brep-io-kernel 1.0.275 → 1.0.276
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/apiExamples/BREP_Booleans.html +2 -2
- package/dist/apiExamples/BREP_Export.html +2 -2
- package/dist/apiExamples/BREP_Primitives.html +2 -2
- package/dist/apiExamples/BREP_Transforms.html +2 -2
- package/dist/apiExamples/Embeded_2D_Sketcher.html +2 -2
- package/dist/apiExamples/Embeded_CAD.html +2 -2
- package/dist/apiExamples/Embeded_CAD_Integration_Test.html +2 -2
- package/dist/assembly-constraint-capture.html +5 -5
- package/dist/assets/{AnnotationRegistry-D4Wu78S5.js → AnnotationRegistry-DmCAaMWU.js} +1 -1
- package/dist/assets/{AssemblyConstraintRegistry-Dv9m5HQZ.js → AssemblyConstraintRegistry-CMGYi26o.js} +1 -1
- package/dist/assets/{FeatureRegistry-BiMzIqqI.js → FeatureRegistry-CtngJUEe.js} +3 -3
- package/dist/assets/{PartHistory-oDnLIAaB.js → PartHistory-C7IhfKVf.js} +1 -1
- package/dist/assets/{annUtils-BrwNyUEy.js → annUtils-DGfVy9U3.js} +1 -1
- package/dist/assets/{apiExample_BREP_Booleans-BwiMtDIS.js → apiExample_BREP_Booleans-DyTcZZ5m.js} +1 -1
- package/dist/assets/{apiExample_BREP_Export-BU6JEsXr.js → apiExample_BREP_Export-CHV-v_5k.js} +1 -1
- package/dist/assets/{apiExample_BREP_Primitives-LgL-6abq.js → apiExample_BREP_Primitives-DvNqBEVv.js} +1 -1
- package/dist/assets/{apiExample_BREP_Transforms-t9BF6JOw.js → apiExample_BREP_Transforms-DzINm9Jd.js} +1 -1
- package/dist/assets/{apiExample_Embeded_2D_Sketcher-ChBmbcOk.js → apiExample_Embeded_2D_Sketcher-DNTtuz8d.js} +1 -1
- package/dist/assets/{apiExample_Embeded_CAD-wxO1n_Eq.js → apiExample_Embeded_CAD-BnQhzp-z.js} +1 -1
- package/dist/assets/{apiExample_Embeded_CAD_Integration_Test-CxQJRkqD.js → apiExample_Embeded_CAD_Integration_Test-CV2Ykzja.js} +1 -1
- package/dist/assets/{assemblyConstraintDialogs-CH_Gbz82.js → assemblyConstraintDialogs-C2rw8l6x.js} +1 -1
- package/dist/assets/{brep-kernel-xxpt9ldE.js → brep-kernel-UtrTyG6Q.js} +1 -1
- package/dist/assets/{browserTests-CRiysi-p.js → browserTests-Cyi6X6Cb.js} +3 -3
- package/dist/assets/{dialogCapturePageFactory-DjJjYM48.js → dialogCapturePageFactory-DVhrYqMv.js} +1 -1
- package/dist/assets/{featureDialogs-Chs09ZCV.js → featureDialogs-DkPbRjYq.js} +1 -1
- package/dist/assets/{featureDialogs-91F4s17y.js → featureDialogs-E0PjzXk0.js} +1 -1
- package/dist/assets/{index.es-xZ7picbN.js → index.es-CGVK-qun.js} +1 -1
- package/dist/assets/{javascript-lY5XZvCd.js → javascript-DpdHQnSD.js} +1 -1
- package/dist/assets/{main-cad-CPA3rCIJ.js → main-cad-Cc83gQHn.js} +6 -6
- package/dist/assets/{pmiDialogs-BTJYTb0b.js → pmiDialogs-D5R54K47.js} +1 -1
- package/dist/assets/{test-CN0ogjpZ.js → test-CEMdQ45d.js} +3 -3
- package/dist/cad.html +7 -7
- package/dist/feature-dialog-capture.html +4 -4
- package/dist/pmi-dialog-capture.html +5 -5
- package/dist/test.html +1 -1
- package/dist/viewer.html +7 -7
- package/dist-kernel/brep-kernel.js +48 -5
- package/package.json +1 -1
- package/src/UI/FloatingWindow.js +72 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Je=Object.defineProperty;var tn=o=>{throw TypeError(o)};var fr=(o,t,e)=>t in o?Je(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var c=(o,t)=>Je(o,"name",{value:t,configurable:!0});var Z=(o,t,e)=>fr(o,typeof t!="symbol"?t+"":t,e),pr=(o,t,e)=>t.has(o)||tn("Cannot "+e);var ee=(o,t,e)=>t.has(o)?tn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(o):t.set(o,e);var h=(o,t,e)=>(pr(o,t,"access private method"),e);import{r as hr,F as dr,A as Q}from"./FeatureRegistry-BiMzIqqI.js";import{Q as ce,V as qt,q as mr,bd as ne,be as en,aM as yr,aI as gr,aK as br,bf as Sr,z as Ar,X as zt,an as nn,bg as rn,af as wr,b9 as _r,b as re}from"./featureDialogs-Chs09ZCV.js";import{A as Sn}from"./AssemblyConstraintRegistry-Dv9m5HQZ.js";import{d as O}from"./deepClone-Dj59xCHB.js";import{L as An}from"./ListEntityBase-DIaWtqmZ.js";import{e as Ir,o as Cr}from"./browserStorage-CvgF8ovw.js";function xr(o,t){if(t==null)return null;if(typeof t=="number")return Number.isFinite(t)?t:null;let e=null;try{o&&typeof o.evaluateExpression=="function"&&(e=o.evaluateExpression(t))}catch{e=null}if(typeof e=="number"&&Number.isFinite(e))return e;const n=Number(e);if(Number.isFinite(n))return n;const r=Number(t);return Number.isFinite(r)?r:null}c(xr,"evaluateConstraintNumericValue");function B(o){return o===0?"0":o?String(o).trim():""}c(B,"normalizeTypeString");const Dr=new Set(["type","persistentData","__open"]);function Nr(o,t){if(o===t)return!0;if(!Array.isArray(o)||!Array.isArray(t)||o.length!==t.length)return!1;for(let e=0;e<o.length;e+=1)if(o[e]!==t[e])return!1;return!0}c(Nr,"shallowArrayEqual");function sn(o){const t={};if(!o||typeof o!="object")return t;for(const e in o){if(!Object.prototype.hasOwnProperty.call(o,e)||Dr.has(e))continue;const n=o[e]?o[e].default_value:void 0;t[e]=O(n)}return t}c(sn,"extractDefaults");function on(o){return`Unknown constraint type: ${o!=null?String(o):"unknown"}`}c(on,"formatUnknownConstraintMessage");const Fr=new Map([["touch_align","touch_align"],["touch-align","touch_align"],["touchalign","touch_align"],["touch align","touch_align"],["touch align constraint","touch_align"],["touchalignconstraint","touch_align"],["touch","touch_align"],["distance","distance"],["distance constraint","distance"],["distanceconstraint","distance"],["angle","angle"],["angle constraint","angle"],["angleconstraint","angle"]]),an={touch_align:"Touch Align",distance:"Distance",angle:"Angle"},un=1e-6,le=1,Pr=.5,Rr=.5,Or=Math.max(1,le),st="Constraint disabled.";function at(o,t){const e=Number(o);return Number.isFinite(e)?e:t}c(at,"toFiniteNumber$5");function Tr(o){const t=Math.floor(at(o,le));return!Number.isFinite(t)||t<1?le:t}c(Tr,"clampIterations");function cn(o,t){const e=at(o,t);return Number.isFinite(e)?e<0?0:e>1?1:e:t}c(cn,"clampGain");function kr(o){if(!o||typeof o.traverse!="function")return;const t=[],e=["parallel-constraint-normal-","distance-constraint-normal-","touch-align-normal-"];o.traverse(n=>{!n||typeof n.name!="string"||e.some(r=>n.name.startsWith(r))&&t.push(n)});for(const n of t)try{n.parent?.remove?.(n)}catch{}}c(kr,"removeExistingDebugArrows");function wn(o){let t=o;for(;t;){if(t.isAssemblyComponent||t.type==="COMPONENT")return t;t=t.parent||null}return null}c(wn,"resolveComponentFromObject");function vr(o){return wn(o)?1:0}c(vr,"scoreObjectForComponent");function zr(o){if(!o)return null;if(o instanceof qt)return o.clone();if(typeof o=="object"){const{x:t,y:e,z:n}=o,r=Number.isFinite(t)?t:0,i=Number.isFinite(e)?e:0,s=Number.isFinite(n)?n:0;return new qt(r,i,s)}return null}c(zr,"vectorFrom");function Ct(o,t=null){if(!o)return t;const e=o.inputParams||{},n=e.id??e.constraintID??o.id??t;return n==null?t:String(n)}c(Ct,"resolveConstraintEntryId");function mt(o){return B(Ct(o))}c(mt,"normalizeConstraintEntryId");var w,_n,xt,pe,In,he,Cn,tt,de,xn,Dn,St,me,Dt,L;const Be=class Be{constructor(t=null,e=null){ee(this,w);this.partHistory=t||null,this.registry=e||new Sn,this.constraints=[],this.idCounter=0,this._listeners=new Set,this._autoRunScheduled=!1,this._autoRunActive=!1,this._autoRunOptions=null}setPartHistory(t){this.partHistory=t||null,this.partHistory&&this.constraints.length&&h(this,w,tt).call(this)}setRegistry(t){this.registry=t||this.registry}addListener(t){return typeof t!="function"?()=>{}:(this._listeners.add(t),()=>{this._listeners.delete(t)})}removeListener(t){typeof t=="function"&&this._listeners.delete(t)}onChange(t){if(typeof t!="function")return()=>{};const e=c(()=>{try{t(this)}catch{}},"wrapped");return this.addListener(e)}list(){return this.entries}get entries(){return this.constraints}set entries(t){Array.isArray(t)?this.constraints=t:this.constraints=[]}get size(){return this.constraints.length}findById(t){const e=B(t);return e&&this.constraints.find(n=>mt(n)===e)||null}async addConstraint(t,e=null){const n=h(this,w,Dt).call(this,t);if(!n)throw new Error(`Constraint type "${t}" is not registered.`);const r=n.inputParamsSchema||{},i=sn(r),s=B(n.constraintType||t||n.name),u={type:s,inputParams:{...i},persistentData:{isNewConstraint:!0},__open:!0,enabled:!0};Object.defineProperty(u,"constraintClass",{value:n,configurable:!0,writable:!0,enumerable:!1});const f=n?.shortName||n?.constraintShortName||s||"CONST",a=this.generateId(f),m=u.inputParams.id??u.inputParams.constraintID;return u.inputParams.id=m||a,h(this,w,xt).call(this,u),e&&typeof e=="object"&&Object.assign(u.inputParams,O(e)),u.inputParams.applyImmediately=!0,h(this,w,pe).call(this,u),this.constraints.push(u),h(this,w,L).call(this,"add",u),this.checkConstraintErrors(this.partHistory),h(this,w,tt).call(this),u}removeConstraint(t){const e=B(t);if(!e)return!1;const n=this.constraints.findIndex(i=>mt(i)===e);if(n<0)return!1;const[r]=this.constraints.splice(n,1);return h(this,w,L).call(this,"remove",r||null),this.checkConstraintErrors(this.partHistory),h(this,w,tt).call(this),!0}moveConstraint(t,e){const n=B(t);if(!n)return!1;const r=this.constraints.findIndex(i=>mt(i)===n);return r<0?!1:this.moveConstraintToIndex(n,r+e)}moveConstraintToIndex(t,e){const n=B(t);if(!n)return!1;const r=this.constraints.findIndex(u=>mt(u)===n);if(r<0)return!1;const i=Number.isFinite(e)?Math.max(0,Math.min(this.constraints.length-1,e)):r;if(i===r)return!1;const[s]=this.constraints.splice(r,1);return this.constraints.splice(i,0,s),h(this,w,L).call(this,"reorder",s||null),h(this,w,tt).call(this),!0}updateConstraintParams(t,e){const n=this.findById(t);return!n||typeof e!="function"?!1:(e(n.inputParams),h(this,w,xt).call(this,n),h(this,w,L).call(this,"update",n),this.checkConstraintErrors(this.partHistory),h(this,w,tt).call(this),!0)}setConstraintEnabled(t,e){const n=this.findById(t);if(!n)return!1;const r=e!==!1;if(n.enabled!==!1===r){if(n.enabled!==r&&(n.enabled=r),!r&&n.persistentData?.status!=="disabled"){const u={...n.persistentData||{}};u.status="disabled",u.message||(u.message=st),n.persistentData=u,h(this,w,L).call(this,"update",n)}return!1}n.enabled=r;const s={...n.persistentData||{}};return r?(s.status==="disabled"&&(s.status="pending",s.message===st&&delete s.message,n.persistentData=s),h(this,w,L).call(this,"update",n),this.checkConstraintErrors(this.partHistory),h(this,w,tt).call(this),!0):(s.status="disabled",s.message||(s.message=st),n.persistentData=s,h(this,w,L).call(this,"update",n),this.checkConstraintErrors(this.partHistory),h(this,w,tt).call(this),!0)}setOpenState(t,e){const n=this.findById(t);if(!n)return!1;const r=e!==!1;if(n.__open!==!1===r)return!1;const s=n.inputParams||{};if(Object.prototype.hasOwnProperty.call(s,"__open"))try{s.__open=r}catch{n.__open=r}else n.__open=r;return(!n.runtimeAttributes||typeof n.runtimeAttributes!="object")&&(n.runtimeAttributes={}),n.runtimeAttributes.__open=r,h(this,w,L).call(this,"open-state",n),!0}setExclusiveOpen(t){const e=B(t);if(!e)return!1;let n=!1;for(const r of this.constraints){if(!r)continue;const s=mt(r)===e;if(r.__open!==!1!==s){const f=r.inputParams||{};if(Object.prototype.hasOwnProperty.call(f,"__open"))try{f.__open=s}catch{r.__open=s}else r.__open=s;(!r.runtimeAttributes||typeof r.runtimeAttributes!="object")&&(r.runtimeAttributes={}),r.runtimeAttributes.__open=s,n=!0}}return n&&h(this,w,L).call(this,"open-state",this.findById(t)),n}clear(){this.constraints=[],this.idCounter=0,h(this,w,L).call(this,"clear")}snapshot(){return{idCounter:this.idCounter,constraints:this.constraints.map(t=>({type:t?.type||null,inputParams:O(t?.inputParams)||{},persistentData:O(t?.persistentData)||{},open:t?.__open!==!1,enabled:t?.enabled!==!1}))}}async replaceAll(t=[],e=0){const n=[],r=Array.isArray(t)?t:[];let i=Number.isFinite(Number(e))?Number(e):0;for(const s of r){const u=h(this,w,_n).call(this,s);if(!u)continue;const f=u.type||u.constraintType||null,a=h(this,w,Dt).call(this,f);if(!a)continue;const m=sn(a.inputParamsSchema),l=B(a.constraintType||f||a.name),y={type:l,inputParams:{...m,...O(u.inputParams||{})},persistentData:O(u.persistentData||{}),__open:u.open!==!1,enabled:u.enabled!==!1},b=y.inputParams.id??y.inputParams.constraintID;if(b){const d=String(b).match(/(\d+)$/);if(d){const g=Number(d[1]);Number.isFinite(g)&&(i=Math.max(i,g))}y.inputParams.id=b}else{const d=(a?.shortName||a?.constraintShortName||l||"CONST").replace(/[^a-z0-9]/gi,"").toUpperCase()||"CONST";i+=1,y.inputParams.id=`${d}${i}`}h(this,w,xt).call(this,y),y.inputParams.applyImmediately=!0,Object.defineProperty(y,"constraintClass",{value:a,configurable:!0,writable:!0,enumerable:!1}),h(this,w,pe).call(this,y),n.push(y)}this.idCounter=i,this.constraints=n,h(this,w,L).call(this,"replace"),this.constraints.length&&(this.checkConstraintErrors(this.partHistory),h(this,w,tt).call(this))}async deserialize(t){const e=t&&typeof t=="object"?t:{},n=Array.isArray(e.constraints)?e.constraints:Array.isArray(t)?t:[],r=Number.isFinite(Number(e.idCounter))?Number(e.idCounter):void 0;await this.replaceAll(n,r)}generateId(t="CONST"){const e=B(t).replace(/[^a-z0-9]/gi,"").toUpperCase()||"CONST";return this.idCounter+=1,`${e}${this.idCounter}`}checkConstraintErrors(t=this.partHistory,e={}){const n=e&&typeof e=="object"?e:{},r=n.emit!==!1,i=n.updatePersistentData!==!1,s=t||this.partHistory||null;s&&(this.partHistory=s);const u=h(this,w,he).call(this),f=[];let a=!1;const m=c((l,y)=>{const b=l?.persistentData&&typeof l.persistentData=="object"?l.persistentData:{},d={...b};let g=!1;const I=c((S,x)=>{const C=d[S];if(x===void 0){Object.prototype.hasOwnProperty.call(d,S)&&(delete d[S],g=!0);return}if(Array.isArray(C)&&Array.isArray(x)){if(Nr(C,x))return}else if(C===x)return;d[S]=x,g=!0},"set"),_=c(S=>{Object.prototype.hasOwnProperty.call(d,S)&&(delete d[S],g=!0)},"remove");try{y({set:I,remove:_,data:d,previous:b})}catch(S){console.warn("[AssemblyConstraintHistory] Failed to update persistent data:",S)}return g&&(l.persistentData=d),g},"mutatePersistentData");for(const l of this.constraints){if(!l)continue;const y=Ct(l),b=l?.type||null,d={id:y,constraintID:y,type:b,status:"ok",message:"",duplicateConstraintIDs:null,duplicateSignature:null};if(l.enabled===!1){d.status="disabled",d.message=st,i&&(a=m(l,({set:_,remove:S,previous:x})=>{_("status","disabled"),(!x.message||x.message===st)&&_("message",st),_("satisfied",!1),S("duplicateConstraintIDs"),S("duplicateSignature")})||a),f.push(d);continue}const g=h(this,w,Dt).call(this,b),I=u.get(l);if(!g){const _=on(b);d.status="error",d.message=_,i&&(a=m(l,({set:S,remove:x})=>{S("status","error"),S("message",_),S("satisfied",!1),x("duplicateConstraintIDs"),x("duplicateSignature")})||a),f.push(d);continue}if(I){const _=Array.isArray(I.relatedIds)?I.relatedIds.filter(Boolean):[],S=I.signature||null;d.status="duplicate",d.message=I.message||"Duplicate constraint selections.",d.duplicateConstraintIDs=_.length?_:null,d.duplicateSignature=S,i&&(a=m(l,({set:x,remove:C})=>{x("status","duplicate"),x("message",d.message),x("satisfied",!1),d.duplicateConstraintIDs?x("duplicateConstraintIDs",d.duplicateConstraintIDs):C("duplicateConstraintIDs"),S?x("duplicateSignature",S):C("duplicateSignature")})||a),f.push(d);continue}i&&(a=m(l,({set:_,remove:S,previous:x})=>{x.status==="duplicate"&&(_("status","pending"),typeof x.message=="string"&&x.message.startsWith("Duplicate constraint selections")&&S("message")),x.status==="error"&&typeof x.message=="string"&&x.message.startsWith("Unknown constraint type:")&&(_("status","pending"),S("message")),S("duplicateConstraintIDs"),S("duplicateSignature")})||a),f.push(d)}return i&&a&&r&&h(this,w,L).call(this,"update"),f}async runAll(t=this.partHistory,e={}){const n=t||this.partHistory;if(!n)return[];this.partHistory=n,this.checkConstraintErrors(n,{emit:!1});const r=Math.abs(at(e?.tolerance,un))||un,i=Tr(e?.iterations),s=cn(e?.translationGain,Pr),u=cn(e?.rotationGain,Rr),f=e?.debugMode===!0,a=f?500:0,m=at(e?.delayMs??e?.iterationDelayMs,a),l=Math.max(0,Number.isFinite(m)?m:a),y=e?.viewer||n.viewer||null,b=c(()=>{try{y?.render?.()}catch{}try{y?.requestRender?.()}catch{}},"renderScene"),d=e?.controller&&typeof e.controller=="object"?e.controller:null,g=d?.signal||e?.signal||null;let I=!1;const _=c(()=>g?.aborted?(I=!0,!0):!1,"shouldAbort"),S=d?.hooks||e?.hooks,x=S&&typeof S=="object"?S:{},C=c(async(A,N={})=>{const R=x?.[A];if(typeof R=="function")try{await R({controller:d,signal:g,aborted:I,...N})}catch(D){console.warn(`[AssemblyConstraintHistory] hook "${A}" failed:`,D)}},"safeCallHook"),F=n.scene||null,P=Array.isArray(n.features)?n.features.filter(Boolean):[],M=new Map;for(const A of P){const N=B(A?.inputParams?.featureID);N&&M.set(N,A)}const H=new Set,E=c(A=>hr(F,A,{scoreFn:vr,allowJson:!1,allowUuidString:!1,allowUuidObject:!0,allowFuzzyName:!1,allowNameContains:!1,allowPath:!1,allowReference:!1,allowTarget:!1,allowSelectionName:!1,arrayMode:"first"}),"resolveObject"),rt=c(A=>{const N=E(A);return wn(N)},"resolveComponent"),q=c(A=>{if(!A)return null;const N=B(A.owningFeatureID);return N&&M.get(N)||null},"getFeatureForComponent"),Jt=c(A=>!!(!A||A.fixed||A.userData?.fixedByConstraint||q(A)?.inputParams?.isFixed),"isComponentFixed"),It=c(A=>{A&&H.add(A)},"markUpdated"),U={partHistory:n,scene:F,tolerance:r,translationGain:s,rotationGain:u,resolveObject:E,resolveComponent:rt,applyTranslation:c((A,N)=>{const R=zr(N);return!A||!R||R.lengthSq()===0?!1:(A.position.add(R),A.updateMatrixWorld?.(!0),It(A),!0)},"applyTranslation"),applyRotation:c((A,N)=>{if(!A||!N)return!1;let R;if(N instanceof ce)R=N.clone();else{const D=at(N?.x,0),it=at(N?.y,0),k=at(N?.z,0),$=Number.isFinite(N?.w)?N.w:1;R=new ce(D,it,k,$)}return!Number.isFinite(R.x)||!Number.isFinite(R.y)||!Number.isFinite(R.z)||!Number.isFinite(R.w)?!1:(Math.abs(1-R.lengthSq())>1e-6&&R.normalize(),A.quaternion.premultiply(R),A.updateMatrixWorld?.(!0),It(A),!0)},"applyRotation"),isComponentFixed:Jt,getFeatureForComponent:q,markUpdated:It,viewer:y,renderScene:b,debugMode:f};kr(F);const ur=h(this,w,he).call(this),ht=this.constraints.map(A=>{const N=Ct(A);if(A?.enabled===!1)return{entry:A,instance:null,result:{id:N,ok:!0,status:"disabled",message:st,applied:!1,satisfied:!1,iteration:0,constraintID:N},skipReason:"disabled"};const R=ur.get(A);if(R){const j=Array.isArray(R.relatedIds)?R.relatedIds.slice():[],G={id:N,ok:!1,status:"duplicate",message:R.message,applied:!1,satisfied:!1,iteration:0,constraintID:N,duplicateConstraintIDs:j,duplicateSignature:R.signature};return{entry:A,instance:null,result:G,skipReason:"duplicate"}}const D=h(this,w,Dt).call(this,A.type);if(!D){const j=on(A.type);return A.persistentData={status:"error",message:j,lastRunAt:Date.now(),lastIteration:0},{entry:A,instance:null,result:{id:N,ok:!1,status:"error",message:j,applied:!1,satisfied:!1,iteration:0,constraintID:N},skipReason:"unregistered"}}const it=O(A.inputParams)||{},k=O(A.inputParams)||{},$=new D(n);h(this,w,In).call(this,k,D.inputParamsSchema||{});try{$.inputParams=k}catch{$.inputParams={...k}}try{Object.assign($.persistentData,O(A.persistentData))}catch{$.persistentData={...A.persistentData||{}}}return{entry:A,instance:$,result:null,originalInputParams:it}});for(const A of ht)A.instance?.clearDebugArrows?.({scene:F});await C("onStart",{maxIterations:i,constraintCount:ht.length});let Qe=0;const cr=ht.length;t:for(let A=0;A<i&&!(_()||(await C("onIterationStart",{iteration:A,maxIterations:i}),_()));A+=1){let N=!1;for(let R=0;R<ht.length;R+=1){if(_())break t;const D=ht[R],it=Ct(D?.entry),k=D?.entry?.type||null,$={iteration:A,index:R,id:it,constraintID:it,constraintType:k,totalConstraints:cr};if(!D.instance){await C("onConstraintSkipped",{...$,skipReason:D.skipReason||null});continue}if(await C("onConstraintStart",$),_())break t;const j={...U,iteration:A,maxIterations:i};let G;try{typeof D.instance.solve=="function"?G=await D.instance.solve(j):G=await D.instance.run(j)}catch(dt){console.warn("[AssemblyConstraintHistory] Constraint solve failed:",dt),G={ok:!1,status:"error",message:dt?.message||"Constraint evaluation failed.",error:dt},D.instance.persistentData=D.instance.persistentData||{},D.instance.persistentData.status="error",D.instance.persistentData.message=G.message}if(D.result=h(this,w,me).call(this,D.instance,G,A),D.result.applied&&(N=!0),await C("onConstraintEnd",{...$,result:D.result}),_())break t}if(typeof U.renderScene=="function")try{U.renderScene()}catch{}if(l>0&&await new Promise(R=>setTimeout(R,l)),_()||(Qe=A+1,await C("onIterationComplete",{iteration:A,maxIterations:i,applied:N}),_())||!N)break}I=I||g?.aborted||!1;const lr=Date.now(),te=[];for(const A of ht){const{entry:N,instance:R}=A,D=A.result||h(this,w,me).call(this,R,{ok:!1,status:"pending",message:"Constraint was not evaluated."},Math.max(0,i-1)),k={...R?.persistentData&&Object.keys(R.persistentData).length?R.persistentData:N.persistentData||{}};if(D.status&&(k.status=D.status),D.message!==void 0&&(D.message?k.message=D.message:k.message&&delete k.message),k.satisfied=!!D.satisfied,typeof D.error=="number"&&Number.isFinite(D.error)&&(k.error=D.error),k.lastRunAt=lr,k.lastIteration=D.iteration,k.lastRequestedIterations=i,D.status==="duplicate"?(Array.isArray(D.duplicateConstraintIDs)&&D.duplicateConstraintIDs.length?k.duplicateConstraintIDs=D.duplicateConstraintIDs.slice():k.duplicateConstraintIDs&&delete k.duplicateConstraintIDs,D.duplicateSignature?k.duplicateSignature=D.duplicateSignature:k.duplicateSignature&&delete k.duplicateSignature):(k.duplicateConstraintIDs&&delete k.duplicateConstraintIDs,k.duplicateSignature&&delete k.duplicateSignature),N.persistentData=k,A.originalInputParams){const j=O(A.originalInputParams)||{};D.persistInputParams&&typeof D.persistInputParams=="object"&&Object.assign(j,O(D.persistInputParams));const G=N.inputParams&&typeof N.inputParams=="object"?N.inputParams:{};for(const dt of Object.keys(G))Object.prototype.hasOwnProperty.call(j,dt)||delete G[dt];Object.assign(G,j),N.inputParams=G}else{const j={...N.inputParams||{}};D.persistInputParams&&typeof D.persistInputParams=="object"&&Object.assign(j,O(D.persistInputParams)),N.inputParams=j}const $=Ct(N);te.push({id:$,constraintID:$,type:N?.type||null,...D})}try{n.syncAssemblyComponentTransforms?.()}catch(A){console.warn("[AssemblyConstraintHistory] Failed to sync component transforms:",A)}return h(this,w,L).call(this,"solve"),await C("onComplete",{results:te.slice(),aborted:I,iterationsCompleted:Qe,maxIterations:i}),te}};w=new WeakSet,_n=c(function(t){if(!t||typeof t!="object")return t;const e={...t},n=t.inputParams&&typeof t.inputParams=="object"?t.inputParams:null;if(n){const i={...n},s=Object.prototype.hasOwnProperty.call(i,"constraintID")?i.constraintID:void 0;(i.id==null||i.id==="")&&s!=null&&(i.id=s),Object.prototype.hasOwnProperty.call(i,"constraintID")&&delete i.constraintID,e.inputParams=i}const r=Object.prototype.hasOwnProperty.call(e,"constraintID")?e.constraintID:void 0;return(e.id==null||e.id==="")&&r!=null&&(e.id=r),Object.prototype.hasOwnProperty.call(e,"constraintID")&&delete e.constraintID,(e.id==null||e.id==="")&&e.inputParams?.id!=null&&(e.id=e.inputParams.id),e},"#runConstraintEntryMigrations"),xt=c(function(t){if(!t||!t.inputParams)return;const e=t.inputParams,n=e.id??e.constraintID??t.id;if(!n)return;const r=String(n);e.id=r,t.id=r},"#syncEntryIds"),pe=c(function(t){if(!t||typeof t!="object")return;(!t.inputParams||typeof t.inputParams!="object")&&(t.inputParams={});const e=t.inputParams,n={configurable:!0,enumerable:!1};h(this,w,xt).call(this,t);const r=Object.prototype.hasOwnProperty.call(e,"constraintID")?e.constraintID:void 0;if(r!=null&&(e.id==null||e.id==="")&&(e.id=r),Object.prototype.hasOwnProperty.call(e,"constraintID"))try{delete e.constraintID}catch{}Object.getOwnPropertyDescriptor(e,"constraintID")||Object.defineProperty(e,"constraintID",{...n,get:c(()=>e.id,"get"),set:c(a=>{if(a==null){e.id=a,t.id=a;return}const m=String(a);e.id=m,t.id=m},"set")});const i=Object.prototype.hasOwnProperty.call(e,"__open")?e.__open:t.__open;if(Object.prototype.hasOwnProperty.call(e,"__open"))try{delete e.__open}catch{}const s=i!==!1;t.__open=s;const u=t.runtimeAttributes&&typeof t.runtimeAttributes=="object"?t.runtimeAttributes:{};u.__open=s;try{Object.defineProperty(t,"runtimeAttributes",{value:u,configurable:!0,writable:!0,enumerable:!1})}catch{t.runtimeAttributes=u}Object.prototype.hasOwnProperty.call(e,"__entityRef")||Object.defineProperty(e,"__entityRef",{...n,value:t});let f;if(Object.prototype.hasOwnProperty.call(e,"persistentData")){f=e.persistentData;try{delete e.persistentData}catch{}}f&&typeof f=="object"?t.persistentData=O(f):(!t.persistentData||typeof t.persistentData!="object")&&(t.persistentData={}),Object.defineProperty(e,"persistentData",{...n,get:c(()=>t.persistentData||(t.persistentData={}),"get"),set:c(a=>{const m=a&&typeof a=="object"?a:{};t.persistentData=m},"set")}),Object.defineProperty(e,"__open",{...n,get:c(()=>t.runtimeAttributes.__open!==!1,"get"),set:c(a=>{const m=a!==!1;t.runtimeAttributes.__open=m,t.__open=m},"set")}),t.type&&!e.type&&(e.type=t.type),t.entityType=t.type||e.type||t.entityType||null},"#linkEntryParams"),In=c(function(t,e){if(!(!t||!e))for(const n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const r=e[n];if(!r||r.type!=="number")continue;const i=xr(this.partHistory,t[n]);i!=null&&(t[n]=i)}},"#applyNumericExpressions"),he=c(function(){const t=new Map;for(const n of this.constraints){if(!n)continue;const r=h(this,w,Cn).call(this,n?.type);if(!r)continue;const i=h(this,w,xn).call(this,n?.inputParams);if(!i)continue;t.has(i)||t.set(i,[]);const s=mt(n)||null,u=an[r]||r;t.get(i).push({entry:n,type:r,typeLabel:u,id:s})}const e=new Map;for(const[n,r]of t.entries()){if(!Array.isArray(r)||r.length<=1)continue;const i=new Map;for(const s of r)i.has(s.type)||i.set(s.type,[]),i.get(s.type).push(s);for(const s of r){const u=(i.get(s.type)||[]).filter(b=>b!==s),f=[];for(const[b,d]of i.entries())b!==s.type&&f.push({type:b,entries:d});const a=c((b,d)=>{const g=Array.from(new Set(d.map(_=>_&&_.trim()?_.trim():null).filter(Boolean)));if(g.length===0)return`${b} constraint`;const I=g.length>1?"constraints":"constraint";return`${b} ${I} ${g.join(", ")}`},"formatConstraintPhrase"),m=[];if(u.length){const b=u.map(d=>d.id);m.push(a(`shares selections with ${s.typeLabel}`,b))}for(const b of f){const d=an[b.type]||b.type,g=b.entries.map(I=>I.id);m.push(a(`conflicts with ${d}`,g))}const l=m.length?`Duplicate constraint selections: ${m.join(". ")}.`:"Duplicate constraint selections.",y=r.filter(b=>b!==s).map(b=>b.id).filter(Boolean);e.set(s.entry,{message:l,signature:n,relatedIds:Array.from(new Set(y)),type:s.type})}}return e},"#detectDuplicateConstraints"),Cn=c(function(t){const e=B(t).toLowerCase();return e&&Fr.get(e)||null},"#normalizeDuplicateConstraintType"),tt=c(function(t=null){if(!this.partHistory)return;const e=t&&typeof t=="object"?{...t}:null;this._autoRunOptions=e,!this._autoRunScheduled&&(this._autoRunScheduled=!0,Promise.resolve().then(()=>{try{h(this,w,de).call(this)}catch(n){console.warn("[AssemblyConstraintHistory] Failed to schedule auto run:",n)}}))},"#scheduleAutoRun"),de=c(async function(){if(!this._autoRunScheduled||this._autoRunActive)return;const t=this._autoRunOptions?{...this._autoRunOptions}:{};this._autoRunOptions=null,this._autoRunScheduled=!1;const e=Number(t.iterations),n=Number.isFinite(e)&&e>=1?Math.floor(e):Or,r=this.partHistory;if(r){this._autoRunActive=!0;try{await this.runAll(r,{...t,iterations:n})}catch(i){console.warn("[AssemblyConstraintHistory] Auto run failed:",i)}finally{this._autoRunActive=!1,this._autoRunScheduled&&Promise.resolve().then(()=>{try{h(this,w,de).call(this)}catch(i){console.warn("[AssemblyConstraintHistory] Failed to re-run auto cycle:",i)}})}}},"#executeAutoRun"),xn=c(function(t){if(!t||typeof t!="object")return null;const e=h(this,w,Dn).call(this,t);if(!e)return null;const n=[];for(const r of e){const i=h(this,w,St).call(this,r,0,new Set);if(!i)return null;n.push(i)}return n.length!==2?null:(n.sort(),`${n[0]}|${n[1]}`)},"#buildSelectionSignature"),Dn=c(function(t){const e=Array.isArray(t?.elements)?t.elements:[],n=[];for(const r of e)if(r!=null&&(n.push(r),n.length>=2))break;return n.length>=2?n.slice(0,2):null},"#extractSelectionPair"),St=c(function(t,e=0,n=new Set){if(t==null||e>5)return null;if(Array.isArray(t)){for(const i of t){const s=h(this,w,St).call(this,i,e+1,n);if(s)return s}return null}const r=typeof t;if(r==="string"||r==="number"||r==="boolean")return`${r}:${String(t)}`;if(r!=="object"||n.has(t))return null;n.add(t);try{if(t.isObject3D&&typeof t.uuid=="string"&&t.uuid)return`uuid:${t.uuid}`;const i=["selectionID","selectionId","fullName","fullPath","pathKey","pathId","pathID","id","uuid","entityUUID","brepId","brepID","objectUUID","objectId","objectID"];for(const a of i){const m=t[a];if(typeof m=="string"&&m.trim())return`${a}:${m.trim()}`}const s=["name","label","displayName","componentName","faceName","edgeName","vertexName","reference","refName"];for(const a of s){const m=t[a];if(typeof m=="string"&&m.trim())return`${a}:${m.trim()}`}if(Array.isArray(t.path)&&t.path.length){const a=t.path.map(m=>String(m)).join("/");if(a)return`path:${a}`}if(t.component&&typeof t.component=="object"){const a=h(this,w,St).call(this,t.component,e+1,n);if(a)return`component:${a}`}if(t.object&&typeof t.object=="object"){const a=h(this,w,St).call(this,t.object,e+1,n);if(a)return`object:${a}`}const u=Object.keys(t).filter(a=>a!=="__proto__").sort(),f=[];for(const a of u){const m=t[a];if(m==null||typeof m=="function"||typeof m=="symbol")continue;let l=null;if(typeof m=="object"){const y=h(this,w,St).call(this,m,e+1,n);y&&(l=y)}else l=`${typeof m}:${String(m)}`;if(l&&(f.push(`${a}=${l}`),f.length>=8))break}return f.length?`obj:${f.join(",")}`:null}finally{n.delete(t)}},"#selectionKey"),me=c(function(t,e,n){const r=e&&typeof e=="object"?e:{},i=!!r.satisfied,s=!!r.applied,u=r.ok!==!1,f=typeof r.message=="string"?r.message:"";let a=typeof r.status=="string"&&r.status.trim()?r.status.trim():null;a||(u?i?a="satisfied":s?a="adjusted":a="pending":a="error");const m=Number.isFinite(r.error)?r.error:null,l=r.persistInputParams&&typeof r.persistInputParams=="object"?O(r.persistInputParams):null;return t&&(t.persistentData=t.persistentData||{},t.persistentData.status||(t.persistentData.status=a),f&&!t.persistentData.message&&(t.persistentData.message=f),t.persistentData.satisfied=i,m!=null&&(t.persistentData.error=m),t.persistentData.isNewConstraint===!0&&u&&s&&(t.persistentData.isNewConstraint=!1)),{ok:u,status:a,satisfied:i,applied:s,error:m,message:f,iteration:n,diagnostics:r.diagnostics||null,persistInputParams:l}},"#finalizeConstraintResult"),Dt=c(function(t){const e=B(t);if(!e)return null;if(this.registry&&typeof this.registry.getSafe=="function"){const n=this.registry.getSafe(e);if(n)return n}if(this.registry&&typeof this.registry.get=="function")try{return this.registry.get(e)}catch{return null}return null},"#resolveConstraint"),L=c(function(t="update",e=null,n=null){if(!(this._listeners instanceof Set)||this._listeners.size===0)return;const r={...n&&typeof n=="object"?n:{},history:this,entry:e||null,reason:t||"update"};for(const i of Array.from(this._listeners))try{i({...r})}catch{}},"#emitChange"),c(Be,"AssemblyConstraintHistory");let fe=Be;const We=class We{constructor(){this.metadata={}}getMetadata(t){const e=this.metadata[t]||{};return e.inheritsFrom?{...this.getMetadata(e.inheritsFrom),...e}:e}getOwnMetadata(t){const e=this.metadata[t];return e?{...e}:{}}setMetadata(t,e,n){this.metadata[t]||(this.metadata[t]={}),this.metadata[t][e]=n}setMetadataObject(t,e){e&&Object.keys(e).length>0?this.metadata[t]={...e}:delete this.metadata[t]}deleteMetadataKey(t,e){const n=this.metadata[t];n&&(delete n[e],Object.keys(n).length===0&&delete this.metadata[t])}clearMetadata(t){delete this.metadata[t]}};c(We,"MetadataManager");let Xt=We;const Ge=class Ge{constructor(t){this.partHistory=t||null,this.views=[],this._listeners=new Set}reset(){this.views=[],this._emit()}getViews(){return this._normalizeViewsArray(this.views),this.views}setViews(t){const e=Array.isArray(t)?Array.from(t):[];return this.views=e,this._normalizeViewsArray(this.views),this._emit(),this.views}addView(t){const e=this.getViews(),n=this._normalizeView(t,e.length);return e.push(n),this._emit(),n}updateView(t,e){const n=this.getViews(),r=Number(t);if(!Number.isInteger(r)||r<0||r>=n.length)return null;const i=n[r];let s=i;if(typeof e=="function")try{const u=e(i);u&&typeof u=="object"&&(s=u)}catch{}else e&&typeof e=="object"&&e!==i&&(s=Object.assign({},i,e));return s!==i&&(n[r]=s),n[r]=this._normalizeView(n[r],r),this._emit(),n[r]}removeView(t){const e=this.getViews(),n=Number(t);if(!Number.isInteger(n)||n<0||n>=e.length)return null;const[r]=e.splice(n,1);for(let i=0;i<e.length;i++)e[i]=this._normalizeView(e[i],i);return this._emit(),r||null}addListener(t){return typeof t!="function"?()=>{}:(this._listeners.add(t),()=>{try{this._listeners.delete(t)}catch{}})}removeListener(t){if(typeof t=="function")try{this._listeners.delete(t)}catch{}}notifyChanged(){this._emit()}toSerializable(){return this.getViews().map(t=>O(t))}_normalizeViewsArray(t){if(!Array.isArray(t))return this.views=[],this.views;for(let e=0;e<t.length;e++)t[e]=this._normalizeView(t[e],e);return t}_normalizeView(t,e){const n=Number.isInteger(e)?e:0,r=t&&typeof t=="object"?t:{},i=typeof r.name=="string"?r.name.trim():"",u=(typeof r.viewName=="string"?r.viewName.trim():"")||i||`View ${n+1}`;if(r.viewName=u,r.name=u,Array.isArray(r.annotations)||(r.annotations=[]),(!r.camera||typeof r.camera!="object")&&(r.camera={}),r.camera.viewport&&typeof r.camera.viewport=="object"){const m=Number(r.camera.viewport.width),l=Number(r.camera.viewport.height);m>0&&l>0?r.camera.viewport={width:m,height:l}:delete r.camera.viewport}(!r.viewSettings||typeof r.viewSettings!="object")&&(r.viewSettings={});const f=Number(r.viewSettings?.pmiTextSizePt);Number.isFinite(f)&&f>0?r.viewSettings.pmiTextSizePt=Math.max(1,Math.min(288,f)):delete r.viewSettings.pmiTextSizePt;const a=Array.isArray(r.viewSettings?.visibilityState?.hidden)?r.viewSettings.visibilityState.hidden.map(m=>({key:String(m?.key||""),count:Math.max(1,Math.round(Number(m?.count)||1))})).filter(m=>m.key):[];return a.length?r.viewSettings.visibilityState={hidden:a}:delete r.viewSettings.visibilityState,r.annotationHistory&&typeof r.annotationHistory!="object"&&delete r.annotationHistory,r}_emit(){if(!this._listeners||this._listeners.size===0)return;const t=this.getViews();for(const e of Array.from(this._listeners))try{e(t,this.partHistory||null)}catch{}}};c(Ge,"PMIViewsManager");let ye=Ge;const Ke=class Ke{constructor(){this.entityClasses=new Map}register(t){if(!t)return;const e=t.shortName;if(!e)throw new Error("EntityClass must declare static entityType (or type/name).");this.entityClasses.set(e,t)}resolve(t){const e=t;return e&&this.entityClasses.get(e)||null}};c(Ke,"entityClassRegistry");let ge=Ke;const qe=class qe{constructor({viewer:t=null,registry:e=null}={}){this.viewer=t||null,this.registry=e||null,this.entries=[],this.registry=new ge,this._listeners=new Set,this._idCounter=0}serializableData(){return this.entries.map(t=>({id:t.id,type:t.type,inputParams:t.inputParams,persistentData:t.persistentData}))}};c(qe,"HistoryCollectionBase");let be=qe;const Mr={id:{type:"string",default_value:null,hint:"Unique identifier for this linear motion."},solid:{type:"reference_selection",selectionFilter:["SOLID"],multiple:!1,default_value:null,hint:"Select the solid to drive."},axis:{type:"reference_selection",selectionFilter:["EDGE"],multiple:!1,default_value:null,hint:"Select an edge or centerline to use as the travel direction."},speed:{type:"number",default_value:10,hint:"Linear speed in scene units per second."},distance:{type:"number",default_value:0,hint:"Optional travel distance. Leave blank to move continuously."}},ut=class ut extends An{onIdChanged(){}onParamsChanged(){}onPersistentDataChanged(){}};c(ut,"LinearMotionEntity"),Z(ut,"entityType","linear"),Z(ut,"shortName","LIN"),Z(ut,"longName","Linear Motion"),Z(ut,"inputParamsSchema",Mr);let Yt=ut;const Er={id:{type:"string",default_value:null,hint:"Unique identifier for this rotation motion."},solid:{type:"reference_selection",selectionFilter:["SOLID"],multiple:!1,default_value:null,hint:"Select the solid to drive."},axis:{type:"reference_selection",selectionFilter:["EDGE"],multiple:!1,default_value:null,hint:"Select an edge or centerline to rotate about."},speed:{type:"number",default_value:90,hint:"Rotation speed in degrees per second."},angle:{type:"number",default_value:0,hint:"Optional total angle in degrees. Leave blank to rotate continuously."}},ct=class ct extends An{onIdChanged(){}onParamsChanged(){}onPersistentDataChanged(){}};c(ct,"RotationMotionEntity"),Z(ct,"entityType","rotation"),Z(ct,"shortName","ROT"),Z(ct,"longName","Rotation Motion"),Z(ct,"inputParamsSchema",Er);let Zt=ct;const yt="rotation",ln=new Set(["type","persistentData","__open"]),Xe=class Xe extends be{constructor(t){super({viewer:null}),this.partHistory=t||null,this._registerAvailableEntries()}getMotions(){return this.entries}createMotion(t=yt,e=null){const n=this._resolveHandler(t);if(!n)return null;const r=new n({history:this,registry:this.registry});r.type=n.entityType||n.type||yt,r.entityType=r.type;const i=this._defaultsFromSchema(n),s=O(e||{});r.setParams({...i,...s,type:r.type}),r.setPersistentData(s.persistentData||{}),delete r.inputParams.persistentData;const u=r.inputParams.id||this.generateId(r.shortName||r.type||"SIM");return r.setId(u),r.runtimeAttributes.__open=!0,this._linkInputParams(r),this.entries.push(r),this._bumpIdCounterFrom(r),this.notifyListeners({reason:"add",entry:r,history:this}),r}loadSerializable(t){this.entries=[],this._idCounter=0;const e=t&&typeof t=="object"&&!Array.isArray(t)?t:{motions:t},n=Array.isArray(e.motions)?e.motions:[];for(const r of n){const i=this._hydrateEntity(r);i&&(this.entries.push(i),this._bumpIdCounterFrom(i),this._linkInputParams(i))}return this.notifyListeners({reason:"load",history:this}),this.entries}toSerializable(){return{motions:this.entries.map(t=>{const e=!!t.runtimeAttributes?.__open,n=O(t.inputParams||{});return n&&typeof n=="object"&&(delete n.persistentData,delete n.__open,delete n.__entityRef),{type:t.type||yt,inputParams:n,persistentData:O(t.persistentData||{}),__open:e||void 0}})}}reset(){this.entries=[],this._idCounter=0,this.notifyListeners({reason:"clear",history:this})}generateId(t="SIM"){const e=String(t||"SIM").replace(/[^a-z0-9]/gi,"").toUpperCase()||"SIM",n=new Set(this.entries.map((i,s)=>{const u=i?.inputParams;return u?.id?String(u.id):i?.id!=null?String(i.id):`SIM${s+1}`}));let r="";do this._idCounter+=1,r=`${e}${this._idCounter}`;while(n.has(r));return r}addListener(t){return typeof t!="function"?()=>{}:(this._listeners.add(t),()=>{try{this._listeners.delete(t)}catch{}})}removeListener(t){if(typeof t=="function")try{this._listeners.delete(t)}catch{}}notifyListeners(t={}){if(this._listeners instanceof Set)for(const e of Array.from(this._listeners))try{e(t,this)}catch{}}_registerAvailableEntries(){for(const t of[Zt,Yt])try{this.registry.register(t)}catch{}}_resolveHandler(t){return String(t||"").trim().toLowerCase()==="linear"?Yt:Zt}_defaultsFromSchema(t){const e={},n=t?.inputParamsSchema;if(!n||typeof n!="object")return e;for(const r of Object.keys(n)){if(ln.has(r))continue;const i=n[r];!i||typeof i!="object"||Object.prototype.hasOwnProperty.call(i,"default_value")&&(e[r]=O(i.default_value))}return e}_hydrateEntity(t){const e=t&&typeof t=="object"?t:{},n=this._resolveHandler(e.type||e.inputParams?.type||yt);if(!n)return null;const r=new n({history:this,registry:this.registry});r.type=n.entityType||n.type||yt,r.entityType=r.type;const i=this._cloneWithoutReserved(e.inputParams||e);i.type||(i.type=r.type),r.setParams(i),r.setPersistentData(O(e.persistentData||{})),delete r.inputParams.persistentData;const s=r.inputParams.id||e.id||this.generateId(r.shortName||r.type);return r.setId(s),r.runtimeAttributes.__open=!!e.__open,this._linkInputParams(r),r}_cloneWithoutReserved(t){const e={};if(!t||typeof t!="object")return e;for(const n of Object.keys(t))ln.has(n)||(e[n]=O(t[n]));return e}_linkInputParams(t){if(!t)return;(!t.runtimeAttributes||typeof t.runtimeAttributes!="object")&&(t.runtimeAttributes={});const e=t.inputParams||{},n={configurable:!0,enumerable:!1};Object.prototype.hasOwnProperty.call(e,"__entityRef")||Object.defineProperty(e,"__entityRef",{...n,value:t}),Object.prototype.hasOwnProperty.call(e,"persistentData")||Object.defineProperty(e,"persistentData",{...n,get:c(()=>t.persistentData,"get"),set:c(r=>{const i=r&&typeof r=="object"?r:{};t.setPersistentData(i)},"set")}),Object.prototype.hasOwnProperty.call(e,"__open")||Object.defineProperty(e,"__open",{...n,get:c(()=>!!t.runtimeAttributes.__open,"get"),set:c(r=>{t.runtimeAttributes.__open=!!r},"set")}),e.type=t.type||e.type||yt,e.id==null&&t.id!=null&&(e.id=t.id)}_bumpIdCounterFrom(t){const e=t?.inputParams?.id||t?.id;if(!e)return;const n=String(e).match(/(\d+)$/);if(!n)return;const r=parseInt(n[1],10);Number.isFinite(r)&&r>this._idCounter&&(this._idCounter=r)}};c(Xe,"SimulationStateManager");let Se=Xe;const gt=96,Nn=1;function jr(o,t=0){const e=Number(o);return Number.isFinite(e)?e:t}c(jr,"toFiniteNumber$4");function Ae(o,t){return Math.max(Nn,jr(o,t))}c(Ae,"clampCustomSheetSize");function fn(o){const t=Math.round(Ae(o,Nn)*100)/100;return String(t).replace(/(\.\d*?[1-9])0+$/u,"$1").replace(/\.0+$/u,"")}c(fn,"formatSheetDimension");const we=Object.freeze({A:Object.freeze({key:"A",label:"A (8.5 x 11 in)",widthIn:8.5,heightIn:11}),B:Object.freeze({key:"B",label:"B (11 x 17 in)",widthIn:11,heightIn:17}),C:Object.freeze({key:"C",label:"C (17 x 22 in)",widthIn:17,heightIn:22}),D:Object.freeze({key:"D",label:"D (22 x 34 in)",widthIn:22,heightIn:34}),E:Object.freeze({key:"E",label:"E (34 x 44 in)",widthIn:34,heightIn:44}),A4:Object.freeze({key:"A4",label:"A4 (210 x 297 mm)",widthIn:8.27,heightIn:11.69}),A3:Object.freeze({key:"A3",label:"A3 (297 x 420 mm)",widthIn:11.69,heightIn:16.54}),A2:Object.freeze({key:"A2",label:"A2 (420 x 594 mm)",widthIn:16.54,heightIn:23.39}),A1:Object.freeze({key:"A1",label:"A1 (594 x 841 mm)",widthIn:23.39,heightIn:33.11}),A0:Object.freeze({key:"A0",label:"A0 (841 x 1189 mm)",widthIn:33.11,heightIn:46.81}),CUSTOM:Object.freeze({key:"CUSTOM",label:"Custom",widthIn:36,heightIn:24})}),Hr=Object.freeze(["A","B","C","D","E","A4","A3","A2","A1","A0","CUSTOM"]);function Fn(o){return String(o??"").trim().toLowerCase()==="portrait"?"portrait":"landscape"}c(Fn,"normalizeSheetOrientation");function Pn(o){const t=String(o??"").trim().toUpperCase();return we[t]||we.A}c(Pn,"getSheetSizeByKey");function bi(){return Hr.map(o=>we[o]).filter(Boolean)}c(bi,"listSheetSizes");function $r(o,t="landscape",e=null){const n=Pn(o),r=Fn(t);if(n.key==="CUSTOM"){const f=Ae(e?.customWidthIn??e?.widthIn,n.widthIn),a=Ae(e?.customHeightIn??e?.heightIn,n.heightIn),m=r==="landscape",l=m?Math.max(f,a):Math.min(f,a),y=m?Math.min(f,a):Math.max(f,a);return{key:n.key,label:`Custom (${fn(l)} x ${fn(y)} in)`,orientation:r,units:"in",widthIn:l,heightIn:y,widthPx:l*gt,heightPx:y*gt,pxPerInch:gt,customWidthIn:l,customHeightIn:y}}const i=r==="landscape",s=i?Math.max(n.widthIn,n.heightIn):Math.min(n.widthIn,n.heightIn),u=i?Math.min(n.widthIn,n.heightIn):Math.max(n.widthIn,n.heightIn);return{key:n.key,label:n.label,orientation:r,units:"in",widthIn:s,heightIn:u,widthPx:s*gt,heightPx:u*gt,pxPerInch:gt}}c($r,"resolveSheetDimensions");function Tt(o,t=0){const e=Number(o);return Number.isFinite(e)?e:t}c(Tt,"toFiniteNumber$3");function X(o,t,e){return Math.max(t,Math.min(e,o))}c(X,"clamp$1");function nt(o,t=""){return typeof o=="string"?o:o==null?t:String(o)}c(nt,"sanitizeText$1");function Lr(o,t=null){const e=String(o??"").trim();return e&&(/^#[\da-fA-F]{3,8}$/.test(e)||/^[a-zA-Z]+$/.test(e)||/^(rgb|rgba|hsl|hsla)\([^)]+\)$/i.test(e))?e:t}c(Lr,"sanitizeColor$1");function z(o,t=1){return Math.max(1,Math.round(Tt(o,t)))}c(z,"clampPositiveInt");function K(o,t=0){return Math.max(0,Math.round(Tt(o,t)))}c(K,"clampIndex");function Ur(o,t=null){if(o==null)return t;const e=String(o).trim().toLowerCase();return e==="middle"||e==="center"?"center":e==="end"||e==="right"?"right":e==="left"?"left":t}c(Ur,"normalizeTextAlign$1");function Vr(o,t=null){if(o==null)return t;const e=String(o).trim().toLowerCase();return e==="center"?"middle":e==="bottom"?"bottom":e==="middle"||e==="top"?e:t}c(Vr,"normalizeVerticalAlign$1");function Br(o,t=null){if(o==null)return t;const e=String(o).trim();return e==="bold"?"700":e==="normal"?"400":/^\d{3}$/.test(e)?e:t}c(Br,"normalizeFontWeight");function Wr(o,t=null){return o==null?t:String(o).trim().toLowerCase()==="italic"?"italic":"normal"}c(Wr,"normalizeFontStyle");function Gr(o,t=null){return o==null?t:String(o).trim().toLowerCase()==="underline"?"underline":"none"}c(Gr,"normalizeTextDecoration");function Ue(o){if(!o||typeof o!="object"||Array.isArray(o))return{};const t={},e=nt(o.fontFamily,"").trim();e&&(t.fontFamily=e);const n=Tt(o.fontSize,Number.NaN);Number.isFinite(n)&&n>0&&(t.fontSize=X(n,.08,3));const r=Br(o.fontWeight??(o.bold?"700":null));r&&(t.fontWeight=r);const i=Wr(o.fontStyle??(o.italic?"italic":null));i&&(t.fontStyle=i);const s=Gr(o.textDecoration);s&&(t.textDecoration=s);const u=Ur(o.textAlign??o.textAnchor);u&&(t.textAlign=u);const f=Vr(o.verticalAlign??o.verticalAnchor);f&&(t.verticalAlign=f);const a=Lr(o.color??o.textColor,null);return a&&(t.color=a),t}c(Ue,"normalizeTableCellStyle");function Rn(o=""){return{text:nt(o,""),rowSpan:1,colSpan:1,mergedInto:null,style:{}}}c(Rn,"createTableCell");function ft(o,t){const e=Math.max(1,z(t,1)),n=Array.isArray(o)?o.slice(0,e):[],r=[];for(let s=0;s<e;s+=1)r.push(Math.max(1e-4,Tt(n[s],1)));const i=r.reduce((s,u)=>s+u,0);return!Number.isFinite(i)||i<=0?Array.from({length:e},()=>1/e):r.map(s=>s/i)}c(ft,"normalizeTableFractions");function wt(o,t=0){return Array.isArray(o?.cells)&&o.cells.length>0?o.cells.length:Array.isArray(o?.rowFractions)&&o.rowFractions.length>0?o.rowFractions.length:Math.max(0,z(t,0))}c(wt,"getTableRowCount");function _t(o,t=0){const e=Array.isArray(o?.cells)?o.cells:[];let n=0;for(const r of e)Array.isArray(r)&&(n=Math.max(n,r.length));return n>0?n:Array.isArray(o?.colFractions)&&o.colFractions.length>0?o.colFractions.length:Math.max(0,z(t,0))}c(_t,"getTableColumnCount");function On(o=3,t=3){const e=Math.max(1,z(o,3)),n=Math.max(1,z(t,3));return{rowFractions:ft(null,e),colFractions:ft(null,n),cells:Array.from({length:e},()=>Array.from({length:n},()=>Rn()))}}c(On,"createTableData");function kt(o,t=3,e=3){const n=Math.max(1,wt(o,t)),r=Math.max(1,_t(o,e)),i=On(n,r);i.rowFractions=ft(o?.rowFractions,n),i.colFractions=ft(o?.colFractions,r);const s=Array.isArray(o?.cells)?o.cells:[],u=[];for(let a=0;a<n;a+=1)for(let m=0;m<r;m+=1){const l=Array.isArray(s[a])?s[a][m]:null,y=i.cells[a][m];l&&typeof l=="object"&&!Array.isArray(l)?(y.text=nt(l.text,nt(l.value,"")),y.style=Ue(l.style&&typeof l.style=="object"?l.style:l),u.push({row:a,col:m,rowSpan:z(l.rowSpan,1),colSpan:z(l.colSpan,1)})):(y.text=nt(l,""),y.style={}),y.rowSpan=1,y.colSpan=1,y.mergedInto=null}const f=Array.from({length:n},()=>Array.from({length:r},()=>!1));for(const a of u){const m=X(a.rowSpan,1,n-a.row),l=X(a.colSpan,1,r-a.col);if(m===1&&l===1)continue;let y=!1;for(let d=a.row;d<a.row+m&&!y;d+=1)for(let g=a.col;g<a.col+l;g+=1)if(!(d===a.row&&g===a.col)&&f[d][g]){y=!0;break}if(y)continue;const b=i.cells[a.row][a.col];b.rowSpan=m,b.colSpan=l;for(let d=a.row;d<a.row+m;d+=1)for(let g=a.col;g<a.col+l;g+=1)d===a.row&&g===a.col||(f[d][g]=!0,i.cells[d][g]={text:"",rowSpan:1,colSpan:1,mergedInto:{row:a.row,col:a.col},style:{}})}return i}c(kt,"normalizeTableData");function Ot(o,t,e){return Array.isArray(o?.cells?.[t])&&o.cells[t][e]||null}c(Ot,"getTableCell");function Tn(o,t,e){const n=Ot(o,t,e);if(!n)return null;const r=n?.mergedInto;if(r&&Number.isInteger(r.row)&&Number.isInteger(r.col)){const i=Ot(o,r.row,r.col);if(i)return{row:r.row,col:r.col,cell:i}}return{row:t,col:e,cell:n}}c(Tn,"resolveTableCellAnchor");function Si(o){if(!o)return null;const t=[o.anchorRow,o.focusRow].map(n=>K(n,0)),e=[o.anchorCol,o.focusCol].map(n=>K(n,0));return{minRow:Math.min(...t),maxRow:Math.max(...t),minCol:Math.min(...e),maxCol:Math.max(...e)}}c(Si,"getTableSelectionRect");function Qt(o,t=3,e=3){const n=kt(o,t,e);return{rowFractions:n.rowFractions.slice(),colFractions:n.colFractions.slice(),cells:n.cells.map(r=>r.map(i=>({text:nt(i?.text,""),rowSpan:z(i?.rowSpan,1),colSpan:z(i?.colSpan,1),mergedInto:i?.mergedInto&&Number.isInteger(i.mergedInto.row)&&Number.isInteger(i.mergedInto.col)?{row:i.mergedInto.row,col:i.mergedInto.col}:null,style:Ue(i?.style)})))}}c(Qt,"cloneTableData");function Kr(o,t){if(typeof t!="function")return;const e=kt(o),n=wt(e,0),r=_t(e,0);for(let i=0;i<n;i+=1)for(let s=0;s<r;s+=1){const u=Ot(e,i,s);!u||u?.mergedInto||t(u,i,s,e)}}c(Kr,"forEachTableAnchor");function Ai(o,t,e,n){const r=Qt(o),i=Tn(r,K(t,0),K(e,0));return i?.cell&&(i.cell.text=nt(n,"")),r}c(Ai,"setTableCellText");function qr(o,t){const e=kt(o),n=t||null;if(!n)return!1;const r=wt(e,0),i=_t(e,0),s=X(n.minRow,0,Math.max(0,r-1)),u=X(n.maxRow,s,Math.max(0,r-1)),f=X(n.minCol,0,Math.max(0,i-1)),a=X(n.maxCol,f,Math.max(0,i-1));if(s===u&&f===a)return!1;for(let m=s;m<=u;m+=1)for(let l=f;l<=a;l+=1){const y=Ot(e,m,l);if(!y||y?.mergedInto||z(y.rowSpan,1)!==1||z(y.colSpan,1)!==1)return!1}return!0}c(qr,"canMergeTableCells");function wi(o,t){const e=Qt(o),n=t||null;if(!n||!qr(e,n))return e;const r=K(n.minRow,0),i=Math.max(r,K(n.maxRow,r)),s=K(n.minCol,0),u=Math.max(s,K(n.maxCol,s)),f=Ot(e,r,s);if(!f)return e;f.rowSpan=i-r+1,f.colSpan=u-s+1,f.mergedInto=null;for(let a=r;a<=i;a+=1)for(let m=s;m<=u;m+=1)a===r&&m===s||(e.cells[a][m]={text:"",rowSpan:1,colSpan:1,mergedInto:{row:r,col:s},style:{}});return e}c(wi,"mergeTableCells");function _i(o,t,e){const n=Qt(o),r=Tn(n,K(t,0),K(e,0));if(!r?.cell)return n;const i=z(r.cell.rowSpan,1),s=z(r.cell.colSpan,1);if(i===1&&s===1)return n;r.cell.rowSpan=1,r.cell.colSpan=1,r.cell.mergedInto=null;for(let u=r.row;u<r.row+i;u+=1)for(let f=r.col;f<r.col+s;f+=1)u===r.row&&f===r.col||(n.cells[u][f]=Rn(""));return n}c(_i,"unmergeTableCell");function pn(o,t){const e=Array.isArray(o)?o.slice():[1],n=e.length;if(n<=0)return[1];const r=X(t,0,n),i=X(r===n?n-1:r,0,n-1),s=Math.max(1e-4,Tt(e[i],1/n)),u=Math.max(1e-4,s*.5);return e[i]=Math.max(1e-4,s-u),e.splice(r,0,u),ft(e,e.length)}c(pn,"splitFractionList");function kn(o,{rowInsertIndex:t=null,colInsertIndex:e=null}={}){const n=kt(o),r=wt(n,1),i=_t(n,1),s=t==null?r:r+1,u=e==null?i:i+1,f=t==null?-1:X(t,0,r),a=e==null?-1:X(e,0,i),m=On(s,u);return m.rowFractions=t==null?ft(n.rowFractions,r):pn(n.rowFractions,f),m.colFractions=e==null?ft(n.colFractions,i):pn(n.colFractions,a),Kr(n,(l,y,b)=>{const d=f>=0&&y>=f?y+1:y,g=a>=0&&b>=a?b+1:b,I=f>=0&&y<f&&y+z(l.rowSpan,1)>f?z(l.rowSpan,1)+1:z(l.rowSpan,1),_=a>=0&&b<a&&b+z(l.colSpan,1)>a?z(l.colSpan,1)+1:z(l.colSpan,1);m.cells[d][g]={text:nt(l.text,""),rowSpan:I,colSpan:_,mergedInto:null,style:Ue(l.style)};for(let S=d;S<d+I;S+=1)for(let x=g;x<g+_;x+=1)S===d&&x===g||(m.cells[S][x]={text:"",rowSpan:1,colSpan:1,mergedInto:{row:d,col:g},style:{}})}),m}c(kn,"buildInsertedTable");function Xr(o,t){return kn(o,{rowInsertIndex:K(t,0)})}c(Xr,"insertTableRow");function Yr(o,t){return kn(o,{colInsertIndex:K(t,0)})}c(Yr,"insertTableColumn");function Ii(o,t=1,e=1){let n=Qt(o,t,e);const r=Math.max(1,z(t,1)),i=Math.max(1,z(e,1));for(;wt(n,0)<r;)n=Xr(n,wt(n,0));for(;_t(n,0)<i;)n=Yr(n,_t(n,0));return n}c(Ii,"ensureTableSize");function T(o,t=0){const e=Number(o);return Number.isFinite(e)?e:t}c(T,"toFiniteNumber$2");function V(o,t=""){return typeof o=="string"?o:o==null?t:String(o)}c(V,"sanitizeText");function Y(o,t){const e=String(o??"").trim();return e&&(/^#[\da-fA-F]{3,8}$/.test(e)||/^[a-zA-Z]+$/.test(e)||/^(rgb|rgba|hsl|hsla)\([^)]+\)$/i.test(e))?e:t}c(Y,"sanitizeColor");function v(o,t,e){return Math.max(t,Math.min(e,o))}c(v,"clamp");function ie(o,t="left"){const e=String(o||t).trim().toLowerCase();return e==="middle"||e==="center"?"center":e==="end"||e==="right"?"right":"left"}c(ie,"normalizeTextAlign");function se(o,t="top"){const e=String(o||t).trim().toLowerCase();return e==="center"?"middle":e==="bottom"?"bottom":e==="middle"?"middle":"top"}c(se,"normalizeVerticalAlign");function Zr(o,t="c"){const e=String(o||t).trim().toLowerCase();return["nw","n","ne","w","c","e","sw","s","se"].includes(e)?e:t}c(Zr,"normalizePmiAnchor");function hn(o,t="bottom"){const e=String(o||t).trim().toLowerCase();return["top","bottom","none"].includes(e)?e:t}c(hn,"normalizePmiLabelPosition");function Qr(o,t="shaded"){const e=String(o||t).trim().toLowerCase();return["shaded","monochrome"].includes(e)?e:t}c(Qr,"normalizePmiRenderMode");function Jr(o,t="solid"){const e=String(o||t).trim();return["none","solid","dotted","dashed","dashDot","longDash","dashDotDot"].includes(e)?e:t}c(Jr,"normalizeLineStyle");function J(o){return["rect","ellipse","triangle","diamond","pentagon","hexagon","parallelogram","trapezoid"].includes(String(o||""))}c(J,"isShapeElementType");function vn(o){return["parallelogram","trapezoid"].includes(String(o||""))}c(vn,"shapeSupportsAdjustHandle");function ti(o){return vn(o)?.18:0}c(ti,"getDefaultShapeAdjust");function ei(o,t){return vn(o)?v(T(t,ti(o)),0,.45):0}c(ei,"clampShapeAdjust");function ni(o){const t=String(o??"").trim().toLowerCase();return t==="rect"?"rect":t==="ellipse"?"ellipse":t==="triangle"?"triangle":t==="diamond"?"diamond":t==="pentagon"?"pentagon":t==="hexagon"?"hexagon":t==="parallelogram"?"parallelogram":t==="trapezoid"?"trapezoid":t==="table"?"table":t==="image"?"image":t==="line"?"line":t==="pmiinset"||t==="pmi_inset"||t==="pmi"||t==="pmiview"?"pmiInset":"text"}c(ni,"normalizeElementType");const Ye=class Ye{constructor(t){this.partHistory=t||null,this.sheets=[],this._listeners=new Set}reset(){this.sheets=[],this._emit()}getSheets(){return this._normalizeSheetsArray(this.sheets),this.sheets}getSheetById(t){const e=String(t??"").trim();return e&&this.getSheets().find(n=>String(n?.id||"")===e)||null}setSheets(t){const e=Array.isArray(t)?Array.from(t):[];return this.sheets=e,this._normalizeSheetsArray(this.sheets),this._emit(),this.sheets}createSheet(t={}){const e=this.getSheets(),n=Date.now(),r=this._normalizeSheet({...t,id:t?.id||this._generateSheetId(),metadata:{...t?.metadata&&typeof t.metadata=="object"?t.metadata:{},createdAt:Number.isFinite(Number(t?.metadata?.createdAt))?Number(t.metadata.createdAt):n,updatedAt:Number.isFinite(Number(t?.metadata?.updatedAt))?Number(t.metadata.updatedAt):n}},e.length);return e.push(r),this._emit(),r}duplicateSheet(t){const e=this._resolveSheetIndex(t);if(e<0)return null;const n=this.getSheets()[e],r=O(n)||{};r.id=this._generateSheetId(),r.name=`${V(n?.name,"Sheet")} Copy`,r.elements=Array.isArray(r.elements)?r.elements.map(s=>({...s||{},id:this._generateElementId(r.id)})):[];const i=this._normalizeSheet(r,this.sheets.length);return this.sheets.push(i),this._emit(),i}updateSheet(t,e){const n=this._resolveSheetIndex(t);if(n<0)return null;const r=this.sheets[n];let i=r;if(typeof e=="function")try{const u=e(O(r));u&&typeof u=="object"&&(i=u)}catch{i=r}else e&&typeof e=="object"&&(i={...r,...e});const s=this._normalizeSheet(i,n,r?.id);return s.metadata={...s.metadata||{},createdAt:Number.isFinite(Number(r?.metadata?.createdAt))?Number(r.metadata.createdAt):s.metadata?.createdAt,updatedAt:Date.now()},this.sheets[n]=s,this._emit(),this.sheets[n]}moveSheet(t,e){const n=this._resolveSheetIndex(t);if(n<0)return null;const r=this.getSheets(),i=v(Math.round(T(e,n)),0,Math.max(0,r.length-1));if(i===n)return r[n]||null;const[s]=r.splice(n,1);return s?(r.splice(i,0,s),this._normalizeSheetsArray(r),this._emit(),s):null}removeSheet(t){const e=this._resolveSheetIndex(t);if(e<0)return null;const[n]=this.sheets.splice(e,1);return this._normalizeSheetsArray(this.sheets),this._emit(),n||null}addListener(t){return typeof t!="function"?()=>{}:(this._listeners.add(t),()=>{try{this._listeners.delete(t)}catch{}})}removeListener(t){if(typeof t=="function")try{this._listeners.delete(t)}catch{}}notifyChanged(){this._emit()}toSerializable(){return this.getSheets().map(t=>O(t))}_resolveSheetIndex(t){if(Number.isInteger(t)){const n=Number(t);return n>=0&&n<this.getSheets().length?n:-1}const e=String(t??"").trim();return e?this.getSheets().findIndex(n=>String(n?.id||"")===e):-1}_generateSheetId(){const t=new Set(this.getSheets().map(n=>String(n?.id||"")));let e=1;for(;t.has(`sheet-${e}`);)e+=1;return`sheet-${e}`}_generateElementId(t="sheet"){return`${String(t||"sheet").replace(/[^A-Za-z0-9_-]/g,"_")}:el:${Date.now().toString(36)}:${Math.random().toString(36).slice(2,7)}`}_normalizeSheetsArray(t){if(!Array.isArray(t))return this.sheets=[],this.sheets;for(let e=0;e<t.length;e++){const n=t[e]?.id;t[e]=this._normalizeSheet(t[e],e,n)}return t}_normalizeSheet(t,e,n=null){const r=t&&typeof t=="object"?t:{},i=Pn(r.sizeKey),s=Fn(r.orientation),u=Math.max(1,T(r.customWidthIn??r.widthIn,i.widthIn)),f=Math.max(1,T(r.customHeightIn??r.heightIn,i.heightIn)),a=$r(i.key,s,{customWidthIn:u,customHeightIn:f}),m=V(n||r.id||this._generateSheetId(),"").trim()||this._generateSheetId(),l=V(r.name,"").trim()||`Sheet ${e+1}`,y=Array.isArray(r.elements)?r.elements:[],b=[],d=new Set;for(let g=0;g<y.length;g++){const I=this._normalizeElement(y[g],g,m,a);I&&(d.has(I.id)&&(I.id=this._generateElementId(m)),d.add(I.id),b.push(I))}return{id:m,name:l,sizeKey:a.key,sizeLabel:a.label,orientation:a.orientation,units:a.units,widthIn:a.widthIn,heightIn:a.heightIn,customWidthIn:a.key==="CUSTOM"?a.widthIn:void 0,customHeightIn:a.key==="CUSTOM"?a.heightIn:void 0,widthPx:a.widthPx,heightPx:a.heightPx,pxPerInch:a.pxPerInch,background:Y(r.background,"#ffffff"),elements:b,metadata:{createdAt:Number.isFinite(Number(r?.metadata?.createdAt))?Number(r.metadata.createdAt):Date.now(),updatedAt:Number.isFinite(Number(r?.metadata?.updatedAt))?Number(r.metadata.updatedAt):Number.isFinite(Number(r?.metadata?.createdAt))?Number(r.metadata.createdAt):Date.now()}}}_normalizeElement(t,e,n,r){const i=t&&typeof t=="object"?t:{},s=ni(i.type),u=Math.max(.1,T(r?.widthIn,11)),f=Math.max(.1,T(r?.heightIn,8.5)),a=-u*2,m=-f*2,l=u*3,y=f*3,b=v(T(i.x,u*.1),a,l),d=v(T(i.y,f*.1),m,y),g=V(i.id,"").trim()||this._generateElementId(n),I=Number.isInteger(i.z)?i.z:Number.isInteger(i.layer)?i.layer:e,_={id:g,type:s,groupId:V(i.groupId,"").trim()||void 0,formboard:i.formboard&&typeof i.formboard=="object"?O(i.formboard):void 0,x:b,y:d,rotationDeg:T(i.rotationDeg,0),z:Number.isFinite(Number(I))?Number(I):e,fill:Y(i.fill,s==="text"||s==="pmiInset"?"transparent":s==="table"?"#ffffff":"#dbeafe"),stroke:Y(i.stroke,s==="table"?"#0f172a":"#1d4ed8"),strokeWidth:v(T(i.strokeWidth,.02),.002,1),lineStyle:Jr(i.lineStyle,"solid"),opacity:v(T(i.opacity,1),0,1)};if(s==="line"){const pt=v(T(i.x2,b+1),a,l),U=v(T(i.y2,d),m,y);return{..._,x2:pt,y2:U,strokeWidth:v(T(i.strokeWidth,.035),.002,1)}}const S=Number.isFinite(Number(i.w)),x=Number.isFinite(Number(i.h)),C=T(S?i.w:i.width??(i.radiusX!=null?T(i.radiusX,.8)*2:1.4),1.4),F=T(x?i.h:i.height??(i.radiusY!=null?T(i.radiusY,.55)*2:.9),.9),P=v(C,.05,u*8),M=v(F,.05,f*8),H=!S&&!x&&Number.isFinite(Number(i.width))&&Number.isFinite(Number(i.height)),E=!S&&!x&&Number.isFinite(Number(i.radiusX))&&Number.isFinite(Number(i.radiusY)),rt=v(H||E?T(i.x,u*.5)-P*.5:b,a,l),q=v(H||E?T(i.y,f*.5)-M*.5:d,m,y);if(s==="table"){const pt=String(i.fontStyle||(i.italic?"italic":"normal")).toLowerCase()==="italic"?"italic":"normal",U=String(i.fontWeight||(i.bold?"700":"400"));return{..._,x:rt,y:q,w:v(C,.4,u*8),h:v(F,.3,f*8),tableData:kt(i.tableData,i.rows??3,i.cols??4),fontSize:v(T(i.fontSize,.22),.08,3),fontFamily:V(i.fontFamily,"Arial, Helvetica, sans-serif"),fontWeight:/^\d{3}$/.test(U)?U:U==="bold"?"700":"400",fontStyle:pt,textDecoration:String(i.textDecoration||"none").toLowerCase()==="underline"?"underline":"none",textAlign:ie(i.textAlign||i.textAnchor,"left"),verticalAlign:se(i.verticalAlign||i.verticalAnchor,"middle"),color:Y(i.color,Y(i.textColor,"#111111"))}}if(J(s)||s==="image"||s==="pmiInset"){const pt=String(i.fontStyle||(i.italic?"italic":"normal")).toLowerCase()==="italic"?"italic":"normal",U=String(i.fontWeight||(i.bold?"700":"400"));return{..._,x:rt,y:q,w:P,h:M,cornerRadius:v(T(i.cornerRadius,s==="rect"?.1:0),0,Math.min(P,M)*.5),shapeAdjust:ei(s,i.shapeAdjust),src:s==="image"||s==="pmiInset"?V(i.src,""):void 0,mediaScale:s==="image"||s==="pmiInset"?v(T(i.mediaScale,1),1,10):void 0,mediaOffsetX:s==="image"||s==="pmiInset"?v(T(i.mediaOffsetX,0),-1,1):void 0,mediaOffsetY:s==="image"||s==="pmiInset"?v(T(i.mediaOffsetY,0),-1,1):void 0,pmiViewIndex:s==="pmiInset"?Number.isInteger(i.pmiViewIndex)?i.pmiViewIndex:-1:void 0,pmiViewName:s==="pmiInset"?V(i.pmiViewName,"PMI View"):void 0,pmiImageRevision:s==="pmiInset"?Number.isInteger(i.pmiImageRevision)?i.pmiImageRevision:0:void 0,pmiModelRevision:s==="pmiInset"?Number.isInteger(i.pmiModelRevision)?i.pmiModelRevision:-1:void 0,pmiImageCaptureKey:s==="pmiInset"?V(i.pmiImageCaptureKey,""):void 0,showTitle:s==="pmiInset"?hn(i.pmiLabelPosition,i.showTitle!==!1?"bottom":"none")!=="none":void 0,pmiLabelPosition:s==="pmiInset"?hn(i.pmiLabelPosition,i.showTitle!==!1?"bottom":"none"):void 0,pmiRenderMode:s==="pmiInset"?Qr(i.pmiRenderMode,"shaded"):void 0,pmiShowCenterLines:s==="pmiInset"?i.pmiShowCenterLines===!0:void 0,pmiAnchor:s==="pmiInset"?Zr(i.pmiAnchor,"c"):void 0,text:J(s)?V(i.text,""):void 0,fontSize:J(s)?v(T(i.fontSize,.28),.08,3):void 0,fontFamily:J(s)?V(i.fontFamily,"Arial, Helvetica, sans-serif"):void 0,fontWeight:J(s)?/^\d{3}$/.test(U)?U:U==="bold"?"700":"400":void 0,fontStyle:J(s)?pt:void 0,textAlign:J(s)?ie(i.textAlign||i.textAnchor,"center"):void 0,verticalAlign:J(s)?se(i.verticalAlign||i.verticalAnchor,"middle"):void 0,color:J(s)?Y(i.color,Y(i.textColor,"#0f172a")):void 0}}const Jt=ie(i.textAlign||i.textAnchor,"left"),It=String(i.fontStyle||(i.italic?"italic":"normal")).toLowerCase()==="italic"?"italic":"normal",vt=String(i.fontWeight||(i.bold?"700":"400"));return{..._,w:v(T(S?i.w:i.width,3.2),.1,u*8),h:v(T(x?i.h:i.height,1.1),.1,f*8),text:V(i.text,`Text ${e+1}`),fontSize:v(T(i.fontSize,.32),.08,3),fontFamily:V(i.fontFamily,"Arial, Helvetica, sans-serif"),fontWeight:/^\d{3}$/.test(vt)?vt:vt==="bold"?"700":"400",fontStyle:It,textAlign:Jt,verticalAlign:se(i.verticalAlign||i.verticalAnchor,"top"),color:Y(i.color,Y(i.textColor,Y(i.fill,"#111111")))}}_emit(){if(!this._listeners||this._listeners.size===0)return;const t=this.getSheets();for(const e of Array.from(this._listeners))try{e(t,this.partHistory||null)}catch{}}};c(Ye,"Sheet2DManager");let _e=Ye;function Rt(o,t=0){const e=Number(o);return Number.isFinite(e)?e:t}c(Rt,"toFiniteNumber$1");function W(o,t=""){return String(o??"").trim()||t}c(W,"normalizeText");function oe(o,t=0){const e=o&&typeof o=="object"?o:{},n=Number.isInteger(t)?t+1:1;return{id:W(e.id,`wire-${n}`),name:W(e.name,`Wire ${n}`),from:W(e.from,""),to:W(e.to,""),diameter:Math.max(.01,Rt(e.diameter,1))}}c(oe,"normalizeConnection");function ri(o){return!Array.isArray(o)||o.length<3?null:[Rt(o[0],0),Rt(o[1],0),Rt(o[2],0)]}c(ri,"normalizePointArray");function dn(o){return Array.isArray(o)?o.map(t=>W(t,"")).filter(Boolean):[]}c(dn,"normalizeStringArray");function ii(o,t=new Map){const e=o&&typeof o=="object"?o:{},n=W(e.connectionId,""),r=t.get(n)||null,i=!!e.feasible;return{connectionId:n,connectionName:W(e.connectionName,r?.name||n||"Wire"),feasible:i,error:W(e.error,i?"":"No route found through the harness network."),distance:Number.isFinite(Number(e.distance))?Number(e.distance):null,polyline:(Array.isArray(e.polyline)?e.polyline:[]).map(s=>ri(s)).filter(Boolean),segmentIds:dn(e.segmentIds),nodePath:dn(e.nodePath),reusesHarnessPoint:!!e.reusesHarnessPoint,diameter:Math.max(.01,Rt(e.diameter,r?.diameter||1)),from:W(e.from,r?.from||""),to:W(e.to,r?.to||"")}}c(ii,"normalizeRouteResult");const Ze=class Ze{constructor(t){this.partHistory=t||null,this.connections=[],this.routeResults=[],this._pendingRestoredRouteResults=null,this._listeners=new Set}reset(){this.connections=[],this.routeResults=[],this._pendingRestoredRouteResults=null,this._emit()}getConnections(){return this._normalizeConnectionsArray(this.connections),this.connections}setConnections(t){const e=Array.isArray(t)?Array.from(t):[];return this.connections=e,this._normalizeConnectionsArray(this.connections),this._pendingRestoredRouteResults=null,this._emit(),this.connections}addConnection(t={}){const e=this.getConnections(),n=oe({id:t?.id||this._generateConnectionId(),...t},e.length);return e.push(n),this._emit(),n}updateConnection(t,e){const n=this.getConnections(),r=W(t,""),i=n.findIndex(f=>String(f?.id||"")===r);if(i<0)return null;const s=n[i];let u=s;if(typeof e=="function")try{const f=e(O(s));f&&typeof f=="object"&&(u=f)}catch{u=s}else e&&typeof e=="object"&&(u={...s,...e});return n[i]=oe(u,i),n[i].id||(n[i].id=s.id),this._emit(),n[i]}removeConnection(t){const e=this.getConnections(),n=W(t,""),r=e.findIndex(s=>String(s?.id||"")===n);if(r<0)return null;const[i]=e.splice(r,1);return this.routeResults=this.routeResults.filter(s=>String(s?.connectionId||"")!==n),this._normalizeConnectionsArray(e),this._emit(),i||null}getRouteResults(){return this._normalizeRouteResultsArray(this.routeResults),Array.isArray(this.routeResults)?this.routeResults:[]}setRouteResults(t,e={}){const n=!!e?.preservePendingRestore,r=!!e?.markPendingRestore;return this.routeResults=Array.isArray(t)?t.map(i=>({...i||{}})):[],this._normalizeRouteResultsArray(this.routeResults),r?this._pendingRestoredRouteResults=this.routeResults.map(i=>O(i)):n||(this._pendingRestoredRouteResults=null),this._emit(),this.routeResults}clearRouteResults(t={}){this.routeResults=[],t?.preservePendingRestore||(this._pendingRestoredRouteResults=null),this._emit()}getRouteResultMap(){const t=new Map;for(const e of this.getRouteResults()){const n=W(e?.connectionId,"");n&&t.set(n,e)}return t}addListener(t){return typeof t!="function"?()=>{}:(this._listeners.add(t),()=>{try{this._listeners.delete(t)}catch{}})}removeListener(t){if(typeof t=="function")try{this._listeners.delete(t)}catch{}}notifyChanged(){this._emit()}toSerializable(){return{connections:this.getConnections().map(t=>O(t)),routeResults:this.getRouteResults().map(t=>O(t))}}loadSerializable(t){const e=t&&typeof t=="object"&&!Array.isArray(t)?t:{connections:t,routeResults:[]};return this.connections=Array.isArray(e.connections)?Array.from(e.connections):[],this._normalizeConnectionsArray(this.connections),this.routeResults=Array.isArray(e.routeResults)?Array.from(e.routeResults):[],this._normalizeRouteResultsArray(this.routeResults),this._pendingRestoredRouteResults=this.routeResults.length?this.routeResults.map(n=>O(n)):null,this._emit(),this.toSerializable()}consumePendingRestoredRouteResults(){const t=Array.isArray(this._pendingRestoredRouteResults)?this._pendingRestoredRouteResults.map(e=>O(e)):null;return this._pendingRestoredRouteResults=null,t}_generateConnectionId(){const t=new Set(this.getConnections().map(n=>String(n?.id||"")));let e=1;for(;t.has(`wire-${e}`);)e+=1;return`wire-${e}`}_normalizeConnectionsArray(t){if(!Array.isArray(t))return this.connections=[],this.connections;for(let e=0;e<t.length;e+=1)t[e]=oe(t[e],e);return t}_normalizeRouteResultsArray(t){if(!Array.isArray(t))return this.routeResults=[],this.routeResults;const e=new Map(this.getConnections().map(n=>[String(n?.id||""),n]));for(let n=0;n<t.length;n+=1)t[n]=ii(t[n],e);return t}_emit(){if(!this._listeners||this._listeners.size===0)return;const t={connections:this.getConnections(),routeResults:this.getRouteResults(),manager:this,partHistory:this.partHistory||null};for(const e of Array.from(this._listeners))try{e(t)}catch{}}};c(Ze,"WireHarnessManager");let Ie=Ze;const si=new Set(["slider","number","select","string"]),zn=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function lt(o,t=null){const e=Number(o);return Number.isFinite(e)?e:t}c(lt,"toFiniteNumber");function Ce(o){const t=[],e=new Set;for(const n of o){const r=String(n??"").trim();!r||e.has(r)||(e.add(r),t.push(r))}return t}c(Ce,"uniqueStrings");function xe(){return{fields:[],values:{}}}c(xe,"createEmptyConfiguratorState");function Ci(o){return zn.test(String(o??"").trim())}c(Ci,"isConfiguratorFieldNameValid");function oi(o){const t=String(o??"").replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\s+/g," ").trim();return t?t.charAt(0).toUpperCase()+t.slice(1):"Field"}c(oi,"prettyConfiguratorLabel");function ai(o,t=0,e=new Set){let n=String(o??"").trim();n=n.replace(/\s+/g,"_").replace(/[^A-Za-z0-9_$]/g,"_").replace(/_+/g,"_"),n||(n=`field${t+1}`),/^[A-Za-z_$]/.test(n)||(n=`_${n}`),zn.test(n)||(n=`field${t+1}`);let r=n,i=2;for(;e.has(r);)r=`${n}_${i}`,i+=1;return e.add(r),r}c(ai,"normalizeConfiguratorFieldName");function ui(o){return Array.isArray(o)?Ce(o):typeof o!="string"?[]:Ce(o.split(/\r?\n|,/g))}c(ui,"parseConfiguratorOptions");function ci(o){const t=String(o??"").trim().toLowerCase();return t==="options"||t==="dropdown"?"select":si.has(t)?t:"number"}c(ci,"normalizeConfiguratorType");function ae(o,t){const e=String(o?.type??"").trim().toLowerCase();if(e==="slider"||e==="number"){let n=lt(t,lt(o?.defaultValue,0));const r=lt(o?.min,null),i=lt(o?.max,null);return Number.isFinite(r)&&(n=Math.max(r,n)),Number.isFinite(i)&&(n=Math.min(i,n)),n}if(e==="select"){const n=Array.isArray(o?.options)?Ce(o.options):[];if(!n.length)return"";const r=String(t??o?.defaultValue??n[0]??"");return n.includes(r)?r:n[0]}return String(t??o?.defaultValue??"")}c(ae,"normalizeConfiguratorValue");function ue(o){const t=xe(),e=Array.isArray(o?.fields)?o.fields:[],n=o?.values&&typeof o.values=="object"&&!Array.isArray(o.values)?o.values:{},r=new Set;for(let i=0;i<e.length;i+=1){const s=e[i]&&typeof e[i]=="object"?e[i]:{},u=ci(s.type),f=ai(s.name??s.key??s.fieldName,i,r),a={name:f,label:String(s.label??"").trim()||oi(f),type:u};if(u==="slider"||u==="number"){let l=lt(s.min,u==="slider"?0:null),y=lt(s.max,u==="slider"?100:null);if(Number.isFinite(l)&&Number.isFinite(y)&&l>y){const d=l;l=y,y=d}let b=lt(s.step,1);(!Number.isFinite(b)||b<=0)&&(b=1),a.min=l,a.max=y,a.step=b,a.defaultValue=ae(a,s.defaultValue??s.value)}else u==="select"?(a.options=ui(s.options),a.options.length||(a.options=["Option"]),a.defaultValue=ae(a,s.defaultValue??s.value)):a.defaultValue=String(s.defaultValue??s.value??"");const m=Object.prototype.hasOwnProperty.call(n,f)?n[f]:a.defaultValue;t.fields.push(a),t.values[f]=ae(a,m)}return t}c(ue,"normalizeConfiguratorState");const mn=!1,yn=new Set(["__open"]),Mn=`resolution = 32;
|
|
1
|
+
var Je=Object.defineProperty;var tn=o=>{throw TypeError(o)};var fr=(o,t,e)=>t in o?Je(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var c=(o,t)=>Je(o,"name",{value:t,configurable:!0});var Z=(o,t,e)=>fr(o,typeof t!="symbol"?t+"":t,e),pr=(o,t,e)=>t.has(o)||tn("Cannot "+e);var ee=(o,t,e)=>t.has(o)?tn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(o):t.set(o,e);var h=(o,t,e)=>(pr(o,t,"access private method"),e);import{r as hr,F as dr,A as Q}from"./FeatureRegistry-CtngJUEe.js";import{Q as ce,V as qt,q as mr,bd as ne,be as en,aM as yr,aI as gr,aK as br,bf as Sr,z as Ar,X as zt,an as nn,bg as rn,af as wr,b9 as _r,b as re}from"./featureDialogs-DkPbRjYq.js";import{A as Sn}from"./AssemblyConstraintRegistry-CMGYi26o.js";import{d as O}from"./deepClone-Dj59xCHB.js";import{L as An}from"./ListEntityBase-DIaWtqmZ.js";import{e as Ir,o as Cr}from"./browserStorage-CvgF8ovw.js";function xr(o,t){if(t==null)return null;if(typeof t=="number")return Number.isFinite(t)?t:null;let e=null;try{o&&typeof o.evaluateExpression=="function"&&(e=o.evaluateExpression(t))}catch{e=null}if(typeof e=="number"&&Number.isFinite(e))return e;const n=Number(e);if(Number.isFinite(n))return n;const r=Number(t);return Number.isFinite(r)?r:null}c(xr,"evaluateConstraintNumericValue");function B(o){return o===0?"0":o?String(o).trim():""}c(B,"normalizeTypeString");const Dr=new Set(["type","persistentData","__open"]);function Nr(o,t){if(o===t)return!0;if(!Array.isArray(o)||!Array.isArray(t)||o.length!==t.length)return!1;for(let e=0;e<o.length;e+=1)if(o[e]!==t[e])return!1;return!0}c(Nr,"shallowArrayEqual");function sn(o){const t={};if(!o||typeof o!="object")return t;for(const e in o){if(!Object.prototype.hasOwnProperty.call(o,e)||Dr.has(e))continue;const n=o[e]?o[e].default_value:void 0;t[e]=O(n)}return t}c(sn,"extractDefaults");function on(o){return`Unknown constraint type: ${o!=null?String(o):"unknown"}`}c(on,"formatUnknownConstraintMessage");const Fr=new Map([["touch_align","touch_align"],["touch-align","touch_align"],["touchalign","touch_align"],["touch align","touch_align"],["touch align constraint","touch_align"],["touchalignconstraint","touch_align"],["touch","touch_align"],["distance","distance"],["distance constraint","distance"],["distanceconstraint","distance"],["angle","angle"],["angle constraint","angle"],["angleconstraint","angle"]]),an={touch_align:"Touch Align",distance:"Distance",angle:"Angle"},un=1e-6,le=1,Pr=.5,Rr=.5,Or=Math.max(1,le),st="Constraint disabled.";function at(o,t){const e=Number(o);return Number.isFinite(e)?e:t}c(at,"toFiniteNumber$5");function Tr(o){const t=Math.floor(at(o,le));return!Number.isFinite(t)||t<1?le:t}c(Tr,"clampIterations");function cn(o,t){const e=at(o,t);return Number.isFinite(e)?e<0?0:e>1?1:e:t}c(cn,"clampGain");function kr(o){if(!o||typeof o.traverse!="function")return;const t=[],e=["parallel-constraint-normal-","distance-constraint-normal-","touch-align-normal-"];o.traverse(n=>{!n||typeof n.name!="string"||e.some(r=>n.name.startsWith(r))&&t.push(n)});for(const n of t)try{n.parent?.remove?.(n)}catch{}}c(kr,"removeExistingDebugArrows");function wn(o){let t=o;for(;t;){if(t.isAssemblyComponent||t.type==="COMPONENT")return t;t=t.parent||null}return null}c(wn,"resolveComponentFromObject");function vr(o){return wn(o)?1:0}c(vr,"scoreObjectForComponent");function zr(o){if(!o)return null;if(o instanceof qt)return o.clone();if(typeof o=="object"){const{x:t,y:e,z:n}=o,r=Number.isFinite(t)?t:0,i=Number.isFinite(e)?e:0,s=Number.isFinite(n)?n:0;return new qt(r,i,s)}return null}c(zr,"vectorFrom");function Ct(o,t=null){if(!o)return t;const e=o.inputParams||{},n=e.id??e.constraintID??o.id??t;return n==null?t:String(n)}c(Ct,"resolveConstraintEntryId");function mt(o){return B(Ct(o))}c(mt,"normalizeConstraintEntryId");var w,_n,xt,pe,In,he,Cn,tt,de,xn,Dn,St,me,Dt,L;const Be=class Be{constructor(t=null,e=null){ee(this,w);this.partHistory=t||null,this.registry=e||new Sn,this.constraints=[],this.idCounter=0,this._listeners=new Set,this._autoRunScheduled=!1,this._autoRunActive=!1,this._autoRunOptions=null}setPartHistory(t){this.partHistory=t||null,this.partHistory&&this.constraints.length&&h(this,w,tt).call(this)}setRegistry(t){this.registry=t||this.registry}addListener(t){return typeof t!="function"?()=>{}:(this._listeners.add(t),()=>{this._listeners.delete(t)})}removeListener(t){typeof t=="function"&&this._listeners.delete(t)}onChange(t){if(typeof t!="function")return()=>{};const e=c(()=>{try{t(this)}catch{}},"wrapped");return this.addListener(e)}list(){return this.entries}get entries(){return this.constraints}set entries(t){Array.isArray(t)?this.constraints=t:this.constraints=[]}get size(){return this.constraints.length}findById(t){const e=B(t);return e&&this.constraints.find(n=>mt(n)===e)||null}async addConstraint(t,e=null){const n=h(this,w,Dt).call(this,t);if(!n)throw new Error(`Constraint type "${t}" is not registered.`);const r=n.inputParamsSchema||{},i=sn(r),s=B(n.constraintType||t||n.name),u={type:s,inputParams:{...i},persistentData:{isNewConstraint:!0},__open:!0,enabled:!0};Object.defineProperty(u,"constraintClass",{value:n,configurable:!0,writable:!0,enumerable:!1});const f=n?.shortName||n?.constraintShortName||s||"CONST",a=this.generateId(f),m=u.inputParams.id??u.inputParams.constraintID;return u.inputParams.id=m||a,h(this,w,xt).call(this,u),e&&typeof e=="object"&&Object.assign(u.inputParams,O(e)),u.inputParams.applyImmediately=!0,h(this,w,pe).call(this,u),this.constraints.push(u),h(this,w,L).call(this,"add",u),this.checkConstraintErrors(this.partHistory),h(this,w,tt).call(this),u}removeConstraint(t){const e=B(t);if(!e)return!1;const n=this.constraints.findIndex(i=>mt(i)===e);if(n<0)return!1;const[r]=this.constraints.splice(n,1);return h(this,w,L).call(this,"remove",r||null),this.checkConstraintErrors(this.partHistory),h(this,w,tt).call(this),!0}moveConstraint(t,e){const n=B(t);if(!n)return!1;const r=this.constraints.findIndex(i=>mt(i)===n);return r<0?!1:this.moveConstraintToIndex(n,r+e)}moveConstraintToIndex(t,e){const n=B(t);if(!n)return!1;const r=this.constraints.findIndex(u=>mt(u)===n);if(r<0)return!1;const i=Number.isFinite(e)?Math.max(0,Math.min(this.constraints.length-1,e)):r;if(i===r)return!1;const[s]=this.constraints.splice(r,1);return this.constraints.splice(i,0,s),h(this,w,L).call(this,"reorder",s||null),h(this,w,tt).call(this),!0}updateConstraintParams(t,e){const n=this.findById(t);return!n||typeof e!="function"?!1:(e(n.inputParams),h(this,w,xt).call(this,n),h(this,w,L).call(this,"update",n),this.checkConstraintErrors(this.partHistory),h(this,w,tt).call(this),!0)}setConstraintEnabled(t,e){const n=this.findById(t);if(!n)return!1;const r=e!==!1;if(n.enabled!==!1===r){if(n.enabled!==r&&(n.enabled=r),!r&&n.persistentData?.status!=="disabled"){const u={...n.persistentData||{}};u.status="disabled",u.message||(u.message=st),n.persistentData=u,h(this,w,L).call(this,"update",n)}return!1}n.enabled=r;const s={...n.persistentData||{}};return r?(s.status==="disabled"&&(s.status="pending",s.message===st&&delete s.message,n.persistentData=s),h(this,w,L).call(this,"update",n),this.checkConstraintErrors(this.partHistory),h(this,w,tt).call(this),!0):(s.status="disabled",s.message||(s.message=st),n.persistentData=s,h(this,w,L).call(this,"update",n),this.checkConstraintErrors(this.partHistory),h(this,w,tt).call(this),!0)}setOpenState(t,e){const n=this.findById(t);if(!n)return!1;const r=e!==!1;if(n.__open!==!1===r)return!1;const s=n.inputParams||{};if(Object.prototype.hasOwnProperty.call(s,"__open"))try{s.__open=r}catch{n.__open=r}else n.__open=r;return(!n.runtimeAttributes||typeof n.runtimeAttributes!="object")&&(n.runtimeAttributes={}),n.runtimeAttributes.__open=r,h(this,w,L).call(this,"open-state",n),!0}setExclusiveOpen(t){const e=B(t);if(!e)return!1;let n=!1;for(const r of this.constraints){if(!r)continue;const s=mt(r)===e;if(r.__open!==!1!==s){const f=r.inputParams||{};if(Object.prototype.hasOwnProperty.call(f,"__open"))try{f.__open=s}catch{r.__open=s}else r.__open=s;(!r.runtimeAttributes||typeof r.runtimeAttributes!="object")&&(r.runtimeAttributes={}),r.runtimeAttributes.__open=s,n=!0}}return n&&h(this,w,L).call(this,"open-state",this.findById(t)),n}clear(){this.constraints=[],this.idCounter=0,h(this,w,L).call(this,"clear")}snapshot(){return{idCounter:this.idCounter,constraints:this.constraints.map(t=>({type:t?.type||null,inputParams:O(t?.inputParams)||{},persistentData:O(t?.persistentData)||{},open:t?.__open!==!1,enabled:t?.enabled!==!1}))}}async replaceAll(t=[],e=0){const n=[],r=Array.isArray(t)?t:[];let i=Number.isFinite(Number(e))?Number(e):0;for(const s of r){const u=h(this,w,_n).call(this,s);if(!u)continue;const f=u.type||u.constraintType||null,a=h(this,w,Dt).call(this,f);if(!a)continue;const m=sn(a.inputParamsSchema),l=B(a.constraintType||f||a.name),y={type:l,inputParams:{...m,...O(u.inputParams||{})},persistentData:O(u.persistentData||{}),__open:u.open!==!1,enabled:u.enabled!==!1},b=y.inputParams.id??y.inputParams.constraintID;if(b){const d=String(b).match(/(\d+)$/);if(d){const g=Number(d[1]);Number.isFinite(g)&&(i=Math.max(i,g))}y.inputParams.id=b}else{const d=(a?.shortName||a?.constraintShortName||l||"CONST").replace(/[^a-z0-9]/gi,"").toUpperCase()||"CONST";i+=1,y.inputParams.id=`${d}${i}`}h(this,w,xt).call(this,y),y.inputParams.applyImmediately=!0,Object.defineProperty(y,"constraintClass",{value:a,configurable:!0,writable:!0,enumerable:!1}),h(this,w,pe).call(this,y),n.push(y)}this.idCounter=i,this.constraints=n,h(this,w,L).call(this,"replace"),this.constraints.length&&(this.checkConstraintErrors(this.partHistory),h(this,w,tt).call(this))}async deserialize(t){const e=t&&typeof t=="object"?t:{},n=Array.isArray(e.constraints)?e.constraints:Array.isArray(t)?t:[],r=Number.isFinite(Number(e.idCounter))?Number(e.idCounter):void 0;await this.replaceAll(n,r)}generateId(t="CONST"){const e=B(t).replace(/[^a-z0-9]/gi,"").toUpperCase()||"CONST";return this.idCounter+=1,`${e}${this.idCounter}`}checkConstraintErrors(t=this.partHistory,e={}){const n=e&&typeof e=="object"?e:{},r=n.emit!==!1,i=n.updatePersistentData!==!1,s=t||this.partHistory||null;s&&(this.partHistory=s);const u=h(this,w,he).call(this),f=[];let a=!1;const m=c((l,y)=>{const b=l?.persistentData&&typeof l.persistentData=="object"?l.persistentData:{},d={...b};let g=!1;const I=c((S,x)=>{const C=d[S];if(x===void 0){Object.prototype.hasOwnProperty.call(d,S)&&(delete d[S],g=!0);return}if(Array.isArray(C)&&Array.isArray(x)){if(Nr(C,x))return}else if(C===x)return;d[S]=x,g=!0},"set"),_=c(S=>{Object.prototype.hasOwnProperty.call(d,S)&&(delete d[S],g=!0)},"remove");try{y({set:I,remove:_,data:d,previous:b})}catch(S){console.warn("[AssemblyConstraintHistory] Failed to update persistent data:",S)}return g&&(l.persistentData=d),g},"mutatePersistentData");for(const l of this.constraints){if(!l)continue;const y=Ct(l),b=l?.type||null,d={id:y,constraintID:y,type:b,status:"ok",message:"",duplicateConstraintIDs:null,duplicateSignature:null};if(l.enabled===!1){d.status="disabled",d.message=st,i&&(a=m(l,({set:_,remove:S,previous:x})=>{_("status","disabled"),(!x.message||x.message===st)&&_("message",st),_("satisfied",!1),S("duplicateConstraintIDs"),S("duplicateSignature")})||a),f.push(d);continue}const g=h(this,w,Dt).call(this,b),I=u.get(l);if(!g){const _=on(b);d.status="error",d.message=_,i&&(a=m(l,({set:S,remove:x})=>{S("status","error"),S("message",_),S("satisfied",!1),x("duplicateConstraintIDs"),x("duplicateSignature")})||a),f.push(d);continue}if(I){const _=Array.isArray(I.relatedIds)?I.relatedIds.filter(Boolean):[],S=I.signature||null;d.status="duplicate",d.message=I.message||"Duplicate constraint selections.",d.duplicateConstraintIDs=_.length?_:null,d.duplicateSignature=S,i&&(a=m(l,({set:x,remove:C})=>{x("status","duplicate"),x("message",d.message),x("satisfied",!1),d.duplicateConstraintIDs?x("duplicateConstraintIDs",d.duplicateConstraintIDs):C("duplicateConstraintIDs"),S?x("duplicateSignature",S):C("duplicateSignature")})||a),f.push(d);continue}i&&(a=m(l,({set:_,remove:S,previous:x})=>{x.status==="duplicate"&&(_("status","pending"),typeof x.message=="string"&&x.message.startsWith("Duplicate constraint selections")&&S("message")),x.status==="error"&&typeof x.message=="string"&&x.message.startsWith("Unknown constraint type:")&&(_("status","pending"),S("message")),S("duplicateConstraintIDs"),S("duplicateSignature")})||a),f.push(d)}return i&&a&&r&&h(this,w,L).call(this,"update"),f}async runAll(t=this.partHistory,e={}){const n=t||this.partHistory;if(!n)return[];this.partHistory=n,this.checkConstraintErrors(n,{emit:!1});const r=Math.abs(at(e?.tolerance,un))||un,i=Tr(e?.iterations),s=cn(e?.translationGain,Pr),u=cn(e?.rotationGain,Rr),f=e?.debugMode===!0,a=f?500:0,m=at(e?.delayMs??e?.iterationDelayMs,a),l=Math.max(0,Number.isFinite(m)?m:a),y=e?.viewer||n.viewer||null,b=c(()=>{try{y?.render?.()}catch{}try{y?.requestRender?.()}catch{}},"renderScene"),d=e?.controller&&typeof e.controller=="object"?e.controller:null,g=d?.signal||e?.signal||null;let I=!1;const _=c(()=>g?.aborted?(I=!0,!0):!1,"shouldAbort"),S=d?.hooks||e?.hooks,x=S&&typeof S=="object"?S:{},C=c(async(A,N={})=>{const R=x?.[A];if(typeof R=="function")try{await R({controller:d,signal:g,aborted:I,...N})}catch(D){console.warn(`[AssemblyConstraintHistory] hook "${A}" failed:`,D)}},"safeCallHook"),F=n.scene||null,P=Array.isArray(n.features)?n.features.filter(Boolean):[],M=new Map;for(const A of P){const N=B(A?.inputParams?.featureID);N&&M.set(N,A)}const H=new Set,E=c(A=>hr(F,A,{scoreFn:vr,allowJson:!1,allowUuidString:!1,allowUuidObject:!0,allowFuzzyName:!1,allowNameContains:!1,allowPath:!1,allowReference:!1,allowTarget:!1,allowSelectionName:!1,arrayMode:"first"}),"resolveObject"),rt=c(A=>{const N=E(A);return wn(N)},"resolveComponent"),q=c(A=>{if(!A)return null;const N=B(A.owningFeatureID);return N&&M.get(N)||null},"getFeatureForComponent"),Jt=c(A=>!!(!A||A.fixed||A.userData?.fixedByConstraint||q(A)?.inputParams?.isFixed),"isComponentFixed"),It=c(A=>{A&&H.add(A)},"markUpdated"),U={partHistory:n,scene:F,tolerance:r,translationGain:s,rotationGain:u,resolveObject:E,resolveComponent:rt,applyTranslation:c((A,N)=>{const R=zr(N);return!A||!R||R.lengthSq()===0?!1:(A.position.add(R),A.updateMatrixWorld?.(!0),It(A),!0)},"applyTranslation"),applyRotation:c((A,N)=>{if(!A||!N)return!1;let R;if(N instanceof ce)R=N.clone();else{const D=at(N?.x,0),it=at(N?.y,0),k=at(N?.z,0),$=Number.isFinite(N?.w)?N.w:1;R=new ce(D,it,k,$)}return!Number.isFinite(R.x)||!Number.isFinite(R.y)||!Number.isFinite(R.z)||!Number.isFinite(R.w)?!1:(Math.abs(1-R.lengthSq())>1e-6&&R.normalize(),A.quaternion.premultiply(R),A.updateMatrixWorld?.(!0),It(A),!0)},"applyRotation"),isComponentFixed:Jt,getFeatureForComponent:q,markUpdated:It,viewer:y,renderScene:b,debugMode:f};kr(F);const ur=h(this,w,he).call(this),ht=this.constraints.map(A=>{const N=Ct(A);if(A?.enabled===!1)return{entry:A,instance:null,result:{id:N,ok:!0,status:"disabled",message:st,applied:!1,satisfied:!1,iteration:0,constraintID:N},skipReason:"disabled"};const R=ur.get(A);if(R){const j=Array.isArray(R.relatedIds)?R.relatedIds.slice():[],G={id:N,ok:!1,status:"duplicate",message:R.message,applied:!1,satisfied:!1,iteration:0,constraintID:N,duplicateConstraintIDs:j,duplicateSignature:R.signature};return{entry:A,instance:null,result:G,skipReason:"duplicate"}}const D=h(this,w,Dt).call(this,A.type);if(!D){const j=on(A.type);return A.persistentData={status:"error",message:j,lastRunAt:Date.now(),lastIteration:0},{entry:A,instance:null,result:{id:N,ok:!1,status:"error",message:j,applied:!1,satisfied:!1,iteration:0,constraintID:N},skipReason:"unregistered"}}const it=O(A.inputParams)||{},k=O(A.inputParams)||{},$=new D(n);h(this,w,In).call(this,k,D.inputParamsSchema||{});try{$.inputParams=k}catch{$.inputParams={...k}}try{Object.assign($.persistentData,O(A.persistentData))}catch{$.persistentData={...A.persistentData||{}}}return{entry:A,instance:$,result:null,originalInputParams:it}});for(const A of ht)A.instance?.clearDebugArrows?.({scene:F});await C("onStart",{maxIterations:i,constraintCount:ht.length});let Qe=0;const cr=ht.length;t:for(let A=0;A<i&&!(_()||(await C("onIterationStart",{iteration:A,maxIterations:i}),_()));A+=1){let N=!1;for(let R=0;R<ht.length;R+=1){if(_())break t;const D=ht[R],it=Ct(D?.entry),k=D?.entry?.type||null,$={iteration:A,index:R,id:it,constraintID:it,constraintType:k,totalConstraints:cr};if(!D.instance){await C("onConstraintSkipped",{...$,skipReason:D.skipReason||null});continue}if(await C("onConstraintStart",$),_())break t;const j={...U,iteration:A,maxIterations:i};let G;try{typeof D.instance.solve=="function"?G=await D.instance.solve(j):G=await D.instance.run(j)}catch(dt){console.warn("[AssemblyConstraintHistory] Constraint solve failed:",dt),G={ok:!1,status:"error",message:dt?.message||"Constraint evaluation failed.",error:dt},D.instance.persistentData=D.instance.persistentData||{},D.instance.persistentData.status="error",D.instance.persistentData.message=G.message}if(D.result=h(this,w,me).call(this,D.instance,G,A),D.result.applied&&(N=!0),await C("onConstraintEnd",{...$,result:D.result}),_())break t}if(typeof U.renderScene=="function")try{U.renderScene()}catch{}if(l>0&&await new Promise(R=>setTimeout(R,l)),_()||(Qe=A+1,await C("onIterationComplete",{iteration:A,maxIterations:i,applied:N}),_())||!N)break}I=I||g?.aborted||!1;const lr=Date.now(),te=[];for(const A of ht){const{entry:N,instance:R}=A,D=A.result||h(this,w,me).call(this,R,{ok:!1,status:"pending",message:"Constraint was not evaluated."},Math.max(0,i-1)),k={...R?.persistentData&&Object.keys(R.persistentData).length?R.persistentData:N.persistentData||{}};if(D.status&&(k.status=D.status),D.message!==void 0&&(D.message?k.message=D.message:k.message&&delete k.message),k.satisfied=!!D.satisfied,typeof D.error=="number"&&Number.isFinite(D.error)&&(k.error=D.error),k.lastRunAt=lr,k.lastIteration=D.iteration,k.lastRequestedIterations=i,D.status==="duplicate"?(Array.isArray(D.duplicateConstraintIDs)&&D.duplicateConstraintIDs.length?k.duplicateConstraintIDs=D.duplicateConstraintIDs.slice():k.duplicateConstraintIDs&&delete k.duplicateConstraintIDs,D.duplicateSignature?k.duplicateSignature=D.duplicateSignature:k.duplicateSignature&&delete k.duplicateSignature):(k.duplicateConstraintIDs&&delete k.duplicateConstraintIDs,k.duplicateSignature&&delete k.duplicateSignature),N.persistentData=k,A.originalInputParams){const j=O(A.originalInputParams)||{};D.persistInputParams&&typeof D.persistInputParams=="object"&&Object.assign(j,O(D.persistInputParams));const G=N.inputParams&&typeof N.inputParams=="object"?N.inputParams:{};for(const dt of Object.keys(G))Object.prototype.hasOwnProperty.call(j,dt)||delete G[dt];Object.assign(G,j),N.inputParams=G}else{const j={...N.inputParams||{}};D.persistInputParams&&typeof D.persistInputParams=="object"&&Object.assign(j,O(D.persistInputParams)),N.inputParams=j}const $=Ct(N);te.push({id:$,constraintID:$,type:N?.type||null,...D})}try{n.syncAssemblyComponentTransforms?.()}catch(A){console.warn("[AssemblyConstraintHistory] Failed to sync component transforms:",A)}return h(this,w,L).call(this,"solve"),await C("onComplete",{results:te.slice(),aborted:I,iterationsCompleted:Qe,maxIterations:i}),te}};w=new WeakSet,_n=c(function(t){if(!t||typeof t!="object")return t;const e={...t},n=t.inputParams&&typeof t.inputParams=="object"?t.inputParams:null;if(n){const i={...n},s=Object.prototype.hasOwnProperty.call(i,"constraintID")?i.constraintID:void 0;(i.id==null||i.id==="")&&s!=null&&(i.id=s),Object.prototype.hasOwnProperty.call(i,"constraintID")&&delete i.constraintID,e.inputParams=i}const r=Object.prototype.hasOwnProperty.call(e,"constraintID")?e.constraintID:void 0;return(e.id==null||e.id==="")&&r!=null&&(e.id=r),Object.prototype.hasOwnProperty.call(e,"constraintID")&&delete e.constraintID,(e.id==null||e.id==="")&&e.inputParams?.id!=null&&(e.id=e.inputParams.id),e},"#runConstraintEntryMigrations"),xt=c(function(t){if(!t||!t.inputParams)return;const e=t.inputParams,n=e.id??e.constraintID??t.id;if(!n)return;const r=String(n);e.id=r,t.id=r},"#syncEntryIds"),pe=c(function(t){if(!t||typeof t!="object")return;(!t.inputParams||typeof t.inputParams!="object")&&(t.inputParams={});const e=t.inputParams,n={configurable:!0,enumerable:!1};h(this,w,xt).call(this,t);const r=Object.prototype.hasOwnProperty.call(e,"constraintID")?e.constraintID:void 0;if(r!=null&&(e.id==null||e.id==="")&&(e.id=r),Object.prototype.hasOwnProperty.call(e,"constraintID"))try{delete e.constraintID}catch{}Object.getOwnPropertyDescriptor(e,"constraintID")||Object.defineProperty(e,"constraintID",{...n,get:c(()=>e.id,"get"),set:c(a=>{if(a==null){e.id=a,t.id=a;return}const m=String(a);e.id=m,t.id=m},"set")});const i=Object.prototype.hasOwnProperty.call(e,"__open")?e.__open:t.__open;if(Object.prototype.hasOwnProperty.call(e,"__open"))try{delete e.__open}catch{}const s=i!==!1;t.__open=s;const u=t.runtimeAttributes&&typeof t.runtimeAttributes=="object"?t.runtimeAttributes:{};u.__open=s;try{Object.defineProperty(t,"runtimeAttributes",{value:u,configurable:!0,writable:!0,enumerable:!1})}catch{t.runtimeAttributes=u}Object.prototype.hasOwnProperty.call(e,"__entityRef")||Object.defineProperty(e,"__entityRef",{...n,value:t});let f;if(Object.prototype.hasOwnProperty.call(e,"persistentData")){f=e.persistentData;try{delete e.persistentData}catch{}}f&&typeof f=="object"?t.persistentData=O(f):(!t.persistentData||typeof t.persistentData!="object")&&(t.persistentData={}),Object.defineProperty(e,"persistentData",{...n,get:c(()=>t.persistentData||(t.persistentData={}),"get"),set:c(a=>{const m=a&&typeof a=="object"?a:{};t.persistentData=m},"set")}),Object.defineProperty(e,"__open",{...n,get:c(()=>t.runtimeAttributes.__open!==!1,"get"),set:c(a=>{const m=a!==!1;t.runtimeAttributes.__open=m,t.__open=m},"set")}),t.type&&!e.type&&(e.type=t.type),t.entityType=t.type||e.type||t.entityType||null},"#linkEntryParams"),In=c(function(t,e){if(!(!t||!e))for(const n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const r=e[n];if(!r||r.type!=="number")continue;const i=xr(this.partHistory,t[n]);i!=null&&(t[n]=i)}},"#applyNumericExpressions"),he=c(function(){const t=new Map;for(const n of this.constraints){if(!n)continue;const r=h(this,w,Cn).call(this,n?.type);if(!r)continue;const i=h(this,w,xn).call(this,n?.inputParams);if(!i)continue;t.has(i)||t.set(i,[]);const s=mt(n)||null,u=an[r]||r;t.get(i).push({entry:n,type:r,typeLabel:u,id:s})}const e=new Map;for(const[n,r]of t.entries()){if(!Array.isArray(r)||r.length<=1)continue;const i=new Map;for(const s of r)i.has(s.type)||i.set(s.type,[]),i.get(s.type).push(s);for(const s of r){const u=(i.get(s.type)||[]).filter(b=>b!==s),f=[];for(const[b,d]of i.entries())b!==s.type&&f.push({type:b,entries:d});const a=c((b,d)=>{const g=Array.from(new Set(d.map(_=>_&&_.trim()?_.trim():null).filter(Boolean)));if(g.length===0)return`${b} constraint`;const I=g.length>1?"constraints":"constraint";return`${b} ${I} ${g.join(", ")}`},"formatConstraintPhrase"),m=[];if(u.length){const b=u.map(d=>d.id);m.push(a(`shares selections with ${s.typeLabel}`,b))}for(const b of f){const d=an[b.type]||b.type,g=b.entries.map(I=>I.id);m.push(a(`conflicts with ${d}`,g))}const l=m.length?`Duplicate constraint selections: ${m.join(". ")}.`:"Duplicate constraint selections.",y=r.filter(b=>b!==s).map(b=>b.id).filter(Boolean);e.set(s.entry,{message:l,signature:n,relatedIds:Array.from(new Set(y)),type:s.type})}}return e},"#detectDuplicateConstraints"),Cn=c(function(t){const e=B(t).toLowerCase();return e&&Fr.get(e)||null},"#normalizeDuplicateConstraintType"),tt=c(function(t=null){if(!this.partHistory)return;const e=t&&typeof t=="object"?{...t}:null;this._autoRunOptions=e,!this._autoRunScheduled&&(this._autoRunScheduled=!0,Promise.resolve().then(()=>{try{h(this,w,de).call(this)}catch(n){console.warn("[AssemblyConstraintHistory] Failed to schedule auto run:",n)}}))},"#scheduleAutoRun"),de=c(async function(){if(!this._autoRunScheduled||this._autoRunActive)return;const t=this._autoRunOptions?{...this._autoRunOptions}:{};this._autoRunOptions=null,this._autoRunScheduled=!1;const e=Number(t.iterations),n=Number.isFinite(e)&&e>=1?Math.floor(e):Or,r=this.partHistory;if(r){this._autoRunActive=!0;try{await this.runAll(r,{...t,iterations:n})}catch(i){console.warn("[AssemblyConstraintHistory] Auto run failed:",i)}finally{this._autoRunActive=!1,this._autoRunScheduled&&Promise.resolve().then(()=>{try{h(this,w,de).call(this)}catch(i){console.warn("[AssemblyConstraintHistory] Failed to re-run auto cycle:",i)}})}}},"#executeAutoRun"),xn=c(function(t){if(!t||typeof t!="object")return null;const e=h(this,w,Dn).call(this,t);if(!e)return null;const n=[];for(const r of e){const i=h(this,w,St).call(this,r,0,new Set);if(!i)return null;n.push(i)}return n.length!==2?null:(n.sort(),`${n[0]}|${n[1]}`)},"#buildSelectionSignature"),Dn=c(function(t){const e=Array.isArray(t?.elements)?t.elements:[],n=[];for(const r of e)if(r!=null&&(n.push(r),n.length>=2))break;return n.length>=2?n.slice(0,2):null},"#extractSelectionPair"),St=c(function(t,e=0,n=new Set){if(t==null||e>5)return null;if(Array.isArray(t)){for(const i of t){const s=h(this,w,St).call(this,i,e+1,n);if(s)return s}return null}const r=typeof t;if(r==="string"||r==="number"||r==="boolean")return`${r}:${String(t)}`;if(r!=="object"||n.has(t))return null;n.add(t);try{if(t.isObject3D&&typeof t.uuid=="string"&&t.uuid)return`uuid:${t.uuid}`;const i=["selectionID","selectionId","fullName","fullPath","pathKey","pathId","pathID","id","uuid","entityUUID","brepId","brepID","objectUUID","objectId","objectID"];for(const a of i){const m=t[a];if(typeof m=="string"&&m.trim())return`${a}:${m.trim()}`}const s=["name","label","displayName","componentName","faceName","edgeName","vertexName","reference","refName"];for(const a of s){const m=t[a];if(typeof m=="string"&&m.trim())return`${a}:${m.trim()}`}if(Array.isArray(t.path)&&t.path.length){const a=t.path.map(m=>String(m)).join("/");if(a)return`path:${a}`}if(t.component&&typeof t.component=="object"){const a=h(this,w,St).call(this,t.component,e+1,n);if(a)return`component:${a}`}if(t.object&&typeof t.object=="object"){const a=h(this,w,St).call(this,t.object,e+1,n);if(a)return`object:${a}`}const u=Object.keys(t).filter(a=>a!=="__proto__").sort(),f=[];for(const a of u){const m=t[a];if(m==null||typeof m=="function"||typeof m=="symbol")continue;let l=null;if(typeof m=="object"){const y=h(this,w,St).call(this,m,e+1,n);y&&(l=y)}else l=`${typeof m}:${String(m)}`;if(l&&(f.push(`${a}=${l}`),f.length>=8))break}return f.length?`obj:${f.join(",")}`:null}finally{n.delete(t)}},"#selectionKey"),me=c(function(t,e,n){const r=e&&typeof e=="object"?e:{},i=!!r.satisfied,s=!!r.applied,u=r.ok!==!1,f=typeof r.message=="string"?r.message:"";let a=typeof r.status=="string"&&r.status.trim()?r.status.trim():null;a||(u?i?a="satisfied":s?a="adjusted":a="pending":a="error");const m=Number.isFinite(r.error)?r.error:null,l=r.persistInputParams&&typeof r.persistInputParams=="object"?O(r.persistInputParams):null;return t&&(t.persistentData=t.persistentData||{},t.persistentData.status||(t.persistentData.status=a),f&&!t.persistentData.message&&(t.persistentData.message=f),t.persistentData.satisfied=i,m!=null&&(t.persistentData.error=m),t.persistentData.isNewConstraint===!0&&u&&s&&(t.persistentData.isNewConstraint=!1)),{ok:u,status:a,satisfied:i,applied:s,error:m,message:f,iteration:n,diagnostics:r.diagnostics||null,persistInputParams:l}},"#finalizeConstraintResult"),Dt=c(function(t){const e=B(t);if(!e)return null;if(this.registry&&typeof this.registry.getSafe=="function"){const n=this.registry.getSafe(e);if(n)return n}if(this.registry&&typeof this.registry.get=="function")try{return this.registry.get(e)}catch{return null}return null},"#resolveConstraint"),L=c(function(t="update",e=null,n=null){if(!(this._listeners instanceof Set)||this._listeners.size===0)return;const r={...n&&typeof n=="object"?n:{},history:this,entry:e||null,reason:t||"update"};for(const i of Array.from(this._listeners))try{i({...r})}catch{}},"#emitChange"),c(Be,"AssemblyConstraintHistory");let fe=Be;const We=class We{constructor(){this.metadata={}}getMetadata(t){const e=this.metadata[t]||{};return e.inheritsFrom?{...this.getMetadata(e.inheritsFrom),...e}:e}getOwnMetadata(t){const e=this.metadata[t];return e?{...e}:{}}setMetadata(t,e,n){this.metadata[t]||(this.metadata[t]={}),this.metadata[t][e]=n}setMetadataObject(t,e){e&&Object.keys(e).length>0?this.metadata[t]={...e}:delete this.metadata[t]}deleteMetadataKey(t,e){const n=this.metadata[t];n&&(delete n[e],Object.keys(n).length===0&&delete this.metadata[t])}clearMetadata(t){delete this.metadata[t]}};c(We,"MetadataManager");let Xt=We;const Ge=class Ge{constructor(t){this.partHistory=t||null,this.views=[],this._listeners=new Set}reset(){this.views=[],this._emit()}getViews(){return this._normalizeViewsArray(this.views),this.views}setViews(t){const e=Array.isArray(t)?Array.from(t):[];return this.views=e,this._normalizeViewsArray(this.views),this._emit(),this.views}addView(t){const e=this.getViews(),n=this._normalizeView(t,e.length);return e.push(n),this._emit(),n}updateView(t,e){const n=this.getViews(),r=Number(t);if(!Number.isInteger(r)||r<0||r>=n.length)return null;const i=n[r];let s=i;if(typeof e=="function")try{const u=e(i);u&&typeof u=="object"&&(s=u)}catch{}else e&&typeof e=="object"&&e!==i&&(s=Object.assign({},i,e));return s!==i&&(n[r]=s),n[r]=this._normalizeView(n[r],r),this._emit(),n[r]}removeView(t){const e=this.getViews(),n=Number(t);if(!Number.isInteger(n)||n<0||n>=e.length)return null;const[r]=e.splice(n,1);for(let i=0;i<e.length;i++)e[i]=this._normalizeView(e[i],i);return this._emit(),r||null}addListener(t){return typeof t!="function"?()=>{}:(this._listeners.add(t),()=>{try{this._listeners.delete(t)}catch{}})}removeListener(t){if(typeof t=="function")try{this._listeners.delete(t)}catch{}}notifyChanged(){this._emit()}toSerializable(){return this.getViews().map(t=>O(t))}_normalizeViewsArray(t){if(!Array.isArray(t))return this.views=[],this.views;for(let e=0;e<t.length;e++)t[e]=this._normalizeView(t[e],e);return t}_normalizeView(t,e){const n=Number.isInteger(e)?e:0,r=t&&typeof t=="object"?t:{},i=typeof r.name=="string"?r.name.trim():"",u=(typeof r.viewName=="string"?r.viewName.trim():"")||i||`View ${n+1}`;if(r.viewName=u,r.name=u,Array.isArray(r.annotations)||(r.annotations=[]),(!r.camera||typeof r.camera!="object")&&(r.camera={}),r.camera.viewport&&typeof r.camera.viewport=="object"){const m=Number(r.camera.viewport.width),l=Number(r.camera.viewport.height);m>0&&l>0?r.camera.viewport={width:m,height:l}:delete r.camera.viewport}(!r.viewSettings||typeof r.viewSettings!="object")&&(r.viewSettings={});const f=Number(r.viewSettings?.pmiTextSizePt);Number.isFinite(f)&&f>0?r.viewSettings.pmiTextSizePt=Math.max(1,Math.min(288,f)):delete r.viewSettings.pmiTextSizePt;const a=Array.isArray(r.viewSettings?.visibilityState?.hidden)?r.viewSettings.visibilityState.hidden.map(m=>({key:String(m?.key||""),count:Math.max(1,Math.round(Number(m?.count)||1))})).filter(m=>m.key):[];return a.length?r.viewSettings.visibilityState={hidden:a}:delete r.viewSettings.visibilityState,r.annotationHistory&&typeof r.annotationHistory!="object"&&delete r.annotationHistory,r}_emit(){if(!this._listeners||this._listeners.size===0)return;const t=this.getViews();for(const e of Array.from(this._listeners))try{e(t,this.partHistory||null)}catch{}}};c(Ge,"PMIViewsManager");let ye=Ge;const Ke=class Ke{constructor(){this.entityClasses=new Map}register(t){if(!t)return;const e=t.shortName;if(!e)throw new Error("EntityClass must declare static entityType (or type/name).");this.entityClasses.set(e,t)}resolve(t){const e=t;return e&&this.entityClasses.get(e)||null}};c(Ke,"entityClassRegistry");let ge=Ke;const qe=class qe{constructor({viewer:t=null,registry:e=null}={}){this.viewer=t||null,this.registry=e||null,this.entries=[],this.registry=new ge,this._listeners=new Set,this._idCounter=0}serializableData(){return this.entries.map(t=>({id:t.id,type:t.type,inputParams:t.inputParams,persistentData:t.persistentData}))}};c(qe,"HistoryCollectionBase");let be=qe;const Mr={id:{type:"string",default_value:null,hint:"Unique identifier for this linear motion."},solid:{type:"reference_selection",selectionFilter:["SOLID"],multiple:!1,default_value:null,hint:"Select the solid to drive."},axis:{type:"reference_selection",selectionFilter:["EDGE"],multiple:!1,default_value:null,hint:"Select an edge or centerline to use as the travel direction."},speed:{type:"number",default_value:10,hint:"Linear speed in scene units per second."},distance:{type:"number",default_value:0,hint:"Optional travel distance. Leave blank to move continuously."}},ut=class ut extends An{onIdChanged(){}onParamsChanged(){}onPersistentDataChanged(){}};c(ut,"LinearMotionEntity"),Z(ut,"entityType","linear"),Z(ut,"shortName","LIN"),Z(ut,"longName","Linear Motion"),Z(ut,"inputParamsSchema",Mr);let Yt=ut;const Er={id:{type:"string",default_value:null,hint:"Unique identifier for this rotation motion."},solid:{type:"reference_selection",selectionFilter:["SOLID"],multiple:!1,default_value:null,hint:"Select the solid to drive."},axis:{type:"reference_selection",selectionFilter:["EDGE"],multiple:!1,default_value:null,hint:"Select an edge or centerline to rotate about."},speed:{type:"number",default_value:90,hint:"Rotation speed in degrees per second."},angle:{type:"number",default_value:0,hint:"Optional total angle in degrees. Leave blank to rotate continuously."}},ct=class ct extends An{onIdChanged(){}onParamsChanged(){}onPersistentDataChanged(){}};c(ct,"RotationMotionEntity"),Z(ct,"entityType","rotation"),Z(ct,"shortName","ROT"),Z(ct,"longName","Rotation Motion"),Z(ct,"inputParamsSchema",Er);let Zt=ct;const yt="rotation",ln=new Set(["type","persistentData","__open"]),Xe=class Xe extends be{constructor(t){super({viewer:null}),this.partHistory=t||null,this._registerAvailableEntries()}getMotions(){return this.entries}createMotion(t=yt,e=null){const n=this._resolveHandler(t);if(!n)return null;const r=new n({history:this,registry:this.registry});r.type=n.entityType||n.type||yt,r.entityType=r.type;const i=this._defaultsFromSchema(n),s=O(e||{});r.setParams({...i,...s,type:r.type}),r.setPersistentData(s.persistentData||{}),delete r.inputParams.persistentData;const u=r.inputParams.id||this.generateId(r.shortName||r.type||"SIM");return r.setId(u),r.runtimeAttributes.__open=!0,this._linkInputParams(r),this.entries.push(r),this._bumpIdCounterFrom(r),this.notifyListeners({reason:"add",entry:r,history:this}),r}loadSerializable(t){this.entries=[],this._idCounter=0;const e=t&&typeof t=="object"&&!Array.isArray(t)?t:{motions:t},n=Array.isArray(e.motions)?e.motions:[];for(const r of n){const i=this._hydrateEntity(r);i&&(this.entries.push(i),this._bumpIdCounterFrom(i),this._linkInputParams(i))}return this.notifyListeners({reason:"load",history:this}),this.entries}toSerializable(){return{motions:this.entries.map(t=>{const e=!!t.runtimeAttributes?.__open,n=O(t.inputParams||{});return n&&typeof n=="object"&&(delete n.persistentData,delete n.__open,delete n.__entityRef),{type:t.type||yt,inputParams:n,persistentData:O(t.persistentData||{}),__open:e||void 0}})}}reset(){this.entries=[],this._idCounter=0,this.notifyListeners({reason:"clear",history:this})}generateId(t="SIM"){const e=String(t||"SIM").replace(/[^a-z0-9]/gi,"").toUpperCase()||"SIM",n=new Set(this.entries.map((i,s)=>{const u=i?.inputParams;return u?.id?String(u.id):i?.id!=null?String(i.id):`SIM${s+1}`}));let r="";do this._idCounter+=1,r=`${e}${this._idCounter}`;while(n.has(r));return r}addListener(t){return typeof t!="function"?()=>{}:(this._listeners.add(t),()=>{try{this._listeners.delete(t)}catch{}})}removeListener(t){if(typeof t=="function")try{this._listeners.delete(t)}catch{}}notifyListeners(t={}){if(this._listeners instanceof Set)for(const e of Array.from(this._listeners))try{e(t,this)}catch{}}_registerAvailableEntries(){for(const t of[Zt,Yt])try{this.registry.register(t)}catch{}}_resolveHandler(t){return String(t||"").trim().toLowerCase()==="linear"?Yt:Zt}_defaultsFromSchema(t){const e={},n=t?.inputParamsSchema;if(!n||typeof n!="object")return e;for(const r of Object.keys(n)){if(ln.has(r))continue;const i=n[r];!i||typeof i!="object"||Object.prototype.hasOwnProperty.call(i,"default_value")&&(e[r]=O(i.default_value))}return e}_hydrateEntity(t){const e=t&&typeof t=="object"?t:{},n=this._resolveHandler(e.type||e.inputParams?.type||yt);if(!n)return null;const r=new n({history:this,registry:this.registry});r.type=n.entityType||n.type||yt,r.entityType=r.type;const i=this._cloneWithoutReserved(e.inputParams||e);i.type||(i.type=r.type),r.setParams(i),r.setPersistentData(O(e.persistentData||{})),delete r.inputParams.persistentData;const s=r.inputParams.id||e.id||this.generateId(r.shortName||r.type);return r.setId(s),r.runtimeAttributes.__open=!!e.__open,this._linkInputParams(r),r}_cloneWithoutReserved(t){const e={};if(!t||typeof t!="object")return e;for(const n of Object.keys(t))ln.has(n)||(e[n]=O(t[n]));return e}_linkInputParams(t){if(!t)return;(!t.runtimeAttributes||typeof t.runtimeAttributes!="object")&&(t.runtimeAttributes={});const e=t.inputParams||{},n={configurable:!0,enumerable:!1};Object.prototype.hasOwnProperty.call(e,"__entityRef")||Object.defineProperty(e,"__entityRef",{...n,value:t}),Object.prototype.hasOwnProperty.call(e,"persistentData")||Object.defineProperty(e,"persistentData",{...n,get:c(()=>t.persistentData,"get"),set:c(r=>{const i=r&&typeof r=="object"?r:{};t.setPersistentData(i)},"set")}),Object.prototype.hasOwnProperty.call(e,"__open")||Object.defineProperty(e,"__open",{...n,get:c(()=>!!t.runtimeAttributes.__open,"get"),set:c(r=>{t.runtimeAttributes.__open=!!r},"set")}),e.type=t.type||e.type||yt,e.id==null&&t.id!=null&&(e.id=t.id)}_bumpIdCounterFrom(t){const e=t?.inputParams?.id||t?.id;if(!e)return;const n=String(e).match(/(\d+)$/);if(!n)return;const r=parseInt(n[1],10);Number.isFinite(r)&&r>this._idCounter&&(this._idCounter=r)}};c(Xe,"SimulationStateManager");let Se=Xe;const gt=96,Nn=1;function jr(o,t=0){const e=Number(o);return Number.isFinite(e)?e:t}c(jr,"toFiniteNumber$4");function Ae(o,t){return Math.max(Nn,jr(o,t))}c(Ae,"clampCustomSheetSize");function fn(o){const t=Math.round(Ae(o,Nn)*100)/100;return String(t).replace(/(\.\d*?[1-9])0+$/u,"$1").replace(/\.0+$/u,"")}c(fn,"formatSheetDimension");const we=Object.freeze({A:Object.freeze({key:"A",label:"A (8.5 x 11 in)",widthIn:8.5,heightIn:11}),B:Object.freeze({key:"B",label:"B (11 x 17 in)",widthIn:11,heightIn:17}),C:Object.freeze({key:"C",label:"C (17 x 22 in)",widthIn:17,heightIn:22}),D:Object.freeze({key:"D",label:"D (22 x 34 in)",widthIn:22,heightIn:34}),E:Object.freeze({key:"E",label:"E (34 x 44 in)",widthIn:34,heightIn:44}),A4:Object.freeze({key:"A4",label:"A4 (210 x 297 mm)",widthIn:8.27,heightIn:11.69}),A3:Object.freeze({key:"A3",label:"A3 (297 x 420 mm)",widthIn:11.69,heightIn:16.54}),A2:Object.freeze({key:"A2",label:"A2 (420 x 594 mm)",widthIn:16.54,heightIn:23.39}),A1:Object.freeze({key:"A1",label:"A1 (594 x 841 mm)",widthIn:23.39,heightIn:33.11}),A0:Object.freeze({key:"A0",label:"A0 (841 x 1189 mm)",widthIn:33.11,heightIn:46.81}),CUSTOM:Object.freeze({key:"CUSTOM",label:"Custom",widthIn:36,heightIn:24})}),Hr=Object.freeze(["A","B","C","D","E","A4","A3","A2","A1","A0","CUSTOM"]);function Fn(o){return String(o??"").trim().toLowerCase()==="portrait"?"portrait":"landscape"}c(Fn,"normalizeSheetOrientation");function Pn(o){const t=String(o??"").trim().toUpperCase();return we[t]||we.A}c(Pn,"getSheetSizeByKey");function bi(){return Hr.map(o=>we[o]).filter(Boolean)}c(bi,"listSheetSizes");function $r(o,t="landscape",e=null){const n=Pn(o),r=Fn(t);if(n.key==="CUSTOM"){const f=Ae(e?.customWidthIn??e?.widthIn,n.widthIn),a=Ae(e?.customHeightIn??e?.heightIn,n.heightIn),m=r==="landscape",l=m?Math.max(f,a):Math.min(f,a),y=m?Math.min(f,a):Math.max(f,a);return{key:n.key,label:`Custom (${fn(l)} x ${fn(y)} in)`,orientation:r,units:"in",widthIn:l,heightIn:y,widthPx:l*gt,heightPx:y*gt,pxPerInch:gt,customWidthIn:l,customHeightIn:y}}const i=r==="landscape",s=i?Math.max(n.widthIn,n.heightIn):Math.min(n.widthIn,n.heightIn),u=i?Math.min(n.widthIn,n.heightIn):Math.max(n.widthIn,n.heightIn);return{key:n.key,label:n.label,orientation:r,units:"in",widthIn:s,heightIn:u,widthPx:s*gt,heightPx:u*gt,pxPerInch:gt}}c($r,"resolveSheetDimensions");function Tt(o,t=0){const e=Number(o);return Number.isFinite(e)?e:t}c(Tt,"toFiniteNumber$3");function X(o,t,e){return Math.max(t,Math.min(e,o))}c(X,"clamp$1");function nt(o,t=""){return typeof o=="string"?o:o==null?t:String(o)}c(nt,"sanitizeText$1");function Lr(o,t=null){const e=String(o??"").trim();return e&&(/^#[\da-fA-F]{3,8}$/.test(e)||/^[a-zA-Z]+$/.test(e)||/^(rgb|rgba|hsl|hsla)\([^)]+\)$/i.test(e))?e:t}c(Lr,"sanitizeColor$1");function z(o,t=1){return Math.max(1,Math.round(Tt(o,t)))}c(z,"clampPositiveInt");function K(o,t=0){return Math.max(0,Math.round(Tt(o,t)))}c(K,"clampIndex");function Ur(o,t=null){if(o==null)return t;const e=String(o).trim().toLowerCase();return e==="middle"||e==="center"?"center":e==="end"||e==="right"?"right":e==="left"?"left":t}c(Ur,"normalizeTextAlign$1");function Vr(o,t=null){if(o==null)return t;const e=String(o).trim().toLowerCase();return e==="center"?"middle":e==="bottom"?"bottom":e==="middle"||e==="top"?e:t}c(Vr,"normalizeVerticalAlign$1");function Br(o,t=null){if(o==null)return t;const e=String(o).trim();return e==="bold"?"700":e==="normal"?"400":/^\d{3}$/.test(e)?e:t}c(Br,"normalizeFontWeight");function Wr(o,t=null){return o==null?t:String(o).trim().toLowerCase()==="italic"?"italic":"normal"}c(Wr,"normalizeFontStyle");function Gr(o,t=null){return o==null?t:String(o).trim().toLowerCase()==="underline"?"underline":"none"}c(Gr,"normalizeTextDecoration");function Ue(o){if(!o||typeof o!="object"||Array.isArray(o))return{};const t={},e=nt(o.fontFamily,"").trim();e&&(t.fontFamily=e);const n=Tt(o.fontSize,Number.NaN);Number.isFinite(n)&&n>0&&(t.fontSize=X(n,.08,3));const r=Br(o.fontWeight??(o.bold?"700":null));r&&(t.fontWeight=r);const i=Wr(o.fontStyle??(o.italic?"italic":null));i&&(t.fontStyle=i);const s=Gr(o.textDecoration);s&&(t.textDecoration=s);const u=Ur(o.textAlign??o.textAnchor);u&&(t.textAlign=u);const f=Vr(o.verticalAlign??o.verticalAnchor);f&&(t.verticalAlign=f);const a=Lr(o.color??o.textColor,null);return a&&(t.color=a),t}c(Ue,"normalizeTableCellStyle");function Rn(o=""){return{text:nt(o,""),rowSpan:1,colSpan:1,mergedInto:null,style:{}}}c(Rn,"createTableCell");function ft(o,t){const e=Math.max(1,z(t,1)),n=Array.isArray(o)?o.slice(0,e):[],r=[];for(let s=0;s<e;s+=1)r.push(Math.max(1e-4,Tt(n[s],1)));const i=r.reduce((s,u)=>s+u,0);return!Number.isFinite(i)||i<=0?Array.from({length:e},()=>1/e):r.map(s=>s/i)}c(ft,"normalizeTableFractions");function wt(o,t=0){return Array.isArray(o?.cells)&&o.cells.length>0?o.cells.length:Array.isArray(o?.rowFractions)&&o.rowFractions.length>0?o.rowFractions.length:Math.max(0,z(t,0))}c(wt,"getTableRowCount");function _t(o,t=0){const e=Array.isArray(o?.cells)?o.cells:[];let n=0;for(const r of e)Array.isArray(r)&&(n=Math.max(n,r.length));return n>0?n:Array.isArray(o?.colFractions)&&o.colFractions.length>0?o.colFractions.length:Math.max(0,z(t,0))}c(_t,"getTableColumnCount");function On(o=3,t=3){const e=Math.max(1,z(o,3)),n=Math.max(1,z(t,3));return{rowFractions:ft(null,e),colFractions:ft(null,n),cells:Array.from({length:e},()=>Array.from({length:n},()=>Rn()))}}c(On,"createTableData");function kt(o,t=3,e=3){const n=Math.max(1,wt(o,t)),r=Math.max(1,_t(o,e)),i=On(n,r);i.rowFractions=ft(o?.rowFractions,n),i.colFractions=ft(o?.colFractions,r);const s=Array.isArray(o?.cells)?o.cells:[],u=[];for(let a=0;a<n;a+=1)for(let m=0;m<r;m+=1){const l=Array.isArray(s[a])?s[a][m]:null,y=i.cells[a][m];l&&typeof l=="object"&&!Array.isArray(l)?(y.text=nt(l.text,nt(l.value,"")),y.style=Ue(l.style&&typeof l.style=="object"?l.style:l),u.push({row:a,col:m,rowSpan:z(l.rowSpan,1),colSpan:z(l.colSpan,1)})):(y.text=nt(l,""),y.style={}),y.rowSpan=1,y.colSpan=1,y.mergedInto=null}const f=Array.from({length:n},()=>Array.from({length:r},()=>!1));for(const a of u){const m=X(a.rowSpan,1,n-a.row),l=X(a.colSpan,1,r-a.col);if(m===1&&l===1)continue;let y=!1;for(let d=a.row;d<a.row+m&&!y;d+=1)for(let g=a.col;g<a.col+l;g+=1)if(!(d===a.row&&g===a.col)&&f[d][g]){y=!0;break}if(y)continue;const b=i.cells[a.row][a.col];b.rowSpan=m,b.colSpan=l;for(let d=a.row;d<a.row+m;d+=1)for(let g=a.col;g<a.col+l;g+=1)d===a.row&&g===a.col||(f[d][g]=!0,i.cells[d][g]={text:"",rowSpan:1,colSpan:1,mergedInto:{row:a.row,col:a.col},style:{}})}return i}c(kt,"normalizeTableData");function Ot(o,t,e){return Array.isArray(o?.cells?.[t])&&o.cells[t][e]||null}c(Ot,"getTableCell");function Tn(o,t,e){const n=Ot(o,t,e);if(!n)return null;const r=n?.mergedInto;if(r&&Number.isInteger(r.row)&&Number.isInteger(r.col)){const i=Ot(o,r.row,r.col);if(i)return{row:r.row,col:r.col,cell:i}}return{row:t,col:e,cell:n}}c(Tn,"resolveTableCellAnchor");function Si(o){if(!o)return null;const t=[o.anchorRow,o.focusRow].map(n=>K(n,0)),e=[o.anchorCol,o.focusCol].map(n=>K(n,0));return{minRow:Math.min(...t),maxRow:Math.max(...t),minCol:Math.min(...e),maxCol:Math.max(...e)}}c(Si,"getTableSelectionRect");function Qt(o,t=3,e=3){const n=kt(o,t,e);return{rowFractions:n.rowFractions.slice(),colFractions:n.colFractions.slice(),cells:n.cells.map(r=>r.map(i=>({text:nt(i?.text,""),rowSpan:z(i?.rowSpan,1),colSpan:z(i?.colSpan,1),mergedInto:i?.mergedInto&&Number.isInteger(i.mergedInto.row)&&Number.isInteger(i.mergedInto.col)?{row:i.mergedInto.row,col:i.mergedInto.col}:null,style:Ue(i?.style)})))}}c(Qt,"cloneTableData");function Kr(o,t){if(typeof t!="function")return;const e=kt(o),n=wt(e,0),r=_t(e,0);for(let i=0;i<n;i+=1)for(let s=0;s<r;s+=1){const u=Ot(e,i,s);!u||u?.mergedInto||t(u,i,s,e)}}c(Kr,"forEachTableAnchor");function Ai(o,t,e,n){const r=Qt(o),i=Tn(r,K(t,0),K(e,0));return i?.cell&&(i.cell.text=nt(n,"")),r}c(Ai,"setTableCellText");function qr(o,t){const e=kt(o),n=t||null;if(!n)return!1;const r=wt(e,0),i=_t(e,0),s=X(n.minRow,0,Math.max(0,r-1)),u=X(n.maxRow,s,Math.max(0,r-1)),f=X(n.minCol,0,Math.max(0,i-1)),a=X(n.maxCol,f,Math.max(0,i-1));if(s===u&&f===a)return!1;for(let m=s;m<=u;m+=1)for(let l=f;l<=a;l+=1){const y=Ot(e,m,l);if(!y||y?.mergedInto||z(y.rowSpan,1)!==1||z(y.colSpan,1)!==1)return!1}return!0}c(qr,"canMergeTableCells");function wi(o,t){const e=Qt(o),n=t||null;if(!n||!qr(e,n))return e;const r=K(n.minRow,0),i=Math.max(r,K(n.maxRow,r)),s=K(n.minCol,0),u=Math.max(s,K(n.maxCol,s)),f=Ot(e,r,s);if(!f)return e;f.rowSpan=i-r+1,f.colSpan=u-s+1,f.mergedInto=null;for(let a=r;a<=i;a+=1)for(let m=s;m<=u;m+=1)a===r&&m===s||(e.cells[a][m]={text:"",rowSpan:1,colSpan:1,mergedInto:{row:r,col:s},style:{}});return e}c(wi,"mergeTableCells");function _i(o,t,e){const n=Qt(o),r=Tn(n,K(t,0),K(e,0));if(!r?.cell)return n;const i=z(r.cell.rowSpan,1),s=z(r.cell.colSpan,1);if(i===1&&s===1)return n;r.cell.rowSpan=1,r.cell.colSpan=1,r.cell.mergedInto=null;for(let u=r.row;u<r.row+i;u+=1)for(let f=r.col;f<r.col+s;f+=1)u===r.row&&f===r.col||(n.cells[u][f]=Rn(""));return n}c(_i,"unmergeTableCell");function pn(o,t){const e=Array.isArray(o)?o.slice():[1],n=e.length;if(n<=0)return[1];const r=X(t,0,n),i=X(r===n?n-1:r,0,n-1),s=Math.max(1e-4,Tt(e[i],1/n)),u=Math.max(1e-4,s*.5);return e[i]=Math.max(1e-4,s-u),e.splice(r,0,u),ft(e,e.length)}c(pn,"splitFractionList");function kn(o,{rowInsertIndex:t=null,colInsertIndex:e=null}={}){const n=kt(o),r=wt(n,1),i=_t(n,1),s=t==null?r:r+1,u=e==null?i:i+1,f=t==null?-1:X(t,0,r),a=e==null?-1:X(e,0,i),m=On(s,u);return m.rowFractions=t==null?ft(n.rowFractions,r):pn(n.rowFractions,f),m.colFractions=e==null?ft(n.colFractions,i):pn(n.colFractions,a),Kr(n,(l,y,b)=>{const d=f>=0&&y>=f?y+1:y,g=a>=0&&b>=a?b+1:b,I=f>=0&&y<f&&y+z(l.rowSpan,1)>f?z(l.rowSpan,1)+1:z(l.rowSpan,1),_=a>=0&&b<a&&b+z(l.colSpan,1)>a?z(l.colSpan,1)+1:z(l.colSpan,1);m.cells[d][g]={text:nt(l.text,""),rowSpan:I,colSpan:_,mergedInto:null,style:Ue(l.style)};for(let S=d;S<d+I;S+=1)for(let x=g;x<g+_;x+=1)S===d&&x===g||(m.cells[S][x]={text:"",rowSpan:1,colSpan:1,mergedInto:{row:d,col:g},style:{}})}),m}c(kn,"buildInsertedTable");function Xr(o,t){return kn(o,{rowInsertIndex:K(t,0)})}c(Xr,"insertTableRow");function Yr(o,t){return kn(o,{colInsertIndex:K(t,0)})}c(Yr,"insertTableColumn");function Ii(o,t=1,e=1){let n=Qt(o,t,e);const r=Math.max(1,z(t,1)),i=Math.max(1,z(e,1));for(;wt(n,0)<r;)n=Xr(n,wt(n,0));for(;_t(n,0)<i;)n=Yr(n,_t(n,0));return n}c(Ii,"ensureTableSize");function T(o,t=0){const e=Number(o);return Number.isFinite(e)?e:t}c(T,"toFiniteNumber$2");function V(o,t=""){return typeof o=="string"?o:o==null?t:String(o)}c(V,"sanitizeText");function Y(o,t){const e=String(o??"").trim();return e&&(/^#[\da-fA-F]{3,8}$/.test(e)||/^[a-zA-Z]+$/.test(e)||/^(rgb|rgba|hsl|hsla)\([^)]+\)$/i.test(e))?e:t}c(Y,"sanitizeColor");function v(o,t,e){return Math.max(t,Math.min(e,o))}c(v,"clamp");function ie(o,t="left"){const e=String(o||t).trim().toLowerCase();return e==="middle"||e==="center"?"center":e==="end"||e==="right"?"right":"left"}c(ie,"normalizeTextAlign");function se(o,t="top"){const e=String(o||t).trim().toLowerCase();return e==="center"?"middle":e==="bottom"?"bottom":e==="middle"?"middle":"top"}c(se,"normalizeVerticalAlign");function Zr(o,t="c"){const e=String(o||t).trim().toLowerCase();return["nw","n","ne","w","c","e","sw","s","se"].includes(e)?e:t}c(Zr,"normalizePmiAnchor");function hn(o,t="bottom"){const e=String(o||t).trim().toLowerCase();return["top","bottom","none"].includes(e)?e:t}c(hn,"normalizePmiLabelPosition");function Qr(o,t="shaded"){const e=String(o||t).trim().toLowerCase();return["shaded","monochrome"].includes(e)?e:t}c(Qr,"normalizePmiRenderMode");function Jr(o,t="solid"){const e=String(o||t).trim();return["none","solid","dotted","dashed","dashDot","longDash","dashDotDot"].includes(e)?e:t}c(Jr,"normalizeLineStyle");function J(o){return["rect","ellipse","triangle","diamond","pentagon","hexagon","parallelogram","trapezoid"].includes(String(o||""))}c(J,"isShapeElementType");function vn(o){return["parallelogram","trapezoid"].includes(String(o||""))}c(vn,"shapeSupportsAdjustHandle");function ti(o){return vn(o)?.18:0}c(ti,"getDefaultShapeAdjust");function ei(o,t){return vn(o)?v(T(t,ti(o)),0,.45):0}c(ei,"clampShapeAdjust");function ni(o){const t=String(o??"").trim().toLowerCase();return t==="rect"?"rect":t==="ellipse"?"ellipse":t==="triangle"?"triangle":t==="diamond"?"diamond":t==="pentagon"?"pentagon":t==="hexagon"?"hexagon":t==="parallelogram"?"parallelogram":t==="trapezoid"?"trapezoid":t==="table"?"table":t==="image"?"image":t==="line"?"line":t==="pmiinset"||t==="pmi_inset"||t==="pmi"||t==="pmiview"?"pmiInset":"text"}c(ni,"normalizeElementType");const Ye=class Ye{constructor(t){this.partHistory=t||null,this.sheets=[],this._listeners=new Set}reset(){this.sheets=[],this._emit()}getSheets(){return this._normalizeSheetsArray(this.sheets),this.sheets}getSheetById(t){const e=String(t??"").trim();return e&&this.getSheets().find(n=>String(n?.id||"")===e)||null}setSheets(t){const e=Array.isArray(t)?Array.from(t):[];return this.sheets=e,this._normalizeSheetsArray(this.sheets),this._emit(),this.sheets}createSheet(t={}){const e=this.getSheets(),n=Date.now(),r=this._normalizeSheet({...t,id:t?.id||this._generateSheetId(),metadata:{...t?.metadata&&typeof t.metadata=="object"?t.metadata:{},createdAt:Number.isFinite(Number(t?.metadata?.createdAt))?Number(t.metadata.createdAt):n,updatedAt:Number.isFinite(Number(t?.metadata?.updatedAt))?Number(t.metadata.updatedAt):n}},e.length);return e.push(r),this._emit(),r}duplicateSheet(t){const e=this._resolveSheetIndex(t);if(e<0)return null;const n=this.getSheets()[e],r=O(n)||{};r.id=this._generateSheetId(),r.name=`${V(n?.name,"Sheet")} Copy`,r.elements=Array.isArray(r.elements)?r.elements.map(s=>({...s||{},id:this._generateElementId(r.id)})):[];const i=this._normalizeSheet(r,this.sheets.length);return this.sheets.push(i),this._emit(),i}updateSheet(t,e){const n=this._resolveSheetIndex(t);if(n<0)return null;const r=this.sheets[n];let i=r;if(typeof e=="function")try{const u=e(O(r));u&&typeof u=="object"&&(i=u)}catch{i=r}else e&&typeof e=="object"&&(i={...r,...e});const s=this._normalizeSheet(i,n,r?.id);return s.metadata={...s.metadata||{},createdAt:Number.isFinite(Number(r?.metadata?.createdAt))?Number(r.metadata.createdAt):s.metadata?.createdAt,updatedAt:Date.now()},this.sheets[n]=s,this._emit(),this.sheets[n]}moveSheet(t,e){const n=this._resolveSheetIndex(t);if(n<0)return null;const r=this.getSheets(),i=v(Math.round(T(e,n)),0,Math.max(0,r.length-1));if(i===n)return r[n]||null;const[s]=r.splice(n,1);return s?(r.splice(i,0,s),this._normalizeSheetsArray(r),this._emit(),s):null}removeSheet(t){const e=this._resolveSheetIndex(t);if(e<0)return null;const[n]=this.sheets.splice(e,1);return this._normalizeSheetsArray(this.sheets),this._emit(),n||null}addListener(t){return typeof t!="function"?()=>{}:(this._listeners.add(t),()=>{try{this._listeners.delete(t)}catch{}})}removeListener(t){if(typeof t=="function")try{this._listeners.delete(t)}catch{}}notifyChanged(){this._emit()}toSerializable(){return this.getSheets().map(t=>O(t))}_resolveSheetIndex(t){if(Number.isInteger(t)){const n=Number(t);return n>=0&&n<this.getSheets().length?n:-1}const e=String(t??"").trim();return e?this.getSheets().findIndex(n=>String(n?.id||"")===e):-1}_generateSheetId(){const t=new Set(this.getSheets().map(n=>String(n?.id||"")));let e=1;for(;t.has(`sheet-${e}`);)e+=1;return`sheet-${e}`}_generateElementId(t="sheet"){return`${String(t||"sheet").replace(/[^A-Za-z0-9_-]/g,"_")}:el:${Date.now().toString(36)}:${Math.random().toString(36).slice(2,7)}`}_normalizeSheetsArray(t){if(!Array.isArray(t))return this.sheets=[],this.sheets;for(let e=0;e<t.length;e++){const n=t[e]?.id;t[e]=this._normalizeSheet(t[e],e,n)}return t}_normalizeSheet(t,e,n=null){const r=t&&typeof t=="object"?t:{},i=Pn(r.sizeKey),s=Fn(r.orientation),u=Math.max(1,T(r.customWidthIn??r.widthIn,i.widthIn)),f=Math.max(1,T(r.customHeightIn??r.heightIn,i.heightIn)),a=$r(i.key,s,{customWidthIn:u,customHeightIn:f}),m=V(n||r.id||this._generateSheetId(),"").trim()||this._generateSheetId(),l=V(r.name,"").trim()||`Sheet ${e+1}`,y=Array.isArray(r.elements)?r.elements:[],b=[],d=new Set;for(let g=0;g<y.length;g++){const I=this._normalizeElement(y[g],g,m,a);I&&(d.has(I.id)&&(I.id=this._generateElementId(m)),d.add(I.id),b.push(I))}return{id:m,name:l,sizeKey:a.key,sizeLabel:a.label,orientation:a.orientation,units:a.units,widthIn:a.widthIn,heightIn:a.heightIn,customWidthIn:a.key==="CUSTOM"?a.widthIn:void 0,customHeightIn:a.key==="CUSTOM"?a.heightIn:void 0,widthPx:a.widthPx,heightPx:a.heightPx,pxPerInch:a.pxPerInch,background:Y(r.background,"#ffffff"),elements:b,metadata:{createdAt:Number.isFinite(Number(r?.metadata?.createdAt))?Number(r.metadata.createdAt):Date.now(),updatedAt:Number.isFinite(Number(r?.metadata?.updatedAt))?Number(r.metadata.updatedAt):Number.isFinite(Number(r?.metadata?.createdAt))?Number(r.metadata.createdAt):Date.now()}}}_normalizeElement(t,e,n,r){const i=t&&typeof t=="object"?t:{},s=ni(i.type),u=Math.max(.1,T(r?.widthIn,11)),f=Math.max(.1,T(r?.heightIn,8.5)),a=-u*2,m=-f*2,l=u*3,y=f*3,b=v(T(i.x,u*.1),a,l),d=v(T(i.y,f*.1),m,y),g=V(i.id,"").trim()||this._generateElementId(n),I=Number.isInteger(i.z)?i.z:Number.isInteger(i.layer)?i.layer:e,_={id:g,type:s,groupId:V(i.groupId,"").trim()||void 0,formboard:i.formboard&&typeof i.formboard=="object"?O(i.formboard):void 0,x:b,y:d,rotationDeg:T(i.rotationDeg,0),z:Number.isFinite(Number(I))?Number(I):e,fill:Y(i.fill,s==="text"||s==="pmiInset"?"transparent":s==="table"?"#ffffff":"#dbeafe"),stroke:Y(i.stroke,s==="table"?"#0f172a":"#1d4ed8"),strokeWidth:v(T(i.strokeWidth,.02),.002,1),lineStyle:Jr(i.lineStyle,"solid"),opacity:v(T(i.opacity,1),0,1)};if(s==="line"){const pt=v(T(i.x2,b+1),a,l),U=v(T(i.y2,d),m,y);return{..._,x2:pt,y2:U,strokeWidth:v(T(i.strokeWidth,.035),.002,1)}}const S=Number.isFinite(Number(i.w)),x=Number.isFinite(Number(i.h)),C=T(S?i.w:i.width??(i.radiusX!=null?T(i.radiusX,.8)*2:1.4),1.4),F=T(x?i.h:i.height??(i.radiusY!=null?T(i.radiusY,.55)*2:.9),.9),P=v(C,.05,u*8),M=v(F,.05,f*8),H=!S&&!x&&Number.isFinite(Number(i.width))&&Number.isFinite(Number(i.height)),E=!S&&!x&&Number.isFinite(Number(i.radiusX))&&Number.isFinite(Number(i.radiusY)),rt=v(H||E?T(i.x,u*.5)-P*.5:b,a,l),q=v(H||E?T(i.y,f*.5)-M*.5:d,m,y);if(s==="table"){const pt=String(i.fontStyle||(i.italic?"italic":"normal")).toLowerCase()==="italic"?"italic":"normal",U=String(i.fontWeight||(i.bold?"700":"400"));return{..._,x:rt,y:q,w:v(C,.4,u*8),h:v(F,.3,f*8),tableData:kt(i.tableData,i.rows??3,i.cols??4),fontSize:v(T(i.fontSize,.22),.08,3),fontFamily:V(i.fontFamily,"Arial, Helvetica, sans-serif"),fontWeight:/^\d{3}$/.test(U)?U:U==="bold"?"700":"400",fontStyle:pt,textDecoration:String(i.textDecoration||"none").toLowerCase()==="underline"?"underline":"none",textAlign:ie(i.textAlign||i.textAnchor,"left"),verticalAlign:se(i.verticalAlign||i.verticalAnchor,"middle"),color:Y(i.color,Y(i.textColor,"#111111"))}}if(J(s)||s==="image"||s==="pmiInset"){const pt=String(i.fontStyle||(i.italic?"italic":"normal")).toLowerCase()==="italic"?"italic":"normal",U=String(i.fontWeight||(i.bold?"700":"400"));return{..._,x:rt,y:q,w:P,h:M,cornerRadius:v(T(i.cornerRadius,s==="rect"?.1:0),0,Math.min(P,M)*.5),shapeAdjust:ei(s,i.shapeAdjust),src:s==="image"||s==="pmiInset"?V(i.src,""):void 0,mediaScale:s==="image"||s==="pmiInset"?v(T(i.mediaScale,1),1,10):void 0,mediaOffsetX:s==="image"||s==="pmiInset"?v(T(i.mediaOffsetX,0),-1,1):void 0,mediaOffsetY:s==="image"||s==="pmiInset"?v(T(i.mediaOffsetY,0),-1,1):void 0,pmiViewIndex:s==="pmiInset"?Number.isInteger(i.pmiViewIndex)?i.pmiViewIndex:-1:void 0,pmiViewName:s==="pmiInset"?V(i.pmiViewName,"PMI View"):void 0,pmiImageRevision:s==="pmiInset"?Number.isInteger(i.pmiImageRevision)?i.pmiImageRevision:0:void 0,pmiModelRevision:s==="pmiInset"?Number.isInteger(i.pmiModelRevision)?i.pmiModelRevision:-1:void 0,pmiImageCaptureKey:s==="pmiInset"?V(i.pmiImageCaptureKey,""):void 0,showTitle:s==="pmiInset"?hn(i.pmiLabelPosition,i.showTitle!==!1?"bottom":"none")!=="none":void 0,pmiLabelPosition:s==="pmiInset"?hn(i.pmiLabelPosition,i.showTitle!==!1?"bottom":"none"):void 0,pmiRenderMode:s==="pmiInset"?Qr(i.pmiRenderMode,"shaded"):void 0,pmiShowCenterLines:s==="pmiInset"?i.pmiShowCenterLines===!0:void 0,pmiAnchor:s==="pmiInset"?Zr(i.pmiAnchor,"c"):void 0,text:J(s)?V(i.text,""):void 0,fontSize:J(s)?v(T(i.fontSize,.28),.08,3):void 0,fontFamily:J(s)?V(i.fontFamily,"Arial, Helvetica, sans-serif"):void 0,fontWeight:J(s)?/^\d{3}$/.test(U)?U:U==="bold"?"700":"400":void 0,fontStyle:J(s)?pt:void 0,textAlign:J(s)?ie(i.textAlign||i.textAnchor,"center"):void 0,verticalAlign:J(s)?se(i.verticalAlign||i.verticalAnchor,"middle"):void 0,color:J(s)?Y(i.color,Y(i.textColor,"#0f172a")):void 0}}const Jt=ie(i.textAlign||i.textAnchor,"left"),It=String(i.fontStyle||(i.italic?"italic":"normal")).toLowerCase()==="italic"?"italic":"normal",vt=String(i.fontWeight||(i.bold?"700":"400"));return{..._,w:v(T(S?i.w:i.width,3.2),.1,u*8),h:v(T(x?i.h:i.height,1.1),.1,f*8),text:V(i.text,`Text ${e+1}`),fontSize:v(T(i.fontSize,.32),.08,3),fontFamily:V(i.fontFamily,"Arial, Helvetica, sans-serif"),fontWeight:/^\d{3}$/.test(vt)?vt:vt==="bold"?"700":"400",fontStyle:It,textAlign:Jt,verticalAlign:se(i.verticalAlign||i.verticalAnchor,"top"),color:Y(i.color,Y(i.textColor,Y(i.fill,"#111111")))}}_emit(){if(!this._listeners||this._listeners.size===0)return;const t=this.getSheets();for(const e of Array.from(this._listeners))try{e(t,this.partHistory||null)}catch{}}};c(Ye,"Sheet2DManager");let _e=Ye;function Rt(o,t=0){const e=Number(o);return Number.isFinite(e)?e:t}c(Rt,"toFiniteNumber$1");function W(o,t=""){return String(o??"").trim()||t}c(W,"normalizeText");function oe(o,t=0){const e=o&&typeof o=="object"?o:{},n=Number.isInteger(t)?t+1:1;return{id:W(e.id,`wire-${n}`),name:W(e.name,`Wire ${n}`),from:W(e.from,""),to:W(e.to,""),diameter:Math.max(.01,Rt(e.diameter,1))}}c(oe,"normalizeConnection");function ri(o){return!Array.isArray(o)||o.length<3?null:[Rt(o[0],0),Rt(o[1],0),Rt(o[2],0)]}c(ri,"normalizePointArray");function dn(o){return Array.isArray(o)?o.map(t=>W(t,"")).filter(Boolean):[]}c(dn,"normalizeStringArray");function ii(o,t=new Map){const e=o&&typeof o=="object"?o:{},n=W(e.connectionId,""),r=t.get(n)||null,i=!!e.feasible;return{connectionId:n,connectionName:W(e.connectionName,r?.name||n||"Wire"),feasible:i,error:W(e.error,i?"":"No route found through the harness network."),distance:Number.isFinite(Number(e.distance))?Number(e.distance):null,polyline:(Array.isArray(e.polyline)?e.polyline:[]).map(s=>ri(s)).filter(Boolean),segmentIds:dn(e.segmentIds),nodePath:dn(e.nodePath),reusesHarnessPoint:!!e.reusesHarnessPoint,diameter:Math.max(.01,Rt(e.diameter,r?.diameter||1)),from:W(e.from,r?.from||""),to:W(e.to,r?.to||"")}}c(ii,"normalizeRouteResult");const Ze=class Ze{constructor(t){this.partHistory=t||null,this.connections=[],this.routeResults=[],this._pendingRestoredRouteResults=null,this._listeners=new Set}reset(){this.connections=[],this.routeResults=[],this._pendingRestoredRouteResults=null,this._emit()}getConnections(){return this._normalizeConnectionsArray(this.connections),this.connections}setConnections(t){const e=Array.isArray(t)?Array.from(t):[];return this.connections=e,this._normalizeConnectionsArray(this.connections),this._pendingRestoredRouteResults=null,this._emit(),this.connections}addConnection(t={}){const e=this.getConnections(),n=oe({id:t?.id||this._generateConnectionId(),...t},e.length);return e.push(n),this._emit(),n}updateConnection(t,e){const n=this.getConnections(),r=W(t,""),i=n.findIndex(f=>String(f?.id||"")===r);if(i<0)return null;const s=n[i];let u=s;if(typeof e=="function")try{const f=e(O(s));f&&typeof f=="object"&&(u=f)}catch{u=s}else e&&typeof e=="object"&&(u={...s,...e});return n[i]=oe(u,i),n[i].id||(n[i].id=s.id),this._emit(),n[i]}removeConnection(t){const e=this.getConnections(),n=W(t,""),r=e.findIndex(s=>String(s?.id||"")===n);if(r<0)return null;const[i]=e.splice(r,1);return this.routeResults=this.routeResults.filter(s=>String(s?.connectionId||"")!==n),this._normalizeConnectionsArray(e),this._emit(),i||null}getRouteResults(){return this._normalizeRouteResultsArray(this.routeResults),Array.isArray(this.routeResults)?this.routeResults:[]}setRouteResults(t,e={}){const n=!!e?.preservePendingRestore,r=!!e?.markPendingRestore;return this.routeResults=Array.isArray(t)?t.map(i=>({...i||{}})):[],this._normalizeRouteResultsArray(this.routeResults),r?this._pendingRestoredRouteResults=this.routeResults.map(i=>O(i)):n||(this._pendingRestoredRouteResults=null),this._emit(),this.routeResults}clearRouteResults(t={}){this.routeResults=[],t?.preservePendingRestore||(this._pendingRestoredRouteResults=null),this._emit()}getRouteResultMap(){const t=new Map;for(const e of this.getRouteResults()){const n=W(e?.connectionId,"");n&&t.set(n,e)}return t}addListener(t){return typeof t!="function"?()=>{}:(this._listeners.add(t),()=>{try{this._listeners.delete(t)}catch{}})}removeListener(t){if(typeof t=="function")try{this._listeners.delete(t)}catch{}}notifyChanged(){this._emit()}toSerializable(){return{connections:this.getConnections().map(t=>O(t)),routeResults:this.getRouteResults().map(t=>O(t))}}loadSerializable(t){const e=t&&typeof t=="object"&&!Array.isArray(t)?t:{connections:t,routeResults:[]};return this.connections=Array.isArray(e.connections)?Array.from(e.connections):[],this._normalizeConnectionsArray(this.connections),this.routeResults=Array.isArray(e.routeResults)?Array.from(e.routeResults):[],this._normalizeRouteResultsArray(this.routeResults),this._pendingRestoredRouteResults=this.routeResults.length?this.routeResults.map(n=>O(n)):null,this._emit(),this.toSerializable()}consumePendingRestoredRouteResults(){const t=Array.isArray(this._pendingRestoredRouteResults)?this._pendingRestoredRouteResults.map(e=>O(e)):null;return this._pendingRestoredRouteResults=null,t}_generateConnectionId(){const t=new Set(this.getConnections().map(n=>String(n?.id||"")));let e=1;for(;t.has(`wire-${e}`);)e+=1;return`wire-${e}`}_normalizeConnectionsArray(t){if(!Array.isArray(t))return this.connections=[],this.connections;for(let e=0;e<t.length;e+=1)t[e]=oe(t[e],e);return t}_normalizeRouteResultsArray(t){if(!Array.isArray(t))return this.routeResults=[],this.routeResults;const e=new Map(this.getConnections().map(n=>[String(n?.id||""),n]));for(let n=0;n<t.length;n+=1)t[n]=ii(t[n],e);return t}_emit(){if(!this._listeners||this._listeners.size===0)return;const t={connections:this.getConnections(),routeResults:this.getRouteResults(),manager:this,partHistory:this.partHistory||null};for(const e of Array.from(this._listeners))try{e(t)}catch{}}};c(Ze,"WireHarnessManager");let Ie=Ze;const si=new Set(["slider","number","select","string"]),zn=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function lt(o,t=null){const e=Number(o);return Number.isFinite(e)?e:t}c(lt,"toFiniteNumber");function Ce(o){const t=[],e=new Set;for(const n of o){const r=String(n??"").trim();!r||e.has(r)||(e.add(r),t.push(r))}return t}c(Ce,"uniqueStrings");function xe(){return{fields:[],values:{}}}c(xe,"createEmptyConfiguratorState");function Ci(o){return zn.test(String(o??"").trim())}c(Ci,"isConfiguratorFieldNameValid");function oi(o){const t=String(o??"").replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\s+/g," ").trim();return t?t.charAt(0).toUpperCase()+t.slice(1):"Field"}c(oi,"prettyConfiguratorLabel");function ai(o,t=0,e=new Set){let n=String(o??"").trim();n=n.replace(/\s+/g,"_").replace(/[^A-Za-z0-9_$]/g,"_").replace(/_+/g,"_"),n||(n=`field${t+1}`),/^[A-Za-z_$]/.test(n)||(n=`_${n}`),zn.test(n)||(n=`field${t+1}`);let r=n,i=2;for(;e.has(r);)r=`${n}_${i}`,i+=1;return e.add(r),r}c(ai,"normalizeConfiguratorFieldName");function ui(o){return Array.isArray(o)?Ce(o):typeof o!="string"?[]:Ce(o.split(/\r?\n|,/g))}c(ui,"parseConfiguratorOptions");function ci(o){const t=String(o??"").trim().toLowerCase();return t==="options"||t==="dropdown"?"select":si.has(t)?t:"number"}c(ci,"normalizeConfiguratorType");function ae(o,t){const e=String(o?.type??"").trim().toLowerCase();if(e==="slider"||e==="number"){let n=lt(t,lt(o?.defaultValue,0));const r=lt(o?.min,null),i=lt(o?.max,null);return Number.isFinite(r)&&(n=Math.max(r,n)),Number.isFinite(i)&&(n=Math.min(i,n)),n}if(e==="select"){const n=Array.isArray(o?.options)?Ce(o.options):[];if(!n.length)return"";const r=String(t??o?.defaultValue??n[0]??"");return n.includes(r)?r:n[0]}return String(t??o?.defaultValue??"")}c(ae,"normalizeConfiguratorValue");function ue(o){const t=xe(),e=Array.isArray(o?.fields)?o.fields:[],n=o?.values&&typeof o.values=="object"&&!Array.isArray(o.values)?o.values:{},r=new Set;for(let i=0;i<e.length;i+=1){const s=e[i]&&typeof e[i]=="object"?e[i]:{},u=ci(s.type),f=ai(s.name??s.key??s.fieldName,i,r),a={name:f,label:String(s.label??"").trim()||oi(f),type:u};if(u==="slider"||u==="number"){let l=lt(s.min,u==="slider"?0:null),y=lt(s.max,u==="slider"?100:null);if(Number.isFinite(l)&&Number.isFinite(y)&&l>y){const d=l;l=y,y=d}let b=lt(s.step,1);(!Number.isFinite(b)||b<=0)&&(b=1),a.min=l,a.max=y,a.step=b,a.defaultValue=ae(a,s.defaultValue??s.value)}else u==="select"?(a.options=ui(s.options),a.options.length||(a.options=["Option"]),a.defaultValue=ae(a,s.defaultValue??s.value)):a.defaultValue=String(s.defaultValue??s.value??"");const m=Object.prototype.hasOwnProperty.call(n,f)?n[f]:a.defaultValue;t.fields.push(a),t.values[f]=ae(a,m)}return t}c(ue,"normalizeConfiguratorState");const mn=!1,yn=new Set(["__open"]),Mn=`resolution = 32;
|
|
2
2
|
`,gn=`//Examples:
|
|
3
3
|
x = 10 + 6;
|
|
4
4
|
y = x * 2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var U=Object.defineProperty;var h=(t,e)=>U(t,"name",{value:e,configurable:!0});import{d as R,L as Y,e as H,bh as B,s as k,f as G,V as b,Q as I,u as Z,a2 as J,m as C,M as T,b as E}from"./featureDialogs-Chs09ZCV.js";const S=Object.freeze({lineColor:9684477,dotColor:9684477,arrowColor:9684477,arrowLengthPx:12,arrowWidthPx:4,leaderDotRadiusPx:6,noteDotRadius:.08,noteDotColor:9684477});let A={...S};function D(){return A}h(D,"getPMIStyle");function st(t={}){return!t||typeof t!="object"||(A={...A,...t}),A}h(st,"setPMIStyle");function at(t={}){const e={...S},n=h((i,s)=>{const r=t[i];if(Number.isFinite(r))e[i]=r;else if(typeof r=="string"&&i.toLowerCase().includes("color")){const f=parseInt(r.replace("#",""),16);Number.isFinite(f)&&(e[i]=f)}else r!=null&&(e[i]=s)},"assign");return n("lineColor",S.lineColor),n("dotColor",S.dotColor),n("arrowColor",S.arrowColor),n("arrowLengthPx",S.arrowLengthPx),n("arrowWidthPx",S.arrowWidthPx),n("leaderDotRadiusPx",S.leaderDotRadiusPx),n("lineWidth",S.lineWidth||1),n("noteDotRadius",S.noteDotRadius),n("noteDotColor",S.noteDotColor),e}h(at,"sanitizePMIStyle");function q(t){try{return JSON.parse(JSON.stringify(t))}catch{return{}}}h(q,"safeCloneJSON");function X(t){return t?t.isPerspectiveCamera?"PerspectiveCamera":t.isOrthographicCamera?"OrthographicCamera":"Camera":"Camera"}h(X,"resolveCameraType");function W(t){if(!t)return null;if(Array.isArray(t)&&t.length===3)return[Number(t[0])||0,Number(t[1])||0,Number(t[2])||0];if(typeof t=="object"){const{x:e,y:n,z:i}=t;if([e,n,i].every(s=>Number.isFinite(s)))return[e,n,i]}return null}h(W,"extractVector3");function _(t){if(!t||typeof t!="object")return null;const e=Number(t.width),n=Number(t.height);return!(e>0)||!(n>0)?null:{width:e,height:n}}h(_,"normalizeViewportMetrics");function Q(t,e,n,i,s){if(!e)return;const r=i?.controlsState;if(r&&typeof e.setStateFromJSON=="function"){const x=Array.isArray(r.target)?r.target:n,o={arcballState:{target:Array.isArray(x)?x:[t.target?.x||0,t.target?.y||0,t.target?.z||0],cameraMatrix:{elements:Array.isArray(r.cameraMatrix)&&r.cameraMatrix.length===16?r.cameraMatrix:Array.from(t.matrix.elements)},cameraUp:r.cameraUp||{x:t.up.x,y:t.up.y,z:t.up.z},cameraNear:Number.isFinite(r.cameraNear)?r.cameraNear:t.near,cameraFar:Number.isFinite(r.cameraFar)?r.cameraFar:t.far,cameraZoom:Number.isFinite(r.cameraZoom)?r.cameraZoom:t.zoom,gizmoMatrix:{elements:Array.isArray(r.gizmoMatrix)&&r.gizmoMatrix.length===16?r.gizmoMatrix:Array.from((e._gizmos?.matrix||new T).elements)}}},l=Number.isFinite(r.cameraFov)?r.cameraFov:i?.projection?.fov;t.isPerspectiveCamera&&Number.isFinite(l)&&(o.arcballState.cameraFov=l);try{e.setStateFromJSON(JSON.stringify(o))}catch(g){console.warn("ArcballControls setStateFromJSON failed; falling back to manual sync",g),L(t,e,n,i),O(e,s);return}O(e,s);return}L(t,e,n,i),O(e,s)}h(Q,"syncArcballControls");function L(t,e,n,i){const s=Array.isArray(n)&&n.length===3?n:e.target?[e.target.x,e.target.y,e.target.z]:[0,0,0],r=new b(s[0],s[1],s[2]);try{typeof e.setTarget=="function"?e.setTarget(r.x,r.y,r.z):e.target?.set?e.target.set(r.x,r.y,r.z):e.target&&(e.target.x=r.x,e.target.y=r.y,e.target.z=r.z)}catch{}try{e._currentTarget?.copy&&e._currentTarget.copy(r),e._target0?.copy&&e._target0.copy(r)}catch{}const f=e._gizmos;if(f){try{f.position.copy(r),f.updateMatrix(),f.updateMatrixWorld(!0)}catch{}if(typeof e.calculateTbRadius=="function")try{e._tbRadius=e.calculateTbRadius(t)}catch{}if(typeof e.makeGizmos=="function")try{e.makeGizmos(r,e._tbRadius||1)}catch{}}try{e._cameraMatrixState?.copy?.(t.matrix),e._cameraMatrixState0?.copy?.(t.matrix),f?.matrix&&(e._gizmoMatrixState?.copy?.(f.matrix),e._gizmoMatrixState0?.copy?.(f.matrix)),e._cameraProjectionState?.copy?.(t.projectionMatrix),typeof e._zoomState=="number"&&(e._zoomState=t.zoom),typeof e._zoom0=="number"&&(e._zoom0=t.zoom),typeof e._fovState=="number"&&Number.isFinite(i?.projection?.fov??t.fov)&&(e._fovState=i?.projection?.fov??t.fov),typeof e._fov0=="number"&&Number.isFinite(i?.projection?.fov??t.fov)&&(e._fov0=i?.projection?.fov??t.fov),typeof e._nearPos=="number"&&(e._nearPos=Number.isFinite(i?.near)?i.near:t.near),typeof e._farPos=="number"&&(e._farPos=Number.isFinite(i?.far)?i.far:t.far),e._up0?.copy?.(t.up)}catch{}try{typeof e.updateTbState=="function"&&e.STATE?.IDLE?e.updateTbState(e.STATE.IDLE,!1):"_state"in e&&e.STATE?.IDLE&&(e._state=e.STATE.IDLE)}catch{}}h(L,"manualArcballSync");function O(t,e){try{if(typeof t._animationId=="number"&&t._animationId!==-1){const n=typeof cancelAnimationFrame=="function"?cancelAnimationFrame:typeof window<"u"&&typeof window.cancelAnimationFrame=="function"?window.cancelAnimationFrame.bind(window):null;n&&n(t._animationId)}t._animationId=-1,typeof t._timeStart=="number"&&(t._timeStart=-1)}catch{}try{t.updateMatrixState?.()}catch{}if(e)try{t.update?.()}catch{}}h(O,"finalizeArcballSync");function K(t){if(!t)return null;if(t.isPerspectiveCamera){const e=t.view&&t.view.enabled?{enabled:!0,fullWidth:t.view.fullWidth,fullHeight:t.view.fullHeight,offsetX:t.view.offsetX,offsetY:t.view.offsetY,width:t.view.width,height:t.view.height}:{enabled:!1};return{kind:"perspective",aspect:Number.isFinite(t.aspect)&&t.aspect>0?t.aspect:void 0,fov:t.fov,near:t.near,far:t.far,zoom:t.zoom??1,filmGauge:t.filmGauge??35,filmOffset:t.filmOffset??0,view:e}}if(t.isOrthographicCamera){const e=t.view&&t.view.enabled?{enabled:!0,fullWidth:t.view.fullWidth,fullHeight:t.view.fullHeight,offsetX:t.view.offsetX,offsetY:t.view.offsetY,width:t.view.width,height:t.view.height}:{enabled:!1};return{kind:"orthographic",aspect:Number.isFinite(t.top-t.bottom)&&Math.abs(t.top-t.bottom)>1e-9?(t.right-t.left)/(t.top-t.bottom):void 0,left:t.left,right:t.right,top:t.top,bottom:t.bottom,near:t.near,far:t.far,zoom:t.zoom??1,view:e}}return{kind:"generic",near:t.near??.1,far:t.far??2e3}}h(K,"captureProjection");function $(t,e=null,n=null,i=null){try{if(!t?.isPerspectiveCamera)return;const s=_(n);if(!s)return;const r=s.width/s.height;if(!(r>1e-9))return;t.aspect=r;const f=_(i),x=f?f.width/f.height:Number.isFinite(e?.aspect)&&e.aspect>1e-9?e.aspect:null;if(!(x>1e-9)||r>=x)return;const o=Number.isFinite(e?.fov)?e.fov:t.fov,l=Number.isFinite(e?.zoom)&&e.zoom>0?e.zoom:Number.isFinite(t.zoom)&&t.zoom>0?t.zoom:1;if(!(o>0)||o>=179)return;const m=Math.tan(E.degToRad(o)*.5)/l*x/r;if(!(m>0))return;const w=E.radToDeg(2*Math.atan(m*l));Number.isFinite(w)&&w>o&&(t.fov=Math.min(179,w))}catch{}}h($,"fitPerspectiveProjection");function j(t,e,n=null){if(!(!t||!e)){if(t.isPerspectiveCamera&&e.kind==="perspective"){Number.isFinite(e.fov)&&(t.fov=e.fov),Number.isFinite(e.near)&&(t.near=e.near),Number.isFinite(e.far)&&(t.far=e.far),Number.isFinite(e.zoom)&&(t.zoom=e.zoom),Number.isFinite(e.filmGauge)&&(t.filmGauge=e.filmGauge),Number.isFinite(e.filmOffset)&&(t.filmOffset=e.filmOffset),n!=null&&Number.isFinite(n)&&(t.aspect=n),e.view&&e.view.enabled&&t.setViewOffset?t.setViewOffset(e.view.fullWidth,e.view.fullHeight,e.view.offsetX,e.view.offsetY,e.view.width,e.view.height):t.clearViewOffset&&t.clearViewOffset();return}if(t.isOrthographicCamera&&e.kind==="orthographic"){const i=["left","right","top","bottom","near","far","zoom"];for(const s of i)Number.isFinite(e[s])&&(t[s]=e[s]);e.view&&e.view.enabled&&t.setViewOffset?t.setViewOffset(e.view.fullWidth,e.view.fullHeight,e.view.offsetX,e.view.offsetY,e.view.width,e.view.height):t.clearViewOffset&&t.clearViewOffset();return}Number.isFinite(e.near)&&(t.near=e.near),Number.isFinite(e.far)&&(t.far=e.far),Number.isFinite(e.zoom)&&(t.zoom=e.zoom)}}h(j,"applyProjection");function ft(t,{controls:e=null,viewport:n=null}={}){if(!t||!t.isCamera)return null;try{t.updateMatrixWorld(!0)}catch{}const i={version:3,type:X(t),worldMatrix:t.matrixWorld?.toArray?.()??null,projection:K(t),position:{x:t.position.x,y:t.position.y,z:t.position.z},quaternion:{x:t.quaternion.x,y:t.quaternion.y,z:t.quaternion.z,w:t.quaternion.w},up:{x:t.up.x,y:t.up.y,z:t.up.z},zoom:Number.isFinite(t.zoom)?t.zoom:1,near:Number.isFinite(t.near)?t.near:void 0,far:Number.isFinite(t.far)?t.far:void 0};if(t.layers?.mask!==void 0&&(i.layers=t.layers.mask),e?.target&&typeof e.target=="object"){i.target={x:e.target.x,y:e.target.y,z:e.target.z};try{const r=e._gizmos?.matrix;r&&(i.controlsState={target:[e.target.x,e.target.y,e.target.z],cameraMatrix:Array.from(t.matrix.elements),cameraUp:{x:t.up.x,y:t.up.y,z:t.up.z},cameraNear:t.near,cameraFar:t.far,cameraZoom:t.zoom,cameraFov:t.isPerspectiveCamera?t.fov:void 0,gizmoMatrix:Array.from(r.elements)})}catch{}}!i.target&&t.target&&typeof t.target=="object"&&(i.target={x:t.target.x,y:t.target.y,z:t.target.z}),t.userData&&typeof t.userData=="object"&&(i.userData=q(t.userData));const s=_(n);return s&&(i.viewport=s),i}h(ft,"captureCameraSnapshot");function ut(t,e,{controls:n=null,respectParent:i=!0,strictType:s=!1,overrideAspect:r=null,syncControls:f=!0,viewport:x=null}={}){if(!t||!t.isCamera||!e)return!1;let o=e;if(typeof o=="string")try{o=JSON.parse(o)}catch{return!1}if(!o||typeof o!="object")return!1;const l=o.type||null;if(s&&l){const p=X(t);if(l!==p)return!1}try{j(t,o.projection,r)}catch{}$(t,o?.projection,x,o?.viewport||null),tt(t,o?.projection,x),typeof o.layers=="number"&&t.layers&&(t.layers.mask=o.layers);const g=W(o.up)||W(o.upVector);g&&t.up.set(g[0],g[1],g[2]),o.userData&&typeof o.userData=="object"&&(t.userData=q(o.userData));let u=!1,m=!1;const w=Array.isArray(o.worldMatrix)&&o.worldMatrix.length===16?o.worldMatrix:null;if(w)try{const p=new T().fromArray(w),F=t.parent||null,M=new b,a=new I,d=new b;if(i&&F){F.updateMatrixWorld?.(!0);const z=new T().copy(F.matrixWorld).invert();new T().multiplyMatrices(z,p).decompose(M,a,d)}else p.decompose(M,a,d);const y=t.matrixAutoUpdate;t.matrixAutoUpdate=!1,t.position.copy(M),t.quaternion.copy(a),t.scale.copy(d),t.updateMatrix(),t.updateMatrixWorld(!0),t.matrixAutoUpdate=y,u=!0,m=!0}catch{u=!1}if(!u){const p=W(o.position);let F=!1;p&&(t.position.set(p[0],p[1],p[2]),F=!0);const M=o.quaternion;if(M&&typeof M=="object"){const{x:a,y:d,z:y,w:z}=M;[a,d,y,z].every(N=>Number.isFinite(N))&&(t.quaternion.set(a,d,y,z),F=!0)}Number.isFinite(o.zoom)&&(t.zoom=o.zoom,F=!0),Number.isFinite(o.near)&&(t.near=o.near,F=!0),Number.isFinite(o.far)&&(t.far=o.far,F=!0),F&&(t.updateMatrixWorld?.(!0),m=!0)}if(!m){try{t.updateProjectionMatrix?.()}catch{}if(n){try{n.update?.()}catch{}try{n.updateMatrixState?.()}catch{}}return!1}try{t.updateProjectionMatrix?.()}catch{}const v=o.target||o.controlsTarget,c=W(v);return n?Q(t,n,c,o,f):c&&t.target&&typeof t.target.set=="function"&&t.target.set(c[0],c[1],c[2]),!0}h(ut,"applyCameraSnapshot");function tt(t,e=null,n=null){try{if(!t?.isOrthographicCamera)return;const i=e||{},s=Number.isFinite(i.top)?i.top:t.top,r=Number.isFinite(i.bottom)?i.bottom:t.bottom,f=Number.isFinite(i.left)?i.left:t.left,x=Number.isFinite(i.right)?i.right:t.right,o=Number.isFinite(s)&&Number.isFinite(r)?s-r:t.top-t.bottom,l=Number.isFinite(f)&&Number.isFinite(x)?x-f:t.right-t.left;if(!Number.isFinite(o)||Math.abs(o)<1e-9||!Number.isFinite(l)||Math.abs(l)<1e-9)return;const g=Number.isFinite(s)&&Number.isFinite(r)?(s+r)*.5:(t.top+t.bottom)*.5,u=Number.isFinite(f)&&Number.isFinite(x)?(f+x)*.5:(t.left+t.right)*.5,m=_(n);let w=m?m.width/m.height:null;w>1e-9||(w=Number.isFinite(i.aspect)&&i.aspect>1e-9?i.aspect:l/o),(!Number.isFinite(w)||w<=1e-9)&&(w=1);const v=Math.abs(o)*.5,c=Math.abs(l)*.5,p=Math.max(c,v*w),F=Math.max(v,c/w),M=o>=0?1:-1;t.top=g+F*M,t.bottom=g-F*M,t.left=u-p,t.right=u+p,t.updateProjectionMatrix()}catch{}}h(tt,"adjustOrthographicFrustum");function V(t,e,n=void 0){const i=D(),s=n??i.lineColor??9684477,r=new R().setFromPoints([t.clone(),e.clone()]),f=new Y({color:s,linewidth:i.lineWidth||1});return f.depthTest=!1,f.depthWrite=!1,f.transparent=!0,new H(r,f)}h(V,"makeOverlayLine");function lt(t,e,n=void 0,i={}){const s=D(),{viewer:r=null,dashPixels:f=10,gapPixels:x=10}=i||{},o=t.distanceTo(e);if(!(o>1e-6))return V(t,e,n??s.lineColor??9684477);const l=e.clone().sub(t).normalize(),g=t.clone().add(e).multiplyScalar(.5),u=et(r,g),m=it(u*f,o),w=nt(u*x,o),v=[];let c=0,p=t.clone();for(;c<o-1e-6;){const d=Math.min(m,o-c),y=p.clone().addScaledVector(l,d);if(v.push(p.clone(),y.clone()),c+=d,c>=o)break;const z=Math.min(w,o-c);p=y.clone().addScaledVector(l,z),c+=z}if(v.length<2)return V(t,e,n??s.lineColor??9684477);const F=new R().setFromPoints(v),M=new Y({color:n??s.lineColor??9684477,linewidth:s.lineWidth||1});M.depthTest=!1,M.depthWrite=!1,M.transparent=!0;const a=new J(F,M);return a.renderOrder=9994,a}h(lt,"makeOverlayDashedLine");function et(t,e){try{const n=t?.camera,i=t?.renderer;if(!n||!i)return .01;const s=i.domElement,r=Math.max(1,s?.clientHeight||s?.height||600);if(n.isOrthographicCamera)return(n.top-n.bottom)/Math.max(1e-6,n.zoom||1)/r;const f=n.getWorldPosition(new b),x=e?e.clone():n.getWorldDirection(new b).add(f),o=f.distanceTo(x),l=(n.fov||50)*Math.PI/180;return 2*Math.tan(l/2)*o/r}catch{return .01}}h(et,"worldUnitsPerPixelAtPoint");function it(t,e){if(!Number.isFinite(t)||t<=0)return e*.25;const n=Math.max(1e-4,e*.5);return Math.max(1e-4,Math.min(t,n))}h(it,"clampDashLength");function nt(t,e){if(!Number.isFinite(t)||t<0)return e*.25;const n=Math.max(1e-4,e*.5);return Math.max(1e-4,Math.min(t,n))}h(nt,"clampGapLength");function dt(t,e=void 0){const n=D(),i=e??n.dotColor??16777215,s=new Z(t,12,8),r=new k({color:i});return r.depthTest=!1,r.depthWrite=!1,r.transparent=!0,new G(s,r)}h(dt,"makeOverlaySphere");function pt(t,e,n,i,s,r){try{const f=D(),x=new B(s,i,8),o=new k({color:r??f.arrowColor??9684477,depthTest:!1,depthWrite:!1,transparent:!0}),l=new G(x,o),g=e.clone().addScaledVector(n,-i*.5);l.position.copy(g);const u=new b(0,1,0),m=new I;return m.setFromUnitVectors(u,n.clone().normalize()),l.setRotationFromQuaternion(m),l.renderOrder=9996,t.add(l),l}catch{return null}}h(pt,"addArrowCone");function gt(t,e=1){try{const n=t?.renderer?.domElement?.getBoundingClientRect?.()||{width:800,height:600},i=t?.camera,s=Math.max(1,n.height||600);if(i&&i.isOrthographicCamera){const f=(i.top-i.bottom)/Math.max(1e-6,i.zoom||1)/s;return Math.max(1e-4,f*(e||1))}if(i&&i.isPerspectiveCamera){const r=(i.fov||50)*Math.PI/180,f=i.position.length(),o=2*Math.tan(r/2)*f/s;return Math.max(1e-4,o*(e||1))}return .01*(e||1)}catch{return .01*(e||1)}}h(gt,"screenSizeWorld");function ht(t,e){try{if(!e)return null;const n=e.userData||{},i=String(e.type||"").toUpperCase(),s=String(n.type||n.brepType||"").toUpperCase(),f=i==="FACE"||i==="PLANE"||!(i==="FACE"||i==="EDGE"||i==="PLANE")&&(s==="FACE"||s==="PLANE"),x=i==="EDGE"||!f&&(s==="EDGE"||e.isLine||e.isLine2||e.isLineSegments||e.isLineLoop);if(f){if(typeof e.getAverageNormal=="function"){const u=e.getAverageNormal();e.updateMatrixWorld(!0);const m=new C().getNormalMatrix(e.matrixWorld);return u.applyMatrix3(m).normalize()}const o=e.geometry;if(o){if(o.attributes&&o.attributes.normal){const u=o.attributes.normal.array;if(u.length>=3){const m=new b,w=u.length/3;for(let c=0;c<w;c++){const p=c*3;m.add(new b(u[p],u[p+1],u[p+2]))}m.divideScalar(w),e.updateMatrixWorld(!0);const v=new C().getNormalMatrix(e.matrixWorld);return m.applyMatrix3(v).normalize()}}if(o.attributes&&o.attributes.position){const u=o.attributes.position.array;if(u.length>=9){const m=new b;let w=0;const v=new b,c=new b,p=new b;e.updateMatrixWorld(!0);const F=Math.min(5,Math.floor(u.length/9));for(let M=0;M<F;M++){const a=M*9;if(a+8<u.length){v.set(u[a],u[a+1],u[a+2]).applyMatrix4(e.matrixWorld),c.set(u[a+3],u[a+4],u[a+5]).applyMatrix4(e.matrixWorld),p.set(u[a+6],u[a+7],u[a+8]).applyMatrix4(e.matrixWorld);const d=c.clone().sub(v).cross(p.clone().sub(v));d.lengthSq()>1e-10&&(d.normalize(),m.add(d),w++)}}if(w>0)return m.divideScalar(w).normalize()}}}const l=new b(0,0,1);e.updateMatrixWorld(!0);const g=new C().getNormalMatrix(e.matrixWorld);return l.applyMatrix3(g).normalize()}else if(x){const l=e.geometry;e.updateMatrixWorld(!0);const g=e.matrixWorld,u=h((a,d=!1)=>{if(!a)return null;let y=null;if(Array.isArray(a)&&a.length>=3)y=new b(a[0],a[1],a[2]);else if(typeof a=="object"){const z=Number(a.x),N=Number(a.y),P=Number(a.z);Number.isFinite(z)&&Number.isFinite(N)&&Number.isFinite(P)&&(y=new b(z,N,P))}return y?(d&&g&&y.applyMatrix4(g),y):null},"parsePoint"),m=h((a,d=!1)=>{if(!Array.isArray(a)||a.length<2)return null;let y=u(a[0],d);for(let z=1;z<a.length;z++){const N=u(a[z],d);if(!y||!N){y=N||y;continue}const P=N.clone().sub(y);if(P.lengthSq()>1e-12)return P.normalize();y=N}return null},"directionFromPointList");try{if(typeof e.points=="function"){const a=e.points(!0),d=m(a,!1);if(d)return d}}catch{}const w=Array.isArray(e?.userData?.polylineLocal)?e.userData.polylineLocal:null;if(w){const a=m(w,!0);if(a)return a}const v=l?.attributes?.instanceStart,c=l?.attributes?.instanceEnd;if(v&&c){const a=Math.min(v.count||0,c.count||0);for(let d=0;d<a;d++){const y=new b(v.getX(d),v.getY(d),v.getZ(d)),z=new b(c.getX(d),c.getY(d),c.getZ(d));g&&(y.applyMatrix4(g),z.applyMatrix4(g));const N=z.sub(y);if(N.lengthSq()>1e-12)return N.normalize()}}const p=l?.getAttribute?.("position");if(p&&p.itemSize===3&&p.count>=2){const a=new b,d=new b;a.set(p.getX(0),p.getY(0),p.getZ(0)),g&&a.applyMatrix4(g);for(let y=1;y<p.count;y++){d.set(p.getX(y),p.getY(y),p.getZ(y)),g&&d.applyMatrix4(g);const z=d.clone().sub(a);if(z.lengthSq()>1e-12)return z.normalize();a.copy(d)}}const F=new b(1,0,0),M=new C().getNormalMatrix(e.matrixWorld);return F.applyMatrix3(M).normalize()}return null}catch{return null}}h(ht,"getElementDirection");function ct(t,e){try{if(!e)return null;const n=e.geometry;if(n){if(typeof e.getWorldPosition=="function"){const s=n.attributes&&n.attributes.position?n.attributes.position.array:null;if(s&&s.length>=3){let r=0,f=0,x=0,o=0;const l=new b;e.updateMatrixWorld(!0);for(let g=0;g<s.length;g+=3)l.set(s[g],s[g+1],s[g+2]).applyMatrix4(e.matrixWorld),r+=l.x,f+=l.y,x+=l.z,o++;if(o>0)return new b(r/o,f/o,x/o)}}n.computeBoundingBox?.();const i=n.boundingBox;if(i)return i.getCenter(new b).applyMatrix4(e.matrixWorld)}return e.getWorldPosition(new b)}catch{return null}}h(ct,"objectRepresentativePoint");export{at as a,gt as b,ht as c,pt as d,ft as e,ut as f,D as g,tt as h,V as i,lt as j,dt as m,ct as o,st as s};
|
|
1
|
+
var U=Object.defineProperty;var h=(t,e)=>U(t,"name",{value:e,configurable:!0});import{d as R,L as Y,e as H,bh as B,s as k,f as G,V as b,Q as I,u as Z,a2 as J,m as C,M as T,b as E}from"./featureDialogs-DkPbRjYq.js";const S=Object.freeze({lineColor:9684477,dotColor:9684477,arrowColor:9684477,arrowLengthPx:12,arrowWidthPx:4,leaderDotRadiusPx:6,noteDotRadius:.08,noteDotColor:9684477});let A={...S};function D(){return A}h(D,"getPMIStyle");function st(t={}){return!t||typeof t!="object"||(A={...A,...t}),A}h(st,"setPMIStyle");function at(t={}){const e={...S},n=h((i,s)=>{const r=t[i];if(Number.isFinite(r))e[i]=r;else if(typeof r=="string"&&i.toLowerCase().includes("color")){const f=parseInt(r.replace("#",""),16);Number.isFinite(f)&&(e[i]=f)}else r!=null&&(e[i]=s)},"assign");return n("lineColor",S.lineColor),n("dotColor",S.dotColor),n("arrowColor",S.arrowColor),n("arrowLengthPx",S.arrowLengthPx),n("arrowWidthPx",S.arrowWidthPx),n("leaderDotRadiusPx",S.leaderDotRadiusPx),n("lineWidth",S.lineWidth||1),n("noteDotRadius",S.noteDotRadius),n("noteDotColor",S.noteDotColor),e}h(at,"sanitizePMIStyle");function q(t){try{return JSON.parse(JSON.stringify(t))}catch{return{}}}h(q,"safeCloneJSON");function X(t){return t?t.isPerspectiveCamera?"PerspectiveCamera":t.isOrthographicCamera?"OrthographicCamera":"Camera":"Camera"}h(X,"resolveCameraType");function W(t){if(!t)return null;if(Array.isArray(t)&&t.length===3)return[Number(t[0])||0,Number(t[1])||0,Number(t[2])||0];if(typeof t=="object"){const{x:e,y:n,z:i}=t;if([e,n,i].every(s=>Number.isFinite(s)))return[e,n,i]}return null}h(W,"extractVector3");function _(t){if(!t||typeof t!="object")return null;const e=Number(t.width),n=Number(t.height);return!(e>0)||!(n>0)?null:{width:e,height:n}}h(_,"normalizeViewportMetrics");function Q(t,e,n,i,s){if(!e)return;const r=i?.controlsState;if(r&&typeof e.setStateFromJSON=="function"){const x=Array.isArray(r.target)?r.target:n,o={arcballState:{target:Array.isArray(x)?x:[t.target?.x||0,t.target?.y||0,t.target?.z||0],cameraMatrix:{elements:Array.isArray(r.cameraMatrix)&&r.cameraMatrix.length===16?r.cameraMatrix:Array.from(t.matrix.elements)},cameraUp:r.cameraUp||{x:t.up.x,y:t.up.y,z:t.up.z},cameraNear:Number.isFinite(r.cameraNear)?r.cameraNear:t.near,cameraFar:Number.isFinite(r.cameraFar)?r.cameraFar:t.far,cameraZoom:Number.isFinite(r.cameraZoom)?r.cameraZoom:t.zoom,gizmoMatrix:{elements:Array.isArray(r.gizmoMatrix)&&r.gizmoMatrix.length===16?r.gizmoMatrix:Array.from((e._gizmos?.matrix||new T).elements)}}},l=Number.isFinite(r.cameraFov)?r.cameraFov:i?.projection?.fov;t.isPerspectiveCamera&&Number.isFinite(l)&&(o.arcballState.cameraFov=l);try{e.setStateFromJSON(JSON.stringify(o))}catch(g){console.warn("ArcballControls setStateFromJSON failed; falling back to manual sync",g),L(t,e,n,i),O(e,s);return}O(e,s);return}L(t,e,n,i),O(e,s)}h(Q,"syncArcballControls");function L(t,e,n,i){const s=Array.isArray(n)&&n.length===3?n:e.target?[e.target.x,e.target.y,e.target.z]:[0,0,0],r=new b(s[0],s[1],s[2]);try{typeof e.setTarget=="function"?e.setTarget(r.x,r.y,r.z):e.target?.set?e.target.set(r.x,r.y,r.z):e.target&&(e.target.x=r.x,e.target.y=r.y,e.target.z=r.z)}catch{}try{e._currentTarget?.copy&&e._currentTarget.copy(r),e._target0?.copy&&e._target0.copy(r)}catch{}const f=e._gizmos;if(f){try{f.position.copy(r),f.updateMatrix(),f.updateMatrixWorld(!0)}catch{}if(typeof e.calculateTbRadius=="function")try{e._tbRadius=e.calculateTbRadius(t)}catch{}if(typeof e.makeGizmos=="function")try{e.makeGizmos(r,e._tbRadius||1)}catch{}}try{e._cameraMatrixState?.copy?.(t.matrix),e._cameraMatrixState0?.copy?.(t.matrix),f?.matrix&&(e._gizmoMatrixState?.copy?.(f.matrix),e._gizmoMatrixState0?.copy?.(f.matrix)),e._cameraProjectionState?.copy?.(t.projectionMatrix),typeof e._zoomState=="number"&&(e._zoomState=t.zoom),typeof e._zoom0=="number"&&(e._zoom0=t.zoom),typeof e._fovState=="number"&&Number.isFinite(i?.projection?.fov??t.fov)&&(e._fovState=i?.projection?.fov??t.fov),typeof e._fov0=="number"&&Number.isFinite(i?.projection?.fov??t.fov)&&(e._fov0=i?.projection?.fov??t.fov),typeof e._nearPos=="number"&&(e._nearPos=Number.isFinite(i?.near)?i.near:t.near),typeof e._farPos=="number"&&(e._farPos=Number.isFinite(i?.far)?i.far:t.far),e._up0?.copy?.(t.up)}catch{}try{typeof e.updateTbState=="function"&&e.STATE?.IDLE?e.updateTbState(e.STATE.IDLE,!1):"_state"in e&&e.STATE?.IDLE&&(e._state=e.STATE.IDLE)}catch{}}h(L,"manualArcballSync");function O(t,e){try{if(typeof t._animationId=="number"&&t._animationId!==-1){const n=typeof cancelAnimationFrame=="function"?cancelAnimationFrame:typeof window<"u"&&typeof window.cancelAnimationFrame=="function"?window.cancelAnimationFrame.bind(window):null;n&&n(t._animationId)}t._animationId=-1,typeof t._timeStart=="number"&&(t._timeStart=-1)}catch{}try{t.updateMatrixState?.()}catch{}if(e)try{t.update?.()}catch{}}h(O,"finalizeArcballSync");function K(t){if(!t)return null;if(t.isPerspectiveCamera){const e=t.view&&t.view.enabled?{enabled:!0,fullWidth:t.view.fullWidth,fullHeight:t.view.fullHeight,offsetX:t.view.offsetX,offsetY:t.view.offsetY,width:t.view.width,height:t.view.height}:{enabled:!1};return{kind:"perspective",aspect:Number.isFinite(t.aspect)&&t.aspect>0?t.aspect:void 0,fov:t.fov,near:t.near,far:t.far,zoom:t.zoom??1,filmGauge:t.filmGauge??35,filmOffset:t.filmOffset??0,view:e}}if(t.isOrthographicCamera){const e=t.view&&t.view.enabled?{enabled:!0,fullWidth:t.view.fullWidth,fullHeight:t.view.fullHeight,offsetX:t.view.offsetX,offsetY:t.view.offsetY,width:t.view.width,height:t.view.height}:{enabled:!1};return{kind:"orthographic",aspect:Number.isFinite(t.top-t.bottom)&&Math.abs(t.top-t.bottom)>1e-9?(t.right-t.left)/(t.top-t.bottom):void 0,left:t.left,right:t.right,top:t.top,bottom:t.bottom,near:t.near,far:t.far,zoom:t.zoom??1,view:e}}return{kind:"generic",near:t.near??.1,far:t.far??2e3}}h(K,"captureProjection");function $(t,e=null,n=null,i=null){try{if(!t?.isPerspectiveCamera)return;const s=_(n);if(!s)return;const r=s.width/s.height;if(!(r>1e-9))return;t.aspect=r;const f=_(i),x=f?f.width/f.height:Number.isFinite(e?.aspect)&&e.aspect>1e-9?e.aspect:null;if(!(x>1e-9)||r>=x)return;const o=Number.isFinite(e?.fov)?e.fov:t.fov,l=Number.isFinite(e?.zoom)&&e.zoom>0?e.zoom:Number.isFinite(t.zoom)&&t.zoom>0?t.zoom:1;if(!(o>0)||o>=179)return;const m=Math.tan(E.degToRad(o)*.5)/l*x/r;if(!(m>0))return;const w=E.radToDeg(2*Math.atan(m*l));Number.isFinite(w)&&w>o&&(t.fov=Math.min(179,w))}catch{}}h($,"fitPerspectiveProjection");function j(t,e,n=null){if(!(!t||!e)){if(t.isPerspectiveCamera&&e.kind==="perspective"){Number.isFinite(e.fov)&&(t.fov=e.fov),Number.isFinite(e.near)&&(t.near=e.near),Number.isFinite(e.far)&&(t.far=e.far),Number.isFinite(e.zoom)&&(t.zoom=e.zoom),Number.isFinite(e.filmGauge)&&(t.filmGauge=e.filmGauge),Number.isFinite(e.filmOffset)&&(t.filmOffset=e.filmOffset),n!=null&&Number.isFinite(n)&&(t.aspect=n),e.view&&e.view.enabled&&t.setViewOffset?t.setViewOffset(e.view.fullWidth,e.view.fullHeight,e.view.offsetX,e.view.offsetY,e.view.width,e.view.height):t.clearViewOffset&&t.clearViewOffset();return}if(t.isOrthographicCamera&&e.kind==="orthographic"){const i=["left","right","top","bottom","near","far","zoom"];for(const s of i)Number.isFinite(e[s])&&(t[s]=e[s]);e.view&&e.view.enabled&&t.setViewOffset?t.setViewOffset(e.view.fullWidth,e.view.fullHeight,e.view.offsetX,e.view.offsetY,e.view.width,e.view.height):t.clearViewOffset&&t.clearViewOffset();return}Number.isFinite(e.near)&&(t.near=e.near),Number.isFinite(e.far)&&(t.far=e.far),Number.isFinite(e.zoom)&&(t.zoom=e.zoom)}}h(j,"applyProjection");function ft(t,{controls:e=null,viewport:n=null}={}){if(!t||!t.isCamera)return null;try{t.updateMatrixWorld(!0)}catch{}const i={version:3,type:X(t),worldMatrix:t.matrixWorld?.toArray?.()??null,projection:K(t),position:{x:t.position.x,y:t.position.y,z:t.position.z},quaternion:{x:t.quaternion.x,y:t.quaternion.y,z:t.quaternion.z,w:t.quaternion.w},up:{x:t.up.x,y:t.up.y,z:t.up.z},zoom:Number.isFinite(t.zoom)?t.zoom:1,near:Number.isFinite(t.near)?t.near:void 0,far:Number.isFinite(t.far)?t.far:void 0};if(t.layers?.mask!==void 0&&(i.layers=t.layers.mask),e?.target&&typeof e.target=="object"){i.target={x:e.target.x,y:e.target.y,z:e.target.z};try{const r=e._gizmos?.matrix;r&&(i.controlsState={target:[e.target.x,e.target.y,e.target.z],cameraMatrix:Array.from(t.matrix.elements),cameraUp:{x:t.up.x,y:t.up.y,z:t.up.z},cameraNear:t.near,cameraFar:t.far,cameraZoom:t.zoom,cameraFov:t.isPerspectiveCamera?t.fov:void 0,gizmoMatrix:Array.from(r.elements)})}catch{}}!i.target&&t.target&&typeof t.target=="object"&&(i.target={x:t.target.x,y:t.target.y,z:t.target.z}),t.userData&&typeof t.userData=="object"&&(i.userData=q(t.userData));const s=_(n);return s&&(i.viewport=s),i}h(ft,"captureCameraSnapshot");function ut(t,e,{controls:n=null,respectParent:i=!0,strictType:s=!1,overrideAspect:r=null,syncControls:f=!0,viewport:x=null}={}){if(!t||!t.isCamera||!e)return!1;let o=e;if(typeof o=="string")try{o=JSON.parse(o)}catch{return!1}if(!o||typeof o!="object")return!1;const l=o.type||null;if(s&&l){const p=X(t);if(l!==p)return!1}try{j(t,o.projection,r)}catch{}$(t,o?.projection,x,o?.viewport||null),tt(t,o?.projection,x),typeof o.layers=="number"&&t.layers&&(t.layers.mask=o.layers);const g=W(o.up)||W(o.upVector);g&&t.up.set(g[0],g[1],g[2]),o.userData&&typeof o.userData=="object"&&(t.userData=q(o.userData));let u=!1,m=!1;const w=Array.isArray(o.worldMatrix)&&o.worldMatrix.length===16?o.worldMatrix:null;if(w)try{const p=new T().fromArray(w),F=t.parent||null,M=new b,a=new I,d=new b;if(i&&F){F.updateMatrixWorld?.(!0);const z=new T().copy(F.matrixWorld).invert();new T().multiplyMatrices(z,p).decompose(M,a,d)}else p.decompose(M,a,d);const y=t.matrixAutoUpdate;t.matrixAutoUpdate=!1,t.position.copy(M),t.quaternion.copy(a),t.scale.copy(d),t.updateMatrix(),t.updateMatrixWorld(!0),t.matrixAutoUpdate=y,u=!0,m=!0}catch{u=!1}if(!u){const p=W(o.position);let F=!1;p&&(t.position.set(p[0],p[1],p[2]),F=!0);const M=o.quaternion;if(M&&typeof M=="object"){const{x:a,y:d,z:y,w:z}=M;[a,d,y,z].every(N=>Number.isFinite(N))&&(t.quaternion.set(a,d,y,z),F=!0)}Number.isFinite(o.zoom)&&(t.zoom=o.zoom,F=!0),Number.isFinite(o.near)&&(t.near=o.near,F=!0),Number.isFinite(o.far)&&(t.far=o.far,F=!0),F&&(t.updateMatrixWorld?.(!0),m=!0)}if(!m){try{t.updateProjectionMatrix?.()}catch{}if(n){try{n.update?.()}catch{}try{n.updateMatrixState?.()}catch{}}return!1}try{t.updateProjectionMatrix?.()}catch{}const v=o.target||o.controlsTarget,c=W(v);return n?Q(t,n,c,o,f):c&&t.target&&typeof t.target.set=="function"&&t.target.set(c[0],c[1],c[2]),!0}h(ut,"applyCameraSnapshot");function tt(t,e=null,n=null){try{if(!t?.isOrthographicCamera)return;const i=e||{},s=Number.isFinite(i.top)?i.top:t.top,r=Number.isFinite(i.bottom)?i.bottom:t.bottom,f=Number.isFinite(i.left)?i.left:t.left,x=Number.isFinite(i.right)?i.right:t.right,o=Number.isFinite(s)&&Number.isFinite(r)?s-r:t.top-t.bottom,l=Number.isFinite(f)&&Number.isFinite(x)?x-f:t.right-t.left;if(!Number.isFinite(o)||Math.abs(o)<1e-9||!Number.isFinite(l)||Math.abs(l)<1e-9)return;const g=Number.isFinite(s)&&Number.isFinite(r)?(s+r)*.5:(t.top+t.bottom)*.5,u=Number.isFinite(f)&&Number.isFinite(x)?(f+x)*.5:(t.left+t.right)*.5,m=_(n);let w=m?m.width/m.height:null;w>1e-9||(w=Number.isFinite(i.aspect)&&i.aspect>1e-9?i.aspect:l/o),(!Number.isFinite(w)||w<=1e-9)&&(w=1);const v=Math.abs(o)*.5,c=Math.abs(l)*.5,p=Math.max(c,v*w),F=Math.max(v,c/w),M=o>=0?1:-1;t.top=g+F*M,t.bottom=g-F*M,t.left=u-p,t.right=u+p,t.updateProjectionMatrix()}catch{}}h(tt,"adjustOrthographicFrustum");function V(t,e,n=void 0){const i=D(),s=n??i.lineColor??9684477,r=new R().setFromPoints([t.clone(),e.clone()]),f=new Y({color:s,linewidth:i.lineWidth||1});return f.depthTest=!1,f.depthWrite=!1,f.transparent=!0,new H(r,f)}h(V,"makeOverlayLine");function lt(t,e,n=void 0,i={}){const s=D(),{viewer:r=null,dashPixels:f=10,gapPixels:x=10}=i||{},o=t.distanceTo(e);if(!(o>1e-6))return V(t,e,n??s.lineColor??9684477);const l=e.clone().sub(t).normalize(),g=t.clone().add(e).multiplyScalar(.5),u=et(r,g),m=it(u*f,o),w=nt(u*x,o),v=[];let c=0,p=t.clone();for(;c<o-1e-6;){const d=Math.min(m,o-c),y=p.clone().addScaledVector(l,d);if(v.push(p.clone(),y.clone()),c+=d,c>=o)break;const z=Math.min(w,o-c);p=y.clone().addScaledVector(l,z),c+=z}if(v.length<2)return V(t,e,n??s.lineColor??9684477);const F=new R().setFromPoints(v),M=new Y({color:n??s.lineColor??9684477,linewidth:s.lineWidth||1});M.depthTest=!1,M.depthWrite=!1,M.transparent=!0;const a=new J(F,M);return a.renderOrder=9994,a}h(lt,"makeOverlayDashedLine");function et(t,e){try{const n=t?.camera,i=t?.renderer;if(!n||!i)return .01;const s=i.domElement,r=Math.max(1,s?.clientHeight||s?.height||600);if(n.isOrthographicCamera)return(n.top-n.bottom)/Math.max(1e-6,n.zoom||1)/r;const f=n.getWorldPosition(new b),x=e?e.clone():n.getWorldDirection(new b).add(f),o=f.distanceTo(x),l=(n.fov||50)*Math.PI/180;return 2*Math.tan(l/2)*o/r}catch{return .01}}h(et,"worldUnitsPerPixelAtPoint");function it(t,e){if(!Number.isFinite(t)||t<=0)return e*.25;const n=Math.max(1e-4,e*.5);return Math.max(1e-4,Math.min(t,n))}h(it,"clampDashLength");function nt(t,e){if(!Number.isFinite(t)||t<0)return e*.25;const n=Math.max(1e-4,e*.5);return Math.max(1e-4,Math.min(t,n))}h(nt,"clampGapLength");function dt(t,e=void 0){const n=D(),i=e??n.dotColor??16777215,s=new Z(t,12,8),r=new k({color:i});return r.depthTest=!1,r.depthWrite=!1,r.transparent=!0,new G(s,r)}h(dt,"makeOverlaySphere");function pt(t,e,n,i,s,r){try{const f=D(),x=new B(s,i,8),o=new k({color:r??f.arrowColor??9684477,depthTest:!1,depthWrite:!1,transparent:!0}),l=new G(x,o),g=e.clone().addScaledVector(n,-i*.5);l.position.copy(g);const u=new b(0,1,0),m=new I;return m.setFromUnitVectors(u,n.clone().normalize()),l.setRotationFromQuaternion(m),l.renderOrder=9996,t.add(l),l}catch{return null}}h(pt,"addArrowCone");function gt(t,e=1){try{const n=t?.renderer?.domElement?.getBoundingClientRect?.()||{width:800,height:600},i=t?.camera,s=Math.max(1,n.height||600);if(i&&i.isOrthographicCamera){const f=(i.top-i.bottom)/Math.max(1e-6,i.zoom||1)/s;return Math.max(1e-4,f*(e||1))}if(i&&i.isPerspectiveCamera){const r=(i.fov||50)*Math.PI/180,f=i.position.length(),o=2*Math.tan(r/2)*f/s;return Math.max(1e-4,o*(e||1))}return .01*(e||1)}catch{return .01*(e||1)}}h(gt,"screenSizeWorld");function ht(t,e){try{if(!e)return null;const n=e.userData||{},i=String(e.type||"").toUpperCase(),s=String(n.type||n.brepType||"").toUpperCase(),f=i==="FACE"||i==="PLANE"||!(i==="FACE"||i==="EDGE"||i==="PLANE")&&(s==="FACE"||s==="PLANE"),x=i==="EDGE"||!f&&(s==="EDGE"||e.isLine||e.isLine2||e.isLineSegments||e.isLineLoop);if(f){if(typeof e.getAverageNormal=="function"){const u=e.getAverageNormal();e.updateMatrixWorld(!0);const m=new C().getNormalMatrix(e.matrixWorld);return u.applyMatrix3(m).normalize()}const o=e.geometry;if(o){if(o.attributes&&o.attributes.normal){const u=o.attributes.normal.array;if(u.length>=3){const m=new b,w=u.length/3;for(let c=0;c<w;c++){const p=c*3;m.add(new b(u[p],u[p+1],u[p+2]))}m.divideScalar(w),e.updateMatrixWorld(!0);const v=new C().getNormalMatrix(e.matrixWorld);return m.applyMatrix3(v).normalize()}}if(o.attributes&&o.attributes.position){const u=o.attributes.position.array;if(u.length>=9){const m=new b;let w=0;const v=new b,c=new b,p=new b;e.updateMatrixWorld(!0);const F=Math.min(5,Math.floor(u.length/9));for(let M=0;M<F;M++){const a=M*9;if(a+8<u.length){v.set(u[a],u[a+1],u[a+2]).applyMatrix4(e.matrixWorld),c.set(u[a+3],u[a+4],u[a+5]).applyMatrix4(e.matrixWorld),p.set(u[a+6],u[a+7],u[a+8]).applyMatrix4(e.matrixWorld);const d=c.clone().sub(v).cross(p.clone().sub(v));d.lengthSq()>1e-10&&(d.normalize(),m.add(d),w++)}}if(w>0)return m.divideScalar(w).normalize()}}}const l=new b(0,0,1);e.updateMatrixWorld(!0);const g=new C().getNormalMatrix(e.matrixWorld);return l.applyMatrix3(g).normalize()}else if(x){const l=e.geometry;e.updateMatrixWorld(!0);const g=e.matrixWorld,u=h((a,d=!1)=>{if(!a)return null;let y=null;if(Array.isArray(a)&&a.length>=3)y=new b(a[0],a[1],a[2]);else if(typeof a=="object"){const z=Number(a.x),N=Number(a.y),P=Number(a.z);Number.isFinite(z)&&Number.isFinite(N)&&Number.isFinite(P)&&(y=new b(z,N,P))}return y?(d&&g&&y.applyMatrix4(g),y):null},"parsePoint"),m=h((a,d=!1)=>{if(!Array.isArray(a)||a.length<2)return null;let y=u(a[0],d);for(let z=1;z<a.length;z++){const N=u(a[z],d);if(!y||!N){y=N||y;continue}const P=N.clone().sub(y);if(P.lengthSq()>1e-12)return P.normalize();y=N}return null},"directionFromPointList");try{if(typeof e.points=="function"){const a=e.points(!0),d=m(a,!1);if(d)return d}}catch{}const w=Array.isArray(e?.userData?.polylineLocal)?e.userData.polylineLocal:null;if(w){const a=m(w,!0);if(a)return a}const v=l?.attributes?.instanceStart,c=l?.attributes?.instanceEnd;if(v&&c){const a=Math.min(v.count||0,c.count||0);for(let d=0;d<a;d++){const y=new b(v.getX(d),v.getY(d),v.getZ(d)),z=new b(c.getX(d),c.getY(d),c.getZ(d));g&&(y.applyMatrix4(g),z.applyMatrix4(g));const N=z.sub(y);if(N.lengthSq()>1e-12)return N.normalize()}}const p=l?.getAttribute?.("position");if(p&&p.itemSize===3&&p.count>=2){const a=new b,d=new b;a.set(p.getX(0),p.getY(0),p.getZ(0)),g&&a.applyMatrix4(g);for(let y=1;y<p.count;y++){d.set(p.getX(y),p.getY(y),p.getZ(y)),g&&d.applyMatrix4(g);const z=d.clone().sub(a);if(z.lengthSq()>1e-12)return z.normalize();a.copy(d)}}const F=new b(1,0,0),M=new C().getNormalMatrix(e.matrixWorld);return F.applyMatrix3(M).normalize()}return null}catch{return null}}h(ht,"getElementDirection");function ct(t,e){try{if(!e)return null;const n=e.geometry;if(n){if(typeof e.getWorldPosition=="function"){const s=n.attributes&&n.attributes.position?n.attributes.position.array:null;if(s&&s.length>=3){let r=0,f=0,x=0,o=0;const l=new b;e.updateMatrixWorld(!0);for(let g=0;g<s.length;g+=3)l.set(s[g],s[g+1],s[g+2]).applyMatrix4(e.matrixWorld),r+=l.x,f+=l.y,x+=l.z,o++;if(o>0)return new b(r/o,f/o,x/o)}}n.computeBoundingBox?.();const i=n.boundingBox;if(i)return i.getCenter(new b).applyMatrix4(e.matrixWorld)}return e.getWorldPosition(new b)}catch{return null}}h(ct,"objectRepresentativePoint");export{at as a,gt as b,ht as c,pt as d,ft as e,ut as f,D as g,tt as h,V as i,lt as j,dt as m,ct as o,st as s};
|
package/dist/assets/{apiExample_BREP_Booleans-BwiMtDIS.js → apiExample_BREP_Booleans-DyTcZZ5m.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var E=Object.defineProperty;var o=(e,t)=>E(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as i}from"./brep-kernel-
|
|
1
|
+
var E=Object.defineProperty;var o=(e,t)=>E(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as i}from"./brep-kernel-UtrTyG6Q.js";import"./preload-helper-ZNr0Qq7Q.js";const m=document.getElementById("status"),b=document.getElementById("log"),f=document.getElementById("btn-run"),c=o((e,t)=>{m.textContent=e,m.className=`status ${t}`},"setStatus"),g=o(e=>Number(e).toFixed(6),"fmt"),u=o((...e)=>{const t=e.map(r=>typeof r=="string"?r:JSON.stringify(r)).join(" ");b.textContent+=`${t}
|
|
2
2
|
`,console.log(...e)},"write"),s=o(e=>({volume:e.volume(),surfaceArea:e.surfaceArea(),triangles:e.getTriangleCount()}),"summarize"),d=o(()=>{b.textContent="",c("Running...","pending");const e=new i.Cube({x:2.2,y:2.2,z:2.2,name:"Cube"}),t=new i.Sphere({r:1.35,resolution:40,name:"Sphere"}),r=e.union(t),h=e.subtract(t),p=e.intersect(t),n={cube:s(e),sphere:s(t),union:s(r),subtract:s(h),intersect:s(p)};u("--- Boolean Results ---");for(const[v,l]of Object.entries(n))u(`${v.padEnd(10)} volume=${g(l.volume)} area=${g(l.surfaceArea)} triangles=${l.triangles}`);const a=1e-6;if(n.union.volume+a<Math.max(n.cube.volume,n.sphere.volume))throw new Error("Union volume is unexpectedly smaller than both source solids.");if(n.intersect.volume-a>Math.min(n.cube.volume,n.sphere.volume))throw new Error("Intersection volume is unexpectedly larger than a source solid.");if(n.subtract.volume-a>n.cube.volume)throw new Error("Subtract volume is unexpectedly larger than the original cube.");c("Completed","ok")},"runExample");f.addEventListener("click",()=>{try{d()}catch(e){console.error(e),u("ERROR:",e?.stack||e?.message||String(e)),c("Failed","err")}});try{d()}catch(e){console.error(e),u("ERROR:",e?.stack||e?.message||String(e)),c("Failed","err")}
|
package/dist/assets/{apiExample_BREP_Export-BU6JEsXr.js → apiExample_BREP_Export-CHV-v_5k.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var g=Object.defineProperty;var r=(t,n)=>g(t,"name",{value:n,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as c}from"./brep-kernel-
|
|
1
|
+
var g=Object.defineProperty;var r=(t,n)=>g(t,"name",{value:n,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as c}from"./brep-kernel-UtrTyG6Q.js";import"./preload-helper-ZNr0Qq7Q.js";const l=document.getElementById("status"),d=document.getElementById("log"),p=document.getElementById("btn-run"),s=r((t,n)=>{l.textContent=t,l.className=`status ${n}`},"setStatus"),e=r((...t)=>{const n=t.map(o=>typeof o=="string"?o:JSON.stringify(o)).join(" ");d.textContent+=`${n}
|
|
2
2
|
`,console.log(...t)},"write"),u=r((t,n=8)=>t.split(`
|
|
3
3
|
`).slice(0,n).join(`
|
|
4
4
|
`),"firstLines"),m=r(()=>{d.textContent="",s("Running...","pending");const t=new c.Cylinder({radius:1,height:3,resolution:48,name:"Shaft"}).bakeTRS({position:[0,0,.6],rotationEuler:[90,0,0],scale:[1,1,1]}),n=new c.Cone({radius:1.55,height:1.6,resolution:48,name:"Head"}).bakeTRS({position:[0,1.65,.6],rotationEuler:[-90,0,0],scale:[1,1,1]}),o=t.union(n),i=o.toSTL("api_example_part",4),a=o.toSTEP("api_example_part",{precision:4});if(e("--- Export Summary ---"),e("Volume:",o.volume()),e("Surface area:",o.surfaceArea()),e("Triangles:",o.getTriangleCount()),e("STL characters:",i.length),e("STEP characters:",a.length),e(""),e("--- STL Preview ---"),e(u(i)),e(""),e("--- STEP Preview ---"),e(u(a)),!i.startsWith("solid"))throw new Error('STL output did not start with "solid".');if(!a.includes("ISO-10303-21"))throw new Error("STEP output did not contain expected ISO header.");s("Completed","ok")},"runExample");p.addEventListener("click",()=>{try{m()}catch(t){console.error(t),e("ERROR:",t?.stack||t?.message||String(t)),s("Failed","err")}});try{m()}catch(t){console.error(t),e("ERROR:",t?.stack||t?.message||String(t)),s("Failed","err")}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var g=Object.defineProperty;var n=(e,t)=>g(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as o}from"./brep-kernel-
|
|
1
|
+
var g=Object.defineProperty;var n=(e,t)=>g(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as o}from"./brep-kernel-UtrTyG6Q.js";import"./preload-helper-ZNr0Qq7Q.js";const m=document.getElementById("status"),u=document.getElementById("log"),y=document.getElementById("btn-run"),s=n((e,t)=>{m.textContent=e,m.className=`status ${t}`},"setStatus"),l=n(e=>Number(e).toFixed(6),"fmt"),a=n((...e)=>{const t=e.map(r=>typeof r=="string"?r:JSON.stringify(r)).join(" ");u.textContent+=`${t}
|
|
2
2
|
`,console.log(...e)},"write"),C=n(e=>({volume:e.volume(),area:e.surfaceArea(),triangles:e.getTriangleCount()}),"summarize"),c=n(()=>{u.textContent="",s("Running...","pending");const e=[["Cube",()=>new o.Cube({x:2,y:3,z:4,name:"Cube"})],["Sphere",()=>new o.Sphere({r:1.2,resolution:32,name:"Sphere"})],["Cylinder",()=>new o.Cylinder({radius:1,height:2.4,resolution:48,name:"Cylinder"})],["Cone",()=>new o.Cone({radius:1.1,height:2.1,resolution:48,name:"Cone"})],["Torus",()=>new o.Torus({mR:2,tR:.55,resolution:64,name:"Torus"})],["Pyramid",()=>new o.Pyramid({bL:2,s:4,h:2.7,name:"Pyramid"})]];a("--- Primitive Summary ---");for(const[t,r]of e){const d=r(),i=C(d);a(`${t.padEnd(10)} volume=${l(i.volume)} area=${l(i.area)} triangles=${i.triangles}`)}s("Completed","ok")},"runExample");y.addEventListener("click",()=>{try{c()}catch(e){console.error(e),a("ERROR:",e?.stack||e?.message||String(e)),s("Failed","err")}});try{c()}catch(e){console.error(e),a("ERROR:",e?.stack||e?.message||String(e)),s("Failed","err")}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var u=Object.defineProperty;var n=(e,t)=>u(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as g}from"./brep-kernel-
|
|
1
|
+
var u=Object.defineProperty;var n=(e,t)=>u(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as g}from"./brep-kernel-UtrTyG6Q.js";import"./preload-helper-ZNr0Qq7Q.js";const c=document.getElementById("status"),l=document.getElementById("log"),b=document.getElementById("btn-run"),s=n((e,t)=>{c.textContent=e,c.className=`status ${t}`},"setStatus"),i=n(e=>Number(e).toFixed(6),"fmt"),m=n((...e)=>{const t=e.map(o=>typeof o=="string"?o:JSON.stringify(o)).join(" ");l.textContent+=`${t}
|
|
2
2
|
`,console.log(...e)},"write"),r=n((e,t)=>{m(`${e.padEnd(16)} volume=${i(t.volume())} area=${i(t.surfaceArea())} triangles=${t.getTriangleCount()}`)},"describe"),d=n(()=>{l.textContent="",s("Running...","pending");const e=new g.Cube({x:2.2,y:1.4,z:1,name:"BaseCube"}),t=e.clone().bakeTRS({position:[2,.4,.3],rotationEuler:[0,35,20],scale:[1.1,.85,1.25]}),o=t.mirrorAcrossPlane([0,0,0],[1,0,0]),a=t.union(o);if(m("--- Transform Summary ---"),r("base",e),r("moved",t),r("mirrored",o),r("combined",a),a.volume()<=t.volume())throw new Error("Combined solid volume should be greater than a single moved solid.");s("Completed","ok")},"runExample");b.addEventListener("click",()=>{try{d()}catch(e){console.error(e),m("ERROR:",e?.stack||e?.message||String(e)),s("Failed","err")}});try{d()}catch(e){console.error(e),m("ERROR:",e?.stack||e?.message||String(e)),s("Failed","err")}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var H=Object.defineProperty;var s=(e,o)=>H(e,"name",{value:o,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{Sketcher2DEmbed as J}from"./brep-kernel-
|
|
1
|
+
var H=Object.defineProperty;var s=(e,o)=>H(e,"name",{value:o,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{Sketcher2DEmbed as J}from"./brep-kernel-UtrTyG6Q.js";import"./preload-helper-ZNr0Qq7Q.js";const k=document.getElementById("btn-create"),C=document.getElementById("btn-destroy"),I=document.getElementById("btn-apply-css"),w=document.getElementById("btn-apply-theme"),B=document.getElementById("btn-export-svg"),$=document.getElementById("btn-export-dxf"),r=document.getElementById("btn-download-dxf"),D=document.getElementById("btn-export-polylines"),F=document.getElementById("geometry-color"),L=document.getElementById("point-color"),N=document.getElementById("constraint-color"),G=document.getElementById("background-color"),T=document.getElementById("point-size-px"),A=document.getElementById("curve-thickness-px"),f=document.getElementById("sidebar-expanded"),u=document.getElementById("grid-visible"),V=document.getElementById("grid-spacing"),Q=document.getElementById("curve-resolution"),R=document.getElementById("css-input"),W=document.getElementById("sketch-status"),Y=document.getElementById("sketch-host"),d=document.getElementById("event-output"),g=document.getElementById("svg-preview"),O=document.getElementById("path-output"),P=document.getElementById("dxf-output"),M=document.getElementById("polyline-output");let t=null,i=null,m=0,h=0,y=0,c=null;const q=6,n=s(e=>{W.textContent=e},"setSketchStatus"),b=s(()=>{c&&(URL.revokeObjectURL(c),c=null)},"revokeDxfDownload"),K=s(e=>{if(b(),typeof e!="string"||!e.length){r.disabled=!0;return}const o=new Blob([e],{type:"application/dxf"});c=URL.createObjectURL(o),r.disabled=!1},"setDxfDownload"),E=s(e=>{k.disabled=e,C.disabled=!e,I.disabled=!e,w.disabled=!e,B.disabled=!e,$.disabled=!e,D.disabled=!e,r.disabled=!e||!c},"setSketchButtons"),p=s((e,o=null)=>{const a=new Date().toLocaleTimeString(),X=o==null?`[${a}] ${e}`:`[${a}] ${e} ${JSON.stringify(o)}`,z=d.textContent==="(No sketch events yet)"?[]:d.textContent.split(`
|
|
2
2
|
`).filter(Boolean),S=[X,...z].slice(0,q);d.textContent=S.length?S.join(`
|
|
3
3
|
`):"(No sketch events yet)"},"pushEvent"),U=s(()=>({geometryColor:F.value,pointColor:L.value,constraintColor:N.value,backgroundColor:G.value,pointSizePx:Math.max(1,Number(T.value)||10),curveThicknessPx:Math.max(.5,Number(A.value)||2)}),"currentTheme"),x=s(()=>{const e=Number(V.value);return Number.isFinite(e)&&e>0?e:1},"currentGridSpacing"),v=s(()=>{const e=Number(Q.value);return Number.isFinite(e)?Math.max(3,Math.min(2048,Math.floor(e))):64},"currentCurveResolution"),Z=s(async()=>{t||(t=new J({cssText:R.value,...U(),sidebarExpanded:f.checked,gridVisible:u.checked,gridSpacing:x(),onChange:s(e=>{i=e,m+=1;const o=Array.isArray(e?.geometries)?e.geometries.length:0;n(`Sketch updated (${m}). Geometries: ${o}`),p("onChange",{geometries:o})},"onChange"),onFinished:s(e=>{i=e,h+=1;const o=Array.isArray(e?.geometries)?e.geometries.length:0;n(`Sketch finished (${h}). Geometries: ${o}`),p("onFinished",{geometries:o}),j().catch(a=>{console.error(a),n(`Failed to export SVG after Finish: ${a?.message||String(a)}`)})},"onFinished"),onCancelled:s(()=>{y+=1,n(`Sketch cancelled (${y}).`),p("onCancelled")},"onCancelled")}),await t.mount(Y),i=await t.getSketch(),E(!0),n("Sketcher iframe mounted. Draw geometry and run any export action."))},"attachSketcher"),_=s(async()=>{t&&(await t.destroy(),t=null,i=null,m=0,h=0,y=0,E(!1),n("Sketcher destroyed."),d.textContent="(No sketch events yet)",g.innerHTML="",O.textContent="(No SVG exported yet)",P.textContent="(No DXF exported yet)",M.textContent="(No 3D polylines exported yet)",b())},"detachSketcher"),ee=s(async()=>{t&&(await t.setCss(R.value),n("Custom CSS applied to iframe."))},"applySketchCss"),l=s(async()=>{t&&(await t.setTheme(U()),await t.setSidebarExpanded(f.checked),typeof t.setGrid=="function"?await t.setGrid({visible:u.checked,spacing:x()}):(typeof t.setGridVisible=="function"&&await t.setGridVisible(u.checked),typeof t.setGridSpacing=="function"&&await t.setGridSpacing(x())),n("Theme + sidebar + grid state applied to iframe."))},"applySketchTheme"),j=s(async()=>{if(!t)return;const e=await t.exportSVG({flipY:!0,precision:3,stroke:"#111111",strokeWidth:1.5,fill:"none",padding:12,curveResolution:v()});i=await t.getSketch({preferCached:!0}),g.innerHTML=e.svg,O.textContent=e.paths.length?e.paths.map(o=>`id=${o.id} type=${o.type} d="${o.d}"`).join(`
|
|
4
4
|
`):"(No sketch geometry to export)",n(`Exported ${e.paths.length} SVG paths.`),g.scrollIntoView({behavior:"smooth",block:"start"})},"exportSvg"),te=s(async()=>{if(!t)return;const e=await t.exportDXF({units:"mm",curveResolution:v(),includeConstruction:!1});P.textContent=e?.dxf||"(No DXF payload returned)",K(e?.dxf||""),n(`Exported DXF with ${e?.polylines?.length||0} polylines.`)},"exportDxf"),ne=s(async()=>{if(!t)return;const e=await t.export3DPolylines({curveResolution:v(),includeConstruction:!1,origin:[0,0,0],xAxis:[1,0,0],yAxis:[0,1,0]});M.textContent=JSON.stringify(e,null,2),n(`Exported ${e?.polylines?.length||0} 3D polylines.`)},"export3DPolylines");k.addEventListener("click",()=>{Z().catch(e=>{console.error(e),n(`Failed to create sketcher: ${e?.message||String(e)}`)})});C.addEventListener("click",()=>{_().catch(e=>{console.error(e),n(`Failed to destroy sketcher: ${e?.message||String(e)}`)})});I.addEventListener("click",()=>{ee().catch(e=>{console.error(e),n(`Failed to apply CSS: ${e?.message||String(e)}`)})});w.addEventListener("click",()=>{l().catch(e=>{console.error(e),n(`Failed to apply theme: ${e?.message||String(e)}`)})});B.addEventListener("click",()=>{j().catch(e=>{console.error(e),n(`Failed to export SVG: ${e?.message||String(e)}`)})});$.addEventListener("click",()=>{te().catch(e=>{console.error(e),n(`Failed to export DXF: ${e?.message||String(e)}`)})});r.addEventListener("click",()=>{if(!c)return;const e=document.createElement("a");e.href=c,e.download="sketch-export.dxf",e.click()});D.addEventListener("click",()=>{ne().catch(e=>{console.error(e),n(`Failed to export 3D polylines: ${e?.message||String(e)}`)})});[F,L,N,G,T,A].forEach(e=>{e.addEventListener("input",()=>{t&&l().catch(o=>{console.error(o),n(`Failed to apply theme: ${o?.message||String(o)}`)})})});f.addEventListener("change",()=>{t&&l().catch(e=>{console.error(e),n(`Failed to apply sidebar state: ${e?.message||String(e)}`)})});u.addEventListener("change",()=>{t&&l().catch(e=>{console.error(e),n(`Failed to apply grid visibility: ${e?.message||String(e)}`)})});V.addEventListener("input",()=>{t&&l().catch(e=>{console.error(e),n(`Failed to apply grid spacing: ${e?.message||String(e)}`)})});window.addEventListener("beforeunload",()=>{t&&t.destroy().catch(()=>{}),b()});E(!1);i&&!Array.isArray(i?.geometries)&&console.warn("Unexpected sketch payload shape",i);
|
package/dist/assets/{apiExample_Embeded_CAD-wxO1n_Eq.js → apiExample_Embeded_CAD-BnQhzp-z.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var B=Object.defineProperty;var n=(t,o)=>B(t,"name",{value:o,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{CADEmbed as v}from"./brep-kernel-
|
|
1
|
+
var B=Object.defineProperty;var n=(t,o)=>B(t,"name",{value:o,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{CADEmbed as v}from"./brep-kernel-UtrTyG6Q.js";import"./preload-helper-ZNr0Qq7Q.js";const u=document.getElementById("btn-create"),y=document.getElementById("btn-destroy"),p=document.getElementById("btn-state"),g=document.getElementById("btn-history"),b=document.getElementById("btn-sample"),E=document.getElementById("btn-reset"),h=document.getElementById("btn-css"),S=document.getElementById("viewer-only"),i=document.getElementById("sidebar-expanded"),x=document.getElementById("model-path"),w=document.getElementById("model-source"),$=document.getElementById("model-repo"),k=document.getElementById("model-branch"),C=document.getElementById("css-input"),F=document.getElementById("cad-status"),H=document.getElementById("cad-host"),I=document.getElementById("state-output"),f=document.getElementById("history-output");let e=null;const D={features:[{type:"Primitive Cube",inputParams:{id:"sample_cube_1",sizeX:24,sizeY:18,sizeZ:14,transform:{position:[0,0,0],rotationEuler:[0,0,0],scale:[1,1,1]},boolean:{targets:[],operation:"NONE"}},persistentData:{},timestamp:null}],idCounter:1,expressions:`//Examples:
|
|
2
2
|
x = 10 + 6;
|
|
3
3
|
y = x * 2;`,pmiViews:[],metadata:{},assemblyConstraints:[],assemblyConstraintIdCounter:0},s=n(t=>{F.textContent=t},"setStatus"),r=n(t=>{u.disabled=t,y.disabled=!t,p.disabled=!t,g.disabled=!t,b.disabled=!t,E.disabled=!t,h.disabled=!t,S.disabled=t},"setButtons"),L=n(()=>{const t=String(x.value||"").trim();if(!t)return null;const o=String(w.value||"local").trim()||"local",a=String($.value||"").trim(),d=String(k.value||"").trim(),l={modelPath:t,source:o};return a&&(l.repoFull=a),d&&(l.branch=d),l},"currentModelRequest"),c=n((t,o="State updated")=>{I.textContent=JSON.stringify(t||{},null,2);const a=Number(t?.featureCount||0),d=t?.model?.name||"(unsaved/new)";s(`${o}. Features: ${a}. Model: ${d}`)},"renderState"),N=n(async()=>{if(e)return;const t=L();e=new v({mountTo:H,viewerOnlyMode:S.checked,sidebarExpanded:i.checked,cssText:C.value,initialModel:t,onReady:n(a=>{c(a,"CAD ready")},"onReady"),onHistoryChanged:n(a=>{c(a,`History changed (${a?.reason||"update"})`)},"onHistoryChanged")}),await e.mount(),r(!0);const o=await e.getState();c(o,"CAD iframe mounted")},"createCad"),O=n(async()=>{e&&(await e.destroy(),e=null,r(!1),s("CAD iframe destroyed."),I.textContent="(No state yet)",f.textContent="(No history exported yet)")},"destroyCad"),m=n(async()=>{if(!e)return;const t=await e.getState();c(t,"State fetched")},"refreshState"),A=n(async()=>{if(!e)return;const t=await e.getPartHistoryJSON();f.textContent=t||"(History is empty)",s(`History exported (${t?t.length:0} chars).`)},"exportHistory"),M=n(async()=>{e&&(await e.setPartHistory(D),await m(),s("Sample cube history loaded."))},"loadSampleCube"),P=n(async()=>{e&&(await e.reset(),await m(),s("Model reset complete."))},"resetModel"),R=n(async()=>{e&&(await e.setCss(C.value),await e.setSidebarExpanded(i.checked),s("Custom CSS and sidebar state applied."))},"applyCss");u.addEventListener("click",()=>{N().catch(t=>{console.error(t),s(`Failed to create CAD iframe: ${t?.message||String(t)}`)})});y.addEventListener("click",()=>{O().catch(t=>{console.error(t),s(`Failed to destroy CAD iframe: ${t?.message||String(t)}`)})});p.addEventListener("click",()=>{m().catch(t=>{console.error(t),s(`Failed to get state: ${t?.message||String(t)}`)})});g.addEventListener("click",()=>{A().catch(t=>{console.error(t),s(`Failed to export history: ${t?.message||String(t)}`)})});b.addEventListener("click",()=>{M().catch(t=>{console.error(t),s(`Failed to load sample history: ${t?.message||String(t)}`)})});E.addEventListener("click",()=>{P().catch(t=>{console.error(t),s(`Failed to reset model: ${t?.message||String(t)}`)})});h.addEventListener("click",()=>{R().catch(t=>{console.error(t),s(`Failed to apply CSS: ${t?.message||String(t)}`)})});i.addEventListener("change",()=>{e&&e.setSidebarExpanded(i.checked).catch(t=>{console.error(t),s(`Failed to set sidebar state: ${t?.message||String(t)}`)})});r(!1);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var O=Object.defineProperty;var i=(t,s)=>O(t,"name",{value:s,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{CADEmbed as S}from"./brep-kernel-
|
|
1
|
+
var O=Object.defineProperty;var i=(t,s)=>O(t,"name",{value:s,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{CADEmbed as S}from"./brep-kernel-UtrTyG6Q.js";import"./preload-helper-ZNr0Qq7Q.js";const h=document.getElementById("btn-run"),u=document.getElementById("btn-destroy"),P=document.getElementById("viewer-only"),H=document.getElementById("sidebar-expanded"),M=document.getElementById("model-path"),A=document.getElementById("model-source"),j=document.getElementById("model-repo"),B=document.getElementById("model-branch"),x=document.getElementById("css-input"),R=document.getElementById("run-status"),$=document.getElementById("cad-host"),C=document.getElementById("results"),g=document.getElementById("log-output");let n=null,w=!1;const v={features:[{type:"Primitive Cube",inputParams:{id:"integration_sample_cube_1",sizeX:16,sizeY:12,sizeZ:10,transform:{position:[0,0,0],rotationEuler:[0,0,0],scale:[1,1,1]},boolean:{targets:[],operation:"NONE"}},persistentData:{},timestamp:null}],idCounter:1,expressions:`//Examples:
|
|
2
2
|
x = 10 + 6;
|
|
3
3
|
y = x * 2;`,pmiViews:[],metadata:{},assemblyConstraints:[],assemblyConstraintIdCounter:0};function l(t){const a=`[${new Date().toLocaleTimeString()}] ${t}`,o=g.textContent==="(No logs yet)"?[]:g.textContent.split(`
|
|
4
4
|
`).filter(Boolean);o.unshift(a),g.textContent=o.slice(0,120).join(`
|
package/dist/assets/{assemblyConstraintDialogs-CH_Gbz82.js → assemblyConstraintDialogs-C2rw8l6x.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
var c=Object.defineProperty;var o=(t,r)=>c(t,"name",{value:r,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";import{A as m}from"./AssemblyConstraintRegistry-
|
|
1
|
+
var c=Object.defineProperty;var o=(t,r)=>c(t,"name",{value:r,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";import{A as m}from"./AssemblyConstraintRegistry-CMGYi26o.js";import{r as s}from"./dialogCapturePageFactory-DVhrYqMv.js";import"./featureDialogs-DkPbRjYq.js";import"./browserStorage-CvgF8ovw.js";import"./preload-helper-ZNr0Qq7Q.js";import"./annUtils-DGfVy9U3.js";const p=new m,f=p.list().filter(Boolean).map(t=>{const r=a(t.longName,t.constraintName,t.name,"Constraint"),e=a(t.shortName,t.constraintShortName,t.constraintType,r,"Constraint"),n=t&&typeof t.inputParamsSchema=="object"?t.inputParamsSchema:{},i=u(n,e);return{displayName:r,shortName:e,captureName:r,schema:n,initialParams:i}});s({title:"Assembly Constraint Dialog Reference",description:"Dialogs for built-in assembly constraints captured from the constraint registry.",entries:f});function a(...t){for(const r of t){if(r==null&&r!==0)continue;const e=String(r).trim();if(e.length)return e}return"Constraint"}o(a,"pickName");function u(t,r){if(!t||typeof t!="object")return{};const e=Object.keys(t).find(i=>i.toLowerCase()==="constraintid");if(!e)return{};const n=String(r||"constraint").replace(/[^a-z0-9._-]+/gi,"_");return{[e]:`${n}-constraint`}}o(u,"buildConstraintParams");
|