1(()=>{(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6085],{50938:function(J,B,e){"use strict";e.d(B,{Z:function(){return o}});var t=e(32092),i=e(51282),l=e(95497);function o(M,T,m,A){const y=m.getBestViewOfPosition(T,A);if(!y)return;const _=t.Z.inverseTransformation(y.cameraToEcefTransform,new t.Z),D=t.Z.multiplyByPoint(_,T,new i.Z),v=-Math.atan2(D.x,D.z),n=-Math.atan2(D.y,D.z);M((0,l.Mn)(v,n)),M((0,l._l)(y.imageTimestamp,!1)),M((0,l.kW)(y.cameraName))}},35113:function(J,B,e){"use strict";e.d(B,{Nv:function(){return p},zX:function(){return C},yL:function(){return P},cy:function(){return g},tq:function(){return h},KS:function(){return Z}});var t=e(10081),i=e(51282),l=e(82615),o=e(66435),M=e(94282),T=e(56223),m=e(29931),A=e(82039),y=e(91681),_=e(56949),D=e(74588),v=e(51450);function n(){const R=(0,A.TL)(),a=(0,v.ug)(),f=(0,M.ng)(),I=(0,y.jk)(x=>!!x.crossSection);return(0,T.useCallback)(x=>{if(!(!I||x.layerType!=="object"||typeof x.key!="string"))try{const b=a.getFeatureById(x.key);if(b&&b.__typename==="ObjectAnnotation"){var L;const N=(L=f.trajectories[b.projectFileId])===null||L===void 0?void 0:L.visualizationMapping;if(N){const U=(0,D._H)(b,N),j=(0,_.w)(U);j&&(R((0,y.dA)(j)),R((0,y.kN)(j.depth)))}}}catch{}},[R,a,f,I])}var E=e(95497),u=e(63410),c=e(50938);function d(R,a,f){return new Promise((I,x)=>{R.flyToBoundingSphere(a,{duration:f.duration,offset:f.offset,complete:()=>{I(!0)},cancel:()=>{I(!1)}})})}class r{addSelectableFunction(a){this.selectableFunctions.push(a),this.notifyFlightReadinessChanged()}removeSelectableFunction(a){this.selectableFunctions=this.selectableFunctions.filter(f=>f!==a),this.notifyFlightReadinessChanged()}setCamera(a){const f=this.isCameraReady();this.camera=a;const I=this.isCameraReady();f!==I&&this.notifyFlightReadinessChanged()}subscribeToFlightReadiness(a){return this.flightReadinessSubscribers.add(a),()=>this.flightReadinessSubscribers.delete(a)}notifyFlightReadinessChanged(){this.flightReadinessSubscribers.forEach(a=>a())}isCameraReady(){return this.camera!==null&&this.canCameraFlyAround}canFlyTo(a){return this.isCameraReady()?this.selectableFunctions.some(f=>f(a)!==null):!1}setTrajectory(a){this.currentTrajectory=a}setCanCameraFlyAround(a){const f=this.isCameraReady();this.canCameraFlyAround=a;const I=this.isCameraReady();this.isFlightInProgress&&!a&&this.camera&&this.camera.cancelFlight(),f!==I&&this.notifyFlightReadinessChanged()}async flyTo(a,f){if(!this.camera)return;let I=null;for(const x of Object.values(this.selectableFunctions)){const L=x(a);if(L){I=L;break}}if(I&&(this.isFlightInProgress&&this.camera.cancelFlight(),this.isFlightInProgress=!0,this.currentTrajectory&&(0,c.Z)(this.dispatch,I.center,this.currentTrajectory,I.frontFace?i.Z.negate(I.frontFace,new i.Z):void 0),this.canCameraFlyAround)){const L=f??3,N=Math.max(I.radius*a.zoomDistanceMultiplier(),10),U=await d(this.camera,I,{duration:L,offset:new l.Z(0,this.isPlanView?-Math.PI/2:-.5,N)});this.isPlanView&&this.camera.frustum instanceof o.Z&&(this.camera.frustum.near=.1,this.camera.frustum.width=N),U&&(this.isFlightInProgress=!1)}}constructor(a){this.camera=null,this.selectableFunctions=[],this.currentTrajectory=null,this.canCameraFlyAround=!1,this.isPlanView=!1,this.isFlightInProgress=!1,this.flightReadinessSubscribers=new Set,this.dispatch=a}}const s=(0,T.createContext)(null);function C(R){const a=(0,A.TL)(),f=(0,T.useMemo)(()=>new r(a),[a]),I=(0,E.hV)(),x=!(0,u.Ox)(N=>N.kind==="object-view"||N.kind==="line-view"),L=(0,u.Ox)(N=>N.kind==="plan-view");(0,T.useEffect)(()=>{f&&(f.setCanCameraFlyAround(I&&x),f.isPlanView=L)},[I,x,f,L]);const b=(0,M._Z)();return(0,T.useEffect)(()=>{f&&f.setTrajectory(b)},[b,f]),(0,t.jsx)(s.Provider,{value:f,children:R.children})}function p(){const{camera:R}=(0,m.VQ)(),a=g();return(0,T.useEffect)(()=>{a&&a.setCamera(R??null)},[R,a]),null}function g(){return(0,T.useContext)(s)}function P(R){const a=g();(0,T.useEffect)(()=>{if(a)return a.addSelectableFunction(R),()=>{a.removeSelectableFunction(R)}},[R,a])}function h(){const R=g(),a=n();return(0,T.useCallback)(async(f,I)=>{a(f),await R?.flyTo(f,I)},[R,a])}function O(){const R=g();return useCallback(a=>a&&R?.selectableFunctions?R.selectableFunctions.some(f=>f(a)!==null):!1,[R?.selectableFunctions])}function Z(R){const a=g();(0,T.useEffect)(()=>
1{if(a)return a.subscribeToFlightReadiness(R)},[a,R])}},88209:function(J,B,e){"use strict";e.d(B,{Oc:function(){return P},Pc:function(){return u},c:function(){return c}});var t=e(10081),i=e(514),l=e(8585),o=e(7943),M=e(89932),T=e(56223),m=e(82039),A=e(76146),y=e(15421),_=e.n(y),D=e(63410),v=e(91681),n=e(65117),E=e(15810);const u=.01,c=2;function d(){const h=(0,m.TL)(),O=(0,v.jk)(f=>f.crossSection),Z=(0,v.tD)(),R=(0,n.ib)(),a=[.01,.25,1].map(f=>(0,M.BI)(f,R,"m",3));return O?(0,t.jsxs)("div",{className:"flex h-full flex-col",children:[(0,t.jsx)(r,{}),(0,t.jsx)(i.FormGroup,{label:"Cross section depth (".concat(R,")"),children:(0,t.jsx)(o.q,{min:(0,M.BI)(u,R,"m",3),max:(0,M.BI)(c,R,"m",3),initialValue:(0,M.BI)(Z,R,"m",3),onChange:f=>(h((0,v.kN)((0,M.BI)(f,"m",R))),f),stepPercentage:.02,labelValueOverrides:a})}),(0,t.jsx)("div",{style:{marginTop:"auto"}}),(0,t.jsx)(i.Button,{onClick:()=>{h((0,v.dA)(null))},text:"Exit Cross Section",intent:"primary"})]}):null}function r(){const h=(0,v.UA)();return(0,t.jsxs)("div",{className:"mb-2 flex items-center",children:[(0,t.jsx)("div",{className:"mr-2 text-body-small text-text",children:"Orientation"}),(0,t.jsxs)("div",{className:"flex items-center justify-center",children:[(0,t.jsx)(s,{direction:"decrement"}),(0,t.jsxs)("div",{className:"mx-2 grid min-w-5 place-items-center text-body-small text-text",children:[h,"\xB0"]}),(0,t.jsx)(s,{direction:"increment"})]})]})}function s(h){let{direction:O}=h;const Z=(0,m.TL)(),R=(0,v.UA)(),a=O==="increment"?(R+90)%360:(R-90+360)%360,f=O==="increment"?"/assets/images/rotate-cw.svg":"/assets/images/rotate-ccw.svg",I=O==="increment"?"Rotate counterclockwise":"Rotate clockwise",x=(0,T.useCallback)(()=>{Z(O==="increment"?(0,v.c8)():(0,v.XG)())},[O,Z]);return(0,t.jsx)(l.u,{content:"Rotate to ".concat(a,"\xB0"),placement:"top",children:(0,t.jsx)(i.Button,{className:"w-5 p-0",onClick:x,children:(0,t.jsx)("img",{src:f,alt:I,height:16,width:16})})})}function C(h){const O=(0,m.TL)(),Z=(0,T.useCallback)(()=>{O((0,v.dA)(null))},[O]);return(0,t.jsx)(i.Button,{minimal:!0,icon:"cross",onClick:Z,disabled:h.disabled,title:h.disabled?"Cannot close cross section info box while in cross section mode":"Close"})}const p=(0,T.forwardRef)((h,O)=>{const R=(0,E.Qq)()==="horizontal"?(0,t.jsx)("img",{src:"/assets/images/horizontal-view.svg",alt:"Swap to Vertical",height:16,width:16}):(0,t.jsx)("img",{src:"/assets/images/vertical-view.svg",alt:"Swap to Horizontal",height:16,width:16}),a=(0,m.TL)();return(0,t.jsxs)("div",{className:_().header,ref:O,children:[(0,t.jsx)("div",{className:_().title,children:h.title}),(0,t.jsx)(i.Button,{icon:R,minimal:!0,onClick:()=>{a((0,E.Zg)())}}),(0,t.jsxs)("div",{className:_().actions,children:[(0,t.jsx)(i.Button,{minimal:!0,icon:h.isMinimized?"expand-all":"minus",onClick:h.onMinimize}),(0,t.jsx)(C,{})]})]})});p.displayName="CrossSectionInfoBoxHeader";function g(h){const[O,Z]=(0,T.useState)(!1),R=(0,v.jk)(f=>f.crossSection!==null),a="Cross Section Info";return R?(0,t.jsxs)("div",{className:_().detailBox,ref:f=>{h.previewRef(f)},children:[(0,t.jsx)(p,{title:a,isMinimized:O,onMinimize:()=>{Z(!O)},ref:f=>{h.dragRef(f)}}),(0,t.jsx)("div",{className:_().boxScrollOuter,style:{backgroundColor:"#293742"},children:(0,t.jsx)("div",{className:_().detailBoxContents,style:{height:O?0:h.height,display:O?"none":void 0},children:(0,t.jsx)(d,{})})})]}):null}function P(h){const O=(0,D.hh)();return(0,t.jsx)(A.DV,{initialBottom:O?30:10,initialLeft:370,children:(Z,R)=>(0,t.jsx)(g,{previewRef:Z,dragRef:R,height:h.height})})}},11132:function(J,B,e){"use strict";e.d(B,{Z:function(){return l}});var t=e(94282),i=e(51450);function l(o){const M=(0,i.FU)(o),T=(0,t.ng)(),m=M?.projectFileId;var A;return{objectAnnotation:M,local:(A=M?.isLocal)!==null&&A!==void 0?A:!1,trajectory:T.trajectories[m??""]}}},44450:function(J,B,e){"use strict";e.d(B,{d:function(){return o}});var t=e(77503),i=e(17631),l=e(11132);function o(){const T=(0,i.WE)(A=>A.detail==="object"?A.key:null),{objectAnnotation:m}=(0,l.Z)(T||"");return!T||!m?!1:M(m.type)}function M(T){return t.OW.includes(T)}},68900:function(J,B,e){"use strict";e.d(B,{Cx:function(){return r},Dn:function(){return D},J4:function(){return p},k0:function(){return u},lL:function(){return E},sZ:function(){return C},u0:function(){return s},vR:function(){return d}});var t=e(19347),i=e(15805),l=e(51282),o=e(75057),M=e(5280),T=e(94282),m=e(56223),A=e(1287);function y(){const g=(0,M.SK)(),P=(0,o.F5)();return g&&P==="Task"?g.bounds:void 0}const _=.01;function D(g){return{coords:(0,A.xg)(g.coords,-_),zVal:g.zVal}}function v(g,P,h){if(Math.abs(P.x-g.x)<1e-10&&Math.abs(P.y-g.y)<1e-10)return g;let O=null;for(let Z=0;Z<h.length-1;Z++){const R=h[Z],a=h[(Z+1)%h.length],f=t.Z.computeLineSegmentLineSegmentIntersection(g.x,g.y,P.x,P.y,R.x,R.y,a.x,a.y);if(f)if(!O)O=f;else{const I=new i.Z(P.x,P.y);O=i.Z.distance(O,I)<i.Z.distance(f,I)?O:f}}return O}function n(g,P){const h=(0,A.Az)(P.coords),O={x:g.x,y:g.y};
1if(Math.abs(g.x-h.x)<1e-10&&Math.abs(g.y-h.y)<1e-10)return g;const Z=v(h,O,P.coords);return Z?new l.Z(Z.x,Z.y,g.z):g}function E(g,P,h){const O=h.coords;for(let Z=0;Z<O.length;Z++){const R=O[Z],a=O[(Z+1)%O.length],f=t.Z.computeLineSegmentLineSegmentIntersection(g.x,g.y,P.x,P.y,R.x,R.y,a.x,a.y);if(f)return new l.Z(f.x,f.y,g.z)}return console.error("unable to find intersection for:",g,P,"polygon coords:",O),P}function u(){const g=y(),P=(0,m.useMemo)(()=>g?D(g):void 0,[g]);return(0,m.useCallback)(h=>!P||(0,A.my)(P,h)?{restrictedPosition:h,bounded:!1}:{restrictedPosition:n(h,P),bounded:!0},[P])}function c(g,P,h){return isInBounds(h,P)?{restrictedPosition:P,bounded:!1}:{restrictedPosition:n(P,h),bounded:!0}}function d(g){const P=y(),h=(0,m.useRef)(void 0),O=(0,m.useRef)(void 0),Z=(0,m.useMemo)(()=>P?D(P):void 0,[P]);return(0,m.useEffect)(()=>{h.current=g,O.current=void 0},[P,g]),(0,m.useCallback)(R=>Z?(0,A.my)(Z,R)?(O.current=void 0,h.current=R,{restrictedPosition:R,bounded:!1}):O.current?{restrictedPosition:O.current,bounded:!0}:h.current?(O.current=E(R,h.current,Z),h.current=O.current,{restrictedPosition:O.current,bounded:!0}):(h.current=g,{restrictedPosition:n(R,Z),bounded:!0}):{restrictedPosition:R,bounded:!1},[Z,g])}function r(g,P,h){return(0,A.my)(h,P)?{restrictedPosition:P,bounded:!1}:{restrictedPosition:E(P,g,h),bounded:!0}}function s(){const g=(0,M.SK)();var P;const h=(0,T.OL)((P=g?.projectFileId)!==null&&P!==void 0?P:"no-trajectory"),O=u();return(0,m.useCallback)(Z=>{if(!h)return{restrictedPosition:Z,bounded:!1};const R=h?.project_from_ecef_point(Z),{restrictedPosition:a,bounded:f}=O(R);return{restrictedPosition:h.ecef_from_project_point(a),bounded:f}},[O,h])}function C(g){const P=(0,M.SK)();var h;const O=(0,T.OL)((h=P?.projectFileId)!==null&&h!==void 0?h:"no-trajectory"),Z=(0,m.useMemo)(()=>O?.project_from_ecef_point(g),[O,g]),R=d(Z??g);return(0,m.useCallback)(a=>{if(!O)return{restrictedPosition:a,bounded:!1};const f=O.project_from_ecef_point(a),{restrictedPosition:I,bounded:x}=R(f);return{restrictedPosition:O.ecef_from_project_point(I),bounded:x}},[R,O])}function p(){const g=y(),P=(0,M.SK)();var h;const O=(0,T.OL)((h=P?.projectFileId)!==null&&h!==void 0?h:"no-trajectory");return(0,m.useCallback)(Z=>{if(!g)return!0;if(!O)return!1;const R=O.project_from_ecef_point(Z);return(0,A.my)(g,R)},[g,O])}},7245:function(J,B,e){"use strict";e.d(B,{c:function(){return l}});var t=e(56223);class i{get draggable(){return!!this._handleDrag}constructor(){this.setHandleDragStart=M=>{this._handleDragStart=M},this.setHandleDrag=M=>{this._handleDrag=M},this.setHandleDragEnd=M=>{this._handleDragEnd=M},this.onDragStart=M=>{var T,m;this.mouseStart=M.mousePosition,this.dragLocationStart=M.position,(T=(m=this)._handleDragStart)===null||T===void 0||T.call(m,M),M.stopPropagation()},this.onDrag=M=>{var T,m;!this.mouseStart||!this.dragLocationStart||((T=(m=this)._handleDrag)===null||T===void 0||T.call(m,M,this.mouseStart,this.dragLocationStart),M.stopPropagation())},this.onDragEnd=M=>{var T,m;!this.mouseStart||!this.dragLocationStart||((T=(m=this)._handleDragEnd)===null||T===void 0||T.call(m,M,this.mouseStart,this.dragLocationStart),M.stopPropagation())}}}function l(o,M,T){const m=(0,t.useMemo)(()=>new i,[]);return(0,t.useEffect)(()=>{m.setHandleDragStart(o)},[o,m]),(0,t.useEffect)(()=>{m.setHandleDrag(M)},[M,m]),(0,t.useEffect)(()=>{m.setHandleDragEnd(T)},[T,m]),m}},63986:function(J,B,e){"use strict";e.d(B,{iC:function(){return A},sY:function(){return y}});var t=e(51282),i=e(19779),l=e(91465),o=e(4919),M=e(84187),T=e(3344),m=e(69334);function A(d,r,s,C){const g=r.globe.ellipsoid.geodeticSurfaceNormal(d,new t.Z),P=t.Z.negate(g,new t.Z);let h,O;switch(s.type){case"HighestPoint":h=P,O=g;break;case"LowestPoint":h=g,O=P;break}var Z;const R=t.Z.add(d,t.Z.multiplyByScalar(O,(Z=s.offsetMeters)!==null&&Z!==void 0?Z:12,new t.Z),new t.Z),a=new i.Z(R,h);C&&(0,T.SX)();const f=(0,M.J5)(a,r,s.pickingOptions);if(!f)return;const I=t.Z.subtract(f.position,d,new t.Z),x=t.Z.dot(I,P);return{drapedPoint:f.position,verticalDistance:x,pickingMiss:!1}}async function y(d,r,s,C,p,g){let P=arguments.length>6&&arguments[6]!==void 0?arguments[6]:2,h=arguments.length>7&&arguments[7]!==void 0?arguments[7]:33,O=arguments.length>8?arguments[8]:void 0;const Z=await u(d,r,C,p,g,P,h,O);return _(Z).map((a,f)=>s(a.drapedPoint)?a.drapedPoint:r[f])}function _(d){return d.map((r,s)=>{if(!r.pickingMiss||r.outOfView)return{...r};const C=D(r,s,d);if(C.length===0)return{...r,interpolated:!1};const{interpolatedPoint:p,interpolatedVerticalDistance:g}=v(r,C);return{...r,drapedPoint:p,interpolated:!0,verticalDistance:g}})}function D(d,r,s){const C=r>0?s[r-1]:void 0,p=r<s.length-1?s[r+1]:void 0,g=[];return C&&n(d,C)&&g.push(C.drapedPoint),p&&n(d,p)&&g.push(p.drapedPoint),g}function v(d,r){const s=r.map(h=>l.Z.WGS84.cartesianToCartographic(h)),C=l.Z.WGS84.cartesianToCartographic(d.drapedPoint),p=s.reduce((h,O)=>h+O.height,0)/s.length,g=new o.Z(C.longitude,C.latitude,p);return{interpolatedPoint:l.Z.WGS84.cartographicToCartesian(g),interpolatedVerticalDistance:p-C.height}}function n(d,r){if(r.pickingMiss)return!1;const C=l.Z.WGS84,p=C.cartesianToCartographic(d.drapedPoint),g=C.cartesianToCartographic(r.drapedPoint);p.height=0,g.height=0;const P=C.cartographicToCartesian(p),h=C.cartographicToCartesian(g);return t.Z.distance(P,h)<=2}const E=d=>"".concat(d.x.toFixed(5),",").concat(d.y.toFixed(5),",").concat(d.z.toFixed(5));async function u(d,r,s,C,p){let g=arguments.length>5&&arguments[5]!==void 0?arguments[5]:2,P=arguments.length>6&&arguments[6]!==void 0?arguments[6]:33,h=arguments.length>7?arguments[7]:void 0;const O=new Map;let Z=0;const R=[],a=f=>{const I={drapedPoint:f,verticalDistance:0,pickingMiss:!0,outOfView:!0,interpolated:!1};if(!d||!(0,m.F)(d,f,100))return I;const x=E(f);if(O.has(x))return O.get(x);const L=A(f,d,s,h);if(L){const b={...L,outOfView:!1,interpolated:!1};return O.set(x,b),b}else return Z++,{...I,outOfView:!1}};return await c(r,g,P,f=>{for(const I of f)R.push(a(I))},C,p,f=>d?(0,m.F)(d,f,100):!1),R}async function c(d,r,s,C,p,g,P){for(let h=0;h<d.length;h+=r){if(g?.aborted)throw new Error("Aborted");const O=d.slice(h,h+r);C(O),p&&p(Math.min((h+O.length)/d.length,1)),s>0&&h+r<d.length&&P&&O.some(P)&&await new Promise(R=>setTimeout(R,s))}}},48649:function(J,B,e){"use strict";e.d(B,{DE:function(){return T},Nx:function(){return A},hA:function(){return m}});var t=e(10081),i=e(56223),l=e(29931);function o(_,D){return(0,i.useCallback)(v=>{if(typeof D=="function"?D(v):D&&(D.current=v),!v?.cesiumElement)return;const n=v.cesiumElement;n.onClick=_.onClick,n.onRightClick=_.onRightClick,n.onMouseMove=_.onMouseMove,n.onMouseEnter=_.onMouseEnter,n.onMouseLeave=_.onMouseLeave,n.onDragStart=_.onDragStart,n.onDrag=_.onDrag,n.onDragEnd=_.onDragEnd,n.eventParent=_.eventParent,n.draggable=_.draggable,n.cursorOverride=_.cursorOverride,n.eventZIndex=_.eventZIndex},[D,_.onClick,_.onRightClick,_.onMouseMove,_.onMouseEnter,_.onMouseLeave,_.onDragStart,_.onDrag,_.onDragEnd,_.eventParent,_.draggable,_.cursorOverride,_.eventZIndex])}function M(_){return{..._,onClick:void 0,onRightClick:void 0,onMouseMove:void 0,onMouseEnter:void 0,onMouseLeave:void 0}}const T=(0,i.forwardRef)((_,D)=>{const v=o(_,D),n=M(_),E=crypto.randomUUID();return(0,t.jsx)(l.WV,{ref:v,...n},E)});T.displayName="EventHandlerPrimitive";const m=(0,i.forwardRef)((_,D)=>{const v=o(_,D),n=M(_);return(0,t.jsx)(l.Hn,{ref:v,...n})});m.displayName="EventHandlerModel";const A=(0,i.forwardRef)((_,D)=>{const v=o(_,D),n=M(_);return(0,t.jsx)(l.vk,{ref:v,...n})});A.displayName="EventHandlerPointPrimitive";const y=(0,i.forwardRef)((_,D)=>{const v=o(_,D),n=M(_);return(0,t.jsx)(l.JH,{ref:v,...n})});y.displayName="EventHandlerEntity",B.ZP=y}
1,65663:function(J,B,e){"use strict";e.d(B,{b:function(){return n},j:function(){return v}});var t=e(17631),i=e(66842),l=e(10241),o=e(7137),M=e(88422),T=e(18507),m=e(2461),A=e(56223),y=e(68900),_=e(7245),D=e(82472);function v(E,u){const{snapPreset:c=i.Nu.USER_DEFINED,ignoreFunction:d}=u,r=(0,D.Z)(E),s=(0,t.FN)(),C=(0,y.sZ)(E.get()),p=(0,y.u0)(),{snapper:g}=(0,M.c4)({configPreset:o.Q3}),P=(0,l.JH)(),h=(0,m.DW)();return(0,A.useCallback)(O=>{if(c!==i.Nu.NEVER_SNAP&&P===i.bK.DEFAULT_SNAP){const a=g(O.event.mousePosition),f=a&&d?d(a):!1;if(a&&a.type!=="pointcloud"&&!f){const I=C(a.position);return I.bounded?{type:"restricted",position:I.restrictedPosition}:a}}if(!h)return;const Z=r?.({event:O.event,mouseStart:O.mouseStart,dragLocationStart:O.dragLocationStart,originalLocation:E.original(),ctx:h});if(!Z)return;const R=p(Z.position);return R.bounded?{type:"restricted",position:R.restrictedPosition}:s?.currentMode==="xyz"?{type:"aligned",position:Z.position,axes:s.axes}:s?.currentMode==="surf"?{type:"point",position:Z.position}:{type:"point",position:Z.position}},[r,p,P,g,C,E,h,c,s,d])}function n(E,u){const c=v(E,u),d=(0,T.lT)(),r=(0,A.useCallback)((P,h,O)=>{const Z=c({event:P,mouseStart:h,dragLocationStart:O});Z&&(d(Z),E.set(Z.position))},[c,E,d]),s=(0,A.useCallback)(()=>{d(void 0)},[d]),{onDragStart:C,onDrag:p,onDragEnd:g}=(0,_.c)(void 0,r,s);return{onDragStart:C,onDrag:p,onDragEnd:g}}},35157:function(J,B,e){"use strict";e.d(B,{Z:function(){return _},f:function(){return y}});var t=e(51282),i=e(15805),l=e(19779),o=e(2461),M=e(56223),T=e(72710),m=e(8058),A=e(7245);function y(D,v){const n=()=>typeof D=="function"?t.Z.normalize(D(),new t.Z):t.Z.normalize(D,new t.Z),E=u=>{const{originalLocation:c,cartesianToCanvasCoordinates:d}=u;if(!d)return null;const r=d(c),s=t.Z.multiplyByScalar(n(),1e-4,new t.Z),C=d(t.Z.add(c,s,new t.Z));if(!r||!C)return null;const p=i.Z.subtract(C,r,new i.Z);if(i.Z.equalsEpsilon(p,i.Z.ZERO,1e-7))return null;const g=(0,m.v)(i.Z.subtract(C,r,new i.Z),new i.Z);return{origin:r,direction:g}};return u=>{const{event:c,mouseStart:d,originalLocation:r,ctx:s}=u;if(!d||!s.camera||!s.cartesianToCanvasCoordinates)return;const C=i.Z.subtract(c.mousePosition,d,new i.Z),p=E({originalLocation:r,cartesianToCanvasCoordinates:s.cartesianToCanvasCoordinates.bind(s)});if(!p)return;const g=i.Z.dot(C,p.direction),P=i.Z.add(p.origin,i.Z.multiplyByScalar(p.direction,g,new i.Z),new i.Z),h=s.camera.getPickRay(P);if(!h)return;let O;const Z=new l.Z(r,n());if(O=(0,T.D)(Z,h).point,!v)return{type:"point",position:O};const R=v(O);return R.bounded?{type:"restricted",position:R.restrictedPosition}:{type:"point",position:O}}}function _(D){const v=(0,M.useMemo)(()=>y(D.axisDirection,D.restrictPosition),[D.axisDirection,D.restrictPosition]),n=(0,o.DW)(),E=(0,M.useCallback)((u,c,d)=>{if(!n)return;const r=v({event:u,mouseStart:c,originalLocation:d,dragLocationStart:d,ctx:n});r&&D.location.set(r.position)},[v,D.location,n]);return(0,A.c)(void 0,E,void 0)}},12689:function(J,B,e){"use strict";e.d(B,{Z:function(){return A},d:function(){return m}});var t=e(89574),i=e(9087),l=e(51282),o=e(2461),M=e(56223),T=e(7245);function m(y,_){return v=>{const{originalLocation:n,dragLocationStart:E,event:u,ctx:c,mouseStart:d}=v;if(!c.camera||!E)return;const r=typeof y=="function"?y():y,s=t.Z.fromPointNormal(E,r),C=c.camera,p=Z=>{const R=C.getPickRay(Z);if(R){var a;return(a=i.Z.rayPlane(R,s))!==null&&a!==void 0?a:void 0}},g=p(d),P=p(u.mousePosition);if(!P||!g)return;const h=l.Z.subtract(P,g,new l.Z),O=l.Z.add(n,h,new l.Z);return _?{type:"restricted",position:_(O,n).restrictedPosition}:{type:"point",position:O}}}function A(y){const _=(0,M.useMemo)(()=>m(y.axisDirection,y.restrictPosition),[y.axisDirection,y.restrictPosition]),D=(0,o.DW)(),v=(0,M.useCallback)((n,E,u)=>{if(!D)return;const c=_({event:n,mouseStart:E,dragLocationStart:u,originalLocation:y.location.original(),ctx:D});c&&y.location.set(c.position)},[_,y.location,D]);return(0,T.c)(void 0,v,void 0)}},82472:function(J,B,e){"use strict";e.d(B,{Z:function(){return v},d:function(){return D}});var t=e(85533),i=e(32092),l=e(51282),o=e(73920),M=e(56223),T=e(36105),m=e(17631),A=e(68900),y=e(35157),_=e(12689);function D(u,c){return(0,M.useMemo)(()=>{var d;const r=(d=c?.axes)!==null&&d!==void 0?d:[],s=t.Z.eastNorthUpToFixedFrame(u.original()),C=i.Z.multiplyByPointAsVector(s,l.Z.UNIT_X,new l.Z),p=i.Z.multiplyByPointAsVector(s,l.Z.UNIT_Y,new l.Z),g=i.Z.multiplyByPointAsVector(s,l.Z.UNIT_Z,new l.Z);return r.map(P=>{if(P==="x")return C;if(P==="y")return p;if(P==="z")return g;(0,T.Z)(P)})},[u,c])}function v(u){const c=(0,m.FN)(),d={xyz:n(u,c),surf:E()};return c?d[c.currentMode]:void 0}function n(u,c){const d=D(u,c),r=(0,A.u0)(),s=(0,A.sZ)(u.original());return(0,M.useMemo)(()=>
1{if(c)if(d.length===2){const[C,p]=d,g=l.Z.cross(C,p,new l.Z);return(0,_.d)(g,r)}else if(d.length===1){const[C]=d;return(0,y.f)(C,s)}else return},[d,r,s,c])}function E(){const u=(0,o.Z)(),c=(0,A.u0)();return(0,M.useCallback)(r=>{const{event:s}=r,C=u(s.mousePosition);if(!C)return;const{entity:p,position:g}=C,P=c(g);return P.bounded?{type:"restricted",position:P.restrictedPosition}:{type:"pointcloud",position:g}},[u,c])}},30675:function(J,B,e){"use strict";e.d(B,{L:function(){return o}});var t=e(10081),i=e(56223),l=e(29931);function o(n){const[E,u]=(0,i.useState)(null),{camera:c}=(0,l.VQ)(),d=(0,i.useCallback)(p=>{if(!c)return;const g=c.getPickRay(p.mousePosition);g&&(u({x:p.mousePosition.x,y:p.mousePosition.y,ray:g,event:p}),p.stopPropagation())},[c]),r=(0,i.useCallback)(()=>{u(null)},[]),s=E?n({ray:E.ray,onClose:r,event:E.event}):null;return[s&&E?(0,t.jsx)(M,{x:E.x,y:E.y,onClose:r,children:s}):null,d]}function M(n){const{onClose:E}=n,{menuRef:u,initialPosition:c}=y({x:n.x,y:n.y,isOpen:!0});return T(E),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m,{menuRef:u,initialPosition:c,children:n.children}),(0,t.jsx)(A,{onClose:E})]})}function T(n){(0,i.useEffect)(()=>{const E=u=>{u.key==="Escape"&&n()};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[n])}function m(n){const E=(0,i.useCallback)(u=>{u.preventDefault()},[]);return(0,t.jsx)("div",{ref:n.menuRef,style:{position:"absolute",left:n.initialPosition.x,top:n.initialPosition.y,display:"block",zIndex:1e3,visibility:"hidden"},onContextMenu:E,children:n.children})}function A(n){const{onClose:E}=n,u=(0,i.useCallback)(d=>{d.button!==1?E():(d.stopPropagation(),d.preventDefault())},[E]),c=(0,i.useCallback)(d=>{d.preventDefault()},[]);return(0,t.jsx)("div",{style:{position:"absolute",left:0,top:0,width:"100%",height:"100%",display:"block",backgroundColor:"rgba(0, 0, 0, 0)",cursor:"default",zIndex:999},onClick:u,onContextMenu:c})}function y(n){const[E,u]=(0,i.useState)({x:n.x,y:n.y}),c=(0,i.useCallback)(d=>{if(d&&n.isOpen){const r=d.getBoundingClientRect(),s=_(d),C=D({x:n.x,y:n.y,menuRect:r,containerDimensions:s});v(d,C)}},[n.x,n.y,n.isOpen]);return(0,i.useLayoutEffect)(()=>{u({x:n.x,y:n.y})},[n.x,n.y]),{menuRef:c,initialPosition:E}}function _(n){const u=(n.offsetParent||document.body).getBoundingClientRect();return{width:u.width,height:u.height}}function D(n){const{x:E,y:u,menuRect:c,containerDimensions:d}=n;let r=E,s=u;return E+c.width>d.width&&(r=E-c.width),u+c.height>d.height&&(s=u-c.height),r=Math.max(0,Math.min(r,d.width-c.width)),s=Math.max(0,Math.min(s,d.height-c.height)),{x:r,y:s}}function v(n,E){n.style.left="".concat(E.x,"px"),n.style.top="".concat(E.y,"px"),n.style.visibility="visible"}},25498:function(J,B,e){"use strict";var t=e(10081),i=e(51282),l=e(55262),o=e(56223),M=e(29931),T=e(48649),m=e(45209),A=e(84786);const y=(0,o.memo)(_=>{const D=i.Z.ZERO.clone();D[_.axis]=1;const v=new l.Z(()=>[-1,1].map(u=>{var c;const d=(c=_.overriddenAxisDirection)!==null&&c!==void 0?c:(0,A.S0)(D,_.cuboid),r=Math.max(_.cuboidRelativeLength*_.cuboid.dimensions.get()[_.axis],.5),s=(0,A.Zj)(_.origin,_.cuboid);return i.Z.add(s,i.Z.multiplyByScalar(d,u*r/2,new i.Z),new i.Z)}),!1),n=m.bZ[_.axis],E=new l.Z(()=>_.show(),!1);return(0,t.jsx)(T.ZP,{children:(0,t.jsx)(M.qz,{positions:v,material:n,width:2,show:E})})});y.displayName="AxisLine",B.Z=y},97830:function(J,B,e){"use strict";e.d(B,{A:function(){return D}});var t=e(10081),i=e(51282),l=e(55262),o=e(56223),M=e(29931),T=e(48649),m=e(84015),A=e(84786);const y=[new i.Z(-.5,-.5,0),new i.Z(.5,-.5,0),new i.Z(.5,.5,0),new i.Z(-.5,.5,0),new i.Z(-.5,-.5,0)],_=[new i.Z(-.1,.5,0),new i.Z(.1,.5,0),new i.Z(0,.6,0),new i.Z(-.1,.5,0)];function D(v){const{cuboid:n,color:E,show:u=!0,readonly:c=!1,onUpdate:d}=v,r=(0,m.Z)(E,{red:1,green:1,blue:0,alpha:1}),s=(0,o.useMemo)(()=>new l.Z(()=>y.map(g=>(0,A.Zj)(g,n)),!1),[n]),C=(0,o.useMemo)(()=>new l.Z(()=>_.map(g=>(0,A.Zj)(g,n)),!1),[n]),p=4;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(T.ZP,{show:u,children:(0,t.jsx)(M.qz,{positions:C,material:r,width:p,depthFailMaterial:r})}),(0,t.jsx)(T.ZP,{show:u,children:(0,t.jsx)(M.qz,{positions:s,material:r,width:p,depthFailMaterial:r})})]})}},84786:function(J,B,e){"use strict";e.d(B,{S0:function(){return y},Y2:function(){return m},Zj:function(){return T},qm:function(){return o},zA:function(){return A}});var t=e(51282),i=e(32092);const l=new t.Z(1e-6,1e-6,1e-6);function o(D,v,n){return i.Z.fromTranslationQuaternionRotationScale(D,n,t.Z.maximumByComponent(v,l,new t.Z))}function M(D,v){const{position:n,dimensions:E,orientation:u}=D;return v?o(n.original(),E.original(),u.original()):o(n.get(),E.get(),u.get())}function T(D,v,n){return i.Z.multiplyByPoint(M(v,n),D,new t.Z)}function m(D,v,n){return i.Z.multiplyByPoint(i.Z.inverse(M(v,n),new i.Z),D,new t.Z)}function A(D,v,n){return i.Z.multiplyByPointAsVector(M(v,n),D,new t.Z)}function y(D,v,n){return t.Z.normalize(A(D,v,n),new t.Z)}function _(D,v,n){return T(new Cartesian3(0,0,D),v,n)}},24872:function(J,B,e){"use strict";e.d(B,{At:function(){return u},Ix:function(){return A},OE:function(){return n},ST:function(){return D},Zw:function(){return E},py:function(){return m},qZ:function(){return T},u5:function(){return y}});var t=e(15805),i=e(20108),l=e(51282),o=e(17631),M=e(84786);const T=Object.values(o.Yq).filter(c=>typeof c!="string");function m(c,d){switch(d){case o.Yq.TOP:case o.Yq.BOTTOM:return new t.Z(c.dimensions.get().x,c.dimensions.get().y);case o.Yq.LEFT:case o.Yq.RIGHT:return new t.Z(c.dimensions.get().y,c.dimensions.get().z);case o.Yq.FRONT:case o.Yq.BACK:return new t.Z(c.dimensions.get().x,c.dimensions.get().z)}}function A(c,d){const r=m(c,d);return Math.max(Math.sqrt(r.x*r.y)/3,r.x/6,r.y/6)}function y(c,d){switch(d){case o.Yq.TOP:case o.Yq.BOTTOM:return c.dimensions.get().z;case o.Yq.LEFT:case o.Yq.RIGHT:return c.dimensions.get().x;case o.Yq.FRONT:case o.Yq.BACK:return c.dimensions.get().y}}const _={[o.Yq.TOP]:i.Z.fromAxisAngle(l.Z.UNIT_Z,Math.PI),[o.Yq.BOTTOM]:i.Z.fromAxisAngle(l.Z.UNIT_Y,Math.PI),[o.Yq.LEFT]:i.Z.multiply(i.Z.fromAxisAngle(l.Z.UNIT_X,Math.PI/2),i.Z.fromAxisAngle(l.Z.UNIT_Y,-Math.PI/2),new i.Z),[o.Yq.RIGHT]:i.Z.multiply(i.Z.fromAxisAngle(l.Z.UNIT_X,Math.PI/2),i.Z.fromAxisAngle(l.Z.UNIT_Y,Math.PI/2),new i.Z),[o.Yq.FRONT]:i.Z.multiply(i.Z.fromAxisAngle(l.Z.UNIT_Y,Math.PI),i.Z.fromAxisAngle(l.Z.UNIT_X,-Math.PI/2),new i.Z),[o.Yq.BACK]:i.Z.fromAxisAngle(l.Z.UNIT_X,Math.PI/2)};function D(c,d){const r=_[d],s=c.orientation.get();return i.Z.multiply(s,r,new i.Z)}const v=.501;function n(c){let d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:v;switch(c){case o.Yq.TOP:return new l.Z(0,0,d);
1case o.Yq.BOTTOM:return new l.Z(0,0,-d);case o.Yq.LEFT:return new l.Z(-d,0,0);case o.Yq.RIGHT:return new l.Z(d,0,0);case o.Yq.FRONT:return new l.Z(0,d,0);case o.Yq.BACK:return new l.Z(0,-d,0)}}function E(c,d){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:v;const s=n(d,r);return(0,M.Zj)(s,c)}function u(c){switch(c){case o.Yq.TOP:return"Top";case o.Yq.BOTTOM:return"Bottom";case o.Yq.LEFT:return"Left";case o.Yq.RIGHT:return"Right";case o.Yq.FRONT:return"Front";case o.Yq.BACK:return"Back"}}},56949:function(J,B,e){"use strict";e.d(B,{t:function(){return y},w:function(){return A}});var t=e(85533),i=e(32092),l=e(51282),o=e(88209),M=e(17631),T=e(84786),m=e(24872);function A(_){const D=[M.Yq.FRONT,M.Yq.BACK,M.Yq.LEFT,M.Yq.RIGHT];for(const v of D){const n=y(_,v);if(n)return n}return null}function y(_,D){const v=(0,T.S0)((0,m.OE)(D),_),n=t.Z.eastNorthUpToFixedFrame(_.position.get()),E=i.Z.multiplyByPointAsVector(n,l.Z.UNIT_Z,new l.Z),u=l.Z.dot(v,E);if(u>.99999)return null;Math.abs(u)>1e-5&&(l.Z.subtract(v,l.Z.multiplyByScalar(E,u,new l.Z),v),l.Z.normalize(v,v));const c=(0,m.Ix)(_,D),d=(0,m.u5)(_,D),r=Math.max(Math.min(d,o.c),o.Pc);return{normal:v,origin:_.position.get(),windowWidth:c*20,depth:r}}},63248:function(J,B,e){"use strict";e.d(B,{QK:function(){return y},T2:function(){return A},ZP:function(){return m}});var t=e(32092),i=e(76517),l=e(51282),o=e(20108),M=e(8703),T=e(34881);function m(_,D){const{x:v,y:n,z:E,rotationW:u,rotationX:c,rotationY:d,rotationZ:r,scaleX:s,scaleY:C,scaleZ:p}=_,g=t.Z.fromTranslationRotationScale(new i.Z(new l.Z(v,n,E),new o.Z(c,d,r,u),(0,T.sj)(new l.Z(s,C,p))),new t.Z);return D.ecef_from_project_matrix4(g)}function A(_){return t.Z.fromTranslationQuaternionRotationScale(new l.Z(_.x,_.y,_.z),new o.Z(_.rotationX,_.rotationY,_.rotationZ,_.rotationW),new l.Z(_.scaleX,_.scaleY,_.scaleZ))}function y(_,D){return t.Z.fromTranslationQuaternionRotationScale(_,D,M.Eg)}},72207:function(J,B,e){"use strict";e.d(B,{Z:function(){return M},J:function(){return o}});var t=e(36105),l={r:1,g:1,b:0,alpha:1};function o(T){switch(T){case"TRAFFIC_LIGHT":return{kind:"model",modelPath:"/assets/models/objects/traffic-light/scene.glb"};case"STOP_SIGN":return{kind:"model",modelPath:"/assets/models/objects/stop-sign/scene.glb"};case"FIRE_HYDRANT":return{kind:"model",modelPath:"/assets/models/objects/fire-hydrant/scene.glb"};case"UTILITY_POLE":return{kind:"model",modelPath:"/assets/models/objects/utility-pole/scene.glb"};case"PARKING_METER":return{kind:"model",modelPath:"/assets/models/objects/parking-meter/scene.glb"};case"PHONE_BOOTH":return{kind:"model",modelPath:"/assets/models/objects/phone-booth/scene.glb"};case"TRAFFIC_PEDX_LIGHT":return{kind:"model",modelPath:"/assets/models/objects/traffic-pedx-light/scene.glb"};case"METER":return{kind:"model",modelPath:"/assets/models/objects/meter/scene.glb"};case"DOWN_SPOUT":return{kind:"model",modelPath:"/assets/models/objects/down-spout/scene.glb"};case"DRAIN":return{kind:"model",modelPath:"/assets/models/objects/drain/scene.glb"};case"CATCH_BASIN":return{kind:"model",modelPath:"/assets/models/objects/catch-basin/scene.glb"};case"ELEC_XARM":return{kind:"model",modelPath:"/assets/models/objects/electric-xarm/scene.glb"};case"LAMP":return{kind:"model",modelPath:"/assets/models/objects/lamp/scene.glb"};case"MANHOLE":return{kind:"point",color:l};case"PULL_BOX":return{kind:"model",modelPath:"/assets/models/objects/pull-box/scene.glb"};case"BOLLARD":return{kind:"model",modelPath:"/assets/models/objects/bollard/scene.glb"};case"TRASH_CAN":return{kind:"model",modelPath:"/assets/models/objects/trash-can/scene.glb"};case"MAILBOX":return{kind:"model",modelPath:"/assets/models/objects/mailbox/scene.glb"};case"SIGN_MAST":return{kind:"model",modelPath:"/assets/models/objects/sign-mast/scene.glb"};case"BIKE_RACK":return{kind:"model",modelPath:"/assets/models/objects/bike-rack/scene.glb"};case"PLANTER":case"PLANTERS":return{kind:"model",modelPath:"/assets/models/objects/planter/scene.glb"};case"TREE_TRUNK":return{kind:"model",modelPath:"/assets/models/objects/tree-trunk/scene.glb"};case"ADA_RAMP":return{kind:"model",modelPath:"/assets/models/objects/ada-ramp/scene.glb"};case"POLE_MOUNT_XFORMER":case"POLE_MOUNTED_TRANSFORMER":return{kind:"model",modelPath:"/assets/models/objects/pole-mounted-transformer/scene.glb"};case"PAD_MOUNT_XFORMER":case"PAD_MOUNTED_TRANSFORMER":return{kind:"model",modelPath:"/assets/models/objects/pad-mounted-transformer/scene.glb"};case"UTILITY_CABINET":case"UTIL_CABINET":return{kind:"model",modelPath:"/assets/models/objects/utility-cabinet/scene.glb"};case"UTILITY_PEDESTAL":case"UTIL_PEDESTAL":return{kind:"model",modelPath:"/assets/models/objects/utility-pedestal/scene.glb"};case"GENERIC_SIGNFACE":return{kind:"model",modelPath:"/assets/models/objects/generic-signface/scene.glb"};case"UTIL_PAINT_MARKING":case"SURVEY_PAINT_MARKINGS":return{kind:"model",modelPath:"/assets/models/objects/survey-paint-marking/scene.glb"};case"SEAT_BENCH":case"BENCH_SEAT":return{kind:"model",modelPath:"/assets/models/objects/bench-seat/scene.glb"};case"PIPELINE_MARKER":return{kind:"model",modelPath:"/assets/models/objects/pipeline-marker/scene.glb"};case"LIGHT_POLE":return{kind:"model",modelPath:"/assets/models/objects/light-pole/scene.glb"};case"SQUARE_MANHOLE":return{kind:"model",modelPath:"/assets/models/objects/square-manhole/scene.glb"};case"SIGN_ASSEMBLY":return{kind:"point",color:l};case"UNCERTAINTY_POINT":return{kind:"point",color:l};case"RAIL_TERMINAL":return{kind:"point",color:l};case"PAVEMENT_SYMBOL_ARROW_LANE_REDUCTION":case"PAVEMENT_SYMBOL_ARROW_LEFT":case"PAVEMENT_SYMBOL_ARROW_LEFT_RIGHT":case"PAVEMENT_SYMBOL_ARROW_LEFT_ROUNDABOUT_FISHHOOK":case"PAVEMENT_SYMBOL_ARROW_LEFT_ROUNDABOUT_FISHHOOK_DOTTED":case"PAVEMENT_SYMBOL_ARROW_RIGHT":case"PAVEMENT_SYMBOL_ARROW_THROUGH":case"PAVEMENT_SYMBOL_ARROW_THROUGH_LEFT":case"PAVEMENT_SYMBOL_ARROW_THROUGH_LEFT_RIGHT":case"PAVEMENT_SYMBOL_ARROW_THROUGH_LEFT_RIGHT_ROUNDABOUT_FISHHOOK":case"PAVEMENT_SYMBOL_ARROW_THROUGH_LEFT_RIGHT_ROUNDABOUT_FISHHOOK_DOTTED":case"PAVEMENT_SYMBOL_ARROW_THROUGH_LEFT_ROUNDABOUT_FISHHOOK":case"PAVEMENT_SYMBOL_ARROW_THROUGH_LEFT_ROUNDABOUT_FISHHOOK_DOTTED":case"PAVEMENT_SYMBOL_ARROW_THROUGH_RIGHT":case"PAVEMENT_SYMBOL_ARROW_THROUGH_RIGHT_ROUNDABOUT_FISHHOOK":case"PAVEMENT_SYMBOL_ARROW_THROUGH_RIGHT_ROUNDABOUT_FISHHOOK_DOTTED":case"PAVEMENT_SYMBOL_ARROW_THROUGH_ROUNDABOUT_FISHHOOK":case"PAVEMENT_SYMBOL_ARROW_THROUGH_ROUNDABOUT_FISHHOOK_DOTTED":case"PAVEMENT_SYMBOL_ARROW_U_TURN":case"PAVEMENT_SYMBOL_ARROW_WRONG_WAY":case"PAVEMENT_SYMBOL_BICYCLE":case"PAVEMENT_SYMBOL_BICYCLIST":case"PAVEMENT_SYMBOL_HOV_DIAMOND":case"PAVEMENT_SYMBOL_RAILROAD_CROSSING":case"PAVEMENT_SYMBOL_RAILROAD_CROSSING_R_BELOW":case"PAVEMENT_SYMBOL_SHARED_LANE":case"PAVEMENT_SYMBOL_SPEED_HUMP":case"PAVEMENT_SYMBOL_WORD":case"PAVEMENT_SYMBOL_YIELD_AHEAD_TRIANGLE_GROUP":case"PAVEMENT_SYMBOL_YIELD_TRIANGLE":return{kind:"point",color:l};case"PAVEMENT_SYMBOL_BOUNDS":return{kind:"bounds",color:{r:0,g:0,b:1,alpha:1}};case"PAVEMENT_ARROW_BOUNDS":return{kind:"bounds",color:{r:0,g:1,b:0,alpha:1}};case"PAVEMENT_MESSAGE_BOUNDS":return{kind:"bounds",color:{r:1,g:0,b:0,alpha:1}};case"CURB_GRATE_POI":return{kind:"point",color:{r:255/255,g:166/255,b:41/255,alpha:1}};case"CURB_INLET_POI":return{kind:"point",color:{r:20/255,g:174/255,b:92/255,alpha:1}};case"CURB_RAMP_POI":return{kind:"point",color:{r:0/255,g:162/255,b:194/255,alpha:1}};default:return(0,t.Z)(T)}}function M(T){const{type:m,spec:A}=T;if(m==="Point"){var y;return{kind:"point",color:(y=A.color)!==null&&y!==void 0?y:l}}else return o(m)}},56660:function(J,B,e){"use strict";e.d(B,{ZP:function(){return N},bA:function(){return a},qV:function(){return I}});var t=e(10081),i=e(514),l=e(51282),o=e(20108),M=e(4919),T=e(32092),m=e(85533),A=e(91681),y=e(90891),_=e(17631),D=e(51450),v=e(7529),n=e(45030),E=e(32907),u=e(76470),c=e(27761),d=e(56223),r=e(29931),s=e(82039),C=e(68900),p=e(63986),g=e(84786),P=e(56949);function h(U,j,w){function Q(ee,Me){const De=l.Z.clone(ee);return De[j]=Me,De}const X=Q(l.Z.ZERO,(-.5+w)/2),k=(0,g.Zj)(X,U),F=Q(l.Z.ZERO,(.5+w)/2),W=(0,g.Zj)(F,U),z=w+.5,V=U.dimensions.get(),G=Q(V,V[j]*z),$=Q(V,V[j]*(1-z));return{firstPosition:k,firstDimensions:G,secondPosition:W,secondDimensions:$}}const O=(0,d.memo)(U=>{const{cuboid:j,object:w,vizMapping:Q,onUpdate:X,ray:k}=U,F=(0,D.FH)(),W=(0,s.TL)(),z=(0,E.Wr)(k,j);if(!z)return null;const V=(0,g.Y2)(z.position,j),G=$=>{const{firstPosition:ee,firstDimensions:Me,secondPosition:De,secondDimensions:Oe}=h(j,$,V[$]),oe=Q.project_from_ecef_point(De),re=Q.project_from_ecef_scale(Oe),ce={type:w.type,spec:w.spec};var me;const ae=F({x:oe.x,y:oe.y,z:oe.z,rotationW:w.rotationW,rotationX:w.rotationX,rotationY:w.rotationY,rotationZ:w.rotationZ,scaleX:re.x,scaleY:re.y,scaleZ:re.z,...ce,annotationLayerId:(me=w.annotationLayerId)!==null&&me!==void 0?me:void 0},w.projectFileId);W((0,n.u7)("object split",[{kind:"update-object",id:w.id,oldState:structuredClone(w)},{kind:"add-object",id:ae.id,state:ae}])),j.position.set(ee),j.dimensions.set(Me),X(!0)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.MenuItem,{icon:"vertical-inbetween",text:"Split horizontally",onClick:()=>{G("z")},disabled:z.face===_.Yq.TOP||z.face===_.Yq.BOTTOM}),(0,t.jsx)(i.MenuItem,{icon:"horizontal-inbetween",text:"Split vertically",onClick:()=>{const $=z.face===_.Yq.FRONT||z.face===_.Yq.BACK;G($?"x":"y")}})]})});O.displayName="SplitOptions";function Z(U){const{cuboid:j,onUpdate:w}=U;return(0,t.jsx)(i.MenuItem,{icon:"refresh",text:"Rotate 180 degrees",onClick:()=>{const Q=o.Z.fromAxisAngle((0,g.S0)(l.Z.UNIT_Z,j),Math.PI),X=o.Z.multiply(Q,j.orientation.get(),new o.Z);j.orientation.set(X),w()}})}function R(U){const{viewer:j}=(0,r.VQ)(),w=(0,y.NJ)();return(0,d.useCallback)(Q=>{if(!j)return 0;const X=(0,g.Zj)(new l.Z(0,0,-.5),U),k=(0,p.iC)(X,j.scene,Q,w);var F;return(F=k?.verticalDistance)!==null&&F!==void 0?F:0},[j,U,w])}function a(U,j){const w=U.position.get(),Q=M.Z.fromCartesian(w);return Q.height-=j,M.Z.toCartesian(Q)}function f(U){const{cuboid:j,onUpdate:w}
1=U,Q=R(j),X=(0,C.sZ)(j.position.original()),k=F=>{const W=Q(F),z=a(j,W),{restrictedPosition:V,bounded:G}=X(z);G?u.Z.show({message:"Cannot move to ground: object centroid would leave the bounds of the task. This can happen because the project coordinate system is not aligned with WGS84",intent:"warning"}):j.position.set(V),w()};return(0,t.jsxs)(i.MenuItem,{icon:"arrow-down",text:"Snap object to",children:[(0,t.jsx)(i.MenuItem,{icon:"chevron-up",text:"High (point cloud)",onClick:()=>k({type:"HighestPoint"})}),(0,t.jsx)(i.MenuItem,{icon:"chevron-down",text:"Low (point cloud)",onClick:()=>k({type:"LowestPoint"})})]})}function I(U,j){const w=U.dimensions.get(),Q=new l.Z(0,0,-1),X=(0,g.S0)(Q,U),k=T.Z.multiplyByPointAsVector(m.Z.eastNorthUpToFixedFrame(U.position.get()),Q,new l.Z),F=l.Z.dot(X,k);if(F<.001)return{kind:"failed",reason:"Object is upside down."};const W=j/F;if(W<-w.z+.001)return{kind:"failed",reason:"Bottom of object would be above the top."};const z=Math.max(.001,w.z+W),V=l.Z.multiplyByScalar(X,W/2,new l.Z);return{kind:"success",position:l.Z.add(U.position.get(),V,new l.Z),dimension:new l.Z(w.x,w.y,z)}}function x(U){const{cuboid:j,onUpdate:w}=U,Q=R(j),X=(0,C.sZ)(j.position.original()),k=(0,d.useCallback)(F=>{const W=Q(F),z=I(j,W);if(z.kind==="failed")u.Z.show({message:"Cannot snap to pointcloud: ".concat(z.reason),intent:"warning"});else{const{position:V,dimension:G}=z,{restrictedPosition:$,bounded:ee}=X(V);ee?u.Z.show({message:"Cannot snap to pointcloud: Object centroid would leave the bounds of the task",intent:"warning"}):(j.position.set($),j.dimensions.set(G))}w()},[j,Q,X,w]);return(0,t.jsxs)(i.MenuItem,{icon:"bring-data",text:"Resize to ground",children:[(0,t.jsx)(i.MenuItem,{icon:"chevron-up",text:"High (point cloud)",onClick:()=>k({type:"HighestPoint"})}),(0,t.jsx)(i.MenuItem,{icon:"chevron-down",text:"Low (point cloud)",onClick:()=>k({type:"LowestPoint"})})]})}function L(U){const{cuboid:j,onUpdate:w}=U;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f,{cuboid:j,onUpdate:w}),(0,t.jsx)(x,{cuboid:j,onUpdate:w})]})}function b(U){const{cuboid:j,face:w}=U,Q=(0,s.TL)(),X=(0,P.t)(j,w);return X?(0,t.jsx)(i.MenuItem,{icon:(0,t.jsx)("img",{src:"/assets/images/icons/torch-gray.svg",alt:"Cross Section",width:"16",height:"16"}),text:"Enter cross section",onClick:()=>{Q((0,A.dA)({normal:X.normal,origin:X.origin,windowWidth:X.windowWidth})),Q((0,A.kN)(X.depth))}}):null}function N(U){var j;const{object:w,vizMapping:Q,onUpdate:X,cuboid:k,ray:F,event:W,onClose:z}=U,V=$=>{X($),z()},G=W==null||(j=W.target)===null||j===void 0?void 0:j.objectRotationPlaneFace;return(0,t.jsxs)(v.x,{children:[(0,t.jsx)(c.RequireFeatureFlag,{featureFlag:"crossSectionTool",featureFlagDefault:!1,children:G===void 0?null:(0,t.jsx)(b,{cuboid:k,face:G})}),(0,t.jsx)(Z,{cuboid:k,onUpdate:V}),(0,t.jsx)(O,{cuboid:k,object:w,vizMapping:Q,onUpdate:V,ray:F}),(0,t.jsx)(L,{cuboid:k,onUpdate:V})]})}},34881:function(J,B,e){"use strict";e.d(B,{sj:function(){return o}});var t=e(51282);const i=.01;function l(M){return M<i?i:M}function o(M){return new t.Z(l(M.x),l(M.y),l(M.z))}},74588:function(J,B,e){"use strict";e.d(B,{nD:function(){return se},e:function(){return Ee},ZP:function(){return ye},_H:function(){return ne},MF:function(){return q}});var t=e(10081),i=e(71177),l=e(55262),o=e(51282),M=e(72017),T=e(76517),m=e(20108),A=e(85533),y=e(32092),_=e(17631),D=e(51450),v=e(66842),n=e(32907),E=e(30594),u=e(56223),c=e(29931),d=e(71412),r=e(36105),s=e(35421),C=e(8325),p=e(76470),g=e(82039),P=e(84786),h=e(95497),O=e(63410);function Z(S,Y,H){const ie=A.Z.eastNorthUpToFixedFrame(S),de=y.Z.multiplyByPointAsVector(ie,o.Z.UNIT_Z,new o.Z),ge=o.Z.cross(de,Y,new o.Z);if(o.Z.equalsEpsilon(ge,o.Z.ZERO,.01))return H;o.Z.normalize(ge,ge);const le=o.Z.cross(Y,ge,new o.Z);return o.Z.normalize(le,le),le}function R(S){const Y=(S.dimensions.get().y+S.dimensions.get().z)/2/S.dimensions.get().x,H=(S.dimensions.get().x+S.dimensions.get().z)/2/S.dimensions.get().y,ie=(S.dimensions.get().x+S.dimensions.get().y)/2/S.dimensions.get().z,de=new o.Z(Y,H,ie),ge=3,le=y.Z.multiplyByPointAsVector(A.Z.eastNorthUpToFixedFrame(S.position.get()),o.Z.UNIT_Z,new o.Z),ve=ue=>{let Ce=(0,P.S0)(ue,S);o.Z.dot(Ce,le)>0&&(ue=o.Z.negate(ue,new o.Z),Ce=(0,P.S0)(ue,S));const Ue=o.Z.negate(ue,new o.Z),Ae=o.Z.add(o.Z.multiplyByScalar(Ue,.5,new o.Z),o.Z.multiplyByScalar(o.Z.multiplyComponents(Ue,de,new o.Z),ge,new o.Z),new o.Z),Re=(0,P.Zj)(Ae,S),Se=Z(Re,Ce,(0,P.S0)(ue.z?o.Z.UNIT_Y:o.Z.UNIT_Z,S));return{position:Re,direction:Ce,up:Se}},Pe=ve(o.Z.UNIT_Z),Le=ve(o.Z.UNIT_X),xe=ve(o.Z.UNIT_Y);return[Pe,Le,xe]}function a(){const{camera:S}=(0,c.VQ)(),Y=(0,g.TL)(),H=(0,O.hh)(),ie=(0,O.Ox)(de=>de.kind==="object-view"||de.kind==="line-view");return(0,u.useCallback)(de=>{if(!S)return;if(H){p.Z.show({message:"V hotkey unavailable in Layer view. Switch to LiDAR?",action:{text:"Switch",intent:C.S.NONE,onClick:()=>{Y((0,h.tu)("lidar"))}},intent:C.S.PRIMARY},"use-lidar-for-v");return}const ge=R(de);let le=0;ie?le=(ge.findIndex(Le=>{let{position:xe,direction:ue,up:Ce}=Le;return o.Z.equalsEpsilon(S.directionWC,ue,.1)})+1)%ge.length:le=(ge.findIndex(Le=>{let{position:xe,direction:ue,up:Ce}=Le;return o.Z.equalsEpsilon(S.positionWC,xe,.01)&&o.Z.equalsEpsilon(S.directionWC,ue,.01)&&o.Z.equalsEpsilon(S.upWC,
1Ce,.01)})+1)%ge.length;const ve=ge[le];Y((0,O.HX)(ve.position,ve.direction,ve.up))},[S,Y,ie,H])}var f=e(11662),I=e(72921),x=e(93920),L=e(68900),b=e(48649),N=e(65663),U=e(82472),j=e(30675),w=e(84015),Q=e(25498),X=e(97830),k=e(72207),F=e(56660),W=e(34881),z=e(41995),V=e(26822),G=e(32603),$=e(73956),ee=e(36574),Me=e(91386);function De(){const[S,Y]=(0,u.useState)(!1);return(0,u.useEffect)(()=>{const H=()=>{Y(!0)},ie=()=>{Y(!1)};return document.addEventListener(f.Zk.SHOW_FACE_CENTERS,H),document.addEventListener(f.Zk.HIDE_FACE_CENTERS,ie),()=>{document.removeEventListener(f.Zk.SHOW_FACE_CENTERS,H),document.removeEventListener(f.Zk.HIDE_FACE_CENTERS,ie)}},[]),S}const Oe=new i.Z(1,1,0,.5),oe=new i.Z(0,255/255,209/255,1),re=(0,u.memo)(S=>{const Y=(0,w.Z)({...S.display.color,alpha:.8},Oe),H=(0,u.useMemo)(()=>new l.Z(()=>{const ie=S.cuboid.dimensions.get();return(0,W.sj)(new o.Z(ie.x/2,ie.y/2,ie.z/2))},!1),[S.cuboid.dimensions]);return(0,t.jsx)(c.l7,{color:Y,pixelSize:10,outlineColor:i.Z.YELLOW,outlineWidth:5})});re.displayName="PointDisplayGraphics";const ce=(0,u.memo)(S=>{const{display:Y,cuboid:H,overrideColor:ie}=S,de=(0,u.useMemo)(()=>new M.Z({Object:new l.Z(()=>{const le=H.dimensions.get(),ve=(0,W.sj)(new o.Z(le.y,le.z,le.x));return new T.Z(o.Z.ZERO,m.Z.IDENTITY,ve)},!1)}),[H.dimensions]),ge=(0,u.useMemo)(()=>ie?i.Z.fromCssColorString(ie):te,[ie]);return(0,t.jsx)(c.ZQ,{uri:Y.modelPath,scale:1,color:ge,nodeTransformations:de})});ce.displayName="ModelDisplayGraphics";const me=(0,u.memo)(S=>{const Y=(0,w.Z)({...S.display.color,alpha:.8},Oe),H=(0,u.useMemo)(()=>new l.Z(()=>{const ie=S.cuboid.dimensions.get(),de=.95;return(0,W.sj)(new o.Z(ie.x*de,ie.y*de,ie.z*de))},!1),[S.cuboid.dimensions]);return(0,t.jsx)(c.n,{material:Y,dimensions:H})});me.displayName="BoxDisplayGraphics";const ae=(0,u.memo)(S=>{const Y=(0,w.Z)({...S.display.color,alpha:.8},Oe),H=(0,s.IP)(S.cuboid.dimensions);return(0,t.jsx)(c.BD,{material:Y,radii:H})});ae.displayName="EllipsoidDisplayGraphics";const Te=(0,u.memo)(S=>{const Y=(0,w.Z)({...S.display.color,alpha:.8},Oe),H=(0,u.useMemo)(()=>new l.Z(()=>{const de=(0,W.sj)(S.cuboid.dimensions.get());return Math.max(de.x,de.y)/2},!1),[S.cuboid.dimensions]),ie=(0,u.useMemo)(()=>new l.Z(()=>(0,W.sj)(S.cuboid.dimensions.get()).z,!1),[S.cuboid.dimensions]);return(0,t.jsx)(c.uz,{material:Y,bottomRadius:H,topRadius:H,length:ie})});Te.displayName="CylinderDisplayGraphics";const K=(0,u.memo)(S=>{const Y=S.display;switch(Y.kind){case"point":return(0,t.jsx)(re,{display:Y,cuboid:S.cuboid});case"model":return(0,t.jsx)(ce,{display:Y,cuboid:S.cuboid,overrideColor:S.overrideColor});case"box":return(0,t.jsx)(me,{display:Y,cuboid:S.cuboid});case"ellipsoid":return(0,t.jsx)(ae,{display:Y,cuboid:S.cuboid});case"cylinder":return(0,t.jsx)(Te,{display:Y,cuboid:S.cuboid});case"bounds":return(0,t.jsx)(X.A,{cuboid:S.cuboid,color:Y.color,show:!0});default:return(0,r.Z)(Y)}});K.displayName="DisplayGraphics";function q(S,Y,H){const ie=(0,u.useMemo)(()=>Y.ecef_from_project_point(new o.Z(S.x,S.y,S.z)),[Y,S.x,S.y,S.z]),de=(0,s.ZP)(ie),ge=(0,u.useMemo)(()=>{var Le,xe,ue,Ce;return Y.ecef_from_project_quaternion(new m.Z((Le=H?.x)!==null&&Le!==void 0?Le:S.rotationX,(xe=H?.y)!==null&&xe!==void 0?xe:S.rotationY,(ue=H?.z)!==null&&ue!==void 0?ue:S.rotationZ,(Ce=H?.w)!==null&&Ce!==void 0?Ce:S.rotationW))},[Y,S.rotationX,S.rotationY,S.rotationZ,S.rotationW,H?.x,H?.y,H?.z,H?.w]),le=(0,s.ZP)(ge),ve=(0,u.useMemo)(()=>Y.ecef_from_project_scale(new o.Z(S.scaleX,S.scaleY,S.scaleZ)),[Y,S.scaleX,S.scaleY,S.scaleZ]),Pe=(0,s.ZP)(ve);return(0,u.useMemo)(()=>({position:de,orientation:le,dimensions:Pe}),[de,le,Pe])}function ne(S,Y){const H=Y.ecef_from_project_point(new o.Z(S.x,S.y,S.z)),ie=Y.ecef_from_project_quaternion(new m.Z(S.rotationX,S.rotationY,S.rotationZ,S.rotationW)),de=Y.ecef_from_project_scale(new o.Z(S.scaleX,S.scaleY,S.scaleZ));return{position:{get(){return H},original(){return H}},orientation:{get(){return ie},original(){return ie}},dimensions:{get(){return de},original(){return de}}}}const se=(0,u.memo)(S=>{const Y=(0,_.FN)(),H=(0,U.d)(S.cuboid.position,Y);return Y?(0,t.jsx)(t.Fragment,{children:Y.axes.map((ie,de)=>(0,t.jsx)(Q.Z,{cuboid:S.cuboid,axis:ie,overriddenAxisDirection:H[de],origin:o.Z.ZERO,show:S.isDragging,cuboidRelativeLength:3},ie))}):null});
1se.displayName="DraggableModelAxisLinesEntity";const te=new i.Z(1,.5,.5,.5),Ee=(0,u.memo)(S=>{const{cuboid:Y,onUpdate:H,display:ie,show:de,id:ge,readonly:le,overrideColor:ve}=S,Pe=(0,s.KV)(Y.position),Le=(0,s.pJ)(Y.orientation),xe=(0,I.mr)(),ue=(0,N.b)(Y.position,{snapPreset:v.Nu.NEVER_SNAP}),Ce=(0,u.useRef)(!1),Ue=pe=>{Ce.current=!0,ue.onDragStart(pe)},Ae=pe=>{Ce.current=!1,H(),ue.onDragEnd(pe)},Re=(0,E.Kc)("object-".concat(ge),pe=>{var Ze;return(Ze=(0,n.Wr)(pe.mouseRay,Y))===null||Ze===void 0?void 0:Ze.position}),Se=!le&&!xe;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(b.ZP,{position:Pe,orientation:Le,onDragStart:le?void 0:Ue,onDrag:le?void 0:ue.onDrag,onDragEnd:le?void 0:Ae,draggable:Se,cursorOverride:Se?"grab":void 0,show:de,ref:Re,children:(0,t.jsx)(K,{display:ie,cuboid:Y,overrideColor:ve})},ge+ie.kind),(0,t.jsx)(se,{isDragging:()=>Ce.current,cuboid:Y})]})});Ee.displayName="DraggableModelEntity";const _e=(0,u.memo)(S=>{const{cuboid:Y,onUpdate:H}=S,{camera:ie}=(0,c.VQ)(),ge=(0,d.y1)(H,300,{leading:!1,trailing:!0}),le=(0,L.sZ)(Y.position.original()),ve=()=>{const Ae=A.Z.eastNorthUpToFixedFrame(Y.position.get());return y.Z.multiplyByPointAsVector(Ae,o.Z.UNIT_Z,new o.Z)},Pe=()=>{if(!ie)return;const Ae=ie.right,Re=ve(),Se=o.Z.subtract(Ae,o.Z.multiplyByScalar(Re,o.Z.dot(Ae,Re),new o.Z),new o.Z);return o.Z.normalize(Se,Se),Se},Le=()=>{if(!ie)return;const Ae=ie.position,Re=Y.position.get();return o.Z.distance(Ae,Re)},xe=.1,ue=.4,Ce=.01,Ue=(Ae,Re)=>{const Se=Le(),pe=Ae();if(!pe||!Se)return;const Ze=o.Z.add(Y.position.get(),o.Z.multiplyByScalar(pe,Se*Re,new o.Z),new o.Z),be=le(Ze).restrictedPosition;Y.position.set(be),ge()};return null});_e.displayName="ObjectMovementHotkeyController";const Ie={w:1,x:0,y:0,z:0};function he(S){const Y=a();(0,u.useEffect)(()=>{const H=()=>{Y(S)};return document.addEventListener(f.Zk.TOGGLE_PERSPECTIVE,H),()=>document.removeEventListener(f.Zk.TOGGLE_PERSPECTIVE,H)},[Y,S])}function fe(S){const Y=(0,k.Z)(S.object),H=S.cuboid,de=(0,Me.g)()(S.object),ge=(0,D.DP)(),le=(0,ee.Z)(S.object,S.cuboid,S.vizMapping),ve=(0,x.tV)(S.object),Pe=(0,$.n)([S.object])[S.object.id],Le=(0,V.b2)(H,Pe?.exportPosition),xe=Pe?.modelUri||Y.kind==="bounds"?H:Le;he(H);const[ue,Ce]=(0,j.L)(Re=>{let{ray:Se,onClose:pe,event:Ze}=Re;return(0,t.jsx)(F.ZP,{object:S.object,vizMapping:S.vizMapping,cuboid:H,ray:Se,onClose:pe,onUpdate:le,event:Ze})}),Ue=De(),Ae=!G.yt.includes(S.object.type);return(0,t.jsxs)(t.Fragment,{children:[(Pe?.modelUri||Y.kind==="bounds")&&(0,t.jsx)(Ee,{cuboid:H,onUpdate:le,display:Y,id:S.object.id,show:ve,readonly:S.readonly,overrideColor:de}),(Pe?.modelUri||Y.kind==="bounds")&&(0,t.jsx)(z.Z,{onRightClick:Ce,cuboid:xe,onUpdate:le,readonly:S.readonly,show:ve,color:Oe}),Pe?.exportPosition&&(0,t.jsx)(V.$m,{object:S.object,onUpdate:le,objectCuboid:H,onRightClick:Ce,readonly:S.readonly,show:ve}),Ae&&(0,t.jsx)(G.AL,{object:S.object,isTop:!0,objectCuboid:H,onUpdate:le,onRightClick:Ce,readonly:S.readonly,show:ve&&Ue}),Ae&&(0,t.jsx)(G.AL,{object:S.object,isTop:!1,objectCuboid:H,onUpdate:le,onRightClick:Ce,readonly:S.readonly,show:ve&&Ue}),!S.readonly&&ve&&(0,t.jsx)(_e,{cuboid:H,onUpdate:le}),!S.readonly&&ue]})}var ye=fe},41995:function(J,B,e){"use strict";e.d(B,{d:function(){return ae},Z:function(){return Te}});var t=e(10081),i=e(71177),l=e(66842),o=e(29931),M=e(35421),T=e(72921),m=e(48649),A=e(65663),y=e(55262),_=e(15805),D=e(85334),v=e(51282),n=e(89574),E=e(56223),u=e(24872),c=e(11662);function d(){const[K,q]=(0,E.useState)(!1);return(0,E.useEffect)(()=>{const ne=()=>{q(!0)},se=()=>{q(!1)};return document.addEventListener(c.Zk.SHOW_FACE_NAMES,ne),document.addEventListener(c.Zk.HIDE_FACE_NAMES,se),()=>{document.removeEventListener(c.Zk.SHOW_FACE_NAMES,ne),document.removeEventListener(c.Zk.HIDE_FACE_NAMES,se)}},[]),K}function r(K){const{camera:q}=(0,o.VQ)(),ne=new y.Z(()=>(0,u.ST)(K.cuboid,K.face),!1),se=new y.Z(()=>(0,u.Zw)(K.cuboid,K.face),!1),te=new y.Z(()=>{const Ie=(0,u.py)(K.cuboid,K.face),he=.1;return _.Z.maximumByComponent(Ie,new _.Z(he,he),new _.Z)},!1),Ee=(0,E.useMemo)(()=>{const Ie=(0,u.At)(K.face),he=document.createElement("canvas");he.width=256,he.height=256;const fe=he.getContext("2d");return fe.font="bold 72px sans-serif",fe.fillStyle="white",fe.strokeStyle="black",fe.textAlign="center",fe.textBaseline="middle",fe.fillText(Ie,he.width/2,he.height/2),fe.strokeText(Ie,he.width/2,he.height/2),new D.Z({image:he,color:i.Z.WHITE,transparent:!0})},[K.face]),_e=(0,E.useMemo)(()=>new y.Z(()=>
1{if(!q)return!1;const Ie=(0,u.Zw)(K.cuboid,K.face),he=v.Z.subtract(Ie,K.cuboid.position.get(),new v.Z),fe=v.Z.subtract(Ie,q.positionWC,new v.Z);return v.Z.dot(he,fe)<0&&K.show},!1),[K.cuboid,K.face,K.show,q]);return(0,t.jsx)(m.ZP,{position:se,orientation:ne,children:(0,t.jsx)(o.mR,{dimensions:te,material:Ee,fill:!0,plane:n.Z.ORIGIN_XY_PLANE,show:_e})})}function s(K){const ne=d()&&K.show!==!1;return(0,t.jsx)(t.Fragment,{children:u.qZ.map(se=>(0,t.jsx)(r,{cuboid:K.cuboid,face:se,show:ne},se))})}var C=e(9087),p=e(79740),g=e(20108),P=e(2278),h=e(32189),O=e(17631),Z=e(32907),R=e(6259),a=e(30594),f=e(82039),I=e(36105),x=e(25498),L=e(44450),b=e(98047),N=e(68900),U=e(35157),j=e(84786),w=e(4377);const Q=(0,E.memo)(K=>{const{cuboid:q,handleLocation:ne}=K,se=new y.Z(()=>(0,j.Zj)(ne,q),!1),te=20,Ee=(0,a.Kc)("scaling-handle-".concat(ne.x,"-").concat(ne.y,"-").concat(ne.z),_e=>(0,Z.O_)(_e.mousePosition,_e.scene,{position:se.getValue(new P.Z),imageWidth:te,imageHeight:te}));return(0,t.jsx)(m.ZP,{position:se,...K.eventHandlers,eventZIndex:R.M.AXIS_SCALING_HANDLE,show:K.show,ref:Ee,children:(0,t.jsx)(o.l7,{color:w.l,pixelSize:te})})});Q.displayName="ScalingHandleEntity";const X=(0,E.memo)(K=>{const{setTooltipContent:q,setTooltipPosition:ne,clearTooltip:se}=(0,b.H)(),te=(0,E.useRef)(!1),{cuboid:Ee,axisDirection:_e,handleLocation:Ie,onUpdate:he,stablePoint:fe}=K,ye=(0,L.d)(),S=(0,j.zA)({x:v.Z.UNIT_X,y:v.Z.UNIT_Y,z:v.Z.UNIT_Z}[_e],Ee),Y=(0,N.sZ)(Ee.position.original()),H=()=>(0,j.Zj)(Ie,Ee),ie=()=>(0,j.Zj)(Ie,Ee,!0),de=ue=>{const Ce=(0,j.Y2)(ie(),Ee,!0),Ae=(0,j.Y2)(ue,Ee,!0)[_e]-Ce[_e],Re=Ie[_e]-fe,Se=Ae/Re+1;let pe=Math.max(.001,Math.min(1e3,Se));const Ze=new v.Z;Ze[_e]=-fe*(pe-1);const be=(0,j.Zj)(Ze,Ee,!0),{restrictedPosition:je,bounded:Ne}=Y(be);if(Ee.position.set(je),Ne){const We=(0,j.Y2)(je,Ee,!0)[_e]/Re*2+1;pe=Math.max(.001,Math.min(1e3,We))}const Be=v.Z.clone(Ee.dimensions.original(),new v.Z);ye&&(_e==="x"||_e==="y")?(Be.x=Be.x*pe,Be.y=Be.y*pe):Be[_e]=Be[_e]*pe,Ee.dimensions.set(Be)},ge=(0,U.Z)({location:{get:H,set:de,original:ie},axisDirection:S}),le=ue=>{if(te.current)return;const Ce=k(_e,ye);q("Scale ".concat(Ce)),ne(ue.mousePosition.x,ue.mousePosition.y)},ve=()=>{te.current||se()},Pe=ue=>{te.current=!0,K.onSetDragging(!0);const Ce=k(_e,ye);q("Scaling ".concat(Ce)),ne(ue.mousePosition.x,ue.mousePosition.y),ge.onDragStart(ue)},Le=ue=>{ne(ue.mousePosition.x,ue.mousePosition.y),ge.onDrag(ue)},xe=ue=>{te.current=!1,K.onSetDragging(!1),se(),he()};return(0,t.jsx)(Q,{eventHandlers:{onMouseEnter:le,onMouseLeave:ve,onDragStart:Pe,onDrag:Le,onDragEnd:xe,draggable:!0},...K})}),k=(K,q)=>{switch(K){case"x":return q?"Diameter":"X";case"y":return q?"Diameter":"Y";case"z":return"Z";default:(0,I.Z)(K)}};X.displayName="AxisScalingHandle";var F=X;function W(K,q,ne){const se=(0,E.useRef)(null),{camera:te}=(0,o.VQ)(),Ee=()=>n.Z.fromPointNormal(K(),q()),_e=fe=>{const ye=te.getPickRay(fe);if(!ye)return null;var S;return(S=C.Z.rayPlane(ye,Ee()))!==null&&S!==void 0?S:null};return{onDragStart:fe=>{se.current=_e(fe.mousePosition),fe.stopPropagation()},onDrag:fe=>{if(!se.current||!te)return;const ye=_e(fe.mousePosition);if(!ye)return;const S=v.Z.angleBetween(v.Z.subtract(se.current,K(),new v.Z),v.Z.subtract(ye,K(),new v.Z)),Y=v.Z.cross(v.Z.subtract(se.current,K(),new v.Z),v.Z.subtract(ye,K(),new v.Z),new v.Z),H=v.Z.dot(Y,q())<0;ne(H?-S:S),se.current=ye,fe.stopPropagation()}}}const z=new D.Z({image:"/assets/images/protractor-texture-white.png",color:i.Z.WHITE,transparent:!0}),V=(0,E.memo)(K=>{const{cuboid:q,onUpdate:ne,face:se}=K,te=new y.Z(()=>(0,u.Ix)(q,se),!1),Ee=.001,_e=()=>(0,u.ST)(q,se),Ie=new y.Z(_e,!1),he=()=>{const ge=_e(),le=p.Z.fromQuaternion(ge,new p.Z);return p.Z.multiplyByVector(le,v.Z.UNIT_Z,new v.Z)},fe=()=>(0,u.Zw)(q,se),ye=new y.Z(fe,!1),S=ge=>{const le=q.orientation.get(),ve=he(),Pe=g.Z.fromAxisAngle(ve,ge),Le=g.Z.multiply(Pe,le,new g.Z);q.orientation.set(Le)},{onDragStart:Y,onDrag:H}=W(fe,he,S),ie=ge=>(0,Z.Mz)(ge.mouseRay,{origin:fe(),orientation:_e(),radius:te.getValue(new P.Z)}),de=(0,a.Kc)("object-rotation-circle",ie);return(0,t.jsx)(m.ZP,{position:ye,orientation:Ie,show:K.show,draggable:!0,onDragStart:Y,onDrag:H,onDragEnd:()=>{ne()},ref:de,eventZIndex:R.M.OBJECT_ROTATION_PLANE,children:(0,t.jsx)(o.uz,{bottomRadius:te,topRadius:te,length:Ee,material:z,fill:!0,outline:!0,outlineColor:i.Z.YELLOW,outlineWidth:3})})});V.displayName="ObjectRotationCircle";const G=i.Z.fromAlpha(i.Z.WHITE,.01),$=i.Z.fromAlpha(w.l,.3),ee=(0,E.memo)(K=>{const q=new y.Z(()=>(0,u.ST)(K.cuboid,K.face),!1),ne=new y.Z(()=>(0,u.Zw)(K.cuboid,K.face),!1),se=new y.Z(()=>{const he=(0,u.py)(K.cuboid,K.face),fe=.1;return new _.Z(Math.max(he.x,fe),Math.max(he.y,fe))},!1),te=(0,E.useRef)(!1),Ee=new h.Z(new y.Z(()=>K.selected||te.current?$:G,!1)),_e="object-rotation-plane-".concat(K.face),Ie=(0,a.Kc)(_e,he=>(0,Z.JI)(he.mouseRay,{origin:ne.getValue(new P.Z),orientation:q.getValue(new P.Z),width:se.getValue(new P.Z).x,height:se.getValue(new P.Z).y}));return(0,t.jsx)(m.ZP,{onClick:K.onClick,onRightClick:K.onRightClick,position:ne,orientation:q,show:K.show,onMouseEnter:()=>te.current=!0,onMouseLeave:()=>te.current=!1,ref:Ie,objectRotationPlaneFace:K.face,children:(0,t.jsx)(o.mR,{dimensions:se,material:Ee,fill:!0,plane:n.Z.ORIGIN_XY_PLANE})})});ee.displayName="ObjectRotationPlane";function Me(K){switch(K){case O.Yq.FRONT:case O.Yq.BACK:return"y";case O.Yq.LEFT:case O.Yq.RIGHT:return"x";case O.Yq.TOP:case O.Yq.BOTTOM:return"z";default:(0,I.Z)(K)}}const De=(0,E.memo)(K=>{const q=(0,E.useRef)(!1),ne=te=>q.current=te,se=[];for(const te of[-.5,.5]){const Ee=K.faceCenter.clone();Ee[K.perpendicularAxis]+=te,se.push((0,t.jsx)(F,{cuboid:K.cuboid,axisDirection:K.perpendicularAxis,handleLocation:Ee,stablePoint:-te,onUpdate:K.onUpdate,show:K.show,onSetDragging:ne},te))}return(0,t.jsxs)(t.Fragment,{children:[se,(0,t.jsx)(x.Z,{cuboid:K.cuboid,origin:K.faceCenter,axis:K.perpendicularAxis,show:()=>K.show&&q.current,cuboidRelativeLength:2.02})]})});De.displayName="EdgeScalingHandlePair";const Oe=(0,E.memo)(K=>{const q=[],ne=Me(K.face);for(const se of["x","y","z"]){if(se===ne)continue;const te=(0,u.OE)(K.face);q.push((0,t.jsx)(De,{cuboid:K.cuboid,onUpdate:K.onUpdate,show:K.show,faceAxis:ne,faceCenter:te,perpendicularAxis:se},se))}return(0,t.jsx)(t.Fragment,{children:q})});Oe.displayName="EdgeScalingHandles";const oe=(0,E.memo)(K=>{const q=(0,f.TL)(),ne=(0,O.WE)(te=>te.detail==="object"?te.selectedFace:null),se=(0,E.useCallback)(te=>{q((0,O.sI)(null))},[q]);return(0,a.sC)("onClick",se),(0,t.jsxs)(t.Fragment,{children:[Object.values(O.Yq).map(te=>typeof te=="string"?null:(0,t.jsx)(ee,{cuboid:K.cuboid,face:te,onClick:Ee=>{q(ne===te?(0,O.sI)(null):(0,O.sI)(te)),Ee.stopPropagation()},show:K.show,selected:ne===te,onUpdate:K.onUpdate,onRightClick:K.onRightClick},te)),(0,t.jsx)(V,{cuboid:K.cuboid,face:ne??O.Yq.FRONT,onUpdate:K.onUpdate,show:ne!==null&&K.show}),(0,t.jsx)(Oe,{cuboid:K.cuboid,face:ne??O.Yq.FRONT,onUpdate:K.onUpdate,show:ne!==null&&K.show})]})});oe.displayName="ObjectRotationPlanes";var re=oe,ce=e(73439);const me=new i.Z(1,1,0,.01),ae=ce.B.withAlpha(.5);function Te(K){const{cuboid:q,onUpdate:ne,shouldHandleDragInPlane:se,readonly:te,color:Ee}=K,_e=(0,M.KV)(q.position),Ie=(0,M.IP)(q.dimensions),he=(0,M.pJ)(q.orientation),fe=(0,T.mr)(),ye=(0,A.b)(q.position,{snapPreset:l.Nu.NEVER_SNAP}),S=se&&!te;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.ZP,{position:_e,orientation:he,onDragStart:S?ye.onDragStart:void 0,onDrag:S?ye.onDrag:void 0,onDragEnd:S?ye.onDragEnd:void 0,draggable:S,show:K.show,children:(0,t.jsx)(o.n,{dimensions:Ie,outline:!0,outlineColor:Ee??ae,outlineWidth:ce.z,material:S?me:i.Z.TRANSPARENT})}),!te&&!fe&&(0,t.jsx)(re,{cuboid:q,onUpdate:ne,show:K.show,onRightClick:K.onRightClick}),(0,t.jsx)(s,{cuboid:q,show:K.show}
1)]})}},26822:function(J,B,e){"use strict";e.d(B,{$m:function(){return f},M4:function(){return h},b2:function(){return Z},by:function(){return a},xf:function(){return R}});var t=e(10081),i=e(51282),l=e(71177),o=e(2278),M=e(95527),T=e(66842),m=e(32907),A=e(6259),y=e(30594),_=e(35421),D=e(11511),v=e(52274),n=e(56223),E=e(29931),u=e(78296),c=e(68900),d=e(48649),r=e(65663),s=e(84015),C=e(84786),p=e(72207),g=e(74588),P=e(91386);function h(I,x){var L;const b=(0,v.Ph)(I,x);var N;const U=b&&(N=x==null||(L=x.schema[b])===null||L===void 0?void 0:L.exportPosition)!==null&&N!==void 0?N:"Centroid",j=D.JC[U];return j.geometry==="3D Point"?new i.Z(j.location.x,j.location.y,j.location.z):new i.Z(0,0,0)}const O=.3;function Z(I,x){const L=(0,c.sZ)(I.position.original()),b=(0,_.ZP)(new i.Z(O,O,O));return(0,n.useMemo)(()=>{const N=()=>(0,C.Zj)(x??i.Z.ZERO,I),U=()=>(0,C.Zj)(x??i.Z.ZERO,I,!0);return{position:{get:N,set:X=>{const k=(0,C.Y2)(U(),I,!0),F=(0,C.Y2)(X,I,!0),W=i.Z.subtract(F,k,new i.Z),z=(0,C.Zj)(W,I,!0),{restrictedPosition:V}=L(z);I.position.set(V)},original:U},dimensions:b,orientation:I.orientation}},[b,x,I,L])}function R(I){const L=(0,P.g)()(I),b=(0,p.Z)(I),N=(0,s.Z)(b.kind==="point"?b.color:void 0,l.Z.fromCssColorString((0,u.Z)(I.type)));return L?l.Z.fromCssColorString(L):N}const a=(0,n.memo)(I=>{const{id:x,exportPositionCuboid:L,eventHandlers:b,show:N,color:U}=I,j=(0,_.KV)(L.position),w=20,Q=3,X=(0,y.Kc)("export-position",k=>(0,m.O_)(k.mousePosition,k.scene,{position:j.getValue(new o.Z),imageWidth:w,imageHeight:w}));return(0,t.jsx)(d.ZP,{position:j,...b,eventZIndex:A.M.SELECTED_OBJECT_EXPORT_POSITION,show:N,ref:X,children:(0,t.jsx)(E.l7,{pixelSize:w-Q,color:U??l.Z.SEAGREEN,outlineColor:l.Z.YELLOW,outlineWidth:Q})})});a.displayName="ObjectExportPointEntity";const f=(0,n.memo)(I=>{const{object:x,objectCuboid:L,onUpdate:b,onRightClick:N,readonly:U,show:j}=I,w=R(x),Q=(0,n.useRef)(!1);var X;const k=(0,M.ow)((X=x.annotationLayerId)!==null&&X!==void 0?X:""),F=h(x,k),W=Z(L,F),z=(0,r.b)(W.position,{snapPreset:T.Nu.USER_DEFINED}),V=ee=>{Q.current=!0,z.onDragStart(ee)},G=ee=>{b?.(),Q.current=!1,z.onDragEnd(ee)},$=!U;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a,{eventHandlers:{onDragStart:U?void 0:V,onDrag:U?void 0:z.onDrag,onDragEnd:U?void 0:G,draggable:$,cursorOverride:$?"grab":void 0,onRightClick:U?void 0:N},exportPositionCuboid:W,id:x.id,color:w}),(0,t.jsx)(g.nD,{cuboid:W,isDragging:()=>Q.current})]})});f.displayName="DraggableExportPoint"},32603:function(J,B,e){"use strict";e.d(B,{AL:function(){return O},bW:function(){return h},yt:function(){return p}});var t=e(10081),i=e(51282),l=e(85533),o=e(32092),M=e(79740),T=e(20108),m=e(2278),A=e(71177),y=e(66842),_=e(32907),D=e(6259),v=e(30594),n=e(35421),E=e(56223),u=e(29931),c=e(78296
1),d=e(48649),r=e(65663),s=e(84786),C=e(74588);const p=["Point","SIGN_ASSEMBLY"],g=new i.Z(0,0,.5),P=new i.Z(0,0,-.5);function h(Z,R){const a=Z?g:P,f=Z?P:g;return(0,E.useMemo)(()=>({get(){return(0,s.Zj)(a,R)},set(I){const x=I,L=(0,s.Zj)(f,R),b=i.Z.distance(x,L),N=R.dimensions.get(),U=new i.Z(N.x,N.y,b),j=i.Z.add(x,L,new i.Z);i.Z.divideByScalar(j,2,j);const w=l.Z.eastNorthUpToFixedFrame(j),Q=o.Z.inverseTransformation(w,new o.Z),X=o.Z.multiplyByPoint(Q,x,new i.Z),k=o.Z.multiplyByPoint(Q,L,new i.Z),F=i.Z.subtract(k,X,new i.Z);i.Z.normalize(F,F);const W=new i.Z(0,0,Z?-1:1),z=i.Z.cross(F,W,new i.Z),V=Math.acos(i.Z.dot(F,W)),G=M.Z.fromQuaternion(T.Z.fromAxisAngle(z,-V)),$=o.Z.getRotation(o.Z.multiplyByMatrix3(w,G,new o.Z),new M.Z);R.position.set(j),R.dimensions.set(U),R.orientation.set(T.Z.fromRotationMatrix($))},original(){return(0,s.Zj)(a,R,!0)}}),[Z,a,f,R])}const O=(0,E.memo)(Z=>{const{object:R,isTop:a,objectCuboid:f,onUpdate:I,onRightClick:x,readonly:L,show:b}=Z,N=(0,c.Z)(R.type),U=(0,E.useRef)(!1),j=h(a,f),w=(0,r.b)(j,{snapPreset:y.Nu.USER_DEFINED}),Q=$=>{U.current=!0,w.onDragStart($)},X=$=>{I?.(),U.current=!1},k=!L,F=(0,n.KV)(j),W=20,z=3,V=(0,v.Kc)("face-center-".concat(a?"top":"bottom"),$=>(0,_.O_)($.mousePosition,$.scene,{position:F.getValue(new m.Z),imageWidth:W,imageHeight:W})),G=(0,E.useMemo)(()=>({position:j,orientation:f.orientation,dimensions:f.dimensions}),[j,f]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.ZP,{position:F,onDragStart:L?void 0:Q,onDrag:L?void 0:w.onDrag,onDragEnd:L?void 0:X,draggable:k,cursorOverride:k?"grab":void 0,onRightClick:L?void 0:x,eventZIndex:D.M.SELECTED_OBJECT_FACE_CENTER,show:b,ref:V,children:(0,t.jsx)(u.l7,{pixelSize:W-z,color:A.Z.fromCssColorString(N),outlineColor:A.Z.YELLOW,outlineWidth:z})}),(0,t.jsx)(C.nD,{cuboid:G,isDragging:()=>U.current})]})});O.displayName="SelectedObjectFaceCenterEntity"},4377:function(J,B,e){"use strict";e.d(B,{l:function(){return i}});var t=e(71177);const i=new t.Z(1,.8156862745098039,.2235294117647059)},73956:function(J,B,e){"use strict";e.d(B,{n:function(){return R}});var t=e(10081),i=e(51282),l=e(71177),o=e(58507),M=e(95527),T=e(39689),m=e(65117),A=e(51450),y=e(32907),_=e(30594),D=e(27945),v=e(52274),n=e(56223),E=e(78296),u=e(82039),c=e(17631),d=e(93920),r=e(48649),s=e(84015),C=e(62768),p=e(97830),g=e(63248),P=e(72207),h=e(74588),O=e(26822),Z=e(91386);function R(F){const W=(0,m.Fj)(G=>G.showAllExportPositionsOverride),z=(0,m.Fj)(G=>G.showAllModelsOverride),V=(0,M.Ni)();return(0,n.useMemo)(()=>{const G={};for(const Me of F){var $;const De=(0,v.jV)(Me,V.get(($=Me.annotationLayerId)!==null&&$!==void 0?$:"")),Oe=(0,P.Z)(Me),oe=Oe.kind==="model"?Oe.modelPath:void 0;var ee;const re=(0,O.M4)(Me,V.get((ee=Me.annotationLayerId)!==null&&ee!==void 0?ee:"")),ce=(z||De)&&oe;G[Me.id]={exportPosition:!ce||W||Me.type==="Point"?re:void 0,modelUri:ce?oe:void 0}}return G},[F,W,z,V])}function a(F,W){const z=["x","y","z","rotationW","rotationX","rotationY","rotationZ","scaleX","scaleY","scaleZ","spec","type"];for(const V of z)if(F[V]!==W[V])return!1;return!0}function f(F,W){if(F.length!==W.length)return!1;const z={};for(const V of W)z[V.id]=V;for(const V of F){const G=z[V.id];if(!G||!a(V,G))return!1}return!0}function I(F,W){let z,V=Number.POSITIVE_INFINITY;for(const $ of W){var G;const ee=(G=(0,y.Wr)(F,$.cuboid))===null||G===void 0?void 0:G.position;if(!ee)continue;const Me=i.Z.distance(F.origin,ee);Me<V&&(V=Me,z={position:ee,object:$})}return z}const x=(0,n.memo)(F=>{const{object:W,modelUri:z,show:V,exportPosition:G,vizMapping:$,onMount:ee,onUnmount:Me}=F,De=(0,h.MF)(W,$,null),Oe=(0,O.b2)(De,G),{onClick:oe,cursorOverride:re}=(0,C.Z)(),ce=(0,g.QK)(Oe.position.original(),Oe.orientation.original()),ae=(0,Z.g)()(W),Te=(0,P.Z)(W),K=(0,s.Z)(Te.kind==="point"?Te.color:void 0,l.Z.fromCssColorString((0,E.Z)(W.type))),q=ae?l.Z.fromCssColorString(ae):K,[ne,se]=(0,n.useState)(void 0);return(0,n.useEffect)(()=>(ne&&ee(ne,W.id,Oe),()=>{Me(W.id)}),[Oe,ne,W.id,ee,Me]),(0,t.jsx)(r.hA,{url:z??"/assets/models/sphere/scene.gltf",modelMatrix:ce,ref:te=>{se(te?.cesiumElement)},onClick:oe,color:q,show:V,id:W.id,cursorOverride:re})},(F,W)=>!(F.object.id!==W.object.id||!a(F.object,W.object)||F.vizMapping!==W.vizMapping||F.show!==W.show));x.displayName="ExportPositionModelByModel";const L=(0,n.memo)(F=>{const{object:W,modelUri:z,vizMapping:V,onMount:G,onUnmount:$}=F,ee=(0,h.MF)(W,V,null),Me=(0,u.TL)(),{onClick:De,cursorOverride:Oe}
1=(0,C.Z)(),[oe,re]=(0,n.useState)(void 0),me=(0,Z.g)()(W),ae=(0,g.ZP)(W,V);return(0,n.useEffect)(()=>(oe&&G(oe,W.id,ee),()=>{$(W.id)}),[oe,ee,W.id,G,$]),(0,t.jsx)(r.hA,{url:z,modelMatrix:ae,ref:Te=>{re(Te?.cesiumElement)},onClick:De,show:F.show,color:me?l.Z.fromCssColorString(me):void 0,colorBlendMode:o.Z.MIX,id:W.id,cursorOverride:Oe})},(F,W)=>!(F.modelUri!==W.modelUri||F.object.id!==W.object.id||!a(F.object,W.object)||F.vizMapping!==W.vizMapping||F.show!==W.show));L.displayName="ModelObjectByModel";function b(F,W,z){const V=F.findPointsWithinRadiusOfRay(W,z);return I(W,V)}function N(F,W,z,V){const $=W.findPointsWithinRadiusOfRay(z,V).filter(ee=>ee.deletedAt===null).map(ee=>F.get(ee.id)).filter(ee=>ee!==void 0);return I(z,$.filter(ee=>ee.model.show))}function U(F){return{position:F.position,object:{kind:"Model",id:F.object.id,object:F.object.model}}}function j(F,W,z,V){return{pick:G=>{if(!z)return;const $=N(W,z,G.mouseRay,V);if($)return U({...$});const ee=b(F,G.mouseRay,V);if(ee)return U({...ee})}}}const w=(0,n.memo)(F=>{var W;const z=(0,n.useRef)(new Map),V=(0,n.useCallback)((ae,Te,K)=>{z.current.set(Te,{id:Te,cuboid:K,model:ae})},[]),G=(0,n.useCallback)(ae=>{z.current.delete(ae)},[]),$=(0,n.useRef)(new D.Z([],0)),ee=(0,n.useCallback)((ae,Te,K)=>{const q=K.position.get();$.current.update({id:Te,cuboid:K,position:q,model:ae})},[]),Me=(0,n.useCallback)(ae=>{$.current.remove(ae)},[]);var De;const Oe=(De=(W=F.objects[0])===null||W===void 0?void 0:W.projectFileId)!==null&&De!==void 0?De:"no-objects",oe=(0,A.qR)(Oe),re=Math.max(...F.objects.map(ae=>Math.hypot(ae.scaleX,ae.scaleY,ae.scaleZ))),ce=(0,n.useMemo)(()=>j($.current,z.current,oe,re),[re,oe]);(0,_.qX)("unselected-model-objects-".concat(F.modelType,"-").concat(Oe),ce);const me=R(F.objects);return(0,t.jsxs)(t.Fragment,{children:[F.objects.map(ae=>{const Te=me[ae.id].modelUri;return Te?(0,t.jsx)(L,{object:ae,show:F.visibilities[ae.id],modelUri:Te,vizMapping:F.vizMapping,onMount:V,onUnmount:G},ae.id):null}),F.objects.map(ae=>{const Te=me[ae.id].exportPosition;return Te?(0,t.jsx)(x,{object:ae,show:F.visibilities[ae.id],vizMapping:F.vizMapping,exportPosition:Te,onMount:ee,onUnmount:Me},ae.id):null})]})});w.displayName="ModelObjectsByModel";function Q(F,W){return F.reduce((z,V)=>{const G=V.type;return V.id===W||!G||!(0,T.m6)(G)||(G in z?z[G].push(V):z[G]=[V]),z},{})}const X=(0,n.memo)(F=>{const W=(0,c.WE)(G=>G.detail==="object"?G.key:null),z=(0,n.useMemo)(()=>Q(F.objects,W),[F.objects,W]),V=(0,d.rW)(F.objects);return(0,t.jsxs)(t.Fragment,{children:[Object.entries(z).map(G=>{let[$,ee]=G;return(0,t.jsx)(w,{objects:ee,vizMapping:F.vizMapping,visibilities:V,modelType:$},$)}),Object.values(z).flat().filter(G=>(0,P.Z)(G).kind==="bounds").map(G=>(0,t.jsx)(k,{object:G,vizMapping:F.vizMapping,show:V[G.id]},"bounds-".concat(G.id)))]})});X.displayName="UnselectedModelObjectAnnotationEntities",B.Z=X;const k=(0,n.memo)(F=>{const W=(0,P.Z)(F.object),z=(0,h.MF)(F.object,F.vizMapping,null);return W.kind!=="bounds"?null:(0,t.jsx)(p.A,{cuboid:z,color:W.color,show:F.show,readonly:!0})});k.displayName="UnselectedBoundsEntity"},36574:function(J,B,e){"use strict";e.d(B,{Z:function(){return M}});var t=e(51450),i=e(45030),l=e(56223),o=e(82039);function M(T,m,A){const y=(0,o.TL)(),_=(0,t.DP)();return(0,l.useCallback)(D=>{const v={...T},n=m.position.get(),E=m.dimensions.get(),u=m.orientation.get(),c=A.project_from_ecef_point(n),d=A.project_from_ecef_scale(E),r=A.project_from_ecef_quaternion(u),s={id:T.id,x:c.x,y:c.y,z:c.z,rotationX:r.x,rotationY:r.y,rotationZ:r.z,rotationW:r.w,scaleX:d.x,scaleY:d.y,scaleZ:d.z};if(!D){const C={...T,...s};y((0,i.tR)(T.id,v))}_(T.id,s)},[m,T,_,y,A])}},91386:function(J,B,e){"use strict";e.d(B,{g:function(){return T}});var t=e(90891),i=e(65117),l=e(56223),o=e(36624);function M(m){return"hsl(".concat(Math.abs((0,o.Z)(m)%360),", 90%, 75%)")}function T(){const m=(0,t.l0)(),A=(0,i.zx)(),y=(0,i.N)();return(0,l.useCallback)(_=>{var D;if(m[(D=_.annotationLayerId)!==null&&D!==void 0?D:_.projectFileId]){var v;return m[(v=_.annotationLayerId)!==null&&v!==void 0?v:_.projectFileId]}if(A){var n;
1if((_.type==="STOP_SIGN"||_.type==="GENERIC_SIGNFACE")&&(!((n=_.spec.intrinsicProperties)===null||n===void 0)&&n.parentId))return M(_.spec.intrinsicProperties.parentId);if(_.type==="SIGN_ASSEMBLY")return M(_.id)}if(y&&_.__typename==="LineAnnotation")return M(_.id)},[m,A,y])}},73439:function(J,B,e){"use strict";e.d(B,{B:function(){return i},z:function(){return l}});var t=e(71177);const i=t.Z.YELLOW,l=5},44789:function(J,B,e){"use strict";e.d(B,{Aw:function(){return D},ZP:function(){return v}});var t=e(81202),i=e(52274),l=e(42112);function o(n,E,u){return n===E?n:u()}function M(n,E){if(n===E)return n;if(n===void 0||E===void 0)return n??E;throw new IncompatibleAttributesError}function T(n,E){return n??E}function m(n,E){if(n===E)return n;if(n===null||E===null)return n??E;throw new IncompatibleAttributesError}function A(n,E){switch(n.type){case"date":case"datetime":case"float":case"int":case"str":case"time":if(n.type!==E.type)throw new l.Le;return{type:n.type,value:T(n.value,E.value)};case"List[str]":if(E.type!=="List[str]")throw new l.Le;if(n.value)if(E.value){if(n.value.length!==E.value.length||n.value.some((u,c)=>u!==E.value[c]))throw new l.Le;return{type:"List[str]",value:n.value}}else return{type:"List[str]",value:n.value};else return{type:"List[str]",value:E.value};default:throw new l.Le}}function y(n,E){if(!n&&!E)return;if(n){if(!E)return n}else return E;const u={};for(const c of new Set([...Object.keys(n??{}),...Object.keys(E??{})])){const d=n?.[c],r=E?.[c];!d&&r||d&&!r?u[c]=d??r:!d&&!r||(u[c]=A(d,r))}return u}function _(n,E,u){const c=(0,i.Ph)(n,u),d=(0,i.Ph)(E,u);let r,s;if(c===d)if(c===void 0)if(n.type===E.type)r=n.type;else throw new l.zK;else r=n.type,s=c;else throw new l.ky;return{layerName:s,type:r}}function D(n,E,u){try{var c,d,r,s;if((0,t.h)(n)||(0,t.h)(E)||n.projectFileId!==E.projectFileId||n.annotationLayerId!==E.annotationLayerId||n.id===E.id)return!1;const C=(0,i.Ph)(n,u),p=(0,i.Ph)(E,u);if(C!==p||C===void 0&&n.type!==E.type)return!1;if(!((d=n.spec)===null||d===void 0||(c=d.subattributes)===null||c===void 0)&&c.data&&(!((s=E.spec)===null||s===void 0||(r=s.subattributes)===null||r===void 0)&&r.data)){const g=n.spec.subattributes.data,P=E.spec.subattributes.data;for(const h of new Set([...Object.keys(g),...Object.keys(P)])){const O=g[h],Z=P[h];if(O&&Z){if(O.type!==Z.type)return!1;if(O.type==="List[str]"&&Z.type==="List[str]"){const R=O.value,a=Z.value;if(R&&a&&(R.length!==a.length||R.some((f,I)=>f!==a[I])))return!1}else if(O.value!==void 0&&Z.value!==void 0&&O.value!==Z.value)return!1}}}return!0}catch{return!1}}function v(n,E,u){try{var c,d,r,s,C,p,g,P,h,O,Z,R,a,f,I,x,L,b,N,U,j,w,Q,X,k,F,W,z;const V=o(n.projectFileId,E.projectFileId,()=>{throw new l.q}),G=o(n.annotationLayerId,E.annotationLayerId,()=>{throw new l.e0});if(n.id===E.id)throw new l.Mv;const $=T((d=n.spec)===null||d===void 0||(c=d.intrinsicProperties)===null||c===void 0?void 0:c.sidewalkEdge,(s=E.spec)===null||s===void 0||(r=s.intrinsicProperties)===null||r===void 0?void 0:r.sidewalkEdge),ee=T((p=n.spec)===null||p===void 0||(C=p.intrinsicProperties)===null||C===void 0?void 0:C.hasBlackContrast,(P=E.spec)===null||P===void 0||(g=P.intrinsicProperties)===null||g===void 0?void 0:g.hasBlackContrast),Me=T((O=n.spec)===null||O===void 0||(h=O.intrinsicProperties)===null||h===void 0?void 0:h.mutcdDesignation,(R=E.spec)===null||R===void 0||(Z=R.intrinsicProperties)===null||Z===void 0?void 0:Z.mutcdDesignation),De=T((f=n.spec)===null||f===void 0||(a=f.intrinsicProperties)===null||a===void 0?void 0:a.paintColor,(x=E.spec)===null||x===void 0||(I=x.intrinsicProperties)===null||I===void 0?void 0:I.paintColor),Oe=T((b=n.spec)===null||b===void 0||(L=b.intrinsicProperties)===null||L===void 0?void 0:L.paintPattern,(U=E.spec)===null||U===void 0||(N=U.intrinsicProperties)===null||N===void 0?void 0:N.paintPattern),{layerName:oe,type:re}=_(n,E,u),ce=y((w=n.spec)===null||w===void 0||(j=w.subattributes)===null||j===void 0?void 0:j.data,(X=E.spec)===null||X===void 0||(Q=X.subattributes)===null||Q===void 0?void 0:Q.data),me=T((F=n.spec)===null||F===void 0||(k=F.subattributes)===null||k===void 0?void 0:k.featureCode,(z=E.spec)===null||z===void 0||(W=z.subattributes)===null||W===void 0?void 0:W.featureCode);
1if((0,t.h)(n)||(0,t.h)(E))throw new l.Oe;let ae;return oe&&ce!==void 0&&(ae={layerName:oe,...me!==void 0?{featureCode:me}:{},data:ce}),{width:n.width,projectFileId:V,annotationLayerId:G,type:re,spec:{intrinsicProperties:{sidewalkEdge:$,hasBlackContrast:ee,mutcdDesignation:Me,paintColor:De,paintPattern:Oe},subattributes:ae},isClosed:!1}}catch(V){if((0,l.hv)(V))return null;throw V}}},67112:function(J,B,e){"use strict";e.d(B,{Z:function(){return l}});var t=e(51282);function i(o,M,T){if(T){const m=t.Z.lerp(o[o.length-1],M[0],.5,new t.Z);return[...o.slice(0,-1),m,...M.slice(1)]}else return[...o,...M]}function l(o,M,T){if(o.length===0||M.length===0)return null;const m=o[0],A=o[o.length-1],y=M[0],_=M[M.length-1];if(!m||!A||!y||!_)return null;const D=t.Z.distance(m,y),v=t.Z.distance(m,_),n=t.Z.distance(A,y),E=t.Z.distance(A,_),u=Math.min(D,v,n,E);if(T?.tolerance&&!(u<T.tolerance))return null;const c=T?.dedupeThreshold?u<T.dedupeThreshold:!1;return u===D?i(M.reverse(),o,c):u===v?i(M,o,c):u===n?i(o,M,c):i(o,M.reverse(),c)}},84015:function(J,B,e){"use strict";e.d(B,{Z:function(){return l}});var t=e(71177),i=e(56223);function l(o,M){var T;const m=(T=o?.r)!==null&&T!==void 0?T:M.red;var A;const y=(A=o?.g)!==null&&A!==void 0?A:M.green;var _;const D=(_=o?.b)!==null&&_!==void 0?_:M.blue;var v,n;const E=(n=(v=o?.alpha)!==null&&v!==void 0?v:M.alpha)!==null&&n!==void 0?n:1;return(0,i.useMemo)(()=>new t.Z(m,y,D,E),[m,y,D,E])}},62768:function(J,B,e){"use strict";e.d(B,{Q:function(){return n},Z:function(){return E}});var t=e(10081),i=e(56223),l=e(82039),o=e(91755),M=e(25243),T=e(51450),m=e(52122),A=e(72921),y=e(78600),_=e(42536);const D={onClick:()=>{},cursorOverride:()=>"default"},v=(0,i.createContext)(D);function n(u){const c=(0,l.TL)(),d=(0,T.ug)(),{select:r}=(0,o.c)(),{isInMergeMode:s,canMerge:C,attemptMerge:p}=(0,y.S)(),g=(0,m.Av)(),P=(0,m.mY)(),h=(0,A.kb)(L=>L.mode==="pick-id"?L:null),O=(0,_.Z)(h?.pasteSpec),Z=(0,M.um)(),R=(0,M.py)(),a=(0,A.ot)(),f=(0,i.useRef)(()=>{});(0,i.useEffect)(()=>{f.current=L=>{const b=L.primitiveId;if(!b)return;const N=d.getFeatureById(b.replace(/(dash|outline)$/i,""));if(!N)return;const U=N.__typename==="LineAnnotation",j=document.body.hasAttribute("data-mod-pressed");if(U&&s)p(N,L.position),L.stopPropagation();else if(U&&g&&j)P(N.id),L.stopPropagation();else if(!(U&&!g&&j))if(h)h.allowedClasses.some(w=>w===N.type)&&(O(N.id),c((0,A.fq)({mode:"none"}))),L.stopPropagation();else if(Z&&j&&N.type==="Point")c((0,M.Af)(N.id)),L.stopPropagation();else{if(a)return;r(N),L.stopPropagation()}}},[d,s,p,c,a,g,h,Z,P,O,r]);const I=(0,i.useRef)(L=>"default");(0,i.useEffect)(()=>{I.current=L=>{if(!L)return"default";const b=d.getFeatureById(L);return b?s&&b.__typename==="LineAnnotation"?C(b)?"alias":"not-allowed":h?h.allowedClasses.some(N=>N===b.type)?"alias":"not-allowed":"pointer":"default"}},[s,C,d,h]);const x=(0,i.useMemo)(()=>({onClick(L){f.current(L)},cursorOverride(L){return I.current(L)}}),[f,I]);return(0,t.jsx)(v.Provider,{value:x,children:u.children})}function E(){return(0,i.useContext)(v)}},52122:function(J,B,e){"use strict";e.d(B,{Av:function(){return T},CA:function(){return o},dr:function(){return M},mY:function(){return A}});var t=e(10081),i=e(56223);const l=(0,i.createContext)(null);function o(y){const[_,D]=(0,i.useState)(null),v=(0,i.useMemo)(()=>({callbacks:_,setCallbacks:D}),[_]);return(0,t.jsx)(l.Provider,{value:v,children:y.children})}function M(){const y=(0,i.useContext)(l);if(!y)throw new Error("useStencilizedResampleSelectionCallbacks must be used within a StencilizedResampleSelectionProvider");return y}function T(){const{callbacks:y}=M();return y!==null}const m=()=>{console.error("Toggle line exclusion was called while not in expanse stage")};function A(){const{callbacks:y}=M();return(0,i.useCallback)(_=>{var D;((D=y?.toggleLineExclusion)!==null&&D!==void 0?D:m)(_)},[y])}},11662:function(J,B,e){"use strict";e.d(B,{Zk:function(){return l},pd:function(){return M},xG:function(){return o}});var t=e(17925),i=e(54327);const l={TOOL_DRAW:"command:tool-object-draw",TOGGLE_IMAGE:"object:toggle-image",TOGGLE_PERSPECTIVE:"object:toggle-perspective",SHOW_FACE_NAMES:"object:show-face-names",HIDE_FACE_NAMES:"object:hide-face-names",SHOW_FACE_CENTERS:"object:show-face-centers",HIDE_FACE_CENTERS:"object:hide-face-centers"};(0,t.UJ)(l.TOOL_DRAW,{label:"Draw object"}),(0,t.UJ)(l.TOGGLE_IMAGE,{label:"Toggle image"}),(0,t.UJ)(l.TOGGLE_PERSPECTIVE,{label:"Toggle perspective"}),(0,t.UJ)(l.SHOW_FACE_NAMES,{label:"Show object face names (hold)"}),(0,t.UJ)(l.HIDE_FACE_NAMES,{label:"Hide object face names (release)"}),(0,t.UJ)(l.SHOW_FACE_CENTERS,{label:"Show object face centers (hold)"}),(0,t.UJ)(l.HIDE_FACE_CENTERS,{label:"Hide object face centers (release)"});const o={"body:not([data-mouse-right])":{b:l.TOOL_DRAW},"body[feature-selected]:not([data-mouse-right])":{"shift-i":l.TOGGLE_IMAGE,"shift-v":l.TOGGLE_PERSPECTIVE,"shift-f":l.SHOW_FACE_NAMES,"^shift-f":l.HIDE_FACE_NAMES,g:l.SHOW_FACE_CENTERS,"^g":l.HIDE_FACE_CENTERS}};function M(){return(0,i.q)(o)}},48242:function(J,B,e){"use strict";e.d(B,{X:function(){return o}});var t=e(64597),i=e(81202),l=e(90345);function o(T,m){for(const _ of T)if((0,i.h)(_))return{lines:[],canMerge:!1,errorMessage:"Cannot merge: Line ".concat(_.id," is not eligible (may be reviewed/approved)")};const A=[];for(const _ of T){const D=M(_,m);A.push(D)}const y=A.length>=1&&A.length<=2;return{lines:A,canMerge:y,errorMessage:y?void 0:"Cannot merge: ".concat(A.length," lines selected")}}function M(T,m){const A=D=>
1{const v=(0,t.normalizeLineIdFromDiffModes)(D.lineId),n=(0,t.normalizeLineIdFromDiffModes)(T.id);return v===n},y=m.filter(D=>{if(!A(D))return!1;const v=D.vertexIndex===0,n=D.vertexIndex===T.coords.length-1;return v||n}),_=m.filter(A);if(y.length===1&&_.length===1){const v=y[0].vertexIndex===0?0:-1;return{line:T,constraint:l.k.FIXED_ENDPOINT,fixedEndpoint:v}}else return{line:T,constraint:l.k.FREE}}},35865:function(J,B,e){"use strict";e.d(B,{u:function(){return Z}});var t=e(56223),i=e(82039),l=e(51450),o=e(76470),M=e(42112),T=e(35812);class m{selectStrategy(a){for(const f of this.strategies)if(f.canExecute(a))return f;return null}async executeMerge(a){const f=this.selectStrategy(a);if(!f)try{throw this.diagnoseSelectionIssue(a),new M.GW}catch(I){const x=(0,M.lU)(I),L={success:!1,mergedLineIds:[],deletedLineIds:[],errorMessage:x};return this.showErrorToast(this.getErrorMessage(L)),L}this.currentStrategy=f;try{const I=await f.execute(a);return I.success?this.showSuccessToast(I):this.showErrorToast(this.getErrorMessage(I)),I}catch(I){const x=(0,M.lU)(I),L={success:!1,mergedLineIds:[],deletedLineIds:[],errorMessage:x};return this.showErrorToast(this.getErrorMessage(L)),L}finally{this.currentStrategy=null}}canMerge(a){return this.selectStrategy(a)!==null}getCurrentStrategy(){return this.currentStrategy}diagnoseSelectionIssue(a){const f=a.selectedLines.length,I=!!a.targetLineId;if(f===0)throw new M.kC;if(f===1&&!I)throw new M.tg;if(f===1&&I)throw new M.Mf;if(f===2&&I)throw new M.cO;if(f===2&&!I){const[x,L]=a.selectedLines;(0,T.z)(x,L,a.attributeTemplate)}throw f>2?new M.L8(f):new M.GW}showSuccessToast(a){const f=a.successMessage||"Lines merged successfully";o.Z.show({message:f,intent:"success"})}showErrorToast(a){o.Z.show({message:a,intent:"danger"})}getErrorMessage(a){return a.errorMessage?a.errorMessage:"Join failed"}constructor(a){this.strategies=a,this.currentStrategy=null}}var A=e(44789),y=e(48242),_=e(90345),D=e(97736);class v{canExecute(a){if(!(a.selectedLines.length===2)||!!a.targetLineId)return!1;const[x,L]=a.selectedLines;return(0,A.Aw)(x,L,a.attributeTemplate)}async execute(a){try{const f=(0,y.X)(a.selectedLines,a.selectedVertices);if(!f.canMerge)throw f.errorMessage?new M.p8(f.errorMessage):new M.fS;const[I,x]=f.lines,L=I.line,b=x.line;(0,T.z)(L,b,a.attributeTemplate);const N=this.extractEndpointConstraint(I),U=this.extractEndpointConstraint(x),{line1Endpoint:j,line2Endpoint:w}=(0,D.hK)({line1Constraint:N,line2Constraint:U,line1:L,line2:b}),Q=(0,D.mm)(L,b,a.attributeTemplate);if(!Q)throw console.warn("\u26A0\uFE0F Merged attributes validation failed"),new M.ky;const X=this.shouldUseDirectMergeForConstraints(I,x),k=await(0,D.Wv)({line1:L,line2:b,line1Endpoint:j,line2Endpoint:w,useDirectMerge:X});if(!k)throw console.warn("\u26A0\uFE0F Geometric merge returned null"),new M.eA;return await(0,D.bh)({line1:L,line2:b,mergedAttributes:Q,mergedCoords:k,updateLine:this.updateLine}),(0,D.QR)({actionName:"direct merge",line1:L,line2:b,currentSelection:a.selectionState,dispatch:this.dispatch}),{success:!0,mergedLineIds:[L.id],deletedLineIds:[b.id],successMessage:"Successfully merged 2 lines into 1 line"}}catch(f){throw console.error("\u274C Direct merge failed:",f),f instanceof Error?f:new M.pm("Unknown error during merge")}}getDescription(){return"Direct merge of 2 compatible lines"}extractEndpointConstraint(a){return a.constraint===_.k.FIXED_ENDPOINT?a.fixedEndpoint:null}shouldUseDirectMergeForConstraints(a,f){const I=a?.constraint===_.k.FIXED_ENDPOINT,x=f?.constraint===_.k.FIXED_ENDPOINT;return I||x}constructor(a,f,I){this.updateLine=a,this.featuresManager=f,this.dispatch=I}}class n{canExecute(a){const f=a.selectedLines.length===1,I=!!a.targetLineId;if(!(f&&I))return!1;const x=a.selectedLines[0],L=this.featuresManager.getFeatureById(a.targetLineId);return L&&L.__typename==="LineAnnotation"?(0,A.Aw)(x,L,a.attributeTemplate):!1}async execute(a){const f=a.selectedLines[0],I=this.featuresManager.getFeatureById(a.targetLineId);if(!I||I.__typename!=="LineAnnotation")throw new M.DT;try{(0,T.z)(f,I,a.attributeTemplate);const x=(0,D.mm)(f,I,a.attributeTemplate);
1if(!x)throw new M.ky;const{sourceEndpointIndex:L,targetEndpointIndex:b,shouldUseDirectMerge:N}=this.determineEndpointStrategy(a,f,I),U=await(0,D.Wv)({line1:f,line2:I,line1Endpoint:L||0,line2Endpoint:b,useDirectMerge:N});if(!U)throw new M.eA;return await(0,D.bh)({line1:f,line2:I,mergedAttributes:x,mergedCoords:U,updateLine:this.updateLine}),(0,D.QR)({actionName:"interactive merge",line1:f,line2:I,currentSelection:a.selectionState,dispatch:this.dispatch}),{success:!0,mergedLineIds:[f.id],deletedLineIds:[I.id],successMessage:"Successfully merged selected line into target line"}}catch(x){throw console.error("\u274C Interactive merge failed:",x),x instanceof Error?x:new M.pm(String(x))}}getDescription(){return"Interactive merge with target selection"}determineEndpointStrategy(a,f,I){let x,L,b;!!a.clickedEndpoints&&a.clickedEndpoints?(x=a.clickedEndpoints.sourceEndpoint,L=a.clickedEndpoints.targetEndpoint,b={line:f,constraint:_.k.FIXED_ENDPOINT,fixedEndpoint:x}):(b=(0,y.X)([f],a.selectedVertices).lines[0],b.constraint===_.k.FIXED_ENDPOINT?x=b.fixedEndpoint:x=null,L=(0,D.mF)(f,I,x));const U=b?.constraint===_.k.FIXED_ENDPOINT;return{sourceEndpointIndex:x,targetEndpointIndex:L,shouldUseDirectMerge:U}}constructor(a,f,I){this.updateLine=a,this.featuresManager=f,this.dispatch=I}}var E=e(81202),u=e(45030);class c{canExecute(a){return!!a.targetLineId||!(a.selectedLines.length>2)?!1:this.groupLinesByType(a.selectedLines,a.attributeTemplate).filter(N=>N.lines.length===2&&(0,A.Aw)(N.lines[0],N.lines[1],a.attributeTemplate)).length>0}async execute(a){try{const I=this.groupLinesByType(a.selectedLines,a.attributeTemplate).filter(N=>N.lines.length===2&&(0,A.Aw)(N.lines[0],N.lines[1],a.attributeTemplate));if(I.length===0)throw new M.L8(a.selectedLines.length);const x={mergedLineIds:[],deletedLineIds:[],undoActions:[{kind:"selection-state",oldSelectionState:a.selectionState}]},L={successfulMergeCount:0,failedMergeCount:0,mergedLineTypes:[]};for(const N of I)(await this.executeSingleGroupMerge(N,a,x,L)).wasSuccessful||console.warn("Failed to merge ".concat(N.type," lines: ").concat(N.lines[0].id," + ").concat(N.lines[1].id));if(x.undoActions.length>0){const N=I.map(U=>U.type).join(", ");this.dispatch((0,u.u7)("multi-group merge (".concat(N,")"),x.undoActions))}const b=this.buildSuccessMessage(a,L);return{success:!0,mergedLineIds:x.mergedLineIds,deletedLineIds:x.deletedLineIds,successMessage:b}}catch(f){throw console.error("\u274C Multi-group merge failed:",f),f instanceof Error?f:new M.pm(String(f))}}getDescription(){return"Multi-group merge of compatible line pairs by type"}groupLinesByType(a,f){const I=[],x=this.filterEligibleLines(a),L=this.organizeLinesByType(x);for(const[b,N]of L){const U=this.createCompatibilityGroups(N,f);for(const j of U)I.push({type:b,lines:j})}return I}filterEligibleLines(a){return a.filter(f=>!(0,E.h)(f))}organizeLinesByType(a){const f=new Map;for(const I of a){const x=I.type;f.has(x)||f.set(x,[]),f.get(x).push(I)}return f}createCompatibilityGroups(a,f){if(a.length<=1)return[a];const x=this.buildCompatibilityGraph(a,f),L=new Set,b=[];for(const N of a)if(!L.has(N.id)){const j=this.findConnectedComponent(N.id,x,L,a);j.length>0&&b.push(j)}return b}buildCompatibilityGraph(a,f){const I=new Map;for(let x=0;x<a.length;x++){const L=a[x];I.set(L.id,new Set);for(let b=x+1;b<a.length;b++){const N=a[b];(0,A.Aw)(L,N,f)&&(I.has(N.id)||I.set(N.id,new Set),I.get(L.id).add(N.id),I.get(N.id).add(L.id))}}return I}findConnectedComponent(a,f,I,x){const L=[],b=[a];for(;b.length>0;){const N=b.pop();if(I.has(N))continue;I.add(N);const j=x.find(Q=>Q.id===N);if(!!j){L.push(j);const Q=f.get(N)||new Set;for(const X of Q)!I.has(X)&&b.push(X)}}return L}async executeSingleGroupMerge(a,f,I,x){const[L,b]=a.lines,N=(0,D.mm)(L,b,f.attributeTemplate);if(!N)return x.failedMergeCount++,{wasSuccessful:!1};const U=(0,D.UH)(L,f.selectedVertices),j=(0,D.UH)(b,f.selectedVertices),{line1Endpoint:w,line2Endpoint:Q}=(0,D.hK)({line1Constraint:U,line2Constraint:j,line1:L,line2:b}),X=U!==null||j!==null,k=await(0,D.Wv)({line1:L,line2:b,line1Endpoint:w,line2Endpoint:Q,useDirectMerge:X});return k?(await(0,D.bh)({line1:L,line2:b,mergedAttributes:N,mergedCoords:k,updateLine:this.updateLine}),I.mergedLineIds.push(L.id),I.deletedLineIds.push(b.id),x.successfulMergeCount++,x.mergedLineTypes.push(a.type),I.undoActions.push({kind:"update-object",id:b.id,oldState:b},{kind:"update-object",id:L.id,oldState:L}),{wasSuccessful:!0}
1):(x.failedMergeCount++,{wasSuccessful:!1})}buildSuccessMessage(a,f){const I=a.selectedLines.length,x=f.successfulMergeCount*2,L=f.successfulMergeCount,b=I-x;let N="";if(f.successfulMergeCount>0){const U=f.mergedLineTypes.length>1?f.mergedLineTypes.slice(0,-1).join(", ")+" and "+f.mergedLineTypes.slice(-1)[0]:f.mergedLineTypes[0];N="Successfully merged ".concat(x," lines into ").concat(L," line").concat(L===1?"":"s"),b>0&&(N+=". ".concat(b," line").concat(b===1?"":"s"," could not be merged (incompatible or unpaired)"))}return N}constructor(a,f,I){this.updateLine=a,this.featuresManager=f,this.dispatch=I}}var d=e(27453),r=e(70978),s=e(64597),C=e(69370),p=e(95527),g=e(72921);function P(){var R;const a=(0,l.ug)(),f=(0,r.Ul)(),I=(0,d.gD)(),x=(0,g.TP)(),L=(0,i.CG)(X=>X.selection.selected),b=(0,t.useMemo)(()=>{const X=new Set,k=[];for(const F of I){const W=(0,s.normalizeLineIdFromDiffModes)(F.lineId);X.add(W)}for(const F of X){const W=a.getFeatureById(F);W&&W.__typename==="LineAnnotation"&&k.push(W)}return k},[I,a]),N=(0,t.useMemo)(()=>{const X=new Map;for(const k of f)X.set(k.id,k);for(const k of b)X.set(k.id,k);return Array.from(X.values())},[f,b]);var U;const j=(U=(R=N[0])===null||R===void 0?void 0:R.annotationLayerId)!==null&&U!==void 0?U:"";var w;const Q=(w=(0,p.ow)(j))!==null&&w!==void 0?w:C.b5;return(0,t.useMemo)(()=>({selectedLines:N,selectedVertices:I,attributeTemplate:Q,targetLineId:x||void 0,selectionState:L}),[N,I,Q,x,L])}var h=e(91755);function O(){const{deselect:R,add:a}=(0,h.c)();return(0,t.useCallback)(function(I,x){if(!I.success)return;const L=new Set([...I.mergedLineIds,...I.deletedLineIds]),b=x.selectedLines.filter(U=>L.has(U.id)).map(U=>({id:U.id,__typename:"LineAnnotation"})),N=x.selectedVertices.filter(U=>L.has(U.lineId)).map(U=>({id:"".concat(U.lineId,"-").concat(U.vertexIndex),type:"vertex",lineId:U.lineId,vertexIndex:U.vertexIndex}));if((b.length>0||N.length>0)&&R([...b,...N]),I.mergedLineIds.length>0){const U=x.selectedLines.filter(j=>I.mergedLineIds.includes(j.id)).map(j=>({id:j.id,__typename:"LineAnnotation"}));U.length>0&&a(U)}},[R,a])}function Z(){const R=(0,l.Qz)(),a=(0,l.ug)(),f=(0,i.TL)(),I=O(),x=(0,t.useMemo)(()=>new m([new c(R,a,f),new v(R,a,f),new n(R,a,f)]),[R,a,f]),L=P(),b=(0,t.useMemo)(()=>x.canMerge(L),[x,L]),N=(0,t.useCallback)(async()=>{const j=await x.executeMerge(L);return I(j,L),j},[x,L,I]),U=(0,t.useCallback)(()=>x.getCurrentStrategy(),[x]);return{controller:x,mergeContext:L,canMerge:b,executeMerge:N,getCurrentStrategy:U}}},78600:function(J,B,e){"use strict";e.d(B,{S:function(){return g}});var t=e(76470),i=e(27453),l=e(94282),o=e(56223),M=e(82039),T=e(69370),m=e(95527),A=e(44789),y=e(51450),_=e(72921),D=e(43274),v=e(66842),n=e(7137),E=e(88422),u=e(22101),c=e(48242),d=e(90345),r=e(42112),s=e(97736),C=e(35812),p=e(35865);function g(P){const h=(0,M.TL)(),O=(0,_.TP)(),{controller:Z,mergeContext:R}=(0,p.u)(),{select:a}=(0,i.cH)(),f=(0,i.gD)(),I=(0,y.ug)(),x=O?I.getFeatureById(O):null,L=x&&x.__typename==="LineAnnotation"?x.projectFileId:null,b=(0,l.OL)(L??""),N=!!O,U=P&&O===P.id;var j,w;const Q=(w=(0,m.ow)((j=P?.annotationLayerId)!==null&&j!==void 0?j:""))!==null&&w!==void 0?w:T.b5,X=(0,o.useMemo)(()=>{if(!U||!P||!f)return null;try{var oe;const re=(0,c.X)([P],f);if(re?.canMerge&&((oe=re.lines)===null||oe===void 0?void 0:oe.length)>0)return re.lines[0]}catch(re){console.error("Error in constraint detection for visual:",re)}return null},[P,f,U]),k=(0,o.useMemo)(()=>{if(X?.constraint===d.k.FIXED_ENDPOINT&&X.fixedEndpoint!==void 0)return X.fixedEndpoint===0?v.B4.FIRST:v.B4.LAST},[X]),F=(0,o.useCallback)((oe,re,ce)=>{if(!P)return null;const me=(0,D.It)(oe,re,ce,n.Bn);return!me||me.type!=="line"||me.subType!=="endpoint"||me.line.id===P.id||!(0,A.Aw)(P,re.line,Q)?null:me},[P,Q]),W=(0,o.useMemo)(()=>({adjust:F,maxDistance:10,shouldIgnoreSelectedLine:!0}),[F]),z=(0,E.ZP)(W),V=(0,u.Z)({snapper:z,snapPreset:v.Nu.MUST_SNAP}),G=(0,o.useCallback)(oe=>{if(!O||oe.id===O)return!1;const re={...R,targetLineId:oe.id};return Z.canMerge(re)},[O,R,Z]),$=(0,o.useCallback)(oe=>{if(!O)return"Lines are not compatible for merging";const re=R.selectedLines.find(ce=>ce.id===O);if(!re)return"Lines are not compatible for merging";try{return(0,C.z)(re,oe,R.attributeTemplate),"Lines are not compatible for merging"}catch(ce){return(0,r.lU)(ce)}},[O,R]),ee=(0,o.useCallback)(async(oe,re,ce)=>{if(!O||!P||P.id===oe.id)return!1;try{const me={...R,selectedLines:[P],targetLineId:oe.id,clickedEndpoints:{sourceEndpoint:re,targetEndpoint:ce}},ae=await Z.executeMerge(me);return ae.success?(h((0,_.XR)()),a({id:ae.mergedLineIds[0],__typename:"LineAnnotation"}),!0):!1}catch(me){return console.error("Precise merge failed:",me),!1}},[O,P,R,Z,h,a]),Me=(0,o.useCallback)(async(oe,re)=>{if(!O)return!1;try{const ce={...R,targetLineId:oe.id,clickedEndpoints:re};return(await Z.executeMerge(ce)).success?(h((0,_.XR)()),!0):!1}catch(ce){return console.error("Simple merge failed:",ce),!1}},[O,R,Z,h]),De=(0,o.useCallback)(async(oe,re)=>{if(!G(oe)){const me=$(oe);return t.Z.show({message:me,intent:"danger"}),!1}let ce;return x&&x.__typename==="LineAnnotation"&&re&&b&&(ce=(0,s.$Y)(x,oe,re,b)),await Me(oe,ce)},[G,Me,$,x,b]),Oe=(0,o.useCallback)((oe,re,ce)=>{if(!ce||ce.type!=="line"||!P)return;h((0,_.XR)());const me=oe===0?0:-1,ae=ce.segmentStart===0&&ce.segmentT===0?0:-1;ee(ce.line,me,ae)},[h,P,ee]);return{isInMergeMode:N,isTargetSplineInMergeMode:U,fixedSourceEndpoint:k,constraintInfo:X,mergeGetDrawingData:V,canMerge:G,getIncompatibilityReason:$,executeSimpleMerge:Me,executePreciseMerge:ee,attemptMerge:De,handleAddMergePoint:Oe}}},90345:function(J,B,e){"use strict";e.d(B,{k:function(){return t}});var t;(function(i){i.FIXED_ENDPOINT="FIXED_ENDPOINT",i.FREE="FREE"})(t||(t={}))},42112:function(J,B,e){"use strict";e.d(B,{DT:function(){return r},GW:function(){return u},IP:function(){return l},L8:function(){return E},Le:function(){return y},Mf:function(){return v},Mv:function(){return c},Oe:function(){return d},X$:function(){return o},cO:function(){return n},e0:function(){return T},eA:function(){return _},fS:function(){return C},hv:function(){return g},kC:function(){return i},ky:function(){return A},lU:function(){return P},p8:function(){return s},pm:function(){return p},q:function(){return M},tg:function(){return D},zK:function(){return m}});
1class t extends Error{}class i extends t{getUserMessage(){return"Cannot join: no lines selected"}constructor(){super("Cannot join: no lines selected"),this.code="NO_SELECTION"}}class l extends t{getUserMessage(){return"Cannot join: selected line has been reviewed"}constructor(){super("Cannot join: selected line has been reviewed"),this.code="MERGING_REVIEWED_LINE"}}class o extends t{getUserMessage(){return"Cannot join: a line cannot be joined with itself"}constructor(){super("Cannot join: a line cannot be joined with itself"),this.code="MERGING_SELF"}}class M extends t{getUserMessage(){return"Cannot join: lines are from different datasets"}constructor(){super("Cannot join: lines are from different datasets"),this.code="DIFFERENT_PROJECT_FILES"}}class T extends t{getUserMessage(){return"Cannot join: lines are on different layers"}constructor(){super("Cannot join: lines are on different layers"),this.code="DIFFERENT_LAYERS"}}class m extends t{getUserMessage(){return"Cannot join: lines have different types"}constructor(){super("Cannot join: lines have different types"),this.code="INCOMPATIBLE_TYPES"}}class A extends t{getUserMessage(){return"Cannot join: lines have incompatible attributes"}constructor(){super("Cannot join: lines have incompatible attributes"),this.code="INCOMPATIBLE_ATTRIBUTES"}}class y extends t{getUserMessage(){return"Cannot join: lines have incompatible properties"}constructor(){super("Cannot join: lines have incompatible properties"),this.code="INCOMPATIBLE_SUBATTRIBUTES"}}class _ extends t{getUserMessage(){return"Cannot join: unable to connect line geometries"}constructor(){super("Cannot join: unable to connect line geometries"),this.code="GEOMETRY_MERGE_FAILED"}}class D extends t{getUserMessage(){return"Cannot join: select a target line"}constructor(){super("Cannot join: select a target line"),this.code="SINGLE_LINE_NEEDS_TARGET"}}class v extends t{getUserMessage(){return"Cannot join: selected lines may be incompatible"}constructor(){super("Cannot join: selected lines may be incompatible"),this.code="ONE_LINE_INCOMPATIBLE"}}class n extends t{getUserMessage(){return"Cannot join: clear target or select only one line"}constructor(){super("Cannot join: clear target or select only one line"),this.code="TWO_LINES_WITH_TARGET"}}class E extends t{getUserMessage(){return this.message}constructor(O){const Z=O!=null?"Cannot join: ".concat(O," lines selected with no compatible pairs"):"Cannot join: no compatible pairs";super(Z),this.code="MULTI_NO_COMPATIBLE_PAIRS"}}class u extends t{getUserMessage(){return"Cannot join: unknown selection state"}constructor(){super("Cannot join: unknown selection state"),this.code="UNKNOWN_SELECTION"}}class c extends t{getUserMessage(){return"Cannot join: selected line is not eligible"}constructor(){super("Cannot join: selected line is not eligible"),this.code="INELIGIBLE_LINE"}}class d extends t{getUserMessage(){return"Cannot join: selected line is reviewed"}constructor(){super("Cannot join: selected line is reviewed"),this.code="LINE_REVIEWED"}}class r extends t{getUserMessage(){return"Cannot join: target line not found"}constructor(){super("Cannot join: target line not found"),this.code="TARGET_NOT_FOUND"}}class s extends t{getUserMessage(){return this.message}constructor(O){super(O||"Cannot join: selected lines are not compatible"),this.code="VALIDATION_ERROR"}}class C extends t{getUserMessage(){return"Cannot join"}constructor(){super("Cannot join"),this.code="GENERIC_CANNOT_MERGE"}}class p extends t{getUserMessage(){return"Cannot join: unexpected error"}constructor(O){super(O||"Cannot join: unexpected error"),this.code="EXCEPTION"}}function g(h){return h instanceof t}function P(h){return g(h)?h.getUserMessage():h instanceof Error?h.message:"An unexpected error occurred during join"}},97736:function(J,B,e){"use strict";e.d(B,{$Y:function(){return A},QR:function(){return c},UH:function(){return n},Wv:function(){return _},bh:function(){return u},hK:function(){return v},mF:function(){return D},mm:function(){return E}});var t=e(51282),i=e(44789),l=e(67112),o=e(45030),M=e(42112);function T(r){let{line1:s,line2:C,line1Endpoint:p,line2Endpoint:g}=r;const P=p===0,h=g===0;let O;return P&&h?O=[...s.coords.slice().reverse(),...C.coords]:P&&!h?O=[...s.coords.slice().reverse(),...C.coords.slice().reverse()]:!P&&h?O=[...s.coords,...C.coords]:O=[...s.coords,...C.coords.slice().reverse()],O}function m(r){let{sourceLine:s,targetLine:C,sourceEndpoint:p}=r;const g=p===0?new t.Z(s.coords[0].x,s.coords[0].y,s.coords[0].z):new t.Z(s.coords[s.coords.length-1].x,s.coords[s.coords.length-1].y,s.coords[s.coords.length-1].z),P=new t.Z(C.coords[0].x,C.coords[0].y,C.coords[0].z),h=new t.Z(C.coords[C.coords.length-1].x,C.coords[C.coords.length-1].y,C.coords[C.coords.length-1].z),O=t.Z.distance(g,P),Z=t.Z.distance(g,h);return O<Z?0:-1}function A(r,s,C,p){const g=new t.Z(r.coords[0].x,r.coords[0].y,r.coords[0].z),P=new t.Z(r.coords[r.coords.length-1].x,r.coords[r.coords.length-1].y,r.coords[r.coords.length-1].z),h=p.ecef_from_project_point(g),O=p.ecef_from_project_point(P),Z=t.Z.distance(C,h),R=t.Z.distance(C,O),a=Z<R?0:-1,f=new t.Z(s.coords[0].x,s.coords[0].y,s.coords[0].z),I=new t.Z(s.coords[s.coords.length-1].x,s.coords[s.coords.length-1].y,s.coords[s.coords.length-1].z),x=p.ecef_from_project_point(f),L=p.ecef_from_project_point(I),b=t.Z.distance(C,x),N=t.Z.distance(C,L),U=b<N?0:-1;return{sourceEndpoint:a,targetEndpoint:U}}function y(r,s){const C=new t.Z(r.coords[0].x,r.coords[0].y,r.coords[0].z),p=new t.Z(r.coords[r.coords.length-1].x,r.coords[r.coords.length-1].y,r.coords[r.coords.length-1].z),g=new t.Z(s.coords[0].x,s.coords[0].y,s.coords[0].z),P=new t.Z(s.coords[s.coords.length-1].x,s.coords[s.coords.length-1].y,s.coords[s.coords.length-1].z),O=[{distance:t.Z.distance(C,g),line1Ep:0,line2Ep:0},{distance:t.Z.distance(C,P),line1Ep:0,line2Ep:-1},{distance:t.Z.distance(p,g),line1Ep:-1,line2Ep:0},{distance:t.Z.distance(p,P),line1Ep:-1,line2Ep:-1}].reduce((Z,R)=>R.distance<Z.distance?R:Z);return{line1Endpoint:O.line1Ep,line2Endpoint:O.line2Ep}}async function _(r){let{line1:s,line2:C,line1Endpoint:p,line2Endpoint:g,useDirectMerge:P}=r;if(P)return T({line1:s,line2:C,line1Endpoint:p,line2Endpoint:g});{const h=s.coords.map(f=>new t.Z(f.x,f.y,f.z)),O=C.coords.map(f=>new t.Z(f.x,f.y,f.z)),Z=p===0?h.slice().reverse():h,R=g===0?O:O.slice().reverse(),a=(0,l.Z)(Z,R,{dedupeThreshold:.001});return a?a.map(f=>({x:f.x,y:f.y,z:f.z})):null}}
1function D(r,s,C){return C!==null?m({sourceLine:r,targetLine:s,sourceEndpoint:C}):y(r,s).line2Endpoint}function v(r){let{line1Constraint:s,line2Constraint:C,line1:p,line2:g}=r;return s!==null&&C!==null?{line1Endpoint:s,line2Endpoint:C}:s!==null?{line1Endpoint:s,line2Endpoint:m({sourceLine:p,targetLine:g,sourceEndpoint:s})}:C!==null?{line1Endpoint:m({sourceLine:g,targetLine:p,sourceEndpoint:C}),line2Endpoint:C}:y(p,g)}function n(r,s){const{normalizeLineIdFromDiffModes:C}=e(64597),p=s.filter(g=>{const P=C(g.lineId),h=C(r.id);if(P!==h)return!1;const O=g.vertexIndex===0,Z=g.vertexIndex===r.coords.length-1;return O||Z});return p.length===1?p[0].vertexIndex===0?0:-1:null}function E(r,s,C){return(0,i.ZP)(r,s,C)}async function u(r){let{line1:s,line2:C,mergedAttributes:p,mergedCoords:g,updateLine:P}=r;try{await Promise.all([P(s.id,{...p,coords:g}),P(C.id,{deletedAt:new Date().toISOString()})])}catch(h){throw new M.pm("Failed to update database during merge: ".concat(h instanceof Error?h.message:String(h)))}}function c(r){let{actionName:s,line1:C,line2:p,currentSelection:g,dispatch:P}=r;P((0,o.u7)(s,[{kind:"selection-state",oldSelectionState:g},{kind:"update-object",id:p.id,oldState:p},{kind:"update-object",id:C.id,oldState:C}]))}function d(r){return{success:!1,mergedLineIds:[],deletedLineIds:[],errorMessage:r}}},35812:function(J,B,e){"use strict";e.d(B,{z:function(){return o}});var t=e(44789),i=e(81202),l=e(42112);function o(M,T,m){if((0,i.h)(M)||(0,i.h)(T))throw new l.IP;if(M.id===T.id)throw new l.X$;if(M.projectFileId!==T.projectFileId)throw new l.q;if(M.annotationLayerId!==T.annotationLayerId)throw new l.e0;if(M.type!==T.type)throw new l.zK;if(!(0,t.Aw)(M,T,m))throw new l.ky}},22101:function(J,B,e){"use strict";e.d(B,{Z:function(){return A}});var t=e(56223),i=e(29931),l=e(68900),o=e(66842),M=e(10241),T=e(73920);function m(){const{scene:y}=(0,i.VQ)();return(0,t.useCallback)(_=>{if(y?.pickPositionSupported)return y.pickPosition(_.mousePosition)},[y])}function A(y){const{snapPreset:_=o.Nu.USER_DEFINED,snapper:D,canPickTerrain:v}=y??{},n=(0,l.u0)(),E=(0,T.Z)(),u=(0,M.JH)(),c=m();return(0,t.useCallback)(d=>{let r,s,C;if((_===o.Nu.MUST_SNAP||_===o.Nu.USER_DEFINED&&u!==o.bK.NO_SNAP)&&D){const g=D(d.mousePosition);r=g?.position,s=g}if(!r&&_!==o.Nu.MUST_SNAP){const g=E(d.mousePosition);g&&(r=g.position,C=g.entity,_===o.Nu.USER_DEFINED&&u!==o.bK.NO_SNAP&&(s={type:"pointcloud",position:r,distance:0,snapGuide:void 0}))}if(!r&&v&&(r=c(d)),!r)return;const p=n(r);return p.bounded&&(r=p.restrictedPosition,s=void 0),{position:r,snappedWith:s,pickTarget:C}},[n,c,D,E,u,_,v])}},42536:function(J,B,e){"use strict";e.d(B,{Z:function(){return T}});var t=e(94282),i=e(52274),l=e(56223),o=e(95527),M=e(51450);function T(m){var A,y;const _=(0,M.FU)((y=m?.objectId)!==null&&y!==void 0?y:"");var D;const v=(0,o.ow)((D=_?.annotationLayerId)!==null&&D!==void 0?D:"");var n;const E=(A=(0,t.J5)((n=_?.projectFileId)!==null&&n!==void 0?n:""))===null||A===void 0?void 0:A.visualizationMapping,u=(0,M.DP)();return(0,l.useCallback)(c=>{if(!_||!v||!m||!E)return;const d=(0,i.Ph)(_,v);if(d){if(m.target.type==="subattribute"){const r=v.schema[d].subattributes[m.target.attributeName];if(!r)return;const{updater:s}=(0,i.rV)(m.target.attributeName,r,_,v);(s.kind==="edit"||s.kind==="id")&&u(_.id,{typeAndSpec:{type:_.type,spec:{..._.spec,...s.onUpdate(c)}}})}else if(m.target.type==="intrinsicProperty"&&_.type!=="Point"){const{updater:r}=(0,i.Sg)(m.target.intrinsicPropertyKey,_);r.kind==="edit"&&u(_.id,{typeAndSpec:{type:_.type,spec:{..._.spec,...r.onUpdate(c)}}})}}},[_,v,m,E,u])}},62368:function(J,B,e){"use strict";e.d(B,{F:function(){return i}});var t=e(36105),i;(function(o){o.Cloud="cloud",o.Layer="layer",o.Measurement="measurement",o.CadFile="cadFile",o.GprAnnotation="gprAnnotation",o.DxfFile="dxfFile",o.GprSlices="gprSlices",o.Custom="custom",o.Object="object",o.Spline="spline",o.MultiselectedObjects="multiselectedObjects",o.DebugDB="debugDB",o.StencilizedResample="stencilized-resample",o.CrossSection="cross-section",o.Vertex="vertex"})(i||(i={}));class l{toNodeKey(){const M=Array.isArray(this.key)?this.key.join("-"):this.key;return"".concat(this.layerType,"-").concat(M)}zoomDistanceMultiplier(){switch(this.layerType){case"cloud":return .5;case"layer":case"cadFile":case"gprAnnotation":case"dxfFile":case"gprSlices":case"custom"
1:return 1;case"object":case"multiselectedObjects":case"measurement":case"spline":return 5;case"debugDB":case"stencilized-resample":case"cross-section":case"vertex":return 2;default:(0,t.Z)(this.layerType)}}constructor(M,T){this.key=M,this.layerType=T}}B.Z=l},7529:function(J,B,e){"use strict";e.d(B,{x:function(){return l}});var t=e(10081),i=e(514);function l(o){const{children:M,...T}=o;return M?(0,t.jsx)(i.Menu,{style:{width:202},...T,children:M}):null}},98047:function(J,B,e){"use strict";e.d(B,{H:function(){return T},T:function(){return M}});var t=e(10081),i=e(56223);const l={x:20,y:20},o=(0,i.createContext)({setTooltipContent:()=>{},setTooltipPosition:()=>{},clearTooltip:()=>{}});function M(m){const[A,y]=(0,i.useState)(null),_=(0,i.useRef)(null),D=(0,i.useCallback)((E,u)=>{const c=_.current;c&&(c.style.transform="translate(".concat(Math.round(E+l.x),"px, ").concat(Math.round(u+l.y),"px)"))},[]),v=(0,i.useCallback)(()=>{y(null)},[]),n=(0,i.useMemo)(()=>({setTooltipContent:y,setTooltipPosition:D,clearTooltip:v}),[y,D,v]);return(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(o.Provider,{value:n,children:[m.children,(0,t.jsx)("div",{ref:_,className:`pointer-events-none absolute z-tooltip rounded-sm 2 bg-bg-tooltip 3 px-2 4 py-1 5 text-body-medium text-text-tooltip `.concat(A?"block":"hidden"),children:A})]})})}function T(){return(0,i.useContext)(o)}},18507:function(J,B,e){"use strict";e.d(B,{AZ:function(){return n},lT:function(){return v}});var t=e(52274),i=e(56223),l=e(29931),o=e(36105),M=e(33567),T=e(95527),m=e(66842),A=e(98047);function y(E,u){switch(E.type){case"line":return D(E,u);case"inProgressLine":return m.Mv[E.subType];case"pointcloud":return"Point Cloud";case"restricted":return"Bounded by task";case"aligned":return E.axes.length===1?"".concat(E.axes[0].toUpperCase()," axis"):E.axes.length===2?"".concat(E.axes[0].toUpperCase(),",").concat(E.axes[1].toUpperCase()," plane"):"Aligned";case"point":return null;case"directional":return _(E);default:(0,o.Z)(E)}}function _(E){switch(E.subType){case m.sA.REFERENCE_PERPENDICULAR:return m.Mv[E.subType];case m.sA.REFERENCE_PARALLEL:return m.Mv[E.subType];default:(0,o.Z)(E.subType)}}function D(E,u){var c;const d=n(E.line,u.get((c=E.line.annotationLayerId)!==null&&c!==void 0?c:""));switch(E.subType){case m.sA.ENDPOINT:return"Endpoint of ".concat(d);case m.sA.VERTEX:return"Vertex of ".concat(d);case m.sA.PERPENDICULAR:return"Perpendicular to ".concat(d);case m.sA.MIDPOINT:return"Midpoint of ".concat(d);case m.sA.EDGE:return"Edge of ".concat(d);default:(0,o.Z)(E.subType)}}function v(){const{scene:E}=(0,l.VQ)(),{setTooltipContent:u,setTooltipPosition:c,clearTooltip:d}=(0,A.H)(),r=(0,T.Ni)();return(0,i.useEffect)(()=>()=>{d()},[d]),(0,i.useCallback)(s=>{if(!s){d();return}const C=y(s,r);if(E&&C){const p=E.cartesianToCanvasCoordinates(s.position);u(C),c(p.x,p.y)}else d()},[u,c,E,d,r])}function n(E,u){var c;const d=(c=(0,t.Ph)(E,u))!==null&&c!==void 0?c:M.di[E.type];return"".concat(d," ").concat(E.id.slice(0,4))}},32907:function(J,B,e){"use strict";e.d(B,{JI:function(){return n},Mz:function(){return v},O_:function(){return c},Wr:function(){return u},uY:function(){return d}});var t=e(79740),i=e(51282),l=e(9087),o=e(89574),M=e(15805),T=e(11044),m=e(19779),A=e(17631),y=e(24872),_=e(81985);function D(r,s){const C=t.Z.fromQuaternion(s.orientation,new t.Z),p=i.Z.normalize(t.Z.getColumn(C,0,new i.Z),new i.Z),g=i.Z.normalize(t.Z.getColumn(C,1,new i.Z),new i.Z),P=i.Z.normalize(t.Z.getColumn(C,2,new i.Z),new i.Z),h=l.Z.rayPlane(r,o.Z.fromPointNormal(s.origin,P));if(!h)return;const O=i.Z.subtract(h,s.origin,new i.Z),Z=new M.Z(i.Z.dot(O,p),i.Z.dot(O,g));if(s.isInFigure(Z))return h}function v(r,s){return D(r,{origin:s.origin,orientation:s.orientation,isInFigure:C=>M.Z.magnitudeSquared(C)<=s.radius*s.radius})}function n(r,s){return D(r,{origin:s.origin,orientation:s.orientation,isInFigure:C=>Math.abs(C.x)<=s.width/2&&Math.abs(C.y)<=s.height/2})}function E(r,s){const C=l.Z.raySphere(r,new T.Z(s.origin,s.radius));if(C)return m.Z.getPoint(r,C.start)}function u(r,s){if(!E(r,{origin:s.position.get(),radius:i.Z.maximumComponent(s.dimensions.get())/2}))return;let p,g=Number.POSITIVE_INFINITY;for(const P of[A.Yq.FRONT,A.Yq.BACK,A.Yq.LEFT,A.Yq.RIGHT,A.Yq.TOP,A.Yq.BOTTOM]){const h=(0,y.py)(s,P),O=n(r,{origin:(0,y.Zw)(s,P),orientation:(0,y.ST)(s,P),width:h.x,height:h.y});if(!O)continue;const Z=i.Z.distance(r.origin,O);Z<g&&(p={position:O,face:P},g=Z)}return p}function c(r,s,C){const p=s.cartesianToCanvasCoordinates(C.position);if(!p)return;const g=p.y-C.imageHeight/2,P=p.x-C.imageWidth/2,h=g+C.imageHeight,O=P+C.imageWidth;if(!(r.x<P||r.x>O||r.y<g||r.y>h))return C.position}function d(r,s){const C=(0,_.Z)(r,s.start,s.end);if(!(C.distance>s.width/2))return C}},69334:function(J,B,e){"use strict";e.d(B,{F:function(){return l},h:function(){return o}});var t=e(30472),i=e(51282);function l(M,T){let m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;const A=M.canvas,y=t.Z.worldToWindowCoordinates(M,T);if(!y)return!1;const _=y.x,D=y.y;return _>=-m&&_<=A.width+m&&D>=-m&&D<=A.height+m}function o(M,T){if(M.length===0||M.length===1)return 0;const m=T.canvas,A=m.width/2,y=m.height/2,D=M.map((u,c)=>{const d=t.Z.worldToWindowCoordinates(T,u),r=d!==void 0&&d.x>=0&&d.x<=m.width&&d.y>=0&&d.y<=m.height;return{index:c,screenPos:d,isVisible:r}}).filter(u=>u.isVisible&&u.screenPos);if(D.length>0){let u=D[0].index,c=1/0;for(const d of D){if(!d.screenPos)continue;const r=d.screenPos.x-A,s=d.screenPos.y-y,C=Math.sqrt(r*r+s*s);C<c&&(c=C,u=d.index)}return u}const v=T.camera.position;let n=0,E=i.Z.distance(M[0],v);for(let u=1;u<M.length;u++){const c=i.Z.distance(M[u],v);c<E&&(E=c,n=u)}return n}},7943:function(J,B,e){"use strict";e.d(B,{K:function(){return M},q:function(){return T}});var t=e(10081),i=e(514),l=e(56223),o=e(14840);function M(m){const[A,y]=(0,l.useState)(m.initialValue);var _;const D=(_=m.significantFigures)!==null&&_!==void 0?_:1;(0,l.useEffect)(()=>{y(m.initialValue)},[m.initialValue]);const v=m.shortValueNameLabel&&m.shortValueNameLabel.length>6?m.shortValueNameLabel.slice(0,6):m.shortValueNameLabel;return(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"5px",alignContent:"center"},children:[v&&(0,t.jsx)("div",{style:{width:"14%",display:"flex",alignItems:"center"},children:v}),(0,t.jsx)("div",{style:{width:v?"50%":"64%",display:"flex",alignItems:"center"},children:(0,t.jsx)(i.Slider,{min:m.min,max:m.max,stepSize:m.stepSize,value:A,onChange:n=>{y(n),m.onChange(n)},labelStepSize:m.labelStepSize,labelRenderer:m.labelStepSize?(n,E)=>(E?.isHandleTooltip,"".concat(n.toFixed(D))):!1,disabled:m.disabled})}),(0,t.jsx)("div",{style:{width:"30%"},children:(0,t.jsx)(o.u,{min:m.min,max:m.max,initialValue:A,stepSize:m.stepSize,onChange:n=>{m.onChange(n),y(n)}})})]})}function T(m){const[_,D]=(0,l.useState)(m.initialValue);var v;const n=(v=m.labelLogScale)!==null&&v!==void 0?v:10,E=Math.log(m.min)/Math.log(n),u=Math.log(m.max)/Math.log(n),c=(u-E)/1;(0,l.useEffect)(()=>{D(m.initialValue)},[m.initialValue]);const d=g=>n**((g-0)*c+E),r=g=>(Math.log(g)/Math.log(n)-E)/c+0,s=m.labelValueOverrides?new Set(m.labelValueOverrides.map(r)):new Set([r(m.min)]);if(!m.labelValueOverrides){let g=Math.ceil(E),P=n**g;for(;g<=Math.floor(u);)P=n**g,P>=m.min&&P<=m.max&&s.add(r(P)),g++;for(;P<=m.max;)s.add(r(P)),P+=n**(g-1);s.add(r(m.max))}const C=Array.from(s).sort((g,P)=>g-P),p=m.shortValueNameLabel&&m.shortValueNameLabel.length>6?m.shortValueNameLabel.slice(0,6):m.shortValueNameLabel;return(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"20px",alignContent:"center"},children:[p&&(0,t.jsx)("div",{style:{width:"14%",display:"flex",alignItems:"center"},children:p}),(0,t.jsx)("div",{style:{width:p?"50%":"64%",display:"flex",alignItems:"center"},children:(0,t.jsx)(i.Slider,{min:0,max:1,stepSize:m.stepPercentage,value:r(_),onChange:g=>{const P=d(g);D(P),m.onChange(P)},labelValues:C,labelRenderer:(g,P)=>P?.isHandleTooltip?"".concat(d(g).toFixed(1)):d(g).toFixed(2),disabled:m.disabled})}),(0,t.jsx)("div",{style:{width:"35%"},children:(0,t.jsx)(o.u,{min:m.min,max:m.max,initialValue:_,stepSize:m.stepPercentage,onChange:g=>{m.onChange(g),D(g)}})})]})}},35421:function(J,B,e){"use strict";e.d(B,{IP:function(){return m},KV:function(){return T},LD:function(){return n},QV:function(){return y},ZP:function(){return o},pJ:function(){return M},zU:function(){return D}});
5var t=e(55262),i=e(34881),l=e(56223);function o(c){const d=(0,l.useRef)(c),r=(0,l.useRef)(c);return r.current!==c&&(d.current=c,r.current=c),(0,l.useDebugValue)(r.current===d.current?"Not updated":"Updated"),(0,l.useMemo)(()=>({get:()=>d.current,set:s=>{d.current=s},original:()=>r.current}),[])}function M(c,d){return(0,l.useMemo)(()=>d?new t.Z(()=>c.get(),!1):new t.Z(c.get,!1),[c,d])}function T(c){return(0,l.useMemo)(()=>new t.Z(c.get,!1),[c])}function m(c){return(0,l.useMemo)(()=>new t.Z(()=>(0,i.sj)(c.get()),!1),[c])}function A(c,d,r){return{get:()=>d(c.get()),set:s=>r(c,s),original:()=>d(c.original())}}function y(c,d,r){return(0,l.useMemo)(()=>A(c,d,r),[c,d,r])}function _(c,d,r){return useMemo(()=>({get:()=>d(...c.map(s=>s.get())),set:s=>r(c,s),original:()=>d(...c.map(s=>s.original()))}),[c,d,r])}function D(c){const d=(0,l.useRef)(new Map),r=c.get().length,s=c.original();return(0,l.useMemo)(()=>{const C=[];d.current.forEach((p,g)=>{var P;(g>=r||c.original()[g]!==((P=d.current.get(g))===null||P===void 0?void 0:P.original()))&&d.current.delete(g)});for(let p=0;p<r;p++)d.current.has(p)||d.current.set(p,{get:()=>c.get()[p],set:g=>{const P=[...c.get()];P[p]=g,c.set(P)},original:()=>s[p]}),C.push(d.current.get(p));return C},[c,r,s])}function v(){return new Error("Attempting to set a read-only value")}function n(c,d,r){const s=(0,l.useCallback)((C,p)=>{if(r)C.set(r(p));else throw v()},[r]);return y(c,d,s)}function E(c){return{get:()=>c,set:()=>{throw v()},original:()=>c}}function u(c){return useMemo(()=>E(c),[c])}},76146:function(J,B,e){"use strict";e.d(B,{DV:function(){return E},QP:function(){return D},f_:function(){return _},iB:function(){return y}});var t=e(10081),i=e(514),l=e(56223),o=e(94598),M=e(35753),T=e(27813),m=e(15421),A=e.n(m);function y(u){return(0,t.jsx)(i.Button,{minimal:!0,icon:"cross",onClick:u,title:"Close"})}function _(){const[u,c]=(0,l.useState)(!1),d=(0,t.jsx)(i.Button,{minimal:!0,icon:u?"expand-all":"minus",onClick:()=>{c(!u)}});return[u,d]}const D=u=>
5{const c=!!(u.title||u.topbarButtons);return(0,t.jsx)(E,{...v(u.initialPosition),children:(d,r)=>(0,t.jsxs)("div",{className:A().detailBox,style:{display:"flex",...u.customPopoverStyle},ref:s=>{d(s)},children:[c&&(0,t.jsxs)("div",{className:A().header,style:u.customHeaderStyle,ref:s=>{r(s)},children:[(0,t.jsx)("div",{className:A().title,children:u.title}),(0,t.jsx)("div",{className:A().actions,children:u.topbarButtons})]}),(0,t.jsx)("div",{className:u.hideScrollbar?void 0:"".concat(A().boxScrollOuter," styled-scrollbars"),ref:c?void 0:s=>{r(s)},children:(0,t.jsx)("div",{className:A().detailBoxContents,style:{display:u.minimized?"none":"block",...u.customBodyStyle},children:u.children})})]})})};function v(u){u||(u={top:0,left:0});const c={initialTop:void 0,initialLeft:void 0,initialRight:void 0,initialBottom:void 0};return"top"in u&&(c.initialTop=u.top),"left"in u&&(c.initialLeft=u.left),"bottom"in u&&(c.initialBottom=u.bottom),"right"in u&&(c.initialRight=u.right),c}function n(u,c,d,r,s,C,p){const g=C.clientHeight-p.clientHeight,P=C.clientWidth-p.clientWidth,h=C.clientHeight;return{top:u!==void 0&&s.initialTop!==void 0?Math.max(Math.min(u,g),s.initialTop):u,right:c!==void 0&&s.initialRight!==void 0?Math.max(Math.min(c,P),s.initialRight):c,left:d!==void 0&&s.initialLeft!==void 0?Math.max(Math.min(d,P),0):d,bottom:r!==void 0&&s.initialBottom!==void 0?Math.max(Math.min(r,h),s.initialBottom):r}}function E(u){const{children:c}=u,[d,r]=(0,l.useState)(u.initialLeft),[s,C]=(0,l.useState)(u.initialBottom),[p,g]=(0,l.useState)(u.initialTop),[P,h]=(0,l.useState)(u.initialRight),O=(0,l.useRef)(null),Z=(0,l.useRef)(null),[{isDragging:R},a,f]=(0,o.c)(()=>({type:T.y.DETAIL_BOX,collect:L=>({isDragging:L.isDragging()})})),I=(0,l.useCallback)(()=>{if(!O.current||!Z.current)return;const L=n(p,P,d,s,u,O.current,Z.current);g(L.top),h(L.right),r(L.left),C(L.bottom)},[p,P,d,s,u]);(0,l.useEffect)(()=>{const L=()=>I();return window.addEventListener("resize",L),()=>window.removeEventListener("resize",L)},[I]);const[,x]=(0,M.L)(()=>({accept:T.y.DETAIL_BOX,drop:(L,b)=>{const N=b.getDifferenceFromInitialOffset();if(!N||!O.current||!Z.current)return;const U=n(p!==void 0?p+N.y:void 0,P!==void 0?P-N.x:void 0,d!==void 0?d+N.x:void 0,s!==void 0?s-N.y:void 0,u,O.current,Z.current);g(U.top),h(U.right),r(U.left),C(U.bottom)}}),[p,P,d,s,u]);return(0,t.jsx)("div",{className:A().dropArea,style:{pointerEvents:R?"all":"none"},ref:L=>{L&&(O.current=L),x(L)}
5,children:(0,t.jsx)("div",{className:A().movable,style:{top:p,right:P,left:d,bottom:s,opacity:R?0:1},children:(0,t.jsx)("div",{ref:Z,children:c(f,a)})})})}},36624:function(J,B,e){"use strict";e.d(B,{Z:function(){return t}});function t(i){let l=0;for(let o=0;o<i.length;o++){const M=i.charCodeAt(o);l=(l<<5)-l+M,l=l&l}return l}},15421:function(J){J.exports={detailBox:"draggablePopover_detailBox__s2iZJ",boxScrollOuter:"draggablePopover_boxScrollOuter__j8aRd",detailBoxContents:"draggablePopover_detailBoxContents__I3hZk",header:"draggablePopover_header__G3Y3I",title:"draggablePopover_title__DbY76",actions:"draggablePopover_actions__QTPqV",actionRow:"draggablePopover_actionRow__B2GLZ",dropArea:"draggablePopover_dropArea__gvu4V",movable:"draggablePopover_movable__Sa5k8"}}}]);})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.