@vertexvis/viewer-toolkit-react 0.0.5-canary.2 → 0.0.5-canary.21

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.
Files changed (101) hide show
  1. package/dist/bundle.cjs.js +14 -2
  2. package/dist/bundle.cjs.js.map +1 -1
  3. package/dist/bundle.esm.js +14 -2
  4. package/dist/bundle.esm.js.map +1 -1
  5. package/dist/components/appearance/material/__tests__/scene-item-material-color-swatch.spec.d.ts +1 -0
  6. package/dist/components/appearance/material/__tests__/scene-item-material-color-swatches.spec.d.ts +1 -0
  7. package/dist/components/appearance/material/__tests__/scene-item-material-opacity-slider.spec.d.ts +1 -0
  8. package/dist/components/appearance/material/material-controls.d.ts +11 -0
  9. package/dist/components/appearance/material/material-panel-section.d.ts +13 -0
  10. package/dist/components/appearance/material/scene-item-material-color-swatch-context-menu.d.ts +4 -0
  11. package/dist/components/appearance/material/scene-item-material-color-swatch.d.ts +10 -0
  12. package/dist/components/appearance/material/scene-item-material-color-swatches.d.ts +7 -0
  13. package/dist/components/common/copy-button.d.ts +9 -0
  14. package/dist/components/context-menu/menu-items/show-properties-menu-item.d.ts +1 -0
  15. package/dist/components/measurement/measurement-details.d.ts +3 -2
  16. package/dist/components/measurement/point-to-point-measurement.d.ts +3 -2
  17. package/dist/components/measurement/precise-measurement.d.ts +3 -2
  18. package/dist/components/metadata/__tests__/metadata-panel.spec.d.ts +1 -0
  19. package/dist/components/metadata/__tests__/metadata-property-value.spec.d.ts +1 -0
  20. package/dist/components/metadata/metadata-panel-contents.d.ts +6 -0
  21. package/dist/components/metadata/metadata-panel.d.ts +4 -0
  22. package/dist/components/metadata/metadata-property-value.d.ts +6 -0
  23. package/dist/components/scene-tree/__tests__/scene-tree-secondary-panel.spec.d.ts +1 -0
  24. package/dist/components/scene-tree/scene-tree-columns/__tests__/scene-tree-custom-column.spec.d.ts +1 -0
  25. package/dist/components/scene-tree/scene-tree-columns/__tests__/scene-tree-metadata-columns.spec.d.ts +1 -0
  26. package/dist/components/scene-tree/scene-tree-columns/scene-tree-custom-column.d.ts +10 -0
  27. package/dist/components/scene-tree/scene-tree-columns/scene-tree-metadata-columns.d.ts +9 -0
  28. package/dist/components/scene-tree/scene-tree-secondary-panel.d.ts +6 -0
  29. package/dist/components/scene-tree/scene-tree-table-layout.d.ts +29 -0
  30. package/dist/components/scene-tree/scene-tree.d.ts +33 -0
  31. package/dist/components/sidebar/viewer-right-sidebar/viewer-right-open-panel.d.ts +14 -1
  32. package/dist/components/sidebar/viewer-right-sidebar/viewer-right-panel-header.d.ts +4 -1
  33. package/dist/components/sidebar/viewer-right-sidebar/viewer-right-sidebar.d.ts +17 -1
  34. package/dist/components/toolbar/cross-section/cross-section-alignment-popover-menu.d.ts +5 -1
  35. package/dist/components/toolbar/cross-section/cross-section-axis-popover-menu.d.ts +5 -1
  36. package/dist/components/toolbar/cross-section/cross-section-offset-stepper.d.ts +2 -1
  37. package/dist/components/transforms/transform-controls.d.ts +3 -1
  38. package/dist/components/transforms/transform-inputs.d.ts +5 -0
  39. package/dist/components/transforms/transform-numeric-field.d.ts +14 -0
  40. package/dist/components/transforms/transform-panel-section.d.ts +3 -1
  41. package/dist/components/viewer/vertex-viewer.d.ts +1 -1
  42. package/dist/index.css +2 -2
  43. package/dist/index.d.ts +31 -9
  44. package/dist/state/appearance/actions.d.ts +6 -0
  45. package/dist/state/appearance/index.d.ts +2 -0
  46. package/dist/state/appearance/material.d.ts +3 -0
  47. package/dist/state/appearance/types.d.ts +2 -0
  48. package/dist/state/context-menu/actions.d.ts +2 -1
  49. package/dist/state/context-menu/context-menu.d.ts +1 -0
  50. package/dist/state/messages/messages.d.ts +1 -0
  51. package/dist/state/metadata/__tests__/actions.spec.d.ts +1 -0
  52. package/dist/state/metadata/actions.d.ts +6 -0
  53. package/dist/state/metadata/index.d.ts +2 -0
  54. package/dist/state/metadata/metadata.d.ts +13 -0
  55. package/dist/state/metadata/types.d.ts +7 -0
  56. package/dist/state/panel/actions.d.ts +3 -1
  57. package/dist/state/panel/panel.d.ts +5 -3
  58. package/dist/state/scene-tree/columns/columns.d.ts +1 -0
  59. package/dist/state/scene-tree/columns/index.d.ts +1 -1
  60. package/dist/state/scene-tree/columns/{open-column-popover.d.ts → open-positioned-popover.d.ts} +4 -5
  61. package/dist/state/scene-tree/core/actions.d.ts +4 -0
  62. package/dist/state/scene-tree/core/core.d.ts +3 -0
  63. package/dist/state/scene-tree/index.d.ts +5 -0
  64. package/dist/state/scene-tree/metadata/index.d.ts +1 -0
  65. package/dist/state/scene-tree/metadata/metadata.d.ts +2 -0
  66. package/dist/state/scene-tree/search/actions.d.ts +3 -2
  67. package/dist/state/scene-tree/search/search.d.ts +1 -0
  68. package/dist/state/scene-tree/types.d.ts +5 -0
  69. package/dist/state/scene-view-item/actions.d.ts +8 -0
  70. package/dist/state/scene-view-item/index.d.ts +2 -0
  71. package/dist/state/scene-view-item/items.d.ts +2 -0
  72. package/dist/state/selection/selection.d.ts +3 -0
  73. package/dist/state/transforms/actions.d.ts +3 -1
  74. package/dist/state/transforms/edit-transforms.d.ts +10 -0
  75. package/dist/state/transforms/index.d.ts +1 -0
  76. package/dist/state/transforms/transforms.d.ts +55 -9
  77. package/dist/state/viewer/camera/__tests__/actions.spec.d.ts +1 -0
  78. package/dist/state/viewer/camera/actions.d.ts +1 -1
  79. package/dist/state/viewer/core/core.d.ts +1 -0
  80. package/dist/state/viewer/scene/scene.d.ts +0 -2
  81. package/dist/testing/color-materials.d.ts +1 -0
  82. package/dist/util/popover/popover.d.ts +1 -0
  83. package/dist/util/react/children.d.ts +5 -0
  84. package/dist/util/refs/__tests__/when-component-ready.spec.d.ts +1 -0
  85. package/dist/util/refs/when-component-ready.d.ts +1 -1
  86. package/dist/util/state/synced-value.d.ts +5 -0
  87. package/dist/util/transforms/transforms.d.ts +6 -0
  88. package/package.json +14 -9
  89. package/dist/components/appearance/material-controls.d.ts +0 -7
  90. package/dist/components/appearance/material-panel-section.d.ts +0 -9
  91. package/dist/components/scene-tree/vertex-scene-tree-table-layout.d.ts +0 -3
  92. package/dist/components/scene-tree/vertex-scene-tree.d.ts +0 -14
  93. /package/dist/components/appearance/{__tests__ → material/__tests__}/scene-item-material-color-picker.spec.d.ts +0 -0
  94. /package/dist/components/appearance/{__tests__/scene-item-material-opacity-slider.spec.d.ts → material/__tests__/scene-item-material-color-swatch-context-menu.spec.d.ts} +0 -0
  95. /package/dist/components/appearance/{scene-item-material-apply-all-confirmation-dialog.d.ts → material/scene-item-material-apply-all-confirmation-dialog.d.ts} +0 -0
  96. /package/dist/components/appearance/{scene-item-material-apply-all.d.ts → material/scene-item-material-apply-all.d.ts} +0 -0
  97. /package/dist/components/appearance/{scene-item-material-clear.d.ts → material/scene-item-material-clear.d.ts} +0 -0
  98. /package/dist/components/appearance/{scene-item-material-color-picker.d.ts → material/scene-item-material-color-picker.d.ts} +0 -0
  99. /package/dist/components/appearance/{scene-item-material-opacity-slider.d.ts → material/scene-item-material-opacity-slider.d.ts} +0 -0
  100. /package/dist/components/scene-tree/{vertex-scene-tree-header.d.ts → scene-tree-header.d.ts} +0 -0
  101. /package/dist/util/{measurement/units.d.ts → numbers/distance-units.d.ts} +0 -0
@@ -1,7 +1,19 @@
1
- import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import a from"quick-format-unescaped";import{useRecoilCallback as i,atom as l,selector as o,useRecoilValue as s,useRecoilState as r,useSetRecoilState as c,atomFamily as d,useRecoilValueLoadable as u,RecoilRoot as m}from"recoil";import*as p from"react";import h,{useEffect as g,useCallback as f,useRef as v,useState as b,useMemo as C}from"react";import{Vector3 as w,BoundingBox as S,Angle as k,Point as A}from"@vertexvis/geometry";import{VertexColorPicker as T,VertexSlider as E,VertexTooltip as P,VertexIconButton as O,VertexDialog as N,VertexToggle as M,VertexButton as I,VertexDropdownMenu as V,VertexIcon as L,VertexMenuItem as R,VertexResizable as _,VertexMenu as B,VertexMenuDivider as D,VertexDraggablePopover as j,VertexBanner as H,VertexToast as F,VertexPopover as U,VertexTextfield as W,VertexSelect as G}from"@vertexvis/ui-react";import{ColorMaterial as K}from"@vertexvis/viewer";import{VertexViewerMeasurementDetails as $,VertexViewerMeasurementDistance as Y,VertexViewerMeasurementPrecise as X,VertexSceneTreeNotificationBanner as q,VertexSceneTreeSearch as Z,VertexSceneTreeToolbar as J,VertexSceneTreeTableLayout as Q,VertexSceneTreeTableColumn as ee,VertexSceneTree as te,VertexViewerToolbarGroup as ne,VertexViewerToolbar as ae,VertexViewerTransformWidget as ie,VertexViewerBoxQueryTool as le,VertexViewerViewCube as oe,VertexViewer as se}from"@vertexvis/viewer-react";import{defineCustomElements as re}from"@vertexvis/ui/loader";import{defineCustomElements as ce}from"@vertexvis/viewer/loader";var extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},extendStatics(e,t)};function __extends(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function __(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}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 __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),i,l=[],o;try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)l.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return l}"function"==typeof SuppressedError&&SuppressedError;var de={exports:{}};const ue=a;de.exports=pino;const me=pfGlobalThisOrFallback().console||{},pe={mapHttpRequest:mock,mapHttpResponse:mock,wrapRequestSerializer:passthrough,wrapResponseSerializer:passthrough,wrapErrorSerializer:passthrough,req:mock,res:mock,err:asErrValue,errWithCause:asErrValue};function levelToValue(e,t){return"silent"===e?1/0:t.levels.values[e]}const he=Symbol("pino.logFuncs"),ge=Symbol("pino.hierarchy"),fe={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function appendChildLogger(e,t){const n={logger:t,parent:e[ge]};t[ge]=n}function setupBaseLogFunctions(e,t,n){const a={};t.forEach((e=>{a[e]=n[e]?n[e]:me[e]||me[fe[e]||"log"]||noop})),e[he]=a}function shouldSerialize(e,t){if(Array.isArray(e)){const t=undefined;return e.filter((function(e){return"!stdSerializers.err"!==e}))}return!0===e&&Object.keys(t)}function pino(e){(e=e||{}).browser=e.browser||{};const t=e.browser.transmit;if(t&&"function"!=typeof t.send)throw Error("pino: transmit option must have a send function");const n=e.browser.write||me;e.browser.write&&(e.browser.asObject=!0);const a=e.serializers||{},i=shouldSerialize(e.browser.serialize,a);let l=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(l=!1);const o=Object.keys(e.customLevels||{}),s=["error","fatal","warn","info","debug","trace"].concat(o);"function"==typeof n&&s.forEach((function(e){n[e]=n})),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");const r=e.level||"info",c=Object.create(n);c.log||(c.log=noop),setupBaseLogFunctions(c,s,n),appendChildLogger({},c),Object.defineProperty(c,"levelVal",{get:getLevelVal}),Object.defineProperty(c,"level",{get:getLevel,set:setLevel});const d={transmit:t,serialize:i,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:s,timestamp:getTimeFunction(e),messageKey:e.messageKey||"msg",onChild:e.onChild||noop};function getLevelVal(){return levelToValue(this.level,this)}function getLevel(){return this._level}function setLevel(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,set(this,d,c,"error"),set(this,d,c,"fatal"),set(this,d,c,"warn"),set(this,d,c,"info"),set(this,d,c,"debug"),set(this,d,c,"trace"),o.forEach((e=>{set(this,d,c,e)}))}function child(n,l,o){if(!l)throw new Error("missing bindings for child Pino");o=o||{},i&&l.serializers&&(o.serializers=l.serializers);const s=o.serializers;if(i&&s){var r=Object.assign({},a,s),c=!0===e.browser.serialize?Object.keys(r):i;delete l.serializers,applySerializers([l],c,r,this._stdErrSerialize)}function Child(e){this._childLevel=1+(0|e._childLevel),this.bindings=l,r&&(this.serializers=r,this._serialize=c),t&&(this._logEvent=createLogEventShape([].concat(e._logEvent.bindings,l)))}Child.prototype=this;const d=new Child(this);return appendChildLogger(this,d),d.child=function(...e){return child.call(this,n,...e)},d.level=o.level||this.level,n.onChild(d),d}return c.levels=getLevels(e),c.level=r,c.isLevelEnabled=function(e){return!!this.levels.values[e]&&this.levels.values[e]>=this.levels.values[this.level]},c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=noop,c.serializers=a,c._serialize=i,c._stdErrSerialize=l,c.child=function(...e){return child.call(this,d,...e)},t&&(c._logEvent=createLogEventShape()),c}function getLevels(e){const t=e.customLevels||{},n=undefined,a=undefined;return{values:Object.assign({},pino.levels.values,t),labels:Object.assign({},pino.levels.labels,invertObject(t))}}function invertObject(e){const t={};return Object.keys(e).forEach((function(n){t[e[n]]=n})),t}function getBindingChain(e){const t=[];e.bindings&&t.push(e.bindings);let n=e[ge];for(;n.parent;)n=n.parent,n.logger.bindings&&t.push(n.logger.bindings);return t.reverse()}function set(e,t,n,a){if(Object.defineProperty(e,a,{value:levelToValue(e.level,n)>levelToValue(a,n)?noop:n[he][a],writable:!0,enumerable:!0,configurable:!0}),e[a]===noop){if(!t.transmit)return;const i=undefined,l=levelToValue(t.transmit.level||e.level,n),o=undefined;if(levelToValue(a,n)<l)return}e[a]=createWrap(e,t,n,a);const i=getBindingChain(e);0!==i.length&&(e[a]=prependBindingsInArguments(i,e[a]))}function prependBindingsInArguments(e,t){return function(){return t.apply(this,[...e,...arguments])}}function createWrap(e,t,n,a){return i=e[he][a],function LOG(){const l=t.timestamp(),o=new Array(arguments.length),s=Object.getPrototypeOf&&Object.getPrototypeOf(this)===me?me:this;for(var r=0;r<o.length;r++)o[r]=arguments[r];var c=!1;if(t.serialize&&(applySerializers(o,this._serialize,this.serializers,this._stdErrSerialize),c=!0),t.asObject||t.formatters?i.call(s,...asObject(this,a,o,l,t)):i.apply(s,o),t.transmit){const i=void 0,s=levelToValue(t.transmit.level||e._level,n),r=levelToValue(a,n);if(r<s)return;transmit(this,{ts:l,methodLevel:a,methodValue:r,transmitValue:n.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:levelToValue(e._level,n)},o,c)}};var i}function asObject(e,t,n,a,i){const{level:l,log:o=e=>e}=i.formatters||{},s=n.slice();let r=s[0];const c={};let d=1+(0|e._childLevel);if(d<1&&(d=1),a&&(c.time=a),l){const n=l(t,e.levels.values[t]);Object.assign(c,n)}else c.level=e.levels.values[t];if(i.asObjectBindingsOnly){if(null!==r&&"object"==typeof r)for(;d--&&"object"==typeof s[0];)Object.assign(c,s.shift());const e=undefined;return[o(c),...s]}{if(null!==r&&"object"==typeof r){for(;d--&&"object"==typeof s[0];)Object.assign(c,s.shift());r=s.length?ue(s.shift(),s):void 0}else"string"==typeof r&&(r=ue(s.shift(),s));void 0!==r&&(c[i.messageKey]=r);const e=undefined;return[o(c)]}}function applySerializers(e,t,n,a){for(const i in e)if(a&&e[i]instanceof Error)e[i]=pino.stdSerializers.err(e[i]);else if("object"==typeof e[i]&&!Array.isArray(e[i])&&t)for(const a in e[i])t.indexOf(a)>-1&&a in n&&(e[i][a]=n[a](e[i][a]))}function transmit(e,t,n,a=!1){const i=t.send,l=t.ts,o=t.methodLevel,s=t.methodValue,r=t.val,c=e._logEvent.bindings;a||applySerializers(n,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=l,e._logEvent.messages=n.filter((function(e){return-1===c.indexOf(e)})),e._logEvent.level.label=o,e._logEvent.level.value=s,i(o,e._logEvent,r),e._logEvent=createLogEventShape(c)}function createLogEventShape(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function asErrValue(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const n in e)void 0===t[n]&&(t[n]=e[n]);return t}function getTimeFunction(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?nullTime:epochTime}function mock(){return{}}function passthrough(e){return e}function noop(){}function nullTime(){return!1}function epochTime(){return Date.now()}function unixTime(){return Math.round(Date.now()/1e3)}function isoTime(){return new Date(Date.now()).toISOString()}function pfGlobalThisOrFallback(){function defd(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(e){return defd(self)||defd(window)||defd(this)||{}}}var ve;pino.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},pino.stdSerializers=pe,pino.stdTimeFunctions=Object.assign({},{nullTime:nullTime,epochTime:epochTime,unixTime:unixTime,isoTime:isoTime}),de.exports.default=pino,de.exports.pino=pino;const ye=(0,de.exports)({formatters:{level:e=>({level:e})}}),logger_error=(e,t)=>{null!=t?ye.error(t,e):ye.error(e)},logger_info=(e,t)=>{null!=t?ye.info(t,e):ye.info(e)},logger_warn=(e,t)=>{null!=t?ye.warn(t,e):ye.warn(e)},logger_debug=(e,t)=>{null!=t?ye.debug(t,e):ye.debug(e)};class be{}function useActionCallback(e,t=[]){const n=undefined;return i((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)}})}))),t instanceof be?void 0:t)}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 t=>{try{return{value:await e.getPromise(t)}}catch(e){return logger_debug(`Error encountered retrieving Recoil value. [key={${t.key}}]`,e),{error:e}}}}var Ce=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,we=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(.+)\s*\)/,Se=/^(#|0x)?([A-Fa-f0-9]{6})$/,create$2=function(e,t,n,a){return void 0===a&&(a=255),{r:e,g:t,b:n,a:a}},fromNumber=function(e){var t=16777215&e;return create$2(t>>16&255,t>>8&255,255&t)},fromHexString=function(e){var t=Se.exec(e);if(null!=t)return fromNumber(parseInt(t[2],16))},fromCss=function(e){var t=Ce.exec(e);if(null!=t)return create$2(parseInt(t[1]),parseInt(t[2]),parseInt(t[3]));var n=we.exec(e);return null!=n?create$2(parseInt(n[1]),parseInt(n[2]),parseInt(n[3]),Math.floor(255*parseFloat(n[4]))):Se.test(e)?fromHexString(e):void 0},fromArray=function(e){return create$2(e[0],e[1],e[2],e[3])},isInvisible=function(e){return 0===e.a},isOpaque=function(e){return 255===e.a},toHexString=function(e){return"#".concat(componentToHex(e.r)).concat(componentToHex(e.g)).concat(componentToHex(e.b))},componentToHex=function(e){var t=e.toString(16);return 1===t.length?"0"+t:t},xe=Object.freeze({__proto__:null,create:create$2,fromNumber:fromNumber,fromHexString:fromHexString,fromCss:fromCss,fromArray:fromArray,isInvisible:isInvisible,isOpaque:isOpaque,toHexString:toHexString}),ke;!function(e){function MapperValidationError(t){var n=e.call(this,"Validation error mapping object.")||this;return n.errors=t,Object.setPrototypeOf(n,MapperValidationError.prototype),n}__extends(MapperValidationError,e)}(Error);var Ae=new Uint8Array(16);function rng(){if(!ke&&!(ke="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ke(Ae)}var Te=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function validate(e){return"string"==typeof e&&Te.test(e)}for(var Ee=[],Pe=0;Pe<256;++Pe)Ee.push((Pe+256).toString(16).substr(1));function stringify(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Ee[e[t+0]]+Ee[e[t+1]]+Ee[e[t+2]]+Ee[e[t+3]]+"-"+Ee[e[t+4]]+Ee[e[t+5]]+"-"+Ee[e[t+6]]+Ee[e[t+7]]+"-"+Ee[e[t+8]]+Ee[e[t+9]]+"-"+Ee[e[t+10]]+Ee[e[t+11]]+Ee[e[t+12]]+Ee[e[t+13]]+Ee[e[t+14]]+Ee[e[t+15]]).toLowerCase();if(!validate(n))throw TypeError("Stringified UUID is invalid");return n}function v4(e,t,n){var a=(e=e||{}).random||(e.rng||rng)();return a[6]=15&a[6]|64,a[8]=63&a[8]|128,stringify(a)}function create$1(){return v4()}function fromMsbLsb(e,t){function digits(e,t){var n=BigInt(1)<<t*BigInt(4);return(n|e&n-BigInt(1)).toString(16).substring(1)}var n="string"==typeof e?BigInt(e):e,a="string"==typeof t?BigInt(t):t,i=digits(n>>BigInt(32),BigInt(8)),l=digits(n>>BigInt(16),BigInt(4)),o=digits(n,BigInt(4)),s=digits(a>>BigInt(48),BigInt(4)),r=digits(a,BigInt(12));return"".concat(i,"-").concat(l,"-").concat(o,"-").concat(s,"-").concat(r)}function toMsbLsb(e){var t=__read(e.split("-"),5),n=t[0],a=t[1],i=t[2],l=t[3],o=t[4];if(null==n||null==a||null==i||null==l||null==o)throw new Error("Invalid UUID string ".concat(e));var s=BigInt.asIntN(64,BigInt("0x".concat(n+a+i))),r=BigInt.asIntN(64,BigInt("0x".concat(l+o)));return{msb:s.toString(),lsb:r.toString()}}var Oe=Object.freeze({__proto__:null,create:create$1,fromMsbLsb:fromMsbLsb,toMsbLsb:toMsbLsb});const Ne=l({key:"viewerToolkitViewerElement",default:void 0,dangerouslyAllowMutability:!0}),Me=l({key:"viewerElementId",default:"vertex-viewer"}),Ie=l({key:"viewerInitialSceneReady",default:!1}),Ve=l({key:"viewerBaseInteractionHandlerProvider",default:Promise.resolve(void 0),dangerouslyAllowMutability:!0}),Le=l({key:"viewerPrimaryInteractionType",default:"rotate"}),Re=o({key:"viewerScene",get:({get:e})=>async()=>{var t;return null===(t=e(Ne))||void 0===t?void 0:t.scene()},dangerouslyAllowMutability:!0}),_e=l({key:"viewerFrameScene",default:void 0,dangerouslyAllowMutability:!0}),Be=o({key:"viewerSceneVisibleBoundingBox",get:({get:e})=>{var t;return null===(t=e(_e))||void 0===t?void 0:t.boundingBox}});function useViewerSceneActions(){const e=useActionCallback((({snapshot:e})=>async(t,n,...a)=>{const i=await e.getPromise(Re),l=await i();a.length>0&&await(null==l?void 0:l.items((e=>a.map((t=>t(e))))).execute({suppliedCorrelationId:n}))})),t=h.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).select()),[]),n=h.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).deselect()),[]),a=h.useCallback((e=>e.where((e=>e.all())).deselect()),[]);return{executeWithCorrelationId:e,execute:useActionCallback((()=>async(t,...n)=>{const a=Oe.create();await e(t,a,...n)})),selectItemsTransform:t,deselectItemsTransform:n,clearSelectionTransform:a,reset:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromiseRequired(Re),a=await n(),i=await e.getPromiseRequired(ze);null==a||a.reset({includeCamera:!0,suppliedCorrelationId:t,cameraTypeOverride:i})}))}}const De=500;function useViewerCameraActions(){return{flyToById:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(Re),i=await a();await(null==i?void 0:i.camera().flyTo({itemId:t}).render({animation:{milliseconds:null!=n?n:De}}))})),flyToByBoundingBox:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(Re),i=await a();await(null==i?void 0:i.camera().flyTo({boundingBox:t}).render({animation:{milliseconds:null!=n?n:De}}))})),updateCameraType:useActionCallback((({set:e})=>t=>{e(ze,t)}))}}const ze=l({key:"viewerCameraType",default:"perspective"});class je{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(w.left(),-e),y=e=>create(w.down(),-e),z=e=>create(w.forward(),-e),getAxis=(e,t)=>{switch(e){case"x":return xAxis(t);case"y":return yAxis(t);case"z":return zAxis(t)}},He={x:w.left(),y:w.down(),z:w.forward()},xAxis=e=>e.x,yAxis=e=>e.y||w.create(e.x.z,e.x.x,e.x.y),zAxis=e=>e.z||w.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===w.magnitude(w.cross(e.normal,t[1])))).map((e=>e[0])).pop(),isNegativeNormal=e=>w.dot(w.create(-1,-1,-1),e.normal)>0,towardsVector=(e,t)=>{const n=undefined;return w.dot(e,t.normal)<0?invert(t):t},towardsCamera=(e,t)=>towardsVector(e.viewVector,t),invert=e=>Object.assign(Object.assign({},e),{normal:w.multiply(e.normal,w.create(-1,-1,-1)),offset:-e.offset}),fromHit=(e,t)=>{const n=w.normalize(e.normal),a=w.dot(n,e.position);return towardsCamera(t,create(n,a))},toAxis=(e,t,n,a,i)=>{const l=n.viewAll(),o=getAxis(e,t),s=null!=a&&null!=o?create(o,w.dot(o,i||S.center(a))):forAxis(e,l.lookAt[e]);return towardsCamera(n,s)};function corners(e){return[w.create(e.min.x,e.min.y,e.min.z),w.create(e.min.x,e.min.y,e.max.z),w.create(e.min.x,e.max.y,e.min.z),w.create(e.min.x,e.max.y,e.max.z),w.create(e.max.x,e.max.y,e.max.z),w.create(e.max.x,e.max.y,e.min.z),w.create(e.max.x,e.min.y,e.max.z),w.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 Fe="#999999",Ue=1,We={default:5,min:0,max:10},Ge=l({key:"crossSectioningEnabled",default:!1}),Ke=l({key:"crossSectioningHighlightColor",default:Fe}),$e=l({key:"crossSectioningBorderWidth",default:1}),Ye=l({key:"crossSectioningPlanes",default:[]}),Xe=l({key:"crossSectioningAlignment",default:{mode:"global",hitPending:!1}}),qe=o({key:"crossSectioningTargetBoundingBox",get:async({get:e})=>{const t=undefined;return e(Be)}}),Ze=l({key:"crossSectioningIsInteractive",default:!1}),Je=l({key:"crossSectioningActiveAxis",default:"x"}),Qe=l({key:"crossSectioningAvailableAxes",default:He}),et=o({key:"crossSectioningOffsetScalar",get:({get:e})=>{const t=e(Ye);return t.length>0&&isNegativeNormal(t[0])?-1:1}}),tt=o({key:"crossSectioningSliderRange",get:({get:e})=>{const t=e(Ye),n=e(qe),a=null!=n?corners(n):[];if(t.length>0){const e=a.map((e=>w.dot(e,isNegativeNormal(t[0])?w.multiply(t[0].normal,w.create(-1,-1,-1)):t[0].normal)));return{default:t[0].offset,min:Math.min(...e)-2,max:Math.max(...e)+2}}return We}}),nt=o({key:"crossSectioningPlaneDisplayOffset",get:({get:e})=>{const t=e(Ye),n=e(et),a=e(tt);return t.length>0?t[0].offset*n:a.default}}),at=l({key:"crossSectioningAdditionalToolsOpen",default:!1}),it=l({key:"crossSectioningAlignmentToolsOpen",default:!1}),lt=l({key:"crossSectioningAxisToolsOpen",default:!1}),ot=l({key:"crossSectioningInteractionHandler",default:new je,dangerouslyAllowMutability:!0});function useCrossSectioning(e,t){const n=s(ot);h.useEffect((()=>{t&&(null==e||e.registerInteractionHandler(n))}),[e,t,n])}const st=l({key:"hitResultsTapDetails",default:void 0}),rt=l({key:"hitResultsLongPressDetails",default:void 0}),ct=l({key:"previousHitResult",default:void 0}),dt=l({key:"currentHitResult",default:void 0}),ut=o({key:"hitResult",get:async({get:e})=>{var t,n,a,i,l,o,s,r;const c=e(st),d=e(rt),u=null!=c?c:d,m=e(Re),p=await m(),h=null==p?void 0:p.sceneViewId,g=null==p?void 0:p.raycaster();if(null!=u&&null!=g&&null!=h){const e=await g.hitItems(u.position),c=((null==e?void 0:e.hits)||[])[0];if(null!=c)return{id:null===(t=c.itemId)||void 0===t?void 0:t.hex,normal:w.create((null===(n=null==c?void 0:c.hitNormal)||void 0===n?void 0:n.x)||0,(null===(a=null==c?void 0:c.hitNormal)||void 0===a?void 0:a.y)||0,(null===(i=null==c?void 0:c.hitNormal)||void 0===i?void 0:i.z)||0),position:w.create((null===(l=null==c?void 0:c.hitPoint)||void 0===l?void 0:l.x)||0,(null===(o=null==c?void 0:c.hitPoint)||void 0===o?void 0:o.y)||0,(null===(s=null==c?void 0:c.hitPoint)||void 0===s?void 0:s.z)||0),meta:u.metaKey||u.ctrlKey||!1,metadata:[],ancestors:(null===(r=null==c?void 0:c.ancestors)||void 0===r?void 0:r.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})))||[]}}}}),mt=l({key:"hitResultsSkipNextTap",default:!1}),alignToNormal=(e,t,n)=>{if(e.toFrameCamera().isPerspective()){const n=w.dot(w.normalize(e.up),t),a=Math.abs(n)>.98?w.normalize(w.scale(-n,e.viewVector)):e.up,i=w.add(w.scale(w.distance(e.position,e.lookAt),w.multiply(t,w.create(-1,-1,-1))),e.lookAt);return e.update({up:a,position:i})}{const a=w.angleTo(w.normalize(e.viewVector),t),i=null!=n?S.center(n):e.lookAt,l=w.normalize(w.cross(w.normalize(e.viewVector),t));return e.rotateAroundAxisAtPoint(a,i,l)}};function isParallelTo(e,t){const n=k.toDegrees(w.angleTo(e,t));return 0===n||180===n}const pt=500;function useCrossSectioningActions(){const e=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise($e),n=await e.getPromise(Ke),a=await e.getPromise(Ye),i=await e.getPromise(Re),l=await i();await(null==l?void 0:l.crossSectioning().update({sectionPlanes:a,highlightColor:n?xe.fromHexString(n):void 0,lineWidth:t}))})),t=useActionCallback((({set:t,reset:n,snapshot:a})=>async()=>{const i=await a.getPromise(Re),l=await i();if(null!=l){const a=l.camera().viewAll();n(Qe),t(Ye,[towardsCamera(l.camera(),x(a.lookAt.x))]),await e()}})),n=useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async()=>{const a=await t.tryGetPromise(ut).then((e=>e.value)),i=await t.getPromise(Re),l=await i();if(null!=a&&null!=l){const t=fromHit(a,l.camera());n(Ye,null!=t?[t]:[]),n(Qe,null!=t?{x:t.normal}:He),await e()}}))),a=useActionCallback((({set:e,snapshot:n})=>async()=>{const a=await n.getPromise(Ye),i=undefined;await n.getPromise(Ge)||(e(Ge,!0),0===a.length&&await t())})),i=useActionCallback((({reset:t,snapshot:n})=>async()=>{const a=undefined;await n.getPromise(Ge)&&(t(Ge),t(at),t(it),t(lt),t(Ye),t(Xe),t(Je),await e())}));return{enable:a,disable:i,reapply:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(Ge)&&await e()})),openAdditionalTools:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=undefined;await t.getPromise(Ge)||await a(),e(at,!0)})),closeAdditionalTools:useActionCallback((({reset:e})=>()=>{e(at)})),openAlignmentTools:useActionCallback((({set:e,reset:t})=>()=>{t(lt),e(it,!0)})),closeAlignmentTools:useActionCallback((({reset:e})=>()=>{e(it)})),openAxisTools:useActionCallback((({set:e,reset:t})=>()=>{t(it),e(lt,!0)})),closeAxisTools:useActionCallback((({reset:e})=>()=>{e(lt)})),beginInteraction:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(ot);e(Ze,!0),await n.beginInteraction()})),endInteraction:useActionCallback((({reset:e,snapshot:t})=>async()=>{const n=await t.getPromise(ot);e(Ze),await n.endInteraction()})),updatePlanes:useActionCallback(retainSnapshot((({set:t,snapshot:n})=>async a=>{const i=await n.getPromise(Ye);if(i.length>0){const l=await n.getPromise(et),o=await n.getPromise(tt),s=l<0?-1*o.max:o.min,r=l<0?-1*o.min:o.max,c=i.map((e=>Object.assign(Object.assign({},e),{offset:Math.min(Math.max(a*l,s),r)})));t(Ye,c),await e()}}))),flipPlanes:useActionCallback((({set:t,snapshot:n})=>async()=>{const a=await n.getPromise(Ye);t(Ye,a.map((e=>invert(e)))),await e()})),alignViewToPlane:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(Ye),n=await e.getPromise(Ne),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:pt}})})),updateAxis:useActionCallback(retainSnapshot((({set:t,reset:n,snapshot:a})=>async i=>{const l=await a.getPromise(Ye),o=await a.getPromise(Qe),s=await a.getPromise(qe),r=await a.getPromise(Xe),c=await a.getPromise(Ne),d=await(null==c?void 0:c.scene()),u=o[i],m=null!=u&&l.length>0&&isParallelTo(l[0].normal,u)&&!isNaN(w.angleTo(l[0].normal,u));if(null!=d&&!m){const e=await a.tryGetPromise(ut).then((e=>e.value));t(Je,i),t(Ye,[toAxis(i,o,d.camera(),s,"global"!==r.mode?null==e?void 0:e.position:void 0)])}n(lt),await e()}))),updateAlignment:useActionCallback((({set:e,reset:i})=>async(l,o)=>{i(it),e(Xe,{mode:l,hitPending:"global"!==l&&null==o}),"global"===l?(i(Je),i(Qe),await t()):"surface"===l&&null!=o&&(await a(),await n())})),sectionCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(Xe);a.hitPending&&(e(Xe,Object.assign(Object.assign({},a),{hitPending:!1})),"surface"===a.mode&&await n())})),cancelCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(Xe);n.hitPending&&e(Xe,Object.assign(Object.assign({},n),{hitPending:!1}))}))}}var ht=Object.freeze({__proto__:null,DEFAULT_ALIGN_TO_PLANE_ANIMATION_DURATION_MS:pt,DEFAULT_CROSS_SECTION_HIGHLIGHT_COLOR:Fe,DEFAULT_CROSS_SECTION_LINE_THICKNESS_VALUE:1,DEFAULT_SLIDER_RANGE:We,crossSectioningActiveAxis:Je,crossSectioningAdditionalToolsOpen:at,crossSectioningAlignment:Xe,crossSectioningAlignmentToolsOpen:it,crossSectioningAvailableAxes:Qe,crossSectioningAxisToolsOpen:lt,crossSectioningBorderWidth:$e,crossSectioningEnabled:Ge,crossSectioningHighlightColor:Ke,crossSectioningInteractionHandler:ot,crossSectioningIsInteractive:Ze,crossSectioningOffsetScalar:et,crossSectioningPlaneDisplayOffset:nt,crossSectioningPlanes:Ye,crossSectioningSliderRange:tt,crossSectioningTargetBoundingBox:qe,useCrossSectioning:useCrossSectioning,useCrossSectioningActions:useCrossSectioningActions});function useDebouncedCallback(e,t){const[n,a]=h.useState();return h.useEffect((()=>()=>{null!=n&&clearTimeout(n)}),[e,t,n]),h.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 i=useDebouncedCallback((e=>{null==n||n(e)}),500),l=h.useCallback((e=>{const t=e.target;i(t.value)}),[i]);return e(T,Object.assign({onInput:l},a))},VertexCrossSectionAppearanceColorPicker=({onUpdate:t})=>{const n=useCrossSectioningActions(),[a,i]=r(Ke);return e(VertexColorPicker,{"data-testid":"cross-section-highlight-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:async e=>{i(e),await n.reapply()}})};var gt={exports:{}},ft;
1
+ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import a from"quick-format-unescaped";import{useRecoilCallback as i,atom as l,selector as o,useRecoilValue as r,useRecoilState as s,useSetRecoilState as c,selectorFamily as d,atomFamily as u,DefaultValue as m,useRecoilValueLoadable as p,useRecoilStateLoadable as h,RecoilRoot as f}from"recoil";import{BoundingBox as g,Vector3 as v,Angle as b,Point as C,Euler as w,Matrix4 as S}from"@vertexvis/geometry";import*as T from"react";import A,{useEffect as k,useCallback as P,useRef as E,useState as I,useMemo as O}from"react";import{VertexColorPicker as N,VertexSlider as M,VertexTooltip as _,VertexIconButton as V,VertexDialog as L,VertexToggle as R,VertexButton as j,VertexColorSwatch as D,VertexIcon as B,VertexDropdownMenu as H,VertexMenuItem as F,VertexResizable as W,VertexMenu as U,VertexMenuDivider as G,VertexDraggablePopover as K,VertexBanner as $,VertexToast as q,VertexPopover as Y,VertexTextfield as X,VertexSelect as Z}from"@vertexvis/ui-react";import{toWorldTransform as J,toLocalTransform as Q,toMatrix as ee,toRadiansTransform as te,ColorMaterial as ne}from"@vertexvis/viewer";import{VertexViewerMeasurementDetails as ae,VertexViewerMeasurementDistance as ie,VertexViewerMeasurementPrecise as le,VertexSceneTreeSearch as oe,VertexSceneTreeToolbar as re,VertexSceneTreeNotificationBanner as se,VertexSceneTreeTableColumn as ce,VertexSceneTreeTableLayout as de,VertexSceneTree as ue,VertexViewerToolbarGroup as me,VertexViewerToolbar as pe,VertexViewerTransformWidget as he,VertexViewerBoxQueryTool as fe,VertexViewerViewCube as ge,VertexViewer as ve}from"@vertexvis/viewer-react";import ye from"prop-types";import{defineCustomElements as be}from"@vertexvis/ui/loader";import{defineCustomElements as Ce}from"@vertexvis/viewer/loader";var extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},extendStatics(e,t)};function __extends(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function __(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}var __assign=function(){return __assign=Object.assign||function __assign(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},__assign.apply(this,arguments)};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 __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),i,l=[],o;try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)l.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return l}"function"==typeof SuppressedError&&SuppressedError;var we=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,Se=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(.+)\s*\)/,xe=/^(#|0x)?([A-Fa-f0-9]{6})$/,create$2=function(e,t,n,a){return void 0===a&&(a=255),{r:e,g:t,b:n,a:a}},fromNumber=function(e){var t=16777215&e;return create$2(t>>16&255,t>>8&255,255&t)},fromHexString=function(e){var t=xe.exec(e);if(null!=t)return fromNumber(parseInt(t[2],16))},fromCss=function(e){var t=we.exec(e);if(null!=t)return create$2(parseInt(t[1]),parseInt(t[2]),parseInt(t[3]));var n=Se.exec(e);return null!=n?create$2(parseInt(n[1]),parseInt(n[2]),parseInt(n[3]),Math.floor(255*parseFloat(n[4]))):xe.test(e)?fromHexString(e):void 0},fromArray=function(e){return create$2(e[0],e[1],e[2],e[3])},isInvisible=function(e){return 0===e.a},isOpaque=function(e){return 255===e.a},toHexString=function(e){return"#".concat(componentToHex(e.r)).concat(componentToHex(e.g)).concat(componentToHex(e.b))},componentToHex=function(e){var t=e.toString(16);return 1===t.length?"0"+t:t},Te=Object.freeze({__proto__:null,create:create$2,fromNumber:fromNumber,fromHexString:fromHexString,fromCss:fromCss,fromArray:fromArray,isInvisible:isInvisible,isOpaque:isOpaque,toHexString:toHexString});!function(e){function MapperValidationError(t){var n=e.call(this,"Validation error mapping object.")||this;return n.errors=t,Object.setPrototypeOf(n,MapperValidationError.prototype),n}__extends(MapperValidationError,e)}(Error);var Ae=function equal(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var n,a,i;if(Array.isArray(e)){if((n=e.length)!=t.length)return!1;for(a=n;0!=a--;)if(!equal(e[a],t[a]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if((n=(i=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(t,i[a]))return!1;for(a=n;0!=a--;){var l=i[a];if(!equal(e[l],t[l]))return!1}return!0}return e!=e&&t!=t};
2
+ /*!
3
+ * isobject <https://github.com/jonschlinkert/isobject>
4
+ *
5
+ * Copyright (c) 2014-2017, Jon Schlinkert.
6
+ * Released under the MIT License.
7
+ */function isObject(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)}
8
+ /*!
9
+ * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
10
+ *
11
+ * Copyright (c) 2014-2017, Jon Schlinkert.
12
+ * Released under the MIT License.
13
+ */function isObjectObject(e){return!0===isObject(e)&&"[object Object]"===Object.prototype.toString.call(e)}function isPlainObject$1(e){var t,n;return!1!==isObjectObject(e)&&("function"==typeof(t=e.constructor)&&(!1!==isObjectObject(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf")))}function defaults(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=__read(e),a=n[0],i=n.slice(1),l=__assign({},a);if(0===i.length)return l;if(1===i.length){var o=i[0];for(var r in o)null==l[r]?l[r]=o[r]:isPlainObject(l[r])&&(l[r]=defaults(l[r],o[r]));return l}return i.reduce((function(e,t){return defaults(e,t)}),a)}function isPlainObject(e){return isPlainObject$1(e)}function isEqual$1(e,t){return Ae(e,t)}function toPairs(e){return null!=e?Object.keys(e).map((function(t){return[t,e[t]]})):[]}function fromPairs(e){return Array.isArray(e)?e.reduce((function(e,t){var n;return null!=t?__assign(__assign({},e),((n={})[t[0]]=t[1],n)):e}),{}):{}}var ke=Object.freeze({__proto__:null,defaults:defaults,isPlainObject:isPlainObject,isEqual:isEqual$1,toPairs:toPairs,fromPairs:fromPairs}),Pe,Ee=new Uint8Array(16);function rng(){if(!Pe&&!(Pe="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Pe(Ee)}var Ie=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function validate(e){return"string"==typeof e&&Ie.test(e)}for(var Oe=[],Ne=0;Ne<256;++Ne)Oe.push((Ne+256).toString(16).substr(1));function stringify(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Oe[e[t+0]]+Oe[e[t+1]]+Oe[e[t+2]]+Oe[e[t+3]]+"-"+Oe[e[t+4]]+Oe[e[t+5]]+"-"+Oe[e[t+6]]+Oe[e[t+7]]+"-"+Oe[e[t+8]]+Oe[e[t+9]]+"-"+Oe[e[t+10]]+Oe[e[t+11]]+Oe[e[t+12]]+Oe[e[t+13]]+Oe[e[t+14]]+Oe[e[t+15]]).toLowerCase();if(!validate(n))throw TypeError("Stringified UUID is invalid");return n}function v4(e,t,n){var a=(e=e||{}).random||(e.rng||rng)();return a[6]=15&a[6]|64,a[8]=63&a[8]|128,stringify(a)}function create$1(){return v4()}function fromMsbLsb(e,t){function digits(e,t){var n=BigInt(1)<<t*BigInt(4);return(n|e&n-BigInt(1)).toString(16).substring(1)}var n="string"==typeof e?BigInt(e):e,a="string"==typeof t?BigInt(t):t,i=digits(n>>BigInt(32),BigInt(8)),l=digits(n>>BigInt(16),BigInt(4)),o=digits(n,BigInt(4)),r=digits(a>>BigInt(48),BigInt(4)),s=digits(a,BigInt(12));return"".concat(i,"-").concat(l,"-").concat(o,"-").concat(r,"-").concat(s)}function toMsbLsb(e){var t=__read(e.split("-"),5),n=t[0],a=t[1],i=t[2],l=t[3],o=t[4];if(null==n||null==a||null==i||null==l||null==o)throw new Error("Invalid UUID string ".concat(e));var r=BigInt.asIntN(64,BigInt("0x".concat(n+a+i))),s=BigInt.asIntN(64,BigInt("0x".concat(l+o)));return{msb:r.toString(),lsb:s.toString()}}var Me=Object.freeze({__proto__:null,create:create$1,fromMsbLsb:fromMsbLsb,toMsbLsb:toMsbLsb}),_e={exports:{}};const Ve=a;_e.exports=pino;const Le=pfGlobalThisOrFallback().console||{},Re={mapHttpRequest:mock,mapHttpResponse:mock,wrapRequestSerializer:passthrough,wrapResponseSerializer:passthrough,wrapErrorSerializer:passthrough,req:mock,res:mock,err:asErrValue,errWithCause:asErrValue};function levelToValue(e,t){return"silent"===e?1/0:t.levels.values[e]}const je=Symbol("pino.logFuncs"),De=Symbol("pino.hierarchy"),ze={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function appendChildLogger(e,t){const n={logger:t,parent:e[De]};t[De]=n}function setupBaseLogFunctions(e,t,n){const a={};t.forEach((e=>{a[e]=n[e]?n[e]:Le[e]||Le[ze[e]||"log"]||noop})),e[je]=a}function shouldSerialize(e,t){if(Array.isArray(e)){const t=undefined;return e.filter((function(e){return"!stdSerializers.err"!==e}))}return!0===e&&Object.keys(t)}function pino(e){(e=e||{}).browser=e.browser||{};const t=e.browser.transmit;if(t&&"function"!=typeof t.send)throw Error("pino: transmit option must have a send function");const n=e.browser.write||Le;e.browser.write&&(e.browser.asObject=!0);const a=e.serializers||{},i=shouldSerialize(e.browser.serialize,a);let l=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(l=!1);const o=Object.keys(e.customLevels||{}),r=["error","fatal","warn","info","debug","trace"].concat(o);"function"==typeof n&&r.forEach((function(e){n[e]=n})),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");const s=e.level||"info",c=Object.create(n);c.log||(c.log=noop),setupBaseLogFunctions(c,r,n),appendChildLogger({},c),Object.defineProperty(c,"levelVal",{get:getLevelVal}),Object.defineProperty(c,"level",{get:getLevel,set:setLevel});const d={transmit:t,serialize:i,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:r,timestamp:getTimeFunction(e),messageKey:e.messageKey||"msg",onChild:e.onChild||noop};function getLevelVal(){return levelToValue(this.level,this)}function getLevel(){return this._level}function setLevel(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,set(this,d,c,"error"),set(this,d,c,"fatal"),set(this,d,c,"warn"),set(this,d,c,"info"),set(this,d,c,"debug"),set(this,d,c,"trace"),o.forEach((e=>{set(this,d,c,e)}))}function child(n,l,o){if(!l)throw new Error("missing bindings for child Pino");o=o||{},i&&l.serializers&&(o.serializers=l.serializers);const r=o.serializers;if(i&&r){var s=Object.assign({},a,r),c=!0===e.browser.serialize?Object.keys(s):i;delete l.serializers,applySerializers([l],c,s,this._stdErrSerialize)}function Child(e){this._childLevel=1+(0|e._childLevel),this.bindings=l,s&&(this.serializers=s,this._serialize=c),t&&(this._logEvent=createLogEventShape([].concat(e._logEvent.bindings,l)))}Child.prototype=this;const d=new Child(this);return appendChildLogger(this,d),d.child=function(...e){return child.call(this,n,...e)},d.level=o.level||this.level,n.onChild(d),d}return c.levels=getLevels(e),c.level=s,c.isLevelEnabled=function(e){return!!this.levels.values[e]&&this.levels.values[e]>=this.levels.values[this.level]},c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=noop,c.serializers=a,c._serialize=i,c._stdErrSerialize=l,c.child=function(...e){return child.call(this,d,...e)},t&&(c._logEvent=createLogEventShape()),c}function getLevels(e){const t=e.customLevels||{},n=undefined,a=undefined;return{values:Object.assign({},pino.levels.values,t),labels:Object.assign({},pino.levels.labels,invertObject(t))}}function invertObject(e){const t={};return Object.keys(e).forEach((function(n){t[e[n]]=n})),t}function getBindingChain(e){const t=[];e.bindings&&t.push(e.bindings);let n=e[De];for(;n.parent;)n=n.parent,n.logger.bindings&&t.push(n.logger.bindings);return t.reverse()}function set(e,t,n,a){if(Object.defineProperty(e,a,{value:levelToValue(e.level,n)>levelToValue(a,n)?noop:n[je][a],writable:!0,enumerable:!0,configurable:!0}),e[a]===noop){if(!t.transmit)return;const i=undefined,l=levelToValue(t.transmit.level||e.level,n),o=undefined;if(levelToValue(a,n)<l)return}e[a]=createWrap(e,t,n,a);const i=getBindingChain(e);0!==i.length&&(e[a]=prependBindingsInArguments(i,e[a]))}function prependBindingsInArguments(e,t){return function(){return t.apply(this,[...e,...arguments])}}function createWrap(e,t,n,a){return i=e[je][a],function LOG(){const l=t.timestamp(),o=new Array(arguments.length),r=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Le?Le:this;for(var s=0;s<o.length;s++)o[s]=arguments[s];var c=!1;if(t.serialize&&(applySerializers(o,this._serialize,this.serializers,this._stdErrSerialize),c=!0),t.asObject||t.formatters?i.call(r,...asObject(this,a,o,l,t)):i.apply(r,o),t.transmit){const i=void 0,r=levelToValue(t.transmit.level||e._level,n),s=levelToValue(a,n);if(s<r)return;transmit(this,{ts:l,methodLevel:a,methodValue:s,transmitValue:n.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:levelToValue(e._level,n)},o,c)}};var i}function asObject(e,t,n,a,i){const{level:l,log:o=e=>e}=i.formatters||{},r=n.slice();let s=r[0];const c={};let d=1+(0|e._childLevel);if(d<1&&(d=1),a&&(c.time=a),l){const n=l(t,e.levels.values[t]);Object.assign(c,n)}else c.level=e.levels.values[t];if(i.asObjectBindingsOnly){if(null!==s&&"object"==typeof s)for(;d--&&"object"==typeof r[0];)Object.assign(c,r.shift());const e=undefined;return[o(c),...r]}{if(null!==s&&"object"==typeof s){for(;d--&&"object"==typeof r[0];)Object.assign(c,r.shift());s=r.length?Ve(r.shift(),r):void 0}else"string"==typeof s&&(s=Ve(r.shift(),r));void 0!==s&&(c[i.messageKey]=s);const e=undefined;return[o(c)]}}function applySerializers(e,t,n,a){for(const i in e)if(a&&e[i]instanceof Error)e[i]=pino.stdSerializers.err(e[i]);else if("object"==typeof e[i]&&!Array.isArray(e[i])&&t)for(const a in e[i])t.indexOf(a)>-1&&a in n&&(e[i][a]=n[a](e[i][a]))}function transmit(e,t,n,a=!1){const i=t.send,l=t.ts,o=t.methodLevel,r=t.methodValue,s=t.val,c=e._logEvent.bindings;a||applySerializers(n,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=l,e._logEvent.messages=n.filter((function(e){return-1===c.indexOf(e)})),e._logEvent.level.label=o,e._logEvent.level.value=r,i(o,e._logEvent,s),e._logEvent=createLogEventShape(c)}function createLogEventShape(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function asErrValue(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const n in e)void 0===t[n]&&(t[n]=e[n]);return t}function getTimeFunction(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?nullTime:epochTime}function mock(){return{}}function passthrough(e){return e}function noop(){}function nullTime(){return!1}function epochTime(){return Date.now()}function unixTime(){return Math.round(Date.now()/1e3)}function isoTime(){return new Date(Date.now()).toISOString()}function pfGlobalThisOrFallback(){function defd(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(e){return defd(self)||defd(window)||defd(this)||{}}}var Be;pino.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},pino.stdSerializers=Re,pino.stdTimeFunctions=Object.assign({},{nullTime:nullTime,epochTime:epochTime,unixTime:unixTime,isoTime:isoTime}),_e.exports.default=pino,_e.exports.pino=pino;const He=(0,_e.exports)({formatters:{level:e=>({level:e})}}),logger_error=(e,t)=>{null!=t?He.error(t,e):He.error(e)},logger_info=(e,t)=>{null!=t?He.info(t,e):He.info(e)},logger_warn=(e,t)=>{null!=t?He.warn(t,e):He.warn(e)},logger_debug=(e,t)=>{null!=t?He.debug(t,e):He.debug(e)};class Fe{}function useActionCallback(e,t=[]){const n=undefined;return i((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)}})}))),t instanceof Fe?void 0:t)}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 t=>{try{return{value:await e.getPromise(t)}}catch(e){return logger_debug(`Error encountered retrieving Recoil value. [key={${t.key}}]`,e),{error:e}}}}const We=3e3,Ue=5e3,Ge=8e3,Ke=l({key:"applicationMessageToast",default:void 0}),$e=l({key:"applicationMessageBanner",default:void 0}),useApplicationMessageActions=()=>({setBannerMessage:useActionCallback((({set:e})=>t=>{e($e,null!=t?Object.assign(Object.assign({},t),{id:Me.create()}):void 0)})),setToastMessage:useActionCallback((({set:e})=>t=>{e(Ke,null!=t?Object.assign(Object.assign({},t),{id:Me.create()}):void 0)}))});var qe=Object.freeze({__proto__:null,LOW_SEVERITY_BANNER_MESSAGE_DURATION_MS:Ue,LOW_SEVERITY_TOAST_MESSAGE_DURATION_MS:We,MEDIUM_SEVERITY_TOAST_MESSAGE_DURATION_MS:Ge,applicationMessageBanner:$e,applicationMessageToast:Ke,useApplicationMessageActions:useApplicationMessageActions});const Ye=500;function useViewerCameraActions(){const e=useApplicationMessageActions();return{flyToById:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(Ze),i=await(null==a?void 0:a.scene());await(null==i?void 0:i.camera().flyTo({itemId:t}).render({animation:{milliseconds:null!=n?n:Ye}}))})),flyToByBoundingBox:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(Ze),i=await(null==a?void 0:a.scene());await(null==i?void 0:i.camera().flyTo({boundingBox:t}).render({animation:{milliseconds:null!=n?n:Ye}}))})),updateCameraType:useActionCallback((({set:t,snapshot:n})=>async(a,i)=>{const l=await n.getPromise(it),o=undefined;null!=l&&g.isValid(l)||!i?t(Xe,a):e.setToastMessage({type:"error",message:"Cannot change the camera type when no geometry is visible.",duration:Ge})}))}}const Xe=l({key:"viewerCameraType",default:"perspective"}),Ze=l({key:"viewerToolkitViewerElement",default:void 0,dangerouslyAllowMutability:!0}),Je=l({key:"viewerElementId",default:"vertex-viewer"}),Qe=l({key:"viewerInitialSceneReady",default:!1}),et=l({key:"viewerBaseInteractionHandlerProvider",default:Promise.resolve(void 0),dangerouslyAllowMutability:!0}),tt=l({key:"viewerPrimaryInteractionType",default:"rotate"}),nt=l({key:"viewerSceneViewId",default:void 0});function useViewerSceneActions(){const e=useActionCallback((({snapshot:e})=>async(t,n,...a)=>{const i=await e.getPromise(Ze),l=await(null==i?void 0:i.scene());a.length>0&&await(null==l?void 0:l.items((e=>a.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()),[]),a=A.useCallback((e=>e.where((e=>e.all())).deselect()),[]);return{executeWithCorrelationId:e,execute:useActionCallback((()=>async(t,...n)=>{const a=Me.create();await e(t,a,...n)})),selectItemsTransform:t,deselectItemsTransform:n,clearSelectionTransform:a,reset:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(Ze),a=await(null==n?void 0:n.scene()),i=await e.getPromiseRequired(Xe);null==a||a.reset({includeCamera:!0,suppliedCorrelationId:t,cameraTypeOverride:i})}))}}const at=l({key:"viewerFrameScene",default:void 0,dangerouslyAllowMutability:!0}),it=o({key:"viewerSceneVisibleBoundingBox",get:({get:e})=>{var t;return null===(t=e(at))||void 0===t?void 0:t.boundingBox}});var lt=Object.freeze({__proto__:null,DEFAULT_CAMERA_ANIMATION_DURATION:Ye,useViewerCameraActions:useViewerCameraActions,useViewerSceneActions:useViewerSceneActions,viewerBaseInteractionHandlerProvider:et,viewerCameraType:Xe,viewerElement:Ze,viewerElementId:Je,viewerFrameScene:at,viewerInitialSceneReady:Qe,viewerPrimaryInteractionType:tt,viewerSceneViewId:nt,viewerSceneVisibleBoundingBox:it});class ot{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(v.left(),-e),y=e=>create(v.down(),-e),z=e=>create(v.forward(),-e),getAxis=(e,t)=>{switch(e){case"x":return xAxis(t);case"y":return yAxis(t);case"z":return zAxis(t)}},rt={x:v.left(),y:v.down(),z:v.forward()},xAxis=e=>e.x,yAxis=e=>e.y||v.create(e.x.z,e.x.x,e.x.y),zAxis=e=>e.z||v.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===v.magnitude(v.cross(e.normal,t[1])))).map((e=>e[0])).pop(),isNegativeNormal=e=>v.dot(v.create(-1,-1,-1),e.normal)>0,towardsVector=(e,t)=>{const n=undefined;return v.dot(e,t.normal)<0?invert(t):t},towardsCamera=(e,t)=>towardsVector(e.viewVector,t),invert=e=>Object.assign(Object.assign({},e),{normal:v.multiply(e.normal,v.create(-1,-1,-1)),offset:-e.offset}),fromHit=(e,t)=>{const n=v.normalize(e.normal),a=v.dot(n,e.position);return towardsCamera(t,create(n,a))},toAxis=(e,t,n,a,i)=>{const l=n.viewAll(),o=getAxis(e,t),r=null!=a&&null!=o?create(o,v.dot(o,i||g.center(a))):forAxis(e,l.lookAt[e]);return towardsCamera(n,r)};function corners(e){return[v.create(e.min.x,e.min.y,e.min.z),v.create(e.min.x,e.min.y,e.max.z),v.create(e.min.x,e.max.y,e.min.z),v.create(e.min.x,e.max.y,e.max.z),v.create(e.max.x,e.max.y,e.max.z),v.create(e.max.x,e.max.y,e.min.z),v.create(e.max.x,e.min.y,e.max.z),v.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 st="#999999",ct=1,dt={default:5,min:0,max:10},ut=l({key:"crossSectioningEnabled",default:!1}),mt=l({key:"crossSectioningHighlightColor",default:st}),pt=l({key:"crossSectioningBorderWidth",default:1}),ht=l({key:"crossSectioningPlanes",default:[]}),ft=l({key:"crossSectioningAlignment",default:{mode:"global",hitPending:!1}}),gt=o({key:"crossSectioningTargetBoundingBox",get:async({get:e})=>{const t=undefined;return e(it)}}),vt=l({key:"crossSectioningIsInteractive",default:!1}),yt=l({key:"crossSectioningActiveAxis",default:"x"}),bt=l({key:"crossSectioningAvailableAxes",default:rt}),Ct=o({key:"crossSectioningOffsetScalar",get:({get:e})=>{const t=e(ht);return t.length>0&&isNegativeNormal(t[0])?-1:1}}),wt=o({key:"crossSectioningSliderRange",get:({get:e})=>{const t=e(ht),n=e(gt),a=null!=n?corners(n):[];if(t.length>0){const e=a.map((e=>v.dot(e,isNegativeNormal(t[0])?v.multiply(t[0].normal,v.create(-1,-1,-1)):t[0].normal)));return{default:t[0].offset,min:Math.min(...e)-2,max:Math.max(...e)+2}}return dt}}),St=o({key:"crossSectioningPlaneDisplayOffset",get:({get:e})=>{const t=e(ht),n=e(Ct),a=e(wt);return t.length>0?t[0].offset*n:a.default}}),xt=l({key:"crossSectioningAdditionalToolsOpen",default:!1}),Tt=l({key:"crossSectioningAlignmentToolsOpen",default:!1}),At=l({key:"crossSectioningAxisToolsOpen",default:!1}),kt=l({key:"crossSectioningInteractionHandler",default:new ot,dangerouslyAllowMutability:!0});function useCrossSectioning(e,t){const n=r(kt);A.useEffect((()=>{t&&(null==e||e.registerInteractionHandler(n))}),[e,t,n])}const Pt=l({key:"hitResultsTapDetails",default:void 0}),Et=l({key:"hitResultsLongPressDetails",default:void 0}),It=l({key:"previousHitResult",default:void 0}),Ot=l({key:"currentHitResult",default:void 0}),Nt=o({key:"hitResult",get:async({get:e})=>{var t,n,a,i,l,o,r,s;const c=e(Pt),d=e(Et),u=null!=c?c:d,m=e(Ze),p=await(null==m?void 0:m.scene()),h=null==p?void 0:p.sceneViewId,f=null==p?void 0:p.raycaster();if(null!=u&&null!=f&&null!=h){const e=await f.hitItems(u.position),c=((null==e?void 0:e.hits)||[])[0];if(null!=c)return{id:null===(t=c.itemId)||void 0===t?void 0:t.hex,normal:v.create((null===(n=null==c?void 0:c.hitNormal)||void 0===n?void 0:n.x)||0,(null===(a=null==c?void 0:c.hitNormal)||void 0===a?void 0:a.y)||0,(null===(i=null==c?void 0:c.hitNormal)||void 0===i?void 0:i.z)||0),position:v.create((null===(l=null==c?void 0:c.hitPoint)||void 0===l?void 0:l.x)||0,(null===(o=null==c?void 0:c.hitPoint)||void 0===o?void 0:o.y)||0,(null===(r=null==c?void 0:c.hitPoint)||void 0===r?void 0:r.z)||0),meta:u.metaKey||u.ctrlKey||!1,metadata:[],ancestors:(null===(s=null==c?void 0:c.ancestors)||void 0===s?void 0:s.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})))||[]}}}}),Mt=l({key:"hitResultsSkipNextTap",default:!1}),alignToNormal=(e,t,n)=>{if(e.toFrameCamera().isPerspective()){const n=v.dot(v.normalize(e.up),t),a=Math.abs(n)>.98?v.normalize(v.scale(-n,e.viewVector)):e.up,i=v.add(v.scale(v.distance(e.position,e.lookAt),v.multiply(t,v.create(-1,-1,-1))),e.lookAt);return e.update({up:a,position:i})}{const a=v.angleTo(v.normalize(e.viewVector),t),i=null!=n?g.center(n):e.lookAt,l=v.normalize(v.cross(v.normalize(e.viewVector),t));return e.rotateAroundAxisAtPoint(a,i,l)}};function isParallelTo(e,t){const n=b.toDegrees(v.angleTo(e,t));return 0===n||180===n}const _t=500;function useCrossSectioningActions(){const e=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(pt),n=await e.getPromise(mt),a=await e.getPromise(ht),i=await e.getPromise(Ze),l=await(null==i?void 0:i.scene());await(null==l?void 0:l.crossSectioning().update({sectionPlanes:a,highlightColor:n?Te.fromHexString(n):void 0,lineWidth:t}))})),t=useActionCallback((({set:t,reset:n,snapshot:a})=>async()=>{const i=await a.getPromise(Ze),l=await(null==i?void 0:i.scene());if(null!=l){const a=l.camera().viewAll();n(bt),t(ht,[towardsCamera(l.camera(),x(a.lookAt.x))]),await e()}})),n=useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async()=>{const a=await t.tryGetPromise(Nt).then((e=>e.value)),i=await t.getPromise(Ze),l=await(null==i?void 0:i.scene());if(null!=a&&null!=l){const t=fromHit(a,l.camera());n(ht,null!=t?[t]:[]),n(bt,null!=t?{x:t.normal}:rt),await e()}}))),a=useActionCallback((({set:e,snapshot:n})=>async()=>{const a=await n.getPromise(ht),i=undefined;await n.getPromise(ut)||(e(ut,!0),0===a.length&&await t())})),i=useActionCallback((({reset:t,snapshot:n})=>async()=>{const a=undefined;await n.getPromise(ut)&&(t(ut),t(xt),t(Tt),t(At),t(ht),t(ft),t(yt),await e())}));return{enable:a,disable:i,reapply:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(ut)&&await e()})),openAdditionalTools:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=undefined;await t.getPromise(ut)||await a(),e(xt,!0)})),closeAdditionalTools:useActionCallback((({reset:e})=>()=>{e(xt)})),openAlignmentTools:useActionCallback((({set:e,reset:t})=>()=>{t(At),e(Tt,!0)})),closeAlignmentTools:useActionCallback((({reset:e})=>()=>{e(Tt)})),openAxisTools:useActionCallback((({set:e,reset:t})=>()=>{t(Tt),e(At,!0)})),closeAxisTools:useActionCallback((({reset:e})=>()=>{e(At)})),beginInteraction:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(kt);e(vt,!0),await n.beginInteraction()})),endInteraction:useActionCallback((({reset:e,snapshot:t})=>async()=>{const n=await t.getPromise(kt);e(vt),await n.endInteraction()})),updatePlanes:useActionCallback(retainSnapshot((({set:t,snapshot:n})=>async a=>{const i=await n.getPromise(ht);if(i.length>0){const l=await n.getPromise(Ct),o=await n.getPromise(wt),r=l<0?-1*o.max:o.min,s=l<0?-1*o.min:o.max,c=i.map((e=>Object.assign(Object.assign({},e),{offset:Math.min(Math.max(a*l,r),s)})));t(ht,c),await e()}}))),flipPlanes:useActionCallback((({set:t,snapshot:n})=>async()=>{const a=await n.getPromise(ht);t(ht,a.map((e=>invert(e)))),await e()})),alignViewToPlane:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(ht),n=await e.getPromise(Ze),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:_t}})})),updateAxis:useActionCallback(retainSnapshot((({set:t,reset:n,snapshot:a})=>async i=>{const l=await a.getPromise(ht),o=await a.getPromise(bt),r=await a.getPromise(gt),s=await a.getPromise(ft),c=await a.getPromise(Ze),d=await(null==c?void 0:c.scene()),u=o[i],m=null!=u&&l.length>0&&isParallelTo(l[0].normal,u)&&!isNaN(v.angleTo(l[0].normal,u));if(null!=d&&!m){const e=await a.tryGetPromise(Nt).then((e=>e.value));t(yt,i),t(ht,[toAxis(i,o,d.camera(),r,"global"!==s.mode?null==e?void 0:e.position:void 0)])}n(At),await e()}))),updateAlignment:useActionCallback((({set:e,reset:i})=>async(l,o)=>{i(Tt),e(ft,{mode:l,hitPending:"global"!==l&&null==o}),"global"===l?(i(yt),i(bt),await t()):"surface"===l&&null!=o&&(await a(),await n())})),sectionCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(ft);a.hitPending&&(e(ft,Object.assign(Object.assign({},a),{hitPending:!1})),"surface"===a.mode&&await n())})),cancelCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(ft);n.hitPending&&e(ft,Object.assign(Object.assign({},n),{hitPending:!1}))}))}}var Vt=Object.freeze({__proto__:null,DEFAULT_ALIGN_TO_PLANE_ANIMATION_DURATION_MS:_t,DEFAULT_CROSS_SECTION_HIGHLIGHT_COLOR:st,DEFAULT_CROSS_SECTION_LINE_THICKNESS_VALUE:1,DEFAULT_SLIDER_RANGE:dt,crossSectioningActiveAxis:yt,crossSectioningAdditionalToolsOpen:xt,crossSectioningAlignment:ft,crossSectioningAlignmentToolsOpen:Tt,crossSectioningAvailableAxes:bt,crossSectioningAxisToolsOpen:At,crossSectioningBorderWidth:pt,crossSectioningEnabled:ut,crossSectioningHighlightColor:mt,crossSectioningInteractionHandler:kt,crossSectioningIsInteractive:vt,crossSectioningOffsetScalar:Ct,crossSectioningPlaneDisplayOffset:St,crossSectioningPlanes:ht,crossSectioningSliderRange:wt,crossSectioningTargetBoundingBox:gt,useCrossSectioning:useCrossSectioning,useCrossSectioningActions:useCrossSectioningActions});function useDebouncedCallback(e,t){const[n,a]=A.useState();return A.useEffect((()=>()=>{null!=n&&clearTimeout(n)}),[e,t,n]),A.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 i=useDebouncedCallback((e=>{null==n||n(e)}),500),l=A.useCallback((e=>{const t=e.target;i(t.value)}),[i]);return e(N,Object.assign({onInput:l},a))},VertexCrossSectionAppearanceColorPicker=({onUpdate:t})=>{const n=useCrossSectioningActions(),[a,i]=s(mt);return e(VertexColorPicker,{"data-testid":"cross-section-highlight-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:async e=>{i(e),await n.reapply()}})};var Lt={exports:{}},Rt;
2
14
  /*!
3
15
  Copyright (c) 2018 Jed Watson.
4
16
  Licensed under the MIT License (MIT), see
5
17
  http://jedwatson.github.io/classnames
6
- */ft=gt,function(){var e={}.hasOwnProperty;function classNames(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=appendClass(e,parseValue(n)))}return e}function parseValue(t){if("string"==typeof t||"number"==typeof t)return t;if("object"!=typeof t)return"";if(Array.isArray(t))return classNames.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var n="";for(var a in t)e.call(t,a)&&t[a]&&(n=appendClass(n,a));return n}function appendClass(e,t){return t?e?e+" "+t:e+t:e}ft.exports?(classNames.default=classNames,ft.exports=classNames):window.classNames=classNames}();var vt=gt.exports;const VertexSlider=n=>{var{value:a,defaultValue:i,leftLabel:l,rightLabel:o,onChange:s,onValueChange:r,onValueInput:c}=n,d=__rest(n,["value","defaultValue","leftLabel","rightLabel","onChange","onValueChange","onValueInput"]);const[u,m]=h.useState(i);return t("div",{className:"flex w-full items-center gap-2",children:[l&&e("div",{className:"pl-0.5 text-xs text-center",children:l}),e(E,Object.assign({className:vt("w-full",{"mt-0.5":null!=l||null!=o}),value:null!=a?a:u,onValueChange:e=>{m(e.detail.value),null==s||s(e.detail.value),null==r||r(e)},onValueInput:e=>{m(e.detail.value),null==s||s(e.detail.value),null==c||c(e)}},d)),o&&e("div",{className:"text-xs pr-2 flex-shrink-0 text-right",children:o})]})},VertexCrossSectionAppearanceLineThicknessSlider=({onUpdate:t})=>{const n=useCrossSectioningActions(),[a,i]=r($e);return e(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=>{i(e.detail.value),await n.reapply()},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexCrossSectionAppearanceControls({onUpdateCrossSectionColor:a,onUpdateCrossSectionLineThickness:i}){return t(n,{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e(VertexCrossSectionAppearanceColorPicker,{onUpdate:a}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e(VertexCrossSectionAppearanceLineThicknessSlider,{onUpdate:i})]})}function PanelSection({header:n,children:a}){return t("div",{className:"py-3 px-4 border-neutral-300 border-b",children:[e("div",{className:"my-2 text-base text-neutral-700",children:n}),a]})}const VertexCrossSectionAppearanceReset=({onReset:t})=>{const n=useCrossSectioningActions(),[a,i]=r(Ke),[l,o]=r($e),s=undefined;return e("div",{className:"ml-auto",children:e(P,{content:"Reset Cross Sectioning Appearance",children:e(O,{"data-testid":"cross-section-appearance-reset",iconName:"reset",iconSize:"sm",onClick:async()=>{i(Fe),o(1),null==t||t(),await n.reapply()},disabled:!(a!==Fe||1!==l)})})})};function VertexCrossSectionAppearancePanelSection({onResetCrossSectionAppearance:n,onUpdateCrossSectionColor:a,onUpdateCrossSectionLineThickness:i}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Cross Sectioning",e(VertexCrossSectionAppearanceReset,{onReset:n})]}),children:e(VertexCrossSectionAppearanceControls,{onUpdateCrossSectionColor:a,onUpdateCrossSectionLineThickness:i})})}const yt=.5,bt="#444444",Ct=l({key:"featureEdgesSelectedColor",default:bt}),wt=l({key:"featureEdgesLineThickness",default:yt}),VertexFeatureEdgesColorPicker=({onUpdate:t})=>{const[n,a]=r(Ct);return e(VertexColorPicker,{"data-testid":"feature-edges-color-picker",value:n,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})},VertexFeatureEdgesThicknessSlider=({onUpdate:t})=>{const[n,a]=r(wt);return e(VertexSlider,{id:"feature-edges-thickness","data-testid":"feature-edges-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:n,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexFeatureEdgesControls({onUpdateFeatureEdgesColor:a,onUpdateFeatureEdgesThickness:i}){return t(n,{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e(VertexFeatureEdgesColorPicker,{onUpdate:a}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e(VertexFeatureEdgesThicknessSlider,{onUpdate:i})]})}const VertexFeatureEdgesReset=({onReset:t})=>{const[n,a]=r(Ct),[i,l]=r(wt),o=undefined;return e("div",{className:"ml-auto",children:e(P,{content:"Reset Feature Edges",children:e(O,{"data-testid":"feature-edges-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(bt),l(yt),null==t||t()},disabled:!(i!==yt||n!==bt)})})})};function VertexFeatureEdgesPanelSection({onResetFeatureEdges:n,onUpdateFeatureEdgesColor:a,onUpdateFeatureEdgesThickness:i}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Feature Edges",e(VertexFeatureEdgesReset,{onReset:n})]}),children:e(VertexFeatureEdgesControls,{onUpdateFeatureEdgesColor:a,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 St=l({key:"contextMenuActive",default:void 0}),xt=l({key:"contextMenuPosition",default:void 0}),kt=l({key:"contextMenuTarget",default:void 0}),At=l({key:"contextMenuItem",default:void 0}),Tt=l({key:"contextMenuActions",default:[]}),Et=o({key:"contextMenuActivePosition",get:({get:e})=>null!=e(St)?e(xt):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(xt,A.create(n,a)),e(kt,t.target)}})),pointerUp:useActionCallback((({snapshot:e,set:t})=>async(n,a,i,l)=>{const o=await e.getPromise(xt),s=await e.getPromise(St);if(null!=o&&null==s){const e=n.clientX,s=null==n?void 0:n.clientY,r=A.create(e,s),c=null!=o?A.distance(o,r):0,d=null==i||i(n);c<2&&d&&(null==l||l(n,null!=o?o:r),t(St,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=A.create(t.touches[0].clientX,t.touches[0].clientY);e(xt,a),e(kt,t.target),e(St,n),null==i||i(t,a)}})),clearActiveContextMenu:useActionCallback((({reset:e,set:t})=>n=>{t(mt,!!n),e(St),e(Tt),e(xt)})),clearDismissedState:useActionCallback((({reset:e})=>()=>e(mt)))}}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 Pt=l({key:"boxSelectionEnabled",default:!1}),Ot=l({key:"boxSelectionOperationType",default:"clearAndSelect"}),useBoxSelectionActions=()=>({enable:useActionCallback((({set:e})=>()=>{e(Pt,!0)})),disable:useActionCallback((({reset:e})=>async()=>{e(Pt),e(Ot)})),setOperationType:useActionCallback((({set:e})=>t=>{e(Ot,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 Nt=l({key:"isEditingPointToPointMeasurement",default:!1}),Mt=l({key:"pointToPointMeasurementOutcome",default:void 0}),It=l({key:"editedPointToPointMeasurement",default:void 0});function usePointToPointMeasurement(e){const t=c(Mt);g((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onOutcomeChanged(t)})),()=>null==n?void 0:n.dispose()}),[e,t])}const Vt=2,Lt=l({key:"isEditingPreciseMeasurement",default:!1}),Rt=l({key:"preciseMeasurementOutcome",default:void 0}),_t=l({key:"preciseMeasurementController",dangerouslyAllowMutability:!0,default:void 0}),Bt=l({key:"preciseMeasurementOverlays",dangerouslyAllowMutability:!0,default:void 0}),Dt=l({key:"preciseMeasurementEntities",dangerouslyAllowMutability:!0,default:[]}),zt=o({key:"preciseMeasurementMessage",get:({get:e})=>{const t=undefined;return 0===e(Dt).length?"Select a surface":void 0}});function usePreciseMeasurementModel(e,t,n){const a=c(Dt),i=c(Rt),l=c(_t),o=c(Bt),r=s(_t);g((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{a(e),null==t||t(e)}))})),()=>null==n?void 0:n.dispose()}),[e,a]),g((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onOutcomeChanged((e=>{i(e),null==n||n(e)}))})),()=>null==t?void 0:t.dispose()}),[e,i]),g((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{if(e.length>2){const t=e[2];null==r||r.setEntities(new Set([t]))}}))})),()=>null==t?void 0:t.dispose()}),[e,r]),g((()=>{whenComponentReady(e,(()=>{l(null==e?void 0:e.measurementController)}))}),[e,l]),g((()=>{whenComponentReady(e,(()=>{o(null==e?void 0:e.measurementOverlays)}))}),[e,o])}function useMeasurementActions(){const e=useBoxSelectionActions(),t=useEnablePointToPointMeasurement(),n=useDisablePointToPointMeasurement(),a=useDisablePreciseMeasurement(),i=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(_t);null==t||t.clearEntities()})),l=useActionCallback((()=>async(e={})=>{await i(),n(e),a()})),o=useActionCallback((({set:e,reset:n})=>async a=>{await l(),"point-to-point"===a?t():(n(Rt),n(Dt),e(Lt,!0))}));return{disableEditMeasurement:useActionCallback((()=>async e=>{await l(e)})),enableEditMeasurement:useActionCallback((()=>async e=>{await o(e)})),resetMeasurement:useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(Lt),a=await e.getPromise(Nt);n?await i():a&&(t(Mt),t(It))})),clearEditedPointToPointMeasurement:useActionCallback((({reset:e})=>()=>{e(It)})),setEditedPointToPointMeasurement:useActionCallback((({set:e})=>t=>{e(It,t)})),toggleEditPointToPointMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(Nt)?await l():await o("point-to-point"),e.disable()})),toggleEditPreciseMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(Lt)?await l():await o("precise"),e.disable()}))}}function useEnablePointToPointMeasurement(){return useActionCallback((({reset:e,set:t})=>(n={})=>{t(Nt,!0),n.keepExistingMeasurement||e(Mt)}))}function useDisablePointToPointMeasurement(){return useActionCallback((({reset:e})=>(t={})=>{e(Nt),t.keepExistingMeasurement||(e(It),e(Mt))}))}function useDisablePreciseMeasurement(){return useActionCallback((({reset:e})=>async()=>{e(Lt),e(Rt),e(Dt)}))}const jt=o({key:"isEditingMeasurement",get:({get:e})=>e(Nt)||e(Lt)}),Ht=o({key:"measurementPanelModel",get:({get:e})=>e(Mt)||e(Rt)}),Ft=o({key:"measurementPanelOverlays",dangerouslyAllowMutability:!0,get:({get:e})=>e(Bt)}),Ut=o({key:"measurementPanelMessage",get:({get:e})=>{const t=undefined;return e(Lt)?e(zt):void 0}}),Wt=o({key:"measurementPanelIsResettable",get:({get:e})=>e(jt)&&null!=e(Ht)}),Gt=3e3,Kt=l({key:"applicationMessageToast",default:void 0}),$t=l({key:"applicationMessageBanner",default:void 0}),useApplicationMessageActions=()=>({setBannerMessage:useActionCallback((({set:e})=>t=>{e($t,null!=t?Object.assign(Object.assign({},t),{id:Oe.create()}):void 0)})),setToastMessage:useActionCallback((({set:e})=>t=>{e(Kt,null!=t?Object.assign(Object.assign({},t),{id:Oe.create()}):void 0)}))});var Yt;!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"}(Yt||(Yt={}));const Xt=d({key:"selectionSelectedItems",default:void 0}),qt=l({key:"selectionSelectedItemIds",default:[]}),Zt=l({key:"selectionLastSelected",default:void 0}),Jt=l({key:"selectionLastSelectionFromViewer",default:!1}),Qt=l({key:"selectionLastSelectWasMultiSelect",default:!1}),en=o({key:"selectionHighestSelectedAncestor",get:({get:e})=>{var t,n;const a=e(Zt),i=e(qt);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}}),tn=l({key:"selectionPreviousVisibleSummary",default:void 0}),nn=l({key:"selectionVisibleSummary",default:void 0}),an=o({key:"selectionVisibleCount",get:({get:e})=>{var t,n;return null!==(n=null===(t=e(nn))||void 0===t?void 0:t.count)&&void 0!==n?n:0}}),ln=o({key:"selectionBoundingBoxCenter",get:({get:e})=>{const t=e(nn);return null!=(null==t?void 0:t.boundingBox)?S.center(t.boundingBox):w.origin()}}),on=o({key:"selectionIsActive",get:({get:e})=>{const t=e(qt),n=undefined;return e(an)>0||t.length>0}}),sn=l({key:"transformWidgetEnabled",default:!1}),rn=l({key:"transformWidgetPosition",default:void 0}),cn=l({key:"transformWidgetOrientationOverride",default:void 0}),dn=o({key:"transformWidgetOrientation",get:({get:e})=>{const t=e(cn);if(null!=t)return t}}),un=l({key:"transformWidgetCachedOrientation",default:void 0}),mn=l({key:"transformWidgetSyncToSelection",default:!1}),pn=l({key:"transformWidgetIsInteracting",default:!1}),hn=d({key:"appliedItemTransform",default:void 0}),gn=l({key:"appliedItemTransformIds",default:[]}),fn=l({key:"selectedCoordinateSpace",default:"world"}),useTransformActions=()=>{const e=useApplicationMessageActions(),t=useViewerSceneActions(),n=useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(ln);e(rn,n)})),a=useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(rn),i=await t.getPromise(Qt),l=await t.getPromise(qt),o=await t.getPromise(an);null==a&&(l.length>0||i||o>0)&&await n(),e(mn,!0)})),i=useActionCallback((({set:e})=>async t=>{e(rn,null!=t?t:void 0)})),l=useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async()=>{const a=await e.getPromise(dn),i=undefined;(await e.getPromise(gn)).forEach((e=>{n(hn(e))})),null!=a&&t(un,a)}))),o=useActionCallback((({set:e,reset:t})=>n=>{t(un),e(cn,n)}));return{enableTransformWidget:useActionCallback((({set:t})=>async(l,o)=>{e.setToastMessage({message:"Transform manipulator enabled! Select parts to interact.",duration:Gt}),t(sn,!0),o?await n():null==l?await a():await i(l)})),disableTransformWidget:useActionCallback((({reset:e})=>()=>{e(sn),e(cn)})),setTransformWidgetOrientation:o,clearTransformWidgetOrientation:useActionCallback((({reset:e})=>()=>{e(un),e(cn)})),setTransformWidgetPosition:i,clearTransformWidgetPosition:useActionCallback((({reset:e})=>()=>e(rn))),invalidateTransforms:l,setIsInteractivelyTransforming:useActionCallback((({set:e})=>t=>{e(pn,t)})),setDefaultWidgetPosition:a,setDefaultWidgetPositionToSelection:n,enableSelectionSync:useActionCallback((({set:e})=>()=>e(mn,!0))),disableSelectionSync:useActionCallback((({reset:e})=>()=>e(mn))),syncToSelection:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(tn),n=await e.getPromise(nn),a=undefined;if(await e.getPromise(mn)){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.center(e))}})),orientToHitResult:useActionCallback((({reset:e})=>async t=>{e(mn),null!=t?(await i(null==t?void 0:t.position),o(w.eulerTo(w.up(),t.normal))):(e(rn),o(void 0))})),clearSelectedTransforms:useActionCallback((({set:e})=>async()=>{await t.execute(Yt.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.withSelected())).clearTransforms())),e(rn,void 0),e(sn,!1)})),clearAllTransforms:useActionCallback((({set:e})=>async()=>{await t.execute(Yt.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.all())).clearTransforms())),e(rn,void 0),e(sn,!1)}))}},useHitActions=()=>{const e=useCrossSectioningActions(),t=useMeasurementActions(),n=useTransformActions(),a=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const n=await e.tryGetPromise(ut).then((e=>e.value)),a=await e.getPromise(It);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(ut).then((e=>e.value));await n.orientToHitResult(t)}))),l=useActionCallback(retainSnapshot((({set:e,snapshot:t})=>async()=>{const n=await t.tryGetPromise(ut).then((e=>e.value));e(At,n)}))),o=useActionCallback(retainSnapshot((({snapshot:e,set:t})=>async()=>{t(dt,await e.tryGetPromise(ut).then((e=>e.value)))})));return{tap:useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async({detail:s},...r)=>{const c=await t.getPromise(jt),d=await t.getPromise(Xe),u=2!==(null==s?void 0:s.buttons)&&!(null==s?void 0:s.altKey);s.altKey||s.ctrlKey||s.metaKey||s.shiftKey;const m=u&&!d.hitPending&&!c,p=await t.tryGetPromise(ut).then((e=>e.value));n(ct,p),n(st,s),await a(),m&&(r.forEach((e=>e())),await i()),await l(),await e.sectionCurrentHit(),await o()}))),longPress:useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async a=>{n(st),t(rt,a.detail),await e.tryGetPromise(ut),await l(),await o()})))}},vn=o({key:"viewerToolkitHitState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,i=undefined,l=undefined;return{tapDetails:e(st),longPressDetails:e(rt),previousHitResult:e(ct),currentHitResult:e(dt)}}});var yn=Object.freeze({__proto__:null,currentHitResult:dt,hitResult:ut,hitResultsLongPressDetails:rt,hitResultsSkipNextTap:mt,hitResultsTapDetails:st,hitState:vn,previousHitResult:ct,useHitActions:useHitActions});function useSelectionActions(){const e=useTransformActions(),t=useViewerSceneActions(),n=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(qt)).forEach((e=>t(Xt(e))))})),a=useActionCallback((({snapshot:e,reset:n,set:a})=>async(i,l)=>{var o,s;const r=await e.getPromise(Xt(i.id)),c=await e.getPromise(qt),u=null===(s=[...null!==(o=i.ancestors)&&void 0!==o?o:[]])||void 0===s?void 0:s.reverse().find((e=>!c.includes(e)));null!=r&&null!=u?(a(Xt(u),{id:u}),a(qt,(e=>[...e,u])),t.execute(Yt.SELECTING_ANCESTOR,t.selectItemsTransform(u))):(null==l?void 0:l.clear)?(a(Xt(i.id),i),a(qt,[i.id]),t.execute(Yt.SELECTING_ONLY_ITEM,t.clearSelectionTransform,t.selectItemsTransform(i.id))):(a(Xt(i.id),i),a(qt,(e=>[...e,i.id])),t.execute(Yt.SELECTING_ITEMS,t.selectItemsTransform(i.id))),d(i),a(Zt,i),a(Jt,!0),n(Qt)})),i=useActionCallback((({reset:e,set:n})=>async a=>{e(Xt(a)),e(Qt),n(qt,(e=>e.filter((e=>e!==a)))),t.execute(Yt.DESELECTING_ITEMS,t.deselectItemsTransform(a))})),l=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(Xt(t.id));null!=n?await i(n.id):await a(t)})),o=useActionCallback((({snapshot:t,reset:n,set:i})=>async(l,o={})=>{const s=await t.getPromise(Xt(l.id)),r=await t.getPromise(qt);if(r.filter((e=>{var t;return e!==l.id&&!(null===(t=l.ancestors)||void 0===t?void 0:t.includes(e))})).forEach((e=>n(Xt(e)))),n(Qt),s)if(o.ignoreAncestorSelection)n(qt),n(Xt(s.id));else{const e=r.filter((e=>{var t;return e===l.id||(null===(t=l.ancestors)||void 0===t?void 0:t.includes(e))}));i(qt,e)}else n(qt);e.clearTransformWidgetOrientation(),await a(l,{clear:!0})})),s=useActionCallback((({reset:t})=>async()=>{await n(),t(qt),t(Zt),t(Jt),t(Qt),e.clearTransformWidgetPosition(),e.clearTransformWidgetOrientation()})),r=useActionCallback((()=>async()=>{await s(),t.execute(Yt.CLEAR_SELECTION,t.clearSelectionTransform)})),c=useActionCallback((({set:e})=>async t=>{e(Qt,t)})),d=useActionCallback((({reset:e,set:t})=>e=>{}));return{select:a,toggleSelection:l,clearAndSelect:o,selectCurrentHit:useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(ut).then((e=>e.value)),n=await e.getPromise(st),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 l(t):await r():await o(t)}))),syncSelection:useActionCallback((({set:e,reset:t})=>async(a,i)=>{i.selected?(await n(),e(Xt(a.id),a),i.multiSelect?e(qt,(e=>[...e.filter((e=>e!==a.id)),a.id])):e(qt,[a.id]),d(a),e(Zt,a),e(Jt,!1),e(Qt,!!i.multiSelect)):(t(Xt(a.id)),t(Qt),e(qt,(e=>e.filter((e=>e!==a.id)))))})),deselect:i,clearSelection:r,resetSelectionState:s,toggleLastSelectWasMultiSelect:c,selectForModelViewsPanel:d}}const bn=o({key:"viewerToolkitSelectionState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,i=undefined;return{selectedItemIds:e(qt),lastSelected:e(Zt),highestSelectedAncestorId:e(en)}}});var Cn=Object.freeze({__proto__:null,selectionBoundingBoxCenter:ln,selectionHighestSelectedAncestor:en,selectionIsActive:on,selectionLastSelectWasMultiSelect:Qt,selectionLastSelected:Zt,selectionLastSelectionFromViewer:Jt,selectionPreviousVisibleSummary:tn,selectionSelectedItemIds:qt,selectionSelectedItems:Xt,selectionState:bn,selectionVisibleCount:an,selectionVisibleSummary:nn,useSelectionActions:useSelectionActions});const wn=255,Sn=l({key:"sceneItemAdjustmentsSelectedColor",default:void 0}),xn=l({key:"sceneItemAdjustmentsSelectedOpacity",default:void 0}),kn=d({key:"appliedItemMaterialOverride",default:void 0}),An=l({key:"appliedItemMaterialOverrideIds",default:[]}),Tn=o({key:"sceneItemAdjustmentsLastSelectedOverride",get:({get:e})=>{const t=e(Zt);if(null!=t)return e(kn(t.id))}}),En=l({key:"applyMaterialToAllUserAction",default:void 0}),Pn=l({key:"showConfirmDialogWhenApplyingMaterialToAll",default:!0}),On=l({key:"confirmApplyMaterialToAllDialogOpen",default:!1}),useSceneItemMaterialActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(An);t(Sn),n.forEach((e=>t(kn(e)))),t(An)}));return{updateColor:useActionCallback((({set:e})=>t=>{e(Sn,t)})),clearCurrentColor:useActionCallback((({reset:e})=>()=>{e(Sn)})),clearCurrentOpacity:useActionCallback((({reset:e})=>()=>{e(xn)})),clear:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const i=await t.getPromise(qt);a(Sn),i.forEach((e=>a(kn(e)))),n(An,(e=>e.filter((e=>!i.includes(e))))),await e.execute(Yt.CLEAR_SELECTED_MATERIAL_OVERRIDES,(e=>e.where((e=>e.withSelected())).clearMaterialOverrides().select()))})),clearAll:useActionCallback((()=>async()=>{await t(),await e.execute(Yt.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(xn,t)})),apply:useActionCallback((({snapshot:t,set:n})=>async()=>{const a=await t.getPromise(Sn),i=await t.getPromise(xn),l=await t.getPromise(qt),o=await t.getPromise(Tn),s=null!=a?a:o,r=null!=i?i:null==o?void 0:o.opacity;if(null!=s){const t=Object.assign(Object.assign({},s),{opacity:null!=r?r:s.opacity});await e.execute(Yt.APPLY_MATERIAL_OVERRIDE_TO_SELECTION,(e=>e.where((e=>e.withSelected())).materialOverride(t))),l.forEach((e=>n(kn(e),t))),n(An,(e=>[...e,...l]))}})),confirmApplyAll:useActionCallback((({set:e})=>t=>{e(On,!0),e(En,(()=>t))})),cancelApplyAll:useActionCallback((({reset:e})=>()=>{e(On),e(En)})),applyAll:useActionCallback((({snapshot:t,reset:n})=>async()=>{const a=await t.getPromise(Sn),i=await t.getPromise(xn);if(null!=a){const l=await t.getPromise(An),o=Object.assign(Object.assign({},a),{opacity:null!=i?i:a.opacity});await e.execute(Yt.APPLY_MATERIAL_OVERRIDE_TO_ALL,(e=>e.where((e=>e.all())).materialOverride(o))),l.forEach((e=>n(kn(e))));const s=await t.getPromise(En);null==s||s(o),n(On),n(En)}})),hideConfirmApplyAllDialog:useActionCallback((({set:e})=>()=>{e(Pn,!1)}))}},Nn="#FFFFFF",Mn=l({key:"viewerBackgroundSelectedColor",default:Nn}),VertexSceneItemMaterialApplyAll=({onApplyAll:t})=>{const n=useSceneItemMaterialActions(),a=u(Tn),i=s(Sn),l=s(Pn),o=p.useMemo((()=>"hasValue"===a.state?null!=i?i:a.contents:i),[a,i]);return e(P,{content:"Apply to All",children:e(O,{iconName:"square-dot-outline",iconSize:"sm",color:"secondary",disabled:null==o,onClick:async()=>{l?n.confirmApplyAll(t):(await n.applyAll(),null==t||t(o))}})})};function SceneItemMaterialApplyAllConfirmationDialog(){const a=useSceneItemMaterialActions(),i=s(On),[l,o]=h.useState(!1),onCloseDialog=()=>{a.cancelApplyAll(),o(!1)};return i?t(N,{open:!0,className:"text-sm",onClosed:onCloseDialog,onBackdropClick:onCloseDialog,children:[e("div",{slot:"heading",children:"Apply to All Parts"}),e("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."}),t("div",{className:"flex mt-8 gap-2 items-center",children:[t("div",{className:"flex gap-2",children:[e(M,{"data-testid":"hide-confirmation-dialog-in-future-checkbox",variant:"check",className:"pt-0.5",checked:l,onValueChanged:e=>{o(e.detail)}}),"Don't show again this session"]}),t("div",{className:"flex ml-auto gap-2",children:[e(I,{"data-testid":"cancel-apply-material-to-all",onClick:onCloseDialog,children:"Cancel"}),e(I,{color:"primary","data-testid":"confirm-apply-material-to-all",onClick:async()=>{await a.applyAll(),l&&a.hideConfirmApplyAllDialog()},children:"Apply"})]})]})]}):e(n,{})}function createColorMaterialWithId(e,t=Oe.create()){return Object.assign({id:t},K.fromHex(e))}const VertexSceneItemMaterialColorPicker=({onApply:t})=>{const n=useSceneItemMaterialActions(),a=u(Tn),i=s(Sn),l=p.useMemo((()=>"hasValue"===a.state?null!=i?i:a.contents:i),[a,i]);return e(VertexColorPicker,{"data-testid":"selected-item-color-picker",value:null!=l?xe.toHexString(l.diffuse):void 0,onValueChanged:()=>{n.apply(),null==t||t(l)},onInput:async e=>{n.updateColor(createColorMaterialWithId(e)),await n.apply()}})},VertexSceneItemMaterialOpacitySlider=({onApply:t})=>{const n=useSceneItemMaterialActions(),a=s(xn),i=u(Tn),l=p.useMemo((()=>{var e,t;return"hasValue"===i.state?null!==(t=null!=a?a:null===(e=i.contents)||void 0===e?void 0:e.opacity)&&void 0!==t?t:wn:null!=a?a:wn}),[a,i]),o=useDebouncedCallback((()=>{n.apply()}),500),r=p.useCallback((e=>{n.updateOpacity(e.detail.value),o(e.detail.value)}),[o,n]),c=p.useMemo((()=>"hasValue"!==i.state||null==i.contents),[i]);return e(P,{className:"flex w-full",content:c?"Select a part and apply a color to enable opacity":`${Math.floor(l/wn*100)}%`,placement:"top",children:e(VertexSlider,{"data-testid":"scene-item-adjustments-opacity-slider",leftLabel:"0%",rightLabel:"100%",disabled:c,value:null!=l?l:wn,step:5,min:0,max:wn,onValueChange:e=>{n.updateOpacity(e.detail.value),n.apply(),null==t||t(e.detail.value)},onValueInput:r})})};function VertexMaterialControls({onApplyMaterial:a,onApplyMaterialToAll:i,onApplyOpacity:l}){const o=useSceneItemMaterialActions(),r=s(Zt);return h.useEffect((()=>{o.clearCurrentColor(),o.clearCurrentOpacity()}),[null==r?void 0:r.id]),t(n,{children:[t("div",{className:"flex flex-col",children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),t("div",{className:"flex items-center gap-2",children:[e(VertexSceneItemMaterialColorPicker,{onApply:a}),e(VertexSceneItemMaterialApplyAll,{onApplyAll:i})]})]}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e(VertexSceneItemMaterialOpacitySlider,{onApply:l}),e(SceneItemMaterialApplyAllConfirmationDialog,{})]})}const ResetButton=({id:n,tooltip:a,children:i})=>{const[l,o]=h.useState(!1);return e("div",{className:"ml-auto",children:t(V,{className:"flex items-stretch h-full","data-testid":`reset-button-dropdown-menu-${n}`,placement:"bottom-end",onMenuOpened:()=>o(!0),onMenuClosed:()=>o(!1),children:[e("div",{slot:"anchor",className:"flex items-center h-full",children:e(P,{content:a,disabled:l,placement:"bottom",children:t(I,{className:vt("p-1.5 rounded-md select-none hover:bg-neutral-300 active:bg-neutral-400 cursor-pointer",{"bg-neutral-300":l}),"data-testid":`reset-button-${n}`,variant:"plaintext",children:[e(L,{className:"px-0.5",name:"reset",size:"sm"}),e(L,{name:"chevron-down",size:"sm"})]})})}),e("div",{className:"whitespace-nowrap",children:i})]})})},VertexSceneItemMaterialClear=({onClear:n,onClearAll:a})=>{const i=useSceneItemMaterialActions(),l=s(on);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"materials",tooltip:"Clear Materials",children:[e("div",{className:"pt-1"}),e(R,{"data-testid":"clear-selected-materials",onClick:()=>{i.clear(),null==n||n()},disabled:!l,children:"Clear selected materials"}),e(R,{"data-testid":"clear-all-materials",onClick:()=>{i.clearAll(),null==a||a()},children:"Clear all materials"})]})})};function VertexMaterialPanelSection({onClearMaterial:n,onClearAllMaterials:a,onApplyMaterial:i,onApplyMaterialToAll:l,onApplyOpacity:o}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Material",e(VertexSceneItemMaterialClear,{onClear:n,onClearAll:a})]}),children:e(VertexMaterialControls,{onApplyMaterial:i,onApplyMaterialToAll:l,onApplyOpacity:o})})}const In="#ffff00",Vn=35,Ln=1,Rn=l({key:"selectionHighlightingSelectedColor",default:In}),_n=l({key:"selectionHighlightingSelectedOpacity",default:Vn}),Bn=l({key:"selectionHighlightingSelectedLineThickness",default:1}),VertexSelectionHighlightingColorPicker=({onUpdate:t})=>{const[n,a]=r(Rn);return e(VertexColorPicker,{"data-testid":"selection-highlighting-color-picker",value:n,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})},VertexSelectionHighlightingLineThicknessSlider=({onUpdate:t})=>{const[n,a]=r(Bn);return e(VertexSlider,{id:"selection-highlighting-line-thickness","data-testid":"selection-highlighting-line-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:n,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},VertexSelectionHighlightingOpacitySlider=({onUpdate:t})=>{const[n,a]=r(_n);return e(VertexSlider,{id:"selection-highlighting-opacity","data-testid":"selection-highlighting-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:n,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexSelectionHighlightingControls({onUpdateSelectionHighlightColor:a,onUpdateSelectionHighlightOpacity:i,onUpdateSelectionHighlightLineThickness:l}){return t(n,{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e(VertexSelectionHighlightingColorPicker,{onUpdate:a}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e(VertexSelectionHighlightingOpacitySlider,{onUpdate:i}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e(VertexSelectionHighlightingLineThicknessSlider,{onUpdate:l})]})}const VertexSelectionHighlightingReset=({onReset:t})=>{const[n,a]=r(Rn),[i,l]=r(_n),[o,s]=r(Bn),c=undefined;return e("div",{className:"ml-auto",children:e(P,{content:"Reset Selection Highlighting",children:e(O,{"data-testid":"selection-highlighting-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(In),l(Vn),s(1),null==t||t()},disabled:!(n!==In||i!==Vn||1!==o)})})})};function VertexSelectionHighlightingPanelSection({onResetSelectionHighlighting:n,onUpdateSelectionHighlightColor:a,onUpdateSelectionHighlightOpacity:i,onUpdateSelectionHighlightLineThickness:l}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Selection Highlighting",e(VertexSelectionHighlightingReset,{onReset:n})]}),children:e(VertexSelectionHighlightingControls,{onUpdateSelectionHighlightColor:a,onUpdateSelectionHighlightOpacity:i,onUpdateSelectionHighlightLineThickness:l})})}const VertexViewerBackgroundColorPicker=({onUpdate:t})=>{const[n,a]=r(Mn);return e(VertexColorPicker,{"data-testid":"viewer-background-color-picker",value:n,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})};function VertexViewerBackgroundControls({onUpdateViewerBackgroundColor:a}){return t(n,{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e(VertexViewerBackgroundColorPicker,{onUpdate:a})]})}const VertexViewerBackgroundReset=({onReset:t})=>{const[n,a]=r(Mn),i=undefined;return e("div",{className:"ml-auto",children:e(P,{content:"Reset Background Color",children:e(O,{"data-testid":"viewer-background-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(Nn),null==t||t()},disabled:!(n!==Nn)})})})};function VertexViewerBackgroundPanelSection({onResetViewerBackgroundColor:n,onUpdateViewerBackgroundColor:a}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Viewer Background",e(VertexViewerBackgroundReset,{onReset:n})]}),children:e(VertexViewerBackgroundControls,{onUpdateViewerBackgroundColor:a})})}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,l=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement,o=e instanceof HTMLElement&&"VERTEX-VIEWER-PIN-TOOL"===e.tagName,s=e instanceof HTMLElement&&"VERTEX-VIEWER-TRANSFORM-WIDGET"===e.tagName;return t||n||a||i||l||o||s},useRecoilReducer=({reducer:e,atom:t})=>{const n=undefined,a=undefined;return[s(t),useRecoilReducerDispatch({reducer:e,atom:t})]},useRecoilReducerDispatch=({reducer:e,atom:t})=>{const n=i((({set:n})=>async a=>{n(t,(t=>e(t,a)))}),[]);return n},Dn=l({key:"keyBindings",default:{applyBindings:[],bindings:{},pressed:{}}});function reducer(e,t){var n,a,i,l;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 s=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!==(l=e.bindings[t.binding.keyBind])&&void 0!==l?l:[]).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:Dn});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();h.useEffect((()=>{const a=Oe.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();h.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(),i=h.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]);h.useEffect((()=>{const handleKeyDown=e=>{if(!e.repeat&&!t(e.target)){a({type:"set-key-pressed",key:e.key,pressed:!0}),i(e.key);const t=Object.assign(Object.assign({},n.pressed),{[e.key]:!0}),l=matchingSingleFnBindings(n.applyBindings,t,e.key),o=matchingOffBindings(n.applyBindings,t,e.key);(l.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)}}),[i,n.applyBindings,n.pressed]),h.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]),h.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(),n=s(Pt);return useStackKeyBinding({id:"ExitBoxSelection",keyBind:"Escape",fn:t.disable,addPredicate:()=>n,cancelPredicate:()=>!n},[n]),e(P,{content:"Box Selection",children:e(O,{iconName:"box-cursor",iconColor:n?"primary":"secondary","data-testid":"viewer-toolbar-enable-box-selection-button",onClick:n?t.disable:t.enable})})},zn=1,VertexResizableContent=n=>{var{className:a,style:i,displayShadow:l,heading:o,id:s,initialScale:r,placement:c="left",children:d,onResize:u}=n,m=__rest(n,["className","style","displayShadow","heading","id","initialScale","placement","children","onResize"]);const p="left"===c||"right"===c,h="top"===c;function getHorizontalResizeDirection(){switch(c){case"left":return"right";case"right":return"left";default:return"none"}}function getVerticalResizeDirection(){return"top"===c?"top":"none"}const g=null!=r?r:1;return e(_,Object.assign({id:s,"data-testid":`resizable-content-position-${c}`,className:vt(a,"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"===c,"sidebar-shadow-right":"left"===c&&l,"border-l min-w-75 max-w-half":"right"===c,"sidebar-shadow-left":"right"===c&&l,"border-t bottom-0 fixed":"top"===c,"min-h-12 sheet":h}),style:Object.assign({maxHeight:"top"===c?window.innerHeight:void 0},i),initialHorizontalScale:p?r:void 0,initialVerticalScale:h?g:void 0,horizontalDirection:getHorizontalResizeDirection(),verticalDirection:getVerticalResizeDirection(),position:"right"===c||"top"===c?"absolute":"relative",onResizeEnd:()=>null==u?void 0:u()},m,{children:t("div",{className:"flex flex-col h-full w-full",children:["top"===c&&e("div",{className:"flex justify-center w-full",children:e("div",{className:"block md:hidden w-20 h-0.5 mt-0.5 bg-neutral-600 rounded"})}),o,e("div",{className:vt("w-full flex flex-col h-0 flex-grow",{"right-0":"right"===c}),children:d})]})}))};function useDefaultKeybindings(){useApplyKeyBinding({fn:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromiseRequired(Re),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,l]=p.useState(),[o,s]=p.useState();p.useEffect((()=>{const handleTouchStart=e=>{const a=e;null!=a.touches&&1===a.touches.length&&(null!=i&&clearTimeout(i),s(A.create(a.touches[0].clientX,a.touches[0].clientY)),l(setTimeout((()=>null==t?void 0:t(a)),n)))},handleTouchMove=e=>{const t=e;null!=t.touches&&t.touches.length>0&&null!=i&&null!=o&&A.distance(o,A.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,o])}function asBooleanAttribute(e){return!!e||void 0}const VertexContextMenu=({targetElement:t,menuType:n,disableBackdrop:a,openPredicate:i,onOpen:l,onClose:o,children:r})=>{const c=useContextMenuActions(),d=s(St),u=s(Et),m=h.useMemo((()=>["bottom-end","top-start","top-end","right","left"]),[]),p=d===n;useStackKeyBinding({id:"ContextMenu",keyBind:"Escape",fn:c.clearActiveContextMenu,addPredicate:()=>null!=d&&d===n,cancelPredicate:()=>null==d},[d]);const g=h.useMemo((()=>null!=t?t:null!=i?window:void 0),[t,i]);return useLongPress({target:g,callback:e=>c.longPress(e,n,i,l),onMovement:()=>c.clearActiveContextMenu()}),h.useEffect((()=>{const handleWindowPointerDown=e=>{const t=undefined;if(!targetWithinMenu(e)&&2!==e.buttons&&d===n){const t=targetShouldSkipNextHit(e);c.clearActiveContextMenu(t)}};if(a)return window.addEventListener("pointerdown",handleWindowPointerDown),()=>{window.removeEventListener("pointerdown",handleWindowPointerDown)}}),[a,n,d]),h.useEffect((()=>{const handlePointerDown=e=>{c.pointerDown(e)},handlePointerUp=e=>{c.pointerUp(e,n,i,l)},handleContextMenu=e=>c.contextMenu(e,i);return null==g||g.addEventListener("pointerdown",handlePointerDown),null==g||g.addEventListener("pointerup",handlePointerUp),null==g||g.addEventListener("contextmenu",handleContextMenu),()=>{null==g||g.removeEventListener("pointerdown",handlePointerDown),null==g||g.removeEventListener("pointerup",handlePointerUp),null==g||g.removeEventListener("contextmenu",handleContextMenu)}}),[t,n,i]),e("div",{className:vt({hidden:!p}),children:e(B,{"data-testid":`${n}-context-menu`,open:asBooleanAttribute(p),position:u,fallbackPlacements:m,backdrop:!a,onMenuClosed:()=>{c.clearActiveContextMenu(),null==o||o()},children:e("div",{className:"pt-1",children:r})})})},VertexFitSelectedMenuItem=()=>{const n=s(qt),a=s(nn),i=useViewerCameraActions();return t(R,{"data-testid":"fit-selected-menu-option",onClick:()=>{null!=(null==a?void 0:a.boundingBox)&&i.flyToByBoundingBox(a.boundingBox)},disabled:asBooleanAttribute(0===n.length),children:[e(L,{slot:"icon",name:"fit-selected",size:"sm"}),e("div",{className:"pl-2",children:"Fit Selected"})]})},VertexFlyToMenuItem=()=>{const n=useViewerCameraActions(),a=s(At);return t(R,{"data-testid":"fly-to-part-menu-option",onClick:()=>{var e;const t=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&&n.flyToById(i)},disabled:asBooleanAttribute(null==a),children:[e(L,{slot:"icon",name:"paper-airplane",size:"sm"}),e("div",{className:"pl-2",children:"Fly To"})]})};function useSceneItemsOperations(){const e=s(Ne),t=undefined,n=undefined,a=undefined,i=undefined,l=undefined,o=undefined;return{sceneItemsOperation:h.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:h.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:h.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:h.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:h.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:h.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 n=useSceneItemsOperations();return t(R,{"data-testid":"hide-all-menu-option",onClick:()=>{n.sceneItemsOperation((e=>e.hide()))},children:[e(L,{slot:"icon",name:"visibility-hidden",size:"sm"}),e("div",{className:"pl-2",children:"Hide All Parts"})]})},VertexHidePartMenuItem=()=>{const n=s(At),a=useSceneItemsOperations();return t(R,{"data-testid":"hide-menu-option",onClick:()=>{var e;const t=undefined,i=contextMenuItemIsRow(n)?null===(e=null==n?void 0:n.node.id)||void 0===e?void 0:e.hex:n.id;null!=i&&a.sceneItemsOperation((e=>e.hide()),[i])},disabled:asBooleanAttribute(null==n),children:[e(L,{slot:"icon",name:"visibility-hidden",size:"sm"}),e("div",{className:"pl-2",children:"Hide Part"})]})},VertexHideSelectedMenuItem=()=>{const n=s(qt),a=useSceneItemsOperations();return t(R,{"data-testid":"hide-selected-menu-option",onClick:()=>a.hideSelected(),disabled:asBooleanAttribute(0===n.length),children:[e(L,{slot:"icon",name:"visibility-hidden",size:"sm"}),e("div",{className:"pl-2",children:"Hide Selected"})]})},VertexShowAllMenuItem=()=>{const n=useSceneItemsOperations();return t(R,{"data-testid":"show-all-menu-option",onClick:()=>{n.sceneItemsOperation((e=>e.show()))},children:[e(L,{slot:"icon",name:"visibility-visible",size:"sm"}),e("div",{className:"pl-2",children:"Show All Parts"})]})},VertexShowOnlyMenuItem=()=>{const n=s(At),a=useSceneItemsOperations();return t(R,{"data-testid":"show-only-menu-option",onClick:()=>{var e;const t=undefined,i=contextMenuItemIsRow(n)?null===(e=null==n?void 0:n.node.id)||void 0===e?void 0:e.hex:null==n?void 0:n.id;null!=i&&a.showOnlyItem(i)},disabled:asBooleanAttribute(null==n),children:[e(L,{slot:"icon",name:"visibility-visible",size:"sm"}),e("div",{className:"pl-2",children:"Show Only Part"})]})},VertexShowOnlySelectedMenuItem=()=>{const n=s(qt),a=useSceneItemsOperations();return t(R,{"data-testid":"show-only-selected-menu-option",onClick:()=>a.showOnlySelected(),disabled:asBooleanAttribute(0===n.length),children:[e(L,{slot:"icon",name:"visibility-visible",size:"sm"}),e("div",{className:"pl-2",children:"Show Only Selected"})]})};l({key:"sceneTreeLoaderVisible",default:!1});const jn=l({key:"sceneTreeElement",default:void 0}),Hn=l({key:"sceneTreeController",default:void 0,dangerouslyAllowMutability:!0});function useSceneTreeActions(){const e=useSelectionActions(),t=useViewerCameraActions();return{toggleSelection:useActionCallback((({snapshot:t})=>async(n,a,i)=>{var l,o;if(!n.defaultPrevented&&0===n.button&&(n.altKey||((n.ctrlKey||n.metaKey)&&a.selected?await i.deselectItem(a):a.selected?await i.selectItem(a,{recurseParent:!0}):a.selected||await i.selectItem(a,{append:n.ctrlKey||n.metaKey,range:n.shiftKey})),null!=a.id)){const i=await t.getPromise(Zt);e.syncSelection({id:null===(l=a.id)||void 0===l?void 0:l.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(jn),l=await(null==i?void 0:i.getRowAtClientY(n));null!=(null===(a=null==l?void 0:l.node.id)||void 0===a?void 0:a.hex)&&await t.flyToById(l.node.id.hex)})),setContextMenuItem:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(jn),i=await(null==a?void 0:a.getRowAtClientY(n));e(At,i)}))}}const VertexGhostSelectedMenuItem=()=>{const n=s(qt),a=useSceneItemsOperations();return t(R,{"data-testid":"ghost-selected-menu-option",onClick:()=>a.ghostSelected(),disabled:asBooleanAttribute(0===n.length),children:[e(L,{slot:"icon",name:"visibility-partial",size:"sm"}),e("div",{className:"pl-2",children:"Ghost Selected"})]})},VertexUnghostSelectedMenuItem=()=>{const n=s(qt),a=useSceneItemsOperations();return t(R,{"data-testid":"unghost-selected-menu-option",onClick:()=>a.unGhostSelected(),disabled:asBooleanAttribute(0===n.length),children:[e(L,{slot:"icon",name:"visibility-visible",size:"sm"}),e("div",{className:"pl-2",children:"Unghost Selected"})]})},DefaultSceneTreeContextMenu=()=>t("div",{className:"w-56",children:[e(VertexHideSelectedMenuItem,{}),e(VertexHideAllMenuItem,{}),e(VertexShowOnlyMenuItem,{}),e(VertexShowOnlySelectedMenuItem,{}),e(VertexShowAllMenuItem,{}),e(VertexGhostSelectedMenuItem,{}),e(VertexUnghostSelectedMenuItem,{}),e(D,{}),e(VertexFitSelectedMenuItem,{}),e(VertexFlyToMenuItem,{})]}),VertexSceneTreeContextMenu=({children:t})=>{const n=useSceneTreeActions(),a=s(jn),i=undefined;return e(VertexContextMenu,{menuType:"scene-tree",targetElement:a,onOpen:async(e,t)=>{const a=e;await n.setContextMenuItem(a.clientY)},disableBackdrop:!0,children:null!=t&&!1!==t?t:e(DefaultSceneTreeContextMenu,{})})},DefaultViewerContextMenu=()=>t("div",{className:"w-56",children:[e(VertexHidePartMenuItem,{}),e(VertexHideSelectedMenuItem,{}),e(VertexHideAllMenuItem,{}),e(VertexShowOnlyMenuItem,{}),e(VertexShowOnlySelectedMenuItem,{}),e(VertexShowAllMenuItem,{}),e(VertexGhostSelectedMenuItem,{}),e(VertexUnghostSelectedMenuItem,{}),e(D,{}),e(VertexFitSelectedMenuItem,{}),e(VertexFlyToMenuItem,{})]}),VertexViewerContextMenu=({children:t})=>{const n=null!=t&&!1!==t,a=h.useCallback((e=>e.target instanceof HTMLElement&&"vertex-viewer"===e.target.id),[]);return e(VertexContextMenu,{menuType:"viewer",disableBackdrop:!0,openPredicate:a,children:n?t:e(DefaultViewerContextMenu,{})})},Fn=undefined,Un=l({key:"sceneItemGhostingSelectedOpacity",default:35}),Wn=d({key:"appliedItemPhantomState",default:void 0}),Gn=l({key:"appliedItemPhantomStateIds",default:[]}),Kn=o({key:"sceneItemGhostingLastSelectedPhantom",get:({get:e})=>{var t;const n=e(Zt);return null!=n&&(null!==(t=e(Wn(n.id)))&&void 0!==t&&t)}}),VertexSceneItemGhostingOpacitySlider=({onApply:t})=>{const[n,a]=r(Un);return e(VertexSlider,{id:"phantom-opacity","data-testid":"phantom-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:n,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(Gn)).forEach((e=>t(Wn(e)))),t(Gn)}));return{setPhantomState:useActionCallback((({snapshot:t,set:n})=>async a=>{const i=await t.getPromise(qt);i.forEach((e=>n(Wn(e),a))),n(Gn,(e=>[...e,...i])),await e.execute(Yt.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(qt);i.forEach((e=>a(Wn(e)))),n(Gn,(e=>e.filter((e=>!i.includes(e))))),await e.execute(Yt.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(Yt.CLEAR_PHANTOM_ALL,(e=>e.where((e=>e.all())).clearPhantom()),(e=>e.where((e=>e.withSelected())).select()))})),resetAllPhantomState:t}},VertexSceneItemGhostingToggle=({onApply:t})=>{const n=useSceneItemPhantomActions(),a=s(on),i=u(Kn);return e(P,{content:"Select a part to display as ghost",disabled:a,children:e(M,{className:"flex items-center","data-testid":"phantom-state-toggle",variant:"switch",disabled:!a,checked:"hasValue"===i.state&&i.contents,onValueChanged:async e=>{await n.setPhantomState(e.detail),null==t||t(e.detail)}})})};function VertexGhostingControls({onApplyGhostingChange:a,onApplyOpacity:i}){return t(n,{children:[t("div",{className:"flex items-center py-3",children:[e(VertexSceneItemGhostingToggle,{onApply:a}),e("span",{className:"pl-4 text-sm text-neutral-700",children:"Display as Ghost"})]}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Global Ghost Opacity"}),e(VertexSceneItemGhostingOpacitySlider,{onApply:i})]})}const VertexSceneItemGhostingClear=({onClear:n,onClearAll:a})=>{const i=useSceneItemPhantomActions(),l=s(Kn);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"phantom",tooltip:"Clear Ghosting",children:[e("div",{className:"pt-1"}),e(R,{"data-testid":"reset-selected-phantom",onClick:async()=>{await i.clearPhantomState(),null==n||n()},disabled:!l,children:"Clear ghosting for selected"}),e(R,{"data-testid":"reset-all-phantom",onClick:async()=>{await i.clearAllPhantomState(),null==a||a()},children:"Clear ghosting for all"})]})})};function VertexGhostingPanelSection({onClearGhostState:n,onClearAllGhostState:a,onApplyGhostingChange:i,onApplyOpacity:l}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Ghosting",e(VertexSceneItemGhostingClear,{onClear:n,onClearAll:a})]}),children:e(VertexGhostingControls,{onApplyGhostingChange:i,onApplyOpacity:l})})}function VertexMeasurementContextMenu({onDelete:n}){const a=s(kt);return e(VertexContextMenu,{menuType:"measurement",openPredicate:e=>e.target instanceof HTMLElement&&"VERTEX-VIEWER-MEASUREMENT-DISTANCE"===e.target.tagName,children:t(R,{"data-testid":"measurement-delete",onClick:()=>null!=a&&n(a.id),children:[e(L,{slot:"icon",name:"delete",size:"sm"}),e("div",{className:"pl-2",children:"Delete"})]})})}const $n=l({key:"lengthUnit",default:"cm"}),Yn=l({key:"decimalPlace",default:"2"});var Xn,qn;!function(e){e.mm="millimeters",e.cm="centimeters",e.m="meters",e.in="inches",e.ft="feet"}(Xn||(Xn={})),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"}(qn||(qn={}));const convertFrom=(e,t)=>{const n=undefined;return e/qn[t]},convertTo=(e,t)=>{const n=undefined;return e*qn[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]=p.useState(A.create(0,0));return p.useLayoutEffect((()=>{if(null!=e){const n=e.getBoundingClientRect(),i=A.create(n.left,n.bottom),l=A.create(n.right,n.bottom);a("left"===t?i:l)}}),[e,t]),n}function VertexMeasurementDetails({placement:n}){const a=useMeasurementActions(),i=s(Ne),l=s(Me),o=useDockedPlacement(null!=i?i:null,n),r=s(Ht),c=s(Ft),d=s(Ut),u=s(Wt),m=s($n),p=s(Yn);return e(j,{className:"z-popover",boundaryPadding:16,boundarySelector:`#${l}`,position:o,children:t("div",{className:"flex flex-col leading-4 min-w-40",children:[t("div",{className:"pb-2 flex justify-between",children:[e("div",{className:"w-full",children:"Measurement"}),e("div",{className:vt("-mt-1 relative",{hidden:!u}),children:e(P,{content:"Reset",placement:"left-start",children:e(O,{"data-testid":"measurement-details-reset",iconName:"reset",iconSize:"sm",onClick:a.resetMeasurement})})})]}),e($,{"data-testid":"measurement-details-viewer-measurement-details",className:vt("gap-y-1.5 text-xs",{hidden:null==r}),measurementOutcome:r,measurementOverlays:c,distanceUnits:toUnitType(m),fractionalDigits:parseInt(p,10)}),e("div",{"data-testid":"measurement-details-message",className:vt("text-xs",{hidden:null==d}),children:d})]})})}function useCallbackRef(e){var t;const[n,a]=h.useState((t=void 0,null)),i=undefined;return{element:n,callback:h.useCallback((e=>a(e)),[])}}function VertexPointToPointMeasurement({detailsPlacement:a,onPointToPointMeasurementChange:i}){const l=useMeasurementActions(),o=s(Ne),r=s(Nt),c=s(It),d=s($n),u=s(Yn),{callback:m,element:p}=useCallbackRef();usePointToPointMeasurement(p);const h=f((e=>{const t={start:e.detail.start,end:e.detail.end,invalid:!e.detail.valid};l.setEditedPointToPointMeasurement(t),null==i||i(t)}),[l]);return r?t(n,{children:[e(Y,{"data-testid":"point-to-point-measurement",ref:m,viewer:null!=o?o:void 0,mode:"replace",start:null==c?void 0:c.start,end:null==c?void 0:c.end,invalid:null==c?void 0:c.invalid,units:toUnitType(d),fractionalDigits:parseInt(u,10),showAxisReferenceLines:!0,onEditEnd:h}),e(VertexMeasurementDetails,{placement:a}),e(VertexMeasurementContextMenu,{onDelete:l.resetMeasurement})]}):e(n,{})}function VertexPointToPointMeasurementTool(){const t=useMeasurementActions(),n=s(Nt);return useStackKeyBinding({id:"ExitMeasurement",keyBind:"Escape",fn:t.disableEditMeasurement,addPredicate:()=>n,cancelPredicate:()=>!n},[n,t]),e(P,{content:"Point to Point Measurement",children:e(O,{iconName:"tape-measure","data-testid":"viewer-toolbar-point-to-point-measurement-button",iconColor:n?"primary":"secondary",onClick:t.toggleEditPointToPointMeasurement})})}const Zn=l({key:"viewerToolkitSdkConfig",default:void 0}),VertexPreciseMeasurement=({detailsPlacement:a,onEntitiesChanged:i,onOutcomeChanged:l})=>{var o,r,c,d;const u=s(Ne),m=s(Zn),p=s(Lt),{callback:h,element:g}=useCallbackRef();return usePreciseMeasurementModel(g,i,l),p?t(n,{children:[e(X,{"data-testid":"precise-measurement-viewer-tool",ref:h,viewer:null!=u?u:void 0,config:JSON.stringify({network:{apiHost:null===(o=null==m?void 0:m.network)||void 0===o?void 0:o.apiHost,renderingHost:null===(r=null==m?void 0:m.network)||void 0===r?void 0:r.renderingHost,sceneTreeHost:null===(c=null==m?void 0:m.network)||void 0===c?void 0:c.sceneTreeHost,sceneViewHost:null===(d=null==m?void 0:m.network)||void 0===d?void 0:d.sceneViewHost}})}),e(VertexMeasurementDetails,{placement:a})]}):e(n,{})};function VertexPreciseMeasurementTool(){const t=useMeasurementActions(),n=s(Lt);return e(P,{content:"Precise Measurement",children:e(O,{iconName:"ruler","data-testid":"viewer-toolbar-precise-measurement-button",iconColor:n?"primary":"secondary",onClick:t.toggleEditPreciseMeasurement})})}function VertexApplicationMessages(){const a=s($t),i=s(Kt);return t(n,{children:[null!=a&&e(H,{className:"z-[16000]",duration:a.duration,open:!0,content:a.message,type:a.type},a.id),null!=i&&e(F,{placement:"bottom-left",className:"z-[16000]",duration:i.duration,open:!0,content:i.message,type:i.type},i.id)]})}const Jn={binding:"{{row.node.name}}",label:"Name",metadataKeyName:"VERTEX_SCENE_ITEM_NAME"};function mapToColumn(e,t){return{label:"name"===e.toLowerCase()?"Name (Property)":e,binding:`{{row.metadata.${e}}}`,initialWidth:t,minWidth:t/2}}const Qn=l({key:"sceneTreeColumnsRefreshTrigger",default:0}),ea=o({key:"sceneTreeColumnsAvailableColumns",get:async({get:e})=>{const t=e(Hn);return e(Qn),null!=t?await t.fetchMetadataKeys():[]}}),ta=o({key:"sceneTreeColumnsAvailableSortedColumns",get:({get:e})=>e(ea).filter((e=>e!==Jn.metadataKeyName)).sort(((e,t)=>e.localeCompare(t)))}),na=l({key:"sceneTreeColumnsVisibleMetadataColumnNames",default:[]}),aa=o({key:"sceneTreeColumnsActiveColumns",get:({get:e})=>{const t=e(na),n=e(jn),a=null==n?void 0:n.clientWidth;if(null!=a&&a>0){const e=1/(t.length+1)*a,n=(a-e)/t.length;return t.reduce(((e,t)=>{const a=mapToColumn(t,n);return Object.assign(Object.assign({},e),{[a.label]:a})}),{Name:Object.assign(Object.assign({},Jn),{initialWidth:e,minWidth:n})})}return{Name:Jn}}}),ia=o({key:"sceneTreeColumnsActiveColumnNames",get:({get:e})=>Object.keys(e(aa))});function useSceneTreeColumnActions(){return{setActive:useActionCallback((({set:e,snapshot:t})=>async n=>{e(na,n);const a=await t.getPromise(Hn);null==a||a.setMetadataKeys(n)})),refreshKeyList:useActionCallback((({set:e})=>()=>{e(Qn,(e=>e+1))}))}}const la=16,oa=-8;var sa;function useOpenColumnPopover({buttonElement:e,horizontalOffset:t,verticalOffset:n}){const[a,i]=p.useState(!1),[l,o]=p.useState(),[s,r]=p.useState(),c=p.useCallback((()=>{if(a)i(!1);else{const a=null==e?void 0:e.getBoundingClientRect();if(null!=a){const e=null!=t?t:la,l=null!=n?n:oa,s=a.x>window.innerWidth/2?sa.LEFT:sa.RIGHT;o({x:s===sa.LEFT?a.left-e:a.right+e,y:a.top+l}),r(s),i(!0)}}}),[a,e]),d=p.useCallback((()=>{i(!1)}),[]);return{open:a,position:l,direction:s,handleOpen:c,handleClose:d}}!function(e){e.LEFT="left",e.RIGHT="right"}(sa||(sa={}));const ra=l({key:"sceneTreeSearchActive",default:!1}),ca=l({key:"sceneTreeColumnsPartial",default:!1}),da=l({key:"sceneTreeSearchValue",default:void 0}),ua=l({key:"sceneTreeSearchExactMatch",default:!1}),ma=l({key:"sceneTreeSearchResultCount",default:0}),pa=l({key:"sceneTreeSearchActiveColumns",default:[]}),ha=o({key:"sceneTreeSearchNameColumnActive",get:({get:e})=>{const t=e(pa);return 0===t.length||t.includes(Jn.metadataKeyName)}});function useSceneTreeSearch({sceneTreeElement:e}){const t=c(ma);h.useEffect((()=>{let n;return whenComponentReady(e,(()=>{var a;n=null===(a=null==e?void 0:e.controller)||void 0===a?void 0:a.stateChanged((e=>{void 0!==(null==e?void 0:e.totalFilteredRows)&&t(null==e?void 0:e.totalFilteredRows)}))})),()=>{null==n||n.dispose()}}),[e])}function useSceneTreePartialResults({sceneTreeElement:e}){const t=c(ca);h.useEffect((()=>{let n;return whenComponentReady(e,(()=>{var a;n=null===(a=null==e?void 0:e.controller)||void 0===a?void 0:a.stateChanged((e=>{t(!!(null==e?void 0:e.isPartialKeysResponse))}))})),()=>{null==n||n.dispose()}}),[e])}const useSceneTreeSearchActions=()=>{const e=useActionCallback((({set:e})=>t=>{e(pa,t)})),t=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(jn),a=await e.getPromise(ua),i=await e.getPromise(pa),l=a?[Jn.metadataKeyName]:[],o=i.length>0?i:l;null==n||n.filterItems(t,{columns:o,exactMatch:a})})),n=useActionCallback((({snapshot:t})=>async(n,a)=>{const i=await t.getPromise(pa);if(a)e(0===i.length?[Jn.metadataKeyName,n]:[...i,n]);else{const t=i.filter((e=>e!==n));e(t.every((e=>e===Jn.metadataKeyName))?[]:t)}})),a=useActionCallback((({set:e})=>t=>{e(ua,t)}));return{setMetadataSearchKeys:e,updateSearchForActiveColumns:t,updateMetadataSearchAfterSearchKeysChange:n,setMetadataSearchExactMatch:a}};function useCacheableLoadable(e,t){const n=v(),[a,i]=b(0),l=u(e);g((()=>{"hasValue"===l.state&&(n.current=l.contents)}),[t,l]);const[o,s]=C((()=>"hasValue"!==l.state&&null!=n.current?[n.current,!0]:"hasValue"===l.state?[l.contents,!1]:[void 0,!1]),[l.state,l.contents,a]),r=f((()=>{n.current=void 0,i(a+1)}),[a]),c=undefined;return C((()=>({data:o,state:l.state,cached:s,invalidate:r})),[r,o,s,l.state])}const VertexSceneTreeMetadataCheck=({checked:n,disabled:a,onChange:i,children:l})=>{const o="string"==typeof l?l.replace(" ","-"):"";return t("div",{className:"flex items-center",children:[e(M,{"data-testid":`scene-tree-metadata-check-${o}`,variant:"check",checked:n,disabled:a,onValueChanged:e=>null==i?void 0:i(e.detail)}),e("div",{className:"pl-2 py-1 text-[0.875rem] w-full","data-testid":`scene-tree-metadata-name-${o}`,onClick:()=>{a||null==i||i(!n)},children:l})]})},VertexSceneTreeColumnPopover=({onVisibleSceneTreeColumnsChange:a})=>{const i=useSceneTreeColumnActions(),l=useSceneTreeSearchActions(),o=s(jn);useSceneTreePartialResults({sceneTreeElement:null!=o?o:null});const r=s(da),c=useCacheableLoadable(ta),d=s(na),u=s(ca),m=s(pa),[h,g]=p.useState(d),[f,v]=p.useState(""),{element:b,callback:C}=useCallbackRef(),{open:w,position:S,direction:k,handleOpen:A,handleClose:T}=useOpenColumnPopover({buttonElement:b}),E=k===sa.LEFT?"left-end":"right-start",N=p.useMemo((()=>{if(null!=c.data){const e=c.data.filter((e=>h.indexOf(e)<0)),t=undefined;return[...[...h].sort(((e,t)=>e.localeCompare(t))),...e]}return[]}),[h,c.data]),M=p.useMemo((()=>N),[w,c.data]);return t(n,{children:[e(P,{content:"Configure Columns",placement:"top",children:e(O,{"data-testid":"scene-tree-column-popover-button",ref:C,iconName:"columns-add",iconSize:"sm",onClick:()=>{A()}})}),w&&e(U,{"data-testid":"scene-tree-column-popover",open:w,backdrop:!1,position:S,resizeBehavior:"fixed",placement:E,className:"z-popover",children:t("div",{className:vt("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!w}),children:[t("div",{className:"flex items-center text-[0.875rem] p-3",children:[t("div",{className:"pr-2",children:[e("div",{className:"text-[0.875rem]",children:"Assembly Properties"}),e("div",{className:"text-[0.75rem] text-neutral-700 mt-1.5",children:"Select up to six properties to appear in the Assembly panel."})]}),e(O,{"data-testid":"scene-tree-columns-popover-close-button",className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{v(""),T()}})]}),e(W,{className:"flex w-full px-2 overflow-hidden border-b border-neutral-300 pb-2",id:"scene-tree-available-columns-search-bar","data-testid":"scene-tree-available-columns-search-bar",multiline:!1,placeholder:"Filter properties",type:"text",onInputInput:e=>{const t=e.detail.value;null!=t&&v(t.toLowerCase())}}),u&&e(q,{"data-testid":"partial-key-list-notification-banner",message:"loading"===c.state?"Refreshing results...":"Data loading, refresh for more.",actionLabel:"Refresh",onAction:()=>i.refreshKeyList()}),t("div",{className:"max-h-64 p-3 overflow-y-auto",children:[e(VertexSceneTreeMetadataCheck,{checked:!0,disabled:!0,children:Jn.label}),M.filter((e=>""===f||e.toLowerCase().includes(f))).map((t=>e(VertexSceneTreeMetadataCheck,{checked:h.includes(t),disabled:h.length>=6&&!h.includes(t),onChange:e=>{g(e?[...h,t]:h.filter((e=>e!==t)))},children:t},t)))]}),t("div",{className:"flex items-center p-3 border-t border-neutral-300 space-x-4",children:[e("div",{className:"text-[0.75rem] text-[var(--vertex-ui-blue-700)] cursor-pointer","data-testid":"scene-tree-column-clear-selection",onClick:()=>g([]),children:"Clear selection"}),e("div",{className:"flex-grow"}),t("div",{className:"flex space-x-2",children:[e(I,{"data-testid":"scene-tree-column-popover-cancel",color:"secondary",onClick:()=>{v(""),T()},children:"Cancel"}),e(I,{"data-testid":"scene-tree-column-popover-apply",color:"primary",onClick:async()=>{await i.setActive(h),null==a||a(h),v(""),T();const e=[Jn.metadataKeyName,...h],t=m.filter((t=>!e.includes(t)));t.length>0&&(await Promise.all(t.map((e=>l.updateMetadataSearchAfterSearchKeysChange(e,!1)))),null!=r&&await l.updateSearchForActiveColumns(r))},children:"Apply"})]})]})]})})]})},VertexSceneTreeSearchOptionsPopover=({onSearchedSceneTreeColumnsChange:a,onSearchForExactMatchChange:i})=>{const l=useSceneTreeSearchActions(),o=s(ha),r=s(pa),c=s(da),d=s(ua),u=s(na),{element:m,callback:p}=useCallbackRef(),{open:h,position:g,direction:f,handleOpen:v,handleClose:b}=useOpenColumnPopover({buttonElement:m,horizontalOffset:40}),C=f===sa.LEFT?"left-end":"right-start";return t(n,{children:[e(P,{content:"Search Options",placement:"top",children:e(O,{"data-testid":"scene-tree-search-options-popover-button",ref:p,iconName:"gear",iconSize:"sm",onClick:()=>{v()}})}),e(U,{"data-testid":"scene-tree-search-options-popover",open:h,backdrop:!1,position:g,resizeBehavior:"fixed",placement:C,className:"z-popover",children:t("div",{className:vt("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!h}),children:[t("div",{className:"flex items-center text-[0.875rem] p-3 border-b border-neutral-300 pb-2",children:[e("div",{className:"pr-2 text-[0.875rem] whitespace-nowrap",children:"Column Properties Search"}),e(O,{className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{b()}})]}),t("div",{className:"max-h-64 p-3 overflow-y-auto",children:[e("div",{className:"text-[0.875rem] pb-2 pr-2",children:"Select properties to perform the search on:"}),e(VertexSceneTreeMetadataCheck,{checked:o,disabled:0===r.length||r.every((e=>e===Jn.metadataKeyName)),onChange:async e=>{await l.updateMetadataSearchAfterSearchKeysChange(Jn.metadataKeyName,e),null==a||a(),null!=c&&await l.updateSearchForActiveColumns(c)},children:Jn.label},Jn.metadataKeyName),u.map((t=>e(VertexSceneTreeMetadataCheck,{checked:r.includes(t),disabled:r.length>0&&r.every((e=>e===t)),onChange:async e=>{await l.updateMetadataSearchAfterSearchKeysChange(t,e),null==a||a(),null!=c&&await l.updateSearchForActiveColumns(c)},children:t},t)))]}),t("div",{className:"flex p-3 border-t border-neutral-300",children:[e(M,{className:"flex items-center","data-testid":"filter-exact-match-toggle",variant:"switch",checked:d,onValueChanged:async e=>{l.setMetadataSearchExactMatch(e.detail),null==i||i(),null!=c&&await l.updateSearchForActiveColumns(c)}}),e("span",{className:"pl-4 text-[0.875rem] text-neutral-800",children:"Return only exact matches"})]})]})})]})},VertexSceneTreeSearchBar=({onSearch:n,onClearSearch:a,onExitSearchMode:i,onSearchedSceneTreeColumnsChange:l,onSearchForExactMatchChange:o,children:c})=>{const d=s(jn),[u,m]=r(ra),[h,g]=r(da);useSceneTreeSearch({sceneTreeElement:null!=d?d:null});const{element:f,callback:v}=useCallbackRef(),b=null==h||""===h,C=b?"Exit Search":"Clear Search";return p.useEffect((()=>{u&&(null==f||f.setFocus())}),[f,u]),t("div",{className:"flex w-full py-3 px-2",children:[e(Z,{"data-testid":"scene-tree-search-bar",ref:v,controller:null==d?void 0:d.controller,onBlur:()=>{b&&(m(!1),null==i||i())},onSearch:()=>{g(null==f?void 0:f.value),null==n||n(null==f?void 0:f.value)},children:c}),e("div",{className:"self-center px-1",onPointerDown:e=>{e.preventDefault()},children:e(VertexSceneTreeSearchOptionsPopover,{onSearchedSceneTreeColumnsChange:l,onSearchForExactMatchChange:o})}),e(P,{className:"self-center pr-1",content:C,children:e(O,{"data-testid":"scene-tree-search-close-button",iconName:"close-circle-fill",iconSize:"sm",variant:"plain",onPointerDown:e=>{e.preventDefault()},onClick:async()=>{b?(m(!1),null==i||i()):(await(null==f?void 0:f.clear()),await(null==f?void 0:f.setFocus()),g(void 0),null==a||a())}})})]})};function VertexToolbarDivider(){return e("div",{"data-testid":"toolbar-divider",className:"h-6 w-px bg-neutral-300 mx-1"})}const VertexSceneTreeSearchInformationForToolbar=()=>{const a=useSelectionActions(),i=s(jn),l=s(da),o=s(ma),r=undefined,c=undefined,d=`${o>=1e3?`${o}+`:`${o}`} ${1===o?"result":"results"}`;return t(n,{children:[e(VertexToolbarDivider,{}),t("div",{className:"flex flex-row items-center overflow-hidden",children:[e("div",{className:"px-2 text-[0.8125rem] leading-4 text-neutral-900 truncate","data-testid":"search-result-info",children:`${d}`}),e(P,{className:"w-auto",content:"Select Results",placement:"top",children:e(I,{className:"h-6 rounded cursor-pointer","data-testid":"select-search-results-button",color:"secondary",variant:"text",size:"sm",onClick:async()=>{null!=i&&null!=l&&(await i.selectFilteredItems(l),a.toggleLastSelectWasMultiSelect(!0))},children:t("div",{className:"flex h-6 items-center gap-1",children:[e(L,{size:"sm",name:"check-circle"}),e("span",{className:"whitespace-nowrap",children:"Select Results"})]})})})]})]})},targetIsElement=(e,t)=>e instanceof Element&&e.tagName===t;function useRecoilRef({state:e}){const t=i((({set:t})=>n=>{t(e,n)}),[]);return t}var ga;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===ga.ROBOTO_MONO?"var(--vertex-ui-font-family-monospace)":"var(--vertex-ui-font-family)"}!function(e){e.ROBOTO="ROBOTO",e.ROBOTO_MONO="ROBOTO_MONO"}(ga||(ga={}));const VertexEnterSceneTreeSearchModeButton=({onEnterSearchMode:t})=>{const n=c(ra);return e(P,{className:"flex ml-auto",content:"Scene Tree Search",children:e(O,{"data-testid":"enter-scene-tree-search-mode-button",iconName:"search",iconSize:"sm",onPointerDown:e=>{e.preventDefault()},onClick:()=>{n(!0),null==t||t()}})})},VertexSceneTreeSearch=({onEnterSearchMode:n,onExitSearchMode:a,onSearch:i,onClearSearch:l,onSearchedSceneTreeColumnsChange:o,onSearchForExactMatchChange:r,children:c})=>{const d=s(ra);return t(J,{className:"h-11 p-0 border-b border-neutral-300 box-content",slot:"header",children:[d&&e(VertexSceneTreeSearchBar,{onSearch:i,onClearSearch:l,onExitSearchMode:a,onSearchedSceneTreeColumnsChange:o,onSearchForExactMatchChange:r,children:c}),!d&&e("div",{className:"ml-auto mr-2",children:e(VertexEnterSceneTreeSearchModeButton,{onEnterSearchMode:n})})]})},VertexSceneTreeCollapseAll=()=>{const t=s(jn);return e(P,{className:"w-auto",content:"Collapse All",placement:"top",children:e(L,{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=s(jn);return e(P,{className:"w-auto",content:"Expand All",placement:"top",children:e(L,{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()}})})},VertexSceneTreeToolbar=({onVisibleSceneTreeColumnsChange:n})=>{const a=s(da),i=null==a||""===a;return e(J,{className:"h-10 border-b border-neutral-300 box-border",children:t("div",{className:"flex w-full text-neutral-700 items-center gap mx-2",children:[e(VertexSceneTreeExpandAll,{}),e(VertexSceneTreeCollapseAll,{}),!i&&e(VertexSceneTreeSearchInformationForToolbar,{}),e("div",{className:"ml-auto",children:e(VertexSceneTreeColumnPopover,{onVisibleSceneTreeColumnsChange:n})})]})})},VertexSceneTreeHeader=({onEnterSearchMode:a,onExitSearchMode:i,onSearch:l,onClearSearch:o,onVisibleSceneTreeColumnsChange:s,children:r})=>{const c=undefined;return e("div",{slot:"header",className:"flex flex-col",children:null!=r&&!1!==r?r:t(n,{children:[e(VertexSceneTreeSearch,{onEnterSearchMode:a,onExitSearchMode:i,onSearch:l,onClearSearch:o,children:e("div",{slot:"clear-icon"})}),e(VertexSceneTreeToolbar,{onVisibleSceneTreeColumnsChange:s})]})})},VertexSceneTreeTableLayout=n=>{const a=s(aa),i=s(ia),l=[];return e(Q,Object.assign({"data-testid":"scene-tree-table-layout"},n,{children:i.map(((n,o)=>{var s;const r=a[n],c=null!==(s=l[o])&&void 0!==s?s:r.initialWidth;return t(ee,{"data-testid":`scene-tree-table-column-${o}`,initialWidth:c,minWidth:r.minWidth,children:[e("template",{slot:"header",dangerouslySetInnerHTML:{__html:`\n <div class="text-sm text-neutral-800 my-2">\n <div class="${vt("truncate",{"pl-2":0===o,"pr-2":o===i.length-1})}">\n ${r.label}\n </div>\n </div>\n `}}),e("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===o?"expand-toggle":""}\n ${o===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="${o!==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:l,backgroundColors:o,children:r,style:d,onPointerDown:u,onClick:m,onToggleSelection:p,onToggleExpansion:g,onToggleVisibility:f,className:v,rowData:b}=a,C=__rest(a,["id","font","backgroundColors","children","style","onPointerDown","onClick","onToggleSelection","onToggleExpansion","onToggleVisibility","className","rowData"]);const w=useSceneTreeActions(),S=useSelectionActions(),k=s(Zn),A=s(Ne),T=s(pa),E=s(ua),P=s(da),O=null==P||""===P,N=useRecoilRef({state:jn}),M=null!=r&&!1!==r,wrappedExpansionHandler=(e,t,n)=>{w.toggleExpansion(e,t,n),null==g||g(e,t,n)},wrappedSelectionHandler=(e,t,n)=>{w.toggleSelection(e,t,n),null==p||p(e,t,n)},wrappedVisibilityHandler=(e,t,n)=>{w.toggleVisibility(e,t,n),null==f||f(e,t,n)},handleClick=e=>{e.altKey&&w.flyToRow(e.clientY),null==m||m(e)},handlePointerDown=e=>{targetIsElement(e.target,"VERTEX-SCENE-TREE-TABLE-COLUMN")&&S.clearSelection(),null==u||u(e)},I=c(Hn),handleFirstRowRendered=e=>{var t;I(e.target.controller),null===(t=null==C?void 0:C.onFirstRowRendered)||void 0===t||t.call(C,e)},V=h.useMemo((()=>({metadataSearchKeys:T,exactMatch:E})),[T,E]);return e("div",{className:vt("flex flex-col w-full h-full",v),children:e("div",{className:"flex group h-full",children:e(te,Object.assign({id:null!=i?i:"vertex-scene-tree","data-testid":"vertex-scene-tree",config:k,ref:N,className:vt("flex-1",{filtered:!O}),style:Object.assign(Object.assign(Object.assign({},styleFromOptionalFont(l)),styleFromOptionalBackgroundColors(o)),d),onConnectionError:e=>{logger_error("Scene Tree Connection Error: ",e.detail)},viewer:A,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)},searchOptions:V},C,{onFirstRowRendered:handleFirstRowRendered,children:M?r:t(n,{children:[e(VertexSceneTreeHeader,{}),e(VertexSceneTreeTableLayout,{}),e(VertexSceneTreeContextMenu,{})]})}))})})},VertexDecimalPlaceSelector=({onApply:n})=>{const[a,i]=r(Yn);return t(G,{"data-testid":"decimal-place-select",className:"w-24",value:a,onOptionChanged:e=>{i(e.detail),null==n||n(e.detail)},children:[e("div",{className:"py-1.5 px-3",children:"0"}),e("div",{className:"py-1.5 px-3",children:"1"}),e("div",{className:"py-1.5 px-3",children:"2"}),e("div",{className:"py-1.5 px-3",children:"3"})]})},VertexLengthUnitSelector=({onApply:n})=>{const[a,i]=r($n);return t(G,{"data-testid":"length-unit-select",className:"w-40",value:a,onOptionChanged:e=>{i(e.detail),null==n||n(e.detail)},children:[e("div",{"data-value":"cm",className:"py-1.5 px-3",children:"centimeters"}),e("div",{"data-value":"mm",className:"py-1.5 px-3",children:"millimeters"}),e("div",{"data-value":"m",className:"py-1.5 px-3",children:"meters"}),e("div",{"data-value":"in",className:"py-1.5 px-3",children:"inches"}),e("div",{"data-value":"ft",className:"py-1.5 px-3",children:"feet"})]})};function VertexUnitsControls({onUnitChange:a,onDecimalPlaceChange:i}){return t(n,{children:[t("div",{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Length Unit"}),e(VertexLengthUnitSelector,{onApply:a})]}),t("div",{children:[e("div",{className:"pt-2 pb-2 text-sm text-neutral-700",children:"Decimals"}),e(VertexDecimalPlaceSelector,{onApply:i})]})]})}function VertexUnitsPanelSection({onUnitChange:t,onDecimalPlaceChange:n}){return e(PanelSection,{header:e("div",{className:"flex items-center text-base",children:"Units"}),children:e(VertexUnitsControls,{onUnitChange:t,onDecimalPlaceChange:n})})}const fa=l({key:"openedPanelActivePrimaryLeft",default:void 0}),va=l({key:"openedPanelActivePrimaryRight",default:void 0});function usePanelActions(){return{openPrimary:useActionCallback((({set:e})=>(t,n)=>{e("left"===n?fa:va,t)})),closePrimary:useActionCallback((({set:e})=>t=>{e("left"===t?fa:va,void 0)}))}}function DefaultAppearancePanel(){return t("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:[e(VertexMaterialPanelSection,{}),e(VertexGhostingPanelSection,{}),e(VertexFeatureEdgesPanelSection,{}),e(VertexViewerBackgroundPanelSection,{}),e(VertexSelectionHighlightingPanelSection,{}),e(VertexCrossSectionAppearancePanelSection,{})]})}function DefaultSettingsPanel(){return e("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e(VertexUnitsPanelSection,{})})}const VertexTransformClear=({onClear:n,onClearAll:a})=>{const i=useTransformActions(),l=s(on);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"transforms",tooltip:"Clear Transforms",children:[e("div",{className:"pt-1"}),e(R,{"data-testid":"reset-selected-transforms",onClick:async()=>{await i.clearSelectedTransforms(),null==n||n()},disabled:!l,children:"Clear selected transforms"}),e(R,{"data-testid":"reset-all-transforms",onClick:async()=>{await i.clearAllTransforms(),null==a||a()},children:"Clear all transforms"})]})})},VertexTransformManipulatorToggle=({onToggleTransformsManipulator:t})=>{const n=useTransformActions(),a=s(sn),i=c(fn);return e(M,{className:"flex items-center","data-testid":"transform-widget-toggle",variant:"switch",checked:a,onValueChanged:async()=>{a?(n.disableTransformWidget(),null==t||t(!1)):(i("world"),await n.enableTransformWidget(),null==t||t(!0))}})};function VertexTransformControls({onToggleTransformsManipulator:a}){return e(n,{children:t("div",{className:"flex items-center py-3",children:[e(VertexTransformManipulatorToggle,{onToggleTransformsManipulator:a}),e("span",{className:"pl-4 text-sm text-neutral-700",children:"Enable manipulator"})]})})}function VertexTransformPanelSection({onClearTransforms:n,onClearAllTransforms:a,onToggleTransformsManipulator:i}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Manual Part Transforms",e(VertexTransformClear,{onClear:n,onClearAll:a})]}),children:e(VertexTransformControls,{onToggleTransformsManipulator:i})})}function DefaultTransformsPanel(){return e("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e(VertexTransformPanelSection,{})})}const ya="Appearance",ba="Settings",Ca="Transforms",ViewerRightPanelHeader=()=>{const t=undefined,n=getHeading(s(va));return e("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("div",{className:"items-center w-full leading-6 text-md align-center font-medium text-neutral-800",children:n})})};function getHeading(e){switch(e){case"appearance":return ya;case"settings":return ba;case"transforms":return Ca;default:return"None"}}function VertexViewerRightOpenedPanel(){const a=s(va),i=h.useMemo((()=>["appearance","settings","transforms"]),[]);return e(n,{children:null!=a&&i.includes(a)&&t(VertexResizableContent,{displayShadow:!0,heading:e(ViewerRightPanelHeader,{}),placement:"right",children:["appearance"===a&&e(DefaultAppearancePanel,{}),"transforms"===a&&e(DefaultTransformsPanel,{}),"settings"===a&&e(DefaultSettingsPanel,{})]})})}function Sidebar({children:t}){return e("div",{className:"pointer-events-auto flex flex-col items-center w-full border-neutral-300 py-2",children:t})}function SidebarIcon({name:n,iconName:a,active:i,responsive:l,disabled:o,content:s,tooltipPlacement:r,children:c,onSelect:d,onDeselect:u}){return e("div",{className:vt({"text-[var(--vertex-ui-blue-700)]":i===n&&!o,"text-neutral-700 hover:text-neutral-800":i!==n&&!o,"cursor-pointer hover:bg-neutral-200":!o,"text-neutral-400":o,"rounded-full md:p-3":l,"p-3":!l&&null==c,"px-3 py-1":null!=c}),"data-testid":`${n}-sidebar-panel`,onClick:()=>{o||(i===n?u():d())},children:t(P,{placement:null!=r?r:void 0,content:h.isValidElement(s)?void 0:s,children:[e("div",{slot:"content",children:s}),t("div",{className:"flex flex-col",children:[e(L,{name:a}),c]})]})})}function VertexViewerRightSidebar(){const n=usePanelActions(),a=s(va);return e("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:t(Sidebar,{children:[e(SidebarIcon,{name:"appearance",active:a,iconName:"adjustments",tooltipPlacement:"right",content:"Appearance",onSelect:()=>{n.openPrimary("appearance","right")},onDeselect:()=>n.closePrimary("right")}),e(SidebarIcon,{name:"transforms",active:a,iconName:"show-only-nearby",tooltipPlacement:"right",content:"Transforms",onSelect:()=>{n.openPrimary("transforms","right")},onDeselect:()=>n.closePrimary("right")}),e(SidebarIcon,{name:"settings",active:a,iconName:"gear",tooltipPlacement:"right",content:"Settings",onSelect:()=>{n.openPrimary("settings","right")},onDeselect:()=>n.closePrimary("right")})]})})}const VertexPopupButton=a=>{var{open:i,children:l}=a,o=__rest(a,["open","children"]);const s=l.find((e=>e.type===Anchor)),r=l.filter((e=>e.type!==Anchor));return null==s?e(n,{}):t(U,Object.assign({className:"flex",placement:"top",backdrop:!1,open:asBooleanAttribute(i)},o,{children:[s,e("div",{className:vt("flex mb-1.5",{hidden:!i}),"data-testid":"align-plane-popover-menu",children:r})]}))},Anchor=({tooltipContent:t,children:n})=>e("div",{slot:"anchor",children:e(P,{className:"cursor-pointer",content:t,children:n})});function VertexViewerCrossSectionAlignmentPopoverMenu(){const n=useCrossSectioningActions(),a=s(it),i=s(Xe),getBaseIcon=()=>`align-to-${null==i?void 0:i.mode}`;return useStackKeyBinding({id:"CrossSectionAlignment",keyBind:"Escape",fn:n.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]),t(VertexPopupButton,{"data-testid":"section-alignment-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(a),onDismissed:n.closeAlignmentTools,children:[e(VertexPopupButton.Anchor,{tooltipContent:"Section Alignment",children:e(O,{"data-testid":"section-alignment-icon-button",iconName:getBaseIcon(),iconColor:"secondary",onClick:a?n.closeAlignmentTools:n.openAlignmentTools,children:e(L,{"data-testid":"section-alignment-icon-chevron",name:"chevron-up",size:"sm"})})}),t(ne,{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(O,{iconColor:"secondary",onClick:()=>n.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("div",{className:"text-base ml-2",children:"Align to Global"})}),e(O,{iconColor:"secondary",onClick:()=>n.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("div",{className:"text-base ml-2",children:"Align to Surface"})})]})]})}function VertexViewerCrossSectionAxisPopoverMenu(){const n=useCrossSectioningActions(),a=s(lt),i=s(Ye),l=u(Qe),o=h.useMemo((()=>{const e=i.length>0&&"hasValue"===l.state?axis(i[0],xAxis(l.contents),yAxis(l.contents),zAxis(l.contents)):"x";return null!=e?`axis-${e}`:"axis-x"}),[l.state,l.contents,i]);return t(VertexPopupButton,{"data-testid":"align-plane-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(a),onDismissed:n.closeAxisTools,children:[e(VertexPopupButton.Anchor,{tooltipContent:"Align Plane",children:e(O,{onClick:a?n.closeAxisTools:n.openAxisTools,iconName:o,"data-testid":"align-plane-icon",iconColor:"secondary",children:e(L,{"data-testid":"align-plane-icon-chevron",name:"chevron-up",size:"sm"})})}),t(ne,{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(O,{"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:()=>n.updateAxis("x"),variant:"plain",iconColor:"secondary",iconName:"axis-x",children:e("div",{className:"text-base ml-2",children:"X-axis Plane"})}),e(O,{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:()=>n.updateAxis("y"),children:e("div",{className:"text-base ml-2",children:"Y-axis Plane"})}),e(O,{"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:()=>n.updateAxis("z"),variant:"plain",iconColor:"secondary",iconName:"axis-z",children:e("div",{className:"text-base ml-2",children:"Z-axis Plane"})})]})]})}function VertexViewerCrossSectionOffsetStepper({offset:n,onOffsetChange:a}){const i=s($n),l=s(Yn),[o,r]=h.useState(convertTo(n,i));h.useEffect((()=>{r(convertTo(n,i))}),[i,n]);const c=createDistanceFormatter(i,parseInt(l,10)),handleIncrementalUpdate=e=>{const t=convertFrom(o+e,i);a(t)},d=undefined,handleBlur=()=>{a(convertFrom(o,i))};return e(P,{content:"Plane Offset",children:e("form",{"data-testid":"cross-section-stepper-form",onSubmit:e=>{e.preventDefault(),a(convertFrom(o,i))},children:t(W,{"data-testid":"cross-section-stepper-input",className:"viewer-toolbar-input w-32 border-none ring-0 bg-white",type:"text",value:c(parseFloat(n.toFixed(3))),onInputInput:e=>{r(null!=e.detail.value?parseFloat(e.detail.value):n)},onBlur:handleBlur,children:[e("div",{"data-testid":"cross-section-stepper-decrement",className:"py-1 cursor-pointer",slot:"left",onClick:()=>handleIncrementalUpdate(-1),children:e(L,{name:"chevron-left",size:"sm"})}),e("div",{"data-testid":"cross-section-stepper-increment",className:"py-1 cursor-pointer",slot:"right",onClick:()=>handleIncrementalUpdate(1),children:e(L,{name:"chevron-right",size:"sm"})})]})})})}VertexPopupButton.Anchor=Anchor;const wa=400;function VertexViewerCrossSectionPopupMenu(){const n=useCrossSectioningActions(),a=s(at),i=u(tt),l=u(nt),o=h.useRef(),r=h.useMemo((()=>"hasValue"===i.state?i.contents:We),[i.state,i.contents]),c=h.useMemo((()=>"hasValue"===l.state?l.contents:0),[l.state,l.contents]),handleCrossSectionValueChange=e=>{clearTimeout(o.current),o.current=window.setTimeout((()=>{n.endInteraction()}),wa),n.beginInteraction(),n.updatePlanes(e)};return t(VertexPopupButton,{"data-testid":"cross-section-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(a),onDismissed:n.closeAdditionalTools,children:[e(VertexPopupButton.Anchor,{tooltipContent:"Section Tools",children:e("div",{className:"-ml-px py-1.5",children:e(L,{"data-testid":"cross-section-popover-icon",name:"chevron-up",size:"sm",onClick:a?n.closeAdditionalTools:n.openAdditionalTools})})}),t(ne,{className:"relative bottom-3 flex justify-evenly items-center p-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e(VertexViewerCrossSectionAlignmentPopoverMenu,{}),e(P,{className:"w-auto",content:"Reverse",children:e(O,{iconName:"flip","data-testid":"viewer-toolbar-flip-button",onClick:n.flipPlanes,iconColor:"secondary"})}),e(P,{className:"w-auto",content:"Align View to Plane",children:e(O,{"data-testid":"viewer-toolbar-align-view-to-plane-button",iconName:"align-view-to-plane",onClick:n.alignViewToPlane,iconColor:"secondary"})}),e(VertexToolbarDivider,{}),e(VertexViewerCrossSectionAxisPopoverMenu,{}),e("div",{className:"w-52 mx-2",children:e(VertexSlider,{value:c,defaultValue:r.default,disabled:asBooleanAttribute("hasValue"!==i.state),min:r.min,max:r.max,step:.01,onChange:handleCrossSectionValueChange})}),e("div",{className:"px-4",children:e(VertexViewerCrossSectionOffsetStepper,{offset:"hasValue"===l.state?l.contents:0,onOffsetChange:handleCrossSectionValueChange})})]})]})}const VertexViewerCrossSectionButton=()=>{const a=useCrossSectioningActions(),i=s(Ge);return t(n,{children:[e(P,{content:i?"Hide Section":"Show Section",children:e(O,{"data-testid":"viewer-toolbar-cross-section-button",iconName:"cross-section",iconColor:i?"primary":"secondary",onClick:()=>i?a.disable():a.enable()})}),e(VertexViewerCrossSectionPopupMenu,{})]})},VertexFitAllButton=()=>{const t=s(Ne);return e(P,{content:"Fit All",children:e(O,{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=s(Ne),n=s(Ie),[a,i]=r(Le),[l,o]=r(Ve);return h.useEffect((()=>{null!=t&&n&&o(t.getBaseInteractionHandler())}),[t,n,o]),e(P,{content:"Pan",children:e(O,{iconName:"pan",iconColor:"pan"===a?"primary":"secondary","data-testid":"viewer-toolbar-pan-button",onClick:async()=>{if(i("pan"),null!=l){const e=await l;null==e||e.setPrimaryInteractionType("pan")}}})})},VertexRotateButton=()=>{const t=s(Ne),n=s(Ie),[a,i]=r(Le),[l,o]=r(Ve);return h.useEffect((()=>{null!=t&&n&&o(t.getBaseInteractionHandler())}),[t,n,o]),e(P,{content:"Rotate",children:e(O,{iconName:"rotate",iconColor:"rotate"===a?"primary":"secondary","data-testid":"viewer-toolbar-rotate-button",onClick:async()=>{if(i("rotate"),null!=l){const e=await l;null==e||e.setPrimaryInteractionType("rotate")}}})})},VertexZoomButton=()=>{const t=s(Ne),n=s(Ie),[a,i]=r(Le),[l,o]=r(Ve);return h.useEffect((()=>{null!=t&&n&&o(t.getBaseInteractionHandler())}),[t,n,o]),e(P,{content:"Zoom",children:e(O,{iconName:"zoom",iconColor:"zoom"===a?"primary":"secondary","data-testid":"viewer-toolbar-zoom-button",onClick:async()=>{if(i("zoom"),null!=l){const e=await l;null==e||e.setPrimaryInteractionType("zoom")}}})})},DefaultToolbar=()=>e(ae,{placement:"bottom-center",children:t(ne,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:[e(VertexRotateButton,{}),e(VertexPanButton,{}),e(VertexZoomButton,{}),e(VertexFitAllButton,{}),e(VertexToolbarDivider,{}),e(VertexBoxSelectionButton,{}),e(VertexToolbarDivider,{}),e(VertexViewerCrossSectionButton,{}),e(VertexToolbarDivider,{}),e(VertexPointToPointMeasurementTool,{}),e(VertexPreciseMeasurementTool,{})]})}),VertexToolbar=({children:t})=>{const n=undefined;return e(ae,{placement:"bottom-center",children:null!=t&&!1!==t?e(ne,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:t}):e(DefaultToolbar,{})})};function VertexTransformWidget({transformWidgetElement:t,supportUndo:a,onPositionChange:i,onRotationChange:l}){const o=useTransformActions(),r=s(mn),c=s(sn),d=s(rn),m=s(un),p=u(dn),g=s($n),f=s(Yn),v=h.useMemo((()=>"hasValue"===p.state?p.contents:m),[p,m]),b=h.useMemo((()=>{const e=undefined;return c&&(null!=v||r)}),[c,v,r]);return e(n,{children:b&&e(ie,{id:"transform-widget","data-testid":"viewer-transform-widget",ref:t,position:d,rotation:null!=d?v:void 0,decimalPlaces:parseInt(f,10),distanceUnit:toUnitType(g),EXPERIMENTAL_undoKeybindings:null==a||a,onInteractionStarted:()=>{o.disableSelectionSync(),o.setIsInteractivelyTransforming(!0)},onInteractionEnded:()=>{o.invalidateTransforms(),o.setIsInteractivelyTransforming(!1)},onPositionChanged:async e=>{await o.setTransformWidgetPosition(e.detail),null==i||i(e.detail)},onRotationChanged:e=>{o.setTransformWidgetOrientation(e.detail),null==l||l(e.detail)}})})}const VertexViewerSceneReset=({onReset:t})=>{const n=useCrossSectioningActions(),a=useSelectionActions(),i=useTransformActions(),l=useViewerSceneActions(),o=undefined;return e(P,{content:"Reset View",children:e(O,{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:async()=>{await n.disable(),await a.resetSelectionState(),i.clearTransformWidgetPosition(),null==t||t(),await l.reset()},variant:"plain"})})};function useViewerFrameActions(){const e=useTransformActions();return{frameDrawn:useActionCallback((({set:t,snapshot:n})=>async a=>{const i=await n.getPromise(nn);t(_e,a.detail.scene),t(nn,a.detail.scene.sceneViewSummary.selectedVisibleSummary),t(tn,i);const l=undefined;await n.getPromise(sn)&&await e.syncToSelection()}))}}const VertexBoxSelectionTool=()=>{const{element:t,callback:n}=useCallbackRef(),a=useBoxSelectionActions(),i=useTransformActions(),l=s(Ot);return p.useEffect((()=>{const e=whenComponentReady(t,(()=>{var e;return[null===(e=null==t?void 0:t.model)||void 0===e?void 0:e.onDragComplete((()=>{"clearAndSelect"===l&&(i.clearTransformWidgetOrientation(),i.clearTransformWidgetPosition(),i.enableSelectionSync())}))]}));return()=>{null==e||e.then((e=>{null==e||e.forEach((e=>null==e?void 0:e.dispose()))}))}}),[t,l]),useApplyKeyBinding({keyBind:"Shift",fn:p.useCallback((()=>a.setOperationType("select")),[]),off:p.useCallback((()=>a.setOperationType("clearAndSelect")),[])}),e(le,{ref:n,"data-testid":"viewer-box-query-tool",operationType:l})};function VertexViewerCameraTypeMenu({open:n,onOpen:a,onDismiss:i,onCameraTypeChange:l}){const o=useViewerCameraActions(),r=s(ze);return t(B,{"data-testid":"camera-types-popover",className:"flex",placement:"bottom-end",open:asBooleanAttribute(n),onMenuClosed:i,children:[e("div",{slot:"anchor",children:e("div",{className:vt("flex bg-white hover:opacity-100 hover:text-neutral-700 hover:bg-neutral-200 rounded",{"opacity-70 text-neutral-900":!n,"opacity-100 text-neutral-700 bg-neutral-200":n}),children:e(P,{content:"Change View",children:e(O,{"data-testid":"set-camera-mode-option",className:"p-1 cursor-pointer",variant:"plain",onClick:a,iconName:"orthographic"===r?"cube-orthographic":"cube-perspective",children:e(L,{"data-testid":"change-camera-type-icon-button",name:"chevron-down",size:"sm"})})})})}),t("div",{className:"w-36",children:[e("div",{className:"pt-1"}),t(R,{"data-testid":"set-perspective-view",onClick:()=>{o.updateCameraType("perspective"),null==l||l("perspective")},children:[e(L,{slot:"icon","data-testid":"set-perspective-view-icon",name:"cube-perspective",size:"sm",className:vt({"text-[var(--vertex-ui-blue-700)]":"perspective"===r})}),e("div",{className:vt("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"perspective"===r}),children:"Perspective"})]}),t(R,{"data-testid":"set-orthographic-view",onClick:()=>{o.updateCameraType("orthographic"),null==l||l("orthographic")},children:[e(L,{slot:"icon","data-testid":"set-orthographic-view-icon",name:"cube-orthographic",size:"sm",className:vt({"text-[var(--vertex-ui-blue-700)]":"orthographic"===r})}),e("div",{className:vt("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"orthographic"===r}),children:"Orthographic"})]})]})]})}const VertexViewerViewCube=n=>{var{placement:a,children:i}=n,l=__rest(n,["placement","children"]);const o=Array.isArray(i)?i:[i],s=o.filter((e=>!h.isValidElement(e)||e.type!==oe)).filter((e=>null!=e&&!1!==e)),r=o.find((e=>h.isValidElement(e)&&e.type===oe)),[c,d]=h.useState(!1);return t(ae,{direction:"vertical","data-testid":"view-cube-toolbar",placement:null!=a?a:"top-right",children:[null!=r?r:e(oe,Object.assign({className:"m-7"},l)),0===s.length?t("div",{className:"flex items-center justify-center mt-3 gap-1",children:[e(VertexViewerSceneReset,{}),e(VertexViewerCameraTypeMenu,{open:c,onDismiss:()=>d(!1),onOpen:()=>d(!0)})]}):e("div",{className:"mt-3",children:s})]})},VertexViewer=a=>{var{id:i,className:l,disableSelection:o,onTap:c,onLongpress:d,onFrameDrawn:u,onSceneReady:m,viewerRefCallback:p,children:g}=a,f=__rest(a,["id","className","disableSelection","onTap","onLongpress","onFrameDrawn","onSceneReady","viewerRefCallback","children"]);const v=s(Zn),b=useRecoilRef({state:Ne}),C=useViewerCameraActions(),w=useHitActions(),S=useSelectionActions(),k=useViewerFrameActions(),[A,T]=r(Ie),E=s(ze),P=s(Xe),O=s(Pt),[N,M]=r(Me);h.useEffect((()=>{null!=i&&M(i)}),[i]);const I=s(Un),V=h.useMemo((()=>({opacity:I/100})),[I]),L=s(Ct),R=s(wt),_=h.useMemo((()=>({color:L,width:R})),[L,R]),B=s(Mn),D=s(Rn),j=s(_n),H=s(Bn),F=h.useMemo((()=>({color:D,opacity:j/100,lineWidth:H})),[D,j,H]),U=s(Lt),W=null!=g&&!1!==g;return useKeyBindings(),useDefaultKeybindings(),t(se,Object.assign({id:N,"data-testid":"vertex-viewer",ref:null!=p?p:b,className:vt("flex w-full h-full",l,{"cursor-crosshair":P.hitPending}),style:{"--viewer-background":B},config:v,cameraType:A?E:void 0,onCameraTypeChanged:e=>{A&&C.updateCameraType(e.detail)},phantom:V,featureLines:_,selectionHighlighting:F,featureMaps:U?"final":void 0,onTap:e=>{const t=[...o?[]:[S.selectCurrentHit]];w.tap(e,...t),null==c||c(e)},onLongpress:e=>{w.longPress(e),null==d||d(e)},onFrameDrawn:e=>{k.frameDrawn(e),null==u||u(e)},onSceneReady:e=>{A||T(!0),null==m||m(e)}},f,{children:[O&&e(VertexBoxSelectionTool,{}),W?g:t(n,{children:[e(VertexViewerViewCube,{}),e(VertexToolbar,{}),e(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 i=s(vn),l=s(bn);return h.useEffect((()=>{null==t||t(i)}),[i,t]),h.useEffect((()=>{null==a||a(l)}),[l,a]),e(n,{})},VertexViewerToolkitRoot=a=>{var{override:i,autoDefineCustomElements:l,children:o,config:s}=a,r=__rest(a,["override","autoDefineCustomElements","children","config"]);return h.useEffect((()=>{(null==l||l)&&(ce(),re())}),[l]),e(m,{override:i,children:t(n,{children:[e(VertexViewerToolkitEventListener,Object.assign({},r)),e(VertexViewerToolkitRootConfig,{config:s,children:o})]})})},VertexViewerToolkitRootConfig=({config:t,children:a})=>{const i=c(Zn);return h.useEffect((()=>{const e=null!=t?toSdkConfig(t):void 0;i(e)}),[t,i]),e(n,{children:a})};var Sa=Object.freeze({__proto__:null,get AssemblyFontFace(){return ga}});export{ht as CrossSection,yn as Hits,Sa as SceneTree,Cn as Selection,VertexApplicationMessages,VertexBoxSelectionButton,VertexContextMenu,VertexCrossSectionAppearanceColorPicker,VertexCrossSectionAppearanceControls,VertexCrossSectionAppearanceLineThicknessSlider,VertexCrossSectionAppearancePanelSection,VertexCrossSectionAppearanceReset,VertexDecimalPlaceSelector,VertexFeatureEdgesColorPicker,VertexFeatureEdgesControls,VertexFeatureEdgesPanelSection,VertexFeatureEdgesReset,VertexFeatureEdgesThicknessSlider,VertexFitAllButton,VertexFitSelectedMenuItem,VertexFlyToMenuItem,VertexGhostingControls,VertexGhostingPanelSection,VertexHideAllMenuItem,VertexHidePartMenuItem,VertexHideSelectedMenuItem,VertexLengthUnitSelector,VertexMaterialControls,VertexMaterialPanelSection,VertexMeasurementContextMenu,VertexMeasurementDetails,VertexPanButton,VertexPointToPointMeasurement,VertexPointToPointMeasurementTool,VertexPreciseMeasurement,VertexPreciseMeasurementTool,VertexResizableContent,VertexRotateButton,VertexSceneItemGhostingClear,VertexSceneItemGhostingOpacitySlider,VertexSceneItemGhostingToggle,VertexSceneItemMaterialClear,VertexSceneItemMaterialColorPicker,VertexSceneItemMaterialOpacitySlider,VertexSceneTree,VertexSceneTreeColumnPopover,VertexSceneTreeContextMenu,VertexSceneTreeHeader,VertexSceneTreeSearchBar,VertexSceneTreeSearchInformationForToolbar,VertexSceneTreeSearchOptionsPopover,VertexSceneTreeTableLayout,VertexSelectionHighlightingColorPicker,VertexSelectionHighlightingControls,VertexSelectionHighlightingLineThicknessSlider,VertexSelectionHighlightingOpacitySlider,VertexSelectionHighlightingPanelSection,VertexSelectionHighlightingReset,VertexShowAllMenuItem,VertexShowOnlyMenuItem,VertexShowOnlySelectedMenuItem,VertexToolbar,VertexToolbarDivider,VertexTransformClear,VertexTransformControls,VertexTransformManipulatorToggle,VertexTransformPanelSection,VertexTransformWidget,VertexUnitsControls,VertexUnitsPanelSection,VertexViewer,VertexViewerBackgroundColorPicker,VertexViewerBackgroundControls,VertexViewerBackgroundPanelSection,VertexViewerBackgroundReset,VertexViewerContextMenu,VertexViewerCrossSectionButton,VertexViewerRightOpenedPanel,VertexViewerRightSidebar,VertexViewerSceneReset,VertexViewerToolkitRoot,VertexViewerViewCube,VertexZoomButton};
18
+ */Rt=Lt,function(){var e={}.hasOwnProperty;function classNames(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=appendClass(e,parseValue(n)))}return e}function parseValue(t){if("string"==typeof t||"number"==typeof t)return t;if("object"!=typeof t)return"";if(Array.isArray(t))return classNames.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var n="";for(var a in t)e.call(t,a)&&t[a]&&(n=appendClass(n,a));return n}function appendClass(e,t){return t?e?e+" "+t:e+t:e}Rt.exports?(classNames.default=classNames,Rt.exports=classNames):window.classNames=classNames}();var jt=Lt.exports;const VertexSlider=n=>{var{value:a,defaultValue:i,leftLabel:l,rightLabel:o,onChange:r,onValueChange:s,onValueInput:c}=n,d=__rest(n,["value","defaultValue","leftLabel","rightLabel","onChange","onValueChange","onValueInput"]);const[u,m]=A.useState(i);return t("div",{className:"flex w-full items-center gap-2",children:[l&&e("div",{className:"pl-0.5 text-xs text-center",children:l}),e(M,Object.assign({className:jt("w-full",{"mt-0.5":null!=l||null!=o}),value:null!=a?a:u,onValueChange:e=>{m(e.detail.value),null==r||r(e.detail.value),null==s||s(e)},onValueInput:e=>{m(e.detail.value),null==r||r(e.detail.value),null==c||c(e)}},d)),o&&e("div",{className:"text-xs pr-2 flex-shrink-0 text-right",children:o})]})},VertexCrossSectionAppearanceLineThicknessSlider=({onUpdate:t})=>{const n=useCrossSectioningActions(),[a,i]=s(pt);return e(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=>{i(e.detail.value),await n.reapply()},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexCrossSectionAppearanceControls({onUpdateCrossSectionColor:a,onUpdateCrossSectionLineThickness:i}){return t(n,{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e(VertexCrossSectionAppearanceColorPicker,{onUpdate:a}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e(VertexCrossSectionAppearanceLineThicknessSlider,{onUpdate:i})]})}function PanelSection({header:n,children:a}){return t("div",{className:"py-3 px-4 border-neutral-300 border-b",children:[e("div",{className:"my-2 text-base text-neutral-700",children:n}),a]})}const VertexCrossSectionAppearanceReset=({onReset:t})=>{const n=useCrossSectioningActions(),[a,i]=s(mt),[l,o]=s(pt),r=undefined;return e("div",{className:"ml-auto",children:e(_,{content:"Reset Cross Sectioning Appearance",children:e(V,{"data-testid":"cross-section-appearance-reset",iconName:"reset",iconSize:"sm",onClick:async()=>{i(st),o(1),null==t||t(),await n.reapply()},disabled:!(a!==st||1!==l)})})})};function VertexCrossSectionAppearancePanelSection({onResetCrossSectionAppearance:n,onUpdateCrossSectionColor:a,onUpdateCrossSectionLineThickness:i}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Cross Sectioning",e(VertexCrossSectionAppearanceReset,{onReset:n})]}),children:e(VertexCrossSectionAppearanceControls,{onUpdateCrossSectionColor:a,onUpdateCrossSectionLineThickness:i})})}const Dt=.5,zt="#444444",Bt=l({key:"featureEdgesSelectedColor",default:zt}),Ht=l({key:"featureEdgesLineThickness",default:Dt}),VertexFeatureEdgesColorPicker=({onUpdate:t})=>{const[n,a]=s(Bt);return e(VertexColorPicker,{"data-testid":"feature-edges-color-picker",value:n,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})},VertexFeatureEdgesThicknessSlider=({onUpdate:t})=>{const[n,a]=s(Ht);return e(VertexSlider,{id:"feature-edges-thickness","data-testid":"feature-edges-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:n,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexFeatureEdgesControls({onUpdateFeatureEdgesColor:a,onUpdateFeatureEdgesThickness:i}){return t(n,{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e(VertexFeatureEdgesColorPicker,{onUpdate:a}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e(VertexFeatureEdgesThicknessSlider,{onUpdate:i})]})}const VertexFeatureEdgesReset=({onReset:t})=>{const[n,a]=s(Bt),[i,l]=s(Ht),o=undefined;return e("div",{className:"ml-auto",children:e(_,{content:"Reset Feature Edges",children:e(V,{"data-testid":"feature-edges-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(zt),l(Dt),null==t||t()},disabled:!(i!==Dt||n!==zt)})})})};function VertexFeatureEdgesPanelSection({onResetFeatureEdges:n,onUpdateFeatureEdgesColor:a,onUpdateFeatureEdgesThickness:i}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Feature Edges",e(VertexFeatureEdgesReset,{onReset:n})]}),children:e(VertexFeatureEdgesControls,{onUpdateFeatureEdgesColor:a,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)}function contextMenuItemIsElement(e){return null!=e&&e instanceof HTMLElement}const Ft=l({key:"contextMenuActive",default:void 0}),Wt=l({key:"contextMenuPosition",default:void 0}),Ut=l({key:"contextMenuTarget",default:void 0}),Gt=l({key:"contextMenuItem",default:void 0}),Kt=l({key:"contextMenuActions",default:[]}),$t=o({key:"contextMenuActivePosition",get:({get:e})=>null!=e(Ft)?e(Wt):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(Wt,C.create(n,a)),e(Ut,t.target)}})),pointerUp:useActionCallback((({snapshot:e,set:t})=>async(n,a,i,l)=>{const o=await e.getPromise(Wt),r=await e.getPromise(Ft);if(null!=o&&null==r){const e=n.clientX,r=null==n?void 0:n.clientY,s=C.create(e,r),c=null!=o?C.distance(o,s):0,d=null==i||i(n);c<2&&d&&(null==l||l(n,null!=o?o:s),t(Ft,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=C.create(t.touches[0].clientX,t.touches[0].clientY);e(Wt,a),e(Ut,t.target),e(Ft,n),null==i||i(t,a)}})),setContextMenuItem:useActionCallback((({snapshot:e,set:t,reset:n})=>async a=>{const i=await e.getPromise(Kt);t(Gt,a),i.forEach((e=>e(a))),n(Kt)})),clearActiveContextMenu:useActionCallback((({reset:e,set:t})=>n=>{t(Mt,!!n),e(Ft),e(Kt),e(Wt)})),clearDismissedState:useActionCallback((({reset:e})=>()=>e(Mt)))}}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)}var qt=Object.freeze({__proto__:null,contextMenuActions:Kt,contextMenuActive:Ft,contextMenuActivePosition:$t,contextMenuItem:Gt,contextMenuItemIsElement:contextMenuItemIsElement,contextMenuItemIsRow:contextMenuItemIsRow,contextMenuPosition:Wt,contextMenuTarget:Ut,targetShouldSkipNextHit:targetShouldSkipNextHit,targetWithinMenu:targetWithinMenu,useContextMenuActions:useContextMenuActions});const Yt=l({key:"boxSelectionEnabled",default:!1}),Xt=l({key:"boxSelectionOperationType",default:"clearAndSelect"}),useBoxSelectionActions=()=>({enable:useActionCallback((({set:e})=>()=>{e(Yt,!0)})),disable:useActionCallback((({reset:e})=>async()=>{e(Yt),e(Xt)})),setOperationType:useActionCallback((({set:e})=>t=>{e(Xt,t)}))});var Zt=Object.freeze({__proto__:null,boxSelectionEnabled:Yt,boxSelectionOperationType:Xt,useBoxSelectionActions:useBoxSelectionActions});async function whenComponentReady(e,t,n=customElements,a=requestAnimationFrame,i=setTimeout){return null!=e&&null!=e.nodeName&&await n.whenDefined(e.nodeName.toLowerCase()),"function"==typeof(null==e?void 0:e.componentOnReady)?(await(null==e?void 0:e.componentOnReady()),t()):(await new Promise((e=>"function"==typeof a?a(e):i(e))),t())}const Jt=l({key:"isEditingPointToPointMeasurement",default:!1}),Qt=l({key:"pointToPointMeasurementOutcome",default:void 0}),en=l({key:"editedPointToPointMeasurement",default:void 0});function usePointToPointMeasurement(e){const t=c(Qt);k((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onOutcomeChanged(t)})),()=>null==n?void 0:n.dispose()}),[e,t])}const tn=2,nn=l({key:"isEditingPreciseMeasurement",default:!1}),an=l({key:"preciseMeasurementOutcome",default:void 0}),ln=l({key:"preciseMeasurementController",dangerouslyAllowMutability:!0,default:void 0}),on=l({key:"preciseMeasurementOverlays",dangerouslyAllowMutability:!0,default:void 0}),rn=l({key:"preciseMeasurementEntities",dangerouslyAllowMutability:!0,default:[]}),sn=o({key:"preciseMeasurementMessage",get:({get:e})=>{const t=undefined;return 0===e(rn).length?"Select a surface":void 0}});function usePreciseMeasurementModel(e,t,n){const a=c(rn),i=c(an),l=c(ln),o=c(on),s=r(ln);k((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{a(e),null==t||t(e)}))})),()=>null==n?void 0:n.dispose()}),[e,a]),k((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onOutcomeChanged((e=>{i(e),null==n||n(e)}))})),()=>null==t?void 0:t.dispose()}),[e,i]),k((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{if(e.length>2){const t=e[2];null==s||s.setEntities(new Set([t]))}}))})),()=>null==t?void 0:t.dispose()}),[e,s]),k((()=>{whenComponentReady(e,(()=>{l(null==e?void 0:e.measurementController)}))}),[e,l]),k((()=>{whenComponentReady(e,(()=>{o(null==e?void 0:e.measurementOverlays)}))}),[e,o])}function useMeasurementActions(){const e=useBoxSelectionActions(),t=useEnablePointToPointMeasurement(),n=useDisablePointToPointMeasurement(),a=useDisablePreciseMeasurement(),i=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(ln);null==t||t.clearEntities()})),l=useActionCallback((()=>async(e={})=>{await i(),n(e),a()})),o=useActionCallback((({set:e,reset:n})=>async a=>{await l(),"point-to-point"===a?t():(n(an),n(rn),e(nn,!0))}));return{disableEditMeasurement:useActionCallback((()=>async e=>{await l(e)})),enableEditMeasurement:useActionCallback((()=>async e=>{await o(e)})),resetMeasurement:useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(nn),a=await e.getPromise(Jt);n?await i():a&&(t(Qt),t(en))})),clearEditedPointToPointMeasurement:useActionCallback((({reset:e})=>()=>{e(en)})),setEditedPointToPointMeasurement:useActionCallback((({set:e})=>t=>{e(en,t)})),toggleEditPointToPointMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(Jt)?await l():await o("point-to-point"),e.disable()})),toggleEditPreciseMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(nn)?await l():await o("precise"),e.disable()}))}}function useEnablePointToPointMeasurement(){return useActionCallback((({reset:e,set:t})=>(n={})=>{t(Jt,!0),n.keepExistingMeasurement||e(Qt)}))}function useDisablePointToPointMeasurement(){return useActionCallback((({reset:e})=>(t={})=>{e(Jt),t.keepExistingMeasurement||(e(en),e(Qt))}))}function useDisablePreciseMeasurement(){return useActionCallback((({reset:e})=>async()=>{e(nn),e(an),e(rn)}))}const cn=o({key:"isEditingMeasurement",get:({get:e})=>e(Jt)||e(nn)}),dn=o({key:"measurementPanelModel",get:({get:e})=>e(Qt)||e(an)}),un=o({key:"measurementPanelOverlays",dangerouslyAllowMutability:!0,get:({get:e})=>e(on)}),mn=o({key:"measurementPanelMessage",get:({get:e})=>{const t=undefined;return e(nn)?e(sn):void 0}}),pn=o({key:"measurementPanelIsResettable",get:({get:e})=>e(cn)&&null!=e(dn)});var hn=Object.freeze({__proto__:null,editedPointToPointMeasurement:en,isEditingMeasurement:cn,isEditingPointToPointMeasurement:Jt,isEditingPreciseMeasurement:nn,measurementPanelIsResettable:pn,measurementPanelMessage:mn,measurementPanelOutcome:dn,measurementPanelOverlays:un,pointToPointMeasurementOutcome:Qt,preciseMeasurementController:ln,preciseMeasurementEntities:rn,preciseMeasurementMessage:sn,preciseMeasurementOutcome:an,preciseMeasurementOverlays:on,useDisablePointToPointMeasurement:useDisablePointToPointMeasurement,useDisablePreciseMeasurement:useDisablePreciseMeasurement,useEnablePointToPointMeasurement:useEnablePointToPointMeasurement,useMeasurementActions:useMeasurementActions,usePointToPointMeasurement:usePointToPointMeasurement,usePreciseMeasurementModel:usePreciseMeasurementModel});const fn="Scene Alteration Performance";var gn;!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"}(gn||(gn={}));var vn=Object.freeze({__proto__:null,SCENE_ALTERATION_PERFORMANCE:fn,get SceneAlterationPerformanceType(){return gn}});const yn=l({key:"fetchedItemInvalidator",default:0}),bn=d({key:"fetchedItems",get:e=>async({get:t})=>{var n;const a=t(Ze),i=t(nt);if(t(yn),t(ea),null!=i)try{return await(null===(n=null==a?void 0:a.sceneItems)||void 0===n?void 0:n.getSceneViewItem(e,i,{includeOverride:!0,includeWorldTransform:!0}))}catch(t){return void logger_debug(`Error encountered get scene view item. [itemId={${e}}]`,t)}}}),Cn=u({key:"selectionSelectedItems",default:void 0}),wn=l({key:"selectionSelectedItemIds",default:[]}),Sn=l({key:"selectionLastSelected",default:void 0}),xn=l({key:"selectionLastSelectionFromViewer",default:!1}),Tn=l({key:"selectionLastSelectWasMultiSelect",default:!1}),An=o({key:"selectionHasMultipleSelected",get:({get:e})=>{const t=e(Sn),n=undefined;return e(wn).filter((e=>{var n;return e!==(null==t?void 0:t.id)&&!(null===(n=null==t?void 0:t.ancestors)||void 0===n?void 0:n.includes(e))})).length>0}}),kn=l({key:"selectionFirstSelectedItemInTreeId",default:void 0}),Pn=o({key:"selectionHighestSelectedAncestor",get:({get:e})=>{var t,n;const a=e(Sn),i=e(wn);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}}),En=l({key:"selectionPreviousVisibleSummary",default:void 0}),In=l({key:"selectionVisibleSummary",default:void 0}),On=o({key:"selectionVisibleCount",get:({get:e})=>{var t,n;return null!==(n=null===(t=e(In))||void 0===t?void 0:t.count)&&void 0!==n?n:0}}),Nn=o({key:"selectionBoundingBoxCenter",get:({get:e})=>{const t=e(In);return null!=(null==t?void 0:t.boundingBox)?g.center(t.boundingBox):v.origin()}}),Mn=o({key:"selectionIsActive",get:({get:e})=>{const t=e(wn),n=undefined;return e(On)>0||t.length>0}}),_n=o({key:"fetchedAndSelectedItems",get:async({get:e})=>{const t=e(wn),n=undefined;return null!=e(nt)?t.map((t=>e(bn(t)))):[]}});function useSceneViewItemActions(){return{invalidateCachedItems:useActionCallback((({set:e})=>()=>{e(yn,(e=>e+1))}))}}var Vn=Object.freeze({__proto__:null,fetchedItem:bn,fetchedItemInvalidator:yn,useSceneViewItemActions:useSceneViewItemActions});const Ln=l({key:"lengthUnit",default:"cm"}),Rn=l({key:"decimalPlace",default:"2"});var jn=Object.freeze({__proto__:null,decimalPlace:Rn,lengthUnit:Ln}),Dn,zn;!function(e){e.mm="millimeters",e.cm="centimeters",e.m="meters",e.in="inches",e.ft="feet"}(Dn||(Dn={})),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"}(zn||(zn={}));const convertFrom=(e,t)=>{const n=undefined;return e/zn[t]},convertTo=(e,t)=>{const n=undefined;return e*zn[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 pickLocalOrWorldTransform(e,t){return"local"===t?e.local:e.world}function mapItemTransforms(e,t){return{local:t(e.local),world:t(e.world)}}function makeItemTransforms(e,t,n){return"local"===n?{local:e,world:J(e,t)}:{world:e,local:Q(e,t)}}function convertTransformToUnits(e,t){const{position:n,rotation:a,scale:i}=e;return{position:v.create(convertTo(n.x,t),convertTo(n.y,t),convertTo(n.z,t)),rotation:a,scale:i}}function convertTransformFromUnits(e,t){const{position:n,rotation:a,scale:i}=e;return{position:v.create(convertFrom(n.x,t),convertFrom(n.y,t),convertFrom(n.z,t)),rotation:a,scale:i}}function toValidTransform(e){const{position:t,rotation:n,scale:a}=e;return{position:{x:t.x||0,y:t.y||0,z:t.z||0},rotation:{x:n.x||0,y:n.y||0,z:n.z||0},scale:a||1}}function scale(e){const t=parseFloat(Math.sqrt(e[0]**2+e[4]**2+e[8]**2).toFixed(2)),n=parseFloat(Math.sqrt(e[1]**2+e[5]**2+e[9]**2).toFixed(2)),a=parseFloat(Math.sqrt(e[2]**2+e[6]**2+e[10]**2).toFixed(2));return t===n&&n===a?t:NaN}function translation(e){return{x:e[12],y:e[13],z:e[14]}}function rotation(e){const t=e.map((t=>t*(1/scale(e))));return t[8]<1?t[8]>-1?{x:Math.atan2(-t[9],t[10])*(180/Math.PI),y:Math.asin(t[8])*(180/Math.PI),z:Math.atan2(-t[4],t[0])*(180/Math.PI)}:{x:-Math.atan2(-t[1],t[5])*(180/Math.PI),y:-90,z:0}:{x:Math.atan2(t[1],t[5])*(180/Math.PI),y:90,z:0}}function toTransformFromApiMatrix(e){return null!=e?{position:translation(e),rotation:rotation(e),scale:scale(e)}:void 0}const Bn={position:v.create(0,0,0),rotation:v.create(0,0,0),scale:1},Hn=l({key:"transformWidgetEnabled",default:!1}),Fn=l({key:"transformWidgetPosition",default:void 0}),Wn=l({key:"transformWidgetOrientationOverride",default:void 0}),Un=o({key:"transformWidgetOrientation",get:({get:e})=>{const t=e(Wn),n=e(Sn);if(null!=t)return t;if(null!=n){const t=e(Qn(n.id));return w.fromDegrees({x:null==t?void 0:t.world.rotation.x,y:null==t?void 0:t.world.rotation.y,z:null==t?void 0:t.world.rotation.z})}}}),Gn=l({key:"transformWidgetCachedOrientation",default:void 0}),Kn=l({key:"transformWidgetSyncToSelection",default:!1}),$n=l({key:"transformWidgetIsInteracting",default:!1}),qn=u({key:"appliedItemTransform",default:void 0}),Yn=l({key:"appliedItemTransformIds",default:[]}),Xn=l({key:"selectedCoordinateSpace",default:"world"}),Zn=u({key:"editedItemTransform",default:void 0}),Jn=d({key:"displayedItemTransform",get:e=>({get:t})=>{if(null!=e){const n=t(Xn),a=t(Ln),i=t(Qn(e)),l=t(Zn(e));if(null!=l)return l.transform;if(null!=i)return pickLocalOrWorldTransform(mapItemTransforms(i,(e=>convertTransformToUnits(e,a))),n)}},set:e=>({get:t,set:n},a)=>{if(null!=e){const i=t(Xn),l=t(ta(e)),o=t(Qn(e)),r=t(Ln);if(null!=o&&!(a instanceof m)&&null!=a&&null!=l){n(Zn(e),{coordinateSpace:i,units:r,transform:a});const o=makeItemTransforms(convertTransformFromUnits(toValidTransform(a),r),l,i),s=t(Yn);n(qn(e),o),n(Yn,[...s,e])}}}}),Qn=d({key:"fetchedItemTransforms",get:e=>({get:t})=>{var n,a;const i=t(bn(e));if(null!=i){const e=(null===(n=i.override)||void 0===n?void 0:n.transform)?toTransformFromApiMatrix(null===(a=i.override)||void 0===a?void 0:a.transform):void 0,t=i.worldTransform?toTransformFromApiMatrix(i.worldTransform):void 0;return{local:null!=e?e:Bn,world:null!=t?t:Bn}}}}),ea=l({key:"transformInvalidator",default:0}),ta=d({key:"parentItemWorldMatrix",get:e=>({get:t})=>{const n=t(nt);if(null!=e&&null!=n){const n=t(bn(e));if(null!=(null==n?void 0:n.parentId)){const e=t(Qn(n.parentId)),a=t(qn(n.parentId));if(null==e)throw new Error("Invalid state. Parent item state should be populated, but is undefined.");return ee(te(null!=a?a.world:e.world))}}return logger_debug(`Unable to find the world matrix for the parent of ${e}. Returning the identity matrix.`),S.makeIdentity()}});function useUpdateEditedTransformWhenSettingsChange(e){const t=r(Ln),n=r(Xn),a=r(qn(null!=e?e:"")),[i,l]=s(Zn(null!=e?e:""));k((()=>{if(null!=a&&((null==i?void 0:i.coordinateSpace)!==n||(null==i?void 0:i.units)!==t)){const e=undefined,i=convertTransformToUnits(pickLocalOrWorldTransform(a,n),t);l({units:t,coordinateSpace:n,transform:i})}}),[t,n])}function useEditItemTransform(e){const t=useTransformActions();useUpdateEditedTransformWhenSettingsChange(e);const n=p(ta(e)),[a,i]=h(Jn(e));return{transform:"hasValue"===a.state?a.contents:void 0,loading:"loading"===a.state||"loading"===n.state,error:"hasError"===a.state?a.contents:void 0,async update(n){t.enableSelectionSync(),i(n),null!=e&&await t.applyTransformToItem(e)}}}const useTransformActions=()=>{const e=useApplicationMessageActions(),t=useViewerSceneActions(),n=useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(Nn);e(Fn,n)})),a=useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(Fn),i=await t.getPromise(Tn),l=await t.getPromise(wn),o=await t.getPromise(On);null==a&&(l.length>0||i||o>0)&&await n(),e(Kn,!0)})),i=useActionCallback((({set:e})=>async t=>{e(Fn,null!=t?t:void 0)})),l=useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async()=>{const a=await e.getPromise(Un),i=undefined;(await e.getPromise(Yn)).forEach((e=>{n(qn(e)),n(Zn(e))})),n(Yn),null!=a&&t(Gn,a),t(ea,(e=>e+1))}))),o=useActionCallback((({set:e,reset:t})=>n=>{t(Gn),e(Wn,n)})),r=useActionCallback((({set:e})=>()=>{e(Fn,void 0),e(Hn,!1)}));return{enableTransformWidget:useActionCallback((({set:t})=>async(l,o)=>{e.setToastMessage({message:"Transform manipulator enabled! Select parts to interact.",duration:We}),t(Hn,!0),o?await n():null==l?await a():await i(l)})),disableTransformWidget:useActionCallback((({reset:e})=>()=>{e(Hn),e(Wn)})),setTransformWidgetOrientation:o,clearTransformWidgetOrientation:useActionCallback((({reset:e})=>()=>{e(Gn),e(Wn)})),setTransformWidgetPosition:i,clearTransformWidgetPosition:useActionCallback((({reset:e})=>()=>e(Fn))),invalidateTransforms:l,setIsInteractivelyTransforming:useActionCallback((({set:e})=>t=>{e($n,t)})),setDefaultWidgetPosition:a,setDefaultWidgetPositionToSelection:n,enableSelectionSync:useActionCallback((({set:e})=>()=>e(Kn,!0))),disableSelectionSync:useActionCallback((({reset:e})=>()=>e(Kn))),syncToSelection:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(En),n=await e.getPromise(In),a=undefined;if(await e.getPromise(Kn)){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(g.center(e))}})),orientToHitResult:useActionCallback((({reset:e})=>async t=>{e(Kn),null!=t?await i(null==t?void 0:t.position):(e(Fn),o(void 0))})),clearSelectedTransforms:useActionCallback((()=>async()=>{await t.execute(gn.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.withSelected())).clearTransforms())),await l(),r()})),clearAllTransforms:useActionCallback((()=>async()=>{await t.execute(gn.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.all())).clearTransforms())),await l(),r()})),applyTransformToItem:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(Ze),a=await(null==n?void 0:n.scene()),i=await e.getPromise(qn(t));if(null==i)return void logger_warn(`There is no transform to apply to item ${t}.`);const l=S.transpose(ee(te(null==i?void 0:i.local)));return null==a?void 0:a.items((e=>e.where((e=>e.withItemId(t))).transform(l))).execute()}))}};var na=Object.freeze({__proto__:null,appliedItemTransformIds:Yn,appliedItemTransforms:qn,convertTransformFromUnits:convertTransformFromUnits,convertTransformToUnits:convertTransformToUnits,displayedItemTransform:Jn,editedItemTransform:Zn,fetchedItemTransforms:Qn,identityTransform:Bn,makeItemTransforms:makeItemTransforms,mapItemTransforms:mapItemTransforms,parentItemWorldMatrix:ta,pickLocalOrWorldTransform:pickLocalOrWorldTransform,selectedCoordinateSpace:Xn,toValidTransform:toValidTransform,transformInvalidator:ea,transformWidgetCachedOrientation:Gn,transformWidgetEnabled:Hn,transformWidgetIsInteracting:$n,transformWidgetOrientation:Un,transformWidgetOrientationOverride:Wn,transformWidgetPosition:Fn,transformWidgetSyncToSelection:Kn,useEditItemTransform:useEditItemTransform,useTransformActions:useTransformActions});const useHitActions=()=>{const e=useCrossSectioningActions(),t=useMeasurementActions(),n=useTransformActions(),a=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const n=await e.tryGetPromise(Nt).then((e=>e.value)),a=await e.getPromise(en);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(Nt).then((e=>e.value));await n.orientToHitResult(t)}))),l=useActionCallback(retainSnapshot((({set:e,snapshot:t})=>async()=>{const n=await t.tryGetPromise(Nt).then((e=>e.value));e(Gt,n)}))),o=useActionCallback(retainSnapshot((({snapshot:e,set:t})=>async()=>{t(Ot,await e.tryGetPromise(Nt).then((e=>e.value)))})));return{tap:useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async({detail:r},...s)=>{const c=await t.getPromise(cn),d=await t.getPromise(ft),u=2!==(null==r?void 0:r.buttons)&&!(null==r?void 0:r.altKey);r.altKey||r.ctrlKey||r.metaKey||r.shiftKey;const m=u&&!d.hitPending&&!c,p=await t.tryGetPromise(Nt).then((e=>e.value));n(It,p),n(Pt,r),await a(),m&&(s.forEach((e=>e())),await i()),await l(),await e.sectionCurrentHit(),await o()}))),longPress:useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async a=>{n(Pt),t(Et,a.detail),await e.tryGetPromise(Nt),await l(),await o()})))}},aa=o({key:"viewerToolkitHitState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,i=undefined,l=undefined;return{tapDetails:e(Pt),longPressDetails:e(Et),previousHitResult:e(It),currentHitResult:e(Ot)}}});var ia=Object.freeze({__proto__:null,currentHitResult:Ot,hitResult:Nt,hitResultsLongPressDetails:Et,hitResultsSkipNextTap:Mt,hitResultsTapDetails:Pt,hitState:aa,previousHitResult:It,useHitActions:useHitActions});function useSelectionActions(){const e=useSceneViewItemActions(),t=useTransformActions(),n=useViewerSceneActions(),a=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(wn)).forEach((e=>t(Cn(e))))})),i=useActionCallback((({snapshot:e,reset:t,set:a})=>async(i,l)=>{var o,r;const s=await e.getPromise(Cn(i.id)),c=await e.getPromise(wn),d=null===(r=[...null!==(o=i.ancestors)&&void 0!==o?o:[]])||void 0===r?void 0:r.reverse().find((e=>!c.includes(e)));null!=s&&null!=d?(a(Cn(d),{id:d}),a(wn,(e=>[...e,d])),await n.execute(gn.SELECTING_ANCESTOR,n.selectItemsTransform(d))):(null==l?void 0:l.clear)?(a(Cn(i.id),i),a(wn,[i.id]),await n.execute(gn.SELECTING_ONLY_ITEM,n.clearSelectionTransform,n.selectItemsTransform(i.id))):(a(Cn(i.id),i),a(wn,(e=>[...e,i.id])),await n.execute(gn.SELECTING_ITEMS,n.selectItemsTransform(i.id))),u(i),a(Sn,i),a(xn,!0),t(Tn)})),l=useActionCallback((({reset:e,set:t})=>async a=>{e(Cn(a)),e(Tn),t(wn,(e=>e.filter((e=>e!==a)))),await n.execute(gn.DESELECTING_ITEMS,n.deselectItemsTransform(a))})),o=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(Cn(t.id));null!=n?await l(n.id):await i(t)})),r=useActionCallback((({snapshot:n,reset:a,set:l})=>async(o,r={})=>{const s=await n.getPromise(Cn(o.id)),c=await n.getPromise(wn);if(c.filter((e=>{var t;return e!==o.id&&!(null===(t=o.ancestors)||void 0===t?void 0:t.includes(e))})).forEach((e=>a(Cn(e)))),a(Tn),s)if(r.ignoreAncestorSelection)a(wn),a(Cn(s.id));else{const e=c.filter((e=>{var t;return e===o.id||(null===(t=o.ancestors)||void 0===t?void 0:t.includes(e))}));l(wn,e)}else a(wn);e.invalidateCachedItems(),t.clearTransformWidgetOrientation(),await i(o,{clear:!0})})),s=useActionCallback((({reset:e})=>async()=>{await a(),e(wn),e(Sn),e(xn),e(Tn),t.clearTransformWidgetPosition(),t.clearTransformWidgetOrientation()})),c=useActionCallback((()=>async()=>{await s(),await n.execute(gn.CLEAR_SELECTION,n.clearSelectionTransform)})),d=useActionCallback((({set:e})=>async t=>{e(Tn,t)})),u=useActionCallback((({reset:e,set:t})=>e=>{}));return{select:i,toggleSelection:o,clearAndSelect:r,selectCurrentHit:useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(Nt).then((e=>e.value)),n=await e.getPromise(Pt),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 o(t):await c():await r(t)}))),syncSelection:useActionCallback((({set:e,reset:t})=>async(n,i)=>{i.selected?(await a(),e(Cn(n.id),n),i.multiSelect?e(wn,(e=>[...e.filter((e=>e!==n.id)),n.id])):e(wn,[n.id]),u(n),e(Sn,n),e(xn,!1),e(Tn,!!i.multiSelect)):(t(Cn(n.id)),t(Tn),e(wn,(e=>e.filter((e=>e!==n.id)))))})),deselect:l,clearSelection:c,resetSelectionState:s,toggleLastSelectWasMultiSelect:d,selectForModelViewsPanel:u}}const la=o({key:"viewerToolkitSelectionState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,i=undefined;return{selectedItemIds:e(wn),lastSelected:e(Sn),highestSelectedAncestorId:e(Pn)}}});var oa=Object.freeze({__proto__:null,fetchedAndSelectedItems:_n,selectionBoundingBoxCenter:Nn,selectionFirstSelectedItemInTreeId:kn,selectionHasMultipleSelected:An,selectionHighestSelectedAncestor:Pn,selectionIsActive:Mn,selectionLastSelectWasMultiSelect:Tn,selectionLastSelected:Sn,selectionLastSelectionFromViewer:xn,selectionPreviousVisibleSummary:En,selectionSelectedItemIds:wn,selectionSelectedItems:Cn,selectionState:la,selectionVisibleCount:On,selectionVisibleSummary:In,useSelectionActions:useSelectionActions});function createColorMaterialWithId(e,t=Me.create()){return Object.assign({id:t},ne.fromHex(e))}const ra=255,sa=18,ca=l({key:"sceneItemAdjustmentsSelectedColor",default:void 0}),da=l({key:"sceneItemAdjustmentsRecentColors",default:[]}),ua=l({key:"sceneItemAdjustmentsCustomColors",default:[createColorMaterialWithId("#ffffff"),createColorMaterialWithId("#616161")]}),ma=l({key:"sceneItemAdjustmentsSelectedOpacity",default:void 0}),pa=u({key:"appliedItemMaterialOverride",default:void 0}),ha=l({key:"appliedItemMaterialOverrideIds",default:[]}),fa=o({key:"sceneItemAdjustmentsLastSelectedOverride",get:({get:e})=>{const t=e(Sn);if(null!=t)return e(pa(t.id))}}),ga=l({key:"applyMaterialToAllUserAction",default:void 0}),va=l({key:"showConfirmDialogWhenApplyingMaterialToAll",default:!0}),ya=l({key:"confirmApplyMaterialToAllDialogOpen",default:!1}),useSceneItemMaterialActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(ha);t(ca),n.forEach((e=>t(pa(e)))),t(ha)}));return{updateColor:useActionCallback((({set:e})=>t=>{e(ca,t)})),saveRecentColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(da),i=[n,...a.filter((e=>e!==n))],l=i.length>sa?i.slice(0,-(i.length-sa)):i;e(ca,n),e(da,l)})),removeRecentColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=undefined,i=(await t.getPromise(da)).filter((e=>e.id!==n));e(da,i)})),setCustomColors:useActionCallback((({set:e})=>async t=>{e(ua,t)})),saveCustomColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=undefined,i=[...await t.getPromise(ua),n],l=i.length>sa?i.slice(i.length-sa):i;e(ca,n),e(ua,l)})),removeCustomColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=undefined,i=(await t.getPromise(ua)).filter((e=>e.id!==n));e(ua,i)})),clearCurrentColor:useActionCallback((({reset:e})=>()=>{e(ca)})),clearCurrentOpacity:useActionCallback((({reset:e})=>()=>{e(ma)})),clear:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const i=await t.getPromise(wn);a(ca),i.forEach((e=>a(pa(e)))),n(ha,(e=>e.filter((e=>!i.includes(e))))),await e.execute(gn.CLEAR_SELECTED_MATERIAL_OVERRIDES,(e=>e.where((e=>e.withSelected())).clearMaterialOverrides().select()))})),clearAll:useActionCallback((()=>async()=>{await t(),await e.execute(gn.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(ma,t)})),apply:useActionCallback((({snapshot:t,set:n})=>async()=>{const a=await t.getPromise(ca),i=await t.getPromise(ma),l=await t.getPromise(wn),o=await t.getPromise(fa),r=null!=a?a:o,s=null!=i?i:null==o?void 0:o.opacity;if(null!=r){const t=Object.assign(Object.assign({},r),{opacity:null!=s?s:r.opacity});await e.execute(gn.APPLY_MATERIAL_OVERRIDE_TO_SELECTION,(e=>e.where((e=>e.withSelected())).materialOverride(t))),l.forEach((e=>n(pa(e),t))),n(ha,(e=>[...e,...l]))}})),confirmApplyAll:useActionCallback((({set:e})=>t=>{e(ya,!0),e(ga,(()=>t))})),cancelApplyAll:useActionCallback((({reset:e})=>()=>{e(ya),e(ga)})),applyAll:useActionCallback((({snapshot:t,reset:n})=>async()=>{const a=await t.getPromise(ca),i=await t.getPromise(ma);if(null!=a){const l=await t.getPromise(ha),o=Object.assign(Object.assign({},a),{opacity:null!=i?i:a.opacity});await e.execute(gn.APPLY_MATERIAL_OVERRIDE_TO_ALL,(e=>e.where((e=>e.all())).materialOverride(o))),l.forEach((e=>n(pa(e))));const r=await t.getPromise(ga);null==r||r(o),n(ya),n(ga)}})),hideConfirmApplyAllDialog:useActionCallback((({set:e})=>()=>{e(va,!1)}))}},ba="#ffff00",Ca=35,wa=1,Sa=l({key:"selectionHighlightingSelectedColor",default:ba}),xa=l({key:"selectionHighlightingSelectedOpacity",default:Ca}),Ta=l({key:"selectionHighlightingSelectedLineThickness",default:1});function elementIsColorSwatch(e){return e instanceof Element&&"VERTEX-COLOR-SWATCH"===e.nodeName}function elementHasColorAttribute(e){return"true"===e.getAttribute("data-custom-color")||"true"===e.getAttribute("data-recent-color")}const Aa="#FFFFFF",ka=l({key:"viewerBackgroundSelectedColor",default:Aa});var Pa=Object.freeze({__proto__:null,DEFAULT_FEATURE_EDGE_COLOR:zt,DEFAULT_FEATURE_EDGE_THICKNESS_VALUE:Dt,DEFAULT_SELECTION_HIGHLIGHTING_COLOR:ba,DEFAULT_SELECTION_HIGHLIGHTING_LINE_THICKNESS:1,DEFAULT_SELECTION_HIGHLIGHTING_OPACITY:Ca,DEFAULT_VIEWER_BACKGROUND_COLOR:Aa,MAXIMUM_MATERIAL_OVERRIDE_OPACITY:ra,MAX_STORED_COLOR_ARRAY_LENGTH:sa,appliedItemMaterialOverride:pa,appliedItemMaterialOverrideIds:ha,applyMaterialToAllUserAction:ga,confirmApplyMaterialToAllDialogOpen:ya,elementHasColorAttribute:elementHasColorAttribute,elementIsColorSwatch:elementIsColorSwatch,featureEdgesLineThickness:Ht,featureEdgesSelectedColor:Bt,sceneItemAdjustmentsCustomColors:ua,sceneItemAdjustmentsLastSelectedOverride:fa,sceneItemAdjustmentsRecentColors:da,sceneItemAdjustmentsSelectedColor:ca,sceneItemAdjustmentsSelectedOpacity:ma,selectionHighlightingSelectedColor:Sa,selectionHighlightingSelectedLineThickness:Ta,selectionHighlightingSelectedOpacity:xa,showConfirmDialogWhenApplyingMaterialToAll:va,useSceneItemMaterialActions:useSceneItemMaterialActions,viewerBackgroundSelectedColor:ka});const VertexSceneItemMaterialApplyAll=({onApplyAll:t})=>{const n=useSceneItemMaterialActions(),a=p(fa),i=r(ca),l=r(va),o=T.useMemo((()=>"hasValue"===a.state?null!=i?i:a.contents:i),[a,i]);return e(_,{content:"Apply to All",children:e(V,{iconName:"square-dot-outline",iconSize:"sm",color:"secondary",disabled:null==o,onClick:async()=>{l?n.confirmApplyAll(t):(await n.applyAll(),null==t||t(o))}})})};function SceneItemMaterialApplyAllConfirmationDialog(){const a=useSceneItemMaterialActions(),i=r(ya),[l,o]=A.useState(!1),onCloseDialog=()=>{a.cancelApplyAll(),o(!1)};return i?t(L,{open:!0,className:"text-sm",onClosed:onCloseDialog,onBackdropClick:onCloseDialog,children:[e("div",{slot:"heading",children:"Apply to All Parts"}),e("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."}),t("div",{className:"flex mt-8 gap-2 items-center",children:[t("div",{className:"flex gap-2",children:[e(R,{"data-testid":"hide-confirmation-dialog-in-future-checkbox",variant:"check",className:"pt-0.5",checked:l,onValueChanged:e=>{o(e.detail)}}),"Don't show again this session"]}),t("div",{className:"flex ml-auto gap-2",children:[e(j,{"data-testid":"cancel-apply-material-to-all",onClick:onCloseDialog,children:"Cancel"}),e(j,{color:"primary","data-testid":"confirm-apply-material-to-all",onClick:async()=>{await a.applyAll(),l&&a.hideConfirmApplyAllDialog()},children:"Apply"})]})]})]}):e(n,{})}const VertexSceneItemMaterialColorPicker=({onApply:t})=>{const n=useSceneItemMaterialActions(),a=p(fa),i=r(ca),l=T.useMemo((()=>"hasValue"===a.state?null!=i?i:a.contents:i),[a,i]);return e(VertexColorPicker,{"data-testid":"selected-item-color-picker",value:null!=l?Te.toHexString(l.diffuse):void 0,onValueChanged:async()=>{null!=l&&(await n.apply(),null==t||t(l),await n.saveRecentColor(createColorMaterialWithId(Te.toHexString(l.diffuse))))},onInput:async e=>{n.updateColor(createColorMaterialWithId(e)),await n.apply()}})},ColorSwatch=t=>{var{color:n,hideTooltip:a,onClick:i}=t,l=__rest(t,["color","hideTooltip","onClick"]);const o="string"==typeof n?n:Te.toHexString(n.diffuse);return e(_,{className:"flex-grow-0",content:o,disabled:!!a,children:e("button",{onClick:()=>null==i?void 0:i(n),children:e(D,Object.assign({"data-testid":`color-swatch-${o}`,variant:"square",color:o},l))})})},VertexSceneItemMaterialColorSwatches=({onAddCustomColor:a,onApplyCustomColor:i,onApplyRecentColor:l})=>{const o=useSceneItemMaterialActions(),s=r(ua),c=r(da),d=s.length===sa;return t(n,{children:[t("div",{"data-testid":"appearance-custom-colors",className:"flex flex-wrap gap-2 mt-1 mb-4",children:[s.map((t=>e(ColorSwatch,{color:t,onClick:async()=>{o.updateColor(t),await o.apply(),null==i||i(t)},"data-custom-color":!0,"data-color-id":t.id},t.id))),!d&&e(N,{"data-testid":"appearance-custom-colors-add",variant:"swatch",size:"md",onValueChanged:async e=>{const t=createColorMaterialWithId(e.detail);await o.saveCustomColor(t),await o.apply(),null==a||a(t)},children:e("div",{slot:"overlay",className:"flex items-center justify-center w-full h-full",children:e(B,{className:"bg-white p-2",name:"plus",size:"sm"})})})]}),!!c.length&&e("div",{"data-testid":"appearance-recent-colors",className:"flex flex-wrap gap-2",children:c.map((t=>e(ColorSwatch,{color:t,onClick:async()=>{o.updateColor(t),await o.apply(),null==l||l(t)},"data-recent-color":!0,"data-color-id":t.id},t.id)))})]})},VertexSceneItemMaterialOpacitySlider=({onApply:t})=>{const n=useSceneItemMaterialActions(),a=r(ma),i=p(fa),l=T.useMemo((()=>{var e,t;return"hasValue"===i.state?null!==(t=null!=a?a:null===(e=i.contents)||void 0===e?void 0:e.opacity)&&void 0!==t?t:ra:null!=a?a:ra}),[a,i]),o=useDebouncedCallback((()=>{n.apply()}),500),s=T.useCallback((e=>{n.updateOpacity(e.detail.value),o(e.detail.value)}),[o,n]),c=T.useMemo((()=>"hasValue"!==i.state||null==i.contents),[i]);return e(_,{className:"flex w-full",content:c?"Select a part and apply a color to enable opacity":`${Math.floor(l/ra*100)}%`,placement:"top",children:e(VertexSlider,{"data-testid":"scene-item-adjustments-opacity-slider",leftLabel:"0%",rightLabel:"100%",disabled:c,value:null!=l?l:ra,step:5,min:0,max:ra,onValueChange:e=>{n.updateOpacity(e.detail.value),n.apply(),null==t||t(e.detail.value)},onValueInput:s})})};function VertexMaterialControls({customColors:a,onApplyMaterial:i,onApplyMaterialToAll:l,onAddCustomColor:o,onApplyCustomColor:s,onApplyRecentColor:c,onApplyOpacity:d}){const u=useSceneItemMaterialActions(),m=r(Sn);return A.useEffect((()=>{u.clearCurrentColor(),u.clearCurrentOpacity()}),[null==m?void 0:m.id]),A.useEffect((()=>{if(null!=a){const e=a.map((e=>Object.assign(Object.assign({},e),{id:Me.create()})));u.setCustomColors(e)}}),[a]),t(n,{children:[t("div",{className:"flex flex-col",children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),t("div",{className:"flex items-center gap-2",children:[e(VertexSceneItemMaterialColorPicker,{onApply:i}),e(VertexSceneItemMaterialApplyAll,{onApplyAll:l})]})]}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Color Swatches"}),e(VertexSceneItemMaterialColorSwatches,{onAddCustomColor:o,onApplyCustomColor:s,onApplyRecentColor:c}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e(VertexSceneItemMaterialOpacitySlider,{onApply:d}),e(SceneItemMaterialApplyAllConfirmationDialog,{})]})}const ResetButton=({id:n,tooltip:a,children:i})=>{const[l,o]=A.useState(!1);return e("div",{className:"ml-auto",children:t(H,{className:"flex items-stretch h-full","data-testid":`reset-button-dropdown-menu-${n}`,placement:"bottom-end",onMenuOpened:()=>o(!0),onMenuClosed:()=>o(!1),children:[e("div",{slot:"anchor",className:"flex items-center h-full",children:e(_,{content:a,disabled:l,placement:"bottom",children:t(j,{className:jt("p-1.5 rounded-md select-none hover:bg-neutral-300 active:bg-neutral-400 cursor-pointer",{"bg-neutral-300":l}),"data-testid":`reset-button-${n}`,variant:"plaintext",children:[e(B,{className:"px-0.5",name:"reset",size:"sm"}),e(B,{name:"chevron-down",size:"sm"})]})})}),e("div",{className:"whitespace-nowrap",children:i})]})})},VertexSceneItemMaterialClear=({onClear:n,onClearAll:a})=>{const i=useSceneItemMaterialActions(),l=r(Mn);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"materials",tooltip:"Clear Materials",children:[e("div",{className:"pt-1"}),e(F,{"data-testid":"clear-selected-materials",onClick:()=>{i.clear(),null==n||n()},disabled:!l,children:"Clear selected materials"}),e(F,{"data-testid":"clear-all-materials",onClick:()=>{i.clearAll(),null==a||a()},children:"Clear all materials"})]})})};function VertexMaterialPanelSection({customColors:n,onClearMaterial:a,onClearAllMaterials:i,onApplyMaterial:l,onApplyMaterialToAll:o,onAddCustomColor:r,onApplyCustomColor:s,onApplyRecentColor:c,onApplyOpacity:d}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Material",e(VertexSceneItemMaterialClear,{onClear:a,onClearAll:i})]}),children:e(VertexMaterialControls,{customColors:n,onApplyMaterial:l,onApplyMaterialToAll:o,onAddCustomColor:r,onApplyCustomColor:s,onApplyRecentColor:c,onApplyOpacity:d})})}const VertexSelectionHighlightingColorPicker=({onUpdate:t})=>{const[n,a]=s(Sa);return e(VertexColorPicker,{"data-testid":"selection-highlighting-color-picker",value:n,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})},VertexSelectionHighlightingLineThicknessSlider=({onUpdate:t})=>{const[n,a]=s(Ta);return e(VertexSlider,{id:"selection-highlighting-line-thickness","data-testid":"selection-highlighting-line-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:n,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},VertexSelectionHighlightingOpacitySlider=({onUpdate:t})=>{const[n,a]=s(xa);return e(VertexSlider,{id:"selection-highlighting-opacity","data-testid":"selection-highlighting-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:n,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexSelectionHighlightingControls({onUpdateSelectionHighlightColor:a,onUpdateSelectionHighlightOpacity:i,onUpdateSelectionHighlightLineThickness:l}){return t(n,{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e(VertexSelectionHighlightingColorPicker,{onUpdate:a}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e(VertexSelectionHighlightingOpacitySlider,{onUpdate:i}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e(VertexSelectionHighlightingLineThicknessSlider,{onUpdate:l})]})}const VertexSelectionHighlightingReset=({onReset:t})=>{const[n,a]=s(Sa),[i,l]=s(xa),[o,r]=s(Ta),c=undefined;return e("div",{className:"ml-auto",children:e(_,{content:"Reset Selection Highlighting",children:e(V,{"data-testid":"selection-highlighting-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(ba),l(Ca),r(1),null==t||t()},disabled:!(n!==ba||i!==Ca||1!==o)})})})};function VertexSelectionHighlightingPanelSection({onResetSelectionHighlighting:n,onUpdateSelectionHighlightColor:a,onUpdateSelectionHighlightOpacity:i,onUpdateSelectionHighlightLineThickness:l}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Selection Highlighting",e(VertexSelectionHighlightingReset,{onReset:n})]}),children:e(VertexSelectionHighlightingControls,{onUpdateSelectionHighlightColor:a,onUpdateSelectionHighlightOpacity:i,onUpdateSelectionHighlightLineThickness:l})})}const VertexViewerBackgroundColorPicker=({onUpdate:t})=>{const[n,a]=s(ka);return e(VertexColorPicker,{"data-testid":"viewer-background-color-picker",value:n,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})};function VertexViewerBackgroundControls({onUpdateViewerBackgroundColor:a}){return t(n,{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e(VertexViewerBackgroundColorPicker,{onUpdate:a})]})}const VertexViewerBackgroundReset=({onReset:t})=>{const[n,a]=s(ka),i=undefined;return e("div",{className:"ml-auto",children:e(_,{content:"Reset Background Color",children:e(V,{"data-testid":"viewer-background-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(Aa),null==t||t()},disabled:!(n!==Aa)})})})};function VertexViewerBackgroundPanelSection({onResetViewerBackgroundColor:n,onUpdateViewerBackgroundColor:a}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Viewer Background",e(VertexViewerBackgroundReset,{onReset:n})]}),children:e(VertexViewerBackgroundControls,{onUpdateViewerBackgroundColor:a})})}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,l=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement,o=e instanceof HTMLElement&&"VERTEX-VIEWER-PIN-TOOL"===e.tagName,r=e instanceof HTMLElement&&"VERTEX-VIEWER-TRANSFORM-WIDGET"===e.tagName;return t||n||a||i||l||o||r},useRecoilReducer=({reducer:e,atom:t})=>{const n=undefined,a=undefined;return[r(t),useRecoilReducerDispatch({reducer:e,atom:t})]},useRecoilReducerDispatch=({reducer:e,atom:t})=>{const n=i((({set:n})=>async a=>{n(t,(t=>e(t,a)))}),[]);return n},Ea=l({key:"keyBindings",default:{applyBindings:[],bindings:{},pressed:{}}});function reducer(e,t){var n,a,i,l;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 r=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!==(l=e.bindings[t.binding.keyBind])&&void 0!==l?l:[]).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:Ea}),useKeyBindingReadonlyState=()=>r(Ea);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();A.useEffect((()=>{const a=Me.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(),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(),i=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],i=t.length>0?t[t.length-1]:void 0;null!=i&&(i.fn(),a({type:"remove-key-binding",binding:i}))}))}),[n]);A.useEffect((()=>{const handleKeyDown=e=>{if(!e.repeat&&!t(e.target)){a({type:"set-key-pressed",key:e.key,pressed:!0}),i(e.key);const t=Object.assign(Object.assign({},n.pressed),{[e.key]:!0}),l=matchingSingleFnBindings(n.applyBindings,t,e.key),o=matchingOffBindings(n.applyBindings,t,e.key);(l.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)}}),[i,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(),n=r(Yt);return useStackKeyBinding({id:"ExitBoxSelection",keyBind:"Escape",fn:t.disable,addPredicate:()=>n,cancelPredicate:()=>!n},[n]),e(_,{content:"Box Selection",children:e(V,{iconName:"box-cursor",iconColor:n?"primary":"secondary","data-testid":"viewer-toolbar-enable-box-selection-button",onClick:n?t.disable:t.enable})})},Ia=1,VertexResizableContent=n=>{var{className:a,style:i,displayShadow:l,heading:o,id:r,initialScale:s,placement:c="left",children:d,onResize:u}=n,m=__rest(n,["className","style","displayShadow","heading","id","initialScale","placement","children","onResize"]);const p="left"===c||"right"===c,h="top"===c;function getHorizontalResizeDirection(){switch(c){case"left":return"right";case"right":return"left";default:return"none"}}function getVerticalResizeDirection(){return"top"===c?"top":"none"}const f=null!=s?s:1;return e(W,Object.assign({id:r,"data-testid":`resizable-content-position-${c}`,className:jt(a,"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"===c,"sidebar-shadow-right":"left"===c&&l,"border-l min-w-75 max-w-half":"right"===c,"sidebar-shadow-left":"right"===c&&l,"border-t bottom-0 fixed":"top"===c,"min-h-12 sheet":h}),style:Object.assign({maxHeight:"top"===c?window.innerHeight:void 0},i),initialHorizontalScale:p?s:void 0,initialVerticalScale:h?f:void 0,horizontalDirection:getHorizontalResizeDirection(),verticalDirection:getVerticalResizeDirection(),position:"right"===c||"top"===c?"absolute":"relative",onResizeEnd:()=>null==u?void 0:u()},m,{children:t("div",{className:"flex flex-col h-full w-full",children:["top"===c&&e("div",{className:"flex justify-center w-full",children:e("div",{className:"block md:hidden w-20 h-0.5 mt-0.5 bg-neutral-600 rounded"})}),o,e("div",{className:jt("w-full flex flex-col h-0 flex-grow",{"right-0":"right"===c}),children:d})]})}))};function useDefaultKeybindings(){useApplyKeyBinding({fn:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(Ze),n=await(null==t?void 0:t.scene()),a={milliseconds:500};await(null==n?void 0:n.camera().viewAll().render({animation:a}))})),keyBind:"f"})}function useLongPress({target:e,callback:t,delay:n=500,onMovement:a}){const[i,l]=T.useState(),[o,r]=T.useState();T.useEffect((()=>{const handleTouchStart=e=>{const a=e;null!=a.touches&&1===a.touches.length&&(null!=i&&clearTimeout(i),r(C.create(a.touches[0].clientX,a.touches[0].clientY)),l(setTimeout((()=>null==t?void 0:t(a)),n)))},handleTouchMove=e=>{const t=e;null!=t.touches&&t.touches.length>0&&null!=i&&null!=o&&C.distance(o,C.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,o])}var Oa=Object.freeze({__proto__:null,isInputElement:isInputElement,keyBindings:Ea,reducer:reducer,useApplyKeyBinding:useApplyKeyBinding,useDefaultKeybindings:useDefaultKeybindings,useKeyBindingReadonlyState:useKeyBindingReadonlyState,useKeyBindings:useKeyBindings,useLongPress:useLongPress,useStackKeyBinding:useStackKeyBinding});function asBooleanAttribute(e){return!!e||void 0}const VertexContextMenu=({targetElement:t,menuType:n,disableBackdrop:a,openPredicate:i,onOpen:l,onClose:o,children:s})=>{const c=useContextMenuActions(),d=r(Ft),u=r($t),m=A.useMemo((()=>["bottom-end","top-start","top-end","right","left"]),[]),p=d===n;useStackKeyBinding({id:"ContextMenu",keyBind:"Escape",fn:c.clearActiveContextMenu,addPredicate:()=>null!=d&&d===n,cancelPredicate:()=>null==d},[d]);const h=A.useMemo((()=>null!=t?t:null!=i?window:void 0),[t,i]);return useLongPress({target:h,callback:e=>c.longPress(e,n,i,l),onMovement:()=>c.clearActiveContextMenu()}),A.useEffect((()=>{const handleWindowPointerDown=e=>{const t=undefined;if(!targetWithinMenu(e)&&2!==e.buttons&&d===n){const t=targetShouldSkipNextHit(e);c.clearActiveContextMenu(t)}};if(a)return window.addEventListener("pointerdown",handleWindowPointerDown),()=>{window.removeEventListener("pointerdown",handleWindowPointerDown)}}),[a,n,d]),A.useEffect((()=>{const handlePointerDown=e=>{c.pointerDown(e)},handlePointerUp=e=>{c.pointerUp(e,n,i,l)},handleContextMenu=e=>c.contextMenu(e,i);return null==h||h.addEventListener("pointerdown",handlePointerDown),null==h||h.addEventListener("pointerup",handlePointerUp),null==h||h.addEventListener("contextmenu",handleContextMenu),()=>{null==h||h.removeEventListener("pointerdown",handlePointerDown),null==h||h.removeEventListener("pointerup",handlePointerUp),null==h||h.removeEventListener("contextmenu",handleContextMenu)}}),[t,n,i]),e("div",{className:jt({hidden:!p}),children:e(U,{"data-testid":`${n}-context-menu`,open:asBooleanAttribute(p),position:u,fallbackPlacements:m,backdrop:!a,onMenuClosed:()=>{c.clearActiveContextMenu(),null==o||o()},children:e("div",{className:"pt-1",children:s})})})},VertexFitSelectedMenuItem=()=>{const n=r(wn),a=r(In),i=useViewerCameraActions();return e(F,{"data-testid":"fit-selected-menu-option",onClick:async()=>{null!=(null==a?void 0:a.boundingBox)&&await i.flyToByBoundingBox(a.boundingBox)},disabled:asBooleanAttribute(0===n.length),children:t("div",{className:"flex align-middle gap-2.5",children:[e(B,{slot:"icon",name:"fit-selected",size:"sm"}),"Fit Selected"]})})},VertexFlyToMenuItem=()=>{const n=useViewerCameraActions(),a=r(Gt);return e(F,{"data-testid":"fly-to-part-menu-option",onClick:async()=>{var e;const t=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&&await n.flyToById(i)},disabled:asBooleanAttribute(null==a),children:t("div",{className:"flex align-middle gap-2.5",children:[e(B,{slot:"icon",name:"paper-airplane",size:"sm"}),"Fly To"]})})};function useSceneItemsOperations(){const e=r(Ze),t=undefined,n=undefined,a=undefined,i=undefined,l=undefined,o=undefined;return{sceneItemsOperation:A.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: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 n=useSceneItemsOperations();return e(F,{"data-testid":"hide-all-menu-option",onClick:async()=>{await n.sceneItemsOperation((e=>e.hide()))},children:t("div",{className:"flex align-middle gap-2.5",children:[e(B,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide All Parts"]})})},VertexHidePartMenuItem=()=>{const n=r(Gt),a=useSceneItemsOperations();return e(F,{"data-testid":"hide-menu-option",onClick:async()=>{var e;const t=undefined,i=contextMenuItemIsRow(n)?null===(e=null==n?void 0:n.node.id)||void 0===e?void 0:e.hex:n.id;null!=i&&await a.sceneItemsOperation((e=>e.hide()),[i])},disabled:asBooleanAttribute(null==n),children:t("div",{className:"flex align-middle gap-2.5",children:[e(B,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide Part"]})})},VertexHideSelectedMenuItem=()=>{const n=r(wn),a=useSceneItemsOperations();return e(F,{"data-testid":"hide-selected-menu-option",onClick:()=>a.hideSelected(),disabled:asBooleanAttribute(0===n.length),children:t("div",{className:"flex align-middle gap-2.5",children:[e(B,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide Selected"]})})},VertexShowAllMenuItem=()=>{const n=useSceneItemsOperations();return e(F,{"data-testid":"show-all-menu-option",onClick:async()=>{await n.sceneItemsOperation((e=>e.show()))},children:t("div",{className:"flex align-middle gap-2.5",children:[e(B,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show All Parts"]})})},VertexShowOnlyMenuItem=()=>{const n=r(Gt),a=useSceneItemsOperations();return e(F,{"data-testid":"show-only-menu-option",onClick:async()=>{var e;const t=undefined,i=contextMenuItemIsRow(n)?null===(e=null==n?void 0:n.node.id)||void 0===e?void 0:e.hex:null==n?void 0:n.id;null!=i&&await a.showOnlyItem(i)},disabled:asBooleanAttribute(null==n),children:t("div",{className:"flex align-middle gap-2.5",children:[e(B,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show Only Part"]})})},VertexShowOnlySelectedMenuItem=()=>{const n=r(wn),a=useSceneItemsOperations();return e(F,{"data-testid":"show-only-selected-menu-option",onClick:()=>a.showOnlySelected(),disabled:asBooleanAttribute(0===n.length),children:t("div",{className:"flex align-middle gap-2.5",children:[e(B,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show Only Selected"]})})},Na=l({key:"openedPanelActivePrimaryLeft",default:void 0}),Ma=l({key:"openedPanelActivePrimaryRight",default:void 0}),_a=l({key:"openedPanelActiveSceneTreeSecondary",default:void 0});function usePanelActions(){return{openPrimary:useActionCallback((({set:e})=>(t,n)=>{e("left"===n?Na:Ma,t)})),closePrimary:useActionCallback((({set:e})=>t=>{e("left"===t?Na:Ma,void 0)})),openSecondary:useActionCallback((({set:e})=>t=>e(_a,t))),closeSecondary:useActionCallback((({reset:e})=>()=>e(_a)))}}var Va=Object.freeze({__proto__:null,openedPanelActivePrimaryLeft:Na,openedPanelActivePrimaryRight:Ma,openedPanelActiveSceneTreeSecondary:_a,usePanelActions:usePanelActions});const VertexShowPropertiesMenuItem=()=>{const n=usePanelActions(),a=useSelectionActions(),i=r(Gt);return e(F,{"data-testid":"show-properties-menu-option",disabled:asBooleanAttribute(null==i),onClick:()=>{var e;const t=undefined,l=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!=l&&(a.clearAndSelect({id:l}),n.openSecondary("Properties"))},children:t("div",{className:"flex align-middle gap-2.5",children:[e(B,{slot:"icon",name:"info",size:"sm"}),"Show Properties"]})})},La=l({key:"sceneTreeLoaderVisible",default:!1}),Ra=l({key:"sceneTreeElement",default:void 0}),ja=l({key:"sceneTreeController",default:void 0,dangerouslyAllowMutability:!0}),Da=l({key:"sceneTreeOpenPopover",default:void 0}),za=d({key:"sceneTreePopoverIsOpen",get:e=>({get:t})=>t(Da)===e});function useSceneTreeActions(){const e=useSelectionActions(),t=useViewerCameraActions();return{toggleSelection:useActionCallback((({snapshot:t})=>async(n,a,i)=>{var l,o;if(!n.defaultPrevented&&0===n.button&&(n.altKey||((n.ctrlKey||n.metaKey)&&a.selected?await i.deselectItem(a):a.selected?await i.selectItem(a,{recurseParent:!0}):a.selected||await i.selectItem(a,{append:n.ctrlKey||n.metaKey,range:n.shiftKey})),null!=a.id)){const i=await t.getPromise(Sn);e.syncSelection({id:null===(l=a.id)||void 0===l?void 0:l.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(Ra),l=await(null==i?void 0:i.getRowAtClientY(n));null!=(null===(a=null==l?void 0:l.node.id)||void 0===a?void 0:a.hex)&&await t.flyToById(l.node.id.hex)})),flyToFirstSelectedItem:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(Ra),n=await e.getPromise(kn);null!=n&&(null==t||t.scrollToItem(n))})),setContextMenuItem:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(Ra),i=await(null==a?void 0:a.getRowAtClientY(n));e(Gt,i)})),openSceneTreePopover:useActionCallback((({set:e})=>t=>{e(Da,t)})),closeSceneTreePopover:useActionCallback((({set:e})=>()=>{e(Da,void 0)}))}}var Ba=Object.freeze({__proto__:null,sceneTreeController:ja,sceneTreeElement:Ra,sceneTreeLoaderVisible:La,sceneTreeOpenPopover:Da,sceneTreePopoverIsOpen:za,useSceneTreeActions:useSceneTreeActions});function fromApiProperty(e){var t,n;return{key:null!==(n=null===(t=e.key)||void 0===t?void 0:t.name)&&void 0!==n?n:"",value:apiMetadataPropertyDisplayValue(e.value)}}function apiMetadataPropertyDisplayValue(e){var t,n,a,i;let l="";switch(null==e?void 0:e.type){case"string":l=null!==(t=e.value)&&void 0!==t?t:l;break;case"long":l=null!==(n=e.value.toString())&&void 0!==n?n:l;break;case"double":l=null!==(a=e.value.toString())&&void 0!==a?a:l;break;case"timestamp":l=null!==(i=e.value.seconds.toLocaleString())&&void 0!==i?i:l}return l}const Ha=l({key:"showMetadataSceneItemProperties",default:!0}),Fa=d({key:"nextMetadataSceneItemProperties",get:e=>async({get:t})=>{var n,a,i;const l=t(Ze),o=t(Ua(e));try{const t=await(null===(n=null==l?void 0:l.sceneItems)||void 0===n?void 0:n.listSceneItemMetadata(e,{cursor:o,size:20})),r=null===(a=null==t?void 0:t.entries)||void 0===a?void 0:a.map((e=>fromApiProperty(e))),s=undefined;return{metadata:null!=r?null===(i=[...r])||void 0===i?void 0:i.sort(((e,t)=>e.key>t.key?1:-1)):void 0,cursor:null==t?void 0:t.paging.next}}catch(t){return void logger_debug(`Error encountered get metadata for scene item. [itemId={${e}}]`,t)}}}),Wa=u({key:"loadedMetadataSceneItemProperties",default:[]}),Ua=u({key:"metadataSceneItemPropertiesCursor",default:void 0}),Ga=d({key:"hasMoreMetadataSceneItemProperties",get:e=>({get:t})=>{const n=undefined;return null!=t(Ua(e))}}),Ka=u({key:"isFetchingMetadataSceneItemProperties",default:!1}),$a=o({key:"metadataSceneItemName",get:async({get:e})=>{var t;const n=e(Sn);if(null!=n){const a=e(bn(n.id));return null!==(t=null==a?void 0:a.name)&&void 0!==t?t:void 0}}});var qa=Object.freeze({__proto__:null,apiMetadataPropertyDisplayValue:apiMetadataPropertyDisplayValue,fromApiProperty:fromApiProperty,hasMoreMetadataSceneItemProperties:Ga,isFetchingMetadataSceneItemProperties:Ka,loadedMetadataSceneItemProperties:Wa,metadataSceneItemName:$a,metadataSceneItemPropertiesCursor:Ua,nextMetadataSceneItemProperties:Fa,showMetadataSceneItemProperties:Ha});const VertexGhostSelectedMenuItem=()=>{const n=r(wn),a=useSceneItemsOperations();return e(F,{"data-testid":"ghost-selected-menu-option",onClick:()=>a.ghostSelected(),disabled:asBooleanAttribute(0===n.length),children:t("div",{className:"flex align-middle gap-2.5",children:[e(B,{slot:"icon",name:"visibility-partial",size:"sm"}),"Ghost Selected"]})})},VertexUnghostSelectedMenuItem=()=>{const n=r(wn),a=useSceneItemsOperations();return e(F,{"data-testid":"unghost-selected-menu-option",onClick:()=>a.unGhostSelected(),disabled:asBooleanAttribute(0===n.length),children:t("div",{className:"flex align-middle gap-2.5",children:[e(B,{slot:"icon",name:"visibility-visible",size:"sm"}),"Unghost Selected"]})})},DefaultSceneTreeContextMenu=()=>{const n=r(Ha);return t("div",{className:"w-56",children:[e(VertexHideSelectedMenuItem,{}),e(VertexHideAllMenuItem,{}),e(VertexShowOnlyMenuItem,{}),e(VertexShowOnlySelectedMenuItem,{}),e(VertexShowAllMenuItem,{}),e(VertexGhostSelectedMenuItem,{}),e(VertexUnghostSelectedMenuItem,{}),e(G,{}),e(VertexFitSelectedMenuItem,{}),e(VertexFlyToMenuItem,{}),n&&t("div",{children:[e(G,{}),e(VertexShowPropertiesMenuItem,{})]})]})},VertexSceneTreeContextMenu=({children:t})=>{const n=useSceneTreeActions(),a=r(Ra),i=undefined;return e(VertexContextMenu,{menuType:"scene-tree",targetElement:a,onOpen:async(e,t)=>{const a=e;await n.setContextMenuItem(a.clientY)},disableBackdrop:!0,children:null!=t&&!1!==t?t:e(DefaultSceneTreeContextMenu,{})})},DefaultViewerContextMenu=()=>{const n=r(Ha);return t("div",{className:"w-56",children:[e(VertexHidePartMenuItem,{}),e(VertexHideSelectedMenuItem,{}),e(VertexHideAllMenuItem,{}),e(VertexShowOnlyMenuItem,{}),e(VertexShowOnlySelectedMenuItem,{}),e(VertexShowAllMenuItem,{}),e(VertexGhostSelectedMenuItem,{}),e(VertexUnghostSelectedMenuItem,{}),e(G,{}),e(VertexFitSelectedMenuItem,{}),e(VertexFlyToMenuItem,{}),n&&t("div",{children:[e(G,{}),e(VertexShowPropertiesMenuItem,{})]})]})},VertexViewerContextMenu=({children:t})=>{const n=null!=t&&!1!==t,a=A.useCallback((e=>e.target instanceof HTMLElement&&"vertex-viewer"===e.target.id),[]);return e(VertexContextMenu,{menuType:"viewer",disableBackdrop:!0,openPredicate:a,children:n?t:e(DefaultViewerContextMenu,{})})},Ya=35,Xa=l({key:"sceneItemGhostingSelectedOpacity",default:Ya}),Za=u({key:"appliedItemPhantomState",default:void 0}),Ja=l({key:"appliedItemPhantomStateIds",default:[]}),Qa=o({key:"sceneItemGhostingLastSelectedPhantom",get:({get:e})=>{var t;const n=e(Sn);return null!=n&&(null!==(t=e(Za(n.id)))&&void 0!==t&&t)}}),VertexSceneItemGhostingOpacitySlider=({onApply:t})=>{const[n,a]=s(Xa);return e(VertexSlider,{id:"phantom-opacity","data-testid":"phantom-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:n,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(Ja)).forEach((e=>t(Za(e)))),t(Ja)}));return{setPhantomState:useActionCallback((({snapshot:t,set:n})=>async a=>{const i=await t.getPromise(wn);i.forEach((e=>n(Za(e),a))),n(Ja,(e=>[...e,...i])),await e.execute(gn.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(wn);i.forEach((e=>a(Za(e)))),n(Ja,(e=>e.filter((e=>!i.includes(e))))),await e.execute(gn.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(gn.CLEAR_PHANTOM_ALL,(e=>e.where((e=>e.all())).clearPhantom()),(e=>e.where((e=>e.withSelected())).select()))})),resetAllPhantomState:t}};var ei=Object.freeze({__proto__:null,DEFAULT_GHOSTING_OPACITY:Ya,appliedItemPhantomState:Za,appliedItemPhantomStateIds:Ja,sceneItemGhostingLastSelectedPhantom:Qa,sceneItemGhostingSelectedOpacity:Xa,useSceneItemPhantomActions:useSceneItemPhantomActions});const VertexSceneItemGhostingToggle=({onApply:t})=>{const n=useSceneItemPhantomActions(),a=r(Mn),i=p(Qa);return e(_,{content:"Select a part to display as ghost",disabled:a,children:e(R,{className:"flex items-center","data-testid":"phantom-state-toggle",variant:"switch",disabled:!a,checked:"hasValue"===i.state&&i.contents,onValueChanged:async e=>{await n.setPhantomState(e.detail),null==t||t(e.detail)}})})};function VertexGhostingControls({onApplyGhostingChange:a,onApplyOpacity:i}){return t(n,{children:[t("div",{className:"flex items-center py-3",children:[e(VertexSceneItemGhostingToggle,{onApply:a}),e("span",{className:"pl-4 text-sm text-neutral-700",children:"Display as Ghost"})]}),e("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Global Ghost Opacity"}),e(VertexSceneItemGhostingOpacitySlider,{onApply:i})]})}const VertexSceneItemGhostingClear=({onClear:n,onClearAll:a})=>{const i=useSceneItemPhantomActions(),l=r(Qa);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"phantom",tooltip:"Clear Ghosting",children:[e("div",{className:"pt-1"}),e(F,{"data-testid":"reset-selected-phantom",onClick:async()=>{await i.clearPhantomState(),null==n||n()},disabled:!l,children:"Clear ghosting for selected"}),e(F,{"data-testid":"reset-all-phantom",onClick:async()=>{await i.clearAllPhantomState(),null==a||a()},children:"Clear ghosting for all"})]})})};function VertexGhostingPanelSection({onClearGhostState:n,onClearAllGhostState:a,onApplyGhostingChange:i,onApplyOpacity:l}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Ghosting",e(VertexSceneItemGhostingClear,{onClear:n,onClearAll:a})]}),children:e(VertexGhostingControls,{onApplyGhostingChange:i,onApplyOpacity:l})})}function VertexMeasurementContextMenu({onDelete:n}){const a=r(Ut);return e(VertexContextMenu,{menuType:"measurement",openPredicate:e=>e.target instanceof HTMLElement&&"VERTEX-VIEWER-MEASUREMENT-DISTANCE"===e.target.tagName,children:t(F,{"data-testid":"measurement-delete",onClick:()=>null!=a&&n(a.id),children:[e(B,{slot:"icon",name:"delete",size:"sm"}),e("div",{className:"pl-2",children:"Delete"})]})})}function useDockedPlacement(e,t){const[n,a]=T.useState(C.create(0,0));return T.useLayoutEffect((()=>{if(null!=e){const n=e.getBoundingClientRect(),i=C.create(n.left,n.bottom),l=C.create(n.right,n.bottom);a("left"===t?i:l)}}),[e,t]),n}function VertexMeasurementDetails({placement:n,size:a}){const i=useMeasurementActions(),l=r(Ze),o=r(Je),s=useDockedPlacement(null!=l?l:null,n),c=r(dn),d=r(un),u=r(mn),m=r(pn),p=r(Ln),h=r(Rn);return e(K,{className:"z-popover",boundaryPadding:16,boundarySelector:`#${o}`,position:s,children:t("div",{className:jt("flex flex-col min-w-40",{"text-xs leading-2":"sm"===a,"text-sm leading-4":"md"===a,"text-base leading-5":"lg"===a,"text-lg leading-5":"xl"===a}),children:[t("div",{className:"pb-2 flex justify-between items-center",children:[e("div",{className:jt("w-full",{"text-sm leading-5":"sm"===a,"text-base leading-5":"md"===a,"text-lg leading-6":"lg"===a,"text-xl leading-7 mr-6":"xl"===a}),children:"Measurement"}),e("div",{className:jt("mr-0.5",{hidden:!m}),children:e(_,{content:"Reset",placement:"left-start",children:e(V,{"data-testid":"measurement-details-reset",iconName:"reset",iconSize:"sm",onClick:i.resetMeasurement})})})]}),e(ae,{"data-testid":"measurement-details-viewer-measurement-details",className:jt("gap-y-1.5",{hidden:null==c}),measurementOutcome:c,measurementOverlays:d,distanceUnits:toUnitType(p),fractionalDigits:parseInt(h,10)}),e("div",{"data-testid":"measurement-details-message",className:jt({hidden:null==u}),children:u})]})})}function useCallbackRef(e){var t;const[n,a]=A.useState((t=void 0,null)),i=undefined;return{element:n,callback:A.useCallback((e=>a(e)),[])}}function VertexPointToPointMeasurement({detailsPlacement:a,detailsSize:i,onPointToPointMeasurementChange:l}){const o=useMeasurementActions(),s=r(Ze),c=r(Jt),d=r(en),u=r(Ln),m=r(Rn),{callback:p,element:h}=useCallbackRef();usePointToPointMeasurement(h);const f=P((e=>{const t={start:e.detail.start,end:e.detail.end,invalid:!e.detail.valid};o.setEditedPointToPointMeasurement(t),null==l||l(t)}),[o]);return c?t(n,{children:[e(ie,{"data-testid":"point-to-point-measurement",ref:p,viewer:null!=s?s:void 0,mode:"replace",start:null==d?void 0:d.start,end:null==d?void 0:d.end,invalid:null==d?void 0:d.invalid,units:toUnitType(u),fractionalDigits:parseInt(m,10),showAxisReferenceLines:!0,onEditEnd:f}),e(VertexMeasurementDetails,{placement:a,size:i}),e(VertexMeasurementContextMenu,{onDelete:o.resetMeasurement})]}):e(n,{})}function VertexPointToPointMeasurementTool(){const t=useMeasurementActions(),n=r(Jt);return useStackKeyBinding({id:"ExitMeasurement",keyBind:"Escape",fn:t.disableEditMeasurement,addPredicate:()=>n,cancelPredicate:()=>!n},[n,t]),e(_,{content:"Point to Point Measurement",children:e(V,{iconName:"tape-measure","data-testid":"viewer-toolbar-point-to-point-measurement-button",iconColor:n?"primary":"secondary",onClick:t.toggleEditPointToPointMeasurement})})}const ti=l({key:"viewerToolkitSdkConfig",default:void 0});var ni=Object.freeze({__proto__:null,sdkConfig:ti});const VertexPreciseMeasurement=({detailsPlacement:a,detailsSize:i,onEntitiesChanged:l,onOutcomeChanged:o})=>{var s,c,d,u;const m=r(Ze),p=r(ti),h=r(nn),{callback:f,element:g}=useCallbackRef();return usePreciseMeasurementModel(g,l,o),h?t(n,{children:[e(le,{"data-testid":"precise-measurement-viewer-tool",ref:f,viewer:null!=m?m:void 0,config:JSON.stringify({network:{apiHost:null===(s=null==p?void 0:p.network)||void 0===s?void 0:s.apiHost,renderingHost:null===(c=null==p?void 0:p.network)||void 0===c?void 0:c.renderingHost,sceneTreeHost:null===(d=null==p?void 0:p.network)||void 0===d?void 0:d.sceneTreeHost,sceneViewHost:null===(u=null==p?void 0:p.network)||void 0===u?void 0:u.sceneViewHost}})}),e(VertexMeasurementDetails,{placement:a,size:i})]}):e(n,{})};function VertexPreciseMeasurementTool(){const t=useMeasurementActions(),n=r(nn);return e(_,{content:"Precise Measurement",children:e(V,{iconName:"ruler","data-testid":"viewer-toolbar-precise-measurement-button",iconColor:n?"primary":"secondary",onClick:t.toggleEditPreciseMeasurement})})}function VertexApplicationMessages(){const a=r($e),i=r(Ke);return t(n,{children:[null!=a&&e($,{className:"z-[16000]",duration:a.duration,open:!0,content:a.message,type:a.type},a.id),null!=i&&e(q,{placement:"bottom-left",className:"z-[16000]",duration:i.duration,open:!0,content:i.message,type:i.type},i.id)]})}const ai={binding:"{{row.node.name}}",label:"Name",metadataKeyName:"VERTEX_SCENE_ITEM_NAME"};function mapToColumn(e,t){return{label:"name"===e.toLowerCase()?"Name (Property)":e,binding:`{{row.metadata.${e}}}`,initialWidth:t,minWidth:t/2}}const ii=l({key:"sceneTreeColumnsRefreshTrigger",default:0}),li=l({key:"sceneTreeColumnsWhitelistedColumns",default:[]}),oi=o({key:"sceneTreeColumnsAvailableColumns",get:async({get:e})=>{const t=e(ja);return e(ii),null!=t?await t.fetchMetadataKeys():[]}}),ri=o({key:"sceneTreeColumnsAvailableSortedColumns",get:({get:e})=>e(oi).filter((e=>e!==ai.metadataKeyName)).sort(((e,t)=>e.localeCompare(t)))}),si=l({key:"sceneTreeColumnsVisibleMetadataColumnNames",default:[]}),ci=o({key:"sceneTreeColumnsActiveColumns",get:({get:e})=>{const t=e(si),n=e(Ra),a=null==n?void 0:n.clientWidth;if(null!=a&&a>0){const e=1/(t.length+1)*a,n=(a-e)/t.length;return t.reduce(((e,t)=>{const a=mapToColumn(t,n);return Object.assign(Object.assign({},e),{[a.label]:a})}),{Name:Object.assign(Object.assign({},ai),{initialWidth:e,minWidth:n})})}return{Name:ai}}}),di=o({key:"sceneTreeColumnsActiveColumnNames",get:({get:e})=>Object.keys(e(ci))});function useSceneTreeColumnActions(){return{setActive:useActionCallback((({set:e})=>async t=>{e(si,t)})),refreshKeyList:useActionCallback((({set:e})=>()=>{e(ii,(e=>e+1))}))}}const ui=16,mi=-8;var pi;function useOpenPositionedPopover({open:e,buttonElement:t,horizontalOffset:n,verticalOffset:a}){const[i,l]=T.useState(),[o,r]=T.useState(),s=undefined;return{position:i,direction:o,handleOpen:T.useCallback((()=>{if(!e){const e=null==t?void 0:t.getBoundingClientRect();if(null!=e){const t=null!=n?n:ui,i=null!=a?a:mi,o=e.x>window.innerWidth/2?pi.LEFT:pi.RIGHT;l({x:o===pi.LEFT?e.left-t:e.right+t,y:e.top+i}),r(o)}}}),[e,t])}}!function(e){e.LEFT="left",e.RIGHT="right"}(pi||(pi={}));var hi=Object.freeze({__proto__:null,DEFAULT_HORIZONTAL_POSITION_OFFSET:ui,DEFAULT_NAME_COLUMN:ai,DEFAULT_VERTICAL_POSITION_OFFSET:mi,get PlacementDirection(){return pi},mapToColumn:mapToColumn,sceneTreeColumnsActiveColumnNames:di,sceneTreeColumnsActiveColumns:ci,sceneTreeColumnsAvailableColumns:oi,sceneTreeColumnsAvailableSortedColumns:ri,sceneTreeColumnsRefreshTrigger:ii,sceneTreeColumnsVisibleMetadataColumnNames:si,sceneTreeColumnsWhitelistedColumns:li,useOpenPositionedPopover:useOpenPositionedPopover,useSceneTreeColumnActions:useSceneTreeColumnActions});const fi=l({key:"sceneTreeSearchActive",default:!1}),gi=l({key:"sceneTreeColumnsPartial",default:!1}),vi=l({key:"sceneTreeSearchValue",default:void 0}),yi=l({key:"sceneTreeSearchExactMatch",default:!1}),bi=l({key:"sceneTreeSearchRemoveHiddenItems",default:!1}),Ci=l({key:"sceneTreeSearchResultCount",default:0}),wi=l({key:"sceneTreeSearchActiveColumns",default:[]}),Si=o({key:"sceneTreeSearchNameColumnActive",get:({get:e})=>{const t=e(wi);return 0===t.length||t.includes(ai.metadataKeyName)}});function useSceneTreeSearch({sceneTreeElement:e}){const t=useSceneTreeActions(),n=r(fi),a=c(Ci),i=c(kn);A.useEffect((()=>{let t;return whenComponentReady(e,(()=>{var n;t=null===(n=null==e?void 0:e.controller)||void 0===n?void 0:n.stateChanged((e=>{void 0!==(null==e?void 0:e.totalFilteredRows)&&a(null==e?void 0:e.totalFilteredRows)}))})),()=>{null==t||t.dispose()}}),[e]),A.useEffect((()=>{if(null!=e){let a;return whenComponentReady(e,(()=>{var l;a=null===(l=null==e?void 0:e.controller)||void 0===l?void 0:l.stateChanged((e=>{var a;if(null!=(null==e?void 0:e.filterTerm)){const t=null==e?void 0:e.rows.find((e=>{var t;return null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.selected}));i(null===(a=null==t?void 0:t.node.id)||void 0===a?void 0:a.hex)}else n&&t.flyToFirstSelectedItem()}))})),()=>{null==a||a.dispose()}}}),[e,null==e?void 0:e.controller,open])}function useSceneTreePartialResults({sceneTreeElement:e}){const t=c(gi);A.useEffect((()=>{let n;return whenComponentReady(e,(()=>{var a;n=null===(a=null==e?void 0:e.controller)||void 0===a?void 0:a.stateChanged((e=>{t(!!(null==e?void 0:e.isPartialKeysResponse))}))})),()=>{null==n||n.dispose()}}),[e])}const useSceneTreeSearchActions=()=>{const e=useActionCallback((({set:e})=>t=>{e(wi,t)})),t=useActionCallback((({snapshot:t})=>async(n,a,i,l)=>{const o=await t.getPromise(Ra),r=await t.getPromise(yi),s=await t.getPromise(bi),c=await t.getPromise(wi),d=c.length>0?a?[...c,n]:c.filter((e=>e!==n)):[...i,ai.metadataKeyName].filter((e=>e!==n));e(d),l&&(null==o||o.filterItems(l,{columns:d,exactMatch:r,removeHiddenItems:s}))})),n=useActionCallback((({snapshot:e,set:t})=>async(n,a,i)=>{const l=await e.getPromise(Ra),o=await e.getPromise(yi),r=await e.getPromise(bi),s=await e.getPromise(wi),c=n.filter((e=>!a.includes(e))),d=a.filter((e=>!n.includes(e))),u=s.length>0?[...s.filter((e=>!c.includes(e))),...d]:[...a,ai.metadataKeyName],m=u.length>0?u:[...a,ai.metadataKeyName];t(wi,m),i&&(null==l||l.filterItems(i,{columns:m,exactMatch:o,removeHiddenItems:r}))})),a=useActionCallback((({set:e})=>t=>{e(yi,t)})),i=useActionCallback((({set:e})=>t=>{e(bi,t)}));return{setMetadataSearchKeys:e,updateMetadataSearchAfterSearchKeysChange:t,updateMetadataSearchAfterColumnVisibilityChange:n,setMetadataSearchExactMatch:a,setMetadataSearchRemoveHiddenItems:i}};var xi=Object.freeze({__proto__:null,sceneTreeColumnsPartial:gi,sceneTreeSearchActive:fi,sceneTreeSearchActiveColumns:wi,sceneTreeSearchExactMatch:yi,sceneTreeSearchNameColumnActive:Si,sceneTreeSearchRemoveHiddenItems:bi,sceneTreeSearchResultCount:Ci,sceneTreeSearchValue:vi,useSceneTreePartialResults:useSceneTreePartialResults,useSceneTreeSearch:useSceneTreeSearch,useSceneTreeSearchActions:useSceneTreeSearchActions});const targetIsElement=(e,t)=>e instanceof Element&&e.tagName===t;function useRecoilRef({state:e}){const t=i((({set:t})=>n=>{t(e,n)}),[]);return t}var Ti;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===Ti.ROBOTO_MONO?"var(--vertex-ui-font-family-monospace)":"var(--vertex-ui-font-family)"}!function(e){e.ROBOTO="ROBOTO",e.ROBOTO_MONO="ROBOTO_MONO"}(Ti||(Ti={}));const Ai=l({key:"sceneTreeAdditionalMetadataKeys",default:[]}),ki=o({key:"sceneTreeActiveMetadataKeys",get:({get:e})=>{const t=e(Ai),n=e(si),a=e(li),i=new Set([...t,...n]),l=new Set(a);return 0===a.length?Array.from(i):Array.from(i.intersection(l))}});var Pi=Object.freeze({__proto__:null,sceneTreeActiveMetadataKeys:ki,sceneTreeAdditionalMetadataKeys:Ai});function childrenAsArray(e){return Array.isArray(e)?e:[e]}function filterChildElements(e,t){return childrenAsArray(e).filter((e=>A.isValidElement(e)&&e.type===t))}function findChildElement(e,t){return filterChildElements(e,t)[0]}function cloneChildNodeOrFunction(e,t){return"object"==typeof e?A.cloneElement(e,t):e(t)}function useStateSyncedValue(e,t,{transform:n}={}){const[a,i]=s(e);return A.useEffect((()=>{null!=t&&i(null!=n?n(t):t)}),[t]),a}const VertexEnterSceneTreeSearchModeButton=({onEnterSearchMode:t})=>{const n=c(fi);return e(_,{className:"flex ml-auto",content:"Scene Tree Search",children:e(V,{"data-testid":"enter-scene-tree-search-mode-button",iconName:"search",iconSize:"sm",onPointerDown:e=>{e.preventDefault()},onClick:()=>{n(!0),null==t||t()}})})},VertexSceneTreeMetadataCheck=({checked:n,disabled:a,onChange:i,children:l})=>{const o="string"==typeof l?l.replace(" ","-"):"";return t("div",{className:"flex items-center",children:[e(R,{"data-testid":`scene-tree-metadata-check-${o}`,variant:"check",checked:n,disabled:a,onValueChanged:e=>null==i?void 0:i(e.detail)}),e("div",{className:"pl-2 py-1 text-[0.875rem] w-full","data-testid":`scene-tree-metadata-name-${o}`,onClick:()=>{a||null==i||i(!n)},children:l})]})},VertexSceneTreeSearchOptionsPopover=({onSearchedSceneTreeColumnsChange:a,onSearchForExactMatchChange:i})=>{const l=useSceneTreeActions(),o=useSceneTreeSearchActions(),s=r(Ra),c=r(Si),d=r(wi),u=r(vi),m=r(yi),p=r(bi),h=r(si),{element:f,callback:g}=useCallbackRef(),v="scene-tree-search",b=r(za(v)),{position:C,direction:w,handleOpen:S}=useOpenPositionedPopover({open:b,buttonElement:f,horizontalOffset:40}),A=T.useCallback((()=>{l.closeSceneTreePopover()}),[]),k=w===pi.LEFT?"left-end":"right-start",updateSearch=async(e,t)=>{if(u){const n=d.length>0?d:[...h,ai.metadataKeyName];await(null==s?void 0:s.filterItems(u,{columns:n,exactMatch:e,removeHiddenItems:t}))}};return t(n,{children:[e(_,{content:"Search Options",placement:"top",children:e(V,{"data-testid":"scene-tree-search-options-popover-button",ref:g,iconName:"gear",iconSize:"sm",onClick:()=>{b?A():(S(),l.openSceneTreePopover(v))}})}),b&&e(Y,{"data-testid":"scene-tree-search-options-popover",open:b,backdrop:!1,position:C,resizeBehavior:"fixed",placement:k,className:"z-popover",children:t("div",{className:jt("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!b}),children:[t("div",{className:"flex items-center text-[0.875rem] p-3 border-b border-neutral-300 pb-2",children:[e("div",{className:"pr-2 text-[0.875rem] whitespace-nowrap",children:"Column Properties Search"}),e(V,{className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{A()}})]}),t("div",{className:"max-h-64 p-3 overflow-y-auto",children:[e("div",{className:"text-[0.875rem] pb-2 pr-2",children:"Select properties to perform the search on:"}),e(VertexSceneTreeMetadataCheck,{checked:c,disabled:0===d.length||d.every((e=>e===ai.metadataKeyName)),onChange:async e=>{await o.updateMetadataSearchAfterSearchKeysChange(ai.metadataKeyName,e,h,u),null==a||a()},children:ai.label},ai.metadataKeyName),h.map((t=>e(VertexSceneTreeMetadataCheck,{checked:d.includes(t),disabled:d.length>0&&d.every((e=>e===t)),onChange:async e=>{await o.updateMetadataSearchAfterSearchKeysChange(t,e,h,u),null==a||a()},children:t},t)))]}),t("div",{className:"flex p-3 border-t border-neutral-300",children:[e(R,{className:"flex items-center","data-testid":"filter-exact-match-toggle",variant:"switch",checked:m,onValueChanged:async e=>{o.setMetadataSearchExactMatch(e.detail),null==i||i(),await updateSearch(e.detail,p)}}),e("span",{className:"pl-4 text-[0.875rem] text-neutral-800",children:"Return only exact matches"})]}),t("div",{className:"flex px-3 pb-3",children:[e(R,{className:"flex items-center","data-testid":"filter-remove-hidden-items-toggle",variant:"switch",checked:p,onValueChanged:async e=>{o.setMetadataSearchRemoveHiddenItems(e.detail),await updateSearch(m,e.detail)}}),e("span",{className:"pl-4 text-[0.875rem] text-neutral-800",children:"Search only visible items"})]})]})})]})},VertexSceneTreeSearchBar=({onSearch:n,onClearSearch:a,onExitSearchMode:i,onSearchedSceneTreeColumnsChange:l,onSearchForExactMatchChange:o,children:c})=>{const d=useSceneTreeActions(),u=r(Ra),[m,p]=s(fi),[h,f]=s(vi);useSceneTreeSearch({sceneTreeElement:null!=u?u:null});const{element:g,callback:v}=useCallbackRef(),b=null==h||""===h,C=b?"Exit Search":"Clear Search";return T.useEffect((()=>{m&&(null==g||g.setFocus())}),[g,m]),t("div",{className:"flex w-full py-3 px-2",children:[e(oe,{"data-testid":"scene-tree-search-bar",ref:v,controller:null==u?void 0:u.controller,onBlur:()=>{b&&(p(!1),null==i||i())},onSearch:()=>{f(null==g?void 0:g.value),null==n||n(null==g?void 0:g.value)},children:c}),e("div",{className:"self-center px-1",onPointerDown:e=>{e.preventDefault()},children:e(VertexSceneTreeSearchOptionsPopover,{onSearchedSceneTreeColumnsChange:l,onSearchForExactMatchChange:o})}),e(_,{className:"self-center pr-1",content:C,children:e(V,{"data-testid":"scene-tree-search-close-button",iconName:"close-circle-fill",iconSize:"sm",variant:"plain",onPointerDown:e=>{e.preventDefault()},onClick:async()=>{b?(p(!1),await d.flyToFirstSelectedItem(),null==i||i()):(await(null==g?void 0:g.clear()),await(null==g?void 0:g.setFocus()),f(void 0),null==a||a())}})})]})},VertexSceneTreeSearch=({onEnterSearchMode:n,onExitSearchMode:a,onSearch:i,onClearSearch:l,onSearchedSceneTreeColumnsChange:o,onSearchForExactMatchChange:s,children:c})=>{const d=r(fi);return t(re,{className:"h-11 p-0 border-b border-neutral-300 box-content",slot:"header",children:[d&&e(VertexSceneTreeSearchBar,{onSearch:i,onClearSearch:l,onExitSearchMode:a,onSearchedSceneTreeColumnsChange:o,onSearchForExactMatchChange:s,children:c}),!d&&e("div",{className:"ml-auto mr-2",children:e(VertexEnterSceneTreeSearchModeButton,{onEnterSearchMode:n})})]})};function useCacheableLoadable(e,t){const n=E(),[a,i]=I(0),l=p(e);k((()=>{"hasValue"===l.state&&(n.current=l.contents)}),[t,l]);const[o,r]=O((()=>"hasValue"!==l.state&&null!=n.current?[n.current,!0]:"hasValue"===l.state?[l.contents,!1]:[void 0,!1]),[l.state,l.contents,a]),s=P((()=>{n.current=void 0,i(a+1)}),[a]),c=undefined;return O((()=>({data:o,state:l.state,cached:r,invalidate:s})),[s,o,r,l.state])}const VertexSceneTreeColumnPopover=({onVisibleSceneTreeColumnsChange:a})=>{const i=useSceneTreeActions(),l=useSceneTreeColumnActions(),o=useSceneTreeSearchActions(),s=r(Ra);useSceneTreePartialResults({sceneTreeElement:null!=s?s:null});const c=r(vi),d=r(li),u=useCacheableLoadable(ri),m=d.length>0?d:u.data,p=r(si),h=r(gi),[f,g]=T.useState(p),[v,b]=T.useState(""),{element:C,callback:w}=useCallbackRef(),S="scene-tree-columns",A=r(za(S)),{position:k,direction:P,handleOpen:E}=useOpenPositionedPopover({open:A,buttonElement:C}),I=T.useCallback((()=>{i.closeSceneTreePopover()}),[]),O=P===pi.LEFT?"left-end":"right-start",N=T.useMemo((()=>{if(null!=m){const e=m.filter((e=>f.indexOf(e)<0)),t=undefined;return[...[...f].sort(((e,t)=>e.localeCompare(t))),...e]}return[]}),[f,m]),M=T.useMemo((()=>N),[A,m]);return t(n,{children:[e(_,{content:"Configure Columns",placement:"top",children:e(V,{"data-testid":"scene-tree-column-popover-button",ref:w,iconName:"columns-add",iconSize:"sm",onClick:()=>{A?I():(E(),i.openSceneTreePopover(S))}})}),A&&e(Y,{"data-testid":"scene-tree-column-popover",open:A,backdrop:!1,position:k,resizeBehavior:"fixed",placement:O,className:"z-popover",children:t("div",{className:jt("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!A}),children:[t("div",{className:"flex items-center text-[0.875rem] p-3",children:[t("div",{className:"pr-2",children:[e("div",{className:"text-[0.875rem]",children:"Assembly Properties"}),e("div",{className:"text-[0.75rem] text-neutral-700 mt-1.5",children:"Select up to six properties to appear in the Assembly panel."})]}),e(V,{"data-testid":"scene-tree-columns-popover-close-button",className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{b(""),I()}})]}),e(X,{className:"flex w-full px-2 overflow-hidden border-b border-neutral-300 pb-2",id:"scene-tree-available-columns-search-bar","data-testid":"scene-tree-available-columns-search-bar",multiline:!1,placeholder:"Filter properties",type:"text",onInputInput:e=>{const t=e.detail.value;null!=t&&b(t.toLowerCase())}}),h&&e(se,{"data-testid":"partial-key-list-notification-banner",message:"loading"===u.state?"Refreshing results...":"Data loading, refresh for more.",actionLabel:"Refresh",onAction:()=>l.refreshKeyList()}),t("div",{className:"max-h-64 p-3 overflow-y-auto",children:[e(VertexSceneTreeMetadataCheck,{checked:!0,disabled:!0,children:ai.label}),M.filter((e=>""===v||e.toLowerCase().includes(v))).map((t=>e(VertexSceneTreeMetadataCheck,{checked:f.includes(t),disabled:f.length>=6&&!f.includes(t),onChange:e=>{g(e?[...f,t]:f.filter((e=>e!==t)))},children:t},t)))]}),t("div",{className:"flex items-center p-3 border-t border-neutral-300 space-x-4",children:[e("div",{className:"text-[0.75rem] text-[var(--vertex-ui-blue-700)] cursor-pointer","data-testid":"scene-tree-column-clear-selection",onClick:()=>g([]),children:"Clear selection"}),e("div",{className:"flex-grow"}),t("div",{className:"flex space-x-2",children:[e(j,{"data-testid":"scene-tree-column-popover-cancel",color:"secondary",onClick:()=>{b(""),I()},children:"Cancel"}),e(j,{"data-testid":"scene-tree-column-popover-apply",color:"primary",onClick:async()=>{await o.updateMetadataSearchAfterColumnVisibilityChange(p,f,c),await l.setActive(f),null==a||a(f),b(""),I()},children:"Apply"})]})]})]})})]})};function VertexToolbarDivider(){return e("div",{"data-testid":"toolbar-divider",className:"h-6 w-px bg-neutral-300 mx-1"})}const VertexSceneTreeSearchInformationForToolbar=()=>{const a=useSelectionActions(),i=r(Ra),l=r(vi),o=r(Ci),s=undefined,c=`${o} ${1===o?"result":"results"}`;return t(n,{children:[e(VertexToolbarDivider,{}),t("div",{className:"flex flex-row items-center overflow-hidden",children:[e("div",{className:"px-2 text-[0.8125rem] leading-4 text-neutral-900 truncate","data-testid":"search-result-info",children:`${c}`}),e(_,{className:"w-auto",content:"Select Results",placement:"top",children:e(j,{className:"h-6 rounded cursor-pointer","data-testid":"select-search-results-button",color:"secondary",variant:"text",size:"sm",onClick:async()=>{null!=i&&null!=l&&(await i.selectFilteredItems(l),a.toggleLastSelectWasMultiSelect(!0))},children:t("div",{className:"flex h-6 items-center gap-1",children:[e(B,{size:"sm",name:"check-circle"}),e("span",{className:"whitespace-nowrap",children:"Select Results"})]})})})]})]})},VertexSceneTreeCollapseAll=()=>{const t=r(Ra);return e(_,{className:"w-auto",content:"Collapse All",placement:"top",children:e(B,{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=r(Ra);return e(_,{className:"w-auto",content:"Expand All",placement:"top",children:e(B,{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()}})})},VertexSceneTreeToolbar=({onVisibleSceneTreeColumnsChange:n})=>{const a=r(vi),i=null==a||""===a;return e(re,{className:"h-10 border-b border-neutral-300 box-border",children:t("div",{className:"flex w-full text-neutral-700 items-center gap mx-2",children:[e(VertexSceneTreeExpandAll,{}),e(VertexSceneTreeCollapseAll,{}),!i&&e(VertexSceneTreeSearchInformationForToolbar,{}),e("div",{className:"ml-auto",children:e(VertexSceneTreeColumnPopover,{onVisibleSceneTreeColumnsChange:n})})]})})},VertexSceneTreeHeader=({onEnterSearchMode:a,onExitSearchMode:i,onSearch:l,onClearSearch:o,onVisibleSceneTreeColumnsChange:r,children:s})=>{const c=undefined;return e("div",{slot:"header",className:"flex flex-col",children:null!=s&&!1!==s?s:t(n,{children:[e(VertexSceneTreeSearch,{onEnterSearchMode:a,onExitSearchMode:i,onSearch:l,onClearSearch:o,children:e("div",{slot:"clear-icon"})}),e(VertexSceneTreeToolbar,{onVisibleSceneTreeColumnsChange:r})]})})};function useMetadataActions(){const e=useActionCallback((({snapshot:e,set:t})=>async n=>{const a=undefined;if(await e.getPromise(Ka(n)))return;t(Ka(n),!0);const i=await e.getPromise(Fa(n));if(null!=(null==i?void 0:i.metadata)){const e=[...i.metadata];t(Wa(n),(t=>[...t,...e]))}const l=null==i?void 0:i.cursor;t(Ua(n),l),t(Ka(n),!1)}));return{fetchInitialMetadata:useActionCallback((({snapshot:t})=>async n=>{const a=undefined;0===(await t.getPromise(Wa(n))).length&&await e(n)})),fetchNextMetadata:useActionCallback((()=>async t=>{await e(t)}))}}var Ei={exports:{}};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function defineProperties(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&defineProperties(e.prototype,t),n&&defineProperties(e,n),e}}(),a=A,i=_interopRequireDefault(a),l,o=_interopRequireDefault(ye);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectWithoutProperties(e,t){var n={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var r=function(e){function InfiniteScroll(e){_classCallCheck(this,InfiniteScroll);var t=_possibleConstructorReturn(this,(InfiniteScroll.__proto__||Object.getPrototypeOf(InfiniteScroll)).call(this,e));return t.scrollListener=t.scrollListener.bind(t),t.eventListenerOptions=t.eventListenerOptions.bind(t),t.mousewheelListener=t.mousewheelListener.bind(t),t}return _inherits(InfiniteScroll,e),n(InfiniteScroll,[{key:"componentDidMount",value:function componentDidMount(){this.pageLoaded=this.props.pageStart,this.options=this.eventListenerOptions(),this.attachScrollListener()}},{key:"componentDidUpdate",value:function componentDidUpdate(){if(this.props.isReverse&&this.loadMore){var e=this.getParentElement(this.scrollComponent);e.scrollTop=e.scrollHeight-this.beforeScrollHeight+this.beforeScrollTop,this.loadMore=!1}this.attachScrollListener()}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.detachScrollListener(),this.detachMousewheelListener()}},{key:"isPassiveSupported",value:function isPassiveSupported(){var e=!1,t={get passive(){e=!0}};try{document.addEventListener("test",null,t),document.removeEventListener("test",null,t)}catch(e){}return e}},{key:"eventListenerOptions",value:function eventListenerOptions(){var e=this.props.useCapture;return e=this.isPassiveSupported()?{useCapture:this.props.useCapture,passive:!0}:{passive:!1}}},{key:"setDefaultLoader",value:function setDefaultLoader(e){this.defaultLoader=e}},{key:"detachMousewheelListener",value:function detachMousewheelListener(){var e=window;!1===this.props.useWindow&&(e=this.scrollComponent.parentNode),e.removeEventListener("mousewheel",this.mousewheelListener,this.options?this.options:this.props.useCapture)}},{key:"detachScrollListener",value:function detachScrollListener(){var e=window;!1===this.props.useWindow&&(e=this.getParentElement(this.scrollComponent)),e.removeEventListener("scroll",this.scrollListener,this.options?this.options:this.props.useCapture),e.removeEventListener("resize",this.scrollListener,this.options?this.options:this.props.useCapture)}},{key:"getParentElement",value:function getParentElement(e){var t=this.props.getScrollParent&&this.props.getScrollParent();return null!=t?t:e&&e.parentNode}},{key:"filterProps",value:function filterProps(e){return e}},{key:"attachScrollListener",value:function attachScrollListener(){var e=this.getParentElement(this.scrollComponent);if(this.props.hasMore&&e){var t=window;!1===this.props.useWindow&&(t=e),t.addEventListener("mousewheel",this.mousewheelListener,this.options?this.options:this.props.useCapture),t.addEventListener("scroll",this.scrollListener,this.options?this.options:this.props.useCapture),t.addEventListener("resize",this.scrollListener,this.options?this.options:this.props.useCapture),this.props.initialLoad&&this.scrollListener()}}},{key:"mousewheelListener",value:function mousewheelListener(e){1!==e.deltaY||this.isPassiveSupported()||e.preventDefault()}},{key:"scrollListener",value:function scrollListener(){var e=this.scrollComponent,t=window,n=this.getParentElement(e),a=void 0;if(this.props.useWindow){var i=document.documentElement||document.body.parentNode||document.body,l=void 0!==t.pageYOffset?t.pageYOffset:i.scrollTop;a=this.props.isReverse?l:this.calculateOffset(e,l)}else a=this.props.isReverse?n.scrollTop:e.scrollHeight-n.scrollTop-n.clientHeight;a<Number(this.props.threshold)&&e&&null!==e.offsetParent&&(this.detachScrollListener(),this.beforeScrollHeight=n.scrollHeight,this.beforeScrollTop=n.scrollTop,"function"==typeof this.props.loadMore&&(this.props.loadMore(this.pageLoaded+=1),this.loadMore=!0))}},{key:"calculateOffset",value:function calculateOffset(e,t){return e?this.calculateTopPosition(e)+(e.offsetHeight-t-window.innerHeight):0}},{key:"calculateTopPosition",value:function calculateTopPosition(e){return e?e.offsetTop+this.calculateTopPosition(e.offsetParent):0}},{key:"render",value:function render(){var e=this,t=this.filterProps(this.props),n=t.children,a=t.element,l=t.hasMore;t.initialLoad;var o=t.isReverse,r=t.loader;t.loadMore,t.pageStart;var s=t.ref;t.threshold,t.useCapture,t.useWindow,t.getScrollParent;var c=_objectWithoutProperties(t,["children","element","hasMore","initialLoad","isReverse","loader","loadMore","pageStart","ref","threshold","useCapture","useWindow","getScrollParent"]);c.ref=function(t){e.scrollComponent=t,s&&s(t)};var d=[n];return l&&(r?o?d.unshift(r):d.push(r):this.defaultLoader&&(o?d.unshift(this.defaultLoader):d.push(this.defaultLoader))),i.default.createElement(a,c,d)}}]),InfiniteScroll}(a.Component);r.propTypes={children:o.default.node.isRequired,element:o.default.node,hasMore:o.default.bool,initialLoad:o.default.bool,isReverse:o.default.bool,loader:o.default.node,loadMore:o.default.func.isRequired,pageStart:o.default.number,ref:o.default.func,getScrollParent:o.default.func,threshold:o.default.number,useCapture:o.default.bool,useWindow:o.default.bool},r.defaultProps={element:"div",hasMore:!1,initialLoad:!0,pageStart:0,ref:null,threshold:250,useWindow:!0,isReverse:!1,useCapture:!1,loader:null,getScrollParent:null},t.default=r,e.exports=t.default}(Ei,Ei.exports);var Ii=Ei.exports;const CopyButton=({id:t,textToCopy:n,iconSize:a,disableTooltip:i,onCopyValue:l})=>{const[o,r]=A.useState(!1),s=undefined,c=useDebouncedCallback((()=>{r(!1)}),2e3);return e(_,{className:"h-fit self-center z-[16000]",content:o?"Copied to Clipboard":"Copy",placement:"bottom",disabled:i,children:e("div",{className:jt({"text-green-700":o}),children:e(V,{className:"ml-auto","data-testid":`${t}-copy-button`,iconName:o?"check":"copy",iconSize:null!=a?a:"xs",onClick:e=>{e.stopPropagation(),e.preventDefault(),null!=n&&(navigator.clipboard.writeText(n),null==l||l(n)),r(!0),c(!0)},style:{"--hover-box-shadow":"none"}})})})};function MetadataPropertyValue({value:n,onCopyMetadataValue:a}){const[i,l]=A.useState(!1),o=""!==n.replace(/^\s*$/,"").trim();return o?t("div",{className:"flex w-full border-b border-neutral-300 pl-1 pr-3","data-testid":`${n}-metadata-property`,onMouseEnter:()=>{l(!0)},onMouseLeave:()=>l(!1),children:[e(_,{className:"w-full shrink truncate pr-2 py-1.5",content:n,placement:"bottom-start",children:e("div",{className:"truncate",children:n})}),i&&e(CopyButton,{id:n,textToCopy:n,onCopyValue:a})]}):e("div",{className:jt("overflow-visible border-b border-neutral-300 pl-1 pr-4 py-1.5",{"text-neutral-500":!o}),children:"--"})}const MetadataPanelContents=({sceneItemId:a,onCopyMetadataValue:i})=>{const l=useMetadataActions(),o=p($a),s=r(Wa(a)),c=r(Ga(a)),d=r(Ka(a)),u=(null==s?void 0:s.length)>0;function getMessage(){if(!d&&0===(null==s?void 0:s.length)&&"hasValue"===o.state)return"This part does not contain properties"}return A.useEffect((()=>{null!=a&&l.fetchInitialMetadata(a)}),[a]),t(n,{children:[e(Ii,{initialLoad:!1,hasMore:c,loadMore:async()=>{c&&await l.fetchNextMetadata(a)},useWindow:!1,children:t("div",{className:"flex w-full text-xs leading-5 grow-0",children:[e(W,{className:"w-1/2 min-w-24 max-w-full shrink-0",horizontalDirection:"right",verticalDirection:"none",initialHorizontalScale:.5,parentSelector:"#metadata-panel-wrapper",horizontalSiblingSelector:"#metadata-value-column",children:e("div",{className:"flex flex-col w-full overflow-hidden whitespace-nowrap",children:s.map(((t,n)=>e(_,{className:"border-b border-neutral-300 pl-4 pr-1 py-1.5",content:t.key,placement:"bottom-start",children:e("div",{className:"truncate",children:t.key})},n)))})}),e("div",{id:"metadata-value-column",className:"flex flex-col w-full min-w-24",children:s.map(((t,n)=>e(MetadataPropertyValue,{value:t.value,onCopyMetadataValue:i},n)))})]})}),!u&&e("div",{className:"w-full h-full flex items-center justify-center px-4 text-center text-sm",children:getMessage()})]})},MetadataPanel=({onCopyMetadataValue:n})=>{const a=usePanelActions(),i=r(Sn),l=p($a);return t("div",{id:"metadata-panel-wrapper","data-testid":"metadata-panel-wrapper",className:"w-full h-full flex flex-col mt-auto text-neutral-800",children:[t("div",{className:"flex h-10 border-b border-neutral-300 p-3 pl-4 text-[0.875rem] items-center",children:["hasValue"===l.state&&e("span",{className:"flex flex-col w-full",children:e(_,{content:l.contents,children:e("div",{className:"truncate",children:l.contents||""})})}),"loading"===l.state&&e("div",{className:"flex items-center w-full h-full",children:e("div",{className:"w-1/2 h-1/2 bg-neutral-300 animate-pulse rounded"})}),e(B,{className:"ml-auto cursor-pointer",onClick:a.closeSecondary,name:"close",size:"sm"})]}),t("div",{className:"w-full h-full overflow-y-auto overflow-x-hidden",children:[null!=i&&e(MetadataPanelContents,{sceneItemId:i.id,onCopyMetadataValue:n}),null==i&&e("div",{className:"w-full h-full flex items-center justify-center px-4 text-center text-sm",children:"Please select a single part or assembly to view its metadata"})]})]})},SceneTreeSecondaryPanel=({panelId:t,onCopyMetadataValue:n})=>e(W,{"data-testid":"scene-tree-secondary-panel",className:"min-h-20 max-h-full flex-shrink-0 border-t border-neutral-300",horizontalDirection:"none",verticalDirection:"top",initializeWithOffset:!0,initialVerticalScale:.6,parentSelector:`#${t}`,verticalSiblingSelector:"#scene-tree-container",children:e(MetadataPanel,{onCopyMetadataValue:n})}),VertexSceneTreeCustomColumn=({label:n,rowDataBinding:a,expandToggle:i,visibilityToggle:l,isolateButton:o,initialWidth:s,minWidth:c})=>{const d=r(Ra);return A.useEffect((()=>{null==d||d.invalidateRows()}),[a]),t(ce,{"data-testid":`scene-tree-table-column-${n}`,initialWidth:s,minWidth:c,children:[e("template",{slot:"header",dangerouslySetInnerHTML:{__html:`\n <div class="text-sm text-neutral-800 my-2">\n <div class="${jt("truncate",{"pl-2":i,"pr-2":l})}">\n ${n}\n </div>\n </div>\n `}}),e("template",{dangerouslySetInnerHTML:{__html:`\n <vertex-scene-tree-table-cell\n prop:value="${a}"\n prop:selection-handler="{{row.data.handleSelection}}"\n prop:expansion-handler="{{row.data.handleExpansion}}"\n prop:visibility-handler="{{row.data.handleVisibility}}"\n ${i?"expand-toggle":""}\n ${l?"visibility-toggle":""}\n ${o?"isolate-button":""}\n >\n <div class="flex items-center gap-2">\n <vertex-tooltip \n class="truncate" \n prop:content="${null!=a?a:"--"}" \n placement="${l?"right":"top"}">\n <div class="flex items-center w-full">\n <div class="truncate">${a}</div>\n </div>\n </vertex-tooltip>\n </div>\n\n <div slot="placeholder" class="flex items-center w-full truncate">\n <div> -- </div>\n </div>\n </vertex-scene-tree-table-cell>\n `}})]},n)},VertexSceneTreeMetadataColumns=({children:t})=>{const a=r(ci),i=r(di),l=[],o=i.filter((e=>e!==ai.label)).map((e=>a[e]));return e(n,null!=t?{children:t({columns:o.map((e=>({key:e.label,initialWidth:e.initialWidth,minWidth:e.minWidth})))})}:{children:o.map(((t,n)=>{var a;const i=null!==(a=l[n])&&void 0!==a?a:t.initialWidth;return e(VertexSceneTreeCustomColumn,{label:t.label,visibilityToggle:n===o.length-1,isolateButton:n===o.length-1,rowDataBinding:t.binding,initialWidth:i,minWidth:t.minWidth},t.label)}))})},VertexSceneTreeTableLayout=n=>{var a,i;const{children:l}=n,o=__rest(n,["children"]),s=r(ci),c=r(di),d=[],u=A.useMemo((()=>findChildElement(l,NameColumn)),[l]),m=A.useMemo((()=>findChildElement(l,MetadataColumns)),[l]),p=null!==(a=s[ai.label])&&void 0!==a?a:ai,h=c.filter((e=>e!==ai.label)).map((e=>s[e]));return t(de,Object.assign({"data-testid":"scene-tree-table-layout"},o,{children:[u?cloneChildNodeOrFunction(u.props.children,{columnCount:c.length,initialWidth:p.initialWidth,minWidth:p.minWidth}):e(VertexSceneTreeCustomColumn,{expandToggle:!0,visibilityToggle:1===c.length,isolateButton:1===c.length,rowDataBinding:p.binding,label:p.label,initialWidth:null!==(i=d[0])&&void 0!==i?i:p.initialWidth,minWidth:p.minWidth}),null!=m?cloneChildNodeOrFunction(m.props.children,{columns:h.map((e=>({key:e.label,initialWidth:e.initialWidth,minWidth:e.minWidth})))}):e(VertexSceneTreeMetadataColumns,{})]}))},NameColumn=({children:t})=>e(n,{children:t}),MetadataColumns=({children:t})=>e(n,{children:t});VertexSceneTreeTableLayout.NameColumn=NameColumn,VertexSceneTreeTableLayout.MetadataColumns=MetadataColumns;const VertexSceneTree=n=>{var{id:a,font:i,backgroundColors:l,additionalLoadedMetadataProperties:o,whitelistedMetadataProperties:s,allowViewingMetadataPropertiesPanel:d,children:u,style:m,onPointerDown:p,onClick:h,onToggleSelection:f,onToggleExpansion:g,onToggleVisibility:v,onCopyMetadataValue:b,className:C,rowData:w}=n,S=__rest(n,["id","font","backgroundColors","additionalLoadedMetadataProperties","whitelistedMetadataProperties","allowViewingMetadataPropertiesPanel","children","style","onPointerDown","onClick","onToggleSelection","onToggleExpansion","onToggleVisibility","onCopyMetadataValue","className","rowData"]);const T=useSceneTreeActions(),k=useSelectionActions(),P=r(ti),E=r(Ze),I=r(_a),O=r(ki),N=r(wi),M=r(yi),_=r(bi),V=r(vi),L=null==V||""===V,R=useRecoilRef({state:Ra}),j=A.useMemo((()=>findChildElement(u,Header)),[u]),D=A.useMemo((()=>findChildElement(u,TableLayout)),[u]),B=A.useMemo((()=>findChildElement(u,ContextMenu)),[u]),wrappedExpansionHandler=(e,t,n)=>{T.toggleExpansion(e,t,n),null==g||g(e,t,n)},wrappedSelectionHandler=(e,t,n)=>{T.toggleSelection(e,t,n),null==f||f(e,t,n)},wrappedVisibilityHandler=(e,t,n)=>{T.toggleVisibility(e,t,n),null==v||v(e,t,n)},handleClick=async e=>{e.altKey&&await T.flyToRow(e.clientY),null==h||h(e)},handlePointerDown=async e=>{targetIsElement(e.target,"VERTEX-SCENE-TREE-TABLE-COLUMN")&&await k.clearSelection(),null==p||p(e)},H=c(ja),handleFirstRowRendered=e=>{var t;H(e.target.controller),null===(t=null==S?void 0:S.onFirstRowRendered)||void 0===t||t.call(S,e)},F=A.useMemo((()=>({metadataSearchKeys:N,exactMatch:M,removeHiddenItems:_})),[N,M,_]);return useStateSyncedValue(li,s,{transform:e=>e.sort(((e,t)=>e.localeCompare(t)))}),useStateSyncedValue(Ha,d),useStateSyncedValue(Ai,o),t("div",{id:"scene-tree-panel",className:"flex flex-col w-full h-full grow-0",children:[e("div",{id:"scene-tree-container",className:"flex group h-full min-h-32 overflow-auto",children:t(ue,Object.assign({id:null!=a?a:"vertex-scene-tree","data-testid":"vertex-scene-tree",config:P,ref:R,className:jt("flex-1",{filtered:!L}),style:Object.assign(Object.assign(Object.assign({},styleFromOptionalFont(i)),styleFromOptionalBackgroundColors(l)),m),onConnectionError:e=>{logger_error("Scene Tree Connection Error: ",e.detail)},viewer:E,onPointerDown:handlePointerDown,onClick:handleClick,rowData:e=>{var t;const n=null!==(t=null==w?void 0:w(e))&&void 0!==t?t:{};return Object.assign({handleExpansion:wrappedExpansionHandler,handleSelection:wrappedSelectionHandler,handleVisibility:wrappedVisibilityHandler},n)},searchOptions:F,metadataKeys:O},S,{onFirstRowRendered:handleFirstRowRendered,children:[null!=j?j:e(VertexSceneTreeHeader,{}),null!=D?D:e(VertexSceneTreeTableLayout,{}),null!=B?B:e(VertexSceneTreeContextMenu,{})]}))}),void 0!==I&&e(SceneTreeSecondaryPanel,{panelId:"scene-tree-panel",onCopyMetadataValue:b})]})},Header=({children:t})=>e(n,{children:t}),TableLayout=({children:t})=>e(n,{children:t}),ContextMenu=({children:t})=>e(n,{children:t});VertexSceneTree.Header=Header,VertexSceneTree.TableLayout=TableLayout,VertexSceneTree.ContextMenu=ContextMenu;const VertexDecimalPlaceSelector=({onApply:n})=>{const[a,i]=s(Rn);return t(Z,{"data-testid":"decimal-place-select",className:"w-24",value:a,onOptionChanged:e=>{i(e.detail),null==n||n(e.detail)},children:[e("div",{className:"py-1.5 px-3",children:"0"}),e("div",{className:"py-1.5 px-3",children:"1"}),e("div",{className:"py-1.5 px-3",children:"2"}),e("div",{className:"py-1.5 px-3",children:"3"})]})},VertexLengthUnitSelector=({onApply:n})=>{const[a,i]=s(Ln);return t(Z,{"data-testid":"length-unit-select",className:"w-40",value:a,onOptionChanged:e=>{i(e.detail),null==n||n(e.detail)},children:[e("div",{"data-value":"cm",className:"py-1.5 px-3",children:"centimeters"}),e("div",{"data-value":"mm",className:"py-1.5 px-3",children:"millimeters"}),e("div",{"data-value":"m",className:"py-1.5 px-3",children:"meters"}),e("div",{"data-value":"in",className:"py-1.5 px-3",children:"inches"}),e("div",{"data-value":"ft",className:"py-1.5 px-3",children:"feet"})]})};function VertexUnitsControls({onUnitChange:a,onDecimalPlaceChange:i}){return t(n,{children:[t("div",{children:[e("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Length Unit"}),e(VertexLengthUnitSelector,{onApply:a})]}),t("div",{children:[e("div",{className:"pt-2 pb-2 text-sm text-neutral-700",children:"Decimals"}),e(VertexDecimalPlaceSelector,{onApply:i})]})]})}function VertexUnitsPanelSection({onUnitChange:t,onDecimalPlaceChange:n}){return e(PanelSection,{header:e("div",{className:"flex items-center text-base",children:"Units"}),children:e(VertexUnitsControls,{onUnitChange:t,onDecimalPlaceChange:n})})}function ColorSwatchContextMenu({onRemoveCustomColor:n}){const a=useContextMenuActions(),i=useSceneItemMaterialActions(),l=r(Gt);return e(VertexContextMenu,{menuType:"color-swatch",onOpen:e=>{elementIsColorSwatch(e.target)&&a.setContextMenuItem(e.target)},openPredicate:e=>elementIsColorSwatch(e.target)&&elementHasColorAttribute(e.target),disableBackdrop:!0,children:e(F,{"data-testid":"color-swatch-delete",onClick:async()=>{if(contextMenuItemIsElement(l)&&elementIsColorSwatch(l)){const e=null==l?void 0:l.getAttribute("data-color-id");null!=e&&"true"===l.getAttribute("data-custom-color")?(await i.removeCustomColor(e),null==n||n(e)):null!=e&&"true"===l.getAttribute("data-recent-color")&&await i.removeRecentColor(e)}},children:t("div",{className:"flex align-middle gap-2.5",children:[e(B,{slot:"icon",name:"delete",size:"sm"}),"Delete"]})})})}function DefaultAppearancePanel(){return t("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:[e(VertexMaterialPanelSection,{}),e(VertexGhostingPanelSection,{}),e(VertexFeatureEdgesPanelSection,{}),e(VertexViewerBackgroundPanelSection,{}),e(VertexSelectionHighlightingPanelSection,{}),e(VertexCrossSectionAppearancePanelSection,{}),e(ColorSwatchContextMenu,{})]})}function DefaultSettingsPanel(){return e("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e(VertexUnitsPanelSection,{})})}const VertexTransformClear=({onClear:n,onClearAll:a})=>{const i=useTransformActions(),l=useCacheableLoadable(_n),o=r(Pn),s=useCacheableLoadable(qn(null!=o?o:"")),c=A.useMemo((()=>{var e;const t=null===(e=l.data)||void 0===e?void 0:e.some((e=>{var t;return null!=(null===(t=null==e?void 0:e.override)||void 0===t?void 0:t.transform)})),n=null!=s.data;return t||n}),[l,s]);return e("div",{className:"ml-auto",children:t(ResetButton,{id:"transforms",tooltip:"Clear Transforms",children:[e("div",{className:"pt-1"}),e(F,{"data-testid":"clear-selected-transforms",onClick:async()=>{await i.clearSelectedTransforms(),null==n||n()},disabled:!c,children:"Clear selected transforms"}),e(F,{"data-testid":"clear-all-transforms",onClick:async()=>{await i.clearAllTransforms(),null==a||a()},children:"Clear all transforms"})]})})},VertexTransformNumericField=({bottomLabel:n,value:a,step:i,min:l,max:o,disabled:s,testId:c,onBlur:d,onInput:u,onChange:m})=>{const p=A.useRef(null),h=r(Rn),[f,g]=A.useState(!0);A.useEffect((()=>{var e;const t=null!=p.current&&Number.isNaN(p.current.valueAsNumber),n=f||t;null!=p.current&&n?p.current.value=null!==(e=null==a?void 0:a.toFixed(Number(h)))&&void 0!==e?e:"":g(!0)}),[a]);const v=A.useCallback((e=>{g(!1),null==m||m(e)}),[g,m]),b=A.useCallback((e=>{g(!0),null==d||d(e),null!=p.current&&null!=a&&(p.current.value=a.toFixed(Number(h)))}),[d,a,g]);return t("div",{children:[e("div",{className:"truncate rounded-md w-full",children:e("input",{ref:p,className:"w-full truncate border border-neutral-400 rounded-md px-2 py-1.5 hover:border-neutral-500 focus:border-neutral-500 focus:outline-none",type:"number",step:i,min:l,max:o,"data-testid":c,disabled:s,defaultValue:Number.isNaN(a)?"":null==a?void 0:a.toFixed(Number(h)),onBlur:b,onInput:u,onChange:v})}),null!=n&&e("div",{className:"flex justify-center items-center pointer-events-none text-neutral-500",children:e("span",{children:n})})]})},VertexTransformInputs=({onUpdateTransform:n})=>{const a=r(Ln),i=r(An),l=r(Tn),o=i||l,s=r(Pn),{transform:c,error:d,update:u}=useEditItemTransform(s),m=o?void 0:c,p=useDebouncedCallback((async e=>{await u(e),null==n||n(e)}),50);function updateTransform(e){return t=>{if(null!=m){const n=parseFloat(t.currentTarget.value);Number.isNaN(n)||null==p||p(Object.assign(Object.assign({},m),e(n,m)))}}}function updatePosition(e){return updateTransform(((t,n)=>({position:Object.assign(Object.assign({},n.position),e(t))})))}function updateRotation(e){return updateTransform(((t,n)=>({rotation:Object.assign(Object.assign({},n.rotation),e(t))})))}function updateScale(){return updateTransform((e=>e>0?{scale:e}:{}))}function updateToDefaultValueIfInvalid(e,t){return n=>{const a=parseFloat(n.currentTarget.value),i=undefined;(isNaN(a)||!!(null==t?void 0:t(a)))&&null!=m&&p(ke.defaults(e,m))}}return t("div",{children:[t("div",{className:"mb-2 text-[0.8125rem]",children:[e("span",{className:"flex w-full items-center mt-3 mb-1",children:"Position"}),t("div",{className:"flex flex-wrap w-full gap-2",children:[t("div",{className:"flex gap-2",children:[e("span",{className:"pt-2",children:"X"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"position-x",value:null!=m?m.position.x:void 0,bottomLabel:a,disabled:null==m,onChange:updatePosition((e=>({x:e}))),onBlur:updateToDefaultValueIfInvalid({position:{x:0}})})})]}),t("div",{className:"flex gap-2",children:[e("span",{className:"pt-2",children:"Y"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"position-y",value:null==m?void 0:m.position.y,bottomLabel:a,disabled:null==m,onChange:updatePosition((e=>({y:e}))),onBlur:updateToDefaultValueIfInvalid({position:{y:0}})})})]}),t("div",{className:"flex gap-2",children:[e("span",{className:"pt-2",children:"Z"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"position-z",value:null==m?void 0:m.position.z,bottomLabel:a,disabled:null==m,onChange:updatePosition((e=>({z:e}))),onBlur:updateToDefaultValueIfInvalid({position:{z:0}})})})]})]})]}),t("div",{className:"mb-2 text-[0.8125rem]",children:[e("span",{className:"flex w-full items-center mt-3 mb-1",children:"Rotation"}),t("div",{className:"flex flex-wrap w-full gap-2",children:[t("div",{className:"flex gap-2",children:[e("span",{className:"pt-2",children:"X"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"rotation-x",value:null==m?void 0:m.rotation.x,bottomLabel:"deg",disabled:null==m,onChange:updateRotation((e=>({x:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{x:0}})})})]}),t("div",{className:"flex gap-2",children:[e("span",{className:"pt-2",children:"Y"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"rotation-y",value:null==m?void 0:m.rotation.y,bottomLabel:"deg",disabled:null==m,onChange:updateRotation((e=>({y:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{y:0}})})})]}),t("div",{className:"flex gap-2",children:[e("span",{className:"pt-2",children:"Z"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"rotation-z",value:null==m?void 0:m.rotation.z,bottomLabel:"deg",disabled:null==m,onChange:updateRotation((e=>({z:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{z:0}})})})]})]})]}),t("div",{className:"mb-2 text-[0.8125rem]",children:[e("span",{className:"flex w-full items-center mt-3 mb-1",children:"Scale"}),e("div",{className:"w-26",children:e(VertexTransformNumericField,{testId:"scale",value:null==m?void 0:m.scale,step:.1,min:.1,disabled:null==m,onChange:updateScale(),onBlur:updateToDefaultValueIfInvalid({scale:1},(e=>e<=0))})}),o&&e("div",{className:"bg-orange-100 rounded px-3 py-2 mt-6 mb-2",children:"Input based part transformation is not yet supported for multiple parts."}),null!=d&&e("div",{className:"bg-red-100 rounded px-3 py-2 mt-6 mb-2",children:"There was a problem retrieving data. Try selecting a different part."})]})]})},VertexTransformManipulatorToggle=({onToggleTransformsManipulator:t})=>{const n=useTransformActions(),a=r(Hn),i=c(Xn);return e(R,{className:"flex items-center","data-testid":"transform-widget-toggle",variant:"switch",checked:a,onValueChanged:async()=>{a?(n.disableTransformWidget(),null==t||t(!1)):(i("world"),await n.enableTransformWidget(),null==t||t(!0))}})};function VertexTransformControls({onToggleTransformsManipulator:a,onUpdateTransform:i}){return t(n,{children:[t("div",{className:"flex items-center py-3",children:[e(VertexTransformManipulatorToggle,{onToggleTransformsManipulator:a}),e("span",{className:"pl-4 text-[0.8125rem] text-neutral-700",children:"Enable manipulator"})]}),e(VertexTransformInputs,{onUpdateTransform:i})]})}function VertexTransformPanelSection({onClearTransforms:n,onClearAllTransforms:a,onToggleTransformsManipulator:i,onUpdateTransform:l}){return e(PanelSection,{header:t("div",{className:"flex items-center text-base",children:["Manual Part Transforms",e(VertexTransformClear,{onClear:n,onClearAll:a})]}),children:e(VertexTransformControls,{onToggleTransformsManipulator:i,onUpdateTransform:l})})}function DefaultTransformsPanel(){return e("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e(VertexTransformPanelSection,{})})}const Oi="Appearance",Ni="Settings",Mi="Transforms",ViewerRightPanelHeader=({additionalHeaderMap:t})=>{const n=undefined,a=getHeading(r(Ma),t);return e("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("div",{className:"items-center w-full leading-6 text-md align-center font-medium text-neutral-800",children:a})})};function getHeading(e,t={}){switch(e){case"appearance":return Oi;case"settings":return Ni;case"transforms":return Mi;default:const n=null!=e?t[e]:void 0;return null!=n?n:"None"}}function VertexViewerRightOpenedPanel({children:a}){const i=r(Ma),l=A.useMemo((()=>filterChildElements(a,CustomPanelContent)),[a]),o=A.useMemo((()=>l.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.props.panelName]:t.props.panelTitle})),{})),[l]),s=A.useMemo((()=>["appearance","settings","transforms",...l.map((e=>e.props.panelName))]),[l]);return e(n,{children:null!=i&&s.includes(i)&&t(VertexResizableContent,{displayShadow:!0,heading:e(ViewerRightPanelHeader,{additionalHeaderMap:o}),placement:"right",children:["appearance"===i&&e(DefaultAppearancePanel,{}),"transforms"===i&&e(DefaultTransformsPanel,{}),"settings"===i&&e(DefaultSettingsPanel,{}),a]})})}function CustomPanelContent({panelName:t,children:a}){const i=r(Ma);return e(n,{children:i===t&&a})}function Sidebar({children:t}){return e("div",{className:"pointer-events-auto flex flex-col items-center w-full border-neutral-300 py-2",children:t})}function SidebarIcon({name:n,iconName:a,active:i,responsive:l,disabled:o,content:r,tooltipPlacement:s,children:c,onSelect:d,onDeselect:u}){return e("div",{className:jt({"text-[var(--vertex-ui-blue-700)]":i===n&&!o,"text-neutral-700 hover:text-neutral-800":i!==n&&!o,"cursor-pointer hover:bg-neutral-200":!o,"text-neutral-400":o,"rounded-full md:p-3":l,"p-3":!l&&null==c,"px-3 py-1":null!=c}),"data-testid":`${n}-sidebar-panel`,onClick:()=>{o||(i===n?u():d())},children:t(_,{placement:null!=s?s:void 0,content:A.isValidElement(r)?void 0:r,children:[e("div",{slot:"content",children:r}),e("div",{className:"flex flex-col",children:null!=c?c:e(B,{name:a})})]})})}function VertexViewerRightSidebar({children:n}){const a=usePanelActions(),i=useTransformActions(),l=r(Ma);return e("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:t(Sidebar,{children:[n,e(SidebarIcon,{name:"appearance",active:l,iconName:"adjustments",tooltipPlacement:"right",content:"Appearance",onSelect:()=>{a.openPrimary("appearance","right")},onDeselect:()=>a.closePrimary("right")}),e(SidebarIcon,{name:"transforms",active:l,iconName:"show-only-nearby",tooltipPlacement:"right",content:"Transforms",onSelect:async()=>{a.openPrimary("transforms","right"),await i.enableTransformWidget(void 0,!0)},onDeselect:()=>a.closePrimary("right")}),e(SidebarIcon,{name:"settings",active:l,iconName:"gear",tooltipPlacement:"right",content:"Settings",onSelect:()=>{a.openPrimary("settings","right")},onDeselect:()=>a.closePrimary("right")})]})})}function CustomPanelIcon(t){const n=usePanelActions(),a=r(Ma),{panelName:i,tooltipContent:l,iconName:o}=t,s=__rest(t,["panelName","tooltipContent","iconName"]);if(null==o&&null==s.children)throw new Error('CustomPanelIcon must contain either a Vertex "iconName" or custom "children"');return e(SidebarIcon,Object.assign({},s,{name:i,iconName:null!=o?o:"help",active:a,content:l,onSelect:()=>{n.openPrimary(t.panelName,"right")},onDeselect:()=>{n.closePrimary("right")}}))}VertexViewerRightOpenedPanel.CustomPanelContent=CustomPanelContent,VertexViewerRightSidebar.CustomPanelIcon=CustomPanelIcon;const VertexPopupButton=a=>{var{open:i,children:l}=a,o=__rest(a,["open","children"]);const r=l.find((e=>e.type===Anchor)),s=l.filter((e=>e.type!==Anchor));return null==r?e(n,{}):t(Y,Object.assign({className:"flex",placement:"top",backdrop:!1,open:asBooleanAttribute(i)},o,{children:[r,e("div",{className:jt("flex mb-1.5",{hidden:!i}),"data-testid":"align-plane-popover-menu",children:s})]}))},Anchor=({tooltipContent:t,children:n})=>e("div",{slot:"anchor",children:e(_,{className:"cursor-pointer",content:t,children:n})});function VertexViewerCrossSectionAlignmentPopoverMenu({disabled:n}){const a=useCrossSectioningActions(),i=r(Tt),l=r(ft),getBaseIcon=()=>`align-to-${null==l?void 0:l.mode}`;return useStackKeyBinding({id:"CrossSectionAlignment",keyBind:"Escape",fn:a.cancelCurrentHit,addPredicate:()=>{var e;return null!==(e=null==l?void 0:l.hitPending)&&void 0!==e&&e},cancelPredicate:()=>!(null==l?void 0:l.hitPending)},[null==l?void 0:l.hitPending]),t(VertexPopupButton,{"data-testid":"section-alignment-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(i),onDismissed:a.closeAlignmentTools,children:[e(VertexPopupButton.Anchor,{tooltipContent:"Section Alignment",children:e(V,{"data-testid":"section-alignment-icon-button",iconName:getBaseIcon(),iconColor:"secondary",onClick:i?a.closeAlignmentTools:a.openAlignmentTools,disabled:n,children:e(B,{"data-testid":"section-alignment-icon-chevron",name:"chevron-up",size:"sm"})})}),t(me,{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(V,{iconColor:"secondary",onClick:()=>a.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("div",{className:"text-base ml-2",children:"Align to Global"})}),e(V,{iconColor:"secondary",onClick:()=>a.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("div",{className:"text-base ml-2",children:"Align to Surface"})})]})]})}function VertexViewerCrossSectionAxisPopoverMenu({disabled:n}){const a=useCrossSectioningActions(),i=r(At),l=r(ht),o=p(bt),s=A.useMemo((()=>{const e=l.length>0&&"hasValue"===o.state?axis(l[0],xAxis(o.contents),yAxis(o.contents),zAxis(o.contents)):"x";return null!=e?`axis-${e}`:"axis-x"}),[o.state,o.contents,l]);return t(VertexPopupButton,{"data-testid":"align-plane-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(i),onDismissed:a.closeAxisTools,children:[e(VertexPopupButton.Anchor,{tooltipContent:"Align Plane",children:e(V,{onClick:i?a.closeAxisTools:a.openAxisTools,iconName:s,"data-testid":"align-plane-icon",iconColor:"secondary",disabled:n,children:e(B,{"data-testid":"align-plane-icon-chevron",name:"chevron-up",size:"sm"})})}),t(me,{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(V,{"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:()=>a.updateAxis("x"),variant:"plain",iconColor:"secondary",iconName:"axis-x",children:e("div",{className:"text-base ml-2",children:"X-axis Plane"})}),e(V,{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:()=>a.updateAxis("y"),children:e("div",{className:"text-base ml-2",children:"Y-axis Plane"})}),e(V,{"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:()=>a.updateAxis("z"),variant:"plain",iconColor:"secondary",iconName:"axis-z",children:e("div",{className:"text-base ml-2",children:"Z-axis Plane"})})]})]})}function VertexViewerCrossSectionOffsetStepper({offset:n,disabled:a,onOffsetChange:i}){const l=r(Ln),o=r(Rn),[s,c]=A.useState(convertTo(n,l));A.useEffect((()=>{c(convertTo(n,l))}),[l,n]);const d=createDistanceFormatter(l,parseInt(o,10)),handleIncrementalUpdate=e=>{const t=convertFrom(s+e,l);i(t)},u=undefined,handleBlur=()=>{i(convertFrom(s,l))};return e(_,{content:"Plane Offset",children:e("form",{"data-testid":"cross-section-stepper-form",onSubmit:e=>{e.preventDefault(),i(convertFrom(s,l))},children:t(X,{"data-testid":"cross-section-stepper-input",className:"viewer-toolbar-input w-32 border-none ring-0 bg-white",type:"text",value:d(parseFloat(n.toFixed(3))),onInputInput:e=>{c(null!=e.detail.value?parseFloat(e.detail.value):n)},onBlur:handleBlur,disabled:a,children:[e("div",{"data-testid":"cross-section-stepper-decrement",className:"py-1 cursor-pointer",slot:"left",onClick:()=>{a||handleIncrementalUpdate(-1)},children:e(B,{name:"chevron-left",size:"sm"})}),e("div",{"data-testid":"cross-section-stepper-increment",className:"py-1 cursor-pointer",slot:"right",onClick:()=>{a||handleIncrementalUpdate(1)},children:e(B,{name:"chevron-right",size:"sm"})})]})})})}VertexPopupButton.Anchor=Anchor;const _i=400;function VertexViewerCrossSectionPopupMenu(){const n=useCrossSectioningActions(),a=r(xt),i=p(wt),l=p(St),o=A.useRef(),s=A.useMemo((()=>"hasValue"===i.state&&Number.isFinite(i.contents.max)&&Number.isFinite(i.contents.min)),[i.state,i.contents]),c=A.useMemo((()=>"hasValue"===i.state?i.contents:dt),[i.state,i.contents]),d=A.useMemo((()=>"hasValue"===l.state&&Number.isFinite(l.contents)?l.contents:0),[l.state,l.contents]),handleCrossSectionValueChange=e=>{clearTimeout(o.current),o.current=window.setTimeout((()=>{n.endInteraction()}),_i),n.beginInteraction(),n.updatePlanes(e)};return t(VertexPopupButton,{"data-testid":"cross-section-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(a),onDismissed:n.closeAdditionalTools,children:[e(VertexPopupButton.Anchor,{tooltipContent:"Section Tools",children:e("div",{className:"-ml-px py-1.5",children:e(B,{"data-testid":"cross-section-popover-icon",name:"chevron-up",size:"sm",onClick:a?n.closeAdditionalTools:n.openAdditionalTools})})}),t(me,{className:"relative bottom-3 flex justify-evenly items-center p-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e(VertexViewerCrossSectionAlignmentPopoverMenu,{disabled:!s}),e(_,{className:"w-auto",content:"Reverse",children:e(V,{iconName:"flip","data-testid":"viewer-toolbar-flip-button",onClick:n.flipPlanes,iconColor:"secondary",disabled:!s})}),e(_,{className:"w-auto",content:"Align View to Plane",children:e(V,{"data-testid":"viewer-toolbar-align-view-to-plane-button",iconName:"align-view-to-plane",onClick:n.alignViewToPlane,iconColor:"secondary",disabled:!s})}),e(VertexToolbarDivider,{}),e(VertexViewerCrossSectionAxisPopoverMenu,{disabled:!s}),e("div",{className:"w-52 mx-2",children:e(VertexSlider,{value:d,defaultValue:c.default,disabled:asBooleanAttribute("hasValue"!==i.state)||!s,min:c.min,max:c.max,step:.01,onChange:handleCrossSectionValueChange})}),e("div",{className:"px-4",children:e(VertexViewerCrossSectionOffsetStepper,{offset:"hasValue"===l.state&&s?l.contents:0,disabled:!s,onOffsetChange:handleCrossSectionValueChange})})]})]})}const VertexViewerCrossSectionButton=()=>{const a=useCrossSectioningActions(),i=r(ut);return t(n,{children:[e(_,{content:i?"Hide Section":"Show Section",children:e(V,{"data-testid":"viewer-toolbar-cross-section-button",iconName:"cross-section",iconColor:i?"primary":"secondary",onClick:()=>i?a.disable():a.enable()})}),e(VertexViewerCrossSectionPopupMenu,{})]})},VertexFitAllButton=()=>{const t=r(Ze);return e(_,{content:"Fit All",children:e(V,{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=r(Ze),n=r(Qe),[a,i]=s(tt),[l,o]=s(et);return A.useEffect((()=>{null!=t&&n&&o(t.getBaseInteractionHandler())}),[t,n,o]),e(_,{content:"Pan",children:e(V,{iconName:"pan",iconColor:"pan"===a?"primary":"secondary","data-testid":"viewer-toolbar-pan-button",onClick:async()=>{if(i("pan"),null!=l){const e=await l;null==e||e.setPrimaryInteractionType("pan")}}})})},VertexRotateButton=()=>{const t=r(Ze),n=r(Qe),[a,i]=s(tt),[l,o]=s(et);return A.useEffect((()=>{null!=t&&n&&o(t.getBaseInteractionHandler())}),[t,n,o]),e(_,{content:"Rotate",children:e(V,{iconName:"rotate",iconColor:"rotate"===a?"primary":"secondary","data-testid":"viewer-toolbar-rotate-button",onClick:async()=>{if(i("rotate"),null!=l){const e=await l;null==e||e.setPrimaryInteractionType("rotate")}}})})},VertexZoomButton=()=>{const t=r(Ze),n=r(Qe),[a,i]=s(tt),[l,o]=s(et);return A.useEffect((()=>{null!=t&&n&&o(t.getBaseInteractionHandler())}),[t,n,o]),e(_,{content:"Zoom",children:e(V,{iconName:"zoom",iconColor:"zoom"===a?"primary":"secondary","data-testid":"viewer-toolbar-zoom-button",onClick:async()=>{if(i("zoom"),null!=l){const e=await l;null==e||e.setPrimaryInteractionType("zoom")}}})})},DefaultToolbar=()=>e(pe,{placement:"bottom-center",children:t(me,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:[e(VertexRotateButton,{}),e(VertexPanButton,{}),e(VertexZoomButton,{}),e(VertexFitAllButton,{}),e(VertexToolbarDivider,{}),e(VertexBoxSelectionButton,{}),e(VertexToolbarDivider,{}),e(VertexViewerCrossSectionButton,{}),e(VertexToolbarDivider,{}),e(VertexPointToPointMeasurementTool,{}),e(VertexPreciseMeasurementTool,{})]})}),VertexToolbar=({children:t})=>{const n=undefined;return e(pe,{placement:"bottom-center",children:null!=t&&!1!==t?e(me,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:t}):e(DefaultToolbar,{})})};function VertexTransformWidget({transformWidgetElement:t,supportUndo:a,onPositionChange:i,onRotationChange:l}){const o=useTransformActions(),s=r(Kn),c=r(Hn),d=r(Fn),u=r(Gn),m=p(Un),h=r(Ln),f=r(Rn),g=A.useMemo((()=>"hasValue"===m.state?m.contents:u),[m,u]),v=A.useMemo((()=>{const e=undefined;return c&&(null!=g||s)}),[c,g,s]);return e(n,{children:v&&e(he,{id:"transform-widget","data-testid":"viewer-transform-widget",ref:t,position:d,rotation:null!=d?g:void 0,decimalPlaces:parseInt(f,10),distanceUnit:toUnitType(h),EXPERIMENTAL_undoKeybindings:null==a||a,onInteractionStarted:()=>{o.disableSelectionSync(),o.setIsInteractivelyTransforming(!0)},onInteractionEnded:()=>{o.invalidateTransforms(),o.setIsInteractivelyTransforming(!1)},onPositionChanged:async e=>{await o.setTransformWidgetPosition(e.detail),null==i||i(e.detail)},onRotationChanged:e=>{o.setTransformWidgetOrientation(e.detail),null==l||l(e.detail)}})})}const VertexViewerSceneReset=({onReset:t})=>{const n=useCrossSectioningActions(),a=useSelectionActions(),i=useTransformActions(),l=useViewerSceneActions(),o=undefined;return e(_,{content:"Reset View",children:e(V,{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:async()=>{await n.disable(),await a.resetSelectionState(),i.clearTransformWidgetPosition(),await i.invalidateTransforms(),null==t||t(),await l.reset()},variant:"plain"})})};function useViewerFrameActions(){const e=useTransformActions();return{frameDrawn:useActionCallback((({set:t,snapshot:n})=>async a=>{const i=await n.getPromise(In);t(at,a.detail.scene),t(In,a.detail.scene.sceneViewSummary.selectedVisibleSummary),t(En,i);const l=undefined;await n.getPromise(Hn)&&await e.syncToSelection()}))}}const VertexBoxSelectionTool=()=>{const{element:t,callback:n}=useCallbackRef(),a=useBoxSelectionActions(),i=useTransformActions(),l=r(Xt);return T.useEffect((()=>{const e=whenComponentReady(t,(()=>{var e;return[null===(e=null==t?void 0:t.model)||void 0===e?void 0:e.onDragComplete((()=>{"clearAndSelect"===l&&(i.clearTransformWidgetOrientation(),i.clearTransformWidgetPosition(),i.enableSelectionSync())}))]}));return()=>{null==e||e.then((e=>{null==e||e.forEach((e=>null==e?void 0:e.dispose()))}))}}),[t,l]),useApplyKeyBinding({keyBind:"Shift",fn:T.useCallback((()=>a.setOperationType("select")),[]),off:T.useCallback((()=>a.setOperationType("clearAndSelect")),[])}),e(fe,{ref:n,"data-testid":"viewer-box-query-tool",operationType:l})};function VertexViewerCameraTypeMenu({open:n,onOpen:a,onDismiss:i,onCameraTypeChange:l}){const o=useViewerCameraActions(),s=r(Xe);return t(U,{"data-testid":"camera-types-popover",className:"flex",placement:"bottom-end",open:asBooleanAttribute(n),onMenuClosed:i,children:[e("div",{slot:"anchor",children:e("div",{className:jt("flex bg-white hover:opacity-100 hover:text-neutral-700 hover:bg-neutral-200 rounded",{"opacity-70 text-neutral-900":!n,"opacity-100 text-neutral-700 bg-neutral-200":n}),children:e(_,{content:"Change View",children:e(V,{"data-testid":"set-camera-mode-option",className:"p-1 cursor-pointer",variant:"plain",onClick:a,iconName:"orthographic"===s?"cube-orthographic":"cube-perspective",children:e(B,{"data-testid":"change-camera-type-icon-button",name:"chevron-down",size:"sm"})})})})}),t("div",{className:"w-36",children:[e("div",{className:"pt-1"}),t(F,{"data-testid":"set-perspective-view",onClick:()=>{o.updateCameraType("perspective",!0),null==l||l("perspective")},children:[e(B,{slot:"icon","data-testid":"set-perspective-view-icon",name:"cube-perspective",size:"sm",className:jt({"text-[var(--vertex-ui-blue-700)]":"perspective"===s})}),e("div",{className:jt("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"perspective"===s}),children:"Perspective"})]}),t(F,{"data-testid":"set-orthographic-view",onClick:()=>{o.updateCameraType("orthographic",!0),null==l||l("orthographic")},children:[e(B,{slot:"icon","data-testid":"set-orthographic-view-icon",name:"cube-orthographic",size:"sm",className:jt({"text-[var(--vertex-ui-blue-700)]":"orthographic"===s})}),e("div",{className:jt("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"orthographic"===s}),children:"Orthographic"})]})]})]})}const VertexViewerViewCube=n=>{var{placement:a,children:i}=n,l=__rest(n,["placement","children"]);const o=Array.isArray(i)?i:[i],r=o.filter((e=>!A.isValidElement(e)||e.type!==ge)).filter((e=>null!=e&&!1!==e)),s=o.find((e=>A.isValidElement(e)&&e.type===ge)),[c,d]=A.useState(!1);return t(pe,{direction:"vertical","data-testid":"view-cube-toolbar",placement:null!=a?a:"top-right",children:[null!=s?s:e(ge,Object.assign({className:"m-7"},l)),0===r.length?t("div",{className:"flex items-center justify-center mt-3 gap-1",children:[e(VertexViewerSceneReset,{}),e(VertexViewerCameraTypeMenu,{open:c,onDismiss:()=>d(!1),onOpen:()=>d(!0)})]}):e("div",{className:"mt-3",children:r})]})},VertexViewer=a=>{var{id:i,src:l,className:o,disableSelection:d,onTap:u,onLongpress:m,onFrameDrawn:p,onSceneReady:h,viewerRefCallback:f,children:g}=a,v=__rest(a,["id","src","className","disableSelection","onTap","onLongpress","onFrameDrawn","onSceneReady","viewerRefCallback","children"]);const b=r(ti),C=useRecoilRef({state:Ze}),w=useViewerCameraActions(),S=useCrossSectioningActions(),T=useHitActions(),k=useSelectionActions(),P=useViewerFrameActions(),E=r(Xe),I=r(ft),O=r(Yt),N=c(nt),[M,_]=s(Qe);A.useEffect((()=>{M&&(_(!1),S.disable())}),[l]);const[V,L]=s(Je);A.useEffect((()=>{null!=i&&L(i)}),[i]);const R=r(Xa),j=A.useMemo((()=>({opacity:R/100})),[R]),D=r(Bt),B=r(Ht),H=A.useMemo((()=>({color:D,width:B})),[D,B]),F=r(ka),W=r(Sa),U=r(xa),G=r(Ta),K=A.useMemo((()=>({color:W,opacity:U/100,lineWidth:G})),[W,U,G]),$=r(nn),q=null!=g&&!1!==g;return useKeyBindings(),useDefaultKeybindings(),t(ve,Object.assign({id:V,"data-testid":"vertex-viewer",src:l,ref:e=>{null==f||f(e),C(e)},className:jt("flex w-full h-full",o,{"cursor-crosshair":I.hitPending}),style:{"--viewer-background":F},config:b,cameraType:M?E:void 0,onCameraTypeChanged:e=>{M&&w.updateCameraType(e.detail,!1)},phantom:j,featureLines:H,selectionHighlighting:K,featureMaps:$?"final":void 0,onTap:e=>{const t=[...d?[]:[k.selectCurrentHit]];T.tap(e,...t),null==u||u(e)},onLongpress:e=>{T.longPress(e),null==m||m(e)},onFrameDrawn:e=>{P.frameDrawn(e),null==p||p(e)},onSceneReady:async e=>{var t;if(!M){_(!0);const n=await(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.scene());N(null==n?void 0:n.sceneViewId)}null==h||h(e)}},v,{children:[O&&e(VertexBoxSelectionTool,{}),q?g:t(n,{children:[e(VertexViewerViewCube,{}),e(VertexToolbar,{}),e(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 i=r(aa),l=r(la);return A.useEffect((()=>{null==t||t(i)}),[i,t]),A.useEffect((()=>{null==a||a(l)}),[l,a]),e(n,{})},VertexViewerToolkitRoot=a=>{var{override:i,autoDefineCustomElements:l,children:o,config:r}=a,s=__rest(a,["override","autoDefineCustomElements","children","config"]);return A.useEffect((()=>{(null==l||l)&&(Ce(),be())}),[l]),e(f,{override:i,children:t(n,{children:[e(VertexViewerToolkitEventListener,Object.assign({},s)),e(VertexViewerToolkitRootConfig,{config:r,children:o})]})})},VertexViewerToolkitRootConfig=({config:t,children:a})=>{const i=c(ti);return A.useEffect((()=>{const e=null!=t?toSdkConfig(t):void 0;i(e)}),[t,i]),e(n,{children:a})};var Vi=Object.freeze({__proto__:null,get AssemblyFontFace(){return Ti},Columns:hi,Core:Ba,Metadata:Pi,Search:xi});export{Pa as Appearance,Zt as BoxSelection,ni as Config,qt as ContextMenu,Vt as CrossSection,ei as Ghosting,ia as Hits,Oa as Keybinding,hn as Measurement,qe as Messages,qa as Metadata,Va as Panel,vn as Performance,Vi as SceneTree,Vn as SceneViewItem,oa as Selection,jn as Settings,na as Transforms,VertexApplicationMessages,VertexBoxSelectionButton,VertexContextMenu,VertexCrossSectionAppearanceColorPicker,VertexCrossSectionAppearanceControls,VertexCrossSectionAppearanceLineThicknessSlider,VertexCrossSectionAppearancePanelSection,VertexCrossSectionAppearanceReset,VertexDecimalPlaceSelector,VertexFeatureEdgesColorPicker,VertexFeatureEdgesControls,VertexFeatureEdgesPanelSection,VertexFeatureEdgesReset,VertexFeatureEdgesThicknessSlider,VertexFitAllButton,VertexFitSelectedMenuItem,VertexFlyToMenuItem,VertexGhostingControls,VertexGhostingPanelSection,VertexHideAllMenuItem,VertexHidePartMenuItem,VertexHideSelectedMenuItem,VertexLengthUnitSelector,VertexMaterialControls,VertexMaterialPanelSection,VertexMeasurementContextMenu,VertexMeasurementDetails,VertexPanButton,VertexPointToPointMeasurement,VertexPointToPointMeasurementTool,VertexPreciseMeasurement,VertexPreciseMeasurementTool,VertexResizableContent,VertexRotateButton,VertexSceneItemGhostingClear,VertexSceneItemGhostingOpacitySlider,VertexSceneItemGhostingToggle,VertexSceneItemMaterialClear,VertexSceneItemMaterialColorPicker,VertexSceneItemMaterialColorSwatches,VertexSceneItemMaterialOpacitySlider,VertexSceneTree,VertexSceneTreeColumnPopover,VertexSceneTreeContextMenu,VertexSceneTreeCustomColumn,VertexSceneTreeHeader,VertexSceneTreeMetadataColumns,VertexSceneTreeSearchBar,VertexSceneTreeSearchInformationForToolbar,VertexSceneTreeSearchOptionsPopover,VertexSceneTreeTableLayout,VertexSelectionHighlightingColorPicker,VertexSelectionHighlightingControls,VertexSelectionHighlightingLineThicknessSlider,VertexSelectionHighlightingOpacitySlider,VertexSelectionHighlightingPanelSection,VertexSelectionHighlightingReset,VertexShowAllMenuItem,VertexShowOnlyMenuItem,VertexShowOnlySelectedMenuItem,VertexShowPropertiesMenuItem,VertexToolbar,VertexToolbarDivider,VertexTransformClear,VertexTransformControls,VertexTransformInputs,VertexTransformManipulatorToggle,VertexTransformPanelSection,VertexTransformWidget,VertexUnitsControls,VertexUnitsPanelSection,VertexViewer,VertexViewerBackgroundColorPicker,VertexViewerBackgroundControls,VertexViewerBackgroundPanelSection,VertexViewerBackgroundReset,VertexViewerContextMenu,VertexViewerCrossSectionButton,VertexViewerRightOpenedPanel,VertexViewerRightSidebar,VertexViewerSceneReset,VertexViewerToolkitRoot,VertexViewerViewCube,VertexZoomButton,lt as Viewer};
7
19
  //# sourceMappingURL=bundle.esm.js.map