1(()=>{(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4839],{53432:function(Me){function fe(d){var e=new Error("Cannot find module '"+d+"'");throw e.code="MODULE_NOT_FOUND",e}fe.keys=function(){return[]},fe.resolve=fe,fe.id=53432,Me.exports=fe},84440:function(){},73695:function(){},41402:function(){},2769:function(Me,fe,d){"use strict";d.d(fe,{M:function(){return M},U:function(){return T}});var e=d(51282);function M(V){return{type:"point",x:V.x,y:V.y,z:V.z}}function T(V){return new e.Z(V.x,V.y,V.z)}},95783:function(Me,fe,d){"use strict";d.d(fe,{Z:function(){return fp}});var e=d(10081),M=d(20460),T=d(88910);const V=[{combo:"F1",global:!0,label:"Open Documentation",onKeyDown(n){n.preventDefault(),window.open("/helpkit/login","_blank")}}];function x(){(0,M.y)(V)}var c=d(56223),W=d(64680),F=d(84493),N=d(91681),Q=d(12694),C=d(27761),te=d(41272),ne=d(20476),G=d(84544),$=d(5547),I=d(76470),R=d(70978),b=d(82039),K=d(32593),k=d(28543),de=d(70913),j=d(72921),X=d(34846);function z(n){const{toolName:t,required:o}=n;switch(o){case"exactly-one-line":return"".concat(t," - Select exactly 1 line");case"at-least-one-line":return"".concat(t," - Select at least 1 line");case"line-or-vertex-or-fishbone":return"".concat(t," - Select a line, vertex, or activate a stencil")}}function L(n,t){const o=(0,X.vg)(t);return"".concat(n," - ").concat(o)}function re(){const n=(0,b.TL)(),t=(0,j.nw)(),o=(0,R.Ul)(),s=(0,de.x)(k.TV.TOOL_ARC),i=(0,c.useCallback)(l=>{if(!l?.repeat&&o.length===1){const u=o[0];n((0,j.JH)(u.id))}},[o,n]),r=(0,c.useCallback)(()=>{n((0,j.AI)())},[n]);(0,c.useEffect)(()=>{const l=()=>{i()};return document.addEventListener(k.TV.TOOL_ARC,l),()=>{document.removeEventListener(k.TV.TOOL_ARC,l)}},[i]),(0,c.useEffect)(()=>(t&&I.Z.show({message:"Creating arc. Press Space/Enter to complete, or Esc to cancel.",intent:"primary",timeout:-1,onDismiss:r},"arc-notification"),()=>{I.Z.dismiss("arc-notification")}),[t,r]);const a=o.length!==1;return(0,e.jsx)($.VJ,{icon:K.H3M,label:a?z({toolName:"Arc",required:"exactly-one-line"}):"Arc",hotkey:s.keybinding,isSelected:t,isVisuallyDisabled:a,onChange:()=>i()})}var q=d(24565),pe=d(19232);function ce(){const n=(0,b.TL)(),t=(0,j.kb)(i=>i),o=(0,de.x)(pe._r.TOOL_CROSS_SECTION),s=(0,c.useCallback)(()=>{n((0,j.fq)({mode:"cross-section"})),n((0,q.D4)(null))},[n]);return(0,c.useEffect)(()=>{const i=()=>{s()};return document.addEventListener(pe._r.TOOL_CROSS_SECTION,i),()=>{document.removeEventListener(pe._r.TOOL_CROSS_SECTION,i)}},[s]),(0,c.useEffect)(()=>{const i=r=>{const a=r;n((0,q.D4)(a.detail.id))};return document.addEventListener("bridge:select-fishbone",i),()=>{document.removeEventListener("bridge:select-fishbone",i)}},[n]),(0,e.jsx)($.VJ,{icon:K.wWM,label:"Cross Section",hotkey:o.keybinding,isSelected:t.mode==="cross-section",onChange:s})}var m=d(51282),ve=d(4726),Te=d(27453),xe=d(94282),we=d(68900),Xe=d(63986),le=d(51450),Se=d(68371),_e=d(50568),Ue=d(45030);function ke(){const n=(0,b.TL)(),t=(0,_e.f8)(),o=(0,Te.Ul)(),s=(0,le.Qz)(),i=(0,xe.yX)(),r=(0,ve.wT)(),a=r?.scene,l=(0,we.J4)(),[u,f]=(0,c.useState)(!1),h=(0,de.x)(k.TV.TOOL_DRAPE),g=o.length===0||u,p=(0,c.useCallback)(async S=>{if(!(!a||o.length===0)){f(!0);try{await rt({lines:o,drapeType:S,scene:a,drapePreset:t,trajectories:i,updateLine:s,dispatch:n,isPointInBounds:l})}catch(E){I.Z.dismiss("line-drape-notification"),I.Z.show({message:"Error draping lines: ".concat(E instanceof Error?E.message:"Unknown error"),intent:"danger"})}finally{f(!1)}}},[a,o,t,s,i,n,l]),v=(0,c.useCallback)(()=>{p("LowestPoint")},[p]);(0,c.useEffect)(()=>{const S=()=>{v()};return document.addEventListener(k.TV.TOOL_DRAPE,S),()=>{document.removeEventListener(k.TV.TOOL_DRAPE,S)}},[v]);const y=(0,c.useMemo)(()=>[{id:"low",icon:K.vhk,label:"Low (point cloud)",onClick:()=>{p("LowestPoint")}},{id:"high",icon:K._ZW,label:"High (point cloud)",onClick:()=>{p("HighestPoint")}},{id:"drape-settings",icon:K.dHW,label:"Drape Settings",onClick:()=>{n((0,_e.y0)(!0))}}],[p,n]);return(0,e.jsx)($.R,{icon:K.s4z,label:g?u?"Drape - In progress...":z({toolName:"Drape",required:"at-least-one-line"}):"Drape",hotkey:h.keybinding,isSelected:!1,isVisuallyDisabled:g,onChange:v,items:y})}async function rt(n){const{lines:t,drapeType:o,scene:s,drapePreset:i,trajectories:r,updateLine:a,dispatch:l,isPointInBounds:u}=n,f=t.length;I.Z.show({message:"Starting to drape ".concat(f," line").concat(f>1?"s":"","..."),intent:"mach9",timeout:0},"line-drape-notification"),await new Promise(g=>setTimeout(g,0));let h=0;for(const g of t){const p=g.id.slice(0,4);I.Z.show({message:"Draping line ".concat(h+1,"/").concat(f," - ").concat(p),intent:"mach9",timeout:0},"line-drape-notification");const v=r[g.projectFileId];if(!v){console.warn("No trajectory found for project file ".concat(g.projectFileId)),h++;continue}const y=await dt({line:g,drapeType:o,scene:s,drapePreset:i,vizMapping:v.visualizationMapping,isPointInBounds:u});l((0,Ue.tR)(g.id,g)),await a(g.id,{coords:y}),h++}I.Z.dismiss("line-drape-notification"),I.Z.show({message:"Finished draping ".concat(f," line").concat(f>1?"s":""),intent:"success"})}async function dt(n){const{line:t,drapeType:o,scene:s,drapePreset:i,vizMapping:r,isPointInBounds:a}=n,l=t.coords.map(h=>{let{x:g,y:p,z:v}=h;return r.ecef_from_project_point(new m.Z(g,p,v))}),u={type:o,pickingOptions:(0,Se.E)(i)};return(await(0,Xe.sY)(s,l,a,u)).map(h=>r.project_from_ecef_point(h)).map(h=>({x:h.x,y:h.y,z:h.z}))}var ye=d(25243);function yt(){const n=(0,b.TL)(),t=(0,ye.um)(),o=(0,c.useCallback)(()=>{t?n((0,ye._H)()):(n((0,j.fq)({mode:"dtm-selection"})),n((0,ye.BN)(!0)))},[n,t]);return(0,e.jsx)($.VJ,{icon:K.Lzo,label:"DTM",isSelected:t,onChange:o})}function Lt(){const n=(0,b.TL)(),t=(0,j.pX)(),o=(0,R.Ul)(),s=(0,de.x)(k.TV.TOOL_EXTEND),i=(0,c.useCallback)(l=>{if(!l?.repeat&&o.length===1){const u=o[0];n((0,j.aY)(u.id))}},[o,n]),r=(0,c.useCallback)(()=>{n((0,j.MV)())},[n]);(0,c.useEffect)(()=>{const l=()=>{i()};return document.addEventListener(k.TV.TOOL_EXTEND,l),()=>{document.removeEventListener(k.TV.TOOL_EXTEND,l)}},[i]),(0,c.useEffect)(()=>(t&&I.Z.show({message:"Extending line. Press Space/Enter to complete, or Esc to cancel.",intent:"primary",timeout:-1,onDismiss:r},"extend-notification"),()=>{I.Z.dismiss("extend-notification")}),[t,r]);const a=o.length!==1;return(0,e.jsx)($.VJ,{icon:K.ALI,label:a?z({toolName:"Extend",required:"exactly-one-line"}):"Extend",hotkey:s.keybinding,isSelected:t,isVisuallyDisabled:a,onChange:()=>i()})}function bt(){const n=(0,b.TL)(),t=(0,j.kb)(l=>l),o=(0,xe.yX)(),s=(0,c.useMemo)(()=>Object.values(o).some(l=>l.imagesByCamera.size>0),[o]),i=(0,de.x)(pe._r.TOOL_IMAGE_FROM_POINT),r=(0,c.useCallback)(()=>{n((0,j.fq)({mode:"find-image-for-point"}))},[n]);(0,c.useEffect)(()=>{const l=()=>{r()};return document.addEventListener(pe._r.TOOL_IMAGE_FROM_POINT,l),()=>{document.removeEventListener(pe._r.TOOL_IMAGE_FROM_POINT,l)}},[r]);const a=(0,c.useMemo)(()=>[{id:"image-for-point",icon:K.qKP,label:"Image for point",onClick:()=>{n((0,j.fq)({mode:"find-image-for-point"}))},isDisabled:!s},{id:"streetview-for-point",icon:K.MoZ,label:"Google Streetview for point",onClick:()=>{n((0,j.fq)({mode:"find-image-for-point",forceStreetView:!0}))}}],[n,s]);return(0,e.jsx)($.R,{icon:K.hP$,label:"Image from point",hotkey:i.keybinding,isSelected:t.mode==="find-image-for-point",onCh
1ange:r,items:a})}var Ae=d(81202),Fe=d(35865),Ve=d(42112);function We(){const{mergeContext:n,executeMerge:t}=(0,Fe.u)(),o=(0,b.TL)(),s=(0,j.bN)(),i=(0,de.x)(k.TV.TOOL_JOIN),r=(0,c.useCallback)(async u=>{if(!u?.repeat){if(n.selectedLines.length===1&&!n.targetLineId){const f=n.selectedLines[0];if(f){if((0,Ae.h)(f)){const h=new Ve.Oe;I.Z.show({message:(0,Ve.lU)(h),intent:"danger"});return}o((0,j.Wl)(f.id));return}}try{await t()}catch(f){console.error("\u274C Merge tool failed:",f)}}},[n,t,o]),a=(0,c.useCallback)(()=>{o((0,j.XR)())},[o]);(0,c.useEffect)(()=>{const u=()=>{r()};return document.addEventListener(k.TV.TOOL_JOIN,u),()=>{document.removeEventListener(k.TV.TOOL_JOIN,u)}},[r]),(0,c.useEffect)(()=>(s&&I.Z.show({message:"Joining lines. Press Esc to cancel.",intent:"primary",timeout:-1,onDismiss:a},"merge-notification"),()=>{I.Z.dismiss("merge-notification")}),[s,a]);const l=(0,c.useCallback)(()=>{s?a():r()},[s,a,r]);return(0,e.jsx)($.VJ,{icon:K.toV,label:"Join",hotkey:i.keybinding,isSelected:s,onChange:l})}var je=d(93920);function B(){const n=(0,b.TL)(),t=(0,j.kb)(r=>r),o=(0,Te.zS)(),s=(0,le.vC)(),i=(0,c.useCallback)(()=>{const r=Array.from(o).map(a=>s.find(l=>l.id===a)).filter(a=>a!=null);n((0,je.l6)(!0)),n((0,j.fq)({mode:"matcher",initialLines:r}))},[n,o,s]);return(0,e.jsx)($.VJ,{icon:K.sKU,label:"Linear Extraction",isSelected:t.mode==="matcher",onChange:i})}var w=d(47213),O=d(52861);function A(){const n=(0,b.TL)(),t=(0,j.kb)(f=>f),o=(0,O.X9)(f=>{var h;return(h=f.modal)===null||h===void 0?void 0:h.type}),{clear:s}=(0,Te.cH)(),i=(0,X.DM)(),r=(0,w.uf)(),a=(0,j.At)(),l=(0,de.x)(k.TV.TOOL_DRAW),u=(0,c.useCallback)(()=>{i||(r?(n((0,j.fq)({mode:"line-annotation",type:r.lineType,prefill:r.prefill})),s()):n((0,O.z1)()))},[n,s,i,r]);return(0,c.useEffect)(()=>{const f=()=>{u()};return document.addEventListener(k.TV.TOOL_DRAW,f),()=>{document.removeEventListener(k.TV.TOOL_DRAW,f)}},[u]),(0,e.jsx)($.VJ,{icon:K.stm,label:i?L("Line",i):"Line",hotkey:l.keybinding,isSelected:t.mode==="line-annotation"||o==="choose-line",isVisuallyDisabled:!!i,onChange:u})}function H(){const n=(0,b.TL)(),t=(0,j.kb)(l=>l),o=(0,X.qW)(),s=o===X.Fy.IMAGE_MODE?o:void 0,i=(0,de.x)(pe._r.TOOL_MEASURE),r=(0,c.useCallback)(()=>{s||n((0,j.fq)({mode:"measurement",measurement:null}))},[n,s]);(0,c.useEffect)(()=>{const l=()=>{r()};return document.addEventListener(pe._r.TOOL_MEASURE,l),()=>{document.removeEventListener(pe._r.TOOL_MEASURE,l)}},[r]);const a=(0,c.useMemo)(()=>[{id:"distance",icon:K.KeH,label:"Distance",onClick:()=>{n((0,j.fq)({mode:"measurement",measurement:null}))}},{id:"height",icon:K.Khj,label:"Height",onClick:()=>{n((0,j.fq)({mode:"measurement-height",measurement:null}))}},{id:"polygon-area",icon:K.V7o,label:"Polygon Area",onClick:()=>{n((0,j.fq)({mode:"measurement-area",measurement:null}))}},{id:"angle",icon:K.PdS,label:"Angle",onClick:()=>{n((0,j.fq)({mode:"measurement-angle",phase:"drawing-first-line"}))}}],[n]);return(0,e.jsx)($.R,{icon:K.eO3,label:s?L("Measure",s):"Measure",hotkey:i.keybinding,isSelected:t.mode==="measurement"||t.mode==="measurement-height"||t.mode==="measurement-area"||t.mode==="measurement-angle",isVisuallyDisabled:!!s,onChange:r,items:a})}var _=d(11662),J=d(58017);function D(){const n=(0,b.TL)(),t=(0,j.kb)(f=>f),o=(0,O.X9)(f=>{var h;return(h=f.modal)===null||h===void 0?void 0:h.type}),{clear:s}=(0,Te.cH)(),i=(0,X.DB)(),r=(0,J.YV)(),a=(0,j.vy)(),l=(0,de.x)(_.Zk.TOOL_DRAW),u=(0,c.useCallback)(()=>{i||(r?(n((0,j.fq)({mode:"object-annotation",type:r.objectType,prefill:r.prefill})),s()):n((0,O.Rk)()))},[n,s,i,r]);return(0,c.useEffect)(()=>{const f=()=>{u()};return document.addEventListener(_.Zk.TOOL_DRAW,f),()=>{document.removeEventListener(_.Zk.TOOL_DRAW,f)}},[u]),(0,e.jsx)($.VJ,{icon:K.TaJ,label:i?L("Object",i):"Object",hotkey:l.keybinding,isSelected:t.mode==="object-annotation"&&t.type!=="Point"||o==="choose-object",isVisuallyDisabled:!!i,onChange:u})}var oe=d(69334),ee=d(33567),ge=d(9025);function be(){const n=(0,b.TL)(),t=(0,R.Ul)(),o=(0,R.gD)(),s=(0,le.ug)(),i=(0,w.uf)(),r=(0,de.x)(k.TV.TOOL_OFFSET),a=(0,xe.yX)(),l=(0,j.kb)(se=>se.mode),u=(0,q.Kq)(),f=(0,N.jk)(se=>se.crossSection),h=(0,ge.b)(),g=(0,ve.wT)(),p=g?.scene,v=t.length===1,y=o.length===1,S=u!==null&&f!==null,E=l==="offset",Z=(0,c.useCallback)(se=>{var he;if(!se){n((0,j.fq)({mode:"none"}));return}if(S&&i){n((0,j.fq)({mode:"offset",type:i.lineType,prefill:i.prefill}));return}if(y&&o.length===1){var ie;const Ne=o[0],Ie=s.getFeatureById(Ne.lineId);if(!Ie||Ie.__typename!=="LineAnnotation")return;const Ke=(ie=a[Ie.projectFileId])===null||ie===void 0?void 0:ie.visualizationMapping,et=Be(Ie,Ke);
1if(!et)return;h(et,Ne.vertexIndex,Ie);return}if(t.length!==1)return;const Oe=t[0],ue=s.getFeatureById(Oe.id);if(!ue||ue.__typename!=="LineAnnotation")return;const De=(he=a[ue.projectFileId])===null||he===void 0?void 0:he.visualizationMapping,Qe=Be(ue,De);if(!Qe||!p)return;const He=(0,oe.h)(Qe,p);h(Qe,He,ue)},[t,o,n,s,i,a,S,y,h,p]);(0,c.useEffect)(()=>{const se=()=>{Z(!E)};return document.addEventListener(k.TV.TOOL_OFFSET,se),()=>{document.removeEventListener(k.TV.TOOL_OFFSET,se)}},[Z,E]);const P=!i,U=!v&&!y&&!S,Y=P||U;return(0,e.jsx)($.VJ,{icon:K.Geo,label:P?"Select an active line layer to use Offset tool":U?z({toolName:"Offset",required:"line-or-vertex-or-fishbone"}):"Offset",hotkey:r.keybinding,isSelected:E,isVisuallyDisabled:Y,onChange:Z})}function Be(n,t){return(0,ee.Te)(n.type)?!n.coords||n.coords.length<2?(I.Z.show({message:"Line must have at least 2 points to offset",intent:"danger"}),null):t?n.coords.map(o=>t.ecef_from_project_point(new m.Z(o.x,o.y,o.z))):(I.Z.show({message:"Could not find visualization mapping for line",intent:"danger"}),null):(I.Z.show({message:"Cannot offset non-selectable line",intent:"danger"}),null)}function Re(){const n=(0,b.TL)(),t=(0,j.kb)(i=>i),o=(0,c.useCallback)(()=>{n((0,j.fq)({mode:"select-area",filterMode:j.ac.ALL,selectionMode:j.oW.WINDOW}))},[n]),s=(0,c.useMemo)(()=>[{id:"all",icon:K.gEN,label:"All",onClick:()=>{n((0,j.fq)({mode:"select-area",filterMode:j.ac.ALL,selectionMode:j.oW.WINDOW}))}},{id:"objects",icon:K.C$r,label:"Objects",onClick:()=>{n((0,j.fq)({mode:"select-area",filterMode:j.ac.OBJECTS,selectionMode:j.oW.WINDOW}))}},{id:"lines",icon:K.Eps,label:"Lines",onClick:()=>{n((0,j.fq)({mode:"select-area",filterMode:j.ac.LINES,selectionMode:j.oW.WINDOW}))}},{id:"vertices",icon:K.onw,label:"Vertices",onClick:()=>{n((0,j.fq)({mode:"select-area",filterMode:j.ac.VERTICES,selectionMode:j.oW.WINDOW}))}}],[n]);return(0,e.jsx)($.R,{icon:K.gEN,label:"Select area",isSelected:t.mode==="select-area",onChange:o,items:s})}function ze(){const n=(0,b.TL)(),t=(0,j.kb)(i=>i),o=(0,de.x)(k.TV.TOOL_SPLIT),s=(0,c.useCallback)(()=>{t.mode==="split"?n((0,j.fq)({mode:"none"})):n((0,j.fq)({mode:"split"}))},[n,t.mode]);return(0,c.useEffect)(()=>{const i=()=>{s()};return document.addEventListener(k.TV.TOOL_SPLIT,i),()=>{document.removeEventListener(k.TV.TOOL_SPLIT,i)}},[s]),(0,e.jsx)($.VJ,{icon:K.oHK,label:"Split",hotkey:o.keybinding,isSelected:t.mode==="split",isDisabled:!1,onChange:s})}function st(){const n=(0,b.TL)(),t=(0,j.kb)(a=>a),o=(0,Te.zS)(),s=(0,le.vC)(),{clear:i}=(0,Te.cH)(),r=(0,c.useCallback)(()=>{const a=Array.from(o).map(l=>s.find(u=>u.id===l)).filter(l=>l!=null);n((0,je.l6)(!0)),n((0,j.fq)({mode:"stencilized-resample",initialLines:a})),n((0,q.D4)(null)),i()},[n,o,s,i]);return(0,e.jsx)($.VJ,{icon:K.TTM,label:"Stencilized Resample",isSelected:t.mode==="stencilized-resample",onChange:r})}function Ze(){const n=(0,Q.ye)("useNewToolBar",!1),t=(0,ne.Z)();return n?(0,e.jsx)("div",{className:"absolute bottom-3 z-toolbar flex w-full justify-around gap-2",children:(0,e.jsx)("div",{className:"flex flex-col justify-center gap-2",children:(0,e.jsxs)($.N_,{orientation:"vertical",children:[(0,e.jsxs)(te.Z,{children:[(0,e.jsx)(D,{}),t&&(0,e.jsx)(A,{}),(0,e.jsx)(G.P,{size:"lg"}),t&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(We,{}),(0,e.jsx)(Lt,{}),(0,e.jsx)(re,{}),(0,e.jsx)(ze,{}),(0,e.jsx)(be,{}),(0,e.jsx)(C.RequireFeatureFlag,{featureFlag:"splineDraping",featureFlagDefault:!1,children:(0,e.jsx)(ke,{})})]}),(0,e.jsx)(G.P,{size:"lg"}),(0,e.jsx)(C.RequireFeatureFlag,{featureFlag:"stencilizedResampleTool",featureFlagDefault:!1,children:(0,e.jsx)(st,{})}),(0,e.jsx)(C.RequireFeatureFlag,{featureFlag:"linearExtractionTool",featureFlagDefault:!1,children:(0,e.jsx)(B,{})}),(0,e.jsx)(C.RequireFeatureFlag,{featureFlag:"dtmTool",featureFlagDefault:!1,children:(0,e.jsx)(yt,{})})]}),(0,e.jsx)(G.P,{size:"lg"}),(0,e.jsx)(Re,{}),(0,e.jsx)(H,{}),(0,e.jsx)(bt,{}),(0,e.jsx)(C.RequireFeatureFlag,{featureFlag:"crossSectionTool",featureFlagDefault:!1,children:(0,e.jsx)(ce,{})})]})})}):null}var Le=d(75057),Ye=d(56646),Mt=d(15810),Ft=d(12293),en=d(10504),kt=d(66435),qn=d(88896),Rn=d(13158);class oa{destroy(){this.stopRenderLoop(),this.canvas=void 0,this.triggerRerender=void 0,this.cameraHasChanged=void 0}setCanvas(t){this.canvas=t}setTriggerRerender(t){this.triggerRerender=t}setCameraHasChanged(t){this.cameraHasChanged=t}
1setRenderingPaused(t){this.renderingPaused=t}startRenderLoop(){this.stopRenderLoop();const t=1e3/this.checksPerSecond,o=1e3/this.minimumRendersPerSecond,s=1e3/this.maximumRendersPerSecond;let i=0,r=i,a=!1;const l=u=>{if(!a){if(!this.renderingPaused&&u-r>=t){var f,h;r=u;const p=u-i;var g;const v=(g=(f=(h=this).cameraHasChanged)===null||f===void 0?void 0:f.call(h))!==null&&g!==void 0?g:!1,y=this.canvasSizeHasChanged(),S=p>=o,E=(v||y)&&p>=s;(S||E)&&(this.rerender(),i=performance.now())}requestAnimationFrame(l)}};requestAnimationFrame(l),this.stopRenderLoop=()=>{a=!0,this.stopRenderLoop=()=>{}}}rerender(){if(this.triggerRerender&&this.canvas){const t=this.canvas.getBoundingClientRect(),o=Math.floor(t.width),s=Math.floor(t.height);o>0&&s>0&&this.triggerRerender(o,s,this.canvas)}}createCanvasSizeChangeHandler(){let t=0,o=0;return()=>{if(!this.canvas)return!1;const s=this.canvas.getBoundingClientRect(),i=Math.floor(s.width),r=Math.floor(s.height),a=i!==t||r!==o;return t=i,o=r,a}}constructor(t,o,s){this.renderingPaused=!1,this.stopRenderLoop=()=>{},this.minimumRendersPerSecond=t,this.maximumRendersPerSecond=o,this.checksPerSecond=s,this.canvasSizeHasChanged=this.createCanvasSizeChangeHandler(),this.startRenderLoop()}}function sa(n){const t=(0,T.UF)(n.initialArbRenCameraSettings),o=n.initialArbRenCameraSettings.arbRenKey,s=t.arbRenInstance;return(0,e.jsx)(Rn.MT,{arbRenKey:n.initialArbRenCameraSettings.arbRenKey,children:(0,e.jsx)(ia,{renderingPaused:n.renderingPaused,arbRenKey:o,arbRenGenerator:s,children:n.children})})}function ia(n){const t=n.arbRenGenerator,o=t?.camera,s=(0,T.It)(n.arbRenKey),i=(0,Rn.An)(),r=(0,c.useRef)(null),a=(0,c.useRef)(void 0),l=(0,c.useMemo)(()=>new oa(2,60,60),[]);var u;l.setRenderingPaused((u=n.renderingPaused)!==null&&u!==void 0?u:!1),(0,c.useEffect)(()=>{a.current=Do(o);var g;l.setCanvas((g=r.current)!==null&&g!==void 0?g:void 0),l.setCameraHasChanged(()=>{const p=aa(o,a.current);return p&&(a.current=Do(o)),p})},[o,l]),(0,c.useEffect)(()=>()=>{l.destroy()},[l]);const f=(0,c.useCallback)((g,p,v)=>{if(!t||!s)return;t.viewportWidth=g,t.viewportHeight=p;const y=t.generateRenderFromCamera(s);y&&((0,qn.xA)(y,v),i(),a.current=Do(o))},[t,s,o,i]);(0,c.useEffect)(()=>{l.setTriggerRerender(f)},[l,f]),(0,Rn.jq)(r.current);const h=(0,c.useCallback)(g=>{g.preventDefault()},[]);return(0,e.jsxs)("div",{className:"relative size-full",children:[(0,e.jsx)("canvas",{ref:r,className:"absolute left-0 top-0 z-0 size-full",tabIndex:0,style:{backgroundColor:"black"},onContextMenu:h}),(0,e.jsx)("div",{className:"pointer-events-none relative z-10 size-full",children:n.children})]})}function Do(n){if(n)return{position:n.position.clone(),direction:n.direction.clone(),up:n.up.clone(),frustum:Fs(n.frustum)}}function Fs(n){if(!(n instanceof en.Z)&&!(n instanceof kt.Z))throw new Error("Unsupported frustum type");const t=n instanceof en.Z?"perspective":"orthographic",o=n instanceof en.Z?n.fov:void 0,s=n instanceof kt.Z?n.width:void 0;return{type:t,near:n.near,far:n.far,aspectRatio:n.aspectRatio,fov:o,width:s}}function ra(n,t){const o=Fs(n);return o.type!==t.type||o.near!==t.near||o.far!==t.far||o.aspectRatio!==t.aspectRatio?!0:o.type==="perspective"&&t.type==="perspective"?o.fov!==t.fov:o.type==="orthographic"&&t.type==="orthographic"?o.width!==t.width:!1}function aa(n,t){if(!n&&!t)return!1;if(!n||!t)return!0;const o=1e-11;return!n.position.equalsEpsilon(t.position,o)||!n.direction.equalsEpsilon(t.direction,o)||!n.up.equalsEpsilon(t.up,o)||ra(n.frustum,t.frustum)}var Xt=d(2461),En=d(68717);function ca(){const n=(0,b.TL)(),t=(0,N.jk)(s=>s.crossSection),o=(0,j.kb)(s=>s.mode==="offset");return(0,c.useEffect)(()=>{o&&!t&&n((0,j.fq)({mode:"none"}))},[t,o,n]),null}var it=d(423);function la(){const n=(0,N.jk)(r=>r.currentFishboneId),t=(0,N.jk)(r=>r.previousFishboneId),o=(0,q.p0)(),s=(0,j.kb)(r=>r.mode==="matcher"),i=(0,b.TL)();return(0,c.useEffect)(()=>{if(!n||!o||!s){i((0,it.YT)([])),i((0,it.ve)([])),i((0,it.tu)()),i((0,it.Mm)(-1)),i((0,it.Iq)());return}n!==null&&t!==null&&n===t||(i((0,it.YT)(o.crossSections.map(()=>({})))),i((0,it.ve)(o.crossSections.map(()=>null))),i((0,it.tu)()),i((0,it.Mm)(-1)),i((0,it.Iq)()))},[n,t,o,i,s]),null}function da(){return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(la,{}),(0,e.jsx)(ca,{})]})}var On=d(91465),at=d(15805),sn=d(55699),It=d(86062),tn=d(4278);function ua(n,t){return t||n}function ma(){const n=(0,tn.x)(),t=(0,N.tD)(),o=(0,Xt.yu)(),s=(0,b.TL)(),i=(0,c.useRef)(null),r=(0,c.useRef)(null),a=(0,c.useMemo)(()=>n&&On.Z.WGS84.geodeticSurfaceNormal(n.origin),[n]),l=(0,c.useCallback)(p=>{r.current=p},[]),u=(0,c.useCallback)(p=>{n&&(i.current=(0,It.ZW)(p,n))},[n]),f=(0,c.useRef)(t),h=(0,N.ln)();if((0,c.useEffect)(()=>
1{if(!o||!n||!a)return;h||(i.current=null,r.current=null);var p;const v=(0,It._i)(n,h&&(p=i.current)!==null&&p!==void 0?p:at.Z.ZERO),y=h?ua(n.windowWidth,r.current):n.windowWidth;o.frustum.far=sn.h3+f.current/2,o.frustum.near=Math.max(sn.h3-f.current/2,1e-6),o.setView({destination:v,orientation:{direction:n.normal,up:a}}),o.frustum instanceof kt.Z&&(o.frustum.width=y)},[o,n,a,s,h]),(0,c.useEffect)(()=>{o&&(o.frustum.far=sn.h3+t/2,o.frustum.near=Math.max(sn.h3-t/2,1e-6),f.current=t)},[o,t]),!n||!a)return null;var g;return(0,e.jsx)(sn.Go,{direction:n.normal,up:a,onWidthUpdate:l,onPositionUpdate:u,originalWidth:(g=r.current)!==null&&g!==void 0?g:n.windowWidth})}var fa=d(88209),nt=d(35421),Ee=d(32092),Rt=d(85533),Pe=d(71177),Ln=d(32189),Nt=d(48649),jt=d(79740),Vt=d(20108),eo=d(55917),Ns=d(32907),qe=d(30594),ha=d(25506),Bs=d(49112),ft=d(65117),ks=d(80789),Et=d(37078);function to(){return(0,N.tD)()*.5+.05}function Vs(n){const{crossSection:t,id:o,show:s,polylineDisplaySpec:i,onClick:r}=n,a=Rt.Z.eastNorthUpToFixedFrame(t.origin,void 0,new Ee.Z),l=m.Z.normalize(Ee.Z.multiplyByPointAsVector(a,m.Z.UNIT_Z,new m.Z),new m.Z),u=m.Z.normalize(t.normal,new m.Z),f=m.Z.cross(u,l,new m.Z);let h=jt.Z.fromColumnMajorArray([u.x,u.y,u.z,f.x,f.y,f.z,l.x,l.y,l.z]);jt.Z.determinant(h)<0&&(h=jt.Z.fromColumnMajorArray([u.x,u.y,u.z,f.x,f.y,f.z,-l.x,-l.y,-l.z]));const g=to(),p=(0,qe.SD)(o,U=>{const Y=(0,Ns.JI)(U.mouseRay,{origin:t.origin,width:g,height:t.windowWidth,orientation:Vt.Z.fromRotationMatrix(h)});if(Y)return{id:o,point:Y}}),v=Ee.Z.inverse(a,new Ee.Z),y=(0,Et.Df)(t).map(U=>Ee.Z.multiplyByPoint(v,U,new m.Z)),S=(0,ks.Z)(y,o,i,new Bs.E(a)),E=U=>U===void 0?"default":"pointer",Z=(0,ft.tL)(),P=new eo.Z({flat:!0});return P._renderState.depthTest.enabled=!Z,(0,e.jsx)(Nt.DE,{onClick:U=>{U.primitiveId===o&&r?.(U)},ref:p,geometryInstances:S,cursorOverride:E,asynchronous:!1,show:s,appearance:P})}const Zo=.1;function ga(n){const{fishbone:t,fishboneId:o,show:s}=n,i=(0,Et.py)(t.crossSections),r=(0,b.TL)(),a=(0,ft.tL)(),l=(0,c.useMemo)(()=>{if(i.length===0)return[];const v=Rt.Z.eastNorthUpToFixedFrame(i[0],void 0,new Ee.Z),y=Ee.Z.inverse(v,new Ee.Z),S=i.map(E=>Ee.Z.multiplyByPoint(y,E,new m.Z));return(0,ks.Z)(S,o,{color:{r:.6039215686274509,g:.803921568627451,b:.19607843137254902,alpha:1},width:Zo,dash:{type:"metric",length:.1,space:.05}},new Bs.E(v))},[i,o]),u=(0,c.useMemo)(()=>{const v=new eo.Z({flat:!0});return v._renderState.depthTest.enabled=!a,v},[a]),f=(0,c.useMemo)(()=>new ha.ZP([{id:o,positions:i}]),[i,o]),h=v=>{const y=f.findPointsWithinRadiusOfRay(v.mouseRay,Zo);let S,E=1/0;for(const Z of y)Z.distance>Zo||Z.distance<E&&(E=Z.distance,S=Z);if(S)return{id:S.segmentStart.toString(),point:S.segmentPoint}},g=(0,qe.SD)("cross-section-".concat(o),h),p=(0,c.useCallback)(v=>{const y=v.position,S=+v.primitiveId;if(!y||S<0||Number.isNaN(S))return;const E=t.crossSections[S].origin,Z=t.crossSections[S+1].origin,P=m.Z.normalize(m.Z.subtract(Z,E,new m.Z),new m.Z),U={origin:y,normal:P,windowWidth:(t.crossSections[S].windowWidth+t.crossSections[S+1].windowWidth)/2},Y=[...t.crossSections];Y.splice(S+1,0,U),r((0,q.Pc)(o,{crossSections:Y}))},[t,o,r]);return(0,e.jsx)(Nt.DE,{geometryInstances:l,appearance:u,asynchronous:!1,ref:g,show:s,onRightClick:p})}function pa(n){const{fishbone:t,fishboneId:o}=n,s=(0,je.iJ)(l=>{var u;return(u=l.fishbones)!==null&&u!==void 0?u:!0}),i=(0,b.TL)(),r=(0,q.nC)(),a=to();return(0,e.jsxs)(e.Fragment,{children:[t.crossSections.map((l,u)=>{const h=u===r?{color:{r:.67578125,g:.84375,b:.8984375,alpha:.4},width:a}:{color:{r:1,g:1,b:1,alpha:.4},width:a};return(0,e.jsx)(Vs,{crossSection:l,id:"".concat(o,"-").concat(u),show:s,onClick:g=>{i((0,q.D4)(o)),i((0,N.dA)(l,o,!0))},polylineDisplaySpec:h},"".concat(o,"-").concat(u))}),(0,e.jsx)(ga,{fishbone:t,fishboneId:o,show:s})]})}function va(){const n=(0,q.Ed)();return(0,e.jsx)(e.Fragment,{children:Object.entries(n).map(t=>{let[o,s]=t;return(0,e.jsx)(pa,{fishbone:s,fishboneId:o},o)})})}var me=d(29931);const no=2,Us=.4;function Ws(n,t){const[o,s]=(0,Et.Df)(n),i=Ee.Z.multiplyByPointAsVector(Rt.Z.eastNorthUpToFixedFrame(o),m.Z.multiplyByScalar(m.Z.UNIT_Z,t,new m.Z),new m.Z),r=Ee.Z.multiplyByPointAsVector(Rt.Z.eastNorthUpToFixedFrame(s),m.Z.multiplyByScalar(m.Z.UNIT_Z,t,new m.Z),new m.Z),a=m.Z.add(o,i,new m.Z),l=m.Z.add(s,r,new m.Z);return{start:o,end:s,startTop:a,endTop:l}}function xa(n){const{crossSection:t,alpha:o}=n,{start:s,end:i,startTop:r,endTop:a}
1=Ws(t,no),l=to(),u=Pe.Z.fromCssColorString("#9ACD32");return u.alpha=o,(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Nt.ZP,{position:m.Z.lerp(s,r,.5,new m.Z),children:(0,e.jsx)(me.n,{dimensions:new m.Z(l,l,no),material:new Ln.Z(u)})}),(0,e.jsx)(Nt.ZP,{position:m.Z.lerp(i,a,.5,new m.Z),children:(0,e.jsx)(me.uz,{length:no,topRadius:l,bottomRadius:l,numberOfVerticalLines:3,material:new Ln.Z(u),slices:3})})]})}function ya(){const n=(0,tn.x)(),t=to(),o=(0,je.iJ)(s=>{var i;return(i=s.fishbones)!==null&&i!==void 0?i:!0});return n?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Vs,{crossSection:n,id:"selected-cross-section",polylineDisplaySpec:{width:t,outline:{color:{r:.3765,g:.5012,b:.1222,alpha:o?1:Us},width:.04},color:{r:.3765,g:.5012,b:.1222,alpha:o?.1:0}},show:!0}),(0,e.jsx)(xa,{crossSection:n,alpha:o?1:Us})]}):null}var St=d(70184);const oo="#9ACD3266";function Ca(n){const{position:t}=n,o=(0,nt.ZP)(t),s=(0,c.useRef)(null);return(0,St.so)([o],i=>{let[r]=i;s.current&&(s.current.style.left="".concat(r.x,"px"),s.current.style.top="".concat(r.y,"px"))}),(0,e.jsx)("div",{id:"bookend-in-cross-section",style:{position:"absolute",transform:"translate(-50%, -50%)",width:16,height:16,backgroundColor:oo,pointerEvents:"none"},ref:s})}function Ea(n){const{start:t,end:o}=n,s=(0,nt.ZP)(t),i=(0,nt.ZP)(o),r=(0,c.useRef)(null);return(0,St.so)([s,i],a=>{let[l,u]=a;if(!r.current)return;r.current.style.left="".concat(u.x,"px"),r.current.style.top="".concat(u.y,"px");const f=l.x-u.y<0?0:180;r.current.style.transform="translate(-50%, -50%) rotate(".concat(f,"deg)")}),(0,e.jsx)("div",{id:"bookend-in-cross-section",style:{position:"absolute",width:0,height:0,borderStyle:"solid",borderWidth:"10px 0px 10px 20px",borderColor:"transparent transparent transparent ".concat(oo),pointerEvents:"none"},ref:r})}function zs(n){const{position:t,color:o}=n,s=(0,nt.ZP)(t),i=(0,c.useRef)(null);return(0,St.so)([s],r=>{let[a]=r;i.current&&(i.current.style.left="".concat(a.x,"px"))}),(0,e.jsx)("div",{id:"bookend-in-cross-section",style:{position:"absolute",transform:"translate(-50%)",top:0,width:5,bottom:0,backgroundColor:o,pointerEvents:"none"},ref:i})}function Sa(){const n=(0,tn.x)();if(!n)return null;const{start:t,end:o}=Ws(n,no);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Ca,{position:t}),(0,e.jsx)(zs,{position:t,color:oo}),(0,e.jsx)(zs,{position:o,color:oo}),(0,e.jsx)(Ea,{start:t,end:o})]})}var Tt=d(16545),ja=d(41995),Bt=d(52783),fn=d(91755);function Ta(n,t,o,s){const i=m.Z.normalize(t,new m.Z),r=m.Z.normalize(s,new m.Z),a=m.Z.subtract(n,o,new m.Z),l=m.Z.dot(i,i),u=m.Z.dot(i,r),f=m.Z.dot(r,r),h=m.Z.dot(i,a),g=m.Z.dot(r,a),p=l*f-u*u;let v,y;Math.abs(p)<1e-10?(v=0,y=m.Z.dot(r,a)):(v=(u*g-f*h)/p,y=(l*g-u*h)/p);const S=m.Z.add(n,m.Z.multiplyByScalar(i,v,new m.Z),new m.Z),E=m.Z.add(o,m.Z.multiplyByScalar(r,y,new m.Z),new m.Z);return{closestOnLine1:S,closestOnLine2:E}}function Fo(n,t,o,s){const i=m.Z.normalize(m.Z.subtract(t,n,new m.Z),new m.Z),r=m.Z.normalize(m.Z.subtract(s,o,new m.Z),new m.Z),{closestOnLine1:a,closestOnLine2:l}=Ta(n,i,o,r);return{commonOrigin:m.Z.midpoint(a,l,new m.Z),direction1:i,direction2:r,closestOnLine1:a,closestOnLine2:l}}function so(n,t){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:2.5;const s=m.Z.add(n,m.Z.multiplyByScalar(t,o,new m.Z),new m.Z);return[n,s]}function An(n,t,o){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:20;const r=m.Z.clone(t);let a=m.Z.clone(o);const l=m.Z.cross(r,a,new m.Z);if(!m.Z.equalsEpsilon(l,m.Z.ZERO,1e-10))m.Z.normalize(l,l);else return{effectiveDir1:r,effectiveDir2:a,arcPositions:[]};const u=r,f=m.Z.cross(l,u,new m.Z);m.Z.normalize(f,f);let h=Math.atan2(m.Z.dot(a,f),m.Z.dot(a,u));h<0&&(h+=2*Math.PI),h>Math.PI&&(h=2*Math.PI-h,a=m.Z.negate(a,new m.Z)),h>Math.PI/2&&(h=Math.PI-h,a=m.Z.negate(a,new m.Z));const g=[];for(let p=0;p<=i;p++){const v=p/i,y=ba(r,a,v);m.Z.normalize(y,y),m.Z.multiplyByScalar(y,s,y);const S=m.Z.add(n,y,new m.Z);g.push(S)}return{effectiveDir1:r,effectiveDir2:a,arcPositions:g}}function ba(n,t,o){let s=m.Z.dot(n,t);s=Math.max(-1,Math.min(1,s));const i=Math.acos(s),r=Math.sin(i);
1if(Math.abs(r)<1e-6)return m.Z.lerp(n,t,o,new m.Z);const a=Math.sin((1-o)*i)/r,l=Math.sin(o*i)/r,u=new m.Z;m.Z.multiplyByScalar(n,a,u);const f=new m.Z;return m.Z.multiplyByScalar(t,l,f),m.Z.add(u,f,u),u}function Hs(n){if(n.length===0)return new m.Z;const t=Math.floor(n.length/2);return n[t]}var Ks=d(94988),nn=d(22852);function Pa(n){const{firstLineStart:t,firstLineEnd:o,secondLineStart:s,secondLineEnd:i,show:r}=n,a=(0,Xt.Yl)(),l=(0,c.useRef)(null),u=(0,c.useRef)(null),f=(0,c.useRef)(null),{arcPositions:h,ray1Start:g,ray1End:p,ray2Start:v,ray2End:y,labelPosition:S,angleText:E}=(0,c.useMemo)(()=>{const Oe=t.get(),ue=o.get(),De=s.get(),Qe=i.get(),He=(0,Ks.M)(Oe,ue,De,Qe),Ne="".concat(He.toFixed(1),"\xB0"),Ie=Fo(Oe,ue,De,Qe),{effectiveDir1:Ke,effectiveDir2:et,arcPositions:ae}=An(Ie.commonOrigin,Ie.direction1,Ie.direction2,1.5,20),$e=so(Ie.commonOrigin,Ke,2.5),Je=so(Ie.commonOrigin,et,2.5),xt=Hs(ae),Ge=$e[0],tt=$e[$e.length-1],gt=Je[0],ut=Je[Je.length-1];return{arcPositions:ae,ray1Start:Ge,ray1End:tt,ray2Start:gt,ray2End:ut,labelPosition:xt,angleText:Ne}},[t,o,s,i]),Z=(0,nt.ZP)(g),P=(0,nt.ZP)(p),U=(0,nt.ZP)(v),Y=(0,nt.ZP)(y),se=(0,c.useMemo)(()=>{const Oe=[];if(h.forEach(ue=>{const De={get:()=>ue,set:()=>{},original:()=>ue};Oe.push(De)}),S){const ue={get:()=>S,set:()=>{},original:()=>S};Oe.push(ue)}return Oe},[h,S]);if((0,St.so)(se,Oe=>{if(!l.current)return;const ue=h.length;if(ue>0){const De=Oe.slice(0,ue);let Qe="M ".concat(De[0].x," ").concat(De[0].y);for(let He=1;He<De.length;He++)Qe+=" L ".concat(De[He].x," ").concat(De[He].y);l.current.setAttribute("d",Qe)}if(S&&Oe.length>ue){const De=Oe[ue],Qe=E.length*8+8,He=20;u.current&&(u.current.setAttribute("x",(De.x-Qe/2).toString()),u.current.setAttribute("y",(De.y-He/2).toString()),u.current.setAttribute("width",Qe.toString()),u.current.setAttribute("height",He.toString())),f.current&&(f.current.setAttribute("x",De.x.toString()),f.current.setAttribute("y",De.y.toString()))}}),!a||!r)return null;const{width:he,height:ie}=a;return(0,e.jsxs)("div",{style:{width:"100%",height:"100%",position:"absolute",pointerEvents:"none",display:r?"block":"none",top:0,left:0},children:[(0,e.jsx)(nn.E,{firstPoint:Z,secondPoint:P,show:r,color:Qt,width:2,strokeDashArray:"8,4",selected:!1}),(0,e.jsx)(nn.E,{firstPoint:U,secondPoint:Y,show:r,color:Qt,width:2,strokeDashArray:"8,4",selected:!1}),(0,e.jsx)("svg",{width:he,height:ie,style:{overflow:"visible"},children:(0,e.jsxs)("g",{children:[(0,e.jsx)("path",{ref:l,fill:"none",stroke:Qt,strokeWidth:"3",strokeOpacity:"0.8",pointerEvents:"none"}),S&&(0,e.jsxs)("g",{children:[(0,e.jsx)("rect",{ref:u,fill:Qt,stroke:"#000000",strokeWidth:"1",rx:"3",ry:"3",pointerEvents:"none",style:{filter:"drop-shadow(0px 0px 2px rgba(0,0,0,0.3))"}}),(0,e.jsx)("text",{ref:f,fill:"#000000",fontSize:"14",fontFamily:"Inter",textAnchor:"middle",dominantBaseline:"middle",pointerEvents:"none",fontWeight:"500",children:E})]})]})})]})}const Qt="#ffff00",Dn="20,5";function Ma(){const n=(0,Tt._I)(r=>r),t=(0,tn.x)(),o=(0,N.jk)(r=>r.currentFishboneId),s=Object.values(n).filter(r=>Oa(r,t,o)),i=Object.values(n).filter(r=>r.type==="measurement-angle");return t?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(La,{}),(0,e.jsx)(Aa,{}),s.map(r=>(0,e.jsx)(Ia,{crossSection:t,measurement:r},r.id)),i.map(r=>(0,e.jsx)(wa,{crossSection:t,measurement:r},r.id))]}):null}function Ia(n){const{crossSection:t,measurement:o}=n,s=(0,je.iJ)(E=>E.measurements),i=(0,c.useMemo)(()=>(0,Bt.Rb)(o.ecefStartPosition),[o.ecefStartPosition]),r=(0,c.useMemo)(()=>(0,Bt.Rb)(o.ecefEndPosition),[o.ecefEndPosition]),a=(0,nt.ZP)(i),l=(0,nt.ZP)(r),u=(0,b.TL)(),{select:f}=(0,fn.c)(),{has:h}=(0,R.h$)(),g=(0,c.useCallback)(()=>{f(o)},[f,o]),p=(0,ft.ws)(),v=ja.d.toCssColorString(),y=(0,c.useCallback)(()=>{f(o)},[f,o]),S=(0,c.useCallback)(()=>{const E=a.get(),Z=l.get();u((0,Tt.ZL)(o.id,{ecefStartPosition:(0,Bt.Wp)(E),ecefEndPosition:(0,Bt.Wp)(Z)}))},[u,o.id,a,l]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(nn.E,{firstPoint:a,secondPoint:l,show:s,onClick:g,selected:h(o.id),color:v,width:2,strokeDashArray:Dn}),s&&h(o.id)&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(St.HK,{point:a,crossSection:t,interactionKey:"cross-section-measurement-".concat(o.id,"-start"),readonly:!1,onDragEnd:S,onClick:y,children:(0,e.jsx)(St.rd,{size:p,isSelected:!1,outlineColor:v,fill:v})}),(0,e.jsx)(St.HK,{point:l,crossSection:t,interactionKey:"cross-section-measurement-".concat(o.id,"-end"),readonly:!1,onDragEnd:S,onClick:y,children:(0,e.jsx)(St.rd,{size:p,isSelected:!1,outlineColor:v,fill:v})})]})]})}function wa(n){const{crossSection:t,measurement:o}=n,s=(0,je.iJ)(P=>P.measurements),{select:i}=(0,fn.c)(),r=(0,c.useMemo)(()=>(0,Bt.Rb)(o.firstLine.start),[o.firstLine.start]),a=(0,c.useMemo)(()=>(0,Bt.Rb)(o.firstLine.end),[o.firstLine.end]),l=(0,c.useMemo)(()=>(0,Bt.Rb)(o.secondLine.start),[o.secondLine.start]),u=(0,c.useMemo)(()=>(0,Bt.Rb)(o.secondLine.end),[o.secondLine.end]),f=(0,nt.ZP)(r),h=(0,nt.ZP)(a),g=(0,nt.ZP)(l),p=(0,nt.ZP)(u),v=(0,b.TL)(),{has:y}=(0,R.h$)(),S=(0,c.useMemo)(()=>Fo(r,a,l,u),[r,a,l,u]),E=(0,c.useCallback)(()=>{i(o)},[i,o]),Z=[{tracked:f,id:"first-start"},{tracked:h,id:"first-end"},{tracked:g,id:"second-start"},{tracked:p,id:"second-end"}];return s?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(nn.E,{firstPoint:f,secondPoint:h,show:s,color:Qt,width:2,strokeDashArray:Dn}),(0,e.jsx)(nn.E,{firstPoint:g,secondPoint:p,show:s,color:Qt,width:2,strokeDashArray:Dn}),s&&Z.map((P,U)=>(0,e.jsx)(Ra,{point:P.tracked,crossSection:t,measurementId:o.id,pointId:P.id,isSelected:y(o.id),onClick:E},P.id)),(0,e.jsx)(Pa,{firstLineStart:f,firstLineEnd:h,secondLineStart:g,secondLineEnd:p,show:s})]}):null}function Ra(n){const{point:t,crossSection:o,measurementId:s,pointId:i,isSelected:r,onClick:a}=n,l=(0,ft.ws)();return(0,e.jsx)(St.HK,{point:t,crossSection:o,interactionKey:"angle-measurement-".concat(s,"-").concat(i),readonly:!0,onClick:a,children:(0,e.jsx)(St.rd,{size:r?l*1.5:l,outlineColor:Qt,fill:Qt})})}function Oa(n,t,o){return n.type!=="cross-section-measurement"||!t?!1:o===null?n.fishboneId===null:n.fishboneId===o}function La(){const n=(0,Tt._I)(i=>i),t=(0,N.jk)(i=>i.crossSection),o=(0,c.useRef)(t),s=(0,b.TL)();return(0,c.useLayoutEffect)(()=>{(0,N.e7)(t,o.current)||(Object.entries(n).filter(r=>{let[a,l]=r;return l.type==="cross-section-measurement"&&l.fishboneId===null}).map(r=>{let[a]=r;return a}
1).forEach(r=>{s((0,Tt.mF)(r))}),o.current=t)},[t,s,n]),null}function Aa(){const n=(0,N.jk)(a=>a.crossSection),t=(0,N.jk)(a=>a.currentFishboneId),o=(0,Tt._I)(a=>a),s=(0,b.TL)(),i=(0,c.useRef)(n),r=(0,c.useRef)(t);return(0,c.useEffect)(()=>{if(t!==null&&r.current!==null&&t===r.current&&i.current&&n&&t&&!(0,N.e7)(n,i.current)){const l=(0,Tt.UO)(o,i.current,n,t);l.length>0&&s((0,Tt.Vp)(l))}i.current=n,r.current=t},[n,t,o,s]),null}var No=d(89948),Da=d(33278),Zn=d(8670),Sn=d(89574);function Za(n,t,o,s){const i=[s.start,o,s.end].filter(r=>r!==null);return i.length>=2?Fa(n,t,o,i):Na(n,t,i,o)}function Fa(n,t,o,s){const i=s.map(u=>u.segmentStart+u.segmentT);let r=Math.floor(Math.min(...i)),a=Math.ceil(Math.max(...i));if(o){const u=o.segmentStart+o.segmentT;u===r?r-=1:u===a&&(a+=1)}return[...t.slice(0,r+1),n,...t.slice(a)]}function Na(n,t,o,s){if(o.length===1&&o[0]===s){const l=[...t];return l[s.segmentStart]=n,l}const i=m.Z.distance(t[0],n),r=m.Z.distance(t[t.length-1],n),a=o.length===1?o[0].segmentStart+o[0].segmentT:null;if(i<r)if(a){const l=Math.ceil(a);return[n,...t.slice(l)]}else return[n,...t];else if(a){const l=Math.floor(a)+1;return[...t.slice(0,l),n]}else return[...t,n]}var io=d(19779),Ut=d(16042);const Ba=10,ka=10,Fn={arbRenKey:"matcher",width:1024,height:1024,nearDepth:.001,farDepth:1,pixelDataType:Ft.Z.UNSIGNED_BYTE,frustumWidth:2,kind:"orthographic"};function Va(){const n=(0,T.UF)(Fn),t=(0,Ut.n_)(o=>o);return n.status==="notReady"?null:(0,e.jsx)(e.Fragment,{children:Object.keys(t).map(o=>(0,e.jsx)(Ua,{pointCloudKey:o},o))})}function Ua(n){const{pointCloudKey:t}=n,o=(0,T.kZ)(),s=(0,c.useCallback)((i,r)=>{i.pointSize=Ba,i.brightnessModifier=ka,i.color="white"},[]);return(0,c.useEffect)(()=>{o(Fn.arbRenKey,t,s)},[o,s,t]),null}function Wa(){const n=(0,T.UF)(Fn),t=(0,T.It)(Fn.arbRenKey),o=(0,N.tD)();return(0,c.useCallback)(async(s,i)=>{const{crossSectionCameraOrigin:r,frustumWidth:a}=i;if(n.status==="notReady"||!t)throw new Error("Arbitrary render generator not ready");const l=n.arbRenInstance,u=Ee.Z.inverse((0,It.Gr)(s),new Ee.Z),f=Ee.Z.multiplyByPoint(u,r,new m.Z),h=Ee.Z.multiplyByPointAsVector(Rt.Z.eastNorthUpToFixedFrame(s.origin),m.Z.UNIT_Z,new m.Z);return l.frustumWidth=a,l.far=o,{...l.generateRenderFromRay(new io.Z(f,s.normal),t,h),viewMatrix:l.camera.viewMatrix.clone(),inverseViewMatrix:l.camera.inverseViewMatrix.clone(),ecefCameraOrigin:l.camera.positionWC}},[t,n.arbRenInstance,n.status,o])}function Bo(){const n=Wa(),t=(0,T.sZ)(Fn.arbRenKey);return(0,c.useCallback)(async(o,s)=>{if(!t)throw new Error("Could not use arbitrary render instance");const i=await n(o,s),r=document.createElement("canvas");(0,qn.xA)(i,r);const a=r.toDataURL("image/jpeg"),l=(0,Zn.fb)(new at.Z(i.width,i.height),i.inverseViewMatrix,o,t.frustumWidth);return{image:a,sectionFromImage:l,crossSection:o}},[n,t])}const za={percentagePadding:.75,minimumPadding:.5};function ko(n,t){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:za;const{percentagePadding:s,minimumPadding:i}=o;if(t.length===0)return{crossSectionCameraOrigin:new m.Z(0,0,0),frustumWidth:0};const r=t.map(Y=>Y.x),a=t.map(Y=>Y.y),l=Math.min(...r),u=Math.max(...r),f=Math.min(...a),h=Math.max(...a),g=u-l,p=h-f,v=(l+u)/2,y=(f+h)/2,S=new m.Z(v,y,-n/2),E=Math.max(g,p),Z=E*s,P=Math.max(Z,i),U=E+P*2;return{crossSectionCameraOrigin:S,frustumWidth:U}}function Ha(n,t){return n.x>t.crossSectionCameraOrigin.x-t.frustumWidth/2&&n.x<t.crossSectionCameraOrigin.x+t.frustumWidth/2&&n.y>t.crossSectionCameraOrigin.y-t.frustumWidth/2&&n.y<t.crossSectionCameraOrigin.y+t.frustumWidth/2}function Gs(){const n=(0,le.ug)(),t=(0,N.tD)();return(0,c.useCallback)((o,s,i)=>{const r=Object.keys(s).map(h=>n.getFeatureById(h)).filter(h=>!!h);let u=[...new Set(r.map(h=>h.projectFileId))].map(h=>n.lines.features.trees[h]).flatMap(h=>h.findIntersectionsWithThickPlane(Sn.Z.fromPointNormal(o.origin,o.normal),t/2).filter(g=>s[g.line.id]));if(i){const h=new m.Z,g=(0,It.Gr)(o);u=u.filter(p=>{const v=Ee.Z.multiplyByPoint(g,p.segmentPoint,h);return Ha(v,i)})}const f={};for(const h of u)if(f[h.line.id]){const g=f[h.line.id],p=m.Z.distance(g.segmentPoint,o.origin);m.Z.distance(h.segmentPoint,o.origin)<p&&(f[h.line.id]=h)}else f[h.line.id]=h;return f},[n,t])}function Ka(){const n=(0,le.Qz)(),t=(0,xe.yX)(),o=(0,le.ug)();return(0,c.useCallback)((s,i,r,a,l)=>{const u=o.getFeatureById(s),f=t[u.projectFileId].visualizationMapping,h=u.coords.map(v=>f.ecef_from_project_point(new m.Z(v.x,v.y,v.z),new m.Z)),g=Ee.Z.multiplyByPoint(r,i,new m.Z(0,0,0)),p=
1Za(g,h,a,l);return n(s,{coords:p.map(v=>f.project_from_ecef_point(v)).map(v=>({x:v.x,y:v.y,z:v.z}))}),{kind:"update-object",id:s,oldState:u}},[n,t,o])}function Ga(){const n=Gs(),t=Ka();return(0,c.useCallback)((o,s,i,r)=>{var a;const l=(a=s.crossSections[i-1])!==null&&a!==void 0?a:null,u=s.crossSections[i];var f;const h=(f=s.crossSections[i+1])!==null&&f!==void 0?f:null,g=[],p=Object.fromEntries(Object.keys(o).map(Y=>[Y,!0])),v=l?n(l,p,r):{},y=n(u,p,r),S=h?n(h,p,r):{},E=(0,It.BY)(u);for(const[Y,se]of Object.entries(o)){var Z,P,U;const he=t(Y,se,E,(Z=y[Y])!==null&&Z!==void 0?Z:null,{start:(P=v[Y])!==null&&P!==void 0?P:null,end:(U=S[Y])!==null&&U!==void 0?U:null});g.push(he)}return g},[t,n])}function Vo(n,t){return Object.fromEntries(Object.entries(n).map(o=>{let[s,i]=o;return[s,t(i)]}))}function _a(n,t){return Object.fromEntries(Object.entries(n).map(o=>{let[s,i]=o;return t(s,i)}))}function Ya(n,t){return Object.fromEntries(Object.entries(n).filter(o=>{let[s,i]=o;return t(s,i)}))}function Ja(n,t,o,s,i){const r=(0,Zn.Ne)(n,o),a=(0,Zn.kM)(r,s.filter(u=>u.score>i.scoreThreshold),i.maxDistance,i.maxPoints),l=(0,Zn.IY)(r,a,i);if(l){const u=(0,Zn.Ne)(t,l);return{crossSectionPoint:new m.Z(u.x,u.y,0),status:"set-automatically"}}else return{crossSectionPoint:o,status:"missed"}}function Xa(){const n=(0,Da.W)(),t=(0,it.E)();return(0,c.useCallback)(async(o,s,i)=>{const r=await n(o.image,s.image),a=Vo(i,l=>Ja(jt.Z.inverse(o.sectionFromImage,new jt.Z),s.sectionFromImage,l,r,t));return{inferenceResults:r,matchResults:a}},[n,t])}function ro(){const n=Gs();return(0,c.useCallback)((t,o,s)=>{const i=n(t,o),r=(0,It.Gr)(t),a=Vo(i,f=>Ee.Z.multiplyByPoint(r,f.segmentPoint,new m.Z(0,0,0))),l=Object.fromEntries(s.map((f,h)=>["line-draft-".concat(h),new m.Z(f.crossSectionPoint.x,f.crossSectionPoint.y,0)]));return{...a,...l}},[n])}function Qa(){const n=(0,b.TL)();return(0,c.useCallback)((t,o,s,i)=>{const r=_a(o,(a,l)=>[a.startsWith("line-draft-")?s[parseInt(a.split("-")[2])]:a,l.status]);n((0,it.TU)(t,r)),n((0,it.rq)(t,i))},[n])}function $a(){const n=(0,b.TL)();return(0,c.useCallback)((t,o)=>{for(const s of o)n((0,it.mj)(t,s,"set-manually")),n((0,it.V9)(s,t));n((0,it.tu)())},[n])}var Kt=d(68428);function _s(){const n=(0,q.p0)(),t=(0,it.y2)(),o=(0,it.Wy)(),s=(0,it.AE)(),i=ro(),r=(0,N.tD)(),a=(0,le.vC)(),l=(0,c.useMemo)(()=>a.filter(u=>o[u.id]).map(u=>u.version),[a,o]);return(0,c.useMemo)(()=>{var u;return!(n==null||(u=n.crossSections)===null||u===void 0)&&u[t]?ko(r,Object.values(i(n.crossSections[t],o,s))):{crossSectionCameraOrigin:new m.Z(0,0,0),frustumWidth:0}},[n?.crossSections,r,i,s,t,o,l])}function qa(){const n=(0,q.p0)(),t=(0,q.nC)(),o=_s(),s=(0,c.useMemo)(()=>{var a;if(!(!(n==null||(a=n.crossSections)===null||a===void 0)&&a[t??0]))return[];const{x:l,y:u}=o.crossSectionCameraOrigin,f=o.frustumWidth/2,h=(0,It.BY)(n.crossSections[t??0]);return[[-f,-f],[f,-f],[f,f],[-f,f]].map(p=>{let[v,y]=p;return Ee.Z.multiplyByPoint(h,new m.Z(l+v,u+y,0),new m.Z(0,0,0))})},[o.crossSectionCameraOrigin,o.frustumWidth,t,n?.crossSections]),i=(0,nt.ZP)(s),r=(0,nt.zU)(i);return o.frustumWidth===0?null:(0,e.jsx)(e.Fragment,{children:r.map((a,l)=>(0,e.jsx)(nn.E,{firstPoint:a,secondPoint:r[(l+1)%r.length],show:!0,color:Kt.wR.REFERENCE_POINT,width:4,strokeDashArray:"10,10"},"segment-".concat(l)))})}function ec(){const n=(0,tn.x)(),t=(0,it.AE)(),o=(0,it.y2)(),s=(0,q.nC)(),i=(0,j.kb)(r=>r.mode==="matcher");return!n||o===-1||!i?null:(0,e.jsxs)(e.Fragment,{children:[o===s&&t.map((r,a)=>(0,e.jsx)(tc,{lineDraft:r,index:a,crossSection:n},a)),(0,e.jsx)(qa,{})]})}function tc(n){var t;const{lineDraft:o,index:s,crossSection:i}=n,r=(0,b.TL)(),a=(0,It.BY)(i),l=new m.Z(o.crossSectionPoint.x,o.crossSectionPoint.y,0),u=Ee.Z.multiplyByPoint(a,l,new m.Z),f=(0,nt.ZP)(u),h=(0,c.useCallback)(()=>{const v=f.get(),y=Ee.Z.inverse(a,new Ee.Z),S=Ee.Z.multiplyByPoint(y,v,new m.Z),E={...o,crossSectionPoint:{x:S.x,y:S.y}};r((0,it.he)(E,s))},[f,r,s,o,a]),g=(0,c.useCallback)(()=>{r((0,it.uI)(s))},[r,s]),p=(0,c.useMemo)(()=>{var v,y;const S=(0,No.Z)({type:o.lineType,spec:(y=(v=o.prefill)===null||v===void 0?void 0:v.spec)!==null&&y!==void 0?y:{}}).color;return new Pe.Z(S.r,S.g,S.b,1).toCssColorString()},[o.lineType,(t=o.prefill)===null||t===void 0?void 0:t.spec]);return(0,e.jsx)(St.HK,{point:f,crossSection:i,show:!0,readonly:!1,onDragEnd:h,onRightClick:g,children:(0,e.jsxs)(St.xH,{children:[(0,e.jsx)(St.rd,{size:Kt.hT,isSelected:!1,outlineColor:Kt.wR.REFERENCE_POINT,maskUrl:"/assets/images/icons/matcher-border.svg",fill:Kt.wR.REFERENCE_POINT}),(0,e.jsx)(St.rd,{size:Kt.Sx,isSelected:!1,outlineColor:p,maskUrl:"/assets/images/icons/plus.svg",fill:p})]})})}var Ct=d(2769),nc=d(13123),oc=d.n(nc),sc=d(9087);function Ys(n,t,o){const s=(0,It.Gr)(t),i=Ee.Z.multiplyByPoint(s,n,new m.Z);i.x=o?.x!=null?o.x:i.x,i.y=o?.y!=null?o.y:i.y;const r=(0,It.BY)(t);return Ee.Z.multiplyByPoint(r,i,new m.Z)}function ic(n){let{onClick:t,onMouseMove:o,constraints:s}=n;const i=(0,tn.x)(),r=(0,c.useRef)(null),a=(0,Xt.yu)(),l=(0,Xt.Ke)(),[u,f]=(0,c.useState)(!1),[h,g]=(0,c.useState)(null),p=(0,Rn.An)(),v=P=>{if(!r.current||!i)return;const U=Ys(P,i,s),Y=l(U);if(Y)return g(Y),p(),o&&o(U),U},y=()=>{r.current&&f(!0)},S=P=>{if(!r.current||(f(!0),!(a&&i)))return;const U=(0,sn.b5)(P.mousePosition,a,i);U&&v(U)},E=()=>{r.current&&f(!1)},Z=P=>{if(!i||!a)return;const U=a.getPickRay(P.mousePosition);if(!U)return;const Y=Sn.Z.fromPointNormal(i.origin,i.normal),se=sc.Z.rayPlane(U,Y);if(!se)return;const he=Ys(se,i,s);t(he)};return(0,Xt.iN)("onMouseEnter",y),(0,Xt.iN)("onMouseMove",S),(0,Xt.iN)("onMouseLeave",E
1),(0,Xt.iN)("onClick",Z),{indicatorRef:r,isVisible:u,canvasPosition:h}}function ao(n){let{color:t,...o}=n;const{indicatorRef:s,isVisible:i,canvasPosition:r}=ic(o);return(0,e.jsx)("div",{ref:s,className:oc().indicator,style:{display:i?"flex":"none",left:"".concat(r?.x,"px"),top:"".concat(r?.y,"px"),backgroundColor:t.toCssColorString()}})}var pt=d(17631);function Nn(n){return n.mode==="measurement-angle"}function rc(){const n=(0,tn.x)(),t=(0,b.TL)(),o=(0,j.kb)(P=>P),[s,i]=(0,c.useState)(m.Z.ZERO),[r,a]=(0,c.useState)(m.Z.ZERO),l=(0,nt.ZP)(m.Z.ZERO),u=(0,c.useCallback)(P=>{if(m.Z.equalsEpsilon(s,m.Z.ZERO,void 0,1e-6))i(P),a(P);else{const U={start:s,end:P};i(m.Z.ZERO),a(m.Z.ZERO),t((0,j.fq)({mode:"measurement-angle",phase:"drawing-second-line",firstLine:U}))}},[s,t]),f=(0,c.useCallback)(P=>{if(m.Z.equalsEpsilon(s,m.Z.ZERO,void 0,1e-6))i(P),a(P);else{if(!Nn(o)||!o.firstLine)return;const U=o.firstLine,Y=t((0,Tt.Lf)((0,Ct.M)(U.start),(0,Ct.M)(U.end),(0,Ct.M)(s),(0,Ct.M)(P)));i(m.Z.ZERO),a(m.Z.ZERO),t((0,j.fq)({mode:"none"})),t((0,pt.lz)({detail:"measurement",measurementKey:Y.payload.id,movement:{surfAllowed:!1}}))}},[s,t,o]),h=(0,c.useCallback)(P=>{n&&P&&Nn(o)&&(o.phase==="drawing-first-line"?u(P):o.phase==="drawing-second-line"&&f(P))},[n,o,u,f]),g=(0,c.useCallback)(()=>{i(m.Z.ZERO),a(m.Z.ZERO),l.set(m.Z.ZERO),t((0,j.fq)({mode:"none"}))},[t,l]),p=(0,c.useCallback)(P=>{P&&(l.set(P),a(P))},[l]),v=(0,nt.ZP)(s),y=(0,nt.ZP)(r),S=(0,nt.ZP)(Nn(o)&&o.firstLine?o.firstLine.start:m.Z.ZERO),E=(0,nt.ZP)(Nn(o)&&o.firstLine?o.firstLine.end:m.Z.ZERO),Z=(0,ft.ws)();return n?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ao,{onClick:h,onMouseMove:p,color:Pe.Z.YELLOW}),!m.Z.equalsEpsilon(s,m.Z.ZERO,void 0,1e-6)&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(St.HK,{point:v,crossSection:n,interactionKey:"cross-section-angle-measurement-current-start",readonly:!1,children:(0,e.jsx)(St.rd,{size:Z,outlineColor:"#ffff00",fill:"#ffff00"})}),(0,e.jsx)(nn.E,{firstPoint:v,secondPoint:y,show:!0,color:Qt,strokeDashArray:Dn})]}),Nn(o)&&o.phase==="drawing-second-line"&&o.firstLine&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(St.HK,{point:S,crossSection:n,interactionKey:"cross-section-angle-measurement-first-start",readonly:!1,children:(0,e.jsx)(St.rd,{size:Z,outlineColor:"#ffff00",fill:"#ffff00"})}),(0,e.jsx)(nn.E,{firstPoint:S,secondPoint:E,show:!0,color:Qt,strokeDashArray:Dn}),(0,e.jsx)(St.HK,{point:E,crossSection:n,interactionKey:"cross-section-angle-measurement-first-end",readonly:!1,children:(0,e.jsx)(St.rd,{size:Z,outlineColor:"#ffff00",fill:"#ffff00"})})]})]}):null}var Uo=d(56199);function ac(){const n=(0,tn.x)(),t=(0,q.Kq)(),[o,s]=(0,c.useState)(m.Z.ZERO),i=(0,b.TL)(),{select:r}=(0,fn.c)(),a=(0,nt.ZP)(m.Z.ZERO),l=(0,c.useCallback)(v=>{if(n&&v)if(m.Z.equalsEpsilon(o,m.Z.ZERO,void 0,1e-6))s(v);else{const y=(0,Uo.x0)();i((0,Tt.U1)(y,o,v,t)),s(m.Z.ZERO),i((0,j.fq)({mode:"none"})),r({id:y,type:"measurement"})}},[i,o,n,t,r]),u=(0,c.useCallback)(()=>{s(m.Z.ZERO),a.set(m.Z.ZERO),i((0,j.fq)({mode:"none"}))},[i,a]),f=(0,c.useCallback)(v=>{v&&a.set(v)},[a]),h=(0,nt.ZP)(o),g=(0,ft.ws)(),p=!m.Z.equalsEpsilon(o,m.Z.ZERO,void 0,1e-6);return n?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ao,{onClick:l,onMouseMove:f,color:Pe.Z.YELLOW}),p&&(0,e.jsx)(St.HK,{point:h,crossSection:n,interactionKey:"cross-section-measurement",readonly:!1,children:(0,e.jsx)(St.rd,{size:g,outlineColor:"#ffff00",fill:"#ffff00"})}),p&&(0,e.jsx)(nn.E,{firstPoint:h,secondPoint:a,show:!0,color:"#ffff00",width:2,strokeDashArray:"20,5"})]}):null}var Ce=d(514),rn=d(89932),Js=d(14840);function Xs(n){let{onChange:t,precision:o=3,stepSize:s=.01,initialValue:i,min:r,max:a,...l}=n;const u=(0,ft.ib)(),f=(0,rn.BI)(i,u,"m",o),h=v=>{const y=(0,rn.BI)(v,"m",u);t(y)},g=(0,c.useMemo)(()=>{if(r!==void 0)return(0,rn.BI)(r,u,"m",o)},[r,u,o]),p=(0,c.useMemo)(()=>{if(a!==void 0)return(0,rn.BI)(a,u,"m",o)},[a,u,o]);return(0,e.jsx)(Js.u,{initialValue:f,onChange:h,min:g,max:p,precision:o,stepSize:s,selectAllOnFocus:!0,...l})}var Gt=d(21850),_t=d(11675),cc=d(29524),co=d.n(cc);function lo(n){return{left:"".concat(n.x,"px"),top:"".concat(n.y,"px")}}function Qs(n,t){const o=(0,Xt.Ke)(),s=(0,c.useRef)(new m.Z);if(!o)return null;const i=(0,It.BY)(n),r=Ee.Z.multiplyByPoint(i,t,s.current);return o(r)}const lc=n=>{let{crossSection:t,uniformSectionPosition:o}=n;const s=Qs(t,m.Z.ZERO),i=Qs(t,o);return!s||!i?null:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(dc,{coordinates:s}),(0,e.jsx)(uc,{coordinates:i}),(0,e.jsx)(mc,{originCoordinates:s,targetCoordinates:i}),(0,e.jsx)(fc,{originCoordinates:s,targetCoordinates:i})]})},dc=n=>{let{coordinates:t}=n;const o=lo(t);return(0,e.jsx)("div",{className:co().originMarker,style:o})},uc=n=>{let{coordinates:t}=n;const o=lo(t);return(0,e.jsx)("div",{className:co().uniformMarker,style:o})},mc=n=>{let{originCoordinates:t,targetCoordinates:o}=n;const s=(0,c.useRef)(new at.Z),i=(0,c.useMemo)(()=>{const r=Math.min(t.x,o.x);return s.current.x=r,s.current.y=t.y,{...lo(s.current),width:"".concat(Math.abs(t.x-o.x),"px")}},[t.x,t.y,o.x]);return(0,e.jsx)("div",{className:co().measurementGuideHorizontal,style:i})},fc=n=>{let{originCoordinates:t,targetCoordinates:o}=n;const s=(0,c.useRef)(new at.Z),i=(0,c.useMemo)(()=>{const r=Math.min(t.y,o.y);return s.current.x=o.x,s.current.y=r,{...lo(s.current),height:"".concat(Math.abs(t.y-o.y),"px")}},[t.y,o.x,o.y]);return(0,e.jsx)("div",{className:co().measurementGuideVertical,style:i})};var hc=d(24901),$s=d.n(hc);function gc(n){const t=(0,w.Eg)(),o=(0,_t.I0)(),s=(0,j.Fc)(),i=(0,q.p0)(),r=(0,N.jk)(P=>P.crossSection),[a,l]=(0,c.useState)(new m.Z),[u,f]=(0,c.useState)({x:null,y:null}),h=(0,c.useCallback)(P=>{if(!r||!i)return;const U=(0,It.Gr)(r),Y=Ee.Z.multiplyByPoint(U,P,new m.Z);l(Y)},[r,i]),g=(0,c.useCallback)(P=>{if(!r||!i)return;const U=i.crossSections.map(he=>Ee.Z.multiplyByPoint((0,It.BY)(he),P,new m.Z));var Y,se;t(U,n.type,(Y=s?.projectFileId)!==null&&Y!==void 0?Y:"",(se=s?.surveyId)!==null&&se!==void 0?se:null,n.prefill),o((0,j.fq)({mode:"none"}))},[o,r,i,n.type,n.prefill,t,s]),p=(0,c.useCallback)(()=>{a&&g(a)},[g,a]),v=(0,c.useCallback)(P=>{if(!r||!i)return;const U=(0,It.Gr)(r),Y=Ee.Z.multiplyByPoint(U,P,new m.Z);l(Y),g(Y)},[g,r,i,l]),y=(0,c.useCallback)(P=>{f(U=>({x:P,y:U.y})),P!=null&&l(U=>(U.x=P,U))},[]),S=(0,c.useCallback)(P=>{f(U=>({x:U.x,y:P})),P!=null&&l(U=>(U.y=P,U))},[]),E=(0,No.Z)({type:n.type,spec:{}}),Z=(0,c.useMemo)(()=>new Pe.Z(E.color.r,E.color.g,E.color.b),[E]);return{uniformSectionOffset:a,constraints:u,color:Z,currentSection:r,sections:i,handleMouseMove:h,handleClick:v,commitPosition:p,handleXChange:y,handleYChange:S}}function qs(n){const{uniformSectionOffset:t,constraints:o,color:s,currentSection:i,sections:r,handleMouseMove:a,handleClick:l,commitPosition:u,handle
1XChange:f,handleYChange:h}=gc(n.state);return!i||!r?null:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ao,{onMouseMove:a,onClick:l,color:s,constraints:o}),(0,e.jsx)(lc,{crossSection:i,uniformSectionPosition:t}),(0,e.jsx)(pc,{uniformPosition:t,onCommit:u,onPositionXChange:f,onPositionYChange:h}),(0,e.jsx)(yc,{})]})}const pc=n=>{let{uniformPosition:t,onPositionXChange:o,onPositionYChange:s,onCommit:i}=n;return(0,e.jsxs)(Ce.Card,{className:$s().positionInputDialog,children:[(0,e.jsx)("h4",{children:"Offset"}),(0,e.jsx)(vc,{uniformPosition:t,onPositionXChange:o,onPositionYChange:s}),(0,e.jsx)(xc,{onClick:i,label:"Commit Position"})]})},vc=n=>{let{uniformPosition:t,onPositionXChange:o,onPositionYChange:s}=n;return(0,e.jsxs)("div",{className:$s().positionInputControls,children:[(0,e.jsx)(Ce.FormGroup,{label:"X",inline:!0,children:(0,e.jsx)(Xs,{initialValue:t.x,onChange:o,onReset:()=>o(null),buttonPosition:"none",autoFocus:!0})}),(0,e.jsx)(Ce.FormGroup,{label:"Z",inline:!0,children:(0,e.jsx)(Xs,{initialValue:t.y,onChange:s,onReset:()=>s(null),buttonPosition:"none"})})]})},xc=n=>{let{onClick:t,label:o}=n;return(0,e.jsx)(Ce.Button,{intent:"primary",text:o,onClick:t})},yc=()=>{const n=(0,_t.I0)(),t=(0,c.useCallback)(o=>{o.key==="Escape"&&n((0,j.fq)({mode:"none"}))},[n]);return(0,e.jsx)(Gt.Z,{callback:t})};function Cc(){const n=(0,J.zi)(),t=(0,J.YV)(),o=(0,_t.I0)(),s=(0,c.useCallback)(i=>{t&&n(i,t.objectType,t.projectFileId,t.annotationLayerId,t.prefill),o((0,j.fq)({mode:"none"}))},[n,o,t]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ao,{onClick:s,color:Pe.Z.YELLOW}),(0,e.jsx)(Gt.Z,{callback:i=>{i.key==="Escape"&&o((0,j.fq)({mode:"none"}))}})]})}function Ec(){const n=(0,j.kb)(o=>o),t=(0,Q.ye)("useNewToolBar",!1);return n.mode==="object-annotation"?(0,e.jsx)(Cc,{}):n.mode==="line-annotation"&&!t?(0,e.jsx)(qs,{state:n}):n.mode==="offset"?(0,e.jsx)(qs,{state:n}):n.mode==="measurement"?(0,e.jsx)(C.RequireFeatureFlag,{featureFlag:"crossSectionMeasurementTool",featureFlagDefault:!1,children:(0,e.jsx)(ac,{})}):n.mode==="measurement-angle"?(0,e.jsx)(C.RequireFeatureFlag,{featureFlag:"crossSectionMeasurementTool",featureFlagDefault:!1,children:(0,e.jsx)(rc,{})}):null}var Sc=Ec,Zt=d(85385),jc=d(40150),Wo=d(45894),Tc=d(10792),ei=d(81833),jn=d(29063);const bc=.01,Pc=2;function Mc(){const n=(0,b.TL)(),t=(0,N.tD)(),o=(0,N.UA)(),s=(0,Mt.Qq)(),{isCollapsed:i}=(0,b.CG)(jn._m),r=i&&s==="vertical",a=g=>{n((0,N.kN)(g))},l=()=>{n((0,N.c8)())},u=()=>{n((0,N.XG)())},f=()=>{n((0,Mt.Zg)())},h=()=>{n((0,N.dA)(null))};return(0,e.jsx)("div",{className:"absolute ".concat(r?"right-8":"right-3"," top-3 z-toolbar"),children:(0,e.jsxs)(Zt.sDD,{variant:"elevated",className:"bg-bg","aria-label":"Cross-section settings",children:[(0,e.jsx)(jc.C,{label:"Depth",title:"Depth",description:"Cross-section depth",value:t,onChange:a,minValue:bc,maxValue:Pc,scale:"logarithmic",scrubThreshold:35,isFixedSize:!0,className:"w-10"}),(0,e.jsx)(ei.P,{orientation:"vertical",size:"md"}),(0,e.jsx)(Wo.X,{title:"Rotate to ".concat((o+90)%360,"\xB0"),onPress:l,children:K.L$i}),(0,e.jsxs)("div",{className:"w-6 shrink-0 select-none px-2 text-center text-body-medium text-text",children:[o,"\xB0"]}),(0,e.jsx)(Wo.X,{title:"Rotate to ".concat((o-90+360)%360,"\xB0"),onPress:u,children:K.xt5}),(0,e.jsx)(ei.P,{orientation:"vertical",size:"md"}),(0,e.jsx)(Tc.n,{title:s==="vertical"?"Switch to horizontal":"Switch to vertical",onIcon:K.Rrj,offIcon:K.Njy,isSelected:s==="vertical",onChange:()=>f()}),(0,e.jsx)(Wo.X,{title:"Exit cross section",onPress:h,children:K.hcv})]})})}var Ic=d(72021),zo=d(95176);function wc(n){const t=(0,b.TL)(),o=(0,W.A5)();return(0,c.useEffect)(()=>{t(o?(0,zo.$l)(o.message,n.id):(0,zo.Wq)(n.id))},[o,n.id,t]),null}function Rc(n){const t=(0,b.TL)();return(0,c.useEffect)(()=>{t((0,zo.Wq)(n.id))},[n.id,t]),null}function Oc(n){return(0,e.jsxs)(W.a3,{fallback:(0,e.jsx)(wc,{id:n.id}),children:[n.children,(0,e.jsx)(Rc,{id:n.id})]})}var hn=Oc;function ht(n){return(0,e.jsx)(W.a3,{fallback:null,children:n.children})}function Lc(n){return(0,e.jsx)(e.Fragment,{children:c.Children.map(n.children,(t,o)=>(0,e.jsx)(ht,{children:t},o))})}
1const ti={arbRenKey:"crossSectionArbRen",width:800,height:600,nearDepth:.1,farDepth:1e3,pixelDataType:Ft.Z.UNSIGNED_BYTE,frustumWidth:20,kind:"orthographic"};function Ac(n){const t=(0,N.jk)(i=>i.crossSection),o=(0,Ut.n_)(i=>i),s=(0,En.ye)("useNewCrossSectionSettingsBar",!1);return(0,e.jsxs)("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0},children:[s?(0,e.jsx)(Mc,{}):(0,e.jsx)(ht,{children:(0,e.jsx)(fa.Oc,{height:250})}),(0,e.jsxs)(sa,{initialArbRenCameraSettings:ti,renderingPaused:n.renderingPaused,children:[Object.keys(o).map(i=>(0,e.jsxs)(hn,{id:i,children:[(0,e.jsx)(Fc,{pointCloudKey:i}),(0,e.jsx)(Nc,{pointCloudKey:i})]},i)),(0,e.jsxs)(Lc,{children:[(0,e.jsx)(Zc,{}),t&&(0,e.jsx)(ma,{}),t&&(0,e.jsx)(Sa,{}),(0,e.jsx)(Sc,{}),(0,e.jsx)(C.RequireFeatureFlag,{featureFlag:"crossSectionMeasurementTool",featureFlagDefault:!1,children:(0,e.jsx)(Ma,{})}),t&&(0,e.jsx)(ec,{}),(0,e.jsx)(da,{}),(0,e.jsx)(Va,{})]})]})]})}function Dc(){const n=(0,Mt.Qq)();return n==="vertical"?(0,e.jsx)("div",{style:{position:"absolute",left:"50%",height:"100%",width:"4px",backgroundColor:"#9ACD32"}}):n==="horizontal"?(0,e.jsx)("div",{style:{position:"absolute",top:"50%",width:"100%",height:"4px",backgroundColor:"#9ACD32"}}):null}function Zc(){const n=(0,Xt.yu)(),t=(0,b.TL)(),o=(0,je.FE)(i=>i.cameraState),s=(0,c.useRef)(!1);return(0,c.useEffect)(()=>{if(n&&!s.current){var i,r,a;n.setView({destination:new m.Z(o.x,o.y,o.z),orientation:{heading:(i=o.heading)!==null&&i!==void 0?i:0,pitch:(r=o.pitch)!==null&&r!==void 0?r:-Math.PI/2,roll:(a=o.roll)!==null&&a!==void 0?a:0}}),s.current=!0}},[n,o,t]),null}function Fc(n){const{pointCloudKey:t}=n,o=(0,xe.J5)(t);return o?(0,e.jsx)(Ic.N,{projectFileId:t,vizMapping:o.visualizationMapping}):null}function Nc(n){const{pointCloudKey:t}=n,o=(0,Rn.R_)(),s=(0,ft.N6)(),i=(0,c.useCallback)((r,a)=>{r.brightnessModifier=s},[s]);return(0,c.useEffect)(()=>{o(t,i)},[o,i,t]),null}var ni=d(66192),Bc=d(80189),uo=d(62653),oi=d(76517),Ho=d(78561),an=d(40067),cn=d(81686),si=d(11044),kc=d(79531),Vc=d(66338),ii=d(589),Ko=d(85334),mt=d(55262),ot=d(54507),Bn=d(35113),Uc=d(34881),ri=d(4377),kn=d(8622),Wt=d(58897);function Cp(n,t){const[o,s,i,r,a,l,u,f]=t,h=Matrix4.fromTranslationRotationScale(new TranslationRotationScale(new Cartesian3(f.coordinates[0],f.coordinates[1],f.coordinates[2]),new Quaternion(o,s,i,r),wrapScaleVector(new Cartesian3(a,l,u))),new Matrix4);return Matrix4.multiply(n.ecefFromDB,h,new Matrix4)}const Go=new eo.Z({flat:!0}),Wc=["Object.id","rotX","rotY","rotZ","rotW","scaleX","scaleY","scaleZ","pos","geomMod","type","color"];function zc(n){const{db:t}=n,o=(0,Wt.np)(t.dbId,Wc,"Object","type = 'CUBOID' or type = 'CYLINDER' or type = 'SPHERE'"),[s,i]=(0,c.useMemo)(()=>{const r=new ni.Z({minimum:new m.Z(-.5,-.5,-.5),maximum:new m.Z(.5,.5,.5)}),a=new Bc.Z({radius:.5,vertexFormat:uo.Z.POSITION_ONLY}),l=[],u=[];for(const f of o){const[h,g,p,v,y,S,E,Z,P,U,Y,se]=f,he=Ee.Z.fromTranslationRotationScale(new oi.Z(new m.Z(P.coordinates[0],P.coordinates[1],P.coordinates[2]),new Vt.Z(g,p,v,y),(0,Uc.sj)(new m.Z(S,E,Z))),new Ee.Z),ie=Ee.Z.multiply(t.ecefFromDB,he,new Ee.Z),Oe=se?Pe.Z.fromCssColorString(se):Pe.Z.WHITE;let ue;if(Y==="CUBOID")ue=r;else if(Y==="CYLINDER"){const De=U;ue=new Ho.Z({length:1,topRadius:De.top_scale/2,bottomRadius:De.bottom_scale/2,vertexFormat:uo.Z.POSITION_ONLY})}else ue=a;l.push(new an.Z({geometry:ue,modelMatrix:ie,id:"db-object-".concat(t.dbId,"-").concat(f[0]),attributes:{color:cn.Z.fromColor(Oe)}})),u.push({id:(0,Uo.x0)(),position:Ee.Z.getTranslation(ie,new m.Z),ecefModelMatrix:ie,table:"Object",tableId:h,dbId:t.dbId})}return[l,u]},[o,t]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(me.WV,{geometryInstances:s,appearance:Go}),(0,e.jsx)(_o,{clickables:i})]})}function Hc(n,t,o){const s=[];for(let i=0;i<n.length-1;i++){const r=n[i],a=n[i+1],l=m.Z.subtract(a,r,new m.Z),u=m.Z.magnitude(l);if(u<1e-6)continue;m.Z.normalize(l,l);const f=m.Z.cross(m.Z.UNIT_Z,l,new m.Z);m.Z.normalize(f,f);const h=Math.acos(m.Z.dot(m.Z.UNIT_Z,l)),g=Vt.Z.fromAxisAngle(f,h);if(o){const{head_length:p,head_diameter:v,shaft_diameter:y}=o,S=u-p,E=m.Z.multiplyByScalar(l,S+p/2,new m.Z),Z=m.Z.add(r,E,new m.Z),P=Ee.Z.fromTranslationQuaternionRotationScale(Z,g,new m.Z(v/2,v/2,p));s.push({matrix:P,geometry:Kc});const U=m.Z.multiplyByScalar(l,S/2,new m.Z),Y=m.Z.add(r,U,new m.Z),se=Ee.Z.fromTranslationQuaternionRotationScale(Y,g,new m.Z(y,y,S));s.push({matrix:se,geometry:ai})}else{const p=m.Z.midpoint(r,a,new m.Z),v=Ee.Z.fromTranslationQuaternionRotationScale(p,g,new m.Z(t,t,u));s.push({matrix:v,geometry:ai})}}return s}
1const ai=new Ho.Z({length:1,topRadius:.5,bottomRadius:.5,vertexFormat:uo.Z.POSITION_ONLY,slices:8}),Kc=new Ho.Z({length:1,topRadius:.5,bottomRadius:.5,vertexFormat:uo.Z.POSITION_ONLY,slices:8}),Gc=["Line.id","thickness","color","coords","type","geomMod","topicName"];function _c(n){const{db:t}=n,o=(0,Wt.np)(t.dbId,Gc,"Line","type = 'LINE_GENERIC' or type = 'ARROW'"),[s,i]=(0,c.useMemo)(()=>{const r=[],a=[];for(const[l,u,f,h,g,p]of o){const v=h.coordinates.map(E=>{let[Z,P,U]=E;return Ee.Z.multiplyByPoint(t.ecefFromDB,new m.Z(Z,P,U),new m.Z)}),y=Hc(v,u===0?.1:u,g==="ARROW"?p:void 0),S=f?Pe.Z.fromCssColorString(f):Pe.Z.WHITE;for(let E=0;E<y.length;E++)r.push(new an.Z({geometry:y[E].geometry,modelMatrix:y[E].matrix,id:"db-line-".concat(t.dbId,"-").concat(l,"-").concat(E),attributes:{color:cn.Z.fromColor(S)}})),a.push({id:(0,Uo.x0)(),position:Ee.Z.getTranslation(y[E].matrix,new m.Z),ecefModelMatrix:y[E].matrix,table:"Line",tableId:l,dbId:t.dbId})}return[r,a]},[o,t]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(me.WV,{geometryInstances:s,appearance:Go}),(0,e.jsx)(_o,{clickables:i})]})}function _o(n){const t=(0,Wt.Be)();return(0,c.useEffect)(()=>{for(const o of n.clickables)t.addClickableCuboid(o);return()=>{for(const o of n.clickables)t.removeClickableCuboid(o.id)}},[n.clickables,t]),null}const Yc=["pos","geomMod","color"];function Jc(n){const{db:t}=n,o=(0,Wt.np)(t.dbId,Yc,"Object","type = 'TEXT'");return(0,e.jsx)(me.qi,{children:o.map((s,i)=>{const[r,a,l]=s;return(0,e.jsx)(Nt.ZP,{position:Ee.Z.multiplyByPoint(t.ecefFromDB,new m.Z(r.coordinates[0],r.coordinates[1],r.coordinates[2]),new m.Z),label:{text:a.text,font:"12pt monospace",fillColor:l?Pe.Z.fromCssColorString(l):Pe.Z.WHITE,outlineColor:Pe.Z.BLACK,outlineWidth:2,showBackground:!0,backgroundColor:Pe.Z.BLACK.withAlpha(.5)}},i)})})}function Xc(n){const t=(0,Wt.np)(n.dbId,["pos"],"Object","1=1"),o=(0,Wt.np)(n.dbId,["coords"],"Line","1=1"),s=(0,c.useCallback)(i=>{if(i.layerType!=="debugDB")return null;const r=t.map(f=>Ee.Z.multiplyByPoint(n.ecefFromDB,new m.Z(f[0].coordinates[0],f[0].coordinates[1],f[0].coordinates[2]),new m.Z)),a=o.flatMap(f=>f[0].coordinates.map(h=>{let[g,p,v]=h;return Ee.Z.multiplyByPoint(n.ecefFromDB,new m.Z(g,p,v),new m.Z)})),l=[...r,...a];return si.Z.fromPoints(l)},[t,o,n.ecefFromDB]);(0,Bn.yL)(s)}function Qc(n){const t=n.match(/POLYGON\(\((-?\d+(?:\.\d+)?) (-?\d+(?:\.\d+)?), (-?\d+(?:\.\d+)?) (-?\d+(?:\.\d+)?), (-?\d+(?:\.\d+)?) (-?\d+(?:\.\d+)?), (-?\d+(?:\.\d+)?) (-?\d+(?:\.\d+)?), (-?\d+(?:\.\d+)?) (-?\d+(?:\.\d+)?)\)\)$/);if(!t)throw new Error("Invalid WKT: ".concat(n));const[o,s,i,r,a,l,u,f,h,g]=t.slice(1).map(Number);if(!(o===u&&i===a&&s===r&&l===f))throw new Error("The polygon is not an axis-aligned square: ".concat(o,", ").concat(s,", ").concat(i,", ").concat(r,", ").concat(a,", ").concat(l,", ").concat(u,", ").concat(f));const p=Math.abs(i-o);if(Math.abs(i-h-p)>.001||Math.abs(l-r-p)>.001)throw new Error("The polygon is not an axis-aligned square: ".concat(p,", ").concat(h-i-p,", ").concat(g-r-p));const v=(o+a)/2,y=(s+l)/2;return{centerX:v,centerY:y,sideLength:p}}function $c(n){let t=0;for(let s=0;s<n.length;s++){const i=n.charCodeAt(s);t=(t<<5)-t+i,t=t&t}const o=t%360;return Pe.Z.fromHsl(o/360,.5,.5)}const qc=new ni.Z({minimum:new m.Z(-.5,-.5,-.5),maximum:new m.Z(.5,.5,.5)});function el(n){const{db:t}=n,o=(0,c.useCallback)(f=>"SELECT id, ST_AsText(area) FROM Region WHERE ".concat(f.activeDBIds.has(t.dbId)?"1=1":"1=0"),[t]),s=(0,Wt.DV)(t.dbId,o),i=(0,Wt.ji)(t.dbId),r=(0,pt.WE)(f=>f.detail==="debug-db"&&f.table==="Region"?f.objectId:void 0),[a,l,u]=(0,c.useMemo)(()=>{const f=[],h=[],g=[];for(const[p,v]of s)try{const{centerX:y,centerY:S,sideLength:E}=Qc(v),Z=Ee.Z.fromTranslationRotationScale(new oi.Z(new m.Z(y,S,0),Vt.Z.IDENTITY,new m.Z(E,E,E))),P=Ee.Z.multiply(t.ecefFromDB,Z,new Ee.Z);f.push(new an.Z({geometry:qc,modelMatrix:P,id:"db-region-".concat(t.dbId,"-").concat(p),attributes:{color:cn.Z.fromColor(r===p?ri.l.withAlpha(.3):i?.[p]?$c(p).withAlpha(.3):Pe.Z.GRAY.withAlpha(.2))}})),h.push({id:"db-region-".concat(t.dbId,"-").concat(p),position:Ee.Z.getTranslation(P,new m.Z),ecefModelMatrix:P,table:"Region",tableId:p,dbId:t.dbId}
1),g.push({text:p,font:"12pt monospace",horizontalOrigin:kc.Z.CENTER,verticalOrigin:Vc.Z.CENTER,showBackground:!0,backgroundColor:Pe.Z.BLACK.withAlpha(.5),position:Ee.Z.getTranslation(P,new m.Z)})}catch(y){console.warn("here",y)}return[f,h,g]},[s,t.ecefFromDB,r,i,t.dbId]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(me.WV,{geometryInstances:a,appearance:Go}),(0,e.jsx)(_o,{clickables:l}),(0,e.jsx)(me.qi,{children:u.map(f=>(0,e.jsx)(me.__,{...f},f.text))})]})}const tl=new Sn.Z(m.Z.UNIT_Z,0);function nl(n){const{db:t}=n,o=(0,Wt.np)(t.dbId,["Image.id","imageKey"],"Image","1=1"),s=ot.Tuple(ot.Number,ot.Number,ot.Number);if(!ot.Array(ot.Tuple(ot.Number,ot.String,ot.Record({coordinates:ot.Tuple(s,s,s,s,s)}))).guard(o))throw new Error("Invalid image");const r=(0,c.useMemo)(()=>o.map(a=>{const l=a[2].coordinates.map(U=>{let[Y,se,he]=U;return Ee.Z.multiplyByPoint(t.ecefFromDB,new m.Z(Y,se,he),new m.Z)}),u=m.Z.subtract(l[1],l[4],new m.Z);m.Z.normalize(u,u);const f=m.Z.subtract(l[1],l[2],new m.Z);m.Z.normalize(f,f);const h=m.Z.cross(u,f,new m.Z),g=new jt.Z;jt.Z.setColumn(g,0,u,g),jt.Z.setColumn(g,1,f,g),jt.Z.setColumn(g,2,h,g);const p=m.Z.midpoint(l[0],l[2],new m.Z),v=new ii.Z(Vt.Z.fromRotationMatrix(g)),y=m.Z.distance(l[0],l[3]),S=m.Z.distance(l[0],l[1]),E=new at.Z(y,S),Z=new kn.xp("/api/debugdb-files/".concat(a[1]));return{material:new Ko.Z({image:new mt.Z(()=>Z.getImage(void 0),!1)}),position:p,orientation:v,dimensions:E,key:a[0]}}),[o,t.ecefFromDB]);return(0,e.jsx)(e.Fragment,{children:r.map(a=>{let{material:l,position:u,orientation:f,dimensions:h,key:g}=a;return(0,e.jsx)(Nt.ZP,{position:u,orientation:f,children:(0,e.jsx)(me.mR,{material:l,dimensions:h,plane:tl})},g)})})}function ol(n){return Xc(n.db),(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(zc,{db:n.db}),(0,e.jsx)(Jc,{db:n.db}),(0,e.jsx)(_c,{db:n.db}),(0,e.jsx)(el,{db:n.db}),(0,e.jsx)(nl,{db:n.db})]})}function sl(n,t){const o=new m.Z(-.5,-.5,-.5),s=new m.Z(.5,.5,.5);let i;try{i=Ee.Z.inverse(n,new Ee.Z)}catch{return null}const r=Ee.Z.multiplyByPoint(i,t.origin,new m.Z),a=Ee.Z.multiplyByPointAsVector(i,t.direction,new m.Z);m.Z.normalize(a,a);const l=new m.Z,u=new m.Z;for(const g of["x","y","z"]){const p=r[g],v=a[g],y=o[g],S=s[g];if(v===0){if(p<y||p>S)return null;l[g]=Number.NEGATIVE_INFINITY,u[g]=Number.POSITIVE_INFINITY}else{let E=(y-p)/v,Z=(S-p)/v;E>Z&&([E,Z]=[Z,E]),l[g]=E,u[g]=Z}}const f=Math.max(l.x,l.y,l.z),h=Math.min(u.x,u.y,u.z);return f>h||h<0?null:f>=0?f:h}function il(){const n=(0,Wt.Be)(),t=(0,b.TL)(),o=(0,c.useMemo)(()=>({pick(s){const i=n.clickableObjects.findPointsWithinRadiusOfRay(s.mouseRay,0);let r=1/0,a;for(const l of i){const u=sl(l.ecefModelMatrix,s.mouseRay);if(u===null)continue;const f=a?.table==="Region",h=l.table==="Region";u!==null&&(!a||f&&!h||f===h&&u<r)&&(r=u,a=l)}if(a){const l={onClick:()=>{a&&t((0,pt.L1)(a.dbId,a.tableId,a.table))},show:!0};return{position:Ee.Z.multiplyByPoint(a.ecefModelMatrix,io.Z.getPoint(s.mouseRay,r),new m.Z),object:{kind:"Primitive",id:a.id,object:l}}}}}),[n,t]);return(0,qe.qX)("debugdb",o),null}function rl(){const n=(0,Wt.A9)();return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(il,{}),[...n.entries()].map(t=>{let[o,s]=t;return(0,e.jsx)(ol,{db:s},o)})]})}var al=d(58593),Yo=d(36612),Jo=d(28742);const cl=/^(?:[+-]?\d+(?:\.\d+)?|(?:[NS]\s*)?\d+°\s*\d+'?\s*\d+(?:\.\d+)?"?\s*(?:[NS])?)\s*,\s*(?:[+-]?\d+(?:\.\d+)?|(?:[EW]\s*)?\d+°\s*\d+'?\s*\d+(?:\.\d+)?"?\s*(?:[EW])?)$/;function ll(){const{scene:n}=(0,me.VQ)(),t=(0,c.useMemo)(()=>n?new al.Z({accessToken:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI1MmM0ZGY4ZS04YTBhLTQwNWMtYTcyNi02MTQ3ZGQ2OGVkMmMiLCJpZCI6ODA5NTAsImlhdCI6MTY0MzMxNzQ5M30.xpgHc-QfzUhkiDrSLKWvF95m_QktZE8DUT-LmFSWP6c",scene:n}):null,[n]),o=(0,c.useCallback)(async s=>{if(!t)return Promise.resolve([]);const i=await t.geocode(s);for(const r of i)if(r.destination instanceof Yo.Z){if(cl.test(s)){const u=(r.destination.east+r.destination.west)/2,f=(r.destination.north+r.destination.south)/2,h=new Yo.Z(u-.5*2e-5,f-.5*1e-5,u+.5*2e-5,f+.5*1e-5);r.destination=h}else if(r.destination.width<.002){const u=(r.destination.east+r.destination.west)/2,f=(r.destination.north+r.destination.south)/2,h=new Yo.Z(u-.5*5e-5,f-.5*25e-6,u+.5*5e-5,f+.5*25e-6);r.destination=h}}return i},[t]);return(0,Jo.YT)(o),null}var dl=d(58004),ul=d(75692),ml=d(73758),fl=d(78695);function hl(){const[n,t]=(0,c.useState)(null);(0,c.useEffect)(()=>{const s=document.getElementsByClassName("cesium-baseLayerPicker-item"),i=[];for(const r of s){const a=()=>{t(r.getAttribute("title"))};r.addEventListener("click",a),i.push(a)}return()=>{for(let r=0;r<s.length;r++)s[r].removeEventListener("click",i[r])}},[t]);
1const{viewer:o}=(0,me.VQ)();return n?.includes("ArcGIS World Imagery")?(0,e.jsx)("div",{style:{position:"absolute",bottom:20,left:370,padding:"2px 4px",color:"white",WebkitTextStroke:"0.03px black",textShadow:"1px 1px 2px black",fontFamily:"sans-serif",fontSize:"12px"},children:"Basemap: Esri"}):null}var gl=hl,Xo=d(5280),mo=d(10918),ci=d(38786),pl=d(87669),vl=d(97531),xl=d(43137),li=d(80326),yl=d(86802),Cl=d(33952),El=d(26521),Sl=d(23537);function jl(){const n=(0,jn.Ym)(),t=(0,Le.fJ)(),o=(0,Le.F5)(),{projectFile:s}=(0,mo.lE)(o==="ProjectFile"&&t||""),{projectView:i}=(0,mo.s0)(o==="View"&&t||""),r=(0,Xo.SK)();let a="Project";return o==="ProjectFile"&&s?.displayName?a=s.displayName:o==="View"&&i?.displayName?a=i.displayName:o==="Task"&&r?.displayName&&(a="Task ".concat(r.displayName)),n?(0,e.jsx)("div",{className:"absolute left-3 top-3 z-toolbar w-panelSidebar",children:(0,e.jsxs)(Zt.sDD,{variant:"elevated",className:"w-full max-w-full bg-bg",children:[(0,e.jsx)(ci.default,{href:"/drive",children:(0,e.jsx)(xl.Q,{size:"md","aria-label":"Company logo",isPressed:!1,isHovered:!1,children:K.l7l})}),(0,e.jsxs)("div",{className:"flex min-w-0 flex-1 items-center px-2",children:[(0,e.jsx)("div",{className:"flex min-w-0 flex-1",children:(0,e.jsxs)(yl.U,{delay:250,children:[(0,e.jsx)(pl.YS,{children:(0,e.jsx)(Zt.qjq,{size:"lg",title:"",children:a})}),(0,e.jsx)(vl.t,{title:a})]})}),(0,e.jsxs)(li.$x,{children:[(0,e.jsx)(li.Ag,{size:"sm","aria-label":"Project options",children:K.HyT}),(0,e.jsx)(Sl.j,{})]})]}),(0,e.jsx)(El.S,{otherProfileLimit:2}),(0,e.jsx)(Cl.G,{})]})}):null}var Tl=d(19340),Dt=d(4919);const bl=(0,ot.Array)((0,ot.Array)((0,ot.Record)({startX:ot.Number,endX:ot.Number,startY:ot.Number,endY:ot.Number}))),Qo=13,Ep=18;class Pl{addFullTerrainAvailability(t,o,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:Qo}removeTerrainSource(t){delete this.terrainAvailabilities[t]}computeMaximumLevelAtPosition(t){let o=0;for(const s of Object.values(this.terrainAvailabilities))o=Math.max(o,s.computeMaximumLevelAtPosition(t));return o}addAvailableTileRange(t,o,s,i,r){}computeChildMaskForTile(t,o,s){return 0}computeBestAvailableLevelOverRectangle(t){return 0}isTileAvailable(t,o,s){return!1}constructor(){this.terrainAvailabilities={}}}class Ml{async addPointCloud(t,o){try{const s=await(await fetch("/api/custom-terrain-server/".concat(t,"/layer.json"),{signal:o})).json(),i=await Tl.Z.fromUrl("/api/custom-terrain-server/".concat(t)),r=bl.check(s?.available);if(!r){console.error("Failed to load layer.json spec for pointcloud ".concat(t," "));return}this.terrainProviders[t]=i,this.customTileAvailability.addFullTerrainAvailability(t,i,r)}catch{return}}async removePointCloud(t){delete this.terrainProviders[t],this.customTileAvailability.removeTerrainSource(t)}get availability(){return this.customTileAvailability}get credit(){return this.worldTerrainProvider.credit}get errorEvent(){return this.worldTerrainProvider.errorEvent}get hasWaterMask(){return this.worldTerrainProvider.hasWaterMask}get hasVertexNormals(){return this.worldTerrainProvider.hasVertexNormals}get tilingScheme(){return this.worldTerrainProvider.tilingScheme}getTileDataAvailable(t,o,s){return this.worldTerrainProvider.getTileDataAvailable(t,o,s)||Object.values(this.terrainProviders).find(i=>i.getTileDataAvailable(t,o,s)===!0)!==void 0}requestTileGeometry(t,o,s,i){let r=32;if(s>Qo)for(const a of Object.values(this.terrainProviders)){const[l,u]=Il(t,o,s);if(a.getTileDataAvailable(t,o,s))return a.requestTileGeometry(t,o,s,i);r=Math.min(r,a.availability.computeMaximumLevelAtPosition(new Dt.Z(l,u)))}if(this.worldTerrainProvider.getTileDataAvailable(t,o,s)&&(s<r||s<Qo))return this.worldTerrainProvider.requestTileGeometry(t,o,s,i)}getLevelMaximumGeometricError(t){var o;const s=(o=Math.max(...Object.values(this.terrainProviders).map(r=>r.getLevelMaximumGeometricError(t))))!==null&&o!==void 0?o:0;var i;return Math.max(s,(i=this.worldTerrainProvider.getLevelMaximumGeometricError(t))!==null&&i!==void 0?i:0)}async loadTileDataAvailability(t,o,s){const i=[this.worldTerrainProvider.loadTileDataAvailability(t,o,s),...Object.values(this.terrainProviders).map(r=>{r.loadTileDataAvailability(t,o,s)})];return Promise.allSettled(i).then(()=>{})}constructor(t){this.worldTerrainProvider=t,this.customTileAvailability=new Pl,this.terrainProviders={}}}function Il(n,t,o){const i=.703125/2**o,r=n*256*i-180,a=(n+1)*256*i-180,l=t*256*i-90,u=(t+1)*256*i-90;return[(r+a)/2*Math.PI/180,(l+u)/2*Math.PI/180]}var wl=d(78841);const Sp=(0,ot.Array)((0,ot.Array)((0,ot.Record)({startX:ot.Number,endX:ot.Number,startY:ot.Number,endY:ot.Number}))),$o=13,Rl=18;class Ol{addFullTerrainAvailability(t,o){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:$o}removeTerrainSource(t){delete this.terrainAvailabilities[t]}computeMaximumLevelAtPosition(t){let o=0;for(const s of Object.values(this.terrainAvailabilities))o=Math.max(o,s.computeMaximumLevelAtPosition(t));return o}addAvailableTileRange(t,o,s,i,r){}computeChildMaskForTile(t,o,s){return 0}computeBestAvailableLevelOverRectangle(t){return 0}isTileAvailable(t,o,s){return!1}constructor(){this.terrainAvailabilities={}}}class qo{async addPointCloud(t,o){try{const s="/api/dem-server/".concat(t,"/dem/dem.cog.tif"),i=await wl.R2.fromSources([s],{backupTerrainProvider:this.worldTerrainProvider,stitchToBackupTile:!0});this.terrainProviders[t]=i,this.customTileAvailability.addFullTerrainAvailability(t,i)}catch{return}}async removePointCloud(t){delete this.terrainProviders[t],this.customTileAvailability.removeTerrainSource(t)}get availability(){return this.customTileAvailability}get credit(){return this.worldTerrainProvider.credit}get errorEvent(){return this.worldTerrainProvider.errorEvent}get hasWaterMask(){return this.worldTerrainProvider.hasWaterMask}get hasVertexNormals(){return this.worldTerrainProvider.hasVertexNormals}get tilingScheme(){return this.worldTerrainProvider.tilingScheme}getTileDataAvailable(t,o,s){return this.worldTerrainProvider.getTileDataAvailable(t,o,s)||Object.values(this.terrainProviders).find(i=>i.getTileDataAvailable(t,o,s)===!0)!==void 0}requestTileGeometry(t,o,s,i){let r=32;if(s>$o)for(const a of Object.values(this.terrainProviders)){const[l,u]=Ll(t,o,s);if(a.getTileDataAvailable(t,o,s))return a.requestTileGeometry(t,o,s,i);r=Math.min(r,a.availability.computeMaximumLevelAtPosition(new Dt.Z(l,u)))}if(this.worldTerrainProvider.getTileDataAvailable(t,o,s)&&(s<r||s<$o))return this.worldTerrainProvider.requestTileGeometry(t,o,s,i)}getLevelMaximumGeometricError(t){var o;const s=(o=Math.max(...Object.values(this.terrainProviders).map(r=>r.getLevelMaximumGeometricError(t))))!==null&&o!==void 0?o:0;var i;return Math.max(s,(i=this.worldTerrainProvider.getLevelMaximumGeometricError(t))!==null&&i!==void 0?i:0)}async loadTileDataAvailability(t,o,s){const i=[this.worldTerrainProvider.loadTileDataAvailability(t,o,s),...Object.values(this.terrainProviders).map(r=>{r.loadTileDataAvailability(t,o,s)})];return Promise.allSettled(i).then(()=>{})}constructor(t){this.worldTerrainProvider=t,this.customTileAvailability=new Ol,this.terrainProviders={}}}function Ll(n,t,o){const i=.703125/2**o,r=n*256*i-180,a=(n+1)*256*i-180,l=t*256*i-90,u=(t+1)*256*i-90;return[(r+a)/2*Math.PI/180,(l+u)/2*Math.PI/180]}var At=d(90891);function Al(){return(0,c.useEffect)(()=>{const n="marketing-version-enabled";return document.body.classList.add(n),()=>{document.body.classList.remove(n)}},[]),null}var di=d(73496),on=d(42862);function Dl(n){const t=n.canvas;if(!t)return;const o={gpuInfo:null,webgl_support:"none",float32_support:!1,depth_texture_support:!1},s=t.getContext("webgl2")||t.getContext("webgl");
1if(s){o.webgl_support=s instanceof WebGL2RenderingContext?"webgl_2":"webgl_1",o.webgl_support==="webgl_2"?(o.float32_support=!0,o.depth_texture_support=!0):(o.float32_support=!!s.getExtension("EXT_color_buffer_float"),o.depth_texture_support=!!s.getExtension("WEBGL_depth_texture"));const i=s.getExtension("WEBGL_debug_renderer_info");i&&(o.gpuInfo=s.getParameter(i.UNMASKED_RENDERER_WEBGL))}return o}function Zl(){const{scene:n}=(0,me.VQ)(),t=(0,di.U0)();return(0,c.useEffect)(()=>{if(!n)return;const o=Dl(n);o&&t.capture("GPU_INFO",o)},[n,t]),null}function Fl(){const{scene:n,viewer:t}=(0,me.VQ)(),o=(0,di.U0)(),s=(0,c.useCallback)((i,r)=>{if(o.capture("CESIUM_ERROR",{error:"render_error",errorMessage:r.message,errorStack:r.stack}),!!t&&m.Z.magnitude(i.camera.positionWC)>1e7){const a=t.cesiumWidget._element.querySelector(".cesium-widget-errorPanel-buttonPanel").querySelector("button");a.innerHTML="Recover Camera",a.style.backgroundColor="#63e2b7",a.addEventListener("click",async()=>{i.camera.switchToPerspectiveFrustum();const l=new m.Z(on.d.x,on.d.y,on.d.z);i.camera.setView({destination:new m.Z(l.x,l.y,l.z),orientation:{heading:on.d.heading,pitch:on.d.pitch,roll:on.d.roll}}),t.cesiumWidget.render(),t.cesiumWidget.useDefaultRenderLoop=!0})}},[t,o]);return(0,c.useEffect)(()=>{if(!(!n||!t))return n.renderError.addEventListener(s),()=>{n.renderError.removeEventListener(s)}},[n,t,s]),null}var ui=d(64267),Nl=d(32770);function Bl(){const{viewer:n}=(0,me.VQ)(),t=(0,Jo._O)();return(0,c.useEffect)(()=>{const o=n?.scene;if(!o||!t)return;const s=new Nl.Z({scene:o});return t.setViewModel(s),()=>{t.setViewModel(null)}},[n,t]),null}var mi=d(92104);dl.Z.defaultAccessToken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI1MmM0ZGY4ZS04YTBhLTQwNWMtYTcyNi02MTQ3ZGQ2OGVkMmMiLCJpZCI6ODA5NTAsImlhdCI6MTY0MzMxNzQ5M30.xpgHc-QfzUhkiDrSLKWvF95m_QktZE8DUT-LmFSWP6c",ul.Z.defaultAccessToken="AAPKd9082ff0dc274c3ea11f01ac861cbab0FUqKQN8f2KEjq4aeC0s7UYv5EfX_YTfinqCpWmRYW_YsPQa26mDrr3_yR6MSVrKZ";
1const kl=(0,ui.q)(),Vl=mi.env.NEXT_PUBLIC_ON_PREM_MAPS?{baseLayerPicker:!1,geocoder:!1,shadows:!1}:{};mi.env.NEXT_PUBLIC_ON_PREM_MAPS&&console.log("On prem map settings enabled");const fi={selectionIndicator:!1,infoBox:!1,homeButton:!1,timeline:!1,sceneModePicker:!1,scene3DOnly:!0,shouldAnimate:!1,depthPlaneEllipsoidOffset:-1e3,imageryProviderViewModels:kl,baseLayerPicker:!1,geocoder:!1,navigationHelpButton:!1,...Vl},jp={...fi,baseLayerPicker:!1,homeButton:!1,navigationHelpButton:!1,fullscreenButton:!1};function hi(n,t){if(n)try{n.primitives._primitives.forEach(o=>{o instanceof ml.Z&&(o.debugFreezeFrame=t)})}catch(o){console.error(o)}}function Ul(n){const{scene:t}=(0,me.VQ)();return(0,c.useEffect)(()=>(t&&hi(t,n.suspendLoading),()=>{t&&hi(t,!1)}),[n.suspendLoading,t]),null}function Wl(){const[n,t]=(0,c.useState)(),o=(0,At.in)(),s=(0,c.useMemo)(()=>{const{promise:r,resolve:a}=Promise.withResolvers();return(async()=>{const l=await(0,fl.Z)();if(o){const u=new qo(l);t(u),a(u)}else{const u=new Ml(l);t(u),a(u)}})(),r},[o]),i=(0,Ut.n_)(r=>r);return(0,c.useEffect)(()=>{if(!n)return;const r=new AbortController;return(async()=>{const a=Object.keys(i);for(const l of a)if(n instanceof qo){const u=n;u.terrainProviders[l]===void 0&&await u.addPointCloud(l,r.signal)}else{const u=n;u.terrainProviders[l]===void 0&&await u.addPointCloud(l,r.signal)}if(n instanceof qo){const l=n;for(const u of Object.keys(l.terrainProviders))a.indexOf(u)===-1&&await l.removePointCloud(u)}else{const l=n;for(const u of Object.keys(l.terrainProviders))a.indexOf(u)===-1&&await l.removePointCloud(u)}})(),()=>r.abort()},[i,n]),s}function zl(n,t){return n?"grabbing":t||"auto"}const Hl=n=>{const t={position:"absolute",left:n.leftOffset||0,right:n.rightOffset||0,top:n.topOffset||0,bottom:n.bottomOffset||0,zIndex:0},[o,s]=(0,c.useState)(void 0),[i,r]=(0,c.useState)(!1),a=Wl(),l=zl(i,o),u=(0,N.I8)(),f=(0,En.ye)("useNewToolBar",!1);return(0,e.jsxs)("div",{style:{width:"100%",height:"100%",cursor:l},children:[(0,e.jsx)(me.AE,{terrainProvider:a,style:t,selectionIndicator:!1,fullscreenButton:!1,geocoder:!1,...n.viewerProps,children:(0,e.jsxs)(qe.zd,{onSetCursor:s,onSetDragging:r,children:[(0,e.jsx)(me.xs,{pickTranslucentDepth:!1,logarithmicDepthBuffer:!1}),(0,e.jsx)(me.C2,{enableLook:!1,enableRotate:!i,enableTilt:!i,enableTranslate:!i,inertiaSpin:i?0:1,inertiaTranslate:i?0:1,inertiaZoom:i?0:1}),(0,e.jsx)(Bl,{}),(0,e.jsx)(ve.z$,{}),(0,e.jsx)(gl,{}),(0,e.jsx)(Ul,{suspendLoading:u}),(0,e.jsx)(Fl,{}),(0,e.jsx)(Zl,{}),n.children,f&&(0,e.jsx)(Al,{})]})}),(0,e.jsx)(jl,{})]})};function Kl(n){return(0,c.useEffect)(()=>{if(n.text)return I.Z.show({intent:"danger",message:n.text},"error-toast"),()=>{I.Z.dismiss("error-toast")}},[n.text]),null}function Gl(n){return(0,e.jsx)(W.a3,{fallback:(0,e.jsx)(Kl,{text:n.message}),onError:t=>{console.error(t)},children:n.children})}var _l=d(79153),gi=d(67846),pi=d(12478),vi=d(18999),xi=d(35079),Yl=d(61861),Jl=d(24390),Xl=d(3007),es=d(65272);function Ql(n){var t;const o=(t=n.mode)!==null&&t!==void 0?t:es.q.Cesium,s=(0,c.useCallback)(()=>{const i=o===es.q.Cesium?(0,gi.bb)():(0,Xl.cR)(),r=(0,vi.zR)(),a=(0,xi.tp)(),l=(0,pi.VM)(),u=l.heapUsedMb>0&&l.totalHeapMb>0&&l.maxHeapSizeMb>0,f=i.fps!==1/0;let h=Object.fromEntries(Object.entries({...r,...a,...u?l:{},...f?i:{}}).map(g=>{let[p,v]=g;return[p,typeof v=="number"&&v===0?.01:v]}));return o===es.q.Rooster&&(h={...h,...$l(i,"rooster_")}),{eventName:"performance_tracking",properties:h}},[o]);return(0,e.jsx)(ql,{reportingIntervalSeconds:n.reportingIntervalSeconds,getMetricEvent:s})}function $l(n,t){return Object.fromEntries(Object.entries(n).map(o=>{let[s,i]=o;return[t+s,i]}))}const ql=n=>{let{reportingIntervalSeconds:t,getMetricEvent:o}=n;const s=(0,c.useRef)(Date.now()),i=(0,c.useRef)(null);return(0,c.useEffect)(()=>{const r=t*1e3;return i.current=setInterval(()=>ed(s.current,o),r),()=>{i.current&&clearInterval(i.current)}},[t,o]),null},ed=(n,t)=>{const s={app_runtime_seconds:Math.floor((Date.now()-n)/1e3),domain:window.location.hostname,path:window.location.pathname.slice(1)},i=t();if(Object.keys(i.properties).length===0){console.warn('Metric event "'.concat(i.eventName,'" has no properties.'));return}const r={...i.properties,...s};Jl.ZP.capture(i.eventName,r)};var Pt=d(72994);const td=ot.Record({object_id:ot.String,perception_object_id:ot.String}),nd=ot.Record({perception_object_id:ot.String}),od=ot.Record({object_id:ot.String}),sd=ot.Record({deltas:ot.Array(td),false_positives:ot.Array(nd),false_negatives:ot.Array(od)});var gn=d(84858);function id(){const n=(0,O.po)(),t=(0,b.TL)(),[o,s]=(0,c.useState)(void 0),[i,r]=(0,c.useState)(!1),[a,l]=(0,c.useState)(void 0),[u,f]=(0,c.useState)(void 0),h=(0,gn.Y6)(p=>p.minDelta),g=(0,gn.Y6)(p=>p.data!==null);return(0,e.jsxs)(Ce.Dialog,{isOpen:n,onClose:()=>{t((0,O.Mr)())},title:"ARP",className:Pt.Pyr,children:[(0,e.jsxs)("div",{className:Pt.TmF,children:[(0,e.jsxs)(Ce.FormGroup,{label:"Select output.json",children:[o&&(0,e.jsx)(Ce.Callout,{intent:"danger",style:{marginBottom:10},children:o}),(0,e.jsx)(Ce.FileInput,{text:a??"Import local objects",onInputChange:async p=>{if(!p.target.files)return;const v=p.target.files[0];if(v)try{r(!0);const y=await v.text(),S=JSON.parse(y),E=sd.check(S);f(E),l(v.name),s(void 0)}catch{s("Invalid output.json")}finally{r(!1)}}})]}),(0,e.jsx)(Ce.FormGroup,{label:"Minimum delta (m between centroids)",children:(0,e.jsx)("input",{type:"number",value:h,onChange:p=>{const v=parseFloat(p.target.value);Number.isNaN(v)||t((0,gn.ZT)(v))}})}),(0,e.jsx)(Ce.Button,{onClick:()=>{t((0,gn.ah)())},disabled:i||!g,children:"Clear"}),(0,e.jsx)("p",{style:{marginTop:20},children:(0,e.jsxs)("a",{href:"https://mach9robotics.atlassian.net/wiki/spaces/PLAD/pages/401244162/Perception+Run+Diff+Visualization",target:"_blank",rel:"noreferrer",children:["Help with ARP ",(0,e.jsx)(Ce.Icon,{icon:"share"})]})})]}),(0,e.jsx)("div",{className:Pt.Alt,children:(0,e.jsxs)("div",{className:Pt.e$L,children:[(0,e.jsx)(Ce.Button,{onClick:()=>{t((0,O.Mr)())},children:"Close"}),(0,e.jsx)(Ce.Button,{onClick:()=>{u&&(t((0,gn.cA)(u)),t((0,O.Mr)()))},disabled:!u||i,children:"Import"})]})})]})}var Vn=d(23150),rd=d(82615),ad=d(71412),$t=d(99884),fo=d(98560);const yi=600;function ts(n){return Math.exp(-n/yi)}function Ci(n){return-Math.log(n)*yi}const cd=Ci(1/10),ld=Ci(1/.7),Ei=(0,c.forwardRef)((n,t)=>
1{const{viewer:o,scene:s,camera:i}=(0,me.VQ)(),r=(0,c.useRef)(0),a=(0,c.useRef)(0),l=(0,c.useRef)(0),u=(0,fo.Z)("Alt");(0,c.useEffect)(()=>{if(!i)return;i.frustum instanceof en.Z||i.switchToPerspectiveFrustum();const ue=i.frustum.fov;return()=>{const De=i.frustum;De.fov=ue}},[i]);const{position:f,initialDirection:h,initialUp:g}=n,p=(0,c.useCallback)(function(){let ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;if(!i)return;const De=m.Z.cross(h,g,new m.Z),Qe=jt.Z.fromQuaternion(Vt.Z.fromAxisAngle(g,r.current)),He=jt.Z.multiplyByVector(Qe,De,new m.Z),Ne=jt.Z.fromQuaternion(Vt.Z.fromAxisAngle(He,a.current)),Ie=jt.Z.multiply(Ne,Qe,new jt.Z),Ke=jt.Z.multiplyByVector(Ie,h,new m.Z),et=jt.Z.multiplyByVector(Ie,g,new m.Z),ae={destination:f,orientation:{direction:Ke,up:et}},$e=i.frustum;$e.fov=Vn.Z.PI_OVER_THREE*ts(l.current),$e.near=.1,i.flyTo({...ae,duration:ue})},[i,f,h,g]);(0,c.useEffect)(()=>{p()},[p]);const v=(0,c.useRef)(!1),y=(0,c.useRef)(null),S=(0,c.useCallback)(ue=>{v.current=!0,y.current=at.Z.clone(ue.mousePosition)},[]),E=(0,c.useCallback)(ue=>{v.current=!1,y.current=null},[]),Z=(0,c.useCallback)((ue,De)=>{if(!v.current)return;if(!y.current){y.current=at.Z.clone(ue.mousePosition);return}const Qe=ue.mousePosition.x-y.current.x,He=ue.mousePosition.y-y.current.y,Ne=.001*ts(l.current),Ie=.001*ts(l.current);r.current=(r.current+Qe*Ne)%(2*Math.PI),a.current=Math.max(-Math.PI/2,Math.min(Math.PI/2,a.current+He*Ie)),y.current=at.Z.clone(ue.mousePosition),p()},[p]),P=(0,c.useCallback)(ue=>{u&&(v.current=!0,y.current=at.Z.clone(ue.mousePosition))},[u]),U=(0,c.useCallback)(ue=>{u?Z(ue,"Alt + Left"):v.current&&(v.current=!1,y.current=null)},[Z,u]),Y=(0,c.useCallback)(ue=>{v.current&&(v.current=!1,y.current=null)},[]),se=(0,c.useCallback)(ue=>{v.current=!0,y.current=at.Z.clone(ue.mousePosition)},[]),he=(0,c.useCallback)(ue=>{Z(ue,"Right mouse")},[Z]),ie=(0,c.useCallback)(ue=>{v.current=!1,y.current=null},[]),Oe=(0,c.useCallback)(ue=>{Z(ue,"Middle mouse")},[Z]);return(0,qe.sC)("onMiddleDragStart",S),(0,qe.sC)("onMiddleDrag",Oe),(0,qe.sC)("onMiddleDragEnd",E),(0,qe.sC)("onDragStart",P),(0,qe.sC)("onDrag",U),(0,qe.sC)("onDragEnd",Y),(0,qe.sC)("onRightDragStart",se),(0,qe.sC)("onRightDrag",he),(0,qe.sC)("onRightDragEnd",ie),(0,c.useEffect)(()=>{if(!o||!s)return;const ue=["tiltEventTypes","rotateEventTypes","zoomEventTypes","translateEventTypes"],De=ue.map(Ne=>s.screenSpaceCameraController[Ne]);ue.forEach(Ne=>s.screenSpaceCameraController[Ne]=void 0);const Qe=o.screenSpaceEventHandler,He=Qe.getInputAction($t.Z.WHEEL);return Qe.removeInputAction($t.Z.WHEEL),Qe.setInputAction(Ne=>{l.current=Math.max(ld,Math.min(cd,l.current+Ne)),p()},$t.Z.WHEEL),()=>{s&&!s.isDestroyed()&&s.screenSpaceCameraController&&!s.screenSpaceCameraController.isDestroyed()&&ue.forEach((Ne,Ie)=>s.screenSpaceCameraController[Ne]=De[Ie]),!(!o||o.isDestroyed()||!o.screenSpaceEventHandler||o.screenSpaceEventHandler.isDestroyed())&&(o.screenSpaceEventHandler.removeInputAction($t.Z.WHEEL),He&&o.screenSpaceEventHandler.setInputAction(He,$t.Z.WHEEL))}},[o,s,p]),(0,c.useImperativeHandle)(t,()=>({reset:()=>{r.current=0,a.current=0,l.current=0,p()},setInitialDirection:(ue,De)=>{r.current=ue,a.current=De,l.current=0,p()}}),[p]),null});Ei.displayName="FirstPersonPOVCamera";var dd=Ei,ho=d(1716),ud=d(48289),Ot=d(78231),ct=d(95497),vt=d(63410),md=d(95755),go=d(5534),fd=d(86932),hd=d(83587);function Si(n){const t=On.Z.WGS84.geodeticSurfaceNormal(n.position);return m.Z.cross(t,n.right,new m.Z)}function ji(n){const t=On.Z.WGS84.geodeticSurfaceNormal(n.position);return m.Z.cross(t,n.up,new m.Z)}function gd(n,t,o){if(t.kind!=="moving"||!n)return;const s=o/1e3,i=n.frustum instanceof kt.Z?n.frustum.width:void 0;n.move(t.spec.direction(n),t.spec.speed*t.heightAboveTerrain*s),n.frustum instanceof kt.Z&&i!==void 0&&(n.frustum.width=i)}const pd=1,vd=5;function Ti(n,t){const s={forward:{directionFn:Si,speedMultiplier:1},backward:{directionFn:Si,speedMultiplier:-1},left:{directionFn:ji,speedMultiplier:1},right:{directionFn:ji,speedMultiplier:-1}}[n];return{direction:s.directionFn,speed:s.speedMultiplier*t,combo:"",description:""}}function bi(){const{camera:n,globe:t}=(0,me.VQ)(),o=(0,c.useRef)({kind:"none"}),s=(0,c.useRef)(null),i=(0,c.useRef)(!1),r=(0,c.useCallback)(l=>{gd(n,o.current,l)},[n]);(0,hd.Z)(r);const a=(0,c.useCallback)(l=>{if(o.current.kind==="moving"&&s.current&&n&&t){const u=Dt.Z.fromCartesian(n.positionWC),f=t.getHeight(u),h=Math.max(5,f?u.height-f:5),g=Ti(s.current,l);o.current={kind:"moving",heightAboveTerrain:h,spec:g}}},[n,t]);return(0,c.useEffect)(()=>{const l=f=>{f.key==="Shift"&&!i.current&&(i.current=!0,a(vd))},u=f=>{f.key==="Shift"&&i.current&&(i.current=!1,a(pd))};return document.addEventListener("keydown",l),document.addEventListener("keyup",u),()=>{document.removeEventListener("keydown",l),document.removeEventListener("keyup",u)}},[a]),(0,c.useEffect)(()=>
1{if(!n||!t)return;const l=f=>{const h=f;s.current=h.detail.direction;const g=Dt.Z.fromCartesian(n.positionWC),p=t.getHeight(g),v=Math.max(5,p?g.height-p:5),y=Ti(h.detail.direction,h.detail.speed);o.current={kind:"moving",heightAboveTerrain:v,spec:y}},u=()=>{o.current={kind:"none"},s.current=null};return document.addEventListener("bridge:camera-start",l),document.addEventListener(Ot.JP.CAMERA_STOP,u),()=>{document.removeEventListener("bridge:camera-start",l),document.removeEventListener(Ot.JP.CAMERA_STOP,u)}},[n,t]),null}const ns=3;function xd(n){const{initialPosition:t,direction:o,up:s}=n,{viewer:i,scene:r,camera:a}=(0,me.VQ)(),l=(0,c.useRef)(t),u=(0,c.useRef)(void 0),f=(0,c.useCallback)(()=>{!a||!o||!s||!l.current||(a.setView({destination:l.current,orientation:{direction:o,up:s}}),a.frustum instanceof kt.Z&&u.current&&(a.frustum.width=u.current))},[a,o,s]);(0,c.useEffect)(()=>{f()},[f]);const h=(0,c.useRef)(!1),g=(0,c.useRef)(null),p=(0,c.useRef)(null);(0,c.useEffect)(()=>{g.current=null,l.current=t},[t]);const v=(0,c.useCallback)(P=>{a&&(h.current=!0,g.current=at.Z.clone(P.mousePosition),u.current=a.frustum instanceof kt.Z?a.frustum.width:void 0)},[a]),y=(0,c.useCallback)(P=>{h.current||(p.current=at.Z.clone(P.mousePosition))},[]),S=(0,c.useCallback)(P=>{if(!h.current||!a||!r||!o||!s||!u.current||!l.current||!i)return;if(!g.current){g.current=at.Z.clone(P.mousePosition);return}const U=P.mousePosition.x-g.current.x,Y=P.mousePosition.y-g.current.y,{width:se,height:he}=(0,go.S)(i),ie=m.Z.normalize(s,new m.Z),Oe=m.Z.cross(ie,o,new m.Z),ue=m.Z.add(m.Z.multiplyByScalar(Oe,U/se*u.current,new m.Z),m.Z.multiplyByScalar(ie,Y/he*u.current*he/se,new m.Z),new m.Z);l.current=m.Z.add(a.positionWC,ue,new m.Z),g.current=at.Z.clone(P.mousePosition),f()},[a,o,s,f,r,i]),E=(0,c.useCallback)(P=>{h.current=!1,g.current=null},[]),Z=(0,c.useRef)();return(0,c.useEffect)(()=>{if(!i||!r||!a)return;const P=["tiltEventTypes","zoomEventTypes","lookEventTypes"],U=P.map(he=>r.screenSpaceCameraController[he]);P.forEach(he=>r.screenSpaceCameraController[he]=void 0),Z.current=a.positionCartographic.height;const Y=i.screenSpaceEventHandler,se=Y.getInputAction($t.Z.WHEEL);return Y.removeInputAction($t.Z.WHEEL),Y.setInputAction(he=>{const ie=a.positionCartographic.height,Oe=r.globe.getHeight(a.positionCartographic);if(!Oe||!a||!o||!s||!l.current)return;const ue=ie-Oe,De=he/sn.nE,Qe=sn.jj*Math.log(2/(1+Math.exp(-Math.abs(De))))/Math.LN2,He=he>0?-1:1,Ne=ue+He*Qe*ue;if(!(Ne<ns)){if(Z.current&&(Ne>Z.current*2||Ne<Z.current/2)&&(a.changed.raiseEvent(.1),Z.current=Ne),p.current&&a&&r){const Ie=Ee.Z.multiplyByPointAsVector(Rt.Z.eastNorthUpToFixedFrame(a.positionWC),m.Z.UNIT_Z,new m.Z),{width:Ke,height:et}=(0,go.S)(i),ae=m.Z.normalize(s,new m.Z),$e=m.Z.cross(ae,o,new m.Z),Je=(p.current.x-Ke/2)/(Ke/2)*ue/2*(Qe*He),xt=(p.current.y-et/2)/(et/2)*ue/2*(et/Ke)*(Qe*He),Ge=m.Z.add(m.Z.add(m.Z.multiplyByScalar($e,Je,new m.Z),m.Z.multiplyByScalar(ae,xt,new m.Z),new m.Z),m.Z.multiplyByScalar(Ie,Ne-ue,new m.Z),new m.Z);u.current=Ne,l.current=m.Z.add(a.positionWC,Ge,new m.Z)}f()}},$t.Z.WHEEL),()=>{r&&!r.isDestroyed()&&r.screenSpaceCameraController&&!r.screenSpaceCameraController.isDestroyed()&&P.forEach((he,ie)=>r.screenSpaceCameraController[he]=U[ie]),!(!i||i.isDestroyed()||!i.screenSpaceEventHandler||i.screenSpaceEventHandler.isDestroyed())&&(i.screenSpaceEventHandler.removeInputAction($t.Z.WHEEL),se&&i.screenSpaceEventHandler.setInputAction(se,$t.Z.WHEEL))}},[i,r,a,o,s,f]),(0,qe.sC)("onMiddleDragStart",v),(0,qe.sC)("onMiddleDrag",S),(0,qe.sC)("onMiddleDragEnd",E),(0,qe.sC)("onMouseMove",y),null}function Pi(n,t){const s=n.positionCartographic.height-t,i=Rt.Z.eastNorthUpToFixedFrame(n.positionWC),r=Ee.Z.multiplyByPointAsVector(i,m.Z.UNIT_Z,new m.Z);let a=m.Z.multiplyByScalar(r,s,new m.Z);if(s<ns){const l=ns-s;a=m.Z.add(a,m.Z.multiplyByScalar(r,l,new m.Z),a)}return a}function yd(){const{camera:n,scene:t,viewer:o}=(0,me.VQ)(),s=(0,vt.Ox)(S=>S),i=(0,fd.y6)(),r=(0,c.useRef)(i),a=s.kind==="plan-view",l=s.kind==="plan-view"?s.initialTarget:void 0;var u;const[f,h]=(0,c.useState)((u=n?.positionWC)!==null&&u!==void 0?u:void 0),[g,p]=(0,c.useState)(void 0),v=(0,c.useMemo)(()=>n?m.Z.negate(On.Z.WGS84.geodeticSurfaceNormal(n.positionWC),new m.Z):void 0,[n]),y=(0,c.useMemo)(()=>
1{if(!n)return;const S=Rt.Z.eastNorthUpToFixedFrame(n.positionWC);return Ee.Z.multiplyByPointAsVector(S,m.Z.UNIT_Y,new m.Z)},[n]);return(0,c.useLayoutEffect)(()=>{if(n&&n.frustum instanceof en.Z&&t){const S=Rt.Z.eastNorthUpToFixedFrame(n.positionWC),E=Ee.Z.multiplyByPointAsVector(S,m.Z.UNIT_Z,new m.Z);if(n.switchToOrthographicFrustum(),n.frustum instanceof kt.Z){let Z;if(l){const P=t.globe.getHeight(n.positionCartographic);if(!P)return;const U=Pi(n,P),Y=m.Z.magnitude(U),se=m.Z.add(l,U,new m.Z);n.setView({destination:se,orientation:{heading:0,pitch:-Math.PI/2,roll:0}}),n.frustum.width=Y}else if(r.current){const P=m.Z.distance(r.current.position,n.positionWC),U=m.Z.multiplyByScalar(E,P,new m.Z),Y=m.Z.add(r.current.position,U,new m.Z);n.setView({destination:Y,orientation:{heading:0,pitch:-Math.PI/2,roll:0}}),n.frustum.width=P}else(async U=>{const se=(await(0,md.Z)(t.terrainProvider,Rl,[Dt.Z.fromCartesian(U)]))[0].height,he=Pi(n,se),ie=m.Z.magnitude(he);n.frustum instanceof kt.Z&&(n.setView({destination:U,orientation:{heading:0,pitch:-Math.PI/2,roll:0}}),n.frustum.width=ie)})(n.positionWC)}}return()=>{try{n&&(n.frustum instanceof kt.Z&&n.switchToPerspectiveFrustum(),n.lookAtTransform(Ee.Z.IDENTITY))}catch(S){if(S.message!=="Cannot read properties of undefined (reading 'drawingBufferWidth')")throw S}}},[a,n,l,t]),(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(bi,{}),(0,e.jsx)(xd,{initialPosition:f,direction:v,up:y})]})}const Cd=10,Pp={lowHeightThreshold:10,heightThresholdMultiplier:20};function Ed(){const{camera:n,scene:t,viewer:o}=(0,me.VQ)(),s=(0,c.useRef)(!1),i=(0,c.useRef)(void 0),r=(0,ft.F3)(),a=(0,ft.A9)(),l=(0,ft.F6)(),u=(0,c.useCallback)(g=>{if(!n||!t)return!0;try{const p=n.positionCartographic,v=t.globe.getHeight(p);if(v===void 0)return!0;const y=p.height-v,S=t.pickPosition(g.mousePosition);let E;if(S)E=m.Z.distance(n.positionWC,S);else{const Z=n.getPickRay(g.mousePosition),P=t.globe.pick(Z,t);if(!P)return!0;E=m.Z.distance(n.positionWC,P)}return y>a||E<Math.abs(l*y)}catch(p){return console.warn("Error validating tilt event:",p),!0}},[n,t,a,l]),f=(0,c.useCallback)(g=>{if(!t||!r)return;u(g)||(i.current=t.screenSpaceCameraController.tiltEventTypes,t.screenSpaceCameraController.tiltEventTypes=void 0,s.current=!0)},[u,t,r]),h=(0,c.useCallback)(()=>{!t||!s.current||!r||setTimeout(()=>{t.screenSpaceCameraController.tiltEventTypes=i.current,s.current=!1},Cd)},[t,r]);(0,qe.sC)("onRightDragStart",f),(0,qe.sC)("onRightDragEnd",h)}const Mp=180/Math.PI;function Sd(n){const{position:t,initialDirection:o,initialUp:s,cameraName:i,initialHeading:r,initialPitch:a}=n.mode,l=(0,c.useMemo)(()=>new m.Z(t.x,t.y,t.z),[t.x,t.y,t.z]),u=(0,c.useMemo)(()=>new m.Z(o.x,o.y,o.z),[o.x,o.y,o.z]),f=(0,c.useMemo)(()=>new m.Z(s.x,s.y,s.z),[s.x,s.y,s.z]),{camera:h}=(0,me.VQ)(),g=(0,vt.yK)();(0,c.useEffect)(()=>{if(!h)return;const v=g.kind==="normal"?-20:0,y=g.kind==="normal"?10:30,S=0;return()=>{const E=h.up.clone(),Z=h.direction.clone(),P=h.position.clone(),U=m.Z.add(m.Z.multiplyByScalar(Z,v,new m.Z),m.Z.multiplyByScalar(E,y,new m.Z),new m.Z),Y=m.Z.add(P,U,new m.Z),se=m.Z.normalize(m.Z.subtract(P,Y,new m.Z),new m.Z),he=m.Z.normalize(m.Z.cross(se,Z,new m.Z),new m.Z),ie=m.Z.normalize(m.Z.cross(he,se,new m.Z),new m.Z);try{h.flyTo({destination:Y,orientation:{direction:se,up:ie},duration:S})}catch(Oe){if(Oe.message!=="Cannot read properties of undefined (reading 'camera')")throw Oe}}},[h,l,u,f,g]);const p=(0,c.useRef)(null);return(0,c.useEffect)(()=>{p.current&&(r===void 0||a===void 0||(p.current.reset(),p.current.setInitialDirection(r,a)))},[r,a]),(0,c.useEffect)(()=>{p.current&&p.current.reset()},[i]),(0,e.jsx)(dd,{position:l,initialDirection:u,initialUp:f,cameraName:i,ref:p,snapping:n.snapping})}function jd(n,t){const o=Rt.Z.eastNorthUpToFixedFrame(n),s=m.Z.subtract(t,n,new m.Z),i=Ee.Z.multiplyByPointAsVector(Ee.Z.inverse(o,new Ee.Z),s,new m.Z),r=m.Z.normalize(i,new m.Z),a=Math.atan2(r.y,r.x)-Vn.Z.PI_OVER_TWO,l=Vn.Z.PI_OVER_TWO-Vn.Z.acosClamped(r.z),u=m.Z.magnitude(i);return new rd.Z(a,l,u)}function Mi(n){const{positionToSnapTo:t}=n,{camera:o}=(0,me.VQ)(),s=(0,vt.Ox)(u=>u),i=s.kind==="object-view",r=s.kind==="object-view"?s.snappingToSettings:void 0,a=(0,b.TL)(),l=(0,c.useRef)(void 0);return(0,c.useEffect)(()=>
1{if(!(!t||!o)){if(l.current!==t&&l.current!==void 0&&i){const u=o.positionWC,f=jd(u,l.current);o.lookAt(t,f)}else{const u=t,f=o.upWC.clone();let h=o.positionWC;if(r){const S=new m.Z(r.position.x,r.position.y,r.position.z),E=m.Z.subtract(S,u,new m.Z),Z=m.Z.magnitude(E),P=m.Z.magnitude(m.Z.subtract(h,u,new m.Z)),U=m.Z.multiplyByScalar(E,P/Z,new m.Z);h=m.Z.add(u,U,new m.Z)}const g=m.Z.subtract(h,u,new m.Z),p=Rt.Z.eastNorthUpToFixedFrame(u),v=Ee.Z.inverseTransformation(p,new Ee.Z),y=Ee.Z.multiplyByPointAsVector(v,g,new m.Z);if(o.lookAt(u,y),r){const S=new m.Z(r.direction.x,r.direction.y,r.direction.z),E=new m.Z(r.up.x,r.up.y,r.up.z);o.setView({orientation:{direction:S,up:E}}),a((0,vt.Mk)())}else m.Z.equalsEpsilon(y,m.Z.multiplyByScalar(m.Z.UNIT_Z,y.z,new m.Z),Vn.Z.EPSILON4)&&o.setView({orientation:{direction:o.directionWC,up:f}})}return i&&(l.current=t),()=>{o.lookAtTransform(Ee.Z.IDENTITY)}}},[o,t,r,a,i]),(0,e.jsx)(me.C2,{enableCollisionDetection:!1,enableLook:!0,enableRotate:!0,enableTilt:!0,enableTranslate:!1,enableZoom:!0,minimumZoomDistance:0,minimumCollisionTerrainHeight:0,minimumPickingTerrainDistanceWithInertia:0,minimumPickingTerrainHeight:0})}function Td(){const n=(0,le.ug)(),t=(0,xe.ng)(),o=(0,pt.WE)(a=>a.detail),s=(0,pt.WE)(a=>a.detail==="object"?a.key:null),i=(0,b.TL)();(0,c.useEffect)(()=>(document.body.setAttribute("camera-locked","true"),()=>{document.body.removeAttribute("camera-locked")}),[]),(0,c.useEffect)(()=>{switch(o){case"spline":i((0,vt.lh)(0));break;case"object":i((0,vt.mg)());break;default:i((0,vt.FI)())}},[o,i]);const r=(0,c.useMemo)(()=>{var a;if(!s)return;const l=n.getFeatureById(s);if(!l||l.__typename!=="ObjectAnnotation")return;const u=(a=t.trajectories[l.projectFileId])===null||a===void 0?void 0:a.visualizationMapping;if(u)return u.ecef_from_project_point(new m.Z(l.x,l.y,l.z))},[n,t.trajectories,s]);return r?(0,e.jsx)(Mi,{positionToSnapTo:r}):(0,e.jsx)(os,{})}function bd(n){const{distance:t,coords:o}=n,s=(0,c.useMemo)(()=>(0,ud.Z)(o),[o]),i=(0,c.useMemo)(()=>(0,ho.Z)(o,t).position,[o,t]),r=(0,b.TL)(),{camera:a}=(0,me.VQ)(),{nextDistance:l,previousDistance:u}=(0,c.useMemo)(()=>(0,ho.H)(o,t),[o,t]),f=(0,c.useCallback)(h=>{if(!a)return;h=Math.max(0,Math.min(s,h));const g=(0,ho.Z)(o,t),p=(0,ho.Z)(o,h),v=Ee.Z.multiplyByPointAsVector(Rt.Z.eastNorthUpToFixedFrame(g.position),m.Z.UNIT_Z,new m.Z),y=Math.asin(m.Z.dot(m.Z.cross(g.direction,p.direction,new m.Z),v)),S=jt.Z.fromQuaternion(Vt.Z.fromAxisAngle(v,y),new jt.Z),E=m.Z.add(p.position,jt.Z.multiplyByVector(S,m.Z.subtract(a.positionWC,g.position,new m.Z),new m.Z),new m.Z),Z=Ee.Z.inverseTransformation(a.transform,new Ee.Z);a.position=Ee.Z.multiplyByPoint(Z,E,new m.Z),r((0,vt.lh)(h))},[s,o,t,a,r]);return(0,c.useEffect)(()=>{const h=()=>{f(u)},g=()=>{f(l)};return document.addEventListener(Ot.JP.CAMERA_PREVIOUS_VERTEX,h),document.addEventListener(Ot.JP.CAMERA_NEXT_VERTEX,g),()=>{document.removeEventListener(Ot.JP.CAMERA_PREVIOUS_VERTEX,h),document.removeEventListener(Ot.JP.CAMERA_NEXT_VERTEX,g)}},[u,l,f]),(0,e.jsx)(Mi,{positionToSnapTo:i})}function Pd(n){const t=(0,le.ug)(),o=(0,xe.ng)(),s=(0,pt.WE)(l=>l.detail==="spline"?l.key:null),i=(0,pt.WE)(l=>l.detail),r=(0,b.TL)();(0,c.useEffect)(()=>(document.body.setAttribute("camera-locked","true"),()=>{document.body.removeAttribute("camera-locked")}),[]),(0,c.useEffect)(()=>{switch(i){case"spline":break;case"object":r((0,vt.mg)());break;default:r((0,vt.FI)())}},[i,r]);const a=(0,c.useMemo)(()=>{var l;if(!s)return;const u=t.getFeatureById(s);if(!u||u.__typename!=="LineAnnotation")return;const f=(l=o.trajectories[u.projectFileId])===null||l===void 0?void 0:l.visualizationMapping;if(f)return u.coords.map(h=>{let{x:g,y:p,z:v}=h;return f.ecef_from_project_point(new m.Z(g,p,v))})},[t,o.trajectories,s]);return a?(0,e.jsx)(bd,{distance:n.distance,coords:a}):(0,e.jsx)(os,{})}function Md(){const n=(0,vt.Ox)(s=>s.kind==="normal"?s.snappingToSettings:void 0),{camera:t}=(0,me.VQ)(),o=(0,b.TL)();(0,c.useEffect)(()=>{if(t){if(n){const{position:s,direction:i,up:r}=n,a=new m.Z(s.x,s.y,s.z),l=new m.Z(i.x,i.y,i.z),u=new m.Z(r.x,r.y,r.z);t.setView({destination:a,orientation:{direction:l,up:u}})}o((0,vt.Mk)())}},[t,n,o])}function Id(){return(0,e.jsx)(me.C2,{enableCollisionDetection:!1,enableLook:!1,enableRotate:!0,enableTilt:!0,enableTranslate:!0,enableZoom:!0,minimumCollisionTerrainHeight:15e3,minimumPickingTerrainHeight:15e4,minimumPickingTerrainDistanceWithInertia:4e3})}function os(){return Ed(),(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(bi,{}),(0,e.jsx)(Id,{})]})}function wd(){const{camera:n}=(0,me.VQ)(),t=(0,b.TL)(),o=(0,je.FE)(i=>i.cameraState),s=(0,c.useRef)(!1);(0,c.useEffect)(()=>
1{if(n&&!s.current){const l=new m.Z(o.x,o.y,o.z);var i,r,a;n.setView({destination:l,orientation:{heading:(i=o.heading)!==null&&i!==void 0?i:on.d.heading,pitch:(r=o.pitch)!==null&&r!==void 0?r:on.d.pitch,roll:(a=o.roll)!==null&&a!==void 0?a:on.d.roll}}),o.viewMode==="plan-view"&&t((0,vt.Xz)()),s.current=!0}},[n,o,t])}function Rd(){const n=(0,vt.Ox)(p=>p),{camera:t,scene:o,viewer:s}=(0,me.VQ)(),i=(0,b.TL)();wd();const r=(0,ct.hV)();var a;const l=(a=(0,ct.dv)(p=>!!p.liveSlider))!==null&&a!==void 0?a:!1,u=()=>{if(!t||!(n.kind==="normal"||n.kind==="plan-view")||!o)return;const p={heading:t.heading,pitch:t.pitch,roll:t.roll};i((0,je.FS)(t.positionWC,p,n.kind))},f=(0,ad.zl)(u,25);(0,c.useEffect)(()=>{if(!t||!s||(t.percentageChanged=.001,!r))return;const p=()=>{if(n.kind!=="normal"&&n.kind!=="plan-view")return;const v={heading:t.heading,pitch:t.pitch,roll:t.roll};!t.position||!v||i((0,je.FS)(t.positionWC,v,n.kind))};return t.moveEnd.addEventListener(p),t.changed.addEventListener(f),()=>{t.moveEnd.removeEventListener(p),t.changed.removeEventListener(f)}},[t,s,n,i,o,r,f]),Md();const h=(0,ct.sN)(),g=(0,At.Bz)().denseDepthDebugMode;return n.kind==="van-view"&&h!=="lidar"&&!g?(0,e.jsx)(Sd,{mode:n,snapping:l}):n.kind==="object-view"?(0,e.jsx)(Td,{}):n.kind==="line-view"?(0,e.jsx)(Pd,{distance:n.distanceAlongLine}):n.kind==="plan-view"?(0,e.jsx)(yd,{}):(0,e.jsx)(os,{})}var Od=Rd,Ii=d(60705),po=d(3344),wi=d(33489),Ld=d(80235),ln=d(76146),Ri=d(63380);const Oi={pickDebugOutcomes:[]},Un=Ld.jP,Ad=()=>{const{scene:n}=(0,me.VQ)(),[t,o]=(0,c.useState)(void 0),s=(0,b.TL)(),i=(0,Ri.h)(),a=(0,At.NJ)()&&i,l=(0,fo.Z)("Shift"),[u,f]=(0,c.useState)(Oi),h=(0,c.useCallback)(p=>{!n||!a||!l||o(p.mousePosition)},[n,a,l]);(0,qe.sC)("onClick",h),(0,c.useEffect)(()=>{if(!n||!t||!a)return;const p=n.camera.getPickRay(t);if(!p)return;if((0,po.SX)(),(0,wi.L9)(p,n,Un),Un.cachingOptions){const Z="frustumWidth"in Un.renderOptions?Un.renderOptions.frustumWidth*.25:.5;Tn(p,n,Z,0,0),Tn(p,n,-Z,0,0),Tn(p,n,0,Z,0),Tn(p,n,0,-Z,0),Tn(p,n,0,Z*.5,-Z),Tn(p,n,Z*5,0,0)}const v=(0,po.Dh)();if((0,po.IA)(),v.length===0){f(Oi);return}const y={pickDebugOutcomes:[]};for(const Z of v){var S,E;const P={pickTimeMs:Z.pickFinishedTime-Z.startTime,render:Z.render,transformedRender:Z.transformedRender,pickPositionText:(E=(S=Z.pickResult)===null||S===void 0?void 0:S.position.toString())!==null&&E!==void 0?E:"No points to pick",pickTilesetIdText:Z.pickResult&&Z.pickResult.tileset?Z.pickResult.tileset.pointCloudFileId:"No points to pick",ray:[Z.pickRay.origin.clone(),Bd(Z.pickRay,100)],pickResult:Z.pickResult?Z.pickResult.position:void 0,cacheResult:Z.cachePickStatus,pixelsUsed:Z.pixelsUsed};y.pickDebugOutcomes.push(P)}f(y)},[t,n,a,f]);const g=(0,c.useCallback)(p=>{p.stopPropagation(),s((0,At.DT)(!1))},[s]);return(0,e.jsx)(e.Fragment,{children:a&&(0,e.jsxs)(e.Fragment,{children:[u.pickDebugOutcomes.map((p,v)=>(0,e.jsx)(me.JH,{children:(0,e.jsx)(me.qz,{width:2,positions:p.ray,material:v===0?Pe.Z.RED:Pe.Z.PINK})},"pickline_".concat(v))),u.pickDebugOutcomes.filter(p=>!!p.pickResult).map((p,v)=>(0,e.jsx)(me.JH,{position:p.pickResult,children:(0,e.jsx)(me.l7,{pixelSize:8,color:v===0?Pe.Z.YELLOW:Pe.Z.YELLOWGREEN,outlineColor:Pe.Z.BLACK,outlineWidth:1})},"pickPoint_".concat(v))),(0,e.jsx)(ln.QP,{title:"Picking Debugging",topbarButtons:(0,e.jsx)(Ce.Button,{minimal:!0,small:!0,icon:"cross",onClick:g}),customBodyStyle:{paddingRight:"16px"},children:(0,e.jsx)(Dd,{outcomes:u.pickDebugOutcomes})})]})})};function Tn(n,t,o,s,i){const r=Zd(n,o,s,i);(0,po.SX)(),(0,wi.L9)(r,t,Un)}function Dd(n){return n.outcomes.length===0?(0,e.jsx)("div",{children:" Shift+Click on the pointcloud to test picking "}):(0,e.jsx)(e.Fragment,{children:n.outcomes.map((t,o)=>(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("span",{children:["PickTime: ",t.pickTimeMs.toFixed(2)," ms ",(0,e.jsx)("br",{}),"Pick Positon: ",t.pickPositionText," ",(0,e.jsx)("br",{}),"Pick Tileset: ",t.pickTilesetIdText," ",(0,e.jsx)("br",{}),"Cache Pick: ",t.cacheResult," ",(0,e.jsx)("br",{}),t.render&&(0,e.jsx)(Li,{render:t.render,pixelsUsed:t.pixelsUsed}),t.transformedRender&&(0,e.jsx)(Li,{render:t.transformedRender,pixelsUsed:t.pixelsUsed})]}),(0,e.jsx)("hr",{})]}))})}function Li(n){const t=(0,c.useRef)(null),o=(0,c.useCallback)(s=>
1{let i=Fd(s);return i=Nd(i,n.pixelsUsed),i},[n.pixelsUsed]);return(0,c.useEffect)(()=>{t.current&&(0,qn.xA)(n.render,t.current,o)},[n.render,o]),(0,e.jsx)("canvas",{ref:t,width:10,height:10,style:{backgroundColor:"black",width:"100px",height:"100px",imageRendering:"pixelated"}})}function Zd(n,t,o,s){let i=new m.Z(0,0,1);Math.abs(m.Z.dot(n.direction,i))>.99&&(i=new m.Z(1,0,0));const r=m.Z.cross(n.direction,i,new m.Z);m.Z.normalize(r,r);const a=m.Z.cross(r,n.direction,new m.Z);m.Z.normalize(a,a);const l=m.Z.clone(n.direction);m.Z.normalize(l,l);const u=m.Z.multiplyByScalar(r,t,new m.Z),f=m.Z.multiplyByScalar(a,o,new m.Z),h=m.Z.multiplyByScalar(l,s,new m.Z);let g=m.Z.add(u,f,new m.Z);g=m.Z.add(g,h,g);const p=m.Z.add(n.origin,g,new m.Z);return new io.Z(p,n.direction.clone())}function Fd(n){if(n.kind!=="float32")return n;let t=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;for(let a=0;a<n.pixels.length;a+=4){if(n.pixels[a+3]<=.01)continue;const u=n.pixels[a+2];u>t&&(t=u),u<o&&(o=u)}const s=t-o,i=new Float32Array(n.pixels.length);for(let a=0;a<n.pixels.length;a+=4)if(n.pixels[a+3]<=.01)i[a]=0,i[a+1]=0,i[a+2]=0,i[a+3]=0;else{const u=((n.pixels[a+2]-o)/s)**.333;i[a]=0,i[a+1]=u,i[a+2]=0,i[a+3]=1}return{kind:"float32",width:n.width,height:n.height,pixels:i}}function Nd(n,t){if(n.kind!=="float32")return n;const o=n.pixels.slice(),s=Math.max(1,Math.round(n.width*.05)),i=Math.floor(s/2);for(const{x:a,y:l}of t)for(let u=-i;u<=i;u++)for(let f=-i;f<=i;f++){const h=a+f,g=l+u;if(h>=0&&h<n.width&&g>=0&&g<n.height){const p=(g*n.width+h)*4;o[p]=1}}return{kind:"float32",width:n.width,height:n.height,pixels:o}}function Bd(n,t){const o=m.Z.multiplyByScalar(n.direction,t,new m.Z);return m.Z.add(n.origin,o,new m.Z)}var Ai=d(21423);const kd=["#00aaff","#ff00aa","#aaff00","#aa00ff","#ffaa00"];function Vd(n){const t=(0,At.l0)(),o=(0,At.t$)(n.layerId);var s;const i=(s=kd.find(l=>!Object.values(t).includes(l)))!==null&&s!==void 0?s:"#ff0000",r=(0,b.TL)(),a=(0,c.useId)();return(0,e.jsx)(Ce.FormGroup,{inline:!0,label:n.layerName,labelFor:a,children:(0,e.jsxs)(Ce.ControlGroup,{children:[(0,e.jsx)(Ce.Switch,{checked:!!o,onChange:()=>{r(o?(0,At.FE)(n.layerId):(0,At.fn)(n.layerId,i))},id:a}),o&&(0,e.jsx)("input",{type:"color",value:o??i,disabled:!o,onChange:l=>{r((0,At.fn)(n.layerId,l.target.value))}})]})})}function Ud(){const n=(0,Ai.Iu)();return(0,e.jsxs)("form",{children:[(0,e.jsx)("h3",{children:"Perception run colors"}),Object.entries(n).map(t=>{let[o,s]=t;return(0,e.jsx)(Vd,{layerId:o,layerName:s.name},o)})]})}function Wd(){const n=(0,Ai.yW)(),t=(0,xe.ng)();return t?(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{children:"Vis mapping overrides"}),Object.entries(t.vizMappingOverrides).map(o=>{let[s,i]=o;var r,a;return(0,e.jsxs)("div",{children:[(r=n[s])!==null&&r!==void 0?r:s," taken from ",(a=n[i])!==null&&a!==void 0?a:i]},s)})]}):null}function zd(){const n=(0,O.JZ)(),t=(0,b.TL)(),o=(0,At.Bz)(),s=(0,Wt.Be)();return(0,e.jsxs)(Ce.Dialog,{isOpen:n,onClose:()=>t((0,O.Mr)()),title:"Debug Settings",className:Pt.Pyr,children:[(0,e.jsxs)("div",{className:Pt.TmF,children:[(0,e.jsx)(Ce.Checkbox,{label:"Dense depth debug mode",checked:o.denseDepthDebugMode,onChange:i=>{t((0,At.Kb)(!o.denseDepthDebugMode))}}),(0,e.jsx)(Ce.Checkbox,{label:"No scene picking on mouse move",checked:o.noScenePickingOnMouseMove,onChange:i=>{t((0,At.TZ)(!o.noScenePickingOnMouseMove))}}),(0,e.jsx)(Ce.Checkbox,{label:"Pick directly against terrain (Warning: don't use custom terrain!)",checked:o.shouldPickDirectlyAgainstTerrain,onChange:i=>{t((0,At.gc)(!o.shouldPickDirectlyAgainstTerrain))}}),(0,e.jsx)(Ud,{}),(0,e.jsx)(Wd,{})]}),(0,e.jsx)("div",{className:Pt.Alt,children:(0,e.jsx)("div",{className:Pt.e$L,children:(0,e.jsx)(Ce.Button,{onClick:()=>t((0,O.Mr)()),children:"Close"})})})]})}var Hd=d(71570),vo=d(36105),Kd=d(30385);function Gd(n,t){n.imageryLayers.removeAll(),n.resolutionScale=window.devicePixelRatio/2,n.scene.sunBloom=!1,n.scene.skyAtmosphere.show=!1,n.scene.fog.enabled=!1,t.msaaSamples=1,t.skyAtmosphere.show=!1}function _d(){const n=(0,c.useMemo)(()=>(0,ui.q)(),[]),{selectedImageryId:t,switchImageryProvider:o}=(0,Kd.b)({availableImageryProviders:n}),s=(0,ft.Y1)();return(0,c.useCallback)((i,r)=>{i.resolutionScale=window.devicePixelRatio,i.scene.sunBloom=s,i.scene.skyAtmosphere.show=s,i.scene.fog.enabled=s,r.msaaSamples=4,r.skyAtmosphere.show=s,o(t)},[o,t,s])}function Yd(){const{scene:n,viewer:t}=(0,me.VQ)(),o=(0,ft.qC)(),s=_d();return(0,c.useEffect)(()=>
1{if(!(!n||!t))switch(o){case"Optimize":Gd(t,n);break;case"Default":s(t,n);break;default:(0,vo.Z)(o)}},[o,n,t,s]),null}function Jd(){const{scene:n,globe:t}=(0,me.VQ)(),o=(0,ft.FO)(),s=(0,ft.Y1)();return(0,c.useEffect)(()=>{if(!t||!n)return;const i=s?o:0;t.translucency.enabled=!0,t.translucency.backFaceAlpha=i,t.translucency.frontFaceAlpha=i,t.depthTestAgainstTerrain=!1,n.backgroundColor=Pe.Z.BLACK.clone(),n&&(n.skyBox.show=!1,n.sun.show=!1,n.moon.show=!1),n.skyAtmosphere.show=s},[t,n,o,s]),null}function Ip(){const{scene:n,globe:t}=useCesium();return useEffect(()=>{!n||!t||(t.show=!1,n.skyBox.show=!1,n.skyAtmosphere.show=!1,n.sun.show=!1,n.moon.show=!1)},[n,t]),null}var xo=d(51566),ss=d(49601),Xd=d(96335);const Qd={0:"0",30:"30",60:"60",90:"90"},$d={0:"N",90:"E",180:"S",270:"W",360:"N"};function qd(){var n;const t=(0,je.Jk)(),o=Math.max(0,Math.min(90,Math.round(-t.pitch*180/Math.PI))),s=(n=(0,ve.wT)())===null||n===void 0?void 0:n.camera,i=r=>{const a=-r*Math.PI/180;s&&s.setView({destination:s.position,orientation:{heading:s.heading,pitch:a,roll:s.roll}})};return(0,e.jsxs)(Zt.wk8,{children:[(0,e.jsx)("div",{className:"flex h-5 flex-row items-center justify-between",children:(0,e.jsx)(Zt.gY2,{isQuiet:!0,children:"Tilt"})}),(0,e.jsx)(Zt.KlT,{"aria-label":"Tilt degrees",minValue:0,maxValue:90,value:o,onChange:i,step:1,shouldShowOutput:!1,className:"px-2",labelValues:[0,30,60,90],labelRenderer:r=>Qd[r]||"".concat(r)})]})}function eu(){var n;const o=(0,je.Jk)().heading*360/(2*Math.PI),s=(n=(0,ve.wT)())===null||n===void 0?void 0:n.camera,i=r=>{let a=r*Math.PI/180;a===0&&(a=.001),s&&s.setView({destination:s.position,orientation:{heading:a,pitch:s.pitch,roll:s.roll}})};return(0,e.jsxs)(Zt.wk8,{children:[(0,e.jsx)("div",{className:"flex h-5 flex-row items-center justify-between",children:(0,e.jsx)(Zt.gY2,{isQuiet:!0,children:"Heading"})}),(0,e.jsx)(Zt.KlT,{"aria-label":"Heading degrees",minValue:0,maxValue:360,value:o,onChange:i,step:1,shouldShowOutput:!1,className:"px-2 pb-3",labelValues:[0,90,180,270,360],labelRenderer:r=>$d[r]||"".concat(r,"\xB0")})]})}function tu(){const[n,t]=(0,c.useState)(!1),o=(0,vt.Ox)(u=>u.kind)==="normal",s=(0,ct.S1)(),i=(0,ct.sN)(),r=(0,je.Jk)().heading,a=c.cloneElement(K.LrQ,{style:{transform:"rotate(".concat(-r-Math.PI/4,"rad)")}}),l=!o||s&&(i==="split"||i==="image");return(0,c.useEffect)(()=>{l&&n&&t(!1)},[l,n]),(0,e.jsxs)(xo.hg,{isOpen:n,onOpenChange:t,children:[(0,e.jsx)(ss.E,{title:"Camera settings","aria-label":"Camera settings",isSelected:n,isDisabled:l,children:a}),(0,e.jsx)(Zt.uvk,{placement:"bottom end",showArrow:!0,className:"min-w-panel",children:(0,e.jsxs)(xo.Vq,{className:"outline-none",children:[(0,e.jsx)(qd,{}),(0,e.jsx)(eu,{})]})})]})}var nu=d(34451),Di=d(73920);function ou(){const n=(0,ve.wT)(),t=n?.camera,o=n?.scene,s=n?.viewer,i=(0,vt.Ox)(v=>v.kind),r=(0,b.TL)(),a=(0,Di.Z)(),l=i==="plan-view",u=(0,ct.S1)(),f=(0,ct.sN)(),h=(0,de.x)(Ot.JP.CAMERA_TOGGLE_PLAN_VIEW),g=(0,c.useCallback)(v=>{if(t&&v&&i==="normal"){if(!o||!s)return;const{width:y,height:S}=(0,go.S)(s),E=new at.Z(y/2,S/2),Z=a(E),P=Z?.position;r(P?(0,vt.it)(P):(0,vt.Xz)())}else t&&!v&&i==="plan-view"&&r((0,vt.DN)())},[t,i,o,s,a,r]);(0,c.useEffect)(()=>{const v=()=>{g(!l)};return document.addEventListener(Ot.JP.CAMERA_TOGGLE_PLAN_VIEW,v),()=>{document.removeEventListener(Ot.JP.CAMERA_TOGGLE_PLAN_VIEW,v)}},[g,l]);const p=u&&(f==="split"||f==="image");return(0,e.jsx)(nu.c,{title:l?"Switch to perspective mode":"Switch to plan mode",hotkey:h.keybinding,onIcon:K.dDC,offIcon:K.pj6,isSelected:l,isDisabled:p,onChange:g})}function su(){return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ou,{}),(0,e.jsx)(tu,{})]})}var iu=d(49971),ru=d(31184),Zi=d(36579);function au(){const n=(0,b.TL)(),t=(0,ve.wT)(),o=t?.scene,[s,i]=(0,c.useState)({fps:0,isLowFrameRate:!1});(0,c.useEffect)(()=>{if(!o)return;const a=Zi.Z.fromScene(o),l=()=>{i(h=>({...h,isLowFrameRate:!0}))},u=()=>{i(h=>({...h,isLowFrameRate:!1}))};a.lowFrameRate.addEventListener(l),a.nominalFrameRate.addEventListener(u);const f=setInterval(()=>{a.lastFramesPerSecond!==void 0&&i(h=>({...h,fps:a.lastFramesPerSecond}))},1e3);return()=>{a.lowFrameRate.removeEventListener(l),a.nominalFrameRate.removeEventListener(u),clearInterval(f),typeof a.destroy=="function"&&a.destroy()}},[o]);const r=(0,c.useCallback)(()=>{n((0,ft.ob)(!0))},[n]);return(0,e.jsxs)(C.RequireFeatureFlag,{featureFlag:"fpsCounter",featureFlagDefault:!1,children:[(0,e.jsx)(Zt.zeo,{title:"Frame Rate",description:"Current frames per second",variant:"admin",size:"sm",isFixedWidth:!1,onPress:r,children:(0,e.jsxs)("div",{className:"flex justify-between gap-1",children:[(0,e.jsx)("span",{children:"FPS: "}),(0,e.jsx)("span",{className:"flex w-5 justify-end",children:s.fps?s.fps.toFixed(1):"N/A"})]})}),(0,e.jsx)(Zt.P7h,{})]})}function cu(){const[n,t]=(0,c.useState)(!1),[o,s]=(0,c.useState)(!1),{isCollapsed:i}=(0,b.CG)(jn._m),r=(0,N.jk)(h=>!!h.crossSection),a=(0,Mt.Qq)(),l=i&&(a==="horizontal"||!r),u=(0,Q.ye)("useNewCameraSettingsUi",!1),f=(0,Q.ye)("useNewTrajectoryViewPanel",!1);return(0,e.jsx)("div",{className:"absolute right-3 top-3 z-toolbar",children:(0,e.jsxs)(Zt.sDD,{variant:"elevated",className:"bg-bg",children:[u&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(au,{}),(0,e.jsx)(su,{})]}),(0,e.jsxs)(xo.hg,{isOpen:n,onOpenChange:t,children:[(0,e.jsx)(ss.E,{title:"Display settings",isSelected:n,children:K.lLt}),(0,e.jsx)(Zt.uvk,{placement:"bottom end",showArrow:!0,className:"max-w-rightSidebar bg-border",size:"lg",shouldCloseOnInteractOutside:h=>!h.closest("[data-styled-select-popover]"),children:(0,e.jsx)(xo.Vq,{className:"outline-none",children:(0,e.jsx)(iu.A,{})})})]}),f&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ss.E,{title:"Settings",isSelected:o,onPress:()=>s(!0),children:K.dHW}),(0,e.jsx)(ru.Z,{isOpen:o,onClose:()=>s(!1)})]}),l&&(0,e.jsx)(Xd.Z$,{})]})})}var is=d(74158),rs=d(52679),Wn=d(69036),Fi=d(34273),Ni=d(51568),Bi=d(34149),lu=d(83783),du=d(53155),as=d(71883),cs=d(38368),uu=d(35470),mu=d(25865),ls=d(36091),fu=d(14064),hu=d(46795);class gu{getKeyFromIndices(t,o){return t<o?"".concat(t,"-").concat(o):"".concat(o,"-").concat(t)}getIndicesFromKey(t){const[o,s]=t.split("-").map(Number);return o<s?[o,s]:[s,o]}setConstraint(t,o,s){this.map.set(this.getKeyFromIndices(t,o),s)}getConstraint(t,o){return this.map.get(this.getKeyFromIndices(t,o))}hasConstraint(t,o){return this.map.has(this.getKeyFromIndices(t,o))}entries(){return Array.from(this.map.entries()).map(t=>{let[o,s]=t;return[this.getIndicesFromKey(o),s]})}constructor(){this.map=new Map}}function zn(n){return"".concat(n.x.toFixed(5),"-").concat(n.y.toFixed(5))}function ds(n,t,o){const s=t[n*2],i=t[n*2+1],r=zn(new m.Z(s,i,0)),a=o.get(r);if(!a)throw new Error("Point with x:".concat(s," and y:").concat(i," not found in coordMap"));return a.vertex}function pu(n,t){const o=[];for(const[a,l]of Array.from(n.entries()).sort((u,f)=>u[1].verticesIndex-f[1].verticesIndex)){const u=[l.vertex.x,l.vertex.y];o.push(...u)}const s=new hu.Z(o);let i=[];return t&&(i=vu(s,t)),{triangles:xu(s,n),constraintFailures:i}}function vu(n,t){const o=new fu.Z(n),s=[];for(const[i,r]of t.entries())try{o.constrainOne(...i)}catch(a){a.message==="Edge intersects already constrained edge"?s.push({...r,type:ye.mW.OVERLAPPING_EDGE}):a.message==="Constraining edge intersects point"?s.push({...r,type:ye.mW.OVERLAPPING_EDGE}):s.push({...r,type:ye.mW.INVALID_TRIANGULATION})}return s}function xu(n,t){const o=[];for(let s=0;s<n.triangles.length;s+=3){const i=n.triangles[s],r=n.triangles[s+1],a=n.triangles[s+2],l=ds(i,n.coords,t),u=ds(r,n.coords,t),f=ds(a,n.coords,t);o.push([l,u,f])}return o}var Hn=d(36624),lt=d(8703),Kn=d(10749),pn=d(39878),bn=d(21349),Pn=d(526),Yt=d(62368);function us(n,t,o){const s=(n.x-o.x)*(t.y-o.y)-(t.x-o.x)*(n.y-o.y);return s>0?"Clockwise":s<0?"Counterclockwise":"Collinear"}function yu(n,t){const o=[us(n,t[0],t[1]),us(n,t[1],t[2]),us(n,t[2],t[0])],s=o.some(r=>r==="Clockwise"),i=o.some(r=>r==="Counterclockwise");return!(s&&i)}function ms(n,t){for(let o=1;o<t.length-1;o++)if(yu(n,[t[0],t[o],t[o+1]]))return!0;return!1}function zt(n,t){let o=1/0,s=-1/0,i=1/0,r=-1/0;for(const a of n)o=Math.min(o,a.x),s=Math.max(s,a.x),i=Math.min(i,a.y),r=Math.max(r,a.y);return t&&(o=Math.floor(o/t)*t,s=Math.ceil(s/t)*t,i=Math.floor(i/t)*t,r=Math.ceil(r/t)*t),{minx:o,maxx:s,miny:i,maxy:r}}function wp(n,t){const{minx:o,maxx:s,miny:i,maxy:r}=zt(n,t),a=[],l=Math.max(...n.map(f=>f.z)),u=Math.min(...n.map(f=>f.z));for(let f=o;f<=s;f+=t)for(let h=i;h<=r;h+=t){const g=IntersectionTests.lineSegmentTriangle(new Cartesian3(f,h,u),new Cartesian3(f,h,l),n[0],n[1],n[2]);g&&a.push(g)}return a}const Cu=.001;function ki(n,t){const o=zn(n),s=t.get(o);if(s)return s.verticesIndex}function Eu(n,t){const o=new gu,s=new Map,i=[];for(const r of n){const a=r.coords.map(l=>{let{x:u,y:f,z:h}=l;return new m.Z(u,f,h)});for(let l=0;l<a.length;l++){if(!ms(a[l],t))continue;const u=zn(a[l]);if(s.has(u)){const g=s.get(u);g&&!g.vertex.equalsEpsilon(a[l],Cu)&&i.push({lineId:r.id,startIndex:l,type:ye.mW.DOUBLED_VERTEX})}else{const g=s.size;s.set(u,{vertex:a[l],verticesIndex:g})}if(l===0)continue;const f=ki(a[l-1],s),h=ki(a[l],s);ms(a[l-1],t)&&f&&h&&f!==h&&o.setConstraint(f,h,{lineId:r.id,startIndex:l-1})}}return{coordMap:s,constraintMap:o,verticalOverlapViolations:i}}var fs=d(2083);const Su=[[0,1],[1,0],[0,-1],[-1,0],[1,1],[1,-1],[-1,1],[-1,-1],[0,2],[2,0],[0,-2],[-2,0],[1,2],[2,1],[2,-1],[1,-2],[-1,-2],[-2,-1],[-2,1],[-1,2],[2,2],[2,-2],[-2,2],[-2,-2],[0,3],[3,0],[0,-3],[-3,0],[1,3],[3,1],[3,-1],[1,-3],[-1,-3],[-3,-1],[-3,1],[
1-1,3],[2,3],[3,2],[3,-2],[2,-3],[-2,-3],[-3,-2],[-3,2],[-2,3],[3,3],[3,-3],[-3,3],[-3,-3],[0,4],[4,0],[0,-4],[-4,0],[1,4],[4,1],[4,-1],[1,-4],[-1,-4],[-4,-1],[-4,1],[-1,4],[2,4],[4,2],[4,-2],[2,-4],[-2,-4],[-4,-2],[-4,2],[-2,4],[3,4],[4,3],[4,-3],[3,-4],[-3,-4],[-4,-3],[-4,3],[-3,4],[4,4],[4,-4],[-4,4],[-4,-4],[0,5],[5,0],[0,-5],[-5,0],[1,5],[5,1],[5,-1],[1,-5],[-1,-5],[-5,-1],[-5,1],[-1,5],[2,5],[5,2],[5,-2],[2,-5],[-2,-5],[-5,-2],[-5,2],[-2,5],[3,5],[5,3],[5,-3],[3,-5],[-3,-5],[-5,-3],[-5,3],[-3,5]];function ju(n,t,o,s,i){const r=(0,b.TL)(),[a,l]=(0,c.useState)({status:"idle"}),u=(0,T.$K)(),{scene:f}=(0,me.VQ)(),h=(0,ye.pW)(),g=(0,c.useMemo)(()=>n,[n]),p=(0,c.useMemo)(()=>t,[t]),v=(0,c.useMemo)(()=>{if(!g||!p)return null;const Z=g.maxx-g.minx,P=g.maxy-g.miny;if(!Number.isFinite(Z)||!Number.isFinite(P)||Z<=0||P<=0)return console.error("Invalid bounding box dimensions:",g),null;const U=p.ecef_from_project_dimension(Z),Y=p.ecef_from_project_dimension(P);if(!Number.isFinite(U)||!Number.isFinite(Y))return console.error("Invalid meter dimensions:",{widthMeters:U,heightMeters:Y}),null;const se=U/Y,he=2048;let ie,Oe;return se>=1?(ie=he,Oe=Math.round(he/se)):(Oe=he,ie=Math.round(he*se)),{arbRenKey:"drapePointsHeightTexture",width:ie,height:Oe,nearDepth:1,farDepth:1e3,kind:"orthographic",frustumWidth:U,pixelDataType:Ft.Z.FLOAT}},[g,p]),y=(0,T.UF)(v||{arbRenKey:"fallback",width:128,height:128,nearDepth:.1,farDepth:void 0,kind:"orthographic",frustumWidth:10,pixelDataType:Ft.Z.FLOAT});(0,c.useEffect)(()=>{switch(a.status){case"idle":case"error":r((0,ye.h3)(0));break;case"starting":r((0,ye.h3)(.5));break;case"success":r((0,ye.h3)(1));break}},[a.status,r]),(0,c.useEffect)(()=>{y.status==="instanceExists"&&y.arbRenInstance&&v&&(0,qn.WV)(y.arbRenInstance,v)},[y.status,y.arbRenInstance,v]);const S=(0,c.useMemo)(()=>y.arbRenInstance,[y.arbRenInstance]),E=(0,c.useMemo)(()=>v,[v]);return(0,c.useEffect)(()=>{if(!S||y.status==="notReady"||!E||!p||!g){l({status:"idle"});return}l({status:"starting"}),setTimeout(()=>{try{const P=S;if(!f){console.error("Scene not available for drape rendering"),l({status:"error",error:"Scene not available"});return}const U=o,Y=new m.Z((g.minx+g.maxx)/2,(g.miny+g.maxy)/2,U);if(!Number.isFinite(Y.x)||!Number.isFinite(Y.y)||!Number.isFinite(Y.z)){console.error("Invalid PCS coordinates:",Y,"from bounding box:",g),l({status:"error",error:"Invalid PCS coordinates"});return}const se=p.ecef_from_project_point(Y);if(!Number.isFinite(se.x)||!Number.isFinite(se.y)||!Number.isFinite(se.z)){console.error("Invalid ECEF coordinates:",se,"from PCS:",Y),l({status:"error",error:"Invalid ECEF coordinates"});return}const he=500,ie=new m.Z(Y.x,Y.y,Y.z+he),Oe=new m.Z(Y.x,Y.y,Y.z),ue=m.Z.normalize(m.Z.subtract(Oe,ie,new m.Z),new m.Z),De=new m.Z(0,1,0),Qe=m.Z.cross(ue,De,new m.Z),He=Ee.Z.computeView(ie,ue,De,Qe,new Ee.Z),Ne=Ee.Z.inverseTransformation(He,new Ee.Z),Ie=p.ecef_from_project_point(ie),Ke=p.ecef_from_project_point(Oe),et=m.Z.normalize(m.Z.subtract(Ke,Ie,new m.Z),new m.Z),ae=m.Z.add(Y,De,new m.Z),$e=p.ecef_from_project_point(ae),Je=m.Z.normalize(m.Z.subtract($e,se,new m.Z),new m.Z),xt=new io.Z(Ie,et),Ge=(()=>{const Ht=u.getAllRegisteredTilesets();return Ht.length===0||!f?[]:[()=>(0,fs.uw)(f,Ht),()=>(0,fs.$1)(f),()=>(0,fs.Fq)(f,Ht,p,s,Ne)]})(),tt=P.generateRenderFromRay(xt,Ge,Je);if(!tt||tt.kind!=="float32"){console.error("DrapePoints render failed:",tt),l({status:"error",error:"Render generation failed"});return}const gt=tt.pixels;let ut=0,wt=0;for(let Ht=0;Ht<gt.length;Ht+=4e3){const $n=gt[Ht],mn=gt[Ht+1],Lo=gt[Ht+2];$n===0&&mn===0&&Lo===0?ut++:wt++}l({status:"success",renderPixels:tt.pixels,width:tt.width,height:tt.height})}catch(P){console.error("DrapePoints render error:",P),l({status:"error",error:String(P)})}},0)},[S,y.status,E,p,g,f,u,o,s,h,i]),a}function Tu(n){const{triangles:t,polygon:o,onTextureReady:s,onGradientBoundsCalculated:i}=n,r=(0,ye._K)(),a=(0,ye.yW)(),l=(0,xe.J5)(a),u=l?.visualizationMapping,{scene:f}=(0,me.VQ)(),h=(0,ye.N)(),[g,p]=(0,c.useState)(0);(0,c.useEffect)(()=>{if(o.length>0){const Z=setTimeout(()=>{p(P=>P+1)},50);return()=>clearTimeout(Z)}},[o]);const v=(0,c.useMemo)(()=>o.length===0?null:zt(o,r),[o,r]),y=(0,c.useMemo)(()=>o.length===0?0:o.reduce((Z,P)=>Z+P.z,0)/o.length,[o]),S=ju(v,u,y,h.drapeUpDepthFlip,g);function E(Z){const P=Math.max(0,Math.min(1,Z)),U=Math.floor(P*16777215)|0;return[U>>>16&255,U>>>8&255,U&255,255]}return(0,c.useEffect)(()=>{S.status==="success"&&S.renderPixels&&f?(async()=>{try{const P=S.renderPixels,U=S.width,Y=S.height;if(!P){console.error("No pixel data available"),s?.(void 0);return}const se=document.createElement("canvas");se.width=U,se.height=Y;const he=se.getContext("2d",{colorSpace:"srgb"});if(he){let Oe=function(Ne,Ie,Ke){for(const[et,ae]of Su){const $e=Ne+et,Je=Ie+ae;if($e<0||$e>=U||Je<0||Je>=Y)continue;const Ge=((Y-1-Je)*U+$e)*4;if(Ke[Ge+3]>.5)return Ke[Ge+0]}return null};const ie=he.createImageData(U,Y);let ue=1/0,De=-1/0,Qe=0;for(let Ne=0;Ne<Y;Ne++)for(let Ie=0;Ie<U;Ie++){const Ke=(Ne*U+Ie)*4;if(P[Ke+3]>.5){const et=P[Ke+0];ue=Math.min(ue,et),De=Math.max(De,et),Qe++}}if(Qe===0){i?.(0,1),he.putImageData(ie,0,0),s?.(se);return}(ue===1/0||De===-1/0)&&(ue=0,De=0),ue-=.1,De+=.1,i?.(ue,De);const He=64;for(let Ne=0;Ne<Y;Ne+=He){const Ie=Math.min(Ne+He,Y);for(let Ke=Ne;Ke<Ie;Ke++)for(let et=0;et<U;et++){const $e=((Y-1-Ke)*U+et)*4,Je=(Ke*U+et)*4,xt=Math.max(1e-9,De-ue),Ge=tt=>
1{const gt=(tt-ue)/xt,[ut,wt,Ht,$n]=E(gt);ie.data[Je+0]=ut,ie.data[Je+1]=wt,ie.data[Je+2]=Ht,ie.data[Je+3]=$n};if(P[$e+3]<.5){const tt=Oe(et,Ke,P);tt!==null&&Ge(tt)}else{const tt=P[$e+0];Ge(tt)}}Ie<Y&&await new Promise(Ke=>setTimeout(Ke,0))}he.putImageData(ie,0,0),s?.(se)}else s?.(void 0)}catch(P){console.error("Failed to create canvas:",P),s?.(void 0)}})():s?.(void 0)},[S,s,i,f]),null}function bu(n){const[t,o,s]=n;return[t.x,t.y,t.z,o.x,o.y,o.z,s.x,s.y,s.z]}function Pu(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const t=(0,ye.um)(),o=(0,ye._1)(),s=(0,ye.sQ)(),i=(0,ye.yW)(),r=(0,xe.J5)(i),a=r?.visualizationMapping,l=(0,b.TL)(),u=(0,ye.N)(),f=(0,c.useRef)(u);f.current=u;const h=(0,c.useCallback)((ae,$e)=>{const Je=f.current;(Math.abs(Je.gradientMin-ae)>.001||Math.abs(Je.gradientMax-$e)>.001)&&l((0,ye.p5)({...Je,gradientMin:ae,gradientMax:$e}))},[l]),g=(0,ye.XT)(),{drapePointsDebugMode:p=!1}=n,{scene:v}=(0,me.VQ)(),y=(0,ye._K)(),S=Mu(i,o),{pcsPolygon:E,ecefPolygon:Z}=Iu(o,a),P=(0,nt.ZP)(Z),U=(0,nt.QV)(P,ae=>ae.length>=3?[...ae,ae[0]]:ae,(ae,$e)=>{ae.set($e.slice(0,-1))}),Y=(0,c.useCallback)(()=>{const ae=P.get();l((0,ye.MA)(ae.map($e=>(0,Bt.Wp)($e))))},[l,P]),{pcsTriangles:se,constraintFailures:he}=wu(i,a,E),ie=Ru(se,a,s),Oe=(0,c.useMemo)(()=>{if(!E.length||!a)return null;const ae=zt(E,y),$e=a.ecef_from_project_point(new m.Z((ae.minx+ae.maxx)/2,(ae.miny+ae.maxy)/2,0)),Je=a.ecef_from_project_dimension(ae.maxx-ae.minx),xt=a.ecef_from_project_dimension(ae.maxy-ae.miny);return{centerX:$e.x,centerY:$e.y,halfWidth:Je/2,halfHeight:xt/2}},[E,y,a]),[ue,De]=(0,c.useState)(void 0);(0,c.useEffect)(()=>{De(void 0)},[E]);const Qe=(0,c.useMemo)(()=>ie.length?Math.max(...ie.flat().map(ae=>ae.z))+1:0,[ie]),He=(0,c.useMemo)(()=>{const ae=[];for(const $e of ie){const[Je,xt,Ge]=$e;ae.push(new an.Z({geometry:new is.Z({positions:[Je,xt],width:3,arcType:rs.Z.NONE,vertexFormat:Wn.Z.VERTEX_FORMAT}),attributes:{color:cn.Z.fromColor(Pe.Z.BLACK)}})),ae.push(new an.Z({geometry:new is.Z({positions:[xt,Ge],width:3,arcType:rs.Z.NONE,vertexFormat:Wn.Z.VERTEX_FORMAT}),attributes:{color:cn.Z.fromColor(Pe.Z.BLACK)}})),ae.push(new an.Z({geometry:new is.Z({positions:[Ge,Je],width:3,arcType:rs.Z.NONE,vertexFormat:Wn.Z.VERTEX_FORMAT}),attributes:{color:cn.Z.fromColor(Pe.Z.BLACK)}}))}return ae},[ie]),Ne=(0,c.useMemo)(()=>new Wn.Z({translucent:!1,renderState:{depthMask:!1}}),[]),Ie=(0,c.useMemo)(()=>{const ae=ue,$e=!!ae;let Je;return $e?(ae instanceof HTMLCanvasElement&&(ae.style.imageRendering="pixelated"),Je=new Fi.Z({fabric:{uniforms:{image:ae,checkerSize:ae.width/16,rampRange:u.colorRamp,cutoffThreshold:u.colorCutoff,showElevationResidual:u.showElevationResidual?1:0,gradientMin:u.gradientMin,gradientMax:u.gradientMax,enableSmoothing:u.enableSmoothing?1:0,enableContours:u.enableContours?1:0,contourSpacing:u.contourSpacing},source:` 2 uniform sampler2D image; 3 uniform float checkerSize; 4 uniform float rampRange; 5 uniform float cutoffThreshold; 6 uniform float showElevationResidual; 7 uniform float gradientMin; 8 uniform float gradientMax; 9 uniform float enableSmoothing; 10 uniform float enableContours; 11 uniform float contourSpacing; 12 13 const float NUM_COLORS = 10.0; 14 15 // Access PCS coordinates from vertex shader (high precision) 16 in vec3 v_modelPosition; 17 18 // HSL to RGB conversion function (from rainbow shader) 19 vec3 hsl2rgb(vec3 hsl) { 20 float h = hsl.x; 21 float s = hsl.y; 22 float l = hsl.z; 23 24 float c = (1.0 - abs(2.0 * l - 1.0)) * s; 25 float x = c * (1.0 - abs(mod(h * 6.0, 2.0) - 1.0)); 26 float m = l - c/2.0; 27 28 vec3 rgb; 29 30 if(h < 1.0/6.0) rgb = vec3(c, x, 0.0); 31 else if(h < 2.0/6.0) rgb = vec3(x, c, 0.0); 32 else if(h < 3.0/6.0) rgb = vec3(0.0, c, x); 33 else if(h < 4.0/6.0) rgb = vec3(0.0, x, c); 34 else if(h < 5.0/6.0) rgb = vec3(x, 0.0, c); 35 else rgb = vec3(c, 0.0, x); 36 37 return rgb + m; 38 } 39 40 // Bitwise 24-bit RGB unpacking 41 float unpackNormalizedFromRGB(vec4 rgba) { 42 // Reconstruct 24-bit integer then normalize by 2^24-1 43 vec3 bytes = rgba.rgb * 255.0; 44 float scaled = bytes.r * 65536.0 + bytes.g * 256.0 + bytes.b; 45 return scaled / 16777215.0; 46 } 47 48 // Checker pattern color function 49 vec3 checker(vec2 uv, float size) { 50 vec2 grid = fract(uv * size); 51 float checkerPattern = step(0.5, grid.x) + step(0.5, grid.y); 52 checkerPattern = mod(checkerPattern, 2.0); 53 return mix(vec3(0.8), vec3(1.0), checkerPattern); 54 } 55 56 // Rainbow elevation color function 57 vec3 rainbow(float heightPC) { 58 // Map height to 0-1 range using adjustable gradient bounds 59 float normalizedHeight = (heightPC - gradientMin) / (gradientMax - gradientMin); 60 float bandIndexGrad = normalizedHeight * NUM_COLORS; 61 62 // Map each bucket to a color in the rainbow spectrum (0-1 range) 63 float bandIndex = abs(floor(bandIndexGrad)); 64 float hueValue = mod(bandIndex, NUM_COLORS) / NUM_COLORS; 65 float finalHue = fract(hueValue); 66 67 // Luminosity to emphasize transitions 68 float transitionIndex = mod(abs(bandIndexGrad - round(bandIndexGrad)), 1.0);
69 float lum = mix(0.6, 0.85, round(transitionIndex*4.0)/4.0); 70 71 return hsl2rgb(vec3(finalHue, 0.5, lum)); 72 } 73 74 // Color ramp: white to red for +ve, white to blue for -ve values over specified range 75 vec3 colorRamp(float value, float range, float threshold) { 76 // Return black for no point data (was transparent in buffer) 77 // Large numbers used as key - see dtmDrapePoints packFloatToRGBA sentinel 78 // This is smaller than the Sentinel number since we're post shader arithmetic here. 79 if (value > 999999999999.0 || value < -999999999999.0) { 80 return vec3(0.0, 0.0, 0.0); // Black for blank point data 81 } 82 83 if(value > threshold) { return (vec3(1.0, 0.0, 0.0)); } 84 if(value < -threshold) { return (vec3(0.0, 0.0, 1.0)); } 85 if (value >= 0.0) { 86 // Positive values: white to red 87 float t = clamp(value / range, 0.0, 1.0); 88 return mix(vec3(1.0, 1.0, 1.0), vec3(1.0, 0.0, 0.0), t); 89 } else { 90 // Negative values: white to blue 91 float t = clamp(-value / range, 0.0, 1.0); 92 return mix(vec3(1.0, 1.0, 1.0), vec3(0.0, 0.0, 1.0), t); 93 } 94 } 95 96 czm_material czm_getMaterial(czm_materialInput materialInput) { 97 czm_material material = czm_getDefaultMaterial(materialInput); 98 99 vec2 st = materialInput.st; 100 // Toggle between elevation residual (height difference) and checker pattern 101 if (showElevationResidual > 0.5) { 102 vec4 textureColor; 103 104 // Apply smoothing if enabled 105 if (enableSmoothing > 0.5) { 106 // 9x9 Gaussian-weighted kernel averaging with alpha validation 107 float validSampleCount; 108 float kernelStep; 109 110 textureColor = vec4(0.0); 111 validSampleCount = 0.0; 112 kernelStep = 1.0 / 2048.0; 113 114 // Sample 9x9 Gaussian-weighted kernel centered on current texel 115 float sigma = 1.5; // Gaussian standard deviation 116 for (int dy = -4; dy <= 4; dy++) { 117 for (int dx = -4; dx <= 4; dx++) { 118 vec2 sampleUV = st + vec2(float(dx) * kernelStep, float(dy) * kernelStep); 119 vec4 sampleColor = texture(image, sampleUV); 120 121 // Calculate Gaussian weight based on distance from center 122 float distanceSq = float(dx * dx + dy * dy); 123 float gaussianWeight = exp(-0.5 * distanceSq / (sigma * sigma)); 124 125 // Only accumulate samples with valid alpha, weighted by Gaussian 126 if (sampleColor.a > 0.95) { 127 textureColor += sampleColor * gaussianWeight; 128 validSampleCount += gaussianWeight; 129 } 130 } 131 } 132 133 // Average the accumulated samples 134 if (validSampleCount > 0.001) { 135 textureColor /= validSampleCount; 136 } 137 } else { 138 // No smoothing: simple texture sample 139 textureColor = texture(image, st); 140 } 141 // Check alpha channel for invalid data 142 if (textureColor.a < 0.5) { 143 // Invalid data: render TIN as black 144 material.diffuse = vec3(0.0, 0.0, 0.0); 145 } else { 146 // Valid data: proceed with normal rendering 147 148 // Decode normalized value from RGB channels (24-bit precision) 149 float normalizedHeight = unpackNormalizedFromRGB(textureColor); 150 151 // Scale back to original height range using gradient bounds 152 float packedHeight = normalizedHeight * (gradientMax - gradientMin) + gradientMin; 153 154 // Just use the normalized 0-1 value directly 155 // float packedHeight = normalizedHeight; 156 157 // Z-only comparison in PCS coordinates: packedHeight contains DrapePoints PCS Z, v_modelPosition.z is TIN PCS Z 158 float zDiff = packedHeight - v_modelPosition.z; 159 160 vec3 colorRampResult = colorRamp(zDiff, rampRange, cutoffThreshold); 161 162 // Apply contour lines if enabled 163 if (enableContours > 0.5) { 164 // Fade to black with proximity to contour spacing intervals, scaled to 3 pixels 165 float scaledZDiff = zDiff / contourSpacing; // Scale by contour spacing 166 float zDiffGradient = length(vec2(dFdx(scaledZDiff), dFdy(scaledZDiff))); // Gradient magnitude 167 float pixelScale = max(zDiffGradient * 3.0, 1e-9);
167 // Avoid divide-by-zero 168 float fractionalPart = abs(fract(scaledZDiff) - 0.5) * 2.0; // 0.0 at intervals, 1.0 at half-intervals 169 float scaledFractional = clamp((1.0 - fractionalPart) / pixelScale, 0.0, 1.0); // Inverted phase 170 material.diffuse = mix(vec3(0.0), colorRampResult, scaledFractional); 171 } else { 172 // No contours: use color ramp directly 173 material.diffuse = colorRampResult; 174 } 175 } 176 } else { 177 material.diffuse = checker(st, checkerSize); 178 } 179 material.alpha = 1.0; 180 181 return material; 182 } 183 `},translucent:!0,minificationFilter:u.enableSmoothing?Ni.Z.LINEAR:Ni.Z.NEAREST,magnificationFilter:u.enableSmoothing?Bi.Z.LINEAR:Bi.Z.NEAREST})):Je=new Fi.Z({fabric:{uniforms:{checkerSize:64},source:` 184 uniform float checkerSize; 185 186 czm_material czm_getMaterial(czm_materialInput materialInput) { 187 czm_material material = czm_getDefaultMaterial(materialInput); 188 189 vec2 st = materialInput.st; 190 vec2 grid = fract(st * checkerSize); 191 192 float checker = step(0.5, grid.x) + step(0.5, grid.y); 193 checker = mod(checker, 2.0); 194 195 vec3 color = mix(vec3(0.8), vec3(1.0), checker); 196 197 material.diffuse = color; 198 material.alpha = 1.0; 199 200 return material; 201 } 202 `}}),new lu.Z({material:Je,flat:!0,translucent:!0,renderState:{cull:{enabled:!1},depthMask:!1},vertexShaderSource:` 203 precision highp float; 204 205 in vec3 position3DHigh; 206 in vec3 position3DLow; 207 in vec3 normal; 208 in vec2 st; 209 in float batchId; 210 211 out vec3 v_positionEC; 212 out vec3 v_normalEC; 213 out vec2 v_st; 214 out vec3 v_modelPosition; // Pass PCS coords (high precision) to fragment 215 216 void main() { 217 vec4 p = czm_computePosition(); 218 v_positionEC = (czm_modelViewRelativeToEye * p).xyz; 219 v_normalEC = czm_normal * normal; 220 221 // Use UVs calculated in PCS space and passed as vertex attributes 222 v_st = vec2(st.x, st.y); 223 224 // Get PCS coordinates directly from normal attribute (workaround for MaterialAppearance limitations) 225 // Note: normal.xyz contains full PCS X,Y,Z coordinates (including height) 226 v_modelPosition = normal; // Clean PCS coordinates from normal attribute 227 228 gl_Position = czm_modelViewProjectionRelativeToEye * p; 229 } 230 `})},[ue]);(0,c.useEffect)(()=>{if(!Ie?.material)return;const ae=Ie.material;try{ae.uniforms.rampRange=u.colorRamp,ae.uniforms.cutoffThreshold=u.colorCutoff,ae.uniforms.showElevationResidual=u.showElevationResidual?1:0,ae.uniforms.gradientMin=u.gradientMin,ae.uniforms.gradientMax=u.gradientMax,ae.uniforms.enableContours=u.enableContours?1:0,ae.uniforms.contourSpacing=u.contourSpacing,ae.uniforms.enableSmoothing=u.enableSmoothing?1:0}catch($e){console.warn("Failed to update material uniforms:",$e)}},[u,Ie]);const Ke=(0,c.useMemo)(()=>{const ae=[];if(!ie.length)return ae;const $e=[Pe.Z.RED,Pe.Z.GREEN,Pe.Z.BLUE,Pe.Z.CYAN,Pe.Z.YELLOW,Pe.Z.MAGENTA,Pe.Z.ORANGE,Pe.Z.PURPLE,Pe.Z.BROWN,Pe.Z.LIME,Pe.Z.TEAL,Pe.Z.NAVY,Pe.Z.OLIVE,Pe.Z.MAROON,Pe.Z.PINK,Pe.Z.GRAY];return ie.forEach((Je,xt)=>{let[Ge,tt,gt]=Je;const ut=[Ge.x,Ge.y,Ge.z,tt.x,tt.y,tt.z,gt.x,gt.y,gt.z],wt=se[xt],$n=bu(wt),mn=zt(E,y),Lo=[];for(const na of wt){const xp=(na.x-mn.minx)/(mn.maxx-mn.minx),yp=(na.y-mn.miny)/(mn.maxy-mn.miny);Lo.push(xp,yp)}const Ao=new du.Z;Ao.position=new as.Z({componentDatatype:cs.Z.DOUBLE,componentsPerAttribute:3,values:new Float64Array(ut)}),Ao.normal=new as.Z({componentDatatype:cs.Z.FLOAT,componentsPerAttribute:3,values:new Float32Array($n)}),Ao.st=new as.Z({componentDatatype:cs.Z.FLOAT,componentsPerAttribute:2,values:new Float32Array(Lo)});const hp=new uu.Z({attributes:Ao,indices:new Uint16Array([0,1,2]),primitiveType:mu.Z.TRIANGLES,boundingSphere:si.Z.fromVertices(ut)}),gp=Ge.x+Ge.y+Ge.z+tt.x+tt.y+tt.z+gt.x+gt.y+gt.z,pp=Math.abs(Math.floor(gp))%$e.length,vp=$e[pp].withAlpha(.3);ae.push(new an.Z({geometry:hp,attributes:{color:cn.Z.fromColor(vp)}}))}),ae},[ie,se,E,y]);(0,c.useEffect)(()=>
230{l((0,ye.aP)(he))},[l,he]),(0,c.useEffect)(()=>{se.length>0&&!g&&!he.some(ae=>ae.type===ye.mW.DOUBLED_VERTEX||ae.type===ye.mW.INVALID_TRIANGULATION)&&l((0,ye.Ys)(!0))},[se.length,he,g,l]);const et=Ou(he,a);return(0,e.jsxs)(e.Fragment,{children:[t&&Z.length>=2&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(bn.cs,{points:U,color:lt.K8,width:4,show:!0,readonly:!1,pickableId:"dtm-boundary-".concat(i),onClick:()=>{}}),(0,e.jsx)(Kn.m_,{children:(0,e.jsx)(Pn.m,{trackedPositions:P,color:lt.K8,lineId:"dtm-boundary-".concat(i),onDragEnd:Y})})]}),Ke.length>0&&(0,e.jsx)(Nt.DE,{geometryInstances:Ke,appearance:Ie,asynchronous:!1,compressVertices:!1}),s&&(0,e.jsx)(Nt.DE,{geometryInstances:He,appearance:Ne,asynchronous:!1,compressVertices:!1}),(0,e.jsx)(pn.At,{ranges:et,width:.3,color:Pe.Z.RED}),g&&(0,e.jsx)(ls.default,{children:(0,e.jsx)(Tu,{triangles:se,polygon:E,onTextureReady:De,onGradientBoundsCalculated:h})}),g&&a&&E.length>0&&(0,e.jsx)(ls.default,{children:(0,e.jsx)(me.JH,{position:a.ecef_from_project_point(new m.Z((zt(E,y).minx+zt(E,y).maxx)/2,(zt(E,y).miny+zt(E,y).maxy)/2,Math.max(...se.flat().map(ae=>ae.z))+.15)),children:(0,e.jsx)(me.mR,{dimensions:new at.Z(a.ecef_from_project_dimension(zt(E,y).maxx-zt(E,y).minx),a.ecef_from_project_dimension(zt(E,y).maxy-zt(E,y).miny)),plane:new mt.Z(()=>new Sn.Z(m.Z.UNIT_Z,0),!1),outline:!0,outlineColor:Pe.Z.CYAN,fill:!1})})})]})}function Mu(n,t){return(0,c.useMemo)(()=>new Yt.Z("DTM-boundary-".concat(n,"-").concat((0,Hn.Z)(t.map(o=>o.x.toString().slice(0,5)+o.y.toString().slice(0,5)+o.z.toString().slice(0,5)).join("-"))),Yt.F.Measurement),[t,n])}function Iu(n,t){return(0,c.useMemo)(()=>({ecefPolygon:n.map(o=>(0,Bt.Rb)(o)),pcsPolygon:t?n.map(o=>t.project_from_ecef_point((0,Bt.Rb)(o))):[]}),[n,t])}function wu(n,t,o){const s=(0,le.Qt)(n),i=(0,le.Lv)(n),r=(0,je.Rw)(s),a=(0,je.Rw)(i),l=(0,ye.py)(),{scene:u}=(0,me.VQ)();return(0,c.useMemo)(()=>{if(!o||o.length===0||!u||!t)return{pcsTriangles:[],constraintFailures:[]};const f=s.filter(v=>r[v.id]&&!l[v.id]),{coordMap:h,constraintMap:g,verticalOverlapViolations:p}=Eu(f,o);for(const v of i){if(!a[v.id]||l[v.id]||v.type!=="Point"||h.has(zn(new m.Z(v.x,v.y,v.z))))continue;const y=new m.Z(v.x,v.y,v.z);ms(y,o)&&h.set(zn(y),{vertex:y,verticesIndex:h.size})}if(h.size===0)return{pcsTriangles:[],constraintFailures:[]};if(p.length>0)return{pcsTriangles:[],constraintFailures:p};try{const{triangles:v,constraintFailures:y}=pu(h,g);return{pcsTriangles:v,constraintFailures:y}}catch(v){return console.error("Error in triangulation",v),{pcsTriangles:[],constraintFailures:[]}}},[s,o,u,r,a,t,i,l])}function Ru(n,t){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return(0,c.useMemo)(()=>!o||!n||n.length===0||!t?[]:n.map(s=>s.map(i=>t?.ecef_from_project_point(i))),[o,t,n])}function Ou(n,t){return(0,c.useMemo)(()=>{const o=new Map;if(!t)return o;for(const i of n){var s;o.has(i.lineId)||o.set(i.lineId,[]),(s=o.get(i.lineId))===null||s===void 0||s.push({startIdx:i.startIndex,startT:0,endIdx:i.startIndex,endT:1})}return o},[n,t])}var yo=d(43254),Lu=d(10102),Jt=d(42295),Au=d(43721),Vi=d(19313);function Du(){const n=(0,ye.T4)(),t=(0,le.ug)(),o=(0,c.useMemo)(()=>{const i=[];for(const r of n){const a=t.getFeatureById(r.lineId);!a||a.__typename!=="LineAnnotation"||i.push({line:a,index:r.startIndex})}return i},[n,t]),s=(0,Vi.rL)(o,!1);return(0,c.useCallback)(i=>{const r=t.getFeatureById(i.lineId);!r||r.__typename!=="LineAnnotation"||s({line:r,index:i.startIndex})},[s,t])}function Zu(n){const{constraintFailure:t,isSelected:o,flyTo:s}=n,r=(0,le.ug)().getFeatureById(t.lineId),a=(0,b.TL)();if(!r||r.__typename!=="LineAnnotation")return null;const l=ee.di[r.type],u="".concat(l," ").concat(r.id.slice(0,4));return(0,e.jsx)(Au.eC,{icon:(0,e.jsx)(Ce.Icon,{icon:"error",intent:"danger"}),name:u,isSelected:o,onClick:f=>{f.stopPropagation(),a((0,pt.ff)(r))},actions:(0,e.jsx)(Ce.Button,{icon:"target",style:{paddingRight:"9px"},small:!0,minimal:!0,title:"Fly to feature",onClick:f=>{f.stopPropagation(),a((0,pt.ff)(r)),s?.()}})})}function Fu(n){return n.length===0?{isBlocking:!1}:n.some(t=>t.type===ye.mW.DOUBLED_VERTEX)?{isBlocking:!0,message:"Resolve overlapping vertices to show triangles."}:n.some(t=>t.type===ye.mW.OVERLAPPING_EDGE)?{isBlocking:!1,message:"Remove overlapping edges to generate a valid DTM."}:n.some(t=>t.type===ye.mW.INVALID_TRIANGULATION)?{isBlocking:!0,message:"Invalid triangulation"}:{isBlocking:!0,message:"Invalid triangulation"}}function Nu(){const n=(0,b.TL)(),t=(0,ye.sQ)(),o=(0,ye.T4)(),s=Fu(o),i=(0,c.useMemo)(()=>t?"Hide TIN":"Show TIN",[t]);return(0,e.jsxs)("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"10px"},children:[s?.message&&(0,e.jsx)(Ce.Callout,{intent:"danger",icon:"error",children:(0,e.jsx)("div",{children:s?.message})}),(0,e.jsx)(Ce.Button,{onClick:()=>n((0,ye.lq)(!t)),intent:"primary",disabled:s.isBlocking,style:{width:"100%"},children:i})]})}function Bu(){const n=(0,ye.T4)(),t=Du(),o=(0,pt.WE)(s=>s.detail==="spline"?s.key:void 0);return(0,e.jsx)(Lu.t7,{height:Math.min(Math.max(330,n.length*26+5),110),width:271,itemCount:n.length,itemSize:26,itemKey:s=>"".concat(n[s]),children:s=>{let{index:i,style:r}=s;return(0,e.jsx)("div",{style:r,children:(0,e.jsx)(Zu,{constraintFailure:n[i],isSelected:o===n[i].lineId,flyTo:()=>t(n[i])})})}})}function ku(){return(0,e.jsxs)("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexGrow:1},children:[(0,e.jsx)("div",{style:{fontStyle:"italic"},children:"No constraint failures "})," ",(0,e.jsx)("div",{children:"\u2705"})]})}function Vu(){const n=(0,ye.T4)();return(0,e.jsxs)(Jt.ZP,{title:"Triangulation Constraint Failures",minimizeKey:"triangulation-card",children:[(0,e.jsx)(Jt.ed,{children:(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",flexGrow:1},children:n.length>0?(0,e.jsx)(Bu,{}):(0,e.jsx)(ku,{})})}),(0,e.jsx)(Jt.ed,{children:(0,e.jsx)(Nu,{})})]})}function Uu(){const n=(0,b.TL)();return(0,e.jsx)(Ce.Tooltip,{content:"Recalculate TIN disparity when you have denser point data loaded over a region",children:(0,e.jsx)(Ce.Button,{onClick:()=>{n((0,ye.mx)())},intent:"primary",children:"Refresh Calculation"})})}function Wu(){const n=(0,b.TL)(),t=(0,ye.N)(),{showElevationResidual:o}=t;return(0,e.jsx)(Ce.Button,{onClick:()=>{n((0,ye.p5)({...t,showElevationResidual:!o}))},intent:"primary",children:o?"Hide Elevation Residual":"Show Elevation Residual"})}function zu(){const n=(0,b.TL)(),t=(0,ye.N)(),{drapeUpDepthFlip:o}=t;return(0,e.jsx)(Ce.Button,{onClick:()=>{n((0,ye.p5)({...t,drapeUpDepthFlip:!o}))},intent:"primary",children:o?"Drape Down":"Drape Up"})}function Hu(){const n=(0,b.TL)(),t=(0,ye.N)(),{enableSmoothing:o}=t;return(0,e.jsx)(Ce.Button,{onClick:()=>{n((0,ye.p5)({...t,enableSmoothing:!o}))},intent:"primary",children:o?"Disable Smoothing":"Enable Smoothing"})}function Ku(){const n=(0,b.TL)(),t=(0,ye.N)(),{enableContours:o}=t;return(0,e.jsx)(Ce.Button,{onClick:()=>{n((0,ye.p5)({...t,enableContours:!o}))},intent:"primary",children:o?"Disable Contours":"Enable Contours"})}function Gu(){const n=(0,b.TL)(),t=(0,ye.N)(),{colorRamp:o,colorCutoff:s,range:i}=t;return(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{style:{backgroundColor:"#30404d",marginBottom:"16
230px",fontSize:"13px",color:"#f5f8fa"},children:[(0,e.jsx)("strong",{children:"[left mouse \u{1F5B1}\uFE0F]"})," to enter a border around your lines to connect them as a TIN.",(0,e.jsx)("br",{}),(0,e.jsx)("strong",{children:"[return \u21B5]"})," completes"]}),(0,e.jsx)("div",{style:{marginBottom:"12px"},children:(0,e.jsxs)(Jt.ed,{children:[(0,e.jsx)("div",{}),(0,e.jsxs)("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end",alignItems:"center",gap:"8px"},children:[(0,e.jsx)(yo.Z,{label:"Color Ramp Range"}),(0,e.jsx)(Ce.NumericInput,{value:i,onValueChange:r=>{if(Number.isNaN(r)||r<=0)return;const a=Math.max(.1,r),l=Math.max(-a,Math.min(a,o)),u=Math.max(-a,Math.min(a,s));n((0,ye.p5)({...t,range:a,colorRamp:l,colorCutoff:u}))},min:.1,max:1e3,stepSize:.1,minorStepSize:.1,style:{width:"80px"}})]})]})}),(0,e.jsx)("div",{style:{marginBottom:"12px"},children:(0,e.jsxs)(Jt.ed,{children:[(0,e.jsx)("div",{style:{marginRight:"4px"},children:(0,e.jsx)(yo.Z,{label:"Color Ramp"})}),(0,e.jsx)("div",{style:{width:"100%"},children:(0,e.jsx)("div",{style:{background:`linear-gradient(to right, 231 #ff0000 0%, 232 #ff0000 `.concat(50-o/i*50,`%, 233 #ffffff 50%, 234 #0000ff `).concat(50+o/i*50,`%, 235 #0000ff 100%)`),borderRadius:"3px",padding:"2px"},children:(0,e.jsx)(Ce.Slider,{min:-i,max:i,stepSize:i/50,value:o,onChange:r=>{const a=Math.max(0,r);n((0,ye.p5)({...t,colorRamp:a}))},labelStepSize:i/2,labelRenderer:r=>(0,e.jsx)("span",{style:{color:"#000000",marginLeft:r===-i?"24px":void 0,marginRight:r===i?"24px":void 0},children:r.toFixed(2)}),showTrackFill:!1})})})]})}),(0,e.jsxs)(Jt.ed,{children:[(0,e.jsx)("div",{style:{marginRight:"4px"},children:(0,e.jsx)(yo.Z,{label:"Color Cutoff"})}),(0,e.jsx)("div",{style:{width:"100%"},children:(0,e.jsx)("div",{style:{background:`linear-gradient(to right, 236 #ff0000 0%, 237 #ff0000 `.concat(50-s/i*50,`%, 238 #ffffff `).concat(50-s/i*50,`%, 239 #ffffff 50%, 240 #ffffff `).concat(50+s/i*50,`%, 241 #0000ff `).concat(50+s/i*50,`%, 242 #0000ff 100%)`),borderRadius:"3px",padding:"2px"},children:(0,e.jsx)(Ce.Slider,{min:-i,max:i,stepSize:i/50,value:s,onChange:r=>{const a=Math.max(0,r);n((0,ye.p5)({...t,colorCutoff:a}))},labelStepSize:i/2,labelRenderer:r=>(0,e.jsx)("span",{style:{color:"#000000",marginLeft:r===-i?"24px":void 0,marginRight:r===i?"24px":void 0},children:r.toFixed(2)}),showTrackFill:!1})})})]}),(0,e.jsx)("div",{style:{marginTop:"12px"},children:(0,e.jsxs)(Jt.ed,{children:[(0,e.jsx)("div",{}),(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px"},children:[(0,e.jsx)(Hu,{}),(0,e.jsx)(Ku,{})]})]})}),(0,e.jsx)("div",{style:{marginTop:"12px"},children:(0,e.jsxs)(Jt.ed,{children:[(0,e.jsx)("div",{style:{marginRight:"4px"},children:(0,e.jsx)(yo.Z,{label:"Contour Spacing"})}),(0,e.jsx)("div",{style:{width:"100%"},children:(0,e.jsxs)("div",{style:{},className:"contour-spacing-slider",children:[(0,e.jsx)("style",{dangerouslySetInnerHTML:{__html:` 243 .contour-spacing-slider .bp4-slider-handle .bp4-slider-label { 244 background: #2d3748 !important; 245 color: #ffffff !important; 246 } 247 `}}),(0,e.jsx)(Ce.Slider,{min:Math.log10(.01),max:Math.log10(10),stepSize:.01,value:Math.log10(t.contourSpacing),onChange:r=>{const a=10**r;n((0,ye.p5)({...t,contourSpacing:a}))},labelStepSize:1,labelRenderer:r=>{const a=10**r;return(0,e.jsx)("span",{style:{color:"#ffffff",backgroundColor:"#2d3748",padding:"2px 4px",borderRadius:"3px",border:"none",boxShadow:"none"},children:a<1?a.toFixed(2):a.toFixed(1)})},showTrackFill:!1})]})})]})}),(0,e.jsx)("div",{style:{marginTop:"16px"},children:(0,e.jsx)(Jt.SC,{left:null,right:(0,e.jsxs)("div",{style:{display:"flex",gap:"8px",alignItems:"center",justifyContent:"space-evenly"},children:[(0,e.jsx)(Uu,{}),(0,e.jsx)(Wu,{}),(0,e.jsx)(zu,{})]})})})]})}function _u(){const n=(0,b.TL)(),t=(0,c.useCallback)(()=>{n((0,j.fq)({mode:"none"})),n((0,ye._H)())},[n]);return(0,ln.iB)(t)}function Yu(){const n="DTM Info",t=(0,ye.um)(),[o,s]=(0,ln.f_)();if(!t)return null;const i=(0,e.jsxs)(e.Fragment,{children:[s,(0,e.jsx)(_u,{})]});return(0,e.jsxs)(ln.QP,{title:n,initialPosition:{bottom:100,left:230},customPopoverStyle:{maxHeight:"700px",zIndex:5,width:void 0},topbarButtons:i,minimized:o,children:[(0,e.jsx)(Gu,{}),(0,e.jsx)(Vu,{})]})}var Ui=d(18167),Wi=d(14586),Gn=d(84786),Ju=d(36879);function hs(n){const t=(0,le.FU)(n);var o;const s=(0,xe.OL)((o=t?.projectFileId)!==null&&o!==void 0?o:"nonexistent"),i=(0,c.useMemo)(()=>
247{if(!t||!s)return;const a=s.ecef_from_project_point(new m.Z(t.x,t.y,t.z)),l=s.ecef_from_project_quaternion(new Vt.Z(t.rotationX,t.rotationY,t.rotationZ,t.rotationW)),u=s.ecef_from_project_scale(new m.Z(t.scaleX,t.scaleY,t.scaleZ));return{position:{get(){return a},set(){throw new Error("Cannot set cuboid")},original(){return a}},orientation:{get(){return l},set(){throw new Error("Cannot set cuboid")},original(){return l}},dimensions:{get(){return u},set(){throw new Error("Cannot set cuboid")},original(){return u}}}},[t,s]),r=(0,je.tV)(t);if(!(!t||!i))return{object:t,cuboid:i,show:r}}const gs=new Ui.Z().fromText("\u0394",Pe.Z.YELLOW,48);function Xu(n){const{onMount:t,onUnmount:o}=n,s=(0,b.TL)(),i=(0,Gn.Zj)(new m.Z(0,0,.8),n.first.cuboid),r=(0,Gn.Zj)(new m.Z(0,0,.8),n.second.cuboid),a=m.Z.midpoint(i,r,new m.Z),l=(0,gn.Y6)(v=>v.minDelta),u=(n.first.show||n.second.show)&&m.Z.distance(i,r)>l,f="".concat(n.first.object.id,"-").concat(n.second.object.id),h=(v,y)=>{t(f,v,y)},g=()=>{o(f)},p=(0,c.useMemo)(()=>new Ko.Z({image:gs}),[]);return(0,e.jsx)(Ju.QT,{info:{billboardLocation:a,key:f,material:p},show:u,onMount:h,onUnmount:g,onClick:()=>{s((0,pt.e)([n.first.object.id,n.second.object.id]))}})}function Qu(n){const t=hs(n.delta.object_id),o=hs(n.delta.perception_object_id);return!t||!o?null:(0,e.jsx)(Xu,{first:t,second:o,onMount:n.onMount,onUnmount:n.onUnmount})}function $u(n){const{pickableObject:t,onMount:o,onUnmount:s}=(0,Wi.Z)(gs.width,gs.height);return(0,qe.qX)("arp-delta",t),(0,e.jsx)(e.Fragment,{children:n.deltas.map(i=>(0,e.jsx)(Qu,{delta:i,onMount:o,onUnmount:s},i.object_id+i.perception_object_id))})}const zi=new Ui.Z,ps=zi.fromText("+",Pe.Z.GREEN,48),qu=zi.fromText("-",Pe.Z.RED,48);function e0(n){const{onMount:t,onUnmount:o}=n,s=(0,Gn.Zj)(new m.Z(0,0,.8),n.display.cuboid),[i,r]=(0,c.useState)(void 0);(0,c.useEffect)(()=>(i&&t(s,i),()=>{o()}),[i,s,t,o]);const a=(0,b.TL)();return(0,e.jsx)(Nt.ZP,{position:s,show:n.display.show,ref:l=>{r(l?.cesiumElement)},onClick:()=>{a((0,pt.Uj)({id:n.display.object.id,type:n.display.object.type}))},children:(0,e.jsx)(me.Kt,{image:n.positive?ps:qu,eyeOffset:new m.Z(0,0,-1)})})}function t0(n){const t=hs(n.id);return t?(0,e.jsx)(e0,{display:t,positive:n.positive,onMount:n.onMount,onUnmount:n.onUnmount}):null}function Hi(n){const{pickableObject:t,onMount:o,onUnmount:s}=(0,Wi.Z)(ps.width,ps.height);return(0,qe.qX)("arp-false-".concat(n.positive),t),(0,e.jsx)(e.Fragment,{children:n.ids.map(i=>(0,e.jsx)(t0,{id:i,positive:n.positive,onMount:o.bind(null,i),onUnmount:s.bind(null,i)},i))})}function n0(n){return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Hi,{ids:n.fps,positive:!0}),(0,e.jsx)(Hi,{ids:n.fns,positive:!1})]})}function o0(){const n=(0,gn.Y6)(t=>t.data);return n?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)($u,{deltas:n.deltas}),(0,e.jsx)(n0,{fps:n.false_positives.map(t=>t.perception_object_id),fns:n.false_negatives.map(t=>t.object_id)})]}):null}var s0=d(7112),i0=d(80407),r0=d(99462),Op=d(88590);function Lp(n){const{projectFile:t}=useGetProjectFile(n),[o,s]=useState(null);return useEffect(()=>{if(!t||!t.metadata)return;const i=CadFileSpec.check(JSON.parse(t.metadata));console.assert(isCadFileProcessed(i));const r=getCadFilePngDirectoryKey(i).replace(/.*upload/,"upload");s(r)},[t]),o}function a0(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const o=(0,c.useRef)(null),[s,i]=(0,c.useState)(1),{viewer:r}=(0,me.VQ)(),a=(0,c.useMemo)(()=>{const u=r?.canvas.getContext("webgl2");return u?u.getParameter(u.MAX_TEXTURE_SIZE):256},[r]),l=new URLSearchParams(t).toString();return(0,c.useEffect)(()=>{const u=new AbortController;async function f(){const h="".concat(i0.Z.LIST_IMAGE_SIZES,"/").concat(n,"?").concat(l),p=await(await fetch(h,{signal:u.signal})).json(),y=r0.fW.check(p).images.map(async S=>{const{size:E,url:Z}=S,P=await s0.Z.fetchImage({url:Z});u.signal.aborted||P.height>a||P.width>a||o.current!==null&&o.current.size>E&&o.current.parameterString===l||(o.current={size:E,image:P,parameterString:l},i(P.width/P.height))});await Promise.all(y)}return f().catch(h=>console.warn(h)),()=>{u.abort()}},[n,a,l]),{aspectRatio:s,imageRef:o}}function c0(n,t,o,s){const{imageRef:i,aspectRatio:r}=a0(n,s);return{imageProperty:(0,c.useMemo)(()=>{const l=new mt.Z(()=>{var h;
247return(h=i.current)===null||h===void 0?void 0:h.image},!1),u=new mt.Z(()=>{var h;return(!((h=i.current)===null||h===void 0)&&h.image?Pe.Z.WHITE:t).withAlpha(o)},!1),f=new mt.Z(()=>!0,!1);return new Ko.Z({image:l,color:u,transparent:f})},[i,t,o]),aspectRatio:r}}var vs=c0,l0=d(71134),Ki=d(2278);const d0=new Sn.Z(m.Z.UNIT_Z,0),Gi=(0,c.forwardRef)((n,t)=>{const{image:o,aspectRatio:s,location:i,width:r,rotation:a}=n,l=(0,c.useMemo)(()=>new mt.Z(i,!1),[i]),u=(0,c.useMemo)(()=>new mt.Z(()=>{const y=r(),S=s?y/s:y;return new at.Z(y,S)},!1),[r,s]),f=d0,h=(0,c.useMemo)(()=>new mt.Z(()=>Rt.Z.headingPitchRollQuaternion(i(),new l0.Z(a(),0,0)),!1),[i,a]),g=(0,c.useId)(),p=(0,c.useCallback)(y=>{const S=u.getValue(new Ki.Z);return(0,Ns.JI)(y.mouseRay,{origin:i(),orientation:h.getValue(new Ki.Z),width:S.x,height:S.y})},[i,h,u]),v=(0,qe.Kc)(g,p,t);return(0,e.jsx)(Nt.ZP,{position:l,orientation:h,ref:v,show:n.show===void 0||n.show===!0,onClick:n.onClick,draggable:n.draggable,onDragStart:n.onDragStart,onDrag:n.onDrag,onDragEnd:n.onDragEnd,children:(0,e.jsx)(me.mR,{dimensions:u,material:o,outline:n.selected,outlineWidth:2,outlineColor:ri.l,plane:f})})});Gi.displayName="CadDrawingEntity";var _i=Gi;function Yi(n){const t=(0,c.useRef)(null),o=(0,c.useCallback)(()=>t.current||n,[t,n]),s=(0,c.useMemo)(()=>new mt.Z(o,!1),[o]);return{ref:t,property:o,callbackProperty:s}}var u0=d(12689);const Ji=(0,c.forwardRef)((n,t)=>{const{onMove:o}=n,s=(0,nt.ZP)(n.location),i=Yi(n.rotation),r=Yi(n.width),a=(0,c.useCallback)(()=>Ee.Z.multiplyByPointAsVector(Rt.Z.eastNorthUpToFixedFrame(s.get()),m.Z.UNIT_Z,new m.Z),[s]),l=(0,u0.Z)({location:s,axisDirection:a}),u=(0,c.useCallback)(()=>{o?.(s.get())},[o,s]);return(0,e.jsx)(_i,{ref:t,selected:n.selected,show:n.visible,location:s.get,width:r.property,rotation:i.property,image:n.image,aspectRatio:n.aspectRatio,onClick:n.onClick,draggable:n.selected&&l.draggable,onDragStart:l.onDragStart,onDrag:l.onDrag,onDragEnd:u})});Ji.displayName="MovableDrawingEntity";var Xi=Ji,xs=d(58398);function m0(n){const{specId:t,spec:o}=n,{imageProperty:s,aspectRatio:i}=vs(o.projectFileId,Pe.Z.WHITE,o.opacity),r=(0,c.useMemo)(()=>Dt.Z.toCartesian(new Dt.Z(o.coordinates[0],o.coordinates[1],o.height)),[o]),a=(0,b.TL)(),l=(0,pt.WE)(v=>v.detail==="cadFile"&&v.key===t),u=(0,c.useCallback)(()=>{l&&a((0,pt.lz)({detail:"none"}))},[a,l]);(0,qe.sC)("onClick",u);const f=(0,c.useCallback)(()=>{a((0,pt.lz)({detail:"cadFile",key:t}))},[a,t]),h=(0,xs.Z)(new Yt.Z(t,Yt.F.CadFile)),g=(0,je.iJ)(v=>v.cadFiles[t]),p=(0,c.useCallback)(v=>{const y=Dt.Z.fromCartesian(v),S={...o,coordinates:[y.longitude,y.latitude],height:y.height};a((0,Ut.mn)(t,S))},[a,t,o]);return(0,e.jsx)(Xi,{selected:l,ref:h,location:r,width:o.width,rotation:o.rotation,image:s,aspectRatio:i,visible:g,onMove:p,onClick:f})}function f0(){const n=(0,Ut.AE)(t=>t);return(0,e.jsx)(e.Fragment,{children:Object.keys(n).map(t=>{const o=n[t];return(0,e.jsx)(hn,{id:t,children:(0,e.jsx)(m0,{specId:t,spec:o},t)},t)})})}var h0=f0,Qi=d(70322),$i=d(56325);function g0(n){const[t,o]=(0,c.useState)(null);return(0,c.useEffect)(()=>{n&&fetch(n).then(s=>s.json()).then(s=>{o(s)}).catch(s=>{o(null)})},[n]),t}var p0=g0;const v0=10,qi=500,x0=new $i.Z(0,qi),y0=new $i.Z(qi,Number.MAX_VALUE);function C0(n){const{id:t,isVisible:o,enuOrigin:s,poleInfo:i}=n,r=(0,c.useMemo)(()=>Rt.Z.eastNorthUpToFixedFrame(s),[s]),a=(0,c.useMemo)(()=>{const u=new m.Z(i.geometry.coordinates[0],i.geometry.coordinates[1],i.geometry.coordinates[2]);return Ee.Z.multiplyByPoint(r,u,new m.Z)},[i,r]),l=(0,c.useMemo)(()=>{const u=new m.Z(i.properties.rx,i.properties.ry,i.properties.rz),f=Ee.Z.multiplyByPointAsVector(r,u,new m.Z),h=m.Z.UNIT_Z,g=m.Z.cross(f,h,new m.Z);m.Z.normalize(g,g);const p=-Math.acos(m.Z.dot(f,h)),v=Vt.Z.fromAxisAngle(g,p);return new ii.Z(v)},[i,r]);return i.properties.detections<v0?null:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(me.JH,{position:a,orientation:l,show:o,children:(0,e.jsx)(me.uz,{length:i.properties.length,topRadius:.25,bottomRadius:.25,fill:!0,material:Pe.Z.CYAN,distanceDisplayCondition:x0})}),(0,e.jsx)(me.JH,{position:a,show:o,orientation:l,children:(0,e.jsx)(me.l7,{pixelSize:5,color:Pe.Z.CYAN,distanceDisplayCondition:y0})})]})}const E0=m.Z.fromDegrees(-80.0238803,40.3357908,314.504);function S0(n){const t=(0,je.iT)(n.id),o=p0("/assets/poles.json");return o?(0,e.jsx)(e.Fragment,{children:o.features.map((s,i)=>(0,e.jsx)(C0,{id:n.id,isVisible:t,enuOrigin:E0,poleInfo:s}
247,i))}):null}var j0=S0;function T0(n){switch(n.layer.kind){case"bloomfieldPoles":return(0,e.jsx)(j0,{id:n.id});default:return null}}function b0(){const n=(0,Ut.jv)(t=>t);return(0,e.jsx)(e.Fragment,{children:Object.entries(n).map(t=>{let[o,s]=t;return(0,e.jsx)(hn,{id:o,children:(0,e.jsx)(T0,{layer:s,id:o},o)},o)})})}var P0=b0,M0=d(61858),I0=d(90934);function er(n){const{spec:t,metadata:o,index:s}=n,{depth:i}=o.slices[s],{coordinates:r,height:a,width:l,rotation:u,opacity:f}=t,[h,g]=r,{imageProperty:p,aspectRatio:v}=vs(t.projectFileId,Pe.Z.TRANSPARENT,f,{slice:"".concat(s)}),y=(0,c.useMemo)(()=>Dt.Z.toCartesian(new Dt.Z(h,g,a-i)),[h,g,a,i]),S=(0,xs.Z)(new Yt.Z(t.projectFileId,Yt.F.GprSlices)),E=(0,c.useCallback)(P=>{S(P)},[S]),Z=(0,je.iJ)(P=>P.gprSlices[t.projectFileId]);return(0,e.jsx)(Xi,{ref:E,selected:!1,location:y,width:l,rotation:u,image:p,aspectRatio:v,visible:Z})}function w0(n){const{spec:t,metadata:o}=n;switch(t.displayState.kind){case"single":return(0,e.jsx)(er,{spec:t,metadata:o,index:t.displayState.index});case"all":return(0,e.jsx)(e.Fragment,{children:o.slices.map((s,i)=>(0,e.jsx)(er,{spec:t,metadata:o,index:i},s.depth))})}}function R0(n){const{spec:t}=n,o=(0,mo.lE)(t.projectFileId).projectFile;return o?(0,e.jsx)(w0,{spec:t,metadata:I0.c.check((0,M0.D)(o.metadata))}):null}function O0(){const n=(0,Ut.Hp)(t=>t);return(0,e.jsx)(e.Fragment,{children:Object.keys(n).map(t=>(0,e.jsx)(hn,{id:t,children:(0,e.jsx)(R0,{spec:n[t]},t)},t))})}var L0=O0;function A0(n){const{measurement:t}=n,o=t.id,{select:s}=(0,Te.cH)(),i=(0,nt.ZP)([(0,Ct.U)(t.firstLine.start),(0,Ct.U)(t.firstLine.end)]),r=(0,nt.ZP)([(0,Ct.U)(t.secondLine.start),(0,Ct.U)(t.secondLine.end)]),[a,l]=(0,nt.zU)(i),[u,f]=(0,nt.zU)(r),h=(0,je.iJ)(ie=>ie.measurements),g=(0,b.TL)(),p=(0,pt.WE)(ie=>ie.detail==="measurement"&&ie.measurementKey===o),v=(0,c.useCallback)(()=>{const[ie,Oe]=i.get();g((0,Tt.XU)(o,"firstLine","start",(0,Ct.M)(ie))),g((0,Tt.XU)(o,"firstLine","end",(0,Ct.M)(Oe))),s(t)},[g,o,i,s,t]),y=(0,c.useCallback)(()=>{const[ie,Oe]=r.get();g((0,Tt.XU)(o,"secondLine","start",(0,Ct.M)(ie))),g((0,Tt.XU)(o,"secondLine","end",(0,Ct.M)(Oe))),s(t)},[g,o,r,s,t]),S=(0,c.useCallback)(()=>{s(t)},[t,s]),E=(0,c.useCallback)(()=>{const ie=a.get(),Oe=l.get(),ue=u.get(),De=f.get(),Qe=Fo(ie,Oe,ue,De);return{start1:ie,end1:Oe,start2:ue,end2:De,vizData:Qe}},[a,l,u,f]),Z=(0,c.useMemo)(()=>new mt.Z(()=>{const{vizData:ie}=E();return An(ie.commonOrigin,ie.direction1,ie.direction2,1.5,20).arcPositions},!1),[E]),P=(0,c.useMemo)(()=>new mt.Z(()=>{const{vizData:ie}=E(),{arcPositions:Oe}=An(ie.commonOrigin,ie.direction1,ie.direction2,1.5,20);return Hs(Oe)},!1),[E]),U=(0,c.useMemo)(()=>new mt.Z(()=>{const{vizData:ie}=E(),{effectiveDir1:Oe}=An(ie.commonOrigin,ie.direction1,ie.direction2,1.5,20);return so(ie.commonOrigin,Oe,2.5)},!1),[E]),Y=(0,c.useMemo)(()=>new mt.Z(()=>{const{vizData:ie}=E(),{effectiveDir2:Oe}=An(ie.commonOrigin,ie.direction1,ie.direction2,1.5,20);return so(ie.commonOrigin,Oe,2.5)},!1),[E]),se=(0,c.useMemo)(()=>new mt.Z(()=>{const{start1:ie,end1:Oe,start2:ue,end2:De}=E();return"".concat((0,Ks.M)(ie,Oe,ue,De).toFixed(1),"\xB0")},!1),[E]),he=(0,c.useMemo)(()=>(0,lt.BW)(lt.K8),[]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(bn.cs,{points:i,color:lt.K8,width:p?3:2,show:h,onClick:S,readonly:!1,pickableId:"measurement-".concat(o,"-line1")}),(0,e.jsx)(bn.cs,{points:r,color:lt.K8,width:p?3:2,show:h,onClick:S,readonly:!1,pickableId:"measurement-".concat(o,"-line2")}),(0,e.jsx)(me.JH,{show:h,children:(0,e.jsx)(me.qz,{positions:U,material:he,width:2,clampToGroun
247d:!1})}),(0,e.jsx)(me.JH,{show:h,children:(0,e.jsx)(me.qz,{positions:Y,material:he,width:2,clampToGround:!1})}),(0,e.jsx)(me.JH,{show:h,children:(0,e.jsx)(me.qz,{positions:Z,material:lt.K8,width:3,clampToGround:!1})}),(0,e.jsx)(me.JH,{position:P,show:h,children:(0,e.jsx)(me.az,{text:se,font:"14px Inter",fillColor:Pe.Z.BLACK,backgroundColor:lt.K8,showBackground:!0,eyeOffset:lt.dU,scaleByDistance:lt.Wr})}),(0,e.jsx)(Kn.m_,{children:h&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Pn.m,{trackedPositions:i,color:lt.K8,lineId:"".concat(o,"-firstLine"),onSelect:S,onDragEnd:v}),(0,e.jsx)(Pn.m,{trackedPositions:r,color:lt.K8,lineId:"".concat(o,"-secondLine"),onSelect:S,onDragEnd:y})]})})]})}var tr=d(74275),nr=d(60528),D0=d(63740);function Z0(n){const{measurement:t}=n,o=t.id,{select:s}=(0,Te.cH)(),i=(0,c.useMemo)(()=>[(0,Ct.U)(t.start),(0,Ct.U)(t.end)],[t]),r=(0,nt.ZP)(i),a=(0,je.iJ)(y=>y.measurements),l=(0,b.TL)(),u=(0,pt.WE)(y=>y.detail==="measurement"&&y.measurementKey===o),f=(0,c.useCallback)(()=>{s(t)},[t,s]),h=(0,c.useCallback)(()=>{const y=r.get()[0],S=r.get()[1];l((0,Tt.$T)((0,Ct.M)(y),"start",o)),l((0,Tt.$T)((0,Ct.M)(S),"end",o)),s(t)},[l,o,r,s,t]),[g,p]=(0,nr.b)(),v=(0,c.useCallback)(y=>{const S=m.Z.subtract(y[1],y[0],new m.Z),{horizontal:E,vertical:Z}=(0,tr.Z)(y[0],y[1]),P=m.Z.magnitude(S);return"".concat(g(P)," ").concat(p," (").concat(g(E)," h, ").concat(g(Z)," v)")},[g,p]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(bn.cs,{points:r,color:lt.K8,width:u?3:2,show:a,onClick:f,readonly:!1,pickableId:"measurement-".concat(o)}),(0,e.jsx)(D0.r,{points:r,getLabel:v,visible:a,onClick:f,color:lt.K8}),(0,e.jsx)(Kn.m_,{children:a&&(0,e.jsx)(Pn.m,{trackedPositions:r,color:lt.K8,lineId:o,onSelect:f,onDragEnd:h})})]})}var F0=d(94314);function N0(){const n=(0,Tt._I)(t=>t);return(0,e.jsx)(e.Fragment,{children:Object.keys(n).map(t=>(0,e.jsx)(hn,{id:t,children:(0,e.jsx)(B0,{measurementKey:t},t)},t))})}function B0(n){const t=(0,Tt.UB)(n.measurementKey,o=>o);switch(t.type){case"measurement":return(0,e.jsx)(Z0,{measurement:t});case"measurement-area":return(0,e.jsx)(F0.o,{measurement:t});case"measurement-angle":return(0,e.jsx)(A0,{measurement:t});case"cross-section-measurement":return null;default:(0,vo.Z)(t)}}var k0=d(49865),Co=d(74588),or=d(73956),sr=d(73439);function V0(n){const{color:t,id:o,vm:s,show:i}=n,r=(0,le.FU)(o),a=(0,or.n)(r?[r]:[]);if(r)if(a[o]&&!a[o].modelUri&&a[o].exportPosition){const u=(0,Co._H)(r,s);var l;const f=(0,Gn.Zj)((l=a[o].exportPosition)!==null&&l!==void 0?l:new m.Z(0,0,0),u),h=new mt.Z(()=>u.orientation.get(),!1);return(0,e.jsx)(Nt.ZP,{position:f,orientation:h,show:i,children:(0,e.jsx)(me.n,{outline:!0,outlineColor:Pe.Z.fromCssColorString(t),outlineWidth:sr.z,material:Pe.Z.TRANSPARENT,dimensions:lt.qu})})}else{const u=s.ecef_from_project_point(new m.Z(r.x,r.y,r.z)),f=s.ecef_from_project_quaternion(new Vt.Z(r.rotationX,r.rotationY,r.rotationZ,r.rotationW)),h=new mt.Z(()=>f,!1),g=s.ecef_from_project_scale(new m.Z(r.scaleX,r.scaleY,r.scaleZ));return(0,e.jsx)(Nt.ZP,{position:u,orientation:h,show:i,children:(0,e.jsx)(me.n,{outline:!0,outlineColor:Pe.Z.fromCssColorString(t),outlineWidth:sr.z,material:Pe.Z.TRANSPARENT,dimensions:g})})}else return null}function U0(n){const{projectFileId:t,color:o,ids:s}=n,i=(0,xe.OL)(n.projectFileId),r=(0,Te.Nj)(),a=(0,le.ug)(),l=(0,c.useMemo)(()=>s.filter(f=>{const h=a.getFeatureById(f);return h?.__typename==="ObjectAnnotation"}),[a,s]),u=(0,c.useMemo)(()=>{const f=new Map;for(const h of s){const g=a.getFeatureById(h);g?.__typename==="LineAnnotation"&&!r.has(h)&&f.set(h,null)}return f},[a,s,r]);return i?(0,e.jsxs)(e.Fragment,{children:[l.map(f=>(0,e.jsx)(V0,{id:f,color:n.color,vm:i,show:!r.has(f)},f)),(0,e.jsx)(pn.At,{ranges:u,color:Pe.Z.fromCssColorString(n.color),width:pn.Y5/2})]}):null}function W0(n){const{objectIds:t,color:o}=n.cursor;return(0,e.jsx)(e.Fragment,{children:Object.entries(t).map(s=>{let[i,r]=s;return(0,e.jsx)(U0,{projectFileId:i,color:o,ids:r},i)})})}function z0(){const n=(0,k0.tp)();return(0,e.jsx)(e.Fragment,{children:(0,c.useMemo)(()=>Object.values(n).map(t=>(0,e.jsx)(W0,{cursor:t},t.color)),[n])})}function ir(n){const t=(0,xe.J5)(n.fileId),o=(0,c.useMemo)(()=>t?.visualizationMapping.getModelMatrix(),[t]),s=(0,c.useCallback)(i=>{const r=i?.cesiumElement;r&&(r.pointCloudShading.attenuation=!0,r.pointCloudShading.geometricErrorScale=.05*2,r.pointCloudShading.baseResolution=.05,r.pointCloudShading.eyeDomeLightingStrength=1,r.pointCloudShading.eyeDomeLightingRadius=.5,r.pointCloudShading.normalShading=!1,r.pointCloudShading.eyeDomeLighting=!0,r.pointCloudShading.maximumAttenuation=4,r.maximumScreenSpaceError=16)},[]);return(0,e.jsx)(me.ME,{ref:s,url:"/api/layers/".concat(n.layerId,"/processed/").concat(n.path,"/tileset.json"),modelMatrix:o,show:n.show})}function H0(){const n=(0,j.Fc)(),t=(0,Ri.Z)(),o=(0,ft.oj)(),s=(0,ft.Aq)(),i=n?.surveyId;return!n||!t||!i?null:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ir,{fileId:n.projectFileId,layerId:i,path:"results/final_cloud_tiles",show:o}),(0,e.jsx)(ir,{fileId:n.projectFileId,layerId:i,path:"results/final_cloud_rejected_tiles",show:s})]})}var rr=d(2598);function K0(){const n=(0,rr.jW)(),t=(0,c.useMemo)(()=>new mt.Z(()=>{var o;return(o=n.get())!==null&&o!==void 0?o:m.Z.ZERO},!1),[n]);return(0,e.jsx)(me.JH,{position:t,children:(0,e.jsx)(me.l7,{pixelSize:20,color:Pe.Z.LIGHTBLUE})})}function G0(){const n=(0,rr.jW)(),t=(0,c.useMemo)(()=>new mt.Z(()=>{var o,s;return[(o=n.getCamera())!==null&&o!==void 0?o:m.Z.ONE,(s=n.get())!==null&&s!==void 0?s:m.Z.ONE]},!1),[n]);return(0,e.jsx)(me.JH,{children:(0,e.jsx)(me.qz,{positions:t,width:2,material:Pe.Z.LIGHTBLUE})})}function _0(){return(0,At.Bz)().denseDepthDebugMode?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(K0,{}),(0,e.jsx)(G0,{})]}):null}var Y0=_0,J0=d(9209),X0=d(15052),ys=d(1287),Q0=d(28191);function $0(){const n=(0,Le.F5)(),t=(0,Xo.SK)();var o;const s=(0,xe.J5)((o=t?.projectFileId)!==null&&o!==void 0?o:""),i=s?.visualizationMapping,r=(0,Q0.$p)(),a=(0,c.useMemo)(()=>
247{if(n!=="Task"||!t||!s||!i||r===void 0)return null;const u=i.project_from_ecef_dimension(ys.uT),h=(0,ys.OJ)(t.bounds,u).coords.map(g=>{var p;return i.ecef_from_project_point(new m.Z(g.x,g.y,(p=t.bounds.zVal)!==null&&p!==void 0?p:r))});return new an.Z({geometry:new J0.Z({positions:h,width:6}),attributes:{color:cn.Z.fromColor(Pe.Z.AQUA.withAlpha(.8))},id:"task-responsibility-boundary`"})},[t,i,n,s,r]),l=(0,c.useMemo)(()=>{const u=new Wn.Z;return u._renderState.depthTest.enabled=!1,u},[]);return a?(0,e.jsx)(me.WV,{children:(0,e.jsx)(me.$g,{geometryInstances:a,asynchronous:!0,allowPicking:!1,classificationType:X0.Z.CESIUM_3D_TILE,show:!0,appearance:l})}):null}var q0=d(62768),em=d(88286),tm=d(68655);function nm(n){const t=n.layerVisibility;let o="true";if(t){const s=Object.keys(t).filter(r=>t[r]===!1),i=Object.keys(t).filter(r=>t[r]===!0);i.length>=s.length?o=s.length===0?"true":s.map(r=>'${layer} !== "'.concat(r,'"')).join(" && "):o=i.length===0?"false":i.map(r=>'${layer} === "'.concat(r,'"')).join(" || ")}return(0,c.useMemo)(()=>new em.Z({show:o,color:"rgba(${colorR} === null ? 0 : ${colorR}, ${colorG} === null ? 0 : ${colorG}, ${colorB} === null ? 0 : ${colorB}, 1)",labelColor:"rgba(${colorR} === null ? 0 : ${colorR}, ${colorG} === null ? 0 : ${colorG}, ${colorB} === null ? 0 : ${colorB}, 1)",pointSize:"${labelText} === null ? 5 : 0",labelText:"${labelText}",scaleByDistance:"vec4(100, 1, 1000, 0.1)",font:"${labelFont} === null ? '24pt sans-serif' : ${labelFont}",backgroundColor:"rgba(${backgroundR} === null ? 0 : ${backgroundR}, ${backgroundG} === null ? 0 : ${backgroundG}, ${backgroundB} === null ? 0 : ${backgroundB}, 1)",backgroundEnabled:"${backgroundR} !== null",labelOutlineColor:"rgba(${outlineR} === null ? 0 : ${outlineR}, ${outlineG} === null ? 0 : ${outlineG}, ${outlineB} === null ? 0 : ${outlineB}, 1)",labelStyle:"${outlineR} !== null ? (${colorR} !== null ? 2 : 1) : 0"}),[o])}function om(n){const{tilesKey:t}=n,o=(0,Ut.CY)(l=>l[t]),s=(0,tm.Z)(o.projectFileId),i=nm(o),r=(0,je.iJ)(l=>l.dxfFiles[t]),a=(0,xs.Z)(new Yt.Z(t,Yt.F.DxfFile));return(0,e.jsx)(me.ME,{ref:a,url:s,style:i,show:r})}function sm(){const n=(0,Ut.CY)(t=>t);return(0,e.jsx)(e.Fragment,{children:Object.keys(n).map(t=>(0,e.jsx)(hn,{id:t,children:(0,e.jsx)(om,{tilesKey:t},t)},t))})}var im=sm,Mn=d(15588),Eo=d(39689);function rm(){const n=(0,le.ug)(),{select:t}=(0,Te.cH)(),o=(0,Bn.tq)(),s=(0,c.useCallback)(async i=>{const a=i.split(";").map(f=>n.getFeatureById(f)).filter(Mn.$K);if(a.length===0)return[];const l=new m.Z(0,0,0);l._override=()=>{a.length===1&&o(new Yt.Z(a[0].id,a[0].__typename==="ObjectAnnotation"?Yt.F.Object:Yt.F.Spline)),t(a)};const u=a.map(f=>f.__typename==="ObjectAnnotation"?Eo.c0[f.type]:ee.di[f.type]).filter(Mn.$K);return[{displayName:u.length>0?u.join(", "):"Feature",destination:l}]},[n,o,t]);return(0,Jo.YT)(s),null}function am(n,t,o,s){const i=m.Z.normalize(new m.Z(0,-Math.sin(s*Math.PI/180),Math.cos(s*Math.PI/180)),new m.Z),r=m.Z.add(t,m.Z.multiplyByScalar(i,-1*o,new m.Z),new m.Z),a=(0,It.BY)(n),l=Ee.Z.multiplyByPoint(a,r,new m.Z),u=Ee.Z.multiplyByPointAsVector(a,i,new m.Z),f=Rt.Z.eastNorthUpToFixedFrame(n.origin),h=Ee.Z.multiplyByPointAsVector(f,m.Z.UNIT_Z,new m.Z);return{destination:l,orientation:{direction:u,up:h}}}function So(){const n=(0,Bn.cy)(),t=(0,it.zz)(),o=_s(),s=(0,c.useMemo)(()=>new m.Z(o.crossSectionCameraOrigin.x,o.crossSectionCameraOrigin.y,0),[o]);return(0,c.useCallback)(i=>{if(!n)return;const r=n.camera;if(!r)return;const a=am(i,s,t.distance,t.viewingAngle);return r.flyTo({...a,duration:Ii.U}),a},[n,s,t])}function ar(){const n=So(),t=(0,Bn.cy)(),o=(0,it.zz)();return(0,c.useCallback)(async s=>{if(!t||!t.camera)return;const i=t.camera.position,r=n(s);if(!r)return;m.Z.distance(i,r.destination)>o.distanceThreshold&&await new Promise(l=>setTimeout(l,o.duration))},[n,t,o])}const cm="Stencil Info",cr=(0,c.createContext)(null);function lm(n){const[t,o]=(0,c.useState)(null),[s,i]=(0,c.useState)(()=>()=>{}),[r,a]=(0,c.useState)(null),l=(0,c.useMemo)(()=>({infoBoxContents:t,setInfoBoxContents:o,onClose:s,setOnClose:i,infoBoxTitle:r,setInfoBoxTitle:a}),[t,s,r]);return(0,e.jsx)(cr.Provider,{value:l,children:n.children})}function vn(){const n=(0,c.useContext)(cr);if(!n)throw new Error("useFishboneInfoBoxContext must be used within a FishboneInfoBoxContextProvider");return n}function dm(){return vn().infoBoxContents}function jo(){return vn().setInfoBoxContents}function um(){const n=vn();var t;return(t=n.infoBoxTitle)!==null&&t!==void 0?t:cm}function Ap(){const n=vn(),t=n.setInfoBoxContents,o=n.setOnClose;return useCallback(()=>{t(null),o(()=>()=>{})},[t,o])}function To(){const t=vn().setOnClose;return(0,c.useCallback)(o=>{t(()=>
247o)},[t])}function lr(){return vn().onClose}function dr(){return vn().setInfoBoxTitle}var ur=d(84704),mm=d(17311);function Cs(n,t,o,s){const i=new Map;for(const a of Object.values(o))for(const[l,u]of n.entries()){const f=a.findIntersectionsWithThickPlane(Sn.Z.fromPointNormal(u.origin,u.normal),t/2);for(const h of f){var r;if(s?.(h.line.id))continue;const g=(0,Et.BR)(u.origin,h.segmentPoint);if(m.Z.magnitude(g)>u.windowWidth/2||h.line.deletedAt!==null||(0,Ae.h)(h.line))continue;i.has(h.line.id)||i.set(h.line.id,[]);const p={...h,crossSection:l};(r=i.get(h.line.id))===null||r===void 0||r.push(p)}}return i}function mr(n){const t=new Map;for(const[o,s]of n.entries()){const i=s.sort((l,u)=>l.segmentStart-u.segmentStart!==0?l.segmentStart-u.segmentStart:l.segmentT-u.segmentT),r=[];let a=[i[0]];for(let l=1;l<i.length;l++){const u=i[l],f=a[a.length-1];Math.abs(u.crossSection-f.crossSection)===1?a.push(u):(r.push(a),a=[u])}a.length>1&&r.push(a),t.set(o,r)}return t}function fm(n,t){const o=[];for(const[a,l]of n.entries())l.length>0&&!o.find(u=>u.id===a)&&o.push(l[0][0].line);const s=[],i=new Map;for(const a of o){const l=n.get(a.id);if(!a||!l?.length)continue;const u=t[a?.projectFileId].visualizationMapping,f=[...a.coords];for(const h of l.reverse()){var r;if(h.length<2)continue;const g=h.map(y=>u.project_from_ecef_point(y.segmentPoint)),p=h[0].segmentT>0?h[0].segmentStart+1:h[0].segmentStart,v=h.at(-1).segmentStart+(h.at(-1).segmentT===1?1:0);i.has(a.id)||i.set(a.id,[]),(r=i.get(a.id))===null||r===void 0||r.push({startIdx:h[0].segmentStart,startT:h[0].segmentT,endIdx:h.at(-1).segmentStart,endT:h.at(-1).segmentT}),f.splice(p,v-p+1,...g)}s.push({...a,coords:f})}return{modifiedLines:s,newStretches:i}}function fr(){const n=(0,le.$P)(),t=(0,xe.yX)(),o=(0,je.Iz)(),s=(0,le.vC)(),i=(0,N.tD)();return(0,c.useCallback)((r,a,l)=>{const f=Cs(r,i,n,g=>{if(l?.[g]||a?.[g])return!0;const p=s.find(v=>v.id===g);return p?!o(p):!0}),h=mr(f);return fm(h,t)},[s,n,t,o,i])}function hm(n){const t=(0,le.vC)(),o=(0,le.$P)(),s=(0,q.IX)(n),i=(0,q.aG)(n),r=(0,je.Iz)(),a=(0,N.tD)(),[l]=(0,ur.Z)();return(0,c.useCallback)(()=>{const u=g=>{if(!s||s.type==="exclude-lines"&&s.excludedLineIds[g])return!0;if(s.type==="include-lines"&&!s.includedLineIds[g])return!0;const p=t.find(v=>v.id===g);return p?!r(p):!0},f=Cs(i.crossSections,a,o,u),h=mr(f);return gm(h,l)},[s,t,o,r,a,i,l])}function gm(n,t){const o=[],s=[];for(const i of n.values()){if(i.length===0)continue;const r=i[0][0].line,{includedRanges:a,excludedRanges:l}=pm(i),u=vm(r,a,l,t);o.push(...u),s.push(r)}return{newLines:o,modifiedLines:s}}function hr(n){return n.startIdx<n.endIdx||n.startIdx===n.endIdx&&n.startT<n.endT}function pm(n){if(n.length===0)return{includedRanges:[],excludedRanges:[]};const t=n[0][0].line,o=[],s=[],i={startIdx:0,startT:0,endIdx:n[0][0].segmentStart,endT:n[0][0].segmentT};s.push(i);for(const[r,a]of n.entries()){const l={startIdx:a[0].segmentStart,startT:a[0].segmentT,endIdx:a.at(-1).segmentStart,endT:a.at(-1).segmentT},u={startIdx:a.at(-1).segmentStart,startT:a.at(-1).segmentT,endIdx:r===n.length-1?t.coords.length-2:n[r+1][0].segmentStart,endT:r===n.length-1?1:n[r+1][0].segmentT};s.push(u),o.push(l)}return{includedRanges:o.filter(hr),excludedRanges:s.filter(hr)}}function vm(n,t,o,s){const i=[],r=(0,mm.PB)(n);for(const l of t){const u=_n(l,r);var a;i.push({line:{annotationLayerId:n.annotationLayerId,coords:u,width:n.width,type:n.type,spec:{...n.spec,qa:{type:"approved",time:new Date().toISOString(),user:(a=s?.username)!==null&&a!==void 0?a:"Unknown"}},isClosed:!1},projectFileId:n.projectFileId})}for(const l of o){const u=_n(l,r);i.push({line:{annotationLayerId:n.annotationLayerId,coords:u,width:n.width,type:n.type,spec:n.spec,isClosed:!1},projectFileId:n.projectFileId})}return i}function _n(n,t){const o=n.startT>0?n.startIdx+1:n.startIdx,s=n.endIdx+(n.endT===1?1:0),i=t.slice(o,s+1);if(n.startT!==0){const r=t[n.startIdx],a=t[n.startIdx+1],l=m.Z.lerp(r,a,n.startT,new m.Z);i.splice(0,0,l)}if(n.endT!==1&&n.endT!==0){const r=t[n.endIdx],a=t[n.endIdx+1],l=m.Z.lerp(r,a,n.endT,new m.Z);i.push(l)}return i}function xm(n){const{fishboneId:t}=n,o=hm(t),s=(0,le.vC)(),i=(0,le.Qz)(),r=(0,le.Dv)(),a=(0,b.TL)(),l=(0,c.useCallback)(()=>{const{newLines:u,modifiedLines:f}=o(),h=[],g=new Date().toISOString();for(const p of f)s.find(y=>y.id===p.id)&&(i(p.id,{deletedAt:g}),h.push({kind:"update-object",id:p.id,oldState:p}));for(const{line:p,projectFileId:v}of u){const y=r(p,v);h.push({kind:"add-object",id:y.id,state:y})}a((0,Ue.u7)("cut and approve",h))},[o,r,i,a,s]);return(0,e.jsx)(Ce.Button,{onClick:l,text:"Cut and Approve",intent:"primary"})}function ym(n){const{fishbone:t,fishboneId:o}=n,s=(0,q.nC)(),i=(0,N.Pt)(),r=t.crossSections.length,a=(0,b.TL)(),l=So(),u=(0,c.useCallback)(()=>{!o||t.crossSections.length===0||(a((0,N.dA)(t.crossSections[0],o,!0)),l(t.crossSections[0]))},[o,t.crossSections,a,l]),f=(0,c.useCallback)(()=>
247{if(!(!o||t.crossSections.length===0)&&s!==null&&s>0){const v=t.crossSections[s-1];a((0,N.dA)(v,o))}},[a,s,t.crossSections,o]),h=(0,c.useCallback)(()=>{if(!(!o||t.crossSections.length===0)&&s!==null&&s<r-1){const v=t.crossSections[s+1];a((0,N.dA)(v,o))}},[a,s,t.crossSections,r,o]),g=(0,c.useCallback)(()=>{!o||t.crossSections.length===0||(a((0,N.dA)(t.crossSections[r-1],o,!0)),l(t.crossSections[r-1]))},[o,t.crossSections,a,r,l]);(0,c.useEffect)(()=>{const v=()=>u();return document.addEventListener(Ot.JP.NAVIGATION_FIRST_CROSS_SECTION,v),()=>document.removeEventListener(Ot.JP.NAVIGATION_FIRST_CROSS_SECTION,v)},[u]),(0,c.useEffect)(()=>{const v=()=>f();return document.addEventListener(Ot.JP.NAVIGATION_PREVIOUS_CROSS_SECTION,v),()=>document.removeEventListener(Ot.JP.NAVIGATION_PREVIOUS_CROSS_SECTION,v)},[f]),(0,c.useEffect)(()=>{const v=()=>h();return document.addEventListener(Ot.JP.NAVIGATION_NEXT_CROSS_SECTION,v),()=>document.removeEventListener(Ot.JP.NAVIGATION_NEXT_CROSS_SECTION,v)},[h]),(0,c.useEffect)(()=>{const v=()=>g();return document.addEventListener(Ot.JP.NAVIGATION_LAST_CROSS_SECTION,v),()=>document.removeEventListener(Ot.JP.NAVIGATION_LAST_CROSS_SECTION,v)},[g]);const p=()=>s!==null?"".concat(s+1," of ").concat(r):"No Cross Section Selected";return(0,e.jsxs)("div",{className:"flex w-full flex-col",children:[(0,e.jsx)("h3",{className:"mb-3",children:"Cross Sections"}),(0,e.jsxs)("div",{className:"flex flex-row items-center gap-2 pb-2",children:[(0,e.jsx)(Ce.Button,{onClick:u,icon:"double-chevron-left",disabled:s===0}),(0,e.jsx)(Ce.Button,{onClick:f,icon:"chevron-left",disabled:s===0}),(0,e.jsx)(Ce.Button,{onClick:h,icon:"chevron-right",disabled:s===null||s===r-1}),(0,e.jsx)(Ce.Button,{onClick:g,icon:"double-chevron-right",disabled:s===null||s===r-1}),(0,e.jsxs)("div",{className:"flex w-full items-center justify-between gap-2",children:[(0,e.jsx)("span",{children:p()}),(0,e.jsx)(Em,{})]})]}),(0,e.jsx)("div",{className:"flex flex-row items-center pb-2",children:(0,e.jsx)(Ce.Checkbox,{label:"Follow Cross Section",checked:i,onChange:v=>a((0,N.U$)(v.currentTarget.checked))})})]})}function Cm(n){const{fishboneId:t,fishbone:o}=n,s=(0,b.TL)(),i=(0,q.nC)(),r=lr(),a=(0,j.kb)(u=>u.mode==="matcher"),l=(0,c.useCallback)(()=>{if(i!==null){s((0,q.HG)(t,i));const u=i===o.crossSections.length-1?o.crossSections.length-2:i+1;s((0,N.dA)(o.crossSections[u],t))}},[s,t,i,o.crossSections]);return a?null:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[(0,e.jsx)(xm,{fishboneId:t}),o.crossSections.length>1&&(0,e.jsx)(Ce.Button,{icon:"remove",intent:"danger",outlined:!0,onClick:l,text:"Delete Cross Section"}),(0,e.jsx)(Ce.Button,{icon:"trash",intent:"danger",onClick:()=>{s((0,q.$W)(t)),s((0,N.dA)(null)),r()},text:"Delete Stencil"})]})}function Em(){const n=So(),t=(0,N.jk)(o=>o.crossSection);return t?(0,e.jsx)(Ce.Button,{onClick:()=>{n(t)},icon:"target",minimal:!0,title:"Fly to Cross Section"}):null}function Sm(n){const t=(0,q.p0)(),o=(0,q.Kq)();return(0,e.jsxs)("div",{className:"flex h-full flex-col justify-between",children:[t&&o&&(0,e.jsx)(ym,{fishbone:t,fishboneId:o}),n.children,t&&o&&(0,e.jsx)(Cm,{fishboneId:o,fishbone:t})]})}function jm(){const n=(0,b.TL)(),t=lr(),o=(0,c.useCallback)(()=>{t(),n((0,q.D4)(null))},[n,t]);return(0,e.jsx)(Ce.Button,{minimal:!0,icon:"cross",onClick:o,title:"Close"})}function Tm(){const[n,t]=(0,ln.f_)(),o=(0,q.p0)(),s=(0,N.jk)(l=>l.crossSection),i=o!==void 0&&s!==null,r=dm(),a=um();return i||r?(0,e.jsx)(ln.QP,{title:a,topbarButtons:(0,e.jsxs)(e.Fragment,{children:[t,(0,e.jsx)(jm,{})]}),initialPosition:{bottom:100,left:200},minimized:n,children:(0,e.jsx)(Sm,{children:r})}):null}var gr=d(52122);function bm(){const n=(0,c.useCallback)(()=>{document.body.setAttribute("data-mouse-right","true")},[]),t=(0,c.useCallback)(()=>{document.body.removeAttribute("data-mouse-right"),document.dispatchEvent(new CustomEvent("bridge:camera-stop"))},[]);return(0,qe.sC)("onRightDragStart",n),(0,qe.sC)("onRightDragEnd",t),null}const Pm=4;function Mm(){const n=(0,j.kb)(g=>g.mode),t=(0,R.NB)(),{select:o}=(0,fn.c)(),s=(0,c.useRef)(!1),i=(0,c.useRef)(null),r=(0,c.useRef)(0),a=(0,c.useRef)(null),l=(0,c.useCallback)(g=>{!Im(g)||wm(n)||!Rm(t)||g.target||s.current||o([])},[n,t,o]),u=(0,c.useCallback)(g=>{a.current&&(clearTimeout(a.current),a.current=null),i.current=at.Z.clone(g.mousePosition),s.current=!1,r.current=0},[]),f=(0,c.useCallback)(g=>{if(!i.current||s.current)return;const p=at.Z.distance(g.mousePosition,i.current);r.current+=p,i.current=at.Z.clone(g.mousePosition),r.current>Pm&&(s.current=!0)},[]),h=(0,c.useCallback)(()=>{i.current=null,a.current=setTimeout(()=>{s.current=!1,a.current=null},100)},[]);return(0,qe.sC)("onDragStart",u),(0,qe.sC)("onMouseMove",f),(0,qe.sC)("onDragEnd",h),(0,qe.sC)("onClick",l),null}function Im(n){return n&&typeof n.mousePosition<"u"}function wm(n){return n!=="none"}function Rm(n){return n>0}
247function Om(){const n=(0,_t.I0)(),t=(0,_e.f8)(),o=(0,_e.Uv)(),s=i=>{n((0,_e.nj)(i.target.value))};return o?(0,e.jsx)(ln.QP,{title:"Drape Settings",topbarButtons:(0,e.jsx)(Ce.Button,{minimal:!0,icon:"cross",onClick:()=>{n((0,_e.y0)(!1))},title:"Close"}),hideScrollbar:!0,initialPosition:{top:40,right:370},children:(0,e.jsxs)(Ce.FormGroup,{label:"Drape Strategy",children:[(0,e.jsx)(Ce.HTMLSelect,{options:Object.entries(Se.P).map(i=>{let[r,a]=i;return{label:a.label,value:r}}),value:t,onChange:s,fill:!0}),(0,e.jsx)("div",{style:{marginTop:8,color:"#b0bec5",fontSize:13},children:Se.P[t].details})]})}):null}var Lm=d(64440),Am=d(19347);function Es(n,t){var o,s;return(s=(o=t[n.projectFileId])===null||o===void 0?void 0:o.visualizationMapping)!==null&&s!==void 0?s:null}function bo(n,t,o){const s=t.ecef_from_project_point(n);var i;return(i=o.cartesianToCanvasCoordinates(s))!==null&&i!==void 0?i:null}function Dm(){return[new m.Z(-.5,-.5,-.5),new m.Z(.5,-.5,-.5),new m.Z(-.5,.5,-.5),new m.Z(.5,.5,-.5),new m.Z(-.5,-.5,.5),new m.Z(.5,-.5,.5),new m.Z(-.5,.5,.5),new m.Z(.5,.5,.5)]}function pr(n,t,o){return n.coords.map(s=>{let{x:i,y:r,z:a}=s;return bo(new m.Z(i,r,a),t,o)}).filter(Mn.GT)}function Zm(n,t){return n.x<=t.x?j.oW.WINDOW:j.oW.CROSSING}function vr(n,t){const o=Zm(n,t);return{box:{left:Math.min(n.x,t.x),top:Math.min(n.y,t.y),width:Math.abs(n.x-t.x),height:Math.abs(n.y-t.y)},selectionMode:o}}function Po(n,t){return n.x>=t.left&&n.x<=t.left+t.width&&n.y>=t.top&&n.y<=t.top+t.height}function Ss(n,t){return Po(n,t)}function Fm(n,t){return Am.Z.computeLineSegmentLineSegmentIntersection(n.start.x,n.start.y,n.end.x,n.end.y,t.start.x,t.start.y,t.end.x,t.end.y)!==void 0}function xr(n,t){const o=[{start:new at.Z(t.left,t.top),end:new at.Z(t.left+t.width,t.top)},{start:new at.Z(t.left+t.width,t.top),end:new at.Z(t.left+t.width,t.top+t.height)},{start:new at.Z(t.left+t.width,t.top+t.height),end:new at.Z(t.left,t.top+t.height)},{start:new at.Z(t.left,t.top+t.height),end:new at.Z(t.left,t.top)}];return Ss(n.start,t)||Ss(n.end,t)||o.some(s=>Fm(n,s))}function Nm(n,t){return n.length===0?!1:n.every(o=>Po(o,t))}const Bm=(()=>{const n=["x","y","z"],t=[];for(const o of n){const s=n.filter(i=>i!==o);for(const i of[-.5,.5])for(const r of[-.5,.5]){const a=new m.Z(0,0,0);a[s[0]]=i,a[s[1]]=r;const l=m.Z.clone(a);l[o]=-.5;const u=m.Z.clone(a);u[o]=.5,t.push({start:l,end:u})}}return t})();var km=d(47346),yr=d(63248);class Cr{selectArea(t,o){switch(o){case j.ac.OBJECTS:return this.selectObjects(t);case j.ac.LINES:return this.selectLines(t);case j.ac.VERTICES:return this.selectVertices(t);case j.ac.ALL:default:return this.selectAll(t)}}selectObjects(t){const o=[];for(const s of t.objects){const i=Es(s,t.trajectories);i&&s.__typename==="ObjectAnnotation"&&this.doesObjectMeetCriteria(s,i,t.scene,t.box)&&o.push(s)}return o}selectLines(t){const o=[];for(const s of t.objects){const i=Es(s,t.trajectories);i&&s.__typename==="LineAnnotation"&&this.doesLineMeetCriteria(s,i,t.scene,t.box)&&o.push(s)}return o}selectVertices(t){const o=[];for(const s of t.objects){if(s.__typename!=="LineAnnotation")continue;const i=Es(s,t.trajectories);if(i)for(let r=0;r<s.coords.length;r++){const{x:a,y:l,z:u}=s.coords[r],f=bo(new m.Z(a,l,u),i,t.scene);f&&this.doesPointMeetCriteria(f,t.box)&&o.push({type:km.I.VERTEX,id:"".concat((0,Te.h7)(s.id),"-").concat(r),lineId:(0,Te.h7)(s.id),vertexIndex:r})}}return o}selectAll(t){const o=[];return o.push(...this.selectObjects(t)),o.push(...this.selectLines(t)),o.push(...this.selectVertices(t)),o}}class Vm extends Cr{doesObjectMeetCriteria(t,o,s,i){const r=(0,yr.T2)(t),a=l=>{const u=Ee.Z.multiplyByPoint(r,l,new m.Z),f=bo(u,o,s);return f??at.Z.ZERO};return Bm.some(l=>{let{start:u,end:f}=l;return xr({start:a(u),end:a(f)},i)})}doesLineMeetCriteria(t,o,s,i){const r=pr(t,o,s);if(r.length<2)return!1;const a=[];for(let l=0;l<r.length-1;l++)a.push({start:r[l],end:r[l+1]});return a.some(l=>xr(l,i))}doesPointMeetCriteria(t,o){return Ss(t,o)}}class Um extends Cr{doesObjectMeetCriteria(t,o,s,i){const r=(0,yr.T2)(t),a=Dm(),l=u=>{const f=Ee.Z.multiplyByPoint(r,u,new m.Z);return bo(f,o,s)};for(const u of a){const f=l(u);if(!f||!Po(f,i))return!1}return!0}
247doesLineMeetCriteria(t,o,s,i){if(!t.coords||t.coords.length===0)return!1;const r=pr(t,o,s);return r.length!==t.coords.length?!1:Nm(r,i)}doesPointMeetCriteria(t,o){return Po(t,o)}}function Wm(n){switch(n){case j.oW.WINDOW:return new Um;case j.oW.CROSSING:return new Vm;default:throw new Error("Unknown selection mode: ".concat(n))}}function zm(){const n=(0,xe.yX)(),{scene:t}=(0,me.VQ)(),o=(0,Lm.Z)(),s=(0,je.rW)(o),i=(0,b.TL)(),{select:r}=(0,fn.c)(),a=(0,c.useMemo)(()=>o.filter(f=>s[f.id]!==!1),[o,s]),l=(0,j.kb)(f=>f.mode==="select-area"?f.filterMode:j.ac.ALL);return(0,j.kb)(f=>f.mode==="select-area"||f.mode==="none")?(0,e.jsx)(Hm,{onSelect:f=>{let{box:h,selectionMode:g}=f;if(!t)return;const p={objects:a,trajectories:n,scene:t,box:h},y=Wm(g).selectArea(p,l);i((0,j.fq)({mode:"none"})),r(y)}}):null}function Hm(n){const[t,o]=(0,c.useState)(void 0),s=(0,c.useRef)(!1),i=(0,c.useRef)(null),r=(0,c.useRef)(!1),a=(0,fo.Z)("Alt"),l=5,u=(0,c.useCallback)(()=>{s.current=!1,r.current=!1,i.current=null,o(void 0)},[]),f=(0,c.useCallback)(p=>{if(!p.target&&!a){p.stopPropagation(),r.current=!0,s.current=!1;const v=p.mousePosition;i.current=v}},[a]),h=(0,c.useCallback)(p=>{if(r.current&&i.current&&!a){p.stopPropagation();const v=p.mousePosition;if(s.current)o([i.current,v]);else{const y=v.x-i.current.x,S=v.y-i.current.y;Math.sqrt(y*y+S*S)>=l&&(s.current=!0,o([i.current,v]))}}else r.current&&a&&(p.stopPropagation(),u())},[a,u]),g=(0,c.useCallback)(p=>{r.current&&(p.stopPropagation(),s.current&&t&&!a&&n.onSelect(vr(...t)),u())},[t,n,u,a]);return(0,qe.sC)("onDragStart",f),(0,qe.sC)("onDrag",h),(0,qe.sC)("onDragEnd",g),(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(Km,{area:t})})}function Km(n){if(n.area){const{box:t,selectionMode:o}=vr(...n.area),{left:s,top:i,width:r,height:a}=t,l=o===j.oW.WINDOW?"border-2 border-blue-500 bg-blue-500/30":"border-2 border-dashed border-white-1000 bg-white-1000/30";return(0,e.jsx)("div",{className:"pointer-events-none absolute ".concat(l),style:{left:s,top:i,width:r,height:a}})}else return null}var Er=d(55951),Sr=d(82656),xn=d(88422);function jr(n){const{snapGuideSegment:t,show:o}=n,{ecefOrigin:s,ecefTarget:i}=t,r=(0,c.useMemo)(()=>(0,lt.BW)(Sr.uo),[]),a=(0,c.useMemo)(()=>new mt.Z(()=>[s,i],!1),[s,i]);return(0,e.jsx)(me.JH,{children:(0,e.jsx)(me.qz,{positions:a,material:r,width:2,show:o})})}function Gm(n){const{directionalSnapGuides:t}=n,o=(0,xn.g$)(),s=(0,c.useMemo)(()=>t.map(i=>{if(o)return(0,Sr.vs)(o,i)}).filter(i=>!!i),[t,o]);return(0,e.jsxs)(e.Fragment,{children:[s.map(i=>(0,e.jsx)(jr,{snapGuideSegment:i,show:!0},i.id)),t.map(i=>(0,e.jsx)(pn.At,{ranges:i.referenceHighlight,width:pn.Y5,color:Pe.Z.RED},i.id))]})}function _m(){const{snapGuideManager:n}=(0,c.useContext)(Er.NM),{selfSnapGuides:t,directionalSnapGuides:o}=n;return(0,e.jsxs)(e.Fragment,{children:[t.map(s=>(0,e.jsx)(jr,{snapGuideSegment:s,show:!0},s.id)),o.length>0&&(0,e.jsx)(Gm,{directionalSnapGuides:o})]})}var Mo=d(55728),Tr=d(26446),js=d(18507),Yn=d(81542),Ts=d(66842),Ym=d(10241),In=d(22101),br=d(68970);function Jm(n,t){const[o,s]=(0,c.useState)(null);return(0,c.useEffect)(()=>{n||s(null)},[n]),[(0,c.useMemo)(()=>!o||t.find(a=>m.Z.equalsEpsilon(a.position,o.position,void 0,.01))?null:o,[o,t]),s]}function Xm(n){const{handleLineFinish:t}=n,o=(0,Ym.JH)()===Ts.bK.DEFAULT_SNAP,[s,i]=(0,c.useState)(null),r=(0,c.useRef)([]),[a,l]=(0,c.useState)([]),[u,f]=(0,c.useState)([]),[h,g]=Jm(o,a),p=(0,xe.yX)(),v=(0,c.useRef)(null),[y,S]=(0,c.useState)(!1),E=(0,js.lT)(),{snapper:Z}=(0,xn.c4)(),P=(0,In.Z)({snapper:Z});(0,br._)();const U=(0,c.useCallback)(Ie=>{const Ke=P(Ie);if(!Ke?.position)return;const{position:et,snappedWith:ae,pickTarget:$e}=Ke;if(f(Je=>[...Je,{followStart:s,vertices:a}]),o&&ae&&ae.type==="line")s&&ae.line.id===s.line.id?(l([...a,...r.current.map(Je=>({position:Je,tilesetId:ae.line.projectFileId}))]),r.current=[],i(ae)):(l([...a,{position:et,tilesetId:ae.line.projectFileId}]),i(ae),r.current=[]);else if($e){const Je=$e.pointCloudFileId;l([...a,{position:et,tilesetId:Je}]),i(null),r.current=[]}Ie.stopPropagation()},[P,s,l,o,a]);(0,qe.sC)("onClick",U);const Y=(0,c.useCallback)(Ie=>{const Ke=P(Ie);if(!Ke?.position)return;const{position:et,snappedWith:ae,pickTarget:$e}=Ke;if(v.current=et,E(ae),o){if(!et||!ae||ae.type!=="line")return;let Je=null;const xt=p[ae.line.projectFileId].visualizationMapping;if(s&&ae.line.id===s.line.id){let Ge=[];if(s.segmentStart>ae.segmentStart){const gt=s.segmentT===0?s.segmentStart:s.segmentStart+1;Ge=s.line.coords.slice(ae.segmentStart+1,gt).reverse().map(ut=>xt.ecef_from_project_point(new m.Z(ut.x,ut.y,ut.z)))}else if(s.segmentStart<ae.segmentStart){const gt=s.segmentT===1?s.segmentStart+2:s.segmentStart+1;Ge=s.line.coords.slice(gt,ae.segmentStart+1).map(ut=>xt.ecef_from_project_point(new m.Z(ut.x,ut.y,ut.z)))}else Ge=[];const tt=[...Ge,ae.position];r.current=tt,s.segmentStart>ae.segmentStart||s.segmentStart===ae.segmentStart&&s.segmentT>ae.segmentT?Je="first":(s.segmentStart<ae.segmentStart||s.segmentStart===ae.segmentStart&&s.segmentT<ae.segmentT)&&(Je="last")}else{r.current=[];const Ge=xt.ecef_from_project_point(new m.Z(ae.line.coords[0].x,ae.line.coords[0].y,ae.line.coords[0].z)),tt=xt.ecef_from_project_point(new m.Z(ae.line.coords.at(-1).x,ae.line.coords.at(-1).y,ae.line.coords.at(-1).z));m.Z.distance(et,Ge)<m.Z.distance(et,tt)?Je="first":Je="last"}switch(Je){case"first":{const Ge=xt.ecef_from_project_point(new m.Z(ae.line.coords[0].x,ae.line.coords[0].y,ae.line.coords[0].z));g({type:"line",line:ae.line,segmentStart:0,position:Ge,segmentT:0,subType:Ts.sA.ENDPOINT});break}case"last":{const Ge=xt.ecef_from_project_point(new m.Z(ae.line.coords.at(-1).x,ae.line.coords.at(-1).y,ae.line.coords.at(-1).z));g({type:"line",line:ae.line,segmentStart:ae.line.coords.length-2,position:Ge,segmentT:1,subType:Ts.sA.ENDPOINT});break}case null:break}}else r.current=[]},[s,P,p,o,g,E]);(0,qe.sC)("onMouseMove",Y);const se=(0,c.useMemo)(()=>a.map(Ie=>Ie.position),[a]),he=(0,c.useMemo)(()=>new mt.Z(()=>
247{if(a.length===0||r.current.length>0)return[m.Z.ONE,m.Z.ONE];var Ie;return[a[a.length-1].position,(Ie=v.current)!==null&&Ie!==void 0?Ie:a[a.length-1].position]},!1),[a,v,r]),ie=(0,c.useMemo)(()=>new mt.Z(()=>v.current,!1),[v]),Oe=(0,c.useMemo)(()=>new mt.Z(()=>a.length+r.current.length>=2&&o?[a.at(-1).position,...r.current]:[m.Z.ONE,m.Z.ONE],!1),[r,a,o]),ue=(0,c.useMemo)(()=>s?[...a,...r.current.map(Ie=>({position:Ie,tilesetId:s.line.projectFileId}))]:a,[s,a,r]),De=(0,c.useCallback)(()=>{ue.length<2||t&&t(ue.map(Ie=>Ie.position),{targetTilesetIds:ue.map(Ie=>Ie.tilesetId)})},[t,ue]),Qe=(0,c.useMemo)(()=>new Tr.Z({color:Pe.Z.GREENYELLOW,dashLength:16}),[]),He=(0,c.useMemo)(()=>(0,lt.BW)(Pe.Z.GREENYELLOW),[]);(0,c.useEffect)(()=>{const Ie=()=>{De()},Ke=()=>{if(u.length===0)return;const et=u.at(-1);f(u.slice(0,-1)),l(et.vertices),i(et.followStart)};return document.addEventListener(k.TV.LINE_FINISH,Ie),document.addEventListener(k.TV.LINE_UNDO_POINT,Ke),()=>{document.removeEventListener(k.TV.LINE_FINISH,Ie),document.removeEventListener(k.TV.LINE_UNDO_POINT,Ke)}},[De,u,l,i]);const Ne=(0,c.useCallback)(()=>{o&&h&&(f(Ie=>[...Ie,{followStart:s,vertices:a}]),s?.line.id===h.line.id?(l([...a,...r.current.map(Ie=>({position:Ie,tilesetId:h.line.projectFileId}))]),r.current=[],i(h)):(l([...a,{position:h.position,tilesetId:h.line.projectFileId}]),r.current=[],i(h)))},[o,s,h,a,l]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(me.JH,{children:(0,e.jsx)(me.qz,{positions:Oe,material:Qe,width:30,depthFailMaterial:Qe})}),se.length>0&&(0,e.jsx)(me.JH,{children:(0,e.jsx)(me.qz,{positions:se,material:He,width:lt.v,depthFailMaterial:He})}),se.length>1?se.map((Ie,Ke)=>(0,e.jsx)(me.JH,{position:Ie,children:(0,e.jsx)(me.l7,{color:Pe.Z.GREENYELLOW,pixelSize:lt.v*2})},Ke)):null,(0,e.jsx)(me.JH,{children:(0,e.jsx)(me.qz,{positions:he,material:Qe,width:lt.v,depthFailMaterial:Qe})}),y&&(0,e.jsx)(me.JH,{position:ie,children:(0,e.jsx)(me.l7,{color:Pe.Z.GREENYELLOW,pixelSize:lt.v*2})}),ue.length>1&&(0,e.jsx)(Yn.h,{pickedPoint:ue[ue.length-1],kindaTransparentColor:Pe.Z.GREENYELLOW.withAlpha(.5),mostlyTransparentColor:Pe.Z.GREENYELLOW.withAlpha(.01),isHovering:y,setHovering:S,handleLineFinish:De}),h&&(0,e.jsx)(Qm,{suggestion:h,acceptSuggestion:Ne}),(0,e.jsx)(Gt.Z,{callback:Ie=>{if(Ie.key==="Escape"){var Ke;r.current=[],g(null),i(null),l([]),S(!1),n==null||(Ke=n.handleCancel)===null||Ke===void 0||Ke.call(n)}}})]})}function Qm(n){const{suggestion:t,acceptSuggestion:o}=n,[s,i]=(0,c.useState)(!1),r=(0,c.useCallback)(u=>{const f=u.target;i(!0),u.stopPropagation()},[i]),a=(0,c.useCallback)(u=>{i(!1)},[i]),l=(0,c.useCallback)(u=>{o(),u.stopPropagation()},[o]);return(0,e.jsx)(Nt.ZP,{position:t?.position,onMouseEnter:r,onMouseLeave:a,onClick:l,cursorOverride:"cell",children:(0,e.jsx)(me.l7,{color:s?Pe.Z.MEDIUMTURQUOISE:Pe.Z.MEDIUMTURQUOISE.withAlpha(.5),pixelSize:lt.v*10})})}function $m(n){return(0,c.useCallback)(t=>{if(n===0){const o=t.slice(0,2);return(0,Et.Jn)(o.map(i=>({point:i,width:Et.kC}))).map(Et.Df)[0]}else{const o=t.slice(n-1,n+2);return(0,Et.Jn)(o.map(i=>({point:i,width:Et.kC}))).map(Et.Df)[1]}},[n])}function qm(n,t){return(0,c.useCallback)(o=>{const s=(0,Et.ZD)(o),i=[...t];return i[n]=s.origin,i},[n,t])}function ef(){const n=(0,xe.yX)();return(0,c.useCallback)(t=>{const o=t.map(s=>{var i;const r=(i=n[s.projectFileId])===null||i===void 0?void 0:i.visualizationMapping;if(!r)return console.warn("No visualization mapping for line ".concat(s.id,", skipping")),null;const a=s.coords.map(l=>{let{x:u,y:f,z:h}=l;return r.ecef_from_project_point(new m.Z(u,f,h))});return{lineId:s.id,drawnPoints:a,resamplePoints:a}}).filter(Mn.GT);return o.length>0&&o.length<t.length&&I.Z.show({message:"Processing ".concat(o.length," of ").concat(t.length," selected lines (").concat(t.length-o.length," skipped due to missing mappings)"),intent:"warning"}),o},[n])}const Jn={RIB_WIDTH:4,SPINE_WIDTH:2,RIB_COLOR:Pe.Z.SALMON},Pr=n=>(0,c.useMemo)(()=>new Ln.Z(n),[n]);function Mr(n){const{edge:t}=n,o=Pr(Jn.RIB_COLOR);return(0,e.jsx)(me.JH,{children:(0,e.jsx)(me.qz,{positions:t,material:o,width:Jn.RIB_WIDTH,depthFailMaterial:o})})}function tf(n){const{index:t,points:o}=n,s=$m(t),i=qm(t,o.original()),r=(0,nt.LD)(o,s,i),a=(0,c.useMemo)(()=>r,[r]),l=(0,nt.pJ)(a),u=Pr(Jn.RIB_COLOR);return(0,e.jsx)(me.JH,{children:(0,e.jsx)(me.qz,{positions:l,material:u,width:Jn.RIB_WIDTH,depthFailMaterial:u})})}function nf(n){const{points:t,trackedPoints:o}=n,{dragState:s}=(0,Kn.Zj)(),i=(0,c.useMemo)(()=>(0,Et.Jn)(t.map(a=>({point:a,width:Et.kC}))).map(Et.Df),[t]),r=(0,c.useCallback)((a,l)=>"".concat(l,"-").concat(a[0].x,"-").concat(a[0].y,"-").concat(a[0].z,"-").concat(a[1].x,"-").concat(a[1].y,"-").concat(a[1].z),[]);return(0,e.jsx)(e.Fragment,{children:i.map((a,l)=>s.kind==="singleDrag"&&Math.abs(s.index-l)<=1?(0,e.jsx)(tf,{index:l,points:o},r(a,l)):(0,e.jsx)(Mr,{edge:a},r(a,l)))})}function of(n){const{spline:t,color:o,onMoveEnd:s,onDelete:i,renderItem:r}=n,a=(0,c.useMemo)(()=>t.coords.map(y=>new m.Z(y.x,y.y,y.z)),[t]),l=(0,nt.ZP)(a),u=(0,ft.tL)(),[f,h]=(0,c.useState)(a);(0,c.useEffect)(()=>{h(a)},[a]);const g=(0,c.useCallback)(()=>{h(void 0)},[]),p=(0,c.useCallback)(async()=>{await s(l.get()),h(l.get())},[l,s]),v=(0,c.useCallback)(async y=>{const S=l.get();if(S.length<=2)await i();else{const E=S.filter((Z,P)=>P!==y);await s(E)}},[l,s,i]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(bn.H8,{points:l,staticPointsOverride:u?f:void 0,color:o,width:Jn.SPINE_WIDTH,onAddPoint:async(y,S)=>{const E=[...l.get()];E.splice(y,0,S),await s(E)},onDelete:i,show:!0,readonly:!1,id:t.id}),(0,e.jsx)(Pn.m,{trackedPositions:l,color:o,isReadonly:!1,onDragStart:g,onDragEnd:p,onDelete:v,lineId:t.id}),r(a,l)]})}function sf(n){const{crossSections:t}=n,o=(0,c.useCallback)(s=>
247"".concat(s.origin.x,"-").concat(s.origin.y,"-").concat(s.origin.z),[]);return(0,e.jsx)(me.JH,{children:t.map((s,i)=>(0,e.jsx)(Mr,{edge:(0,Et.Df)(s)},o(s)))})}var rf=d(15421),dn=d.n(rf),Ir=d(22953),af=d(16608);function cf(n,t){return(0,c.useCallback)((o,s)=>{const i=s;i==="uniform"&&o.maxDistance!==void 0?o={maxDistance:o.maxDistance,horizontalTolerance:Number.MAX_VALUE,verticalTolerance:Number.MAX_VALUE}:i==="adaptive"&&o.maxDistance!==void 0&&o.horizontalTolerance!==void 0&&o.verticalTolerance!==void 0&&(o={maxDistance:o.maxDistance,horizontalTolerance:o.horizontalTolerance,verticalTolerance:o.verticalTolerance});const r=n.map(a=>{const l=a.drawnPoints;let u=l;try{const f=Rt.Z.eastNorthUpToFixedFrame(l[0]),h=Ee.Z.inverseTransformation(f,new Ee.Z),g=l.map(p=>Ee.Z.multiplyByPointAsVector(h,p,new m.Z));i==="adaptive"&&o?u=(0,Ir.ZP)(g,o).map(y=>Ee.Z.multiplyByPointAsVector(f,y,new m.Z)):i==="uniform"&&o&&(u=(0,Ir.L9)(g,o.maxDistance).map(y=>Ee.Z.multiplyByPointAsVector(f,y,new m.Z)))}catch(f){console.error("Resampling failed, using original points:",f),u=l}return{...a,resamplePoints:u}});t({stage:"resample",spines:r})},[n,t])}function lf(n,t){const o=(0,b.TL)();(0,c.useEffect)(()=>{const s=()=>{n(t)};return document.addEventListener(k.TV.FISHBONE_RESAMPLE_APPLY,s),()=>{document.removeEventListener(k.TV.FISHBONE_RESAMPLE_APPLY,s)}},[n,t]),(0,c.useEffect)(()=>{const s=()=>{o((0,j.fq)({mode:"none"}))};return document.addEventListener(k.TV.FISHBONE_RESAMPLE_CANCEL,s),()=>{document.removeEventListener(k.TV.FISHBONE_RESAMPLE_CANCEL,s)}},[o])}const df=[{key:"uniform",label:"Uniform"},{key:"adaptive",label:"Adaptive"},{key:"manual",label:"Manual"}];function uf(n){let{resampleStrategy:t,setResampleStrategy:o,resampleLogic:s}=n;const i=(0,ft.ib)(),r=(0,c.useCallback)(f=>{s(f,t)},[s,t]),{intervalComponent:a,toleranceComponent:l,resampleOptions:u}=(0,af.u)(r);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Ce.FormGroup,{children:(0,e.jsx)(Ce.ButtonGroup,{children:df.map(f=>(0,e.jsx)(Ce.Button,{text:f.label,onClick:()=>{o(f.key),s(u,f.key)},active:t===f.key},f.key))})}),t!=="manual"&&(0,e.jsx)(Ce.FormGroup,{label:t==="uniform"?"Interval between points (".concat(i,")"):"Max distance between points (".concat(i,")"),children:a}),t==="adaptive"&&(0,e.jsx)(Ce.FormGroup,{label:"Max Tolerance (".concat(i,")"),children:l})]})}function mf(n){let{spines:t,onFinish:o}=n;return(0,e.jsx)("div",{className:dn().actionRow,children:(0,e.jsx)(Ce.Button,{onClick:()=>o(t),text:t.length>1?"Apply to ".concat(t.length," Lines"):"Apply",intent:"primary",style:{marginTop:"auto"}})})}function ff(n){let{spines:t,onReset:o}=n;return(0,e.jsx)(e.Fragment,{children:t.length>0&&(0,e.jsx)(Ce.Button,{small:!0,minimal:!0,icon:"undo",title:"Back to spine drawing","aria-label":"Back to spine drawing",onClick:o})})}function hf(n){const{spines:t,setFishboneStage:o,onFinish:s}=n,[i,r]=(0,c.useState)("manual"),{clear:a}=(0,fn.c)(),l=(0,c.useCallback)(()=>{o({stage:"spine"}),a()},[o,a]),u=cf(t,o);return lf(s,t),(0,e.jsxs)("div",{className:"flex size-full flex-col justify-between",children:[(0,e.jsxs)("div",{className:"flex items-start justify-between",children:[(0,e.jsx)("h3",{className:"mb-3",children:"Cross Sections"}),(0,e.jsx)(ff,{spines:t,onReset:l})]}),(0,e.jsxs)("div",{className:"mb-2",children:[(0,e.jsx)("p",{children:"Click to add a vertex."}),t.length===1&&(0,e.jsx)("p",{children:"I + click to extend the spine."})]}),(0,e.jsx)("div",{children:(0,e.jsx)(uf,{resampleStrategy:i,setResampleStrategy:r,resampleLogic:u})}),(0,e.jsx)(mf,{spines:t,onFinish:s})]})}function gf(){return(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"mb-3",children:"Cross Sections"}),(0,e.jsxs)("p",{children:["Draw a line to define the cross section locations, then press ",(0,e.jsx)("b",{children:"Space"})," to proceed."]})]})}function pf(n){const{setFishboneStage:t}=n,o=(0,b.TL)(),s=jo(),i=To(),{clear:r}=(0,fn.c)(),a=(0,c.useCallback)(u=>{r();const f=[{lineId:"manual-".concat(Date.now()),drawnPoints:u,resamplePoints:u}];t({stage:"resample",spines:f})},[t,r]),l=(0,c.useCallback)(()=>{o((0,j.fq)({mode:"none"}))},[o]);return(0,c.useEffect)(()=>{const u=()=>{l()};return document.addEventListener(k.TV.FISHBONE_RESAMPLE_CANCEL,u),()=>{document.removeEventListener(k.TV.FISHBONE_RESAMPLE_CANCEL,u)}},[l]),(0,c.useEffect)(()=>(s((0,e.jsx)(gf,{})),()=>{s(null)}),[s]),(0,c.useEffect)(()=>(i(l),()=>{i(()=>{})}),[i,l]),(0,e.jsx)(Xm,{handleLineFinish:a,handleCancel:l})}function vf(n){const{allStencilSplines:t,createOnMoveEnd:o}=n,{snapper:s}=(0,xn.c4)(),i=(0,In.Z)({snapper:s}),r=(0,fo.Z)("i"),a=t.length===1,l=(0,c.useMemo)(()=>a?t[0].coords.map(f=>new m.Z(f.x,f.y,f.z)):[],[a,t]),u=(0,c.useCallback)((f,h)=>{const g=[...l];g.splice(f,0,h),o(0)(g)},[l,o]);return r&&a?(0,e.jsx)(Mo.Z,{points:l,width:2,onAddPoint:u,getDrawingData:i}):null}function xf(n){const{setFishboneStage:t,spines:o,onFinish:s}=n,i=(0,b.TL)(),r=jo(),a=To(),l=(0,c.useMemo)(()=>o.map((g,p)=>({id:"preview-fishbone-".concat(p),coords:g.resamplePoints.map(v=>({x:v.x,y:v.y,z:v.z}
247)),spine:g,index:p})),[o]),u=(0,c.useCallback)(g=>async p=>{const v=[...o];v[g]={...v[g],drawnPoints:p??[],resamplePoints:p},t({stage:"resample",spines:v})},[t,o]),f=(0,c.useCallback)(g=>async()=>{const p=o.filter((v,y)=>y!==g);p.length===0?i((0,j.fq)({mode:"none"})):t({stage:"resample",spines:p})},[t,o,i]),h=(0,c.useMemo)(()=>(0,e.jsx)(hf,{spines:o,setFishboneStage:t,onFinish:s}),[o,t,s]);return(0,c.useEffect)(()=>(r(h),()=>{r(null)}),[r,h]),(0,c.useEffect)(()=>(a(()=>{i((0,j.fq)({mode:"none"}))}),()=>{a(()=>{})}),[a,i]),(0,e.jsxs)(Kn.m_,{children:[l.map((g,p)=>(0,e.jsx)(of,{spline:g,color:p===0?Pe.Z.GREENYELLOW:Pe.Z.YELLOW,onMoveEnd:u(p),onDelete:f(p),renderItem:(v,y)=>(0,e.jsx)(nf,{points:v,trackedPoints:y})},g.id)),(0,e.jsx)(vf,{allStencilSplines:l,createOnMoveEnd:u})]})}function wr(n){const{initialLines:t,onFinish:o}=n,[s,i]=(0,c.useState)(!1),[r,a]=(0,c.useState)({stage:"spine"}),l=ef(),u=(0,b.TL)();switch((0,c.useEffect)(()=>{s||(t&&t.length>0?a({stage:"resample",spines:l(t)}):a({stage:"spine"}),i(!0))},[t,r,l,s]),(0,c.useEffect)(()=>(u((0,q.hZ)(r.stage==="spine")),()=>{u((0,q.hZ)(!1))}),[r,u]),r.stage){case"spine":return(0,e.jsx)(pf,{setFishboneStage:a});case"resample":return(0,e.jsx)(xf,{spines:r.spines,setFishboneStage:a,onFinish:o});default:(0,vo.Z)(r)}}var Rr=d(1112),Xn=d(95527),Io=d(95585),yf=d(85822),Or=d(58950);function bs(n){const t=[];for(const[o,s]of Object.entries(n)){if(s.inclusion!=="approved")continue;const i=(0,yf.Z)(o,s);if(i.featureClass==="object"){const{objectType:r,featureClass:a,...l}=i;r&&r in Eo.Zm&&t.push({name:o,type:r,prefill:l,featureClass:"object"})}else if(i.featureClass==="line"){const{lineType:r,featureClass:a,...l}=i;r&&r in ee.vl&&t.push({name:o,type:r,prefill:l,featureClass:"line"})}}return t}function Cf(n){var t;const o=(0,j.wR)(),s=(t=(0,j.vy)())===null||t===void 0?void 0:t.type,i=(0,j.Fc)();var r;const a=(0,Xn.ow)((r=i?.surveyId)!==null&&r!==void 0?r:""),l=a?bs(a.schema).filter(E=>E.featureClass==="object"):[];var u;const f=(0,Io.WT)((u=i?.surveyId)!==null&&u!==void 0?u:""),h=(0,Io.Pn)().filter(Eo.qP),g=(0,je.qe)(E=>E.attributeTemplateLayersExcluded);for(const E of l)E.disabled=g?.[E.name];const p=(0,je.qe)(E=>E.objectTypesExcluded),v=(0,Le.F5)(),y=E=>({name:Eo.Zm[E],type:E,disabled:p?.[E],featureClass:"object"}),S=[{group:"Layers",options:l.sort((E,Z)=>E.name.localeCompare(Z.name))}];return v==="Task"?S.push({group:"Task Objects",options:f.map(y).sort((E,Z)=>E.name.localeCompare(Z.name))}):S.push({group:"All Objects",options:h.map(y).sort((E,Z)=>E.name.localeCompare(Z.name))}),(0,e.jsx)(Or.ZP,{isOpen:n.isOpen,onClose:n.onClose,onChoose:E=>{let{type:Z,prefill:P}=E;n.onSelect(Z,P),n.onClose()},choiceName:"object",title:"Choose an object",types:S,mostUsed:o?y(o):void 0,lastUsed:s?y(s):void 0})}function Ef(){const n=(0,O.JH)(),t=(0,b.TL)();return(0,e.jsx)(Cf,{isOpen:n,onClose:()=>{t((0,O.Mr)())},onSelect:(o,s)=>{t((0,j.fq)({mode:"object-annotation",type:o,prefill:s}))}})}var Sf=Ef,Lr=d(79227);function jf(){const n=(0,le.Dv)(),[t]=(0,ur.Z)(),o=(0,xe.yX)();return(0,c.useCallback)((s,i,r,a)=>{var l,u;const f=o[s.projectFileId].visualizationMapping,h=[f.project_from_ecef_point(Ee.Z.multiplyByPoint((0,It.BY)(r),new m.Z(s.crossSectionPoint.x,s.crossSectionPoint.y,0),new m.Z(0,0,0)),new m.Z),f.project_from_ecef_point(Ee.Z.multiplyByPoint((0,It.BY)(a),i,new m.Z(0,0,0)),new m.Z)];var g,p;const v=n({coords:h.map(y=>({x:y.x,y:y.y,z:y.z})),isClosed:!1,width:(g=(l=s.prefill)===null||l===void 0?void 0:l.width)!==null&&g!==void 0?g:1,type:s.lineType,annotationLayerId:s.annotationLayerId,spec:{source:{type:"user",user:(p=t?.username)!==null&&p!==void 0?p:"Unknown"},...(u=s.prefill)===null||u===void 0?void 0:u.spec}},s.projectFileId);return{kind:"add-object",id:v.id,state:v}},[n,t,o])}function Tf(){const n=jf();return(0,c.useCallback)((t,o,s,i)=>{const r=[];for(let a=0;a<t.length;a++){const l=t[a];r.push(n(l,o["line-draft-".concat(a)].crossSectionPoint,s,i))}return r},[n])}function Ar(){const n=Bo(),t=Xa(),o=Ga(),s=ro(),i=Tf(),r=Qa(),a=$a(),l=(0,_t.I0)();return(0,c.useCallback)(async u=>{const{referenceIndex:f,referenceFrame:h,referenceLineIds:g,lineDrafts:p,cameraParams:v,fishbone:y,crossSectionIndex:S}=u,E=s(h.crossSection,g,p),Z=await n(y.crossSections[S],v),{inferenceResults:P,matchResults:U}=await t(h,Z,E),Y=o(Vo(Ya(U,(ie,Oe)=>g[ie]),ie=>ie.crossSectionPoint),y,S,v),se=i(p,U,h.crossSection,y.crossSections[S]),he=se.map(ie=>ie.id);r(S,U,he,{firstFrame:h,secondFrame:Z,inferenceResults:P}),a(f,he),l((0,Ue.u7)("match and update",[...Y,...se]))},[n,s,t,o,i,r,a,l])}function bf(){const n=(0,it.y2)(),t=(0,it.Wy)(),o=(0,it.AE)(),s=(0,q.nC)(),i=(0,q.p0)(),r=(0,q.Kq)(),a=(0,N.tD)(),l=Ar(),u=Bo(),f=ro(),h=ar(),g=Object.keys(t).length>0||o.length>0,p=r===null||n===-1||!g||s===null,v=(0,c.useCallback)(async()=>{try{if(p)return;const y=ko(a,Object.values(f(i.crossSections[n],t,o)));await h(i.crossSections[n]);const S=await u(i.crossSections[n],y);await h(i.crossSections[s]),await l({referenceIndex:n,referenceFrame:S,referenceLineIds:t,lineDrafts:o,cameraParams:y,fishbone:i,crossSectionIndex:s})}catch(y){console.error("Error during matching: ",y)}},[p,a,f,i,n,t,o,h,u,s,l]);return(0,e.jsx)(Ce.Button,{className:"w-full",text:"Run Linear E
247xtraction",icon:Ps,intent:"primary",disabled:p,onClick:v})}const Ps=(0,e.jsx)("img",{src:"/assets/images/icons/play-circle.svg",alt:"Play",height:20,width:20}),Dr=(0,e.jsx)("img",{src:"/assets/images/icons/pause-circle.svg",alt:"Pause",height:20,width:20});function Pf(){const{runLoop:n,cancelLoop:t,isRunning:o,isDisabled:s}=Fr();return(0,e.jsx)(e.Fragment,{children:o?(0,e.jsx)(Ce.Button,{className:"w-full",text:"Pause Linear Extraction",icon:Dr,intent:"danger",onClick:t}):(0,e.jsx)(Ce.Button,{className:"w-full",text:"Run Linear Extraction",icon:Ps,intent:"primary",disabled:s,onClick:()=>n(0)})})}function Zr(){const{runLoop:n,cancelLoop:t,isRunning:o,isDisabled:s}=Fr(),i=(0,q.nC)();return(0,e.jsx)(e.Fragment,{children:o?(0,e.jsx)(Ce.Button,{className:"w-full",text:"Pause Linear Extraction",icon:Dr,intent:"danger",onClick:t}):(0,e.jsx)(Ce.Button,{className:"w-full",text:"Run Linear Extraction",icon:Ps,intent:"primary",disabled:s,onClick:()=>n(i??0)})})}function Fr(){const[n,t]=(0,c.useState)(null),o=(0,it.y2)(),s=(0,it.Wy)(),i=(0,it.AE)(),r=(0,q.p0)(),a=(0,q.Kq)(),l=(0,q.nC)(),u=(0,b.TL)(),f=(0,N.tD)(),h=ro(),g=Bo(),p=Ar(),v=ar(),y=Object.keys(s).length>0||i.length>0,S=n!==null,E=a===null||o===-1||S||l===null||!y,Z=(0,c.useRef)({...s}),P=(0,c.useRef)([...i]);(0,c.useEffect)(()=>{Z.current={...s}},[s]),(0,c.useEffect)(()=>{P.current=[...i]},[i]);const U=(0,c.useCallback)(async se=>{if(E)return;const he=new AbortController;t(he);try{const ie=ko(f,Object.values(h(r.crossSections[o],Z.current,P.current)));await v(r.crossSections[o]);const Oe=await g(r.crossSections[o],ie);for(let ue=se;ue<r.crossSections.length;ue++){if(he.signal.aborted)throw new Error("Loop aborted");(0,N.e7)(r.crossSections[ue],Oe.crossSection)||(await v(r.crossSections[ue]),await p({referenceIndex:o,referenceFrame:Oe,referenceLineIds:Z.current,lineDrafts:P.current,cameraParams:ie,fishbone:r,crossSectionIndex:ue}),u((0,N.dA)(r.crossSections[ue],a,!0)))}}catch(ie){if(ie instanceof Error&&ie.message==="Loop aborted")return;console.error("Error during matching: ",ie)}finally{t(null)}},[E,r,f,h,o,g,v,p,u,a]),Y=(0,c.useCallback)(()=>{n&&n.abort()},[n]);return{runLoop:U,cancelLoop:Y,isRunning:S,isDisabled:E}}const Nr=[{value:"once",label:"Single"},{value:"all",label:"All"},{value:"continue",label:"Continue"}];function Mf(n){let{selectedRunOption:t}=n;switch(t){case"once":return(0,e.jsx)(bf,{});case"all":return(0,e.jsx)(Pf,{});case"continue":return(0,e.jsx)(Zr,{});default:return(0,e.jsx)(Zr,{})}}function If(){const[n,t]=(0,c.useState)("all"),o=Nr.find(s=>s.value===n);return(0,e.jsxs)("div",{className:"flex flex-row gap-2",children:[(0,e.jsx)("div",{className:"flex-1",children:(0,e.jsx)(Mf,{selectedRunOption:n})}),(0,e.jsx)(Lr.Z,{value:o,selectOptions:Nr,getOptionName:s=>s.label,onChange:s=>{s&&t(s.value)},defaultText:"Select Run Mode"})]})}function wf(){const n=(0,b.TL)(),t=(0,it.IG)(),o=(0,e.jsx)("img",{src:"/assets/images/icons/matcher-debug.svg",alt:"Matcher debug",height:20,width:20});return(0,e.jsx)(Ce.Button,{minimal:!0,icon:o,title:t?"Close Debug":"Debug",onClick:()=>n((0,it.L6)(!t))})}function Rf(){const[n,t]=(0,c.useState)(null),o=(0,b.TL)(),s=(0,q.nC)(),i=(0,T.sZ)(ti.arbRenKey),r=(0,tn.x)(),a=(0,j.Fc)(),l=a?.surveyId,u=(0,Xn.ow)(l??""),f=u?bs(u.schema).filter(g=>g.featureClass==="line"):[],h=!n||!l||s===null||!i||!r;return(0,e.jsxs)("div",{children:[!u&&(0,e.jsx)("p",{children:"Select an annotation layer to add a line."}),(0,e.jsxs)("div",{className:"flex flex-row gap-2",children:[(0,e.jsx)("div",{className:"flex-1",children:(0,e.jsx)(Lr.Z,{disabled:!u||!a,value:n??void 0,selectOptions:f,getOptionName:g=>{var p;return(p=g.name)!==null&&p!==void 0?p:""},onChange:g=>{t(g??null)},defaultText:"Select Line Type"})}),(0,e.jsx)(Ce.Button,{text:"Add Line",onClick:()=>{if(h){I.Z.show({message:"Please select an active layer and line type.",intent:"warning"});return}const g=i.camera.position,p=(0,It.Gr)(r),v=Ee.Z.multiplyByPoint(p,g,new m.Z);o((0,it.KP)({crossSectionPoint:{x:v.x,y:v.y},lineType:n.type,prefill:n.prefill,annotationLayerId:l,projectFileId:a.projectFileId},s))}})]})]})}function wn(n){const{text:t,icon:o,color:s}=n;return(0,e.jsxs)("div",{className:"flex flex-row",children:[(0,e.jsx)("div",{className:"size-4",style:{backgroundColor:s,mask:"url(
247/assets/images/icons/".concat(o,".svg)"),maskSize:"100%"}}),(0,e.jsxs)("p",{children:[": ",t]})]})}function Of(){return(0,e.jsxs)("div",{className:"p-2",children:[(0,e.jsx)(wn,{text:"Not used. Left click to set.",icon:"center-focus-strong",color:Kt.wR.UNSET}),(0,e.jsx)(wn,{text:"Intersection point. Right click to set.",icon:"matcher-intersection-point",color:Kt.wR.UNSET}),(0,e.jsx)(wn,{text:"Selected reference points.",icon:"center-focus-strong",color:Kt.wR.REFERENCE_POINT}),(0,e.jsx)(wn,{text:"Creating new line.",icon:"matcher-border",color:Kt.wR.REFERENCE_POINT}),(0,e.jsx)(wn,{text:"Set automatically.",icon:"center-focus-strong",color:Kt.wR.SET_AUTOMATICALLY}),(0,e.jsx)(wn,{text:"Missed.",icon:"center-focus-strong",color:Kt.wR.MISSED})]})}function Lf(){return(0,e.jsx)(Rr.p,{content:(0,e.jsx)(Of,{}),placement:"bottom-start",minimal:!0,children:(0,e.jsx)(Ce.Button,{minimal:!0,icon:(0,e.jsx)(Ce.Icon,{icon:"info-sign"}),title:"Show instructions"})})}function Af(){return(0,e.jsxs)("div",{className:"flex flex-col gap-2 pb-2",children:[(0,e.jsxs)("div",{className:"flex flex-row items-start justify-between gap-2",children:[(0,e.jsxs)("div",{className:"flex flex-row items-center gap-2",children:[(0,e.jsx)("h3",{children:"Marker Controls"}),(0,e.jsx)(Lf,{})]}),(0,e.jsx)(ls.default,{children:(0,e.jsx)(wf,{})})]}),(0,e.jsx)("p",{className:"mb-2",children:"Set reference points with existing lines, or create new lines."}),(0,e.jsx)(Rf,{}),(0,e.jsx)(If,{})]})}function Df(){return(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,e.jsx)("span",{children:"Linear Extraction"}),(0,e.jsx)(ci.default,{href:"https://app.arcade.software/share/loJ8z4sah4S2l4HASxMU",target:"_blank",rel:"noreferrer noopener",style:{color:"#48aff0",textDecoration:"none",fontSize:"12px",padding:"2px 6px",borderRadius:"3px",transition:"all 0.1s ease"},onMouseEnter:n=>{n.currentTarget.style.textDecoration="underline",n.currentTarget.style.backgroundColor="rgba(72, 175, 240, 0.1)"},onMouseLeave:n=>{n.currentTarget.style.textDecoration="none",n.currentTarget.style.backgroundColor="transparent"},children:"Tutorial"})]})}function Zf(){const[n,t]=(0,c.useState)(!0),o=(0,j.kb)(h=>h),s=(0,b.TL)(),i=jo(),r=To(),a=dr(),l=So(),u=(0,q.Kq)(),f=(0,c.useCallback)(h=>{if(h.length===0)return;const g=(0,Et.Jn)(h[0].resamplePoints.map(v=>({point:v,width:Et.kC}))),p=crypto.randomUUID();s((0,q.dr)(p,g,{type:"exclude-lines",excludedLineIds:q.FT})),t(!1),s((0,q.D4)(p)),s((0,N.dA)(g[0],p,!0)),l(g[0])},[s,l]);return(0,c.useEffect)(()=>{n&&u&&t(!1)},[u,n]),(0,c.useEffect)(()=>(a((0,e.jsx)(Df,{})),()=>{a(null)}),[a]),(0,c.useEffect)(()=>{if(!n)return i((0,e.jsx)(Af,{})),()=>{i(null)}},[i,n]),(0,c.useEffect)(()=>{if(!n)return r(()=>{s((0,j.fq)({mode:"none"})),u&&(s((0,q.$W)(u)),s((0,N.dA)(null)))}),()=>{r(()=>{})}},[n,s,r,u]),o.mode!=="matcher"?null:n?(0,e.jsx)(wr,{initialLines:o.initialLines,onFinish:f}):null}var Ff=d(7943);function Nf(n){var t,o;const{stencilConfigs:s,setStencilConfigs:i,globalExcludedLineIds:r}=n,a=s.length>1,l=s.length,u=(0,b.TL)(),f=fr(),h=(0,le.Qz)(),g=(0,le.vC)(),p=(0,ft.ib)(),v=(s==null||(o=s[0])===null||o===void 0||(t=o.pointsAndWidth[0])===null||t===void 0?void 0:t.width)||Et.kC,y=Number.parseFloat((0,rn.BI)(v,p,"m").toFixed(3)),S=(0,c.useCallback)(U=>{const Y=[];for(const se of U){const he=g.find(ie=>ie.id===se.id);he&&(h(se.id,{coords:se.coords}),Y.push({kind:"update-object",id:se.id,oldState:he}))}return Y},[g,h]),E=(0,c.useCallback)(U=>{const Y=(0,Et.Jn)(U.pointsAndWidth),{modifiedLines:se}=f(Y,U.excludedLineIds,r),he=S(se),ie=crypto.randomUUID();u((0,q.dr)(ie,Y,{type:"exclude-lines",excludedLineIds:U.excludedLineIds})),u((0,Ue.u7)("stencilized resample",he)),u((0,q.D4)(ie)),u((0,N.dA)(Y[0],ie)),u((0,j.fq)({mode:"none"}))},[u,S,f,r]),Z=(0,c.useCallback)(U=>{const Y=[],se=[];for(const ie of U)try{const Oe=(0,Et.Jn)(ie.pointsAndWidth),{modifiedLines:ue}=f(Oe,ie.excludedLineIds,r),De=S(ue);Y.push(...De)}catch(Oe){console.warn("Failed to process stencil ".concat(ie.lineId,":"),Oe),se.push(ie.lineId)}if(se.length>0){const{length:ie}=U,Oe=ie-se.length;I.Z.show({message:"Successfully processed ".concat(Oe," of ").concat(ie," stencils (").concat(se.length," failed)"),intent:se.length===ie?"danger":"warning"})}const he=Array.from(new Map(Y.filter(ie=>ie.kind==="update-object").map(ie=>[ie.id,ie])).values());u((0,Ue.u7)("multi-stencil resample",he)),u((0,j.fq)({mode:"none"}))},[u,S,f,r]),P=(0,c.useCallback)(()=>{s.length===1?E(s[0]):Z(s)},[s,E,Z]);return(0,c.useEffect)(()=>(document.addEventListener(k.TV.STENCILIZED_RESAMPLE_EXPANSE_APPLY,P),()=>{document.removeEventListener(k.TV.STENCILIZED_RESAMPLE_EXPANSE_APPLY,P)}),[P]),(0,c.useEffect)(()=>{const U=()=>{u((0,j.fq)({mode:"none"}))};return document.addEventListener(k.TV.STENCILIZED_RESAMPLE_EXPANSE_CA
247NCEL,U),()=>{document.removeEventListener(k.TV.STENCILIZED_RESAMPLE_EXPANSE_CANCEL,U)}},[u]),(0,e.jsxs)("div",{className:"flex size-full flex-col justify-between",children:[(0,e.jsxs)("div",{children:[a&&(0,e.jsx)("div",{className:"mb-3 rounded-md border border-border bg-bg-secondary p-2",children:(0,e.jsxs)("span",{className:"text-body-medium text-text-secondary",children:["\u2713 Applying width settings to ",l," stencils (same width per stencil, configurable per cross-section)"]})}),(0,e.jsx)(Ce.FormGroup,{label:"Window Width (".concat(p,")"),children:(0,e.jsx)(Ff.K,{min:Number.parseFloat((0,rn.BI)(.1,p,"m").toFixed(3)),max:Number.parseFloat((0,rn.BI)(50,p,"m").toFixed(3)),initialValue:y,stepSize:.1,onChange:U=>{const Y=(0,rn.BI)(U,"m",p),se=s.map(he=>({...he,pointsAndWidth:he.pointsAndWidth.map(ie=>({...ie,width:Y}))}));return i(se),U}})})]}),(0,e.jsxs)("div",{className:dn().actionRow,children:[(0,e.jsx)(Ce.Button,{onClick:P,text:a?"Apply to ".concat(l," Stencils"):"Apply Width",intent:"primary"}),(0,e.jsx)(Ce.Button,{icon:"trash",intent:"danger",minimal:!0,outlined:!0,onClick:()=>{u((0,j.fq)({mode:"none"}))}})]})]})}const Bf=new eo.Z({flat:!0});Bf._renderState.depthTest.enabled=!1;const kf=new Pe.Z(29/256,163/256,243/256,.5);function Vf(n){const{crossSections:t,globalExcludedLineIds:o}=n,s=fr(),i=(0,c.useMemo)(()=>s(t,void 0,o).newStretches,[t,s,o]);return(0,e.jsx)(pn.At,{ranges:i,width:pn.Y5,color:kf})}function Uf(n){const{stencilConfigs:t,setStencilConfigs:o,globalExcludedLineIds:s}=n,i=(0,b.TL)(),r=jo(),a=To(),l=(0,c.useMemo)(()=>t.map((h,g)=>{const p=(0,Et.Jn)(h.pointsAndWidth),v=h.pointsAndWidth.map(y=>y.point);return{crossSections:p,polylinePositions:v,config:h,index:g}}),[t]),u=(0,c.useMemo)(()=>new Ln.Z(Pe.Z.GREENYELLOW),[]),f=(0,c.useMemo)(()=>new Ln.Z(Pe.Z.YELLOW),[]);return(0,c.useEffect)(()=>(r((0,e.jsx)(Nf,{stencilConfigs:t,setStencilConfigs:o,globalExcludedLineIds:s})),()=>{r(null)}),[r,t,o,s]),(0,c.useEffect)(()=>(a(()=>{i((0,j.fq)({mode:"none"}))}),()=>{a(()=>{})}),[i,a]),(0,e.jsx)(e.Fragment,{children:l.map((h,g)=>(0,e.jsxs)(me.JH,{children:[(0,e.jsx)(me.qz,{positions:h.polylinePositions,material:g===0?u:f,width:g===0?4:3,depthFailMaterial:g===0?u:f}),(0,e.jsx)(sf,{crossSections:h.crossSections}),(0,e.jsx)(Vf,{crossSections:h.crossSections,globalExcludedLineIds:s})]},"stencil-".concat(g)))})}function Wf(){const[n,t]=(0,c.useState)([]),[o,s]=(0,c.useState)({}),[i,r]=(0,c.useState)(!1),a=(0,j.kb)(S=>S),{setCallbacks:l}=(0,gr.dr)(),u=dr(),f=a.mode==="stencilized-resample"?a.initialLines:void 0,h=(0,c.useCallback)(S=>{const E=S.map(Z=>({lineId:Z.lineId,pointsAndWidth:Z.resamplePoints.map(P=>({point:P,width:Et.kC})),excludedLineIds:{}}));t(E),r(!0)},[t]),g=(0,c.useCallback)(S=>{const E={...o,[S]:!0},Z=n.map(P=>({...P,excludedLineIds:{...P.excludedLineIds,[S]:!0}}));s(E),t(Z)},[n,t,o,s]),p=(0,c.useCallback)(S=>{const E={...o};delete E[S];const Z=n.map(U=>U.lineId),P=n.map(U=>{const Y={...U.excludedLineIds};return(!Z.includes(S)||U.lineId===S)&&delete Y[S],{...U,excludedLineIds:Y}});s(E),t(P)},[n,t,o,s]),v=(0,c.useCallback)(S=>{const Z=n.map(se=>se.lineId).includes(S);if(!o[S]){const se={...o,[S]:!0},he=n.map(ie=>({...ie,excludedLineIds:{...ie.excludedLineIds,[S]:!0}}));s(se),t(he);return}const U={...o};if(delete U[S],Z){const se=n.map(he=>{const ie={...he.excludedLineIds};return he.lineId===S&&delete ie[S],{...he,excludedLineIds:ie}});s(U),t(se);return}const Y=n.map(se=>{const he={...se.excludedLineIds};return delete he[S],{...se,excludedLineIds:he}});s(U),t(Y)},[o,n,t,s]),y=(0,c.useCallback)(()=>{const S=n.map(P=>P.lineId),E=new Set(S),Z=n.map(P=>{const U={};for(const Y of E)Y!==P.lineId&&(U[Y]=!0);return{...P,excludedLineIds:U}});s(q.FT),t(Z)},[n,t,s]);return(0,c.useEffect)(()=>{const S=i?"expanse":"fishbone";return document.body.setAttribute("data-stage",S),()=>{document.body.removeAttribute("data-stage")}},[i]),(0,c.useEffect)(()=>(u("Stencilized Resample"),()=>{u(null)}),[u]),(0,c.useEffect)(()=>{if(!i){l(null);return}return l({excludeLine:g,includeLine:p,toggleLineExclusion:v,clearLineExclusion:y}),()=>{l(null)}},[i,l,g,p,v,y]),i?(0,e.jsx)(Uf,{stencilConfigs:n,setStencilConfigs:t,globalExcludedLineIds:o}):(0,e.jsx)(wr,{initialLines:f,onFinish:h})}const Br=.25;function kr(n,t){const o=(0,Xe.iC)(n,t,{type:"LowestPoint"});if(o)return o.drapedPoint}function zf(n){const{handleLineFinish:t,handleLineInProgress:o,handleCancel:s,snapToGround:i,initialPoint:r}=n,{camera:a,scene:l,viewer:u}=(0,me.VQ)(),[f,h]=(0,c.useState)(r??null),g=(0,c.useRef)(r??null),p=(0,c.useRef)(null),v=i,[y,S]=(0,nr.b)(),E=n.color||Pe.Z.GREEN,Z=(0,c.useMemo)(()=>new Tr.Z({color:E,dashLength:16}),[E]),{snapper:P}=(0,xn.c4)(),U=(0,In.Z)({snapper:P}),Y=(0,js.lT)(),se=(0,c.useCallback)(()=>
247{if(g.current&&v&&l){var He;return(He=kr(g.current,l))!==null&&He!==void 0?He:null}else return p.current},[v,l]),he=(0,c.useCallback)(async He=>{const Ne=U(He);if(f){if(Ne){const Ie={start:f,end:Ne.position};g.current=null,p.current=null,h(null),t&&t(Ie)}}else{if(v&&Ne&&u){const Ie=kr(Ne.position,u.scene);if(!Ie)return;const Ke={start:Ne.position,end:Ie};g.current=null,p.current=null,h(null),t&&t(Ke);return}Ne&&h(Ne.position)}},[f,U,t,v,u]);(0,qe.sC)("onClick",he);const ie=(0,c.useCallback)(He=>{const Ne=U(He);if(Ne)if(Y(Ne.snappedWith),!f)g.current=Ne.position;else{const Ie=Ne.position;p.current=Ie,o&&o({start:f,end:Ne.position})}},[f,U,o,Y]);(0,qe.sC)("onMouseMove",ie);const Oe=(0,c.useMemo)(()=>{const He=new mt.Z(()=>g.current||m.Z.ZERO,!1);return(0,e.jsx)(me.JH,{position:He,children:(0,e.jsx)(me.l7,{color:E,pixelSize:10})})},[E]),ue=(0,c.useMemo)(()=>{const He=new mt.Z(()=>{var ae;return(ae=se())!==null&&ae!==void 0?ae:m.Z.ONE},!1),Ne=new mt.Z(()=>{const ae=se();return ae?Dt.Z.fromCartesian(ae).height:0},!1),Ie=new Pe.Z(E.red,E.green,E.blue,.8),Ke=new mt.Z(()=>{const ae=se();return ae&&g.current?"".concat(y(m.Z.distance(g.current,ae),1)," ").concat(S):""},!1),et=new mt.Z(()=>{const ae=se();return ae&&g.current?m.Z.midpoint(ae,g.current,new m.Z):m.Z.ONE},!1);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(me.JH,{position:He,children:(0,e.jsx)(me.l7,{color:Ie,pixelSize:10})}),(0,e.jsx)(me.JH,{position:He,children:(0,e.jsx)(me.qq,{height:Ne,semiMajorAxis:Br,semiMinorAxis:Br,fill:!1,outlineColor:E,outline:!0,outlineWidth:4})}),(0,e.jsx)(me.JH,{position:et,children:(0,e.jsx)(me.az,{text:Ke,font:"14px Inter",fillColor:Pe.Z.BLACK,backgroundColor:E,showBackground:!0,eyeOffset:lt.dU,scaleByDistance:lt.Wr})})]})},[E,se,y,S]),De=(0,c.useMemo)(()=>{const He=new mt.Z(()=>{const Ne=se();return Ne?[g.current,Ne]:[m.Z.UNIT_X,m.Z.ONE]},!1);return(0,e.jsx)(me.JH,{children:(0,e.jsx)(me.qz,{positions:He,material:Z,width:lt.v})})},[Z,se]),Qe=(0,c.useMemo)(()=>(0,e.jsx)(Gt.Z,{callback:He=>{s&&He.key==="Escape"&&s()}}),[s]);return(0,e.jsxs)(e.Fragment,{children:[Oe,De,ue,Qe]})}var wo=zf;function Hf(){const n=(0,_t.I0)(),t=(0,j.kb)(i=>i),o=(0,c.useCallback)(i=>{t.mode==="measurement-angle"&&(t.phase==="drawing-first-line"?n((0,j.fq)({mode:"measurement-angle",phase:"drawing-second-line",firstLine:i})):t.phase==="drawing-second-line"&&t.firstLine&&(n((0,Tt.Lf)((0,Ct.M)(t.firstLine.start),(0,Ct.M)(t.firstLine.end),(0,Ct.M)(i.start),(0,Ct.M)(i.end))),n((0,j.fq)({mode:"none"}))))},[n,t]),s=(0,c.useCallback)(()=>{n((0,j.fq)({mode:"none"}))},[n]);return t.mode!=="measurement-angle"?null:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(wo,{handleLineFinish:o,handleCancel:s,color:lt.K8,snapToGround:!1}),(0,e.jsx)(Gt.Z,{callback:i=>{i.key==="Escape"&&n((0,j.fq)({mode:"none"}))}})]})}var Kf=Hf,Ro=d(70876);function Gf(n){const{snapper:t}=(0,xn.c4)({initialVertices:n});return(0,In.Z)({snapper:t})}var Vr=d(30774),Ur=d(52274),Wr=d(69370);function _f(){const n=(0,b.TL)(),t=(0,j.kb)(P=>P.mode==="arc"?P:null),o=t?.lineId,s=(0,le.UM)(o??""),i=(0,le.Qz)();var r;const a=(0,xe.OL)((r=s?.projectFileId)!==null&&r!==void 0?r:""),l=(0,Ro.Z)(s);var u,f;const h=(f=(0,Xn.ow)((u=s?.annotationLayerId)!==null&&u!==void 0?u:""))!==null&&f!==void 0?f:Wr.b5;var g;const p=(0,Vr.ge)(s?(g=(0,Ur.Ph)(s,h))!==null&&g!==void 0?g:s.type:"Line"),v=(0,c.useMemo)(()=>!s||!a?[]:s.coords.map(P=>{let{x:U,y:Y,z:se}=P;return a.ecef_from_project_point(new m.Z(U,Y,se))}),[s,a]),y=Gf(v),S=(0,c.useCallback)((P,U)=>{if(!s||!a)return;const Y=[...v];Y.splice(P,0,U),n((0,Ue.tR)(s.id,s)),i(s.id,{coords:Y.map(se=>a.project_from_ecef_point(se)).map(se=>({x:se.x,y:se.y,z:se.z}))})},[v,s,a,n,i]),E=(0,c.useCallback)((P,U,Y)=>{if(!s||!a)return;const se=[...v];se.splice(P,0,...U),n((0,Ue.tR)(s.id,s)),i(s.id,{coords:se.map(he=>a.project_from_ecef_point(he)).map(he=>({x:he.x,y:he.y,z:he.z}))})},[v,s,a,n,i]),Z=(0,c.useMemo)(()=>({settings:p,onAddPoints:E}),[p,E]);return!s||!a||!t||!l?null:(0,e.jsx)(Mo.Z,{points:v,width:5,onAddPoint:S,getDrawingData:y,circle:Z})}var Yf=_f;function Jf(){const n=(0,_t.I0)(),t=(0,c.useCallback)(i=>{n((0,j.fq)({mode:"measurement-area",measurement:null}))},[n]),o=(0,c.useCallback)(()=>{n((0,j.fq)({mode:"none"}))},[n]),s=(0,c.useCallback)(async(i,r)=>
247{n((0,Tt.Ce)(i.map(Ct.M))),n((0,j.fq)({mode:"none"}))},[n]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Yn.Z,{color:lt.K8,onMouseMove:t,handleLineFinish:s,handleCancel:o,drawType:"polygon"}),(0,e.jsx)(Gt.Z,{callback:i=>{i.key==="Escape"&&n((0,j.fq)({mode:"none"}))}})]})}var Xf=Jf;const zr=.5;function Qf(n){const{interactionState:t}=n,o=(0,_t.I0)(),s=(0,c.useRef)(null),{projectFileId:i,pageNumber:r}=t,{imageProperty:a,aspectRatio:l}=vs(i,Pe.Z.WHITE,zr),u=(0,c.useRef)(null),f=(0,c.useMemo)(()=>{const S=()=>s.current||m.Z.ONE,E=()=>10,Z=()=>0;return(0,e.jsx)(_i,{ref:u,location:S,width:E,rotation:Z,image:a,aspectRatio:l})},[l,a]),{camera:h,globe:g,scene:p}=(0,me.VQ)(),v=(0,c.useCallback)(S=>{if(!h||!g||!p)return;const E=h.getPickRay(S.mousePosition);if(!E)return;const Z=g.pick(E,p);Z&&(s.current=Z)},[h,g,p]);(0,qe.sC)("onMouseMove",v);const y=(0,c.useCallback)(S=>{if(!h||!g||!p)return;const E=h.getPickRay(S.mousePosition);if(!E)return;const Z=g.pick(E,p);if(!Z)return;const P=Dt.Z.fromCartesian(Z),U=o((0,Ut.JN)({projectFileId:i,pageNumber:r,coordinates:[P.longitude,P.latitude],height:P.height,width:100,rotation:0,opacity:zr}));o((0,je.QU)(U.payload.id,!0)),o((0,j.fq)({mode:"none"}))},[h,g,p,o,i,r]);return(0,qe.sC)("onClick",y),(0,e.jsxs)(e.Fragment,{children:[f,(0,e.jsx)(Gt.Z,{callback:S=>{S.key==="Escape"&&o((0,j.fq)({mode:"none"}))}})]})}var $f=Qf,qf=d(72207),Ms=d(26822),eh=d(84015);function Dp(n,t,o){const s=Cartesian3.subtract(o,t,new Cartesian3);switch(n.type){case"object":return Cartesian3.add(t,s,new Cartesian3);case"line":return n.ecefCoords.map(i=>Cartesian3.add(i,s,new Cartesian3))}}function Hr(n,t,o){const s=m.Z.subtract(o,t,new m.Z);return n.ecefCoords.map(i=>m.Z.add(i,s,new m.Z))}function Kr(n,t,o){const s=m.Z.subtract(o,t,new m.Z);return m.Z.add(n.ecefPosition,s,new m.Z)}function th(n){const{mousePosition:t,clipboardLine:o,originalEcefPosition:s}=n,i=(0,c.useCallback)(f=>Hr(o,s,f),[o,s]),r=(0,c.useCallback)((f,h)=>{f.set(m.Z.ZERO)},[]),a=(0,nt.QV)(t,i,r),l=(0,c.useMemo)(()=>{var f;return(0,No.Z)({type:o.featureType,spec:(f=o.prefill.spec)!==null&&f!==void 0?f:{}})},[o]),u=(0,eh.Z)(l?.color,Pe.Z.YELLOW);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(bn.H8,{points:a,color:u,width:2,show:!0,readonly:!0,id:"preview-line"}),(0,e.jsx)(Pn.m,{trackedPositions:a,color:u,isReadonly:!0,lineId:"preview-line"})]})}function nh(n){const{originalObject:t,objectCuboid:o,representation:s}=n,i=(0,Ms.b2)(o,s.exportPosition),r=(0,Ms.xf)(t);return(0,e.jsx)(Ms.by,{exportPositionCuboid:i,id:t.id,eventHandlers:{},show:!0,color:r})}function oh(n){const{mousePosition:t,clipboardObject:o,originalEcefPosition:s}=n,i=(0,xe.OL)(o.projectFileId),r=(0,le.FU)(o.originalFeatureId),a=(0,or.n)(r?[r]:[]),l=r?a[r.id]:void 0,u=(0,nt.LD)(t,g=>Kr(o,s,g),()=>m.Z.ZERO),f=(0,c.useMemo)(()=>{if(!i||!r)return null;const g=(0,Co._H)(r,i);return{position:u,orientation:g.orientation,dimensions:g.dimensions}},[u,i,r]);if(!r||!l||!f)return null;const h=(0,qf.Z)(r);return(0,e.jsxs)(e.Fragment,{children:[l.modelUri&&(0,e.jsx)(Co.e,{cuboid:f,onUpdate:()=>{},display:h,id:r.id,show:!0,readonly:!0}),l.exportPosition&&(0,e.jsx)(nh,{originalObject:r,objectCuboid:f,representation:l})]})}function sh(){const n=(0,_t.I0)(),t=(0,j.kb)(p=>p.mode==="paste-annotations"?p:null),o=(0,J.zi)(),s=(0,w.Eg)(),{snapper:i}=(0,xn.c4)(),r=(0,In.Z)({snapper:i}),a=(0,nt.ZP)(m.Z.ONE),l=(0,js.lT)(),u=(0,c.useCallback)(p=>{if(!t)return;const v=r(p);v?.position&&(a.set(v.position),l(v?.snappedWith))},[r,a,t,l]),f=(0,c.useCallback)(p=>{if(!t)return;const v=r(p);if(v?.position)for(const E of t.originalFeatures)switch(E.type){case"object":{const Z=Kr(E,t.ecefClipboardOrigin,v.position);var y;o(Z,E.featureType,E.projectFileId,(y=E.annotationLayerId)!==null&&y!==void 0?y:null,E.prefill);break}case"line":{const Z=Hr(E,t.ecefClipboardOrigin,v.position);var S;s(Z,E.featureType,E.projectFileId,(S=E.annotationLayerId)!==null&&S!==void 0?S:null,E.prefill);break}}n((0,j.fq)({mode:"none"}))},[r,t,s,o,n]);(0,qe.sC)("onMouseMove",u),(0,qe.sC)("onClick",f);const h=t?.originalFeatures.filter(p=>p.type==="object"),g=t?.originalFeatures.filter(p=>p.type==="line");return t?.ecefClipboardOrigin?(0,e.jsxs)(e.Fragment,{children:[h?.map(p=>(0,e.jsx)(oh,{mousePosition:a,clipboardObject:p,originalEcefPosition:t.ecefClipboardOrigin},p.originalFeatureId)),g?.map(p=>(0,e.jsx)(th,{mousePosition:a,clipboardLine:p,originalEcefPosition:t.ecefClipboardOrigin},p.originalFeatureId)),(0,e.jsx)(Gt.Z,{callback:p=>{p.key==="Escape"&&n((0,j.fq)({mode:"none"}))}})]}):null}function Gr(n,t){const o=m.Z.midpoint(n,t,new m.Z),s=m.Z.subtract(t,n,new m.Z),i=On.Z.WGS84.geodeticSurfaceNormal(o),r=m.Z.normalize(m.Z.cross(i,s,new m.Z),new m.Z);return{origin:o,normal:r,windowWidth:m.Z.magnitude(s)}}function ih(){const n=(0,b.TL)(),t=(0,c.useCallback)(s=>
247{const i=Gr(s.start,s.end);n((0,N.dA)(i)),n((0,j.fq)({mode:"none"}))},[n]),o=(0,c.useCallback)(()=>{n((0,j.fq)({mode:"none"}))},[n]);return(0,e.jsx)(wo,{handleLineInProgress:s=>{},handleLineFinish:t,handleCancel:o,color:Pe.Z.GREENYELLOW,snapToGround:!1})}function rh(){const n=(0,_t.I0)(),t=(0,c.useCallback)(i=>{},[]),o=(0,c.useCallback)(()=>{n((0,j.fq)({mode:"none"}))},[n]),s=(0,c.useCallback)(async(i,r)=>{n((0,j.fq)({mode:"none"}));const a=new Set(r.targetTilesetIds),l=a.values().next().value;if(a.size===1&&l)n((0,ye.BN)(!0)),n((0,ye.MA)(i.map(u=>(0,Bt.Wp)(u)))),n((0,ye.FX)(l));else{I.Z.show({intent:"danger",message:"DTM Boundary must be on a single dataset; points were found on ".concat(a.size," datasets. Please try again")});return}},[n]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Yn.Z,{color:lt.K8,onMouseMove:t,handleLineFinish:s,handleCancel:o,drawType:"polygon"}),(0,e.jsx)(Gt.Z,{callback:i=>{i.key==="Escape"&&n((0,j.fq)({mode:"none"}))}})]})}function ah(n){const{snapper:t}=(0,xn.c4)({initialVertices:n});return(0,In.Z)({snapper:t})}var Is=d(77894),ch=d(37492);function lh(){var n;const t=(0,b.TL)(),o=(0,j.kb)(Ge=>Ge.mode==="extending"?Ge:null),s=o?.lineId,i=(0,le.UM)(s??""),r=(0,le.Qz)();var a;const l=(0,xe.OL)((a=i?.projectFileId)!==null&&a!==void 0?a:""),u=(0,Ro.Z)(i),f=(0,ch.w)();var h,g;const p=(g=(0,Xn.ow)((h=i?.annotationLayerId)!==null&&h!==void 0?h:""))!==null&&g!==void 0?g:Wr.b5;var v;const y=(0,Vr.ge)(i?(v=(0,Ur.Ph)(i,p))!==null&&v!==void 0?v:i.type:"Line"),S=(0,c.useMemo)(()=>!i||!l?[]:i.coords.map(Ge=>{let{x:tt,y:gt,z:ut}=Ge;return l.ecef_from_project_point(new m.Z(tt,gt,ut))}),[i,l]),[E,Z]=(0,c.useState)(S.length),P=ah(S),[U,Y]=(0,c.useState)(null),se=(0,c.useMemo)(()=>{if(U!==null)return{endpointIndex:U,allCoords:S}},[U,S]),he=(0,En.ye)("useMagicPencil",!1),{config:ie}=(0,Is.w$)(),Oe=(0,c.useCallback)((Ge,tt)=>{if(!i||!l)return;const gt=[...S];gt.splice(tt.insertIndex,0,...Ge),t((0,Ue.tR)(i.id,i)),r(i.id,{coords:gt.map(ut=>l.project_from_ecef_point(ut)).map(ut=>({x:ut.x,y:ut.y,z:ut.z}))})},[S,i,l,t,r]);var ue,De,Qe,He;const{suggestions:Ne,onVertexPlaced:Ie,isExtendingFromStart:Ke,onAcceptPartialSuggestions:et}=(0,Is.RZ)({currentVertices:S,annotationLayerId:(ue=i?.annotationLayerId)!==null&&ue!==void 0?ue:"",projectFileId:(De=i?.projectFileId)!==null&&De!==void 0?De:"",lineId:i?.id,lineType:(Qe=i?.type)!==null&&Qe!==void 0?Qe:"",lineIntrinsicProperties:(He=i==null||(n=i.spec)===null||n===void 0?void 0:n.intrinsicProperties)!==null&&He!==void 0?He:{},bidirectional:se,onAcceptSuggestions:Oe,enabled:he}),ae=(0,c.useCallback)(Ge=>{Y(Ge)},[]);(0,c.useEffect)(()=>{if(S.length!==E&&(Z(S.length),S.length<E&&U!==null&&S.length>0)){const Ge=U===0?S[0]:S[S.length-1];Ie(Ge)}},[S.length,E,U,S,Ie]);const $e=(0,c.useCallback)((Ge,tt,gt)=>{if(!i||!l)return;const ut=[...S];ut.splice(Ge,0,tt),t((0,Ue.tR)(i.id,i)),r(i.id,{coords:ut.map(wt=>l.project_from_ecef_point(wt)).map(wt=>({x:wt.x,y:wt.y,z:wt.z}))}),Ie(tt)},[S,i,l,t,r,Ie]),Je=(0,c.useCallback)((Ge,tt,gt)=>{if(!i||!l)return;const ut=[...S];ut.splice(Ge,0,...tt),t((0,Ue.tR)(i.id,i)),r(i.id,{coords:ut.map(wt=>l.project_from_ecef_point(wt)).map(wt=>({x:wt.x,y:wt.y,z:wt.z}))})},[S,i,l,t,r]),xt=(0,c.useMemo)(()=>{if(f)return{settings:y,onAddPoints:Je}},[f,y,Je]);return(0,br._)(),(0,c.useEffect)(()=>{const Ge=()=>{const tt=new CustomEvent(k.TV.TOOL_CANCEL);document.dispatchEvent(tt)};return document.addEventListener(k.TV.LINE_FINISH,Ge),()=>{document.removeEventListener(k.TV.LINE_FINISH,Ge)}},[]),(0,c.useEffect)(()=>{const Ge=()=>{const tt=new CustomEvent(pe._r.UNDO);document.dispatchEvent(tt)};return document.addEventListener(k.TV.LINE_UNDO_POINT,Ge),()=>{document.removeEventListener(k.TV.LINE_UNDO_POINT,Ge)}},[]),!i||!l||!o||!u?null:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Mo.Z,{points:S,width:5,onAddPoint:$e,getDrawingData:P,circle:xt,onEndpointChange:ae}),Ne&&(0,e.jsx)(Is.wd,{suggestions:Ne,currentVertices:S,config:ie,isExtendingFromStart:Ke,onAcceptPartialSuggestions:et})]})}var dh=lh,uh=d(5042),mh=d(50938),fh=d(66586);function hh(n,t){const o=Dt.Z.fromCartesian(n),s=Dt.Z.fromCartesian(t);return new uh.Z(o,s).startHeading}function gh(n,t){const o=Dt.Z.fromCartesian(n),s=180/Math.PI*o.latitude,i=180/Math.PI*o.longitude,r=hh(n,t),a=new URLSearchParams;a.set("api","1"),a.set("map_action","pano"),a.set("viewpoint","".concat(s,",").concat(i)),a.set("heading","".concat(r*(180/Math.PI))),window.open("https://www.google.com/maps/@?".concat(a.toString()),"_blank")}function ph(n){const t=(0,_t.I0)(),o=(0,ct.S1)(),s=(0,xe.yX)(),{camera:i}=(0,me.VQ)(),r=(0,c.useCallback)(async(a,l)=>{if(!l.target.pointCloudFileId)return;const u=s[l.target.pointCloudFileId];u&&(i&&(n.forceStreetView||u.spline.segments.length===0)?gh(i.position,a):(o||t((0,
247ct.tu)("image")),t((0,ct.l8)(0,u.fileId,u.calibration)),(0,mh.Z)(t,a,u,void 0)),t((0,j.fq)({mode:"none"})))},[t,s,o,n.forceStreetView,i]);return(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(fh.Z,{handleFinish:r,handleCancel:()=>t((0,j.fq)({mode:"none"}))})})}var vh=d(42536);function xh(n){var t;const o=(0,vh.Z)(n);var s;const i=(0,le.FU)((s=n?.objectId)!==null&&s!==void 0?s:"");var r;const a=(t=(0,xe.J5)((r=i?.projectFileId)!==null&&r!==void 0?r:""))===null||t===void 0?void 0:t.visualizationMapping;return(0,c.useCallback)((l,u)=>{if(!a||!i)return;const f=m.Z.subtract(u,l,new m.Z),h=a.project_from_ecef_vector(f),g=jt.Z.fromQuaternion(new Vt.Z(i.rotationX,i.rotationY,i.rotationZ,i.rotationW)),p=jt.Z.multiplyByVector(g,new m.Z(0,0,1),new m.Z),v=m.Z.dot(h,p);o(Number(v.toFixed(2)))},[a,i,o])}function yh(n){const t=(0,b.TL)(),o=xh(n.pasteSpec),s=(0,c.useCallback)(a=>{t((0,j.fq)({mode:n.measurementType,measurement:(0,tr.Z)(a.start,a.end),pasteSpec:n.pasteSpec}))},[t,n.measurementType,n.pasteSpec]),i=(0,c.useCallback)(a=>{o(a.start,a.end),t((0,Tt.zq)((0,Ct.M)(a.start),(0,Ct.M)(a.end))),t((0,j.fq)({mode:"none"}))},[t,o]),r=(0,c.useCallback)(()=>{t((0,j.fq)({mode:"none"}))},[t]);return(0,e.jsx)(wo,{handleLineInProgress:s,handleLineFinish:i,handleCancel:r,color:lt.K8,snapToGround:n.measurementType==="measurement-height",initialPoint:n.initialPoint?(0,Bt.Rb)(n.initialPoint):void 0})}var Ch=yh,Eh=d(78600);function Sh(){const n=(0,j.kb)(g=>g.mode==="merging"?g:null),t=n?.lineId,o=(0,le.UM)(t??"");var s;const i=(0,xe.OL)((s=o?.projectFileId)!==null&&s!==void 0?s:""),r=(0,Ro.Z)(o),a=(0,c.useMemo)(()=>!o||!i?[]:o.coords.map(g=>{let{x:p,y:v,z:y}=g;return i.ecef_from_project_point(new m.Z(p,v,y))}),[o,i]),{isTargetSplineInMergeMode:l,mergeGetDrawingData:u,fixedSourceEndpoint:f,handleAddMergePoint:h}=(0,Eh.S)(o);return!o||!i||!n||!l||!r?null:(0,e.jsx)(Mo.Z,{points:a,width:5,onAddPoint:h,getDrawingData:u,fixedSourceEndpoint:f})}var jh=Sh;function Th(){const n=(0,b.TL)(),t=(0,c.useCallback)(()=>{n((0,j.fq)({mode:"none"}))},[n]);return(0,c.useEffect)(()=>(I.Z.show({message:"Picking a parent feature. Press ESC to cancel.",intent:"primary",timeout:-1,onDismiss:t},"pick-id-notification"),()=>{I.Z.dismiss("pick-id-notification")}),[t]),null}var _r=d(70455);function bh(n){const t=new Map;for(const[o,s]of n){const i=t.get(o);i?i.push(s):t.set(o,[s])}return t}function Ph(n,t){let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const r=t[s].x,a=t[s].y,l=t[i].x,u=t[i].y;a>n.y!=u>n.y&&n.x<(l-r)*(n.y-a)/(u-a)+r&&(o=!o)}return o}function Mh(n,t){const o=[];for(const[s,i]of n.imagesByCamera)for(let r=0;r<i.length;r++)Ph(i[r].properties,t)&&o.push(i[r].viewportName());if(o.length===0)throw new Error("No viewports selected");return o}function Ih(n,t){const o=n.visualizationMapping.ecef_from_project_point(m.Z.divideByScalar(t.reduce((a,l)=>m.Z.add(l,a,a),m.Z.ZERO.clone()),t.length,new m.Z)),s=n.getPossibleViewsOfPosition(o);return[...bh(s.map(a=>[a.cameraName,a])).entries()].map(a=>{let[l,u]=a;var f;return(f=(0,_r.Cq)(u,o,void 0,1)[0])===null||f===void 0?void 0:f.perspective}).filter(Mn.GT).map(a=>a.viewportName())}function wh(n){const t=(0,b.TL)(),o=(0,j.Fc)(),s=(0,c.useCallback)(l=>{t((0,j.fq)({mode:"select-perception-area",command:n.command}))},[t,n.command]),i=(0,c.useCallback)(()=>{t((0,j.fq)({mode:"none"}))},[t]),r=(0,xe.yX)(),a=(0,c.useCallback)(async(l,u)=>{try{if(new Set(u.targetTilesetIds).size!==1)throw new Error("Please select a single tileset to download");const h=u.targetTilesetIds[0],g=r[h],p=l.map(y=>g.visualizationMapping.project_from_ecef_point(y));let v="";switch(n.command){case"restrict":v="[".concat(Mh(g,p).map(y=>'"'.concat(y,'"')).join(", "),"]");break;case"download":v="bazel run //scripts:download_layout -- "+"--dataset s3://".concat("mach9cloud-storage-d2jlr365rfxa4u174444-prod","/files/").concat(h,"/ ")+"--polygon ".concat(JSON.stringify(p.map(y=>[y.x,y.y]))," ")+"".concat(o?.surveyId?"--perception_layer ".concat(o.surveyId," "):"")+"--output";break;case"create-label":v="bazel run //scripts:create_label -- "+"--dataset s3://".concat("mach9cloud-storage-d2jlr365rfxa4u174444-prod","/files/").concat(h,"/ --polygon ")+"".concat(JSON.stringify(p.map(y=>[y.x,y.y]))," --images ")+"".concat(Ih(g,p).map(y=>'"'.concat(y,'"')).join(" ")," ")+"--output";break;default:(0,vo.Z)(n.command)}navigator.clipboard.writeText(v),I.Z.show({message:"Copied command to clipboard",intent:"mach9"})}catch(f){I.Z.show({message:f.message,intent:"danger"})}finally{t((0,j.fq)({mode:"none"}))}},[t,n.command,r,o?.surveyId]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Yn.Z,{color:lt.K8,onMouseMove:s,handleLineFinish:a,handleCancel:i,drawType:"polygon"}),(0,e.jsx)(Gt.Z,{callback:l=>{l.key==="Escape"&&t((0,j.fq)({mode:"none"}))}})]})}function Rh(n,t,o){if(t.length===0)return{originalLineId:n.id,originalLine:n,newSegments:[]};const s=t.sort((a,l)=>a.segmentStart!==l.segmentStart?a.segmentStart-l.segmentStart:a.segmentT-l.segmentT),i=[],r=o.length-2;for(let a=0;a<s.length;a++){const l=s[a],u=s[a+1];if(a===0&&(l.segmentStart>0||l.segmentT>0)){const f={startIdx:0,startT:0,endIdx:l.segmentStart,endT:l.segmentT}
247,h=_n(f,o);h.length>=2&&i.push({coords:h})}if(u){const f={startIdx:l.segmentStart,startT:l.segmentT,endIdx:u.segmentStart,endT:u.segmentT},h=_n(f,o);h.length>=2&&i.push({coords:h})}else if(l.segmentStart<r||l.segmentT<1){const f={startIdx:l.segmentStart,startT:l.segmentT,endIdx:r,endT:1},h=_n(f,o);h.length>=2&&i.push({coords:h})}}return{originalLineId:n.id,originalLine:n,newSegments:i}}function Oh(n,t,o,s,i){const r=Cs([n],o,t),a=[];for(const[l,u]of r.entries()){if(u.length===0)continue;const f=u[0].line;if(!s(f)||i||(0,Ae.h)(f))continue;const h=f.positions,g=Rh(f,u,h);g.newSegments.length>=2&&a.push(g)}return a}const Lh=.01;function Ah(){const n=(0,b.TL)(),t=(0,le.$P)(),o=(0,le.ug)(),s=(0,le.Qz)(),i=(0,xe.ng)(),r=(0,je.Iz)(),a=(0,Ro.a)(),l=(0,c.useCallback)(f=>{try{const h=Gr(f.start,f.end),g=Oh(h,t,Lh,r,a);if(g.length===0){n((0,j.fq)({mode:"none"}));return}const p=[],v=new Date().toISOString();for(const y of g){const S=y.originalLine,E=i.trajectories[S.projectFileId];if(!E){console.warn("No trajectory for project file ".concat(S.projectFileId));continue}s(y.originalLineId,{deletedAt:v}),p.push({kind:"update-object",id:y.originalLineId,oldState:S});for(const Z of y.newSegments){const P=Z.coords.map(Y=>E.visualizationMapping.project_from_ecef_point(Y)),U=o.createLineForProjectFile({coords:P,width:S.width,type:S.type,annotationLayerId:S.annotationLayerId,spec:S.spec,isClosed:!1},S.projectFileId);p.push({kind:"add-object",id:U.id,state:U})}}if(p.length>0){n((0,Ue.u7)("split lines",p));const y=g.length;I.Z.show({message:"Split ".concat(y," ").concat(y===1?"line":"lines"),intent:"success"})}}catch(h){console.error("Error splitting lines:",h)}n((0,j.fq)({mode:"none"}))},[n,t,o,s,i,r,a]),u=(0,c.useCallback)(()=>{n((0,j.fq)({mode:"none"}))},[n]);return(0,e.jsx)(wo,{handleLineFinish:l,handleCancel:u,color:Pe.Z.YELLOW,snapToGround:!1})}function Dh(){const n=(0,j.Fc)(),t=(0,b.TL)(),o=(0,w.Eg)(),s=(0,c.useCallback)(i=>{var r,a;o(i,"Line",(r=n?.projectFileId)!==null&&r!==void 0?r:"",(a=n?.surveyId)!==null&&a!==void 0?a:null,void 0),t((0,j.fq)({mode:"none"}))},[t,o,n]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Yn.Z,{handleLineFinish:s,handleCancel:()=>{t((0,j.fq)({mode:"none"}))},color:Pe.Z.ORANGE,drawType:"polyline",canPickTerrain:!0}),(0,e.jsx)(Gt.Z,{callback:i=>{i.key==="Escape"&&t((0,j.fq)({mode:"none"}))}})]})}function Zh(){const n=(0,j.kb)(t=>t);return n.mode==="object-annotation"?(0,e.jsx)(J.ZP,{}):n.mode==="line-annotation"?(0,e.jsx)(w.ZP,{}):n.mode==="paste-annotations"?(0,e.jsx)(sh,{}):n.mode==="task"?(0,e.jsx)(Dh,{}):n.mode==="measurement"||n.mode==="measurement-height"?(0,e.jsx)(Ch,{measurementType:n.mode,pasteSpec:n.pasteSpec,initialPoint:n.mode==="measurement"?n.initialPoint:void 0}):n.mode==="measurement-area"?(0,e.jsx)(Xf,{}):n.mode==="measurement-angle"?(0,e.jsx)(Kf,{}):n.mode==="addCadFile"?(0,e.jsx)($f,{interactionState:n}):n.mode==="find-image-for-point"?(0,e.jsx)(ph,{forceStreetView:n.forceStreetView}):n.mode==="select-perception-area"?(0,e.jsx)(wh,{command:n.command}):n.mode==="cross-section"?(0,e.jsx)(ih,{}):n.mode==="stencilized-resample"?(0,e.jsx)(Wf,{}):n.mode==="matcher"?(0,e.jsx)(Zf,{}):n.mode==="dtm-selection"?(0,e.jsx)(rh,{}):n.mode==="pick-id"?(0,e.jsx)(Th,{}):n.mode==="split"?(0,e.jsx)(Ah,{}):n.mode==="extending"?(0,e.jsx)(dh,{}):n.mode==="arc"?(0,e.jsx)(Yf,{}):n.mode==="merging"?(0,e.jsx)(jh,{}):null}var Fh=Zh,Nh=d(8585),Bh=d(46909),un=d.n(Bh);function kh(){const n=(0,b.TL)(),{scene:t}=(0,me.VQ)(),[o,s]=(0,c.useState)({fps:0,isLowFrameRate:!1});(0,c.useEffect)(()=>{if(!t)return;const r=Zi.Z.fromScene(t),a=()=>{s(f=>({...f,isLowFrameRate:!0}))},l=()=>{s(f=>({...f,isLowFrameRate:!1}))};r.lowFrameRate.addEventListener(a),r.nominalFrameRate.addEventListener(l);const u=setInterval(()=>{r.lastFramesPerSecond!==void 0&&s(f=>({...f,fps:r.lastFramesPerSecond}))},1e3);return()=>{r.lowFrameRate.removeEventListener(a),r.nominalFrameRate.removeEventListener(l),clearInterval(u),typeof r.destroy=="function"&&r.destroy()}},[t]);const i=(0,c.useCallback)(()=>{n((0,ft.ob)(!0))},[n]);return(0,e.jsx)(C.RequireFeatureFlag,{featureFlag:"fpsCounter",featureFlagDefault:!1,children:(0,e.jsx)("div",{className:un().performanceMonitor,onClick:i,style:{cursor:"pointer"},children:(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[(0,e.jsx)("span",{style:{fontSize:"14px"},children:"FPS:"}),(0,e.jsx)("span",{style:{fontSize:"14px",fontWeight:"bold",color:o.isLowFrameRate?"red":"white",fontFamily:"monospace",minWidth:"45px",display:"inline-block",textAlign:"right"},children:o.fps?o.fps.toFixed(1):"N/A"})]})})})}var Vh=d(43958);function ws(n){return(0,e.jsx)(Nh.u,{content:n.title,disabled:n.disabled,children:(0,e.jsx)("button",{className:"".concat(un().cameraModeBarButton," ").concat(n.active?un().active:""),onClick:n.onClick,style:n.style,title:n.title,disabled:n.disabled,children:(0,e.jsx)(Ce.Icon,{icon:n.icon})})})}function Uh(){const{camera:n,scene:t,viewer:o}=(0,me.VQ)(),s=(0,vt.Ox)(l=>l.kind),i=(0,b.TL)(),r=(0,Di.Z)(),a=s==="plan-view";return(0,e.jsx)(ws,{icon:a?(0,e.jsx)("img",{src:"/assets/images/icons/plan-camera-mode.svg",alt:"Plan Camera Mode"}):(0,e.jsx)("img",{src:"/assets/images/icons/perspective-camera-mode.svg",alt:"Perspective Camera Mode"}),title:a?"Switch to perspective mode":"Switch to plan mode",onClick:l=>{if(l.stopPropagation(),n&&s==="normal"){if(!t||!o)return;const{width:u,height:f}=(0,go.S)(o),h=new at.Z(u/2,f/2),g=r(h),p=g?.position;i(p?(0,vt.it)(p):(0,vt.Xz)())}else n&&s==="plan-view"&&i((0,vt.DN)())}})}function Wh(){const n=(0,b.TL)(),t=(0,jn.ow)(),s=Object.entries((0,xe.yX)()).some(r=>{let[a,l]=r;return l.spline.segments.length>0}),i=(0,Q.ye)("newLayerPanel",!1);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ws,{icon:"map",onClick:()=>n((0,jn.Dc)()),active:t,title:t?"Close minimap":"Open minimap",disabled:!s}
247),t&&s&&!i&&(0,e.jsx)("div",{className:un().minimapContainer,children:(0,e.jsx)(Vh.N,{})})]})}const zh={0:"0",30:"30",60:"60",90:"90"},Hh={0:"N",90:"E",180:"S",270:"W",360:"N"};function Yr(){return(0,e.jsx)("div",{className:un().smallCircle,children:" "})}function Kh(){var n;const t=(0,je.Jk)(),o=Math.max(0,Math.min(90,Math.round(-t.pitch*180/Math.PI))),s=t.heading*360/(2*Math.PI),i=(n=(0,ve.wT)())===null||n===void 0?void 0:n.camera;return(0,e.jsxs)("div",{className:"".concat(un().tiltHeadingControls," slider-label-off"),children:[(0,e.jsx)("span",{children:"Tilt"}),(0,e.jsx)(Ce.Slider,{min:0,max:90,value:o,onChange:r=>{const a=-r*Math.PI/180;i&&i.setView({destination:i.position,orientation:{heading:i.heading,pitch:a,roll:i.roll}})},labelValues:[0,15,30,45,60,75,90],labelRenderer:r=>{var a;return(a=zh[r])!==null&&a!==void 0?a:(0,e.jsx)(Yr,{})}}),(0,e.jsx)("span",{children:"Heading"}),(0,e.jsx)(Ce.Slider,{min:0,max:360,value:s,onChange:r=>{let a=r*Math.PI/180;a===0&&(a=.001),i&&i.setView({destination:i.position,orientation:{heading:a,pitch:i.pitch,roll:i.roll}})},labelValues:[0,45,90,135,180,225,270,315,360],labelRenderer:r=>{var a;return(a=Hh[r])!==null&&a!==void 0?a:(0,e.jsx)(Yr,{})}})]})}function Gh(){const[n,t]=(0,c.useState)(!1),o=(0,vt.Ox)(r=>r.kind)==="normal";(0,c.useLayoutEffect)(()=>{o||t(!1)},[o]);const s=(0,je.Jk)().heading,i=(0,e.jsx)("img",{src:"/assets/images/icons/compass.svg",alt:"Compass",style:{transform:"rotate(".concat(-s,"rad)")}});return(0,e.jsx)(Rr.p,{content:(0,e.jsx)(Kh,{}),className:un().compassPopoverOverride,placement:"right",children:(0,e.jsx)(ws,{icon:i,onClick:()=>t(!n),active:n,title:"Open camera settings",disabled:!o})})}function _h(){const n=(0,vt.Ox)(o=>o.kind);return(0,ct.sN)()==="lidar"&&(n==="normal"||n==="plan-view")}function Yh(){const n=(0,Q.ye)("useMarketingVersion",!1);return!_h()||n?null:(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)("div",{className:un().cameraModeBar,children:[(0,e.jsx)(kh,{}),(0,e.jsx)(Wh,{}),(0,e.jsx)(Uh,{}),(0,e.jsx)(Gh,{})]})})}function Jh(n){var t;const o=(0,j.KF)(),s=(t=(0,j.At)())===null||t===void 0?void 0:t.type,i=(0,j.Fc)();var r;const a=(0,Xn.ow)((r=i?.surveyId)!==null&&r!==void 0?r:""),l=(0,je.qe)(E=>E.attributeTemplateLayersExcluded),u=(0,c.useMemo)(()=>{const E=a?bs(a.schema).filter(Z=>Z.featureClass==="line"):[];for(const Z of E)Z.disabled=l?.[Z.name];return E},[a,l]),f=(0,je.qe)(E=>E.objectTypesExcluded);var h;const g=(0,Io.nx)((h=i?.surveyId)!==null&&h!==void 0?h:""),p=(0,Io.Pn)().filter(ee.Te),v=(0,Le.F5)(),y=(0,c.useCallback)(E=>({name:ee.vl[E],type:E,disabled:f?.[E],featureClass:"line"}),[f]),S=(0,c.useMemo)(()=>{const E=[{group:"Layers",options:u.sort((Z,P)=>Z.name.localeCompare(P.name))}];return v==="Task"?E.push({group:"Task Lines",options:g.map(y).sort((Z,P)=>Z.name.localeCompare(P.name))}):E.push({group:"All Lines",options:p.map(y).sort((Z,P)=>Z.name.localeCompare(P.name))}),E},[p,u,v,g,y]);return(0,e.jsx)(Or.ZP,{isOpen:n.isOpen,onClose:n.onClose,onChoose:E=>{let{type:Z,prefill:P}=E;n.onSelect(Z,P),n.onClose()},choiceName:"line",title:"Choose a line",types:S,mostUsed:o?y(o):void 0,lastUsed:s?y(s):void 0})}function Xh(){const n=(0,O.N_)(),t=(0,b.TL)();return(0,e.jsx)(Jh,{isOpen:n,onClose:()=>{t((0,O.Mr)())},onSelect:(o,s)=>{t((0,j.fq)({mode:"line-annotation",type:o,prefill:s})),t((0,O.Mr)())}})}var Qh=Xh,$h=d(93139);function qh(){const n=(0,Le.fJ)(),t=(0,O.Vd)(),o=(0,b.TL)(),s=(0,Q.ye)("canExport",!1),i=()=>{o((0,O.Mr)())},[r,a]=(0,c.useState)(1);return(0,e.jsxs)(Ce.Dialog,{isOpen:t,onClose:i,title:"Choose CSV options",className:Pt.Pyr,children:[(0,e.jsx)("div",{className:Pt.TmF,children:(0,e.jsx)($h.F,{onChange:l=>a(l.startNumber)})}),(0,e.jsx)("div",{className:Pt.Alt,children:(0,e.jsxs)("div",{className:Pt.e$L,children:[(0,e.jsx)(Ce.Button,{onClick:i,children:"Cancel"}),(0,e.jsx)(Ce.Button,{intent:"mach9",disabled:!s,title:s?void 0:"Export disabled",onClick:()=>{if(!s)return;const l="/api/view/export/".concat(n,"?format=csv&startNumber=").concat(r);window.open(l,"_blank"),i()},children:"Export"})]})})]})}var eg=qh,tg=d(74345),ng=d(63106),og=d(76034),sg=d(85831);
247function ig(){const n=(0,Le.fJ)(),{projectView:t}=(0,mo.s0)(n||""),o=(0,Ut.Q)(),s=(0,je.FE)(p=>p),i=JSON.stringify(o),r=JSON.stringify(s),a=t?.specification===i,l=t?.viewState===r,[u,f]=(0,ng.D)((0,og.Ps)(sg.F$),{refetchQueries:["ListProjectViews","GetProjectView","GetProjectWithFilesAndViews"]}),h=(0,c.useCallback)(async()=>{!t||a||a||u({variables:{input:{id:t.id,specification:i,viewState:r}}})},[i,r,t,a,u]),g=f.loading;return{save:h,hasSaved:a,hasSavedViewState:l,currentlySaving:g,savingPossible:!!t}}function rg(n){const{save:t,hasSaved:o,currentlySaving:s,savingPossible:i}=ig(),r=(0,Le.fJ)(),[a,l]=(0,c.useState)(!1);return(0,e.jsx)(Ce.Button,{intent:"mach9",disabled:!n.projection,loading:a,onClick:async()=>{if(!n.projection||!n.format)return;l(!0),await t();const u="/api/view/export/".concat(r,"?format=").concat(n.format,"&epsg=").concat(n.projection.key);window.open(u,"_blank"),l(!1),n.onClose()},children:"Export"})}function ag(){const n=(0,O.AF)();var t;const o=(t=(0,O.Px)())!==null&&t!==void 0?t:void 0,s=(0,b.TL)(),i=()=>{s((0,O.Mr)())},[r,a]=(0,c.useState)(void 0);return(0,e.jsxs)(Ce.Dialog,{isOpen:n,onClose:i,title:"Choose export coordinate system",className:Pt.Pyr,children:[(0,e.jsx)("div",{className:Pt.TmF,children:(0,e.jsx)(tg.Z,{value:r,onChange:a})}),(0,e.jsx)("div",{className:Pt.Alt,children:(0,e.jsxs)("div",{className:Pt.e$L,children:[(0,e.jsx)(Ce.Button,{onClick:i,children:"Cancel"}),(0,e.jsx)(rg,{projection:r,format:o,onClose:i})]})})]})}var cg=ag,lg=d(84795),dg=d(51614),ug=d.n(dg),mg=d(34506);function fg(n){return(0,e.jsx)(e.Fragment,{children:n.children})}function hg(){const n=(0,O.Y$)(),t=(0,b.TL)(),o=()=>{t((0,O.Mr)())},s=(0,O.jk)(),i=typeof s=="number"?(0,mg.p)(s):fg,r=(0,O.ku)(),a=l=>{t((0,O.KW)(l))};return(0,e.jsx)(Ce.Dialog,{title:"Import data",isOpen:n,onClose:o,className:Pt.Pyr,style:{width:"90vw",height:"90vh"},children:(0,e.jsx)("div",{className:"".concat(Pt.TmF," ").concat(ug().body," "),children:(0,e.jsx)(lg.Z,{folder:r??{kind:"drive"},itemWrapper:i,setFolder:a})})})}var gg=hg,yn=d(75516),pg=d(96067),Qn=d.n(pg);function vg(){const n=(0,b.TL)(),t=(0,ct.b6)();return(0,e.jsxs)("div",{className:Qn().opacity,children:[(0,e.jsxs)("span",{className:Qn().opacityText,children:[(0,e.jsx)("span",{className:Qn().opacityLabel,children:"Opacity:\xA0"}),(0,e.jsxs)("span",{className:Qn().opacityValue,children:[Math.round(t*100),"%"]})]}),(0,e.jsx)("input",{type:"range",min:"0",max:"100",value:t*100,onChange:o=>n((0,ct.os)(parseInt(o.target.value)/100)),style:{flexGrow:1}})]})}function xg(){const n=(0,ct.S1)(),t=(0,ct.sN)(),o=(0,yn.Z)()===yn.x.OBJECT_IMAGE;return!n||t!=="split"||o?null:(0,e.jsx)("div",{className:Qn().settings,children:(0,e.jsx)(vg,{})})}var yg=d(27540),Cg=d(25003);function Jr(n){const{title:t,children:o,portalKey:s,close:i,initialHeight:r,initialWidth:a}=n,[l,u]=(0,c.useState)(void 0);return(0,c.useEffect)(()=>{const f=window.open("about:blank",s,"width=".concat(a??800,"m,height=").concat(r??800,"m"));if(f){for(const h of Array.from(document.styleSheets))if(h.href){const g=f.document.createElement("link");g.rel="stylesheet",g.href=h.href,f.document.head.appendChild(g)}return u(f),()=>{f.close()}}},[s,r,a]),(0,c.useEffect)(()=>{const f=()=>{i()};return l?.addEventListener("beforeunload",f),()=>{l?.removeEventListener("beforeunload",f)}},[i,l]),(0,c.useEffect)(()=>{l&&(l.document.title=t)},[l,t]),l?(0,Cg.createPortal)(o,l.document.body,s):null}function Eg(n){const{perspective:t}=n,{fileId:o,stem:s,cameraDirectoryName:i}=t.imageId,r=(0,kn.Sp)({fileId:o,stem:s,cameraDirectoryName:i});return(0,e.jsx)("div",{style:{width:"100%",height:"100%"},children:(0,e.jsx)("img",{style:{objectFit:"contain",width:"100%",height:"100%",transform:"rotate(".concat(t.rotationForDisplay,"deg)")},src:r,alt:"".concat(o," ").concat(i," ").concat(s)})})}function Sg(n){const{cameraName:t}=n,o=(0,b.TL)(),s=(0,ct.RF)(t),i=(0,xe._Z)(),r=(0,ct.rj)(),a=(0,c.useCallback)(()=>{o((0,ct.ci)(t,!1))},[t,o]),l=r?.timestamp;if(!l)return null;const u=i?.closestImageToTime(l,t),f=u?.cameraCalibration.intrinsic.image_height,h=u?.cameraCalibration.intrinsic.image_width;return u&&s&&(0,e.jsx)(Jr,{title:"".concat(u.imageId.cameraDirectoryName," ").concat(u.imageId.fileId," ").concat(u.imageId.stem),portalKey:"".concat(u.imageId.cameraDirectoryName,"-").concat(u.imageId.fileId),close:a,initialHeight:f,initialWidth:h,children:(0,e.jsx)(Eg,{perspective:u})})}function jg(){const n=(0,xe._Z)(),t=(0,c.useMemo)(()=>n?[...n.imagesByCamera.keys()]:null,[n]);return t?.map(o=>(0,e.jsx)(Sg,{cameraName:o},o))}var Tg=d(48584),bg=d(83500),Rs=d(20158),Pg=d(98602),Mg=d(55209),Ig=d(92959),wg=d(13855),Cn=d.n(wg);function Rg(n){const{perspective:t,object:o}=n,s=(0,je.tV)(o),i=(0,Co.MF)(o,t.trajectory.visualizationMapping,null);let[r,a,l,u]=[1/0,1/0,-1/0,-1/0];for(const f of[-.5,.5])for(const h of[-.5,.5])for(const g of[-.5,.5]){const p=(0,Gn.Zj)(new m.Z(f,h,g),i),v=t.pixelFromEcef(p);v&&(r=Math.min(r,v.x),a=Math.min(a,v.y),l=Math.max(l,v.x),u=Math.max(u,v.y))}return![r,a,l,u].every(f=>Number.isFinite(f))||!s?null:(0,e.jsx)(Rs.UL,{x:r,y:a,width:l-r,height:u-a,stroke:"yellow",strokeWidth:5})}function Og(n){const t=(0,pt.WE)(i=>i.detail==="object"?i.key:null),o=(0,le.ug)(),s=t?o.getFeatureById(t):null;return!s||s.__typename!=="ObjectAnnotation"?null:(0,e.jsx)(Rg,{perspective:n.perspective,object:s})}const Lg=.1,Ag=10,Dg=.001,Zg=Math.E,Zp=(0,ot.Record)({mouseX:ot.Number,mouseY:ot.Number}),Xr=(0,c.createContext)(void 0),Fg=(0,c.forwardRef)(function(t,o){const s=Ng(t.shouldRespondToInputs),{scale:i,translateX:r,translateY:a,mouseInImagePositionContext:l,containerRef:u,setZoom:f,handleWheel:h,handleMouseDown:g,handleMouseMove:p,handleMouseUp:v,handleMouseLeave:y}=s;return(0,c.useImperativeHandle)(o,()=>({setZoom:f}),[f]),(0,e.jsx)(Xr.Provider,{value:l,children:(0,e.jsx)(Bg,{containerRef:u,eventHandlers:{handleWheel:h,handleMouseDown:g,handleMouseMove:p,handleMouseUp:v,handleMouseLeave:y},children:(0,e.jsx)(kg,{translateX:r,translateY:a,scale:i,children:t.children})})})});
247function Ng(n){const[t,o]=(0,c.useState)(1),[s,i]=(0,c.useState)(0),[r,a]=(0,c.useState)(0),[l,u]=(0,c.useState)(void 0),[f,h]=(0,c.useState)(null),g=(0,c.useRef)(null),p=(0,c.useCallback)((Y,se,he)=>{o(Y),i(se),a(he)},[]),v=(0,c.useCallback)(Y=>({x:(Y.x-s)/t,y:(Y.y-r)/t}),[s,r,t]),y=(0,c.useCallback)(Y=>{u({mouseX:Y.x,mouseY:Y.y})},[]),S=(0,c.useCallback)(Y=>{if(n&&!n())return;const se=-Y.deltaY*Dg,he=Zg**se,ie=t*he,Oe=Math.min(Math.max(ie,Lg),Ag),ue=Os(Y,g.current),De=v(ue);o(Oe),i(ue.x-De.x*Oe),a(ue.y-De.y*Oe)},[t,n,v]),E=(0,c.useCallback)(Y=>{h({x:Y.clientX,y:Y.clientY});const se=Os(Y,g.current),he=v(se);y(he)},[v,y]),Z=(0,c.useCallback)(Y=>{if(n&&!n())return;f&&(i(s+Y.clientX-f.x),a(r+Y.clientY-f.y),h({x:Y.clientX,y:Y.clientY}));const se=Os(Y,g.current),he=v(se);y(he)},[n,f,s,r,v,y]),P=(0,c.useCallback)(()=>{h(null)},[]),U=(0,c.useCallback)(()=>{h(null)},[]);return{scale:t,translateX:s,translateY:r,mouseInImagePositionContext:l,containerRef:g,setZoom:p,handleWheel:S,handleMouseDown:E,handleMouseMove:Z,handleMouseUp:P,handleMouseLeave:U}}function Bg(n){let{children:t,containerRef:o,eventHandlers:s}=n;const{handleWheel:i,handleMouseDown:r,handleMouseMove:a,handleMouseUp:l,handleMouseLeave:u}=s;return(0,e.jsx)("div",{style:{width:"100%",height:"100%",position:"relative",overflow:"hidden"},ref:o,onWheel:i,onMouseDown:r,onMouseMove:a,onMouseUp:l,onMouseLeave:u,children:t})}function kg(n){let{children:t,translateX:o,translateY:s,scale:i}=n;return(0,e.jsx)("div",{style:{position:"absolute",top:0,left:0,transformOrigin:"left top",transform:"translate(".concat(o,"px, ").concat(s,"px) scale(").concat(i,") ")},children:t})}function Fp(){const n=useContext(Xr);return n===void 0&&console.error("Couldn't find parent ZoomPan - useZoomPanMouseInImagePosition must be used within a ZoomPan"),n}function Os(n,t){if(!t)return console.warn("Container ref not available"),{x:0,y:0};const o=t.getBoundingClientRect();return{x:n.clientX-o.left,y:n.clientY-o.top}}function Vg(n){const{image_width:t,image_height:o}=n.perspective.cameraCalibration.intrinsic;return(0,e.jsx)(Rs.Hf,{width:t,height:o,className:Cn().fullScreenImage,children:(0,e.jsx)(Rs.mh,{children:(0,e.jsx)(Og,{perspective:n.perspective})})})}function Ug(n){const{perspective:t}=n,{image_width:o,image_height:s}=t.cameraCalibration.intrinsic,i=(0,c.useRef)(null),r=(0,j.kb)(S=>S.mode),a=(0,ct.te)(),[l,u]=(0,c.useState)(null),{fileId:f,stem:h,cameraDirectoryName:g}=t.imageId,p=(0,c.useMemo)(()=>({fileId:f,stem:h,cameraDirectoryName:g}),[f,h,g]);(0,c.useLayoutEffect)(()=>{const S=new AbortController,E=i.current;return(0,kn.bA)(Z=>{u(Z.getImage());const P=Z.getImage();if(!P||!E)return;const U=E.getContext("2d");U&&U.drawImage(P,0,0,E.width,E.height)},p,!1,S.signal),()=>{if(S.abort(),!E||a==="playing")return;const Z=E.getContext("2d");Z&&(Z.fillStyle="grey",Z.fillRect(0,0,E.width,E.height))}},[p,r,a]);const v=(0,c.useRef)(null),y=(0,Ig.ZP)(t);return(0,c.useEffect)(()=>{if(!l)return;const S=i.current;if(!S)return;const E=S.getContext("2d");E&&y&&E.drawImage(y,0,0,S.width,S.height)},[y,l]),(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("canvas",{ref:i,className:Cn().fullScreenImage,height:s,width:o}),(0,e.jsx)("canvas",{ref:v,className:Cn().fullScreenImage,height:s,width:o})]})}function Wg(n){const{perspective:t}=n,{image_width:o,image_height:s}=t.cameraCalibration.intrinsic;return(0,e.jsx)(Tg.F,{content:(0,e.jsx)(Mg.Z,{perspective:t}),children:(0,e.jsx)("div",{style:{position:"absolute",left:0,top:0,width:o,height:s,transform:"rotate(".concat(t.rotationForDisplay,"deg)"),transformOrigin:"center"},children:(0,e.jsxs)("div",{style:{position:"relative",width:"100%",height:"100%"},children:[(0,e.jsx)(Ug,{perspective:t}),(0,e.jsx)(Vg,{perspective:t})]})})})}const Ls=(0,c.forwardRef)((n,t)=>{const o=(0,c.useRef)(null),s=(0,c.useRef)(null),i=(0,c.useCallback)(()=>{if(!o.current||!s.current)return;let{width:a,height:l}=o.current.getBoundingClientRect();a=Math.max(1,a-n.rightBuffer);const{image_height:u,image_width:f}=n.perspective.cameraCalibration.intrinsic;if(a===0||l===0){s.current.setZoom(1,0,0);return}const h=Math.min(a/f,l/u),g=(a-f*h)/2,p=(l-u*h)/2;s.current.setZoom(h,g,p)},[n.perspective,n.rightBuffer]);(0,c.useImperativeHandle)(t,()=>({zoomToFit:i}),[i]);const r=(0,c.useMemo)(()=>[{combo:"r",label:"Reset scale",global:!0,onKeyDown:()=>i}],[i]);return(0,M.y)(r),(0,e.jsx)("div",{className:Cn().view,style:{visibility:n.visible?"visible":"hidden"},children:(0,e.jsxs)("div",{style:{width:"100%",height:"100%",position:"relative"},ref:o,children:[(0,e.jsx)(Fg,{ref:s,children:(0,e.jsx)(Wg,{perspective:n.perspective})}),n.children]})})});Ls.displayName="FullScreenViewLoader";function zg(n){const t=(0,ct.vy)();(0,c.useEffect)(()=>{const o=new AbortController;for(let s=1;s<5;
247s++){const i=n.imageTimestamp+(t??1)*s,r=n.trajectory.closestImageToTime(i,n.cameraName);if(!r)continue;const a=r.imageId;(0,kn.bA)(l=>{},a,!1,o.signal,!0)}return()=>{o.abort()}},[n.reactKey,t])}function Qr(n){const t=(0,ct.sN)(),o=(0,ct.te)();zg(n.perspective);const s=(0,c.useRef)(null);return(0,c.useEffect)(()=>{if(o==="paused"){var i;(i=s.current)===null||i===void 0||i.zoomToFit()}},[n.perspective.reactKey,o]),(0,e.jsx)(Ls,{perspective:n.perspective,visible:t==="image",ref:s,rightBuffer:353})}function $r(n){const t=n.perspective.rotationForDisplay%180===90,{image_width:o,image_height:s}=n.perspective.cameraCalibration.intrinsic,i=120,r=t?i*o/s:i*s/o;return(0,e.jsx)("span",{className:"".concat(Cn().imageSelectionImage," ").concat(n.isSelected?Cn().selected:""),role:"menuitem",style:{width:i,height:r},children:(0,e.jsx)("img",{crossOrigin:"anonymous",src:(0,kn.Sp)(n.perspective.imageId),onClick:n.onClick,alt:"View from ".concat(n.perspective.cameraName),role:"menuitem",style:{maxWidth:t?r:i,maxHeight:t?i:r,transform:"rotate(".concat(n.perspective.rotationForDisplay,"deg)"),transformOrigin:"center"}})})}function Hg(n){const[t,o]=(0,c.useState)(!1);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"".concat(Cn().imageSelectionContainer," styled-scrollbars"),role:"menu",children:[n.preferredAlternatives.map(s=>(0,e.jsx)($r,{perspective:s,isSelected:s.key===n.perspectiveKey,onClick:()=>{n.setPerspectiveKey(s.key)}},s.key)),t&&n.remainingPerspectives.length>0&&(0,e.jsx)(Ce.MenuDivider,{title:(0,e.jsx)("div",{style:{fontSize:"14px"},children:"More images"})}),t&&n.remainingPerspectives.map(s=>(0,e.jsx)($r,{perspective:s,isSelected:s.key===n.perspectiveKey,onClick:()=>{n.setPerspectiveKey(s.key)}},s.key))]}),(0,e.jsx)(Ce.Button,{style:{width:"100%"},onClick:()=>o(!t),role:"menuitem",text:!0,icon:t?"chevron-up":"chevron-down",children:t?"Show less":"Show more"})]})}function Kg(n,t){const o=[],s=Object.keys(n),i=Object.fromEntries(s.map((r,a)=>[r,0]));for(let r=0;r<t;r++){let a=!1;for(let l=r;l<r+s.length;l++){const u=s[l%s.length],f=n[u],h=i[u];if(h<f.length){i[u]++;const g=f[h].perspective;if(!o.some(p=>p.reactKey===g.reactKey)){o.push(g),a=!0;break}}}if(!a)break}return o}function Gg(n){const t={};for(const o of Object.keys(n)){const s=n[o];(0,Pg.H)(s,(r,a)=>a.rating-r.rating,0,s.length,Oo);const i=s.slice(0,Oo).sort((r,a)=>a.rating-r.rating);t[o]=i}return t}function qr(n,t){const o=[],s=new Set;let i,r=Number.POSITIVE_INFINITY;for(const a of n){if(a.length===0)continue;const l=a[0];l&&!s.has(l.perspective.reactKey)&&(o.push(l.perspective),s.add(l.perspective.reactKey));for(const u of a){const f=m.Z.distance(t.center,u.perspective.getPosition());f<r&&(r=f,i=u.perspective)}}return{preferredPerspectives:o,closest:i??void 0}}function _g(n,t){return(0,c.useMemo)(()=>{const o=[],s=p=>(0,_r.Cq)(n,t.center,p,Oo);o.push(s(t.frontFace)),t.frontFace&&(o.push(s(m.Z.negate(t.frontFace,new m.Z))),o.push(s(void 0)));const{preferredPerspectives:i}=qr(o,t);if(i.length>0){const p=Ee.Z.multiplyByPointAsVector(i[0].cameraToEcefTransform,m.Z.UNIT_Z,new m.Z);o.push(s(m.Z.negate(p,new m.Z)));const v=m.Z.cross(p,m.Z.UNIT_Z,new m.Z);m.Z.equalsEpsilon(v,m.Z.ZERO,.01)||(m.Z.normalize(v,v),o.push(s(v)),o.push(s(m.Z.negate(v,new m.Z))))}const{preferredPerspectives:r,closest:a}=qr(o,t),l=new Set(r.map(p=>p.reactKey));a&&!l.has(a.reactKey)&&(r.push(a),l.add(a.reactKey));const u={},f={};for(const p of o)for(const v of p.slice(1))l.has(v.perspective.reactKey)||(u[v.perspective.cameraName]||(u[v.perspective.cameraName]=[],f[v.perspective.cameraName]=new Set),f[v.perspective.cameraName].has(v.perspective.reactKey)||(u[v.perspective.cameraName].push(v),f[v.perspective.cameraName].add(v.perspective.reactKey)));const h=Gg(u),g=Kg(h,Oo-r.length);return[r,g]},[n,t])}const Oo=10,As=(0,c.forwardRef)((n,t)=>{var o;const{object:s,trajectory:i,options:r,show:a,rightBuffer:l}=n,u=(0,b.TL)(),f=(0,c.useMemo)(()=>(0,bg.ZP)(s,i.visualizationMapping),[s,i]),h=(0,c.useMemo)(()=>{var P,U;let Y=[];return"perception"in s.spec&&(!((U=s.spec.perception)===null||U===void 0||(P=U.viewports)===null||P===void 0)&&P.length)?Y=s.spec.perception.viewports.map(se=>{let[he,ie]=se;return i.getPerspective(he,ie)}).filter(Mn.GT):Y=i.getPossibleViewsOfPosition(f.center),Y},[s,i,f]),[g,p]=_g(h,f),[v,y]=(0,c.useState)((o=g[0])===null||o===void 0?void 0:o.key);var S;const E=(S=g.find(P=>P.key===v))!==null&&S!==void 0?S:p.find(P=>P.key===v);(0,c.useEffect)(()=>{E||(g.length>0?y(g[0].key):p.length>0?y(p[0].key):y(void 0))},[E,g,p,u]),(0,c.useEffect)(()=>{g.length+p.length===0?u((0,pt.Uh)(!1)):u((0,pt.Uh)(!0))},[g,p,u]);const Z=(0,c.useRef)(null);return(0,c.useImperativeHandle)(t,()=>({zoomToFit:()=>{var P;return(P=Z.current)===null||P===void 0?void 0:P.zoomToFit()}}),[]),(0,c.useEffect)(()=>{var P;(P=Z.current)===null||P===void 0||P.zoomToFit()},[s,E]),E?(0,e.jsx)(Ls,{perspective:E,visible:!!a,ref:Z,rightBuffer:l,children:(0,e.jsxs)("div",{style:{position:"absolute",top:10,left:10},children:[r,h.length>1&&(0,e.jsx)(Hg,{preferredAlternatives:g,remainingPerspectives:p,setPerspectiveKey:y,perspectiveKey:v})]})}):null});As.displayName="FullScreenObjectImage";function ea(n){const t=(0,ft.IL)(),o=(0,pt.WE)(i=>i.detail==="object"&&i.showImage),s=(0,b.TL)();return(0,e.jsx)(As,{object:n.object,trajectory:n.trajectory,options:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column"},children:[(0,e.jsxs)(Ce.Button,{icon:"arrow-left",onClick:()=>{s((0,pt.Do)(!1))},children:[" ","Close image"," "]}),(0,e.jsx)(Ce.Button,{icon:"document-open",onClick:()=>{s((0,ft.ZY)(!0))},children:"Popout"})]}),show:o&&!t,rightBuffer:353})}function Yg(){const n=(0,ct.rj)(),t=(0,xe._Z)(),o=(0,c.useMemo)(()=>!n||!t?null:t.closestImageToTime(n.timestamp,n.preferredCamera),[n,t]),s=(0,pt.WE)(u=>u.detail==="object"?u.key:null),i=(0,le.FU)(s??"nonexistent");var r;const a=(0,xe.J5)((r=i?.projectFileId)!==null&&r!==void 0?r:"");switch((0,yn.Z)()){case yn.x.OBJECT_IMAGE:return i&&a?(0,e.jsx)(ea,{object:i,trajectory:a}):null;case yn.x.STREETVIEW:return o?(0,e.jsx)(Qr,{perspective:o}):null;default:return i&&a?(0,e.jsx)(ea,{object:i,trajectory:a}):o?(0,e.jsx)(Qr,{perspective:o}):null}}var Jg=Yg;function Xg(n){const{object:t,trajectory:o}=n,s=(0,b.TL)(),i=(0,c.useRef)(null);return(0,c.useEffect)(()=>{setTimeout(()=>{var r;(r=i.current)===null||r===void 0||r.zoomToFit()},50)},[]),(0,e.jsx)(As,{object:t,trajectory:o,show:!0,options:(0,e.jsx)(Ce.Button,{icon:"minimize",onClick:()=>{s((0,ft.ZY)(!1)),s((0,pt.Do)(!0))},children:"Show inline"}),ref:i,rightBuffer:0})}function Qg(){const n=(0,pt.WE)(i=>i.detail==="object"?i.key:null),t=(0,le.FU)(n??"nonexistent");var o;const s=(0,xe.J5)((o=t?.projectFileId)!==null&&o!==void 0?o:"");return t&&s?(0,e.jsx)("div",{className:Pt.Pyr,style:{width:"100%",height:"100%"},children:(0,e.jsx)(Xg,{object:t,trajectory:s})}):(0,e.jsx)(Ce.NonIdealState,{title:"Select an object to see images",icon:"select"})}function $g(){const n=(0,ft.IL)(),t=(0,b.TL)();return n?(0,e.jsx)(Jr,{title:"Object image",portalKey:"object-image",close:()=>t((0,ft.ZY)(!1)),children:(0,e.jsx)(Qg,{})}):null}var qg=d(27791),qt=d.n(qg);function Ds(n){const t=(0,b.TL)(),o=(0,ct.sN)()===n.mode,s=()=>{t((0,ct.tu)(n.mode))};return(0,e.jsxs)("div",{className:qt().toolbarButtonContainer,children:[(0,e.jsx)("div",{className:"".concat(qt().toolbarButton," ").concat(o?qt().toolbarButtonActive:qt().toolbarButtonInactive),role:"button",onClick:s,children:(0,e.jsx)("img",{src:n.icon,className:qt().icon,style:{width:30,height:30},alt:n.hoverText})}),(0,e.jsx)("div",{className:qt().toolbarHoverText,onClick:s,children:n.hoverText})]})}function ep(){const n=(0,b.TL)();return(0,e.jsxs)("button",{className:qt().exitButton,onClick:()=>{n((0,ct.rf)()),n((0,ct.tu)("lidar")),n((0,ct.ev)())},children:[(0,e.jsx)(Ce.Icon,{icon:"arrow-left",iconSize:12}),"Exit"]})}function tp(){const n=(0,O.EV)(),t=(0,ct.S1)(),o=(0,yn.Z)()===yn.x.OBJ
247ECT_IMAGE;return n||!t||o?null:(0,e.jsxs)("div",{className:qt().toolbar,role:"menu",children:[(0,e.jsx)("div",{className:qt().toolbarBlur}),(0,e.jsx)("div",{className:qt().toolbarBackground}),(0,e.jsx)(ep,{}),(0,e.jsx)(Ds,{icon:"/assets/images/icons/lidar-view-blue.svg",hoverText:"LiDAR view",mode:"lidar"}),(0,e.jsx)(Ds,{icon:"/assets/images/icons/layer-view-blue.svg",hoverText:"Layer view",mode:"split"}),(0,e.jsx)(Ds,{icon:"/assets/images/icons/image-view-blue.svg",hoverText:"Image view",mode:"image"})]})}var np=tp,Zs=d(91624);const ta=(0,c.forwardRef)((n,t)=>{const o=(0,b.TL)();return(0,e.jsxs)("div",{className:dn().header,ref:t,children:[(0,e.jsx)("div",{className:dn().title,children:n.title}),(0,e.jsxs)("div",{className:dn().actions,children:[(0,e.jsx)(Ce.Button,{minimal:!0,icon:n.isMinimized?"expand-all":"minus",onClick:n.onMinimize}),(0,e.jsx)(Ce.Button,{minimal:!0,icon:"cross",onClick:()=>o((0,At.u8)(!1))})]})]})});ta.displayName="VertexInspectorDetailBoxHeader";function op(){const n=(0,le.vC)(),t=(0,je.wg)(n),o=(0,Xo.SK)();var s;const i=(0,xe.J5)((s=o?.projectFileId)!==null&&s!==void 0?s:""),r=(0,Qi.z6)(i);return(0,c.useMemo)(()=>{const l=[];for(const u of t)for(let f=0;f<u.coords.length;f++)(!r||r&&(0,ys.my)(r,u.coords[f]))&&l.push({line:u,index:f});return l.sort((u,f)=>{const h=(0,Hn.Z)("".concat((0,Hn.Z)(u.index.toString()),":").concat(u.line.id)),g=(0,Hn.Z)("".concat((0,Hn.Z)(f.index.toString()),":").concat(f.line.id));return h-g})},[t,r])}function sp(n){const{resetToFirstVertex:t,disabled:o}=n;return o?(0,e.jsx)(Ce.Callout,{intent:"warning",children:(0,e.jsx)("span",{children:"No vertices visible. Please adjust your filters"})}):(0,e.jsxs)(Ce.Callout,{intent:"warning",children:[(0,e.jsx)("span",{children:"A vertex was added or removed, please restart your session"}),(0,e.jsx)(Ce.Button,{onClick:t,icon:"refresh",minimal:!0,title:"Restart Session",disabled:o})]})}function ip(){const n=op(),[t,o]=(0,c.useState)(!1),[s,i]=(0,c.useState)(1),r=(0,Vi.rL)(n,!0),a=(0,c.useRef)(0),l=(0,c.useRef)(!1);(0,c.useEffect)(()=>{n.length!==a.current&&l.current&&(o(!0),a.current=n.length)},[n]),(0,c.useEffect)(()=>{n.length>0&&!l.current&&(i(1),r(n[0]),l.current=!0,a.current=n.length)},[n,r]);const u=(0,c.useMemo)(()=>n[s-1],[n,s]);return(0,e.jsxs)(Jt.ZP,{title:"Visible Vertices: ".concat(n.length),children:[(0,e.jsx)(Jt.ed,{children:t&&(0,e.jsx)(sp,{resetToFirstVertex:()=>{n.length!==0&&(i(1),r(n[0]),o(!1))},disabled:n.length===0})}),(0,e.jsx)(Zs.V,{left:"Current Index",right:(0,e.jsx)(Js.u,{initialValue:s,disabled:n.length===0,onChange:f=>{try{const h=n[f-1];r(h),i(f)}catch{I.Z.show({message:"Could not find a suitable visible vertex",intent:"warning"})}},stepSize:1,min:1,max:Math.max(1,n.length),precision:0})}),(0,e.jsx)(Zs.V,{left:"Current Line",right:(0,e.jsx)("div",{style:{display:"flex",flexDirection:"row",gap:"4px"},children:(0,e.jsxs)("span",{children:[" ",u?"".concat(u?.line.id.slice(0,4)):"No line selected"," "]})})}),(0,e.jsx)(Zs.V,{left:"Current Vertex",right:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center"},children:[(0,e.jsxs)("span",{children:[" ",u?"".concat(u?.index):"No vertex selected"," "]}),(0,e.jsx)(Ce.Button,{icon:"target",minimal:!0,title:"Return to vertex",disabled:!u,onClick:()=>{r(u)}})]})})]})}function rp(n){const{previewRef:t,dragRef:o}=n,[s,i]=(0,c.useState)(!1);return(0,e.jsxs)("div",{className:dn().detailBox,ref:r=>{t(r)},children:[(0,e.jsx)(ta,{title:"Vertex Inspector",isMinimized:s,onMinimize:()=>{i(!s)},ref:r=>{o(r)}}),(0,e.jsx)("div",{className:"".concat(dn().boxScrollOuter," styled-scrollbars"),children:(0,e.jsx)("div",{className:dn().detailBoxContents,style:{display:s?"none":"block"},children:(0,e.jsx)(ip,{})})})]})}function ap(){return(0,At.xs)()?(0,e.jsx)(ln.DV,{initialBottom:10,initialLeft:370,children:(t,o)=>(0,e.jsx)(rp,{previewRef:t,dragRef:o})}):null}function cp(n){const t=(0,ct.S1)(),o=(0,ct.sN)(),s=(0,c.useRef)(null);return(0,c.useEffect)(()=>{const i=s.current;if(!i)return;const r=t&&(o==="image"||o==="split")?"hideViewerButtons":"showViewerButtons";i.className=r},[t,o]),(0,e.jsx)("div",{ref:s,children:n.children})}function lp(n){const t=(0,Ut.n_)(u=>u),o=(0,En.ye)("newLayerPanel",!1),s=(0,jn.Ym)(),i=(0,En.ye)("useNewCameraSettingsUi",!1),r=(0,En.ye)("useNewTrajectoryViewPanel",!1),l=o&&s?"top-10":"top-3";return(0,e.jsx)(_l.w,{flexDirection:"column",filler:(0,e.jsxs)("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0},children:[!r&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"absolute z-[6] ".concat(l," left-3"),children:(0,e.jsx)(np,{})}),(0,e.jsx)(xg,{})]}),(0,e.jsx)(Gl,{message:"Error in full screen view; try refreshing the page.",children:(0,e.jsx)(Jg,{})}),(0,e.jsx)(Yu,{}),(0,e.jsx)(cu,{}),(0,e.jsxs)(lm,{children:[(0,e.jsx)(Tm,{}
247),(0,e.jsx)(cp,{children:(0,e.jsxs)(Hl,{topOffset:n.topOffset,leftOffset:n.leftOffset,rightOffset:n.rightOffset,viewerProps:fi,children:[(0,e.jsx)(bm,{}),(0,e.jsx)(T.zy,{}),(0,e.jsx)(Er.jG,{children:(0,e.jsx)(gr.CA,{children:(0,e.jsxs)(q0.Q,{children:[(0,e.jsx)(Mm,{}),(0,e.jsx)(Bn.Nv,{}),(0,e.jsx)(Jd,{}),(0,e.jsx)(Yd,{}),(0,e.jsx)(P0,{}),Object.keys(t).map(u=>(0,e.jsx)(hn,{id:u,children:(0,e.jsx)(Qi.ZP,{pcKey:u})},u)),(0,e.jsx)(Ad,{}),(0,e.jsx)(Om,{}),(0,e.jsx)(gi.u4,{}),(0,e.jsx)(pi.Kr,{}),(0,e.jsx)(vi.Zk,{}),(0,e.jsx)(xi.kg,{}),(0,e.jsx)(Ql,{reportingIntervalSeconds:10}),(0,e.jsx)(Yl.d,{}),(0,e.jsx)(N0,{}),(0,e.jsx)(rm,{}),(0,e.jsx)(ll,{}),(0,e.jsx)(ht,{children:(0,e.jsx)(zm,{})}),(0,e.jsx)(ht,{children:(0,e.jsx)(Fh,{})}),(0,e.jsx)(ht,{children:(0,e.jsx)(te.Z,{children:(0,e.jsx)(Hd.ZP,{})})}),(0,e.jsx)(h0,{}),(0,e.jsx)(im,{}),(0,e.jsx)(L0,{}),(0,e.jsx)(ht,{children:(0,e.jsx)(Od,{})}),(0,e.jsx)(ht,{children:(0,e.jsx)(Ii.w,{})}),(0,e.jsx)(ht,{children:(0,e.jsx)(gg,{})}),(0,e.jsx)(ht,{children:(0,e.jsx)(Sf,{})}),(0,e.jsx)(ht,{children:(0,e.jsx)(Qh,{})}),(0,e.jsx)(ht,{children:(0,e.jsx)(cg,{})}),(0,e.jsx)(ht,{children:(0,e.jsx)(zd,{})}),(0,e.jsx)(ht,{children:(0,e.jsx)(eg,{})}),(0,e.jsx)(Y0,{}),(0,e.jsx)(ht,{children:(0,e.jsx)(H0,{})}),(0,e.jsx)(ht,{children:(0,e.jsx)(z0,{})}),(0,e.jsx)(ht,{children:(0,e.jsx)(id,{})}),(0,e.jsx)(ht,{children:(0,e.jsx)(o0,{})}),(0,e.jsx)(ht,{children:(0,e.jsx)(jg,{})}),(0,e.jsx)(ht,{children:(0,e.jsx)($g,{})}),(0,e.jsx)(ht,{children:(0,e.jsx)(va,{})}),!i&&(0,e.jsx)(ht,{children:(0,e.jsx)(Yh,{})}),(0,e.jsx)(ht,{children:(0,e.jsx)(rl,{})}),(0,e.jsx)(ht,{children:(0,e.jsx)(Pu,{})}),(0,e.jsx)(ht,{children:(0,e.jsx)(ya,{})}),(0,e.jsx)(ht,{children:(0,e.jsx)(ap,{})}),(0,e.jsx)(ht,{children:(0,e.jsx)(_m,{})}),(0,e.jsx)(C.RequireFeatureFlag,{featureFlag:"linesInTask",featureFlagDefault:!1,children:(0,e.jsx)(ht,{children:(0,e.jsx)($0,{})})})]})})})]})})]})]}),after:r?null:(0,e.jsx)(yg.Z,{})})}function dp(){const[n,t]=(0,c.useState)(!1),o=(0,c.useMemo)(()=>[{combo:"alt+shift+r",global:!0,label:"Refresh Viewer",onKeyDown:()=>{console.warn("refresh viewer"),t(!0),setTimeout(()=>{t(!1)},100)}}],[]);return(0,M.y)(o),n}function up(){const n=(0,Mt.Qq)(),t=(0,N.jk)(u=>!!u.crossSection),s=(0,Le.F5)()==="CameraSelection",i=t&&n==="horizontal"?"50%":"100%",r=t&&n==="vertical"?"50%":"100%",a=n==="horizontal"?"50%":"100%",l=n==="vertical"?"50%":"100%";return(0,e.jsx)("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0},children:(0,e.jsxs)(T.ro,{children:[(0,e.jsx)(Ye.En,{windowName:"main-viewer",divProps:{tabIndex:0,style:{position:"absolute",left:0,top:0,width:r,height:i,overflow:"hidden"}},children:(0,e.jsx)(lp,{topOffset:0,leftOffset:0,rightOffset:0})}),(0,e.jsx)(Ye.En,{windowName:"cross-section-viewer",divProps:{tabIndex:0,style:{position:"absolute",right:0,bottom:0,width:l,height:a,overflow:"hidden",display:t?"block":"none"}},children:(0,e.jsx)(Ac,{renderingPaused:!t})}),t&&(0,e.jsx)(Dc,{}),!s&&(0,e.jsx)(Ze,{})]})})}function mp(){return x(),dp()?null:(0,e.jsx)(W.a3,{fallback:(0,e.jsx)(F.Z,{}),children:(0,e.jsx)(up,{})})}var fp=mp},33278:function(Me,fe,d){"use strict";d.d(fe,{L:function(){return Q},W:function(){return C}});var e=d(76470),M=d(56223),T=d(54507);const V=(0,T.Record)({x:T.Number,y:T.Number}),x=(0,T.Record)({from:V,to:V,score:T.Number}),c=(0,T.Array)((0,T.Array)(x));var W=d(56911);const F="inf-2025-08-26-a";function N(te,ne){var G;const $=te.split(","),I=((G=$[0].match(/:(.*?);/))===null||G===void 0?void 0:G[1])||"image/jpeg",R=atob($[1]);let b=R.length;const K=new Uint8Array(b);for(;b--;)K[b]=R.charCodeAt(b);return new File([K],ne,{type:I})}function Q(){return(0,M.useCallback)(async()=>{const te="https://inference.mach9.io/"+F;return{...await(await fetch("".concat(te,"/health"))).json(),url:te}},[])}function C(){return(0,M.useCallback)(async(te,ne)=>{const G=N(te,"image1.jpeg"),$=N(ne,"image2.jpeg"),I=new FormData;I.append("reference",G),I.append("images",$);const R="".concat("https://inference.mach9.io","/").concat(F,"/calculate-matches");try{const b=await fetch(R,{method:"POST",body:I});if(!b.ok)throw new Error("HTTP error! status: ".concat(b.status));const K=await b.json();return c.check(K).map(W.lv)[0]}catch(b){let K="Unknown error";throw b instanceof Error&&(K="Error running linear extraction: ".concat(b.message)),console.error(K),e.Z.show({intent:"danger",message:K,timeout:8e3},"matcher-inference-error"),b}},[])}},8670:function(Me,fe,d){"use strict";d.d(fe,{Dv:function(){return k},IY:function(){return ne},Nd:function(){return N},Ne:function(){return Q},fB:function(){return C},fb:function(){return G},kM:function(){return $},wT:function(){return de}});var e=d(79740),M=d(51282),T=d(15805),V=d(32092),x=d(68292),c=d(29273),W=d.n(c),F=d(86062);function N(X,z,L){const re=X.x*z.scale,q=X.y*z.scale,pe=z.scale,ce=(L.x-re)/2-z.x,m=(L.y-q)/2-z.y;return new e.Z(pe,0,ce,0,pe,m,0,0,1)}function Q(X,z){const L=e.Z.multiplyByVector(X,new M.Z(z.x,z.y,1),new M.Z(0,0,0));return T.Z.fromCartesian3(L)}function C(X,z){const L=new e.Z(1,0,z.x,0,1,z.y,0,0,1);return e.Z.multiply(L,X,new e.Z)}function te(X,z){const L=Math.max(X.x,X.y)/z,re=X.x>X.y?new Cartesian2(0,X.y/2-z*L/2):new Cartesian2(X.x/2-z*L/2,0);return new Matrix3(L,0,re.x,0,L,re.y,0,0,1)}function ne(X,z,L){const re=k(z,L.numIterations,L.inlierThreshold,W()("Random"));return re?Q(re,X):null}function G(X,z,L,re){const q=V.Z.inverse((0,F.BY)(L),new V.Z),pe=V.Z.multiply(q,z,new V.Z),ce=Math.max(X.x,X.y),m=re/2*(X.x/ce),ve=re/2*(X.y/ce),Te=V.Z.multiplyByPoint(pe,new M.Z(-m,ve,0),new M.Z),xe=V.Z.multiplyByPoint(pe,new M.Z(m,-ve,0),new M.Z);return new e.Z((xe.x-Te.x)/X.x,0,Te.x,0,(xe.y-Te.y)/X.y,Te.y,0,0,1)}function $(X,z,L){let re=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1;function q(m){return Math.hypot(m.from.x-X.x,m.from.y-X.y)}const pe=z.filter(m=>q(m)<L).sort((m,ve)=>q(m)-q(ve));return re===-1?pe:pe.slice(0,re)}function I(X){if(X.length<4)return X.length===3?b(X):null;const z=X.map(m=>new Cartesian2(m.from.x,m.from.y)),L=X.map(m=>new Cartesian2(m.to.x,m.to.y)),re=[];for(let m=0;m<z.length;m++){const ve=z[m],Te=L[m];re.push([ve.x,ve.y,1,0,0,0,-ve.x*Te.x,-ve.y*Te.x,-Te.x]),re.push([0,0,0,ve.x,ve.y,1,-ve.x*Te.y,-ve.y*Te.y,-Te.y])}const pe=new SingularValueDecomposition(re,{computeLeftSingularVectors:!1,computeRightSingularVectors:!0,autoTranspose:!0}).rightSingularVectors;return new Matrix3(pe.get(0,8),pe.get(1,8),pe.get(2,8),pe.get(3,8),pe.get(4,8),pe.get(5,8),pe.get(6,8),pe.get(7,8),pe.get(8,8))}function R(X,z){const L=Matrix3.multiplyByVector(X,new Cartesian3(z.x,z.y,1),new Cartesian3(0,0,0));return new Cartesian2(L.x/L.z,L.y/L.z)}function b(X){if(X.length!==3)return null;const z=new e.Z(X[0].from.x,X[1].from.x,X[2].from.x,X[0].from.y,X[1].from.y,X[2].from.y,1,1,1),L=new e.Z(X[0].to.x,X[1].to.x,X[2].to.x,X[0].to.y,X[1].to.y,X[2].to.y,1,1,1);try{return e.Z.multiply(L,e.Z.inverse(z,new e.Z),new e.Z)}catch{return null}}function K(X){if(X.length<3)return null;const z=[],L=[];for(let pe=0;pe<X.length;pe++){const ce=X[pe];z.push([ce.from.x,ce.from.y,1,0,0,0]),z.push([0,0,0,ce.from.x,ce.from.y,1]),L.push([ce.to.x]),L.push([ce.to.y])}
247const re=new x.ZP(z),q=new x.ZP(L);try{const pe=re.transpose(),ce=pe.mmul(re),ve=(0,x.SO)(ce).mmul(pe).mmul(q);return new e.Z(ve.get(0,0),ve.get(1,0),ve.get(2,0),ve.get(3,0),ve.get(4,0),ve.get(5,0),0,0,1)}catch{return null}}function k(X,z,L){let re=arguments.length>3&&arguments[3]!==void 0?arguments[3]:Math.random;if(X.length<3)return null;let q=null,pe=0;for(let ce=0;ce<z;ce++){const ve=j(X.length,3,re).map(we=>X[we]),Te=b(ve);if(!Te)continue;const xe=de(Te,X,L);xe.length>pe&&(q=Te,pe=xe.length)}if(q){const ce=de(q,X,L);q=K(ce)}return q}function de(X,z,L){return z.filter(re=>{const q=Q(X,re.from);return Math.hypot(q.x-re.to.x,q.y-re.to.y)<L})}function j(X,z,L){const re=new Set;for(;re.size<z;){const q=Math.floor(L()*X);re.add(q)}return Array.from(re)}},43256:function(Me,fe,d){"use strict";d.d(fe,{Z:function(){return ne}});var e=d(10081),M=d(12694),T=d(44623),V=d(91755),x=d(27453),c=d(35113),W=d(51450),F=d(62368),N=d(93096),Q=d.n(N),C=d(49865);function te(G){const{username:$,otherCursor:I}=G,{color:R,objectIds:b}=I,K=(0,c.tq)(),k=(0,W.ug)(),{select:de}=(0,V.c)(),j=Object.values(b).flat(),X=(0,x.Nj)(),z=j.some(L=>X.has(L));return(0,e.jsx)("button",{disabled:j.length===0,className:"".concat(Q().user," ").concat(z?Q().hasOverlap:""),style:{backgroundColor:R},title:$,onClick:()=>{if(j.length!==0)if(j.length===1){const L=k.getFeatureById(j[0]);if(!L)return;de(L),K(new F.Z(L.id,L.__typename==="ObjectAnnotation"?F.F.Object:F.F.Spline))}else{const L=j.map(re=>k.getFeatureById(re)).filter(re=>re!=null);if(L.length===0)return;de(L),K(new F.Z(L.map(re=>re.id),F.F.MultiselectedObjects))}},children:$[0].toLocaleUpperCase()})}function ne(){const G=(0,C.tp)();return(0,M.ye)("useNewUserProfileDisplay",!1)?null:(0,e.jsx)(T.Z,{children:(0,e.jsx)("div",{className:Q().users,children:Object.entries(G).map(I=>{let[R,b]=I;return(0,e.jsx)(te,{username:R,otherCursor:b},R)})})})}},49971:function(Me,fe,d){"use strict";d.d(fe,{A:function(){return je}});var e=d(10081),M=d(12694),T=d(56223),V=d(82039),x=d(85385),c=d(62831),W=d(32593),F=d(4726),N=d(64267),Q=d(65117),C=d(54446);function te(B){let{providerType:w,providers:O,selectedProviderId:A,onProviderSwitch:H,onProviderChange:_,placeholder:J="Select ".concat(w,"..."),ariaLabel:D="Select ".concat(w),...oe}=B;const ee=async ge=>{if(!(!ge||typeof ge!="string"))try{await H(ge);const be=(0,C.Mh)(O,ge,w);be&&_&&_(be)}catch(be){console.error("Failed to switch ".concat(w," provider:"),be)}};return(0,e.jsx)(x.guY,{selectedKey:A,onSelectionChange:ee,placeholder:J,"aria-label":D,...oe})}var ne=d(30385);function G(B){let{availableImageryProviders:w,onImageryChange:O,...A}=B;const{sections:H,imageryProviders:_,selectedImageryId:J,switchImageryProvider:D,isLoading:oe}=(0,ne.b)({availableImageryProviders:w}),{autoShowIfHidden:ee}=(0,c.M)(),ge=async be=>{ee(),await D(be)};return(0,e.jsx)(te,{providerType:"imagery",providers:_,selectedProviderId:J,onProviderSwitch:ge,onProviderChange:O,isLoading:oe,sections:H,placeholder:"Select imagery...",ariaLabel:"Select imagery",...A})}function $(){const B=(0,F.wT)(),w=(0,V.TL)(),O=(0,Q.Y1)();return B?.viewer?(0,e.jsx)(c.p,{isVisible:O,onShow:()=>w((0,Q.YV)(!0)),children:(0,e.jsx)(I,{})}):null}function I(){const B=(0,V.TL)(),w=(0,Q.FO)(),{isVisible:O,areControlsVisuallyDisabled:A,autoShowIfHidden:H}=(0,c.M)(),_=T.useMemo(()=>(0,N.q)(),[]),J=oe=>{H(),B((0,Q.eR)(oe))},D=oe=>{B((0,Q.YV)(oe))};return(0,e.jsxs)(x.wk8,{children:[(0,e.jsxs)("div",{className:"flex h-5 flex-row items-center justify-between",children:[(0,e.jsx)(x.gY2,{isQuiet:!0,children:"Globe"}),(0,e.jsx)(x.OcD,{size:"sm",placeholder:"Enter an address or landmark"})]}),(0,e.jsx)(x.ffg,{wide:(0,e.jsx)(G,{availableImageryProviders:_,size:"sm",isVisuallyDisabled:A}),narrow:(0,e.jsx)(x.C2l,{label:W.r00,title:"Globe opacity",description:A?"Globe is hidden. Changing settings will automatically show it.":void 0,value:w,onChange:J,formatOptions:{minimumFractionDigits:0,maximumFractionDigits:0},isVisuallyDisabled:A}),endItem2:(0,e.jsx)(x.bxU,{isSelected:O,onChange:D,showText:"Show globe",hideText:"Hide globe"})})]})}var R=d(93920);function b(){const B=(0,V.TL)(),w=(0,R.iJ)(ee=>ee.measurements),O=(0,R.iJ)(ee=>{var ge;return(ge=ee.fishbones)!==null&&ge!==void 0?ge:!0}
247),A=(0,R.W)(),H=(0,R.fU)(),_=ee=>{B((0,R.Wd)(ee))},J=ee=>{B((0,R.l6)(ee))},D=ee=>{B((0,R.vA)(ee))},oe=ee=>{B((0,R.Wo)(ee))};return(0,e.jsxs)(x.wk8,{children:[(0,e.jsx)("div",{className:"flex h-5 flex-row items-center justify-between",children:(0,e.jsx)(x.gY2,{isQuiet:!0,children:"Overlays"})}),(0,e.jsx)(x.zNw,{columns:1,children:(0,e.jsx)(x.P2T,{className:"pl-2",isSelected:w,onChange:_,children:"Measurements"})}),(0,e.jsx)(x.zNw,{columns:1,children:(0,e.jsx)(x.P2T,{className:"pl-2",isSelected:O,onChange:J,children:"Stencils"})}),(0,e.jsx)(x.zNw,{columns:1,children:(0,e.jsx)(x.P2T,{className:"pl-2",isSelected:A,onChange:D,children:"Trajectory"})}),(0,e.jsx)(x.zNw,{columns:1,children:(0,e.jsx)(x.P2T,{className:"pl-2",isSelected:H,onChange:oe,children:"Object pins"})})]})}var K=d(29063);function k(){const B=(0,V.TL)(),w=(0,K.ow)(),O=A=>{B((0,K.Au)(A))};return(0,e.jsxs)(x.wk8,{children:[(0,e.jsx)("div",{className:"flex h-5 flex-row items-center justify-between",children:(0,e.jsx)(x.gY2,{isQuiet:!0,children:"Minimap"})}),(0,e.jsx)(x.zNw,{columns:1,children:(0,e.jsx)(x.P2T,{className:"pl-2",isSelected:w,onChange:O,children:"Show minimap"})})]})}var de=d(51566),j=d(109);function X(){return(0,R.FE)(B=>{const w=Object.keys(B.pointCloudStyle);return w.length>0?w[0]:void 0})}function z(){return(0,R.FE)(B=>Object.keys(B.pointCloudStyle))}const L={plasma:"Plasma",turbo:"Turbo",viridis:"Viridis",jet:"Jet",inverseJet:"Inverse Jet",nipySpectral:"Spectral",ironThermal:"Iron",grayscale:"Grayscale"},re={plasma:"bg-gradient-to-l from-[#951a66] to-[#0a0768]",viridis:"bg-gradient-to-r from-[#40014f] to-[#086c68] via-[#1e2953] via-[65.385%]",turbo:"bg-gradient-to-r from-[#1c0a22] to-[#4abd22] via-[#176ab8] via-[50.962%]",jet:"bg-gradient-to-r from-[#00005c] to-[#1bc07b] via-[#0004df] via-[48.558%]",inverseJet:"bg-gradient-to-r from-[#6e0000] to-[#b7a101] via-[#b93400] via-50%",ironThermal:"bg-gradient-to-r from-[#020b1f] to-[#b2272d] via-[#4e0050] via-[51.923%]",nipySpectral:"bg-gradient-to-r from-[#4f005c] from-[2.404%] to-[#05aa02] to-[96.635%] via-[#0f0087] via-[49.038%]",grayscale:"bg-gradient-to-l from-[#ffffff] to-[#050505] to-[88.942%] via-[#828282] via-[44.471%]"},q={transparentRGB:"bg-[linear-gradient(to_right,#885520_0%,#DDC368_21%,#EFE48B_39%,#C4BB6C_61%,#869161_82%,#455A3C_100%)]",zValueRainbow:"bg-[linear-gradient(to_right,#951A1A_0%,#FFA600_27%,#F6FF00_50%,#00FF1A_71%,#0A0768_96%)]"};function pe(B){if(typeof B=="object"&&B&&"specType"in B)return B.specType}function ce(B,w){if(!B)return;const O=w.options[w.selected];if(!O||O.displayName!=="LiDAR Intensity")return;const A=j._E.guard(O.spec)?O.spec:void 0;if(A&&typeof A=="object"&&"specType"in A&&A.specType==="single-attribute"&&"scale"in A)return A.scale}function m(){const B=X(),w=z(),{areControlsVisuallyDisabled:O,autoShowIfHidden:A}=(0,c.M)(),H=(0,V.TL)(),_=(0,R.aA)(B,Ze=>Ze);if(!B)return null;const J=_?.color;if(!j.Ps.guard(J))return null;const D=J.options.map((Ze,Le)=>({spec:Ze,i:Le})),oe=D.filter((Ze,Le)=>{let{spec:Ye}=Ze;return D.findIndex(Mt=>{let{spec:Ft}=Mt;return Ft.displayName===Ye.displayName})===Le}).sort((Ze,Le)=>Ze.spec.displayName.localeCompare(Le.spec.displayName)),ee=oe.find(Ze=>{let{spec:Le}=Ze;return Le.displayName==="LiDAR Intensity"}),ge=ce(B,J),be=oe.filter(Ze=>{let{spec:Le}=Ze;return Le.displayName!=="LiDAR Intensity"}).map(Ze=>{let{spec:Le,i:Ye}
247=Ze;const Mt=pe(Le.spec);return{id:Ye.toString(),textValue:Le.displayName,renderLeftContent:Mt&&q[Mt]?()=>(0,e.jsx)("div",{className:"size-3 rounded-sm ".concat(q[Mt])}):void 0}}),Be=ee?j.aJ.map(Ze=>({id:"intensity-".concat(Ze),textValue:L[Ze],renderLeftContent:()=>(0,e.jsx)("div",{className:"size-3 rounded-sm ".concat(re[Ze])})})):[],Re=[];be.length>0&&Re.push({header:"Colorization",options:be}),Be.length>0&&Re.push({header:"LiDAR intensity",options:Be});let ze;ee&&J.selected===ee.i&&ge?ze="intensity-".concat(ge):ze=J.selected.toString();const st=Ze=>{if(Ze===null)return;A();const Le=Ze.toString();if(Le.startsWith("intensity-")){const Ye=Le.replace("intensity-","");ee&&J.selected!==ee.i&&H((0,R.Fn)(w,ee.i)),H((0,R.GH)(w,Ye))}else{const Ye=parseInt(Le);H((0,R.Fn)(w,Ye))}};return(0,e.jsx)(x.guY,{sections:Re,selectedKey:ze,onSelectionChange:st,placeholder:"Select point cloud color...","aria-label":"Select point cloud color",isVisuallyDisabled:O})}var ve=d(89932),Te=d(94282);function xe(B){const w=(0,R.aA)(B||void 0,Ye=>Ye),O=z(),A=(0,V.TL)(),H=(0,Te.J5)(B||""),_=(0,Q.ib)(),J={config:{displayName:"Contour band height",minBound:.01,maxBound:1,currentValue:.2,unit:"m",step:.01,isAvailable:!1},handlers:{setValue:()=>{}}};if(!B||!w||!H)return J;const D=w.color,oe=(0,j.Sl)(D??"rgb");if(typeof oe=="string"||!("specType"in oe)||oe.specType!=="zValueRainbow")return J;const ee=oe,ge=H.projectUnitInfo.displayUnit;var be;const Be=(be=ee.contourBandHeight)!==null&&be!==void 0?be:j.t7.contourBandHeight,Re=(0,ve.BI)(Be,_,ge,3),ze=(0,ve.BI)(.01,_,ge,3),st=(0,ve.BI)(1,_,ge,3);return{config:{displayName:"Contour band height",minBound:ze,maxBound:st,currentValue:Re,unit:_,step:.01,isAvailable:!0},handlers:{setValue:Ye=>{const Mt=(0,ve.BI)(Ye,ge,_,3);A((0,R.UE)(O,Mt))}}}}function we(){const B=X(),{config:w,handlers:O}=xe(B||null);if(!B||!w.isAvailable)return null;const A=w.unit?" ".concat(w.unit):"";return(0,e.jsxs)(x.wk8,{children:[(0,e.jsx)(x.gY2,{children:"Contour band height"}),(0,e.jsx)(x.zNw,{columns:1,size:"md",children:(0,e.jsx)(x.nJ3,{label:"Height",title:"".concat(w.displayName," - controls the width of elevation color bands"),description:"Smaller values create more detailed elevation bands, larger values create broader bands",placement:"top",value:w.currentValue,onChange:O.setValue,minValue:w.minBound,maxValue:w.maxBound,step:w.step,placeholder:"".concat(w.minBound).concat(A)})}),(0,e.jsx)(x.zNw,{columns:1,size:"md",children:(0,e.jsx)(x.KlT,{value:w.currentValue,onChange:O.setValue,minValue:w.minBound,maxValue:w.maxBound,step:w.step,variant:"default",className:"pl-1",shouldShowOutput:!1})})]})}var Xe=d(29092);function le(B){const w=(0,R.aA)(B||void 0,Le=>Le),O=z(),A=(0,V.TL)(),H={config:{displayName:"Intensity",minBound:0,maxBound:255,currentMin:0,currentMax:255,unit:"",step:1,isAvailable:!1},handlers:{setMin:()=>{},setMax:()=>{},setRange:()=>{},setRangeFromArray:()=>{}}};if(!B||!w||typeof w!="object"||!w.color)return H;const _=w.color,J=(0,j.Sl)(_??"rgb");if(typeof J=="string"||!("specType"in J)||J.specType!=="single-attribute")return H;const D=J,oe=D.interactionMode,ee=Le=>{const Ye=oe.type==="thermal"?(0,Xe.P)(Le):Le;A((0,R.nC)(O,Ye))},ge=Le=>{const Ye=oe.type==="thermal"?(0,Xe.P)(Le):Le;A((0,R.Od)(O,Ye))};let be;if(oe.type==="intensity"){var Be,Re;be={displayName:oe.displayName,minBound:0,maxBound:255,currentMin:(Be=D.min)!==null&&Be!==void 0?Be:0,currentMax:(Re=D.max)!==null&&Re!==void 0?Re:255,unit:"",step:1,isAvailable:!0}}else if(oe.type==="thermal")be={displayName:oe.displayName,minBound:0,maxBound:50,currentMin:D.min?(0,Xe.T)(D.min):0,currentMax:D.max?(0,Xe.T)(D.max):40,unit:"\xB0C",step:1,isAvailable:!0};else if(oe.type==="sensor"){var ze,st;be={displayName:oe.displayName,minBound:oe.min,maxBound:oe.max,currentMin:(ze=D.min)!==null&&ze!==void 0?ze:oe.min,currentMax:(st=D.max)!==null&&st!==void 0?st:oe.max,unit:oe.unitName||"",step:(oe.max-oe.min)/1e3,isAvailable:!0}}else return H;const Ze={setMin:Le=>{const Ye=Math.min(Le,be.currentMax);ee(Ye)},setMax:Le=>{const Ye=Math.max(Le,be.currentMin);ge(Ye)},setRange:(Le,Ye)=>
247{const Mt=Math.min(Le,Ye),Ft=Math.max(Le,Ye);ee(Mt),ge(Ft)},setRangeFromArray:Le=>{if(Array.isArray(Le)&&Le.length===2){const[Ye,Mt]=Le;Ze.setRange(Ye,Mt)}}};return{config:be,handlers:Ze}}function Se(){const B=X(),{config:w,handlers:O}=le(B||null);return w.isAvailable?(0,e.jsx)(x.KlT,{value:[w.currentMin,w.currentMax],onChange:O.setRangeFromArray,minValue:w.minBound,maxValue:w.maxBound,step:w.step,variant:"default",className:"pl-1",shouldShowOutput:!1,"aria-label":"Intensity range"}):null}function _e(){const B=X(),{config:w,handlers:O}=le(B||null);if(!B||!w.isAvailable)return null;const A=w.unit?" ".concat(w.unit):"";return(0,e.jsxs)(x.wk8,{children:[(0,e.jsx)(x.gY2,{children:"LiDAR intensity range"}),(0,e.jsxs)(x.zNw,{columns:2,size:"md",children:[(0,e.jsx)(x.nJ3,{label:"Min",title:"Minimum ".concat(w.displayName),placement:"top",value:w.currentMin,onChange:O.setMin,minValue:w.minBound,maxValue:w.currentMax,step:w.step,placeholder:"".concat(w.minBound).concat(A)}),(0,e.jsx)(x.nJ3,{label:"Max",title:"Maximum ".concat(w.displayName),placement:"top",value:w.currentMax,onChange:O.setMax,minValue:w.currentMin,maxValue:w.maxBound,step:w.step,placeholder:"".concat(w.maxBound).concat(A)})]}),(0,e.jsx)(x.zNw,{columns:1,size:"md",children:(0,e.jsx)(Se,{})})]})}function Ue(B){const w=(0,R.aA)(B||void 0,ge=>ge?.zSlice),O=z(),A=(0,V.TL)(),H={config:{displayName:"Z slice",minBound:R.ZO,maxBound:R.En,currentMin:-2.5,currentMax:2.5,unit:"m",step:.1,isAvailable:!1},handlers:{setMin:()=>{},setMax:()=>{},setRange:()=>{},setRangeFromArray:()=>{}}};if(!B||!w)return H;const _=w.center-w.thickness/2,J=w.center+w.thickness/2,D={displayName:"Z slice",minBound:R.ZO,maxBound:R.En,currentMin:_,currentMax:J,unit:"m",step:.1,isAvailable:!0},oe=(ge,be)=>{const Be=(ge+be)/2,Re=be-ge;A((0,R.Ss)(O,{...w,center:Be,thickness:Re}))},ee={setMin:ge=>{const be=Math.min(ge,D.currentMax);oe(be,D.currentMax)},setMax:ge=>{const be=Math.max(ge,D.currentMin);oe(D.currentMin,be)},setRange:(ge,be)=>{const Be=Math.min(ge,be),Re=Math.max(ge,be);oe(Be,Re)},setRangeFromArray:ge=>{if(Array.isArray(ge)&&ge.length===2){const[be,Be]=ge;ee.setRange(be,Be)}}};return{config:D,handlers:ee}}function ke(){const B=X(),{config:w,handlers:O}=Ue(B||null);return w.isAvailable?(0,e.jsx)(x.KlT,{value:[w.currentMin,w.currentMax],onChange:O.setRangeFromArray,minValue:w.minBound,maxValue:w.maxBound,step:w.step,variant:"default",className:"pl-1",shouldShowOutput:!1}):null}function rt(){const B=X(),{config:w,handlers:O}=Ue(B||null);if(!B||!w.isAvailable)return null;const A=w.unit?" ".concat(w.unit):"";return(0,e.jsxs)(x.wk8,{children:[(0,e.jsx)(x.gY2,{children:"Z slice"}),(0,e.jsxs)(x.zNw,{columns:2,size:"md",children:[(0,e.jsx)(x.nJ3,{label:"Min",title:"Minimum ".concat(w.displayName.toLowerCase()),placement:"top",value:w.currentMin,onChange:O.setMin,minValue:w.minBound,maxValue:w.currentMax,step:w.step,placeholder:"".concat(w.minBound).concat(A),formatOptions:{maximumFractionDigits:2}}),(0,e.jsx)(x.nJ3,{label:"Max",title:"Maximum ".concat(w.displayName.toLowerCase()),placement:"top",value:w.currentMax,onChange:O.setMax,minValue:w.currentMin,maxValue:w.maxBound,step:w.step,placeholder:"".concat(w.maxBound).concat(A),formatOptions:{maximumFractionDigits:2}})]}),(0,e.jsx)(x.zNw,{columns:1,size:"md",children:(0,e.jsx)(ke,{})})]})}function dt(){const B=X(),w=z(),{areControlsVisuallyDisabled:O,autoShowIfHidden:A}=(0,c.M)(),H=(0,V.TL)(),_=(0,R.aA)(B,ze=>ze);if(!B)return null;var J;const D=(J=_?.pointSize)!==null&&J!==void 0?J:3;var oe;const ee=(0,j.Sl)((oe=_?.color)!==null&&oe!==void 0?oe:"rgb"),ge=typeof D!="number"||D<2,be=O||ge;if(typeof ee=="string")return null;const Be=typeof ee.opacity>"u"?1:ee.opacity,Re=ze=>{A(),H((0,R.Jb)(w,ze))};return(0,e.jsx)(x.C2l,{title:"Opacity",description:O?"Point cloud is hidden. Changing settings will automatically show it.":ge?"Opacity control is only available when point size is 2px or larger":void 0,label:W.r00,value:Be,onChange:Re,formatOptions:{minimumFractionDigits:0,maximumFractionDigits:0},isVisuallyDisabled:be})}var ye=d(49550);function yt(){const B=X(),w=z(),{areControlsVisuallyDisabled:O,autoShowIfHidden:A}=(0,c.M)(),H=(0,V.TL)(),_=(0,R.aA)(B,ee=>ee);if(!B)return null;var J;const D=(J=_?.pointSize)!==null&&J!==void 0?J:3,oe=ee=>{ee!==null&&ee>0&&(A(),H((0,R.$$)(w,Math.round(ee))))};return(0,e.jsx)(ye.t,{title:"Point Size",description:O?"Point cloud is hidden. Changing settings will automatically show it.":void 0,label:W.d6L,value:typeof D=="number"?D:3,onChange:oe,minValue:1,maxValue:20,scrubThreshold:10,step:1,isVisuallyDisabled:O})}function Lt(){const B=X(),w=z(),{areControlsVisuallyDisabled:O,autoShowIfHidden:A}=(0,c.M)(),H=(0,V.TL)(),_=(0,R.aA)(B,Re=>Re?.filters),J=(0,R.aA)(B,Re=>Re?.zSlice);if(!B)return null;const D=_?.ground,ee=[{options:[{id:"undefined",textValue:"All",description:"Show all points in the point cloud",renderLeftContent:()=>(0,e.jsx)("div",{className:"size-3 text-icon-menu",children:W.W$$})},{id:"true",textValue:"Ground",description:"Show only ground points",renderLeftContent:()=>(0,e.jsx)("div",{className:"size-3 text-icon-menu",children:W.chv})},{id:"above-ground",textValue:"Above ground",description:"Show only points above the ground level",renderLeftContent:()=>(0,e.jsx)("div",{className:"size-3 text-icon-menu",children:W.jwO})},{id:"focus-on-selected-object",textValue:"Selected",description:"Show only points around the selected object",renderLeftContent:()=>(0,e.jsx)("div",{className:"size-3 text-icon-menu",children:W.HRB})},{id:"height-slice",textValue:"Z slice",description:"Show only points within a specific height range",renderLeftContent:()=>(0,e.jsx)("div",{className:"size-3 text-icon-menu",children:W.P3r})}]}];let ge;J?ge="height-slice":ge=String(D);const be=Re=>{A(),Re==="height-slice"?(H((0,R.q4)(w,{..._,ground:void 0})),H((0,R.Ss)(w,{version:1,thickness:10,center:0}))):(H((0,R.Ss)(w,void 0)),H((0,R.q4)(w,{..._,ground:Re})))},Be=Re=>{if(Re!==null){const ze=Re.toString();ze==="undefined"?be(void 0):ze==="true"?be(!0):ze==="above-ground"?be("above-ground"):ze==="focus-on-selected-object"?be("focus-on-selected-object"):ze==="height-slice"&&be("height-slice")}};return(0,e.jsx)(x.guY,{sections:ee,selectedKey:ge,onSelectionChange:Be,placeholder:"Select point cloud filter...","aria-label":"Select point cloud filter",isVisuallyDisabled:O})}function bt(B){return!!(0,R.aA)(B,O=>O?.zSlice)}function Ae(B){const w=(0,R.aA)(B,H=>
247H);if(!B||!w||!w.color)return!1;const O=w.color,A=(0,j.Sl)(O??"rgb");return typeof A=="object"&&"specType"in A&&A.specType==="zValueRainbow"}function Fe(B){const w=(0,R.aA)(B,_=>_);if(!B||!w||!w.color)return!1;const O=w.color;if(!j.Ps.guard(O))return!1;const A=O.options[O.selected];if(!A)return!1;if(A.displayName==="LiDAR Intensity")return!0;const H=j._E.guard(A.spec)?A.spec:void 0;return!!(H&&typeof H=="object"&&"specType"in H&&H.specType==="single-attribute"&&"attribute"in H&&H.attribute==="${Intensity}")}function Ve(){const B=X(),w=(0,V.TL)(),O=(0,R.WY)(B||"");return B?(0,e.jsx)(c.p,{isVisible:O,onShow:()=>w((0,R.Qk)(B,!0)),children:(0,e.jsx)(We,{pcKey:B})}):null}function We(B){let{pcKey:w}=B;const O=(0,V.TL)(),[A,H]=T.useState(!1),[_,J]=T.useState(!1),{isVisible:D,areControlsVisuallyDisabled:oe,autoShowIfHidden:ee}=(0,c.M)(),ge=Fe(w),be=bt(w),Be=Ae(w),Re=T.useMemo(()=>ge||Be,[ge,Be]),ze=T.useMemo(()=>be,[be]);T.useEffect(()=>{!Re&&A&&H(!1)},[Re,A]),T.useEffect(()=>{!ze&&_&&J(!1)},[ze,_]);const st=Ye=>{O((0,R.Qk)(w,Ye))},Ze=Ye=>{Ye&&ee(),H(Ye)},Le=Ye=>{Ye&&ee(),J(Ye)};return(0,e.jsxs)(x.wk8,{children:[(0,e.jsx)("div",{className:"flex h-5 flex-row items-center justify-between",children:(0,e.jsx)(x.gY2,{isQuiet:!0,children:"Point cloud"})}),(0,e.jsx)(x.ffg,{wide:(0,e.jsx)(m,{}),narrow:(0,e.jsx)(dt,{}),endItem1:(0,e.jsxs)(de.hg,{isOpen:A,onOpenChange:Ye=>{Ye&&!Re||Ze(Ye)},children:[(0,e.jsx)(x.EEn,{isSelected:A,isVisuallyDisabled:oe||!Re,title:"Intensity & Color Settings",description:oe?"Point cloud is hidden. Changing settings will automatically show it.":Re?void 0:"Available when point cloud color is set to LiDAR Intensity or Elevation Rainbow",children:W.duR}),(0,e.jsx)(x.uvk,{placement:"bottom end",showArrow:!0,children:(0,e.jsxs)(de.Vq,{className:"outline-none",children:[(0,e.jsx)(_e,{}),Be&&(0,e.jsx)(we,{})]})})]}),endItem2:(0,e.jsx)(x.bxU,{isSelected:D,onChange:st,showText:"Show point cloud",hideText:"Hide point cloud"})}),(0,e.jsx)(x.ffg,{wide:(0,e.jsx)(Lt,{}),narrow:(0,e.jsx)(yt,{}),endItem1:(0,e.jsxs)(de.hg,{isOpen:_,onOpenChange:Ye=>{Ye&&!ze||Le(Ye)},children:[(0,e.jsx)(x.EEn,{isSelected:_,isVisuallyDisabled:oe||!ze,title:"Z Slice Settings",description:oe?"Point cloud is hidden. Changing settings will automatically show it.":ze?void 0:"Available when Z slice filter is selected",children:W.duR}),(0,e.jsx)(x.uvk,{placement:"bottom end",showArrow:!0,children:(0,e.jsx)(de.Vq,{className:"outline-none",children:be&&(0,e.jsx)(rt,{})})})]})})]})}function je(){const B=(0,M.ye)("useNewCameraSettingsUi",!1);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)($,{}),(0,e.jsx)(Ve,{}),(0,e.jsx)(b,{}),B&&(0,e.jsx)(k,{})]})}},54446:function(Me,fe,d){"use strict";d.d(fe,{Mh:function(){return c},UB:function(){return T},ng:function(){return x}});var e=d(10081),M=d(56223);function T(W,F){return"".concat(W,"-").concat(F)}function V(W,F){return parseInt(W.replace("".concat(F,"-"),""))}function x(W,F,N){return{id:T(F,N),textValue:W.name,renderLeftContent:W.iconUrl?Q=>{let{option:C}=Q;return(0,e.jsx)("img",{src:W.iconUrl,alt:"".concat(W.name," preview"),className:"size-3 rounded-sm object-cover"})}:void 0,tooltipTitle:W.name,tooltipDescription:W.tooltip,tooltipImgUrl:W.iconUrl}}function c(W,F,N){const Q=V(F,N);return W[Q]}},30385:function(Me,fe,d){"use strict";d.d(fe,{b:function(){return Q}});var e=d(50201),M=d(54446);function T(C,te,ne){if(!ne||ne.length===0)return[{options:C.map((R,b)=>(0,M.ng)(R,te,b))}];const G=new Map,$=[];C.forEach(R=>{const b=ne.find(K=>K.predicate(R));if(b){const K=G.get(b.header)||[];G.set(b.header,[...K,R])}else $.push(R)});const I=[];return ne.forEach(R=>{const b=G.get(R.header);b&&b.length>0&&I.push({header:R.header,options:b.map(K=>{const k=C.indexOf(K);return(0,M.ng)(K,te,k)})})}),$.length>0&&I.push({header:"Other",options:$.map(R=>{const b=C.indexOf(R);return(0,M.ng)(R,te,b)})}),I}function V(C){var te;const ne=C.name.toLowerCase();var G;const $=(G=(te=C.tooltip)===null||te===void 0?void 0:te.toLowerCase())!==null&&G!==void 0?G:"";return/^(bing|ion)\b/i.test(C.name)||/cesium ion/i.test($)||/^(esri|osm)\b/i.test(C.name)}
247var x=d(56223),c=d(4726);function W(C){let{providers:te,type:ne,onProviderCreate:G,onProviderApply:$}=C;const I=(0,c.wT)(),R=I?.viewer,[b,K]=(0,x.useState)((0,M.UB)(ne,0)),[k,de]=(0,x.useState)(!1),j=(0,x.useRef)(!0);(0,x.useEffect)(()=>()=>{j.current=!1},[]),(0,x.useEffect)(()=>{const L=te.length-1;parseInt(b.replace("".concat(ne,"-"),""))>L&&K((0,M.UB)(ne,0))},[te,b,ne]);const X=(0,x.useCallback)(async L=>{if(!R||k)return;const re=(0,M.Mh)(te,L,ne);if(!(!re||!j.current)){de(!0);try{const q=await G(re);j.current&&($(R,q),K(L))}catch(q){console.error("Failed to switch ".concat(ne," provider:"),q)}finally{j.current&&de(!1)}}},[R,te,ne,G,$,k]),z=(0,M.Mh)(te,b,ne);return{selectedProviderId:b,selectedProvider:z,switchProvider:X,isLoading:k}}async function F(C){const te=C.creationCommand;return e.Z.fromProviderAsync(te())}function N(C,te){var ne,G;const $=C.imageryLayers.get(0);$&&C.imageryLayers.remove($,!0),C.imageryLayers.add(te,0),(ne=(G=C.scene).requestRender)===null||ne===void 0||ne.call(G)}function Q(){let{availableImageryProviders:C=[]}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{selectedProviderId:te,selectedProvider:ne,switchProvider:G,isLoading:$}=W({providers:C,type:"imagery",onProviderCreate:F,onProviderApply:N});return{sections:T(C,"imagery",[{predicate:V,header:"Cesium ion"}]),imageryProviders:C,selectedImageryId:te,selectedImageryProvider:ne,switchImageryProvider:G,isLoading:$}}},58699:function(Me,fe,d){"use strict";d.d(fe,{Z:function(){return x}});var e=d(10081),M=d(514),T=d(56223),V=d(31184);function x(){const[c,W]=(0,T.useState)(!1);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(M.Button,{icon:"settings",minimal:!0,onClick:()=>W(!0),title:"Settings"}),(0,e.jsx)(V.Z,{isOpen:c,onClose:()=>W(!1)})]})}},31184:function(Me,fe,d){"use strict";d.d(fe,{Z:function(){return R}});var e=d(10081),M=d(514),T=d(72994),V=d(57302),x=d(19432),c=d(4726),W=d(68717),F=d(79227),N=d(7943),Q=d(89932),C=d(27761),te=d(24100),ne=d(82039),G=d(91681),$=d(90891),I=d(65117);function R(K){const k=(0,ne.TL)(),de=(0,$.Bz)(),j=(0,I.oj)(),X=(0,I.Aq)(),z=(0,I.Oz)(),L=(0,I.ib)(),re=(0,I.Fj)(D=>D.showAllExportPositionsOverride),q=(0,I.Fj)(D=>D.showAllModelsOverride),pe=(0,G.jk)(D=>D.crossSection!==null),ce=(0,I.ws)(),m=(0,I.mH)(),ve=(0,I.tL)(),Te=(0,I.zx)(),xe=(0,I.qC)(),we=(0,c.wT)(),Xe=(0,I.xq)(),le=(0,I.fn)(),Se=(0,I.P9)(),_e=(0,I.Rk)(),Ue=(0,I.oP)(),ke=(0,I.T0
247)(),rt=(0,I.sH)(),dt=(0,I.bc)(),ye=(0,I.N)(),yt=(0,I.Uq)(),Lt=(0,I.M2)(),bt=(0,I.rA)(),Ae=(0,I.Re)(),Fe=(0,I.t1)(),Ve=(0,I.N6)(),We=(0,I.Uk)(),je=(0,I.E7)(),B=(0,I.YE)(),w=(0,W.ye)("testFeatureFlag",!1),O=(0,I.mx)(),A=(0,I.F3)(),H=(0,I.A9)(),_=(0,I.F6)(),J=(0,I.af)();return(0,e.jsxs)(M.Dialog,{isOpen:K.isOpen,onClose:K.onClose,title:"Display settings",className:T.Pyr,children:[(0,e.jsxs)("div",{className:T.TmF,children:[(0,e.jsx)(M.FormGroup,{label:"Display Units",children:(0,e.jsx)(F.Z,{value:L,onChange:D=>{D!==void 0&&k((0,I.Sm)(D))},getOptionName:D=>"",getOptionInfo:D=>(0,Q.lS)(D),selectOptions:Q.PF,defaultText:"Select a unit of measurement"})}),(0,e.jsxs)(M.FormGroup,{label:"Model display settings",children:[(0,e.jsx)(M.Checkbox,{label:"Show all object export position",checked:re,onChange:D=>{k((0,I.LP)(!re))}}),(0,e.jsx)(M.Checkbox,{label:"Show all object models",checked:q,onChange:D=>{k((0,I.LM)(!q))}})]}),(0,e.jsxs)(M.FormGroup,{label:"Lines settings",children:[(0,e.jsx)(M.Checkbox,{label:"Always show lines on top",checked:ve,onChange:D=>{k((0,I.PO)(!ve))}}),(0,e.jsx)(M.Checkbox,{label:"Enable multi-line editing",checked:B,onChange:D=>{k((0,I.Oi)(!B))}}),(0,e.jsxs)(C.RequireFeatureFlag,{featureFlag:"lineQaVisualization",featureFlagDefault:!1,children:[(0,e.jsx)(M.Checkbox,{label:"Highlight approval status",checked:le,onChange:D=>{k((0,I.K2)(!le))}}),(0,e.jsx)(M.Checkbox,{label:"Display in QA mode",checked:Se,onChange:D=>{k((0,I.q_)(!Se))}}),Se&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(b,{label:"QA Mode Scale",children:(0,e.jsx)(N.K,{min:0,max:1,initialValue:_e,stepSize:.1,significantFigures:1,labelStepSize:.1,onChange:D=>(k((0,I.vz)(D)),D)})}),(0,e.jsxs)(b,{label:"Endcap scale",children:[(0,e.jsx)(M.Checkbox,{label:"Show End Caps",checked:rt,onChange:D=>{k((0,I.dN)(!rt))}}),rt&&(0,e.jsx)(N.K,{min:0,max:10,initialValue:dt,onChange:D=>(k((0,I.__)(D)),D),labelStepSize:1,stepSize:.1,significantFigures:1})]}),(0,e.jsxs)(b,{label:"Angle deviation threshold",children:[(0,e.jsx)(M.Checkbox,{label:"Show angle deviation",checked:Ue,onChange:D=>{k((0,I.Nu)(!Ue))}}),Ue&&(0,e.jsx)(N.K,{min:0,max:180,initialValue:ke,onChange:D=>(k((0,I.kL)(D)),D),labelStepSize:45,stepSize:1,significantFigures:0})]}),(0,e.jsxs)(b,{label:"Vertical angle deviation threshold",children:[(0,e.jsx)(M.Checkbox,{label:"Show vertical angle deviation",checked:We,onChange:D=>{k((0,I.BA)(!We))}}),We&&(0,e.jsx)(N.K,{min:0,max:180,initialValue:je,onChange:D=>(k((0,I.sR)(D)),D),labelStepSize:45,stepSize:1,significantFigures:0})]}),(0,e.jsxs)(b,{label:"Doubled vertex distance threshold (m)",children:[(0,e.jsx)(M.Checkbox,{label:"Show doubled vertex",checked:yt,onChange:D=>{k((0,I.xA)(!yt))}}),yt&&(0,e.jsx)(N.K,{min:0,max:1,initialValue:Lt,onChange:D=>(k((0,I.Uw)(D)),D),labelStepSize:.1,stepSize:.01,significantFigures:1})]}),(0,e.jsx)(b,{label:"Dashed line checker",children:(0,e.jsx)(M.Checkbox,{label:"Show dashed line checker",checked:bt,onChange:D=>{k((0,I._G)(!bt))}})}),(0,e.jsx)(b,{label:"Unset type checker",children:(0,e.jsx)(M.Checkbox,{label:"Show unset type flags",checked:Ae,onChange:D=>{k((0,I.a2)(!Ae))}})})]})]})]}),(0,e.jsx)(C.RequireFeatureFlag,{featureFlag:"crossSectionTool",featureFlagDefault:!1,children:pe&&(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)(M.FormGroup,{label:"Cross section settings",children:[(0,e.jsx)(b,{label:"Cross section vertex size",children:(0,e.jsx)(M.Slider,{min:I.t,max:I.In,stepSize:1,value:ce,onChange:D=>{k((0,I.wX)(D))},labelStepSize:I.In-I.t,labelRenderer:(D,oe)=>(oe?.isHandleTooltip,D.toString())})}),(0,e.jsx)(b,{label:"Cross section pointcloud brightness",children:(0,e.jsx)(M.Slider,{min:I.dY,max:I.nH,stepSize:.01,value:Ve,onChange:D=>{k((0,I.Xt)(D))}})}),(0,e.jsx)(b,{label:"Show Vertex Labels",children:(0,e.jsx)(M.Checkbox,{checked:m,onChange:()=>{k((0,I.Wv)(!m))}})})]})})}),(0,e.jsxs)(M.FormGroup,{label:"Color settings",children:[(0,e.jsx)(M.Checkbox,{label:"Color signs based on assemblies",checked:Te,onChange:D=>{k((0,I.bH)(!Te))}}),(0,e.jsx)(C.RequireFeatureFlag,{featureFlag:"lineQaVisualization",featureFlagDefault:!1,children:(0,e.jsx)(M.Checkbox,{label:"Color lines uniquely",checked:ye,onChange:D=>{k((0,I.K1)(!ye))}})})]}),(0,e.jsxs)(M.FormGroup,{label:"Performance settings",children:[(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"auto auto",gridTemplateRows:"auto auto",gap:"10px"},children:[(0,e.jsx)(M.Label,{children:"Graphics options"}),(0,e.jsx)(F.Z,{value:xe,onChange:D=>{D!==void 0&&k((0,I.UA)(D))},getOptionName:D=>D,selectOptions:[...I.Ot],defaultText:"Select a performance setting"}),(0,e.jsx)(M.Label,{children:"Plan view MaximumScreenSpaceError"}),(0,e.jsx)(F.Z,{value:Xe,onChange:D=>{D!==void 0&&k((0,I.Bx)(D))},selectOptions:[...I.yz],getOptionName:D=>D.toString(),getOptionInfo:D=>{switch(D){case 16:return"Low";case 32:return"Medium";case 48:return"High";case 64:return"Ultra";default:return"Default"}}})]}),(0,e.jsx)(M.Checkbox,{label:"Enable line antialiasing",checked:Fe,onChange:D=>{k((0,I.E_)(!Fe))}}),(0,e.jsx)(M.Checkbox,{label:"Use live collaboration",checked:O,onChange:D=>{k((0,I.x3)(!O))}})]}),(0,e.jsx)(te.Z,{children:(0,e.jsxs)(M.FormGroup,{label:"Camera tilt control",children:[(0,e.jsx)(M.Checkbox,{label:"Enable tilt event hijacking",checked:A,onChange:D=>{k((0,I.Tx)(!A))}}),A&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(b,{label:"Low height threshold (meters above terrain)",children:(0,e.jsx)(N.K,{min:1,max:100,initialValue:H,stepSize:1,significantFigures:0,labelStepSize:10,onChange:D=>(k((0,I.yK)(D)),D)})}),(0,e.jsx)(b,{label:"Height threshold multiplier",children:(0,e.jsx)(N.K,{min:1,max:100,initialValue:_,stepSize:1,significantFigures:0,labelStepSize:10,onChange:D=>(k((0,I.qv)(D)),D)})})]})]})}),(0,e.jsxs)(te.Z,{children:[(0,e.jsxs)(M.FormGroup,{label:"Perception settings",children:[(0,e.jsx)(M.Checkbox,{label:"Show final instanced cloud",checked:j,onChange:D=>{k((0,I.ax)(!j))}}),(0,e.jsx)(M.Checkbox,{label:"Show final rejected instanced cloud",checked:X,onChange:D=>{k((0,I.aN)(!X))}}),(0,e.jsx)(M.Label,{children:"Masks"}),(0,e.jsxs)(M.ButtonGroup,{children:[(0,e.jsx)(M.Button,{onClick:()=>k((0,I.gW)(null)),active:z===null,children:"None"}),(0,e.jsx)(M.Button,{onClick:()=>k((0,I.gW)("groundnet")),active:z==="groundnet",children:"Groundnet"}),(0,e.jsx)(M.Button,{onClick:()=>k((0,I.gW)("objnet")),active:z==="objnet",children:"Objnet"})]})]}),(0,e.jsxs)(M.FormGroup,{label:"Debug settings",children:[(0,e.jsx)(M.Checkbox,{label:"No scene picking on mouse move",checked:de.noScenePickingOnMouseMove,onChange:D=>{k((0,$.TZ)(!de.noScenePickingOnMouseMove))}}),(0,e.jsx)(M.Checkbox,{label:"Dense depth debug mode",checked:de.denseDepthDebugMode,onChange:D=>{k((0,$.Kb)(!de.denseDepthDebugMode))}}),(0,e.jsx)(M.Checkbox,{label:"Show 3D Tiles inspector",checked:de.showDebug3DTilesInspector,disabled:de.showDebug3DTilesInspector,onChange:D=>{we?.viewer&&(de.showDebug3DTilesInspector||(we.viewer.extend(V.Z),k((0,$.bV)(!0))))}}),(0,e.jsx)(M.Checkbox,{label:"Use Eptium",checked:de.shouldUseEptium,onChange:D=>{alert("Please refresh the page to see the changes."),k((0,$.B1)(!de.shouldUseEptium))}}),(0,e.jsx)(M.Checkbox,{label:"Show Cesium Inspector",checked:de.showDebugCesiumInspector,disabled:de.showDebugCesiumInspector,onChange:D=>{if(we?.viewer&&!de.showDebugCesiumInspector){var oe;const ee=(oe=we.globe)===null||oe===void 0?void 0:oe.depthTestAgainstTerrain;we.viewer.extend(x.Z),ee!==void 0&&we.globe&&(we.globe.depthTestAgainstTerrain=ee),k((0,$.Qm)(!0))}}}),(0,e.jsx)(M.Checkbox,{label:"Picking Debugger",checked:de.showPickingDebugger,onChange:D=>{k((0,$.DT)(!de.showPickingDebugger))}})]}),(0,e.jsx)(M.FormGroup,{label:"Suggestion settings",children:(0,e.jsx)(M.Checkbox,{label:"Show line suggestions",checked:J,onChange:D=>{k((0,I.xm)(!J))}})}),w&&(0,e.jsx)("span",{className:"mt-2 text-text-assistive",children:"testFeatureFlag enabled"})]})]}),(0,e.jsx)("div",{className:T.Alt,children:(0,e.jsx)("div",{className:T.e$L,children:(0,e.jsx)(M.Button,{onClick:K.onClose,children:"Close"})})})]})}function b(K){return(0,e.jsxs)("div",{children:[(0,e.jsx)(M.Label,{children:K.label}),(0,e.jsx)("div",{className:"mx-7 mt-2",children:K.children})]})}},94314:function(Me,fe,d){"use strict";d.d(fe,{J:function(){return b},o:function(){return R}});var e=d(10081),M=d(51282),T=d(16545),V=d(27453),x=d(56223),c=d(82039),W=d(35421),F=d(2769),N=d(17631),Q=d(93920),C=d(8703),te=d(10749),ne=d(21349),G=d(526),$=d(60528),I=d(63740);function R(K){const{measurement:k}=K,de=k.id,{select:j}=(0,V.cH)(),X=(0,x.useMemo)(()=>k.points.map(F.U),[k]),z=(0,W.ZP)(X),L=(0,W.QV)(z,we=>we.length<1?we:[...we,we[0]],(we,Xe)=>{Xe.length<1||we.set(Xe.slice(0,-1))}),re=(0,Q.iJ)(we=>
247we.measurements),q=(0,c.TL)(),pe=(0,N.WE)(we=>we.detail==="measurement"&&we.measurementKey===de),ce=(0,x.useCallback)(()=>{j(k)},[k,j]),m=(0,x.useCallback)(()=>{const we=z.get().map(F.M);q((0,T.w3)(we,de)),j(k)},[q,de,z,j,k]),[ve,Te]=(0,$.b)(),xe=(0,x.useCallback)(we=>{const Xe=b(we);return"".concat(ve(Xe)," ").concat(Te,"\xB2")},[ve,Te]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ne.cs,{points:L,color:C.K8,width:pe?3:2,show:re,onClick:ce,readonly:!1,pickableId:"measurement-".concat(de)}),(0,e.jsx)(I.r,{points:z,getLabel:xe,visible:re,onClick:ce,color:C.K8}),(0,e.jsx)(te.m_,{children:re&&(0,e.jsx)(G.m,{trackedPositions:z,color:C.K8,lineId:de,onSelect:ce,onDragEnd:m})})]})}function b(K){let k=0;for(let de=1;de<K.length-1;de++){const j=M.Z.subtract(K[0],K[de],new M.Z),X=M.Z.subtract(K[0],K[de+1],new M.Z),z=M.Z.magnitude(M.Z.cross(j,X,new M.Z))/2;k+=z}return k}},63740:function(Me,fe,d){"use strict";d.d(fe,{r:function(){return $}});var e=d(10081),M=d(55262),T=d(51282),V=d(71177),x=d(56223),c=d(29931),W=d(35421),F=d(8703),N=d(48649),Q=d(32907),C=d(30594),te=d(40104);function ne(I,R){const{scene:b}=(0,c.VQ)(),K=(0,x.useMemo)(()=>{const j=R.getValue();if(!j)return;const z=document.createElement("canvas").getContext("2d");return z.font="18px Inter",z.measureText(j)},[R]),k=(0,x.useCallback)(j=>{const X=I.getValue();if(!(!K||!X))return(0,Q.O_)(j.mousePosition,b,{position:X,imageWidth:K.width+12,imageHeight:24})},[b,K,I]);return(0,C.Kc)("location-label-".concat(I.toString(),"-").concat(R),k)}function G(I){const{position:R,label:b,onClick:K,labelStyleOverrides:k}=I,de=useMemo(()=>new NearFarScalar(200,1,1e3,.4),[]),j=useMemo(()=>wordwrap.wrap(b,{width:20}),[b]),X=useMemo(()=>new CallbackProperty(()=>R,!1),[R]),z=useMemo(()=>new CallbackProperty(()=>j,!1),[j]),L=ne(X,z);return j?_jsx(EventHandlerEntity,{position:R,ref:L,onClick:K,cursorOverride:"pointer",label:{text:j,font:"18px Inter",fillColor:Color.BLACK,backgroundColor:Color.WHITE,showBackground:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY,scaleByDistance:de,...k}}):null}function $(I){const{points:R,visible:b,onClick:K,color:k}=I,de=(0,x.useMemo)(()=>new M.Z(()=>{const L=R.get();if(L.length>=2){const re=new T.Z;for(let q=0;q<L.length;q++)T.Z.add(re,L[q],re);return T.Z.multiplyByScalar(re,1/L.length,new T.Z)}return T.Z.ZERO},!1),[R]),j=(0,W.QV)(R,L=>I.getLabel(L),(L,re)=>{}),X=(0,W.pJ)(j),z=ne(de,X);return(0,e.jsx)(N.ZP,{show:b,onClick:K,position:de,ref:z,children:(0,e.jsx)(c.az,{text:X,font:"18px Inter",fillColor:V.Z.BLACK,backgroundColor:k,showBackground:!0,eyeOffset:F.dU,scaleByDistance:F.Wr})})}},17311:function(Me,fe,d){"use strict";d.d(fe,{BN:function(){return F},LW:function(){return W},PB:function(){return x},Sf:function(){return Q},TZ:function(){return N},xH:function(){return c},yf:function(){return T}});var e=d(51282),M=d(8058);const T=1e-5;function V(C){return new e.Z(C.x,C.y,C.z)}function x(C){return C.coords.map(te=>V(te))}function c(C,te){return{line:C,segmentStart:0,segmentT:0,segmentPoint:te.ecef_from_project_point(V(C.coords[0])),distance:0}}function W(C,te){return{line:C,segmentStart:C.coords.length-2,segmentT:1,segmentPoint:te.ecef_from_project_point(V(C.coords[C.coords.length-1])),distance:0}}function F(C){let te,ne;if(C.segmentStart===0&&C.segmentT===0)te=V(C.line.coords[0]),ne=V(C.line.coords[1]);else if(C.segmentStart===C.line.coords.length-2&&C.segmentT===1)te=V(C.line.coords[C.line.coords.length-1]),ne=V(C.line.coords[C.line.coords.length-2]);else return;const G=e.Z.subtract(te,ne,new e.Z);if(!(e.Z.magnitude(G)<T))return(0,M.Z)(G,G)}function N(C,te){const ne=new Set;for(const G of C.desireIds)te.edgeIds.includes(G)||ne.add(G);for(const G of te.desireIds)C.edgeIds.includes(G)||ne.add(G);return Array.from(ne)}function Q(C,te){const ne=new Set;for(const G of C.edgeIds)G!==te.line.id&&ne.add(G);for(const G of te.edgeIds)G!==C.line.id&&ne.add(G);if(C.edgeIds.length>1)for(const G of te.desireIds)C.edgeIds.includes(G)&&ne.delete(G);if(te.edgeIds.length>1)for(const G of C.desireIds)te.edgeIds.includes(G)&&ne.delete(G);return Array.from(ne)}},19154:function(Me,fe,d){"use strict";d.d(fe,{Z:function(){return Xe}});var e=d(10081),M=d(514),T=d(72994),V=d(58241),x=d(56223),c=d(45769),W=d(19232),F=d(28543),N=d(11662),Q=d(78231),C=d(19741),te=d(99582);const ne=["scene","task","object","line","ui","general"],G=[{tab:"scene",name:"Pan view",combo:"Space + left click + drag"},{tab:"scene",name:"Zoom view",combo:"Scroll"},{tab:"scene",name:"Rotate view",combo:"Alt + left click + drag"},{tab:"scene",name:"Move camera",combo:"Right-click + W/A/S/D"}],$=["command:camera-move-forward","command:camera-move-backward","command:camera-move-left","command:camera-move-right","command:camera-move-forward-fast","command:camera-move-backward-fast","command:camera-move-left-fast","command:camera-move-right-fast","camera:stop"];function I(le){return(0,c.Ov)().map(Se=>({tab:le,name:Se.label,combo:{key:Se.displayKey}}))}function R(le){return(0,F.jB)().map(Se=>({tab:le,name:Se.label,combo:{key:Se.displayKey}}))}function b(le){return(0,N.pd)().map(Se=>({tab:le,name:Se.label,combo:{key:Se.displayKey}}))}function K(le){return(0,W.G5)().map(Se=>({tab:le,name:Se.label,combo:{key:Se.displayKey}}))}function k(le){return(0,C._u)().map(Se=>({tab:le,name:Se.label,combo:{key:Se.displayKey}}))}function de(le){return(0,te.HP)().map(Se=>({tab:le,name:Se.label,combo:{key:Se.displayKey}}))}function j(le){return(0,Q.c7)().filter(Se=>!$.includes(Se.commandId)).map(Se=>({tab:le,name:Se.label,combo:{key:Se.displayKey}}))}const X=[...G,...j("scene"),...k("task"),...b("object"),...I("object"),...R("line"),...I("line"),...de("ui"),...K("general")];var z=d(41869),L=d.n(z);function re(le){return(0,e.jsx)(M.KeyCombo,{combo:le.combo.key,className:L().c
247omboKey,minimal:!0})}function q(le){const{combo:Se}=le;return typeof Se=="string"?(0,e.jsx)(e.Fragment,{children:Se}):Array.isArray(Se)?(0,e.jsx)(e.Fragment,{children:Se.map((_e,Ue)=>(0,e.jsx)(re,{combo:_e},Ue))}):(0,e.jsx)(re,{combo:Se})}function pe(le){return(0,e.jsx)("div",{className:L().bindings,children:le.hotkeys.map((Se,_e)=>(0,e.jsxs)(x.Fragment,{children:[(0,e.jsx)("span",{className:L().name,children:Se.name}),(0,e.jsx)("span",{className:L().combo,children:(0,e.jsx)(q,{combo:Se.combo})}),(0,e.jsx)("span",{className:L().hotkeyRuler})]},"".concat(Se.tab,"-").concat(Se.name,"-").concat(_e)))})}function ce(le){switch(le){case"scene":return"Scene";case"task":return"Task";case"object":return"Object";case"line":return"Line";case"ui":return"UI";case"general":return"General"}}function m(le){switch(le){case"scene":return"/assets/images/icons/hotkey-scene-icon.svg";case"task":return"/assets/images/icons/hotkey-task-icon.svg";case"object":return"/assets/images/icons/hotkey-object-icon.svg";case"line":return"/assets/images/icons/spline-drawing-tool.svg";case"ui":return"/assets/images/icons/hotkey-ui-icon.svg";case"general":return"/assets/images/icons/hotkey-general-icon.svg"}}function ve(le){const{tab:Se,currentTab:_e,onSelect:Ue}=le,ke=Se===_e;return(0,e.jsxs)("li",{className:"".concat(L().tab," ").concat(ke?L().activeTab:L().inactiveTab),onClick:()=>{Ue(Se)},children:[(0,e.jsx)("img",{src:m(Se),alt:""}),ce(Se)]})}function Te(le){return(0,e.jsx)("nav",{children:(0,e.jsx)("ul",{className:L().tabs,children:ne.map(Se=>(0,e.jsx)(ve,{tab:Se,currentTab:le.currentTab,onSelect:le.onSelect},Se))})})}const xe=new V.Z(X,{keys:["name","combo","combo.key"],includeMatches:!0,findAllMatches:!0,useExtendedSearch:!0});function we(){const[le,Se]=(0,x.useState)("scene"),[_e,Ue]=(0,x.useState)(""),ke=_e.length>0,rt=ke?xe.search(_e).map(dt=>dt.item):X.filter(dt=>dt.tab===le);return(0,e.jsxs)("div",{className:L().body,children:[(0,e.jsx)(Te,{currentTab:le,onSelect:dt=>{Se(dt),Ue("")}}),(0,e.jsxs)("div",{className:"".concat(L().right," styled-scrollbars"),children:[(0,e.jsx)(M.InputGroup,{leftIcon:"search",placeholder:"Search commands...",value:_e,onChange:dt=>{Ue(dt.target.value)}}),(0,e.jsx)("h1",{className:L().tabHeading,children:ke?"Search":"".concat(ce(le)," Controls")}),(0,e.jsx)(pe,{hotkeys:rt})]})]})}function Xe(le){return(0,e.jsx)(M.Dialog,{isOpen:le.isOpen,onClose:le.onClose,className:"".concat(T.Pyr," ").concat(L().dialog),children:(0,e.jsx)(we,{})})}},45769:function(Me,fe,d){"use strict";d.d(fe,{Ib:function(){return T},Ov:function(){return x},gA:function(){return V}});var e=d(17925),M=d(54327);const T={HIDE_SELECTED:"ui:hide-selected-features",LOCK_CAMERA:"command:tool-lock-camera",TOGGLE_AXIS_X:"ui:toggle-axis-x",TOGGLE_AXIS_Y:"ui:toggle-axis-y",TOGGLE_AXIS_Z:"ui:toggle-axis-z",TOGGLE_SURF_MODE:"ui:toggle-surf-mode"};(0,e.UJ)(T.HIDE_SELECTED,{label:"Hide/show object"}),(0,e.UJ)(T.LOCK_CAMERA,{label:"Lock camera around object"}),(0,e.UJ)(T.TOGGLE_AXIS_X,{label:"Toggle position X"}),(0,e.UJ)(T.TOGGLE_AXIS_Y,{label:"Toggle position Y"}),(0,e.UJ)(T.TOGGLE_AXIS_Z,{label:"Toggle position Z"}),(0,e.UJ)(T.TOGGLE_SURF_MODE,{label:"Toggle surf mode"});const V={"body[feature-selected]:not([data-mouse-right])":{h:T.HIDE_SELECTED,"shift-l":T.LOCK_CAMERA,x:T.TOGGLE_AXIS_X,y:T.TOGGLE_AXIS_Y,z:T.TOGGLE_AXIS_Z,1:T.TOGGLE_SURF_MODE}};function x(){return(0,M.q)(V)}},78231:function(Me,fe,d){"use strict";d.d(fe,{JP:function(){return T},bV:function(){return V},c7:function(){return x}});var e=d(17925),M=d(54327);const T={CAMERA_TOGGLE_PLAN_VIEW:"camera:toggle-plan-view",CAMERA_MOVE_FORWARD:"command:camera-move-forward",CAMERA_MOVE_BACKWARD:"command:camera-move-backward",CAMERA_MOVE_LEFT:"command:camera-move-left",CAMERA_MOVE_RIGHT:"command:camera-move-right",CAMERA_MOVE_FORWARD_FAST:"command:camera-move-forward-fast",CAMERA_MOVE_BACKWARD_FAST:"command:camera-move-backward-fast",CAMERA_MOVE_LEFT_FAST:"command:camera-move-left-fast",CAMERA_MOVE_RIGHT_FAST:"command:camera-move-right-fast",CAMERA_STOP:"camera:stop",CAMERA_PREVIOUS_VERTEX:"camera:previous-vertex",CAMERA_NEXT_VERTEX:"camera:next-vertex",NAVIGATION_FLY_TO
247:"navigation:fly-to",NAVIGATION_NEXT_ANNOTATION:"navigation:next-annotation",NAVIGATION_PREVIOUS_ANNOTATION:"navigation:previous-annotation",NAVIGATION_NEXT_CROSS_SECTION:"navigation:next-cross-section",NAVIGATION_PREVIOUS_CROSS_SECTION:"navigation:previous-cross-section",NAVIGATION_LAST_CROSS_SECTION:"navigation:last-cross-section",NAVIGATION_FIRST_CROSS_SECTION:"navigation:first-cross-section",NAVIGATION_STEP_FORWARD_TRAJECTORY:"navigation:step-forward-trajectory",NAVIGATION_STEP_BACKWARD_TRAJECTORY:"navigation:step-backward-trajectory",TOGGLE_TRAJECTORY:"ui:toggle-trajectory",TOGGLE_HIDE_ALL_FEATURES:"ui:toggle-hide-all-features"};(0,e.UJ)(T.CAMERA_TOGGLE_PLAN_VIEW,{label:"Toggle plan view (top-down)"}),(0,e.UJ)(T.CAMERA_MOVE_FORWARD,{label:"Move camera forward"}),(0,e.UJ)(T.CAMERA_MOVE_BACKWARD,{label:"Move camera backward"}),(0,e.UJ)(T.CAMERA_MOVE_LEFT,{label:"Move camera left"}),(0,e.UJ)(T.CAMERA_MOVE_RIGHT,{label:"Move camera right"}),(0,e.UJ)(T.CAMERA_MOVE_FORWARD_FAST,{label:"Move camera forward (fast)"}),(0,e.UJ)(T.CAMERA_MOVE_BACKWARD_FAST,{label:"Move camera backward (fast)"}),(0,e.UJ)(T.CAMERA_MOVE_LEFT_FAST,{label:"Move camera left (fast)"}),(0,e.UJ)(T.CAMERA_MOVE_RIGHT_FAST,{label:"Move camera right (fast)"}),(0,e.UJ)(T.CAMERA_STOP,{label:"Stop camera movement"}),(0,e.UJ)(T.CAMERA_PREVIOUS_VERTEX,{label:"Progress backward along line (while locked)"}),(0,e.UJ)(T.CAMERA_NEXT_VERTEX,{label:"Progress forward along line (while locked)"}),(0,e.UJ)(T.NAVIGATION_FLY_TO,{label:"Fly to selected object"}),(0,e.UJ)(T.NAVIGATION_NEXT_ANNOTATION,{label:"Next annotation"}),(0,e.UJ)(T.NAVIGATION_PREVIOUS_ANNOTATION,{label:"Previous annotation"}),(0,e.UJ)(T.NAVIGATION_NEXT_CROSS_SECTION,{label:"Next cross section"}),(0,e.UJ)(T.NAVIGATION_PREVIOUS_CROSS_SECTION,{label:"Previous cross section"}),(0,e.UJ)(T.NAVIGATION_LAST_CROSS_SECTION,{label:"Last cross section"}),(0,e.UJ)(T.NAVIGATION_FIRST_CROSS_SECTION,{label:"First cross section"}),(0,e.UJ)(T.NAVIGATION_STEP_FORWARD_TRAJECTORY,{label:"Step forward along trajectory"}),(0,e.UJ)(T.NAVIGATION_STEP_BACKWARD_TRAJECTORY,{label:"Step backward along trajectory"}),(0,e.UJ)(T.TOGGLE_TRAJECTORY,{label:"Show / Hide trajectory"}),(0,e.UJ)(T.TOGGLE_HIDE_ALL_FEATURES,{label:"Hide/show all objects"});const V={"body:not([data-mouse-right])":{"shift-z":T.CAMERA_TOGGLE_PLAN_VIEW,"shift-h":T.TOGGLE_HIDE_ALL_FEATURES,f:T.NAVIGATION_FLY_TO,"=":T.NAVIGATION_NEXT_ANNOTATION,"-":T.NAVIGATION_PREVIOUS_ANNOTATION,"'":T.NAVIGATION_NEXT_CROSS_SECTION,";":T.NAVIGATION_PREVIOUS_CROSS_SECTION,"shift-'":T.NAVIGATION_LAST_CROSS_SECTION,"shift-;":T.NAVIGATION_FIRST_CROSS_SECTION,".":T.NAVIGATION_STEP_FORWARD_TRAJECTORY,",":T.NAVIGATION_STEP_BACKWARD_TRAJECTORY,"shift-t":T.TOGGLE_TRAJECTORY},"body[data-mouse-right]":{w:T.CAMERA_MOVE_FORWARD,a:T.CAMERA_MOVE_LEFT,s:T.CAMERA_MOVE_BACKWARD,d:T.CAMERA_MOVE_RIGHT,"shift-w":T.CAMERA_MOVE_FORWARD_FAST,"shift-a":T.CAMERA_MOVE_LEFT_FAST,"shift-s":T.CAMERA_MOVE_BACKWARD_FAST,"shift-d":T.CAMERA_MOVE_RIGHT_FAST,"^w":T.CAMERA_STOP,"^a":T.CAMERA_STOP,"^s":T.CAMERA_STOP,"^d":T.CAMERA_STOP,"^shift-w":T.CAMERA_STOP,"^shift-a":T.CAMERA_STOP,"^shift-s":T.CAMERA_STOP,"^shift-d":T.CAMERA_STOP},"body[camera-locked]:not([data-mouse-right])":{";":T.CAMERA_PREVIOUS_VERTEX,"'":T.CAMERA_NEXT_VERTEX}};function x(){return(0,M.q)(V)}},19741:function(Me,fe,d){"use strict";d.d(fe,{Lf:function(){return V},ZY:function(){return T},_u:function(){return x}});var e=d(17925),M=d(54327);const T={QA_APPROVE:"qa:approve",QA_REVERT:"qa:revert",QA_DELETE:"qa:delete",QA_FLAG_FOR_REVIEW:"qa:flag-for-review"};(0,e.UJ)(T.QA_APPROVE,{label:"QA - approve"}),(0,e.UJ)(T.QA_REVERT,{label:"QA - revert"}),(0,e.UJ)(T.QA_DELETE,{label:"QA - delete"}),(0,e.UJ)(T.QA_FLAG_FOR_REVIEW,{label:"QA - Flag for review"});const V={"body[feature-selected]:not([data-mouse-right])":{"shift-e":T.QA_APPROVE,"shift-r":T.QA_REVERT,delete:T.QA_DELETE,backspace:T.QA_DELETE,"shift-d":T.QA_DELETE,"shift-1":T.QA_FLAG_FOR_REVIEW}};function x(){return(0,M.q)(V)}},94988:function(Me,fe,d){"use strict";d.d(fe,{M:function(){return M}});var e=d(51282);function M(T,V,x,c){const W=e.Z.subtract(V,T,new e.Z),F=e.Z.subtract(c,x,new e.Z);if(e.Z.equalsEpsilon(W,e.Z.ZERO,1e-10)||e.Z.equalsEpsilon(F,e.Z.ZERO,1e-10))return 0;const N=e.Z.normalize(W,new e.Z),Q=e.Z.normalize(F,new e.Z),C=e.Z.dot(N,Q),te=Math.max(-1,Math.min(1,C));return Math.acos(Math.abs(te))*180/Math.PI}},74275:function(Me,fe,d){"use strict";var e=d(85533),M=d(32092),T=d(51282);function V(x,c){const W=e.Z.eastNorthUpToFixedFrame(x),F=M.Z.inverseTransformation(W,new M.Z),N=T.Z.subtract(c,x,new T.Z),Q=M.Z.multiplyByPointAsVector(F,N,new T.Z),C=Math.hypot(Q.x,Q.y),te=Math.abs(Q.z);return{horizontal:C,vertical:te}}fe.Z=V},58017:function(Me,fe,d){"use strict";d.d(fe,{YV:function(){return z},zi:function(){return L}});var e=d(10081),M=d(85533),T=d(32092),V=d(79740),x=d(51282),c=d(20108),W=d(2461),F=d(84704),N=d(94282),Q=d(85822),C=d(56223),te=d(11675),ne=d(91755),G=d(95527),$=d(68900),I=d(51450),R=d(45030),b=d(99981),K=d(72921),k=d(66586);function de(q,pe){const ce=M.Z.eastNorthUpToFixedFrame(q),m=T.Z.getMatrix3(ce,new V.Z),ve=V.Z.multiplyByVector(m,x.Z.UNIT_Z,new x.Z),Te=x.Z.clone(pe);x.Z.subtract(Te,x.Z.multiplyByScalar(ve,x.Z.dot(ve,Te),new x.Z),Te);try{x.Z.normalize(Te,Te)}catch{V.Z.multiplyByVector(m,x.Z.UNIT_X,Te)}const xe=x.Z.cross(Te,ve,new x.Z);return c.Z.fromRotationMatrix(V.Z.fromColumnMajorArray([xe.x,xe.y,xe.z,Te.x,Te.y,Te.z,ve.x,ve.y,ve.z]),new c.Z)}function j(q,pe,ce,m){const ve=M.Z.eastNorthUpToFixedFrame(pe),Te=x.Z.multiplyComponents(ce,m,new x.Z),xe=T.Z.multiplyByPoint(ve,Te,new x.Z),we=de(pe,x.Z.negate(q.direction,new x.Z));return{position:xe,orientation:we,dimensions:m}}const X={ADA_RAMP:new x.Z(.6,.9,.1),BOLLARD:new x.Z(.2,.2,.8),DOWN_SPOUT:new x.Z(.1,.1,3),DRAIN:new x.Z(1,1,.1),ELEC_XARM:new x.Z(2.4384,.1,.1),FIRE_HYDRANT:new x.Z(.52,.52,1.34),GENERIC_SIGNFACE:new x.Z(.75,.01,.75),LAMP:new x.Z(.39185166370332747,.40450088900177805,.5430022860045721),LIGHT_POLE:new x.Z(.2,.2,12),MANHOLE:new x.Z(.1,.1,.1),SQUARE_MANHOLE:new x.Z(1.292,1.292,.1),PARKING_METER:new x.Z(.325,.339,1.94),PLANTERS:new x.Z(.8,.8,.7),PLANTER:new x.Z(.8,.8,.7),Point:new x.Z(.1,.1,.1),POLE_MOUNT_XFORMER:new x.Z(.88,.88,1.19),POLE_MOUNTED_TRANSFORMER:new x.Z(.88,.88,1.19),SIGN_MAST:new x.Z(.1,.1,2.1),STOP_SIGN:new x.Z(.75,.01,.75),TRAFFIC_LIGHT:new x.Z(.39,.25,.83),TRAFFIC_PEDX_LIGHT:new x.Z(.39,.25,.83),TRASH_CAN:new x.Z(.3,.3,.8),TREE_TRUNK:new x.Z(.2,.2,2),UTILITY_CABINET:new x.Z(.4,.6,1.2),UTILITY_POLE:new x.Z(.2,.2,12),SIGN_ASSEMBLY:new x.Z(.01,.01,.01),PAVEMENT_SYMBOL_BOUNDS:new x.Z(2,2,.01),PAVEMENT_ARROW_BOUNDS:new x.Z(2,2,.01),PAVEMENT_MESSAGE_BOUNDS:new x.Z(2,2,.01),CURB_GRATE_POI:new x.Z(.1,.1,.1),CURB_INLET_POI:new x.Z(.1,.1,.1),CURB_RAMP_POI:new x.Z(.1,.1,.1)};function z(){const q=(0,K.kb)(ve=>ve.mode==="object-annotation"?ve.type:null),pe=(0,K.kb)(ve=>ve.mode==="object-annotation"?ve.prefill:void 0),ce=(0,K.Fc)(),m=(0,G.Ni)();return(0,C.useMemo)(()=>
247{if(q==="Point"&&ce?.projectFileId){var ve;return{objectType:"Point",projectFileId:ce.projectFileId,annotationLayerId:(ve=ce.surveyId)!==null&&ve!==void 0?ve:null,prefill:pe}}if(ce?.activeLayerId&&ce.projectFileId){var Te;const we=(0,b.Js)(ce.activeLayerId);if(!we)return;const{annotationLayerId:Xe,layerFromAttributeTemplate:le}=we,Se=m.get(Xe),_e=Se==null||(Te=Se.schema)===null||Te===void 0?void 0:Te[le];if(!_e||_e.inclusion!=="approved"||(0,Q.Z)(le,_e).featureClass==="line")return;const ke=(0,b.s2)(le,_e);return ke.length>0?{projectFileId:ce.projectFileId,annotationLayerId:Xe,layerFromAttributeTemplate:le,objectType:ke[0].type,prefill:ke[0].prefill}:void 0}if(q&&ce?.projectFileId){var xe;return{objectType:q,projectFileId:ce.projectFileId,annotationLayerId:(xe=ce.surveyId)!==null&&xe!==void 0?xe:null,prefill:pe}}},[ce,m,q,pe])}function L(){const q=(0,te.I0)(),{select:pe}=(0,ne.c)(),ce=(0,I.FH)(),m=(0,W.yu)(),ve=(0,N.ng)(),[Te]=(0,F.Z)();var xe;const we=(xe=Te?.username)!==null&&xe!==void 0?xe:"Unknown",Xe=(0,$.k0)();return(0,C.useCallback)((le,Se,_e,Ue,ke)=>{if(!Se||!_e||!m)return;const rt=ve.trajectories[_e];if(!rt){console.error("No trajectory loaded for point cloud file ID");return}q((0,K.fP)(Se,ke));const dt=Se==="Point"?x.Z.ZERO:new x.Z(0,.5,.5);let ye;if(ke?.scaleX&&ke?.scaleY&&ke?.scaleZ)ye=rt.visualizationMapping.ecef_from_project_scale(new x.Z(ke.scaleX,ke.scaleY,ke.scaleZ));else{var yt;ye=(yt=X[Se])!==null&&yt!==void 0?yt:x.Z.ONE}const{position:Lt,orientation:bt,dimensions:Ae}=j(m,le,dt,ye),Fe=rt.visualizationMapping.project_from_ecef_point(Lt),Ve=rt.visualizationMapping.project_from_ecef_quaternion(bt),We=rt.visualizationMapping.project_from_ecef_scale(Ae),{restrictedPosition:je,bounded:B}=Xe(Fe),{spec:w,...O}=ke??{},A={...w,source:{type:"user",user:we}},H=Se==="Point"?{type:"Point",spec:A}:{type:Se,spec:A},_=ce({x:je.x,y:je.y,z:je.z,rotationX:Ve.x,rotationY:Ve.y,rotationZ:Ve.z,rotationW:Ve.w,scaleX:We.x,scaleY:We.y,scaleZ:We.z,annotationLayerId:Ue??void 0,...H,...O},_e);pe(_),q((0,R.vL)(_))},[q,pe,ce,ve,Xe,we,m])}function re(){const q=(0,te.I0)(),pe=L(),ce=z(),m=(0,C.useCallback)(Te=>{ce&&pe(Te,ce.objectType,ce.projectFileId,ce.annotationLayerId,ce.prefill),q((0,K.fq)({mode:"none"}))},[q,pe,ce]),ve=(0,C.useCallback)(()=>{q((0,K.fq)({mode:"none"}))},[q]);return(0,e.jsx)(k.Z,{handleFinish:m,handleCancel:ve})}fe.ZP=re},66586:function(Me,fe,d){"use strict";var e=d(10081),M=d(55262),T=d(51282),V=d(71177),x=d(72921),c=d(30594),W=d(21850),F=d(56223),N=d(29931),Q=d(68900),C=d(73920);function te(G,$){const I=(0,C.Z)(),R=(0,F.useCallback)(b=>{if(!$)return;const K=I(b.mousePosition);K&&$(K.position,{target:K.entity})},[$,I]);(0,c.sC)(G,R)}function ne(G){const{handleFinish:$,handleCancel:I}=G,R=(0,Q.u0)(),b=(0,x.kb)(z=>z.mode==="object-annotation"),K=(0,F.useRef)(null),k=(0,F.useRef)(null),de=(0,F.useMemo)(()=>{const z=new M.Z(()=>K.current||T.Z.ZERO,!1);return(0,e.jsx)(N.JH,{position:z,ref:k,children:(0,e.jsx)(N.l7,{pixelSize:20,color:V.Z.YELLOW})})},[]),j=(0,F.useRef)(!1),X=(0,F.useCallback)(z=>{if(!j.current&&b){const{restrictedPosition:L,bounded:re}=R(z);K.current=L}},[R,b]);return te("onMouseMove",X),te("onClick",$),(0,e.jsxs)(e.Fragment,{children:[de,(0,e.jsx)(W.Z,{callback:z=>{z.key==="Escape"&&I?.()}})]})}fe.Z=ne},2598:function(Me,fe,d){"use strict";d.d(fe,{QM:function(){return T},e6:function(){return M},jW:function(){return V}});var e=d(56223);class M{set(c,W){this.position=c,this.cameraPosition=W}get(){return this.position}getCamera(){return this.cameraPosition}constructor(){this.position=null,this.cameraPosition=null}}const T=e.createContext(new M);function V(){return e.useContext(T)}},33952:function(Me,fe,d){"use strict";d.d(fe,{G:function(){return N}});var e=d(10081),M=d(56223),T=d(82039),V=d(10792),x=d(32593),c=d(99582),W=d(70913),F=d(29063);function N(){const Q=(0,T.TL)(),te=!(0,F.Ym)(),ne=(0,W.x)(c.ZU.TOGGLE_LAYER_PANEL),G=()=>{Q((0,F.Mj)())},$=te?"Collapse layer panel":"Expand layer panel";return(0,e.jsx)(V.n,{size:"md",title:$,hotkey:ne.keybinding,isSelected:te,onChange:G,onIcon:x.EHk,offIcon:x.DuN})}},26521:function(Me,fe,d){"use strict";d.d(fe,{S:function(){return bt}});var e=d(10081),M=d(56223),T=d(84704),V=d(44623),x=d(49865),c=d(97531),W=d(57792),F=d(86802),N=d(91755),Q=d(27453),C=d(35113),te=d(51450),ne=d(62368);function G(Ae){let{username:Fe,cursor:Ve,className:We,style:je}=Ae;const{objectIds:B}
247=Ve,w=(0,C.tq)(),O=(0,te.ug)(),{select:A}=(0,N.c)(),H=Object.values(B).flat(),_=(0,Q.Nj)(),J=H.some(ee=>_.has(ee)),D=$({objectIds:B,flyTo:w,featuresManager:O,select:A}),oe=H.length>0?"Fly to ".concat(Fe,"'s selection"):"".concat(Fe," (no selection)");return(0,e.jsx)("div",{style:je,children:(0,e.jsxs)(F.U,{delay:250,children:[(0,e.jsx)(W.J,{letter:Fe[0].toUpperCase(),color:Ve.colorName,size:"sm",className:"".concat(We||""," ").concat(J?"outline outline-4 outline-green-400":""),isInteractive:H.length>0,onPress:D,"aria-label":oe}),(0,e.jsx)(c.t,{title:oe})]})})}function $(Ae){let{objectIds:Fe,flyTo:Ve,featuresManager:We,select:je}=Ae;return()=>{const B=Object.values(Fe).flat();if(B.length!==0)if(B.length===1){const w=We.getFeatureById(B[0]);if(!w)return;je(w),Ve(new ne.Z(w.id,w.__typename==="ObjectAnnotation"?ne.F.Object:ne.F.Spline))}else{const w=B.map(O=>We.getFeatureById(O)).filter(O=>O!=null);if(w.length===0)return;je(w),Ve(new ne.Z(w.map(O=>O.id),ne.F.MultiselectedObjects))}}}var I=d(80326);function R(Ae){let{username:Fe,cursor:Ve}=Ae;const{objectIds:We}=Ve,je=(0,C.tq)(),B=(0,te.ug)(),{select:w}=(0,N.c)(),O=Object.values(We).flat(),A=$({objectIds:We,flyTo:je,featuresManager:B,select:w}),H=O.length>0;return(0,e.jsx)(I.CM,{onAction:A,textValue:Fe,isDisabled:!H,children:(0,e.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,e.jsx)(W.J,{letter:Fe[0].toUpperCase(),color:Ve.colorName,size:"xs",isInteractive:!1}),(0,e.jsx)("span",{className:"truncate text-text",children:Fe})]})})}function b(Ae){let{remainingUsers:Fe,className:Ve}=Ae;const We=Fe.length,je="".concat(We," other user").concat(We===1?"":"s");return(0,e.jsxs)(I.$x,{children:[(0,e.jsxs)(F.U,{delay:250,children:[(0,e.jsx)(W.J,{letter:We.toString(),color:"grey",size:"sm",className:Ve||"","aria-label":"View ".concat(je)}),(0,e.jsx)(c.t,{title:je})]}),(0,e.jsx)(I.xH,{placement:"bottom start",children:(0,e.jsx)(I.l2,{children:Fe.map(B=>{let[w,O]=B;return(0,e.jsx)(R,{username:w,cursor:O},w)})})})]})}var K=d(98004),k=d(63380),de=d(9003);function j(Ae){let{size:Fe="sm",className:Ve}=Ae;var We;const[je]=(0,T.Z)(),B=(0,k.h)(),w=(0,k.Z)();let O="regularUser";B?O="admin":je?.isViewOnly?O="viewOnlyUser":w&&!B&&(O="adminShowAsNonAdmin");const A=(je==null||(We=je.username)===null||We===void 0?void 0:We.charAt(0).toUpperCase())||"U";return(0,e.jsxs)(F.U,{delay:250,children:[(0,e.jsx)(de.a,{letter:A,size:Fe,variant:"default",profileVariant:O,className:Ve,"aria-label":"User settings and profile options"}),(0,e.jsx)(c.t,{title:"User settings"})]})}var X=d(514),z=d(72994),L=d(68717),re=d(93349),q=d(7546),pe=d(17340),ce=d(24199),m=d(47568);function ve(Ae){const{assumeRole:Fe}=(0,pe.Z)(),[Ve,We]=(0,M.useState)(""),[je,B]=(0,M.useState)(null),[w,O]=(0,M.useState)(!0),[A,H]=(0,q.Z)(),{createFeatureFlagContext:_,reidentify:J}=(0,L.gV)();async function D(){try{await H(async()=>{const oe=await Fe(Ve);if(oe?.error&&!oe.assumedFromOriginalAdminEmail)throw new Error(oe.error);if(oe){const ee=new re.W(oe),ge=_(ee);await J(ge)}}),B(null),O(!1)}catch(oe){B(oe.message)}}return(0,e.jsxs)(X.Dialog,{className:z.Pyr,isOpen:w,onClose:()=>O(!1),onClosed:Ae.onClosed,title:"Assume Role",children:[(0,e.jsxs)("div",{className:z.TmF,children:[je&&(0,e.jsx)(X.Callout,{intent:"danger",style:{marginBottom:10},children:je}),(0,e.jsx)(X.FormGroup,{label:"Email",labelFor:"new-email",labelInfo:"(required)",children:(0,e.jsx)("input",{id:"new-email",type:"text",value:Ve,onChange:oe=>We(oe.target.value),onKeyDown:oe=>{oe.key==="Enter"&&D()}})})]}),(0,e.jsx)("div",{className:z.Alt,children:(0,e.jsxs)("div",{className:z.e$L,children:[(0,e.jsx)(X.Button,{onClick:()=>O(!1),disabled:A,children:"Cancel"}),(0,e.jsx)(X.Button,{intent:"mach9",onClick:D,loading:A,disabled:Ve==="",children:"Assume role"})]})})]})}function Te(){const{data:Ae}=(0,ce.useMach9Session)();return Ae&&(0,m.L)(Ae)?Ae.assumedFromOriginalAdminEmail:void 0}function xe(Ae){const Fe=Te(),Ve=(0,k.h)();return Fe||!Ve?null:(0,e.jsx)(I.CM,{onAction:()=>Ae.setDialog((0,e.jsx)(ve,{onClosed:()=>Ae.setDialog(null)})),className:"admin-only",children:"Assume role"})}var we=d(38982);function Xe(){const{data:Ae}=(0,ce.useMach9Session)();
247return Ae&&(0,m.L)(Ae)?Ae.assumedFromOriginalAdminEmail:void 0}function le(){const{revertRole:Ae}=(0,pe.Z)(),Fe=(0,we.useRouter)(),Ve=Xe(),[We,je]=(0,M.useState)(!1),{createFeatureFlagContext:B,reidentify:w}=(0,L.gV)();return Ve?(0,e.jsx)(I.CM,{onAction:async()=>{try{je(!0);const O=await Ae();if(O){const A=new re.W(O),H=B(A);await w(H)}Fe.refresh()}finally{je(!1)}},isDisabled:We,className:"admin-only",children:"Revert to ".concat(Ve)}):null}var Se=d(8325),_e=d(51741);function Ue(Ae){const[Fe]=(0,T.Z)(),{flags:Ve,isLoading:We,error:je,refetch:B}=(0,L.Zd)(),{toggleFeatureFlag:w,isLoading:O}=(0,L.Rq)(),{resetUserTargeting:A,isLoading:H}=(0,_e.O)(),{getAllFlags:_}=(0,L.gV)(),J=_(),[D,oe]=(0,M.useState)(""),[ee,ge]=(0,M.useState)(!1),[be,Be]=(0,M.useState)(null),Re=Ve.filter(Ze=>Ze.key!=="enableFeatureFlagsSystem").filter(Ze=>{var Le;return Ze.key.toLowerCase().includes(D.toLowerCase())||Ze.name.toLowerCase().includes(D.toLowerCase())||((Le=Ze.description)===null||Le===void 0?void 0:Le.toLowerCase().includes(D.toLowerCase()))}),ze=async Ze=>{try{await w(Ze,Fe?.username)}catch(Le){console.error("Failed to toggle feature flag:",Le)}},st=async()=>{if(Fe?.username)try{const Le=(await A(Fe.username)).filter(Ye=>Ye.removed).length;Be("Successfully reset ".concat(Le," feature flags for ").concat(Fe.username)),ge(!1),await B()}catch(Ze){console.error("Failed to reset feature flags:",Ze)}};return(0,e.jsxs)(X.Dialog,{className:z.Pyr,isOpen:!0,onClose:Ae.onClosed,onClosed:Ae.onClosed,title:"Manage Feature Flags",style:{width:600,maxHeight:"80vh"},children:[(0,e.jsxs)("div",{className:z.TmF,children:[je&&(0,e.jsxs)(X.Callout,{intent:"danger",style:{marginBottom:10},children:["Error loading feature flags: ",je]}),be&&(0,e.jsx)(X.Callout,{intent:"success",style:{marginBottom:10},children:be}),(0,e.jsx)("div",{style:{marginBottom:10},children:(0,e.jsx)("input",{type:"text",placeholder:"Search feature flags...",value:D,onChange:Ze=>oe(Ze.target.value),style:{width:"100%",padding:"8px"}})}),We?(0,e.jsx)("div",{style:{textAlign:"center",padding:20},children:(0,e.jsx)(X.Spinner,{})}):(0,e.jsx)("div",{style:{maxHeight:"400px",overflowY:"auto"},children:Re.length===0?(0,e.jsx)("div",{style:{padding:20,textAlign:"center",color:"#888"},children:"No feature flags found"}):Re.map(Ze=>{const Le=!!J[Ze.key];return(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px",borderBottom:"1px solid #333"},children:[(0,e.jsxs)("div",{style:{marginRight:12,flex:1},children:[(0,e.jsx)("div",{style:{fontWeight:"bold",marginBottom:4},children:Ze.name}),(0,e.jsxs)("div",{style:{fontSize:"0.9em",color:"#888",marginBottom:4},children:["Key: ",Ze.key]}),(0,e.jsx)("div",{style:{fontSize:"0.9em",color:"#888"},children:Ze.description||"No description available"})]}),(0,e.jsx)(X.Switch,{checked:Le,onChange:()=>ze(Ze.key),disabled:O||Ze.archived,large:!0})]},Ze.key)})})]}),(0,e.jsx)("div",{className:z.Alt,children:(0,e.jsxs)("div",{className:z.e$L,children:[(0,e.jsx)(X.Button,{onClick:()=>ge(!0),intent:"danger",disabled:H,loading:H,children:"Reset All Flags"}),(0,e.jsx)(X.Button,{onClick:Ae.onClosed,children:"Close"})]})}),(0,e.jsxs)(X.Alert,{isOpen:ee,onClose:()=>ge(!1),onConfirm:st,intent:Se.S.DANGER,cancelButtonText:"Cancel",confirmButtonText:"Yes, Reset All",children:["Are you sure you want to reset all feature flag targeting for ",Fe?.username,"? This will remove all individual user targeting rules."]})]})}function ke(Ae){const Fe=(0,k.h)(),{isFlagEnabled:Ve}=(0,L.gV)(),We=Ve("featureFlagManager");return!Fe&&!We?null:(0,e.jsx)(I.CM,{onAction:()=>Ae.setDialog((0,e.jsx)(Ue,{onClosed:()=>Ae.setDialog(null)})),className:Fe?"admin-only":"",children:"Manage Feature Flags"})}var rt=d(82039);function dt(Ae){const Fe=(0,rt.TL)(),Ve=(0,x.nS)();return(0,e.jsxs)(X.Dialog,{className:z.Pyr,isOpen:!0,onClose:()=>{Ae.onClosed()},onClosed:Ae.onClosed,title:"Set presence",children:[(0,e.jsxs)("div",{className:z.TmF,children:["Are you sure you want to"," ",Ve?"stop reporting presence":"start reporting presence","?"]}),(0,e.jsx)("div",{className:z.Alt,children:(0,e.jsxs)("div",{className:z.e$L,children:[(0,e.jsx)(X.Button,{onClick:()=>Ae.onClosed(),children:"Cancel"}),(0,e.jsx)(X.Button,{intent:"danger",onClick:()=>{Fe((0,x.di)(!Ve)),Ae.onClosed()},children:Ve?"Yes, I want to stop reporting presence":"Yes, I want to start reporting presence"})]})})]})}function ye(Ae){const Fe=(0,x.nS)();return(0,k.Z)()?(0,e.jsx)(I.CM,{onAction:()=>Ae.setDialog((0,e.jsx)(dt,{onClosed:()=>Ae.setDialog(null)})),className:"admin-only",children:Fe?"Disable presence":"Enable presence"}):null}function yt(){const{setShowAsNonAdmin:Ae}=(0,pe.Z)(),[Fe,Ve]=(0,q.Z)(),[We]=(0,T.Z)(),{reidentify:je,createFeatureFlagContext:B}=(0,L.gV)();return(0,k.Z)()?(0,e.jsx)(I.CM,{onAction:async()=>{await Ve(async()=>{const O=!We?.showAsNonAdmin;if(await Ae(O),We){const A=B(We);A.user.custom.showAsNonAdmin=O,await je(A)}})},className:"admin-only",children:We?.showAsNonAdmin?"Show as admin":"Show as non-admin"}):null}function Lt(){const[Ae]=(0,T.Z)(),[Fe,Ve]=(0,M.useState)(null),We=(0,K.I)();return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(I.$x,{children:[(0,e.jsx)(j,{}),(0,e.jsx)(I.xH,{placement:"bottom end",children:(0,e.jsxs)(I.l2,{children:[(0,e.jsx)(I.L7,{children:Ae?.username}),(0,e.jsx)(xe,{setDialog:Ve}),(0,e.jsx)(le,{}),(0,e.jsx)(yt,{}),(0,e.jsx)(ke,{setDialog:Ve}),(0,e.jsx)(ye,{setDialog:Ve}),(0,e.jsx)(I.CM,{onAction:()=>We(),children:"Log out"})]})})]}),Fe]})}function bt(Ae){let{otherProfileLimit:Fe=3}=Ae;var Ve,We;
247const je=(0,x.tp)(),B=(We=(0,T.Z)())===null||We===void 0||(Ve=We[0])===null||Ve===void 0?void 0:Ve.isViewOnly,w=Object.entries(je),O=w.length,A=O>0,H=O>Fe,_=H?Fe-1:O,J=w.slice(0,_),D=w.slice(_);let oe=0;B||(oe+=J.length,H&&D.length>0&&(oe+=1));const ee=50+oe*10;return(0,e.jsxs)("div",{className:"flex items-center px-1",children:[(0,e.jsxs)(V.Z,{children:[H&&D.length>0&&(0,e.jsx)(b,{remainingUsers:D,className:"z-10"}),J.map((ge,be)=>{let[Be,Re]=ge;return(0,e.jsx)(G,{username:Be,cursor:Re,className:"".concat(H&&D.length>0||be>0?"-ml-1":""),style:{zIndex:20+be*10}},Be)})]}),(0,e.jsx)("div",{className:"".concat(A&&!B?"-ml-1":""),style:{zIndex:ee},children:(0,e.jsx)(Lt,{})})]})}},23537:function(Me,fe,d){"use strict";d.d(fe,{j:function(){return pe}});var e=d(10081),M=d(514),T=d(72994),V=d(12694),x=d(5280),c=d(84704),W=d(63380),F=d(38786),N=d(38982),Q=d(56223),C=d(80326),te=d(82039),ne=d(4115),G=d(90891),$=d(67566),I=d(52861),R=d(16042),b=d(53637),K=d(44026),k=d(87915),de=d(45030),j=d(75057),X=d(93920);function z(ce){const[m,ve]=(0,Q.useState)(""),Te=(0,te.TL)();return(0,e.jsxs)(M.Dialog,{isOpen:ce.showing,onClose:ce.onClose,title:"Add custom layer",className:T.Pyr,children:[(0,e.jsx)("div",{className:T.TmF,children:(0,e.jsx)("div",{children:(0,e.jsxs)(M.HTMLSelect,{fill:!0,"aria-label":"custom layer type",onChange:xe=>ve(xe.target.value),children:[(0,e.jsx)("option",{value:"",children:"Select..."}),Object.entries(ne.Ug).map(xe=>{let[we,Xe]=xe;return(0,e.jsx)("option",{value:we,children:Xe.displayName},we)})]})})}),(0,e.jsx)("div",{className:T.Alt,children:(0,e.jsxs)("div",{className:T.e$L,children:[(0,e.jsx)(M.Button,{onClick:ce.onClose,children:"Cancel"}),(0,e.jsx)(M.Button,{intent:"mach9",onClick:()=>{if(ce.onClose(),m){const xe=Te((0,R.xe)(ne.Ug[m]));Te((0,X.WM)(xe.payload.id,!0))}},children:"Add"})]})})]})}function L(ce,m){return"/api/view/export/".concat(ce,"?format=").concat(m)}function re(ce,m){return"/api/tasks/".concat(ce,"/export?format=").concat(m)}function q(){const ce=(0,N.usePathname)(),m=(0,V.ye)("rooster",!1),[ve,Te]=(0,Q.useState)({isInRoosterView:!1,navigationUrl:null,isRoosterEnabled:m});return(0,Q.useEffect)(()=>{const xe=ce??"",we=xe.includes("/view2")||xe.includes("/task2"),Xe=xe.match(/\/files\/([^/]+)\/(view|view2)/);var le;const Se=(le=Xe?.[1])!==null&&le!==void 0?le:null,_e=xe.match(/\/tasks\/([^/]+)(?:\/task2)?/);var Ue;const ke=(Ue=_e?.[1])!==null&&Ue!==void 0?Ue:null;let rt=null;const dt=m&&!we;if(Se)rt="/files/".concat(Se,"/").concat(dt?"view2":"view");else if(ke)rt="/tasks/".concat(ke,"/").concat(dt?"task2":"");else{const ye=xe.match(/^\/view2\/([^/?#]+)/),yt=xe.match(/^\/view\/([^/?#]+)/);ye?rt="/view/".concat(ye[1]):yt&&(rt=dt?"/view2/".concat(yt[1]):null)}Te({isInRoosterView:we,navigationUrl:rt,isRoosterEnabled:m})},[m,ce]),ve}function pe(){const[ce,m]=(0,Q.useState)(!1),[ve,Te]=(0,Q.useState)(!1),[xe,we]=(0,Q.useState)(!1),[Xe,le]=(0,Q.useState)(!1),[Se,_e]=(0,Q.useState)(!1),Ue=(0,j.F5)(),ke=(0,j.vp)(),rt=(0,j.fJ)(),dt=(0,x.SK)(),ye=(0,te.TL)(),yt=(0,V.ye)("canExport",!1),Lt=(0,$._T)(),bt=q(),Ae=(0,W.h)(),[Fe]=(0,c.Z)(),Ve=Fe?.isViewOnly;if(ke===j.Gp)return null;const We=ke?"/drive/folders/".concat(ke):"/drive",je=B=>{let w;if(Ue==="Task"&&dt&&(w=re(dt.id,B)),Ue==="View"&&rt&&(w=L(rt,B)),!w)return;const O=window.open(w,"_blank","noopener,noreferrer");O&&(O.opener=null)};return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(C.xH,{placement:"bottom start",children:(0,e.jsxs)(C.l2,{children:[bt.isRoosterEnabled&&bt.navigationUrl&&(0,e.jsx)(C.CM,{children:(0,e.jsx)(F.default,{href:bt.navigationUrl,onClick:()=>ye((0,de.x8)()),className:"block w-full no-underline",children:bt.isInRoosterView?"Open in Viewer":"Open in Digital Surveyor 2 Viewer"})}),(0,e.jsx)(C.CM,{onAction:()=>{const B=window.location.href;navigator.clipboard.writeText(B)},children:"Copy Share Link"}),rt!=="bridges"&&(0,e.jsx)(C.CM,{children:(0,e.jsx)(F.default,{href:We,onClick:()=>ye((0,de.x8)()),className:"block w-full no-underline",children:"Show in Folder"})}),Lt&&(0,e.jsx)(C.CM,{children:(0,e.jsx)(F.default,{href:Lt,onClick:()=>ye((0,de.x8)()),className:"block w-full no-underline",children:"Back"})}),(Ue==="View"||Ue==="Task")&&!Ve&&(0,e.jsxs)(C.o_,{children:[(0,e.jsx)(C.CM,{isDisabled:!yt,children:"Export"}),(0,e.jsx)(C.xH,{placement:"right",children:(0,e.jsxs)(C.l2,{children:[(0,e.jsx)(C.CM,{onAction:()=>je("v2-gdb"),children:"GDB"}),(0,e.jsx)(C.CM,{onAction:()=>je("v2-shp-obj"),children:"SHP (points)"}),(0,e.jsx)(C.CM,{onAction:()=>je("v2-shp-obj-layered"),children:"Layered SHP (points)"}),(0,e.jsx)(C.CM,{onAction:()=>je("v2-shp-lines"),children:"SHP (lines)"}),(0,e.jsx)(C.CM,{onAction:()=>ye((0,I.Q5)()),children:"CSV"}),(0,e.jsx)(C.CM,{onAction:()=>je("v2-csv-obj-layered"),children:"Layered CSV"}),(0,e.jsx)(C.CM,{onAction:()=>je("v2-dxf"),children:"DXF"}),Ae&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(C.CM,{onAction:()=>ye((0,I.n0)("dxf")),className:"admin-only",children:"DXF (old)"}),(0,e.jsx)(C.CM,{onAction:()=>
247je("geojson"),className:"admin-only",children:"GeoJSON (\u{1F950})"}),(0,e.jsx)(C.CM,{onAction:()=>je("mach9-json"),className:"admin-only",children:"Mach9 JSON"}),(0,e.jsx)(C.CM,{onAction:()=>je("kml"),className:"admin-only",children:"KML"})]})]})})]}),Ae&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(C.EE,{}),(0,e.jsx)(C.CM,{onAction:()=>le(!0),className:"admin-only",children:"Add custom layer"}),(0,e.jsx)(C.CM,{onAction:()=>m(!0),className:"admin-only",children:"Import local annotations"}),(0,e.jsx)(C.CM,{onAction:()=>Te(!0),className:"admin-only",children:"Populate suggestion table"}),(0,e.jsx)(C.CM,{onAction:()=>we(!0),className:"admin-only",children:"Populate auxiliary table"}),(0,e.jsx)(C.CM,{onAction:()=>ye((0,I.uw)()),className:"admin-only",children:"Open debug settings"}),(0,e.jsx)(C.CM,{onAction:()=>ye((0,I.gb)()),className:"admin-only",children:"Open ARP output"}),(0,e.jsx)(C.CM,{onAction:()=>ye((0,G.u8)(!0)),className:"admin-only",children:"Open vertex inspector"})]})]})}),(0,e.jsx)(z,{showing:Xe,onClose:()=>le(!1)}),(0,e.jsx)(b.Z,{isOpen:ce,onClose:()=>m(!1)}),(0,e.jsx)(k.H,{isOpen:ve,onClose:()=>Te(!1)}),(0,e.jsx)(K.o,{isOpen:xe,onClose:()=>we(!1)})]})}},43958:function(Me,fe,d){"use strict";d.d(fe,{N:function(){return ye}});var e=d(10081),M=d(514),T=d(51282),V=d(4919),x=d(23150),c=d(5280),W=d(32940),F=d(81929),N=d(59685),Q=d(94282),C=d(21188),te=d.n(C),ne=d(80822),G=d(56223),$=d(36743),I=d(27027),R=d(52218),b=d(34317),K=d(48609),k=d(72921),de=d(95497),j=d(75057),X=d(93920);const z={RADIUS_PX:5,DIST_PX:20,INSCRIBED_ANGLE_RAD:Math.PI/4},L={TILE_PANE:200,OVERLAY_PANE:400,SHADOW_PANE:500,MARKER_PANE:600,TOOLTIP_PANE:650,POPUP_PANE:700,OVERLAY_BUTTONS:701},re={SELECTED:3,UNSELECTED:2};var q=d(27384),pe=d(54492),ce=d(99070),m=d(1287);function ve(B,w){if(w.contains(B))return B.clone();const O=w.getCenter(),A=Math.atan2(B.y-O.y,B.x-O.x),H=Math.cos(A),_=Math.sin(A),J=w.getTopLeft(),D=w.getBottomRight();if(H>0){const oe=(D.x-O.x)/H,ee=O.y+oe*_;if(ee>=J.y&&ee<=D.y)return new(te()).Point(D.x,ee)}if(H<0){const oe=(J.x-O.x)/H,ee=O.y+oe*_;if(ee>=J.y&&ee<=D.y)return new(te()).Point(J.x,ee)}if(_>
2470){const oe=(D.y-O.y)/_,ee=O.x+oe*H;if(ee>=J.x&&ee<=D.x)return new(te()).Point(ee,D.y)}if(_<0){const oe=(J.y-O.y)/_,ee=O.x+oe*H;if(ee>=J.x&&ee<=D.x)return new(te()).Point(ee,J.y)}return O.clone()}function Te(B){const{boundedLatLng:w,heading:O,map:A}=B,{RADIUS_PX:H,DIST_PX:_,INSCRIBED_ANGLE_RAD:J}=z,D=A.latLngToLayerPoint(w),oe=new C.Point(D.x+_*Math.sin(O),D.y-_*Math.cos(O)),ee=A.layerPointToLatLng(oe),ge=new C.Point(D.x+H*Math.sin(O-Math.PI/2+J/2),D.y-H*Math.cos(O-Math.PI/2+J/2)),be=new C.Point(D.x+H*Math.sin(O+Math.PI/2-J/2),D.y-H*Math.cos(O+Math.PI/2-J/2));return{vertexLatLng:ee,tangentLatLngCCW:A.layerPointToLatLng(ge),tangentLatLngCW:A.layerPointToLatLng(be)}}function xe(B,w){const O=(0,m.A5)(B.bounds),A=w.ecef_from_project_point(new T.Z(O.xMin,O.yMin,0)),H=w.ecef_from_project_point(new T.Z(O.xMax,O.yMax,0)),_=(0,ce.Z)({position:A,time:0}),J=(0,ce.Z)({position:H,time:0});return(0,C.latLngBounds)(_,J)}function we(B){const w=Object.values(B).flatMap(O=>O.points).map(ce.Z);return(0,C.latLngBounds)(w)}function Xe(B,w){const O=Object.entries(B).filter(A=>{let[H]=A;return w[H]}).reduce((A,H)=>{let[_,J]=H;return A[_]=J,A},{});return Object.keys(O).length===0?null:we(O)}function le(B){return[B.points.map(A=>A.time).reduce((A,H)=>{let[_,J]=A;return[Math.min(_,H),Math.max(J,H)]},[1/0,-1/0])]}function Se(B,w){const O=(0,q.Sx)(),A=(0,pe.R9)();return(0,G.useMemo)(()=>{if(!A)return{boundedLatLng:B,arrowParams:Te({boundedLatLng:B,heading:w,map:O})};const H=A.pad(-.01),_=te().bounds(O.latLngToLayerPoint(H.getNorthEast()),O.latLngToLayerPoint(H.getSouthWest
247())),J=O.latLngToLayerPoint(B),D=ve(J,_),oe=O.layerPointToLatLng(D),ee=Te({boundedLatLng:oe,heading:w,map:O});return{boundedLatLng:oe,arrowParams:ee}},[B,w,O,A])}function _e(B,w){const O=(0,q.Sx)(),A=Ue(B,w);(0,G.useEffect)(()=>{A.isValid()&&O.fitBounds(A)},[A,O])}function Ue(B,w){const O=(0,X.iJ)(ee=>ee.pointClouds),A=(0,c.SK)();var H;const _=(0,Q.J5)((H=A?.projectFileId)!==null&&H!==void 0?H:"no-trajectory"),J=_?.visualizationMapping,D=(0,G.useMemo)(()=>{try{if(!A||!J)return we(B);const ee=xe(A,J);return w?ee:we(B).extend(ee)}catch(ee){return console.error("Error calculating base bounds:",ee),we(B)}},[B,A,J,w]);return(0,G.useMemo)(()=>{try{return A?D:Xe(B,O)||D}catch(ee){return console.error("Error calculating final bounds:",ee),D}},[A,D,B,O])}var ke=d(82039);function rt(){const B=(0,q.Sx)(),w=(0,ke.TL)();return(0,G.useEffect)(()=>{w((0,pe.is)(B.getBounds()))},[B,w]),(0,q.$_)("zoomend",O=>{w((0,pe.is)(O.target.getBounds()))}),(0,q.$_)("moveend",O=>{w((0,pe.is)(O.target.getBounds()))}),null}const dt={type:"timeRange",trajectoryTimeRanges:[]};function ye(){let{size:B="size-oldMinimap"}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const w=(0,de.sN)(),O=Object.entries((0,Q.yX)()),A=(0,G.useMemo)(()=>{const H={};for(const[_,J]of O){const D=J.spline,oe=(0,F.Z)(D),ee=new Set,ge=[];for(const be of oe)ee.add(ge.length),ge.push(...be);H[_]={runStarts:ee,points:ge}}return H},[O]);return O.length===0||w==="image"||w==="split"?null:(0,e.jsx)(yt,{convertedTrajectories:A,size:B})}const yt=(0,G.memo)(B=>{const{convertedTrajectories:w,size:O}=B,A=(0,j.F5)()==="Task",[H,_]=(0,G.useState)(A);return(0,e.jsxs)("div",{className:"relative",children:[A&&(0,e.jsx)(Lt,{shouldFocusTask:H,onClick:()=>_(!H)}),(0,e.jsxs)($.h,{className:O,center:new C.LatLng(0,0),zoom:17,maxZoom:18,scrollWheelZoom:!1,dragging:!1,doubleClickZoom:!1,attributionControl:!1,zoomControl:!1,children:[(0,e.jsx)(I.I,{url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),(0,e.jsx)(rt,{}),(0,e.jsx)(bt,{trajectories:w,shouldFocusTask:H}),(0,e.jsx)(Ae,{}),(0,e.jsx)(We,{trajectories:w}),(0,e.jsx)(je,{})]})]})});yt.displayName="Minimap";function Lt(B){let{shouldFocusTask:w,onClick:O}=B;return(0,e.jsx)(M.Button,{className:"absolute left-[174px]",style:{zIndex:L.OVERLAY_BUTTONS},icon:(0,e.jsx)(M.Icon,{icon:"zoom-to-fit"}),title:w?"Focus trajectories":"Focus task area",onClick:O,minimal:!0})}function bt(B){const{trajectories:w,shouldFocusTask:O}=B;return _e(w,O),null}function Ae(){const B=(0,X.Jk)(),w=new T.Z(B.x,B.y,B.z),O=V.Z.fromCartesian(w),A=new C.LatLng(x.Z.toDegrees(O.latitude),x.Z.toDegrees(O.longitude));return(0,e.jsx)(R.X,{name:"cameraIndicator",children:(0,e.jsx)(Fe,{cameraLatLng:A,heading:B.heading})})}function Fe(B){const{cameraLatLng:w,heading:O}=B,A=Se(w,O);return(0,e.jsx)(Ve,{...A})}function Ve(B){const{boundedLatLng:w,arrowParams:{vertexLatLng:O,tangentLatLngCW:A,tangentLatLngCCW:H}}=B;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(b.c,{center:w,radius:z.RADIUS_PX,color:"#137CBD",fillColor:"#137CBD",fillOpacity:1}),(0,e.jsx)(K.m,{positions:[O,A,H],color:"#137CBD",fillColor:"#137CBD",fillOpacity:1})]})}const We=(0,G.memo)(function(w){const{trajectories:O}=w,A=(0,k.Fc)(),H=A?.projectFileId;return(0,e.jsx)(e.Fragment,{children:Object.entries(O).map(_=>{let[J,D]=_;const oe=H===J;if(D.points.length===0)return null;const ee=oe?{type:"timeRange",trajectoryTimeRanges:le(D)}:dt;return(0,e.jsx)(N.j,{runStarts:D.runStarts,points:D.points,rangeSelection:ee,weight:oe?re.SELECTED:re.UNSELECTED},J)})})});function je(){const B=(0,c.SK)();var w;const O=(0,Q.J5)((w=B?.projectFileId)!==null&&w!==void 0?w:"no-trajectory");return!B||!O?null:(0,e.jsx)(W.Xy,{bounds:B.bounds,visualizationMapping:O.visualizationMapping})}},58950:function(Me,fe,d){"use strict";d.d(fe,{BK:function(){return te},Wx:function(){return C},ZP:function(){return I}});var e=d(10081),M=d(514),T=d(72994),V=d(56223);function x(R,b){const K=[];let k=0;for(const de of b){const j=de[0],X=de[1];j!==X&&(k<j&&K.push({originalIndex:k,text:R.substring(k,j),isMatch:!1}
247),K.push({originalIndex:j,text:R.substring(j,X),isMatch:!0}),k=X)}return k<R.length&&K.push({originalIndex:k,text:R.substring(k),isMatch:!1}),K}var c=d(47987),W=d(60218),F=d.n(W);function N(R){const b=x(R.str,R.matches);return(0,e.jsx)(e.Fragment,{children:b.map(K=>(0,e.jsx)("span",{className:K.isMatch?F().highlightedString:"",children:K.text},K.originalIndex))})}function Q(R){const{type:b,name:K,onChoose:k}=R;return(0,e.jsxs)(M.Button,{onClick:k,className:F().mostLastOption,children:[(0,e.jsx)("div",{children:(0,e.jsxs)("span",{style:{fontWeight:700},children:[b==="last"?"Last":"Most"," used"]})}),K]})}function C(R){const{name:b,onChoose:K,matches:k,isMultiSelected:de}=R;return(0,e.jsx)(M.Button,{onClick:K,className:"".concat(F().option," ").concat(de?F().multiSelected:""),disabled:R.disabled,title:R.disabled?"Disabled in filters":void 0,children:(0,e.jsx)("span",{className:F().objectOptionText,children:k&&k.length>0?(0,e.jsx)(N,{str:b,matches:k}):b})})}function te(R){const{searchTerm:b,setSearchTerm:K,choiceName:k}=R;return(0,e.jsx)(M.InputGroup,{autoFocus:!0,placeholder:"Search ".concat(k,"s..."),value:b,onChange:de=>K(de.target.value),onKeyDown:de=>{de.key==="Enter"&&R.onEnter&&R.onEnter()},rightElement:(0,e.jsx)(M.Button,{minimal:!0,children:(0,e.jsx)(M.Icon,{icon:"search",style:{margin:0}})}),onEmptied:()=>K("")})}function ne(R){return(0,e.jsx)(e.Fragment,{children:R.types.map(b=>{let{group:K,options:k}=b;return k.length===0?null:(0,e.jsxs)("div",{children:[(0,e.jsx)(M.H5,{children:K}),(0,e.jsx)("div",{className:F().options,children:k.map(de=>(0,e.jsx)(C,{name:de.name,disabled:de.disabled,onChoose:()=>R.onChoose(de)},de.name))})]},K)})})}function G(R){return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(M.H5,{children:["Filtered Results ",R.results.length]}),(0,e.jsx)("div",{className:F().options,children:R.results.map(b=>(0,e.jsx)(C,{name:b.item.name,matches:b.matches,disabled:b.item.disabled,onChoose:()=>R.onChoose(b.item)},b.item.name))})]})}function $(R){const[b,K]=(0,V.useState)(""),k=(0,c.Z)(R.types.flatMap(de=>de.options),"name",b);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(te,{searchTerm:b,setSearchTerm:K,choiceName:R.choiceName,onEnter:()=>{k.length===1&&R.onChoose(k[0].item)}}),!b&&(0,e.jsxs)("div",{className:F().options,children:[R.lastUsed?(0,e.jsx)(Q,{type:"last",name:R.lastUsed.name,onChoose:()=>R.onChoose(R.lastUsed)}):null,R.mostUsed?(0,e.jsx)(Q,{type:"most",name:R.mostUsed.name,onChoose:()=>R.onChoose(R.mostUsed)}):null]}),b?(0,e.jsx)(G,{results:k,onChoose:R.onChoose}):(0,e.jsx)(ne,{types:R.types,onChoose:R.onChoose})]})}function I(R){return(0,e.jsx)(M.Dialog,{isOpen:R.isOpen,onClose:R.onClose,title:R.title,className:T.Pyr,children:(0,e.jsx)("div",{className:"".concat(F().modal," styled-scrollbars"),children:(0,e.jsx)($,{types:R.types,choiceName:R.choiceName,onChoose:R.onChoose,mostUsed:R.mostUsed,lastUsed:R.lastUsed})})})}},65909:function(Me,fe,d){"use strict";d.d(fe,{D:function(){return W}});var e=d(8325),M=d(56223),T=d(82039),V=d(76470),x=d(78231),c=d(93920);function W(){const F=(0,T.TL)(),N=(0,c.W)(),Q=(0,M.useCallback)(()=>{const C=!N;F((0,c.vA)(C)),V.Z.show({message:"Trajectory path "+(C?"active":"hidden")+".",action:{text:"Press Shift+T to "+(C?"hide":"show"),intent:e.S.NONE,onClick:Q},intent:e.S.PRIMARY},"toggle-trajectory")},[N,F]);return(0,M.useEffect)(()=>{const C=()=>{Q()};return document.addEventListener(x.JP.TOGGLE_TRAJECTORY,C),()=>{document.removeEventListener(x.JP.TOGGLE_TRAJECTORY,C)}},[Q]),null}},27540:function(Me,fe,d){"use strict";d.d(fe,{g:function(){return je},Z:function(){return O}});var e=d(10081),M=d(514),T=d(48584),V=d(75057),x=d(93920),c=d(29117),W=d(94282),F=d(56223),N=d(82039),Q=d(75516),C=d(95497),te=d(63589),ne=d.n(te);function G(A){return(0,e.jsx)(M.Button,{icon:(0,e.jsx)(M.Icon,{icon:A.icon,size:24}),disabled:A.disabled,onClick:A.onClick,minimal:!0,style:{height:"100%"},title:A.title})}function $(A){const{images:H,imageWidths:_,imageHeight:J}=A,[D,oe]=(0,F.useState)(0),ee=st=>_.slice(0,st).reduce((Le,Ye)=>Le+Ye,0)+9*st,ge=ee(H.length),[be,Be]=(0,F.useState)(0);let Re=H.length-1;for(;ee(Re-1)+be>ge&&Re>0;)Re--;let ze=ee(D);return ze+be>ge&&(ze=ge-be),(0,e.jsxs)("div",{className:ne().carousel,children:[(0,e.jsx)("div",{className:ne().leftButton,children:(0,e.jsx)(G,{icon:"chevron-left",onClick:()=>{oe(Math.max(0,D-1))},disabled:D===0,title:"Move images left"})}),(0,e.jsx)("div",{className:ne().images,style:{height:J},ref:st=>{st&&st.clientWidth!==be&&Be(st.clientWidth)},children:(0,e.jsx)("div",{className:ne().imageContent,style:{transform:"translateX(-".concat(ze,"px)")},role:"listbox",children:H.map((st,Ze)=>(0,e.jsx)("div",{className:ne().image,style:{width:_[Ze],height:J},children:st},Ze))})}),(0,e.jsx)("div",{className:ne().rightButton,children:(0,e.jsx)(G,{icon:"chevron-right",onClick:()=>{oe(Math.min(Re,D+1))},disabled:D===Re,title:"Move images right"})})]})}var I=$;const R=239,b=173;var K=d(8585),k=d(78231),de=d(69748),j=d.n(de);function X(A,H){const _=(0,N.TL)();(0,F.useEffect)(()=>{const J=()=>{_((0,C.l3)("paused")),_((0,C._l)(A,!0))};return document.addEventListener(k.JP.NAVIGATION_STEP_FORWARD_TRAJECTORY,J),()=>{document.removeEventListener(k.JP.NAVIGATION_STEP_FORWARD_TRAJECTORY,J)}},[_,A]),(0,F.useEffect)(()=>{const J=()=>{_((0,C.l3)("paused")),_((0,C._l)(H,!0))};return document.addEventListener(k.JP.NAVIGATION_STEP_BACKWARD_TRAJECTORY,J),()=>{document.removeEventListener(k.JP.NAVIGATION_STEP_BACKWARD_TRAJECTORY,J)}},[_,H])}function z(A){const{view:H,trajectory:_}=A,J=(0,N.TL)(),[D,oe]=(0,F.useState)(1),{timestamp:ee,playback:ge,playbackDirection:be,playbackSpeed:Be}=H,Re=Math.min(_.maxTime,ee+D),ze=Math.max(_.minTime,ee-D),st=Math.min(_.maxTime,ee+1),Ze=Math.max(_.minTime,ee-1);return(0,F.useEffect)(()=>
247{if(ge==="paused")return;const Le=setInterval(()=>{be===1&&ee<_.maxTime?J((0,C._l)(st,!0)):be===-1&&ee>_.minTime&&J((0,C._l)(Ze,!0))},1e3/Be);return()=>clearInterval(Le)},[J,st,Ze,D,ee,_.maxTime,_.minTime,ge,Be,be]),X(Re,ze),(0,e.jsxs)("div",{className:j().stepbuttons,children:[(0,e.jsx)(K.u,{content:"Step Backward",placement:"top",children:(0,e.jsx)(M.Button,{icon:"step-backward","aria-label":"Step backward",disabled:ee===_.minTime,onClick:()=>{J((0,C.l3)("paused")),J((0,C._l)(ze,!0))}})}),(0,e.jsx)(M.NumericInput,{buttonPosition:"none",style:{width:40},value:D,onValueChange:Le=>oe(Le),min:1,max:100,stepSize:1}),(0,e.jsx)(K.u,{content:"Step Forward",placement:"top",children:(0,e.jsx)(M.Button,{icon:"step-forward","aria-label":"Step forward",disabled:ee===_.maxTime,onClick:()=>{J((0,C.l3)("paused")),J((0,C._l)(Re,!0))}})}),(0,e.jsx)(M.Divider,{className:j().verticalDivider}),(0,e.jsx)(M.Button,{icon:be===1?"arrow-right":"arrow-left","aria-label":be===1?"Forward":"Backward",onClick:()=>{J((0,C.wm)(be===1?-1:1))}}),(0,e.jsxs)(M.Button,{onClick:()=>{J((0,C.VV)((0,C.UY)(Be)))},children:["x",Be]}),(0,e.jsx)(M.Button,{icon:ge==="playing"?"pause":"play","aria-label":ge,onClick:()=>{J((0,C.l3)(ge==="playing"?"paused":"playing"))}})]})}function L(A){return(0,e.jsx)("div",{className:j().timeMarkers})}function re(A){const{view:H,trajectory:_}=A,J=(0,N.TL)(),D=H.liveSlider?H.liveSlider.timestamp:H.timestamp;return(0,e.jsx)(M.Slider,{labelRenderer:!1,min:_.minTime,max:_.maxTime,stepSize:.1,value:D,onChange:oe=>{J((0,C.Y2)({timestamp:Math.min(Math.max(oe,_.minTime),_.maxTime)}))},onRelease:()=>{const oe=H.liveSlider;oe&&(J((0,C._l)(oe.timestamp,!0)),J((0,C.Y2)(null)))}})}function q(A){return(0,e.jsxs)("div",{className:j().sliderAndLine,children:[(0,e.jsx)(L,{durationSeconds:15*60+30}),(0,e.jsx)(re,{view:A.view,trajectory:A.trajectory})]})}function pe(){const A=(0,C.rj)(),H=(0,W._Z)();return!A||!H?null:(0,e.jsxs)("div",{className:j().timeline,children:[(0,e.jsx)(z,{view:A,trajectory:H}),(0,e.jsx)(q,{view:A,trajectory:H})]})}var ce=pe;function m(A,H){if(A.length!==H.length)return!1;for(let _=0;_<A.length;_++)if(A[_]!==H[_])return!1;return!0}function ve(A,H,_){const[J,D]=useState(void 0),[oe,ee]=useState(!1),[ge,be]=useState(void 0);var Be;const Re=(Be=_?.arePropsEqual)!==null&&Be!==void 0?Be:m,ze=useRef(void 0);return useEffect(()=>{const st=async()=>{ee(!0);try{const Ze=await A(...H);D(Ze)}catch(Ze){be(Ze)}finally{ee(!1)}};(ze.current===void 0||!Re(ze.current,H))&&st(),ze.current=H},[A,Re,...H]),oe?[void 0,!0,void 0]:ge?[void 0,!1,ge]:[J,!1,void 0]}function Te(A){for(var H=arguments.length,_=new Array(H>1?H-1:0),J=1;J<H;J++)_[J-1]=arguments[J];const[D,oe]=(0,F.useState)(void 0),[ee,ge]=(0,F.useState)(!1),[be,Be]=(0,F.useState)(void 0);return(0,F.useEffect)(()=>{(async()=>{ge(!0);try{const ze=await A(..._);oe(ze)}catch(ze){Be(ze)}finally{ge(!1)}})()},[A,..._]),ee?[void 0,!0,void 0]:be?[void 0,!1,be]:[D,!1,void 0]}var xe=d(5265),we=d(8622);async function Xe(A,H){return await A.ready,A.getImage(H)}const le=2,Se=0;function _e(A){const{id:H,isThermal:_,pointCloudStyleSpec:J}=A,D=_?Se:le,oe=(0,F.useMemo)(()=>(0,we.fX)(H,D,_),[H,D,_]),ee=J?(0,xe.Vj)(J):void 0,ge=!!ee,be=(0,F.useMemo)(()=>{if(ge)return{min:ee.min,max:ee.max,scale:ee.scale}},[ge,ee?.min,ee?.max,ee?.scale]),[Be,Re,ze]=Te(Xe,oe,be);return[Be?{displayImage:Be,downloadLink:(0,we.Sp)(H)}:void 0,Re,ze]}var Ue=d(43928),ke=d.n(Ue),rt=d(55209),dt=d(83587),ye=d(2598),yt=d(16807),Lt=d(92959);function bt(A){const{imageHeight:H,imageWidth:_,displayHeight:J,displayWidth:D}=A;if(_/H>D/J){const oe=_/H*J;return{width:oe,height:J,top:0,left:(D-oe)/2}}else{const oe=H/_*D;return{width:D,height:oe,top:(J-oe)/2,left:0}}}const Ae=(0,F.forwardRef)((A,H)=>{const{ready:_,displayHeight:J,displayWidth:D,rotate:oe}=A,ee={width:D,height:J,justifyContent:"center",alignItems:"center",position:"relative"};let{imageWidth:ge,imageHeight:be}=A;oe%180===90&&([ge,be]=[be,ge]);const Be=bt({imageHeight:be,imageWidth:ge,displayHeight:J,displayWidth:D});let Re=Be.width,ze=Be.height;return oe%180===90&&([Re,ze]=[ze,Re]),(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{style:{display:_?"none":"flex",...ee},children:(0,e.jsx)(M.Spinner,{})}),(0,e.jsx)("div",{style:{display:_?"flex":"none",...ee},children:(0,e.jsx)("div",{style:{...Be,position:"absolute",display:"flex",justifyContent:"center",alignItems:"center"},children:(0,e.jsx)("canvas",{...A.canvasProps,ref:H,width:A.imageWidth,height:A.imageHeight,style:{width:Re,height:ze,transformOrigin:"center",transform:"rotate(".concat(oe,"deg)")}})})})]})});
247Ae.displayName="CanvasLoader";function Fe(A){const{image:H,displayDepth:_,cameraInfo:J}=A,D=(0,Lt.ZP)(J),oe=(0,ye.jW)(),ee=(0,F.useRef)(null),ge=(0,F.useCallback)(()=>{if(!ee.current)return;const Be=ee.current,Re=Be.getContext("2d");if(Re.clearRect(0,0,Be.width,Be.height),Re.globalAlpha=1,_){const ze=oe.get();if(ze&&J){const st=(0,yt.ZP)(ze,J.cameraCalibration,J.cameraToEcefTransform);st&&(Re.beginPath(),Re.arc(st.x,st.y,1,0,2*Math.PI),Re.fillStyle="red",Re.fill())}Re.globalAlpha=.2}H&&Re.drawImage(H,0,0,Be.width,Be.height),D&&Re.drawImage(D,0,0,Be.width,Be.height)},[H,oe,J,_,D]);(0,dt.Z)(ge);var be;return(0,e.jsx)(Ae,{ready:!!H,displayWidth:R,displayHeight:b,canvasProps:{},ref:ee,rotate:(be=J.rotationForDisplay)!==null&&be!==void 0?be:0,imageWidth:J.cameraCalibration.intrinsic.image_width,imageHeight:J.cameraCalibration.intrinsic.image_height})}const Ve={front:"Front camera",back:"Back camera",left:"Left camera",right:"Right camera",front_thermal:"Front thermal camera",back_thermal:"Back thermal camera"};function We(A){return(0,e.jsxs)(T.F,{content:A.contextMenu,tagName:"figure",className:"".concat(ke().imageFigure," ").concat(A.disabled?ke().imageDisabled:ke().imageEnabled),onClick:()=>{A.disabled||A.onClick()},onMouseEnter:A.disabled?void 0:A.onMouseEnter,onMouseLeave:A.disabled?void 0:A.onMouseLeave,children:[(0,e.jsx)("div",{className:ke().imageContainer,style:{width:R,height:b},children:A.image}),(0,e.jsx)("div",{className:"".concat(ke().imageBorder," ").concat(A.selected?ke().selected:ke().unselected)}),A.included==="included"&&(0,e.jsx)("div",{className:ke().includedOverlay,children:(0,e.jsx)(M.Icon,{icon:"tick",size:120,className:ke().includedTick})}),A.included==="excluded"&&(0,e.jsx)("div",{className:ke().excludedOverlay,children:(0,e.jsx)(M.Icon,{icon:"cross",size:120,className:ke().excludedCross,intent:"danger"})}),(0,e.jsx)("div",{className:ke().imageNameContainer,children:(0,e.jsx)("span",{className:ke().imageName,children:A.label})})]})}function je(A){const{perspective:H}=A,_=(0,N.TL)(),J=H.cameraName,D=(0,C.Mp)()===J,{fileId:oe,cameraDirectoryName:ee,stem:ge}=H.imageId,be=(0,F.useMemo)(()=>({fileId:oe,cameraDirectoryName:ee,stem:ge}),[oe,ee,ge]),Be=(0,c._H)(),Re=(0,V.F5)(),ze=(0,x.aA)(oe,kt=>kt),[st,Ze,Le]=_e({id:be,isThermal:H.cameraCalibration.type==="thermal",pointCloudStyleSpec:ze}),[Ye,Mt]=(0,F.useState)(!1);let Ft;if(Le)Ft=(0,e.jsx)(M.NonIdealState,{icon:"error",title:"Missing",description:"Image not available"});else if(Ze)Ft=(0,e.jsx)(M.Spinner,{style:{height:"100%"}});else{var en;Ft=(0,e.jsx)(Fe,{cameraInfo:H,image:(en=st?.displayImage)!==null&&en!==void 0?en:null,displayDepth:Ye})}return(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsx)(M.Button,{style:{position:"absolute",zIndex:401,left:R-30},icon:(0,e.jsx)(M.Icon,{icon:"document-open",style:{color:"white"}}),minimal:!0,title:"Open image in popup",onClick:()=>{_((0,C.ci)(ee,!0))}}),(0,e.jsx)(We,{image:Ft,label:J in Ve?Ve[J]:J,onClick:()=>{_((0,C.kW)(J))},onMouseEnter:()=>{_((0,C.uD)(J))},onMouseLeave:()=>{_((0,C.uD)(null))},disabled:Ze||Le,selected:D,included:Re==="CameraSelection"?Be[J]:void 0,contextMenu:(0,e.jsx)(rt.Z,{perspective:H})})]})}function B(A){const{trajectoryView:H,trajectory:_}=A,J=(0,F.useMemo)(()=>!H||!_?[]:[..._.closestImagesToTime(H.timestamp).values()],[_,H]);J.sort((ge,be)=>ge.cameraName.localeCompare(be.cameraName));const D=J.map(ge=>(0,e.jsx)(je,{perspective:ge},ge.cameraName)),oe=173,ee=J.map(ge=>R/b*oe);return(0,e.jsx)(I,{images:D,imageWidths:ee,imageHeight:oe})}function w(){const A=(0,C.rj)(),H=(0,W._Z)(),_=(0,Q.Z)()===Q.x.OBJECT_IMAGE,J=(0,C.te)()==="playing";return!A||!H?null:(0,e.jsxs)("div",{className:ke().bar,style:{display:_?"none":void 0},children:[(0,e.jsx)(ce,{}),!J&&(0,e.jsx)(B,{trajectoryView:A,trajectory:H})]})}var O=w},55209:function(Me,fe,d){"use strict";d.d(fe,{Z:function(){return F}});var e=d(10081),M=d(514),T=d(10918),V=d(36091),x=d(56223),c=d(8622);function W(N){const{fileId:Q,cameraDirectoryName:C,stem:te}=N.perspective.imageId,[ne,G]=(0,x.useState)(!1);return(0,e.jsx)(V.default,{children:(0,e.jsx)(M.MenuItem,{text:"Submit to V7",icon:ne?"refresh":void 0,onClick:async()=>{G(!0),await fetch("/api/files/".concat(Q,"/submit-to-v7/images/").concat(encodeURIComponent(C),"/").concat(encodeURIComponent(te)),{method:"POST"}),G(!1)},shouldDismissPopover:!1})})}function F(N){var Q;const{perspective:C}=N,ne=(Q=(0,T.lE)(N.perspective.imageId.fileId).projectFile)===null||Q===void 0?void 0:Q.displayName,{cameraDirectoryName:G,stem:$}=C.imageId;return(0,e.jsxs)(M.Menu,{children:[(0,e.jsx)(M.MenuItem,{text:"Download image",href:(0,c.Sp)(C.imageId),download:"".concat(ne,"-").concat(G,"-").concat($,".png")}),(0,e.jsx)(M.MenuItem,{text:"Copy timestamp",onClick:()=>{navigator.clipboard.writeText(C.imageTimestamp.toString())}}),(0,e.jsx)(M.MenuItem,{text:"Copy image stem",onClick:()=>{navigator.clipboard.writeText(C.imageId.stem)}}),(0,e.jsx)(W,{perspective:C})]})}},75516:function(Me,fe,d){"use strict";d.d(fe,{Z:function(){return x},x:function(){return V}});var e=d(17631),M=d(65117),T=d(95497),V;(function(c){c[c.STREETVIEW=1]="STREETVIEW",c[c.OBJECT_IMAGE=2]="OBJECT_IMAGE"})(V||(V={}));function x(){const c=(0,T.rj)(),W=(0,T.sN)(),F=(0,e.WE)(Q=>Q.detail==="object"&&Q.showImage),N=(0,M.IL)();return c&&W==="image"?1:F&&!N?2:null}},98491:function(Me,fe,d){"use strict";d.d(fe,{b:function(){return X}});var e=d(10081),M=d(56223),T=d(85385),V=d(95497),x=d(82039),c=d(32593);function W(){const z=(0,x.TL)(),L=(0,M.useCallback)(()=>{z((0,V.rf)()),z((0,V.tu)("lidar")),z((0,V.ev)())},[z]);return(0,e.jsxs)("div",{className:"flex flex-row items-center justify-between p-2",children:[(0,e.jsx)(T.gY2,{children:(0,e.jsx)("span",{children:"Trajectory View"})}),(0,e.jsx)("div",{className:"flex flex-row",children:(0,e.jsx)(T.XQ8,{title:"Close trajectory view",onPress:L,children:c.hcv})})]})}var F=d(94282),N=d(27540);function Q(){const z=(0,V.rj)(),L=(0,F._Z)(),re=(0,M.useMemo)(()=>!z||!L?[]:[...L.closestImagesToTime(z.timestamp).values()],[L,z]);return re.sort((q,pe)=>q.cameraName.localeCompare(pe.cameraName)),!z||!L||re.length===0?null:(0,e.jsx)(T.K9E,{isFixedSize:!1,
247className:"min-h-0 overflow-hidden",children:(0,e.jsx)(T.A_R,{children:(0,e.jsx)("div",{className:"space-y-2 p-2",children:re.map(q=>(0,e.jsx)("div",{className:"w-full shrink-0",children:(0,e.jsx)("div",{className:"max-w-full overflow-hidden",children:(0,e.jsx)(N.g,{perspective:q})})},q.cameraName))})})})}var C=d(6522),te=d(10792);function ne(){const z=(0,x.TL)(),L=(0,V.rj)(),re=(0,F._Z)(),q=(0,V.te)(),pe=(0,V.vy)(),ce=(0,V.dP)(),m=()=>{ce&&z((0,V.VV)((0,V.UY)(ce)))},ve=q==="playing",Te=Se=>{z((0,V.l3)(Se?"playing":"paused"))},xe=Se=>{z((0,V.wm)(Se?1:-1))},we=L?.liveSlider?L.liveSlider.timestamp:L?.timestamp,Xe=Se=>{if(!re)return;const _e=Math.min(Math.max(Se,re.minTime),re.maxTime);z((0,V.Y2)({timestamp:_e}))},le=Se=>{z((0,V._l)(Se,!0)),z((0,V.Y2)(null))};return(0,M.useEffect)(()=>{if(!L||!re||q==="paused")return;const Se=Math.min(re.maxTime,L.timestamp+1),_e=Math.max(re.minTime,L.timestamp-1),Ue=setInterval(()=>{pe===1&&L.timestamp<re.maxTime?z((0,V._l)(Se,!0)):pe===-1&&L.timestamp>re.minTime&&z((0,V._l)(_e,!0))},1e3/(ce??1));return()=>clearInterval(Ue)},[L,re,q,pe,ce,z]),{playbackSpeed:ce,handlePlaybackSpeedChange:m,isPlaying:ve,handlePlaybackToggle:Te,playbackDirection:pe,handleDirectionToggle:xe,displayValue:we,handleSliderChange:Xe,handleSliderChangeEnd:le,trajectoryView:L,trajectory:re}}function G(){const{playbackSpeed:z,handlePlaybackSpeedChange:L,isPlaying:re,handlePlaybackToggle:q,playbackDirection:pe,handleDirectionToggle:ce,displayValue:m,handleSliderChange:ve,handleSliderChangeEnd:Te,trajectoryView:xe,trajectory:we}=ne();return!xe||!we?null:(0,e.jsxs)("div",{className:"flex items-center justify-between px-1 pt-px",children:[(0,e.jsxs)("div",{className:"flex shrink-0 items-center",children:[(0,e.jsx)(te.n,{size:"sm",title:pe===1?"Forward":"Backward",description:pe===1?"Change direction to backward":"Change direction to forward",onIcon:c.uCi,offIcon:c.ld5,isSelected:pe===1,onChange:ce}),(0,e.jsx)("div",{className:"w-7",children:(0,e.jsxs)(C.z,{size:"sm",variant:"ghost",isFixedWidth:!1,title:"Playback Speed",description:"Current speed: ".concat(z??1,"x. Click to cycle through available speeds."),onPress:L,children:["x",z??1]})}),(0,e.jsx)(te.n,{size:"sm",title:re?"Pause":"Play",description:re?"Pause navigation playback":"Start navigation playback",onIcon:c.uhQ,offIcon:c.rg6,isSelected:re,onChange:q})]}),(0,e.jsx)("div",{className:"flex-1 pl-1",children:(0,e.jsx)(T.KlT,{value:m??0,minValue:we.minTime,maxValue:we.maxTime,step:.1,shouldShowOutput:!1,"aria-label":"Navigation timeline slider",onChange:ve,onChangeEnd:Te})})]})}var $=d(20460),I=d(12694),R=d(52861),b=d(75516),K=d(49601);function k(){const z=(0,x.TL)(),L=(0,V.sN)();return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(K.E,{title:"LiDAR view",isSelected:L==="lidar",onPress:()=>z((0,V.tu)("lidar")),children:c.rGD}),(0,e.jsx)(K.E,{title:"Layer view",isSelected:L==="split",onPress:()=>z((0,V.tu)("split")),children:c.D5$}),(0,e.jsx)(K.E,{title:"Image view",isSelected:L==="image",onPress:()=>z((0,V.tu)("image")),children:c.XvS})]})}function de(){const z=(0,V.S1)(),L=(0,R.EV)(),re=(0,b.Z)()===b.x.OBJECT_IMAGE,q=(0,I.ye)("useNewTrajectoryViewPanel",!1);return!(z&&!L&&!re)||!q?null:(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(k,{})})}function j(){const z=(0,V.rj)(),L=(0,F._Z)(),re=(0,x.TL)(),q=(0,V.S1)(),pe=(0,V.sN)(),ce=(0,V.b6)(),[m,ve]=(0,M.useState)(1),Te=(0,M.useCallback)(()=>{if(!L||!z)return;const ye=Math.min(L.maxTime,z.timestamp+m);re((0,V.l3)("paused")),re((0,V._l)(ye,!0))},[L,z,m,re]),xe=(0,M.useCallback)(()=>{if(!L||!z)return;const ye=Math.max(L.minTime,z.timestamp-m);re((0,V.l3)("paused")),re((0,V._l)(ye,!0))},[L,z,m,re]),we=(0,M.useMemo)(()=>[{combo:".",global:!0,label:"Step forward along Trajectory",group:"Trajectory",onKeyDown:Te},{combo:",",global:!0,label:"Step backward along Trajectory",group:"Trajectory",onKeyDown:xe}],[Te,xe]);(0,$.y)(we);const Xe=!q||pe!=="split",le=Xe,Se=Xe?"Image opacity control is only available in layer view mode":void 0,_e=ye=>{re((0,V.os)(ye))};if(!z||!L)return null;const{timestamp:Ue}
247=z,ke=Math.min(L.maxTime,Ue+m),rt=Math.max(L.minTime,Ue-m),dt=(0,e.jsx)(T.XQ8,{size:"sm",title:"Next image",description:"Navigate to next image",isDisabled:Ue===L.maxTime,onPress:()=>{re((0,V.l3)("paused")),re((0,V._l)(ke,!0))},children:c.Aug});return(0,e.jsxs)(T.zNw,{columnSizes:["minmax(0, 2fr)","minmax(0, 1fr)","auto"],size:"sm",endSlots:1,endItem1:dt,children:[(0,e.jsx)("div",{className:"flex pl-1",children:(0,e.jsx)(de,{})}),(0,e.jsx)(T.C2l,{label:c.yYZ,title:"Image opacity",description:Se,value:ce,onChange:_e,formatOptions:{minimumFractionDigits:0,maximumFractionDigits:0},isVisuallyDisabled:le}),(0,e.jsxs)("div",{className:"flex shrink-0 items-center",children:[(0,e.jsx)(T.XQ8,{size:"sm",title:"Previous image",description:"Navigate to previous image",isDisabled:Ue===L.minTime,onPress:()=>{re((0,V.l3)("paused")),re((0,V._l)(rt,!0))},children:c.yf_}),(0,e.jsx)(T.nJ3,{label:"S",className:"w-4",title:"Image step",description:"Set the step value for image navigation and hotkeys",value:m,minValue:1,maxValue:100,step:1,onChange:ye=>{ve(ye)}})]})]})}function X(){const z=(0,V.te)()==="playing";return(0,V.S1)()?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(T.Fr7,{className:"z-panel w-panel flex-none bg-bg",children:[(0,e.jsx)(T.K9E,{isFixedSize:!0,children:(0,e.jsx)(W,{})}),(0,e.jsx)(T.K9E,{isFixedSize:!0,children:(0,e.jsxs)(T.wk8,{className:"py-2",children:[(0,e.jsx)(j,{}),(0,e.jsx)(G,{})]})}),!z&&(0,e.jsx)(Q,{})]}),(0,e.jsx)(T.mxQ,{})]}):null}},64267:function(Me,fe,d){"use strict";d.d(fe,{q:function(){return T}});var e=d(7629);const M=new Set(["Stamen Watercolor","Stamen Toner","Sentinel-2","Blue Marble","Earth at night","Natural Earth\xA0II","Esri World Ocean","ArcGIS World Hillshade"]);function T(){return(0,e.Z)().filter(V=>!M.has(V.name))}},93139:function(Me,fe,d){"use strict";d.d(fe,{F:function(){return x}});var e=d(10081),M=d(514),T=d(14840),V=d(56223);function x(c){let{onChange:W}=c;const[F,N]=(0,V.useState)(1),Q=C=>{N(C),W({startNumber:C})};return(0,e.jsx)("div",{style:{width:"100px"},children:(0,e.jsx)(M.FormGroup,{label:"Initial number",children:(0,e.jsx)(T.u,{stepSize:10,min:0,precision:0,initialValue:F,onChange:Q})})})}},74345:function(Me,fe,d){"use strict";d.d(fe,{Z:function(){return x}});var e=d(10081),M=d(98241),T=d(79227),V=d(43254);function x(c){const{value:W,onChange:F,omit:N}=c,Q=(0,M.pF)(C=>C);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(V.Z,{label:"Code",value:W?W?.key:""}),(0,e.jsx)(T.Z,{value:W,selectOptions:Q,onChange:F,getOptionName:C=>C.key,getOptionInfo:C=>C.name,defaultText:"Select a projection",omit:N,failedToLoadOptionsText:"SVY21 / Singapore TM"})]})}},47987:function(Me,fe,d){"use strict";d.d(fe,{Z:function(){return e}});function e(M,T,V){const x=V.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),c=new RegExp(x,"ig");return M.map(W=>{if(V==="")return{item:W,matches:[]};const F=[];for(const N of Array.from(W[T].matchAll(c)))N.index===void 0||N[0]===void 0||F.push([N.index,N.index+N[0].length]);return F.length>0?{item:W,matches:F}:null}).filter(W=>W!==null)}},73013:function(Me,fe,d){"use strict";d.d(fe,{a:function(){return M}});const e=100;class M{static get instance(){return this._instance||(this._instance=new M),this._instance}ensurePerformanceObserver(){if(!(this.observer||!this.usePerformanceObserver)){if(typeof PerformanceObserver>"u"){this.usePerformanceObserver=!1;return}this.observer=new PerformanceObserver(x=>{}),this.observer.observe({entryTypes:["measure"]})}}prettyPrintLastTimingEvent(x){var c;const W=(c=this.completedTimingEvents.get(x))===null||c===void 0?void 0:c.last();if(W){let F="Timing Event (".concat(x,") - Total Duration: ").concat(W.msDuration.toFixed(2),"ms");for(const N of W.markedEvents)F+=` 248 - `.concat(N.label,": (Since start: ").concat(N.msTimeSinceStart.toFixed(2),"ms, Since previous: ").concat(N.msTimeSincePrevious.toFixed(2),"ms)");return F}return"No event"}getDurationOfLastTimingEvent(x){const c=this.completedTimingEvents.get(x),W=c?.last();return W?W.msDuration:-1}getAveragedDurationOfLastNTimingEvents(x){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1;const W=this.completedTimingEvents.get(x);if(!W||W.length===0)return 0;const F=c>0?W.toArray().slice(-c):W.toArray();return F.length===0?0:F.map(Q=>Q.msDuration).reduce((Q,C)=>Q+C,0)/F.length}getAllRecentTimingEventDurations(x){const c=this.completedTimingEvents.get(x);return!c||c.length===0?[]:c.toArray().map(W=>({msDuration:W.msDuration,markedEvents:W.markedEvents.map(F=>({...F}))}
248))}getMostRecentValueEvent(x){const c=this.recordedValueEvents.get(x),W=c?.last();return W?W.value:-1}getAllRecentValueEvents(x){const c=this.recordedValueEvents.get(x);return!c||c.length===0?[]:c.toArray().map(W=>W.value)}setFilteredTags(x){this.filteredTags=new Set(x)}clearFilteredTags(){this.filteredTags=void 0}recordValueEvent(x,c){if(!this.shouldTrack(x.tags))return;var W;const F=(W=this.recordedValueEvents.get(x.id))!==null&&W!==void 0?W:new T(e);F.push({...x,value:c}),this.recordedValueEvents.set(x.id,F)}startRecurringValueEvent(x,c,W){this.cancelRecurringValueEvent(x.id);const F=setInterval(()=>{const N=c();this.recordValueEvent(x,N)},W);this.recurringValueEventCancelCallbacks.set(x.id,()=>clearInterval(F))}cancelRecurringValueEvent(x){const c=this.recurringValueEventCancelCallbacks.get(x);c&&(c(),this.recurringValueEventCancelCallbacks.delete(x))}startTimingEvent(x){if(!this.shouldTrack(x.tags))return;if(this.currentlyTrackedTimingEvents.has(x.id)){console.warn("Performance monitor tried to start an event with an id(".concat(x.id,") that hasn't ended"));return}this.usePerformanceObserver&&(this.ensurePerformanceObserver(),this.usePerformanceObserver&&performance.mark("".concat(x.id,"-start")));const c={...x,startTime:performance.now(),markedEvents:[],msDuration:0};this.currentlyTrackedTimingEvents.set(c.id,c)}markTimingEvent(x,c){const W=this.currentlyTrackedTimingEvents.get(x);if(!W){console.warn("Performance monitor tried to mark an event with an id(".concat(x,") that is not active"));return}const F=performance.now()-W.startTime,N=W.markedEvents.at(-1),Q=N?F-N.msTimeSinceStart:F;W.markedEvents.push({label:c,msTimeSinceStart:F,msTimeSincePrevious:Q})}endTimingEvent(x){const c=this.currentlyTrackedTimingEvents.get(x);if(!c){console.warn("Performance monitor tried to end an event with an id(".concat(x,") that was never started"));return}this.usePerformanceObserver?this.endTimingEventWithPerformanceObserver(c):this.endTimingEventWithoutPerformanceObserver(c)}endTimingEventWithoutPerformanceObserver(x){const W=performance.now()-x.startTime;this.recordCompletedTimingEvent(x,W)}endTimingEventWithPerformanceObserver(x){const c=x.id;performance.mark("".concat(c,"-end"));const W=performance.measure(c,"".concat(c,"-start"),"".concat(c,"-end"));this.recordCompletedTimingEvent(x,W.duration)}recordCompletedTimingEvent(x,c){if(x){this.currentlyTrackedTimingEvents.delete(x.id);var W;const F=(W=this.completedTimingEvents.get(x.id))!==null&&W!==void 0?W:new T(e);x.msDuration=c,F.push(x),this.completedTimingEvents.set(x.id,F)}}clear(x){performance.clearMarks("".concat(x,"-start")),performance.clearMarks("".concat(x,"-end")),performance.clearMeasures(x),this.currentlyTrackedTimingEvents.delete(x)}shouldTrack(x){return!this.filteredTags||!x||x.length===0?!0:x.some(c=>this.filteredTags.has(c))}constructor(){this.usePerformanceObserver=!1,this.observer=null,this.filteredTags=void 0,this.currentlyTrackedTimingEvents=new Map,this.completedTimingEvents=new Map,this.recordedValueEvents=new Map,this.recurringValueEventCancelCallbacks=new Map}}class T{push(x){const c=(this.start+this.count)%this.capacity;this.buffer[c]=x,this.count<this.capacity?this.count++:this.start=(this.start+1)%this.capacity}get length(){return this.count}get(x){if(x<0||x>=this.count)return;const c=(this.start+x)%this.capacity;return this.buffer[c]}first(){return this.count>0?this.buffer[this.start]:void 0}last(){if(this.count===0)return;const x=(this.start+this.count-1)%this.capacity;return this.buffer[x]}toArray(){const x=[];for(let c=0;c<this.count;c++){const W=(this.start+c)%this.capacity;x.push(this.buffer[W])}return x}constructor(x){this.capacity=x,this.start=0,this.count=0,this.buffer=new Array(x)}}},66456:function(Me,fe,d){"use strict";d.d(fe,{$V:function(){return x},Fb:function(){return c},Zq:function(){return M},bg:function(){return V},rr:function(){return T}});var e=d(73013);function M(F,N,Q){const C=e.a.instance.getAllRecentTimingEventDurations(F).map(te=>te.msDuration);return W(C,N,Q)}function T(F,N,Q){const C=e.a.instance.getAllRecentValueEvents(F);return W(C,N,Q)}function V(F){return e.a.instance.getMostRecentValueEvent(F)}function x(F){return e.a.instance.getDurationOfLastTimingEvent(F)}function c(F){let N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1;return e.a.instance.getAveragedDurationOfLastNTimingEvents(F,N)}function W(F,N,Q){return N&&(F.length>N&&(F=F.slice(-N)),F.length<N&&(F=[...new Array(N-F.length).fill(Q),...F])),F}},67846:function(Me,fe,d){"use strict";d.d(fe,{Uo:function(){return c},bb:function(){return N},u4:function(){return Q}});var e=d(10081),M=d(56223),T=d(29931),V=d(73013),x=d(66456),c;
248(function(ne){ne.SceneUpdate="Cesium_RenderUpdate",ne.GenerateImage="Cesium_RenderGenerateImage",ne.CompleteRenderPass="Cesium_SingleRenderPass",ne.NotRenderingInterval="Cesium_NotRendering",ne.FrameToFrameInterval="Cesium_FrameToFrame"})(c||(c={}));var W;(function(ne){ne.CommandsCount="Cesium_RenderCommandsCount",ne.PrimitivesCount="Cesium_RenderPrimitivesCount"})(W||(W={}));var F;(function(ne){ne.CesiumRenderPass="Cesium_RenderPass",ne.CesiumRenderPassDetailed="Cesium_RenderPassDetailed"})(F||(F={}));function N(){const ne=(0,x.$V)("Cesium_SingleRenderPass"),G=Math.min((0,x.$V)("Cesium_NotRendering"),1e3),I=1e3/(0,x.Fb)("Cesium_FrameToFrame",60),R=(0,x.bg)("Cesium_RenderCommandsCount"),b=(0,x.bg)("Cesium_RenderPrimitivesCount");return{fps:I,totalRenderDuration:ne,renderPassUpdateDuration:(0,x.$V)("Cesium_RenderUpdate"),renderPassDrawDuration:(0,x.$V)("Cesium_RenderGenerateImage"),intervalBetweenRenders:G,drawCommandsCount:R,primitivesCount:b}}function Q(){const{scene:ne}=(0,T.VQ)();return(0,M.useEffect)(()=>{ne&&te.attachToRenderLoop(ne)},[ne]),(0,e.jsx)(e.Fragment,{})}const C=new Map;class te{static attachToRenderLoop(G){this.detachFromRenderLoop(G);const $=V.a.instance,I=()=>{$.endTimingEvent("Cesium_FrameToFrame"),$.startTimingEvent({id:"Cesium_FrameToFrame",tags:["Cesium_RenderPass"]}),$.endTimingEvent("Cesium_NotRendering"),$.startTimingEvent({id:"Cesium_SingleRenderPass",tags:["Cesium_RenderPass"]}),$.startTimingEvent({id:"Cesium_RenderUpdate",tags:["Cesium_RenderPassDetailed"]})},R=()=>{$.endTimingEvent("Cesium_RenderUpdate")},b=()=>{$.startTimingEvent({id:"Cesium_RenderGenerateImage",tags:["Cesium_RenderPassDetailed"]});const de=G._frameState.commandList.length,j=G.primitives.length;$.recordValueEvent({id:"Cesium_RenderCommandsCount"},de),$.recordValueEvent({id:"Cesium_RenderPrimitivesCount"},j)},K=()=>{$.endTimingEvent("Cesium_RenderGenerateImage"),$.endTimingEvent("Cesium_SingleRenderPass"),$.startTimingEvent({id:"Cesium_NotRendering",tags:["Cesium_RenderPass"]})};G.preUpdate.addEventListener(I),G.postUpdate.addEventListener(R),G.preRender.addEventListener(b),G.postRender.addEventListener(K),C.set(G,{preUpdate:I,postUpdate:R,preRender:b,postRender:K})}static detachFromRenderLoop(G){const $=C.get(G);$&&(G.preUpdate.removeEventListener($.preUpdate),G.postUpdate.removeEventListener($.postRender),G.preRender.removeEventListener($.preRender),G.postRender.removeEventListener($.postRender),C.delete(G))}}},12478:function(Me,fe,d){"use strict";d.d(fe,{Kr:function(){return W},VM:function(){return c},h1:function(){return x}});var e=d(10081),M=d(56223),T=d(73013),V=d(66456),x;(function(C){C.UsedHeapMb="Memory_UsedHeapMb",C.TotalHeapMb="Memory_TotalHeapMb",C.MaxHeapSizeMb="Memory_MaxHeapSizeMb"})(x||(x={}));function c(){return{heapUsedMb:(0,V.bg)("Memory_UsedHeapMb"),totalHeapMb:(0,V.bg)("Memory_TotalHeapMb"),maxHeapSizeMb:(0,V.bg)("Memory_MaxHeapSizeMb")}}function W(){return(0,M.useEffect)(()=>(F(500),()=>N()),[]),(0,e.jsx)(e.Fragment,{})}function F(C){T.a.instance.startRecurringValueEvent({id:"Memory_UsedHeapMb"},()=>Q().mbUsedHeap,C),T.a.instance.startRecurringValueEvent({id:"Memory_TotalHeapMb"},()=>Q().mbTotalHeap,C),T.a.instance.startRecurringValueEvent({id:"Memory_MaxHeapSizeMb"},()=>Q().mbHeapSizeLimit,C)}function N(){T.a.instance.cancelRecurringValueEvent("Memory_UsedHeapMb"),T.a.instance.cancelRecurringValueEvent("Memory_TotalHeapMb"),T.a.instance.cancelRecurringValueEvent("Memory_MaxHeapSizeMb")}function Q(){if("memory"in performance){const{usedJSHeapSize:C,totalJSHeapSize:te,jsHeapSizeLimit:ne}=performance.memory;return{mbUsedHeap:C/1048576,mbTotalHeap:te/1048576,mbHeapSizeLimit:ne/1048576}}else return{mbUsedHeap:0,mbTotalHeap:0,mbHeapSizeLimit:0}}},18999:function(Me,fe,d){"use strict";d.d(fe,{Zk:function(){return W},vc:function(){return x},zR:function(){return c}});var e=d(10081),M=d(56223),T=d(73013),V=d(66456),x;(function(N){N.OpenFetch="NetworkOpenFetch",N.OpenXHR="NetworkOpenXHR",N.OpenWebSockets="NetworkOpenWebSockets",N.NetworkMBsPerSecond="NetworkMBsPerSecond"})(x||(x={}));function c(){const N=(0,V.bg)("NetworkOpenFetch"),Q=(0,V.bg)("NetworkOpenXHR"),C=(0,V.bg)("NetworkOpenWebSockets"),te=N+Q+C;return{openFetchRequests:N,xmlHttpRequests:Q,socketConnections:C,allOpenConnections:te,mbsPerSecond:(0,V.bg)("NetworkMBsPerSecond")}}function W(){const N=(0,M.useRef)(),Q=(0,M.useCallback)(C=>
248{T.a.instance.recordValueEvent({id:"NetworkOpenFetch"},C.openFetch),T.a.instance.recordValueEvent({id:"NetworkOpenXHR"},C.openXHR),T.a.instance.recordValueEvent({id:"NetworkOpenWebSockets"},C.openWebSockets),T.a.instance.recordValueEvent({id:"NetworkMBsPerSecond"},C.mbsThisSecond)},[]);return(0,M.useEffect)(()=>(N.current||(N.current=new F({onSample:Q}),N.current.start(500)),()=>{var C;(C=N.current)===null||C===void 0||C.stop(),N.current=void 0}),[Q]),(0,e.jsx)(e.Fragment,{})}class F{start(){let Q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1e3;this.patchFetch(),this.patchXHR(),this.patchWebSocket(),this.timerId=window.setInterval(()=>{const C={openFetch:this.openFetch,openXHR:this.openXHR,openWebSockets:this.openWebSockets,mbsThisSecond:this.bytesThisTick*(1e3/Q)/1e6};this.bytesThisTick=0,this.opts.onSample(C)},Q)}stop(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null),this.unpatchFetch(),this.unpatchXHR(),this.unpatchWebSocket()}patchFetch(){var Q=this;this.origFetch=window.fetch.bind(window),window.fetch=async function(){for(var C=arguments.length,te=new Array(C),ne=0;ne<C;ne++)te[ne]=arguments[ne];Q.openFetch++;try{const G=await Q.origFetch(...te),$=G.headers.get("content-length");if($)Q.bytesThisTick+=+$;else{const R=G.clone().body;if(R){const b=R.getReader();let K=!1;for(;!K;){const{value:k,done:de}=await b.read();K=de,k&&(Q.bytesThisTick+=k.byteLength)}}}return G}finally{Q.openFetch--}}}unpatchFetch(){this.origFetch&&(window.fetch=this.origFetch)}patchXHR(){this.origXhrSend=XMLHttpRequest.prototype.send;const Q=this;XMLHttpRequest.prototype.send=function(){for(var C=arguments.length,te=new Array(C),ne=0;ne<C;ne++)te[ne]=arguments[ne];Q.openXHR++;const G=()=>{var $;Q.openXHR--;const I=this.getResponseHeader("content-length"),R=I?+I:(($=this.response)===null||$===void 0?void 0:$.length)||0;Q.bytesThisTick+=R,this.removeEventListener("loadend",G)};return this.addEventListener("loadend",G),Q.origXhrSend.apply(this,te)}}unpatchXHR(){this.origXhrSend&&(XMLHttpRequest.prototype.send=this.origXhrSend)}patchWebSocket(){this.origWebSocket=window.WebSocket;const Q=this.origWebSocket.prototype,C=this,te=function(G,$){const I=$?new C.origWebSocket(G,$):new C.origWebSocket(G);return C.openWebSockets++,I.addEventListener("close",()=>{C.openWebSockets--}),I.addEventListener("message",R=>{let b=0;typeof R.data=="string"?b=new TextEncoder().encode(R.data).length:R.data instanceof ArrayBuffer?b=R.data.byteLength:R.data instanceof Blob?b=R.data.size:ArrayBuffer.isView(R.data)&&(b=R.data.byteLength),C.bytesThisTick+=b}),I};te.prototype=Q;const ne=new Set(["prototype","name","length","caller","callee","arguments"]);Object.getOwnPropertyNames(this.origWebSocket).forEach(G=>{ne.has(G)||(te[G]=this.origWebSocket[G])}),window.WebSocket=te}unpatchWebSocket(){this.origWebSocket&&(window.WebSocket=this.origWebSocket)}constructor(Q){this.opts=Q,this.openFetch=0,this.openXHR=0,this.openWebSockets=0,this.bytesThisTick=0,this.timerId=null}}},3007:function(Me,fe,d){"use strict";d.d(fe,{cR:function(){return Q},oh:function(){return C},z6:function(){return W}});var e=d(10081),M=d(97301),T=d(56223),V=d(53068),x=d(73013),c=d(66456),W;(function(G){G.RenderPass="Rooster_SingleRenderPass",G.NotRenderingInterval="Rooster_NotRendering",G.FrameToFrameInterval="Rooster_FrameToFrame"})(W||(W={}));var F;(function(G){G.PointCloudNodes="Rooster_RenderPointCloudNodes",G.Geometries="Rooster_RenderGeometries",G.Textures="Rooster_RenderTextures",G.Programs="Rooster_RenderPrograms"})(F||(F={}));var N;(function(G){G.RoosterRenderPass="Rooster_RenderPass"})(N||(N={}));function Q(){const G=(0,c.$V)("Rooster_SingleRenderPass"),$=Math.min((0,c.$V)("Rooster_NotRendering"),1e3),I=(0,c.Fb)("Rooster_FrameToFrame",60),R=I>0?1e3/I:0,b=(0,c.bg)("Rooster_RenderGeometries"),K=(0,c.bg)("Rooster_RenderPointCloudNodes"),k=(0,c.bg)("Rooster_RenderTextures"),de=(0,c.bg)("Rooster_RenderPrograms");return{fps:R,totalRenderDuration:G,intervalBetweenRenders:$,renderedPointCloudNodes:K,renderedGeometries:b,renderedTextures:k,renderedPrograms:de}}function C(){const G=(0,V.jE)();return(0,T.useEffect)(()=>
248{if(G)return ne.attachToRenderLoop(G),()=>{ne.detachFromRenderLoop(G)}},[G]),(0,e.jsx)(e.Fragment,{})}const te=new Map;class ne{static attachToRenderLoop($){this.detachFromRenderLoop($);const I=x.a.instance;I.startTimingEvent({id:"Rooster_NotRendering",tags:["Rooster_RenderPass"]}),I.startTimingEvent({id:"Rooster_FrameToFrame",tags:["Rooster_RenderPass"]});const R=(k,de)=>{try{I.endTimingEvent("Rooster_FrameToFrame"),I.startTimingEvent({id:"Rooster_FrameToFrame",tags:["Rooster_RenderPass"]})}catch(j){console.warn("RoosterPerformanceTracking error:",j)}},b=(k,de)=>{try{I.endTimingEvent("Rooster_NotRendering"),I.startTimingEvent({id:"Rooster_SingleRenderPass",tags:["Rooster_RenderPass"]})}catch(j){console.warn("RoosterPerformanceTracking preRender error:",j)}},K=(k,de)=>{this.recordThreeRenderInfoMetrics($.renderContext.renderer.info,I),this.recordPotreeMetrics($.renderContext.potreeViewer,I),I.endTimingEvent("Rooster_SingleRenderPass"),I.startTimingEvent({id:"Rooster_NotRendering",tags:["Rooster_RenderPass"]})};$.renderContext.addRenderStageCallback(M.K.PreUpdate,R),$.renderContext.addRenderStageCallback(M.K.PreRender,b),$.renderContext.addRenderStageCallback(M.K.PostRender,K),te.set($,{updateCallback:R,preRenderCallback:b,postRenderCallback:K})}static recordThreeRenderInfoMetrics($,I){I.recordValueEvent({id:"Rooster_RenderGeometries"},$.memory.geometries),I.recordValueEvent({id:"Rooster_RenderTextures"},$.memory.textures),$.programs&&I.recordValueEvent({id:"Rooster_RenderPrograms"},$.programs.length)}static recordPotreeMetrics($,I){var R;if(!((R=$.scene)===null||R===void 0)&&R.pointclouds){let b=0;$.scene.pointclouds.forEach(K=>{b+=K.visibleNodes.length}),I.recordValueEvent({id:"Rooster_RenderPointCloudNodes"},b)}}static detachFromRenderLoop($){const I=te.get($);if(I){$.renderContext.removeRenderStageCallback(M.K.PreUpdate,I.updateCallback),$.renderContext.removeRenderStageCallback(M.K.PreRender,I.preRenderCallback),$.renderContext.removeRenderStageCallback(M.K.PostRender,I.postRenderCallback),te.delete($);const R=x.a.instance;R.clear("Rooster_FrameToFrame"),R.clear("Rooster_SingleRenderPass"),R.clear("Rooster_NotRendering")}}}},35079:function(Me,fe,d){"use strict";d.d(fe,{HP:function(){return c},_x:function(){return F},kg:function(){return W},tp:function(){return x}});var e=d(10081),M=d(56223),T=d(73013),V=d(66456);function x(){return{domNodesCount:(0,V.bg)("DomNodesCount"),reactRendersSec:(0,V.bg)("TotalReactRerendersPerSecond")}}var c;(function(C){C.DomNodesCount="DomNodesCount",C.TotalReactRerendersPerSecond="TotalReactRerendersPerSecond"})(c||(c={}));function W(){return(0,M.useEffect)(()=>(N(1),()=>Q()),[]),(0,e.jsx)(e.Fragment,{})}function F(C){const te=(0,M.useRef)(0),ne=(0,M.useCallback)(()=>{te.current++},[]);return(0,M.useEffect)(()=>{T.a.instance.startRecurringValueEvent({id:C.profilerId},()=>{const G=te.current;return te.current=0,G},1e3)},[C.profilerId]),(0,e.jsx)(M.Profiler,{id:C.profilerId,onRender:ne,children:C.children})}function N(C){T.a.instance.startRecurringValueEvent({id:"DomNodesCount"},()=>document.getElementsByTagName("*").length,C)}function Q(){T.a.instance.cancelRecurringValueEvent("DomNodesCount")}},61861:function(Me,fe,d){"use strict";d.d(fe,{d:function(){return X},v:function(){return z}});var e=d(10081),M=d(514),T=d(65117),V=d(76146),x=d(56223),c=d(82039),W=d(65272),F=d(42295),N=d(93935),Q=d(80042);N.kL.register(N.jn,N.uw,N.f$,N.od,N.Dx,N.u,N.De);function C(L){let{datasets:re,minY:q,maxY:pe,yAxisLabel:ce,xAxisLabel:m,maxPoints:ve}=L;ve=ve??100;const Te=(0,x.useRef)(),xe=re.map(le=>{let{dataPoints:Se,label:_e,color:Ue}=le;return{label:_e??"",data:Se.slice(-ve),borderColor:Ue??"rgba(255,255,255,1)",borderWidth:2,fill:!1}}),we=Math.max(...xe.map(le=>le.data.length)),Xe=Array.from({length:we},(le,Se)=>"");return(0,e.jsx)("div",{className:"w-full max-w-[600px]",children:(0,e.jsx)(Q.x1,{ref:Te,data:{labels:Xe,datasets:xe},options:{plugins:{legend:{display:!0,onClick:()=>{},labels:{color:"white",usePointStyle:!1,boxWidth:0}},tooltip:{enabled:!1}},elements:{point:{radius:0},line:{tension:0}},responsive:!1,animation:!1,scales:{y:{min:q,max:pe,title:{display:!!ce,text:ce,color:"white"},ticks:{color:"white"}},x:{title:{display:!!m,text:m,color:"white"},ticks:{display:!1}}}}})})}var te=d(66456),ne=d(67846);function G(){const L=(0,ne.bb)(),re=(0,te.Zq)(ne.Uo.CompleteRenderPass,50,0);return(0,e.jsxs)(F.af,{title:"Render Info",minimizeKey:"renderTracking",children:[(0,e.jsxs)("div",{children:["FPS: ",L.fps.toFixed(1),(0,e.jsx)("br",{})," Total Render Pass: ",L.totalRenderDuration.toFixed(2)," ms",(0,e.jsx)("br",{}),"- Render Pass (Update): ",L.renderPassUpdateDuration.toFixed(2)," ms",(0,e.jsx)("br",{}),"- Render Pass (Draw): ",L.renderPassDrawDuration.toFixed(2)," ms",(0,e.jsx)("br",{})," Not Rendering Interval: ",L.intervalBetweenRenders.toFixed(2)," ms"]}),(0,e.jsx)(F._B,{}),(0,e.jsxs)("div",{children:["Draw commands: ",L.drawCommandsCount.toFixed(0),(0,e.jsx)("br",{})," Primitives: ",L.primitivesCount.toFixed(0)]}),(0,e.jsx)(F._B,{}),(0,e.jsx)(C,{datasets:[{dataPoints:re,color:"rgba(255,255,0,0.8)",label:"Render Events (ms)"},{dataPoints:(0,te.Zq)(ne.Uo.SceneUpdate,50,0),color:"rgba(255,0,0,0.8)"},{dataPoints:(0,te.Zq)(ne.Uo.GenerateImage,50,0),color:"rgba(0,255,0,0.8)"}],minY:0,maxY:50})]})}var $=d(12478);function I(){const L=(0,$.VM)();return(0,e.jsxs)(F.af,{title:"Memory Usage",minimizeKey:"memoryTracking",children:[(0,e.jsxs)("div",{children:["Heap Used: ",L.heapUsedMb.toFixed(2)," mb",(0,e.jsx)("br",{})," Total Heap: ",L.totalHeapMb.toFixed(2)," mb",(0,e.jsx)("br",{})," Heap Max Size: ",L.maxHeapSizeMb.toFixed(2)," mb"]}),(0,e.jsx)(F._B,{}),(0,e.jsx)(C,{datasets:[{dataPoints:(0,te.rr)($.h1.UsedHeapMb,50,0),color:"rgba(0,255,137,0.8)",label:"Memory Usage (mb)"},{dataPoints:(0,te.rr)($.h1.TotalHeapMb,50,0),color:"rgba(155,255,0,0.8)"}]})]})}var R=d(18999);function b(){const L=(0,R.zR)();return(0,e.jsxs)(F.af,{title:"Network Usage",minimizeKey:"networkTracking",children:[(0,e.jsxs)("div",{children:["All Connections: ",L.allOpenConnections.toFixed(0),(0,e.jsx)("br",{})," Fetch Requests: ",L.openFetchRequests.toFixed(0),(0,e.jsx)("br",{})," XML HTTP Requests: ",L.xmlHttpRequests.toFixed(0),(0,e.jsx)("br",{})," Socket Connections: ",L.socketConnections.toFixed(0),(0,e.jsx)("br",{})," Mbs Per Second: ",L.mbsPerSecond.toFixed(2)]}),(0,e.jsx)(F._B,{}),(0,e.jsx)(C,{datasets:[{dataPoints:(0,te.rr)(R.vc.OpenFetch,50,0),color:"rgba(255,0,0,0.8)",label:"Fetch (Red) \u2022 XHR (Green) \u2022 Sockets (Blue)"},{dataPoints:(0,te.rr)(R.vc.OpenXHR,50,0),color:"rgba(0,255,0,0.8)"},{dataPoints:(0,te.rr)(R.vc.OpenWebSockets,50,0),color:"rgba(0,0,255,0.8)"}],minY:0,maxY:40}),(0,e.jsx)(C,{datasets:[{dataPoints:(0,te.rr)(R.vc.NetworkMBsPerSecond,50,0),color:"rgba(255,127,0,0.8)",label:"Mbs Per Second"}],minY:0,maxY:50})]})}var K=d(3007);function k(){const L=(0,K.cR)(),re=(0,te.Zq)(K.z6.RenderPass,50,0);return(0,e.jsxs)(F.af,{title:"Rooster Render Info",minimizeKey:"roosterRenderTracking",children:[(0,e.jsxs)("div",{children:["Frames Per Second: ",L.fps.toFixed(1),(0,e.jsx)("br",{})," Render Pass: ",L.totalRenderDuration.toFixed(2)," ms",(0,e.jsx)("br",{})," Not Rendering Interval: ",L.intervalBetweenRenders.toFixed(2)," ms"]}),(0,e.jsx)(F._B,{}),(0,e.jsxs)("div",{children:["Rendered Geometries: ",L.renderedGeometries.toFixed(0),(0,e.jsx)("br",{})," Rendered Textures: ",L.renderedTextures.toFixed(0),(0,e.jsx)("br",{})," Rendered Programs: ",L.renderedPrograms.toFixed(0),(0,e.jsx)("br",{})," Point Cloud Nodes: ",L.renderedPointCloudNodes.toFixed(0)]}),(0,e.jsx)(F._B,{}),(0,e.jsx)(C,{datasets:[{dataPoints:re,color:"rgba(255,255,0,0.8)",label:"Render Events (ms)"}],minY:0,maxY:50})]})}var de=d(35079);function j(){const L=(0,de.tp)();return(0,e.jsxs)(F.af,{title:"Web Elements",minimizeKey:"webElementsTracking",children:[(0,e.jsxs)("div",{children:["DOM Nodes: ",L.domNodesCount.toFixed(0)]}),(0,e.jsxs)("div",{children:["React Rerenders Per Second: ",L.reactRendersSec.toFixed(0)]}),(0,e.jsx)(F._B,{}),(0,e.jsx)(C,{datasets:[{dataPoints:(0,te.rr)(de.HP.DomNodesCount,50,0),color:"rgba(20,20,255,0.8)",label:"DOM Nodes Count"}]}),(0,e.jsx)(C,{datasets:[{dataPoints:(0,te.rr)(de.HP.TotalReactRerendersPerSecond,50,0),color:"rgba(0,255,255,0.8)",label:"React Rerenders / Second"}]})]})}function X(){const L=(0,c.TL)(),re=(0,T.gZ)(),q=(0,x.useCallback)(()=>{L((0,T.ob)(!1))},[L]);return re?(0,e.jsx)(V.QP,{title:"Performance Tracking",topbarButtons:(0,e.jsx)(M.Button,{minimal:!0,small:!0,icon:"cross",onClick:q}),customPopoverStyle:{maxHeight:"80vh"},children:(0,e.jsx)(z,{})}):null}function z(L){const[re,q]=(0,x.useState)(0),pe=100;var ce;const m=(ce=L.mode)!==null&&ce!==void 0?ce:W.q.Cesium;(0,x.useEffect)(()=>{const Te=setInterval(()=>{q(xe=>xe+1)},pe);return()=>clearInterval(Te)},[]);let ve=(0,e.jsx)(e.Fragment,{});switch(m){case W.q.Cesium:ve=(0,e.jsx)(G,{});break;case W.q.Rooster:ve=(0,e.jsx)(k,{});break}return(0,e.jsxs)(e.Fragment,{children:[ve,(0,e.jsx)(b,{}),(0,e.jsx)(I,{}),(0,e.jsx)(j,{})]})}},65272:function(Me,fe,d){"use strict";d.d(fe,{q:function(){return e}});var e;(function(M){M.Cesium="Cesium",M.Rooster="Rooster"})(e||(e={}))},91624:function(Me,fe,d){"use strict";d.d(fe,{F:function(){return V},V:function(){return x}});var e=d(10081),M=d(21341),T=d.n(M);function V(c){return(0,e.jsx)("div",{className:T().detailRowContainer,children:c.children})}function x(c){let{left:W,right:F}=c;return(0,e.jsxs)("div",{className:T().detailRow,children:[(0,e.jsx)("div",{className:"".concat(T().detailRowLeft),children:W}),(0,e.jsx)("div",{className:"".concat(T().right," select-text"),children:F})]})}},52378:function(Me,fe,d){"use strict";d.d(fe,{LN:function(){return R},bw:function(){return b},iE:function(){return k},sO:function(){return K},sh:function(){return $},ul:function(){return de}});var e=d(10081),M=d(56223),T=d(51566),V=d(67900),x=d(35656),c=d(51647),W=d(32201),F=d(43137),N=d(35441),Q=d(84797);const C=(0,M.createContext)({size:"md",variant:"default"}),te=()=>(0,M.useContext)(C),ne=(0,c.tv)({base:["fixed inset-0 z-50","flex items-center justify-center p-4","overflow-y-auto"],variants:{isEntering:{true:"duration-200 animate-in fade-in-0"},isExiting:{true:"duration-150 animate-out fade-out-0"}}}),G=(0,c.tv)({base:["relative flex max-h-full w-full flex-col rounded-sm bg-bg-menu shadow-elevation-400","overflow-hidden","outline-none"],variants:{size:{sm:"max-h-[24rem] min-w-[20rem] max-w-sm",md:"max-h-[32rem] min-w-[24rem] max-w-md",lg:"max-h-[40rem] min-w-[28rem] max-w-2xl",xl:"max-h-[48rem] min-w-[32rem] max-w-4xl",auto:"max-h-[90vh] min-w-[20rem] max-w-[90vw]",full:"h-screen max-h-screen w-screen max-w-full",custom:""},isEntering:{true:"duration-200 animate-in fade-in-0 zoom-in-95 slide-in-from-bottom-2"},isExiting:{true:"duration-150 animate-out fade-out-0 zoom-out-95 slide-out-to-bottom-2"}},defaultVariants:{size:"md"}});function $(j){let{children:X,size:z="md",variant:L="default",...re}=j;const q=(0,M.useMemo)(()=>({size:z,variant:L}),[z,L]);return(0,e.jsx)(C.Provider,{value:q,children:(0,e.jsx)(T.hg,{...re,children:X})})}const I=N.S,R=M.forwardRef((j,X)=>{let{children:z,className:L,...re}=j;return(0,e.jsx)(V.ZA,{ref:X,className:(0,Q.tw)(ne,{variants:{},className:L}),isDismissable:!0,...re,children:(0,e.jsx)(V.u_,{children:z})})}),b=M.forwardRef((j,X)=>{let{children:z,size:L,variant:re,className:q,...pe}=j;const ce=te(),m=L??ce.size;return(0,e.jsx)(T.Vq,{ref:X,className:G({size:m,className:q}),...pe,children:z})}),K=M.forwardRef((j,X)=>{let{children:z,className:L,showCloseButton:re=!0,hasContentDivider:q=!1,title:pe,onClose:ce,...m}=j;return(0,e.jsx)("header",{ref:X,className:"shrink-0 border-b border-border-menu bg-bg-menu px-2 py-1 text-text-menu ".concat(L||""),...m,children:(0,e.jsxs)("div",{className:"flex items-center justify-between py-1 ".concat(q?"gap-1":"gap-4"),children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-1 items-center overflow-hidden pl-2 ".concat(q?"gap-4 py-0.5":"gap-2"),children:[pe&&(0,e.jsx)(x.X,{slot:"title",className:"shrink-0 text-body-medium-strong font-strong text-text-menu",children:pe}),z]}),q&&(0,e.jsx)("div",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-border-menu"}),re&&(0,e.jsx)(F.Q,{slot:"close",onPress:ce,"aria-label":"Close",children:W.UE_})]})})}),k=M.forwardRef((j,X)=>{let{children:z,className:L,...re}=j;return(0,e.jsx)("div",{ref:X,className:"min-h-0 flex-1 overflow-y-auto bg-bg-menu text-text-menu ".concat(L||""),...re,children:z})}),de=M.forwardRef((j,X)=>{let{children:z,className:L,...re}=j;return(0,e.jsx)("footer",{ref:X,className:"flex shrink-0 items-center justify-end gap-2 bg-bg-menu p-3 ".concat(L||""),...re,children:z})});$.displayName="StyledModalTrigger",I.displayName="StyledModalButton",R.displayName="StyledModalOverlay",b.displayName="StyledModalDialog",K.displayName="StyledModalHeader",k.displayName="StyledModalBody",de.displayName="StyledModalFooter"},49550:function(Me,fe,d){"use strict";d.d(fe,{t:function(){return c}});var e=d(10081),M=d(56223),T=d(98284),V=d(18581);const x=(W,F)=>{let{minValue:N=1,maxValue:Q,step:C=1,scrubThreshold:te=5,locale:ne="en-US",formatOptions:G,...$}=W;return(0,e.jsx)(V.n,{ref:F,...G&&{formatOptions:G},locale:ne,minValue:N,maxValue:Q,step:C,scrubThreshold:te,unit:T.fb.PIXELS,shouldDisplayShorthandUnit:!1,...$})},c=M.forwardRef(x);c.displayName="PixelInput"},75756:function(Me){Me.exports={wholePage:"bridgeLayout_wholePage__Md10d",imageModal:"bridgeLayout_imageModal__fYMls"}},24901:function(Me){Me.exports={positionInputDialog:"crossSectionLineAnnotationTool_positionInputDialog__NCrDz",positionInputControls:"crossSectionLineAnnotationTool_positionInputControls__OrgEr"}},13123:function(Me){Me.exports={indicator:"crossSectionPlacementTool_indicator__fqUUe"}},29524:function(Me){Me.exports={measurementGuideHorizontal:"MeasurementGuides_measurementGuideHorizontal__ikaq_",measurementGuideVertical:"MeasurementGuides_measurementGuideVertical__RungA",originMarker:"MeasurementGuides_originMarker__T8_V7",uniformMarker:"MeasurementGuides_uniformMarker__T4ERY"}},93096:function(Me){Me.exports={user:"cursorDisplay_user__tELa9",users:"cursorDisplay_users__FgipF",hasOverlap:"cursorDisplay_hasOverlap__n1euZ"}},41869:function(Me){Me.exports={body:"hotkeyDialog_body__vfsnf",tabs:"hotkeyDialog_tabs__zvxjw",tab:"hotkeyDialog_tab__kmTG5",activeTab:"hotkeyDialog_activeTab__ujsRb",inactiveTab:"hotkeyDialog_inactiveTab__PE_nn",right:"hotkeyDialog_right__Nzub2",tabHeading:"hotkeyDialog_tabHeading__8NRxj",bindings:"hotkeyDialog_bindings__SZ4R2",name:"hotkeyDialog_name__Vhmy8",combo:"hotkeyDialog_combo__J1MpJ",hotkeyRuler:"hotkeyDialog_hotkeyRuler__ksveH",comboKey:"hotkeyDialog_comboKey__OqoMP",dialog:"hotkeyDialog_dialog__2B6sm"}},46909:function(Me){Me.exports={cameraModeBar:"cameraModeBar_cameraModeBar__3Atzo",cameraModeBarButton:"cameraModeBar_cameraModeBarButton__ny4Ay",active:"cameraModeBar_active__j_hij",minimapContainer:"cameraModeBar_minimapContainer__NNUS5",performanceMonitor:"cameraModeBar_performanceMonitor__1qnXE",tiltHeadingControls:"cameraModeBar_tiltHeadingControls__lC4q7",smallCircle:"cameraModeBar_smallCircle__cVA1N",compassPopoverOverride:"cameraModeBar_compassPopoverOverride__fnNUA"}},60218:function(Me){Me.exports={modal:"chooseTypeModal_modal__vrUiT",options:"chooseTypeModal_options__qC3r5",option:"cho
248oseTypeModal_option__seyDJ",mostLastOption:"chooseTypeModal_mostLastOption__dUF4H",multiSelected:"chooseTypeModal_multiSelected__sMboF",highlightedString:"chooseTypeModal_highlightedString__qS4LB"}},51614:function(Me){Me.exports={body:"importDataModal_body__IQZC0"}},96067:function(Me){Me.exports={settings:"hybridViewSettingsBar_settings__znOjV",opacity:"hybridViewSettingsBar_opacity__Yp4OH",pick:"hybridViewSettingsBar_pick__ruw04",opacityText:"hybridViewSettingsBar_opacityText__ySveL",opacityLabel:"hybridViewSettingsBar_opacityLabel__uVWXl",opacityValue:"hybridViewSettingsBar_opacityValue__N842p"}},63589:function(Me){Me.exports={carousel:"imageCarousel_carousel__VnXGG",images:"imageCarousel_images__NeFnd",imageContent:"imageCarousel_imageContent__nKSyQ",image:"imageCarousel_image__oVwAh",button:"imageCarousel_button__5aE2K",active:"imageCarousel_active__crhOA",disabled:"imageCarousel_disabled__oDW3b"}},69748:function(Me){Me.exports={timeline:"timelineDisplay_timeline__geJOI",stepbuttons:"timelineDisplay_stepbuttons__OpxEn",sliderAndLine:"timelineDisplay_sliderAndLine__inPzi",timeMarkers:"timelineDisplay_timeMarkers__JMktN",verticalDivider:"timelineDisplay_verticalDivider__Ctl_C"}},43928:function(Me){Me.exports={bar:"vanViewBar_bar__H5Lw1",imageFigure:"vanViewBar_imageFigure__cfwGR",imageEnabled:"vanViewBar_imageEnabled__n48IV",imageBorder:"vanViewBar_imageBorder__6h69R",selected:"vanViewBar_selected__8EcJx",imageContainer:"vanViewBar_imageContainer__mN2LH",imageNameContainer:"vanViewBar_imageNameContainer__LZB6P",excludedOverlay:"vanViewBar_excludedOverlay__FOHu6",excludedCross:"vanViewBar_excludedCross__2xaX0",includedOverlay:"vanViewBar_includedOverlay__f03Yq",includedTick:"vanViewBar_includedTick__iGAPN",imageName:"vanViewBar_imageName__UJaS5"}},13855:function(Me){Me.exports={view:"fullScreenView_view__yE3yr",fullScreenImage:"fullScreenView_fullScreenImage__s7S7J",imageSelectionContainer:"fullScreenView_imageSelectionContainer__l_Bl6",imageSelectionImage:"fullScreenView_imageSelectionImage__38P3e",selected:"fullScreenView_selected__h0LFY"}},27791:function(Me){Me.exports={toolbar:"modeSelector_toolbar__VYR_I",toolbarBackground:"modeSelector_toolbarBackground__Du1eQ",toolbarBlur:"modeSelector_toolbarBlur__lP2i4",toolbarButtonContainer:"modeSelector_toolbarButtonContainer__OtSy1",toolbarButton:"modeSelector_toolbarButton__HP_wV",toolbarButtonActive:"modeSelector_toolbarButtonActive__S0ZL9",toolbarButtonInactive:"modeSelector_toolbarButtonInactive__2kSXg",icon:"modeSelector_icon__vkWes",toolbarHoverText:"modeSelector_toolbarHoverText__nh5_L",exitButton:"modeSelector_exitButton__xH6K2"}},21341:function(Me){Me.exports={detailRowContainer:"detailRow_detailRowContainer__o_SFE",detailRow:"detailRow_detailRow___JDjK",detailRowLeft:"detailRow_detailRowLeft__gbuHR",right:"detailRow_right__BOfFk"}}}]);})();
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.