@vertexvis/viewer-toolkit-react 0.0.6-canary.7 → 0.0.6-canary.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("quick-format-unescaped"),n=require("recoil"),o=require("@vertexvis/geometry"),a=require("react"),l=require("@vertexvis/ui-react"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("quick-format-unescaped"),n=require("recoil"),o=require("@vertexvis/geometry"),a=require("react"),l=require("@vertexvis/ui-react"),i=require("@vertexvis/viewer"),s=require("@vertexvis/viewer-react"),r=require("prop-types"),c=require("@vertexvis/ui/loader"),d=require("@vertexvis/viewer/loader");function _interopNamespaceDefault(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{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,o=arguments.length;n<o;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},__assign.apply(this,arguments)};function __rest(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);a<o.length;a++)t.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(n[o[a]]=e[o[a]]);return n}function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o=n.call(e),a,l=[],i;try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)l.push(a.value)}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return l}"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,o){return void 0===o&&(o=255),{r:e,g:t,b:n,a:o}},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,o,a;if(Array.isArray(e)){if((n=e.length)!=t.length)return!1;for(o=n;0!=o--;)if(!equal(e[o],t[o]))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=(a=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(t,a[o]))return!1;for(o=n;0!=o--;){var l=a[o];if(!equal(e[l],t[l]))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),o=n[0],a=n.slice(1),l=__assign({},o);if(0===a.length)return l;if(1===a.length){var s=a[0];for(var i in s)null==l[i]?l[i]=s[i]:isPlainObject(l[i])&&(l[i]=defaults(l[i],s[i]));return l}return a.reduce((function(e,t){return defaults(e,t)}),o)}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,w=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(w)}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 S=[],j=0;j<256;++j)S.push((j+256).toString(16).substr(1));function stringify(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(S[e[t+0]]+S[e[t+1]]+S[e[t+2]]+S[e[t+3]]+"-"+S[e[t+4]]+S[e[t+5]]+"-"+S[e[t+6]]+S[e[t+7]]+"-"+S[e[t+8]]+S[e[t+9]]+"-"+S[e[t+10]]+S[e[t+11]]+S[e[t+12]]+S[e[t+13]]+S[e[t+14]]+S[e[t+15]]).toLowerCase();if(!validate(n))throw TypeError("Stringified UUID is invalid");return n}function v4(e,t,n){var o=(e=e||{}).random||(e.rng||rng)();return o[6]=15&o[6]|64,o[8]=63&o[8]|128,stringify(o)}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,o="string"==typeof t?BigInt(t):t,a=digits(n>>BigInt(32),BigInt(8)),l=digits(n>>BigInt(16),BigInt(4)),s=digits(n,BigInt(4)),i=digits(o>>BigInt(48),BigInt(4)),r=digits(o,BigInt(12));return"".concat(a,"-").concat(l,"-").concat(s,"-").concat(i,"-").concat(r)}function toMsbLsb(e){var t=__read(e.split("-"),5),n=t[0],o=t[1],a=t[2],l=t[3],s=t[4];if(null==n||null==o||null==a||null==l||null==s)throw new Error("Invalid UUID string ".concat(e));var i=BigInt.asIntN(64,BigInt("0x".concat(n+o+a))),r=BigInt.asIntN(64,BigInt("0x".concat(l+s)));return{msb:i.toString(),lsb:r.toString()}}var V=Object.freeze({__proto__:null,create:create$1,fromMsbLsb:fromMsbLsb,toMsbLsb:toMsbLsb}),k={exports:{}};const T=t;k.exports=pino;const A=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"),M=Symbol("pino.hierarchy"),E={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function appendChildLogger(e,t){const n={logger:t,parent:e[M]};t[M]=n}function setupBaseLogFunctions(e,t,n){const o={};t.forEach((e=>{o[e]=n[e]?n[e]:A[e]||A[E[e]||"log"]||noop})),e[I]=o}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||A;e.browser.write&&(e.browser.asObject=!0);const o=e.serializers||{},a=shouldSerialize(e.browser.serialize,o);let l=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(l=!1);const s=Object.keys(e.customLevels||{}),i=["error","fatal","warn","info","debug","trace"].concat(s);"function"==typeof n&&i.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,i,n),appendChildLogger({},c),Object.defineProperty(c,"levelVal",{get:getLevelVal}),Object.defineProperty(c,"level",{get:getLevel,set:setLevel});const d={transmit:t,serialize:a,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:i,timestamp:getTimeFunction(e),messageKey:e.messageKey||"msg",onChild:e.onChild||noop};function getLevelVal(){return levelToValue(this.level,this)}function getLevel(){return this._level}function setLevel(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,set(this,d,c,"error"),set(this,d,c,"fatal"),set(this,d,c,"warn"),set(this,d,c,"info"),set(this,d,c,"debug"),set(this,d,c,"trace"),s.forEach((e=>{set(this,d,c,e)}))}function child(n,l,s){if(!l)throw new Error("missing bindings for child Pino");s=s||{},a&&l.serializers&&(s.serializers=l.serializers);const i=s.serializers;if(a&&i){var r=Object.assign({},o,i),c=!0===e.browser.serialize?Object.keys(r):a;delete l.serializers,applySerializers([l],c,r,this._stdErrSerialize)}function Child(e){this._childLevel=1+(0|e._childLevel),this.bindings=l,r&&(this.serializers=r,this._serialize=c),t&&(this._logEvent=createLogEventShape([].concat(e._logEvent.bindings,l)))}Child.prototype=this;const d=new Child(this);return appendChildLogger(this,d),d.child=function(...e){return child.call(this,n,...e)},d.level=s.level||this.level,n.onChild(d),d}return c.levels=getLevels(e),c.level=r,c.isLevelEnabled=function(e){return!!this.levels.values[e]&&this.levels.values[e]>=this.levels.values[this.level]},c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=noop,c.serializers=o,c._serialize=a,c._stdErrSerialize=l,c.child=function(...e){return child.call(this,d,...e)},t&&(c._logEvent=createLogEventShape()),c}function getLevels(e){const t=e.customLevels||{},n=undefined,o=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[M];for(;n.parent;)n=n.parent,n.logger.bindings&&t.push(n.logger.bindings);return t.reverse()}function set(e,t,n,o){if(Object.defineProperty(e,o,{value:levelToValue(e.level,n)>levelToValue(o,n)?noop:n[I][o],writable:!0,enumerable:!0,configurable:!0}),e[o]===noop){if(!t.transmit)return;const a=undefined,l=levelToValue(t.transmit.level||e.level,n),s=undefined;if(levelToValue(o,n)<l)return}e[o]=createWrap(e,t,n,o);const a=getBindingChain(e);0!==a.length&&(e[o]=prependBindingsInArguments(a,e[o]))}function prependBindingsInArguments(e,t){return function(){return t.apply(this,[...e,...arguments])}}function createWrap(e,t,n,o){return a=e[I][o],function LOG(){const l=t.timestamp(),s=new Array(arguments.length),i=Object.getPrototypeOf&&Object.getPrototypeOf(this)===A?A:this;for(var r=0;r<s.length;r++)s[r]=arguments[r];var c=!1;if(t.serialize&&(applySerializers(s,this._serialize,this.serializers,this._stdErrSerialize),c=!0),t.asObject||t.formatters?a.call(i,...asObject(this,o,s,l,t)):a.apply(i,s),t.transmit){const a=void 0,i=levelToValue(t.transmit.level||e._level,n),r=levelToValue(o,n);if(r<i)return;transmit(this,{ts:l,methodLevel:o,methodValue:r,transmitValue:n.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:levelToValue(e._level,n)},s,c)}};var a}function asObject(e,t,n,o,a){const{level:l,log:s=e=>e}=a.formatters||{},i=n.slice();let r=i[0];const c={};let d=1+(0|e._childLevel);if(d<1&&(d=1),o&&(c.time=o),l){const n=l(t,e.levels.values[t]);Object.assign(c,n)}else c.level=e.levels.values[t];if(a.asObjectBindingsOnly){if(null!==r&&"object"==typeof r)for(;d--&&"object"==typeof i[0];)Object.assign(c,i.shift());const e=undefined;return[s(c),...i]}{if(null!==r&&"object"==typeof r){for(;d--&&"object"==typeof i[0];)Object.assign(c,i.shift());r=i.length?T(i.shift(),i):void 0}else"string"==typeof r&&(r=T(i.shift(),i));void 0!==r&&(c[a.messageKey]=r);const e=undefined;return[s(c)]}}function applySerializers(e,t,n,o){for(const a in e)if(o&&e[a]instanceof Error)e[a]=pino.stdSerializers.err(e[a]);else if("object"==typeof e[a]&&!Array.isArray(e[a])&&t)for(const o in e[a])t.indexOf(o)>-1&&o in n&&(e[a][o]=n[o](e[a][o]))}function transmit(e,t,n,o=!1){const a=t.send,l=t.ts,s=t.methodLevel,i=t.methodValue,r=t.val,c=e._logEvent.bindings;o||applySerializers(n,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=l,e._logEvent.messages=n.filter((function(e){return-1===c.indexOf(e)})),e._logEvent.level.label=s,e._logEvent.level.value=i,a(s,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 R;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}),k.exports.default=pino,k.exports.pino=pino;const N=(0,k.exports)({formatters:{level:e=>({level:e})}}),logger_error=(e,t)=>{null!=t?N.error(t,e):N.error(e)},logger_info=(e,t)=>{null!=t?N.info(t,e):N.info(e)},logger_warn=(e,t)=>{null!=t?N.warn(t,e):N.warn(e)},logger_debug=(e,t)=>{null!=t?N.debug(t,e):N.debug(e)};class O{}function useActionCallback(e,t=[]){const o=t instanceof O?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)}})}))),o)}function retainSnapshot(e){return t=>{var{snapshot:n}=t,o=__rest(t,["snapshot"]);return async(...t)=>{const a=n.retain();try{const a=undefined;return await e(Object.assign(Object.assign({},o),{snapshot:n}))(...t)}finally{a()}}}}function createGetPromiseRequiredWrapper(e){return async(t,n)=>{const o=await e.getPromise(t);if(null==o)throw null!=n?n:new Error(`No value present for required value ${t.key}`);return o}}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 L=3e3,_=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:V.create()}):void 0)})),setToastMessage:useActionCallback((({set:e})=>t=>{e(D,null!=t?Object.assign(Object.assign({},t),{id:V.create()}):void 0)}))});var H=Object.freeze({__proto__:null,LOW_SEVERITY_BANNER_MESSAGE_DURATION_MS:_,LOW_SEVERITY_TOAST_MESSAGE_DURATION_MS:L,MEDIUM_SEVERITY_TOAST_MESSAGE_DURATION_MS:B,applicationMessageBanner:F,applicationMessageToast:D,useApplicationMessageActions:useApplicationMessageActions});const U=500;function useViewerCameraActions(){const e=useApplicationMessageActions();return{flyToById:useActionCallback((({snapshot:e})=>async(t,n)=>{const o=await e.getPromise(G),a=await(null==o?void 0:o.scene());await(null==a?void 0:a.camera().flyTo({itemId:t}).render({animation:{milliseconds:null!=n?n:U}}))})),flyToByBoundingBox:useActionCallback((({snapshot:e})=>async(t,n)=>{const o=await e.getPromise(G),a=await(null==o?void 0:o.scene());await(null==a?void 0:a.camera().flyTo({boundingBox:t}).render({animation:{milliseconds:null!=n?n:U}}))})),updateCameraType:useActionCallback((({set:t,snapshot:n})=>async(a,l)=>{const s=await n.getPromise(J),i=undefined;null!=s&&o.BoundingBox.isValid(s)||!l?t(W,a):e.setToastMessage({type:"error",message:"Cannot change the camera type when no geometry is visible.",duration:B})}))}}const W=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,...o)=>{const a=await e.getPromise(G),l=await(null==a?void 0:a.scene());o.length>0&&await(null==l?void 0:l.items((e=>o.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()),[]),o=a.useCallback((e=>e.where((e=>e.all())).deselect()),[]);return{executeWithCorrelationId:e,execute:useActionCallback((()=>async(t,...n)=>{const o=V.create();await e(t,o,...n)})),selectItemsTransform:t,deselectItemsTransform:n,clearSelectionTransform:o,reset:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(G),o=await(null==n?void 0:n.scene()),a=await e.getPromiseRequired(W);null==o||o.reset({includeCamera:!0,suppliedCorrelationId:t,cameraTypeOverride:a})}))}}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:U,useViewerCameraActions:useViewerCameraActions,useViewerSceneActions:useViewerSceneActions,viewerBaseInteractionHandlerProvider:q,viewerCameraType:W,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(o.Vector3.left(),-e),y=e=>create(o.Vector3.down(),-e),z=e=>create(o.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:o.Vector3.left(),y:o.Vector3.down(),z:o.Vector3.forward()},xAxis=e=>e.x,yAxis=e=>e.y||o.Vector3.create(e.x.z,e.x.x,e.x.y),zAxis=e=>e.z||o.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===o.Vector3.magnitude(o.Vector3.cross(e.normal,t[1])))).map((e=>e[0])).pop(),isNegativeNormal=e=>o.Vector3.dot(o.Vector3.create(-1,-1,-1),e.normal)>0,towardsVector=(e,t)=>{const n=undefined;return o.Vector3.dot(e,t.normal)<0?invert(t):t},towardsCamera=(e,t)=>towardsVector(e.viewVector,t),invert=e=>Object.assign(Object.assign({},e),{normal:o.Vector3.multiply(e.normal,o.Vector3.create(-1,-1,-1)),offset:-e.offset}),fromHit=(e,t)=>{const n=o.Vector3.normalize(e.normal),a=o.Vector3.dot(n,e.position);return towardsCamera(t,create(n,a))},toAxis=(e,t,n,a,l)=>{const s=n.viewAll(),i=getAxis(e,t),r=null!=a&&null!=i?create(i,o.Vector3.dot(i,l||o.BoundingBox.center(a))):forAxis(e,s.lookAt[e]);return towardsCamera(n,r)};function corners(e){return[o.Vector3.create(e.min.x,e.min.y,e.min.z),o.Vector3.create(e.min.x,e.min.y,e.max.z),o.Vector3.create(e.min.x,e.max.y,e.min.z),o.Vector3.create(e.min.x,e.max.y,e.max.z),o.Vector3.create(e.max.x,e.max.y,e.max.z),o.Vector3.create(e.max.x,e.max.y,e.min.z),o.Vector3.create(e.max.x,e.min.y,e.max.z),o.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}var ne;!function(e){e.PART="PART",e.SINGLE="SINGLE"}(ne||(ne={}));const oe="#616161",ae=1,le="#BDBDBD",se={default:5,min:0,max:10},ie=n.atom({key:"crossSectioningEnabled",default:!1}),re=n.atom({key:"crossSectioningHighlightColor",default:oe}),ce=n.atom({key:"crossSectioningBorderWidth",default:1}),de=n.atom({key:"endCapEnabledDefault",default:!1}),ue=n.atom({key:"endCapEnabled",default:!1}),me=n.atom({key:"endCapColorType",default:ne.PART}),pe=n.atom({key:"endCapCustomColor",default:le}),he=n.atom({key:"crossSectioningPlanes",default:[]}),xe=n.atom({key:"crossSectioningAlignment",default:{mode:"global",hitPending:!1}}),fe=n.selector({key:"crossSectioningTargetBoundingBox",get:async({get:e})=>{const t=undefined;return e(J)}}),ge=n.atom({key:"crossSectioningIsInteractive",default:!1}),ve=n.atom({key:"crossSectioningActiveAxis",default:"x"}),ye=n.atom({key:"crossSectioningAvailableAxes",default:te}),be=n.selector({key:"crossSectioningOffsetScalar",get:({get:e})=>{const t=e(he);return t.length>0&&isNegativeNormal(t[0])?-1:1}}),we=n.selector({key:"crossSectioningSliderRange",get:({get:e})=>{const t=e(he),n=e(fe),a=null!=n?corners(n):[];if(t.length>0){const e=a.map((e=>o.Vector3.dot(e,isNegativeNormal(t[0])?o.Vector3.multiply(t[0].normal,o.Vector3.create(-1,-1,-1)):t[0].normal)));return{default:t[0].offset,min:Math.min(...e)-2,max:Math.max(...e)+2}}return se}}),Ce=n.selector({key:"crossSectioningPlaneDisplayOffset",get:({get:e})=>{const t=e(he),n=e(be),o=e(we);return t.length>0?t[0].offset*n:o.default}}),Se=n.atom({key:"crossSectioningAdditionalToolsOpen",default:!1}),je=n.atom({key:"crossSectioningAlignmentToolsOpen",default:!1}),Ve=n.atom({key:"crossSectioningAxisToolsOpen",default:!1}),ke=n.atom({key:"crossSectioningInteractionHandler",default:new ee,dangerouslyAllowMutability:!0});function useCrossSectioning(e,t){const o=n.useRecoilValue(ke);a.useEffect((()=>{t&&(null==e||e.registerInteractionHandler(o))}),[e,t,o])}const Te=n.atom({key:"hitResultsTapDetails",default:void 0}),Ae=n.atom({key:"hitResultsLongPressDetails",default:void 0}),Pe=n.atom({key:"previousHitResult",default:void 0}),Ie=n.atom({key:"currentHitResult",default:void 0}),Me=n.selector({key:"hitResult",get:async({get:e})=>{var t,n,a,l,s,i,r,c,d;const u=e(Te),m=e(Ae),p=null!=u?u:m,h=e(G),f=await(null==h?void 0:h.scene()),g=null==f?void 0:f.sceneViewId,v=null==f?void 0:f.raycaster();if(null!=p&&null!=v&&null!=g){const e=await v.hitItems(p.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:o.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===(l=null==u?void 0:u.hitNormal)||void 0===l?void 0:l.z)||0),position:o.Vector3.create((null===(s=null==u?void 0:u.hitPoint)||void 0===s?void 0:s.x)||0,(null===(i=null==u?void 0:u.hitPoint)||void 0===i?void 0:i.y)||0,(null===(r=null==u?void 0:u.hitPoint)||void 0===r?void 0:r.z)||0),meta:p.metaKey||p.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})))||[],annotationId:null===(d=null==u?void 0:u.annotationId)||void 0===d?void 0:d.hex}}}}),Ee=n.atom({key:"hitResultsSkipNextTap",default:!1}),alignToNormal=(e,t,n)=>{if(e.toFrameCamera().isPerspective()){const n=o.Vector3.dot(o.Vector3.normalize(e.up),t),a=Math.abs(n)>.98?o.Vector3.normalize(o.Vector3.scale(-n,e.viewVector)):e.up,l=o.Vector3.add(o.Vector3.scale(o.Vector3.distance(e.position,e.lookAt),o.Vector3.multiply(t,o.Vector3.create(-1,-1,-1))),e.lookAt);return e.update({up:a,position:l})}{const a=o.Vector3.angleTo(o.Vector3.normalize(e.viewVector),t),l=null!=n?o.BoundingBox.center(n):e.lookAt,s=o.Vector3.normalize(o.Vector3.cross(o.Vector3.normalize(e.viewVector),t));return e.rotateAroundAxisAtPoint(a,l,s)}};function isParallelTo(e,t){const n=o.Angle.toDegrees(o.Vector3.angleTo(e,t));return 0===n||180===n}const Re=500;function useCrossSectioningActions(){const e=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(ce),n=await e.getPromise(re),o=await e.getPromise(he),a=await e.getPromise(G),l=await(null==a?void 0:a.scene());await(null==l?void 0:l.crossSectioning().update({sectionPlanes:o,highlightColor:n?f.fromHexString(n):void 0,lineWidth:t}))})),t=useActionCallback((({set:t,reset:n,snapshot:o})=>async()=>{const a=await o.getPromise(G),l=await(null==a?void 0:a.scene());if(null!=l){const o=l.camera().viewAll();n(ye),t(he,[towardsCamera(l.camera(),x(o.lookAt.x))]),await e()}})),n=useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async()=>{const o=await t.tryGetPromise(Me).then((e=>e.value)),a=await t.getPromise(G),l=await(null==a?void 0:a.scene());if(null!=o&&null!=l){const t=fromHit(o,l.camera());n(he,null!=t?[t]:[]),n(ye,null!=t?{x:t.normal}:te),await e()}}))),a=useActionCallback((({set:e,snapshot:n})=>async()=>{const o=await n.getPromise(he),a=undefined;await n.getPromise(ie)||(e(ie,!0),0===o.length&&await t())})),l=useActionCallback((({reset:t,snapshot:n})=>async()=>{const o=undefined;await n.getPromise(ie)&&(t(ie),t(Se),t(je),t(Ve),t(he),t(xe),t(ve),await e())}));return{enable:a,disable:l,reapply:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(ie)&&await e()})),openAdditionalTools:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=undefined;await t.getPromise(ie)||await a(),e(Se,!0)})),closeAdditionalTools:useActionCallback((({reset:e})=>()=>{e(Se)})),openAlignmentTools:useActionCallback((({set:e,reset:t})=>()=>{t(Ve),e(je,!0)})),closeAlignmentTools:useActionCallback((({reset:e})=>()=>{e(je)})),openAxisTools:useActionCallback((({set:e,reset:t})=>()=>{t(je),e(Ve,!0)})),closeAxisTools:useActionCallback((({reset:e})=>()=>{e(Ve)})),beginInteraction:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(ke);e(ge,!0),await n.beginInteraction()})),endInteraction:useActionCallback((({reset:e,snapshot:t})=>async()=>{const n=await t.getPromise(ke);e(ge),await n.endInteraction()})),updatePlanes:useActionCallback(retainSnapshot((({set:t,snapshot:n})=>async o=>{const a=await n.getPromise(he);if(a.length>0){const l=await n.getPromise(be),s=await n.getPromise(we),i=l<0?-1*s.max:s.min,r=l<0?-1*s.min:s.max,c=a.map((e=>Object.assign(Object.assign({},e),{offset:Math.min(Math.max(o*l,i),r)})));t(he,c),await e()}}))),flipPlanes:useActionCallback((({set:t,snapshot:n})=>async()=>{const o=await n.getPromise(he);t(he,o.map((e=>invert(e)))),await e()})),alignViewToPlane:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(he),n=await e.getPromise(G),o=await(null==n?void 0:n.scene());t.length>0&&null!=o&&await alignToNormal(o.camera(),t[0].normal,o.boundingBox()).render({animation:{milliseconds:Re}})})),updateAxis:useActionCallback(retainSnapshot((({set:t,reset:n,snapshot:a})=>async l=>{const s=await a.getPromise(he),i=await a.getPromise(ye),r=await a.getPromise(fe),c=await a.getPromise(xe),d=await a.getPromise(G),u=await(null==d?void 0:d.scene()),m=i[l],p=null!=m&&s.length>0&&isParallelTo(s[0].normal,m)&&!isNaN(o.Vector3.angleTo(s[0].normal,m));if(null!=u&&!p){const e=await a.tryGetPromise(Me).then((e=>e.value));t(ve,l),t(he,[toAxis(l,i,u.camera(),r,"global"!==c.mode?null==e?void 0:e.position:void 0)])}n(Ve),await e()}))),updateAlignment:useActionCallback((({set:e,reset:o})=>async(l,s)=>{o(je),e(xe,{mode:l,hitPending:"global"!==l&&null==s}),"global"===l?(o(ve),o(ye),await t()):"surface"===l&&null!=s&&(await a(),await n())})),sectionCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const o=await t.getPromise(xe);o.hitPending&&(e(xe,Object.assign(Object.assign({},o),{hitPending:!1})),"surface"===o.mode&&await n())})),cancelCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(xe);n.hitPending&&e(xe,Object.assign(Object.assign({},n),{hitPending:!1}))}))}}var Ne=Object.freeze({__proto__:null,DEFAULT_ALIGN_TO_PLANE_ANIMATION_DURATION_MS:Re,DEFAULT_CROSS_SECTION_HIGHLIGHT_COLOR:oe,DEFAULT_CROSS_SECTION_LINE_THICKNESS_VALUE:1,DEFAULT_END_CAPPING_COLOR:le,DEFAULT_SLIDER_RANGE:se,get EndCapColorType(){return ne},crossSectioningActiveAxis:ve,crossSectioningAdditionalToolsOpen:Se,crossSectioningAlignment:xe,crossSectioningAlignmentToolsOpen:je,crossSectioningAvailableAxes:ye,crossSectioningAxisToolsOpen:Ve,crossSectioningBorderWidth:ce,crossSectioningEnabled:ie,crossSectioningHighlightColor:re,crossSectioningInteractionHandler:ke,crossSectioningIsInteractive:ge,crossSectioningOffsetScalar:be,crossSectioningPlaneDisplayOffset:Ce,crossSectioningPlanes:he,crossSectioningSliderRange:we,crossSectioningTargetBoundingBox:fe,endCapColorType:me,endCapCustomColor:pe,endCapEnabled:ue,endCapEnabledDefault:de,useCrossSectioning:useCrossSectioning,useCrossSectioningActions:useCrossSectioningActions});function useDebouncedCallback(e,t){const[n,o]=a.useState();return a.useEffect((()=>()=>{null!=n&&clearTimeout(n)}),[e,t,n]),a.useCallback((a=>{const handler=()=>{e(a)};null!=n&&clearTimeout(n),o(setTimeout(handler,t))}),[e,t,n])}const VertexColorPicker=t=>{var{onInput:n}=t,o=__rest(t,["onInput"]);const s=useDebouncedCallback((e=>{null==n||n(e)}),500),i=a.useCallback((e=>{const t=e.target;s(t.value)}),[s]);return e.jsx(l.VertexColorPicker,Object.assign({onInput:i},o))},VertexCrossSectionAppearanceColorPicker=({onUpdate:t})=>{const o=useCrossSectioningActions(),[a,l]=n.useRecoilState(re);return e.jsx(VertexColorPicker,{"data-testid":"cross-section-highlight-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:async e=>{l(e),await o.reapply()}})};var Oe={exports:{}},Le;
|
|
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),o=n[0],a=n.slice(1),l=__assign({},o);if(0===a.length)return l;if(1===a.length){var i=a[0];for(var s in i)null==l[s]?l[s]=i[s]:isPlainObject(l[s])&&(l[s]=defaults(l[s],i[s]));return l}return a.reduce((function(e,t){return defaults(e,t)}),o)}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,w=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(w)}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 S=[],V=0;V<256;++V)S.push((V+256).toString(16).substr(1));function stringify(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(S[e[t+0]]+S[e[t+1]]+S[e[t+2]]+S[e[t+3]]+"-"+S[e[t+4]]+S[e[t+5]]+"-"+S[e[t+6]]+S[e[t+7]]+"-"+S[e[t+8]]+S[e[t+9]]+"-"+S[e[t+10]]+S[e[t+11]]+S[e[t+12]]+S[e[t+13]]+S[e[t+14]]+S[e[t+15]]).toLowerCase();if(!validate(n))throw TypeError("Stringified UUID is invalid");return n}function v4(e,t,n){var o=(e=e||{}).random||(e.rng||rng)();return o[6]=15&o[6]|64,o[8]=63&o[8]|128,stringify(o)}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,o="string"==typeof t?BigInt(t):t,a=digits(n>>BigInt(32),BigInt(8)),l=digits(n>>BigInt(16),BigInt(4)),i=digits(n,BigInt(4)),s=digits(o>>BigInt(48),BigInt(4)),r=digits(o,BigInt(12));return"".concat(a,"-").concat(l,"-").concat(i,"-").concat(s,"-").concat(r)}function toMsbLsb(e){var t=__read(e.split("-"),5),n=t[0],o=t[1],a=t[2],l=t[3],i=t[4];if(null==n||null==o||null==a||null==l||null==i)throw new Error("Invalid UUID string ".concat(e));var s=BigInt.asIntN(64,BigInt("0x".concat(n+o+a))),r=BigInt.asIntN(64,BigInt("0x".concat(l+i)));return{msb:s.toString(),lsb:r.toString()}}var j=Object.freeze({__proto__:null,create:create$1,fromMsbLsb:fromMsbLsb,toMsbLsb:toMsbLsb}),k={exports:{}};const T=t;k.exports=pino;const A=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"),M=Symbol("pino.hierarchy"),E={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function appendChildLogger(e,t){const n={logger:t,parent:e[M]};t[M]=n}function setupBaseLogFunctions(e,t,n){const o={};t.forEach((e=>{o[e]=n[e]?n[e]:A[e]||A[E[e]||"log"]||noop})),e[I]=o}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||A;e.browser.write&&(e.browser.asObject=!0);const o=e.serializers||{},a=shouldSerialize(e.browser.serialize,o);let l=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(l=!1);const i=Object.keys(e.customLevels||{}),s=["error","fatal","warn","info","debug","trace"].concat(i);"function"==typeof n&&s.forEach((function(e){n[e]=n})),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");const r=e.level||"info",c=Object.create(n);c.log||(c.log=noop),setupBaseLogFunctions(c,s,n),appendChildLogger({},c),Object.defineProperty(c,"levelVal",{get:getLevelVal}),Object.defineProperty(c,"level",{get:getLevel,set:setLevel});const d={transmit:t,serialize:a,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:s,timestamp:getTimeFunction(e),messageKey:e.messageKey||"msg",onChild:e.onChild||noop};function getLevelVal(){return levelToValue(this.level,this)}function getLevel(){return this._level}function setLevel(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,set(this,d,c,"error"),set(this,d,c,"fatal"),set(this,d,c,"warn"),set(this,d,c,"info"),set(this,d,c,"debug"),set(this,d,c,"trace"),i.forEach((e=>{set(this,d,c,e)}))}function child(n,l,i){if(!l)throw new Error("missing bindings for child Pino");i=i||{},a&&l.serializers&&(i.serializers=l.serializers);const s=i.serializers;if(a&&s){var r=Object.assign({},o,s),c=!0===e.browser.serialize?Object.keys(r):a;delete l.serializers,applySerializers([l],c,r,this._stdErrSerialize)}function Child(e){this._childLevel=1+(0|e._childLevel),this.bindings=l,r&&(this.serializers=r,this._serialize=c),t&&(this._logEvent=createLogEventShape([].concat(e._logEvent.bindings,l)))}Child.prototype=this;const d=new Child(this);return appendChildLogger(this,d),d.child=function(...e){return child.call(this,n,...e)},d.level=i.level||this.level,n.onChild(d),d}return c.levels=getLevels(e),c.level=r,c.isLevelEnabled=function(e){return!!this.levels.values[e]&&this.levels.values[e]>=this.levels.values[this.level]},c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=noop,c.serializers=o,c._serialize=a,c._stdErrSerialize=l,c.child=function(...e){return child.call(this,d,...e)},t&&(c._logEvent=createLogEventShape()),c}function getLevels(e){const t=e.customLevels||{},n=undefined,o=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[M];for(;n.parent;)n=n.parent,n.logger.bindings&&t.push(n.logger.bindings);return t.reverse()}function set(e,t,n,o){if(Object.defineProperty(e,o,{value:levelToValue(e.level,n)>levelToValue(o,n)?noop:n[I][o],writable:!0,enumerable:!0,configurable:!0}),e[o]===noop){if(!t.transmit)return;const a=undefined,l=levelToValue(t.transmit.level||e.level,n),i=undefined;if(levelToValue(o,n)<l)return}e[o]=createWrap(e,t,n,o);const a=getBindingChain(e);0!==a.length&&(e[o]=prependBindingsInArguments(a,e[o]))}function prependBindingsInArguments(e,t){return function(){return t.apply(this,[...e,...arguments])}}function createWrap(e,t,n,o){return a=e[I][o],function LOG(){const l=t.timestamp(),i=new Array(arguments.length),s=Object.getPrototypeOf&&Object.getPrototypeOf(this)===A?A: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?a.call(s,...asObject(this,o,i,l,t)):a.apply(s,i),t.transmit){const a=void 0,s=levelToValue(t.transmit.level||e._level,n),r=levelToValue(o,n);if(r<s)return;transmit(this,{ts:l,methodLevel:o,methodValue:r,transmitValue:n.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:levelToValue(e._level,n)},i,c)}};var a}function asObject(e,t,n,o,a){const{level:l,log:i=e=>e}=a.formatters||{},s=n.slice();let r=s[0];const c={};let d=1+(0|e._childLevel);if(d<1&&(d=1),o&&(c.time=o),l){const n=l(t,e.levels.values[t]);Object.assign(c,n)}else c.level=e.levels.values[t];if(a.asObjectBindingsOnly){if(null!==r&&"object"==typeof r)for(;d--&&"object"==typeof s[0];)Object.assign(c,s.shift());const e=undefined;return[i(c),...s]}{if(null!==r&&"object"==typeof r){for(;d--&&"object"==typeof s[0];)Object.assign(c,s.shift());r=s.length?T(s.shift(),s):void 0}else"string"==typeof r&&(r=T(s.shift(),s));void 0!==r&&(c[a.messageKey]=r);const e=undefined;return[i(c)]}}function applySerializers(e,t,n,o){for(const a in e)if(o&&e[a]instanceof Error)e[a]=pino.stdSerializers.err(e[a]);else if("object"==typeof e[a]&&!Array.isArray(e[a])&&t)for(const o in e[a])t.indexOf(o)>-1&&o in n&&(e[a][o]=n[o](e[a][o]))}function transmit(e,t,n,o=!1){const a=t.send,l=t.ts,i=t.methodLevel,s=t.methodValue,r=t.val,c=e._logEvent.bindings;o||applySerializers(n,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=l,e._logEvent.messages=n.filter((function(e){return-1===c.indexOf(e)})),e._logEvent.level.label=i,e._logEvent.level.value=s,a(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 R;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}),k.exports.default=pino,k.exports.pino=pino;const N=(0,k.exports)({formatters:{level:e=>({level:e})}}),logger_error=(e,t)=>{null!=t?N.error(t,e):N.error(e)},logger_info=(e,t)=>{null!=t?N.info(t,e):N.info(e)},logger_warn=(e,t)=>{null!=t?N.warn(t,e):N.warn(e)},logger_debug=(e,t)=>{null!=t?N.debug(t,e):N.debug(e)};class O{}function useActionCallback(e,t=[]){const o=t instanceof O?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)}})}))),o)}function retainSnapshot(e){return t=>{var{snapshot:n}=t,o=__rest(t,["snapshot"]);return async(...t)=>{const a=n.retain();try{const a=undefined;return await e(Object.assign(Object.assign({},o),{snapshot:n}))(...t)}finally{a()}}}}function createGetPromiseRequiredWrapper(e){return async(t,n)=>{const o=await e.getPromise(t);if(null==o)throw null!=n?n:new Error(`No value present for required value ${t.key}`);return o}}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 L=3e3,_=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:_,LOW_SEVERITY_TOAST_MESSAGE_DURATION_MS:L,MEDIUM_SEVERITY_TOAST_MESSAGE_DURATION_MS:B,applicationMessageBanner:F,applicationMessageToast:D,useApplicationMessageActions:useApplicationMessageActions});const U=500;function useViewerCameraActions(){const e=useApplicationMessageActions();return{flyToById:useActionCallback((({snapshot:e})=>async(t,n)=>{const o=await e.getPromise(G),a=await(null==o?void 0:o.scene());await(null==a?void 0:a.camera().flyTo({itemId:t}).render({animation:{milliseconds:null!=n?n:U}}))})),flyToByBoundingBox:useActionCallback((({snapshot:e})=>async(t,n)=>{const o=await e.getPromise(G),a=await(null==o?void 0:o.scene());await(null==a?void 0:a.camera().flyTo({boundingBox:t}).render({animation:{milliseconds:null!=n?n:U}}))})),updateCameraType:useActionCallback((({set:t,snapshot:n})=>async(a,l)=>{const i=await n.getPromise(J),s=undefined;null!=i&&o.BoundingBox.isValid(i)||!l?t(W,a):e.setToastMessage({type:"error",message:"Cannot change the camera type when no geometry is visible.",duration:B})}))}}const W=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,...o)=>{const a=await e.getPromise(G),l=await(null==a?void 0:a.scene());o.length>0&&await(null==l?void 0:l.items((e=>o.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()),[]),o=a.useCallback((e=>e.where((e=>e.all())).deselect()),[]);return{executeWithCorrelationId:e,execute:useActionCallback((()=>async(t,...n)=>{const o=j.create();await e(t,o,...n)})),selectItemsTransform:t,deselectItemsTransform:n,clearSelectionTransform:o,reset:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(G),o=await(null==n?void 0:n.scene()),a=await e.getPromiseRequired(W);null==o||o.reset({includeCamera:!0,suppliedCorrelationId:t,cameraTypeOverride:a})}))}}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:U,useViewerCameraActions:useViewerCameraActions,useViewerSceneActions:useViewerSceneActions,viewerBaseInteractionHandlerProvider:q,viewerCameraType:W,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(o.Vector3.left(),-e),y=e=>create(o.Vector3.down(),-e),z=e=>create(o.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:o.Vector3.left(),y:o.Vector3.down(),z:o.Vector3.forward()},xAxis=e=>e.x,yAxis=e=>e.y||o.Vector3.create(e.x.z,e.x.x,e.x.y),zAxis=e=>e.z||o.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===o.Vector3.magnitude(o.Vector3.cross(e.normal,t[1])))).map((e=>e[0])).pop(),isNegativeNormal=e=>o.Vector3.dot(o.Vector3.create(-1,-1,-1),e.normal)>0,towardsVector=(e,t)=>{const n=undefined;return o.Vector3.dot(e,t.normal)<0?invert(t):t},towardsCamera=(e,t)=>towardsVector(e.viewVector,t),invert=e=>Object.assign(Object.assign({},e),{normal:o.Vector3.multiply(e.normal,o.Vector3.create(-1,-1,-1)),offset:-e.offset}),fromHit=(e,t)=>{const n=o.Vector3.normalize(e.normal),a=o.Vector3.dot(n,e.position);return towardsCamera(t,create(n,a))},toAxis=(e,t,n,a,l)=>{const i=n.viewAll(),s=getAxis(e,t),r=null!=a&&null!=s?create(s,o.Vector3.dot(s,l||o.BoundingBox.center(a))):forAxis(e,i.lookAt[e]);return towardsCamera(n,r)};function corners(e){return[o.Vector3.create(e.min.x,e.min.y,e.min.z),o.Vector3.create(e.min.x,e.min.y,e.max.z),o.Vector3.create(e.min.x,e.max.y,e.min.z),o.Vector3.create(e.min.x,e.max.y,e.max.z),o.Vector3.create(e.max.x,e.max.y,e.max.z),o.Vector3.create(e.max.x,e.max.y,e.min.z),o.Vector3.create(e.max.x,e.min.y,e.max.z),o.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}var ne;!function(e){e.PART="PART",e.SINGLE="SINGLE"}(ne||(ne={}));const oe="#616161",ae=1,le="#BDBDBD",ie={default:5,min:0,max:10},se=n.atom({key:"crossSectioningEnabled",default:!1}),re=n.atom({key:"crossSectioningHighlightColor",default:oe}),ce=n.atom({key:"crossSectioningBorderWidth",default:1}),de=n.atom({key:"endCapEnabledDefault",default:!1}),ue=n.atom({key:"endCapEnabled",default:!1}),me=n.atom({key:"endCapColorType",default:ne.PART}),pe=n.atom({key:"endCapCustomColor",default:le}),he=n.atom({key:"crossSectioningPlanes",default:[]}),xe=n.atom({key:"crossSectioningAlignment",default:{mode:"global",hitPending:!1}}),fe=n.selector({key:"crossSectioningTargetBoundingBox",get:async({get:e})=>{const t=undefined;return e(J)}}),ge=n.atom({key:"crossSectioningIsInteractive",default:!1}),ve=n.atom({key:"crossSectioningActiveAxis",default:"x"}),ye=n.atom({key:"crossSectioningAvailableAxes",default:te}),be=n.selector({key:"crossSectioningOffsetScalar",get:({get:e})=>{const t=e(he);return t.length>0&&isNegativeNormal(t[0])?-1:1}}),we=n.selector({key:"crossSectioningSliderRange",get:({get:e})=>{const t=e(he),n=e(fe),a=null!=n?corners(n):[];if(t.length>0){const e=a.map((e=>o.Vector3.dot(e,isNegativeNormal(t[0])?o.Vector3.multiply(t[0].normal,o.Vector3.create(-1,-1,-1)):t[0].normal)));return{default:t[0].offset,min:Math.min(...e)-2,max:Math.max(...e)+2}}return ie}}),Ce=n.selector({key:"crossSectioningPlaneDisplayOffset",get:({get:e})=>{const t=e(he),n=e(be),o=e(we);return t.length>0?t[0].offset*n:o.default}}),Se=n.atom({key:"crossSectioningAdditionalToolsOpen",default:!1}),Ve=n.atom({key:"crossSectioningAlignmentToolsOpen",default:!1}),je=n.atom({key:"crossSectioningAxisToolsOpen",default:!1}),ke=n.atom({key:"crossSectioningInteractionHandler",default:new ee,dangerouslyAllowMutability:!0});function useCrossSectioning(e,t){const o=n.useRecoilValue(ke);a.useEffect((()=>{t&&(null==e||e.registerInteractionHandler(o))}),[e,t,o])}const Te=n.atom({key:"hitResultsTapDetails",default:void 0}),Ae=n.atom({key:"hitResultsLongPressDetails",default:void 0}),Pe=n.atom({key:"previousHitResult",default:void 0}),Ie=n.atom({key:"currentHitResult",default:void 0}),Me=n.selector({key:"hitResult",get:async({get:e})=>{var t,n,a,l,i,s,r,c,d;const u=e(Te),m=e(Ae),p=null!=u?u:m,h=e(G),f=await(null==h?void 0:h.scene()),g=null==f?void 0:f.sceneViewId,v=null==f?void 0:f.raycaster();if(null!=p&&null!=v&&null!=g){const e=await v.hitItems(p.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:o.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===(l=null==u?void 0:u.hitNormal)||void 0===l?void 0:l.z)||0),position:o.Vector3.create((null===(i=null==u?void 0:u.hitPoint)||void 0===i?void 0:i.x)||0,(null===(s=null==u?void 0:u.hitPoint)||void 0===s?void 0:s.y)||0,(null===(r=null==u?void 0:u.hitPoint)||void 0===r?void 0:r.z)||0),meta:p.metaKey||p.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})))||[],annotationId:null===(d=null==u?void 0:u.annotationId)||void 0===d?void 0:d.hex}}}}),Ee=n.atom({key:"hitResultsSkipNextTap",default:!1}),alignToNormal=(e,t,n)=>{if(e.toFrameCamera().isPerspective()){const n=o.Vector3.dot(o.Vector3.normalize(e.up),t),a=Math.abs(n)>.98?o.Vector3.normalize(o.Vector3.scale(-n,e.viewVector)):e.up,l=o.Vector3.add(o.Vector3.scale(o.Vector3.distance(e.position,e.lookAt),o.Vector3.multiply(t,o.Vector3.create(-1,-1,-1))),e.lookAt);return e.update({up:a,position:l})}{const a=o.Vector3.angleTo(o.Vector3.normalize(e.viewVector),t),l=null!=n?o.BoundingBox.center(n):e.lookAt,i=o.Vector3.normalize(o.Vector3.cross(o.Vector3.normalize(e.viewVector),t));return e.rotateAroundAxisAtPoint(a,l,i)}};function isParallelTo(e,t){const n=o.Angle.toDegrees(o.Vector3.angleTo(e,t));return 0===n||180===n}const Re=500;function useCrossSectioningActions(){const e=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(ce),n=await e.getPromise(re),o=await e.getPromise(he),a=await e.getPromise(G),l=await(null==a?void 0:a.scene());await(null==l?void 0:l.crossSectioning().update({sectionPlanes:o,highlightColor:n?f.fromHexString(n):void 0,lineWidth:t}))})),t=useActionCallback((({set:t,reset:n,snapshot:o})=>async()=>{const a=await o.getPromise(G),l=await(null==a?void 0:a.scene());if(null!=l){const o=l.camera().viewAll();n(ye),t(he,[towardsCamera(l.camera(),x(o.lookAt.x))]),await e()}})),n=useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async()=>{const o=await t.tryGetPromise(Me).then((e=>e.value)),a=await t.getPromise(G),l=await(null==a?void 0:a.scene());if(null!=o&&null!=l){const t=fromHit(o,l.camera());n(he,null!=t?[t]:[]),n(ye,null!=t?{x:t.normal}:te),await e()}}))),a=useActionCallback((({set:e,snapshot:n})=>async()=>{const o=await n.getPromise(he),a=undefined;await n.getPromise(se)||(e(se,!0),0===o.length&&await t())})),l=useActionCallback((({reset:t,snapshot:n})=>async()=>{const o=undefined;await n.getPromise(se)&&(t(se),t(Se),t(Ve),t(je),t(he),t(xe),t(ve),await e())}));return{enable:a,disable:l,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 a(),e(Se,!0)})),closeAdditionalTools:useActionCallback((({reset:e})=>()=>{e(Se)})),openAlignmentTools:useActionCallback((({set:e,reset:t})=>()=>{t(je),e(Ve,!0)})),closeAlignmentTools:useActionCallback((({reset:e})=>()=>{e(Ve)})),openAxisTools:useActionCallback((({set:e,reset:t})=>()=>{t(Ve),e(je,!0)})),closeAxisTools:useActionCallback((({reset:e})=>()=>{e(je)})),beginInteraction:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(ke);e(ge,!0),await n.beginInteraction()})),endInteraction:useActionCallback((({reset:e,snapshot:t})=>async()=>{const n=await t.getPromise(ke);e(ge),await n.endInteraction()})),updatePlanes:useActionCallback(retainSnapshot((({set:t,snapshot:n})=>async o=>{const a=await n.getPromise(he);if(a.length>0){const l=await n.getPromise(be),i=await n.getPromise(we),s=l<0?-1*i.max:i.min,r=l<0?-1*i.min:i.max,c=a.map((e=>Object.assign(Object.assign({},e),{offset:Math.min(Math.max(o*l,s),r)})));t(he,c),await e()}}))),flipPlanes:useActionCallback((({set:t,snapshot:n})=>async()=>{const o=await n.getPromise(he);t(he,o.map((e=>invert(e)))),await e()})),alignViewToPlane:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(he),n=await e.getPromise(G),o=await(null==n?void 0:n.scene());t.length>0&&null!=o&&await alignToNormal(o.camera(),t[0].normal,o.boundingBox()).render({animation:{milliseconds:Re}})})),updateAxis:useActionCallback(retainSnapshot((({set:t,reset:n,snapshot:a})=>async l=>{const i=await a.getPromise(he),s=await a.getPromise(ye),r=await a.getPromise(fe),c=await a.getPromise(xe),d=await a.getPromise(G),u=await(null==d?void 0:d.scene()),m=s[l],p=null!=m&&i.length>0&&isParallelTo(i[0].normal,m)&&!isNaN(o.Vector3.angleTo(i[0].normal,m));if(null!=u&&!p){const e=await a.tryGetPromise(Me).then((e=>e.value));t(ve,l),t(he,[toAxis(l,s,u.camera(),r,"global"!==c.mode?null==e?void 0:e.position:void 0)])}n(je),await e()}))),updateAlignment:useActionCallback((({set:e,reset:o})=>async(l,i)=>{o(Ve),e(xe,{mode:l,hitPending:"global"!==l&&null==i}),"global"===l?(o(ve),o(ye),await t()):"surface"===l&&null!=i&&(await a(),await n())})),sectionCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const o=await t.getPromise(xe);o.hitPending&&(e(xe,Object.assign(Object.assign({},o),{hitPending:!1})),"surface"===o.mode&&await n())})),cancelCurrentHit:useActionCallback((({set:e,snapshot:t})=>async()=>{const n=await t.getPromise(xe);n.hitPending&&e(xe,Object.assign(Object.assign({},n),{hitPending:!1}))}))}}var Ne=Object.freeze({__proto__:null,DEFAULT_ALIGN_TO_PLANE_ANIMATION_DURATION_MS:Re,DEFAULT_CROSS_SECTION_HIGHLIGHT_COLOR:oe,DEFAULT_CROSS_SECTION_LINE_THICKNESS_VALUE:1,DEFAULT_END_CAPPING_COLOR:le,DEFAULT_SLIDER_RANGE:ie,get EndCapColorType(){return ne},crossSectioningActiveAxis:ve,crossSectioningAdditionalToolsOpen:Se,crossSectioningAlignment:xe,crossSectioningAlignmentToolsOpen:Ve,crossSectioningAvailableAxes:ye,crossSectioningAxisToolsOpen:je,crossSectioningBorderWidth:ce,crossSectioningEnabled:se,crossSectioningHighlightColor:re,crossSectioningInteractionHandler:ke,crossSectioningIsInteractive:ge,crossSectioningOffsetScalar:be,crossSectioningPlaneDisplayOffset:Ce,crossSectioningPlanes:he,crossSectioningSliderRange:we,crossSectioningTargetBoundingBox:fe,endCapColorType:me,endCapCustomColor:pe,endCapEnabled:ue,endCapEnabledDefault:de,useCrossSectioning:useCrossSectioning,useCrossSectioningActions:useCrossSectioningActions});function useDebouncedCallback(e,t){const[n,o]=a.useState();return a.useEffect((()=>()=>{null!=n&&clearTimeout(n)}),[e,t,n]),a.useCallback((a=>{const handler=()=>{e(a)};null!=n&&clearTimeout(n),o(setTimeout(handler,t))}),[e,t,n])}const VertexColorPicker=t=>{var{onInput:n}=t,o=__rest(t,["onInput"]);const i=useDebouncedCallback((e=>{null==n||n(e)}),500),s=a.useCallback((e=>{const t=e.target;i(t.value)}),[i]);return e.jsx(l.VertexColorPicker,Object.assign({onInput:s},o))},VertexCrossSectionAppearanceColorPicker=({onUpdate:t})=>{const o=useCrossSectioningActions(),[a,l]=n.useRecoilState(re);return e.jsx(VertexColorPicker,{"data-testid":"cross-section-highlight-color-picker",value:a,onValueChanged:e=>{null==t||t(e.detail)},onInput:async e=>{l(e),await o.reapply()}})};var Oe={exports:{}},Le;
|
|
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
|
-
*/Le=Oe,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 o in t)e.call(t,o)&&t[o]&&(n=appendClass(n,o));return n}function appendClass(e,t){return t?e?e+" "+t:e+t:e}Le.exports?(classNames.default=classNames,Le.exports=classNames):window.classNames=classNames}();var _e=Oe.exports;const VertexSlider=t=>{var{value:n,defaultValue:o,leftLabel:s,rightLabel:i,onChange:r,onValueChange:c,onValueInput:d}=t,u=__rest(t,["value","defaultValue","leftLabel","rightLabel","onChange","onValueChange","onValueInput"]);const[m,p]=a.useState(o);return e.jsxs("div",{className:"flex w-full items-center gap-2",children:[s&&e.jsx("div",{className:"pl-0.5 text-xs text-center",children:s}),e.jsx(l.VertexSlider,Object.assign({className:_e("w-full",{"mt-0.5":null!=s||null!=i}),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==d||d(e)}},u)),i&&e.jsx("div",{className:"text-xs pr-2 flex-shrink-0 text-right",children:i})]})},VertexCrossSectionAppearanceLineThicknessSlider=({onUpdate:t})=>{const o=useCrossSectioningActions(),[a,l]=n.useRecoilState(ce);return e.jsx(VertexSlider,{id:"cross-section-line-thickness","data-testid":"cross-section-line-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:a,valueLabelDisplay:"auto",onValueInput:async e=>{l(e.detail.value),await o.reapply()},onValueChange:e=>{null==t||t(e.detail.value)}})},VertexEndCapColorOptions=({onUpdateColorType:t})=>{const[o,a]=n.useRecoilState(me);return e.jsx("div",{className:"pl-2 text-sm text-neutral-700",children:e.jsxs(l.VertexRadioGroup,{value:o,"data-testid":"end-capping-color-type-radio-group",name:"end-capping-color-type",onValueChanged:e=>{a(e.detail.toUpperCase()===ne.PART?ne.PART:ne.SINGLE),null==t||t(e.detail)},children:[e.jsx(l.VertexRadio,{"data-testid":"end-capping-color-part-color",label:"Part Color",value:ne.PART}),e.jsx(l.VertexRadio,{"data-testid":"end-capping-color-single-color",label:"Single Color",value:ne.SINGLE})]})})},VertexEndCapColorPicker=({onUpdateCustomColor:t})=>{const[o,a]=n.useRecoilState(pe);return e.jsx(VertexColorPicker,{"data-testid":"end-capping-color-picker",value:o,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})},VertexEndCapToggle=({onEnabledChange:t})=>{const[o,a]=n.useRecoilState(ue);return e.jsx(l.VertexToggle,{className:"flex items-center","data-testid":"end-item-enabled-toggle",variant:"switch",checked:o,onValueChanged:async e=>{a(e.detail),null==t||t(e.detail)}})};function VertexCrossSectionAppearanceControls({onUpdateCrossSectionColor:t,onUpdateCrossSectionLineThickness:o,showEndCapSettings:a,onEndCapEnabledChange:l,onUpdateEndCapColorType:s,onUpdateEndCapCustomColor:i}){const r=n.useRecoilValue(me);return e.jsxs(e.Fragment,{children:[a&&e.jsxs("div",{className:"flex items-center pt-2 pb-2",children:[e.jsx(VertexEndCapToggle,{onEnabledChange:l}),e.jsx("span",{className:"pl-4 text-sm text-neutral-700",children:"Show End Cap"})]}),e.jsx("div",{className:"pt-2 pb-2 text-sm text-neutral-700",children:"Line 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:o}),a&&e.jsxs("div",{children:[e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Cap Color"}),e.jsx(VertexEndCapColorOptions,{onUpdateColorType:s}),r===ne.SINGLE&&e.jsx("div",{className:"mt-2",children:e.jsx(VertexEndCapColorPicker,{onUpdateCustomColor:i})})]})]})}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 o=useCrossSectioningActions(),[a,s]=n.useRecoilState(re),[i,r]=n.useRecoilState(ce),c=n.useRecoilValue(de),[d,u]=n.useRecoilState(ue),[m,p]=n.useRecoilState(me),[h,f]=n.useRecoilState(pe),g=a!==oe||1!==i||d!==c||m!==ne.PART||h!==le;return e.jsx("div",{className:"ml-auto",children:e.jsx(l.VertexTooltip,{content:"Reset Cross Sectioning Appearance",children:e.jsx(l.VertexIconButton,{"data-testid":"cross-section-appearance-reset",iconName:"reset",iconSize:"sm",onClick:async()=>{s(oe),r(1),u(c),p(ne.PART),f(le),null==t||t(),await o.reapply()},disabled:!g})})})};function VertexCrossSectionAppearancePanelSection({onResetCrossSectionAppearance:t,onUpdateCrossSectionColor:n,onUpdateCrossSectionLineThickness:o,onEndCapEnabledChange:a,onUpdateEndCapColorType:l,onUpdateEndCapCustomColor:s}){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:o,onEndCapEnabledChange:a,onUpdateEndCapColorType:l,onUpdateEndCapCustomColor:s})})}const Be=.5,De="#444444",ze=n.atom({key:"featureEdgesSelectedColor",default:De}),Fe=n.atom({key:"featureEdgesLineThickness",default:Be}),VertexFeatureEdgesColorPicker=({onUpdate:t})=>{const[o,a]=n.useRecoilState(ze);return e.jsx(VertexColorPicker,{"data-testid":"feature-edges-color-picker",value:o,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})},VertexFeatureEdgesThicknessSlider=({onUpdate:t})=>{const[o,a]=n.useRecoilState(Fe);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:o,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexFeatureEdgesControls({onUpdateFeatureEdgesColor:t,onUpdateFeatureEdgesThickness:n}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexFeatureEdgesColorPicker,{onUpdate:t}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e.jsx(VertexFeatureEdgesThicknessSlider,{onUpdate:n})]})}const VertexFeatureEdgesReset=({onReset:t})=>{const[o,a]=n.useRecoilState(ze),[s,i]=n.useRecoilState(Fe),r=s!==Be||o!==De;return e.jsx("div",{className:"ml-auto",children:e.jsx(l.VertexTooltip,{content:"Reset Feature Edges",children:e.jsx(l.VertexIconButton,{"data-testid":"feature-edges-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(De),i(Be),null==t||t()},disabled:!r})})})};function VertexFeatureEdgesPanelSection({onResetFeatureEdges:t,onUpdateFeatureEdgesColor:n,onUpdateFeatureEdgesThickness:o}){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:o})})}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 He=n.atom({key:"contextMenuActive",default:void 0}),Ue=n.atom({key:"contextMenuPosition",default:void 0}),We=n.atom({key:"contextMenuTarget",default:void 0}),Ge=n.atom({key:"contextMenuItem",default:void 0}),Ke=n.atom({key:"contextMenuActions",default:[]}),$e=n.selector({key:"contextMenuActivePosition",get:({get:e})=>null!=e(He)?e(Ue):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(Ue,o.Point.create(n,a)),e(We,t.target)}})),pointerUp:useActionCallback((({snapshot:e,set:t})=>async(n,a,l,s)=>{const i=await e.getPromise(Ue),r=await e.getPromise(He);if(null!=i&&null==r){const e=n.clientX,r=null==n?void 0:n.clientY,c=o.Point.create(e,r),d=null!=i?o.Point.distance(i,c):0,u=null==l||l(n);d<2&&u&&(null==s||s(n,null!=i?i:c),t(He,a))}})),contextMenu:useActionCallback((()=>(e,t)=>{(null==t||t(e))&&e.preventDefault()})),longPress:useActionCallback((({set:e})=>(t,n,a,l)=>{if(null==a||a(t)){const a=o.Point.create(t.touches[0].clientX,t.touches[0].clientY);e(Ue,a),e(We,t.target),e(He,n),null==l||l(t,a)}})),setContextMenuItem:useActionCallback((({snapshot:e,set:t,reset:n})=>async o=>{const a=await e.getPromise(Ke);t(Ge,o),a.forEach((e=>e(o))),n(Ke)})),clearActiveContextMenu:useActionCallback((({reset:e,set:t})=>n=>{t(Ee,!!n),e(He),e(Ke),e(Ue)})),clearDismissedState:useActionCallback((({reset:e})=>()=>e(Ee)))}}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 qe=Object.freeze({__proto__:null,contextMenuActions:Ke,contextMenuActive:He,contextMenuActivePosition:$e,contextMenuItem:Ge,contextMenuItemIsElement:contextMenuItemIsElement,contextMenuItemIsRow:contextMenuItemIsRow,contextMenuPosition:Ue,contextMenuTarget:We,targetShouldSkipNextHit:targetShouldSkipNextHit,targetWithinMenu:targetWithinMenu,useContextMenuActions:useContextMenuActions});const Ye=n.atom({key:"boxSelectionEnabled",default:!1}),Xe=n.atom({key:"boxSelectionOperationType",default:"clearAndSelect"}),useBoxSelectionActions=()=>({enable:useActionCallback((({set:e})=>()=>{e(Ye,!0)})),disable:useActionCallback((({reset:e})=>async()=>{e(Ye),e(Xe)})),setOperationType:useActionCallback((({set:e})=>t=>{e(Xe,t)}))});var Ze=Object.freeze({__proto__:null,boxSelectionEnabled:Ye,boxSelectionOperationType:Xe,useBoxSelectionActions:useBoxSelectionActions});async function whenComponentReady(e,t,n=customElements,o=requestAnimationFrame,a=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 o?o(e):a(e))),t())}const Je=n.atom({key:"isEditingPointToPointMeasurement",default:!1}),Qe=n.atom({key:"pointToPointMeasurementOutcome",default:void 0}),et=n.atom({key:"editedPointToPointMeasurement",default:void 0});function usePointToPointMeasurement(e){const t=n.useSetRecoilState(Qe);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 tt=2,nt=n.atom({key:"isEditingPreciseMeasurement",default:!1}),ot=n.atom({key:"preciseMeasurementOutcome",default:void 0}),at=n.atom({key:"preciseMeasurementController",dangerouslyAllowMutability:!0,default:void 0}),lt=n.atom({key:"preciseMeasurementOverlays",dangerouslyAllowMutability:!0,default:void 0}),st=n.atom({key:"preciseMeasurementEntities",dangerouslyAllowMutability:!0,default:[]}),it=n.selector({key:"preciseMeasurementMessage",get:({get:e})=>{const t=undefined;return 0===e(st).length?"Select a surface":void 0}});function usePreciseMeasurementModel(e,t,o){const l=n.useSetRecoilState(st),s=n.useSetRecoilState(ot),i=n.useSetRecoilState(at),r=n.useSetRecoilState(lt),c=n.useRecoilValue(at);a.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{l(e),null==t||t(e)}))})),()=>null==n?void 0:n.dispose()}),[e,l]),a.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onOutcomeChanged((e=>{s(e),null==o||o(e)}))})),()=>null==t?void 0:t.dispose()}),[e,s]),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,(()=>{i(null==e?void 0:e.measurementController)}))}),[e,i]),a.useEffect((()=>{whenComponentReady(e,(()=>{r(null==e?void 0:e.measurementOverlays)}))}),[e,r])}function useMeasurementActions(){const e=useBoxSelectionActions(),t=useEnablePointToPointMeasurement(),n=useDisablePointToPointMeasurement(),o=useDisablePreciseMeasurement(),a=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(at);null==t||t.clearEntities()})),l=useActionCallback((()=>async(e={})=>{await a(),n(e),o()})),s=useActionCallback((({set:e,reset:n})=>async o=>{await l(),"point-to-point"===o?t():(n(ot),n(st),e(nt,!0))}));return{disableEditMeasurement:useActionCallback((()=>async e=>{await l(e)})),enableEditMeasurement:useActionCallback((()=>async e=>{await s(e)})),resetMeasurement:useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(nt),o=await e.getPromise(Je);n?await a():o&&(t(Qe),t(et))})),clearEditedPointToPointMeasurement:useActionCallback((({reset:e})=>()=>{e(et)})),setEditedPointToPointMeasurement:useActionCallback((({set:e})=>t=>{e(et,t)})),toggleEditPointToPointMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(Je)?await l():await s("point-to-point"),e.disable()})),toggleEditPreciseMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(nt)?await l():await s("precise"),e.disable()}))}}function useEnablePointToPointMeasurement(){return useActionCallback((({reset:e,set:t})=>(n={})=>{t(Je,!0),n.keepExistingMeasurement||e(Qe)}))}function useDisablePointToPointMeasurement(){return useActionCallback((({reset:e})=>(t={})=>{e(Je),t.keepExistingMeasurement||(e(et),e(Qe))}))}function useDisablePreciseMeasurement(){return useActionCallback((({reset:e})=>async()=>{e(nt),e(ot),e(st)}))}const rt=n.selector({key:"isEditingMeasurement",get:({get:e})=>e(Je)||e(nt)}),ct=n.selector({key:"measurementPanelModel",get:({get:e})=>e(Qe)||e(ot)}),dt=n.selector({key:"measurementPanelOverlays",dangerouslyAllowMutability:!0,get:({get:e})=>e(lt)}),ut=n.selector({key:"measurementPanelMessage",get:({get:e})=>{const t=undefined;return e(nt)?e(it):void 0}}),mt=n.selector({key:"measurementPanelIsResettable",get:({get:e})=>e(rt)&&null!=e(ct)});var pt=Object.freeze({__proto__:null,editedPointToPointMeasurement:et,isEditingMeasurement:rt,isEditingPointToPointMeasurement:Je,isEditingPreciseMeasurement:nt,measurementPanelIsResettable:mt,measurementPanelMessage:ut,measurementPanelOutcome:ct,measurementPanelOverlays:dt,pointToPointMeasurementOutcome:Qe,preciseMeasurementController:at,preciseMeasurementEntities:st,preciseMeasurementMessage:it,preciseMeasurementOutcome:ot,preciseMeasurementOverlays:lt,useDisablePointToPointMeasurement:useDisablePointToPointMeasurement,useDisablePreciseMeasurement:useDisablePreciseMeasurement,useEnablePointToPointMeasurement:useEnablePointToPointMeasurement,useMeasurementActions:useMeasurementActions,usePointToPointMeasurement:usePointToPointMeasurement,usePreciseMeasurementModel:usePreciseMeasurementModel});const ht="Scene Alteration Performance";var xt;!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"}(xt||(xt={}));var ft=Object.freeze({__proto__:null,SCENE_ALTERATION_PERFORMANCE:ht,get SceneAlterationPerformanceType(){return xt}});const gt=n.atom({key:"fetchedItemInvalidator",default:0}),vt=n.selectorFamily({key:"fetchedItems",get:e=>async({get:t})=>{var n;const o=t(G),a=t(X);if(t(gt),t(en),null!=a)try{return await(null===(n=null==o?void 0:o.sceneItems)||void 0===n?void 0:n.getSceneViewItem(e,a,{includeOverride:!0,includeWorldTransform:!0}))}catch(t){return void logger_debug(`Error encountered get scene view item. [itemId={${e}}]`,t)}}}),yt=n.atomFamily({key:"selectionSelectedItems",default:void 0}),bt=n.atom({key:"selectionSelectedItemIds",default:[]}),wt=n.atom({key:"selectionLastSelected",default:void 0}),Ct=n.atom({key:"selectionLastSelectionFromViewer",default:!1}),St=n.atom({key:"selectionLastSelectWasMultiSelect",default:!1}),jt=n.selector({key:"selectionHasMultipleSelected",get:({get:e})=>{const t=e(wt),n=undefined;return e(bt).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}}),Vt=n.atom({key:"selectionFirstSelectedItemInTreeId",default:void 0}),kt=n.selector({key:"selectionHighestSelectedAncestor",get:({get:e})=>{var t,n;const o=e(wt),a=e(bt);return null!==(n=null===(t=null==o?void 0:o.ancestors)||void 0===t?void 0:t.find((e=>a.includes(e))))&&void 0!==n?n:null==o?void 0:o.id}}),Tt=n.atom({key:"selectionPreviousVisibleSummary",default:void 0}),At=n.atom({key:"selectionVisibleSummary",default:void 0}),Pt=n.selector({key:"selectionVisibleCount",get:({get:e})=>{var t,n;return null!==(n=null===(t=e(At))||void 0===t?void 0:t.count)&&void 0!==n?n:0}}),It=n.selector({key:"selectionBoundingBoxCenter",get:({get:e})=>{const t=e(At);return null!=(null==t?void 0:t.boundingBox)?o.BoundingBox.center(t.boundingBox):o.Vector3.origin()}}),Mt=n.selector({key:"selectionIsActive",get:({get:e})=>{const t=e(bt),n=undefined;return e(Pt)>0||t.length>0}}),Et=n.selector({key:"fetchedAndSelectedItems",get:async({get:e})=>{const t=e(bt),n=undefined;return null!=e(X)?t.map((t=>e(vt(t)))):[]}}),Rt=n.atom({key:"selectionModelViewsSelected",default:void 0});function useSceneViewItemActions(){return{invalidateCachedItems:useActionCallback((({set:e})=>()=>{e(gt,(e=>e+1))}))}}var Nt=Object.freeze({__proto__:null,fetchedItem:vt,fetchedItemInvalidator:gt,useSceneViewItemActions:useSceneViewItemActions});const Ot=n.atom({key:"lengthUnit",default:"cm"}),Lt=n.atom({key:"decimalPlace",default:"2"});var _t=Object.freeze({__proto__:null,decimalPlace:Lt,lengthUnit:Ot}),Bt,Dt;!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"}(Dt||(Dt={}));const convertFrom=(e,t)=>{const n=undefined;return e/Dt[t]},convertTo=(e,t)=>{const n=undefined;return e*Dt[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:s.toWorldTransform(e,t)}:{world:e,local:s.toLocalTransform(e,t)}}function convertTransformToUnits(e,t){const{position:n,rotation:a,scale:l}=e;return{position:o.Vector3.create(convertTo(n.x,t),convertTo(n.y,t),convertTo(n.z,t)),rotation:a,scale:l}}function convertTransformFromUnits(e,t){const{position:n,rotation:a,scale:l}=e;return{position:o.Vector3.create(convertFrom(n.x,t),convertFrom(n.y,t),convertFrom(n.z,t)),rotation:a,scale:l}}function toValidTransform(e){const{position:t,rotation:n,scale:o}=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:o||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)),o=parseFloat(Math.sqrt(e[2]**2+e[6]**2+e[10]**2).toFixed(2));return t===n&&n===o?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 zt={position:o.Vector3.create(0,0,0),rotation:o.Vector3.create(0,0,0),scale:1},Ft=n.atom({key:"transformWidgetEnabled",default:!1}),Ht=n.atom({key:"transformWidgetPosition",default:void 0}),Ut=n.atom({key:"transformWidgetOrientationOverride",default:void 0}),Wt=n.selector({key:"transformWidgetOrientation",get:({get:e})=>{const t=e(Ut),n=e(wt);if(null!=t)return t;if(null!=n){const t=e(Qt(n.id));return o.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})}}}),Gt=n.atom({key:"transformWidgetCachedOrientation",default:void 0}),Kt=n.atom({key:"transformWidgetSyncToSelection",default:!1}),$t=n.atom({key:"transformWidgetIsInteracting",default:!1}),qt=n.atomFamily({key:"appliedItemTransform",default:void 0}),Yt=n.atom({key:"appliedItemTransformIds",default:[]}),Xt=n.atom({key:"selectedCoordinateSpace",default:"world"}),Zt=n.atomFamily({key:"editedItemTransform",default:void 0}),Jt=n.selectorFamily({key:"displayedItemTransform",get:e=>({get:t})=>{if(null!=e){const n=t(Xt),o=t(Ot),a=t(Qt(e)),l=t(Zt(e));if(null!=l)return l.transform;if(null!=a)return pickLocalOrWorldTransform(mapItemTransforms(a,(e=>convertTransformToUnits(e,o))),n)}},set:e=>({get:t,set:o},a)=>{if(null!=e){const l=t(Xt),s=t(tn(e)),i=t(Qt(e)),r=t(Ot);if(null!=i&&!(a instanceof n.DefaultValue)&&null!=a&&null!=s){o(Zt(e),{coordinateSpace:l,units:r,transform:a});const n=makeItemTransforms(convertTransformFromUnits(toValidTransform(a),r),s,l),i=t(Yt);o(qt(e),n),o(Yt,[...i,e])}}}}),Qt=n.selectorFamily({key:"fetchedItemTransforms",get:e=>({get:t})=>{var n,o;const a=t(vt(e));if(null!=a){const e=(null===(n=a.override)||void 0===n?void 0:n.transform)?toTransformFromApiMatrix(null===(o=a.override)||void 0===o?void 0:o.transform):void 0,t=a.worldTransform?toTransformFromApiMatrix(a.worldTransform):void 0;return{local:null!=e?e:zt,world:null!=t?t:zt}}}}),en=n.atom({key:"transformInvalidator",default:0}),tn=n.selectorFamily({key:"parentItemWorldMatrix",get:e=>({get:t})=>{const n=t(X);if(null!=e&&null!=n){const n=t(vt(e));if(null!=(null==n?void 0:n.parentId)){const e=t(Qt(n.parentId)),o=t(qt(n.parentId));if(null==e)throw new Error("Invalid state. Parent item state should be populated, but is undefined.");return null!=o?s.toMatrix(s.toRadiansTransform(o.world)):s.toMatrix(s.toRadiansTransform(e.world))}}return logger_debug(`Unable to find the world matrix for the parent of ${e}. Returning the identity matrix.`),o.Matrix4.makeIdentity()}});function useUpdateEditedTransformWhenSettingsChange(e){const t=n.useRecoilValue(Ot),o=n.useRecoilValue(Xt),l=n.useRecoilValue(qt(null!=e?e:"")),[s,i]=n.useRecoilState(Zt(null!=e?e:""));a.useEffect((()=>{if(null!=l&&((null==s?void 0:s.coordinateSpace)!==o||(null==s?void 0:s.units)!==t)){const e=undefined,n=convertTransformToUnits(pickLocalOrWorldTransform(l,o),t);i({units:t,coordinateSpace:o,transform:n})}}),[t,o])}function useEditItemTransform(e){const t=useTransformActions();useUpdateEditedTransformWhenSettingsChange(e);const o=n.useRecoilValueLoadable(tn(e)),[a,l]=n.useRecoilStateLoadable(Jt(e));return{transform:"hasValue"===a.state?a.contents:void 0,loading:"loading"===a.state||"loading"===o.state,error:"hasError"===a.state?a.contents:void 0,async update(n){t.enableSelectionSync(),l(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(It);e(Ht,n)})),a=useActionCallback((({set:e,snapshot:t})=>async()=>{const o=await t.getPromise(Ht),a=await t.getPromise(St),l=await t.getPromise(bt),s=await t.getPromise(Pt);null==o&&(l.length>0||a||s>0)&&await n(),e(Kt,!0)})),l=useActionCallback((({set:e})=>async t=>{e(Ht,null!=t?t:void 0)})),i=useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async()=>{const o=await e.getPromise(Wt),a=undefined;(await e.getPromise(Yt)).forEach((e=>{n(qt(e)),n(Zt(e))})),n(Yt),null!=o&&t(Gt,o),t(en,(e=>e+1))}))),r=useActionCallback((({set:e,reset:t})=>n=>{t(Gt),e(Ut,n)})),c=useActionCallback((({set:e})=>()=>{e(Ht,void 0),e(Ft,!1)}));return{enableTransformWidget:useActionCallback((({set:t})=>async(o,s)=>{e.setToastMessage({message:"Transform manipulator enabled! Select parts to interact.",duration:L}),t(Ft,!0),s?await n():null==o?await a():await l(o)})),disableTransformWidget:useActionCallback((({reset:e})=>()=>{e(Ft),e(Ut)})),setTransformWidgetOrientation:r,clearTransformWidgetOrientation:useActionCallback((({reset:e})=>()=>{e(Gt),e(Ut)})),setTransformWidgetPosition:l,clearTransformWidgetPosition:useActionCallback((({reset:e})=>()=>e(Ht))),invalidateTransforms:i,setIsInteractivelyTransforming:useActionCallback((({set:e})=>t=>{e($t,t)})),setDefaultWidgetPosition:a,setDefaultWidgetPositionToSelection:n,enableSelectionSync:useActionCallback((({set:e})=>()=>e(Kt,!0))),disableSelectionSync:useActionCallback((({reset:e})=>()=>e(Kt))),syncToSelection:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(Tt),n=await e.getPromise(At),a=undefined;if(await e.getPromise(Kt)){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 l(o.BoundingBox.center(e))}})),orientToHitResult:useActionCallback((({reset:e})=>async t=>{e(Kt),null==(null==t?void 0:t.annotationId)&&(null!=t?await l(null==t?void 0:t.position):(e(Ht),r(void 0)))})),clearSelectedTransforms:useActionCallback((()=>async()=>{await t.execute(xt.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.withSelected())).clearTransforms())),await i(),c()})),clearAllTransforms:useActionCallback((()=>async()=>{await t.execute(xt.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.all())).clearTransforms())),await i(),c()})),applyTransformToItem:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(G),a=await(null==n?void 0:n.scene()),l=await e.getPromise(qt(t));if(null==l)return void logger_warn(`There is no transform to apply to item ${t}.`);const i=o.Matrix4.transpose(s.toMatrix(s.toRadiansTransform(null==l?void 0:l.local)));return null==a?void 0:a.items((e=>e.where((e=>e.withItemId(t))).transform(i))).execute()}))}};var nn=Object.freeze({__proto__:null,appliedItemTransformIds:Yt,appliedItemTransforms:qt,convertTransformFromUnits:convertTransformFromUnits,convertTransformToUnits:convertTransformToUnits,displayedItemTransform:Jt,editedItemTransform:Zt,fetchedItemTransforms:Qt,identityTransform:zt,makeItemTransforms:makeItemTransforms,mapItemTransforms:mapItemTransforms,parentItemWorldMatrix:tn,pickLocalOrWorldTransform:pickLocalOrWorldTransform,selectedCoordinateSpace:Xt,toValidTransform:toValidTransform,transformInvalidator:en,transformWidgetCachedOrientation:Gt,transformWidgetEnabled:Ft,transformWidgetIsInteracting:$t,transformWidgetOrientation:Wt,transformWidgetOrientationOverride:Ut,transformWidgetPosition:Ht,transformWidgetSyncToSelection:Kt,useEditItemTransform:useEditItemTransform,useTransformActions:useTransformActions});const useHitActions=()=>{const e=useCrossSectioningActions(),t=useMeasurementActions(),n=useTransformActions(),o=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const n=await e.tryGetPromise(Me).then((e=>e.value)),o=await e.getPromise(et);null==n&&null!=(null==o?void 0:o.start)&&null!=o.end&&await t.resetMeasurement()}))),a=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(Me).then((e=>e.value));await n.orientToHitResult(t)}))),l=useActionCallback(retainSnapshot((({set:e,snapshot:t})=>async()=>{const n=await t.tryGetPromise(Me).then((e=>e.value));e(Ge,n)}))),s=useActionCallback(retainSnapshot((({snapshot:e,set:t})=>async()=>{t(Ie,await e.tryGetPromise(Me).then((e=>e.value)))})));return{tap:useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async({detail:i},...r)=>{const c=await t.getPromise(rt),d=await t.getPromise(xe),u=2!==(null==i?void 0:i.buttons)&&!(null==i?void 0:i.altKey);i.altKey||i.ctrlKey||i.metaKey||i.shiftKey;const m=u&&!d.hitPending&&!c,p=await t.tryGetPromise(Me).then((e=>e.value));n(Pe,p),n(Te,i),await o(),m&&(r.forEach((e=>e())),await a()),await l(),await e.sectionCurrentHit(),await s()}))),longPress:useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async o=>{n(Te),t(Ae,o.detail),await e.tryGetPromise(Me),await l(),await s()})))}},on=n.selector({key:"viewerToolkitHitState",get:({get:e})=>{const t=undefined,n=undefined,o=undefined,a=undefined,l=undefined;return{tapDetails:e(Te),longPressDetails:e(Ae),previousHitResult:e(Pe),currentHitResult:e(Ie)}}});var an=Object.freeze({__proto__:null,currentHitResult:Ie,hitResult:Me,hitResultsLongPressDetails:Ae,hitResultsSkipNextTap:Ee,hitResultsTapDetails:Te,hitState:on,previousHitResult:Pe,useHitActions:useHitActions});const ln=n.atomFamily({key:"modelViewsCursor",default:void 0}),sn=n.atomFamily({key:"pmiAnnotationsCursor",default:void 0}),rn=n.atomFamily({key:"loadedModelViews",default:[]}),cn=n.atomFamily({key:"loadedPmiAnnotations",default:[]}),dn=n.atomFamily({key:"visiblePmiAnnotations",default:[]}),un=n.selector({key:"modelViewsSceneItemName",get:async({get:e})=>{var t;const n=e(Rt);if(null!=n){const o=e(vt(n.id));return null!==(t=null==o?void 0:o.name)&&void 0!==t?t:void 0}}}),mn=n.atom({key:"loadedItemModelView",default:void 0}),pn=n.selectorFamily({key:"nextModelViews",get:e=>async({get:t})=>{var n;const o=t(G),a=t(ln(e));return await(null===(n=null==o?void 0:o.modelViews)||void 0===n?void 0:n.listByItem(e,{cursor:a,size:100,hasAnnotations:!0}))}}),hn=n.selectorFamily({key:"modelViews",get:e=>({get:t})=>{var n;const o=t(rn(e)),a=t(pn(e));return o.flatMap((e=>e.modelViews)).concat(null!==(n=null==a?void 0:a.modelViews)&&void 0!==n?n:[])}}),xn=n.selectorFamily({key:"hasMoreModelViews",get:e=>({get:t})=>{const n=t(pn(e));return null!=(null==n?void 0:n.paging.next)}}),fn=n.selectorFamily({key:"nextPmiAnnotations",get:e=>async({get:t})=>{var n;const o=t(G),a=t(sn(e));return null===(n=null==o?void 0:o.pmi)||void 0===n?void 0:n.listAnnotations({modelViewId:e,cursor:a,size:100})}}),gn=n.selectorFamily({key:"pmiAnnotations",get:e=>({get:t})=>{const n=undefined;return t(cn(e)).flatMap((e=>e.annotations))}}),vn=n.selectorFamily({key:"hasMorePmiAnnotations",get:e=>({get:t})=>{const n=undefined;return null!=t(sn(e))}}),yn=n.atom({key:"selectedPmiAnnotationId",default:void 0});function useSceneAnnotationsOperations(){const e=a.useCallback((async(e,t,n)=>{const o=await(null==t?void 0:t.scene());null==n?await(null==o?void 0:o.elements((t=>e(t.annotations.where((e=>e.all()))))).execute()):n.length>0&&await(null==o?void 0:o.elements((t=>e(t.annotations.where((e=>e.withAnnotationIds(n)))))).execute())}),[]),t=a.useCallback((async(e,t)=>{const n=await(null==e?void 0:e.scene());null==n||n.elements((e=>[e.annotations.where((e=>e.all())).deselect(),e.annotations.where((e=>e.withAnnotationIds([t]))).select()])).execute()}),[]),n=a.useCallback((async e=>{const t=await(null==e?void 0:e.scene());null==t||t.elements((e=>[e.annotations.where((e=>e.all())).deselect()])).execute()}),[]);return{sceneAnnotationsOperation:e,selectOnlyAnnotation:t,clearAnnotationSelection:n}}function usePmiAnnotationActions(){const e=useSceneAnnotationsOperations(),t=useActionCallback((({snapshot:e,set:t})=>async n=>{var o;const a=await e.getPromise(fn(n));if(null!=a){t(cn(n),(e=>[...e,a])),t(dn(n),(e=>[...e,...a.annotations]));const e=null===(o=null==a?void 0:a.paging)||void 0===o?void 0:o.next;t(sn(n),null!=e?()=>e:()=>{})}}));return{fetchInitialPmiAnnotations:useActionCallback((({snapshot:e})=>async n=>{const o=undefined;0===(await e.getPromise(gn(n))).length&&await t(n)})),fetchNextPmiAnnotations:useActionCallback((()=>async e=>{await t(e)})),selectPmiAnnotation:useActionCallback((({set:t,snapshot:n})=>async o=>{t(yn,o);const a=await n.getPromise(G);null!=a&&await(null==e?void 0:e.selectOnlyAnnotation(a,o))})),clearPmiAnnotationSelection:useActionCallback((({reset:t,snapshot:n})=>async()=>{const o=await n.getPromise(yn),a=await n.getPromise(G);null!=o&&null!=a&&(t(yn),await(null==e?void 0:e.clearAnnotationSelection(a)))}))}}const bn=n.atom({key:"sceneTreeLoaderVisible",default:!1}),wn=n.atom({key:"sceneTreeElement",default:void 0}),Cn=n.atom({key:"sceneTreeController",default:void 0,dangerouslyAllowMutability:!0}),Sn=n.atom({key:"sceneTreeOpenPopover",default:void 0}),jn=n.selectorFamily({key:"sceneTreePopoverIsOpen",get:e=>({get:t})=>t(Sn)===e});function useSceneTreeActions(){const e=useSelectionActions(),t=useViewerCameraActions();return{toggleSelection:useActionCallback((({snapshot:t})=>async(n,o,a)=>{var l,s;if(!n.defaultPrevented&&0===n.button&&(n.altKey||((n.ctrlKey||n.metaKey)&&o.selected?await a.deselectItem(o):o.selected?await a.selectItem(o,{recurseParent:!0}):o.selected||await a.selectItem(o,{append:n.ctrlKey||n.metaKey,range:n.shiftKey})),null!=o.id)){const a=await t.getPromise(wt);e.syncSelection({id:null===(l=o.id)||void 0===l?void 0:l.hex,ancestors:null!==(s=null==a?void 0:a.ancestors)&&void 0!==s?s:[]},{selected:!n.metaKey&&!n.ctrlKey||!o.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 o;const a=await e.getPromise(wn),l=await(null==a?void 0:a.getRowAtClientY(n));null!=(null===(o=null==l?void 0:l.node.id)||void 0===o?void 0:o.hex)&&await t.flyToById(l.node.id.hex)})),flyToFirstSelectedItem:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(wn),n=await e.getPromise(Vt);null!=n&&(null==t||t.scrollToItem(n))})),setContextMenuItem:useActionCallback((({set:e,snapshot:t})=>async n=>{const o=await t.getPromise(wn),a=await(null==o?void 0:o.getRowAtClientY(n));e(Ge,a)})),openSceneTreePopover:useActionCallback((({set:e})=>t=>{e(Sn,t)})),closeSceneTreePopover:useActionCallback((({set:e})=>()=>{e(Sn,void 0)}))}}var Vn=Object.freeze({__proto__:null,sceneTreeController:Cn,sceneTreeElement:wn,sceneTreeLoaderVisible:bn,sceneTreeOpenPopover:Sn,sceneTreePopoverIsOpen:jn,useSceneTreeActions:useSceneTreeActions});function useSelectionActions(){const e=usePmiAnnotationActions(),t=useSceneViewItemActions(),n=useTransformActions(),o=useViewerSceneActions(),a=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(bt)).forEach((e=>t(yt(e))))})),l=useActionCallback((({snapshot:e,reset:t,set:n})=>async(a,l)=>{var s,i;const r=await e.getPromise(yt(a.id)),c=await e.getPromise(bt),d=null===(i=[...null!==(s=a.ancestors)&&void 0!==s?s:[]])||void 0===i?void 0:i.reverse().find((e=>!c.includes(e)));null!=r&&null!=d?(n(yt(d),{id:d}),n(bt,(e=>[...e,d])),await o.execute(xt.SELECTING_ANCESTOR,o.selectItemsTransform(d))):(null==l?void 0:l.clear)?(n(yt(a.id),a),n(bt,[a.id]),await o.execute(xt.SELECTING_ONLY_ITEM,o.clearSelectionTransform,o.selectItemsTransform(a.id))):(n(yt(a.id),a),n(bt,(e=>[...e,a.id])),await o.execute(xt.SELECTING_ITEMS,o.selectItemsTransform(a.id))),m(a),n(wt,a),n(Ct,!0),t(St);try{const t=await e.getPromise(wn);await(null==t?void 0:t.scrollToItem(a.id))}catch(e){logger_debug(`The scene item was not found in the tree. [itemId={${a.id}}]`)}})),s=useActionCallback((({reset:e,set:t})=>async n=>{e(yt(n)),e(St),t(bt,(e=>e.filter((e=>e!==n)))),await o.execute(xt.DESELECTING_ITEMS,o.deselectItemsTransform(n))})),i=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(yt(t.id));null!=n?await s(n.id):await l(t)})),r=useActionCallback((({snapshot:o,reset:a,set:s})=>async(i,r={})=>{const c=await o.getPromise(yt(i.id)),d=await o.getPromise(bt);if(d.filter((e=>{var t;return e!==i.id&&!(null===(t=i.ancestors)||void 0===t?void 0:t.includes(e))})).forEach((e=>a(yt(e)))),a(St),c)if(r.ignoreAncestorSelection)a(bt),a(yt(c.id));else{const e=d.filter((e=>{var t;return e===i.id||(null===(t=i.ancestors)||void 0===t?void 0:t.includes(e))}));s(bt,e)}else a(bt);t.invalidateCachedItems(),n.clearTransformWidgetOrientation(),await e.clearPmiAnnotationSelection(),await l(i,{clear:!0})})),c=useActionCallback((({reset:t})=>async()=>{await a(),t(bt),t(wt),t(Ct),t(St),n.clearTransformWidgetPosition(),n.clearTransformWidgetOrientation(),await e.clearPmiAnnotationSelection()})),d=useActionCallback((()=>async()=>{await c(),await o.execute(xt.CLEAR_SELECTION,o.clearSelectionTransform)})),u=useActionCallback((({set:e})=>async t=>{e(St,t)})),m=useActionCallback((({set:e,snapshot:t})=>async n=>{const o=await t.getPromise(Rt);(null==o?void 0:o.id)!==(null==n?void 0:n.id)&&e(Rt,n)}));return{select:l,toggleSelection:i,clearAndSelect:r,selectCurrentHit:useActionCallback(retainSnapshot((({snapshot:t})=>async()=>{const n=await t.tryGetPromise(Me).then((e=>e.value)),o=await t.getPromise(Te),a=(null==o?void 0:o.metaKey)||(null==o?void 0:o.ctrlKey)||(null==o?void 0:o.shiftKey);null!=(null==n?void 0:n.annotationId)?await e.selectPmiAnnotation(n.annotationId):null==n||a?null!=n&&a?await i(n):await d():await r(n)}))),syncSelection:useActionCallback((({set:e,reset:t})=>async(n,o)=>{o.selected?(await a(),e(yt(n.id),n),o.multiSelect?e(bt,(e=>[...e.filter((e=>e!==n.id)),n.id])):e(bt,[n.id]),await m(n),e(wt,n),e(Ct,!1),e(St,!!o.multiSelect)):(t(yt(n.id)),t(St),e(bt,(e=>e.filter((e=>e!==n.id)))))})),deselect:s,clearSelection:d,resetSelectionState:c,toggleLastSelectWasMultiSelect:u,selectForModelViewsPanel:m}}const kn=n.selector({key:"viewerToolkitSelectionState",get:({get:e})=>{const t=undefined,n=undefined,o=undefined,a=undefined;return{selectedItemIds:e(bt),lastSelected:e(wt),highestSelectedAncestorId:e(kt)}}});var Tn=Object.freeze({__proto__:null,fetchedAndSelectedItems:Et,selectionBoundingBoxCenter:It,selectionFirstSelectedItemInTreeId:Vt,selectionHasMultipleSelected:jt,selectionHighestSelectedAncestor:kt,selectionIsActive:Mt,selectionLastSelectWasMultiSelect:St,selectionLastSelected:wt,selectionLastSelectionFromViewer:Ct,selectionModelViewsSelected:Rt,selectionPreviousVisibleSummary:Tt,selectionSelectedItemIds:bt,selectionSelectedItems:yt,selectionState:kn,selectionVisibleCount:Pt,selectionVisibleSummary:At,useSelectionActions:useSelectionActions});function createColorMaterialWithId(e,t=V.create()){return Object.assign({id:t},s.ColorMaterial.fromHex(e))}const An=255,Pn=18,In=n.atom({key:"sceneItemAdjustmentsSelectedColor",default:void 0}),Mn=n.atom({key:"sceneItemAdjustmentsRecentColors",default:[]}),En=n.atom({key:"sceneItemAdjustmentsCustomColors",default:[createColorMaterialWithId("#ffffff"),createColorMaterialWithId("#616161")]}),Rn=n.atom({key:"sceneItemAdjustmentsSelectedOpacity",default:void 0}),Nn=n.atomFamily({key:"appliedItemMaterialOverride",default:void 0}),On=n.atom({key:"appliedItemMaterialOverrideIds",default:[]}),Ln=n.selector({key:"sceneItemAdjustmentsLastSelectedOverride",get:({get:e})=>{const t=e(wt);if(null!=t)return e(Nn(t.id))}}),_n=n.atom({key:"applyMaterialToAllUserAction",default:void 0}),Bn=n.atom({key:"showConfirmDialogWhenApplyingMaterialToAll",default:!0}),Dn=n.atom({key:"confirmApplyMaterialToAllDialogOpen",default:!1}),useSceneItemMaterialActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(On);t(In),n.forEach((e=>t(Nn(e)))),t(On)}));return{updateColor:useActionCallback((({set:e})=>t=>{e(In,t)})),saveRecentColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const o=await t.getPromise(Mn),a=[n,...o.filter((e=>e!==n))],l=a.length>Pn?a.slice(0,-(a.length-Pn)):a;e(In,n),e(Mn,l)})),removeRecentColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const o=undefined,a=(await t.getPromise(Mn)).filter((e=>e.id!==n));e(Mn,a)})),setCustomColors:useActionCallback((({set:e})=>async t=>{e(En,t)})),saveCustomColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const o=undefined,a=[...await t.getPromise(En),n],l=a.length>Pn?a.slice(a.length-Pn):a;e(In,n),e(En,l)})),removeCustomColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const o=undefined,a=(await t.getPromise(En)).filter((e=>e.id!==n));e(En,a)})),clearCurrentColor:useActionCallback((({reset:e})=>()=>{e(In)})),clearCurrentOpacity:useActionCallback((({reset:e})=>()=>{e(Rn)})),clear:useActionCallback((({snapshot:t,set:n,reset:o})=>async()=>{const a=await t.getPromise(bt);o(In),a.forEach((e=>o(Nn(e)))),n(On,(e=>e.filter((e=>!a.includes(e))))),await e.execute(xt.CLEAR_SELECTED_MATERIAL_OVERRIDES,(e=>e.where((e=>e.withSelected())).clearMaterialOverrides().select()))})),clearAll:useActionCallback((()=>async()=>{await t(),await e.execute(xt.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(Rn,t)})),apply:useActionCallback((({snapshot:t,set:n})=>async()=>{const o=await t.getPromise(In),a=await t.getPromise(Rn),l=await t.getPromise(bt),s=await t.getPromise(Ln),i=null!=o?o:s,r=null!=a?a:null==s?void 0:s.opacity;if(null!=i){const t=Object.assign(Object.assign({},i),{opacity:null!=r?r:i.opacity});await e.execute(xt.APPLY_MATERIAL_OVERRIDE_TO_SELECTION,(e=>e.where((e=>e.withSelected())).materialOverride(t))),l.forEach((e=>n(Nn(e),t))),n(On,(e=>[...e,...l]))}})),confirmApplyAll:useActionCallback((({set:e})=>t=>{e(Dn,!0),e(_n,(()=>t))})),cancelApplyAll:useActionCallback((({reset:e})=>()=>{e(Dn),e(_n)})),applyAll:useActionCallback((({snapshot:t,reset:n})=>async()=>{const o=await t.getPromise(In),a=await t.getPromise(Rn);if(null!=o){const l=await t.getPromise(On),s=Object.assign(Object.assign({},o),{opacity:null!=a?a:o.opacity});await e.execute(xt.APPLY_MATERIAL_OVERRIDE_TO_ALL,(e=>e.where((e=>e.all())).materialOverride(s))),l.forEach((e=>n(Nn(e))));const i=await t.getPromise(_n);null==i||i(s),n(Dn),n(_n)}})),hideConfirmApplyAllDialog:useActionCallback((({set:e})=>()=>{e(Bn,!1)}))}},zn="#ffff00",Fn=35,Hn=1,Un=n.atom({key:"selectionHighlightingSelectedColor",default:zn}),Wn=n.atom({key:"selectionHighlightingSelectedOpacity",default:Fn}),Gn=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 Kn="#FFFFFF",$n=n.atom({key:"viewerBackgroundSelectedColor",default:Kn});var qn=Object.freeze({__proto__:null,DEFAULT_FEATURE_EDGE_COLOR:De,DEFAULT_FEATURE_EDGE_THICKNESS_VALUE:Be,DEFAULT_SELECTION_HIGHLIGHTING_COLOR:zn,DEFAULT_SELECTION_HIGHLIGHTING_LINE_THICKNESS:1,DEFAULT_SELECTION_HIGHLIGHTING_OPACITY:Fn,DEFAULT_VIEWER_BACKGROUND_COLOR:Kn,MAXIMUM_MATERIAL_OVERRIDE_OPACITY:An,MAX_STORED_COLOR_ARRAY_LENGTH:Pn,appliedItemMaterialOverride:Nn,appliedItemMaterialOverrideIds:On,applyMaterialToAllUserAction:_n,confirmApplyMaterialToAllDialogOpen:Dn,elementHasColorAttribute:elementHasColorAttribute,elementIsColorSwatch:elementIsColorSwatch,featureEdgesLineThickness:Fe,featureEdgesSelectedColor:ze,sceneItemAdjustmentsCustomColors:En,sceneItemAdjustmentsLastSelectedOverride:Ln,sceneItemAdjustmentsRecentColors:Mn,sceneItemAdjustmentsSelectedColor:In,sceneItemAdjustmentsSelectedOpacity:Rn,selectionHighlightingSelectedColor:Un,selectionHighlightingSelectedLineThickness:Gn,selectionHighlightingSelectedOpacity:Wn,showConfirmDialogWhenApplyingMaterialToAll:Bn,useSceneItemMaterialActions:useSceneItemMaterialActions,viewerBackgroundSelectedColor:$n});const VertexSceneItemMaterialApplyAll=({onApplyAll:t})=>{const o=useSceneItemMaterialActions(),a=n.useRecoilValueLoadable(Ln),s=n.useRecoilValue(In),i=n.useRecoilValue(Bn),r=u.useMemo((()=>"hasValue"===a.state?null!=s?s:a.contents:s),[a,s]);return e.jsx(l.VertexTooltip,{content:"Apply to All",children:e.jsx(l.VertexIconButton,{iconName:"square-dot-outline",iconSize:"sm",color:"secondary",disabled:null==r,onClick:async()=>{i?o.confirmApplyAll(t):(await o.applyAll(),null==t||t(r))}})})};function SceneItemMaterialApplyAllConfirmationDialog(){const t=useSceneItemMaterialActions(),o=n.useRecoilValue(Dn),[s,i]=a.useState(!1),onCloseDialog=()=>{t.cancelApplyAll(),i(!1)};return o?e.jsxs(l.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(l.VertexToggle,{"data-testid":"hide-confirmation-dialog-in-future-checkbox",variant:"check",className:"pt-0.5",checked:s,onValueChanged:e=>{i(e.detail)}}),"Don't show again this session"]}),e.jsxs("div",{className:"flex ml-auto gap-2",children:[e.jsx(l.VertexButton,{"data-testid":"cancel-apply-material-to-all",onClick:onCloseDialog,children:"Cancel"}),e.jsx(l.VertexButton,{color:"primary","data-testid":"confirm-apply-material-to-all",onClick:async()=>{await t.applyAll(),s&&t.hideConfirmApplyAllDialog()},children:"Apply"})]})]})]}):e.jsx(e.Fragment,{})}const VertexSceneItemMaterialColorPicker=({onApply:t})=>{const o=useSceneItemMaterialActions(),a=n.useRecoilValueLoadable(Ln),l=n.useRecoilValue(In),s=u.useMemo((()=>"hasValue"===a.state?null!=l?l:a.contents:l),[a,l]);return e.jsx(VertexColorPicker,{"data-testid":"selected-item-color-picker",value:null!=s?f.toHexString(s.diffuse):void 0,onValueChanged:async()=>{null!=s&&(await o.apply(),null==t||t(s),await o.saveRecentColor(createColorMaterialWithId(f.toHexString(s.diffuse))))},onInput:async e=>{o.updateColor(createColorMaterialWithId(e)),await o.apply()}})},ColorSwatch=t=>{var{color:n,hideTooltip:o,onClick:a}=t,s=__rest(t,["color","hideTooltip","onClick"]);const i="string"==typeof n?n:f.toHexString(n.diffuse);return e.jsx(l.VertexTooltip,{className:"flex-grow-0",content:i,disabled:!!o,children:e.jsx("button",{onClick:()=>null==a?void 0:a(n),children:e.jsx(l.VertexColorSwatch,Object.assign({"data-testid":`color-swatch-${i}`,variant:"square",color:i},s))})})},VertexSceneItemMaterialColorSwatches=({onAddCustomColor:t,onApplyCustomColor:o,onApplyRecentColor:a})=>{const s=useSceneItemMaterialActions(),i=n.useRecoilValue(En),r=n.useRecoilValue(Mn),c=i.length===Pn;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:[i.map((t=>e.jsx(ColorSwatch,{color:t,onClick:async()=>{s.updateColor(t),await s.apply(),null==o||o(t)},"data-custom-color":!0,"data-color-id":t.id},t.id))),!c&&e.jsx(l.VertexColorPicker,{"data-testid":"appearance-custom-colors-add",variant:"swatch",size:"md",onValueChanged:async e=>{const n=createColorMaterialWithId(e.detail);await s.saveCustomColor(n),await s.apply(),null==t||t(n)},children:e.jsx("div",{slot:"overlay",className:"flex items-center justify-center w-full h-full",children:e.jsx(l.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()=>{s.updateColor(t),await s.apply(),null==a||a(t)},"data-recent-color":!0,"data-color-id":t.id},t.id)))})]})},VertexSceneItemMaterialOpacitySlider=({onApply:t})=>{const o=useSceneItemMaterialActions(),a=n.useRecoilValue(Rn),s=n.useRecoilValueLoadable(Ln),i=u.useMemo((()=>{var e,t;return"hasValue"===s.state?null!==(t=null!=a?a:null===(e=s.contents)||void 0===e?void 0:e.opacity)&&void 0!==t?t:An:null!=a?a:An}),[a,s]),r=useDebouncedCallback((()=>{o.apply()}),500),c=u.useCallback((e=>{o.updateOpacity(e.detail.value),r(e.detail.value)}),[r,o]),d=u.useMemo((()=>"hasValue"!==s.state||null==s.contents),[s]);return e.jsx(l.VertexTooltip,{className:"flex w-full",content:d?"Select a part and apply a color to enable opacity":`${Math.floor(i/An*100)}%`,placement:"top",children:e.jsx(VertexSlider,{"data-testid":"scene-item-adjustments-opacity-slider",leftLabel:"0%",rightLabel:"100%",disabled:d,value:null!=i?i:An,step:5,min:0,max:An,onValueChange:e=>{o.updateOpacity(e.detail.value),o.apply(),null==t||t(e.detail.value)},onValueInput:c})})};function VertexMaterialControls({customColors:t,onApplyMaterial:o,onApplyMaterialToAll:l,onAddCustomColor:s,onApplyCustomColor:i,onApplyRecentColor:r,onApplyOpacity:c}){const d=useSceneItemMaterialActions(),u=n.useRecoilValue(wt);return a.useEffect((()=>{d.clearCurrentColor(),d.clearCurrentOpacity()}),[null==u?void 0:u.id]),a.useEffect((()=>{if(null!=t){const e=t.map((e=>Object.assign(Object.assign({},e),{id:V.create()})));d.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:o}),e.jsx(VertexSceneItemMaterialApplyAll,{onApplyAll:l})]})]}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Color Swatches"}),e.jsx(VertexSceneItemMaterialColorSwatches,{onAddCustomColor:s,onApplyCustomColor:i,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:o})=>{const[s,i]=a.useState(!1);return e.jsx("div",{className:"ml-auto",children:e.jsxs(l.VertexDropdownMenu,{className:"flex items-stretch h-full","data-testid":`reset-button-dropdown-menu-${t}`,placement:"bottom-end",onMenuOpened:()=>i(!0),onMenuClosed:()=>i(!1),children:[e.jsx("div",{slot:"anchor",className:"flex items-center h-full",children:e.jsx(l.VertexTooltip,{content:n,disabled:s,placement:"bottom",children:e.jsxs(l.VertexButton,{className:_e("p-1.5 rounded-md select-none hover:bg-neutral-300 active:bg-neutral-400 cursor-pointer",{"bg-neutral-300":s}),"data-testid":`reset-button-${t}`,variant:"plaintext",children:[e.jsx(l.VertexIcon,{className:"px-0.5",name:"reset",size:"sm"}),e.jsx(l.VertexIcon,{name:"chevron-down",size:"sm"})]})})}),e.jsx("div",{className:"whitespace-nowrap",children:o})]})})},VertexSceneItemMaterialClear=({onClear:t,onClearAll:o})=>{const a=useSceneItemMaterialActions(),s=n.useRecoilValue(Mt);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(l.VertexMenuItem,{"data-testid":"clear-selected-materials",onClick:()=>{a.clear(),null==t||t()},disabled:!s,children:"Clear selected materials"}),e.jsx(l.VertexMenuItem,{"data-testid":"clear-all-materials",onClick:()=>{a.clearAll(),null==o||o()},children:"Clear all materials"})]})})};function VertexMaterialPanelSection({customColors:t,onClearMaterial:n,onClearAllMaterials:o,onApplyMaterial:a,onApplyMaterialToAll:l,onAddCustomColor:s,onApplyCustomColor:i,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:o})]}),children:e.jsx(VertexMaterialControls,{customColors:t,onApplyMaterial:a,onApplyMaterialToAll:l,onAddCustomColor:s,onApplyCustomColor:i,onApplyRecentColor:r,onApplyOpacity:c})})}const VertexSelectionHighlightingColorPicker=({onUpdate:t})=>{const[o,a]=n.useRecoilState(Un);return e.jsx(VertexColorPicker,{"data-testid":"selection-highlighting-color-picker",value:o,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})},VertexSelectionHighlightingLineThicknessSlider=({onUpdate:t})=>{const[o,a]=n.useRecoilState(Gn);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:o,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},VertexSelectionHighlightingOpacitySlider=({onUpdate:t})=>{const[o,a]=n.useRecoilState(Wn);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:o,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexSelectionHighlightingControls({onUpdateSelectionHighlightColor:t,onUpdateSelectionHighlightOpacity:n,onUpdateSelectionHighlightLineThickness:o}){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:o})]})}const VertexSelectionHighlightingReset=({onReset:t})=>{const[o,a]=n.useRecoilState(Un),[s,i]=n.useRecoilState(Wn),[r,c]=n.useRecoilState(Gn),d=o!==zn||s!==Fn||1!==r;return e.jsx("div",{className:"ml-auto",children:e.jsx(l.VertexTooltip,{content:"Reset Selection Highlighting",children:e.jsx(l.VertexIconButton,{"data-testid":"selection-highlighting-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(zn),i(Fn),c(1),null==t||t()},disabled:!d})})})};function VertexSelectionHighlightingPanelSection({onResetSelectionHighlighting:t,onUpdateSelectionHighlightColor:n,onUpdateSelectionHighlightOpacity:o,onUpdateSelectionHighlightLineThickness:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Selection Highlighting",e.jsx(VertexSelectionHighlightingReset,{onReset:t})]}),children:e.jsx(VertexSelectionHighlightingControls,{onUpdateSelectionHighlightColor:n,onUpdateSelectionHighlightOpacity:o,onUpdateSelectionHighlightLineThickness:a})})}const VertexViewerBackgroundColorPicker=({onUpdate:t})=>{const[o,a]=n.useRecoilState($n);return e.jsx(VertexColorPicker,{"data-testid":"viewer-background-color-picker",value:o,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})};function VertexViewerBackgroundControls({onUpdateViewerBackgroundColor:t}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexViewerBackgroundColorPicker,{onUpdate:t})]})}const VertexViewerBackgroundReset=({onReset:t})=>{const[o,a]=n.useRecoilState($n),s=o!==Kn;return e.jsx("div",{className:"ml-auto",children:e.jsx(l.VertexTooltip,{content:"Reset Background Color",children:e.jsx(l.VertexIconButton,{"data-testid":"viewer-background-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(Kn),null==t||t()},disabled:!s})})})};function VertexViewerBackgroundPanelSection({onResetViewerBackgroundColor:t,onUpdateViewerBackgroundColor:n}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Viewer Background",e.jsx(VertexViewerBackgroundReset,{onReset:t})]}),children:e.jsx(VertexViewerBackgroundControls,{onUpdateViewerBackgroundColor:n})})}const isInputElement=e=>{const t=e instanceof HTMLElement&&"VERTEX-AUTO-RESIZE-TEXTAREA"===e.tagName,n=e instanceof HTMLElement&&"VERTEX-TEXTFIELD"===e.tagName,o=e instanceof HTMLElement&&"true"===e.contentEditable,a=e instanceof HTMLElement&&"VERTEX-SCENE-TREE-SEARCH"===e.tagName,l=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement,s=e instanceof HTMLElement&&"VERTEX-VIEWER-PIN-TOOL"===e.tagName,i=e instanceof HTMLElement&&"VERTEX-VIEWER-TRANSFORM-WIDGET"===e.tagName;return t||n||o||a||l||s||i},useRecoilReducer=({reducer:e,atom:t})=>{const o=undefined,a=undefined;return[n.useRecoilValue(t),useRecoilReducerDispatch({reducer:e,atom:t})]},useRecoilReducerDispatch=({reducer:e,atom:t})=>{const o=n.useRecoilCallback((({set:n})=>async o=>{n(t,(t=>e(t,o)))}),[]);return o},Yn=n.atom({key:"keyBindings",default:{applyBindings:[],bindings:{},pressed:{}}});function reducer(e,t){var n,o,a,l;switch(t.type){case"push-key-binding":const s=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!==(o=e.bindings[t.binding.keyBind])&&void 0!==o?o:[],t.binding]})});case"remove-key-binding":const i=undefined;return null==(null===(a=e.bindings[t.binding.keyBind])||void 0===a?void 0:a.find((e=>e.id===t.binding.id)))?e:Object.assign(Object.assign({},e),{bindings:Object.assign(Object.assign({},e.bindings),{[t.binding.keyBind]:(null!==(l=e.bindings[t.binding.keyBind])&&void 0!==l?l:[]).filter((e=>e.id!==t.binding.id))})});case"add-apply-key-binding":return Object.assign(Object.assign({},e),{applyBindings:[...e.applyBindings,t.binding]});case"remove-apply-key-binding":return Object.assign(Object.assign({},e),{applyBindings:e.applyBindings.filter((e=>e.id!==t.id))});case"set-key-pressed":return Object.assign(Object.assign({},e),{applyBindings:e.applyBindings.map((t=>Object.assign(Object.assign({},t),{active:null!=t.keyBind&&allPressed(t.keyBind,e.pressed)}))),pressed:Object.assign(Object.assign({},e.pressed),{[t.key]:t.pressed}),lastPressed:t.pressed?t.key:void 0})}}const useKeyBindingState=()=>useRecoilReducer({reducer:reducer,atom:Yn}),useKeyBindingReadonlyState=()=>n.useRecoilValue(Yn);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 o;return null!=e.keyBind&&null!=n&&(null===(o=e.keyBind)||void 0===o?void 0:o.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 o=V.create();return n({type:"add-apply-key-binding",binding:Object.assign(Object.assign({},e),{id:o,active:null!=e.keyBind&&allPressed(e.keyBind,t.pressed)})}),()=>{n({type:"remove-apply-key-binding",id:o})}}),[e.fn,e.off,e.keyBind,e.repeat])},useStackKeyBinding=(e,t=[])=>{const[,n]=useKeyBindingState();a.useEffect((()=>{const t=null==e.addPredicate||e.addPredicate(),o=null!=e.cancelPredicate&&e.cancelPredicate();t&&n({type:"push-key-binding",binding:e}),o&&n({type:"remove-key-binding",binding:e})}),t)},useKeyBindings=({keydownRepeatInterval:e=25,keydownIgnorePredicate:t=isInputElement}={})=>{const[n,o]=useKeyBindingState(),l=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(),o({type:"remove-key-binding",binding:a}))}))}),[n]);a.useEffect((()=>{const handleKeyDown=e=>{if(!e.repeat&&!t(e.target)){o({type:"set-key-pressed",key:e.key,pressed:!0}),l(e.key);const t=Object.assign(Object.assign({},n.pressed),{[e.key]:!0}),a=matchingSingleFnBindings(n.applyBindings,t,e.key),s=matchingOffBindings(n.applyBindings,t,e.key);(a.length>0||s.length>0)&&e.preventDefault()}},handleKeyUp=e=>{o({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)}}),[l,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(),o=n.useRecoilValue(Ye);return useStackKeyBinding({id:"ExitBoxSelection",keyBind:"Escape",fn:t.disable,addPredicate:()=>o,cancelPredicate:()=>!o},[o]),e.jsx(l.VertexTooltip,{content:"Box Selection",children:e.jsx(l.VertexIconButton,{iconName:"box-cursor",iconColor:o?"primary":"secondary","data-testid":"viewer-toolbar-enable-box-selection-button",onClick:o?t.disable:t.enable})})},Xn=1,VertexResizableContent=t=>{var{className:n,style:o,displayShadow:a,heading:s,id:i,initialScale:r,placement:c="left",children:d,onResize:u}=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(l.VertexResizable,Object.assign({id:i,"data-testid":`resizable-content-position-${c}`,className:_e(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&&a,"border-l min-w-75 max-w-half":"right"===c,"sidebar-shadow-left":"right"===c&&a,"border-t bottom-0 fixed":"top"===c,"min-h-12 sheet":h}),style:Object.assign({maxHeight:"top"===c?window.innerHeight:void 0},o),initialHorizontalScale:p?r:void 0,initialVerticalScale:h?f:void 0,horizontalDirection:getHorizontalResizeDirection(),verticalDirection:getVerticalResizeDirection(),position:"right"===c||"top"===c?"absolute":"relative",onResizeEnd:()=>null==u?void 0:u()},m,{children: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"})}),s,e.jsx("div",{className:_e("w-full flex flex-col h-0 flex-grow",{"right-0":"right"===c}),children:d})]})}))};function useDefaultKeybindings(){useApplyKeyBinding({fn:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(G),n=await(null==t?void 0:t.scene()),o={milliseconds:500};await(null==n?void 0:n.camera().viewAll().render({animation:o}))})),keyBind:"f"})}function useLongPress({target:e,callback:t,delay:n=500,onMovement:a}){const[l,s]=u.useState(),[i,r]=u.useState();u.useEffect((()=>{const handleTouchStart=e=>{const a=e;null!=a.touches&&1===a.touches.length&&(null!=l&&clearTimeout(l),r(o.Point.create(a.touches[0].clientX,a.touches[0].clientY)),s(setTimeout((()=>null==t?void 0:t(a)),n)))},handleTouchMove=e=>{const t=e;null!=t.touches&&t.touches.length>0&&null!=l&&null!=i&&o.Point.distance(i,o.Point.create(t.touches[0].clientX,t.touches[0].clientY))>=2&&(clearTimeout(l),null==a||a())},handleTouchEnd=()=>{null!=l&&clearTimeout(l)};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,l,i])}var Zn=Object.freeze({__proto__:null,isInputElement:isInputElement,keyBindings:Yn,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:o,disableBackdrop:s,openPredicate:i,onOpen:r,onClose:c,children:d})=>{const u=useContextMenuActions(),m=n.useRecoilValue(He),p=n.useRecoilValue($e),h=a.useMemo((()=>["bottom-end","top-start","top-end","right","left"]),[]),f=m===o;useStackKeyBinding({id:"ContextMenu",keyBind:"Escape",fn:u.clearActiveContextMenu,addPredicate:()=>null!=m&&m===o,cancelPredicate:()=>null==m},[m]);const g=a.useMemo((()=>null!=t?t:null!=i?window:void 0),[t,i]);return useLongPress({target:g,callback:e=>u.longPress(e,o,i,r),onMovement:()=>u.clearActiveContextMenu()}),a.useEffect((()=>{const handleWindowPointerDown=e=>{const t=undefined;if(!targetWithinMenu(e)&&2!==e.buttons&&m===o){const t=targetShouldSkipNextHit(e);u.clearActiveContextMenu(t)}};if(s)return window.addEventListener("pointerdown",handleWindowPointerDown),()=>{window.removeEventListener("pointerdown",handleWindowPointerDown)}}),[s,o,m]),a.useEffect((()=>{const handlePointerDown=e=>{u.pointerDown(e)},handlePointerUp=e=>{u.pointerUp(e,o,i,r)},handleContextMenu=e=>u.contextMenu(e,i);return null==g||g.addEventListener("pointerdown",handlePointerDown),null==g||g.addEventListener("pointerup",handlePointerUp),null==g||g.addEventListener("contextmenu",handleContextMenu),()=>{null==g||g.removeEventListener("pointerdown",handlePointerDown),null==g||g.removeEventListener("pointerup",handlePointerUp),null==g||g.removeEventListener("contextmenu",handleContextMenu)}}),[t,o,i]),e.jsx("div",{className:_e({hidden:!f}),children:e.jsx(l.VertexMenu,{"data-testid":`${o}-context-menu`,open:asBooleanAttribute(f),position:p,fallbackPlacements:h,backdrop:!s,onMenuClosed:()=>{u.clearActiveContextMenu(),null==c||c()},children:e.jsx("div",{className:"pt-1",children:d})})})},VertexFitSelectedMenuItem=()=>{const t=n.useRecoilValue(bt),o=n.useRecoilValue(At),a=useViewerCameraActions();return e.jsx(l.VertexMenuItem,{"data-testid":"fit-selected-menu-option",onClick:async()=>{null!=(null==o?void 0:o.boundingBox)&&await a.flyToByBoundingBox(o.boundingBox)},disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.VertexIcon,{slot:"icon",name:"fit-selected",size:"sm"}),"Fit Selected"]})})},VertexFlyToMenuItem=()=>{const t=useViewerCameraActions(),o=n.useRecoilValue(Ge);return e.jsx(l.VertexMenuItem,{"data-testid":"fly-to-part-menu-option",onClick:async()=>{var e;const n=undefined,a=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!=a&&await t.flyToById(a)},disabled:asBooleanAttribute(null==o),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.VertexIcon,{slot:"icon",name:"paper-airplane",size:"sm"}),"Fly To"]})})};function useSceneItemsOperations(){const e=n.useRecoilValue(G),t=undefined,o=undefined,l=undefined,s=undefined,i=undefined,r=undefined;return{sceneItemsOperation:a.useCallback((async(t,n)=>{const o=await(null==e?void 0:e.scene());null==n?await(null==o?void 0:o.items((e=>t(e.where((e=>e.all()))))).execute()):n.length>0&&await(null==o?void 0:o.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.jsx(l.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(l.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide All Parts"]})})},VertexHidePartMenuItem=()=>{const t=n.useRecoilValue(Ge),o=useSceneItemsOperations();return e.jsx(l.VertexMenuItem,{"data-testid":"hide-menu-option",onClick:async()=>{var e;const n=undefined,a=contextMenuItemIsRow(t)?null===(e=null==t?void 0:t.node.id)||void 0===e?void 0:e.hex:t.id;null!=a&&await o.sceneItemsOperation((e=>e.hide()),[a])},disabled:asBooleanAttribute(null==t),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide Part"]})})},VertexHideSelectedMenuItem=()=>{const t=n.useRecoilValue(bt),o=useSceneItemsOperations();return e.jsx(l.VertexMenuItem,{"data-testid":"hide-selected-menu-option",onClick:()=>o.hideSelected(),disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide Selected"]})})},VertexShowAllMenuItem=()=>{const t=useSceneItemsOperations();return e.jsx(l.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(l.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show All Parts"]})})},VertexShowOnlyMenuItem=()=>{const t=n.useRecoilValue(Ge),o=useSceneItemsOperations();return e.jsx(l.VertexMenuItem,{"data-testid":"show-only-menu-option",onClick:async()=>{var e;const n=undefined,a=contextMenuItemIsRow(t)?null===(e=null==t?void 0:t.node.id)||void 0===e?void 0:e.hex:null==t?void 0:t.id;null!=a&&await o.showOnlyItem(a)},disabled:asBooleanAttribute(null==t),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show Only Part"]})})},VertexShowOnlySelectedMenuItem=()=>{const t=n.useRecoilValue(bt),o=useSceneItemsOperations();return e.jsx(l.VertexMenuItem,{"data-testid":"show-only-selected-menu-option",onClick:()=>o.showOnlySelected(),disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show Only Selected"]})})},Jn=n.atom({key:"openedPanelActivePrimaryLeft",default:void 0}),Qn=n.atom({key:"openedPanelActivePrimaryRight",default:void 0}),eo=n.atom({key:"openedPanelActiveSceneTreeSecondary",default:void 0});function usePanelActions(){return{openPrimary:useActionCallback((({set:e})=>(t,n)=>{e("left"===n?Jn:Qn,t)})),closePrimary:useActionCallback((({set:e})=>t=>{e("left"===t?Jn:Qn,void 0)})),openSecondary:useActionCallback((({set:e})=>t=>e(eo,t))),closeSecondary:useActionCallback((({reset:e})=>()=>e(eo)))}}var to=Object.freeze({__proto__:null,openedPanelActivePrimaryLeft:Jn,openedPanelActivePrimaryRight:Qn,openedPanelActiveSceneTreeSecondary:eo,usePanelActions:usePanelActions});const VertexShowPropertiesMenuItem=()=>{const t=usePanelActions(),o=useSelectionActions(),a=n.useRecoilValue(Ge);return e.jsx(l.VertexMenuItem,{"data-testid":"show-properties-menu-option",disabled:asBooleanAttribute(null==a),onClick:()=>{var e;const n=undefined,l=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!=l&&(o.clearAndSelect({id:l}),t.openSecondary("Properties"))},children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.VertexIcon,{slot:"icon",name:"info",size:"sm"}),"Show Properties"]})})};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,o,a;let l="";switch(null==e?void 0:e.type){case"string":l=null!==(t=e.value)&&void 0!==t?t:l;break;case"long":l=null!==(n=e.value.toString())&&void 0!==n?n:l;break;case"double":l=null!==(o=e.value.toString())&&void 0!==o?o:l;break;case"timestamp":l=null!==(a=e.value.seconds.toLocaleString())&&void 0!==a?a:l}return l}const no=n.atom({key:"showMetadataSceneItemProperties",default:!0}),oo=n.selectorFamily({key:"nextMetadataSceneItemProperties",get:e=>async({get:t})=>{var n,o,a;const l=t(G),s=t(lo(e));try{const t=await(null===(n=null==l?void 0:l.sceneItems)||void 0===n?void 0:n.listSceneItemMetadata(e,{cursor:s,size:20})),i=null===(o=null==t?void 0:t.entries)||void 0===o?void 0:o.map((e=>fromApiProperty(e))),r=undefined;return{metadata:null!=i?null===(a=[...i])||void 0===a?void 0:a.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)}}}),ao=n.atomFamily({key:"loadedMetadataSceneItemProperties",default:[]}),lo=n.atomFamily({key:"metadataSceneItemPropertiesCursor",default:void 0}),so=n.selectorFamily({key:"hasMoreMetadataSceneItemProperties",get:e=>({get:t})=>{const n=undefined;return null!=t(lo(e))}}),io=n.atomFamily({key:"isFetchingMetadataSceneItemProperties",default:!1}),ro=n.selector({key:"metadataSceneItemName",get:async({get:e})=>{var t;const n=e(wt);if(null!=n){const o=e(vt(n.id));return null!==(t=null==o?void 0:o.name)&&void 0!==t?t:void 0}}});var co=Object.freeze({__proto__:null,apiMetadataPropertyDisplayValue:apiMetadataPropertyDisplayValue,fromApiProperty:fromApiProperty,hasMoreMetadataSceneItemProperties:so,isFetchingMetadataSceneItemProperties:io,loadedMetadataSceneItemProperties:ao,metadataSceneItemName:ro,metadataSceneItemPropertiesCursor:lo,nextMetadataSceneItemProperties:oo,showMetadataSceneItemProperties:no});const VertexGhostSelectedMenuItem=()=>{const t=n.useRecoilValue(bt),o=useSceneItemsOperations();return e.jsx(l.VertexMenuItem,{"data-testid":"ghost-selected-menu-option",onClick:()=>o.ghostSelected(),disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.VertexIcon,{slot:"icon",name:"visibility-partial",size:"sm"}),"Ghost Selected"]})})};function BetaLabel({children:t,label:n="Beta",placement:o="end",borderColor:a="border-purple-400",textColor:l="text-purple-500"}){return e.jsxs("div",{className:"flex items-center",children:[t,e.jsx("div",{className:_e(`flex border ${a} rounded-md px-1.5 text-xs ${l} uppercase items-center justify-center ml-2 select-none max-h-5`,{"ml-auto":"end"===o}),style:{height:"fit-content"},children:n})]})}const VertexShowModelViewsMenuItem=()=>{const t=usePanelActions(),o=useSelectionActions(),a=n.useRecoilValue(Ge);return e.jsx(l.VertexMenuItem,{"data-testid":"viewer-show-model-views",disabled:asBooleanAttribute(null==a),onClick:async()=>{var e;const n=undefined,l=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!=l&&(t.openPrimary("model-views","right"),o.selectForModelViewsPanel({id:l}))},children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.VertexIcon,{slot:"icon",name:"views",size:"sm"}),e.jsxs("div",{className:"flex gap-2",children:["Show Model Views ",e.jsx(BetaLabel,{})]})]})})},VertexUnghostSelectedMenuItem=()=>{const t=n.useRecoilValue(bt),o=useSceneItemsOperations();return e.jsx(l.VertexMenuItem,{"data-testid":"unghost-selected-menu-option",onClick:()=>o.unGhostSelected(),disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),"Unghost Selected"]})})},DefaultSceneTreeContextMenu=()=>{const t=n.useRecoilValue(no);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(l.VertexMenuDivider,{}),e.jsx(VertexFitSelectedMenuItem,{}),e.jsx(VertexFlyToMenuItem,{}),e.jsx(l.VertexMenuDivider,{}),t&&e.jsx(VertexShowPropertiesMenuItem,{}),e.jsx(VertexShowModelViewsMenuItem,{})]})},VertexSceneTreeContextMenu=({children:t})=>{const o=useSceneTreeActions(),a=n.useRecoilValue(wn),l=null!=t&&!1!==t;return e.jsx(VertexContextMenu,{menuType:"scene-tree",targetElement:a,onOpen:async(e,t)=>{const n=e;await o.setContextMenuItem(n.clientY)},disableBackdrop:!0,children:l?t:e.jsx(DefaultSceneTreeContextMenu,{})})},DefaultViewerContextMenu=()=>{const t=n.useRecoilValue(no);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(l.VertexMenuDivider,{}),e.jsx(VertexFitSelectedMenuItem,{}),e.jsx(VertexFlyToMenuItem,{}),e.jsx(l.VertexMenuDivider,{}),t&&e.jsx(VertexShowPropertiesMenuItem,{}),e.jsx(VertexShowModelViewsMenuItem,{})]})},VertexViewerContextMenu=({children:t})=>{const n=null!=t&&!1!==t,o=a.useCallback((e=>e.target instanceof HTMLElement&&"vertex-viewer"===e.target.id),[]);return e.jsx(VertexContextMenu,{menuType:"viewer",disableBackdrop:!0,openPredicate:o,children:n?t:e.jsx(DefaultViewerContextMenu,{})})},uo=35,mo=n.atom({key:"sceneItemGhostingSelectedOpacity",default:uo}),po=n.atomFamily({key:"appliedItemPhantomState",default:void 0}),ho=n.atom({key:"appliedItemPhantomStateIds",default:[]}),xo=n.selector({key:"sceneItemGhostingLastSelectedPhantom",get:({get:e})=>{var t;const n=e(wt);return null!=n&&(null!==(t=e(po(n.id)))&&void 0!==t&&t)}}),VertexSceneItemGhostingOpacitySlider=({onApply:t})=>{const[o,a]=n.useRecoilState(mo);return e.jsx(VertexSlider,{id:"phantom-opacity","data-testid":"phantom-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:o,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},useSceneItemPhantomActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(ho)).forEach((e=>t(po(e)))),t(ho)}));return{setPhantomState:useActionCallback((({snapshot:t,set:n})=>async o=>{const a=await t.getPromise(bt);a.forEach((e=>n(po(e),o))),n(ho,(e=>[...e,...a])),await e.execute(xt.SET_PHANTOM_SELECTED_ITEMS,(e=>e.where((e=>e.withSelected())).setPhantom(o)))})),clearPhantomState:useActionCallback((({snapshot:t,set:n,reset:o})=>async()=>{const a=await t.getPromise(bt);a.forEach((e=>o(po(e)))),n(ho,(e=>e.filter((e=>!a.includes(e))))),await e.execute(xt.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(xt.CLEAR_PHANTOM_ALL,(e=>e.where((e=>e.all())).clearPhantom()),(e=>e.where((e=>e.withSelected())).select()))})),resetAllPhantomState:t}};var fo=Object.freeze({__proto__:null,DEFAULT_GHOSTING_OPACITY:uo,appliedItemPhantomState:po,appliedItemPhantomStateIds:ho,sceneItemGhostingLastSelectedPhantom:xo,sceneItemGhostingSelectedOpacity:mo,useSceneItemPhantomActions:useSceneItemPhantomActions});const VertexSceneItemGhostingToggle=({onApply:t})=>{const o=useSceneItemPhantomActions(),a=n.useRecoilValue(Mt),s=n.useRecoilValueLoadable(xo);return e.jsx(l.VertexTooltip,{content:"Select a part to display as ghost",disabled:a,children:e.jsx(l.VertexToggle,{className:"flex items-center","data-testid":"phantom-state-toggle",variant:"switch",disabled:!a,checked:"hasValue"===s.state&&s.contents,onValueChanged:async e=>{await o.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:o})=>{const a=useSceneItemPhantomActions(),s=n.useRecoilValue(xo);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(l.VertexMenuItem,{"data-testid":"reset-selected-phantom",onClick:async()=>{await a.clearPhantomState(),null==t||t()},disabled:!s,children:"Clear ghosting for selected"}),e.jsx(l.VertexMenuItem,{"data-testid":"reset-all-phantom",onClick:async()=>{await a.clearAllPhantomState(),null==o||o()},children:"Clear ghosting for all"})]})})};function VertexGhostingPanelSection({onClearGhostState:t,onClearAllGhostState:n,onApplyGhostingChange:o,onApplyOpacity:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Ghosting",e.jsx(VertexSceneItemGhostingClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexGhostingControls,{onApplyGhostingChange:o,onApplyOpacity:a})})}function VertexMeasurementContextMenu({onDelete:t}){const o=n.useRecoilValue(We);return e.jsx(VertexContextMenu,{menuType:"measurement",openPredicate:e=>e.target instanceof HTMLElement&&"VERTEX-VIEWER-MEASUREMENT-DISTANCE"===e.target.tagName,children:e.jsxs(l.VertexMenuItem,{"data-testid":"measurement-delete",onClick:()=>null!=o&&t(o.id),children:[e.jsx(l.VertexIcon,{slot:"icon",name:"delete",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Delete"})]})})}function useDockedPlacement(e,t){const[n,a]=u.useState(o.Point.create(0,0));return u.useLayoutEffect((()=>{if(null!=e){const n=e.getBoundingClientRect(),l=o.Point.create(n.left,n.bottom),s=o.Point.create(n.right,n.bottom);a("left"===t?l:s)}}),[e,t]),n}function VertexMeasurementDetails({placement:t,size:o}){const a=useMeasurementActions(),s=n.useRecoilValue(G),r=n.useRecoilValue(K),c=useDockedPlacement(null!=s?s:null,t),d=n.useRecoilValue(ct),u=n.useRecoilValue(dt),m=n.useRecoilValue(ut),p=n.useRecoilValue(mt),h=n.useRecoilValue(Ot),f=n.useRecoilValue(Lt);return e.jsx(l.VertexDraggablePopover,{className:"z-popover",boundaryPadding:16,boundarySelector:`#${r}`,position:c,children:e.jsxs("div",{className:_e("flex flex-col min-w-40",{"text-xs leading-2":"sm"===o,"text-sm leading-4":"md"===o,"text-base leading-5":"lg"===o,"text-lg leading-5":"xl"===o}),children:[e.jsxs("div",{className:"pb-2 flex justify-between items-center",children:[e.jsx("div",{className:_e("w-full",{"text-sm leading-5":"sm"===o,"text-base leading-5":"md"===o,"text-lg leading-6":"lg"===o,"text-xl leading-7 mr-6":"xl"===o}),children:"Measurement"}),e.jsx("div",{className:_e("mr-0.5",{hidden:!p}),children:e.jsx(l.VertexTooltip,{content:"Reset",placement:"left-start",children:e.jsx(l.VertexIconButton,{"data-testid":"measurement-details-reset",iconName:"reset",iconSize:"sm",onClick:a.resetMeasurement})})})]}),e.jsx(i.VertexViewerMeasurementDetails,{"data-testid":"measurement-details-viewer-measurement-details",className:_e("gap-y-1.5",{hidden:null==d}),measurementOutcome:d,measurementOverlays:u,distanceUnits:toUnitType(h),fractionalDigits:parseInt(f,10)}),e.jsx("div",{"data-testid":"measurement-details-message",className:_e({hidden:null==m}),children:m})]})})}function useCallbackRef(e){var t;const[n,o]=a.useState(null!==(t=null==e?void 0:e.override)&&void 0!==t?t:null),l=a.useCallback((t=>{var n;return o(null!==(n=null==e?void 0:e.override)&&void 0!==n?n:t)}),[]);return{element:n,callback:l}}function VertexPointToPointMeasurement({detailsPlacement:t,detailsSize:o,onPointToPointMeasurementChange:l}){const s=useMeasurementActions(),r=n.useRecoilValue(G),c=n.useRecoilValue(Je),d=n.useRecoilValue(et),u=n.useRecoilValue(Ot),m=n.useRecoilValue(Lt),{callback:p,element:h}=useCallbackRef();usePointToPointMeasurement(h);const f=a.useCallback((e=>{const t={start:e.detail.start,end:e.detail.end,invalid:!e.detail.valid};s.setEditedPointToPointMeasurement(t),null==l||l(t)}),[s]);return c?e.jsxs(e.Fragment,{children:[e.jsx(i.VertexViewerMeasurementDistance,{"data-testid":"point-to-point-measurement",ref:p,viewer:null!=r?r:void 0,mode:"replace",start:null==d?void 0:d.start,end:null==d?void 0:d.end,invalid:null==d?void 0:d.invalid,units:toUnitType(u),fractionalDigits:parseInt(m,10),showAxisReferenceLines:!0,onEditEnd:f}),e.jsx(VertexMeasurementDetails,{placement:t,size:o}),e.jsx(VertexMeasurementContextMenu,{onDelete:s.resetMeasurement})]}):e.jsx(e.Fragment,{})}function VertexPointToPointMeasurementTool(){const t=useMeasurementActions(),o=n.useRecoilValue(Je);return useStackKeyBinding({id:"ExitMeasurement",keyBind:"Escape",fn:t.disableEditMeasurement,addPredicate:()=>o,cancelPredicate:()=>!o},[o,t]),e.jsx(l.VertexTooltip,{content:"Point to Point Measurement",children:e.jsx(l.VertexIconButton,{iconName:"tape-measure","data-testid":"viewer-toolbar-point-to-point-measurement-button",iconColor:o?"primary":"secondary",onClick:t.toggleEditPointToPointMeasurement})})}const go=n.atom({key:"viewerToolkitSdkConfig",default:void 0});var vo=Object.freeze({__proto__:null,sdkConfig:go});const VertexPreciseMeasurement=({detailsPlacement:t,detailsSize:o,onEntitiesChanged:a,onOutcomeChanged:l})=>{var s,r,c,d;const u=n.useRecoilValue(G),m=n.useRecoilValue(go),p=n.useRecoilValue(nt),{callback:h,element:f}=useCallbackRef();return usePreciseMeasurementModel(f,a,l),p?e.jsxs(e.Fragment,{children:[e.jsx(i.VertexViewerMeasurementPrecise,{"data-testid":"precise-measurement-viewer-tool",ref:h,viewer:null!=u?u:void 0,config:JSON.stringify({network:{apiHost:null===(s=null==m?void 0:m.network)||void 0===s?void 0:s.apiHost,renderingHost:null===(r=null==m?void 0:m.network)||void 0===r?void 0:r.renderingHost,sceneTreeHost:null===(c=null==m?void 0:m.network)||void 0===c?void 0:c.sceneTreeHost,sceneViewHost:null===(d=null==m?void 0:m.network)||void 0===d?void 0:d.sceneViewHost}})}),e.jsx(VertexMeasurementDetails,{placement:t,size:o})]}):e.jsx(e.Fragment,{})};function VertexPreciseMeasurementTool(){const t=useMeasurementActions(),o=n.useRecoilValue(nt);return e.jsx(l.VertexTooltip,{content:"Precise Measurement",children:e.jsx(l.VertexIconButton,{iconName:"ruler","data-testid":"viewer-toolbar-precise-measurement-button",iconColor:o?"primary":"secondary",onClick:t.toggleEditPreciseMeasurement})})}function VertexApplicationMessages(){const t=n.useRecoilValue(F),o=n.useRecoilValue(D);return e.jsxs(e.Fragment,{children:[null!=t&&e.jsx(l.VertexBanner,{className:"z-[16000]",duration:t.duration,open:!0,content:t.message,type:t.type},t.id),null!=o&&e.jsx(l.VertexToast,{placement:"bottom-left",className:"z-[16000]",duration:o.duration,open:!0,content:o.message,type:o.type},o.id)]})}const yo={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 bo=n.atom({key:"sceneTreeColumnsRefreshTrigger",default:0}),wo=n.atom({key:"sceneTreeColumnsWhitelistedColumns",default:[]}),Co=n.selector({key:"sceneTreeColumnsAvailableColumns",get:async({get:e})=>{const t=e(Cn);return e(bo),null!=t?await t.fetchMetadataKeys():[]}}),So=n.selector({key:"sceneTreeColumnsAvailableSortedColumns",get:({get:e})=>e(Co).filter((e=>e!==yo.metadataKeyName)).sort(((e,t)=>e.localeCompare(t)))}),jo=n.atom({key:"sceneTreeColumnsVisibleMetadataColumnNames",default:[]}),Vo=n.selector({key:"sceneTreeColumnsActiveColumns",get:({get:e})=>{const t=e(jo),n=e(wn),o=null==n?void 0:n.clientWidth;if(null!=o&&o>0){const e=1/(t.length+1)*o,n=(o-e)/t.length;return t.reduce(((e,t)=>{const o=mapToColumn(t,n);return Object.assign(Object.assign({},e),{[o.label]:o})}),{Name:Object.assign(Object.assign({},yo),{initialWidth:e,minWidth:n})})}return{Name:yo}}}),ko=n.selector({key:"sceneTreeColumnsActiveColumnNames",get:({get:e})=>Object.keys(e(Vo))});function useSceneTreeColumnActions(){return{setActive:useActionCallback((({set:e})=>async t=>{e(jo,t)})),refreshKeyList:useActionCallback((({set:e})=>()=>{e(bo,(e=>e+1))}))}}const To=16,Ao=-8;var Po;function useOpenPositionedPopover({open:e,buttonElement:t,horizontalOffset:n,verticalOffset:o}){const[a,l]=u.useState(),[s,i]=u.useState(),r=undefined;return{position:a,direction:s,handleOpen:u.useCallback((()=>{if(!e){const e=null==t?void 0:t.getBoundingClientRect();if(null!=e){const t=null!=n?n:To,a=null!=o?o:Ao,s=e.x>window.innerWidth/2?Po.LEFT:Po.RIGHT;l({x:s===Po.LEFT?e.left-t:e.right+t,y:e.top+a}),i(s)}}}),[e,t])}}!function(e){e.LEFT="left",e.RIGHT="right"}(Po||(Po={}));var Io=Object.freeze({__proto__:null,DEFAULT_HORIZONTAL_POSITION_OFFSET:To,DEFAULT_NAME_COLUMN:yo,DEFAULT_VERTICAL_POSITION_OFFSET:Ao,get PlacementDirection(){return Po},mapToColumn:mapToColumn,sceneTreeColumnsActiveColumnNames:ko,sceneTreeColumnsActiveColumns:Vo,sceneTreeColumnsAvailableColumns:Co,sceneTreeColumnsAvailableSortedColumns:So,sceneTreeColumnsRefreshTrigger:bo,sceneTreeColumnsVisibleMetadataColumnNames:jo,sceneTreeColumnsWhitelistedColumns:wo,useOpenPositionedPopover:useOpenPositionedPopover,useSceneTreeColumnActions:useSceneTreeColumnActions});const Mo=n.atom({key:"sceneTreeSearchActive",default:!1}),Eo=n.atom({key:"sceneTreeColumnsPartial",default:!1}),Ro=n.atom({key:"sceneTreeSearchValue",default:void 0}),No=n.atom({key:"sceneTreeSearchExactMatch",default:!1}),Oo=n.atom({key:"sceneTreeSearchRemoveHiddenItems",default:!1}),Lo=n.atom({key:"sceneTreeSearchResultCount",default:0}),_o=n.atom({key:"sceneTreeSearchActiveColumns",default:[]}),Bo=n.selector({key:"sceneTreeSearchNameColumnActive",get:({get:e})=>{const t=e(_o);return 0===t.length||t.includes(yo.metadataKeyName)}});function useSceneTreeSearch({sceneTreeElement:e}){const t=useSceneTreeActions(),o=n.useRecoilValue(Mo),l=n.useSetRecoilState(Lo),s=n.useSetRecoilState(Vt);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)&&l(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}));s(null===(n=null==t?void 0:t.node.id)||void 0===n?void 0:n.hex)}else o&&t.flyToFirstSelectedItem()}))})),()=>{null==n||n.dispose()}}}),[e,null==e?void 0:e.controller,open])}function useSceneTreePartialResults({sceneTreeElement:e}){const t=n.useSetRecoilState(Eo);a.useEffect((()=>{let n;return whenComponentReady(e,(()=>{var o;n=null===(o=null==e?void 0:e.controller)||void 0===o?void 0:o.stateChanged((e=>{t(!!(null==e?void 0:e.isPartialKeysResponse))}))})),()=>{null==n||n.dispose()}}),[e])}const useSceneTreeSearchActions=()=>{const e=useActionCallback((({set:e})=>t=>{e(_o,t)})),t=useActionCallback((({snapshot:t})=>async(n,o,a,l)=>{const s=await t.getPromise(wn),i=await t.getPromise(No),r=await t.getPromise(Oo),c=await t.getPromise(_o),d=c.length>0?o?[...c,n]:c.filter((e=>e!==n)):[...a,yo.metadataKeyName].filter((e=>e!==n));e(d),l&&(null==s||s.filterItems(l,{columns:d,exactMatch:i,removeHiddenItems:r}))})),n=useActionCallback((({snapshot:e,set:t})=>async(n,o,a)=>{const l=await e.getPromise(wn),s=await e.getPromise(No),i=await e.getPromise(Oo),r=await e.getPromise(_o),c=n.filter((e=>!o.includes(e))),d=o.filter((e=>!n.includes(e))),u=r.length>0?[...r.filter((e=>!c.includes(e))),...d]:[...o,yo.metadataKeyName],m=u.length>0?u:[...o,yo.metadataKeyName];t(_o,m),a&&(null==l||l.filterItems(a,{columns:m,exactMatch:s,removeHiddenItems:i}))})),o=useActionCallback((({set:e})=>t=>{e(No,t)})),a=useActionCallback((({set:e})=>t=>{e(Oo,t)}));return{setMetadataSearchKeys:e,updateMetadataSearchAfterSearchKeysChange:t,updateMetadataSearchAfterColumnVisibilityChange:n,setMetadataSearchExactMatch:o,setMetadataSearchRemoveHiddenItems:a}};var Do=Object.freeze({__proto__:null,sceneTreeColumnsPartial:Eo,sceneTreeSearchActive:Mo,sceneTreeSearchActiveColumns:_o,sceneTreeSearchExactMatch:No,sceneTreeSearchNameColumnActive:Bo,sceneTreeSearchRemoveHiddenItems:Oo,sceneTreeSearchResultCount:Lo,sceneTreeSearchValue:Ro,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 zo;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===zo.ROBOTO_MONO?"var(--vertex-ui-font-family-monospace)":"var(--vertex-ui-font-family)"}!function(e){e.ROBOTO="ROBOTO",e.ROBOTO_MONO="ROBOTO_MONO"}(zo||(zo={}));const Fo=n.atom({key:"sceneTreeAdditionalMetadataKeys",default:[]}),Ho=n.selector({key:"sceneTreeActiveMetadataKeys",get:({get:e})=>{const t=e(Fo),n=e(jo),o=e(wo),a=new Set([...t,...n]),l=new Set(o);return 0===o.length?Array.from(a):Array.from(a.intersection(l))}});var Uo=Object.freeze({__proto__:null,sceneTreeActiveMetadataKeys:Ho,sceneTreeAdditionalMetadataKeys:Fo});function childrenAsArray(e){return Array.isArray(e)?e:[e]}function filterChildElements(e,t){return childrenAsArray(e).filter((e=>a.isValidElement(e)&&e.type===t))}function findChildElement(e,t){return filterChildElements(e,t)[0]}function cloneChildNodeOrFunction(e,t){return"object"==typeof e?a.cloneElement(e,t):e(t)}function useStateSyncedValue(e,t,{transform:o}={}){const[l,s]=n.useRecoilState(e);return a.useEffect((()=>{null!=t&&s(null!=o?o(t):t)}),[t]),l}const VertexEnterSceneTreeSearchModeButton=({onEnterSearchMode:t})=>{const o=n.useSetRecoilState(Mo);return e.jsx(l.VertexTooltip,{className:"flex ml-auto",content:"Scene Tree Search",children:e.jsx(l.VertexIconButton,{"data-testid":"enter-scene-tree-search-mode-button",iconName:"search",iconSize:"sm",onPointerDown:e=>{e.preventDefault()},onClick:()=>{o(!0),null==t||t()}})})},VertexSceneTreeMetadataCheck=({checked:t,disabled:n,onChange:o,children:a})=>{const s="string"==typeof a?a.replace(" ","-"):"";return e.jsxs("div",{className:"flex items-center",children:[e.jsx(l.VertexToggle,{"data-testid":`scene-tree-metadata-check-${s}`,variant:"check",checked:t,disabled:n,onValueChanged:e=>null==o?void 0:o(e.detail)}),e.jsx("div",{className:"pl-2 py-1 text-[0.875rem] w-full","data-testid":`scene-tree-metadata-name-${s}`,onClick:()=>{n||null==o||o(!t)},children:a})]})},VertexSceneTreeSearchOptionsPopover=({onSearchedSceneTreeColumnsChange:t,onSearchForExactMatchChange:o})=>{const a=useSceneTreeActions(),s=useSceneTreeSearchActions(),i=n.useRecoilValue(wn),r=n.useRecoilValue(Bo),c=n.useRecoilValue(_o),d=n.useRecoilValue(Ro),m=n.useRecoilValue(No),p=n.useRecoilValue(Oo),h=n.useRecoilValue(jo),{element:f,callback:g}=useCallbackRef(),v="scene-tree-search",b=n.useRecoilValue(jn(v)),{position:w,direction:C,handleOpen:S}=useOpenPositionedPopover({open:b,buttonElement:f,horizontalOffset:20}),j=u.useCallback((()=>{a.closeSceneTreePopover()}),[]),V=C===Po.LEFT?"left-end":"right-start",updateSearch=async(e,t)=>{if(d){const n=c.length>0?c:[...h,yo.metadataKeyName];await(null==i?void 0:i.filterItems(d,{columns:n,exactMatch:e,removeHiddenItems:t}))}};return e.jsxs(e.Fragment,{children:[e.jsx(l.VertexTooltip,{content:"Search Options",placement:"top",children:e.jsx(l.VertexIconButton,{"data-testid":"scene-tree-search-options-popover-button",className:"text-neutral-700",ref:g,iconName:"gear",iconSize:"sm",onClick:()=>{b?j():(S(),a.openSceneTreePopover(v))}})}),b&&e.jsx(l.VertexPopover,{"data-testid":"scene-tree-search-options-popover",open:b,backdrop:!1,position:w,resizeBehavior:"fixed",placement:V,className:"z-popover",children:e.jsxs("div",{className:_e("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(l.VertexIconButton,{className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{j()}})]}),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===yo.metadataKeyName)),onChange:async e=>{await s.updateMetadataSearchAfterSearchKeysChange(yo.metadataKeyName,e,h,d),null==t||t()},children:yo.label},yo.metadataKeyName),h.map((n=>e.jsx(VertexSceneTreeMetadataCheck,{checked:c.includes(n),disabled:c.length>0&&c.every((e=>e===n)),onChange:async e=>{await s.updateMetadataSearchAfterSearchKeysChange(n,e,h,d),null==t||t()},children:n},n)))]}),e.jsxs("div",{className:"flex p-3 border-t border-neutral-300",children:[e.jsx(l.VertexToggle,{className:"flex items-center","data-testid":"filter-exact-match-toggle",variant:"switch",checked:m,onValueChanged:async e=>{s.setMetadataSearchExactMatch(e.detail),null==o||o(),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(l.VertexToggle,{className:"flex items-center","data-testid":"filter-remove-hidden-items-toggle",variant:"switch",checked:p,onValueChanged:async e=>{s.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:o,onExitSearchMode:a,onSearchedSceneTreeColumnsChange:s,onSearchForExactMatchChange:r,sceneTreeSearchElement:c,children:d})=>{const m=useSceneTreeActions(),p=n.useRecoilValue(wn),[h,f]=n.useRecoilState(Mo),[g,v]=n.useRecoilState(Ro),b=n.useRecoilValue(jn("scene-tree-search"));useSceneTreeSearch({sceneTreeElement:null!=p?p:null});const{element:w,callback:C}=useCallbackRef({override:c}),S=null==g||""===g;return u.useEffect((()=>{h&&(null==w||w.setFocus())}),[w,h]),e.jsxs("div",{className:"flex w-full py-3 px-2",children:[e.jsx(l.VertexTooltip,{className:"self-center mr-1",content:"Exit Search",children:e.jsx(l.VertexIconButton,{"data-testid":"scene-tree-search-close-button",iconName:"caret-left",iconSize:"sm",onPointerDown:e=>{e.preventDefault()},onClick:async()=>{f(!1),v(void 0),await(null==w?void 0:w.clear()),await(null==p?void 0:p.filterItems("")),b&&m.closeSceneTreePopover(),await m.flyToFirstSelectedItem(),null==a||a()}})}),e.jsxs(i.VertexSceneTreeSearch,{"data-testid":"scene-tree-search-bar",ref:C,controller:null==p?void 0:p.controller,onBlur:()=>{S&&(f(!1),null==a||a(),b&&m.closeSceneTreePopover())},onSearch:()=>{v(null==w?void 0:w.value),null==t||t(null==w?void 0:w.value)},children:[d,e.jsx(l.VertexIcon,{slot:"clear-icon",name:"close-circle-fill",size:"sm",onPointerDown:async()=>{await m.flyToFirstSelectedItem(),null==o||o()}})]}),e.jsx("div",{className:"self-center pl-1",onPointerDown:e=>{e.preventDefault()},children:e.jsx(VertexSceneTreeSearchOptionsPopover,{onSearchedSceneTreeColumnsChange:s,onSearchForExactMatchChange:r})})]})},VertexSceneTreeSearch=({onEnterSearchMode:t,onExitSearchMode:o,onSearch:a,onClearSearch:l,onSearchedSceneTreeColumnsChange:s,onSearchForExactMatchChange:r,children:c})=>{const d=n.useRecoilValue(Mo);return e.jsxs(i.VertexSceneTreeToolbar,{className:"h-11 p-0 border-b border-neutral-300 box-content",slot:"header",children:[d&&e.jsx(VertexSceneTreeSearchBar,{onSearch:a,onClearSearch:l,onExitSearchMode:o,onSearchedSceneTreeColumnsChange:s,onSearchForExactMatchChange:r,children:c}),!d&&e.jsx("div",{className:"ml-auto mr-2",children:e.jsx(VertexEnterSceneTreeSearchModeButton,{onEnterSearchMode:t})})]})};function useCacheableLoadable(e,t){const o=a.useRef(),[l,s]=a.useState(0),i=n.useRecoilValueLoadable(e);a.useEffect((()=>{"hasValue"===i.state&&(o.current=i.contents)}),[t,i]);const[r,c]=a.useMemo((()=>"hasValue"!==i.state&&null!=o.current?[o.current,!0]:"hasValue"===i.state?[i.contents,!1]:[void 0,!1]),[i.state,i.contents,l]),d=a.useCallback((()=>{o.current=void 0,s(l+1)}),[l]),u=undefined;return a.useMemo((()=>({data:r,state:i.state,cached:c,invalidate:d})),[d,r,c,i.state])}const VertexSceneTreeColumnPopover=({onVisibleSceneTreeColumnsChange:t})=>{const o=useSceneTreeActions(),a=useSceneTreeColumnActions(),s=useSceneTreeSearchActions(),r=n.useRecoilValue(wn);useSceneTreePartialResults({sceneTreeElement:null!=r?r:null});const c=n.useRecoilValue(Ro),d=n.useRecoilValue(wo),m=useCacheableLoadable(So),p=d.length>0?d:m.data,h=n.useRecoilValue(jo),f=n.useRecoilValue(Eo),[g,v]=u.useState(h),[b,w]=u.useState(""),{element:C,callback:S}=useCallbackRef(),j="scene-tree-columns",V=n.useRecoilValue(jn(j)),{position:k,direction:T,handleOpen:A}=useOpenPositionedPopover({open:V,buttonElement:C}),P=u.useCallback((()=>{o.closeSceneTreePopover()}),[]),I=T===Po.LEFT?"left-end":"right-start",M=u.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]),E=u.useMemo((()=>M),[V,p]);return e.jsxs(e.Fragment,{children:[e.jsx(l.VertexTooltip,{content:"Configure Columns",placement:"top",children:e.jsx(l.VertexIconButton,{"data-testid":"scene-tree-column-popover-button",ref:S,iconName:"columns-add",iconSize:"sm",onClick:()=>{V?P():(A(),o.openSceneTreePopover(j))}})}),V&&e.jsx(l.VertexPopover,{"data-testid":"scene-tree-column-popover",open:V,backdrop:!1,position:k,resizeBehavior:"fixed",placement:I,className:"z-popover",children:e.jsxs("div",{className:_e("flex flex-col bg-white border border-neutral-300 rounded",{hidden:!V}),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(l.VertexIconButton,{"data-testid":"scene-tree-columns-popover-close-button",className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{w(""),P()}})]}),e.jsx(l.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&&w(t.toLowerCase())}}),f&&e.jsx(i.VertexSceneTreeNotificationBanner,{"data-testid":"partial-key-list-notification-banner",message:"loading"===m.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:yo.label}),E.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(l.VertexButton,{"data-testid":"scene-tree-column-popover-cancel",color:"secondary",onClick:()=>{w(""),P()},children:"Cancel"}),e.jsx(l.VertexButton,{"data-testid":"scene-tree-column-popover-apply",color:"primary",onClick:async()=>{await s.updateMetadataSearchAfterColumnVisibilityChange(h,g,c),await a.setActive(g),null==t||t(g),w(""),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(),o=n.useRecoilValue(wn),a=n.useRecoilValue(Ro),s=n.useRecoilValue(Lo),i=undefined,r=`${s} ${1===s?"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(l.VertexTooltip,{className:"w-auto",content:"Select Results",placement:"top",children:e.jsx(l.VertexButton,{className:"h-6 rounded cursor-pointer","data-testid":"select-search-results-button",color:"secondary",variant:"text",size:"sm",onClick:async()=>{null!=o&&null!=a&&(await o.selectFilteredItems(a),t.toggleLastSelectWasMultiSelect(!0))},children:e.jsxs("div",{className:"flex h-6 items-center gap-1",children:[e.jsx(l.VertexIcon,{size:"sm",name:"check-circle"}),e.jsx("span",{className:"whitespace-nowrap",children:"Select Results"})]})})})]})]})},VertexSceneTreeCollapseAll=()=>{const t=n.useRecoilValue(wn);return e.jsx(l.VertexTooltip,{className:"w-auto",content:"Collapse All",placement:"top",children:e.jsx(l.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(wn);return e.jsx(l.VertexTooltip,{className:"w-auto",content:"Expand All",placement:"top",children:e.jsx(l.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 o=n.useRecoilValue(Ro),a=null==o||""===o;return e.jsx(i.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,{}),!a&&e.jsx(VertexSceneTreeSearchInformationForToolbar,{}),e.jsx("div",{className:"ml-auto",children:e.jsx(VertexSceneTreeColumnPopover,{onVisibleSceneTreeColumnsChange:t})})]})})},VertexSceneTreeHeader=({onEnterSearchMode:t,onExitSearchMode:n,onSearch:o,onClearSearch:a,onVisibleSceneTreeColumnsChange:l,children:s})=>{const i=null!=s&&!1!==s;return e.jsx("div",{slot:"header",className:"flex flex-col",children:i?s:e.jsxs(e.Fragment,{children:[e.jsx(VertexSceneTreeSearch,{onEnterSearchMode:t,onExitSearchMode:n,onSearch:o,onClearSearch:a,children:e.jsx("div",{slot:"clear-icon"})}),e.jsx(VertexSceneTreeToolbar,{onVisibleSceneTreeColumnsChange:l})]})})};function useMetadataActions(){const e=useActionCallback((({snapshot:e,set:t})=>async n=>{const o=undefined;if(await e.getPromise(io(n)))return;t(io(n),!0);const a=await e.getPromise(oo(n));if(null!=(null==a?void 0:a.metadata)){const e=[...a.metadata];t(ao(n),(t=>[...t,...e]))}const l=null==a?void 0:a.cursor;t(lo(n),l),t(io(n),!1)}));return{fetchInitialMetadata:useActionCallback((({snapshot:t})=>async n=>{const o=undefined;0===(await t.getPromise(ao(n))).length&&await e(n)})),fetchNextMetadata:useActionCallback((()=>async t=>{await e(t)}))}}var Wo={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 o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(e,t,n){return t&&defineProperties(e.prototype,t),n&&defineProperties(e,n),e}}(),o=a,l=_interopRequireDefault(o),s,i=_interopRequireDefault(r);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectWithoutProperties(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);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),o=void 0;if(this.props.useWindow){var a=document.documentElement||document.body.parentNode||document.body,l=void 0!==t.pageYOffset?t.pageYOffset:a.scrollTop;o=this.props.isReverse?l:this.calculateOffset(e,l)}else o=this.props.isReverse?n.scrollTop:e.scrollHeight-n.scrollTop-n.clientHeight;o<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,o=t.element,a=t.hasMore;t.initialLoad;var s=t.isReverse,i=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 d=[n];return a&&(i?s?d.unshift(i):d.push(i):this.defaultLoader&&(s?d.unshift(this.defaultLoader):d.push(this.defaultLoader))),l.default.createElement(o,c,d)}}]),InfiniteScroll}(o.Component);c.propTypes={children:i.default.node.isRequired,element:i.default.node,hasMore:i.default.bool,initialLoad:i.default.bool,isReverse:i.default.bool,loader:i.default.node,loadMore:i.default.func.isRequired,pageStart:i.default.number,ref:i.default.func,getScrollParent:i.default.func,threshold:i.default.number,useCapture:i.default.bool,useWindow:i.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}(Wo,Wo.exports);var Go=Wo.exports;const CopyButton=({id:t,textToCopy:n,iconSize:o,disableTooltip:s,onCopyValue:i})=>{const[r,c]=a.useState(!1),d=undefined,u=useDebouncedCallback((()=>{c(!1)}),2e3);return e.jsx(l.VertexTooltip,{className:"h-fit self-center z-[16000]",content:r?"Copied to Clipboard":"Copy",placement:"bottom",disabled:s,children:e.jsx("div",{className:_e({"text-green-700":r}),children:e.jsx(l.VertexIconButton,{className:"ml-auto","data-testid":`${t}-copy-button`,iconName:r?"check":"copy",iconSize:null!=o?o:"xs",onClick:e=>{e.stopPropagation(),e.preventDefault(),null!=n&&(navigator.clipboard.writeText(n),null==i||i(n)),c(!0),u(!0)},style:{"--hover-box-shadow":"none"}})})})};function MetadataPropertyValue({value:t,onCopyMetadataValue:n}){const[o,s]=a.useState(!1),i=""!==t.replace(/^\s*$/,"").trim();return i?e.jsxs("div",{className:"flex w-full border-b border-neutral-300 pl-1 pr-3","data-testid":`${t}-metadata-property`,onMouseEnter:()=>{s(!0)},onMouseLeave:()=>s(!1),children:[e.jsx(l.VertexTooltip,{className:"w-full shrink truncate pr-2 py-1.5",content:t,placement:"bottom-start",children:e.jsx("div",{className:"truncate",children:t})}),o&&e.jsx(CopyButton,{id:t,textToCopy:t,onCopyValue:n})]}):e.jsx("div",{className:_e("overflow-visible border-b border-neutral-300 pl-1 pr-4 py-1.5",{"text-neutral-500":!i}),children:"--"})}const MetadataPanelContents=({sceneItemId:t,onCopyMetadataValue:o})=>{const s=useMetadataActions(),i=n.useRecoilValueLoadable(ro),r=n.useRecoilValue(ao(t)),c=n.useRecoilValue(so(t)),d=n.useRecoilValue(io(t)),u=(null==r?void 0:r.length)>0;function getMessage(){if(!d&&0===(null==r?void 0:r.length)&&"hasValue"===i.state)return"This part does not contain properties"}return a.useEffect((()=>{null!=t&&s.fetchInitialMetadata(t)}),[t]),e.jsxs(e.Fragment,{children:[e.jsx(Go,{initialLoad:!1,hasMore:c,loadMore:async()=>{c&&await s.fetchNextMetadata(t)},useWindow:!1,children:e.jsxs("div",{className:"flex w-full text-xs leading-5 grow-0",children:[e.jsx(l.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(l.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:o},n)))})]})}),!u&&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 o=usePanelActions(),a=n.useRecoilValue(wt),s=n.useRecoilValueLoadable(ro);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"===s.state&&e.jsx("span",{className:"flex flex-col w-full",children:e.jsx(l.VertexTooltip,{content:s.contents,children:e.jsx("div",{className:"truncate",children:s.contents||""})})}),"loading"===s.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(l.VertexIcon,{className:"ml-auto cursor-pointer",onClick:o.closeSecondary,name:"close",size:"sm"})]}),e.jsxs("div",{className:"w-full h-full overflow-y-auto overflow-x-hidden",children:[null!=a&&e.jsx(MetadataPanelContents,{sceneItemId:a.id,onCopyMetadataValue:t}),null==a&&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(l.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:o,expandToggle:l,visibilityToggle:s,isolateButton:r,modelViewsButton:c,initialWidth:d,minWidth:u})=>{const m=n.useRecoilValue(wn);return a.useEffect((()=>{null==m||m.invalidateRows()}),[o]),e.jsxs(i.VertexSceneTreeTableColumn,{"data-testid":`scene-tree-table-column-${t}`,initialWidth:d,minWidth:u,children:[e.jsx("template",{slot:"header",dangerouslySetInnerHTML:{__html:`\n <div class="text-sm text-neutral-800 my-2">\n <div class="${_e("truncate",{"pl-2":l,"pr-2":s})}">\n ${t}\n </div>\n </div>\n `}}),e.jsx("template",{dangerouslySetInnerHTML:{__html:`\n <vertex-scene-tree-table-cell\n prop:value="${o}"\n prop:selection-handler="{{row.data.handleSelection}}"\n prop:expansion-handler="{{row.data.handleExpansion}}"\n prop:visibility-handler="{{row.data.handleVisibility}}"\n ${l?"expand-toggle":""}\n ${s?"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!=o?o:"--"}" \n placement="${s?"right":"top"}">\n <div class="flex items-center w-full">\n <div class="truncate">${o}</div>\n </div>\n </vertex-tooltip>\n\n ${c?'<div attr:style={{row.data.modelViewIndicatorStyle}}> \n <vertex-tooltip class="block w-full truncate" content="Listing Model Views" placement="bottom">\n <vertex-icon-button\n class="ml-auto mr-0.5 text-neutral-800"\n event:pointerup="{{row.data.handleShowModelViews}}"\n icon-name="views"\n icon-size="sm"\n variant="plain"\n >\n </vertex-icon-button>\n </vertex-tooltip>\n </div>':""}\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 o=n.useRecoilValue(Vo),a=n.useRecoilValue(ko),l=[],s=a.filter((e=>e!==yo.label)).map((e=>o[e]));return null!=t?e.jsx(e.Fragment,{children:t({columns:s.map((e=>({key:e.label,initialWidth:e.initialWidth,minWidth:e.minWidth})))})}):e.jsx(e.Fragment,{children:s.map(((t,n)=>{var o;const a=null!==(o=l[n])&&void 0!==o?o:t.initialWidth;return e.jsx(VertexSceneTreeCustomColumn,{label:t.label,visibilityToggle:n===s.length-1,isolateButton:n===s.length-1,rowDataBinding:t.binding,initialWidth:a,minWidth:t.minWidth},t.label)}))})},VertexSceneTreeTableLayout=t=>{var o,l;const{children:s}=t,r=__rest(t,["children"]),c=n.useRecoilValue(Vo),d=n.useRecoilValue(ko),u=[],m=a.useMemo((()=>findChildElement(s,NameColumn)),[s]),p=a.useMemo((()=>findChildElement(s,MetadataColumns)),[s]),h=null!==(o=c[yo.label])&&void 0!==o?o:yo,f=d.filter((e=>e!==yo.label)).map((e=>c[e]));return e.jsxs(i.VertexSceneTreeTableLayout,Object.assign({"data-testid":"scene-tree-table-layout"},r,{children:[m?cloneChildNodeOrFunction(m.props.children,{columnCount:d.length,initialWidth:h.initialWidth,minWidth:h.minWidth}):e.jsx(VertexSceneTreeCustomColumn,{expandToggle:!0,visibilityToggle:1===d.length,isolateButton:1===d.length,rowDataBinding:h.binding,label:h.label,initialWidth:null!==(l=u[0])&&void 0!==l?l: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:o,font:l,backgroundColors:s,additionalLoadedMetadataProperties:r,whitelistedMetadataProperties:c,allowViewingMetadataPropertiesPanel:d,children:u,style:m,onPointerDown:p,onClick:h,onToggleSelection:f,onToggleExpansion:g,onToggleVisibility:v,onCopyMetadataValue:b,className:w,rowData:C}=t,S=__rest(t,["id","font","backgroundColors","additionalLoadedMetadataProperties","whitelistedMetadataProperties","allowViewingMetadataPropertiesPanel","children","style","onPointerDown","onClick","onToggleSelection","onToggleExpansion","onToggleVisibility","onCopyMetadataValue","className","rowData"]);const j=usePanelActions(),V=useSceneTreeActions(),k=useSelectionActions(),T=n.useRecoilValue(go),A=n.useRecoilValue(G),P=n.useRecoilValue(eo),I=n.useRecoilValue(Ho),M=n.useRecoilValue(_o),E=n.useRecoilValue(No),R=n.useRecoilValue(Oo),N=n.useRecoilValue(Ro),O=null==N||""===N,L=useRecoilRef({state:wn}),_=a.useMemo((()=>findChildElement(u,Header)),[u]),B=a.useMemo((()=>findChildElement(u,TableLayout)),[u]),D=a.useMemo((()=>findChildElement(u,ContextMenu)),[u]),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 k.clearSelection(),null==p||p(e)},F=n.useSetRecoilState(Cn),handleFirstRowRendered=e=>{var t;F(e.target.controller),null===(t=null==S?void 0:S.onFirstRowRendered)||void 0===t||t.call(S,e)},H=a.useMemo((()=>({metadataSearchKeys:M,exactMatch:E,removeHiddenItems:R})),[M,E,R]);useStateSyncedValue(wo,c,{transform:e=>e.sort(((e,t)=>e.localeCompare(t)))}),useStateSyncedValue(no,d),useStateSyncedValue(Fo,r);const U=n.useRecoilValue(Rt),W=a.useCallback((e=>{e.preventDefault(),e.stopPropagation(),j.openPrimary("model-views","right")}),[j]);return 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(i.VertexSceneTree,Object.assign({id:null!=o?o:"vertex-scene-tree","data-testid":"vertex-scene-tree",config:T,ref:L,className:_e("flex-1",{filtered:!O}),style:Object.assign(Object.assign(Object.assign({},styleFromOptionalFont(l)),styleFromOptionalBackgroundColors(s)),m),onConnectionError:e=>{logger_error("Scene Tree Connection Error: ",e.detail)},viewer:A,onPointerDown:handlePointerDown,onClick:handleClick,rowData:e=>{var t,n;const o=null!==(t=null==C?void 0:C(e))&&void 0!==t?t:{};return Object.assign({handleExpansion:wrappedExpansionHandler,handleSelection:wrappedSelectionHandler,handleVisibility:wrappedVisibilityHandler,handleShowModelViews:W,modelViewIndicatorStyle:(null===(n=null==e?void 0:e.node.id)||void 0===n?void 0:n.hex)===(null==U?void 0:U.id)?"display: flex;":"display: none;"},o)},searchOptions:H,metadataKeys:I},S,{onFirstRowRendered:handleFirstRowRendered,children:[null!=_?_:e.jsx(VertexSceneTreeHeader,{}),null!=B?B:e.jsx(VertexSceneTreeTableLayout,{}),null!=D?D:e.jsx(VertexSceneTreeContextMenu,{})]}))}),void 0!==P&&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[o,a]=n.useRecoilState(Lt);return e.jsxs(l.VertexSelect,{"data-testid":"decimal-place-select",className:"w-24",value:o,onOptionChanged:e=>{a(e.detail),null==t||t(e.detail)},children:[e.jsx("div",{className:"py-1.5 px-3",children:"0"}),e.jsx("div",{className:"py-1.5 px-3",children:"1"}),e.jsx("div",{className:"py-1.5 px-3",children:"2"}),e.jsx("div",{className:"py-1.5 px-3",children:"3"})]})},VertexLengthUnitSelector=({onApply:t})=>{const[o,a]=n.useRecoilState(Ot);return e.jsxs(l.VertexSelect,{"data-testid":"length-unit-select",className:"w-40",value:o,onOptionChanged:e=>{a(e.detail),null==t||t(e.detail)},children:[e.jsx("div",{"data-value":"cm",className:"py-1.5 px-3",children:"centimeters"}),e.jsx("div",{"data-value":"mm",className:"py-1.5 px-3",children:"millimeters"}),e.jsx("div",{"data-value":"m",className:"py-1.5 px-3",children:"meters"}),e.jsx("div",{"data-value":"in",className:"py-1.5 px-3",children:"inches"}),e.jsx("div",{"data-value":"ft",className:"py-1.5 px-3",children:"feet"})]})};function VertexUnitsControls({onUnitChange:t,onDecimalPlaceChange:n}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Length Unit"}),e.jsx(VertexLengthUnitSelector,{onApply:t})]}),e.jsxs("div",{children:[e.jsx("div",{className:"pt-2 pb-2 text-sm text-neutral-700",children:"Decimals"}),e.jsx(VertexDecimalPlaceSelector,{onApply:n})]})]})}function VertexUnitsPanelSection({onUnitChange:t,onDecimalPlaceChange:n}){return e.jsx(PanelSection,{header:e.jsx("div",{className:"flex items-center text-base",children:"Units"}),children:e.jsx(VertexUnitsControls,{onUnitChange:t,onDecimalPlaceChange:n})})}function useModelViewActions(){const e=usePmiAnnotationActions(),t=useSelectionActions();return{fetchNextModelViews:useActionCallback((({snapshot:e,set:t})=>async n=>{var o;const a=await e.getPromise(pn(n));if(null!=a){const e=null===(o=null==a?void 0:a.paging)||void 0===o?void 0:o.next;null!=e&&(t(rn(n),(e=>[...e,a])),t(ln(n),(()=>e)))}})),loadModelView:useActionCallback((({set:n,snapshot:o})=>async(a,l)=>{var s;const i=await o.getPromiseRequired(G),r=await o.getPromiseRequired(bt);try{await(null===(s=null==i?void 0:i.modelViews)||void 0===s?void 0:s.load(a,l.id)),n(mn,{itemId:a,modelView:l}),0!==r.length&&await t.clearSelection(),await e.fetchInitialPmiAnnotations(l.id)}catch(e){logger_error("Failed to load model view",e)}})),clearModelView:useActionCallback((({reset:t,snapshot:n})=>async()=>{var o;const a=undefined;if(null!=await n.getPromise(mn)){const a=await n.getPromiseRequired(G);try{await(null===(o=null==a?void 0:a.modelViews)||void 0===o?void 0:o.unload()),t(mn),await e.clearPmiAnnotationSelection()}catch(e){logger_error("Failed to remove model view",e)}}}))}}var Ko=Object.freeze({__proto__:null,hasMoreModelViews:xn,hasMorePmiAnnotations:vn,loadedItemModelView:mn,loadedModelViews:rn,loadedPmiAnnotations:cn,modelViews:hn,modelViewsCursor:ln,modelViewsSceneItemName:un,nextModelViews:pn,nextPmiAnnotations:fn,pmiAnnotations:gn,pmiAnnotationsCursor:sn,selectedPmiAnnotationId:yn,useModelViewActions:useModelViewActions,visiblePmiAnnotations:dn});function FileWithMagnifyingGlassImage(){return e.jsx("div",{children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"160",height:"160",viewBox:"0 0 220 220",children:[e.jsx("path",{fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":".75",d:"M38.84 186.31h143.29m-155.07 5.14h176.49M1 196.58h218m-205.11 5.14h185.22m-162.74 5.13h141.84"}),e.jsx("path",{fill:"#f7fcfd",d:"m150.94 50.25 20.43 19.51a3.42 3.42 0 0 1 1 2.46v121.2a5.23 5.23 0 0 1-5.23 5.23H52.78a5.23 5.23 0 0 1-5.23-5.23V54.56a5.24 5.24 0 0 1 5.23-5.24h95.81a3.44 3.44 0 0 1 2.35.93"}),e.jsx("path",{fill:"none",stroke:"#006bad","stroke-dasharray":"3 3","stroke-linecap":"round","stroke-linejoin":"round",d:"m150.94 50.25 20.43 19.51a3.42 3.42 0 0 1 1 2.46v121.2a5.23 5.23 0 0 1-5.23 5.23H52.78a5.23 5.23 0 0 1-5.23-5.23V54.56a5.24 5.24 0 0 1 5.23-5.24h95.81a3.44 3.44 0 0 1 2.35.93"}),e.jsx("path",{d:"M79.12 123.99H110v30.88H79.12z",fill:"#e0f3f9"}),e.jsx("path",{d:"M110 153.37v1.5h-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M105.4 154.87H82.17",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M80.62 154.87h-1.5v-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M79.12 150.27v-23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M79.12 125.49v-1.5h1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M83.72 123.99h23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M108.5 123.99h1.5v1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M110 128.59v23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M110 123.99h30.88v30.88H110z",fill:"#e0f3f9"}),e.jsx("path",{d:"M140.88 153.37v1.5h-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M136.28 154.87h-23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M111.5 154.87H110v-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M110 150.27v-23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M110 125.49v-1.5h1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M114.6 123.99h23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M139.38 123.99h1.5v1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M140.88 128.59v23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M110 93.11h30.88v30.88H110z",fill:"#e0f3f9"}),e.jsx("path",{d:"M140.88 122.49v1.5h-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M136.28 123.99h-23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M111.5 123.99H110v-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M110 119.39V96.15",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M110 94.61v-1.5h1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M114.6 93.11h23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M139.38 93.11h1.5v1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M140.88 97.7v23.24",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M150.91 50.28a3.6 3.6 0 0 1 .86 1.22",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{fill:"none",stroke:"#006bad","stroke-dasharray":"2.87 2.87","stroke-linecap":"round","stroke-linejoin":"round",d:"M152.05 54.34v9.14a5.24 5.24 0 0 0 5.24 5.23h9.94"}),e.jsx("path",{d:"M168.67 68.71h.2a3.5 3.5 0 0 1 1.27.23M19.8 78.25l1.93 14.68-14.67 1.93",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M21.73 92.93S-2.15 82.45 4.05 54.82",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{fill:"none",stroke:"#b43296","stroke-linecap":"round","stroke-linejoin":"round",d:"M14.89 132.63h5.88v5.88h-5.88z"}),e.jsx("path",{fill:"none",stroke:"#f90","stroke-linecap":"round","stroke-linejoin":"round",d:"M174.49 36v5.88m-2.94-2.94h5.88"}),e.jsx("circle",{cx:"199.1",cy:"164.76",r:"2.45",fill:"none",stroke:"#0c0","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M109.68 25.74V11.9M87.12 29.74l-6.02-9.4m53.21 9.4 6.01-9.4",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{fill:"#eff9fc",stroke:"#006bad","stroke-linejoin":"round",d:"m140.43 139.69 7.22 5.8-8.28 10.31-7.22-5.8"}),e.jsx("circle",{cx:"110.2",cy:"124.35",r:"27.74",fill:"#e0f3f9",opacity:".7"}),e.jsx("path",{fill:"#fff",stroke:"#006bad","stroke-linejoin":"round",d:"M131.2 98.19a33.55 33.55 0 1 0 5.16 47.16 33.56 33.56 0 0 0-5.16-47.16Zm.63 43.52a27.73 27.73 0 1 1-4.26-39 27.73 27.73 0 0 1 4.26 39ZM187 173.84a29.8 29.8 0 0 1-4.19 7.52 29.3 29.3 0 0 1-7.24 6.71l-37.77-30.31a29.3 29.3 0 0 1 5-8.56 29.6 29.6 0 0 1 6.4-5.67Z"}),e.jsx("path",{fill:"none",stroke:"#fff","stroke-linecap":"round","stroke-miterlimit":"10",d:"m118.82 138.09 12.51-15.58m-38.56-3.68 6.94-8.65m-5.32 1.9 6.95-8.66m16.23 42.44 12.5-15.58"}),e.jsx("path",{fill:"#fff",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round",d:"M139.92 153.31a28.4 28.4 0 0 0-2.12 4.45m7.07-.49a38 38 0 0 0-2.35 4.28m7.3-.32c-.93 1.34-1.79 2.72-2.58 4.11m7.53-.15q-1.47 2-2.81 3.94m7.75.01-3 3.78m7.95.18c-1.07 1.24-2.16 2.45-3.26 3.61m8.21.35a54 54 0 0 1-3.49 3.44m8.44.5a37 37 0 0 1-3.72 3.26m8.67.74a29 29 0 0 1-3.95 3.09"}),e.jsx("path",{d:"m196.69 115.8-2.18 14.64 14.64 2.18",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M194.51 130.44s23.76-12 21.9-35.66",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"})]})})}function ModelViewsEmptyState({itemSelected:t}){const n=t?"There are no model views associated with this part.":"Select a part to access model views.";return e.jsxs("div",{"data-testid":"pmi-views-empty-state",className:"h-full w-full px-4 flex flex-col gap-2 justify-center items-center overflow-y-auto",children:[e.jsx(FileWithMagnifyingGlassImage,{}),e.jsx("div",{className:"text-base text-neutral-700 text-center px-3 pt-2.5 pb-1.5",children:"No Model Views"}),e.jsx("div",{className:"text-[0.8125rem] text-neutral-600 text-center px-3 pb-2.5",children:n})]})}const VertexModelViewsViewRow=({view:t,currentlyViewing:n,itemId:o,onLoadModelView:a,onClearModelView:s})=>{const i=useModelViewActions();return e.jsx("div",{"data-testid":`model-view-${t.id}`,onClick:async()=>{n?(await i.clearModelView(),null==s||s()):(await i.loadModelView(o,t),null==a||a(o,t.id))},className:_e("flex flex-col w-full h-8 p-1 pl-4 cursor-pointer text-neutral-700 text-[0.8125rem] hover:text-[var(--vertex-ui-blue-600)]",{"bg-[var(--vertex-ui-blue-200)]":n,"hover:bg-[var(--vertex-ui-blue-100)]":!n}),children:e.jsxs("div",{className:_e("flex w-full h-full items-center",{"text-neutral-900 font-extrabold":n}),children:[e.jsxs(l.VertexTooltip,{className:"flex w-20 grow","data-testid":`model-view-${t.id}-tooltip`,placement:"bottom-start",content:t.displayName,children:[e.jsx(l.VertexIcon,{name:"views",size:"sm"}),e.jsx("div",{className:"truncate mx-2",children:t.displayName}),e.jsx("span",{className:"font-normal text-neutral-700 ml-auto pr-1",children:n&&"(Viewing)"})]}),n&&e.jsx("div",{className:"ml-auto pr-1",children:e.jsx(l.VertexIconButton,{"data-testid":"model-views-clear-selection",iconSize:"sm",iconName:"close",onClick:async()=>await i.clearModelView()})})]})},t.id)};function VertexModelViewsList({itemId:t,onLoadModelView:o,onClearModelView:a}){const s=useModelViewActions(),i=n.useRecoilValue(mn),r=n.useRecoilValue(hn(t)),c=n.useRecoilValue(xn(t)),d=n.useRecoilValueLoadable(un),u=0===r.length;return e.jsxs("div",{className:"w-full h-full flex flex-col",children:[("hasValue"!==d.state||null!=d.contents)&&e.jsxs("div",{className:"flex flex-row h-11 w-full border-b border-neutral-300 p-3 pl-4 mr-2 text-sm items-center",children:["hasValue"===d.state&&e.jsx("div",{className:"truncate items-center",children:e.jsx(l.VertexTooltip,{content:d.contents,children:e.jsx("div",{className:"truncate",children:d.contents||""})})}),"loading"===d.state&&e.jsx("div",{className:"flex items-center h-11 w-full",children:e.jsx("div",{className:"w-3/4 h-3 bg-neutral-300 animate-pulse rounded"})})]}),u&&e.jsx(ModelViewsEmptyState,{itemSelected:!0}),!u&&e.jsx("div",{className:"h-full overflow-y-auto",children:e.jsx(Go,{hasMore:c,loadMore:()=>{s.fetchNextModelViews(t)},useWindow:!1,children:r.map((n=>{var l;const s=undefined,r=(null===(l=null==i?void 0:i.modelView)||void 0===l?void 0:l.id.toString())===(null==n?void 0:n.id);return e.jsx(VertexModelViewsViewRow,{view:n,currentlyViewing:r,itemId:t,onLoadModelView:o,onClearModelView:a},n.id)}))})})]})}const VertexPMIAnnotationRow=({annotation:t,checked:n,onCheckedChange:o,selected:a,onSelectedChange:s})=>e.jsxs("div",{"data-testid":`annotation-entry-${t.displayName}`,className:_e("flex items-center w-full h-7 gap-2.5 pl-4 pr-2 cursor-default hover:text-[var(--vertex-ui-blue-600)]",{"bg-[var(--vertex-ui-blue-200)]":a,"hover:bg-[var(--vertex-ui-blue-100)]":!a}),onClick:()=>s(!a),children:[e.jsx(l.VertexToggle,{"data-testid":`annotation-entry-${t.displayName}-check`,variant:"check",checked:n,onClick:e=>e.stopPropagation(),onValueChanged:e=>{o(e.detail)}}),e.jsx("div",{className:"w-1/2 flex-grow",children:e.jsx(l.VertexTooltip,{content:t.displayName,placement:"bottom-start",children:e.jsx("div",{className:"truncate",children:t.displayName})})})]}),VertexPMIAnnotationsSecondaryPanel=({modelViewId:t,parentPanelId:o,verticalSiblingId:a,sceneAnnotationOperations:s,onToggleSelectionOfPMIAnnotation:i,onToggleVisibilityOfPMIAnnotation:r})=>{const c=usePmiAnnotationActions(),d=n.useRecoilValue(G),m=n.useRecoilValue(gn(t)),p=n.useRecoilValue(vn(t)),h=n.useRecoilValue(yn),[f,g]=n.useRecoilState(dn(t)),[v,b]=u.useState("");u.useEffect((()=>{t!==v&&(g(m),b(t))}),[m,v,t,g,b]);const toggleVisibilityOfAllAnnotations=e=>{e?(g(m),null==s||s.sceneAnnotationsOperation((e=>e.show()),d)):(g([]),null==s||s.sceneAnnotationsOperation((e=>e.hide()),d))};return e.jsx(l.VertexResizable,{"data-testid":"pmi-annotation-secondary-panel",className:"min-h-28 max-h-3/4 flex-shrink-0 border-t text-sm text-neutral-700",horizontalDirection:"none",verticalDirection:"top",initializeWithOffset:!0,initialVerticalScale:.6,parentSelector:`#${o}`,verticalSiblingSelector:`#${a}`,children:e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsx("div",{className:"flex items-center w-full h-9 border-b border-[var(--vertex-ui-neutral-300)] px-4 shrink-0",children:"3D PMI"}),e.jsxs("div",{"data-testid":"display-all-annotations",className:"flex items-center w-full h-8 gap-2.5 px-4 py-1.5 cursor-default border-b border-[var(--vertex-ui-neutral-300)]",onClick:()=>{const e=m.length!==f.length;toggleVisibilityOfAllAnnotations(e)},children:[e.jsx(l.VertexToggle,{"data-testid":"display-all-annotations-check",variant:"check",checked:m.length===f.length,onClick:e=>e.stopPropagation(),onValueChanged:e=>{toggleVisibilityOfAllAnnotations(e.detail)}}),"Display All"]}),e.jsx("div",{className:"h-full overflow-y-auto text-[0.8125rem] py-1",children:e.jsx(Go,{hasMore:p,loadMore:async()=>{await c.fetchNextPmiAnnotations(t)},useWindow:!1,children:m.map(((n,o)=>e.jsx(VertexPMIAnnotationRow,{annotation:n,checked:f.includes(n),onCheckedChange:e=>{e?(g([...f,n]),null==s||s.sceneAnnotationsOperation((e=>e.show()),d,[n.id])):(g(f.filter((e=>e!==n))),null==s||s.sceneAnnotationsOperation((e=>e.hide()),d,[n.id])),null==r||r(t,n.id,e)},selected:n.id===h,onSelectedChange:async e=>{e?await c.selectPmiAnnotation(n.id):await c.clearPmiAnnotationSelection(),null==i||i(t,n.id,e)}},o)))})})]})})},VertexModelViewsPanelSection=({onLoadModelView:t,onClearModelView:o,onToggleSelectionOfPMIAnnotation:a,onToggleVisibilityOfPMIAnnotation:l})=>{const s=useSceneAnnotationsOperations(),i=n.useRecoilValue(Rt),r=null!=(null==i?void 0:i.id),c=n.useRecoilValue(mn),d=(null==c?void 0:c.itemId)===(null==i?void 0:i.id);return e.jsxs("div",{id:"model-views-panel-wrapper",className:"w-full h-full flex flex-col text-neutral-800",children:[e.jsxs("div",{"data-testid":"model-views-container",className:"group h-full flex overflow-auto min-h-29 relative",children:[r&&e.jsx(u.Suspense,{fallback:e.jsx(ModelViewsItemListLoading,{}),children:e.jsx(VertexModelViewsList,{itemId:i.id,onLoadModelView:t,onClearModelView:o})}),!r&&e.jsx(ModelViewsEmptyState,{itemSelected:!1})]}),null!=c&&d&&e.jsx(u.Suspense,{fallback:e.jsx(ModelViewsItemListLoading,{}),children:e.jsx(VertexPMIAnnotationsSecondaryPanel,{modelViewId:c.modelView.id,parentPanelId:"model-views-panel-wrapper",verticalSiblingId:"model-views-container",sceneAnnotationOperations:s,onToggleSelectionOfPMIAnnotation:a,onToggleVisibilityOfPMIAnnotation:l})})]})};function ModelViewsItemListLoading(){return e.jsxs("div",{className:"flex flex-col w-full h-full items-center justify-center text-[0.8125rem] overflow-y-auto",children:[e.jsx(l.VertexSpinner,{"data-testid":"model-views-panel-spinner",size:"lg",color:"grey"}),e.jsx("div",{className:"pt-3 px-10 text-center",children:"Loading model views for the selected part..."})]})}function VertexModelViewsPanel(){return e.jsx("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e.jsx(VertexModelViewsPanelSection,{})})}function ColorSwatchContextMenu({onRemoveCustomColor:t}){const o=useContextMenuActions(),a=useSceneItemMaterialActions(),s=n.useRecoilValue(Ge);return e.jsx(VertexContextMenu,{menuType:"color-swatch",onOpen:e=>{elementIsColorSwatch(e.target)&&o.setContextMenuItem(e.target)},openPredicate:e=>elementIsColorSwatch(e.target)&&elementHasColorAttribute(e.target),disableBackdrop:!0,children:e.jsx(l.VertexMenuItem,{"data-testid":"color-swatch-delete",onClick:async()=>{if(contextMenuItemIsElement(s)&&elementIsColorSwatch(s)){const e=null==s?void 0:s.getAttribute("data-color-id");null!=e&&"true"===s.getAttribute("data-custom-color")?(await a.removeCustomColor(e),null==t||t(e)):null!=e&&"true"===s.getAttribute("data-recent-color")&&await a.removeRecentColor(e)}},children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.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:o})=>{const s=useTransformActions(),i=useCacheableLoadable(Et),r=n.useRecoilValue(kt),c=useCacheableLoadable(qt(null!=r?r:"")),d=a.useMemo((()=>{var e;const t=null===(e=i.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}),[i,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(l.VertexMenuItem,{"data-testid":"clear-selected-transforms",onClick:async()=>{await s.clearSelectedTransforms(),null==t||t()},disabled:!d,children:"Clear selected transforms"}),e.jsx(l.VertexMenuItem,{"data-testid":"clear-all-transforms",onClick:async()=>{await s.clearAllTransforms(),null==o||o()},children:"Clear all transforms"})]})})},VertexTransformNumericField=({bottomLabel:t,value:o,step:l,min:s,max:i,disabled:r,testId:c,onBlur:d,onInput:u,onChange:m})=>{const p=a.useRef(null),h=n.useRecoilValue(Lt),[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==o?void 0:o.toFixed(Number(h)))&&void 0!==e?e:"":g(!0)}),[o]);const v=a.useCallback((e=>{g(!1),null==m||m(e)}),[g,m]),b=a.useCallback((e=>{g(!0),null==d||d(e),null!=p.current&&null!=o&&(p.current.value=o.toFixed(Number(h)))}),[d,o,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:l,min:s,max:i,"data-testid":c,disabled:r,defaultValue:Number.isNaN(o)?"":null==o?void 0:o.toFixed(Number(h)),onBlur:b,onInput:u,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 o=n.useRecoilValue(Ot),a=n.useRecoilValue(jt),l=n.useRecoilValue(St),s=a||l,i=n.useRecoilValue(kt),{transform:r,error:c,update:d}=useEditItemTransform(i),u=s?void 0:r,m=useDebouncedCallback((async e=>{await d(e),null==t||t(e)}),50);function updateTransform(e){return t=>{if(null!=u){const n=parseFloat(t.currentTarget.value);Number.isNaN(n)||null==m||m(Object.assign(Object.assign({},u),e(n,u)))}}}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 o=parseFloat(n.currentTarget.value),a=undefined;(isNaN(o)||!!(null==t?void 0:t(o)))&&null!=u&&m(v.defaults(e,u))}}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!=u?u.position.x:void 0,bottomLabel:o,disabled:null==u,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==u?void 0:u.position.y,bottomLabel:o,disabled:null==u,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==u?void 0:u.position.z,bottomLabel:o,disabled:null==u,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==u?void 0:u.rotation.x,bottomLabel:"deg",disabled:null==u,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==u?void 0:u.rotation.y,bottomLabel:"deg",disabled:null==u,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==u?void 0:u.rotation.z,bottomLabel:"deg",disabled:null==u,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==u?void 0:u.scale,step:.1,min:.1,disabled:null==u,onChange:updateScale(),onBlur:updateToDefaultValueIfInvalid({scale:1},(e=>e<=0))})}),s&&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 o=useTransformActions(),a=n.useRecoilValue(Ft),s=n.useSetRecoilState(Xt);return e.jsx(l.VertexToggle,{className:"flex items-center","data-testid":"transform-widget-toggle",variant:"switch",checked:a,onValueChanged:async()=>{a?(o.disableTransformWidget(),null==t||t(!1)):(s("world"),await o.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:o,onUpdateTransform:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Manual Part Transforms",e.jsx(VertexTransformClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexTransformControls,{onToggleTransformsManipulator:o,onUpdateTransform:a})})}function DefaultTransformsPanel(){return e.jsx("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e.jsx(VertexTransformPanelSection,{})})}const $o="Appearance",qo="Model Views",Yo="Settings",Xo="Transforms",ViewerRightPanelHeader=({additionalHeaderMap:t})=>{const o=n.useRecoilValue(Qn),a=getHeading(o,t),l="model-views"===o;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.jsxs("div",{className:"flex items-center w-full leading-6 text-md align-center font-medium text-neutral-800 gap-2",children:[a,l&&e.jsx(BetaLabel,{})]})})};function getHeading(e,t={}){switch(e){case"appearance":return $o;case"model-views":return qo;case"settings":return Yo;case"transforms":return Xo;default:const n=null!=e?t[e]:void 0;return null!=n?n:"None"}}function VertexViewerRightOpenedPanel({children:t}){const o=n.useRecoilValue(Qn),l=a.useMemo((()=>filterChildElements(t,CustomPanelContent)),[t]),s=a.useMemo((()=>l.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.props.panelName]:t.props.panelTitle})),{})),[l]),i=a.useMemo((()=>["appearance","model-views","settings","transforms",...l.map((e=>e.props.panelName))]),[l]);return e.jsx(e.Fragment,{children:null!=o&&i.includes(o)&&e.jsxs(VertexResizableContent,{displayShadow:!0,heading:e.jsx(ViewerRightPanelHeader,{additionalHeaderMap:s}),placement:"right",children:["appearance"===o&&e.jsx(DefaultAppearancePanel,{}),"transforms"===o&&e.jsx(DefaultTransformsPanel,{}),"settings"===o&&e.jsx(DefaultSettingsPanel,{}),"model-views"===o&&e.jsx(VertexModelViewsPanel,{}),t]})})}function CustomPanelContent({panelName:t,children:o}){const a=n.useRecoilValue(Qn);return e.jsx(e.Fragment,{children:a===t&&o})}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:o,responsive:s,disabled:i,content:r,tooltipPlacement:c,children:d,onSelect:u,onDeselect:m}){return e.jsx("div",{className:_e({"text-[var(--vertex-ui-blue-700)]":o===t&&!i,"text-neutral-700 hover:text-neutral-800":o!==t&&!i,"cursor-pointer hover:bg-neutral-200":!i,"text-neutral-400":i,"rounded-full md:p-3":s,"p-3":!s&&null==d,"px-3 py-1":null!=d}),"data-testid":`${t}-sidebar-panel`,onClick:()=>{i||(o===t?m():u())},children:e.jsxs(l.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!=d?d:e.jsx(l.VertexIcon,{name:n})})]})})}function VertexViewerRightSidebar({children:t}){const o=usePanelActions(),a=useTransformActions(),l=n.useRecoilValue(Qn);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:l,iconName:"adjustments",tooltipPlacement:"right",content:"Appearance",onSelect:()=>{o.openPrimary("appearance","right")},onDeselect:()=>o.closePrimary("right")}),e.jsx(SidebarIcon,{name:"transforms",active:l,iconName:"show-only-nearby",tooltipPlacement:"right",content:"Transforms",onSelect:async()=>{o.openPrimary("transforms","right"),await a.enableTransformWidget(void 0,!0)},onDeselect:()=>o.closePrimary("right")}),e.jsx(SidebarIcon,{name:"model-views",active:l,iconName:"views",tooltipPlacement:"right",content:"Model Views",onSelect:async()=>{o.openPrimary("model-views","right")},onDeselect:()=>o.closePrimary("right")}),e.jsx(SidebarIcon,{name:"settings",active:l,iconName:"gear",tooltipPlacement:"right",content:"Settings",onSelect:()=>{o.openPrimary("settings","right")},onDeselect:()=>o.closePrimary("right")})]})})}function CustomPanelIcon(t){const o=usePanelActions(),a=n.useRecoilValue(Qn),{panelName:l,tooltipContent:s,iconName:i}=t,r=__rest(t,["panelName","tooltipContent","iconName"]);if(null==i&&null==r.children)throw new Error('CustomPanelIcon must contain either a Vertex "iconName" or custom "children"');return e.jsx(SidebarIcon,Object.assign({},r,{name:l,iconName:null!=i?i:"help",active:a,content:s,onSelect:()=>{o.openPrimary(t.panelName,"right")},onDeselect:()=>{o.closePrimary("right")}}))}VertexViewerRightOpenedPanel.CustomPanelContent=CustomPanelContent,VertexViewerRightSidebar.CustomPanelIcon=CustomPanelIcon;const VertexPopupButton=t=>{var{open:n,children:o}=t,a=__rest(t,["open","children"]);const s=o.find((e=>e.type===Anchor)),i=o.filter((e=>e.type!==Anchor));return null==s?e.jsx(e.Fragment,{}):e.jsxs(l.VertexPopover,Object.assign({className:"flex",placement:"top",backdrop:!1,open:asBooleanAttribute(n)},a,{children:[s,e.jsx("div",{className:_e("flex mb-1.5",{hidden:!n}),"data-testid":"align-plane-popover-menu",children:i})]}))},Anchor=({tooltipContent:t,children:n})=>e.jsx("div",{slot:"anchor",children:e.jsx(l.VertexTooltip,{className:"cursor-pointer",content:t,children:n})});function VertexViewerCrossSectionAlignmentPopoverMenu({disabled:t}){const o=useCrossSectioningActions(),a=n.useRecoilValue(je),s=n.useRecoilValue(xe),getBaseIcon=()=>`align-to-${null==s?void 0:s.mode}`;return useStackKeyBinding({id:"CrossSectionAlignment",keyBind:"Escape",fn:o.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:o.closeAlignmentTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Section Alignment",children:e.jsx(l.VertexIconButton,{"data-testid":"section-alignment-icon-button",iconName:getBaseIcon(),iconColor:"secondary",onClick:a?o.closeAlignmentTools:o.openAlignmentTools,disabled:t,children:e.jsx(l.VertexIcon,{"data-testid":"section-alignment-icon-chevron",name:"chevron-up",size:"sm"})})}),e.jsxs(i.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(l.VertexIconButton,{iconColor:"secondary",onClick:()=>o.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(l.VertexIconButton,{iconColor:"secondary",onClick:()=>o.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 o=useCrossSectioningActions(),s=n.useRecoilValue(Ve),r=n.useRecoilValue(he),c=n.useRecoilValueLoadable(ye),d=a.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(s),onDismissed:o.closeAxisTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Align Plane",children:e.jsx(l.VertexIconButton,{onClick:s?o.closeAxisTools:o.openAxisTools,iconName:d,"data-testid":"align-plane-icon",iconColor:"secondary",disabled:t,children:e.jsx(l.VertexIcon,{"data-testid":"align-plane-icon-chevron",name:"chevron-up",size:"sm"})})}),e.jsxs(i.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(l.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:()=>o.updateAxis("x"),variant:"plain",iconColor:"secondary",iconName:"axis-x",children:e.jsx("div",{className:"text-base ml-2",children:"X-axis Plane"})}),e.jsx(l.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:()=>o.updateAxis("y"),children:e.jsx("div",{className:"text-base ml-2",children:"Y-axis Plane"})}),e.jsx(l.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:()=>o.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:o,onOffsetChange:s}){const i=n.useRecoilValue(Ot),r=n.useRecoilValue(Lt),[c,d]=a.useState(convertTo(t,i));a.useEffect((()=>{d(convertTo(t,i))}),[i,t]);const u=createDistanceFormatter(i,parseInt(r,10)),handleIncrementalUpdate=e=>{const t=convertFrom(c+e,i);s(t)},handleSubmit=e=>{e.preventDefault(),s(convertFrom(c,i))},handleBlur=()=>{s(convertFrom(c,i))};return e.jsx(l.VertexTooltip,{content:"Plane Offset",children:e.jsx("form",{"data-testid":"cross-section-stepper-form",onSubmit:handleSubmit,children:e.jsxs(l.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=>{d(null!=e.detail.value?parseFloat(e.detail.value):t)},onBlur:handleBlur,disabled:o,children:[e.jsx("div",{"data-testid":"cross-section-stepper-decrement",className:"py-1 cursor-pointer",slot:"left",onClick:()=>{o||handleIncrementalUpdate(-1)},children:e.jsx(l.VertexIcon,{name:"chevron-left",size:"sm"})}),e.jsx("div",{"data-testid":"cross-section-stepper-increment",className:"py-1 cursor-pointer",slot:"right",onClick:()=>{o||handleIncrementalUpdate(1)},children:e.jsx(l.VertexIcon,{name:"chevron-right",size:"sm"})})]})})})}VertexPopupButton.Anchor=Anchor;const Zo=400;function VertexViewerCrossSectionPopupMenu(){const t=useCrossSectioningActions(),o=n.useRecoilValue(Se),s=n.useRecoilValueLoadable(we),r=n.useRecoilValueLoadable(Ce),c=a.useRef(),d=a.useMemo((()=>"hasValue"===s.state&&Number.isFinite(s.contents.max)&&Number.isFinite(s.contents.min)),[s.state,s.contents]),u=a.useMemo((()=>"hasValue"===s.state?s.contents:se),[s.state,s.contents]),m=a.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()}),Zo),t.beginInteraction(),t.updatePlanes(e)};return e.jsxs(VertexPopupButton,{"data-testid":"cross-section-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(o),onDismissed:t.closeAdditionalTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Section Tools",children:e.jsx("div",{className:"-ml-px py-1.5",children:e.jsx(l.VertexIcon,{"data-testid":"cross-section-popover-icon",name:"chevron-up",size:"sm",onClick:o?t.closeAdditionalTools:t.openAdditionalTools})})}),e.jsxs(i.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:!d}),e.jsx(l.VertexTooltip,{className:"w-auto",content:"Reverse",children:e.jsx(l.VertexIconButton,{iconName:"flip","data-testid":"viewer-toolbar-flip-button",onClick:t.flipPlanes,iconColor:"secondary",disabled:!d})}),e.jsx(l.VertexTooltip,{className:"w-auto",content:"Align View to Plane",children:e.jsx(l.VertexIconButton,{"data-testid":"viewer-toolbar-align-view-to-plane-button",iconName:"align-view-to-plane",onClick:t.alignViewToPlane,iconColor:"secondary",disabled:!d})}),e.jsx(VertexToolbarDivider,{}),e.jsx(VertexViewerCrossSectionAxisPopoverMenu,{disabled:!d}),e.jsx("div",{className:"w-52 mx-2",children:e.jsx(VertexSlider,{value:m,defaultValue:u.default,disabled:asBooleanAttribute("hasValue"!==s.state)||!d,min:u.min,max:u.max,step:.01,onChange:handleCrossSectionValueChange})}),e.jsx("div",{className:"px-4",children:e.jsx(VertexViewerCrossSectionOffsetStepper,{offset:"hasValue"===r.state&&d?r.contents:0,disabled:!d,onOffsetChange:handleCrossSectionValueChange})})]})]})}const VertexViewerCrossSectionButton=()=>{const t=useCrossSectioningActions(),o=n.useRecoilValue(ie);return e.jsxs(e.Fragment,{children:[e.jsx(l.VertexTooltip,{content:o?"Hide Section":"Show Section",children:e.jsx(l.VertexIconButton,{"data-testid":"viewer-toolbar-cross-section-button",iconName:"cross-section",iconColor:o?"primary":"secondary",onClick:()=>o?t.disable():t.enable()})}),e.jsx(VertexViewerCrossSectionPopupMenu,{})]})},VertexFitAllButton=()=>{const t=n.useRecoilValue(G);return e.jsx(l.VertexTooltip,{content:"Fit All",children:e.jsx(l.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),o=n.useRecoilValue($),[s,i]=n.useRecoilState(Y),[r,c]=n.useRecoilState(q);return a.useEffect((()=>{null!=t&&o&&c(t.getBaseInteractionHandler())}),[t,o,c]),e.jsx(l.VertexTooltip,{content:"Pan",children:e.jsx(l.VertexIconButton,{iconName:"pan",iconColor:"pan"===s?"primary":"secondary","data-testid":"viewer-toolbar-pan-button",onClick:async()=>{if(i("pan"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("pan")}}})})},VertexRotateButton=()=>{const t=n.useRecoilValue(G),o=n.useRecoilValue($),[s,i]=n.useRecoilState(Y),[r,c]=n.useRecoilState(q);return a.useEffect((()=>{null!=t&&o&&c(t.getBaseInteractionHandler())}),[t,o,c]),e.jsx(l.VertexTooltip,{content:"Rotate",children:e.jsx(l.VertexIconButton,{iconName:"rotate",iconColor:"rotate"===s?"primary":"secondary","data-testid":"viewer-toolbar-rotate-button",onClick:async()=>{if(i("rotate"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("rotate")}}})})},VertexZoomButton=()=>{const t=n.useRecoilValue(G),o=n.useRecoilValue($),[s,i]=n.useRecoilState(Y),[r,c]=n.useRecoilState(q);return a.useEffect((()=>{null!=t&&o&&c(t.getBaseInteractionHandler())}),[t,o,c]),e.jsx(l.VertexTooltip,{content:"Zoom",children:e.jsx(l.VertexIconButton,{iconName:"zoom",iconColor:"zoom"===s?"primary":"secondary","data-testid":"viewer-toolbar-zoom-button",onClick:async()=>{if(i("zoom"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("zoom")}}})})},DefaultToolbar=()=>e.jsx(i.VertexViewerToolbar,{placement:"bottom-center",children:e.jsxs(i.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=({endCapEnabledByDefault:t,children:o})=>{const l=n.useSetRecoilState(ue),s=n.useSetRecoilState(de);a.useEffect((()=>{null!=t&&(l(t),s(t))}),[t]);const r=null!=o&&!1!==o;return e.jsx(i.VertexViewerToolbar,{placement:"bottom-center",children:r?e.jsx(i.VertexViewerToolbarGroup,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:o}):e.jsx(DefaultToolbar,{})})};function VertexTransformWidget({transformWidgetElement:t,supportUndo:o,onPositionChange:l,onRotationChange:s}){const r=useTransformActions(),c=n.useRecoilValue(Kt),d=n.useRecoilValue(Ft),u=n.useRecoilValue(Ht),m=n.useRecoilValue(Gt),p=n.useRecoilValueLoadable(Wt),h=n.useRecoilValue(Ot),f=n.useRecoilValue(Lt),g=a.useMemo((()=>"hasValue"===p.state?p.contents:m),[p,m]),v=a.useMemo((()=>{const e=undefined;return d&&(null!=g||c)}),[d,g,c]);return e.jsx(e.Fragment,{children:v&&e.jsx(i.VertexViewerTransformWidget,{id:"transform-widget","data-testid":"viewer-transform-widget",ref:t,position:u,rotation:null!=u?g:void 0,decimalPlaces:parseInt(f,10),distanceUnit:toUnitType(h),EXPERIMENTAL_undoKeybindings:null==o||o,onInteractionStarted:()=>{r.disableSelectionSync(),r.setIsInteractivelyTransforming(!0)},onInteractionEnded:()=>{r.invalidateTransforms(),r.setIsInteractivelyTransforming(!1)},onPositionChanged:async e=>{await r.setTransformWidgetPosition(e.detail),null==l||l(e.detail)},onRotationChanged:e=>{r.setTransformWidgetOrientation(e.detail),null==s||s(e.detail)}})})}const VertexViewerSceneReset=({onReset:t})=>{const o=useCrossSectioningActions(),a=useModelViewActions(),s=useSelectionActions(),i=useTransformActions(),r=useViewerSceneActions(),c=n.useSetRecoilState(Rt),handleReset=async()=>{await o.disable(),await s.resetSelectionState(),i.clearTransformWidgetPosition(),await i.invalidateTransforms(),c(void 0),await a.clearModelView(),null==t||t(),await r.reset()};return e.jsx(l.VertexTooltip,{content:"Reset View",children:e.jsx(l.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 o=>{const a=await n.getPromise(At);t(Z,o.detail.scene),t(At,o.detail.scene.sceneViewSummary.selectedVisibleSummary),t(Tt,a);const l=undefined;await n.getPromise(Ft)&&await e.syncToSelection()}))}}const VertexBoxSelectionTool=()=>{const{element:t,callback:o}=useCallbackRef(),a=useBoxSelectionActions(),l=useTransformActions(),s=n.useRecoilValue(Xe);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"===s&&(l.clearTransformWidgetOrientation(),l.clearTransformWidgetPosition(),l.enableSelectionSync())}))]}));return()=>{null==e||e.then((e=>{null==e||e.forEach((e=>null==e?void 0:e.dispose()))}))}}),[t,s]),useApplyKeyBinding({keyBind:"Shift",fn:u.useCallback((()=>a.setOperationType("select")),[]),off:u.useCallback((()=>a.setOperationType("clearAndSelect")),[])}),e.jsx(i.VertexViewerBoxQueryTool,{ref:o,"data-testid":"viewer-box-query-tool",operationType:s})};function VertexViewerCameraTypeMenu({open:t,onOpen:o,onDismiss:a,onCameraTypeChange:s}){const i=useViewerCameraActions(),r=n.useRecoilValue(W);return e.jsxs(l.VertexMenu,{"data-testid":"camera-types-popover",className:"flex",placement:"bottom-end",open:asBooleanAttribute(t),onMenuClosed:a,children:[e.jsx("div",{slot:"anchor",children:e.jsx("div",{className:_e("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(l.VertexTooltip,{content:"Change View",children:e.jsx(l.VertexIconButton,{"data-testid":"set-camera-mode-option",className:"p-1 cursor-pointer",variant:"plain",onClick:o,iconName:"orthographic"===r?"cube-orthographic":"cube-perspective",children:e.jsx(l.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(l.VertexMenuItem,{"data-testid":"set-perspective-view",onClick:()=>{i.updateCameraType("perspective",!0),null==s||s("perspective")},children:[e.jsx(l.VertexIcon,{slot:"icon","data-testid":"set-perspective-view-icon",name:"cube-perspective",size:"sm",className:_e({"text-[var(--vertex-ui-blue-700)]":"perspective"===r})}),e.jsx("div",{className:_e("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"perspective"===r}),children:"Perspective"})]}),e.jsxs(l.VertexMenuItem,{"data-testid":"set-orthographic-view",onClick:()=>{i.updateCameraType("orthographic",!0),null==s||s("orthographic")},children:[e.jsx(l.VertexIcon,{slot:"icon","data-testid":"set-orthographic-view-icon",name:"cube-orthographic",size:"sm",className:_e({"text-[var(--vertex-ui-blue-700)]":"orthographic"===r})}),e.jsx("div",{className:_e("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"orthographic"===r}),children:"Orthographic"})]})]})]})}const VertexViewerViewCube=t=>{var{placement:n,children:o}=t,l=__rest(t,["placement","children"]);const s=Array.isArray(o)?o:[o],r=s.filter((e=>!a.isValidElement(e)||e.type!==i.VertexViewerViewCube)).filter((e=>null!=e&&!1!==e)),c=s.find((e=>a.isValidElement(e)&&e.type===i.VertexViewerViewCube)),[d,u]=a.useState(!1);return e.jsxs(i.VertexViewerToolbar,{direction:"vertical","data-testid":"view-cube-toolbar",placement:null!=n?n:"top-right",children:[null!=c?c:e.jsx(i.VertexViewerViewCube,Object.assign({className:"m-7"},l)),0===r.length?e.jsxs("div",{className:"flex items-center justify-center mt-3 gap-1",children:[e.jsx(VertexViewerSceneReset,{}),e.jsx(VertexViewerCameraTypeMenu,{open:d,onDismiss:()=>u(!1),onOpen:()=>u(!0)})]}):e.jsx("div",{className:"mt-3",children:r})]})},VertexViewer=t=>{var{id:o,src:l,className:s,disableSelection:r,onTap:c,onLongpress:d,onFrameDrawn:u,onSceneReady:m,viewerRefCallback:p,children:h}=t,f=__rest(t,["id","src","className","disableSelection","onTap","onLongpress","onFrameDrawn","onSceneReady","viewerRefCallback","children"]);const g=n.useRecoilValue(go),v=useRecoilRef({state:G}),b=useViewerCameraActions(),w=useCrossSectioningActions(),C=useHitActions(),S=useSelectionActions(),j=useViewerFrameActions(),V=n.useRecoilValue(W),k=n.useRecoilValue(xe),T=n.useRecoilValue(Ye),A=n.useSetRecoilState(X),[P,I]=n.useRecoilState($);a.useEffect((()=>{P&&(I(!1),w.disable())}),[l]);const[M,E]=n.useRecoilState(K);a.useEffect((()=>{null!=o&&E(o)}),[o]);const R=n.useRecoilValue(mo),N=a.useMemo((()=>({opacity:R/100})),[R]),O=n.useRecoilValue(ze),L=n.useRecoilValue(Fe),_=a.useMemo((()=>({color:O,width:L})),[O,L]),B=n.useRecoilValue(ue),D=n.useRecoilValue(me),F=n.useRecoilValue(pe),H=a.useMemo((()=>Object.assign({endCapEnabled:B,endCapUsePartColor:D===ne.PART},B&&D===ne.SINGLE&&{endCapColor:F})),[B,D,F]),U=n.useRecoilValue($n),q=n.useRecoilValue(Un),Y=n.useRecoilValue(Wn),Z=n.useRecoilValue(Gn),J=a.useMemo((()=>({color:q,opacity:Y/100,lineWidth:Z})),[q,Y,Z]),Q=n.useRecoilValue(nt),ee=null!=h&&!1!==h;return useKeyBindings(),useDefaultKeybindings(),e.jsxs(i.VertexViewer,Object.assign({id:M,"data-testid":"vertex-viewer",src:l,ref:e=>{null==p||p(e),v(e)},className:_e("flex w-full h-full",s,{"cursor-crosshair":k.hitPending}),style:{"--viewer-background":U},config:g,cameraType:P?V:void 0,onCameraTypeChanged:e=>{P&&b.updateCameraType(e.detail,!1)},phantom:N,featureLines:_,selectionHighlighting:J,crossSectioning:H,featureMaps:Q?"final":void 0,onTap:e=>{const t=[...r?[]:[S.selectCurrentHit]];C.tap(e,...t),null==c||c(e)},onLongpress:e=>{C.longPress(e),null==d||d(e)},onFrameDrawn:e=>{j.frameDrawn(e),null==u||u(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());A(null==n?void 0:n.sceneViewId)}null==m||m(e)}},f,{children:[T&&e.jsx(VertexBoxSelectionTool,{}),ee?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:o})=>{const l=n.useRecoilValue(on),s=n.useRecoilValue(kn);return a.useEffect((()=>{null==t||t(l)}),[l,t]),a.useEffect((()=>{null==o||o(s)}),[s,o]),e.jsx(e.Fragment,{})},VertexViewerToolkitRoot=t=>{var{override:o,autoDefineCustomElements:l,children:s,config:i}=t,r=__rest(t,["override","autoDefineCustomElements","children","config"]);return a.useEffect((()=>{(null==l||l)&&(d.defineCustomElements(),c.defineCustomElements())}),[l]),e.jsx(n.RecoilRoot,{override:o,children:e.jsxs(e.Fragment,{children:[e.jsx(VertexViewerToolkitEventListener,Object.assign({},r)),e.jsx(VertexViewerToolkitRootConfig,{config:i,children:s})]})})},VertexViewerToolkitRootConfig=({config:t,children:o})=>{const l=n.useSetRecoilState(go);return a.useEffect((()=>{const e=null!=t?toSdkConfig(t):void 0;l(e)}),[t,l]),e.jsx(e.Fragment,{children:o})};var Jo=Object.freeze({__proto__:null,get AssemblyFontFace(){return zo},Columns:Io,Core:Vn,Metadata:Uo,Search:Do});exports.Appearance=qn,exports.BoxSelection=Ze,exports.Config=vo,exports.ContextMenu=qe,exports.CrossSection=Ne,exports.Ghosting=fo,exports.Hits=an,exports.Keybinding=Zn,exports.Measurement=pt,exports.Messages=H,exports.Metadata=co,exports.ModelViews=Ko,exports.Panel=to,exports.Performance=ft,exports.SceneTree=Jo,exports.SceneViewItem=Nt,exports.Selection=Tn,exports.Settings=_t,exports.Transforms=nn,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.VertexModelViewsPanel=VertexModelViewsPanel,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;
|
|
18
|
+
*/Le=Oe,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 o in t)e.call(t,o)&&t[o]&&(n=appendClass(n,o));return n}function appendClass(e,t){return t?e?e+" "+t:e+t:e}Le.exports?(classNames.default=classNames,Le.exports=classNames):window.classNames=classNames}();var _e=Oe.exports;const VertexSlider=t=>{var{value:n,defaultValue:o,leftLabel:i,rightLabel:s,onChange:r,onValueChange:c,onValueInput:d}=t,u=__rest(t,["value","defaultValue","leftLabel","rightLabel","onChange","onValueChange","onValueInput"]);const[m,p]=a.useState(o);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(l.VertexSlider,Object.assign({className:_e("w-full",{"mt-0.5":null!=i||null!=s}),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==d||d(e)}},u)),s&&e.jsx("div",{className:"text-xs pr-2 flex-shrink-0 text-right",children:s})]})},VertexCrossSectionAppearanceLineThicknessSlider=({onUpdate:t})=>{const o=useCrossSectioningActions(),[a,l]=n.useRecoilState(ce);return e.jsx(VertexSlider,{id:"cross-section-line-thickness","data-testid":"cross-section-line-thickness-slider",leftLabel:"Off",rightLabel:"Thick",min:0,max:3,step:.5,value:a,valueLabelDisplay:"auto",onValueInput:async e=>{l(e.detail.value),await o.reapply()},onValueChange:e=>{null==t||t(e.detail.value)}})},VertexEndCapColorOptions=({onUpdateColorType:t})=>{const[o,a]=n.useRecoilState(me);return e.jsx("div",{className:"pl-2 text-sm text-neutral-700",children:e.jsxs(l.VertexRadioGroup,{value:o,"data-testid":"end-capping-color-type-radio-group",name:"end-capping-color-type",onValueChanged:e=>{a(e.detail.toUpperCase()===ne.PART?ne.PART:ne.SINGLE),null==t||t(e.detail)},children:[e.jsx(l.VertexRadio,{"data-testid":"end-capping-color-part-color",label:"Part Color",value:ne.PART}),e.jsx(l.VertexRadio,{"data-testid":"end-capping-color-single-color",label:"Single Color",value:ne.SINGLE})]})})},VertexEndCapColorPicker=({onUpdateCustomColor:t})=>{const[o,a]=n.useRecoilState(pe);return e.jsx(VertexColorPicker,{"data-testid":"end-capping-color-picker",value:o,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})},VertexEndCapToggle=({onEnabledChange:t})=>{const[o,a]=n.useRecoilState(ue);return e.jsx(l.VertexToggle,{className:"flex items-center","data-testid":"end-item-enabled-toggle",variant:"switch",checked:o,onValueChanged:async e=>{a(e.detail),null==t||t(e.detail)}})};function VertexCrossSectionAppearanceControls({onUpdateCrossSectionColor:t,onUpdateCrossSectionLineThickness:o,showEndCapSettings:a,onEndCapEnabledChange:l,onUpdateEndCapColorType:i,onUpdateEndCapCustomColor:s}){const r=n.useRecoilValue(me);return e.jsxs(e.Fragment,{children:[a&&e.jsxs("div",{className:"flex items-center pt-2 pb-2",children:[e.jsx(VertexEndCapToggle,{onEnabledChange:l}),e.jsx("span",{className:"pl-4 text-sm text-neutral-700",children:"Show End Cap"})]}),e.jsx("div",{className:"pt-2 pb-2 text-sm text-neutral-700",children:"Line 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:o}),a&&e.jsxs("div",{children:[e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Cap Color"}),e.jsx(VertexEndCapColorOptions,{onUpdateColorType:i}),r===ne.SINGLE&&e.jsx("div",{className:"mt-2",children:e.jsx(VertexEndCapColorPicker,{onUpdateCustomColor:s})})]})]})}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 o=useCrossSectioningActions(),[a,i]=n.useRecoilState(re),[s,r]=n.useRecoilState(ce),c=n.useRecoilValue(de),[d,u]=n.useRecoilState(ue),[m,p]=n.useRecoilState(me),[h,f]=n.useRecoilState(pe),g=a!==oe||1!==s||d!==c||m!==ne.PART||h!==le;return e.jsx("div",{className:"ml-auto",children:e.jsx(l.VertexTooltip,{content:"Reset Cross Sectioning Appearance",children:e.jsx(l.VertexIconButton,{"data-testid":"cross-section-appearance-reset",iconName:"reset",iconSize:"sm",onClick:async()=>{i(oe),r(1),u(c),p(ne.PART),f(le),null==t||t(),await o.reapply()},disabled:!g})})})};function VertexCrossSectionAppearancePanelSection({onResetCrossSectionAppearance:t,onUpdateCrossSectionColor:n,onUpdateCrossSectionLineThickness:o,onEndCapEnabledChange:a,onUpdateEndCapColorType:l,onUpdateEndCapCustomColor:i}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Cross Sectioning",e.jsx(VertexCrossSectionAppearanceReset,{onReset:t})]}),children:e.jsx(VertexCrossSectionAppearanceControls,{onUpdateCrossSectionColor:n,onUpdateCrossSectionLineThickness:o,onEndCapEnabledChange:a,onUpdateEndCapColorType:l,onUpdateEndCapCustomColor:i})})}const Be=.5,De="#444444",ze=n.atom({key:"featureEdgesSelectedColor",default:De}),Fe=n.atom({key:"featureEdgesLineThickness",default:Be}),VertexFeatureEdgesColorPicker=({onUpdate:t})=>{const[o,a]=n.useRecoilState(ze);return e.jsx(VertexColorPicker,{"data-testid":"feature-edges-color-picker",value:o,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})},VertexFeatureEdgesThicknessSlider=({onUpdate:t})=>{const[o,a]=n.useRecoilState(Fe);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:o,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexFeatureEdgesControls({onUpdateFeatureEdgesColor:t,onUpdateFeatureEdgesThickness:n}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexFeatureEdgesColorPicker,{onUpdate:t}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Line Thickness"}),e.jsx(VertexFeatureEdgesThicknessSlider,{onUpdate:n})]})}const VertexFeatureEdgesReset=({onReset:t})=>{const[o,a]=n.useRecoilState(ze),[i,s]=n.useRecoilState(Fe),r=i!==Be||o!==De;return e.jsx("div",{className:"ml-auto",children:e.jsx(l.VertexTooltip,{content:"Reset Feature Edges",children:e.jsx(l.VertexIconButton,{"data-testid":"feature-edges-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(De),s(Be),null==t||t()},disabled:!r})})})};function VertexFeatureEdgesPanelSection({onResetFeatureEdges:t,onUpdateFeatureEdgesColor:n,onUpdateFeatureEdgesThickness:o}){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:o})})}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 He=n.atom({key:"contextMenuActive",default:void 0}),Ue=n.atom({key:"contextMenuPosition",default:void 0}),We=n.atom({key:"contextMenuTarget",default:void 0}),Ge=n.atom({key:"contextMenuItem",default:void 0}),Ke=n.atom({key:"contextMenuActions",default:[]}),$e=n.selector({key:"contextMenuActivePosition",get:({get:e})=>null!=e(He)?e(Ue):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(Ue,o.Point.create(n,a)),e(We,t.target)}})),pointerUp:useActionCallback((({snapshot:e,set:t})=>async(n,a,l,i)=>{const s=await e.getPromise(Ue),r=await e.getPromise(He);if(null!=s&&null==r){const e=n.clientX,r=null==n?void 0:n.clientY,c=o.Point.create(e,r),d=null!=s?o.Point.distance(s,c):0,u=null==l||l(n);d<2&&u&&(null==i||i(n,null!=s?s:c),t(He,a))}})),contextMenu:useActionCallback((()=>(e,t)=>{(null==t||t(e))&&e.preventDefault()})),longPress:useActionCallback((({set:e})=>(t,n,a,l)=>{if(null==a||a(t)){const a=o.Point.create(t.touches[0].clientX,t.touches[0].clientY);e(Ue,a),e(We,t.target),e(He,n),null==l||l(t,a)}})),setContextMenuItem:useActionCallback((({snapshot:e,set:t,reset:n})=>async o=>{const a=await e.getPromise(Ke);t(Ge,o),a.forEach((e=>e(o))),n(Ke)})),clearActiveContextMenu:useActionCallback((({reset:e,set:t})=>n=>{t(Ee,!!n),e(He),e(Ke),e(Ue)})),clearDismissedState:useActionCallback((({reset:e})=>()=>e(Ee)))}}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 qe=Object.freeze({__proto__:null,contextMenuActions:Ke,contextMenuActive:He,contextMenuActivePosition:$e,contextMenuItem:Ge,contextMenuItemIsElement:contextMenuItemIsElement,contextMenuItemIsRow:contextMenuItemIsRow,contextMenuPosition:Ue,contextMenuTarget:We,targetShouldSkipNextHit:targetShouldSkipNextHit,targetWithinMenu:targetWithinMenu,useContextMenuActions:useContextMenuActions});const Ye=n.atom({key:"boxSelectionEnabled",default:!1}),Xe=n.atom({key:"boxSelectionOperationType",default:"clearAndSelect"}),useBoxSelectionActions=()=>({enable:useActionCallback((({set:e})=>()=>{e(Ye,!0)})),disable:useActionCallback((({reset:e})=>async()=>{e(Ye),e(Xe)})),setOperationType:useActionCallback((({set:e})=>t=>{e(Xe,t)}))});var Ze=Object.freeze({__proto__:null,boxSelectionEnabled:Ye,boxSelectionOperationType:Xe,useBoxSelectionActions:useBoxSelectionActions});async function whenComponentReady(e,t,n=customElements,o=requestAnimationFrame,a=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 o?o(e):a(e))),t())}const Je=n.atom({key:"isEditingPointToPointMeasurement",default:!1}),Qe=n.atom({key:"pointToPointMeasurementOutcome",default:void 0}),et=n.atom({key:"editedPointToPointMeasurement",default:void 0});function usePointToPointMeasurement(e){const t=n.useSetRecoilState(Qe);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 tt=2,nt=n.atom({key:"isEditingPreciseMeasurement",default:!1}),ot=n.atom({key:"preciseMeasurementOutcome",default:void 0}),at=n.atom({key:"preciseMeasurementController",dangerouslyAllowMutability:!0,default:void 0}),lt=n.atom({key:"preciseMeasurementOverlays",dangerouslyAllowMutability:!0,default:void 0}),it=n.atom({key:"preciseMeasurementEntities",dangerouslyAllowMutability:!0,default:[]}),st=n.selector({key:"preciseMeasurementMessage",get:({get:e})=>{const t=undefined;return 0===e(it).length?"Select a surface":void 0}});function usePreciseMeasurementModel(e,t,o){const l=n.useSetRecoilState(it),i=n.useSetRecoilState(ot),s=n.useSetRecoilState(at),r=n.useSetRecoilState(lt),c=n.useRecoilValue(at);a.useEffect((()=>{let n;return whenComponentReady(e,(()=>{n=null==e?void 0:e.measurementModel.onEntitiesChanged((e=>{l(e),null==t||t(e)}))})),()=>null==n?void 0:n.dispose()}),[e,l]),a.useEffect((()=>{let t;return whenComponentReady(e,(()=>{t=null==e?void 0:e.measurementModel.onOutcomeChanged((e=>{i(e),null==o||o(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,(()=>{s(null==e?void 0:e.measurementController)}))}),[e,s]),a.useEffect((()=>{whenComponentReady(e,(()=>{r(null==e?void 0:e.measurementOverlays)}))}),[e,r])}function useMeasurementActions(){const e=useBoxSelectionActions(),t=useEnablePointToPointMeasurement(),n=useDisablePointToPointMeasurement(),o=useDisablePreciseMeasurement(),a=useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(at);null==t||t.clearEntities()})),l=useActionCallback((()=>async(e={})=>{await a(),n(e),o()})),i=useActionCallback((({set:e,reset:n})=>async o=>{await l(),"point-to-point"===o?t():(n(ot),n(it),e(nt,!0))}));return{disableEditMeasurement:useActionCallback((()=>async e=>{await l(e)})),enableEditMeasurement:useActionCallback((()=>async e=>{await i(e)})),resetMeasurement:useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(nt),o=await e.getPromise(Je);n?await a():o&&(t(Qe),t(et))})),clearEditedPointToPointMeasurement:useActionCallback((({reset:e})=>()=>{e(et)})),setEditedPointToPointMeasurement:useActionCallback((({set:e})=>t=>{e(et,t)})),toggleEditPointToPointMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(Je)?await l():await i("point-to-point"),e.disable()})),toggleEditPreciseMeasurement:useActionCallback((({snapshot:t})=>async()=>{const n=undefined;await t.getPromise(nt)?await l():await i("precise"),e.disable()}))}}function useEnablePointToPointMeasurement(){return useActionCallback((({reset:e,set:t})=>(n={})=>{t(Je,!0),n.keepExistingMeasurement||e(Qe)}))}function useDisablePointToPointMeasurement(){return useActionCallback((({reset:e})=>(t={})=>{e(Je),t.keepExistingMeasurement||(e(et),e(Qe))}))}function useDisablePreciseMeasurement(){return useActionCallback((({reset:e})=>async()=>{e(nt),e(ot),e(it)}))}const rt=n.selector({key:"isEditingMeasurement",get:({get:e})=>e(Je)||e(nt)}),ct=n.selector({key:"measurementPanelModel",get:({get:e})=>e(Qe)||e(ot)}),dt=n.selector({key:"measurementPanelOverlays",dangerouslyAllowMutability:!0,get:({get:e})=>e(lt)}),ut=n.selector({key:"measurementPanelMessage",get:({get:e})=>{const t=undefined;return e(nt)?e(st):void 0}}),mt=n.selector({key:"measurementPanelIsResettable",get:({get:e})=>e(rt)&&null!=e(ct)});var pt=Object.freeze({__proto__:null,editedPointToPointMeasurement:et,isEditingMeasurement:rt,isEditingPointToPointMeasurement:Je,isEditingPreciseMeasurement:nt,measurementPanelIsResettable:mt,measurementPanelMessage:ut,measurementPanelOutcome:ct,measurementPanelOverlays:dt,pointToPointMeasurementOutcome:Qe,preciseMeasurementController:at,preciseMeasurementEntities:it,preciseMeasurementMessage:st,preciseMeasurementOutcome:ot,preciseMeasurementOverlays:lt,useDisablePointToPointMeasurement:useDisablePointToPointMeasurement,useDisablePreciseMeasurement:useDisablePreciseMeasurement,useEnablePointToPointMeasurement:useEnablePointToPointMeasurement,useMeasurementActions:useMeasurementActions,usePointToPointMeasurement:usePointToPointMeasurement,usePreciseMeasurementModel:usePreciseMeasurementModel});const ht="Scene Alteration Performance";var xt;!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"}(xt||(xt={}));var ft=Object.freeze({__proto__:null,SCENE_ALTERATION_PERFORMANCE:ht,get SceneAlterationPerformanceType(){return xt}});const gt=n.atom({key:"fetchedItemInvalidator",default:0}),vt=n.selectorFamily({key:"fetchedItems",get:e=>async({get:t})=>{var n;const o=t(G),a=t(X);if(t(gt),t(en),null!=a)try{return await(null===(n=null==o?void 0:o.sceneItems)||void 0===n?void 0:n.getSceneViewItem(e,a,{includeOverride:!0,includeWorldTransform:!0}))}catch(t){return void logger_debug(`Error encountered get scene view item. [itemId={${e}}]`,t)}}}),yt=n.atomFamily({key:"selectionSelectedItems",default:void 0}),bt=n.atom({key:"selectionSelectedItemIds",default:[]}),wt=n.atom({key:"selectionLastSelected",default:void 0}),Ct=n.atom({key:"selectionLastSelectionFromViewer",default:!1}),St=n.atom({key:"selectionLastSelectWasMultiSelect",default:!1}),Vt=n.selector({key:"selectionHasMultipleSelected",get:({get:e})=>{const t=e(wt),n=undefined;return e(bt).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}}),jt=n.atom({key:"selectionFirstSelectedItemInTreeId",default:void 0}),kt=n.selector({key:"selectionHighestSelectedAncestor",get:({get:e})=>{var t,n;const o=e(wt),a=e(bt);return null!==(n=null===(t=null==o?void 0:o.ancestors)||void 0===t?void 0:t.find((e=>a.includes(e))))&&void 0!==n?n:null==o?void 0:o.id}}),Tt=n.atom({key:"selectionPreviousVisibleSummary",default:void 0}),At=n.atom({key:"selectionVisibleSummary",default:void 0}),Pt=n.selector({key:"selectionVisibleCount",get:({get:e})=>{var t,n;return null!==(n=null===(t=e(At))||void 0===t?void 0:t.count)&&void 0!==n?n:0}}),It=n.selector({key:"selectionBoundingBoxCenter",get:({get:e})=>{const t=e(At);return null!=(null==t?void 0:t.boundingBox)?o.BoundingBox.center(t.boundingBox):o.Vector3.origin()}}),Mt=n.selector({key:"selectionIsActive",get:({get:e})=>{const t=e(bt),n=undefined;return e(Pt)>0||t.length>0}}),Et=n.selector({key:"fetchedAndSelectedItems",get:async({get:e})=>{const t=e(bt),n=undefined;return null!=e(X)?t.map((t=>e(vt(t)))):[]}}),Rt=n.atom({key:"selectionModelViewsSelected",default:void 0});function useSceneViewItemActions(){return{invalidateCachedItems:useActionCallback((({set:e})=>()=>{e(gt,(e=>e+1))}))}}var Nt=Object.freeze({__proto__:null,fetchedItem:vt,fetchedItemInvalidator:gt,useSceneViewItemActions:useSceneViewItemActions});const Ot=n.atom({key:"lengthUnit",default:"cm"}),Lt=n.atom({key:"decimalPlace",default:"2"});var _t=Object.freeze({__proto__:null,decimalPlace:Lt,lengthUnit:Ot}),Bt,Dt;!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"}(Dt||(Dt={}));const convertFrom=(e,t)=>{const n=undefined;return e/Dt[t]},convertTo=(e,t)=>{const n=undefined;return e*Dt[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:l}=e;return{position:o.Vector3.create(convertTo(n.x,t),convertTo(n.y,t),convertTo(n.z,t)),rotation:a,scale:l}}function convertTransformFromUnits(e,t){const{position:n,rotation:a,scale:l}=e;return{position:o.Vector3.create(convertFrom(n.x,t),convertFrom(n.y,t),convertFrom(n.z,t)),rotation:a,scale:l}}function toValidTransform(e){const{position:t,rotation:n,scale:o}=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:o||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)),o=parseFloat(Math.sqrt(e[2]**2+e[6]**2+e[10]**2).toFixed(2));return t===n&&n===o?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 zt={position:o.Vector3.create(0,0,0),rotation:o.Vector3.create(0,0,0),scale:1},Ft=n.atom({key:"transformWidgetEnabled",default:!1}),Ht=n.atom({key:"transformWidgetPosition",default:void 0}),Ut=n.atom({key:"transformWidgetOrientationOverride",default:void 0}),Wt=n.selector({key:"transformWidgetOrientation",get:({get:e})=>{const t=e(Ut),n=e(wt);if(null!=t)return t;if(null!=n){const t=e(Qt(n.id));return o.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})}}}),Gt=n.atom({key:"transformWidgetCachedOrientation",default:void 0}),Kt=n.atom({key:"transformWidgetSyncToSelection",default:!1}),$t=n.atom({key:"transformWidgetIsInteracting",default:!1}),qt=n.atomFamily({key:"appliedItemTransform",default:void 0}),Yt=n.atom({key:"appliedItemTransformIds",default:[]}),Xt=n.atom({key:"selectedCoordinateSpace",default:"world"}),Zt=n.atomFamily({key:"editedItemTransform",default:void 0}),Jt=n.selectorFamily({key:"displayedItemTransform",get:e=>({get:t})=>{if(null!=e){const n=t(Xt),o=t(Ot),a=t(Qt(e)),l=t(Zt(e));if(null!=l)return l.transform;if(null!=a)return pickLocalOrWorldTransform(mapItemTransforms(a,(e=>convertTransformToUnits(e,o))),n)}},set:e=>({get:t,set:o},a)=>{if(null!=e){const l=t(Xt),i=t(tn(e)),s=t(Qt(e)),r=t(Ot);if(null!=s&&!(a instanceof n.DefaultValue)&&null!=a&&null!=i){o(Zt(e),{coordinateSpace:l,units:r,transform:a});const n=makeItemTransforms(convertTransformFromUnits(toValidTransform(a),r),i,l),s=t(Yt);o(qt(e),n),o(Yt,[...s,e])}}}}),Qt=n.selectorFamily({key:"fetchedItemTransforms",get:e=>({get:t})=>{var n,o;const a=t(vt(e));if(null!=a){const e=(null===(n=a.override)||void 0===n?void 0:n.transform)?toTransformFromApiMatrix(null===(o=a.override)||void 0===o?void 0:o.transform):void 0,t=a.worldTransform?toTransformFromApiMatrix(a.worldTransform):void 0;return{local:null!=e?e:zt,world:null!=t?t:zt}}}}),en=n.atom({key:"transformInvalidator",default:0}),tn=n.selectorFamily({key:"parentItemWorldMatrix",get:e=>({get:t})=>{const n=t(X);if(null!=e&&null!=n){const n=t(vt(e));if(null!=(null==n?void 0:n.parentId)){const e=t(Qt(n.parentId)),o=t(qt(n.parentId));if(null==e)throw new Error("Invalid state. Parent item state should be populated, but is undefined.");return null!=o?i.toMatrix(i.toRadiansTransform(o.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.`),o.Matrix4.makeIdentity()}});function useUpdateEditedTransformWhenSettingsChange(e){const t=n.useRecoilValue(Ot),o=n.useRecoilValue(Xt),l=n.useRecoilValue(qt(null!=e?e:"")),[i,s]=n.useRecoilState(Zt(null!=e?e:""));a.useEffect((()=>{if(null!=l&&((null==i?void 0:i.coordinateSpace)!==o||(null==i?void 0:i.units)!==t)){const e=undefined,n=convertTransformToUnits(pickLocalOrWorldTransform(l,o),t);s({units:t,coordinateSpace:o,transform:n})}}),[t,o])}function useEditItemTransform(e){const t=useTransformActions();useUpdateEditedTransformWhenSettingsChange(e);const o=n.useRecoilValueLoadable(tn(e)),[a,l]=n.useRecoilStateLoadable(Jt(e));return{transform:"hasValue"===a.state?a.contents:void 0,loading:"loading"===a.state||"loading"===o.state,error:"hasError"===a.state?a.contents:void 0,async update(n){t.enableSelectionSync(),l(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(It);e(Ht,n)})),a=useActionCallback((({set:e,snapshot:t})=>async()=>{const o=await t.getPromise(Ht),a=await t.getPromise(St),l=await t.getPromise(bt),i=await t.getPromise(Pt);null==o&&(l.length>0||a||i>0)&&await n(),e(Kt,!0)})),l=useActionCallback((({set:e})=>async t=>{e(Ht,null!=t?t:void 0)})),s=useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async()=>{const o=await e.getPromise(Wt),a=undefined;(await e.getPromise(Yt)).forEach((e=>{n(qt(e)),n(Zt(e))})),n(Yt),null!=o&&t(Gt,o),t(en,(e=>e+1))}))),r=useActionCallback((({set:e,reset:t})=>n=>{t(Gt),e(Ut,n)})),c=useActionCallback((({set:e})=>()=>{e(Ht,void 0),e(Ft,!1)}));return{enableTransformWidget:useActionCallback((({set:t})=>async(o,i)=>{e.setToastMessage({message:"Transform manipulator enabled! Select parts to interact.",duration:L}),t(Ft,!0),i?await n():null==o?await a():await l(o)})),disableTransformWidget:useActionCallback((({reset:e})=>()=>{e(Ft),e(Ut)})),setTransformWidgetOrientation:r,clearTransformWidgetOrientation:useActionCallback((({reset:e})=>()=>{e(Gt),e(Ut)})),setTransformWidgetPosition:l,clearTransformWidgetPosition:useActionCallback((({reset:e})=>()=>e(Ht))),invalidateTransforms:s,setIsInteractivelyTransforming:useActionCallback((({set:e})=>t=>{e($t,t)})),setDefaultWidgetPosition:a,setDefaultWidgetPositionToSelection:n,enableSelectionSync:useActionCallback((({set:e})=>()=>e(Kt,!0))),disableSelectionSync:useActionCallback((({reset:e})=>()=>e(Kt))),syncToSelection:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(Tt),n=await e.getPromise(At),a=undefined;if(await e.getPromise(Kt)){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 l(o.BoundingBox.center(e))}})),orientToHitResult:useActionCallback((({reset:e})=>async t=>{e(Kt),null==(null==t?void 0:t.annotationId)&&(null!=t?await l(null==t?void 0:t.position):(e(Ht),r(void 0)))})),clearSelectedTransforms:useActionCallback((()=>async()=>{await t.execute(xt.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.withSelected())).clearTransforms())),await s(),c()})),clearAllTransforms:useActionCallback((()=>async()=>{await t.execute(xt.CLEAR_SELECTED_TRANSFORMS,(e=>e.where((e=>e.all())).clearTransforms())),await s(),c()})),applyTransformToItem:useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(G),a=await(null==n?void 0:n.scene()),l=await e.getPromise(qt(t));if(null==l)return void logger_warn(`There is no transform to apply to item ${t}.`);const s=o.Matrix4.transpose(i.toMatrix(i.toRadiansTransform(null==l?void 0:l.local)));return null==a?void 0:a.items((e=>e.where((e=>e.withItemId(t))).transform(s))).execute()}))}};var nn=Object.freeze({__proto__:null,appliedItemTransformIds:Yt,appliedItemTransforms:qt,convertTransformFromUnits:convertTransformFromUnits,convertTransformToUnits:convertTransformToUnits,displayedItemTransform:Jt,editedItemTransform:Zt,fetchedItemTransforms:Qt,identityTransform:zt,makeItemTransforms:makeItemTransforms,mapItemTransforms:mapItemTransforms,parentItemWorldMatrix:tn,pickLocalOrWorldTransform:pickLocalOrWorldTransform,selectedCoordinateSpace:Xt,toValidTransform:toValidTransform,transformInvalidator:en,transformWidgetCachedOrientation:Gt,transformWidgetEnabled:Ft,transformWidgetIsInteracting:$t,transformWidgetOrientation:Wt,transformWidgetOrientationOverride:Ut,transformWidgetPosition:Ht,transformWidgetSyncToSelection:Kt,useEditItemTransform:useEditItemTransform,useTransformActions:useTransformActions});const useHitActions=()=>{const e=useCrossSectioningActions(),t=useMeasurementActions(),n=useTransformActions(),o=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const n=await e.tryGetPromise(Me).then((e=>e.value)),o=await e.getPromise(et);null==n&&null!=(null==o?void 0:o.start)&&null!=o.end&&await t.resetMeasurement()}))),a=useActionCallback(retainSnapshot((({snapshot:e})=>async()=>{const t=await e.tryGetPromise(Me).then((e=>e.value));await n.orientToHitResult(t)}))),l=useActionCallback(retainSnapshot((({set:e,snapshot:t})=>async()=>{const n=await t.tryGetPromise(Me).then((e=>e.value));e(Ge,n)}))),i=useActionCallback(retainSnapshot((({snapshot:e,set:t})=>async()=>{t(Ie,await e.tryGetPromise(Me).then((e=>e.value)))})));return{tap:useActionCallback(retainSnapshot((({snapshot:t,set:n})=>async({detail:s},...r)=>{const c=await t.getPromise(rt),d=await t.getPromise(xe),u=2!==(null==s?void 0:s.buttons)&&!(null==s?void 0:s.altKey);s.altKey||s.ctrlKey||s.metaKey||s.shiftKey;const m=u&&!d.hitPending&&!c,p=await t.tryGetPromise(Me).then((e=>e.value));n(Pe,p),n(Te,s),await o(),m&&(r.forEach((e=>e())),await a()),await l(),await e.sectionCurrentHit(),await i()}))),longPress:useActionCallback(retainSnapshot((({snapshot:e,set:t,reset:n})=>async o=>{n(Te),t(Ae,o.detail),await e.tryGetPromise(Me),await l(),await i()})))}},on=n.selector({key:"viewerToolkitHitState",get:({get:e})=>{const t=undefined,n=undefined,o=undefined,a=undefined,l=undefined;return{tapDetails:e(Te),longPressDetails:e(Ae),previousHitResult:e(Pe),currentHitResult:e(Ie)}}});var an=Object.freeze({__proto__:null,currentHitResult:Ie,hitResult:Me,hitResultsLongPressDetails:Ae,hitResultsSkipNextTap:Ee,hitResultsTapDetails:Te,hitState:on,previousHitResult:Pe,useHitActions:useHitActions});const ln=n.atomFamily({key:"modelViewsCursor",default:void 0}),sn=n.atomFamily({key:"pmiAnnotationsCursor",default:void 0}),rn=n.atomFamily({key:"loadedModelViews",default:[]}),cn=n.atomFamily({key:"loadedPmiAnnotations",default:[]}),dn=n.atomFamily({key:"visiblePmiAnnotations",default:[]}),un=n.selector({key:"modelViewsSceneItemName",get:async({get:e})=>{var t;const n=e(Rt);if(null!=n){const o=e(vt(n.id));return null!==(t=null==o?void 0:o.name)&&void 0!==t?t:void 0}}}),mn=n.atom({key:"loadedItemModelView",default:void 0}),pn=n.selectorFamily({key:"nextModelViews",get:e=>async({get:t})=>{var n;const o=t(G),a=t(ln(e));return await(null===(n=null==o?void 0:o.modelViews)||void 0===n?void 0:n.listByItem(e,{cursor:a,size:100,hasAnnotations:!0}))}}),hn=n.selectorFamily({key:"modelViews",get:e=>({get:t})=>{var n;const o=t(rn(e)),a=t(pn(e));return o.flatMap((e=>e.modelViews)).concat(null!==(n=null==a?void 0:a.modelViews)&&void 0!==n?n:[])}}),xn=n.selectorFamily({key:"hasMoreModelViews",get:e=>({get:t})=>{const n=t(pn(e));return null!=(null==n?void 0:n.paging.next)}}),fn=n.selectorFamily({key:"nextPmiAnnotations",get:e=>async({get:t})=>{var n;const o=t(G),a=t(sn(e));return null===(n=null==o?void 0:o.pmi)||void 0===n?void 0:n.listAnnotations({modelViewId:e,cursor:a,size:100})}}),gn=n.selectorFamily({key:"pmiAnnotations",get:e=>({get:t})=>{const n=undefined;return t(cn(e)).flatMap((e=>e.annotations))}}),vn=n.selectorFamily({key:"hasMorePmiAnnotations",get:e=>({get:t})=>{const n=undefined;return null!=t(sn(e))}}),yn=n.atom({key:"selectedPmiAnnotationId",default:void 0});function useSceneAnnotationsOperations(){const e=a.useCallback((async(e,t,n)=>{const o=await(null==t?void 0:t.scene());null==n?await(null==o?void 0:o.elements((t=>e(t.annotations.where((e=>e.all()))))).execute()):n.length>0&&await(null==o?void 0:o.elements((t=>e(t.annotations.where((e=>e.withAnnotationIds(n)))))).execute())}),[]),t=a.useCallback((async(e,t)=>{const n=await(null==e?void 0:e.scene());null==n||n.elements((e=>[e.annotations.where((e=>e.all())).deselect(),e.annotations.where((e=>e.withAnnotationIds([t]))).select()])).execute()}),[]),n=a.useCallback((async e=>{const t=await(null==e?void 0:e.scene());null==t||t.elements((e=>[e.annotations.where((e=>e.all())).deselect()])).execute()}),[]);return{sceneAnnotationsOperation:e,selectOnlyAnnotation:t,clearAnnotationSelection:n}}function usePmiAnnotationActions(){const e=useSceneAnnotationsOperations(),t=useActionCallback((({snapshot:e,set:t})=>async n=>{var o;const a=await e.getPromise(fn(n));if(null!=a){t(cn(n),(e=>[...e,a])),t(dn(n),(e=>[...e,...a.annotations]));const e=null===(o=null==a?void 0:a.paging)||void 0===o?void 0:o.next;t(sn(n),null!=e?()=>e:()=>{})}})),n=useActionCallback((({snapshot:e})=>async o=>{const a=document.getElementById(`annotation-entry-${o}`);if(null!=a)a.scrollIntoView();else{const a=await e.getPromise(mn),l=null==a?void 0:a.modelView.id;if(null==l)return;const i=undefined;await e.getPromise(vn(l))&&(await t(l),await n(o))}}));return{fetchInitialPmiAnnotations:useActionCallback((({snapshot:e})=>async n=>{const o=undefined;0===(await e.getPromise(gn(n))).length&&await t(n)})),fetchNextPmiAnnotations:useActionCallback((()=>async e=>{await t(e)})),selectPmiAnnotation:useActionCallback((({set:t,snapshot:o})=>async(a,l)=>{t(yn,a);const i=await o.getPromise(G);null!=i&&await(null==e?void 0:e.selectOnlyAnnotation(i,a)),l&&await n(a)})),clearPmiAnnotationSelection:useActionCallback((({reset:t,snapshot:n})=>async()=>{const o=await n.getPromise(yn),a=await n.getPromise(G);null!=o&&null!=a&&(t(yn),await(null==e?void 0:e.clearAnnotationSelection(a)))})),scrollToSelectedPmiAnnotation:n}}const bn=n.atom({key:"sceneTreeLoaderVisible",default:!1}),wn=n.atom({key:"sceneTreeElement",default:void 0}),Cn=n.atom({key:"sceneTreeController",default:void 0,dangerouslyAllowMutability:!0}),Sn=n.atom({key:"sceneTreeOpenPopover",default:void 0}),Vn=n.selectorFamily({key:"sceneTreePopoverIsOpen",get:e=>({get:t})=>t(Sn)===e});function useSceneTreeActions(){const e=useSelectionActions(),t=useViewerCameraActions();return{toggleSelection:useActionCallback((({snapshot:t})=>async(n,o,a)=>{var l,i;if(!n.defaultPrevented&&0===n.button&&(n.altKey||((n.ctrlKey||n.metaKey)&&o.selected?await a.deselectItem(o):o.selected?await a.selectItem(o,{recurseParent:!0}):o.selected||await a.selectItem(o,{append:n.ctrlKey||n.metaKey,range:n.shiftKey})),null!=o.id)){const a=await t.getPromise(wt);e.syncSelection({id:null===(l=o.id)||void 0===l?void 0:l.hex,ancestors:null!==(i=null==a?void 0:a.ancestors)&&void 0!==i?i:[]},{selected:!n.metaKey&&!n.ctrlKey||!o.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 o;const a=await e.getPromise(wn),l=await(null==a?void 0:a.getRowAtClientY(n));null!=(null===(o=null==l?void 0:l.node.id)||void 0===o?void 0:o.hex)&&await t.flyToById(l.node.id.hex)})),flyToFirstSelectedItem:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(wn),n=await e.getPromise(jt);null!=n&&(null==t||t.scrollToItem(n))})),setContextMenuItem:useActionCallback((({set:e,snapshot:t})=>async n=>{const o=await t.getPromise(wn),a=await(null==o?void 0:o.getRowAtClientY(n));e(Ge,a)})),openSceneTreePopover:useActionCallback((({set:e})=>t=>{e(Sn,t)})),closeSceneTreePopover:useActionCallback((({set:e})=>()=>{e(Sn,void 0)}))}}var jn=Object.freeze({__proto__:null,sceneTreeController:Cn,sceneTreeElement:wn,sceneTreeLoaderVisible:bn,sceneTreeOpenPopover:Sn,sceneTreePopoverIsOpen:Vn,useSceneTreeActions:useSceneTreeActions});function useSelectionActions(){const e=usePmiAnnotationActions(),t=useSceneViewItemActions(),n=useTransformActions(),o=useViewerSceneActions(),a=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(bt)).forEach((e=>t(yt(e))))})),l=useActionCallback((({snapshot:e,reset:t,set:n})=>async(a,l)=>{var i,s;const r=await e.getPromise(yt(a.id)),c=await e.getPromise(bt),d=null===(s=[...null!==(i=a.ancestors)&&void 0!==i?i:[]])||void 0===s?void 0:s.reverse().find((e=>!c.includes(e)));null!=r&&null!=d?(n(yt(d),{id:d}),n(bt,(e=>[...e,d])),await o.execute(xt.SELECTING_ANCESTOR,o.selectItemsTransform(d))):(null==l?void 0:l.clear)?(n(yt(a.id),a),n(bt,[a.id]),await o.execute(xt.SELECTING_ONLY_ITEM,o.clearSelectionTransform,o.selectItemsTransform(a.id))):(n(yt(a.id),a),n(bt,(e=>[...e,a.id])),await o.execute(xt.SELECTING_ITEMS,o.selectItemsTransform(a.id))),m(a),n(wt,a),n(Ct,!0),t(St);try{const t=await e.getPromise(wn);await(null==t?void 0:t.scrollToItem(a.id))}catch(e){logger_debug(`The scene item was not found in the tree. [itemId={${a.id}}]`)}})),i=useActionCallback((({reset:e,set:t})=>async n=>{e(yt(n)),e(St),t(bt,(e=>e.filter((e=>e!==n)))),await o.execute(xt.DESELECTING_ITEMS,o.deselectItemsTransform(n))})),s=useActionCallback((({snapshot:e})=>async t=>{const n=await e.getPromise(yt(t.id));null!=n?await i(n.id):await l(t)})),r=useActionCallback((({snapshot:o,reset:a,set:i})=>async(s,r={})=>{const c=await o.getPromise(yt(s.id)),d=await o.getPromise(bt);if(d.filter((e=>{var t;return e!==s.id&&!(null===(t=s.ancestors)||void 0===t?void 0:t.includes(e))})).forEach((e=>a(yt(e)))),a(St),c)if(r.ignoreAncestorSelection)a(bt),a(yt(c.id));else{const e=d.filter((e=>{var t;return e===s.id||(null===(t=s.ancestors)||void 0===t?void 0:t.includes(e))}));i(bt,e)}else a(bt);t.invalidateCachedItems(),n.clearTransformWidgetOrientation(),await e.clearPmiAnnotationSelection(),await l(s,{clear:!0})})),c=useActionCallback((({reset:t})=>async()=>{await a(),t(bt),t(wt),t(Ct),t(St),n.clearTransformWidgetPosition(),n.clearTransformWidgetOrientation(),await e.clearPmiAnnotationSelection()})),d=useActionCallback((()=>async()=>{await c(),await o.execute(xt.CLEAR_SELECTION,o.clearSelectionTransform)})),u=useActionCallback((({set:e})=>async t=>{e(St,t)})),m=useActionCallback((({set:e,snapshot:t})=>async n=>{const o=await t.getPromise(Rt);(null==o?void 0:o.id)!==(null==n?void 0:n.id)&&e(Rt,n)}));return{select:l,toggleSelection:s,clearAndSelect:r,selectCurrentHit:useActionCallback(retainSnapshot((({snapshot:t})=>async()=>{const n=await t.tryGetPromise(Me).then((e=>e.value)),o=await t.getPromise(Te),a=(null==o?void 0:o.metaKey)||(null==o?void 0:o.ctrlKey)||(null==o?void 0:o.shiftKey);null!=(null==n?void 0:n.annotationId)?await e.selectPmiAnnotation(n.annotationId,!0):null==n||a?null!=n&&a?await s(n):await d():await r(n)}))),syncSelection:useActionCallback((({set:e,reset:t})=>async(n,o)=>{o.selected?(await a(),e(yt(n.id),n),o.multiSelect?e(bt,(e=>[...e.filter((e=>e!==n.id)),n.id])):e(bt,[n.id]),await m(n),e(wt,n),e(Ct,!1),e(St,!!o.multiSelect)):(t(yt(n.id)),t(St),e(bt,(e=>e.filter((e=>e!==n.id)))))})),deselect:i,clearSelection:d,resetSelectionState:c,toggleLastSelectWasMultiSelect:u,selectForModelViewsPanel:m}}const kn=n.selector({key:"viewerToolkitSelectionState",get:({get:e})=>{const t=undefined,n=undefined,o=undefined,a=undefined;return{selectedItemIds:e(bt),lastSelected:e(wt),highestSelectedAncestorId:e(kt)}}});var Tn=Object.freeze({__proto__:null,fetchedAndSelectedItems:Et,selectionBoundingBoxCenter:It,selectionFirstSelectedItemInTreeId:jt,selectionHasMultipleSelected:Vt,selectionHighestSelectedAncestor:kt,selectionIsActive:Mt,selectionLastSelectWasMultiSelect:St,selectionLastSelected:wt,selectionLastSelectionFromViewer:Ct,selectionModelViewsSelected:Rt,selectionPreviousVisibleSummary:Tt,selectionSelectedItemIds:bt,selectionSelectedItems:yt,selectionState:kn,selectionVisibleCount:Pt,selectionVisibleSummary:At,useSelectionActions:useSelectionActions});function createColorMaterialWithId(e,t=j.create()){return Object.assign({id:t},i.ColorMaterial.fromHex(e))}const An=255,Pn=18,In=n.atom({key:"sceneItemAdjustmentsSelectedColor",default:void 0}),Mn=n.atom({key:"sceneItemAdjustmentsRecentColors",default:[]}),En=n.atom({key:"sceneItemAdjustmentsCustomColors",default:[createColorMaterialWithId("#ffffff"),createColorMaterialWithId("#616161")]}),Rn=n.atom({key:"sceneItemAdjustmentsSelectedOpacity",default:void 0}),Nn=n.atomFamily({key:"appliedItemMaterialOverride",default:void 0}),On=n.atom({key:"appliedItemMaterialOverrideIds",default:[]}),Ln=n.selector({key:"sceneItemAdjustmentsLastSelectedOverride",get:({get:e})=>{const t=e(wt);if(null!=t)return e(Nn(t.id))}}),_n=n.atom({key:"applyMaterialToAllUserAction",default:void 0}),Bn=n.atom({key:"showConfirmDialogWhenApplyingMaterialToAll",default:!0}),Dn=n.atom({key:"confirmApplyMaterialToAllDialogOpen",default:!1}),useSceneItemMaterialActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=await e.getPromise(On);t(In),n.forEach((e=>t(Nn(e)))),t(On)}));return{updateColor:useActionCallback((({set:e})=>t=>{e(In,t)})),saveRecentColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const o=await t.getPromise(Mn),a=[n,...o.filter((e=>e!==n))],l=a.length>Pn?a.slice(0,-(a.length-Pn)):a;e(In,n),e(Mn,l)})),removeRecentColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const o=undefined,a=(await t.getPromise(Mn)).filter((e=>e.id!==n));e(Mn,a)})),setCustomColors:useActionCallback((({set:e})=>async t=>{e(En,t)})),saveCustomColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const o=undefined,a=[...await t.getPromise(En),n],l=a.length>Pn?a.slice(a.length-Pn):a;e(In,n),e(En,l)})),removeCustomColor:useActionCallback((({set:e,snapshot:t})=>async n=>{const o=undefined,a=(await t.getPromise(En)).filter((e=>e.id!==n));e(En,a)})),clearCurrentColor:useActionCallback((({reset:e})=>()=>{e(In)})),clearCurrentOpacity:useActionCallback((({reset:e})=>()=>{e(Rn)})),clear:useActionCallback((({snapshot:t,set:n,reset:o})=>async()=>{const a=await t.getPromise(bt);o(In),a.forEach((e=>o(Nn(e)))),n(On,(e=>e.filter((e=>!a.includes(e))))),await e.execute(xt.CLEAR_SELECTED_MATERIAL_OVERRIDES,(e=>e.where((e=>e.withSelected())).clearMaterialOverrides().select()))})),clearAll:useActionCallback((()=>async()=>{await t(),await e.execute(xt.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(Rn,t)})),apply:useActionCallback((({snapshot:t,set:n})=>async()=>{const o=await t.getPromise(In),a=await t.getPromise(Rn),l=await t.getPromise(bt),i=await t.getPromise(Ln),s=null!=o?o:i,r=null!=a?a:null==i?void 0:i.opacity;if(null!=s){const t=Object.assign(Object.assign({},s),{opacity:null!=r?r:s.opacity});await e.execute(xt.APPLY_MATERIAL_OVERRIDE_TO_SELECTION,(e=>e.where((e=>e.withSelected())).materialOverride(t))),l.forEach((e=>n(Nn(e),t))),n(On,(e=>[...e,...l]))}})),confirmApplyAll:useActionCallback((({set:e})=>t=>{e(Dn,!0),e(_n,(()=>t))})),cancelApplyAll:useActionCallback((({reset:e})=>()=>{e(Dn),e(_n)})),applyAll:useActionCallback((({snapshot:t,reset:n})=>async()=>{const o=await t.getPromise(In),a=await t.getPromise(Rn);if(null!=o){const l=await t.getPromise(On),i=Object.assign(Object.assign({},o),{opacity:null!=a?a:o.opacity});await e.execute(xt.APPLY_MATERIAL_OVERRIDE_TO_ALL,(e=>e.where((e=>e.all())).materialOverride(i))),l.forEach((e=>n(Nn(e))));const s=await t.getPromise(_n);null==s||s(i),n(Dn),n(_n)}})),hideConfirmApplyAllDialog:useActionCallback((({set:e})=>()=>{e(Bn,!1)}))}},zn="#ffff00",Fn=35,Hn=1,Un=n.atom({key:"selectionHighlightingSelectedColor",default:zn}),Wn=n.atom({key:"selectionHighlightingSelectedOpacity",default:Fn}),Gn=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 Kn="#FFFFFF",$n=n.atom({key:"viewerBackgroundSelectedColor",default:Kn});var qn=Object.freeze({__proto__:null,DEFAULT_FEATURE_EDGE_COLOR:De,DEFAULT_FEATURE_EDGE_THICKNESS_VALUE:Be,DEFAULT_SELECTION_HIGHLIGHTING_COLOR:zn,DEFAULT_SELECTION_HIGHLIGHTING_LINE_THICKNESS:1,DEFAULT_SELECTION_HIGHLIGHTING_OPACITY:Fn,DEFAULT_VIEWER_BACKGROUND_COLOR:Kn,MAXIMUM_MATERIAL_OVERRIDE_OPACITY:An,MAX_STORED_COLOR_ARRAY_LENGTH:Pn,appliedItemMaterialOverride:Nn,appliedItemMaterialOverrideIds:On,applyMaterialToAllUserAction:_n,confirmApplyMaterialToAllDialogOpen:Dn,elementHasColorAttribute:elementHasColorAttribute,elementIsColorSwatch:elementIsColorSwatch,featureEdgesLineThickness:Fe,featureEdgesSelectedColor:ze,sceneItemAdjustmentsCustomColors:En,sceneItemAdjustmentsLastSelectedOverride:Ln,sceneItemAdjustmentsRecentColors:Mn,sceneItemAdjustmentsSelectedColor:In,sceneItemAdjustmentsSelectedOpacity:Rn,selectionHighlightingSelectedColor:Un,selectionHighlightingSelectedLineThickness:Gn,selectionHighlightingSelectedOpacity:Wn,showConfirmDialogWhenApplyingMaterialToAll:Bn,useSceneItemMaterialActions:useSceneItemMaterialActions,viewerBackgroundSelectedColor:$n});const VertexSceneItemMaterialApplyAll=({onApplyAll:t})=>{const o=useSceneItemMaterialActions(),a=n.useRecoilValueLoadable(Ln),i=n.useRecoilValue(In),s=n.useRecoilValue(Bn),r=u.useMemo((()=>"hasValue"===a.state?null!=i?i:a.contents:i),[a,i]);return e.jsx(l.VertexTooltip,{content:"Apply to All",children:e.jsx(l.VertexIconButton,{iconName:"square-dot-outline",iconSize:"sm",color:"secondary",disabled:null==r,onClick:async()=>{s?o.confirmApplyAll(t):(await o.applyAll(),null==t||t(r))}})})};function SceneItemMaterialApplyAllConfirmationDialog(){const t=useSceneItemMaterialActions(),o=n.useRecoilValue(Dn),[i,s]=a.useState(!1),onCloseDialog=()=>{t.cancelApplyAll(),s(!1)};return o?e.jsxs(l.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(l.VertexToggle,{"data-testid":"hide-confirmation-dialog-in-future-checkbox",variant:"check",className:"pt-0.5",checked:i,onValueChanged:e=>{s(e.detail)}}),"Don't show again this session"]}),e.jsxs("div",{className:"flex ml-auto gap-2",children:[e.jsx(l.VertexButton,{"data-testid":"cancel-apply-material-to-all",onClick:onCloseDialog,children:"Cancel"}),e.jsx(l.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 o=useSceneItemMaterialActions(),a=n.useRecoilValueLoadable(Ln),l=n.useRecoilValue(In),i=u.useMemo((()=>"hasValue"===a.state?null!=l?l:a.contents:l),[a,l]);return e.jsx(VertexColorPicker,{"data-testid":"selected-item-color-picker",value:null!=i?f.toHexString(i.diffuse):void 0,onValueChanged:async()=>{null!=i&&(await o.apply(),null==t||t(i),await o.saveRecentColor(createColorMaterialWithId(f.toHexString(i.diffuse))))},onInput:async e=>{o.updateColor(createColorMaterialWithId(e)),await o.apply()}})},ColorSwatch=t=>{var{color:n,hideTooltip:o,onClick:a}=t,i=__rest(t,["color","hideTooltip","onClick"]);const s="string"==typeof n?n:f.toHexString(n.diffuse);return e.jsx(l.VertexTooltip,{className:"flex-grow-0",content:s,disabled:!!o,children:e.jsx("button",{onClick:()=>null==a?void 0:a(n),children:e.jsx(l.VertexColorSwatch,Object.assign({"data-testid":`color-swatch-${s}`,variant:"square",color:s},i))})})},VertexSceneItemMaterialColorSwatches=({onAddCustomColor:t,onApplyCustomColor:o,onApplyRecentColor:a})=>{const i=useSceneItemMaterialActions(),s=n.useRecoilValue(En),r=n.useRecoilValue(Mn),c=s.length===Pn;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:[s.map((t=>e.jsx(ColorSwatch,{color:t,onClick:async()=>{i.updateColor(t),await i.apply(),null==o||o(t)},"data-custom-color":!0,"data-color-id":t.id},t.id))),!c&&e.jsx(l.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(l.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==a||a(t)},"data-recent-color":!0,"data-color-id":t.id},t.id)))})]})},VertexSceneItemMaterialOpacitySlider=({onApply:t})=>{const o=useSceneItemMaterialActions(),a=n.useRecoilValue(Rn),i=n.useRecoilValueLoadable(Ln),s=u.useMemo((()=>{var e,t;return"hasValue"===i.state?null!==(t=null!=a?a:null===(e=i.contents)||void 0===e?void 0:e.opacity)&&void 0!==t?t:An:null!=a?a:An}),[a,i]),r=useDebouncedCallback((()=>{o.apply()}),500),c=u.useCallback((e=>{o.updateOpacity(e.detail.value),r(e.detail.value)}),[r,o]),d=u.useMemo((()=>"hasValue"!==i.state||null==i.contents),[i]);return e.jsx(l.VertexTooltip,{className:"flex w-full",content:d?"Select a part and apply a color to enable opacity":`${Math.floor(s/An*100)}%`,placement:"top",children:e.jsx(VertexSlider,{"data-testid":"scene-item-adjustments-opacity-slider",leftLabel:"0%",rightLabel:"100%",disabled:d,value:null!=s?s:An,step:5,min:0,max:An,onValueChange:e=>{o.updateOpacity(e.detail.value),o.apply(),null==t||t(e.detail.value)},onValueInput:c})})};function VertexMaterialControls({customColors:t,onApplyMaterial:o,onApplyMaterialToAll:l,onAddCustomColor:i,onApplyCustomColor:s,onApplyRecentColor:r,onApplyOpacity:c}){const d=useSceneItemMaterialActions(),u=n.useRecoilValue(wt);return a.useEffect((()=>{d.clearCurrentColor(),d.clearCurrentOpacity()}),[null==u?void 0:u.id]),a.useEffect((()=>{if(null!=t){const e=t.map((e=>Object.assign(Object.assign({},e),{id:j.create()})));d.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:o}),e.jsx(VertexSceneItemMaterialApplyAll,{onApplyAll:l})]})]}),e.jsx("div",{className:"pt-4 pb-2 text-sm text-neutral-700",children:"Color Swatches"}),e.jsx(VertexSceneItemMaterialColorSwatches,{onAddCustomColor:i,onApplyCustomColor:s,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:o})=>{const[i,s]=a.useState(!1);return e.jsx("div",{className:"ml-auto",children:e.jsxs(l.VertexDropdownMenu,{className:"flex items-stretch h-full","data-testid":`reset-button-dropdown-menu-${t}`,placement:"bottom-end",onMenuOpened:()=>s(!0),onMenuClosed:()=>s(!1),children:[e.jsx("div",{slot:"anchor",className:"flex items-center h-full",children:e.jsx(l.VertexTooltip,{content:n,disabled:i,placement:"bottom",children:e.jsxs(l.VertexButton,{className:_e("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(l.VertexIcon,{className:"px-0.5",name:"reset",size:"sm"}),e.jsx(l.VertexIcon,{name:"chevron-down",size:"sm"})]})})}),e.jsx("div",{className:"whitespace-nowrap",children:o})]})})},VertexSceneItemMaterialClear=({onClear:t,onClearAll:o})=>{const a=useSceneItemMaterialActions(),i=n.useRecoilValue(Mt);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(l.VertexMenuItem,{"data-testid":"clear-selected-materials",onClick:()=>{a.clear(),null==t||t()},disabled:!i,children:"Clear selected materials"}),e.jsx(l.VertexMenuItem,{"data-testid":"clear-all-materials",onClick:()=>{a.clearAll(),null==o||o()},children:"Clear all materials"})]})})};function VertexMaterialPanelSection({customColors:t,onClearMaterial:n,onClearAllMaterials:o,onApplyMaterial:a,onApplyMaterialToAll:l,onAddCustomColor:i,onApplyCustomColor:s,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:o})]}),children:e.jsx(VertexMaterialControls,{customColors:t,onApplyMaterial:a,onApplyMaterialToAll:l,onAddCustomColor:i,onApplyCustomColor:s,onApplyRecentColor:r,onApplyOpacity:c})})}const VertexSelectionHighlightingColorPicker=({onUpdate:t})=>{const[o,a]=n.useRecoilState(Un);return e.jsx(VertexColorPicker,{"data-testid":"selection-highlighting-color-picker",value:o,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})},VertexSelectionHighlightingLineThicknessSlider=({onUpdate:t})=>{const[o,a]=n.useRecoilState(Gn);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:o,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},VertexSelectionHighlightingOpacitySlider=({onUpdate:t})=>{const[o,a]=n.useRecoilState(Wn);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:o,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})};function VertexSelectionHighlightingControls({onUpdateSelectionHighlightColor:t,onUpdateSelectionHighlightOpacity:n,onUpdateSelectionHighlightLineThickness:o}){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:o})]})}const VertexSelectionHighlightingReset=({onReset:t})=>{const[o,a]=n.useRecoilState(Un),[i,s]=n.useRecoilState(Wn),[r,c]=n.useRecoilState(Gn),d=o!==zn||i!==Fn||1!==r;return e.jsx("div",{className:"ml-auto",children:e.jsx(l.VertexTooltip,{content:"Reset Selection Highlighting",children:e.jsx(l.VertexIconButton,{"data-testid":"selection-highlighting-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(zn),s(Fn),c(1),null==t||t()},disabled:!d})})})};function VertexSelectionHighlightingPanelSection({onResetSelectionHighlighting:t,onUpdateSelectionHighlightColor:n,onUpdateSelectionHighlightOpacity:o,onUpdateSelectionHighlightLineThickness:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Selection Highlighting",e.jsx(VertexSelectionHighlightingReset,{onReset:t})]}),children:e.jsx(VertexSelectionHighlightingControls,{onUpdateSelectionHighlightColor:n,onUpdateSelectionHighlightOpacity:o,onUpdateSelectionHighlightLineThickness:a})})}const VertexViewerBackgroundColorPicker=({onUpdate:t})=>{const[o,a]=n.useRecoilState($n);return e.jsx(VertexColorPicker,{"data-testid":"viewer-background-color-picker",value:o,onValueChanged:e=>{null==t||t(e.detail)},onInput:e=>a(e)})};function VertexViewerBackgroundControls({onUpdateViewerBackgroundColor:t}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Color"}),e.jsx(VertexViewerBackgroundColorPicker,{onUpdate:t})]})}const VertexViewerBackgroundReset=({onReset:t})=>{const[o,a]=n.useRecoilState($n),i=o!==Kn;return e.jsx("div",{className:"ml-auto",children:e.jsx(l.VertexTooltip,{content:"Reset Background Color",children:e.jsx(l.VertexIconButton,{"data-testid":"viewer-background-reset",iconName:"reset",iconSize:"sm",onClick:()=>{a(Kn),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,o=e instanceof HTMLElement&&"true"===e.contentEditable,a=e instanceof HTMLElement&&"VERTEX-SCENE-TREE-SEARCH"===e.tagName,l=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement,i=e instanceof HTMLElement&&"VERTEX-VIEWER-PIN-TOOL"===e.tagName,s=e instanceof HTMLElement&&"VERTEX-VIEWER-TRANSFORM-WIDGET"===e.tagName;return t||n||o||a||l||i||s},useRecoilReducer=({reducer:e,atom:t})=>{const o=undefined,a=undefined;return[n.useRecoilValue(t),useRecoilReducerDispatch({reducer:e,atom:t})]},useRecoilReducerDispatch=({reducer:e,atom:t})=>{const o=n.useRecoilCallback((({set:n})=>async o=>{n(t,(t=>e(t,o)))}),[]);return o},Yn=n.atom({key:"keyBindings",default:{applyBindings:[],bindings:{},pressed:{}}});function reducer(e,t){var n,o,a,l;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!==(o=e.bindings[t.binding.keyBind])&&void 0!==o?o:[],t.binding]})});case"remove-key-binding":const s=undefined;return null==(null===(a=e.bindings[t.binding.keyBind])||void 0===a?void 0:a.find((e=>e.id===t.binding.id)))?e:Object.assign(Object.assign({},e),{bindings:Object.assign(Object.assign({},e.bindings),{[t.binding.keyBind]:(null!==(l=e.bindings[t.binding.keyBind])&&void 0!==l?l:[]).filter((e=>e.id!==t.binding.id))})});case"add-apply-key-binding":return Object.assign(Object.assign({},e),{applyBindings:[...e.applyBindings,t.binding]});case"remove-apply-key-binding":return Object.assign(Object.assign({},e),{applyBindings:e.applyBindings.filter((e=>e.id!==t.id))});case"set-key-pressed":return Object.assign(Object.assign({},e),{applyBindings:e.applyBindings.map((t=>Object.assign(Object.assign({},t),{active:null!=t.keyBind&&allPressed(t.keyBind,e.pressed)}))),pressed:Object.assign(Object.assign({},e.pressed),{[t.key]:t.pressed}),lastPressed:t.pressed?t.key:void 0})}}const useKeyBindingState=()=>useRecoilReducer({reducer:reducer,atom:Yn}),useKeyBindingReadonlyState=()=>n.useRecoilValue(Yn);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 o;return null!=e.keyBind&&null!=n&&(null===(o=e.keyBind)||void 0===o?void 0:o.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 o=j.create();return n({type:"add-apply-key-binding",binding:Object.assign(Object.assign({},e),{id:o,active:null!=e.keyBind&&allPressed(e.keyBind,t.pressed)})}),()=>{n({type:"remove-apply-key-binding",id:o})}}),[e.fn,e.off,e.keyBind,e.repeat])},useStackKeyBinding=(e,t=[])=>{const[,n]=useKeyBindingState();a.useEffect((()=>{const t=null==e.addPredicate||e.addPredicate(),o=null!=e.cancelPredicate&&e.cancelPredicate();t&&n({type:"push-key-binding",binding:e}),o&&n({type:"remove-key-binding",binding:e})}),t)},useKeyBindings=({keydownRepeatInterval:e=25,keydownIgnorePredicate:t=isInputElement}={})=>{const[n,o]=useKeyBindingState(),l=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(),o({type:"remove-key-binding",binding:a}))}))}),[n]);a.useEffect((()=>{const handleKeyDown=e=>{if(!e.repeat&&!t(e.target)){o({type:"set-key-pressed",key:e.key,pressed:!0}),l(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=>{o({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)}}),[l,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(),o=n.useRecoilValue(Ye);return useStackKeyBinding({id:"ExitBoxSelection",keyBind:"Escape",fn:t.disable,addPredicate:()=>o,cancelPredicate:()=>!o},[o]),e.jsx(l.VertexTooltip,{content:"Box Selection",children:e.jsx(l.VertexIconButton,{iconName:"box-cursor",iconColor:o?"primary":"secondary","data-testid":"viewer-toolbar-enable-box-selection-button",onClick:o?t.disable:t.enable})})},Xn=1,VertexResizableContent=t=>{var{className:n,style:o,displayShadow:a,heading:i,id:s,initialScale:r,placement:c="left",children:d,onResize:u}=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(l.VertexResizable,Object.assign({id:s,"data-testid":`resizable-content-position-${c}`,className:_e(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&&a,"border-l min-w-75 max-w-half":"right"===c,"sidebar-shadow-left":"right"===c&&a,"border-t bottom-0 fixed":"top"===c,"min-h-12 sheet":h}),style:Object.assign({maxHeight:"top"===c?window.innerHeight:void 0},o),initialHorizontalScale:p?r:void 0,initialVerticalScale:h?f:void 0,horizontalDirection:getHorizontalResizeDirection(),verticalDirection:getVerticalResizeDirection(),position:"right"===c||"top"===c?"absolute":"relative",onResizeEnd:()=>null==u?void 0:u()},m,{children: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:_e("w-full flex flex-col h-0 flex-grow",{"right-0":"right"===c}),children:d})]})}))};function useDefaultKeybindings(){useApplyKeyBinding({fn:useActionCallback((({snapshot:e})=>async()=>{const t=await e.getPromise(G),n=await(null==t?void 0:t.scene()),o={milliseconds:500};await(null==n?void 0:n.camera().viewAll().render({animation:o}))})),keyBind:"f"})}function useLongPress({target:e,callback:t,delay:n=500,onMovement:a}){const[l,i]=u.useState(),[s,r]=u.useState();u.useEffect((()=>{const handleTouchStart=e=>{const a=e;null!=a.touches&&1===a.touches.length&&(null!=l&&clearTimeout(l),r(o.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!=l&&null!=s&&o.Point.distance(s,o.Point.create(t.touches[0].clientX,t.touches[0].clientY))>=2&&(clearTimeout(l),null==a||a())},handleTouchEnd=()=>{null!=l&&clearTimeout(l)};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,l,s])}var Zn=Object.freeze({__proto__:null,isInputElement:isInputElement,keyBindings:Yn,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:o,disableBackdrop:i,openPredicate:s,onOpen:r,onClose:c,children:d})=>{const u=useContextMenuActions(),m=n.useRecoilValue(He),p=n.useRecoilValue($e),h=a.useMemo((()=>["bottom-end","top-start","top-end","right","left"]),[]),f=m===o;useStackKeyBinding({id:"ContextMenu",keyBind:"Escape",fn:u.clearActiveContextMenu,addPredicate:()=>null!=m&&m===o,cancelPredicate:()=>null==m},[m]);const g=a.useMemo((()=>null!=t?t:null!=s?window:void 0),[t,s]);return useLongPress({target:g,callback:e=>u.longPress(e,o,s,r),onMovement:()=>u.clearActiveContextMenu()}),a.useEffect((()=>{const handleWindowPointerDown=e=>{const t=undefined;if(!targetWithinMenu(e)&&2!==e.buttons&&m===o){const t=targetShouldSkipNextHit(e);u.clearActiveContextMenu(t)}};if(i)return window.addEventListener("pointerdown",handleWindowPointerDown),()=>{window.removeEventListener("pointerdown",handleWindowPointerDown)}}),[i,o,m]),a.useEffect((()=>{const handlePointerDown=e=>{u.pointerDown(e)},handlePointerUp=e=>{u.pointerUp(e,o,s,r)},handleContextMenu=e=>u.contextMenu(e,s);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,o,s]),e.jsx("div",{className:_e({hidden:!f}),children:e.jsx(l.VertexMenu,{"data-testid":`${o}-context-menu`,open:asBooleanAttribute(f),position:p,fallbackPlacements:h,backdrop:!i,onMenuClosed:()=>{u.clearActiveContextMenu(),null==c||c()},children:e.jsx("div",{className:"pt-1",children:d})})})},VertexFitSelectedMenuItem=()=>{const t=n.useRecoilValue(bt),o=n.useRecoilValue(At),a=useViewerCameraActions();return e.jsx(l.VertexMenuItem,{"data-testid":"fit-selected-menu-option",onClick:async()=>{null!=(null==o?void 0:o.boundingBox)&&await a.flyToByBoundingBox(o.boundingBox)},disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.VertexIcon,{slot:"icon",name:"fit-selected",size:"sm"}),"Fit Selected"]})})},VertexFlyToMenuItem=()=>{const t=useViewerCameraActions(),o=n.useRecoilValue(Ge);return e.jsx(l.VertexMenuItem,{"data-testid":"fly-to-part-menu-option",onClick:async()=>{var e;const n=undefined,a=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!=a&&await t.flyToById(a)},disabled:asBooleanAttribute(null==o),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.VertexIcon,{slot:"icon",name:"paper-airplane",size:"sm"}),"Fly To"]})})};function useSceneItemsOperations(){const e=n.useRecoilValue(G),t=undefined,o=undefined,l=undefined,i=undefined,s=undefined,r=undefined;return{sceneItemsOperation:a.useCallback((async(t,n)=>{const o=await(null==e?void 0:e.scene());null==n?await(null==o?void 0:o.items((e=>t(e.where((e=>e.all()))))).execute()):n.length>0&&await(null==o?void 0:o.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.jsx(l.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(l.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide All Parts"]})})},VertexHidePartMenuItem=()=>{const t=n.useRecoilValue(Ge),o=useSceneItemsOperations();return e.jsx(l.VertexMenuItem,{"data-testid":"hide-menu-option",onClick:async()=>{var e;const n=undefined,a=contextMenuItemIsRow(t)?null===(e=null==t?void 0:t.node.id)||void 0===e?void 0:e.hex:t.id;null!=a&&await o.sceneItemsOperation((e=>e.hide()),[a])},disabled:asBooleanAttribute(null==t),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide Part"]})})},VertexHideSelectedMenuItem=()=>{const t=n.useRecoilValue(bt),o=useSceneItemsOperations();return e.jsx(l.VertexMenuItem,{"data-testid":"hide-selected-menu-option",onClick:()=>o.hideSelected(),disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.VertexIcon,{slot:"icon",name:"visibility-hidden",size:"sm"}),"Hide Selected"]})})},VertexShowAllMenuItem=()=>{const t=useSceneItemsOperations();return e.jsx(l.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(l.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show All Parts"]})})},VertexShowOnlyMenuItem=()=>{const t=n.useRecoilValue(Ge),o=useSceneItemsOperations();return e.jsx(l.VertexMenuItem,{"data-testid":"show-only-menu-option",onClick:async()=>{var e;const n=undefined,a=contextMenuItemIsRow(t)?null===(e=null==t?void 0:t.node.id)||void 0===e?void 0:e.hex:null==t?void 0:t.id;null!=a&&await o.showOnlyItem(a)},disabled:asBooleanAttribute(null==t),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show Only Part"]})})},VertexShowOnlySelectedMenuItem=()=>{const t=n.useRecoilValue(bt),o=useSceneItemsOperations();return e.jsx(l.VertexMenuItem,{"data-testid":"show-only-selected-menu-option",onClick:()=>o.showOnlySelected(),disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),"Show Only Selected"]})})},Jn=n.atom({key:"openedPanelActivePrimaryLeft",default:void 0}),Qn=n.atom({key:"openedPanelActivePrimaryRight",default:void 0}),eo=n.atom({key:"openedPanelActiveSceneTreeSecondary",default:void 0});function usePanelActions(){return{openPrimary:useActionCallback((({set:e})=>(t,n)=>{e("left"===n?Jn:Qn,t)})),closePrimary:useActionCallback((({set:e})=>t=>{e("left"===t?Jn:Qn,void 0)})),openSecondary:useActionCallback((({set:e})=>t=>e(eo,t))),closeSecondary:useActionCallback((({reset:e})=>()=>e(eo)))}}var to=Object.freeze({__proto__:null,openedPanelActivePrimaryLeft:Jn,openedPanelActivePrimaryRight:Qn,openedPanelActiveSceneTreeSecondary:eo,usePanelActions:usePanelActions});const VertexShowPropertiesMenuItem=()=>{const t=usePanelActions(),o=useSelectionActions(),a=n.useRecoilValue(Ge);return e.jsx(l.VertexMenuItem,{"data-testid":"show-properties-menu-option",disabled:asBooleanAttribute(null==a),onClick:()=>{var e;const n=undefined,l=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!=l&&(o.clearAndSelect({id:l}),t.openSecondary("Properties"))},children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.VertexIcon,{slot:"icon",name:"info",size:"sm"}),"Show Properties"]})})};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,o,a;let l="";switch(null==e?void 0:e.type){case"string":l=null!==(t=e.value)&&void 0!==t?t:l;break;case"long":l=null!==(n=e.value.toString())&&void 0!==n?n:l;break;case"double":l=null!==(o=e.value.toString())&&void 0!==o?o:l;break;case"timestamp":l=null!==(a=e.value.seconds.toLocaleString())&&void 0!==a?a:l}return l}const no=n.atom({key:"showMetadataSceneItemProperties",default:!0}),oo=n.selectorFamily({key:"nextMetadataSceneItemProperties",get:e=>async({get:t})=>{var n,o,a;const l=t(G),i=t(lo(e));try{const t=await(null===(n=null==l?void 0:l.sceneItems)||void 0===n?void 0:n.listSceneItemMetadata(e,{cursor:i,size:20})),s=null===(o=null==t?void 0:t.entries)||void 0===o?void 0:o.map((e=>fromApiProperty(e))),r=undefined;return{metadata:null!=s?null===(a=[...s])||void 0===a?void 0:a.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)}}}),ao=n.atomFamily({key:"loadedMetadataSceneItemProperties",default:[]}),lo=n.atomFamily({key:"metadataSceneItemPropertiesCursor",default:void 0}),io=n.selectorFamily({key:"hasMoreMetadataSceneItemProperties",get:e=>({get:t})=>{const n=undefined;return null!=t(lo(e))}}),so=n.atomFamily({key:"isFetchingMetadataSceneItemProperties",default:!1}),ro=n.selector({key:"metadataSceneItemName",get:async({get:e})=>{var t;const n=e(wt);if(null!=n){const o=e(vt(n.id));return null!==(t=null==o?void 0:o.name)&&void 0!==t?t:void 0}}});var co=Object.freeze({__proto__:null,apiMetadataPropertyDisplayValue:apiMetadataPropertyDisplayValue,fromApiProperty:fromApiProperty,hasMoreMetadataSceneItemProperties:io,isFetchingMetadataSceneItemProperties:so,loadedMetadataSceneItemProperties:ao,metadataSceneItemName:ro,metadataSceneItemPropertiesCursor:lo,nextMetadataSceneItemProperties:oo,showMetadataSceneItemProperties:no});const VertexGhostSelectedMenuItem=()=>{const t=n.useRecoilValue(bt),o=useSceneItemsOperations();return e.jsx(l.VertexMenuItem,{"data-testid":"ghost-selected-menu-option",onClick:()=>o.ghostSelected(),disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.VertexIcon,{slot:"icon",name:"visibility-partial",size:"sm"}),"Ghost Selected"]})})};function BetaLabel({children:t,label:n="Beta",placement:o="end",borderColor:a="border-purple-400",textColor:l="text-purple-500"}){return e.jsxs("div",{className:"flex items-center",children:[t,e.jsx("div",{className:_e(`flex border ${a} rounded-md px-1.5 text-xs ${l} uppercase items-center justify-center ml-2 select-none max-h-5`,{"ml-auto":"end"===o}),style:{height:"fit-content"},children:n})]})}const VertexShowModelViewsMenuItem=()=>{const t=usePanelActions(),o=useSelectionActions(),a=n.useRecoilValue(Ge);return e.jsx(l.VertexMenuItem,{"data-testid":"viewer-show-model-views",disabled:asBooleanAttribute(null==a),onClick:async()=>{var e;const n=undefined,l=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!=l&&(t.openPrimary("model-views","right"),o.selectForModelViewsPanel({id:l}))},children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.VertexIcon,{slot:"icon",name:"views",size:"sm"}),e.jsxs("div",{className:"flex gap-2",children:["Show Model Views ",e.jsx(BetaLabel,{})]})]})})},VertexUnghostSelectedMenuItem=()=>{const t=n.useRecoilValue(bt),o=useSceneItemsOperations();return e.jsx(l.VertexMenuItem,{"data-testid":"unghost-selected-menu-option",onClick:()=>o.unGhostSelected(),disabled:asBooleanAttribute(0===t.length),children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.VertexIcon,{slot:"icon",name:"visibility-visible",size:"sm"}),"Unghost Selected"]})})},DefaultSceneTreeContextMenu=()=>{const t=n.useRecoilValue(no);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(l.VertexMenuDivider,{}),e.jsx(VertexFitSelectedMenuItem,{}),e.jsx(VertexFlyToMenuItem,{}),e.jsx(l.VertexMenuDivider,{}),t&&e.jsx(VertexShowPropertiesMenuItem,{}),e.jsx(VertexShowModelViewsMenuItem,{})]})},VertexSceneTreeContextMenu=({children:t})=>{const o=useSceneTreeActions(),a=n.useRecoilValue(wn),l=null!=t&&!1!==t;return e.jsx(VertexContextMenu,{menuType:"scene-tree",targetElement:a,onOpen:async(e,t)=>{const n=e;await o.setContextMenuItem(n.clientY)},disableBackdrop:!0,children:l?t:e.jsx(DefaultSceneTreeContextMenu,{})})},DefaultViewerContextMenu=()=>{const t=n.useRecoilValue(no);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(l.VertexMenuDivider,{}),e.jsx(VertexFitSelectedMenuItem,{}),e.jsx(VertexFlyToMenuItem,{}),e.jsx(l.VertexMenuDivider,{}),t&&e.jsx(VertexShowPropertiesMenuItem,{}),e.jsx(VertexShowModelViewsMenuItem,{})]})},VertexViewerContextMenu=({children:t})=>{const n=null!=t&&!1!==t,o=a.useCallback((e=>e.target instanceof HTMLElement&&"vertex-viewer"===e.target.id),[]);return e.jsx(VertexContextMenu,{menuType:"viewer",disableBackdrop:!0,openPredicate:o,children:n?t:e.jsx(DefaultViewerContextMenu,{})})},uo=35,mo=n.atom({key:"sceneItemGhostingSelectedOpacity",default:uo}),po=n.atomFamily({key:"appliedItemPhantomState",default:void 0}),ho=n.atom({key:"appliedItemPhantomStateIds",default:[]}),xo=n.selector({key:"sceneItemGhostingLastSelectedPhantom",get:({get:e})=>{var t;const n=e(wt);return null!=n&&(null!==(t=e(po(n.id)))&&void 0!==t&&t)}}),VertexSceneItemGhostingOpacitySlider=({onApply:t})=>{const[o,a]=n.useRecoilState(mo);return e.jsx(VertexSlider,{id:"phantom-opacity","data-testid":"phantom-opacity-slider",leftLabel:"0%",rightLabel:"100%",min:0,max:100,step:5,value:o,valueLabelDisplay:"auto",onValueInput:e=>{a(e.detail.value)},onValueChange:e=>{null==t||t(e.detail.value)}})},useSceneItemPhantomActions=()=>{const e=useViewerSceneActions(),t=useActionCallback((({snapshot:e,reset:t})=>async()=>{const n=undefined;(await e.getPromise(ho)).forEach((e=>t(po(e)))),t(ho)}));return{setPhantomState:useActionCallback((({snapshot:t,set:n})=>async o=>{const a=await t.getPromise(bt);a.forEach((e=>n(po(e),o))),n(ho,(e=>[...e,...a])),await e.execute(xt.SET_PHANTOM_SELECTED_ITEMS,(e=>e.where((e=>e.withSelected())).setPhantom(o)))})),clearPhantomState:useActionCallback((({snapshot:t,set:n,reset:o})=>async()=>{const a=await t.getPromise(bt);a.forEach((e=>o(po(e)))),n(ho,(e=>e.filter((e=>!a.includes(e))))),await e.execute(xt.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(xt.CLEAR_PHANTOM_ALL,(e=>e.where((e=>e.all())).clearPhantom()),(e=>e.where((e=>e.withSelected())).select()))})),resetAllPhantomState:t}};var fo=Object.freeze({__proto__:null,DEFAULT_GHOSTING_OPACITY:uo,appliedItemPhantomState:po,appliedItemPhantomStateIds:ho,sceneItemGhostingLastSelectedPhantom:xo,sceneItemGhostingSelectedOpacity:mo,useSceneItemPhantomActions:useSceneItemPhantomActions});const VertexSceneItemGhostingToggle=({onApply:t})=>{const o=useSceneItemPhantomActions(),a=n.useRecoilValue(Mt),i=n.useRecoilValueLoadable(xo);return e.jsx(l.VertexTooltip,{content:"Select a part to display as ghost",disabled:a,children:e.jsx(l.VertexToggle,{className:"flex items-center","data-testid":"phantom-state-toggle",variant:"switch",disabled:!a,checked:"hasValue"===i.state&&i.contents,onValueChanged:async e=>{await o.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:o})=>{const a=useSceneItemPhantomActions(),i=n.useRecoilValue(xo);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(l.VertexMenuItem,{"data-testid":"reset-selected-phantom",onClick:async()=>{await a.clearPhantomState(),null==t||t()},disabled:!i,children:"Clear ghosting for selected"}),e.jsx(l.VertexMenuItem,{"data-testid":"reset-all-phantom",onClick:async()=>{await a.clearAllPhantomState(),null==o||o()},children:"Clear ghosting for all"})]})})};function VertexGhostingPanelSection({onClearGhostState:t,onClearAllGhostState:n,onApplyGhostingChange:o,onApplyOpacity:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Ghosting",e.jsx(VertexSceneItemGhostingClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexGhostingControls,{onApplyGhostingChange:o,onApplyOpacity:a})})}function VertexMeasurementContextMenu({onDelete:t}){const o=n.useRecoilValue(We);return e.jsx(VertexContextMenu,{menuType:"measurement",openPredicate:e=>e.target instanceof HTMLElement&&"VERTEX-VIEWER-MEASUREMENT-DISTANCE"===e.target.tagName,children:e.jsxs(l.VertexMenuItem,{"data-testid":"measurement-delete",onClick:()=>null!=o&&t(o.id),children:[e.jsx(l.VertexIcon,{slot:"icon",name:"delete",size:"sm"}),e.jsx("div",{className:"pl-2",children:"Delete"})]})})}function useDockedPlacement(e,t){const[n,a]=u.useState(o.Point.create(0,0));return u.useLayoutEffect((()=>{if(null!=e){const n=e.getBoundingClientRect(),l=o.Point.create(n.left,n.bottom),i=o.Point.create(n.right,n.bottom);a("left"===t?l:i)}}),[e,t]),n}function VertexMeasurementDetails({placement:t,size:o}){const a=useMeasurementActions(),i=n.useRecoilValue(G),r=n.useRecoilValue(K),c=useDockedPlacement(null!=i?i:null,t),d=n.useRecoilValue(ct),u=n.useRecoilValue(dt),m=n.useRecoilValue(ut),p=n.useRecoilValue(mt),h=n.useRecoilValue(Ot),f=n.useRecoilValue(Lt);return e.jsx(l.VertexDraggablePopover,{className:"z-popover",boundaryPadding:16,boundarySelector:`#${r}`,position:c,children:e.jsxs("div",{className:_e("flex flex-col min-w-40",{"text-xs leading-2":"sm"===o,"text-sm leading-4":"md"===o,"text-base leading-5":"lg"===o,"text-lg leading-5":"xl"===o}),children:[e.jsxs("div",{className:"pb-2 flex justify-between items-center",children:[e.jsx("div",{className:_e("w-full",{"text-sm leading-5":"sm"===o,"text-base leading-5":"md"===o,"text-lg leading-6":"lg"===o,"text-xl leading-7 mr-6":"xl"===o}),children:"Measurement"}),e.jsx("div",{className:_e("mr-0.5",{hidden:!p}),children:e.jsx(l.VertexTooltip,{content:"Reset",placement:"left-start",children:e.jsx(l.VertexIconButton,{"data-testid":"measurement-details-reset",iconName:"reset",iconSize:"sm",onClick:a.resetMeasurement})})})]}),e.jsx(s.VertexViewerMeasurementDetails,{"data-testid":"measurement-details-viewer-measurement-details",className:_e("gap-y-1.5",{hidden:null==d}),measurementOutcome:d,measurementOverlays:u,distanceUnits:toUnitType(h),fractionalDigits:parseInt(f,10)}),e.jsx("div",{"data-testid":"measurement-details-message",className:_e({hidden:null==m}),children:m})]})})}function useCallbackRef(e){var t;const[n,o]=a.useState(null!==(t=null==e?void 0:e.override)&&void 0!==t?t:null),l=a.useCallback((t=>{var n;return o(null!==(n=null==e?void 0:e.override)&&void 0!==n?n:t)}),[]);return{element:n,callback:l}}function VertexPointToPointMeasurement({detailsPlacement:t,detailsSize:o,onPointToPointMeasurementChange:l}){const i=useMeasurementActions(),r=n.useRecoilValue(G),c=n.useRecoilValue(Je),d=n.useRecoilValue(et),u=n.useRecoilValue(Ot),m=n.useRecoilValue(Lt),{callback:p,element:h}=useCallbackRef();usePointToPointMeasurement(h);const f=a.useCallback((e=>{const t={start:e.detail.start,end:e.detail.end,invalid:!e.detail.valid};i.setEditedPointToPointMeasurement(t),null==l||l(t)}),[i]);return c?e.jsxs(e.Fragment,{children:[e.jsx(s.VertexViewerMeasurementDistance,{"data-testid":"point-to-point-measurement",ref:p,viewer:null!=r?r:void 0,mode:"replace",start:null==d?void 0:d.start,end:null==d?void 0:d.end,invalid:null==d?void 0:d.invalid,units:toUnitType(u),fractionalDigits:parseInt(m,10),showAxisReferenceLines:!0,onEditEnd:f}),e.jsx(VertexMeasurementDetails,{placement:t,size:o}),e.jsx(VertexMeasurementContextMenu,{onDelete:i.resetMeasurement})]}):e.jsx(e.Fragment,{})}function VertexPointToPointMeasurementTool(){const t=useMeasurementActions(),o=n.useRecoilValue(Je);return useStackKeyBinding({id:"ExitMeasurement",keyBind:"Escape",fn:t.disableEditMeasurement,addPredicate:()=>o,cancelPredicate:()=>!o},[o,t]),e.jsx(l.VertexTooltip,{content:"Point to Point Measurement",children:e.jsx(l.VertexIconButton,{iconName:"tape-measure","data-testid":"viewer-toolbar-point-to-point-measurement-button",iconColor:o?"primary":"secondary",onClick:t.toggleEditPointToPointMeasurement})})}const go=n.atom({key:"viewerToolkitSdkConfig",default:void 0});var vo=Object.freeze({__proto__:null,sdkConfig:go});const VertexPreciseMeasurement=({detailsPlacement:t,detailsSize:o,onEntitiesChanged:a,onOutcomeChanged:l})=>{var i,r,c,d;const u=n.useRecoilValue(G),m=n.useRecoilValue(go),p=n.useRecoilValue(nt),{callback:h,element:f}=useCallbackRef();return usePreciseMeasurementModel(f,a,l),p?e.jsxs(e.Fragment,{children:[e.jsx(s.VertexViewerMeasurementPrecise,{"data-testid":"precise-measurement-viewer-tool",ref:h,viewer:null!=u?u: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===(d=null==m?void 0:m.network)||void 0===d?void 0:d.sceneViewHost}})}),e.jsx(VertexMeasurementDetails,{placement:t,size:o})]}):e.jsx(e.Fragment,{})};function VertexPreciseMeasurementTool(){const t=useMeasurementActions(),o=n.useRecoilValue(nt);return e.jsx(l.VertexTooltip,{content:"Precise Measurement",children:e.jsx(l.VertexIconButton,{iconName:"ruler","data-testid":"viewer-toolbar-precise-measurement-button",iconColor:o?"primary":"secondary",onClick:t.toggleEditPreciseMeasurement})})}function VertexApplicationMessages(){const t=n.useRecoilValue(F),o=n.useRecoilValue(D);return e.jsxs(e.Fragment,{children:[null!=t&&e.jsx(l.VertexBanner,{className:"z-[16000]",duration:t.duration,open:!0,content:t.message,type:t.type},t.id),null!=o&&e.jsx(l.VertexToast,{placement:"bottom-left",className:"z-[16000]",duration:o.duration,open:!0,content:o.message,type:o.type},o.id)]})}const yo={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 bo=n.atom({key:"sceneTreeColumnsRefreshTrigger",default:0}),wo=n.atom({key:"sceneTreeColumnsWhitelistedColumns",default:[]}),Co=n.selector({key:"sceneTreeColumnsAvailableColumns",get:async({get:e})=>{const t=e(Cn);return e(bo),null!=t?await t.fetchMetadataKeys():[]}}),So=n.selector({key:"sceneTreeColumnsAvailableSortedColumns",get:({get:e})=>e(Co).filter((e=>e!==yo.metadataKeyName)).sort(((e,t)=>e.localeCompare(t)))}),Vo=n.atom({key:"sceneTreeColumnsVisibleMetadataColumnNames",default:[]}),jo=n.selector({key:"sceneTreeColumnsActiveColumns",get:({get:e})=>{const t=e(Vo),n=e(wn),o=null==n?void 0:n.clientWidth;if(null!=o&&o>0){const e=1/(t.length+1)*o,n=(o-e)/t.length;return t.reduce(((e,t)=>{const o=mapToColumn(t,n);return Object.assign(Object.assign({},e),{[o.label]:o})}),{Name:Object.assign(Object.assign({},yo),{initialWidth:e,minWidth:n})})}return{Name:yo}}}),ko=n.selector({key:"sceneTreeColumnsActiveColumnNames",get:({get:e})=>Object.keys(e(jo))});function useSceneTreeColumnActions(){return{setActive:useActionCallback((({set:e})=>async t=>{e(Vo,t)})),refreshKeyList:useActionCallback((({set:e})=>()=>{e(bo,(e=>e+1))}))}}const To=16,Ao=-8;var Po;function useOpenPositionedPopover({open:e,buttonElement:t,horizontalOffset:n,verticalOffset:o}){const[a,l]=u.useState(),[i,s]=u.useState(),r=undefined;return{position:a,direction:i,handleOpen:u.useCallback((()=>{if(!e){const e=null==t?void 0:t.getBoundingClientRect();if(null!=e){const t=null!=n?n:To,a=null!=o?o:Ao,i=e.x>window.innerWidth/2?Po.LEFT:Po.RIGHT;l({x:i===Po.LEFT?e.left-t:e.right+t,y:e.top+a}),s(i)}}}),[e,t])}}!function(e){e.LEFT="left",e.RIGHT="right"}(Po||(Po={}));var Io=Object.freeze({__proto__:null,DEFAULT_HORIZONTAL_POSITION_OFFSET:To,DEFAULT_NAME_COLUMN:yo,DEFAULT_VERTICAL_POSITION_OFFSET:Ao,get PlacementDirection(){return Po},mapToColumn:mapToColumn,sceneTreeColumnsActiveColumnNames:ko,sceneTreeColumnsActiveColumns:jo,sceneTreeColumnsAvailableColumns:Co,sceneTreeColumnsAvailableSortedColumns:So,sceneTreeColumnsRefreshTrigger:bo,sceneTreeColumnsVisibleMetadataColumnNames:Vo,sceneTreeColumnsWhitelistedColumns:wo,useOpenPositionedPopover:useOpenPositionedPopover,useSceneTreeColumnActions:useSceneTreeColumnActions});const Mo=n.atom({key:"sceneTreeSearchActive",default:!1}),Eo=n.atom({key:"sceneTreeColumnsPartial",default:!1}),Ro=n.atom({key:"sceneTreeSearchValue",default:void 0}),No=n.atom({key:"sceneTreeSearchExactMatch",default:!1}),Oo=n.atom({key:"sceneTreeSearchRemoveHiddenItems",default:!1}),Lo=n.atom({key:"sceneTreeSearchResultCount",default:0}),_o=n.atom({key:"sceneTreeSearchActiveColumns",default:[]}),Bo=n.selector({key:"sceneTreeSearchNameColumnActive",get:({get:e})=>{const t=e(_o);return 0===t.length||t.includes(yo.metadataKeyName)}});function useSceneTreeSearch({sceneTreeElement:e}){const t=useSceneTreeActions(),o=n.useRecoilValue(Mo),l=n.useSetRecoilState(Lo),i=n.useSetRecoilState(jt);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)&&l(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 o&&t.flyToFirstSelectedItem()}))})),()=>{null==n||n.dispose()}}}),[e,null==e?void 0:e.controller,open])}function useSceneTreePartialResults({sceneTreeElement:e}){const t=n.useSetRecoilState(Eo);a.useEffect((()=>{let n;return whenComponentReady(e,(()=>{var o;n=null===(o=null==e?void 0:e.controller)||void 0===o?void 0:o.stateChanged((e=>{t(!!(null==e?void 0:e.isPartialKeysResponse))}))})),()=>{null==n||n.dispose()}}),[e])}const useSceneTreeSearchActions=()=>{const e=useActionCallback((({set:e})=>t=>{e(_o,t)})),t=useActionCallback((({snapshot:t})=>async(n,o,a,l)=>{const i=await t.getPromise(wn),s=await t.getPromise(No),r=await t.getPromise(Oo),c=await t.getPromise(_o),d=c.length>0?o?[...c,n]:c.filter((e=>e!==n)):[...a,yo.metadataKeyName].filter((e=>e!==n));e(d),l&&(null==i||i.filterItems(l,{columns:d,exactMatch:s,removeHiddenItems:r}))})),n=useActionCallback((({snapshot:e,set:t})=>async(n,o,a)=>{const l=await e.getPromise(wn),i=await e.getPromise(No),s=await e.getPromise(Oo),r=await e.getPromise(_o),c=n.filter((e=>!o.includes(e))),d=o.filter((e=>!n.includes(e))),u=r.length>0?[...r.filter((e=>!c.includes(e))),...d]:[...o,yo.metadataKeyName],m=u.length>0?u:[...o,yo.metadataKeyName];t(_o,m),a&&(null==l||l.filterItems(a,{columns:m,exactMatch:i,removeHiddenItems:s}))})),o=useActionCallback((({set:e})=>t=>{e(No,t)})),a=useActionCallback((({set:e})=>t=>{e(Oo,t)}));return{setMetadataSearchKeys:e,updateMetadataSearchAfterSearchKeysChange:t,updateMetadataSearchAfterColumnVisibilityChange:n,setMetadataSearchExactMatch:o,setMetadataSearchRemoveHiddenItems:a}};var Do=Object.freeze({__proto__:null,sceneTreeColumnsPartial:Eo,sceneTreeSearchActive:Mo,sceneTreeSearchActiveColumns:_o,sceneTreeSearchExactMatch:No,sceneTreeSearchNameColumnActive:Bo,sceneTreeSearchRemoveHiddenItems:Oo,sceneTreeSearchResultCount:Lo,sceneTreeSearchValue:Ro,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 zo;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===zo.ROBOTO_MONO?"var(--vertex-ui-font-family-monospace)":"var(--vertex-ui-font-family)"}!function(e){e.ROBOTO="ROBOTO",e.ROBOTO_MONO="ROBOTO_MONO"}(zo||(zo={}));const Fo=n.atom({key:"sceneTreeAdditionalMetadataKeys",default:[]}),Ho=n.selector({key:"sceneTreeActiveMetadataKeys",get:({get:e})=>{const t=e(Fo),n=e(Vo),o=e(wo),a=new Set([...t,...n]),l=new Set(o);return 0===o.length?Array.from(a):Array.from(a.intersection(l))}});var Uo=Object.freeze({__proto__:null,sceneTreeActiveMetadataKeys:Ho,sceneTreeAdditionalMetadataKeys:Fo});function childrenAsArray(e){return Array.isArray(e)?e:[e]}function filterChildElements(e,t){return childrenAsArray(e).filter((e=>a.isValidElement(e)&&e.type===t))}function findChildElement(e,t){return filterChildElements(e,t)[0]}function cloneChildNodeOrFunction(e,t){return"object"==typeof e?a.cloneElement(e,t):e(t)}function useStateSyncedValue(e,t,{transform:o}={}){const[l,i]=n.useRecoilState(e);return a.useEffect((()=>{null!=t&&i(null!=o?o(t):t)}),[t]),l}const VertexEnterSceneTreeSearchModeButton=({onEnterSearchMode:t})=>{const o=n.useSetRecoilState(Mo);return e.jsx(l.VertexTooltip,{className:"flex ml-auto",content:"Scene Tree Search",children:e.jsx(l.VertexIconButton,{"data-testid":"enter-scene-tree-search-mode-button",iconName:"search",iconSize:"sm",onPointerDown:e=>{e.preventDefault()},onClick:()=>{o(!0),null==t||t()}})})},VertexSceneTreeMetadataCheck=({checked:t,disabled:n,onChange:o,children:a})=>{const i="string"==typeof a?a.replace(" ","-"):"";return e.jsxs("div",{className:"flex items-center",children:[e.jsx(l.VertexToggle,{"data-testid":`scene-tree-metadata-check-${i}`,variant:"check",checked:t,disabled:n,onValueChanged:e=>null==o?void 0:o(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==o||o(!t)},children:a})]})},VertexSceneTreeSearchOptionsPopover=({onSearchedSceneTreeColumnsChange:t,onSearchForExactMatchChange:o})=>{const a=useSceneTreeActions(),i=useSceneTreeSearchActions(),s=n.useRecoilValue(wn),r=n.useRecoilValue(Bo),c=n.useRecoilValue(_o),d=n.useRecoilValue(Ro),m=n.useRecoilValue(No),p=n.useRecoilValue(Oo),h=n.useRecoilValue(Vo),{element:f,callback:g}=useCallbackRef(),v="scene-tree-search",b=n.useRecoilValue(Vn(v)),{position:w,direction:C,handleOpen:S}=useOpenPositionedPopover({open:b,buttonElement:f,horizontalOffset:20}),V=u.useCallback((()=>{a.closeSceneTreePopover()}),[]),j=C===Po.LEFT?"left-end":"right-start",updateSearch=async(e,t)=>{if(d){const n=c.length>0?c:[...h,yo.metadataKeyName];await(null==s?void 0:s.filterItems(d,{columns:n,exactMatch:e,removeHiddenItems:t}))}};return e.jsxs(e.Fragment,{children:[e.jsx(l.VertexTooltip,{content:"Search Options",placement:"top",children:e.jsx(l.VertexIconButton,{"data-testid":"scene-tree-search-options-popover-button",className:"text-neutral-700",ref:g,iconName:"gear",iconSize:"sm",onClick:()=>{b?V():(S(),a.openSceneTreePopover(v))}})}),b&&e.jsx(l.VertexPopover,{"data-testid":"scene-tree-search-options-popover",open:b,backdrop:!1,position:w,resizeBehavior:"fixed",placement:j,className:"z-popover",children:e.jsxs("div",{className:_e("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(l.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===yo.metadataKeyName)),onChange:async e=>{await i.updateMetadataSearchAfterSearchKeysChange(yo.metadataKeyName,e,h,d),null==t||t()},children:yo.label},yo.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,d),null==t||t()},children:n},n)))]}),e.jsxs("div",{className:"flex p-3 border-t border-neutral-300",children:[e.jsx(l.VertexToggle,{className:"flex items-center","data-testid":"filter-exact-match-toggle",variant:"switch",checked:m,onValueChanged:async e=>{i.setMetadataSearchExactMatch(e.detail),null==o||o(),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(l.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:o,onExitSearchMode:a,onSearchedSceneTreeColumnsChange:i,onSearchForExactMatchChange:r,sceneTreeSearchElement:c,children:d})=>{const m=useSceneTreeActions(),p=n.useRecoilValue(wn),[h,f]=n.useRecoilState(Mo),[g,v]=n.useRecoilState(Ro),b=n.useRecoilValue(Vn("scene-tree-search"));useSceneTreeSearch({sceneTreeElement:null!=p?p:null});const{element:w,callback:C}=useCallbackRef({override:c}),S=null==g||""===g;return u.useEffect((()=>{h&&(null==w||w.setFocus())}),[w,h]),e.jsxs("div",{className:"flex w-full py-3 px-2",children:[e.jsx(l.VertexTooltip,{className:"self-center mr-1",content:"Exit Search",children:e.jsx(l.VertexIconButton,{"data-testid":"scene-tree-search-close-button",iconName:"caret-left",iconSize:"sm",onPointerDown:e=>{e.preventDefault()},onClick:async()=>{f(!1),v(void 0),await(null==w?void 0:w.clear()),await(null==p?void 0:p.filterItems("")),b&&m.closeSceneTreePopover(),await m.flyToFirstSelectedItem(),null==a||a()}})}),e.jsxs(s.VertexSceneTreeSearch,{"data-testid":"scene-tree-search-bar",ref:C,controller:null==p?void 0:p.controller,onBlur:()=>{S&&(f(!1),null==a||a(),b&&m.closeSceneTreePopover())},onSearch:()=>{v(null==w?void 0:w.value),null==t||t(null==w?void 0:w.value)},children:[d,e.jsx(l.VertexIcon,{slot:"clear-icon",name:"close-circle-fill",size:"sm",onPointerDown:async()=>{await m.flyToFirstSelectedItem(),null==o||o()}})]}),e.jsx("div",{className:"self-center pl-1",onPointerDown:e=>{e.preventDefault()},children:e.jsx(VertexSceneTreeSearchOptionsPopover,{onSearchedSceneTreeColumnsChange:i,onSearchForExactMatchChange:r})})]})},VertexSceneTreeSearch=({onEnterSearchMode:t,onExitSearchMode:o,onSearch:a,onClearSearch:l,onSearchedSceneTreeColumnsChange:i,onSearchForExactMatchChange:r,children:c})=>{const d=n.useRecoilValue(Mo);return e.jsxs(s.VertexSceneTreeToolbar,{className:"h-11 p-0 border-b border-neutral-300 box-content",slot:"header",children:[d&&e.jsx(VertexSceneTreeSearchBar,{onSearch:a,onClearSearch:l,onExitSearchMode:o,onSearchedSceneTreeColumnsChange:i,onSearchForExactMatchChange:r,children:c}),!d&&e.jsx("div",{className:"ml-auto mr-2",children:e.jsx(VertexEnterSceneTreeSearchModeButton,{onEnterSearchMode:t})})]})};function useCacheableLoadable(e,t){const o=a.useRef(),[l,i]=a.useState(0),s=n.useRecoilValueLoadable(e);a.useEffect((()=>{"hasValue"===s.state&&(o.current=s.contents)}),[t,s]);const[r,c]=a.useMemo((()=>"hasValue"!==s.state&&null!=o.current?[o.current,!0]:"hasValue"===s.state?[s.contents,!1]:[void 0,!1]),[s.state,s.contents,l]),d=a.useCallback((()=>{o.current=void 0,i(l+1)}),[l]),u=undefined;return a.useMemo((()=>({data:r,state:s.state,cached:c,invalidate:d})),[d,r,c,s.state])}const VertexSceneTreeColumnPopover=({onVisibleSceneTreeColumnsChange:t})=>{const o=useSceneTreeActions(),a=useSceneTreeColumnActions(),i=useSceneTreeSearchActions(),r=n.useRecoilValue(wn);useSceneTreePartialResults({sceneTreeElement:null!=r?r:null});const c=n.useRecoilValue(Ro),d=n.useRecoilValue(wo),m=useCacheableLoadable(So),p=d.length>0?d:m.data,h=n.useRecoilValue(Vo),f=n.useRecoilValue(Eo),[g,v]=u.useState(h),[b,w]=u.useState(""),{element:C,callback:S}=useCallbackRef(),V="scene-tree-columns",j=n.useRecoilValue(Vn(V)),{position:k,direction:T,handleOpen:A}=useOpenPositionedPopover({open:j,buttonElement:C}),P=u.useCallback((()=>{o.closeSceneTreePopover()}),[]),I=T===Po.LEFT?"left-end":"right-start",M=u.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]),E=u.useMemo((()=>M),[j,p]);return e.jsxs(e.Fragment,{children:[e.jsx(l.VertexTooltip,{content:"Configure Columns",placement:"top",children:e.jsx(l.VertexIconButton,{"data-testid":"scene-tree-column-popover-button",ref:S,iconName:"columns-add",iconSize:"sm",onClick:()=>{j?P():(A(),o.openSceneTreePopover(V))}})}),j&&e.jsx(l.VertexPopover,{"data-testid":"scene-tree-column-popover",open:j,backdrop:!1,position:k,resizeBehavior:"fixed",placement:I,className:"z-popover",children:e.jsxs("div",{className:_e("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(l.VertexIconButton,{"data-testid":"scene-tree-columns-popover-close-button",className:"ml-auto",iconName:"close",iconSize:"sm",onClick:()=>{w(""),P()}})]}),e.jsx(l.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&&w(t.toLowerCase())}}),f&&e.jsx(s.VertexSceneTreeNotificationBanner,{"data-testid":"partial-key-list-notification-banner",message:"loading"===m.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:yo.label}),E.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(l.VertexButton,{"data-testid":"scene-tree-column-popover-cancel",color:"secondary",onClick:()=>{w(""),P()},children:"Cancel"}),e.jsx(l.VertexButton,{"data-testid":"scene-tree-column-popover-apply",color:"primary",onClick:async()=>{await i.updateMetadataSearchAfterColumnVisibilityChange(h,g,c),await a.setActive(g),null==t||t(g),w(""),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(),o=n.useRecoilValue(wn),a=n.useRecoilValue(Ro),i=n.useRecoilValue(Lo),s=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(l.VertexTooltip,{className:"w-auto",content:"Select Results",placement:"top",children:e.jsx(l.VertexButton,{className:"h-6 rounded cursor-pointer","data-testid":"select-search-results-button",color:"secondary",variant:"text",size:"sm",onClick:async()=>{null!=o&&null!=a&&(await o.selectFilteredItems(a),t.toggleLastSelectWasMultiSelect(!0))},children:e.jsxs("div",{className:"flex h-6 items-center gap-1",children:[e.jsx(l.VertexIcon,{size:"sm",name:"check-circle"}),e.jsx("span",{className:"whitespace-nowrap",children:"Select Results"})]})})})]})]})},VertexSceneTreeCollapseAll=()=>{const t=n.useRecoilValue(wn);return e.jsx(l.VertexTooltip,{className:"w-auto",content:"Collapse All",placement:"top",children:e.jsx(l.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(wn);return e.jsx(l.VertexTooltip,{className:"w-auto",content:"Expand All",placement:"top",children:e.jsx(l.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 o=n.useRecoilValue(Ro),a=null==o||""===o;return e.jsx(s.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,{}),!a&&e.jsx(VertexSceneTreeSearchInformationForToolbar,{}),e.jsx("div",{className:"ml-auto",children:e.jsx(VertexSceneTreeColumnPopover,{onVisibleSceneTreeColumnsChange:t})})]})})},VertexSceneTreeHeader=({onEnterSearchMode:t,onExitSearchMode:n,onSearch:o,onClearSearch:a,onVisibleSceneTreeColumnsChange:l,children:i})=>{const s=null!=i&&!1!==i;return e.jsx("div",{slot:"header",className:"flex flex-col",children:s?i:e.jsxs(e.Fragment,{children:[e.jsx(VertexSceneTreeSearch,{onEnterSearchMode:t,onExitSearchMode:n,onSearch:o,onClearSearch:a,children:e.jsx("div",{slot:"clear-icon"})}),e.jsx(VertexSceneTreeToolbar,{onVisibleSceneTreeColumnsChange:l})]})})};function useMetadataActions(){const e=useActionCallback((({snapshot:e,set:t})=>async n=>{const o=undefined;if(await e.getPromise(so(n)))return;t(so(n),!0);const a=await e.getPromise(oo(n));if(null!=(null==a?void 0:a.metadata)){const e=[...a.metadata];t(ao(n),(t=>[...t,...e]))}const l=null==a?void 0:a.cursor;t(lo(n),l),t(so(n),!1)}));return{fetchInitialMetadata:useActionCallback((({snapshot:t})=>async n=>{const o=undefined;0===(await t.getPromise(ao(n))).length&&await e(n)})),fetchNextMetadata:useActionCallback((()=>async t=>{await e(t)}))}}var Wo={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 o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(e,t,n){return t&&defineProperties(e.prototype,t),n&&defineProperties(e,n),e}}(),o=a,l=_interopRequireDefault(o),i,s=_interopRequireDefault(r);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectWithoutProperties(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);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),o=void 0;if(this.props.useWindow){var a=document.documentElement||document.body.parentNode||document.body,l=void 0!==t.pageYOffset?t.pageYOffset:a.scrollTop;o=this.props.isReverse?l:this.calculateOffset(e,l)}else o=this.props.isReverse?n.scrollTop:e.scrollHeight-n.scrollTop-n.clientHeight;o<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,o=t.element,a=t.hasMore;t.initialLoad;var i=t.isReverse,s=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 d=[n];return a&&(s?i?d.unshift(s):d.push(s):this.defaultLoader&&(i?d.unshift(this.defaultLoader):d.push(this.defaultLoader))),l.default.createElement(o,c,d)}}]),InfiniteScroll}(o.Component);c.propTypes={children:s.default.node.isRequired,element:s.default.node,hasMore:s.default.bool,initialLoad:s.default.bool,isReverse:s.default.bool,loader:s.default.node,loadMore:s.default.func.isRequired,pageStart:s.default.number,ref:s.default.func,getScrollParent:s.default.func,threshold:s.default.number,useCapture:s.default.bool,useWindow:s.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}(Wo,Wo.exports);var Go=Wo.exports;const CopyButton=({id:t,textToCopy:n,iconSize:o,disableTooltip:i,onCopyValue:s})=>{const[r,c]=a.useState(!1),d=undefined,u=useDebouncedCallback((()=>{c(!1)}),2e3);return e.jsx(l.VertexTooltip,{className:"h-fit self-center z-[16000]",content:r?"Copied to Clipboard":"Copy",placement:"bottom",disabled:i,children:e.jsx("div",{className:_e({"text-green-700":r}),children:e.jsx(l.VertexIconButton,{className:"ml-auto","data-testid":`${t}-copy-button`,iconName:r?"check":"copy",iconSize:null!=o?o:"xs",onClick:e=>{e.stopPropagation(),e.preventDefault(),null!=n&&(navigator.clipboard.writeText(n),null==s||s(n)),c(!0),u(!0)},style:{"--hover-box-shadow":"none"}})})})};function MetadataPropertyValue({value:t,onCopyMetadataValue:n}){const[o,i]=a.useState(!1),s=""!==t.replace(/^\s*$/,"").trim();return s?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(l.VertexTooltip,{className:"w-full shrink truncate pr-2 py-1.5",content:t,placement:"bottom-start",children:e.jsx("div",{className:"truncate",children:t})}),o&&e.jsx(CopyButton,{id:t,textToCopy:t,onCopyValue:n})]}):e.jsx("div",{className:_e("overflow-visible border-b border-neutral-300 pl-1 pr-4 py-1.5",{"text-neutral-500":!s}),children:"--"})}const MetadataPanelContents=({sceneItemId:t,onCopyMetadataValue:o})=>{const i=useMetadataActions(),s=n.useRecoilValueLoadable(ro),r=n.useRecoilValue(ao(t)),c=n.useRecoilValue(io(t)),d=n.useRecoilValue(so(t)),u=(null==r?void 0:r.length)>0;function getMessage(){if(!d&&0===(null==r?void 0:r.length)&&"hasValue"===s.state)return"This part does not contain properties"}return a.useEffect((()=>{null!=t&&i.fetchInitialMetadata(t)}),[t]),e.jsxs(e.Fragment,{children:[e.jsx(Go,{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(l.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(l.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:o},n)))})]})}),!u&&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 o=usePanelActions(),a=n.useRecoilValue(wt),i=n.useRecoilValueLoadable(ro);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(l.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(l.VertexIcon,{className:"ml-auto cursor-pointer",onClick:o.closeSecondary,name:"close",size:"sm"})]}),e.jsxs("div",{className:"w-full h-full overflow-y-auto overflow-x-hidden",children:[null!=a&&e.jsx(MetadataPanelContents,{sceneItemId:a.id,onCopyMetadataValue:t}),null==a&&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(l.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:o,expandToggle:l,visibilityToggle:i,isolateButton:r,modelViewsButton:c,initialWidth:d,minWidth:u})=>{const m=n.useRecoilValue(wn);return a.useEffect((()=>{null==m||m.invalidateRows()}),[o]),e.jsxs(s.VertexSceneTreeTableColumn,{"data-testid":`scene-tree-table-column-${t}`,initialWidth:d,minWidth:u,children:[e.jsx("template",{slot:"header",dangerouslySetInnerHTML:{__html:`\n <div class="text-sm text-neutral-800 my-2">\n <div class="${_e("truncate",{"pl-2":l,"pr-2":i})}">\n ${t}\n </div>\n </div>\n `}}),e.jsx("template",{dangerouslySetInnerHTML:{__html:`\n <vertex-scene-tree-table-cell\n prop:value="${o}"\n prop:selection-handler="{{row.data.handleSelection}}"\n prop:expansion-handler="{{row.data.handleExpansion}}"\n prop:visibility-handler="{{row.data.handleVisibility}}"\n ${l?"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!=o?o:"--"}" \n placement="${i?"right":"top"}">\n <div class="flex items-center w-full">\n <div class="truncate">${o}</div>\n </div>\n </vertex-tooltip>\n\n ${c?'<div attr:style={{row.data.modelViewIndicatorStyle}}> \n <vertex-tooltip class="block w-full truncate" content="Listing Model Views" placement="bottom">\n <vertex-icon-button\n class="ml-auto mr-0.5 text-neutral-800"\n event:pointerup="{{row.data.handleShowModelViews}}"\n icon-name="views"\n icon-size="sm"\n variant="plain"\n >\n </vertex-icon-button>\n </vertex-tooltip>\n </div>':""}\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 o=n.useRecoilValue(jo),a=n.useRecoilValue(ko),l=[],i=a.filter((e=>e!==yo.label)).map((e=>o[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 o;const a=null!==(o=l[n])&&void 0!==o?o:t.initialWidth;return e.jsx(VertexSceneTreeCustomColumn,{label:t.label,visibilityToggle:n===i.length-1,isolateButton:n===i.length-1,rowDataBinding:t.binding,initialWidth:a,minWidth:t.minWidth},t.label)}))})},VertexSceneTreeTableLayout=t=>{var o,l;const{children:i}=t,r=__rest(t,["children"]),c=n.useRecoilValue(jo),d=n.useRecoilValue(ko),u=[],m=a.useMemo((()=>findChildElement(i,NameColumn)),[i]),p=a.useMemo((()=>findChildElement(i,MetadataColumns)),[i]),h=null!==(o=c[yo.label])&&void 0!==o?o:yo,f=d.filter((e=>e!==yo.label)).map((e=>c[e]));return e.jsxs(s.VertexSceneTreeTableLayout,Object.assign({"data-testid":"scene-tree-table-layout"},r,{children:[m?cloneChildNodeOrFunction(m.props.children,{columnCount:d.length,initialWidth:h.initialWidth,minWidth:h.minWidth}):e.jsx(VertexSceneTreeCustomColumn,{expandToggle:!0,visibilityToggle:1===d.length,isolateButton:1===d.length,rowDataBinding:h.binding,label:h.label,initialWidth:null!==(l=u[0])&&void 0!==l?l: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:o,font:l,backgroundColors:i,additionalLoadedMetadataProperties:r,whitelistedMetadataProperties:c,allowViewingMetadataPropertiesPanel:d,children:u,style:m,onPointerDown:p,onClick:h,onToggleSelection:f,onToggleExpansion:g,onToggleVisibility:v,onCopyMetadataValue:b,className:w,rowData:C}=t,S=__rest(t,["id","font","backgroundColors","additionalLoadedMetadataProperties","whitelistedMetadataProperties","allowViewingMetadataPropertiesPanel","children","style","onPointerDown","onClick","onToggleSelection","onToggleExpansion","onToggleVisibility","onCopyMetadataValue","className","rowData"]);const V=usePanelActions(),j=useSceneTreeActions(),k=useSelectionActions(),T=n.useRecoilValue(go),A=n.useRecoilValue(G),P=n.useRecoilValue(eo),I=n.useRecoilValue(Ho),M=n.useRecoilValue(_o),E=n.useRecoilValue(No),R=n.useRecoilValue(Oo),N=n.useRecoilValue(Ro),O=null==N||""===N,L=useRecoilRef({state:wn}),_=a.useMemo((()=>findChildElement(u,Header)),[u]),B=a.useMemo((()=>findChildElement(u,TableLayout)),[u]),D=a.useMemo((()=>findChildElement(u,ContextMenu)),[u]),wrappedExpansionHandler=(e,t,n)=>{j.toggleExpansion(e,t,n),null==g||g(e,t,n)},wrappedSelectionHandler=(e,t,n)=>{j.toggleSelection(e,t,n),null==f||f(e,t,n)},wrappedVisibilityHandler=(e,t,n)=>{j.toggleVisibility(e,t,n),null==v||v(e,t,n)},handleClick=async e=>{e.altKey&&await j.flyToRow(e.clientY),null==h||h(e)},handlePointerDown=async e=>{targetIsElement(e.target,"VERTEX-SCENE-TREE-TABLE-COLUMN")&&await k.clearSelection(),null==p||p(e)},F=n.useSetRecoilState(Cn),handleFirstRowRendered=e=>{var t;F(e.target.controller),null===(t=null==S?void 0:S.onFirstRowRendered)||void 0===t||t.call(S,e)},H=a.useMemo((()=>({metadataSearchKeys:M,exactMatch:E,removeHiddenItems:R})),[M,E,R]);useStateSyncedValue(wo,c,{transform:e=>e.sort(((e,t)=>e.localeCompare(t)))}),useStateSyncedValue(no,d),useStateSyncedValue(Fo,r);const U=n.useRecoilValue(Rt),W=a.useCallback((e=>{e.preventDefault(),e.stopPropagation(),V.openPrimary("model-views","right")}),[V]);return 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(s.VertexSceneTree,Object.assign({id:null!=o?o:"vertex-scene-tree","data-testid":"vertex-scene-tree",config:T,ref:L,className:_e("flex-1",{filtered:!O}),style:Object.assign(Object.assign(Object.assign({},styleFromOptionalFont(l)),styleFromOptionalBackgroundColors(i)),m),onConnectionError:e=>{logger_error("Scene Tree Connection Error: ",e.detail)},viewer:A,onPointerDown:handlePointerDown,onClick:handleClick,rowData:e=>{var t,n;const o=null!==(t=null==C?void 0:C(e))&&void 0!==t?t:{};return Object.assign({handleExpansion:wrappedExpansionHandler,handleSelection:wrappedSelectionHandler,handleVisibility:wrappedVisibilityHandler,handleShowModelViews:W,modelViewIndicatorStyle:(null===(n=null==e?void 0:e.node.id)||void 0===n?void 0:n.hex)===(null==U?void 0:U.id)?"display: flex;":"display: none;"},o)},searchOptions:H,metadataKeys:I},S,{onFirstRowRendered:handleFirstRowRendered,children:[null!=_?_:e.jsx(VertexSceneTreeHeader,{}),null!=B?B:e.jsx(VertexSceneTreeTableLayout,{}),null!=D?D:e.jsx(VertexSceneTreeContextMenu,{})]}))}),void 0!==P&&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[o,a]=n.useRecoilState(Lt);return e.jsxs(l.VertexSelect,{"data-testid":"decimal-place-select",className:"w-24",value:o,onOptionChanged:e=>{a(e.detail),null==t||t(e.detail)},children:[e.jsx("div",{className:"py-1.5 px-3",children:"0"}),e.jsx("div",{className:"py-1.5 px-3",children:"1"}),e.jsx("div",{className:"py-1.5 px-3",children:"2"}),e.jsx("div",{className:"py-1.5 px-3",children:"3"})]})},VertexLengthUnitSelector=({onApply:t})=>{const[o,a]=n.useRecoilState(Ot);return e.jsxs(l.VertexSelect,{"data-testid":"length-unit-select",className:"w-40",value:o,onOptionChanged:e=>{a(e.detail),null==t||t(e.detail)},children:[e.jsx("div",{"data-value":"cm",className:"py-1.5 px-3",children:"centimeters"}),e.jsx("div",{"data-value":"mm",className:"py-1.5 px-3",children:"millimeters"}),e.jsx("div",{"data-value":"m",className:"py-1.5 px-3",children:"meters"}),e.jsx("div",{"data-value":"in",className:"py-1.5 px-3",children:"inches"}),e.jsx("div",{"data-value":"ft",className:"py-1.5 px-3",children:"feet"})]})};function VertexUnitsControls({onUnitChange:t,onDecimalPlaceChange:n}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("div",{className:"pt-1 pb-2 text-sm text-neutral-700",children:"Length Unit"}),e.jsx(VertexLengthUnitSelector,{onApply:t})]}),e.jsxs("div",{children:[e.jsx("div",{className:"pt-2 pb-2 text-sm text-neutral-700",children:"Decimals"}),e.jsx(VertexDecimalPlaceSelector,{onApply:n})]})]})}function VertexUnitsPanelSection({onUnitChange:t,onDecimalPlaceChange:n}){return e.jsx(PanelSection,{header:e.jsx("div",{className:"flex items-center text-base",children:"Units"}),children:e.jsx(VertexUnitsControls,{onUnitChange:t,onDecimalPlaceChange:n})})}function useModelViewActions(){const e=usePmiAnnotationActions(),t=useSelectionActions();return{fetchNextModelViews:useActionCallback((({snapshot:e,set:t})=>async n=>{var o;const a=await e.getPromise(pn(n));if(null!=a){const e=null===(o=null==a?void 0:a.paging)||void 0===o?void 0:o.next;null!=e&&(t(rn(n),(e=>[...e,a])),t(ln(n),(()=>e)))}})),loadModelView:useActionCallback((({set:n,snapshot:o})=>async(a,l)=>{var i;const s=await o.getPromiseRequired(G),r=await o.getPromiseRequired(bt);try{await(null===(i=null==s?void 0:s.modelViews)||void 0===i?void 0:i.load(a,l.id)),n(mn,{itemId:a,modelView:l}),await e.clearPmiAnnotationSelection(),0!==r.length&&await t.clearSelection(),await e.fetchInitialPmiAnnotations(l.id)}catch(e){logger_error("Failed to load model view",e)}})),clearModelView:useActionCallback((({reset:t,snapshot:n})=>async()=>{var o;const a=undefined;if(null!=await n.getPromise(mn)){const a=await n.getPromiseRequired(G);try{await(null===(o=null==a?void 0:a.modelViews)||void 0===o?void 0:o.unload()),t(mn),await e.clearPmiAnnotationSelection()}catch(e){logger_error("Failed to remove model view",e)}}}))}}var Ko=Object.freeze({__proto__:null,hasMoreModelViews:xn,hasMorePmiAnnotations:vn,loadedItemModelView:mn,loadedModelViews:rn,loadedPmiAnnotations:cn,modelViews:hn,modelViewsCursor:ln,modelViewsSceneItemName:un,nextModelViews:pn,nextPmiAnnotations:fn,pmiAnnotations:gn,pmiAnnotationsCursor:sn,selectedPmiAnnotationId:yn,useModelViewActions:useModelViewActions,visiblePmiAnnotations:dn});function FileWithMagnifyingGlassImage(){return e.jsx("div",{children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"160",height:"160",viewBox:"0 0 220 220",children:[e.jsx("path",{fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":".75",d:"M38.84 186.31h143.29m-155.07 5.14h176.49M1 196.58h218m-205.11 5.14h185.22m-162.74 5.13h141.84"}),e.jsx("path",{fill:"#f7fcfd",d:"m150.94 50.25 20.43 19.51a3.42 3.42 0 0 1 1 2.46v121.2a5.23 5.23 0 0 1-5.23 5.23H52.78a5.23 5.23 0 0 1-5.23-5.23V54.56a5.24 5.24 0 0 1 5.23-5.24h95.81a3.44 3.44 0 0 1 2.35.93"}),e.jsx("path",{fill:"none",stroke:"#006bad","stroke-dasharray":"3 3","stroke-linecap":"round","stroke-linejoin":"round",d:"m150.94 50.25 20.43 19.51a3.42 3.42 0 0 1 1 2.46v121.2a5.23 5.23 0 0 1-5.23 5.23H52.78a5.23 5.23 0 0 1-5.23-5.23V54.56a5.24 5.24 0 0 1 5.23-5.24h95.81a3.44 3.44 0 0 1 2.35.93"}),e.jsx("path",{d:"M79.12 123.99H110v30.88H79.12z",fill:"#e0f3f9"}),e.jsx("path",{d:"M110 153.37v1.5h-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M105.4 154.87H82.17",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M80.62 154.87h-1.5v-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M79.12 150.27v-23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M79.12 125.49v-1.5h1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M83.72 123.99h23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M108.5 123.99h1.5v1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M110 128.59v23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M110 123.99h30.88v30.88H110z",fill:"#e0f3f9"}),e.jsx("path",{d:"M140.88 153.37v1.5h-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M136.28 154.87h-23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M111.5 154.87H110v-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M110 150.27v-23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M110 125.49v-1.5h1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M114.6 123.99h23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M139.38 123.99h1.5v1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M140.88 128.59v23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M110 93.11h30.88v30.88H110z",fill:"#e0f3f9"}),e.jsx("path",{d:"M140.88 122.49v1.5h-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M136.28 123.99h-23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M111.5 123.99H110v-1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M110 119.39V96.15",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M110 94.61v-1.5h1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M114.6 93.11h23.23",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M139.38 93.11h1.5v1.5",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M140.88 97.7v23.24",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"3.1 3.1"}),e.jsx("path",{d:"M150.91 50.28a3.6 3.6 0 0 1 .86 1.22",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{fill:"none",stroke:"#006bad","stroke-dasharray":"2.87 2.87","stroke-linecap":"round","stroke-linejoin":"round",d:"M152.05 54.34v9.14a5.24 5.24 0 0 0 5.24 5.23h9.94"}),e.jsx("path",{d:"M168.67 68.71h.2a3.5 3.5 0 0 1 1.27.23M19.8 78.25l1.93 14.68-14.67 1.93",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M21.73 92.93S-2.15 82.45 4.05 54.82",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{fill:"none",stroke:"#b43296","stroke-linecap":"round","stroke-linejoin":"round",d:"M14.89 132.63h5.88v5.88h-5.88z"}),e.jsx("path",{fill:"none",stroke:"#f90","stroke-linecap":"round","stroke-linejoin":"round",d:"M174.49 36v5.88m-2.94-2.94h5.88"}),e.jsx("circle",{cx:"199.1",cy:"164.76",r:"2.45",fill:"none",stroke:"#0c0","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M109.68 25.74V11.9M87.12 29.74l-6.02-9.4m53.21 9.4 6.01-9.4",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{fill:"#eff9fc",stroke:"#006bad","stroke-linejoin":"round",d:"m140.43 139.69 7.22 5.8-8.28 10.31-7.22-5.8"}),e.jsx("circle",{cx:"110.2",cy:"124.35",r:"27.74",fill:"#e0f3f9",opacity:".7"}),e.jsx("path",{fill:"#fff",stroke:"#006bad","stroke-linejoin":"round",d:"M131.2 98.19a33.55 33.55 0 1 0 5.16 47.16 33.56 33.56 0 0 0-5.16-47.16Zm.63 43.52a27.73 27.73 0 1 1-4.26-39 27.73 27.73 0 0 1 4.26 39ZM187 173.84a29.8 29.8 0 0 1-4.19 7.52 29.3 29.3 0 0 1-7.24 6.71l-37.77-30.31a29.3 29.3 0 0 1 5-8.56 29.6 29.6 0 0 1 6.4-5.67Z"}),e.jsx("path",{fill:"none",stroke:"#fff","stroke-linecap":"round","stroke-miterlimit":"10",d:"m118.82 138.09 12.51-15.58m-38.56-3.68 6.94-8.65m-5.32 1.9 6.95-8.66m16.23 42.44 12.5-15.58"}),e.jsx("path",{fill:"#fff",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round",d:"M139.92 153.31a28.4 28.4 0 0 0-2.12 4.45m7.07-.49a38 38 0 0 0-2.35 4.28m7.3-.32c-.93 1.34-1.79 2.72-2.58 4.11m7.53-.15q-1.47 2-2.81 3.94m7.75.01-3 3.78m7.95.18c-1.07 1.24-2.16 2.45-3.26 3.61m8.21.35a54 54 0 0 1-3.49 3.44m8.44.5a37 37 0 0 1-3.72 3.26m8.67.74a29 29 0 0 1-3.95 3.09"}),e.jsx("path",{d:"m196.69 115.8-2.18 14.64 14.64 2.18",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M194.51 130.44s23.76-12 21.9-35.66",fill:"none",stroke:"#006bad","stroke-linecap":"round","stroke-linejoin":"round"})]})})}function ModelViewsEmptyState({itemSelected:t}){const n=t?"There are no model views associated with this part.":"Select a part to access model views.";return e.jsxs("div",{"data-testid":"pmi-views-empty-state",className:"h-full w-full px-4 flex flex-col gap-2 justify-center items-center overflow-y-auto",children:[e.jsx(FileWithMagnifyingGlassImage,{}),e.jsx("div",{className:"text-base text-neutral-700 text-center px-3 pt-2.5 pb-1.5",children:"No Model Views"}),e.jsx("div",{className:"text-[0.8125rem] text-neutral-600 text-center px-3 pb-2.5",children:n})]})}const VertexModelViewsViewRow=({view:t,currentlyViewing:n,itemId:o,onLoadModelView:a,onClearModelView:i})=>{const s=useModelViewActions();return e.jsx("div",{"data-testid":`model-view-${t.id}`,onClick:async()=>{n?(await s.clearModelView(),null==i||i()):(await s.loadModelView(o,t),null==a||a(o,t.id))},className:_e("flex flex-col w-full h-8 p-1 pl-4 cursor-pointer text-neutral-700 text-[0.8125rem] hover:text-[var(--vertex-ui-blue-600)]",{"bg-[var(--vertex-ui-blue-200)]":n,"hover:bg-[var(--vertex-ui-blue-100)]":!n}),children:e.jsxs("div",{className:_e("flex w-full h-full items-center",{"text-neutral-900 font-extrabold":n}),children:[e.jsxs(l.VertexTooltip,{className:"flex w-20 grow","data-testid":`model-view-${t.id}-tooltip`,placement:"bottom-start",content:t.displayName,children:[e.jsx(l.VertexIcon,{name:"views",size:"sm"}),e.jsx("div",{className:"truncate mx-2",children:t.displayName}),e.jsx("span",{className:"font-normal text-neutral-700 ml-auto pr-1",children:n&&"(Viewing)"})]}),n&&e.jsx("div",{className:"ml-auto pr-1",children:e.jsx(l.VertexIconButton,{"data-testid":"model-views-clear-selection",iconSize:"sm",iconName:"close",onClick:async()=>await s.clearModelView()})})]})},t.id)};function VertexModelViewsList({itemId:t,onLoadModelView:o,onClearModelView:a}){const i=useModelViewActions(),s=n.useRecoilValue(mn),r=n.useRecoilValue(hn(t)),c=n.useRecoilValue(xn(t)),d=n.useRecoilValueLoadable(un),u=0===r.length;return e.jsxs("div",{className:"w-full h-full flex flex-col",children:[("hasValue"!==d.state||null!=d.contents)&&e.jsxs("div",{className:"flex flex-row h-11 w-full border-b border-neutral-300 p-3 pl-4 mr-2 text-sm items-center",children:["hasValue"===d.state&&e.jsx("div",{className:"truncate items-center",children:e.jsx(l.VertexTooltip,{content:d.contents,children:e.jsx("div",{className:"truncate",children:d.contents||""})})}),"loading"===d.state&&e.jsx("div",{className:"flex items-center h-11 w-full",children:e.jsx("div",{className:"w-3/4 h-3 bg-neutral-300 animate-pulse rounded"})})]}),u&&e.jsx(ModelViewsEmptyState,{itemSelected:!0}),!u&&e.jsx("div",{className:"h-full overflow-y-auto",children:e.jsx(Go,{hasMore:c,loadMore:()=>{i.fetchNextModelViews(t)},useWindow:!1,children:r.map((n=>{var l;const i=undefined,r=(null===(l=null==s?void 0:s.modelView)||void 0===l?void 0:l.id.toString())===(null==n?void 0:n.id);return e.jsx(VertexModelViewsViewRow,{view:n,currentlyViewing:r,itemId:t,onLoadModelView:o,onClearModelView:a},n.id)}))})})]})}const VertexPMIAnnotationRow=({annotation:t,checked:n,onCheckedChange:o,selected:a,onSelectedChange:i})=>e.jsxs("div",{id:`annotation-entry-${t.id}`,"data-testid":`annotation-entry-${t.displayName}`,className:_e("flex items-center w-full h-7 gap-2.5 pl-4 pr-2 cursor-default hover:text-[var(--vertex-ui-blue-600)]",{"bg-[var(--vertex-ui-blue-200)]":a,"hover:bg-[var(--vertex-ui-blue-100)]":!a}),onClick:()=>i(!a),children:[e.jsx(l.VertexToggle,{"data-testid":`annotation-entry-${t.displayName}-check`,variant:"check",checked:n,onClick:e=>e.stopPropagation(),onValueChanged:e=>{o(e.detail)}}),e.jsx("div",{className:"w-1/2 flex-grow",children:e.jsx(l.VertexTooltip,{content:t.displayName,placement:"bottom-start",children:e.jsx("div",{className:"truncate",children:t.displayName})})})]}),VertexPMIAnnotationsSecondaryPanel=({modelViewId:t,parentPanelId:o,verticalSiblingId:a,sceneAnnotationOperations:i,onToggleSelectionOfPMIAnnotation:s,onToggleVisibilityOfPMIAnnotation:r})=>{const c=usePmiAnnotationActions(),d=n.useRecoilValue(G),m=n.useRecoilValue(gn(t)),p=n.useRecoilValue(vn(t)),h=n.useRecoilValue(yn),[f,g]=n.useRecoilState(dn(t)),[v,b]=u.useState("");u.useEffect((()=>{t!==v&&(g(m),b(t))}),[m,v,t,g,b]);const toggleVisibilityOfAllAnnotations=e=>{e?(g(m),null==i||i.sceneAnnotationsOperation((e=>e.show()),d)):(g([]),null==i||i.sceneAnnotationsOperation((e=>e.hide()),d))};return e.jsx(l.VertexResizable,{"data-testid":"pmi-annotation-secondary-panel",className:"min-h-28 max-h-3/4 flex-shrink-0 border-t text-sm text-neutral-700",horizontalDirection:"none",verticalDirection:"top",initializeWithOffset:!0,initialVerticalScale:.6,parentSelector:`#${o}`,verticalSiblingSelector:`#${a}`,children:e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsx("div",{className:"flex items-center w-full h-9 border-b border-[var(--vertex-ui-neutral-300)] px-4 shrink-0",children:"3D PMI"}),e.jsxs("div",{"data-testid":"display-all-annotations",className:"flex items-center w-full h-8 gap-2.5 px-4 py-1.5 cursor-default border-b border-[var(--vertex-ui-neutral-300)]",onClick:()=>{const e=m.length!==f.length;toggleVisibilityOfAllAnnotations(e)},children:[e.jsx(l.VertexToggle,{"data-testid":"display-all-annotations-check",variant:"check",checked:m.length===f.length,onClick:e=>e.stopPropagation(),onValueChanged:e=>{toggleVisibilityOfAllAnnotations(e.detail)}}),"Display All"]}),e.jsx("div",{className:"h-full overflow-y-auto text-[0.8125rem] py-1",children:e.jsx(Go,{hasMore:p,loadMore:async()=>{p&&await c.fetchNextPmiAnnotations(t)},useWindow:!1,children:m.map(((n,o)=>e.jsx(VertexPMIAnnotationRow,{annotation:n,checked:f.includes(n),onCheckedChange:e=>{e?(g([...f,n]),null==i||i.sceneAnnotationsOperation((e=>e.show()),d,[n.id])):(g(f.filter((e=>e!==n))),null==i||i.sceneAnnotationsOperation((e=>e.hide()),d,[n.id])),null==r||r(t,n.id,e)},selected:n.id===h,onSelectedChange:async e=>{e?await c.selectPmiAnnotation(n.id,!1):await c.clearPmiAnnotationSelection(),null==s||s(t,n.id,e)}},o)))})})]})})},VertexModelViewsPanelSection=({onLoadModelView:t,onClearModelView:o,onToggleSelectionOfPMIAnnotation:a,onToggleVisibilityOfPMIAnnotation:l})=>{const i=useSceneAnnotationsOperations(),s=n.useRecoilValue(Rt),r=null!=(null==s?void 0:s.id),c=n.useRecoilValue(mn),d=(null==c?void 0:c.itemId)===(null==s?void 0:s.id);return e.jsxs("div",{id:"model-views-panel-wrapper",className:"w-full h-full flex flex-col text-neutral-800",children:[e.jsxs("div",{"data-testid":"model-views-container",className:"group h-full flex overflow-auto min-h-29 relative",children:[r&&e.jsx(u.Suspense,{fallback:e.jsx(ModelViewsItemListLoading,{}),children:e.jsx(VertexModelViewsList,{itemId:s.id,onLoadModelView:t,onClearModelView:o})}),!r&&e.jsx(ModelViewsEmptyState,{itemSelected:!1})]}),null!=c&&d&&e.jsx(u.Suspense,{fallback:e.jsx(ModelViewsItemListLoading,{}),children:e.jsx(VertexPMIAnnotationsSecondaryPanel,{modelViewId:c.modelView.id,parentPanelId:"model-views-panel-wrapper",verticalSiblingId:"model-views-container",sceneAnnotationOperations:i,onToggleSelectionOfPMIAnnotation:a,onToggleVisibilityOfPMIAnnotation:l})})]})};function ModelViewsItemListLoading(){return e.jsxs("div",{className:"flex flex-col w-full h-full items-center justify-center text-[0.8125rem] overflow-y-auto",children:[e.jsx(l.VertexSpinner,{"data-testid":"model-views-panel-spinner",size:"lg",color:"grey"}),e.jsx("div",{className:"pt-3 px-10 text-center",children:"Loading model views for the selected part..."})]})}function VertexModelViewsPanel(){return e.jsx("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e.jsx(VertexModelViewsPanelSection,{})})}function ColorSwatchContextMenu({onRemoveCustomColor:t}){const o=useContextMenuActions(),a=useSceneItemMaterialActions(),i=n.useRecoilValue(Ge);return e.jsx(VertexContextMenu,{menuType:"color-swatch",onOpen:e=>{elementIsColorSwatch(e.target)&&o.setContextMenuItem(e.target)},openPredicate:e=>elementIsColorSwatch(e.target)&&elementHasColorAttribute(e.target),disableBackdrop:!0,children:e.jsx(l.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 a.removeCustomColor(e),null==t||t(e)):null!=e&&"true"===i.getAttribute("data-recent-color")&&await a.removeRecentColor(e)}},children:e.jsxs("div",{className:"flex align-middle gap-2.5",children:[e.jsx(l.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:o})=>{const i=useTransformActions(),s=useCacheableLoadable(Et),r=n.useRecoilValue(kt),c=useCacheableLoadable(qt(null!=r?r:"")),d=a.useMemo((()=>{var e;const t=null===(e=s.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}),[s,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(l.VertexMenuItem,{"data-testid":"clear-selected-transforms",onClick:async()=>{await i.clearSelectedTransforms(),null==t||t()},disabled:!d,children:"Clear selected transforms"}),e.jsx(l.VertexMenuItem,{"data-testid":"clear-all-transforms",onClick:async()=>{await i.clearAllTransforms(),null==o||o()},children:"Clear all transforms"})]})})},VertexTransformNumericField=({bottomLabel:t,value:o,step:l,min:i,max:s,disabled:r,testId:c,onBlur:d,onInput:u,onChange:m})=>{const p=a.useRef(null),h=n.useRecoilValue(Lt),[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==o?void 0:o.toFixed(Number(h)))&&void 0!==e?e:"":g(!0)}),[o]);const v=a.useCallback((e=>{g(!1),null==m||m(e)}),[g,m]),b=a.useCallback((e=>{g(!0),null==d||d(e),null!=p.current&&null!=o&&(p.current.value=o.toFixed(Number(h)))}),[d,o,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:l,min:i,max:s,"data-testid":c,disabled:r,defaultValue:Number.isNaN(o)?"":null==o?void 0:o.toFixed(Number(h)),onBlur:b,onInput:u,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 o=n.useRecoilValue(Ot),a=n.useRecoilValue(Vt),l=n.useRecoilValue(St),i=a||l,s=n.useRecoilValue(kt),{transform:r,error:c,update:d}=useEditItemTransform(s),u=i?void 0:r,m=useDebouncedCallback((async e=>{await d(e),null==t||t(e)}),50);function updateTransform(e){return t=>{if(null!=u){const n=parseFloat(t.currentTarget.value);Number.isNaN(n)||null==m||m(Object.assign(Object.assign({},u),e(n,u)))}}}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 o=parseFloat(n.currentTarget.value),a=undefined;(isNaN(o)||!!(null==t?void 0:t(o)))&&null!=u&&m(v.defaults(e,u))}}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!=u?u.position.x:void 0,bottomLabel:o,disabled:null==u,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==u?void 0:u.position.y,bottomLabel:o,disabled:null==u,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==u?void 0:u.position.z,bottomLabel:o,disabled:null==u,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==u?void 0:u.rotation.x,bottomLabel:"deg",disabled:null==u,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==u?void 0:u.rotation.y,bottomLabel:"deg",disabled:null==u,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==u?void 0:u.rotation.z,bottomLabel:"deg",disabled:null==u,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==u?void 0:u.scale,step:.1,min:.1,disabled:null==u,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 o=useTransformActions(),a=n.useRecoilValue(Ft),i=n.useSetRecoilState(Xt);return e.jsx(l.VertexToggle,{className:"flex items-center","data-testid":"transform-widget-toggle",variant:"switch",checked:a,onValueChanged:async()=>{a?(o.disableTransformWidget(),null==t||t(!1)):(i("world"),await o.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:o,onUpdateTransform:a}){return e.jsx(PanelSection,{header:e.jsxs("div",{className:"flex items-center text-base",children:["Manual Part Transforms",e.jsx(VertexTransformClear,{onClear:t,onClearAll:n})]}),children:e.jsx(VertexTransformControls,{onToggleTransformsManipulator:o,onUpdateTransform:a})})}function DefaultTransformsPanel(){return e.jsx("div",{className:"flex flex-col text-neutral-700 h-full overflow-y-auto",children:e.jsx(VertexTransformPanelSection,{})})}const $o="Appearance",qo="Model Views",Yo="Settings",Xo="Transforms",ViewerRightPanelHeader=({additionalHeaderMap:t})=>{const o=n.useRecoilValue(Qn),a=getHeading(o,t),l="model-views"===o;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.jsxs("div",{className:"flex items-center w-full leading-6 text-md align-center font-medium text-neutral-800 gap-2",children:[a,l&&e.jsx(BetaLabel,{})]})})};function getHeading(e,t={}){switch(e){case"appearance":return $o;case"model-views":return qo;case"settings":return Yo;case"transforms":return Xo;default:const n=null!=e?t[e]:void 0;return null!=n?n:"None"}}function VertexViewerRightOpenedPanel({children:t}){const o=n.useRecoilValue(Qn),l=a.useMemo((()=>filterChildElements(t,CustomPanelContent)),[t]),i=a.useMemo((()=>l.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.props.panelName]:t.props.panelTitle})),{})),[l]),s=a.useMemo((()=>["appearance","model-views","settings","transforms",...l.map((e=>e.props.panelName))]),[l]);return e.jsx(e.Fragment,{children:null!=o&&s.includes(o)&&e.jsxs(VertexResizableContent,{displayShadow:!0,heading:e.jsx(ViewerRightPanelHeader,{additionalHeaderMap:i}),placement:"right",children:["appearance"===o&&e.jsx(DefaultAppearancePanel,{}),"transforms"===o&&e.jsx(DefaultTransformsPanel,{}),"settings"===o&&e.jsx(DefaultSettingsPanel,{}),"model-views"===o&&e.jsx(VertexModelViewsPanel,{}),t]})})}function CustomPanelContent({panelName:t,children:o}){const a=n.useRecoilValue(Qn);return e.jsx(e.Fragment,{children:a===t&&o})}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:o,responsive:i,disabled:s,content:r,tooltipPlacement:c,children:d,onSelect:u,onDeselect:m}){return e.jsx("div",{className:_e({"text-[var(--vertex-ui-blue-700)]":o===t&&!s,"text-neutral-700 hover:text-neutral-800":o!==t&&!s,"cursor-pointer hover:bg-neutral-200":!s,"text-neutral-400":s,"rounded-full md:p-3":i,"p-3":!i&&null==d,"px-3 py-1":null!=d}),"data-testid":`${t}-sidebar-panel`,onClick:()=>{s||(o===t?m():u())},children:e.jsxs(l.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!=d?d:e.jsx(l.VertexIcon,{name:n})})]})})}function VertexViewerRightSidebar({children:t}){const o=usePanelActions(),a=useTransformActions(),l=n.useRecoilValue(Qn);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:l,iconName:"adjustments",tooltipPlacement:"right",content:"Appearance",onSelect:()=>{o.openPrimary("appearance","right")},onDeselect:()=>o.closePrimary("right")}),e.jsx(SidebarIcon,{name:"transforms",active:l,iconName:"show-only-nearby",tooltipPlacement:"right",content:"Transforms",onSelect:async()=>{o.openPrimary("transforms","right"),await a.enableTransformWidget(void 0,!0)},onDeselect:()=>o.closePrimary("right")}),e.jsx(SidebarIcon,{name:"model-views",active:l,iconName:"views",tooltipPlacement:"right",content:"Model Views",onSelect:async()=>{o.openPrimary("model-views","right")},onDeselect:()=>o.closePrimary("right")}),e.jsx(SidebarIcon,{name:"settings",active:l,iconName:"gear",tooltipPlacement:"right",content:"Settings",onSelect:()=>{o.openPrimary("settings","right")},onDeselect:()=>o.closePrimary("right")})]})})}function CustomPanelIcon(t){const o=usePanelActions(),a=n.useRecoilValue(Qn),{panelName:l,tooltipContent:i,iconName:s}=t,r=__rest(t,["panelName","tooltipContent","iconName"]);if(null==s&&null==r.children)throw new Error('CustomPanelIcon must contain either a Vertex "iconName" or custom "children"');return e.jsx(SidebarIcon,Object.assign({},r,{name:l,iconName:null!=s?s:"help",active:a,content:i,onSelect:()=>{o.openPrimary(t.panelName,"right")},onDeselect:()=>{o.closePrimary("right")}}))}VertexViewerRightOpenedPanel.CustomPanelContent=CustomPanelContent,VertexViewerRightSidebar.CustomPanelIcon=CustomPanelIcon;const VertexPopupButton=t=>{var{open:n,children:o}=t,a=__rest(t,["open","children"]);const i=o.find((e=>e.type===Anchor)),s=o.filter((e=>e.type!==Anchor));return null==i?e.jsx(e.Fragment,{}):e.jsxs(l.VertexPopover,Object.assign({className:"flex",placement:"top",backdrop:!1,open:asBooleanAttribute(n)},a,{children:[i,e.jsx("div",{className:_e("flex mb-1.5",{hidden:!n}),"data-testid":"align-plane-popover-menu",children:s})]}))},Anchor=({tooltipContent:t,children:n})=>e.jsx("div",{slot:"anchor",children:e.jsx(l.VertexTooltip,{className:"cursor-pointer",content:t,children:n})});function VertexViewerCrossSectionAlignmentPopoverMenu({disabled:t}){const o=useCrossSectioningActions(),a=n.useRecoilValue(Ve),i=n.useRecoilValue(xe),getBaseIcon=()=>`align-to-${null==i?void 0:i.mode}`;return useStackKeyBinding({id:"CrossSectionAlignment",keyBind:"Escape",fn:o.cancelCurrentHit,addPredicate:()=>{var e;return null!==(e=null==i?void 0:i.hitPending)&&void 0!==e&&e},cancelPredicate:()=>!(null==i?void 0:i.hitPending)},[null==i?void 0:i.hitPending]),e.jsxs(VertexPopupButton,{"data-testid":"section-alignment-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(a),onDismissed:o.closeAlignmentTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Section Alignment",children:e.jsx(l.VertexIconButton,{"data-testid":"section-alignment-icon-button",iconName:getBaseIcon(),iconColor:"secondary",onClick:a?o.closeAlignmentTools:o.openAlignmentTools,disabled:t,children:e.jsx(l.VertexIcon,{"data-testid":"section-alignment-icon-chevron",name:"chevron-up",size:"sm"})})}),e.jsxs(s.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(l.VertexIconButton,{iconColor:"secondary",onClick:()=>o.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(l.VertexIconButton,{iconColor:"secondary",onClick:()=>o.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 o=useCrossSectioningActions(),i=n.useRecoilValue(je),r=n.useRecoilValue(he),c=n.useRecoilValueLoadable(ye),d=a.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:o.closeAxisTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Align Plane",children:e.jsx(l.VertexIconButton,{onClick:i?o.closeAxisTools:o.openAxisTools,iconName:d,"data-testid":"align-plane-icon",iconColor:"secondary",disabled:t,children:e.jsx(l.VertexIcon,{"data-testid":"align-plane-icon-chevron",name:"chevron-up",size:"sm"})})}),e.jsxs(s.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(l.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:()=>o.updateAxis("x"),variant:"plain",iconColor:"secondary",iconName:"axis-x",children:e.jsx("div",{className:"text-base ml-2",children:"X-axis Plane"})}),e.jsx(l.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:()=>o.updateAxis("y"),children:e.jsx("div",{className:"text-base ml-2",children:"Y-axis Plane"})}),e.jsx(l.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:()=>o.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:o,onOffsetChange:i}){const s=n.useRecoilValue(Ot),r=n.useRecoilValue(Lt),[c,d]=a.useState(convertTo(t,s));a.useEffect((()=>{d(convertTo(t,s))}),[s,t]);const u=createDistanceFormatter(s,parseInt(r,10)),handleIncrementalUpdate=e=>{const t=convertFrom(c+e,s);i(t)},handleSubmit=e=>{e.preventDefault(),i(convertFrom(c,s))},handleBlur=()=>{i(convertFrom(c,s))};return e.jsx(l.VertexTooltip,{content:"Plane Offset",children:e.jsx("form",{"data-testid":"cross-section-stepper-form",onSubmit:handleSubmit,children:e.jsxs(l.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=>{d(null!=e.detail.value?parseFloat(e.detail.value):t)},onBlur:handleBlur,disabled:o,children:[e.jsx("div",{"data-testid":"cross-section-stepper-decrement",className:"py-1 cursor-pointer",slot:"left",onClick:()=>{o||handleIncrementalUpdate(-1)},children:e.jsx(l.VertexIcon,{name:"chevron-left",size:"sm"})}),e.jsx("div",{"data-testid":"cross-section-stepper-increment",className:"py-1 cursor-pointer",slot:"right",onClick:()=>{o||handleIncrementalUpdate(1)},children:e.jsx(l.VertexIcon,{name:"chevron-right",size:"sm"})})]})})})}VertexPopupButton.Anchor=Anchor;const Zo=400;function VertexViewerCrossSectionPopupMenu(){const t=useCrossSectioningActions(),o=n.useRecoilValue(Se),i=n.useRecoilValueLoadable(we),r=n.useRecoilValueLoadable(Ce),c=a.useRef(),d=a.useMemo((()=>"hasValue"===i.state&&Number.isFinite(i.contents.max)&&Number.isFinite(i.contents.min)),[i.state,i.contents]),u=a.useMemo((()=>"hasValue"===i.state?i.contents:ie),[i.state,i.contents]),m=a.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()}),Zo),t.beginInteraction(),t.updatePlanes(e)};return e.jsxs(VertexPopupButton,{"data-testid":"cross-section-popover",placement:"top",backdrop:!1,open:asBooleanAttribute(o),onDismissed:t.closeAdditionalTools,children:[e.jsx(VertexPopupButton.Anchor,{tooltipContent:"Section Tools",children:e.jsx("div",{className:"-ml-px py-1.5",children:e.jsx(l.VertexIcon,{"data-testid":"cross-section-popover-icon",name:"chevron-up",size:"sm",onClick:o?t.closeAdditionalTools:t.openAdditionalTools})})}),e.jsxs(s.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:!d}),e.jsx(l.VertexTooltip,{className:"w-auto",content:"Reverse",children:e.jsx(l.VertexIconButton,{iconName:"flip","data-testid":"viewer-toolbar-flip-button",onClick:t.flipPlanes,iconColor:"secondary",disabled:!d})}),e.jsx(l.VertexTooltip,{className:"w-auto",content:"Align View to Plane",children:e.jsx(l.VertexIconButton,{"data-testid":"viewer-toolbar-align-view-to-plane-button",iconName:"align-view-to-plane",onClick:t.alignViewToPlane,iconColor:"secondary",disabled:!d})}),e.jsx(VertexToolbarDivider,{}),e.jsx(VertexViewerCrossSectionAxisPopoverMenu,{disabled:!d}),e.jsx("div",{className:"w-52 mx-2",children:e.jsx(VertexSlider,{value:m,defaultValue:u.default,disabled:asBooleanAttribute("hasValue"!==i.state)||!d,min:u.min,max:u.max,step:.01,onChange:handleCrossSectionValueChange})}),e.jsx("div",{className:"px-4",children:e.jsx(VertexViewerCrossSectionOffsetStepper,{offset:"hasValue"===r.state&&d?r.contents:0,disabled:!d,onOffsetChange:handleCrossSectionValueChange})})]})]})}const VertexViewerCrossSectionButton=()=>{const t=useCrossSectioningActions(),o=n.useRecoilValue(se);return e.jsxs(e.Fragment,{children:[e.jsx(l.VertexTooltip,{content:o?"Hide Section":"Show Section",children:e.jsx(l.VertexIconButton,{"data-testid":"viewer-toolbar-cross-section-button",iconName:"cross-section",iconColor:o?"primary":"secondary",onClick:()=>o?t.disable():t.enable()})}),e.jsx(VertexViewerCrossSectionPopupMenu,{})]})},VertexFitAllButton=()=>{const t=n.useRecoilValue(G);return e.jsx(l.VertexTooltip,{content:"Fit All",children:e.jsx(l.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),o=n.useRecoilValue($),[i,s]=n.useRecoilState(Y),[r,c]=n.useRecoilState(q);return a.useEffect((()=>{null!=t&&o&&c(t.getBaseInteractionHandler())}),[t,o,c]),e.jsx(l.VertexTooltip,{content:"Pan",children:e.jsx(l.VertexIconButton,{iconName:"pan",iconColor:"pan"===i?"primary":"secondary","data-testid":"viewer-toolbar-pan-button",onClick:async()=>{if(s("pan"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("pan")}}})})},VertexRotateButton=()=>{const t=n.useRecoilValue(G),o=n.useRecoilValue($),[i,s]=n.useRecoilState(Y),[r,c]=n.useRecoilState(q);return a.useEffect((()=>{null!=t&&o&&c(t.getBaseInteractionHandler())}),[t,o,c]),e.jsx(l.VertexTooltip,{content:"Rotate",children:e.jsx(l.VertexIconButton,{iconName:"rotate",iconColor:"rotate"===i?"primary":"secondary","data-testid":"viewer-toolbar-rotate-button",onClick:async()=>{if(s("rotate"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("rotate")}}})})},VertexZoomButton=()=>{const t=n.useRecoilValue(G),o=n.useRecoilValue($),[i,s]=n.useRecoilState(Y),[r,c]=n.useRecoilState(q);return a.useEffect((()=>{null!=t&&o&&c(t.getBaseInteractionHandler())}),[t,o,c]),e.jsx(l.VertexTooltip,{content:"Zoom",children:e.jsx(l.VertexIconButton,{iconName:"zoom",iconColor:"zoom"===i?"primary":"secondary","data-testid":"viewer-toolbar-zoom-button",onClick:async()=>{if(s("zoom"),null!=r){const e=await r;null==e||e.setPrimaryInteractionType("zoom")}}})})},DefaultToolbar=()=>e.jsx(s.VertexViewerToolbar,{placement:"bottom-center",children:e.jsxs(s.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=({endCapEnabledByDefault:t,children:o})=>{const l=n.useSetRecoilState(ue),i=n.useSetRecoilState(de);a.useEffect((()=>{null!=t&&(l(t),i(t))}),[t]);const r=null!=o&&!1!==o;return e.jsx(s.VertexViewerToolbar,{placement:"bottom-center",children:r?e.jsx(s.VertexViewerToolbarGroup,{className:"p-1 border border-neutral-200 rounded bg-neutral-100 opacity-95",children:o}):e.jsx(DefaultToolbar,{})})};function VertexTransformWidget({transformWidgetElement:t,supportUndo:o,onPositionChange:l,onRotationChange:i}){const r=useTransformActions(),c=n.useRecoilValue(Kt),d=n.useRecoilValue(Ft),u=n.useRecoilValue(Ht),m=n.useRecoilValue(Gt),p=n.useRecoilValueLoadable(Wt),h=n.useRecoilValue(Ot),f=n.useRecoilValue(Lt),g=a.useMemo((()=>"hasValue"===p.state?p.contents:m),[p,m]),v=a.useMemo((()=>{const e=undefined;return d&&(null!=g||c)}),[d,g,c]);return e.jsx(e.Fragment,{children:v&&e.jsx(s.VertexViewerTransformWidget,{id:"transform-widget","data-testid":"viewer-transform-widget",ref:t,position:u,rotation:null!=u?g:void 0,decimalPlaces:parseInt(f,10),distanceUnit:toUnitType(h),EXPERIMENTAL_undoKeybindings:null==o||o,onInteractionStarted:()=>{r.disableSelectionSync(),r.setIsInteractivelyTransforming(!0)},onInteractionEnded:()=>{r.invalidateTransforms(),r.setIsInteractivelyTransforming(!1)},onPositionChanged:async e=>{await r.setTransformWidgetPosition(e.detail),null==l||l(e.detail)},onRotationChanged:e=>{r.setTransformWidgetOrientation(e.detail),null==i||i(e.detail)}})})}const VertexViewerSceneReset=({onReset:t})=>{const o=useCrossSectioningActions(),a=useModelViewActions(),i=useSelectionActions(),s=useTransformActions(),r=useViewerSceneActions(),c=n.useSetRecoilState(Rt),handleReset=async()=>{await o.disable(),await i.resetSelectionState(),s.clearTransformWidgetPosition(),await s.invalidateTransforms(),c(void 0),await a.clearModelView(),null==t||t(),await r.reset()};return e.jsx(l.VertexTooltip,{content:"Reset View",children:e.jsx(l.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 o=>{const a=await n.getPromise(At);t(Z,o.detail.scene),t(At,o.detail.scene.sceneViewSummary.selectedVisibleSummary),t(Tt,a);const l=undefined;await n.getPromise(Ft)&&await e.syncToSelection()}))}}const VertexBoxSelectionTool=()=>{const{element:t,callback:o}=useCallbackRef(),a=useBoxSelectionActions(),l=useTransformActions(),i=n.useRecoilValue(Xe);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&&(l.clearTransformWidgetOrientation(),l.clearTransformWidgetPosition(),l.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((()=>a.setOperationType("select")),[]),off:u.useCallback((()=>a.setOperationType("clearAndSelect")),[])}),e.jsx(s.VertexViewerBoxQueryTool,{ref:o,"data-testid":"viewer-box-query-tool",operationType:i})};function VertexViewerCameraTypeMenu({open:t,onOpen:o,onDismiss:a,onCameraTypeChange:i}){const s=useViewerCameraActions(),r=n.useRecoilValue(W);return e.jsxs(l.VertexMenu,{"data-testid":"camera-types-popover",className:"flex",placement:"bottom-end",open:asBooleanAttribute(t),onMenuClosed:a,children:[e.jsx("div",{slot:"anchor",children:e.jsx("div",{className:_e("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(l.VertexTooltip,{content:"Change View",children:e.jsx(l.VertexIconButton,{"data-testid":"set-camera-mode-option",className:"p-1 cursor-pointer",variant:"plain",onClick:o,iconName:"orthographic"===r?"cube-orthographic":"cube-perspective",children:e.jsx(l.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(l.VertexMenuItem,{"data-testid":"set-perspective-view",onClick:()=>{s.updateCameraType("perspective",!0),null==i||i("perspective")},children:[e.jsx(l.VertexIcon,{slot:"icon","data-testid":"set-perspective-view-icon",name:"cube-perspective",size:"sm",className:_e({"text-[var(--vertex-ui-blue-700)]":"perspective"===r})}),e.jsx("div",{className:_e("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"perspective"===r}),children:"Perspective"})]}),e.jsxs(l.VertexMenuItem,{"data-testid":"set-orthographic-view",onClick:()=>{s.updateCameraType("orthographic",!0),null==i||i("orthographic")},children:[e.jsx(l.VertexIcon,{slot:"icon","data-testid":"set-orthographic-view-icon",name:"cube-orthographic",size:"sm",className:_e({"text-[var(--vertex-ui-blue-700)]":"orthographic"===r})}),e.jsx("div",{className:_e("ml-2 items-center",{"text-[var(--vertex-ui-blue-700)]":"orthographic"===r}),children:"Orthographic"})]})]})]})}const VertexViewerViewCube=t=>{var{placement:n,children:o}=t,l=__rest(t,["placement","children"]);const i=Array.isArray(o)?o:[o],r=i.filter((e=>!a.isValidElement(e)||e.type!==s.VertexViewerViewCube)).filter((e=>null!=e&&!1!==e)),c=i.find((e=>a.isValidElement(e)&&e.type===s.VertexViewerViewCube)),[d,u]=a.useState(!1);return e.jsxs(s.VertexViewerToolbar,{direction:"vertical","data-testid":"view-cube-toolbar",placement:null!=n?n:"top-right",children:[null!=c?c:e.jsx(s.VertexViewerViewCube,Object.assign({className:"m-7"},l)),0===r.length?e.jsxs("div",{className:"flex items-center justify-center mt-3 gap-1",children:[e.jsx(VertexViewerSceneReset,{}),e.jsx(VertexViewerCameraTypeMenu,{open:d,onDismiss:()=>u(!1),onOpen:()=>u(!0)})]}):e.jsx("div",{className:"mt-3",children:r})]})},VertexViewer=t=>{var{id:o,src:l,className:i,disableSelection:r,onTap:c,onLongpress:d,onFrameDrawn:u,onSceneReady:m,viewerRefCallback:p,children:h}=t,f=__rest(t,["id","src","className","disableSelection","onTap","onLongpress","onFrameDrawn","onSceneReady","viewerRefCallback","children"]);const g=n.useRecoilValue(go),v=useRecoilRef({state:G}),b=useViewerCameraActions(),w=useCrossSectioningActions(),C=useHitActions(),S=useSelectionActions(),V=useViewerFrameActions(),j=n.useRecoilValue(W),k=n.useRecoilValue(xe),T=n.useRecoilValue(Ye),A=n.useSetRecoilState(X),[P,I]=n.useRecoilState($);a.useEffect((()=>{P&&(I(!1),w.disable())}),[l]);const[M,E]=n.useRecoilState(K);a.useEffect((()=>{null!=o&&E(o)}),[o]);const R=n.useRecoilValue(mo),N=a.useMemo((()=>({opacity:R/100})),[R]),O=n.useRecoilValue(ze),L=n.useRecoilValue(Fe),_=a.useMemo((()=>({color:O,width:L})),[O,L]),B=n.useRecoilValue(ue),D=n.useRecoilValue(me),F=n.useRecoilValue(pe),H=a.useMemo((()=>Object.assign({endCapEnabled:B,endCapUsePartColor:D===ne.PART},B&&D===ne.SINGLE&&{endCapColor:F})),[B,D,F]),U=n.useRecoilValue($n),q=n.useRecoilValue(Un),Y=n.useRecoilValue(Wn),Z=n.useRecoilValue(Gn),J=a.useMemo((()=>({color:q,opacity:Y/100,lineWidth:Z})),[q,Y,Z]),Q=n.useRecoilValue(nt),ee=null!=h&&!1!==h;return useKeyBindings(),useDefaultKeybindings(),e.jsxs(s.VertexViewer,Object.assign({id:M,"data-testid":"vertex-viewer",src:l,ref:e=>{null==p||p(e),v(e)},className:_e("flex w-full h-full",i,{"cursor-crosshair":k.hitPending}),style:{"--viewer-background":U},config:g,cameraType:P?j:void 0,onCameraTypeChanged:e=>{P&&b.updateCameraType(e.detail,!1)},phantom:N,featureLines:_,selectionHighlighting:J,crossSectioning:H,featureMaps:Q?"final":void 0,onTap:e=>{const t=[...r?[]:[S.selectCurrentHit]];C.tap(e,...t),null==c||c(e)},onLongpress:e=>{C.longPress(e),null==d||d(e)},onFrameDrawn:e=>{V.frameDrawn(e),null==u||u(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());A(null==n?void 0:n.sceneViewId)}null==m||m(e)}},f,{children:[T&&e.jsx(VertexBoxSelectionTool,{}),ee?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:o})=>{const l=n.useRecoilValue(on),i=n.useRecoilValue(kn);return a.useEffect((()=>{null==t||t(l)}),[l,t]),a.useEffect((()=>{null==o||o(i)}),[i,o]),e.jsx(e.Fragment,{})},VertexViewerToolkitRoot=t=>{var{override:o,autoDefineCustomElements:l,children:i,config:s}=t,r=__rest(t,["override","autoDefineCustomElements","children","config"]);return a.useEffect((()=>{(null==l||l)&&(d.defineCustomElements(),c.defineCustomElements())}),[l]),e.jsx(n.RecoilRoot,{override:o,children:e.jsxs(e.Fragment,{children:[e.jsx(VertexViewerToolkitEventListener,Object.assign({},r)),e.jsx(VertexViewerToolkitRootConfig,{config:s,children:i})]})})},VertexViewerToolkitRootConfig=({config:t,children:o})=>{const l=n.useSetRecoilState(go);return a.useEffect((()=>{const e=null!=t?toSdkConfig(t):void 0;l(e)}),[t,l]),e.jsx(e.Fragment,{children:o})};var Jo=Object.freeze({__proto__:null,get AssemblyFontFace(){return zo},Columns:Io,Core:jn,Metadata:Uo,Search:Do});exports.Appearance=qn,exports.BoxSelection=Ze,exports.Config=vo,exports.ContextMenu=qe,exports.CrossSection=Ne,exports.Ghosting=fo,exports.Hits=an,exports.Keybinding=Zn,exports.Measurement=pt,exports.Messages=H,exports.Metadata=co,exports.ModelViews=Ko,exports.Panel=to,exports.Performance=ft,exports.SceneTree=Jo,exports.SceneViewItem=Nt,exports.Selection=Tn,exports.Settings=_t,exports.Transforms=nn,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.VertexModelViewsPanel=VertexModelViewsPanel,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
|