@vertexvis/viewer 0.13.2-canary.9 → 0.14.0
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/{_commonjsHelpers-537d719a.js → _commonjsHelpers-dcc4cf71.js} +21 -0
- package/dist/cjs/{app-globals-3671e828.js → app-globals-2035678d.js} +1 -1
- package/dist/cjs/{browser.esm-075810bf.js → browser.esm-0bcdc581.js} +1 -1
- package/dist/cjs/{bundle.esm-618a5fe9.js → bundle.esm-22b6f2d6.js} +35 -1
- package/dist/cjs/{config-fb124bac.js → config-c63caa4f.js} +3 -2
- package/dist/cjs/{cursors-d71f6a74.js → cursors-f5d3c9a6.js} +13 -1
- package/dist/cjs/{dom-57ef84e9.js → dom-8d90bfaf.js} +1 -1
- package/dist/cjs/dom-d1bbd67c.js +10 -0
- package/dist/cjs/elementRectObserver-9b28f182.js +25 -0
- package/dist/cjs/entities-9eb7e608.js +41 -0
- package/dist/cjs/{entities-90f1347a.js → entities-e71231d8.js} +4 -4
- package/dist/cjs/{grpc-web-client.umd-60a79aae.js → grpc-web-client.umd-2af20c1b.js} +1 -1
- package/dist/cjs/{index-e100709a.js → index-4138aa2c.js} +1 -0
- package/dist/cjs/{index-3bc6bac0.js → index-b9d13137.js} +1 -1
- package/dist/cjs/index.cjs.js +25 -22
- package/dist/cjs/loader.cjs.js +4 -4
- package/dist/cjs/{mapper-80ee2957.js → mapper-08bbab48.js} +4 -4
- package/dist/cjs/{markup-7f7de5f2.js → markup-f7e61d16.js} +2 -2
- package/dist/cjs/{measurement-f1ae9248.js → measurement-3367e9b7.js} +2 -2
- package/dist/cjs/{model-55abd9ab.js → model-5ca87867.js} +1 -1
- package/dist/cjs/model-a9cfd037.js +246 -0
- package/dist/cjs/{overlays-68e8eff2.js → overlays-b0ba69fd.js} +2 -2
- package/dist/cjs/{png-decoder-076131d8.js → png-decoder-ef097f37.js} +2 -2
- package/dist/cjs/{results-e9496869.js → results-178e89a3.js} +1 -1
- package/dist/cjs/{scene-92728420.js → scene-b6b78909.js} +49 -12
- package/dist/cjs/{stencil-a664cd10.js → stencil-ef19638e.js} +5 -1
- package/dist/cjs/{streamAttributes-81eb52f2.js → streamAttributes-c343bdc8.js} +1993 -78
- package/dist/cjs/utils-78928e4e.js +162 -0
- package/dist/cjs/{utils-6397efca.js → utils-b157b0af.js} +1 -1
- package/dist/cjs/{utils-463cd52e.js → utils-c74b8bf0.js} +1 -1
- package/dist/cjs/vertex-scene-tree-search_3.cjs.entry.js +16 -6
- package/dist/cjs/vertex-scene-tree-table-cell.cjs.entry.js +16 -14
- package/dist/cjs/vertex-scene-tree-table-column.cjs.entry.js +1 -1
- package/dist/cjs/vertex-scene-tree-table-header.cjs.entry.js +1 -1
- package/dist/cjs/vertex-scene-tree-table-resize-divider.cjs.entry.js +3 -3
- package/dist/cjs/vertex-scene-tree-toolbar-group.cjs.entry.js +1 -1
- package/dist/cjs/vertex-scene-tree.cjs.entry.js +154 -27
- package/dist/cjs/vertex-viewer-button_3.cjs.entry.js +3 -3
- package/dist/cjs/vertex-viewer-default-toolbar.cjs.entry.js +1 -1
- package/dist/cjs/{vertex-viewer-dom-element_3.cjs.entry.js → vertex-viewer-dom-element_2.cjs.entry.js} +20 -178
- package/dist/cjs/vertex-viewer-dom-group.cjs.entry.js +191 -0
- package/dist/cjs/vertex-viewer-icon.cjs.entry.js +6 -3
- package/dist/cjs/vertex-viewer-layer.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-markup-arrow_3.cjs.entry.js +49 -196
- package/dist/cjs/vertex-viewer-markup-tool.cjs.entry.js +5 -5
- package/dist/cjs/vertex-viewer-markup.cjs.entry.js +5 -5
- package/dist/cjs/vertex-viewer-measurement-details.cjs.entry.js +8 -7
- package/dist/cjs/vertex-viewer-measurement-distance.cjs.entry.js +16 -15
- package/dist/cjs/vertex-viewer-measurement-line_2.cjs.entry.js +10 -9
- package/dist/cjs/vertex-viewer-measurement-precise.cjs.entry.js +18 -35
- package/dist/cjs/vertex-viewer-measurement-tool.cjs.entry.js +8 -7
- package/dist/cjs/vertex-viewer-measurements.cjs.entry.js +12 -11
- package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js +167 -0
- package/dist/cjs/vertex-viewer-pin-label_2.cjs.entry.js +276 -0
- package/dist/cjs/vertex-viewer-pin-tool.cjs.entry.js +322 -0
- package/dist/cjs/vertex-viewer-transform-widget.cjs.entry.js +13272 -0
- package/dist/cjs/vertex-viewer-view-cube.cjs.entry.js +8 -7
- package/dist/cjs/vertex-viewer.cjs.entry.js +119 -52
- package/dist/cjs/viewer.cjs.js +4 -4
- package/dist/cjs/{viewport-54b1389d.js → viewport-5ca619f7.js} +14 -4
- package/dist/collection/__mocks__/regl-shape.js +6 -0
- package/dist/collection/__mocks__/regl.js +3 -0
- package/dist/collection/collection-manifest.json +5 -0
- package/dist/collection/components/scene-tree/lib/controller.js +17 -5
- package/dist/collection/components/scene-tree/lib/errors.js +7 -1
- package/dist/collection/components/scene-tree/lib/viewer-ops.js +12 -1
- package/dist/collection/components/scene-tree/scene-tree.js +112 -22
- package/dist/collection/components/scene-tree-table-cell/scene-tree-table-cell.css +0 -7
- package/dist/collection/components/scene-tree-table-cell/scene-tree-table-cell.js +34 -12
- package/dist/collection/components/scene-tree-table-layout/scene-tree-table-layout.js +14 -2
- package/dist/collection/components/viewer/viewer.js +79 -14
- package/dist/collection/components/viewer-dom-element/viewer-dom-element.js +32 -4
- package/dist/collection/components/viewer-dom-group/utils.js +3 -2
- package/dist/collection/components/viewer-dom-group/viewer-dom-group.js +30 -2
- package/dist/collection/components/viewer-icon/viewer-icon.js +5 -2
- package/dist/collection/components/viewer-markup/utils.js +3 -2
- package/dist/collection/components/viewer-measurement-details/viewer-measurement-details-results.js +2 -2
- package/dist/collection/components/viewer-pin-group/pin-renderer.js +12 -0
- package/dist/collection/components/viewer-pin-group/utils.js +24 -0
- package/dist/collection/components/viewer-pin-group/viewer-pin-group.css +83 -0
- package/dist/collection/components/viewer-pin-group/viewer-pin-group.js +276 -0
- package/dist/collection/components/viewer-pin-label/utils.js +4 -0
- package/dist/collection/components/viewer-pin-label/viewer-pin-label.css +154 -0
- package/dist/collection/components/viewer-pin-label/viewer-pin-label.js +410 -0
- package/dist/collection/components/viewer-pin-label-line/viewer-pin-label-line.css +36 -0
- package/dist/collection/components/viewer-pin-label-line/viewer-pin-label-line.js +61 -0
- package/dist/collection/components/viewer-pin-tool/viewer-pin-tool.css +9 -0
- package/dist/collection/components/viewer-pin-tool/viewer-pin-tool.js +277 -0
- package/dist/collection/components/viewer-transform-widget/__mocks__/widget.js +21 -0
- package/dist/collection/components/viewer-transform-widget/util.js +78 -0
- package/dist/collection/components/viewer-transform-widget/viewer-transform-widget.css +48 -0
- package/dist/collection/components/viewer-transform-widget/viewer-transform-widget.js +442 -0
- package/dist/collection/components/viewer-transform-widget/widget.js +259 -0
- package/dist/collection/lib/cursors.js +11 -1
- package/dist/collection/lib/interactions/baseInteractionHandler.js +9 -2
- package/dist/collection/lib/interactions/flyToPositionKeyInteraction.js +4 -3
- package/dist/collection/lib/interactions/interactionApi.js +21 -1
- package/dist/collection/lib/interactions/interactionApiOrthographic.js +18 -1
- package/dist/collection/lib/interactions/mouseInteractionHandler.js +4 -4
- package/dist/collection/lib/interactions/mouseInteractions.js +24 -1
- package/dist/collection/lib/interactions/multiTouchInteractionHandler.js +1 -2
- package/dist/collection/lib/interactions/pointerInteractionHandler.js +3 -3
- package/dist/collection/lib/mappers/streamAttributes.js +4 -2
- package/dist/collection/lib/pins/controller.js +100 -0
- package/dist/collection/lib/pins/interactions.js +183 -0
- package/dist/collection/lib/pins/model.js +136 -0
- package/dist/collection/lib/rendering/canvas.js +6 -28
- package/dist/collection/lib/scenes/camera.js +34 -2
- package/dist/collection/lib/scenes/colorMaterial.js +8 -8
- package/dist/collection/lib/scenes/mapper.js +2 -1
- package/dist/collection/lib/scenes/queries.js +6 -4
- package/dist/collection/lib/transforms/axis-lines.js +31 -0
- package/dist/collection/lib/transforms/axis-rotation.js +34 -0
- package/dist/collection/lib/transforms/axis-translation.js +30 -0
- package/dist/collection/lib/transforms/controller.js +117 -0
- package/dist/collection/lib/transforms/drawable.js +47 -0
- package/dist/collection/lib/transforms/hits.js +51 -0
- package/dist/collection/lib/transforms/line.js +58 -0
- package/dist/collection/lib/transforms/mesh.js +35 -0
- package/dist/collection/lib/transforms/shape.js +2 -0
- package/dist/collection/lib/transforms/util.js +4 -0
- package/dist/collection/lib/types/depthBuffer.js +2 -2
- package/dist/collection/lib/types/frameCamera.js +4 -6
- package/dist/collection/lib/types/viewport.js +14 -4
- package/dist/custom-elements/index.d.ts +30 -0
- package/dist/custom-elements/index.js +16835 -335
- package/dist/esm/{_commonjsHelpers-9943807e.js → _commonjsHelpers-11ca3be1.js} +20 -1
- package/dist/esm/{app-globals-3a04a531.js → app-globals-40df99a0.js} +1 -1
- package/dist/esm/{browser.esm-e72d80ad.js → browser.esm-1ddb69c9.js} +1 -1
- package/dist/esm/{bundle.esm-8ceccb91.js → bundle.esm-ce2c7ad3.js} +36 -2
- package/dist/esm/{config-fb7cd8ff.js → config-7075833a.js} +3 -2
- package/dist/esm/{cursors-fc2deed7.js → cursors-98b7d89d.js} +12 -2
- package/dist/esm/{dom-2cd18856.js → dom-5b164305.js} +1 -1
- package/dist/esm/dom-be140992.js +8 -0
- package/dist/esm/elementRectObserver-39cf7b95.js +23 -0
- package/dist/esm/{entities-78557270.js → entities-46be90d5.js} +4 -4
- package/dist/esm/entities-ce81dd7f.js +41 -0
- package/dist/esm/{grpc-web-client.umd-5982b7b0.js → grpc-web-client.umd-5409853c.js} +1 -1
- package/dist/esm/{index-10c1495a.js → index-a9fb8318.js} +1 -1
- package/dist/esm/{index-455380d0.js → index-e841d91b.js} +1 -1
- package/dist/esm/index.js +15 -14
- package/dist/esm/index.mjs +15 -14
- package/dist/esm/loader.js +4 -4
- package/dist/esm/loader.mjs +4 -4
- package/dist/esm/{mapper-da36de17.js → mapper-bde6c607.js} +4 -4
- package/dist/esm/{markup-c313d99c.js → markup-8904f2fe.js} +2 -2
- package/dist/esm/{measurement-544b69d5.js → measurement-3f9b0ae0.js} +2 -2
- package/dist/esm/{model-2a34b443.js → model-e54b081f.js} +1 -1
- package/dist/esm/model-f679c493.js +241 -0
- package/dist/esm/{overlays-354e275c.js → overlays-ea2d45ec.js} +2 -2
- package/dist/esm/{png-decoder-07de80d1.js → png-decoder-d4b65417.js} +2 -2
- package/dist/esm/{results-4d0c3568.js → results-3b4df2cf.js} +1 -1
- package/dist/esm/{scene-2bfcce74.js → scene-22ebacfd.js} +49 -12
- package/dist/esm/{stencil-9bf7fb9e.js → stencil-8b20e5a8.js} +5 -2
- package/dist/esm/{streamAttributes-d0b384b3.js → streamAttributes-72a92676.js} +1982 -67
- package/dist/esm/{utils-3ea0acdd.js → utils-0b980078.js} +1 -1
- package/dist/esm/utils-c714e2f7.js +153 -0
- package/dist/esm/{utils-e0941c61.js → utils-f11bd6f7.js} +1 -1
- package/dist/esm/vertex-scene-tree-search_3.entry.js +16 -6
- package/dist/esm/vertex-scene-tree-table-cell.entry.js +16 -14
- package/dist/esm/vertex-scene-tree-table-column.entry.js +1 -1
- package/dist/esm/vertex-scene-tree-table-header.entry.js +1 -1
- package/dist/esm/vertex-scene-tree-table-resize-divider.entry.js +3 -3
- package/dist/esm/vertex-scene-tree-toolbar-group.entry.js +1 -1
- package/dist/esm/vertex-scene-tree.entry.js +154 -27
- package/dist/esm/vertex-viewer-button_3.entry.js +3 -3
- package/dist/esm/vertex-viewer-default-toolbar.entry.js +1 -1
- package/dist/esm/{vertex-viewer-dom-element_3.entry.js → vertex-viewer-dom-element_2.entry.js} +21 -178
- package/dist/esm/vertex-viewer-dom-group.entry.js +187 -0
- package/dist/esm/vertex-viewer-icon.entry.js +6 -3
- package/dist/esm/vertex-viewer-layer.entry.js +1 -1
- package/dist/esm/vertex-viewer-markup-arrow_3.entry.js +8 -155
- package/dist/esm/vertex-viewer-markup-tool.entry.js +5 -5
- package/dist/esm/vertex-viewer-markup.entry.js +5 -5
- package/dist/esm/vertex-viewer-measurement-details.entry.js +8 -7
- package/dist/esm/vertex-viewer-measurement-distance.entry.js +16 -15
- package/dist/esm/vertex-viewer-measurement-line_2.entry.js +10 -9
- package/dist/esm/vertex-viewer-measurement-precise.entry.js +15 -32
- package/dist/esm/vertex-viewer-measurement-tool.entry.js +8 -7
- package/dist/esm/vertex-viewer-measurements.entry.js +12 -11
- package/dist/esm/vertex-viewer-pin-group.entry.js +163 -0
- package/dist/esm/vertex-viewer-pin-label_2.entry.js +271 -0
- package/dist/esm/vertex-viewer-pin-tool.entry.js +318 -0
- package/dist/esm/vertex-viewer-transform-widget.entry.js +13268 -0
- package/dist/esm/vertex-viewer-view-cube.entry.js +8 -7
- package/dist/esm/vertex-viewer.entry.js +118 -51
- package/dist/esm/viewer.js +4 -4
- package/dist/esm/{viewport-5cc7b128.js → viewport-e39e2eba.js} +14 -4
- package/dist/types/__mocks__/regl-shape.d.ts +5 -0
- package/dist/types/__mocks__/regl.d.ts +5 -0
- package/dist/types/components/scene-tree/lib/controller.d.ts +13 -1
- package/dist/types/components/scene-tree/lib/errors.d.ts +3 -1
- package/dist/types/components/scene-tree/lib/viewer-ops.d.ts +1 -0
- package/dist/types/components/scene-tree/scene-tree.d.ts +16 -4
- package/dist/types/components/scene-tree-table-cell/scene-tree-table-cell.d.ts +6 -2
- package/dist/types/components/scene-tree-table-layout/scene-tree-table-layout.d.ts +2 -0
- package/dist/types/components/viewer/viewer.d.ts +13 -1
- package/dist/types/components/viewer-dom-element/viewer-dom-element.d.ts +10 -2
- package/dist/types/components/viewer-dom-group/viewer-dom-group.d.ts +9 -1
- package/dist/types/components/viewer-icon/viewer-icon.d.ts +1 -1
- package/dist/types/components/viewer-pin-group/pin-renderer.d.ts +8 -0
- package/dist/types/components/viewer-pin-group/utils.d.ts +2 -0
- package/dist/types/components/viewer-pin-group/viewer-pin-group.d.ts +49 -0
- package/dist/types/components/viewer-pin-label/utils.d.ts +1 -0
- package/dist/types/components/viewer-pin-label/viewer-pin-label.d.ts +77 -0
- package/dist/types/components/viewer-pin-label-line/viewer-pin-label-line.d.ts +7 -0
- package/dist/types/components/viewer-pin-tool/viewer-pin-tool.d.ts +68 -0
- package/dist/types/components/viewer-transform-widget/__mocks__/widget.d.ts +11 -0
- package/dist/types/components/viewer-transform-widget/util.d.ts +5 -0
- package/dist/types/components/viewer-transform-widget/viewer-transform-widget.d.ts +81 -0
- package/dist/types/components/viewer-transform-widget/widget.d.ts +74 -0
- package/dist/types/components.d.ts +303 -12
- package/dist/types/interfaces.d.ts +1 -0
- package/dist/types/lib/cursors.d.ts +10 -0
- package/dist/types/lib/interactions/baseInteractionHandler.d.ts +4 -3
- package/dist/types/lib/interactions/interactionApi.d.ts +10 -1
- package/dist/types/lib/interactions/interactionApiOrthographic.d.ts +7 -0
- package/dist/types/lib/interactions/mouseInteractionHandler.d.ts +2 -2
- package/dist/types/lib/interactions/mouseInteractions.d.ts +6 -0
- package/dist/types/lib/pins/controller.d.ts +70 -0
- package/dist/types/lib/pins/interactions.d.ts +30 -0
- package/dist/types/lib/pins/model.d.ts +104 -0
- package/dist/types/lib/rendering/canvas.d.ts +1 -2
- package/dist/types/lib/scenes/camera.d.ts +10 -0
- package/dist/types/lib/scenes/colorMaterial.d.ts +1 -0
- package/dist/types/lib/scenes/queries.d.ts +4 -2
- package/dist/types/lib/transforms/axis-lines.d.ts +6 -0
- package/dist/types/lib/transforms/axis-rotation.d.ts +6 -0
- package/dist/types/lib/transforms/axis-translation.d.ts +6 -0
- package/dist/types/lib/transforms/controller.d.ts +17 -0
- package/dist/types/lib/transforms/drawable.d.ts +26 -0
- package/dist/types/lib/transforms/hits.d.ts +10 -0
- package/dist/types/lib/transforms/line.d.ts +31 -0
- package/dist/types/lib/transforms/mesh.d.ts +23 -0
- package/dist/types/lib/transforms/shape.d.ts +3 -0
- package/dist/types/lib/transforms/util.d.ts +2 -0
- package/dist/types/lib/types/frameCamera.d.ts +1 -0
- package/dist/types/lib/types/viewport.d.ts +8 -0
- package/dist/types/regl-shape.d.ts +26 -0
- package/dist/viewer/index.esm.js +1 -1
- package/dist/viewer/p-058632f4.js +4 -0
- package/dist/viewer/p-07aeee89.js +10 -0
- package/dist/viewer/{p-e75bba97.js → p-083f427e.js} +1 -1
- package/dist/viewer/{p-a455ae02.entry.js → p-08eda2b2.entry.js} +1 -1
- package/dist/viewer/{p-bcb66f97.js → p-096e60bd.js} +1 -1
- package/dist/viewer/p-0bc4b3f7.js +4 -0
- package/dist/viewer/p-148c5f1a.js +4 -0
- package/dist/viewer/p-1db9bd1a.entry.js +4 -0
- package/dist/viewer/{p-70ca1ea7.entry.js → p-1f251549.entry.js} +1 -1
- package/dist/viewer/p-29986489.js +4 -0
- package/dist/viewer/{p-cafa57a6.js → p-2e581b2a.js} +1 -1
- package/dist/viewer/{p-d2bcf788.entry.js → p-33daeb09.entry.js} +1 -1
- package/dist/viewer/p-39803f8f.js +4 -0
- package/dist/viewer/p-465a92d9.entry.js +4 -0
- package/dist/viewer/p-4a65ddb3.entry.js +4 -0
- package/dist/viewer/{p-099fe6ca.entry.js → p-4aaf02b4.entry.js} +1 -1
- package/dist/viewer/{p-31658489.entry.js → p-4c3a3738.entry.js} +1 -1
- package/dist/viewer/{p-e38458da.js → p-4d37d97c.js} +1 -1
- package/dist/viewer/p-4fdf8553.entry.js +4 -0
- package/dist/viewer/p-5679f46b.entry.js +4 -0
- package/dist/viewer/p-5809b400.js +4 -0
- package/dist/viewer/{p-fa9a0bed.js → p-58dacdce.js} +1 -1
- package/dist/viewer/p-61a042f0.entry.js +4 -0
- package/dist/viewer/{p-b8774c9c.js → p-6c377932.js} +1 -1
- package/dist/viewer/p-6d379d4a.js +4 -0
- package/dist/viewer/p-6d70b198.entry.js +4 -0
- package/dist/viewer/p-6e7e094a.entry.js +4 -0
- package/dist/viewer/{p-661f0612.js → p-70e5e8a8.js} +1 -1
- package/dist/viewer/p-74102b29.entry.js +32 -0
- package/dist/viewer/p-7a5a9a93.entry.js +4 -0
- package/dist/viewer/p-7c755e0e.entry.js +4 -0
- package/dist/viewer/{p-3a20a038.js → p-92fe4417.js} +1 -1
- package/dist/viewer/{p-7e0328aa.js → p-98e6a50e.js} +1 -1
- package/dist/viewer/{p-388a43f7.js → p-990f98c2.js} +1 -1
- package/dist/viewer/{p-487e054a.js → p-99352cf0.js} +1 -1
- package/dist/viewer/{p-1ca95f9a.entry.js → p-99799a71.entry.js} +1 -1
- package/dist/viewer/p-9acd1b44.js +4 -0
- package/dist/viewer/{p-69058178.js → p-9bcde9c8.js} +1 -1
- package/dist/viewer/{p-5b342e97.js → p-a2ef15e5.js} +1 -1
- package/dist/viewer/{p-61b1097b.entry.js → p-a32cc378.entry.js} +1 -1
- package/dist/viewer/p-a380f0c2.js +4 -0
- package/dist/viewer/{p-41028d3b.entry.js → p-af37b63e.entry.js} +1 -1
- package/dist/viewer/p-b6b727a6.entry.js +4 -0
- package/dist/viewer/p-c2e3312b.js +4 -0
- package/dist/viewer/{p-4717c98e.entry.js → p-c9f91798.entry.js} +1 -1
- package/dist/viewer/p-ca518dcb.entry.js +4 -0
- package/dist/viewer/p-d828fd18.entry.js +4 -0
- package/dist/viewer/p-d996b1d2.entry.js +4 -0
- package/dist/viewer/{p-3f0f83ad.js → p-db01460a.js} +1 -1
- package/dist/viewer/p-db716103.entry.js +4 -0
- package/dist/viewer/p-df8fbe56.js +4 -0
- package/dist/viewer/p-dfe5a97d.js +4 -0
- package/dist/viewer/p-e42cb163.js +4 -0
- package/dist/viewer/p-eb8e5db5.js +4 -0
- package/dist/viewer/{p-46459921.entry.js → p-ebb801c3.entry.js} +1 -1
- package/dist/viewer/p-ebd85d58.entry.js +4 -0
- package/dist/viewer/p-eefae62a.entry.js +4 -0
- package/dist/viewer/viewer.esm.js +1 -1
- package/package.json +12 -10
- package/readme.md +4 -4
- package/dist/viewer/p-0a189e62.entry.js +0 -4
- package/dist/viewer/p-112455b1.js +0 -4
- package/dist/viewer/p-3561d910.js +0 -4
- package/dist/viewer/p-49d36e94.entry.js +0 -4
- package/dist/viewer/p-73a5eacc.entry.js +0 -4
- package/dist/viewer/p-77be081a.js +0 -4
- package/dist/viewer/p-809d09d9.js +0 -4
- package/dist/viewer/p-858bd2c7.entry.js +0 -4
- package/dist/viewer/p-89b66838.entry.js +0 -32
- package/dist/viewer/p-90bb0a1f.entry.js +0 -4
- package/dist/viewer/p-a93a63a9.js +0 -4
- package/dist/viewer/p-b043b076.entry.js +0 -4
- package/dist/viewer/p-b0ac6b3c.entry.js +0 -4
- package/dist/viewer/p-bcde5521.entry.js +0 -4
- package/dist/viewer/p-d1584404.js +0 -4
- package/dist/viewer/p-d32b54cb.js +0 -4
- package/dist/viewer/p-d3a20af4.entry.js +0 -4
- package/dist/viewer/p-d9f99f4d.entry.js +0 -4
- package/dist/viewer/p-ebd55df7.entry.js +0 -4
- package/dist/viewer/p-f0411993.entry.js +0 -4
- package/dist/viewer/p-f482325b.js +0 -10
- package/dist/viewer/p-fad9693e.js +0 -4
- package/dist/viewer/p-ffdeb08c.js +0 -4
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/**!
|
|
2
|
+
* Copyright (c) 2022 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import{c as t,u as e,a as s,b as i}from"./p-083f427e.js";import{v as r,b as n,a as o,m as a,q as h,r as u,p as c,d as l}from"./p-70e5e8a8.js";import{v as d,t as p,g as w,e as v,h as m,d as y,w as f,i as b}from"./p-e42cb163.js";import"./p-df8fbe56.js";const g={opacity:255,glossiness:4,diffuse:{r:0,g:0,b:0,a:0},ambient:{r:0,g:0,b:0,a:0},specular:{r:0,g:0,b:0,a:0},emissive:{r:0,g:0,b:0,a:0}},x=(e,s)=>{const i=t.fromHexString(e);return Object.assign(Object.assign({},g),{opacity:null!=s?s:g.opacity,diffuse:Object.assign({},null!=i?i:g.diffuse)})},O={opacity:g.opacity,glossiness:g.glossiness,diffuse:{r:255,g:255,b:0,a:0},ambient:{r:0,g:0,b:0,a:0},specular:{r:255,g:255,b:255,a:0},emissive:{r:0,g:0,b:0,a:0}},j=Object.freeze({__proto__:null,defaultColor:g,create:(t,e,s,i)=>Object.assign(Object.assign({},g),{opacity:null!=i?i:g.opacity,diffuse:{r:t,g:e,b:s,a:0}}),fromHex:x,defaultSelectionMaterial:O});class I extends Error{constructor(t,e){super(),this.message=t,this.stack=null==e?void 0:e.stack,this.name=this.constructor.name,Object.setPrototypeOf(this,I.prototype)}}class T extends I{constructor(t,e){super(t,e),Object.setPrototypeOf(this,T.prototype)}}class k extends I{constructor(t,e){super(t,e),Object.setPrototypeOf(this,k.prototype)}}class A extends I{constructor(t,e){super(t,e),Object.setPrototypeOf(this,A.prototype)}}class S extends I{constructor(t,e){super(t,e),Object.setPrototypeOf(this,S.prototype)}}class C extends I{constructor(t,e){super(t,e),Object.setPrototypeOf(this,C.prototype)}}class V extends I{constructor(t,e){super(t,e),Object.setPrototypeOf(this,V.prototype)}}class B extends I{constructor(t,e){super(t,e),Object.setPrototypeOf(this,B.prototype)}}class M extends I{constructor(t,e){super(t,e),Object.setPrototypeOf(this,M.prototype)}}class R extends I{constructor(t,e){super(t,e),Object.setPrototypeOf(this,R.prototype)}}class D extends I{constructor(t,e){super(t,e),Object.setPrototypeOf(this,D.prototype)}}function U(t){const s=e.parse(t);if("urn"!==s.scheme||null==s.path)throw new Error("Invalid URN. Expected URN scheme.");const[i,r,n]=s.path.split(":");if("vertexvis"!==i)throw new Error("Invalid URN. Expected URN to be vertexvis namespace");switch(r){case"stream-key":return{resource:{type:"stream-key",id:n},queries:(o=s.query,null!=o?o.split("&").map((t=>{const[e,s]=t.split("=");switch(e){case"scene-view-state":return{type:"scene-view-state",id:s};default:throw new Error("Invalid URN. Unknown query resource type")}})):[])};default:throw new T(`Invalid URN. Unknown resource type ${r}`)}var o}const E=Object.freeze({__proto__:null,fromUrn:U});class N{constructor(t,e=new Date){this.knownRemoteTime=t,this.knownLocalTime=e}localOffset(){return this.duration(this.knownLocalTime,this.localNow())}localTime(t){const e="number"==typeof t?new Date(this.knownLocalTime.getTime()+t):t,s=this.duration(this.knownRemoteTime,e);return this.addDuration(this.knownLocalTime,s)}remoteOffset(t=new Date){return this.duration(this.remoteTime(this.knownLocalTime),this.remoteTime(t))}remoteNow(){return this.remoteTime(this.localNow())}remoteTime(t){const e="number"==typeof t?new Date(this.knownLocalTime.getTime()+t):t,s=this.duration(this.knownLocalTime,e);return this.addDuration(this.knownRemoteTime,s)}addDuration(t,e){return new Date(t.getTime()+e)}duration(t,e){return e.getTime()-t.getTime()}localNow(){return new Date(Date.now())}}class _{constructor(t,e,s,i=1e4){this.stream=t,this.predicate=e,this.transform=s,this.timeout=i,this.listeners=[],this.handleMessage=this.handleMessage.bind(this)}on(t){this.listeners=[...this.listeners,t],null!=this.eventDisposable&&null!=this.requestDisposable||this.addListeners()}off(t){this.listeners=this.listeners.filter((e=>e!==t)),0===this.listeners.length&&this.removeListeners()}once(){let t;return s.timeout(this.timeout,new Promise((e=>{t=s=>{e(s),this.off(t)},this.on(t)}))).finally((()=>{this.off(t)}))}handleMessage(t){if(this.predicate(t)){const e=this.transform(t);null!=e&&this.listeners.forEach((t=>t(e)))}}addListeners(){this.eventDisposable=this.stream.onEvent(this.handleMessage),this.requestDisposable=this.stream.onRequest(this.handleMessage)}removeListeners(){var t,e;null===(t=this.eventDisposable)||void 0===t||t.dispose(),null===(e=this.requestDisposable)||void 0===e||e.dispose()}}class F{constructor(t,e,{animationId:s,correlationId:i},r){this.data=void 0,this.onAnimationCompleted=new _(t,(t=>{var e,i,r;return(null===(r=null===(i=null===(e=t.event)||void 0===e?void 0:e.animationCompleted)||void 0===i?void 0:i.animationId)||void 0===r?void 0:r.hex)===s}),(t=>{var e,s,i;return(null===(i=null===(s=null===(e=t.event)||void 0===e?void 0:e.animationCompleted)||void 0===s?void 0:s.animationId)||void 0===i?void 0:i.hex)||void 0}),r),this.onFrameReceived=new _(t,(t=>{var e,s,r;return!!(null===(r=null===(s=null===(e=t.request)||void 0===e?void 0:e.drawFrame)||void 0===s?void 0:s.frameCorrelationIds)||void 0===r?void 0:r.some((t=>t===i)))}),(t=>{var s;return null!=(null===(s=t.request)||void 0===s?void 0:s.drawFrame)?e(t.request.drawFrame):void 0}),r)}}function z(t){switch(t.type){case"item-id":return{id:new d.protobuf.core.Uuid({hex:t.value})};case"supplied-id":return{suppliedId:t.value};default:return{}}}class q{constructor(t){this.flyToOptions=t}build(){return this.flyToOptions}}class P{withItemId(t){return new q({flyTo:{type:"internal",data:t}})}withSuppliedId(t){return new q({flyTo:{type:"supplied",data:t}})}withCamera(t){return new q({flyTo:{type:"camera",data:t}})}withBoundingBox(t){return new q({flyTo:{type:"bounding-box",data:t}})}build(){return this.flyToOptions}}class H{constructor(t,e,s,i,r,n){this.stream=t,this.aspect=e,this.data=s,this.boundingBox=i,this.decodeFrame=r,this.flyToOptions=n}fitCameraToBoundingBox(t,e,s){const i=r.scale(e,r.normalize(s)),o=n.center(t),a=r.subtract(o,i);return this.update({lookAt:o,position:a,viewVector:i})}signedDistanceToBoundingBoxCenter(t){const{position:e,viewVector:s}=f(this.data),i=n.center(null!=t?t:this.boundingBox),o=r.subtract(i,e);return r.dot(s,o)/r.magnitude(s)}flyTo(t){return this.updateFlyToOptions("function"!=typeof t?{flyTo:this.buildFlyToType(t)}:t(new P).build())}viewAll(){return this.fitToBoundingBox(this.boundingBox)}async render(t){var e,s,r;null==this.flyToOptions&&null!=t&&(this.flyToOptions={flyTo:{type:"camera",data:this.data}});try{const n=i.create();if(null!=this.flyToOptions){const i=function(t,e,s){const i={frameCorrelationId:{value:t},animation:s?{duration:p(s.milliseconds)}:void 0};switch(e.flyTo.type){case"supplied":return Object.assign(Object.assign({},i),{itemSuppliedId:e.flyTo.data});case"internal":return Object.assign(Object.assign({},i),{itemId:new d.protobuf.core.Uuid({hex:e.flyTo.data})});case"camera":return Object.assign(Object.assign({},i),{camera:w(e.flyTo.data)});case"bounding-box":return Object.assign(Object.assign({},i),{boundingBox:{xmin:e.flyTo.data.min.x,xmax:e.flyTo.data.max.x,ymin:e.flyTo.data.min.y,ymax:e.flyTo.data.max.y,zmin:e.flyTo.data.min.z,zmax:e.flyTo.data.max.z}});default:return{}}}(n,this.flyToOptions,null==t?void 0:t.animation),o=await this.stream.flyTo(i,!0);return new F(this.stream,this.decodeFrame,{correlationId:n,animationId:(null===(s=null===(e=o.flyTo)||void 0===e?void 0:e.animationId)||void 0===s?void 0:s.hex)||void 0},null!=(null===(r=null==t?void 0:t.animation)||void 0===r?void 0:r.milliseconds)?t.animation.milliseconds+1e4:void 0)}return this.stream.replaceCamera({camera:w(this.data),frameCorrelationId:{value:n}}),new F(this.stream,this.decodeFrame,{correlationId:n})}catch(t){throw console.warn("Error when performing render: ",t),t}}rotateAroundAxis(t,e){return this.rotateAroundAxisAtPoint(t,this.data.lookAt,e)}alignTo(t,e){const s=r.normalize(r.cross(this.up,r.normalize(this.viewVector))),i=r.normalize(r.cross(r.normalize(this.viewVector),s)),n=r.angleTo(e,i)>Math.PI/2?r.negate(i):i,o=r.isEqual(n,e)?s:r.normalize(r.cross(n,e)),c=r.transformMatrix(this.viewVector,a.makeRotation(h.fromAxisAngle(o,r.angleTo(e,n)))),l=u.create({origin:t,direction:r.normalize(c)}),d=u.at(l,r.magnitude(this.viewVector));return this.update({position:t,lookAt:d,up:e})}standardView(t){return this.update({position:t.position,viewVector:r.subtract(r.origin(),t.position),lookAt:r.origin(),up:t.up})}buildFlyToType(t){if(null!=t.boundingBox)return{type:"bounding-box",data:t.boundingBox};if(null!=t.camera)return{type:"camera",data:t.camera};if(null!=t.itemId)return{type:"internal",data:t.itemId};if(null!=t.itemSuppliedId)return{type:"supplied",data:t.itemSuppliedId};throw new Error("Fly to must specify at least one option.")}computeClippingPlanes(t){return b(this.boundingBox,t)}}class L extends H{constructor(t,e,s,i,r,n){super(t,e,s,i,r,n),this.perspectiveData=s}moveBy(t){return this.update({position:r.add(this.position,t),lookAt:r.add(this.lookAt,t)})}rotateAroundAxisAtPoint(t,e,s){return this.update({position:r.rotateAboutAxis(t,this.position,s,e),lookAt:r.rotateAboutAxis(t,this.lookAt,s,e),up:r.rotateAboutAxis(t,this.up,s,r.origin())})}fitToBoundingBox(t){var e;const s=1.1*r.magnitude(r.subtract(t.max,n.center(t)));let i=Math.tan(.008726646259972*(null!==(e=this.fovY)&&void 0!==e?e:45));this.aspect<1&&(i*=this.aspect);const o=Math.abs(s/i);return super.fitCameraToBoundingBox(t,o,this.viewVector)}update(t){return new L(this.stream,this.aspect,Object.assign(Object.assign({},this.perspectiveData),t),this.boundingBox,this.decodeFrame,this.flyToOptions)}toFrameCamera(){var t;return new v(this.position,this.lookAt,this.up,this.near,this.far,this.aspectRatio,null!==(t=this.fovY)&&void 0!==t?t:45)}get viewVector(){return r.subtract(this.lookAt,this.position)}get position(){return Object.assign({},this.perspectiveData.position)}get up(){return Object.assign({},this.perspectiveData.up)}get lookAt(){return Object.assign({},this.perspectiveData.lookAt)}get fovY(){return this.perspectiveData.fovY}get aspectRatio(){return this.aspect}get near(){const{near:t}=this.computeClippingPlanes(this.perspectiveData);return t}get far(){const{far:t}=this.computeClippingPlanes(this.perspectiveData);return t}updateFlyToOptions(t){return new L(this.stream,this.aspect,this.perspectiveData,this.boundingBox,this.decodeFrame,t)}}class Q extends H{constructor(t,e,s,i,r,n){super(t,e,s,i,r,n),this.orthographicData=s}moveBy(t){return this.update({lookAt:r.add(this.lookAt,t)})}rotateAroundAxisAtPoint(t,e,s){const i=r.rotateAboutAxis(t,this.lookAt,s,e),n=r.rotateAboutAxis(t,this.position,s,e),a=m(r.subtract(i,n),o.create(this.boundingBox));return this.update({viewVector:a,lookAt:i,up:r.rotateAboutAxis(t,this.up,s,r.origin())})}fitToBoundingBox(t){const e=o.create(t),s=super.fitCameraToBoundingBox(t,e.radius,this.viewVector);return this.update({lookAt:s.lookAt,viewVector:s.viewVector,fovHeight:2*e.radius})}update(t){return new Q(this.stream,this.aspect,Object.assign(Object.assign({},this.orthographicData),t),this.boundingBox,this.decodeFrame,this.flyToOptions)}toFrameCamera(){return new y(m(this.viewVector,o.create(this.boundingBox)),this.lookAt,this.up,this.near,this.far,this.aspectRatio,this.fovHeight)}get viewVector(){return Object.assign({},this.orthographicData.viewVector)}get position(){return r.add(this.lookAt,r.negate(this.viewVector))}get up(){return Object.assign({},this.orthographicData.up)}get lookAt(){return Object.assign({},this.orthographicData.lookAt)}get fovHeight(){return this.orthographicData.fovHeight}get aspectRatio(){return this.aspect}get near(){const{near:t}=this.computeClippingPlanes(this.orthographicData);return t}get far(){const{far:t}=this.computeClippingPlanes(this.orthographicData);return t}updateFlyToOptions(t){return new Q(this.stream,this.aspect,this.orthographicData,this.boundingBox,this.decodeFrame,t)}}class Y{constructor(t,e){this.stream=t,this.imageScaleProvider=e}async hitItems(t,e){const s=this.imageScaleProvider();return(await this.stream.hitItems({point:c.scale(t,(null==s?void 0:s.x)||1,(null==s?void 0:s.y)||1),includeMetadata:null==e?void 0:e.includeMetadata},!0)).hitItems||void 0}}class W{constructor(t,e){this.stream=t,this.data=e}async update(t){return(await this.stream.updateCrossSectioning({crossSectioning:t},!0)).updateCrossSectioning||void 0}current(){return this.data}}class ${constructor(t=[]){this.operations=t}build(){return this.operations.concat()}materialOverride(t){return new $(this.operations.concat([{type:"change-material",material:t}]))}show(){return new $(this.operations.concat([{type:"show"}]))}hide(){return new $(this.operations.concat([{type:"hide"}]))}select(t){return new $(this.operations.concat([{type:"select",material:t}]))}deselect(){return new $(this.operations.concat([{type:"deselect"}]))}clearMaterialOverrides(){return new $(this.operations.concat([{type:"clear-override"}]))}transform(t){return new $(this.operations.concat([{type:"change-transform",transform:t}]))}}class G{all(){return new J}withItemIds(t){return new et(t,"item-id")}withSuppliedIds(t){return new et(t,"supplied-id")}withItemId(t){return new st({type:"item-id",value:t})}withSuppliedId(t){return new st({type:"supplied-id",value:t})}withSceneTreeRange(t){return new K(t)}withMetadata(t,e,s){return new X(t,e,s)}withSelected(){return new Z}withPoint(t){return new tt(t)}}class J{build(){return{type:"all"}}}class K{constructor(t){this.range=t}build(){return{type:"scene-tree-range",range:this.range}}}class X{constructor(t,e,s){this.filter=t,this.keys=e,this.exactMatch=s}build(){return{type:"metadata",filter:this.filter,keys:this.keys,exactMatch:this.exactMatch}}}class Z{build(){return{type:"all-selected"}}}class tt{constructor(t){this.point=t}build(){return{type:"point",point:this.point}}}class et{constructor(t,e){this.ids=t,this.type=e}build(){return{type:"or",expressions:this.ids.map((t=>({type:this.type,value:t})))}}}class st{constructor(t){this.query=t}build(){return Object.assign({},this.query)}and(){return new rt([this.query])}or(){return new it([this.query])}}class it{constructor(t){this.expressions=t}build(){return{type:"or",expressions:[...this.expressions]}}withItemId(t){return new it([...this.expressions,{type:"item-id",value:t}])}withSuppliedId(t){return new it([...this.expressions,{type:"supplied-id",value:t}])}or(){return this}}class rt{constructor(t){this.expressions=t}build(){return{type:"and",expressions:[...this.expressions]}}withItemId(t){return new rt([...this.expressions,{type:"item-id",value:t}])}withSuppliedId(t){return new rt([...this.expressions,{type:"supplied-id",value:t}])}and(){return this}}class nt{constructor(t){this.defaultSelectionMaterial=t}where(t){const e=t(new G).build();return new ot(e,this.defaultSelectionMaterial)}}class ot{constructor(t,e,s){this.query=t,this.defaultSelectionMaterial=e,this.builder=null!=s?s:new $}materialOverride(t){return new ot(this.query,this.defaultSelectionMaterial,this.builder.materialOverride("string"==typeof t?x(t):t))}hide(){return new ot(this.query,this.defaultSelectionMaterial,this.builder.hide())}show(){return new ot(this.query,this.defaultSelectionMaterial,this.builder.show())}select(t){return new ot(this.query,this.defaultSelectionMaterial,this.builder.select("string"==typeof t?x(t):t||this.defaultSelectionMaterial))}deselect(){return new ot(this.query,this.defaultSelectionMaterial,this.builder.deselect())}clearMaterialOverrides(){return new ot(this.query,this.defaultSelectionMaterial,this.builder.clearMaterialOverrides())}transform(t){if(Array.isArray(t)){if(16!==t.length)throw new R("Matrix provided must contain exactly 16 values (4x4).");return new ot(this.query,this.defaultSelectionMaterial,this.builder.transform({r0:{x:t[0],y:t[1],z:t[2],w:t[3]},r1:{x:t[4],y:t[5],z:t[6],w:t[7]},r2:{x:t[8],y:t[9],z:t[10],w:t[11]},r3:{x:t[12],y:t[13],z:t[14],w:t[15]}}))}return new ot(this.query,this.defaultSelectionMaterial,this.builder.transform(t))}build(){return{query:this.query,operations:this.builder.build()}}}class at{constructor(t,e,s,i){this.sceneViewId=t,this.stream=e,this.dimensions=s,this.queryOperations=i}async execute(t){const e=this.queryOperations.map((t=>function(t,e,s){const i=function(t){return t.map((t=>{switch(t.type){case"change-material":return{changeMaterial:{material:{d:t.material.opacity,ns:t.material.glossiness,ka:t.material.ambient,kd:t.material.diffuse,ks:t.material.specular,ke:t.material.emissive}}};case"clear-override":return{changeMaterial:{}};case"change-transform":return{changeTransform:{transform:Object.assign({},t.transform)}};case"hide":return{changeVisibility:{visible:!1}};case"show":return{changeVisibility:{visible:!0}};case"select":return{changeSelection:{material:{d:t.material.opacity,ns:t.material.glossiness,ka:t.material.ambient,kd:t.material.diffuse,ks:t.material.specular,ke:t.material.emissive}}};case"deselect":return{changeSelection:{}};default:return{}}}))}(e);switch(t.type){case"and":case"or":return{[t.type]:{queries:t.expressions.map((t=>({sceneItemQuery:z(t)})))},operationTypes:i};case"item-id":case"supplied-id":return{item:{sceneItemQuery:z(t)},operationTypes:i};case"all":return{all:{},operationTypes:i};case"scene-tree-range":return{sceneTreeRange:{start:t.range.start,end:t.range.end},operationTypes:i};case"metadata":return{metadata:{valueFilter:t.filter,keys:t.keys,exactMatch:t.exactMatch},operationTypes:i};case"all-selected":return{override:{selection:{}},operationTypes:i};case"point":return{point:{point:t.point,viewport:s.dimensions},operationTypes:i};default:return{}}}(t.query,t.operations,{dimensions:this.dimensions}))),s={sceneViewId:{hex:this.sceneViewId},operations:e,suppliedCorrelationId:null!=(null==t?void 0:t.suppliedCorrelationId)?{value:null==t?void 0:t.suppliedCorrelationId}:void 0};await this.stream.createSceneAlteration(s)}}class ht{constructor(t,e,s,i,r,n,o){this.stream=t,this.frame=e,this.decodeFrame=s,this.imageScaleProvider=i,this.dimensions=r,this.sceneViewId=n,this.defaultSelectionMaterial=o}async applySceneViewState(t,e={}){return await this.stream.loadSceneViewState({sceneViewStateId:{hex:t},frameCorrelationId:e.suppliedCorrelationId?{value:e.suppliedCorrelationId}:void 0},!0)}async reset(t={}){return await this.stream.resetSceneView({includeCamera:t.includeCamera,frameCorrelationId:t.suppliedCorrelationId?{value:t.suppliedCorrelationId}:void 0},!0)}items(t){const e=t(new nt(this.defaultSelectionMaterial)),s=(Array.isArray(e)?e:[e]).reduce(((t,e)=>t.concat(e.build())),[]);return new at(this.sceneViewId,this.stream,this.dimensions,s)}camera(){const{scene:t}=this.frame;if(t.camera.isOrthographic())return new Q(this.stream,l.aspectRatio(this.viewport()),{viewVector:t.camera.viewVector,lookAt:t.camera.lookAt,up:t.camera.up,fovHeight:t.camera.fovHeight},this.frame.scene.boundingBox,this.decodeFrame);if(t.camera.isPerspective())return new L(this.stream,l.aspectRatio(this.viewport()),{position:t.camera.position,lookAt:t.camera.lookAt,up:t.camera.up,fovY:t.camera.fovY},this.frame.scene.boundingBox,this.decodeFrame);throw new D("Cannot retrieve camera. Scene has an unknown or invalid camera type.")}boundingBox(){return this.frame.scene.boundingBox}crossSectioning(){return new W(this.stream,this.frame.scene.crossSection)}raycaster(){return new Y(this.stream,this.imageScaleProvider)}viewport(){return this.frame.dimensions}scale(){return this.imageScaleProvider()||c.create(1,1)}}export{I as C,B as I,ht as S,k as V,C as W,N as a,S as b,j as c,O as d,V as e,U as f,A as g,M as h,x as i,E as l}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/**!
|
|
2
|
+
* Copyright (c) 2022 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import{r as i,c as t,h as s,H as e,g as l}from"./p-2e581b2a.js";import{c as n}from"./p-07aeee89.js";import"./p-dfe5a97d.js";let o=class{constructor(s){i(this,s),this.hovered=t(this,"hovered",7),this.expandToggled=t(this,"expandToggled",7),this.visibilityToggled=t(this,"visibilityToggled",7),this.selectionToggled=t(this,"selectionToggled",7),this.placeholder="--",this.interactionsDisabled=!1,this.recurseParentSelectionDisabled=!1,this.displayValue=()=>null==this.value||""===this.value.trim()?this.placeholder:this.value,this.handleCellPointerUp=i=>{var t,s,e,l,n,o;i.defaultPrevented||0!==i.button||this.interactionsDisabled||this.isScrolling||((i.ctrlKey||i.metaKey)&&(null===(t=this.node)||void 0===t?void 0:t.selected)?null===(s=this.tree)||void 0===s||s.deselectItem(this.node):(null===(e=this.node)||void 0===e?void 0:e.selected)&&!this.recurseParentSelectionDisabled?null===(l=this.tree)||void 0===l||l.selectItem(this.node,{recurseParent:!0}):(null===(n=this.node)||void 0===n?void 0:n.selected)||null===(o=this.tree)||void 0===o||o.selectItem(this.node,{append:i.ctrlKey||i.metaKey,range:i.shiftKey}),this.selectionToggled.emit({node:this.node,originalEvent:i}))},this.toggleExpansion=i=>{null==this.tree||null==this.node||this.interactionsDisabled||this.tree.toggleExpandItem(this.node),this.expandToggled.emit({node:this.node,originalEvent:i})},this.toggleVisibility=i=>{null==this.tree||null==this.node||this.interactionsDisabled||this.tree.toggleItemVisibility(this.node),this.visibilityToggled.emit({node:this.node,originalEvent:i})}}componentWillRender(){var i,t,s,e,l,n,o;this.toggleAttribute("is-hovered",this.hoveredNodeId===(null===(t=null===(i=this.node)||void 0===i?void 0:i.id)||void 0===t?void 0:t.hex)),this.toggleAttribute("is-hidden",!(null===(s=this.node)||void 0===s?void 0:s.visible)),this.toggleAttribute("is-selected",!!(null===(e=this.node)||void 0===e?void 0:e.selected)),this.toggleAttribute("is-partial",!!(null===(l=this.node)||void 0===l?void 0:l.partiallyVisible)),this.toggleAttribute("is-leaf",!!(null===(n=this.node)||void 0===n?void 0:n.isLeaf)),this.toggleAttribute("is-filter-hit",!!(null===(o=this.node)||void 0===o?void 0:o.filterHit))}render(){var i,t,l,o,a,d,h,r,v,c,g,u,p,m;return s(e,{onPointerEnter:i=>{this.hovered.emit({node:this.node,originalEvent:i})},onPointerLeave:()=>{this.hovered.emit(void 0)},onPointerUp:this.handleCellPointerUp},s("div",{class:"wrapper"},s("div",{class:"no-shrink"},s("slot",{name:"left-gutter"})),this.expandToggle&&s("button",{class:"expand-btn no-shrink","data-test-id":"expand-"+(null===(i=this.node)||void 0===i?void 0:i.name),onPointerUp:i=>{i.preventDefault(),this.toggleExpansion(i)}},!(null===(t=this.node)||void 0===t?void 0:t.isLeaf)&&s("div",{class:n("icon",{"icon-expanded":!(null===(l=this.node)||void 0===l?void 0:l.isLeaf)&&(null===(o=this.node)||void 0===o?void 0:o.expanded),"icon-collapsed":!(null===(a=this.node)||void 0===a?void 0:a.isLeaf)&&!(null===(d=this.node)||void 0===d?void 0:d.expanded)})})),s("div",{class:"content"},null!=this.value&&""!==this.value.trim()?s("slot",null,this.displayValue()):s("slot",{name:"placeholder"},this.placeholder)),this.visibilityToggle&&s("button",{class:"visibility-btn no-shrink","data-test-id":"visibility-btn-"+(null===(h=this.node)||void 0===h?void 0:h.name),onPointerUp:i=>{null==i||i.preventDefault(),this.toggleVisibility(i)}},s("div",{class:n("icon",{"icon-visible":this.hoveredNodeId===(null===(v=null===(r=this.node)||void 0===r?void 0:r.id)||void 0===v?void 0:v.hex)&&!(null===(c=this.node)||void 0===c?void 0:c.partiallyVisible)&&(null===(g=this.node)||void 0===g?void 0:g.visible),"icon-hidden":!(null===(u=this.node)||void 0===u?void 0:u.partiallyVisible)&&!(null===(p=this.node)||void 0===p?void 0:p.visible),"icon-partial":null===(m=this.node)||void 0===m?void 0:m.partiallyVisible})})),s("div",{class:"no-shrink"},s("slot",{name:"right-gutter"})),!this.visibilityToggle&&s("div",{class:"column-spacer"})))}toggleAttribute(i,t){t?this.hostEl.setAttribute(i,""):this.hostEl.removeAttribute(i)}get hostEl(){return l(this)}};o.style="button{border:none;background:transparent;cursor:pointer;margin:0;padding:0}:host{display:flex;align-items:center;box-sizing:border-box;--scene-tree-cell-background-hover:var(--blue-200);--scene-tree-cell-background-selected:var(--blue-300);--scene-tree-cell-text-positioning:left;--scene-tree-cell-padding:0.25rem 0}:host([is-hovered]){background:var(--scene-tree-cell-background-hover)}:host([is-selected]){background:var(--scene-tree-cell-background-selected)}.wrapper{display:flex;align-items:center;box-sizing:border-box;width:100%;height:100%;padding:var(--scene-tree-cell-padding)}.content{width:100%;text-align:var(--scene-tree-cell-text-positioning);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.column-spacer{width:var(--scene-tree-table-column-gap)}.expand-btn{cursor:pointer;display:flex;align-items:center;justify-content:center;min-width:24px;min-height:24px}.no-shrink{flex-shrink:0}:host([is-leaf]) .expand-btn{visibility:hidden;cursor:default}.visibility-btn{cursor:pointer;display:flex;align-items:center;justify-content:center;width:24px;height:24px}.icon{width:14px;height:14px}.icon-expanded{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' class='icon' %3E%3Cpath fill='%23444444' d='M11.88,9.17l-3.5-4a.51.51,0,0,0-.76,0l-3.5,4A.5.5,0,0,0,4.5,10h7a.5.5,0,0,0,.38-.83Z' transform='rotate(180 8 8)' /%3E%3C/svg%3E\")}.icon-collapsed{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' class='icon' %3E%3Cpath fill='%23444444' d='M10.83,7.62l-4-3.5A.5.5,0,0,0,6,4.5v7a.5.5,0,0,0,.83.38l4-3.5a.51.51,0,0,0,0-.76Z' /%3E%3C/svg%3E\")}.icon-visible{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' class='icon' %3E%3Cpath fill='%23444444' d='M8 5a3 3 0 103 3 3 3 0 00-3-3zm4.65-1.17A8.53 8.53 0 008 2.5a8.53 8.53 0 00-4.65 1.33A6.57 6.57 0 00.51 7.89v.22a6.57 6.57 0 002.84 4.06A8.53 8.53 0 008 13.5a8.53 8.53 0 004.65-1.33 6.57 6.57 0 002.84-4.06v-.22a6.57 6.57 0 00-2.84-4.06zm-.55 7.5A7.52 7.52 0 018 12.5a7.52 7.52 0 01-4.1-1.17A5.49 5.49 0 011.53 8 5.49 5.49 0 013.9 4.67 7.52 7.52 0 018 3.5a7.52 7.52 0 014.1 1.17A5.49 5.49 0 0114.47 8a5.49 5.49 0 01-2.37 3.33z' /%3E%3C/svg%3E\")}.icon-hidden{background-image:url(\"data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' class='icon' %3E%3Cpath fill='%23444444' d='M13.35 2.65a.48.48 0 00-.7 0l-.78.77a8.71 8.71 0 00-8.52.41A6.57 6.57 0 00.51 7.89v.22a6.58 6.58 0 002.71 4l-.57.58a.49.49 0 00.7.7l10-10a.48.48 0 000-.74zM9.73 5.56a3 3 0 00-4.17 4.17l-1.62 1.62A5.49 5.49 0 011.53 8 5.49 5.49 0 013.9 4.67 7.52 7.52 0 018 3.5a7.67 7.67 0 013.12.67zm3.61-1.2l-.72.72A5.45 5.45 0 0114.47 8a5.49 5.49 0 01-2.37 3.33A7.52 7.52 0 018 12.5a8.15 8.15 0 01-2.41-.38l-.78.78a8.9 8.9 0 003.19.6 8.53 8.53 0 004.65-1.33 6.57 6.57 0 002.84-4.06v-.22a6.56 6.56 0 00-2.15-3.53z' /%3E%3C/svg%3E%0A\")}.icon-partial{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M4.12 11.46A5.62 5.62 0 011.52 8 5.57 5.57 0 013.9 4.67 7.52 7.52 0 018 3.5a7.7 7.7 0 013.33.75l.74-.74A8.67 8.67 0 008 2.5a8.53 8.53 0 00-4.65 1.33A6.57 6.57 0 00.51 7.89v.22a6.54 6.54 0 002.88 4.08z' fill='%23444'/%3E%3Cpath d='M8 5a3 3 0 00-3 3 3 3 0 00.69 1.89l4.2-4.2A3 3 0 008 5zM5.88 5.88zM9.2 12.41a.51.51 0 00-.42.57.5.5 0 00.56.42.5.5 0 00.43-.57.51.51 0 00-.57-.42zM6.77 12.41a.5.5 0 00-.57.42.49.49 0 00.41.57.5.5 0 10.15-1zM14.48 5.61a.5.5 0 00-.7-.12.49.49 0 00-.12.69.5.5 0 00.82-.57zM11.5 11.68a.5.5 0 00-.22.67.51.51 0 00.68.22.5.5 0 00-.46-.89zM15.07 7.77a.52.52 0 00-.62.35.51.51 0 00.35.62.5.5 0 00.61-.35.52.52 0 00-.34-.62zM13.36 10.21a.5.5 0 10.76.64.49.49 0 00-.06-.7.51.51 0 00-.7.06z' fill='%23444'/%3E%3C/svg%3E\")}";export{o as vertex_scene_tree_table_cell}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/**!
|
|
2
|
+
* Copyright (c) 2022 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import{h as i,F as t,r as e}from"./p-2e581b2a.js";import{p as n,m as o,v as s}from"./p-70e5e8a8.js";import"./p-058632f4.js";import"./p-6c377932.js";import"./p-92fe4417.js";import"./p-e42cb163.js";import"./p-df8fbe56.js";import{V as r}from"./p-29986489.js";import{i as l,b as a,P as p,a as h}from"./p-148c5f1a.js";import{a as d}from"./p-9acd1b44.js";import{c as v}from"./p-07aeee89.js";import"./p-083f427e.js";import"./p-dfe5a97d.js";import"./p-39803f8f.js";const c=({pin:e,selected:n})=>i(t,null,a(e)&&i("div",{id:"pin-anchor",class:v("pin-anchor",{selected:n})}),l(e)&&i("vertex-viewer-icon",{name:"pin-fill",size:"lg",class:v("pin",{"pin-selected":n})}));function u(i,t,e){const o=[{x:i.x+e.width/2,y:i.y},{x:i.x+e.width/2,y:i.y+e.height},{x:i.x,y:i.y+e.height/2},{x:i.x+e.width,y:i.y+e.height/2}],s=o.map((i=>n.distance(i,t)));return o[s.indexOf(Math.min(...s))]}let b=class{constructor(i){e(this,i),this.matrix=o.makeIdentity(),this.projectionViewMatrix=o.makeIdentity(),this.pinModel=new p,this.selected=!1,this.invalidateStateCounter=0,this.leafNodesRendered=!1,this.handleAnchorPointerDown=()=>{var i,t;null!=this.elementBounds&&"edit"===(null===(i=this.pinController)||void 0===i?void 0:i.getToolMode())&&null!=this.pin&&(null===(t=this.pinController)||void 0===t||t.setDraggable({id:this.pin.id}))}}componentDidLoad(){this.setLabelObserver(),null==this.pinController&&(this.pinController=new h(this.pinModel)),this.leafNodesRendered=!0}disconnectedCallback(){var i,t;null===(i=this.labelEl)||void 0===i||i.removeEventListener("labelChanged",this.invalidateState),null===(t=this.resizeObserver)||void 0===t||t.disconnect()}render(){var e;if(null==this.pin)throw new Error("Unable to draw pin");const n=this.computePinPoints(this.pin),{pinPoint:o,labelPoint:s}=n;return i(t,null,i("vertex-viewer-dom-element",{"data-testid":`drawn-pin-${this.pin.id}`,position:this.pin.worldPosition,onPointerDown:i=>{var t,e;2!==i.buttons&&i.stopPropagation(),null===(t=this.pinController)||void 0===t||t.setSelectedPinId(null===(e=this.pin)||void 0===e?void 0:e.id),this.handleAnchorPointerDown(i)}},this.leafNodesRendered&&i(c,{pin:this.pin,selected:this.selected})),a(this.pin)&&i(t,null,i("vertex-viewer-pin-label-line",{id:`pin-label-line-${null===(e=this.pin)||void 0===e?void 0:e.id}`,pinPoint:o,labelPoint:s}),i("vertex-viewer-pin-label",{pin:this.pin,ref:i=>{this.labelEl=i},elementBounds:this.elementBounds,pinController:this.pinController})))}invalidateState(){this.invalidateStateCounter=this.invalidateStateCounter+1}setLabelObserver(){var i;const t=null===(i=this.labelEl)||void 0===i?void 0:i.addEventListener("labelChanged",this.invalidateState);null!=t&&(this.resizeObserver=new ResizeObserver((()=>this.invalidateState())),this.resizeObserver.observe(t))}computePinPoints(i){return null!=this.elementBounds&&null!=this.pin?a(this.pin)&&null!=this.pin.label.point?this.computeTextPinPoints(this.pin,this.elementBounds):this.computeDefaultPinPoints(this.pin,this.elementBounds):{pinPoint:i.worldPosition}}computeDefaultPinPoints(i,t){return{pinPoint:this.getFromWorldPosition(i.worldPosition,this.projectionViewMatrix,t)}}computeTextPinPoints(i,t){var e,n;const{pinPoint:o}=this.computeDefaultPinPoints(i,t),s=d(i.label.point,t),r=null===(e=this.labelEl)||void 0===e?void 0:e.querySelector(`#pin-label-${null===(n=this.pin)||void 0===n?void 0:n.id}`);return{pinPoint:o,labelPoint:u(s,o,{width:(null==r?void 0:r.clientWidth)||0,height:(null==r?void 0:r.clientHeight)||0})}}getFromWorldPosition(i,t,e){const n=s.transformMatrix(i,t);return r.fromDimensions(e).transformVectorToViewport(n)}};b.style=":host{--viewer-annotations-pin-dot-color:var(--blue-600);--viewer-annotations-pin-color:var(--blue-700);--viewer-annotations-pin-font-size:0.75rem;--viewer-annotations-pin-selected-stroke:var(--white);--viewer-annotations-pin-selected-border:2px solid var(--white);--viewer-annotations-pin-label-border:2px solid var(--black);--viewer-annotations-pin-selected-stroke:var(--white);font-size:var(--viewer-annotations-pin-font-size);position:absolute;top:0;bottom:0;left:0;right:0;overflow:hidden;pointer-events:none}.pin-anchor{position:absolute;border-radius:50%;transform:translate(-50%, -50%);display:block;width:9px;height:9px;box-sizing:border-box;border:var(--viewer-annotations-pin-label-border);background:var(--viewer-annotations-pin-dot-color);pointer-events:auto;cursor:pointer}.selected{width:13px;height:13px;border:var(--viewer-annotations-pin-selected-border)}.pin{color:var(--viewer-annotations-pin-color);cursor:pointer}.pin-selected{stroke-width:1;stroke:var(--viewer-annotations-pin-selected-stroke)}";export{b as vertex_viewer_pin_group}
|
|
@@ -15,4 +15,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
15
15
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
16
16
|
PERFORMANCE OF THIS SOFTWARE.
|
|
17
17
|
***************************************************************************** */
|
|
18
|
-
var n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function u(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(u.prototype=r.prototype,new u)}var r=function(){return(r=Object.assign||function(n){for(var t,r=1,u=arguments.length;r<u;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}).apply(this,arguments)};function u(n,t){var r={};for(var u in n)Object.prototype.hasOwnProperty.call(n,u)&&t.indexOf(u)<0&&(r[u]=n[u]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(u=Object.getOwnPropertySymbols(n);o<u.length;o++)t.indexOf(u[o])<0&&Object.prototype.propertyIsEnumerable.call(n,u[o])&&(r[u[o]]=n[u[o]])}return r}function o(n,t,r,u){return new(r||(r=Promise))((function(o,e){function i(n){try{c(u.next(n))}catch(n){e(n)}}function a(n){try{c(u.throw(n))}catch(n){e(n)}}function c(n){var t;n.done?o(n.value):(t=n.value,t instanceof r?t:new r((function(n){n(t)}))).then(i,a)}c((u=u.apply(n,t||[])).next())}))}function e(n,t){var r,u,o,e,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return e={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function a(e){return function(a){return function(e){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,u&&(o=2&e[0]?u.return:e[0]?u.throw||((o=u.return)&&o.call(u),0):u.next)&&!(o=o.call(u,e[1])).done)return o;switch(u=0,o&&(e=[2&e[0],o.value]),e[0]){case 0:case 1:o=e;break;case 4:return i.label++,{value:e[1],done:!1};case 5:i.label++,u=e[1],e=[0];continue;case 7:e=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==e[0]&&2!==e[0])){i=0;continue}if(3===e[0]&&(!o||e[1]>o[0]&&e[1]<o[3])){i.label=e[1];break}if(6===e[0]&&i.label<o[1]){i.label=o[1],o=e;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(e);break}o[2]&&i.ops.pop(),i.trys.pop();continue}e=t.call(n,i)}catch(n){e=[6,n],u=0}finally{r=o=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,a])}}}function i(n,t){var r="function"==typeof Symbol&&n[Symbol.iterator];if(!r)return n;var u,o,e=r.call(n),i=[];try{for(;(void 0===t||t-- >0)&&!(u=e.next()).done;)i.push(u.value)}catch(n){o={error:n}}finally{try{u&&!u.done&&(r=e.return)&&r.call(e)}finally{if(o)throw o.error}}return i}function a(n,t,r){if(r||2===arguments.length)for(var u,o=0,e=t.length;o<e;o++)!u&&o in t||(u||(u=Array.prototype.slice.call(t,0,o)),u[o]=t[o]);return n.concat(u||Array.prototype.slice.call(t))}function c(n,t,r){return Math.max(t,Math.min(r,n))}function f(n,t,r){return(r=c(r,0,1))*(t-n)+n}function h(n,t){return void 0===n&&(n=0),void 0===t&&(t=0),{x:n,y:t}}function l(n,t){return{x:n.x-t.x,y:n.y-t.y}}function v(n,t){return{x:n.x+t.x,y:n.y+t.y}}function s(n,t){return n.x===t.x&&n.y===t.y}var d=Object.freeze({__proto__:null,create:h,polar:function(n,t){return h(Math.cos(t)*n,Math.sin(t)*n)},distance:function(n,t){var r=l(n,t);return Math.sqrt(r.x*r.x+r.y*r.y)},subtract:l,add:v,isEqual:s,lerp:function(n,t,r){return{x:f(n.x,t.x,r),y:f(n.y,t.y,r)}},negate:function(n){return h(-n.x,-n.y)},scale:function(n,t,r){return{x:n.x*t,y:n.y*r}},fromJson:function(n){var t=JSON.parse(n);return Array.isArray(t)?h(t[0],t[1]):h(t.x,t.y)}});function M(n){return(n+3600)%360}function y(n){return n*(180/Math.PI)}function m(n){return n*(Math.PI/180)}var x=Object.freeze({__proto__:null,fromPoints:function(n,t){var r=l(t,n);return Math.atan2(r.y,r.x)},fromPointsInDegrees:function(n,t){var r=l(t,n);return M(y(Math.atan2(r.y,r.x))-270)},normalize:M,toDegrees:y,toRadians:m});function _(n,t,r,u,o,e,i,a,c,f,h,l,v,s,d,M){return[n,o,c,v,t,e,f,s,r,i,h,d,u,a,l,M]}function p(n){return[1,0,0,0,0,1,0,0,0,0,1,0,n.x,n.y,n.z,1]}function z(n){var t=n.x,r=n.y,u=n.z,o=n.w,e=t+t,i=r+r,a=u+u,c=t*e,f=t*i,h=t*a,l=r*i,v=r*a,s=u*a,d=o*e,M=o*i,y=o*a;return[1-(l+s),f+y,h-M,0,f-y,1-(c+s),v+d,0,h+M,v-d,1-(c+l),0,0,0,0,1]}function b(n){return[n.x,0,0,0,0,n.y,0,0,0,0,n.z,0,0,0,0,1]}function w(n,t,r,u,o,e){return[2*o/(t-n),0,0,0,0,2*o/(r-u),0,0,(t+n)/(t-n),(r+u)/(r-u),-(e+o)/(e-o),-1,0,0,-2*e*o/(e-o),0]}function O(n,t){var r=n[0],u=n[4],o=n[8],e=n[12],i=n[1],a=n[5],c=n[9],f=n[13],h=n[2],l=n[6],v=n[10],s=n[14],d=n[3],M=n[7],y=n[11],m=n[15],x=t[0],_=t[4],p=t[8],z=t[12],b=t[1],w=t[5],O=t[9],j=t[13],g=t[2],k=t[6],A=t[10],S=t[14],P=t[3],T=t[7],q=t[11],J=t[15],R=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return R[0]=r*x+u*b+o*g+e*P,R[4]=r*_+u*w+o*k+e*T,R[8]=r*p+u*O+o*A+e*q,R[12]=r*z+u*j+o*S+e*J,R[1]=i*x+a*b+c*g+f*P,R[5]=i*_+a*w+c*k+f*T,R[9]=i*p+a*O+c*A+f*q,R[13]=i*z+a*j+c*S+f*J,R[2]=h*x+l*b+v*g+s*P,R[6]=h*_+l*w+v*k+s*T,R[10]=h*p+l*O+v*A+s*q,R[14]=h*z+l*j+v*S+s*J,R[3]=d*x+M*b+y*g+m*P,R[7]=d*_+M*w+y*k+m*T,R[11]=d*p+M*O+y*A+m*q,R[15]=d*z+M*j+y*S+m*J,R}function j(n){return{m11:n[0],m12:n[4],m13:n[8],m14:n[12],m21:n[1],m22:n[5],m23:n[9],m24:n[13],m31:n[2],m32:n[6],m33:n[10],m34:n[14],m41:n[3],m42:n[7],m43:n[11],m44:n[15]}}var g=Object.freeze({__proto__:null,fromValues:_,fromObject:function(n){return _(n.m11,n.m12,n.m13,n.m14,n.m21,n.m22,n.m23,n.m24,n.m31,n.m32,n.m33,n.m34,n.m41,n.m42,n.m43,n.m44)},makeIdentity:function(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},makeZero:function(){return[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},makeTranslation:p,makeRotation:z,makeScale:b,makeTRS:function(n,t,r){var u=p(n),o=z(t),e=b(r);return O(O(u,o),e)},makeBasis:function(n,t,r){return[n.x,n.y,n.z,0,t.x,t.y,t.z,0,r.x,r.y,r.z,0,0,0,0,1]},makeRotationAxis:function(n,t){var r=Math.cos(t),u=Math.sin(t),o=1-r,e=n.x,i=n.y,a=n.z,c=o*e,f=o*i;return[c*e+r,c*i+u*a,c*a-u*i,0,c*i-u*a,f*i+r,f*a+u*e,0,c*a+u*i,f*a-u*e,o*a*a+r,0,0,0,0,1]},makeFrustum:w,makePerspective:function(n,t,r,u){var o=n*Math.tan(m(r/2)),e=o*u;return w(-e,e,o,-o,n,t)},makeOrthographic:function(n,t,r,u,o,e){var i=1/(t-n),a=1/(u-r),c=1/(e-o);return[2*i,0,0,-(t+n)*i,0,2*a,0,-(u+r)*a,0,0,-2*c,-(e+o)*c,0,0,0,1]},makeLookAtView:function(n,t,r){var u=T(F(n,t)),o=T(R(r,u)),e=R(u,o),i=-D(o,n),a=-D(e,n),c=-D(u,n);return[o.x,e.x,u.x,0,o.y,e.y,u.y,0,o.z,e.z,u.z,0,i,a,c,1]},makeLookAt:function(n,t,r){var u=T(F(n,t)),o=T(R(r,u)),e=R(u,o);return[o.x,o.y,o.z,0,e.x,e.y,e.z,0,u.x,u.y,u.z,0,n.x,n.y,n.z,1]},invert:function(n){var t=n[0],r=n[1],u=n[2],o=n[3],e=n[4],i=n[5],a=n[6],c=n[7],f=n[8],h=n[9],l=n[10],v=n[11],s=n[12],d=n[13],M=n[14],y=n[15],m=t*i-r*e,x=t*a-u*e,_=t*c-o*e,p=r*a-u*i,z=r*c-o*i,b=u*c-o*a,w=f*d-h*s,O=f*M-l*s,j=f*y-v*s,g=h*M-l*d,k=h*y-v*d,A=l*y-v*M,S=m*A-x*k+_*g+p*j-z*O+b*w;return S?[(i*A-a*k+c*g)*(S=1/S),(u*k-r*A-o*g)*S,(d*b-M*z+y*p)*S,(l*z-h*b-v*p)*S,(a*j-e*A-c*O)*S,(t*A-u*j+o*O)*S,(M*_-s*b-y*x)*S,(f*b-l*_+v*x)*S,(e*k-i*j+c*w)*S,(r*j-t*k-o*w)*S,(s*z-d*_+y*m)*S,(h*_-f*z-v*m)*S,(i*O-e*g-a*w)*S,(t*g-r*O+u*w)*S,(d*x-s*p-M*m)*S,(f*p-h*x+l*m)*S]:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},lookAt:function(n,t,u,o){var e=F(t,u);0===J(e)&&(e=r(r({},e),{z:1}));var i=R(o,e=T(e));0===J(i)&&(i=R(o,e=T(e=1===Math.abs(o.z)?r(r({},e),{x:e.x+1e-4}):r(r({},e),{z:e.z+1e-4}))));var c=R(e,i=T(i)),f=a([],n,!0);return f[0]=i.x,f[4]=c.x,f[8]=e.x,f[1]=i.y,f[5]=c.y,f[9]=e.y,f[2]=i.z,f[6]=c.z,f[10]=e.z,f},multiply:O,transpose:function(n){return[n[0],n[4],n[8],n[12],n[1],n[5],n[9],n[13],n[2],n[6],n[10],n[14],n[3],n[7],n[11],n[15]]},scale:function(n,t){var r=t.x,u=t.y,o=t.z,e=a([],n,!0);return e[0]*=r,e[4]*=u,e[8]*=o,e[1]*=r,e[5]*=u,e[9]*=o,e[2]*=r,e[6]*=u,e[10]*=o,e[3]*=r,e[7]*=u,e[11]*=o,e},position:function(n,t){var r=a([],n,!0);return r[12]=t[12],r[13]=t[13],r[14]=t[14],r},toObject:j,isType:function(n){return Array.isArray(n)&&16===n.length}});function k(){for(var n,t,r,u,o,e,i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];return 1===i.length?{x:null!==(n=i[0].x)&&void 0!==n?n:0,y:null!==(t=i[0].y)&&void 0!==t?t:0,z:null!==(r=i[0].z)&&void 0!==r?r:0}:3===i.length?{x:null!==(u=i[0])&&void 0!==u?u:0,y:null!==(o=i[1])&&void 0!==o?o:0,z:null!==(e=i[2])&&void 0!==e?e:0}:{x:0,y:0,z:0}}function A(n){var t=j(n);return{x:Math.hypot(t.m11,t.m21,t.m31),y:Math.hypot(t.m12,t.m22,t.m32),z:Math.hypot(t.m13,t.m23,t.m33)}}function S(){return k(0,0,-1)}function P(){return k(0,0,0)}function T(n){var t=q(n);return{x:n.x/t,y:n.y/t,z:n.z/t}}function q(n){return Math.sqrt(J(n))}function J(n){return n.x*n.x+n.y*n.y+n.z*n.z}function R(n,t){return{x:n.y*t.z-n.z*t.y,y:n.z*t.x-n.x*t.z,z:n.x*t.y-n.y*t.x}}function N(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce((function(n,t){return{x:n.x+t.x,y:n.y+t.y,z:n.z+t.z}}),n)}function F(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce((function(n,t){return{x:n.x-t.x,y:n.y-t.y,z:n.z-t.z}}),n)}function E(n,t){return{x:t.x*n,y:t.y*n,z:t.z*n}}function D(n,t){return n.x*t.x+n.y*t.y+n.z*t.z}function L(n,t){var r=n.x,u=n.y,o=n.z,e=1/(t[3]*r+t[7]*u+t[11]*o+t[15]);return{x:(t[0]*r+t[4]*u+t[8]*o+t[12])*e,y:(t[1]*r+t[5]*u+t[9]*o+t[13])*e,z:(t[2]*r+t[6]*u+t[10]*o+t[14])*e}}function V(n,t){return Math.sqrt(C(n,t))}function C(n,t){var r=F(n,t),u=r.x,o=r.y,e=r.z;return u*u+o*o+e*e}function I(n,t){return k(Math.max(n.x,t.x),Math.max(n.y,t.y),Math.max(n.z,t.z))}function B(n,t){return k(Math.min(n.x,t.x),Math.min(n.y,t.y),Math.min(n.z,t.z))}function G(n,t,r){return{x:f(n.x,t.x,r),y:f(n.y,t.y,r),z:f(n.z,t.z,r)}}var W=Object.freeze({__proto__:null,create:k,isValid:function(n){return[n.x,n.y,n.z].every((function(n){return isFinite(n)&&!isNaN(n)}))},fromMatrixScale:A,fromMatrixPosition:function(n){var t=j(n);return{x:t.m14,y:t.m24,z:t.m34}},fromJson:function(n){var t=JSON.parse(n);return Array.isArray(t)?k(t[0],t[1],t[2]):k(t.x,t.y,t.z)},fromArray:function(n,t){return void 0===t&&(t=0),k(n[t],n[t+1],n[t+2])},toArray:function(n){return[n.x,n.y,n.z]},right:function(){return k(1,0,0)},up:function(){return k(0,1,0)},forward:S,left:function(){return k(-1,0,0)},down:function(){return k(0,-1,0)},back:function(){return k(0,0,1)},origin:P,normalize:T,magnitude:q,magnitudeSquared:J,cross:R,add:N,subtract:F,multiply:function(n,t){return{x:n.x*t.x,y:n.y*t.y,z:n.z*t.z}},scale:E,dot:D,angleTo:function(n,t){var r=D(n,t)/(q(n)*q(t));return Math.acos(r)},project:function(n,t){return E(D(t,n)/q(t),t)},rotateAboutAxis:function(n,t,r,u){if(0!==n){var o=t.x,e=t.y,i=t.z,a=u.x,c=u.y,f=u.z,h=r.x,l=r.y,v=r.z;return{x:(a*(l*l+v*v)-h*(c*l+f*v-h*o-l*e-v*i))*(1-Math.cos(n))+o*Math.cos(n)+(-f*l+c*v-v*e+l*i)*Math.sin(n),y:(c*(h*h+v*v)-l*(a*h+f*v-h*o-l*e-v*i))*(1-Math.cos(n))+e*Math.cos(n)+(f*h-a*v+v*o-h*i)*Math.sin(n),z:(f*(h*h+l*l)-v*(a*h+c*l-h*o-l*e-v*i))*(1-Math.cos(n))+i*Math.cos(n)+(-c*h+a*l-l*o+h*e)*Math.sin(n)}}return t},transformMatrix:L,distance:V,distanceSquared:C,isEqual:function(n,t){return n.x===t.x&&n.y===t.y&&n.z===t.z},max:I,min:B,negate:function(n){return{x:-n.x,y:-n.y,z:-n.z}},lerp:G,transformNdcToWorldSpace:function(n,t,r){return L(L(n,r),t)}}),Z=function(n,t){return{min:n,max:t}},H=function(n){return E(.5,N(n.min,n.max))};function K(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var u=a([n],t,!0);return u.reduce((function(n,t){return Z(B(n.min,t.min),I(n.max,t.max))}))}var Q=Object.freeze({__proto__:null,create:Z,fromVectors:function(n){return K.apply(void 0,n.map((function(n){return Z(n,n)})))},center:H,union:K}),U=Object.freeze({__proto__:null,create:function(n){var t=H(n),r=q(F(n.max,t)),u=Math.max(r,q(t));return{center:t,radius:r,epsilon:0===u?1:1e-6*u}}});function X(n,t,r,u){return{x:n,y:t,width:r,height:u}}function Y(n,t){return X(n.x,n.y,t.width,t.height)}function $(n,t){var r=Math.min(n.width/t.width,n.height/t.height),u=hn(r,t);return Y(l(un(n),vn(u)),u)}function nn(n,t){var r=Math.max(n.width/t.width,n.height/t.height),u=hn(r,t);return Y(l(un(n),vn(u)),u)}function tn(n,t){var r=Math.min(Math.sqrt(n/rn(t)),1),u=ln(hn(r,t));return Y(l(un(t),vn(u)),u)}function rn(n){return n.width*n.height}function un(n){return{x:n.x+n.width/2,y:n.y+n.height/2}}function on(n){return h(n.x,n.y)}var en=Object.freeze({__proto__:null,create:X,fromDimensions:function(n){return X(0,0,n.width,n.height)},fromPointAndDimensions:Y,fromPoints:function(n,t){var r=Math.min(n.x,t.x),u=Math.min(n.y,t.y);return X(r,u,Math.max(n.x,t.x)-r,Math.max(n.y,t.y)-u)},containFit:$,cropFit:nn,scaleFit:tn,scale:function n(t,r,u){return null==u?n(t,r,r):X(t.x*r,t.y*u,t.width*r,t.height*u)},isEqual:function(n,t){return s(n,t)&&cn(n,t)},offset:function(n,t){return Y(v(on(t),n),t)},area:rn,center:un,topLeft:on,bottomRight:function(n){return h(n.x+n.width,n.y+n.height)},isPortrait:function(n){return n.width<n.height},isLandscape:function(n){return n.width>n.height},isSquare:function(n){return n.width===n.height},pad:function(n,t){return X(n.x-t,n.y-t,n.width+2*t,n.height+2*t)},fromJson:function(n){var t=JSON.parse(n);return Array.isArray(t)?X(t[0],t[1],t[2],t[3]):X(t.x,t.y,t.width,t.height)}}),an=function(n,t){return{width:n,height:t}},cn=function(n,t){return n.width===t.width&&n.height===t.height},fn=function(n,t,r){return{width:r.width*n,height:r.height*t}},hn=function(n,t){return fn(n,n,t)},ln=function(n){return{width:Math.floor(n.width),height:Math.floor(n.height)}},vn=function(n){return{x:n.width/2,y:n.height/2}};function sn(n,t){return void 0===t&&(t=h()),Y(t,n)}var dn=Object.freeze({__proto__:null,create:an,square:function(n){return an(n,n)},isEqual:cn,scale:fn,proportionalScale:hn,trim:function(n,t){return{width:Math.min(n.width,t.width),height:Math.min(n.height,t.height)}},containFit:function(n,t){var r=$(sn(n),sn(t));return{width:r.width,height:r.height}},cropFit:function(n,t){var r=nn(sn(n),sn(t));return{width:r.width,height:r.height}},scaleFit:function(n,t){var r=tn(n,sn(t));return{width:r.width,height:r.height}},round:function(n){return{width:Math.round(n.width),height:Math.round(n.height)}},floor:ln,center:vn,aspectRatio:function(n){return n.width/n.height},area:function(n){return n.width*n.height},fitToRatio:function(n,t){return t.width>=t.height*n?an(t.height*n,t.height):an(t.width,t.width/n)},toRectangle:sn});function Mn(n){var t,r,u,o;return void 0===n&&(n={}),{x:null!==(t=n.x)&&void 0!==t?t:0,y:null!==(r=n.y)&&void 0!==r?r:0,z:null!==(u=n.z)&&void 0!==u?u:0,order:null!==(o=n.order)&&void 0!==o?o:"xyz"}}var yn=Object.freeze({__proto__:null,create:Mn,fromDegrees:function(n){void 0===n&&(n={});var t=n.x,r=n.y,u=void 0===r?0:r,o=n.z,e=void 0===o?0:o,i=n.order;return Mn({x:m(void 0===t?0:t),y:m(u),z:m(e),order:i})},fromRotationMatrix:function(n,t){void 0===t&&(t="xyz");var r=j(n),u=0,o=0,e=0;return"xyz"===t?(o=Math.asin(c(r.m13,-1,1)),Math.abs(r.m13)<.9999999?(u=Math.atan2(-r.m23,r.m33),e=Math.atan2(-r.m12,r.m11)):(u=Math.atan2(r.m32,r.m22),e=0)):"yxz"===t?(u=Math.asin(-c(r.m23,-1,1)),Math.abs(r.m23)<.9999999?(o=Math.atan2(r.m13,r.m33),e=Math.atan2(r.m21,r.m22)):(o=Math.atan2(-r.m31,r.m11),e=0)):"zxy"===t?(u=Math.asin(c(r.m32,-1,1)),Math.abs(r.m32)<.9999999?(o=Math.atan2(-r.m31,r.m33),e=Math.atan2(-r.m12,r.m22)):(o=0,e=Math.atan2(r.m21,r.m11))):"zyx"===t?(o=Math.asin(-c(r.m31,-1,1)),Math.abs(r.m31)<.9999999?(u=Math.atan2(r.m32,r.m33),e=Math.atan2(r.m21,r.m11)):(u=0,e=Math.atan2(-r.m12,r.m22))):"yzx"===t?(e=Math.asin(c(r.m21,-1,1)),Math.abs(r.m21)<.9999999?(u=Math.atan2(-r.m23,r.m22),o=Math.atan2(-r.m31,r.m11)):(u=0,o=Math.atan2(r.m13,r.m33))):"xzy"===t&&(e=Math.asin(-c(r.m12,-1,1)),Math.abs(r.m12)<.9999999?(u=Math.atan2(r.m32,r.m22),o=Math.atan2(r.m13,r.m11)):(u=Math.atan2(-r.m23,r.m33),o=0)),{x:u,y:o,z:e,order:t}},fromJson:function(n){var t=JSON.parse(n);if(Array.isArray(t)){var r=t[3];return{x:t[0],y:t[1],z:t[2],order:void 0===r?"xyz":r}}var u=t.order;return{x:t.x,y:t.y,z:t.z,order:void 0===u?"xyz":u}},isType:function(n){var t=n;return null!=t&&t.hasOwnProperty("x")&&t.hasOwnProperty("y")&&t.hasOwnProperty("z")&&t.hasOwnProperty("order")}});function mn(n){return F(n.end,n.start)}var xn=Object.freeze({__proto__:null,create:function(n){var t,r;return void 0===n&&(n={}),{start:null!==(t=n.start)&&void 0!==t?t:P(),end:null!==(r=n.end)&&void 0!==r?r:P()}},center:function(n){return G(n.start,n.end,.5)},transformMatrix:function(n,t){return{start:L(n.start,t),end:L(n.end,t)}},distance:function(n){return V(n.start,n.end)},distanceSquared:function(n){return C(n.start,n.end)},direction:mn}),_n=function(n,t,r,u,o,e){return void 0===n&&(n=1),void 0===t&&(t=0),void 0===r&&(r=0),void 0===u&&(u=1),void 0===o&&(o=0),void 0===e&&(e=0),{a:n,b:t,c:r,d:u,tx:o,ty:e}},pn=function(){return _n()},zn=function(n,t){var r=m(n),u=Math.cos(r),o=Math.sin(r);return _n(t.a*u+t.c*o,t.b*u+t.d*o,t.a*-o+t.c*u,t.b*-o+t.d*u,t.tx,t.ty)},bn=function(n,t,r){return _n(r.a,r.b,r.c,r.d,r.a*n+r.c*t+r.tx,r.b*n+r.d*t+r.ty)},wn=Object.freeze({__proto__:null,create:_n,identity:pn,translation:function(n,t){return bn(n,t,pn())},rotation:function(n){return zn(n,pn())},rotate:zn,translate:bn,transformPoint:function(n,t){return h(n.a*t.x+n.c*t.y+n.tx,n.b*t.x+n.d*t.y+n.ty)}}),On=Object.freeze({__proto__:null,create:function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return 2===n.length?{a:n[0].x,b:n[0].y,c:n[1].x,d:n[1].y}:4===n.length?{a:n[0],b:n[1],c:n[2],d:n[3]}:{a:0,b:0,c:0,d:0}},determinant:function(n){return n.a*n.d-n.b*n.c},dot:function(n){return n.a*n.c+n.b*n.d}});function jn(n){return void 0===n&&(n={}),r({normal:P(),constant:0},n)}function gn(n,t){return D(n.normal,t)+n.constant}var kn=Object.freeze({__proto__:null,create:jn,fromNormalAndCoplanarPoint:function(n,t){return jn({normal:n,constant:-D(t,n)})},distanceToPoint:gn,intersectLine:function(n,t){var r=mn(t),u=D(n.normal,r);if(0===u)return 0===gn(n,t.start)?t.start:void 0;var o=-(D(t.start,n.normal)+n.constant)/u;return o<0||o>1?void 0:N(E(o,r),t.start)},projectPoint:function(n,t){return N(t,E(-gn(n,t),n.normal))}});function An(n){return void 0===n&&(n={}),r({x:0,y:0,z:0,w:1},n)}var Sn=Object.freeze({__proto__:null,create:An,fromJson:function(n){var t=JSON.parse(n);return Array.isArray(t)?An({x:t[0],y:t[1],z:t[2],w:t[3]}):An(t)},fromAxisAngle:function(n,t){var r=t/2,u=Math.sin(r);return{x:n.x*u,y:n.y*u,z:n.z*u,w:Math.cos(r)}},fromMatrixRotation:function(n){var t,r=j(n),u=A(n),o=1/u.x,e=1/u.y,i=1/u.z,a=r.m11*o,c=r.m21*e,f=r.m31*i,h=r.m12*o,l=r.m22*e,v=r.m32*i,s=r.m13*o,d=r.m23*e,M=r.m33*i,y=a+l+M;return y>0?{x:(v-d)/(t=2*Math.sqrt(y+1)),y:(s-f)/t,z:(c-h)/t,w:.25*t}:a>l&&a>M?{x:.25*(t=2*Math.sqrt(1+a-l-M)),y:(c+h)/t,z:(s+f)/t,w:t}:l>M?{x:(c+h)/(t=2*Math.sqrt(1+l-a-M)),y:.25*t,z:(v+d)/t,w:(s-f)/t}:{x:(s+f)/(t=2*Math.sqrt(1+M-a-l)),y:(v+d)/t,z:.25*t,w:(c-h)/t}},fromEuler:function(n){var t=n.x,r=n.y,u=n.z,o=n.order,e=Math.cos(t/2),i=Math.cos(r/2),a=Math.cos(u/2),c=Math.sin(t/2),f=Math.sin(r/2),h=Math.sin(u/2),l=0,v=0,s=0,d=0;switch(o){case"xyz":l=c*i*a+e*f*h,v=e*f*a-c*i*h,s=e*i*h+c*f*a,d=e*i*a-c*f*h;break;case"yxz":l=c*i*a+e*f*h,v=e*f*a-c*i*h,s=e*i*h-c*f*a,d=e*i*a+c*f*h;break;case"zxy":l=c*i*a-e*f*h,v=e*f*a+c*i*h,s=e*i*h+c*f*a,d=e*i*a-c*f*h;break;case"zyx":l=c*i*a-e*f*h,v=e*f*a+c*i*h,s=e*i*h-c*f*a,d=e*i*a+c*f*h;break;case"yzx":l=c*i*a+e*f*h,v=e*f*a+c*i*h,s=e*i*h-c*f*a,d=e*i*a-c*f*h;break;case"xzy":l=c*i*a-e*f*h,v=e*f*a-c*i*h,s=e*i*h+c*f*a,d=e*i*a+c*f*h}return{x:l,y:v,z:s,w:d}},multiply:function(n,t){return{x:n.x*t.w+n.w*t.x+n.y*t.z-n.z*t.y,y:n.y*t.w+n.w*t.y+n.z*t.x-n.x*t.z,z:n.z*t.w+n.w*t.z+n.x*t.y-n.y*t.x,w:n.w*t.w-n.x*t.x-n.y*t.y-n.z*t.z}},isType:function(n){var t=n;return null!=t&&t.hasOwnProperty("x")&&t.hasOwnProperty("y")&&t.hasOwnProperty("z")&&t.hasOwnProperty("w")}});function Pn(n,t){return N(E(t,n.direction),n.origin)}function Tn(n,t){var r=D(t.normal,n.direction);if(0===r)return 0===gn(t,n.origin)?0:void 0;var u=-(D(n.origin,t.normal)+t.constant)/r;return u>=0?u:void 0}var qn=Object.freeze({__proto__:null,create:function(n){var t,r;return void 0===n&&(n={}),{origin:null!==(t=n.origin)&&void 0!==t?t:P(),direction:null!==(r=n.direction)&&void 0!==r?r:S()}},at:Pn,distanceToPlane:Tn,intersectPlane:function(n,t){var r=Tn(n,t);return null!=r?Pn(n,r):void 0}});export{t as _,U as a,Q as b,o as c,dn as d,e,r as f,a as g,x as h,en as i,kn as j,c as k,xn as l,g as m,i as n,u as o,d as p,On as q,qn as r,wn as s,Sn as t,yn as u,W as v}
|
|
18
|
+
var n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function u(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(u.prototype=r.prototype,new u)}var r=function(){return(r=Object.assign||function(n){for(var t,r=1,u=arguments.length;r<u;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}).apply(this,arguments)};function u(n,t){var r={};for(var u in n)Object.prototype.hasOwnProperty.call(n,u)&&t.indexOf(u)<0&&(r[u]=n[u]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(u=Object.getOwnPropertySymbols(n);o<u.length;o++)t.indexOf(u[o])<0&&Object.prototype.propertyIsEnumerable.call(n,u[o])&&(r[u[o]]=n[u[o]])}return r}function o(n,t,r,u){return new(r||(r=Promise))((function(o,e){function i(n){try{c(u.next(n))}catch(n){e(n)}}function a(n){try{c(u.throw(n))}catch(n){e(n)}}function c(n){var t;n.done?o(n.value):(t=n.value,t instanceof r?t:new r((function(n){n(t)}))).then(i,a)}c((u=u.apply(n,t||[])).next())}))}function e(n,t){var r,u,o,e,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return e={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function a(e){return function(a){return function(e){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,u&&(o=2&e[0]?u.return:e[0]?u.throw||((o=u.return)&&o.call(u),0):u.next)&&!(o=o.call(u,e[1])).done)return o;switch(u=0,o&&(e=[2&e[0],o.value]),e[0]){case 0:case 1:o=e;break;case 4:return i.label++,{value:e[1],done:!1};case 5:i.label++,u=e[1],e=[0];continue;case 7:e=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==e[0]&&2!==e[0])){i=0;continue}if(3===e[0]&&(!o||e[1]>o[0]&&e[1]<o[3])){i.label=e[1];break}if(6===e[0]&&i.label<o[1]){i.label=o[1],o=e;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(e);break}o[2]&&i.ops.pop(),i.trys.pop();continue}e=t.call(n,i)}catch(n){e=[6,n],u=0}finally{r=o=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,a])}}}function i(n,t){var r="function"==typeof Symbol&&n[Symbol.iterator];if(!r)return n;var u,o,e=r.call(n),i=[];try{for(;(void 0===t||t-- >0)&&!(u=e.next()).done;)i.push(u.value)}catch(n){o={error:n}}finally{try{u&&!u.done&&(r=e.return)&&r.call(e)}finally{if(o)throw o.error}}return i}function a(n,t,r){if(r||2===arguments.length)for(var u,o=0,e=t.length;o<e;o++)!u&&o in t||(u||(u=Array.prototype.slice.call(t,0,o)),u[o]=t[o]);return n.concat(u||Array.prototype.slice.call(t))}function c(n,t,r){return Math.max(t,Math.min(r,n))}function f(n,t,r){return(r=c(r,0,1))*(t-n)+n}function h(n,t){return void 0===n&&(n=0),void 0===t&&(t=0),{x:n,y:t}}function l(n,t){return{x:n.x-t.x,y:n.y-t.y}}function v(n,t){return{x:n.x+t.x,y:n.y+t.y}}function s(n,t){return n.x===t.x&&n.y===t.y}var d=Object.freeze({__proto__:null,create:h,polar:function(n,t){return h(Math.cos(t)*n,Math.sin(t)*n)},distance:function(n,t){var r=l(n,t);return Math.sqrt(r.x*r.x+r.y*r.y)},subtract:l,add:v,isEqual:s,lerp:function(n,t,r){return{x:f(n.x,t.x,r),y:f(n.y,t.y,r)}},negate:function(n){return h(-n.x,-n.y)},scale:function(n,t,r){return{x:n.x*t,y:n.y*r}},fromJson:function(n){var t=JSON.parse(n);return Array.isArray(t)?h(t[0],t[1]):h(t.x,t.y)}});function M(n){return(n+3600)%360}function y(n){return n*(180/Math.PI)}function m(n){return n*(Math.PI/180)}var x=Object.freeze({__proto__:null,fromPoints:function(n,t){var r=l(t,n);return Math.atan2(r.y,r.x)},fromPointsInDegrees:function(n,t){var r=l(t,n);return M(y(Math.atan2(r.y,r.x))-270)},normalize:M,toDegrees:y,toRadians:m});function _(n,t,r,u,o,e,i,a,c,f,h,l,v,s,d,M){return[n,o,c,v,t,e,f,s,r,i,h,d,u,a,l,M]}function p(n){return[1,0,0,0,0,1,0,0,0,0,1,0,n.x,n.y,n.z,1]}function z(n){var t=n.x,r=n.y,u=n.z,o=n.w,e=t+t,i=r+r,a=u+u,c=t*e,f=t*i,h=t*a,l=r*i,v=r*a,s=u*a,d=o*e,M=o*i,y=o*a;return[1-(l+s),f+y,h-M,0,f-y,1-(c+s),v+d,0,h+M,v-d,1-(c+l),0,0,0,0,1]}function b(n){return[n.x,0,0,0,0,n.y,0,0,0,0,n.z,0,0,0,0,1]}function w(n,t,r,u,o,e){return[2*o/(t-n),0,0,0,0,2*o/(r-u),0,0,(t+n)/(t-n),(r+u)/(r-u),-(e+o)/(e-o),-1,0,0,-2*e*o/(e-o),0]}function O(n,t){var r=n[0],u=n[4],o=n[8],e=n[12],i=n[1],a=n[5],c=n[9],f=n[13],h=n[2],l=n[6],v=n[10],s=n[14],d=n[3],M=n[7],y=n[11],m=n[15],x=t[0],_=t[4],p=t[8],z=t[12],b=t[1],w=t[5],O=t[9],j=t[13],g=t[2],k=t[6],A=t[10],S=t[14],P=t[3],T=t[7],q=t[11],J=t[15],R=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return R[0]=r*x+u*b+o*g+e*P,R[4]=r*_+u*w+o*k+e*T,R[8]=r*p+u*O+o*A+e*q,R[12]=r*z+u*j+o*S+e*J,R[1]=i*x+a*b+c*g+f*P,R[5]=i*_+a*w+c*k+f*T,R[9]=i*p+a*O+c*A+f*q,R[13]=i*z+a*j+c*S+f*J,R[2]=h*x+l*b+v*g+s*P,R[6]=h*_+l*w+v*k+s*T,R[10]=h*p+l*O+v*A+s*q,R[14]=h*z+l*j+v*S+s*J,R[3]=d*x+M*b+y*g+m*P,R[7]=d*_+M*w+y*k+m*T,R[11]=d*p+M*O+y*A+m*q,R[15]=d*z+M*j+y*S+m*J,R}function j(n){return{m11:n[0],m12:n[4],m13:n[8],m14:n[12],m21:n[1],m22:n[5],m23:n[9],m24:n[13],m31:n[2],m32:n[6],m33:n[10],m34:n[14],m41:n[3],m42:n[7],m43:n[11],m44:n[15]}}var g=Object.freeze({__proto__:null,fromValues:_,fromObject:function(n){return _(n.m11,n.m12,n.m13,n.m14,n.m21,n.m22,n.m23,n.m24,n.m31,n.m32,n.m33,n.m34,n.m41,n.m42,n.m43,n.m44)},makeIdentity:function(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},makeZero:function(){return[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},makeTranslation:p,makeRotation:z,makeScale:b,makeTRS:function(n,t,r){var u=p(n),o=z(t),e=b(r);return O(O(u,o),e)},makeBasis:function(n,t,r){return[n.x,n.y,n.z,0,t.x,t.y,t.z,0,r.x,r.y,r.z,0,0,0,0,1]},makeRotationAxis:function(n,t){var r=Math.cos(t),u=Math.sin(t),o=1-r,e=n.x,i=n.y,a=n.z,c=o*e,f=o*i;return[c*e+r,c*i+u*a,c*a-u*i,0,c*i-u*a,f*i+r,f*a+u*e,0,c*a+u*i,f*a-u*e,o*a*a+r,0,0,0,0,1]},makeFrustum:w,makePerspective:function(n,t,r,u){var o=n*Math.tan(m(r/2)),e=o*u;return w(-e,e,o,-o,n,t)},makeOrthographic:function(n,t,r,u,o,e){var i=1/(t-n),a=1/(u-r),c=1/(e-o);return[2*i,0,0,-(t+n)*i,0,2*a,0,-(u+r)*a,0,0,-2*c,-(e+o)*c,0,0,0,1]},makeLookAtView:function(n,t,r){var u=T(F(n,t)),o=T(R(r,u)),e=R(u,o),i=-D(o,n),a=-D(e,n),c=-D(u,n);return[o.x,e.x,u.x,0,o.y,e.y,u.y,0,o.z,e.z,u.z,0,i,a,c,1]},makeLookAt:function(n,t,r){var u=T(F(n,t)),o=T(R(r,u)),e=R(u,o);return[o.x,o.y,o.z,0,e.x,e.y,e.z,0,u.x,u.y,u.z,0,n.x,n.y,n.z,1]},invert:function(n){var t=n[0],r=n[1],u=n[2],o=n[3],e=n[4],i=n[5],a=n[6],c=n[7],f=n[8],h=n[9],l=n[10],v=n[11],s=n[12],d=n[13],M=n[14],y=n[15],m=t*i-r*e,x=t*a-u*e,_=t*c-o*e,p=r*a-u*i,z=r*c-o*i,b=u*c-o*a,w=f*d-h*s,O=f*M-l*s,j=f*y-v*s,g=h*M-l*d,k=h*y-v*d,A=l*y-v*M,S=m*A-x*k+_*g+p*j-z*O+b*w;return S?[(i*A-a*k+c*g)*(S=1/S),(u*k-r*A-o*g)*S,(d*b-M*z+y*p)*S,(l*z-h*b-v*p)*S,(a*j-e*A-c*O)*S,(t*A-u*j+o*O)*S,(M*_-s*b-y*x)*S,(f*b-l*_+v*x)*S,(e*k-i*j+c*w)*S,(r*j-t*k-o*w)*S,(s*z-d*_+y*m)*S,(h*_-f*z-v*m)*S,(i*O-e*g-a*w)*S,(t*g-r*O+u*w)*S,(d*x-s*p-M*m)*S,(f*p-h*x+l*m)*S]:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},lookAt:function(n,t,u,o){var e=F(t,u);0===J(e)&&(e=r(r({},e),{z:1}));var i=R(o,e=T(e));0===J(i)&&(i=R(o,e=T(e=1===Math.abs(o.z)?r(r({},e),{x:e.x+1e-4}):r(r({},e),{z:e.z+1e-4}))));var c=R(e,i=T(i)),f=a([],n,!0);return f[0]=i.x,f[4]=c.x,f[8]=e.x,f[1]=i.y,f[5]=c.y,f[9]=e.y,f[2]=i.z,f[6]=c.z,f[10]=e.z,f},multiply:O,transpose:function(n){return[n[0],n[4],n[8],n[12],n[1],n[5],n[9],n[13],n[2],n[6],n[10],n[14],n[3],n[7],n[11],n[15]]},scale:function(n,t){var r=t.x,u=t.y,o=t.z,e=a([],n,!0);return e[0]*=r,e[4]*=u,e[8]*=o,e[1]*=r,e[5]*=u,e[9]*=o,e[2]*=r,e[6]*=u,e[10]*=o,e[3]*=r,e[7]*=u,e[11]*=o,e},position:function(n,t){var r=a([],n,!0);return r[12]=t[12],r[13]=t[13],r[14]=t[14],r},toObject:j,isType:function(n){return Array.isArray(n)&&16===n.length}});function k(){for(var n,t,r,u,o,e,i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];return 1===i.length?{x:null!==(n=i[0].x)&&void 0!==n?n:0,y:null!==(t=i[0].y)&&void 0!==t?t:0,z:null!==(r=i[0].z)&&void 0!==r?r:0}:3===i.length?{x:null!==(u=i[0])&&void 0!==u?u:0,y:null!==(o=i[1])&&void 0!==o?o:0,z:null!==(e=i[2])&&void 0!==e?e:0}:{x:0,y:0,z:0}}function A(n){var t=j(n);return{x:Math.hypot(t.m11,t.m21,t.m31),y:Math.hypot(t.m12,t.m22,t.m32),z:Math.hypot(t.m13,t.m23,t.m33)}}function S(){return k(0,0,-1)}function P(){return k(0,0,0)}function T(n){var t=q(n);return{x:n.x/t,y:n.y/t,z:n.z/t}}function q(n){return Math.sqrt(J(n))}function J(n){return n.x*n.x+n.y*n.y+n.z*n.z}function R(n,t){return{x:n.y*t.z-n.z*t.y,y:n.z*t.x-n.x*t.z,z:n.x*t.y-n.y*t.x}}function N(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce((function(n,t){return{x:n.x+t.x,y:n.y+t.y,z:n.z+t.z}}),n)}function F(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce((function(n,t){return{x:n.x-t.x,y:n.y-t.y,z:n.z-t.z}}),n)}function E(n,t){return{x:t.x*n,y:t.y*n,z:t.z*n}}function D(n,t){return n.x*t.x+n.y*t.y+n.z*t.z}function L(n,t){var r=n.x,u=n.y,o=n.z,e=1/(t[3]*r+t[7]*u+t[11]*o+t[15]);return{x:(t[0]*r+t[4]*u+t[8]*o+t[12])*e,y:(t[1]*r+t[5]*u+t[9]*o+t[13])*e,z:(t[2]*r+t[6]*u+t[10]*o+t[14])*e}}function V(n,t){return Math.sqrt(C(n,t))}function C(n,t){var r=F(n,t),u=r.x,o=r.y,e=r.z;return u*u+o*o+e*e}function I(n,t){return k(Math.max(n.x,t.x),Math.max(n.y,t.y),Math.max(n.z,t.z))}function B(n,t){return k(Math.min(n.x,t.x),Math.min(n.y,t.y),Math.min(n.z,t.z))}function G(n,t,r){return{x:f(n.x,t.x,r),y:f(n.y,t.y,r),z:f(n.z,t.z,r)}}var W=Object.freeze({__proto__:null,create:k,isValid:function(n){return[n.x,n.y,n.z].every((function(n){return isFinite(n)&&!isNaN(n)}))},fromMatrixScale:A,fromMatrixPosition:function(n){var t=j(n);return{x:t.m14,y:t.m24,z:t.m34}},fromJson:function(n){var t=JSON.parse(n);return Array.isArray(t)?k(t[0],t[1],t[2]):k(t.x,t.y,t.z)},fromArray:function(n,t){return void 0===t&&(t=0),k(n[t],n[t+1],n[t+2])},toArray:function(n){return[n.x,n.y,n.z]},right:function(){return k(1,0,0)},up:function(){return k(0,1,0)},forward:S,left:function(){return k(-1,0,0)},down:function(){return k(0,-1,0)},back:function(){return k(0,0,1)},origin:P,normalize:T,magnitude:q,magnitudeSquared:J,cross:R,add:N,subtract:F,multiply:function(n,t){return{x:n.x*t.x,y:n.y*t.y,z:n.z*t.z}},scale:E,dot:D,angleTo:function(n,t){var r=D(n,t)/(q(n)*q(t));return Math.acos(r)},project:function(n,t){return E(D(t,n)/q(t),t)},rotateAboutAxis:function(n,t,r,u){if(0!==n){var o=t.x,e=t.y,i=t.z,a=u.x,c=u.y,f=u.z,h=r.x,l=r.y,v=r.z;return{x:(a*(l*l+v*v)-h*(c*l+f*v-h*o-l*e-v*i))*(1-Math.cos(n))+o*Math.cos(n)+(-f*l+c*v-v*e+l*i)*Math.sin(n),y:(c*(h*h+v*v)-l*(a*h+f*v-h*o-l*e-v*i))*(1-Math.cos(n))+e*Math.cos(n)+(f*h-a*v+v*o-h*i)*Math.sin(n),z:(f*(h*h+l*l)-v*(a*h+c*l-h*o-l*e-v*i))*(1-Math.cos(n))+i*Math.cos(n)+(-c*h+a*l-l*o+h*e)*Math.sin(n)}}return t},transformMatrix:L,distance:V,distanceSquared:C,isEqual:function(n,t){return n.x===t.x&&n.y===t.y&&n.z===t.z},max:I,min:B,negate:function(n){return{x:-n.x,y:-n.y,z:-n.z}},lerp:G,transformNdcToWorldSpace:function(n,t,r){return L(L(n,r),t)}}),Z=function(n,t){return{min:n,max:t}},H=function(n){return E(.5,N(n.min,n.max))},K=function(n){return F(n.max,n.min)};function Q(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var u=a([n],t,!0);return u.reduce((function(n,t){return Z(B(n.min,t.min),I(n.max,t.max))}))}var U=Object.freeze({__proto__:null,create:Z,fromVectors:function(n){return Q.apply(void 0,n.map((function(n){return Z(n,n)})))},center:H,diagonal:K,epsilon:function(n){return 1e-6*Math.max(Math.max(q(n.max),q(n.min)),q(K(n)))},union:Q}),X=Object.freeze({__proto__:null,create:function(n){var t=H(n),r=q(F(n.max,t)),u=Math.max(r,q(t));return{center:t,radius:r,epsilon:0===u?1:1e-6*u}}});function Y(n,t,r,u){return{x:n,y:t,width:r,height:u}}function $(n,t){return Y(n.x,n.y,t.width,t.height)}function nn(n,t){var r=Math.min(n.width/t.width,n.height/t.height),u=ln(r,t);return $(l(on(n),sn(u)),u)}function tn(n,t){var r=Math.max(n.width/t.width,n.height/t.height),u=ln(r,t);return $(l(on(n),sn(u)),u)}function rn(n,t){var r=Math.min(Math.sqrt(n/un(t)),1),u=vn(ln(r,t));return $(l(on(t),sn(u)),u)}function un(n){return n.width*n.height}function on(n){return{x:n.x+n.width/2,y:n.y+n.height/2}}function en(n){return h(n.x,n.y)}var an=Object.freeze({__proto__:null,create:Y,fromDimensions:function(n){return Y(0,0,n.width,n.height)},fromPointAndDimensions:$,fromPoints:function(n,t){var r=Math.min(n.x,t.x),u=Math.min(n.y,t.y);return Y(r,u,Math.max(n.x,t.x)-r,Math.max(n.y,t.y)-u)},containFit:nn,cropFit:tn,scaleFit:rn,scale:function n(t,r,u){return null==u?n(t,r,r):Y(t.x*r,t.y*u,t.width*r,t.height*u)},isEqual:function(n,t){return s(n,t)&&fn(n,t)},offset:function(n,t){return $(v(en(t),n),t)},area:un,center:on,topLeft:en,bottomRight:function(n){return h(n.x+n.width,n.y+n.height)},isPortrait:function(n){return n.width<n.height},isLandscape:function(n){return n.width>n.height},isSquare:function(n){return n.width===n.height},pad:function(n,t){return Y(n.x-t,n.y-t,n.width+2*t,n.height+2*t)},containsPoints:function(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.every((function(t){return n.x<=t.x&&n.x+n.width>=t.x&&n.y<=t.y&&n.y+n.height>=t.y}))},fromJson:function(n){var t=JSON.parse(n);return Array.isArray(t)?Y(t[0],t[1],t[2],t[3]):Y(t.x,t.y,t.width,t.height)}}),cn=function(n,t){return{width:n,height:t}},fn=function(n,t){return n.width===t.width&&n.height===t.height},hn=function(n,t,r){return{width:r.width*n,height:r.height*t}},ln=function(n,t){return hn(n,n,t)},vn=function(n){return{width:Math.floor(n.width),height:Math.floor(n.height)}},sn=function(n){return{x:n.width/2,y:n.height/2}};function dn(n,t){return void 0===t&&(t=h()),$(t,n)}var Mn=Object.freeze({__proto__:null,create:cn,square:function(n){return cn(n,n)},isEqual:fn,scale:hn,proportionalScale:ln,trim:function(n,t){return{width:Math.min(n.width,t.width),height:Math.min(n.height,t.height)}},containFit:function(n,t){var r=nn(dn(n),dn(t));return{width:r.width,height:r.height}},cropFit:function(n,t){var r=tn(dn(n),dn(t));return{width:r.width,height:r.height}},scaleFit:function(n,t){var r=rn(n,dn(t));return{width:r.width,height:r.height}},round:function(n){return{width:Math.round(n.width),height:Math.round(n.height)}},floor:vn,center:sn,aspectRatio:function(n){return n.width/n.height},area:function(n){return n.width*n.height},fitToRatio:function(n,t){return t.width>=t.height*n?cn(t.height*n,t.height):cn(t.width,t.width/n)},toRectangle:dn});function yn(n){var t,r,u,o;return void 0===n&&(n={}),{x:null!==(t=n.x)&&void 0!==t?t:0,y:null!==(r=n.y)&&void 0!==r?r:0,z:null!==(u=n.z)&&void 0!==u?u:0,order:null!==(o=n.order)&&void 0!==o?o:"xyz"}}var mn=Object.freeze({__proto__:null,create:yn,fromDegrees:function(n){void 0===n&&(n={});var t=n.x,r=n.y,u=void 0===r?0:r,o=n.z,e=void 0===o?0:o,i=n.order;return yn({x:m(void 0===t?0:t),y:m(u),z:m(e),order:i})},fromRotationMatrix:function(n,t){void 0===t&&(t="xyz");var r=j(n),u=0,o=0,e=0;return"xyz"===t?(o=Math.asin(c(r.m13,-1,1)),Math.abs(r.m13)<.9999999?(u=Math.atan2(-r.m23,r.m33),e=Math.atan2(-r.m12,r.m11)):(u=Math.atan2(r.m32,r.m22),e=0)):"yxz"===t?(u=Math.asin(-c(r.m23,-1,1)),Math.abs(r.m23)<.9999999?(o=Math.atan2(r.m13,r.m33),e=Math.atan2(r.m21,r.m22)):(o=Math.atan2(-r.m31,r.m11),e=0)):"zxy"===t?(u=Math.asin(c(r.m32,-1,1)),Math.abs(r.m32)<.9999999?(o=Math.atan2(-r.m31,r.m33),e=Math.atan2(-r.m12,r.m22)):(o=0,e=Math.atan2(r.m21,r.m11))):"zyx"===t?(o=Math.asin(-c(r.m31,-1,1)),Math.abs(r.m31)<.9999999?(u=Math.atan2(r.m32,r.m33),e=Math.atan2(r.m21,r.m11)):(u=0,e=Math.atan2(-r.m12,r.m22))):"yzx"===t?(e=Math.asin(c(r.m21,-1,1)),Math.abs(r.m21)<.9999999?(u=Math.atan2(-r.m23,r.m22),o=Math.atan2(-r.m31,r.m11)):(u=0,o=Math.atan2(r.m13,r.m33))):"xzy"===t&&(e=Math.asin(-c(r.m12,-1,1)),Math.abs(r.m12)<.9999999?(u=Math.atan2(r.m32,r.m22),o=Math.atan2(r.m13,r.m11)):(u=Math.atan2(-r.m23,r.m33),o=0)),{x:u,y:o,z:e,order:t}},fromJson:function(n){var t=JSON.parse(n);if(Array.isArray(t)){var r=t[3];return{x:t[0],y:t[1],z:t[2],order:void 0===r?"xyz":r}}var u=t.order;return{x:t.x,y:t.y,z:t.z,order:void 0===u?"xyz":u}},isType:function(n){var t=n;return null!=t&&t.hasOwnProperty("x")&&t.hasOwnProperty("y")&&t.hasOwnProperty("z")&&t.hasOwnProperty("order")}});function xn(n){return F(n.end,n.start)}var _n=Object.freeze({__proto__:null,create:function(n){var t,r;return void 0===n&&(n={}),{start:null!==(t=n.start)&&void 0!==t?t:P(),end:null!==(r=n.end)&&void 0!==r?r:P()}},center:function(n){return G(n.start,n.end,.5)},transformMatrix:function(n,t){return{start:L(n.start,t),end:L(n.end,t)}},distance:function(n){return V(n.start,n.end)},distanceSquared:function(n){return C(n.start,n.end)},direction:xn}),pn=function(n,t,r,u,o,e){return void 0===n&&(n=1),void 0===t&&(t=0),void 0===r&&(r=0),void 0===u&&(u=1),void 0===o&&(o=0),void 0===e&&(e=0),{a:n,b:t,c:r,d:u,tx:o,ty:e}},zn=function(){return pn()},bn=function(n,t){var r=m(n),u=Math.cos(r),o=Math.sin(r);return pn(t.a*u+t.c*o,t.b*u+t.d*o,t.a*-o+t.c*u,t.b*-o+t.d*u,t.tx,t.ty)},wn=function(n,t,r){return pn(r.a,r.b,r.c,r.d,r.a*n+r.c*t+r.tx,r.b*n+r.d*t+r.ty)},On=Object.freeze({__proto__:null,create:pn,identity:zn,translation:function(n,t){return wn(n,t,zn())},rotation:function(n){return bn(n,zn())},rotate:bn,translate:wn,transformPoint:function(n,t){return h(n.a*t.x+n.c*t.y+n.tx,n.b*t.x+n.d*t.y+n.ty)}}),jn=Object.freeze({__proto__:null,create:function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return 2===n.length?{a:n[0].x,b:n[0].y,c:n[1].x,d:n[1].y}:4===n.length?{a:n[0],b:n[1],c:n[2],d:n[3]}:{a:0,b:0,c:0,d:0}},determinant:function(n){return n.a*n.d-n.b*n.c},dot:function(n){return n.a*n.c+n.b*n.d}});function gn(n){return void 0===n&&(n={}),r({normal:P(),constant:0},n)}function kn(n,t){return D(n.normal,t)+n.constant}var An=Object.freeze({__proto__:null,create:gn,fromNormalAndCoplanarPoint:function(n,t){return gn({normal:n,constant:-D(t,n)})},distanceToPoint:kn,intersectLine:function(n,t){var r=xn(t),u=D(n.normal,r);if(0===u)return 0===kn(n,t.start)?t.start:void 0;var o=-(D(t.start,n.normal)+n.constant)/u;return o<0||o>1?void 0:N(E(o,r),t.start)},projectPoint:function(n,t){return N(t,E(-kn(n,t),n.normal))}});function Sn(n){return void 0===n&&(n={}),r({x:0,y:0,z:0,w:1},n)}var Pn=Object.freeze({__proto__:null,create:Sn,fromJson:function(n){var t=JSON.parse(n);return Array.isArray(t)?Sn({x:t[0],y:t[1],z:t[2],w:t[3]}):Sn(t)},fromAxisAngle:function(n,t){var r=t/2,u=Math.sin(r);return{x:n.x*u,y:n.y*u,z:n.z*u,w:Math.cos(r)}},fromMatrixRotation:function(n){var t,r=j(n),u=A(n),o=1/u.x,e=1/u.y,i=1/u.z,a=r.m11*o,c=r.m21*e,f=r.m31*i,h=r.m12*o,l=r.m22*e,v=r.m32*i,s=r.m13*o,d=r.m23*e,M=r.m33*i,y=a+l+M;return y>0?{x:(v-d)/(t=2*Math.sqrt(y+1)),y:(s-f)/t,z:(c-h)/t,w:.25*t}:a>l&&a>M?{x:.25*(t=2*Math.sqrt(1+a-l-M)),y:(c+h)/t,z:(s+f)/t,w:(v-d)/t}:l>M?{x:(c+h)/(t=2*Math.sqrt(1+l-a-M)),y:.25*t,z:(v+d)/t,w:(s-f)/t}:{x:(s+f)/(t=2*Math.sqrt(1+M-a-l)),y:(v+d)/t,z:.25*t,w:(c-h)/t}},fromEuler:function(n){var t=n.x,r=n.y,u=n.z,o=n.order,e=Math.cos(t/2),i=Math.cos(r/2),a=Math.cos(u/2),c=Math.sin(t/2),f=Math.sin(r/2),h=Math.sin(u/2),l=0,v=0,s=0,d=0;switch(o){case"xyz":l=c*i*a+e*f*h,v=e*f*a-c*i*h,s=e*i*h+c*f*a,d=e*i*a-c*f*h;break;case"yxz":l=c*i*a+e*f*h,v=e*f*a-c*i*h,s=e*i*h-c*f*a,d=e*i*a+c*f*h;break;case"zxy":l=c*i*a-e*f*h,v=e*f*a+c*i*h,s=e*i*h+c*f*a,d=e*i*a-c*f*h;break;case"zyx":l=c*i*a-e*f*h,v=e*f*a+c*i*h,s=e*i*h-c*f*a,d=e*i*a+c*f*h;break;case"yzx":l=c*i*a+e*f*h,v=e*f*a+c*i*h,s=e*i*h-c*f*a,d=e*i*a-c*f*h;break;case"xzy":l=c*i*a-e*f*h,v=e*f*a-c*i*h,s=e*i*h+c*f*a,d=e*i*a+c*f*h}return{x:l,y:v,z:s,w:d}},multiply:function(n,t){return{x:n.x*t.w+n.w*t.x+n.y*t.z-n.z*t.y,y:n.y*t.w+n.w*t.y+n.z*t.x-n.x*t.z,z:n.z*t.w+n.w*t.z+n.x*t.y-n.y*t.x,w:n.w*t.w-n.x*t.x-n.y*t.y-n.z*t.z}},isType:function(n){var t=n;return null!=t&&t.hasOwnProperty("x")&&t.hasOwnProperty("y")&&t.hasOwnProperty("z")&&t.hasOwnProperty("w")}});function Tn(n,t){return N(E(t,n.direction),n.origin)}function qn(n,t){var r=D(t.normal,n.direction);if(0===r)return 0===kn(t,n.origin)?0:void 0;var u=-(D(n.origin,t.normal)+t.constant)/r;return u>=0?u:void 0}var Jn=Object.freeze({__proto__:null,create:function(n){var t,r;return void 0===n&&(n={}),{origin:null!==(t=n.origin)&&void 0!==t?t:P(),direction:null!==(r=n.direction)&&void 0!==r?r:S()}},at:Tn,distanceToPlane:qn,intersectPlane:function(n,t){var r=qn(n,t);return null!=r?Tn(n,r):void 0}});export{t as _,X as a,U as b,o as c,Mn as d,e,r as f,a as g,x as h,an as i,An as j,c as k,_n as l,g as m,i as n,u as o,d as p,Pn as q,Jn as r,jn as s,On as t,mn as u,W as v}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**!
|
|
2
|
+
* Copyright (c) 2022 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import{h as e,F as t,r,H as s}from"./p-2e581b2a.js";import{D as i,A as n,f as a}from"./p-e42cb163.js";import"./p-df8fbe56.js";import{o as l,v as o}from"./p-70e5e8a8.js";import{c as h}from"./p-07aeee89.js";import"./p-083f427e.js";import"./p-dfe5a97d.js";
|
|
5
|
+
/*! *****************************************************************************
|
|
6
|
+
Copyright (c) Microsoft Corporation.
|
|
7
|
+
|
|
8
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
9
|
+
purpose with or without fee is hereby granted.
|
|
10
|
+
|
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
12
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
13
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
16
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
18
|
+
***************************************************************************** */var u=function(){return(u=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},d=function(){return(d=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};
|
|
19
|
+
/*! *****************************************************************************
|
|
20
|
+
Copyright (c) Microsoft Corporation.
|
|
21
|
+
|
|
22
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
23
|
+
purpose with or without fee is hereby granted.
|
|
24
|
+
|
|
25
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
26
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
27
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
28
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
29
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
30
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
31
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
32
|
+
***************************************************************************** */function v(e){return e.toLowerCase()}var m=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],c=/[^A-Z0-9]+/gi;function f(e,t,r){return t instanceof RegExp?e.replace(t,r):t.reduce((function(e,t){return e.replace(t,r)}),e)}function y(e,t){return void 0===t&&(t={}),function(e,t){void 0===t&&(t={});for(var r=t.splitRegexp,s=t.stripRegexp,i=void 0===s?c:s,n=t.transform,a=void 0===n?v:n,l=t.delimiter,o=void 0===l?" ":l,h=f(f(e,void 0===r?m:r,"$1\0$2"),i,"\0"),u=0,d=h.length;"\0"===h.charAt(u);)u++;for(;"\0"===h.charAt(d-1);)d--;return h.slice(u,d).split("\0").map(a).join(o)}(e,d({delimiter:"."},t))}const p=(t,r)=>{var s,i,{label:n}=t,a=l(t,["label"]);return e("div",Object.assign({},a,{class:"measurement-details-entry"}),e("div",{class:h("measurement-details-entry-label",(s=n,void 0===i&&(i={}),y(s,u({delimiter:"-"},i))))},n,":"),r)},b=({result:r,formatter:s,overlays:i,onShowOverlay:n,onHideOverlay:a})=>{const l=o.subtract(r.point1,r.point2);return e(t,null,e(p,{label:"Dist",onMouseEnter:()=>n(null==i?void 0:i.addLineFromResult(r)),onMouseLeave:a},s(r.distance)),e(p,{label:"X",onMouseEnter:()=>n(null==i?void 0:i.addDistanceVectorFromResult(r)),onMouseLeave:a},s(l.x)),e(p,{label:"Y",onMouseEnter:()=>n(null==i?void 0:i.addDistanceVectorFromResult(r)),onMouseLeave:a},s(l.y)),e(p,{label:"Z",onMouseEnter:()=>n(null==i?void 0:i.addDistanceVectorFromResult(r)),onMouseLeave:a},s(l.z)))},g=({result:t,formatter:r})=>e(p,{label:"Angle"},r(t.angle)),w=({result:t,formatter:r})=>e(p,{label:"Parallel Dist"},r(t.distance)),O=({result:t,formatter:r})=>e(p,{label:"Area"},r(t.area));let M=class{constructor(e){r(this,e),this.distanceUnits="millimeters",this.angleUnits="degrees",this.fractionalDigits=2,this.distanceMeasurementUnits=new i(this.distanceUnits),this.angleMeasurementUnits=new n(this.angleUnits),this.areaMeasurementUnits=new a(this.distanceUnits),this.handleShowOverlay=e=>{this.overlay=e},this.handleHideOverlay=()=>{var e;null===(e=this.overlay)||void 0===e||e.dispose()},this.handleOutcomeChange=()=>{this.updateStateFromModel()}}connectedCallback(){var e;this.onOutcomeChangedHandler=null===(e=this.measurementModel)||void 0===e?void 0:e.onOutcomeChanged(this.handleOutcomeChange),this.updateStateFromModel()}disconnectedCallback(){var e;null===(e=this.onOutcomeChangedHandler)||void 0===e||e.dispose()}handleDistanceUnitsChanged(){this.distanceMeasurementUnits=new i(this.distanceUnits),this.areaMeasurementUnits=new a(this.distanceUnits)}handleAngleUnitsChanged(){this.angleMeasurementUnits=new n(this.angleUnits)}handleMeasurementModelChanged(){var e,t;null===(e=this.onOutcomeChangedHandler)||void 0===e||e.dispose(),this.onOutcomeChangedHandler=null===(t=this.measurementModel)||void 0===t?void 0:t.onOutcomeChanged(this.handleOutcomeChange),this.updateStateFromModel()}handleResultTypesChanged(){this.updateStateFromModel()}render(){var t,r;const i=(null!==(r=null===(t=this.measurementOutcome)||void 0===t?void 0:t.results)&&void 0!==r?r:[]).filter((e=>{var t,r;return null===(r=null===(t=this.resultTypes)||void 0===t?void 0:t.includes(e.type))||void 0===r||r}));return e(s,null,this.renderResult("planar-angle",i,(t=>e(g,{result:t,overlays:this.measurementOverlays,formatter:this.makeAngleFormatter(),onShowOverlay:this.handleShowOverlay,onHideOverlay:this.handleHideOverlay}))),this.renderResult("planar-distance",i,(t=>e(w,{result:t,overlays:this.measurementOverlays,formatter:this.makeDistanceFormatter(),onShowOverlay:this.handleShowOverlay,onHideOverlay:this.handleHideOverlay}))),this.renderResult("surface-area",i,(t=>e(O,{result:t,overlays:this.measurementOverlays,formatter:this.makeAreaFormatter(),onShowOverlay:this.handleShowOverlay,onHideOverlay:this.handleHideOverlay}))),this.renderResult("minimum-distance",i,(t=>e(b,{result:t,overlays:this.measurementOverlays,formatter:this.makeDistanceFormatter(),onShowOverlay:this.handleShowOverlay,onHideOverlay:this.handleHideOverlay}))))}updateStateFromModel(){var e;this.measurementOutcome=null===(e=this.measurementModel)||void 0===e?void 0:e.getOutcome()}renderResult(e,t,r){const s=this.getResultForType(e,t);return null!=s?r(s):void 0}getResultForType(e,t){return t.find((t=>t.type===e))}makeDistanceFormatter(){return this.makeFormatter((e=>this.distanceMeasurementUnits.convertWorldValueToReal(e)),this.distanceMeasurementUnits.unit,this.distanceFormatter)}makeAngleFormatter(){return this.makeFormatter((e=>this.angleMeasurementUnits.convertTo(e)),this.angleMeasurementUnits.unit,this.angleFormatter)}makeAreaFormatter(){return this.makeFormatter((e=>this.areaMeasurementUnits.convertWorldValueToReal(e)),this.areaMeasurementUnits.unit,this.areaFormatter)}makeFormatter(e,t,r){return s=>{const i=e(s);return null!=r?r(i):this.formatValue(i,t)}}formatValue(e,t){var r,s;const i=e.toFixed(this.fractionalDigits);return`${null!==(s=null===(r=this.measurementOutcome)||void 0===r?void 0:r.isApproximate)&&void 0!==s&&s?"~"+i:i} ${t.abbreviatedName}`}static get watchers(){return{distanceUnits:["handleDistanceUnitsChanged"],angleUnits:["handleAngleUnitsChanged"],measurementModel:["handleMeasurementModelChanged"],resultTypes:["handleResultTypesChanged"]}}};M.style=":host{display:flex;flex-direction:column;--viewer-measurement-details-x-color:red;--viewer-measurement-details-y-color:var(--green-500);--viewer-measurement-details-z-color:blue}.measurement-details-entry{display:flex;align-items:center}.measurement-details-entry-label{user-select:none;padding-right:0.25rem}.measurement-details-entry-label.x{color:var(--viewer-measurement-details-x-color)}.measurement-details-entry-label.y{color:var(--viewer-measurement-details-y-color)}.measurement-details-entry-label.z{color:var(--viewer-measurement-details-z-color)}";export{M as vertex_viewer_measurement_details}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/**!
|
|
2
|
+
* Copyright (c) 2022 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import{r as e,h as i,F as t,H as s}from"./p-2e581b2a.js";import{p as r,h as a}from"./p-70e5e8a8.js";import"./p-6c377932.js";import"./p-92fe4417.js";import"./p-e42cb163.js";import{M as n}from"./p-db01460a.js";import{t as l}from"./p-58dacdce.js";import"./p-dfe5a97d.js";import"./p-083f427e.js";import"./p-df8fbe56.js";let o=class{constructor(i){e(this,i),this.start=r.create(),this.end=r.create(),this.capLength=0,this.pointerEvents="none"}render(){const e=a.fromPoints(this.start,this.end),t=m(this.start,this.end,e,this.capLength),s=m(this.start,this.end,e,this.capLength+1);return i("svg",null,i("g",{class:"line-stroke","pointer-events":this.pointerEvents},i("line",{class:"line",x1:this.start.x,y1:this.start.y,x2:this.end.x,y2:this.end.y}),i("line",{class:"start-cap",x1:s.startEndCap.start.x,y1:s.startEndCap.start.y,x2:s.startEndCap.end.x,y2:s.startEndCap.end.y}),i("line",{class:"end-cap",x1:s.endEndCap.start.x,y1:s.endEndCap.start.y,x2:s.endEndCap.end.x,y2:s.endEndCap.end.y})),i("g",{class:"line-fill","pointer-events":this.pointerEvents},i("line",{class:"line",x1:this.start.x,y1:this.start.y,x2:this.end.x,y2:this.end.y}),i("line",{class:"start-cap",x1:t.startEndCap.start.x,y1:t.startEndCap.start.y,x2:t.startEndCap.end.x,y2:t.startEndCap.end.y}),i("line",{class:"end-cap",x1:t.endEndCap.start.x,y1:t.endEndCap.start.y,x2:t.endEndCap.end.x,y2:t.endEndCap.end.y})))}};function m(e,i,t,s){return{startEndCap:v(e,t,s),endEndCap:v(i,t,s)}}function v(e,i,t){const s=i+Math.PI/2;return{start:r.add(e,r.polar(t/2,s)),end:r.add(e,r.polar(t/2,s+Math.PI))}}o.style=":host{display:block;--viewer-measurement-line-stroke:var(--white);--viewer-measurement-line-stroke-opacity:0.75;--viewer-measurement-line-stroke-width:1.25px;--viewer-measurement-line-fill:var(--neutral-900);--viewer-measurement-line-fill-width:2px;--viewer-measurement-line-start-cap-visibility:initial;--viewer-measurement-line-end-cap-visibility:initial}svg{width:100%;height:100%}.line-stroke{stroke-width:calc(\n var(--viewer-measurement-line-fill-width) +\n var(--viewer-measurement-line-stroke-width)\n );stroke:var(--viewer-measurement-line-stroke);opacity:var(--viewer-measurement-line-stroke-opacity)}.line-fill{stroke-width:var(--viewer-measurement-line-fill-width);stroke:var(--viewer-measurement-line-fill)}.start-cap{visibility:var(--viewer-measurement-line-start-cap-visibility)}.end-cap{visibility:var(--viewer-measurement-line-end-cap-visibility)}";const h=({overlay:e,viewport:t,camera:s})=>i("line"===e.type?c:d,{overlay:e,viewport:t,camera:s}),c=({overlay:e,camera:t,viewport:s})=>{const{start:r,end:a}=l(e,{camera:t,viewport:s});return i("vertex-viewer-measurement-line",{class:"measurement-line",start:r,end:a})},d=({overlay:{x:e,y:s,z:r},camera:a,viewport:n})=>{const o={camera:a,viewport:n},{start:m,end:v}=l(e,o),{start:h,end:c}=l(s,o),{start:d,end:u}=l(r,o);return i(t,null,i("vertex-viewer-measurement-line",{class:"measurement-line distance-vector-x",start:m,end:v}),i("vertex-viewer-measurement-line",{class:"measurement-line distance-vector-y",start:h,end:c}),i("vertex-viewer-measurement-line",{class:"measurement-line distance-vector-z",start:d,end:u}))};let u=class{constructor(i){e(this,i),this.measurementOverlays=new n,this.overlays=[],this.updateCamera=()=>{var e,i;this.camera=null===(i=null===(e=this.viewer)||void 0===e?void 0:e.frame)||void 0===i?void 0:i.scene.camera}}handleMeasurementOverlaysChanged(){this.removeModelListeners(),this.addModelListeners(),this.updateOverlays()}handleViewerChanged(e,i){this.removeViewerListeners(i),this.addViewerListeners(),this.updateCamera()}componentWillLoad(){this.addModelListeners(),this.addViewerListeners(),this.updateOverlays(),this.updateCamera()}addModelListeners(){this.onOverlaysChangedListener=this.measurementOverlays.onOverlaysChanged((()=>this.updateOverlays()))}removeModelListeners(){var e;null===(e=this.onOverlaysChangedListener)||void 0===e||e.dispose(),this.onOverlaysChangedListener=void 0}addViewerListeners(){var e;null===(e=this.viewer)||void 0===e||e.addEventListener("frameReceived",this.updateCamera)}removeViewerListeners(e){null==e||e.removeEventListener("frameReceived",this.updateCamera)}updateOverlays(){this.overlays=this.measurementOverlays.getOverlays()}render(){return i(s,null,this.overlays.map((e=>{if(null!=this.camera&&null!=this.viewer)return i(h,{overlay:e,viewport:this.viewer.viewport,camera:this.camera})})))}static get watchers(){return{measurementOverlays:["handleMeasurementOverlaysChanged"],viewer:["handleViewerChanged"]}}};u.style=":host{display:block;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;--viewer-measurement-overlays-x-axis-color:var(--x-axis-color);--viewer-measurement-overlays-y-axis-color:var(--y-axis-color);--viewer-measurement-overlays-z-axis-color:var(--z-axis-color)}.measurement-line{position:absolute;width:100%;height:100%}.measurement-line.distance-vector-x{--viewer-measurement-line-fill:var(\n --viewer-measurement-overlays-x-axis-color\n )}.measurement-line.distance-vector-y{--viewer-measurement-line-fill:var(\n --viewer-measurement-overlays-y-axis-color\n )}.measurement-line.distance-vector-z{--viewer-measurement-line-fill:var(\n --viewer-measurement-overlays-z-axis-color\n )}";export{o as vertex_viewer_measurement_line,u as vertex_viewer_measurement_overlays}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/**!
|
|
2
|
+
* Copyright (c) 2022 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import{r as t,c as i,h as s,H as e,g as n}from"./p-2e581b2a.js";import{p as h,v as o,h as r,j as a,r as l,b as c,s as u,d}from"./p-70e5e8a8.js";import{l as v,m as w,n as f,t as p,g as m,p as g,o as y,q as b,S as C,r as P,s as T,u as I,x as D,y as k,z as x,B as S,W as E,C as M,E as O}from"./p-e42cb163.js";import{E as j,m as A,c as R,o as F,u as B,a as z,b as L}from"./p-083f427e.js";import{c as N}from"./p-07aeee89.js";import{p as $}from"./p-c2e3312b.js";import{C as K}from"./p-058632f4.js";import{g as W,c as V}from"./p-99352cf0.js";import{I as q,f as H,C as U,W as G,a as J,b as _,d as X,V as Y,e as Q,g as Z,h as tt,i as it,S as st}from"./p-6d379d4a.js";import{E as et}from"./p-df8fbe56.js";import{V as nt}from"./p-29986489.js";import"./p-dfe5a97d.js";class ht{constructor(t){this.viewer=t,this.handleInteractionStarted=()=>{this.invalidateStencilBuffer(),this.pendingInteractionFinished=new Promise((t=>{this.pendingInteractionFinishedResolver=t}))},this.handleInteractionFinished=()=>{var t;null===(t=this.pendingInteractionFinishedResolver)||void 0===t||t.call(this),this.pendingInteractionFinished=void 0,this.pendingInteractionFinishedResolver=void 0},this.invalidateStencilBuffer=()=>{this.pendingStencilBuffer=void 0},t.addEventListener("interactionStarted",this.handleInteractionStarted),t.addEventListener("interactionFinished",this.handleInteractionFinished),t.addEventListener("frameReceived",(()=>{this.invalidateStencilBuffer()}))}async fetch(){var t;const i=await this.viewer.isSceneReady()?await this.viewer.scene():void 0,s=null!=i&&(i.crossSectioning().current().sectionPlanes.length>0||null!=this.viewer.featureLines),e=null===(t=this.viewer.frame)||void 0===t?void 0:t.scene.camera;if(s&&null!=this.viewer.stream&&null!=e){const t=await this.viewer.stream.getStencilBuffer({includeDepthBuffer:!0}),{stencilBuffer:i,depthBuffer:s,imageAttributes:n}=v(t),[h,o]=await Promise.all([w(new Uint8Array(i)),w(new Uint8Array(s))]);return ot.fromPng(h,n,i,f.fromPng(o,e,n))}}latest(){return null==this.pendingStencilBuffer&&(this.pendingStencilBuffer=this.fetch()),this.pendingStencilBuffer}async latestAfterInteraction(){return await this.pendingInteractionFinished,this.latest()}}class ot{constructor(t,i,s,e,n){this.imageAttr=t,this.imageBytes=i,this.pixelBytes=s,this.imageChannels=e,this.depthBuffer=n}static fromPng(t,i,s,e){if(t.data instanceof Uint8Array){if(1!==t.channels)throw new Error("Expected stencil PNG to have 1 color channel");return new ot(i,s,t.data,t.channels,e)}throw new Error("Expected stencil PNG to have depth of 8-bit")}getValue(t){const{width:i,height:s}=this.imageAttr.imageRect,e=h.subtract(t,this.imageAttr.imageRect),n=1/this.imageAttr.imageScale,o=h.scale(e,n,n);if(o.x>=0&&o.y>=0&&o.x<i&&o.y<s){const t=Math.floor(o.x)+Math.floor(o.y)*i;return this.pixelBytes[t]}return 0}hitTest(t){return 0!==this.getValue(t)}snapToNearestPixel(t,i,s=(()=>!0)){const e=2*i,n=h.create(t.x-i,t.y-i),o=[];for(let r=0;r<e*e;r++){const a=r%e,l=Math.floor(r/e),c=h.add(n,{x:a,y:l});if(h.distance(c,t)<=i){const t=this.getValue(c);255===t&&s(t)&&o.push(c)}}const r=o.sort(((i,s)=>h.distance(i,t)-h.distance(s,t)))[0];return null!=r?h.create(Math.floor(r.x)+.5,Math.floor(r.y)+.5):t}}class rt{constructor(t,i,s){this.stream=t,this.configProvider=i,this.imageScaleProvider=s}predicate(t){return t.altKey&&!t.shiftKey}async fn(t){var i;const s=this.imageScaleProvider(),e=await this.stream.hitItems({point:h.scale(t.position,(null==s?void 0:s.x)||1,(null==s?void 0:s.y)||1)},!0);null!=(null===(i=e.hitItems)||void 0===i?void 0:i.hits)&&e.hitItems.hits.length>0?await this.stream.flyTo({itemId:e.hitItems.hits[0].itemId,animation:{duration:p(this.configProvider().animation.durationMs)}}):console.debug(`No hit results found for fly to part [position={x: ${t.position.x}, y: ${t.position.y}}]`)}}class at{constructor(t,i,s,e,n,h,o,r,a,l,c){this.stream=t,this.cursors=i,this.getConfig=s,this.getScene=e,this.getFrame=n,this.getViewport=h,this.tapEmitter=o,this.doubleTapEmitter=r,this.longPressEmitter=a,this.interactionStartedEmitter=l,this.interactionFinishedEmitter=c,this.tap=this.tap.bind(this),this.doubleTap=this.doubleTap.bind(this),this.longPress=this.longPress.bind(this),this.emitTapEvent=this.emitTapEvent.bind(this)}addCursor(t,i){return this.cursors.add(t,i)}async getWorldPointFromViewport(t){const i=this.getViewport(),s=this.getFrame();if(null==s)throw new Error("Cannot get world point. Frame is undefined.");const e=await s.depthBuffer();return null!=e?i.transformPointToWorldSpace(t,e,.5):void 0}async getEntityTypeAtPoint(t){var i;const s=this.getViewport(),e=await(null===(i=this.getFrame())||void 0===i?void 0:i.featureMap());if(null!=e){const i=s.transformPointToFrame(t,e);return e.getEntityType(i)}return et.NO_GEOMETRY}getRayFromPoint(t){const i=this.getViewport(),s=this.getFrame();if(null!=s)return i.transformPointToRay(t,s.image,s.scene.camera);throw new Error("Cannot get camera. Frame is undefined.")}async tap(t,i={},s=0){this.emitTapEvent(this.tapEmitter.emit,t,i,s)}async doubleTap(t,i={},s=0){this.emitTapEvent(this.doubleTapEmitter.emit,t,i,s)}async longPress(t,i={},s=0){this.emitTapEvent(this.longPressEmitter.emit,t,i,s)}async beginInteraction(){this.isInteracting()||(this.interactionStartedEmitter.emit(),this.currentCamera=this.getScene().camera(),await this.stream.beginInteraction())}async transformCamera(t){var i;if(this.isInteracting()){const s=this.getScene(),e=this.getViewport(),n=this.getFrame(),h=await(null==n?void 0:n.depthBuffer());this.currentCamera=null!=this.currentCamera&&null!=e&&null!=n?t({camera:this.currentCamera,viewport:e,scale:s.scale(),boundingBox:s.boundingBox(),frame:n,depthBuffer:h}):void 0,await(null===(i=this.currentCamera)||void 0===i?void 0:i.render())}}async twistCamera(...t){return this.transformCamera((({camera:i,viewport:s})=>{const e=o.normalize(o.subtract(i.lookAt,i.position));if(1===t.length&&"number"==typeof t[0]){const s=r.toRadians(-t[0]);return i.rotateAroundAxis(s,e)}if(1===t.length){const e=h.create(s.width/2,s.height/2),n=r.toDegrees(r.fromPoints(e,t[0])),a=null!=this.lastAngle?n-this.lastAngle:0;this.lastAngle=n;const l=o.normalize(o.subtract(i.lookAt,i.position)),c=r.toRadians(-a);return i.rotateAroundAxis(c,l)}return i}))}async panCameraToScreenPoint(t){return this.transformCamera((({camera:i,frame:s,viewport:e,depthBuffer:n})=>{if(null==this.panData){const h=i.toFrameCamera(),o=h.direction,r=e.transformPointToRay(t,s.image,h),c=a.fromNormalAndCoplanarPoint(o,i.lookAt),u=l.intersectPlane(r,c);if(null==u)return console.warn("Cannot determine fallback for pan. Ray does not intersect plane."),i;const d=null!=n?this.getWorldPoint(t,n,u):u,v=a.fromNormalAndCoplanarPoint(o,d);this.panData={hitPt:d,hitPlane:v,startingCamera:h}}if(null!=this.panData){const{hitPt:n,hitPlane:h,startingCamera:r}=this.panData,a=e.transformPointToRay(t,s.image,r),c=l.intersectPlane(a,h);if(null!=c){const t=o.subtract(n,c);return i.update(r).moveBy(t)}}return i}))}async viewAll(){await this.getScene().camera().viewAll().render()}async rotateCamera(t){return this.transformCamera((({camera:i,viewport:s})=>{const e=o.normalize(i.up),n=o.normalize(o.subtract(i.lookAt,i.position)),h=o.cross(e,n),r=o.cross(n,h),a=o.normalize({x:t.x*h.x+t.y*r.x,y:t.x*h.y+t.y*r.y,z:t.x*h.z+t.y*r.z}),l=o.cross(a,n),c=3*Math.PI*t.x/s.width,u=3*Math.PI*t.y/s.height,d=Math.abs(c)+Math.abs(u);return i.rotateAroundAxis(d,l)}))}async rotateCameraAtPoint(t,i){return this.transformCamera((({camera:s,viewport:e,boundingBox:n,depthBuffer:h})=>{if(null==this.worldRotationPoint){const t=c.center(n);this.worldRotationPoint=null!=h?this.getWorldPoint(i,h,t):s.lookAt}const r=o.normalize(s.up),a=o.normalize(o.subtract(s.lookAt,s.position)),l=o.cross(r,a),u=o.cross(a,l),d=o.normalize({x:t.x*l.x+t.y*u.x,y:t.x*l.y+t.y*u.y,z:t.x*l.z+t.y*u.z}),v=o.cross(d,a),w=3*Math.PI*t.x/e.width,f=3*Math.PI*t.y/e.height,p=Math.abs(w)+Math.abs(f),m=s.rotateAroundAxisAtPoint(p,this.worldRotationPoint,v);return m.update({lookAt:o.add(o.scale(Math.abs(s.signedDistanceToBoundingBoxCenter())/o.magnitude(m.viewVector),m.viewVector),m.position)})}))}async zoomCamera(t){return this.transformCamera((({camera:i,viewport:s})=>{const e=i.viewVector,n=o.normalize(e),h=o.magnitude(e),r=o.add(i.position,o.scale(3*h*t/s.height,n));return i.update({position:r})}))}async zoomCameraToPoint(t,i){return this.transformCamera((({camera:s,viewport:e,frame:n,depthBuffer:h})=>{const r=n.scene.camera,c=r.direction,u=s.toFrameCamera(),d=e.transformPointToRay(t,n.image,u);if(null==this.zoomData){const i=a.fromNormalAndCoplanarPoint(c,r.lookAt),e=l.intersectPlane(d,i);if(null==e)return console.warn("Cannot determine fallback point for zoom. Ray does not intersect plane."),s;const n=null!=h?this.getWorldPoint(t,h,e):e,o=a.fromNormalAndCoplanarPoint(c,n);this.zoomData={hitPt:n,hitPlane:o}}if(null!=this.zoomData){const{hitPt:t,hitPlane:n}=this.zoomData,h=o.distance(s.position,t),r=l.at(d,6*h*i/e.height),c=a.projectPoint(n,r),u=s.update({position:r,lookAt:c});if(o.distance(r,c)>=u.near)return u}return s}))}async pivotCamera(t,i){return this.transformCamera((({camera:s})=>{const{position:e,up:n,lookAt:h}=s,a=o.normalize(n),l=o.normalize(s.viewVector),c=o.cross(a,l),u=o.cross(l,c),d=o.rotateAboutAxis(r.toRadians(t),h,c,e),v=o.rotateAboutAxis(r.toRadians(i),d,u,e);return s.update(Object.assign(Object.assign({},s),{lookAt:v}))}))}async endInteraction(){this.isInteracting()&&(this.currentCamera=void 0,this.worldRotationPoint=void 0,this.panData=void 0,this.zoomData=void 0,this.resetLastAngle(),this.interactionFinishedEmitter.emit(),await this.stream.endInteraction())}resetLastAngle(){this.lastAngle=void 0}isInteracting(){return null!=this.currentCamera}pixelThreshold(t){return(this.isCoarseInputDevice(t)?this.getConfig().coarsePointerThreshold:this.getConfig().finePointerThreshold)*window.devicePixelRatio}async hitItems(t){var i;const s=await this.getScene().raycaster().hitItems(t);return null!==(i=null==s?void 0:s.hits)&&void 0!==i?i:[]}emitTapEvent(t,i,s={},e=0){const{altKey:n=!1,ctrlKey:h=!1,metaKey:o=!1,shiftKey:r=!1}=s;t({position:i,altKey:n,ctrlKey:h,metaKey:o,shiftKey:r,buttons:e})}isCoarseInputDevice(t){return t||window.matchMedia("(pointer: coarse)").matches}getWorldPoint(t,i,s){const e=this.getViewport(),n=e.transformPointToFrame(t,i);return i.hitTest(n)?e.transformPointToWorldSpace(t,i):s}}class lt extends at{constructor(t,i,s,e,n,h,o,r,a,l,c){super(t,i,s,e,n,h,o,r,a,l,c)}async getWorldPointFromViewport(t){const i=this.getViewport(),s=this.getFrame();if(null==s)throw new Error("Cannot get world point. Frame is undefined.");const e=await s.depthBuffer();return null!=e?i.transformPointToOrthographicWorldSpace(t,e,.5):void 0}async panCameraByDelta(t){return this.transformCamera((({camera:i,viewport:s})=>{const e=i.viewVector,n=o.normalize(i.up),h=o.normalize(e),r=o.magnitude(e)*Math.tan(i.fovHeight),a=t.x*r/s.width,l=t.y/s.width*r,c=o.cross(n,h),u=o.cross(h,c),d=o.add(o.scale(a,c),o.scale(l,u));return i.moveBy(d)}))}async panCameraToScreenPoint(t){return this.transformCamera((({camera:i,frame:s,viewport:e})=>{if(null==this.panData){const n=i.toFrameCamera(),h=n.direction,o=e.transformPointToOrthographicRay(t,s.image,n),r=a.fromNormalAndCoplanarPoint(h,i.lookAt),c=l.intersectPlane(o,r);if(null==c)return console.warn("Cannot determine fallback for pan. Ray does not intersect plane."),i;this.panData={hitPt:c,hitPlane:r,startingCamera:n}}if(null!=this.panData){const{hitPt:n,hitPlane:h,startingCamera:r}=this.panData,a=e.transformPointToOrthographicRay(t,s.image,r),c=l.intersectPlane(a,h);if(null!=c){const t=o.subtract(n,c);return i.update({lookAt:o.add(r.lookAt,t)})}}return i}))}async zoomCameraToPoint(t,i){return this.transformCamera((({camera:s,viewport:e,frame:n,depthBuffer:r})=>{if(null==this.orthographicZoomData||h.distance(t,this.orthographicZoomData.startingScreenPt)>2){const i=s.toFrameCamera(),h=i.direction,o=e.transformPointToOrthographicRay(t,n.image,i),c=a.fromNormalAndCoplanarPoint(h,i.lookAt),u=l.intersectPlane(o,c);if(null==u)return console.warn("Cannot determine fallback point for zoom. Ray does not intersect plane."),s;const d=null!=r?this.getWorldPoint(t,r,u):u,v=a.fromNormalAndCoplanarPoint(h,d);this.orthographicZoomData={hitPt:d,hitPlane:v,startingScreenPt:t}}if(null!=this.orthographicZoomData){const{hitPt:t,hitPlane:n}=this.orthographicZoomData,h=s.fovHeight/e.height*2*i,r=Math.max(1,s.fovHeight-h),l=a.projectPoint(n,s.lookAt),c=o.scale((s.fovHeight-r)/s.fovHeight,o.subtract(t,l));return s.update({lookAt:o.add(s.lookAt,c),fovHeight:Math.max(1,s.fovHeight-h)})}return s}))}getWorldPoint(t,i,s){const e=this.getViewport(),n=e.transformPointToFrame(t,i);return i.hitTest(n)?e.transformPointToOrthographicWorldSpace(t,i):s}async transformCamera(t){var i;if(this.isInteracting()){const s=this.getScene(),e=this.getViewport(),n=this.getFrame(),h=await(null==n?void 0:n.depthBuffer());this.currentCamera=null!=this.currentCamera&&null!=e&&null!=n?t({camera:this.currentCamera,viewport:e,scale:s.scale(),boundingBox:s.boundingBox(),frame:n,depthBuffer:h}):void 0,await(null===(i=this.currentCamera)||void 0===i?void 0:i.render())}}}class ct extends at{constructor(t,i,s,e,n,h,o,r,a,l,c){super(t,i,s,e,n,h,o,r,a,l,c)}async panCameraByDelta(t){return this.transformCamera((({camera:i,viewport:s})=>{var e;const n=i.viewVector,h=o.normalize(i.up),r=o.normalize(n),a=o.magnitude(n)*Math.tan(null!==(e=i.fovY)&&void 0!==e?e:45),l=t.x*a/s.width,c=t.y/s.width*a,u=o.cross(h,r),d=o.cross(r,u),v=o.add(o.scale(l,u),o.scale(c,d));return i.moveBy(v)}))}async transformCamera(t){var i;if(this.isInteracting()){const s=this.getScene(),e=this.getViewport(),n=this.getFrame(),h=await(null==n?void 0:n.depthBuffer());this.currentCamera=null!=this.currentCamera&&null!=e&&null!=n?t({camera:this.currentCamera,viewport:e,scale:s.scale(),boundingBox:s.boundingBox(),frame:n,depthBuffer:h}):void 0,await(null===(i=this.currentCamera)||void 0===i?void 0:i.render())}}}class ut{constructor(t,i,s,e){this.stream=t,this.configProvider=i,this.imageScaleProvider=s,this.sceneProvider=e}predicate(t){return t.altKey&&t.shiftKey}async fn(t){var i,s;const e=this.imageScaleProvider(),n=await this.stream.hitItems({point:h.scale(t.position,(null==e?void 0:e.x)||1,(null==e?void 0:e.y)||1)},!0);if(null!=(null===(i=n.hitItems)||void 0===i?void 0:i.hits)&&n.hitItems.hits.length>0&&null!=n.hitItems.hits[0].hitPoint){const i=this.sceneProvider().camera(),e=n.hitItems.hits[0];null!=e.hitPoint&&null!=e.hitPoint.x&&null!=e.hitPoint.y&&null!=e.hitPoint.z?await this.stream.flyTo({camera:m(i.update({lookAt:o.create(e.hitPoint.x,e.hitPoint.y,e.hitPoint.z)}).toFrameCamera()),animation:{duration:p(this.configProvider().animation.durationMs)}}):console.debug(`No hit position found for fly to position [position={x: ${t.position.x}, y: ${t.position.y}}, hit-id={${null===(s=e.itemId)||void 0===s?void 0:s.hex}}]`)}else console.debug(`No hit results found for fly to position [position={x: ${t.position.x}, y: ${t.position.y}}]`)}}const dt=[.2,.15,.25,.25,.15];class vt{constructor(t,i,s,e,n,h,o,r,a,l){this.downEvent=t,this.upEvent=i,this.moveEvent=s,this.rotateInteraction=e,this.rotatePointInteraction=n,this.zoomInteraction=h,this.panInteraction=o,this.twistInteraction=r,this.pivotInteraction=a,this.getConfig=l,this.primaryInteraction=this.rotateInteraction,this.isDragging=!1,this.keyboardControls=!1,this.disableIndividualInteractions=!1,this.primaryInteractionTypeChange=new j,this.handleDownEvent=this.handleDownEvent.bind(this),this.handleMouseWheel=this.handleMouseWheel.bind(this),this.handleWindowMove=this.handleWindowMove.bind(this),this.handleWindowUp=this.handleWindowUp.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this)}initialize(t,i){this.element=t,this.interactionApi=i,t.addEventListener(this.downEvent,this.handleDownEvent),t.addEventListener("mousedown",this.handleDoubleClick),t.addEventListener("wheel",this.handleMouseWheel)}dispose(){var t,i,s;null===(t=this.element)||void 0===t||t.removeEventListener(this.downEvent,this.handleDownEvent),null===(i=this.element)||void 0===i||i.removeEventListener("mousedown",this.handleDoubleClick),null===(s=this.element)||void 0===s||s.removeEventListener("wheel",this.handleMouseWheel),this.element=void 0}onPrimaryInteractionTypeChange(t){return this.primaryInteractionTypeChange.on(t)}setCurrentInteractionType(t){var i;switch(t){case"rotate":this.currentInteraction=this.rotateInteraction;break;case"zoom":this.currentInteraction=this.zoomInteraction;break;case"pan":this.currentInteraction=this.panInteraction;break;case"twist":this.currentInteraction=this.twistInteraction;break;case"rotate-point":this.currentInteraction=this.rotatePointInteraction;break;case"pivot":this.currentInteraction=this.pivotInteraction;break;default:this.currentInteraction=void 0}if(this.draggingInteraction){const t=this.draggingInteraction.getPosition();this.draggingInteraction=this.currentInteraction||this.primaryInteraction,null===(i=this.interactionApi)||void 0===i||i.resetLastAngle(),this.draggingInteraction.setPosition(t)}}getPrimaryInteractionType(){return this.primaryInteraction.getType()}getCurrentInteractionType(){return(this.currentInteraction||this.primaryInteraction).getType()}setPrimaryInteractionType(t){switch(t){case"rotate":this.primaryInteraction=this.rotateInteraction;break;case"rotate-point":this.primaryInteraction=this.rotatePointInteraction;break;case"zoom":this.primaryInteraction=this.zoomInteraction;break;case"pan":this.primaryInteraction=this.panInteraction;break;case"pivot":this.primaryInteraction=this.pivotInteraction}this.primaryInteractionTypeChange.emit()}setDefaultKeyboardControls(t){this.keyboardControls=t}handleDownEvent(t){this.interactionTimer=window.setTimeout((()=>{this.downPosition=h.create(t.screenX,t.screenY),this.downPositionCanvas=this.getCanvasPosition(t),this.interactionTimer=void 0,null!=this.lastMoveEvent&&this.handleWindowMove(this.lastMoveEvent)}),this.getConfig().interactions.interactionDelay),window.addEventListener(this.moveEvent,this.handleWindowMove),window.addEventListener(this.upEvent,this.handleWindowUp)}handleWindowMove(t){if(null==this.interactionTimer){if(this.disableIndividualInteractions)return;const i=h.create(t.screenX,t.screenY),s=null!=this.interactionApi?this.interactionApi.pixelThreshold(this.isTouch(t)):2;null!=this.downPosition&&h.distance(i,this.downPosition)>=s&&!this.isDragging&&(this.beginDrag(t),this.isDragging=!0),this.isDragging&&this.drag(t)}this.lastMoveEvent=t}async handleWindowUp(t){this.isDragging&&(this.endDrag(t),this.isDragging=!1),null!=this.interactionTimer&&(window.clearTimeout(this.interactionTimer),this.interactionTimer=void 0),window.removeEventListener(this.moveEvent,this.handleWindowMove),window.removeEventListener(this.upEvent,this.handleWindowUp),this.lastMoveEvent=void 0}async handleDoubleClick(t){2===t.detail&&4===t.buttons&&null!=this.interactionApi&&this.interactionApi.viewAll()}beginDrag(t){this.keyboardControls&&t.metaKey&&t.shiftKey?this.currentInteraction=this.rotatePointInteraction:this.keyboardControls&&t.shiftKey?this.currentInteraction=this.zoomInteraction:this.keyboardControls&&(t.metaKey||t.ctrlKey)?this.currentInteraction=this.panInteraction:this.keyboardControls&&t.altKey&&(this.currentInteraction=this.rotateInteraction),1===t.buttons||4===t.buttons?this.draggingInteraction=this.currentInteraction||this.primaryInteraction:2===t.buttons&&(this.draggingInteraction=this.panInteraction),null!=this.draggingInteraction&&null!=this.interactionApi&&null!=this.element&&(this.zoomInteraction.endDrag(t,this.interactionApi),this.draggingInteraction.beginDrag(t,this.downPositionCanvas||h.create(t.clientX,t.clientY),this.interactionApi,this.element))}drag(t){this.currentInteraction=this.keyboardControls&&t.altKey&&t.shiftKey?this.twistInteraction:void 0,this.draggingInteraction=this.currentInteraction||this.draggingInteraction||this.primaryInteraction,null!=this.draggingInteraction&&null!=this.interactionApi&&this.draggingInteraction.drag(t,this.interactionApi)}endDrag(t){this.keyboardControls&&this.currentInteraction===this.twistInteraction&&(this.currentInteraction=void 0),null!=this.draggingInteraction&&null!=this.interactionApi&&(this.draggingInteraction.endDrag(t,this.interactionApi),this.draggingInteraction=void 0)}handleMouseWheel(t){if(t.preventDefault(),null!=this.element&&null!=this.interactionApi&&4!==t.buttons){const i=-this.wheelDeltaToPixels(t.deltaY,t.deltaMode)/10,s=this.element.getBoundingClientRect(),e=W(t,s);dt.forEach(((t,s)=>{window.setTimeout((()=>{null!=this.interactionApi&&this.zoomInteraction.zoomToPoint(e,i*t,this.interactionApi)}),2*s)}))}}wheelDeltaToPixels(t,i){null==this.computedBodyStyle&&(this.computedBodyStyle=window.getComputedStyle(document.body));const s=null==this.computedBodyStyle.fontSize||""===this.computedBodyStyle.fontSize||isNaN(parseFloat(this.computedBodyStyle.fontSize))?19.2:1.2*parseFloat(this.computedBodyStyle.fontSize);return 1===i?null==this.computedBodyStyle.lineHeight||""===this.computedBodyStyle.lineHeight||isNaN(parseFloat(this.computedBodyStyle.lineHeight))?t*s:t*parseFloat(this.computedBodyStyle.lineHeight):2===i?null==this.computedBodyStyle.height||""===this.computedBodyStyle.height||isNaN(parseFloat(this.computedBodyStyle.height))?t*window.innerHeight:t*parseFloat(this.computedBodyStyle.height):t}getCanvasPosition(t){var i;const s=null===(i=this.element)||void 0===i?void 0:i.getBoundingClientRect(),e=null!=s?h.create(s.left,s.top):void 0;return null!=e?h.subtract(h.create(t.clientX,t.clientY),e):void 0}isTouch(t){return null!=window.PointerEvent&&t instanceof PointerEvent&&"touch"===t.pointerType}}class wt{setPosition(t){this.currentPosition=t}getPosition(){return this.currentPosition}getType(){return this.type}beginDrag(t,i,s,e){}drag(t,i){}endDrag(t,i){null!=this.currentPosition&&(i.endInteraction(),this.currentPosition=void 0)}zoom(t,i){}}class ft extends wt{constructor(){super(...arguments),this.type="rotate"}beginDrag(t,i,s){null==this.currentPosition&&(this.currentPosition=h.create(t.screenX,t.screenY),s.beginInteraction())}drag(t,i){if(null!=this.currentPosition){const s=h.create(t.screenX,t.screenY),e=h.subtract(s,this.currentPosition);i.rotateCamera(e),this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class pt extends wt{constructor(){super(...arguments),this.type="rotate-point"}beginDrag(t,i,s){null==this.currentPosition&&(this.currentPosition=h.create(t.screenX,t.screenY),this.startingPosition=i,s.beginInteraction())}drag(t,i){if(null!=this.currentPosition&&null!=this.startingPosition){const s=h.create(t.screenX,t.screenY),e=h.subtract(s,this.currentPosition);i.rotateCameraAtPoint(e,this.startingPosition),this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class mt extends wt{constructor(t=1e3){super(),this.interactionTimeout=t,this.type="zoom",this.didTransformBegin=!1}beginDrag(t,i,s,e){if(null==this.currentPosition){this.currentPosition=h.create(t.clientX,t.clientY);const i=e.getBoundingClientRect(),n=W(t,i);this.startPt=n,s.beginInteraction()}}drag(t,i){if(null!=this.currentPosition){const s=h.create(t.clientX,t.clientY),e=h.subtract(s,this.currentPosition);null!=this.startPt&&(i.zoomCameraToPoint(this.startPt,e.y),this.currentPosition=s)}}endDrag(t,i){super.endDrag(t,i),this.stopInteractionTimer(),this.didTransformBegin=!1,this.startPt=void 0}zoom(t,i){this.operateWithTimer(i,(()=>i.zoomCamera(t)))}zoomToPoint(t,i,s){this.operateWithTimer(s,(()=>s.zoomCameraToPoint(t,i)))}beginInteraction(t){this.didTransformBegin=!0,t.beginInteraction()}endInteraction(t){this.didTransformBegin=!1,t.endInteraction()}resetInteractionTimer(t){this.stopInteractionTimer(),this.startInteractionTimer(t)}startInteractionTimer(t){this.interactionTimer=window.setTimeout((()=>{this.interactionTimer=void 0,this.endInteraction(t)}),this.interactionTimeout)}stopInteractionTimer(){null!=this.interactionTimer&&(window.clearTimeout(this.interactionTimer),this.interactionTimer=void 0)}operateWithTimer(t,i){this.didTransformBegin||this.beginInteraction(t),this.resetInteractionTimer(t),i()}}class gt extends wt{constructor(){super(...arguments),this.type="pan"}beginDrag(t,i,s,e){null==this.currentPosition&&(this.currentPosition=h.create(t.screenX,t.screenY),this.canvasRect=e.getBoundingClientRect(),s.beginInteraction())}drag(t,i){if(null!=this.currentPosition&&null!=this.canvasRect){const s=W(t,this.canvasRect);i.panCameraToScreenPoint(s),this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class yt extends wt{constructor(){super(...arguments),this.type="twist"}beginDrag(t,i,s){this.currentPosition=h.create(t.clientX,t.clientY),s.beginInteraction()}drag(t,i){const s=h.create(t.clientX,t.clientY);this.currentPosition=s,i.twistCamera(s)}endDrag(t,i){super.endDrag(t,i)}}class bt extends wt{constructor(){super(...arguments),this.type="pivot"}beginDrag(t,i,s){null==this.currentPosition&&(this.currentPosition=h.create(t.screenX,t.screenY),s.beginInteraction())}drag(t,i){if(null!=this.currentPosition){const s=h.create(t.screenX,t.screenY),e=h.subtract(s,this.currentPosition);i.pivotCamera(-.25*e.y,.25*e.x),this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class Ct extends vt{constructor(t,i=new ft,s=new pt,e=new mt,n=new gt,h=new yt,o=new bt){super("mousedown","mouseup","mousemove",i,s,e,n,h,o,t)}}class Pt{initialize(t,i){this.element=t,this.interactionApi=i}dispose(){this.element=void 0}handleTwoPointTouchMove(t,i){var s,e,n,o;if(null!=this.currentPosition1&&null!=this.currentPosition2){const a=h.scale(h.add(h.subtract(t,this.currentPosition1),h.subtract(i,this.currentPosition2)),.25,.25),l=.5*(h.distance(t,i)-h.distance(this.currentPosition1,this.currentPosition2)),c=u.create(h.subtract(this.currentPosition1,this.currentPosition2),h.subtract(t,i)),d=r.toDegrees(Math.atan2(u.determinant(c),u.dot(c)));null===(s=this.interactionApi)||void 0===s||s.beginInteraction(),null===(e=this.interactionApi)||void 0===e||e.zoomCamera(l),null===(n=this.interactionApi)||void 0===n||n.panCameraByDelta(a),Math.abs(d)>.5&&(null===(o=this.interactionApi)||void 0===o||o.twistCamera(d))}this.currentPosition1=t,this.currentPosition2=i}}class Tt extends Pt{constructor(){super(),this.touchPoints={},this.handlePointerDown=this.handlePointerDown.bind(this),this.handlePointerMove=this.handlePointerMove.bind(this),this.handlePointerUp=this.handlePointerUp.bind(this)}dispose(){var t;null===(t=this.element)||void 0===t||t.removeEventListener("pointerdown",this.handlePointerDown),super.dispose()}initialize(t,i){super.initialize(t,i),t.addEventListener("pointerdown",this.handlePointerDown)}handlePointerDown(t){const i=h.create(t.screenX,t.screenY);this.touchPoints=Object.assign(Object.assign({},this.touchPoints),{[t.pointerId]:i}),1===Object.keys(this.touchPoints).length&&(window.addEventListener("pointermove",this.handlePointerMove),window.addEventListener("pointerup",this.handlePointerUp))}handlePointerMove(t){null!=this.touchPoints[t.pointerId]&&(this.touchPoints[t.pointerId]=h.create(t.screenX,t.screenY));const i=Object.keys(this.touchPoints);2===i.length&&this.handleTwoPointTouchMove(this.touchPoints[i[0]],this.touchPoints[i[1]])}handlePointerUp(t){var i;delete this.touchPoints[t.pointerId];const s=Object.keys(this.touchPoints);1===s.length&&(null===(i=this.interactionApi)||void 0===i||i.endInteraction(),this.currentPosition1=void 0,this.currentPosition2=void 0),0===s.length&&(window.removeEventListener("pointermove",this.handlePointerMove),window.removeEventListener("pointerup",this.handlePointerUp))}}class It extends vt{constructor(t){super("pointerdown","pointerup","pointermove",new ft,new pt,new mt,new gt,new yt,new bt,t),this.touchPoints=new Set,this.handlePointerDown=this.handlePointerDown.bind(this),this.handlePointerUp=this.handlePointerUp.bind(this)}initialize(t,i){super.initialize(t,i),t.addEventListener("pointerdown",this.handlePointerDown)}handlePointerDown(t){this.downPosition=h.create(t.screenX,t.screenY),this.touchPoints.add(t.pointerId),1===this.touchPoints.size&&window.addEventListener("pointerup",this.handlePointerUp),2===this.touchPoints.size&&(this.disableIndividualInteractions=!0)}handlePointerUp(t){this.touchPoints.delete(t.pointerId),this.touchPoints.size<2&&(this.disableIndividualInteractions=!1),0===this.touchPoints.size&&window.removeEventListener("pointerup",this.handlePointerUp)}}class Dt{constructor(t,i,s,e){this.downEvent=t,this.upEvent=i,this.moveEvent=s,this.getConfig=e,this.handleDown=this.handleDown.bind(this),this.handleUp=this.handleUp.bind(this),this.handleMove=this.handleMove.bind(this),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this),this.handlePointerMove=this.handlePointerMove.bind(this),this.handlePointerEnd=this.handlePointerEnd.bind(this),this.clearPositions=this.clearPositions.bind(this),this.restartDoubleTapTimer=this.restartDoubleTapTimer.bind(this),this.clearDoubleTapTimer=this.clearDoubleTapTimer.bind(this),this.restartLongPressTimer=this.restartLongPressTimer.bind(this),this.clearLongPressTimer=this.clearLongPressTimer.bind(this),this.setPointerPositions=this.setPointerPositions.bind(this),this.emit=this.emit.bind(this)}dispose(){var t,i;null===(t=this.element)||void 0===t||t.removeEventListener(this.downEvent,this.handleDown),null===(i=this.element)||void 0===i||i.removeEventListener("touchstart",this.handleTouchStart),this.element=void 0,this.clearDoubleTapTimer(),this.clearLongPressTimer()}initialize(t,i){this.element=t,this.interactionApi=i,t.addEventListener(this.downEvent,this.handleDown),t.addEventListener("touchstart",this.handleTouchStart)}handleTouchStart(t){1===t.touches.length&&(this.setPointerPositions(h.create(t.touches[0].clientX,t.touches[0].clientY)),this.restartLongPressTimer(),window.addEventListener("touchend",this.handleTouchEnd),window.addEventListener("touchmove",this.handleTouchMove))}handleTouchMove(t){t.touches.length>0&&this.handlePointerMove(h.create(t.touches[0].clientX,t.touches[0].clientY),!0)}handleTouchEnd(t){null!=this.pointerDownPosition&&(window.removeEventListener("touchend",this.handleTouchEnd),window.removeEventListener("touchmove",this.handleTouchMove)),this.handlePointerEnd(this.pointerDownPosition)}handleDown(t){this.setPointerPositions(h.create(t.clientX,t.clientY)),this.buttons=t.buttons,this.restartLongPressTimer({altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey}),window.addEventListener(this.upEvent,this.handleUp),window.addEventListener(this.moveEvent,this.handleMove)}handleMove(t){this.handlePointerMove(h.create(t.clientX,t.clientY),this.isTouch(t))}handleUp(t){null!=this.pointerDownPosition&&(window.removeEventListener(this.upEvent,this.handleUp),window.removeEventListener(this.moveEvent,this.handleMove)),this.handlePointerEnd(h.create(t.clientX,t.clientY),{altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey},this.buttons,this.isTouch(t)),this.buttons=void 0}handlePointerMove(t,i){var s;const e=(null===(s=this.interactionApi)||void 0===s?void 0:s.pixelThreshold(i))||2;null!=this.pointerDownPosition&&h.distance(t,this.pointerDownPosition)>=e&&null==this.interactionTimer&&this.clearPositions()}handlePointerEnd(t,i={},s=0,e=!1){var n,h;null!=t&&(null!=this.longPressTimer&&this.emit(null===(n=this.interactionApi)||void 0===n?void 0:n.tap)(t,i,s),null!=this.doubleTapTimer&&null!=this.secondPointerDownPosition&&(this.emit(null===(h=this.interactionApi)||void 0===h?void 0:h.doubleTap)(t,i,s,this.secondPointerDownPosition),this.clearDoubleTapTimer())),this.pointerDownPosition=void 0,this.clearLongPressTimer()}emit(t){return(i,s={},e=0,n,o=!1)=>{var r;const a=n||this.pointerDownPosition,l=(null===(r=this.interactionApi)||void 0===r?void 0:r.pixelThreshold(o))||1;let c;null!=this.interactionTimer?c=this.getCanvasPosition(a||i):null!=a&&h.distance(a,i)<=l&&(c=this.getCanvasPosition(i)),null!=c&&null!=t&&t(c,s,e)}}getCanvasPosition(t){var i;const s=null===(i=this.element)||void 0===i?void 0:i.getBoundingClientRect(),e=null!=s?h.create(s.left,s.top):void 0;return null!=e?h.subtract(h.create(t.x,t.y),e):void 0}clearPositions(){this.pointerDownPosition=void 0,this.firstPointerDownPosition=void 0,this.secondPointerDownPosition=void 0,this.clearDoubleTapTimer(),this.clearLongPressTimer(),this.clearInteractionTimer()}clearDoubleTapTimer(){null!=this.doubleTapTimer&&window.clearTimeout(this.doubleTapTimer),this.doubleTapTimer=void 0,this.firstPointerDownPosition=void 0,this.secondPointerDownPosition=void 0}restartDoubleTapTimer(){this.clearDoubleTapTimer(),this.doubleTapTimer=window.setTimeout((()=>this.clearDoubleTapTimer()),this.getConfig().events.doubleTapThreshold)}clearLongPressTimer(){null!=this.longPressTimer&&window.clearTimeout(this.longPressTimer),this.longPressTimer=void 0}restartLongPressTimer(t={}){this.clearLongPressTimer(),this.longPressTimer=window.setTimeout((()=>{var i;this.pointerDownPosition&&this.emit(null===(i=this.interactionApi)||void 0===i?void 0:i.longPress)(this.pointerDownPosition,t,this.buttons),this.clearLongPressTimer()}),this.getConfig().events.longPressThreshold)}restartInteractionTimer(){this.clearInteractionTimer(),this.interactionTimer=window.setTimeout((()=>{this.interactionTimer=void 0}),this.getConfig().interactions.interactionDelay)}clearInteractionTimer(){null!=this.interactionTimer&&(window.clearTimeout(this.interactionTimer),this.interactionTimer=void 0)}setPointerPositions(t){this.pointerDownPosition=t,this.restartInteractionTimer(),null==this.firstPointerDownPosition?(this.restartDoubleTapTimer(),this.firstPointerDownPosition=t):this.secondPointerDownPosition=t}isTouch(t){return null!=window.PointerEvent&&t instanceof PointerEvent&&"touch"===t.pointerType}}class kt extends Pt{constructor(){super(),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this)}dispose(){var t;null===(t=this.element)||void 0===t||t.removeEventListener("touchstart",this.handleTouchStart),super.dispose()}initialize(t,i){super.initialize(t,i),t.addEventListener("touchstart",this.handleTouchStart)}handleTouchStart(t){if(t.touches.length>=1){const i=t.touches[0],s=t.touches[1];this.currentPosition1=h.create(i.screenX,i.screenY),this.currentPosition2=null!=s?h.create(s.screenX,s.screenY):void 0,window.addEventListener("touchmove",this.handleTouchMove,{passive:!1}),window.addEventListener("touchend",this.handleTouchEnd)}}handleTouchMove(t){if(1===t.touches.length)this.handleOnePointTouchMove(t.touches[0]);else if(2===t.touches.length){const i=h.create(t.touches[0].clientX,t.touches[0].clientY),s=h.create(t.touches[1].clientX,t.touches[1].clientY);this.handleTwoPointTouchMove(i,s)}}handleTouchEnd(t){var i;null===(i=this.interactionApi)||void 0===i||i.endInteraction(),this.isInteracting=!1,window.removeEventListener("touchmove",this.handleTouchMove),window.removeEventListener("touchend",this.handleTouchEnd)}handleOnePointTouchMove(t){var i,s,e;const n=h.create(t.screenX,t.screenY);if(null!=this.currentPosition1){const t=h.subtract(n,this.currentPosition1),o=(null===(i=this.interactionApi)||void 0===i?void 0:i.pixelThreshold(!0))||2;(h.distance(n,this.currentPosition1)>=o||this.isInteracting)&&(null===(s=this.interactionApi)||void 0===s||s.beginInteraction(),null===(e=this.interactionApi)||void 0===e||e.rotateCamera(t),this.isInteracting=!0)}this.currentPosition1=n}}const xt=new class{constructor(t,i=window.performance){this.name=t,this.perf=i,this.measures=new Set,this.nextId=0}clearMeasurements(){this.perf.clearMeasures(this.name)}measure(t){if(null!=(i=t)&&i.then instanceof Function&&i.catch instanceof Function&&i.finally instanceof Function){const i=this.begin();return t.finally((()=>this.end(i)))}if("function"==typeof t){const i=this.begin(),s=t();return this.end(i),s}throw new Error("Input must be a function or Promise");var i}takeMeasurements(){const t=this.perf.getEntriesByName(this.name);return this.clearMeasurements(),t}takeLastMeasurement(){const t=this.takeMeasurements();return t[t.length-1]}begin(){const t=`${this.name}-${this.nextId++}`;return this.measures.add(t),this.perf.mark(t),t}end(t){this.perf.measure(this.name,t),this.perf.clearMarks(t),this.measures.delete(t)}}("paint_time");function St(t,i,s,e,n=1e3){let h,o,r=0,a=[];return s&&setInterval((()=>{if(null!=o){5===a.length?a=[...a.slice(1),o]:a.push(o);const t=a.reduce(((t,i)=>t+i))/a.length;console.debug(`Paint rate: ${o}fps`),console.debug(`Paint rate (avg): ${t}`),o=void 0}}),1e3),s=>(r++,null==h&&(h=setInterval((()=>{!function(t,i){const s=t.takeMeasurements();s.length>0&&i(s)}(t,e),0===r&&null!=h&&(clearInterval(h),h=void 0)}),n)),t.measure((async()=>{const t=await i(s);return o=null==o?1:o+1,t})).finally((()=>{r--})))}var Et;!function(t){t.DEVICE_ID="vertexvis:device-id"}(Et||(Et={}));class Mt extends C{constructor(t,i={}){var s,e,n;super(t,{loggingEnabled:i.loggingEnabled}),this.state={type:"disconnected"},this.stateChanged=new j,this.dimensions=d.create(0,0),this.streamAttributes={},this.frameBgColor=R.create(255,255,255),this.config=$("platprod"),this.options={tokenRefreshOffsetInSeconds:null!==(s=i.tokenRefreshOffsetInSeconds)&&void 0!==s?s:30,offlineThresholdInSeconds:null!==(e=i.offlineThresholdInSeconds)&&void 0!==e?e:30,loadTimeoutInSeconds:null!==(n=i.loadTimeoutInSeconds)&&void 0!==n?n:15}}getState(){return this.state}disconnect(){"disconnected"!==this.state.type&&"connection-failed"!==this.state.type&&(console.debug("Disconnecting websocket"),this.state.connection.dispose(),this.updateState({type:"disconnected"}))}async load(t,i,s,e=$("platprod")){return this.clientId=i,this.deviceId=s,this.config=e,"disconnected"===this.state.type||"connection-failed"===this.state.type?this.loadIfDisconnected(t):this.loadIfConnectingOrConnected(t,this.state)}update(t){this.frameBgColor=t.frameBgColor?t.frameBgColor:this.frameBgColor,null!=t.dimensions&&t.dimensions!==this.dimensions&&(this.dimensions=t.dimensions,this.ifState("connected",(()=>this.updateDimensions({dimensions:this.dimensions})))),null!=t.streamAttributes&&this.streamAttributes!==t.streamAttributes&&(this.streamAttributes=t.streamAttributes,this.ifState("connected",(()=>this.updateStream({streamAttributes:Ot(this.streamAttributes)}))))}async loadIfConnectingOrConnected(t,i){const{resource:s,queries:e}=i.resource,n=H(t),h=!F.isEqual(s,n.resource),o=!F.isEqual(e,n.queries),r=null!=n.queries[0],a="connected"===i.type;if(h||("connecting"===i.type||"reconnecting"===i.type)&&o)return this.disconnect(),this.loadIfDisconnected(t);a&&r&&o&&(await this.loadSceneViewState({sceneViewStateId:{hex:n.queries[0].id}}),this.updateState(Object.assign(Object.assign({},i),{resource:n})))}async loadIfDisconnected(t){try{await this.connectWithNewStream(H(t))}catch(t){throw this.updateState(t instanceof U?{type:"connection-failed",message:`Cannot load scene. ${t.message}`,error:t}:t instanceof P?{type:"connection-failed",message:"Cannot load scene. Stream request failed to start stream.",error:t}:{type:"connection-failed",message:"Cannot load scene for unknown reason. See console logs.",error:t}),t}}connectWithNewStream(t){return this.openWebsocketStream(t,"connecting",(()=>this.requestNewStream(t)))}connectToExistingStream(t){return this.openWebsocketStream(t.resource,"reconnecting",(()=>this.requestReconnectStream(t)),{maxRetries:Number.POSITIVE_INFINITY})}async openWebsocketStream(t,i,s,{maxRetries:e=3}={}){const n=(h=function(t,i,s,e){return B.appendPath(null!=s?B.toString(B.parseAndAddParams("/ws",{clientId:s,deviceId:e})):`/stream-keys/${i.id}/session`,B.parse(t.network.renderingHost))}(this.config,t.resource,this.clientId,this.deviceId),{url:B.toString(h),protocols:["ws.vertexvis.com"]});var h;console.debug(`Initiating WS connection [uri=${n.url}]`);const o=new AbortController,r=(a=this.config,{EXPERIMENTAL_frameDelivery:Object.assign(Object.assign({},a.EXPERIMENTAL_frameDelivery),{rateLimitingEnabled:a.flags.throttleFrameDelivery}),EXPERIMENTAL_adaptiveRendering:Object.assign(Object.assign({},a.EXPERIMENTAL_adaptiveRendering),{enabled:a.flags.adaptiveRendering}),EXPERIMENTAL_qualityOfService:Object.assign({},a.EXPERIMENTAL_qualityOfService)});var a;this.updateState({type:i,resource:t,connection:{dispose:()=>{this.dispose(),o.abort()}}});const l=await z.abort(o.signal,z.retry((()=>this.connect(n,r)),{maxRetries:e,delaysInMs:Mt.WS_RECONNECT_DELAYS})).catch((t=>{throw new G("Websocket connection failed.",t instanceof Error?t:void 0)}));if(!l.aborted)return this.requestNewOrExistingStream(t,l.result,s);this.updateState({type:"disconnected"})}async requestNewOrExistingStream(t,i,s){const e=this.requestClock(),n=await s();console.debug(`Stream connected [stream-id=${n.streamId}, scene-view-id=${n.sceneViewId}]`);const h=this.onRequest((t=>{const i=t.request.drawFrame;if(null!=i){const t=T(n.worldOrientation)(i);"connected"===this.state.type&&this.updateState(Object.assign(Object.assign({},this.state),{frame:t}))}})),o=this.reconnectWhenNeeded(),r=this.refreshTokenWhenExpired(n.token),a=this.acknowledgeFrameRequests(),l=null==n.frame?await this.waitForFrame(n.worldOrientation,this.options.loadTimeoutInSeconds):n.frame,c=await e;console.debug(`Synchronized clocks [local-time=${c.knownLocalTime.toISOString()}, remote-time=${c.knownRemoteTime.toISOString()}]`),this.updateState({type:"connected",connection:{dispose:()=>{o.dispose(),h.dispose(),r.dispose(),a.dispose(),i.dispose()}},resource:t,streamId:n.streamId,deviceId:n.deviceId,sceneViewId:n.sceneViewId,worldOrientation:n.worldOrientation,token:n.token,frame:l,clock:c})}async requestNewStream(t){var i;const s=I(await this.startStream({streamKey:{value:t.resource.id},dimensions:this.dimensions,frameBackgroundColor:jt(this.frameBgColor),streamAttributes:Ot(this.streamAttributes),sceneViewStateId:"scene-view-state"===(null===(i=t.queries[0])||void 0===i?void 0:i.type)?{hex:t.queries[0].id}:void 0}));return{resource:t,streamId:s.streamId,sceneViewId:s.sceneViewId,deviceId:s.sessionId,token:s.token,worldOrientation:s.worldOrientation,frame:void 0}}async requestReconnectStream(t){const i=D(await this.reconnect({streamId:{hex:t.streamId},dimensions:this.dimensions,frameBackgroundColor:jt(this.frameBgColor),streamAttributes:Ot(this.streamAttributes)}));return Object.assign(Object.assign({},t),{token:i.token})}async requestClock(){const t=k(await this.syncTime({requestTime:x()}));return new J(t)}reconnectWhenNeeded(){const t=this.onClose((()=>{"connected"===this.state.type&&this.closeAndReconnect(this.state)})),i=this.onRequest((t=>{null!=t.request.gracefulReconnection&&"connected"===this.state.type&&(console.debug("Received request for graceful reconnect. Closing connection and attempting reconnect."),this.closeAndReconnect(this.state))})),s=this.reconnectWhenOffline();return{dispose:()=>{t.dispose(),i.dispose(),s.dispose()}}}refreshTokenWhenExpired(t){let i;const s=t=>{const{tokenRefreshOffsetInSeconds:e}=this.options,n=t.remainingTimeInMs(e);i=window.setTimeout((async()=>{const t=await this.refreshToken(),i=S(t);s(i),"connected"===this.state.type&&this.updateState(Object.assign(Object.assign({},this.state),{token:i}))}),n)};return s(t),{dispose:()=>clearTimeout(i)}}reconnectWhenOffline(){let t;const i=()=>window.clearTimeout(t),s=()=>{i();const s=this.options.offlineThresholdInSeconds;console.debug(`Detected that host is offline. Will attempt reconnect in ${s}s.`),t=window.setTimeout((()=>{"connected"===this.state.type&&this.closeAndReconnect(this.state)}),1e3*s)};return window.addEventListener("offline",(()=>s())),window.addEventListener("online",(()=>{console.debug("Detected that host is online."),i()})),{dispose:()=>{i(),window.removeEventListener("offline",s),window.removeEventListener("online",i)}}}closeAndReconnect(t){return t.connection.dispose(),this.connectToExistingStream(t)}async waitForFrame(t,i){let s;try{return await z.timeout(1e3*i,new Promise((i=>{s=this.onRequest((e=>{try{const n=e.request.drawFrame;if(null!=n){const s=T(t)(n);i(s)}}finally{null==s||s.dispose()}}))})))}catch(t){throw new _(`Frame timed out after ${i/1e3}s`,t instanceof Error?t:void 0)}finally{null==s||s.dispose()}}acknowledgeFrameRequests(){return this.onRequest(function(t,i){const s=function(t){let i=!1;return s=>{const e=t();if(null!=e){const t=e.remoteTime(new Date(Date.now())),n=p(s,t);return g(n).getTime()>=0?n:void(i||(console.warn(`Possible erroneous send to receive timing. Muting for 60s. [sent-at=${s.toISOString()}, received-at=${t.toISOString()}, remote-time=${e.knownRemoteTime.toISOString()}]`),i=!0,setTimeout((()=>i=!1),6e4)))}}}(i);return e=i=>{return e=()=>e=>{const n=g(e.sentAtTime);null!=n&&t.replyResult(i,{drawFrame:{sendToReceiveDuration:s(n)}})},t=>{const{drawFrame:i}=t.request;null!=i&&e()(t)};var e},t=>{var i;const s=null===(i=t.request.requestId)||void 0===i?void 0:i.value;null!=s&&e(s)(t)};var e}(this,(()=>"connected"===this.state.type?this.state.clock:void 0)))}updateState(t){this.state!==t&&(this.state=t,this.stateChanged.emit(this.state))}ifState(t,i){if(this.state.type===t)return i()}onStateChanged(t){return this.stateChanged.on(t)}}Mt.WS_RECONNECT_DELAYS=[0,1e3,1e3,5e3];const Ot=A.ifInvalidThrow(y),jt=A.ifInvalidThrow(b);let At=class{constructor(s){t(this,s),this.tap=i(this,"tap",7),this.doubletap=i(this,"doubletap",7),this.longpress=i(this,"longpress",7),this.frameReceived=i(this,"frameReceived",7),this.frameDrawn=i(this,"frameDrawn",7),this.tokenExpired=i(this,"tokenExpired",7),this.connectionChange=i(this,"connectionChange",7),this.sceneReady=i(this,"sceneReady",7),this.sceneChanged=i(this,"sceneChanged",7),this.interactionStarted=i(this,"interactionStarted",7),this.interactionFinished=i(this,"interactionFinished",7),this.cameraTypeChanged=i(this,"cameraTypeChanged",7),this.deviceIdChange=i(this,"deviceIdChange",7),this.dimensionschange=i(this,"dimensionschange",7),this.configEnv="platprod",this.cameraControls=!0,this.cameraType="perspective",this.keyboardControls=!0,this.rotateAroundTapPoint=!0,this.experimentalGhostingOpacity=0,this.noDefaultLights=!1,this.selectionMaterial=X,this.resizeDebounce=100,this.stencilBuffer=new ht(this.hostElement),this.viewport=nt.fromDimensions(d.create(0,0)),this.stateMap={cursorManager:new K,streamState:{type:"disconnected"}},this.interactionHandlers=[],this.tapKeyInteractions=[],this.internalFrameDrawnDispatcher=new j,this.handleElementResize=this.handleElementResize.bind(this)}componentWillLoad(){var t;this.updateResolvedConfig(),this.calculateComponentDimensions(),this.resizeObserver=new ResizeObserver(this.handleElementResize),this.registerSlotChangeListeners(),this.stream=null!==(t=this.stream)&&void 0!==t?t:new Mt(new E,{loggingEnabled:this.getResolvedConfig().flags.logWsMessages}),this.addStreamListeners(),this.updateStreamAttributes(),this.stateMap.cursorManager.onChanged.on((()=>this.handleCursorChanged()))}componentDidLoad(){var t,i,s;if(this.interactionApi=this.createInteractionApi(),null!=this.containerElement&&(null===(t=this.resizeObserver)||void 0===t||t.observe(this.containerElement)),null!=this.src)try{this.load(this.src)}catch(t){console.error("Error loading scene",t)}if(this.cameraControls)if(null!=window.PointerEvent){const t=new Dt("pointerdown","pointerup","pointermove",(()=>this.getResolvedConfig()));this.baseInteractionHandler=new It((()=>this.getResolvedConfig())),this.registerInteractionHandler(this.baseInteractionHandler),this.registerInteractionHandler(new Tt),this.registerInteractionHandler(t)}else{const t=new Dt("mousedown","mouseup","mousemove",(()=>this.getResolvedConfig()));this.baseInteractionHandler=new Ct((()=>this.getResolvedConfig())),this.registerInteractionHandler(this.baseInteractionHandler),this.registerInteractionHandler(new kt),this.registerInteractionHandler(t)}this.keyboardControls&&null!=this.stream&&(null===(i=this.baseInteractionHandler)||void 0===i||i.setDefaultKeyboardControls(this.keyboardControls),this.registerTapKeyInteraction(new rt(this.stream,(()=>this.getResolvedConfig()),(()=>this.getImageScale()))),this.registerTapKeyInteraction(new ut(this.stream,(()=>this.getResolvedConfig()),(()=>this.getImageScale()),(()=>this.createScene())))),this.rotateAroundTapPoint&&(null===(s=this.baseInteractionHandler)||void 0===s||s.setPrimaryInteractionType("rotate-point")),this.injectViewerApi()}render(){var t;return s(e,null,s("div",{class:"viewer-container",style:{cursor:V(null!==(t=this.cursor)&&void 0!==t?t:"")},onContextMenu:t=>t.preventDefault()},s("div",{ref:t=>this.containerElement=t,class:N("canvas-container",{"enable-pointer-events ":null!=window.PointerEvent})},s("canvas",{ref:t=>{this.canvasElement=t,this.stateMap.interactionTarget=t},class:"canvas"}),null!=this.errorMessage?s("div",{class:"error-message"},this.errorMessage):null),s("slot",null)))}async dispatchFrameDrawn(t){this.frame=t,this.internalFrameDrawnDispatcher.emit(t),this.frameDrawn.emit(t)}async registerInteractionHandler(t){return this.interactionHandlers.push(t),this.initializeInteractionHandler(t),{dispose:()=>{const i=this.interactionHandlers.indexOf(t);-1!==i&&(this.interactionHandlers[i].dispose(),this.interactionHandlers.splice(i,1))}}}async registerTapKeyInteraction(t){this.tapKeyInteractions=[...this.tapKeyInteractions,t]}async getInteractionTarget(){if(null!=this.stateMap.interactionTarget)return this.stateMap.interactionTarget;throw new Error("Interaction target is undefined.")}async addCursor(t,i){return this.stateMap.cursorManager.add(t,i)}async getInteractionHandlers(){return this.interactionHandlers}async getBaseInteractionHandler(){return this.baseInteractionHandler}async getJwt(){return this.token}handleSrcChanged(t){null!=t?this.load(t):this.unload()}handleRotateAboutTapPointChanged(){var t,i;this.updateStreamAttributes(),this.rotateAroundTapPoint?null===(t=this.baseInteractionHandler)||void 0===t||t.setPrimaryInteractionType("rotate-point"):null===(i=this.baseInteractionHandler)||void 0===i||i.setPrimaryInteractionType("rotate")}handleCameraTypeChanged(t,i){t!==i&&this.updateCameraType()}handleDepthBuffersChanged(){this.updateStreamAttributes()}handleExperimentalGhostingOpacityChanged(){this.updateStreamAttributes()}handleNoDefaultLightsChanged(){this.updateStreamAttributes()}handleFeatureLinesChanged(){this.updateStreamAttributes()}handleFeatureHighlightingChanged(){this.updateStreamAttributes()}handleFeatureMapsChanged(){this.updateStreamAttributes()}handleConfigChanged(){this.updateResolvedConfig()}handleConfigEnvChanged(){this.updateResolvedConfig()}async load(t){var i;if(null==this.stream||null==this.dimensions)throw new Y("Cannot load scene. Viewer has not been initialized.");this.calculateComponentDimensions(),this.stream.update({streamAttributes:this.getStreamAttributes(),config:$(this.configEnv,this.config),dimensions:this.dimensions,frameBgColor:this.getBackgroundColor()}),await(null===(i=this.stream)||void 0===i?void 0:i.load(t,this.clientId,this.getDeviceId(),this.getResolvedConfig())),this.sceneReady.emit()}async unload(){if(null!=this.stream&&(this.stream.disconnect(),this.frame=void 0,this.errorMessage=void 0),null!=this.canvasElement){const t=this.canvasElement.getContext("2d");null!=t&&t.clearRect(0,0,this.canvasElement.width,this.canvasElement.height)}}async scene(){return this.createScene()}async isSceneReady(){return"connected"===this.stateMap.streamState.type}async handleTapEvent(t){this.tapKeyInteractions.filter((i=>i.predicate(t.detail))).forEach((i=>i.fn(t.detail)))}emitConnectionChange(t){this.connectionChange.emit(t)}handleElementResize(t){t.length>=0&&null!=this.dimensions&&!d.isEqual(t[0].contentRect,this.viewport)&&(null!=this.resizeTimer&&(clearTimeout(this.resizeTimer),this.resizeTimer=void 0),this.isResizing||(this.resizeTimer=setTimeout((()=>{this.isResizing=!0,this.isResizeUpdate=!0,this.recalculateComponentDimensions()}),this.resizeDebounce)))}registerSlotChangeListeners(){this.mutationObserver=new MutationObserver((()=>this.injectViewerApi())),this.mutationObserver.observe(this.hostElement,{childList:!0,subtree:!0})}injectViewerApi(){function t(t){return Array.from(t.querySelectorAll("*"))}t(this.hostElement).filter((t=>t.nodeName.startsWith("VERTEX-"))).reduce(((i,s)=>[...i,s,...t(s)]),[]).forEach((t=>{t.viewer=this.hostElement}))}calculateComponentDimensions(){var t;const i=this.getBounds();if(null!=(null==i?void 0:i.width)&&null!=(null==i?void 0:i.height)){const s=d.create(i.width,i.height),e=d.scaleFit(2073600,s);this.hostDimensions=s,this.dimensions=null!=e?d.create(e.width,e.height):void 0,this.viewport=nt.fromDimensions(null!==(t=this.getCanvasDimensions())&&void 0!==t?t:d.create(0,0))}}recalculateComponentDimensions(){var t;this.isResizing&&(this.calculateComponentDimensions(),this.isResizing=!1,null===(t=this.stream)||void 0===t||t.update({dimensions:this.dimensions}),this.dimensionschange.emit(this.dimensions))}reportPerformance(t){if("connected"===this.stateMap.streamState.type){const i={timings:t.map((t=>({receiveToPaintDuration:p(t.duration)})))};this.getStream().recordPerformance(i,!1)}}addStreamListeners(){this.stateMap.streamListeners=this.getStream().stateChanged.on((t=>{this.handleStreamStateChanged(this.stateMap.streamState,t)}))}handleStreamStateChanged(t,i){this.stateMap.streamState=i,"connecting"===i.type?this.handleConnecting(t,i):"connected"===i.type?this.handleConnected(t,i):"connection-failed"===i.type?this.handleConnectionFailed(t,i):"disconnected"===i.type&&this.handleDisconnected(t,i)}handleConnecting(t,i){"connecting"!==t.type&&(this.token=void 0,this.errorMessage=void 0,this.emitConnectionChange({status:"connecting"}))}handleConnected(t,i){this.token=i.token.token,"connected"!==t.type&&(this.errorMessage=void 0,this.canvasRenderer=St(xt,function(){let t;return async i=>{var s,e,n;const h=i.frame.sequenceNumber,o=null==t||h>t,r=await(l=i.frame.image.imageBytes,null!=window.createImageBitmap?async function(t){const i=new Blob([t]),s=await window.createImageBitmap(i);return{image:s,dispose:()=>s.close()}}(l):(c=l,new Promise(((t,i)=>{const s=new Blob([c]),e=URL.createObjectURL(s),n=new Image;n.addEventListener("load",(()=>{t({image:n,dispose:()=>{}}),URL.revokeObjectURL(e)})),n.addEventListener("error",(()=>{i(new q("Failed to load image data")),URL.revokeObjectURL(e)})),n.src=e})))),a=null===(e=null===(s=i.predicate)||void 0===s?void 0:s.call(i))||void 0===e||e;var l,c;return o&&a&&(t=h,null===(n=i.beforeDraw)||void 0===n||n.call(i),function(t,i){const s=i.viewport.calculateDrawRect(i.frame.image);i.canvas.clearRect(0,0,i.canvasDimensions.width,i.canvasDimensions.height),i.canvas.drawImage(t.image,s.x,s.y,s.width,s.height)}(r,i)),r.dispose(),i.frame}}(),this.getResolvedConfig().flags.logFrameRate,(t=>this.reportPerformance(t))),this.emitConnectionChange({status:"connected",jwt:i.token.token}),this.deviceIdChange.emit(i.deviceId)),this.frame!==i.frame&&this.updateFrame(i.frame)}handleConnectionFailed(t,i){"connection-failed"!==t.type&&(this.token=void 0,this.errorMessage=i.message)}handleDisconnected(t,i){"disconnected"!==t.type&&(this.token=void 0,this.errorMessage=void 0,this.emitConnectionChange({status:"disconnected"}))}async updateFrame(t){const i=this.getCanvasDimensions();if(null!=this.canvasElement&&null!=i&&this.frame!==t){const s=this.canvasElement.getContext("2d");if(null!=s){const e=this.frame;this.frame=t,this.updateInteractionApi(e);const n={canvas:s,canvasDimensions:i,dimensions:this.dimensions,frame:this.frame,viewport:this.viewport,beforeDraw:()=>{this.updateCanvasDimensions(i),this.isResizeUpdate=!1},predicate:()=>!this.isResizeUpdate||null==this.dimensions||d.isEqual(this.dimensions,n.frame.image.imageAttr.frameDimensions)};this.frameReceived.emit(this.frame),this.frame.scene.hasChanged&&this.sceneChanged.emit();const h=await this.canvasRenderer(n);this.dispatchFrameDrawn(h)}}}initializeInteractionHandler(t){if(null==this.stateMap.interactionTarget)throw new Q("Cannot initialize interaction handler. Interaction target is undefined.");if(null==this.interactionApi)throw new Q("Cannot initialize interaction handler. Interaction APi is undefined.");t.initialize(this.stateMap.interactionTarget,this.interactionApi)}createInteractionApi(){if(null==this.stream)throw new Z("Cannot create interaction API. Component has not been initialized.");return null==this.frame||this.frame.scene.camera.isPerspective()?new ct(this.stream,this.stateMap.cursorManager,(()=>this.getResolvedConfig().interactions),(()=>this.createScene()),(()=>this.frame),(()=>this.viewport),this.tap,this.doubletap,this.longpress,this.interactionStarted,this.interactionFinished):new lt(this.stream,this.stateMap.cursorManager,(()=>this.getResolvedConfig().interactions),(()=>this.createScene()),(()=>this.frame),(()=>this.viewport),this.tap,this.doubletap,this.longpress,this.interactionStarted,this.interactionFinished)}handleCursorChanged(){window.requestAnimationFrame((()=>{this.cursor=this.stateMap.cursorManager.getActiveCursor()}))}createScene(){if("connected"!==this.stateMap.streamState.type)throw new tt("Cannot create scene. Viewer stream is not connected.");const{frame:t,sceneViewId:i,worldOrientation:s}=this.stateMap.streamState,e="string"==typeof this.selectionMaterial?it(this.selectionMaterial):this.selectionMaterial;return new st(this.getStream(),t,T(s),(()=>this.getImageScale()),this.viewport,i,e)}getBackgroundColor(){if(null!=this.containerElement)return function(t){const i=window.getComputedStyle(t);return R.fromCss(i.backgroundColor)}(this.containerElement)}getBounds(){return this.hostElement.getBoundingClientRect()}getCanvasDimensions(){return this.getResolvedConfig().flags.letterboxFrames?this.dimensions:this.hostDimensions}getImageScale(){const t=this.getCanvasDimensions();if(null!=this.dimensions&&null!=t)return h.create(this.dimensions.width/t.width,this.dimensions.height/t.height)}getStreamAttributes(){return{depthBuffers:this.getDepthBufferStreamAttributesValue(),experimentalGhosting:this.experimentalGhostingOpacity,noDefaultLights:this.noDefaultLights,featureLines:this.featureLines,featureHighlighting:this.featureHighlighting,featureMaps:this.featureMaps}}updateCanvasDimensions(t){null!=this.canvasElement&&(this.canvasElement.width=t.width,this.canvasElement.height=t.height)}updateStreamAttributes(){var t;null===(t=this.stream)||void 0===t||t.update({streamAttributes:this.getStreamAttributes()})}updateInteractionApi(t){if(null!=this.frame){const i=(null==t||t.scene.camera.isPerspective())&&this.frame.scene.camera.isOrthographic(),s=(null==t||t.scene.camera.isOrthographic())&&this.frame.scene.camera.isPerspective();(i||s)&&(this.interactionApi=this.createInteractionApi(),this.cameraType=this.frame.scene.camera.isPerspective()?"perspective":"orthographic",this.cameraTypeChanged.emit(this.cameraType),this.interactionHandlers.forEach((t=>this.initializeInteractionHandler(t))))}}updateCameraType(){var t,i;null!=this.frame&&("orthographic"===this.cameraType&&this.frame.scene.camera.isPerspective()?null===(t=this.stream)||void 0===t||t.replaceCamera({camera:m(M(this.frame.scene.camera,this.frame.scene.boundingBox))}):"perspective"===this.cameraType&&this.frame.scene.camera.isOrthographic()&&(null===(i=this.stream)||void 0===i||i.replaceCamera({camera:m(O(this.frame.scene.camera))})))}getDepthBufferStreamAttributesValue(){var t;return null!==(t=this.depthBuffers)&&void 0!==t?t:this.rotateAroundTapPoint?"final":void 0}updateResolvedConfig(){this.resolvedConfig=$(this.configEnv,this.config)}getResolvedConfig(){return Rt("Resolved config is undefined",(()=>this.resolvedConfig))}getStream(){return Rt("Stream is undefined",(()=>this.stream))}getDeviceId(){if(null==this.deviceId){try{this.deviceId=function(t,i,s=window.localStorage){const e=s.getItem(Et.DEVICE_ID);if(null!=e)return i(JSON.parse(e))}(0,(t=>t["device-id"]))}catch(t){console.warn("Cannot read device ID. Local storage is not supported.")}if(null==this.deviceId){this.deviceId=L.create();try{!function(t,i,s=window.localStorage){const e=s.getItem(t);if(null!=e){const n=Object.assign(Object.assign({},JSON.parse(e)),i);s.setItem(t,JSON.stringify(n))}else s.setItem(t,JSON.stringify(i))}(Et.DEVICE_ID,{"device-id":this.deviceId})}catch(t){console.warn("Cannot write device ID. Local storage is not supported.")}}}return this.deviceId}get hostElement(){return n(this)}static get watchers(){return{src:["handleSrcChanged"],rotateAroundTapPoint:["handleRotateAboutTapPointChanged"],cameraType:["handleCameraTypeChanged"],depthBuffers:["handleDepthBuffersChanged"],experimentalGhostingOpacity:["handleExperimentalGhostingOpacityChanged"],noDefaultLights:["handleNoDefaultLightsChanged"],featureLines:["handleFeatureLinesChanged"],featureHighlighting:["handleFeatureHighlightingChanged"],featureMaps:["handleFeatureMapsChanged"],config:["handleConfigChanged"],configEnv:["handleConfigEnvChanged"]}}};function Rt(t,i){const s=i();if(null!=s)return s;throw new Error(t)}At.style=":host{--image-background:var(--image-background);--viewer-background:var(--viewer-background);display:block;position:relative;width:300px;height:300px;min-width:1px;min-height:1px}.canvas-container{display:flex;justify-content:center;align-items:center;width:100%;height:100%;position:relative;background:var(--image-background, var(--viewer-background, #ffffff))}.enable-pointer-events{touch-action:none}.viewer-container{width:100%;height:100%;overflow:hidden;background:var(--viewer-background, #ffffff)}.error-message{position:absolute;top:50%;width:100%;transform:translateY(-50%);text-align:center}";export{At as vertex_viewer}
|