@vertexvis/viewer-toolkit-react 0.0.5-canary.8 → 0.0.5

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 (81) hide show
  1. package/dist/bundle.cjs.js +3 -3
  2. package/dist/bundle.cjs.js.map +1 -1
  3. package/dist/bundle.esm.js +3 -3
  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/toolbar/cross-section/cross-section-alignment-popover-menu.d.ts +5 -1
  32. package/dist/components/toolbar/cross-section/cross-section-axis-popover-menu.d.ts +5 -1
  33. package/dist/components/toolbar/cross-section/cross-section-offset-stepper.d.ts +2 -1
  34. package/dist/components/viewer/vertex-viewer.d.ts +1 -1
  35. package/dist/index.css +2 -2
  36. package/dist/index.d.ts +30 -9
  37. package/dist/state/appearance/actions.d.ts +6 -0
  38. package/dist/state/appearance/index.d.ts +2 -0
  39. package/dist/state/appearance/material.d.ts +3 -0
  40. package/dist/state/appearance/types.d.ts +2 -0
  41. package/dist/state/context-menu/actions.d.ts +2 -1
  42. package/dist/state/context-menu/context-menu.d.ts +1 -0
  43. package/dist/state/messages/messages.d.ts +1 -0
  44. package/dist/state/metadata/__tests__/actions.spec.d.ts +1 -0
  45. package/dist/state/metadata/actions.d.ts +6 -0
  46. package/dist/state/metadata/index.d.ts +2 -0
  47. package/dist/state/metadata/metadata.d.ts +13 -0
  48. package/dist/state/metadata/types.d.ts +7 -0
  49. package/dist/state/panel/actions.d.ts +3 -1
  50. package/dist/state/panel/panel.d.ts +2 -0
  51. package/dist/state/scene-tree/columns/columns.d.ts +1 -0
  52. package/dist/state/scene-tree/columns/index.d.ts +1 -1
  53. package/dist/state/scene-tree/columns/{open-column-popover.d.ts → open-positioned-popover.d.ts} +4 -5
  54. package/dist/state/scene-tree/core/actions.d.ts +3 -0
  55. package/dist/state/scene-tree/core/core.d.ts +3 -0
  56. package/dist/state/scene-tree/index.d.ts +5 -0
  57. package/dist/state/scene-tree/metadata/index.d.ts +1 -0
  58. package/dist/state/scene-tree/metadata/metadata.d.ts +2 -0
  59. package/dist/state/scene-tree/search/actions.d.ts +1 -0
  60. package/dist/state/scene-tree/search/search.d.ts +1 -0
  61. package/dist/state/scene-tree/types.d.ts +5 -0
  62. package/dist/state/viewer/camera/__tests__/actions.spec.d.ts +1 -0
  63. package/dist/state/viewer/camera/actions.d.ts +1 -1
  64. package/dist/state/viewer/scene/scene.d.ts +0 -2
  65. package/dist/testing/color-materials.d.ts +1 -0
  66. package/dist/util/popover/popover.d.ts +1 -0
  67. package/dist/util/react/children.d.ts +1 -0
  68. package/dist/util/state/synced-value.d.ts +5 -0
  69. package/package.json +10 -8
  70. package/dist/components/appearance/material-controls.d.ts +0 -7
  71. package/dist/components/appearance/material-panel-section.d.ts +0 -9
  72. package/dist/components/scene-tree/vertex-scene-tree-table-layout.d.ts +0 -3
  73. package/dist/components/scene-tree/vertex-scene-tree.d.ts +0 -14
  74. /package/dist/components/appearance/{__tests__ → material/__tests__}/scene-item-material-color-picker.spec.d.ts +0 -0
  75. /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
  76. /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
  77. /package/dist/components/appearance/{scene-item-material-apply-all.d.ts → material/scene-item-material-apply-all.d.ts} +0 -0
  78. /package/dist/components/appearance/{scene-item-material-clear.d.ts → material/scene-item-material-clear.d.ts} +0 -0
  79. /package/dist/components/appearance/{scene-item-material-color-picker.d.ts → material/scene-item-material-color-picker.d.ts} +0 -0
  80. /package/dist/components/appearance/{scene-item-material-opacity-slider.d.ts → material/scene-item-material-opacity-slider.d.ts} +0 -0
  81. /package/dist/components/scene-tree/{vertex-scene-tree-header.d.ts → scene-tree-header.d.ts} +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";var e=require("react/jsx-runtime"),t=require("quick-format-unescaped"),n=require("recoil"),a=require("react"),s=require("@vertexvis/geometry"),o=require("@vertexvis/ui-react"),i=require("@vertexvis/viewer"),l=require("@vertexvis/viewer-react"),r=require("@vertexvis/ui/loader"),c=require("@vertexvis/viewer/loader");function _interopNamespaceDefault(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var u=_interopNamespaceDefault(a),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 s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);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 s=0,a=Object.getOwnPropertySymbols(e);s<a.length;s++)t.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(e,a[s])&&(n[a[s]]=e[a[s]]);return n}function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),s,o=[],i;try{for(;(void 0===t||t-- >0)&&!(s=a.next()).done;)o.push(s.value)}catch(e){i={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o}"function"==typeof SuppressedError&&SuppressedError;var d={exports:{}};const m=t;d.exports=pino;const p=pfGlobalThisOrFallback().console||{},h={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 f=Symbol("pino.logFuncs"),g=Symbol("pino.hierarchy"),v={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function appendChildLogger(e,t){const n={logger:t,parent:e[g]};t[g]=n}function setupBaseLogFunctions(e,t,n){const a={};t.forEach((e=>{a[e]=n[e]?n[e]:p[e]||p[v[e]||"log"]||noop})),e[f]=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||p;e.browser.write&&(e.browser.asObject=!0);const a=e.serializers||{},s=shouldSerialize(e.browser.serialize,a);let o=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(o=!1);const i=Object.keys(e.customLevels||{}),l=["error","fatal","warn","info","debug","trace"].concat(i);"function"==typeof n&&l.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,l,n),appendChildLogger({},c),Object.defineProperty(c,"levelVal",{get:getLevelVal}),Object.defineProperty(c,"level",{get:getLevel,set:setLevel});const u={transmit:t,serialize:s,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:l,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,u,c,"error"),set(this,u,c,"fatal"),set(this,u,c,"warn"),set(this,u,c,"info"),set(this,u,c,"debug"),set(this,u,c,"trace"),i.forEach((e=>{set(this,u,c,e)}))}function child(n,o,i){if(!o)throw new Error("missing bindings for child Pino");i=i||{},s&&o.serializers&&(i.serializers=o.serializers);const l=i.serializers;if(s&&l){var r=Object.assign({},a,l),c=!0===e.browser.serialize?Object.keys(r):s;delete o.serializers,applySerializers([o],c,r,this._stdErrSerialize)}function Child(e){this._childLevel=1+(0|e._childLevel),this.bindings=o,r&&(this.serializers=r,this._serialize=c),t&&(this._logEvent=createLogEventShape([].concat(e._logEvent.bindings,o)))}Child.prototype=this;const u=new Child(this);return appendChildLogger(this,u),u.child=function(...e){return child.call(this,n,...e)},u.level=i.level||this.level,n.onChild(u),u}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=s,c._stdErrSerialize=o,c.child=function(...e){return child.call(this,u,...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[g];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[f][a],writable:!0,enumerable:!0,configurable:!0}),e[a]===noop){if(!t.transmit)return;const s=undefined,o=levelToValue(t.transmit.level||e.level,n),i=undefined;if(levelToValue(a,n)<o)return}e[a]=createWrap(e,t,n,a);const s=getBindingChain(e);0!==s.length&&(e[a]=prependBindingsInArguments(s,e[a]))}function prependBindingsInArguments(e,t){return function(){return t.apply(this,[...e,...arguments])}}function createWrap(e,t,n,a){return s=e[f][a],function LOG(){const o=t.timestamp(),i=new Array(arguments.length),l=Object.getPrototypeOf&&Object.getPrototypeOf(this)===p?p:this;for(var r=0;r<i.length;r++)i[r]=arguments[r];var c=!1;if(t.serialize&&(applySerializers(i,this._serialize,this.serializers,this._stdErrSerialize),c=!0),t.asObject||t.formatters?s.call(l,...asObject(this,a,i,o,t)):s.apply(l,i),t.transmit){const s=void 0,l=levelToValue(t.transmit.level||e._level,n),r=levelToValue(a,n);if(r<l)return;transmit(this,{ts:o,methodLevel:a,methodValue:r,transmitValue:n.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:levelToValue(e._level,n)},i,c)}};var s}function asObject(e,t,n,a,s){const{level:o,log:i=e=>e}=s.formatters||{},l=n.slice();let r=l[0];const c={};let u=1+(0|e._childLevel);if(u<1&&(u=1),a&&(c.time=a),o){const n=o(t,e.levels.values[t]);Object.assign(c,n)}else c.level=e.levels.values[t];if(s.asObjectBindingsOnly){if(null!==r&&"object"==typeof r)for(;u--&&"object"==typeof l[0];)Object.assign(c,l.shift());const e=undefined;return[i(c),...l]}{if(null!==r&&"object"==typeof r){for(;u--&&"object"==typeof l[0];)Object.assign(c,l.shift());r=l.length?m(l.shift(),l):void 0}else"string"==typeof r&&(r=m(l.shift(),l));void 0!==r&&(c[s.messageKey]=r);const e=undefined;return[i(c)]}}function applySerializers(e,t,n,a){for(const s in e)if(a&&e[s]instanceof Error)e[s]=pino.stdSerializers.err(e[s]);else if("object"==typeof e[s]&&!Array.isArray(e[s])&&t)for(const a in e[s])t.indexOf(a)>-1&&a in n&&(e[s][a]=n[a](e[s][a]))}function transmit(e,t,n,a=!1){const s=t.send,o=t.ts,i=t.methodLevel,l=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=o,e._logEvent.messages=n.filter((function(e){return-1===c.indexOf(e)})),e._logEvent.level.label=i,e._logEvent.level.value=l,s(i,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 b;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=h,pino.stdTimeFunctions=Object.assign({},{nullTime:nullTime,epochTime:epochTime,unixTime:unixTime,isoTime:isoTime}),d.exports.default=pino,d.exports.pino=pino;const S=(0,d.exports)({formatters:{level:e=>({level:e})}}),logger_error=(e,t)=>{null!=t?S.error(t,e):S.error(e)},logger_info=(e,t)=>{null!=t?S.info(t,e):S.info(e)},logger_warn=(e,t)=>{null!=t?S.warn(t,e):S.warn(e)},logger_debug=(e,t)=>{null!=t?S.debug(t,e):S.debug(e)};class w{}function useActionCallback(e,t=[]){const a=t instanceof w?void 0:t;return n.useRecoilCallback((t=>e(Object.assign(Object.assign({},t),{snapshot:Object.defineProperties(t.snapshot,{getPromiseRequired:{configurable:!0,value:createGetPromiseRequiredWrapper(t.snapshot)},tryGetPromise:{configurable:!0,value:createTryGetPromiseWrapper(t.snapshot)}})}))),a)}function retainSnapshot(e){return t=>{var{snapshot:n}=t,a=__rest(t,["snapshot"]);return async(...t)=>{const s=n.retain();try{const s=undefined;return await e(Object.assign(Object.assign({},a),{snapshot:n}))(...t)}finally{s()}}}}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 V=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,C=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(.+)\s*\)/,j=/^(#|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=j.exec(e);if(null!=t)return fromNumber(parseInt(t[2],16))},fromCss=function(e){var t=V.exec(e);if(null!=t)return create$2(parseInt(t[1]),parseInt(t[2]),parseInt(t[3]));var n=C.exec(e);return null!=n?create$2(parseInt(n[1]),parseInt(n[2]),parseInt(n[3]),Math.floor(255*parseFloat(n[4]))):j.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},T=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 k=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,s;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=(s=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(t,s[a]))return!1;for(a=n;0!=a--;){var o=s[a];if(!equal(e[o],t[o]))return!1}return!0}return e!=e&&t!=t};
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("quick-format-unescaped"),n=require("recoil"),a=require("@vertexvis/geometry"),o=require("react"),s=require("@vertexvis/ui-react"),i=require("@vertexvis/viewer"),l=require("@vertexvis/viewer-react"),r=require("prop-types"),c=require("@vertexvis/ui/loader"),u=require("@vertexvis/viewer/loader");function _interopNamespaceDefault(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var d=_interopNamespaceDefault(o),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 o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);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 o=0,a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]]);return n}function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),o,s=[],i;try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)s.push(o.value)}catch(e){i={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return s}"function"==typeof SuppressedError&&SuppressedError;var m=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,p=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(.+)\s*\)/,h=/^(#|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=h.exec(e);if(null!=t)return fromNumber(parseInt(t[2],16))},fromCss=function(e){var t=m.exec(e);if(null!=t)return create$2(parseInt(t[1]),parseInt(t[2]),parseInt(t[3]));var n=p.exec(e);return null!=n?create$2(parseInt(n[1]),parseInt(n[2]),parseInt(n[3]),Math.floor(255*parseFloat(n[4]))):h.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},f=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 g=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,o;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=(o=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(t,o[a]))return!1;for(a=n;0!=a--;){var s=o[a];if(!equal(e[s],t[s]))return!1}return!0}return e!=e&&t!=t};
2
2
  /*!
3
3
  * isobject <https://github.com/jonschlinkert/isobject>
4
4
  *
@@ -10,10 +10,10 @@
10
10
  *
11
11
  * Copyright (c) 2014-2017, Jon Schlinkert.
12
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],s=n.slice(1),o=__assign({},a);if(0===s.length)return o;if(1===s.length){var i=s[0];for(var l in i)null==o[l]?o[l]=i[l]:isPlainObject(o[l])&&(o[l]=defaults(o[l],i[l]));return o}return s.reduce((function(e,t){return defaults(e,t)}),a)}function isPlainObject(e){return isPlainObject$1(e)}function isEqual$1(e,t){return k(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 A=Object.freeze({__proto__:null,defaults:defaults,isPlainObject:isPlainObject,isEqual:isEqual$1,toPairs:toPairs,fromPairs:fromPairs}),P,E=new Uint8Array(16);function rng(){if(!P&&!(P="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 P(E)}var I=/^(?:[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&&I.test(e)}for(var R=[],N=0;N<256;++N)R.push((N+256).toString(16).substr(1));function stringify(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(R[e[t+0]]+R[e[t+1]]+R[e[t+2]]+R[e[t+3]]+"-"+R[e[t+4]]+R[e[t+5]]+"-"+R[e[t+6]]+R[e[t+7]]+"-"+R[e[t+8]]+R[e[t+9]]+"-"+R[e[t+10]]+R[e[t+11]]+R[e[t+12]]+R[e[t+13]]+R[e[t+14]]+R[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,s=digits(n>>BigInt(32),BigInt(8)),o=digits(n>>BigInt(16),BigInt(4)),i=digits(n,BigInt(4)),l=digits(a>>BigInt(48),BigInt(4)),r=digits(a,BigInt(12));return"".concat(s,"-").concat(o,"-").concat(i,"-").concat(l,"-").concat(r)}function toMsbLsb(e){var t=__read(e.split("-"),5),n=t[0],a=t[1],s=t[2],o=t[3],i=t[4];if(null==n||null==a||null==s||null==o||null==i)throw new Error("Invalid UUID string ".concat(e));var l=BigInt.asIntN(64,BigInt("0x".concat(n+a+s))),r=BigInt.asIntN(64,BigInt("0x".concat(o+i)));return{msb:l.toString(),lsb:r.toString()}}var O=Object.freeze({__proto__:null,create:create$1,fromMsbLsb:fromMsbLsb,toMsbLsb:toMsbLsb});const M=n.atom({key:"viewerToolkitViewerElement",default:void 0,dangerouslyAllowMutability:!0}),L=n.atom({key:"viewerElementId",default:"vertex-viewer"}),B=n.atom({key:"viewerInitialSceneReady",default:!1}),_=n.atom({key:"viewerBaseInteractionHandlerProvider",default:Promise.resolve(void 0),dangerouslyAllowMutability:!0}),D=n.atom({key:"viewerPrimaryInteractionType",default:"rotate"}),F=n.atom({key:"viewerSceneViewId",default:void 0}),H=n.selector({key:"viewerScene",get:({get:e})=>async()=>{var t;return null===(t=e(M))||void 0===t?void 0:t.scene()},dangerouslyAllowMutability:!0}),U=n.atom({key:"viewerFrameScene",default:void 0,dangerouslyAllowMutability:!0}),W=n.selector({key:"viewerSceneVisibleBoundingBox",get:({get:e})=>{var t;return null===(t=e(U))||void 0===t?void 0:t.boundingBox}});function useViewerSceneActions(){const e=useActionCallback((({snapshot:e})=>async(t,n,...a)=>{const s=await e.getPromise(H),o=await s();a.length>0&&await(null==o?void 0:o.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()),[]),s=a.useCallback((e=>e.where((e=>e.all())).deselect()),[]);return{executeWithCorrelationId:e,execute:useActionCallback((()=>async(t,...n)=>{const a=O.create();await e(t,a,...n)})),selectItemsTransform:t,deselectItemsTransform:n,clearSelectionTransform:s,reset:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromiseRequired(H),a=await n(),s=await e.getPromiseRequired(K);null==a||a.reset({includeCamera:!0,suppliedCorrelationId:t,cameraTypeOverride:s})}))}}const G=500;function useViewerCameraActions(){return{flyToById:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(H),s=await a();await(null==s?void 0:s.camera().flyTo({itemId:t}).render({animation:{milliseconds:null!=n?n:G}}))})),flyToByBoundingBox:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(H),s=await a();await(null==s?void 0:s.camera().flyTo({boundingBox:t}).render({animation:{milliseconds:null!=n?n:G}}))})),updateCameraType:useActionCallback((({set:e})=>t=>{e(K,t)}))}}const K=n.atom({key:"viewerCameraType",default:"perspective"});class ${constructor(){this.interactionStarted=!1}initialize(e,t){this.api=t}dispose(){this.endInteraction()}async beginInteraction(){var e;this.interactionStarted||(await(null===(e=this.api)||void 0===e?void 0:e.beginInteraction()),this.interactionStarted=!0)}async endInteraction(){var e;await(null===(e=this.api)||void 0===e?void 0:e.endInteraction()),this.interactionStarted=!1}}const create=(e,t=0)=>({normal:e,offset:t}),forAxis=(e,t)=>{switch(e){case"x":return x(t);case"y":return y(t);case"z":return z(t)}},x=e=>create(s.Vector3.left(),-e),y=e=>create(s.Vector3.down(),-e),z=e=>create(s.Vector3.forward(),-e),getAxis=(e,t)=>{switch(e){case"x":return xAxis(t);case"y":return yAxis(t);case"z":return zAxis(t)}},q={x:s.Vector3.left(),y:s.Vector3.down(),z:s.Vector3.forward()},xAxis=e=>e.x,yAxis=e=>e.y||s.Vector3.create(e.x.z,e.x.x,e.x.y),zAxis=e=>e.z||s.Vector3.create(e.x.y,e.x.z,e.x.x),axis=(e,t,n,a)=>e&&e.normal&&[["x",t],["y",n],["z",a]].filter((t=>0===s.Vector3.magnitude(s.Vector3.cross(e.normal,t[1])))).map((e=>e[0])).pop(),isNegativeNormal=e=>s.Vector3.dot(s.Vector3.create(-1,-1,-1),e.normal)>0,towardsVector=(e,t)=>{const n=undefined;return s.Vector3.dot(e,t.normal)<0?invert(t):t},towardsCamera=(e,t)=>towardsVector(e.viewVector,t),invert=e=>Object.assign(Object.assign({},e),{normal:s.Vector3.multiply(e.normal,s.Vector3.create(-1,-1,-1)),offset:-e.offset}),fromHit=(e,t)=>{const n=s.Vector3.normalize(e.normal),a=s.Vector3.dot(n,e.position);return towardsCamera(t,create(n,a))},toAxis=(e,t,n,a,o)=>{const i=n.viewAll(),l=getAxis(e,t),r=null!=a&&null!=l?create(l,s.Vector3.dot(l,o||s.BoundingBox.center(a))):forAxis(e,i.lookAt[e]);return towardsCamera(n,r)};function corners(e){return[s.Vector3.create(e.min.x,e.min.y,e.min.z),s.Vector3.create(e.min.x,e.min.y,e.max.z),s.Vector3.create(e.min.x,e.max.y,e.min.z),s.Vector3.create(e.min.x,e.max.y,e.max.z),s.Vector3.create(e.max.x,e.max.y,e.max.z),s.Vector3.create(e.max.x,e.max.y,e.min.z),s.Vector3.create(e.max.x,e.min.y,e.max.z),s.Vector3.create(e.max.x,e.min.y,e.min.z)]}function equals(e,t){return e.min.x===t.min.x&&e.min.y===t.min.y&&e.min.z===t.min.z&&e.max.x===t.max.x&&e.max.y===t.max.y&&e.max.z===t.max.z}const Y="#999999",X=1,Z={default:5,min:0,max:10},J=n.atom({key:"crossSectioningEnabled",default:!1}),Q=n.atom({key:"crossSectioningHighlightColor",default:Y}),ee=n.atom({key:"crossSectioningBorderWidth",default:1}),te=n.atom({key:"crossSectioningPlanes",default:[]}),ne=n.atom({key:"crossSectioningAlignment",default:{mode:"global",hitPending:!1}}),ae=n.selector({key:"crossSectioningTargetBoundingBox",get:async({get:e})=>{const t=undefined;return e(W)}}),se=n.atom({key:"crossSectioningIsInteractive",default:!1}),oe=n.atom({key:"crossSectioningActiveAxis",default:"x"}),ie=n.atom({key:"crossSectioningAvailableAxes",default:q}),le=n.selector({key:"crossSectioningOffsetScalar",get:({get:e})=>{const t=e(te);return t.length>0&&isNegativeNormal(t[0])?-1:1}}),re=n.selector({key:"crossSectioningSliderRange",get:({get:e})=>{const t=e(te),n=e(ae),a=null!=n?corners(n):[];if(t.length>0){const e=a.map((e=>s.Vector3.dot(e,isNegativeNormal(t[0])?s.Vector3.multiply(t[0].normal,s.Vector3.create(-1,-1,-1)):t[0].normal)));return{default:t[0].offset,min:Math.min(...e)-2,max:Math.max(...e)+2}}return Z}}),ce=n.selector({key:"crossSectioningPlaneDisplayOffset",get:({get:e})=>{const t=e(te),n=e(le),a=e(re);return t.length>0?t[0].offset*n:a.default}}),ue=n.atom({key:"crossSectioningAdditionalToolsOpen",default:!1}),de=n.atom({key:"crossSectioningAlignmentToolsOpen",default:!1}),me=n.atom({key:"crossSectioningAxisToolsOpen",default:!1}),pe=n.atom({key:"crossSectioningInteractionHandler",default:new $,dangerouslyAllowMutability:!0});function useCrossSectioning(e,t){const s=n.useRecoilValue(pe);a.useEffect((()=>{t&&(null==e||e.registerInteractionHandler(s))}),[e,t,s])}const xe=n.atom({key:"hitResultsTapDetails",default:void 0}),he=n.atom({key:"hitResultsLongPressDetails",default:void 0}),fe=n.atom({key:"previousHitResult",default:void 0}),ge=n.atom({key:"currentHitResult",default:void 0}),ve=n.selector({key:"hitResult",get:async({get:e})=>{var t,n,a,o,i,l,r,c;const u=e(xe),d=e(he),m=null!=u?u:d,p=e(H),h=await p(),f=null==h?void 0:h.sceneViewId,g=null==h?void 0:h.raycaster();if(null!=m&&null!=g&&null!=f){const e=await g.hitItems(m.position),u=((null==e?void 0:e.hits)||[])[0];if(null!=u)return{id:null===(t=u.itemId)||void 0===t?void 0:t.hex,normal:s.Vector3.create((null===(n=null==u?void 0:u.hitNormal)||void 0===n?void 0:n.x)||0,(null===(a=null==u?void 0:u.hitNormal)||void 0===a?void 0:a.y)||0,(null===(o=null==u?void 0:u.hitNormal)||void 0===o?void 0:o.z)||0),position:s.Vector3.create((null===(i=null==u?void 0:u.hitPoint)||void 0===i?void 0:i.x)||0,(null===(l=null==u?void 0:u.hitPoint)||void 0===l?void 0:l.y)||0,(null===(r=null==u?void 0:u.hitPoint)||void 0===r?void 0:r.z)||0),meta:m.metaKey||m.ctrlKey||!1,metadata:[],ancestors:(null===(c=null==u?void 0:u.ancestors)||void 0===c?void 0:c.filter((e=>{var t;return null!=(null===(t=e.itemId)||void 0===t?void 0:t.hex)})).map((e=>{var t;return null===(t=e.itemId)||void 0===t?void 0:t.hex})))||[]}}}}),ye=n.atom({key:"hitResultsSkipNextTap",default:!1}),alignToNormal=(e,t,n)=>{if(e.toFrameCamera().isPerspective()){const n=s.Vector3.dot(s.Vector3.normalize(e.up),t),a=Math.abs(n)>.98?s.Vector3.normalize(s.Vector3.scale(-n,e.viewVector)):e.up,o=s.Vector3.add(s.Vector3.scale(s.Vector3.distance(e.position,e.lookAt),s.Vector3.multiply(t,s.Vector3.create(-1,-1,-1))),e.lookAt);return e.update({up:a,position:o})}{const a=s.Vector3.angleTo(s.Vector3.normalize(e.viewVector),t),o=null!=n?s.BoundingBox.center(n):e.lookAt,i=s.Vector3.normalize(s.Vector3.cross(s.Vector3.normalize(e.viewVector),t));return e.rotateAroundAxisAtPoint(a,o,i)}};function isParallelTo(e,t){const n=s.Angle.toDegrees(s.Vector3.angleTo(e,t));return 0===n||180===n}const be=500;function useCrossSectioningActions(){const e=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(ee),n=await e.getPromise(Q),a=await e.getPromise(te),s=await e.getPromise(H),o=await s();await(null==o?void 0:o.crossSectioning().update({sectionPlanes:a,highlightColor:n?T.fromHexString(n):void 0,lineWidth:t}))})),t=useActionCallback((({set:t,reset:n,snapshot:a})=>async()=>{const s=await a.getPromise(H),o=await s();if(null!=o){const a=o.camera().viewAll();n(ie),t(te,[towardsCamera(o.camera(),x(a.lookAt.x))]),await e()}})),n=useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async()=>{const a=await t.tryGetPromise(ve).then((e=>e.value)),s=await t.getPromise(H),o=await s();if(null!=a&&null!=o){const t=fromHit(a,o.camera());n(te,null!=t?[t]:[]),n(ie,null!=t?{x:t.normal}:q),await e()}}))),a=useActionCallback((({set:e,snapshot:n})=>async()=>{const a=await n.getPromise(te),s=undefined;await n.getPromise(J)||(e(J,!0),0===a.length&&await t())})),o=useActionCallback((({reset:t,snapshot:n})=>async()=>{const a=undefined;await n.getPromise(J)&&(t(J),t(ue),t(de),t(me),t(te),t(ne),t(oe),await e())}));return{enable:a,disable:o,reapply:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(J)&&await e()})),openAdditionalTools:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=undefined;await t.getPromise(J)||await a(),e(ue,!0)})),closeAdditionalTools:useActionCallback((({reset:e})=>()=>{e(ue)})),openAlignmentTools:useActionCallback((({set:e,reset:t})=>()=>{t(me),e(de,!0)})),closeAlignmentTools:useActionCallback((({reset:e})=>()=>{e(de)})),openAxisTools:useActionCallback((({set:e,reset:t})=>()=>{t(de),e(me,!0)})),closeAxisTools:useActionCallback((({reset:e})=>()=>{e(me)})),beginInteraction:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(pe);e(se,!0),await n.beginInteraction()})),endInteraction:useActionCallback((({reset:e,snapshot:t})=>async()=>{const n=await t.getPromise(pe);e(se),await n.endInteraction()})),updatePlanes:useActionCallback(retainSnapshot((({set:t,snapshot:n})=>async a=>{const s=await n.getPromise(te);if(s.length>0){const o=await n.getPromise(le),i=await n.getPromise(re),l=o<0?-1*i.max:i.min,r=o<0?-1*i.min:i.max,c=s.map((e=>Object.assign(Object.assign({},e),{offset:Math.min(Math.max(a*o,l),r)})));t(te,c),await e()}}))),flipPlanes:useActionCallback((({set:t,snapshot:n})=>async()=>{const a=await n.getPromise(te);t(te,a.map((e=>invert(e)))),await e()})),alignViewToPlane:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(te),n=await e.getPromise(M),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:be}})})),updateAxis:useActionCallback(retainSnapshot((({set:t,reset:n,snapshot:a})=>async o=>{const i=await a.getPromise(te),l=await a.getPromise(ie),r=await a.getPromise(ae),c=await a.getPromise(ne),u=await a.getPromise(M),d=await(null==u?void 0:u.scene()),m=l[o],p=null!=m&&i.length>0&&isParallelTo(i[0].normal,m)&&!isNaN(s.Vector3.angleTo(i[0].normal,m));if(null!=d&&!p){const e=await a.tryGetPromise(ve).then((e=>e.value));t(oe,o),t(te,[toAxis(o,l,d.camera(),r,"global"!==c.mode?null==e?void 0:e.position:void 0)])}n(me),await e()}))),updateAlignment:useActionCallback((({set:e,reset:s})=>async(o,i)=>{s(de),e(ne,{mode:o,hitPending:"global"!==o&&null==i}),"global"===o?(s(oe),s(ie),await t()):"surface"===o&&null!=i&&(await a(),await n())})),sectionCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(ne);a.hitPending&&(e(ne,Object.assign(Object.assign({},a),{hitPending:!1})),"surface"===a.mode&&await n())})),cancelCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(ne);n.hitPending&&e(ne,Object.assign(Object.assign({},n),{hitPending:!1}))}))}}var Se=Object.freeze({__proto__:null,DEFAULT_ALIGN_TO_PLANE_ANIMATION_DURATION_MS:be,DEFAULT_CROSS_SECTION_HIGHLIGHT_COLOR:Y,DEFAULT_CROSS_SECTION_LINE_THICKNESS_VALUE:1,DEFAULT_SLIDER_RANGE:Z,crossSectioningActiveAxis:oe,crossSectioningAdditionalToolsOpen:ue,crossSectioningAlignment:ne,crossSectioningAlignmentToolsOpen:de,crossSectioningAvailableAxes:ie,crossSectioningAxisToolsOpen:me,crossSectioningBorderWidth:ee,crossSectioningEnabled:J,crossSectioningHighlightColor:Q,crossSectioningInteractionHandler:pe,crossSectioningIsInteractive:se,crossSectioningOffsetScalar:le,crossSectioningPlaneDisplayOffset:ce,crossSectioningPlanes:te,crossSectioningSliderRange:re,crossSectioningTargetBoundingBox:ae,useCrossSectioning:useCrossSectioning,useCrossSectioningActions:useCrossSectioningActions});function useDebouncedCallback(e,t){const[n,s]=a.useState();return a.useEffect((()=>()=>{null!=n&&clearTimeout(n)}),[e,t,n]),a.useCallback((a=>{const handler=()=>{e(a)};null!=n&&clearTimeout(n),s(setTimeout(handler,t))}),[e,t,n])}const VertexColorPicker=t=>{var{onInput:n}=t,s=__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.jsx(o.VertexColorPicker,Object.assign({onInput:l},s))},VertexCrossSectionAppearanceColorPicker=({onUpdate:t})=>{const a=useCrossSectioningActions(),[s,o]=n.useRecoilState(Q);return e.jsx(VertexColorPicker,{"data-testid":"cross-section-highlight-color-picker",value:s,onValueChanged:e=>{null==t||t(e.detail)},onInput:async e=>{o(e),await a.reapply()}})};var we={exports:{}},Ve;
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],o=n.slice(1),s=__assign({},a);if(0===o.length)return s;if(1===o.length){var i=o[0];for(var l in i)null==s[l]?s[l]=i[l]:isPlainObject(s[l])&&(s[l]=defaults(s[l],i[l]));return s}return o.reduce((function(e,t){return defaults(e,t)}),a)}function isPlainObject(e){return isPlainObject$1(e)}function isEqual$1(e,t){return g(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 v=Object.freeze({__proto__:null,defaults:defaults,isPlainObject:isPlainObject,isEqual:isEqual$1,toPairs:toPairs,fromPairs:fromPairs}),b,S=new Uint8Array(16);function rng(){if(!b&&!(b="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 b(S)}var C=/^(?:[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&&C.test(e)}for(var w=[],V=0;V<256;++V)w.push((V+256).toString(16).substr(1));function stringify(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(w[e[t+0]]+w[e[t+1]]+w[e[t+2]]+w[e[t+3]]+"-"+w[e[t+4]]+w[e[t+5]]+"-"+w[e[t+6]]+w[e[t+7]]+"-"+w[e[t+8]]+w[e[t+9]]+"-"+w[e[t+10]]+w[e[t+11]]+w[e[t+12]]+w[e[t+13]]+w[e[t+14]]+w[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,o=digits(n>>BigInt(32),BigInt(8)),s=digits(n>>BigInt(16),BigInt(4)),i=digits(n,BigInt(4)),l=digits(a>>BigInt(48),BigInt(4)),r=digits(a,BigInt(12));return"".concat(o,"-").concat(s,"-").concat(i,"-").concat(l,"-").concat(r)}function toMsbLsb(e){var t=__read(e.split("-"),5),n=t[0],a=t[1],o=t[2],s=t[3],i=t[4];if(null==n||null==a||null==o||null==s||null==i)throw new Error("Invalid UUID string ".concat(e));var l=BigInt.asIntN(64,BigInt("0x".concat(n+a+o))),r=BigInt.asIntN(64,BigInt("0x".concat(s+i)));return{msb:l.toString(),lsb:r.toString()}}var j=Object.freeze({__proto__:null,create:create$1,fromMsbLsb:fromMsbLsb,toMsbLsb:toMsbLsb}),T={exports:{}};const A=t;T.exports=pino;const k=pfGlobalThisOrFallback().console||{},P={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 I=Symbol("pino.logFuncs"),E=Symbol("pino.hierarchy"),M={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function appendChildLogger(e,t){const n={logger:t,parent:e[E]};t[E]=n}function setupBaseLogFunctions(e,t,n){const a={};t.forEach((e=>{a[e]=n[e]?n[e]:k[e]||k[M[e]||"log"]||noop})),e[I]=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||k;e.browser.write&&(e.browser.asObject=!0);const a=e.serializers||{},o=shouldSerialize(e.browser.serialize,a);let s=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const i=Object.keys(e.customLevels||{}),l=["error","fatal","warn","info","debug","trace"].concat(i);"function"==typeof n&&l.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,l,n),appendChildLogger({},c),Object.defineProperty(c,"levelVal",{get:getLevelVal}),Object.defineProperty(c,"level",{get:getLevel,set:setLevel});const u={transmit:t,serialize:o,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:l,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,u,c,"error"),set(this,u,c,"fatal"),set(this,u,c,"warn"),set(this,u,c,"info"),set(this,u,c,"debug"),set(this,u,c,"trace"),i.forEach((e=>{set(this,u,c,e)}))}function child(n,s,i){if(!s)throw new Error("missing bindings for child Pino");i=i||{},o&&s.serializers&&(i.serializers=s.serializers);const l=i.serializers;if(o&&l){var r=Object.assign({},a,l),c=!0===e.browser.serialize?Object.keys(r):o;delete s.serializers,applySerializers([s],c,r,this._stdErrSerialize)}function Child(e){this._childLevel=1+(0|e._childLevel),this.bindings=s,r&&(this.serializers=r,this._serialize=c),t&&(this._logEvent=createLogEventShape([].concat(e._logEvent.bindings,s)))}Child.prototype=this;const u=new Child(this);return appendChildLogger(this,u),u.child=function(...e){return child.call(this,n,...e)},u.level=i.level||this.level,n.onChild(u),u}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=o,c._stdErrSerialize=s,c.child=function(...e){return child.call(this,u,...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[E];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[I][a],writable:!0,enumerable:!0,configurable:!0}),e[a]===noop){if(!t.transmit)return;const o=undefined,s=levelToValue(t.transmit.level||e.level,n),i=undefined;if(levelToValue(a,n)<s)return}e[a]=createWrap(e,t,n,a);const o=getBindingChain(e);0!==o.length&&(e[a]=prependBindingsInArguments(o,e[a]))}function prependBindingsInArguments(e,t){return function(){return t.apply(this,[...e,...arguments])}}function createWrap(e,t,n,a){return o=e[I][a],function LOG(){const s=t.timestamp(),i=new Array(arguments.length),l=Object.getPrototypeOf&&Object.getPrototypeOf(this)===k?k:this;for(var r=0;r<i.length;r++)i[r]=arguments[r];var c=!1;if(t.serialize&&(applySerializers(i,this._serialize,this.serializers,this._stdErrSerialize),c=!0),t.asObject||t.formatters?o.call(l,...asObject(this,a,i,s,t)):o.apply(l,i),t.transmit){const o=void 0,l=levelToValue(t.transmit.level||e._level,n),r=levelToValue(a,n);if(r<l)return;transmit(this,{ts:s,methodLevel:a,methodValue:r,transmitValue:n.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:levelToValue(e._level,n)},i,c)}};var o}function asObject(e,t,n,a,o){const{level:s,log:i=e=>e}=o.formatters||{},l=n.slice();let r=l[0];const c={};let u=1+(0|e._childLevel);if(u<1&&(u=1),a&&(c.time=a),s){const n=s(t,e.levels.values[t]);Object.assign(c,n)}else c.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(null!==r&&"object"==typeof r)for(;u--&&"object"==typeof l[0];)Object.assign(c,l.shift());const e=undefined;return[i(c),...l]}{if(null!==r&&"object"==typeof r){for(;u--&&"object"==typeof l[0];)Object.assign(c,l.shift());r=l.length?A(l.shift(),l):void 0}else"string"==typeof r&&(r=A(l.shift(),l));void 0!==r&&(c[o.messageKey]=r);const e=undefined;return[i(c)]}}function applySerializers(e,t,n,a){for(const o in e)if(a&&e[o]instanceof Error)e[o]=pino.stdSerializers.err(e[o]);else if("object"==typeof e[o]&&!Array.isArray(e[o])&&t)for(const a in e[o])t.indexOf(a)>-1&&a in n&&(e[o][a]=n[a](e[o][a]))}function transmit(e,t,n,a=!1){const o=t.send,s=t.ts,i=t.methodLevel,l=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=s,e._logEvent.messages=n.filter((function(e){return-1===c.indexOf(e)})),e._logEvent.level.label=i,e._logEvent.level.value=l,o(i,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 O;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=P,pino.stdTimeFunctions=Object.assign({},{nullTime:nullTime,epochTime:epochTime,unixTime:unixTime,isoTime:isoTime}),T.exports.default=pino,T.exports.pino=pino;const R=(0,T.exports)({formatters:{level:e=>({level:e})}}),logger_error=(e,t)=>{null!=t?R.error(t,e):R.error(e)},logger_info=(e,t)=>{null!=t?R.info(t,e):R.info(e)},logger_warn=(e,t)=>{null!=t?R.warn(t,e):R.warn(e)},logger_debug=(e,t)=>{null!=t?R.debug(t,e):R.debug(e)};class N{}function useActionCallback(e,t=[]){const a=t instanceof N?void 0:t;return n.useRecoilCallback((t=>e(Object.assign(Object.assign({},t),{snapshot:Object.defineProperties(t.snapshot,{getPromiseRequired:{configurable:!0,value:createGetPromiseRequiredWrapper(t.snapshot)},tryGetPromise:{configurable:!0,value:createTryGetPromiseWrapper(t.snapshot)}})}))),a)}function retainSnapshot(e){return t=>{var{snapshot:n}=t,a=__rest(t,["snapshot"]);return async(...t)=>{const o=n.retain();try{const o=undefined;return await e(Object.assign(Object.assign({},a),{snapshot:n}))(...t)}finally{o()}}}}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 _=3e3,L=5e3,B=8e3,D=n.atom({key:"applicationMessageToast",default:void 0}),F=n.atom({key:"applicationMessageBanner",default:void 0}),useApplicationMessageActions=()=>({setBannerMessage:useActionCallback((({set:e})=>t=>{e(F,null!=t?Object.assign(Object.assign({},t),{id:j.create()}):void 0)})),setToastMessage:useActionCallback((({set:e})=>t=>{e(D,null!=t?Object.assign(Object.assign({},t),{id:j.create()}):void 0)}))});var H=Object.freeze({__proto__:null,LOW_SEVERITY_BANNER_MESSAGE_DURATION_MS:L,LOW_SEVERITY_TOAST_MESSAGE_DURATION_MS:_,MEDIUM_SEVERITY_TOAST_MESSAGE_DURATION_MS:B,applicationMessageBanner:F,applicationMessageToast:D,useApplicationMessageActions:useApplicationMessageActions});const W=500;function useViewerCameraActions(){const e=useApplicationMessageActions();return{flyToById:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(G),o=await(null==a?void 0:a.scene());await(null==o?void 0:o.camera().flyTo({itemId:t}).render({animation:{milliseconds:null!=n?n:W}}))})),flyToByBoundingBox:useActionCallback((({snapshot:e})=>async(t,n)=>{const a=await e.getPromise(G),o=await(null==a?void 0:a.scene());await(null==o?void 0:o.camera().flyTo({boundingBox:t}).render({animation:{milliseconds:null!=n?n:W}}))})),updateCameraType:useActionCallback((({set:t,snapshot:n})=>async(o,s)=>{const i=await n.getPromise(J),l=undefined;null!=i&&a.BoundingBox.isValid(i)||!s?t(U,o):e.setToastMessage({type:"error",message:"Cannot change the camera type when no geometry is visible.",duration:B})}))}}const U=n.atom({key:"viewerCameraType",default:"perspective"}),G=n.atom({key:"viewerToolkitViewerElement",default:void 0,dangerouslyAllowMutability:!0}),K=n.atom({key:"viewerElementId",default:"vertex-viewer"}),$=n.atom({key:"viewerInitialSceneReady",default:!1}),q=n.atom({key:"viewerBaseInteractionHandlerProvider",default:Promise.resolve(void 0),dangerouslyAllowMutability:!0}),Y=n.atom({key:"viewerPrimaryInteractionType",default:"rotate"}),X=n.atom({key:"viewerSceneViewId",default:void 0});function useViewerSceneActions(){const e=useActionCallback((({snapshot:e})=>async(t,n,...a)=>{const o=await e.getPromise(G),s=await(null==o?void 0:o.scene());a.length>0&&await(null==s?void 0:s.items((e=>a.map((t=>t(e))))).execute({suppliedCorrelationId:n}))})),t=o.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).select()),[]),n=o.useCallback(((...e)=>t=>t.where((t=>t.withItemIds(e))).deselect()),[]),a=o.useCallback((e=>e.where((e=>e.all())).deselect()),[]);return{executeWithCorrelationId:e,execute:useActionCallback((()=>async(t,...n)=>{const a=j.create();await e(t,a,...n)})),selectItemsTransform:t,deselectItemsTransform:n,clearSelectionTransform:a,reset:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(G),a=await(null==n?void 0:n.scene()),o=await e.getPromiseRequired(U);null==a||a.reset({includeCamera:!0,suppliedCorrelationId:t,cameraTypeOverride:o})}))}}const Z=n.atom({key:"viewerFrameScene",default:void 0,dangerouslyAllowMutability:!0}),J=n.selector({key:"viewerSceneVisibleBoundingBox",get:({get:e})=>{var t;return null===(t=e(Z))||void 0===t?void 0:t.boundingBox}});var Q=Object.freeze({__proto__:null,DEFAULT_CAMERA_ANIMATION_DURATION:W,useViewerCameraActions:useViewerCameraActions,useViewerSceneActions:useViewerSceneActions,viewerBaseInteractionHandlerProvider:q,viewerCameraType:U,viewerElement:G,viewerElementId:K,viewerFrameScene:Z,viewerInitialSceneReady:$,viewerPrimaryInteractionType:Y,viewerSceneViewId:X,viewerSceneVisibleBoundingBox:J});class ee{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(a.Vector3.left(),-e),y=e=>create(a.Vector3.down(),-e),z=e=>create(a.Vector3.forward(),-e),getAxis=(e,t)=>{switch(e){case"x":return xAxis(t);case"y":return yAxis(t);case"z":return zAxis(t)}},te={x:a.Vector3.left(),y:a.Vector3.down(),z:a.Vector3.forward()},xAxis=e=>e.x,yAxis=e=>e.y||a.Vector3.create(e.x.z,e.x.x,e.x.y),zAxis=e=>e.z||a.Vector3.create(e.x.y,e.x.z,e.x.x),axis=(e,t,n,o)=>e&&e.normal&&[["x",t],["y",n],["z",o]].filter((t=>0===a.Vector3.magnitude(a.Vector3.cross(e.normal,t[1])))).map((e=>e[0])).pop(),isNegativeNormal=e=>a.Vector3.dot(a.Vector3.create(-1,-1,-1),e.normal)>0,towardsVector=(e,t)=>{const n=undefined;return a.Vector3.dot(e,t.normal)<0?invert(t):t},towardsCamera=(e,t)=>towardsVector(e.viewVector,t),invert=e=>Object.assign(Object.assign({},e),{normal:a.Vector3.multiply(e.normal,a.Vector3.create(-1,-1,-1)),offset:-e.offset}),fromHit=(e,t)=>{const n=a.Vector3.normalize(e.normal),o=a.Vector3.dot(n,e.position);return towardsCamera(t,create(n,o))},toAxis=(e,t,n,o,s)=>{const i=n.viewAll(),l=getAxis(e,t),r=null!=o&&null!=l?create(l,a.Vector3.dot(l,s||a.BoundingBox.center(o))):forAxis(e,i.lookAt[e]);return towardsCamera(n,r)};function corners(e){return[a.Vector3.create(e.min.x,e.min.y,e.min.z),a.Vector3.create(e.min.x,e.min.y,e.max.z),a.Vector3.create(e.min.x,e.max.y,e.min.z),a.Vector3.create(e.min.x,e.max.y,e.max.z),a.Vector3.create(e.max.x,e.max.y,e.max.z),a.Vector3.create(e.max.x,e.max.y,e.min.z),a.Vector3.create(e.max.x,e.min.y,e.max.z),a.Vector3.create(e.max.x,e.min.y,e.min.z)]}function equals(e,t){return e.min.x===t.min.x&&e.min.y===t.min.y&&e.min.z===t.min.z&&e.max.x===t.max.x&&e.max.y===t.max.y&&e.max.z===t.max.z}const ne="#999999",ae=1,oe={default:5,min:0,max:10},se=n.atom({key:"crossSectioningEnabled",default:!1}),ie=n.atom({key:"crossSectioningHighlightColor",default:ne}),le=n.atom({key:"crossSectioningBorderWidth",default:1}),re=n.atom({key:"crossSectioningPlanes",default:[]}),ce=n.atom({key:"crossSectioningAlignment",default:{mode:"global",hitPending:!1}}),ue=n.selector({key:"crossSectioningTargetBoundingBox",get:async({get:e})=>{const t=undefined;return e(J)}}),de=n.atom({key:"crossSectioningIsInteractive",default:!1}),me=n.atom({key:"crossSectioningActiveAxis",default:"x"}),pe=n.atom({key:"crossSectioningAvailableAxes",default:te}),he=n.selector({key:"crossSectioningOffsetScalar",get:({get:e})=>{const t=e(re);return t.length>0&&isNegativeNormal(t[0])?-1:1}}),fe=n.selector({key:"crossSectioningSliderRange",get:({get:e})=>{const t=e(re),n=e(ue),o=null!=n?corners(n):[];if(t.length>0){const e=o.map((e=>a.Vector3.dot(e,isNegativeNormal(t[0])?a.Vector3.multiply(t[0].normal,a.Vector3.create(-1,-1,-1)):t[0].normal)));return{default:t[0].offset,min:Math.min(...e)-2,max:Math.max(...e)+2}}return oe}}),xe=n.selector({key:"crossSectioningPlaneDisplayOffset",get:({get:e})=>{const t=e(re),n=e(he),a=e(fe);return t.length>0?t[0].offset*n:a.default}}),ge=n.atom({key:"crossSectioningAdditionalToolsOpen",default:!1}),ve=n.atom({key:"crossSectioningAlignmentToolsOpen",default:!1}),ye=n.atom({key:"crossSectioningAxisToolsOpen",default:!1}),be=n.atom({key:"crossSectioningInteractionHandler",default:new ee,dangerouslyAllowMutability:!0});function useCrossSectioning(e,t){const a=n.useRecoilValue(be);o.useEffect((()=>{t&&(null==e||e.registerInteractionHandler(a))}),[e,t,a])}const Se=n.atom({key:"hitResultsTapDetails",default:void 0}),Ce=n.atom({key:"hitResultsLongPressDetails",default:void 0}),we=n.atom({key:"previousHitResult",default:void 0}),Ve=n.atom({key:"currentHitResult",default:void 0}),je=n.selector({key:"hitResult",get:async({get:e})=>{var t,n,o,s,i,l,r,c;const u=e(Se),d=e(Ce),m=null!=u?u:d,p=e(G),h=await(null==p?void 0:p.scene()),f=null==h?void 0:h.sceneViewId,g=null==h?void 0:h.raycaster();if(null!=m&&null!=g&&null!=f){const e=await g.hitItems(m.position),u=((null==e?void 0:e.hits)||[])[0];if(null!=u)return{id:null===(t=u.itemId)||void 0===t?void 0:t.hex,normal:a.Vector3.create((null===(n=null==u?void 0:u.hitNormal)||void 0===n?void 0:n.x)||0,(null===(o=null==u?void 0:u.hitNormal)||void 0===o?void 0:o.y)||0,(null===(s=null==u?void 0:u.hitNormal)||void 0===s?void 0:s.z)||0),position:a.Vector3.create((null===(i=null==u?void 0:u.hitPoint)||void 0===i?void 0:i.x)||0,(null===(l=null==u?void 0:u.hitPoint)||void 0===l?void 0:l.y)||0,(null===(r=null==u?void 0:u.hitPoint)||void 0===r?void 0:r.z)||0),meta:m.metaKey||m.ctrlKey||!1,metadata:[],ancestors:(null===(c=null==u?void 0:u.ancestors)||void 0===c?void 0:c.filter((e=>{var t;return null!=(null===(t=e.itemId)||void 0===t?void 0:t.hex)})).map((e=>{var t;return null===(t=e.itemId)||void 0===t?void 0:t.hex})))||[]}}}}),Te=n.atom({key:"hitResultsSkipNextTap",default:!1}),alignToNormal=(e,t,n)=>{if(e.toFrameCamera().isPerspective()){const n=a.Vector3.dot(a.Vector3.normalize(e.up),t),o=Math.abs(n)>.98?a.Vector3.normalize(a.Vector3.scale(-n,e.viewVector)):e.up,s=a.Vector3.add(a.Vector3.scale(a.Vector3.distance(e.position,e.lookAt),a.Vector3.multiply(t,a.Vector3.create(-1,-1,-1))),e.lookAt);return e.update({up:o,position:s})}{const o=a.Vector3.angleTo(a.Vector3.normalize(e.viewVector),t),s=null!=n?a.BoundingBox.center(n):e.lookAt,i=a.Vector3.normalize(a.Vector3.cross(a.Vector3.normalize(e.viewVector),t));return e.rotateAroundAxisAtPoint(o,s,i)}};function isParallelTo(e,t){const n=a.Angle.toDegrees(a.Vector3.angleTo(e,t));return 0===n||180===n}const Ae=500;function useCrossSectioningActions(){const e=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(le),n=await e.getPromise(ie),a=await e.getPromise(re),o=await e.getPromise(G),s=await(null==o?void 0:o.scene());await(null==s?void 0:s.crossSectioning().update({sectionPlanes:a,highlightColor:n?f.fromHexString(n):void 0,lineWidth:t}))})),t=useActionCallback((({set:t,reset:n,snapshot:a})=>async()=>{const o=await a.getPromise(G),s=await(null==o?void 0:o.scene());if(null!=s){const a=s.camera().viewAll();n(pe),t(re,[towardsCamera(s.camera(),x(a.lookAt.x))]),await e()}})),n=useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async()=>{const a=await t.tryGetPromise(je).then((e=>e.value)),o=await t.getPromise(G),s=await(null==o?void 0:o.scene());if(null!=a&&null!=s){const t=fromHit(a,s.camera());n(re,null!=t?[t]:[]),n(pe,null!=t?{x:t.normal}:te),await e()}}))),o=useActionCallback((({set:e,snapshot:n})=>async()=>{const a=await n.getPromise(re),o=undefined;await n.getPromise(se)||(e(se,!0),0===a.length&&await t())})),s=useActionCallback((({reset:t,snapshot:n})=>async()=>{const a=undefined;await n.getPromise(se)&&(t(se),t(ge),t(ve),t(ye),t(re),t(ce),t(me),await e())}));return{enable:o,disable:s,reapply:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(se)&&await e()})),openAdditionalTools:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=undefined;await t.getPromise(se)||await o(),e(ge,!0)})),closeAdditionalTools:useActionCallback((({reset:e})=>()=>{e(ge)})),openAlignmentTools:useActionCallback((({set:e,reset:t})=>()=>{t(ye),e(ve,!0)})),closeAlignmentTools:useActionCallback((({reset:e})=>()=>{e(ve)})),openAxisTools:useActionCallback((({set:e,reset:t})=>()=>{t(ve),e(ye,!0)})),closeAxisTools:useActionCallback((({reset:e})=>()=>{e(ye)})),beginInteraction:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(be);e(de,!0),await n.beginInteraction()})),endInteraction:useActionCallback((({reset:e,snapshot:t})=>async()=>{const n=await t.getPromise(be);e(de),await n.endInteraction()})),updatePlanes:useActionCallback(retainSnapshot((({set:t,snapshot:n})=>async a=>{const o=await n.getPromise(re);if(o.length>0){const s=await n.getPromise(he),i=await n.getPromise(fe),l=s<0?-1*i.max:i.min,r=s<0?-1*i.min:i.max,c=o.map((e=>Object.assign(Object.assign({},e),{offset:Math.min(Math.max(a*s,l),r)})));t(re,c),await e()}}))),flipPlanes:useActionCallback((({set:t,snapshot:n})=>async()=>{const a=await n.getPromise(re);t(re,a.map((e=>invert(e)))),await e()})),alignViewToPlane:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(re),n=await e.getPromise(G),a=await(null==n?void 0:n.scene());t.length>0&&null!=a&&await alignToNormal(a.camera(),t[0].normal,a.boundingBox()).render({animation:{milliseconds:Ae}})})),updateAxis:useActionCallback(retainSnapshot((({set:t,reset:n,snapshot:o})=>async s=>{const i=await o.getPromise(re),l=await o.getPromise(pe),r=await o.getPromise(ue),c=await o.getPromise(ce),u=await o.getPromise(G),d=await(null==u?void 0:u.scene()),m=l[s],p=null!=m&&i.length>0&&isParallelTo(i[0].normal,m)&&!isNaN(a.Vector3.angleTo(i[0].normal,m));if(null!=d&&!p){const e=await o.tryGetPromise(je).then((e=>e.value));t(me,s),t(re,[toAxis(s,l,d.camera(),r,"global"!==c.mode?null==e?void 0:e.position:void 0)])}n(ye),await e()}))),updateAlignment:useActionCallback((({set:e,reset:a})=>async(s,i)=>{a(ve),e(ce,{mode:s,hitPending:"global"!==s&&null==i}),"global"===s?(a(me),a(pe),await t()):"surface"===s&&null!=i&&(await o(),await n())})),sectionCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(ce);a.hitPending&&(e(ce,Object.assign(Object.assign({},a),{hitPending:!1})),"surface"===a.mode&&await n())})),cancelCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(ce);n.hitPending&&e(ce,Object.assign(Object.assign({},n),{hitPending:!1}))}))}}var ke=Object.freeze({__proto__:null,DEFAULT_ALIGN_TO_PLANE_ANIMATION_DURATION_MS:Ae,DEFAULT_CROSS_SECTION_HIGHLIGHT_COLOR:ne,DEFAULT_CROSS_SECTION_LINE_THICKNESS_VALUE:1,DEFAULT_SLIDER_RANGE:oe,crossSectioningActiveAxis:me,crossSectioningAdditionalToolsOpen:ge,crossSectioningAlignment:ce,crossSectioningAlignmentToolsOpen:ve,crossSectioningAvailableAxes:pe,crossSectioningAxisToolsOpen:ye,crossSectioningBorderWidth:le,crossSectioningEnabled:se,crossSectioningHighlightColor:ie,crossSectioningInteractionHandler:be,crossSectioningIsInteractive:de,crossSectioningOffsetScalar:he,crossSectioningPlaneDisplayOffset:xe,crossSectioningPlanes:re,crossSectioningSliderRange:fe,crossSectioningTargetBoundingBox:ue,useCrossSectioning:useCrossSectioning,useCrossSectioningActions:useCrossSectioningActions});function useDebouncedCallback(e,t){const[n,a]=o.useState();return o.useEffect((()=>()=>{null!=n&&clearTimeout(n)}),[e,t,n]),o.useCallback((o=>{const handler=()=>{e(o)};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=o.useCallback((e=>{const t=e.target;i(t.value)}),[i]);return e.jsx(s.VertexColorPicker,Object.assign({onInput:l},a))},VertexCrossSectionAppearanceColorPicker=({onUpdate:t})=>{const a=useCrossSectioningActions(),[o,s]=n.useRecoilState(ie);return e.jsx(VertexColorPicker,{"data-testid":"cross-section-highlight-color-picker",value:o,onValueChanged:e=>{null==t||t(e.detail)},onInput:async e=>{s(e),await a.reapply()}})};var Pe={exports:{}},Ie;
14
14
  /*!
15
15
  Copyright (c) 2018 Jed Watson.
16
16
  Licensed under the MIT License (MIT), see
17
17
  http://jedwatson.github.io/classnames
18
- */Ve=we,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}Ve.exports?(classNames.default=classNames,Ve.exports=classNames):window.classNames=classNames}();var Ce=we.exports;const VertexSlider=t=>{var{value:n,defaultValue:s,leftLabel:i,rightLabel:l,onChange:r,onValueChange:c,onValueInput:u}=t,d=__rest(t,["value","defaultValue","leftLabel","rightLabel","onChange","onValueChange","onValueInput"]);const[m,p]=a.useState(s);return e.jsxs("div",{className:"flex w-full items-center gap-2",children:[i&&e.jsx("div",{className:"pl-0.5 text-xs text-center",children:i}),e.jsx(o.VertexSlider,Object.assign({className:Ce("w-full",{"mt-0.5":null!=i||null!=l}),value:null!=n?n:m,onValueChange:e=>{p(e.detail.value),null==r||r(e.detail.value),null==c||c(e)},onValueInput:e=>{p(e.detail.value),null==r||r(e.detail.value),null==u||u(e)}},d)),l&&e.jsx("div",{className:"text-xs pr-2 flex-shrink-0 text-right",children:l})]})},VertexCrossSectionAppearanceLineThicknessSlider=({onUpdate:t})=>{const a=useCrossSectioningActions(),[s,o]=n.useRecoilState(ee);return e.jsx(VertexSlider,{id:"cross-section-line-thickness","data-testid":"cross-section-line-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:s,valueLabelDisplay:"auto",onValueInput:async e=>{o(e.detail.value),await a.reapply()},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexCrossSectionAppearanceControls({onUpdateCrossSectionColor:t,onUpdateCrossSectionLineThickness:n}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexCrossSectionAppearanceColorPicker,{onUpdate:t}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e.jsx(VertexCrossSectionAppearanceLineThicknessSlider,{onUpdate:n})]})}function PanelSection({header:t,children:n}){return e.jsxs("div",{className:"py-3 px-4 border-neutral-300 border-b",children:[e.jsx("div",{className:"my-2 text-base text-neutral-700",children:t}),n]})}const VertexCrossSectionAppearanceReset=({onReset:t})=>{const a=useCrossSectioningActions(),[s,i]=n.useRecoilState(Q),[l,r]=n.useRecoilState(ee),c=s!==Y||1!==l;return e.jsx("div",{className:"ml-auto",children:e.jsx(o.VertexTooltip,{content:"Reset Cross Sectioning Appearance",children:e.jsx(o.VertexIconButton,{"data-testid":"cross-section-appearance-reset",iconName:"reset",iconSize:"sm",onClick:async()=>{i(Y),r(1),null==t||t(),await a.reapply()},disabled:!c})})})};function VertexCrossSectionAppearancePanelSection({onResetCrossSectionAppearance:t,onUpdateCrossSectionColor:n,onUpdateCrossSectionLineThickness:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Cross Sectioning",e.jsx(VertexCrossSectionAppearanceReset,{onReset:t})]}),children:e.jsx(VertexCrossSectionAppearanceControls,{onUpdateCrossSectionColor:n,onUpdateCrossSectionLineThickness:a})})}const je=.5,Te="#444444",ke=n.atom({key:"featureEdgesSelectedColor",default:Te}),Ae=n.atom({key:"featureEdgesLineThickness",default:je}),VertexFeatureEdgesColorPicker=({onUpdate:t})=>{const[a,s]=n.useRecoilState(ke);return e.jsx(VertexColorPicker,{"data-testid":"feature-edges-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>s(e)})},VertexFeatureEdgesThicknessSlider=({onUpdate:t})=>{const[a,s]=n.useRecoilState(Ae);return e.jsx(VertexSlider,{id:"feature-edges-thickness","data-testid":"feature-edges-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:a,valueLabelDisplay:"auto",onValueInput:e=>{s(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexFeatureEdgesControls({onUpdateFeatureEdgesColor:t,onUpdateFeatureEdgesThickness:n}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexFeatureEdgesColorPicker,{onUpdate:t}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e.jsx(VertexFeatureEdgesThicknessSlider,{onUpdate:n})]})}const VertexFeatureEdgesReset=({onReset:t})=>{const[a,s]=n.useRecoilState(ke),[i,l]=n.useRecoilState(Ae),r=i!==je||a!==Te;return e.jsx("div",{className:"ml-auto",children:e.jsx(o.VertexTooltip,{content:"Reset Feature Edges",children:e.jsx(o.VertexIconButton,{"data-testid":"feature-edges-reset",iconName:"reset",iconSize:"sm",onClick:()=>{s(Te),l(je),null==t||t()},disabled:!r})})})};function VertexFeatureEdgesPanelSection({onResetFeatureEdges:t,onUpdateFeatureEdgesColor:n,onUpdateFeatureEdgesThickness:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Feature Edges",e.jsx(VertexFeatureEdgesReset,{onReset:t})]}),children:e.jsx(VertexFeatureEdgesControls,{onUpdateFeatureEdgesColor:n,onUpdateFeatureEdgesThickness:a})})}function contextMenuItemIsRow(e){var t;return null!=e&&null!=(null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.id)}const Pe=n.atom({key:"contextMenuActive",default:void 0}),Ee=n.atom({key:"contextMenuPosition",default:void 0}),Ie=n.atom({key:"contextMenuTarget",default:void 0}),Re=n.atom({key:"contextMenuItem",default:void 0}),Ne=n.atom({key:"contextMenuActions",default:[]}),Oe=n.selector({key:"contextMenuActivePosition",get:({get:e})=>null!=e(Pe)?e(Ee):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(Ee,s.Point.create(n,a)),e(Ie,t.target)}})),pointerUp:useActionCallback((({snapshot:e,set:t})=>async(n,a,o,i)=>{const l=await e.getPromise(Ee),r=await e.getPromise(Pe);if(null!=l&&null==r){const e=n.clientX,r=null==n?void 0:n.clientY,c=s.Point.create(e,r),u=null!=l?s.Point.distance(l,c):0,d=null==o||o(n);u<2&&d&&(null==i||i(n,null!=l?l:c),t(Pe,a))}})),contextMenu:useActionCallback((()=>(e,t)=>{(null==t||t(e))&&e.preventDefault()})),longPress:useActionCallback((({set:e})=>(t,n,a,o)=>{if(null==a||a(t)){const a=s.Point.create(t.touches[0].clientX,t.touches[0].clientY);e(Ee,a),e(Ie,t.target),e(Pe,n),null==o||o(t,a)}})),clearActiveContextMenu:useActionCallback((({reset:e,set:t})=>n=>{t(ye,!!n),e(Pe),e(Ne),e(Ee)})),clearDismissedState:useActionCallback((({reset:e})=>()=>e(ye)))}}function targetWithinMenu(e){return e.target instanceof Element&&isChildOf("vertex-menu",e.target)}function targetShouldSkipNextHit(e){return e.target instanceof Element&&isChildOf("vertex-viewer",e.target)}function isChildOf(e,t){return null!=t.closest(e)}const Me=n.atom({key:"boxSelectionEnabled",default:!1}),Le=n.atom({key:"boxSelectionOperationType",default:"clearAndSelect"}),useBoxSelectionActions=()=>({enable:useActionCallback((({set:e})=>()=>{e(Me,!0)})),disable:useActionCallback((({reset:e})=>async()=>{e(Me),e(Le)})),setOperationType:useActionCallback((({set:e})=>t=>{e(Le,t)}))});async function whenComponentReady(e,t,n=customElements,a=requestAnimationFrame,s=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):s(e))),t())}const Be=n.atom({key:"isEditingPointToPointMeasurement",default:!1}),_e=n.atom({key:"pointToPointMeasurementOutcome",default:void 0}),De=n.atom({key:"editedPointToPointMeasurement",default:void 0});function usePointToPointMeasurement(e){const t=n.useSetRecoilState(_e);a.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onOutcomeChanged(t)})),()=>null==n?void 0:n.dispose()}),[e,t])}const ze=2,Fe=n.atom({key:"isEditingPreciseMeasurement",default:!1}),He=n.atom({key:"preciseMeasurementOutcome",default:void 0}),Ue=n.atom({key:"preciseMeasurementController",dangerouslyAllowMutability:!0,default:void 0}),We=n.atom({key:"preciseMeasurementOverlays",dangerouslyAllowMutability:!0,default:void 0}),Ge=n.atom({key:"preciseMeasurementEntities",dangerouslyAllowMutability:!0,default:[]}),Ke=n.selector({key:"preciseMeasurementMessage",get:({get:e})=>{const t=undefined;return 0===e(Ge).length?"Select a surface":void 0}});function usePreciseMeasurementModel(e,t,s){const o=n.useSetRecoilState(Ge),i=n.useSetRecoilState(He),l=n.useSetRecoilState(Ue),r=n.useSetRecoilState(We),c=n.useRecoilValue(Ue);a.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{o(e),null==t||t(e)}))})),()=>null==n?void 0:n.dispose()}),[e,o]),a.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onOutcomeChanged((e=>{i(e),null==s||s(e)}))})),()=>null==t?void 0:t.dispose()}),[e,i]),a.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{if(e.length>2){const t=e[2];null==c||c.setEntities(new Set([t]))}}))})),()=>null==t?void 0:t.dispose()}),[e,c]),a.useEffect((()=>{whenComponentReady(e,(()=>{l(null==e?void 0:e.measurementController)}))}),[e,l]),a.useEffect((()=>{whenComponentReady(e,(()=>{r(null==e?void 0:e.measurementOverlays)}))}),[e,r])}function useMeasurementActions(){const e=useBoxSelectionActions(),t=useEnablePointToPointMeasurement(),n=useDisablePointToPointMeasurement(),a=useDisablePreciseMeasurement(),s=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(Ue);null==t||t.clearEntities()})),o=useActionCallback((()=>async(e={})=>{await s(),n(e),a()})),i=useActionCallback((({set:e,reset:n})=>async a=>{await o(),"point-to-point"===a?t():(n(He),n(Ge),e(Fe,!0))}));return{disableEditMeasurement:useActionCallback((()=>async e=>{await o(e)})),enableEditMeasurement:useActionCallback((()=>async e=>{await i(e)})),resetMeasurement:useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(Fe),a=await e.getPromise(Be);n?await s():a&&(t(_e),t(De))})),clearEditedPointToPointMeasurement:useActionCallback((({reset:e})=>()=>{e(De)})),setEditedPointToPointMeasurement:useActionCallback((({set:e})=>t=>{e(De,t)})),toggleEditPointToPointMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(Be)?await o():await i("point-to-point"),e.disable()})),toggleEditPreciseMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(Fe)?await o():await i("precise"),e.disable()}))}}function useEnablePointToPointMeasurement(){return useActionCallback((({reset:e,set:t})=>(n={})=>{t(Be,!0),n.keepExistingMeasurement||e(_e)}))}function useDisablePointToPointMeasurement(){return useActionCallback((({reset:e})=>(t={})=>{e(Be),t.keepExistingMeasurement||(e(De),e(_e))}))}function useDisablePreciseMeasurement(){return useActionCallback((({reset:e})=>async()=>{e(Fe),e(He),e(Ge)}))}const $e=n.selector({key:"isEditingMeasurement",get:({get:e})=>e(Be)||e(Fe)}),qe=n.selector({key:"measurementPanelModel",get:({get:e})=>e(_e)||e(He)}),Ye=n.selector({key:"measurementPanelOverlays",dangerouslyAllowMutability:!0,get:({get:e})=>e(We)}),Xe=n.selector({key:"measurementPanelMessage",get:({get:e})=>{const t=undefined;return e(Fe)?e(Ke):void 0}}),Ze=n.selector({key:"measurementPanelIsResettable",get:({get:e})=>e($e)&&null!=e(qe)}),Je=3e3,Qe=n.atom({key:"applicationMessageToast",default:void 0}),et=n.atom({key:"applicationMessageBanner",default:void 0}),useApplicationMessageActions=()=>({setBannerMessage:useActionCallback((({set:e})=>t=>{e(et,null!=t?Object.assign(Object.assign({},t),{id:O.create()}):void 0)})),setToastMessage:useActionCallback((({set:e})=>t=>{e(Qe,null!=t?Object.assign(Object.assign({},t),{id:O.create()}):void 0)}))});var tt;!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"}(tt||(tt={}));const nt=n.atom({key:"fetchedItemInvalidator",default:0}),at=n.selectorFamily({key:"fetchedItems",get:e=>async({get:t})=>{var n;const a=t(M),s=t(F);if(t(nt),t(Lt),null!=s)try{return await(null===(n=null==a?void 0:a.sceneItems)||void 0===n?void 0:n.getSceneViewItem(e,s,{includeOverride:!0,includeWorldTransform:!0}))}catch(t){return void logger_debug(`Error encountered get scene view item. [itemId={${e}}]`,t)}}}),st=n.atomFamily({key:"selectionSelectedItems",default:void 0}),ot=n.atom({key:"selectionSelectedItemIds",default:[]}),it=n.atom({key:"selectionLastSelected",default:void 0}),lt=n.atom({key:"selectionLastSelectionFromViewer",default:!1}),rt=n.atom({key:"selectionLastSelectWasMultiSelect",default:!1}),ct=n.selector({key:"selectionHasMultipleSelected",get:({get:e})=>{const t=e(it),n=undefined;return e(ot).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}}),ut=n.atom({key:"selectionFirstSelectedItemInTreeId",default:void 0}),dt=n.selector({key:"selectionHighestSelectedAncestor",get:({get:e})=>{var t,n;const a=e(it),s=e(ot);return null!==(n=null===(t=null==a?void 0:a.ancestors)||void 0===t?void 0:t.find((e=>s.includes(e))))&&void 0!==n?n:null==a?void 0:a.id}}),mt=n.atom({key:"selectionPreviousVisibleSummary",default:void 0}),pt=n.atom({key:"selectionVisibleSummary",default:void 0}),xt=n.selector({key:"selectionVisibleCount",get:({get:e})=>{var t,n;return null!==(n=null===(t=e(pt))||void 0===t?void 0:t.count)&&void 0!==n?n:0}}),ht=n.selector({key:"selectionBoundingBoxCenter",get:({get:e})=>{const t=e(pt);return null!=(null==t?void 0:t.boundingBox)?s.BoundingBox.center(t.boundingBox):s.Vector3.origin()}}),ft=n.selector({key:"selectionIsActive",get:({get:e})=>{const t=e(ot),n=undefined;return e(xt)>0||t.length>0}}),gt=n.selector({key:"fetchedAndSelectedItems",get:async({get:e})=>{const t=e(ot),n=undefined;return null!=e(F)?t.map((t=>e(at(t)))):[]}});function useSceneViewItemActions(){return{invalidateCachedItems:useActionCallback((({set:e})=>()=>{e(nt,(e=>e+1))}))}}const vt=n.atom({key:"lengthUnit",default:"cm"}),yt=n.atom({key:"decimalPlace",default:"2"});var bt,St;!function(e){e.mm="millimeters",e.cm="centimeters",e.m="meters",e.in="inches",e.ft="feet"}(bt||(bt={})),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"}(St||(St={}));const convertFrom=(e,t)=>{const n=undefined;return e/St[t]},convertTo=(e,t)=>{const n=undefined;return e*St[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:i.toWorldTransform(e,t)}:{world:e,local:i.toLocalTransform(e,t)}}function convertTransformToUnits(e,t){const{position:n,rotation:a,scale:o}=e;return{position:s.Vector3.create(convertTo(n.x,t),convertTo(n.y,t),convertTo(n.z,t)),rotation:a,scale:o}}function convertTransformFromUnits(e,t){const{position:n,rotation:a,scale:o}=e;return{position:s.Vector3.create(convertFrom(n.x,t),convertFrom(n.y,t),convertFrom(n.z,t)),rotation:a,scale:o}}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 wt={position:s.Vector3.create(0,0,0),rotation:s.Vector3.create(0,0,0),scale:1},Vt=n.atom({key:"transformWidgetEnabled",default:!1}),Ct=n.atom({key:"transformWidgetPosition",default:void 0}),jt=n.atom({key:"transformWidgetOrientationOverride",default:void 0}),Tt=n.selector({key:"transformWidgetOrientation",get:({get:e})=>{const t=e(jt),n=e(it);if(null!=t)return t;if(null!=n){const t=e(Mt(n.id));return s.Euler.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})}}}),kt=n.atom({key:"transformWidgetCachedOrientation",default:void 0}),At=n.atom({key:"transformWidgetSyncToSelection",default:!1}),Pt=n.atom({key:"transformWidgetIsInteracting",default:!1}),Et=n.atomFamily({key:"appliedItemTransform",default:void 0}),It=n.atom({key:"appliedItemTransformIds",default:[]}),Rt=n.atom({key:"selectedCoordinateSpace",default:"world"}),Nt=n.atomFamily({key:"editedItemTransform",default:void 0}),Ot=n.selectorFamily({key:"displayedItemTransform",get:e=>({get:t})=>{if(null!=e){const n=t(Rt),a=t(vt),s=t(Mt(e)),o=t(Nt(e));if(null!=o)return o.transform;if(null!=s)return pickLocalOrWorldTransform(mapItemTransforms(s,(e=>convertTransformToUnits(e,a))),n)}},set:e=>({get:t,set:a},s)=>{if(null!=e){const o=t(Rt),i=t(Bt(e)),l=t(Mt(e)),r=t(vt);if(null!=l&&!(s instanceof n.DefaultValue)&&null!=s&&null!=i){a(Nt(e),{coordinateSpace:o,units:r,transform:s});const n=makeItemTransforms(convertTransformFromUnits(toValidTransform(s),r),i,o),l=t(It);a(Et(e),n),a(It,[...l,e])}}}}),Mt=n.selectorFamily({key:"fetchedItemTransforms",get:e=>({get:t})=>{var n,a;const s=t(at(e));if(null!=s){const e=(null===(n=s.override)||void 0===n?void 0:n.transform)?toTransformFromApiMatrix(null===(a=s.override)||void 0===a?void 0:a.transform):void 0,t=s.worldTransform?toTransformFromApiMatrix(s.worldTransform):void 0;return{local:null!=e?e:wt,world:null!=t?t:wt}}}}),Lt=n.atom({key:"transformInvalidator",default:0}),Bt=n.selectorFamily({key:"parentItemWorldMatrix",get:e=>({get:t})=>{const n=t(F);if(null!=e&&null!=n){const n=t(at(e));if(null!=(null==n?void 0:n.parentId)){const e=t(Mt(n.parentId)),a=t(Et(n.parentId));if(null==e)throw new Error("Invalid state. Parent item state should be populated, but is undefined.");return null!=a?i.toMatrix(i.toRadiansTransform(a.world)):i.toMatrix(i.toRadiansTransform(e.world))}}return logger_debug(`Unable to find the world matrix for the parent of ${e}. Returning the identity matrix.`),s.Matrix4.makeIdentity()}});function useUpdateEditedTransformWhenSettingsChange(e){const t=n.useRecoilValue(vt),s=n.useRecoilValue(Rt),o=n.useRecoilValue(Et(null!=e?e:"")),[i,l]=n.useRecoilState(Nt(null!=e?e:""));a.useEffect((()=>{if(null!=o&&((null==i?void 0:i.coordinateSpace)!==s||(null==i?void 0:i.units)!==t)){const e=undefined,n=convertTransformToUnits(pickLocalOrWorldTransform(o,s),t);l({units:t,coordinateSpace:s,transform:n})}}),[t,s])}function useEditItemTransform(e){const t=useTransformActions();useUpdateEditedTransformWhenSettingsChange(e);const a=n.useRecoilValueLoadable(Bt(e)),[s,o]=n.useRecoilStateLoadable(Ot(e));return{transform:"hasValue"===s.state?s.contents:void 0,loading:"loading"===s.state||"loading"===a.state,error:"hasError"===s.state?s.contents:void 0,async update(n){t.enableSelectionSync(),o(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(ht);e(Ct,n)})),a=useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(Ct),s=await t.getPromise(rt),o=await t.getPromise(ot),i=await t.getPromise(xt);null==a&&(o.length>0||s||i>0)&&await n(),e(At,!0)})),o=useActionCallback((({set:e})=>async t=>{e(Ct,null!=t?t:void 0)})),l=useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async()=>{const a=await e.getPromise(Tt),s=undefined;(await e.getPromise(It)).forEach((e=>{n(Et(e)),n(Nt(e))})),n(It),null!=a&&t(kt,a),t(Lt,(e=>e+1))}))),r=useActionCallback((({set:e,reset:t})=>n=>{t(kt),e(jt,n)})),c=useActionCallback((({set:e})=>()=>{e(Ct,void 0),e(Vt,!1)}));return{enableTransformWidget:useActionCallback((({set:t})=>async(s,i)=>{e.setToastMessage({message:"Transform manipulator enabled! Select parts to interact.",duration:Je}),t(Vt,!0),i?await n():null==s?await a():await o(s)})),disableTransformWidget:useActionCallback((({reset:e})=>()=>{e(Vt),e(jt)})),setTransformWidgetOrientation:r,clearTransformWidgetOrientation:useActionCallback((({reset:e})=>()=>{e(kt),e(jt)})),setTransformWidgetPosition:o,clearTransformWidgetPosition:useActionCallback((({reset:e})=>()=>e(Ct))),invalidateTransforms:l,setIsInteractivelyTransforming:useActionCallback((({set:e})=>t=>{e(Pt,t)})),setDefaultWidgetPosition:a,setDefaultWidgetPositionToSelection:n,enableSelectionSync:useActionCallback((({set:e})=>()=>e(At,!0))),disableSelectionSync:useActionCallback((({reset:e})=>()=>e(At))),syncToSelection:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(mt),n=await e.getPromise(pt),a=undefined;if(await e.getPromise(At)){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 o(s.BoundingBox.center(e))}})),orientToHitResult:useActionCallback((({reset:e})=>async t=>{e(At),null!=t?await o(null==t?void 0:t.position):(e(Ct),r(void 0))})),clearSelectedTransforms:useActionCallback((()=>async()=>{await t.execute(tt.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.withSelected())).clearTransforms())),await l(),c()})),clearAllTransforms:useActionCallback((()=>async()=>{await t.execute(tt.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.all())).clearTransforms())),await l(),c()})),applyTransformToItem:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(M),a=await(null==n?void 0:n.scene()),o=await e.getPromise(Et(t));if(null==o)return void logger_warn(`There is no transform to apply to item ${t}.`);const l=s.Matrix4.transpose(i.toMatrix(i.toRadiansTransform(null==o?void 0:o.local)));return null==a?void 0:a.items((e=>e.where((e=>e.withItemId(t))).transform(l))).execute()}))}},useHitActions=()=>{const e=useCrossSectioningActions(),t=useMeasurementActions(),n=useTransformActions(),a=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const n=await e.tryGetPromise(ve).then((e=>e.value)),a=await e.getPromise(De);null==n&&null!=(null==a?void 0:a.start)&&null!=a.end&&await t.resetMeasurement()}))),s=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(ve).then((e=>e.value));await n.orientToHitResult(t)}))),o=useActionCallback(retainSnapshot((({set:e,snapshot:t})=>async()=>{const n=await t.tryGetPromise(ve).then((e=>e.value));e(Re,n)}))),i=useActionCallback(retainSnapshot((({snapshot:e,set:t})=>async()=>{t(ge,await e.tryGetPromise(ve).then((e=>e.value)))})));return{tap:useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async({detail:l},...r)=>{const c=await t.getPromise($e),u=await t.getPromise(ne),d=2!==(null==l?void 0:l.buttons)&&!(null==l?void 0:l.altKey);l.altKey||l.ctrlKey||l.metaKey||l.shiftKey;const m=d&&!u.hitPending&&!c,p=await t.tryGetPromise(ve).then((e=>e.value));n(fe,p),n(xe,l),await a(),m&&(r.forEach((e=>e())),await s()),await o(),await e.sectionCurrentHit(),await i()}))),longPress:useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async a=>{n(xe),t(he,a.detail),await e.tryGetPromise(ve),await o(),await i()})))}},_t=n.selector({key:"viewerToolkitHitState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,s=undefined,o=undefined;return{tapDetails:e(xe),longPressDetails:e(he),previousHitResult:e(fe),currentHitResult:e(ge)}}});var Dt=Object.freeze({__proto__:null,currentHitResult:ge,hitResult:ve,hitResultsLongPressDetails:he,hitResultsSkipNextTap:ye,hitResultsTapDetails:xe,hitState:_t,previousHitResult:fe,useHitActions:useHitActions});function useSelectionActions(){const e=useSceneViewItemActions(),t=useTransformActions(),n=useViewerSceneActions(),a=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(ot)).forEach((e=>t(st(e))))})),s=useActionCallback((({snapshot:e,reset:t,set:a})=>async(s,o)=>{var i,l;const r=await e.getPromise(st(s.id)),c=await e.getPromise(ot),u=null===(l=[...null!==(i=s.ancestors)&&void 0!==i?i:[]])||void 0===l?void 0:l.reverse().find((e=>!c.includes(e)));null!=r&&null!=u?(a(st(u),{id:u}),a(ot,(e=>[...e,u])),n.execute(tt.SELECTING_ANCESTOR,n.selectItemsTransform(u))):(null==o?void 0:o.clear)?(a(st(s.id),s),a(ot,[s.id]),n.execute(tt.SELECTING_ONLY_ITEM,n.clearSelectionTransform,n.selectItemsTransform(s.id))):(a(st(s.id),s),a(ot,(e=>[...e,s.id])),n.execute(tt.SELECTING_ITEMS,n.selectItemsTransform(s.id))),d(s),a(it,s),a(lt,!0),t(rt)})),o=useActionCallback((({reset:e,set:t})=>async a=>{e(st(a)),e(rt),t(ot,(e=>e.filter((e=>e!==a)))),n.execute(tt.DESELECTING_ITEMS,n.deselectItemsTransform(a))})),i=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(st(t.id));null!=n?await o(n.id):await s(t)})),l=useActionCallback((({snapshot:n,reset:a,set:o})=>async(i,l={})=>{const r=await n.getPromise(st(i.id)),c=await n.getPromise(ot);if(c.filter((e=>{var t;return e!==i.id&&!(null===(t=i.ancestors)||void 0===t?void 0:t.includes(e))})).forEach((e=>a(st(e)))),a(rt),r)if(l.ignoreAncestorSelection)a(ot),a(st(r.id));else{const e=c.filter((e=>{var t;return e===i.id||(null===(t=i.ancestors)||void 0===t?void 0:t.includes(e))}));o(ot,e)}else a(ot);e.invalidateCachedItems(),t.clearTransformWidgetOrientation(),await s(i,{clear:!0})})),r=useActionCallback((({reset:e})=>async()=>{await a(),e(ot),e(it),e(lt),e(rt),t.clearTransformWidgetPosition(),t.clearTransformWidgetOrientation()})),c=useActionCallback((()=>async()=>{await r(),n.execute(tt.CLEAR_SELECTION,n.clearSelectionTransform)})),u=useActionCallback((({set:e})=>async t=>{e(rt,t)})),d=useActionCallback((({reset:e,set:t})=>e=>{}));return{select:s,toggleSelection:i,clearAndSelect:l,selectCurrentHit:useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(ve).then((e=>e.value)),n=await e.getPromise(xe),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 i(t):await c():await l(t)}))),syncSelection:useActionCallback((({set:e,reset:t})=>async(n,s)=>{s.selected?(await a(),e(st(n.id),n),s.multiSelect?e(ot,(e=>[...e.filter((e=>e!==n.id)),n.id])):e(ot,[n.id]),d(n),e(it,n),e(lt,!1),e(rt,!!s.multiSelect)):(t(st(n.id)),t(rt),e(ot,(e=>e.filter((e=>e!==n.id)))))})),deselect:o,clearSelection:c,resetSelectionState:r,toggleLastSelectWasMultiSelect:u,selectForModelViewsPanel:d}}const zt=n.selector({key:"viewerToolkitSelectionState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,s=undefined;return{selectedItemIds:e(ot),lastSelected:e(it),highestSelectedAncestorId:e(dt)}}});var Ft=Object.freeze({__proto__:null,fetchedAndSelectedItems:gt,selectionBoundingBoxCenter:ht,selectionFirstSelectedItemInTreeId:ut,selectionHasMultipleSelected:ct,selectionHighestSelectedAncestor:dt,selectionIsActive:ft,selectionLastSelectWasMultiSelect:rt,selectionLastSelected:it,selectionLastSelectionFromViewer:lt,selectionPreviousVisibleSummary:mt,selectionSelectedItemIds:ot,selectionSelectedItems:st,selectionState:zt,selectionVisibleCount:xt,selectionVisibleSummary:pt,useSelectionActions:useSelectionActions});const Ht=255,Ut=n.atom({key:"sceneItemAdjustmentsSelectedColor",default:void 0}),Wt=n.atom({key:"sceneItemAdjustmentsSelectedOpacity",default:void 0}),Gt=n.atomFamily({key:"appliedItemMaterialOverride",default:void 0}),Kt=n.atom({key:"appliedItemMaterialOverrideIds",default:[]}),$t=n.selector({key:"sceneItemAdjustmentsLastSelectedOverride",get:({get:e})=>{const t=e(it);if(null!=t)return e(Gt(t.id))}}),qt=n.atom({key:"applyMaterialToAllUserAction",default:void 0}),Yt=n.atom({key:"showConfirmDialogWhenApplyingMaterialToAll",default:!0}),Xt=n.atom({key:"confirmApplyMaterialToAllDialogOpen",default:!1}),useSceneItemMaterialActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(Kt);t(Ut),n.forEach((e=>t(Gt(e)))),t(Kt)}));return{updateColor:useActionCallback((({set:e})=>t=>{e(Ut,t)})),clearCurrentColor:useActionCallback((({reset:e})=>()=>{e(Ut)})),clearCurrentOpacity:useActionCallback((({reset:e})=>()=>{e(Wt)})),clear:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const s=await t.getPromise(ot);a(Ut),s.forEach((e=>a(Gt(e)))),n(Kt,(e=>e.filter((e=>!s.includes(e))))),await e.execute(tt.CLEAR_SELECTED_MATERIAL_OVERRIDES,(e=>e.where((e=>e.withSelected())).clearMaterialOverrides().select()))})),clearAll:useActionCallback((()=>async()=>{await t(),await e.execute(tt.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(Wt,t)})),apply:useActionCallback((({snapshot:t,set:n})=>async()=>{const a=await t.getPromise(Ut),s=await t.getPromise(Wt),o=await t.getPromise(ot),i=await t.getPromise($t),l=null!=a?a:i,r=null!=s?s:null==i?void 0:i.opacity;if(null!=l){const t=Object.assign(Object.assign({},l),{opacity:null!=r?r:l.opacity});await e.execute(tt.APPLY_MATERIAL_OVERRIDE_TO_SELECTION,(e=>e.where((e=>e.withSelected())).materialOverride(t))),o.forEach((e=>n(Gt(e),t))),n(Kt,(e=>[...e,...o]))}})),confirmApplyAll:useActionCallback((({set:e})=>t=>{e(Xt,!0),e(qt,(()=>t))})),cancelApplyAll:useActionCallback((({reset:e})=>()=>{e(Xt),e(qt)})),applyAll:useActionCallback((({snapshot:t,reset:n})=>async()=>{const a=await t.getPromise(Ut),s=await t.getPromise(Wt);if(null!=a){const o=await t.getPromise(Kt),i=Object.assign(Object.assign({},a),{opacity:null!=s?s:a.opacity});await e.execute(tt.APPLY_MATERIAL_OVERRIDE_TO_ALL,(e=>e.where((e=>e.all())).materialOverride(i))),o.forEach((e=>n(Gt(e))));const l=await t.getPromise(qt);null==l||l(i),n(Xt),n(qt)}})),hideConfirmApplyAllDialog:useActionCallback((({set:e})=>()=>{e(Yt,!1)}))}},Zt="#FFFFFF",Jt=n.atom({key:"viewerBackgroundSelectedColor",default:Zt}),VertexSceneItemMaterialApplyAll=({onApplyAll:t})=>{const a=useSceneItemMaterialActions(),s=n.useRecoilValueLoadable($t),i=n.useRecoilValue(Ut),l=n.useRecoilValue(Yt),r=u.useMemo((()=>"hasValue"===s.state?null!=i?i:s.contents:i),[s,i]);return e.jsx(o.VertexTooltip,{content:"Apply to All",children:e.jsx(o.VertexIconButton,{iconName:"square-dot-outline",iconSize:"sm",color:"secondary",disabled:null==r,onClick:async()=>{l?a.confirmApplyAll(t):(await a.applyAll(),null==t||t(r))}})})};function SceneItemMaterialApplyAllConfirmationDialog(){const t=useSceneItemMaterialActions(),s=n.useRecoilValue(Xt),[i,l]=a.useState(!1),onCloseDialog=()=>{t.cancelApplyAll(),l(!1)};return s?e.jsxs(o.VertexDialog,{open:!0,className:"text-sm",onClosed:onCloseDialog,onBackdropClick:onCloseDialog,children:[e.jsx("div",{slot:"heading",children:"Apply to All Parts"}),e.jsx("div",{className:"max-w-lg break-words pr-2",children:"This will apply the same material to all parts in the model. Any previous material changes will be lost."}),e.jsxs("div",{className:"flex mt-8 gap-2 items-center",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(o.VertexToggle,{"data-testid":"hide-confirmation-dialog-in-future-checkbox",variant:"check",className:"pt-0.5",checked:i,onValueChanged:e=>{l(e.detail)}}),"Don't show again this session"]}),e.jsxs("div",{className:"flex ml-auto gap-2",children:[e.jsx(o.VertexButton,{"data-testid":"cancel-apply-material-to-all",onClick:onCloseDialog,children:"Cancel"}),e.jsx(o.VertexButton,{color:"primary","data-testid":"confirm-apply-material-to-all",onClick:async()=>{await t.applyAll(),i&&t.hideConfirmApplyAllDialog()},children:"Apply"})]})]})]}):e.jsx(e.Fragment,{})}function createColorMaterialWithId(e,t=O.create()){return Object.assign({id:t},i.ColorMaterial.fromHex(e))}const VertexSceneItemMaterialColorPicker=({onApply:t})=>{const a=useSceneItemMaterialActions(),s=n.useRecoilValueLoadable($t),o=n.useRecoilValue(Ut),i=u.useMemo((()=>"hasValue"===s.state?null!=o?o:s.contents:o),[s,o]);return e.jsx(VertexColorPicker,{"data-testid":"selected-item-color-picker",value:null!=i?T.toHexString(i.diffuse):void 0,onValueChanged:()=>{a.apply(),null==t||t(i)},onInput:async e=>{a.updateColor(createColorMaterialWithId(e)),await a.apply()}})},VertexSceneItemMaterialOpacitySlider=({onApply:t})=>{const a=useSceneItemMaterialActions(),s=n.useRecoilValue(Wt),i=n.useRecoilValueLoadable($t),l=u.useMemo((()=>{var e,t;return"hasValue"===i.state?null!==(t=null!=s?s:null===(e=i.contents)||void 0===e?void 0:e.opacity)&&void 0!==t?t:Ht:null!=s?s:Ht}),[s,i]),r=useDebouncedCallback((()=>{a.apply()}),500),c=u.useCallback((e=>{a.updateOpacity(e.detail.value),r(e.detail.value)}),[r,a]),d=u.useMemo((()=>"hasValue"!==i.state||null==i.contents),[i]);return e.jsx(o.VertexTooltip,{className:"flex w-full",content:d?"Select a part and apply a color to enable opacity":`${Math.floor(l/Ht*100)}%`,placement:"top",children:e.jsx(VertexSlider,{"data-testid":"scene-item-adjustments-opacity-slider",leftLabel:"0%",rightLabel:"100%",disabled:d,value:null!=l?l:Ht,step:5,min:0,max:Ht,onValueChange:e=>{a.updateOpacity(e.detail.value),a.apply(),null==t||t(e.detail.value)},onValueInput:c})})};function VertexMaterialControls({onApplyMaterial:t,onApplyMaterialToAll:s,onApplyOpacity:o}){const i=useSceneItemMaterialActions(),l=n.useRecoilValue(it);return a.useEffect((()=>{i.clearCurrentColor(),i.clearCurrentOpacity()}),[null==l?void 0:l.id]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(VertexSceneItemMaterialColorPicker,{onApply:t}),e.jsx(VertexSceneItemMaterialApplyAll,{onApplyAll:s})]})]}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e.jsx(VertexSceneItemMaterialOpacitySlider,{onApply:o}),e.jsx(SceneItemMaterialApplyAllConfirmationDialog,{})]})}const ResetButton=({id:t,tooltip:n,children:s})=>{const[i,l]=a.useState(!1);return e.jsx("div",{className:"ml-auto",children:e.jsxs(o.VertexDropdownMenu,{className:"flex items-stretch h-full","data-testid":`reset-button-dropdown-menu-${t}`,placement:"bottom-end",onMenuOpened:()=>l(!0),onMenuClosed:()=>l(!1),children:[e.jsx("div",{slot:"anchor",className:"flex items-center h-full",children:e.jsx(o.VertexTooltip,{content:n,disabled:i,placement:"bottom",children:e.jsxs(o.VertexButton,{className:Ce("p-1.5 rounded-md select-none hover:bg-neutral-300 active:bg-neutral-400 cursor-pointer",{"bg-neutral-300":i}),"data-testid":`reset-button-${t}`,variant:"plaintext",children:[e.jsx(o.VertexIcon,{className:"px-0.5",name:"reset",size:"sm"}),e.jsx(o.VertexIcon,{name:"chevron-down",size:"sm"})]})})}),e.jsx("div",{className:"whitespace-nowrap",children:s})]})})},VertexSceneItemMaterialClear=({onClear:t,onClearAll:a})=>{const s=useSceneItemMaterialActions(),i=n.useRecoilValue(ft);return e.jsx("div",{className:"ml-auto",children:e.jsxs(ResetButton,{id:"materials",tooltip:"Clear Materials",children:[e.jsx("div",{className:"pt-1"}),e.jsx(o.VertexMenuItem,{"data-testid":"clear-selected-materials",onClick:()=>{s.clear(),null==t||t()},disabled:!i,children:"Clear selected materials"}),e.jsx(o.VertexMenuItem,{"data-testid":"clear-all-materials",onClick:()=>{s.clearAll(),null==a||a()},children:"Clear all materials"})]})})};function VertexMaterialPanelSection({onClearMaterial:t,onClearAllMaterials:n,onApplyMaterial:a,onApplyMaterialToAll:s,onApplyOpacity:o}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Material",e.jsx(VertexSceneItemMaterialClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexMaterialControls,{onApplyMaterial:a,onApplyMaterialToAll:s,onApplyOpacity:o})})}const Qt="#ffff00",en=35,tn=1,nn=n.atom({key:"selectionHighlightingSelectedColor",default:Qt}),an=n.atom({key:"selectionHighlightingSelectedOpacity",default:en}),sn=n.atom({key:"selectionHighlightingSelectedLineThickness",default:1}),VertexSelectionHighlightingColorPicker=({onUpdate:t})=>{const[a,s]=n.useRecoilState(nn);return e.jsx(VertexColorPicker,{"data-testid":"selection-highlighting-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>s(e)})},VertexSelectionHighlightingLineThicknessSlider=({onUpdate:t})=>{const[a,s]=n.useRecoilState(sn);return e.jsx(VertexSlider,{id:"selection-highlighting-line-thickness","data-testid":"selection-highlighting-line-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:a,valueLabelDisplay:"auto",onValueInput:e=>{s(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},VertexSelectionHighlightingOpacitySlider=({onUpdate:t})=>{const[a,s]=n.useRecoilState(an);return e.jsx(VertexSlider,{id:"selection-highlighting-opacity","data-testid":"selection-highlighting-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:a,valueLabelDisplay:"auto",onValueInput:e=>{s(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexSelectionHighlightingControls({onUpdateSelectionHighlightColor:t,onUpdateSelectionHighlightOpacity:n,onUpdateSelectionHighlightLineThickness:a}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexSelectionHighlightingColorPicker,{onUpdate:t}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e.jsx(VertexSelectionHighlightingOpacitySlider,{onUpdate:n}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e.jsx(VertexSelectionHighlightingLineThicknessSlider,{onUpdate:a})]})}const VertexSelectionHighlightingReset=({onReset:t})=>{const[a,s]=n.useRecoilState(nn),[i,l]=n.useRecoilState(an),[r,c]=n.useRecoilState(sn),u=a!==Qt||i!==en||1!==r;return e.jsx("div",{className:"ml-auto",children:e.jsx(o.VertexTooltip,{content:"Reset Selection Highlighting",children:e.jsx(o.VertexIconButton,{"data-testid":"selection-highlighting-reset",iconName:"reset",iconSize:"sm",onClick:()=>{s(Qt),l(en),c(1),null==t||t()},disabled:!u})})})};function VertexSelectionHighlightingPanelSection({onResetSelectionHighlighting:t,onUpdateSelectionHighlightColor:n,onUpdateSelectionHighlightOpacity:a,onUpdateSelectionHighlightLineThickness:s}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Selection Highlighting",e.jsx(VertexSelectionHighlightingReset,{onReset:t})]}),children:e.jsx(VertexSelectionHighlightingControls,{onUpdateSelectionHighlightColor:n,onUpdateSelectionHighlightOpacity:a,onUpdateSelectionHighlightLineThickness:s})})}const VertexViewerBackgroundColorPicker=({onUpdate:t})=>{const[a,s]=n.useRecoilState(Jt);return e.jsx(VertexColorPicker,{"data-testid":"viewer-background-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>s(e)})};function VertexViewerBackgroundControls({onUpdateViewerBackgroundColor:t}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexViewerBackgroundColorPicker,{onUpdate:t})]})}const VertexViewerBackgroundReset=({onReset:t})=>{const[a,s]=n.useRecoilState(Jt),i=a!==Zt;return e.jsx("div",{className:"ml-auto",children:e.jsx(o.VertexTooltip,{content:"Reset Background Color",children:e.jsx(o.VertexIconButton,{"data-testid":"viewer-background-reset",iconName:"reset",iconSize:"sm",onClick:()=>{s(Zt),null==t||t()},disabled:!i})})})};function VertexViewerBackgroundPanelSection({onResetViewerBackgroundColor:t,onUpdateViewerBackgroundColor:n}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Viewer Background",e.jsx(VertexViewerBackgroundReset,{onReset:t})]}),children:e.jsx(VertexViewerBackgroundControls,{onUpdateViewerBackgroundColor:n})})}const isInputElement=e=>{const t=e instanceof HTMLElement&&"VERTEX-AUTO-RESIZE-TEXTAREA"===e.tagName,n=e instanceof HTMLElement&&"VERTEX-TEXTFIELD"===e.tagName,a=e instanceof HTMLElement&&"true"===e.contentEditable,s=e instanceof HTMLElement&&"VERTEX-SCENE-TREE-SEARCH"===e.tagName,o=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement,i=e instanceof HTMLElement&&"VERTEX-VIEWER-PIN-TOOL"===e.tagName,l=e instanceof HTMLElement&&"VERTEX-VIEWER-TRANSFORM-WIDGET"===e.tagName;return t||n||a||s||o||i||l},useRecoilReducer=({reducer:e,atom:t})=>{const a=undefined,s=undefined;return[n.useRecoilValue(t),useRecoilReducerDispatch({reducer:e,atom:t})]},useRecoilReducerDispatch=({reducer:e,atom:t})=>{const a=n.useRecoilCallback((({set:n})=>async a=>{n(t,(t=>e(t,a)))}),[]);return a},on=n.atom({key:"keyBindings",default:{applyBindings:[],bindings:{},pressed:{}}});function reducer(e,t){var n,a,s,o;switch(t.type){case"push-key-binding":const i=undefined;return null!=(null===(n=e.bindings[t.binding.keyBind])||void 0===n?void 0:n.find((e=>e.id===t.binding.id)))?e:Object.assign(Object.assign({},e),{bindings:Object.assign(Object.assign({},e.bindings),{[t.binding.keyBind]:[...null!==(a=e.bindings[t.binding.keyBind])&&void 0!==a?a:[],t.binding]})});case"remove-key-binding":const l=undefined;return null==(null===(s=e.bindings[t.binding.keyBind])||void 0===s?void 0:s.find((e=>e.id===t.binding.id)))?e:Object.assign(Object.assign({},e),{bindings:Object.assign(Object.assign({},e.bindings),{[t.binding.keyBind]:(null!==(o=e.bindings[t.binding.keyBind])&&void 0!==o?o:[]).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:on});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=O.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,s]=useKeyBindingState(),o=a.useCallback((e=>{Object.keys(n.bindings).filter((t=>t.includes(e)&&allPressed(t,Object.assign(Object.assign({},n.pressed),{[e]:!0})))).forEach((e=>{const t=n.bindings[e],a=t.length>0?t[t.length-1]:void 0;null!=a&&(a.fn(),s({type:"remove-key-binding",binding:a}))}))}),[n]);a.useEffect((()=>{const handleKeyDown=e=>{if(!e.repeat&&!t(e.target)){s({type:"set-key-pressed",key:e.key,pressed:!0}),o(e.key);const t=Object.assign(Object.assign({},n.pressed),{[e.key]:!0}),a=matchingSingleFnBindings(n.applyBindings,t,e.key),i=matchingOffBindings(n.applyBindings,t,e.key);(a.length>0||i.length>0)&&e.preventDefault()}},handleKeyUp=e=>{s({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)}}),[o,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(),a=n.useRecoilValue(Me);return useStackKeyBinding({id:"ExitBoxSelection",keyBind:"Escape",fn:t.disable,addPredicate:()=>a,cancelPredicate:()=>!a},[a]),e.jsx(o.VertexTooltip,{content:"Box Selection",children:e.jsx(o.VertexIconButton,{iconName:"box-cursor",iconColor:a?"primary":"secondary","data-testid":"viewer-toolbar-enable-box-selection-button",onClick:a?t.disable:t.enable})})},ln=1,VertexResizableContent=t=>{var{className:n,style:a,displayShadow:s,heading:i,id:l,initialScale:r,placement:c="left",children:u,onResize:d}=t,m=__rest(t,["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!=r?r:1;return e.jsx(o.VertexResizable,Object.assign({id:l,"data-testid":`resizable-content-position-${c}`,className:Ce(n,"pointer-events-auto z-popover md:z-overlay bg-white bg-opacity-95 flex-grow-0 flex-shrink-0 border-neutral-300",{"border-r min-w-75 max-w-half":"left"===c,"sidebar-shadow-right":"left"===c&&s,"border-l min-w-75 max-w-half":"right"===c,"sidebar-shadow-left":"right"===c&&s,"border-t bottom-0 fixed":"top"===c,"min-h-12 sheet":h}),style:Object.assign({maxHeight:"top"===c?window.innerHeight:void 0},a),initialHorizontalScale:p?r:void 0,initialVerticalScale:h?f:void 0,horizontalDirection:getHorizontalResizeDirection(),verticalDirection:getVerticalResizeDirection(),position:"right"===c||"top"===c?"absolute":"relative",onResizeEnd:()=>null==d?void 0:d()},m,{children:e.jsxs("div",{className:"flex flex-col h-full w-full",children:["top"===c&&e.jsx("div",{className:"flex justify-center w-full",children:e.jsx("div",{className:"block md:hidden w-20 h-0.5 mt-0.5 bg-neutral-600 rounded"})}),i,e.jsx("div",{className:Ce("w-full flex flex-col h-0 flex-grow",{"right-0":"right"===c}),children:u})]})}))};function useDefaultKeybindings(){useApplyKeyBinding({fn:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromiseRequired(H),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[o,i]=u.useState(),[l,r]=u.useState();u.useEffect((()=>{const handleTouchStart=e=>{const a=e;null!=a.touches&&1===a.touches.length&&(null!=o&&clearTimeout(o),r(s.Point.create(a.touches[0].clientX,a.touches[0].clientY)),i(setTimeout((()=>null==t?void 0:t(a)),n)))},handleTouchMove=e=>{const t=e;null!=t.touches&&t.touches.length>0&&null!=o&&null!=l&&s.Point.distance(l,s.Point.create(t.touches[0].clientX,t.touches[0].clientY))>=2&&(clearTimeout(o),null==a||a())},handleTouchEnd=()=>{null!=o&&clearTimeout(o)};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,o,l])}function asBooleanAttribute(e){return!!e||void 0}const VertexContextMenu=({targetElement:t,menuType:s,disableBackdrop:i,openPredicate:l,onOpen:r,onClose:c,children:u})=>{const d=useContextMenuActions(),m=n.useRecoilValue(Pe),p=n.useRecoilValue(Oe),h=a.useMemo((()=>["bottom-end","top-start","top-end","right","left"]),[]),f=m===s;useStackKeyBinding({id:"ContextMenu",keyBind:"Escape",fn:d.clearActiveContextMenu,addPredicate:()=>null!=m&&m===s,cancelPredicate:()=>null==m},[m]);const g=a.useMemo((()=>null!=t?t:null!=l?window:void 0),[t,l]);return useLongPress({target:g,callback:e=>d.longPress(e,s,l,r),onMovement:()=>d.clearActiveContextMenu()}),a.useEffect((()=>{const handleWindowPointerDown=e=>{const t=undefined;if(!targetWithinMenu(e)&&2!==e.buttons&&m===s){const t=targetShouldSkipNextHit(e);d.clearActiveContextMenu(t)}};if(i)return window.addEventListener("pointerdown",handleWindowPointerDown),()=>{window.removeEventListener("pointerdown",handleWindowPointerDown)}}),[i,s,m]),a.useEffect((()=>{const handlePointerDown=e=>{d.pointerDown(e)},handlePointerUp=e=>{d.pointerUp(e,s,l,r)},handleContextMenu=e=>d.contextMenu(e,l);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,s,l]),e.jsx("div",{className:Ce({hidden:!f}),children:e.jsx(o.VertexMenu,{"data-testid":`${s}-context-menu`,open:asBooleanAttribute(f),position:p,fallbackPlacements:h,backdrop:!i,onMenuClosed:()=>{d.clearActiveContextMenu(),null==c||c()},children:e.jsx("div",{className:"pt-1",children:u})})})},VertexFitSelectedMenuItem=()=>{const t=n.useRecoilValue(ot),a=n.useRecoilValue(pt),s=useViewerCameraActions();return e.jsxs(o.VertexMenuItem,{"data-testid":"fit-selected-menu-option",onClick:()=>{null!=(null==a?void 0:a.boundingBox)&&s.flyToByBoundingBox(a.boundingBox)},disabled:asBooleanAttribute(0===t.length),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"fit-selected",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Fit Selected"})]})},VertexFlyToMenuItem=()=>{const t=useViewerCameraActions(),a=n.useRecoilValue(Re);return e.jsxs(o.VertexMenuItem,{"data-testid":"fly-to-part-menu-option",onClick:()=>{var e;const n=undefined,s=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!=s&&t.flyToById(s)},disabled:asBooleanAttribute(null==a),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"paper-airplane",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Fly To"})]})};function useSceneItemsOperations(){const e=n.useRecoilValue(M),t=undefined,s=undefined,o=undefined,i=undefined,l=undefined,r=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 t=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"hide-all-menu-option",onClick:()=>{t.sceneItemsOperation((e=>e.hide()))},children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Hide All Parts"})]})},VertexHidePartMenuItem=()=>{const t=n.useRecoilValue(Re),a=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"hide-menu-option",onClick:()=>{var e;const n=undefined,s=contextMenuItemIsRow(t)?null===(e=null==t?void 0:t.node.id)||void 0===e?void 0:e.hex:t.id;null!=s&&a.sceneItemsOperation((e=>e.hide()),[s])},disabled:asBooleanAttribute(null==t),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Hide Part"})]})},VertexHideSelectedMenuItem=()=>{const t=n.useRecoilValue(ot),a=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"hide-selected-menu-option",onClick:()=>a.hideSelected(),disabled:asBooleanAttribute(0===t.length),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Hide Selected"})]})},VertexShowAllMenuItem=()=>{const t=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"show-all-menu-option",onClick:()=>{t.sceneItemsOperation((e=>e.show()))},children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Show All Parts"})]})},VertexShowOnlyMenuItem=()=>{const t=n.useRecoilValue(Re),a=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"show-only-menu-option",onClick:()=>{var e;const n=undefined,s=contextMenuItemIsRow(t)?null===(e=null==t?void 0:t.node.id)||void 0===e?void 0:e.hex:null==t?void 0:t.id;null!=s&&a.showOnlyItem(s)},disabled:asBooleanAttribute(null==t),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Show Only Part"})]})},VertexShowOnlySelectedMenuItem=()=>{const t=n.useRecoilValue(ot),a=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"show-only-selected-menu-option",onClick:()=>a.showOnlySelected(),disabled:asBooleanAttribute(0===t.length),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Show Only Selected"})]})};n.atom({key:"sceneTreeLoaderVisible",default:!1});const rn=n.atom({key:"sceneTreeElement",default:void 0}),cn=n.atom({key:"sceneTreeController",default:void 0,dangerouslyAllowMutability:!0});function useSceneTreeActions(){const e=useSelectionActions(),t=useViewerCameraActions();return{toggleSelection:useActionCallback((({snapshot:t})=>async(n,a,s)=>{var o,i;if(!n.defaultPrevented&&0===n.button&&(n.altKey||((n.ctrlKey||n.metaKey)&&a.selected?await s.deselectItem(a):a.selected?await s.selectItem(a,{recurseParent:!0}):a.selected||await s.selectItem(a,{append:n.ctrlKey||n.metaKey,range:n.shiftKey})),null!=a.id)){const s=await t.getPromise(it);e.syncSelection({id:null===(o=a.id)||void 0===o?void 0:o.hex,ancestors:null!==(i=null==s?void 0:s.ancestors)&&void 0!==i?i:[]},{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 s=await e.getPromise(rn),o=await(null==s?void 0:s.getRowAtClientY(n));null!=(null===(a=null==o?void 0:o.node.id)||void 0===a?void 0:a.hex)&&await t.flyToById(o.node.id.hex)})),flyToFirstSelectedItem:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(rn),n=await e.getPromise(ut);null!=n&&(null==t||t.scrollToItem(n))})),setContextMenuItem:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(rn),s=await(null==a?void 0:a.getRowAtClientY(n));e(Re,s)}))}}const VertexGhostSelectedMenuItem=()=>{const t=n.useRecoilValue(ot),a=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"ghost-selected-menu-option",onClick:()=>a.ghostSelected(),disabled:asBooleanAttribute(0===t.length),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-partial",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Ghost Selected"})]})},VertexUnghostSelectedMenuItem=()=>{const t=n.useRecoilValue(ot),a=useSceneItemsOperations();return e.jsxs(o.VertexMenuItem,{"data-testid":"unghost-selected-menu-option",onClick:()=>a.unGhostSelected(),disabled:asBooleanAttribute(0===t.length),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Unghost Selected"})]})},DefaultSceneTreeContextMenu=()=>e.jsxs("div",{className:"w-56",children:[e.jsx(VertexHideSelectedMenuItem,{}),e.jsx(VertexHideAllMenuItem,{}),e.jsx(VertexShowOnlyMenuItem,{}),e.jsx(VertexShowOnlySelectedMenuItem,{}),e.jsx(VertexShowAllMenuItem,{}),e.jsx(VertexGhostSelectedMenuItem,{}),e.jsx(VertexUnghostSelectedMenuItem,{}),e.jsx(o.VertexMenuDivider,{}),e.jsx(VertexFitSelectedMenuItem,{}),e.jsx(VertexFlyToMenuItem,{})]}),VertexSceneTreeContextMenu=({children:t})=>{const a=useSceneTreeActions(),s=n.useRecoilValue(rn),o=null!=t&&!1!==t;return e.jsx(VertexContextMenu,{menuType:"scene-tree",targetElement:s,onOpen:async(e,t)=>{const n=e;await a.setContextMenuItem(n.clientY)},disableBackdrop:!0,children:o?t:e.jsx(DefaultSceneTreeContextMenu,{})})},DefaultViewerContextMenu=()=>e.jsxs("div",{className:"w-56",children:[e.jsx(VertexHidePartMenuItem,{}),e.jsx(VertexHideSelectedMenuItem,{}),e.jsx(VertexHideAllMenuItem,{}),e.jsx(VertexShowOnlyMenuItem,{}),e.jsx(VertexShowOnlySelectedMenuItem,{}),e.jsx(VertexShowAllMenuItem,{}),e.jsx(VertexGhostSelectedMenuItem,{}),e.jsx(VertexUnghostSelectedMenuItem,{}),e.jsx(o.VertexMenuDivider,{}),e.jsx(VertexFitSelectedMenuItem,{}),e.jsx(VertexFlyToMenuItem,{})]}),VertexViewerContextMenu=({children:t})=>{const n=null!=t&&!1!==t,s=a.useCallback((e=>e.target instanceof HTMLElement&&"vertex-viewer"===e.target.id),[]);return e.jsx(VertexContextMenu,{menuType:"viewer",disableBackdrop:!0,openPredicate:s,children:n?t:e.jsx(DefaultViewerContextMenu,{})})},un=35,dn=n.atom({key:"sceneItemGhostingSelectedOpacity",default:un}),mn=n.atomFamily({key:"appliedItemPhantomState",default:void 0}),pn=n.atom({key:"appliedItemPhantomStateIds",default:[]}),xn=n.selector({key:"sceneItemGhostingLastSelectedPhantom",get:({get:e})=>{var t;const n=e(it);return null!=n&&(null!==(t=e(mn(n.id)))&&void 0!==t&&t)}}),VertexSceneItemGhostingOpacitySlider=({onApply:t})=>{const[a,s]=n.useRecoilState(dn);return e.jsx(VertexSlider,{id:"phantom-opacity","data-testid":"phantom-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:a,valueLabelDisplay:"auto",onValueInput:e=>{s(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(pn)).forEach((e=>t(mn(e)))),t(pn)}));return{setPhantomState:useActionCallback((({snapshot:t,set:n})=>async a=>{const s=await t.getPromise(ot);s.forEach((e=>n(mn(e),a))),n(pn,(e=>[...e,...s])),await e.execute(tt.SET_PHANTOM_SELECTED_ITEMS,(e=>e.where((e=>e.withSelected())).setPhantom(a)))})),clearPhantomState:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const s=await t.getPromise(ot);s.forEach((e=>a(mn(e)))),n(pn,(e=>e.filter((e=>!s.includes(e))))),await e.execute(tt.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(tt.CLEAR_PHANTOM_ALL,(e=>e.where((e=>e.all())).clearPhantom()),(e=>e.where((e=>e.withSelected())).select()))})),resetAllPhantomState:t}},VertexSceneItemGhostingToggle=({onApply:t})=>{const a=useSceneItemPhantomActions(),s=n.useRecoilValue(ft),i=n.useRecoilValueLoadable(xn);return e.jsx(o.VertexTooltip,{content:"Select a part to display as ghost",disabled:s,children:e.jsx(o.VertexToggle,{className:"flex items-center","data-testid":"phantom-state-toggle",variant:"switch",disabled:!s,checked:"hasValue"===i.state&&i.contents,onValueChanged:async e=>{await a.setPhantomState(e.detail),null==t||t(e.detail)}})})};function VertexGhostingControls({onApplyGhostingChange:t,onApplyOpacity:n}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center py-3",children:[e.jsx(VertexSceneItemGhostingToggle,{onApply:t}),e.jsx("span",{className:"pl-4 text-sm text-neutral-700",children:"Display as Ghost"})]}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Global Ghost Opacity"}),e.jsx(VertexSceneItemGhostingOpacitySlider,{onApply:n})]})}const VertexSceneItemGhostingClear=({onClear:t,onClearAll:a})=>{const s=useSceneItemPhantomActions(),i=n.useRecoilValue(xn);return e.jsx("div",{className:"ml-auto",children:e.jsxs(ResetButton,{id:"phantom",tooltip:"Clear Ghosting",children:[e.jsx("div",{className:"pt-1"}),e.jsx(o.VertexMenuItem,{"data-testid":"reset-selected-phantom",onClick:async()=>{await s.clearPhantomState(),null==t||t()},disabled:!i,children:"Clear ghosting for selected"}),e.jsx(o.VertexMenuItem,{"data-testid":"reset-all-phantom",onClick:async()=>{await s.clearAllPhantomState(),null==a||a()},children:"Clear ghosting for all"})]})})};function VertexGhostingPanelSection({onClearGhostState:t,onClearAllGhostState:n,onApplyGhostingChange:a,onApplyOpacity:s}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Ghosting",e.jsx(VertexSceneItemGhostingClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexGhostingControls,{onApplyGhostingChange:a,onApplyOpacity:s})})}function VertexMeasurementContextMenu({onDelete:t}){const a=n.useRecoilValue(Ie);return e.jsx(VertexContextMenu,{menuType:"measurement",openPredicate:e=>e.target instanceof HTMLElement&&"VERTEX-VIEWER-MEASUREMENT-DISTANCE"===e.target.tagName,children:e.jsxs(o.VertexMenuItem,{"data-testid":"measurement-delete",onClick:()=>null!=a&&t(a.id),children:[e.jsx(o.VertexIcon,{slot:"icon",name:"delete",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Delete"})]})})}function useDockedPlacement(e,t){const[n,a]=u.useState(s.Point.create(0,0));return u.useLayoutEffect((()=>{if(null!=e){const n=e.getBoundingClientRect(),o=s.Point.create(n.left,n.bottom),i=s.Point.create(n.right,n.bottom);a("left"===t?o:i)}}),[e,t]),n}function VertexMeasurementDetails({placement:t}){const a=useMeasurementActions(),s=n.useRecoilValue(M),i=n.useRecoilValue(L),r=useDockedPlacement(null!=s?s:null,t),c=n.useRecoilValue(qe),u=n.useRecoilValue(Ye),d=n.useRecoilValue(Xe),m=n.useRecoilValue(Ze),p=n.useRecoilValue(vt),h=n.useRecoilValue(yt);return e.jsx(o.VertexDraggablePopover,{className:"z-popover",boundaryPadding:16,boundarySelector:`#${i}`,position:r,children:e.jsxs("div",{className:"flex flex-col leading-4 min-w-40",children:[e.jsxs("div",{className:"pb-2 flex justify-between",children:[e.jsx("div",{className:"w-full",children:"Measurement"}),e.jsx("div",{className:Ce("-mt-1 relative",{hidden:!m}),children:e.jsx(o.VertexTooltip,{content:"Reset",placement:"left-start",children:e.jsx(o.VertexIconButton,{"data-testid":"measurement-details-reset",iconName:"reset",iconSize:"sm",onClick:a.resetMeasurement})})})]}),e.jsx(l.VertexViewerMeasurementDetails,{"data-testid":"measurement-details-viewer-measurement-details",className:Ce("gap-y-1.5 text-xs",{hidden:null==c}),measurementOutcome:c,measurementOverlays:u,distanceUnits:toUnitType(p),fractionalDigits:parseInt(h,10)}),e.jsx("div",{"data-testid":"measurement-details-message",className:Ce("text-xs",{hidden:null==d}),children:d})]})})}function useCallbackRef(e){var t;const[n,s]=a.useState((t=void 0,null)),o=undefined;return{element:n,callback:a.useCallback((e=>s(e)),[])}}function VertexPointToPointMeasurement({detailsPlacement:t,onPointToPointMeasurementChange:s}){const o=useMeasurementActions(),i=n.useRecoilValue(M),r=n.useRecoilValue(Be),c=n.useRecoilValue(De),u=n.useRecoilValue(vt),d=n.useRecoilValue(yt),{callback:m,element:p}=useCallbackRef();usePointToPointMeasurement(p);const h=a.useCallback((e=>{const t={start:e.detail.start,end:e.detail.end,invalid:!e.detail.valid};o.setEditedPointToPointMeasurement(t),null==s||s(t)}),[o]);return r?e.jsxs(e.Fragment,{children:[e.jsx(l.VertexViewerMeasurementDistance,{"data-testid":"point-to-point-measurement",ref:m,viewer:null!=i?i: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(u),fractionalDigits:parseInt(d,10),showAxisReferenceLines:!0,onEditEnd:h}),e.jsx(VertexMeasurementDetails,{placement:t}),e.jsx(VertexMeasurementContextMenu,{onDelete:o.resetMeasurement})]}):e.jsx(e.Fragment,{})}function VertexPointToPointMeasurementTool(){const t=useMeasurementActions(),a=n.useRecoilValue(Be);return useStackKeyBinding({id:"ExitMeasurement",keyBind:"Escape",fn:t.disableEditMeasurement,addPredicate:()=>a,cancelPredicate:()=>!a},[a,t]),e.jsx(o.VertexTooltip,{content:"Point to Point Measurement",children:e.jsx(o.VertexIconButton,{iconName:"tape-measure","data-testid":"viewer-toolbar-point-to-point-measurement-button",iconColor:a?"primary":"secondary",onClick:t.toggleEditPointToPointMeasurement})})}const hn=n.atom({key:"viewerToolkitSdkConfig",default:void 0}),VertexPreciseMeasurement=({detailsPlacement:t,onEntitiesChanged:a,onOutcomeChanged:s})=>{var o,i,r,c;const u=n.useRecoilValue(M),d=n.useRecoilValue(hn),m=n.useRecoilValue(Fe),{callback:p,element:h}=useCallbackRef();return usePreciseMeasurementModel(h,a,s),m?e.jsxs(e.Fragment,{children:[e.jsx(l.VertexViewerMeasurementPrecise,{"data-testid":"precise-measurement-viewer-tool",ref:p,viewer:null!=u?u:void 0,config:JSON.stringify({network:{apiHost:null===(o=null==d?void 0:d.network)||void 0===o?void 0:o.apiHost,renderingHost:null===(i=null==d?void 0:d.network)||void 0===i?void 0:i.renderingHost,sceneTreeHost:null===(r=null==d?void 0:d.network)||void 0===r?void 0:r.sceneTreeHost,sceneViewHost:null===(c=null==d?void 0:d.network)||void 0===c?void 0:c.sceneViewHost}})}),e.jsx(VertexMeasurementDetails,{placement:t})]}):e.jsx(e.Fragment,{})};function VertexPreciseMeasurementTool(){const t=useMeasurementActions(),a=n.useRecoilValue(Fe);return e.jsx(o.VertexTooltip,{content:"Precise Measurement",children:e.jsx(o.VertexIconButton,{iconName:"ruler","data-testid":"viewer-toolbar-precise-measurement-button",iconColor:a?"primary":"secondary",onClick:t.toggleEditPreciseMeasurement})})}function VertexApplicationMessages(){const t=n.useRecoilValue(et),a=n.useRecoilValue(Qe);return e.jsxs(e.Fragment,{children:[null!=t&&e.jsx(o.VertexBanner,{className:"z-[16000]",duration:t.duration,open:!0,content:t.message,type:t.type},t.id),null!=a&&e.jsx(o.VertexToast,{placement:"bottom-left",className:"z-[16000]",duration:a.duration,open:!0,content:a.message,type:a.type},a.id)]})}const fn={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 gn=n.atom({key:"sceneTreeColumnsRefreshTrigger",default:0}),vn=n.selector({key:"sceneTreeColumnsAvailableColumns",get:async({get:e})=>{const t=e(cn);return e(gn),null!=t?await t.fetchMetadataKeys():[]}}),yn=n.selector({key:"sceneTreeColumnsAvailableSortedColumns",get:({get:e})=>e(vn).filter((e=>e!==fn.metadataKeyName)).sort(((e,t)=>e.localeCompare(t)))}),bn=n.atom({key:"sceneTreeColumnsVisibleMetadataColumnNames",default:[]}),Sn=n.selector({key:"sceneTreeColumnsActiveColumns",get:({get:e})=>{const t=e(bn),n=e(rn),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({},fn),{initialWidth:e,minWidth:n})})}return{Name:fn}}}),wn=n.selector({key:"sceneTreeColumnsActiveColumnNames",get:({get:e})=>Object.keys(e(Sn))});function useSceneTreeColumnActions(){return{setActive:useActionCallback((({set:e,snapshot:t})=>async n=>{e(bn,n);const a=await t.getPromise(cn);null==a||a.setMetadataKeys(n)})),refreshKeyList:useActionCallback((({set:e})=>()=>{e(gn,(e=>e+1))}))}}const Vn=16,Cn=-8;var jn;function useOpenColumnPopover({buttonElement:e,horizontalOffset:t,verticalOffset:n}){const[a,s]=u.useState(!1),[o,i]=u.useState(),[l,r]=u.useState(),c=u.useCallback((()=>{if(a)s(!1);else{const a=null==e?void 0:e.getBoundingClientRect();if(null!=a){const e=null!=t?t:Vn,o=null!=n?n:Cn,l=a.x>window.innerWidth/2?jn.LEFT:jn.RIGHT;i({x:l===jn.LEFT?a.left-e:a.right+e,y:a.top+o}),r(l),s(!0)}}}),[a,e]),d=u.useCallback((()=>{s(!1)}),[]);return{open:a,position:o,direction:l,handleOpen:c,handleClose:d}}!function(e){e.LEFT="left",e.RIGHT="right"}(jn||(jn={}));const Tn=n.atom({key:"sceneTreeSearchActive",default:!1}),kn=n.atom({key:"sceneTreeColumnsPartial",default:!1}),An=n.atom({key:"sceneTreeSearchValue",default:void 0}),Pn=n.atom({key:"sceneTreeSearchExactMatch",default:!1}),En=n.atom({key:"sceneTreeSearchResultCount",default:0}),In=n.atom({key:"sceneTreeSearchActiveColumns",default:[]}),Rn=n.selector({key:"sceneTreeSearchNameColumnActive",get:({get:e})=>{const t=e(In);return 0===t.length||t.includes(fn.metadataKeyName)}});function useSceneTreeSearch({sceneTreeElement:e}){const t=useSceneTreeActions(),s=n.useRecoilValue(Tn),o=n.useSetRecoilState(En),i=n.useSetRecoilState(ut);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)&&o(null==e?void 0:e.totalFilteredRows)}))})),()=>{null==t||t.dispose()}}),[e]),a.useEffect((()=>{if(null!=e){let n;return whenComponentReady(e,(()=>{var a;n=null===(a=null==e?void 0:e.controller)||void 0===a?void 0:a.stateChanged((e=>{var n;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===(n=null==t?void 0:t.node.id)||void 0===n?void 0:n.hex)}else s&&t.flyToFirstSelectedItem()}))})),()=>{null==n||n.dispose()}}}),[e,null==e?void 0:e.controller,open])}function useSceneTreePartialResults({sceneTreeElement:e}){const t=n.useSetRecoilState(kn);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(In,t)})),t=useActionCallback((({snapshot:t})=>async(n,a,s,o)=>{const i=await t.getPromise(rn),l=await t.getPromise(Pn),r=await t.getPromise(In),c=r.length>0?a?[...r,n]:r.filter((e=>e!==n)):[...s,fn.metadataKeyName].filter((e=>e!==n));e(c),o&&(null==i||i.filterItems(o,{columns:c,exactMatch:l}))})),n=useActionCallback((({snapshot:e,set:t})=>async(n,a,s)=>{const o=await e.getPromise(rn),i=await e.getPromise(Pn),l=await e.getPromise(In),r=n.filter((e=>!a.includes(e))),c=a.filter((e=>!n.includes(e))),u=l.length>0?[...l.filter((e=>!r.includes(e))),...c]:[...a,fn.metadataKeyName],d=u.length>0?u:[...a,fn.metadataKeyName];t(In,d),s&&(null==o||o.filterItems(s,{columns:d,exactMatch:i}))})),a=useActionCallback((({set:e})=>t=>{e(Pn,t)}));return{setMetadataSearchKeys:e,updateMetadataSearchAfterSearchKeysChange:t,updateMetadataSearchAfterColumnVisibilityChange:n,setMetadataSearchExactMatch:a}};function useCacheableLoadable(e,t){const s=a.useRef(),[o,i]=a.useState(0),l=n.useRecoilValueLoadable(e);a.useEffect((()=>{"hasValue"===l.state&&(s.current=l.contents)}),[t,l]);const[r,c]=a.useMemo((()=>"hasValue"!==l.state&&null!=s.current?[s.current,!0]:"hasValue"===l.state?[l.contents,!1]:[void 0,!1]),[l.state,l.contents,o]),u=a.useCallback((()=>{s.current=void 0,i(o+1)}),[o]),d=undefined;return a.useMemo((()=>({data:r,state:l.state,cached:c,invalidate:u})),[u,r,c,l.state])}const VertexSceneTreeMetadataCheck=({checked:t,disabled:n,onChange:a,children:s})=>{const i="string"==typeof s?s.replace(" ","-"):"";return e.jsxs("div",{className:"flex items-center",children:[e.jsx(o.VertexToggle,{"data-testid":`scene-tree-metadata-check-${i}`,variant:"check",checked:t,disabled:n,onValueChanged:e=>null==a?void 0:a(e.detail)}),e.jsx("div",{className:"pl-2 py-1 text-[0.875rem] w-full","data-testid":`scene-tree-metadata-name-${i}`,onClick:()=>{n||null==a||a(!t)},children:s})]})},VertexSceneTreeColumnPopover=({onVisibleSceneTreeColumnsChange:t})=>{const a=useSceneTreeColumnActions(),s=useSceneTreeSearchActions(),i=n.useRecoilValue(rn);useSceneTreePartialResults({sceneTreeElement:null!=i?i:null});const r=n.useRecoilValue(An),c=useCacheableLoadable(yn),d=n.useRecoilValue(bn),m=n.useRecoilValue(kn),[p,h]=u.useState(d),[f,g]=u.useState(""),{element:v,callback:b}=useCallbackRef(),{open:S,position:w,direction:V,handleOpen:C,handleClose:j}=useOpenColumnPopover({buttonElement:v}),T=V===jn.LEFT?"left-end":"right-start",k=u.useMemo((()=>{if(null!=c.data){const e=c.data.filter((e=>p.indexOf(e)<0)),t=undefined;return[...[...p].sort(((e,t)=>e.localeCompare(t))),...e]}return[]}),[p,c.data]),A=u.useMemo((()=>k),[S,c.data]);return e.jsxs(e.Fragment,{children:[e.jsx(o.VertexTooltip,{content:"Configure Columns",placement:"top",children:e.jsx(o.VertexIconButton,{"data-testid":"scene-tree-column-popover-button",ref:b,iconName:"columns-add",iconSize:"sm",onClick:()=>{C()}})}),S&&e.jsx(o.VertexPopover,{"data-testid":"scene-tree-column-popover",open:S,backdrop:!1,position:w,resizeBehavior:"fixed",placement:T,className:"z-popover",children:e.jsxs("div",{className:Ce("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!S}),children:[e.jsxs("div",{className:"flex items-center text-[0.875rem] p-3",children:[e.jsxs("div",{className:"pr-2",children:[e.jsx("div",{className:"text-[0.875rem]",children:"Assembly Properties"}),e.jsx("div",{className:"text-[0.75rem] text-neutral-700 mt-1.5",children:"Select up to six properties to appear in the Assembly panel."})]}),e.jsx(o.VertexIconButton,{"data-testid":"scene-tree-columns-popover-close-button",className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{g(""),j()}})]}),e.jsx(o.VertexTextfield,{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&&g(t.toLowerCase())}}),m&&e.jsx(l.VertexSceneTreeNotificationBanner,{"data-testid":"partial-key-list-notification-banner",message:"loading"===c.state?"Refreshing results...":"Data loading, refresh for more.",actionLabel:"Refresh",onAction:()=>a.refreshKeyList()}),e.jsxs("div",{className:"max-h-64 p-3 overflow-y-auto",children:[e.jsx(VertexSceneTreeMetadataCheck,{checked:!0,disabled:!0,children:fn.label}),A.filter((e=>""===f||e.toLowerCase().includes(f))).map((t=>e.jsx(VertexSceneTreeMetadataCheck,{checked:p.includes(t),disabled:p.length>=6&&!p.includes(t),onChange:e=>{h(e?[...p,t]:p.filter((e=>e!==t)))},children:t},t)))]}),e.jsxs("div",{className:"flex items-center p-3 border-t border-neutral-300 space-x-4",children:[e.jsx("div",{className:"text-[0.75rem] text-[var(--vertex-ui-blue-700)] cursor-pointer","data-testid":"scene-tree-column-clear-selection",onClick:()=>h([]),children:"Clear selection"}),e.jsx("div",{className:"flex-grow"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(o.VertexButton,{"data-testid":"scene-tree-column-popover-cancel",color:"secondary",onClick:()=>{g(""),j()},children:"Cancel"}),e.jsx(o.VertexButton,{"data-testid":"scene-tree-column-popover-apply",color:"primary",onClick:async()=>{await s.updateMetadataSearchAfterColumnVisibilityChange(d,p,r),await a.setActive(p),null==t||t(p),g(""),j()},children:"Apply"})]})]})]})})]})},VertexSceneTreeSearchOptionsPopover=({onSearchedSceneTreeColumnsChange:t,onSearchForExactMatchChange:a})=>{const s=useSceneTreeSearchActions(),i=n.useRecoilValue(rn),l=n.useRecoilValue(Rn),r=n.useRecoilValue(In),c=n.useRecoilValue(An),u=n.useRecoilValue(Pn),d=n.useRecoilValue(bn),{element:m,callback:p}=useCallbackRef(),{open:h,position:f,direction:g,handleOpen:v,handleClose:b}=useOpenColumnPopover({buttonElement:m,horizontalOffset:40}),S=g===jn.LEFT?"left-end":"right-start",updateSearch=e=>{if(c){const t=r.length>0?r:[...d,fn.metadataKeyName];null==i||i.filterItems(c,{columns:t,exactMatch:e})}};return e.jsxs(e.Fragment,{children:[e.jsx(o.VertexTooltip,{content:"Search Options",placement:"top",children:e.jsx(o.VertexIconButton,{"data-testid":"scene-tree-search-options-popover-button",ref:p,iconName:"gear",iconSize:"sm",onClick:()=>{v()}})}),e.jsx(o.VertexPopover,{"data-testid":"scene-tree-search-options-popover",open:h,backdrop:!1,position:f,resizeBehavior:"fixed",placement:S,className:"z-popover",children:e.jsxs("div",{className:Ce("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!h}),children:[e.jsxs("div",{className:"flex items-center text-[0.875rem] p-3 border-b border-neutral-300 pb-2",children:[e.jsx("div",{className:"pr-2 text-[0.875rem] whitespace-nowrap",children:"Column Properties Search"}),e.jsx(o.VertexIconButton,{className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{b()}})]}),e.jsxs("div",{className:"max-h-64 p-3 overflow-y-auto",children:[e.jsx("div",{className:"text-[0.875rem] pb-2 pr-2",children:"Select properties to perform the search on:"}),e.jsx(VertexSceneTreeMetadataCheck,{checked:l,disabled:0===r.length||r.every((e=>e===fn.metadataKeyName)),onChange:async e=>{await s.updateMetadataSearchAfterSearchKeysChange(fn.metadataKeyName,e,d,c),null==t||t()},children:fn.label},fn.metadataKeyName),d.map((n=>e.jsx(VertexSceneTreeMetadataCheck,{checked:r.includes(n),disabled:r.length>0&&r.every((e=>e===n)),onChange:async e=>{await s.updateMetadataSearchAfterSearchKeysChange(n,e,d,c),null==t||t()},children:n},n)))]}),e.jsxs("div",{className:"flex p-3 border-t border-neutral-300",children:[e.jsx(o.VertexToggle,{className:"flex items-center","data-testid":"filter-exact-match-toggle",variant:"switch",checked:u,onValueChanged:async e=>{s.setMetadataSearchExactMatch(e.detail),null==a||a(),updateSearch(e.detail)}}),e.jsx("span",{className:"pl-4 text-[0.875rem] text-neutral-800",children:"Return only exact matches"})]})]})})]})},VertexSceneTreeSearchBar=({onSearch:t,onClearSearch:a,onExitSearchMode:s,onSearchedSceneTreeColumnsChange:i,onSearchForExactMatchChange:r,children:c})=>{const d=useSceneTreeActions(),m=n.useRecoilValue(rn),[p,h]=n.useRecoilState(Tn),[f,g]=n.useRecoilState(An);useSceneTreeSearch({sceneTreeElement:null!=m?m:null});const{element:v,callback:b}=useCallbackRef(),S=null==f||""===f,w=S?"Exit Search":"Clear Search";return u.useEffect((()=>{p&&(null==v||v.setFocus())}),[v,p]),e.jsxs("div",{className:"flex w-full py-3 px-2",children:[e.jsx(l.VertexSceneTreeSearch,{"data-testid":"scene-tree-search-bar",ref:b,controller:null==m?void 0:m.controller,onBlur:()=>{S&&(h(!1),null==s||s())},onSearch:()=>{g(null==v?void 0:v.value),null==t||t(null==v?void 0:v.value)},children:c}),e.jsx("div",{className:"self-center px-1",onPointerDown:e=>{e.preventDefault()},children:e.jsx(VertexSceneTreeSearchOptionsPopover,{onSearchedSceneTreeColumnsChange:i,onSearchForExactMatchChange:r})}),e.jsx(o.VertexTooltip,{className:"self-center pr-1",content:w,children:e.jsx(o.VertexIconButton,{"data-testid":"scene-tree-search-close-button",iconName:"close-circle-fill",iconSize:"sm",variant:"plain",onPointerDown:e=>{e.preventDefault()},onClick:async()=>{S?(h(!1),await d.flyToFirstSelectedItem(),null==s||s()):(await(null==v?void 0:v.clear()),await(null==v?void 0:v.setFocus()),g(void 0),null==a||a())}})})]})};function VertexToolbarDivider(){return e.jsx("div",{"data-testid":"toolbar-divider",className:"h-6 w-px bg-neutral-300 mx-1"})}const VertexSceneTreeSearchInformationForToolbar=()=>{const t=useSelectionActions(),a=n.useRecoilValue(rn),s=n.useRecoilValue(An),i=n.useRecoilValue(En),l=undefined,r=undefined,c=`${i>=1e3?`${i}+`:`${i}`} ${1===i?"result":"results"}`;return e.jsxs(e.Fragment,{children:[e.jsx(VertexToolbarDivider,{}),e.jsxs("div",{className:"flex flex-row items-center overflow-hidden",children:[e.jsx("div",{className:"px-2 text-[0.8125rem] leading-4 text-neutral-900 truncate","data-testid":"search-result-info",children:`${c}`}),e.jsx(o.VertexTooltip,{className:"w-auto",content:"Select Results",placement:"top",children:e.jsx(o.VertexButton,{className:"h-6 rounded cursor-pointer","data-testid":"select-search-results-button",color:"secondary",variant:"text",size:"sm",onClick:async()=>{null!=a&&null!=s&&(await a.selectFilteredItems(s),t.toggleLastSelectWasMultiSelect(!0))},children:e.jsxs("div",{className:"flex h-6 items-center gap-1",children:[e.jsx(o.VertexIcon,{size:"sm",name:"check-circle"}),e.jsx("span",{className:"whitespace-nowrap",children:"Select Results"})]})})})]})]})},targetIsElement=(e,t)=>e instanceof Element&&e.tagName===t;function useRecoilRef({state:e}){const t=n.useRecoilCallback((({set:t})=>n=>{t(e,n)}),[]);return t}var Nn;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===Nn.ROBOTO_MONO?"var(--vertex-ui-font-family-monospace)":"var(--vertex-ui-font-family)"}!function(e){e.ROBOTO="ROBOTO",e.ROBOTO_MONO="ROBOTO_MONO"}(Nn||(Nn={}));const VertexEnterSceneTreeSearchModeButton=({onEnterSearchMode:t})=>{const a=n.useSetRecoilState(Tn);return e.jsx(o.VertexTooltip,{className:"flex ml-auto",content:"Scene Tree Search",children:e.jsx(o.VertexIconButton,{"data-testid":"enter-scene-tree-search-mode-button",iconName:"search",iconSize:"sm",onPointerDown:e=>{e.preventDefault()},onClick:()=>{a(!0),null==t||t()}})})},VertexSceneTreeSearch=({onEnterSearchMode:t,onExitSearchMode:a,onSearch:s,onClearSearch:o,onSearchedSceneTreeColumnsChange:i,onSearchForExactMatchChange:r,children:c})=>{const u=n.useRecoilValue(Tn);return e.jsxs(l.VertexSceneTreeToolbar,{className:"h-11 p-0 border-b border-neutral-300 box-content",slot:"header",children:[u&&e.jsx(VertexSceneTreeSearchBar,{onSearch:s,onClearSearch:o,onExitSearchMode:a,onSearchedSceneTreeColumnsChange:i,onSearchForExactMatchChange:r,children:c}),!u&&e.jsx("div",{className:"ml-auto mr-2",children:e.jsx(VertexEnterSceneTreeSearchModeButton,{onEnterSearchMode:t})})]})},VertexSceneTreeCollapseAll=()=>{const t=n.useRecoilValue(rn);return e.jsx(o.VertexTooltip,{className:"w-auto",content:"Collapse All",placement:"top",children:e.jsx(o.VertexIcon,{size:"sm",className:"h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer","data-testid":"collapse-all-icon",name:"collapse-all",onClick:()=>{null==t||t.collapseAll()}})})},VertexSceneTreeExpandAll=()=>{const t=n.useRecoilValue(rn);return e.jsx(o.VertexTooltip,{className:"w-auto",content:"Expand All",placement:"top",children:e.jsx(o.VertexIcon,{size:"sm","data-testid":"expand-all-icon",className:"h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer",name:"expand-all",onClick:()=>{null==t||t.expandAll()}})})},VertexSceneTreeToolbar=({onVisibleSceneTreeColumnsChange:t})=>{const a=n.useRecoilValue(An),s=null==a||""===a;return e.jsx(l.VertexSceneTreeToolbar,{className:"h-10 border-b border-neutral-300 box-border",children:e.jsxs("div",{className:"flex w-full text-neutral-700 items-center gap mx-2",children:[e.jsx(VertexSceneTreeExpandAll,{}),e.jsx(VertexSceneTreeCollapseAll,{}),!s&&e.jsx(VertexSceneTreeSearchInformationForToolbar,{}),e.jsx("div",{className:"ml-auto",children:e.jsx(VertexSceneTreeColumnPopover,{onVisibleSceneTreeColumnsChange:t})})]})})},VertexSceneTreeHeader=({onEnterSearchMode:t,onExitSearchMode:n,onSearch:a,onClearSearch:s,onVisibleSceneTreeColumnsChange:o,children:i})=>{const l=null!=i&&!1!==i;return e.jsx("div",{slot:"header",className:"flex flex-col",children:l?i:e.jsxs(e.Fragment,{children:[e.jsx(VertexSceneTreeSearch,{onEnterSearchMode:t,onExitSearchMode:n,onSearch:a,onClearSearch:s,children:e.jsx("div",{slot:"clear-icon"})}),e.jsx(VertexSceneTreeToolbar,{onVisibleSceneTreeColumnsChange:o})]})})},VertexSceneTreeTableLayout=t=>{const a=n.useRecoilValue(Sn),s=n.useRecoilValue(wn),o=[];return e.jsx(l.VertexSceneTreeTableLayout,Object.assign({"data-testid":"scene-tree-table-layout"},t,{children:s.map(((t,n)=>{var i;const r=a[t],c=null!==(i=o[n])&&void 0!==i?i:r.initialWidth;return e.jsxs(l.VertexSceneTreeTableColumn,{"data-testid":`scene-tree-table-column-${n}`,initialWidth:c,minWidth:r.minWidth,children:[e.jsx("template",{slot:"header",dangerouslySetInnerHTML:{__html:`\n <div class="text-sm text-neutral-800 my-2">\n <div class="${Ce("truncate",{"pl-2":0===n,"pr-2":n===s.length-1})}">\n ${r.label}\n </div>\n </div>\n `}}),e.jsx("template",{dangerouslySetInnerHTML:{__html:`\n <vertex-scene-tree-table-cell\n prop:value="${r.binding}"\n prop:selection-handler="{{row.data.handleSelection}}"\n prop:expansion-handler="{{row.data.handleExpansion}}"\n prop:visibility-handler="{{row.data.handleVisibility}}"\n ${0===n?"expand-toggle":""}\n ${n===s.length-1?"isolate-button visibility-toggle":""}>\n <div class="flex items-center gap-2">\n <vertex-tooltip \n class="truncate" \n prop:content="${null!=r.binding?r.binding:"--"}" \n placement="${n!==s.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=t=>{var{id:s,font:o,backgroundColors:i,children:r,style:c,onPointerDown:u,onClick:d,onToggleSelection:m,onToggleExpansion:p,onToggleVisibility:h,className:f,rowData:g}=t,v=__rest(t,["id","font","backgroundColors","children","style","onPointerDown","onClick","onToggleSelection","onToggleExpansion","onToggleVisibility","className","rowData"]);const b=useSceneTreeActions(),S=useSelectionActions(),w=n.useRecoilValue(hn),V=n.useRecoilValue(M),C=n.useRecoilValue(In),j=n.useRecoilValue(Pn),T=n.useRecoilValue(An),k=null==T||""===T,A=useRecoilRef({state:rn}),P=null!=r&&!1!==r,wrappedExpansionHandler=(e,t,n)=>{b.toggleExpansion(e,t,n),null==p||p(e,t,n)},wrappedSelectionHandler=(e,t,n)=>{b.toggleSelection(e,t,n),null==m||m(e,t,n)},wrappedVisibilityHandler=(e,t,n)=>{b.toggleVisibility(e,t,n),null==h||h(e,t,n)},handleClick=e=>{e.altKey&&b.flyToRow(e.clientY),null==d||d(e)},handlePointerDown=e=>{targetIsElement(e.target,"VERTEX-SCENE-TREE-TABLE-COLUMN")&&S.clearSelection(),null==u||u(e)},E=n.useSetRecoilState(cn),handleFirstRowRendered=e=>{var t;E(e.target.controller),null===(t=null==v?void 0:v.onFirstRowRendered)||void 0===t||t.call(v,e)},I=a.useMemo((()=>({metadataSearchKeys:C,exactMatch:j})),[C,j]);return e.jsx("div",{className:Ce("flex flex-col w-full h-full",f),children:e.jsx("div",{className:"flex group h-full",children:e.jsx(l.VertexSceneTree,Object.assign({id:null!=s?s:"vertex-scene-tree","data-testid":"vertex-scene-tree",config:w,ref:A,className:Ce("flex-1",{filtered:!k}),style:Object.assign(Object.assign(Object.assign({},styleFromOptionalFont(o)),styleFromOptionalBackgroundColors(i)),c),onConnectionError:e=>{logger_error("Scene Tree Connection Error: ",e.detail)},viewer:V,onPointerDown:handlePointerDown,onClick:handleClick,rowData:e=>{var t;const n=null!==(t=null==g?void 0:g(e))&&void 0!==t?t:{};return Object.assign({handleExpansion:wrappedExpansionHandler,handleSelection:wrappedSelectionHandler,handleVisibility:wrappedVisibilityHandler},n)},searchOptions:I},v,{onFirstRowRendered:handleFirstRowRendered,children:P?r:e.jsxs(e.Fragment,{children:[e.jsx(VertexSceneTreeHeader,{}),e.jsx(VertexSceneTreeTableLayout,{}),e.jsx(VertexSceneTreeContextMenu,{})]})}))})})},VertexDecimalPlaceSelector=({onApply:t})=>{const[a,s]=n.useRecoilState(yt);return e.jsxs(o.VertexSelect,{"data-testid":"decimal-place-select",className:"w-24",value:a,onOptionChanged:e=>{s(e.detail),null==t||t(e.detail)},children:[e.jsx("div",{className:"py-1.5 px-3",children:"0"}),e.jsx("div",{className:"py-1.5 px-3",children:"1"}),e.jsx("div",{className:"py-1.5 px-3",children:"2"}),e.jsx("div",{className:"py-1.5 px-3",children:"3"})]})},VertexLengthUnitSelector=({onApply:t})=>{const[a,s]=n.useRecoilState(vt);return e.jsxs(o.VertexSelect,{"data-testid":"length-unit-select",className:"w-40",value:a,onOptionChanged:e=>{s(e.detail),null==t||t(e.detail)},children:[e.jsx("div",{"data-value":"cm",className:"py-1.5 px-3",children:"centimeters"}),e.jsx("div",{"data-value":"mm",className:"py-1.5 px-3",children:"millimeters"}),e.jsx("div",{"data-value":"m",className:"py-1.5 px-3",children:"meters"}),e.jsx("div",{"data-value":"in",className:"py-1.5 px-3",children:"inches"}),e.jsx("div",{"data-value":"ft",className:"py-1.5 px-3",children:"feet"})]})};function VertexUnitsControls({onUnitChange:t,onDecimalPlaceChange:n}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Length Unit"}),e.jsx(VertexLengthUnitSelector,{onApply:t})]}),e.jsxs("div",{children:[e.jsx("div",{className:"pt-2 pb-2 text-sm text-neutral-700",children:"Decimals"}),e.jsx(VertexDecimalPlaceSelector,{onApply:n})]})]})}function VertexUnitsPanelSection({onUnitChange:t,onDecimalPlaceChange:n}){return e.jsx(PanelSection,{header:e.jsx("div",{className:"flex items-center text-base",children:"Units"}),children:e.jsx(VertexUnitsControls,{onUnitChange:t,onDecimalPlaceChange:n})})}const On=n.atom({key:"openedPanelActivePrimaryLeft",default:void 0}),Mn=n.atom({key:"openedPanelActivePrimaryRight",default:void 0});function usePanelActions(){return{openPrimary:useActionCallback((({set:e})=>(t,n)=>{e("left"===n?On:Mn,t)})),closePrimary:useActionCallback((({set:e})=>t=>{e("left"===t?On:Mn,void 0)}))}}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 DefaultAppearancePanel(){return e.jsxs("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:[e.jsx(VertexMaterialPanelSection,{}),e.jsx(VertexGhostingPanelSection,{}),e.jsx(VertexFeatureEdgesPanelSection,{}),e.jsx(VertexViewerBackgroundPanelSection,{}),e.jsx(VertexSelectionHighlightingPanelSection,{}),e.jsx(VertexCrossSectionAppearancePanelSection,{})]})}function DefaultSettingsPanel(){return e.jsx("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e.jsx(VertexUnitsPanelSection,{})})}const VertexTransformClear=({onClear:t,onClearAll:s})=>{const i=useTransformActions(),l=useCacheableLoadable(gt),r=n.useRecoilValue(dt),c=useCacheableLoadable(Et(null!=r?r:"")),u=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!=c.data;return t||n}),[l,c]);return e.jsx("div",{className:"ml-auto",children:e.jsxs(ResetButton,{id:"transforms",tooltip:"Clear Transforms",children:[e.jsx("div",{className:"pt-1"}),e.jsx(o.VertexMenuItem,{"data-testid":"clear-selected-transforms",onClick:async()=>{await i.clearSelectedTransforms(),null==t||t()},disabled:!u,children:"Clear selected transforms"}),e.jsx(o.VertexMenuItem,{"data-testid":"clear-all-transforms",onClick:async()=>{await i.clearAllTransforms(),null==s||s()},children:"Clear all transforms"})]})})},VertexTransformNumericField=({bottomLabel:t,value:s,step:o,min:i,max:l,disabled:r,testId:c,onBlur:u,onInput:d,onChange:m})=>{const p=a.useRef(null),h=n.useRecoilValue(yt),[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==s?void 0:s.toFixed(Number(h)))&&void 0!==e?e:"":g(!0)}),[s]);const v=a.useCallback((e=>{g(!1),null==m||m(e)}),[g,m]),b=a.useCallback((e=>{g(!0),null==u||u(e),null!=p.current&&null!=s&&(p.current.value=s.toFixed(Number(h)))}),[u,s,g]);return e.jsxs("div",{children:[e.jsx("div",{className:"truncate rounded-md w-full",children:e.jsx("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:o,min:i,max:l,"data-testid":c,disabled:r,defaultValue:Number.isNaN(s)?"":null==s?void 0:s.toFixed(Number(h)),onBlur:b,onInput:d,onChange:v})}),null!=t&&e.jsx("div",{className:"flex justify-center items-center pointer-events-none text-neutral-500",children:e.jsx("span",{children:t})})]})},VertexTransformInputs=({onUpdateTransform:t})=>{const a=n.useRecoilValue(vt),s=n.useRecoilValue(ct),o=n.useRecoilValue(rt),i=s||o,l=n.useRecoilValue(dt),{transform:r,error:c,update:u}=useEditItemTransform(l),d=i?void 0:r,m=useDebouncedCallback((async e=>{await u(e),null==t||t(e)}),50);function updateTransform(e){return t=>{if(null!=d){const n=parseFloat(t.currentTarget.value);Number.isNaN(n)||null==m||m(Object.assign(Object.assign({},d),e(n,d)))}}}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),s=undefined;(isNaN(a)||!!(null==t?void 0:t(a)))&&null!=d&&m(A.defaults(e,d))}}return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 text-[0.8125rem]",children:[e.jsx("span",{className:"flex w-full items-center mt-3 mb-1",children:"Position"}),e.jsxs("div",{className:"flex flex-wrap w-full gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"X"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"position-x",value:null!=d?d.position.x:void 0,bottomLabel:a,disabled:null==d,onChange:updatePosition((e=>({x:e}))),onBlur:updateToDefaultValueIfInvalid({position:{x:0}})})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"Y"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"position-y",value:null==d?void 0:d.position.y,bottomLabel:a,disabled:null==d,onChange:updatePosition((e=>({y:e}))),onBlur:updateToDefaultValueIfInvalid({position:{y:0}})})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"Z"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"position-z",value:null==d?void 0:d.position.z,bottomLabel:a,disabled:null==d,onChange:updatePosition((e=>({z:e}))),onBlur:updateToDefaultValueIfInvalid({position:{z:0}})})})]})]})]}),e.jsxs("div",{className:"mb-2 text-[0.8125rem]",children:[e.jsx("span",{className:"flex w-full items-center mt-3 mb-1",children:"Rotation"}),e.jsxs("div",{className:"flex flex-wrap w-full gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"X"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"rotation-x",value:null==d?void 0:d.rotation.x,bottomLabel:"deg",disabled:null==d,onChange:updateRotation((e=>({x:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{x:0}})})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"Y"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"rotation-y",value:null==d?void 0:d.rotation.y,bottomLabel:"deg",disabled:null==d,onChange:updateRotation((e=>({y:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{y:0}})})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"Z"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"rotation-z",value:null==d?void 0:d.rotation.z,bottomLabel:"deg",disabled:null==d,onChange:updateRotation((e=>({z:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{z:0}})})})]})]})]}),e.jsxs("div",{className:"mb-2 text-[0.8125rem]",children:[e.jsx("span",{className:"flex w-full items-center mt-3 mb-1",children:"Scale"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"scale",value:null==d?void 0:d.scale,step:.1,min:.1,disabled:null==d,onChange:updateScale(),onBlur:updateToDefaultValueIfInvalid({scale:1},(e=>e<=0))})}),i&&e.jsx("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!=c&&e.jsx("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 a=useTransformActions(),s=n.useRecoilValue(Vt),i=n.useSetRecoilState(Rt);return e.jsx(o.VertexToggle,{className:"flex items-center","data-testid":"transform-widget-toggle",variant:"switch",checked:s,onValueChanged:async()=>{s?(a.disableTransformWidget(),null==t||t(!1)):(i("world"),await a.enableTransformWidget(),null==t||t(!0))}})};function VertexTransformControls({onToggleTransformsManipulator:t,onUpdateTransform:n}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center py-3",children:[e.jsx(VertexTransformManipulatorToggle,{onToggleTransformsManipulator:t}),e.jsx("span",{className:"pl-4 text-[0.8125rem] text-neutral-700",children:"Enable manipulator"})]}),e.jsx(VertexTransformInputs,{onUpdateTransform:n})]})}function VertexTransformPanelSection({onClearTransforms:t,onClearAllTransforms:n,onToggleTransformsManipulator:a,onUpdateTransform:s}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Manual Part Transforms",e.jsx(VertexTransformClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexTransformControls,{onToggleTransformsManipulator:a,onUpdateTransform:s})})}function DefaultTransformsPanel(){return e.jsx("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e.jsx(VertexTransformPanelSection,{})})}const Ln="Appearance",Bn="Settings",_n="Transforms",ViewerRightPanelHeader=({additionalHeaderMap:t})=>{const a=undefined,s=getHeading(n.useRecoilValue(Mn),t);return e.jsx("div",{className:"flex flex-col w-full items-center z-overlay pointer-events-none md:pointer-events-auto py-3 px-4 border-b border-neutral-300",children:e.jsx("div",{className:"items-center w-full leading-6 text-md align-center font-medium text-neutral-800",children:s})})};function getHeading(e,t={}){switch(e){case"appearance":return Ln;case"settings":return Bn;case"transforms":return _n;default:const n=null!=e?t[e]:void 0;return null!=n?n:"None"}}function VertexViewerRightOpenedPanel({children:t}){const s=n.useRecoilValue(Mn),o=a.useMemo((()=>filterChildElements(t,CustomPanelContent)),[t]),i=a.useMemo((()=>o.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.props.panelName]:t.props.panelTitle})),{})),[o]),l=a.useMemo((()=>["appearance","settings","transforms",...o.map((e=>e.props.panelName))]),[o]);return e.jsx(e.Fragment,{children:null!=s&&l.includes(s)&&e.jsxs(VertexResizableContent,{displayShadow:!0,heading:e.jsx(ViewerRightPanelHeader,{additionalHeaderMap:i}),placement:"right",children:["appearance"===s&&e.jsx(DefaultAppearancePanel,{}),"transforms"===s&&e.jsx(DefaultTransformsPanel,{}),"settings"===s&&e.jsx(DefaultSettingsPanel,{}),t]})})}function CustomPanelContent({panelName:t,children:a}){const s=n.useRecoilValue(Mn);return e.jsx(e.Fragment,{children:s===t&&a})}function Sidebar({children:t}){return e.jsx("div",{className:"pointer-events-auto flex flex-col items-center w-full border-neutral-300 py-2",children:t})}function SidebarIcon({name:t,iconName:n,active:s,responsive:i,disabled:l,content:r,tooltipPlacement:c,children:u,onSelect:d,onDeselect:m}){return e.jsx("div",{className:Ce({"text-[var(--vertex-ui-blue-700)]":s===t&&!l,"text-neutral-700 hover:text-neutral-800":s!==t&&!l,"cursor-pointer hover:bg-neutral-200":!l,"text-neutral-400":l,"rounded-full md:p-3":i,"p-3":!i&&null==u,"px-3 py-1":null!=u}),"data-testid":`${t}-sidebar-panel`,onClick:()=>{l||(s===t?m():d())},children:e.jsxs(o.VertexTooltip,{placement:null!=c?c:void 0,content:a.isValidElement(r)?void 0:r,children:[e.jsx("div",{slot:"content",children:r}),e.jsx("div",{className:"flex flex-col",children:null!=u?u:e.jsx(o.VertexIcon,{name:n})})]})})}function VertexViewerRightSidebar({children:t}){const a=usePanelActions(),s=useTransformActions(),o=n.useRecoilValue(Mn);return e.jsx("div",{className:"flex flex-col flex-shrink-0 items-center relative border-neutral-300 border-l bg-white h-full top-0 min-w-12 w-12",children:e.jsxs(Sidebar,{children:[t,e.jsx(SidebarIcon,{name:"appearance",active:o,iconName:"adjustments",tooltipPlacement:"right",content:"Appearance",onSelect:()=>{a.openPrimary("appearance","right")},onDeselect:()=>a.closePrimary("right")}),e.jsx(SidebarIcon,{name:"transforms",active:o,iconName:"show-only-nearby",tooltipPlacement:"right",content:"Transforms",onSelect:async()=>{a.openPrimary("transforms","right"),await s.enableTransformWidget(void 0,!0)},onDeselect:()=>a.closePrimary("right")}),e.jsx(SidebarIcon,{name:"settings",active:o,iconName:"gear",tooltipPlacement:"right",content:"Settings",onSelect:()=>{a.openPrimary("settings","right")},onDeselect:()=>a.closePrimary("right")})]})})}function CustomPanelIcon(t){const a=usePanelActions(),s=n.useRecoilValue(Mn),{panelName:o,tooltipContent:i,iconName:l}=t,r=__rest(t,["panelName","tooltipContent","iconName"]);if(null==l&&null==r.children)throw new Error('CustomPanelIcon must contain either a Vertex "iconName" or custom "children"');return e.jsx(SidebarIcon,Object.assign({},r,{name:o,iconName:null!=l?l:"help",active:s,content:i,onSelect:()=>{a.openPrimary(t.panelName,"right")},onDeselect:()=>{a.closePrimary("right")}}))}VertexViewerRightOpenedPanel.CustomPanelContent=CustomPanelContent,VertexViewerRightSidebar.CustomPanelIcon=CustomPanelIcon;const VertexPopupButton=t=>{var{open:n,children:a}=t,s=__rest(t,["open","children"]);const i=a.find((e=>e.type===Anchor)),l=a.filter((e=>e.type!==Anchor));return null==i?e.jsx(e.Fragment,{}):e.jsxs(o.VertexPopover,Object.assign({className:"flex",placement:"top",backdrop:!1,open:asBooleanAttribute(n)},s,{children:[i,e.jsx("div",{className:Ce("flex mb-1.5",{hidden:!n}),"data-testid":"align-plane-popover-menu",children:l})]}))},Anchor=({tooltipContent:t,children:n})=>e.jsx("div",{slot:"anchor",children:e.jsx(o.VertexTooltip,{className:"cursor-pointer",content:t,children:n})});function VertexViewerCrossSectionAlignmentPopoverMenu(){const t=useCrossSectioningActions(),a=n.useRecoilValue(de),s=n.useRecoilValue(ne),getBaseIcon=()=>`align-to-${null==s?void 0:s.mode}`;return useStackKeyBinding({id:"CrossSectionAlignment",keyBind:"Escape",fn:t.cancelCurrentHit,addPredicate:()=>{var e;return null!==(e=null==s?void 0:s.hitPending)&&void 0!==e&&e},cancelPredicate:()=>!(null==s?void 0:s.hitPending)},[null==s?void 0:s.hitPending]),e.jsxs(VertexPopupButton,{"data-testid":"section-alignment-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(a),onDismissed:t.closeAlignmentTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Section Alignment",children:e.jsx(o.VertexIconButton,{"data-testid":"section-alignment-icon-button",iconName:getBaseIcon(),iconColor:"secondary",onClick:a?t.closeAlignmentTools:t.openAlignmentTools,children:e.jsx(o.VertexIcon,{"data-testid":"section-alignment-icon-chevron",name:"chevron-up",size:"sm"})})}),e.jsxs(l.VertexViewerToolbarGroup,{direction:"vertical",className:"flex justify-evenly items-center py-1 my-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(o.VertexIconButton,{iconColor:"secondary",onClick:()=>t.updateAlignment("global"),className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2","data-testid":"section-alignment-align-global",iconName:"align-to-global",variant:"plain",children:e.jsx("div",{className:"text-base ml-2",children:"Align to Global"})}),e.jsx(o.VertexIconButton,{iconColor:"secondary",onClick:()=>t.updateAlignment("surface"),className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2","data-testid":"section-alignment-align-surface",iconName:"align-to-surface",variant:"plain",children:e.jsx("div",{className:"text-base ml-2",children:"Align to Surface"})})]})]})}function VertexViewerCrossSectionAxisPopoverMenu(){const t=useCrossSectioningActions(),s=n.useRecoilValue(me),i=n.useRecoilValue(te),r=n.useRecoilValueLoadable(ie),c=a.useMemo((()=>{const e=i.length>0&&"hasValue"===r.state?axis(i[0],xAxis(r.contents),yAxis(r.contents),zAxis(r.contents)):"x";return null!=e?`axis-${e}`:"axis-x"}),[r.state,r.contents,i]);return e.jsxs(VertexPopupButton,{"data-testid":"align-plane-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(s),onDismissed:t.closeAxisTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Align Plane",children:e.jsx(o.VertexIconButton,{onClick:s?t.closeAxisTools:t.openAxisTools,iconName:c,"data-testid":"align-plane-icon",iconColor:"secondary",children:e.jsx(o.VertexIcon,{"data-testid":"align-plane-icon-chevron",name:"chevron-up",size:"sm"})})}),e.jsxs(l.VertexViewerToolbarGroup,{direction:"vertical",className:"flex justify-evenly items-center py-1 my-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(o.VertexIconButton,{"data-testid":"align-plane-x-axis-button",className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2",onClick:()=>t.updateAxis("x"),variant:"plain",iconColor:"secondary",iconName:"axis-x",children:e.jsx("div",{className:"text-base ml-2",children:"X-axis Plane"})}),e.jsx(o.VertexIconButton,{className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2",variant:"plain",iconColor:"secondary",iconName:"axis-y","data-testid":"align-plane-y-axis-button",onClick:()=>t.updateAxis("y"),children:e.jsx("div",{className:"text-base ml-2",children:"Y-axis Plane"})}),e.jsx(o.VertexIconButton,{"data-testid":"align-plane-z-axis-button",className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2",onClick:()=>t.updateAxis("z"),variant:"plain",iconColor:"secondary",iconName:"axis-z",children:e.jsx("div",{className:"text-base ml-2",children:"Z-axis Plane"})})]})]})}function VertexViewerCrossSectionOffsetStepper({offset:t,onOffsetChange:s}){const i=n.useRecoilValue(vt),l=n.useRecoilValue(yt),[r,c]=a.useState(convertTo(t,i));a.useEffect((()=>{c(convertTo(t,i))}),[i,t]);const u=createDistanceFormatter(i,parseInt(l,10)),handleIncrementalUpdate=e=>{const t=convertFrom(r+e,i);s(t)},handleSubmit=e=>{e.preventDefault(),s(convertFrom(r,i))},handleBlur=()=>{s(convertFrom(r,i))};return e.jsx(o.VertexTooltip,{content:"Plane Offset",children:e.jsx("form",{"data-testid":"cross-section-stepper-form",onSubmit:handleSubmit,children:e.jsxs(o.VertexTextfield,{"data-testid":"cross-section-stepper-input",className:"viewer-toolbar-input w-32 border-none ring-0 bg-white",type:"text",value:u(parseFloat(t.toFixed(3))),onInputInput:e=>{c(null!=e.detail.value?parseFloat(e.detail.value):t)},onBlur:handleBlur,children:[e.jsx("div",{"data-testid":"cross-section-stepper-decrement",className:"py-1 cursor-pointer",slot:"left",onClick:()=>handleIncrementalUpdate(-1),children:e.jsx(o.VertexIcon,{name:"chevron-left",size:"sm"})}),e.jsx("div",{"data-testid":"cross-section-stepper-increment",className:"py-1 cursor-pointer",slot:"right",onClick:()=>handleIncrementalUpdate(1),children:e.jsx(o.VertexIcon,{name:"chevron-right",size:"sm"})})]})})})}VertexPopupButton.Anchor=Anchor;const Dn=400;function VertexViewerCrossSectionPopupMenu(){const t=useCrossSectioningActions(),s=n.useRecoilValue(ue),i=n.useRecoilValueLoadable(re),r=n.useRecoilValueLoadable(ce),c=a.useRef(),u=a.useMemo((()=>"hasValue"===i.state?i.contents:Z),[i.state,i.contents]),d=a.useMemo((()=>"hasValue"===r.state?r.contents:0),[r.state,r.contents]),handleCrossSectionValueChange=e=>{clearTimeout(c.current),c.current=window.setTimeout((()=>{t.endInteraction()}),Dn),t.beginInteraction(),t.updatePlanes(e)};return e.jsxs(VertexPopupButton,{"data-testid":"cross-section-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(s),onDismissed:t.closeAdditionalTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Section Tools",children:e.jsx("div",{className:"-ml-px py-1.5",children:e.jsx(o.VertexIcon,{"data-testid":"cross-section-popover-icon",name:"chevron-up",size:"sm",onClick:s?t.closeAdditionalTools:t.openAdditionalTools})})}),e.jsxs(l.VertexViewerToolbarGroup,{className:"relative bottom-3 flex justify-evenly items-center p-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(VertexViewerCrossSectionAlignmentPopoverMenu,{}),e.jsx(o.VertexTooltip,{className:"w-auto",content:"Reverse",children:e.jsx(o.VertexIconButton,{iconName:"flip","data-testid":"viewer-toolbar-flip-button",onClick:t.flipPlanes,iconColor:"secondary"})}),e.jsx(o.VertexTooltip,{className:"w-auto",content:"Align View to Plane",children:e.jsx(o.VertexIconButton,{"data-testid":"viewer-toolbar-align-view-to-plane-button",iconName:"align-view-to-plane",onClick:t.alignViewToPlane,iconColor:"secondary"})}),e.jsx(VertexToolbarDivider,{}),e.jsx(VertexViewerCrossSectionAxisPopoverMenu,{}),e.jsx("div",{className:"w-52 mx-2",children:e.jsx(VertexSlider,{value:d,defaultValue:u.default,disabled:asBooleanAttribute("hasValue"!==i.state),min:u.min,max:u.max,step:.01,onChange:handleCrossSectionValueChange})}),e.jsx("div",{className:"px-4",children:e.jsx(VertexViewerCrossSectionOffsetStepper,{offset:"hasValue"===r.state?r.contents:0,onOffsetChange:handleCrossSectionValueChange})})]})]})}const VertexViewerCrossSectionButton=()=>{const t=useCrossSectioningActions(),a=n.useRecoilValue(J);return e.jsxs(e.Fragment,{children:[e.jsx(o.VertexTooltip,{content:a?"Hide Section":"Show Section",children:e.jsx(o.VertexIconButton,{"data-testid":"viewer-toolbar-cross-section-button",iconName:"cross-section",iconColor:a?"primary":"secondary",onClick:()=>a?t.disable():t.enable()})}),e.jsx(VertexViewerCrossSectionPopupMenu,{})]})},VertexFitAllButton=()=>{const t=n.useRecoilValue(M);return e.jsx(o.VertexTooltip,{content:"Fit All",children:e.jsx(o.VertexIconButton,{iconName:"fit-all",iconColor:"secondary","data-testid":"viewer-toolbar-fit-all-button",onClick:async()=>{const e=await(null==t?void 0:t.scene());await(null==e?void 0:e.camera().viewAll().render({animation:{milliseconds:500}}))}})})},VertexPanButton=()=>{const t=n.useRecoilValue(M),s=n.useRecoilValue(B),[i,l]=n.useRecoilState(D),[r,c]=n.useRecoilState(_);return a.useEffect((()=>{null!=t&&s&&c(t.getBaseInteractionHandler())}),[t,s,c]),e.jsx(o.VertexTooltip,{content:"Pan",children:e.jsx(o.VertexIconButton,{iconName:"pan",iconColor:"pan"===i?"primary":"secondary","data-testid":"viewer-toolbar-pan-button",onClick:async()=>{if(l("pan"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("pan")}}})})},VertexRotateButton=()=>{const t=n.useRecoilValue(M),s=n.useRecoilValue(B),[i,l]=n.useRecoilState(D),[r,c]=n.useRecoilState(_);return a.useEffect((()=>{null!=t&&s&&c(t.getBaseInteractionHandler())}),[t,s,c]),e.jsx(o.VertexTooltip,{content:"Rotate",children:e.jsx(o.VertexIconButton,{iconName:"rotate",iconColor:"rotate"===i?"primary":"secondary","data-testid":"viewer-toolbar-rotate-button",onClick:async()=>{if(l("rotate"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("rotate")}}})})},VertexZoomButton=()=>{const t=n.useRecoilValue(M),s=n.useRecoilValue(B),[i,l]=n.useRecoilState(D),[r,c]=n.useRecoilState(_);return a.useEffect((()=>{null!=t&&s&&c(t.getBaseInteractionHandler())}),[t,s,c]),e.jsx(o.VertexTooltip,{content:"Zoom",children:e.jsx(o.VertexIconButton,{iconName:"zoom",iconColor:"zoom"===i?"primary":"secondary","data-testid":"viewer-toolbar-zoom-button",onClick:async()=>{if(l("zoom"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("zoom")}}})})},DefaultToolbar=()=>e.jsx(l.VertexViewerToolbar,{placement:"bottom-center",children:e.jsxs(l.VertexViewerToolbarGroup,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(VertexRotateButton,{}),e.jsx(VertexPanButton,{}),e.jsx(VertexZoomButton,{}),e.jsx(VertexFitAllButton,{}),e.jsx(VertexToolbarDivider,{}),e.jsx(VertexBoxSelectionButton,{}),e.jsx(VertexToolbarDivider,{}),e.jsx(VertexViewerCrossSectionButton,{}),e.jsx(VertexToolbarDivider,{}),e.jsx(VertexPointToPointMeasurementTool,{}),e.jsx(VertexPreciseMeasurementTool,{})]})}),VertexToolbar=({children:t})=>{const n=null!=t&&!1!==t;return e.jsx(l.VertexViewerToolbar,{placement:"bottom-center",children:n?e.jsx(l.VertexViewerToolbarGroup,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:t}):e.jsx(DefaultToolbar,{})})};function VertexTransformWidget({transformWidgetElement:t,supportUndo:s,onPositionChange:o,onRotationChange:i}){const r=useTransformActions(),c=n.useRecoilValue(At),u=n.useRecoilValue(Vt),d=n.useRecoilValue(Ct),m=n.useRecoilValue(kt),p=n.useRecoilValueLoadable(Tt),h=n.useRecoilValue(vt),f=n.useRecoilValue(yt),g=a.useMemo((()=>"hasValue"===p.state?p.contents:m),[p,m]),v=a.useMemo((()=>{const e=undefined;return u&&(null!=g||c)}),[u,g,c]);return e.jsx(e.Fragment,{children:v&&e.jsx(l.VertexViewerTransformWidget,{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==s||s,onInteractionStarted:()=>{r.disableSelectionSync(),r.setIsInteractivelyTransforming(!0)},onInteractionEnded:()=>{r.invalidateTransforms(),r.setIsInteractivelyTransforming(!1)},onPositionChanged:async e=>{await r.setTransformWidgetPosition(e.detail),null==o||o(e.detail)},onRotationChanged:e=>{r.setTransformWidgetOrientation(e.detail),null==i||i(e.detail)}})})}const VertexViewerSceneReset=({onReset:t})=>{const n=useCrossSectioningActions(),a=useSelectionActions(),s=useTransformActions(),i=useViewerSceneActions(),handleReset=async()=>{await n.disable(),await a.resetSelectionState(),s.clearTransformWidgetPosition(),await s.invalidateTransforms(),null==t||t(),await i.reset()};return e.jsx(o.VertexTooltip,{content:"Reset View",children:e.jsx(o.VertexIconButton,{iconName:"reset",className:"flex bg-white opacity-70 hover:opacity-100 text-neutral-900 hover:text-neutral-700 hover:bg-neutral-200 rounded p-1 cursor-pointer","data-testid":"viewer-reset-tool-button",onClick:handleReset,variant:"plain"})})};function useViewerFrameActions(){const e=useTransformActions();return{frameDrawn:useActionCallback((({set:t,snapshot:n})=>async a=>{const s=await n.getPromise(pt);t(U,a.detail.scene),t(pt,a.detail.scene.sceneViewSummary.selectedVisibleSummary),t(mt,s);const o=undefined;await n.getPromise(Vt)&&await e.syncToSelection()}))}}const VertexBoxSelectionTool=()=>{const{element:t,callback:a}=useCallbackRef(),s=useBoxSelectionActions(),o=useTransformActions(),i=n.useRecoilValue(Le);return u.useEffect((()=>{const e=whenComponentReady(t,(()=>{var e;return[null===(e=null==t?void 0:t.model)||void 0===e?void 0:e.onDragComplete((()=>{"clearAndSelect"===i&&(o.clearTransformWidgetOrientation(),o.clearTransformWidgetPosition(),o.enableSelectionSync())}))]}));return()=>{null==e||e.then((e=>{null==e||e.forEach((e=>null==e?void 0:e.dispose()))}))}}),[t,i]),useApplyKeyBinding({keyBind:"Shift",fn:u.useCallback((()=>s.setOperationType("select")),[]),off:u.useCallback((()=>s.setOperationType("clearAndSelect")),[])}),e.jsx(l.VertexViewerBoxQueryTool,{ref:a,"data-testid":"viewer-box-query-tool",operationType:i})};function VertexViewerCameraTypeMenu({open:t,onOpen:a,onDismiss:s,onCameraTypeChange:i}){const l=useViewerCameraActions(),r=n.useRecoilValue(K);return e.jsxs(o.VertexMenu,{"data-testid":"camera-types-popover",className:"flex",placement:"bottom-end",open:asBooleanAttribute(t),onMenuClosed:s,children:[e.jsx("div",{slot:"anchor",children:e.jsx("div",{className:Ce("flex bg-white hover:opacity-100 hover:text-neutral-700 hover:bg-neutral-200 rounded",{"opacity-70 text-neutral-900":!t,"opacity-100 text-neutral-700 bg-neutral-200":t}),children:e.jsx(o.VertexTooltip,{content:"Change View",children:e.jsx(o.VertexIconButton,{"data-testid":"set-camera-mode-option",className:"p-1 cursor-pointer",variant:"plain",onClick:a,iconName:"orthographic"===r?"cube-orthographic":"cube-perspective",children:e.jsx(o.VertexIcon,{"data-testid":"change-camera-type-icon-button",name:"chevron-down",size:"sm"})})})})}),e.jsxs("div",{className:"w-36",children:[e.jsx("div",{className:"pt-1"}),e.jsxs(o.VertexMenuItem,{"data-testid":"set-perspective-view",onClick:()=>{l.updateCameraType("perspective"),null==i||i("perspective")},children:[e.jsx(o.VertexIcon,{slot:"icon","data-testid":"set-perspective-view-icon",name:"cube-perspective",size:"sm",className:Ce({"text-[var(--vertex-ui-blue-700)]":"perspective"===r})}),e.jsx("div",{className:Ce("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"perspective"===r}),children:"Perspective"})]}),e.jsxs(o.VertexMenuItem,{"data-testid":"set-orthographic-view",onClick:()=>{l.updateCameraType("orthographic"),null==i||i("orthographic")},children:[e.jsx(o.VertexIcon,{slot:"icon","data-testid":"set-orthographic-view-icon",name:"cube-orthographic",size:"sm",className:Ce({"text-[var(--vertex-ui-blue-700)]":"orthographic"===r})}),e.jsx("div",{className:Ce("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"orthographic"===r}),children:"Orthographic"})]})]})]})}const VertexViewerViewCube=t=>{var{placement:n,children:s}=t,o=__rest(t,["placement","children"]);const i=Array.isArray(s)?s:[s],r=i.filter((e=>!a.isValidElement(e)||e.type!==l.VertexViewerViewCube)).filter((e=>null!=e&&!1!==e)),c=i.find((e=>a.isValidElement(e)&&e.type===l.VertexViewerViewCube)),[u,d]=a.useState(!1);return e.jsxs(l.VertexViewerToolbar,{direction:"vertical","data-testid":"view-cube-toolbar",placement:null!=n?n:"top-right",children:[null!=c?c:e.jsx(l.VertexViewerViewCube,Object.assign({className:"m-7"},o)),0===r.length?e.jsxs("div",{className:"flex items-center justify-center mt-3 gap-1",children:[e.jsx(VertexViewerSceneReset,{}),e.jsx(VertexViewerCameraTypeMenu,{open:u,onDismiss:()=>d(!1),onOpen:()=>d(!0)})]}):e.jsx("div",{className:"mt-3",children:r})]})},VertexViewer=t=>{var{id:s,className:o,disableSelection:i,onTap:r,onLongpress:c,onFrameDrawn:u,onSceneReady:d,viewerRefCallback:m,children:p}=t,h=__rest(t,["id","className","disableSelection","onTap","onLongpress","onFrameDrawn","onSceneReady","viewerRefCallback","children"]);const f=n.useRecoilValue(hn),g=useRecoilRef({state:M}),v=useViewerCameraActions(),b=useHitActions(),S=useSelectionActions(),w=useViewerFrameActions(),[V,C]=n.useRecoilState(B),j=n.useRecoilValue(K),T=n.useRecoilValue(ne),k=n.useRecoilValue(Me),A=n.useSetRecoilState(F),[P,E]=n.useRecoilState(L);a.useEffect((()=>{null!=s&&E(s)}),[s]);const I=n.useRecoilValue(dn),R=a.useMemo((()=>({opacity:I/100})),[I]),N=n.useRecoilValue(ke),O=n.useRecoilValue(Ae),_=a.useMemo((()=>({color:N,width:O})),[N,O]),D=n.useRecoilValue(Jt),H=n.useRecoilValue(nn),U=n.useRecoilValue(an),W=n.useRecoilValue(sn),G=a.useMemo((()=>({color:H,opacity:U/100,lineWidth:W})),[H,U,W]),$=n.useRecoilValue(Fe),q=null!=p&&!1!==p;return useKeyBindings(),useDefaultKeybindings(),e.jsxs(l.VertexViewer,Object.assign({id:P,"data-testid":"vertex-viewer",ref:null!=m?m:g,className:Ce("flex w-full h-full",o,{"cursor-crosshair":T.hitPending}),style:{"--viewer-background":D},config:f,cameraType:V?j:void 0,onCameraTypeChanged:e=>{V&&v.updateCameraType(e.detail)},phantom:R,featureLines:_,selectionHighlighting:G,featureMaps:$?"final":void 0,onTap:e=>{const t=[...i?[]:[S.selectCurrentHit]];b.tap(e,...t),null==r||r(e)},onLongpress:e=>{b.longPress(e),null==c||c(e)},onFrameDrawn:e=>{w.frameDrawn(e),null==u||u(e)},onSceneReady:async e=>{var t;if(!V){C(!0);const n=await(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.scene());A(null==n?void 0:n.sceneViewId)}null==d||d(e)}},h,{children:[k&&e.jsx(VertexBoxSelectionTool,{}),q?p:e.jsxs(e.Fragment,{children:[e.jsx(VertexViewerViewCube,{}),e.jsx(VertexToolbar,{}),e.jsx(VertexViewerContextMenu,{})]})]}))};function toSdkConfig(e){return isOnlyNetworkConfig(e)?{network:e}:e}function isOnlyNetworkConfig(e){const t=undefined;return null!=e.renderingHost}const VertexViewerToolkitEventListener=({onHitStateChange:t,onSelectionStateChange:s})=>{const o=n.useRecoilValue(_t),i=n.useRecoilValue(zt);return a.useEffect((()=>{null==t||t(o)}),[o,t]),a.useEffect((()=>{null==s||s(i)}),[i,s]),e.jsx(e.Fragment,{})},VertexViewerToolkitRoot=t=>{var{override:s,autoDefineCustomElements:o,children:i,config:l}=t,u=__rest(t,["override","autoDefineCustomElements","children","config"]);return a.useEffect((()=>{(null==o||o)&&(c.defineCustomElements(),r.defineCustomElements())}),[o]),e.jsx(n.RecoilRoot,{override:s,children:e.jsxs(e.Fragment,{children:[e.jsx(VertexViewerToolkitEventListener,Object.assign({},u)),e.jsx(VertexViewerToolkitRootConfig,{config:l,children:i})]})})},VertexViewerToolkitRootConfig=({config:t,children:s})=>{const o=n.useSetRecoilState(hn);return a.useEffect((()=>{const e=null!=t?toSdkConfig(t):void 0;o(e)}),[t,o]),e.jsx(e.Fragment,{children:s})};var zn=Object.freeze({__proto__:null,get AssemblyFontFace(){return Nn}});exports.CrossSection=Se,exports.Hits=Dt,exports.SceneTree=zn,exports.Selection=Ft,exports.VertexApplicationMessages=VertexApplicationMessages,exports.VertexBoxSelectionButton=VertexBoxSelectionButton,exports.VertexContextMenu=VertexContextMenu,exports.VertexCrossSectionAppearanceColorPicker=VertexCrossSectionAppearanceColorPicker,exports.VertexCrossSectionAppearanceControls=VertexCrossSectionAppearanceControls,exports.VertexCrossSectionAppearanceLineThicknessSlider=VertexCrossSectionAppearanceLineThicknessSlider,exports.VertexCrossSectionAppearancePanelSection=VertexCrossSectionAppearancePanelSection,exports.VertexCrossSectionAppearanceReset=VertexCrossSectionAppearanceReset,exports.VertexDecimalPlaceSelector=VertexDecimalPlaceSelector,exports.VertexFeatureEdgesColorPicker=VertexFeatureEdgesColorPicker,exports.VertexFeatureEdgesControls=VertexFeatureEdgesControls,exports.VertexFeatureEdgesPanelSection=VertexFeatureEdgesPanelSection,exports.VertexFeatureEdgesReset=VertexFeatureEdgesReset,exports.VertexFeatureEdgesThicknessSlider=VertexFeatureEdgesThicknessSlider,exports.VertexFitAllButton=VertexFitAllButton,exports.VertexFitSelectedMenuItem=VertexFitSelectedMenuItem,exports.VertexFlyToMenuItem=VertexFlyToMenuItem,exports.VertexGhostingControls=VertexGhostingControls,exports.VertexGhostingPanelSection=VertexGhostingPanelSection,exports.VertexHideAllMenuItem=VertexHideAllMenuItem,exports.VertexHidePartMenuItem=VertexHidePartMenuItem,exports.VertexHideSelectedMenuItem=VertexHideSelectedMenuItem,exports.VertexLengthUnitSelector=VertexLengthUnitSelector,exports.VertexMaterialControls=VertexMaterialControls,exports.VertexMaterialPanelSection=VertexMaterialPanelSection,exports.VertexMeasurementContextMenu=VertexMeasurementContextMenu,exports.VertexMeasurementDetails=VertexMeasurementDetails,exports.VertexPanButton=VertexPanButton,exports.VertexPointToPointMeasurement=VertexPointToPointMeasurement,exports.VertexPointToPointMeasurementTool=VertexPointToPointMeasurementTool,exports.VertexPreciseMeasurement=VertexPreciseMeasurement,exports.VertexPreciseMeasurementTool=VertexPreciseMeasurementTool,exports.VertexResizableContent=VertexResizableContent,exports.VertexRotateButton=VertexRotateButton,exports.VertexSceneItemGhostingClear=VertexSceneItemGhostingClear,exports.VertexSceneItemGhostingOpacitySlider=VertexSceneItemGhostingOpacitySlider,exports.VertexSceneItemGhostingToggle=VertexSceneItemGhostingToggle,exports.VertexSceneItemMaterialClear=VertexSceneItemMaterialClear,exports.VertexSceneItemMaterialColorPicker=VertexSceneItemMaterialColorPicker,exports.VertexSceneItemMaterialOpacitySlider=VertexSceneItemMaterialOpacitySlider,exports.VertexSceneTree=VertexSceneTree,exports.VertexSceneTreeColumnPopover=VertexSceneTreeColumnPopover,exports.VertexSceneTreeContextMenu=VertexSceneTreeContextMenu,exports.VertexSceneTreeHeader=VertexSceneTreeHeader,exports.VertexSceneTreeSearchBar=VertexSceneTreeSearchBar,exports.VertexSceneTreeSearchInformationForToolbar=VertexSceneTreeSearchInformationForToolbar,exports.VertexSceneTreeSearchOptionsPopover=VertexSceneTreeSearchOptionsPopover,exports.VertexSceneTreeTableLayout=VertexSceneTreeTableLayout,exports.VertexSelectionHighlightingColorPicker=VertexSelectionHighlightingColorPicker,exports.VertexSelectionHighlightingControls=VertexSelectionHighlightingControls,exports.VertexSelectionHighlightingLineThicknessSlider=VertexSelectionHighlightingLineThicknessSlider,exports.VertexSelectionHighlightingOpacitySlider=VertexSelectionHighlightingOpacitySlider,exports.VertexSelectionHighlightingPanelSection=VertexSelectionHighlightingPanelSection,exports.VertexSelectionHighlightingReset=VertexSelectionHighlightingReset,exports.VertexShowAllMenuItem=VertexShowAllMenuItem,exports.VertexShowOnlyMenuItem=VertexShowOnlyMenuItem,exports.VertexShowOnlySelectedMenuItem=VertexShowOnlySelectedMenuItem,exports.VertexToolbar=VertexToolbar,exports.VertexToolbarDivider=VertexToolbarDivider,exports.VertexTransformClear=VertexTransformClear,exports.VertexTransformControls=VertexTransformControls,exports.VertexTransformInputs=VertexTransformInputs,exports.VertexTransformManipulatorToggle=VertexTransformManipulatorToggle,exports.VertexTransformPanelSection=VertexTransformPanelSection,exports.VertexTransformWidget=VertexTransformWidget,exports.VertexUnitsControls=VertexUnitsControls,exports.VertexUnitsPanelSection=VertexUnitsPanelSection,exports.VertexViewer=VertexViewer,exports.VertexViewerBackgroundColorPicker=VertexViewerBackgroundColorPicker,exports.VertexViewerBackgroundControls=VertexViewerBackgroundControls,exports.VertexViewerBackgroundPanelSection=VertexViewerBackgroundPanelSection,exports.VertexViewerBackgroundReset=VertexViewerBackgroundReset,exports.VertexViewerContextMenu=VertexViewerContextMenu,exports.VertexViewerCrossSectionButton=VertexViewerCrossSectionButton,exports.VertexViewerRightOpenedPanel=VertexViewerRightOpenedPanel,exports.VertexViewerRightSidebar=VertexViewerRightSidebar,exports.VertexViewerSceneReset=VertexViewerSceneReset,exports.VertexViewerToolkitRoot=VertexViewerToolkitRoot,exports.VertexViewerViewCube=VertexViewerViewCube,exports.VertexZoomButton=VertexZoomButton;
18
+ */Ie=Pe,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}Ie.exports?(classNames.default=classNames,Ie.exports=classNames):window.classNames=classNames}();var Ee=Pe.exports;const VertexSlider=t=>{var{value:n,defaultValue:a,leftLabel:i,rightLabel:l,onChange:r,onValueChange:c,onValueInput:u}=t,d=__rest(t,["value","defaultValue","leftLabel","rightLabel","onChange","onValueChange","onValueInput"]);const[m,p]=o.useState(a);return e.jsxs("div",{className:"flex w-full items-center gap-2",children:[i&&e.jsx("div",{className:"pl-0.5 text-xs text-center",children:i}),e.jsx(s.VertexSlider,Object.assign({className:Ee("w-full",{"mt-0.5":null!=i||null!=l}),value:null!=n?n:m,onValueChange:e=>{p(e.detail.value),null==r||r(e.detail.value),null==c||c(e)},onValueInput:e=>{p(e.detail.value),null==r||r(e.detail.value),null==u||u(e)}},d)),l&&e.jsx("div",{className:"text-xs pr-2 flex-shrink-0 text-right",children:l})]})},VertexCrossSectionAppearanceLineThicknessSlider=({onUpdate:t})=>{const a=useCrossSectioningActions(),[o,s]=n.useRecoilState(le);return e.jsx(VertexSlider,{id:"cross-section-line-thickness","data-testid":"cross-section-line-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:o,valueLabelDisplay:"auto",onValueInput:async e=>{s(e.detail.value),await a.reapply()},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexCrossSectionAppearanceControls({onUpdateCrossSectionColor:t,onUpdateCrossSectionLineThickness:n}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexCrossSectionAppearanceColorPicker,{onUpdate:t}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e.jsx(VertexCrossSectionAppearanceLineThicknessSlider,{onUpdate:n})]})}function PanelSection({header:t,children:n}){return e.jsxs("div",{className:"py-3 px-4 border-neutral-300 border-b",children:[e.jsx("div",{className:"my-2 text-base text-neutral-700",children:t}),n]})}const VertexCrossSectionAppearanceReset=({onReset:t})=>{const a=useCrossSectioningActions(),[o,i]=n.useRecoilState(ie),[l,r]=n.useRecoilState(le),c=o!==ne||1!==l;return e.jsx("div",{className:"ml-auto",children:e.jsx(s.VertexTooltip,{content:"Reset Cross Sectioning Appearance",children:e.jsx(s.VertexIconButton,{"data-testid":"cross-section-appearance-reset",iconName:"reset",iconSize:"sm",onClick:async()=>{i(ne),r(1),null==t||t(),await a.reapply()},disabled:!c})})})};function VertexCrossSectionAppearancePanelSection({onResetCrossSectionAppearance:t,onUpdateCrossSectionColor:n,onUpdateCrossSectionLineThickness:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Cross Sectioning",e.jsx(VertexCrossSectionAppearanceReset,{onReset:t})]}),children:e.jsx(VertexCrossSectionAppearanceControls,{onUpdateCrossSectionColor:n,onUpdateCrossSectionLineThickness:a})})}const Me=.5,Oe="#444444",Re=n.atom({key:"featureEdgesSelectedColor",default:Oe}),Ne=n.atom({key:"featureEdgesLineThickness",default:Me}),VertexFeatureEdgesColorPicker=({onUpdate:t})=>{const[a,o]=n.useRecoilState(Re);return e.jsx(VertexColorPicker,{"data-testid":"feature-edges-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>o(e)})},VertexFeatureEdgesThicknessSlider=({onUpdate:t})=>{const[a,o]=n.useRecoilState(Ne);return e.jsx(VertexSlider,{id:"feature-edges-thickness","data-testid":"feature-edges-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:a,valueLabelDisplay:"auto",onValueInput:e=>{o(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexFeatureEdgesControls({onUpdateFeatureEdgesColor:t,onUpdateFeatureEdgesThickness:n}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexFeatureEdgesColorPicker,{onUpdate:t}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e.jsx(VertexFeatureEdgesThicknessSlider,{onUpdate:n})]})}const VertexFeatureEdgesReset=({onReset:t})=>{const[a,o]=n.useRecoilState(Re),[i,l]=n.useRecoilState(Ne),r=i!==Me||a!==Oe;return e.jsx("div",{className:"ml-auto",children:e.jsx(s.VertexTooltip,{content:"Reset Feature Edges",children:e.jsx(s.VertexIconButton,{"data-testid":"feature-edges-reset",iconName:"reset",iconSize:"sm",onClick:()=>{o(Oe),l(Me),null==t||t()},disabled:!r})})})};function VertexFeatureEdgesPanelSection({onResetFeatureEdges:t,onUpdateFeatureEdgesColor:n,onUpdateFeatureEdgesThickness:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Feature Edges",e.jsx(VertexFeatureEdgesReset,{onReset:t})]}),children:e.jsx(VertexFeatureEdgesControls,{onUpdateFeatureEdgesColor:n,onUpdateFeatureEdgesThickness:a})})}function contextMenuItemIsRow(e){var t;return null!=e&&null!=(null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.id)}function contextMenuItemIsElement(e){return null!=e&&e instanceof HTMLElement}const _e=n.atom({key:"contextMenuActive",default:void 0}),Le=n.atom({key:"contextMenuPosition",default:void 0}),Be=n.atom({key:"contextMenuTarget",default:void 0}),De=n.atom({key:"contextMenuItem",default:void 0}),ze=n.atom({key:"contextMenuActions",default:[]}),Fe=n.selector({key:"contextMenuActivePosition",get:({get:e})=>null!=e(_e)?e(Le):void 0});function useContextMenuActions(){return{pointerDown:useActionCallback((({set:e})=>async t=>{if(2===t.button){const n=t.clientX,o=null==t?void 0:t.clientY;e(Le,a.Point.create(n,o)),e(Be,t.target)}})),pointerUp:useActionCallback((({snapshot:e,set:t})=>async(n,o,s,i)=>{const l=await e.getPromise(Le),r=await e.getPromise(_e);if(null!=l&&null==r){const e=n.clientX,r=null==n?void 0:n.clientY,c=a.Point.create(e,r),u=null!=l?a.Point.distance(l,c):0,d=null==s||s(n);u<2&&d&&(null==i||i(n,null!=l?l:c),t(_e,o))}})),contextMenu:useActionCallback((()=>(e,t)=>{(null==t||t(e))&&e.preventDefault()})),longPress:useActionCallback((({set:e})=>(t,n,o,s)=>{if(null==o||o(t)){const o=a.Point.create(t.touches[0].clientX,t.touches[0].clientY);e(Le,o),e(Be,t.target),e(_e,n),null==s||s(t,o)}})),setContextMenuItem:useActionCallback((({snapshot:e,set:t,reset:n})=>async a=>{const o=await e.getPromise(ze);t(De,a),o.forEach((e=>e(a))),n(ze)})),clearActiveContextMenu:useActionCallback((({reset:e,set:t})=>n=>{t(Te,!!n),e(_e),e(ze),e(Le)})),clearDismissedState:useActionCallback((({reset:e})=>()=>e(Te)))}}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 He=Object.freeze({__proto__:null,contextMenuActions:ze,contextMenuActive:_e,contextMenuActivePosition:Fe,contextMenuItem:De,contextMenuItemIsElement:contextMenuItemIsElement,contextMenuItemIsRow:contextMenuItemIsRow,contextMenuPosition:Le,contextMenuTarget:Be,targetShouldSkipNextHit:targetShouldSkipNextHit,targetWithinMenu:targetWithinMenu,useContextMenuActions:useContextMenuActions});const We=n.atom({key:"boxSelectionEnabled",default:!1}),Ue=n.atom({key:"boxSelectionOperationType",default:"clearAndSelect"}),useBoxSelectionActions=()=>({enable:useActionCallback((({set:e})=>()=>{e(We,!0)})),disable:useActionCallback((({reset:e})=>async()=>{e(We),e(Ue)})),setOperationType:useActionCallback((({set:e})=>t=>{e(Ue,t)}))});var Ge=Object.freeze({__proto__:null,boxSelectionEnabled:We,boxSelectionOperationType:Ue,useBoxSelectionActions:useBoxSelectionActions});async function whenComponentReady(e,t,n=customElements,a=requestAnimationFrame,o=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):o(e))),t())}const Ke=n.atom({key:"isEditingPointToPointMeasurement",default:!1}),$e=n.atom({key:"pointToPointMeasurementOutcome",default:void 0}),qe=n.atom({key:"editedPointToPointMeasurement",default:void 0});function usePointToPointMeasurement(e){const t=n.useSetRecoilState($e);o.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onOutcomeChanged(t)})),()=>null==n?void 0:n.dispose()}),[e,t])}const Ye=2,Xe=n.atom({key:"isEditingPreciseMeasurement",default:!1}),Ze=n.atom({key:"preciseMeasurementOutcome",default:void 0}),Je=n.atom({key:"preciseMeasurementController",dangerouslyAllowMutability:!0,default:void 0}),Qe=n.atom({key:"preciseMeasurementOverlays",dangerouslyAllowMutability:!0,default:void 0}),et=n.atom({key:"preciseMeasurementEntities",dangerouslyAllowMutability:!0,default:[]}),tt=n.selector({key:"preciseMeasurementMessage",get:({get:e})=>{const t=undefined;return 0===e(et).length?"Select a surface":void 0}});function usePreciseMeasurementModel(e,t,a){const s=n.useSetRecoilState(et),i=n.useSetRecoilState(Ze),l=n.useSetRecoilState(Je),r=n.useSetRecoilState(Qe),c=n.useRecoilValue(Je);o.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{s(e),null==t||t(e)}))})),()=>null==n?void 0:n.dispose()}),[e,s]),o.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onOutcomeChanged((e=>{i(e),null==a||a(e)}))})),()=>null==t?void 0:t.dispose()}),[e,i]),o.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{if(e.length>2){const t=e[2];null==c||c.setEntities(new Set([t]))}}))})),()=>null==t?void 0:t.dispose()}),[e,c]),o.useEffect((()=>{whenComponentReady(e,(()=>{l(null==e?void 0:e.measurementController)}))}),[e,l]),o.useEffect((()=>{whenComponentReady(e,(()=>{r(null==e?void 0:e.measurementOverlays)}))}),[e,r])}function useMeasurementActions(){const e=useBoxSelectionActions(),t=useEnablePointToPointMeasurement(),n=useDisablePointToPointMeasurement(),a=useDisablePreciseMeasurement(),o=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(Je);null==t||t.clearEntities()})),s=useActionCallback((()=>async(e={})=>{await o(),n(e),a()})),i=useActionCallback((({set:e,reset:n})=>async a=>{await s(),"point-to-point"===a?t():(n(Ze),n(et),e(Xe,!0))}));return{disableEditMeasurement:useActionCallback((()=>async e=>{await s(e)})),enableEditMeasurement:useActionCallback((()=>async e=>{await i(e)})),resetMeasurement:useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(Xe),a=await e.getPromise(Ke);n?await o():a&&(t($e),t(qe))})),clearEditedPointToPointMeasurement:useActionCallback((({reset:e})=>()=>{e(qe)})),setEditedPointToPointMeasurement:useActionCallback((({set:e})=>t=>{e(qe,t)})),toggleEditPointToPointMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(Ke)?await s():await i("point-to-point"),e.disable()})),toggleEditPreciseMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(Xe)?await s():await i("precise"),e.disable()}))}}function useEnablePointToPointMeasurement(){return useActionCallback((({reset:e,set:t})=>(n={})=>{t(Ke,!0),n.keepExistingMeasurement||e($e)}))}function useDisablePointToPointMeasurement(){return useActionCallback((({reset:e})=>(t={})=>{e(Ke),t.keepExistingMeasurement||(e(qe),e($e))}))}function useDisablePreciseMeasurement(){return useActionCallback((({reset:e})=>async()=>{e(Xe),e(Ze),e(et)}))}const nt=n.selector({key:"isEditingMeasurement",get:({get:e})=>e(Ke)||e(Xe)}),at=n.selector({key:"measurementPanelModel",get:({get:e})=>e($e)||e(Ze)}),ot=n.selector({key:"measurementPanelOverlays",dangerouslyAllowMutability:!0,get:({get:e})=>e(Qe)}),st=n.selector({key:"measurementPanelMessage",get:({get:e})=>{const t=undefined;return e(Xe)?e(tt):void 0}}),it=n.selector({key:"measurementPanelIsResettable",get:({get:e})=>e(nt)&&null!=e(at)});var lt=Object.freeze({__proto__:null,editedPointToPointMeasurement:qe,isEditingMeasurement:nt,isEditingPointToPointMeasurement:Ke,isEditingPreciseMeasurement:Xe,measurementPanelIsResettable:it,measurementPanelMessage:st,measurementPanelOutcome:at,measurementPanelOverlays:ot,pointToPointMeasurementOutcome:$e,preciseMeasurementController:Je,preciseMeasurementEntities:et,preciseMeasurementMessage:tt,preciseMeasurementOutcome:Ze,preciseMeasurementOverlays:Qe,useDisablePointToPointMeasurement:useDisablePointToPointMeasurement,useDisablePreciseMeasurement:useDisablePreciseMeasurement,useEnablePointToPointMeasurement:useEnablePointToPointMeasurement,useMeasurementActions:useMeasurementActions,usePointToPointMeasurement:usePointToPointMeasurement,usePreciseMeasurementModel:usePreciseMeasurementModel});const rt="Scene Alteration Performance";var ct;!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"}(ct||(ct={}));var ut=Object.freeze({__proto__:null,SCENE_ALTERATION_PERFORMANCE:rt,get SceneAlterationPerformanceType(){return ct}});const dt=n.atom({key:"fetchedItemInvalidator",default:0}),mt=n.selectorFamily({key:"fetchedItems",get:e=>async({get:t})=>{var n;const a=t(G),o=t(X);if(t(dt),t($t),null!=o)try{return await(null===(n=null==a?void 0:a.sceneItems)||void 0===n?void 0:n.getSceneViewItem(e,o,{includeOverride:!0,includeWorldTransform:!0}))}catch(t){return void logger_debug(`Error encountered get scene view item. [itemId={${e}}]`,t)}}}),pt=n.atomFamily({key:"selectionSelectedItems",default:void 0}),ht=n.atom({key:"selectionSelectedItemIds",default:[]}),ft=n.atom({key:"selectionLastSelected",default:void 0}),xt=n.atom({key:"selectionLastSelectionFromViewer",default:!1}),gt=n.atom({key:"selectionLastSelectWasMultiSelect",default:!1}),vt=n.selector({key:"selectionHasMultipleSelected",get:({get:e})=>{const t=e(ft),n=undefined;return e(ht).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}}),yt=n.atom({key:"selectionFirstSelectedItemInTreeId",default:void 0}),bt=n.selector({key:"selectionHighestSelectedAncestor",get:({get:e})=>{var t,n;const a=e(ft),o=e(ht);return null!==(n=null===(t=null==a?void 0:a.ancestors)||void 0===t?void 0:t.find((e=>o.includes(e))))&&void 0!==n?n:null==a?void 0:a.id}}),St=n.atom({key:"selectionPreviousVisibleSummary",default:void 0}),Ct=n.atom({key:"selectionVisibleSummary",default:void 0}),wt=n.selector({key:"selectionVisibleCount",get:({get:e})=>{var t,n;return null!==(n=null===(t=e(Ct))||void 0===t?void 0:t.count)&&void 0!==n?n:0}}),Vt=n.selector({key:"selectionBoundingBoxCenter",get:({get:e})=>{const t=e(Ct);return null!=(null==t?void 0:t.boundingBox)?a.BoundingBox.center(t.boundingBox):a.Vector3.origin()}}),jt=n.selector({key:"selectionIsActive",get:({get:e})=>{const t=e(ht),n=undefined;return e(wt)>0||t.length>0}}),Tt=n.selector({key:"fetchedAndSelectedItems",get:async({get:e})=>{const t=e(ht),n=undefined;return null!=e(X)?t.map((t=>e(mt(t)))):[]}});function useSceneViewItemActions(){return{invalidateCachedItems:useActionCallback((({set:e})=>()=>{e(dt,(e=>e+1))}))}}var At=Object.freeze({__proto__:null,fetchedItem:mt,fetchedItemInvalidator:dt,useSceneViewItemActions:useSceneViewItemActions});const kt=n.atom({key:"lengthUnit",default:"cm"}),Pt=n.atom({key:"decimalPlace",default:"2"});var It=Object.freeze({__proto__:null,decimalPlace:Pt,lengthUnit:kt}),Et,Mt;!function(e){e.mm="millimeters",e.cm="centimeters",e.m="meters",e.in="inches",e.ft="feet"}(Et||(Et={})),function(e){e[e.mm=1]="mm",e[e.cm=.1]="cm",e[e.m=.001]="m",e[e.in=.03937007874015748]="in",e[e.ft=.0032808398950131233]="ft"}(Mt||(Mt={}));const convertFrom=(e,t)=>{const n=undefined;return e/Mt[t]},convertTo=(e,t)=>{const n=undefined;return e*Mt[t]},formatWithUnit=(e,t,n)=>`${e.toFixed(n)} ${t}`,formatDistance=(e,t,n)=>formatWithUnit(convertTo(e,t),t,n),createDistanceFormatter=(e,t)=>n=>formatDistance(n,e,t);function toUnitType(e){switch(e){case"cm":return"centimeters";case"m":return"meters";case"in":return"inches";case"ft":return"feet";default:return"millimeters"}}function 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:i.toWorldTransform(e,t)}:{world:e,local:i.toLocalTransform(e,t)}}function convertTransformToUnits(e,t){const{position:n,rotation:o,scale:s}=e;return{position:a.Vector3.create(convertTo(n.x,t),convertTo(n.y,t),convertTo(n.z,t)),rotation:o,scale:s}}function convertTransformFromUnits(e,t){const{position:n,rotation:o,scale:s}=e;return{position:a.Vector3.create(convertFrom(n.x,t),convertFrom(n.y,t),convertFrom(n.z,t)),rotation:o,scale:s}}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 Ot={position:a.Vector3.create(0,0,0),rotation:a.Vector3.create(0,0,0),scale:1},Rt=n.atom({key:"transformWidgetEnabled",default:!1}),Nt=n.atom({key:"transformWidgetPosition",default:void 0}),_t=n.atom({key:"transformWidgetOrientationOverride",default:void 0}),Lt=n.selector({key:"transformWidgetOrientation",get:({get:e})=>{const t=e(_t),n=e(ft);if(null!=t)return t;if(null!=n){const t=e(Kt(n.id));return a.Euler.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})}}}),Bt=n.atom({key:"transformWidgetCachedOrientation",default:void 0}),Dt=n.atom({key:"transformWidgetSyncToSelection",default:!1}),zt=n.atom({key:"transformWidgetIsInteracting",default:!1}),Ft=n.atomFamily({key:"appliedItemTransform",default:void 0}),Ht=n.atom({key:"appliedItemTransformIds",default:[]}),Wt=n.atom({key:"selectedCoordinateSpace",default:"world"}),Ut=n.atomFamily({key:"editedItemTransform",default:void 0}),Gt=n.selectorFamily({key:"displayedItemTransform",get:e=>({get:t})=>{if(null!=e){const n=t(Wt),a=t(kt),o=t(Kt(e)),s=t(Ut(e));if(null!=s)return s.transform;if(null!=o)return pickLocalOrWorldTransform(mapItemTransforms(o,(e=>convertTransformToUnits(e,a))),n)}},set:e=>({get:t,set:a},o)=>{if(null!=e){const s=t(Wt),i=t(qt(e)),l=t(Kt(e)),r=t(kt);if(null!=l&&!(o instanceof n.DefaultValue)&&null!=o&&null!=i){a(Ut(e),{coordinateSpace:s,units:r,transform:o});const n=makeItemTransforms(convertTransformFromUnits(toValidTransform(o),r),i,s),l=t(Ht);a(Ft(e),n),a(Ht,[...l,e])}}}}),Kt=n.selectorFamily({key:"fetchedItemTransforms",get:e=>({get:t})=>{var n,a;const o=t(mt(e));if(null!=o){const e=(null===(n=o.override)||void 0===n?void 0:n.transform)?toTransformFromApiMatrix(null===(a=o.override)||void 0===a?void 0:a.transform):void 0,t=o.worldTransform?toTransformFromApiMatrix(o.worldTransform):void 0;return{local:null!=e?e:Ot,world:null!=t?t:Ot}}}}),$t=n.atom({key:"transformInvalidator",default:0}),qt=n.selectorFamily({key:"parentItemWorldMatrix",get:e=>({get:t})=>{const n=t(X);if(null!=e&&null!=n){const n=t(mt(e));if(null!=(null==n?void 0:n.parentId)){const e=t(Kt(n.parentId)),a=t(Ft(n.parentId));if(null==e)throw new Error("Invalid state. Parent item state should be populated, but is undefined.");return null!=a?i.toMatrix(i.toRadiansTransform(a.world)):i.toMatrix(i.toRadiansTransform(e.world))}}return logger_debug(`Unable to find the world matrix for the parent of ${e}. Returning the identity matrix.`),a.Matrix4.makeIdentity()}});function useUpdateEditedTransformWhenSettingsChange(e){const t=n.useRecoilValue(kt),a=n.useRecoilValue(Wt),s=n.useRecoilValue(Ft(null!=e?e:"")),[i,l]=n.useRecoilState(Ut(null!=e?e:""));o.useEffect((()=>{if(null!=s&&((null==i?void 0:i.coordinateSpace)!==a||(null==i?void 0:i.units)!==t)){const e=undefined,n=convertTransformToUnits(pickLocalOrWorldTransform(s,a),t);l({units:t,coordinateSpace:a,transform:n})}}),[t,a])}function useEditItemTransform(e){const t=useTransformActions();useUpdateEditedTransformWhenSettingsChange(e);const a=n.useRecoilValueLoadable(qt(e)),[o,s]=n.useRecoilStateLoadable(Gt(e));return{transform:"hasValue"===o.state?o.contents:void 0,loading:"loading"===o.state||"loading"===a.state,error:"hasError"===o.state?o.contents:void 0,async update(n){t.enableSelectionSync(),s(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(Vt);e(Nt,n)})),o=useActionCallback((({set:e,snapshot:t})=>async()=>{const a=await t.getPromise(Nt),o=await t.getPromise(gt),s=await t.getPromise(ht),i=await t.getPromise(wt);null==a&&(s.length>0||o||i>0)&&await n(),e(Dt,!0)})),s=useActionCallback((({set:e})=>async t=>{e(Nt,null!=t?t:void 0)})),l=useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async()=>{const a=await e.getPromise(Lt),o=undefined;(await e.getPromise(Ht)).forEach((e=>{n(Ft(e)),n(Ut(e))})),n(Ht),null!=a&&t(Bt,a),t($t,(e=>e+1))}))),r=useActionCallback((({set:e,reset:t})=>n=>{t(Bt),e(_t,n)})),c=useActionCallback((({set:e})=>()=>{e(Nt,void 0),e(Rt,!1)}));return{enableTransformWidget:useActionCallback((({set:t})=>async(a,i)=>{e.setToastMessage({message:"Transform manipulator enabled! Select parts to interact.",duration:_}),t(Rt,!0),i?await n():null==a?await o():await s(a)})),disableTransformWidget:useActionCallback((({reset:e})=>()=>{e(Rt),e(_t)})),setTransformWidgetOrientation:r,clearTransformWidgetOrientation:useActionCallback((({reset:e})=>()=>{e(Bt),e(_t)})),setTransformWidgetPosition:s,clearTransformWidgetPosition:useActionCallback((({reset:e})=>()=>e(Nt))),invalidateTransforms:l,setIsInteractivelyTransforming:useActionCallback((({set:e})=>t=>{e(zt,t)})),setDefaultWidgetPosition:o,setDefaultWidgetPositionToSelection:n,enableSelectionSync:useActionCallback((({set:e})=>()=>e(Dt,!0))),disableSelectionSync:useActionCallback((({reset:e})=>()=>e(Dt))),syncToSelection:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(St),n=await e.getPromise(Ct),o=undefined;if(await e.getPromise(Dt)){const e=null==n?void 0:n.boundingBox,o=null!=e&&null!=(null==t?void 0:t.boundingBox)&&equals(e,t.boundingBox);null==e||o||await s(a.BoundingBox.center(e))}})),orientToHitResult:useActionCallback((({reset:e})=>async t=>{e(Dt),null!=t?await s(null==t?void 0:t.position):(e(Nt),r(void 0))})),clearSelectedTransforms:useActionCallback((()=>async()=>{await t.execute(ct.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.withSelected())).clearTransforms())),await l(),c()})),clearAllTransforms:useActionCallback((()=>async()=>{await t.execute(ct.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.all())).clearTransforms())),await l(),c()})),applyTransformToItem:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(G),o=await(null==n?void 0:n.scene()),s=await e.getPromise(Ft(t));if(null==s)return void logger_warn(`There is no transform to apply to item ${t}.`);const l=a.Matrix4.transpose(i.toMatrix(i.toRadiansTransform(null==s?void 0:s.local)));return null==o?void 0:o.items((e=>e.where((e=>e.withItemId(t))).transform(l))).execute()}))}};var Yt=Object.freeze({__proto__:null,appliedItemTransformIds:Ht,appliedItemTransforms:Ft,convertTransformFromUnits:convertTransformFromUnits,convertTransformToUnits:convertTransformToUnits,displayedItemTransform:Gt,editedItemTransform:Ut,fetchedItemTransforms:Kt,identityTransform:Ot,makeItemTransforms:makeItemTransforms,mapItemTransforms:mapItemTransforms,parentItemWorldMatrix:qt,pickLocalOrWorldTransform:pickLocalOrWorldTransform,selectedCoordinateSpace:Wt,toValidTransform:toValidTransform,transformInvalidator:$t,transformWidgetCachedOrientation:Bt,transformWidgetEnabled:Rt,transformWidgetIsInteracting:zt,transformWidgetOrientation:Lt,transformWidgetOrientationOverride:_t,transformWidgetPosition:Nt,transformWidgetSyncToSelection:Dt,useEditItemTransform:useEditItemTransform,useTransformActions:useTransformActions});const useHitActions=()=>{const e=useCrossSectioningActions(),t=useMeasurementActions(),n=useTransformActions(),a=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const n=await e.tryGetPromise(je).then((e=>e.value)),a=await e.getPromise(qe);null==n&&null!=(null==a?void 0:a.start)&&null!=a.end&&await t.resetMeasurement()}))),o=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(je).then((e=>e.value));await n.orientToHitResult(t)}))),s=useActionCallback(retainSnapshot((({set:e,snapshot:t})=>async()=>{const n=await t.tryGetPromise(je).then((e=>e.value));e(De,n)}))),i=useActionCallback(retainSnapshot((({snapshot:e,set:t})=>async()=>{t(Ve,await e.tryGetPromise(je).then((e=>e.value)))})));return{tap:useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async({detail:l},...r)=>{const c=await t.getPromise(nt),u=await t.getPromise(ce),d=2!==(null==l?void 0:l.buttons)&&!(null==l?void 0:l.altKey);l.altKey||l.ctrlKey||l.metaKey||l.shiftKey;const m=d&&!u.hitPending&&!c,p=await t.tryGetPromise(je).then((e=>e.value));n(we,p),n(Se,l),await a(),m&&(r.forEach((e=>e())),await o()),await s(),await e.sectionCurrentHit(),await i()}))),longPress:useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async a=>{n(Se),t(Ce,a.detail),await e.tryGetPromise(je),await s(),await i()})))}},Xt=n.selector({key:"viewerToolkitHitState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,o=undefined,s=undefined;return{tapDetails:e(Se),longPressDetails:e(Ce),previousHitResult:e(we),currentHitResult:e(Ve)}}});var Zt=Object.freeze({__proto__:null,currentHitResult:Ve,hitResult:je,hitResultsLongPressDetails:Ce,hitResultsSkipNextTap:Te,hitResultsTapDetails:Se,hitState:Xt,previousHitResult:we,useHitActions:useHitActions});function useSelectionActions(){const e=useSceneViewItemActions(),t=useTransformActions(),n=useViewerSceneActions(),a=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(ht)).forEach((e=>t(pt(e))))})),o=useActionCallback((({snapshot:e,reset:t,set:a})=>async(o,s)=>{var i,l;const r=await e.getPromise(pt(o.id)),c=await e.getPromise(ht),u=null===(l=[...null!==(i=o.ancestors)&&void 0!==i?i:[]])||void 0===l?void 0:l.reverse().find((e=>!c.includes(e)));null!=r&&null!=u?(a(pt(u),{id:u}),a(ht,(e=>[...e,u])),await n.execute(ct.SELECTING_ANCESTOR,n.selectItemsTransform(u))):(null==s?void 0:s.clear)?(a(pt(o.id),o),a(ht,[o.id]),await n.execute(ct.SELECTING_ONLY_ITEM,n.clearSelectionTransform,n.selectItemsTransform(o.id))):(a(pt(o.id),o),a(ht,(e=>[...e,o.id])),await n.execute(ct.SELECTING_ITEMS,n.selectItemsTransform(o.id))),d(o),a(ft,o),a(xt,!0),t(gt)})),s=useActionCallback((({reset:e,set:t})=>async a=>{e(pt(a)),e(gt),t(ht,(e=>e.filter((e=>e!==a)))),await n.execute(ct.DESELECTING_ITEMS,n.deselectItemsTransform(a))})),i=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(pt(t.id));null!=n?await s(n.id):await o(t)})),l=useActionCallback((({snapshot:n,reset:a,set:s})=>async(i,l={})=>{const r=await n.getPromise(pt(i.id)),c=await n.getPromise(ht);if(c.filter((e=>{var t;return e!==i.id&&!(null===(t=i.ancestors)||void 0===t?void 0:t.includes(e))})).forEach((e=>a(pt(e)))),a(gt),r)if(l.ignoreAncestorSelection)a(ht),a(pt(r.id));else{const e=c.filter((e=>{var t;return e===i.id||(null===(t=i.ancestors)||void 0===t?void 0:t.includes(e))}));s(ht,e)}else a(ht);e.invalidateCachedItems(),t.clearTransformWidgetOrientation(),await o(i,{clear:!0})})),r=useActionCallback((({reset:e})=>async()=>{await a(),e(ht),e(ft),e(xt),e(gt),t.clearTransformWidgetPosition(),t.clearTransformWidgetOrientation()})),c=useActionCallback((()=>async()=>{await r(),await n.execute(ct.CLEAR_SELECTION,n.clearSelectionTransform)})),u=useActionCallback((({set:e})=>async t=>{e(gt,t)})),d=useActionCallback((({reset:e,set:t})=>e=>{}));return{select:o,toggleSelection:i,clearAndSelect:l,selectCurrentHit:useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(je).then((e=>e.value)),n=await e.getPromise(Se),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 i(t):await c():await l(t)}))),syncSelection:useActionCallback((({set:e,reset:t})=>async(n,o)=>{o.selected?(await a(),e(pt(n.id),n),o.multiSelect?e(ht,(e=>[...e.filter((e=>e!==n.id)),n.id])):e(ht,[n.id]),d(n),e(ft,n),e(xt,!1),e(gt,!!o.multiSelect)):(t(pt(n.id)),t(gt),e(ht,(e=>e.filter((e=>e!==n.id)))))})),deselect:s,clearSelection:c,resetSelectionState:r,toggleLastSelectWasMultiSelect:u,selectForModelViewsPanel:d}}const Jt=n.selector({key:"viewerToolkitSelectionState",get:({get:e})=>{const t=undefined,n=undefined,a=undefined,o=undefined;return{selectedItemIds:e(ht),lastSelected:e(ft),highestSelectedAncestorId:e(bt)}}});var Qt=Object.freeze({__proto__:null,fetchedAndSelectedItems:Tt,selectionBoundingBoxCenter:Vt,selectionFirstSelectedItemInTreeId:yt,selectionHasMultipleSelected:vt,selectionHighestSelectedAncestor:bt,selectionIsActive:jt,selectionLastSelectWasMultiSelect:gt,selectionLastSelected:ft,selectionLastSelectionFromViewer:xt,selectionPreviousVisibleSummary:St,selectionSelectedItemIds:ht,selectionSelectedItems:pt,selectionState:Jt,selectionVisibleCount:wt,selectionVisibleSummary:Ct,useSelectionActions:useSelectionActions});function createColorMaterialWithId(e,t=j.create()){return Object.assign({id:t},i.ColorMaterial.fromHex(e))}const en=255,tn=18,nn=n.atom({key:"sceneItemAdjustmentsSelectedColor",default:void 0}),an=n.atom({key:"sceneItemAdjustmentsRecentColors",default:[]}),on=n.atom({key:"sceneItemAdjustmentsCustomColors",default:[createColorMaterialWithId("#ffffff"),createColorMaterialWithId("#616161")]}),sn=n.atom({key:"sceneItemAdjustmentsSelectedOpacity",default:void 0}),ln=n.atomFamily({key:"appliedItemMaterialOverride",default:void 0}),rn=n.atom({key:"appliedItemMaterialOverrideIds",default:[]}),cn=n.selector({key:"sceneItemAdjustmentsLastSelectedOverride",get:({get:e})=>{const t=e(ft);if(null!=t)return e(ln(t.id))}}),un=n.atom({key:"applyMaterialToAllUserAction",default:void 0}),dn=n.atom({key:"showConfirmDialogWhenApplyingMaterialToAll",default:!0}),mn=n.atom({key:"confirmApplyMaterialToAllDialogOpen",default:!1}),useSceneItemMaterialActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(rn);t(nn),n.forEach((e=>t(ln(e)))),t(rn)}));return{updateColor:useActionCallback((({set:e})=>t=>{e(nn,t)})),saveRecentColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(an),o=[n,...a.filter((e=>e!==n))],s=o.length>tn?o.slice(0,-(o.length-tn)):o;e(nn,n),e(an,s)})),removeRecentColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=undefined,o=(await t.getPromise(an)).filter((e=>e.id!==n));e(an,o)})),setCustomColors:useActionCallback((({set:e})=>async t=>{e(on,t)})),saveCustomColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=undefined,o=[...await t.getPromise(on),n],s=o.length>tn?o.slice(o.length-tn):o;e(nn,n),e(on,s)})),removeCustomColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=undefined,o=(await t.getPromise(on)).filter((e=>e.id!==n));e(on,o)})),clearCurrentColor:useActionCallback((({reset:e})=>()=>{e(nn)})),clearCurrentOpacity:useActionCallback((({reset:e})=>()=>{e(sn)})),clear:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const o=await t.getPromise(ht);a(nn),o.forEach((e=>a(ln(e)))),n(rn,(e=>e.filter((e=>!o.includes(e))))),await e.execute(ct.CLEAR_SELECTED_MATERIAL_OVERRIDES,(e=>e.where((e=>e.withSelected())).clearMaterialOverrides().select()))})),clearAll:useActionCallback((()=>async()=>{await t(),await e.execute(ct.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(sn,t)})),apply:useActionCallback((({snapshot:t,set:n})=>async()=>{const a=await t.getPromise(nn),o=await t.getPromise(sn),s=await t.getPromise(ht),i=await t.getPromise(cn),l=null!=a?a:i,r=null!=o?o:null==i?void 0:i.opacity;if(null!=l){const t=Object.assign(Object.assign({},l),{opacity:null!=r?r:l.opacity});await e.execute(ct.APPLY_MATERIAL_OVERRIDE_TO_SELECTION,(e=>e.where((e=>e.withSelected())).materialOverride(t))),s.forEach((e=>n(ln(e),t))),n(rn,(e=>[...e,...s]))}})),confirmApplyAll:useActionCallback((({set:e})=>t=>{e(mn,!0),e(un,(()=>t))})),cancelApplyAll:useActionCallback((({reset:e})=>()=>{e(mn),e(un)})),applyAll:useActionCallback((({snapshot:t,reset:n})=>async()=>{const a=await t.getPromise(nn),o=await t.getPromise(sn);if(null!=a){const s=await t.getPromise(rn),i=Object.assign(Object.assign({},a),{opacity:null!=o?o:a.opacity});await e.execute(ct.APPLY_MATERIAL_OVERRIDE_TO_ALL,(e=>e.where((e=>e.all())).materialOverride(i))),s.forEach((e=>n(ln(e))));const l=await t.getPromise(un);null==l||l(i),n(mn),n(un)}})),hideConfirmApplyAllDialog:useActionCallback((({set:e})=>()=>{e(dn,!1)}))}},pn="#ffff00",hn=35,fn=1,xn=n.atom({key:"selectionHighlightingSelectedColor",default:pn}),gn=n.atom({key:"selectionHighlightingSelectedOpacity",default:hn}),vn=n.atom({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 yn="#FFFFFF",bn=n.atom({key:"viewerBackgroundSelectedColor",default:yn});var Sn=Object.freeze({__proto__:null,DEFAULT_FEATURE_EDGE_COLOR:Oe,DEFAULT_FEATURE_EDGE_THICKNESS_VALUE:Me,DEFAULT_SELECTION_HIGHLIGHTING_COLOR:pn,DEFAULT_SELECTION_HIGHLIGHTING_LINE_THICKNESS:1,DEFAULT_SELECTION_HIGHLIGHTING_OPACITY:hn,DEFAULT_VIEWER_BACKGROUND_COLOR:yn,MAXIMUM_MATERIAL_OVERRIDE_OPACITY:en,MAX_STORED_COLOR_ARRAY_LENGTH:tn,appliedItemMaterialOverride:ln,appliedItemMaterialOverrideIds:rn,applyMaterialToAllUserAction:un,confirmApplyMaterialToAllDialogOpen:mn,elementHasColorAttribute:elementHasColorAttribute,elementIsColorSwatch:elementIsColorSwatch,featureEdgesLineThickness:Ne,featureEdgesSelectedColor:Re,sceneItemAdjustmentsCustomColors:on,sceneItemAdjustmentsLastSelectedOverride:cn,sceneItemAdjustmentsRecentColors:an,sceneItemAdjustmentsSelectedColor:nn,sceneItemAdjustmentsSelectedOpacity:sn,selectionHighlightingSelectedColor:xn,selectionHighlightingSelectedLineThickness:vn,selectionHighlightingSelectedOpacity:gn,showConfirmDialogWhenApplyingMaterialToAll:dn,useSceneItemMaterialActions:useSceneItemMaterialActions,viewerBackgroundSelectedColor:bn});const VertexSceneItemMaterialApplyAll=({onApplyAll:t})=>{const a=useSceneItemMaterialActions(),o=n.useRecoilValueLoadable(cn),i=n.useRecoilValue(nn),l=n.useRecoilValue(dn),r=d.useMemo((()=>"hasValue"===o.state?null!=i?i:o.contents:i),[o,i]);return e.jsx(s.VertexTooltip,{content:"Apply to All",children:e.jsx(s.VertexIconButton,{iconName:"square-dot-outline",iconSize:"sm",color:"secondary",disabled:null==r,onClick:async()=>{l?a.confirmApplyAll(t):(await a.applyAll(),null==t||t(r))}})})};function SceneItemMaterialApplyAllConfirmationDialog(){const t=useSceneItemMaterialActions(),a=n.useRecoilValue(mn),[i,l]=o.useState(!1),onCloseDialog=()=>{t.cancelApplyAll(),l(!1)};return a?e.jsxs(s.VertexDialog,{open:!0,className:"text-sm",onClosed:onCloseDialog,onBackdropClick:onCloseDialog,children:[e.jsx("div",{slot:"heading",children:"Apply to All Parts"}),e.jsx("div",{className:"max-w-lg break-words pr-2",children:"This will apply the same material to all parts in the model. Any previous material changes will be lost."}),e.jsxs("div",{className:"flex mt-8 gap-2 items-center",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(s.VertexToggle,{"data-testid":"hide-confirmation-dialog-in-future-checkbox",variant:"check",className:"pt-0.5",checked:i,onValueChanged:e=>{l(e.detail)}}),"Don't show again this session"]}),e.jsxs("div",{className:"flex ml-auto gap-2",children:[e.jsx(s.VertexButton,{"data-testid":"cancel-apply-material-to-all",onClick:onCloseDialog,children:"Cancel"}),e.jsx(s.VertexButton,{color:"primary","data-testid":"confirm-apply-material-to-all",onClick:async()=>{await t.applyAll(),i&&t.hideConfirmApplyAllDialog()},children:"Apply"})]})]})]}):e.jsx(e.Fragment,{})}const VertexSceneItemMaterialColorPicker=({onApply:t})=>{const a=useSceneItemMaterialActions(),o=n.useRecoilValueLoadable(cn),s=n.useRecoilValue(nn),i=d.useMemo((()=>"hasValue"===o.state?null!=s?s:o.contents:s),[o,s]);return e.jsx(VertexColorPicker,{"data-testid":"selected-item-color-picker",value:null!=i?f.toHexString(i.diffuse):void 0,onValueChanged:async()=>{null!=i&&(await a.apply(),null==t||t(i),await a.saveRecentColor(createColorMaterialWithId(f.toHexString(i.diffuse))))},onInput:async e=>{a.updateColor(createColorMaterialWithId(e)),await a.apply()}})},ColorSwatch=t=>{var{color:n,hideTooltip:a,onClick:o}=t,i=__rest(t,["color","hideTooltip","onClick"]);const l="string"==typeof n?n:f.toHexString(n.diffuse);return e.jsx(s.VertexTooltip,{className:"flex-grow-0",content:l,disabled:!!a,children:e.jsx("button",{onClick:()=>null==o?void 0:o(n),children:e.jsx(s.VertexColorSwatch,Object.assign({"data-testid":`color-swatch-${l}`,variant:"square",color:l},i))})})},VertexSceneItemMaterialColorSwatches=({onAddCustomColor:t,onApplyCustomColor:a,onApplyRecentColor:o})=>{const i=useSceneItemMaterialActions(),l=n.useRecoilValue(on),r=n.useRecoilValue(an),c=l.length===tn;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-testid":"appearance-custom-colors",className:"flex flex-wrap gap-2 mt-1 mb-4",children:[l.map((t=>e.jsx(ColorSwatch,{color:t,onClick:async()=>{i.updateColor(t),await i.apply(),null==a||a(t)},"data-custom-color":!0,"data-color-id":t.id},t.id))),!c&&e.jsx(s.VertexColorPicker,{"data-testid":"appearance-custom-colors-add",variant:"swatch",size:"md",onValueChanged:async e=>{const n=createColorMaterialWithId(e.detail);await i.saveCustomColor(n),await i.apply(),null==t||t(n)},children:e.jsx("div",{slot:"overlay",className:"flex items-center justify-center w-full h-full",children:e.jsx(s.VertexIcon,{className:"bg-white p-2",name:"plus",size:"sm"})})})]}),!!r.length&&e.jsx("div",{"data-testid":"appearance-recent-colors",className:"flex flex-wrap gap-2",children:r.map((t=>e.jsx(ColorSwatch,{color:t,onClick:async()=>{i.updateColor(t),await i.apply(),null==o||o(t)},"data-recent-color":!0,"data-color-id":t.id},t.id)))})]})},VertexSceneItemMaterialOpacitySlider=({onApply:t})=>{const a=useSceneItemMaterialActions(),o=n.useRecoilValue(sn),i=n.useRecoilValueLoadable(cn),l=d.useMemo((()=>{var e,t;return"hasValue"===i.state?null!==(t=null!=o?o:null===(e=i.contents)||void 0===e?void 0:e.opacity)&&void 0!==t?t:en:null!=o?o:en}),[o,i]),r=useDebouncedCallback((()=>{a.apply()}),500),c=d.useCallback((e=>{a.updateOpacity(e.detail.value),r(e.detail.value)}),[r,a]),u=d.useMemo((()=>"hasValue"!==i.state||null==i.contents),[i]);return e.jsx(s.VertexTooltip,{className:"flex w-full",content:u?"Select a part and apply a color to enable opacity":`${Math.floor(l/en*100)}%`,placement:"top",children:e.jsx(VertexSlider,{"data-testid":"scene-item-adjustments-opacity-slider",leftLabel:"0%",rightLabel:"100%",disabled:u,value:null!=l?l:en,step:5,min:0,max:en,onValueChange:e=>{a.updateOpacity(e.detail.value),a.apply(),null==t||t(e.detail.value)},onValueInput:c})})};function VertexMaterialControls({customColors:t,onApplyMaterial:a,onApplyMaterialToAll:s,onAddCustomColor:i,onApplyCustomColor:l,onApplyRecentColor:r,onApplyOpacity:c}){const u=useSceneItemMaterialActions(),d=n.useRecoilValue(ft);return o.useEffect((()=>{u.clearCurrentColor(),u.clearCurrentOpacity()}),[null==d?void 0:d.id]),o.useEffect((()=>{if(null!=t){const e=t.map((e=>Object.assign(Object.assign({},e),{id:j.create()})));u.setCustomColors(e)}}),[t]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(VertexSceneItemMaterialColorPicker,{onApply:a}),e.jsx(VertexSceneItemMaterialApplyAll,{onApplyAll:s})]})]}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Color Swatches"}),e.jsx(VertexSceneItemMaterialColorSwatches,{onAddCustomColor:i,onApplyCustomColor:l,onApplyRecentColor:r}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e.jsx(VertexSceneItemMaterialOpacitySlider,{onApply:c}),e.jsx(SceneItemMaterialApplyAllConfirmationDialog,{})]})}const ResetButton=({id:t,tooltip:n,children:a})=>{const[i,l]=o.useState(!1);return e.jsx("div",{className:"ml-auto",children:e.jsxs(s.VertexDropdownMenu,{className:"flex items-stretch h-full","data-testid":`reset-button-dropdown-menu-${t}`,placement:"bottom-end",onMenuOpened:()=>l(!0),onMenuClosed:()=>l(!1),children:[e.jsx("div",{slot:"anchor",className:"flex items-center h-full",children:e.jsx(s.VertexTooltip,{content:n,disabled:i,placement:"bottom",children:e.jsxs(s.VertexButton,{className:Ee("p-1.5 rounded-md select-none hover:bg-neutral-300 active:bg-neutral-400 cursor-pointer",{"bg-neutral-300":i}),"data-testid":`reset-button-${t}`,variant:"plaintext",children:[e.jsx(s.VertexIcon,{className:"px-0.5",name:"reset",size:"sm"}),e.jsx(s.VertexIcon,{name:"chevron-down",size:"sm"})]})})}),e.jsx("div",{className:"whitespace-nowrap",children:a})]})})},VertexSceneItemMaterialClear=({onClear:t,onClearAll:a})=>{const o=useSceneItemMaterialActions(),i=n.useRecoilValue(jt);return e.jsx("div",{className:"ml-auto",children:e.jsxs(ResetButton,{id:"materials",tooltip:"Clear Materials",children:[e.jsx("div",{className:"pt-1"}),e.jsx(s.VertexMenuItem,{"data-testid":"clear-selected-materials",onClick:()=>{o.clear(),null==t||t()},disabled:!i,children:"Clear selected materials"}),e.jsx(s.VertexMenuItem,{"data-testid":"clear-all-materials",onClick:()=>{o.clearAll(),null==a||a()},children:"Clear all materials"})]})})};function VertexMaterialPanelSection({customColors:t,onClearMaterial:n,onClearAllMaterials:a,onApplyMaterial:o,onApplyMaterialToAll:s,onAddCustomColor:i,onApplyCustomColor:l,onApplyRecentColor:r,onApplyOpacity:c}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Material",e.jsx(VertexSceneItemMaterialClear,{onClear:n,onClearAll:a})]}),children:e.jsx(VertexMaterialControls,{customColors:t,onApplyMaterial:o,onApplyMaterialToAll:s,onAddCustomColor:i,onApplyCustomColor:l,onApplyRecentColor:r,onApplyOpacity:c})})}const VertexSelectionHighlightingColorPicker=({onUpdate:t})=>{const[a,o]=n.useRecoilState(xn);return e.jsx(VertexColorPicker,{"data-testid":"selection-highlighting-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>o(e)})},VertexSelectionHighlightingLineThicknessSlider=({onUpdate:t})=>{const[a,o]=n.useRecoilState(vn);return e.jsx(VertexSlider,{id:"selection-highlighting-line-thickness","data-testid":"selection-highlighting-line-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:a,valueLabelDisplay:"auto",onValueInput:e=>{o(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},VertexSelectionHighlightingOpacitySlider=({onUpdate:t})=>{const[a,o]=n.useRecoilState(gn);return e.jsx(VertexSlider,{id:"selection-highlighting-opacity","data-testid":"selection-highlighting-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:a,valueLabelDisplay:"auto",onValueInput:e=>{o(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexSelectionHighlightingControls({onUpdateSelectionHighlightColor:t,onUpdateSelectionHighlightOpacity:n,onUpdateSelectionHighlightLineThickness:a}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexSelectionHighlightingColorPicker,{onUpdate:t}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Opacity"}),e.jsx(VertexSelectionHighlightingOpacitySlider,{onUpdate:n}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e.jsx(VertexSelectionHighlightingLineThicknessSlider,{onUpdate:a})]})}const VertexSelectionHighlightingReset=({onReset:t})=>{const[a,o]=n.useRecoilState(xn),[i,l]=n.useRecoilState(gn),[r,c]=n.useRecoilState(vn),u=a!==pn||i!==hn||1!==r;return e.jsx("div",{className:"ml-auto",children:e.jsx(s.VertexTooltip,{content:"Reset Selection Highlighting",children:e.jsx(s.VertexIconButton,{"data-testid":"selection-highlighting-reset",iconName:"reset",iconSize:"sm",onClick:()=>{o(pn),l(hn),c(1),null==t||t()},disabled:!u})})})};function VertexSelectionHighlightingPanelSection({onResetSelectionHighlighting:t,onUpdateSelectionHighlightColor:n,onUpdateSelectionHighlightOpacity:a,onUpdateSelectionHighlightLineThickness:o}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Selection Highlighting",e.jsx(VertexSelectionHighlightingReset,{onReset:t})]}),children:e.jsx(VertexSelectionHighlightingControls,{onUpdateSelectionHighlightColor:n,onUpdateSelectionHighlightOpacity:a,onUpdateSelectionHighlightLineThickness:o})})}const VertexViewerBackgroundColorPicker=({onUpdate:t})=>{const[a,o]=n.useRecoilState(bn);return e.jsx(VertexColorPicker,{"data-testid":"viewer-background-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>o(e)})};function VertexViewerBackgroundControls({onUpdateViewerBackgroundColor:t}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexViewerBackgroundColorPicker,{onUpdate:t})]})}const VertexViewerBackgroundReset=({onReset:t})=>{const[a,o]=n.useRecoilState(bn),i=a!==yn;return e.jsx("div",{className:"ml-auto",children:e.jsx(s.VertexTooltip,{content:"Reset Background Color",children:e.jsx(s.VertexIconButton,{"data-testid":"viewer-background-reset",iconName:"reset",iconSize:"sm",onClick:()=>{o(yn),null==t||t()},disabled:!i})})})};function VertexViewerBackgroundPanelSection({onResetViewerBackgroundColor:t,onUpdateViewerBackgroundColor:n}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Viewer Background",e.jsx(VertexViewerBackgroundReset,{onReset:t})]}),children:e.jsx(VertexViewerBackgroundControls,{onUpdateViewerBackgroundColor:n})})}const isInputElement=e=>{const t=e instanceof HTMLElement&&"VERTEX-AUTO-RESIZE-TEXTAREA"===e.tagName,n=e instanceof HTMLElement&&"VERTEX-TEXTFIELD"===e.tagName,a=e instanceof HTMLElement&&"true"===e.contentEditable,o=e instanceof HTMLElement&&"VERTEX-SCENE-TREE-SEARCH"===e.tagName,s=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement,i=e instanceof HTMLElement&&"VERTEX-VIEWER-PIN-TOOL"===e.tagName,l=e instanceof HTMLElement&&"VERTEX-VIEWER-TRANSFORM-WIDGET"===e.tagName;return t||n||a||o||s||i||l},useRecoilReducer=({reducer:e,atom:t})=>{const a=undefined,o=undefined;return[n.useRecoilValue(t),useRecoilReducerDispatch({reducer:e,atom:t})]},useRecoilReducerDispatch=({reducer:e,atom:t})=>{const a=n.useRecoilCallback((({set:n})=>async a=>{n(t,(t=>e(t,a)))}),[]);return a},Cn=n.atom({key:"keyBindings",default:{applyBindings:[],bindings:{},pressed:{}}});function reducer(e,t){var n,a,o,s;switch(t.type){case"push-key-binding":const i=undefined;return null!=(null===(n=e.bindings[t.binding.keyBind])||void 0===n?void 0:n.find((e=>e.id===t.binding.id)))?e:Object.assign(Object.assign({},e),{bindings:Object.assign(Object.assign({},e.bindings),{[t.binding.keyBind]:[...null!==(a=e.bindings[t.binding.keyBind])&&void 0!==a?a:[],t.binding]})});case"remove-key-binding":const l=undefined;return null==(null===(o=e.bindings[t.binding.keyBind])||void 0===o?void 0:o.find((e=>e.id===t.binding.id)))?e:Object.assign(Object.assign({},e),{bindings:Object.assign(Object.assign({},e.bindings),{[t.binding.keyBind]:(null!==(s=e.bindings[t.binding.keyBind])&&void 0!==s?s:[]).filter((e=>e.id!==t.binding.id))})});case"add-apply-key-binding":return Object.assign(Object.assign({},e),{applyBindings:[...e.applyBindings,t.binding]});case"remove-apply-key-binding":return Object.assign(Object.assign({},e),{applyBindings:e.applyBindings.filter((e=>e.id!==t.id))});case"set-key-pressed":return Object.assign(Object.assign({},e),{applyBindings:e.applyBindings.map((t=>Object.assign(Object.assign({},t),{active:null!=t.keyBind&&allPressed(t.keyBind,e.pressed)}))),pressed:Object.assign(Object.assign({},e.pressed),{[t.key]:t.pressed}),lastPressed:t.pressed?t.key:void 0})}}const useKeyBindingState=()=>useRecoilReducer({reducer:reducer,atom:Cn}),useKeyBindingReadonlyState=()=>n.useRecoilValue(Cn);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();o.useEffect((()=>{const a=j.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();o.useEffect((()=>{const t=null==e.addPredicate||e.addPredicate(),a=null!=e.cancelPredicate&&e.cancelPredicate();t&&n({type:"push-key-binding",binding:e}),a&&n({type:"remove-key-binding",binding:e})}),t)},useKeyBindings=({keydownRepeatInterval:e=25,keydownIgnorePredicate:t=isInputElement}={})=>{const[n,a]=useKeyBindingState(),s=o.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],o=t.length>0?t[t.length-1]:void 0;null!=o&&(o.fn(),a({type:"remove-key-binding",binding:o}))}))}),[n]);o.useEffect((()=>{const handleKeyDown=e=>{if(!e.repeat&&!t(e.target)){a({type:"set-key-pressed",key:e.key,pressed:!0}),s(e.key);const t=Object.assign(Object.assign({},n.pressed),{[e.key]:!0}),o=matchingSingleFnBindings(n.applyBindings,t,e.key),i=matchingOffBindings(n.applyBindings,t,e.key);(o.length>0||i.length>0)&&e.preventDefault()}},handleKeyUp=e=>{a({type:"set-key-pressed",key:e.key,pressed:!1})};return window.addEventListener("keydown",handleKeyDown),window.addEventListener("keyup",handleKeyUp),()=>{window.removeEventListener("keydown",handleKeyDown),window.removeEventListener("keyup",handleKeyUp)}}),[s,n.applyBindings,n.pressed]),o.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]),o.useEffect((()=>{const t=n.applyBindings.filter((e=>e.repeat&&null!=e.keyBind&&allPressed(e.keyBind,n.pressed))).map((e=>e.fn));if(t.length>0){const n=setInterval((()=>{t.forEach((e=>e()))}),e);return()=>{clearInterval(n)}}return()=>{}}),[n.applyBindings,n.lastPressed])},VertexBoxSelectionButton=()=>{const t=useBoxSelectionActions(),a=n.useRecoilValue(We);return useStackKeyBinding({id:"ExitBoxSelection",keyBind:"Escape",fn:t.disable,addPredicate:()=>a,cancelPredicate:()=>!a},[a]),e.jsx(s.VertexTooltip,{content:"Box Selection",children:e.jsx(s.VertexIconButton,{iconName:"box-cursor",iconColor:a?"primary":"secondary","data-testid":"viewer-toolbar-enable-box-selection-button",onClick:a?t.disable:t.enable})})},wn=1,VertexResizableContent=t=>{var{className:n,style:a,displayShadow:o,heading:i,id:l,initialScale:r,placement:c="left",children:u,onResize:d}=t,m=__rest(t,["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!=r?r:1;return e.jsx(s.VertexResizable,Object.assign({id:l,"data-testid":`resizable-content-position-${c}`,className:Ee(n,"pointer-events-auto z-popover md:z-overlay bg-white bg-opacity-95 flex-grow-0 flex-shrink-0 border-neutral-300",{"border-r min-w-75 max-w-half":"left"===c,"sidebar-shadow-right":"left"===c&&o,"border-l min-w-75 max-w-half":"right"===c,"sidebar-shadow-left":"right"===c&&o,"border-t bottom-0 fixed":"top"===c,"min-h-12 sheet":h}),style:Object.assign({maxHeight:"top"===c?window.innerHeight:void 0},a),initialHorizontalScale:p?r:void 0,initialVerticalScale:h?f:void 0,horizontalDirection:getHorizontalResizeDirection(),verticalDirection:getVerticalResizeDirection(),position:"right"===c||"top"===c?"absolute":"relative",onResizeEnd:()=>null==d?void 0:d()},m,{children:e.jsxs("div",{className:"flex flex-col h-full w-full",children:["top"===c&&e.jsx("div",{className:"flex justify-center w-full",children:e.jsx("div",{className:"block md:hidden w-20 h-0.5 mt-0.5 bg-neutral-600 rounded"})}),i,e.jsx("div",{className:Ee("w-full flex flex-col h-0 flex-grow",{"right-0":"right"===c}),children:u})]})}))};function useDefaultKeybindings(){useApplyKeyBinding({fn:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(G),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:o}){const[s,i]=d.useState(),[l,r]=d.useState();d.useEffect((()=>{const handleTouchStart=e=>{const o=e;null!=o.touches&&1===o.touches.length&&(null!=s&&clearTimeout(s),r(a.Point.create(o.touches[0].clientX,o.touches[0].clientY)),i(setTimeout((()=>null==t?void 0:t(o)),n)))},handleTouchMove=e=>{const t=e;null!=t.touches&&t.touches.length>0&&null!=s&&null!=l&&a.Point.distance(l,a.Point.create(t.touches[0].clientX,t.touches[0].clientY))>=2&&(clearTimeout(s),null==o||o())},handleTouchEnd=()=>{null!=s&&clearTimeout(s)};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,s,l])}var Vn=Object.freeze({__proto__:null,isInputElement:isInputElement,keyBindings:Cn,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:a,disableBackdrop:i,openPredicate:l,onOpen:r,onClose:c,children:u})=>{const d=useContextMenuActions(),m=n.useRecoilValue(_e),p=n.useRecoilValue(Fe),h=o.useMemo((()=>["bottom-end","top-start","top-end","right","left"]),[]),f=m===a;useStackKeyBinding({id:"ContextMenu",keyBind:"Escape",fn:d.clearActiveContextMenu,addPredicate:()=>null!=m&&m===a,cancelPredicate:()=>null==m},[m]);const g=o.useMemo((()=>null!=t?t:null!=l?window:void 0),[t,l]);return useLongPress({target:g,callback:e=>d.longPress(e,a,l,r),onMovement:()=>d.clearActiveContextMenu()}),o.useEffect((()=>{const handleWindowPointerDown=e=>{const t=undefined;if(!targetWithinMenu(e)&&2!==e.buttons&&m===a){const t=targetShouldSkipNextHit(e);d.clearActiveContextMenu(t)}};if(i)return window.addEventListener("pointerdown",handleWindowPointerDown),()=>{window.removeEventListener("pointerdown",handleWindowPointerDown)}}),[i,a,m]),o.useEffect((()=>{const handlePointerDown=e=>{d.pointerDown(e)},handlePointerUp=e=>{d.pointerUp(e,a,l,r)},handleContextMenu=e=>d.contextMenu(e,l);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,a,l]),e.jsx("div",{className:Ee({hidden:!f}),children:e.jsx(s.VertexMenu,{"data-testid":`${a}-context-menu`,open:asBooleanAttribute(f),position:p,fallbackPlacements:h,backdrop:!i,onMenuClosed:()=>{d.clearActiveContextMenu(),null==c||c()},children:e.jsx("div",{className:"pt-1",children:u})})})},VertexFitSelectedMenuItem=()=>{const t=n.useRecoilValue(ht),a=n.useRecoilValue(Ct),o=useViewerCameraActions();return e.jsx(s.VertexMenuItem,{"data-testid":"fit-selected-menu-option",onClick:async()=>{null!=(null==a?void 0:a.boundingBox)&&await o.flyToByBoundingBox(a.boundingBox)},disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"fit-selected",size:"sm"}),"Fit Selected"]})})},VertexFlyToMenuItem=()=>{const t=useViewerCameraActions(),a=n.useRecoilValue(De);return e.jsx(s.VertexMenuItem,{"data-testid":"fly-to-part-menu-option",onClick:async()=>{var e;const n=undefined,o=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!=o&&await t.flyToById(o)},disabled:asBooleanAttribute(null==a),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"paper-airplane",size:"sm"}),"Fly To"]})})};function useSceneItemsOperations(){const e=n.useRecoilValue(G),t=undefined,a=undefined,s=undefined,i=undefined,l=undefined,r=undefined;return{sceneItemsOperation:o.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:o.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:o.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:o.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:o.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:o.useCallback((async()=>{const t=await(null==e?void 0:e.scene());null==t||t.items((e=>[e.where((e=>e.withSelected())).setPhantom(!1)])).execute()}),[e])}}const VertexHideAllMenuItem=()=>{const t=useSceneItemsOperations();return e.jsx(s.VertexMenuItem,{"data-testid":"hide-all-menu-option",onClick:async()=>{await t.sceneItemsOperation((e=>e.hide()))},children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide All Parts"]})})},VertexHidePartMenuItem=()=>{const t=n.useRecoilValue(De),a=useSceneItemsOperations();return e.jsx(s.VertexMenuItem,{"data-testid":"hide-menu-option",onClick:async()=>{var e;const n=undefined,o=contextMenuItemIsRow(t)?null===(e=null==t?void 0:t.node.id)||void 0===e?void 0:e.hex:t.id;null!=o&&await a.sceneItemsOperation((e=>e.hide()),[o])},disabled:asBooleanAttribute(null==t),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide Part"]})})},VertexHideSelectedMenuItem=()=>{const t=n.useRecoilValue(ht),a=useSceneItemsOperations();return e.jsx(s.VertexMenuItem,{"data-testid":"hide-selected-menu-option",onClick:()=>a.hideSelected(),disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide Selected"]})})},VertexShowAllMenuItem=()=>{const t=useSceneItemsOperations();return e.jsx(s.VertexMenuItem,{"data-testid":"show-all-menu-option",onClick:async()=>{await t.sceneItemsOperation((e=>e.show()))},children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show All Parts"]})})},VertexShowOnlyMenuItem=()=>{const t=n.useRecoilValue(De),a=useSceneItemsOperations();return e.jsx(s.VertexMenuItem,{"data-testid":"show-only-menu-option",onClick:async()=>{var e;const n=undefined,o=contextMenuItemIsRow(t)?null===(e=null==t?void 0:t.node.id)||void 0===e?void 0:e.hex:null==t?void 0:t.id;null!=o&&await a.showOnlyItem(o)},disabled:asBooleanAttribute(null==t),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show Only Part"]})})},VertexShowOnlySelectedMenuItem=()=>{const t=n.useRecoilValue(ht),a=useSceneItemsOperations();return e.jsx(s.VertexMenuItem,{"data-testid":"show-only-selected-menu-option",onClick:()=>a.showOnlySelected(),disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show Only Selected"]})})},jn=n.atom({key:"openedPanelActivePrimaryLeft",default:void 0}),Tn=n.atom({key:"openedPanelActivePrimaryRight",default:void 0}),An=n.atom({key:"openedPanelActiveSceneTreeSecondary",default:void 0});function usePanelActions(){return{openPrimary:useActionCallback((({set:e})=>(t,n)=>{e("left"===n?jn:Tn,t)})),closePrimary:useActionCallback((({set:e})=>t=>{e("left"===t?jn:Tn,void 0)})),openSecondary:useActionCallback((({set:e})=>t=>e(An,t))),closeSecondary:useActionCallback((({reset:e})=>()=>e(An)))}}var kn=Object.freeze({__proto__:null,openedPanelActivePrimaryLeft:jn,openedPanelActivePrimaryRight:Tn,openedPanelActiveSceneTreeSecondary:An,usePanelActions:usePanelActions});const VertexShowPropertiesMenuItem=()=>{const t=usePanelActions(),a=useSelectionActions(),o=n.useRecoilValue(De);return e.jsx(s.VertexMenuItem,{"data-testid":"show-properties-menu-option",disabled:asBooleanAttribute(null==o),onClick:()=>{var e;const n=undefined,s=contextMenuItemIsRow(o)?null===(e=null==o?void 0:o.node.id)||void 0===e?void 0:e.hex:null==o?void 0:o.id;null!=s&&(a.clearAndSelect({id:s}),t.openSecondary("Properties"))},children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"info",size:"sm"}),"Show Properties"]})})},Pn=n.atom({key:"sceneTreeLoaderVisible",default:!1}),In=n.atom({key:"sceneTreeElement",default:void 0}),En=n.atom({key:"sceneTreeController",default:void 0,dangerouslyAllowMutability:!0}),Mn=n.atom({key:"sceneTreeOpenPopover",default:void 0}),On=n.selectorFamily({key:"sceneTreePopoverIsOpen",get:e=>({get:t})=>t(Mn)===e});function useSceneTreeActions(){const e=useSelectionActions(),t=useViewerCameraActions();return{toggleSelection:useActionCallback((({snapshot:t})=>async(n,a,o)=>{var s,i;if(!n.defaultPrevented&&0===n.button&&(n.altKey||((n.ctrlKey||n.metaKey)&&a.selected?await o.deselectItem(a):a.selected?await o.selectItem(a,{recurseParent:!0}):a.selected||await o.selectItem(a,{append:n.ctrlKey||n.metaKey,range:n.shiftKey})),null!=a.id)){const o=await t.getPromise(ft);e.syncSelection({id:null===(s=a.id)||void 0===s?void 0:s.hex,ancestors:null!==(i=null==o?void 0:o.ancestors)&&void 0!==i?i:[]},{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 o=await e.getPromise(In),s=await(null==o?void 0:o.getRowAtClientY(n));null!=(null===(a=null==s?void 0:s.node.id)||void 0===a?void 0:a.hex)&&await t.flyToById(s.node.id.hex)})),flyToFirstSelectedItem:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(In),n=await e.getPromise(yt);null!=n&&(null==t||t.scrollToItem(n))})),setContextMenuItem:useActionCallback((({set:e,snapshot:t})=>async n=>{const a=await t.getPromise(In),o=await(null==a?void 0:a.getRowAtClientY(n));e(De,o)})),openSceneTreePopover:useActionCallback((({set:e})=>t=>{e(Mn,t)})),closeSceneTreePopover:useActionCallback((({set:e})=>()=>{e(Mn,void 0)}))}}var Rn=Object.freeze({__proto__:null,sceneTreeController:En,sceneTreeElement:In,sceneTreeLoaderVisible:Pn,sceneTreeOpenPopover:Mn,sceneTreePopoverIsOpen:On,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,o;let s="";switch(null==e?void 0:e.type){case"string":s=null!==(t=e.value)&&void 0!==t?t:s;break;case"long":s=null!==(n=e.value.toString())&&void 0!==n?n:s;break;case"double":s=null!==(a=e.value.toString())&&void 0!==a?a:s;break;case"timestamp":s=null!==(o=e.value.seconds.toLocaleString())&&void 0!==o?o:s}return s}const Nn=n.atom({key:"showMetadataSceneItemProperties",default:!0}),_n=n.selectorFamily({key:"nextMetadataSceneItemProperties",get:e=>async({get:t})=>{var n,a,o;const s=t(G),i=t(Bn(e));try{const t=await(null===(n=null==s?void 0:s.sceneItems)||void 0===n?void 0:n.listSceneItemMetadata(e,{cursor:i,size:20})),l=null===(a=null==t?void 0:t.entries)||void 0===a?void 0:a.map((e=>fromApiProperty(e))),r=undefined;return{metadata:null!=l?null===(o=[...l])||void 0===o?void 0:o.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)}}}),Ln=n.atomFamily({key:"loadedMetadataSceneItemProperties",default:[]}),Bn=n.atomFamily({key:"metadataSceneItemPropertiesCursor",default:void 0}),Dn=n.selectorFamily({key:"hasMoreMetadataSceneItemProperties",get:e=>({get:t})=>{const n=undefined;return null!=t(Bn(e))}}),zn=n.atomFamily({key:"isFetchingMetadataSceneItemProperties",default:!1}),Fn=n.selector({key:"metadataSceneItemName",get:async({get:e})=>{var t;const n=e(ft);if(null!=n){const a=e(mt(n.id));return null!==(t=null==a?void 0:a.name)&&void 0!==t?t:void 0}}});var Hn=Object.freeze({__proto__:null,apiMetadataPropertyDisplayValue:apiMetadataPropertyDisplayValue,fromApiProperty:fromApiProperty,hasMoreMetadataSceneItemProperties:Dn,isFetchingMetadataSceneItemProperties:zn,loadedMetadataSceneItemProperties:Ln,metadataSceneItemName:Fn,metadataSceneItemPropertiesCursor:Bn,nextMetadataSceneItemProperties:_n,showMetadataSceneItemProperties:Nn});const VertexGhostSelectedMenuItem=()=>{const t=n.useRecoilValue(ht),a=useSceneItemsOperations();return e.jsx(s.VertexMenuItem,{"data-testid":"ghost-selected-menu-option",onClick:()=>a.ghostSelected(),disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"visibility-partial",size:"sm"}),"Ghost Selected"]})})},VertexUnghostSelectedMenuItem=()=>{const t=n.useRecoilValue(ht),a=useSceneItemsOperations();return e.jsx(s.VertexMenuItem,{"data-testid":"unghost-selected-menu-option",onClick:()=>a.unGhostSelected(),disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),"Unghost Selected"]})})},DefaultSceneTreeContextMenu=()=>{const t=n.useRecoilValue(Nn);return e.jsxs("div",{className:"w-56",children:[e.jsx(VertexHideSelectedMenuItem,{}),e.jsx(VertexHideAllMenuItem,{}),e.jsx(VertexShowOnlyMenuItem,{}),e.jsx(VertexShowOnlySelectedMenuItem,{}),e.jsx(VertexShowAllMenuItem,{}),e.jsx(VertexGhostSelectedMenuItem,{}),e.jsx(VertexUnghostSelectedMenuItem,{}),e.jsx(s.VertexMenuDivider,{}),e.jsx(VertexFitSelectedMenuItem,{}),e.jsx(VertexFlyToMenuItem,{}),t&&e.jsxs("div",{children:[e.jsx(s.VertexMenuDivider,{}),e.jsx(VertexShowPropertiesMenuItem,{})]})]})},VertexSceneTreeContextMenu=({children:t})=>{const a=useSceneTreeActions(),o=n.useRecoilValue(In),s=null!=t&&!1!==t;return e.jsx(VertexContextMenu,{menuType:"scene-tree",targetElement:o,onOpen:async(e,t)=>{const n=e;await a.setContextMenuItem(n.clientY)},disableBackdrop:!0,children:s?t:e.jsx(DefaultSceneTreeContextMenu,{})})},DefaultViewerContextMenu=()=>{const t=n.useRecoilValue(Nn);return e.jsxs("div",{className:"w-56",children:[e.jsx(VertexHidePartMenuItem,{}),e.jsx(VertexHideSelectedMenuItem,{}),e.jsx(VertexHideAllMenuItem,{}),e.jsx(VertexShowOnlyMenuItem,{}),e.jsx(VertexShowOnlySelectedMenuItem,{}),e.jsx(VertexShowAllMenuItem,{}),e.jsx(VertexGhostSelectedMenuItem,{}),e.jsx(VertexUnghostSelectedMenuItem,{}),e.jsx(s.VertexMenuDivider,{}),e.jsx(VertexFitSelectedMenuItem,{}),e.jsx(VertexFlyToMenuItem,{}),t&&e.jsxs("div",{children:[e.jsx(s.VertexMenuDivider,{}),e.jsx(VertexShowPropertiesMenuItem,{})]})]})},VertexViewerContextMenu=({children:t})=>{const n=null!=t&&!1!==t,a=o.useCallback((e=>e.target instanceof HTMLElement&&"vertex-viewer"===e.target.id),[]);return e.jsx(VertexContextMenu,{menuType:"viewer",disableBackdrop:!0,openPredicate:a,children:n?t:e.jsx(DefaultViewerContextMenu,{})})},Wn=35,Un=n.atom({key:"sceneItemGhostingSelectedOpacity",default:Wn}),Gn=n.atomFamily({key:"appliedItemPhantomState",default:void 0}),Kn=n.atom({key:"appliedItemPhantomStateIds",default:[]}),$n=n.selector({key:"sceneItemGhostingLastSelectedPhantom",get:({get:e})=>{var t;const n=e(ft);return null!=n&&(null!==(t=e(Gn(n.id)))&&void 0!==t&&t)}}),VertexSceneItemGhostingOpacitySlider=({onApply:t})=>{const[a,o]=n.useRecoilState(Un);return e.jsx(VertexSlider,{id:"phantom-opacity","data-testid":"phantom-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:a,valueLabelDisplay:"auto",onValueInput:e=>{o(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(Kn)).forEach((e=>t(Gn(e)))),t(Kn)}));return{setPhantomState:useActionCallback((({snapshot:t,set:n})=>async a=>{const o=await t.getPromise(ht);o.forEach((e=>n(Gn(e),a))),n(Kn,(e=>[...e,...o])),await e.execute(ct.SET_PHANTOM_SELECTED_ITEMS,(e=>e.where((e=>e.withSelected())).setPhantom(a)))})),clearPhantomState:useActionCallback((({snapshot:t,set:n,reset:a})=>async()=>{const o=await t.getPromise(ht);o.forEach((e=>a(Gn(e)))),n(Kn,(e=>e.filter((e=>!o.includes(e))))),await e.execute(ct.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(ct.CLEAR_PHANTOM_ALL,(e=>e.where((e=>e.all())).clearPhantom()),(e=>e.where((e=>e.withSelected())).select()))})),resetAllPhantomState:t}};var qn=Object.freeze({__proto__:null,DEFAULT_GHOSTING_OPACITY:Wn,appliedItemPhantomState:Gn,appliedItemPhantomStateIds:Kn,sceneItemGhostingLastSelectedPhantom:$n,sceneItemGhostingSelectedOpacity:Un,useSceneItemPhantomActions:useSceneItemPhantomActions});const VertexSceneItemGhostingToggle=({onApply:t})=>{const a=useSceneItemPhantomActions(),o=n.useRecoilValue(jt),i=n.useRecoilValueLoadable($n);return e.jsx(s.VertexTooltip,{content:"Select a part to display as ghost",disabled:o,children:e.jsx(s.VertexToggle,{className:"flex items-center","data-testid":"phantom-state-toggle",variant:"switch",disabled:!o,checked:"hasValue"===i.state&&i.contents,onValueChanged:async e=>{await a.setPhantomState(e.detail),null==t||t(e.detail)}})})};function VertexGhostingControls({onApplyGhostingChange:t,onApplyOpacity:n}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center py-3",children:[e.jsx(VertexSceneItemGhostingToggle,{onApply:t}),e.jsx("span",{className:"pl-4 text-sm text-neutral-700",children:"Display as Ghost"})]}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Global Ghost Opacity"}),e.jsx(VertexSceneItemGhostingOpacitySlider,{onApply:n})]})}const VertexSceneItemGhostingClear=({onClear:t,onClearAll:a})=>{const o=useSceneItemPhantomActions(),i=n.useRecoilValue($n);return e.jsx("div",{className:"ml-auto",children:e.jsxs(ResetButton,{id:"phantom",tooltip:"Clear Ghosting",children:[e.jsx("div",{className:"pt-1"}),e.jsx(s.VertexMenuItem,{"data-testid":"reset-selected-phantom",onClick:async()=>{await o.clearPhantomState(),null==t||t()},disabled:!i,children:"Clear ghosting for selected"}),e.jsx(s.VertexMenuItem,{"data-testid":"reset-all-phantom",onClick:async()=>{await o.clearAllPhantomState(),null==a||a()},children:"Clear ghosting for all"})]})})};function VertexGhostingPanelSection({onClearGhostState:t,onClearAllGhostState:n,onApplyGhostingChange:a,onApplyOpacity:o}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Ghosting",e.jsx(VertexSceneItemGhostingClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexGhostingControls,{onApplyGhostingChange:a,onApplyOpacity:o})})}function VertexMeasurementContextMenu({onDelete:t}){const a=n.useRecoilValue(Be);return e.jsx(VertexContextMenu,{menuType:"measurement",openPredicate:e=>e.target instanceof HTMLElement&&"VERTEX-VIEWER-MEASUREMENT-DISTANCE"===e.target.tagName,children:e.jsxs(s.VertexMenuItem,{"data-testid":"measurement-delete",onClick:()=>null!=a&&t(a.id),children:[e.jsx(s.VertexIcon,{slot:"icon",name:"delete",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Delete"})]})})}function useDockedPlacement(e,t){const[n,o]=d.useState(a.Point.create(0,0));return d.useLayoutEffect((()=>{if(null!=e){const n=e.getBoundingClientRect(),s=a.Point.create(n.left,n.bottom),i=a.Point.create(n.right,n.bottom);o("left"===t?s:i)}}),[e,t]),n}function VertexMeasurementDetails({placement:t,size:a}){const o=useMeasurementActions(),i=n.useRecoilValue(G),r=n.useRecoilValue(K),c=useDockedPlacement(null!=i?i:null,t),u=n.useRecoilValue(at),d=n.useRecoilValue(ot),m=n.useRecoilValue(st),p=n.useRecoilValue(it),h=n.useRecoilValue(kt),f=n.useRecoilValue(Pt);return e.jsx(s.VertexDraggablePopover,{className:"z-popover",boundaryPadding:16,boundarySelector:`#${r}`,position:c,children:e.jsxs("div",{className:Ee("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:[e.jsxs("div",{className:"pb-2 flex justify-between items-center",children:[e.jsx("div",{className:Ee("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.jsx("div",{className:Ee("mr-0.5",{hidden:!p}),children:e.jsx(s.VertexTooltip,{content:"Reset",placement:"left-start",children:e.jsx(s.VertexIconButton,{"data-testid":"measurement-details-reset",iconName:"reset",iconSize:"sm",onClick:o.resetMeasurement})})})]}),e.jsx(l.VertexViewerMeasurementDetails,{"data-testid":"measurement-details-viewer-measurement-details",className:Ee("gap-y-1.5",{hidden:null==u}),measurementOutcome:u,measurementOverlays:d,distanceUnits:toUnitType(h),fractionalDigits:parseInt(f,10)}),e.jsx("div",{"data-testid":"measurement-details-message",className:Ee({hidden:null==m}),children:m})]})})}function useCallbackRef(e){var t;const[n,a]=o.useState((t=void 0,null)),s=undefined;return{element:n,callback:o.useCallback((e=>a(e)),[])}}function VertexPointToPointMeasurement({detailsPlacement:t,detailsSize:a,onPointToPointMeasurementChange:s}){const i=useMeasurementActions(),r=n.useRecoilValue(G),c=n.useRecoilValue(Ke),u=n.useRecoilValue(qe),d=n.useRecoilValue(kt),m=n.useRecoilValue(Pt),{callback:p,element:h}=useCallbackRef();usePointToPointMeasurement(h);const f=o.useCallback((e=>{const t={start:e.detail.start,end:e.detail.end,invalid:!e.detail.valid};i.setEditedPointToPointMeasurement(t),null==s||s(t)}),[i]);return c?e.jsxs(e.Fragment,{children:[e.jsx(l.VertexViewerMeasurementDistance,{"data-testid":"point-to-point-measurement",ref:p,viewer:null!=r?r:void 0,mode:"replace",start:null==u?void 0:u.start,end:null==u?void 0:u.end,invalid:null==u?void 0:u.invalid,units:toUnitType(d),fractionalDigits:parseInt(m,10),showAxisReferenceLines:!0,onEditEnd:f}),e.jsx(VertexMeasurementDetails,{placement:t,size:a}),e.jsx(VertexMeasurementContextMenu,{onDelete:i.resetMeasurement})]}):e.jsx(e.Fragment,{})}function VertexPointToPointMeasurementTool(){const t=useMeasurementActions(),a=n.useRecoilValue(Ke);return useStackKeyBinding({id:"ExitMeasurement",keyBind:"Escape",fn:t.disableEditMeasurement,addPredicate:()=>a,cancelPredicate:()=>!a},[a,t]),e.jsx(s.VertexTooltip,{content:"Point to Point Measurement",children:e.jsx(s.VertexIconButton,{iconName:"tape-measure","data-testid":"viewer-toolbar-point-to-point-measurement-button",iconColor:a?"primary":"secondary",onClick:t.toggleEditPointToPointMeasurement})})}const Yn=n.atom({key:"viewerToolkitSdkConfig",default:void 0});var Xn=Object.freeze({__proto__:null,sdkConfig:Yn});const VertexPreciseMeasurement=({detailsPlacement:t,detailsSize:a,onEntitiesChanged:o,onOutcomeChanged:s})=>{var i,r,c,u;const d=n.useRecoilValue(G),m=n.useRecoilValue(Yn),p=n.useRecoilValue(Xe),{callback:h,element:f}=useCallbackRef();return usePreciseMeasurementModel(f,o,s),p?e.jsxs(e.Fragment,{children:[e.jsx(l.VertexViewerMeasurementPrecise,{"data-testid":"precise-measurement-viewer-tool",ref:h,viewer:null!=d?d:void 0,config:JSON.stringify({network:{apiHost:null===(i=null==m?void 0:m.network)||void 0===i?void 0:i.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===(u=null==m?void 0:m.network)||void 0===u?void 0:u.sceneViewHost}})}),e.jsx(VertexMeasurementDetails,{placement:t,size:a})]}):e.jsx(e.Fragment,{})};function VertexPreciseMeasurementTool(){const t=useMeasurementActions(),a=n.useRecoilValue(Xe);return e.jsx(s.VertexTooltip,{content:"Precise Measurement",children:e.jsx(s.VertexIconButton,{iconName:"ruler","data-testid":"viewer-toolbar-precise-measurement-button",iconColor:a?"primary":"secondary",onClick:t.toggleEditPreciseMeasurement})})}function VertexApplicationMessages(){const t=n.useRecoilValue(F),a=n.useRecoilValue(D);return e.jsxs(e.Fragment,{children:[null!=t&&e.jsx(s.VertexBanner,{className:"z-[16000]",duration:t.duration,open:!0,content:t.message,type:t.type},t.id),null!=a&&e.jsx(s.VertexToast,{placement:"bottom-left",className:"z-[16000]",duration:a.duration,open:!0,content:a.message,type:a.type},a.id)]})}const Zn={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 Jn=n.atom({key:"sceneTreeColumnsRefreshTrigger",default:0}),Qn=n.atom({key:"sceneTreeColumnsWhitelistedColumns",default:[]}),ea=n.selector({key:"sceneTreeColumnsAvailableColumns",get:async({get:e})=>{const t=e(En);return e(Jn),null!=t?await t.fetchMetadataKeys():[]}}),ta=n.selector({key:"sceneTreeColumnsAvailableSortedColumns",get:({get:e})=>e(ea).filter((e=>e!==Zn.metadataKeyName)).sort(((e,t)=>e.localeCompare(t)))}),na=n.atom({key:"sceneTreeColumnsVisibleMetadataColumnNames",default:[]}),aa=n.selector({key:"sceneTreeColumnsActiveColumns",get:({get:e})=>{const t=e(na),n=e(In),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({},Zn),{initialWidth:e,minWidth:n})})}return{Name:Zn}}}),oa=n.selector({key:"sceneTreeColumnsActiveColumnNames",get:({get:e})=>Object.keys(e(aa))});function useSceneTreeColumnActions(){return{setActive:useActionCallback((({set:e})=>async t=>{e(na,t)})),refreshKeyList:useActionCallback((({set:e})=>()=>{e(Jn,(e=>e+1))}))}}const sa=16,ia=-8;var la;function useOpenPositionedPopover({open:e,buttonElement:t,horizontalOffset:n,verticalOffset:a}){const[o,s]=d.useState(),[i,l]=d.useState(),r=undefined;return{position:o,direction:i,handleOpen:d.useCallback((()=>{if(!e){const e=null==t?void 0:t.getBoundingClientRect();if(null!=e){const t=null!=n?n:sa,o=null!=a?a:ia,i=e.x>window.innerWidth/2?la.LEFT:la.RIGHT;s({x:i===la.LEFT?e.left-t:e.right+t,y:e.top+o}),l(i)}}}),[e,t])}}!function(e){e.LEFT="left",e.RIGHT="right"}(la||(la={}));var ra=Object.freeze({__proto__:null,DEFAULT_HORIZONTAL_POSITION_OFFSET:sa,DEFAULT_NAME_COLUMN:Zn,DEFAULT_VERTICAL_POSITION_OFFSET:ia,get PlacementDirection(){return la},mapToColumn:mapToColumn,sceneTreeColumnsActiveColumnNames:oa,sceneTreeColumnsActiveColumns:aa,sceneTreeColumnsAvailableColumns:ea,sceneTreeColumnsAvailableSortedColumns:ta,sceneTreeColumnsRefreshTrigger:Jn,sceneTreeColumnsVisibleMetadataColumnNames:na,sceneTreeColumnsWhitelistedColumns:Qn,useOpenPositionedPopover:useOpenPositionedPopover,useSceneTreeColumnActions:useSceneTreeColumnActions});const ca=n.atom({key:"sceneTreeSearchActive",default:!1}),ua=n.atom({key:"sceneTreeColumnsPartial",default:!1}),da=n.atom({key:"sceneTreeSearchValue",default:void 0}),ma=n.atom({key:"sceneTreeSearchExactMatch",default:!1}),pa=n.atom({key:"sceneTreeSearchRemoveHiddenItems",default:!1}),ha=n.atom({key:"sceneTreeSearchResultCount",default:0}),fa=n.atom({key:"sceneTreeSearchActiveColumns",default:[]}),xa=n.selector({key:"sceneTreeSearchNameColumnActive",get:({get:e})=>{const t=e(fa);return 0===t.length||t.includes(Zn.metadataKeyName)}});function useSceneTreeSearch({sceneTreeElement:e}){const t=useSceneTreeActions(),a=n.useRecoilValue(ca),s=n.useSetRecoilState(ha),i=n.useSetRecoilState(yt);o.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)&&s(null==e?void 0:e.totalFilteredRows)}))})),()=>{null==t||t.dispose()}}),[e]),o.useEffect((()=>{if(null!=e){let n;return whenComponentReady(e,(()=>{var o;n=null===(o=null==e?void 0:e.controller)||void 0===o?void 0:o.stateChanged((e=>{var n;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===(n=null==t?void 0:t.node.id)||void 0===n?void 0:n.hex)}else a&&t.flyToFirstSelectedItem()}))})),()=>{null==n||n.dispose()}}}),[e,null==e?void 0:e.controller,open])}function useSceneTreePartialResults({sceneTreeElement:e}){const t=n.useSetRecoilState(ua);o.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(fa,t)})),t=useActionCallback((({snapshot:t})=>async(n,a,o,s)=>{const i=await t.getPromise(In),l=await t.getPromise(ma),r=await t.getPromise(pa),c=await t.getPromise(fa),u=c.length>0?a?[...c,n]:c.filter((e=>e!==n)):[...o,Zn.metadataKeyName].filter((e=>e!==n));e(u),s&&(null==i||i.filterItems(s,{columns:u,exactMatch:l,removeHiddenItems:r}))})),n=useActionCallback((({snapshot:e,set:t})=>async(n,a,o)=>{const s=await e.getPromise(In),i=await e.getPromise(ma),l=await e.getPromise(pa),r=await e.getPromise(fa),c=n.filter((e=>!a.includes(e))),u=a.filter((e=>!n.includes(e))),d=r.length>0?[...r.filter((e=>!c.includes(e))),...u]:[...a,Zn.metadataKeyName],m=d.length>0?d:[...a,Zn.metadataKeyName];t(fa,m),o&&(null==s||s.filterItems(o,{columns:m,exactMatch:i,removeHiddenItems:l}))})),a=useActionCallback((({set:e})=>t=>{e(ma,t)})),o=useActionCallback((({set:e})=>t=>{e(pa,t)}));return{setMetadataSearchKeys:e,updateMetadataSearchAfterSearchKeysChange:t,updateMetadataSearchAfterColumnVisibilityChange:n,setMetadataSearchExactMatch:a,setMetadataSearchRemoveHiddenItems:o}};var ga=Object.freeze({__proto__:null,sceneTreeColumnsPartial:ua,sceneTreeSearchActive:ca,sceneTreeSearchActiveColumns:fa,sceneTreeSearchExactMatch:ma,sceneTreeSearchNameColumnActive:xa,sceneTreeSearchRemoveHiddenItems:pa,sceneTreeSearchResultCount:ha,sceneTreeSearchValue:da,useSceneTreePartialResults:useSceneTreePartialResults,useSceneTreeSearch:useSceneTreeSearch,useSceneTreeSearchActions:useSceneTreeSearchActions});const targetIsElement=(e,t)=>e instanceof Element&&e.tagName===t;function useRecoilRef({state:e}){const t=n.useRecoilCallback((({set:t})=>n=>{t(e,n)}),[]);return t}var va;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===va.ROBOTO_MONO?"var(--vertex-ui-font-family-monospace)":"var(--vertex-ui-font-family)"}!function(e){e.ROBOTO="ROBOTO",e.ROBOTO_MONO="ROBOTO_MONO"}(va||(va={}));const ya=n.atom({key:"sceneTreeAdditionalMetadataKeys",default:[]}),ba=n.selector({key:"sceneTreeActiveMetadataKeys",get:({get:e})=>{const t=e(ya),n=e(na),a=e(Qn),o=new Set([...t,...n]),s=new Set(a);return 0===a.length?Array.from(o):Array.from(o.intersection(s))}});var Sa=Object.freeze({__proto__:null,sceneTreeActiveMetadataKeys:ba,sceneTreeAdditionalMetadataKeys:ya});function childrenAsArray(e){return Array.isArray(e)?e:[e]}function filterChildElements(e,t){return childrenAsArray(e).filter((e=>o.isValidElement(e)&&e.type===t))}function findChildElement(e,t){return filterChildElements(e,t)[0]}function cloneChildNodeOrFunction(e,t){return"object"==typeof e?o.cloneElement(e,t):e(t)}function useStateSyncedValue(e,t,{transform:a}={}){const[s,i]=n.useRecoilState(e);return o.useEffect((()=>{null!=t&&i(null!=a?a(t):t)}),[t]),s}const VertexEnterSceneTreeSearchModeButton=({onEnterSearchMode:t})=>{const a=n.useSetRecoilState(ca);return e.jsx(s.VertexTooltip,{className:"flex ml-auto",content:"Scene Tree Search",children:e.jsx(s.VertexIconButton,{"data-testid":"enter-scene-tree-search-mode-button",iconName:"search",iconSize:"sm",onPointerDown:e=>{e.preventDefault()},onClick:()=>{a(!0),null==t||t()}})})},VertexSceneTreeMetadataCheck=({checked:t,disabled:n,onChange:a,children:o})=>{const i="string"==typeof o?o.replace(" ","-"):"";return e.jsxs("div",{className:"flex items-center",children:[e.jsx(s.VertexToggle,{"data-testid":`scene-tree-metadata-check-${i}`,variant:"check",checked:t,disabled:n,onValueChanged:e=>null==a?void 0:a(e.detail)}),e.jsx("div",{className:"pl-2 py-1 text-[0.875rem] w-full","data-testid":`scene-tree-metadata-name-${i}`,onClick:()=>{n||null==a||a(!t)},children:o})]})},VertexSceneTreeSearchOptionsPopover=({onSearchedSceneTreeColumnsChange:t,onSearchForExactMatchChange:a})=>{const o=useSceneTreeActions(),i=useSceneTreeSearchActions(),l=n.useRecoilValue(In),r=n.useRecoilValue(xa),c=n.useRecoilValue(fa),u=n.useRecoilValue(da),m=n.useRecoilValue(ma),p=n.useRecoilValue(pa),h=n.useRecoilValue(na),{element:f,callback:g}=useCallbackRef(),v="scene-tree-search",b=n.useRecoilValue(On(v)),{position:S,direction:C,handleOpen:w}=useOpenPositionedPopover({open:b,buttonElement:f,horizontalOffset:40}),V=d.useCallback((()=>{o.closeSceneTreePopover()}),[]),j=C===la.LEFT?"left-end":"right-start",updateSearch=async(e,t)=>{if(u){const n=c.length>0?c:[...h,Zn.metadataKeyName];await(null==l?void 0:l.filterItems(u,{columns:n,exactMatch:e,removeHiddenItems:t}))}};return e.jsxs(e.Fragment,{children:[e.jsx(s.VertexTooltip,{content:"Search Options",placement:"top",children:e.jsx(s.VertexIconButton,{"data-testid":"scene-tree-search-options-popover-button",ref:g,iconName:"gear",iconSize:"sm",onClick:()=>{b?V():(w(),o.openSceneTreePopover(v))}})}),b&&e.jsx(s.VertexPopover,{"data-testid":"scene-tree-search-options-popover",open:b,backdrop:!1,position:S,resizeBehavior:"fixed",placement:j,className:"z-popover",children:e.jsxs("div",{className:Ee("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!b}),children:[e.jsxs("div",{className:"flex items-center text-[0.875rem] p-3 border-b border-neutral-300 pb-2",children:[e.jsx("div",{className:"pr-2 text-[0.875rem] whitespace-nowrap",children:"Column Properties Search"}),e.jsx(s.VertexIconButton,{className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{V()}})]}),e.jsxs("div",{className:"max-h-64 p-3 overflow-y-auto",children:[e.jsx("div",{className:"text-[0.875rem] pb-2 pr-2",children:"Select properties to perform the search on:"}),e.jsx(VertexSceneTreeMetadataCheck,{checked:r,disabled:0===c.length||c.every((e=>e===Zn.metadataKeyName)),onChange:async e=>{await i.updateMetadataSearchAfterSearchKeysChange(Zn.metadataKeyName,e,h,u),null==t||t()},children:Zn.label},Zn.metadataKeyName),h.map((n=>e.jsx(VertexSceneTreeMetadataCheck,{checked:c.includes(n),disabled:c.length>0&&c.every((e=>e===n)),onChange:async e=>{await i.updateMetadataSearchAfterSearchKeysChange(n,e,h,u),null==t||t()},children:n},n)))]}),e.jsxs("div",{className:"flex p-3 border-t border-neutral-300",children:[e.jsx(s.VertexToggle,{className:"flex items-center","data-testid":"filter-exact-match-toggle",variant:"switch",checked:m,onValueChanged:async e=>{i.setMetadataSearchExactMatch(e.detail),null==a||a(),await updateSearch(e.detail,p)}}),e.jsx("span",{className:"pl-4 text-[0.875rem] text-neutral-800",children:"Return only exact matches"})]}),e.jsxs("div",{className:"flex px-3 pb-3",children:[e.jsx(s.VertexToggle,{className:"flex items-center","data-testid":"filter-remove-hidden-items-toggle",variant:"switch",checked:p,onValueChanged:async e=>{i.setMetadataSearchRemoveHiddenItems(e.detail),await updateSearch(m,e.detail)}}),e.jsx("span",{className:"pl-4 text-[0.875rem] text-neutral-800",children:"Search only visible items"})]})]})})]})},VertexSceneTreeSearchBar=({onSearch:t,onClearSearch:a,onExitSearchMode:o,onSearchedSceneTreeColumnsChange:i,onSearchForExactMatchChange:r,children:c})=>{const u=useSceneTreeActions(),m=n.useRecoilValue(In),[p,h]=n.useRecoilState(ca),[f,g]=n.useRecoilState(da);useSceneTreeSearch({sceneTreeElement:null!=m?m:null});const{element:v,callback:b}=useCallbackRef(),S=null==f||""===f,C=S?"Exit Search":"Clear Search";return d.useEffect((()=>{p&&(null==v||v.setFocus())}),[v,p]),e.jsxs("div",{className:"flex w-full py-3 px-2",children:[e.jsx(l.VertexSceneTreeSearch,{"data-testid":"scene-tree-search-bar",ref:b,controller:null==m?void 0:m.controller,onBlur:()=>{S&&(h(!1),null==o||o())},onSearch:()=>{g(null==v?void 0:v.value),null==t||t(null==v?void 0:v.value)},children:c}),e.jsx("div",{className:"self-center px-1",onPointerDown:e=>{e.preventDefault()},children:e.jsx(VertexSceneTreeSearchOptionsPopover,{onSearchedSceneTreeColumnsChange:i,onSearchForExactMatchChange:r})}),e.jsx(s.VertexTooltip,{className:"self-center pr-1",content:C,children:e.jsx(s.VertexIconButton,{"data-testid":"scene-tree-search-close-button",iconName:"close-circle-fill",iconSize:"sm",variant:"plain",onPointerDown:e=>{e.preventDefault()},onClick:async()=>{S?(h(!1),await u.flyToFirstSelectedItem(),null==o||o()):(await(null==v?void 0:v.clear()),await(null==v?void 0:v.setFocus()),g(void 0),null==a||a())}})})]})},VertexSceneTreeSearch=({onEnterSearchMode:t,onExitSearchMode:a,onSearch:o,onClearSearch:s,onSearchedSceneTreeColumnsChange:i,onSearchForExactMatchChange:r,children:c})=>{const u=n.useRecoilValue(ca);return e.jsxs(l.VertexSceneTreeToolbar,{className:"h-11 p-0 border-b border-neutral-300 box-content",slot:"header",children:[u&&e.jsx(VertexSceneTreeSearchBar,{onSearch:o,onClearSearch:s,onExitSearchMode:a,onSearchedSceneTreeColumnsChange:i,onSearchForExactMatchChange:r,children:c}),!u&&e.jsx("div",{className:"ml-auto mr-2",children:e.jsx(VertexEnterSceneTreeSearchModeButton,{onEnterSearchMode:t})})]})};function useCacheableLoadable(e,t){const a=o.useRef(),[s,i]=o.useState(0),l=n.useRecoilValueLoadable(e);o.useEffect((()=>{"hasValue"===l.state&&(a.current=l.contents)}),[t,l]);const[r,c]=o.useMemo((()=>"hasValue"!==l.state&&null!=a.current?[a.current,!0]:"hasValue"===l.state?[l.contents,!1]:[void 0,!1]),[l.state,l.contents,s]),u=o.useCallback((()=>{a.current=void 0,i(s+1)}),[s]),d=undefined;return o.useMemo((()=>({data:r,state:l.state,cached:c,invalidate:u})),[u,r,c,l.state])}const VertexSceneTreeColumnPopover=({onVisibleSceneTreeColumnsChange:t})=>{const a=useSceneTreeActions(),o=useSceneTreeColumnActions(),i=useSceneTreeSearchActions(),r=n.useRecoilValue(In);useSceneTreePartialResults({sceneTreeElement:null!=r?r:null});const c=n.useRecoilValue(da),u=n.useRecoilValue(Qn),m=useCacheableLoadable(ta),p=u.length>0?u:m.data,h=n.useRecoilValue(na),f=n.useRecoilValue(ua),[g,v]=d.useState(h),[b,S]=d.useState(""),{element:C,callback:w}=useCallbackRef(),V="scene-tree-columns",j=n.useRecoilValue(On(V)),{position:T,direction:A,handleOpen:k}=useOpenPositionedPopover({open:j,buttonElement:C}),P=d.useCallback((()=>{a.closeSceneTreePopover()}),[]),I=A===la.LEFT?"left-end":"right-start",E=d.useMemo((()=>{if(null!=p){const e=p.filter((e=>g.indexOf(e)<0)),t=undefined;return[...[...g].sort(((e,t)=>e.localeCompare(t))),...e]}return[]}),[g,p]),M=d.useMemo((()=>E),[j,p]);return e.jsxs(e.Fragment,{children:[e.jsx(s.VertexTooltip,{content:"Configure Columns",placement:"top",children:e.jsx(s.VertexIconButton,{"data-testid":"scene-tree-column-popover-button",ref:w,iconName:"columns-add",iconSize:"sm",onClick:()=>{j?P():(k(),a.openSceneTreePopover(V))}})}),j&&e.jsx(s.VertexPopover,{"data-testid":"scene-tree-column-popover",open:j,backdrop:!1,position:T,resizeBehavior:"fixed",placement:I,className:"z-popover",children:e.jsxs("div",{className:Ee("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!j}),children:[e.jsxs("div",{className:"flex items-center text-[0.875rem] p-3",children:[e.jsxs("div",{className:"pr-2",children:[e.jsx("div",{className:"text-[0.875rem]",children:"Assembly Properties"}),e.jsx("div",{className:"text-[0.75rem] text-neutral-700 mt-1.5",children:"Select up to six properties to appear in the Assembly panel."})]}),e.jsx(s.VertexIconButton,{"data-testid":"scene-tree-columns-popover-close-button",className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{S(""),P()}})]}),e.jsx(s.VertexTextfield,{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&&S(t.toLowerCase())}}),f&&e.jsx(l.VertexSceneTreeNotificationBanner,{"data-testid":"partial-key-list-notification-banner",message:"loading"===m.state?"Refreshing results...":"Data loading, refresh for more.",actionLabel:"Refresh",onAction:()=>o.refreshKeyList()}),e.jsxs("div",{className:"max-h-64 p-3 overflow-y-auto",children:[e.jsx(VertexSceneTreeMetadataCheck,{checked:!0,disabled:!0,children:Zn.label}),M.filter((e=>""===b||e.toLowerCase().includes(b))).map((t=>e.jsx(VertexSceneTreeMetadataCheck,{checked:g.includes(t),disabled:g.length>=6&&!g.includes(t),onChange:e=>{v(e?[...g,t]:g.filter((e=>e!==t)))},children:t},t)))]}),e.jsxs("div",{className:"flex items-center p-3 border-t border-neutral-300 space-x-4",children:[e.jsx("div",{className:"text-[0.75rem] text-[var(--vertex-ui-blue-700)] cursor-pointer","data-testid":"scene-tree-column-clear-selection",onClick:()=>v([]),children:"Clear selection"}),e.jsx("div",{className:"flex-grow"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(s.VertexButton,{"data-testid":"scene-tree-column-popover-cancel",color:"secondary",onClick:()=>{S(""),P()},children:"Cancel"}),e.jsx(s.VertexButton,{"data-testid":"scene-tree-column-popover-apply",color:"primary",onClick:async()=>{await i.updateMetadataSearchAfterColumnVisibilityChange(h,g,c),await o.setActive(g),null==t||t(g),S(""),P()},children:"Apply"})]})]})]})})]})};function VertexToolbarDivider(){return e.jsx("div",{"data-testid":"toolbar-divider",className:"h-6 w-px bg-neutral-300 mx-1"})}const VertexSceneTreeSearchInformationForToolbar=()=>{const t=useSelectionActions(),a=n.useRecoilValue(In),o=n.useRecoilValue(da),i=n.useRecoilValue(ha),l=undefined,r=`${i} ${1===i?"result":"results"}`;return e.jsxs(e.Fragment,{children:[e.jsx(VertexToolbarDivider,{}),e.jsxs("div",{className:"flex flex-row items-center overflow-hidden",children:[e.jsx("div",{className:"px-2 text-[0.8125rem] leading-4 text-neutral-900 truncate","data-testid":"search-result-info",children:`${r}`}),e.jsx(s.VertexTooltip,{className:"w-auto",content:"Select Results",placement:"top",children:e.jsx(s.VertexButton,{className:"h-6 rounded cursor-pointer","data-testid":"select-search-results-button",color:"secondary",variant:"text",size:"sm",onClick:async()=>{null!=a&&null!=o&&(await a.selectFilteredItems(o),t.toggleLastSelectWasMultiSelect(!0))},children:e.jsxs("div",{className:"flex h-6 items-center gap-1",children:[e.jsx(s.VertexIcon,{size:"sm",name:"check-circle"}),e.jsx("span",{className:"whitespace-nowrap",children:"Select Results"})]})})})]})]})},VertexSceneTreeCollapseAll=()=>{const t=n.useRecoilValue(In);return e.jsx(s.VertexTooltip,{className:"w-auto",content:"Collapse All",placement:"top",children:e.jsx(s.VertexIcon,{size:"sm",className:"h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer","data-testid":"collapse-all-icon",name:"collapse-all",onClick:()=>{null==t||t.collapseAll()}})})},VertexSceneTreeExpandAll=()=>{const t=n.useRecoilValue(In);return e.jsx(s.VertexTooltip,{className:"w-auto",content:"Expand All",placement:"top",children:e.jsx(s.VertexIcon,{size:"sm","data-testid":"expand-all-icon",className:"h-6 w-6 hover:bg-neutral-300 rounded cursor-pointer",name:"expand-all",onClick:()=>{null==t||t.expandAll()}})})},VertexSceneTreeToolbar=({onVisibleSceneTreeColumnsChange:t})=>{const a=n.useRecoilValue(da),o=null==a||""===a;return e.jsx(l.VertexSceneTreeToolbar,{className:"h-10 border-b border-neutral-300 box-border",children:e.jsxs("div",{className:"flex w-full text-neutral-700 items-center gap mx-2",children:[e.jsx(VertexSceneTreeExpandAll,{}),e.jsx(VertexSceneTreeCollapseAll,{}),!o&&e.jsx(VertexSceneTreeSearchInformationForToolbar,{}),e.jsx("div",{className:"ml-auto",children:e.jsx(VertexSceneTreeColumnPopover,{onVisibleSceneTreeColumnsChange:t})})]})})},VertexSceneTreeHeader=({onEnterSearchMode:t,onExitSearchMode:n,onSearch:a,onClearSearch:o,onVisibleSceneTreeColumnsChange:s,children:i})=>{const l=null!=i&&!1!==i;return e.jsx("div",{slot:"header",className:"flex flex-col",children:l?i:e.jsxs(e.Fragment,{children:[e.jsx(VertexSceneTreeSearch,{onEnterSearchMode:t,onExitSearchMode:n,onSearch:a,onClearSearch:o,children:e.jsx("div",{slot:"clear-icon"})}),e.jsx(VertexSceneTreeToolbar,{onVisibleSceneTreeColumnsChange:s})]})})};function useMetadataActions(){const e=useActionCallback((({snapshot:e,set:t})=>async n=>{const a=undefined;if(await e.getPromise(zn(n)))return;t(zn(n),!0);const o=await e.getPromise(_n(n));if(null!=(null==o?void 0:o.metadata)){const e=[...o.metadata];t(Ln(n),(t=>[...t,...e]))}const s=null==o?void 0:o.cursor;t(Bn(n),s),t(zn(n),!1)}));return{fetchInitialMetadata:useActionCallback((({snapshot:t})=>async n=>{const a=undefined;0===(await t.getPromise(Ln(n))).length&&await e(n)})),fetchNextMetadata:useActionCallback((()=>async t=>{await e(t)}))}}var Ca={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=o,s=_interopRequireDefault(a),i,l=_interopRequireDefault(r);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 c=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 o=document.documentElement||document.body.parentNode||document.body,s=void 0!==t.pageYOffset?t.pageYOffset:o.scrollTop;a=this.props.isReverse?s:this.calculateOffset(e,s)}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,o=t.hasMore;t.initialLoad;var i=t.isReverse,l=t.loader;t.loadMore,t.pageStart;var r=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,r&&r(t)};var u=[n];return o&&(l?i?u.unshift(l):u.push(l):this.defaultLoader&&(i?u.unshift(this.defaultLoader):u.push(this.defaultLoader))),s.default.createElement(a,c,u)}}]),InfiniteScroll}(a.Component);c.propTypes={children:l.default.node.isRequired,element:l.default.node,hasMore:l.default.bool,initialLoad:l.default.bool,isReverse:l.default.bool,loader:l.default.node,loadMore:l.default.func.isRequired,pageStart:l.default.number,ref:l.default.func,getScrollParent:l.default.func,threshold:l.default.number,useCapture:l.default.bool,useWindow:l.default.bool},c.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=c,e.exports=t.default}(Ca,Ca.exports);var wa=Ca.exports;const CopyButton=({id:t,textToCopy:n,iconSize:a,disableTooltip:i,onCopyValue:l})=>{const[r,c]=o.useState(!1),u=undefined,d=useDebouncedCallback((()=>{c(!1)}),2e3);return e.jsx(s.VertexTooltip,{className:"h-fit self-center z-[16000]",content:r?"Copied to Clipboard":"Copy",placement:"bottom",disabled:i,children:e.jsx("div",{className:Ee({"text-green-700":r}),children:e.jsx(s.VertexIconButton,{className:"ml-auto","data-testid":`${t}-copy-button`,iconName:r?"check":"copy",iconSize:null!=a?a:"xs",onClick:e=>{e.stopPropagation(),e.preventDefault(),null!=n&&(navigator.clipboard.writeText(n),null==l||l(n)),c(!0),d(!0)},style:{"--hover-box-shadow":"none"}})})})};function MetadataPropertyValue({value:t,onCopyMetadataValue:n}){const[a,i]=o.useState(!1),l=""!==t.replace(/^\s*$/,"").trim();return l?e.jsxs("div",{className:"flex w-full border-b border-neutral-300 pl-1 pr-3","data-testid":`${t}-metadata-property`,onMouseEnter:()=>{i(!0)},onMouseLeave:()=>i(!1),children:[e.jsx(s.VertexTooltip,{className:"w-full shrink truncate pr-2 py-1.5",content:t,placement:"bottom-start",children:e.jsx("div",{className:"truncate",children:t})}),a&&e.jsx(CopyButton,{id:t,textToCopy:t,onCopyValue:n})]}):e.jsx("div",{className:Ee("overflow-visible border-b border-neutral-300 pl-1 pr-4 py-1.5",{"text-neutral-500":!l}),children:"--"})}const MetadataPanelContents=({sceneItemId:t,onCopyMetadataValue:a})=>{const i=useMetadataActions(),l=n.useRecoilValueLoadable(Fn),r=n.useRecoilValue(Ln(t)),c=n.useRecoilValue(Dn(t)),u=n.useRecoilValue(zn(t)),d=(null==r?void 0:r.length)>0;function getMessage(){if(!u&&0===(null==r?void 0:r.length)&&"hasValue"===l.state)return"This part does not contain properties"}return o.useEffect((()=>{null!=t&&i.fetchInitialMetadata(t)}),[t]),e.jsxs(e.Fragment,{children:[e.jsx(wa,{initialLoad:!1,hasMore:c,loadMore:async()=>{c&&await i.fetchNextMetadata(t)},useWindow:!1,children:e.jsxs("div",{className:"flex w-full text-xs leading-5 grow-0",children:[e.jsx(s.VertexResizable,{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.jsx("div",{className:"flex flex-col w-full overflow-hidden whitespace-nowrap",children:r.map(((t,n)=>e.jsx(s.VertexTooltip,{className:"border-b border-neutral-300 pl-4 pr-1 py-1.5",content:t.key,placement:"bottom-start",children:e.jsx("div",{className:"truncate",children:t.key})},n)))})}),e.jsx("div",{id:"metadata-value-column",className:"flex flex-col w-full min-w-24",children:r.map(((t,n)=>e.jsx(MetadataPropertyValue,{value:t.value,onCopyMetadataValue:a},n)))})]})}),!d&&e.jsx("div",{className:"w-full h-full flex items-center justify-center px-4 text-center text-sm",children:getMessage()})]})},MetadataPanel=({onCopyMetadataValue:t})=>{const a=usePanelActions(),o=n.useRecoilValue(ft),i=n.useRecoilValueLoadable(Fn);return e.jsxs("div",{id:"metadata-panel-wrapper","data-testid":"metadata-panel-wrapper",className:"w-full h-full flex flex-col mt-auto text-neutral-800",children:[e.jsxs("div",{className:"flex h-10 border-b border-neutral-300 p-3 pl-4 text-[0.875rem] items-center",children:["hasValue"===i.state&&e.jsx("span",{className:"flex flex-col w-full",children:e.jsx(s.VertexTooltip,{content:i.contents,children:e.jsx("div",{className:"truncate",children:i.contents||""})})}),"loading"===i.state&&e.jsx("div",{className:"flex items-center w-full h-full",children:e.jsx("div",{className:"w-1/2 h-1/2 bg-neutral-300 animate-pulse rounded"})}),e.jsx(s.VertexIcon,{className:"ml-auto cursor-pointer",onClick:a.closeSecondary,name:"close",size:"sm"})]}),e.jsxs("div",{className:"w-full h-full overflow-y-auto overflow-x-hidden",children:[null!=o&&e.jsx(MetadataPanelContents,{sceneItemId:o.id,onCopyMetadataValue:t}),null==o&&e.jsx("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.jsx(s.VertexResizable,{"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.jsx(MetadataPanel,{onCopyMetadataValue:n})}),VertexSceneTreeCustomColumn=({label:t,rowDataBinding:a,expandToggle:s,visibilityToggle:i,isolateButton:r,initialWidth:c,minWidth:u})=>{const d=n.useRecoilValue(In);return o.useEffect((()=>{null==d||d.invalidateRows()}),[a]),e.jsxs(l.VertexSceneTreeTableColumn,{"data-testid":`scene-tree-table-column-${t}`,initialWidth:c,minWidth:u,children:[e.jsx("template",{slot:"header",dangerouslySetInnerHTML:{__html:`\n <div class="text-sm text-neutral-800 my-2">\n <div class="${Ee("truncate",{"pl-2":s,"pr-2":i})}">\n ${t}\n </div>\n </div>\n `}}),e.jsx("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 ${s?"expand-toggle":""}\n ${i?"visibility-toggle":""}\n ${r?"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="${i?"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 `}})]},t)},VertexSceneTreeMetadataColumns=({children:t})=>{const a=n.useRecoilValue(aa),o=n.useRecoilValue(oa),s=[],i=o.filter((e=>e!==Zn.label)).map((e=>a[e]));return null!=t?e.jsx(e.Fragment,{children:t({columns:i.map((e=>({key:e.label,initialWidth:e.initialWidth,minWidth:e.minWidth})))})}):e.jsx(e.Fragment,{children:i.map(((t,n)=>{var a;const o=null!==(a=s[n])&&void 0!==a?a:t.initialWidth;return e.jsx(VertexSceneTreeCustomColumn,{label:t.label,visibilityToggle:n===i.length-1,isolateButton:n===i.length-1,rowDataBinding:t.binding,initialWidth:o,minWidth:t.minWidth},t.label)}))})},VertexSceneTreeTableLayout=t=>{var a,s;const{children:i}=t,r=__rest(t,["children"]),c=n.useRecoilValue(aa),u=n.useRecoilValue(oa),d=[],m=o.useMemo((()=>findChildElement(i,NameColumn)),[i]),p=o.useMemo((()=>findChildElement(i,MetadataColumns)),[i]),h=null!==(a=c[Zn.label])&&void 0!==a?a:Zn,f=u.filter((e=>e!==Zn.label)).map((e=>c[e]));return e.jsxs(l.VertexSceneTreeTableLayout,Object.assign({"data-testid":"scene-tree-table-layout"},r,{children:[m?cloneChildNodeOrFunction(m.props.children,{columnCount:u.length,initialWidth:h.initialWidth,minWidth:h.minWidth}):e.jsx(VertexSceneTreeCustomColumn,{expandToggle:!0,visibilityToggle:1===u.length,isolateButton:1===u.length,rowDataBinding:h.binding,label:h.label,initialWidth:null!==(s=d[0])&&void 0!==s?s:h.initialWidth,minWidth:h.minWidth}),null!=p?cloneChildNodeOrFunction(p.props.children,{columns:f.map((e=>({key:e.label,initialWidth:e.initialWidth,minWidth:e.minWidth})))}):e.jsx(VertexSceneTreeMetadataColumns,{})]}))},NameColumn=({children:t})=>e.jsx(e.Fragment,{children:t}),MetadataColumns=({children:t})=>e.jsx(e.Fragment,{children:t});VertexSceneTreeTableLayout.NameColumn=NameColumn,VertexSceneTreeTableLayout.MetadataColumns=MetadataColumns;const VertexSceneTree=t=>{var{id:a,font:s,backgroundColors:i,additionalLoadedMetadataProperties:r,whitelistedMetadataProperties:c,allowViewingMetadataPropertiesPanel:u,children:d,style:m,onPointerDown:p,onClick:h,onToggleSelection:f,onToggleExpansion:g,onToggleVisibility:v,onCopyMetadataValue:b,className:S,rowData:C}=t,w=__rest(t,["id","font","backgroundColors","additionalLoadedMetadataProperties","whitelistedMetadataProperties","allowViewingMetadataPropertiesPanel","children","style","onPointerDown","onClick","onToggleSelection","onToggleExpansion","onToggleVisibility","onCopyMetadataValue","className","rowData"]);const V=useSceneTreeActions(),j=useSelectionActions(),T=n.useRecoilValue(Yn),A=n.useRecoilValue(G),k=n.useRecoilValue(An),P=n.useRecoilValue(ba),I=n.useRecoilValue(fa),E=n.useRecoilValue(ma),M=n.useRecoilValue(pa),O=n.useRecoilValue(da),R=null==O||""===O,N=useRecoilRef({state:In}),_=o.useMemo((()=>findChildElement(d,Header)),[d]),L=o.useMemo((()=>findChildElement(d,TableLayout)),[d]),B=o.useMemo((()=>findChildElement(d,ContextMenu)),[d]),wrappedExpansionHandler=(e,t,n)=>{V.toggleExpansion(e,t,n),null==g||g(e,t,n)},wrappedSelectionHandler=(e,t,n)=>{V.toggleSelection(e,t,n),null==f||f(e,t,n)},wrappedVisibilityHandler=(e,t,n)=>{V.toggleVisibility(e,t,n),null==v||v(e,t,n)},handleClick=async e=>{e.altKey&&await V.flyToRow(e.clientY),null==h||h(e)},handlePointerDown=async e=>{targetIsElement(e.target,"VERTEX-SCENE-TREE-TABLE-COLUMN")&&await j.clearSelection(),null==p||p(e)},D=n.useSetRecoilState(En),handleFirstRowRendered=e=>{var t;D(e.target.controller),null===(t=null==w?void 0:w.onFirstRowRendered)||void 0===t||t.call(w,e)},F=o.useMemo((()=>({metadataSearchKeys:I,exactMatch:E,removeHiddenItems:M})),[I,E,M]);return useStateSyncedValue(Qn,c,{transform:e=>e.sort(((e,t)=>e.localeCompare(t)))}),useStateSyncedValue(Nn,u),useStateSyncedValue(ya,r),e.jsxs("div",{id:"scene-tree-panel",className:"flex flex-col w-full h-full grow-0",children:[e.jsx("div",{id:"scene-tree-container",className:"flex group h-full min-h-32 overflow-auto",children:e.jsxs(l.VertexSceneTree,Object.assign({id:null!=a?a:"vertex-scene-tree","data-testid":"vertex-scene-tree",config:T,ref:N,className:Ee("flex-1",{filtered:!R}),style:Object.assign(Object.assign(Object.assign({},styleFromOptionalFont(s)),styleFromOptionalBackgroundColors(i)),m),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==C?void 0:C(e))&&void 0!==t?t:{};return Object.assign({handleExpansion:wrappedExpansionHandler,handleSelection:wrappedSelectionHandler,handleVisibility:wrappedVisibilityHandler},n)},searchOptions:F,metadataKeys:P},w,{onFirstRowRendered:handleFirstRowRendered,children:[null!=_?_:e.jsx(VertexSceneTreeHeader,{}),null!=L?L:e.jsx(VertexSceneTreeTableLayout,{}),null!=B?B:e.jsx(VertexSceneTreeContextMenu,{})]}))}),void 0!==k&&e.jsx(SceneTreeSecondaryPanel,{panelId:"scene-tree-panel",onCopyMetadataValue:b})]})},Header=({children:t})=>e.jsx(e.Fragment,{children:t}),TableLayout=({children:t})=>e.jsx(e.Fragment,{children:t}),ContextMenu=({children:t})=>e.jsx(e.Fragment,{children:t});VertexSceneTree.Header=Header,VertexSceneTree.TableLayout=TableLayout,VertexSceneTree.ContextMenu=ContextMenu;const VertexDecimalPlaceSelector=({onApply:t})=>{const[a,o]=n.useRecoilState(Pt);return e.jsxs(s.VertexSelect,{"data-testid":"decimal-place-select",className:"w-24",value:a,onOptionChanged:e=>{o(e.detail),null==t||t(e.detail)},children:[e.jsx("div",{className:"py-1.5 px-3",children:"0"}),e.jsx("div",{className:"py-1.5 px-3",children:"1"}),e.jsx("div",{className:"py-1.5 px-3",children:"2"}),e.jsx("div",{className:"py-1.5 px-3",children:"3"})]})},VertexLengthUnitSelector=({onApply:t})=>{const[a,o]=n.useRecoilState(kt);return e.jsxs(s.VertexSelect,{"data-testid":"length-unit-select",className:"w-40",value:a,onOptionChanged:e=>{o(e.detail),null==t||t(e.detail)},children:[e.jsx("div",{"data-value":"cm",className:"py-1.5 px-3",children:"centimeters"}),e.jsx("div",{"data-value":"mm",className:"py-1.5 px-3",children:"millimeters"}),e.jsx("div",{"data-value":"m",className:"py-1.5 px-3",children:"meters"}),e.jsx("div",{"data-value":"in",className:"py-1.5 px-3",children:"inches"}),e.jsx("div",{"data-value":"ft",className:"py-1.5 px-3",children:"feet"})]})};function VertexUnitsControls({onUnitChange:t,onDecimalPlaceChange:n}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Length Unit"}),e.jsx(VertexLengthUnitSelector,{onApply:t})]}),e.jsxs("div",{children:[e.jsx("div",{className:"pt-2 pb-2 text-sm text-neutral-700",children:"Decimals"}),e.jsx(VertexDecimalPlaceSelector,{onApply:n})]})]})}function VertexUnitsPanelSection({onUnitChange:t,onDecimalPlaceChange:n}){return e.jsx(PanelSection,{header:e.jsx("div",{className:"flex items-center text-base",children:"Units"}),children:e.jsx(VertexUnitsControls,{onUnitChange:t,onDecimalPlaceChange:n})})}function ColorSwatchContextMenu({onRemoveCustomColor:t}){const a=useContextMenuActions(),o=useSceneItemMaterialActions(),i=n.useRecoilValue(De);return e.jsx(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.jsx(s.VertexMenuItem,{"data-testid":"color-swatch-delete",onClick:async()=>{if(contextMenuItemIsElement(i)&&elementIsColorSwatch(i)){const e=null==i?void 0:i.getAttribute("data-color-id");null!=e&&"true"===i.getAttribute("data-custom-color")?(await o.removeCustomColor(e),null==t||t(e)):null!=e&&"true"===i.getAttribute("data-recent-color")&&await o.removeRecentColor(e)}},children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(s.VertexIcon,{slot:"icon",name:"delete",size:"sm"}),"Delete"]})})})}function DefaultAppearancePanel(){return e.jsxs("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:[e.jsx(VertexMaterialPanelSection,{}),e.jsx(VertexGhostingPanelSection,{}),e.jsx(VertexFeatureEdgesPanelSection,{}),e.jsx(VertexViewerBackgroundPanelSection,{}),e.jsx(VertexSelectionHighlightingPanelSection,{}),e.jsx(VertexCrossSectionAppearancePanelSection,{}),e.jsx(ColorSwatchContextMenu,{})]})}function DefaultSettingsPanel(){return e.jsx("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e.jsx(VertexUnitsPanelSection,{})})}const VertexTransformClear=({onClear:t,onClearAll:a})=>{const i=useTransformActions(),l=useCacheableLoadable(Tt),r=n.useRecoilValue(bt),c=useCacheableLoadable(Ft(null!=r?r:"")),u=o.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!=c.data;return t||n}),[l,c]);return e.jsx("div",{className:"ml-auto",children:e.jsxs(ResetButton,{id:"transforms",tooltip:"Clear Transforms",children:[e.jsx("div",{className:"pt-1"}),e.jsx(s.VertexMenuItem,{"data-testid":"clear-selected-transforms",onClick:async()=>{await i.clearSelectedTransforms(),null==t||t()},disabled:!u,children:"Clear selected transforms"}),e.jsx(s.VertexMenuItem,{"data-testid":"clear-all-transforms",onClick:async()=>{await i.clearAllTransforms(),null==a||a()},children:"Clear all transforms"})]})})},VertexTransformNumericField=({bottomLabel:t,value:a,step:s,min:i,max:l,disabled:r,testId:c,onBlur:u,onInput:d,onChange:m})=>{const p=o.useRef(null),h=n.useRecoilValue(Pt),[f,g]=o.useState(!0);o.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=o.useCallback((e=>{g(!1),null==m||m(e)}),[g,m]),b=o.useCallback((e=>{g(!0),null==u||u(e),null!=p.current&&null!=a&&(p.current.value=a.toFixed(Number(h)))}),[u,a,g]);return e.jsxs("div",{children:[e.jsx("div",{className:"truncate rounded-md w-full",children:e.jsx("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:s,min:i,max:l,"data-testid":c,disabled:r,defaultValue:Number.isNaN(a)?"":null==a?void 0:a.toFixed(Number(h)),onBlur:b,onInput:d,onChange:v})}),null!=t&&e.jsx("div",{className:"flex justify-center items-center pointer-events-none text-neutral-500",children:e.jsx("span",{children:t})})]})},VertexTransformInputs=({onUpdateTransform:t})=>{const a=n.useRecoilValue(kt),o=n.useRecoilValue(vt),s=n.useRecoilValue(gt),i=o||s,l=n.useRecoilValue(bt),{transform:r,error:c,update:u}=useEditItemTransform(l),d=i?void 0:r,m=useDebouncedCallback((async e=>{await u(e),null==t||t(e)}),50);function updateTransform(e){return t=>{if(null!=d){const n=parseFloat(t.currentTarget.value);Number.isNaN(n)||null==m||m(Object.assign(Object.assign({},d),e(n,d)))}}}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),o=undefined;(isNaN(a)||!!(null==t?void 0:t(a)))&&null!=d&&m(v.defaults(e,d))}}return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 text-[0.8125rem]",children:[e.jsx("span",{className:"flex w-full items-center mt-3 mb-1",children:"Position"}),e.jsxs("div",{className:"flex flex-wrap w-full gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"X"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"position-x",value:null!=d?d.position.x:void 0,bottomLabel:a,disabled:null==d,onChange:updatePosition((e=>({x:e}))),onBlur:updateToDefaultValueIfInvalid({position:{x:0}})})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"Y"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"position-y",value:null==d?void 0:d.position.y,bottomLabel:a,disabled:null==d,onChange:updatePosition((e=>({y:e}))),onBlur:updateToDefaultValueIfInvalid({position:{y:0}})})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"Z"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"position-z",value:null==d?void 0:d.position.z,bottomLabel:a,disabled:null==d,onChange:updatePosition((e=>({z:e}))),onBlur:updateToDefaultValueIfInvalid({position:{z:0}})})})]})]})]}),e.jsxs("div",{className:"mb-2 text-[0.8125rem]",children:[e.jsx("span",{className:"flex w-full items-center mt-3 mb-1",children:"Rotation"}),e.jsxs("div",{className:"flex flex-wrap w-full gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"X"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"rotation-x",value:null==d?void 0:d.rotation.x,bottomLabel:"deg",disabled:null==d,onChange:updateRotation((e=>({x:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{x:0}})})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"Y"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"rotation-y",value:null==d?void 0:d.rotation.y,bottomLabel:"deg",disabled:null==d,onChange:updateRotation((e=>({y:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{y:0}})})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"pt-2",children:"Z"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"rotation-z",value:null==d?void 0:d.rotation.z,bottomLabel:"deg",disabled:null==d,onChange:updateRotation((e=>({z:e}))),onBlur:updateToDefaultValueIfInvalid({rotation:{z:0}})})})]})]})]}),e.jsxs("div",{className:"mb-2 text-[0.8125rem]",children:[e.jsx("span",{className:"flex w-full items-center mt-3 mb-1",children:"Scale"}),e.jsx("div",{className:"w-26",children:e.jsx(VertexTransformNumericField,{testId:"scale",value:null==d?void 0:d.scale,step:.1,min:.1,disabled:null==d,onChange:updateScale(),onBlur:updateToDefaultValueIfInvalid({scale:1},(e=>e<=0))})}),i&&e.jsx("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!=c&&e.jsx("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 a=useTransformActions(),o=n.useRecoilValue(Rt),i=n.useSetRecoilState(Wt);return e.jsx(s.VertexToggle,{className:"flex items-center","data-testid":"transform-widget-toggle",variant:"switch",checked:o,onValueChanged:async()=>{o?(a.disableTransformWidget(),null==t||t(!1)):(i("world"),await a.enableTransformWidget(),null==t||t(!0))}})};function VertexTransformControls({onToggleTransformsManipulator:t,onUpdateTransform:n}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center py-3",children:[e.jsx(VertexTransformManipulatorToggle,{onToggleTransformsManipulator:t}),e.jsx("span",{className:"pl-4 text-[0.8125rem] text-neutral-700",children:"Enable manipulator"})]}),e.jsx(VertexTransformInputs,{onUpdateTransform:n})]})}function VertexTransformPanelSection({onClearTransforms:t,onClearAllTransforms:n,onToggleTransformsManipulator:a,onUpdateTransform:o}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Manual Part Transforms",e.jsx(VertexTransformClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexTransformControls,{onToggleTransformsManipulator:a,onUpdateTransform:o})})}function DefaultTransformsPanel(){return e.jsx("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e.jsx(VertexTransformPanelSection,{})})}const Va="Appearance",ja="Settings",Ta="Transforms",ViewerRightPanelHeader=({additionalHeaderMap:t})=>{const a=undefined,o=getHeading(n.useRecoilValue(Tn),t);return e.jsx("div",{className:"flex flex-col w-full items-center z-overlay pointer-events-none md:pointer-events-auto py-3 px-4 border-b border-neutral-300",children:e.jsx("div",{className:"items-center w-full leading-6 text-md align-center font-medium text-neutral-800",children:o})})};function getHeading(e,t={}){switch(e){case"appearance":return Va;case"settings":return ja;case"transforms":return Ta;default:const n=null!=e?t[e]:void 0;return null!=n?n:"None"}}function VertexViewerRightOpenedPanel({children:t}){const a=n.useRecoilValue(Tn),s=o.useMemo((()=>filterChildElements(t,CustomPanelContent)),[t]),i=o.useMemo((()=>s.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.props.panelName]:t.props.panelTitle})),{})),[s]),l=o.useMemo((()=>["appearance","settings","transforms",...s.map((e=>e.props.panelName))]),[s]);return e.jsx(e.Fragment,{children:null!=a&&l.includes(a)&&e.jsxs(VertexResizableContent,{displayShadow:!0,heading:e.jsx(ViewerRightPanelHeader,{additionalHeaderMap:i}),placement:"right",children:["appearance"===a&&e.jsx(DefaultAppearancePanel,{}),"transforms"===a&&e.jsx(DefaultTransformsPanel,{}),"settings"===a&&e.jsx(DefaultSettingsPanel,{}),t]})})}function CustomPanelContent({panelName:t,children:a}){const o=n.useRecoilValue(Tn);return e.jsx(e.Fragment,{children:o===t&&a})}function Sidebar({children:t}){return e.jsx("div",{className:"pointer-events-auto flex flex-col items-center w-full border-neutral-300 py-2",children:t})}function SidebarIcon({name:t,iconName:n,active:a,responsive:i,disabled:l,content:r,tooltipPlacement:c,children:u,onSelect:d,onDeselect:m}){return e.jsx("div",{className:Ee({"text-[var(--vertex-ui-blue-700)]":a===t&&!l,"text-neutral-700 hover:text-neutral-800":a!==t&&!l,"cursor-pointer hover:bg-neutral-200":!l,"text-neutral-400":l,"rounded-full md:p-3":i,"p-3":!i&&null==u,"px-3 py-1":null!=u}),"data-testid":`${t}-sidebar-panel`,onClick:()=>{l||(a===t?m():d())},children:e.jsxs(s.VertexTooltip,{placement:null!=c?c:void 0,content:o.isValidElement(r)?void 0:r,children:[e.jsx("div",{slot:"content",children:r}),e.jsx("div",{className:"flex flex-col",children:null!=u?u:e.jsx(s.VertexIcon,{name:n})})]})})}function VertexViewerRightSidebar({children:t}){const a=usePanelActions(),o=useTransformActions(),s=n.useRecoilValue(Tn);return e.jsx("div",{className:"flex flex-col flex-shrink-0 items-center relative border-neutral-300 border-l bg-white h-full top-0 min-w-12 w-12",children:e.jsxs(Sidebar,{children:[t,e.jsx(SidebarIcon,{name:"appearance",active:s,iconName:"adjustments",tooltipPlacement:"right",content:"Appearance",onSelect:()=>{a.openPrimary("appearance","right")},onDeselect:()=>a.closePrimary("right")}),e.jsx(SidebarIcon,{name:"transforms",active:s,iconName:"show-only-nearby",tooltipPlacement:"right",content:"Transforms",onSelect:async()=>{a.openPrimary("transforms","right"),await o.enableTransformWidget(void 0,!0)},onDeselect:()=>a.closePrimary("right")}),e.jsx(SidebarIcon,{name:"settings",active:s,iconName:"gear",tooltipPlacement:"right",content:"Settings",onSelect:()=>{a.openPrimary("settings","right")},onDeselect:()=>a.closePrimary("right")})]})})}function CustomPanelIcon(t){const a=usePanelActions(),o=n.useRecoilValue(Tn),{panelName:s,tooltipContent:i,iconName:l}=t,r=__rest(t,["panelName","tooltipContent","iconName"]);if(null==l&&null==r.children)throw new Error('CustomPanelIcon must contain either a Vertex "iconName" or custom "children"');return e.jsx(SidebarIcon,Object.assign({},r,{name:s,iconName:null!=l?l:"help",active:o,content:i,onSelect:()=>{a.openPrimary(t.panelName,"right")},onDeselect:()=>{a.closePrimary("right")}}))}VertexViewerRightOpenedPanel.CustomPanelContent=CustomPanelContent,VertexViewerRightSidebar.CustomPanelIcon=CustomPanelIcon;const VertexPopupButton=t=>{var{open:n,children:a}=t,o=__rest(t,["open","children"]);const i=a.find((e=>e.type===Anchor)),l=a.filter((e=>e.type!==Anchor));return null==i?e.jsx(e.Fragment,{}):e.jsxs(s.VertexPopover,Object.assign({className:"flex",placement:"top",backdrop:!1,open:asBooleanAttribute(n)},o,{children:[i,e.jsx("div",{className:Ee("flex mb-1.5",{hidden:!n}),"data-testid":"align-plane-popover-menu",children:l})]}))},Anchor=({tooltipContent:t,children:n})=>e.jsx("div",{slot:"anchor",children:e.jsx(s.VertexTooltip,{className:"cursor-pointer",content:t,children:n})});function VertexViewerCrossSectionAlignmentPopoverMenu({disabled:t}){const a=useCrossSectioningActions(),o=n.useRecoilValue(ve),i=n.useRecoilValue(ce),getBaseIcon=()=>`align-to-${null==i?void 0:i.mode}`;return useStackKeyBinding({id:"CrossSectionAlignment",keyBind:"Escape",fn:a.cancelCurrentHit,addPredicate:()=>{var e;return null!==(e=null==i?void 0:i.hitPending)&&void 0!==e&&e},cancelPredicate:()=>!(null==i?void 0:i.hitPending)},[null==i?void 0:i.hitPending]),e.jsxs(VertexPopupButton,{"data-testid":"section-alignment-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(o),onDismissed:a.closeAlignmentTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Section Alignment",children:e.jsx(s.VertexIconButton,{"data-testid":"section-alignment-icon-button",iconName:getBaseIcon(),iconColor:"secondary",onClick:o?a.closeAlignmentTools:a.openAlignmentTools,disabled:t,children:e.jsx(s.VertexIcon,{"data-testid":"section-alignment-icon-chevron",name:"chevron-up",size:"sm"})})}),e.jsxs(l.VertexViewerToolbarGroup,{direction:"vertical",className:"flex justify-evenly items-center py-1 my-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(s.VertexIconButton,{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.jsx("div",{className:"text-base ml-2",children:"Align to Global"})}),e.jsx(s.VertexIconButton,{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.jsx("div",{className:"text-base ml-2",children:"Align to Surface"})})]})]})}function VertexViewerCrossSectionAxisPopoverMenu({disabled:t}){const a=useCrossSectioningActions(),i=n.useRecoilValue(ye),r=n.useRecoilValue(re),c=n.useRecoilValueLoadable(pe),u=o.useMemo((()=>{const e=r.length>0&&"hasValue"===c.state?axis(r[0],xAxis(c.contents),yAxis(c.contents),zAxis(c.contents)):"x";return null!=e?`axis-${e}`:"axis-x"}),[c.state,c.contents,r]);return e.jsxs(VertexPopupButton,{"data-testid":"align-plane-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(i),onDismissed:a.closeAxisTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Align Plane",children:e.jsx(s.VertexIconButton,{onClick:i?a.closeAxisTools:a.openAxisTools,iconName:u,"data-testid":"align-plane-icon",iconColor:"secondary",disabled:t,children:e.jsx(s.VertexIcon,{"data-testid":"align-plane-icon-chevron",name:"chevron-up",size:"sm"})})}),e.jsxs(l.VertexViewerToolbarGroup,{direction:"vertical",className:"flex justify-evenly items-center py-1 my-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(s.VertexIconButton,{"data-testid":"align-plane-x-axis-button",className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2",onClick:()=>a.updateAxis("x"),variant:"plain",iconColor:"secondary",iconName:"axis-x",children:e.jsx("div",{className:"text-base ml-2",children:"X-axis Plane"})}),e.jsx(s.VertexIconButton,{className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2",variant:"plain",iconColor:"secondary",iconName:"axis-y","data-testid":"align-plane-y-axis-button",onClick:()=>a.updateAxis("y"),children:e.jsx("div",{className:"text-base ml-2",children:"Y-axis Plane"})}),e.jsx(s.VertexIconButton,{"data-testid":"align-plane-z-axis-button",className:"w-full text-neutral-800 hover:bg-neutral-300 rounded cursor-pointer mx-0.5 py-1 px-2",onClick:()=>a.updateAxis("z"),variant:"plain",iconColor:"secondary",iconName:"axis-z",children:e.jsx("div",{className:"text-base ml-2",children:"Z-axis Plane"})})]})]})}function VertexViewerCrossSectionOffsetStepper({offset:t,disabled:a,onOffsetChange:i}){const l=n.useRecoilValue(kt),r=n.useRecoilValue(Pt),[c,u]=o.useState(convertTo(t,l));o.useEffect((()=>{u(convertTo(t,l))}),[l,t]);const d=createDistanceFormatter(l,parseInt(r,10)),handleIncrementalUpdate=e=>{const t=convertFrom(c+e,l);i(t)},handleSubmit=e=>{e.preventDefault(),i(convertFrom(c,l))},handleBlur=()=>{i(convertFrom(c,l))};return e.jsx(s.VertexTooltip,{content:"Plane Offset",children:e.jsx("form",{"data-testid":"cross-section-stepper-form",onSubmit:handleSubmit,children:e.jsxs(s.VertexTextfield,{"data-testid":"cross-section-stepper-input",className:"viewer-toolbar-input w-32 border-none ring-0 bg-white",type:"text",value:d(parseFloat(t.toFixed(3))),onInputInput:e=>{u(null!=e.detail.value?parseFloat(e.detail.value):t)},onBlur:handleBlur,disabled:a,children:[e.jsx("div",{"data-testid":"cross-section-stepper-decrement",className:"py-1 cursor-pointer",slot:"left",onClick:()=>{a||handleIncrementalUpdate(-1)},children:e.jsx(s.VertexIcon,{name:"chevron-left",size:"sm"})}),e.jsx("div",{"data-testid":"cross-section-stepper-increment",className:"py-1 cursor-pointer",slot:"right",onClick:()=>{a||handleIncrementalUpdate(1)},children:e.jsx(s.VertexIcon,{name:"chevron-right",size:"sm"})})]})})})}VertexPopupButton.Anchor=Anchor;const Aa=400;function VertexViewerCrossSectionPopupMenu(){const t=useCrossSectioningActions(),a=n.useRecoilValue(ge),i=n.useRecoilValueLoadable(fe),r=n.useRecoilValueLoadable(xe),c=o.useRef(),u=o.useMemo((()=>"hasValue"===i.state&&Number.isFinite(i.contents.max)&&Number.isFinite(i.contents.min)),[i.state,i.contents]),d=o.useMemo((()=>"hasValue"===i.state?i.contents:oe),[i.state,i.contents]),m=o.useMemo((()=>"hasValue"===r.state&&Number.isFinite(r.contents)?r.contents:0),[r.state,r.contents]),handleCrossSectionValueChange=e=>{clearTimeout(c.current),c.current=window.setTimeout((()=>{t.endInteraction()}),Aa),t.beginInteraction(),t.updatePlanes(e)};return e.jsxs(VertexPopupButton,{"data-testid":"cross-section-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(a),onDismissed:t.closeAdditionalTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Section Tools",children:e.jsx("div",{className:"-ml-px py-1.5",children:e.jsx(s.VertexIcon,{"data-testid":"cross-section-popover-icon",name:"chevron-up",size:"sm",onClick:a?t.closeAdditionalTools:t.openAdditionalTools})})}),e.jsxs(l.VertexViewerToolbarGroup,{className:"relative bottom-3 flex justify-evenly items-center p-1 ring-1 ring-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(VertexViewerCrossSectionAlignmentPopoverMenu,{disabled:!u}),e.jsx(s.VertexTooltip,{className:"w-auto",content:"Reverse",children:e.jsx(s.VertexIconButton,{iconName:"flip","data-testid":"viewer-toolbar-flip-button",onClick:t.flipPlanes,iconColor:"secondary",disabled:!u})}),e.jsx(s.VertexTooltip,{className:"w-auto",content:"Align View to Plane",children:e.jsx(s.VertexIconButton,{"data-testid":"viewer-toolbar-align-view-to-plane-button",iconName:"align-view-to-plane",onClick:t.alignViewToPlane,iconColor:"secondary",disabled:!u})}),e.jsx(VertexToolbarDivider,{}),e.jsx(VertexViewerCrossSectionAxisPopoverMenu,{disabled:!u}),e.jsx("div",{className:"w-52 mx-2",children:e.jsx(VertexSlider,{value:m,defaultValue:d.default,disabled:asBooleanAttribute("hasValue"!==i.state)||!u,min:d.min,max:d.max,step:.01,onChange:handleCrossSectionValueChange})}),e.jsx("div",{className:"px-4",children:e.jsx(VertexViewerCrossSectionOffsetStepper,{offset:"hasValue"===r.state&&u?r.contents:0,disabled:!u,onOffsetChange:handleCrossSectionValueChange})})]})]})}const VertexViewerCrossSectionButton=()=>{const t=useCrossSectioningActions(),a=n.useRecoilValue(se);return e.jsxs(e.Fragment,{children:[e.jsx(s.VertexTooltip,{content:a?"Hide Section":"Show Section",children:e.jsx(s.VertexIconButton,{"data-testid":"viewer-toolbar-cross-section-button",iconName:"cross-section",iconColor:a?"primary":"secondary",onClick:()=>a?t.disable():t.enable()})}),e.jsx(VertexViewerCrossSectionPopupMenu,{})]})},VertexFitAllButton=()=>{const t=n.useRecoilValue(G);return e.jsx(s.VertexTooltip,{content:"Fit All",children:e.jsx(s.VertexIconButton,{iconName:"fit-all",iconColor:"secondary","data-testid":"viewer-toolbar-fit-all-button",onClick:async()=>{const e=await(null==t?void 0:t.scene());await(null==e?void 0:e.camera().viewAll().render({animation:{milliseconds:500}}))}})})},VertexPanButton=()=>{const t=n.useRecoilValue(G),a=n.useRecoilValue($),[i,l]=n.useRecoilState(Y),[r,c]=n.useRecoilState(q);return o.useEffect((()=>{null!=t&&a&&c(t.getBaseInteractionHandler())}),[t,a,c]),e.jsx(s.VertexTooltip,{content:"Pan",children:e.jsx(s.VertexIconButton,{iconName:"pan",iconColor:"pan"===i?"primary":"secondary","data-testid":"viewer-toolbar-pan-button",onClick:async()=>{if(l("pan"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("pan")}}})})},VertexRotateButton=()=>{const t=n.useRecoilValue(G),a=n.useRecoilValue($),[i,l]=n.useRecoilState(Y),[r,c]=n.useRecoilState(q);return o.useEffect((()=>{null!=t&&a&&c(t.getBaseInteractionHandler())}),[t,a,c]),e.jsx(s.VertexTooltip,{content:"Rotate",children:e.jsx(s.VertexIconButton,{iconName:"rotate",iconColor:"rotate"===i?"primary":"secondary","data-testid":"viewer-toolbar-rotate-button",onClick:async()=>{if(l("rotate"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("rotate")}}})})},VertexZoomButton=()=>{const t=n.useRecoilValue(G),a=n.useRecoilValue($),[i,l]=n.useRecoilState(Y),[r,c]=n.useRecoilState(q);return o.useEffect((()=>{null!=t&&a&&c(t.getBaseInteractionHandler())}),[t,a,c]),e.jsx(s.VertexTooltip,{content:"Zoom",children:e.jsx(s.VertexIconButton,{iconName:"zoom",iconColor:"zoom"===i?"primary":"secondary","data-testid":"viewer-toolbar-zoom-button",onClick:async()=>{if(l("zoom"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("zoom")}}})})},DefaultToolbar=()=>e.jsx(l.VertexViewerToolbar,{placement:"bottom-center",children:e.jsxs(l.VertexViewerToolbarGroup,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:[e.jsx(VertexRotateButton,{}),e.jsx(VertexPanButton,{}),e.jsx(VertexZoomButton,{}),e.jsx(VertexFitAllButton,{}),e.jsx(VertexToolbarDivider,{}),e.jsx(VertexBoxSelectionButton,{}),e.jsx(VertexToolbarDivider,{}),e.jsx(VertexViewerCrossSectionButton,{}),e.jsx(VertexToolbarDivider,{}),e.jsx(VertexPointToPointMeasurementTool,{}),e.jsx(VertexPreciseMeasurementTool,{})]})}),VertexToolbar=({children:t})=>{const n=null!=t&&!1!==t;return e.jsx(l.VertexViewerToolbar,{placement:"bottom-center",children:n?e.jsx(l.VertexViewerToolbarGroup,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:t}):e.jsx(DefaultToolbar,{})})};function VertexTransformWidget({transformWidgetElement:t,supportUndo:a,onPositionChange:s,onRotationChange:i}){const r=useTransformActions(),c=n.useRecoilValue(Dt),u=n.useRecoilValue(Rt),d=n.useRecoilValue(Nt),m=n.useRecoilValue(Bt),p=n.useRecoilValueLoadable(Lt),h=n.useRecoilValue(kt),f=n.useRecoilValue(Pt),g=o.useMemo((()=>"hasValue"===p.state?p.contents:m),[p,m]),v=o.useMemo((()=>{const e=undefined;return u&&(null!=g||c)}),[u,g,c]);return e.jsx(e.Fragment,{children:v&&e.jsx(l.VertexViewerTransformWidget,{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:()=>{r.disableSelectionSync(),r.setIsInteractivelyTransforming(!0)},onInteractionEnded:()=>{r.invalidateTransforms(),r.setIsInteractivelyTransforming(!1)},onPositionChanged:async e=>{await r.setTransformWidgetPosition(e.detail),null==s||s(e.detail)},onRotationChanged:e=>{r.setTransformWidgetOrientation(e.detail),null==i||i(e.detail)}})})}const VertexViewerSceneReset=({onReset:t})=>{const n=useCrossSectioningActions(),a=useSelectionActions(),o=useTransformActions(),i=useViewerSceneActions(),handleReset=async()=>{await n.disable(),await a.resetSelectionState(),o.clearTransformWidgetPosition(),await o.invalidateTransforms(),null==t||t(),await i.reset()};return e.jsx(s.VertexTooltip,{content:"Reset View",children:e.jsx(s.VertexIconButton,{iconName:"reset",className:"flex bg-white opacity-70 hover:opacity-100 text-neutral-900 hover:text-neutral-700 hover:bg-neutral-200 rounded p-1 cursor-pointer","data-testid":"viewer-reset-tool-button",onClick:handleReset,variant:"plain"})})};function useViewerFrameActions(){const e=useTransformActions();return{frameDrawn:useActionCallback((({set:t,snapshot:n})=>async a=>{const o=await n.getPromise(Ct);t(Z,a.detail.scene),t(Ct,a.detail.scene.sceneViewSummary.selectedVisibleSummary),t(St,o);const s=undefined;await n.getPromise(Rt)&&await e.syncToSelection()}))}}const VertexBoxSelectionTool=()=>{const{element:t,callback:a}=useCallbackRef(),o=useBoxSelectionActions(),s=useTransformActions(),i=n.useRecoilValue(Ue);return d.useEffect((()=>{const e=whenComponentReady(t,(()=>{var e;return[null===(e=null==t?void 0:t.model)||void 0===e?void 0:e.onDragComplete((()=>{"clearAndSelect"===i&&(s.clearTransformWidgetOrientation(),s.clearTransformWidgetPosition(),s.enableSelectionSync())}))]}));return()=>{null==e||e.then((e=>{null==e||e.forEach((e=>null==e?void 0:e.dispose()))}))}}),[t,i]),useApplyKeyBinding({keyBind:"Shift",fn:d.useCallback((()=>o.setOperationType("select")),[]),off:d.useCallback((()=>o.setOperationType("clearAndSelect")),[])}),e.jsx(l.VertexViewerBoxQueryTool,{ref:a,"data-testid":"viewer-box-query-tool",operationType:i})};function VertexViewerCameraTypeMenu({open:t,onOpen:a,onDismiss:o,onCameraTypeChange:i}){const l=useViewerCameraActions(),r=n.useRecoilValue(U);return e.jsxs(s.VertexMenu,{"data-testid":"camera-types-popover",className:"flex",placement:"bottom-end",open:asBooleanAttribute(t),onMenuClosed:o,children:[e.jsx("div",{slot:"anchor",children:e.jsx("div",{className:Ee("flex bg-white hover:opacity-100 hover:text-neutral-700 hover:bg-neutral-200 rounded",{"opacity-70 text-neutral-900":!t,"opacity-100 text-neutral-700 bg-neutral-200":t}),children:e.jsx(s.VertexTooltip,{content:"Change View",children:e.jsx(s.VertexIconButton,{"data-testid":"set-camera-mode-option",className:"p-1 cursor-pointer",variant:"plain",onClick:a,iconName:"orthographic"===r?"cube-orthographic":"cube-perspective",children:e.jsx(s.VertexIcon,{"data-testid":"change-camera-type-icon-button",name:"chevron-down",size:"sm"})})})})}),e.jsxs("div",{className:"w-36",children:[e.jsx("div",{className:"pt-1"}),e.jsxs(s.VertexMenuItem,{"data-testid":"set-perspective-view",onClick:()=>{l.updateCameraType("perspective",!0),null==i||i("perspective")},children:[e.jsx(s.VertexIcon,{slot:"icon","data-testid":"set-perspective-view-icon",name:"cube-perspective",size:"sm",className:Ee({"text-[var(--vertex-ui-blue-700)]":"perspective"===r})}),e.jsx("div",{className:Ee("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"perspective"===r}),children:"Perspective"})]}),e.jsxs(s.VertexMenuItem,{"data-testid":"set-orthographic-view",onClick:()=>{l.updateCameraType("orthographic",!0),null==i||i("orthographic")},children:[e.jsx(s.VertexIcon,{slot:"icon","data-testid":"set-orthographic-view-icon",name:"cube-orthographic",size:"sm",className:Ee({"text-[var(--vertex-ui-blue-700)]":"orthographic"===r})}),e.jsx("div",{className:Ee("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"orthographic"===r}),children:"Orthographic"})]})]})]})}const VertexViewerViewCube=t=>{var{placement:n,children:a}=t,s=__rest(t,["placement","children"]);const i=Array.isArray(a)?a:[a],r=i.filter((e=>!o.isValidElement(e)||e.type!==l.VertexViewerViewCube)).filter((e=>null!=e&&!1!==e)),c=i.find((e=>o.isValidElement(e)&&e.type===l.VertexViewerViewCube)),[u,d]=o.useState(!1);return e.jsxs(l.VertexViewerToolbar,{direction:"vertical","data-testid":"view-cube-toolbar",placement:null!=n?n:"top-right",children:[null!=c?c:e.jsx(l.VertexViewerViewCube,Object.assign({className:"m-7"},s)),0===r.length?e.jsxs("div",{className:"flex items-center justify-center mt-3 gap-1",children:[e.jsx(VertexViewerSceneReset,{}),e.jsx(VertexViewerCameraTypeMenu,{open:u,onDismiss:()=>d(!1),onOpen:()=>d(!0)})]}):e.jsx("div",{className:"mt-3",children:r})]})},VertexViewer=t=>{var{id:a,src:s,className:i,disableSelection:r,onTap:c,onLongpress:u,onFrameDrawn:d,onSceneReady:m,viewerRefCallback:p,children:h}=t,f=__rest(t,["id","src","className","disableSelection","onTap","onLongpress","onFrameDrawn","onSceneReady","viewerRefCallback","children"]);const g=n.useRecoilValue(Yn),v=useRecoilRef({state:G}),b=useViewerCameraActions(),S=useCrossSectioningActions(),C=useHitActions(),w=useSelectionActions(),V=useViewerFrameActions(),j=n.useRecoilValue(U),T=n.useRecoilValue(ce),A=n.useRecoilValue(We),k=n.useSetRecoilState(X),[P,I]=n.useRecoilState($);o.useEffect((()=>{P&&(I(!1),S.disable())}),[s]);const[E,M]=n.useRecoilState(K);o.useEffect((()=>{null!=a&&M(a)}),[a]);const O=n.useRecoilValue(Un),R=o.useMemo((()=>({opacity:O/100})),[O]),N=n.useRecoilValue(Re),_=n.useRecoilValue(Ne),L=o.useMemo((()=>({color:N,width:_})),[N,_]),B=n.useRecoilValue(bn),D=n.useRecoilValue(xn),F=n.useRecoilValue(gn),H=n.useRecoilValue(vn),W=o.useMemo((()=>({color:D,opacity:F/100,lineWidth:H})),[D,F,H]),q=n.useRecoilValue(Xe),Y=null!=h&&!1!==h;return useKeyBindings(),useDefaultKeybindings(),e.jsxs(l.VertexViewer,Object.assign({id:E,"data-testid":"vertex-viewer",src:s,ref:e=>{null==p||p(e),v(e)},className:Ee("flex w-full h-full",i,{"cursor-crosshair":T.hitPending}),style:{"--viewer-background":B},config:g,cameraType:P?j:void 0,onCameraTypeChanged:e=>{P&&b.updateCameraType(e.detail,!1)},phantom:R,featureLines:L,selectionHighlighting:W,featureMaps:q?"final":void 0,onTap:e=>{const t=[...r?[]:[w.selectCurrentHit]];C.tap(e,...t),null==c||c(e)},onLongpress:e=>{C.longPress(e),null==u||u(e)},onFrameDrawn:e=>{V.frameDrawn(e),null==d||d(e)},onSceneReady:async e=>{var t;if(!P){I(!0);const n=await(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.scene());k(null==n?void 0:n.sceneViewId)}null==m||m(e)}},f,{children:[A&&e.jsx(VertexBoxSelectionTool,{}),Y?h:e.jsxs(e.Fragment,{children:[e.jsx(VertexViewerViewCube,{}),e.jsx(VertexToolbar,{}),e.jsx(VertexViewerContextMenu,{})]})]}))};function toSdkConfig(e){return isOnlyNetworkConfig(e)?{network:e}:e}function isOnlyNetworkConfig(e){const t=undefined;return null!=e.renderingHost}const VertexViewerToolkitEventListener=({onHitStateChange:t,onSelectionStateChange:a})=>{const s=n.useRecoilValue(Xt),i=n.useRecoilValue(Jt);return o.useEffect((()=>{null==t||t(s)}),[s,t]),o.useEffect((()=>{null==a||a(i)}),[i,a]),e.jsx(e.Fragment,{})},VertexViewerToolkitRoot=t=>{var{override:a,autoDefineCustomElements:s,children:i,config:l}=t,r=__rest(t,["override","autoDefineCustomElements","children","config"]);return o.useEffect((()=>{(null==s||s)&&(u.defineCustomElements(),c.defineCustomElements())}),[s]),e.jsx(n.RecoilRoot,{override:a,children:e.jsxs(e.Fragment,{children:[e.jsx(VertexViewerToolkitEventListener,Object.assign({},r)),e.jsx(VertexViewerToolkitRootConfig,{config:l,children:i})]})})},VertexViewerToolkitRootConfig=({config:t,children:a})=>{const s=n.useSetRecoilState(Yn);return o.useEffect((()=>{const e=null!=t?toSdkConfig(t):void 0;s(e)}),[t,s]),e.jsx(e.Fragment,{children:a})};var ka=Object.freeze({__proto__:null,get AssemblyFontFace(){return va},Columns:ra,Core:Rn,Metadata:Sa,Search:ga});exports.Appearance=Sn,exports.BoxSelection=Ge,exports.Config=Xn,exports.ContextMenu=He,exports.CrossSection=ke,exports.Ghosting=qn,exports.Hits=Zt,exports.Keybinding=Vn,exports.Measurement=lt,exports.Messages=H,exports.Metadata=Hn,exports.Panel=kn,exports.Performance=ut,exports.SceneTree=ka,exports.SceneViewItem=At,exports.Selection=Qt,exports.Settings=It,exports.Transforms=Yt,exports.VertexApplicationMessages=VertexApplicationMessages,exports.VertexBoxSelectionButton=VertexBoxSelectionButton,exports.VertexContextMenu=VertexContextMenu,exports.VertexCrossSectionAppearanceColorPicker=VertexCrossSectionAppearanceColorPicker,exports.VertexCrossSectionAppearanceControls=VertexCrossSectionAppearanceControls,exports.VertexCrossSectionAppearanceLineThicknessSlider=VertexCrossSectionAppearanceLineThicknessSlider,exports.VertexCrossSectionAppearancePanelSection=VertexCrossSectionAppearancePanelSection,exports.VertexCrossSectionAppearanceReset=VertexCrossSectionAppearanceReset,exports.VertexDecimalPlaceSelector=VertexDecimalPlaceSelector,exports.VertexFeatureEdgesColorPicker=VertexFeatureEdgesColorPicker,exports.VertexFeatureEdgesControls=VertexFeatureEdgesControls,exports.VertexFeatureEdgesPanelSection=VertexFeatureEdgesPanelSection,exports.VertexFeatureEdgesReset=VertexFeatureEdgesReset,exports.VertexFeatureEdgesThicknessSlider=VertexFeatureEdgesThicknessSlider,exports.VertexFitAllButton=VertexFitAllButton,exports.VertexFitSelectedMenuItem=VertexFitSelectedMenuItem,exports.VertexFlyToMenuItem=VertexFlyToMenuItem,exports.VertexGhostingControls=VertexGhostingControls,exports.VertexGhostingPanelSection=VertexGhostingPanelSection,exports.VertexHideAllMenuItem=VertexHideAllMenuItem,exports.VertexHidePartMenuItem=VertexHidePartMenuItem,exports.VertexHideSelectedMenuItem=VertexHideSelectedMenuItem,exports.VertexLengthUnitSelector=VertexLengthUnitSelector,exports.VertexMaterialControls=VertexMaterialControls,exports.VertexMaterialPanelSection=VertexMaterialPanelSection,exports.VertexMeasurementContextMenu=VertexMeasurementContextMenu,exports.VertexMeasurementDetails=VertexMeasurementDetails,exports.VertexPanButton=VertexPanButton,exports.VertexPointToPointMeasurement=VertexPointToPointMeasurement,exports.VertexPointToPointMeasurementTool=VertexPointToPointMeasurementTool,exports.VertexPreciseMeasurement=VertexPreciseMeasurement,exports.VertexPreciseMeasurementTool=VertexPreciseMeasurementTool,exports.VertexResizableContent=VertexResizableContent,exports.VertexRotateButton=VertexRotateButton,exports.VertexSceneItemGhostingClear=VertexSceneItemGhostingClear,exports.VertexSceneItemGhostingOpacitySlider=VertexSceneItemGhostingOpacitySlider,exports.VertexSceneItemGhostingToggle=VertexSceneItemGhostingToggle,exports.VertexSceneItemMaterialClear=VertexSceneItemMaterialClear,exports.VertexSceneItemMaterialColorPicker=VertexSceneItemMaterialColorPicker,exports.VertexSceneItemMaterialColorSwatches=VertexSceneItemMaterialColorSwatches,exports.VertexSceneItemMaterialOpacitySlider=VertexSceneItemMaterialOpacitySlider,exports.VertexSceneTree=VertexSceneTree,exports.VertexSceneTreeColumnPopover=VertexSceneTreeColumnPopover,exports.VertexSceneTreeContextMenu=VertexSceneTreeContextMenu,exports.VertexSceneTreeCustomColumn=VertexSceneTreeCustomColumn,exports.VertexSceneTreeHeader=VertexSceneTreeHeader,exports.VertexSceneTreeMetadataColumns=VertexSceneTreeMetadataColumns,exports.VertexSceneTreeSearchBar=VertexSceneTreeSearchBar,exports.VertexSceneTreeSearchInformationForToolbar=VertexSceneTreeSearchInformationForToolbar,exports.VertexSceneTreeSearchOptionsPopover=VertexSceneTreeSearchOptionsPopover,exports.VertexSceneTreeTableLayout=VertexSceneTreeTableLayout,exports.VertexSelectionHighlightingColorPicker=VertexSelectionHighlightingColorPicker,exports.VertexSelectionHighlightingControls=VertexSelectionHighlightingControls,exports.VertexSelectionHighlightingLineThicknessSlider=VertexSelectionHighlightingLineThicknessSlider,exports.VertexSelectionHighlightingOpacitySlider=VertexSelectionHighlightingOpacitySlider,exports.VertexSelectionHighlightingPanelSection=VertexSelectionHighlightingPanelSection,exports.VertexSelectionHighlightingReset=VertexSelectionHighlightingReset,exports.VertexShowAllMenuItem=VertexShowAllMenuItem,exports.VertexShowOnlyMenuItem=VertexShowOnlyMenuItem,exports.VertexShowOnlySelectedMenuItem=VertexShowOnlySelectedMenuItem,exports.VertexShowPropertiesMenuItem=VertexShowPropertiesMenuItem,exports.VertexToolbar=VertexToolbar,exports.VertexToolbarDivider=VertexToolbarDivider,exports.VertexTransformClear=VertexTransformClear,exports.VertexTransformControls=VertexTransformControls,exports.VertexTransformInputs=VertexTransformInputs,exports.VertexTransformManipulatorToggle=VertexTransformManipulatorToggle,exports.VertexTransformPanelSection=VertexTransformPanelSection,exports.VertexTransformWidget=VertexTransformWidget,exports.VertexUnitsControls=VertexUnitsControls,exports.VertexUnitsPanelSection=VertexUnitsPanelSection,exports.VertexViewer=VertexViewer,exports.VertexViewerBackgroundColorPicker=VertexViewerBackgroundColorPicker,exports.VertexViewerBackgroundControls=VertexViewerBackgroundControls,exports.VertexViewerBackgroundPanelSection=VertexViewerBackgroundPanelSection,exports.VertexViewerBackgroundReset=VertexViewerBackgroundReset,exports.VertexViewerContextMenu=VertexViewerContextMenu,exports.VertexViewerCrossSectionButton=VertexViewerCrossSectionButton,exports.VertexViewerRightOpenedPanel=VertexViewerRightOpenedPanel,exports.VertexViewerRightSidebar=VertexViewerRightSidebar,exports.VertexViewerSceneReset=VertexViewerSceneReset,exports.VertexViewerToolkitRoot=VertexViewerToolkitRoot,exports.VertexViewerViewCube=VertexViewerViewCube,exports.VertexZoomButton=VertexZoomButton,exports.Viewer=Q;
19
19
  //# sourceMappingURL=bundle.cjs.js.map