@vertexvis/viewer-toolkit-react 0.0.3-canary.16 → 0.0.3-canary.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.cjs.js +1 -1
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.esm.js +1 -1
- package/dist/bundle.esm.js.map +1 -1
- package/dist/components/scene-tree/scene-tree-search/__tests__/enter-scene-tree-search-mode-button.spec.d.ts +1 -0
- package/dist/components/scene-tree/scene-tree-search/__tests__/scene-tree-search-bar.spec.d.ts +1 -0
- package/dist/components/scene-tree/scene-tree-search/enter-scene-tree-search-mode-button.d.ts +4 -0
- package/dist/components/scene-tree/scene-tree-search/scene-tree-search-bar.d.ts +8 -0
- package/dist/components/scene-tree/scene-tree-search/scene-tree-search.d.ts +9 -0
- package/dist/components/scene-tree/vertex-scene-tree-header.d.ts +5 -1
- package/dist/index.css +1 -1
- package/dist/state/scene-tree/search/index.d.ts +1 -0
- package/dist/state/scene-tree/search/search.d.ts +1 -0
- package/package.json +5 -5
package/dist/bundle.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("@vertexwebtoolkit/logging"),n=require("recoil"),i=require("@vertexvis/utils"),a=require("react"),s=require("@vertexvis/geometry"),o=require("@vertexvis/ui-react"),l=require("classnames"),r=require("@vertexvis/viewer"),c=require("@vertexvis/viewer-react"),u=require("@vertexvis/ui/loader"),d=require("@vertexvis/viewer/loader");function _interopNamespaceDefault(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var m=_interopNamespaceDefault(a);function __rest(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(n[i[a]]=e[i[a]]);return n}"function"==typeof SuppressedError&&SuppressedError;class p{}function useActionCallback(e,t=[]){const i=t instanceof p?void 0:t;return n.useRecoilCallback((t=>e(Object.assign(Object.assign({},t),{snapshot:Object.defineProperties(t.snapshot,{getPromiseRequired:{configurable:!0,value:createGetPromiseRequiredWrapper(t.snapshot)},tryGetPromise:{configurable:!0,value:createTryGetPromiseWrapper(t.snapshot)}})}))),i)}function retainSnapshot(e){return t=>{var{snapshot:n}=t,i=__rest(t,["snapshot"]);return async(...t)=>{const a=n.retain();try{const a=undefined;return await e(Object.assign(Object.assign({},i),{snapshot:n}))(...t)}finally{a()}}}}function createGetPromiseRequiredWrapper(e){return async(t,n)=>{const i=await e.getPromise(t);if(null==i)throw null!=n?n:new Error(`No value present for required value ${t.key}`);return i}}function createTryGetPromiseWrapper(e){return async n=>{try{return{value:await e.getPromise(n)}}catch(e){return t.logger.debug(`Error encountered retrieving Recoil value. [key={${n.key}}]`,e),{error:e}}}}const g=n.atom({key:"viewerToolkitViewerElement",default:void 0,dangerouslyAllowMutability:!0}),h=n.atom({key:"viewerElementId",default:"vertex-viewer"}),f=n.atom({key:"viewerInitialSceneReady",default:!1}),v=n.atom({key:"viewerBaseInteractionHandlerProvider",default:Promise.resolve(void 0),dangerouslyAllowMutability:!0}),b=n.atom({key:"viewerPrimaryInteractionType",default:"rotate"}),V=n.selector({key:"viewerScene",get:({get:e})=>async()=>{var t;return null===(t=e(g))||void 0===t?void 0:t.scene()},dangerouslyAllowMutability:!0}),w=n.atom({key:"viewerFrameScene",default:void 0,dangerouslyAllowMutability:!0}),S=n.selector({key:"viewerSceneVisibleBoundingBox",get:({get:e})=>{var t;return null===(t=e(w))||void 0===t?void 0:t.boundingBox}});function useViewerSceneActions(){const e=useActionCallback((({snapshot:e})=>async(t,n,...i)=>{const a=await e.getPromise(V),s=await a();i.length>0&&await(null==s?void 0:s.items((e=>i.map((t=>t(e))))).execute({suppliedCorrelationId:n}))})),t=a.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).select()),[]),n=a.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).deselect()),[]),s=a.useCallback((e=>e.where((e=>e.all())).deselect()),[]);return{executeWithCorrelationId:e,execute:useActionCallback((()=>async(t,...n)=>{const a=i.UUID.create();await e(t,a,...n)})),selectItemsTransform:t,deselectItemsTransform:n,clearSelectionTransform:s,reset:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromiseRequired(V),i=await n(),a=await e.getPromiseRequired(j);null==i||i.reset({includeCamera:!0,suppliedCorrelationId:t,cameraTypeOverride:a})}))}}const C=500;function useViewerCameraActions(){return{flyToById:useActionCallback((({snapshot:e})=>async(t,n)=>{const i=await e.getPromise(V),a=await i();await(null==a?void 0:a.camera().flyTo({itemId:t}).render({animation:{milliseconds:null!=n?n:C}}))})),flyToByBoundingBox:useActionCallback((({snapshot:e})=>async(t,n)=>{const i=await e.getPromise(V),a=await i();await(null==a?void 0:a.camera().flyTo({boundingBox:t}).render({animation:{milliseconds:null!=n?n:C}}))})),updateCameraType:useActionCallback((({set:e})=>t=>{e(j,t)}))}}const j=n.atom({key:"viewerCameraType",default:"perspective"});class A{constructor(){this.interactionStarted=!1}initialize(e,t){this.api=t}dispose(){this.endInteraction()}async beginInteraction(){var e;this.interactionStarted||(await(null===(e=this.api)||void 0===e?void 0:e.beginInteraction()),this.interactionStarted=!0)}async endInteraction(){var e;await(null===(e=this.api)||void 0===e?void 0:e.endInteraction()),this.interactionStarted=!1}}const create=(e,t=0)=>({normal:e,offset:t}),forAxis=(e,t)=>{switch(e){case"x":return x(t);case"y":return y(t);case"z":return z(t)}},x=e=>create(s.Vector3.left(),-e),y=e=>create(s.Vector3.down(),-e),z=e=>create(s.Vector3.forward(),-e),getAxis=(e,t)=>{switch(e){case"x":return xAxis(t);case"y":return yAxis(t);case"z":return zAxis(t)}},k={x:s.Vector3.left(),y:s.Vector3.down(),z:s.Vector3.forward()},xAxis=e=>e.x,yAxis=e=>e.y||s.Vector3.create(e.x.z,e.x.x,e.x.y),zAxis=e=>e.z||s.Vector3.create(e.x.y,e.x.z,e.x.x),axis=(e,t,n,i)=>e&&e.normal&&[["x",t],["y",n],["z",i]].filter((t=>0===s.Vector3.magnitude(s.Vector3.cross(e.normal,t[1])))).map((e=>e[0])).pop(),isNegativeNormal=e=>s.Vector3.dot(s.Vector3.create(-1,-1,-1),e.normal)>0,towardsVector=(e,t)=>{const n=undefined;return s.Vector3.dot(e,t.normal)<0?invert(t):t},towardsCamera=(e,t)=>towardsVector(e.viewVector,t),invert=e=>Object.assign(Object.assign({},e),{normal:s.Vector3.multiply(e.normal,s.Vector3.create(-1,-1,-1)),offset:-e.offset}),fromHit=(e,t)=>{const n=s.Vector3.normalize(e.normal),i=s.Vector3.dot(n,e.position);return towardsCamera(t,create(n,i))},toAxis=(e,t,n,i,a)=>{const o=n.viewAll(),l=getAxis(e,t),r=null!=i&&null!=l?create(l,s.Vector3.dot(l,a||s.BoundingBox.center(i))):forAxis(e,o.lookAt[e]);return towardsCamera(n,r)};function corners(e){return[s.Vector3.create(e.min.x,e.min.y,e.min.z),s.Vector3.create(e.min.x,e.min.y,e.max.z),s.Vector3.create(e.min.x,e.max.y,e.min.z),s.Vector3.create(e.min.x,e.max.y,e.max.z),s.Vector3.create(e.max.x,e.max.y,e.max.z),s.Vector3.create(e.max.x,e.max.y,e.min.z),s.Vector3.create(e.max.x,e.min.y,e.max.z),s.Vector3.create(e.max.x,e.min.y,e.min.z)]}function equals(e,t){return e.min.x===t.min.x&&e.min.y===t.min.y&&e.min.z===t.min.z&&e.max.x===t.max.x&&e.max.y===t.max.y&&e.max.z===t.max.z}const T="#999999",P=1,E={default:5,min:0,max:10},I=n.atom({key:"crossSectioningEnabled",default:!1}),R=n.atom({key:"crossSectioningHighlightColor",default:T}),M=n.atom({key:"crossSectioningBorderWidth",default:1}),O=n.atom({key:"crossSectioningPlanes",default:[]}),N=n.atom({key:"crossSectioningAlignment",default:{mode:"global",hitPending:!1}}),L=n.selector({key:"crossSectioningTargetBoundingBox",get:async({get:e})=>{const t=undefined;return e(S)}}),B=n.atom({key:"crossSectioningIsInteractive",default:!1}),_=n.atom({key:"crossSectioningActiveAxis",default:"x"}),D=n.atom({key:"crossSectioningAvailableAxes",default:k}),H=n.selector({key:"crossSectioningOffsetScalar",get:({get:e})=>{const t=e(O);return t.length>0&&isNegativeNormal(t[0])?-1:1}}),F=n.selector({key:"crossSectioningSliderRange",get:({get:e})=>{const t=e(O),n=e(L),i=null!=n?corners(n):[];if(t.length>0){const e=i.map((e=>s.Vector3.dot(e,isNegativeNormal(t[0])?s.Vector3.multiply(t[0].normal,s.Vector3.create(-1,-1,-1)):t[0].normal)));return{default:t[0].offset,min:Math.min(...e)-2,max:Math.max(...e)+2}}return E}}),U=n.selector({key:"crossSectioningPlaneDisplayOffset",get:({get:e})=>{const t=e(O),n=e(H),i=e(F);return t.length>0?t[0].offset*n:i.default}}),W=n.atom({key:"crossSectioningAdditionalToolsOpen",default:!1}),G=n.atom({key:"crossSectioningAlignmentToolsOpen",default:!1}),K=n.atom({key:"crossSectioningAxisToolsOpen",default:!1}),q=n.atom({key:"crossSectioningInteractionHandler",default:new A,dangerouslyAllowMutability:!0});function useCrossSectioning(e,t){const i=n.useRecoilValue(q);a.useEffect((()=>{t&&(null==e||e.registerInteractionHandler(i))}),[e,t,i])}const $=n.atom({key:"hitResultsTapDetails",default:void 0}),Y=n.atom({key:"hitResultsLongPressDetails",default:void 0}),X=n.atom({key:"previousHitResult",default:void 0}),Z=n.atom({key:"currentHitResult",default:void 0}),J=n.selector({key:"hitResult",get:async({get:e})=>{var t,n,i,a,o,l,r,c;const u=e($),d=e(Y),m=null!=u?u:d,p=e(V),g=await p(),h=null==g?void 0:g.sceneViewId,f=null==g?void 0:g.raycaster();if(null!=m&&null!=f&&null!=h){const e=await f.hitItems(m.position),u=((null==e?void 0:e.hits)||[])[0];if(null!=u)return{id:null===(t=u.itemId)||void 0===t?void 0:t.hex,normal:s.Vector3.create((null===(n=null==u?void 0:u.hitNormal)||void 0===n?void 0:n.x)||0,(null===(i=null==u?void 0:u.hitNormal)||void 0===i?void 0:i.y)||0,(null===(a=null==u?void 0:u.hitNormal)||void 0===a?void 0:a.z)||0),position:s.Vector3.create((null===(o=null==u?void 0:u.hitPoint)||void 0===o?void 0:o.x)||0,(null===(l=null==u?void 0:u.hitPoint)||void 0===l?void 0:l.y)||0,(null===(r=null==u?void 0:u.hitPoint)||void 0===r?void 0:r.z)||0),meta:m.metaKey||m.ctrlKey||!1,metadata:[],ancestors:(null===(c=null==u?void 0:u.ancestors)||void 0===c?void 0:c.filter((e=>{var t;return null!=(null===(t=e.itemId)||void 0===t?void 0:t.hex)})).map((e=>{var t;return null===(t=e.itemId)||void 0===t?void 0:t.hex})))||[]}}}}),Q=n.atom({key:"hitResultsSkipNextTap",default:!1}),alignToNormal=(e,t,n)=>{if(e.toFrameCamera().isPerspective()){const n=s.Vector3.dot(s.Vector3.normalize(e.up),t),i=Math.abs(n)>.98?s.Vector3.normalize(s.Vector3.scale(-n,e.viewVector)):e.up,a=s.Vector3.add(s.Vector3.scale(s.Vector3.distance(e.position,e.lookAt),s.Vector3.multiply(t,s.Vector3.create(-1,-1,-1))),e.lookAt);return e.update({up:i,position:a})}{const i=s.Vector3.angleTo(s.Vector3.normalize(e.viewVector),t),a=null!=n?s.BoundingBox.center(n):e.lookAt,o=s.Vector3.normalize(s.Vector3.cross(s.Vector3.normalize(e.viewVector),t));return e.rotateAroundAxisAtPoint(i,a,o)}};function isParallelTo(e,t){const n=s.Angle.toDegrees(s.Vector3.angleTo(e,t));return 0===n||180===n}const ee=500;function useCrossSectioningActions(){const e=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(M),n=await e.getPromise(R),a=await e.getPromise(O),s=await e.getPromise(V),o=await s();await(null==o?void 0:o.crossSectioning().update({sectionPlanes:a,highlightColor:n?i.Color.fromHexString(n):void 0,lineWidth:t}))})),t=useActionCallback((({set:t,reset:n,snapshot:i})=>async()=>{const a=await i.getPromise(V),s=await a();if(null!=s){const i=s.camera().viewAll();n(D),t(O,[towardsCamera(s.camera(),x(i.lookAt.x))]),await e()}})),n=useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async()=>{const i=await t.tryGetPromise(J).then((e=>e.value)),a=await t.getPromise(V),s=await a();if(null!=i&&null!=s){const t=fromHit(i,s.camera());n(O,null!=t?[t]:[]),n(D,null!=t?{x:t.normal}:k),await e()}}))),a=useActionCallback((({set:e,snapshot:n})=>async()=>{const i=await n.getPromise(O),a=undefined;await n.getPromise(I)||(e(I,!0),0===i.length&&await t())})),o=useActionCallback((({reset:t,snapshot:n})=>async()=>{const i=undefined;await n.getPromise(I)&&(t(I),t(W),t(G),t(K),t(O),t(N),t(_),await e())}));return{enable:a,disable:o,reapply:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(I)&&await e()})),openAdditionalTools:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=undefined;await t.getPromise(I)||await a(),e(W,!0)})),closeAdditionalTools:useActionCallback((({reset:e})=>()=>{e(W)})),openAlignmentTools:useActionCallback((({set:e,reset:t})=>()=>{t(K),e(G,!0)})),closeAlignmentTools:useActionCallback((({reset:e})=>()=>{e(G)})),openAxisTools:useActionCallback((({set:e,reset:t})=>()=>{t(G),e(K,!0)})),closeAxisTools:useActionCallback((({reset:e})=>()=>{e(K)})),beginInteraction:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(q);e(B,!0),await n.beginInteraction()})),endInteraction:useActionCallback((({reset:e,snapshot:t})=>async()=>{const n=await t.getPromise(q);e(B),await n.endInteraction()})),updatePlanes:useActionCallback(retainSnapshot((({set:t,snapshot:n})=>async i=>{const a=await n.getPromise(O);if(a.length>0){const s=await n.getPromise(H),o=await n.getPromise(F),l=s<0?-1*o.max:o.min,r=s<0?-1*o.min:o.max,c=a.map((e=>Object.assign(Object.assign({},e),{offset:Math.min(Math.max(i*s,l),r)})));t(O,c),await e()}}))),flipPlanes:useActionCallback((({set:t,snapshot:n})=>async()=>{const i=await n.getPromise(O);t(O,i.map((e=>invert(e)))),await e()})),alignViewToPlane:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(O),n=await e.getPromise(g),i=await(null==n?void 0:n.scene());t.length>0&&null!=i&&await alignToNormal(i.camera(),t[0].normal,i.boundingBox()).render({animation:{milliseconds:ee}})})),updateAxis:useActionCallback(retainSnapshot((({set:t,reset:n,snapshot:i})=>async a=>{const o=await i.getPromise(O),l=await i.getPromise(D),r=await i.getPromise(L),c=await i.getPromise(N),u=await i.getPromise(g),d=await(null==u?void 0:u.scene()),m=l[a],p=null!=m&&o.length>0&&isParallelTo(o[0].normal,m)&&!isNaN(s.Vector3.angleTo(o[0].normal,m));if(null!=d&&!p){const e=await i.tryGetPromise(J).then((e=>e.value));t(_,a),t(O,[toAxis(a,l,d.camera(),r,"global"!==c.mode?null==e?void 0:e.position:void 0)])}n(K),await e()}))),updateAlignment:useActionCallback((({set:e,reset:i})=>async(s,o)=>{i(G),e(N,{mode:s,hitPending:"global"!==s&&null==o}),"global"===s?(i(_),i(D),await t()):"surface"===s&&null!=o&&(await a(),await n())})),sectionCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const i=await t.getPromise(N);i.hitPending&&(e(N,Object.assign(Object.assign({},i),{hitPending:!1})),"surface"===i.mode&&await n())})),cancelCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(N);n.hitPending&&e(N,Object.assign(Object.assign({},n),{hitPending:!1}))}))}}var te=Object.freeze({__proto__:null,DEFAULT_ALIGN_TO_PLANE_ANIMATION_DURATION_MS:ee,DEFAULT_CROSS_SECTION_HIGHLIGHT_COLOR:T,DEFAULT_CROSS_SECTION_LINE_THICKNESS_VALUE:1,DEFAULT_SLIDER_RANGE:E,crossSectioningActiveAxis:_,crossSectioningAdditionalToolsOpen:W,crossSectioningAlignment:N,crossSectioningAlignmentToolsOpen:G,crossSectioningAvailableAxes:D,crossSectioningAxisToolsOpen:K,crossSectioningBorderWidth:M,crossSectioningEnabled:I,crossSectioningHighlightColor:R,crossSectioningInteractionHandler:q,crossSectioningIsInteractive:B,crossSectioningOffsetScalar:H,crossSectioningPlaneDisplayOffset:U,crossSectioningPlanes:O,crossSectioningSliderRange:F,crossSectioningTargetBoundingBox:L,useCrossSectioning:useCrossSectioning,useCrossSectioningActions:useCrossSectioningActions});function useDebouncedCallback(e,t){const[n,i]=a.useState();return a.useEffect((()=>()=>{null!=n&&clearTimeout(n)}),[e,t,n]),a.useCallback((a=>{const handler=()=>{e(a)};null!=n&&clearTimeout(n),i(setTimeout(handler,t))}),[e,t,n])}const VertexColorPicker=t=>{var{onInput:n}=t,i=__rest(t,["onInput"]);const s=useDebouncedCallback((e=>{null==n||n(e)}),500),l=a.useCallback((e=>{const t=e.target;s(t.value)}),[s]);return e.jsx(o.VertexColorPicker,Object.assign({onInput:l},i))},VertexCrossSectionAppearanceColorPicker=({onUpdate:t})=>{const i=useCrossSectioningActions(),[a,s]=n.useRecoilState(R);return e.jsx(VertexColorPicker,{"data-testid":"cross-section-highlight-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:async e=>{s(e),await i.reapply()}})},VertexSlider=t=>{var{value:n,defaultValue:i,leftLabel:s,rightLabel:r,onChange:c,onValueChange:u,onValueInput:d}=t,m=__rest(t,["value","defaultValue","leftLabel","rightLabel","onChange","onValueChange","onValueInput"]);const[p,g]=a.useState(i);return e.jsxs("div",{className:"flex w-full items-center gap-2",children:[s&&e.jsx("div",{className:"pl-0.5 text-xs text-center",children:s}),e.jsx(o.VertexSlider,Object.assign({className:l("w-full",{"mt-0.5":null!=s||null!=r}),value:null!=n?n:p,onValueChange:e=>{g(e.detail.value),null==c||c(e.detail.value),null==u||u(e)},onValueInput:e=>{g(e.detail.value),null==c||c(e.detail.value),null==d||d(e)}},m)),r&&e.jsx("div",{className:"text-xs pr-2 flex-shrink-0 text-right",children:r})]})},VertexCrossSectionAppearanceLineThicknessSlider=({onUpdate:t})=>{const i=useCrossSectioningActions(),[a,s]=n.useRecoilState(M);return e.jsx(VertexSlider,{id:"cross-section-line-thickness","data-testid":"cross-section-line-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:a,valueLabelDisplay:"auto",onValueInput:async e=>{s(e.detail.value),await i.reapply()},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexCrossSectionAppearanceControls({onUpdateCrossSectionColor:t,onUpdateCrossSectionLineThickness:n}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexCrossSectionAppearanceColorPicker,{onUpdate:t}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e.jsx(VertexCrossSectionAppearanceLineThicknessSlider,{onUpdate:n})]})}function PanelSection({header:t,children:n}){return e.jsxs("div",{className:"py-3 px-4 border-neutral-300 border-b",children:[e.jsx("div",{className:"my-2 text-base text-neutral-700",children:t}),n]})}const VertexCrossSectionAppearanceReset=({onReset:t})=>{const i=useCrossSectioningActions(),[a,s]=n.useRecoilState(R),[l,r]=n.useRecoilState(M),c=a!==T||1!==l;return e.jsx("div",{className:"ml-auto",children:e.jsx(o.VertexTooltip,{content:"Reset Cross Sectioning Appearance",children:e.jsx(o.VertexIconButton,{"data-testid":"cross-section-appearance-reset",iconName:"reset",iconSize:"sm",onClick:async()=>{s(T),r(1),null==t||t(),await i.reapply()},disabled:!c})})})};function VertexCrossSectionAppearancePanelSection({onResetCrossSectionAppearance:t,onUpdateCrossSectionColor:n,onUpdateCrossSectionLineThickness:i}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Cross Sectioning",e.jsx(VertexCrossSectionAppearanceReset,{onReset:t})]}),children:e.jsx(VertexCrossSectionAppearanceControls,{onUpdateCrossSectionColor:n,onUpdateCrossSectionLineThickness:i})})}const ne=.5,ie="#444444",ae=n.atom({key:"featureEdgesSelectedColor",default:ie}),se=n.atom({key:"featureEdgesLineThickness",default:ne}),VertexFeatureEdgesColorPicker=({onUpdate:t})=>{const[i,a]=n.useRecoilState(ae);return e.jsx(VertexColorPicker,{"data-testid":"feature-edges-color-picker",value:i,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})},VertexFeatureEdgesThicknessSlider=({onUpdate:t})=>{const[i,a]=n.useRecoilState(se);return e.jsx(VertexSlider,{id:"feature-edges-thickness","data-testid":"feature-edges-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:i,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexFeatureEdgesControls({onUpdateFeatureEdgesColor:t,onUpdateFeatureEdgesThickness:n}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexFeatureEdgesColorPicker,{onUpdate:t}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e.jsx(VertexFeatureEdgesThicknessSlider,{onUpdate:n})]})}const VertexFeatureEdgesReset=({onReset:t})=>{const[i,a]=n.useRecoilState(ae),[s,l]=n.useRecoilState(se),r=s!==ne||i!==ie;return e.jsx("div",{className:"ml-auto",children:e.jsx(o.VertexTooltip,{content:"Reset Feature Edges",children:e.jsx(o.VertexIconButton,{"data-testid":"feature-edges-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(ie),l(ne),null==t||t()},disabled:!r})})})};function VertexFeatureEdgesPanelSection({onResetFeatureEdges:t,onUpdateFeatureEdgesColor:n,onUpdateFeatureEdgesThickness:i}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Feature Edges",e.jsx(VertexFeatureEdgesReset,{onReset:t})]}),children:e.jsx(VertexFeatureEdgesControls,{onUpdateFeatureEdgesColor:n,onUpdateFeatureEdgesThickness:i})})}function contextMenuItemIsRow(e){var t;return null!=e&&null!=(null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.id)}const oe=n.atom({key:"contextMenuActive",default:void 0}),le=n.atom({key:"contextMenuPosition",default:void 0}),re=n.atom({key:"contextMenuTarget",default:void 0}),ce=n.atom({key:"contextMenuItem",default:void 0}),ue=n.atom({key:"contextMenuActions",default:[]}),de=n.selector({key:"contextMenuActivePosition",get:({get:e})=>null!=e(oe)?e(le):void 0});function useContextMenuActions(){return{pointerDown:useActionCallback((({set:e})=>async t=>{if(2===t.button){const n=t.clientX,i=null==t?void 0:t.clientY;e(le,s.Point.create(n,i)),e(re,t.target)}})),pointerUp:useActionCallback((({snapshot:e,set:t})=>async(n,i,a,o)=>{const l=await e.getPromise(le),r=await e.getPromise(oe);if(null!=l&&null==r){const e=n.clientX,r=null==n?void 0:n.clientY,c=s.Point.create(e,r),u=null!=l?s.Point.distance(l,c):0,d=null==a||a(n);u<2&&d&&(null==o||o(n,null!=l?l:c),t(oe,i))}})),contextMenu:useActionCallback((()=>(e,t)=>{(null==t||t(e))&&e.preventDefault()})),longPress:useActionCallback((({set:e})=>(t,n,i,a)=>{if(null==i||i(t)){const i=s.Point.create(t.touches[0].clientX,t.touches[0].clientY);e(le,i),e(re,t.target),e(oe,n),null==a||a(t,i)}})),clearActiveContextMenu:useActionCallback((({reset:e,set:t})=>n=>{t(Q,!!n),e(oe),e(ue),e(le)})),clearDismissedState:useActionCallback((({reset:e})=>()=>e(Q)))}}function targetWithinMenu(e){return e.target instanceof Element&&isChildOf("vertex-menu",e.target)}function targetShouldSkipNextHit(e){return e.target instanceof Element&&isChildOf("vertex-viewer",e.target)}function isChildOf(e,t){return null!=t.closest(e)}const me=n.atom({key:"boxSelectionEnabled",default:!1}),pe=n.atom({key:"boxSelectionOperationType",default:"clearAndSelect"}),useBoxSelectionActions=()=>({enable:useActionCallback((({set:e})=>()=>{e(me,!0)})),disable:useActionCallback((({reset:e})=>async()=>{e(me),e(pe)})),setOperationType:useActionCallback((({set:e})=>t=>{e(pe,t)}))});async function whenComponentReady(e,t){return null!=e&&null!=e.nodeName&&await customElements.whenDefined(e.nodeName.toLowerCase()),"function"==typeof(null==e?void 0:e.componentOnReady)?(await(null==e?void 0:e.componentOnReady()),t()):void 0}const xe=n.atom({key:"isEditingPointToPointMeasurement",default:!1}),ge=n.atom({key:"pointToPointMeasurementOutcome",default:void 0}),he=n.atom({key:"editedPointToPointMeasurement",default:void 0});function usePointToPointMeasurement(e){const t=n.useSetRecoilState(ge);a.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onOutcomeChanged(t)})),()=>null==n?void 0:n.dispose()}),[e,t])}const fe=2,ve=n.atom({key:"isEditingPreciseMeasurement",default:!1}),ye=n.atom({key:"preciseMeasurementOutcome",default:void 0}),be=n.atom({key:"preciseMeasurementController",dangerouslyAllowMutability:!0,default:void 0}),Ve=n.atom({key:"preciseMeasurementOverlays",dangerouslyAllowMutability:!0,default:void 0}),we=n.atom({key:"preciseMeasurementEntities",dangerouslyAllowMutability:!0,default:[]}),Se=n.selector({key:"preciseMeasurementMessage",get:({get:e})=>{const t=undefined;return 0===e(we).length?"Select a surface":void 0}});function usePreciseMeasurementModel(e,t,i){const s=n.useSetRecoilState(we),o=n.useSetRecoilState(ye),l=n.useSetRecoilState(be),r=n.useSetRecoilState(Ve),c=n.useRecoilValue(be);a.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{s(e),null==t||t(e)}))})),()=>null==n?void 0:n.dispose()}),[e,s]),a.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onOutcomeChanged((e=>{o(e),null==i||i(e)}))})),()=>null==t?void 0:t.dispose()}),[e,o]),a.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{if(e.length>2){const t=e[2];null==c||c.setEntities(new Set([t]))}}))})),()=>null==t?void 0:t.dispose()}),[e,c]),a.useEffect((()=>{whenComponentReady(e,(()=>{l(null==e?void 0:e.measurementController)}))}),[e,l]),a.useEffect((()=>{whenComponentReady(e,(()=>{r(null==e?void 0:e.measurementOverlays)}))}),[e,r])}function useMeasurementActions(){const e=useBoxSelectionActions(),t=useEnablePointToPointMeasurement(),n=useDisablePointToPointMeasurement(),i=useDisablePreciseMeasurement(),a=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(be);null==t||t.clearEntities()})),s=useActionCallback((()=>async(e={})=>{await a(),n(e),i()})),o=useActionCallback((({set:e,reset:n})=>async i=>{await s(),"point-to-point"===i?t():(n(ye),n(we),e(ve,!0))}));return{disableEditMeasurement:useActionCallback((()=>async e=>{await s(e)})),enableEditMeasurement:useActionCallback((()=>async e=>{await o(e)})),resetMeasurement:useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(ve),i=await e.getPromise(xe);n?await a():i&&(t(ge),t(he))})),clearEditedPointToPointMeasurement:useActionCallback((({reset:e})=>()=>{e(he)})),setEditedPointToPointMeasurement:useActionCallback((({set:e})=>t=>{e(he,t)})),toggleEditPointToPointMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(xe)?await s():await o("point-to-point"),e.disable()})),toggleEditPreciseMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(ve)?await s():await o("precise"),e.disable()}))}}function useEnablePointToPointMeasurement(){return useActionCallback((({reset:e,set:t})=>(n={})=>{t(xe,!0),n.keepExistingMeasurement||e(ge)}))}function useDisablePointToPointMeasurement(){return useActionCallback((({reset:e})=>(t={})=>{e(xe),t.keepExistingMeasurement||(e(he),e(ge))}))}function useDisablePreciseMeasurement(){return useActionCallback((({reset:e})=>async()=>{e(ve),e(ye),e(we)}))}const Ce=n.selector({key:"isEditingMeasurement",get:({get:e})=>e(xe)||e(ve)}),je=n.selector({key:"measurementPanelModel",get:({get:e})=>e(ge)||e(ye)}),Ae=n.selector({key:"measurementPanelOverlays",dangerouslyAllowMutability:!0,get:({get:e})=>e(Ve)}),ke=n.selector({key:"measurementPanelMessage",get:({get:e})=>{const t=undefined;return e(ve)?e(Se):void 0}}),Te=n.selector({key:"measurementPanelIsResettable",get:({get:e})=>e(Ce)&&null!=e(je)}),Pe=3e3,Ee=n.atom({key:"applicationMessageToast",default:void 0}),Ie=n.atom({key:"applicationMessageBanner",default:void 0}),useApplicationMessageActions=()=>({setBannerMessage:useActionCallback((({set:e})=>t=>{e(Ie,null!=t?Object.assign(Object.assign({},t),{id:i.UUID.create()}):void 0)})),setToastMessage:useActionCallback((({set:e})=>t=>{e(Ee,null!=t?Object.assign(Object.assign({},t),{id:i.UUID.create()}):void 0)}))});var Re;!function(e){e.HIDE_ITEM="Hide Item",e.SHOW_ONLY_SELECTED="Show Only Selected",e.HIDE_SELECTED="Hide Selected",e.SHOW_ONLY_ITEM="Show Only Item",e.SHOW_ALL="Show All",e.HIDE_ALL="Hide All",e.SELECT_FILTERED_ITEMS="Select Filtered Items",e.INVERT_SELECTION="Invert Selection",e.CLEAR_ALL_TRANSFORMS="Clear All Transforms",e.CLEAR_SELECTED_TRANSFORMS="Clear Selected Transforms",e.CLEAR_SELECTION="Clear Selection",e.DESELECTING_ITEMS="Deselecting Items",e.SELECTING_ITEMS="Selecting Items",e.SELECTING_ONLY_ITEM="Selecting Only Item",e.SELECTING_ANCESTOR="Selecting Ancestor",e.APPLY_MATERIAL_OVERRIDE_TO_ALL="Apply Material Override To All",e.APPLY_MATERIAL_OVERRIDE_TO_SELECTION="Apply Material Override To Selection",e.CLEAR_ALL_MATERIAL_OVERRIDES="Clear All Material Overrides",e.CLEAR_SELECTED_MATERIAL_OVERRIDES="Clear Selected Material Overrides",e.SET_PHANTOM_ALL="Set Phantom All",e.SET_PHANTOM_SELECTED_ITEMS="Set Phantom Selected Items",e.CLEAR_PHANTOM_ALL="Clear Phantom All",e.CLEAR_PHANTOM_SELECTED_ITEMS="Clear Phantom Selected Items",e.SET_PHANTOM_NON_SELECTED_ITEMS="Set Phantom Non Selected Items",e.RESTORE_PHANTOM_OVERRIDES="Restore Phantom Overrides",e.SET_ITEM_AS_END_ITEM="Set Item as End Item",e.UNSET_ITEM_AS_END_ITEM="Unset Item as End Item",e.SHOW_ANNOTATION="Show Annotation",e.HIDE_ANNOTATION="Hide Annotation"}(Re||(Re={}));const Me=n.atomFamily({key:"selectionSelectedItems",default:void 0}),Oe=n.atom({key:"selectionSelectedItemIds",default:[]}),Ne=n.atom({key:"selectionLastSelected",default:void 0}),Le=n.atom({key:"selectionLastSelectionFromViewer",default:!1}),Be=n.atom({key:"selectionLastSelectWasMultiSelect",default:!1}),_e=n.selector({key:"selectionHighestSelectedAncestor",get:({get:e})=>{var t,n;const i=e(Ne),a=e(Oe);return null!==(n=null===(t=null==i?void 0:i.ancestors)||void 0===t?void 0:t.find((e=>a.includes(e))))&&void 0!==n?n:null==i?void 0:i.id}}),De=n.atom({key:"selectionPreviousVisibleSummary",default:void 0}),He=n.atom({key:"selectionVisibleSummary",default:void 0}),Fe=n.selector({key:"selectionVisibleCount",get:({get:e})=>{var t,n;return null!==(n=null===(t=e(He))||void 0===t?void 0:t.count)&&void 0!==n?n:0}}),ze=n.selector({key:"selectionBoundingBoxCenter",get:({get:e})=>{const t=e(He);return null!=(null==t?void 0:t.boundingBox)?s.BoundingBox.center(t.boundingBox):s.Vector3.origin()}}),Ue=n.selector({key:"selectionIsActive",get:({get:e})=>{const t=e(Oe),n=undefined;return e(Fe)>0||t.length>0}}),We=n.atom({key:"transformWidgetEnabled",default:!1}),Ge=n.atom({key:"transformWidgetPosition",default:void 0}),Ke=n.atom({key:"transformWidgetOrientationOverride",default:void 0}),qe=n.selector({key:"transformWidgetOrientation",get:({get:e})=>{const t=e(Ke);if(null!=t)return t}}),$e=n.atom({key:"transformWidgetCachedOrientation",default:void 0}),Ye=n.atom({key:"transformWidgetSyncToSelection",default:!1}),Xe=n.atom({key:"transformWidgetIsInteracting",default:!1}),Ze=n.atomFamily({key:"appliedItemTransform",default:void 0}),Je=n.atom({key:"appliedItemTransformIds",default:[]}),Qe=n.atom({key:"selectedCoordinateSpace",default:"world"}),useTransformActions=()=>{const e=useApplicationMessageActions(),t=useViewerSceneActions(),n=useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(ze);e(Ge,n)})),i=useActionCallback((({set:e,snapshot:t})=>async()=>{const i=await t.getPromise(Ge),a=await t.getPromise(Be),s=await t.getPromise(Oe),o=await t.getPromise(Fe);null==i&&(s.length>0||a||o>0)&&await n(),e(Ye,!0)})),a=useActionCallback((({set:e})=>async t=>{e(Ge,null!=t?t:void 0)})),o=useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async()=>{const i=await e.getPromise(qe),a=undefined;(await e.getPromise(Je)).forEach((e=>{n(Ze(e))})),null!=i&&t($e,i)}))),l=useActionCallback((({set:e,reset:t})=>n=>{t($e),e(Ke,n)}));return{enableTransformWidget:useActionCallback((({set:t})=>async(s,o)=>{e.setToastMessage({message:"Transform manipulator enabled! Select parts to interact.",duration:Pe}),t(We,!0),o?await n():null==s?await i():await a(s)})),disableTransformWidget:useActionCallback((({reset:e})=>()=>{e(We),e(Ke)})),setTransformWidgetOrientation:l,clearTransformWidgetOrientation:useActionCallback((({reset:e})=>()=>{e($e),e(Ke)})),setTransformWidgetPosition:a,clearTransformWidgetPosition:useActionCallback((({reset:e})=>()=>e(Ge))),invalidateTransforms:o,setIsInteractivelyTransforming:useActionCallback((({set:e})=>t=>{e(Xe,t)})),setDefaultWidgetPosition:i,setDefaultWidgetPositionToSelection:n,enableSelectionSync:useActionCallback((({set:e})=>()=>e(Ye,!0))),disableSelectionSync:useActionCallback((({reset:e})=>()=>e(Ye))),syncToSelection:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(De),n=await e.getPromise(He),i=undefined;if(await e.getPromise(Ye)){const e=null==n?void 0:n.boundingBox,i=null!=e&&null!=(null==t?void 0:t.boundingBox)&&equals(e,t.boundingBox);null==e||i||await a(s.BoundingBox.center(e))}})),orientToHitResult:useActionCallback((({reset:e})=>async t=>{e(Ye),null!=t?(await a(null==t?void 0:t.position),l(s.Vector3.eulerTo(s.Vector3.up(),t.normal))):(e(Ge),l(void 0))})),clearSelectedTransforms:useActionCallback((({set:e})=>async()=>{await t.execute(Re.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.withSelected())).clearTransforms())),e(Ge,void 0),e(We,!1)})),clearAllTransforms:useActionCallback((({set:e})=>async()=>{await t.execute(Re.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.all())).clearTransforms())),e(Ge,void 0),e(We,!1)}))}},useHitActions=()=>{const e=useCrossSectioningActions(),t=useMeasurementActions(),n=useTransformActions(),i=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const n=await e.tryGetPromise(J).then((e=>e.value)),i=await e.getPromise(he);null==n&&null!=(null==i?void 0:i.start)&&null!=i.end&&await t.resetMeasurement()}))),a=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(J).then((e=>e.value));await n.orientToHitResult(t)}))),s=useActionCallback(retainSnapshot((({set:e,snapshot:t})=>async()=>{const n=await t.tryGetPromise(J).then((e=>e.value));e(ce,n)}))),o=useActionCallback(retainSnapshot((({snapshot:e,set:t})=>async()=>{t(Z,await e.tryGetPromise(J).then((e=>e.value)))})));return{tap:useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async({detail:l},...r)=>{const c=await t.getPromise(Ce),u=await t.getPromise(N),d=2!==(null==l?void 0:l.buttons)&&!(null==l?void 0:l.altKey);l.altKey||l.ctrlKey||l.metaKey||l.shiftKey;const m=d&&!u.hitPending&&!c,p=await t.tryGetPromise(J).then((e=>e.value));n(X,p),n($,l),await i(),m&&(r.forEach((e=>e())),await a()),await s(),await e.sectionCurrentHit(),await o()}))),longPress:useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async i=>{n($),t(Y,i.detail),await e.tryGetPromise(J),await s(),await o()})))}},et=n.selector({key:"viewerToolkitHitState",get:({get:e})=>{const t=undefined,n=undefined,i=undefined,a=undefined,s=undefined;return{tapDetails:e($),longPressDetails:e(Y),previousHitResult:e(X),currentHitResult:e(Z)}}});var tt=Object.freeze({__proto__:null,currentHitResult:Z,hitResult:J,hitResultsLongPressDetails:Y,hitResultsSkipNextTap:Q,hitResultsTapDetails:$,hitState:et,previousHitResult:X,useHitActions:useHitActions});function useSelectionActions(){const e=useTransformActions(),t=useViewerSceneActions(),n=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(Oe)).forEach((e=>t(Me(e))))})),i=useActionCallback((({snapshot:e,reset:n,set:i})=>async(a,s)=>{var o,l;const r=await e.getPromise(Me(a.id)),c=await e.getPromise(Oe),d=null===(l=[...null!==(o=a.ancestors)&&void 0!==o?o:[]])||void 0===l?void 0:l.reverse().find((e=>!c.includes(e)));null!=r&&null!=d?(i(Me(d),{id:d}),i(Oe,(e=>[...e,d])),t.execute(Re.SELECTING_ANCESTOR,t.selectItemsTransform(d))):(null==s?void 0:s.clear)?(i(Me(a.id),a),i(Oe,[a.id]),t.execute(Re.SELECTING_ONLY_ITEM,t.clearSelectionTransform,t.selectItemsTransform(a.id))):(i(Me(a.id),a),i(Oe,(e=>[...e,a.id])),t.execute(Re.SELECTING_ITEMS,t.selectItemsTransform(a.id))),u(a),i(Ne,a),i(Le,!0),n(Be)})),a=useActionCallback((({reset:e,set:n})=>async i=>{e(Me(i)),e(Be),n(Oe,(e=>e.filter((e=>e!==i)))),t.execute(Re.DESELECTING_ITEMS,t.deselectItemsTransform(i))})),s=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(Me(t.id));null!=n?await a(n.id):await i(t)})),o=useActionCallback((({snapshot:t,reset:n,set:a})=>async(s,o={})=>{const l=await t.getPromise(Me(s.id)),r=await t.getPromise(Oe);if(r.filter((e=>{var t;return e!==s.id&&!(null===(t=s.ancestors)||void 0===t?void 0:t.includes(e))})).forEach((e=>n(Me(e)))),n(Be),l)if(o.ignoreAncestorSelection)n(Oe),n(Me(l.id));else{const e=r.filter((e=>{var t;return e===s.id||(null===(t=s.ancestors)||void 0===t?void 0:t.includes(e))}));a(Oe,e)}else n(Oe);e.clearTransformWidgetOrientation(),await i(s,{clear:!0})})),l=useActionCallback((({reset:t})=>async()=>{await n(),t(Oe),t(Ne),t(Le),t(Be),e.clearTransformWidgetPosition(),e.clearTransformWidgetOrientation()})),r=useActionCallback((()=>async()=>{await l(),t.execute(Re.CLEAR_SELECTION,t.clearSelectionTransform)})),c=useActionCallback((({set:e})=>async t=>{e(Be,t)})),u=useActionCallback((({reset:e,set:t})=>e=>{}));return{select:i,toggleSelection:s,clearAndSelect:o,selectCurrentHit:useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(J).then((e=>e.value)),n=await e.getPromise($),i=(null==n?void 0:n.metaKey)||(null==n?void 0:n.ctrlKey)||(null==n?void 0:n.shiftKey);null==t||i?null!=t&&i?await s(t):await r():await o(t)}))),syncSelection:useActionCallback((({set:e,reset:t})=>async(i,a)=>{a.selected?(await n(),e(Me(i.id),i),a.multiSelect?e(Oe,(e=>[...e.filter((e=>e!==i.id)),i.id])):e(Oe,[i.id]),u(i),e(Ne,i),e(Le,!1),e(Be,!!a.multiSelect)):(t(Me(i.id)),t(Be),e(Oe,(e=>e.filter((e=>e!==i.id)))))})),deselect:a,clearSelection:r,resetSelectionState:l,toggleLastSelectWasMultiSelect:c,selectForModelViewsPanel:u}}const nt=n.selector({key:"viewerToolkitSelectionState",get:({get:e})=>{const t=undefined,n=undefined,i=undefined,a=undefined;return{selectedItemIds:e(Oe),lastSelected:e(Ne),highestSelectedAncestorId:e(_e)}}});var it=Object.freeze({__proto__:null,selectionBoundingBoxCenter:ze,selectionHighestSelectedAncestor:_e,selectionIsActive:Ue,selectionLastSelectWasMultiSelect:Be,selectionLastSelected:Ne,selectionLastSelectionFromViewer:Le,selectionPreviousVisibleSummary:De,selectionSelectedItemIds:Oe,selectionSelectedItems:Me,selectionState:nt,selectionVisibleCount:Fe,selectionVisibleSummary:He,useSelectionActions:useSelectionActions});const at=255,st=n.atom({key:"sceneItemAdjustmentsSelectedColor",default:void 0}),ot=n.atom({key:"sceneItemAdjustmentsSelectedOpacity",default:void 0}),lt=n.atomFamily({key:"appliedItemMaterialOverride",default:void 0}),rt=n.atom({key:"appliedItemMaterialOverrideIds",default:[]}),ct=n.selector({key:"sceneItemAdjustmentsLastSelectedOverride",get:({get:e})=>{const t=e(Ne);if(null!=t)return e(lt(t.id))}}),ut=n.atom({key:"applyMaterialToAllUserAction",default:void 0}),dt=n.atom({key:"showConfirmDialogWhenApplyingMaterialToAll",default:!0}),mt=n.atom({key:"confirmApplyMaterialToAllDialogOpen",default:!1}),useSceneItemMaterialActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(rt);t(st),n.forEach((e=>t(lt(e)))),t(rt)}));return{updateColor:useActionCallback((({set:e})=>t=>{e(st,t)})),clearCurrentColor:useActionCallback((({reset:e})=>()=>{e(st)})),clearCurrentOpacity:useActionCallback((({reset:e})=>()=>{e(ot)})),clear:useActionCallback((({snapshot:t,set:n,reset:i})=>async()=>{const a=await t.getPromise(Oe);i(st),a.forEach((e=>i(lt(e)))),n(rt,(e=>e.filter((e=>!a.includes(e))))),await e.execute(Re.CLEAR_SELECTED_MATERIAL_OVERRIDES,(e=>e.where((e=>e.withSelected())).clearMaterialOverrides().select()))})),clearAll:useActionCallback((()=>async()=>{await t(),await e.execute(Re.CLEAR_ALL_MATERIAL_OVERRIDES,(e=>e.where((e=>e.all())).clearMaterialOverrides()),(e=>e.where((e=>e.withSelected())).select()))})),clearState:t,updateOpacity:useActionCallback((({set:e})=>t=>{e(ot,t)})),apply:useActionCallback((({snapshot:t,set:n})=>async()=>{const i=await t.getPromise(st),a=await t.getPromise(ot),s=await t.getPromise(Oe),o=await t.getPromise(ct),l=null!=i?i:o,r=null!=a?a:null==o?void 0:o.opacity;if(null!=l){const t=Object.assign(Object.assign({},l),{opacity:null!=r?r:l.opacity});await e.execute(Re.APPLY_MATERIAL_OVERRIDE_TO_SELECTION,(e=>e.where((e=>e.withSelected())).materialOverride(t))),s.forEach((e=>n(lt(e),t))),n(rt,(e=>[...e,...s]))}})),confirmApplyAll:useActionCallback((({set:e})=>t=>{e(mt,!0),e(ut,(()=>t))})),cancelApplyAll:useActionCallback((({reset:e})=>()=>{e(mt),e(ut)})),applyAll:useActionCallback((({snapshot:t,reset:n})=>async()=>{const i=await t.getPromise(st),a=await t.getPromise(ot);if(null!=i){const s=await t.getPromise(rt),o=Object.assign(Object.assign({},i),{opacity:null!=a?a:i.opacity});await e.execute(Re.APPLY_MATERIAL_OVERRIDE_TO_ALL,(e=>e.where((e=>e.all())).materialOverride(o))),s.forEach((e=>n(lt(e))));const l=await t.getPromise(ut);null==l||l(o),n(mt),n(ut)}})),hideConfirmApplyAllDialog:useActionCallback((({set:e})=>()=>{e(dt,!1)}))}},pt="#FFFFFF",xt=n.atom({key:"viewerBackgroundSelectedColor",default:pt}),VertexSceneItemMaterialApplyAll=({onApplyAll:t})=>{const i=useSceneItemMaterialActions(),a=n.useRecoilValueLoadable(ct),s=n.useRecoilValue(st),l=n.useRecoilValue(dt),r=m.useMemo((()=>"hasValue"===a.state?null!=s?s:a.contents:s),[a,s]);return e.jsx(o.VertexTooltip,{content:"Apply to All",children:e.jsx(o.VertexIconButton,{iconName:"square-dot-outline",iconSize:"sm",color:"secondary",disabled:null==r,onClick:async()=>{l?i.confirmApplyAll(t):(await i.applyAll(),null==t||t(r))}})})};function SceneItemMaterialApplyAllConfirmationDialog(){const t=useSceneItemMaterialActions(),i=n.useRecoilValue(mt),[s,l]=a.useState(!1),onCloseDialog=()=>{t.cancelApplyAll(),l(!1)};return i?e.jsxs(o.VertexDialog,{open:!0,className:"text-sm",onClosed:onCloseDialog,onBackdropClick:onCloseDialog,children:[e.jsx("div",{slot:"heading",children:"Apply to All Parts"}),e.jsx("div",{className:"max-w-lg break-words pr-2",children:"This will apply the same material to all parts in the model. Any previous material changes will be lost."}),e.jsxs("div",{className:"flex mt-8 gap-2 items-center",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(o.VertexToggle,{"data-testid":"hide-confirmation-dialog-in-future-checkbox",variant:"check",className:"pt-0.5",checked:s,onValueChanged:e=>{l(e.detail)}}),"Don't show again this session"]}),e.jsxs("div",{className:"flex ml-auto gap-2",children:[e.jsx(o.VertexButton,{"data-testid":"cancel-apply-material-to-all",onClick:onCloseDialog,children:"Cancel"}),e.jsx(o.VertexButton,{color:"primary","data-testid":"confirm-apply-material-to-all",onClick:async()=>{await t.applyAll(),s&&t.hideConfirmApplyAllDialog()},children:"Apply"})]})]})]}):e.jsx(e.Fragment,{})}function createColorMaterialWithId(e,t=i.UUID.create()){return Object.assign({id:t},r.ColorMaterial.fromHex(e))}const VertexSceneItemMaterialColorPicker=({onApply:t})=>{const a=useSceneItemMaterialActions(),s=n.useRecoilValueLoadable(ct),o=n.useRecoilValue(st),l=m.useMemo((()=>"hasValue"===s.state?null!=o?o:s.contents:o),[s,o]);return e.jsx(VertexColorPicker,{"data-testid":"selected-item-color-picker",value:null!=l?i.Color.toHexString(l.diffuse):void 0,onValueChanged:()=>{a.apply(),null==t||t(l)},onInput:async e=>{a.updateColor(createColorMaterialWithId(e)),await a.apply()}})},VertexSceneItemMaterialOpacitySlider=({onApply:t})=>{const i=useSceneItemMaterialActions(),a=n.useRecoilValue(ot),s=n.useRecoilValueLoadable(ct),l=m.useMemo((()=>{var e,t;return"hasValue"===s.state?null!==(t=null!=a?a:null===(e=s.contents)||void 0===e?void 0:e.opacity)&&void 0!==t?t:at:null!=a?a:at}),[a,s]),r=useDebouncedCallback((()=>{i.apply()}),500),c=m.useCallback((e=>{i.updateOpacity(e.detail.value),r(e.detail.value)}),[r,i]),u=m.useMemo((()=>"hasValue"!==s.state||null==s.contents),[s]);return e.jsx(o.VertexTooltip,{className:"flex w-full",content:u?"Select a part and apply a color to enable opacity":`${Math.floor(l/at*100)}%`,placement:"top",children:e.jsx(VertexSlider,{"data-testid":"scene-item-adjustments-opacity-slider",leftLabel:"0%",rightLabel:"100%",disabled:u,value:null!=l?l:at,step:5,min:0,max:at,onValueChange:e=>{i.updateOpacity(e.detail.value),i.apply(),null==t||t(e.detail.value)},onValueInput:c})})};function VertexMaterialControls({onApplyMaterial:t,onApplyMaterialToAll:i,onApplyOpacity:s}){const o=useSceneItemMaterialActions(),l=n.useRecoilValue(Ne);return a.useEffect((()=>{o.clearCurrentColor(),o.clearCurrentOpacity()}),[null==l?void 0:l.id]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(VertexSceneItemMaterialColorPicker,{onApply:t}),e.jsx(VertexSceneItemMaterialApplyAll,{onApplyAll:i})]})]}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e.jsx(VertexSceneItemMaterialOpacitySlider,{onApply:s}),e.jsx(SceneItemMaterialApplyAllConfirmationDialog,{})]})}const ResetButton=({id:t,tooltip:n,children:i})=>{const[s,r]=a.useState(!1);return e.jsx("div",{className:"ml-auto",children:e.jsxs(o.VertexDropdownMenu,{className:"flex items-stretch h-full","data-testid":`reset-button-dropdown-menu-${t}`,placement:"bottom-end",onMenuOpened:()=>r(!0),onMenuClosed:()=>r(!1),children:[e.jsx("div",{slot:"anchor",className:"flex items-center h-full",children:e.jsx(o.VertexTooltip,{content:n,disabled:s,placement:"bottom",children:e.jsxs(o.VertexButton,{className:l("p-1.5 rounded-md select-none hover:bg-neutral-300 active:bg-neutral-400 cursor-pointer",{"bg-neutral-300":s}),"data-testid":`reset-button-${t}`,variant:"plaintext",children:[e.jsx(o.VertexIcon,{className:"px-0.5",name:"reset",size:"sm"}),e.jsx(o.VertexIcon,{name:"chevron-down",size:"sm"})]})})}),e.jsx("div",{className:"whitespace-nowrap",children:i})]})})},VertexSceneItemMaterialClear=({onClear:t,onClearAll:i})=>{const a=useSceneItemMaterialActions(),s=n.useRecoilValue(Ue);return e.jsx("div",{className:"ml-auto",children:e.jsxs(ResetButton,{id:"materials",tooltip:"Clear Materials",children:[e.jsx("div",{className:"pt-1"}),e.jsx(o.VertexMenuItem,{"data-testid":"clear-selected-materials",onClick:()=>{a.clear(),null==t||t()},disabled:!s,children:"Clear selected materials"}),e.jsx(o.VertexMenuItem,{"data-testid":"clear-all-materials",onClick:()=>{a.clearAll(),null==i||i()},children:"Clear all materials"})]})})};function VertexMaterialPanelSection({onClearMaterial:t,onClearAllMaterials:n,onApplyMaterial:i,onApplyMaterialToAll:a,onApplyOpacity:s}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Material",e.jsx(VertexSceneItemMaterialClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexMaterialControls,{onApplyMaterial:i,onApplyMaterialToAll:a,onApplyOpacity:s})})}const gt="#ffff00",ht=35,ft=1,vt=n.atom({key:"selectionHighlightingSelectedColor",default:gt}),yt=n.atom({key:"selectionHighlightingSelectedOpacity",default:ht}),bt=n.atom({key:"selectionHighlightingSelectedLineThickness",default:1}),VertexSelectionHighlightingColorPicker=({onUpdate:t})=>{const[i,a]=n.useRecoilState(vt);return e.jsx(VertexColorPicker,{"data-testid":"selection-highlighting-color-picker",value:i,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})},VertexSelectionHighlightingLineThicknessSlider=({onUpdate:t})=>{const[i,a]=n.useRecoilState(bt);return e.jsx(VertexSlider,{id:"selection-highlighting-line-thickness","data-testid":"selection-highlighting-line-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:i,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},VertexSelectionHighlightingOpacitySlider=({onUpdate:t})=>{const[i,a]=n.useRecoilState(yt);return e.jsx(VertexSlider,{id:"selection-highlighting-opacity","data-testid":"selection-highlighting-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:i,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexSelectionHighlightingControls({onUpdateSelectionHighlightColor:t,onUpdateSelectionHighlightOpacity:n,onUpdateSelectionHighlightLineThickness:i}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexSelectionHighlightingColorPicker,{onUpdate:t}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e.jsx(VertexSelectionHighlightingOpacitySlider,{onUpdate:n}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e.jsx(VertexSelectionHighlightingLineThicknessSlider,{onUpdate:i})]})}const VertexSelectionHighlightingReset=({onReset:t})=>{const[i,a]=n.useRecoilState(vt),[s,l]=n.useRecoilState(yt),[r,c]=n.useRecoilState(bt),u=i!==gt||s!==ht||1!==r;return e.jsx("div",{className:"ml-auto",children:e.jsx(o.VertexTooltip,{content:"Reset Selection Highlighting",children:e.jsx(o.VertexIconButton,{"data-testid":"selection-highlighting-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(gt),l(ht),c(1),null==t||t()},disabled:!u})})})};function VertexSelectionHighlightingPanelSection({onResetSelectionHighlighting:t,onUpdateSelectionHighlightColor:n,onUpdateSelectionHighlightOpacity:i,onUpdateSelectionHighlightLineThickness:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Selection Highlighting",e.jsx(VertexSelectionHighlightingReset,{onReset:t})]}),children:e.jsx(VertexSelectionHighlightingControls,{onUpdateSelectionHighlightColor:n,onUpdateSelectionHighlightOpacity:i,onUpdateSelectionHighlightLineThickness:a})})}const VertexViewerBackgroundColorPicker=({onUpdate:t})=>{const[i,a]=n.useRecoilState(xt);return e.jsx(VertexColorPicker,{"data-testid":"viewer-background-color-picker",value:i,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})};function VertexViewerBackgroundControls({onUpdateViewerBackgroundColor:t}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexViewerBackgroundColorPicker,{onUpdate:t})]})}const VertexViewerBackgroundReset=({onReset:t})=>{const[i,a]=n.useRecoilState(xt),s=i!==pt;return e.jsx("div",{className:"ml-auto",children:e.jsx(o.VertexTooltip,{content:"Reset Background Color",children:e.jsx(o.VertexIconButton,{"data-testid":"viewer-background-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(pt),null==t||t()},disabled:!s})})})};function VertexViewerBackgroundPanelSection({onResetViewerBackgroundColor:t,onUpdateViewerBackgroundColor:n}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Viewer Background",e.jsx(VertexViewerBackgroundReset,{onReset:t})]}),children:e.jsx(VertexViewerBackgroundControls,{onUpdateViewerBackgroundColor:n})})}const isInputElement=e=>{const t=e instanceof HTMLElement&&"VERTEX-AUTO-RESIZE-TEXTAREA"===e.tagName,n=e instanceof HTMLElement&&"VERTEX-TEXTFIELD"===e.tagName,i=e instanceof HTMLElement&&"true"===e.contentEditable,a=e instanceof HTMLElement&&"VERTEX-SCENE-TREE-SEARCH"===e.tagName,s=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement,o=e instanceof HTMLElement&&"VERTEX-VIEWER-PIN-TOOL"===e.tagName,l=e instanceof HTMLElement&&"VERTEX-VIEWER-TRANSFORM-WIDGET"===e.tagName;return t||n||i||a||s||o||l},useRecoilReducer=({reducer:e,atom:t})=>{const i=undefined,a=undefined;return[n.useRecoilValue(t),useRecoilReducerDispatch({reducer:e,atom:t})]},useRecoilReducerDispatch=({reducer:e,atom:t})=>{const i=undefined;return n.useRecoilCallback((({set:n})=>async i=>{n(t,(t=>e(t,i)))}),[])},Vt=n.atom({key:"keyBindings",default:{applyBindings:[],bindings:{},pressed:{}}});function reducer(e,t){var n,i,a,s;switch(t.type){case"push-key-binding":const o=undefined;return null!=(null===(n=e.bindings[t.binding.keyBind])||void 0===n?void 0:n.find((e=>e.id===t.binding.id)))?e:Object.assign(Object.assign({},e),{bindings:Object.assign(Object.assign({},e.bindings),{[t.binding.keyBind]:[...null!==(i=e.bindings[t.binding.keyBind])&&void 0!==i?i:[],t.binding]})});case"remove-key-binding":const l=undefined;return null==(null===(a=e.bindings[t.binding.keyBind])||void 0===a?void 0:a.find((e=>e.id===t.binding.id)))?e:Object.assign(Object.assign({},e),{bindings:Object.assign(Object.assign({},e.bindings),{[t.binding.keyBind]:(null!==(s=e.bindings[t.binding.keyBind])&&void 0!==s?s:[]).filter((e=>e.id!==t.binding.id))})});case"add-apply-key-binding":return Object.assign(Object.assign({},e),{applyBindings:[...e.applyBindings,t.binding]});case"remove-apply-key-binding":return Object.assign(Object.assign({},e),{applyBindings:e.applyBindings.filter((e=>e.id!==t.id))});case"set-key-pressed":return Object.assign(Object.assign({},e),{applyBindings:e.applyBindings.map((t=>Object.assign(Object.assign({},t),{active:null!=t.keyBind&&allPressed(t.keyBind,e.pressed)}))),pressed:Object.assign(Object.assign({},e.pressed),{[t.key]:t.pressed}),lastPressed:t.pressed?t.key:void 0})}}const useKeyBindingState=()=>useRecoilReducer({reducer:reducer,atom:Vt});function pressedValue(e,t){return e.includes("!")?!t[e.replace("!","")]&&!t[e.replace("!","").toLowerCase()]:t[e]||t[e.toLowerCase()]}function isPressed(e,t){const n=e.split("||");return n.length>1?n.some((e=>pressedValue(e,t))):pressedValue(n[0],t)}function allPressed(e,t){const n=undefined;return e.split("+").every((e=>isPressed(e,t)))}function matchingSingleFnBindings(e,t,n){return e.filter((e=>!e.repeat)).filter((e=>{var i;return null!=e.keyBind&&null!=n&&(null===(i=e.keyBind)||void 0===i?void 0:i.includes(n))&&allPressed(e.keyBind,t)})).map((e=>e.fn))}function matchingOffBindings(e,t,n){return e.filter((e=>e.off&&e.active&&null!=e.keyBind&&null==n&&!allPressed(e.keyBind,t))).map((e=>e.off))}const useApplyKeyBinding=e=>{const[t,n]=useKeyBindingState();a.useEffect((()=>{const a=i.UUID.create();return n({type:"add-apply-key-binding",binding:Object.assign(Object.assign({},e),{id:a,active:null!=e.keyBind&&allPressed(e.keyBind,t.pressed)})}),()=>{n({type:"remove-apply-key-binding",id:a})}}),[e.fn,e.off,e.keyBind,e.repeat])},useStackKeyBinding=(e,t=[])=>{const[,n]=useKeyBindingState();a.useEffect((()=>{const t=null==e.addPredicate||e.addPredicate(),i=null!=e.cancelPredicate&&e.cancelPredicate();t&&n({type:"push-key-binding",binding:e}),i&&n({type:"remove-key-binding",binding:e})}),t)},useKeyBindings=({keydownRepeatInterval:e=25,keydownIgnorePredicate:t=isInputElement}={})=>{const[n,i]=useKeyBindingState(),s=a.useCallback((e=>{Object.keys(n.bindings).filter((t=>t.includes(e)&&allPressed(t,Object.assign(Object.assign({},n.pressed),{[e]:!0})))).forEach((e=>{const t=n.bindings[e],a=t.length>0?t[t.length-1]:void 0;null!=a&&(a.fn(),i({type:"remove-key-binding",binding:a}))}))}),[n]);a.useEffect((()=>{const handleKeyDown=e=>{if(!e.repeat&&!t(e.target)){i({type:"set-key-pressed",key:e.key,pressed:!0}),s(e.key);const t=Object.assign(Object.assign({},n.pressed),{[e.key]:!0}),a=matchingSingleFnBindings(n.applyBindings,t,e.key),o=matchingOffBindings(n.applyBindings,t,e.key);(a.length>0||o.length>0)&&e.preventDefault()}},handleKeyUp=e=>{i({type:"set-key-pressed",key:e.key,pressed:!1})};return window.addEventListener("keydown",handleKeyDown),window.addEventListener("keyup",handleKeyUp),()=>{window.removeEventListener("keydown",handleKeyDown),window.removeEventListener("keyup",handleKeyUp)}}),[s,n.applyBindings,n.pressed]),a.useEffect((()=>{const e=matchingSingleFnBindings(n.applyBindings,n.pressed,n.lastPressed),t=matchingOffBindings(n.applyBindings,n.pressed,n.lastPressed);e.forEach((e=>e())),t.forEach((e=>e()))}),[n.pressed,n.lastPressed]),a.useEffect((()=>{const t=n.applyBindings.filter((e=>e.repeat&&null!=e.keyBind&&allPressed(e.keyBind,n.pressed))).map((e=>e.fn));if(t.length>0){const n=setInterval((()=>{t.forEach((e=>e()))}),e);return()=>{clearInterval(n)}}return()=>{}}),[n.applyBindings,n.lastPressed])},VertexBoxSelectionButton=()=>{const t=useBoxSelectionActions(),i=n.useRecoilValue(me);return useStackKeyBinding({id:"ExitBoxSelection",keyBind:"Escape",fn:t.disable,addPredicate:()=>i,cancelPredicate:()=>!i},[i]),e.jsx(o.VertexTooltip,{content:"Box Selection",children:e.jsx(o.VertexIconButton,{iconName:"box-cursor",iconColor:i?"primary":"secondary","data-testid":"viewer-toolbar-enable-box-selection-button",onClick:i?t.disable:t.enable})})},wt=1,VertexResizableContent=t=>{var{className:n,style:i,displayShadow:a,heading:s,id:r,initialScale:c,placement:u="left",children:d,onResize:m}=t,p=__rest(t,["className","style","displayShadow","heading","id","initialScale","placement","children","onResize"]);const g="left"===u||"right"===u,h="top"===u;function getHorizontalResizeDirection(){switch(u){case"left":return"right";case"right":return"left";default:return"none"}}function getVerticalResizeDirection(){return"top"===u?"top":"none"}const f=null!=c?c:1;return e.jsx(o.VertexResizable,Object.assign({id:r,"data-testid":`resizable-content-position-${u}`,className:l(n,"pointer-events-auto z-popover md:z-overlay bg-white bg-opacity-95 flex-grow-0 flex-shrink-0 border-neutral-300",{"border-r min-w-75 max-w-half":"left"===u,"sidebar-shadow-right":"left"===u&&a,"border-l min-w-75 max-w-half":"right"===u,"sidebar-shadow-left":"right"===u&&a,"border-t bottom-0 fixed":"top"===u,"min-h-12 sheet":h}),style:Object.assign({maxHeight:"top"===u?window.innerHeight:void 0},i),initialHorizontalScale:g?c:void 0,initialVerticalScale:h?f:void 0,horizontalDirection:getHorizontalResizeDirection(),verticalDirection:getVerticalResizeDirection(),position:"right"===u||"top"===u?"absolute":"relative",onResizeEnd:()=>null==m?void 0:m()},p,{children:e.jsxs("div",{className:"flex flex-col h-full w-full",children:["top"===u&&e.jsx("div",{className:"flex justify-center w-full",children:e.jsx("div",{className:"block md:hidden w-20 h-0.5 mt-0.5 bg-neutral-600 rounded"})}),s,e.jsx("div",{className:l("w-full flex flex-col h-0 flex-grow",{"right-0":"right"===u}),children:d})]})}))};function useDefaultKeybindings(){useApplyKeyBinding({fn:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromiseRequired(V),n={milliseconds:500},i=await t();await(null==i?void 0:i.camera().viewAll().render({animation:n}))})),keyBind:"f"})}function useLongPress({target:e,callback:t,delay:n=500,onMovement:i}){const[a,o]=m.useState(),[l,r]=m.useState();m.useEffect((()=>{const handleTouchStart=e=>{const i=e;null!=i.touches&&1===i.touches.length&&(null!=a&&clearTimeout(a),r(s.Point.create(i.touches[0].clientX,i.touches[0].clientY)),o(setTimeout((()=>null==t?void 0:t(i)),n)))},handleTouchMove=e=>{const t=e;null!=t.touches&&t.touches.length>0&&null!=a&&null!=l&&s.Point.distance(l,s.Point.create(t.touches[0].clientX,t.touches[0].clientY))>=2&&(clearTimeout(a),null==i||i())},handleTouchEnd=()=>{null!=a&&clearTimeout(a)};return null==e||e.addEventListener("touchstart",handleTouchStart),null==e||e.addEventListener("touchmove",handleTouchMove),null==e||e.addEventListener("touchend",handleTouchEnd),()=>{null==e||e.removeEventListener("touchstart",handleTouchStart),null==e||e.removeEventListener("touchmove",handleTouchMove),null==e||e.removeEventListener("touchend",handleTouchEnd)}}),[e,a,l])}function asBooleanAttribute(e){return!!e||void 0}const VertexContextMenu=({targetElement:t,menuType:i,disableBackdrop:s,openPredicate:r,onOpen:c,onClose:u,children:d})=>{const m=useContextMenuActions(),p=n.useRecoilValue(oe),g=n.useRecoilValue(de),h=a.useMemo((()=>["bottom-end","top-start","top-end","right","left"]),[]),f=p===i;useStackKeyBinding({id:"ContextMenu",keyBind:"Escape",fn:m.clearActiveContextMenu,addPredicate:()=>null!=p&&p===i,cancelPredicate:()=>null==p},[p]);const v=a.useMemo((()=>null!=t?t:null!=r?window:void 0),[t,r]);return useLongPress({target:v,callback:e=>m.longPress(e,i,r,c),onMovement:()=>m.clearActiveContextMenu()}),a.useEffect((()=>{const handleWindowPointerDown=e=>{const t=undefined;if(!targetWithinMenu(e)&&2!==e.buttons&&p===i){const t=targetShouldSkipNextHit(e);m.clearActiveContextMenu(t)}};if(s)return window.addEventListener("pointerdown",handleWindowPointerDown),()=>{window.removeEventListener("pointerdown",handleWindowPointerDown)}}),[s,i,p]),a.useEffect((()=>{const handlePointerDown=e=>{m.pointerDown(e)},handlePointerUp=e=>{m.pointerUp(e,i,r,c)},handleContextMenu=e=>m.contextMenu(e,r);return null==v||v.addEventListener("pointerdown",handlePointerDown),null==v||v.addEventListener("pointerup",handlePointerUp),null==v||v.addEventListener("contextmenu",handleContextMenu),()=>{null==v||v.removeEventListener("pointerdown",handlePointerDown),null==v||v.removeEventListener("pointerup",handlePointerUp),null==v||v.removeEventListener("contextmenu",handleContextMenu)}}),[t,i,r]),e.jsx("div",{className:l({hidden:!f}),children:e.jsx(o.VertexMenu,{"data-testid":`${i}-context-menu`,open:asBooleanAttribute(f),position:g,fallbackPlacements:h,backdrop:!s,onMenuClosed:()=>{m.clearActiveContextMenu(),null==u||u()},children:e.jsx("div",{className:"pt-1",children:d})})})},VertexFitSelectedMenuItem=()=>{const t=n.useRecoilValue(Oe),i=n.useRecoilValue(He),a=useViewerCameraActions();return e.jsxs(o.VertexMenuItem,{"data-testid":"fit-selected-menu-option",onClick:()=>{null!=(null==i?void 0:i.boundingBox)&&a.flyToByBoundingBox(i.boundingBox)},disabled:asBooleanAttribute(0===t.length),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"fit-selected",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Fit Selected"})]})},VertexFlyToMenuItem=()=>{const t=useViewerCameraActions(),i=n.useRecoilValue(ce);return e.jsxs(o.VertexMenuItem,{"data-testid":"fly-to-part-menu-option",onClick:()=>{var e;const n=undefined,a=contextMenuItemIsRow(i)?null===(e=null==i?void 0:i.node.id)||void 0===e?void 0:e.hex:null==i?void 0:i.id;null!=a&&t.flyToById(a)},disabled:asBooleanAttribute(null==i),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"paper-airplane",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Fly To"})]})};function useSceneItemsOperations(){const e=n.useRecoilValue(g),t=undefined,i=undefined,s=undefined,o=undefined,l=undefined,r=undefined;return{sceneItemsOperation:a.useCallback((async(t,n)=>{const i=await(null==e?void 0:e.scene());null==n?await(null==i?void 0:i.items((e=>t(e.where((e=>e.all()))))).execute()):n.length>0&&await(null==i?void 0:i.items((e=>t(e.where((e=>e.withItemIds(n)))))).execute())}),[e]),showOnlySelected:a.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.all())).hide(),e.where((e=>e.withSelected())).show()])).execute()}),[e]),hideSelected:a.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.withSelected())).hide()])).execute()}),[e]),showOnlyItem:a.useCallback((async t=>{const n=await(null==e?void 0:e.scene());null==n||n.items((e=>[e.where((e=>e.all())).hide(),e.where((e=>e.withItemIds([t]))).show()])).execute()}),[e]),ghostSelected:a.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.withSelected())).setPhantom(!0)])).execute()}),[e]),unGhostSelected:a.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.withSelected())).setPhantom(!1)])).execute()}),[e])}}const VertexHideAllMenuItem=()=>{const t=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"hide-all-menu-option",onClick:()=>{t.sceneItemsOperation((e=>e.hide()))},children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Hide All Parts"})]})},VertexHidePartMenuItem=()=>{const t=n.useRecoilValue(ce),i=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"hide-menu-option",onClick:()=>{var e;const n=undefined,a=contextMenuItemIsRow(t)?null===(e=null==t?void 0:t.node.id)||void 0===e?void 0:e.hex:t.id;null!=a&&i.sceneItemsOperation((e=>e.hide()),[a])},disabled:asBooleanAttribute(null==t),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Hide Part"})]})},VertexHideSelectedMenuItem=()=>{const t=n.useRecoilValue(Oe),i=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"hide-selected-menu-option",onClick:()=>i.hideSelected(),disabled:asBooleanAttribute(0===t.length),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Hide Selected"})]})},VertexShowAllMenuItem=()=>{const t=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"show-all-menu-option",onClick:()=>{t.sceneItemsOperation((e=>e.show()))},children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Show All Parts"})]})},VertexShowOnlyMenuItem=()=>{const t=n.useRecoilValue(ce),i=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"show-only-menu-option",onClick:()=>{var e;const n=undefined,a=contextMenuItemIsRow(t)?null===(e=null==t?void 0:t.node.id)||void 0===e?void 0:e.hex:null==t?void 0:t.id;null!=a&&i.showOnlyItem(a)},disabled:asBooleanAttribute(null==t),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Show Only Part"})]})},VertexShowOnlySelectedMenuItem=()=>{const t=n.useRecoilValue(Oe),i=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"show-only-selected-menu-option",onClick:()=>i.showOnlySelected(),disabled:asBooleanAttribute(0===t.length),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Show Only Selected"})]})};n.atom({key:"sceneTreeLoaderVisible",default:!1});const St=n.atom({key:"sceneTreeElement",default:void 0}),Ct=n.atom({key:"sceneTreeWidth",default:void 0});function useSceneTreeActions(){const e=useSelectionActions(),t=useViewerCameraActions();return{toggleSelection:useActionCallback((({snapshot:t})=>async(n,i,a)=>{var s,o;if(!n.defaultPrevented&&0===n.button&&(n.altKey||((n.ctrlKey||n.metaKey)&&i.selected?a.deselectItem(i):i.selected?a.selectItem(i,{recurseParent:!0}):i.selected||a.selectItem(i,{append:n.ctrlKey||n.metaKey,range:n.shiftKey})),null!=i.id)){const a=await t.getPromise(Ne);e.syncSelection({id:null===(s=i.id)||void 0===s?void 0:s.hex,ancestors:null!==(o=null==a?void 0:a.ancestors)&&void 0!==o?o:[]},{selected:!n.metaKey&&!n.ctrlKey||!i.selected,multiSelect:n.shiftKey||n.metaKey||n.ctrlKey})}})),toggleExpansion:useActionCallback((()=>(e,t,n)=>{n.toggleExpandItem(t)})),toggleVisibility:useActionCallback((()=>(e,t,n)=>{n.toggleItemVisibility(t)})),flyToRow:useActionCallback((({snapshot:e})=>async n=>{var i;const a=await e.getPromise(St),s=await(null==a?void 0:a.getRowAtClientY(n));null!=(null===(i=null==s?void 0:s.node.id)||void 0===i?void 0:i.hex)&&await t.flyToById(s.node.id.hex)})),setContextMenuItem:useActionCallback((({set:e,snapshot:t})=>async n=>{const i=await t.getPromise(St),a=await(null==i?void 0:i.getRowAtClientY(n));e(ce,a)}))}}n.selector({key:"sceneTreeController",get:({get:e})=>{var t;return null===(t=e(St))||void 0===t?void 0:t.controller},dangerouslyAllowMutability:!0});const VertexGhostSelectedMenuItem=()=>{const t=n.useRecoilValue(Oe),i=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"ghost-selected-menu-option",onClick:()=>i.ghostSelected(),disabled:asBooleanAttribute(0===t.length),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-partial",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Ghost Selected"})]})},VertexUnghostSelectedMenuItem=()=>{const t=n.useRecoilValue(Oe),i=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"unghost-selected-menu-option",onClick:()=>i.unGhostSelected(),disabled:asBooleanAttribute(0===t.length),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Unghost Selected"})]})},DefaultSceneTreeContextMenu=()=>e.jsxs("div",{className:"w-56",children:[e.jsx(VertexHideSelectedMenuItem,{}),e.jsx(VertexHideAllMenuItem,{}),e.jsx(VertexShowOnlyMenuItem,{}),e.jsx(VertexShowOnlySelectedMenuItem,{}),e.jsx(VertexShowAllMenuItem,{}),e.jsx(VertexGhostSelectedMenuItem,{}),e.jsx(VertexUnghostSelectedMenuItem,{}),e.jsx(o.VertexMenuDivider,{}),e.jsx(VertexFitSelectedMenuItem,{}),e.jsx(VertexFlyToMenuItem,{})]}),VertexSceneTreeContextMenu=({children:t})=>{const i=useSceneTreeActions(),a=n.useRecoilValue(St),s=null!=t&&!1!==t;return e.jsx(VertexContextMenu,{menuType:"scene-tree",targetElement:a,onOpen:async(e,t)=>{const n=e;await i.setContextMenuItem(n.clientY)},disableBackdrop:!0,children:s?t:e.jsx(DefaultSceneTreeContextMenu,{})})},DefaultViewerContextMenu=()=>e.jsxs("div",{className:"w-56",children:[e.jsx(VertexHidePartMenuItem,{}),e.jsx(VertexHideSelectedMenuItem,{}),e.jsx(VertexHideAllMenuItem,{}),e.jsx(VertexShowOnlyMenuItem,{}),e.jsx(VertexShowOnlySelectedMenuItem,{}),e.jsx(VertexShowAllMenuItem,{}),e.jsx(VertexGhostSelectedMenuItem,{}),e.jsx(VertexUnghostSelectedMenuItem,{}),e.jsx(o.VertexMenuDivider,{}),e.jsx(VertexFitSelectedMenuItem,{}),e.jsx(VertexFlyToMenuItem,{})]}),VertexViewerContextMenu=({children:t})=>{const n=null!=t&&!1!==t,i=a.useCallback((e=>e.target instanceof HTMLElement&&"vertex-viewer"===e.target.id),[]);return e.jsx(VertexContextMenu,{menuType:"viewer",disableBackdrop:!0,openPredicate:i,children:n?t:e.jsx(DefaultViewerContextMenu,{})})},jt=35,At=n.atom({key:"sceneItemGhostingSelectedOpacity",default:jt}),kt=n.atomFamily({key:"appliedItemPhantomState",default:void 0}),Tt=n.atom({key:"appliedItemPhantomStateIds",default:[]}),Pt=n.selector({key:"sceneItemGhostingLastSelectedPhantom",get:({get:e})=>{var t;const n=e(Ne);return null!=n&&(null!==(t=e(kt(n.id)))&&void 0!==t&&t)}}),VertexSceneItemGhostingOpacitySlider=({onApply:t})=>{const[i,a]=n.useRecoilState(At);return e.jsx(VertexSlider,{id:"phantom-opacity","data-testid":"phantom-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:i,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},useSceneItemPhantomActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(Tt)).forEach((e=>t(kt(e)))),t(Tt)}));return{setPhantomState:useActionCallback((({snapshot:t,set:n})=>async i=>{const a=await t.getPromise(Oe);a.forEach((e=>n(kt(e),i))),n(Tt,(e=>[...e,...a])),await e.execute(Re.SET_PHANTOM_SELECTED_ITEMS,(e=>e.where((e=>e.withSelected())).setPhantom(i)))})),clearPhantomState:useActionCallback((({snapshot:t,set:n,reset:i})=>async()=>{const a=await t.getPromise(Oe);a.forEach((e=>i(kt(e)))),n(Tt,(e=>e.filter((e=>!a.includes(e))))),await e.execute(Re.CLEAR_PHANTOM_SELECTED_ITEMS,(e=>e.where((e=>e.withSelected())).clearPhantom()),(e=>e.where((e=>e.withSelected())).select()))})),clearAllPhantomState:useActionCallback((()=>async()=>{await t(),await e.execute(Re.CLEAR_PHANTOM_ALL,(e=>e.where((e=>e.all())).clearPhantom()),(e=>e.where((e=>e.withSelected())).select()))})),resetAllPhantomState:t}},VertexSceneItemGhostingToggle=({onApply:t})=>{const i=useSceneItemPhantomActions(),a=n.useRecoilValue(Ue),s=n.useRecoilValueLoadable(Pt);return e.jsx(o.VertexTooltip,{content:"Select a part to display as ghost",disabled:a,children:e.jsx(o.VertexToggle,{className:"flex items-center","data-testid":"phantom-state-toggle",variant:"switch",disabled:!a,checked:"hasValue"===s.state&&s.contents,onValueChanged:async e=>{await i.setPhantomState(e.detail),null==t||t(e.detail)}})})};function VertexGhostingControls({onApplyGhostingChange:t,onApplyOpacity:n}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center py-3",children:[e.jsx(VertexSceneItemGhostingToggle,{onApply:t}),e.jsx("span",{className:"pl-4 text-sm text-neutral-700",children:"Display as Ghost"})]}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Global Ghost Opacity"}),e.jsx(VertexSceneItemGhostingOpacitySlider,{onApply:n})]})}const VertexSceneItemGhostingClear=({onClear:t,onClearAll:i})=>{const a=useSceneItemPhantomActions(),s=n.useRecoilValue(Pt);return e.jsx("div",{className:"ml-auto",children:e.jsxs(ResetButton,{id:"phantom",tooltip:"Clear Ghosting",children:[e.jsx("div",{className:"pt-1"}),e.jsx(o.VertexMenuItem,{"data-testid":"reset-selected-phantom",onClick:async()=>{await a.clearPhantomState(),null==t||t()},disabled:!s,children:"Clear ghosting for selected"}),e.jsx(o.VertexMenuItem,{"data-testid":"reset-all-phantom",onClick:async()=>{await a.clearAllPhantomState(),null==i||i()},children:"Clear ghosting for all"})]})})};function VertexGhostingPanelSection({onClearGhostState:t,onClearAllGhostState:n,onApplyGhostingChange:i,onApplyOpacity:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Ghosting",e.jsx(VertexSceneItemGhostingClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexGhostingControls,{onApplyGhostingChange:i,onApplyOpacity:a})})}function VertexMeasurementContextMenu({onDelete:t}){const i=n.useRecoilValue(re);return e.jsx(VertexContextMenu,{menuType:"measurement",openPredicate:e=>e.target instanceof HTMLElement&&"VERTEX-VIEWER-MEASUREMENT-DISTANCE"===e.target.tagName,children:e.jsxs(o.VertexMenuItem,{"data-testid":"measurement-delete",onClick:()=>null!=i&&t(i.id),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"delete",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Delete"})]})})}const Et=n.atom({key:"lengthUnit",default:"cm"}),It=n.atom({key:"decimalPlace",default:"2"});var Rt,Mt;!function(e){e.mm="millimeters",e.cm="centimeters",e.m="meters",e.in="inches",e.ft="feet"}(Rt||(Rt={})),function(e){e[e.mm=1]="mm",e[e.cm=.1]="cm",e[e.m=.001]="m",e[e.in=.03937007874015748]="in",e[e.ft=.0032808398950131233]="ft"}(Mt||(Mt={}));const convertFrom=(e,t)=>{const n=undefined;return e/Mt[t]},convertTo=(e,t)=>{const n=undefined;return e*Mt[t]},formatWithUnit=(e,t,n)=>`${e.toFixed(n)} ${t}`,formatDistance=(e,t,n)=>formatWithUnit(convertTo(e,t),t,n),createDistanceFormatter=(e,t)=>n=>formatDistance(n,e,t);function toUnitType(e){switch(e){case"cm":return"centimeters";case"m":return"meters";case"in":return"inches";case"ft":return"feet";default:return"millimeters"}}function useDockedPlacement(e,t){const[n,i]=m.useState(s.Point.create(0,0));return m.useLayoutEffect((()=>{if(null!=e){const n=e.getBoundingClientRect(),a=s.Point.create(n.left,n.bottom),o=s.Point.create(n.right,n.bottom);i("left"===t?a:o)}}),[e,t]),n}function VertexMeasurementDetails({placement:t}){const i=useMeasurementActions(),a=n.useRecoilValue(g),s=n.useRecoilValue(h),r=useDockedPlacement(null!=a?a:null,t),u=n.useRecoilValue(je),d=n.useRecoilValue(Ae),m=n.useRecoilValue(ke),p=n.useRecoilValue(Te),f=n.useRecoilValue(Et),v=n.useRecoilValue(It);return e.jsx(o.VertexDraggablePopover,{className:"z-popover",boundaryPadding:16,boundarySelector:`#${s}`,position:r,children:e.jsxs("div",{className:"flex flex-col leading-4 min-w-40",children:[e.jsxs("div",{className:"pb-2 flex justify-between",children:[e.jsx("div",{className:"w-full",children:"Measurement"}),e.jsx("div",{className:l("-mt-1 relative",{hidden:!p}),children:e.jsx(o.VertexTooltip,{content:"Reset",placement:"left-start",children:e.jsx(o.VertexIconButton,{"data-testid":"measurement-details-reset",iconName:"reset",iconSize:"sm",onClick:i.resetMeasurement})})})]}),e.jsx(c.VertexViewerMeasurementDetails,{"data-testid":"measurement-details-viewer-measurement-details",className:l("gap-y-1.5 text-xs",{hidden:null==u}),measurementOutcome:u,measurementOverlays:d,distanceUnits:toUnitType(f),fractionalDigits:parseInt(v,10)}),e.jsx("div",{"data-testid":"measurement-details-message",className:l("text-xs",{hidden:null==m}),children:m})]})})}function useCallbackRef(e){var t;const[n,i]=a.useState((t=void 0,null)),s=undefined;return{element:n,callback:a.useCallback((e=>i(e)),[])}}function VertexPointToPointMeasurement({detailsPlacement:t,onPointToPointMeasurementChange:i}){const s=useMeasurementActions(),o=n.useRecoilValue(g),l=n.useRecoilValue(xe),r=n.useRecoilValue(he),u=n.useRecoilValue(Et),d=n.useRecoilValue(It),{callback:m,element:p}=useCallbackRef();usePointToPointMeasurement(p);const h=a.useCallback((e=>{const t={start:e.detail.start,end:e.detail.end,invalid:!e.detail.valid};s.setEditedPointToPointMeasurement(t),null==i||i(t)}),[s]);return l?e.jsxs(e.Fragment,{children:[e.jsx(c.VertexViewerMeasurementDistance,{"data-testid":"point-to-point-measurement",ref:m,viewer:null!=o?o:void 0,mode:"replace",start:null==r?void 0:r.start,end:null==r?void 0:r.end,invalid:null==r?void 0:r.invalid,units:toUnitType(u),fractionalDigits:parseInt(d,10),showAxisReferenceLines:!0,onEditEnd:h}),e.jsx(VertexMeasurementDetails,{placement:t}),e.jsx(VertexMeasurementContextMenu,{onDelete:s.resetMeasurement})]}):e.jsx(e.Fragment,{})}function VertexPointToPointMeasurementTool(){const t=useMeasurementActions(),i=n.useRecoilValue(xe);return useStackKeyBinding({id:"ExitMeasurement",keyBind:"Escape",fn:t.disableEditMeasurement,addPredicate:()=>i,cancelPredicate:()=>!i},[i,t]),e.jsx(o.VertexTooltip,{content:"Point to Point Measurement",children:e.jsx(o.VertexIconButton,{iconName:"tape-measure","data-testid":"viewer-toolbar-point-to-point-measurement-button",iconColor:i?"primary":"secondary",onClick:t.toggleEditPointToPointMeasurement})})}const Ot=n.atom({key:"viewerToolkitSdkConfig",default:void 0}),VertexPreciseMeasurement=({detailsPlacement:t,onEntitiesChanged:i,onOutcomeChanged:a})=>{var s,o,l,r;const u=n.useRecoilValue(g),d=n.useRecoilValue(Ot),m=n.useRecoilValue(ve),{callback:p,element:h}=useCallbackRef();return usePreciseMeasurementModel(h,i,a),m?e.jsxs(e.Fragment,{children:[e.jsx(c.VertexViewerMeasurementPrecise,{"data-testid":"precise-measurement-viewer-tool",ref:p,viewer:null!=u?u:void 0,config:JSON.stringify({network:{apiHost:null===(s=null==d?void 0:d.network)||void 0===s?void 0:s.apiHost,renderingHost:null===(o=null==d?void 0:d.network)||void 0===o?void 0:o.renderingHost,sceneTreeHost:null===(l=null==d?void 0:d.network)||void 0===l?void 0:l.sceneTreeHost,sceneViewHost:null===(r=null==d?void 0:d.network)||void 0===r?void 0:r.sceneViewHost}})}),e.jsx(VertexMeasurementDetails,{placement:t})]}):e.jsx(e.Fragment,{})};function VertexPreciseMeasurementTool(){const t=useMeasurementActions(),i=n.useRecoilValue(ve);return e.jsx(o.VertexTooltip,{content:"Precise Measurement",children:e.jsx(o.VertexIconButton,{iconName:"ruler","data-testid":"viewer-toolbar-precise-measurement-button",iconColor:i?"primary":"secondary",onClick:t.toggleEditPreciseMeasurement})})}function VertexApplicationMessages(){const t=n.useRecoilValue(Ie),i=n.useRecoilValue(Ee);return e.jsxs(e.Fragment,{children:[null!=t&&e.jsx(o.VertexBanner,{className:"z-[16000]",duration:t.duration,open:!0,content:t.message,type:t.type},t.id),null!=i&&e.jsx(o.VertexToast,{placement:"bottom-left",className:"z-[16000]",duration:i.duration,open:!0,content:i.message,type:i.type},i.id)]})}const targetIsElement=(e,t)=>e instanceof Element&&e.tagName===t;function useRecoilRef({state:e}){const t=undefined;return n.useRecoilCallback((({set:t})=>n=>{t(e,n)}),[])}var Nt;function styleFromOptionalFont(e){return null!=e?{"--scene-tree-default-font-family":styleFromFontFace(e.fontFace),"--scene-tree-default-font-color":e.color}:{}}function styleFromOptionalBackgroundColors(e){const t=null==e?void 0:e.depthColors,n=null!=t?Object.keys(t).reduce(((e,n)=>Object.assign(Object.assign({},e),{[`--scene-tree-row-background-color-depth-${n}`]:t[parseInt(n)]})),{}):{};return null!=e?Object.assign(Object.assign({},n),{"--scene-tree-hovered-row-background-color":e.hovered,"--scene-tree-selected-row-background-color":e.selected,"--scene-tree-row-background-color":e.defaultColor}):{}}function styleFromFontFace(e){return e===Nt.ROBOTO_MONO?"var(--vertex-ui-font-family-monospace)":"var(--vertex-ui-font-family)"}!function(e){e.ROBOTO="ROBOTO",e.ROBOTO_MONO="ROBOTO_MONO"}(Nt||(Nt={}));const VertexSceneTreeCollapseAll=()=>{const t=n.useRecoilValue(St);return e.jsx(o.VertexTooltip,{className:"w-auto",content:"Collapse All",placement:"top",children:e.jsx(o.VertexIcon,{size:"sm",className:"h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer","data-testid":"collapse-all-icon",name:"collapse-all",onClick:()=>{null==t||t.collapseAll()}})})},VertexSceneTreeExpandAll=()=>{const t=n.useRecoilValue(St);return e.jsx(o.VertexTooltip,{className:"w-auto",content:"Expand All",placement:"top",children:e.jsx(o.VertexIcon,{size:"sm","data-testid":"expand-all-icon",className:"h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer",name:"expand-all",onClick:()=>{null==t||t.expandAll()}})})};function VertexSceneTreeToolbar(){return e.jsx(c.VertexSceneTreeToolbar,{className:"h-10 border-b border-neutral-300 box-border",children:e.jsxs("div",{className:"flex flex-shrink-0 w-full text-neutral-700 items-center gap mx-2",children:[e.jsx(VertexSceneTreeExpandAll,{}),e.jsx(VertexSceneTreeCollapseAll,{})]})})}const VertexSceneTreeHeader=({children:t})=>{const n=null!=t&&!1!==t;return e.jsx("div",{slot:"header",className:"flex flex-col",children:n?t:e.jsxs(e.Fragment,{children:[e.jsx(c.VertexSceneTreeSearch,{className:"border-b border-neutral-300"}),e.jsx(VertexSceneTreeToolbar,{})]})})},Lt={binding:"{{row.node.name}}",label:"Name",metadataKeyName:"VERTEX_SCENE_ITEM_NAME"},Bt=n.selector({key:"sceneTreeColumnsActiveColumns",get:({get:e})=>{const t=[],n=e(Ct);if(null!=n&&n>0){const e=1/(t.length+1)*n,i=(n-e)/t.length;return{Name:Object.assign(Object.assign({},Lt),{initialWidth:e,minWidth:i})}}return{Name:Lt}}}),_t=n.selector({key:"sceneTreeColumnsActiveColumnNames",get:({get:e})=>Object.keys(e(Bt))}),VertexSceneTreeTableLayout=t=>{const i=n.useRecoilValue(Bt),a=n.useRecoilValue(_t),s=[];return e.jsx(c.VertexSceneTreeTableLayout,Object.assign({"data-testid":"scene-tree-table-layout"},t,{children:a.map(((t,n)=>{var o;const r=i[t],u=null!==(o=s[n])&&void 0!==o?o:r.initialWidth;return e.jsxs(c.VertexSceneTreeTableColumn,{"data-testid":`scene-tree-table-column-${n}`,initialWidth:u,minWidth:r.minWidth,children:[e.jsx("template",{slot:"header",dangerouslySetInnerHTML:{__html:`\n <div class="text-sm text-neutral-800 my-2">\n <div class="${l("truncate",{"pl-2":0===n,"pr-2":n===a.length-1})}">\n ${r.label}\n </div>\n </div>\n `}}),e.jsx("template",{dangerouslySetInnerHTML:{__html:`\n <vertex-scene-tree-table-cell\n prop:value="${r.binding}"\n prop:selection-handler="{{row.data.handleSelection}}"\n prop:expansion-handler="{{row.data.handleExpansion}}"\n prop:visibility-handler="{{row.data.handleVisibility}}"\n ${0===n?"expand-toggle":""}\n ${n===a.length-1?"isolate-button visibility-toggle":""}>\n <div class="flex items-center gap-2">\n <vertex-tooltip \n class="truncate" \n prop:content="${null!=r.binding?r.binding:"--"}" \n placement="${n!==a.length-1?"right":"top"}">\n <div class="flex items-center w-full">\n <div class="truncate">${r.binding}</div>\n </div>\n </vertex-tooltip>\n </div>\n \n\n <div slot="placeholder" class="flex items-center w-full truncate">\n <div> -- </div>\n </div>\n </vertex-scene-tree-table-cell>\n `}})]},r.label)}))}))},VertexSceneTree=i=>{var{id:a,font:s,backgroundColors:o,children:r,style:u,onPointerDown:d,onClick:m,onToggleSelection:p,onToggleExpansion:h,onToggleVisibility:f,className:v,rowData:b}=i,V=__rest(i,["id","font","backgroundColors","children","style","onPointerDown","onClick","onToggleSelection","onToggleExpansion","onToggleVisibility","className","rowData"]);const w=n.useRecoilValue(Ot),S=useSelectionActions(),C=useSceneTreeActions(),j=n.useRecoilValue(g),A=useRecoilRef({state:St}),k=null!=r&&!1!==r,wrappedExpansionHandler=(e,t,n)=>{C.toggleExpansion(e,t,n),null==h||h(e,t,n)},wrappedSelectionHandler=(e,t,n)=>{C.toggleSelection(e,t,n),null==p||p(e,t,n)},wrappedVisibilityHandler=(e,t,n)=>{C.toggleVisibility(e,t,n),null==f||f(e,t,n)},handleClick=e=>{e.altKey&&C.flyToRow(e.clientY),null==m||m(e)},handlePointerDown=e=>{targetIsElement(e.target,"VERTEX-SCENE-TREE-TABLE-COLUMN")&&S.clearSelection(),null==d||d(e)};return e.jsx("div",{className:l("flex flex-col w-full h-full",v),children:e.jsx("div",{className:"flex group h-full",children:e.jsx(c.VertexSceneTree,Object.assign({id:null!=a?a:"vertex-scene-tree","data-testid":"vertex-scene-tree",config:w,ref:A,className:"flex-1",style:Object.assign(Object.assign(Object.assign({},styleFromOptionalFont(s)),styleFromOptionalBackgroundColors(o)),u),onConnectionError:e=>{t.logger.error("Scene Tree Connection Error: ",e.detail)},viewer:j,onPointerDown:handlePointerDown,onClick:handleClick,rowData:e=>{var t;const n=null!==(t=null==b?void 0:b(e))&&void 0!==t?t:{};return Object.assign({handleExpansion:wrappedExpansionHandler,handleSelection:wrappedSelectionHandler,handleVisibility:wrappedVisibilityHandler},n)}},V,{children:k?r:e.jsxs(e.Fragment,{children:[e.jsx(VertexSceneTreeHeader,{}),e.jsx(VertexSceneTreeTableLayout,{}),e.jsx(VertexSceneTreeContextMenu,{})]})}))})})},VertexDecimalPlaceSelector=({onApply:t})=>{const[i,a]=n.useRecoilState(It);return e.jsxs(o.VertexSelect,{"data-testid":"decimal-place-select",className:"w-24",value:i,onOptionChanged:e=>{a(e.detail),null==t||t(e.detail)},children:[e.jsx("div",{className:"py-1.5 px-3",children:"0"}),e.jsx("div",{className:"py-1.5 px-3",children:"1"}),e.jsx("div",{className:"py-1.5 px-3",children:"2"}),e.jsx("div",{className:"py-1.5 px-3",children:"3"})]})},VertexLengthUnitSelector=({onApply:t})=>{const[i,a]=n.useRecoilState(Et);return e.jsxs(o.VertexSelect,{"data-testid":"length-unit-select",className:"w-40",value:i,onOptionChanged:e=>{a(e.detail),null==t||t(e.detail)},children:[e.jsx("div",{"data-value":"cm",className:"py-1.5 px-3",children:"centimeters"}),e.jsx("div",{"data-value":"mm",className:"py-1.5 px-3",children:"millimeters"}),e.jsx("div",{"data-value":"m",className:"py-1.5 px-3",children:"meters"}),e.jsx("div",{"data-value":"in",className:"py-1.5 px-3",children:"inches"}),e.jsx("div",{"data-value":"ft",className:"py-1.5 px-3",children:"feet"})]})};function VertexUnitsControls({onUnitChange:t,onDecimalPlaceChange:n}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Length Unit"}),e.jsx(VertexLengthUnitSelector,{onApply:t})]}),e.jsxs("div",{children:[e.jsx("div",{className:"pt-2 pb-2 text-sm text-neutral-700",children:"Decimals"}),e.jsx(VertexDecimalPlaceSelector,{onApply:n})]})]})}function VertexUnitsPanelSection({onUnitChange:t,onDecimalPlaceChange:n}){return e.jsx(PanelSection,{header:e.jsx("div",{className:"flex items-center text-base",children:"Units"}),children:e.jsx(VertexUnitsControls,{onUnitChange:t,onDecimalPlaceChange:n})})}const Dt=n.atom({key:"openedPanelActivePrimaryLeft",default:void 0}),Ht=n.atom({key:"openedPanelActivePrimaryRight",default:void 0});function usePanelActions(){return{openPrimary:useActionCallback((({set:e})=>(t,n)=>{e("left"===n?Dt:Ht,t)})),closePrimary:useActionCallback((({set:e})=>t=>{e("left"===t?Dt:Ht,void 0)}))}}function DefaultAppearancePanel(){return e.jsxs("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:[e.jsx(VertexMaterialPanelSection,{}),e.jsx(VertexGhostingPanelSection,{}),e.jsx(VertexFeatureEdgesPanelSection,{}),e.jsx(VertexViewerBackgroundPanelSection,{}),e.jsx(VertexSelectionHighlightingPanelSection,{}),e.jsx(VertexCrossSectionAppearancePanelSection,{})]})}function DefaultSettingsPanel(){return e.jsx("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e.jsx(VertexUnitsPanelSection,{})})}const VertexTransformClear=({onClear:t,onClearAll:i})=>{const a=useTransformActions(),s=n.useRecoilValue(Ue);return e.jsx("div",{className:"ml-auto",children:e.jsxs(ResetButton,{id:"transforms",tooltip:"Clear Transforms",children:[e.jsx("div",{className:"pt-1"}),e.jsx(o.VertexMenuItem,{"data-testid":"reset-selected-transforms",onClick:async()=>{await a.clearSelectedTransforms(),null==t||t()},disabled:!s,children:"Clear selected transforms"}),e.jsx(o.VertexMenuItem,{"data-testid":"reset-all-transforms",onClick:async()=>{await a.clearAllTransforms(),null==i||i()},children:"Clear all transforms"})]})})},VertexTransformManipulatorToggle=({onToggleTransformsManipulator:t})=>{const i=useTransformActions(),a=n.useRecoilValue(We),s=n.useSetRecoilState(Qe);return e.jsx(o.VertexToggle,{className:"flex items-center","data-testid":"transform-widget-toggle",variant:"switch",checked:a,onValueChanged:async()=>{a?(i.disableTransformWidget(),null==t||t(!1)):(s("world"),await i.enableTransformWidget(),null==t||t(!0))}})};function VertexTransformControls({onToggleTransformsManipulator:t}){return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex items-center py-3",children:[e.jsx(VertexTransformManipulatorToggle,{onToggleTransformsManipulator:t}),e.jsx("span",{className:"pl-4 text-sm text-neutral-700",children:"Enable manipulator"})]})})}function VertexTransformPanelSection({onClearTransforms:t,onClearAllTransforms:n,onToggleTransformsManipulator:i}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Manual Part Transforms",e.jsx(VertexTransformClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexTransformControls,{onToggleTransformsManipulator:i})})}function DefaultTransformsPanel(){return e.jsx("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e.jsx(VertexTransformPanelSection,{})})}const Ft="Appearance",zt="Settings",Ut="Transforms",ViewerRightPanelHeader=()=>{const t=undefined,i=getHeading(n.useRecoilValue(Ht));return e.jsx("div",{className:"flex flex-col w-full items-center z-overlay pointer-events-none md:pointer-events-auto py-3 px-4 border-b border-neutral-300",children:e.jsx("div",{className:"items-center w-full leading-6 text-md align-center font-medium text-neutral-800",children:i})})};function getHeading(e){switch(e){case"appearance":return Ft;case"settings":return zt;case"transforms":return Ut;default:return"None"}}function VertexViewerRightOpenedPanel(){const t=n.useRecoilValue(Ht),i=a.useMemo((()=>["appearance","settings","transforms"]),[]);return e.jsx(e.Fragment,{children:null!=t&&i.includes(t)&&e.jsxs(VertexResizableContent,{displayShadow:!0,heading:e.jsx(ViewerRightPanelHeader,{}),placement:"right",children:["appearance"===t&&e.jsx(DefaultAppearancePanel,{}),"transforms"===t&&e.jsx(DefaultTransformsPanel,{}),"settings"===t&&e.jsx(DefaultSettingsPanel,{})]})})}function Sidebar({children:t}){return e.jsx("div",{className:"pointer-events-auto flex flex-col items-center w-full border-neutral-300 py-2",children:t})}function SidebarIcon({name:t,iconName:n,active:i,responsive:s,disabled:r,content:c,tooltipPlacement:u,children:d,onSelect:m,onDeselect:p}){return e.jsx("div",{className:l({"text-[var(--vertex-ui-blue-700)]":i===t&&!r,"text-neutral-700 hover:text-neutral-800":i!==t&&!r,"cursor-pointer hover:bg-neutral-200":!r,"text-neutral-400":r,"rounded-full md:p-3":s,"p-3":!s&&null==d,"px-3 py-1":null!=d}),"data-testid":`${t}-sidebar-panel`,onClick:()=>{r||(i===t?p():m())},children:e.jsxs(o.VertexTooltip,{placement:null!=u?u:void 0,content:a.isValidElement(c)?void 0:c,children:[e.jsx("div",{slot:"content",children:c}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx(o.VertexIcon,{name:n}),d]})]})})}function VertexViewerRightSidebar(){const t=usePanelActions(),i=n.useRecoilValue(Ht);return e.jsx("div",{className:"flex flex-col flex-shrink-0 items-center relative border-neutral-300 border-l bg-white h-full top-0 min-w-12 w-12",children:e.jsxs(Sidebar,{children:[e.jsx(SidebarIcon,{name:"appearance",active:i,iconName:"adjustments",tooltipPlacement:"right",content:"Appearance",onSelect:()=>{t.openPrimary("appearance","right")},onDeselect:()=>t.closePrimary("right")}),e.jsx(SidebarIcon,{name:"transforms",active:i,iconName:"show-only-nearby",tooltipPlacement:"right",content:"Transforms",onSelect:()=>{t.openPrimary("transforms","right")},onDeselect:()=>t.closePrimary("right")}),e.jsx(SidebarIcon,{name:"settings",active:i,iconName:"gear",tooltipPlacement:"right",content:"Settings",onSelect:()=>{t.openPrimary("settings","right")},onDeselect:()=>t.closePrimary("right")})]})})}const VertexPopupButton=t=>{var{open:n,children:i}=t,a=__rest(t,["open","children"]);const s=i.find((e=>e.type===Anchor)),r=i.filter((e=>e.type!==Anchor));return null==s?e.jsx(e.Fragment,{}):e.jsxs(o.VertexPopover,Object.assign({className:"flex",placement:"top",backdrop:!1,open:asBooleanAttribute(n)},a,{children:[s,e.jsx("div",{className:l("flex mb-1.5",{hidden:!n}),"data-testid":"align-plane-popover-menu",children:r})]}))},Anchor=({tooltipContent:t,children:n})=>e.jsx("div",{slot:"anchor",children:e.jsx(o.VertexTooltip,{className:"cursor-pointer",content:t,children:n})});function VertexViewerToolbarDivider(){return e.jsx("div",{"data-testid":"toolbar-divider",className:"h-6 w-px bg-neutral-300 mx-1 items-center mt-1"})}function VertexViewerCrossSectionAlignmentPopoverMenu(){const t=useCrossSectioningActions(),i=n.useRecoilValue(G),a=n.useRecoilValue(N),getBaseIcon=()=>`align-to-${null==a?void 0:a.mode}`;return useStackKeyBinding({id:"CrossSectionAlignment",keyBind:"Escape",fn:t.cancelCurrentHit,addPredicate:()=>{var e;return null!==(e=null==a?void 0:a.hitPending)&&void 0!==e&&e},cancelPredicate:()=>!(null==a?void 0:a.hitPending)},[null==a?void 0:a.hitPending]),e.jsxs(VertexPopupButton,{"data-testid":"section-alignment-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(i),onDismissed:t.closeAlignmentTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Section Alignment",children:e.jsx(o.VertexIconButton,{"data-testid":"section-alignment-icon-button",iconName:getBaseIcon(),iconColor:"secondary",onClick:i?t.closeAlignmentTools:t.openAlignmentTools,children:e.jsx(o.VertexIcon,{"data-testid":"section-alignment-icon-chevron",name:"chevron-up",size:"sm"})})}),e.jsxs(c.VertexViewerToolbarGroup,{direction:"vertical",className:"flex justify-evenly items-center py-1 my-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(o.VertexIconButton,{iconColor:"secondary",onClick:()=>t.updateAlignment("global"),className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2","data-testid":"section-alignment-align-global",iconName:"align-to-global",variant:"plain",children:e.jsx("div",{className:"text-base ml-2",children:"Align to Global"})}),e.jsx(o.VertexIconButton,{iconColor:"secondary",onClick:()=>t.updateAlignment("surface"),className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2","data-testid":"section-alignment-align-surface",iconName:"align-to-surface",variant:"plain",children:e.jsx("div",{className:"text-base ml-2",children:"Align to Surface"})})]})]})}function VertexViewerCrossSectionAxisPopoverMenu(){const t=useCrossSectioningActions(),i=n.useRecoilValue(K),s=n.useRecoilValue(O),l=n.useRecoilValueLoadable(D),r=a.useMemo((()=>{const e=s.length>0&&"hasValue"===l.state?axis(s[0],xAxis(l.contents),yAxis(l.contents),zAxis(l.contents)):"x";return null!=e?`axis-${e}`:"axis-x"}),[l.state,l.contents,s]);return e.jsxs(VertexPopupButton,{"data-testid":"align-plane-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(i),onDismissed:t.closeAxisTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Align Plane",children:e.jsx(o.VertexIconButton,{onClick:i?t.closeAxisTools:t.openAxisTools,iconName:r,"data-testid":"align-plane-icon",iconColor:"secondary",children:e.jsx(o.VertexIcon,{"data-testid":"align-plane-icon-chevron",name:"chevron-up",size:"sm"})})}),e.jsxs(c.VertexViewerToolbarGroup,{direction:"vertical",className:"flex justify-evenly items-center py-1 my-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(o.VertexIconButton,{"data-testid":"align-plane-x-axis-button",className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2",onClick:()=>t.updateAxis("x"),variant:"plain",iconColor:"secondary",iconName:"axis-x",children:e.jsx("div",{className:"text-base ml-2",children:"X-axis Plane"})}),e.jsx(o.VertexIconButton,{className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2",variant:"plain",iconColor:"secondary",iconName:"axis-y","data-testid":"align-plane-y-axis-button",onClick:()=>t.updateAxis("y"),children:e.jsx("div",{className:"text-base ml-2",children:"Y-axis Plane"})}),e.jsx(o.VertexIconButton,{"data-testid":"align-plane-z-axis-button",className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2",onClick:()=>t.updateAxis("z"),variant:"plain",iconColor:"secondary",iconName:"axis-z",children:e.jsx("div",{className:"text-base ml-2",children:"Z-axis Plane"})})]})]})}function VertexViewerCrossSectionOffsetStepper({offset:t,onOffsetChange:i}){const s=n.useRecoilValue(Et),l=n.useRecoilValue(It),[r,c]=a.useState(convertTo(t,s));a.useEffect((()=>{c(convertTo(t,s))}),[s,t]);const u=createDistanceFormatter(s,parseInt(l,10)),handleIncrementalUpdate=e=>{const t=convertFrom(r+e,s);i(t)},handleSubmit=e=>{e.preventDefault(),i(convertFrom(r,s))},handleBlur=()=>{i(convertFrom(r,s))};return e.jsx(o.VertexTooltip,{content:"Plane Offset",children:e.jsx("form",{"data-testid":"cross-section-stepper-form",onSubmit:handleSubmit,children:e.jsxs(o.VertexTextfield,{"data-testid":"cross-section-stepper-input",className:"viewer-toolbar-input w-32 border-none ring-0 bg-white",type:"text",value:u(parseFloat(t.toFixed(3))),onInputInput:e=>{c(null!=e.detail.value?parseFloat(e.detail.value):t)},onBlur:handleBlur,children:[e.jsx("div",{"data-testid":"cross-section-stepper-decrement",className:"py-1 cursor-pointer",slot:"left",onClick:()=>handleIncrementalUpdate(-1),children:e.jsx(o.VertexIcon,{name:"chevron-left",size:"sm"})}),e.jsx("div",{"data-testid":"cross-section-stepper-increment",className:"py-1 cursor-pointer",slot:"right",onClick:()=>handleIncrementalUpdate(1),children:e.jsx(o.VertexIcon,{name:"chevron-right",size:"sm"})})]})})})}VertexPopupButton.Anchor=Anchor;const Wt=400;function VertexViewerCrossSectionPopupMenu(){const t=useCrossSectioningActions(),i=n.useRecoilValue(W),s=n.useRecoilValueLoadable(F),l=n.useRecoilValueLoadable(U),r=a.useRef(),u=a.useMemo((()=>"hasValue"===s.state?s.contents:E),[s.state,s.contents]),d=a.useMemo((()=>"hasValue"===l.state?l.contents:0),[l.state,l.contents]),handleCrossSectionValueChange=e=>{clearTimeout(r.current),r.current=window.setTimeout((()=>{t.endInteraction()}),Wt),t.beginInteraction(),t.updatePlanes(e)};return e.jsxs(VertexPopupButton,{"data-testid":"cross-section-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(i),onDismissed:t.closeAdditionalTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Section Tools",children:e.jsx("div",{className:"-ml-px py-1.5",children:e.jsx(o.VertexIcon,{"data-testid":"cross-section-popover-icon",name:"chevron-up",size:"sm",onClick:i?t.closeAdditionalTools:t.openAdditionalTools})})}),e.jsxs(c.VertexViewerToolbarGroup,{className:"relative bottom-3 flex justify-evenly items-center p-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(VertexViewerCrossSectionAlignmentPopoverMenu,{}),e.jsx(o.VertexTooltip,{className:"w-auto",content:"Reverse",children:e.jsx(o.VertexIconButton,{iconName:"flip","data-testid":"viewer-toolbar-flip-button",onClick:t.flipPlanes,iconColor:"secondary"})}),e.jsx(o.VertexTooltip,{className:"w-auto",content:"Align View to Plane",children:e.jsx(o.VertexIconButton,{"data-testid":"viewer-toolbar-align-view-to-plane-button",iconName:"align-view-to-plane",onClick:t.alignViewToPlane,iconColor:"secondary"})}),e.jsx(VertexViewerToolbarDivider,{}),e.jsx(VertexViewerCrossSectionAxisPopoverMenu,{}),e.jsx("div",{className:"w-52 mx-2",children:e.jsx(VertexSlider,{value:d,defaultValue:u.default,disabled:asBooleanAttribute("hasValue"!==s.state),min:u.min,max:u.max,step:.01,onChange:handleCrossSectionValueChange})}),e.jsx("div",{className:"px-4",children:e.jsx(VertexViewerCrossSectionOffsetStepper,{offset:"hasValue"===l.state?l.contents:0,onOffsetChange:handleCrossSectionValueChange})})]})]})}const VertexViewerCrossSectionButton=()=>{const t=useCrossSectioningActions(),i=n.useRecoilValue(I);return e.jsxs(e.Fragment,{children:[e.jsx(o.VertexTooltip,{content:i?"Hide Section":"Show Section",children:e.jsx(o.VertexIconButton,{"data-testid":"viewer-toolbar-cross-section-button",iconName:"cross-section",iconColor:i?"primary":"secondary",onClick:()=>i?t.disable():t.enable()})}),e.jsx(VertexViewerCrossSectionPopupMenu,{})]})},VertexFitAllButton=()=>{const t=n.useRecoilValue(g);return e.jsx(o.VertexTooltip,{content:"Fit All",children:e.jsx(o.VertexIconButton,{iconName:"fit-all",iconColor:"secondary","data-testid":"viewer-toolbar-fit-all-button",onClick:async()=>{const e=await(null==t?void 0:t.scene());await(null==e?void 0:e.camera().viewAll().render({animation:{milliseconds:500}}))}})})},VertexPanButton=()=>{const t=n.useRecoilValue(g),i=n.useRecoilValue(f),[s,l]=n.useRecoilState(b),[r,c]=n.useRecoilState(v);return a.useEffect((()=>{null!=t&&i&&c(t.getBaseInteractionHandler())}),[t,i,c]),e.jsx(o.VertexTooltip,{content:"Pan",children:e.jsx(o.VertexIconButton,{iconName:"pan",iconColor:"pan"===s?"primary":"secondary","data-testid":"viewer-toolbar-pan-button",onClick:async()=>{if(l("pan"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("pan")}}})})},VertexRotateButton=()=>{const t=n.useRecoilValue(g),i=n.useRecoilValue(f),[s,l]=n.useRecoilState(b),[r,c]=n.useRecoilState(v);return a.useEffect((()=>{null!=t&&i&&c(t.getBaseInteractionHandler())}),[t,i,c]),e.jsx(o.VertexTooltip,{content:"Rotate",children:e.jsx(o.VertexIconButton,{iconName:"rotate",iconColor:"rotate"===s?"primary":"secondary","data-testid":"viewer-toolbar-rotate-button",onClick:async()=>{if(l("rotate"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("rotate")}}})})},VertexZoomButton=()=>{const t=n.useRecoilValue(g),i=n.useRecoilValue(f),[s,l]=n.useRecoilState(b),[r,c]=n.useRecoilState(v);return a.useEffect((()=>{null!=t&&i&&c(t.getBaseInteractionHandler())}),[t,i,c]),e.jsx(o.VertexTooltip,{content:"Zoom",children:e.jsx(o.VertexIconButton,{iconName:"zoom",iconColor:"zoom"===s?"primary":"secondary","data-testid":"viewer-toolbar-zoom-button",onClick:async()=>{if(l("zoom"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("zoom")}}})})},DefaultToolbar=()=>e.jsx(c.VertexViewerToolbar,{placement:"bottom-center",children:e.jsxs(c.VertexViewerToolbarGroup,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(VertexRotateButton,{}),e.jsx(VertexPanButton,{}),e.jsx(VertexZoomButton,{}),e.jsx(VertexFitAllButton,{}),e.jsx(VertexViewerToolbarDivider,{}),e.jsx(VertexBoxSelectionButton,{}),e.jsx(VertexViewerToolbarDivider,{}),e.jsx(VertexViewerCrossSectionButton,{}),e.jsx(VertexViewerToolbarDivider,{}),e.jsx(VertexPointToPointMeasurementTool,{}),e.jsx(VertexPreciseMeasurementTool,{})]})}),VertexToolbar=({children:t})=>{const n=null!=t&&!1!==t;return e.jsx(c.VertexViewerToolbar,{placement:"bottom-center",children:n?e.jsx(c.VertexViewerToolbarGroup,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:t}):e.jsx(DefaultToolbar,{})})};function VertexTransformWidget({transformWidgetElement:t,supportUndo:i,onPositionChange:s,onRotationChange:o}){const l=useTransformActions(),r=n.useRecoilValue(Ye),u=n.useRecoilValue(We),d=n.useRecoilValue(Ge),m=n.useRecoilValue($e),p=n.useRecoilValueLoadable(qe),g=n.useRecoilValue(Et),h=n.useRecoilValue(It),f=a.useMemo((()=>"hasValue"===p.state?p.contents:m),[p,m]),v=a.useMemo((()=>{const e=undefined;return u&&(null!=f||r)}),[u,f,r]);return e.jsx(e.Fragment,{children:v&&e.jsx(c.VertexViewerTransformWidget,{id:"transform-widget","data-testid":"viewer-transform-widget",ref:t,position:d,rotation:null!=d?f:void 0,decimalPlaces:parseInt(h,10),distanceUnit:toUnitType(g),EXPERIMENTAL_undoKeybindings:null==i||i,onInteractionStarted:()=>{l.disableSelectionSync(),l.setIsInteractivelyTransforming(!0)},onInteractionEnded:()=>{l.invalidateTransforms(),l.setIsInteractivelyTransforming(!1)},onPositionChanged:async e=>{await l.setTransformWidgetPosition(e.detail),null==s||s(e.detail)},onRotationChanged:e=>{l.setTransformWidgetOrientation(e.detail),null==o||o(e.detail)}})})}const VertexViewerSceneReset=({onReset:t})=>{const n=useCrossSectioningActions(),i=useSelectionActions(),a=useTransformActions(),s=useViewerSceneActions(),handleReset=async()=>{await n.disable(),await i.resetSelectionState(),a.clearTransformWidgetPosition(),null==t||t(),await s.reset()};return e.jsx(o.VertexTooltip,{content:"Reset View",children:e.jsx(o.VertexIconButton,{iconName:"reset",className:"flex bg-white opacity-70 hover:opacity-100 text-neutral-900 hover:text-neutral-700 hover:bg-neutral-200 rounded p-1 cursor-pointer","data-testid":"viewer-reset-tool-button",onClick:handleReset,variant:"plain"})})};function useViewerFrameActions(){const e=useTransformActions();return{frameDrawn:useActionCallback((({set:t,snapshot:n})=>async i=>{const a=await n.getPromise(He);t(w,i.detail.scene),t(He,i.detail.scene.sceneViewSummary.selectedVisibleSummary),t(De,a);const s=undefined;await n.getPromise(We)&&await e.syncToSelection()}))}}const VertexBoxSelectionTool=()=>{const{element:t,callback:i}=useCallbackRef(),a=useBoxSelectionActions(),s=useTransformActions(),o=n.useRecoilValue(pe);return m.useEffect((()=>{const e=whenComponentReady(t,(()=>{var e;return[null===(e=null==t?void 0:t.model)||void 0===e?void 0:e.onDragComplete((()=>{"clearAndSelect"===o&&(s.clearTransformWidgetOrientation(),s.clearTransformWidgetPosition(),s.enableSelectionSync())}))]}));return()=>{null==e||e.then((e=>{null==e||e.forEach((e=>null==e?void 0:e.dispose()))}))}}),[t,o]),useApplyKeyBinding({keyBind:"Shift",fn:m.useCallback((()=>a.setOperationType("select")),[]),off:m.useCallback((()=>a.setOperationType("clearAndSelect")),[])}),e.jsx(c.VertexViewerBoxQueryTool,{ref:i,"data-testid":"viewer-box-query-tool",operationType:o})};function VertexViewerCameraTypeMenu({open:t,onOpen:i,onDismiss:a,onCameraTypeChange:s}){const r=useViewerCameraActions(),c=n.useRecoilValue(j);return e.jsxs(o.VertexMenu,{"data-testid":"camera-types-popover",className:"flex",placement:"bottom-end",open:asBooleanAttribute(t),onMenuClosed:a,children:[e.jsx("div",{slot:"anchor",children:e.jsx("div",{className:l("flex bg-white hover:opacity-100 hover:text-neutral-700 hover:bg-neutral-200 rounded",{"opacity-70 text-neutral-900":!t,"opacity-100 text-neutral-700 bg-neutral-200":t}),children:e.jsx(o.VertexTooltip,{content:"Change View",children:e.jsx(o.VertexIconButton,{"data-testid":"set-camera-mode-option",className:"p-1 cursor-pointer",variant:"plain",onClick:i,iconName:"orthographic"===c?"cube-orthographic":"cube-perspective",children:e.jsx(o.VertexIcon,{"data-testid":"change-camera-type-icon-button",name:"chevron-down",size:"sm"})})})})}),e.jsxs("div",{className:"w-36",children:[e.jsx("div",{className:"pt-1"}),e.jsxs(o.VertexMenuItem,{"data-testid":"set-perspective-view",onClick:()=>{r.updateCameraType("perspective"),null==s||s("perspective")},children:[e.jsx(o.VertexIcon,{slot:"icon","data-testid":"set-perspective-view-icon",name:"cube-perspective",size:"sm",className:l({"text-[var(--vertex-ui-blue-700)]":"perspective"===c})}),e.jsx("div",{className:l("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"perspective"===c}),children:"Perspective"})]}),e.jsxs(o.VertexMenuItem,{"data-testid":"set-orthographic-view",onClick:()=>{r.updateCameraType("orthographic"),null==s||s("orthographic")},children:[e.jsx(o.VertexIcon,{slot:"icon","data-testid":"set-orthographic-view-icon",name:"cube-orthographic",size:"sm",className:l({"text-[var(--vertex-ui-blue-700)]":"orthographic"===c})}),e.jsx("div",{className:l("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"orthographic"===c}),children:"Orthographic"})]})]})]})}const VertexViewerViewCube=t=>{var{placement:n,children:i}=t,s=__rest(t,["placement","children"]);const o=Array.isArray(i)?i:[i],l=o.filter((e=>!a.isValidElement(e)||e.type!==c.VertexViewerViewCube)).filter((e=>null!=e&&!1!==e)),r=o.find((e=>a.isValidElement(e)&&e.type===c.VertexViewerViewCube)),[u,d]=a.useState(!1);return e.jsxs(c.VertexViewerToolbar,{direction:"vertical","data-testid":"view-cube-toolbar",placement:null!=n?n:"top-right",children:[null!=r?r:e.jsx(c.VertexViewerViewCube,Object.assign({className:"m-7"},s)),0===l.length?e.jsxs("div",{className:"flex items-center justify-center mt-3 gap-1",children:[e.jsx(VertexViewerSceneReset,{}),e.jsx(VertexViewerCameraTypeMenu,{open:u,onDismiss:()=>d(!1),onOpen:()=>d(!0)})]}):e.jsx("div",{className:"mt-3",children:l})]})},VertexViewer=t=>{var{id:i,className:s,disableSelection:o,onTap:r,onLongpress:u,onFrameDrawn:d,onSceneReady:m,viewerRefCallback:p,children:v}=t,b=__rest(t,["id","className","disableSelection","onTap","onLongpress","onFrameDrawn","onSceneReady","viewerRefCallback","children"]);const V=n.useRecoilValue(Ot),w=useRecoilRef({state:g}),S=useViewerCameraActions(),C=useHitActions(),A=useSelectionActions(),k=useViewerFrameActions(),[T,P]=n.useRecoilState(f),E=n.useRecoilValue(j),I=n.useRecoilValue(N),R=n.useRecoilValue(me),[M,O]=n.useRecoilState(h);a.useEffect((()=>{null!=i&&O(i)}),[i]);const L=n.useRecoilValue(At),B=a.useMemo((()=>({opacity:L/100})),[L]),_=n.useRecoilValue(ae),D=n.useRecoilValue(se),H=a.useMemo((()=>({color:_,width:D})),[_,D]),F=n.useRecoilValue(xt),U=n.useRecoilValue(vt),W=n.useRecoilValue(yt),G=n.useRecoilValue(bt),K=a.useMemo((()=>({color:U,opacity:W/100,lineWidth:G})),[U,W,G]),q=n.useRecoilValue(ve),$=null!=v&&!1!==v;return useKeyBindings(),useDefaultKeybindings(),e.jsxs(c.VertexViewer,Object.assign({id:M,"data-testid":"vertex-viewer",ref:null!=p?p:w,className:l("flex w-full h-full",s,{"cursor-crosshair":I.hitPending}),style:{"--viewer-background":F},config:V,cameraType:T?E:void 0,onCameraTypeChanged:e=>{T&&S.updateCameraType(e.detail)},phantom:B,featureLines:H,selectionHighlighting:K,featureMaps:q?"final":void 0,onTap:e=>{const t=[...o?[]:[A.selectCurrentHit]];C.tap(e,...t),null==r||r(e)},onLongpress:e=>{C.longPress(e),null==u||u(e)},onFrameDrawn:e=>{k.frameDrawn(e),null==d||d(e)},onSceneReady:e=>{T||P(!0),null==m||m(e)}},b,{children:[R&&e.jsx(VertexBoxSelectionTool,{}),$?v:e.jsxs(e.Fragment,{children:[e.jsx(VertexViewerViewCube,{}),e.jsx(VertexToolbar,{}),e.jsx(VertexViewerContextMenu,{})]})]}))};function toSdkConfig(e){return isOnlyNetworkConfig(e)?{network:e}:e}function isOnlyNetworkConfig(e){const t=undefined;return null!=e.renderingHost}const VertexViewerToolkitEventListener=({onHitStateChange:t,onSelectionStateChange:i})=>{const s=n.useRecoilValue(et),o=n.useRecoilValue(nt);return a.useEffect((()=>{null==t||t(s)}),[s,t]),a.useEffect((()=>{null==i||i(o)}),[o,i]),e.jsx(e.Fragment,{})},VertexViewerToolkitRoot=t=>{var{override:i,autoDefineCustomElements:s,children:o,config:l}=t,r=__rest(t,["override","autoDefineCustomElements","children","config"]);return a.useEffect((()=>{(null==s||s)&&(d.defineCustomElements(),u.defineCustomElements())}),[s]),e.jsx(n.RecoilRoot,{override:i,children:e.jsxs(e.Fragment,{children:[e.jsx(VertexViewerToolkitEventListener,Object.assign({},r)),e.jsx(VertexViewerToolkitRootConfig,{config:l,children:o})]})})},VertexViewerToolkitRootConfig=({config:t,children:i})=>{const s=n.useSetRecoilState(Ot);return a.useEffect((()=>{const e=null!=t?toSdkConfig(t):void 0;s(e)}),[t,s]),e.jsx(e.Fragment,{children:i})};var Gt=Object.freeze({__proto__:null,get AssemblyFontFace(){return Nt}});exports.CrossSection=te,exports.Hits=tt,exports.SceneTree=Gt,exports.Selection=it,exports.VertexApplicationMessages=VertexApplicationMessages,exports.VertexBoxSelectionButton=VertexBoxSelectionButton,exports.VertexContextMenu=VertexContextMenu,exports.VertexCrossSectionAppearanceColorPicker=VertexCrossSectionAppearanceColorPicker,exports.VertexCrossSectionAppearanceControls=VertexCrossSectionAppearanceControls,exports.VertexCrossSectionAppearanceLineThicknessSlider=VertexCrossSectionAppearanceLineThicknessSlider,exports.VertexCrossSectionAppearancePanelSection=VertexCrossSectionAppearancePanelSection,exports.VertexCrossSectionAppearanceReset=VertexCrossSectionAppearanceReset,exports.VertexDecimalPlaceSelector=VertexDecimalPlaceSelector,exports.VertexFeatureEdgesColorPicker=VertexFeatureEdgesColorPicker,exports.VertexFeatureEdgesControls=VertexFeatureEdgesControls,exports.VertexFeatureEdgesPanelSection=VertexFeatureEdgesPanelSection,exports.VertexFeatureEdgesReset=VertexFeatureEdgesReset,exports.VertexFeatureEdgesThicknessSlider=VertexFeatureEdgesThicknessSlider,exports.VertexFitAllButton=VertexFitAllButton,exports.VertexFitSelectedMenuItem=VertexFitSelectedMenuItem,exports.VertexFlyToMenuItem=VertexFlyToMenuItem,exports.VertexGhostingControls=VertexGhostingControls,exports.VertexGhostingPanelSection=VertexGhostingPanelSection,exports.VertexHideAllMenuItem=VertexHideAllMenuItem,exports.VertexHidePartMenuItem=VertexHidePartMenuItem,exports.VertexHideSelectedMenuItem=VertexHideSelectedMenuItem,exports.VertexLengthUnitSelector=VertexLengthUnitSelector,exports.VertexMaterialControls=VertexMaterialControls,exports.VertexMaterialPanelSection=VertexMaterialPanelSection,exports.VertexMeasurementContextMenu=VertexMeasurementContextMenu,exports.VertexMeasurementDetails=VertexMeasurementDetails,exports.VertexPanButton=VertexPanButton,exports.VertexPointToPointMeasurement=VertexPointToPointMeasurement,exports.VertexPointToPointMeasurementTool=VertexPointToPointMeasurementTool,exports.VertexPreciseMeasurement=VertexPreciseMeasurement,exports.VertexPreciseMeasurementTool=VertexPreciseMeasurementTool,exports.VertexResizableContent=VertexResizableContent,exports.VertexRotateButton=VertexRotateButton,exports.VertexSceneItemGhostingClear=VertexSceneItemGhostingClear,exports.VertexSceneItemGhostingOpacitySlider=VertexSceneItemGhostingOpacitySlider,exports.VertexSceneItemGhostingToggle=VertexSceneItemGhostingToggle,exports.VertexSceneItemMaterialClear=VertexSceneItemMaterialClear,exports.VertexSceneItemMaterialColorPicker=VertexSceneItemMaterialColorPicker,exports.VertexSceneItemMaterialOpacitySlider=VertexSceneItemMaterialOpacitySlider,exports.VertexSceneTree=VertexSceneTree,exports.VertexSceneTreeContextMenu=VertexSceneTreeContextMenu,exports.VertexSceneTreeHeader=VertexSceneTreeHeader,exports.VertexSceneTreeTableLayout=VertexSceneTreeTableLayout,exports.VertexSelectionHighlightingColorPicker=VertexSelectionHighlightingColorPicker,exports.VertexSelectionHighlightingControls=VertexSelectionHighlightingControls,exports.VertexSelectionHighlightingLineThicknessSlider=VertexSelectionHighlightingLineThicknessSlider,exports.VertexSelectionHighlightingOpacitySlider=VertexSelectionHighlightingOpacitySlider,exports.VertexSelectionHighlightingPanelSection=VertexSelectionHighlightingPanelSection,exports.VertexSelectionHighlightingReset=VertexSelectionHighlightingReset,exports.VertexShowAllMenuItem=VertexShowAllMenuItem,exports.VertexShowOnlyMenuItem=VertexShowOnlyMenuItem,exports.VertexShowOnlySelectedMenuItem=VertexShowOnlySelectedMenuItem,exports.VertexToolbar=VertexToolbar,exports.VertexTransformClear=VertexTransformClear,exports.VertexTransformControls=VertexTransformControls,exports.VertexTransformManipulatorToggle=VertexTransformManipulatorToggle,exports.VertexTransformPanelSection=VertexTransformPanelSection,exports.VertexTransformWidget=VertexTransformWidget,exports.VertexUnitsControls=VertexUnitsControls,exports.VertexUnitsPanelSection=VertexUnitsPanelSection,exports.VertexViewer=VertexViewer,exports.VertexViewerBackgroundColorPicker=VertexViewerBackgroundColorPicker,exports.VertexViewerBackgroundControls=VertexViewerBackgroundControls,exports.VertexViewerBackgroundPanelSection=VertexViewerBackgroundPanelSection,exports.VertexViewerBackgroundReset=VertexViewerBackgroundReset,exports.VertexViewerContextMenu=VertexViewerContextMenu,exports.VertexViewerCrossSectionButton=VertexViewerCrossSectionButton,exports.VertexViewerRightOpenedPanel=VertexViewerRightOpenedPanel,exports.VertexViewerRightSidebar=VertexViewerRightSidebar,exports.VertexViewerSceneReset=VertexViewerSceneReset,exports.VertexViewerToolbarDivider=VertexViewerToolbarDivider,exports.VertexViewerToolkitRoot=VertexViewerToolkitRoot,exports.VertexViewerViewCube=VertexViewerViewCube,exports.VertexZoomButton=VertexZoomButton;
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("@vertexwebtoolkit/logging"),n=require("recoil"),a=require("@vertexvis/utils"),i=require("react"),s=require("@vertexvis/geometry"),o=require("@vertexvis/ui-react"),l=require("classnames"),r=require("@vertexvis/viewer"),c=require("@vertexvis/viewer-react"),u=require("@vertexvis/ui/loader"),d=require("@vertexvis/viewer/loader");function _interopNamespaceDefault(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var m=_interopNamespaceDefault(i);function __rest(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,a=Object.getOwnPropertySymbols(e);i<a.length;i++)t.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(n[a[i]]=e[a[i]]);return n}"function"==typeof SuppressedError&&SuppressedError;class p{}function useActionCallback(e,t=[]){const a=t instanceof p?void 0:t;return n.useRecoilCallback((t=>e(Object.assign(Object.assign({},t),{snapshot:Object.defineProperties(t.snapshot,{getPromiseRequired:{configurable:!0,value:createGetPromiseRequiredWrapper(t.snapshot)},tryGetPromise:{configurable:!0,value:createTryGetPromiseWrapper(t.snapshot)}})}))),a)}function retainSnapshot(e){return t=>{var{snapshot:n}=t,a=__rest(t,["snapshot"]);return async(...t)=>{const i=n.retain();try{const i=undefined;return await e(Object.assign(Object.assign({},a),{snapshot:n}))(...t)}finally{i()}}}}function createGetPromiseRequiredWrapper(e){return async(t,n)=>{const a=await e.getPromise(t);if(null==a)throw null!=n?n:new Error(`No value present for required value ${t.key}`);return a}}function createTryGetPromiseWrapper(e){return async n=>{try{return{value:await e.getPromise(n)}}catch(e){return t.logger.debug(`Error encountered retrieving Recoil value. [key={${n.key}}]`,e),{error:e}}}}const g=n.atom({key:"viewerToolkitViewerElement",default:void 0,dangerouslyAllowMutability:!0}),h=n.atom({key:"viewerElementId",default:"vertex-viewer"}),f=n.atom({key:"viewerInitialSceneReady",default:!1}),v=n.atom({key:"viewerBaseInteractionHandlerProvider",default:Promise.resolve(void 0),dangerouslyAllowMutability:!0}),b=n.atom({key:"viewerPrimaryInteractionType",default:"rotate"}),V=n.selector({key:"viewerScene",get:({get:e})=>async()=>{var t;return null===(t=e(g))||void 0===t?void 0:t.scene()},dangerouslyAllowMutability:!0}),S=n.atom({key:"viewerFrameScene",default:void 0,dangerouslyAllowMutability:!0}),w=n.selector({key:"viewerSceneVisibleBoundingBox",get:({get:e})=>{var t;return null===(t=e(S))||void 0===t?void 0:t.boundingBox}});function useViewerSceneActions(){const e=useActionCallback((({snapshot:e})=>async(t,n,...a)=>{const i=await e.getPromise(V),s=await i();a.length>0&&await(null==s?void 0:s.items((e=>a.map((t=>t(e))))).execute({suppliedCorrelationId:n}))})),t=i.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).select()),[]),n=i.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).deselect()),[]),s=i.useCallback((e=>e.where((e=>e.all())).deselect()),[]);return{executeWithCorrelationId:e,execute:useActionCallback((()=>async(t,...n)=>{const i=a.UUID.create();await e(t,i,...n)})),selectItemsTransform:t,deselectItemsTransform:n,clearSelectionTransform:s,reset:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromiseRequired(V),a=await n(),i=await e.getPromiseRequired(j);null==a||a.reset({includeCamera:!0,suppliedCorrelationId:t,cameraTypeOverride:i})}))}}const C=500;function useViewerCameraActions(){return{flyToById:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(V),i=await a();await(null==i?void 0:i.camera().flyTo({itemId:t}).render({animation:{milliseconds:null!=n?n:C}}))})),flyToByBoundingBox:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(V),i=await a();await(null==i?void 0:i.camera().flyTo({boundingBox:t}).render({animation:{milliseconds:null!=n?n:C}}))})),updateCameraType:useActionCallback((({set:e})=>t=>{e(j,t)}))}}const j=n.atom({key:"viewerCameraType",default:"perspective"});class k{constructor(){this.interactionStarted=!1}initialize(e,t){this.api=t}dispose(){this.endInteraction()}async beginInteraction(){var e;this.interactionStarted||(await(null===(e=this.api)||void 0===e?void 0:e.beginInteraction()),this.interactionStarted=!0)}async endInteraction(){var e;await(null===(e=this.api)||void 0===e?void 0:e.endInteraction()),this.interactionStarted=!1}}const create=(e,t=0)=>({normal:e,offset:t}),forAxis=(e,t)=>{switch(e){case"x":return x(t);case"y":return y(t);case"z":return z(t)}},x=e=>create(s.Vector3.left(),-e),y=e=>create(s.Vector3.down(),-e),z=e=>create(s.Vector3.forward(),-e),getAxis=(e,t)=>{switch(e){case"x":return xAxis(t);case"y":return yAxis(t);case"z":return zAxis(t)}},A={x:s.Vector3.left(),y:s.Vector3.down(),z:s.Vector3.forward()},xAxis=e=>e.x,yAxis=e=>e.y||s.Vector3.create(e.x.z,e.x.x,e.x.y),zAxis=e=>e.z||s.Vector3.create(e.x.y,e.x.z,e.x.x),axis=(e,t,n,a)=>e&&e.normal&&[["x",t],["y",n],["z",a]].filter((t=>0===s.Vector3.magnitude(s.Vector3.cross(e.normal,t[1])))).map((e=>e[0])).pop(),isNegativeNormal=e=>s.Vector3.dot(s.Vector3.create(-1,-1,-1),e.normal)>0,towardsVector=(e,t)=>{const n=undefined;return s.Vector3.dot(e,t.normal)<0?invert(t):t},towardsCamera=(e,t)=>towardsVector(e.viewVector,t),invert=e=>Object.assign(Object.assign({},e),{normal:s.Vector3.multiply(e.normal,s.Vector3.create(-1,-1,-1)),offset:-e.offset}),fromHit=(e,t)=>{const n=s.Vector3.normalize(e.normal),a=s.Vector3.dot(n,e.position);return towardsCamera(t,create(n,a))},toAxis=(e,t,n,a,i)=>{const o=n.viewAll(),l=getAxis(e,t),r=null!=a&&null!=l?create(l,s.Vector3.dot(l,i||s.BoundingBox.center(a))):forAxis(e,o.lookAt[e]);return towardsCamera(n,r)};function corners(e){return[s.Vector3.create(e.min.x,e.min.y,e.min.z),s.Vector3.create(e.min.x,e.min.y,e.max.z),s.Vector3.create(e.min.x,e.max.y,e.min.z),s.Vector3.create(e.min.x,e.max.y,e.max.z),s.Vector3.create(e.max.x,e.max.y,e.max.z),s.Vector3.create(e.max.x,e.max.y,e.min.z),s.Vector3.create(e.max.x,e.min.y,e.max.z),s.Vector3.create(e.max.x,e.min.y,e.min.z)]}function equals(e,t){return e.min.x===t.min.x&&e.min.y===t.min.y&&e.min.z===t.min.z&&e.max.x===t.max.x&&e.max.y===t.max.y&&e.max.z===t.max.z}const T="#999999",P=1,E={default:5,min:0,max:10},R=n.atom({key:"crossSectioningEnabled",default:!1}),I=n.atom({key:"crossSectioningHighlightColor",default:T}),M=n.atom({key:"crossSectioningBorderWidth",default:1}),O=n.atom({key:"crossSectioningPlanes",default:[]}),N=n.atom({key:"crossSectioningAlignment",default:{mode:"global",hitPending:!1}}),L=n.selector({key:"crossSectioningTargetBoundingBox",get:async({get:e})=>{const t=undefined;return e(w)}}),B=n.atom({key:"crossSectioningIsInteractive",default:!1}),_=n.atom({key:"crossSectioningActiveAxis",default:"x"}),D=n.atom({key:"crossSectioningAvailableAxes",default:A}),H=n.selector({key:"crossSectioningOffsetScalar",get:({get:e})=>{const t=e(O);return t.length>0&&isNegativeNormal(t[0])?-1:1}}),F=n.selector({key:"crossSectioningSliderRange",get:({get:e})=>{const t=e(O),n=e(L),a=null!=n?corners(n):[];if(t.length>0){const e=a.map((e=>s.Vector3.dot(e,isNegativeNormal(t[0])?s.Vector3.multiply(t[0].normal,s.Vector3.create(-1,-1,-1)):t[0].normal)));return{default:t[0].offset,min:Math.min(...e)-2,max:Math.max(...e)+2}}return E}}),U=n.selector({key:"crossSectioningPlaneDisplayOffset",get:({get:e})=>{const t=e(O),n=e(H),a=e(F);return t.length>0?t[0].offset*n:a.default}}),W=n.atom({key:"crossSectioningAdditionalToolsOpen",default:!1}),G=n.atom({key:"crossSectioningAlignmentToolsOpen",default:!1}),K=n.atom({key:"crossSectioningAxisToolsOpen",default:!1}),q=n.atom({key:"crossSectioningInteractionHandler",default:new k,dangerouslyAllowMutability:!0});function useCrossSectioning(e,t){const a=n.useRecoilValue(q);i.useEffect((()=>{t&&(null==e||e.registerInteractionHandler(a))}),[e,t,a])}const $=n.atom({key:"hitResultsTapDetails",default:void 0}),Y=n.atom({key:"hitResultsLongPressDetails",default:void 0}),X=n.atom({key:"previousHitResult",default:void 0}),Z=n.atom({key:"currentHitResult",default:void 0}),J=n.selector({key:"hitResult",get:async({get:e})=>{var t,n,a,i,o,l,r,c;const u=e($),d=e(Y),m=null!=u?u:d,p=e(V),g=await p(),h=null==g?void 0:g.sceneViewId,f=null==g?void 0:g.raycaster();if(null!=m&&null!=f&&null!=h){const e=await f.hitItems(m.position),u=((null==e?void 0:e.hits)||[])[0];if(null!=u)return{id:null===(t=u.itemId)||void 0===t?void 0:t.hex,normal:s.Vector3.create((null===(n=null==u?void 0:u.hitNormal)||void 0===n?void 0:n.x)||0,(null===(a=null==u?void 0:u.hitNormal)||void 0===a?void 0:a.y)||0,(null===(i=null==u?void 0:u.hitNormal)||void 0===i?void 0:i.z)||0),position:s.Vector3.create((null===(o=null==u?void 0:u.hitPoint)||void 0===o?void 0:o.x)||0,(null===(l=null==u?void 0:u.hitPoint)||void 0===l?void 0:l.y)||0,(null===(r=null==u?void 0:u.hitPoint)||void 0===r?void 0:r.z)||0),meta:m.metaKey||m.ctrlKey||!1,metadata:[],ancestors:(null===(c=null==u?void 0:u.ancestors)||void 0===c?void 0:c.filter((e=>{var t;return null!=(null===(t=e.itemId)||void 0===t?void 0:t.hex)})).map((e=>{var t;return null===(t=e.itemId)||void 0===t?void 0:t.hex})))||[]}}}}),Q=n.atom({key:"hitResultsSkipNextTap",default:!1}),alignToNormal=(e,t,n)=>{if(e.toFrameCamera().isPerspective()){const n=s.Vector3.dot(s.Vector3.normalize(e.up),t),a=Math.abs(n)>.98?s.Vector3.normalize(s.Vector3.scale(-n,e.viewVector)):e.up,i=s.Vector3.add(s.Vector3.scale(s.Vector3.distance(e.position,e.lookAt),s.Vector3.multiply(t,s.Vector3.create(-1,-1,-1))),e.lookAt);return e.update({up:a,position:i})}{const a=s.Vector3.angleTo(s.Vector3.normalize(e.viewVector),t),i=null!=n?s.BoundingBox.center(n):e.lookAt,o=s.Vector3.normalize(s.Vector3.cross(s.Vector3.normalize(e.viewVector),t));return e.rotateAroundAxisAtPoint(a,i,o)}};function isParallelTo(e,t){const n=s.Angle.toDegrees(s.Vector3.angleTo(e,t));return 0===n||180===n}const ee=500;function useCrossSectioningActions(){const e=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(M),n=await e.getPromise(I),i=await e.getPromise(O),s=await e.getPromise(V),o=await s();await(null==o?void 0:o.crossSectioning().update({sectionPlanes:i,highlightColor:n?a.Color.fromHexString(n):void 0,lineWidth:t}))})),t=useActionCallback((({set:t,reset:n,snapshot:a})=>async()=>{const i=await a.getPromise(V),s=await i();if(null!=s){const a=s.camera().viewAll();n(D),t(O,[towardsCamera(s.camera(),x(a.lookAt.x))]),await e()}})),n=useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async()=>{const a=await t.tryGetPromise(J).then((e=>e.value)),i=await t.getPromise(V),s=await i();if(null!=a&&null!=s){const t=fromHit(a,s.camera());n(O,null!=t?[t]:[]),n(D,null!=t?{x:t.normal}:A),await e()}}))),i=useActionCallback((({set:e,snapshot:n})=>async()=>{const a=await n.getPromise(O),i=undefined;await n.getPromise(R)||(e(R,!0),0===a.length&&await t())})),o=useActionCallback((({reset:t,snapshot:n})=>async()=>{const a=undefined;await n.getPromise(R)&&(t(R),t(W),t(G),t(K),t(O),t(N),t(_),await e())}));return{enable:i,disable:o,reapply:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(R)&&await e()})),openAdditionalTools:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=undefined;await t.getPromise(R)||await i(),e(W,!0)})),closeAdditionalTools:useActionCallback((({reset:e})=>()=>{e(W)})),openAlignmentTools:useActionCallback((({set:e,reset:t})=>()=>{t(K),e(G,!0)})),closeAlignmentTools:useActionCallback((({reset:e})=>()=>{e(G)})),openAxisTools:useActionCallback((({set:e,reset:t})=>()=>{t(G),e(K,!0)})),closeAxisTools:useActionCallback((({reset:e})=>()=>{e(K)})),beginInteraction:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(q);e(B,!0),await n.beginInteraction()})),endInteraction:useActionCallback((({reset:e,snapshot:t})=>async()=>{const n=await t.getPromise(q);e(B),await n.endInteraction()})),updatePlanes:useActionCallback(retainSnapshot((({set:t,snapshot:n})=>async a=>{const i=await n.getPromise(O);if(i.length>0){const s=await n.getPromise(H),o=await n.getPromise(F),l=s<0?-1*o.max:o.min,r=s<0?-1*o.min:o.max,c=i.map((e=>Object.assign(Object.assign({},e),{offset:Math.min(Math.max(a*s,l),r)})));t(O,c),await e()}}))),flipPlanes:useActionCallback((({set:t,snapshot:n})=>async()=>{const a=await n.getPromise(O);t(O,a.map((e=>invert(e)))),await e()})),alignViewToPlane:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(O),n=await e.getPromise(g),a=await(null==n?void 0:n.scene());t.length>0&&null!=a&&await alignToNormal(a.camera(),t[0].normal,a.boundingBox()).render({animation:{milliseconds:ee}})})),updateAxis:useActionCallback(retainSnapshot((({set:t,reset:n,snapshot:a})=>async i=>{const o=await a.getPromise(O),l=await a.getPromise(D),r=await a.getPromise(L),c=await a.getPromise(N),u=await a.getPromise(g),d=await(null==u?void 0:u.scene()),m=l[i],p=null!=m&&o.length>0&&isParallelTo(o[0].normal,m)&&!isNaN(s.Vector3.angleTo(o[0].normal,m));if(null!=d&&!p){const e=await a.tryGetPromise(J).then((e=>e.value));t(_,i),t(O,[toAxis(i,l,d.camera(),r,"global"!==c.mode?null==e?void 0:e.position:void 0)])}n(K),await e()}))),updateAlignment:useActionCallback((({set:e,reset:a})=>async(s,o)=>{a(G),e(N,{mode:s,hitPending:"global"!==s&&null==o}),"global"===s?(a(_),a(D),await t()):"surface"===s&&null!=o&&(await i(),await n())})),sectionCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(N);a.hitPending&&(e(N,Object.assign(Object.assign({},a),{hitPending:!1})),"surface"===a.mode&&await n())})),cancelCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(N);n.hitPending&&e(N,Object.assign(Object.assign({},n),{hitPending:!1}))}))}}var te=Object.freeze({__proto__:null,DEFAULT_ALIGN_TO_PLANE_ANIMATION_DURATION_MS:ee,DEFAULT_CROSS_SECTION_HIGHLIGHT_COLOR:T,DEFAULT_CROSS_SECTION_LINE_THICKNESS_VALUE:1,DEFAULT_SLIDER_RANGE:E,crossSectioningActiveAxis:_,crossSectioningAdditionalToolsOpen:W,crossSectioningAlignment:N,crossSectioningAlignmentToolsOpen:G,crossSectioningAvailableAxes:D,crossSectioningAxisToolsOpen:K,crossSectioningBorderWidth:M,crossSectioningEnabled:R,crossSectioningHighlightColor:I,crossSectioningInteractionHandler:q,crossSectioningIsInteractive:B,crossSectioningOffsetScalar:H,crossSectioningPlaneDisplayOffset:U,crossSectioningPlanes:O,crossSectioningSliderRange:F,crossSectioningTargetBoundingBox:L,useCrossSectioning:useCrossSectioning,useCrossSectioningActions:useCrossSectioningActions});function useDebouncedCallback(e,t){const[n,a]=i.useState();return i.useEffect((()=>()=>{null!=n&&clearTimeout(n)}),[e,t,n]),i.useCallback((i=>{const handler=()=>{e(i)};null!=n&&clearTimeout(n),a(setTimeout(handler,t))}),[e,t,n])}const VertexColorPicker=t=>{var{onInput:n}=t,a=__rest(t,["onInput"]);const s=useDebouncedCallback((e=>{null==n||n(e)}),500),l=i.useCallback((e=>{const t=e.target;s(t.value)}),[s]);return e.jsx(o.VertexColorPicker,Object.assign({onInput:l},a))},VertexCrossSectionAppearanceColorPicker=({onUpdate:t})=>{const a=useCrossSectioningActions(),[i,s]=n.useRecoilState(I);return e.jsx(VertexColorPicker,{"data-testid":"cross-section-highlight-color-picker",value:i,onValueChanged:e=>{null==t||t(e.detail)},onInput:async e=>{s(e),await a.reapply()}})},VertexSlider=t=>{var{value:n,defaultValue:a,leftLabel:s,rightLabel:r,onChange:c,onValueChange:u,onValueInput:d}=t,m=__rest(t,["value","defaultValue","leftLabel","rightLabel","onChange","onValueChange","onValueInput"]);const[p,g]=i.useState(a);return e.jsxs("div",{className:"flex w-full items-center gap-2",children:[s&&e.jsx("div",{className:"pl-0.5 text-xs text-center",children:s}),e.jsx(o.VertexSlider,Object.assign({className:l("w-full",{"mt-0.5":null!=s||null!=r}),value:null!=n?n:p,onValueChange:e=>{g(e.detail.value),null==c||c(e.detail.value),null==u||u(e)},onValueInput:e=>{g(e.detail.value),null==c||c(e.detail.value),null==d||d(e)}},m)),r&&e.jsx("div",{className:"text-xs pr-2 flex-shrink-0 text-right",children:r})]})},VertexCrossSectionAppearanceLineThicknessSlider=({onUpdate:t})=>{const a=useCrossSectioningActions(),[i,s]=n.useRecoilState(M);return e.jsx(VertexSlider,{id:"cross-section-line-thickness","data-testid":"cross-section-line-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:i,valueLabelDisplay:"auto",onValueInput:async e=>{s(e.detail.value),await a.reapply()},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexCrossSectionAppearanceControls({onUpdateCrossSectionColor:t,onUpdateCrossSectionLineThickness:n}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexCrossSectionAppearanceColorPicker,{onUpdate:t}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e.jsx(VertexCrossSectionAppearanceLineThicknessSlider,{onUpdate:n})]})}function PanelSection({header:t,children:n}){return e.jsxs("div",{className:"py-3 px-4 border-neutral-300 border-b",children:[e.jsx("div",{className:"my-2 text-base text-neutral-700",children:t}),n]})}const VertexCrossSectionAppearanceReset=({onReset:t})=>{const a=useCrossSectioningActions(),[i,s]=n.useRecoilState(I),[l,r]=n.useRecoilState(M),c=i!==T||1!==l;return e.jsx("div",{className:"ml-auto",children:e.jsx(o.VertexTooltip,{content:"Reset Cross Sectioning Appearance",children:e.jsx(o.VertexIconButton,{"data-testid":"cross-section-appearance-reset",iconName:"reset",iconSize:"sm",onClick:async()=>{s(T),r(1),null==t||t(),await a.reapply()},disabled:!c})})})};function VertexCrossSectionAppearancePanelSection({onResetCrossSectionAppearance:t,onUpdateCrossSectionColor:n,onUpdateCrossSectionLineThickness:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Cross Sectioning",e.jsx(VertexCrossSectionAppearanceReset,{onReset:t})]}),children:e.jsx(VertexCrossSectionAppearanceControls,{onUpdateCrossSectionColor:n,onUpdateCrossSectionLineThickness:a})})}const ne=.5,ae="#444444",ie=n.atom({key:"featureEdgesSelectedColor",default:ae}),se=n.atom({key:"featureEdgesLineThickness",default:ne}),VertexFeatureEdgesColorPicker=({onUpdate:t})=>{const[a,i]=n.useRecoilState(ie);return e.jsx(VertexColorPicker,{"data-testid":"feature-edges-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>i(e)})},VertexFeatureEdgesThicknessSlider=({onUpdate:t})=>{const[a,i]=n.useRecoilState(se);return e.jsx(VertexSlider,{id:"feature-edges-thickness","data-testid":"feature-edges-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:a,valueLabelDisplay:"auto",onValueInput:e=>{i(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexFeatureEdgesControls({onUpdateFeatureEdgesColor:t,onUpdateFeatureEdgesThickness:n}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexFeatureEdgesColorPicker,{onUpdate:t}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e.jsx(VertexFeatureEdgesThicknessSlider,{onUpdate:n})]})}const VertexFeatureEdgesReset=({onReset:t})=>{const[a,i]=n.useRecoilState(ie),[s,l]=n.useRecoilState(se),r=s!==ne||a!==ae;return e.jsx("div",{className:"ml-auto",children:e.jsx(o.VertexTooltip,{content:"Reset Feature Edges",children:e.jsx(o.VertexIconButton,{"data-testid":"feature-edges-reset",iconName:"reset",iconSize:"sm",onClick:()=>{i(ae),l(ne),null==t||t()},disabled:!r})})})};function VertexFeatureEdgesPanelSection({onResetFeatureEdges:t,onUpdateFeatureEdgesColor:n,onUpdateFeatureEdgesThickness:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Feature Edges",e.jsx(VertexFeatureEdgesReset,{onReset:t})]}),children:e.jsx(VertexFeatureEdgesControls,{onUpdateFeatureEdgesColor:n,onUpdateFeatureEdgesThickness:a})})}function contextMenuItemIsRow(e){var t;return null!=e&&null!=(null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.id)}const oe=n.atom({key:"contextMenuActive",default:void 0}),le=n.atom({key:"contextMenuPosition",default:void 0}),re=n.atom({key:"contextMenuTarget",default:void 0}),ce=n.atom({key:"contextMenuItem",default:void 0}),ue=n.atom({key:"contextMenuActions",default:[]}),de=n.selector({key:"contextMenuActivePosition",get:({get:e})=>null!=e(oe)?e(le):void 0});function useContextMenuActions(){return{pointerDown:useActionCallback((({set:e})=>async t=>{if(2===t.button){const n=t.clientX,a=null==t?void 0:t.clientY;e(le,s.Point.create(n,a)),e(re,t.target)}})),pointerUp:useActionCallback((({snapshot:e,set:t})=>async(n,a,i,o)=>{const l=await e.getPromise(le),r=await e.getPromise(oe);if(null!=l&&null==r){const e=n.clientX,r=null==n?void 0:n.clientY,c=s.Point.create(e,r),u=null!=l?s.Point.distance(l,c):0,d=null==i||i(n);u<2&&d&&(null==o||o(n,null!=l?l:c),t(oe,a))}})),contextMenu:useActionCallback((()=>(e,t)=>{(null==t||t(e))&&e.preventDefault()})),longPress:useActionCallback((({set:e})=>(t,n,a,i)=>{if(null==a||a(t)){const a=s.Point.create(t.touches[0].clientX,t.touches[0].clientY);e(le,a),e(re,t.target),e(oe,n),null==i||i(t,a)}})),clearActiveContextMenu:useActionCallback((({reset:e,set:t})=>n=>{t(Q,!!n),e(oe),e(ue),e(le)})),clearDismissedState:useActionCallback((({reset:e})=>()=>e(Q)))}}function targetWithinMenu(e){return e.target instanceof Element&&isChildOf("vertex-menu",e.target)}function targetShouldSkipNextHit(e){return e.target instanceof Element&&isChildOf("vertex-viewer",e.target)}function isChildOf(e,t){return null!=t.closest(e)}const me=n.atom({key:"boxSelectionEnabled",default:!1}),pe=n.atom({key:"boxSelectionOperationType",default:"clearAndSelect"}),useBoxSelectionActions=()=>({enable:useActionCallback((({set:e})=>()=>{e(me,!0)})),disable:useActionCallback((({reset:e})=>async()=>{e(me),e(pe)})),setOperationType:useActionCallback((({set:e})=>t=>{e(pe,t)}))});async function whenComponentReady(e,t){return null!=e&&null!=e.nodeName&&await customElements.whenDefined(e.nodeName.toLowerCase()),"function"==typeof(null==e?void 0:e.componentOnReady)?(await(null==e?void 0:e.componentOnReady()),t()):void 0}const xe=n.atom({key:"isEditingPointToPointMeasurement",default:!1}),ge=n.atom({key:"pointToPointMeasurementOutcome",default:void 0}),he=n.atom({key:"editedPointToPointMeasurement",default:void 0});function usePointToPointMeasurement(e){const t=n.useSetRecoilState(ge);i.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onOutcomeChanged(t)})),()=>null==n?void 0:n.dispose()}),[e,t])}const fe=2,ve=n.atom({key:"isEditingPreciseMeasurement",default:!1}),ye=n.atom({key:"preciseMeasurementOutcome",default:void 0}),be=n.atom({key:"preciseMeasurementController",dangerouslyAllowMutability:!0,default:void 0}),Ve=n.atom({key:"preciseMeasurementOverlays",dangerouslyAllowMutability:!0,default:void 0}),Se=n.atom({key:"preciseMeasurementEntities",dangerouslyAllowMutability:!0,default:[]}),we=n.selector({key:"preciseMeasurementMessage",get:({get:e})=>{const t=undefined;return 0===e(Se).length?"Select a surface":void 0}});function usePreciseMeasurementModel(e,t,a){const s=n.useSetRecoilState(Se),o=n.useSetRecoilState(ye),l=n.useSetRecoilState(be),r=n.useSetRecoilState(Ve),c=n.useRecoilValue(be);i.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{s(e),null==t||t(e)}))})),()=>null==n?void 0:n.dispose()}),[e,s]),i.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onOutcomeChanged((e=>{o(e),null==a||a(e)}))})),()=>null==t?void 0:t.dispose()}),[e,o]),i.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{if(e.length>2){const t=e[2];null==c||c.setEntities(new Set([t]))}}))})),()=>null==t?void 0:t.dispose()}),[e,c]),i.useEffect((()=>{whenComponentReady(e,(()=>{l(null==e?void 0:e.measurementController)}))}),[e,l]),i.useEffect((()=>{whenComponentReady(e,(()=>{r(null==e?void 0:e.measurementOverlays)}))}),[e,r])}function useMeasurementActions(){const e=useBoxSelectionActions(),t=useEnablePointToPointMeasurement(),n=useDisablePointToPointMeasurement(),a=useDisablePreciseMeasurement(),i=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(be);null==t||t.clearEntities()})),s=useActionCallback((()=>async(e={})=>{await i(),n(e),a()})),o=useActionCallback((({set:e,reset:n})=>async a=>{await s(),"point-to-point"===a?t():(n(ye),n(Se),e(ve,!0))}));return{disableEditMeasurement:useActionCallback((()=>async e=>{await s(e)})),enableEditMeasurement:useActionCallback((()=>async e=>{await o(e)})),resetMeasurement:useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(ve),a=await e.getPromise(xe);n?await i():a&&(t(ge),t(he))})),clearEditedPointToPointMeasurement:useActionCallback((({reset:e})=>()=>{e(he)})),setEditedPointToPointMeasurement:useActionCallback((({set:e})=>t=>{e(he,t)})),toggleEditPointToPointMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(xe)?await s():await o("point-to-point"),e.disable()})),toggleEditPreciseMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(ve)?await s():await o("precise"),e.disable()}))}}function useEnablePointToPointMeasurement(){return useActionCallback((({reset:e,set:t})=>(n={})=>{t(xe,!0),n.keepExistingMeasurement||e(ge)}))}function useDisablePointToPointMeasurement(){return useActionCallback((({reset:e})=>(t={})=>{e(xe),t.keepExistingMeasurement||(e(he),e(ge))}))}function useDisablePreciseMeasurement(){return useActionCallback((({reset:e})=>async()=>{e(ve),e(ye),e(Se)}))}const Ce=n.selector({key:"isEditingMeasurement",get:({get:e})=>e(xe)||e(ve)}),je=n.selector({key:"measurementPanelModel",get:({get:e})=>e(ge)||e(ye)}),ke=n.selector({key:"measurementPanelOverlays",dangerouslyAllowMutability:!0,get:({get:e})=>e(Ve)}),Ae=n.selector({key:"measurementPanelMessage",get:({get:e})=>{const t=undefined;return e(ve)?e(we):void 0}}),Te=n.selector({key:"measurementPanelIsResettable",get:({get:e})=>e(Ce)&&null!=e(je)}),Pe=3e3,Ee=n.atom({key:"applicationMessageToast",default:void 0}),Re=n.atom({key:"applicationMessageBanner",default:void 0}),useApplicationMessageActions=()=>({setBannerMessage:useActionCallback((({set:e})=>t=>{e(Re,null!=t?Object.assign(Object.assign({},t),{id:a.UUID.create()}):void 0)})),setToastMessage:useActionCallback((({set:e})=>t=>{e(Ee,null!=t?Object.assign(Object.assign({},t),{id:a.UUID.create()}):void 0)}))});var Ie;!function(e){e.HIDE_ITEM="Hide Item",e.SHOW_ONLY_SELECTED="Show Only Selected",e.HIDE_SELECTED="Hide Selected",e.SHOW_ONLY_ITEM="Show Only Item",e.SHOW_ALL="Show All",e.HIDE_ALL="Hide All",e.SELECT_FILTERED_ITEMS="Select Filtered Items",e.INVERT_SELECTION="Invert Selection",e.CLEAR_ALL_TRANSFORMS="Clear All Transforms",e.CLEAR_SELECTED_TRANSFORMS="Clear Selected Transforms",e.CLEAR_SELECTION="Clear Selection",e.DESELECTING_ITEMS="Deselecting Items",e.SELECTING_ITEMS="Selecting Items",e.SELECTING_ONLY_ITEM="Selecting Only Item",e.SELECTING_ANCESTOR="Selecting Ancestor",e.APPLY_MATERIAL_OVERRIDE_TO_ALL="Apply Material Override To All",e.APPLY_MATERIAL_OVERRIDE_TO_SELECTION="Apply Material Override To Selection",e.CLEAR_ALL_MATERIAL_OVERRIDES="Clear All Material Overrides",e.CLEAR_SELECTED_MATERIAL_OVERRIDES="Clear Selected Material Overrides",e.SET_PHANTOM_ALL="Set Phantom All",e.SET_PHANTOM_SELECTED_ITEMS="Set Phantom Selected Items",e.CLEAR_PHANTOM_ALL="Clear Phantom All",e.CLEAR_PHANTOM_SELECTED_ITEMS="Clear Phantom Selected Items",e.SET_PHANTOM_NON_SELECTED_ITEMS="Set Phantom Non Selected Items",e.RESTORE_PHANTOM_OVERRIDES="Restore Phantom Overrides",e.SET_ITEM_AS_END_ITEM="Set Item as End Item",e.UNSET_ITEM_AS_END_ITEM="Unset Item as End Item",e.SHOW_ANNOTATION="Show Annotation",e.HIDE_ANNOTATION="Hide Annotation"}(Ie||(Ie={}));const Me=n.atomFamily({key:"selectionSelectedItems",default:void 0}),Oe=n.atom({key:"selectionSelectedItemIds",default:[]}),Ne=n.atom({key:"selectionLastSelected",default:void 0}),Le=n.atom({key:"selectionLastSelectionFromViewer",default:!1}),Be=n.atom({key:"selectionLastSelectWasMultiSelect",default:!1}),_e=n.selector({key:"selectionHighestSelectedAncestor",get:({get:e})=>{var t,n;const a=e(Ne),i=e(Oe);return null!==(n=null===(t=null==a?void 0:a.ancestors)||void 0===t?void 0:t.find((e=>i.includes(e))))&&void 0!==n?n:null==a?void 0:a.id}}),De=n.atom({key:"selectionPreviousVisibleSummary",default:void 0}),He=n.atom({key:"selectionVisibleSummary",default:void 0}),Fe=n.selector({key:"selectionVisibleCount",get:({get:e})=>{var t,n;return null!==(n=null===(t=e(He))||void 0===t?void 0:t.count)&&void 0!==n?n:0}}),ze=n.selector({key:"selectionBoundingBoxCenter",get:({get:e})=>{const t=e(He);return null!=(null==t?void 0:t.boundingBox)?s.BoundingBox.center(t.boundingBox):s.Vector3.origin()}}),Ue=n.selector({key:"selectionIsActive",get:({get:e})=>{const t=e(Oe),n=undefined;return e(Fe)>0||t.length>0}}),We=n.atom({key:"transformWidgetEnabled",default:!1}),Ge=n.atom({key:"transformWidgetPosition",default:void 0}),Ke=n.atom({key:"transformWidgetOrientationOverride",default:void 0}),qe=n.selector({key:"transformWidgetOrientation",get:({get:e})=>{const t=e(Ke);if(null!=t)return t}}),$e=n.atom({key:"transformWidgetCachedOrientation",default:void 0}),Ye=n.atom({key:"transformWidgetSyncToSelection",default:!1}),Xe=n.atom({key:"transformWidgetIsInteracting",default:!1}),Ze=n.atomFamily({key:"appliedItemTransform",default:void 0}),Je=n.atom({key:"appliedItemTransformIds",default:[]}),Qe=n.atom({key:"selectedCoordinateSpace",default:"world"}),useTransformActions=()=>{const e=useApplicationMessageActions(),t=useViewerSceneActions(),n=useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(ze);e(Ge,n)})),a=useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(Ge),i=await t.getPromise(Be),s=await t.getPromise(Oe),o=await t.getPromise(Fe);null==a&&(s.length>0||i||o>0)&&await n(),e(Ye,!0)})),i=useActionCallback((({set:e})=>async t=>{e(Ge,null!=t?t:void 0)})),o=useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async()=>{const a=await e.getPromise(qe),i=undefined;(await e.getPromise(Je)).forEach((e=>{n(Ze(e))})),null!=a&&t($e,a)}))),l=useActionCallback((({set:e,reset:t})=>n=>{t($e),e(Ke,n)}));return{enableTransformWidget:useActionCallback((({set:t})=>async(s,o)=>{e.setToastMessage({message:"Transform manipulator enabled! Select parts to interact.",duration:Pe}),t(We,!0),o?await n():null==s?await a():await i(s)})),disableTransformWidget:useActionCallback((({reset:e})=>()=>{e(We),e(Ke)})),setTransformWidgetOrientation:l,clearTransformWidgetOrientation:useActionCallback((({reset:e})=>()=>{e($e),e(Ke)})),setTransformWidgetPosition:i,clearTransformWidgetPosition:useActionCallback((({reset:e})=>()=>e(Ge))),invalidateTransforms:o,setIsInteractivelyTransforming:useActionCallback((({set:e})=>t=>{e(Xe,t)})),setDefaultWidgetPosition:a,setDefaultWidgetPositionToSelection:n,enableSelectionSync:useActionCallback((({set:e})=>()=>e(Ye,!0))),disableSelectionSync:useActionCallback((({reset:e})=>()=>e(Ye))),syncToSelection:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(De),n=await e.getPromise(He),a=undefined;if(await e.getPromise(Ye)){const e=null==n?void 0:n.boundingBox,a=null!=e&&null!=(null==t?void 0:t.boundingBox)&&equals(e,t.boundingBox);null==e||a||await i(s.BoundingBox.center(e))}})),orientToHitResult:useActionCallback((({reset:e})=>async t=>{e(Ye),null!=t?(await i(null==t?void 0:t.position),l(s.Vector3.eulerTo(s.Vector3.up(),t.normal))):(e(Ge),l(void 0))})),clearSelectedTransforms:useActionCallback((({set:e})=>async()=>{await t.execute(Ie.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.withSelected())).clearTransforms())),e(Ge,void 0),e(We,!1)})),clearAllTransforms:useActionCallback((({set:e})=>async()=>{await t.execute(Ie.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.all())).clearTransforms())),e(Ge,void 0),e(We,!1)}))}},useHitActions=()=>{const e=useCrossSectioningActions(),t=useMeasurementActions(),n=useTransformActions(),a=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const n=await e.tryGetPromise(J).then((e=>e.value)),a=await e.getPromise(he);null==n&&null!=(null==a?void 0:a.start)&&null!=a.end&&await t.resetMeasurement()}))),i=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(J).then((e=>e.value));await n.orientToHitResult(t)}))),s=useActionCallback(retainSnapshot((({set:e,snapshot:t})=>async()=>{const n=await t.tryGetPromise(J).then((e=>e.value));e(ce,n)}))),o=useActionCallback(retainSnapshot((({snapshot:e,set:t})=>async()=>{t(Z,await e.tryGetPromise(J).then((e=>e.value)))})));return{tap:useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async({detail:l},...r)=>{const c=await t.getPromise(Ce),u=await t.getPromise(N),d=2!==(null==l?void 0:l.buttons)&&!(null==l?void 0:l.altKey);l.altKey||l.ctrlKey||l.metaKey||l.shiftKey;const m=d&&!u.hitPending&&!c,p=await t.tryGetPromise(J).then((e=>e.value));n(X,p),n($,l),await a(),m&&(r.forEach((e=>e())),await i()),await s(),await e.sectionCurrentHit(),await o()}))),longPress:useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async a=>{n($),t(Y,a.detail),await e.tryGetPromise(J),await s(),await o()})))}},et=n.selector({key:"viewerToolkitHitState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,i=undefined,s=undefined;return{tapDetails:e($),longPressDetails:e(Y),previousHitResult:e(X),currentHitResult:e(Z)}}});var tt=Object.freeze({__proto__:null,currentHitResult:Z,hitResult:J,hitResultsLongPressDetails:Y,hitResultsSkipNextTap:Q,hitResultsTapDetails:$,hitState:et,previousHitResult:X,useHitActions:useHitActions});function useSelectionActions(){const e=useTransformActions(),t=useViewerSceneActions(),n=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(Oe)).forEach((e=>t(Me(e))))})),a=useActionCallback((({snapshot:e,reset:n,set:a})=>async(i,s)=>{var o,l;const r=await e.getPromise(Me(i.id)),c=await e.getPromise(Oe),d=null===(l=[...null!==(o=i.ancestors)&&void 0!==o?o:[]])||void 0===l?void 0:l.reverse().find((e=>!c.includes(e)));null!=r&&null!=d?(a(Me(d),{id:d}),a(Oe,(e=>[...e,d])),t.execute(Ie.SELECTING_ANCESTOR,t.selectItemsTransform(d))):(null==s?void 0:s.clear)?(a(Me(i.id),i),a(Oe,[i.id]),t.execute(Ie.SELECTING_ONLY_ITEM,t.clearSelectionTransform,t.selectItemsTransform(i.id))):(a(Me(i.id),i),a(Oe,(e=>[...e,i.id])),t.execute(Ie.SELECTING_ITEMS,t.selectItemsTransform(i.id))),u(i),a(Ne,i),a(Le,!0),n(Be)})),i=useActionCallback((({reset:e,set:n})=>async a=>{e(Me(a)),e(Be),n(Oe,(e=>e.filter((e=>e!==a)))),t.execute(Ie.DESELECTING_ITEMS,t.deselectItemsTransform(a))})),s=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(Me(t.id));null!=n?await i(n.id):await a(t)})),o=useActionCallback((({snapshot:t,reset:n,set:i})=>async(s,o={})=>{const l=await t.getPromise(Me(s.id)),r=await t.getPromise(Oe);if(r.filter((e=>{var t;return e!==s.id&&!(null===(t=s.ancestors)||void 0===t?void 0:t.includes(e))})).forEach((e=>n(Me(e)))),n(Be),l)if(o.ignoreAncestorSelection)n(Oe),n(Me(l.id));else{const e=r.filter((e=>{var t;return e===s.id||(null===(t=s.ancestors)||void 0===t?void 0:t.includes(e))}));i(Oe,e)}else n(Oe);e.clearTransformWidgetOrientation(),await a(s,{clear:!0})})),l=useActionCallback((({reset:t})=>async()=>{await n(),t(Oe),t(Ne),t(Le),t(Be),e.clearTransformWidgetPosition(),e.clearTransformWidgetOrientation()})),r=useActionCallback((()=>async()=>{await l(),t.execute(Ie.CLEAR_SELECTION,t.clearSelectionTransform)})),c=useActionCallback((({set:e})=>async t=>{e(Be,t)})),u=useActionCallback((({reset:e,set:t})=>e=>{}));return{select:a,toggleSelection:s,clearAndSelect:o,selectCurrentHit:useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(J).then((e=>e.value)),n=await e.getPromise($),a=(null==n?void 0:n.metaKey)||(null==n?void 0:n.ctrlKey)||(null==n?void 0:n.shiftKey);null==t||a?null!=t&&a?await s(t):await r():await o(t)}))),syncSelection:useActionCallback((({set:e,reset:t})=>async(a,i)=>{i.selected?(await n(),e(Me(a.id),a),i.multiSelect?e(Oe,(e=>[...e.filter((e=>e!==a.id)),a.id])):e(Oe,[a.id]),u(a),e(Ne,a),e(Le,!1),e(Be,!!i.multiSelect)):(t(Me(a.id)),t(Be),e(Oe,(e=>e.filter((e=>e!==a.id)))))})),deselect:i,clearSelection:r,resetSelectionState:l,toggleLastSelectWasMultiSelect:c,selectForModelViewsPanel:u}}const nt=n.selector({key:"viewerToolkitSelectionState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,i=undefined;return{selectedItemIds:e(Oe),lastSelected:e(Ne),highestSelectedAncestorId:e(_e)}}});var at=Object.freeze({__proto__:null,selectionBoundingBoxCenter:ze,selectionHighestSelectedAncestor:_e,selectionIsActive:Ue,selectionLastSelectWasMultiSelect:Be,selectionLastSelected:Ne,selectionLastSelectionFromViewer:Le,selectionPreviousVisibleSummary:De,selectionSelectedItemIds:Oe,selectionSelectedItems:Me,selectionState:nt,selectionVisibleCount:Fe,selectionVisibleSummary:He,useSelectionActions:useSelectionActions});const it=255,st=n.atom({key:"sceneItemAdjustmentsSelectedColor",default:void 0}),ot=n.atom({key:"sceneItemAdjustmentsSelectedOpacity",default:void 0}),lt=n.atomFamily({key:"appliedItemMaterialOverride",default:void 0}),rt=n.atom({key:"appliedItemMaterialOverrideIds",default:[]}),ct=n.selector({key:"sceneItemAdjustmentsLastSelectedOverride",get:({get:e})=>{const t=e(Ne);if(null!=t)return e(lt(t.id))}}),ut=n.atom({key:"applyMaterialToAllUserAction",default:void 0}),dt=n.atom({key:"showConfirmDialogWhenApplyingMaterialToAll",default:!0}),mt=n.atom({key:"confirmApplyMaterialToAllDialogOpen",default:!1}),useSceneItemMaterialActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(rt);t(st),n.forEach((e=>t(lt(e)))),t(rt)}));return{updateColor:useActionCallback((({set:e})=>t=>{e(st,t)})),clearCurrentColor:useActionCallback((({reset:e})=>()=>{e(st)})),clearCurrentOpacity:useActionCallback((({reset:e})=>()=>{e(ot)})),clear:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const i=await t.getPromise(Oe);a(st),i.forEach((e=>a(lt(e)))),n(rt,(e=>e.filter((e=>!i.includes(e))))),await e.execute(Ie.CLEAR_SELECTED_MATERIAL_OVERRIDES,(e=>e.where((e=>e.withSelected())).clearMaterialOverrides().select()))})),clearAll:useActionCallback((()=>async()=>{await t(),await e.execute(Ie.CLEAR_ALL_MATERIAL_OVERRIDES,(e=>e.where((e=>e.all())).clearMaterialOverrides()),(e=>e.where((e=>e.withSelected())).select()))})),clearState:t,updateOpacity:useActionCallback((({set:e})=>t=>{e(ot,t)})),apply:useActionCallback((({snapshot:t,set:n})=>async()=>{const a=await t.getPromise(st),i=await t.getPromise(ot),s=await t.getPromise(Oe),o=await t.getPromise(ct),l=null!=a?a:o,r=null!=i?i:null==o?void 0:o.opacity;if(null!=l){const t=Object.assign(Object.assign({},l),{opacity:null!=r?r:l.opacity});await e.execute(Ie.APPLY_MATERIAL_OVERRIDE_TO_SELECTION,(e=>e.where((e=>e.withSelected())).materialOverride(t))),s.forEach((e=>n(lt(e),t))),n(rt,(e=>[...e,...s]))}})),confirmApplyAll:useActionCallback((({set:e})=>t=>{e(mt,!0),e(ut,(()=>t))})),cancelApplyAll:useActionCallback((({reset:e})=>()=>{e(mt),e(ut)})),applyAll:useActionCallback((({snapshot:t,reset:n})=>async()=>{const a=await t.getPromise(st),i=await t.getPromise(ot);if(null!=a){const s=await t.getPromise(rt),o=Object.assign(Object.assign({},a),{opacity:null!=i?i:a.opacity});await e.execute(Ie.APPLY_MATERIAL_OVERRIDE_TO_ALL,(e=>e.where((e=>e.all())).materialOverride(o))),s.forEach((e=>n(lt(e))));const l=await t.getPromise(ut);null==l||l(o),n(mt),n(ut)}})),hideConfirmApplyAllDialog:useActionCallback((({set:e})=>()=>{e(dt,!1)}))}},pt="#FFFFFF",xt=n.atom({key:"viewerBackgroundSelectedColor",default:pt}),VertexSceneItemMaterialApplyAll=({onApplyAll:t})=>{const a=useSceneItemMaterialActions(),i=n.useRecoilValueLoadable(ct),s=n.useRecoilValue(st),l=n.useRecoilValue(dt),r=m.useMemo((()=>"hasValue"===i.state?null!=s?s:i.contents:s),[i,s]);return e.jsx(o.VertexTooltip,{content:"Apply to All",children:e.jsx(o.VertexIconButton,{iconName:"square-dot-outline",iconSize:"sm",color:"secondary",disabled:null==r,onClick:async()=>{l?a.confirmApplyAll(t):(await a.applyAll(),null==t||t(r))}})})};function SceneItemMaterialApplyAllConfirmationDialog(){const t=useSceneItemMaterialActions(),a=n.useRecoilValue(mt),[s,l]=i.useState(!1),onCloseDialog=()=>{t.cancelApplyAll(),l(!1)};return a?e.jsxs(o.VertexDialog,{open:!0,className:"text-sm",onClosed:onCloseDialog,onBackdropClick:onCloseDialog,children:[e.jsx("div",{slot:"heading",children:"Apply to All Parts"}),e.jsx("div",{className:"max-w-lg break-words pr-2",children:"This will apply the same material to all parts in the model. Any previous material changes will be lost."}),e.jsxs("div",{className:"flex mt-8 gap-2 items-center",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(o.VertexToggle,{"data-testid":"hide-confirmation-dialog-in-future-checkbox",variant:"check",className:"pt-0.5",checked:s,onValueChanged:e=>{l(e.detail)}}),"Don't show again this session"]}),e.jsxs("div",{className:"flex ml-auto gap-2",children:[e.jsx(o.VertexButton,{"data-testid":"cancel-apply-material-to-all",onClick:onCloseDialog,children:"Cancel"}),e.jsx(o.VertexButton,{color:"primary","data-testid":"confirm-apply-material-to-all",onClick:async()=>{await t.applyAll(),s&&t.hideConfirmApplyAllDialog()},children:"Apply"})]})]})]}):e.jsx(e.Fragment,{})}function createColorMaterialWithId(e,t=a.UUID.create()){return Object.assign({id:t},r.ColorMaterial.fromHex(e))}const VertexSceneItemMaterialColorPicker=({onApply:t})=>{const i=useSceneItemMaterialActions(),s=n.useRecoilValueLoadable(ct),o=n.useRecoilValue(st),l=m.useMemo((()=>"hasValue"===s.state?null!=o?o:s.contents:o),[s,o]);return e.jsx(VertexColorPicker,{"data-testid":"selected-item-color-picker",value:null!=l?a.Color.toHexString(l.diffuse):void 0,onValueChanged:()=>{i.apply(),null==t||t(l)},onInput:async e=>{i.updateColor(createColorMaterialWithId(e)),await i.apply()}})},VertexSceneItemMaterialOpacitySlider=({onApply:t})=>{const a=useSceneItemMaterialActions(),i=n.useRecoilValue(ot),s=n.useRecoilValueLoadable(ct),l=m.useMemo((()=>{var e,t;return"hasValue"===s.state?null!==(t=null!=i?i:null===(e=s.contents)||void 0===e?void 0:e.opacity)&&void 0!==t?t:it:null!=i?i:it}),[i,s]),r=useDebouncedCallback((()=>{a.apply()}),500),c=m.useCallback((e=>{a.updateOpacity(e.detail.value),r(e.detail.value)}),[r,a]),u=m.useMemo((()=>"hasValue"!==s.state||null==s.contents),[s]);return e.jsx(o.VertexTooltip,{className:"flex w-full",content:u?"Select a part and apply a color to enable opacity":`${Math.floor(l/it*100)}%`,placement:"top",children:e.jsx(VertexSlider,{"data-testid":"scene-item-adjustments-opacity-slider",leftLabel:"0%",rightLabel:"100%",disabled:u,value:null!=l?l:it,step:5,min:0,max:it,onValueChange:e=>{a.updateOpacity(e.detail.value),a.apply(),null==t||t(e.detail.value)},onValueInput:c})})};function VertexMaterialControls({onApplyMaterial:t,onApplyMaterialToAll:a,onApplyOpacity:s}){const o=useSceneItemMaterialActions(),l=n.useRecoilValue(Ne);return i.useEffect((()=>{o.clearCurrentColor(),o.clearCurrentOpacity()}),[null==l?void 0:l.id]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(VertexSceneItemMaterialColorPicker,{onApply:t}),e.jsx(VertexSceneItemMaterialApplyAll,{onApplyAll:a})]})]}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e.jsx(VertexSceneItemMaterialOpacitySlider,{onApply:s}),e.jsx(SceneItemMaterialApplyAllConfirmationDialog,{})]})}const ResetButton=({id:t,tooltip:n,children:a})=>{const[s,r]=i.useState(!1);return e.jsx("div",{className:"ml-auto",children:e.jsxs(o.VertexDropdownMenu,{className:"flex items-stretch h-full","data-testid":`reset-button-dropdown-menu-${t}`,placement:"bottom-end",onMenuOpened:()=>r(!0),onMenuClosed:()=>r(!1),children:[e.jsx("div",{slot:"anchor",className:"flex items-center h-full",children:e.jsx(o.VertexTooltip,{content:n,disabled:s,placement:"bottom",children:e.jsxs(o.VertexButton,{className:l("p-1.5 rounded-md select-none hover:bg-neutral-300 active:bg-neutral-400 cursor-pointer",{"bg-neutral-300":s}),"data-testid":`reset-button-${t}`,variant:"plaintext",children:[e.jsx(o.VertexIcon,{className:"px-0.5",name:"reset",size:"sm"}),e.jsx(o.VertexIcon,{name:"chevron-down",size:"sm"})]})})}),e.jsx("div",{className:"whitespace-nowrap",children:a})]})})},VertexSceneItemMaterialClear=({onClear:t,onClearAll:a})=>{const i=useSceneItemMaterialActions(),s=n.useRecoilValue(Ue);return e.jsx("div",{className:"ml-auto",children:e.jsxs(ResetButton,{id:"materials",tooltip:"Clear Materials",children:[e.jsx("div",{className:"pt-1"}),e.jsx(o.VertexMenuItem,{"data-testid":"clear-selected-materials",onClick:()=>{i.clear(),null==t||t()},disabled:!s,children:"Clear selected materials"}),e.jsx(o.VertexMenuItem,{"data-testid":"clear-all-materials",onClick:()=>{i.clearAll(),null==a||a()},children:"Clear all materials"})]})})};function VertexMaterialPanelSection({onClearMaterial:t,onClearAllMaterials:n,onApplyMaterial:a,onApplyMaterialToAll:i,onApplyOpacity:s}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Material",e.jsx(VertexSceneItemMaterialClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexMaterialControls,{onApplyMaterial:a,onApplyMaterialToAll:i,onApplyOpacity:s})})}const gt="#ffff00",ht=35,ft=1,vt=n.atom({key:"selectionHighlightingSelectedColor",default:gt}),yt=n.atom({key:"selectionHighlightingSelectedOpacity",default:ht}),bt=n.atom({key:"selectionHighlightingSelectedLineThickness",default:1}),VertexSelectionHighlightingColorPicker=({onUpdate:t})=>{const[a,i]=n.useRecoilState(vt);return e.jsx(VertexColorPicker,{"data-testid":"selection-highlighting-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>i(e)})},VertexSelectionHighlightingLineThicknessSlider=({onUpdate:t})=>{const[a,i]=n.useRecoilState(bt);return e.jsx(VertexSlider,{id:"selection-highlighting-line-thickness","data-testid":"selection-highlighting-line-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:a,valueLabelDisplay:"auto",onValueInput:e=>{i(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},VertexSelectionHighlightingOpacitySlider=({onUpdate:t})=>{const[a,i]=n.useRecoilState(yt);return e.jsx(VertexSlider,{id:"selection-highlighting-opacity","data-testid":"selection-highlighting-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:a,valueLabelDisplay:"auto",onValueInput:e=>{i(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexSelectionHighlightingControls({onUpdateSelectionHighlightColor:t,onUpdateSelectionHighlightOpacity:n,onUpdateSelectionHighlightLineThickness:a}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexSelectionHighlightingColorPicker,{onUpdate:t}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e.jsx(VertexSelectionHighlightingOpacitySlider,{onUpdate:n}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e.jsx(VertexSelectionHighlightingLineThicknessSlider,{onUpdate:a})]})}const VertexSelectionHighlightingReset=({onReset:t})=>{const[a,i]=n.useRecoilState(vt),[s,l]=n.useRecoilState(yt),[r,c]=n.useRecoilState(bt),u=a!==gt||s!==ht||1!==r;return e.jsx("div",{className:"ml-auto",children:e.jsx(o.VertexTooltip,{content:"Reset Selection Highlighting",children:e.jsx(o.VertexIconButton,{"data-testid":"selection-highlighting-reset",iconName:"reset",iconSize:"sm",onClick:()=>{i(gt),l(ht),c(1),null==t||t()},disabled:!u})})})};function VertexSelectionHighlightingPanelSection({onResetSelectionHighlighting:t,onUpdateSelectionHighlightColor:n,onUpdateSelectionHighlightOpacity:a,onUpdateSelectionHighlightLineThickness:i}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Selection Highlighting",e.jsx(VertexSelectionHighlightingReset,{onReset:t})]}),children:e.jsx(VertexSelectionHighlightingControls,{onUpdateSelectionHighlightColor:n,onUpdateSelectionHighlightOpacity:a,onUpdateSelectionHighlightLineThickness:i})})}const VertexViewerBackgroundColorPicker=({onUpdate:t})=>{const[a,i]=n.useRecoilState(xt);return e.jsx(VertexColorPicker,{"data-testid":"viewer-background-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>i(e)})};function VertexViewerBackgroundControls({onUpdateViewerBackgroundColor:t}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexViewerBackgroundColorPicker,{onUpdate:t})]})}const VertexViewerBackgroundReset=({onReset:t})=>{const[a,i]=n.useRecoilState(xt),s=a!==pt;return e.jsx("div",{className:"ml-auto",children:e.jsx(o.VertexTooltip,{content:"Reset Background Color",children:e.jsx(o.VertexIconButton,{"data-testid":"viewer-background-reset",iconName:"reset",iconSize:"sm",onClick:()=>{i(pt),null==t||t()},disabled:!s})})})};function VertexViewerBackgroundPanelSection({onResetViewerBackgroundColor:t,onUpdateViewerBackgroundColor:n}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Viewer Background",e.jsx(VertexViewerBackgroundReset,{onReset:t})]}),children:e.jsx(VertexViewerBackgroundControls,{onUpdateViewerBackgroundColor:n})})}const isInputElement=e=>{const t=e instanceof HTMLElement&&"VERTEX-AUTO-RESIZE-TEXTAREA"===e.tagName,n=e instanceof HTMLElement&&"VERTEX-TEXTFIELD"===e.tagName,a=e instanceof HTMLElement&&"true"===e.contentEditable,i=e instanceof HTMLElement&&"VERTEX-SCENE-TREE-SEARCH"===e.tagName,s=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement,o=e instanceof HTMLElement&&"VERTEX-VIEWER-PIN-TOOL"===e.tagName,l=e instanceof HTMLElement&&"VERTEX-VIEWER-TRANSFORM-WIDGET"===e.tagName;return t||n||a||i||s||o||l},useRecoilReducer=({reducer:e,atom:t})=>{const a=undefined,i=undefined;return[n.useRecoilValue(t),useRecoilReducerDispatch({reducer:e,atom:t})]},useRecoilReducerDispatch=({reducer:e,atom:t})=>{const a=undefined;return n.useRecoilCallback((({set:n})=>async a=>{n(t,(t=>e(t,a)))}),[])},Vt=n.atom({key:"keyBindings",default:{applyBindings:[],bindings:{},pressed:{}}});function reducer(e,t){var n,a,i,s;switch(t.type){case"push-key-binding":const o=undefined;return null!=(null===(n=e.bindings[t.binding.keyBind])||void 0===n?void 0:n.find((e=>e.id===t.binding.id)))?e:Object.assign(Object.assign({},e),{bindings:Object.assign(Object.assign({},e.bindings),{[t.binding.keyBind]:[...null!==(a=e.bindings[t.binding.keyBind])&&void 0!==a?a:[],t.binding]})});case"remove-key-binding":const l=undefined;return null==(null===(i=e.bindings[t.binding.keyBind])||void 0===i?void 0:i.find((e=>e.id===t.binding.id)))?e:Object.assign(Object.assign({},e),{bindings:Object.assign(Object.assign({},e.bindings),{[t.binding.keyBind]:(null!==(s=e.bindings[t.binding.keyBind])&&void 0!==s?s:[]).filter((e=>e.id!==t.binding.id))})});case"add-apply-key-binding":return Object.assign(Object.assign({},e),{applyBindings:[...e.applyBindings,t.binding]});case"remove-apply-key-binding":return Object.assign(Object.assign({},e),{applyBindings:e.applyBindings.filter((e=>e.id!==t.id))});case"set-key-pressed":return Object.assign(Object.assign({},e),{applyBindings:e.applyBindings.map((t=>Object.assign(Object.assign({},t),{active:null!=t.keyBind&&allPressed(t.keyBind,e.pressed)}))),pressed:Object.assign(Object.assign({},e.pressed),{[t.key]:t.pressed}),lastPressed:t.pressed?t.key:void 0})}}const useKeyBindingState=()=>useRecoilReducer({reducer:reducer,atom:Vt});function pressedValue(e,t){return e.includes("!")?!t[e.replace("!","")]&&!t[e.replace("!","").toLowerCase()]:t[e]||t[e.toLowerCase()]}function isPressed(e,t){const n=e.split("||");return n.length>1?n.some((e=>pressedValue(e,t))):pressedValue(n[0],t)}function allPressed(e,t){const n=undefined;return e.split("+").every((e=>isPressed(e,t)))}function matchingSingleFnBindings(e,t,n){return e.filter((e=>!e.repeat)).filter((e=>{var a;return null!=e.keyBind&&null!=n&&(null===(a=e.keyBind)||void 0===a?void 0:a.includes(n))&&allPressed(e.keyBind,t)})).map((e=>e.fn))}function matchingOffBindings(e,t,n){return e.filter((e=>e.off&&e.active&&null!=e.keyBind&&null==n&&!allPressed(e.keyBind,t))).map((e=>e.off))}const useApplyKeyBinding=e=>{const[t,n]=useKeyBindingState();i.useEffect((()=>{const i=a.UUID.create();return n({type:"add-apply-key-binding",binding:Object.assign(Object.assign({},e),{id:i,active:null!=e.keyBind&&allPressed(e.keyBind,t.pressed)})}),()=>{n({type:"remove-apply-key-binding",id:i})}}),[e.fn,e.off,e.keyBind,e.repeat])},useStackKeyBinding=(e,t=[])=>{const[,n]=useKeyBindingState();i.useEffect((()=>{const t=null==e.addPredicate||e.addPredicate(),a=null!=e.cancelPredicate&&e.cancelPredicate();t&&n({type:"push-key-binding",binding:e}),a&&n({type:"remove-key-binding",binding:e})}),t)},useKeyBindings=({keydownRepeatInterval:e=25,keydownIgnorePredicate:t=isInputElement}={})=>{const[n,a]=useKeyBindingState(),s=i.useCallback((e=>{Object.keys(n.bindings).filter((t=>t.includes(e)&&allPressed(t,Object.assign(Object.assign({},n.pressed),{[e]:!0})))).forEach((e=>{const t=n.bindings[e],i=t.length>0?t[t.length-1]:void 0;null!=i&&(i.fn(),a({type:"remove-key-binding",binding:i}))}))}),[n]);i.useEffect((()=>{const handleKeyDown=e=>{if(!e.repeat&&!t(e.target)){a({type:"set-key-pressed",key:e.key,pressed:!0}),s(e.key);const t=Object.assign(Object.assign({},n.pressed),{[e.key]:!0}),i=matchingSingleFnBindings(n.applyBindings,t,e.key),o=matchingOffBindings(n.applyBindings,t,e.key);(i.length>0||o.length>0)&&e.preventDefault()}},handleKeyUp=e=>{a({type:"set-key-pressed",key:e.key,pressed:!1})};return window.addEventListener("keydown",handleKeyDown),window.addEventListener("keyup",handleKeyUp),()=>{window.removeEventListener("keydown",handleKeyDown),window.removeEventListener("keyup",handleKeyUp)}}),[s,n.applyBindings,n.pressed]),i.useEffect((()=>{const e=matchingSingleFnBindings(n.applyBindings,n.pressed,n.lastPressed),t=matchingOffBindings(n.applyBindings,n.pressed,n.lastPressed);e.forEach((e=>e())),t.forEach((e=>e()))}),[n.pressed,n.lastPressed]),i.useEffect((()=>{const t=n.applyBindings.filter((e=>e.repeat&&null!=e.keyBind&&allPressed(e.keyBind,n.pressed))).map((e=>e.fn));if(t.length>0){const n=setInterval((()=>{t.forEach((e=>e()))}),e);return()=>{clearInterval(n)}}return()=>{}}),[n.applyBindings,n.lastPressed])},VertexBoxSelectionButton=()=>{const t=useBoxSelectionActions(),a=n.useRecoilValue(me);return useStackKeyBinding({id:"ExitBoxSelection",keyBind:"Escape",fn:t.disable,addPredicate:()=>a,cancelPredicate:()=>!a},[a]),e.jsx(o.VertexTooltip,{content:"Box Selection",children:e.jsx(o.VertexIconButton,{iconName:"box-cursor",iconColor:a?"primary":"secondary","data-testid":"viewer-toolbar-enable-box-selection-button",onClick:a?t.disable:t.enable})})},St=1,VertexResizableContent=t=>{var{className:n,style:a,displayShadow:i,heading:s,id:r,initialScale:c,placement:u="left",children:d,onResize:m}=t,p=__rest(t,["className","style","displayShadow","heading","id","initialScale","placement","children","onResize"]);const g="left"===u||"right"===u,h="top"===u;function getHorizontalResizeDirection(){switch(u){case"left":return"right";case"right":return"left";default:return"none"}}function getVerticalResizeDirection(){return"top"===u?"top":"none"}const f=null!=c?c:1;return e.jsx(o.VertexResizable,Object.assign({id:r,"data-testid":`resizable-content-position-${u}`,className:l(n,"pointer-events-auto z-popover md:z-overlay bg-white bg-opacity-95 flex-grow-0 flex-shrink-0 border-neutral-300",{"border-r min-w-75 max-w-half":"left"===u,"sidebar-shadow-right":"left"===u&&i,"border-l min-w-75 max-w-half":"right"===u,"sidebar-shadow-left":"right"===u&&i,"border-t bottom-0 fixed":"top"===u,"min-h-12 sheet":h}),style:Object.assign({maxHeight:"top"===u?window.innerHeight:void 0},a),initialHorizontalScale:g?c:void 0,initialVerticalScale:h?f:void 0,horizontalDirection:getHorizontalResizeDirection(),verticalDirection:getVerticalResizeDirection(),position:"right"===u||"top"===u?"absolute":"relative",onResizeEnd:()=>null==m?void 0:m()},p,{children:e.jsxs("div",{className:"flex flex-col h-full w-full",children:["top"===u&&e.jsx("div",{className:"flex justify-center w-full",children:e.jsx("div",{className:"block md:hidden w-20 h-0.5 mt-0.5 bg-neutral-600 rounded"})}),s,e.jsx("div",{className:l("w-full flex flex-col h-0 flex-grow",{"right-0":"right"===u}),children:d})]})}))};function useDefaultKeybindings(){useApplyKeyBinding({fn:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromiseRequired(V),n={milliseconds:500},a=await t();await(null==a?void 0:a.camera().viewAll().render({animation:n}))})),keyBind:"f"})}function useLongPress({target:e,callback:t,delay:n=500,onMovement:a}){const[i,o]=m.useState(),[l,r]=m.useState();m.useEffect((()=>{const handleTouchStart=e=>{const a=e;null!=a.touches&&1===a.touches.length&&(null!=i&&clearTimeout(i),r(s.Point.create(a.touches[0].clientX,a.touches[0].clientY)),o(setTimeout((()=>null==t?void 0:t(a)),n)))},handleTouchMove=e=>{const t=e;null!=t.touches&&t.touches.length>0&&null!=i&&null!=l&&s.Point.distance(l,s.Point.create(t.touches[0].clientX,t.touches[0].clientY))>=2&&(clearTimeout(i),null==a||a())},handleTouchEnd=()=>{null!=i&&clearTimeout(i)};return null==e||e.addEventListener("touchstart",handleTouchStart),null==e||e.addEventListener("touchmove",handleTouchMove),null==e||e.addEventListener("touchend",handleTouchEnd),()=>{null==e||e.removeEventListener("touchstart",handleTouchStart),null==e||e.removeEventListener("touchmove",handleTouchMove),null==e||e.removeEventListener("touchend",handleTouchEnd)}}),[e,i,l])}function asBooleanAttribute(e){return!!e||void 0}const VertexContextMenu=({targetElement:t,menuType:a,disableBackdrop:s,openPredicate:r,onOpen:c,onClose:u,children:d})=>{const m=useContextMenuActions(),p=n.useRecoilValue(oe),g=n.useRecoilValue(de),h=i.useMemo((()=>["bottom-end","top-start","top-end","right","left"]),[]),f=p===a;useStackKeyBinding({id:"ContextMenu",keyBind:"Escape",fn:m.clearActiveContextMenu,addPredicate:()=>null!=p&&p===a,cancelPredicate:()=>null==p},[p]);const v=i.useMemo((()=>null!=t?t:null!=r?window:void 0),[t,r]);return useLongPress({target:v,callback:e=>m.longPress(e,a,r,c),onMovement:()=>m.clearActiveContextMenu()}),i.useEffect((()=>{const handleWindowPointerDown=e=>{const t=undefined;if(!targetWithinMenu(e)&&2!==e.buttons&&p===a){const t=targetShouldSkipNextHit(e);m.clearActiveContextMenu(t)}};if(s)return window.addEventListener("pointerdown",handleWindowPointerDown),()=>{window.removeEventListener("pointerdown",handleWindowPointerDown)}}),[s,a,p]),i.useEffect((()=>{const handlePointerDown=e=>{m.pointerDown(e)},handlePointerUp=e=>{m.pointerUp(e,a,r,c)},handleContextMenu=e=>m.contextMenu(e,r);return null==v||v.addEventListener("pointerdown",handlePointerDown),null==v||v.addEventListener("pointerup",handlePointerUp),null==v||v.addEventListener("contextmenu",handleContextMenu),()=>{null==v||v.removeEventListener("pointerdown",handlePointerDown),null==v||v.removeEventListener("pointerup",handlePointerUp),null==v||v.removeEventListener("contextmenu",handleContextMenu)}}),[t,a,r]),e.jsx("div",{className:l({hidden:!f}),children:e.jsx(o.VertexMenu,{"data-testid":`${a}-context-menu`,open:asBooleanAttribute(f),position:g,fallbackPlacements:h,backdrop:!s,onMenuClosed:()=>{m.clearActiveContextMenu(),null==u||u()},children:e.jsx("div",{className:"pt-1",children:d})})})},VertexFitSelectedMenuItem=()=>{const t=n.useRecoilValue(Oe),a=n.useRecoilValue(He),i=useViewerCameraActions();return e.jsxs(o.VertexMenuItem,{"data-testid":"fit-selected-menu-option",onClick:()=>{null!=(null==a?void 0:a.boundingBox)&&i.flyToByBoundingBox(a.boundingBox)},disabled:asBooleanAttribute(0===t.length),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"fit-selected",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Fit Selected"})]})},VertexFlyToMenuItem=()=>{const t=useViewerCameraActions(),a=n.useRecoilValue(ce);return e.jsxs(o.VertexMenuItem,{"data-testid":"fly-to-part-menu-option",onClick:()=>{var e;const n=undefined,i=contextMenuItemIsRow(a)?null===(e=null==a?void 0:a.node.id)||void 0===e?void 0:e.hex:null==a?void 0:a.id;null!=i&&t.flyToById(i)},disabled:asBooleanAttribute(null==a),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"paper-airplane",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Fly To"})]})};function useSceneItemsOperations(){const e=n.useRecoilValue(g),t=undefined,a=undefined,s=undefined,o=undefined,l=undefined,r=undefined;return{sceneItemsOperation:i.useCallback((async(t,n)=>{const a=await(null==e?void 0:e.scene());null==n?await(null==a?void 0:a.items((e=>t(e.where((e=>e.all()))))).execute()):n.length>0&&await(null==a?void 0:a.items((e=>t(e.where((e=>e.withItemIds(n)))))).execute())}),[e]),showOnlySelected:i.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.all())).hide(),e.where((e=>e.withSelected())).show()])).execute()}),[e]),hideSelected:i.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.withSelected())).hide()])).execute()}),[e]),showOnlyItem:i.useCallback((async t=>{const n=await(null==e?void 0:e.scene());null==n||n.items((e=>[e.where((e=>e.all())).hide(),e.where((e=>e.withItemIds([t]))).show()])).execute()}),[e]),ghostSelected:i.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.withSelected())).setPhantom(!0)])).execute()}),[e]),unGhostSelected:i.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.withSelected())).setPhantom(!1)])).execute()}),[e])}}const VertexHideAllMenuItem=()=>{const t=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"hide-all-menu-option",onClick:()=>{t.sceneItemsOperation((e=>e.hide()))},children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Hide All Parts"})]})},VertexHidePartMenuItem=()=>{const t=n.useRecoilValue(ce),a=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"hide-menu-option",onClick:()=>{var e;const n=undefined,i=contextMenuItemIsRow(t)?null===(e=null==t?void 0:t.node.id)||void 0===e?void 0:e.hex:t.id;null!=i&&a.sceneItemsOperation((e=>e.hide()),[i])},disabled:asBooleanAttribute(null==t),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Hide Part"})]})},VertexHideSelectedMenuItem=()=>{const t=n.useRecoilValue(Oe),a=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"hide-selected-menu-option",onClick:()=>a.hideSelected(),disabled:asBooleanAttribute(0===t.length),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Hide Selected"})]})},VertexShowAllMenuItem=()=>{const t=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"show-all-menu-option",onClick:()=>{t.sceneItemsOperation((e=>e.show()))},children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Show All Parts"})]})},VertexShowOnlyMenuItem=()=>{const t=n.useRecoilValue(ce),a=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"show-only-menu-option",onClick:()=>{var e;const n=undefined,i=contextMenuItemIsRow(t)?null===(e=null==t?void 0:t.node.id)||void 0===e?void 0:e.hex:null==t?void 0:t.id;null!=i&&a.showOnlyItem(i)},disabled:asBooleanAttribute(null==t),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Show Only Part"})]})},VertexShowOnlySelectedMenuItem=()=>{const t=n.useRecoilValue(Oe),a=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"show-only-selected-menu-option",onClick:()=>a.showOnlySelected(),disabled:asBooleanAttribute(0===t.length),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Show Only Selected"})]})};n.atom({key:"sceneTreeLoaderVisible",default:!1});const wt=n.atom({key:"sceneTreeElement",default:void 0}),Ct=n.atom({key:"sceneTreeWidth",default:void 0});function useSceneTreeActions(){const e=useSelectionActions(),t=useViewerCameraActions();return{toggleSelection:useActionCallback((({snapshot:t})=>async(n,a,i)=>{var s,o;if(!n.defaultPrevented&&0===n.button&&(n.altKey||((n.ctrlKey||n.metaKey)&&a.selected?i.deselectItem(a):a.selected?i.selectItem(a,{recurseParent:!0}):a.selected||i.selectItem(a,{append:n.ctrlKey||n.metaKey,range:n.shiftKey})),null!=a.id)){const i=await t.getPromise(Ne);e.syncSelection({id:null===(s=a.id)||void 0===s?void 0:s.hex,ancestors:null!==(o=null==i?void 0:i.ancestors)&&void 0!==o?o:[]},{selected:!n.metaKey&&!n.ctrlKey||!a.selected,multiSelect:n.shiftKey||n.metaKey||n.ctrlKey})}})),toggleExpansion:useActionCallback((()=>(e,t,n)=>{n.toggleExpandItem(t)})),toggleVisibility:useActionCallback((()=>(e,t,n)=>{n.toggleItemVisibility(t)})),flyToRow:useActionCallback((({snapshot:e})=>async n=>{var a;const i=await e.getPromise(wt),s=await(null==i?void 0:i.getRowAtClientY(n));null!=(null===(a=null==s?void 0:s.node.id)||void 0===a?void 0:a.hex)&&await t.flyToById(s.node.id.hex)})),setContextMenuItem:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(wt),i=await(null==a?void 0:a.getRowAtClientY(n));e(ce,i)}))}}n.selector({key:"sceneTreeController",get:({get:e})=>{var t;return null===(t=e(wt))||void 0===t?void 0:t.controller},dangerouslyAllowMutability:!0});const VertexGhostSelectedMenuItem=()=>{const t=n.useRecoilValue(Oe),a=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"ghost-selected-menu-option",onClick:()=>a.ghostSelected(),disabled:asBooleanAttribute(0===t.length),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-partial",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Ghost Selected"})]})},VertexUnghostSelectedMenuItem=()=>{const t=n.useRecoilValue(Oe),a=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"unghost-selected-menu-option",onClick:()=>a.unGhostSelected(),disabled:asBooleanAttribute(0===t.length),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Unghost Selected"})]})},DefaultSceneTreeContextMenu=()=>e.jsxs("div",{className:"w-56",children:[e.jsx(VertexHideSelectedMenuItem,{}),e.jsx(VertexHideAllMenuItem,{}),e.jsx(VertexShowOnlyMenuItem,{}),e.jsx(VertexShowOnlySelectedMenuItem,{}),e.jsx(VertexShowAllMenuItem,{}),e.jsx(VertexGhostSelectedMenuItem,{}),e.jsx(VertexUnghostSelectedMenuItem,{}),e.jsx(o.VertexMenuDivider,{}),e.jsx(VertexFitSelectedMenuItem,{}),e.jsx(VertexFlyToMenuItem,{})]}),VertexSceneTreeContextMenu=({children:t})=>{const a=useSceneTreeActions(),i=n.useRecoilValue(wt),s=null!=t&&!1!==t;return e.jsx(VertexContextMenu,{menuType:"scene-tree",targetElement:i,onOpen:async(e,t)=>{const n=e;await a.setContextMenuItem(n.clientY)},disableBackdrop:!0,children:s?t:e.jsx(DefaultSceneTreeContextMenu,{})})},DefaultViewerContextMenu=()=>e.jsxs("div",{className:"w-56",children:[e.jsx(VertexHidePartMenuItem,{}),e.jsx(VertexHideSelectedMenuItem,{}),e.jsx(VertexHideAllMenuItem,{}),e.jsx(VertexShowOnlyMenuItem,{}),e.jsx(VertexShowOnlySelectedMenuItem,{}),e.jsx(VertexShowAllMenuItem,{}),e.jsx(VertexGhostSelectedMenuItem,{}),e.jsx(VertexUnghostSelectedMenuItem,{}),e.jsx(o.VertexMenuDivider,{}),e.jsx(VertexFitSelectedMenuItem,{}),e.jsx(VertexFlyToMenuItem,{})]}),VertexViewerContextMenu=({children:t})=>{const n=null!=t&&!1!==t,a=i.useCallback((e=>e.target instanceof HTMLElement&&"vertex-viewer"===e.target.id),[]);return e.jsx(VertexContextMenu,{menuType:"viewer",disableBackdrop:!0,openPredicate:a,children:n?t:e.jsx(DefaultViewerContextMenu,{})})},jt=35,kt=n.atom({key:"sceneItemGhostingSelectedOpacity",default:jt}),At=n.atomFamily({key:"appliedItemPhantomState",default:void 0}),Tt=n.atom({key:"appliedItemPhantomStateIds",default:[]}),Pt=n.selector({key:"sceneItemGhostingLastSelectedPhantom",get:({get:e})=>{var t;const n=e(Ne);return null!=n&&(null!==(t=e(At(n.id)))&&void 0!==t&&t)}}),VertexSceneItemGhostingOpacitySlider=({onApply:t})=>{const[a,i]=n.useRecoilState(kt);return e.jsx(VertexSlider,{id:"phantom-opacity","data-testid":"phantom-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:a,valueLabelDisplay:"auto",onValueInput:e=>{i(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},useSceneItemPhantomActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(Tt)).forEach((e=>t(At(e)))),t(Tt)}));return{setPhantomState:useActionCallback((({snapshot:t,set:n})=>async a=>{const i=await t.getPromise(Oe);i.forEach((e=>n(At(e),a))),n(Tt,(e=>[...e,...i])),await e.execute(Ie.SET_PHANTOM_SELECTED_ITEMS,(e=>e.where((e=>e.withSelected())).setPhantom(a)))})),clearPhantomState:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const i=await t.getPromise(Oe);i.forEach((e=>a(At(e)))),n(Tt,(e=>e.filter((e=>!i.includes(e))))),await e.execute(Ie.CLEAR_PHANTOM_SELECTED_ITEMS,(e=>e.where((e=>e.withSelected())).clearPhantom()),(e=>e.where((e=>e.withSelected())).select()))})),clearAllPhantomState:useActionCallback((()=>async()=>{await t(),await e.execute(Ie.CLEAR_PHANTOM_ALL,(e=>e.where((e=>e.all())).clearPhantom()),(e=>e.where((e=>e.withSelected())).select()))})),resetAllPhantomState:t}},VertexSceneItemGhostingToggle=({onApply:t})=>{const a=useSceneItemPhantomActions(),i=n.useRecoilValue(Ue),s=n.useRecoilValueLoadable(Pt);return e.jsx(o.VertexTooltip,{content:"Select a part to display as ghost",disabled:i,children:e.jsx(o.VertexToggle,{className:"flex items-center","data-testid":"phantom-state-toggle",variant:"switch",disabled:!i,checked:"hasValue"===s.state&&s.contents,onValueChanged:async e=>{await a.setPhantomState(e.detail),null==t||t(e.detail)}})})};function VertexGhostingControls({onApplyGhostingChange:t,onApplyOpacity:n}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center py-3",children:[e.jsx(VertexSceneItemGhostingToggle,{onApply:t}),e.jsx("span",{className:"pl-4 text-sm text-neutral-700",children:"Display as Ghost"})]}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Global Ghost Opacity"}),e.jsx(VertexSceneItemGhostingOpacitySlider,{onApply:n})]})}const VertexSceneItemGhostingClear=({onClear:t,onClearAll:a})=>{const i=useSceneItemPhantomActions(),s=n.useRecoilValue(Pt);return e.jsx("div",{className:"ml-auto",children:e.jsxs(ResetButton,{id:"phantom",tooltip:"Clear Ghosting",children:[e.jsx("div",{className:"pt-1"}),e.jsx(o.VertexMenuItem,{"data-testid":"reset-selected-phantom",onClick:async()=>{await i.clearPhantomState(),null==t||t()},disabled:!s,children:"Clear ghosting for selected"}),e.jsx(o.VertexMenuItem,{"data-testid":"reset-all-phantom",onClick:async()=>{await i.clearAllPhantomState(),null==a||a()},children:"Clear ghosting for all"})]})})};function VertexGhostingPanelSection({onClearGhostState:t,onClearAllGhostState:n,onApplyGhostingChange:a,onApplyOpacity:i}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Ghosting",e.jsx(VertexSceneItemGhostingClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexGhostingControls,{onApplyGhostingChange:a,onApplyOpacity:i})})}function VertexMeasurementContextMenu({onDelete:t}){const a=n.useRecoilValue(re);return e.jsx(VertexContextMenu,{menuType:"measurement",openPredicate:e=>e.target instanceof HTMLElement&&"VERTEX-VIEWER-MEASUREMENT-DISTANCE"===e.target.tagName,children:e.jsxs(o.VertexMenuItem,{"data-testid":"measurement-delete",onClick:()=>null!=a&&t(a.id),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"delete",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Delete"})]})})}const Et=n.atom({key:"lengthUnit",default:"cm"}),Rt=n.atom({key:"decimalPlace",default:"2"});var It,Mt;!function(e){e.mm="millimeters",e.cm="centimeters",e.m="meters",e.in="inches",e.ft="feet"}(It||(It={})),function(e){e[e.mm=1]="mm",e[e.cm=.1]="cm",e[e.m=.001]="m",e[e.in=.03937007874015748]="in",e[e.ft=.0032808398950131233]="ft"}(Mt||(Mt={}));const convertFrom=(e,t)=>{const n=undefined;return e/Mt[t]},convertTo=(e,t)=>{const n=undefined;return e*Mt[t]},formatWithUnit=(e,t,n)=>`${e.toFixed(n)} ${t}`,formatDistance=(e,t,n)=>formatWithUnit(convertTo(e,t),t,n),createDistanceFormatter=(e,t)=>n=>formatDistance(n,e,t);function toUnitType(e){switch(e){case"cm":return"centimeters";case"m":return"meters";case"in":return"inches";case"ft":return"feet";default:return"millimeters"}}function useDockedPlacement(e,t){const[n,a]=m.useState(s.Point.create(0,0));return m.useLayoutEffect((()=>{if(null!=e){const n=e.getBoundingClientRect(),i=s.Point.create(n.left,n.bottom),o=s.Point.create(n.right,n.bottom);a("left"===t?i:o)}}),[e,t]),n}function VertexMeasurementDetails({placement:t}){const a=useMeasurementActions(),i=n.useRecoilValue(g),s=n.useRecoilValue(h),r=useDockedPlacement(null!=i?i:null,t),u=n.useRecoilValue(je),d=n.useRecoilValue(ke),m=n.useRecoilValue(Ae),p=n.useRecoilValue(Te),f=n.useRecoilValue(Et),v=n.useRecoilValue(Rt);return e.jsx(o.VertexDraggablePopover,{className:"z-popover",boundaryPadding:16,boundarySelector:`#${s}`,position:r,children:e.jsxs("div",{className:"flex flex-col leading-4 min-w-40",children:[e.jsxs("div",{className:"pb-2 flex justify-between",children:[e.jsx("div",{className:"w-full",children:"Measurement"}),e.jsx("div",{className:l("-mt-1 relative",{hidden:!p}),children:e.jsx(o.VertexTooltip,{content:"Reset",placement:"left-start",children:e.jsx(o.VertexIconButton,{"data-testid":"measurement-details-reset",iconName:"reset",iconSize:"sm",onClick:a.resetMeasurement})})})]}),e.jsx(c.VertexViewerMeasurementDetails,{"data-testid":"measurement-details-viewer-measurement-details",className:l("gap-y-1.5 text-xs",{hidden:null==u}),measurementOutcome:u,measurementOverlays:d,distanceUnits:toUnitType(f),fractionalDigits:parseInt(v,10)}),e.jsx("div",{"data-testid":"measurement-details-message",className:l("text-xs",{hidden:null==m}),children:m})]})})}function useCallbackRef(e){var t;const[n,a]=i.useState((t=void 0,null)),s=undefined;return{element:n,callback:i.useCallback((e=>a(e)),[])}}function VertexPointToPointMeasurement({detailsPlacement:t,onPointToPointMeasurementChange:a}){const s=useMeasurementActions(),o=n.useRecoilValue(g),l=n.useRecoilValue(xe),r=n.useRecoilValue(he),u=n.useRecoilValue(Et),d=n.useRecoilValue(Rt),{callback:m,element:p}=useCallbackRef();usePointToPointMeasurement(p);const h=i.useCallback((e=>{const t={start:e.detail.start,end:e.detail.end,invalid:!e.detail.valid};s.setEditedPointToPointMeasurement(t),null==a||a(t)}),[s]);return l?e.jsxs(e.Fragment,{children:[e.jsx(c.VertexViewerMeasurementDistance,{"data-testid":"point-to-point-measurement",ref:m,viewer:null!=o?o:void 0,mode:"replace",start:null==r?void 0:r.start,end:null==r?void 0:r.end,invalid:null==r?void 0:r.invalid,units:toUnitType(u),fractionalDigits:parseInt(d,10),showAxisReferenceLines:!0,onEditEnd:h}),e.jsx(VertexMeasurementDetails,{placement:t}),e.jsx(VertexMeasurementContextMenu,{onDelete:s.resetMeasurement})]}):e.jsx(e.Fragment,{})}function VertexPointToPointMeasurementTool(){const t=useMeasurementActions(),a=n.useRecoilValue(xe);return useStackKeyBinding({id:"ExitMeasurement",keyBind:"Escape",fn:t.disableEditMeasurement,addPredicate:()=>a,cancelPredicate:()=>!a},[a,t]),e.jsx(o.VertexTooltip,{content:"Point to Point Measurement",children:e.jsx(o.VertexIconButton,{iconName:"tape-measure","data-testid":"viewer-toolbar-point-to-point-measurement-button",iconColor:a?"primary":"secondary",onClick:t.toggleEditPointToPointMeasurement})})}const Ot=n.atom({key:"viewerToolkitSdkConfig",default:void 0}),VertexPreciseMeasurement=({detailsPlacement:t,onEntitiesChanged:a,onOutcomeChanged:i})=>{var s,o,l,r;const u=n.useRecoilValue(g),d=n.useRecoilValue(Ot),m=n.useRecoilValue(ve),{callback:p,element:h}=useCallbackRef();return usePreciseMeasurementModel(h,a,i),m?e.jsxs(e.Fragment,{children:[e.jsx(c.VertexViewerMeasurementPrecise,{"data-testid":"precise-measurement-viewer-tool",ref:p,viewer:null!=u?u:void 0,config:JSON.stringify({network:{apiHost:null===(s=null==d?void 0:d.network)||void 0===s?void 0:s.apiHost,renderingHost:null===(o=null==d?void 0:d.network)||void 0===o?void 0:o.renderingHost,sceneTreeHost:null===(l=null==d?void 0:d.network)||void 0===l?void 0:l.sceneTreeHost,sceneViewHost:null===(r=null==d?void 0:d.network)||void 0===r?void 0:r.sceneViewHost}})}),e.jsx(VertexMeasurementDetails,{placement:t})]}):e.jsx(e.Fragment,{})};function VertexPreciseMeasurementTool(){const t=useMeasurementActions(),a=n.useRecoilValue(ve);return e.jsx(o.VertexTooltip,{content:"Precise Measurement",children:e.jsx(o.VertexIconButton,{iconName:"ruler","data-testid":"viewer-toolbar-precise-measurement-button",iconColor:a?"primary":"secondary",onClick:t.toggleEditPreciseMeasurement})})}function VertexApplicationMessages(){const t=n.useRecoilValue(Re),a=n.useRecoilValue(Ee);return e.jsxs(e.Fragment,{children:[null!=t&&e.jsx(o.VertexBanner,{className:"z-[16000]",duration:t.duration,open:!0,content:t.message,type:t.type},t.id),null!=a&&e.jsx(o.VertexToast,{placement:"bottom-left",className:"z-[16000]",duration:a.duration,open:!0,content:a.message,type:a.type},a.id)]})}const targetIsElement=(e,t)=>e instanceof Element&&e.tagName===t;function useRecoilRef({state:e}){const t=undefined;return n.useRecoilCallback((({set:t})=>n=>{t(e,n)}),[])}var Nt;function styleFromOptionalFont(e){return null!=e?{"--scene-tree-default-font-family":styleFromFontFace(e.fontFace),"--scene-tree-default-font-color":e.color}:{}}function styleFromOptionalBackgroundColors(e){const t=null==e?void 0:e.depthColors,n=null!=t?Object.keys(t).reduce(((e,n)=>Object.assign(Object.assign({},e),{[`--scene-tree-row-background-color-depth-${n}`]:t[parseInt(n)]})),{}):{};return null!=e?Object.assign(Object.assign({},n),{"--scene-tree-hovered-row-background-color":e.hovered,"--scene-tree-selected-row-background-color":e.selected,"--scene-tree-row-background-color":e.defaultColor}):{}}function styleFromFontFace(e){return e===Nt.ROBOTO_MONO?"var(--vertex-ui-font-family-monospace)":"var(--vertex-ui-font-family)"}!function(e){e.ROBOTO="ROBOTO",e.ROBOTO_MONO="ROBOTO_MONO"}(Nt||(Nt={}));const Lt=n.atom({key:"sceneTreeSearchActive",default:!1}),VertexEnterSceneTreeSearchModeButton=({onEnterSearchMode:t})=>{const a=n.useSetRecoilState(Lt);return e.jsx(o.VertexTooltip,{className:"flex ml-auto",content:"Scene Tree Search",children:e.jsx(o.VertexIconButton,{"data-testid":"enter-scene-tree-search-mode-button",iconName:"search",iconSize:"sm",onPointerDown:e=>{e.preventDefault()},onClick:()=>{a(!0),null==t||t()}})})},VertexSceneTreeSearchBar=({onSearch:t,onClearSearch:a,onExitSearchMode:i,children:s})=>{const l=n.useRecoilValue(wt),[r,u]=n.useRecoilState(Lt),[d,p]=m.useState(!1),{element:g,callback:h}=useCallbackRef(),f=null==(null==g?void 0:g.value)||""===(null==g?void 0:g.value)||d,v=f?"Exit Search":"Clear Search";return m.useEffect((()=>{r&&(null==g||g.setFocus())}),[g,r]),e.jsxs("div",{className:"flex w-full py-3 px-2",children:[e.jsx(c.VertexSceneTreeSearch,{"data-testid":"scene-tree-search-bar",ref:h,controller:null==l?void 0:l.controller,onBlur:()=>{f&&(u(!1),null==i||i())},onSearch:()=>{null==t||t(null==g?void 0:g.value)},onInput:()=>{p(!1)},children:s}),e.jsx(o.VertexTooltip,{className:"self-center pr-1 pl-2",content:v,children:e.jsx(o.VertexIconButton,{"data-testid":"scene-tree-search-close-button",iconName:"close-circle-fill",iconSize:"sm",variant:"plain",onPointerDown:e=>{e.preventDefault()},onClick:async()=>{f?(u(!1),null==i||i()):(await(null==g?void 0:g.clear()),await(null==g?void 0:g.setFocus()),p(!0),null==a||a())}})})]})},VertexSceneTreeSearch=({onEnterSearchMode:t,onExitSearchMode:a,onSearch:i,onClearSearch:s,children:o})=>{const l=n.useRecoilValue(Lt);return e.jsxs(c.VertexSceneTreeToolbar,{className:"h-11 p-0 border-b border-neutral-300 box-content",slot:"header",children:[l&&e.jsx(VertexSceneTreeSearchBar,{onSearch:i,onClearSearch:s,onExitSearchMode:a,children:o}),!l&&e.jsx("div",{className:"ml-auto mr-2",children:e.jsx(VertexEnterSceneTreeSearchModeButton,{onEnterSearchMode:t})})]})},VertexSceneTreeCollapseAll=()=>{const t=n.useRecoilValue(wt);return e.jsx(o.VertexTooltip,{className:"w-auto",content:"Collapse All",placement:"top",children:e.jsx(o.VertexIcon,{size:"sm",className:"h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer","data-testid":"collapse-all-icon",name:"collapse-all",onClick:()=>{null==t||t.collapseAll()}})})},VertexSceneTreeExpandAll=()=>{const t=n.useRecoilValue(wt);return e.jsx(o.VertexTooltip,{className:"w-auto",content:"Expand All",placement:"top",children:e.jsx(o.VertexIcon,{size:"sm","data-testid":"expand-all-icon",className:"h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer",name:"expand-all",onClick:()=>{null==t||t.expandAll()}})})};function VertexSceneTreeToolbar(){return e.jsx(c.VertexSceneTreeToolbar,{className:"h-10 border-b border-neutral-300 box-border",children:e.jsxs("div",{className:"flex flex-shrink-0 w-full text-neutral-700 items-center gap mx-2",children:[e.jsx(VertexSceneTreeExpandAll,{}),e.jsx(VertexSceneTreeCollapseAll,{})]})})}const VertexSceneTreeHeader=({onEnterSearchMode:t,onExitSearchMode:n,onSearch:a,onClearSearch:i,children:s})=>{const o=null!=s&&!1!==s;return e.jsx("div",{slot:"header",className:"flex flex-col",children:o?s:e.jsxs(e.Fragment,{children:[e.jsx(VertexSceneTreeSearch,{onEnterSearchMode:t,onExitSearchMode:n,onSearch:a,onClearSearch:i,children:e.jsx("div",{slot:"clear-icon"})}),e.jsx(VertexSceneTreeToolbar,{})]})})},Bt={binding:"{{row.node.name}}",label:"Name",metadataKeyName:"VERTEX_SCENE_ITEM_NAME"},_t=n.selector({key:"sceneTreeColumnsActiveColumns",get:({get:e})=>{const t=[],n=e(Ct);if(null!=n&&n>0){const e=1/(t.length+1)*n,a=(n-e)/t.length;return{Name:Object.assign(Object.assign({},Bt),{initialWidth:e,minWidth:a})}}return{Name:Bt}}}),Dt=n.selector({key:"sceneTreeColumnsActiveColumnNames",get:({get:e})=>Object.keys(e(_t))}),VertexSceneTreeTableLayout=t=>{const a=n.useRecoilValue(_t),i=n.useRecoilValue(Dt),s=[];return e.jsx(c.VertexSceneTreeTableLayout,Object.assign({"data-testid":"scene-tree-table-layout"},t,{children:i.map(((t,n)=>{var o;const r=a[t],u=null!==(o=s[n])&&void 0!==o?o:r.initialWidth;return e.jsxs(c.VertexSceneTreeTableColumn,{"data-testid":`scene-tree-table-column-${n}`,initialWidth:u,minWidth:r.minWidth,children:[e.jsx("template",{slot:"header",dangerouslySetInnerHTML:{__html:`\n <div class="text-sm text-neutral-800 my-2">\n <div class="${l("truncate",{"pl-2":0===n,"pr-2":n===i.length-1})}">\n ${r.label}\n </div>\n </div>\n `}}),e.jsx("template",{dangerouslySetInnerHTML:{__html:`\n <vertex-scene-tree-table-cell\n prop:value="${r.binding}"\n prop:selection-handler="{{row.data.handleSelection}}"\n prop:expansion-handler="{{row.data.handleExpansion}}"\n prop:visibility-handler="{{row.data.handleVisibility}}"\n ${0===n?"expand-toggle":""}\n ${n===i.length-1?"isolate-button visibility-toggle":""}>\n <div class="flex items-center gap-2">\n <vertex-tooltip \n class="truncate" \n prop:content="${null!=r.binding?r.binding:"--"}" \n placement="${n!==i.length-1?"right":"top"}">\n <div class="flex items-center w-full">\n <div class="truncate">${r.binding}</div>\n </div>\n </vertex-tooltip>\n </div>\n \n\n <div slot="placeholder" class="flex items-center w-full truncate">\n <div> -- </div>\n </div>\n </vertex-scene-tree-table-cell>\n `}})]},r.label)}))}))},VertexSceneTree=a=>{var{id:i,font:s,backgroundColors:o,children:r,style:u,onPointerDown:d,onClick:m,onToggleSelection:p,onToggleExpansion:h,onToggleVisibility:f,className:v,rowData:b}=a,V=__rest(a,["id","font","backgroundColors","children","style","onPointerDown","onClick","onToggleSelection","onToggleExpansion","onToggleVisibility","className","rowData"]);const S=n.useRecoilValue(Ot),w=useSelectionActions(),C=useSceneTreeActions(),j=n.useRecoilValue(g),k=useRecoilRef({state:wt}),A=null!=r&&!1!==r,wrappedExpansionHandler=(e,t,n)=>{C.toggleExpansion(e,t,n),null==h||h(e,t,n)},wrappedSelectionHandler=(e,t,n)=>{C.toggleSelection(e,t,n),null==p||p(e,t,n)},wrappedVisibilityHandler=(e,t,n)=>{C.toggleVisibility(e,t,n),null==f||f(e,t,n)},handleClick=e=>{e.altKey&&C.flyToRow(e.clientY),null==m||m(e)},handlePointerDown=e=>{targetIsElement(e.target,"VERTEX-SCENE-TREE-TABLE-COLUMN")&&w.clearSelection(),null==d||d(e)};return e.jsx("div",{className:l("flex flex-col w-full h-full",v),children:e.jsx("div",{className:"flex group h-full",children:e.jsx(c.VertexSceneTree,Object.assign({id:null!=i?i:"vertex-scene-tree","data-testid":"vertex-scene-tree",config:S,ref:k,className:"flex-1",style:Object.assign(Object.assign(Object.assign({},styleFromOptionalFont(s)),styleFromOptionalBackgroundColors(o)),u),onConnectionError:e=>{t.logger.error("Scene Tree Connection Error: ",e.detail)},viewer:j,onPointerDown:handlePointerDown,onClick:handleClick,rowData:e=>{var t;const n=null!==(t=null==b?void 0:b(e))&&void 0!==t?t:{};return Object.assign({handleExpansion:wrappedExpansionHandler,handleSelection:wrappedSelectionHandler,handleVisibility:wrappedVisibilityHandler},n)}},V,{children:A?r:e.jsxs(e.Fragment,{children:[e.jsx(VertexSceneTreeHeader,{}),e.jsx(VertexSceneTreeTableLayout,{}),e.jsx(VertexSceneTreeContextMenu,{})]})}))})})},VertexDecimalPlaceSelector=({onApply:t})=>{const[a,i]=n.useRecoilState(Rt);return e.jsxs(o.VertexSelect,{"data-testid":"decimal-place-select",className:"w-24",value:a,onOptionChanged:e=>{i(e.detail),null==t||t(e.detail)},children:[e.jsx("div",{className:"py-1.5 px-3",children:"0"}),e.jsx("div",{className:"py-1.5 px-3",children:"1"}),e.jsx("div",{className:"py-1.5 px-3",children:"2"}),e.jsx("div",{className:"py-1.5 px-3",children:"3"})]})},VertexLengthUnitSelector=({onApply:t})=>{const[a,i]=n.useRecoilState(Et);return e.jsxs(o.VertexSelect,{"data-testid":"length-unit-select",className:"w-40",value:a,onOptionChanged:e=>{i(e.detail),null==t||t(e.detail)},children:[e.jsx("div",{"data-value":"cm",className:"py-1.5 px-3",children:"centimeters"}),e.jsx("div",{"data-value":"mm",className:"py-1.5 px-3",children:"millimeters"}),e.jsx("div",{"data-value":"m",className:"py-1.5 px-3",children:"meters"}),e.jsx("div",{"data-value":"in",className:"py-1.5 px-3",children:"inches"}),e.jsx("div",{"data-value":"ft",className:"py-1.5 px-3",children:"feet"})]})};function VertexUnitsControls({onUnitChange:t,onDecimalPlaceChange:n}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Length Unit"}),e.jsx(VertexLengthUnitSelector,{onApply:t})]}),e.jsxs("div",{children:[e.jsx("div",{className:"pt-2 pb-2 text-sm text-neutral-700",children:"Decimals"}),e.jsx(VertexDecimalPlaceSelector,{onApply:n})]})]})}function VertexUnitsPanelSection({onUnitChange:t,onDecimalPlaceChange:n}){return e.jsx(PanelSection,{header:e.jsx("div",{className:"flex items-center text-base",children:"Units"}),children:e.jsx(VertexUnitsControls,{onUnitChange:t,onDecimalPlaceChange:n})})}const Ht=n.atom({key:"openedPanelActivePrimaryLeft",default:void 0}),Ft=n.atom({key:"openedPanelActivePrimaryRight",default:void 0});function usePanelActions(){return{openPrimary:useActionCallback((({set:e})=>(t,n)=>{e("left"===n?Ht:Ft,t)})),closePrimary:useActionCallback((({set:e})=>t=>{e("left"===t?Ht:Ft,void 0)}))}}function DefaultAppearancePanel(){return e.jsxs("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:[e.jsx(VertexMaterialPanelSection,{}),e.jsx(VertexGhostingPanelSection,{}),e.jsx(VertexFeatureEdgesPanelSection,{}),e.jsx(VertexViewerBackgroundPanelSection,{}),e.jsx(VertexSelectionHighlightingPanelSection,{}),e.jsx(VertexCrossSectionAppearancePanelSection,{})]})}function DefaultSettingsPanel(){return e.jsx("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e.jsx(VertexUnitsPanelSection,{})})}const VertexTransformClear=({onClear:t,onClearAll:a})=>{const i=useTransformActions(),s=n.useRecoilValue(Ue);return e.jsx("div",{className:"ml-auto",children:e.jsxs(ResetButton,{id:"transforms",tooltip:"Clear Transforms",children:[e.jsx("div",{className:"pt-1"}),e.jsx(o.VertexMenuItem,{"data-testid":"reset-selected-transforms",onClick:async()=>{await i.clearSelectedTransforms(),null==t||t()},disabled:!s,children:"Clear selected transforms"}),e.jsx(o.VertexMenuItem,{"data-testid":"reset-all-transforms",onClick:async()=>{await i.clearAllTransforms(),null==a||a()},children:"Clear all transforms"})]})})},VertexTransformManipulatorToggle=({onToggleTransformsManipulator:t})=>{const a=useTransformActions(),i=n.useRecoilValue(We),s=n.useSetRecoilState(Qe);return e.jsx(o.VertexToggle,{className:"flex items-center","data-testid":"transform-widget-toggle",variant:"switch",checked:i,onValueChanged:async()=>{i?(a.disableTransformWidget(),null==t||t(!1)):(s("world"),await a.enableTransformWidget(),null==t||t(!0))}})};function VertexTransformControls({onToggleTransformsManipulator:t}){return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex items-center py-3",children:[e.jsx(VertexTransformManipulatorToggle,{onToggleTransformsManipulator:t}),e.jsx("span",{className:"pl-4 text-sm text-neutral-700",children:"Enable manipulator"})]})})}function VertexTransformPanelSection({onClearTransforms:t,onClearAllTransforms:n,onToggleTransformsManipulator:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Manual Part Transforms",e.jsx(VertexTransformClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexTransformControls,{onToggleTransformsManipulator:a})})}function DefaultTransformsPanel(){return e.jsx("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e.jsx(VertexTransformPanelSection,{})})}const zt="Appearance",Ut="Settings",Wt="Transforms",ViewerRightPanelHeader=()=>{const t=undefined,a=getHeading(n.useRecoilValue(Ft));return e.jsx("div",{className:"flex flex-col w-full items-center z-overlay pointer-events-none md:pointer-events-auto py-3 px-4 border-b border-neutral-300",children:e.jsx("div",{className:"items-center w-full leading-6 text-md align-center font-medium text-neutral-800",children:a})})};function getHeading(e){switch(e){case"appearance":return zt;case"settings":return Ut;case"transforms":return Wt;default:return"None"}}function VertexViewerRightOpenedPanel(){const t=n.useRecoilValue(Ft),a=i.useMemo((()=>["appearance","settings","transforms"]),[]);return e.jsx(e.Fragment,{children:null!=t&&a.includes(t)&&e.jsxs(VertexResizableContent,{displayShadow:!0,heading:e.jsx(ViewerRightPanelHeader,{}),placement:"right",children:["appearance"===t&&e.jsx(DefaultAppearancePanel,{}),"transforms"===t&&e.jsx(DefaultTransformsPanel,{}),"settings"===t&&e.jsx(DefaultSettingsPanel,{})]})})}function Sidebar({children:t}){return e.jsx("div",{className:"pointer-events-auto flex flex-col items-center w-full border-neutral-300 py-2",children:t})}function SidebarIcon({name:t,iconName:n,active:a,responsive:s,disabled:r,content:c,tooltipPlacement:u,children:d,onSelect:m,onDeselect:p}){return e.jsx("div",{className:l({"text-[var(--vertex-ui-blue-700)]":a===t&&!r,"text-neutral-700 hover:text-neutral-800":a!==t&&!r,"cursor-pointer hover:bg-neutral-200":!r,"text-neutral-400":r,"rounded-full md:p-3":s,"p-3":!s&&null==d,"px-3 py-1":null!=d}),"data-testid":`${t}-sidebar-panel`,onClick:()=>{r||(a===t?p():m())},children:e.jsxs(o.VertexTooltip,{placement:null!=u?u:void 0,content:i.isValidElement(c)?void 0:c,children:[e.jsx("div",{slot:"content",children:c}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx(o.VertexIcon,{name:n}),d]})]})})}function VertexViewerRightSidebar(){const t=usePanelActions(),a=n.useRecoilValue(Ft);return e.jsx("div",{className:"flex flex-col flex-shrink-0 items-center relative border-neutral-300 border-l bg-white h-full top-0 min-w-12 w-12",children:e.jsxs(Sidebar,{children:[e.jsx(SidebarIcon,{name:"appearance",active:a,iconName:"adjustments",tooltipPlacement:"right",content:"Appearance",onSelect:()=>{t.openPrimary("appearance","right")},onDeselect:()=>t.closePrimary("right")}),e.jsx(SidebarIcon,{name:"transforms",active:a,iconName:"show-only-nearby",tooltipPlacement:"right",content:"Transforms",onSelect:()=>{t.openPrimary("transforms","right")},onDeselect:()=>t.closePrimary("right")}),e.jsx(SidebarIcon,{name:"settings",active:a,iconName:"gear",tooltipPlacement:"right",content:"Settings",onSelect:()=>{t.openPrimary("settings","right")},onDeselect:()=>t.closePrimary("right")})]})})}const VertexPopupButton=t=>{var{open:n,children:a}=t,i=__rest(t,["open","children"]);const s=a.find((e=>e.type===Anchor)),r=a.filter((e=>e.type!==Anchor));return null==s?e.jsx(e.Fragment,{}):e.jsxs(o.VertexPopover,Object.assign({className:"flex",placement:"top",backdrop:!1,open:asBooleanAttribute(n)},i,{children:[s,e.jsx("div",{className:l("flex mb-1.5",{hidden:!n}),"data-testid":"align-plane-popover-menu",children:r})]}))},Anchor=({tooltipContent:t,children:n})=>e.jsx("div",{slot:"anchor",children:e.jsx(o.VertexTooltip,{className:"cursor-pointer",content:t,children:n})});function VertexViewerToolbarDivider(){return e.jsx("div",{"data-testid":"toolbar-divider",className:"h-6 w-px bg-neutral-300 mx-1 items-center mt-1"})}function VertexViewerCrossSectionAlignmentPopoverMenu(){const t=useCrossSectioningActions(),a=n.useRecoilValue(G),i=n.useRecoilValue(N),getBaseIcon=()=>`align-to-${null==i?void 0:i.mode}`;return useStackKeyBinding({id:"CrossSectionAlignment",keyBind:"Escape",fn:t.cancelCurrentHit,addPredicate:()=>{var e;return null!==(e=null==i?void 0:i.hitPending)&&void 0!==e&&e},cancelPredicate:()=>!(null==i?void 0:i.hitPending)},[null==i?void 0:i.hitPending]),e.jsxs(VertexPopupButton,{"data-testid":"section-alignment-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(a),onDismissed:t.closeAlignmentTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Section Alignment",children:e.jsx(o.VertexIconButton,{"data-testid":"section-alignment-icon-button",iconName:getBaseIcon(),iconColor:"secondary",onClick:a?t.closeAlignmentTools:t.openAlignmentTools,children:e.jsx(o.VertexIcon,{"data-testid":"section-alignment-icon-chevron",name:"chevron-up",size:"sm"})})}),e.jsxs(c.VertexViewerToolbarGroup,{direction:"vertical",className:"flex justify-evenly items-center py-1 my-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(o.VertexIconButton,{iconColor:"secondary",onClick:()=>t.updateAlignment("global"),className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2","data-testid":"section-alignment-align-global",iconName:"align-to-global",variant:"plain",children:e.jsx("div",{className:"text-base ml-2",children:"Align to Global"})}),e.jsx(o.VertexIconButton,{iconColor:"secondary",onClick:()=>t.updateAlignment("surface"),className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2","data-testid":"section-alignment-align-surface",iconName:"align-to-surface",variant:"plain",children:e.jsx("div",{className:"text-base ml-2",children:"Align to Surface"})})]})]})}function VertexViewerCrossSectionAxisPopoverMenu(){const t=useCrossSectioningActions(),a=n.useRecoilValue(K),s=n.useRecoilValue(O),l=n.useRecoilValueLoadable(D),r=i.useMemo((()=>{const e=s.length>0&&"hasValue"===l.state?axis(s[0],xAxis(l.contents),yAxis(l.contents),zAxis(l.contents)):"x";return null!=e?`axis-${e}`:"axis-x"}),[l.state,l.contents,s]);return e.jsxs(VertexPopupButton,{"data-testid":"align-plane-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(a),onDismissed:t.closeAxisTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Align Plane",children:e.jsx(o.VertexIconButton,{onClick:a?t.closeAxisTools:t.openAxisTools,iconName:r,"data-testid":"align-plane-icon",iconColor:"secondary",children:e.jsx(o.VertexIcon,{"data-testid":"align-plane-icon-chevron",name:"chevron-up",size:"sm"})})}),e.jsxs(c.VertexViewerToolbarGroup,{direction:"vertical",className:"flex justify-evenly items-center py-1 my-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(o.VertexIconButton,{"data-testid":"align-plane-x-axis-button",className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2",onClick:()=>t.updateAxis("x"),variant:"plain",iconColor:"secondary",iconName:"axis-x",children:e.jsx("div",{className:"text-base ml-2",children:"X-axis Plane"})}),e.jsx(o.VertexIconButton,{className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2",variant:"plain",iconColor:"secondary",iconName:"axis-y","data-testid":"align-plane-y-axis-button",onClick:()=>t.updateAxis("y"),children:e.jsx("div",{className:"text-base ml-2",children:"Y-axis Plane"})}),e.jsx(o.VertexIconButton,{"data-testid":"align-plane-z-axis-button",className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2",onClick:()=>t.updateAxis("z"),variant:"plain",iconColor:"secondary",iconName:"axis-z",children:e.jsx("div",{className:"text-base ml-2",children:"Z-axis Plane"})})]})]})}function VertexViewerCrossSectionOffsetStepper({offset:t,onOffsetChange:a}){const s=n.useRecoilValue(Et),l=n.useRecoilValue(Rt),[r,c]=i.useState(convertTo(t,s));i.useEffect((()=>{c(convertTo(t,s))}),[s,t]);const u=createDistanceFormatter(s,parseInt(l,10)),handleIncrementalUpdate=e=>{const t=convertFrom(r+e,s);a(t)},handleSubmit=e=>{e.preventDefault(),a(convertFrom(r,s))},handleBlur=()=>{a(convertFrom(r,s))};return e.jsx(o.VertexTooltip,{content:"Plane Offset",children:e.jsx("form",{"data-testid":"cross-section-stepper-form",onSubmit:handleSubmit,children:e.jsxs(o.VertexTextfield,{"data-testid":"cross-section-stepper-input",className:"viewer-toolbar-input w-32 border-none ring-0 bg-white",type:"text",value:u(parseFloat(t.toFixed(3))),onInputInput:e=>{c(null!=e.detail.value?parseFloat(e.detail.value):t)},onBlur:handleBlur,children:[e.jsx("div",{"data-testid":"cross-section-stepper-decrement",className:"py-1 cursor-pointer",slot:"left",onClick:()=>handleIncrementalUpdate(-1),children:e.jsx(o.VertexIcon,{name:"chevron-left",size:"sm"})}),e.jsx("div",{"data-testid":"cross-section-stepper-increment",className:"py-1 cursor-pointer",slot:"right",onClick:()=>handleIncrementalUpdate(1),children:e.jsx(o.VertexIcon,{name:"chevron-right",size:"sm"})})]})})})}VertexPopupButton.Anchor=Anchor;const Gt=400;function VertexViewerCrossSectionPopupMenu(){const t=useCrossSectioningActions(),a=n.useRecoilValue(W),s=n.useRecoilValueLoadable(F),l=n.useRecoilValueLoadable(U),r=i.useRef(),u=i.useMemo((()=>"hasValue"===s.state?s.contents:E),[s.state,s.contents]),d=i.useMemo((()=>"hasValue"===l.state?l.contents:0),[l.state,l.contents]),handleCrossSectionValueChange=e=>{clearTimeout(r.current),r.current=window.setTimeout((()=>{t.endInteraction()}),Gt),t.beginInteraction(),t.updatePlanes(e)};return e.jsxs(VertexPopupButton,{"data-testid":"cross-section-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(a),onDismissed:t.closeAdditionalTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Section Tools",children:e.jsx("div",{className:"-ml-px py-1.5",children:e.jsx(o.VertexIcon,{"data-testid":"cross-section-popover-icon",name:"chevron-up",size:"sm",onClick:a?t.closeAdditionalTools:t.openAdditionalTools})})}),e.jsxs(c.VertexViewerToolbarGroup,{className:"relative bottom-3 flex justify-evenly items-center p-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(VertexViewerCrossSectionAlignmentPopoverMenu,{}),e.jsx(o.VertexTooltip,{className:"w-auto",content:"Reverse",children:e.jsx(o.VertexIconButton,{iconName:"flip","data-testid":"viewer-toolbar-flip-button",onClick:t.flipPlanes,iconColor:"secondary"})}),e.jsx(o.VertexTooltip,{className:"w-auto",content:"Align View to Plane",children:e.jsx(o.VertexIconButton,{"data-testid":"viewer-toolbar-align-view-to-plane-button",iconName:"align-view-to-plane",onClick:t.alignViewToPlane,iconColor:"secondary"})}),e.jsx(VertexViewerToolbarDivider,{}),e.jsx(VertexViewerCrossSectionAxisPopoverMenu,{}),e.jsx("div",{className:"w-52 mx-2",children:e.jsx(VertexSlider,{value:d,defaultValue:u.default,disabled:asBooleanAttribute("hasValue"!==s.state),min:u.min,max:u.max,step:.01,onChange:handleCrossSectionValueChange})}),e.jsx("div",{className:"px-4",children:e.jsx(VertexViewerCrossSectionOffsetStepper,{offset:"hasValue"===l.state?l.contents:0,onOffsetChange:handleCrossSectionValueChange})})]})]})}const VertexViewerCrossSectionButton=()=>{const t=useCrossSectioningActions(),a=n.useRecoilValue(R);return e.jsxs(e.Fragment,{children:[e.jsx(o.VertexTooltip,{content:a?"Hide Section":"Show Section",children:e.jsx(o.VertexIconButton,{"data-testid":"viewer-toolbar-cross-section-button",iconName:"cross-section",iconColor:a?"primary":"secondary",onClick:()=>a?t.disable():t.enable()})}),e.jsx(VertexViewerCrossSectionPopupMenu,{})]})},VertexFitAllButton=()=>{const t=n.useRecoilValue(g);return e.jsx(o.VertexTooltip,{content:"Fit All",children:e.jsx(o.VertexIconButton,{iconName:"fit-all",iconColor:"secondary","data-testid":"viewer-toolbar-fit-all-button",onClick:async()=>{const e=await(null==t?void 0:t.scene());await(null==e?void 0:e.camera().viewAll().render({animation:{milliseconds:500}}))}})})},VertexPanButton=()=>{const t=n.useRecoilValue(g),a=n.useRecoilValue(f),[s,l]=n.useRecoilState(b),[r,c]=n.useRecoilState(v);return i.useEffect((()=>{null!=t&&a&&c(t.getBaseInteractionHandler())}),[t,a,c]),e.jsx(o.VertexTooltip,{content:"Pan",children:e.jsx(o.VertexIconButton,{iconName:"pan",iconColor:"pan"===s?"primary":"secondary","data-testid":"viewer-toolbar-pan-button",onClick:async()=>{if(l("pan"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("pan")}}})})},VertexRotateButton=()=>{const t=n.useRecoilValue(g),a=n.useRecoilValue(f),[s,l]=n.useRecoilState(b),[r,c]=n.useRecoilState(v);return i.useEffect((()=>{null!=t&&a&&c(t.getBaseInteractionHandler())}),[t,a,c]),e.jsx(o.VertexTooltip,{content:"Rotate",children:e.jsx(o.VertexIconButton,{iconName:"rotate",iconColor:"rotate"===s?"primary":"secondary","data-testid":"viewer-toolbar-rotate-button",onClick:async()=>{if(l("rotate"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("rotate")}}})})},VertexZoomButton=()=>{const t=n.useRecoilValue(g),a=n.useRecoilValue(f),[s,l]=n.useRecoilState(b),[r,c]=n.useRecoilState(v);return i.useEffect((()=>{null!=t&&a&&c(t.getBaseInteractionHandler())}),[t,a,c]),e.jsx(o.VertexTooltip,{content:"Zoom",children:e.jsx(o.VertexIconButton,{iconName:"zoom",iconColor:"zoom"===s?"primary":"secondary","data-testid":"viewer-toolbar-zoom-button",onClick:async()=>{if(l("zoom"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("zoom")}}})})},DefaultToolbar=()=>e.jsx(c.VertexViewerToolbar,{placement:"bottom-center",children:e.jsxs(c.VertexViewerToolbarGroup,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(VertexRotateButton,{}),e.jsx(VertexPanButton,{}),e.jsx(VertexZoomButton,{}),e.jsx(VertexFitAllButton,{}),e.jsx(VertexViewerToolbarDivider,{}),e.jsx(VertexBoxSelectionButton,{}),e.jsx(VertexViewerToolbarDivider,{}),e.jsx(VertexViewerCrossSectionButton,{}),e.jsx(VertexViewerToolbarDivider,{}),e.jsx(VertexPointToPointMeasurementTool,{}),e.jsx(VertexPreciseMeasurementTool,{})]})}),VertexToolbar=({children:t})=>{const n=null!=t&&!1!==t;return e.jsx(c.VertexViewerToolbar,{placement:"bottom-center",children:n?e.jsx(c.VertexViewerToolbarGroup,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:t}):e.jsx(DefaultToolbar,{})})};function VertexTransformWidget({transformWidgetElement:t,supportUndo:a,onPositionChange:s,onRotationChange:o}){const l=useTransformActions(),r=n.useRecoilValue(Ye),u=n.useRecoilValue(We),d=n.useRecoilValue(Ge),m=n.useRecoilValue($e),p=n.useRecoilValueLoadable(qe),g=n.useRecoilValue(Et),h=n.useRecoilValue(Rt),f=i.useMemo((()=>"hasValue"===p.state?p.contents:m),[p,m]),v=i.useMemo((()=>{const e=undefined;return u&&(null!=f||r)}),[u,f,r]);return e.jsx(e.Fragment,{children:v&&e.jsx(c.VertexViewerTransformWidget,{id:"transform-widget","data-testid":"viewer-transform-widget",ref:t,position:d,rotation:null!=d?f:void 0,decimalPlaces:parseInt(h,10),distanceUnit:toUnitType(g),EXPERIMENTAL_undoKeybindings:null==a||a,onInteractionStarted:()=>{l.disableSelectionSync(),l.setIsInteractivelyTransforming(!0)},onInteractionEnded:()=>{l.invalidateTransforms(),l.setIsInteractivelyTransforming(!1)},onPositionChanged:async e=>{await l.setTransformWidgetPosition(e.detail),null==s||s(e.detail)},onRotationChanged:e=>{l.setTransformWidgetOrientation(e.detail),null==o||o(e.detail)}})})}const VertexViewerSceneReset=({onReset:t})=>{const n=useCrossSectioningActions(),a=useSelectionActions(),i=useTransformActions(),s=useViewerSceneActions(),handleReset=async()=>{await n.disable(),await a.resetSelectionState(),i.clearTransformWidgetPosition(),null==t||t(),await s.reset()};return e.jsx(o.VertexTooltip,{content:"Reset View",children:e.jsx(o.VertexIconButton,{iconName:"reset",className:"flex bg-white opacity-70 hover:opacity-100 text-neutral-900 hover:text-neutral-700 hover:bg-neutral-200 rounded p-1 cursor-pointer","data-testid":"viewer-reset-tool-button",onClick:handleReset,variant:"plain"})})};function useViewerFrameActions(){const e=useTransformActions();return{frameDrawn:useActionCallback((({set:t,snapshot:n})=>async a=>{const i=await n.getPromise(He);t(S,a.detail.scene),t(He,a.detail.scene.sceneViewSummary.selectedVisibleSummary),t(De,i);const s=undefined;await n.getPromise(We)&&await e.syncToSelection()}))}}const VertexBoxSelectionTool=()=>{const{element:t,callback:a}=useCallbackRef(),i=useBoxSelectionActions(),s=useTransformActions(),o=n.useRecoilValue(pe);return m.useEffect((()=>{const e=whenComponentReady(t,(()=>{var e;return[null===(e=null==t?void 0:t.model)||void 0===e?void 0:e.onDragComplete((()=>{"clearAndSelect"===o&&(s.clearTransformWidgetOrientation(),s.clearTransformWidgetPosition(),s.enableSelectionSync())}))]}));return()=>{null==e||e.then((e=>{null==e||e.forEach((e=>null==e?void 0:e.dispose()))}))}}),[t,o]),useApplyKeyBinding({keyBind:"Shift",fn:m.useCallback((()=>i.setOperationType("select")),[]),off:m.useCallback((()=>i.setOperationType("clearAndSelect")),[])}),e.jsx(c.VertexViewerBoxQueryTool,{ref:a,"data-testid":"viewer-box-query-tool",operationType:o})};function VertexViewerCameraTypeMenu({open:t,onOpen:a,onDismiss:i,onCameraTypeChange:s}){const r=useViewerCameraActions(),c=n.useRecoilValue(j);return e.jsxs(o.VertexMenu,{"data-testid":"camera-types-popover",className:"flex",placement:"bottom-end",open:asBooleanAttribute(t),onMenuClosed:i,children:[e.jsx("div",{slot:"anchor",children:e.jsx("div",{className:l("flex bg-white hover:opacity-100 hover:text-neutral-700 hover:bg-neutral-200 rounded",{"opacity-70 text-neutral-900":!t,"opacity-100 text-neutral-700 bg-neutral-200":t}),children:e.jsx(o.VertexTooltip,{content:"Change View",children:e.jsx(o.VertexIconButton,{"data-testid":"set-camera-mode-option",className:"p-1 cursor-pointer",variant:"plain",onClick:a,iconName:"orthographic"===c?"cube-orthographic":"cube-perspective",children:e.jsx(o.VertexIcon,{"data-testid":"change-camera-type-icon-button",name:"chevron-down",size:"sm"})})})})}),e.jsxs("div",{className:"w-36",children:[e.jsx("div",{className:"pt-1"}),e.jsxs(o.VertexMenuItem,{"data-testid":"set-perspective-view",onClick:()=>{r.updateCameraType("perspective"),null==s||s("perspective")},children:[e.jsx(o.VertexIcon,{slot:"icon","data-testid":"set-perspective-view-icon",name:"cube-perspective",size:"sm",className:l({"text-[var(--vertex-ui-blue-700)]":"perspective"===c})}),e.jsx("div",{className:l("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"perspective"===c}),children:"Perspective"})]}),e.jsxs(o.VertexMenuItem,{"data-testid":"set-orthographic-view",onClick:()=>{r.updateCameraType("orthographic"),null==s||s("orthographic")},children:[e.jsx(o.VertexIcon,{slot:"icon","data-testid":"set-orthographic-view-icon",name:"cube-orthographic",size:"sm",className:l({"text-[var(--vertex-ui-blue-700)]":"orthographic"===c})}),e.jsx("div",{className:l("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"orthographic"===c}),children:"Orthographic"})]})]})]})}const VertexViewerViewCube=t=>{var{placement:n,children:a}=t,s=__rest(t,["placement","children"]);const o=Array.isArray(a)?a:[a],l=o.filter((e=>!i.isValidElement(e)||e.type!==c.VertexViewerViewCube)).filter((e=>null!=e&&!1!==e)),r=o.find((e=>i.isValidElement(e)&&e.type===c.VertexViewerViewCube)),[u,d]=i.useState(!1);return e.jsxs(c.VertexViewerToolbar,{direction:"vertical","data-testid":"view-cube-toolbar",placement:null!=n?n:"top-right",children:[null!=r?r:e.jsx(c.VertexViewerViewCube,Object.assign({className:"m-7"},s)),0===l.length?e.jsxs("div",{className:"flex items-center justify-center mt-3 gap-1",children:[e.jsx(VertexViewerSceneReset,{}),e.jsx(VertexViewerCameraTypeMenu,{open:u,onDismiss:()=>d(!1),onOpen:()=>d(!0)})]}):e.jsx("div",{className:"mt-3",children:l})]})},VertexViewer=t=>{var{id:a,className:s,disableSelection:o,onTap:r,onLongpress:u,onFrameDrawn:d,onSceneReady:m,viewerRefCallback:p,children:v}=t,b=__rest(t,["id","className","disableSelection","onTap","onLongpress","onFrameDrawn","onSceneReady","viewerRefCallback","children"]);const V=n.useRecoilValue(Ot),S=useRecoilRef({state:g}),w=useViewerCameraActions(),C=useHitActions(),k=useSelectionActions(),A=useViewerFrameActions(),[T,P]=n.useRecoilState(f),E=n.useRecoilValue(j),R=n.useRecoilValue(N),I=n.useRecoilValue(me),[M,O]=n.useRecoilState(h);i.useEffect((()=>{null!=a&&O(a)}),[a]);const L=n.useRecoilValue(kt),B=i.useMemo((()=>({opacity:L/100})),[L]),_=n.useRecoilValue(ie),D=n.useRecoilValue(se),H=i.useMemo((()=>({color:_,width:D})),[_,D]),F=n.useRecoilValue(xt),U=n.useRecoilValue(vt),W=n.useRecoilValue(yt),G=n.useRecoilValue(bt),K=i.useMemo((()=>({color:U,opacity:W/100,lineWidth:G})),[U,W,G]),q=n.useRecoilValue(ve),$=null!=v&&!1!==v;return useKeyBindings(),useDefaultKeybindings(),e.jsxs(c.VertexViewer,Object.assign({id:M,"data-testid":"vertex-viewer",ref:null!=p?p:S,className:l("flex w-full h-full",s,{"cursor-crosshair":R.hitPending}),style:{"--viewer-background":F},config:V,cameraType:T?E:void 0,onCameraTypeChanged:e=>{T&&w.updateCameraType(e.detail)},phantom:B,featureLines:H,selectionHighlighting:K,featureMaps:q?"final":void 0,onTap:e=>{const t=[...o?[]:[k.selectCurrentHit]];C.tap(e,...t),null==r||r(e)},onLongpress:e=>{C.longPress(e),null==u||u(e)},onFrameDrawn:e=>{A.frameDrawn(e),null==d||d(e)},onSceneReady:e=>{T||P(!0),null==m||m(e)}},b,{children:[I&&e.jsx(VertexBoxSelectionTool,{}),$?v:e.jsxs(e.Fragment,{children:[e.jsx(VertexViewerViewCube,{}),e.jsx(VertexToolbar,{}),e.jsx(VertexViewerContextMenu,{})]})]}))};function toSdkConfig(e){return isOnlyNetworkConfig(e)?{network:e}:e}function isOnlyNetworkConfig(e){const t=undefined;return null!=e.renderingHost}const VertexViewerToolkitEventListener=({onHitStateChange:t,onSelectionStateChange:a})=>{const s=n.useRecoilValue(et),o=n.useRecoilValue(nt);return i.useEffect((()=>{null==t||t(s)}),[s,t]),i.useEffect((()=>{null==a||a(o)}),[o,a]),e.jsx(e.Fragment,{})},VertexViewerToolkitRoot=t=>{var{override:a,autoDefineCustomElements:s,children:o,config:l}=t,r=__rest(t,["override","autoDefineCustomElements","children","config"]);return i.useEffect((()=>{(null==s||s)&&(d.defineCustomElements(),u.defineCustomElements())}),[s]),e.jsx(n.RecoilRoot,{override:a,children:e.jsxs(e.Fragment,{children:[e.jsx(VertexViewerToolkitEventListener,Object.assign({},r)),e.jsx(VertexViewerToolkitRootConfig,{config:l,children:o})]})})},VertexViewerToolkitRootConfig=({config:t,children:a})=>{const s=n.useSetRecoilState(Ot);return i.useEffect((()=>{const e=null!=t?toSdkConfig(t):void 0;s(e)}),[t,s]),e.jsx(e.Fragment,{children:a})};var Kt=Object.freeze({__proto__:null,get AssemblyFontFace(){return Nt}});exports.CrossSection=te,exports.Hits=tt,exports.SceneTree=Kt,exports.Selection=at,exports.VertexApplicationMessages=VertexApplicationMessages,exports.VertexBoxSelectionButton=VertexBoxSelectionButton,exports.VertexContextMenu=VertexContextMenu,exports.VertexCrossSectionAppearanceColorPicker=VertexCrossSectionAppearanceColorPicker,exports.VertexCrossSectionAppearanceControls=VertexCrossSectionAppearanceControls,exports.VertexCrossSectionAppearanceLineThicknessSlider=VertexCrossSectionAppearanceLineThicknessSlider,exports.VertexCrossSectionAppearancePanelSection=VertexCrossSectionAppearancePanelSection,exports.VertexCrossSectionAppearanceReset=VertexCrossSectionAppearanceReset,exports.VertexDecimalPlaceSelector=VertexDecimalPlaceSelector,exports.VertexFeatureEdgesColorPicker=VertexFeatureEdgesColorPicker,exports.VertexFeatureEdgesControls=VertexFeatureEdgesControls,exports.VertexFeatureEdgesPanelSection=VertexFeatureEdgesPanelSection,exports.VertexFeatureEdgesReset=VertexFeatureEdgesReset,exports.VertexFeatureEdgesThicknessSlider=VertexFeatureEdgesThicknessSlider,exports.VertexFitAllButton=VertexFitAllButton,exports.VertexFitSelectedMenuItem=VertexFitSelectedMenuItem,exports.VertexFlyToMenuItem=VertexFlyToMenuItem,exports.VertexGhostingControls=VertexGhostingControls,exports.VertexGhostingPanelSection=VertexGhostingPanelSection,exports.VertexHideAllMenuItem=VertexHideAllMenuItem,exports.VertexHidePartMenuItem=VertexHidePartMenuItem,exports.VertexHideSelectedMenuItem=VertexHideSelectedMenuItem,exports.VertexLengthUnitSelector=VertexLengthUnitSelector,exports.VertexMaterialControls=VertexMaterialControls,exports.VertexMaterialPanelSection=VertexMaterialPanelSection,exports.VertexMeasurementContextMenu=VertexMeasurementContextMenu,exports.VertexMeasurementDetails=VertexMeasurementDetails,exports.VertexPanButton=VertexPanButton,exports.VertexPointToPointMeasurement=VertexPointToPointMeasurement,exports.VertexPointToPointMeasurementTool=VertexPointToPointMeasurementTool,exports.VertexPreciseMeasurement=VertexPreciseMeasurement,exports.VertexPreciseMeasurementTool=VertexPreciseMeasurementTool,exports.VertexResizableContent=VertexResizableContent,exports.VertexRotateButton=VertexRotateButton,exports.VertexSceneItemGhostingClear=VertexSceneItemGhostingClear,exports.VertexSceneItemGhostingOpacitySlider=VertexSceneItemGhostingOpacitySlider,exports.VertexSceneItemGhostingToggle=VertexSceneItemGhostingToggle,exports.VertexSceneItemMaterialClear=VertexSceneItemMaterialClear,exports.VertexSceneItemMaterialColorPicker=VertexSceneItemMaterialColorPicker,exports.VertexSceneItemMaterialOpacitySlider=VertexSceneItemMaterialOpacitySlider,exports.VertexSceneTree=VertexSceneTree,exports.VertexSceneTreeContextMenu=VertexSceneTreeContextMenu,exports.VertexSceneTreeHeader=VertexSceneTreeHeader,exports.VertexSceneTreeTableLayout=VertexSceneTreeTableLayout,exports.VertexSelectionHighlightingColorPicker=VertexSelectionHighlightingColorPicker,exports.VertexSelectionHighlightingControls=VertexSelectionHighlightingControls,exports.VertexSelectionHighlightingLineThicknessSlider=VertexSelectionHighlightingLineThicknessSlider,exports.VertexSelectionHighlightingOpacitySlider=VertexSelectionHighlightingOpacitySlider,exports.VertexSelectionHighlightingPanelSection=VertexSelectionHighlightingPanelSection,exports.VertexSelectionHighlightingReset=VertexSelectionHighlightingReset,exports.VertexShowAllMenuItem=VertexShowAllMenuItem,exports.VertexShowOnlyMenuItem=VertexShowOnlyMenuItem,exports.VertexShowOnlySelectedMenuItem=VertexShowOnlySelectedMenuItem,exports.VertexToolbar=VertexToolbar,exports.VertexTransformClear=VertexTransformClear,exports.VertexTransformControls=VertexTransformControls,exports.VertexTransformManipulatorToggle=VertexTransformManipulatorToggle,exports.VertexTransformPanelSection=VertexTransformPanelSection,exports.VertexTransformWidget=VertexTransformWidget,exports.VertexUnitsControls=VertexUnitsControls,exports.VertexUnitsPanelSection=VertexUnitsPanelSection,exports.VertexViewer=VertexViewer,exports.VertexViewerBackgroundColorPicker=VertexViewerBackgroundColorPicker,exports.VertexViewerBackgroundControls=VertexViewerBackgroundControls,exports.VertexViewerBackgroundPanelSection=VertexViewerBackgroundPanelSection,exports.VertexViewerBackgroundReset=VertexViewerBackgroundReset,exports.VertexViewerContextMenu=VertexViewerContextMenu,exports.VertexViewerCrossSectionButton=VertexViewerCrossSectionButton,exports.VertexViewerRightOpenedPanel=VertexViewerRightOpenedPanel,exports.VertexViewerRightSidebar=VertexViewerRightSidebar,exports.VertexViewerSceneReset=VertexViewerSceneReset,exports.VertexViewerToolbarDivider=VertexViewerToolbarDivider,exports.VertexViewerToolkitRoot=VertexViewerToolkitRoot,exports.VertexViewerViewCube=VertexViewerViewCube,exports.VertexZoomButton=VertexZoomButton;
|
|
2
2
|
//# sourceMappingURL=bundle.cjs.js.map
|