@vertexvis/viewer 1.1.1-testing.3 → 1.1.1-testing.5
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/README.template.md +14 -8
- package/dist/cjs/{bundle-07I6_WqC.js → bundle-BCS0nA91.js} +28 -25
- package/dist/cjs/bundle-BCS0nA91.js.map +1 -0
- package/dist/cjs/{config-CepHuwRF.js → config-OELTgslY.js} +3 -3
- package/dist/cjs/{config-CepHuwRF.js.map → config-OELTgslY.js.map} +1 -1
- package/dist/cjs/{controller-Dklbe0Y6.js → controller-DvE3p6ta.js} +3 -3
- package/dist/cjs/{controller-Dklbe0Y6.js.map → controller-DvE3p6ta.js.map} +1 -1
- package/dist/cjs/{dom-Dlu6-7PF.js → dom-BuQSLPWr.js} +3 -3
- package/dist/cjs/{dom-Dlu6-7PF.js.map → dom-BuQSLPWr.js.map} +1 -1
- package/dist/cjs/{entities-BdWnb6KI.js → entities-rj-TEPKc.js} +4 -4
- package/dist/cjs/{entities-BdWnb6KI.js.map → entities-rj-TEPKc.js.map} +1 -1
- package/dist/cjs/{geometry_pb-BISQT2vx.js → geometry_pb-asn2mNvW.js} +3 -3
- package/dist/cjs/{geometry_pb-BISQT2vx.js.map → geometry_pb-asn2mNvW.js.map} +1 -1
- package/dist/cjs/grpc-D5Apx_zz.js.map +1 -1
- package/dist/cjs/index.cjs.js +13 -13
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{markup-C-qyTwID.js → markup-Du4uVRo4.js} +3 -3
- package/dist/cjs/{markup-C-qyTwID.js.map → markup-Du4uVRo4.js.map} +1 -1
- package/dist/cjs/{model-Dy5FvjIA.js → model-BC6acIWJ.js} +3 -3
- package/dist/cjs/{model-Dy5FvjIA.js.map → model-BC6acIWJ.js.map} +1 -1
- package/dist/cjs/model-Bw4h8wNt.js.map +1 -1
- package/dist/cjs/{model-k5VBFN6C.js → model-DqxeakCS.js} +3 -3
- package/dist/cjs/{model-k5VBFN6C.js.map → model-DqxeakCS.js.map} +1 -1
- package/dist/cjs/{multiElementInteractionHandler-Bqpg2wVT.js → multiElementInteractionHandler-Bdeo6FYp.js} +6 -5
- package/dist/cjs/multiElementInteractionHandler-Bdeo6FYp.js.map +1 -0
- package/dist/cjs/{overlays-BujVkBnG.js → overlays-DASFbMSp.js} +3 -3
- package/dist/cjs/{overlays-BujVkBnG.js.map → overlays-DASFbMSp.js.map} +1 -1
- package/dist/cjs/{queries-GhYmoomu.js → queries-e19TP_oF.js} +5 -5
- package/dist/cjs/queries-e19TP_oF.js.map +1 -0
- package/dist/cjs/{regl-component-CB004H91.js → regl-component-DjVaO3t3.js} +6 -6
- package/dist/cjs/{regl-component-CB004H91.js.map → regl-component-DjVaO3t3.js.map} +1 -1
- package/dist/cjs/{representation_pb-CHCm5o1e.js → representation_pb-BVBPrHLf.js} +3 -3
- package/dist/cjs/{representation_pb-CHCm5o1e.js.map → representation_pb-BVBPrHLf.js.map} +1 -1
- package/dist/cjs/{results-BpfUIwa8.js → results-CU9Ctm2K.js} +3 -3
- package/dist/cjs/{results-BpfUIwa8.js.map → results-CU9Ctm2K.js.map} +1 -1
- package/dist/cjs/{streamAttributes-CJOD7AxG.js → streamAttributes-M3UUIO3l.js} +118 -95
- package/dist/cjs/streamAttributes-M3UUIO3l.js.map +1 -0
- package/dist/cjs/{util-smaTO4bk.js → util-gX3IGslq.js} +3 -3
- package/dist/cjs/{util-smaTO4bk.js.map → util-gX3IGslq.js.map} +1 -1
- package/dist/cjs/{utils-BsXO-wLi.js → utils-D5TGpFAV.js} +3 -3
- package/dist/cjs/utils-D5TGpFAV.js.map +1 -0
- package/dist/cjs/{utils-DY6afhh8.js → utils-opS9hsaU.js} +3 -3
- package/dist/cjs/{utils-DY6afhh8.js.map → utils-opS9hsaU.js.map} +1 -1
- package/dist/cjs/vertex-scene-tree-notification-banner_4.cjs.entry.js +2 -2
- package/dist/cjs/vertex-scene-tree-notification-banner_4.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-scene-tree-table-cell.cjs.entry.js +3 -3
- package/dist/cjs/vertex-scene-tree-table-cell.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-scene-tree-table-column.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-scene-tree.cjs.entry.js +3 -3
- package/dist/cjs/vertex-scene-tree.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-annotation-callout.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-box-query-tool.cjs.entry.js +4 -4
- package/dist/cjs/vertex-viewer-box-query-tool.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-button_3.cjs.entry.js +6 -1
- package/dist/cjs/vertex-viewer-button_3.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-default-toolbar.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-default-toolbar.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-dom-element_2.cjs.entry.js +5 -5
- package/dist/cjs/vertex-viewer-dom-group.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-hit-result-indicator.cjs.entry.js +5 -5
- package/dist/cjs/vertex-viewer-markup-arrow_3.cjs.entry.js +3 -3
- package/dist/cjs/vertex-viewer-markup-tool.cjs.entry.js +4 -4
- package/dist/cjs/vertex-viewer-markup-tool.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-markup.cjs.entry.js +3 -3
- package/dist/cjs/vertex-viewer-markup.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-measurement-details.cjs.entry.js +3 -3
- package/dist/cjs/vertex-viewer-measurement-distance.cjs.entry.js +8 -8
- package/dist/cjs/vertex-viewer-measurement-line_2.cjs.entry.js +5 -5
- package/dist/cjs/vertex-viewer-measurement-precise.cjs.entry.js +7 -7
- package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js +7 -7
- package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-pin-label_2.cjs.entry.js +9 -8
- package/dist/cjs/vertex-viewer-pin-label_2.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-pin-tool.cjs.entry.js +3 -3
- package/dist/cjs/vertex-viewer-spinner.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-teleport-tool.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-transform-widget.cjs.entry.js +7 -7
- package/dist/cjs/vertex-viewer-transform-widget.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-view-cube.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-walk-mode-tool.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer.cjs.entry.js +8 -8
- package/dist/cjs/viewer.cjs.js +1 -1
- package/dist/cjs/{viewport-B70DgDZj.js → viewport-BDbB9o9T.js} +3 -3
- package/dist/cjs/{viewport-B70DgDZj.js.map → viewport-BDbB9o9T.js.map} +1 -1
- package/dist/collection/components/scene-tree/scene-tree.css +2 -3
- package/dist/collection/components/scene-tree/scene-tree.js.map +1 -1
- package/dist/collection/components/scene-tree-notification-banner/scene-tree-notification-banner.css +1 -1
- package/dist/collection/components/scene-tree-search/scene-tree-search.css +1 -1
- package/dist/collection/components/scene-tree-search/scene-tree-search.js +1 -1
- package/dist/collection/components/scene-tree-search/scene-tree-search.js.map +1 -1
- package/dist/collection/components/scene-tree-table-cell/scene-tree-table-cell.css +10 -10
- package/dist/collection/components/scene-tree-table-cell/scene-tree-table-cell.js +1 -1
- package/dist/collection/components/scene-tree-table-cell/scene-tree-table-cell.js.map +1 -1
- package/dist/collection/components/scene-tree-table-column/scene-tree-table-column.css +0 -1
- package/dist/collection/components/scene-tree-table-layout/scene-tree-table-layout.css +3 -3
- package/dist/collection/components/viewer-annotation-callout/viewer-annotation-callout.css +3 -4
- package/dist/collection/components/viewer-box-query-tool/types.js.map +1 -1
- package/dist/collection/components/viewer-box-query-tool/viewer-box-query-tool.css +9 -7
- package/dist/collection/components/viewer-button/viewer-button.js +32 -1
- package/dist/collection/components/viewer-button/viewer-button.js.map +1 -1
- package/dist/collection/components/viewer-default-toolbar/viewer-default-toolbar.css +2 -2
- package/dist/collection/components/viewer-default-toolbar/viewer-default-toolbar.js +1 -1
- package/dist/collection/components/viewer-default-toolbar/viewer-default-toolbar.js.map +1 -1
- package/dist/collection/components/viewer-markup/viewer-markup.js.map +1 -1
- package/dist/collection/components/viewer-markup-arrow/utils.js.map +1 -1
- package/dist/collection/components/viewer-markup-tool/viewer-markup-tool.css +2 -2
- package/dist/collection/components/viewer-pin-group/viewer-pin-group.css +12 -11
- package/dist/collection/components/viewer-pin-label/viewer-pin-label.css +21 -8
- package/dist/collection/components/viewer-pin-label/viewer-pin-label.js +4 -3
- package/dist/collection/components/viewer-pin-label/viewer-pin-label.js.map +1 -1
- package/dist/collection/components/viewer-pin-label-line/viewer-pin-label-line.css +5 -4
- package/dist/collection/components/viewer-spinner/viewer-spinner.css +2 -2
- package/dist/collection/components/viewer-transform-widget/viewer-transform-widget-components.js +1 -1
- package/dist/collection/components/viewer-transform-widget/viewer-transform-widget-components.js.map +1 -1
- package/dist/collection/components/viewer-transform-widget/viewer-transform-widget.css +1 -2
- package/dist/collection/lib/grpc.js.map +1 -1
- package/dist/collection/lib/interactions/baseInteractionHandler.js +2 -1
- package/dist/collection/lib/interactions/baseInteractionHandler.js.map +1 -1
- package/dist/collection/lib/scenes/scene.js.map +1 -1
- package/dist/collection/lib/scenes/sceneViewStateLoader.js.map +1 -1
- package/dist/collection/lib/stream/state.js.map +1 -1
- package/dist/collection/lib/types/loadableResource.js.map +1 -1
- package/dist/collection/lib/types/sceneViewStateIdentifier.js.map +1 -1
- package/dist/collection/lib/walk-mode/model.js.map +1 -1
- package/dist/collection/workers/png-decoder-pool.js +4 -3
- package/dist/collection/workers/png-decoder-pool.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/p-2UsvOTHJ.js +5 -0
- package/dist/components/p-2UsvOTHJ.js.map +1 -0
- package/dist/components/{p-CZgX-9yo.js → p-5bk1mHRt.js} +2 -2
- package/dist/components/{p-DRGCkSEK.js → p-B8530k7R.js} +2 -2
- package/dist/components/{p-garvKln8.js → p-BAuOB8M-.js} +2 -2
- package/dist/components/p-BAuOB8M-.js.map +1 -0
- package/dist/components/{p-BKQMbekH.js → p-BCuMPvZO.js} +2 -2
- package/dist/components/p-BFEV_v80.js +5 -0
- package/dist/components/p-BFEV_v80.js.map +1 -0
- package/dist/components/{p-C02XtMl4.js → p-BHyxBmg6.js} +2 -2
- package/dist/components/{p-O1_Yvjd6.js → p-BT9d9jRt.js} +2 -2
- package/dist/components/{p-oDn1DcWj.js → p-BZDn1Vuv.js} +2 -2
- package/dist/components/{p-VEJB73Ei.js → p-Bdf4AcJ2.js} +2 -2
- package/dist/components/p-BgzjmANj.js +5 -0
- package/dist/components/p-BgzjmANj.js.map +1 -0
- package/dist/components/p-BjvjKoy7.js +5 -0
- package/dist/components/p-BjvjKoy7.js.map +1 -0
- package/dist/components/p-Bwtyddca.js +5 -0
- package/dist/components/p-Bwtyddca.js.map +1 -0
- package/dist/components/{p-CMdP8O-G.js → p-Bx42CNGV.js} +2 -2
- package/dist/components/{p-CelQDFR0.js → p-C12jtCFb.js} +2 -2
- package/dist/components/p-C86HMDzi.js +5 -0
- package/dist/components/p-C86HMDzi.js.map +1 -0
- package/dist/components/{p-Dzs4u_ZY.js → p-CABws4i9.js} +2 -2
- package/dist/components/p-CIuxJYJL.js.map +1 -1
- package/dist/components/{p-BqeEZXPn.js → p-CPROw2BU.js} +2 -2
- package/dist/components/p-CSVgoQU8.js +5 -0
- package/dist/components/p-CSVgoQU8.js.map +1 -0
- package/dist/components/{p-DnVcQAR9.js → p-CTi-0-dI.js} +2 -2
- package/dist/components/{p-EG7pMA2M.js → p-CeZe0Qql.js} +2 -2
- package/dist/components/p-CioaIHsi.js.map +1 -1
- package/dist/components/{p-Due5EmBt.js → p-Clyxptbp.js} +2 -2
- package/dist/components/{p-taOlygmc.js → p-Cs2aiMUK.js} +2 -2
- package/dist/components/p-Cs2aiMUK.js.map +1 -0
- package/dist/components/p-DUo-H-nW.js +5 -0
- package/dist/components/p-DUo-H-nW.js.map +1 -0
- package/dist/components/{p-MnZadXO8.js → p-D_h07qsA.js} +2 -2
- package/dist/components/{p-DCTZZ5Rd.js → p-DjQ6RXWP.js} +2 -2
- package/dist/components/p-DxuSiXYg.js.map +1 -1
- package/dist/components/{p-CxzyM08j.js → p-DyL2wWm6.js} +2 -2
- package/dist/components/{p-avWSFTeP.js → p-JvS9LLoO.js} +2 -2
- package/dist/components/{p-CfTvpqud.js → p-KidjtXKE.js} +2 -2
- package/dist/{viewer/p-7m7Vr5V7.js → components/p-Ng27jBsS.js} +2 -2
- package/dist/components/p-Ng27jBsS.js.map +1 -0
- package/dist/components/{p-BC777sCK.js → p-UJR-ixsy.js} +2 -2
- package/dist/components/{p-Ib4vgh2t.js → p-UrT4ZJv3.js} +2 -2
- package/dist/components/{p-Ib4vgh2t.js.map → p-UrT4ZJv3.js.map} +1 -1
- package/dist/components/{p-mpsCUvSn.js → p-_qi2VkC2.js} +2 -2
- package/dist/components/{p-CNprIkKd.js → p-rDr0x5Z7.js} +2 -2
- package/dist/components/vertex-scene-tree-search.js +1 -1
- package/dist/components/vertex-scene-tree-table-cell.js +1 -1
- package/dist/components/vertex-scene-tree-table-cell.js.map +1 -1
- package/dist/components/vertex-scene-tree-table-column.js.map +1 -1
- package/dist/components/vertex-scene-tree-table-layout.js +1 -1
- package/dist/components/vertex-scene-tree.js +1 -1
- package/dist/components/vertex-scene-tree.js.map +1 -1
- package/dist/components/vertex-viewer-annotation-callout.js.map +1 -1
- package/dist/components/vertex-viewer-box-query-tool.js +1 -1
- package/dist/components/vertex-viewer-box-query-tool.js.map +1 -1
- package/dist/components/vertex-viewer-button.js +1 -1
- package/dist/components/vertex-viewer-default-toolbar.js +1 -1
- package/dist/components/vertex-viewer-default-toolbar.js.map +1 -1
- package/dist/components/vertex-viewer-dom-element.js +1 -1
- package/dist/components/vertex-viewer-dom-group.js +1 -1
- package/dist/components/vertex-viewer-dom-renderer.js +1 -1
- package/dist/components/vertex-viewer-hit-result-indicator.js +1 -1
- package/dist/components/vertex-viewer-markup-arrow.js +1 -1
- package/dist/components/vertex-viewer-markup-circle.js +1 -1
- package/dist/components/vertex-viewer-markup-freeform.js +1 -1
- package/dist/components/vertex-viewer-markup-tool.js +1 -1
- package/dist/components/vertex-viewer-markup-tool.js.map +1 -1
- package/dist/components/vertex-viewer-markup.js +1 -1
- package/dist/components/vertex-viewer-markup.js.map +1 -1
- package/dist/components/vertex-viewer-measurement-details.js +1 -1
- package/dist/components/vertex-viewer-measurement-distance.js +1 -1
- package/dist/components/vertex-viewer-measurement-line.js +1 -1
- package/dist/components/vertex-viewer-measurement-overlays.js +1 -1
- package/dist/components/vertex-viewer-measurement-precise.js +1 -1
- package/dist/components/vertex-viewer-pin-group.js +1 -1
- package/dist/components/vertex-viewer-pin-label-line.js +1 -1
- package/dist/components/vertex-viewer-pin-label.js +1 -1
- package/dist/components/vertex-viewer-pin-tool.js +1 -1
- package/dist/components/vertex-viewer-teleport-tool.js +1 -1
- package/dist/components/vertex-viewer-transform-widget.js +1 -1
- package/dist/components/vertex-viewer-transform-widget.js.map +1 -1
- package/dist/components/vertex-viewer-view-cube.js +1 -1
- package/dist/components/vertex-viewer-walk-mode-tool.js +1 -1
- package/dist/components/vertex-viewer.js +1 -1
- package/dist/esm/{bundle-CZZALKHT.js → bundle-2UsvOTHJ.js} +28 -25
- package/dist/esm/bundle-2UsvOTHJ.js.map +1 -0
- package/dist/esm/{config-CyaUTJEG.js → config-Cqrcty7U.js} +3 -3
- package/dist/esm/{config-CyaUTJEG.js.map → config-Cqrcty7U.js.map} +1 -1
- package/dist/esm/{controller-ByBd8r3O.js → controller-BPECXXfj.js} +3 -3
- package/dist/esm/{controller-ByBd8r3O.js.map → controller-BPECXXfj.js.map} +1 -1
- package/dist/esm/{dom-Bbf2HAst.js → dom-DaP9SiyY.js} +3 -3
- package/dist/esm/{dom-Bbf2HAst.js.map → dom-DaP9SiyY.js.map} +1 -1
- package/dist/esm/{entities-DriL3zBC.js → entities-CawBZH7i.js} +4 -4
- package/dist/esm/{entities-DriL3zBC.js.map → entities-CawBZH7i.js.map} +1 -1
- package/dist/esm/{geometry_pb-BEB8SExe.js → geometry_pb-COdZQiRi.js} +3 -3
- package/dist/esm/{geometry_pb-BEB8SExe.js.map → geometry_pb-COdZQiRi.js.map} +1 -1
- package/dist/esm/grpc-hWL8wFvk.js.map +1 -1
- package/dist/esm/index.js +13 -13
- package/dist/esm/index.mjs +13 -13
- package/dist/esm/loader.js +1 -1
- package/dist/esm/loader.mjs +1 -1
- package/dist/esm/{markup-y96-uR-l.js → markup-B58g75Hr.js} +3 -3
- package/dist/esm/{markup-y96-uR-l.js.map → markup-B58g75Hr.js.map} +1 -1
- package/dist/esm/{model-BJQo0DxL.js → model-B5KuXEsl.js} +3 -3
- package/dist/esm/{model-BJQo0DxL.js.map → model-B5KuXEsl.js.map} +1 -1
- package/dist/esm/model-BHVr1tU0.js.map +1 -1
- package/dist/esm/{model-CTdG73h9.js → model-Dc6T63-k.js} +3 -3
- package/dist/esm/{model-CTdG73h9.js.map → model-Dc6T63-k.js.map} +1 -1
- package/dist/esm/{multiElementInteractionHandler-C45E8VzE.js → multiElementInteractionHandler-3tE3OPpw.js} +6 -5
- package/dist/esm/multiElementInteractionHandler-3tE3OPpw.js.map +1 -0
- package/dist/esm/{overlays-DmcRtaSn.js → overlays-BwIqsqLW.js} +3 -3
- package/dist/esm/{overlays-DmcRtaSn.js.map → overlays-BwIqsqLW.js.map} +1 -1
- package/dist/esm/{queries-DWjy-LsV.js → queries-B4XotYyr.js} +5 -5
- package/dist/esm/queries-B4XotYyr.js.map +1 -0
- package/dist/esm/{regl-component-zzdsBise.js → regl-component-B1_h3_s8.js} +6 -6
- package/dist/esm/{regl-component-zzdsBise.js.map → regl-component-B1_h3_s8.js.map} +1 -1
- package/dist/esm/{representation_pb-CQdJxiGO.js → representation_pb-C4MJfZMo.js} +3 -3
- package/dist/esm/{representation_pb-CQdJxiGO.js.map → representation_pb-C4MJfZMo.js.map} +1 -1
- package/dist/esm/{results-ClIgKssN.js → results-De9arm7M.js} +3 -3
- package/dist/esm/{results-ClIgKssN.js.map → results-De9arm7M.js.map} +1 -1
- package/dist/esm/{streamAttributes-CTs61PCl.js → streamAttributes-BW9JzMeG.js} +117 -94
- package/dist/esm/streamAttributes-BW9JzMeG.js.map +1 -0
- package/dist/esm/{util-DUjEw5Kh.js → util-CMPFqnEv.js} +3 -3
- package/dist/esm/{util-DUjEw5Kh.js.map → util-CMPFqnEv.js.map} +1 -1
- package/dist/esm/{utils-DOjHP1wA.js → utils-B1mSYmAK.js} +3 -3
- package/dist/esm/{utils-DOjHP1wA.js.map → utils-B1mSYmAK.js.map} +1 -1
- package/dist/esm/{utils-DJ5FvINs.js → utils-c-mcLgsj.js} +3 -3
- package/dist/esm/utils-c-mcLgsj.js.map +1 -0
- package/dist/esm/vertex-scene-tree-notification-banner_4.entry.js +2 -2
- package/dist/esm/vertex-scene-tree-notification-banner_4.entry.js.map +1 -1
- package/dist/esm/vertex-scene-tree-table-cell.entry.js +3 -3
- package/dist/esm/vertex-scene-tree-table-cell.entry.js.map +1 -1
- package/dist/esm/vertex-scene-tree-table-column.entry.js.map +1 -1
- package/dist/esm/vertex-scene-tree.entry.js +3 -3
- package/dist/esm/vertex-scene-tree.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-annotation-callout.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-box-query-tool.entry.js +4 -4
- package/dist/esm/vertex-viewer-box-query-tool.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-button_3.entry.js +6 -1
- package/dist/esm/vertex-viewer-button_3.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-default-toolbar.entry.js +2 -2
- package/dist/esm/vertex-viewer-default-toolbar.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-dom-element_2.entry.js +5 -5
- package/dist/esm/vertex-viewer-dom-group.entry.js +1 -1
- package/dist/esm/vertex-viewer-hit-result-indicator.entry.js +5 -5
- package/dist/esm/vertex-viewer-markup-arrow_3.entry.js +3 -3
- package/dist/esm/vertex-viewer-markup-tool.entry.js +4 -4
- package/dist/esm/vertex-viewer-markup-tool.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-markup.entry.js +3 -3
- package/dist/esm/vertex-viewer-markup.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-measurement-details.entry.js +3 -3
- package/dist/esm/vertex-viewer-measurement-distance.entry.js +8 -8
- package/dist/esm/vertex-viewer-measurement-line_2.entry.js +5 -5
- package/dist/esm/vertex-viewer-measurement-precise.entry.js +7 -7
- package/dist/esm/vertex-viewer-pin-group.entry.js +7 -7
- package/dist/esm/vertex-viewer-pin-group.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-pin-label_2.entry.js +9 -8
- package/dist/esm/vertex-viewer-pin-label_2.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-pin-tool.entry.js +3 -3
- package/dist/esm/vertex-viewer-spinner.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-teleport-tool.entry.js +2 -2
- package/dist/esm/vertex-viewer-transform-widget.entry.js +7 -7
- package/dist/esm/vertex-viewer-transform-widget.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-view-cube.entry.js +2 -2
- package/dist/esm/vertex-viewer-walk-mode-tool.entry.js +1 -1
- package/dist/esm/vertex-viewer.entry.js +8 -8
- package/dist/esm/viewer.js +1 -1
- package/dist/esm/{viewport-D90kzsD7.js → viewport-CHtidaFL.js} +3 -3
- package/dist/esm/{viewport-D90kzsD7.js.map → viewport-CHtidaFL.js.map} +1 -1
- package/dist/types/components/viewer-button/viewer-button.d.ts +5 -0
- package/dist/types/components.d.ts +14 -1
- package/dist/types/lib/walk-mode/model.d.ts +10 -10
- package/dist/types/regl-shape.d.ts +1 -5
- package/dist/types/workers/png-decoder-pool.d.ts +0 -1
- package/dist/viewer/index.esm.js +1 -1
- package/dist/viewer/{p-12a673f0.entry.js → p-1506f9a2.entry.js} +2 -2
- package/dist/viewer/p-1506f9a2.entry.js.map +1 -0
- package/dist/viewer/{p-78f422af.entry.js → p-287e0670.entry.js} +2 -2
- package/dist/viewer/{p-78f422af.entry.js.map → p-287e0670.entry.js.map} +1 -1
- package/dist/viewer/{p-7b4eec65.entry.js → p-293d8f3f.entry.js} +2 -2
- package/dist/viewer/p-2UsvOTHJ.js +5 -0
- package/dist/viewer/p-2UsvOTHJ.js.map +1 -0
- package/dist/viewer/{p-510fd2e1.entry.js → p-2d2fa147.entry.js} +2 -2
- package/dist/viewer/{p-a108a305.entry.js → p-2faddbf8.entry.js} +2 -2
- package/dist/viewer/{p-e3981cf8.entry.js → p-36349a80.entry.js} +2 -2
- package/dist/viewer/p-36349a80.entry.js.map +1 -0
- package/dist/viewer/{p-aa0359e0.entry.js → p-3c5dd716.entry.js} +2 -2
- package/dist/viewer/p-44395076.entry.js +5 -0
- package/dist/viewer/p-44395076.entry.js.map +1 -0
- package/dist/viewer/{p-fe434552.entry.js → p-45cc095e.entry.js} +2 -2
- package/dist/viewer/p-504e77a7.entry.js +5 -0
- package/dist/viewer/{p-c2c3579f.entry.js.map → p-504e77a7.entry.js.map} +1 -1
- package/dist/viewer/{p-71c03352.entry.js → p-53f6cc59.entry.js} +2 -2
- package/dist/viewer/{p-56e39cff.entry.js → p-83683307.entry.js} +2 -2
- package/dist/viewer/{p-91fca24b.entry.js → p-93311f46.entry.js} +2 -2
- package/dist/viewer/{p-BIR7Lfxx.js → p-BEOO-Ypv.js} +2 -2
- package/dist/viewer/{p-BIR7Lfxx.js.map → p-BEOO-Ypv.js.map} +1 -1
- package/dist/viewer/{p-C6YtUG51.js → p-BJGbLthH.js} +2 -2
- package/dist/viewer/{p-C6YtUG51.js.map → p-BJGbLthH.js.map} +1 -1
- package/dist/viewer/{p-O1_Yvjd6.js → p-BT9d9jRt.js} +2 -2
- package/dist/viewer/{p-O1_Yvjd6.js.map → p-BT9d9jRt.js.map} +1 -1
- package/dist/viewer/{p-VEJB73Ei.js → p-Bdf4AcJ2.js} +2 -2
- package/dist/viewer/{p-VEJB73Ei.js.map → p-Bdf4AcJ2.js.map} +1 -1
- package/dist/viewer/{p-C-huOg09.js → p-Br21pGVj.js} +2 -2
- package/dist/viewer/{p-C-huOg09.js.map → p-Br21pGVj.js.map} +1 -1
- package/dist/viewer/{p-Ce1j43tF.js → p-Bw_ryWU0.js} +2 -2
- package/dist/viewer/{p-Ce1j43tF.js.map → p-Bw_ryWU0.js.map} +1 -1
- package/dist/viewer/{p-CelQDFR0.js → p-C12jtCFb.js} +2 -2
- package/dist/viewer/{p-CelQDFR0.js.map → p-C12jtCFb.js.map} +1 -1
- package/dist/viewer/{p-B-J4CqZy.js → p-C4_1Jc7H.js} +2 -2
- package/dist/viewer/{p-B-J4CqZy.js.map → p-C4_1Jc7H.js.map} +1 -1
- package/dist/viewer/p-CEDqc5sS.js +5 -0
- package/dist/viewer/{p-BDy3SLKk.js.map → p-CEDqc5sS.js.map} +1 -1
- package/dist/viewer/p-Cc3XhAoA.js +5 -0
- package/dist/viewer/p-Cc3XhAoA.js.map +1 -0
- package/dist/viewer/{p-EG7pMA2M.js → p-CeZe0Qql.js} +2 -2
- package/dist/viewer/{p-EG7pMA2M.js.map → p-CeZe0Qql.js.map} +1 -1
- package/dist/viewer/p-CioaIHsi.js.map +1 -1
- package/dist/viewer/{p-EUeCUp3y.js → p-CxBXErQ8.js} +2 -2
- package/dist/viewer/{p-EUeCUp3y.js.map → p-CxBXErQ8.js.map} +1 -1
- package/dist/viewer/{p-CIBBr-p1.js → p-D0aTA_2m.js} +2 -2
- package/dist/viewer/{p-CIBBr-p1.js.map → p-D0aTA_2m.js.map} +1 -1
- package/dist/viewer/{p-UQXG8bCI.js → p-DBfvBC5O.js} +2 -2
- package/dist/viewer/p-DBfvBC5O.js.map +1 -0
- package/dist/{components/p-QhlhRt6X.js → viewer/p-DIbJ8Ijj.js} +2 -2
- package/dist/viewer/p-DIbJ8Ijj.js.map +1 -0
- package/dist/viewer/{p-Cju1inFh.js → p-DYDhLlLS.js} +2 -2
- package/dist/viewer/p-DYDhLlLS.js.map +1 -0
- package/dist/viewer/{p-CxzyM08j.js → p-DyL2wWm6.js} +2 -2
- package/dist/viewer/{p-CxzyM08j.js.map → p-DyL2wWm6.js.map} +1 -1
- package/dist/viewer/{p-avWSFTeP.js → p-JvS9LLoO.js} +2 -2
- package/dist/viewer/{p-avWSFTeP.js.map → p-JvS9LLoO.js.map} +1 -1
- package/dist/viewer/{p-mpsCUvSn.js → p-_qi2VkC2.js} +2 -2
- package/dist/viewer/{p-mpsCUvSn.js.map → p-_qi2VkC2.js.map} +1 -1
- package/dist/viewer/{p-9312a936.entry.js → p-a94b626c.entry.js} +2 -2
- package/dist/viewer/p-b5cc83a4.entry.js.map +1 -1
- package/dist/viewer/{p-fc7d9b2b.entry.js → p-c531ca97.entry.js} +2 -2
- package/dist/viewer/{p-fc7d9b2b.entry.js.map → p-c531ca97.entry.js.map} +1 -1
- package/dist/viewer/p-c9dee5c4.entry.js +5 -0
- package/dist/viewer/p-c9dee5c4.entry.js.map +1 -0
- package/dist/viewer/p-ce711ae0.entry.js +5 -0
- package/dist/viewer/p-ce711ae0.entry.js.map +1 -0
- package/dist/viewer/{p-82ed4346.entry.js → p-ced98004.entry.js} +2 -2
- package/dist/viewer/p-d357d235.entry.js.map +1 -1
- package/dist/viewer/p-dcb6ddfe.entry.js +5 -0
- package/dist/viewer/p-dcb6ddfe.entry.js.map +1 -0
- package/dist/viewer/p-e98db875.entry.js.map +1 -1
- package/dist/viewer/{p-c2454523.entry.js → p-ea45c3e9.entry.js} +2 -2
- package/dist/viewer/p-ebd9dd99.entry.js +5 -0
- package/dist/viewer/p-ebd9dd99.entry.js.map +1 -0
- package/dist/viewer/{p-a893a299.entry.js → p-ecd594f2.entry.js} +2 -2
- package/dist/viewer/{p-03a531d9.entry.js → p-ef9437ca.entry.js} +2 -2
- package/dist/viewer/p-fec5a15d.entry.js +5 -0
- package/dist/viewer/p-fec5a15d.entry.js.map +1 -0
- package/dist/viewer/p-ipyYHvea.js.map +1 -1
- package/dist/viewer/viewer.esm.js +1 -1
- package/package.json +10 -10
- package/readme.md +14 -8
- package/dist/cjs/bundle-07I6_WqC.js.map +0 -1
- package/dist/cjs/multiElementInteractionHandler-Bqpg2wVT.js.map +0 -1
- package/dist/cjs/queries-GhYmoomu.js.map +0 -1
- package/dist/cjs/streamAttributes-CJOD7AxG.js.map +0 -1
- package/dist/cjs/utils-BsXO-wLi.js.map +0 -1
- package/dist/components/p-B4sO9HdX.js +0 -5
- package/dist/components/p-B4sO9HdX.js.map +0 -1
- package/dist/components/p-C--Voxln.js +0 -5
- package/dist/components/p-C--Voxln.js.map +0 -1
- package/dist/components/p-CZZALKHT.js +0 -5
- package/dist/components/p-CZZALKHT.js.map +0 -1
- package/dist/components/p-Cn0vKqIN.js +0 -5
- package/dist/components/p-Cn0vKqIN.js.map +0 -1
- package/dist/components/p-DH341c7b.js +0 -5
- package/dist/components/p-DH341c7b.js.map +0 -1
- package/dist/components/p-DjrtwKcK.js +0 -5
- package/dist/components/p-DjrtwKcK.js.map +0 -1
- package/dist/components/p-Dmc49hX3.js +0 -5
- package/dist/components/p-Dmc49hX3.js.map +0 -1
- package/dist/components/p-QhlhRt6X.js.map +0 -1
- package/dist/components/p-Y8W_BXUk.js +0 -5
- package/dist/components/p-Y8W_BXUk.js.map +0 -1
- package/dist/components/p-garvKln8.js.map +0 -1
- package/dist/components/p-taOlygmc.js.map +0 -1
- package/dist/esm/bundle-CZZALKHT.js.map +0 -1
- package/dist/esm/multiElementInteractionHandler-C45E8VzE.js.map +0 -1
- package/dist/esm/queries-DWjy-LsV.js.map +0 -1
- package/dist/esm/streamAttributes-CTs61PCl.js.map +0 -1
- package/dist/esm/utils-DJ5FvINs.js.map +0 -1
- package/dist/viewer/p-02384d83.entry.js +0 -5
- package/dist/viewer/p-02384d83.entry.js.map +0 -1
- package/dist/viewer/p-12a673f0.entry.js.map +0 -1
- package/dist/viewer/p-49578ec9.entry.js +0 -5
- package/dist/viewer/p-49578ec9.entry.js.map +0 -1
- package/dist/viewer/p-4c223366.entry.js +0 -5
- package/dist/viewer/p-4c223366.entry.js.map +0 -1
- package/dist/viewer/p-7m7Vr5V7.js.map +0 -1
- package/dist/viewer/p-8774425b.entry.js +0 -5
- package/dist/viewer/p-8774425b.entry.js.map +0 -1
- package/dist/viewer/p-9c02567d.entry.js +0 -5
- package/dist/viewer/p-9c02567d.entry.js.map +0 -1
- package/dist/viewer/p-BDy3SLKk.js +0 -5
- package/dist/viewer/p-CZZALKHT.js +0 -5
- package/dist/viewer/p-CZZALKHT.js.map +0 -1
- package/dist/viewer/p-Cju1inFh.js.map +0 -1
- package/dist/viewer/p-Cr2EnhS-.js +0 -5
- package/dist/viewer/p-Cr2EnhS-.js.map +0 -1
- package/dist/viewer/p-UQXG8bCI.js.map +0 -1
- package/dist/viewer/p-c2c3579f.entry.js +0 -5
- package/dist/viewer/p-d5542b6a.entry.js +0 -5
- package/dist/viewer/p-d5542b6a.entry.js.map +0 -1
- package/dist/viewer/p-e3981cf8.entry.js.map +0 -1
- /package/dist/components/{p-CZgX-9yo.js.map → p-5bk1mHRt.js.map} +0 -0
- /package/dist/components/{p-DRGCkSEK.js.map → p-B8530k7R.js.map} +0 -0
- /package/dist/components/{p-BKQMbekH.js.map → p-BCuMPvZO.js.map} +0 -0
- /package/dist/components/{p-C02XtMl4.js.map → p-BHyxBmg6.js.map} +0 -0
- /package/dist/components/{p-O1_Yvjd6.js.map → p-BT9d9jRt.js.map} +0 -0
- /package/dist/components/{p-oDn1DcWj.js.map → p-BZDn1Vuv.js.map} +0 -0
- /package/dist/components/{p-VEJB73Ei.js.map → p-Bdf4AcJ2.js.map} +0 -0
- /package/dist/components/{p-CMdP8O-G.js.map → p-Bx42CNGV.js.map} +0 -0
- /package/dist/components/{p-CelQDFR0.js.map → p-C12jtCFb.js.map} +0 -0
- /package/dist/components/{p-Dzs4u_ZY.js.map → p-CABws4i9.js.map} +0 -0
- /package/dist/components/{p-BqeEZXPn.js.map → p-CPROw2BU.js.map} +0 -0
- /package/dist/components/{p-DnVcQAR9.js.map → p-CTi-0-dI.js.map} +0 -0
- /package/dist/components/{p-EG7pMA2M.js.map → p-CeZe0Qql.js.map} +0 -0
- /package/dist/components/{p-Due5EmBt.js.map → p-Clyxptbp.js.map} +0 -0
- /package/dist/components/{p-MnZadXO8.js.map → p-D_h07qsA.js.map} +0 -0
- /package/dist/components/{p-DCTZZ5Rd.js.map → p-DjQ6RXWP.js.map} +0 -0
- /package/dist/components/{p-CxzyM08j.js.map → p-DyL2wWm6.js.map} +0 -0
- /package/dist/components/{p-avWSFTeP.js.map → p-JvS9LLoO.js.map} +0 -0
- /package/dist/components/{p-CfTvpqud.js.map → p-KidjtXKE.js.map} +0 -0
- /package/dist/components/{p-BC777sCK.js.map → p-UJR-ixsy.js.map} +0 -0
- /package/dist/components/{p-mpsCUvSn.js.map → p-_qi2VkC2.js.map} +0 -0
- /package/dist/components/{p-CNprIkKd.js.map → p-rDr0x5Z7.js.map} +0 -0
- /package/dist/viewer/{p-7b4eec65.entry.js.map → p-293d8f3f.entry.js.map} +0 -0
- /package/dist/viewer/{p-510fd2e1.entry.js.map → p-2d2fa147.entry.js.map} +0 -0
- /package/dist/viewer/{p-a108a305.entry.js.map → p-2faddbf8.entry.js.map} +0 -0
- /package/dist/viewer/{p-aa0359e0.entry.js.map → p-3c5dd716.entry.js.map} +0 -0
- /package/dist/viewer/{p-fe434552.entry.js.map → p-45cc095e.entry.js.map} +0 -0
- /package/dist/viewer/{p-71c03352.entry.js.map → p-53f6cc59.entry.js.map} +0 -0
- /package/dist/viewer/{p-56e39cff.entry.js.map → p-83683307.entry.js.map} +0 -0
- /package/dist/viewer/{p-91fca24b.entry.js.map → p-93311f46.entry.js.map} +0 -0
- /package/dist/viewer/{p-9312a936.entry.js.map → p-a94b626c.entry.js.map} +0 -0
- /package/dist/viewer/{p-82ed4346.entry.js.map → p-ced98004.entry.js.map} +0 -0
- /package/dist/viewer/{p-c2454523.entry.js.map → p-ea45c3e9.entry.js.map} +0 -0
- /package/dist/viewer/{p-a893a299.entry.js.map → p-ecd594f2.entry.js.map} +0 -0
- /package/dist/viewer/{p-03a531d9.entry.js.map → p-ef9437ca.entry.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{h as e,F as t,t as i,p as a,H as o,e as r}from"./p-Bb32XUUS.js";import{q as c,v as n,h as d}from"./p-CZZALKHT.js";import{r as s}from"./p-Cd7kap5W.js";import{O as f,g as b,S as l}from"./p-DjrtwKcK.js";import{c as h}from"./p-C6gMOKYg.js";import{d as v}from"./p-C02XtMl4.js";import{d as g}from"./p-CNprIkKd.js";import{d as u}from"./p-CMdP8O-G.js";const w={front:{direction:n.back(),quaternion:c.create()},back:{direction:n.forward(),quaternion:c.fromAxisAngle(n.up(),Math.PI)},left:{direction:n.left(),quaternion:c.fromAxisAngle(n.down(),Math.PI/2)},right:{direction:n.right(),quaternion:c.fromAxisAngle(n.up(),Math.PI/2)},top:{direction:n.up(),quaternion:c.fromAxisAngle(n.right(),-Math.PI/2)},bottom:{direction:n.down(),quaternion:c.fromAxisAngle(n.left(),-Math.PI/2)}};const p=({label:i,length:a,rotationAxis:o})=>{const r={width:`${a+5}px`};const s=c.fromAxisAngle(o,Math.PI/2);const f=n.scale(a+15,n.right());return e(t,null,e("vertex-viewer-dom-group",{quaternion:s},e("vertex-viewer-dom-element",{style:r,billboardOff:true,interactionsOff:true},e("div",{class:`triad-axis triad-axis-${i.toLowerCase()}`})),e("vertex-viewer-dom-element",{rotation:d.create({x:Math.PI/2,y:0,z:0}),style:r,billboardOff:true,interactionsOff:true},e("div",{class:`triad-axis triad-axis-${i.toLowerCase()}`})),e("vertex-viewer-dom-element",{position:f,interactionsOff:true},e("div",{class:`triad-label triad-label-${i.toLowerCase()}`},i))))};const m=({label:t,length:i,side:a,disabled:o,onPointerDown:r})=>{const{direction:c,quaternion:d}=w[a];const s=n.scale(i/2-.1,c);return e("vertex-viewer-dom-element",{class:h("cube-side",{disabled:o}),position:s,quaternion:d,style:{width:`${i}px`,height:`${i}px`},onPointerDown:r,billboardOff:true},e("div",{class:`cube-side-face cube-side-face-${t.toLowerCase()}`},t))};const x=({length:t,face1Side:i,face1Corner:a,face2Side:o,face2Corner:r,face3Side:c,face3Corner:d,disabled:s,onPointerDown:f})=>{const{direction:b,quaternion:l}=w[i];const{direction:v,quaternion:g}=w[o];const{direction:u,quaternion:p}=w[c];const m=n.scale(t/2,b);const x=n.scale(t/2,v);const y=n.scale(t/2,u);const k={width:`${t}px`,height:`${t}px`};return e("vertex-viewer-dom-group",{class:h("cube-corner",{disabled:s}),onPointerDown:f},e("vertex-viewer-dom-element",{position:m,quaternion:l,style:k,billboardOff:true},e("div",{class:`cube-corner-face ${a}`})),e("vertex-viewer-dom-element",{position:x,quaternion:g,style:k,billboardOff:true},e("div",{class:`cube-corner-face ${r}`})),e("vertex-viewer-dom-element",{position:y,quaternion:p,style:k,billboardOff:true},e("div",{class:`cube-corner-face ${d}`})))};const y=({length:t,face1Side:i,face2Side:a,face1Edge:o,face2Edge:r,disabled:c,onPointerDown:d})=>{const{direction:s,quaternion:f}=w[i];const{direction:b,quaternion:l}=w[a];const v=n.scale(t/2,s);const g=n.scale(t/2,b);const u={width:`${t}px`,height:`${t}px`};return e("vertex-viewer-dom-group",{class:h("cube-edge",{disabled:c}),onPointerDown:d},e("vertex-viewer-dom-element",{position:v,quaternion:f,style:u,billboardOff:true},e("div",{class:`cube-edge-face ${o}`})),e("vertex-viewer-dom-element",{position:g,quaternion:l,style:u,billboardOff:true},e("div",{class:`cube-edge-face ${r}`})))};const k=({length:t})=>{const{direction:i,quaternion:a}=w.top;const o=n.scale(-t/2,i);return e("vertex-viewer-dom-element",{class:"cube-shadow",position:o,quaternion:a,style:{width:`${t}px`,height:`${t}px`},billboardOff:true,interactionsOff:true},e("div",{class:"cube-shadow-face"}))};const S=()=>`:host{--viewer-view-cube-side-background:var(--white);--viewer-view-cube-side-background-hover:var(--blue-500);--viewer-view-cube-side-background-hover-opacity:0.25;--viewer-view-cube-side-border:1.5px solid var(--neutral-500);--viewer-view-cube-edge-length:12px;--viewer-view-cube-opacity:0.8;--viewer-view-cube-triad-x-axis-color:var(--x-axis-color);--viewer-view-cube-triad-y-axis-color:var(--y-axis-color);--viewer-view-cube-triad-z-axis-color:var(--z-axis-color);color:var(--neutral-700);width:80px;height:80px;margin:20px;position:relative;display:flex;align-items:center;justify-content:center;user-select:none}.renderer{position:unset;width:100%;height:100%;overflow:visible !important}.reference-point{width:5px;height:5px;border-radius:50%;background-color:black}.triad{pointer-events:none}.triad-axis{width:100%;height:1.5px;outline:1px solid transparent;transform:translateX(50%)}.triad-axis-x{background-color:#ea3324}.triad-axis-y{background-color:#4faf32}.triad-axis-z{background-color:#0000ff}.triad-label{font-family:Arial, Helvetica, sans-serif;font-size:0.6875rem}.triad-label-x{color:var(--viewer-view-cube-triad-x-axis-color)}.triad-label-y{color:var(--viewer-view-cube-triad-y-axis-color)}.triad-label-z{color:var(--viewer-view-cube-triad-z-axis-color)}.cube{pointer-events:initial}.cube:hover .cube-side-face{opacity:1}.cube-side{backface-visibility:hidden;-webkit-backface-visibility:hidden}.cube-side-face{box-sizing:border-box;font-size:0.875rem;text-transform:uppercase;width:100%;height:100%;background-color:var(--viewer-view-cube-side-background);border:var(--viewer-view-cube-side-border);display:flex;align-items:center;justify-content:center;outline:1px solid transparent;opacity:var(--viewer-view-cube-opacity);transition:opacity 0.2s ease-in-out}.cube-side-face::before{content:'';position:absolute;left:calc(var(--viewer-view-cube-edge-length) - 4px);right:calc(var(--viewer-view-cube-edge-length) - 4px);top:calc(var(--viewer-view-cube-edge-length) - 4px);bottom:calc(var(--viewer-view-cube-edge-length) - 4px)}.cube-corner,.cube-edge{position:relative}.cube-corner-face,.cube-edge-face{position:absolute;backface-visibility:hidden;-webkit-backface-visibility:hidden}.cube-edge-face.top{top:0;left:var(--viewer-view-cube-edge-length);right:var(--viewer-view-cube-edge-length);height:var(--viewer-view-cube-edge-length)}.cube-edge-face.bottom{bottom:0;left:var(--viewer-view-cube-edge-length);right:var(--viewer-view-cube-edge-length);height:var(--viewer-view-cube-edge-length)}.cube-edge-face.left{left:0;top:var(--viewer-view-cube-edge-length);bottom:var(--viewer-view-cube-edge-length);width:var(--viewer-view-cube-edge-length)}.cube-edge-face.right{right:0;top:var(--viewer-view-cube-edge-length);bottom:var(--viewer-view-cube-edge-length);width:var(--viewer-view-cube-edge-length)}.cube-corner-face{width:var(--viewer-view-cube-edge-length);height:var(--viewer-view-cube-edge-length)}.cube-corner-face.top-left{top:0;left:0}.cube-corner-face.top-right{top:0;right:0}.cube-corner-face.bottom-right{bottom:0;right:0}.cube-corner-face.bottom-left{bottom:0;left:0}.cube-shadow{backface-visibility:hidden;-webkit-backface-visibility:hidden}.cube-shadow-face{position:absolute;left:4px;right:4px;top:4px;bottom:4px;background-color:black;opacity:0.12;filter:blur(4px)}.cube-side-face,.cube-corner-face,.cube-edge-face{pointer-events:initial}.cube-corner .cube-corner-face,.cube-edge .cube-edge-face,.cube-side .cube-side-face::before{background:var(--viewer-view-cube-side-background-hover);opacity:0}.cube-corner:hover .cube-corner-face,.cube-edge:hover .cube-edge-face,.cube-side:hover .cube-side-face::before{opacity:var(--viewer-view-cube-side-background-hover-opacity)}.cube-corner.disabled,.cube-edge.disabled,.cube-side.disabled{pointer-events:none}`;const D=a(class t extends o{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.boxLength=80;this.triadPosition=n.origin();this.xPositiveLabel="Right";this.xNegativeLabel="Left";this.yPositiveLabel="Top";this.yNegativeLabel="Bottom";this.zPositiveLabel="Front";this.zNegativeLabel="Back";this.standardViewsOff=false;this.viewAll=true;this.animationDuration=500;this.triadOff=false;this.worldOrientation=f.DEFAULT;this.updateMatrices=()=>{var e;if(((e=this.viewer)===null||e===void 0?void 0:e.frame)!=null){const{camera:e}=this.viewer.frame.scene;const t=this.boxLength/2;this.triadPosition=n.create(-t-5,-t-5,-t-5);const i=3.125;const a=this.boxLength*i;const o=21.5;this.camera=new b(n.scale(a,n.negate(e.direction)),n.origin(),e.up,.1,100,1,o);this.worldOrientation=this.viewer.frame.scene.worldOrientation}}}handleViewerChanged(e,t){t===null||t===void 0?void 0:t.removeEventListener("frameDrawn",this.updateMatrices);e===null||e===void 0?void 0:e.addEventListener("frameDrawn",this.updateMatrices);this.updateMatrices()}handleStandardView(e){if(this.standardViewsOff){return async()=>undefined}else{return async()=>{if(this.viewer!=null){const t=await this.viewer.scene();const i=this.animationDuration>0?{animation:{milliseconds:this.animationDuration}}:{};const a=e.transformMatrix(this.worldOrientation.matrix);const o=t.boundingBox();if(!this.viewAll){t.camera().standardViewFixedLookAt(a).render(i)}else if((o===null||o===void 0?void 0:o.max)!=null&&n.isEqual(o.max,n.origin())&&n.isEqual(o.min,n.origin())){t.camera().standardView(a).render(i)}else{t.camera().standardView(a).viewAll().render(i)}}}}}componentWillLoad(){this.handleViewerChanged(this.viewer)}componentDidLoad(){if(this.rendererEl!=null){const e=new ResizeObserver((()=>this.handleRendererResized()));e.observe(this.rendererEl);this.handleRendererResized()}}handleRendererResized(){s((()=>{if(this.rendererEl!=null){const e=this.rendererEl.getBoundingClientRect();this.boxLength=Math.min(e.width,e.height)}}))}render(){return e(r,{key:"a3cea27b2376c4ffbe255168515b8c3f0e7ab5aa"},e("vertex-viewer-dom-renderer",{key:"7f1560abaf53c1dc5b8f43b9dade445917861656",ref:e=>this.rendererEl=e,class:"renderer",camera:this.camera},!this.triadOff&&e("vertex-viewer-dom-group",{key:"0671f7678ab3197709e98649d0ac36a1703614c6",class:"triad",position:this.triadPosition},e(p,{key:"b65eddeb99f9b93120246f8143886ac937afb57a",label:"X",length:this.boxLength,rotationAxis:n.origin()}),e(p,{key:"ba49dbda3e18e90e033453d06b509f31336fffe8",label:"Y",length:this.boxLength,rotationAxis:n.back()}),e(p,{key:"ff765198e6e11cc6b7b2d466766809b055c5ccdf",label:"Z",length:this.boxLength,rotationAxis:n.down()})),e("vertex-viewer-dom-group",{key:"0dd9aab195029c25a3090f35ee39c04ed45da8f8",class:"cube",matrix:this.worldOrientation.matrix},e(k,{key:"995e2af8e70518edcf949d5df72387463ff3cc0e",length:this.boxLength+10}),e(m,{key:"0864a044b3d79b9a483cd492b7a04a20fcf64f42",label:this.zPositiveLabel,length:this.boxLength,side:"front",onPointerDown:this.handleStandardView(l.FRONT),disabled:this.standardViewsOff}),e(m,{key:"8f9110528267a00b802f97a8543a896d9fc333f7",label:this.zNegativeLabel,length:this.boxLength,side:"back",onPointerDown:this.handleStandardView(l.BACK),disabled:this.standardViewsOff}),e(m,{key:"6848e1e273bc815ee40e0218cc15bdc80d1f2715",label:this.xNegativeLabel,length:this.boxLength,side:"left",onPointerDown:this.handleStandardView(l.LEFT),disabled:this.standardViewsOff}),e(m,{key:"825624a992f4d31d9faf7506c8e964392da041ab",label:this.xPositiveLabel,length:this.boxLength,side:"right",onPointerDown:this.handleStandardView(l.RIGHT),disabled:this.standardViewsOff}),e(m,{key:"f59f5693ce4f1b4a794f4665b3f920bf29c1f159",label:this.yPositiveLabel,length:this.boxLength,side:"top",onPointerDown:this.handleStandardView(l.TOP),disabled:this.standardViewsOff}),e(m,{key:"65b8c8a2f8cc5cbc7974ca0dc3e6c328e2ca0649",label:this.yNegativeLabel,length:this.boxLength,side:"bottom",onPointerDown:this.handleStandardView(l.BOTTOM),disabled:this.standardViewsOff}),e(y,{key:"0923dfc3696b2c76e69069156c0f57d6cd4f8285",length:this.boxLength,face1Side:"top",face1Edge:"bottom",face2Side:"front",face2Edge:"top",onPointerDown:this.handleStandardView(l.TOP_FRONT),disabled:this.standardViewsOff}),e(y,{key:"6bf8058fbb4e35b9a1ed8dc5ff772ed2d2995add",length:this.boxLength,face1Side:"front",face1Edge:"right",face2Side:"right",face2Edge:"left",onPointerDown:this.handleStandardView(l.FRONT_LEFT),disabled:this.standardViewsOff}),e(y,{key:"61f28c6cd18661c643ec1510305a8603efbd5cdb",length:this.boxLength,face1Side:"bottom",face1Edge:"top",face2Side:"front",face2Edge:"bottom",onPointerDown:this.handleStandardView(l.BOTTOM_FRONT),disabled:this.standardViewsOff}),e(y,{key:"6c62acdf92f6397ec3c381d10078215cf6a29ebb",length:this.boxLength,face1Side:"front",face1Edge:"left",face2Side:"left",face2Edge:"right",onPointerDown:this.handleStandardView(l.FRONT_RIGHT),disabled:this.standardViewsOff}),e(y,{key:"a94dc61cea93cae54e148c4f1ffc73a42717f986",length:this.boxLength,face1Side:"top",face1Edge:"right",face2Side:"right",face2Edge:"top",onPointerDown:this.handleStandardView(l.TOP_LEFT),disabled:this.standardViewsOff}),e(y,{key:"4a97659a3aad5b162252091401ec666727d204be",length:this.boxLength,face1Side:"back",face1Edge:"left",face2Side:"right",face2Edge:"right",onPointerDown:this.handleStandardView(l.BACK_LEFT),disabled:this.standardViewsOff}),e(y,{key:"422acd7e4689eb7ae0403726a29a3784637bdfd6",length:this.boxLength,face1Side:"bottom",face1Edge:"right",face2Side:"right",face2Edge:"bottom",onPointerDown:this.handleStandardView(l.BOTTOM_LEFT),disabled:this.standardViewsOff}),e(y,{key:"afa5fb1b78c1fcbb78a48f040d5c868a4dd338fc",length:this.boxLength,face1Side:"top",face1Edge:"top",face2Side:"back",face2Edge:"top",onPointerDown:this.handleStandardView(l.TOP_BACK),disabled:this.standardViewsOff}),e(y,{key:"e1aa294c3ed0a6e105929a7094cfbdeab26fe7c0",length:this.boxLength,face1Side:"back",face1Edge:"right",face2Side:"left",face2Edge:"left",onPointerDown:this.handleStandardView(l.BACK_RIGHT),disabled:this.standardViewsOff}),e(y,{key:"e3a83623df735d9987a279ef2e055d1f962cafbe",length:this.boxLength,face1Side:"bottom",face1Edge:"bottom",face2Side:"back",face2Edge:"bottom",onPointerDown:this.handleStandardView(l.BOTTOM_BACK),disabled:this.standardViewsOff}),e(y,{key:"ad1d8915f046ba5df73240489c2daf1703b6a310",length:this.boxLength,face1Side:"top",face1Edge:"left",face2Side:"left",face2Edge:"top",onPointerDown:this.handleStandardView(l.TOP_RIGHT),disabled:this.standardViewsOff}),e(y,{key:"f0b94c0f3517d1f54cf0c23f74fa681607da3532",length:this.boxLength,face1Side:"bottom",face1Edge:"left",face2Side:"left",face2Edge:"bottom",onPointerDown:this.handleStandardView(l.BOTTOM_RIGHT),disabled:this.standardViewsOff}),e(x,{key:"c814db371a4b47ba50084e69879845921eb6ba91",length:this.boxLength,face1Side:"top",face1Corner:"bottom-left",face2Side:"front",face2Corner:"top-left",face3Side:"left",face3Corner:"top-right",onPointerDown:this.handleStandardView(l.TOP_FRONT_RIGHT),disabled:this.standardViewsOff}),e(x,{key:"b0f81f620127d1533eeb675c66d74e1b3019cb3b",length:this.boxLength,face1Side:"top",face1Corner:"bottom-right",face2Side:"front",face2Corner:"top-right",face3Side:"right",face3Corner:"top-left",onPointerDown:this.handleStandardView(l.TOP_FRONT_LEFT),disabled:this.standardViewsOff}),e(x,{key:"254834f0214afa786b8997274e0dcbc4f1e5e31c",length:this.boxLength,face1Side:"bottom",face1Corner:"top-right",face2Side:"front",face2Corner:"bottom-right",face3Side:"right",face3Corner:"bottom-left",onPointerDown:this.handleStandardView(l.BOTTOM_FRONT_LEFT),disabled:this.standardViewsOff}),e(x,{key:"847425b3886582ddb596408fbfcd2fcd9e424641",length:this.boxLength,face1Side:"bottom",face1Corner:"top-left",face2Side:"front",face2Corner:"bottom-left",face3Side:"left",face3Corner:"bottom-right",onPointerDown:this.handleStandardView(l.BOTTOM_FRONT_RIGHT),disabled:this.standardViewsOff}),e(x,{key:"fe6eaffd1f06fe45a9fa3fb680d638f3623187aa",length:this.boxLength,face1Side:"top",face1Corner:"top-right",face2Side:"back",face2Corner:"top-left",face3Side:"right",face3Corner:"top-right",onPointerDown:this.handleStandardView(l.TOP_BACK_LEFT),disabled:this.standardViewsOff}),e(x,{key:"e4b8004047f4f1da2decc4b17d86297a67e38e9d",length:this.boxLength,face1Side:"top",face1Corner:"top-left",face2Side:"back",face2Corner:"top-right",face3Side:"left",face3Corner:"top-left",onPointerDown:this.handleStandardView(l.TOP_BACK_RIGHT),disabled:this.standardViewsOff}),e(x,{key:"c06a8465a3b39828bf114faaa0039c8e32196441",length:this.boxLength,face1Side:"bottom",face1Corner:"bottom-left",face2Side:"back",face2Corner:"bottom-right",face3Side:"left",face3Corner:"bottom-left",onPointerDown:this.handleStandardView(l.BOTTOM_BACK_RIGHT),disabled:this.standardViewsOff}),e(x,{key:"2ea208573579fd18a3b7fde9f0bbc3a5834e2652",length:this.boxLength,face1Side:"bottom",face1Corner:"bottom-right",face2Side:"back",face2Corner:"bottom-left",face3Side:"right",face3Corner:"bottom-right",onPointerDown:this.handleStandardView(l.BOTTOM_BACK_LEFT),disabled:this.standardViewsOff}))))}static get watchers(){return{viewer:[{handleViewerChanged:0}]}}static get style(){return S()}},[1,"vertex-viewer-view-cube",{xPositiveLabel:[1,"x-positive-label"],xNegativeLabel:[1,"x-negative-label"],yPositiveLabel:[1,"y-positive-label"],yNegativeLabel:[1,"y-negative-label"],zPositiveLabel:[1,"z-positive-label"],zNegativeLabel:[1,"z-negative-label"],standardViewsOff:[4,"standard-views-off"],viewAll:[4,"view-all"],animationDuration:[2,"animation-duration"],triadOff:[4,"triad-off"],worldOrientation:[1040],camera:[1040],viewer:[16],boxLength:[32],triadPosition:[32]},undefined,{viewer:[{handleViewerChanged:0}]}]);function P(){if(typeof customElements==="undefined"){return}const e=["vertex-viewer-view-cube","vertex-viewer-dom-element","vertex-viewer-dom-group","vertex-viewer-dom-renderer"];e.forEach((e=>{switch(e){case"vertex-viewer-view-cube":if(!customElements.get(i(e))){customElements.define(i(e),D)}break;case"vertex-viewer-dom-element":if(!customElements.get(i(e))){v()}break;case"vertex-viewer-dom-group":if(!customElements.get(i(e))){g()}break;case"vertex-viewer-dom-renderer":if(!customElements.get(i(e))){u()}break}}))}P();const C=D;const E=P;export{C as VertexViewerViewCube,E as defineCustomElement};
|
|
4
|
+
import{h as e,F as t,t as i,p as a,H as o,e as r}from"./p-Bb32XUUS.js";import{q as c,v as n,h as d}from"./p-2UsvOTHJ.js";import{r as s}from"./p-Cd7kap5W.js";import{O as f,g as b,S as l}from"./p-BjvjKoy7.js";import{c as h}from"./p-C6gMOKYg.js";import{d as v}from"./p-BHyxBmg6.js";import{d as g}from"./p-rDr0x5Z7.js";import{d as u}from"./p-Bx42CNGV.js";const w={front:{direction:n.back(),quaternion:c.create()},back:{direction:n.forward(),quaternion:c.fromAxisAngle(n.up(),Math.PI)},left:{direction:n.left(),quaternion:c.fromAxisAngle(n.down(),Math.PI/2)},right:{direction:n.right(),quaternion:c.fromAxisAngle(n.up(),Math.PI/2)},top:{direction:n.up(),quaternion:c.fromAxisAngle(n.right(),-Math.PI/2)},bottom:{direction:n.down(),quaternion:c.fromAxisAngle(n.left(),-Math.PI/2)}};const p=({label:i,length:a,rotationAxis:o})=>{const r={width:`${a+5}px`};const s=c.fromAxisAngle(o,Math.PI/2);const f=n.scale(a+15,n.right());return e(t,null,e("vertex-viewer-dom-group",{quaternion:s},e("vertex-viewer-dom-element",{style:r,billboardOff:true,interactionsOff:true},e("div",{class:`triad-axis triad-axis-${i.toLowerCase()}`})),e("vertex-viewer-dom-element",{rotation:d.create({x:Math.PI/2,y:0,z:0}),style:r,billboardOff:true,interactionsOff:true},e("div",{class:`triad-axis triad-axis-${i.toLowerCase()}`})),e("vertex-viewer-dom-element",{position:f,interactionsOff:true},e("div",{class:`triad-label triad-label-${i.toLowerCase()}`},i))))};const m=({label:t,length:i,side:a,disabled:o,onPointerDown:r})=>{const{direction:c,quaternion:d}=w[a];const s=n.scale(i/2-.1,c);return e("vertex-viewer-dom-element",{class:h("cube-side",{disabled:o}),position:s,quaternion:d,style:{width:`${i}px`,height:`${i}px`},onPointerDown:r,billboardOff:true},e("div",{class:`cube-side-face cube-side-face-${t.toLowerCase()}`},t))};const x=({length:t,face1Side:i,face1Corner:a,face2Side:o,face2Corner:r,face3Side:c,face3Corner:d,disabled:s,onPointerDown:f})=>{const{direction:b,quaternion:l}=w[i];const{direction:v,quaternion:g}=w[o];const{direction:u,quaternion:p}=w[c];const m=n.scale(t/2,b);const x=n.scale(t/2,v);const y=n.scale(t/2,u);const k={width:`${t}px`,height:`${t}px`};return e("vertex-viewer-dom-group",{class:h("cube-corner",{disabled:s}),onPointerDown:f},e("vertex-viewer-dom-element",{position:m,quaternion:l,style:k,billboardOff:true},e("div",{class:`cube-corner-face ${a}`})),e("vertex-viewer-dom-element",{position:x,quaternion:g,style:k,billboardOff:true},e("div",{class:`cube-corner-face ${r}`})),e("vertex-viewer-dom-element",{position:y,quaternion:p,style:k,billboardOff:true},e("div",{class:`cube-corner-face ${d}`})))};const y=({length:t,face1Side:i,face2Side:a,face1Edge:o,face2Edge:r,disabled:c,onPointerDown:d})=>{const{direction:s,quaternion:f}=w[i];const{direction:b,quaternion:l}=w[a];const v=n.scale(t/2,s);const g=n.scale(t/2,b);const u={width:`${t}px`,height:`${t}px`};return e("vertex-viewer-dom-group",{class:h("cube-edge",{disabled:c}),onPointerDown:d},e("vertex-viewer-dom-element",{position:v,quaternion:f,style:u,billboardOff:true},e("div",{class:`cube-edge-face ${o}`})),e("vertex-viewer-dom-element",{position:g,quaternion:l,style:u,billboardOff:true},e("div",{class:`cube-edge-face ${r}`})))};const k=({length:t})=>{const{direction:i,quaternion:a}=w.top;const o=n.scale(-t/2,i);return e("vertex-viewer-dom-element",{class:"cube-shadow",position:o,quaternion:a,style:{width:`${t}px`,height:`${t}px`},billboardOff:true,interactionsOff:true},e("div",{class:"cube-shadow-face"}))};const S=()=>`:host{--viewer-view-cube-side-background:var(--white);--viewer-view-cube-side-background-hover:var(--blue-500);--viewer-view-cube-side-background-hover-opacity:0.25;--viewer-view-cube-side-border:1.5px solid var(--neutral-500);--viewer-view-cube-edge-length:12px;--viewer-view-cube-opacity:0.8;--viewer-view-cube-triad-x-axis-color:var(--x-axis-color);--viewer-view-cube-triad-y-axis-color:var(--y-axis-color);--viewer-view-cube-triad-z-axis-color:var(--z-axis-color);color:var(--neutral-700);width:80px;height:80px;margin:20px;position:relative;display:flex;align-items:center;justify-content:center;user-select:none}.renderer{position:unset;width:100%;height:100%;overflow:visible !important}.reference-point{width:5px;height:5px;border-radius:50%;background-color:black}.triad{pointer-events:none}.triad-axis{width:100%;height:1.5px;outline:1px solid transparent;transform:translateX(50%)}.triad-axis-x{background-color:#ea3324}.triad-axis-y{background-color:#4faf32}.triad-axis-z{background-color:#0000ff}.triad-label{font-family:Arial, Helvetica, sans-serif;font-size:0.6875rem}.triad-label-x{color:var(--viewer-view-cube-triad-x-axis-color)}.triad-label-y{color:var(--viewer-view-cube-triad-y-axis-color)}.triad-label-z{color:var(--viewer-view-cube-triad-z-axis-color)}.cube{pointer-events:initial}.cube:hover .cube-side-face{opacity:1}.cube-side{backface-visibility:hidden;-webkit-backface-visibility:hidden}.cube-side-face{box-sizing:border-box;font-size:0.875rem;text-transform:uppercase;width:100%;height:100%;background-color:var(--viewer-view-cube-side-background);border:var(--viewer-view-cube-side-border);display:flex;align-items:center;justify-content:center;outline:1px solid transparent;opacity:var(--viewer-view-cube-opacity);transition:opacity 0.2s ease-in-out}.cube-side-face::before{content:'';position:absolute;left:calc(var(--viewer-view-cube-edge-length) - 4px);right:calc(var(--viewer-view-cube-edge-length) - 4px);top:calc(var(--viewer-view-cube-edge-length) - 4px);bottom:calc(var(--viewer-view-cube-edge-length) - 4px)}.cube-corner,.cube-edge{position:relative}.cube-corner-face,.cube-edge-face{position:absolute;backface-visibility:hidden;-webkit-backface-visibility:hidden}.cube-edge-face.top{top:0;left:var(--viewer-view-cube-edge-length);right:var(--viewer-view-cube-edge-length);height:var(--viewer-view-cube-edge-length)}.cube-edge-face.bottom{bottom:0;left:var(--viewer-view-cube-edge-length);right:var(--viewer-view-cube-edge-length);height:var(--viewer-view-cube-edge-length)}.cube-edge-face.left{left:0;top:var(--viewer-view-cube-edge-length);bottom:var(--viewer-view-cube-edge-length);width:var(--viewer-view-cube-edge-length)}.cube-edge-face.right{right:0;top:var(--viewer-view-cube-edge-length);bottom:var(--viewer-view-cube-edge-length);width:var(--viewer-view-cube-edge-length)}.cube-corner-face{width:var(--viewer-view-cube-edge-length);height:var(--viewer-view-cube-edge-length)}.cube-corner-face.top-left{top:0;left:0}.cube-corner-face.top-right{top:0;right:0}.cube-corner-face.bottom-right{bottom:0;right:0}.cube-corner-face.bottom-left{bottom:0;left:0}.cube-shadow{backface-visibility:hidden;-webkit-backface-visibility:hidden}.cube-shadow-face{position:absolute;left:4px;right:4px;top:4px;bottom:4px;background-color:black;opacity:0.12;filter:blur(4px)}.cube-side-face,.cube-corner-face,.cube-edge-face{pointer-events:initial}.cube-corner .cube-corner-face,.cube-edge .cube-edge-face,.cube-side .cube-side-face::before{background:var(--viewer-view-cube-side-background-hover);opacity:0}.cube-corner:hover .cube-corner-face,.cube-edge:hover .cube-edge-face,.cube-side:hover .cube-side-face::before{opacity:var(--viewer-view-cube-side-background-hover-opacity)}.cube-corner.disabled,.cube-edge.disabled,.cube-side.disabled{pointer-events:none}`;const D=a(class t extends o{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.boxLength=80;this.triadPosition=n.origin();this.xPositiveLabel="Right";this.xNegativeLabel="Left";this.yPositiveLabel="Top";this.yNegativeLabel="Bottom";this.zPositiveLabel="Front";this.zNegativeLabel="Back";this.standardViewsOff=false;this.viewAll=true;this.animationDuration=500;this.triadOff=false;this.worldOrientation=f.DEFAULT;this.updateMatrices=()=>{var e;if(((e=this.viewer)===null||e===void 0?void 0:e.frame)!=null){const{camera:e}=this.viewer.frame.scene;const t=this.boxLength/2;this.triadPosition=n.create(-t-5,-t-5,-t-5);const i=3.125;const a=this.boxLength*i;const o=21.5;this.camera=new b(n.scale(a,n.negate(e.direction)),n.origin(),e.up,.1,100,1,o);this.worldOrientation=this.viewer.frame.scene.worldOrientation}}}handleViewerChanged(e,t){t===null||t===void 0?void 0:t.removeEventListener("frameDrawn",this.updateMatrices);e===null||e===void 0?void 0:e.addEventListener("frameDrawn",this.updateMatrices);this.updateMatrices()}handleStandardView(e){if(this.standardViewsOff){return async()=>undefined}else{return async()=>{if(this.viewer!=null){const t=await this.viewer.scene();const i=this.animationDuration>0?{animation:{milliseconds:this.animationDuration}}:{};const a=e.transformMatrix(this.worldOrientation.matrix);const o=t.boundingBox();if(!this.viewAll){t.camera().standardViewFixedLookAt(a).render(i)}else if((o===null||o===void 0?void 0:o.max)!=null&&n.isEqual(o.max,n.origin())&&n.isEqual(o.min,n.origin())){t.camera().standardView(a).render(i)}else{t.camera().standardView(a).viewAll().render(i)}}}}}componentWillLoad(){this.handleViewerChanged(this.viewer)}componentDidLoad(){if(this.rendererEl!=null){const e=new ResizeObserver((()=>this.handleRendererResized()));e.observe(this.rendererEl);this.handleRendererResized()}}handleRendererResized(){s((()=>{if(this.rendererEl!=null){const e=this.rendererEl.getBoundingClientRect();this.boxLength=Math.min(e.width,e.height)}}))}render(){return e(r,{key:"a3cea27b2376c4ffbe255168515b8c3f0e7ab5aa"},e("vertex-viewer-dom-renderer",{key:"7f1560abaf53c1dc5b8f43b9dade445917861656",ref:e=>this.rendererEl=e,class:"renderer",camera:this.camera},!this.triadOff&&e("vertex-viewer-dom-group",{key:"0671f7678ab3197709e98649d0ac36a1703614c6",class:"triad",position:this.triadPosition},e(p,{key:"b65eddeb99f9b93120246f8143886ac937afb57a",label:"X",length:this.boxLength,rotationAxis:n.origin()}),e(p,{key:"ba49dbda3e18e90e033453d06b509f31336fffe8",label:"Y",length:this.boxLength,rotationAxis:n.back()}),e(p,{key:"ff765198e6e11cc6b7b2d466766809b055c5ccdf",label:"Z",length:this.boxLength,rotationAxis:n.down()})),e("vertex-viewer-dom-group",{key:"0dd9aab195029c25a3090f35ee39c04ed45da8f8",class:"cube",matrix:this.worldOrientation.matrix},e(k,{key:"995e2af8e70518edcf949d5df72387463ff3cc0e",length:this.boxLength+10}),e(m,{key:"0864a044b3d79b9a483cd492b7a04a20fcf64f42",label:this.zPositiveLabel,length:this.boxLength,side:"front",onPointerDown:this.handleStandardView(l.FRONT),disabled:this.standardViewsOff}),e(m,{key:"8f9110528267a00b802f97a8543a896d9fc333f7",label:this.zNegativeLabel,length:this.boxLength,side:"back",onPointerDown:this.handleStandardView(l.BACK),disabled:this.standardViewsOff}),e(m,{key:"6848e1e273bc815ee40e0218cc15bdc80d1f2715",label:this.xNegativeLabel,length:this.boxLength,side:"left",onPointerDown:this.handleStandardView(l.LEFT),disabled:this.standardViewsOff}),e(m,{key:"825624a992f4d31d9faf7506c8e964392da041ab",label:this.xPositiveLabel,length:this.boxLength,side:"right",onPointerDown:this.handleStandardView(l.RIGHT),disabled:this.standardViewsOff}),e(m,{key:"f59f5693ce4f1b4a794f4665b3f920bf29c1f159",label:this.yPositiveLabel,length:this.boxLength,side:"top",onPointerDown:this.handleStandardView(l.TOP),disabled:this.standardViewsOff}),e(m,{key:"65b8c8a2f8cc5cbc7974ca0dc3e6c328e2ca0649",label:this.yNegativeLabel,length:this.boxLength,side:"bottom",onPointerDown:this.handleStandardView(l.BOTTOM),disabled:this.standardViewsOff}),e(y,{key:"0923dfc3696b2c76e69069156c0f57d6cd4f8285",length:this.boxLength,face1Side:"top",face1Edge:"bottom",face2Side:"front",face2Edge:"top",onPointerDown:this.handleStandardView(l.TOP_FRONT),disabled:this.standardViewsOff}),e(y,{key:"6bf8058fbb4e35b9a1ed8dc5ff772ed2d2995add",length:this.boxLength,face1Side:"front",face1Edge:"right",face2Side:"right",face2Edge:"left",onPointerDown:this.handleStandardView(l.FRONT_LEFT),disabled:this.standardViewsOff}),e(y,{key:"61f28c6cd18661c643ec1510305a8603efbd5cdb",length:this.boxLength,face1Side:"bottom",face1Edge:"top",face2Side:"front",face2Edge:"bottom",onPointerDown:this.handleStandardView(l.BOTTOM_FRONT),disabled:this.standardViewsOff}),e(y,{key:"6c62acdf92f6397ec3c381d10078215cf6a29ebb",length:this.boxLength,face1Side:"front",face1Edge:"left",face2Side:"left",face2Edge:"right",onPointerDown:this.handleStandardView(l.FRONT_RIGHT),disabled:this.standardViewsOff}),e(y,{key:"a94dc61cea93cae54e148c4f1ffc73a42717f986",length:this.boxLength,face1Side:"top",face1Edge:"right",face2Side:"right",face2Edge:"top",onPointerDown:this.handleStandardView(l.TOP_LEFT),disabled:this.standardViewsOff}),e(y,{key:"4a97659a3aad5b162252091401ec666727d204be",length:this.boxLength,face1Side:"back",face1Edge:"left",face2Side:"right",face2Edge:"right",onPointerDown:this.handleStandardView(l.BACK_LEFT),disabled:this.standardViewsOff}),e(y,{key:"422acd7e4689eb7ae0403726a29a3784637bdfd6",length:this.boxLength,face1Side:"bottom",face1Edge:"right",face2Side:"right",face2Edge:"bottom",onPointerDown:this.handleStandardView(l.BOTTOM_LEFT),disabled:this.standardViewsOff}),e(y,{key:"afa5fb1b78c1fcbb78a48f040d5c868a4dd338fc",length:this.boxLength,face1Side:"top",face1Edge:"top",face2Side:"back",face2Edge:"top",onPointerDown:this.handleStandardView(l.TOP_BACK),disabled:this.standardViewsOff}),e(y,{key:"e1aa294c3ed0a6e105929a7094cfbdeab26fe7c0",length:this.boxLength,face1Side:"back",face1Edge:"right",face2Side:"left",face2Edge:"left",onPointerDown:this.handleStandardView(l.BACK_RIGHT),disabled:this.standardViewsOff}),e(y,{key:"e3a83623df735d9987a279ef2e055d1f962cafbe",length:this.boxLength,face1Side:"bottom",face1Edge:"bottom",face2Side:"back",face2Edge:"bottom",onPointerDown:this.handleStandardView(l.BOTTOM_BACK),disabled:this.standardViewsOff}),e(y,{key:"ad1d8915f046ba5df73240489c2daf1703b6a310",length:this.boxLength,face1Side:"top",face1Edge:"left",face2Side:"left",face2Edge:"top",onPointerDown:this.handleStandardView(l.TOP_RIGHT),disabled:this.standardViewsOff}),e(y,{key:"f0b94c0f3517d1f54cf0c23f74fa681607da3532",length:this.boxLength,face1Side:"bottom",face1Edge:"left",face2Side:"left",face2Edge:"bottom",onPointerDown:this.handleStandardView(l.BOTTOM_RIGHT),disabled:this.standardViewsOff}),e(x,{key:"c814db371a4b47ba50084e69879845921eb6ba91",length:this.boxLength,face1Side:"top",face1Corner:"bottom-left",face2Side:"front",face2Corner:"top-left",face3Side:"left",face3Corner:"top-right",onPointerDown:this.handleStandardView(l.TOP_FRONT_RIGHT),disabled:this.standardViewsOff}),e(x,{key:"b0f81f620127d1533eeb675c66d74e1b3019cb3b",length:this.boxLength,face1Side:"top",face1Corner:"bottom-right",face2Side:"front",face2Corner:"top-right",face3Side:"right",face3Corner:"top-left",onPointerDown:this.handleStandardView(l.TOP_FRONT_LEFT),disabled:this.standardViewsOff}),e(x,{key:"254834f0214afa786b8997274e0dcbc4f1e5e31c",length:this.boxLength,face1Side:"bottom",face1Corner:"top-right",face2Side:"front",face2Corner:"bottom-right",face3Side:"right",face3Corner:"bottom-left",onPointerDown:this.handleStandardView(l.BOTTOM_FRONT_LEFT),disabled:this.standardViewsOff}),e(x,{key:"847425b3886582ddb596408fbfcd2fcd9e424641",length:this.boxLength,face1Side:"bottom",face1Corner:"top-left",face2Side:"front",face2Corner:"bottom-left",face3Side:"left",face3Corner:"bottom-right",onPointerDown:this.handleStandardView(l.BOTTOM_FRONT_RIGHT),disabled:this.standardViewsOff}),e(x,{key:"fe6eaffd1f06fe45a9fa3fb680d638f3623187aa",length:this.boxLength,face1Side:"top",face1Corner:"top-right",face2Side:"back",face2Corner:"top-left",face3Side:"right",face3Corner:"top-right",onPointerDown:this.handleStandardView(l.TOP_BACK_LEFT),disabled:this.standardViewsOff}),e(x,{key:"e4b8004047f4f1da2decc4b17d86297a67e38e9d",length:this.boxLength,face1Side:"top",face1Corner:"top-left",face2Side:"back",face2Corner:"top-right",face3Side:"left",face3Corner:"top-left",onPointerDown:this.handleStandardView(l.TOP_BACK_RIGHT),disabled:this.standardViewsOff}),e(x,{key:"c06a8465a3b39828bf114faaa0039c8e32196441",length:this.boxLength,face1Side:"bottom",face1Corner:"bottom-left",face2Side:"back",face2Corner:"bottom-right",face3Side:"left",face3Corner:"bottom-left",onPointerDown:this.handleStandardView(l.BOTTOM_BACK_RIGHT),disabled:this.standardViewsOff}),e(x,{key:"2ea208573579fd18a3b7fde9f0bbc3a5834e2652",length:this.boxLength,face1Side:"bottom",face1Corner:"bottom-right",face2Side:"back",face2Corner:"bottom-left",face3Side:"right",face3Corner:"bottom-right",onPointerDown:this.handleStandardView(l.BOTTOM_BACK_LEFT),disabled:this.standardViewsOff}))))}static get watchers(){return{viewer:[{handleViewerChanged:0}]}}static get style(){return S()}},[1,"vertex-viewer-view-cube",{xPositiveLabel:[1,"x-positive-label"],xNegativeLabel:[1,"x-negative-label"],yPositiveLabel:[1,"y-positive-label"],yNegativeLabel:[1,"y-negative-label"],zPositiveLabel:[1,"z-positive-label"],zNegativeLabel:[1,"z-negative-label"],standardViewsOff:[4,"standard-views-off"],viewAll:[4,"view-all"],animationDuration:[2,"animation-duration"],triadOff:[4,"triad-off"],worldOrientation:[1040],camera:[1040],viewer:[16],boxLength:[32],triadPosition:[32]},undefined,{viewer:[{handleViewerChanged:0}]}]);function P(){if(typeof customElements==="undefined"){return}const e=["vertex-viewer-view-cube","vertex-viewer-dom-element","vertex-viewer-dom-group","vertex-viewer-dom-renderer"];e.forEach((e=>{switch(e){case"vertex-viewer-view-cube":if(!customElements.get(i(e))){customElements.define(i(e),D)}break;case"vertex-viewer-dom-element":if(!customElements.get(i(e))){v()}break;case"vertex-viewer-dom-group":if(!customElements.get(i(e))){g()}break;case"vertex-viewer-dom-renderer":if(!customElements.get(i(e))){u()}break}}))}P();const C=D;const E=P;export{C as VertexViewerViewCube,E as defineCustomElement};
|
|
5
5
|
//# sourceMappingURL=vertex-viewer-view-cube.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{t,p as i,H as e,d as s,h,e as o}from"./p-Bb32XUUS.js";import{a as n,d as l,W as d,b as a}from"./p-
|
|
4
|
+
import{t,p as i,H as e,d as s,h,e as o}from"./p-Bb32XUUS.js";import{a as n,d as l,W as d,b as a}from"./p-UrT4ZJv3.js";import{v as r}from"./p-2UsvOTHJ.js";function v(t){return t instanceof Element}class c{constructor(t){this.model=t;this.pressed={};this.handleKeyUp=async t=>{const i=t.key.toLocaleLowerCase();this.pressed=Object.keys(this.pressed).filter((t=>t!==i)).reduce(((t,i)=>({...t,[i]:true})),{});if(Object.keys(this.pressed).length===0&&this.interval!=null){this.endInteraction()}};this.endInteraction=async()=>{var t;this.clearInterval();await((t=this.api)===null||t===void 0?void 0:t.endInteraction())};this.handleKeyDown=this.handleKeyDown.bind(this);this.handleKeyUp=this.handleKeyUp.bind(this);this.handleEnabledChange=this.handleEnabledChange.bind(this);this.restartInteraction=this.restartInteraction.bind(this);this.updateCamera=this.updateCamera.bind(this);this.handlers={[n.MOVE_DOWN]:this.moveDown.bind(this),[n.MOVE_UP]:this.moveUp.bind(this),[n.PIVOT_DOWN]:this.pivotDown.bind(this),[n.PIVOT_LEFT]:this.pivotLeft.bind(this),[n.PIVOT_RIGHT]:this.pivotRight.bind(this),[n.PIVOT_UP]:this.pivotUp.bind(this),[n.WALK_BACKWARD]:this.walkBackward.bind(this),[n.WALK_FORWARD]:this.walkForward.bind(this),[n.WALK_LEFT]:this.walkLeft.bind(this),[n.WALK_RIGHT]:this.walkRight.bind(this)};this.enabledChangeDisposable=this.model.onEnabledChange(this.handleEnabledChange);this.keyBindingsChangeDisposable=this.model.onKeyBindingsChange(this.restartInteraction);this.configurationChangeDisposable=this.model.onConfigurationChange(this.restartInteraction)}dispose(){var t,i,e;this.disable();(t=this.enabledChangeDisposable)===null||t===void 0?void 0:t.dispose();(i=this.keyBindingsChangeDisposable)===null||i===void 0?void 0:i.dispose();(e=this.configurationChangeDisposable)===null||e===void 0?void 0:e.dispose();window.removeEventListener("keydown",this.handleKeyDown);window.removeEventListener("keyup",this.handleKeyUp)}initialize(t,i){this.api=i;this.handleEnabledChange(this.model.getEnabled())}enable(){this.disable();window.addEventListener("keydown",this.handleKeyDown);window.addEventListener("keyup",this.handleKeyUp)}disable(){window.removeEventListener("keydown",this.handleKeyDown);window.removeEventListener("keyup",this.handleKeyUp)}handleKeyDown(t){const i=t.key.toLowerCase();const e=v(t.target)&&this.model.isElementExcluded(t.target);if(!t.repeat&&!e){this.pressed={...this.pressed,[i]:true};this.tryBeginInteraction()}}handleEnabledChange(t){if(t){this.enable()}else{this.disable()}}restartInteraction(){this.clearInterval();this.tryBeginInteraction()}tryBeginInteraction(){if(Object.keys(this.pressed).length>0&&this.someOperationMatches()){this.beginInteraction()}}beginInteraction(){var t,i;if(!((t=this.api)===null||t===void 0?void 0:t.isInteracting())){(i=this.api)===null||i===void 0?void 0:i.beginInteraction()}if(this.interval==null){this.interval=setInterval(this.updateCamera,this.model.getKeyboardRepeatInterval())}}clearInterval(){if(this.interval!=null){clearInterval(this.interval);this.interval=undefined}}updateCamera(){Object.keys(this.handlers).forEach((t=>{const i=t;if(this.model.operationMatches(i,this.pressed)){this.handlers[i]()}}))}someOperationMatches(){return Object.keys(this.handlers).some((t=>this.model.operationMatches(t,this.pressed)))}pivotLeft(){var t;(t=this.api)===null||t===void 0?void 0:t.pivotCamera(0,this.model.getKeyboardPivotDegrees())}pivotRight(){var t;(t=this.api)===null||t===void 0?void 0:t.pivotCamera(0,-this.model.getKeyboardPivotDegrees())}pivotUp(){var t;(t=this.api)===null||t===void 0?void 0:t.pivotCamera(-this.model.getKeyboardPivotDegrees(),0)}pivotDown(){var t;(t=this.api)===null||t===void 0?void 0:t.pivotCamera(this.model.getKeyboardPivotDegrees(),0)}walkForward(){var t;(t=this.api)===null||t===void 0?void 0:t.walk(r.scale(this.relativeWalkSpeed(),r.forward()))}walkBackward(){var t;(t=this.api)===null||t===void 0?void 0:t.walk(r.scale(this.relativeWalkSpeed(),r.back()))}walkLeft(){var t;(t=this.api)===null||t===void 0?void 0:t.walk(r.scale(this.relativeWalkSpeed(),r.left()))}walkRight(){var t;(t=this.api)===null||t===void 0?void 0:t.walk(r.scale(this.relativeWalkSpeed(),r.right()))}moveUp(){var t;(t=this.api)===null||t===void 0?void 0:t.walk(r.scale(this.relativeWalkSpeed(),r.down()))}moveDown(){var t;(t=this.api)===null||t===void 0?void 0:t.walk(r.scale(this.relativeWalkSpeed(),r.up()))}relativeWalkSpeed(){return this.model.getKeyboardWalkSpeed()/500}}const u=()=>`:host{position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none}`;const w=i(class t extends e{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow();this.controllerChanged=s(this,"controllerChanged");this.model=new d;this.enabled=true;this.stateMap={}}componentWillLoad(){this.setupController();this.setupInteractionHandler()}async componentDidLoad(){await this.ensureTeleportToolConfigured();this.updateTeleportTool();await this.setPivotInteractionMode()}connectedCallback(){this.setupInteractionHandler();this.setPivotInteractionMode()}disconnectedCallback(){this.clearInteractionHandler();this.resetInteractionMode()}handleEnabledChanged(){var t;(t=this.controller)===null||t===void 0?void 0:t.setEnabled(this.enabled);this.toggleInteractionMode()}handleViewerChanged(){this.clearInteractionHandler();this.setupInteractionHandler();this.updateTeleportTool();this.toggleInteractionMode()}handleTeleportModeChanged(){this.updateTeleportTool()}handleControllerChanged(){this.updateTeleportTool();this.controllerChanged.emit(this.controller)}handleModelChanged(){this.setupController();this.clearInteractionHandler();this.setupInteractionHandler()}render(){return h(o,{key:"b5a66d1f87a5d1eed77092c0dc1ff295587b3d01"},h("slot",{key:"91809a5501b34953821955c791bc0a497765209f",name:"teleport-tool",onSlotchange:async()=>{await this.ensureTeleportToolConfigured();this.updateTeleportTool()}}))}setupController(){if(this.controller==null){this.controller=new a(this.model);this.controllerChanged.emit(this.controller)}else{this.controller.updateModel(this.model)}}clearInteractionHandler(){var t,i;(t=this.interactionHandlerDisposable)===null||t===void 0?void 0:t.dispose();this.interactionHandlerDisposable=undefined;(i=this.interactionHandler)===null||i===void 0?void 0:i.dispose();this.interactionHandler=undefined}async setupInteractionHandler(){var t;if(this.interactionHandler==null){this.interactionHandler=new c(this.model);this.interactionHandlerDisposable=await((t=this.viewer)===null||t===void 0?void 0:t.registerInteractionHandler(this.interactionHandler))}}async ensureTeleportToolConfigured(){var t,i,e;if(this.hostEl!=null){const s=(i=(t=this.hostEl)===null||t===void 0?void 0:t.querySelector('vertex-viewer-teleport-tool[slot="teleport-tool"]'))!==null&&i!==void 0?i:undefined;const h=(s===null||s===void 0?void 0:s.tagName)==="VERTEX-VIEWER-TELEPORT-TOOL"?s:undefined;if(h!=null){this.stateMap.teleportTool=h}else{this.stateMap.teleportTool=document.createElement("vertex-viewer-teleport-tool");this.stateMap.teleportTool.slot="teleport-tool";(e=this.hostEl)===null||e===void 0?void 0:e.appendChild(this.stateMap.teleportTool)}}}updateTeleportTool(){if(this.stateMap.teleportTool!=null){this.stateMap.teleportTool.viewer=this.viewer;this.stateMap.teleportTool.controller=this.controller;this.stateMap.teleportTool.model=this.model;this.stateMap.teleportTool.mode=this.teleportMode}}toggleInteractionMode(){if(this.enabled){this.setPivotInteractionMode()}else{this.resetInteractionMode()}}async setPivotInteractionMode(){var t;const i=await((t=this.viewer)===null||t===void 0?void 0:t.getBaseInteractionHandler());if(this.enabled&&i!=null){const t=i.getPrimaryInteractionType();this.stateMap.previousPrimaryInteractionType=t==="pivot"?this.stateMap.previousPrimaryInteractionType:t;i.setPrimaryInteractionType("pivot")}}async resetInteractionMode(){var t;const i=await((t=this.viewer)===null||t===void 0?void 0:t.getBaseInteractionHandler());if(i!=null&&i.getPrimaryInteractionType()==="pivot"&&this.stateMap.previousPrimaryInteractionType!=null){i.setPrimaryInteractionType(this.stateMap.previousPrimaryInteractionType);this.stateMap.previousPrimaryInteractionType=undefined}}get hostEl(){return this}static get watchers(){return{enabled:[{handleEnabledChanged:0}],viewer:[{handleViewerChanged:0}],teleportMode:[{handleTeleportModeChanged:0}],controller:[{handleControllerChanged:0}],model:[{handleModelChanged:0}]}}static get style(){return u()}},[257,"vertex-viewer-walk-mode-tool",{viewer:[16],controller:[1040],model:[1040],teleportMode:[1,"teleport-mode"],enabled:[4]},undefined,{enabled:[{handleEnabledChanged:0}],viewer:[{handleViewerChanged:0}],teleportMode:[{handleTeleportModeChanged:0}],controller:[{handleControllerChanged:0}],model:[{handleModelChanged:0}]}]);function p(){if(typeof customElements==="undefined"){return}const i=["vertex-viewer-walk-mode-tool","vertex-viewer-teleport-tool"];i.forEach((i=>{switch(i){case"vertex-viewer-walk-mode-tool":if(!customElements.get(t(i))){customElements.define(t(i),w)}break;case"vertex-viewer-teleport-tool":if(!customElements.get(t(i))){l()}break}}))}p();const f=w;const m=p;export{f as VertexViewerWalkModeTool,m as defineCustomElement};
|
|
5
5
|
//# sourceMappingURL=vertex-viewer-walk-mode-tool.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{t,p as i,H as s,d as n,h as e,e as o}from"./p-Bb32XUUS.js";import{p as a,v as r,a as h,b as c,r as l,c as d,d as u,e as f}from"./p-CZZALKHT.js";import{s as p}from"./p-B2_E6tqs.js";import{t as m,p as v,S as w,a as g,c as y,W as b}from"./p-5kcpg4MZ.js";import{m as C,E as S,a as I,c as P,d as T,o as k,u as A,b as D}from"./p-CDM7zNn0.js";import{c as E}from"./p-C6gMOKYg.js";import{u as x,I as M,p as R,C as B,W as L,S as z,V as H,M as K,a as O,b as $}from"./p--8q6LyIm.js";import{p as j}from"./p-DRGCkSEK.js";import{s as V,r as F}from"./p-FRKLa468.js";import{r as N,a as W,c as q}from"./p-CioaIHsi.js";import{i as U,j as _,k as J,l as X,m as Z,n as G,o as Q,p as Y,q as tt,E as it,u as st,t as nt,r as et,s as ot,v as at,w as rt,x as ht,y as ct,z as lt,B as dt,C as ut,G as ft,H as pt,I as mt,J as vt,K as wt,L as gt,M as yt,N as bt,P as Ct,Q as St}from"./p-DjrtwKcK.js";import{t as It,m as Pt,n as Tt,j as kt,M as At,k as Dt,S as Et}from"./p-DH341c7b.js";import{p as xt}from"./p-CZgX-9yo.js";import{C as Mt}from"./p-DxMDDbmh.js";import{g as Rt,c as Bt}from"./p-BqeEZXPn.js";import{V as Lt}from"./p-EG7pMA2M.js";import{B as zt,M as Ht}from"./p-QhlhRt6X.js";import{w as Kt}from"./p-Cd7kap5W.js";const Ot=0;const $t=255;class jt{constructor(t){this.viewer=t;this.handleInteractionStarted=()=>{this.invalidateStencilBuffer();this.pendingInteractionFinished=new Promise((t=>{this.pendingInteractionFinishedResolver=t}))};this.handleInteractionFinished=()=>{var t;(t=this.pendingInteractionFinishedResolver)===null||t===void 0?void 0:t.call(this);this.pendingInteractionFinished=undefined;this.pendingInteractionFinishedResolver=undefined};this.invalidateStencilBuffer=()=>{this.pendingStencilBuffer=undefined};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();const s=i?await this.viewer.scene():undefined;const n=s!=null?s.crossSectioning().current().sectionPlanes.length>0||this.viewer.featureLines!=null:false;const e=(t=this.viewer.frame)===null||t===void 0?void 0:t.scene.camera;if(n&&this.viewer.stream!=null&&e!=null){const t=await this.viewer.stream.getStencilBuffer({includeDepthBuffer:true});const{stencilBuffer:i,depthBuffer:s,imageAttributes:n}=U(t);const[o,a]=await Promise.all([_(new Uint8Array(i)),_(new Uint8Array(s))]);return Vt.fromPng(o,n,i,J.fromPng(a,e,n))}else return undefined}latest(){if(this.pendingStencilBuffer==null){this.pendingStencilBuffer=this.fetch()}return this.pendingStencilBuffer}async latestAfterInteraction(){await this.pendingInteractionFinished;return this.latest()}}class Vt{constructor(t,i,s,n,e){this.imageAttr=t;this.imageBytes=i;this.pixelBytes=s;this.imageChannels=n;this.depthBuffer=e}static fromPng(t,i,s,n){if(!(t.data instanceof Uint8Array)){throw new Error("Expected stencil PNG to have depth of 8-bit")}else if(t.channels!==1){throw new Error("Expected stencil PNG to have 1 color channel")}else{return new Vt(i,s,t.data,t.channels,n)}}getValue(t){const{width:i,height:s}=this.imageAttr.imageRect;const n=a.subtract(t,this.imageAttr.imageRect);const e=1/this.imageAttr.imageScale;const o=a.scale(n,e,e);if(o.x>=0&&o.y>=0&&o.x<i&&o.y<s){const t=Math.floor(o.x)+Math.floor(o.y)*i;const s=this.pixelBytes[t];return s}else return 0}hitTest(t){return this.getValue(t)!==Ot}snapToNearestPixel(t,i,s=()=>true){const n=i*2;const e=a.create(t.x-i,t.y-i);const o=[];for(let r=0;r<n*n;r++){const h=r%n;const c=Math.floor(r/n);const l=a.add(e,{x:h,y:c});if(a.distance(l,t)<=i){const t=this.getValue(l);if(t===$t&&s(t)){o.push(l)}}}const r=o.sort(((i,s)=>a.distance(i,t)-a.distance(s,t)));const h=r[0];return h!=null?a.create(Math.floor(h.x)+.5,Math.floor(h.y)+.5):t}}function Ft(t){return new Promise((i=>setTimeout(i,t)))}const Nt=C.defineMapper(C.compose((t=>t.toObject()),C.read(C.mapRequiredProp("id",X),C.mapRequiredProp("createdAt",Z),C.mapRequiredProp("modifiedAt",Z),C.mapProp("name",G),C.mapProp("suppliedId",G))),(([t,i,s,n,e])=>({id:t,createdAt:i,modifiedAt:s,name:n,suppliedId:e})));const Wt=C.ifInvalidThrow(Nt);const qt=C.defineMapper(C.compose((t=>t.toObject()),C.read(C.mapRequiredProp("id",X),C.mapRequiredProp("createdAt",Z),C.mapRequiredProp("modifiedAt",Z),C.mapProp("suppliedId",G),C.mapRequiredProp("data",(t=>{if(t.callout!=null){return _t(t.callout)}else if(t.customJson!=null){return Jt(t.customJson)}else{throw new Error("Undefined or unknown annotation data.")}})))),(([t,i,s,n,e])=>({id:t,createdAt:i,modifiedAt:s,suppliedId:n,data:e})));const Ut=C.ifInvalidThrow(qt);const _t=C.defineMapper(C.read(C.mapRequiredProp("position",Q),C.mapProp("icon",G),C.mapProp("primaryColor",G),C.mapProp("accentColor",G)),(([t,i,s,n])=>({type:"callout",position:t,icon:i,primaryColor:s,accentColor:n})));const Jt=C.defineMapper(C.read(C.requiredProp("type"),C.mapRequiredProp("jsonData",(t=>JSON.parse(t)))),(([t,i])=>({type:"custom",jsonType:t,jsonData:i})));class Xt{constructor(t,i,s){this.client=t;this.jwtProvider=i;this.deviceIdProvider=s;this.onStateChange=new S}async addAnnotationSet(t){await N((async i=>{const s=this.deviceIdProvider();const n=await q(this.jwtProvider,s);const e=new V.CreateSceneViewAnnotationSetRequest;const o=new x.Uuid;o.setHex(t);e.setSceneAnnotationSetId(o);this.client.createSceneViewAnnotationSet(e,n,i)}));return this.fetch()}disconnect(){if(this.connection!=null){this.connection.dispose();this.connection=undefined}}connect(t=1e4){this.disconnect();const i=this.pollAnnotationState(t);this.connection={dispose:()=>i.abort()}}async fetch(t={}){const i=await this.fetchAnnotationSetsAsArray();const s=await this.fetchAnnotationsAsArray(i);const n=(await Promise.all(s)).reduce(((t,[i,s])=>({annotations:{...t.annotations,[i.id]:s}})),{annotations:{}});if(t.signal==null||!t.signal.aborted){this.updateState(n)}return n}async removeAnnotationSet(t){await N((async i=>{const s=this.deviceIdProvider();const n=await q(this.jwtProvider,s);const e=new V.DeleteSceneViewAnnotationSetRequest;const o=new x.Uuid;o.setHex(t);e.setSceneAnnotationSetId(o);this.client.deleteSceneViewAnnotationSet(e,n,i)}));return this.fetch()}pollAnnotationState(t){const i=new AbortController;const s=async t=>{await this.fetch({signal:i.signal});if(!i.signal.aborted){await Ft(t);await s(t)}};I.abort(i.signal,s(t));return i}fetchAnnotationSets(){return W((t=>async i=>{const s=this.deviceIdProvider();const n=await q(this.jwtProvider,s);const e=new V.ListSceneViewAnnotationSetsRequest;if(t!=null){const i=new j.Pager;i.setCursor(t);i.setLimit(100);e.setPage(i)}this.client.listSceneViewAnnotationSets(e,n,i)}),(t=>{var i;return(i=t.toObject().nextCursor)===null||i===void 0?void 0:i.next}))}async fetchAnnotationSetsAsArray(){return(await I.asArray(this.fetchAnnotationSets())).flatMap((t=>t.getSceneAnnotationSetsList())).map((t=>Wt(t)))}fetchAnnotations(t){return W((i=>async s=>{const n=this.deviceIdProvider();const e=await q(this.jwtProvider,n);const o=new V.ListSceneAnnotationsRequest;const a=It(t);o.setSceneAnnotationSetId(a);if(i!=null){const t=new j.Pager;t.setCursor(i);t.setLimit(100);o.setPage(t)}this.client.listSceneAnnotations(o,e,s)}),(t=>{var i;return(i=t.toObject().nextCursor)===null||i===void 0?void 0:i.next}))}fetchAnnotationsAsArray(t){const i=t.map((async t=>{const i=(await I.asArray(this.fetchAnnotations(t.id))).flatMap((t=>t.getSceneAnnotationsList())).map((t=>Ut(t)));return[t,i]}));return Promise.all(i)}updateState(t){this.state=t;this.onStateChange.emit(t)}}const Zt=C.defineMapper(C.read(C.mapRequiredProp("color",Y),C.getProp("thickness")),(([t,i])=>({color:t,thickness:i})));const Gt=C.defineMapper(C.read(C.mapRequiredProp("color",Y)),(([t])=>({color:t})));const Qt=C.defineMapper(C.read(C.pickFirst(C.mapProp("arrow",C.ifDefined((t=>({...t,type:"arrow-end"})))),C.mapProp("circle",C.ifDefined((t=>({...t,type:"circle-end"})))),C.mapProp("dash",C.ifDefined((t=>({...t,type:"dash-end"})))))),(([t])=>t!==null&&t!==void 0?t:undefined));const Yt=C.defineMapper(C.read(C.mapRequiredProp("startPosition",tt),C.mapRequiredProp("endPosition",tt),C.mapProp("strokeStyle",C.ifDefined(Zt)),C.mapProp("fillStyle",C.ifDefined(Gt)),C.mapProp("startShape",C.ifDefined(Qt)),C.mapProp("endShape",C.ifDefined(Qt))),(([t,i,s,n,e,o])=>({type:"line-2d",startPosition:t,endPosition:i,strokeStyle:s,fillStyle:n,startShape:e!==null&&e!==void 0?e:undefined,endShape:o!==null&&o!==void 0?o:undefined})));const ti=C.defineMapper(C.read(C.mapRequiredProp("topLeft",tt),C.mapRequiredProp("bottomRight",tt),C.mapProp("strokeStyle",C.ifDefined(Zt)),C.mapProp("fillStyle",C.ifDefined(Gt))),(([t,i,s,n])=>({type:"oval-2d",topLeftPosition:t,bottomRightPosition:i,strokeStyle:s,fillStyle:n})));const ii=C.defineMapper(C.read(C.mapRequiredProp("positionsList",C.mapArray(tt)),C.mapProp("strokeStyle",C.ifDefined(Zt)),C.mapProp("fillStyle",C.ifDefined(Gt))),(([t,i,s])=>({type:"freeform-2d",positions:t,strokeStyle:i,fillStyle:s})));const si=C.defineMapper(C.read(C.mapRequiredProp("primaryColor",Y),C.mapRequiredProp("accentColor",Y),C.mapRequiredProp("position",Q),C.mapProp("sceneItemId",C.ifDefined(X))),(([t,i,s,n])=>({type:"pin-2d",primaryColor:t,accentColor:i,position:s,sceneItemId:n!==null&&n!==void 0?n:undefined})));const ni=C.defineMapper(C.read(C.mapRequiredProp("primaryColor",Y),C.mapRequiredProp("accentColor",Y),C.mapRequiredProp("anchorPosition",Q),C.mapRequiredProp("textPosition",tt),C.getProp("text"),C.mapProp("sceneItemId",C.ifDefined(X))),(([t,i,s,n,e,o])=>({type:"callout",primaryColor:t,accentColor:i,anchorPosition:s,textPosition:n,text:e,sceneItemId:o!==null&&o!==void 0?o:undefined})));const ei=C.defineMapper(C.read(C.pickFirst(C.mapProp("line2d",C.ifDefined(Yt)),C.mapProp("oval",C.ifDefined(ti)),C.mapProp("freeform",C.ifDefined(ii)),C.mapProp("pin",C.ifDefined(si)),C.mapProp("callout",C.ifDefined(ni)))),(([t])=>t!==null&&t!==void 0?t:undefined));const oi=C.defineMapper(C.read(C.mapRequiredProp("itemsList",C.mapArray(ei))),(([t])=>({items:t.filter((t=>t!=null))})));const ai=C.defineMapper(C.read(C.mapRequiredProp("canvas",C.mapRequiredProp("document",C.mapRequiredProp("v1",oi)))),(([t])=>t));const ri=C.ifInvalidThrow(ai);class hi{constructor(t,i,s){this.client=t;this.jwtProvider=i;this.deviceIdProvider=s}async getCanvas({canvasId:t,sceneViewStateId:i}){if(t!=null&&i!=null){throw new Error("Invalid request. Only one lookup ID between `canvasId` and `sceneViewStateId` can be provided.")}const s=await N((async s=>{const n=this.deviceIdProvider();const e=await q(this.jwtProvider,n);const o=new V.GetCanvasRequest;if(t!=null){const i=It(t);o.setCanvasId(i)}else if(i!=null){const t=It(i);o.setSceneViewStateId(t)}this.client.getCanvas(o,e,s)}));return ri(s.toObject())}}class ci{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();const n=await this.stream.hitItems({point:a.scale(t.position,(s===null||s===void 0?void 0:s.x)||1,(s===null||s===void 0?void 0:s.y)||1)},true);if(((i=n.hitItems)===null||i===void 0?void 0:i.hits)!=null&&n.hitItems.hits.length>0){await this.stream.flyTo({itemId:n.hitItems.hits[0].itemId,animation:{duration:m(this.configProvider().animation.durationMs)}})}else{console.debug(`No hit results found for fly to part [position={x: ${t.position.x}, y: ${t.position.y}}]`)}}}class li{constructor(t,i,s,n,e,o,a,r,h,c,l){this.stream=t;this.cursors=i;this.getConfig=s;this.getScene=n;this.getFrame=e;this.getViewport=o;this.tapEmitter=a;this.doubleTapEmitter=r;this.longPressEmitter=h;this.interactionStartedEmitter=c;this.interactionFinishedEmitter=l;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();const s=this.getFrame();if(s==null){throw new Error("Cannot get world point. Frame is undefined.")}const n=await s.depthBuffer();return n!=null?i.transformPointToWorldSpace(t,n,.5):undefined}async getEntityTypeAtPoint(t){var i;const s=this.getViewport();const n=await((i=this.getFrame())===null||i===void 0?void 0:i.featureMap());if(n!=null){const i=s.transformPointToFrame(t,n);return n.getEntityType(i)}else{return it.NO_GEOMETRY}}getRayFromPoint(t){const i=this.getViewport();const s=this.getFrame();if(s!=null){return i.transformPointToRay(t,s.image,s.scene.camera)}else 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(t={}){if(!this.isInteracting()){this.activeRenderOptions=t;this.interactionStartedEmitter.emit();this.sceneLoadingPromise=this.getScene();this.currentCamera=(await this.sceneLoadingPromise).camera();this.sceneLoadingPromise=undefined;await this.stream.beginInteraction()}}async transformCamera(t,i){var s,n;if(i===void 0){i=(s=this.activeRenderOptions)!==null&&s!==void 0?s:{}}if(this.isInteracting()){const s=await this.getScene();const e=this.getViewport();const o=this.getFrame();const a=await(o===null||o===void 0?void 0:o.depthBuffer());this.currentCamera=this.currentCamera!=null&&e!=null&&o!=null?t({camera:this.currentCamera,viewport:e,scale:s.scale(),boundingBox:s.boundingBox(),frame:o,depthBuffer:a}):undefined;await((n=this.currentCamera)===null||n===void 0?void 0:n.render(i))}}async twistCamera(...t){return this.transformCamera((({camera:i,viewport:s})=>{const n=r.normalize(r.subtract(i.lookAt,i.position));if(t.length===1&&typeof t[0]==="number"){const s=h.toRadians(-t[0]);return i.rotateAroundAxis(s,n)}else if(t.length===1){const n=a.create(s.width/2,s.height/2);const e=h.toDegrees(h.fromPoints(n,t[0]));const o=this.lastAngle!=null?e-this.lastAngle:0;this.lastAngle=e;const c=r.normalize(r.subtract(i.lookAt,i.position));const l=h.toRadians(-o);return i.rotateAroundAxis(l,c)}return i}))}async panCameraToScreenPoint(t){return this.transformCamera((({camera:i,frame:s,viewport:n,depthBuffer:e})=>{if(this.panData==null){const o=i.toFrameCamera();const a=o.direction;const r=n.transformPointToRay(t,s.image,o);const h=c.fromNormalAndCoplanarPoint(a,i.lookAt);const d=l.intersectPlane(r,h);if(d==null){console.warn("Cannot determine fallback for pan. Ray does not intersect plane.");return i}const u=e!=null?this.getWorldPoint(t,e,d):d;const f=c.fromNormalAndCoplanarPoint(a,u);this.panData={hitPt:u,hitPlane:f,startingCamera:o}}if(this.panData!=null){const{hitPt:e,hitPlane:o,startingCamera:a}=this.panData;const h=n.transformPointToRay(t,s.image,a);const c=l.intersectPlane(h,o);if(c!=null){const t=r.subtract(e,c);return i.update(a).moveBy(t)}}return i}))}async viewAll(){await(await this.getScene()).camera().viewAll().render({})}async rotateCamera(t){return this.transformCamera((({camera:i,viewport:s})=>{const n=r.normalize(i.up);const e=r.normalize(r.subtract(i.lookAt,i.position));const o=r.cross(n,e);const a=r.cross(e,o);const h=r.normalize({x:t.x*o.x+t.y*a.x,y:t.x*o.y+t.y*a.y,z:t.x*o.z+t.y*a.z});const c=r.cross(h,e);const l=9.5*t.x/s.width;const d=9.5*t.y/s.height;const u=Math.abs(l)+Math.abs(d);return i.rotateAroundAxis(u,c)}))}async rotateCameraAtPoint(t,i){return this.transformCamera((({camera:s,viewport:n,depthBuffer:e})=>{if(this.worldRotationPoint==null){this.worldRotationPoint=e!=null?this.getWorldPoint(i,e,s.lookAt):s.lookAt}const o=r.normalize(s.up);const a=r.normalize(r.subtract(s.lookAt,s.position));const h=r.cross(o,a);const c=r.cross(a,h);const l=r.normalize({x:t.x*h.x+t.y*c.x,y:t.x*h.y+t.y*c.y,z:t.x*h.z+t.y*c.z});const d=r.cross(l,a);const u=9.5*t.x/n.width;const f=9.5*t.y/n.height;const p=Math.abs(u)+Math.abs(f);const m=s.rotateAroundAxisAtPoint(p,this.worldRotationPoint,d);return m.update({lookAt:r.add(r.scale(Math.abs(s.signedDistanceToBoundingBoxCenter())/r.magnitude(m.viewVector),m.viewVector),m.position)})}))}async zoomCamera(t){return this.transformCamera((({camera:i,viewport:s,frame:n,boundingBox:e})=>{if(s!=null&&n!=null){const o=i===null||i===void 0?void 0:i.toFrameCamera().isPerspective();if(o){const n=i.viewVector;const e=r.magnitude(n);const o=3*e*(t/s.height);const a=r.normalize(n);const h=r.scale(o,a);const c=r.add(i.position,h);const l=i.update({position:c});return l}else{const o=i;const a=i.toFrameCamera();const h=a.direction;const u=s.transformPointToRay(s.center,n.image,a);const f=4*(t/s.height);const p=r.magnitude(d.diagonal(e))*1e-5;const m=Math.max(p,o.fovHeight*(1-f));const v=c.fromNormalAndCoplanarPoint(h,a.lookAt);const w=l.intersectPlane(u,v);if(w!=null){const t=c.projectPoint(v,o.lookAt);const s=(o.fovHeight-m)/o.fovHeight;const n=r.scale(s,r.subtract(w,t));const e=r.add(o.lookAt,n);const a=i.update({lookAt:e,rotationPoint:e,fovHeight:m});return a}}}return i}))}async pivotCamera(t,i){return this.transformCamera((({camera:s})=>{const{position:n,up:e,lookAt:o}=s;const a=r.normalize(e);const c=r.normalize(s.viewVector);const l=r.cross(a,c);const d=r.cross(c,l);const u=r.rotateAboutAxis(h.toRadians(t),o,l,n);const f=r.rotateAboutAxis(h.toRadians(i),u,d,n);return s.update({...s,lookAt:f})}))}async endInteraction(){await this.sceneLoadingPromise;if(this.isInteracting()){this.currentCamera=undefined;this.worldRotationPoint=undefined;this.panData=undefined;this.zoomData=undefined;this.resetLastAngle();this.interactionFinishedEmitter.emit();await this.stream.endInteraction()}this.activeRenderOptions=undefined}resetLastAngle(){this.lastAngle=undefined}isInteracting(){return this.currentCamera!=null}pixelThreshold(t){const i=this.isCoarseInputDevice(t)?this.getConfig().coarsePointerThreshold:this.getConfig().finePointerThreshold;return i*window.devicePixelRatio}async hitItems(t){var i;const s=await(await this.getScene()).raycaster().hitItems(t);return(i=s===null||s===void 0?void 0:s.hits)!==null&&i!==void 0?i:[]}emitTapEvent(t,i,s={},n=0){const{altKey:e=false,ctrlKey:o=false,metaKey:a=false,shiftKey:r=false}=s;t({position:i,altKey:e,ctrlKey:o,metaKey:a,shiftKey:r,buttons:n})}isCoarseInputDevice(t){return t||window.matchMedia("(pointer: coarse)").matches}getWorldPoint(t,i,s){const n=this.getViewport();const e=n.transformPointToFrame(t,i);const o=i.hitTest(e);return o?n.transformPointToWorldSpace(t,i):s}}class di extends li{constructor(t,i,s,n,e,o,a,r,h,c,l){super(t,i,s,n,e,o,a,r,h,c,l)}async getWorldPointFromViewport(t){const i=this.getViewport();const s=this.getFrame();if(s==null){throw new Error("Cannot get world point. Frame is undefined.")}const n=await s.depthBuffer();return n!=null?i.transformPointToWorldSpace(t,n,.5):undefined}async panCameraByDelta(t){return this.transformCamera((({camera:i,viewport:s})=>{const n=i.viewVector;const e=r.normalize(i.up);const o=r.normalize(n);const h=a.scale(t,.5,.5);const c=r.magnitude(n);const l=h.x*c/s.width;const d=h.y*c/s.height;const u=r.cross(e,o);const f=r.cross(o,u);const p=r.add(r.scale(l,u),r.scale(d,f));return i.moveBy(p)}))}async panCameraToScreenPoint(t){return this.transformCamera((({camera:i,frame:s,viewport:n,boundingBox:e})=>{if(this.panData==null){const e=i.toFrameCamera();const o=e.direction;const a=n.transformPointToRay(t,s.image,e);const r=c.fromNormalAndCoplanarPoint(o,i.lookAt);const h=l.intersectPlane(a,r);if(h==null){console.warn("Cannot determine fallback for pan. Ray does not intersect plane.");return i}this.panData={hitPt:h,hitPlane:r,startingCamera:e}}if(this.panData!=null){const{hitPt:e,hitPlane:o,startingCamera:a}=this.panData;const h=n.transformPointToRay(t,s.image,a);const c=l.intersectPlane(h,o);if(c!=null){const t=r.subtract(e,c);const s=r.add(a.lookAt,t);return i.update({lookAt:s,rotationPoint:s})}}return i}))}async zoomCameraToPoint(t,i){return this.transformCamera((({camera:s,viewport:n,frame:e,depthBuffer:o,boundingBox:h})=>{if(this.orthographicZoomData==null||a.distance(t,this.orthographicZoomData.startingScreenPt)>2){const i=s.toFrameCamera();const a=i.direction;const r=n.transformPointToRay(t,e.image,i);const h=c.fromNormalAndCoplanarPoint(a,i.lookAt);const d=l.intersectPlane(r,h);if(d==null){console.warn("Cannot determine fallback point for zoom. Ray does not intersect plane.");return s}const u=o!=null?this.getWorldPoint(t,o,d):d;const f=c.fromNormalAndCoplanarPoint(a,u);this.orthographicZoomData={hitPt:u,hitPlane:f,startingScreenPt:t}}if(this.orthographicZoomData!=null){const{hitPt:t,hitPlane:e}=this.orthographicZoomData;const o=4*(i/n.height);const a=r.magnitude(d.diagonal(h))*1e-5;const l=Math.max(a,s.fovHeight*(1-o));const u=c.projectPoint(e,s.lookAt);const f=(s.fovHeight-l)/s.fovHeight;const p=r.scale(f,r.subtract(t,u));const m=r.add(s.lookAt,p);return s.update({lookAt:m,rotationPoint:m,fovHeight:l})}return s}))}async rotateCamera(t){return this.transformCamera((({camera:i,viewport:s,boundingBox:n})=>{var e;const o=r.normalize(i.up);const a=r.normalize(r.subtract(i.lookAt,i.position));const h=r.cross(o,a);const c=r.cross(a,h);const l=r.normalize({x:t.x*h.x+t.y*c.x,y:t.x*h.y+t.y*c.y,z:t.x*h.z+t.y*c.z});const u=r.cross(l,a);const f=9.5*t.x/s.width;const p=9.5*t.y/s.height;const m=Math.abs(f)+Math.abs(p);const v=i.rotationPoint!=null&&((e=i.rotationPoint)===null||e===void 0?void 0:e.x)!=null?i.rotationPoint:i.lookAt;const w=i.rotateAroundAxisAtPoint(m,v,u);const g=st(w.lookAt,w.viewVector,d.center(n));return w.update({lookAt:g})}))}getWorldPoint(t,i,s){const n=this.getViewport();const e=n.transformPointToFrame(t,i);const o=i.hitTest(e);return o?n.transformPointToWorldSpace(t,i):s}}const ui=.2;class fi extends li{constructor(t,i,s,n,e,o,a,r,h,c,l){super(t,i,s,n,e,o,a,r,h,c,l)}async panCameraByDelta(t){return this.transformCamera((({camera:i,viewport:s})=>{var n;const e=i.viewVector;const o=r.normalize(i.up);const h=r.normalize(e);const c=a.scale(t,.25,.25);const l=r.magnitude(e)*Math.tan((n=i.fovY)!==null&&n!==void 0?n:45);const d=c.x*l/s.width;const u=c.y/s.width*l;const f=r.cross(o,h);const p=r.cross(h,f);const m=r.add(r.scale(d,f),r.scale(u,p));return i.moveBy(m)}))}async zoomCameraToPoint(t,i){return this.transformCamera((({camera:s,viewport:n,frame:e,depthBuffer:o,boundingBox:a})=>{const h=e.scene.camera;const d=h.direction;const u=s.toFrameCamera();const f=n.transformPointToRay(t,e.image,u);if(this.zoomData==null){const i=c.fromNormalAndCoplanarPoint(d,h.lookAt);const n=l.intersectPlane(f,i);if(n==null){console.warn("Cannot determine fallback point for zoom. Ray does not intersect plane.");return s}const e=o!=null?this.getWorldPoint(t,o,n):n;const a=c.fromNormalAndCoplanarPoint(d,e);this.zoomData={hitPt:e,hitPlane:a}}if(this.zoomData!=null){const{hitPlane:t}=this.zoomData;const{position:e,distance:o,isPastHitPlane:h,keepCurrent:d}=this.computeZoomDistances(i,s,n,a,f,this.zoomData);if(h&&!d){const t=l.create({origin:e,direction:r.normalize(s.viewVector)});return s.update({position:e,lookAt:l.at(t,o)})}else if(!d){return s.update({position:e,lookAt:c.projectPoint(t,e)})}}return s}))}walk(t){this.transformCamera((({camera:i,boundingBox:s})=>{const{position:n,up:e,lookAt:o}=i;const a=r.normalize(e);const h=r.normalize(i.viewVector);const c=Math.min(...r.toArray(d.lengths(s)));const l=r.scale(c,t);const u=r.cross(a,h);const f=r.cross(u,a);const p=r.scale(l.x,r.normalize(u));const m=r.scale(l.y,r.normalize(a));const v=r.scale(l.z,r.normalize(f));const w=r.negate(r.add(p,m,v));return i.update({...i,position:r.add(n,w),lookAt:r.add(o,w)})}))}computeZoomDistances(t,i,s,n,e,o){const a=this.getConfig();const{hitPt:h,hitPlane:c}=o;const d=a.useMinimumPerspectiveZoomDistance?this.computeZoomMinimumDistance(i,n):-1;const u=r.distance(i.position,h);const f=Math.max(d,u);const p=6*f*t/s.height;const m=l.at(e,p);const v=l.create({origin:m,direction:r.normalize(i.viewVector)});const w=l.intersectPlane(v,c);if(w==null&&a.useMinimumPerspectiveZoomDistance){const i=6*d*t/s.height;const n=l.at(e,i);return{position:n,distance:d,isPastHitPlane:true,keepCurrent:false}}else if(w==null){return{position:i.position,distance:f,isPastHitPlane:true,keepCurrent:true}}return{position:m,distance:f,isPastHitPlane:false,keepCurrent:false}}computeZoomMinimumDistance(t,i){const s=Math.abs(i.min.x)+Math.abs(i.max.x);const n=Math.abs(i.min.y)+Math.abs(i.max.y);const e=Math.abs(i.min.z)+Math.abs(i.max.z);const o=Math.max(s,n,e);const a=Math.abs(r.dot(r.normalize(t.viewVector),r.right()));const h=Math.abs(r.dot(r.normalize(t.viewVector),r.up()));const c=Math.abs(r.dot(r.normalize(t.viewVector),r.back()));const l=s*a;const d=n*h;const u=e*c;const f=o/s;const p=o/n;const m=o/e;return(l+d+u)/(f+p+m)*ui}}class pi{constructor(t,i,s,n){this.stream=t;this.configProvider=i;this.imageScaleProvider=s;this.sceneProvider=n}predicate(t){return t.altKey&&t.shiftKey}async fn(t){var i,s;const n=this.imageScaleProvider();const e=await this.stream.hitItems({point:a.scale(t.position,(n===null||n===void 0?void 0:n.x)||1,(n===null||n===void 0?void 0:n.y)||1)},true);if(((i=e.hitItems)===null||i===void 0?void 0:i.hits)!=null&&e.hitItems.hits.length>0&&e.hitItems.hits[0].hitPoint!=null){const i=await this.sceneProvider();const n=(await this.sceneProvider()).camera();const o=e.hitItems.hits[0];if(o.hitPoint!=null&&o.hitPoint.x!=null&&o.hitPoint.y!=null&&o.hitPoint.z!=null){const t=r.create(o.hitPoint.x,o.hitPoint.y,o.hitPoint.z);const s=await this.getLookAtPoint(i,t,n.viewVector);await this.stream.flyTo({camera:nt(n.update({lookAt:s,rotationPoint:s}).toFrameCamera()),animation:{duration:m(this.configProvider().animation.durationMs)}})}else{console.debug(`No hit position found for fly to position [position={x: ${t.position.x}, y: ${t.position.y}}, hit-id={${(s=o.itemId)===null||s===void 0?void 0:s.hex}}]`)}}else{console.debug(`No hit results found for fly to position [position={x: ${t.position.x}, y: ${t.position.y}}]`)}}getLookAtPoint(t,i,s){if(t.isOrthographic()){return st(i,s,d.center(t.boundingBox()))}else{return i}}}class mi{setPosition(t){this.currentPosition=t}getPosition(){return this.currentPosition}getType(){return this.type}beginDrag(t,i,s,n){}drag(t,i){}endDrag(t,i){if(this.currentPosition!=null){i.endInteraction();this.currentPosition=undefined}}async zoom(t,i){}}class vi extends mi{constructor(){super(...arguments);this.type="rotate"}beginDrag(t,i,s){if(this.currentPosition==null){this.currentPosition=a.create(t.screenX,t.screenY);s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null){const s=a.create(t.screenX,t.screenY);const n=a.subtract(s,this.currentPosition);i.rotateCamera(n);this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class wi extends mi{constructor(){super(...arguments);this.type="rotate-point"}beginDrag(t,i,s){if(this.currentPosition==null){this.currentPosition=a.create(t.screenX,t.screenY);this.startingPosition=i;s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null&&this.startingPosition!=null){const s=a.create(t.screenX,t.screenY);const n=a.subtract(s,this.currentPosition);i.rotateCameraAtPoint(n,this.startingPosition);this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class gi extends mi{constructor(t){super();this.interactionConfigProvider=t;this.type="zoom";this.isTransforming=false}async beginDrag(t,i,s,n){if(this.currentPosition==null){this.currentPosition=a.create(t.clientX,t.clientY);const i=n.getBoundingClientRect();const e=Rt(t,i);this.startPt=e;await s.beginInteraction()}}async drag(t,i){if(this.currentPosition!=null){const s=a.create(t.clientX,t.clientY);const n=a.subtract(s,this.currentPosition);if(this.startPt!=null){await i.zoomCameraToPoint(this.startPt,n.y);this.currentPosition=s}}}endDrag(t,i){super.endDrag(t,i);this.stopInteractionTimer();this.isTransforming=false;this.startPt=undefined}async zoom(t,i,s){await this.runWheelZoomInteraction(i,(()=>i.zoomCamera(this.getDirectionalDelta(t))),s)}async zoomToPoint(t,i,s,n){await this.runWheelZoomInteraction(s,(()=>s.zoomCameraToPoint(t,this.getDirectionalDelta(i))),n)}async beginInteraction(t){this.isTransforming=true;await t.beginInteraction()}async endInteraction(t){this.isTransforming=false;await t.endInteraction()}resetInteractionTimer(t,i){this.stopInteractionTimer();this.startInteractionTimer(t,i)}getDirectionalDelta(t){return this.interactionConfigProvider().reverseMouseWheelDirection?-t:t}getInteractionDelay(){return this.interactionConfigProvider().mouseWheelInteractionEndDebounce}startInteractionTimer(t,i=0){this.interactionTimer=window.setTimeout((async()=>{this.interactionTimer=undefined;await this.endInteraction(t)}),i+this.getInteractionDelay())}stopInteractionTimer(){if(this.interactionTimer!=null){window.clearTimeout(this.interactionTimer);this.interactionTimer=undefined}}async runWheelZoomInteraction(t,i,s){if(!this.isTransforming){await this.beginInteraction(t)}this.resetInteractionTimer(t,s);i()}}class yi extends mi{constructor(){super(...arguments);this.type="pan"}beginDrag(t,i,s,n){if(this.currentPosition==null){this.currentPosition=a.create(t.screenX,t.screenY);this.canvasRect=n.getBoundingClientRect();s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null&&this.canvasRect!=null){const s=Rt(t,this.canvasRect);i.panCameraToScreenPoint(s);this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class bi extends mi{constructor(){super(...arguments);this.type="twist"}beginDrag(t,i,s,n){this.currentPosition=a.create(t.offsetX,t.offsetY);this.canvasRect=n.getBoundingClientRect();s.beginInteraction()}drag(t,i){const s=Rt(t,this.canvasRect);this.currentPosition=s;i.twistCamera(s)}endDrag(t,i){super.endDrag(t,i)}}class Ci extends mi{constructor(){super(...arguments);this.type="pivot"}beginDrag(t,i,s){if(this.currentPosition==null){this.currentPosition=a.create(t.screenX,t.screenY);s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null){const s=a.create(t.screenX,t.screenY);const n=a.subtract(s,this.currentPosition);i.pivotCamera(-.25*n.y,.25*n.x);this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class Si extends zt{constructor(t,i=new vi,s=new wi,n=new gi((()=>t().interactions)),e=new yi,o=new bi,a=new Ci){super("mousedown","mouseup","mousemove",i,s,n,e,o,a,t)}}function Ii(t){window.requestAnimationFrame(t)}class Pi{constructor(){this.previousFirstPoints=[];this.previousSecondPoints=[]}initialize(t,i){this.element=t;this.interactionApi=i}dispose(){this.element=undefined}beginTwoPointTouch(t,i){this.previousFirstPoints=[...this.previousFirstPoints,t];this.previousSecondPoints=[...this.previousSecondPoints,i]}handleTwoPointTouchMove(t,i){this.previousFirstPoints=[...this.previousFirstPoints,t];this.previousSecondPoints=[...this.previousSecondPoints,i];Ii((()=>{var t,i,s,n;if(this.previousFirstPoints.length>1&&this.previousSecondPoints.length>1&&this.previousFirstPoints.length===this.previousSecondPoints.length){const e=this.previousFirstPoints;const o=this.previousSecondPoints;this.previousFirstPoints=this.previousFirstPoints.slice(-1);this.previousSecondPoints=this.previousSecondPoints.slice(-1);const r=e.reduce(((t,i,s)=>{if(s<e.length-1){const n=e[s+1];const a=o[s];const r=o[s+1];return{deltas:[...t.deltas,this.computeDelta(i,a,n,r)],zooms:[...t.zooms,this.computeZoom(i,a,n,r)],angles:[...t.angles,this.computeAngle(i,a,n,r)]}}return t}),{deltas:[],zooms:[],angles:[]});const h=r.deltas.reduce(((t,i)=>a.add(t,i)),a.create());const c=r.zooms.reduce(((t,i)=>t+i),0);const l=r.angles.reduce(((t,i)=>t+i),0);const d=a.create((e[e.length-1].x+o[o.length-1].x)/2,(e[e.length-1].y+o[o.length-1].y)/2);(t=this.interactionApi)===null||t===void 0?void 0:t.beginInteraction();(i=this.interactionApi)===null||i===void 0?void 0:i.zoomCameraToPoint(d,c);(s=this.interactionApi)===null||s===void 0?void 0:s.panCameraByDelta(h);(n=this.interactionApi)===null||n===void 0?void 0:n.twistCamera(l)}}))}endTwoPointTouch(){this.previousFirstPoints=[];this.previousSecondPoints=[]}computeDelta(t,i,s,n){return a.add(a.subtract(s,t),a.subtract(n,i))}computeZoom(t,i,s,n){const e=a.distance(s,n)-a.distance(t,i);return e*.5}computeAngle(t,i,s,n){const e=u.create(a.subtract(t,i),a.subtract(s,n));return h.toDegrees(Math.atan2(u.determinant(e),u.dot(e)))}}class Ti extends Pi{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;(t=this.element)===null||t===void 0?void 0:t.removeEventListener("pointerdown",this.handlePointerDown);super.dispose()}initialize(t,i){super.initialize(t,i);t.addEventListener("pointerdown",this.handlePointerDown)}handlePointerDown(t){const i=a.create(t.screenX,t.screenY);this.touchPoints={...this.touchPoints,[t.pointerId]:i};const s=Object.keys(this.touchPoints);if(s.length===1){window.addEventListener("pointermove",this.handlePointerMove);window.addEventListener("pointerup",this.handlePointerUp)}else if(s.length===2){this.beginTwoPointTouch(this.touchPoints[0],this.touchPoints[1])}}handlePointerMove(t){if(this.touchPoints[t.pointerId]!=null){this.touchPoints[t.pointerId]=a.create(t.screenX,t.screenY)}const i=Object.keys(this.touchPoints);if(i.length===2){const t=this.touchPoints[i[0]];const s=this.touchPoints[i[1]];this.handleTwoPointTouchMove(t,s)}}handlePointerUp(t){var i;delete this.touchPoints[t.pointerId];const s=Object.keys(this.touchPoints);if(s.length===1){(i=this.interactionApi)===null||i===void 0?void 0:i.endInteraction()}if(s.length===0){window.removeEventListener("pointermove",this.handlePointerMove);window.removeEventListener("pointerup",this.handlePointerUp)}this.endTwoPointTouch()}}class ki extends Ht{constructor(t,i=new vi,s=new wi,n=new gi((()=>t().interactions)),e=new yi,o=new bi,a=new Ci){super("pointerdown","pointerup","pointermove",i,s,n,e,o,a,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)}addEventListenersToElement(t){t.addEventListener(this.downEvent,this.handleDownEvent);t.addEventListener("wheel",this.handleMouseWheel,{passive:false});return{dispose:()=>{t.removeEventListener(this.downEvent,this.handleDownEvent);t.removeEventListener("wheel",this.handleMouseWheel)}}}handlePointerDown(t){this.downPosition=a.create(t.screenX,t.screenY);this.touchPoints.add(t.pointerId);if(this.touchPoints.size===1){window.addEventListener("pointerup",this.handlePointerUp)}if(this.touchPoints.size===2){this.disableIndividualInteractions=true}}handlePointerUp(t){this.touchPoints.delete(t.pointerId);if(this.touchPoints.size<2){this.disableIndividualInteractions=false}if(this.touchPoints.size===0){window.removeEventListener("pointerup",this.handlePointerUp)}}}class Ai{constructor(t,i,s,n){this.downEvent=t;this.upEvent=i;this.moveEvent=s;this.getConfig=n;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;(t=this.element)===null||t===void 0?void 0:t.removeEventListener(this.downEvent,this.handleDown);(i=this.element)===null||i===void 0?void 0:i.removeEventListener("touchstart",this.handleTouchStart);this.element=undefined;this.clearDoubleTapTimer();this.clearLongPressTimer()}initialize(t,i){this.element=t;this.interactionApi=i;t.addEventListener(this.downEvent,this.handleDown);t.addEventListener("touchstart",this.handleTouchStart,{passive:true})}handleTouchStart(t){if(t.touches.length===1){this.setPointerPositions(a.create(t.touches[0].clientX,t.touches[0].clientY));this.restartLongPressTimer();window.addEventListener("touchend",this.handleTouchEnd);window.addEventListener("touchmove",this.handleTouchMove)}}handleTouchMove(t){if(t.touches.length>0){this.handlePointerMove(a.create(t.touches[0].clientX,t.touches[0].clientY),true)}}handleTouchEnd(t){if(this.pointerDownPosition!=null){window.removeEventListener("touchend",this.handleTouchEnd);window.removeEventListener("touchmove",this.handleTouchMove)}this.handlePointerEnd(this.pointerDownPosition)}handleDown(t){this.setPointerPositions(a.create(t.clientX,t.clientY));this.buttons=t.buttons;const i={altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey};this.restartLongPressTimer(i);window.addEventListener(this.upEvent,this.handleUp);window.addEventListener(this.moveEvent,this.handleMove)}handleMove(t){this.handlePointerMove(a.create(t.clientX,t.clientY),this.isTouch(t))}handleUp(t){if(this.pointerDownPosition!=null){window.removeEventListener(this.upEvent,this.handleUp);window.removeEventListener(this.moveEvent,this.handleMove)}this.handlePointerEnd(a.create(t.clientX,t.clientY),{altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey},this.buttons,this.isTouch(t));this.buttons=undefined}handlePointerMove(t,i){var s;const n=((s=this.interactionApi)===null||s===void 0?void 0:s.pixelThreshold(i))||2;if(this.pointerDownPosition!=null&&a.distance(t,this.pointerDownPosition)>=n&&this.interactionTimer==null){this.clearPositions()}}handlePointerEnd(t,i={},s=0,n=false){var e,o;if(t!=null){if(this.longPressTimer!=null){this.emit((e=this.interactionApi)===null||e===void 0?void 0:e.tap)(t,i,s)}if(this.doubleTapTimer!=null&&this.secondPointerDownPosition!=null){this.emit((o=this.interactionApi)===null||o===void 0?void 0:o.doubleTap)(t,i,s,this.secondPointerDownPosition);this.clearDoubleTapTimer()}}this.pointerDownPosition=undefined;this.clearLongPressTimer()}emit(t){return(i,s={},n=0,e,o=false)=>{var r;const h=e||this.pointerDownPosition;const c=((r=this.interactionApi)===null||r===void 0?void 0:r.pixelThreshold(o))||1;let l;if(this.interactionTimer!=null){l=this.getCanvasPosition(h||i)}else if(h!=null&&a.distance(h,i)<=c){l=this.getCanvasPosition(i)}if(l!=null&&t!=null){t(l,s,n)}}}getCanvasPosition(t){var i;const s=(i=this.element)===null||i===void 0?void 0:i.getBoundingClientRect();const n=s!=null?a.create(s.left,s.top):undefined;return n!=null?a.subtract(a.create(t.x,t.y),n):undefined}clearPositions(){this.pointerDownPosition=undefined;this.firstPointerDownPosition=undefined;this.secondPointerDownPosition=undefined;this.clearDoubleTapTimer();this.clearLongPressTimer();this.clearInteractionTimer()}clearDoubleTapTimer(){if(this.doubleTapTimer!=null){window.clearTimeout(this.doubleTapTimer)}this.doubleTapTimer=undefined;this.firstPointerDownPosition=undefined;this.secondPointerDownPosition=undefined}restartDoubleTapTimer(){this.clearDoubleTapTimer();this.doubleTapTimer=window.setTimeout((()=>this.clearDoubleTapTimer()),this.getConfig().events.doubleTapThreshold)}clearLongPressTimer(){if(this.longPressTimer!=null){window.clearTimeout(this.longPressTimer)}this.longPressTimer=undefined}restartLongPressTimer(t={}){this.clearLongPressTimer();this.longPressTimer=window.setTimeout((()=>{var i;if(this.pointerDownPosition){this.emit((i=this.interactionApi)===null||i===void 0?void 0:i.longPress)(this.pointerDownPosition,t,this.buttons)}this.clearLongPressTimer()}),this.getConfig().events.longPressThreshold)}restartInteractionTimer(){this.clearInteractionTimer();this.interactionTimer=window.setTimeout((()=>{this.interactionTimer=undefined}),this.getConfig().interactions.interactionDelay)}clearInteractionTimer(){if(this.interactionTimer!=null){window.clearTimeout(this.interactionTimer);this.interactionTimer=undefined}}setPointerPositions(t){this.pointerDownPosition=t;this.restartInteractionTimer();if(this.firstPointerDownPosition==null){this.restartDoubleTapTimer();this.firstPointerDownPosition=t}else{this.secondPointerDownPosition=t}}isTouch(t){return window.PointerEvent!=null&&t instanceof PointerEvent?t.pointerType==="touch":false}}class Di extends Pi{constructor(){super();this.handleTouchStart=this.handleTouchStart.bind(this);this.handleTouchMove=this.handleTouchMove.bind(this);this.handleTouchEnd=this.handleTouchEnd.bind(this)}dispose(){var t;(t=this.element)===null||t===void 0?void 0: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){t.preventDefault();const i=t.touches[0];this.currentPosition1=a.create(i.screenX,i.screenY);if(t.touches[1]!=null){this.beginTwoPointTouch(this.currentPosition1,a.create(t.touches[1].screenX,t.touches[1].screenY))}window.addEventListener("touchmove",this.handleTouchMove,{passive:false});window.addEventListener("touchend",this.handleTouchEnd)}}handleTouchMove(t){t.preventDefault();if(t.touches.length===1){this.handleOnePointTouchMove(t.touches[0])}else if(t.touches.length===2){const i=a.create(t.touches[0].clientX,t.touches[0].clientY);const s=a.create(t.touches[1].clientX,t.touches[1].clientY);this.handleTwoPointTouchMove(i,s)}}handleTouchEnd(t){var i;t.preventDefault();(i=this.interactionApi)===null||i===void 0?void 0:i.endInteraction();this.isInteracting=false;window.removeEventListener("touchmove",this.handleTouchMove);window.removeEventListener("touchend",this.handleTouchEnd);this.endTwoPointTouch()}handleOnePointTouchMove(t){var i,s,n;const e=a.create(t.screenX,t.screenY);if(this.currentPosition1!=null){const t=a.subtract(e,this.currentPosition1);const o=((i=this.interactionApi)===null||i===void 0?void 0:i.pixelThreshold(true))||2;if(a.distance(e,this.currentPosition1)>=o||this.isInteracting){(s=this.interactionApi)===null||s===void 0?void 0:s.beginInteraction();(n=this.interactionApi)===null||n===void 0?void 0:n.rotateCamera(t);this.isInteracting=true}}this.currentPosition1=e}}const Ei={clearMarks:()=>undefined,clearMeasures:()=>undefined,getEntriesByName:()=>[],mark:()=>undefined,measure:()=>undefined};function xi(){var t;if(typeof window!=="undefined"){return window.performance}return(t=globalThis.performance)!==null&&t!==void 0?t:Ei}class Mi{constructor(t,i=xi()){this.name=t;this.perf=i;this.measures=new Set;this.nextId=0}clearMeasurements(){this.perf.clearMeasures(this.name)}measure(t){if(t instanceof Promise){const i=this.begin();return t.finally((()=>this.end(i)))}else if(typeof t==="function"){const i=this.begin();const s=t();this.end(i);return s}else{throw new Error("Input must be a function or Promise")}}takeMeasurements(){const t=this.perf.getEntriesByName(this.name);this.clearMeasurements();return t}takeLastMeasurement(){const t=this.takeMeasurements();return t[t.length-1]}begin(){const t=`${this.name}-${this.nextId++}`;this.measures.add(t);this.perf.mark(t);return t}end(t){this.perf.measure(this.name,t);this.perf.clearMarks(t);this.measures.delete(t)}}const Ri=new Mi("paint_time");function Bi(t){const i=new Uint8Array(t.byteLength);i.set(t);return i.buffer}function Li(t){return new Promise(((i,s)=>{const n=new Blob([Bi(t)]);const e=URL.createObjectURL(n);const o=new Image;o.addEventListener("load",(()=>{i({image:o,dispose:()=>undefined});URL.revokeObjectURL(e)}));o.addEventListener("error",(()=>{s(new M("Failed to load image data"));URL.revokeObjectURL(e)}));o.src=e}))}async function zi(t){const i=new Blob([Bi(t)]);const s=await window.createImageBitmap(i);return{image:s,dispose:()=>s.close()}}function Hi(t){if(window.createImageBitmap!=null){return zi(t)}else{return Li(t)}}const Ki=1e3;function Oi(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)}function $i(t,i){const s=t.takeMeasurements();if(s.length>0){i(s)}}function ji(t,i,s,n,e=Ki){let o;let a=0;let r;let h=[];function c(){a++;if(o==null){o=setInterval((()=>{$i(t,n);if(a===0){d()}}),e)}}function l(){a--}function d(){if(o!=null){clearInterval(o);o=undefined}}if(s){setInterval((()=>{if(r!=null){if(h.length===5){h=[...h.slice(1),r]}else{h.push(r)}const t=h.reduce(((t,i)=>t+i),0)/h.length;console.debug(`Paint rate: ${r}fps`);console.debug(`Paint rate (avg): ${t}`);r=undefined}}),1e3)}return s=>{c();return t.measure((async()=>{const t=await i(s);r=r==null?1:r+1;return t})).finally((()=>l()))}}function Vi(){let t=[];function i(i){if(i!=null){const s=i.copy({correlationIds:[...i.correlationIds,...t.filter((t=>!i.correlationIds.includes(t)))]});t=[];return s}return i}function s(){let t=-1;return async i=>{if(i.frame.sequenceNumber>t){const s=await Hi(i.frame.image.imageBytes);t=i.frame.sequenceNumber;return s}}}function n(){let t=-1;return async(i,s)=>{var n;if(s!=null&&i.frame.sequenceNumber>t){t=i.frame.sequenceNumber;(n=i.beforeDraw)===null||n===void 0?void 0:n.call(i);Oi(s,i);s.dispose();return i.frame}s===null||s===void 0?void 0:s.dispose()}}const e=s();const o=n();return async s=>{var n,a;const r=(a=(n=s.predicate)===null||n===void 0?void 0:n.call(s))!==null&&a!==void 0?a:true;t=[...t,...s.frame.correlationIds];if(r){return e(s).then((t=>o(s,t).then(i)))}}}function Fi(t){return i=>{var s;const n=(s=i.request.requestId)===null||s===void 0?void 0:s.value;if(n!=null){t(n)(i)}}}function Ni(t){return i=>{const{drawFrame:s}=i.request;if(s!=null){t(s)(i)}}}const Wi=1*60;function qi(t){let i=false;return s=>{const n=t();if(n!=null){const t=n.remoteTime(new Date(Date.now()));const e=m(s,t);const o=v(e).getTime();if(o>=0){return e}else{if(!i){console.warn(`Possible erroneous send to receive timing. Muting for ${Wi}s. [sent-at=${s.toISOString()}, received-at=${t.toISOString()}, remote-time=${n.knownRemoteTime.toISOString()}]`);i=true;setTimeout((()=>i=false),Wi*1e3)}return undefined}}}}function Ui(t,i){const s=qi(i);return Fi((i=>Ni((n=>n=>{const e=v(n.sentAtTime);if(e!=null){t.replyResult(i,{drawFrame:{sendToReceiveDuration:s(e)}})}}))))}var _i=F();const Ji=C.defineMapper(C.read(C.requiredProp("d"),C.requiredProp("ns"),C.mapRequiredProp("ka",et),C.mapRequiredProp("kd",et),C.mapRequiredProp("ks",et),C.mapRequiredProp("ke",et)),(([t,i,s,n,e,o])=>({opacity:t,glossiness:i,ambient:s,diffuse:n,specular:e,emissive:o})));const Xi=C.defineMapper(C.read(C.mapRequiredProp("defaultMaterial",(()=>Pt)),C.mapRequiredProp("colorMaterial",Ji)),(([t,i])=>({defaultMaterial:t,colorMaterial:i})));const Zi=C.defineMapper(C.read(C.requiredProp("name"),C.requiredProp("category")),(([t,i])=>({name:t,category:i})));const Gi=C.defineMapper(C.read(C.getProp("value")),(([t])=>({type:"string",value:t})));const Qi=C.mapProp("string",C.ifDefined(Gi));const Yi=C.defineMapper(C.read(C.getProp("value")),(([t])=>({type:"long",value:t})));const ts=C.mapProp("pb_long",C.ifDefined(Yi));const is=C.defineMapper(C.read(C.getProp("value")),(([t])=>({type:"double",value:t})));const ss=C.mapProp("pb_double",C.ifDefined(is));const ns=C.defineMapper(C.read(C.requiredProp("value")),(([t])=>({type:"timestamp",value:t})));const es=C.mapProp("date",C.ifDefined(ns));const os=C.compose(C.pickFirst(Qi,ts,ss,es),C.required("value"));const as=C.defineMapper(C.read(C.requiredProp("id"),C.mapProp("key",C.ifDefined(Zi)),C.mapProp("value",C.ifDefined(os))),(([t,i,s])=>({id:t,key:i,value:s})));const rs=C.defineMapper(C.read(C.mapProp("cursor",ot),C.mapRequiredProp("entriesList",C.mapArray(as))),(([t,i])=>({paging:{next:t},entries:i})));const hs=C.ifInvalidThrow(rs);const cs=C.defineMapper(C.read(C.mapRequiredProp("id",X),C.mapRequiredProp("createdAt",at),C.mapProp("materialOverride",C.ifDefined(Xi)),C.mapProp("transform",C.ifDefined(rt)),C.mapProp("isVisible",C.ifDefined(ht)),C.mapProp("isSelected",C.ifDefined(ht)),C.mapProp("isPhantom",C.ifDefined(ht)),C.mapProp("endItem",C.ifDefined(ht))),(([t,i,s,n,e,o,a,r])=>({id:t,createdAt:i,materialOverride:s,transform:n,isVisible:e,isSelected:o,isPhantom:a,endItem:r})));const ls=C.defineMapper(C.read(C.mapRequiredProp("id",X),C.mapRequiredProp("createdAt",at),C.mapRequiredProp("name",G),C.mapProp("parentId",C.ifDefined(X)),C.mapProp("suppliedId",C.ifDefined(G)),C.mapProp("boundingBox",C.ifDefined(ct)),C.mapProp("worldTransform",C.ifDefined(rt)),C.mapProp("override",C.ifDefined(cs))),(([t,i,s,n,e,o,a,r])=>({id:t,createdAt:i,name:s,parentId:n!==null&&n!==void 0?n:undefined,suppliedId:e,boundingBox:o,worldTransform:a,override:r})));const ds=C.ifInvalidThrow(C.defineMapper(C.read(C.mapProp("item",C.ifDefined(ls))),(([t])=>t!==null&&t!==void 0?t:undefined)));class us{constructor(t,i,s){this.client=t;this.jwtProvider=i;this.deviceIdProvider=s}async getSceneViewItem(t,i,s){const n=await N((async n=>{const e=this.deviceIdProvider();const o=await q(this.jwtProvider,e);const a=new V.GetSceneViewItemRequest;a.setSceneItemId(It(t));a.setViewId(It(i));const r=new _i.FieldMask;if(s.includeBoundingBox){r.addPaths("bounding_box")}if(s.includeWorldTransform){r.addPaths("world_transform")}if(s.includeOverride){r.addPaths("override")}a.setAdditionalFields(r);this.client.getSceneViewItem(a,o,n)}));return ds(n.toObject())}async listSceneItemMetadata(t,i){const s=await N((async s=>{const n=this.deviceIdProvider();const e=await q(this.jwtProvider,n);const o=new V.ListSceneItemMetadataRequest;o.setItemId(It(t));const a=new R.Pager;if(i.size!=null){a.setLimit(i.size)}if(i.cursor!=null){a.setCursor(i.cursor)}o.setPager(a);this.client.listSceneItemMetadata(o,e,s)}));return hs(s.toObject())}}var fs;(function(t){t["DEVICE_ID"]="vertexvis:device-id"})(fs||(fs={}));function ps(){if(typeof window==="undefined"){throw new Error("Local storage is not available.")}return window.localStorage}function ms(t,i,s=ps()){const n=s.getItem(t);if(n!=null){const e={...JSON.parse(n),...i};s.setItem(t,JSON.stringify(e))}else{s.setItem(t,JSON.stringify(i))}}function vs(t,i,s=ps()){const n=s.getItem(t);if(n!=null){return i(JSON.parse(n))}}function ws(t,i,s,n){return I.retry((()=>{if(!t.aborted){return i()}return Promise.resolve(s)}),n)}class gs extends w{constructor(t,i={}){var s,n,e,o,a;super(t,{loggingEnabled:i.loggingEnabled});this.state={type:"disconnected"};this.stateChanged=new S;this.dimensions=f.create(0,0);this.streamAttributes={};this.enableTemporalRefinement=(s=i.enableTemporalRefinement)!==null&&s!==void 0?s:true;this.frameBgColor=P.create(255,255,255);this.config=xt("platprod");this.options={tokenRefreshOffsetInSeconds:(n=i.tokenRefreshOffsetInSeconds)!==null&&n!==void 0?n:30,offlineThresholdInSeconds:(e=i.offlineThresholdInSeconds)!==null&&e!==void 0?e:30,loadTimeoutInSeconds:(o=i.loadTimeoutInSeconds)!==null&&o!==void 0?o:15,enableTemporalRefinement:(a=i.enableTemporalRefinement)!==null&&a!==void 0?a:true}}isPaused(){return this.pausedState!=null}getState(){return this.state}disconnect(){if(this.state.type!=="disconnected"&&this.state.type!=="connection-failed"){console.debug("Disconnecting websocket");this.state.connection.dispose();this.updateState({type:"disconnected"})}}async load(t,i,s,n=xt("platprod"),e){this.clientId=i;this.deviceId=s;this.config=n;if(this.state.type==="disconnected"){await this.loadIfDisconnected(t,e)}else if(this.state.type==="connection-failed"){await this.loadIfDisconnected(t,e)}else{await this.loadIfConnectingOrConnected(t,this.state,e)}return this.state}update(t){this.frameBgColor=t.frameBgColor?t.frameBgColor:this.frameBgColor;if(t.dimensions!=null&&!T(t.dimensions,this.dimensions)){this.dimensions=t.dimensions;this.ifState("connected",(()=>this.updateDimensions({dimensions:this.getDimensions(),resolution:Ss(this.getResolution())})))}const i=!T(this.streamAttributes,t.streamAttributes);if(t.streamAttributes!=null&&i){this.streamAttributes=t.streamAttributes;this.ifState("connected",(()=>this.updateStream({streamAttributes:ys(this.streamAttributes)})))}if(t.enableTemporalRefinement!=null&&t.enableTemporalRefinement!==this.enableTemporalRefinement){this.enableTemporalRefinement=t.enableTemporalRefinement;if(this.state.type==="connected"){this.closeAndReconnect(this.state)}}}pause(){if(this.state.type==="connected"){this.pausedState=this.state;console.debug(`Stream paused [stream-id=${this.pausedState.streamId}, scene-id=${this.pausedState.sceneId}, scene-view-id=${this.pausedState.sceneViewId}]`);this.disconnect()}}async resume(){if(this.pausedState!=null){console.debug(`Stream resumed [stream-id=${this.pausedState.streamId}, scene-id=${this.pausedState.sceneId}, scene-view-id=${this.pausedState.sceneViewId}]`);await this.connectToExistingStream(this.pausedState);this.pausedState=undefined}}async loadIfConnectingOrConnected(t,i,s){var n;const{resource:e,subResource:o}=i.resource;const a=Tt(t);const r=!k.isEqual(e,a.resource);const h=!k.isEqual(o,a.subResource);const c=i.type==="connecting"||i.type==="reconnecting";const l=i.type==="connected";if(r||c&&h){this.disconnect();return this.loadIfDisconnected(t)}else if(l&&h&&((n=a.subResource)===null||n===void 0?void 0:n.type)==="scene-view-state"){const t=a.queries.find((t=>t.type==="supplied-id"));const n={...a.subResource.id!=null?{sceneViewStateId:{hex:a.subResource.id}}:{},...t!=null?{sceneViewStateSuppliedId:{value:t.id}}:{},...s!=null?{cameraType:Cs(s)}:{}};await this.loadSceneViewState(n);this.updateState({...i,resource:a})}}async loadIfDisconnected(t,i){try{await this.connectWithNewStream(Tt(t),i)}catch(t){if(t instanceof B){this.updateState({type:"connection-failed",message:`Cannot load scene. ${t.message}`,error:t})}else if(t instanceof g){this.updateState({type:"connection-failed",message:`Cannot load scene. Stream request failed to start stream.`,error:t})}else{this.updateState({type:"connection-failed",message:`Cannot load scene for unknown reason. See console logs.`,error:t})}throw t}}connectWithNewStream(t,i){return this.openWebsocketStream(t,"connecting",(()=>this.requestNewStream(t,i)))}connectToExistingStream(t){return this.openWebsocketStream(t.resource,"reconnecting",(()=>this.requestReconnectStream(t)),{maxRetries:Number.POSITIVE_INFINITY})}async openWebsocketStream(t,i,s,{maxRetries:n=3}={}){var e;const o=Ps(Ts(this.config,t.resource,this.clientId,this.deviceId));console.debug(`Initiating WS connection [uri=${o.url}]`);(e=this.abortController)===null||e===void 0?void 0:e.abort();const a=new AbortController;this.abortController=a;const r=Is(this.config);this.updateState({type:i,resource:t,connection:{dispose:()=>{this.dispose();a.abort()}}});const h=await I.abort(a.signal,ws(a.signal,(()=>this.connect(o,r)),{dispose:()=>{}},{maxRetries:n,delaysInMs:gs.WS_RECONNECT_DELAYS})).catch((t=>{throw new L("Websocket connection failed.",t instanceof Error?t:undefined)}));if(!h.aborted){return this.requestNewOrExistingStream(t,h.result,s)}else{this.updateState({type:"disconnected"})}}async requestNewOrExistingStream(t,i,s){const n=this.requestClock();const e=await s();console.debug(`Stream connected [stream-id=${e.streamId}, scene-id=${e.sceneId}, scene-view-id=${e.sceneViewId}]`);const o=this.onRequest((t=>{const i=t.request.drawFrame;if(i!=null){const t=pt(e.worldOrientation)(i);if(this.state.type==="connected"){if(t.depthBufferBytes!=null||this.state.frame.temporalRefinementCorrelationId!==t.temporalRefinementCorrelationId){this.updateState({...this.state,frame:t,fallbackDepthBufferBytes:t.depthBufferBytes})}else{this.updateState({...this.state,frame:t.copy({depthBufferBytes:this.state.fallbackDepthBufferBytes})})}}}}));const a=this.reconnectWhenNeeded();const r=this.refreshTokenWhenExpired(e.token);const h=this.acknowledgeFrameRequests();const c=e.frame==null?await this.waitForFrame(e.worldOrientation,this.options.loadTimeoutInSeconds):e.frame;const l=await n;console.debug(`Synchronized clocks [local-time=${l.knownLocalTime.toISOString()}, remote-time=${l.knownRemoteTime.toISOString()}]`);this.updateState({type:"connected",connection:{dispose:()=>{a.dispose();o.dispose();r.dispose();h.dispose();i.dispose()}},resource:t,streamId:e.streamId,deviceId:e.deviceId,sceneId:e.sceneId,sceneViewId:e.sceneViewId,worldOrientation:e.worldOrientation,token:e.token,frame:c,clock:l,fallbackDepthBufferBytes:undefined})}async requestNewStream(t,i){var s,n;const e=t.queries.find((t=>t.type==="supplied-id"));const o=mt(await this.startStream({streamKey:{value:t.resource.id},dimensions:this.getDimensions(),resolution:Ss(this.getResolution()),frameBackgroundColor:bs(this.frameBgColor),clientSupportsTemporalRefinement:this.enableTemporalRefinement,streamAttributes:ys(this.streamAttributes),sceneViewStateId:((s=t.subResource)===null||s===void 0?void 0:s.type)==="scene-view-state"&&t.subResource.id!=null?{hex:t.subResource.id}:undefined,sceneViewStateSuppliedId:((n=t.subResource)===null||n===void 0?void 0:n.type)==="scene-view-state"&&e!=null?{value:e.id}:undefined,cameraType:i!=null?Cs(i):undefined}));return{resource:t,streamId:o.streamId,sceneId:o.sceneId,sceneViewId:o.sceneViewId,deviceId:o.sessionId,token:o.token,worldOrientation:o.worldOrientation,frame:undefined,fallbackDepthBufferBytes:undefined}}async requestReconnectStream(t){const i=vt(await this.reconnect({streamId:{hex:t.streamId},dimensions:this.getDimensions(),frameBackgroundColor:bs(this.frameBgColor),streamAttributes:ys(this.streamAttributes),clientSupportsTemporalRefinement:this.enableTemporalRefinement}));return{...t,token:i.token}}async requestClock(){const t=wt(await this.syncTime({requestTime:y()}));return new kt(t)}reconnectWhenNeeded(){const t=this.onClose((()=>{if(this.state.type==="connected"){this.closeAndReconnect(this.state)}}));const i=this.onRequest((t=>{const i=t.request.gracefulReconnection!=null;if(i&&this.state.type==="connected"){console.debug("Received request for graceful reconnect. Closing connection and attempting reconnect.");this.closeAndReconnect(this.state)}}));const s=this.reconnectWhenOffline();return{dispose:()=>{t.dispose();i.dispose();s.dispose()}}}refreshTokenWhenExpired(t){let i;const s=t=>{const{tokenRefreshOffsetInSeconds:n}=this.options;const e=t.remainingTimeInMs(n);i=window.setTimeout((async()=>{const t=await this.refreshToken();const i=gt(t);s(i);if(this.state.type==="connected"){this.updateState({...this.state,token:i})}}),e)};s(t);return{dispose:()=>clearTimeout(i)}}reconnectWhenOffline(){let t;const i=()=>window.clearTimeout(t);const s=()=>{i();const s=this.options.offlineThresholdInSeconds;console.debug(`Detected that host is offline. Will attempt reconnect in ${s}s.`);t=window.setTimeout((()=>{if(this.state.type==="connected"){this.closeAndReconnect(this.state)}}),s*1e3)};const n=()=>{console.debug("Detected that host is online.");i()};const e=()=>s();window.addEventListener("offline",e);window.addEventListener("online",n);return{dispose:()=>{i();window.removeEventListener("offline",e);window.removeEventListener("online",n)}}}closeAndReconnect(t){t.connection.dispose();return this.connectToExistingStream(t)}async waitForFrame(t,i){let s;try{return await I.timeout(i*1e3,new Promise((i=>{s=this.onRequest((n=>{try{const s=n.request.drawFrame;if(s!=null){const n=pt(t)(s);i(n)}}finally{s===null||s===void 0?void 0:s.dispose()}}))})))}catch(t){throw new z(`Frame timed out after ${i}s`,t instanceof Error?t:undefined)}finally{s===null||s===void 0?void 0:s.dispose()}}acknowledgeFrameRequests(){return this.onRequest(Ui(this,(()=>this.state.type==="connected"?this.state.clock:undefined)))}updateState(t){if(this.state!==t){this.state=t;this.stateChanged.emit(this.state)}}getDimensions(){if(f.area(this.dimensions)===0){return f.create(1,1)}return this.dimensions}getResolution(){if(window.devicePixelRatio!=null){return 96*window.devicePixelRatio}else{return 96}}ifState(t,i){if(this.state.type===t){return i()}}onStateChanged(t){return this.stateChanged.on(t)}}gs.WS_RECONNECT_DELAYS=[0,1e3,1e3,5e3];const ys=C.ifInvalidThrow(lt);const bs=C.ifInvalidThrow(dt);const Cs=C.ifInvalidThrow(ut);const Ss=C.ifInvalidThrow(ft);function Is(t){return{EXPERIMENTAL_frameDelivery:{...t.EXPERIMENTAL_frameDelivery,rateLimitingEnabled:t.flags.throttleFrameDelivery},EXPERIMENTAL_adaptiveRendering:{...t.EXPERIMENTAL_adaptiveRendering,enabled:t.flags.adaptiveRendering},EXPERIMENTAL_qualityOfService:{...t.EXPERIMENTAL_qualityOfService}}}function Ps(t){return{url:A.toString(t),protocols:["ws.vertexvis.com"]}}function Ts(t,i,s,n){if(s!=null){return A.appendPath(A.toString(A.parseAndAddParams("/ws",{clientId:s,deviceId:n})),A.parse(t.network.renderingHost))}else{return A.appendPath(`/stream-keys/${i.id}/session`,A.parse(t.network.renderingHost))}}class ks{constructor(t){this.callback=t;this.handleVisibilityChange=this.handleVisibilityChange.bind(this);this.emitVisibilityChange=this.emitVisibilityChange.bind(this);this.mutationObservers=[]}isVisible(t){if("checkVisibility"in t){return t.checkVisibility({visibilityProperty:true,opacityProperty:true})}return true}observe(t){this.targetElement=t;this.watchElementVisibility(t)}unobserve(){if(this.targetElement!=null){this.mutationObservers.forEach((t=>t.disconnect()));this.mutationObservers=[]}this.targetElement=undefined}disconnect(){this.mutationObservers.forEach((t=>t.disconnect()));this.mutationObservers=[]}watchElementVisibility(t){if(t!=null){const i=new MutationObserver(this.handleVisibilityChange);i.observe(t,{attributes:true,attributeFilter:["style","class","hidden"]});this.mutationObservers=[...this.mutationObservers,i];this.watchElementVisibility(t.parentElement)}}handleVisibilityChange(){if(this.targetElement!=null){this.emitVisibilityChange(this.targetElement)}}emitVisibilityChange(t){const i=t!=null?this.isVisible(t):true;console.debug(`Detected visibility change [visible={${i}}]`);this.callback(i)}}const As=15e3;function Ds(t){return t.getBoundingClientRect()}function Es(t,i){const s=window.getComputedStyle(t);const n=s.getPropertyValue(i);return n!==""?n:undefined}const xs=()=>`button{border:none;background:transparent;cursor:pointer;margin:0;padding:0}.button{padding:0.5rem;border-radius:0.25rem}.button-secondary{color:var(--neutral-800);background-color:var(--neutral-300)}.button-secondary:hover{color:var(--neutral-900)}.button-secondary:hover:enabled{box-shadow:0 2px 2px rgb(0 0 0 / 20%)}.button-secondary:disabled{opacity:0.8}.button-secondary:hover:disabled{cursor:not-allowed}: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;user-select:none;-webkit-user-select:none}.canvas-container{display:flex;justify-content:center;align-items:center;width:100%;height:100%;position:relative}.enable-pointer-events{touch-action:none}.viewer-container{width:100%;height:100%;overflow:hidden}.error-message-wrapper{align-items:center;display:flex;flex-direction:column;gap:1rem;position:absolute;top:50%;width:100%;transform:translateY(-50%);text-align:center}.error-message{font-size:0.875rem}`;const Ms=i(class t extends s{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow();this.tap=n(this,"tap");this.doubletap=n(this,"doubletap");this.longpress=n(this,"longpress");this.frameReceived=n(this,"frameReceived");this.frameDrawn=n(this,"frameDrawn");this.tokenExpired=n(this,"tokenExpired");this.connectionChange=n(this,"connectionChange");this.sceneReady=n(this,"sceneReady");this.sceneChanged=n(this,"sceneChanged");this.interactionStarted=n(this,"interactionStarted");this.interactionFinished=n(this,"interactionFinished");this.cameraTypeChanged=n(this,"cameraTypeChanged");this.annotationStateChanged=n(this,"annotationStateChanged");this.deviceIdChange=n(this,"deviceIdChange");this.dimensionschange=n(this,"dimensionschange");this.configEnv="platprod";this.cameraControls=true;this.cameraType="perspective";this.keyboardControls=true;this.rotateAroundTapPoint=true;this.phantom={opacity:.1};this.noDefaultLights=false;this.enableTemporalRefinement=true;this.experimentalRenderingOptions="";this.crossSectioning={endCapEnabled:true,endCapColor:undefined};this.resizeDebounce=100;this.viewport=Lt.fromDimensions(f.create(0,0));this.experimentalSkipVisibilityCheck=false;this.stateMap={cursorManager:new Mt,streamState:{type:"disconnected"}};this.isVisible=false;this.frameRenderVersion=0;this.interactionHandlers=[];this.defaultInteractionHandlerDisposables=[];this.tapKeyInteractions=[];this.defaultTapKeyInteractions=[];this.internalFrameDrawnDispatcher=new S;this.handleUpdateStreamAttributesWithTimer=()=>{const t=50;if(this.streamAttributesUpdateTimer==null){this.streamAttributesUpdateTimer=setTimeout((()=>{this.streamAttributesUpdateTimer=undefined;this.updateStreamAttributes()}),t)}};this.handleRetry=()=>{this.reload().catch((t=>{console.error("Error reloading scene",t)}))};this.handleElementResize=this.handleElementResize.bind(this);this.handleVisibilityChange=this.handleVisibilityChange.bind(this)}connectedCallback(){var t,i,s;(t=this.stencilBuffer)!==null&&t!==void 0?t:this.stencilBuffer=new jt(this.hostElement);this.visibilityObserver=new ks(this.handleVisibilityChange);this.isVisible=this.visibilityObserver.isVisible(this.hostElement);if(!this.isVisible){(i=this.visibilityObserver)===null||i===void 0?void 0:i.observe(this.hostElement)}(s=this.stream)===null||s===void 0?void 0:s.resume()}componentWillLoad(){var t;this.updateResolvedConfig();this.calculateComponentDimensions();this.resizeObserver=new ResizeObserver(this.handleElementResize);this.registerSlotChangeListeners();const i=this.getResolvedConfig();const s=new p.SceneViewAPIClient(i.network.sceneViewHost);this.annotations=new Xt(s,(()=>this.token),(()=>this.deviceId));this.annotations.onStateChange.on((t=>{this.annotationStateChanged.emit(t);const i=Object.keys(t.annotations).length;this.handleAnnotationSetsChange(i)}));this.stream=(t=this.stream)!==null&&t!==void 0?t:new gs(new b,{loggingEnabled:i.flags.logWsMessages,enableTemporalRefinement:this.enableTemporalRefinement});this.addStreamListeners();this.modelViews=new At(s,this.stream,(()=>this.token),(()=>this.deviceId));this.pmi=new Dt(s,(()=>this.token),(()=>this.deviceId));this.sceneItems=new us(s,(()=>this.token),(()=>this.deviceId));this.canvases=new hi(s,(()=>this.token),(()=>this.deviceId));this.updateStreamAttributes();this.stateMap.cursorManager.onChanged.on((()=>this.handleCursorChanged()))}async componentDidLoad(){var t,i,s;this.interactionApi=this.createInteractionApi();this.isVisible=(i=(t=this.visibilityObserver)===null||t===void 0?void 0:t.isVisible(this.hostElement))!==null&&i!==void 0?i:true;if(this.canvasContainerElement!=null){(s=this.resizeObserver)===null||s===void 0?void 0:s.observe(this.canvasContainerElement)}this.loadOrResumeStream().catch((t=>{console.error("Error loading scene",t)}));await this.initializeDefaultInteractionHandlers();this.injectViewerApi()}disconnectedCallback(){var t,i,s;(t=this.visibilityObserver)===null||t===void 0?void 0:t.disconnect();(i=this.annotations)===null||i===void 0?void 0:i.disconnect();(s=this.stream)===null||s===void 0?void 0:s.pause()}render(){var t;return e(o,{key:"9f432c1405929448b4ded4c458d70c36781d4a7d"},e("div",{key:"1963c4b6d17b168e87a652da2190d10923ea4ce5",ref:t=>this.viewerContainerElement=t,class:"viewer-container",style:{cursor:Bt((t=this.cursor)!==null&&t!==void 0?t:"")},onContextMenu:t=>t.preventDefault()},e("div",{key:"dc2a675091f94c47c87f24a43cf7e9cd603a8af2",ref:t=>this.canvasContainerElement=t,class:E("canvas-container",{"enable-pointer-events ":window.PointerEvent!=null})},e("canvas",{key:"604cdad20b6fc50c6a06e3e5ec4fdc8ee6b71d8f",ref:t=>{this.canvasElement=t;this.stateMap.interactionTarget=t},class:"canvas"}),this.errorMessage!=null?e("div",{class:"error-message-wrapper",role:"alert"},e("span",{class:"error-message"},this.errorMessage),e("slot",{name:"retry"},e("button",{class:"button button-secondary",type:"button",onClick:this.handleRetry},"Retry"))):null),e("slot",{key:"a09eb09541a5b3bfb8943a62e0d37f100a2fde25"})))}async dispatchFrameDrawn(t){this.frame=t;this.internalFrameDrawnDispatcher.emit(t);this.frameDrawn.emit(t)}async registerInteractionHandler(t){this.interactionHandlers.push(t);this.initializeInteractionHandler(t);return{dispose:()=>{const i=this.interactionHandlers.indexOf(t);if(i!==-1){this.interactionHandlers[i].dispose();this.interactionHandlers.splice(i,1)}}}}async registerBasicInteractionHandler(t){this.interactionHandlers.push(t);this.initializeBasicInteractionHandler(t);return{dispose:()=>{const i=this.interactionHandlers.indexOf(t);if(i!==-1){this.interactionHandlers[i].dispose();this.interactionHandlers.splice(i,1)}}}}async registerTapKeyInteraction(t){this.tapKeyInteractions=[...this.tapKeyInteractions,t]}async getInteractionTarget_DEPRECATED(){if(this.stateMap.interactionTarget!=null){return this.stateMap.interactionTarget}else throw new Error("Interaction target is undefined.")}async addCursor(t,i){return this.stateMap.cursorManager.add(t,i)}async getInteractionHandlers(){return this.interactionHandlers}async getKeyInteractions(){return this.tapKeyInteractions}async getBaseInteractionHandler(){return this.baseInteractionHandler}async getJwt(){return this.token}handleSrcChanged(t){if(t!=null){this.load(t,{cameraType:this.cameraType})}else{this.unload()}}handleCameraControlsChanged(){this.initializeDefaultCameraInteractionHandlers()}handleKeyboardControlsChanged(){this.initializeDefaultKeyboardInteractionHandlers()}handleRotateAboutTapPointChanged(){var t,i;this.updateStreamAttributes();if(this.rotateAroundTapPoint){(t=this.baseInteractionHandler)===null||t===void 0?void 0:t.setPrimaryInteractionType("rotate-point")}else{(i=this.baseInteractionHandler)===null||i===void 0?void 0:i.setPrimaryInteractionType("rotate")}}handleCameraTypeChanged(t,i){if(t!==i){this.updateCameraType()}}handleStreamAttributesChanged(){this.handleUpdateStreamAttributesWithTimer()}handleEnableTemporalRefinementChanged(){this.updateEnableTemporalRefinement()}handleConfigChanged(){this.updateResolvedConfig()}handleConfigEnvChanged(){this.updateResolvedConfig()}async load(t,i){var s,n;const e=this.experimentalSkipVisibilityCheck||this.isVisible;if(!e){console.debug("Detected the viewer is hidden. Delaying load until visible.");return}if(this.stream!=null&&this.dimensions!=null){const{EXPERIMENTAL_annotationPollingIntervalInMs:e}=this.getResolvedConfig();this.calculateComponentDimensions();this.stream.update({streamAttributes:this.getStreamAttributes(),config:xt(this.configEnv,this.config),dimensions:this.dimensions,frameBgColor:this.getBackgroundColor()});const o=await((s=this.stream)===null||s===void 0?void 0:s.load(t,this.clientId,this.getDeviceId(),this.getResolvedConfig(),i===null||i===void 0?void 0:i.cameraType));if(o.type==="connected"){this.sceneReady.emit();if(e!==undefined){(n=this.annotations)===null||n===void 0?void 0:n.connect(e)}}}else{throw new H("Cannot load scene. Viewer has not been initialized.")}}async unload(){var t;if(this.stream!=null){this.frameRenderVersion+=1;(t=this.annotations)===null||t===void 0?void 0:t.disconnect();this.stream.disconnect();this.frame=undefined;this.errorMessage=undefined}if(this.canvasElement!=null){const t=this.canvasElement.getContext("2d");if(t!=null){t.clearRect(0,0,this.canvasElement.width,this.canvasElement.height)}}}async reload(){if(this.src!=null){await this.unload();await this.load(this.src,{cameraType:this.cameraType})}}async scene(){return this.createScene()}async isSceneReady(){return this.stateMap.streamState.type==="connected"}async handleTapEvent(t){this.tapKeyInteractions.filter((i=>i.predicate(t.detail))).forEach((i=>i.fn(t.detail)))}emitConnectionChange(t){if(t.status==="connected"){if(t.jwt.length===0){throw new K("JWT is empty")}}if(!this.hostElement.isConnected){return}this.connectionChange.emit(t)}handleElementResize(t){const i=t.length>0&&this.dimensions!=null&&!f.isEqual(t[0].contentRect,this.viewport);if(i){if(this.resizeTimer!=null){clearTimeout(this.resizeTimer);this.resizeTimer=undefined}if(!this.isResizing){this.resizeTimer=setTimeout((()=>{this.isResizing=true;this.isResizeUpdate=true;this.recalculateComponentDimensions()}),this.resizeDebounce)}}}handleVisibilityChange(t){var i;this.isVisible=t;if(this.isVisible){(i=this.visibilityObserver)===null||i===void 0?void 0:i.disconnect();this.loadOrResumeStream()}}async loadOrResumeStream(){var t,i,s;const n=(i=(t=this.stream)===null||t===void 0?void 0:t.isPaused())!==null&&i!==void 0?i:false;if(this.src!=null&&!n){await this.load(this.src,{cameraType:this.cameraType})}else if(n){(s=this.stream)===null||s===void 0?void 0:s.resume()}}registerSlotChangeListeners(){this.mutationObserver=new MutationObserver((t=>this.injectViewerApi()));this.mutationObserver.observe(this.hostElement,{childList:true,subtree:true});this.styleObserver=new MutationObserver((t=>this.syncViewerStyles()));this.styleObserver.observe(this.hostElement,{attributes:true,attributeFilter:["style"]})}injectViewerApi(){function t(t){return Array.from(t.querySelectorAll("*"))}const i=t(this.hostElement);i.filter((t=>t.nodeName.startsWith("VERTEX-"))).reduce(((i,s)=>[...i,s,...t(s)]),[]).forEach((t=>{t.viewer=this.hostElement}))}syncViewerStyles(){var t;const i=this.getBackgroundColor();(t=this.stream)===null||t===void 0?void 0:t.update({frameBgColor:i,streamAttributes:this.getStreamAttributes()})}calculateComponentDimensions(){var t;const i=2073600;const s=this.getBounds();if((s===null||s===void 0?void 0:s.width)!=null&&(s===null||s===void 0?void 0:s.height)!=null){const n=f.create(s.width,s.height);const e=f.scaleFit(i,n);this.hostDimensions=n;this.dimensions=e!=null?f.create(e.width,e.height):undefined;this.viewport=Lt.fromDimensions((t=this.getCanvasDimensions())!==null&&t!==void 0?t:f.create(0,0))}}recalculateComponentDimensions(){var t;if(this.isResizing){this.calculateComponentDimensions();this.isResizing=false;if(((t=this.stream)===null||t===void 0?void 0:t.getState().type)==="connected"){this.updateDimensions(this.dimensions)}}}reportPerformance(t){if(this.stateMap.streamState.type==="connected"){const i={timings:t.map((t=>({receiveToPaintDuration:m(t.duration)})))};this.getStream().recordPerformance(i,false)}}addStreamListeners(){this.stateMap.streamListeners=this.getStream().stateChanged.on((t=>{this.handleStreamStateChanged(this.stateMap.streamState,t)}))}handleStreamStateChanged(t,i){this.stateMap.streamState=i;if(i.type==="connecting"){this.handleConnecting(t,i)}else if(i.type==="connected"){this.handleConnected(t,i)}else if(i.type==="connection-failed"){this.handleConnectionFailed(t,i)}else if(i.type==="disconnected"){this.handleDisconnected(t,i)}}handleConnecting(t,i){if(t.type!=="connecting"){this.token=undefined;this.errorMessage=undefined;this.emitConnectionChange({status:"connecting"})}}handleConnected(t,i){var s;this.token=i.token.token;if(t.type!=="connected"){this.errorMessage=undefined;this.canvasRenderer=ji(Ri,Vi(),this.getResolvedConfig().flags.logFrameRate,(t=>this.reportPerformance(t)));this.emitConnectionChange({status:"connected",jwt:i.token.token});this.deviceIdChange.emit(i.deviceId)}if(((s=this.frame)===null||s===void 0?void 0:s.getId())!==i.frame.getId()){this.updateFrame(i.frame)}this.updateDimensions(this.dimensions)}handleConnectionFailed(t,i){if(t.type!=="connection-failed"){this.token=undefined;this.errorMessage=i.message;this.emitConnectionChange({status:"connection-failed",errorMessage:i.message})}}handleDisconnected(t,i){if(t.type!=="disconnected"){this.token=undefined;this.errorMessage=undefined;this.emitConnectionChange({status:"disconnected"})}}updateDimensions(t){var i;(i=this.stream)===null||i===void 0?void 0:i.update({dimensions:t});this.dimensionschange.emit(t)}async updateFrame(t){var i;const s=this.getCanvasDimensions();const n=this.frameRenderVersion;if(this.canvasElement!=null&&s!=null&&((i=this.frame)===null||i===void 0?void 0:i.getId())!==t.getId()){const i=this.canvasElement.getContext("2d");if(i!=null){const e=this.frame;this.frame=yt(t,e);this.updateInteractionApi(e);const o={canvas:i,canvasDimensions:s,dimensions:this.dimensions,frame:this.frame,viewport:this.viewport,beforeDraw:()=>{this.updateCanvasDimensions(s);this.isResizeUpdate=false},predicate:()=>{if(this.isResizeUpdate){return this.dimensions==null||f.isEqual(this.dimensions,o.frame.image.imageAttr.frameDimensions)}return true}};this.frameReceived.emit(this.frame);if(this.frame.scene.hasChanged){this.sceneChanged.emit()}const a=await this.canvasRenderer(o);if(a!=null&&n===this.frameRenderVersion){this.updateViewerBackground();this.dispatchFrameDrawn(a)}}}}updateViewerBackground(){const t=this.getBackgroundColor();Kt((()=>{var i,s;(i=this.viewerContainerElement)===null||i===void 0?void 0:i.style.setProperty("background",t!=null?P.toHexString(t):"#ffffff");(s=this.canvasContainerElement)===null||s===void 0?void 0:s.style.setProperty("background",t!=null?P.toHexString(t):"#ffffff")}))}async initializeDefaultInteractionHandlers(){var t;await this.initializeDefaultCameraInteractionHandlers();await this.initializeDefaultTapInteractionHandler();this.initializeDefaultKeyboardInteractionHandlers();if(this.rotateAroundTapPoint){(t=this.baseInteractionHandler)===null||t===void 0?void 0:t.setPrimaryInteractionType("rotate-point")}}clearDefaultCameraInteractionHandlers(){this.defaultInteractionHandlerDisposables.forEach((t=>t.dispose()));this.defaultInteractionHandlerDisposables=[]}clearDefaultKeyboardInteractions(){this.defaultTapKeyInteractions.forEach((t=>{const i=this.tapKeyInteractions.indexOf(t);if(i!==-1){this.tapKeyInteractions.splice(i,1)}}));this.tapKeyInteractions=[]}async initializeDefaultCameraInteractionHandlers(){var t,i;this.clearDefaultCameraInteractionHandlers();if(this.cameraControls){if(window.PointerEvent!=null){this.baseInteractionHandler=(t=this.baseInteractionHandler)!==null&&t!==void 0?t:new ki((()=>this.getResolvedConfig()));const i=await this.registerInteractionHandler(this.baseInteractionHandler);const s=await this.registerInteractionHandler(new Ti);this.defaultInteractionHandlerDisposables=[i,s]}else{this.baseInteractionHandler=(i=this.baseInteractionHandler)!==null&&i!==void 0?i:new Si((()=>this.getResolvedConfig()));const t=await this.registerInteractionHandler(this.baseInteractionHandler);const s=await this.registerInteractionHandler(new Di);this.defaultInteractionHandlerDisposables=[t,s]}}}initializeDefaultKeyboardInteractionHandlers(){var t;this.clearDefaultKeyboardInteractions();if(this.keyboardControls&&this.stream!=null){(t=this.baseInteractionHandler)===null||t===void 0?void 0:t.setDefaultKeyboardControls(this.keyboardControls);const i=new ci(this.stream,(()=>this.getResolvedConfig()),(()=>this.getImageScale()));const s=new pi(this.stream,(()=>this.getResolvedConfig()),(()=>this.getImageScale()),(()=>this.createScene()));this.registerTapKeyInteraction(i);this.registerTapKeyInteraction(s);this.defaultTapKeyInteractions=[i,s]}}async initializeDefaultTapInteractionHandler(){if(this.tapHandlerDisposable==null){if(window.PointerEvent!=null){const t=new Ai("pointerdown","pointerup","pointermove",(()=>this.getResolvedConfig()));this.tapHandlerDisposable=await this.registerInteractionHandler(t)}else{const t=new Ai("mousedown","mouseup","mousemove",(()=>this.getResolvedConfig()));this.tapHandlerDisposable=await this.registerInteractionHandler(t)}}}initializeInteractionHandler(t){if(this.stateMap.interactionTarget==null){throw new O("Cannot initialize interaction handler. Interaction target is undefined.")}if(this.interactionApi==null){throw new O("Cannot initialize interaction handler. Interaction APi is undefined.")}t.initialize(this.stateMap.interactionTarget,this.interactionApi)}initializeBasicInteractionHandler(t){if(this.stateMap.interactionTarget==null){throw new O("Cannot initialize interaction handler. Interaction target is undefined.")}t.initialize(this.stateMap.interactionTarget)}createInteractionApi(){if(this.stream==null){throw new $("Cannot create interaction API. Component has not been initialized.")}return this.frame==null||this.frame.scene.camera.isPerspective()?new fi(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 di(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()}))}async createScene(){const t=await this.waitForConnectedState();const i=bt();const{frame:s,sceneId:n,sceneViewId:e,worldOrientation:o}=t;return new Et(this.getStream(),s,pt(o),i,(()=>this.getImageScale()),this.viewport,n,e)}getBackgroundColor(){if(this.canvasContainerElement!=null){const t=Es(this.hostElement,"--image-background");const i=Es(this.hostElement,"--viewer-background");const s=t!==null&&t!==void 0?t:i;return s!=null?P.fromCss(s):P.create(255,255,255)}}getBounds(){return Ds(this.hostElement)}getCanvasDimensions(){return this.getResolvedConfig().flags.letterboxFrames?this.dimensions:this.hostDimensions}getImageScale(){const t=this.getCanvasDimensions();if(this.dimensions!=null&&t!=null){return a.create(this.dimensions.width/t.width,this.dimensions.height/t.height)}}getStreamAttributes(){return{depthBuffers:this.getDepthBufferStreamAttributesValue(),experimentalRenderingOptions:this.experimentalRenderingOptions,featureHighlighting:this.featureHighlighting,featureLines:this.featureLines,featureMaps:this.featureMaps,frames:{frameBackgroundColor:this.getBackgroundColor()},noDefaultLights:this.noDefaultLights,phantom:this.phantom,sceneComparison:this.sceneComparison,selectionHighlighting:this.selectionHighlighting,crossSectioning:this.crossSectioning}}updateCanvasDimensions(t){if(this.canvasElement!=null){this.canvasElement.width=t.width;this.canvasElement.height=t.height}}updateStreamAttributes(){var t;(t=this.stream)===null||t===void 0?void 0:t.update({streamAttributes:this.getStreamAttributes()})}updateEnableTemporalRefinement(){var t;(t=this.stream)===null||t===void 0?void 0:t.update({enableTemporalRefinement:this.enableTemporalRefinement})}updateInteractionApi(t){if(this.frame!=null){const i=(t==null||t.scene.camera.isPerspective())&&this.frame.scene.camera.isOrthographic();const s=(t==null||t.scene.camera.isOrthographic())&&this.frame.scene.camera.isPerspective();if(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;if(this.frame!=null){if(this.cameraType==="orthographic"&&this.frame.scene.camera.isPerspective()){(t=this.stream)===null||t===void 0?void 0:t.replaceCamera({camera:nt(Ct(this.frame.scene.camera,this.frame.scene.boundingBox))})}else if(this.cameraType==="perspective"&&this.frame.scene.camera.isOrthographic()){(i=this.stream)===null||i===void 0?void 0:i.replaceCamera({camera:nt(St(this.frame.scene.camera))})}}}handleAnnotationSetsChange(t){if(t>0&&this.getDepthBufferStreamAttributesValue()==null){this.stateMap.depthBuffersOverrideForAnnotations=true;this.updateStreamAttributes()}else if(t===0&&this.stateMap.depthBuffersOverrideForAnnotations){this.stateMap.depthBuffersOverrideForAnnotations=false;this.updateStreamAttributes()}}getDepthBufferStreamAttributesValue(){var t;const i=(t=this.depthBuffers)!==null&&t!==void 0?t:this.rotateAroundTapPoint||this.stateMap.depthBuffersOverrideForAnnotations?"final":undefined;return i}updateResolvedConfig(){this.resolvedConfig=xt(this.configEnv,this.config)}getResolvedConfig(){return Rs("Resolved config is undefined",(()=>this.resolvedConfig))}getStream(){return Rs("Stream is undefined",(()=>this.stream))}getDeviceId(){if(this.deviceId==null){try{this.deviceId=vs(fs.DEVICE_ID,(t=>t["device-id"]))}catch(t){console.warn("Cannot read device ID. Local storage is not supported.")}if(this.deviceId==null){this.deviceId=D.create();try{ms(fs.DEVICE_ID,{["device-id"]:this.deviceId})}catch(t){console.warn("Cannot write device ID. Local storage is not supported.")}}}return this.deviceId}async waitForConnectedState(){if(this.stateMap.streamState.type!=="connected"){console.debug("Stream was not in a connected state. Waiting for successful connection.");return new Promise(((t,i)=>{const s=this.getStream().onStateChanged((i=>{if(i.type==="connected"){t(i)}}));setTimeout((()=>{s.dispose();i(new Error("Timed out waiting for connected state."))}),As)}))}return this.stateMap.streamState}get hostElement(){return this}static get watchers(){return{src:[{handleSrcChanged:0}],cameraControls:[{handleCameraControlsChanged:0}],keyboardControls:[{handleKeyboardControlsChanged:0}],rotateAroundTapPoint:[{handleRotateAboutTapPointChanged:0}],cameraType:[{handleCameraTypeChanged:0}],crossSectioning:[{handleStreamAttributesChanged:0}],depthBuffers:[{handleStreamAttributesChanged:0}],experimentalRenderingOptions:[{handleStreamAttributesChanged:0}],featureHighlighting:[{handleStreamAttributesChanged:0}],featureLines:[{handleStreamAttributesChanged:0}],featureMaps:[{handleStreamAttributesChanged:0}],noDefaultLights:[{handleStreamAttributesChanged:0}],phantom:[{handleStreamAttributesChanged:0}],sceneComparison:[{handleStreamAttributesChanged:0}],selectionHighlighting:[{handleStreamAttributesChanged:0}],enableTemporalRefinement:[{handleEnableTemporalRefinementChanged:0}],config:[{handleConfigChanged:0}],configEnv:[{handleConfigEnvChanged:0}]}}static get style(){return xs()}},[257,"vertex-viewer",{src:[1],clientId:[1,"client-id"],deviceId:[1025,"device-id"],config:[1],configEnv:[1,"config-env"],resolvedConfig:[1040],cameraControls:[4,"camera-controls"],cameraType:[1537,"camera-type"],keyboardControls:[4,"keyboard-controls"],rotateAroundTapPoint:[4,"rotate-around-tap-point"],token:[1025],depthBuffers:[1,"depth-buffers"],phantom:[16],noDefaultLights:[4,"no-default-lights"],enableTemporalRefinement:[4,"enable-temporal-refinement"],experimentalRenderingOptions:[1,"experimental-rendering-options"],featureLines:[16],selectionHighlighting:[16],featureHighlighting:[16],sceneComparison:[16],crossSectioning:[16],featureMaps:[1,"feature-maps"],resizeDebounce:[2,"resize-debounce"],frame:[1040],stream:[1040],stencilBuffer:[1040],viewport:[1040],annotations:[1040],modelViews:[1040],pmi:[1040],sceneItems:[1040],canvases:[1040],experimentalSkipVisibilityCheck:[4,"experimental-skip-visibility-check"],dimensions:[32],hostDimensions:[32],errorMessage:[32],cursor:[32],stateMap:[32],dispatchFrameDrawn:[64],registerInteractionHandler:[64],registerBasicInteractionHandler:[64],registerTapKeyInteraction:[64],getInteractionTarget_DEPRECATED:[64],addCursor:[64],getInteractionHandlers:[64],getKeyInteractions:[64],getBaseInteractionHandler:[64],getJwt:[64],load:[64],unload:[64],reload:[64],scene:[64],isSceneReady:[64]},[[0,"tap","handleTapEvent"]],{src:[{handleSrcChanged:0}],cameraControls:[{handleCameraControlsChanged:0}],keyboardControls:[{handleKeyboardControlsChanged:0}],rotateAroundTapPoint:[{handleRotateAboutTapPointChanged:0}],cameraType:[{handleCameraTypeChanged:0}],crossSectioning:[{handleStreamAttributesChanged:0}],depthBuffers:[{handleStreamAttributesChanged:0}],experimentalRenderingOptions:[{handleStreamAttributesChanged:0}],featureHighlighting:[{handleStreamAttributesChanged:0}],featureLines:[{handleStreamAttributesChanged:0}],featureMaps:[{handleStreamAttributesChanged:0}],noDefaultLights:[{handleStreamAttributesChanged:0}],phantom:[{handleStreamAttributesChanged:0}],sceneComparison:[{handleStreamAttributesChanged:0}],selectionHighlighting:[{handleStreamAttributesChanged:0}],enableTemporalRefinement:[{handleEnableTemporalRefinementChanged:0}],config:[{handleConfigChanged:0}],configEnv:[{handleConfigEnvChanged:0}]}]);function Rs(t,i){const s=i();if(s!=null){return s}else throw new Error(t)}function Bs(){if(typeof customElements==="undefined"){return}const i=["vertex-viewer"];i.forEach((i=>{switch(i){case"vertex-viewer":if(!customElements.get(t(i))){customElements.define(t(i),Ms)}break}}))}Bs();const Ls=Ms;const zs=Bs;export{Ls as VertexViewer,zs as defineCustomElement};
|
|
4
|
+
import{t,p as i,H as s,d as n,h as e,e as o}from"./p-Bb32XUUS.js";import{p as a,v as r,a as h,b as c,r as l,c as d,d as u,e as f}from"./p-2UsvOTHJ.js";import{s as p}from"./p-B2_E6tqs.js";import{t as m,p as v,S as w,a as g,c as y,W as b}from"./p-5kcpg4MZ.js";import{m as C,E as S,a as I,c as P,d as k,o as T,u as A,b as D}from"./p-CDM7zNn0.js";import{c as x}from"./p-C6gMOKYg.js";import{u as E,I as M,p as R,C as B,W as z,S as L,V as O,M as j,a as H,b as V}from"./p--8q6LyIm.js";import{p as $}from"./p-B8530k7R.js";import{s as K,r as N}from"./p-FRKLa468.js";import{r as F,a as W,c as U}from"./p-CioaIHsi.js";import{i as q,j as _,k as J,l as X,m as Z,n as G,o as Q,p as Y,q as tt,E as it,u as st,t as nt,r as et,s as ot,v as at,w as rt,x as ht,y as ct,z as lt,B as dt,C as ut,G as ft,H as pt,I as mt,J as vt,K as wt,L as gt,M as yt,N as bt,P as Ct,Q as St}from"./p-BjvjKoy7.js";import{t as It,m as Pt,n as kt,j as Tt,M as At,k as Dt,S as xt}from"./p-CSVgoQU8.js";import{p as Et}from"./p-5bk1mHRt.js";import{C as Mt}from"./p-DxMDDbmh.js";import{g as Rt,c as Bt}from"./p-CPROw2BU.js";import{V as zt}from"./p-CeZe0Qql.js";import{B as Lt,M as Ot}from"./p-Ng27jBsS.js";import{w as jt}from"./p-Cd7kap5W.js";const Ht=0;const Vt=255;class $t{constructor(t){this.viewer=t;this.handleInteractionStarted=()=>{this.invalidateStencilBuffer();this.pendingInteractionFinished=new Promise((t=>{this.pendingInteractionFinishedResolver=t}))};this.handleInteractionFinished=()=>{var t;(t=this.pendingInteractionFinishedResolver)===null||t===void 0?void 0:t.call(this);this.pendingInteractionFinished=undefined;this.pendingInteractionFinishedResolver=undefined};this.invalidateStencilBuffer=()=>{this.pendingStencilBuffer=undefined};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();const s=i?await this.viewer.scene():undefined;const n=s!=null?s.crossSectioning().current().sectionPlanes.length>0||this.viewer.featureLines!=null:false;const e=(t=this.viewer.frame)===null||t===void 0?void 0:t.scene.camera;if(n&&this.viewer.stream!=null&&e!=null){const t=await this.viewer.stream.getStencilBuffer({includeDepthBuffer:true});const{stencilBuffer:i,depthBuffer:s,imageAttributes:n}=q(t);const[o,a]=await Promise.all([_(new Uint8Array(i)),_(new Uint8Array(s))]);return Kt.fromPng(o,n,i,J.fromPng(a,e,n))}else return undefined}latest(){if(this.pendingStencilBuffer==null){this.pendingStencilBuffer=this.fetch()}return this.pendingStencilBuffer}async latestAfterInteraction(){await this.pendingInteractionFinished;return this.latest()}}class Kt{constructor(t,i,s,n,e){this.imageAttr=t;this.imageBytes=i;this.pixelBytes=s;this.imageChannels=n;this.depthBuffer=e}static fromPng(t,i,s,n){if(!(t.data instanceof Uint8Array)){throw new Error("Expected stencil PNG to have depth of 8-bit")}else if(t.channels!==1){throw new Error("Expected stencil PNG to have 1 color channel")}else{return new Kt(i,s,t.data,t.channels,n)}}getValue(t){const{width:i,height:s}=this.imageAttr.imageRect;const n=a.subtract(t,this.imageAttr.imageRect);const e=1/this.imageAttr.imageScale;const o=a.scale(n,e,e);if(o.x>=0&&o.y>=0&&o.x<i&&o.y<s){const t=Math.floor(o.x)+Math.floor(o.y)*i;const s=this.pixelBytes[t];return s}else return 0}hitTest(t){return this.getValue(t)!==Ht}snapToNearestPixel(t,i,s=()=>true){const n=i*2;const e=a.create(t.x-i,t.y-i);const o=[];for(let r=0;r<n*n;r++){const h=r%n;const c=Math.floor(r/n);const l=a.add(e,{x:h,y:c});if(a.distance(l,t)<=i){const t=this.getValue(l);if(t===Vt&&s(t)){o.push(l)}}}const r=o.sort(((i,s)=>a.distance(i,t)-a.distance(s,t)));const h=r[0];return h!=null?a.create(Math.floor(h.x)+.5,Math.floor(h.y)+.5):t}}function Nt(t){return new Promise((i=>setTimeout(i,t)))}const Ft=C.defineMapper(C.compose((t=>t.toObject()),C.read(C.mapRequiredProp("id",X),C.mapRequiredProp("createdAt",Z),C.mapRequiredProp("modifiedAt",Z),C.mapProp("name",G),C.mapProp("suppliedId",G))),(([t,i,s,n,e])=>({id:t,createdAt:i,modifiedAt:s,name:n,suppliedId:e})));const Wt=C.ifInvalidThrow(Ft);const Ut=C.defineMapper(C.compose((t=>t.toObject()),C.read(C.mapRequiredProp("id",X),C.mapRequiredProp("createdAt",Z),C.mapRequiredProp("modifiedAt",Z),C.mapProp("suppliedId",G),C.mapRequiredProp("data",(t=>{if(t.callout!=null){return _t(t.callout)}else if(t.customJson!=null){return Jt(t.customJson)}else{throw new Error("Undefined or unknown annotation data.")}})))),(([t,i,s,n,e])=>({id:t,createdAt:i,modifiedAt:s,suppliedId:n,data:e})));const qt=C.ifInvalidThrow(Ut);const _t=C.defineMapper(C.read(C.mapRequiredProp("position",Q),C.mapProp("icon",G),C.mapProp("primaryColor",G),C.mapProp("accentColor",G)),(([t,i,s,n])=>({type:"callout",position:t,icon:i,primaryColor:s,accentColor:n})));const Jt=C.defineMapper(C.read(C.requiredProp("type"),C.mapRequiredProp("jsonData",(t=>JSON.parse(t)))),(([t,i])=>({type:"custom",jsonType:t,jsonData:i})));class Xt{constructor(t,i,s){this.client=t;this.jwtProvider=i;this.deviceIdProvider=s;this.onStateChange=new S}async addAnnotationSet(t){await F((async i=>{const s=this.deviceIdProvider();const n=await U(this.jwtProvider,s);const e=new K.CreateSceneViewAnnotationSetRequest;const o=new E.Uuid;o.setHex(t);e.setSceneAnnotationSetId(o);this.client.createSceneViewAnnotationSet(e,n,i)}));return this.fetch()}disconnect(){if(this.connection!=null){this.connection.dispose();this.connection=undefined}}connect(t=1e4){this.disconnect();const i=this.pollAnnotationState(t);this.connection={dispose:()=>i.abort()}}async fetch(t={}){const i=await this.fetchAnnotationSetsAsArray();const s=await this.fetchAnnotationsAsArray(i);const n=(await Promise.all(s)).reduce(((t,[i,s])=>({annotations:{...t.annotations,[i.id]:s}})),{annotations:{}});if(t.signal==null||!t.signal.aborted){this.updateState(n)}return n}async removeAnnotationSet(t){await F((async i=>{const s=this.deviceIdProvider();const n=await U(this.jwtProvider,s);const e=new K.DeleteSceneViewAnnotationSetRequest;const o=new E.Uuid;o.setHex(t);e.setSceneAnnotationSetId(o);this.client.deleteSceneViewAnnotationSet(e,n,i)}));return this.fetch()}pollAnnotationState(t){const i=new AbortController;const s=async t=>{await this.fetch({signal:i.signal});if(!i.signal.aborted){await Nt(t);await s(t)}};I.abort(i.signal,s(t));return i}fetchAnnotationSets(){return W((t=>async i=>{const s=this.deviceIdProvider();const n=await U(this.jwtProvider,s);const e=new K.ListSceneViewAnnotationSetsRequest;if(t!=null){const i=new $.Pager;i.setCursor(t);i.setLimit(100);e.setPage(i)}this.client.listSceneViewAnnotationSets(e,n,i)}),(t=>{var i;return(i=t.toObject().nextCursor)===null||i===void 0?void 0:i.next}))}async fetchAnnotationSetsAsArray(){return(await I.asArray(this.fetchAnnotationSets())).flatMap((t=>t.getSceneAnnotationSetsList())).map((t=>Wt(t)))}fetchAnnotations(t){return W((i=>async s=>{const n=this.deviceIdProvider();const e=await U(this.jwtProvider,n);const o=new K.ListSceneAnnotationsRequest;const a=It(t);o.setSceneAnnotationSetId(a);if(i!=null){const t=new $.Pager;t.setCursor(i);t.setLimit(100);o.setPage(t)}this.client.listSceneAnnotations(o,e,s)}),(t=>{var i;return(i=t.toObject().nextCursor)===null||i===void 0?void 0:i.next}))}fetchAnnotationsAsArray(t){const i=t.map((async t=>{const i=(await I.asArray(this.fetchAnnotations(t.id))).flatMap((t=>t.getSceneAnnotationsList())).map((t=>qt(t)));return[t,i]}));return Promise.all(i)}updateState(t){this.state=t;this.onStateChange.emit(t)}}const Zt=C.defineMapper(C.read(C.mapRequiredProp("color",Y),C.getProp("thickness")),(([t,i])=>({color:t,thickness:i})));const Gt=C.defineMapper(C.read(C.mapRequiredProp("color",Y)),(([t])=>({color:t})));const Qt=C.defineMapper(C.read(C.pickFirst(C.mapProp("arrow",C.ifDefined((t=>({...t,type:"arrow-end"})))),C.mapProp("circle",C.ifDefined((t=>({...t,type:"circle-end"})))),C.mapProp("dash",C.ifDefined((t=>({...t,type:"dash-end"})))))),(([t])=>t!==null&&t!==void 0?t:undefined));const Yt=C.defineMapper(C.read(C.mapRequiredProp("startPosition",tt),C.mapRequiredProp("endPosition",tt),C.mapProp("strokeStyle",C.ifDefined(Zt)),C.mapProp("fillStyle",C.ifDefined(Gt)),C.mapProp("startShape",C.ifDefined(Qt)),C.mapProp("endShape",C.ifDefined(Qt))),(([t,i,s,n,e,o])=>({type:"line-2d",startPosition:t,endPosition:i,strokeStyle:s,fillStyle:n,startShape:e!==null&&e!==void 0?e:undefined,endShape:o!==null&&o!==void 0?o:undefined})));const ti=C.defineMapper(C.read(C.mapRequiredProp("topLeft",tt),C.mapRequiredProp("bottomRight",tt),C.mapProp("strokeStyle",C.ifDefined(Zt)),C.mapProp("fillStyle",C.ifDefined(Gt))),(([t,i,s,n])=>({type:"oval-2d",topLeftPosition:t,bottomRightPosition:i,strokeStyle:s,fillStyle:n})));const ii=C.defineMapper(C.read(C.mapRequiredProp("positionsList",C.mapArray(tt)),C.mapProp("strokeStyle",C.ifDefined(Zt)),C.mapProp("fillStyle",C.ifDefined(Gt))),(([t,i,s])=>({type:"freeform-2d",positions:t,strokeStyle:i,fillStyle:s})));const si=C.defineMapper(C.read(C.mapRequiredProp("primaryColor",Y),C.mapRequiredProp("accentColor",Y),C.mapRequiredProp("position",Q),C.mapProp("sceneItemId",C.ifDefined(X))),(([t,i,s,n])=>({type:"pin-2d",primaryColor:t,accentColor:i,position:s,sceneItemId:n!==null&&n!==void 0?n:undefined})));const ni=C.defineMapper(C.read(C.mapRequiredProp("primaryColor",Y),C.mapRequiredProp("accentColor",Y),C.mapRequiredProp("anchorPosition",Q),C.mapRequiredProp("textPosition",tt),C.getProp("text"),C.mapProp("sceneItemId",C.ifDefined(X))),(([t,i,s,n,e,o])=>({type:"callout",primaryColor:t,accentColor:i,anchorPosition:s,textPosition:n,text:e,sceneItemId:o!==null&&o!==void 0?o:undefined})));const ei=C.defineMapper(C.read(C.pickFirst(C.mapProp("line2d",C.ifDefined(Yt)),C.mapProp("oval",C.ifDefined(ti)),C.mapProp("freeform",C.ifDefined(ii)),C.mapProp("pin",C.ifDefined(si)),C.mapProp("callout",C.ifDefined(ni)))),(([t])=>t!==null&&t!==void 0?t:undefined));const oi=C.defineMapper(C.read(C.mapRequiredProp("itemsList",C.mapArray(ei))),(([t])=>({items:t.filter((t=>t!=null))})));const ai=C.defineMapper(C.read(C.mapRequiredProp("canvas",C.mapRequiredProp("document",C.mapRequiredProp("v1",oi)))),(([t])=>t));const ri=C.ifInvalidThrow(ai);class hi{constructor(t,i,s){this.client=t;this.jwtProvider=i;this.deviceIdProvider=s}async getCanvas({canvasId:t,sceneViewStateId:i}){if(t!=null&&i!=null){throw new Error("Invalid request. Only one lookup ID between `canvasId` and `sceneViewStateId` can be provided.")}const s=await F((async s=>{const n=this.deviceIdProvider();const e=await U(this.jwtProvider,n);const o=new K.GetCanvasRequest;if(t!=null){const i=It(t);o.setCanvasId(i)}else if(i!=null){const t=It(i);o.setSceneViewStateId(t)}this.client.getCanvas(o,e,s)}));return ri(s.toObject())}}class ci{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();const n=await this.stream.hitItems({point:a.scale(t.position,(s===null||s===void 0?void 0:s.x)||1,(s===null||s===void 0?void 0:s.y)||1)},true);if(((i=n.hitItems)===null||i===void 0?void 0:i.hits)!=null&&n.hitItems.hits.length>0){await this.stream.flyTo({itemId:n.hitItems.hits[0].itemId,animation:{duration:m(this.configProvider().animation.durationMs)}})}else{console.debug(`No hit results found for fly to part [position={x: ${t.position.x}, y: ${t.position.y}}]`)}}}class li{constructor(t,i,s,n,e,o,a,r,h,c,l){this.stream=t;this.cursors=i;this.getConfig=s;this.getScene=n;this.getFrame=e;this.getViewport=o;this.tapEmitter=a;this.doubleTapEmitter=r;this.longPressEmitter=h;this.interactionStartedEmitter=c;this.interactionFinishedEmitter=l;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();const s=this.getFrame();if(s==null){throw new Error("Cannot get world point. Frame is undefined.")}const n=await s.depthBuffer();return n!=null?i.transformPointToWorldSpace(t,n,.5):undefined}async getEntityTypeAtPoint(t){var i;const s=this.getViewport();const n=await((i=this.getFrame())===null||i===void 0?void 0:i.featureMap());if(n!=null){const i=s.transformPointToFrame(t,n);return n.getEntityType(i)}else{return it.NO_GEOMETRY}}getRayFromPoint(t){const i=this.getViewport();const s=this.getFrame();if(s!=null){return i.transformPointToRay(t,s.image,s.scene.camera)}else 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(t={}){if(!this.isInteracting()){this.activeRenderOptions=t;this.interactionStartedEmitter.emit();this.sceneLoadingPromise=this.getScene();this.currentCamera=(await this.sceneLoadingPromise).camera();this.sceneLoadingPromise=undefined;await this.stream.beginInteraction()}}async transformCamera(t,i){var s,n;if(i===void 0){i=(s=this.activeRenderOptions)!==null&&s!==void 0?s:{}}if(this.isInteracting()){const s=await this.getScene();const e=this.getViewport();const o=this.getFrame();const a=await(o===null||o===void 0?void 0:o.depthBuffer());this.currentCamera=this.currentCamera!=null&&e!=null&&o!=null?t({camera:this.currentCamera,viewport:e,scale:s.scale(),boundingBox:s.boundingBox(),frame:o,depthBuffer:a}):undefined;await((n=this.currentCamera)===null||n===void 0?void 0:n.render(i))}}async twistCamera(...t){return this.transformCamera((({camera:i,viewport:s})=>{const n=r.normalize(r.subtract(i.lookAt,i.position));if(t.length===1&&typeof t[0]==="number"){const s=h.toRadians(-t[0]);return i.rotateAroundAxis(s,n)}else if(t.length===1){const n=a.create(s.width/2,s.height/2);const e=h.toDegrees(h.fromPoints(n,t[0]));const o=this.lastAngle!=null?e-this.lastAngle:0;this.lastAngle=e;const c=r.normalize(r.subtract(i.lookAt,i.position));const l=h.toRadians(-o);return i.rotateAroundAxis(l,c)}return i}))}async panCameraToScreenPoint(t){return this.transformCamera((({camera:i,frame:s,viewport:n,depthBuffer:e})=>{if(this.panData==null){const o=i.toFrameCamera();const a=o.direction;const r=n.transformPointToRay(t,s.image,o);const h=c.fromNormalAndCoplanarPoint(a,i.lookAt);const d=l.intersectPlane(r,h);if(d==null){console.warn("Cannot determine fallback for pan. Ray does not intersect plane.");return i}const u=e!=null?this.getWorldPoint(t,e,d):d;const f=c.fromNormalAndCoplanarPoint(a,u);this.panData={hitPt:u,hitPlane:f,startingCamera:o}}if(this.panData!=null){const{hitPt:e,hitPlane:o,startingCamera:a}=this.panData;const h=n.transformPointToRay(t,s.image,a);const c=l.intersectPlane(h,o);if(c!=null){const t=r.subtract(e,c);return i.update(a).moveBy(t)}}return i}))}async viewAll(){await(await this.getScene()).camera().viewAll().render({})}async rotateCamera(t){return this.transformCamera((({camera:i,viewport:s})=>{const n=r.normalize(i.up);const e=r.normalize(r.subtract(i.lookAt,i.position));const o=r.cross(n,e);const a=r.cross(e,o);const h=r.normalize({x:t.x*o.x+t.y*a.x,y:t.x*o.y+t.y*a.y,z:t.x*o.z+t.y*a.z});const c=r.cross(h,e);const l=9.5*t.x/s.width;const d=9.5*t.y/s.height;const u=Math.abs(l)+Math.abs(d);return i.rotateAroundAxis(u,c)}))}async rotateCameraAtPoint(t,i){return this.transformCamera((({camera:s,viewport:n,depthBuffer:e})=>{if(this.worldRotationPoint==null){this.worldRotationPoint=e!=null?this.getWorldPoint(i,e,s.lookAt):s.lookAt}const o=r.normalize(s.up);const a=r.normalize(r.subtract(s.lookAt,s.position));const h=r.cross(o,a);const c=r.cross(a,h);const l=r.normalize({x:t.x*h.x+t.y*c.x,y:t.x*h.y+t.y*c.y,z:t.x*h.z+t.y*c.z});const d=r.cross(l,a);const u=9.5*t.x/n.width;const f=9.5*t.y/n.height;const p=Math.abs(u)+Math.abs(f);const m=s.rotateAroundAxisAtPoint(p,this.worldRotationPoint,d);return m.update({lookAt:r.add(r.scale(Math.abs(s.signedDistanceToBoundingBoxCenter())/r.magnitude(m.viewVector),m.viewVector),m.position)})}))}async zoomCamera(t){return this.transformCamera((({camera:i,viewport:s,frame:n,boundingBox:e})=>{if(s!=null&&n!=null){const o=i===null||i===void 0?void 0:i.toFrameCamera().isPerspective();if(o){const n=i.viewVector;const e=r.magnitude(n);const o=3*e*(t/s.height);const a=r.normalize(n);const h=r.scale(o,a);const c=r.add(i.position,h);const l=i.update({position:c});return l}else{const o=i;const a=i.toFrameCamera();const h=a.direction;const u=s.transformPointToRay(s.center,n.image,a);const f=4*(t/s.height);const p=r.magnitude(d.diagonal(e))*1e-5;const m=Math.max(p,o.fovHeight*(1-f));const v=c.fromNormalAndCoplanarPoint(h,a.lookAt);const w=l.intersectPlane(u,v);if(w!=null){const t=c.projectPoint(v,o.lookAt);const s=(o.fovHeight-m)/o.fovHeight;const n=r.scale(s,r.subtract(w,t));const e=r.add(o.lookAt,n);const a=i.update({lookAt:e,rotationPoint:e,fovHeight:m});return a}}}return i}))}async pivotCamera(t,i){return this.transformCamera((({camera:s})=>{const{position:n,up:e,lookAt:o}=s;const a=r.normalize(e);const c=r.normalize(s.viewVector);const l=r.cross(a,c);const d=r.cross(c,l);const u=r.rotateAboutAxis(h.toRadians(t),o,l,n);const f=r.rotateAboutAxis(h.toRadians(i),u,d,n);return s.update({...s,lookAt:f})}))}async endInteraction(){await this.sceneLoadingPromise;if(this.isInteracting()){this.currentCamera=undefined;this.worldRotationPoint=undefined;this.panData=undefined;this.zoomData=undefined;this.resetLastAngle();this.interactionFinishedEmitter.emit();await this.stream.endInteraction()}this.activeRenderOptions=undefined}resetLastAngle(){this.lastAngle=undefined}isInteracting(){return this.currentCamera!=null}pixelThreshold(t){const i=this.isCoarseInputDevice(t)?this.getConfig().coarsePointerThreshold:this.getConfig().finePointerThreshold;return i*window.devicePixelRatio}async hitItems(t){var i;const s=await(await this.getScene()).raycaster().hitItems(t);return(i=s===null||s===void 0?void 0:s.hits)!==null&&i!==void 0?i:[]}emitTapEvent(t,i,s={},n=0){const{altKey:e=false,ctrlKey:o=false,metaKey:a=false,shiftKey:r=false}=s;t({position:i,altKey:e,ctrlKey:o,metaKey:a,shiftKey:r,buttons:n})}isCoarseInputDevice(t){return t||window.matchMedia("(pointer: coarse)").matches}getWorldPoint(t,i,s){const n=this.getViewport();const e=n.transformPointToFrame(t,i);const o=i.hitTest(e);return o?n.transformPointToWorldSpace(t,i):s}}class di extends li{constructor(t,i,s,n,e,o,a,r,h,c,l){super(t,i,s,n,e,o,a,r,h,c,l)}async getWorldPointFromViewport(t){const i=this.getViewport();const s=this.getFrame();if(s==null){throw new Error("Cannot get world point. Frame is undefined.")}const n=await s.depthBuffer();return n!=null?i.transformPointToWorldSpace(t,n,.5):undefined}async panCameraByDelta(t){return this.transformCamera((({camera:i,viewport:s})=>{const n=i.viewVector;const e=r.normalize(i.up);const o=r.normalize(n);const h=a.scale(t,.5,.5);const c=r.magnitude(n);const l=h.x*c/s.width;const d=h.y*c/s.height;const u=r.cross(e,o);const f=r.cross(o,u);const p=r.add(r.scale(l,u),r.scale(d,f));return i.moveBy(p)}))}async panCameraToScreenPoint(t){return this.transformCamera((({camera:i,frame:s,viewport:n,boundingBox:e})=>{if(this.panData==null){const e=i.toFrameCamera();const o=e.direction;const a=n.transformPointToRay(t,s.image,e);const r=c.fromNormalAndCoplanarPoint(o,i.lookAt);const h=l.intersectPlane(a,r);if(h==null){console.warn("Cannot determine fallback for pan. Ray does not intersect plane.");return i}this.panData={hitPt:h,hitPlane:r,startingCamera:e}}if(this.panData!=null){const{hitPt:e,hitPlane:o,startingCamera:a}=this.panData;const h=n.transformPointToRay(t,s.image,a);const c=l.intersectPlane(h,o);if(c!=null){const t=r.subtract(e,c);const s=r.add(a.lookAt,t);return i.update({lookAt:s,rotationPoint:s})}}return i}))}async zoomCameraToPoint(t,i){return this.transformCamera((({camera:s,viewport:n,frame:e,depthBuffer:o,boundingBox:h})=>{if(this.orthographicZoomData==null||a.distance(t,this.orthographicZoomData.startingScreenPt)>2){const i=s.toFrameCamera();const a=i.direction;const r=n.transformPointToRay(t,e.image,i);const h=c.fromNormalAndCoplanarPoint(a,i.lookAt);const d=l.intersectPlane(r,h);if(d==null){console.warn("Cannot determine fallback point for zoom. Ray does not intersect plane.");return s}const u=o!=null?this.getWorldPoint(t,o,d):d;const f=c.fromNormalAndCoplanarPoint(a,u);this.orthographicZoomData={hitPt:u,hitPlane:f,startingScreenPt:t}}if(this.orthographicZoomData!=null){const{hitPt:t,hitPlane:e}=this.orthographicZoomData;const o=4*(i/n.height);const a=r.magnitude(d.diagonal(h))*1e-5;const l=Math.max(a,s.fovHeight*(1-o));const u=c.projectPoint(e,s.lookAt);const f=(s.fovHeight-l)/s.fovHeight;const p=r.scale(f,r.subtract(t,u));const m=r.add(s.lookAt,p);return s.update({lookAt:m,rotationPoint:m,fovHeight:l})}return s}))}async rotateCamera(t){return this.transformCamera((({camera:i,viewport:s,boundingBox:n})=>{var e;const o=r.normalize(i.up);const a=r.normalize(r.subtract(i.lookAt,i.position));const h=r.cross(o,a);const c=r.cross(a,h);const l=r.normalize({x:t.x*h.x+t.y*c.x,y:t.x*h.y+t.y*c.y,z:t.x*h.z+t.y*c.z});const u=r.cross(l,a);const f=9.5*t.x/s.width;const p=9.5*t.y/s.height;const m=Math.abs(f)+Math.abs(p);const v=i.rotationPoint!=null&&((e=i.rotationPoint)===null||e===void 0?void 0:e.x)!=null?i.rotationPoint:i.lookAt;const w=i.rotateAroundAxisAtPoint(m,v,u);const g=st(w.lookAt,w.viewVector,d.center(n));return w.update({lookAt:g})}))}getWorldPoint(t,i,s){const n=this.getViewport();const e=n.transformPointToFrame(t,i);const o=i.hitTest(e);return o?n.transformPointToWorldSpace(t,i):s}}const ui=.2;class fi extends li{constructor(t,i,s,n,e,o,a,r,h,c,l){super(t,i,s,n,e,o,a,r,h,c,l)}async panCameraByDelta(t){return this.transformCamera((({camera:i,viewport:s})=>{var n;const e=i.viewVector;const o=r.normalize(i.up);const h=r.normalize(e);const c=a.scale(t,.25,.25);const l=r.magnitude(e)*Math.tan((n=i.fovY)!==null&&n!==void 0?n:45);const d=c.x*l/s.width;const u=c.y/s.width*l;const f=r.cross(o,h);const p=r.cross(h,f);const m=r.add(r.scale(d,f),r.scale(u,p));return i.moveBy(m)}))}async zoomCameraToPoint(t,i){return this.transformCamera((({camera:s,viewport:n,frame:e,depthBuffer:o,boundingBox:a})=>{const h=e.scene.camera;const d=h.direction;const u=s.toFrameCamera();const f=n.transformPointToRay(t,e.image,u);if(this.zoomData==null){const i=c.fromNormalAndCoplanarPoint(d,h.lookAt);const n=l.intersectPlane(f,i);if(n==null){console.warn("Cannot determine fallback point for zoom. Ray does not intersect plane.");return s}const e=o!=null?this.getWorldPoint(t,o,n):n;const a=c.fromNormalAndCoplanarPoint(d,e);this.zoomData={hitPt:e,hitPlane:a}}if(this.zoomData!=null){const{hitPlane:t}=this.zoomData;const{position:e,distance:o,isPastHitPlane:h,keepCurrent:d}=this.computeZoomDistances(i,s,n,a,f,this.zoomData);if(h&&!d){const t=l.create({origin:e,direction:r.normalize(s.viewVector)});return s.update({position:e,lookAt:l.at(t,o)})}else if(!d){return s.update({position:e,lookAt:c.projectPoint(t,e)})}}return s}))}walk(t){this.transformCamera((({camera:i,boundingBox:s})=>{const{position:n,up:e,lookAt:o}=i;const a=r.normalize(e);const h=r.normalize(i.viewVector);const c=Math.min(...r.toArray(d.lengths(s)));const l=r.scale(c,t);const u=r.cross(a,h);const f=r.cross(u,a);const p=r.scale(l.x,r.normalize(u));const m=r.scale(l.y,r.normalize(a));const v=r.scale(l.z,r.normalize(f));const w=r.negate(r.add(p,m,v));return i.update({...i,position:r.add(n,w),lookAt:r.add(o,w)})}))}computeZoomDistances(t,i,s,n,e,o){const a=this.getConfig();const{hitPt:h,hitPlane:c}=o;const d=a.useMinimumPerspectiveZoomDistance?this.computeZoomMinimumDistance(i,n):-1;const u=r.distance(i.position,h);const f=Math.max(d,u);const p=6*f*t/s.height;const m=l.at(e,p);const v=l.create({origin:m,direction:r.normalize(i.viewVector)});const w=l.intersectPlane(v,c);if(w==null&&a.useMinimumPerspectiveZoomDistance){const i=6*d*t/s.height;const n=l.at(e,i);return{position:n,distance:d,isPastHitPlane:true,keepCurrent:false}}else if(w==null){return{position:i.position,distance:f,isPastHitPlane:true,keepCurrent:true}}return{position:m,distance:f,isPastHitPlane:false,keepCurrent:false}}computeZoomMinimumDistance(t,i){const s=Math.abs(i.min.x)+Math.abs(i.max.x);const n=Math.abs(i.min.y)+Math.abs(i.max.y);const e=Math.abs(i.min.z)+Math.abs(i.max.z);const o=Math.max(s,n,e);const a=Math.abs(r.dot(r.normalize(t.viewVector),r.right()));const h=Math.abs(r.dot(r.normalize(t.viewVector),r.up()));const c=Math.abs(r.dot(r.normalize(t.viewVector),r.back()));const l=s*a;const d=n*h;const u=e*c;const f=o/s;const p=o/n;const m=o/e;return(l+d+u)/(f+p+m)*ui}}class pi{constructor(t,i,s,n){this.stream=t;this.configProvider=i;this.imageScaleProvider=s;this.sceneProvider=n}predicate(t){return t.altKey&&t.shiftKey}async fn(t){var i,s;const n=this.imageScaleProvider();const e=await this.stream.hitItems({point:a.scale(t.position,(n===null||n===void 0?void 0:n.x)||1,(n===null||n===void 0?void 0:n.y)||1)},true);if(((i=e.hitItems)===null||i===void 0?void 0:i.hits)!=null&&e.hitItems.hits.length>0&&e.hitItems.hits[0].hitPoint!=null){const i=await this.sceneProvider();const n=(await this.sceneProvider()).camera();const o=e.hitItems.hits[0];if(o.hitPoint!=null&&o.hitPoint.x!=null&&o.hitPoint.y!=null&&o.hitPoint.z!=null){const t=r.create(o.hitPoint.x,o.hitPoint.y,o.hitPoint.z);const s=await this.getLookAtPoint(i,t,n.viewVector);await this.stream.flyTo({camera:nt(n.update({lookAt:s,rotationPoint:s}).toFrameCamera()),animation:{duration:m(this.configProvider().animation.durationMs)}})}else{console.debug(`No hit position found for fly to position [position={x: ${t.position.x}, y: ${t.position.y}}, hit-id={${(s=o.itemId)===null||s===void 0?void 0:s.hex}}]`)}}else{console.debug(`No hit results found for fly to position [position={x: ${t.position.x}, y: ${t.position.y}}]`)}}getLookAtPoint(t,i,s){if(t.isOrthographic()){return st(i,s,d.center(t.boundingBox()))}else{return i}}}class mi{setPosition(t){this.currentPosition=t}getPosition(){return this.currentPosition}getType(){return this.type}beginDrag(t,i,s,n){}drag(t,i){}endDrag(t,i){if(this.currentPosition!=null){i.endInteraction();this.currentPosition=undefined}}async zoom(t,i){}}class vi extends mi{constructor(){super(...arguments);this.type="rotate"}beginDrag(t,i,s){if(this.currentPosition==null){this.currentPosition=a.create(t.screenX,t.screenY);s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null){const s=a.create(t.screenX,t.screenY);const n=a.subtract(s,this.currentPosition);i.rotateCamera(n);this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class wi extends mi{constructor(){super(...arguments);this.type="rotate-point"}beginDrag(t,i,s){if(this.currentPosition==null){this.currentPosition=a.create(t.screenX,t.screenY);this.startingPosition=i;s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null&&this.startingPosition!=null){const s=a.create(t.screenX,t.screenY);const n=a.subtract(s,this.currentPosition);i.rotateCameraAtPoint(n,this.startingPosition);this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class gi extends mi{constructor(t){super();this.interactionConfigProvider=t;this.type="zoom";this.isTransforming=false}async beginDrag(t,i,s,n){if(this.currentPosition==null){this.currentPosition=a.create(t.clientX,t.clientY);const i=n.getBoundingClientRect();const e=Rt(t,i);this.startPt=e;await s.beginInteraction()}}async drag(t,i){if(this.currentPosition!=null){const s=a.create(t.clientX,t.clientY);const n=a.subtract(s,this.currentPosition);if(this.startPt!=null){await i.zoomCameraToPoint(this.startPt,n.y);this.currentPosition=s}}}endDrag(t,i){super.endDrag(t,i);this.stopInteractionTimer();this.isTransforming=false;this.startPt=undefined}async zoom(t,i,s){await this.runWheelZoomInteraction(i,(()=>i.zoomCamera(this.getDirectionalDelta(t))),s)}async zoomToPoint(t,i,s,n){await this.runWheelZoomInteraction(s,(()=>s.zoomCameraToPoint(t,this.getDirectionalDelta(i))),n)}async beginInteraction(t){this.isTransforming=true;await t.beginInteraction()}async endInteraction(t){this.isTransforming=false;await t.endInteraction()}resetInteractionTimer(t,i){this.stopInteractionTimer();this.startInteractionTimer(t,i)}getDirectionalDelta(t){return this.interactionConfigProvider().reverseMouseWheelDirection?-t:t}getInteractionDelay(){return this.interactionConfigProvider().mouseWheelInteractionEndDebounce}startInteractionTimer(t,i=0){this.interactionTimer=window.setTimeout((async()=>{this.interactionTimer=undefined;await this.endInteraction(t)}),i+this.getInteractionDelay())}stopInteractionTimer(){if(this.interactionTimer!=null){window.clearTimeout(this.interactionTimer);this.interactionTimer=undefined}}async runWheelZoomInteraction(t,i,s){if(!this.isTransforming){await this.beginInteraction(t)}this.resetInteractionTimer(t,s);i()}}class yi extends mi{constructor(){super(...arguments);this.type="pan"}beginDrag(t,i,s,n){if(this.currentPosition==null){this.currentPosition=a.create(t.screenX,t.screenY);this.canvasRect=n.getBoundingClientRect();s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null&&this.canvasRect!=null){const s=Rt(t,this.canvasRect);i.panCameraToScreenPoint(s);this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class bi extends mi{constructor(){super(...arguments);this.type="twist"}beginDrag(t,i,s,n){this.currentPosition=a.create(t.offsetX,t.offsetY);this.canvasRect=n.getBoundingClientRect();s.beginInteraction()}drag(t,i){const s=Rt(t,this.canvasRect);this.currentPosition=s;i.twistCamera(s)}endDrag(t,i){super.endDrag(t,i)}}class Ci extends mi{constructor(){super(...arguments);this.type="pivot"}beginDrag(t,i,s){if(this.currentPosition==null){this.currentPosition=a.create(t.screenX,t.screenY);s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null){const s=a.create(t.screenX,t.screenY);const n=a.subtract(s,this.currentPosition);i.pivotCamera(-.25*n.y,.25*n.x);this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class Si extends Lt{constructor(t,i=new vi,s=new wi,n=new gi((()=>t().interactions)),e=new yi,o=new bi,a=new Ci){super("mousedown","mouseup","mousemove",i,s,n,e,o,a,t)}}function Ii(t){window.requestAnimationFrame(t)}class Pi{constructor(){this.previousFirstPoints=[];this.previousSecondPoints=[]}initialize(t,i){this.element=t;this.interactionApi=i}dispose(){this.element=undefined}beginTwoPointTouch(t,i){this.previousFirstPoints=[...this.previousFirstPoints,t];this.previousSecondPoints=[...this.previousSecondPoints,i]}handleTwoPointTouchMove(t,i){this.previousFirstPoints=[...this.previousFirstPoints,t];this.previousSecondPoints=[...this.previousSecondPoints,i];Ii((()=>{var t,i,s,n;if(this.previousFirstPoints.length>1&&this.previousSecondPoints.length>1&&this.previousFirstPoints.length===this.previousSecondPoints.length){const e=this.previousFirstPoints;const o=this.previousSecondPoints;this.previousFirstPoints=this.previousFirstPoints.slice(-1);this.previousSecondPoints=this.previousSecondPoints.slice(-1);const r=e.reduce(((t,i,s)=>{if(s<e.length-1){const n=e[s+1];const a=o[s];const r=o[s+1];return{deltas:[...t.deltas,this.computeDelta(i,a,n,r)],zooms:[...t.zooms,this.computeZoom(i,a,n,r)],angles:[...t.angles,this.computeAngle(i,a,n,r)]}}return t}),{deltas:[],zooms:[],angles:[]});const h=r.deltas.reduce(((t,i)=>a.add(t,i)),a.create());const c=r.zooms.reduce(((t,i)=>t+i),0);const l=r.angles.reduce(((t,i)=>t+i),0);const d=a.create((e[e.length-1].x+o[o.length-1].x)/2,(e[e.length-1].y+o[o.length-1].y)/2);(t=this.interactionApi)===null||t===void 0?void 0:t.beginInteraction();(i=this.interactionApi)===null||i===void 0?void 0:i.zoomCameraToPoint(d,c);(s=this.interactionApi)===null||s===void 0?void 0:s.panCameraByDelta(h);(n=this.interactionApi)===null||n===void 0?void 0:n.twistCamera(l)}}))}endTwoPointTouch(){this.previousFirstPoints=[];this.previousSecondPoints=[]}computeDelta(t,i,s,n){return a.add(a.subtract(s,t),a.subtract(n,i))}computeZoom(t,i,s,n){const e=a.distance(s,n)-a.distance(t,i);return e*.5}computeAngle(t,i,s,n){const e=u.create(a.subtract(t,i),a.subtract(s,n));return h.toDegrees(Math.atan2(u.determinant(e),u.dot(e)))}}class ki extends Pi{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;(t=this.element)===null||t===void 0?void 0:t.removeEventListener("pointerdown",this.handlePointerDown);super.dispose()}initialize(t,i){super.initialize(t,i);t.addEventListener("pointerdown",this.handlePointerDown)}handlePointerDown(t){const i=a.create(t.screenX,t.screenY);this.touchPoints={...this.touchPoints,[t.pointerId]:i};const s=Object.keys(this.touchPoints);if(s.length===1){window.addEventListener("pointermove",this.handlePointerMove);window.addEventListener("pointerup",this.handlePointerUp)}else if(s.length===2){this.beginTwoPointTouch(this.touchPoints[0],this.touchPoints[1])}}handlePointerMove(t){if(this.touchPoints[t.pointerId]!=null){this.touchPoints[t.pointerId]=a.create(t.screenX,t.screenY)}const i=Object.keys(this.touchPoints);if(i.length===2){const t=this.touchPoints[i[0]];const s=this.touchPoints[i[1]];this.handleTwoPointTouchMove(t,s)}}handlePointerUp(t){var i;delete this.touchPoints[t.pointerId];const s=Object.keys(this.touchPoints);if(s.length===1){(i=this.interactionApi)===null||i===void 0?void 0:i.endInteraction()}if(s.length===0){window.removeEventListener("pointermove",this.handlePointerMove);window.removeEventListener("pointerup",this.handlePointerUp)}this.endTwoPointTouch()}}class Ti extends Ot{constructor(t,i=new vi,s=new wi,n=new gi((()=>t().interactions)),e=new yi,o=new bi,a=new Ci){super("pointerdown","pointerup","pointermove",i,s,n,e,o,a,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)}addEventListenersToElement(t){t.addEventListener(this.downEvent,this.handleDownEvent);t.addEventListener("wheel",this.handleMouseWheel,{passive:false});return{dispose:()=>{t.removeEventListener(this.downEvent,this.handleDownEvent);t.removeEventListener("wheel",this.handleMouseWheel)}}}handlePointerDown(t){this.downPosition=a.create(t.screenX,t.screenY);this.touchPoints.add(t.pointerId);if(this.touchPoints.size===1){window.addEventListener("pointerup",this.handlePointerUp)}if(this.touchPoints.size===2){this.disableIndividualInteractions=true}}handlePointerUp(t){this.touchPoints.delete(t.pointerId);if(this.touchPoints.size<2){this.disableIndividualInteractions=false}if(this.touchPoints.size===0){window.removeEventListener("pointerup",this.handlePointerUp)}}}class Ai{constructor(t,i,s,n){this.downEvent=t;this.upEvent=i;this.moveEvent=s;this.getConfig=n;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;(t=this.element)===null||t===void 0?void 0:t.removeEventListener(this.downEvent,this.handleDown);(i=this.element)===null||i===void 0?void 0:i.removeEventListener("touchstart",this.handleTouchStart);this.element=undefined;this.clearDoubleTapTimer();this.clearLongPressTimer()}initialize(t,i){this.element=t;this.interactionApi=i;t.addEventListener(this.downEvent,this.handleDown);t.addEventListener("touchstart",this.handleTouchStart,{passive:true})}handleTouchStart(t){if(t.touches.length===1){this.setPointerPositions(a.create(t.touches[0].clientX,t.touches[0].clientY));this.restartLongPressTimer();window.addEventListener("touchend",this.handleTouchEnd);window.addEventListener("touchmove",this.handleTouchMove)}}handleTouchMove(t){if(t.touches.length>0){this.handlePointerMove(a.create(t.touches[0].clientX,t.touches[0].clientY),true)}}handleTouchEnd(t){if(this.pointerDownPosition!=null){window.removeEventListener("touchend",this.handleTouchEnd);window.removeEventListener("touchmove",this.handleTouchMove)}this.handlePointerEnd(this.pointerDownPosition)}handleDown(t){this.setPointerPositions(a.create(t.clientX,t.clientY));this.buttons=t.buttons;const i={altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey};this.restartLongPressTimer(i);window.addEventListener(this.upEvent,this.handleUp);window.addEventListener(this.moveEvent,this.handleMove)}handleMove(t){this.handlePointerMove(a.create(t.clientX,t.clientY),this.isTouch(t))}handleUp(t){if(this.pointerDownPosition!=null){window.removeEventListener(this.upEvent,this.handleUp);window.removeEventListener(this.moveEvent,this.handleMove)}this.handlePointerEnd(a.create(t.clientX,t.clientY),{altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey},this.buttons,this.isTouch(t));this.buttons=undefined}handlePointerMove(t,i){var s;const n=((s=this.interactionApi)===null||s===void 0?void 0:s.pixelThreshold(i))||2;if(this.pointerDownPosition!=null&&a.distance(t,this.pointerDownPosition)>=n&&this.interactionTimer==null){this.clearPositions()}}handlePointerEnd(t,i={},s=0,n=false){var e,o;if(t!=null){if(this.longPressTimer!=null){this.emit((e=this.interactionApi)===null||e===void 0?void 0:e.tap)(t,i,s)}if(this.doubleTapTimer!=null&&this.secondPointerDownPosition!=null){this.emit((o=this.interactionApi)===null||o===void 0?void 0:o.doubleTap)(t,i,s,this.secondPointerDownPosition);this.clearDoubleTapTimer()}}this.pointerDownPosition=undefined;this.clearLongPressTimer()}emit(t){return(i,s={},n=0,e,o=false)=>{var r;const h=e||this.pointerDownPosition;const c=((r=this.interactionApi)===null||r===void 0?void 0:r.pixelThreshold(o))||1;let l;if(this.interactionTimer!=null){l=this.getCanvasPosition(h||i)}else if(h!=null&&a.distance(h,i)<=c){l=this.getCanvasPosition(i)}if(l!=null&&t!=null){t(l,s,n)}}}getCanvasPosition(t){var i;const s=(i=this.element)===null||i===void 0?void 0:i.getBoundingClientRect();const n=s!=null?a.create(s.left,s.top):undefined;return n!=null?a.subtract(a.create(t.x,t.y),n):undefined}clearPositions(){this.pointerDownPosition=undefined;this.firstPointerDownPosition=undefined;this.secondPointerDownPosition=undefined;this.clearDoubleTapTimer();this.clearLongPressTimer();this.clearInteractionTimer()}clearDoubleTapTimer(){if(this.doubleTapTimer!=null){window.clearTimeout(this.doubleTapTimer)}this.doubleTapTimer=undefined;this.firstPointerDownPosition=undefined;this.secondPointerDownPosition=undefined}restartDoubleTapTimer(){this.clearDoubleTapTimer();this.doubleTapTimer=window.setTimeout((()=>this.clearDoubleTapTimer()),this.getConfig().events.doubleTapThreshold)}clearLongPressTimer(){if(this.longPressTimer!=null){window.clearTimeout(this.longPressTimer)}this.longPressTimer=undefined}restartLongPressTimer(t={}){this.clearLongPressTimer();this.longPressTimer=window.setTimeout((()=>{var i;if(this.pointerDownPosition){this.emit((i=this.interactionApi)===null||i===void 0?void 0:i.longPress)(this.pointerDownPosition,t,this.buttons)}this.clearLongPressTimer()}),this.getConfig().events.longPressThreshold)}restartInteractionTimer(){this.clearInteractionTimer();this.interactionTimer=window.setTimeout((()=>{this.interactionTimer=undefined}),this.getConfig().interactions.interactionDelay)}clearInteractionTimer(){if(this.interactionTimer!=null){window.clearTimeout(this.interactionTimer);this.interactionTimer=undefined}}setPointerPositions(t){this.pointerDownPosition=t;this.restartInteractionTimer();if(this.firstPointerDownPosition==null){this.restartDoubleTapTimer();this.firstPointerDownPosition=t}else{this.secondPointerDownPosition=t}}isTouch(t){return window.PointerEvent!=null&&t instanceof PointerEvent?t.pointerType==="touch":false}}class Di extends Pi{constructor(){super();this.handleTouchStart=this.handleTouchStart.bind(this);this.handleTouchMove=this.handleTouchMove.bind(this);this.handleTouchEnd=this.handleTouchEnd.bind(this)}dispose(){var t;(t=this.element)===null||t===void 0?void 0: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){t.preventDefault();const i=t.touches[0];this.currentPosition1=a.create(i.screenX,i.screenY);if(t.touches[1]!=null){this.beginTwoPointTouch(this.currentPosition1,a.create(t.touches[1].screenX,t.touches[1].screenY))}window.addEventListener("touchmove",this.handleTouchMove,{passive:false});window.addEventListener("touchend",this.handleTouchEnd)}}handleTouchMove(t){t.preventDefault();if(t.touches.length===1){this.handleOnePointTouchMove(t.touches[0])}else if(t.touches.length===2){const i=a.create(t.touches[0].clientX,t.touches[0].clientY);const s=a.create(t.touches[1].clientX,t.touches[1].clientY);this.handleTwoPointTouchMove(i,s)}}handleTouchEnd(t){var i;t.preventDefault();(i=this.interactionApi)===null||i===void 0?void 0:i.endInteraction();this.isInteracting=false;window.removeEventListener("touchmove",this.handleTouchMove);window.removeEventListener("touchend",this.handleTouchEnd);this.endTwoPointTouch()}handleOnePointTouchMove(t){var i,s,n;const e=a.create(t.screenX,t.screenY);if(this.currentPosition1!=null){const t=a.subtract(e,this.currentPosition1);const o=((i=this.interactionApi)===null||i===void 0?void 0:i.pixelThreshold(true))||2;if(a.distance(e,this.currentPosition1)>=o||this.isInteracting){(s=this.interactionApi)===null||s===void 0?void 0:s.beginInteraction();(n=this.interactionApi)===null||n===void 0?void 0:n.rotateCamera(t);this.isInteracting=true}}this.currentPosition1=e}}const xi={clearMarks:()=>undefined,clearMeasures:()=>undefined,getEntriesByName:()=>[],mark:()=>undefined,measure:()=>undefined};function Ei(){var t;if(typeof window!=="undefined"){return window.performance}return(t=globalThis.performance)!==null&&t!==void 0?t:xi}class Mi{constructor(t,i=Ei()){this.name=t;this.perf=i;this.measures=new Set;this.nextId=0}clearMeasurements(){this.perf.clearMeasures(this.name)}measure(t){if(t instanceof Promise){const i=this.begin();return t.finally((()=>this.end(i)))}else if(typeof t==="function"){const i=this.begin();const s=t();this.end(i);return s}else{throw new Error("Input must be a function or Promise")}}takeMeasurements(){const t=this.perf.getEntriesByName(this.name);this.clearMeasurements();return t}takeLastMeasurement(){const t=this.takeMeasurements();return t[t.length-1]}begin(){const t=`${this.name}-${this.nextId++}`;this.measures.add(t);this.perf.mark(t);return t}end(t){this.perf.measure(this.name,t);this.perf.clearMarks(t);this.measures.delete(t)}}const Ri=new Mi("paint_time");function Bi(t){const i=new Uint8Array(t.byteLength);i.set(t);return i.buffer}function zi(t){return new Promise(((i,s)=>{const n=new Blob([Bi(t)]);const e=URL.createObjectURL(n);const o=new Image;o.addEventListener("load",(()=>{i({image:o,dispose:()=>undefined});URL.revokeObjectURL(e)}));o.addEventListener("error",(()=>{s(new M("Failed to load image data"));URL.revokeObjectURL(e)}));o.src=e}))}async function Li(t){const i=new Blob([Bi(t)]);const s=await window.createImageBitmap(i);return{image:s,dispose:()=>s.close()}}function Oi(t){if(window.createImageBitmap!=null){return Li(t)}else{return zi(t)}}const ji=1e3;function Hi(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)}function Vi(t,i){const s=t.takeMeasurements();if(s.length>0){i(s)}}function $i(t,i,s,n,e=ji){let o;let a=0;let r;let h=[];function c(){a++;if(o==null){o=setInterval((()=>{Vi(t,n);if(a===0){d()}}),e)}}function l(){a--}function d(){if(o!=null){clearInterval(o);o=undefined}}if(s){setInterval((()=>{if(r!=null){if(h.length===5){h=[...h.slice(1),r]}else{h.push(r)}const t=h.reduce(((t,i)=>t+i),0)/h.length;console.debug(`Paint rate: ${r}fps`);console.debug(`Paint rate (avg): ${t}`);r=undefined}}),1e3)}return s=>{c();return t.measure((async()=>{const t=await i(s);r=r==null?1:r+1;return t})).finally((()=>l()))}}function Ki(){let t=[];function i(i){if(i!=null){const s=i.copy({correlationIds:[...i.correlationIds,...t.filter((t=>!i.correlationIds.includes(t)))]});t=[];return s}return i}function s(){let t=-1;return async i=>{if(i.frame.sequenceNumber>t){const s=await Oi(i.frame.image.imageBytes);t=i.frame.sequenceNumber;return s}}}function n(){let t=-1;return async(i,s)=>{var n;if(s!=null&&i.frame.sequenceNumber>t){t=i.frame.sequenceNumber;(n=i.beforeDraw)===null||n===void 0?void 0:n.call(i);Hi(s,i);s.dispose();return i.frame}s===null||s===void 0?void 0:s.dispose()}}const e=s();const o=n();return async s=>{var n,a;const r=(a=(n=s.predicate)===null||n===void 0?void 0:n.call(s))!==null&&a!==void 0?a:true;t=[...t,...s.frame.correlationIds];if(r){return e(s).then((t=>o(s,t).then(i)))}}}function Ni(t){return i=>{var s;const n=(s=i.request.requestId)===null||s===void 0?void 0:s.value;if(n!=null){t(n)(i)}}}function Fi(t){return i=>{const{drawFrame:s}=i.request;if(s!=null){t(s)(i)}}}const Wi=1*60;function Ui(t){let i=false;return s=>{const n=t();if(n!=null){const t=n.remoteTime(new Date(Date.now()));const e=m(s,t);const o=v(e).getTime();if(o>=0){return e}else{if(!i){console.warn(`Possible erroneous send to receive timing. Muting for ${Wi}s. [sent-at=${s.toISOString()}, received-at=${t.toISOString()}, remote-time=${n.knownRemoteTime.toISOString()}]`);i=true;setTimeout((()=>i=false),Wi*1e3)}return undefined}}}}function qi(t,i){const s=Ui(i);return Ni((i=>Fi((n=>n=>{const e=v(n.sentAtTime);if(e!=null){t.replyResult(i,{drawFrame:{sendToReceiveDuration:s(e)}})}}))))}var _i=N();const Ji=C.defineMapper(C.read(C.requiredProp("d"),C.requiredProp("ns"),C.mapRequiredProp("ka",et),C.mapRequiredProp("kd",et),C.mapRequiredProp("ks",et),C.mapRequiredProp("ke",et)),(([t,i,s,n,e,o])=>({opacity:t,glossiness:i,ambient:s,diffuse:n,specular:e,emissive:o})));const Xi=C.defineMapper(C.read(C.mapRequiredProp("defaultMaterial",(()=>Pt)),C.mapRequiredProp("colorMaterial",Ji)),(([t,i])=>({defaultMaterial:t,colorMaterial:i})));const Zi=C.defineMapper(C.read(C.requiredProp("name"),C.requiredProp("category")),(([t,i])=>({name:t,category:i})));const Gi=C.defineMapper(C.read(C.getProp("value")),(([t])=>({type:"string",value:t})));const Qi=C.mapProp("string",C.ifDefined(Gi));const Yi=C.defineMapper(C.read(C.getProp("value")),(([t])=>({type:"long",value:t})));const ts=C.mapProp("pb_long",C.ifDefined(Yi));const is=C.defineMapper(C.read(C.getProp("value")),(([t])=>({type:"double",value:t})));const ss=C.mapProp("pb_double",C.ifDefined(is));const ns=C.defineMapper(C.read(C.requiredProp("value")),(([t])=>({type:"timestamp",value:t})));const es=C.mapProp("date",C.ifDefined(ns));const os=C.compose(C.pickFirst(Qi,ts,ss,es),C.required("value"));const as=C.defineMapper(C.read(C.requiredProp("id"),C.mapProp("key",C.ifDefined(Zi)),C.mapProp("value",C.ifDefined(os))),(([t,i,s])=>({id:t,key:i,value:s})));const rs=C.defineMapper(C.read(C.mapProp("cursor",ot),C.mapRequiredProp("entriesList",C.mapArray(as))),(([t,i])=>({paging:{next:t},entries:i})));const hs=C.ifInvalidThrow(rs);const cs=C.defineMapper(C.read(C.mapRequiredProp("id",X),C.mapRequiredProp("createdAt",at),C.mapProp("materialOverride",C.ifDefined(Xi)),C.mapProp("transform",C.ifDefined(rt)),C.mapProp("isVisible",C.ifDefined(ht)),C.mapProp("isSelected",C.ifDefined(ht)),C.mapProp("isPhantom",C.ifDefined(ht)),C.mapProp("endItem",C.ifDefined(ht))),(([t,i,s,n,e,o,a,r])=>({id:t,createdAt:i,materialOverride:s,transform:n,isVisible:e,isSelected:o,isPhantom:a,endItem:r})));const ls=C.defineMapper(C.read(C.mapRequiredProp("id",X),C.mapRequiredProp("createdAt",at),C.mapRequiredProp("name",G),C.mapProp("parentId",C.ifDefined(X)),C.mapProp("suppliedId",C.ifDefined(G)),C.mapProp("boundingBox",C.ifDefined(ct)),C.mapProp("worldTransform",C.ifDefined(rt)),C.mapProp("override",C.ifDefined(cs))),(([t,i,s,n,e,o,a,r])=>({id:t,createdAt:i,name:s,parentId:n!==null&&n!==void 0?n:undefined,suppliedId:e,boundingBox:o,worldTransform:a,override:r})));const ds=C.ifInvalidThrow(C.defineMapper(C.read(C.mapProp("item",C.ifDefined(ls))),(([t])=>t!==null&&t!==void 0?t:undefined)));class us{constructor(t,i,s){this.client=t;this.jwtProvider=i;this.deviceIdProvider=s}async getSceneViewItem(t,i,s){const n=await F((async n=>{const e=this.deviceIdProvider();const o=await U(this.jwtProvider,e);const a=new K.GetSceneViewItemRequest;a.setSceneItemId(It(t));a.setViewId(It(i));const r=new _i.FieldMask;if(s.includeBoundingBox){r.addPaths("bounding_box")}if(s.includeWorldTransform){r.addPaths("world_transform")}if(s.includeOverride){r.addPaths("override")}a.setAdditionalFields(r);this.client.getSceneViewItem(a,o,n)}));return ds(n.toObject())}async listSceneItemMetadata(t,i){const s=await F((async s=>{const n=this.deviceIdProvider();const e=await U(this.jwtProvider,n);const o=new K.ListSceneItemMetadataRequest;o.setItemId(It(t));const a=new R.Pager;if(i.size!=null){a.setLimit(i.size)}if(i.cursor!=null){a.setCursor(i.cursor)}o.setPager(a);this.client.listSceneItemMetadata(o,e,s)}));return hs(s.toObject())}}var fs;(function(t){t["DEVICE_ID"]="vertexvis:device-id"})(fs||(fs={}));function ps(){if(typeof window==="undefined"){throw new Error("Local storage is not available.")}return window.localStorage}function ms(t,i,s=ps()){const n=s.getItem(t);if(n!=null){const e={...JSON.parse(n),...i};s.setItem(t,JSON.stringify(e))}else{s.setItem(t,JSON.stringify(i))}}function vs(t,i,s=ps()){const n=s.getItem(t);if(n!=null){return i(JSON.parse(n))}}function ws(t,i,s,n){return I.retry((()=>{if(!t.aborted){return i()}return Promise.resolve(s)}),n)}class gs extends w{constructor(t,i={}){var s,n,e,o,a;super(t,{loggingEnabled:i.loggingEnabled});this.state={type:"disconnected"};this.stateChanged=new S;this.dimensions=f.create(0,0);this.streamAttributes={};this.enableTemporalRefinement=(s=i.enableTemporalRefinement)!==null&&s!==void 0?s:true;this.frameBgColor=P.create(255,255,255);this.config=Et("platprod");this.options={tokenRefreshOffsetInSeconds:(n=i.tokenRefreshOffsetInSeconds)!==null&&n!==void 0?n:30,offlineThresholdInSeconds:(e=i.offlineThresholdInSeconds)!==null&&e!==void 0?e:30,loadTimeoutInSeconds:(o=i.loadTimeoutInSeconds)!==null&&o!==void 0?o:15,enableTemporalRefinement:(a=i.enableTemporalRefinement)!==null&&a!==void 0?a:true}}isPaused(){return this.pausedState!=null}getState(){return this.state}disconnect(){if(this.state.type!=="disconnected"&&this.state.type!=="connection-failed"){console.debug("Disconnecting websocket");this.state.connection.dispose();this.updateState({type:"disconnected"})}}async load(t,i,s,n=Et("platprod"),e){this.clientId=i;this.deviceId=s;this.config=n;if(this.state.type==="disconnected"){await this.loadIfDisconnected(t,e)}else if(this.state.type==="connection-failed"){await this.loadIfDisconnected(t,e)}else{await this.loadIfConnectingOrConnected(t,this.state,e)}return this.state}update(t){this.frameBgColor=t.frameBgColor?t.frameBgColor:this.frameBgColor;if(t.dimensions!=null&&!k(t.dimensions,this.dimensions)){this.dimensions=t.dimensions;this.ifState("connected",(()=>this.updateDimensions({dimensions:this.getDimensions(),resolution:Ss(this.getResolution())})))}const i=!k(this.streamAttributes,t.streamAttributes);if(t.streamAttributes!=null&&i){this.streamAttributes=t.streamAttributes;this.ifState("connected",(()=>this.updateStream({streamAttributes:ys(this.streamAttributes)})))}if(t.enableTemporalRefinement!=null&&t.enableTemporalRefinement!==this.enableTemporalRefinement){this.enableTemporalRefinement=t.enableTemporalRefinement;if(this.state.type==="connected"){this.closeAndReconnect(this.state)}}}pause(){if(this.state.type==="connected"){this.pausedState=this.state;console.debug(`Stream paused [stream-id=${this.pausedState.streamId}, scene-id=${this.pausedState.sceneId}, scene-view-id=${this.pausedState.sceneViewId}]`);this.disconnect()}}async resume(){if(this.pausedState!=null){console.debug(`Stream resumed [stream-id=${this.pausedState.streamId}, scene-id=${this.pausedState.sceneId}, scene-view-id=${this.pausedState.sceneViewId}]`);await this.connectToExistingStream(this.pausedState);this.pausedState=undefined}}async loadIfConnectingOrConnected(t,i,s){var n;const{resource:e,subResource:o}=i.resource;const a=kt(t);const r=!T.isEqual(e,a.resource);const h=!T.isEqual(o,a.subResource);const c=i.type==="connecting"||i.type==="reconnecting";const l=i.type==="connected";if(r||c&&h){this.disconnect();return this.loadIfDisconnected(t)}else if(l&&h&&((n=a.subResource)===null||n===void 0?void 0:n.type)==="scene-view-state"){const t=a.queries.find((t=>t.type==="supplied-id"));const n={...a.subResource.id!=null?{sceneViewStateId:{hex:a.subResource.id}}:{},...t!=null?{sceneViewStateSuppliedId:{value:t.id}}:{},...s!=null?{cameraType:Cs(s)}:{}};await this.loadSceneViewState(n);this.updateState({...i,resource:a})}}async loadIfDisconnected(t,i){try{await this.connectWithNewStream(kt(t),i)}catch(t){if(t instanceof B){this.updateState({type:"connection-failed",message:`Cannot load scene. ${t.message}`,error:t})}else if(t instanceof g){this.updateState({type:"connection-failed",message:`Cannot load scene. Stream request failed to start stream.`,error:t})}else{this.updateState({type:"connection-failed",message:`Cannot load scene for unknown reason. See console logs.`,error:t})}throw t}}connectWithNewStream(t,i){return this.openWebsocketStream(t,"connecting",(()=>this.requestNewStream(t,i)))}connectToExistingStream(t){return this.openWebsocketStream(t.resource,"reconnecting",(()=>this.requestReconnectStream(t)),{maxRetries:Number.POSITIVE_INFINITY})}async openWebsocketStream(t,i,s,{maxRetries:n=3}={}){var e;const o=Ps(ks(this.config,t.resource,this.clientId,this.deviceId));console.debug(`Initiating WS connection [uri=${o.url}]`);(e=this.abortController)===null||e===void 0?void 0:e.abort();const a=new AbortController;this.abortController=a;const r=Is(this.config);this.updateState({type:i,resource:t,connection:{dispose:()=>{this.dispose();a.abort()}}});const h=await I.abort(a.signal,ws(a.signal,(()=>this.connect(o,r)),{dispose:()=>{}},{maxRetries:n,delaysInMs:gs.WS_RECONNECT_DELAYS})).catch((t=>{throw new z("Websocket connection failed.",t instanceof Error?t:undefined)}));if(!h.aborted){return this.requestNewOrExistingStream(t,h.result,s)}else{this.updateState({type:"disconnected"})}}async requestNewOrExistingStream(t,i,s){const n=this.requestClock();const e=await s();console.debug(`Stream connected [stream-id=${e.streamId}, scene-id=${e.sceneId}, scene-view-id=${e.sceneViewId}]`);const o=this.onRequest((t=>{const i=t.request.drawFrame;if(i!=null){const t=pt(e.worldOrientation)(i);if(this.state.type==="connected"){if(t.depthBufferBytes!=null||this.state.frame.temporalRefinementCorrelationId!==t.temporalRefinementCorrelationId){this.updateState({...this.state,frame:t,fallbackDepthBufferBytes:t.depthBufferBytes})}else{this.updateState({...this.state,frame:t.copy({depthBufferBytes:this.state.fallbackDepthBufferBytes})})}}}}));const a=this.reconnectWhenNeeded();const r=this.refreshTokenWhenExpired(e.token);const h=this.acknowledgeFrameRequests();const c=e.frame==null?await this.waitForFrame(e.worldOrientation,this.options.loadTimeoutInSeconds):e.frame;const l=await n;console.debug(`Synchronized clocks [local-time=${l.knownLocalTime.toISOString()}, remote-time=${l.knownRemoteTime.toISOString()}]`);this.updateState({type:"connected",connection:{dispose:()=>{a.dispose();o.dispose();r.dispose();h.dispose();i.dispose()}},resource:t,streamId:e.streamId,deviceId:e.deviceId,sceneId:e.sceneId,sceneViewId:e.sceneViewId,worldOrientation:e.worldOrientation,token:e.token,frame:c,clock:l,fallbackDepthBufferBytes:undefined})}async requestNewStream(t,i){var s,n;const e=t.queries.find((t=>t.type==="supplied-id"));const o=mt(await this.startStream({streamKey:{value:t.resource.id},dimensions:this.getDimensions(),resolution:Ss(this.getResolution()),frameBackgroundColor:bs(this.frameBgColor),clientSupportsTemporalRefinement:this.enableTemporalRefinement,streamAttributes:ys(this.streamAttributes),sceneViewStateId:((s=t.subResource)===null||s===void 0?void 0:s.type)==="scene-view-state"&&t.subResource.id!=null?{hex:t.subResource.id}:undefined,sceneViewStateSuppliedId:((n=t.subResource)===null||n===void 0?void 0:n.type)==="scene-view-state"&&e!=null?{value:e.id}:undefined,cameraType:i!=null?Cs(i):undefined}));return{resource:t,streamId:o.streamId,sceneId:o.sceneId,sceneViewId:o.sceneViewId,deviceId:o.sessionId,token:o.token,worldOrientation:o.worldOrientation,frame:undefined,fallbackDepthBufferBytes:undefined}}async requestReconnectStream(t){const i=vt(await this.reconnect({streamId:{hex:t.streamId},dimensions:this.getDimensions(),frameBackgroundColor:bs(this.frameBgColor),streamAttributes:ys(this.streamAttributes),clientSupportsTemporalRefinement:this.enableTemporalRefinement}));return{...t,token:i.token}}async requestClock(){const t=wt(await this.syncTime({requestTime:y()}));return new Tt(t)}reconnectWhenNeeded(){const t=this.onClose((()=>{if(this.state.type==="connected"){this.closeAndReconnect(this.state)}}));const i=this.onRequest((t=>{const i=t.request.gracefulReconnection!=null;if(i&&this.state.type==="connected"){console.debug("Received request for graceful reconnect. Closing connection and attempting reconnect.");this.closeAndReconnect(this.state)}}));const s=this.reconnectWhenOffline();return{dispose:()=>{t.dispose();i.dispose();s.dispose()}}}refreshTokenWhenExpired(t){let i;const s=t=>{const{tokenRefreshOffsetInSeconds:n}=this.options;const e=t.remainingTimeInMs(n);i=window.setTimeout((async()=>{const t=await this.refreshToken();const i=gt(t);s(i);if(this.state.type==="connected"){this.updateState({...this.state,token:i})}}),e)};s(t);return{dispose:()=>clearTimeout(i)}}reconnectWhenOffline(){let t;const i=()=>window.clearTimeout(t);const s=()=>{i();const s=this.options.offlineThresholdInSeconds;console.debug(`Detected that host is offline. Will attempt reconnect in ${s}s.`);t=window.setTimeout((()=>{if(this.state.type==="connected"){this.closeAndReconnect(this.state)}}),s*1e3)};const n=()=>{console.debug("Detected that host is online.");i()};const e=()=>s();window.addEventListener("offline",e);window.addEventListener("online",n);return{dispose:()=>{i();window.removeEventListener("offline",e);window.removeEventListener("online",n)}}}closeAndReconnect(t){t.connection.dispose();return this.connectToExistingStream(t)}async waitForFrame(t,i){let s;try{return await I.timeout(i*1e3,new Promise((i=>{s=this.onRequest((n=>{try{const s=n.request.drawFrame;if(s!=null){const n=pt(t)(s);i(n)}}finally{s===null||s===void 0?void 0:s.dispose()}}))})))}catch(t){throw new L(`Frame timed out after ${i}s`,t instanceof Error?t:undefined)}finally{s===null||s===void 0?void 0:s.dispose()}}acknowledgeFrameRequests(){return this.onRequest(qi(this,(()=>this.state.type==="connected"?this.state.clock:undefined)))}updateState(t){if(this.state!==t){this.state=t;this.stateChanged.emit(this.state)}}getDimensions(){if(f.area(this.dimensions)===0){return f.create(1,1)}return this.dimensions}getResolution(){if(window.devicePixelRatio!=null){return 96*window.devicePixelRatio}else{return 96}}ifState(t,i){if(this.state.type===t){return i()}}onStateChanged(t){return this.stateChanged.on(t)}}gs.WS_RECONNECT_DELAYS=[0,1e3,1e3,5e3];const ys=C.ifInvalidThrow(lt);const bs=C.ifInvalidThrow(dt);const Cs=C.ifInvalidThrow(ut);const Ss=C.ifInvalidThrow(ft);function Is(t){return{EXPERIMENTAL_frameDelivery:{...t.EXPERIMENTAL_frameDelivery,rateLimitingEnabled:t.flags.throttleFrameDelivery},EXPERIMENTAL_adaptiveRendering:{...t.EXPERIMENTAL_adaptiveRendering,enabled:t.flags.adaptiveRendering},EXPERIMENTAL_qualityOfService:{...t.EXPERIMENTAL_qualityOfService}}}function Ps(t){return{url:A.toString(t),protocols:["ws.vertexvis.com"]}}function ks(t,i,s,n){if(s!=null){return A.appendPath(A.toString(A.parseAndAddParams("/ws",{clientId:s,deviceId:n})),A.parse(t.network.renderingHost))}else{return A.appendPath(`/stream-keys/${i.id}/session`,A.parse(t.network.renderingHost))}}class Ts{constructor(t){this.callback=t;this.handleVisibilityChange=this.handleVisibilityChange.bind(this);this.emitVisibilityChange=this.emitVisibilityChange.bind(this);this.mutationObservers=[]}isVisible(t){if("checkVisibility"in t){return t.checkVisibility({visibilityProperty:true,opacityProperty:true})}return true}observe(t){this.targetElement=t;this.watchElementVisibility(t)}unobserve(){if(this.targetElement!=null){this.mutationObservers.forEach((t=>t.disconnect()));this.mutationObservers=[]}this.targetElement=undefined}disconnect(){this.mutationObservers.forEach((t=>t.disconnect()));this.mutationObservers=[]}watchElementVisibility(t){if(t!=null){const i=new MutationObserver(this.handleVisibilityChange);i.observe(t,{attributes:true,attributeFilter:["style","class","hidden"]});this.mutationObservers=[...this.mutationObservers,i];this.watchElementVisibility(t.parentElement)}}handleVisibilityChange(){if(this.targetElement!=null){this.emitVisibilityChange(this.targetElement)}}emitVisibilityChange(t){const i=t!=null?this.isVisible(t):true;console.debug(`Detected visibility change [visible={${i}}]`);this.callback(i)}}const As=15e3;function Ds(t){return t.getBoundingClientRect()}function xs(t,i){const s=window.getComputedStyle(t);const n=s.getPropertyValue(i);return n!==""?n:undefined}const Es=()=>`button{border:none;background:transparent;cursor:pointer;margin:0;padding:0}.button{padding:0.5rem;border-radius:0.25rem}.button-secondary{color:var(--neutral-800);background-color:var(--neutral-300)}.button-secondary:hover{color:var(--neutral-900)}.button-secondary:hover:enabled{box-shadow:0 2px 2px rgb(0 0 0 / 20%)}.button-secondary:disabled{opacity:0.8}.button-secondary:hover:disabled{cursor:not-allowed}: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;user-select:none;-webkit-user-select:none}.canvas-container{display:flex;justify-content:center;align-items:center;width:100%;height:100%;position:relative}.enable-pointer-events{touch-action:none}.viewer-container{width:100%;height:100%;overflow:hidden}.error-message-wrapper{align-items:center;display:flex;flex-direction:column;gap:1rem;position:absolute;top:50%;width:100%;transform:translateY(-50%);text-align:center}.error-message{font-size:0.875rem}`;const Ms=i(class t extends s{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow();this.tap=n(this,"tap");this.doubletap=n(this,"doubletap");this.longpress=n(this,"longpress");this.frameReceived=n(this,"frameReceived");this.frameDrawn=n(this,"frameDrawn");this.tokenExpired=n(this,"tokenExpired");this.connectionChange=n(this,"connectionChange");this.sceneReady=n(this,"sceneReady");this.sceneChanged=n(this,"sceneChanged");this.interactionStarted=n(this,"interactionStarted");this.interactionFinished=n(this,"interactionFinished");this.cameraTypeChanged=n(this,"cameraTypeChanged");this.annotationStateChanged=n(this,"annotationStateChanged");this.deviceIdChange=n(this,"deviceIdChange");this.dimensionschange=n(this,"dimensionschange");this.configEnv="platprod";this.cameraControls=true;this.cameraType="perspective";this.keyboardControls=true;this.rotateAroundTapPoint=true;this.phantom={opacity:.1};this.noDefaultLights=false;this.enableTemporalRefinement=true;this.experimentalRenderingOptions="";this.crossSectioning={endCapEnabled:true,endCapColor:undefined};this.resizeDebounce=100;this.viewport=zt.fromDimensions(f.create(0,0));this.experimentalSkipVisibilityCheck=false;this.stateMap={cursorManager:new Mt,streamState:{type:"disconnected"}};this.isVisible=false;this.frameRenderVersion=0;this.interactionHandlers=[];this.defaultInteractionHandlerDisposables=[];this.tapKeyInteractions=[];this.defaultTapKeyInteractions=[];this.internalFrameDrawnDispatcher=new S;this.handleUpdateStreamAttributesWithTimer=()=>{const t=50;if(this.streamAttributesUpdateTimer==null){this.streamAttributesUpdateTimer=setTimeout((()=>{this.streamAttributesUpdateTimer=undefined;this.updateStreamAttributes()}),t)}};this.handleRetry=()=>{this.reload().catch((t=>{console.error("Error reloading scene",t)}))};this.handleElementResize=this.handleElementResize.bind(this);this.handleVisibilityChange=this.handleVisibilityChange.bind(this)}connectedCallback(){var t,i,s;(t=this.stencilBuffer)!==null&&t!==void 0?t:this.stencilBuffer=new $t(this.hostElement);this.visibilityObserver=new Ts(this.handleVisibilityChange);this.isVisible=this.visibilityObserver.isVisible(this.hostElement);if(!this.isVisible){(i=this.visibilityObserver)===null||i===void 0?void 0:i.observe(this.hostElement)}(s=this.stream)===null||s===void 0?void 0:s.resume()}componentWillLoad(){var t;this.updateResolvedConfig();this.calculateComponentDimensions();this.resizeObserver=new ResizeObserver(this.handleElementResize);this.registerSlotChangeListeners();const i=this.getResolvedConfig();const s=new p.SceneViewAPIClient(i.network.sceneViewHost);this.annotations=new Xt(s,(()=>this.token),(()=>this.deviceId));this.annotations.onStateChange.on((t=>{this.annotationStateChanged.emit(t);const i=Object.keys(t.annotations).length;this.handleAnnotationSetsChange(i)}));this.stream=(t=this.stream)!==null&&t!==void 0?t:new gs(new b,{loggingEnabled:i.flags.logWsMessages,enableTemporalRefinement:this.enableTemporalRefinement});this.addStreamListeners();this.modelViews=new At(s,this.stream,(()=>this.token),(()=>this.deviceId));this.pmi=new Dt(s,(()=>this.token),(()=>this.deviceId));this.sceneItems=new us(s,(()=>this.token),(()=>this.deviceId));this.canvases=new hi(s,(()=>this.token),(()=>this.deviceId));this.updateStreamAttributes();this.stateMap.cursorManager.onChanged.on((()=>this.handleCursorChanged()))}async componentDidLoad(){var t,i,s;this.interactionApi=this.createInteractionApi();this.isVisible=(i=(t=this.visibilityObserver)===null||t===void 0?void 0:t.isVisible(this.hostElement))!==null&&i!==void 0?i:true;if(this.canvasContainerElement!=null){(s=this.resizeObserver)===null||s===void 0?void 0:s.observe(this.canvasContainerElement)}this.loadOrResumeStream().catch((t=>{console.error("Error loading scene",t)}));await this.initializeDefaultInteractionHandlers();this.injectViewerApi()}disconnectedCallback(){var t,i,s;(t=this.visibilityObserver)===null||t===void 0?void 0:t.disconnect();(i=this.annotations)===null||i===void 0?void 0:i.disconnect();(s=this.stream)===null||s===void 0?void 0:s.pause()}render(){var t;return e(o,{key:"9f432c1405929448b4ded4c458d70c36781d4a7d"},e("div",{key:"1963c4b6d17b168e87a652da2190d10923ea4ce5",ref:t=>this.viewerContainerElement=t,class:"viewer-container",style:{cursor:Bt((t=this.cursor)!==null&&t!==void 0?t:"")},onContextMenu:t=>t.preventDefault()},e("div",{key:"dc2a675091f94c47c87f24a43cf7e9cd603a8af2",ref:t=>this.canvasContainerElement=t,class:x("canvas-container",{"enable-pointer-events ":window.PointerEvent!=null})},e("canvas",{key:"604cdad20b6fc50c6a06e3e5ec4fdc8ee6b71d8f",ref:t=>{this.canvasElement=t;this.stateMap.interactionTarget=t},class:"canvas"}),this.errorMessage!=null?e("div",{class:"error-message-wrapper",role:"alert"},e("span",{class:"error-message"},this.errorMessage),e("slot",{name:"retry"},e("button",{class:"button button-secondary",type:"button",onClick:this.handleRetry},"Retry"))):null),e("slot",{key:"a09eb09541a5b3bfb8943a62e0d37f100a2fde25"})))}async dispatchFrameDrawn(t){this.frame=t;this.internalFrameDrawnDispatcher.emit(t);this.frameDrawn.emit(t)}async registerInteractionHandler(t){this.interactionHandlers.push(t);this.initializeInteractionHandler(t);return{dispose:()=>{const i=this.interactionHandlers.indexOf(t);if(i!==-1){this.interactionHandlers[i].dispose();this.interactionHandlers.splice(i,1)}}}}async registerBasicInteractionHandler(t){this.interactionHandlers.push(t);this.initializeBasicInteractionHandler(t);return{dispose:()=>{const i=this.interactionHandlers.indexOf(t);if(i!==-1){this.interactionHandlers[i].dispose();this.interactionHandlers.splice(i,1)}}}}async registerTapKeyInteraction(t){this.tapKeyInteractions=[...this.tapKeyInteractions,t]}async getInteractionTarget_DEPRECATED(){if(this.stateMap.interactionTarget!=null){return this.stateMap.interactionTarget}else throw new Error("Interaction target is undefined.")}async addCursor(t,i){return this.stateMap.cursorManager.add(t,i)}async getInteractionHandlers(){return this.interactionHandlers}async getKeyInteractions(){return this.tapKeyInteractions}async getBaseInteractionHandler(){return this.baseInteractionHandler}async getJwt(){return this.token}handleSrcChanged(t){if(t!=null){this.load(t,{cameraType:this.cameraType})}else{this.unload()}}handleCameraControlsChanged(){this.initializeDefaultCameraInteractionHandlers()}handleKeyboardControlsChanged(){this.initializeDefaultKeyboardInteractionHandlers()}handleRotateAboutTapPointChanged(){var t,i;this.updateStreamAttributes();if(this.rotateAroundTapPoint){(t=this.baseInteractionHandler)===null||t===void 0?void 0:t.setPrimaryInteractionType("rotate-point")}else{(i=this.baseInteractionHandler)===null||i===void 0?void 0:i.setPrimaryInteractionType("rotate")}}handleCameraTypeChanged(t,i){if(t!==i){this.updateCameraType()}}handleStreamAttributesChanged(){this.handleUpdateStreamAttributesWithTimer()}handleEnableTemporalRefinementChanged(){this.updateEnableTemporalRefinement()}handleConfigChanged(){this.updateResolvedConfig()}handleConfigEnvChanged(){this.updateResolvedConfig()}async load(t,i){var s,n;const e=this.experimentalSkipVisibilityCheck||this.isVisible;if(!e){console.debug("Detected the viewer is hidden. Delaying load until visible.");return}if(this.stream!=null&&this.dimensions!=null){const{EXPERIMENTAL_annotationPollingIntervalInMs:e}=this.getResolvedConfig();this.calculateComponentDimensions();this.stream.update({streamAttributes:this.getStreamAttributes(),config:Et(this.configEnv,this.config),dimensions:this.dimensions,frameBgColor:this.getBackgroundColor()});const o=await((s=this.stream)===null||s===void 0?void 0:s.load(t,this.clientId,this.getDeviceId(),this.getResolvedConfig(),i===null||i===void 0?void 0:i.cameraType));if(o.type==="connected"){this.sceneReady.emit();if(e!==undefined){(n=this.annotations)===null||n===void 0?void 0:n.connect(e)}}}else{throw new O("Cannot load scene. Viewer has not been initialized.")}}async unload(){var t;if(this.stream!=null){this.frameRenderVersion+=1;(t=this.annotations)===null||t===void 0?void 0:t.disconnect();this.stream.disconnect();this.frame=undefined;this.errorMessage=undefined}if(this.canvasElement!=null){const t=this.canvasElement.getContext("2d");if(t!=null){t.clearRect(0,0,this.canvasElement.width,this.canvasElement.height)}}}async reload(){if(this.src!=null){await this.unload();await this.load(this.src,{cameraType:this.cameraType})}}async scene(){return this.createScene()}async isSceneReady(){return this.stateMap.streamState.type==="connected"}async handleTapEvent(t){this.tapKeyInteractions.filter((i=>i.predicate(t.detail))).forEach((i=>i.fn(t.detail)))}emitConnectionChange(t){if(t.status==="connected"){if(t.jwt.length===0){throw new j("JWT is empty")}}if(!this.hostElement.isConnected){return}this.connectionChange.emit(t)}handleElementResize(t){const i=t.length>0&&this.dimensions!=null&&!f.isEqual(t[0].contentRect,this.viewport);if(i){if(this.resizeTimer!=null){clearTimeout(this.resizeTimer);this.resizeTimer=undefined}if(!this.isResizing){this.resizeTimer=setTimeout((()=>{this.isResizing=true;this.isResizeUpdate=true;this.recalculateComponentDimensions()}),this.resizeDebounce)}}}handleVisibilityChange(t){var i;this.isVisible=t;if(this.isVisible){(i=this.visibilityObserver)===null||i===void 0?void 0:i.disconnect();this.loadOrResumeStream()}}async loadOrResumeStream(){var t,i,s;const n=(i=(t=this.stream)===null||t===void 0?void 0:t.isPaused())!==null&&i!==void 0?i:false;if(this.src!=null&&!n){await this.load(this.src,{cameraType:this.cameraType})}else if(n){(s=this.stream)===null||s===void 0?void 0:s.resume()}}registerSlotChangeListeners(){this.mutationObserver=new MutationObserver((t=>this.injectViewerApi()));this.mutationObserver.observe(this.hostElement,{childList:true,subtree:true});this.styleObserver=new MutationObserver((t=>this.syncViewerStyles()));this.styleObserver.observe(this.hostElement,{attributes:true,attributeFilter:["style"]})}injectViewerApi(){function t(t){return Array.from(t.querySelectorAll("*"))}const i=t(this.hostElement);i.filter((t=>t.nodeName.startsWith("VERTEX-"))).reduce(((i,s)=>[...i,s,...t(s)]),[]).forEach((t=>{t.viewer=this.hostElement}))}syncViewerStyles(){var t;const i=this.getBackgroundColor();(t=this.stream)===null||t===void 0?void 0:t.update({frameBgColor:i,streamAttributes:this.getStreamAttributes()})}calculateComponentDimensions(){var t;const i=2073600;const s=this.getBounds();if((s===null||s===void 0?void 0:s.width)!=null&&(s===null||s===void 0?void 0:s.height)!=null){const n=f.create(s.width,s.height);const e=f.scaleFit(i,n);this.hostDimensions=n;this.dimensions=e!=null?f.create(e.width,e.height):undefined;this.viewport=zt.fromDimensions((t=this.getCanvasDimensions())!==null&&t!==void 0?t:f.create(0,0))}}recalculateComponentDimensions(){var t;if(this.isResizing){this.calculateComponentDimensions();this.isResizing=false;if(((t=this.stream)===null||t===void 0?void 0:t.getState().type)==="connected"){this.updateDimensions(this.dimensions)}}}reportPerformance(t){if(this.stateMap.streamState.type==="connected"){const i={timings:t.map((t=>({receiveToPaintDuration:m(t.duration)})))};this.getStream().recordPerformance(i,false)}}addStreamListeners(){this.stateMap.streamListeners=this.getStream().stateChanged.on((t=>{this.handleStreamStateChanged(this.stateMap.streamState,t)}))}handleStreamStateChanged(t,i){this.stateMap.streamState=i;if(i.type==="connecting"){this.handleConnecting(t,i)}else if(i.type==="connected"){this.handleConnected(t,i)}else if(i.type==="connection-failed"){this.handleConnectionFailed(t,i)}else if(i.type==="disconnected"){this.handleDisconnected(t,i)}}handleConnecting(t,i){if(t.type!=="connecting"){this.token=undefined;this.errorMessage=undefined;this.emitConnectionChange({status:"connecting"})}}handleConnected(t,i){var s;this.token=i.token.token;if(t.type!=="connected"){this.errorMessage=undefined;this.canvasRenderer=$i(Ri,Ki(),this.getResolvedConfig().flags.logFrameRate,(t=>this.reportPerformance(t)));this.emitConnectionChange({status:"connected",jwt:i.token.token});this.deviceIdChange.emit(i.deviceId)}if(((s=this.frame)===null||s===void 0?void 0:s.getId())!==i.frame.getId()){this.updateFrame(i.frame)}this.updateDimensions(this.dimensions)}handleConnectionFailed(t,i){if(t.type!=="connection-failed"){this.token=undefined;this.errorMessage=i.message;this.emitConnectionChange({status:"connection-failed",errorMessage:i.message})}}handleDisconnected(t,i){if(t.type!=="disconnected"){this.token=undefined;this.errorMessage=undefined;this.emitConnectionChange({status:"disconnected"})}}updateDimensions(t){var i;(i=this.stream)===null||i===void 0?void 0:i.update({dimensions:t});this.dimensionschange.emit(t)}async updateFrame(t){var i;const s=this.getCanvasDimensions();const n=this.frameRenderVersion;if(this.canvasElement!=null&&s!=null&&((i=this.frame)===null||i===void 0?void 0:i.getId())!==t.getId()){const i=this.canvasElement.getContext("2d");if(i!=null){const e=this.frame;this.frame=yt(t,e);this.updateInteractionApi(e);const o={canvas:i,canvasDimensions:s,dimensions:this.dimensions,frame:this.frame,viewport:this.viewport,beforeDraw:()=>{this.updateCanvasDimensions(s);this.isResizeUpdate=false},predicate:()=>{if(this.isResizeUpdate){return this.dimensions==null||f.isEqual(this.dimensions,o.frame.image.imageAttr.frameDimensions)}return true}};this.frameReceived.emit(this.frame);if(this.frame.scene.hasChanged){this.sceneChanged.emit()}const a=await this.canvasRenderer(o);if(a!=null&&n===this.frameRenderVersion){this.updateViewerBackground();this.dispatchFrameDrawn(a)}}}}updateViewerBackground(){const t=this.getBackgroundColor();jt((()=>{var i,s;(i=this.viewerContainerElement)===null||i===void 0?void 0:i.style.setProperty("background",t!=null?P.toHexString(t):"#ffffff");(s=this.canvasContainerElement)===null||s===void 0?void 0:s.style.setProperty("background",t!=null?P.toHexString(t):"#ffffff")}))}async initializeDefaultInteractionHandlers(){var t;await this.initializeDefaultCameraInteractionHandlers();await this.initializeDefaultTapInteractionHandler();this.initializeDefaultKeyboardInteractionHandlers();if(this.rotateAroundTapPoint){(t=this.baseInteractionHandler)===null||t===void 0?void 0:t.setPrimaryInteractionType("rotate-point")}}clearDefaultCameraInteractionHandlers(){this.defaultInteractionHandlerDisposables.forEach((t=>t.dispose()));this.defaultInteractionHandlerDisposables=[]}clearDefaultKeyboardInteractions(){this.defaultTapKeyInteractions.forEach((t=>{const i=this.tapKeyInteractions.indexOf(t);if(i!==-1){this.tapKeyInteractions.splice(i,1)}}));this.tapKeyInteractions=[]}async initializeDefaultCameraInteractionHandlers(){var t,i;this.clearDefaultCameraInteractionHandlers();if(this.cameraControls){if(window.PointerEvent!=null){this.baseInteractionHandler=(t=this.baseInteractionHandler)!==null&&t!==void 0?t:new Ti((()=>this.getResolvedConfig()));const i=await this.registerInteractionHandler(this.baseInteractionHandler);const s=await this.registerInteractionHandler(new ki);this.defaultInteractionHandlerDisposables=[i,s]}else{this.baseInteractionHandler=(i=this.baseInteractionHandler)!==null&&i!==void 0?i:new Si((()=>this.getResolvedConfig()));const t=await this.registerInteractionHandler(this.baseInteractionHandler);const s=await this.registerInteractionHandler(new Di);this.defaultInteractionHandlerDisposables=[t,s]}}}initializeDefaultKeyboardInteractionHandlers(){var t;this.clearDefaultKeyboardInteractions();if(this.keyboardControls&&this.stream!=null){(t=this.baseInteractionHandler)===null||t===void 0?void 0:t.setDefaultKeyboardControls(this.keyboardControls);const i=new ci(this.stream,(()=>this.getResolvedConfig()),(()=>this.getImageScale()));const s=new pi(this.stream,(()=>this.getResolvedConfig()),(()=>this.getImageScale()),(()=>this.createScene()));this.registerTapKeyInteraction(i);this.registerTapKeyInteraction(s);this.defaultTapKeyInteractions=[i,s]}}async initializeDefaultTapInteractionHandler(){if(this.tapHandlerDisposable==null){if(window.PointerEvent!=null){const t=new Ai("pointerdown","pointerup","pointermove",(()=>this.getResolvedConfig()));this.tapHandlerDisposable=await this.registerInteractionHandler(t)}else{const t=new Ai("mousedown","mouseup","mousemove",(()=>this.getResolvedConfig()));this.tapHandlerDisposable=await this.registerInteractionHandler(t)}}}initializeInteractionHandler(t){if(this.stateMap.interactionTarget==null){throw new H("Cannot initialize interaction handler. Interaction target is undefined.")}if(this.interactionApi==null){throw new H("Cannot initialize interaction handler. Interaction APi is undefined.")}t.initialize(this.stateMap.interactionTarget,this.interactionApi)}initializeBasicInteractionHandler(t){if(this.stateMap.interactionTarget==null){throw new H("Cannot initialize interaction handler. Interaction target is undefined.")}t.initialize(this.stateMap.interactionTarget)}createInteractionApi(){if(this.stream==null){throw new V("Cannot create interaction API. Component has not been initialized.")}return this.frame==null||this.frame.scene.camera.isPerspective()?new fi(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 di(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()}))}async createScene(){const t=await this.waitForConnectedState();const i=bt();const{frame:s,sceneId:n,sceneViewId:e,worldOrientation:o}=t;return new xt(this.getStream(),s,pt(o),i,(()=>this.getImageScale()),this.viewport,n,e)}getBackgroundColor(){if(this.canvasContainerElement!=null){const t=xs(this.hostElement,"--image-background");const i=xs(this.hostElement,"--viewer-background");const s=t!==null&&t!==void 0?t:i;return s!=null?P.fromCss(s):P.create(255,255,255)}}getBounds(){return Ds(this.hostElement)}getCanvasDimensions(){return this.getResolvedConfig().flags.letterboxFrames?this.dimensions:this.hostDimensions}getImageScale(){const t=this.getCanvasDimensions();if(this.dimensions!=null&&t!=null){return a.create(this.dimensions.width/t.width,this.dimensions.height/t.height)}}getStreamAttributes(){return{depthBuffers:this.getDepthBufferStreamAttributesValue(),experimentalRenderingOptions:this.experimentalRenderingOptions,featureHighlighting:this.featureHighlighting,featureLines:this.featureLines,featureMaps:this.featureMaps,frames:{frameBackgroundColor:this.getBackgroundColor()},noDefaultLights:this.noDefaultLights,phantom:this.phantom,sceneComparison:this.sceneComparison,selectionHighlighting:this.selectionHighlighting,crossSectioning:this.crossSectioning}}updateCanvasDimensions(t){if(this.canvasElement!=null){this.canvasElement.width=t.width;this.canvasElement.height=t.height}}updateStreamAttributes(){var t;(t=this.stream)===null||t===void 0?void 0:t.update({streamAttributes:this.getStreamAttributes()})}updateEnableTemporalRefinement(){var t;(t=this.stream)===null||t===void 0?void 0:t.update({enableTemporalRefinement:this.enableTemporalRefinement})}updateInteractionApi(t){if(this.frame!=null){const i=(t==null||t.scene.camera.isPerspective())&&this.frame.scene.camera.isOrthographic();const s=(t==null||t.scene.camera.isOrthographic())&&this.frame.scene.camera.isPerspective();if(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;if(this.frame!=null){if(this.cameraType==="orthographic"&&this.frame.scene.camera.isPerspective()){(t=this.stream)===null||t===void 0?void 0:t.replaceCamera({camera:nt(Ct(this.frame.scene.camera,this.frame.scene.boundingBox))})}else if(this.cameraType==="perspective"&&this.frame.scene.camera.isOrthographic()){(i=this.stream)===null||i===void 0?void 0:i.replaceCamera({camera:nt(St(this.frame.scene.camera))})}}}handleAnnotationSetsChange(t){if(t>0&&this.getDepthBufferStreamAttributesValue()==null){this.stateMap.depthBuffersOverrideForAnnotations=true;this.updateStreamAttributes()}else if(t===0&&this.stateMap.depthBuffersOverrideForAnnotations){this.stateMap.depthBuffersOverrideForAnnotations=false;this.updateStreamAttributes()}}getDepthBufferStreamAttributesValue(){var t;const i=(t=this.depthBuffers)!==null&&t!==void 0?t:this.rotateAroundTapPoint||this.stateMap.depthBuffersOverrideForAnnotations?"final":undefined;return i}updateResolvedConfig(){this.resolvedConfig=Et(this.configEnv,this.config)}getResolvedConfig(){return Rs("Resolved config is undefined",(()=>this.resolvedConfig))}getStream(){return Rs("Stream is undefined",(()=>this.stream))}getDeviceId(){if(this.deviceId==null){try{this.deviceId=vs(fs.DEVICE_ID,(t=>t["device-id"]))}catch(t){console.warn("Cannot read device ID. Local storage is not supported.")}if(this.deviceId==null){this.deviceId=D.create();try{ms(fs.DEVICE_ID,{["device-id"]:this.deviceId})}catch(t){console.warn("Cannot write device ID. Local storage is not supported.")}}}return this.deviceId}async waitForConnectedState(){if(this.stateMap.streamState.type!=="connected"){console.debug("Stream was not in a connected state. Waiting for successful connection.");return new Promise(((t,i)=>{const s=this.getStream().onStateChanged((i=>{if(i.type==="connected"){t(i)}}));setTimeout((()=>{s.dispose();i(new Error("Timed out waiting for connected state."))}),As)}))}return this.stateMap.streamState}get hostElement(){return this}static get watchers(){return{src:[{handleSrcChanged:0}],cameraControls:[{handleCameraControlsChanged:0}],keyboardControls:[{handleKeyboardControlsChanged:0}],rotateAroundTapPoint:[{handleRotateAboutTapPointChanged:0}],cameraType:[{handleCameraTypeChanged:0}],crossSectioning:[{handleStreamAttributesChanged:0}],depthBuffers:[{handleStreamAttributesChanged:0}],experimentalRenderingOptions:[{handleStreamAttributesChanged:0}],featureHighlighting:[{handleStreamAttributesChanged:0}],featureLines:[{handleStreamAttributesChanged:0}],featureMaps:[{handleStreamAttributesChanged:0}],noDefaultLights:[{handleStreamAttributesChanged:0}],phantom:[{handleStreamAttributesChanged:0}],sceneComparison:[{handleStreamAttributesChanged:0}],selectionHighlighting:[{handleStreamAttributesChanged:0}],enableTemporalRefinement:[{handleEnableTemporalRefinementChanged:0}],config:[{handleConfigChanged:0}],configEnv:[{handleConfigEnvChanged:0}]}}static get style(){return Es()}},[257,"vertex-viewer",{src:[1],clientId:[1,"client-id"],deviceId:[1025,"device-id"],config:[1],configEnv:[1,"config-env"],resolvedConfig:[1040],cameraControls:[4,"camera-controls"],cameraType:[1537,"camera-type"],keyboardControls:[4,"keyboard-controls"],rotateAroundTapPoint:[4,"rotate-around-tap-point"],token:[1025],depthBuffers:[1,"depth-buffers"],phantom:[16],noDefaultLights:[4,"no-default-lights"],enableTemporalRefinement:[4,"enable-temporal-refinement"],experimentalRenderingOptions:[1,"experimental-rendering-options"],featureLines:[16],selectionHighlighting:[16],featureHighlighting:[16],sceneComparison:[16],crossSectioning:[16],featureMaps:[1,"feature-maps"],resizeDebounce:[2,"resize-debounce"],frame:[1040],stream:[1040],stencilBuffer:[1040],viewport:[1040],annotations:[1040],modelViews:[1040],pmi:[1040],sceneItems:[1040],canvases:[1040],experimentalSkipVisibilityCheck:[4,"experimental-skip-visibility-check"],dimensions:[32],hostDimensions:[32],errorMessage:[32],cursor:[32],stateMap:[32],dispatchFrameDrawn:[64],registerInteractionHandler:[64],registerBasicInteractionHandler:[64],registerTapKeyInteraction:[64],getInteractionTarget_DEPRECATED:[64],addCursor:[64],getInteractionHandlers:[64],getKeyInteractions:[64],getBaseInteractionHandler:[64],getJwt:[64],load:[64],unload:[64],reload:[64],scene:[64],isSceneReady:[64]},[[0,"tap","handleTapEvent"]],{src:[{handleSrcChanged:0}],cameraControls:[{handleCameraControlsChanged:0}],keyboardControls:[{handleKeyboardControlsChanged:0}],rotateAroundTapPoint:[{handleRotateAboutTapPointChanged:0}],cameraType:[{handleCameraTypeChanged:0}],crossSectioning:[{handleStreamAttributesChanged:0}],depthBuffers:[{handleStreamAttributesChanged:0}],experimentalRenderingOptions:[{handleStreamAttributesChanged:0}],featureHighlighting:[{handleStreamAttributesChanged:0}],featureLines:[{handleStreamAttributesChanged:0}],featureMaps:[{handleStreamAttributesChanged:0}],noDefaultLights:[{handleStreamAttributesChanged:0}],phantom:[{handleStreamAttributesChanged:0}],sceneComparison:[{handleStreamAttributesChanged:0}],selectionHighlighting:[{handleStreamAttributesChanged:0}],enableTemporalRefinement:[{handleEnableTemporalRefinementChanged:0}],config:[{handleConfigChanged:0}],configEnv:[{handleConfigEnvChanged:0}]}]);function Rs(t,i){const s=i();if(s!=null){return s}else throw new Error(t)}function Bs(){if(typeof customElements==="undefined"){return}const i=["vertex-viewer"];i.forEach((i=>{switch(i){case"vertex-viewer":if(!customElements.get(t(i))){customElements.define(t(i),Ms)}break}}))}Bs();const zs=Ms;const Ls=Bs;export{zs as VertexViewer,Ls as defineCustomElement};
|
|
5
5
|
//# sourceMappingURL=vertex-viewer.js.map
|