@vertexvis/viewer 1.1.1-canary.6 → 1.1.1-testing.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{config-Ca0seD16.js → config-qhB9yOkD.js} +3 -3
- package/dist/cjs/{config-Ca0seD16.js.map → config-qhB9yOkD.js.map} +1 -1
- package/dist/cjs/{entities-CBN2BJKd.js → entities-OgE3KKMo.js} +4 -4
- package/dist/cjs/{entities-CBN2BJKd.js.map → entities-OgE3KKMo.js.map} +1 -1
- package/dist/cjs/{geometry_pb-DS0HM8ls.js → geometry_pb-CJZxK0hh.js} +3 -3
- package/dist/cjs/{geometry_pb-DS0HM8ls.js.map → geometry_pb-CJZxK0hh.js.map} +1 -1
- package/dist/cjs/index.cjs.js +5 -5
- package/dist/cjs/{png-decoder-Dt3IOAnw.js → png-decoder-BTtMRfiW.js} +23 -32
- package/dist/cjs/png-decoder-BTtMRfiW.js.map +1 -0
- package/dist/cjs/{queries-B4oPQ5xP.js → queries-DvkzwhnO.js} +4 -4
- package/dist/cjs/{queries-B4oPQ5xP.js.map → queries-DvkzwhnO.js.map} +1 -1
- package/dist/cjs/{regl-component-DDHBbHhG.js → regl-component-Ctuzdy_i.js} +3 -3
- package/dist/cjs/{regl-component-DDHBbHhG.js.map → regl-component-Ctuzdy_i.js.map} +1 -1
- package/dist/cjs/{representation_pb-_-8GOu4g.js → representation_pb-Cb20_8yP.js} +3 -3
- package/dist/cjs/{representation_pb-_-8GOu4g.js.map → representation_pb-Cb20_8yP.js.map} +1 -1
- package/dist/cjs/{streamAttributes-D4FScmnu.js → streamAttributes-BOGFM4R7.js} +3 -3
- package/dist/cjs/{streamAttributes-D4FScmnu.js.map → streamAttributes-BOGFM4R7.js.map} +1 -1
- package/dist/cjs/tslib.es6-BqRXrZGq.js +40 -0
- package/dist/cjs/{tslib.es6-Bu5Kp4WX.js.map → tslib.es6-BqRXrZGq.js.map} +1 -1
- package/dist/cjs/vertex-scene-tree-notification-banner_4.cjs.entry.js +1 -1
- package/dist/cjs/vertex-scene-tree-table-cell.cjs.entry.js +1 -1
- package/dist/cjs/vertex-scene-tree.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-dom-element_2.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-hit-result-indicator.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-measurement-details.cjs.entry.js +3 -3
- package/dist/cjs/vertex-viewer-measurement-distance.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-measurement-line_2.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-measurement-precise.cjs.entry.js +4 -4
- package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js +3 -3
- package/dist/cjs/vertex-viewer-transform-widget.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-view-cube.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer.cjs.entry.js +4 -4
- package/dist/components/index.js +1 -1
- package/dist/components/{p-Tfg7jao4.js → p-B1EwHtiU.js} +2 -2
- package/dist/components/p-C-NyjLsm.js +5 -0
- package/dist/components/p-C-NyjLsm.js.map +1 -0
- package/dist/components/{p-Be_EPOMu.js → p-CNDZjNd7.js} +2 -2
- package/dist/components/{p-BNanw3eX.js → p-C_5cRYhA.js} +2 -2
- package/dist/components/{p-C-Mdlx-o.js → p-CkYfi_b3.js} +2 -2
- package/dist/components/{p-BQQxciHe.js → p-Dks3EzBM.js} +2 -2
- package/dist/components/{p-DCxPi7ft.js → p-IbLMJcql.js} +2 -2
- package/dist/components/{p-B3jZXFq2.js → p-XydgrVf-.js} +2 -2
- package/dist/components/p-Z7U3o7I4.js +5 -0
- package/dist/components/{p-Cta7kB-G.js → p-ZzS5zTnx.js} +2 -2
- package/dist/components/p-fKH0aLlq.js +5 -0
- package/dist/components/p-fKH0aLlq.js.map +1 -0
- package/dist/components/{p-C6BUwWB4.js → p-hMIHFP5Q.js} +2 -2
- package/dist/components/{p-DpQErze2.js → p-sPEu8FHr.js} +2 -2
- package/dist/components/vertex-scene-tree-table-cell.js +1 -1
- package/dist/components/vertex-scene-tree-table-layout.js +1 -1
- package/dist/components/vertex-scene-tree.js +1 -1
- package/dist/components/vertex-viewer-dom-renderer.js +1 -1
- package/dist/components/vertex-viewer-hit-result-indicator.js +1 -1
- package/dist/components/vertex-viewer-measurement-details.js +1 -1
- package/dist/components/vertex-viewer-measurement-distance.js +1 -1
- package/dist/components/vertex-viewer-measurement-overlays.js +1 -1
- package/dist/components/vertex-viewer-measurement-precise.js +1 -1
- package/dist/components/vertex-viewer-pin-group.js +1 -1
- package/dist/components/vertex-viewer-pin-tool.js +1 -1
- package/dist/components/vertex-viewer-transform-widget.js +1 -1
- package/dist/components/vertex-viewer-transform-widget.js.map +1 -1
- package/dist/components/vertex-viewer-view-cube.js +1 -1
- package/dist/components/vertex-viewer.js +1 -1
- package/dist/esm/{config-BHITDQif.js → config-Dukl2tlT.js} +3 -3
- package/dist/esm/{config-BHITDQif.js.map → config-Dukl2tlT.js.map} +1 -1
- package/dist/esm/{entities-Cj9Pt10J.js → entities-2kVCQNVh.js} +4 -4
- package/dist/esm/{entities-Cj9Pt10J.js.map → entities-2kVCQNVh.js.map} +1 -1
- package/dist/esm/{geometry_pb-EePgefLR.js → geometry_pb-CAxktHWj.js} +3 -3
- package/dist/esm/{geometry_pb-EePgefLR.js.map → geometry_pb-CAxktHWj.js.map} +1 -1
- package/dist/esm/index.js +5 -5
- package/dist/esm/{png-decoder-gMslGChA.js → png-decoder-Dx1E5Sod.js} +23 -32
- package/dist/esm/png-decoder-Dx1E5Sod.js.map +1 -0
- package/dist/esm/{queries-CEfTZHMm.js → queries-DM84n6se.js} +4 -4
- package/dist/esm/{queries-CEfTZHMm.js.map → queries-DM84n6se.js.map} +1 -1
- package/dist/esm/{regl-component-DXn0jg5S.js → regl-component-D-Wlx_GA.js} +3 -3
- package/dist/esm/{regl-component-DXn0jg5S.js.map → regl-component-D-Wlx_GA.js.map} +1 -1
- package/dist/esm/{representation_pb-DdXEMKrs.js → representation_pb-ZzJjYuoD.js} +3 -3
- package/dist/esm/{representation_pb-DdXEMKrs.js.map → representation_pb-ZzJjYuoD.js.map} +1 -1
- package/dist/esm/{streamAttributes-BZnxWMmW.js → streamAttributes-C2mLVHk_.js} +3 -3
- package/dist/esm/{streamAttributes-BZnxWMmW.js.map → streamAttributes-C2mLVHk_.js.map} +1 -1
- package/dist/esm/tslib.es6-C-NyjLsm.js +40 -0
- package/dist/esm/{tslib.es6-BzyVljQN.js.map → tslib.es6-C-NyjLsm.js.map} +1 -1
- package/dist/esm/vertex-scene-tree-notification-banner_4.entry.js +1 -1
- package/dist/esm/vertex-scene-tree-table-cell.entry.js +1 -1
- package/dist/esm/vertex-scene-tree.entry.js +2 -2
- package/dist/esm/vertex-viewer-dom-element_2.entry.js +1 -1
- package/dist/esm/vertex-viewer-hit-result-indicator.entry.js +2 -2
- package/dist/esm/vertex-viewer-measurement-details.entry.js +3 -3
- package/dist/esm/vertex-viewer-measurement-distance.entry.js +2 -2
- package/dist/esm/vertex-viewer-measurement-line_2.entry.js +2 -2
- package/dist/esm/vertex-viewer-measurement-precise.entry.js +4 -4
- package/dist/esm/vertex-viewer-pin-group.entry.js +3 -3
- package/dist/esm/vertex-viewer-transform-widget.entry.js +2 -2
- package/dist/esm/vertex-viewer-view-cube.entry.js +1 -1
- package/dist/esm/vertex-viewer.entry.js +4 -4
- package/dist/viewer/index.esm.js +1 -1
- package/dist/viewer/{p-ad4c1175.entry.js → p-08b86996.entry.js} +2 -2
- package/dist/viewer/{p-b4bbbebf.entry.js → p-10c40a5e.entry.js} +2 -2
- package/dist/viewer/{p-ef596c04.entry.js → p-17e47830.entry.js} +2 -2
- package/dist/viewer/{p-ec49e818.entry.js → p-195297bb.entry.js} +2 -2
- package/dist/viewer/{p-994602a4.entry.js → p-37a7cbe4.entry.js} +2 -2
- package/dist/viewer/{p-9dd4a49a.entry.js → p-484e6990.entry.js} +2 -2
- package/dist/viewer/{p-ffd28212.entry.js → p-4a3a05c7.entry.js} +2 -2
- package/dist/viewer/{p-210f1777.entry.js → p-515eefc1.entry.js} +2 -2
- package/dist/viewer/{p-bfe38f9b.entry.js → p-91b6f9de.entry.js} +2 -2
- package/dist/viewer/{p-c46bf3b1.entry.js → p-9386f89b.entry.js} +2 -2
- package/dist/viewer/{p-75EpAVwy.js → p-Bi9f5zZC.js} +2 -2
- package/dist/viewer/{p-75EpAVwy.js.map → p-Bi9f5zZC.js.map} +1 -1
- package/dist/viewer/p-C-NyjLsm.js +5 -0
- package/dist/viewer/{p-BzyVljQN.js.map → p-C-NyjLsm.js.map} +1 -1
- package/dist/viewer/{p-CT1PhiRV.js → p-CD3U7s8H.js} +2 -2
- package/dist/viewer/{p-CT1PhiRV.js.map → p-CD3U7s8H.js.map} +1 -1
- package/dist/viewer/{p-BFQ1Tt4Y.js → p-Dl2B5rCE.js} +2 -2
- package/dist/viewer/{p-BFQ1Tt4Y.js.map → p-Dl2B5rCE.js.map} +1 -1
- package/dist/{components/p-CMBmMRkF.js → viewer/p-Dt9-9vSd.js} +2 -2
- package/dist/viewer/{p-BIj2SAwD.js.map → p-Dt9-9vSd.js.map} +1 -1
- package/dist/viewer/{p-CT3sclrO.js → p-P0ZprdA-.js} +2 -2
- package/dist/viewer/{p-CT3sclrO.js.map → p-P0ZprdA-.js.map} +1 -1
- package/dist/viewer/{p-2bb26337.entry.js → p-ae4ec0a8.entry.js} +2 -2
- package/dist/viewer/{p-e00839cd.entry.js → p-d709a094.entry.js} +2 -2
- package/dist/viewer/{p-7cb94735.entry.js → p-ef02ec4c.entry.js} +2 -2
- package/dist/viewer/p-fKH0aLlq.js +5 -0
- package/dist/viewer/p-fKH0aLlq.js.map +1 -0
- package/dist/viewer/{p-BnXUpT0J.js → p-fXz1xKOD.js} +2 -2
- package/dist/viewer/{p-BnXUpT0J.js.map → p-fXz1xKOD.js.map} +1 -1
- package/dist/viewer/{p-D4OO4AF0.js → p-vWHX2QSb.js} +2 -2
- package/dist/viewer/{p-D4OO4AF0.js.map → p-vWHX2QSb.js.map} +1 -1
- package/dist/viewer/viewer.esm.js +1 -1
- package/package.json +32 -32
- package/dist/cjs/package.json +0 -3
- package/dist/cjs/png-decoder-Dt3IOAnw.js.map +0 -1
- package/dist/cjs/tslib.es6-Bu5Kp4WX.js +0 -92
- package/dist/components/p-BzyVljQN.js +0 -5
- package/dist/components/p-BzyVljQN.js.map +0 -1
- package/dist/components/p-DaLbXlOV.js +0 -5
- package/dist/components/p-DaLbXlOV.js.map +0 -1
- package/dist/esm/index.mjs +0 -106
- package/dist/esm/loader.mjs +0 -16
- package/dist/esm/png-decoder-gMslGChA.js.map +0 -1
- package/dist/esm/tslib.es6-BzyVljQN.js +0 -88
- package/dist/index.cjs +0 -1
- package/dist/viewer/p-BIj2SAwD.js +0 -5
- package/dist/viewer/p-BzyVljQN.js +0 -5
- package/dist/viewer/p-DaLbXlOV.js +0 -5
- package/dist/viewer/p-DaLbXlOV.js.map +0 -1
- package/loader/index.cjs +0 -4
- /package/dist/components/{p-Tfg7jao4.js.map → p-B1EwHtiU.js.map} +0 -0
- /package/dist/components/{p-Be_EPOMu.js.map → p-CNDZjNd7.js.map} +0 -0
- /package/dist/components/{p-BNanw3eX.js.map → p-C_5cRYhA.js.map} +0 -0
- /package/dist/components/{p-C-Mdlx-o.js.map → p-CkYfi_b3.js.map} +0 -0
- /package/dist/components/{p-BQQxciHe.js.map → p-Dks3EzBM.js.map} +0 -0
- /package/dist/components/{p-DCxPi7ft.js.map → p-IbLMJcql.js.map} +0 -0
- /package/dist/components/{p-B3jZXFq2.js.map → p-XydgrVf-.js.map} +0 -0
- /package/dist/components/{p-CMBmMRkF.js.map → p-Z7U3o7I4.js.map} +0 -0
- /package/dist/components/{p-Cta7kB-G.js.map → p-ZzS5zTnx.js.map} +0 -0
- /package/dist/components/{p-C6BUwWB4.js.map → p-hMIHFP5Q.js.map} +0 -0
- /package/dist/components/{p-DpQErze2.js.map → p-sPEu8FHr.js.map} +0 -0
- /package/dist/viewer/{p-ad4c1175.entry.js.map → p-08b86996.entry.js.map} +0 -0
- /package/dist/viewer/{p-b4bbbebf.entry.js.map → p-10c40a5e.entry.js.map} +0 -0
- /package/dist/viewer/{p-ef596c04.entry.js.map → p-17e47830.entry.js.map} +0 -0
- /package/dist/viewer/{p-ec49e818.entry.js.map → p-195297bb.entry.js.map} +0 -0
- /package/dist/viewer/{p-994602a4.entry.js.map → p-37a7cbe4.entry.js.map} +0 -0
- /package/dist/viewer/{p-9dd4a49a.entry.js.map → p-484e6990.entry.js.map} +0 -0
- /package/dist/viewer/{p-ffd28212.entry.js.map → p-4a3a05c7.entry.js.map} +0 -0
- /package/dist/viewer/{p-210f1777.entry.js.map → p-515eefc1.entry.js.map} +0 -0
- /package/dist/viewer/{p-bfe38f9b.entry.js.map → p-91b6f9de.entry.js.map} +0 -0
- /package/dist/viewer/{p-c46bf3b1.entry.js.map → p-9386f89b.entry.js.map} +0 -0
- /package/dist/viewer/{p-2bb26337.entry.js.map → p-ae4ec0a8.entry.js.map} +0 -0
- /package/dist/viewer/{p-e00839cd.entry.js.map → p-d709a094.entry.js.map} +0 -0
- /package/dist/viewer/{p-7cb94735.entry.js.map → p-ef02ec4c.entry.js.map} +0 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
var bundle = require('./bundle-BLWif0ig.js');
|
|
7
7
|
var events = require('./events-8W8yXGxn.js');
|
|
8
|
-
require('./streamAttributes-
|
|
8
|
+
require('./streamAttributes-BOGFM4R7.js');
|
|
9
9
|
require('./entities-BhIrCJqA.js');
|
|
10
10
|
|
|
11
11
|
const DEFAULT_ANIMATION_DURATION = 500;
|
|
@@ -121,6 +121,6 @@ function validateUrlScheme(networkConfig, field, expectedScheme) {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
exports.parseAndValidateConfig = parseAndValidateConfig;
|
|
124
|
-
//# sourceMappingURL=config-
|
|
124
|
+
//# sourceMappingURL=config-qhB9yOkD.js.map
|
|
125
125
|
|
|
126
|
-
//# sourceMappingURL=config-
|
|
126
|
+
//# sourceMappingURL=config-qhB9yOkD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-Ca0seD16.js","sources":["src/lib/types/animation.ts","src/lib/types/flags.ts","src/lib/types/interactions.ts","src/lib/config.ts"],"sourcesContent":["const DEFAULT_ANIMATION_DURATION = 500;\n\nexport interface Animation {\n milliseconds: number;\n}\n\nexport function create(data: Partial<Animation> = {}): Animation {\n return {\n milliseconds: data.milliseconds || DEFAULT_ANIMATION_DURATION,\n };\n}\n\nexport interface AnimationConfig {\n durationMs: number;\n}\n\nexport const defaultAnimationConfig: AnimationConfig = {\n durationMs: DEFAULT_ANIMATION_DURATION,\n};\n","import { Objects } from '@vertexvis/utils';\n\ntype Flag =\n /**\n * Enables or disables a throttling of image delivery based on detected\n * network conditions.\n */\n | 'throttleFrameDelivery'\n\n /**\n * Enables or disables automatic quality adjustments of rendered frames to\n * improve the performance of delivering frames to the client.\n */\n | 'adaptiveRendering'\n\n /**\n * Enables or disables logging of WS message payloads.\n */\n | 'logWsMessages'\n\n /**\n * Toggles the logging of frame rates.\n */\n | 'logFrameRate'\n\n /**\n * Enables or disables the letterboxing of frames when the host dimensions\n * are larger than the supported maximum image size (1080p). By default\n * this option is disabled, and images will be scaled up to match the host.\n */\n | 'letterboxFrames'\n\n /**\n * Enables or disables the use of the `grpc.WebsocketTransport` for streaming\n * RPCs. By default this transport will be used, and streaming messages will\n * be sent over WebSocket.\n */\n | 'grpcUseStreamingWebSocketTransport';\n\n/**\n * A set of experimental features that can be enabled through the viewer's\n * config.\n */\nexport type Flags = { [K in Flag]: boolean };\n\nexport const defaultFlags: Flags = {\n throttleFrameDelivery: true,\n adaptiveRendering: true,\n logWsMessages: false,\n logFrameRate: false,\n letterboxFrames: false,\n grpcUseStreamingWebSocketTransport: true,\n};\n\nexport function createFlags(\n features: Partial<Flags>,\n fallbacks: Partial<Flags> = defaultFlags,\n): Flags {\n return Objects.defaults(features, fallbacks, defaultFlags);\n}\n","export interface InteractionConfig {\n /**\n * The amount of movement required with a fine (mouse, trackpad, etc) pointer\n * input before an interaction is considered a movement that will update the\n * camera. This threshold is always scaled up based on the device's pixel ratio.\n */\n finePointerThreshold: number;\n\n /**\n * The amount of movement required with a coarse (touch, stylus, etc) pointer\n * input before an interaction is considered a movement that will update the\n * camera. This threshold is always scaled up based on the device's pixel ratio.\n */\n coarsePointerThreshold: number;\n\n /**\n * The amount of time before a movement is considered an interaction and will\n * update the camera.\n */\n interactionDelay: number;\n\n /**\n * Whether the `zoomCameraToPoint` interaction through the `InteractionApiPerspective`\n * will enforce a minimum distance when moving the camera. When set, the camera will be\n * able to move through geometry under the cursor, rather than being restricted by the\n * point under the cursor. Defaults to `true`.\n */\n useMinimumPerspectiveZoomDistance: boolean;\n\n /**\n * The amount of time before a wheel interaction is ended.\n *\n * This delay is used to support successive sets of mouse events, and not cause\n * abrupt and unexpected ending of mouse interactions during natural pauses in mouse\n * wheel usage.\n */\n mouseWheelInteractionEndDebounce: number;\n\n /**\n * Reverses which direction the mouse wheel considers positive or negative\n * for zoom interactions.\n */\n reverseMouseWheelDirection: boolean;\n}\n\nexport const defaultInteractionConfig: InteractionConfig = {\n finePointerThreshold: 1,\n coarsePointerThreshold: 3,\n interactionDelay: 75,\n useMinimumPerspectiveZoomDistance: true,\n mouseWheelInteractionEndDebounce: 400,\n reverseMouseWheelDirection: false,\n};\n","import { FrameDeliverySettings } from '@vertexvis/stream-api';\nimport {\n AdaptiveRenderingSettings,\n QualityOfServiceSettings,\n} from '@vertexvis/stream-api';\nimport { DeepPartial, Objects } from '@vertexvis/utils';\n\nimport { Environment } from './environment';\nimport { Animation, Events, Flags, Interactions } from './types';\n\ninterface NetworkConfig {\n apiHost: string;\n renderingHost: string;\n sceneTreeHost: string;\n sceneViewHost: string;\n}\n\nexport interface Config {\n network: NetworkConfig;\n flags: Flags.Flags;\n events: Events.EventConfig;\n animation: Animation.AnimationConfig;\n interactions: Interactions.InteractionConfig;\n EXPERIMENTAL_frameDelivery: Omit<\n FrameDeliverySettings,\n 'rateLimitingEnabled'\n >;\n EXPERIMENTAL_adaptiveRendering: Omit<AdaptiveRenderingSettings, 'enabled'>;\n EXPERIMENTAL_qualityOfService: QualityOfServiceSettings;\n EXPERIMENTAL_annotationPollingIntervalInMs: number | undefined;\n}\n\nexport type PartialConfig = DeepPartial<Config>;\n\nexport type ConfigProvider = () => Config;\n\nexport type InteractionConfigProvider = () => Interactions.InteractionConfig;\n\nconst config: Config = {\n network: {\n apiHost: 'https://platform.platprod.vertexvis.io',\n renderingHost: 'wss://stream.platprod.vertexvis.io',\n sceneTreeHost: 'https://scene-trees.platprod.vertexvis.io',\n sceneViewHost: 'https://scenes.platprod.vertexvis.io',\n },\n flags: Flags.defaultFlags,\n events: Events.defaultEventConfig,\n animation: Animation.defaultAnimationConfig,\n interactions: Interactions.defaultInteractionConfig,\n EXPERIMENTAL_frameDelivery: {},\n EXPERIMENTAL_adaptiveRendering: {},\n EXPERIMENTAL_qualityOfService: {},\n EXPERIMENTAL_annotationPollingIntervalInMs: undefined,\n};\n\nconst platdevConfig: Config = {\n ...config,\n network: {\n apiHost: 'https://platform.platdev.vertexvis.io',\n renderingHost: 'wss://stream.platdev.vertexvis.io',\n sceneTreeHost: 'https://scene-trees.platdev.vertexvis.io',\n sceneViewHost: 'https://scenes.platdev.vertexvis.io',\n },\n};\n\nconst platstagingConfig: Config = {\n ...config,\n network: {\n apiHost: 'https://platform.platstaging.vertexvis.io',\n renderingHost: 'wss://stream.platstaging.vertexvis.io',\n sceneTreeHost: 'https://scene-trees.platstaging.vertexvis.io',\n sceneViewHost: 'https://scenes.platstaging.vertexvis.io',\n },\n};\n\nfunction getEnvironmentConfig(environment: Environment): Config {\n switch (environment) {\n case 'platdev':\n return platdevConfig;\n case 'platstaging':\n return platstagingConfig;\n default:\n return config;\n }\n}\n\nexport function parseAndValidateConfig(\n environment: Environment = 'platprod',\n config?: string | PartialConfig,\n): Config {\n const parsed = parseConfig(environment, config);\n\n return validateConfig(sanitizeConfig(parsed));\n}\n\nexport function parseConfig(\n environment: Environment = 'platprod',\n config?: string | PartialConfig,\n): Config {\n if (typeof config === 'string') {\n config = JSON.parse(config) as PartialConfig;\n }\n\n const envConfig = getEnvironmentConfig(environment);\n\n if (config == null) {\n return envConfig;\n } else {\n return Objects.defaults({ ...config }, envConfig);\n }\n}\n\nexport function sanitizeConfig(config: Config): Config {\n const sanitizedApiHost = config.network.apiHost.trim();\n const sanitizedRenderingHost = config.network.renderingHost.trim();\n const sanitizedSceneTreeHost = config.network.sceneTreeHost.trim();\n const sanitizedSceneViewHost = config.network.sceneViewHost.trim();\n\n return {\n ...config,\n network: {\n ...config.network,\n apiHost: sanitizedApiHost,\n renderingHost: sanitizedRenderingHost,\n sceneTreeHost: sanitizedSceneTreeHost,\n sceneViewHost: sanitizedSceneViewHost,\n },\n };\n}\n\nexport function validateConfig(config: Config): Config {\n validateUrlScheme(config.network, 'apiHost', 'https://');\n validateUrlScheme(config.network, 'renderingHost', 'wss://');\n validateUrlScheme(config.network, 'sceneTreeHost', 'https://');\n validateUrlScheme(config.network, 'sceneViewHost', 'https://');\n\n return config;\n}\n\nfunction validateUrlScheme(\n networkConfig: NetworkConfig,\n field: keyof NetworkConfig,\n expectedScheme: string,\n): void {\n if (!networkConfig[field].startsWith(expectedScheme)) {\n throw new Error(\n `Invalid ${field} \"${networkConfig[field]}\" specified. The URL must start with the ${expectedScheme} scheme.`,\n );\n }\n}\n"],"names":["Flags.defaultFlags","Events.defaultEventConfig","Animation.defaultAnimationConfig","Interactions.defaultInteractionConfig","Objects"],"mappings":";;;;;;;;;;AAAA,MAAM,0BAA0B,GAAG,GAAG;AAgB/B,MAAM,sBAAsB,GAAoB;AACrD,IAAA,UAAU,EAAE,0BAA0B;CACvC;;AC2BM,MAAM,YAAY,GAAU;AACjC,IAAA,qBAAqB,EAAE,IAAI;AAC3B,IAAA,iBAAi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AO,EAAE,gBAAgB;AACzB,YAAA,aAAa,EAAE,sBAAsB;AACrC,YAAA,aAAa,EAAE,sBAAsB;AACrC,YAAA,aAAa,EAAE,sBAAsB;AACtC,SAAA;KACF;AACH;AAEM,SAAU,cAAc,CAAC,MAAc,EAAA;IAC3C,iBAAiB,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC;IACxD,iBAAiB,CAAC,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,CAAC;IAC5D,iBAAiB,CAAC,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,UAAU,CAAC;IAC9D,iBAAiB,CAAC,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,UAAU,CAAC;AAE9D,IAAA,OAAO,MAAM;AACf;AAEA,SAAS,iBAAiB,CACxB,aAA4B,EAC5B,KAA0B,EAC1B,cAAsB,EAAA;IAEtB,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE;AACpD,QAAA,MAAM,IAAI,KAAK,CACb,CAAA,QAAA,EAAW,KAAK,CAAA,EAAA,EAAK,aAAa,CAAC,KAAK,CAAC,CAAA,yCAAA,EAA4C,cAAc,CAAA,QAAA,CAAU,CAC9G;;AAEL;;;;"}
|
|
1
|
+
{"version":3,"file":"config-qhB9yOkD.js","sources":["src/lib/types/animation.ts","src/lib/types/flags.ts","src/lib/types/interactions.ts","src/lib/config.ts"],"sourcesContent":["const DEFAULT_ANIMATION_DURATION = 500;\n\nexport interface Animation {\n milliseconds: number;\n}\n\nexport function create(data: Partial<Animation> = {}): Animation {\n return {\n milliseconds: data.milliseconds || DEFAULT_ANIMATION_DURATION,\n };\n}\n\nexport interface AnimationConfig {\n durationMs: number;\n}\n\nexport const defaultAnimationConfig: AnimationConfig = {\n durationMs: DEFAULT_ANIMATION_DURATION,\n};\n","import { Objects } from '@vertexvis/utils';\n\ntype Flag =\n /**\n * Enables or disables a throttling of image delivery based on detected\n * network conditions.\n */\n | 'throttleFrameDelivery'\n\n /**\n * Enables or disables automatic quality adjustments of rendered frames to\n * improve the performance of delivering frames to the client.\n */\n | 'adaptiveRendering'\n\n /**\n * Enables or disables logging of WS message payloads.\n */\n | 'logWsMessages'\n\n /**\n * Toggles the logging of frame rates.\n */\n | 'logFrameRate'\n\n /**\n * Enables or disables the letterboxing of frames when the host dimensions\n * are larger than the supported maximum image size (1080p). By default\n * this option is disabled, and images will be scaled up to match the host.\n */\n | 'letterboxFrames'\n\n /**\n * Enables or disables the use of the `grpc.WebsocketTransport` for streaming\n * RPCs. By default this transport will be used, and streaming messages will\n * be sent over WebSocket.\n */\n | 'grpcUseStreamingWebSocketTransport';\n\n/**\n * A set of experimental features that can be enabled through the viewer's\n * config.\n */\nexport type Flags = { [K in Flag]: boolean };\n\nexport const defaultFlags: Flags = {\n throttleFrameDelivery: true,\n adaptiveRendering: true,\n logWsMessages: false,\n logFrameRate: false,\n letterboxFrames: false,\n grpcUseStreamingWebSocketTransport: true,\n};\n\nexport function createFlags(\n features: Partial<Flags>,\n fallbacks: Partial<Flags> = defaultFlags,\n): Flags {\n return Objects.defaults(features, fallbacks, defaultFlags);\n}\n","export interface InteractionConfig {\n /**\n * The amount of movement required with a fine (mouse, trackpad, etc) pointer\n * input before an interaction is considered a movement that will update the\n * camera. This threshold is always scaled up based on the device's pixel ratio.\n */\n finePointerThreshold: number;\n\n /**\n * The amount of movement required with a coarse (touch, stylus, etc) pointer\n * input before an interaction is considered a movement that will update the\n * camera. This threshold is always scaled up based on the device's pixel ratio.\n */\n coarsePointerThreshold: number;\n\n /**\n * The amount of time before a movement is considered an interaction and will\n * update the camera.\n */\n interactionDelay: number;\n\n /**\n * Whether the `zoomCameraToPoint` interaction through the `InteractionApiPerspective`\n * will enforce a minimum distance when moving the camera. When set, the camera will be\n * able to move through geometry under the cursor, rather than being restricted by the\n * point under the cursor. Defaults to `true`.\n */\n useMinimumPerspectiveZoomDistance: boolean;\n\n /**\n * The amount of time before a wheel interaction is ended.\n *\n * This delay is used to support successive sets of mouse events, and not cause\n * abrupt and unexpected ending of mouse interactions during natural pauses in mouse\n * wheel usage.\n */\n mouseWheelInteractionEndDebounce: number;\n\n /**\n * Reverses which direction the mouse wheel considers positive or negative\n * for zoom interactions.\n */\n reverseMouseWheelDirection: boolean;\n}\n\nexport const defaultInteractionConfig: InteractionConfig = {\n finePointerThreshold: 1,\n coarsePointerThreshold: 3,\n interactionDelay: 75,\n useMinimumPerspectiveZoomDistance: true,\n mouseWheelInteractionEndDebounce: 400,\n reverseMouseWheelDirection: false,\n};\n","import { FrameDeliverySettings } from '@vertexvis/stream-api';\nimport {\n AdaptiveRenderingSettings,\n QualityOfServiceSettings,\n} from '@vertexvis/stream-api';\nimport { DeepPartial, Objects } from '@vertexvis/utils';\n\nimport { Environment } from './environment';\nimport { Animation, Events, Flags, Interactions } from './types';\n\ninterface NetworkConfig {\n apiHost: string;\n renderingHost: string;\n sceneTreeHost: string;\n sceneViewHost: string;\n}\n\nexport interface Config {\n network: NetworkConfig;\n flags: Flags.Flags;\n events: Events.EventConfig;\n animation: Animation.AnimationConfig;\n interactions: Interactions.InteractionConfig;\n EXPERIMENTAL_frameDelivery: Omit<\n FrameDeliverySettings,\n 'rateLimitingEnabled'\n >;\n EXPERIMENTAL_adaptiveRendering: Omit<AdaptiveRenderingSettings, 'enabled'>;\n EXPERIMENTAL_qualityOfService: QualityOfServiceSettings;\n EXPERIMENTAL_annotationPollingIntervalInMs: number | undefined;\n}\n\nexport type PartialConfig = DeepPartial<Config>;\n\nexport type ConfigProvider = () => Config;\n\nexport type InteractionConfigProvider = () => Interactions.InteractionConfig;\n\nconst config: Config = {\n network: {\n apiHost: 'https://platform.platprod.vertexvis.io',\n renderingHost: 'wss://stream.platprod.vertexvis.io',\n sceneTreeHost: 'https://scene-trees.platprod.vertexvis.io',\n sceneViewHost: 'https://scenes.platprod.vertexvis.io',\n },\n flags: Flags.defaultFlags,\n events: Events.defaultEventConfig,\n animation: Animation.defaultAnimationConfig,\n interactions: Interactions.defaultInteractionConfig,\n EXPERIMENTAL_frameDelivery: {},\n EXPERIMENTAL_adaptiveRendering: {},\n EXPERIMENTAL_qualityOfService: {},\n EXPERIMENTAL_annotationPollingIntervalInMs: undefined,\n};\n\nconst platdevConfig: Config = {\n ...config,\n network: {\n apiHost: 'https://platform.platdev.vertexvis.io',\n renderingHost: 'wss://stream.platdev.vertexvis.io',\n sceneTreeHost: 'https://scene-trees.platdev.vertexvis.io',\n sceneViewHost: 'https://scenes.platdev.vertexvis.io',\n },\n};\n\nconst platstagingConfig: Config = {\n ...config,\n network: {\n apiHost: 'https://platform.platstaging.vertexvis.io',\n renderingHost: 'wss://stream.platstaging.vertexvis.io',\n sceneTreeHost: 'https://scene-trees.platstaging.vertexvis.io',\n sceneViewHost: 'https://scenes.platstaging.vertexvis.io',\n },\n};\n\nfunction getEnvironmentConfig(environment: Environment): Config {\n switch (environment) {\n case 'platdev':\n return platdevConfig;\n case 'platstaging':\n return platstagingConfig;\n default:\n return config;\n }\n}\n\nexport function parseAndValidateConfig(\n environment: Environment = 'platprod',\n config?: string | PartialConfig,\n): Config {\n const parsed = parseConfig(environment, config);\n\n return validateConfig(sanitizeConfig(parsed));\n}\n\nexport function parseConfig(\n environment: Environment = 'platprod',\n config?: string | PartialConfig,\n): Config {\n if (typeof config === 'string') {\n config = JSON.parse(config) as PartialConfig;\n }\n\n const envConfig = getEnvironmentConfig(environment);\n\n if (config == null) {\n return envConfig;\n } else {\n return Objects.defaults({ ...config }, envConfig);\n }\n}\n\nexport function sanitizeConfig(config: Config): Config {\n const sanitizedApiHost = config.network.apiHost.trim();\n const sanitizedRenderingHost = config.network.renderingHost.trim();\n const sanitizedSceneTreeHost = config.network.sceneTreeHost.trim();\n const sanitizedSceneViewHost = config.network.sceneViewHost.trim();\n\n return {\n ...config,\n network: {\n ...config.network,\n apiHost: sanitizedApiHost,\n renderingHost: sanitizedRenderingHost,\n sceneTreeHost: sanitizedSceneTreeHost,\n sceneViewHost: sanitizedSceneViewHost,\n },\n };\n}\n\nexport function validateConfig(config: Config): Config {\n validateUrlScheme(config.network, 'apiHost', 'https://');\n validateUrlScheme(config.network, 'renderingHost', 'wss://');\n validateUrlScheme(config.network, 'sceneTreeHost', 'https://');\n validateUrlScheme(config.network, 'sceneViewHost', 'https://');\n\n return config;\n}\n\nfunction validateUrlScheme(\n networkConfig: NetworkConfig,\n field: keyof NetworkConfig,\n expectedScheme: string,\n): void {\n if (!networkConfig[field].startsWith(expectedScheme)) {\n throw new Error(\n `Invalid ${field} \"${networkConfig[field]}\" specified. The URL must start with the ${expectedScheme} scheme.`,\n );\n }\n}\n"],"names":["Flags.defaultFlags","Events.defaultEventConfig","Animation.defaultAnimationConfig","Interactions.defaultInteractionConfig","Objects"],"mappings":";;;;;;;;;;AAAA,MAAM,0BAA0B,GAAG,GAAG;AAgB/B,MAAM,sBAAsB,GAAoB;AACrD,IAAA,UAAU,EAAE,0BAA0B;CACvC;;AC2BM,MAAM,YAAY,GAAU;AACjC,IAAA,qBAAqB,EAAE,IAAI;AAC3B,IAAA,iBAAiB,EAAE,IAAI;AACvB,IAAA,aAAa,EAAE,KAAK;AACpB,IAAA,YAAY,EAAE,KAAK;AACnB,IAAA,eAAe,EAAE,KAAK;AACtB,IAAA,kCAAkC,EAAE,IAAI;CACzC;;ACPM,MAAM,wBAAwB,GAAsB;AACzD,IAAA,oBAAoB,EAAE,CAAC;AACvB,IAAA,sBAAsB,EAAE,CAAC;AACzB,IAAA,gBAAgB,EAAE,EAAE;AACpB,IAAA,iCAAiC,EAAE,IAAI;AACvC,IAAA,gCAAgC,EAAE,GAAG;AACrC,IAAA,0BAA0B,EAAE,KAAK;CAClC;;ACdD,MAAM,MAAM,GAAW;AACrB,IAAA,OAAO,EAAE;AACP,QAAA,OAAO,EAAE,wCAAwC;AACjD,QAAA,aAAa,EAAE,oCAAoC;AACnD,QAAA,aAAa,EAAE,2CAA2C;AAC1D,QAAA,aAAa,EAAE,sCA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AA;IAEtB,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE;AACpD,QAAA,MAAM,IAAI,KAAK,CACb,CAAA,QAAA,EAAW,KAAK,CAAA,EAAA,EAAK,aAAa,CAAC,KAAK,CAAC,CAAA,yCAAA,EAA4C,cAAc,CAAA,QAAA,CAAU,CAC9G;;AAEL;;;;"}
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
|
-
var geometry_pb = require('./geometry_pb-
|
|
6
|
+
var geometry_pb = require('./geometry_pb-CJZxK0hh.js');
|
|
7
7
|
var wrappers_pb = require('./wrappers_pb-Dupo3Hcb.js');
|
|
8
8
|
var grpc = require('./grpc-D5Apx_zz.js');
|
|
9
9
|
var bundle$1 = require('./bundle-CJoxPtdL.js');
|
|
10
10
|
var bundle = require('./bundle-BLWif0ig.js');
|
|
11
|
-
var streamAttributes = require('./streamAttributes-
|
|
11
|
+
var streamAttributes = require('./streamAttributes-BOGFM4R7.js');
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* The `MeasurementController` is responsible for performing measurements of
|
|
@@ -176,6 +176,6 @@ class MeasurementEntity {
|
|
|
176
176
|
|
|
177
177
|
exports.MeasurementController = MeasurementController;
|
|
178
178
|
exports.MeasurementEntity = MeasurementEntity;
|
|
179
|
-
//# sourceMappingURL=entities-
|
|
179
|
+
//# sourceMappingURL=entities-OgE3KKMo.js.map
|
|
180
180
|
|
|
181
|
-
//# sourceMappingURL=entities-
|
|
181
|
+
//# sourceMappingURL=entities-OgE3KKMo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entities-CBN2BJKd.js","sources":["src/lib/measurement/controller.ts","src/lib/measurement/entities.ts"],"sourcesContent":["import { ModelEntity } from '@vertexvis/scene-view-protos/core/protos/model_entity_pb';\nimport {\n MeasureRequest,\n MeasureResponse,\n ModelEntityUpdate,\n UpdateModelEntitiesRequest,\n} from '@vertexvis/scene-view-protos/sceneview/protos/scene_view_api_pb';\nimport { SceneViewAPIClient } from '@vertexvis/scene-view-protos/sceneview/protos/scene_view_api_pb_service';\nimport { BoolValue } from 'google-protobuf/google/protobuf/wrappers_pb';\n\nimport { createMetadata, JwtProvider, requestUnary } from '../grpc';\nimport { MeasurementEntity } from './entities';\nimport { mapMeasureResponseOrThrow } from './mapper';\nimport { MeasurementModel } from './model';\nimport { MeasurementOutcome } from './outcomes';\n\n/**\n * The `MeasurementController` is responsible for performing measurements of\n * registered entities, and updating the model with their measurement results.\n */\nexport class MeasurementController {\n private outcome = Promise.resolve<MeasurementOutcome | undefined>(undefined);\n private debugLogs = false;\n\n public constructor(\n private model: MeasurementModel,\n private client: SceneViewAPIClient,\n private jwtProvider: JwtProvider,\n private deviceId: string | undefined,\n ) {}\n\n /**\n * Registers an entity to measure and performs a measurement if this entity\n * has not been previously registered.\n *\n * @param entity The entity to measure.\n * @returns A promise that resolves with the results after registering this\n * entity.\n */\n public addEntity(\n entity: MeasurementEntity,\n ): Promise<MeasurementOutcome | undefined> {\n if (this.debugLogs) {\n const deserializedEntity = ModelEntity.deserializeBinary(\n entity.modelEntity,\n );\n\n this.log(\n `Adding ModelEntity. [entityId={${deserializedEntity.getEntityId()}}, sceneItemId={${deserializedEntity.getSceneItemId()}}]`,\n );\n }\n\n return this.performMeasurement(() => this.model.addEntity(entity));\n }\n\n /**\n * Clears all entities and returns a promise that resolves with an empty list\n * of measurement results.\n */\n public clearEntities(): Promise<MeasurementOutcome | undefined> {\n this.log('Clearing all ModelEntities.');\n\n return this.performMeasurement(() => {\n this.model.clearEntities();\n this.model.clearOutcome();\n return true;\n });\n }\n\n /**\n * Deregisters an entity and performs a measurement if this entity was\n * removed.\n *\n * @param entity The entity to remove.\n * @returns A promise that resolves with the results after removing this\n * entity.\n */\n public removeEntity(\n entity: MeasurementEntity,\n ): Promise<MeasurementOutcome | undefined> {\n if (this.debugLogs) {\n const deserializedEntity = ModelEntity.deserializeBinary(\n entity.modelEntity,\n );\n\n this.log(\n `Removing ModelEntity. [entityId={${deserializedEntity.getEntityId()}}, sceneItemId={${deserializedEntity.getSceneItemId()}}]`,\n );\n }\n\n return this.performMeasurement(() => this.model.removeEntity(entity));\n }\n\n /**\n * Registers a set of entities and performs a measurement\n *\n * @param entities The entities to measure.\n * @returns A promise that resolves with the results after registering these\n * entities.\n */\n public setEntities(\n entities: Set<MeasurementEntity>,\n ): Promise<MeasurementOutcome | undefined> {\n if (this.debugLogs) {\n const deserializedEntities = Array.from(entities).map((e) =>\n ModelEntity.deserializeBinary(e.modelEntity),\n );\n\n this.log(\n `Setting ${deserializedEntities.length} ModelEntities. [entityIds=[${deserializedEntities.map((e) => e.getEntityId()).join(', ')}], sceneItemIds=[${deserializedEntities.map((e) => e.getSceneItemId()).join(', ')}]]`,\n );\n }\n\n return this.performMeasurement(() => this.model.setEntities(entities));\n }\n\n public setDebugLogs(debugLogs: boolean): void {\n this.debugLogs = debugLogs;\n }\n\n private performMeasurement(\n effect: () => boolean,\n ): Promise<MeasurementOutcome | undefined> {\n const previous = this.model.getEntities();\n const changed = effect();\n const entities = this.model.getEntities();\n if (changed) {\n this.measureAndUpdateModel(entities);\n this.highlightEntities(previous, entities);\n }\n return this.outcome;\n }\n\n private measureAndUpdateModel(entities: MeasurementEntity[]): void {\n if (entities.length > 0) {\n this.outcome = this.measureEntities(entities).then((outcome) => {\n this.model.setOutcome(outcome);\n return this.model.getOutcome();\n });\n } else {\n this.outcome = Promise.resolve(undefined);\n }\n }\n\n private async measureEntities(\n entities: MeasurementEntity[],\n ): Promise<MeasurementOutcome | undefined> {\n if (entities.length > 0) {\n const res = await requestUnary<MeasureResponse>(async (handler) => {\n const meta = await createMetadata(this.jwtProvider, this.deviceId);\n const req = new MeasureRequest();\n req.setEntitiesList(entities.map((e) => e.toProto()));\n\n this.client.measure(req, meta, handler);\n });\n\n return mapMeasureResponseOrThrow(res.toObject());\n } else {\n return undefined;\n }\n }\n\n private async highlightEntities(\n previous: MeasurementEntity[],\n entities: MeasurementEntity[],\n ): Promise<void> {\n await requestUnary(async (handler) => {\n const meta = await createMetadata(this.jwtProvider, this.deviceId);\n\n const entitySet = new Set(entities);\n const newPrevious = previous.filter((e) => !entitySet.has(e));\n\n const clearEntities = newPrevious.map((e) => {\n const update = new ModelEntityUpdate();\n update.setModelEntity(ModelEntity.deserializeBinary(e.modelEntity));\n update.setHighlight(new BoolValue().setValue(false));\n return update;\n });\n const highlightEntities = entities.map((e) => {\n const update = new ModelEntityUpdate();\n update.setModelEntity(ModelEntity.deserializeBinary(e.modelEntity));\n update.setHighlight(new BoolValue().setValue(true));\n return update;\n });\n\n const req = new UpdateModelEntitiesRequest();\n req.setUpdatesList([...clearEntities, ...highlightEntities]);\n this.client.updateModelEntities(req, meta, handler);\n });\n }\n\n private log(message?: string, ...optionalParams: unknown[]): void {\n if (this.debugLogs) {\n console.debug(message, optionalParams);\n }\n }\n}\n","import { vertexvis } from '@vertexvis/frame-streaming-protos';\nimport { Vector3 } from '@vertexvis/geometry';\nimport { Vector3f } from '@vertexvis/scene-view-protos/core/protos/geometry_pb';\nimport { ModelEntity } from '@vertexvis/scene-view-protos/core/protos/model_entity_pb';\nimport { MeasureEntity } from '@vertexvis/scene-view-protos/sceneview/protos/scene_view_api_pb';\nimport { Mapper } from '@vertexvis/utils';\n\nimport { fromPbVector3f } from '../mappers';\n\nexport class MeasurementEntity {\n public constructor(\n public readonly point: Vector3.Vector3,\n public readonly modelEntity: Uint8Array,\n ) {}\n\n public static fromHit(\n hit: vertexvis.protobuf.stream.IHit,\n ): MeasurementEntity {\n if (hit.hitPoint != null && hit.modelEntity != null) {\n const hitPoint = Mapper.ifInvalidThrow(fromPbVector3f)(hit.hitPoint);\n const modelEntity = vertexvis.protobuf.core.ModelEntity.encode(\n hit.modelEntity,\n ).finish();\n return new MeasurementEntity(hitPoint, modelEntity);\n } else {\n throw new Error(\n 'Cannot create MeasurementEntity from Hit. Hit is missing hit point and model entity',\n );\n }\n }\n\n public toProto(): MeasureEntity {\n const entity = new MeasureEntity();\n\n const point = new Vector3f();\n point.setX(this.point.x);\n point.setY(this.point.y);\n point.setZ(this.point.z);\n entity.setPoint(point);\n\n const modelEntity = ModelEntity.deserializeBinary(this.modelEntity);\n entity.setModelEntity(modelEntity);\n\n return entity;\n }\n}\n"],"names":["ModelEntity","requestUnary","createMetadata","MeasureRequest","mapMeasureResponseOrThrow","ModelEntityUpdate","BoolValue","UpdateModelEntitiesRequest","Mapper","fromPbVector3f","vertexvis","MeasureEntity","Vector3f"],"mappings":";;;;;;;;;;;;AAgBA;;;AAGG;MACU,qBAAqB,CAAA;AAIhC,IAAA,WAAA,CACU,KAAuB,EACvB,MAA0B,EAC1B,WAAwB,EACxB,QAA4B,EAAA;AAH5B,QAAA,IAAA,CAAA,KAAK,GAAL,KAAK;AACL,QAAA,IAAA,CAAA,MAAM,GAAN,MAAM;AACN,QAAA,IAAA,CAAA,WAAW,GAAX,WAAW;AACX,QAAA,IAAA,CAAA,QAAQ,GAAR,QAAQ;QAPV,IAAA,CAAA,OAAO,GAAG,OAAO,CAAC,OAAO,CAAiC,SAAS,CAAC;AACpE,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK;;AASzB;;;;;;;AAOG;AACI,IAAA,SAAS,CACd,MAAyB,EAAA;AAEzB,QAAA,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,MAAM,kBAAkB,GAAGA,8CAAW,CAAC,iBAAiB,CACtD,MAAM,CAAC,WAAW,CACnB;AAED,YAAA,IAAI,CAAC,GAAG,CACN,CAAA,+BAAA,EAAkC,kBAAkB,CAAC,WAAW,EAAE,CAAA,gBAAA,EAAmB,kBAAkB,CAAC,cAAc,EAAE,CAAA,EAAA,CAAI,CAC7H;;AAGH,QAAA,OAAO,IAAI,CAAC,kBAAkB,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;;AAGpE;;;AAGG;IAC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AAA,OAAO,IAAI,iBAAiB,CAAC,QAAQ,EAAE,WAAW,CAAC;;aAC9C;AACL,YAAA,MAAM,IAAI,KAAK,CACb,qFAAqF,CACtF;;;IAIE,OAAO,GAAA;AACZ,QAAA,MAAM,MAAM,GAAG,IAAIC,kDAAa,EAAE;AAElC,QAAA,MAAM,KAAK,GAAG,IAAIC,uCAAQ,EAAE;QAC5B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AACxB,QAAA,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAEtB,MAAM,WAAW,GAAGZ,8CAAW,CAAC,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC;AACnE,QAAA,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC;AAElC,QAAA,OAAO,MAAM;;AAEhB;;;;;"}
|
|
1
|
+
{"version":3,"file":"entities-OgE3KKMo.js","sources":["src/lib/measurement/controller.ts","src/lib/measurement/entities.ts"],"sourcesContent":["import { ModelEntity } from '@vertexvis/scene-view-protos/core/protos/model_entity_pb';\nimport {\n MeasureRequest,\n MeasureResponse,\n ModelEntityUpdate,\n UpdateModelEntitiesRequest,\n} from '@vertexvis/scene-view-protos/sceneview/protos/scene_view_api_pb';\nimport { SceneViewAPIClient } from '@vertexvis/scene-view-protos/sceneview/protos/scene_view_api_pb_service';\nimport { BoolValue } from 'google-protobuf/google/protobuf/wrappers_pb';\n\nimport { createMetadata, JwtProvider, requestUnary } from '../grpc';\nimport { MeasurementEntity } from './entities';\nimport { mapMeasureResponseOrThrow } from './mapper';\nimport { MeasurementModel } from './model';\nimport { MeasurementOutcome } from './outcomes';\n\n/**\n * The `MeasurementController` is responsible for performing measurements of\n * registered entities, and updating the model with their measurement results.\n */\nexport class MeasurementController {\n private outcome = Promise.resolve<MeasurementOutcome | undefined>(undefined);\n private debugLogs = false;\n\n public constructor(\n private model: MeasurementModel,\n private client: SceneViewAPIClient,\n private jwtProvider: JwtProvider,\n private deviceId: string | undefined,\n ) {}\n\n /**\n * Registers an entity to measure and performs a measurement if this entity\n * has not been previously registered.\n *\n * @param entity The entity to measure.\n * @returns A promise that resolves with the results after registering this\n * entity.\n */\n public addEntity(\n entity: MeasurementEntity,\n ): Promise<MeasurementOutcome | undefined> {\n if (this.debugLogs) {\n const deserializedEntity = ModelEntity.deserializeBinary(\n entity.modelEntity,\n );\n\n this.log(\n `Adding ModelEntity. [entityId={${deserializedEntity.getEntityId()}}, sceneItemId={${deserializedEntity.getSceneItemId()}}]`,\n );\n }\n\n return this.performMeasurement(() => this.model.addEntity(entity));\n }\n\n /**\n * Clears all entities and returns a promise that resolves with an empty list\n * of measurement results.\n */\n public clearEntities(): Promise<MeasurementOutcome | undefined> {\n this.log('Clearing all ModelEntities.');\n\n return this.performMeasurement(() => {\n this.model.clearEntities();\n this.model.clearOutcome();\n return true;\n });\n }\n\n /**\n * Deregisters an entity and performs a measurement if this entity was\n * removed.\n *\n * @param entity The entity to remove.\n * @returns A promise that resolves with the results after removing this\n * entity.\n */\n public removeEntity(\n entity: MeasurementEntity,\n ): Promise<MeasurementOutcome | undefined> {\n if (this.debugLogs) {\n const deserializedEntity = ModelEntity.deserializeBinary(\n entity.modelEntity,\n );\n\n this.log(\n `Removing ModelEntity. [entityId={${deserializedEntity.getEntityId()}}, sceneItemId={${deserializedEntity.getSceneItemId()}}]`,\n );\n }\n\n return this.performMeasurement(() => this.model.removeEntity(entity));\n }\n\n /**\n * Registers a set of entities and performs a measurement\n *\n * @param entities The entities to measure.\n * @returns A promise that resolves with the results after registering these\n * entities.\n */\n public setEntities(\n entities: Set<MeasurementEntity>,\n ): Promise<MeasurementOutcome | undefined> {\n if (this.debugLogs) {\n const deserializedEntities = Array.from(entities).map((e) =>\n ModelEntity.deserializeBinary(e.modelEntity),\n );\n\n this.log(\n `Setting ${deserializedEntities.length} ModelEntities. [entityIds=[${deserializedEntities.map((e) => e.getEntityId()).join(', ')}], sceneItemIds=[${deserializedEntities.map((e) => e.getSceneItemId()).join(', ')}]]`,\n );\n }\n\n return this.performMeasurement(() => this.model.setEntities(entities));\n }\n\n public setDebugLogs(debugLogs: boolean): void {\n this.debugLogs = debugLogs;\n }\n\n private performMeasurement(\n effect: () => boolean,\n ): Promise<MeasurementOutcome | undefined> {\n const previous = this.model.getEntities();\n const changed = effect();\n const entities = this.model.getEntities();\n if (changed) {\n this.measureAndUpdateModel(entities);\n this.highlightEntities(previous, entities);\n }\n return this.outcome;\n }\n\n private measureAndUpdateModel(entities: MeasurementEntity[]): void {\n if (entities.length > 0) {\n this.outcome = this.measureEntities(entities).then((outcome) => {\n this.model.setOutcome(outcome);\n return this.model.getOutcome();\n });\n } else {\n this.outcome = Promise.resolve(undefined);\n }\n }\n\n private async measureEntities(\n entities: MeasurementEntity[],\n ): Promise<MeasurementOutcome | undefined> {\n if (entities.length > 0) {\n const res = await requestUnary<MeasureResponse>(async (handler) => {\n const meta = await createMetadata(this.jwtProvider, this.deviceId);\n const req = new MeasureRequest();\n req.setEntitiesList(entities.map((e) => e.toProto()));\n\n this.client.measure(req, meta, handler);\n });\n\n return mapMeasureResponseOrThrow(res.toObject());\n } else {\n return undefined;\n }\n }\n\n private async highlightEntities(\n previous: MeasurementEntity[],\n entities: MeasurementEntity[],\n ): Promise<void> {\n await requestUnary(async (handler) => {\n const meta = await createMetadata(this.jwtProvider, this.deviceId);\n\n const entitySet = new Set(entities);\n const newPrevious = previous.filter((e) => !entitySet.has(e));\n\n const clearEntities = newPrevious.map((e) => {\n const update = new ModelEntityUpdate();\n update.setModelEntity(ModelEntity.deserializeBinary(e.modelEntity));\n update.setHighlight(new BoolValue().setValue(false));\n return update;\n });\n const highlightEntities = entities.map((e) => {\n const update = new ModelEntityUpdate();\n update.setModelEntity(ModelEntity.deserializeBinary(e.modelEntity));\n update.setHighlight(new BoolValue().setValue(true));\n return update;\n });\n\n const req = new UpdateModelEntitiesRequest();\n req.setUpdatesList([...clearEntities, ...highlightEntities]);\n this.client.updateModelEntities(req, meta, handler);\n });\n }\n\n private log(message?: string, ...optionalParams: unknown[]): void {\n if (this.debugLogs) {\n console.debug(message, optionalParams);\n }\n }\n}\n","import { vertexvis } from '@vertexvis/frame-streaming-protos';\nimport { Vector3 } from '@vertexvis/geometry';\nimport { Vector3f } from '@vertexvis/scene-view-protos/core/protos/geometry_pb';\nimport { ModelEntity } from '@vertexvis/scene-view-protos/core/protos/model_entity_pb';\nimport { MeasureEntity } from '@vertexvis/scene-view-protos/sceneview/protos/scene_view_api_pb';\nimport { Mapper } from '@vertexvis/utils';\n\nimport { fromPbVector3f } from '../mappers';\n\nexport class MeasurementEntity {\n public constructor(\n public readonly point: Vector3.Vector3,\n public readonly modelEntity: Uint8Array,\n ) {}\n\n public static fromHit(\n hit: vertexvis.protobuf.stream.IHit,\n ): MeasurementEntity {\n if (hit.hitPoint != null && hit.modelEntity != null) {\n const hitPoint = Mapper.ifInvalidThrow(fromPbVector3f)(hit.hitPoint);\n const modelEntity = vertexvis.protobuf.core.ModelEntity.encode(\n hit.modelEntity,\n ).finish();\n return new MeasurementEntity(hitPoint, modelEntity);\n } else {\n throw new Error(\n 'Cannot create MeasurementEntity from Hit. Hit is missing hit point and model entity',\n );\n }\n }\n\n public toProto(): MeasureEntity {\n const entity = new MeasureEntity();\n\n const point = new Vector3f();\n point.setX(this.point.x);\n point.setY(this.point.y);\n point.setZ(this.point.z);\n entity.setPoint(point);\n\n const modelEntity = ModelEntity.deserializeBinary(this.modelEntity);\n entity.setModelEntity(modelEntity);\n\n return entity;\n }\n}\n"],"names":["ModelEntity","requestUnary","createMetadata","MeasureRequest","mapMeasureResponseOrThrow","ModelEntityUpdate","BoolValue","UpdateModelEntitiesRequest","Mapper","fromPbVector3f","vertexvis","MeasureEntity","Vector3f"],"mappings":";;;;;;;;;;;;A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,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AACxB,QAAA,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAEtB,MAAM,WAAW,GAAGZ,8CAAW,CAAC,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC;AACnE,QAAA,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC;AAElC,QAAA,OAAO,MAAM;;AAEhB;;;;;"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
var wrappers_pb = require('./wrappers_pb-Dupo3Hcb.js');
|
|
7
7
|
var bundle = require('./bundle-BLWif0ig.js');
|
|
8
|
-
var streamAttributes = require('./streamAttributes-
|
|
8
|
+
var streamAttributes = require('./streamAttributes-BOGFM4R7.js');
|
|
9
9
|
|
|
10
10
|
var model_entity_pbExports = wrappers_pb.requireModel_entity_pb();
|
|
11
11
|
|
|
@@ -45,6 +45,6 @@ var geometry_pbExports = wrappers_pb.requireGeometry_pb();
|
|
|
45
45
|
exports.geometry_pbExports = geometry_pbExports;
|
|
46
46
|
exports.mapMeasureResponseOrThrow = mapMeasureResponseOrThrow;
|
|
47
47
|
exports.model_entity_pbExports = model_entity_pbExports;
|
|
48
|
-
//# sourceMappingURL=geometry_pb-
|
|
48
|
+
//# sourceMappingURL=geometry_pb-CJZxK0hh.js.map
|
|
49
49
|
|
|
50
|
-
//# sourceMappingURL=geometry_pb-
|
|
50
|
+
//# sourceMappingURL=geometry_pb-CJZxK0hh.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry_pb-
|
|
1
|
+
{"version":3,"file":"geometry_pb-CJZxK0hh.js","sources":["src/lib/measurement/mapper.ts"],"sourcesContent":["import { Plane } from '@vertexvis/geometry';\nimport type {\n MeasurementResult as PbMeasurementResult,\n MinimumDistanceResult as PbMinimumDistanceResult,\n PlanarAngleResult as PbPlanarAngleResult,\n PlanarDistanceResult as PbPlanarDistanceResult,\n PlanePair as PbPlanePair,\n SurfaceAreaResult as PbSurfaceAreaResult,\n} from '@vertexvis/scene-view-protos/core/protos/measurement_pb';\nimport type { MeasureResponse as PbMeasureResponse } from '@vertexvis/scene-view-protos/sceneview/protos/scene_view_api_pb';\nimport { Mapper as M } from '@vertexvis/utils';\n\nimport { fromPbPlane, fromPbVector3f } from '../mappers';\nimport { MeasurementOutcome } from './outcomes';\nimport {\n MeasurementResult,\n MinimumDistanceMeasurementResult,\n PlanarAngleMeasurementResult,\n PlanarDistanceMeasurementResult,\n SurfaceAreaMeasurementResult,\n} from './results';\n\nconst mapPlanePair: M.Func<\n PbPlanePair.AsObject,\n { start: Plane.Plane; end: Plane.Plane }\n> = M.defineMapper(\n M.read(\n M.mapRequiredProp('start', fromPbPlane),\n M.mapRequiredProp('end', fromPbPlane),\n ),\n ([start, end]) => ({ start, end }),\n);\n\nconst mapPlanarDistance: M.Func<\n PbPlanarDistanceResult.AsObject,\n PlanarDistanceMeasurementResult\n> = M.defineMapper(\n M.read(\n M.getProp('distance'),\n M.mapRequiredProp(\n 'planes',\n M.compose(mapPlanePair, M.requiredProp('start')),\n ),\n M.mapRequiredProp('planes', M.compose(mapPlanePair, M.requiredProp('end'))),\n ),\n ([distance, plane1, plane2]) => ({\n type: 'planar-distance',\n distance,\n plane1,\n plane2,\n }),\n);\n\nconst mapPlanarAngle: M.Func<\n PbPlanarAngleResult.AsObject,\n PlanarAngleMeasurementResult\n> = M.defineMapper(\n M.read(\n M.getProp('angleInRadians'),\n M.mapRequiredProp(\n 'planes',\n M.compose(mapPlanePair, M.requiredProp('start')),\n ),\n M.mapRequiredProp('planes', M.compose(mapPlanePair, M.requiredProp('end'))),\n ),\n ([angle, plane1, plane2]) => ({\n type: 'planar-angle',\n angle,\n plane1,\n plane2,\n }),\n);\n\nconst mapMinimumDistance: M.Func<\n PbMinimumDistanceResult.AsObject,\n MinimumDistanceMeasurementResult\n> = M.defineMapper(\n M.read(\n M.getProp('distance'),\n M.mapRequiredProp('closestPoint1', fromPbVector3f),\n M.mapRequiredProp('closestPoint2', fromPbVector3f),\n ),\n ([distance, point1, point2]) => ({\n type: 'minimum-distance',\n distance,\n point1,\n point2,\n }),\n);\n\nconst mapSurfaceArea: M.Func<\n PbSurfaceAreaResult.AsObject,\n SurfaceAreaMeasurementResult\n> = M.defineMapper(M.read(M.getProp('area')), ([area]) => ({\n type: 'surface-area',\n area,\n}));\n\nconst mapPlanarDistanceFromResult: M.Func<\n PbMeasurementResult.AsObject,\n PlanarDistanceMeasurementResult | undefined | null\n> = M.mapProp('planarDistance', M.ifDefined(mapPlanarDistance));\n\nconst mapPlanarAngleFromResult: M.Func<\n PbMeasurementResult.AsObject,\n PlanarAngleMeasurementResult | undefined | null\n> = M.mapProp('planarAngle', M.ifDefined(mapPlanarAngle));\n\nconst mapMinimumDistanceFromResult: M.Func<\n PbMeasurementResult.AsObject,\n MinimumDistanceMeasurementResult | undefined | null\n> = M.mapProp('minimumDistance', M.ifDefined(mapMinimumDistance));\n\nconst mapSurfaceAreaFromResult: M.Func<\n PbMeasurementResult.AsObject,\n SurfaceAreaMeasurementResult | undefined | null\n> = M.mapProp('totalSurfaceArea', M.ifDefined(mapSurfaceArea));\n\nconst mapMeasurementResult: M.Func<\n PbMeasurementResult.AsObject,\n MeasurementResult\n> = M.compose(\n M.pickFirst(\n mapPlanarDistanceFromResult,\n mapPlanarAngleFromResult,\n mapMinimumDistanceFromResult,\n mapSurfaceAreaFromResult,\n ),\n M.required('Result field'),\n);\n\nexport const mapMeasureResponse: M.Func<\n PbMeasureResponse.AsObject,\n MeasurementOutcome\n> = M.defineMapper(\n M.read(\n M.mapRequiredProp(\n 'outcome',\n M.mapRequiredProp('resultsList', M.mapArray(mapMeasurementResult)),\n ),\n M.mapRequiredProp('outcome', M.getProp('isApproximate')),\n ),\n ([results, isApproximate]) => ({ results, isApproximate }),\n);\n\nexport const mapMeasureResponseOrThrow = M.ifInvalidThrow(mapMeasureResponse);\n"],"names":["M","fromPbPlane","fromPbVector3f"],"mappings":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SAAS,CACT,2BAA2B,EAC3B,wBAAwB,EACxB,4BAA4B,EAC5B,wBAAwB,CACzB,EACDA,aAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,CAC3B;AAEM,MAAM,kBAAkB,GAG3BA,aAAC,CAAC,YAAY,CAChBA,aAAC,CAAC,IAAI,CACJA,aAAC,CAAC,eAAe,CACf,SAAS,EACTA,aAAC,CAAC,eAAe,CAAC,aAAa,EAAEA,aAAC,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC,CACnE,EACDA,aAAC,CAAC,eAAe,CAAC,SAAS,EAAEA,aAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CACzD,EACD,CAAC,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,CAC3D;AAEM,MAAM,yBAAyB,GAAGA,aAAC,CAAC,cAAc,CAAC,kBAAkB;;;;;;;;"}
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
*/
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
|
-
var queries = require('./queries-
|
|
6
|
+
var queries = require('./queries-DvkzwhnO.js');
|
|
7
7
|
var controller = require('./controller-BtsJHuJK.js');
|
|
8
8
|
var row = require('./row-Cet6xXup.js');
|
|
9
9
|
var types = require('./types-UbZMN9nQ.js');
|
|
10
10
|
var cursors = require('./cursors-D3ok1iDu.js');
|
|
11
|
-
var entities$1 = require('./entities-
|
|
11
|
+
var entities$1 = require('./entities-OgE3KKMo.js');
|
|
12
12
|
var model = require('./model-BPucf2oP.js');
|
|
13
13
|
var overlays = require('./overlays-SBlhZXvz.js');
|
|
14
14
|
var results = require('./results-QyUFDeA7.js');
|
|
15
15
|
var bundle = require('./bundle-CCWqezam.js');
|
|
16
16
|
var controller$1 = require('./controller-DFpu-IoI.js');
|
|
17
17
|
var util = require('./util-B3VMD3K8.js');
|
|
18
|
-
var streamAttributes = require('./streamAttributes-
|
|
18
|
+
var streamAttributes = require('./streamAttributes-BOGFM4R7.js');
|
|
19
19
|
var entities = require('./entities-BhIrCJqA.js');
|
|
20
20
|
var markup = require('./markup-DgKoqV5o.js');
|
|
21
21
|
var viewport = require('./viewport-C4RKYBae.js');
|
|
@@ -24,11 +24,11 @@ require('./bundle-BLWif0ig.js');
|
|
|
24
24
|
require('./_commonjsHelpers-CBbBosIU.js');
|
|
25
25
|
require('./errors-C-mfaQwO.js');
|
|
26
26
|
require('./wrappers_pb-DCb8h8QZ.js');
|
|
27
|
-
require('./representation_pb-
|
|
27
|
+
require('./representation_pb-Cb20_8yP.js');
|
|
28
28
|
require('./wrappers_pb-Dupo3Hcb.js');
|
|
29
29
|
require('./grpc-D5Apx_zz.js');
|
|
30
30
|
require('./bundle-CJoxPtdL.js');
|
|
31
|
-
require('./geometry_pb-
|
|
31
|
+
require('./geometry_pb-CJZxK0hh.js');
|
|
32
32
|
|
|
33
33
|
const ALMOST_ONE = 0.9999;
|
|
34
34
|
/**
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
6
|
var _commonjsHelpers = require('./_commonjsHelpers-CBbBosIU.js');
|
|
7
|
-
var tslib_es6 = require('./tslib.es6-Bu5Kp4WX.js');
|
|
8
7
|
|
|
9
8
|
var dist = {};
|
|
10
9
|
|
|
@@ -3159,32 +3158,24 @@ function requireDist () {
|
|
|
3159
3158
|
|
|
3160
3159
|
var distExports = /*@__PURE__*/ requireDist();
|
|
3161
3160
|
|
|
3162
|
-
|
|
3163
|
-
|
|
3161
|
+
class TerminateController {
|
|
3162
|
+
constructor() {
|
|
3164
3163
|
this.threads = [];
|
|
3165
3164
|
this.pools = [];
|
|
3166
3165
|
}
|
|
3167
|
-
|
|
3166
|
+
addThread(thread) {
|
|
3168
3167
|
this.threads.push(thread);
|
|
3169
|
-
}
|
|
3170
|
-
|
|
3168
|
+
}
|
|
3169
|
+
addPool(pool) {
|
|
3171
3170
|
this.pools.push(pool);
|
|
3172
|
-
}
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
_a.sent();
|
|
3181
|
-
return [2 /*return*/];
|
|
3182
|
-
}
|
|
3183
|
-
});
|
|
3184
|
-
});
|
|
3185
|
-
};
|
|
3186
|
-
return TerminateController;
|
|
3187
|
-
}());
|
|
3171
|
+
}
|
|
3172
|
+
async terminate(force = false) {
|
|
3173
|
+
await Promise.all([
|
|
3174
|
+
...this.threads.map((t) => distExports.Thread.terminate(t)),
|
|
3175
|
+
...this.pools.map((p) => p.terminate(force)),
|
|
3176
|
+
]);
|
|
3177
|
+
}
|
|
3178
|
+
}
|
|
3188
3179
|
|
|
3189
3180
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3190
3181
|
function getGlobal() {
|
|
@@ -3206,7 +3197,7 @@ var globalThis$1 = getGlobal();
|
|
|
3206
3197
|
|
|
3207
3198
|
function instanceOf(obj, className) {
|
|
3208
3199
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3209
|
-
|
|
3200
|
+
const Type = globalThis$1[className];
|
|
3210
3201
|
return Type != null && obj instanceof Type;
|
|
3211
3202
|
}
|
|
3212
3203
|
function isTransferable(obj) {
|
|
@@ -3240,7 +3231,7 @@ function makeTransferable(obj) {
|
|
|
3240
3231
|
return distExports.Transfer(obj);
|
|
3241
3232
|
}
|
|
3242
3233
|
else if (obj != null && typeof obj === 'object') {
|
|
3243
|
-
|
|
3234
|
+
const transferables = findTransferables(obj);
|
|
3244
3235
|
return distExports.Transfer(obj, transferables);
|
|
3245
3236
|
}
|
|
3246
3237
|
else {
|
|
@@ -3253,16 +3244,16 @@ function findTransferables(obj) {
|
|
|
3253
3244
|
}
|
|
3254
3245
|
else if (typeof obj === 'object') {
|
|
3255
3246
|
if (Array.isArray(obj)) {
|
|
3256
|
-
|
|
3257
|
-
obj.forEach(
|
|
3258
|
-
return
|
|
3247
|
+
const result = [];
|
|
3248
|
+
obj.forEach((o) => result.push(...findTransferables(o)));
|
|
3249
|
+
return result;
|
|
3259
3250
|
}
|
|
3260
3251
|
else if (isTypedArray(obj)) {
|
|
3261
3252
|
return [obj.buffer];
|
|
3262
3253
|
}
|
|
3263
3254
|
else if (obj != null) {
|
|
3264
|
-
return Object.values(obj).reduce(
|
|
3265
|
-
acc.push
|
|
3255
|
+
return Object.values(obj).reduce((acc, value) => {
|
|
3256
|
+
acc.push(...findTransferables(value));
|
|
3266
3257
|
return acc;
|
|
3267
3258
|
}, []);
|
|
3268
3259
|
}
|
|
@@ -3276,7 +3267,7 @@ function findTransferables(obj) {
|
|
|
3276
3267
|
}
|
|
3277
3268
|
|
|
3278
3269
|
const workerName = "png-decoder-worker.js";
|
|
3279
|
-
const workerText = `!function(){"use strict";function t(t,e,n,i){return new(n||(n=Promise))(function(r,s){function a(t){try{h(i.next(t))}catch(t){s(t)}}function o(t){try{h(i.throw(t))}catch(t){s(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,o)}h((i=i.apply(t,e||[])).next())})}function e(t,e){var n,i,r,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=o(0),a.throw=o(1),a.return=o(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(o){return function(h){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,o[0]&&(s=0)),s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,h])}}}"function"==typeof SuppressedError&&SuppressedError;const n={deserialize:t=>Object.assign(Error(t.message),{name:t.name,stack:t.stack}),serialize:t=>({__error_marker:"$$error",message:t.message,name:t.name,stack:t.stack})};let i={deserialize(t){return(e=t)&&"object"==typeof e&&"__error_marker"in e&&"$$error"===e.__error_marker?n.deserialize(t):t;var e},serialize:t=>t instanceof Error?n.serialize(t):t};function r(t){return i.deserialize(t)}function s(t){return i.serialize(t)}function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}const o=Symbol("thread.transferable");function h(t,e){if(!e){if(!(n=t)||"object"!=typeof n)throw Error();e=[t]}var n;return{[o]:!0,send:t,transferables:e}}var f,l,d,c;!function(t){t.cancel="cancel",t.run="run"}(f||(f={})),function(t){t.error="error",t.init="init",t.result="result",t.running="running",t.uncaughtError="uncaughtError"}(l||(l={}));var u=a(c?d:(c=1,d=t=>!!t&&("symbol"==typeof Symbol.observable&&"function"==typeof t[Symbol.observable]?t===t[Symbol.observable]():"function"==typeof t["@@observable"]&&t===t["@@observable"]())));var p=function(){const t="undefined"!=typeof self&&"undefined"!=typeof Window&&self instanceof Window;return!("undefined"==typeof self||!self.postMessage||t)},w=function(t,e){self.postMessage(t,e)},b=function(t){const e=e=>{t(e.data)};return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}},_=function(t,e,n,i){return new(n||(n=Promise))(function(r,s){function a(t){try{h(i.next(t))}catch(t){s(t)}}function o(t){try{h(i.throw(t))}catch(t){s(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,o)}h((i=i.apply(t,e||[])).next())})};let g=!1;const y=new Map,m=t=>t&&t.type===f.run,k=t=>u(t)||function(t){return t&&"object"==typeof t&&"function"==typeof t.subscribe}(t);function v(t){return function(t){return t&&"object"==typeof t&&t[o]}(t)?{payload:t.send,transferables:t.transferables}:{payload:t,transferables:void 0}}function A(t,e){const{payload:n,transferables:i}=v(e),r={type:l.error,uid:t,error:s(n)};w(r,i)}function E(t,e,n){const{payload:i,transferables:r}=v(n),s={type:l.result,uid:t,complete:!!e||void 0,payload:i};w(s,r)}function x(t){try{const e={type:l.uncaughtError,error:s(t)};w(e)}catch(e){console.error("Not reporting uncaught error back to master thread as it occured while reporting an uncaught error already.Latest error:",e,"Original error:",t)}}function U(t,e,n){return _(this,void 0,void 0,function*(){let i;try{i=e(...n)}catch(e){return A(t,e)}const r=k(i)?"observable":"promise";if(function(t,e){const n={type:l.running,uid:t,resultType:e};w(n)}(t,r),k(i)){const e=i.subscribe(e=>E(t,!1,s(e)),e=>{A(t,s(e)),y.delete(t)},()=>{E(t,!0),y.delete(t)});y.set(t,e)}else try{const e=yield i;E(t,!0,s(e))}catch(e){A(t,s(e))}})}function T(t){if(!p())throw Error("expose() called in the master thread.");if(g)throw Error("expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.");if(g=!0,"function"==typeof t)b(e=>{m(e)&&!e.method&&U(e.uid,t,e.args.map(r))}),function(){const t={type:l.init,exposed:{type:"function"}};w(t)}();else{if("object"!=typeof t||!t)throw Error(\`Invalid argument passed to expose(). Expected a function or an object, got: \${t}\`);b(e=>{m(e)&&e.method&&U(e.uid,t[e.method],e.args.map(r))});!function(t){const e={type:l.init,exposed:{type:"module",methods:t}};w(e)}(Object.keys(t).filter(e=>"function"==typeof t[e]))}b(t=>{if((e=t)&&e.type===f.cancel){const e=t.uid,n=y.get(e);n&&(n.unsubscribe(),y.delete(e))}var e})}"undefined"!=typeof self&&"function"==typeof self.addEventListener&&p()&&(self.addEventListener("error",t=>{setTimeout(()=>x(t.error||t),250)}),self.addEventListener("unhandledrejection",t=>{const e=t.reason;e&&"string"==typeof e.message&&setTimeout(()=>x(e),250)})),"undefined"!=typeof process&&"function"==typeof process.on&&p()&&(process.on("uncaughtException",t=>{setTimeout(()=>x(t),250)}),process.on("unhandledRejection",t=>{t&&"string"==typeof t.message&&setTimeout(()=>x(t),250)}));var B=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}();function O(t,e){var n=B[e];return null!=n&&t instanceof n}function C(t){return O(t,"ArrayBuffer")||O(t,"MessagePort")||O(t,"ImageBitmap")||O(t,"OffscreenCanvas")}function I(t){return C(t)?h(t):null!=t&&"object"==typeof t?h(t,R(t)):t}function R(t){if(C(t))return[t];if("object"==typeof t){if(Array.isArray(t)){var e=[];return t.forEach(function(t){return e.push.apply(e,R(t))}),e}return function(t){return O(t,"Int8Array")||O(t,"Uint8Array")||O(t,"Uint8ClampedArray")||O(t,"Int16Array")||O(t,"Uint16Array")||O(t,"Int32Array")||O(t,"Uint32Array")||O(t,"Float32Array")||O(t,"Float64Array")||O(t,"BigInt64Array")||O(t,"BigUint64Array")}(t)?[t.buffer]:null!=t?Object.values(t).reduce(function(t,e){return t.push.apply(t,R(e)),t},[]):[]}return[]}function S(t,e="utf8"){return new TextDecoder(e).decode(t)}const D=new TextEncoder;const M=(()=>{const t=new Uint8Array(4);return!((new Uint32Array(t.buffer)[0]=1)&t[0])})(),L={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array};class F{buffer;byteLength;byteOffset;length;offset;lastWrittenByte;littleEndian;_data;_mark;_marks;constructor(t=8192,e={}){let n=!1;"number"==typeof t?t=new ArrayBuffer(t):(n=!0,this.lastWrittenByte=t.byteLength);const i=e.offset?e.offset>>>0:0,r=t.byteLength-i;let s=i;(ArrayBuffer.isView(t)||t instanceof F)&&(t.byteLength!==t.buffer.byteLength&&(s=t.byteOffset+i),t=t.buffer),this.lastWrittenByte=n?r:0,this.buffer=t,this.length=r,this.byteLength=r,this.byteOffset=s,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,s,r),this._mark=0,this._marks=[]}available(t=1){return this.offset+t<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(t=1){return this.offset+=t,this}back(t=1){return this.offset-=t,this}seek(t){return this.offset=t,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){const t=this._marks.pop();if(void 0===t)throw new Error("Mark stack empty");return this.seek(t),this}rewind(){return this.offset=0,this}ensureAvailable(t=1){if(!this.available(t)){const e=2*(this.offset+t),n=new Uint8Array(e);n.set(new Uint8Array(this.buffer)),this.buffer=n.buffer,this.length=e,this.byteLength=e,this._data=new DataView(this.buffer)}return this}readBoolean(){return 0!==this.readUint8()}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(t=1){return this.readArray(t,"uint8")}readArray(t,e){const n=L[e].BYTES_PER_ELEMENT*t,i=this.byteOffset+this.offset,r=this.buffer.slice(i,i+n);if(this.littleEndian===M&&"uint8"!==e&&"int8"!==e){const t=new Uint8Array(this.buffer.slice(i,i+n));t.reverse();const r=new L[e](t.buffer);return this.offset+=n,r.reverse(),r}const s=new L[e](r);return this.offset+=n,s}readInt16(){const t=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}readUint16(){const t=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,t}readInt32(){const t=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}readUint32(){const t=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat32(){const t=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat64(){const t=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}readBigInt64(){const t=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,t}readBigUint64(){const t=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,t}readChar(){return String.fromCharCode(this.readInt8())}readChars(t=1){let e="";for(let n=0;n<t;n++)e+=this.readChar();return e}readUtf8(t=1){return S(this.readBytes(t))}decodeText(t=1,e="utf8"){return S(this.readBytes(t),e)}writeBoolean(t){return this.writeUint8(t?255:0),this}writeInt8(t){return this.ensureAvailable(1),this._data.setInt8(this.offset++,t),this._updateLastWrittenByte(),this}writeUint8(t){return this.ensureAvailable(1),this._data.setUint8(this.offset++,t),this._updateLastWrittenByte(),this}writeByte(t){return this.writeUint8(t)}writeBytes(t){this.ensureAvailable(t.length);for(let e=0;e<t.length;e++)this._data.setUint8(this.offset++,t[e]);return this._updateLastWrittenByte(),this}writeInt16(t){return this.ensureAvailable(2),this._data.setInt16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(t){return this.ensureAvailable(2),this._data.setUint16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(t){return this.ensureAvailable(4),this._data.setInt32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(t){return this.ensureAvailable(4),this._data.setUint32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(t){return this.ensureAvailable(4),this._data.setFloat32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(t){return this.ensureAvailable(8),this._data.setFloat64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(t){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(t){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(t){return this.writeUint8(t.charCodeAt(0))}writeChars(t){for(let e=0;e<t.length;e++)this.writeUint8(t.charCodeAt(e));return this}writeUtf8(t){return this.writeBytes(function(t){return D.encode(t)}(t))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}getWrittenByteLength(){return this.lastWrittenByte-this.byteOffset}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}function N(t){let e=t.length;for(;--e>=0;)t[e]=0}N(new Array(576));N(new Array(60));N(new Array(512));N(new Array(256));N(new Array(29));N(new Array(30));var Z=(t,e,n,i)=>{let r=65535&t,s=t>>>16&65535,a=0;for(;0!==n;){a=n>2e3?2e3:n,n-=a;do{r=r+e[i++]|0,s=s+r|0}while(--a);r%=65521,s%=65521}return r|s<<16};const $=new Uint32Array((()=>{let t,e=[];for(var n=0;n<256;n++){t=n;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e})());var P=(t,e,n,i)=>{const r=$,s=i+n;t^=-1;for(let n=i;n<s;n++)t=t>>>8^r[255&(t^e[n])];return-1^t},j={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},z={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const W=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var H=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(const e in n)W(n,e)&&(t[e]=n[e])}}return t},K=t=>{let e=0;for(let n=0,i=t.length;n<i;n++)e+=t[n].length;const n=new Uint8Array(e);for(let e=0,i=0,r=t.length;e<r;e++){let r=t[e];n.set(r,i),i+=r.length}return n};let G=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){G=!1}const q=new Uint8Array(256);for(let t=0;t<256;t++)q[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;q[254]=q[254]=1;var Y=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,n,i,r,s,a=t.length,o=0;for(r=0;r<a;r++)n=t.charCodeAt(r),55296==(64512&n)&&r+1<a&&(i=t.charCodeAt(r+1),56320==(64512&i)&&(n=65536+(n-55296<<10)+(i-56320),r++)),o+=n<128?1:n<2048?2:n<65536?3:4;for(e=new Uint8Array(o),s=0,r=0;s<o;r++)n=t.charCodeAt(r),55296==(64512&n)&&r+1<a&&(i=t.charCodeAt(r+1),56320==(64512&i)&&(n=65536+(n-55296<<10)+(i-56320),r++)),n<128?e[s++]=n:n<2048?(e[s++]=192|n>>>6,e[s++]=128|63&n):n<65536?(e[s++]=224|n>>>12,e[s++]=128|n>>>6&63,e[s++]=128|63&n):(e[s++]=240|n>>>18,e[s++]=128|n>>>12&63,e[s++]=128|n>>>6&63,e[s++]=128|63&n);return e},V=(t,e)=>{const n=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let i,r;const s=new Array(2*n);for(r=0,i=0;i<n;){let e=t[i++];if(e<128){s[r++]=e;continue}let a=q[e];if(a>4)s[r++]=65533,i+=a-1;else{for(e&=2===a?31:3===a?15:7;a>1&&i<n;)e=e<<6|63&t[i++],a--;a>1?s[r++]=65533:e<65536?s[r++]=e:(e-=65536,s[r++]=55296|e>>10&1023,s[r++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&G)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let n="";for(let i=0;i<e;i++)n+=String.fromCharCode(t[i]);return n})(s,r)},X=(t,e)=>{(e=e||t.length)>t.length&&(e=t.length);let n=e-1;for(;n>=0&&128==(192&t[n]);)n--;return n<0||0===n?e:n+q[t[n]]>e?n:e};var J=function(){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};const Q=16209;var tt=function(t,e){let n,i,r,s,a,o,h,f,l,d,c,u,p,w,b,_,g,y,m,k,v,A,E,x;const U=t.state;n=t.next_in,E=t.input,i=n+(t.avail_in-5),r=t.next_out,x=t.output,s=r-(e-t.avail_out),a=r+(t.avail_out-257),o=U.dmax,h=U.wsize,f=U.whave,l=U.wnext,d=U.window,c=U.hold,u=U.bits,p=U.lencode,w=U.distcode,b=(1<<U.lenbits)-1,_=(1<<U.distbits)-1;t:do{u<15&&(c+=E[n++]<<u,u+=8,c+=E[n++]<<u,u+=8),g=p[c&b];e:for(;;){if(y=g>>>24,c>>>=y,u-=y,y=g>>>16&255,0===y)x[r++]=65535&g;else{if(!(16&y)){if(64&y){if(32&y){U.mode=16191;break t}t.msg="invalid literal/length code",U.mode=Q;break t}g=p[(65535&g)+(c&(1<<y)-1)];continue e}for(m=65535&g,y&=15,y&&(u<y&&(c+=E[n++]<<u,u+=8),m+=c&(1<<y)-1,c>>>=y,u-=y),u<15&&(c+=E[n++]<<u,u+=8,c+=E[n++]<<u,u+=8),g=w[c&_];;){if(y=g>>>24,c>>>=y,u-=y,y=g>>>16&255,16&y){if(k=65535&g,y&=15,u<y&&(c+=E[n++]<<u,u+=8,u<y&&(c+=E[n++]<<u,u+=8)),k+=c&(1<<y)-1,k>o){t.msg="invalid distance too far back",U.mode=Q;break t}if(c>>>=y,u-=y,y=r-s,k>y){if(y=k-y,y>f&&U.sane){t.msg="invalid distance too far back",U.mode=Q;break t}if(v=0,A=d,0===l){if(v+=h-y,y<m){m-=y;do{x[r++]=d[v++]}while(--y);v=r-k,A=x}}else if(l<y){if(v+=h+l-y,y-=l,y<m){m-=y;do{x[r++]=d[v++]}while(--y);if(v=0,l<m){y=l,m-=y;do{x[r++]=d[v++]}while(--y);v=r-k,A=x}}}else if(v+=l-y,y<m){m-=y;do{x[r++]=d[v++]}while(--y);v=r-k,A=x}for(;m>2;)x[r++]=A[v++],x[r++]=A[v++],x[r++]=A[v++],m-=3;m&&(x[r++]=A[v++],m>1&&(x[r++]=A[v++]))}else{v=r-k;do{x[r++]=x[v++],x[r++]=x[v++],x[r++]=x[v++],m-=3}while(m>2);m&&(x[r++]=x[v++],m>1&&(x[r++]=x[v++]))}break}if(64&y){t.msg="invalid distance code",U.mode=Q;break t}g=w[(65535&g)+(c&(1<<y)-1)]}}break}}while(n<i&&r<a);m=u>>3,n-=m,u-=m<<3,c&=(1<<u)-1,t.next_in=n,t.next_out=r,t.avail_in=n<i?i-n+5:5-(n-i),t.avail_out=r<a?a-r+257:257-(r-a),U.hold=c,U.bits=u};const et=15,nt=new Uint16Array([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]),it=new Uint8Array([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]),rt=new Uint16Array([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]),st=new Uint8Array([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]);var at=(t,e,n,i,r,s,a,o)=>{const h=o.bits;let f,l,d,c,u,p,w=0,b=0,_=0,g=0,y=0,m=0,k=0,v=0,A=0,E=0,x=null;const U=new Uint16Array(16),T=new Uint16Array(16);let B,O,C,I=null;for(w=0;w<=et;w++)U[w]=0;for(b=0;b<i;b++)U[e[n+b]]++;for(y=h,g=et;g>=1&&0===U[g];g--);if(y>g&&(y=g),0===g)return r[s++]=20971520,r[s++]=20971520,o.bits=1,0;for(_=1;_<g&&0===U[_];_++);for(y<_&&(y=_),v=1,w=1;w<=et;w++)if(v<<=1,v-=U[w],v<0)return-1;if(v>0&&(0===t||1!==g))return-1;for(T[1]=0,w=1;w<et;w++)T[w+1]=T[w]+U[w];for(b=0;b<i;b++)0!==e[n+b]&&(a[T[e[n+b]]++]=b);if(0===t?(x=I=a,p=20):1===t?(x=nt,I=it,p=257):(x=rt,I=st,p=0),E=0,b=0,w=_,u=s,m=y,k=0,d=-1,A=1<<y,c=A-1,1===t&&A>852||2===t&&A>592)return 1;for(;;){B=w-k,a[b]+1<p?(O=0,C=a[b]):a[b]>=p?(O=I[a[b]-p],C=x[a[b]-p]):(O=96,C=0),f=1<<w-k,l=1<<m,_=l;do{l-=f,r[u+(E>>k)+l]=B<<24|O<<16|C}while(0!==l);for(f=1<<w-1;E&f;)f>>=1;if(0!==f?(E&=f-1,E+=f):E=0,b++,0===--U[w]){if(w===g)break;w=e[n+a[b]]}if(w>y&&(E&c)!==d){for(0===k&&(k=y),u+=_,m=w-k,v=1<<m;m+k<g&&(v-=U[m+k],!(v<=0));)m++,v<<=1;if(A+=1<<m,1===t&&A>852||2===t&&A>592)return 1;d=E&c,r[d]=y<<24|m<<16|u-s}}return 0!==E&&(r[u+E]=w-k<<24|64<<16),o.bits=y,0};const{Z_FINISH:ot,Z_BLOCK:ht,Z_TREES:ft,Z_OK:lt,Z_STREAM_END:dt,Z_NEED_DICT:ct,Z_STREAM_ERROR:ut,Z_DATA_ERROR:pt,Z_MEM_ERROR:wt,Z_BUF_ERROR:bt,Z_DEFLATED:_t}=z,gt=16180,yt=16190,mt=16191,kt=16192,vt=16194,At=16199,Et=16200,xt=16206,Ut=16209,Tt=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function Bt(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,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 Ot=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<gt||e.mode>16211?1:0},Ct=t=>{if(Ot(t))return ut;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=gt,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,lt},It=t=>{if(Ot(t))return ut;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Ct(t)},Rt=(t,e)=>{let n;if(Ot(t))return ut;const i=t.state;return e<0?(n=0,e=-e):(n=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?ut:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=n,i.wbits=e,It(t))},St=(t,e)=>{if(!t)return ut;const n=new Bt;t.state=n,n.strm=t,n.window=null,n.mode=gt;const i=Rt(t,e);return i!==lt&&(t.state=null),i};let Dt,Mt,Lt=!0;const Ft=t=>{if(Lt){Dt=new Int32Array(512),Mt=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(at(1,t.lens,0,288,Dt,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;at(2,t.lens,0,32,Mt,0,t.work,{bits:5}),Lt=!1}t.lencode=Dt,t.lenbits=9,t.distcode=Mt,t.distbits=5},Nt=(t,e,n,i)=>{let r;const s=t.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),i>=s.wsize?(s.window.set(e.subarray(n-s.wsize,n),0),s.wnext=0,s.whave=s.wsize):(r=s.wsize-s.wnext,r>i&&(r=i),s.window.set(e.subarray(n-i,n-i+r),s.wnext),(i-=r)?(s.window.set(e.subarray(n-i,n),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=r,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=r))),0};var Zt={inflateReset:It,inflateReset2:Rt,inflateResetKeep:Ct,inflateInit:t=>St(t,15),inflateInit2:St,inflate:(t,e)=>{let n,i,r,s,a,o,h,f,l,d,c,u,p,w,b,_,g,y,m,k,v,A,E=0;const x=new Uint8Array(4);let U,T;const B=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ot(t)||!t.output||!t.input&&0!==t.avail_in)return ut;n=t.state,n.mode===mt&&(n.mode=kt),a=t.next_out,r=t.output,h=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,f=n.hold,l=n.bits,d=o,c=h,A=lt;t:for(;;)switch(n.mode){case gt:if(0===n.wrap){n.mode=kt;break}for(;l<16;){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}if(2&n.wrap&&35615===f){0===n.wbits&&(n.wbits=15),n.check=0,x[0]=255&f,x[1]=f>>>8&255,n.check=P(n.check,x,2,0),f=0,l=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&f)<<8)+(f>>8))%31){t.msg="incorrect header check",n.mode=Ut;break}if((15&f)!==_t){t.msg="unknown compression method",n.mode=Ut;break}if(f>>>=4,l-=4,v=8+(15&f),0===n.wbits&&(n.wbits=v),v>15||v>n.wbits){t.msg="invalid window size",n.mode=Ut;break}n.dmax=1<<n.wbits,n.flags=0,t.adler=n.check=1,n.mode=512&f?16189:mt,f=0,l=0;break;case 16181:for(;l<16;){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}if(n.flags=f,(255&n.flags)!==_t){t.msg="unknown compression method",n.mode=Ut;break}if(57344&n.flags){t.msg="unknown header flags set",n.mode=Ut;break}n.head&&(n.head.text=f>>8&1),512&n.flags&&4&n.wrap&&(x[0]=255&f,x[1]=f>>>8&255,n.check=P(n.check,x,2,0)),f=0,l=0,n.mode=16182;case 16182:for(;l<32;){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}n.head&&(n.head.time=f),512&n.flags&&4&n.wrap&&(x[0]=255&f,x[1]=f>>>8&255,x[2]=f>>>16&255,x[3]=f>>>24&255,n.check=P(n.check,x,4,0)),f=0,l=0,n.mode=16183;case 16183:for(;l<16;){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}n.head&&(n.head.xflags=255&f,n.head.os=f>>8),512&n.flags&&4&n.wrap&&(x[0]=255&f,x[1]=f>>>8&255,n.check=P(n.check,x,2,0)),f=0,l=0,n.mode=16184;case 16184:if(1024&n.flags){for(;l<16;){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}n.length=f,n.head&&(n.head.extra_len=f),512&n.flags&&4&n.wrap&&(x[0]=255&f,x[1]=f>>>8&255,n.check=P(n.check,x,2,0)),f=0,l=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&(u=n.length,u>o&&(u=o),u&&(n.head&&(v=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(i.subarray(s,s+u),v)),512&n.flags&&4&n.wrap&&(n.check=P(n.check,i,u,s)),o-=u,s+=u,n.length-=u),n.length))break t;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===o)break t;u=0;do{v=i[s+u++],n.head&&v&&n.length<65536&&(n.head.name+=String.fromCharCode(v))}while(v&&u<o);if(512&n.flags&&4&n.wrap&&(n.check=P(n.check,i,u,s)),o-=u,s+=u,v)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=16187;case 16187:if(4096&n.flags){if(0===o)break t;u=0;do{v=i[s+u++],n.head&&v&&n.length<65536&&(n.head.comment+=String.fromCharCode(v))}while(v&&u<o);if(512&n.flags&&4&n.wrap&&(n.check=P(n.check,i,u,s)),o-=u,s+=u,v)break t}else n.head&&(n.head.comment=null);n.mode=16188;case 16188:if(512&n.flags){for(;l<16;){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}if(4&n.wrap&&f!==(65535&n.check)){t.msg="header crc mismatch",n.mode=Ut;break}f=0,l=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=mt;break;case 16189:for(;l<32;){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}t.adler=n.check=Tt(f),f=0,l=0,n.mode=yt;case yt:if(0===n.havedict)return t.next_out=a,t.avail_out=h,t.next_in=s,t.avail_in=o,n.hold=f,n.bits=l,ct;t.adler=n.check=1,n.mode=mt;case mt:if(e===ht||e===ft)break t;case kt:if(n.last){f>>>=7&l,l-=7&l,n.mode=xt;break}for(;l<3;){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}switch(n.last=1&f,f>>>=1,l-=1,3&f){case 0:n.mode=16193;break;case 1:if(Ft(n),n.mode=At,e===ft){f>>>=2,l-=2;break t}break;case 2:n.mode=16196;break;case 3:t.msg="invalid block type",n.mode=Ut}f>>>=2,l-=2;break;case 16193:for(f>>>=7&l,l-=7&l;l<32;){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}if((65535&f)!=(f>>>16^65535)){t.msg="invalid stored block lengths",n.mode=Ut;break}if(n.length=65535&f,f=0,l=0,n.mode=vt,e===ft)break t;case vt:n.mode=16195;case 16195:if(u=n.length,u){if(u>o&&(u=o),u>h&&(u=h),0===u)break t;r.set(i.subarray(s,s+u),a),o-=u,s+=u,h-=u,a+=u,n.length-=u;break}n.mode=mt;break;case 16196:for(;l<14;){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}if(n.nlen=257+(31&f),f>>>=5,l-=5,n.ndist=1+(31&f),f>>>=5,l-=5,n.ncode=4+(15&f),f>>>=4,l-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=Ut;break}n.have=0,n.mode=16197;case 16197:for(;n.have<n.ncode;){for(;l<3;){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}n.lens[B[n.have++]]=7&f,f>>>=3,l-=3}for(;n.have<19;)n.lens[B[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,U={bits:n.lenbits},A=at(0,n.lens,0,19,n.lencode,0,n.work,U),n.lenbits=U.bits,A){t.msg="invalid code lengths set",n.mode=Ut;break}n.have=0,n.mode=16198;case 16198:for(;n.have<n.nlen+n.ndist;){for(;E=n.lencode[f&(1<<n.lenbits)-1],b=E>>>24,_=E>>>16&255,g=65535&E,!(b<=l);){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}if(g<16)f>>>=b,l-=b,n.lens[n.have++]=g;else{if(16===g){for(T=b+2;l<T;){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}if(f>>>=b,l-=b,0===n.have){t.msg="invalid bit length repeat",n.mode=Ut;break}v=n.lens[n.have-1],u=3+(3&f),f>>>=2,l-=2}else if(17===g){for(T=b+3;l<T;){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}f>>>=b,l-=b,v=0,u=3+(7&f),f>>>=3,l-=3}else{for(T=b+7;l<T;){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}f>>>=b,l-=b,v=0,u=11+(127&f),f>>>=7,l-=7}if(n.have+u>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=Ut;break}for(;u--;)n.lens[n.have++]=v}}if(n.mode===Ut)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=Ut;break}if(n.lenbits=9,U={bits:n.lenbits},A=at(1,n.lens,0,n.nlen,n.lencode,0,n.work,U),n.lenbits=U.bits,A){t.msg="invalid literal/lengths set",n.mode=Ut;break}if(n.distbits=6,n.distcode=n.distdyn,U={bits:n.distbits},A=at(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,U),n.distbits=U.bits,A){t.msg="invalid distances set",n.mode=Ut;break}if(n.mode=At,e===ft)break t;case At:n.mode=Et;case Et:if(o>=6&&h>=258){t.next_out=a,t.avail_out=h,t.next_in=s,t.avail_in=o,n.hold=f,n.bits=l,tt(t,c),a=t.next_out,r=t.output,h=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,f=n.hold,l=n.bits,n.mode===mt&&(n.back=-1);break}for(n.back=0;E=n.lencode[f&(1<<n.lenbits)-1],b=E>>>24,_=E>>>16&255,g=65535&E,!(b<=l);){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}if(_&&!(240&_)){for(y=b,m=_,k=g;E=n.lencode[k+((f&(1<<y+m)-1)>>y)],b=E>>>24,_=E>>>16&255,g=65535&E,!(y+b<=l);){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}f>>>=y,l-=y,n.back+=y}if(f>>>=b,l-=b,n.back+=b,n.length=g,0===_){n.mode=16205;break}if(32&_){n.back=-1,n.mode=mt;break}if(64&_){t.msg="invalid literal/length code",n.mode=Ut;break}n.extra=15&_,n.mode=16201;case 16201:if(n.extra){for(T=n.extra;l<T;){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}n.length+=f&(1<<n.extra)-1,f>>>=n.extra,l-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;E=n.distcode[f&(1<<n.distbits)-1],b=E>>>24,_=E>>>16&255,g=65535&E,!(b<=l);){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}if(!(240&_)){for(y=b,m=_,k=g;E=n.distcode[k+((f&(1<<y+m)-1)>>y)],b=E>>>24,_=E>>>16&255,g=65535&E,!(y+b<=l);){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}f>>>=y,l-=y,n.back+=y}if(f>>>=b,l-=b,n.back+=b,64&_){t.msg="invalid distance code",n.mode=Ut;break}n.offset=g,n.extra=15&_,n.mode=16203;case 16203:if(n.extra){for(T=n.extra;l<T;){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}n.offset+=f&(1<<n.extra)-1,f>>>=n.extra,l-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=Ut;break}n.mode=16204;case 16204:if(0===h)break t;if(u=c-h,n.offset>u){if(u=n.offset-u,u>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=Ut;break}u>n.wnext?(u-=n.wnext,p=n.wsize-u):p=n.wnext-u,u>n.length&&(u=n.length),w=n.window}else w=r,p=a-n.offset,u=n.length;u>h&&(u=h),h-=u,n.length-=u;do{r[a++]=w[p++]}while(--u);0===n.length&&(n.mode=Et);break;case 16205:if(0===h)break t;r[a++]=n.length,h--,n.mode=Et;break;case xt:if(n.wrap){for(;l<32;){if(0===o)break t;o--,f|=i[s++]<<l,l+=8}if(c-=h,t.total_out+=c,n.total+=c,4&n.wrap&&c&&(t.adler=n.check=n.flags?P(n.check,r,c,a-c):Z(n.check,r,c,a-c)),c=h,4&n.wrap&&(n.flags?f:Tt(f))!==n.check){t.msg="incorrect data check",n.mode=Ut;break}f=0,l=0}n.mode=16207;case 16207:if(n.wrap&&n.flags){for(;l<32;){if(0===o)break t;o--,f+=i[s++]<<l,l+=8}if(4&n.wrap&&f!==(4294967295&n.total)){t.msg="incorrect length check",n.mode=Ut;break}f=0,l=0}n.mode=16208;case 16208:A=dt;break t;case Ut:A=pt;break t;case 16210:return wt;default:return ut}return t.next_out=a,t.avail_out=h,t.next_in=s,t.avail_in=o,n.hold=f,n.bits=l,(n.wsize||c!==t.avail_out&&n.mode<Ut&&(n.mode<xt||e!==ot))&&Nt(t,t.output,t.next_out,c-t.avail_out),d-=t.avail_in,c-=t.avail_out,t.total_in+=d,t.total_out+=c,n.total+=c,4&n.wrap&&c&&(t.adler=n.check=n.flags?P(n.check,r,c,t.next_out-c):Z(n.check,r,c,t.next_out-c)),t.data_type=n.bits+(n.last?64:0)+(n.mode===mt?128:0)+(n.mode===At||n.mode===vt?256:0),(0===d&&0===c||e===ot)&&A===lt&&(A=bt),A},inflateEnd:t=>{if(Ot(t))return ut;let e=t.state;return e.window&&(e.window=null),t.state=null,lt},inflateGetHeader:(t,e)=>{if(Ot(t))return ut;const n=t.state;return 2&n.wrap?(n.head=e,e.done=!1,lt):ut},inflateSetDictionary:(t,e)=>{const n=e.length;let i,r,s;return Ot(t)?ut:(i=t.state,0!==i.wrap&&i.mode!==yt?ut:i.mode===yt&&(r=1,r=Z(r,e,n,0),r!==i.check)?pt:(s=Nt(t,e,n,n),s?(i.mode=16210,wt):(i.havedict=1,lt)))},inflateInfo:"pako inflate (from Nodeca project)"};var $t=function(){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=!1};const Pt=Object.prototype.toString,{Z_NO_FLUSH:jt,Z_FINISH:zt,Z_OK:Wt,Z_STREAM_END:Ht,Z_NEED_DICT:Kt,Z_STREAM_ERROR:Gt,Z_DATA_ERROR:qt,Z_MEM_ERROR:Yt}=z;function Vt(t){this.options=H({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(15&e.windowBits||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new J,this.strm.avail_out=0;let n=Zt.inflateInit2(this.strm,e.windowBits);if(n!==Wt)throw new Error(j[n]);if(this.header=new $t,Zt.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Y(e.dictionary):"[object ArrayBuffer]"===Pt.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=Zt.inflateSetDictionary(this.strm,e.dictionary),n!==Wt)))throw new Error(j[n])}Vt.prototype.push=function(t,e){const n=this.strm,i=this.options.chunkSize,r=this.options.dictionary;let s,a,o;if(this.ended)return!1;for(a=e===~~e?e:!0===e?zt:jt,"[object ArrayBuffer]"===Pt.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;){for(0===n.avail_out&&(n.output=new Uint8Array(i),n.next_out=0,n.avail_out=i),s=Zt.inflate(n,a),s===Kt&&r&&(s=Zt.inflateSetDictionary(n,r),s===Wt?s=Zt.inflate(n,a):s===qt&&(s=Kt));n.avail_in>0&&s===Ht&&n.state.wrap>0&&0!==t[n.next_in];)Zt.inflateReset(n),s=Zt.inflate(n,a);switch(s){case Gt:case qt:case Kt:case Yt:return this.onEnd(s),this.ended=!0,!1}if(o=n.avail_out,n.next_out&&(0===n.avail_out||s===Ht))if("string"===this.options.to){let t=X(n.output,n.next_out),e=n.next_out-t,r=V(n.output,t);n.next_out=e,n.avail_out=i-e,e&&n.output.set(n.output.subarray(t,t+e),0),this.onData(r)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(s!==Wt||0!==o){if(s===Ht)return s=Zt.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},Vt.prototype.onData=function(t){this.chunks.push(t)},Vt.prototype.onEnd=function(t){t===Wt&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=K(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Xt={Inflate:Vt,inflate:function(t,e){const n=new Vt(e);if(n.push(t),n.err)throw n.msg||j[n.err];return n.result}};const{Inflate:Jt,inflate:Qt}=Xt;var te=Jt,ee=Qt;const ne=[];for(let t=0;t<256;t++){let e=t;for(let t=0;t<8;t++)1&e?e=3988292384^e>>>1:e>>>=1;ne[t]=e}const ie=4294967295;function re(t,e){return(function(t,e,n){let i=t;for(let t=0;t<n;t++)i=ne[255&(i^e[t])]^i>>>8;return i}(ie,t,e)^ie)>>>0}function se(t,e,n){const i=t.readUint32(),r=re(new Uint8Array(t.buffer,t.byteOffset+t.offset-e-4,e),e);if(r!==i)throw new Error(\`CRC mismatch for chunk \${n}. Expected \${i}, found \${r}\`)}function ae(t,e,n){for(let i=0;i<n;i++)e[i]=t[i]}function oe(t,e,n,i){let r=0;for(;r<i;r++)e[r]=t[r];for(;r<n;r++)e[r]=t[r]+e[r-i]&255}function he(t,e,n,i){let r=0;if(0===n.length)for(;r<i;r++)e[r]=t[r];else for(;r<i;r++)e[r]=t[r]+n[r]&255}function fe(t,e,n,i,r){let s=0;if(0===n.length){for(;s<r;s++)e[s]=t[s];for(;s<i;s++)e[s]=t[s]+(e[s-r]>>1)&255}else{for(;s<r;s++)e[s]=t[s]+(n[s]>>1)&255;for(;s<i;s++)e[s]=t[s]+(e[s-r]+n[s]>>1)&255}}function le(t,e,n,i,r){let s=0;if(0===n.length){for(;s<r;s++)e[s]=t[s];for(;s<i;s++)e[s]=t[s]+e[s-r]&255}else{for(;s<r;s++)e[s]=t[s]+n[s]&255;for(;s<i;s++)e[s]=t[s]+de(e[s-r],n[s],n[s-r])&255}}function de(t,e,n){const i=t+e-n,r=Math.abs(i-t),s=Math.abs(i-e),a=Math.abs(i-n);return r<=s&&r<=a?t:s<=a?e:n}function ce(t,e,n,i,r,s){switch(t){case 0:ae(e,n,r);break;case 1:oe(e,n,r,s);break;case 2:he(e,n,i,r);break;case 3:fe(e,n,i,r,s);break;case 4:le(e,n,i,r,s);break;default:throw new Error(\`Unsupported filter: \${t}\`)}}const ue=new Uint16Array([255]),pe=255===new Uint8Array(ue.buffer)[0];function we(t){return(255&t)<<8|t>>8&255}const be=new Uint16Array([255]),_e=255===new Uint8Array(be.buffer)[0],ge=new Uint8Array(0);function ye(t){const{data:e,width:n,height:i,channels:r,depth:s}=t,a=Math.ceil(s/8)*r,o=Math.ceil(s/8*r*n),h=new Uint8Array(i*o);let f,l,d=ge,c=0;for(let t=0;t<i;t++){switch(f=e.subarray(c+1,c+1+o),l=h.subarray(t*o,(t+1)*o),e[c]){case 0:ae(f,l,o);break;case 1:oe(f,l,o,a);break;case 2:he(f,l,d,o);break;case 3:fe(f,l,d,o,a);break;case 4:le(f,l,d,o,a);break;default:throw new Error(\`Unsupported filter: \${e[c]}\`)}d=l,c+=o+1}if(16===s){const t=new Uint16Array(h.buffer);if(_e)for(let e=0;e<t.length;e++)t[e]=me(t[e]);return t}return h}function me(t){return(255&t)<<8|t>>8&255}const ke=Uint8Array.of(137,80,78,71,13,10,26,10);function ve(t){if(!function(t){if(t.length<ke.length)return!1;for(let e=0;e<ke.length;e++)if(t[e]!==ke[e])return!1;return!0}(t.readBytes(ke.length)))throw new Error("wrong PNG signature")}const Ae=new TextDecoder("latin1");function Ee(t){if(function(t){if(!xe.test(t))throw new Error("invalid latin1 text")}(t),0===t.length||t.length>79)throw new Error("keyword length must be between 1 and 79")}const xe=/^[\u0000-\u00FF]*$/;function Ue(t,e,n){const i=Te(e);t[i]=function(t,e){return Ae.decode(t.readBytes(e))}(e,n-i.length-1)}function Te(t){for(t.mark();0!==t.readByte(););const e=t.offset;t.reset();const n=Ae.decode(t.readBytes(e-t.offset-1));return t.skip(1),Ee(n),n}const Be=-1,Oe=0,Ce=2,Ie=3,Re=4,Se=6,De=-1,Me=0,Le=-1,Fe=0,Ne=-1,Ze=0,$e=1,Pe=0,je=1,ze=2,We=0,He=1;class Ke extends F{_checkCrc;_inflator;_png;_apng;_end;_hasPalette;_palette;_hasTransparency;_transparency;_compressionMethod;_filterMethod;_interlaceMethod;_colorType;_isAnimated;_numberOfFrames;_numberOfPlays;_frames;_writingDataChunks;constructor(t,e={}){super(t);const{checkCrc:n=!1}=e;this._checkCrc=n,this._inflator=new te,this._png={width:-1,height:-1,channels:-1,data:new Uint8Array(0),depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array(0),this._compressionMethod=De,this._filterMethod=Le,this._interlaceMethod=Ne,this._colorType=Be,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(ve(this);!this._end;){const t=this.readUint32(),e=this.readChars(4);this.decodeChunk(t,e)}return this.decodeImage(),this._png}decodeApng(){for(ve(this);!this._end;){const t=this.readUint32(),e=this.readChars(4);this.decodeApngChunk(t,e)}return this.decodeApngImage(),this._apng}decodeChunk(t,e){const n=this.offset;switch(e){case"IHDR":this.decodeIHDR();break;case"PLTE":this.decodePLTE(t);break;case"IDAT":this.decodeIDAT(t);break;case"IEND":this._end=!0;break;case"tRNS":this.decodetRNS(t);break;case"iCCP":this.decodeiCCP(t);break;case"tEXt":Ue(this._png.text,this,t);break;case"pHYs":this.decodepHYs();break;default:this.skip(t)}if(this.offset-n!==t)throw new Error(\`Length mismatch while decoding chunk \${e}\`);this._checkCrc?se(this,t+4,e):this.skip(4)}decodeApngChunk(t,e){const n=this.offset;switch("fdAT"!==e&&"IDAT"!==e&&this._writingDataChunks&&this.pushDataToFrame(),e){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(t);break;default:this.decodeChunk(t,e),this.offset=n+t}if(this.offset-n!==t)throw new Error(\`Length mismatch while decoding chunk \${e}\`);this._checkCrc?se(this,t+4,e):this.skip(4)}decodeIHDR(){const t=this._png;t.width=this.readUint32(),t.height=this.readUint32(),t.depth=function(t){if(1!==t&&2!==t&&4!==t&&8!==t&&16!==t)throw new Error(\`invalid bit depth: \${t}\`);return t}(this.readUint8());const e=this.readUint8();let n;switch(this._colorType=e,e){case Oe:n=1;break;case Ce:n=3;break;case Ie:n=1;break;case Re:n=2;break;case Se:n=4;break;default:throw new Error(\`Unknown color type: \${e}\`)}if(this._png.channels=n,this._compressionMethod=this.readUint8(),this._compressionMethod!==Me)throw new Error(\`Unsupported compression method: \${this._compressionMethod}\`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){const t={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array(0)};this._frames.push(t)}decodePLTE(t){if(t%3!=0)throw new RangeError(\`PLTE field length must be a multiple of 3. Got \${t}\`);const e=t/3;this._hasPalette=!0;const n=[];this._palette=n;for(let t=0;t<e;t++)n.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(t){this._writingDataChunks=!0;const e=t,n=this.offset+this.byteOffset;if(this._inflator.push(new Uint8Array(this.buffer,n,e)),this._inflator.err)throw new Error(\`Error while decompressing the data: \${this._inflator.err}\`);this.skip(t)}decodeFDAT(t){this._writingDataChunks=!0;let e=t,n=this.offset+this.byteOffset;if(n+=4,e-=4,this._inflator.push(new Uint8Array(this.buffer,n,e)),this._inflator.err)throw new Error(\`Error while decompressing the data: \${this._inflator.err}\`);this.skip(t)}decodetRNS(t){switch(this._colorType){case Oe:case Ce:if(t%2!=0)throw new RangeError(\`tRNS chunk length must be a multiple of 2. Got \${t}\`);if(t/2>this._png.width*this._png.height)throw new Error(\`tRNS chunk contains more alpha values than there are pixels (\${t/2} vs \${this._png.width*this._png.height})\`);this._hasTransparency=!0,this._transparency=new Uint16Array(t/2);for(let e=0;e<t/2;e++)this._transparency[e]=this.readUint16();break;case Ie:{if(t>this._palette.length)throw new Error(\`tRNS chunk contains more alpha values than there are palette colors (\${t} vs \${this._palette.length})\`);let e=0;for(;e<t;e++){const t=this.readByte();this._palette[e].push(t)}for(;e<this._palette.length;e++)this._palette[e].push(255);break}default:throw new Error(\`tRNS chunk is not supported for color type \${this._colorType}\`)}}decodeiCCP(t){const e=Te(this),n=this.readUint8();if(n!==Me)throw new Error(\`Unsupported iCCP compression method: \${n}\`);const i=this.readBytes(t-e.length-2);this._png.iccEmbeddedProfile={name:e,profile:ee(i)}}decodepHYs(){const t=this.readUint32(),e=this.readUint32(),n=this.readByte();this._png.resolution={x:t,y:e,unit:n}}decodeApngImage(){this._apng.width=this._png.width,this._apng.height=this._png.height,this._apng.channels=this._png.channels,this._apng.depth=this._png.depth,this._apng.numberOfFrames=this._numberOfFrames,this._apng.numberOfPlays=this._numberOfPlays,this._apng.text=this._png.text,this._apng.resolution=this._png.resolution;for(let t=0;t<this._numberOfFrames;t++){const e={sequenceNumber:this._frames[t].sequenceNumber,delayNumber:this._frames[t].delayNumber,delayDenominator:this._frames[t].delayDenominator,data:8===this._apng.depth?new Uint8Array(this._apng.width*this._apng.height*this._apng.channels):new Uint16Array(this._apng.width*this._apng.height*this._apng.channels)},n=this._frames.at(t);if(n){if(n.data=ye({data:n.data,width:n.width,height:n.height,channels:this._apng.channels,depth:this._apng.depth}),this._hasPalette&&(this._apng.palette=this._palette),this._hasTransparency&&(this._apng.transparency=this._transparency),0===t||0===n.xOffset&&0===n.yOffset&&n.width===this._png.width&&n.height===this._png.height)e.data=n.data;else{const i=this._apng.frames.at(t-1);this.disposeFrame(n,i,e),this.addFrameDataToCanvas(e,n)}this._apng.frames.push(e)}}return this._apng}disposeFrame(t,e,n){switch(t.disposeOp){case Pe:break;case je:for(let e=0;e<this._png.height;e++)for(let i=0;i<this._png.width;i++){const r=(e*t.width+i)*this._png.channels;for(let t=0;t<this._png.channels;t++)n.data[r+t]=0}break;case ze:n.data.set(e.data);break;default:throw new Error("Unknown disposeOp")}}addFrameDataToCanvas(t,e){const n=1<<this._png.depth,i=(t,n)=>({index:((t+e.yOffset)*this._png.width+e.xOffset+n)*this._png.channels,frameIndex:(t*e.width+n)*this._png.channels});switch(e.blendOp){case We:for(let n=0;n<e.height;n++)for(let r=0;r<e.width;r++){const{index:s,frameIndex:a}=i(n,r);for(let n=0;n<this._png.channels;n++)t.data[s+n]=e.data[a+n]}break;case He:for(let r=0;r<e.height;r++)for(let s=0;s<e.width;s++){const{index:a,frameIndex:o}=i(r,s);for(let i=0;i<this._png.channels;i++){const r=e.data[o+this._png.channels-1]/n,s=i%(this._png.channels-1)==0?1:e.data[o+i],h=Math.floor(r*s+(1-r)*t.data[a+i]);t.data[a+i]+=h}}break;default:throw new Error("Unknown blendOp")}}decodeImage(){if(this._inflator.err)throw new Error(\`Error while decompressing the data: \${this._inflator.err}\`);const t=this._isAnimated?(this._frames?.at(0)).data:this._inflator.result;if(this._filterMethod!==Fe)throw new Error(\`Filter method \${this._filterMethod} not supported\`);if(this._interlaceMethod===Ze)this._png.data=ye({data:t,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else{if(this._interlaceMethod!==$e)throw new Error(\`Interlace method \${this._interlaceMethod} not supported\`);this._png.data=function(t){const{data:e,width:n,height:i,channels:r,depth:s}=t,a=[{x:0,y:0,xStep:8,yStep:8},{x:4,y:0,xStep:8,yStep:8},{x:0,y:4,xStep:4,yStep:8},{x:2,y:0,xStep:4,yStep:4},{x:0,y:2,xStep:2,yStep:4},{x:1,y:0,xStep:2,yStep:2},{x:0,y:1,xStep:1,yStep:2}],o=Math.ceil(s/8)*r,h=new Uint8Array(i*n*o);let f=0;for(let t=0;t<7;t++){const r=a[t],s=Math.ceil((n-r.x)/r.xStep),l=Math.ceil((i-r.y)/r.yStep);if(s<=0||l<=0)continue;const d=s*o,c=new Uint8Array(d);for(let t=0;t<l;t++){const a=e[f++],l=e.subarray(f,f+d);f+=d;const u=new Uint8Array(d);ce(a,l,u,c,d,o),c.set(u);for(let e=0;e<s;e++){const s=r.x+e*r.xStep,a=r.y+t*r.yStep;if(!(s>=n||a>=i))for(let t=0;t<o;t++)h[(a*n+s)*o+t]=u[e*o+t]}}}if(16===s){const t=new Uint16Array(h.buffer);if(pe)for(let e=0;e<t.length;e++)t[e]=we(t[e]);return t}return h}({data:t,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth})}this._hasPalette&&(this._png.palette=this._palette),this._hasTransparency&&(this._png.transparency=this._transparency)}pushDataToFrame(){const t=this._inflator.result,e=this._frames.at(-1);e?e.data=t:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:Pe,blendOp:We,data:t}),this._inflator=new te,this._writingDataChunks=!1}}var Ge;!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.METRE=1]="METRE"}(Ge||(Ge={})),function(n){var i={}.expose,r=void 0===i?T:i;function s(n){var i=this;return function(){for(var r=[],s=0;s<arguments.length;s++)r[s]=arguments[s];return t(i,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,n.apply(void 0,r)];case 1:return[2,I(t.sent())]}})})}}if("function"==typeof n)return r(s(n));var a=Object.entries(n).reduce(function(t,e){var n=e[0],i=e[1];return t[n]=s(i),t},{});r(a)}(async function(t){return e=t instanceof Uint8Array?t:new Uint8Array(t),new Ke(e,n).decode();var e,n})}();
|
|
3270
|
+
const workerText = `!function(){"use strict";const t={deserialize:t=>Object.assign(Error(t.message),{name:t.name,stack:t.stack}),serialize:t=>({__error_marker:"$$error",message:t.message,name:t.name,stack:t.stack})};let e={deserialize(e){return(i=e)&&"object"==typeof i&&"__error_marker"in i&&"$$error"===i.__error_marker?t.deserialize(e):e;var i},serialize:e=>e instanceof Error?t.serialize(e):e};function i(t){return e.deserialize(t)}function n(t){return e.serialize(t)}function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}const s=Symbol("thread.transferable");function a(t,e){if(!e){if(!(i=t)||"object"!=typeof i)throw Error();e=[t]}var i;return{[s]:!0,send:t,transferables:e}}var o,h,f,l;!function(t){t.cancel="cancel",t.run="run"}(o||(o={})),function(t){t.error="error",t.init="init",t.result="result",t.running="running",t.uncaughtError="uncaughtError"}(h||(h={}));var d=r(l?f:(l=1,f=t=>!!t&&("symbol"==typeof Symbol.observable&&"function"==typeof t[Symbol.observable]?t===t[Symbol.observable]():"function"==typeof t["@@observable"]&&t===t["@@observable"]())));var c=function(){const t="undefined"!=typeof self&&"undefined"!=typeof Window&&self instanceof Window;return!("undefined"==typeof self||!self.postMessage||t)},u=function(t,e){self.postMessage(t,e)},p=function(t){const e=e=>{t(e.data)};return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}},w=function(t,e,i,n){return new(i||(i=Promise))(function(r,s){function a(t){try{h(n.next(t))}catch(t){s(t)}}function o(t){try{h(n.throw(t))}catch(t){s(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(a,o)}h((n=n.apply(t,e||[])).next())})};let b=!1;const _=new Map,g=t=>t&&t.type===o.run,y=t=>d(t)||function(t){return t&&"object"==typeof t&&"function"==typeof t.subscribe}(t);function m(t){return function(t){return t&&"object"==typeof t&&t[s]}(t)?{payload:t.send,transferables:t.transferables}:{payload:t,transferables:void 0}}function k(t,e){const{payload:i,transferables:r}=m(e),s={type:h.error,uid:t,error:n(i)};u(s,r)}function v(t,e,i){const{payload:n,transferables:r}=m(i),s={type:h.result,uid:t,complete:!!e||void 0,payload:n};u(s,r)}function A(t){try{const e={type:h.uncaughtError,error:n(t)};u(e)}catch(e){console.error("Not reporting uncaught error back to master thread as it occured while reporting an uncaught error already.Latest error:",e,"Original error:",t)}}function E(t,e,i){return w(this,void 0,void 0,function*(){let r;try{r=e(...i)}catch(e){return k(t,e)}const s=y(r)?"observable":"promise";if(function(t,e){const i={type:h.running,uid:t,resultType:e};u(i)}(t,s),y(r)){const e=r.subscribe(e=>v(t,!1,n(e)),e=>{k(t,n(e)),_.delete(t)},()=>{v(t,!0),_.delete(t)});_.set(t,e)}else try{const e=yield r;v(t,!0,n(e))}catch(e){k(t,n(e))}})}function x(t){if(!c())throw Error("expose() called in the master thread.");if(b)throw Error("expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.");if(b=!0,"function"==typeof t)p(e=>{g(e)&&!e.method&&E(e.uid,t,e.args.map(i))}),function(){const t={type:h.init,exposed:{type:"function"}};u(t)}();else{if("object"!=typeof t||!t)throw Error(\`Invalid argument passed to expose(). Expected a function or an object, got: \${t}\`);p(e=>{g(e)&&e.method&&E(e.uid,t[e.method],e.args.map(i))});!function(t){const e={type:h.init,exposed:{type:"module",methods:t}};u(e)}(Object.keys(t).filter(e=>"function"==typeof t[e]))}p(t=>{if((e=t)&&e.type===o.cancel){const e=t.uid,i=_.get(e);i&&(i.unsubscribe(),_.delete(e))}var e})}"undefined"!=typeof self&&"function"==typeof self.addEventListener&&c()&&(self.addEventListener("error",t=>{setTimeout(()=>A(t.error||t),250)}),self.addEventListener("unhandledrejection",t=>{const e=t.reason;e&&"string"==typeof e.message&&setTimeout(()=>A(e),250)})),"undefined"!=typeof process&&"function"==typeof process.on&&c()&&(process.on("uncaughtException",t=>{setTimeout(()=>A(t),250)}),process.on("unhandledRejection",t=>{t&&"string"==typeof t.message&&setTimeout(()=>A(t),250)}));var U=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}();function T(t,e){const i=U[e];return null!=i&&t instanceof i}function B(t){return T(t,"ArrayBuffer")||T(t,"MessagePort")||T(t,"ImageBitmap")||T(t,"OffscreenCanvas")}function O(t){if(B(t))return a(t);if(null!=t&&"object"==typeof t){return a(t,C(t))}return t}function C(t){if(B(t))return[t];if("object"==typeof t){if(Array.isArray(t)){const e=[];return t.forEach(t=>e.push(...C(t))),e}return function(t){return T(t,"Int8Array")||T(t,"Uint8Array")||T(t,"Uint8ClampedArray")||T(t,"Int16Array")||T(t,"Uint16Array")||T(t,"Int32Array")||T(t,"Uint32Array")||T(t,"Float32Array")||T(t,"Float64Array")||T(t,"BigInt64Array")||T(t,"BigUint64Array")}(t)?[t.buffer]:null!=t?Object.values(t).reduce((t,e)=>(t.push(...C(e)),t),[]):[]}return[]}function I(t,e="utf8"){return new TextDecoder(e).decode(t)}const R=new TextEncoder;const S=(()=>{const t=new Uint8Array(4);return!((new Uint32Array(t.buffer)[0]=1)&t[0])})(),D={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array};class M{buffer;byteLength;byteOffset;length;offset;lastWrittenByte;littleEndian;_data;_mark;_marks;constructor(t=8192,e={}){let i=!1;"number"==typeof t?t=new ArrayBuffer(t):(i=!0,this.lastWrittenByte=t.byteLength);const n=e.offset?e.offset>>>0:0,r=t.byteLength-n;let s=n;(ArrayBuffer.isView(t)||t instanceof M)&&(t.byteLength!==t.buffer.byteLength&&(s=t.byteOffset+n),t=t.buffer),this.lastWrittenByte=i?r:0,this.buffer=t,this.length=r,this.byteLength=r,this.byteOffset=s,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,s,r),this._mark=0,this._marks=[]}available(t=1){return this.offset+t<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(t=1){return this.offset+=t,this}back(t=1){return this.offset-=t,this}seek(t){return this.offset=t,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){const t=this._marks.pop();if(void 0===t)throw new Error("Mark stack empty");return this.seek(t),this}rewind(){return this.offset=0,this}ensureAvailable(t=1){if(!this.available(t)){const e=2*(this.offset+t),i=new Uint8Array(e);i.set(new Uint8Array(this.buffer)),this.buffer=i.buffer,this.length=e,this.byteLength=e,this._data=new DataView(this.buffer)}return this}readBoolean(){return 0!==this.readUint8()}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(t=1){return this.readArray(t,"uint8")}readArray(t,e){const i=D[e].BYTES_PER_ELEMENT*t,n=this.byteOffset+this.offset,r=this.buffer.slice(n,n+i);if(this.littleEndian===S&&"uint8"!==e&&"int8"!==e){const t=new Uint8Array(this.buffer.slice(n,n+i));t.reverse();const r=new D[e](t.buffer);return this.offset+=i,r.reverse(),r}const s=new D[e](r);return this.offset+=i,s}readInt16(){const t=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}readUint16(){const t=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,t}readInt32(){const t=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}readUint32(){const t=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat32(){const t=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat64(){const t=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}readBigInt64(){const t=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,t}readBigUint64(){const t=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,t}readChar(){return String.fromCharCode(this.readInt8())}readChars(t=1){let e="";for(let i=0;i<t;i++)e+=this.readChar();return e}readUtf8(t=1){return I(this.readBytes(t))}decodeText(t=1,e="utf8"){return I(this.readBytes(t),e)}writeBoolean(t){return this.writeUint8(t?255:0),this}writeInt8(t){return this.ensureAvailable(1),this._data.setInt8(this.offset++,t),this._updateLastWrittenByte(),this}writeUint8(t){return this.ensureAvailable(1),this._data.setUint8(this.offset++,t),this._updateLastWrittenByte(),this}writeByte(t){return this.writeUint8(t)}writeBytes(t){this.ensureAvailable(t.length);for(let e=0;e<t.length;e++)this._data.setUint8(this.offset++,t[e]);return this._updateLastWrittenByte(),this}writeInt16(t){return this.ensureAvailable(2),this._data.setInt16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(t){return this.ensureAvailable(2),this._data.setUint16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(t){return this.ensureAvailable(4),this._data.setInt32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(t){return this.ensureAvailable(4),this._data.setUint32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(t){return this.ensureAvailable(4),this._data.setFloat32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(t){return this.ensureAvailable(8),this._data.setFloat64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(t){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(t){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(t){return this.writeUint8(t.charCodeAt(0))}writeChars(t){for(let e=0;e<t.length;e++)this.writeUint8(t.charCodeAt(e));return this}writeUtf8(t){return this.writeBytes(function(t){return R.encode(t)}(t))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}getWrittenByteLength(){return this.lastWrittenByte-this.byteOffset}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}function L(t){let e=t.length;for(;--e>=0;)t[e]=0}L(new Array(576));L(new Array(60));L(new Array(512));L(new Array(256));L(new Array(29));L(new Array(30));var F=(t,e,i,n)=>{let r=65535&t,s=t>>>16&65535,a=0;for(;0!==i;){a=i>2e3?2e3:i,i-=a;do{r=r+e[n++]|0,s=s+r|0}while(--a);r%=65521,s%=65521}return r|s<<16};const N=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var Z=(t,e,i,n)=>{const r=N,s=n+i;t^=-1;for(let i=n;i<s;i++)t=t>>>8^r[255&(t^e[i])];return-1^t},$={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},P={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const j=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var z=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)j(i,e)&&(t[e]=i[e])}}return t},W=t=>{let e=0;for(let i=0,n=t.length;i<n;i++)e+=t[i].length;const i=new Uint8Array(e);for(let e=0,n=0,r=t.length;e<r;e++){let r=t[e];i.set(r,n),n+=r.length}return i};let H=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){H=!1}const K=new Uint8Array(256);for(let t=0;t<256;t++)K[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;K[254]=K[254]=1;var G=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,n,r,s,a=t.length,o=0;for(r=0;r<a;r++)i=t.charCodeAt(r),55296==(64512&i)&&r+1<a&&(n=t.charCodeAt(r+1),56320==(64512&n)&&(i=65536+(i-55296<<10)+(n-56320),r++)),o+=i<128?1:i<2048?2:i<65536?3:4;for(e=new Uint8Array(o),s=0,r=0;s<o;r++)i=t.charCodeAt(r),55296==(64512&i)&&r+1<a&&(n=t.charCodeAt(r+1),56320==(64512&n)&&(i=65536+(i-55296<<10)+(n-56320),r++)),i<128?e[s++]=i:i<2048?(e[s++]=192|i>>>6,e[s++]=128|63&i):i<65536?(e[s++]=224|i>>>12,e[s++]=128|i>>>6&63,e[s++]=128|63&i):(e[s++]=240|i>>>18,e[s++]=128|i>>>12&63,e[s++]=128|i>>>6&63,e[s++]=128|63&i);return e},q=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,r;const s=new Array(2*i);for(r=0,n=0;n<i;){let e=t[n++];if(e<128){s[r++]=e;continue}let a=K[e];if(a>4)s[r++]=65533,n+=a-1;else{for(e&=2===a?31:3===a?15:7;a>1&&n<i;)e=e<<6|63&t[n++],a--;a>1?s[r++]=65533:e<65536?s[r++]=e:(e-=65536,s[r++]=55296|e>>10&1023,s[r++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&H)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let n=0;n<e;n++)i+=String.fromCharCode(t[n]);return i})(s,r)},Y=(t,e)=>{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+K[t[i]]>e?i:e};var V=function(){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};const X=16209;var J=function(t,e){let i,n,r,s,a,o,h,f,l,d,c,u,p,w,b,_,g,y,m,k,v,A,E,x;const U=t.state;i=t.next_in,E=t.input,n=i+(t.avail_in-5),r=t.next_out,x=t.output,s=r-(e-t.avail_out),a=r+(t.avail_out-257),o=U.dmax,h=U.wsize,f=U.whave,l=U.wnext,d=U.window,c=U.hold,u=U.bits,p=U.lencode,w=U.distcode,b=(1<<U.lenbits)-1,_=(1<<U.distbits)-1;t:do{u<15&&(c+=E[i++]<<u,u+=8,c+=E[i++]<<u,u+=8),g=p[c&b];e:for(;;){if(y=g>>>24,c>>>=y,u-=y,y=g>>>16&255,0===y)x[r++]=65535&g;else{if(!(16&y)){if(64&y){if(32&y){U.mode=16191;break t}t.msg="invalid literal/length code",U.mode=X;break t}g=p[(65535&g)+(c&(1<<y)-1)];continue e}for(m=65535&g,y&=15,y&&(u<y&&(c+=E[i++]<<u,u+=8),m+=c&(1<<y)-1,c>>>=y,u-=y),u<15&&(c+=E[i++]<<u,u+=8,c+=E[i++]<<u,u+=8),g=w[c&_];;){if(y=g>>>24,c>>>=y,u-=y,y=g>>>16&255,16&y){if(k=65535&g,y&=15,u<y&&(c+=E[i++]<<u,u+=8,u<y&&(c+=E[i++]<<u,u+=8)),k+=c&(1<<y)-1,k>o){t.msg="invalid distance too far back",U.mode=X;break t}if(c>>>=y,u-=y,y=r-s,k>y){if(y=k-y,y>f&&U.sane){t.msg="invalid distance too far back",U.mode=X;break t}if(v=0,A=d,0===l){if(v+=h-y,y<m){m-=y;do{x[r++]=d[v++]}while(--y);v=r-k,A=x}}else if(l<y){if(v+=h+l-y,y-=l,y<m){m-=y;do{x[r++]=d[v++]}while(--y);if(v=0,l<m){y=l,m-=y;do{x[r++]=d[v++]}while(--y);v=r-k,A=x}}}else if(v+=l-y,y<m){m-=y;do{x[r++]=d[v++]}while(--y);v=r-k,A=x}for(;m>2;)x[r++]=A[v++],x[r++]=A[v++],x[r++]=A[v++],m-=3;m&&(x[r++]=A[v++],m>1&&(x[r++]=A[v++]))}else{v=r-k;do{x[r++]=x[v++],x[r++]=x[v++],x[r++]=x[v++],m-=3}while(m>2);m&&(x[r++]=x[v++],m>1&&(x[r++]=x[v++]))}break}if(64&y){t.msg="invalid distance code",U.mode=X;break t}g=w[(65535&g)+(c&(1<<y)-1)]}}break}}while(i<n&&r<a);m=u>>3,i-=m,u-=m<<3,c&=(1<<u)-1,t.next_in=i,t.next_out=r,t.avail_in=i<n?n-i+5:5-(i-n),t.avail_out=r<a?a-r+257:257-(r-a),U.hold=c,U.bits=u};const Q=15,tt=new Uint16Array([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]),et=new Uint8Array([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]),it=new Uint16Array([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]),nt=new Uint8Array([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]);var rt=(t,e,i,n,r,s,a,o)=>{const h=o.bits;let f,l,d,c,u,p,w=0,b=0,_=0,g=0,y=0,m=0,k=0,v=0,A=0,E=0,x=null;const U=new Uint16Array(16),T=new Uint16Array(16);let B,O,C,I=null;for(w=0;w<=Q;w++)U[w]=0;for(b=0;b<n;b++)U[e[i+b]]++;for(y=h,g=Q;g>=1&&0===U[g];g--);if(y>g&&(y=g),0===g)return r[s++]=20971520,r[s++]=20971520,o.bits=1,0;for(_=1;_<g&&0===U[_];_++);for(y<_&&(y=_),v=1,w=1;w<=Q;w++)if(v<<=1,v-=U[w],v<0)return-1;if(v>0&&(0===t||1!==g))return-1;for(T[1]=0,w=1;w<Q;w++)T[w+1]=T[w]+U[w];for(b=0;b<n;b++)0!==e[i+b]&&(a[T[e[i+b]]++]=b);if(0===t?(x=I=a,p=20):1===t?(x=tt,I=et,p=257):(x=it,I=nt,p=0),E=0,b=0,w=_,u=s,m=y,k=0,d=-1,A=1<<y,c=A-1,1===t&&A>852||2===t&&A>592)return 1;for(;;){B=w-k,a[b]+1<p?(O=0,C=a[b]):a[b]>=p?(O=I[a[b]-p],C=x[a[b]-p]):(O=96,C=0),f=1<<w-k,l=1<<m,_=l;do{l-=f,r[u+(E>>k)+l]=B<<24|O<<16|C}while(0!==l);for(f=1<<w-1;E&f;)f>>=1;if(0!==f?(E&=f-1,E+=f):E=0,b++,0===--U[w]){if(w===g)break;w=e[i+a[b]]}if(w>y&&(E&c)!==d){for(0===k&&(k=y),u+=_,m=w-k,v=1<<m;m+k<g&&(v-=U[m+k],!(v<=0));)m++,v<<=1;if(A+=1<<m,1===t&&A>852||2===t&&A>592)return 1;d=E&c,r[d]=y<<24|m<<16|u-s}}return 0!==E&&(r[u+E]=w-k<<24|64<<16),o.bits=y,0};const{Z_FINISH:st,Z_BLOCK:at,Z_TREES:ot,Z_OK:ht,Z_STREAM_END:ft,Z_NEED_DICT:lt,Z_STREAM_ERROR:dt,Z_DATA_ERROR:ct,Z_MEM_ERROR:ut,Z_BUF_ERROR:pt,Z_DEFLATED:wt}=P,bt=16180,_t=16190,gt=16191,yt=16192,mt=16194,kt=16199,vt=16200,At=16206,Et=16209,xt=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function Ut(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,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 Tt=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<bt||e.mode>16211?1:0},Bt=t=>{if(Tt(t))return dt;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=bt,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,ht},Ot=t=>{if(Tt(t))return dt;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Bt(t)},Ct=(t,e)=>{let i;if(Tt(t))return dt;const n=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?dt:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,Ot(t))},It=(t,e)=>{if(!t)return dt;const i=new Ut;t.state=i,i.strm=t,i.window=null,i.mode=bt;const n=Ct(t,e);return n!==ht&&(t.state=null),n};let Rt,St,Dt=!0;const Mt=t=>{if(Dt){Rt=new Int32Array(512),St=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(rt(1,t.lens,0,288,Rt,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;rt(2,t.lens,0,32,St,0,t.work,{bits:5}),Dt=!1}t.lencode=Rt,t.lenbits=9,t.distcode=St,t.distbits=5},Lt=(t,e,i,n)=>{let r;const s=t.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),n>=s.wsize?(s.window.set(e.subarray(i-s.wsize,i),0),s.wnext=0,s.whave=s.wsize):(r=s.wsize-s.wnext,r>n&&(r=n),s.window.set(e.subarray(i-n,i-n+r),s.wnext),(n-=r)?(s.window.set(e.subarray(i-n,i),0),s.wnext=n,s.whave=s.wsize):(s.wnext+=r,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=r))),0};var Ft={inflateReset:Ot,inflateReset2:Ct,inflateResetKeep:Bt,inflateInit:t=>It(t,15),inflateInit2:It,inflate:(t,e)=>{let i,n,r,s,a,o,h,f,l,d,c,u,p,w,b,_,g,y,m,k,v,A,E=0;const x=new Uint8Array(4);let U,T;const B=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Tt(t)||!t.output||!t.input&&0!==t.avail_in)return dt;i=t.state,i.mode===gt&&(i.mode=yt),a=t.next_out,r=t.output,h=t.avail_out,s=t.next_in,n=t.input,o=t.avail_in,f=i.hold,l=i.bits,d=o,c=h,A=ht;t:for(;;)switch(i.mode){case bt:if(0===i.wrap){i.mode=yt;break}for(;l<16;){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}if(2&i.wrap&&35615===f){0===i.wbits&&(i.wbits=15),i.check=0,x[0]=255&f,x[1]=f>>>8&255,i.check=Z(i.check,x,2,0),f=0,l=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&f)<<8)+(f>>8))%31){t.msg="incorrect header check",i.mode=Et;break}if((15&f)!==wt){t.msg="unknown compression method",i.mode=Et;break}if(f>>>=4,l-=4,v=8+(15&f),0===i.wbits&&(i.wbits=v),v>15||v>i.wbits){t.msg="invalid window size",i.mode=Et;break}i.dmax=1<<i.wbits,i.flags=0,t.adler=i.check=1,i.mode=512&f?16189:gt,f=0,l=0;break;case 16181:for(;l<16;){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}if(i.flags=f,(255&i.flags)!==wt){t.msg="unknown compression method",i.mode=Et;break}if(57344&i.flags){t.msg="unknown header flags set",i.mode=Et;break}i.head&&(i.head.text=f>>8&1),512&i.flags&&4&i.wrap&&(x[0]=255&f,x[1]=f>>>8&255,i.check=Z(i.check,x,2,0)),f=0,l=0,i.mode=16182;case 16182:for(;l<32;){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}i.head&&(i.head.time=f),512&i.flags&&4&i.wrap&&(x[0]=255&f,x[1]=f>>>8&255,x[2]=f>>>16&255,x[3]=f>>>24&255,i.check=Z(i.check,x,4,0)),f=0,l=0,i.mode=16183;case 16183:for(;l<16;){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}i.head&&(i.head.xflags=255&f,i.head.os=f>>8),512&i.flags&&4&i.wrap&&(x[0]=255&f,x[1]=f>>>8&255,i.check=Z(i.check,x,2,0)),f=0,l=0,i.mode=16184;case 16184:if(1024&i.flags){for(;l<16;){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}i.length=f,i.head&&(i.head.extra_len=f),512&i.flags&&4&i.wrap&&(x[0]=255&f,x[1]=f>>>8&255,i.check=Z(i.check,x,2,0)),f=0,l=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(u=i.length,u>o&&(u=o),u&&(i.head&&(v=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(s,s+u),v)),512&i.flags&&4&i.wrap&&(i.check=Z(i.check,n,u,s)),o-=u,s+=u,i.length-=u),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===o)break t;u=0;do{v=n[s+u++],i.head&&v&&i.length<65536&&(i.head.name+=String.fromCharCode(v))}while(v&&u<o);if(512&i.flags&&4&i.wrap&&(i.check=Z(i.check,n,u,s)),o-=u,s+=u,v)break t}else i.head&&(i.head.name=null);i.length=0,i.mode=16187;case 16187:if(4096&i.flags){if(0===o)break t;u=0;do{v=n[s+u++],i.head&&v&&i.length<65536&&(i.head.comment+=String.fromCharCode(v))}while(v&&u<o);if(512&i.flags&&4&i.wrap&&(i.check=Z(i.check,n,u,s)),o-=u,s+=u,v)break t}else i.head&&(i.head.comment=null);i.mode=16188;case 16188:if(512&i.flags){for(;l<16;){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}if(4&i.wrap&&f!==(65535&i.check)){t.msg="header crc mismatch",i.mode=Et;break}f=0,l=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=gt;break;case 16189:for(;l<32;){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}t.adler=i.check=xt(f),f=0,l=0,i.mode=_t;case _t:if(0===i.havedict)return t.next_out=a,t.avail_out=h,t.next_in=s,t.avail_in=o,i.hold=f,i.bits=l,lt;t.adler=i.check=1,i.mode=gt;case gt:if(e===at||e===ot)break t;case yt:if(i.last){f>>>=7&l,l-=7&l,i.mode=At;break}for(;l<3;){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}switch(i.last=1&f,f>>>=1,l-=1,3&f){case 0:i.mode=16193;break;case 1:if(Mt(i),i.mode=kt,e===ot){f>>>=2,l-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=Et}f>>>=2,l-=2;break;case 16193:for(f>>>=7&l,l-=7&l;l<32;){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}if((65535&f)!=(f>>>16^65535)){t.msg="invalid stored block lengths",i.mode=Et;break}if(i.length=65535&f,f=0,l=0,i.mode=mt,e===ot)break t;case mt:i.mode=16195;case 16195:if(u=i.length,u){if(u>o&&(u=o),u>h&&(u=h),0===u)break t;r.set(n.subarray(s,s+u),a),o-=u,s+=u,h-=u,a+=u,i.length-=u;break}i.mode=gt;break;case 16196:for(;l<14;){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}if(i.nlen=257+(31&f),f>>>=5,l-=5,i.ndist=1+(31&f),f>>>=5,l-=5,i.ncode=4+(15&f),f>>>=4,l-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=Et;break}i.have=0,i.mode=16197;case 16197:for(;i.have<i.ncode;){for(;l<3;){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}i.lens[B[i.have++]]=7&f,f>>>=3,l-=3}for(;i.have<19;)i.lens[B[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,U={bits:i.lenbits},A=rt(0,i.lens,0,19,i.lencode,0,i.work,U),i.lenbits=U.bits,A){t.msg="invalid code lengths set",i.mode=Et;break}i.have=0,i.mode=16198;case 16198:for(;i.have<i.nlen+i.ndist;){for(;E=i.lencode[f&(1<<i.lenbits)-1],b=E>>>24,_=E>>>16&255,g=65535&E,!(b<=l);){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}if(g<16)f>>>=b,l-=b,i.lens[i.have++]=g;else{if(16===g){for(T=b+2;l<T;){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}if(f>>>=b,l-=b,0===i.have){t.msg="invalid bit length repeat",i.mode=Et;break}v=i.lens[i.have-1],u=3+(3&f),f>>>=2,l-=2}else if(17===g){for(T=b+3;l<T;){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}f>>>=b,l-=b,v=0,u=3+(7&f),f>>>=3,l-=3}else{for(T=b+7;l<T;){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}f>>>=b,l-=b,v=0,u=11+(127&f),f>>>=7,l-=7}if(i.have+u>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=Et;break}for(;u--;)i.lens[i.have++]=v}}if(i.mode===Et)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=Et;break}if(i.lenbits=9,U={bits:i.lenbits},A=rt(1,i.lens,0,i.nlen,i.lencode,0,i.work,U),i.lenbits=U.bits,A){t.msg="invalid literal/lengths set",i.mode=Et;break}if(i.distbits=6,i.distcode=i.distdyn,U={bits:i.distbits},A=rt(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,U),i.distbits=U.bits,A){t.msg="invalid distances set",i.mode=Et;break}if(i.mode=kt,e===ot)break t;case kt:i.mode=vt;case vt:if(o>=6&&h>=258){t.next_out=a,t.avail_out=h,t.next_in=s,t.avail_in=o,i.hold=f,i.bits=l,J(t,c),a=t.next_out,r=t.output,h=t.avail_out,s=t.next_in,n=t.input,o=t.avail_in,f=i.hold,l=i.bits,i.mode===gt&&(i.back=-1);break}for(i.back=0;E=i.lencode[f&(1<<i.lenbits)-1],b=E>>>24,_=E>>>16&255,g=65535&E,!(b<=l);){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}if(_&&!(240&_)){for(y=b,m=_,k=g;E=i.lencode[k+((f&(1<<y+m)-1)>>y)],b=E>>>24,_=E>>>16&255,g=65535&E,!(y+b<=l);){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}f>>>=y,l-=y,i.back+=y}if(f>>>=b,l-=b,i.back+=b,i.length=g,0===_){i.mode=16205;break}if(32&_){i.back=-1,i.mode=gt;break}if(64&_){t.msg="invalid literal/length code",i.mode=Et;break}i.extra=15&_,i.mode=16201;case 16201:if(i.extra){for(T=i.extra;l<T;){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}i.length+=f&(1<<i.extra)-1,f>>>=i.extra,l-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;E=i.distcode[f&(1<<i.distbits)-1],b=E>>>24,_=E>>>16&255,g=65535&E,!(b<=l);){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}if(!(240&_)){for(y=b,m=_,k=g;E=i.distcode[k+((f&(1<<y+m)-1)>>y)],b=E>>>24,_=E>>>16&255,g=65535&E,!(y+b<=l);){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}f>>>=y,l-=y,i.back+=y}if(f>>>=b,l-=b,i.back+=b,64&_){t.msg="invalid distance code",i.mode=Et;break}i.offset=g,i.extra=15&_,i.mode=16203;case 16203:if(i.extra){for(T=i.extra;l<T;){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}i.offset+=f&(1<<i.extra)-1,f>>>=i.extra,l-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=Et;break}i.mode=16204;case 16204:if(0===h)break t;if(u=c-h,i.offset>u){if(u=i.offset-u,u>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=Et;break}u>i.wnext?(u-=i.wnext,p=i.wsize-u):p=i.wnext-u,u>i.length&&(u=i.length),w=i.window}else w=r,p=a-i.offset,u=i.length;u>h&&(u=h),h-=u,i.length-=u;do{r[a++]=w[p++]}while(--u);0===i.length&&(i.mode=vt);break;case 16205:if(0===h)break t;r[a++]=i.length,h--,i.mode=vt;break;case At:if(i.wrap){for(;l<32;){if(0===o)break t;o--,f|=n[s++]<<l,l+=8}if(c-=h,t.total_out+=c,i.total+=c,4&i.wrap&&c&&(t.adler=i.check=i.flags?Z(i.check,r,c,a-c):F(i.check,r,c,a-c)),c=h,4&i.wrap&&(i.flags?f:xt(f))!==i.check){t.msg="incorrect data check",i.mode=Et;break}f=0,l=0}i.mode=16207;case 16207:if(i.wrap&&i.flags){for(;l<32;){if(0===o)break t;o--,f+=n[s++]<<l,l+=8}if(4&i.wrap&&f!==(4294967295&i.total)){t.msg="incorrect length check",i.mode=Et;break}f=0,l=0}i.mode=16208;case 16208:A=ft;break t;case Et:A=ct;break t;case 16210:return ut;default:return dt}return t.next_out=a,t.avail_out=h,t.next_in=s,t.avail_in=o,i.hold=f,i.bits=l,(i.wsize||c!==t.avail_out&&i.mode<Et&&(i.mode<At||e!==st))&&Lt(t,t.output,t.next_out,c-t.avail_out),d-=t.avail_in,c-=t.avail_out,t.total_in+=d,t.total_out+=c,i.total+=c,4&i.wrap&&c&&(t.adler=i.check=i.flags?Z(i.check,r,c,t.next_out-c):F(i.check,r,c,t.next_out-c)),t.data_type=i.bits+(i.last?64:0)+(i.mode===gt?128:0)+(i.mode===kt||i.mode===mt?256:0),(0===d&&0===c||e===st)&&A===ht&&(A=pt),A},inflateEnd:t=>{if(Tt(t))return dt;let e=t.state;return e.window&&(e.window=null),t.state=null,ht},inflateGetHeader:(t,e)=>{if(Tt(t))return dt;const i=t.state;return 2&i.wrap?(i.head=e,e.done=!1,ht):dt},inflateSetDictionary:(t,e)=>{const i=e.length;let n,r,s;return Tt(t)?dt:(n=t.state,0!==n.wrap&&n.mode!==_t?dt:n.mode===_t&&(r=1,r=F(r,e,i,0),r!==n.check)?ct:(s=Lt(t,e,i,i),s?(n.mode=16210,ut):(n.havedict=1,ht)))},inflateInfo:"pako inflate (from Nodeca project)"};var Nt=function(){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=!1};const Zt=Object.prototype.toString,{Z_NO_FLUSH:$t,Z_FINISH:Pt,Z_OK:jt,Z_STREAM_END:zt,Z_NEED_DICT:Wt,Z_STREAM_ERROR:Ht,Z_DATA_ERROR:Kt,Z_MEM_ERROR:Gt}=P;function qt(t){this.options=z({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(15&e.windowBits||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new V,this.strm.avail_out=0;let i=Ft.inflateInit2(this.strm,e.windowBits);if(i!==jt)throw new Error($[i]);if(this.header=new Nt,Ft.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=G(e.dictionary):"[object ArrayBuffer]"===Zt.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=Ft.inflateSetDictionary(this.strm,e.dictionary),i!==jt)))throw new Error($[i])}qt.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize,r=this.options.dictionary;let s,a,o;if(this.ended)return!1;for(a=e===~~e?e:!0===e?Pt:$t,"[object ArrayBuffer]"===Zt.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),s=Ft.inflate(i,a),s===Wt&&r&&(s=Ft.inflateSetDictionary(i,r),s===jt?s=Ft.inflate(i,a):s===Kt&&(s=Wt));i.avail_in>0&&s===zt&&i.state.wrap>0&&0!==t[i.next_in];)Ft.inflateReset(i),s=Ft.inflate(i,a);switch(s){case Ht:case Kt:case Wt:case Gt:return this.onEnd(s),this.ended=!0,!1}if(o=i.avail_out,i.next_out&&(0===i.avail_out||s===zt))if("string"===this.options.to){let t=Y(i.output,i.next_out),e=i.next_out-t,r=q(i.output,t);i.next_out=e,i.avail_out=n-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(r)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(s!==jt||0!==o){if(s===zt)return s=Ft.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},qt.prototype.onData=function(t){this.chunks.push(t)},qt.prototype.onEnd=function(t){t===jt&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=W(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Yt={Inflate:qt,inflate:function(t,e){const i=new qt(e);if(i.push(t),i.err)throw i.msg||$[i.err];return i.result}};const{Inflate:Vt,inflate:Xt}=Yt;var Jt=Vt,Qt=Xt;const te=[];for(let t=0;t<256;t++){let e=t;for(let t=0;t<8;t++)1&e?e=3988292384^e>>>1:e>>>=1;te[t]=e}const ee=4294967295;function ie(t,e){return(function(t,e,i){let n=t;for(let t=0;t<i;t++)n=te[255&(n^e[t])]^n>>>8;return n}(ee,t,e)^ee)>>>0}function ne(t,e,i){const n=t.readUint32(),r=ie(new Uint8Array(t.buffer,t.byteOffset+t.offset-e-4,e),e);if(r!==n)throw new Error(\`CRC mismatch for chunk \${i}. Expected \${n}, found \${r}\`)}function re(t,e,i){for(let n=0;n<i;n++)e[n]=t[n]}function se(t,e,i,n){let r=0;for(;r<n;r++)e[r]=t[r];for(;r<i;r++)e[r]=t[r]+e[r-n]&255}function ae(t,e,i,n){let r=0;if(0===i.length)for(;r<n;r++)e[r]=t[r];else for(;r<n;r++)e[r]=t[r]+i[r]&255}function oe(t,e,i,n,r){let s=0;if(0===i.length){for(;s<r;s++)e[s]=t[s];for(;s<n;s++)e[s]=t[s]+(e[s-r]>>1)&255}else{for(;s<r;s++)e[s]=t[s]+(i[s]>>1)&255;for(;s<n;s++)e[s]=t[s]+(e[s-r]+i[s]>>1)&255}}function he(t,e,i,n,r){let s=0;if(0===i.length){for(;s<r;s++)e[s]=t[s];for(;s<n;s++)e[s]=t[s]+e[s-r]&255}else{for(;s<r;s++)e[s]=t[s]+i[s]&255;for(;s<n;s++)e[s]=t[s]+fe(e[s-r],i[s],i[s-r])&255}}function fe(t,e,i){const n=t+e-i,r=Math.abs(n-t),s=Math.abs(n-e),a=Math.abs(n-i);return r<=s&&r<=a?t:s<=a?e:i}function le(t,e,i,n,r,s){switch(t){case 0:re(e,i,r);break;case 1:se(e,i,r,s);break;case 2:ae(e,i,n,r);break;case 3:oe(e,i,n,r,s);break;case 4:he(e,i,n,r,s);break;default:throw new Error(\`Unsupported filter: \${t}\`)}}const de=new Uint16Array([255]),ce=255===new Uint8Array(de.buffer)[0];function ue(t){return(255&t)<<8|t>>8&255}const pe=new Uint16Array([255]),we=255===new Uint8Array(pe.buffer)[0],be=new Uint8Array(0);function _e(t){const{data:e,width:i,height:n,channels:r,depth:s}=t,a=Math.ceil(s/8)*r,o=Math.ceil(s/8*r*i),h=new Uint8Array(n*o);let f,l,d=be,c=0;for(let t=0;t<n;t++){switch(f=e.subarray(c+1,c+1+o),l=h.subarray(t*o,(t+1)*o),e[c]){case 0:re(f,l,o);break;case 1:se(f,l,o,a);break;case 2:ae(f,l,d,o);break;case 3:oe(f,l,d,o,a);break;case 4:he(f,l,d,o,a);break;default:throw new Error(\`Unsupported filter: \${e[c]}\`)}d=l,c+=o+1}if(16===s){const t=new Uint16Array(h.buffer);if(we)for(let e=0;e<t.length;e++)t[e]=ge(t[e]);return t}return h}function ge(t){return(255&t)<<8|t>>8&255}const ye=Uint8Array.of(137,80,78,71,13,10,26,10);function me(t){if(!function(t){if(t.length<ye.length)return!1;for(let e=0;e<ye.length;e++)if(t[e]!==ye[e])return!1;return!0}(t.readBytes(ye.length)))throw new Error("wrong PNG signature")}const ke=new TextDecoder("latin1");function ve(t){if(function(t){if(!Ae.test(t))throw new Error("invalid latin1 text")}(t),0===t.length||t.length>79)throw new Error("keyword length must be between 1 and 79")}const Ae=/^[\u0000-\u00FF]*$/;function Ee(t,e,i){const n=xe(e);t[n]=function(t,e){return ke.decode(t.readBytes(e))}(e,i-n.length-1)}function xe(t){for(t.mark();0!==t.readByte(););const e=t.offset;t.reset();const i=ke.decode(t.readBytes(e-t.offset-1));return t.skip(1),ve(i),i}const Ue=-1,Te=0,Be=2,Oe=3,Ce=4,Ie=6,Re=-1,Se=0,De=-1,Me=0,Le=-1,Fe=0,Ne=1,Ze=0,$e=1,Pe=2,je=0,ze=1;class We extends M{_checkCrc;_inflator;_png;_apng;_end;_hasPalette;_palette;_hasTransparency;_transparency;_compressionMethod;_filterMethod;_interlaceMethod;_colorType;_isAnimated;_numberOfFrames;_numberOfPlays;_frames;_writingDataChunks;constructor(t,e={}){super(t);const{checkCrc:i=!1}=e;this._checkCrc=i,this._inflator=new Jt,this._png={width:-1,height:-1,channels:-1,data:new Uint8Array(0),depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array(0),this._compressionMethod=Re,this._filterMethod=De,this._interlaceMethod=Le,this._colorType=Ue,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(me(this);!this._end;){const t=this.readUint32(),e=this.readChars(4);this.decodeChunk(t,e)}return this.decodeImage(),this._png}decodeApng(){for(me(this);!this._end;){const t=this.readUint32(),e=this.readChars(4);this.decodeApngChunk(t,e)}return this.decodeApngImage(),this._apng}decodeChunk(t,e){const i=this.offset;switch(e){case"IHDR":this.decodeIHDR();break;case"PLTE":this.decodePLTE(t);break;case"IDAT":this.decodeIDAT(t);break;case"IEND":this._end=!0;break;case"tRNS":this.decodetRNS(t);break;case"iCCP":this.decodeiCCP(t);break;case"tEXt":Ee(this._png.text,this,t);break;case"pHYs":this.decodepHYs();break;default:this.skip(t)}if(this.offset-i!==t)throw new Error(\`Length mismatch while decoding chunk \${e}\`);this._checkCrc?ne(this,t+4,e):this.skip(4)}decodeApngChunk(t,e){const i=this.offset;switch("fdAT"!==e&&"IDAT"!==e&&this._writingDataChunks&&this.pushDataToFrame(),e){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(t);break;default:this.decodeChunk(t,e),this.offset=i+t}if(this.offset-i!==t)throw new Error(\`Length mismatch while decoding chunk \${e}\`);this._checkCrc?ne(this,t+4,e):this.skip(4)}decodeIHDR(){const t=this._png;t.width=this.readUint32(),t.height=this.readUint32(),t.depth=function(t){if(1!==t&&2!==t&&4!==t&&8!==t&&16!==t)throw new Error(\`invalid bit depth: \${t}\`);return t}(this.readUint8());const e=this.readUint8();let i;switch(this._colorType=e,e){case Te:i=1;break;case Be:i=3;break;case Oe:i=1;break;case Ce:i=2;break;case Ie:i=4;break;default:throw new Error(\`Unknown color type: \${e}\`)}if(this._png.channels=i,this._compressionMethod=this.readUint8(),this._compressionMethod!==Se)throw new Error(\`Unsupported compression method: \${this._compressionMethod}\`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){const t={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array(0)};this._frames.push(t)}decodePLTE(t){if(t%3!=0)throw new RangeError(\`PLTE field length must be a multiple of 3. Got \${t}\`);const e=t/3;this._hasPalette=!0;const i=[];this._palette=i;for(let t=0;t<e;t++)i.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(t){this._writingDataChunks=!0;const e=t,i=this.offset+this.byteOffset;if(this._inflator.push(new Uint8Array(this.buffer,i,e)),this._inflator.err)throw new Error(\`Error while decompressing the data: \${this._inflator.err}\`);this.skip(t)}decodeFDAT(t){this._writingDataChunks=!0;let e=t,i=this.offset+this.byteOffset;if(i+=4,e-=4,this._inflator.push(new Uint8Array(this.buffer,i,e)),this._inflator.err)throw new Error(\`Error while decompressing the data: \${this._inflator.err}\`);this.skip(t)}decodetRNS(t){switch(this._colorType){case Te:case Be:if(t%2!=0)throw new RangeError(\`tRNS chunk length must be a multiple of 2. Got \${t}\`);if(t/2>this._png.width*this._png.height)throw new Error(\`tRNS chunk contains more alpha values than there are pixels (\${t/2} vs \${this._png.width*this._png.height})\`);this._hasTransparency=!0,this._transparency=new Uint16Array(t/2);for(let e=0;e<t/2;e++)this._transparency[e]=this.readUint16();break;case Oe:{if(t>this._palette.length)throw new Error(\`tRNS chunk contains more alpha values than there are palette colors (\${t} vs \${this._palette.length})\`);let e=0;for(;e<t;e++){const t=this.readByte();this._palette[e].push(t)}for(;e<this._palette.length;e++)this._palette[e].push(255);break}default:throw new Error(\`tRNS chunk is not supported for color type \${this._colorType}\`)}}decodeiCCP(t){const e=xe(this),i=this.readUint8();if(i!==Se)throw new Error(\`Unsupported iCCP compression method: \${i}\`);const n=this.readBytes(t-e.length-2);this._png.iccEmbeddedProfile={name:e,profile:Qt(n)}}decodepHYs(){const t=this.readUint32(),e=this.readUint32(),i=this.readByte();this._png.resolution={x:t,y:e,unit:i}}decodeApngImage(){this._apng.width=this._png.width,this._apng.height=this._png.height,this._apng.channels=this._png.channels,this._apng.depth=this._png.depth,this._apng.numberOfFrames=this._numberOfFrames,this._apng.numberOfPlays=this._numberOfPlays,this._apng.text=this._png.text,this._apng.resolution=this._png.resolution;for(let t=0;t<this._numberOfFrames;t++){const e={sequenceNumber:this._frames[t].sequenceNumber,delayNumber:this._frames[t].delayNumber,delayDenominator:this._frames[t].delayDenominator,data:8===this._apng.depth?new Uint8Array(this._apng.width*this._apng.height*this._apng.channels):new Uint16Array(this._apng.width*this._apng.height*this._apng.channels)},i=this._frames.at(t);if(i){if(i.data=_e({data:i.data,width:i.width,height:i.height,channels:this._apng.channels,depth:this._apng.depth}),this._hasPalette&&(this._apng.palette=this._palette),this._hasTransparency&&(this._apng.transparency=this._transparency),0===t||0===i.xOffset&&0===i.yOffset&&i.width===this._png.width&&i.height===this._png.height)e.data=i.data;else{const n=this._apng.frames.at(t-1);this.disposeFrame(i,n,e),this.addFrameDataToCanvas(e,i)}this._apng.frames.push(e)}}return this._apng}disposeFrame(t,e,i){switch(t.disposeOp){case Ze:break;case $e:for(let e=0;e<this._png.height;e++)for(let n=0;n<this._png.width;n++){const r=(e*t.width+n)*this._png.channels;for(let t=0;t<this._png.channels;t++)i.data[r+t]=0}break;case Pe:i.data.set(e.data);break;default:throw new Error("Unknown disposeOp")}}addFrameDataToCanvas(t,e){const i=1<<this._png.depth,n=(t,i)=>({index:((t+e.yOffset)*this._png.width+e.xOffset+i)*this._png.channels,frameIndex:(t*e.width+i)*this._png.channels});switch(e.blendOp){case je:for(let i=0;i<e.height;i++)for(let r=0;r<e.width;r++){const{index:s,frameIndex:a}=n(i,r);for(let i=0;i<this._png.channels;i++)t.data[s+i]=e.data[a+i]}break;case ze:for(let r=0;r<e.height;r++)for(let s=0;s<e.width;s++){const{index:a,frameIndex:o}=n(r,s);for(let n=0;n<this._png.channels;n++){const r=e.data[o+this._png.channels-1]/i,s=n%(this._png.channels-1)==0?1:e.data[o+n],h=Math.floor(r*s+(1-r)*t.data[a+n]);t.data[a+n]+=h}}break;default:throw new Error("Unknown blendOp")}}decodeImage(){if(this._inflator.err)throw new Error(\`Error while decompressing the data: \${this._inflator.err}\`);const t=this._isAnimated?(this._frames?.at(0)).data:this._inflator.result;if(this._filterMethod!==Me)throw new Error(\`Filter method \${this._filterMethod} not supported\`);if(this._interlaceMethod===Fe)this._png.data=_e({data:t,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else{if(this._interlaceMethod!==Ne)throw new Error(\`Interlace method \${this._interlaceMethod} not supported\`);this._png.data=function(t){const{data:e,width:i,height:n,channels:r,depth:s}=t,a=[{x:0,y:0,xStep:8,yStep:8},{x:4,y:0,xStep:8,yStep:8},{x:0,y:4,xStep:4,yStep:8},{x:2,y:0,xStep:4,yStep:4},{x:0,y:2,xStep:2,yStep:4},{x:1,y:0,xStep:2,yStep:2},{x:0,y:1,xStep:1,yStep:2}],o=Math.ceil(s/8)*r,h=new Uint8Array(n*i*o);let f=0;for(let t=0;t<7;t++){const r=a[t],s=Math.ceil((i-r.x)/r.xStep),l=Math.ceil((n-r.y)/r.yStep);if(s<=0||l<=0)continue;const d=s*o,c=new Uint8Array(d);for(let t=0;t<l;t++){const a=e[f++],l=e.subarray(f,f+d);f+=d;const u=new Uint8Array(d);le(a,l,u,c,d,o),c.set(u);for(let e=0;e<s;e++){const s=r.x+e*r.xStep,a=r.y+t*r.yStep;if(!(s>=i||a>=n))for(let t=0;t<o;t++)h[(a*i+s)*o+t]=u[e*o+t]}}}if(16===s){const t=new Uint16Array(h.buffer);if(ce)for(let e=0;e<t.length;e++)t[e]=ue(t[e]);return t}return h}({data:t,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth})}this._hasPalette&&(this._png.palette=this._palette),this._hasTransparency&&(this._png.transparency=this._transparency)}pushDataToFrame(){const t=this._inflator.result,e=this._frames.at(-1);e?e.data=t:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:Ze,blendOp:je,data:t}),this._inflator=new Jt,this._writingDataChunks=!1}}var He;!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.METRE=1]="METRE"}(He||(He={})),function(t,{expose:e=x}={}){function i(t){return async(...e)=>O(await t(...e))}e("function"==typeof t?i(t):Object.entries(t).reduce((t,[e,n])=>(t[e]=i(n),t),{}))}(async function(t){return e=t instanceof Uint8Array?t:new Uint8Array(t),new We(e,i).decode();var e,i})}();
|
|
3280
3271
|
`;
|
|
3281
3272
|
|
|
3282
3273
|
function makeController() {
|
|
@@ -3305,6 +3296,6 @@ exports.makeController = makeController;
|
|
|
3305
3296
|
exports.makeWorker = makeWorker;
|
|
3306
3297
|
exports.spawnPool = spawnPool;
|
|
3307
3298
|
exports.spawnWorker = spawnWorker;
|
|
3308
|
-
//# sourceMappingURL=png-decoder-
|
|
3299
|
+
//# sourceMappingURL=png-decoder-BTtMRfiW.js.map
|
|
3309
3300
|
|
|
3310
|
-
//# sourceMappingURL=png-decoder-
|
|
3301
|
+
//# sourceMappingURL=png-decoder-BTtMRfiW.js.map
|