@vertexvis/viewer 0.23.7-canary.1 → 0.23.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{cursors-d0bd6404.js → cursors-a1da6c6b.js} +19 -1
- package/dist/cjs/cursors-a1da6c6b.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/vertex-viewer-box-query-tool.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-measurement-distance.cjs.entry.js +14 -14
- package/dist/cjs/vertex-viewer-measurement-distance.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-measurement-precise.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-pin-tool.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer.cjs.entry.js +1 -1
- package/dist/collection/components/viewer-measurement-distance/viewer-measurement-distance.js +13 -13
- package/dist/collection/components/viewer-measurement-distance/viewer-measurement-distance.js.map +1 -1
- package/dist/collection/lib/cursors.js +18 -0
- package/dist/collection/lib/cursors.js.map +1 -1
- package/dist/components/cursors.js +18 -0
- package/dist/components/cursors.js.map +1 -1
- package/dist/components/vertex-viewer-measurement-distance.js +13 -13
- package/dist/components/vertex-viewer-measurement-distance.js.map +1 -1
- package/dist/esm/{cursors-34b3da50.js → cursors-70716df3.js} +19 -1
- package/dist/esm/cursors-70716df3.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/vertex-viewer-box-query-tool.entry.js +1 -1
- package/dist/esm/vertex-viewer-measurement-distance.entry.js +14 -14
- package/dist/esm/vertex-viewer-measurement-distance.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-measurement-precise.entry.js +1 -1
- package/dist/esm/vertex-viewer-pin-group.entry.js +1 -1
- package/dist/esm/vertex-viewer-pin-tool.entry.js +1 -1
- package/dist/esm/vertex-viewer.entry.js +1 -1
- package/dist/types/components/viewer-measurement-distance/viewer-measurement-distance.d.ts +3 -3
- package/dist/types/lib/cursors.d.ts +8 -0
- package/dist/viewer/index.esm.js +1 -1
- package/dist/viewer/{p-d3bcde8b.entry.js → p-6f1ed862.entry.js} +2 -2
- package/dist/viewer/{p-401ada4a.entry.js → p-82a0dcb2.entry.js} +2 -2
- package/dist/viewer/{p-14765f2d.entry.js → p-af7987b2.entry.js} +2 -2
- package/dist/viewer/p-af7987b2.entry.js.map +1 -0
- package/dist/viewer/{p-84d1293d.entry.js → p-c878e4ac.entry.js} +2 -2
- package/dist/viewer/{p-d2ddc770.entry.js → p-caaf5f09.entry.js} +2 -2
- package/dist/viewer/{p-aa5bf24d.entry.js → p-cd746316.entry.js} +2 -2
- package/dist/viewer/p-d457f24a.js +5 -0
- package/dist/viewer/p-d457f24a.js.map +1 -0
- package/dist/viewer/viewer.esm.js +1 -1
- package/package.json +7 -7
- package/readme.md +4 -4
- package/dist/cjs/cursors-d0bd6404.js.map +0 -1
- package/dist/esm/cursors-34b3da50.js.map +0 -1
- package/dist/viewer/p-14765f2d.entry.js.map +0 -1
- package/dist/viewer/p-d7952e13.js +0 -5
- package/dist/viewer/p-d7952e13.js.map +0 -1
- /package/dist/viewer/{p-d3bcde8b.entry.js.map → p-6f1ed862.entry.js.map} +0 -0
- /package/dist/viewer/{p-401ada4a.entry.js.map → p-82a0dcb2.entry.js.map} +0 -0
- /package/dist/viewer/{p-84d1293d.entry.js.map → p-c878e4ac.entry.js.map} +0 -0
- /package/dist/viewer/{p-d2ddc770.entry.js.map → p-caaf5f09.entry.js.map} +0 -0
- /package/dist/viewer/{p-aa5bf24d.entry.js.map → p-cd746316.entry.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2025 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,c as i,h as s,H as n,g as e}from"./p-6685b50e.js";import{p as o,v as r,c as h,g as a,r as c,b as l,y as u,d}from"./p-021bcb25.js";import{S as f}from"./p-d456a65b.js";import{t as p,p as m,a as w,S as v,c as g,W as y}from"./p-28dfd6fb.js";import{m as b,E as C,b as P,c as I,o as T,u as S,a as A}from"./p-da65b274.js";import{c as D}from"./p-9d9c943e.js";import{u as j,c as k,p as x,C as M,W as E,S as O,V as R,d as B,e as z}from"./p-243cc2b6.js";import{s as L,p as $,f as K}from"./p-b53cd80d.js";import{r as F,c as H,a as N}from"./p-b9d95f63.js";import{o as V,p as W,q as _,l as q,r as U,s as J,j as X,u as G,t as Z,x as Q,m as Y,y as tt,z as it,B as st,C as nt,E as et,G as ot,H as rt,I as ht,J as at,K as ct,M as lt,N as ut,P as dt,Q as ft,R as pt,T as mt}from"./p-fdfb1d5a.js";import{t as wt,m as vt,n as gt,j as yt,M as bt,k as Ct,S as Pt}from"./p-dedb6440.js";import{p as It}from"./p-f71c157e.js";import{C as Tt}from"./p-d7952e13.js";import{g as St,c as At}from"./p-3d985864.js";import{E as Dt}from"./p-ab1cef89.js";import{V as jt}from"./p-8c65c44d.js";import{B as kt,M as xt}from"./p-3f05f3e7.js";import{w as Mt}from"./p-b276d65a.js";import"./p-4dab2cc5.js";import"./p-bcce32b5.js";import"./p-eb4743a1.js";import"./p-308fcf7c.js";const Et=0;const Ot=255;class Rt{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}=V(t);const[o,r]=await Promise.all([W(new Uint8Array(i)),W(new Uint8Array(s))]);return Bt.fromPng(o,n,i,_.fromPng(r,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 Bt{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 Bt(i,s,t.data,t.channels,n)}}getValue(t){const{width:i,height:s}=this.imageAttr.imageRect;const n=o.subtract(t,this.imageAttr.imageRect);const e=1/this.imageAttr.imageScale;const r=o.scale(n,e,e);if(r.x>=0&&r.y>=0&&r.x<i&&r.y<s){const t=Math.floor(r.x)+Math.floor(r.y)*i;const s=this.pixelBytes[t];return s}else return 0}hitTest(t){return this.getValue(t)!==Et}snapToNearestPixel(t,i,s=(()=>true)){const n=i*2;const e=o.create(t.x-i,t.y-i);const r=[];for(let h=0;h<n*n;h++){const a=h%n;const c=Math.floor(h/n);const l=o.add(e,{x:a,y:c});if(o.distance(l,t)<=i){const t=this.getValue(l);if(t===Ot&&s(t)){r.push(l)}}}const h=r.sort(((i,s)=>o.distance(i,t)-o.distance(s,t)));const a=h[0];return a!=null?o.create(Math.floor(a.x)+.5,Math.floor(a.y)+.5):t}}function zt(t){return t!=null&&t["then"]instanceof Function&&t["catch"]instanceof Function&&t["finally"]instanceof Function}function Lt(t){return new Promise((i=>setTimeout(i,t)))}const $t=b.defineMapper(b.compose((t=>t.toObject()),b.read(b.mapRequiredProp("id",q),b.mapRequiredProp("createdAt",U),b.mapRequiredProp("modifiedAt",U),b.mapProp("name",J),b.mapProp("suppliedId",J))),(([t,i,s,n,e])=>({id:t,createdAt:i,modifiedAt:s,name:n,suppliedId:e})));const Kt=b.ifInvalidThrow($t);const Ft=b.defineMapper(b.compose((t=>t.toObject()),b.read(b.mapRequiredProp("id",q),b.mapRequiredProp("createdAt",U),b.mapRequiredProp("modifiedAt",U),b.mapProp("suppliedId",J),b.mapRequiredProp("data",(t=>{if(t.callout!=null){return Nt(t.callout)}else if(t.customJson!=null){return Vt(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 Ht=b.ifInvalidThrow(Ft);const Nt=b.defineMapper(b.read(b.mapRequiredProp("position",X),b.mapProp("icon",J),b.mapProp("primaryColor",J),b.mapProp("accentColor",J)),(([t,i,s,n])=>({type:"callout",position:t,icon:i,primaryColor:s,accentColor:n})));const Vt=b.defineMapper(b.read(b.requiredProp("type"),b.mapRequiredProp("jsonData",(t=>JSON.parse(t)))),(([t,i])=>({type:"custom",jsonType:t,jsonData:i})));class Wt{constructor(t,i,s){this.client=t;this.jwtProvider=i;this.deviceIdProvider=s;this.onStateChange=new C}async addAnnotationSet(t){await F((async i=>{const s=this.deviceIdProvider();const n=await H(this.jwtProvider,s);const e=new L.CreateSceneViewAnnotationSetRequest;const o=new j.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:Object.assign(Object.assign({},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 H(this.jwtProvider,s);const e=new L.DeleteSceneViewAnnotationSetRequest;const o=new j.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 Lt(t);await s(t)}};P.abort(i.signal,s(t));return i}fetchAnnotationSets(){return N((t=>async i=>{const s=this.deviceIdProvider();const n=await H(this.jwtProvider,s);const e=new L.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 P.asArray(this.fetchAnnotationSets())).flatMap((t=>t.getSceneAnnotationSetsList())).map((t=>Kt(t)))}fetchAnnotations(t){return N((i=>async s=>{const n=this.deviceIdProvider();const e=await H(this.jwtProvider,n);const o=new L.ListSceneAnnotationsRequest;const r=wt(t);o.setSceneAnnotationSetId(r);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 P.asArray(this.fetchAnnotations(t.id))).flatMap((t=>t.getSceneAnnotationsList())).map((t=>Ht(t)));return[t,i]}));return Promise.all(i)}updateState(t){this.state=t;this.onStateChange.emit(t)}}class _t{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:o.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:p(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 qt{constructor(t,i,s,n,e,o,r,h,a,c,l){this.stream=t;this.cursors=i;this.getConfig=s;this.getScene=n;this.getFrame=e;this.getViewport=o;this.tapEmitter=r;this.doubleTapEmitter=h;this.longPressEmitter=a;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 Dt.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(){if(!this.isInteracting()){this.interactionStartedEmitter.emit();this.sceneLoadingPromise=this.getScene();this.currentCamera=(await this.sceneLoadingPromise).camera();this.sceneLoadingPromise=undefined;await this.stream.beginInteraction()}}async transformCamera(...t){var i;const s=t[0];const n=t[1];if(this.isInteracting()){const t=await this.getScene();const e=this.getViewport();const o=this.getFrame();const r=await(o===null||o===void 0?void 0:o.depthBuffer());this.currentCamera=this.currentCamera!=null&&e!=null&&o!=null?s({camera:this.currentCamera,viewport:e,scale:t.scale(),boundingBox:t.boundingBox(),frame:o,depthBuffer:r}):undefined;await((i=this.currentCamera)===null||i===void 0?void 0:i.render(n))}}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=o.create(s.width/2,s.height/2);const e=h.toDegrees(h.fromPoints(n,t[0]));const a=this.lastAngle!=null?e-this.lastAngle:0;this.lastAngle=e;const c=r.normalize(r.subtract(i.lookAt,i.position));const l=h.toRadians(-a);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 r=o.direction;const h=n.transformPointToRay(t,s.image,o);const l=a.fromNormalAndCoplanarPoint(r,i.lookAt);const u=c.intersectPlane(h,l);if(u==null){console.warn("Cannot determine fallback for pan. Ray does not intersect plane.");return i}const d=e!=null?this.getWorldPoint(t,e,u):u;const f=a.fromNormalAndCoplanarPoint(r,d);this.panData={hitPt:d,hitPlane:f,startingCamera:o}}if(this.panData!=null){const{hitPt:e,hitPlane:o,startingCamera:h}=this.panData;const a=n.transformPointToRay(t,s.image,h);const l=c.intersectPlane(a,o);if(l!=null){const t=r.subtract(e,l);return i.update(h).moveBy(t)}}return i}))}async viewAll(){await(await this.getScene()).camera().viewAll().render()}async rotateCamera(t){return this.transformCamera((({camera:i,viewport:s,boundingBox:n})=>{const e=r.normalize(i.up);const o=r.normalize(r.subtract(i.lookAt,i.position));const h=r.cross(e,o);const a=r.cross(o,h);const c=r.normalize({x:t.x*h.x+t.y*a.x,y:t.x*h.y+t.y*a.y,z:t.x*h.z+t.y*a.z});const l=r.cross(c,o);const u=9.5*t.x/s.width;const d=9.5*t.y/s.height;const f=Math.abs(u)+Math.abs(d);return i.rotateAroundAxis(f,l)}))}async rotateCameraAtPoint(t,i){return this.transformCamera((({camera:s,viewport:n,boundingBox:e,depthBuffer:o})=>{if(this.worldRotationPoint==null){const t=l.center(e);this.worldRotationPoint=o!=null?this.getWorldPoint(i,o,t):s.lookAt}const h=r.normalize(s.up);const a=r.normalize(r.subtract(s.lookAt,s.position));const c=r.cross(h,a);const u=r.cross(a,c);const d=r.normalize({x:t.x*c.x+t.y*u.x,y:t.x*c.y+t.y*u.y,z:t.x*c.z+t.y*u.z});const f=r.cross(d,a);const p=9.5*t.x/n.width;const m=9.5*t.y/n.height;const w=Math.abs(p)+Math.abs(m);const v=s.rotateAroundAxisAtPoint(w,this.worldRotationPoint,f);return v.update({lookAt:r.add(r.scale(Math.abs(s.signedDistanceToBoundingBoxCenter())/r.magnitude(v.viewVector),v.viewVector),v.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 h=r.normalize(n);const a=r.scale(o,h);const c=r.add(i.position,a);const l=i.update({position:c});return l}else{const o=i;const h=i.toFrameCamera();const u=h.direction;const d=s.transformPointToRay(s.center,n.image,h);const f=4*(t/s.height);const p=r.magnitude(l.diagonal(e))*1e-5;const m=Math.max(p,o.fovHeight*(1-f));const w=a.fromNormalAndCoplanarPoint(u,h.lookAt);const v=c.intersectPlane(d,w);if(v!=null){const t=a.projectPoint(w,o.lookAt);const s=(o.fovHeight-m)/o.fovHeight;const n=r.scale(s,r.subtract(v,t));const e=r.add(o.lookAt,n);const h=i.update({lookAt:e,rotationPoint:e,fovHeight:m});return h}}}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 u=r.cross(c,l);const d=r.rotateAboutAxis(h.toRadians(t),o,l,n);const f=r.rotateAboutAxis(h.toRadians(i),d,u,n);return s.update(Object.assign(Object.assign({},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()}}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:r=false,shiftKey:h=false}=s;t({position:i,altKey:e,ctrlKey:o,metaKey:r,shiftKey:h,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 Ut extends qt{constructor(t,i,s,n,e,o,r,h,a,c,l){super(t,i,s,n,e,o,r,h,a,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 h=r.normalize(n);const a=o.scale(t,.5,.5);const c=r.magnitude(n);const l=a.x*c/s.width;const u=a.y*c/s.height;const d=r.cross(e,h);const f=r.cross(h,d);const p=r.add(r.scale(l,d),r.scale(u,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 r=n.transformPointToRay(t,s.image,e);const h=a.fromNormalAndCoplanarPoint(o,i.lookAt);const l=c.intersectPlane(r,h);if(l==null){console.warn("Cannot determine fallback for pan. Ray does not intersect plane.");return i}this.panData={hitPt:l,hitPlane:h,startingCamera:e}}if(this.panData!=null){const{hitPt:e,hitPlane:o,startingCamera:h}=this.panData;const a=n.transformPointToRay(t,s.image,h);const l=c.intersectPlane(a,o);if(l!=null){const t=r.subtract(e,l);const s=r.add(h.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:h,boundingBox:u})=>{if(this.orthographicZoomData==null||o.distance(t,this.orthographicZoomData.startingScreenPt)>2){const i=s.toFrameCamera();const o=i.direction;const r=n.transformPointToRay(t,e.image,i);const l=a.fromNormalAndCoplanarPoint(o,i.lookAt);const u=c.intersectPlane(r,l);if(u==null){console.warn("Cannot determine fallback point for zoom. Ray does not intersect plane.");return s}const d=h!=null?this.getWorldPoint(t,h,u):u;const f=a.fromNormalAndCoplanarPoint(o,d);this.orthographicZoomData={hitPt:d,hitPlane:f,startingScreenPt:t}}if(this.orthographicZoomData!=null){const{hitPt:t,hitPlane:e}=this.orthographicZoomData;const o=4*(i/n.height);const h=r.magnitude(l.diagonal(u))*1e-5;const c=Math.max(h,s.fovHeight*(1-o));const d=a.projectPoint(e,s.lookAt);const f=(s.fovHeight-c)/s.fovHeight;const p=r.scale(f,r.subtract(t,d));const m=r.add(s.lookAt,p);return s.update({lookAt:m,rotationPoint:m,fovHeight:c})}return s}))}async rotateCamera(t){return this.transformCamera((({camera:i,viewport:s,boundingBox:n})=>{var e;const o=r.normalize(i.up);const h=r.normalize(r.subtract(i.lookAt,i.position));const a=r.cross(o,h);const c=r.cross(h,a);const u=r.normalize({x:t.x*a.x+t.y*c.x,y:t.x*a.y+t.y*c.y,z:t.x*a.z+t.y*c.z});const d=r.cross(u,h);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 w=i.rotationPoint!=null&&((e=i.rotationPoint)===null||e===void 0?void 0:e.x)!=null?i.rotationPoint:i.lookAt;const v=i.rotateAroundAxisAtPoint(m,w,d);const g=G(v.lookAt,v.viewVector,l.center(n));return v.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 Jt=.2;class Xt extends qt{constructor(t,i,s,n,e,o,r,h,a,c,l){super(t,i,s,n,e,o,r,h,a,c,l)}async panCameraByDelta(t){return this.transformCamera((({camera:i,viewport:s})=>{var n;const e=i.viewVector;const h=r.normalize(i.up);const a=r.normalize(e);const c=o.scale(t,.25,.25);const l=r.magnitude(e)*Math.tan((n=i.fovY)!==null&&n!==void 0?n:45);const u=c.x*l/s.width;const d=c.y/s.width*l;const f=r.cross(h,a);const p=r.cross(a,f);const m=r.add(r.scale(u,f),r.scale(d,p));return i.moveBy(m)}))}async zoomCameraToPoint(t,i){return this.transformCamera((({camera:s,viewport:n,frame:e,depthBuffer:o,boundingBox:h})=>{const l=e.scene.camera;const u=l.direction;const d=s.toFrameCamera();const f=n.transformPointToRay(t,e.image,d);if(this.zoomData==null){const i=a.fromNormalAndCoplanarPoint(u,l.lookAt);const n=c.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 r=a.fromNormalAndCoplanarPoint(u,e);this.zoomData={hitPt:e,hitPlane:r}}if(this.zoomData!=null){const{hitPlane:t}=this.zoomData;const{position:e,distance:o,isPastHitPlane:l,keepCurrent:u}=this.computeZoomDistances(i,s,n,h,f,this.zoomData);if(l&&!u){const t=c.create({origin:e,direction:r.normalize(s.viewVector)});return s.update({position:e,lookAt:c.at(t,o)})}else if(!u){return s.update({position:e,lookAt:a.projectPoint(t,e)})}}return s}))}walk(t){this.transformCamera((({camera:i,boundingBox:s})=>{const{position:n,up:e,lookAt:o}=i;const h=r.normalize(e);const a=r.normalize(i.viewVector);const c=Math.min(...r.toArray(l.lengths(s)));const u=r.scale(c,t);const d=r.cross(h,a);const f=r.cross(d,h);const p=r.scale(u.x,r.normalize(d));const m=r.scale(u.y,r.normalize(h));const w=r.scale(u.z,r.normalize(f));const v=r.negate(r.add(p,m,w));return i.update(Object.assign(Object.assign({},i),{position:r.add(n,v),lookAt:r.add(o,v)}))}))}computeZoomDistances(t,i,s,n,e,o){const h=this.getConfig();const{hitPt:a,hitPlane:l}=o;const u=h.useMinimumPerspectiveZoomDistance?this.computeZoomMinimumDistance(i,n):-1;const d=r.distance(i.position,a);const f=Math.max(u,d);const p=6*f*t/s.height;const m=c.at(e,p);const w=c.create({origin:m,direction:r.normalize(i.viewVector)});const v=c.intersectPlane(w,l);if(v==null&&h.useMinimumPerspectiveZoomDistance){const i=6*u*t/s.height;const n=c.at(e,i);return{position:n,distance:u,isPastHitPlane:true,keepCurrent:false}}else if(v==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 h=Math.abs(r.dot(r.normalize(t.viewVector),r.right()));const a=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*h;const u=n*a;const d=e*c;const f=o/s;const p=o/n;const m=o/e;return(l+u+d)/(f+p+m)*Jt}}class Gt{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:o.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:Z(n.update({lookAt:s,rotationPoint:s}).toFrameCamera()),animation:{duration:p(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 G(i,s,l.center(t.boundingBox()))}else{return i}}}class Zt{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}}zoom(t,i){}}class Qt extends Zt{constructor(){super(...arguments);this.type="rotate"}beginDrag(t,i,s){if(this.currentPosition==null){this.currentPosition=o.create(t.screenX,t.screenY);s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null){const s=o.create(t.screenX,t.screenY);const n=o.subtract(s,this.currentPosition);i.rotateCamera(n);this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class Yt extends Zt{constructor(){super(...arguments);this.type="rotate-point"}beginDrag(t,i,s){if(this.currentPosition==null){this.currentPosition=o.create(t.screenX,t.screenY);this.startingPosition=i;s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null&&this.startingPosition!=null){const s=o.create(t.screenX,t.screenY);const n=o.subtract(s,this.currentPosition);i.rotateCameraAtPoint(n,this.startingPosition);this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class ti extends Zt{constructor(t){super();this.interactionConfigProvider=t;this.type="zoom";this.didTransformBegin=false}beginDrag(t,i,s,n){if(this.currentPosition==null){this.currentPosition=o.create(t.clientX,t.clientY);const i=n.getBoundingClientRect();const e=St(t,i);this.startPt=e;s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null){const s=o.create(t.clientX,t.clientY);const n=o.subtract(s,this.currentPosition);if(this.startPt!=null){i.zoomCameraToPoint(this.startPt,n.y);this.currentPosition=s}}}endDrag(t,i){super.endDrag(t,i);this.stopInteractionTimer();this.didTransformBegin=false;this.startPt=undefined}zoom(t,i){this.operateWithTimer(i,(()=>i.zoomCamera(this.getDirectionalDelta(t))))}zoomToPoint(t,i,s){this.operateWithTimer(s,(()=>s.zoomCameraToPoint(t,this.getDirectionalDelta(i))))}beginInteraction(t){this.didTransformBegin=true;t.beginInteraction()}endInteraction(t){this.didTransformBegin=false;t.endInteraction()}resetInteractionTimer(t){this.stopInteractionTimer();this.startInteractionTimer(t)}getDirectionalDelta(t){return this.interactionConfigProvider().reverseMouseWheelDirection?-t:t}getInteractionDelay(){return this.interactionConfigProvider().mouseWheelInteractionEndDebounce}startInteractionTimer(t){this.interactionTimer=window.setTimeout((()=>{this.interactionTimer=undefined;this.endInteraction(t)}),this.getInteractionDelay())}stopInteractionTimer(){if(this.interactionTimer!=null){window.clearTimeout(this.interactionTimer);this.interactionTimer=undefined}}operateWithTimer(t,i){if(!this.didTransformBegin){this.beginInteraction(t)}this.resetInteractionTimer(t);i()}}class ii extends Zt{constructor(){super(...arguments);this.type="pan"}beginDrag(t,i,s,n){if(this.currentPosition==null){this.currentPosition=o.create(t.screenX,t.screenY);this.canvasRect=n.getBoundingClientRect();s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null&&this.canvasRect!=null){const s=St(t,this.canvasRect);i.panCameraToScreenPoint(s);this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class si extends Zt{constructor(){super(...arguments);this.type="twist"}beginDrag(t,i,s,n){this.currentPosition=o.create(t.offsetX,t.offsetY);this.canvasRect=n.getBoundingClientRect();s.beginInteraction()}drag(t,i){const s=St(t,this.canvasRect);this.currentPosition=s;i.twistCamera(s)}endDrag(t,i){super.endDrag(t,i)}}class ni extends Zt{constructor(){super(...arguments);this.type="pivot"}beginDrag(t,i,s){if(this.currentPosition==null){this.currentPosition=o.create(t.screenX,t.screenY);s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null){const s=o.create(t.screenX,t.screenY);const n=o.subtract(s,this.currentPosition);i.pivotCamera(-.25*n.y,.25*n.x);this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class ei extends kt{constructor(t,i=new Qt,s=new Yt,n=new ti((()=>t().interactions)),e=new ii,o=new si,r=new ni){super("mousedown","mouseup","mousemove",i,s,n,e,o,r,t)}}function oi(t){window.requestAnimationFrame(t)}class ri{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];oi((()=>{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 r=this.previousSecondPoints;this.previousFirstPoints=this.previousFirstPoints.slice(-1);this.previousSecondPoints=this.previousSecondPoints.slice(-1);const h=e.reduce(((t,i,s)=>{if(s<e.length-1){const n=e[s+1];const o=r[s];const h=r[s+1];return{deltas:[...t.deltas,this.computeDelta(i,o,n,h)],zooms:[...t.zooms,this.computeZoom(i,o,n,h)],angles:[...t.angles,this.computeAngle(i,o,n,h)]}}return t}),{deltas:[],zooms:[],angles:[]});const a=h.deltas.reduce(((t,i)=>o.add(t,i)),o.create());const c=h.zooms.reduce(((t,i)=>t+i),0);const l=h.angles.reduce(((t,i)=>t+i),0);const u=o.create((e[e.length-1].x+r[r.length-1].x)/2,(e[e.length-1].y+r[r.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(u,c);(s=this.interactionApi)===null||s===void 0?void 0:s.panCameraByDelta(a);(n=this.interactionApi)===null||n===void 0?void 0:n.twistCamera(l)}}))}endTwoPointTouch(){this.previousFirstPoints=[];this.previousSecondPoints=[]}computeDelta(t,i,s,n){return o.add(o.subtract(s,t),o.subtract(n,i))}computeZoom(t,i,s,n){const e=o.distance(s,n)-o.distance(t,i);return e*.5}computeAngle(t,i,s,n){const e=u.create(o.subtract(t,i),o.subtract(s,n));return h.toDegrees(Math.atan2(u.determinant(e),u.dot(e)))}}class hi extends ri{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=o.create(t.screenX,t.screenY);this.touchPoints=Object.assign(Object.assign({},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]=o.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 ai extends xt{constructor(t,i=new Qt,s=new Yt,n=new ti((()=>t().interactions)),e=new ii,o=new si,r=new ni){super("pointerdown","pointerup","pointermove",i,s,n,e,o,r,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=o.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 ci{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(o.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(o.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(o.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(o.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(o.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&&o.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,r=false)=>{var h;const a=e||this.pointerDownPosition;const c=((h=this.interactionApi)===null||h===void 0?void 0:h.pixelThreshold(r))||1;let l;if(this.interactionTimer!=null){l=this.getCanvasPosition(a||i)}else if(a!=null&&o.distance(a,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?o.create(s.left,s.top):undefined;return n!=null?o.subtract(o.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 li extends ri{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=o.create(i.screenX,i.screenY);if(t.touches[1]!=null){this.beginTwoPointTouch(this.currentPosition1,o.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=o.create(t.touches[0].clientX,t.touches[0].clientY);const s=o.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=o.create(t.screenX,t.screenY);if(this.currentPosition1!=null){const t=o.subtract(e,this.currentPosition1);const r=((i=this.interactionApi)===null||i===void 0?void 0:i.pixelThreshold(true))||2;if(o.distance(e,this.currentPosition1)>=r||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}}class ui{constructor(t,i=window.performance){this.name=t;this.perf=i;this.measures=new Set;this.nextId=0}clearMeasurements(){this.perf.clearMeasures(this.name)}measure(t){if(zt(t)){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 di=new ui("paint_time");function fi(t){return new Promise(((i,s)=>{const n=new Blob([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 k("Failed to load image data"));URL.revokeObjectURL(e)}));o.src=e}))}async function pi(t){const i=new Blob([t]);const s=await window.createImageBitmap(i);return{image:s,dispose:()=>s.close()}}function mi(t){if(window.createImageBitmap!=null){return pi(t)}else{return fi(t)}}const wi=1e3;function vi(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 gi(t,i){const s=t.takeMeasurements();if(s.length>0){i(s)}}function yi(t,i,s,n,e=wi){let o;let r=0;let h;let a=[];function c(){r++;if(o==null){o=setInterval((()=>{gi(t,n);if(r===0){u()}}),e)}}function l(){r--}function u(){if(o!=null){clearInterval(o);o=undefined}}if(s){setInterval((()=>{if(h!=null){if(a.length===5){a=[...a.slice(1),h]}else{a.push(h)}const t=a.reduce(((t,i)=>t+i))/a.length;console.debug(`Paint rate: ${h}fps`);console.debug(`Paint rate (avg): ${t}`);h=undefined}}),1e3)}return s=>{c();return t.measure((async()=>{const t=await i(s);h=h==null?1:h+1;return t})).finally((()=>l()))}}function bi(){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 mi(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);vi(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,r;const h=(r=(n=s.predicate)===null||n===void 0?void 0:n.call(s))!==null&&r!==void 0?r:true;t=[...t,...s.frame.correlationIds];if(h){return e(s).then((t=>o(s,t).then(i)))}}}function Ci(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 Pi(t){return i=>{const{drawFrame:s}=i.request;if(s!=null){t(s)(i)}}}const Ii=1*60;function Ti(t){let i=false;return s=>{const n=t();if(n!=null){const t=n.remoteTime(new Date(Date.now()));const e=p(s,t);const o=m(e).getTime();if(o>=0){return e}else{if(!i){console.warn(`Possible erroneous send to receive timing. Muting for ${Ii}s. [sent-at=${s.toISOString()}, received-at=${t.toISOString()}, remote-time=${n.knownRemoteTime.toISOString()}]`);i=true;setTimeout((()=>i=false),Ii*1e3)}return undefined}}}}function Si(t,i){const s=Ti(i);return Ci((i=>Pi((n=>n=>{const e=m(n.sentAtTime);if(e!=null){t.replyResult(i,{drawFrame:{sendToReceiveDuration:s(e)}})}}))))}const Ai=b.defineMapper(b.read(b.requiredProp("d"),b.requiredProp("ns"),b.mapRequiredProp("ka",Q),b.mapRequiredProp("kd",Q),b.mapRequiredProp("ks",Q),b.mapRequiredProp("ke",Q)),(([t,i,s,n,e,o])=>({opacity:t,glossiness:i,ambient:s,diffuse:n,specular:e,emissive:o})));const Di=b.defineMapper(b.read(b.mapRequiredProp("defaultMaterial",(()=>vt)),b.mapRequiredProp("colorMaterial",Ai)),(([t,i])=>({defaultMaterial:t,colorMaterial:i})));const ji=b.defineMapper(b.read(b.requiredProp("name"),b.requiredProp("category")),(([t,i])=>({name:t,category:i})));const ki=b.defineMapper(b.read(b.getProp("value")),(([t])=>({type:"string",value:t})));const xi=b.mapProp("string",b.ifDefined(ki));const Mi=b.defineMapper(b.read(b.getProp("value")),(([t])=>({type:"long",value:t})));const Ei=b.mapProp("pb_long",b.ifDefined(Mi));const Oi=b.defineMapper(b.read(b.getProp("value")),(([t])=>({type:"double",value:t})));const Ri=b.mapProp("pb_double",b.ifDefined(Oi));const Bi=b.defineMapper(b.read(b.requiredProp("value")),(([t])=>({type:"timestamp",value:t})));const zi=b.mapProp("date",b.ifDefined(Bi));const Li=b.compose(b.pickFirst(xi,Ei,Ri,zi),b.required("value"));const $i=b.defineMapper(b.read(b.requiredProp("id"),b.mapProp("key",b.ifDefined(ji)),b.mapProp("value",b.ifDefined(Li))),(([t,i,s])=>({id:t,key:i,value:s})));const Ki=b.defineMapper(b.read(b.mapProp("cursor",Y),b.mapRequiredProp("entriesList",b.mapArray($i))),(([t,i])=>({paging:{next:t},entries:i})));const Fi=b.ifInvalidThrow(Ki);const Hi=b.defineMapper(b.read(b.mapRequiredProp("id",q),b.mapRequiredProp("createdAt",tt),b.mapProp("materialOverride",b.ifDefined(Di)),b.mapProp("transform",b.ifDefined(it)),b.mapProp("isVisible",b.ifDefined(st)),b.mapProp("isSelected",b.ifDefined(st)),b.mapProp("isPhantom",b.ifDefined(st)),b.mapProp("endItem",b.ifDefined(st))),(([t,i,s,n,e,o,r,h])=>({id:t,createdAt:i,materialOverride:s,transform:n,isVisible:e,isSelected:o,isPhantom:r,endItem:h})));const Ni=b.defineMapper(b.read(b.mapRequiredProp("id",q),b.mapRequiredProp("createdAt",tt),b.mapRequiredProp("name",J),b.mapProp("parentId",b.ifDefined(q)),b.mapProp("suppliedId",b.ifDefined(J)),b.mapProp("boundingBox",b.ifDefined(nt)),b.mapProp("worldTransform",b.ifDefined(it)),b.mapProp("override",b.ifDefined(Hi))),(([t,i,s,n,e,o,r,h])=>({id:t,createdAt:i,name:s,parentId:n!==null&&n!==void 0?n:undefined,suppliedId:e,boundingBox:o,worldTransform:r,override:h})));const Vi=b.ifInvalidThrow(b.defineMapper(b.read(b.mapProp("item",b.ifDefined(Ni))),(([t])=>t!==null&&t!==void 0?t:undefined)));class Wi{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 H(this.jwtProvider,e);const r=new L.GetSceneViewItemRequest;r.setSceneItemId(wt(t));r.setViewId(wt(i));const h=new K.FieldMask;if(s.includeBoundingBox){h.addPaths("bounding_box")}if(s.includeWorldTransform){h.addPaths("world_transform")}if(s.includeOverride){h.addPaths("override")}r.setAdditionalFields(h);this.client.getSceneViewItem(r,o,n)}));return Vi(n.toObject())}async listSceneItemMetadata(t,i){const s=await F((async s=>{const n=this.deviceIdProvider();const e=await H(this.jwtProvider,n);const o=new L.ListSceneItemMetadataRequest;o.setItemId(wt(t));const r=new x.Pager;if(i.size!=null){r.setLimit(i.size)}if(i.cursor!=null){r.setCursor(i.cursor)}o.setPager(r);this.client.listSceneItemMetadata(o,e,s)}));return Fi(s.toObject())}}var _i;(function(t){t["DEVICE_ID"]="vertexvis:device-id"})(_i||(_i={}));function qi(t,i,s=window.localStorage){const n=s.getItem(t);if(n!=null){const e=Object.assign(Object.assign({},JSON.parse(n)),i);s.setItem(t,JSON.stringify(e))}else{s.setItem(t,JSON.stringify(i))}}function Ui(t,i,s=window.localStorage){const n=s.getItem(t);if(n!=null){return i(JSON.parse(n))}}var Ji=function t(i,s){if(i===s)return true;if(i&&s&&typeof i=="object"&&typeof s=="object"){if(i.constructor!==s.constructor)return false;var n,e,o;if(Array.isArray(i)){n=i.length;if(n!=s.length)return false;for(e=n;e--!==0;)if(!t(i[e],s[e]))return false;return true}if(i.constructor===RegExp)return i.source===s.source&&i.flags===s.flags;if(i.valueOf!==Object.prototype.valueOf)return i.valueOf()===s.valueOf();if(i.toString!==Object.prototype.toString)return i.toString()===s.toString();o=Object.keys(i);n=o.length;if(n!==Object.keys(s).length)return false;for(e=n;e--!==0;)if(!Object.prototype.hasOwnProperty.call(s,o[e]))return false;for(e=n;e--!==0;){var r=o[e];if(!t(i[r],s[r]))return false}return true}return i!==i&&s!==s};class Xi extends w{constructor(t,i={}){var s,n,e,o,r;super(t,{loggingEnabled:i.loggingEnabled});this.state={type:"disconnected"};this.stateChanged=new C;this.dimensions=d.create(0,0);this.streamAttributes={};this.enableTemporalRefinement=(s=i.enableTemporalRefinement)!==null&&s!==void 0?s:true;this.frameBgColor=I.create(255,255,255);this.config=It("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:(r=i.enableTemporalRefinement)!==null&&r!==void 0?r:true}}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=It("platprod"),e){this.clientId=i;this.deviceId=s;this.config=n;if(this.state.type==="disconnected"){return this.loadIfDisconnected(t,e)}else if(this.state.type==="connection-failed"){return this.loadIfDisconnected(t,e)}else{return this.loadIfConnectingOrConnected(t,this.state,e)}}update(t){this.frameBgColor=t.frameBgColor?t.frameBgColor:this.frameBgColor;if(t.dimensions!=null&&!Ji(t.dimensions,this.dimensions)){this.dimensions=t.dimensions;this.ifState("connected",(()=>this.updateDimensions({dimensions:this.getDimensions()})))}if(t.streamAttributes!=null&&!Ji(this.streamAttributes,t.streamAttributes)){this.streamAttributes=t.streamAttributes;this.ifState("connected",(()=>this.updateStream({streamAttributes:Gi(this.streamAttributes)})))}if(t.enableTemporalRefinement!=null&&t.enableTemporalRefinement!==this.enableTemporalRefinement){this.enableTemporalRefinement=t.enableTemporalRefinement;if(this.state.type==="connected"){this.closeAndReconnect(this.state)}}}async loadIfConnectingOrConnected(t,i,s){var n;const{resource:e,subResource:o}=i.resource;const r=gt(t);const h=!T.isEqual(e,r.resource);const a=!T.isEqual(o,r.subResource);const c=i.type==="connecting"||i.type==="reconnecting";const l=i.type==="connected";if(h||c&&a){this.disconnect();return this.loadIfDisconnected(t)}else if(l&&a&&((n=r.subResource)===null||n===void 0?void 0:n.type)==="scene-view-state"){const t=r.queries.find((t=>t.type==="supplied-id"));const n=Object.assign(Object.assign(Object.assign({},r.subResource.id!=null?{sceneViewStateId:{hex:r.subResource.id}}:{}),t!=null?{sceneViewStateSuppliedId:{value:t.id}}:{}),s!=null?{cameraType:Qi(s)}:{});await this.loadSceneViewState(n);this.updateState(Object.assign(Object.assign({},i),{resource:r}))}}async loadIfDisconnected(t,i){try{await this.connectWithNewStream(gt(t),i)}catch(t){if(t instanceof M){this.updateState({type:"connection-failed",message:`Cannot load scene. ${t.message}`,error:t})}else if(t instanceof v){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}={}){const e=ts(is(this.config,t.resource,this.clientId,this.deviceId));console.debug(`Initiating WS connection [uri=${e.url}]`);const o=new AbortController;const r=Yi(this.config);this.updateState({type:i,resource:t,connection:{dispose:()=>{this.dispose();o.abort()}}});const h=await P.abort(o.signal,P.retry((()=>this.connect(e,r)),{maxRetries:n,delaysInMs:Xi.WS_RECONNECT_DELAYS})).catch((t=>{throw new E("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=ht(e.worldOrientation)(i);if(this.state.type==="connected"){if(t.depthBufferBytes!=null||this.state.frame.temporalRefinementCorrelationId!==t.temporalRefinementCorrelationId){this.updateState(Object.assign(Object.assign({},this.state),{frame:t,fallbackDepthBufferBytes:t.depthBufferBytes}))}else{this.updateState(Object.assign(Object.assign({},this.state),{frame:t.copy({depthBufferBytes:this.state.fallbackDepthBufferBytes})}))}}}}));const r=this.reconnectWhenNeeded();const h=this.refreshTokenWhenExpired(e.token);const a=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:()=>{r.dispose();o.dispose();h.dispose();a.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=at(await this.startStream({streamKey:{value:t.resource.id},dimensions:this.getDimensions(),frameBackgroundColor:Zi(this.frameBgColor),clientSupportsTemporalRefinement:this.enableTemporalRefinement,streamAttributes:Gi(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?Qi(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=ct(await this.reconnect({streamId:{hex:t.streamId},dimensions:this.getDimensions(),frameBackgroundColor:Zi(this.frameBgColor),streamAttributes:Gi(this.streamAttributes),clientSupportsTemporalRefinement:this.enableTemporalRefinement}));return Object.assign(Object.assign({},t),{token:i.token})}async requestClock(){const t=lt(await this.syncTime({requestTime:g()}));return new yt(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=ut(t);s(i);if(this.state.type==="connected"){this.updateState(Object.assign(Object.assign({},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",s);window.removeEventListener("online",i)}}}closeAndReconnect(t){t.connection.dispose();return this.connectToExistingStream(t)}async waitForFrame(t,i){let s;try{return await P.timeout(i*1e3,new Promise((i=>{s=this.onRequest((n=>{try{const e=n.request.drawFrame;if(e!=null){const s=ht(t)(e);i(s)}}finally{s===null||s===void 0?void 0:s.dispose()}}))})))}catch(t){throw new O(`Frame timed out after ${i/1e3}s`,t instanceof Error?t:undefined)}finally{s===null||s===void 0?void 0:s.dispose()}}acknowledgeFrameRequests(){return this.onRequest(Si(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(d.area(this.dimensions)===0){return d.create(1,1)}return this.dimensions}ifState(t,i){if(this.state.type===t){return i()}}onStateChanged(t){return this.stateChanged.on(t)}}Xi.WS_RECONNECT_DELAYS=[0,1e3,1e3,5e3];const Gi=b.ifInvalidThrow(et);const Zi=b.ifInvalidThrow(ot);const Qi=b.ifInvalidThrow(rt);function Yi(t){return{EXPERIMENTAL_frameDelivery:Object.assign(Object.assign({},t.EXPERIMENTAL_frameDelivery),{rateLimitingEnabled:t.flags.throttleFrameDelivery}),EXPERIMENTAL_adaptiveRendering:Object.assign(Object.assign({},t.EXPERIMENTAL_adaptiveRendering),{enabled:t.flags.adaptiveRendering}),EXPERIMENTAL_qualityOfService:Object.assign({},t.EXPERIMENTAL_qualityOfService)}}function ts(t){return{url:S.toString(t),protocols:["ws.vertexvis.com"]}}function is(t,i,s,n){if(s!=null){return S.appendPath(S.toString(S.parseAndAddParams("/ws",{clientId:s,deviceId:n})),S.parse(t.network.renderingHost))}else{return S.appendPath(`/stream-keys/${i.id}/session`,S.parse(t.network.renderingHost))}}const ss=15e3;function ns(t){return t.getBoundingClientRect()}function es(t,i){const s=window.getComputedStyle(t);const n=s.getPropertyValue(i);return n!==""?n:undefined}const os=":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{position:absolute;top:50%;width:100%;transform:translateY(-50%);text-align:center}";const rs=class{constructor(s){t(this,s);this.tap=i(this,"tap",7);this.doubletap=i(this,"doubletap",7);this.longpress=i(this,"longpress",7);this.frameReceived=i(this,"frameReceived",7);this.frameDrawn=i(this,"frameDrawn",7);this.tokenExpired=i(this,"tokenExpired",7);this.connectionChange=i(this,"connectionChange",7);this.sceneReady=i(this,"sceneReady",7);this.sceneChanged=i(this,"sceneChanged",7);this.interactionStarted=i(this,"interactionStarted",7);this.interactionFinished=i(this,"interactionFinished",7);this.cameraTypeChanged=i(this,"cameraTypeChanged",7);this.annotationStateChanged=i(this,"annotationStateChanged",7);this.deviceIdChange=i(this,"deviceIdChange",7);this.dimensionschange=i(this,"dimensionschange",7);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.resizeDebounce=100;this.stencilBuffer=new Rt(this.hostElement);this.viewport=jt.fromDimensions(d.create(0,0));this.stateMap={cursorManager:new Tt,streamState:{type:"disconnected"}};this.interactionHandlers=[];this.defaultInteractionHandlerDisposables=[];this.tapKeyInteractions=[];this.defaultTapKeyInteractions=[];this.internalFrameDrawnDispatcher=new C;this.handleElementResize=this.handleElementResize.bind(this)}componentWillLoad(){var t;this.updateResolvedConfig();this.calculateComponentDimensions();this.resizeObserver=new ResizeObserver(this.handleElementResize);this.registerSlotChangeListeners();const i=this.getResolvedConfig();const s=new f(i.network.sceneViewHost);this.annotations=new Wt(s,(()=>this.token),(()=>this.deviceId));this.annotations.onStateChange.on((t=>this.annotationStateChanged.emit(t)));this.stream=(t=this.stream)!==null&&t!==void 0?t:new Xi(new y,{loggingEnabled:i.flags.logWsMessages,enableTemporalRefinement:this.enableTemporalRefinement});this.addStreamListeners();this.modelViews=new bt(s,this.stream,(()=>this.token),(()=>this.deviceId));this.pmi=new Ct(s,(()=>this.token),(()=>this.deviceId));this.sceneItems=new Wi(s,(()=>this.token),(()=>this.deviceId));this.updateStreamAttributes();this.stateMap.cursorManager.onChanged.on((()=>this.handleCursorChanged()))}async componentDidLoad(){var t;this.interactionApi=this.createInteractionApi();if(this.canvasContainerElement!=null){(t=this.resizeObserver)===null||t===void 0?void 0:t.observe(this.canvasContainerElement)}if(this.src!=null){this.load(this.src,{cameraType:this.cameraType}).catch((t=>{console.error("Error loading scene",t)}))}await this.initializeDefaultInteractionHandlers();this.injectViewerApi()}render(){var t;return s(n,null,s("div",{ref:t=>this.viewerContainerElement=t,class:"viewer-container",style:{cursor:At((t=this.cursor)!==null&&t!==void 0?t:"")},onContextMenu:t=>t.preventDefault()},s("div",{ref:t=>this.canvasContainerElement=t,class:D("canvas-container",{"enable-pointer-events ":window.PointerEvent!=null})},s("canvas",{ref:t=>{this.canvasElement=t;this.stateMap.interactionTarget=t},class:"canvas"}),this.errorMessage!=null?s("div",{class:"error-message"},this.errorMessage):null),s("slot",null)))}async dispatchFrameDrawn(t){this.frame=t;this.internalFrameDrawnDispatcher.emit(t);this.frameDrawn.emit(t)}async registerInteractionHandler(t){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 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.updateStreamAttributes()}handleEnableTemporalRefinementChanged(){this.updateEnableTemporalRefinement()}handleConfigChanged(){this.updateResolvedConfig()}handleConfigEnvChanged(){this.updateResolvedConfig()}async load(t,i){var s,n;if(this.stream!=null&&this.dimensions!=null){const{EXPERIMENTAL_annotationPollingIntervalInMs:e}=this.getResolvedConfig();this.calculateComponentDimensions();this.stream.update({streamAttributes:this.getStreamAttributes(),config:It(this.configEnv,this.config),dimensions:this.dimensions,frameBgColor:this.getBackgroundColor()});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));this.sceneReady.emit();if(e!==undefined){(n=this.annotations)===null||n===void 0?void 0:n.connect(e)}}else{throw new R("Cannot load scene. Viewer has not been initialized.")}}async unload(){var t;if(this.stream!=null){(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){this.connectionChange.emit(t)}handleElementResize(t){const i=t.length>0&&this.dimensions!=null&&!d.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)}}}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=d.create(s.width,s.height);const e=d.scaleFit(i,n);this.hostDimensions=n;this.dimensions=e!=null?d.create(e.width,e.height):undefined;this.viewport=jt.fromDimensions((t=this.getCanvasDimensions())!==null&&t!==void 0?t:d.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:p(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=yi(di,bi(),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();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 n=this.frame;this.frame=dt(t,n);this.updateInteractionApi(n);const e={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||d.isEqual(this.dimensions,e.frame.image.imageAttr.frameDimensions)}return true}};this.frameReceived.emit(this.frame);if(this.frame.scene.hasChanged){this.sceneChanged.emit()}const o=await this.canvasRenderer(e);if(o!=null){this.updateViewerBackground();this.dispatchFrameDrawn(o)}}}}updateViewerBackground(){const t=this.getBackgroundColor();Mt((()=>{var i,s;(i=this.viewerContainerElement)===null||i===void 0?void 0:i.style.setProperty("background",t!=null?I.toHexString(t):"#ffffff");(s=this.canvasContainerElement)===null||s===void 0?void 0:s.style.setProperty("background",t!=null?I.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 ai((()=>this.getResolvedConfig()));const i=await this.registerInteractionHandler(this.baseInteractionHandler);const s=await this.registerInteractionHandler(new hi);this.defaultInteractionHandlerDisposables=[i,s]}else{this.baseInteractionHandler=(i=this.baseInteractionHandler)!==null&&i!==void 0?i:new ei((()=>this.getResolvedConfig()));const t=await this.registerInteractionHandler(this.baseInteractionHandler);const s=await this.registerInteractionHandler(new li);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 _t(this.stream,(()=>this.getResolvedConfig()),(()=>this.getImageScale()));const s=new Gt(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 ci("pointerdown","pointerup","pointermove",(()=>this.getResolvedConfig()));this.tapHandlerDisposable=await this.registerInteractionHandler(t)}else{const t=new ci("mousedown","mouseup","mousemove",(()=>this.getResolvedConfig()));this.tapHandlerDisposable=await this.registerInteractionHandler(t)}}}initializeInteractionHandler(t){if(this.stateMap.interactionTarget==null){throw new B("Cannot initialize interaction handler. Interaction target is undefined.")}if(this.interactionApi==null){throw new B("Cannot initialize interaction handler. Interaction APi is undefined.")}t.initialize(this.stateMap.interactionTarget,this.interactionApi)}createInteractionApi(){if(this.stream==null){throw new z("Cannot create interaction API. Component has not been initialized.")}return this.frame==null||this.frame.scene.camera.isPerspective()?new Xt(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 Ut(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=ft();const{frame:s,sceneId:n,sceneViewId:e,worldOrientation:o}=t;return new Pt(this.getStream(),s,ht(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?I.fromCss(s):I.create(255,255,255)}}getBounds(){return ns(this.hostElement)}getCanvasDimensions(){return this.getResolvedConfig().flags.letterboxFrames?this.dimensions:this.hostDimensions}getImageScale(){const t=this.getCanvasDimensions();if(this.dimensions!=null&&t!=null){return o.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}}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:Z(pt(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:Z(mt(this.frame.scene.camera))})}}}getDepthBufferStreamAttributesValue(){var t;const i=(t=this.depthBuffers)!==null&&t!==void 0?t:this.rotateAroundTapPoint?"final":undefined;return i}updateResolvedConfig(){this.resolvedConfig=It(this.configEnv,this.config)}getResolvedConfig(){return hs("Resolved config is undefined",(()=>this.resolvedConfig))}getStream(){return hs("Stream is undefined",(()=>this.stream))}getDeviceId(){if(this.deviceId==null){try{this.deviceId=Ui(_i.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=A.create();try{qi(_i.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."))}),ss)}))}return this.stateMap.streamState}get hostElement(){return e(this)}static get watchers(){return{src:["handleSrcChanged"],cameraControls:["handleCameraControlsChanged"],keyboardControls:["handleKeyboardControlsChanged"],rotateAroundTapPoint:["handleRotateAboutTapPointChanged"],cameraType:["handleCameraTypeChanged"],experimentalRenderingOptions:["handleStreamAttributesChanged"],depthBuffers:["handleStreamAttributesChanged"],featureHighlighting:["handleStreamAttributesChanged"],featureLines:["handleStreamAttributesChanged"],featureMaps:["handleStreamAttributesChanged"],noDefaultLights:["handleStreamAttributesChanged"],phantom:["handleStreamAttributesChanged"],sceneComparison:["handleStreamAttributesChanged"],selectionHighlighting:["handleStreamAttributesChanged"],enableTemporalRefinement:["handleEnableTemporalRefinementChanged"],config:["handleConfigChanged"],configEnv:["handleConfigEnvChanged"]}}};function hs(t,i){const s=i();if(s!=null){return s}else throw new Error(t)}rs.style=os;export{rs as vertex_viewer};
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
import{r as t,c as i,h as s,H as n,g as e}from"./p-6685b50e.js";import{p as o,v as r,c as h,g as a,r as c,b as l,y as u,d}from"./p-021bcb25.js";import{S as f}from"./p-d456a65b.js";import{t as p,p as m,a as w,S as v,c as g,W as y}from"./p-28dfd6fb.js";import{m as b,E as C,b as P,c as I,o as T,u as S,a as A}from"./p-da65b274.js";import{c as D}from"./p-9d9c943e.js";import{u as j,c as k,p as x,C as M,W as E,S as O,V as R,d as B,e as z}from"./p-243cc2b6.js";import{s as L,p as $,f as K}from"./p-b53cd80d.js";import{r as F,c as H,a as N}from"./p-b9d95f63.js";import{o as V,p as W,q as _,l as q,r as U,s as J,j as X,u as G,t as Z,x as Q,m as Y,y as tt,z as it,B as st,C as nt,E as et,G as ot,H as rt,I as ht,J as at,K as ct,M as lt,N as ut,P as dt,Q as ft,R as pt,T as mt}from"./p-fdfb1d5a.js";import{t as wt,m as vt,n as gt,j as yt,M as bt,k as Ct,S as Pt}from"./p-dedb6440.js";import{p as It}from"./p-f71c157e.js";import{C as Tt}from"./p-d457f24a.js";import{g as St,c as At}from"./p-3d985864.js";import{E as Dt}from"./p-ab1cef89.js";import{V as jt}from"./p-8c65c44d.js";import{B as kt,M as xt}from"./p-3f05f3e7.js";import{w as Mt}from"./p-b276d65a.js";import"./p-4dab2cc5.js";import"./p-bcce32b5.js";import"./p-eb4743a1.js";import"./p-308fcf7c.js";const Et=0;const Ot=255;class Rt{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}=V(t);const[o,r]=await Promise.all([W(new Uint8Array(i)),W(new Uint8Array(s))]);return Bt.fromPng(o,n,i,_.fromPng(r,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 Bt{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 Bt(i,s,t.data,t.channels,n)}}getValue(t){const{width:i,height:s}=this.imageAttr.imageRect;const n=o.subtract(t,this.imageAttr.imageRect);const e=1/this.imageAttr.imageScale;const r=o.scale(n,e,e);if(r.x>=0&&r.y>=0&&r.x<i&&r.y<s){const t=Math.floor(r.x)+Math.floor(r.y)*i;const s=this.pixelBytes[t];return s}else return 0}hitTest(t){return this.getValue(t)!==Et}snapToNearestPixel(t,i,s=(()=>true)){const n=i*2;const e=o.create(t.x-i,t.y-i);const r=[];for(let h=0;h<n*n;h++){const a=h%n;const c=Math.floor(h/n);const l=o.add(e,{x:a,y:c});if(o.distance(l,t)<=i){const t=this.getValue(l);if(t===Ot&&s(t)){r.push(l)}}}const h=r.sort(((i,s)=>o.distance(i,t)-o.distance(s,t)));const a=h[0];return a!=null?o.create(Math.floor(a.x)+.5,Math.floor(a.y)+.5):t}}function zt(t){return t!=null&&t["then"]instanceof Function&&t["catch"]instanceof Function&&t["finally"]instanceof Function}function Lt(t){return new Promise((i=>setTimeout(i,t)))}const $t=b.defineMapper(b.compose((t=>t.toObject()),b.read(b.mapRequiredProp("id",q),b.mapRequiredProp("createdAt",U),b.mapRequiredProp("modifiedAt",U),b.mapProp("name",J),b.mapProp("suppliedId",J))),(([t,i,s,n,e])=>({id:t,createdAt:i,modifiedAt:s,name:n,suppliedId:e})));const Kt=b.ifInvalidThrow($t);const Ft=b.defineMapper(b.compose((t=>t.toObject()),b.read(b.mapRequiredProp("id",q),b.mapRequiredProp("createdAt",U),b.mapRequiredProp("modifiedAt",U),b.mapProp("suppliedId",J),b.mapRequiredProp("data",(t=>{if(t.callout!=null){return Nt(t.callout)}else if(t.customJson!=null){return Vt(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 Ht=b.ifInvalidThrow(Ft);const Nt=b.defineMapper(b.read(b.mapRequiredProp("position",X),b.mapProp("icon",J),b.mapProp("primaryColor",J),b.mapProp("accentColor",J)),(([t,i,s,n])=>({type:"callout",position:t,icon:i,primaryColor:s,accentColor:n})));const Vt=b.defineMapper(b.read(b.requiredProp("type"),b.mapRequiredProp("jsonData",(t=>JSON.parse(t)))),(([t,i])=>({type:"custom",jsonType:t,jsonData:i})));class Wt{constructor(t,i,s){this.client=t;this.jwtProvider=i;this.deviceIdProvider=s;this.onStateChange=new C}async addAnnotationSet(t){await F((async i=>{const s=this.deviceIdProvider();const n=await H(this.jwtProvider,s);const e=new L.CreateSceneViewAnnotationSetRequest;const o=new j.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:Object.assign(Object.assign({},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 H(this.jwtProvider,s);const e=new L.DeleteSceneViewAnnotationSetRequest;const o=new j.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 Lt(t);await s(t)}};P.abort(i.signal,s(t));return i}fetchAnnotationSets(){return N((t=>async i=>{const s=this.deviceIdProvider();const n=await H(this.jwtProvider,s);const e=new L.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 P.asArray(this.fetchAnnotationSets())).flatMap((t=>t.getSceneAnnotationSetsList())).map((t=>Kt(t)))}fetchAnnotations(t){return N((i=>async s=>{const n=this.deviceIdProvider();const e=await H(this.jwtProvider,n);const o=new L.ListSceneAnnotationsRequest;const r=wt(t);o.setSceneAnnotationSetId(r);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 P.asArray(this.fetchAnnotations(t.id))).flatMap((t=>t.getSceneAnnotationsList())).map((t=>Ht(t)));return[t,i]}));return Promise.all(i)}updateState(t){this.state=t;this.onStateChange.emit(t)}}class _t{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:o.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:p(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 qt{constructor(t,i,s,n,e,o,r,h,a,c,l){this.stream=t;this.cursors=i;this.getConfig=s;this.getScene=n;this.getFrame=e;this.getViewport=o;this.tapEmitter=r;this.doubleTapEmitter=h;this.longPressEmitter=a;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 Dt.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(){if(!this.isInteracting()){this.interactionStartedEmitter.emit();this.sceneLoadingPromise=this.getScene();this.currentCamera=(await this.sceneLoadingPromise).camera();this.sceneLoadingPromise=undefined;await this.stream.beginInteraction()}}async transformCamera(...t){var i;const s=t[0];const n=t[1];if(this.isInteracting()){const t=await this.getScene();const e=this.getViewport();const o=this.getFrame();const r=await(o===null||o===void 0?void 0:o.depthBuffer());this.currentCamera=this.currentCamera!=null&&e!=null&&o!=null?s({camera:this.currentCamera,viewport:e,scale:t.scale(),boundingBox:t.boundingBox(),frame:o,depthBuffer:r}):undefined;await((i=this.currentCamera)===null||i===void 0?void 0:i.render(n))}}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=o.create(s.width/2,s.height/2);const e=h.toDegrees(h.fromPoints(n,t[0]));const a=this.lastAngle!=null?e-this.lastAngle:0;this.lastAngle=e;const c=r.normalize(r.subtract(i.lookAt,i.position));const l=h.toRadians(-a);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 r=o.direction;const h=n.transformPointToRay(t,s.image,o);const l=a.fromNormalAndCoplanarPoint(r,i.lookAt);const u=c.intersectPlane(h,l);if(u==null){console.warn("Cannot determine fallback for pan. Ray does not intersect plane.");return i}const d=e!=null?this.getWorldPoint(t,e,u):u;const f=a.fromNormalAndCoplanarPoint(r,d);this.panData={hitPt:d,hitPlane:f,startingCamera:o}}if(this.panData!=null){const{hitPt:e,hitPlane:o,startingCamera:h}=this.panData;const a=n.transformPointToRay(t,s.image,h);const l=c.intersectPlane(a,o);if(l!=null){const t=r.subtract(e,l);return i.update(h).moveBy(t)}}return i}))}async viewAll(){await(await this.getScene()).camera().viewAll().render()}async rotateCamera(t){return this.transformCamera((({camera:i,viewport:s,boundingBox:n})=>{const e=r.normalize(i.up);const o=r.normalize(r.subtract(i.lookAt,i.position));const h=r.cross(e,o);const a=r.cross(o,h);const c=r.normalize({x:t.x*h.x+t.y*a.x,y:t.x*h.y+t.y*a.y,z:t.x*h.z+t.y*a.z});const l=r.cross(c,o);const u=9.5*t.x/s.width;const d=9.5*t.y/s.height;const f=Math.abs(u)+Math.abs(d);return i.rotateAroundAxis(f,l)}))}async rotateCameraAtPoint(t,i){return this.transformCamera((({camera:s,viewport:n,boundingBox:e,depthBuffer:o})=>{if(this.worldRotationPoint==null){const t=l.center(e);this.worldRotationPoint=o!=null?this.getWorldPoint(i,o,t):s.lookAt}const h=r.normalize(s.up);const a=r.normalize(r.subtract(s.lookAt,s.position));const c=r.cross(h,a);const u=r.cross(a,c);const d=r.normalize({x:t.x*c.x+t.y*u.x,y:t.x*c.y+t.y*u.y,z:t.x*c.z+t.y*u.z});const f=r.cross(d,a);const p=9.5*t.x/n.width;const m=9.5*t.y/n.height;const w=Math.abs(p)+Math.abs(m);const v=s.rotateAroundAxisAtPoint(w,this.worldRotationPoint,f);return v.update({lookAt:r.add(r.scale(Math.abs(s.signedDistanceToBoundingBoxCenter())/r.magnitude(v.viewVector),v.viewVector),v.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 h=r.normalize(n);const a=r.scale(o,h);const c=r.add(i.position,a);const l=i.update({position:c});return l}else{const o=i;const h=i.toFrameCamera();const u=h.direction;const d=s.transformPointToRay(s.center,n.image,h);const f=4*(t/s.height);const p=r.magnitude(l.diagonal(e))*1e-5;const m=Math.max(p,o.fovHeight*(1-f));const w=a.fromNormalAndCoplanarPoint(u,h.lookAt);const v=c.intersectPlane(d,w);if(v!=null){const t=a.projectPoint(w,o.lookAt);const s=(o.fovHeight-m)/o.fovHeight;const n=r.scale(s,r.subtract(v,t));const e=r.add(o.lookAt,n);const h=i.update({lookAt:e,rotationPoint:e,fovHeight:m});return h}}}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 u=r.cross(c,l);const d=r.rotateAboutAxis(h.toRadians(t),o,l,n);const f=r.rotateAboutAxis(h.toRadians(i),d,u,n);return s.update(Object.assign(Object.assign({},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()}}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:r=false,shiftKey:h=false}=s;t({position:i,altKey:e,ctrlKey:o,metaKey:r,shiftKey:h,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 Ut extends qt{constructor(t,i,s,n,e,o,r,h,a,c,l){super(t,i,s,n,e,o,r,h,a,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 h=r.normalize(n);const a=o.scale(t,.5,.5);const c=r.magnitude(n);const l=a.x*c/s.width;const u=a.y*c/s.height;const d=r.cross(e,h);const f=r.cross(h,d);const p=r.add(r.scale(l,d),r.scale(u,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 r=n.transformPointToRay(t,s.image,e);const h=a.fromNormalAndCoplanarPoint(o,i.lookAt);const l=c.intersectPlane(r,h);if(l==null){console.warn("Cannot determine fallback for pan. Ray does not intersect plane.");return i}this.panData={hitPt:l,hitPlane:h,startingCamera:e}}if(this.panData!=null){const{hitPt:e,hitPlane:o,startingCamera:h}=this.panData;const a=n.transformPointToRay(t,s.image,h);const l=c.intersectPlane(a,o);if(l!=null){const t=r.subtract(e,l);const s=r.add(h.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:h,boundingBox:u})=>{if(this.orthographicZoomData==null||o.distance(t,this.orthographicZoomData.startingScreenPt)>2){const i=s.toFrameCamera();const o=i.direction;const r=n.transformPointToRay(t,e.image,i);const l=a.fromNormalAndCoplanarPoint(o,i.lookAt);const u=c.intersectPlane(r,l);if(u==null){console.warn("Cannot determine fallback point for zoom. Ray does not intersect plane.");return s}const d=h!=null?this.getWorldPoint(t,h,u):u;const f=a.fromNormalAndCoplanarPoint(o,d);this.orthographicZoomData={hitPt:d,hitPlane:f,startingScreenPt:t}}if(this.orthographicZoomData!=null){const{hitPt:t,hitPlane:e}=this.orthographicZoomData;const o=4*(i/n.height);const h=r.magnitude(l.diagonal(u))*1e-5;const c=Math.max(h,s.fovHeight*(1-o));const d=a.projectPoint(e,s.lookAt);const f=(s.fovHeight-c)/s.fovHeight;const p=r.scale(f,r.subtract(t,d));const m=r.add(s.lookAt,p);return s.update({lookAt:m,rotationPoint:m,fovHeight:c})}return s}))}async rotateCamera(t){return this.transformCamera((({camera:i,viewport:s,boundingBox:n})=>{var e;const o=r.normalize(i.up);const h=r.normalize(r.subtract(i.lookAt,i.position));const a=r.cross(o,h);const c=r.cross(h,a);const u=r.normalize({x:t.x*a.x+t.y*c.x,y:t.x*a.y+t.y*c.y,z:t.x*a.z+t.y*c.z});const d=r.cross(u,h);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 w=i.rotationPoint!=null&&((e=i.rotationPoint)===null||e===void 0?void 0:e.x)!=null?i.rotationPoint:i.lookAt;const v=i.rotateAroundAxisAtPoint(m,w,d);const g=G(v.lookAt,v.viewVector,l.center(n));return v.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 Jt=.2;class Xt extends qt{constructor(t,i,s,n,e,o,r,h,a,c,l){super(t,i,s,n,e,o,r,h,a,c,l)}async panCameraByDelta(t){return this.transformCamera((({camera:i,viewport:s})=>{var n;const e=i.viewVector;const h=r.normalize(i.up);const a=r.normalize(e);const c=o.scale(t,.25,.25);const l=r.magnitude(e)*Math.tan((n=i.fovY)!==null&&n!==void 0?n:45);const u=c.x*l/s.width;const d=c.y/s.width*l;const f=r.cross(h,a);const p=r.cross(a,f);const m=r.add(r.scale(u,f),r.scale(d,p));return i.moveBy(m)}))}async zoomCameraToPoint(t,i){return this.transformCamera((({camera:s,viewport:n,frame:e,depthBuffer:o,boundingBox:h})=>{const l=e.scene.camera;const u=l.direction;const d=s.toFrameCamera();const f=n.transformPointToRay(t,e.image,d);if(this.zoomData==null){const i=a.fromNormalAndCoplanarPoint(u,l.lookAt);const n=c.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 r=a.fromNormalAndCoplanarPoint(u,e);this.zoomData={hitPt:e,hitPlane:r}}if(this.zoomData!=null){const{hitPlane:t}=this.zoomData;const{position:e,distance:o,isPastHitPlane:l,keepCurrent:u}=this.computeZoomDistances(i,s,n,h,f,this.zoomData);if(l&&!u){const t=c.create({origin:e,direction:r.normalize(s.viewVector)});return s.update({position:e,lookAt:c.at(t,o)})}else if(!u){return s.update({position:e,lookAt:a.projectPoint(t,e)})}}return s}))}walk(t){this.transformCamera((({camera:i,boundingBox:s})=>{const{position:n,up:e,lookAt:o}=i;const h=r.normalize(e);const a=r.normalize(i.viewVector);const c=Math.min(...r.toArray(l.lengths(s)));const u=r.scale(c,t);const d=r.cross(h,a);const f=r.cross(d,h);const p=r.scale(u.x,r.normalize(d));const m=r.scale(u.y,r.normalize(h));const w=r.scale(u.z,r.normalize(f));const v=r.negate(r.add(p,m,w));return i.update(Object.assign(Object.assign({},i),{position:r.add(n,v),lookAt:r.add(o,v)}))}))}computeZoomDistances(t,i,s,n,e,o){const h=this.getConfig();const{hitPt:a,hitPlane:l}=o;const u=h.useMinimumPerspectiveZoomDistance?this.computeZoomMinimumDistance(i,n):-1;const d=r.distance(i.position,a);const f=Math.max(u,d);const p=6*f*t/s.height;const m=c.at(e,p);const w=c.create({origin:m,direction:r.normalize(i.viewVector)});const v=c.intersectPlane(w,l);if(v==null&&h.useMinimumPerspectiveZoomDistance){const i=6*u*t/s.height;const n=c.at(e,i);return{position:n,distance:u,isPastHitPlane:true,keepCurrent:false}}else if(v==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 h=Math.abs(r.dot(r.normalize(t.viewVector),r.right()));const a=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*h;const u=n*a;const d=e*c;const f=o/s;const p=o/n;const m=o/e;return(l+u+d)/(f+p+m)*Jt}}class Gt{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:o.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:Z(n.update({lookAt:s,rotationPoint:s}).toFrameCamera()),animation:{duration:p(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 G(i,s,l.center(t.boundingBox()))}else{return i}}}class Zt{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}}zoom(t,i){}}class Qt extends Zt{constructor(){super(...arguments);this.type="rotate"}beginDrag(t,i,s){if(this.currentPosition==null){this.currentPosition=o.create(t.screenX,t.screenY);s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null){const s=o.create(t.screenX,t.screenY);const n=o.subtract(s,this.currentPosition);i.rotateCamera(n);this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class Yt extends Zt{constructor(){super(...arguments);this.type="rotate-point"}beginDrag(t,i,s){if(this.currentPosition==null){this.currentPosition=o.create(t.screenX,t.screenY);this.startingPosition=i;s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null&&this.startingPosition!=null){const s=o.create(t.screenX,t.screenY);const n=o.subtract(s,this.currentPosition);i.rotateCameraAtPoint(n,this.startingPosition);this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class ti extends Zt{constructor(t){super();this.interactionConfigProvider=t;this.type="zoom";this.didTransformBegin=false}beginDrag(t,i,s,n){if(this.currentPosition==null){this.currentPosition=o.create(t.clientX,t.clientY);const i=n.getBoundingClientRect();const e=St(t,i);this.startPt=e;s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null){const s=o.create(t.clientX,t.clientY);const n=o.subtract(s,this.currentPosition);if(this.startPt!=null){i.zoomCameraToPoint(this.startPt,n.y);this.currentPosition=s}}}endDrag(t,i){super.endDrag(t,i);this.stopInteractionTimer();this.didTransformBegin=false;this.startPt=undefined}zoom(t,i){this.operateWithTimer(i,(()=>i.zoomCamera(this.getDirectionalDelta(t))))}zoomToPoint(t,i,s){this.operateWithTimer(s,(()=>s.zoomCameraToPoint(t,this.getDirectionalDelta(i))))}beginInteraction(t){this.didTransformBegin=true;t.beginInteraction()}endInteraction(t){this.didTransformBegin=false;t.endInteraction()}resetInteractionTimer(t){this.stopInteractionTimer();this.startInteractionTimer(t)}getDirectionalDelta(t){return this.interactionConfigProvider().reverseMouseWheelDirection?-t:t}getInteractionDelay(){return this.interactionConfigProvider().mouseWheelInteractionEndDebounce}startInteractionTimer(t){this.interactionTimer=window.setTimeout((()=>{this.interactionTimer=undefined;this.endInteraction(t)}),this.getInteractionDelay())}stopInteractionTimer(){if(this.interactionTimer!=null){window.clearTimeout(this.interactionTimer);this.interactionTimer=undefined}}operateWithTimer(t,i){if(!this.didTransformBegin){this.beginInteraction(t)}this.resetInteractionTimer(t);i()}}class ii extends Zt{constructor(){super(...arguments);this.type="pan"}beginDrag(t,i,s,n){if(this.currentPosition==null){this.currentPosition=o.create(t.screenX,t.screenY);this.canvasRect=n.getBoundingClientRect();s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null&&this.canvasRect!=null){const s=St(t,this.canvasRect);i.panCameraToScreenPoint(s);this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class si extends Zt{constructor(){super(...arguments);this.type="twist"}beginDrag(t,i,s,n){this.currentPosition=o.create(t.offsetX,t.offsetY);this.canvasRect=n.getBoundingClientRect();s.beginInteraction()}drag(t,i){const s=St(t,this.canvasRect);this.currentPosition=s;i.twistCamera(s)}endDrag(t,i){super.endDrag(t,i)}}class ni extends Zt{constructor(){super(...arguments);this.type="pivot"}beginDrag(t,i,s){if(this.currentPosition==null){this.currentPosition=o.create(t.screenX,t.screenY);s.beginInteraction()}}drag(t,i){if(this.currentPosition!=null){const s=o.create(t.screenX,t.screenY);const n=o.subtract(s,this.currentPosition);i.pivotCamera(-.25*n.y,.25*n.x);this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class ei extends kt{constructor(t,i=new Qt,s=new Yt,n=new ti((()=>t().interactions)),e=new ii,o=new si,r=new ni){super("mousedown","mouseup","mousemove",i,s,n,e,o,r,t)}}function oi(t){window.requestAnimationFrame(t)}class ri{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];oi((()=>{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 r=this.previousSecondPoints;this.previousFirstPoints=this.previousFirstPoints.slice(-1);this.previousSecondPoints=this.previousSecondPoints.slice(-1);const h=e.reduce(((t,i,s)=>{if(s<e.length-1){const n=e[s+1];const o=r[s];const h=r[s+1];return{deltas:[...t.deltas,this.computeDelta(i,o,n,h)],zooms:[...t.zooms,this.computeZoom(i,o,n,h)],angles:[...t.angles,this.computeAngle(i,o,n,h)]}}return t}),{deltas:[],zooms:[],angles:[]});const a=h.deltas.reduce(((t,i)=>o.add(t,i)),o.create());const c=h.zooms.reduce(((t,i)=>t+i),0);const l=h.angles.reduce(((t,i)=>t+i),0);const u=o.create((e[e.length-1].x+r[r.length-1].x)/2,(e[e.length-1].y+r[r.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(u,c);(s=this.interactionApi)===null||s===void 0?void 0:s.panCameraByDelta(a);(n=this.interactionApi)===null||n===void 0?void 0:n.twistCamera(l)}}))}endTwoPointTouch(){this.previousFirstPoints=[];this.previousSecondPoints=[]}computeDelta(t,i,s,n){return o.add(o.subtract(s,t),o.subtract(n,i))}computeZoom(t,i,s,n){const e=o.distance(s,n)-o.distance(t,i);return e*.5}computeAngle(t,i,s,n){const e=u.create(o.subtract(t,i),o.subtract(s,n));return h.toDegrees(Math.atan2(u.determinant(e),u.dot(e)))}}class hi extends ri{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=o.create(t.screenX,t.screenY);this.touchPoints=Object.assign(Object.assign({},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]=o.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 ai extends xt{constructor(t,i=new Qt,s=new Yt,n=new ti((()=>t().interactions)),e=new ii,o=new si,r=new ni){super("pointerdown","pointerup","pointermove",i,s,n,e,o,r,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=o.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 ci{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(o.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(o.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(o.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(o.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(o.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&&o.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,r=false)=>{var h;const a=e||this.pointerDownPosition;const c=((h=this.interactionApi)===null||h===void 0?void 0:h.pixelThreshold(r))||1;let l;if(this.interactionTimer!=null){l=this.getCanvasPosition(a||i)}else if(a!=null&&o.distance(a,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?o.create(s.left,s.top):undefined;return n!=null?o.subtract(o.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 li extends ri{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=o.create(i.screenX,i.screenY);if(t.touches[1]!=null){this.beginTwoPointTouch(this.currentPosition1,o.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=o.create(t.touches[0].clientX,t.touches[0].clientY);const s=o.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=o.create(t.screenX,t.screenY);if(this.currentPosition1!=null){const t=o.subtract(e,this.currentPosition1);const r=((i=this.interactionApi)===null||i===void 0?void 0:i.pixelThreshold(true))||2;if(o.distance(e,this.currentPosition1)>=r||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}}class ui{constructor(t,i=window.performance){this.name=t;this.perf=i;this.measures=new Set;this.nextId=0}clearMeasurements(){this.perf.clearMeasures(this.name)}measure(t){if(zt(t)){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 di=new ui("paint_time");function fi(t){return new Promise(((i,s)=>{const n=new Blob([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 k("Failed to load image data"));URL.revokeObjectURL(e)}));o.src=e}))}async function pi(t){const i=new Blob([t]);const s=await window.createImageBitmap(i);return{image:s,dispose:()=>s.close()}}function mi(t){if(window.createImageBitmap!=null){return pi(t)}else{return fi(t)}}const wi=1e3;function vi(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 gi(t,i){const s=t.takeMeasurements();if(s.length>0){i(s)}}function yi(t,i,s,n,e=wi){let o;let r=0;let h;let a=[];function c(){r++;if(o==null){o=setInterval((()=>{gi(t,n);if(r===0){u()}}),e)}}function l(){r--}function u(){if(o!=null){clearInterval(o);o=undefined}}if(s){setInterval((()=>{if(h!=null){if(a.length===5){a=[...a.slice(1),h]}else{a.push(h)}const t=a.reduce(((t,i)=>t+i))/a.length;console.debug(`Paint rate: ${h}fps`);console.debug(`Paint rate (avg): ${t}`);h=undefined}}),1e3)}return s=>{c();return t.measure((async()=>{const t=await i(s);h=h==null?1:h+1;return t})).finally((()=>l()))}}function bi(){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 mi(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);vi(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,r;const h=(r=(n=s.predicate)===null||n===void 0?void 0:n.call(s))!==null&&r!==void 0?r:true;t=[...t,...s.frame.correlationIds];if(h){return e(s).then((t=>o(s,t).then(i)))}}}function Ci(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 Pi(t){return i=>{const{drawFrame:s}=i.request;if(s!=null){t(s)(i)}}}const Ii=1*60;function Ti(t){let i=false;return s=>{const n=t();if(n!=null){const t=n.remoteTime(new Date(Date.now()));const e=p(s,t);const o=m(e).getTime();if(o>=0){return e}else{if(!i){console.warn(`Possible erroneous send to receive timing. Muting for ${Ii}s. [sent-at=${s.toISOString()}, received-at=${t.toISOString()}, remote-time=${n.knownRemoteTime.toISOString()}]`);i=true;setTimeout((()=>i=false),Ii*1e3)}return undefined}}}}function Si(t,i){const s=Ti(i);return Ci((i=>Pi((n=>n=>{const e=m(n.sentAtTime);if(e!=null){t.replyResult(i,{drawFrame:{sendToReceiveDuration:s(e)}})}}))))}const Ai=b.defineMapper(b.read(b.requiredProp("d"),b.requiredProp("ns"),b.mapRequiredProp("ka",Q),b.mapRequiredProp("kd",Q),b.mapRequiredProp("ks",Q),b.mapRequiredProp("ke",Q)),(([t,i,s,n,e,o])=>({opacity:t,glossiness:i,ambient:s,diffuse:n,specular:e,emissive:o})));const Di=b.defineMapper(b.read(b.mapRequiredProp("defaultMaterial",(()=>vt)),b.mapRequiredProp("colorMaterial",Ai)),(([t,i])=>({defaultMaterial:t,colorMaterial:i})));const ji=b.defineMapper(b.read(b.requiredProp("name"),b.requiredProp("category")),(([t,i])=>({name:t,category:i})));const ki=b.defineMapper(b.read(b.getProp("value")),(([t])=>({type:"string",value:t})));const xi=b.mapProp("string",b.ifDefined(ki));const Mi=b.defineMapper(b.read(b.getProp("value")),(([t])=>({type:"long",value:t})));const Ei=b.mapProp("pb_long",b.ifDefined(Mi));const Oi=b.defineMapper(b.read(b.getProp("value")),(([t])=>({type:"double",value:t})));const Ri=b.mapProp("pb_double",b.ifDefined(Oi));const Bi=b.defineMapper(b.read(b.requiredProp("value")),(([t])=>({type:"timestamp",value:t})));const zi=b.mapProp("date",b.ifDefined(Bi));const Li=b.compose(b.pickFirst(xi,Ei,Ri,zi),b.required("value"));const $i=b.defineMapper(b.read(b.requiredProp("id"),b.mapProp("key",b.ifDefined(ji)),b.mapProp("value",b.ifDefined(Li))),(([t,i,s])=>({id:t,key:i,value:s})));const Ki=b.defineMapper(b.read(b.mapProp("cursor",Y),b.mapRequiredProp("entriesList",b.mapArray($i))),(([t,i])=>({paging:{next:t},entries:i})));const Fi=b.ifInvalidThrow(Ki);const Hi=b.defineMapper(b.read(b.mapRequiredProp("id",q),b.mapRequiredProp("createdAt",tt),b.mapProp("materialOverride",b.ifDefined(Di)),b.mapProp("transform",b.ifDefined(it)),b.mapProp("isVisible",b.ifDefined(st)),b.mapProp("isSelected",b.ifDefined(st)),b.mapProp("isPhantom",b.ifDefined(st)),b.mapProp("endItem",b.ifDefined(st))),(([t,i,s,n,e,o,r,h])=>({id:t,createdAt:i,materialOverride:s,transform:n,isVisible:e,isSelected:o,isPhantom:r,endItem:h})));const Ni=b.defineMapper(b.read(b.mapRequiredProp("id",q),b.mapRequiredProp("createdAt",tt),b.mapRequiredProp("name",J),b.mapProp("parentId",b.ifDefined(q)),b.mapProp("suppliedId",b.ifDefined(J)),b.mapProp("boundingBox",b.ifDefined(nt)),b.mapProp("worldTransform",b.ifDefined(it)),b.mapProp("override",b.ifDefined(Hi))),(([t,i,s,n,e,o,r,h])=>({id:t,createdAt:i,name:s,parentId:n!==null&&n!==void 0?n:undefined,suppliedId:e,boundingBox:o,worldTransform:r,override:h})));const Vi=b.ifInvalidThrow(b.defineMapper(b.read(b.mapProp("item",b.ifDefined(Ni))),(([t])=>t!==null&&t!==void 0?t:undefined)));class Wi{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 H(this.jwtProvider,e);const r=new L.GetSceneViewItemRequest;r.setSceneItemId(wt(t));r.setViewId(wt(i));const h=new K.FieldMask;if(s.includeBoundingBox){h.addPaths("bounding_box")}if(s.includeWorldTransform){h.addPaths("world_transform")}if(s.includeOverride){h.addPaths("override")}r.setAdditionalFields(h);this.client.getSceneViewItem(r,o,n)}));return Vi(n.toObject())}async listSceneItemMetadata(t,i){const s=await F((async s=>{const n=this.deviceIdProvider();const e=await H(this.jwtProvider,n);const o=new L.ListSceneItemMetadataRequest;o.setItemId(wt(t));const r=new x.Pager;if(i.size!=null){r.setLimit(i.size)}if(i.cursor!=null){r.setCursor(i.cursor)}o.setPager(r);this.client.listSceneItemMetadata(o,e,s)}));return Fi(s.toObject())}}var _i;(function(t){t["DEVICE_ID"]="vertexvis:device-id"})(_i||(_i={}));function qi(t,i,s=window.localStorage){const n=s.getItem(t);if(n!=null){const e=Object.assign(Object.assign({},JSON.parse(n)),i);s.setItem(t,JSON.stringify(e))}else{s.setItem(t,JSON.stringify(i))}}function Ui(t,i,s=window.localStorage){const n=s.getItem(t);if(n!=null){return i(JSON.parse(n))}}var Ji=function t(i,s){if(i===s)return true;if(i&&s&&typeof i=="object"&&typeof s=="object"){if(i.constructor!==s.constructor)return false;var n,e,o;if(Array.isArray(i)){n=i.length;if(n!=s.length)return false;for(e=n;e--!==0;)if(!t(i[e],s[e]))return false;return true}if(i.constructor===RegExp)return i.source===s.source&&i.flags===s.flags;if(i.valueOf!==Object.prototype.valueOf)return i.valueOf()===s.valueOf();if(i.toString!==Object.prototype.toString)return i.toString()===s.toString();o=Object.keys(i);n=o.length;if(n!==Object.keys(s).length)return false;for(e=n;e--!==0;)if(!Object.prototype.hasOwnProperty.call(s,o[e]))return false;for(e=n;e--!==0;){var r=o[e];if(!t(i[r],s[r]))return false}return true}return i!==i&&s!==s};class Xi extends w{constructor(t,i={}){var s,n,e,o,r;super(t,{loggingEnabled:i.loggingEnabled});this.state={type:"disconnected"};this.stateChanged=new C;this.dimensions=d.create(0,0);this.streamAttributes={};this.enableTemporalRefinement=(s=i.enableTemporalRefinement)!==null&&s!==void 0?s:true;this.frameBgColor=I.create(255,255,255);this.config=It("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:(r=i.enableTemporalRefinement)!==null&&r!==void 0?r:true}}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=It("platprod"),e){this.clientId=i;this.deviceId=s;this.config=n;if(this.state.type==="disconnected"){return this.loadIfDisconnected(t,e)}else if(this.state.type==="connection-failed"){return this.loadIfDisconnected(t,e)}else{return this.loadIfConnectingOrConnected(t,this.state,e)}}update(t){this.frameBgColor=t.frameBgColor?t.frameBgColor:this.frameBgColor;if(t.dimensions!=null&&!Ji(t.dimensions,this.dimensions)){this.dimensions=t.dimensions;this.ifState("connected",(()=>this.updateDimensions({dimensions:this.getDimensions()})))}if(t.streamAttributes!=null&&!Ji(this.streamAttributes,t.streamAttributes)){this.streamAttributes=t.streamAttributes;this.ifState("connected",(()=>this.updateStream({streamAttributes:Gi(this.streamAttributes)})))}if(t.enableTemporalRefinement!=null&&t.enableTemporalRefinement!==this.enableTemporalRefinement){this.enableTemporalRefinement=t.enableTemporalRefinement;if(this.state.type==="connected"){this.closeAndReconnect(this.state)}}}async loadIfConnectingOrConnected(t,i,s){var n;const{resource:e,subResource:o}=i.resource;const r=gt(t);const h=!T.isEqual(e,r.resource);const a=!T.isEqual(o,r.subResource);const c=i.type==="connecting"||i.type==="reconnecting";const l=i.type==="connected";if(h||c&&a){this.disconnect();return this.loadIfDisconnected(t)}else if(l&&a&&((n=r.subResource)===null||n===void 0?void 0:n.type)==="scene-view-state"){const t=r.queries.find((t=>t.type==="supplied-id"));const n=Object.assign(Object.assign(Object.assign({},r.subResource.id!=null?{sceneViewStateId:{hex:r.subResource.id}}:{}),t!=null?{sceneViewStateSuppliedId:{value:t.id}}:{}),s!=null?{cameraType:Qi(s)}:{});await this.loadSceneViewState(n);this.updateState(Object.assign(Object.assign({},i),{resource:r}))}}async loadIfDisconnected(t,i){try{await this.connectWithNewStream(gt(t),i)}catch(t){if(t instanceof M){this.updateState({type:"connection-failed",message:`Cannot load scene. ${t.message}`,error:t})}else if(t instanceof v){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}={}){const e=ts(is(this.config,t.resource,this.clientId,this.deviceId));console.debug(`Initiating WS connection [uri=${e.url}]`);const o=new AbortController;const r=Yi(this.config);this.updateState({type:i,resource:t,connection:{dispose:()=>{this.dispose();o.abort()}}});const h=await P.abort(o.signal,P.retry((()=>this.connect(e,r)),{maxRetries:n,delaysInMs:Xi.WS_RECONNECT_DELAYS})).catch((t=>{throw new E("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=ht(e.worldOrientation)(i);if(this.state.type==="connected"){if(t.depthBufferBytes!=null||this.state.frame.temporalRefinementCorrelationId!==t.temporalRefinementCorrelationId){this.updateState(Object.assign(Object.assign({},this.state),{frame:t,fallbackDepthBufferBytes:t.depthBufferBytes}))}else{this.updateState(Object.assign(Object.assign({},this.state),{frame:t.copy({depthBufferBytes:this.state.fallbackDepthBufferBytes})}))}}}}));const r=this.reconnectWhenNeeded();const h=this.refreshTokenWhenExpired(e.token);const a=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:()=>{r.dispose();o.dispose();h.dispose();a.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=at(await this.startStream({streamKey:{value:t.resource.id},dimensions:this.getDimensions(),frameBackgroundColor:Zi(this.frameBgColor),clientSupportsTemporalRefinement:this.enableTemporalRefinement,streamAttributes:Gi(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?Qi(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=ct(await this.reconnect({streamId:{hex:t.streamId},dimensions:this.getDimensions(),frameBackgroundColor:Zi(this.frameBgColor),streamAttributes:Gi(this.streamAttributes),clientSupportsTemporalRefinement:this.enableTemporalRefinement}));return Object.assign(Object.assign({},t),{token:i.token})}async requestClock(){const t=lt(await this.syncTime({requestTime:g()}));return new yt(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=ut(t);s(i);if(this.state.type==="connected"){this.updateState(Object.assign(Object.assign({},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",s);window.removeEventListener("online",i)}}}closeAndReconnect(t){t.connection.dispose();return this.connectToExistingStream(t)}async waitForFrame(t,i){let s;try{return await P.timeout(i*1e3,new Promise((i=>{s=this.onRequest((n=>{try{const e=n.request.drawFrame;if(e!=null){const s=ht(t)(e);i(s)}}finally{s===null||s===void 0?void 0:s.dispose()}}))})))}catch(t){throw new O(`Frame timed out after ${i/1e3}s`,t instanceof Error?t:undefined)}finally{s===null||s===void 0?void 0:s.dispose()}}acknowledgeFrameRequests(){return this.onRequest(Si(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(d.area(this.dimensions)===0){return d.create(1,1)}return this.dimensions}ifState(t,i){if(this.state.type===t){return i()}}onStateChanged(t){return this.stateChanged.on(t)}}Xi.WS_RECONNECT_DELAYS=[0,1e3,1e3,5e3];const Gi=b.ifInvalidThrow(et);const Zi=b.ifInvalidThrow(ot);const Qi=b.ifInvalidThrow(rt);function Yi(t){return{EXPERIMENTAL_frameDelivery:Object.assign(Object.assign({},t.EXPERIMENTAL_frameDelivery),{rateLimitingEnabled:t.flags.throttleFrameDelivery}),EXPERIMENTAL_adaptiveRendering:Object.assign(Object.assign({},t.EXPERIMENTAL_adaptiveRendering),{enabled:t.flags.adaptiveRendering}),EXPERIMENTAL_qualityOfService:Object.assign({},t.EXPERIMENTAL_qualityOfService)}}function ts(t){return{url:S.toString(t),protocols:["ws.vertexvis.com"]}}function is(t,i,s,n){if(s!=null){return S.appendPath(S.toString(S.parseAndAddParams("/ws",{clientId:s,deviceId:n})),S.parse(t.network.renderingHost))}else{return S.appendPath(`/stream-keys/${i.id}/session`,S.parse(t.network.renderingHost))}}const ss=15e3;function ns(t){return t.getBoundingClientRect()}function es(t,i){const s=window.getComputedStyle(t);const n=s.getPropertyValue(i);return n!==""?n:undefined}const os=":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{position:absolute;top:50%;width:100%;transform:translateY(-50%);text-align:center}";const rs=class{constructor(s){t(this,s);this.tap=i(this,"tap",7);this.doubletap=i(this,"doubletap",7);this.longpress=i(this,"longpress",7);this.frameReceived=i(this,"frameReceived",7);this.frameDrawn=i(this,"frameDrawn",7);this.tokenExpired=i(this,"tokenExpired",7);this.connectionChange=i(this,"connectionChange",7);this.sceneReady=i(this,"sceneReady",7);this.sceneChanged=i(this,"sceneChanged",7);this.interactionStarted=i(this,"interactionStarted",7);this.interactionFinished=i(this,"interactionFinished",7);this.cameraTypeChanged=i(this,"cameraTypeChanged",7);this.annotationStateChanged=i(this,"annotationStateChanged",7);this.deviceIdChange=i(this,"deviceIdChange",7);this.dimensionschange=i(this,"dimensionschange",7);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.resizeDebounce=100;this.stencilBuffer=new Rt(this.hostElement);this.viewport=jt.fromDimensions(d.create(0,0));this.stateMap={cursorManager:new Tt,streamState:{type:"disconnected"}};this.interactionHandlers=[];this.defaultInteractionHandlerDisposables=[];this.tapKeyInteractions=[];this.defaultTapKeyInteractions=[];this.internalFrameDrawnDispatcher=new C;this.handleElementResize=this.handleElementResize.bind(this)}componentWillLoad(){var t;this.updateResolvedConfig();this.calculateComponentDimensions();this.resizeObserver=new ResizeObserver(this.handleElementResize);this.registerSlotChangeListeners();const i=this.getResolvedConfig();const s=new f(i.network.sceneViewHost);this.annotations=new Wt(s,(()=>this.token),(()=>this.deviceId));this.annotations.onStateChange.on((t=>this.annotationStateChanged.emit(t)));this.stream=(t=this.stream)!==null&&t!==void 0?t:new Xi(new y,{loggingEnabled:i.flags.logWsMessages,enableTemporalRefinement:this.enableTemporalRefinement});this.addStreamListeners();this.modelViews=new bt(s,this.stream,(()=>this.token),(()=>this.deviceId));this.pmi=new Ct(s,(()=>this.token),(()=>this.deviceId));this.sceneItems=new Wi(s,(()=>this.token),(()=>this.deviceId));this.updateStreamAttributes();this.stateMap.cursorManager.onChanged.on((()=>this.handleCursorChanged()))}async componentDidLoad(){var t;this.interactionApi=this.createInteractionApi();if(this.canvasContainerElement!=null){(t=this.resizeObserver)===null||t===void 0?void 0:t.observe(this.canvasContainerElement)}if(this.src!=null){this.load(this.src,{cameraType:this.cameraType}).catch((t=>{console.error("Error loading scene",t)}))}await this.initializeDefaultInteractionHandlers();this.injectViewerApi()}render(){var t;return s(n,null,s("div",{ref:t=>this.viewerContainerElement=t,class:"viewer-container",style:{cursor:At((t=this.cursor)!==null&&t!==void 0?t:"")},onContextMenu:t=>t.preventDefault()},s("div",{ref:t=>this.canvasContainerElement=t,class:D("canvas-container",{"enable-pointer-events ":window.PointerEvent!=null})},s("canvas",{ref:t=>{this.canvasElement=t;this.stateMap.interactionTarget=t},class:"canvas"}),this.errorMessage!=null?s("div",{class:"error-message"},this.errorMessage):null),s("slot",null)))}async dispatchFrameDrawn(t){this.frame=t;this.internalFrameDrawnDispatcher.emit(t);this.frameDrawn.emit(t)}async registerInteractionHandler(t){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 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.updateStreamAttributes()}handleEnableTemporalRefinementChanged(){this.updateEnableTemporalRefinement()}handleConfigChanged(){this.updateResolvedConfig()}handleConfigEnvChanged(){this.updateResolvedConfig()}async load(t,i){var s,n;if(this.stream!=null&&this.dimensions!=null){const{EXPERIMENTAL_annotationPollingIntervalInMs:e}=this.getResolvedConfig();this.calculateComponentDimensions();this.stream.update({streamAttributes:this.getStreamAttributes(),config:It(this.configEnv,this.config),dimensions:this.dimensions,frameBgColor:this.getBackgroundColor()});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));this.sceneReady.emit();if(e!==undefined){(n=this.annotations)===null||n===void 0?void 0:n.connect(e)}}else{throw new R("Cannot load scene. Viewer has not been initialized.")}}async unload(){var t;if(this.stream!=null){(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){this.connectionChange.emit(t)}handleElementResize(t){const i=t.length>0&&this.dimensions!=null&&!d.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)}}}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=d.create(s.width,s.height);const e=d.scaleFit(i,n);this.hostDimensions=n;this.dimensions=e!=null?d.create(e.width,e.height):undefined;this.viewport=jt.fromDimensions((t=this.getCanvasDimensions())!==null&&t!==void 0?t:d.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:p(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=yi(di,bi(),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();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 n=this.frame;this.frame=dt(t,n);this.updateInteractionApi(n);const e={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||d.isEqual(this.dimensions,e.frame.image.imageAttr.frameDimensions)}return true}};this.frameReceived.emit(this.frame);if(this.frame.scene.hasChanged){this.sceneChanged.emit()}const o=await this.canvasRenderer(e);if(o!=null){this.updateViewerBackground();this.dispatchFrameDrawn(o)}}}}updateViewerBackground(){const t=this.getBackgroundColor();Mt((()=>{var i,s;(i=this.viewerContainerElement)===null||i===void 0?void 0:i.style.setProperty("background",t!=null?I.toHexString(t):"#ffffff");(s=this.canvasContainerElement)===null||s===void 0?void 0:s.style.setProperty("background",t!=null?I.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 ai((()=>this.getResolvedConfig()));const i=await this.registerInteractionHandler(this.baseInteractionHandler);const s=await this.registerInteractionHandler(new hi);this.defaultInteractionHandlerDisposables=[i,s]}else{this.baseInteractionHandler=(i=this.baseInteractionHandler)!==null&&i!==void 0?i:new ei((()=>this.getResolvedConfig()));const t=await this.registerInteractionHandler(this.baseInteractionHandler);const s=await this.registerInteractionHandler(new li);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 _t(this.stream,(()=>this.getResolvedConfig()),(()=>this.getImageScale()));const s=new Gt(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 ci("pointerdown","pointerup","pointermove",(()=>this.getResolvedConfig()));this.tapHandlerDisposable=await this.registerInteractionHandler(t)}else{const t=new ci("mousedown","mouseup","mousemove",(()=>this.getResolvedConfig()));this.tapHandlerDisposable=await this.registerInteractionHandler(t)}}}initializeInteractionHandler(t){if(this.stateMap.interactionTarget==null){throw new B("Cannot initialize interaction handler. Interaction target is undefined.")}if(this.interactionApi==null){throw new B("Cannot initialize interaction handler. Interaction APi is undefined.")}t.initialize(this.stateMap.interactionTarget,this.interactionApi)}createInteractionApi(){if(this.stream==null){throw new z("Cannot create interaction API. Component has not been initialized.")}return this.frame==null||this.frame.scene.camera.isPerspective()?new Xt(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 Ut(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=ft();const{frame:s,sceneId:n,sceneViewId:e,worldOrientation:o}=t;return new Pt(this.getStream(),s,ht(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?I.fromCss(s):I.create(255,255,255)}}getBounds(){return ns(this.hostElement)}getCanvasDimensions(){return this.getResolvedConfig().flags.letterboxFrames?this.dimensions:this.hostDimensions}getImageScale(){const t=this.getCanvasDimensions();if(this.dimensions!=null&&t!=null){return o.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}}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:Z(pt(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:Z(mt(this.frame.scene.camera))})}}}getDepthBufferStreamAttributesValue(){var t;const i=(t=this.depthBuffers)!==null&&t!==void 0?t:this.rotateAroundTapPoint?"final":undefined;return i}updateResolvedConfig(){this.resolvedConfig=It(this.configEnv,this.config)}getResolvedConfig(){return hs("Resolved config is undefined",(()=>this.resolvedConfig))}getStream(){return hs("Stream is undefined",(()=>this.stream))}getDeviceId(){if(this.deviceId==null){try{this.deviceId=Ui(_i.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=A.create();try{qi(_i.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."))}),ss)}))}return this.stateMap.streamState}get hostElement(){return e(this)}static get watchers(){return{src:["handleSrcChanged"],cameraControls:["handleCameraControlsChanged"],keyboardControls:["handleKeyboardControlsChanged"],rotateAroundTapPoint:["handleRotateAboutTapPointChanged"],cameraType:["handleCameraTypeChanged"],experimentalRenderingOptions:["handleStreamAttributesChanged"],depthBuffers:["handleStreamAttributesChanged"],featureHighlighting:["handleStreamAttributesChanged"],featureLines:["handleStreamAttributesChanged"],featureMaps:["handleStreamAttributesChanged"],noDefaultLights:["handleStreamAttributesChanged"],phantom:["handleStreamAttributesChanged"],sceneComparison:["handleStreamAttributesChanged"],selectionHighlighting:["handleStreamAttributesChanged"],enableTemporalRefinement:["handleEnableTemporalRefinementChanged"],config:["handleConfigChanged"],configEnv:["handleConfigEnvChanged"]}}};function hs(t,i){const s=i();if(s!=null){return s}else throw new Error(t)}rs.style=os;export{rs as vertex_viewer};
|
|
5
|
+
//# sourceMappingURL=p-caaf5f09.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2025 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{r as i,c as e,h as t,H as s,g as o}from"./p-6685b50e.js";import{a as l,V as r}from"./p-1204b485.js";import{b as h}from"./p-
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
import{r as i,c as e,h as t,H as s,g as o}from"./p-6685b50e.js";import{a as l,V as r}from"./p-1204b485.js";import{b as h}from"./p-d457f24a.js";import{g as n}from"./p-3d985864.js";import"./p-28dfd6fb.js";import"./p-021bcb25.js";import"./p-da65b274.js";class d{constructor(i){this.controller=i;this.handleDragBegin=this.handleDragBegin.bind(this);this.handleDrag=this.handleDrag.bind(this);this.handleDragEnd=this.handleDragEnd.bind(this);this.enabled=true}initialize(i,e){this.element=i;this.api=e;this.element.addEventListener("pointerdown",this.handleDragBegin);this.addCrosshairCursor()}dispose(){var i,e,t;(i=this.element)===null||i===void 0?void 0:i.removeEventListener("pointerdown",this.handleDragBegin);window.removeEventListener("pointermove",this.handleDrag);window.removeEventListener("pointerup",this.handleDragEnd);(e=this.crosshairCursorDisposable)===null||e===void 0?void 0:e.dispose();(t=this.waitCursorDisposable)===null||t===void 0?void 0:t.dispose();this.element=undefined;this.api=undefined;this.enabled=true}disable(){this.enabled=false}enable(){this.enabled=true}handleDragBegin(i){var e;if(this.enabled&&this.isPrimaryMouseButtonClick(i)&&!this.isInteracting){this.elementBounds=(e=this.element)===null||e===void 0?void 0:e.getBoundingClientRect();this.isInteracting=true;this.controller.setStartPoint(n(i,this.elementBounds));window.addEventListener("pointermove",this.handleDrag);window.addEventListener("pointerup",this.handleDragEnd)}}handleDrag(i){if(this.enabled){this.controller.setEndPoint(n(i,this.elementBounds))}}async handleDragEnd(){var i,e;this.isInteracting=false;window.removeEventListener("pointermove",this.handleDrag);window.removeEventListener("pointerup",this.handleDragEnd);(i=this.crosshairCursorDisposable)===null||i===void 0?void 0:i.dispose();if(this.enabled){this.addWaitCursor();try{await this.controller.execute()}finally{(e=this.waitCursorDisposable)===null||e===void 0?void 0:e.dispose();this.addCrosshairCursor()}}}isPrimaryMouseButtonClick(i){return i.buttons===1}addCrosshairCursor(){var i,e;(i=this.crosshairCursorDisposable)===null||i===void 0?void 0:i.dispose();this.crosshairCursorDisposable=(e=this.api)===null||e===void 0?void 0:e.addCursor(h)}addWaitCursor(){var i,e;(i=this.waitCursorDisposable)===null||i===void 0?void 0:i.dispose();this.waitCursorDisposable=(e=this.api)===null||e===void 0?void 0:e.addCursor("wait")}}const u=':host{--viewer-box-query-outline-exclusive-color:#0099cc;--viewer-box-query-outline-exclusive-border-style:solid;--viewer-box-query-outline-inclusive-color:#00cc00;--viewer-box-query-outline-inclusive-border-style:dashed;--viewer-box-query-outline-border-radius:0.25rem;--viewer-box-query-outline-fill-opacity:0.25}.bounds{position:absolute}.outline{position:absolute;top:0;left:0;width:100%;height:100%;box-sizing:border-box;border-radius:var(--viewer-box-query-outline-border-radius)}:host([exclusive="true"]) .outline{border:3px var(--viewer-box-query-outline-exclusive-border-style) var(--viewer-box-query-outline-exclusive-color)}:host([inclusive="true"]) .outline{border:3px var(--viewer-box-query-outline-inclusive-border-style) var(--viewer-box-query-outline-inclusive-color)}.fill{position:absolute;top:0;left:0;width:100%;height:100%;opacity:var(--viewer-box-query-outline-fill-opacity);border-radius:var(--viewer-box-query-outline-border-radius)}:host([exclusive="true"]) .fill{background-color:var(--viewer-box-query-outline-exclusive-color)}:host([inclusive="true"]) .fill{background-color:var(--viewer-box-query-outline-inclusive-color)}';const a=class{constructor(t){i(this,t);this.controllerChanged=e(this,"controllerChanged",7);this.operationType="clearAndSelect";this.handleScreenBoundsChanged=this.handleScreenBoundsChanged.bind(this);this.handleExecuteStarted=this.handleExecuteStarted.bind(this);this.handleExecuteComplete=this.handleExecuteComplete.bind(this)}componentWillLoad(){var i;this.model=(i=this.model)!==null&&i!==void 0?i:new l(this.mode);this.screenBoundsChangedDisposable=this.model.onScreenBoundsChanged(this.handleScreenBoundsChanged);this.handleViewerChanged(this.viewer);this.handleControllerChange(this.controller);this.handleDefaultOperationChange(this.operationType)}disconnectedCallback(){var i,e,t,s;(i=this.model)===null||i===void 0?void 0:i.reset();(e=this.screenBoundsChangedDisposable)===null||e===void 0?void 0:e.dispose();(t=this.operationStartedDisposable)===null||t===void 0?void 0:t.dispose();(s=this.operationCompleteDisposable)===null||s===void 0?void 0:s.dispose();this.deregisterInteractionHandler()}handleViewerChanged(i){this.deregisterInteractionHandler();if(this.model!=null&&i!=null){this.controller=new r(this.model,i);this.handleDefaultOperationChange(this.operationType);this.registerInteractionHandler(this.controller,i)}}handleDefaultOperationChange(i){switch(i){case"clearAndSelect":this.setDefaultClearAndSelectOperation();break;case"select":this.setDefaultSelectOperation();break;case"deselect":this.setDefaultDeselectOperation();break}}handleModeChange(i){var e;(e=this.model)===null||e===void 0?void 0:e.setMode(i)}handleControllerChange(i){var e,t;(e=this.operationStartedDisposable)===null||e===void 0?void 0:e.dispose();(t=this.operationCompleteDisposable)===null||t===void 0?void 0:t.dispose();this.operationStartedDisposable=i===null||i===void 0?void 0:i.onExecuteStarted(this.handleExecuteStarted);this.operationStartedDisposable=i===null||i===void 0?void 0:i.onExecuteComplete(this.handleExecuteComplete);this.controllerChanged.emit(this.controller)}render(){return t(s,null,t("vertex-viewer-layer",null,this.details!=null&&t("div",{class:"bounds",style:{left:`${this.details.screenBounds.x}px`,top:`${this.details.screenBounds.y}px`,width:`${this.details.screenBounds.width}px`,height:`${this.details.screenBounds.height}px`}},t("slot",{name:"bounds"},t("div",{class:"outline"}),t("div",{class:"fill"})))))}handleScreenBoundsChanged(i){this.details=i;this.updateTypeAttribute(i===null||i===void 0?void 0:i.type)}handleExecuteStarted(){var i;(i=this.interactionHandler)===null||i===void 0?void 0:i.disable()}handleExecuteComplete(){var i;(i=this.interactionHandler)===null||i===void 0?void 0:i.enable()}async registerInteractionHandler(i,e){this.interactionHandler=new d(i);this.interactionHandlerDisposable=await e.registerInteractionHandler(this.interactionHandler)}deregisterInteractionHandler(){var i,e;(i=this.interactionHandlerDisposable)===null||i===void 0?void 0:i.dispose();(e=this.interactionHandler)===null||e===void 0?void 0:e.dispose();this.interactionHandler=undefined}updateTypeAttribute(i){this.hostEl.setAttribute("inclusive",`${i==="inclusive"}`);this.hostEl.setAttribute("exclusive",`${i==="exclusive"}`)}setDefaultClearAndSelectOperation(){var i,e;(i=this.controller)===null||i===void 0?void 0:i.setOperationTransform((i=>i.select()));(e=this.controller)===null||e===void 0?void 0:e.setAdditionalTransforms([i=>i.items.where((i=>i.withSelected())).deselect()])}setDefaultSelectOperation(){var i,e;(i=this.controller)===null||i===void 0?void 0:i.setOperationTransform((i=>i.select()));(e=this.controller)===null||e===void 0?void 0:e.setAdditionalTransforms([])}setDefaultDeselectOperation(){var i,e;(i=this.controller)===null||i===void 0?void 0:i.setOperationTransform((i=>i.deselect()));(e=this.controller)===null||e===void 0?void 0:e.setAdditionalTransforms([])}get hostEl(){return o(this)}static get watchers(){return{viewer:["handleViewerChanged"],operationType:["handleDefaultOperationChange"],mode:["handleModeChange"],controller:["handleControllerChange"]}}};a.style=u;export{a as vertex_viewer_box_query_tool};
|
|
5
|
+
//# sourceMappingURL=p-cd746316.entry.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2025 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import{E as s}from"./p-da65b274.js";class t{constructor(){this.onChanged=new s;this.cursors=[];this.nextId=0}add(s,a=t.NORMAL_PRIORITY){const l=this.getExistingDuplicateCursor(s,a);if(l!=null){this.remove(l.id)}const h=++this.nextId;const i={id:h,cursor:s,priority:a,dispose:()=>this.remove(h)};this.cursors.push(i);this.onChanged.emit();return i}remove(s){const t=this.cursors.findIndex((({id:t})=>t===s));if(t>=0){this.cursors.splice(t,1);this.onChanged.emit()}}getExistingDuplicateCursor(s,t){return this.cursors.find((a=>a.cursor===s&&a.priority===t))}getActiveCursor(){var s;const t=this.cursors.concat().reverse().sort(((s,t)=>t.priority-s.priority));return(s=t[0])===null||s===void 0?void 0:s.cursor}}t.LOW_PRIORITY=0;t.NORMAL_PRIORITY=10;t.HIGH_PRIORITY=20;const a={url:"data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M21.5 8h-19a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h19a.5.5 0 00.5-.5v-6a.5.5 0 00-.5-.5zm-.5 6H3V9h3v2.5a.5.5 0 001 0V9h2v2.5a.5.5 0 001 0V9h2v2.5a.5.5 0 001 0V9h2v2.5a.5.5 0 001 0V9h2v2.5a.5.5 0 001 0V9h2z' stroke='%23fff' stroke-width='1.25' stroke-opacity='0.5' stroke-miterlimit='10' shape-rendering='crispEdges'/%3E%3Cpath d='M21.5 8h-19a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h19a.5.5 0 00.5-.5v-6a.5.5 0 00-.5-.5zm-.5 6H3V9h3v2.5a.5.5 0 001 0V9h2v2.5a.5.5 0 001 0V9h2v2.5a.5.5 0 001 0V9h2v2.5a.5.5 0 001 0V9h2v2.5a.5.5 0 001 0V9h2z' shape-rendering='crispEdges'/%3E%3C/svg%3E",offsetX:-24,offsetY:-24};const l={url:"data:image/svg+xml;utf8,%3Csvg id='icons' xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bstroke:%23fff;stroke-miterlimit:10;stroke-width:2px;%7D.cls-2%7Bfill:%23fff;%7D.cls-2,.cls-3%7Bfill-rule:evenodd;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M27.46,21h-19a.5.5,0,0,0-.5.5v6a.5.5,0,0,0,.5.5h19a.5.5,0,0,0,.5-.5v-6A.5.5,0,0,0,27.46,21ZM27,27H9V22h3v2.5a.5.5,0,0,0,1,0V22h2v2.5a.5.5,0,0,0,1,0V22h2v2.5a.5.5,0,0,0,1,0V22h2v2.5a.5.5,0,0,0,1,0V22h2v2.5a.5.5,0,0,0,1,0V22h2Z'/%3E%3Cpath d='M27.46,21h-19a.5.5,0,0,0-.5.5v6a.5.5,0,0,0,.5.5h19a.5.5,0,0,0,.5-.5v-6A.5.5,0,0,0,27.46,21ZM27,27H9V22h3v2.5a.5.5,0,0,0,1,0V22h2v2.5a.5.5,0,0,0,1,0V22h2v2.5a.5.5,0,0,0,1,0V22h2v2.5a.5.5,0,0,0,1,0V22h2v2.5a.5.5,0,0,0,1,0V22h2Z'/%3E%3Cpath class='cls-2' d='M1,17V1L12.59,12.62H5.81l-.41.12Z'/%3E%3Cpath class='cls-2' d='M10.08,17.69l-3.6,1.53L1.8,8.14,5.48,6.58Z'/%3E%3Cpath class='cls-3' d='M8.75,17l-1.84.77-3.1-7.37,1.84-.78Z'/%3E%3Cpath class='cls-3' d='M2,3.41V14.6l3-2.87.43-.14h4.76Z'/%3E%3C/svg%3E",offsetX:-30,offsetY:-30};const h={url:"data:image/svg+xml,%3Csvg width='36px' height='36px' viewBox='0 0 24 24' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cdefs%3E%3Cpath d='M12,2 C7.581722,2 4,5.581722 4,10 C4.00435812,11.7714969 4.41127263,13.5188357 5.19,15.11 C6.15517666,17.0237439 7.49502409,18.7240579 9.13,20.11 C9.86916736,20.7592093 10.6620019,21.3446357 11.5,21.86 L12,22.14 L12.5,21.86 C13.8750156,21.0120029 15.1296156,19.9827599 16.23,18.8 C17.2698142,17.7023203 18.1394508,16.4551671 18.81,15.1 C19.5872532,13.5118707 19.9941287,11.7681184 20,10 C20,5.581722 16.418278,2 12,2 Z M12,13 C10.3431458,13 9,11.6568542 9,10 C9,8.34314575 10.3431458,7 12,7 C13.6568542,7 15,8.34314575 15,10 C15,10.7956495 14.6839295,11.5587112 14.1213203,12.1213203 C13.5587112,12.6839295 12.7956495,13 12,13 Z' id='path-1'%3E%3C/path%3E%3C/defs%3E%3Cg id='icons/pin-filled' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E%3Cmask id='mask-2' fill='white'%3E%3Cuse xlink:href='%23path-1'%3E%3C/use%3E%3C/mask%3E%3Cuse id='Shape' stroke='%23FAFAFA' fill='%23BDBDBD' fill-rule='nonzero' xlink:href='%23path-1'%3E%3C/use%3E%3C/g%3E%3C/svg%3E",offsetX:17,offsetY:22};const i={url:"data:image/svg+xml,%3Csvg width='36px' height='36px' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 16 24' %3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:none;%7D.cls-2%7Bfill:%23616161;%7D.cls-3%7Bclip-path:url(%23clip-path);%7D%3C/style%3E%3CclipPath id='clip-path'%3E%3Ccircle cx='-576.76' cy='-107.26' r='4'/%3E%3C/clipPath%3E%3C/defs%3E%3Cpath d='M8,16H8a.48.48,0,0,1-.42-.23L5.75,13H3.51A1.5,1.5,0,0,1,2,11.5v-8A1.5,1.5,0,0,1,3.51,2h9A1.51,1.51,0,0,1,14,3.5v8a1.5,1.5,0,0,1-1.5,1.5H10.22L8.39,15.81A.5.5,0,0,1,8,16ZM3.51,3a.5.5,0,0,0-.5.5v8a.5.5,0,0,0,.5.5H6a.5.5,0,0,1,.42.23L8,14.61l1.55-2.38A.5.5,0,0,1,10,12h2.56a.5.5,0,0,0,.5-.5v-8a.51.51,0,0,0-.5-.5Z'/%3E%3Ccircle cx='8.01' cy='20' r='2'/%3E%3C/svg%3E%0A",offsetX:17,offsetY:29};const e={url:"data:image/svg+xml;utf8,%3Csvg id='icons' xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bstroke:%23fff;stroke-miterlimit:10;stroke-width:2px;%7D.cls-2%7Bfill:%23fff;%7D.cls-2,.cls-3%7Bfill-rule:evenodd;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-2' d='M1.25,17V1L12.59,12.62H5.81l-.41.12Z'/%3E%3Cpath class='cls-2' d='M10.33,17.69l-3.6,1.53L1.8,8.14,5.48,6.58Z'/%3E %3Cpath class='cls-3' d='M9,17l-1.84.77-3.1-7.37,1.84-.78Z'/%3E%3Cpath class='cls-3' d='M2.25,3.41V14.6l3-2.87.43-.14h4.76Z'/%3E%3Cpath class='cls-1' d='M21.36,22.5H15.5V16.64a.5.5,0,0,0-1,0V22.5H8.64a.5.5,0,0,0,0,1H14.5v5.86a.5.5,0,0,0,1,0V23.5h5.86a.5.5,0,0,0,0-1Z' /%3E %3Cpath d='M21.36,22.5H15.5V16.64a.5.5,0,0,0-1,0V22.5H8.64a.5.5,0,0,0,0,1H14.5v5.86a.5.5,0,0,0,1,0V23.5h5.86a.5.5,0,0,0,0-1Z' /%3E%3C/svg%3E",offsetX:-30,offsetY:-30};export{t as C,l as a,e as b,i as l,a as m,h as p};
|
|
5
|
+
//# sourceMappingURL=p-d457f24a.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["src/lib/cursors.ts"],"names":["CursorManager","[object Object]","this","onChanged","EventDispatcher","cursors","nextId","cursor","priority","NORMAL_PRIORITY","duplicateCursor","getExistingDuplicateCursor","remove","id","instance","dispose","push","emit","cursorId","index","findIndex","splice","cursorToCheck","priorityToCheck","find","sorted","concat","reverse","sort","a","b","_a","LOW_PRIORITY","HIGH_PRIORITY","measurementCursor","url","offsetX","offsetY","measurementWithArrowCursor","pinCursor","labelPinCursor","boxQueryCursor"],"mappings":";;;0CAwEaA,EAAbC,cAuBkBC,KAAAC,UAAY,IAAIC,EAExBF,KAAAG,QAA4B,GAE5BH,KAAAI,OAAS,EAYVL,IACLM,EACAC,EAAWR,EAAcS,iBAMzB,MAAMC,EAAkBR,KAAKS,2BAA2BJ,EAAQC,GAChE,GAAIE,GAAmB,KAAM,CAC3BR,KAAKU,OAAOF,EAAgBG,IAG9B,MAAMA,IAAOX,KAAKI,OAClB,MAAMQ,EAAW,CAAED,GAAAA,EAAIN,OAAAA,EAAQC,SAAAA,EAAUO,QAAS,IAAMb,KAAKU,OAAOC,IACpEX,KAAKG,QAAQW,KAAKF,GAClBZ,KAAKC,UAAUc,OACf,OAAOH,EAQDb,OAAOiB,GACb,MAAMC,EAAQjB,KAAKG,QAAQe,WAAU,EAAGP,GAAAA,KAASA,IAAOK,IACxD,GAAIC,GAAS,EAAG,CACdjB,KAAKG,QAAQgB,OAAOF,EAAO,GAC3BjB,KAAKC,UAAUc,QAWXhB,2BACNqB,EACAC,GAEA,OAAOrB,KAAKG,QAAQmB,MACjBjB,GACCA,EAAOA,SAAWe,GAAiBf,EAAOC,WAAae,IAStDtB,wBACL,MAAMwB,EAASvB,KAAKG,QACjBqB,SACAC,UACAC,MAAK,CAACC,EAAGC,IAAMA,EAAEtB,SAAWqB,EAAErB,WAEjC,OAAOuB,EAAAN,EAAO,MAAE,MAAAM,SAAA,OAAA,EAAAA,EAAExB,QAhGGP,EAAAgC,aAAe,EAMfhC,EAAAS,gBAAkB,GAKlBT,EAAAiC,cAAgB,SA2F5BC,EAAoB,CAC/BC,IAAK,krBACLC,SAAU,GACVC,SAAU,UAGCC,EAA6B,CACxCH,IAAK,uiCACLC,SAAU,GACVC,SAAU,UAGCE,EAAY,CACvBJ,IAAK,4oCACLC,QAAS,GACTC,QAAS,UAGEG,EAAiB,CAC5BL,IAAK,ovBACLC,QAAS,GACTC,QAAS,UAGEI,EAAiB,CAC5BN,IAAK,g1BACLC,SAAU,GACVC,SAAU","sourcesContent":["import { Disposable, EventDispatcher } from '@vertexvis/utils';\n\n/**\n * Represents a built-in [browser CSS\n * cursor](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor).\n */\nexport type CssCursor =\n | 'auto'\n | 'default'\n | 'none'\n | 'context-menu'\n | 'help'\n | 'pointer'\n | 'progress'\n | 'wait'\n | 'cell'\n | 'crosshair'\n | 'text'\n | 'vertical-text'\n | 'alias'\n | 'copy'\n | 'move'\n | 'no-drop'\n | 'not-allowed'\n | 'grab'\n | 'grabbing'\n | 'all-scroll'\n | 'col-resize'\n | 'row-resize'\n | 'n-resize'\n | 'e-resize'\n | 's-resize'\n | 'w-resize'\n | 'ne-resize'\n | 'nw-resize'\n | 'se-resize'\n | 'sw-resize'\n | 'ew-resize'\n | 'ns-resize'\n | 'nesw-resize'\n | 'nwse-resize'\n | 'zoom-in'\n | 'zoom-out'\n | string;\n\n/**\n * Represents a custom cursor that points to an image file and offset.\n */\nexport interface CustomCursor {\n url: string;\n offsetX?: number;\n offsetY?: number;\n}\n\n/**\n * Represents all possible cursor types.\n */\nexport type Cursor = CssCursor | CustomCursor;\n\ninterface CursorInstance extends Disposable {\n id: number;\n cursor: Cursor;\n priority: number;\n}\n\n/**\n * The cursor manager maintains a prioritized list of cursors for the viewer.\n *\n * Cursors with the highest priority will be considered active, where the most\n * recently added cursor will take precedence if there are multiple cursors with\n * the same priority.\n */\nexport class CursorManager {\n /**\n * A constant representing the lowest priority cursors.\n */\n public static readonly LOW_PRIORITY = 0;\n\n /**\n * A constant representing a priority between `LOW_PRIORITY` and\n * `HIGH_PRIORITY`.\n */\n public static readonly NORMAL_PRIORITY = 10;\n\n /**\n * A constant representing the high priority cursors.\n */\n public static readonly HIGH_PRIORITY = 20;\n\n /**\n * An event dispatcher that emits an event when a cursor is added or removed.\n *\n * @see {@link CursorManager.add} to add a cursor.\n * @see {@link CursorManager.getActiveCursor} to query the current cursor.\n */\n public readonly onChanged = new EventDispatcher<void>();\n\n private cursors: CursorInstance[] = [];\n\n private nextId = 0;\n\n /**\n * Adds a cursor to the cursor manager, and returns an identifier that can be\n * used to remove the cursor.\n *\n * @param cursor The cursor to add.\n * @param priority The priority of the cursor. Higher values have higher\n * \tpriority over lower values.\n * @returns An identifier for the cursor.\n * @see {@link CursorManager.getActiveCursor} to query the current cursor.\n */\n public add(\n cursor: Cursor,\n priority = CursorManager.NORMAL_PRIORITY\n ): Disposable {\n // Ensure a duplicate cursor will not be added to the cursor manager.\n // If a matching cursor exists, delete it before proceeding.\n // Note that deleting the old cursor and adding the new one results in the\n // new cursor taking precedent over other existing cursors with the same priority.\n const duplicateCursor = this.getExistingDuplicateCursor(cursor, priority);\n if (duplicateCursor != null) {\n this.remove(duplicateCursor.id);\n }\n\n const id = ++this.nextId;\n const instance = { id, cursor, priority, dispose: () => this.remove(id) };\n this.cursors.push(instance);\n this.onChanged.emit();\n return instance;\n }\n\n /**\n * Removes a cursor with the given ID, if it exists.\n *\n * @param cursorId The ID of the cursor to remove.\n */\n private remove(cursorId: number): void {\n const index = this.cursors.findIndex(({ id }) => id === cursorId);\n if (index >= 0) {\n this.cursors.splice(index, 1);\n this.onChanged.emit();\n }\n }\n\n /**\n * Checks to see if an existing cursor matches the provided cursor and priority level.\n * The matching cursor is returned if found.\n *\n * @param cursorToCheck The cursor to check for duplicates against.\n * @param priorityToCheck The priority level to check for duplicates against.\n */\n private getExistingDuplicateCursor(\n cursorToCheck: Cursor,\n priorityToCheck: number\n ): CursorInstance | undefined {\n return this.cursors.find(\n (cursor) =>\n cursor.cursor === cursorToCheck && cursor.priority === priorityToCheck\n );\n }\n\n /**\n * Returns the active cursor based on priority and insertion order.\n *\n * @see {@link CursorManager.add} to add a cursor.\n */\n public getActiveCursor(): Cursor | undefined {\n const sorted = this.cursors\n .concat()\n .reverse()\n .sort((a, b) => b.priority - a.priority);\n\n return sorted[0]?.cursor;\n }\n}\n\n// CSS SVG images need to be URL encoded: https://yoksel.github.io/url-encoder/\n\nexport const measurementCursor = {\n url: \"data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M21.5 8h-19a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h19a.5.5 0 00.5-.5v-6a.5.5 0 00-.5-.5zm-.5 6H3V9h3v2.5a.5.5 0 001 0V9h2v2.5a.5.5 0 001 0V9h2v2.5a.5.5 0 001 0V9h2v2.5a.5.5 0 001 0V9h2v2.5a.5.5 0 001 0V9h2z' stroke='%23fff' stroke-width='1.25' stroke-opacity='0.5' stroke-miterlimit='10' shape-rendering='crispEdges'/%3E%3Cpath d='M21.5 8h-19a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h19a.5.5 0 00.5-.5v-6a.5.5 0 00-.5-.5zm-.5 6H3V9h3v2.5a.5.5 0 001 0V9h2v2.5a.5.5 0 001 0V9h2v2.5a.5.5 0 001 0V9h2v2.5a.5.5 0 001 0V9h2v2.5a.5.5 0 001 0V9h2z' shape-rendering='crispEdges'/%3E%3C/svg%3E\",\n offsetX: -24,\n offsetY: -24,\n};\n\nexport const measurementWithArrowCursor = {\n url: \"data:image/svg+xml;utf8,%3Csvg id='icons' xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bstroke:%23fff;stroke-miterlimit:10;stroke-width:2px;%7D.cls-2%7Bfill:%23fff;%7D.cls-2,.cls-3%7Bfill-rule:evenodd;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M27.46,21h-19a.5.5,0,0,0-.5.5v6a.5.5,0,0,0,.5.5h19a.5.5,0,0,0,.5-.5v-6A.5.5,0,0,0,27.46,21ZM27,27H9V22h3v2.5a.5.5,0,0,0,1,0V22h2v2.5a.5.5,0,0,0,1,0V22h2v2.5a.5.5,0,0,0,1,0V22h2v2.5a.5.5,0,0,0,1,0V22h2v2.5a.5.5,0,0,0,1,0V22h2Z'/%3E%3Cpath d='M27.46,21h-19a.5.5,0,0,0-.5.5v6a.5.5,0,0,0,.5.5h19a.5.5,0,0,0,.5-.5v-6A.5.5,0,0,0,27.46,21ZM27,27H9V22h3v2.5a.5.5,0,0,0,1,0V22h2v2.5a.5.5,0,0,0,1,0V22h2v2.5a.5.5,0,0,0,1,0V22h2v2.5a.5.5,0,0,0,1,0V22h2v2.5a.5.5,0,0,0,1,0V22h2Z'/%3E%3Cpath class='cls-2' d='M1,17V1L12.59,12.62H5.81l-.41.12Z'/%3E%3Cpath class='cls-2' d='M10.08,17.69l-3.6,1.53L1.8,8.14,5.48,6.58Z'/%3E%3Cpath class='cls-3' d='M8.75,17l-1.84.77-3.1-7.37,1.84-.78Z'/%3E%3Cpath class='cls-3' d='M2,3.41V14.6l3-2.87.43-.14h4.76Z'/%3E%3C/svg%3E\",\n offsetX: -30,\n offsetY: -30,\n};\n\nexport const pinCursor = {\n url: \"data:image/svg+xml,%3Csvg width='36px' height='36px' viewBox='0 0 24 24' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cdefs%3E%3Cpath d='M12,2 C7.581722,2 4,5.581722 4,10 C4.00435812,11.7714969 4.41127263,13.5188357 5.19,15.11 C6.15517666,17.0237439 7.49502409,18.7240579 9.13,20.11 C9.86916736,20.7592093 10.6620019,21.3446357 11.5,21.86 L12,22.14 L12.5,21.86 C13.8750156,21.0120029 15.1296156,19.9827599 16.23,18.8 C17.2698142,17.7023203 18.1394508,16.4551671 18.81,15.1 C19.5872532,13.5118707 19.9941287,11.7681184 20,10 C20,5.581722 16.418278,2 12,2 Z M12,13 C10.3431458,13 9,11.6568542 9,10 C9,8.34314575 10.3431458,7 12,7 C13.6568542,7 15,8.34314575 15,10 C15,10.7956495 14.6839295,11.5587112 14.1213203,12.1213203 C13.5587112,12.6839295 12.7956495,13 12,13 Z' id='path-1'%3E%3C/path%3E%3C/defs%3E%3Cg id='icons/pin-filled' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E%3Cmask id='mask-2' fill='white'%3E%3Cuse xlink:href='%23path-1'%3E%3C/use%3E%3C/mask%3E%3Cuse id='Shape' stroke='%23FAFAFA' fill='%23BDBDBD' fill-rule='nonzero' xlink:href='%23path-1'%3E%3C/use%3E%3C/g%3E%3C/svg%3E\",\n offsetX: 17,\n offsetY: 22,\n};\n\nexport const labelPinCursor = {\n url: \"data:image/svg+xml,%3Csvg width='36px' height='36px' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 16 24' %3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:none;%7D.cls-2%7Bfill:%23616161;%7D.cls-3%7Bclip-path:url(%23clip-path);%7D%3C/style%3E%3CclipPath id='clip-path'%3E%3Ccircle cx='-576.76' cy='-107.26' r='4'/%3E%3C/clipPath%3E%3C/defs%3E%3Cpath d='M8,16H8a.48.48,0,0,1-.42-.23L5.75,13H3.51A1.5,1.5,0,0,1,2,11.5v-8A1.5,1.5,0,0,1,3.51,2h9A1.51,1.51,0,0,1,14,3.5v8a1.5,1.5,0,0,1-1.5,1.5H10.22L8.39,15.81A.5.5,0,0,1,8,16ZM3.51,3a.5.5,0,0,0-.5.5v8a.5.5,0,0,0,.5.5H6a.5.5,0,0,1,.42.23L8,14.61l1.55-2.38A.5.5,0,0,1,10,12h2.56a.5.5,0,0,0,.5-.5v-8a.51.51,0,0,0-.5-.5Z'/%3E%3Ccircle cx='8.01' cy='20' r='2'/%3E%3C/svg%3E%0A\",\n offsetX: 17,\n offsetY: 29,\n};\n\nexport const boxQueryCursor = {\n url: \"data:image/svg+xml;utf8,%3Csvg id='icons' xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bstroke:%23fff;stroke-miterlimit:10;stroke-width:2px;%7D.cls-2%7Bfill:%23fff;%7D.cls-2,.cls-3%7Bfill-rule:evenodd;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-2' d='M1.25,17V1L12.59,12.62H5.81l-.41.12Z'/%3E%3Cpath class='cls-2' d='M10.33,17.69l-3.6,1.53L1.8,8.14,5.48,6.58Z'/%3E %3Cpath class='cls-3' d='M9,17l-1.84.77-3.1-7.37,1.84-.78Z'/%3E%3Cpath class='cls-3' d='M2.25,3.41V14.6l3-2.87.43-.14h4.76Z'/%3E%3Cpath class='cls-1' d='M21.36,22.5H15.5V16.64a.5.5,0,0,0-1,0V22.5H8.64a.5.5,0,0,0,0,1H14.5v5.86a.5.5,0,0,0,1,0V23.5h5.86a.5.5,0,0,0,0-1Z' /%3E %3Cpath d='M21.36,22.5H15.5V16.64a.5.5,0,0,0-1,0V22.5H8.64a.5.5,0,0,0,0,1H14.5v5.86a.5.5,0,0,0,1,0V23.5h5.86a.5.5,0,0,0,0-1Z' /%3E%3C/svg%3E\",\n offsetX: -30,\n offsetY: -30,\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2025 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{d as e,N as t,w as n,p as a,b as i}from"./p-6685b50e.js";import{g as o}from"./p-70a6c9eb.js";import"./p-bcce32b5.js";const r=e=>`__sc_import_${e.replace(/\s|-/g,"_")}`;const s=()=>{const i=Array.from(e.querySelectorAll("script")).find((e=>new RegExp(`/${t}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===t));const o="";const r={};if(o!==""){r.resourcesUrl=new URL(".",o).href}else{r.resourcesUrl=new URL(".",new URL(i.getAttribute("data-resources-url")||i.src,n.location.href)).href;{l(r.resourcesUrl,i)}if(!n.customElements){return __sc_import_viewer("./p-4e5c5637.js").then((()=>r))}}return a(r)};const l=(a,i)=>{const o=r(t);try{n[o]=new Function("w",`return import(w);//${Math.random()}`)}catch(t){const r=new Map;n[o]=t=>{const s=new URL(t,a).href;let l=r.get(s);if(!l){const t=e.createElement("script");t.type="module";t.crossOrigin=i.crossOrigin;t.src=URL.createObjectURL(new Blob([`import * as m from '${s}'; window.${o}.m = m;`],{type:"application/javascript"}));l=new Promise((e=>{t.onload=()=>{e(n[o].m);t.remove()}}));r.set(s,l);e.head.appendChild(t)}return l}}};s().then((e=>{o();return i(JSON.parse('[["p-dfd1d63d",[[1,"vertex-scene-tree",{"overScanCount":[2,"over-scan-count"],"viewerSelector":[1,"viewer-selector"],"viewer":[1040],"rowData":[16],"config":[1],"configEnv":[1,"config-env"],"controller":[1040],"searchOptions":[1040],"metadataSearchExactMatch":[1028,"metadata-search-exact-match"],"metadataSearchKeys":[1040],"metadataKeys":[16],"operationAnimationDuration":[2,"operation-animation-duration"],"rows":[32],"totalRows":[32],"showLoader":[32],"showEmptyResults":[32],"stateMap":[32],"errorDetails":[32],"hasPartialFilterResults":[32],"refreshingResults":[32],"attemptingRetry":[32],"invalidateRows":[64],"scrollToIndex":[64],"scrollToItem":[64],"expandAll":[64],"collapseAll":[64],"expandItem":[64],"collapseItem":[64],"toggleExpandItem":[64],"toggleItemVisibility":[64],"hideItem":[64],"showItem":[64],"selectItem":[64],"deselectItem":[64],"isolateItem":[64],"getRowAtIndex":[64],"getRowForEvent":[64],"getRowAtClientY":[64],"filterItems":[64],"selectFilteredItems":[64],"fetchMetadataKeys":[64]},[[0,"search","handleSearch"],[0,"cellLoaded","handleCellLoaded"]]]]],["p-401ada4a",[[1,"vertex-viewer-pin-tool",{"pinController":[1040],"pinModel":[16],"viewer":[16],"tool":[1025],"mode":[1025],"primaryColor":[1025,"primary-color"],"accentColor":[1025,"accent-color"],"pins":[32],"selectedPinId":[32],"elementBounds":[32],"projectionViewMatrix":[32]}]]],["p-d033f5c0",[[1,"vertex-viewer-default-toolbar",{"viewer":[16],"placement":[1],"direction":[1],"animationsDisabled":[4,"animations-disabled"],"animationMs":[2,"animation-ms"]}]]],["p-ed588e0b",[[1,"vertex-viewer-markup",{"arrowTemplateId":[1,"arrow-template-id"],"circleTemplateId":[1,"circle-template-id"],"freeformTemplateId":[1,"freeform-template-id"],"tool":[1],"disabled":[4],"viewer":[16],"selectedMarkupId":[1025,"selected-markup-id"],"selectNew":[4,"select-new"],"startLineAnchorStyle":[1025,"start-line-anchor-style"],"endLineAnchorStyle":[1025,"end-line-anchor-style"],"toSelectMarkupId":[32],"pointerDownPosition":[32],"addMarkup":[64],"removeMarkup":[64],"getMarkupElements":[64],"getMarkupElement":[64]},[[0,"markupEnd","handleMarkupEnd"],[0,"interactionEnd","handleMarkupUpdated"],[1,"pointerdown","handleMarkupPointerDown"]]]]],["p-4f2a88a2",[[1,"vertex-viewer-markup-tool",{"arrowTemplateId":[1,"arrow-template-id"],"circleTemplateId":[1,"circle-template-id"],"freeformTemplateId":[1,"freeform-template-id"],"tool":[1],"disabled":[4],"viewer":[16],"startLineAnchorStyle":[1025,"start-line-anchor-style"],"endLineAnchorStyle":[1025,"end-line-anchor-style"],"stateMap":[32],"reset":[64]}]]],["p-45d50f00",[[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]}]]],["p-14765f2d",[[1,"vertex-viewer-measurement-distance",{"start":[1040],"startJson":[1,"start-json"],"end":[1040],"endJson":[1,"end-json"],"distance":[1026],"showAxisReferenceLines":[4,"show-axis-reference-lines"],"snapDistance":[2,"snap-distance"],"units":[1],"fractionalDigits":[2,"fractional-digits"],"labelFormatter":[16],"anchorLabelOffset":[2,"anchor-label-offset"],"lineCapLength":[2,"line-cap-length"],"mode":[513],"interactingAnchor":[1537,"interacting-anchor"],"invalid":[1540],"camera":[16],"hitProvider":[16],"indicatorPt":[1040],"viewer":[16],"measurementModel":[16],"viewport":[32],"elementBounds":[32],"interactionCount":[32],"internalCamera":[32],"invalidateStateCounter":[32],"stateMap":[32],"measurementUnits":[32],"computeElementMetrics":[64]}]]],["p-d3bcde8b",[[1,"vertex-viewer-measurement-precise",{"measurementModel":[16],"measurementOverlays":[16],"measurementController":[1040],"measurableEntityTypes":[16],"viewer":[16],"configEnv":[1,"config-env"],"config":[1]}]]],["p-d002487d",[[1,"vertex-scene-tree-table-cell",{"node":[16],"tree":[16],"value":[1],"placeholder":[1],"alwaysShowIcons":[4,"always-show-icons"],"hovered":[1028],"isScrolling":[4,"is-scrolling"],"expandToggle":[4,"expand-toggle"],"endItemIndicator":[4,"end-item-indicator"],"visibilityToggle":[4,"visibility-toggle"],"isolateButton":[4,"isolate-button"],"selectionHandler":[16],"visibilityHandler":[16],"expansionHandler":[16],"isolateHandler":[16],"hoverController":[16]}]]],["p-6b59ac9d",[[1,"vertex-viewer-annotation-callout",{"data":[16],"iconSize":[1,"icon-size"]}]]],["p-aa5bf24d",[[1,"vertex-viewer-box-query-tool",{"viewer":[16],"controller":[1040],"model":[1040],"operationType":[1,"operation-type"],"mode":[1],"details":[32]}]]],["p-1172e584",[[1,"vertex-viewer-walk-mode-tool",{"viewer":[16],"controller":[1040],"model":[1040],"teleportMode":[1,"teleport-mode"],"enabled":[4]}]]],["p-0f819542",[[1,"vertex-scene-tree-table-column",{"initialWidth":[2,"initial-width"],"minWidth":[2,"min-width"],"maxWidth":[2,"max-width"]}]]],["p-69bcb9d0",[[1,"vertex-scene-tree-table-header"]]],["p-46e1dccd",[[1,"vertex-scene-tree-table-resize-divider",{"hovering":[32],"dragging":[32]}]]],["p-d8725e77",[[1,"vertex-scene-tree-toolbar-group"]]],["p-d2ddc770",[[1,"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],"featureMaps":[1,"feature-maps"],"resizeDebounce":[2,"resize-debounce"],"frame":[1040],"stream":[1040],"stencilBuffer":[1040],"viewport":[1040],"annotations":[1040],"modelViews":[1040],"pmi":[1040],"sceneItems":[1040],"dimensions":[32],"hostDimensions":[32],"errorMessage":[32],"cursor":[32],"stateMap":[32],"dispatchFrameDrawn":[64],"registerInteractionHandler":[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"]]]]],["p-07d2b2fa",[[1,"vertex-viewer-hit-result-indicator",{"viewer":[16],"position":[1040],"normal":[1040]}]]],["p-aea58f94",[[1,"vertex-viewer-measurement-details",{"measurementModel":[16],"measurementOverlays":[16],"measurementOutcome":[1040],"distanceUnits":[1,"distance-units"],"angleUnits":[1,"angle-units"],"fractionalDigits":[2,"fractional-digits"],"distanceFormatter":[16],"angleFormatter":[16],"areaFormatter":[16],"resultTypes":[16],"overlay":[32],"distanceMeasurementUnits":[32],"angleMeasurementUnits":[32],"areaMeasurementUnits":[32]}]]],["p-9c4fc8bd",[[1,"vertex-viewer-transform-widget",{"viewer":[16],"position":[1040],"rotation":[1040],"controller":[1040],"xRotationDisabled":[1028,"x-rotation-disabled"],"yRotationDisabled":[1028,"y-rotation-disabled"],"zRotationDisabled":[1028,"z-rotation-disabled"],"xTranslationDisabled":[1028,"x-translation-disabled"],"yTranslationDisabled":[1028,"y-translation-disabled"],"zTranslationDisabled":[1028,"z-translation-disabled"],"showInputs":[4,"show-inputs"],"distanceUnit":[1,"distance-unit"],"angleUnit":[1,"angle-unit"],"decimalPlaces":[2,"decimal-places"],"EXPERIMENTAL_undoKeybindings":[4,"e-x-p-e-r-i-m-e-n-t-a-l_undo-keybindings"],"hovered":[1040],"inputPosition":[32],"inputValue":[32],"isEndingTransform":[32],"inputShouldFocus":[32],"EXPERIMENTAL_undo":[64]}]]],["p-84d1293d",[[0,"vertex-viewer-pin-group",{"pin":[16],"matrix":[1040],"projectionViewMatrix":[16],"elementBounds":[1040],"pinModel":[16],"pinController":[16],"selected":[4],"occluded":[1540],"detached":[1540],"invalidateStateCounter":[32]},[[0,"occlusionStateChanged","handleOcclusionStateChanged"],[0,"detachedStateChanged","handleDetachedStateChanged"]]]]],["p-4f471068",[[6,"vertex-viewer-dom-group",{"position":[1040],"positionJson":[1,"position"],"rotation":[1040],"rotationJson":[1,"rotation"],"quaternion":[1040],"quaternionJson":[1,"quaternion"],"scale":[1040],"scaleJson":[1,"scale"],"matrix":[1040]}]]],["p-a33042f5",[[1,"vertex-viewer-teleport-tool",{"viewer":[16],"mode":[1025],"animationsDisabled":[4,"animations-disabled"],"animationMs":[2,"animation-ms"],"controller":[1040],"model":[1040]}]]],["p-6567e0ac",[[1,"vertex-viewer-spinner",{"size":[1]}]]],["p-7ce3a971",[[1,"vertex-viewer-layer",{"stretchOff":[516,"stretch-off"]}]]],["p-1d6f074a",[[1,"vertex-viewer-toolbar",{"placement":[1],"direction":[1]}],[1,"vertex-viewer-button"],[1,"vertex-viewer-toolbar-group",{"direction":[1]}]]],["p-dd508107",[[1,"vertex-scene-tree-search",{"debounce":[2],"disabled":[4],"placeholder":[1],"controller":[16],"value":[1025],"focused":[32],"isSearching":[32],"setFocus":[64],"clear":[64]}],[1,"vertex-scene-tree-notification-banner",{"message":[1],"actionLabel":[1,"action-label"]}],[1,"vertex-scene-tree-table-layout",{"tree":[16],"controller":[16],"rows":[16],"totalRows":[2,"total-rows"],"rowHeight":[1026,"row-height"],"overScanCount":[2,"over-scan-count"],"rowData":[16],"layoutOffset":[1026,"layout-offset"],"scrollOffset":[1026,"scroll-offset"],"layoutHeight":[1026,"layout-height"],"layoutWidth":[1026,"layout-width"],"viewportStartIndex":[1026,"viewport-start-index"],"viewportEndIndex":[1026,"viewport-end-index"],"columnGridLayout":[32],"columnGridFixedLayout":[32],"isComputingCellHeight":[32],"lastDividerPointerPosition":[32],"resizingColumnIndex":[32],"isScrolling":[32],"scrollTimer":[32],"stateMap":[32],"scrollToPosition":[64]}],[1,"vertex-scene-tree-toolbar"]]],["p-aa9ee8a2",[[0,"vertex-viewer-pin-label",{"pin":[16],"elementBounds":[16],"value":[1025],"pinController":[16],"focused":[32],"computedScreenPosition":[32],"textareaRows":[32],"contentElBounds":[32],"setFocus":[64],"submit":[64]}],[0,"vertex-viewer-pin-label-line",{"pinPoint":[16],"labelPoint":[16],"pin":[16]}]]],["p-3d2f313d",[[1,"vertex-viewer-measurement-overlays",{"measurementOverlays":[16],"camera":[1040],"viewer":[16],"overlays":[32]}],[1,"vertex-viewer-measurement-line",{"start":[16],"end":[16],"capLength":[2,"cap-length"],"pointerEvents":[1,"pointer-events"]}]]],["p-be3a5b20",[[6,"vertex-viewer-dom-renderer",{"drawMode":[1,"draw-mode"],"propagateEventsToViewer":[4,"propagate-events-to-viewer"],"viewer":[16],"camera":[1040],"depthBuffer":[1040],"viewport":[32],"invalidateFrameCounter":[32],"interactionDisposables":[32]},[[0,"propertyChange","handlePropertyChange"]]],[1,"vertex-viewer-dom-element",{"position":[1040],"positionJson":[1,"position"],"rotation":[1040],"rotationJson":[1,"rotation"],"quaternion":[1040],"quaternionJson":[1,"quaternion"],"scale":[1040],"scaleJson":[1,"scale"],"matrix":[1040],"occlusionOff":[4,"occlusion-off"],"occluded":[516],"detachedOff":[4,"detached-off"],"detached":[516],"billboardOff":[4,"billboard-off"],"interactionsOff":[516,"interactions-off"]}]]],["p-b6aee220",[[1,"vertex-viewer-markup-arrow",{"start":[1040],"startJson":[1,"start"],"end":[1040],"endJson":[1,"end"],"startLineAnchorStyle":[1025,"start-line-anchor-style"],"endLineAnchorStyle":[1025,"end-line-anchor-style"],"mode":[513],"viewer":[16],"elementBounds":[32],"dispose":[64]}],[1,"vertex-viewer-markup-circle",{"bounds":[1040],"boundsJson":[1,"bounds"],"mode":[513],"viewer":[16],"elementBounds":[32],"dispose":[64]}],[1,"vertex-viewer-markup-freeform",{"points":[1040],"pointsJson":[1,"points"],"bounds":[1040],"boundsJson":[1,"bounds"],"mode":[513],"viewer":[16],"elementBounds":[32],"screenPoints":[32],"dispose":[64]}]]],["p-9134656a",[[1,"vertex-viewer-icon",{"name":[1],"size":[1]}]]]]'),e)}));
|
|
4
|
+
import{d as e,N as t,w as n,p as a,b as i}from"./p-6685b50e.js";import{g as o}from"./p-70a6c9eb.js";import"./p-bcce32b5.js";const r=e=>`__sc_import_${e.replace(/\s|-/g,"_")}`;const s=()=>{const i=Array.from(e.querySelectorAll("script")).find((e=>new RegExp(`/${t}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===t));const o="";const r={};if(o!==""){r.resourcesUrl=new URL(".",o).href}else{r.resourcesUrl=new URL(".",new URL(i.getAttribute("data-resources-url")||i.src,n.location.href)).href;{l(r.resourcesUrl,i)}if(!n.customElements){return __sc_import_viewer("./p-4e5c5637.js").then((()=>r))}}return a(r)};const l=(a,i)=>{const o=r(t);try{n[o]=new Function("w",`return import(w);//${Math.random()}`)}catch(t){const r=new Map;n[o]=t=>{const s=new URL(t,a).href;let l=r.get(s);if(!l){const t=e.createElement("script");t.type="module";t.crossOrigin=i.crossOrigin;t.src=URL.createObjectURL(new Blob([`import * as m from '${s}'; window.${o}.m = m;`],{type:"application/javascript"}));l=new Promise((e=>{t.onload=()=>{e(n[o].m);t.remove()}}));r.set(s,l);e.head.appendChild(t)}return l}}};s().then((e=>{o();return i(JSON.parse('[["p-dfd1d63d",[[1,"vertex-scene-tree",{"overScanCount":[2,"over-scan-count"],"viewerSelector":[1,"viewer-selector"],"viewer":[1040],"rowData":[16],"config":[1],"configEnv":[1,"config-env"],"controller":[1040],"searchOptions":[1040],"metadataSearchExactMatch":[1028,"metadata-search-exact-match"],"metadataSearchKeys":[1040],"metadataKeys":[16],"operationAnimationDuration":[2,"operation-animation-duration"],"rows":[32],"totalRows":[32],"showLoader":[32],"showEmptyResults":[32],"stateMap":[32],"errorDetails":[32],"hasPartialFilterResults":[32],"refreshingResults":[32],"attemptingRetry":[32],"invalidateRows":[64],"scrollToIndex":[64],"scrollToItem":[64],"expandAll":[64],"collapseAll":[64],"expandItem":[64],"collapseItem":[64],"toggleExpandItem":[64],"toggleItemVisibility":[64],"hideItem":[64],"showItem":[64],"selectItem":[64],"deselectItem":[64],"isolateItem":[64],"getRowAtIndex":[64],"getRowForEvent":[64],"getRowAtClientY":[64],"filterItems":[64],"selectFilteredItems":[64],"fetchMetadataKeys":[64]},[[0,"search","handleSearch"],[0,"cellLoaded","handleCellLoaded"]]]]],["p-82a0dcb2",[[1,"vertex-viewer-pin-tool",{"pinController":[1040],"pinModel":[16],"viewer":[16],"tool":[1025],"mode":[1025],"primaryColor":[1025,"primary-color"],"accentColor":[1025,"accent-color"],"pins":[32],"selectedPinId":[32],"elementBounds":[32],"projectionViewMatrix":[32]}]]],["p-d033f5c0",[[1,"vertex-viewer-default-toolbar",{"viewer":[16],"placement":[1],"direction":[1],"animationsDisabled":[4,"animations-disabled"],"animationMs":[2,"animation-ms"]}]]],["p-ed588e0b",[[1,"vertex-viewer-markup",{"arrowTemplateId":[1,"arrow-template-id"],"circleTemplateId":[1,"circle-template-id"],"freeformTemplateId":[1,"freeform-template-id"],"tool":[1],"disabled":[4],"viewer":[16],"selectedMarkupId":[1025,"selected-markup-id"],"selectNew":[4,"select-new"],"startLineAnchorStyle":[1025,"start-line-anchor-style"],"endLineAnchorStyle":[1025,"end-line-anchor-style"],"toSelectMarkupId":[32],"pointerDownPosition":[32],"addMarkup":[64],"removeMarkup":[64],"getMarkupElements":[64],"getMarkupElement":[64]},[[0,"markupEnd","handleMarkupEnd"],[0,"interactionEnd","handleMarkupUpdated"],[1,"pointerdown","handleMarkupPointerDown"]]]]],["p-4f2a88a2",[[1,"vertex-viewer-markup-tool",{"arrowTemplateId":[1,"arrow-template-id"],"circleTemplateId":[1,"circle-template-id"],"freeformTemplateId":[1,"freeform-template-id"],"tool":[1],"disabled":[4],"viewer":[16],"startLineAnchorStyle":[1025,"start-line-anchor-style"],"endLineAnchorStyle":[1025,"end-line-anchor-style"],"stateMap":[32],"reset":[64]}]]],["p-45d50f00",[[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]}]]],["p-af7987b2",[[1,"vertex-viewer-measurement-distance",{"start":[1040],"startJson":[1,"start-json"],"end":[1040],"endJson":[1,"end-json"],"distance":[1026],"showAxisReferenceLines":[4,"show-axis-reference-lines"],"snapDistance":[2,"snap-distance"],"units":[1],"fractionalDigits":[2,"fractional-digits"],"labelFormatter":[16],"anchorLabelOffset":[2,"anchor-label-offset"],"lineCapLength":[2,"line-cap-length"],"mode":[513],"interactingAnchor":[1537,"interacting-anchor"],"invalid":[1540],"camera":[16],"hitProvider":[16],"indicatorPt":[1040],"viewer":[16],"measurementModel":[16],"viewport":[32],"elementBounds":[32],"interactionCount":[32],"internalCamera":[32],"invalidateStateCounter":[32],"stateMap":[32],"measurementUnits":[32],"computeElementMetrics":[64]}]]],["p-6f1ed862",[[1,"vertex-viewer-measurement-precise",{"measurementModel":[16],"measurementOverlays":[16],"measurementController":[1040],"measurableEntityTypes":[16],"viewer":[16],"configEnv":[1,"config-env"],"config":[1]}]]],["p-d002487d",[[1,"vertex-scene-tree-table-cell",{"node":[16],"tree":[16],"value":[1],"placeholder":[1],"alwaysShowIcons":[4,"always-show-icons"],"hovered":[1028],"isScrolling":[4,"is-scrolling"],"expandToggle":[4,"expand-toggle"],"endItemIndicator":[4,"end-item-indicator"],"visibilityToggle":[4,"visibility-toggle"],"isolateButton":[4,"isolate-button"],"selectionHandler":[16],"visibilityHandler":[16],"expansionHandler":[16],"isolateHandler":[16],"hoverController":[16]}]]],["p-6b59ac9d",[[1,"vertex-viewer-annotation-callout",{"data":[16],"iconSize":[1,"icon-size"]}]]],["p-cd746316",[[1,"vertex-viewer-box-query-tool",{"viewer":[16],"controller":[1040],"model":[1040],"operationType":[1,"operation-type"],"mode":[1],"details":[32]}]]],["p-1172e584",[[1,"vertex-viewer-walk-mode-tool",{"viewer":[16],"controller":[1040],"model":[1040],"teleportMode":[1,"teleport-mode"],"enabled":[4]}]]],["p-0f819542",[[1,"vertex-scene-tree-table-column",{"initialWidth":[2,"initial-width"],"minWidth":[2,"min-width"],"maxWidth":[2,"max-width"]}]]],["p-69bcb9d0",[[1,"vertex-scene-tree-table-header"]]],["p-46e1dccd",[[1,"vertex-scene-tree-table-resize-divider",{"hovering":[32],"dragging":[32]}]]],["p-d8725e77",[[1,"vertex-scene-tree-toolbar-group"]]],["p-caaf5f09",[[1,"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],"featureMaps":[1,"feature-maps"],"resizeDebounce":[2,"resize-debounce"],"frame":[1040],"stream":[1040],"stencilBuffer":[1040],"viewport":[1040],"annotations":[1040],"modelViews":[1040],"pmi":[1040],"sceneItems":[1040],"dimensions":[32],"hostDimensions":[32],"errorMessage":[32],"cursor":[32],"stateMap":[32],"dispatchFrameDrawn":[64],"registerInteractionHandler":[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"]]]]],["p-07d2b2fa",[[1,"vertex-viewer-hit-result-indicator",{"viewer":[16],"position":[1040],"normal":[1040]}]]],["p-aea58f94",[[1,"vertex-viewer-measurement-details",{"measurementModel":[16],"measurementOverlays":[16],"measurementOutcome":[1040],"distanceUnits":[1,"distance-units"],"angleUnits":[1,"angle-units"],"fractionalDigits":[2,"fractional-digits"],"distanceFormatter":[16],"angleFormatter":[16],"areaFormatter":[16],"resultTypes":[16],"overlay":[32],"distanceMeasurementUnits":[32],"angleMeasurementUnits":[32],"areaMeasurementUnits":[32]}]]],["p-9c4fc8bd",[[1,"vertex-viewer-transform-widget",{"viewer":[16],"position":[1040],"rotation":[1040],"controller":[1040],"xRotationDisabled":[1028,"x-rotation-disabled"],"yRotationDisabled":[1028,"y-rotation-disabled"],"zRotationDisabled":[1028,"z-rotation-disabled"],"xTranslationDisabled":[1028,"x-translation-disabled"],"yTranslationDisabled":[1028,"y-translation-disabled"],"zTranslationDisabled":[1028,"z-translation-disabled"],"showInputs":[4,"show-inputs"],"distanceUnit":[1,"distance-unit"],"angleUnit":[1,"angle-unit"],"decimalPlaces":[2,"decimal-places"],"EXPERIMENTAL_undoKeybindings":[4,"e-x-p-e-r-i-m-e-n-t-a-l_undo-keybindings"],"hovered":[1040],"inputPosition":[32],"inputValue":[32],"isEndingTransform":[32],"inputShouldFocus":[32],"EXPERIMENTAL_undo":[64]}]]],["p-c878e4ac",[[0,"vertex-viewer-pin-group",{"pin":[16],"matrix":[1040],"projectionViewMatrix":[16],"elementBounds":[1040],"pinModel":[16],"pinController":[16],"selected":[4],"occluded":[1540],"detached":[1540],"invalidateStateCounter":[32]},[[0,"occlusionStateChanged","handleOcclusionStateChanged"],[0,"detachedStateChanged","handleDetachedStateChanged"]]]]],["p-4f471068",[[6,"vertex-viewer-dom-group",{"position":[1040],"positionJson":[1,"position"],"rotation":[1040],"rotationJson":[1,"rotation"],"quaternion":[1040],"quaternionJson":[1,"quaternion"],"scale":[1040],"scaleJson":[1,"scale"],"matrix":[1040]}]]],["p-a33042f5",[[1,"vertex-viewer-teleport-tool",{"viewer":[16],"mode":[1025],"animationsDisabled":[4,"animations-disabled"],"animationMs":[2,"animation-ms"],"controller":[1040],"model":[1040]}]]],["p-6567e0ac",[[1,"vertex-viewer-spinner",{"size":[1]}]]],["p-7ce3a971",[[1,"vertex-viewer-layer",{"stretchOff":[516,"stretch-off"]}]]],["p-1d6f074a",[[1,"vertex-viewer-toolbar",{"placement":[1],"direction":[1]}],[1,"vertex-viewer-button"],[1,"vertex-viewer-toolbar-group",{"direction":[1]}]]],["p-dd508107",[[1,"vertex-scene-tree-search",{"debounce":[2],"disabled":[4],"placeholder":[1],"controller":[16],"value":[1025],"focused":[32],"isSearching":[32],"setFocus":[64],"clear":[64]}],[1,"vertex-scene-tree-notification-banner",{"message":[1],"actionLabel":[1,"action-label"]}],[1,"vertex-scene-tree-table-layout",{"tree":[16],"controller":[16],"rows":[16],"totalRows":[2,"total-rows"],"rowHeight":[1026,"row-height"],"overScanCount":[2,"over-scan-count"],"rowData":[16],"layoutOffset":[1026,"layout-offset"],"scrollOffset":[1026,"scroll-offset"],"layoutHeight":[1026,"layout-height"],"layoutWidth":[1026,"layout-width"],"viewportStartIndex":[1026,"viewport-start-index"],"viewportEndIndex":[1026,"viewport-end-index"],"columnGridLayout":[32],"columnGridFixedLayout":[32],"isComputingCellHeight":[32],"lastDividerPointerPosition":[32],"resizingColumnIndex":[32],"isScrolling":[32],"scrollTimer":[32],"stateMap":[32],"scrollToPosition":[64]}],[1,"vertex-scene-tree-toolbar"]]],["p-aa9ee8a2",[[0,"vertex-viewer-pin-label",{"pin":[16],"elementBounds":[16],"value":[1025],"pinController":[16],"focused":[32],"computedScreenPosition":[32],"textareaRows":[32],"contentElBounds":[32],"setFocus":[64],"submit":[64]}],[0,"vertex-viewer-pin-label-line",{"pinPoint":[16],"labelPoint":[16],"pin":[16]}]]],["p-3d2f313d",[[1,"vertex-viewer-measurement-overlays",{"measurementOverlays":[16],"camera":[1040],"viewer":[16],"overlays":[32]}],[1,"vertex-viewer-measurement-line",{"start":[16],"end":[16],"capLength":[2,"cap-length"],"pointerEvents":[1,"pointer-events"]}]]],["p-be3a5b20",[[6,"vertex-viewer-dom-renderer",{"drawMode":[1,"draw-mode"],"propagateEventsToViewer":[4,"propagate-events-to-viewer"],"viewer":[16],"camera":[1040],"depthBuffer":[1040],"viewport":[32],"invalidateFrameCounter":[32],"interactionDisposables":[32]},[[0,"propertyChange","handlePropertyChange"]]],[1,"vertex-viewer-dom-element",{"position":[1040],"positionJson":[1,"position"],"rotation":[1040],"rotationJson":[1,"rotation"],"quaternion":[1040],"quaternionJson":[1,"quaternion"],"scale":[1040],"scaleJson":[1,"scale"],"matrix":[1040],"occlusionOff":[4,"occlusion-off"],"occluded":[516],"detachedOff":[4,"detached-off"],"detached":[516],"billboardOff":[4,"billboard-off"],"interactionsOff":[516,"interactions-off"]}]]],["p-b6aee220",[[1,"vertex-viewer-markup-arrow",{"start":[1040],"startJson":[1,"start"],"end":[1040],"endJson":[1,"end"],"startLineAnchorStyle":[1025,"start-line-anchor-style"],"endLineAnchorStyle":[1025,"end-line-anchor-style"],"mode":[513],"viewer":[16],"elementBounds":[32],"dispose":[64]}],[1,"vertex-viewer-markup-circle",{"bounds":[1040],"boundsJson":[1,"bounds"],"mode":[513],"viewer":[16],"elementBounds":[32],"dispose":[64]}],[1,"vertex-viewer-markup-freeform",{"points":[1040],"pointsJson":[1,"points"],"bounds":[1040],"boundsJson":[1,"bounds"],"mode":[513],"viewer":[16],"elementBounds":[32],"screenPoints":[32],"dispose":[64]}]]],["p-9134656a",[[1,"vertex-viewer-icon",{"name":[1],"size":[1]}]]]]'),e)}));
|
|
5
5
|
//# sourceMappingURL=viewer.esm.js.map
|