brep-io-kernel 1.0.177 → 1.0.178

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/about.html +3 -66
  2. package/dist/apiExamples/BREP_Booleans.html +2 -2
  3. package/dist/apiExamples/BREP_Export.html +2 -2
  4. package/dist/apiExamples/BREP_Primitives.html +2 -2
  5. package/dist/apiExamples/BREP_Transforms.html +2 -2
  6. package/dist/apiExamples/Embeded_2D_Sketcher.html +2 -2
  7. package/dist/apiExamples/Embeded_CAD.html +2 -2
  8. package/dist/apiExamples/Embeded_CAD_Integration_Test.html +2 -2
  9. package/dist/assembly-constraint-capture.html +5 -5
  10. package/dist/assets/{AnnotationRegistry-CyI5mmDu.js → AnnotationRegistry-QZj3o2R6.js} +1 -1
  11. package/dist/assets/{AssemblyConstraintRegistry-3P1cpGjG.js → AssemblyConstraintRegistry-DJV0rHvz.js} +1 -1
  12. package/dist/assets/{FeatureRegistry-Cd-GX-Bm.js → FeatureRegistry-C7MrfKHF.js} +3 -3
  13. package/dist/assets/{PartHistory-DxsRIXx4.js → PartHistory-CyUoWFuO.js} +1 -1
  14. package/dist/assets/{Tube-bO80ROeR.js → Tube-TKgrLSLm.js} +1 -1
  15. package/dist/assets/{annUtils-D9TT7tgs.js → annUtils-Cv2fgMTB.js} +1 -1
  16. package/dist/assets/{apiExample_BREP_Booleans-p7pplM2w.js → apiExample_BREP_Booleans-CVUu-3pI.js} +1 -1
  17. package/dist/assets/{apiExample_BREP_Export-DcEboCzN.js → apiExample_BREP_Export-D3YICePi.js} +1 -1
  18. package/dist/assets/{apiExample_BREP_Primitives-mwn27Zyf.js → apiExample_BREP_Primitives-CB9GlLIq.js} +1 -1
  19. package/dist/assets/{apiExample_BREP_Transforms-DoxqJ6cS.js → apiExample_BREP_Transforms-BTbdOuJd.js} +1 -1
  20. package/dist/assets/{apiExample_Embeded_2D_Sketcher-D0UY5aPj.js → apiExample_Embeded_2D_Sketcher-jli62c46.js} +1 -1
  21. package/dist/assets/{apiExample_Embeded_CAD-CGA1Zguy.js → apiExample_Embeded_CAD-BBzOAW8d.js} +1 -1
  22. package/dist/assets/{apiExample_Embeded_CAD_Integration_Test-CdZX2cCy.js → apiExample_Embeded_CAD_Integration_Test-Dla62MVj.js} +1 -1
  23. package/dist/assets/{assemblyConstraintDialogs-Qq5KEM_o.js → assemblyConstraintDialogs-7PwUshmv.js} +1 -1
  24. package/dist/assets/{brep-kernel-DRr4NDNQ.js → brep-kernel-B2gzJr_I.js} +3 -10
  25. package/dist/assets/{browserTests-DI1pWDf6.js → browserTests-Rma8zWcv.js} +1 -1
  26. package/dist/assets/{chamfer-DdXNz6lz.js → chamfer-jmLT1RTy.js} +1 -1
  27. package/dist/assets/{dialogCapturePageFactory-DGBZ6PkY.js → dialogCapturePageFactory-l1BkjONQ.js} +1 -1
  28. package/dist/assets/{featureDialogs-CUWi02Qp.js → featureDialogs-Bas0NDXF.js} +3 -3
  29. package/dist/assets/{featureDialogs-CJ9OA-vL.js → featureDialogs-zsfh_u_t.js} +1 -1
  30. package/dist/assets/{fillet-CJey7GJP.js → fillet-Bzd1Xae9.js} +1 -1
  31. package/dist/assets/{index.es-X1ZhwpCY.js → index.es-tZ6V_7py.js} +1 -1
  32. package/dist/assets/{javascript-CHFzcwro.js → javascript-DU8Xgp6c.js} +1 -1
  33. package/dist/assets/{main-cad-bbPyIDxb.js → main-cad-J2VK-edE.js} +6 -6
  34. package/dist/assets/{pmiDialogs-BFqEnCKw.js → pmiDialogs-DtSa0QaG.js} +1 -1
  35. package/dist/assets/{test-XEjDO9UE.js → test-D-0BGqtx.js} +3 -3
  36. package/dist/cad.html +10 -10
  37. package/dist/feature-dialog-capture.html +7 -7
  38. package/dist/help/index.html +3 -66
  39. package/dist/help/search-index.json +1 -1
  40. package/dist/pmi-dialog-capture.html +5 -5
  41. package/dist/test.html +1 -1
  42. package/dist/viewer.html +10 -10
  43. package/dist-kernel/brep-kernel.js +3 -10
  44. package/dist-kernel/help/index.html +3 -66
  45. package/dist-kernel/help/search-index.json +1 -1
  46. package/package.json +2 -3
  47. package/src/BREP/setupManifold.js +2 -7
  48. package/src/generated/licenseBundle.js +1 -1
  49. package/src/generated/manifoldSource.js +0 -1
  50. package/dist/assets/manifold-B8h_vZ5O.js +0 -16
  51. package/dist/assets/manifold-D9yvTBHx.wasm +0 -0
@@ -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-DRr4NDNQ.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:
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-B2gzJr_I.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-DRr4NDNQ.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:
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-B2gzJr_I.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(`
@@ -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-3P1cpGjG.js";import{r as s}from"./dialogCapturePageFactory-DGBZ6PkY.js";import"./featureDialogs-CUWi02Qp.js";import"./browserStorage-CvgF8ovw.js";import"./preload-helper-ZNr0Qq7Q.js";import"./annUtils-D9TT7tgs.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");
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-DJV0rHvz.js";import{r as s}from"./dialogCapturePageFactory-l1BkjONQ.js";import"./featureDialogs-Bas0NDXF.js";import"./browserStorage-CvgF8ovw.js";import"./preload-helper-ZNr0Qq7Q.js";import"./annUtils-Cv2fgMTB.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");
@@ -5837,7 +5837,7 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
5837
5837
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
5838
5838
 
5839
5839
  Third-party licenses (production dependencies)
5840
- 40 packages • 6 license types
5840
+ 33 packages • 6 license types
5841
5841
  Generated from: installed node_modules graph (dependencies + optionalDependencies) + vendored third-party components
5842
5842
 
5843
5843
  (MIT AND Zlib) (2 packages)
@@ -5847,27 +5847,20 @@ Generated from: installed node_modules graph (dependencies + optionalDependencie
5847
5847
  (MIT OR GPL-3.0-or-later) (1 package)
5848
5848
  - jszip@3.10.1 — Create, read and edit .zip files with JavaScript http://stuartk.com/jszip — Author: Stuart Knightley <stuart@stuartk.com> — https://github.com/Stuk/jszip.git
5849
5849
 
5850
- Apache-2.0 (2 packages)
5851
- - manifold-3d@3.3.2 — Geometry library for topological robustness — https://github.com/elalish/manifold#readme
5850
+ Apache-2.0 (1 package)
5852
5851
  - manifold-3d@3.4.0 — Geometry library for topological robustness — https://github.com/elalish/manifold#readme
5853
5852
 
5854
5853
  ISC (1 package)
5855
5854
  - inherits@2.0.4 — Browser-friendly inheritance fully compatible with standard node.js inherits() — git://github.com/isaacs/inherits
5856
5855
 
5857
- MIT (33 packages)
5856
+ MIT (27 packages)
5858
5857
  - @babel/runtime@7.28.6 — babel's modular runtime helpers — Author: The Babel Team (https://babel.dev/team) — https://babel.dev/docs/en/next/babel-runtime
5859
- - @jridgewell/resolve-uri@3.1.2 — Resolve a URI relative to an optional base URI — Author: Justin Ridgewell <justin@ridgewell.name> — https://github.com/jridgewell/resolve-uri
5860
- - @jridgewell/sourcemap-codec@1.5.5 — Encode/decode sourcemap mappings — Author: Justin Ridgewell <justin@ridgewell.name> — https://github.com/jridgewell/sourcemaps/tree/main/packages/sourcemap-codec
5861
- - @jridgewell/trace-mapping@0.3.31 — Trace the original position through a source map — Author: Justin Ridgewell <justin@ridgewell.name> — https://github.com/jridgewell/sourcemaps/tree/main/packages/trace-mapping
5862
- - @jscadui/3mf-export@0.5.0 — 3mf export
5863
5858
  - @tarikjabiri/dxf@2.8.9 — A JavaScript interface to Dxf written in TypeScript. — Author: Tarik EL JABIRI — https://dxf.vercel.app
5864
5859
  - @types/pako@2.0.4 — TypeScript definitions for pako — https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pako
5865
5860
  - base64-arraybuffer@1.0.2 — Encode/decode base64 data into ArrayBuffers — Author: Niklas von Hertzen <niklasvh@gmail.com> — https://github.com/niklasvh/base64-arraybuffer
5866
- - convert-source-map@2.0.0 — Converts a source-map from/to different formats and allows adding/changing properties. — Author: Thorsten Lorenz <thlorenz@gmx.de> — https://github.com/thlorenz/convert-source-map
5867
5861
  - core-js@3.48.0 — Standard library — Author: Denis Pushkarev <zloirock@zloirock.ru> — https://core-js.io
5868
5862
  - core-util-is@1.0.3 — The \`util.is*\` functions introduced in Node v0.12. — Author: Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/) — git://github.com/isaacs/core-util-is
5869
5863
  - css-line-break@2.1.0 — Author: Niklas von Hertzen <niklasvh@gmail.com> — https://github.com/niklasvh/css-line-break#readme
5870
- - esbuild-wasm@0.25.12 — The cross-platform WebAssembly binary for esbuild, a JavaScript bundler. — git+https://github.com/evanw/esbuild.git
5871
5864
  - fast-png@6.4.0 — PNG image decoder and encoder written entirely in JavaScript — Author: Michaël Zasso — https://github.com/image-js/fast-png#readme
5872
5865
  - html2canvas@1.4.1 — Screenshots with JavaScript — Author: Niklas von Hertzen <niklasvh@gmail.com> — https://html2canvas.hertzen.com
5873
5866
  - immediate@3.0.6 — A cross browser microtask library — git://github.com/calvinmetcalf/immediate.git
@@ -1,4 +1,4 @@
1
- var hr=Object.defineProperty;var i=(e,t)=>hr(e,"name",{value:t,configurable:!0});import{g as pt,D as Ht,a as xr,r as mt,b as ht,c as Qt,d as e0,e as gr,f as yr,h as vr,i as xt,j as t0,k as wr,l as Ye,m as r0,n as _r,o as Er,p as br,q as Sr,s as Pr,P as je,t as Fr,u as n0,v as Ar,w as Ir,x as Tr,y as Nr,z as Mr,A as Dr,B as o0,V as a0,F as s0}from"./main-cad-bbPyIDxb.js";import{q as b}from"./browserStorage-CvgF8ovw.js";import{S as zt,q as B0,P as rt}from"./PartHistory-DxsRIXx4.js";import{C as L0,B as J,o as i0,p as jt,q as c0,t as Cr,E as z0,u as Or,O as kr,_ as j0,v as Te,w as l0,x as Rr,y as De,z as $r,f as Ut,d as Br,a as U0}from"./FeatureRegistry-Cd-GX-Bm.js";import{V as L,b9 as Lr,ba as zr,bb as jr,B as Ur,G as Wr,d as Vr,F as Xr,f as Yr,J as Gr,ap as d0,a4 as ge,O as W0,b0 as Jr,a3 as Ue,aZ as Zr,aK as V0,aR as Kr,Q as qr}from"./featureDialogs-CUWi02Qp.js";import{computeFilletCenterline as X0}from"./fillet-CJey7GJP.js";import"./Tube-bO80ROeR.js";import"./droppedWorkspaceFiles-8o-ZYOrf.js";import"./annUtils-D9TT7tgs.js";import"./AnnotationRegistry-CyI5mmDu.js";import"./deepClone-Dj59xCHB.js";import"./preload-helper-ZNr0Qq7Q.js";import"./AssemblyConstraintRegistry-3P1cpGjG.js";import"./chamfer-DdXNz6lz.js";const Jt=class Jt{constructor(t={}){this.options={captureStack:!!t.captureStack,withTimestamp:t.withTimestamp!==!1,levels:t.levels||null,maxEntries:Number.isFinite(t.maxEntries)?t.maxEntries:1/0},this._orig=(typeof window<"u"?window.console:console)||{},this._installed=!1,this._capturing=!0,this._logs=[],this._nextId=1,this._proxy=this._buildProxy(),this.install()}install(){if(this._installed)return;const t=typeof window<"u"?window:globalThis;this._prevConsole=t.console,t.console=this._proxy,this._installed=!0}restore(){if(!this._installed)return;const t=typeof window<"u"?window:globalThis;t.console=this._prevConsole||this._orig,this._installed=!1}pause(){this._capturing=!1}resume(){this._capturing=!0}getLogs(t={}){const{level:r,since:n,until:o}=t;return this._logs.filter(a=>!(r&&a.level!==r||n&&a.time&&a.time<n||o&&a.time&&a.time>o)).slice()}clearLogs(){this._logs.length=0}get logs(){return this.getLogs()}getLogsAll(){return this.getLogs()}_buildProxy(){const t=this._orig,r={},n=new Set([...Object.getOwnPropertyNames(t),...Object.keys(t)]);["log","info","warn","error","debug","trace","group","groupCollapsed","groupEnd","table","time","timeEnd","timeLog","count","countReset","assert","clear","dir","dirxml"].forEach(a=>n.add(a));for(const a of n){const s=this._safeGetDescriptor(t,a);if(s)if(typeof s.value=="function")r[a]=this._wrapMethod(a,t[a]);else if(s.get||s.set)Object.defineProperty(r,a,{configurable:!0,enumerable:s.enumerable,get:s.get?s.get.bind(t):void 0,set:s.set?s.set.bind(t):void 0});else try{r[a]=t[a]}catch{}}return Object.defineProperty(r,"__capturing__",{value:!0,enumerable:!1}),r}_safeGetDescriptor(t,r){try{return Object.getOwnPropertyDescriptor(t,r)}catch{return null}}_wrapMethod(t,r){const n=this,o=!n.options.levels||n.options.levels.includes(t);function a(...s){const l=t==="assert"?!s[0]:!0;if(n._capturing&&o&&l){const d={id:n._nextId++,level:t,args:s};if(n.options.withTimestamp&&(d.time=new Date),n.options.captureStack){const f=new Error().stack||"";d.stack=f.split(`
1
+ var hr=Object.defineProperty;var i=(e,t)=>hr(e,"name",{value:t,configurable:!0});import{g as pt,D as Ht,a as xr,r as mt,b as ht,c as Qt,d as e0,e as gr,f as yr,h as vr,i as xt,j as t0,k as wr,l as Ye,m as r0,n as _r,o as Er,p as br,q as Sr,s as Pr,P as je,t as Fr,u as n0,v as Ar,w as Ir,x as Tr,y as Nr,z as Mr,A as Dr,B as o0,V as a0,F as s0}from"./main-cad-J2VK-edE.js";import{q as b}from"./browserStorage-CvgF8ovw.js";import{S as zt,q as B0,P as rt}from"./PartHistory-CyUoWFuO.js";import{C as L0,B as J,o as i0,p as jt,q as c0,t as Cr,E as z0,u as Or,O as kr,_ as j0,v as Te,w as l0,x as Rr,y as De,z as $r,f as Ut,d as Br,a as U0}from"./FeatureRegistry-C7MrfKHF.js";import{V as L,b9 as Lr,ba as zr,bb as jr,B as Ur,G as Wr,d as Vr,F as Xr,f as Yr,J as Gr,ap as d0,a4 as ge,O as W0,b0 as Jr,a3 as Ue,aZ as Zr,aK as V0,aR as Kr,Q as qr}from"./featureDialogs-Bas0NDXF.js";import{computeFilletCenterline as X0}from"./fillet-Bzd1Xae9.js";import"./Tube-TKgrLSLm.js";import"./droppedWorkspaceFiles-8o-ZYOrf.js";import"./annUtils-Cv2fgMTB.js";import"./AnnotationRegistry-QZj3o2R6.js";import"./deepClone-Dj59xCHB.js";import"./preload-helper-ZNr0Qq7Q.js";import"./AssemblyConstraintRegistry-DJV0rHvz.js";import"./chamfer-jmLT1RTy.js";const Jt=class Jt{constructor(t={}){this.options={captureStack:!!t.captureStack,withTimestamp:t.withTimestamp!==!1,levels:t.levels||null,maxEntries:Number.isFinite(t.maxEntries)?t.maxEntries:1/0},this._orig=(typeof window<"u"?window.console:console)||{},this._installed=!1,this._capturing=!0,this._logs=[],this._nextId=1,this._proxy=this._buildProxy(),this.install()}install(){if(this._installed)return;const t=typeof window<"u"?window:globalThis;this._prevConsole=t.console,t.console=this._proxy,this._installed=!0}restore(){if(!this._installed)return;const t=typeof window<"u"?window:globalThis;t.console=this._prevConsole||this._orig,this._installed=!1}pause(){this._capturing=!1}resume(){this._capturing=!0}getLogs(t={}){const{level:r,since:n,until:o}=t;return this._logs.filter(a=>!(r&&a.level!==r||n&&a.time&&a.time<n||o&&a.time&&a.time>o)).slice()}clearLogs(){this._logs.length=0}get logs(){return this.getLogs()}getLogsAll(){return this.getLogs()}_buildProxy(){const t=this._orig,r={},n=new Set([...Object.getOwnPropertyNames(t),...Object.keys(t)]);["log","info","warn","error","debug","trace","group","groupCollapsed","groupEnd","table","time","timeEnd","timeLog","count","countReset","assert","clear","dir","dirxml"].forEach(a=>n.add(a));for(const a of n){const s=this._safeGetDescriptor(t,a);if(s)if(typeof s.value=="function")r[a]=this._wrapMethod(a,t[a]);else if(s.get||s.set)Object.defineProperty(r,a,{configurable:!0,enumerable:s.enumerable,get:s.get?s.get.bind(t):void 0,set:s.set?s.set.bind(t):void 0});else try{r[a]=t[a]}catch{}}return Object.defineProperty(r,"__capturing__",{value:!0,enumerable:!1}),r}_safeGetDescriptor(t,r){try{return Object.getOwnPropertyDescriptor(t,r)}catch{return null}}_wrapMethod(t,r){const n=this,o=!n.options.levels||n.options.levels.includes(t);function a(...s){const l=t==="assert"?!s[0]:!0;if(n._capturing&&o&&l){const d={id:n._nextId++,level:t,args:s};if(n.options.withTimestamp&&(d.time=new Date),n.options.captureStack){const f=new Error().stack||"";d.stack=f.split(`
2
2
  `).slice(2).join(`
3
3
  `)}n.options.maxEntries!==1/0&&n._logs.length>=n.options.maxEntries&&n._logs.shift(),n._logs.push(d)}try{if(typeof r=="function")return r.apply(n._orig,s)}catch(d){try{return n._orig&&typeof n._orig.log=="function"?n._orig.log("ConsoleCapture forwarding error:",d):void 0}catch{}}}i(a,"wrapped");try{Object.defineProperty(a,"name",{value:`capture_${t}`})}catch{}return a}};i(Jt,"ConsoleCapture");let At=Jt;const O=!!globalThis?.process?.versions?.node&&typeof window>"u";function $(){if(!O)return I;if(typeof require=="function"){const t=require("node:path");return(t.default??t).posix}const e=globalThis?.module;if(e&&typeof e.createRequire=="function"){const r=e.createRequire(globalThis.__filename||globalThis.process.cwd())("node:path");return(r.default??r).posix}return I}i($,"getNodePosixSync");const Y0="/",Hr=":";function le(e){if(typeof e!="string")throw new TypeError("Path must be a string")}i(le,"_assertString");function dt(e){return e.startsWith(Y0)}i(dt,"_isAbsolute");function G0(e,t){const r=e.split("/"),n=[];for(let o=0;o<r.length;o++){const a=r[o];!a||a==="."||(a===".."?n.length&&n[n.length-1]!==".."?n.pop():t&&n.push(".."):n.push(a))}return n.join("/")}i(G0,"_normalizeString");function J0(e){if(le(e),e==="")return".";const t=dt(e),r=e.endsWith("/");let n=G0(e,!t);return n===""&&!t&&(n="."),n!==""&&r&&(n+="/"),(t?"/":"")+n}i(J0,"_normalize");function Qr(...e){let t="";for(let r=0;r<e.length;r++){const n=e[r];le(n),n!==""&&(t===""?t=n:t+="/"+n)}return J0(t)}i(Qr,"_join");function It(...e){let t="",r=!1;for(let o=e.length-1;o>=0;o--){const a=e[o];if(a!==void 0&&(le(a),a!==""&&(t=a+"/"+t,a.startsWith("/")))){r=!0;break}}r||(t="/"+t,r=!0);const n=G0(t,!1);return(r?"/":"")+n||(r?"/":".")}i(It,"_resolve");function en(e,t){if(le(e),le(t),e===t||(e=It(e),t=It(t),e===t))return"";const r=e.slice(1).split("/").filter(Boolean),n=t.slice(1).split("/").filter(Boolean);let o=0;const a=Math.min(r.length,n.length);for(;o<a&&r[o]===n[o];o++);const s=r.slice(o).map(()=>".."),c=n.slice(o);return s.concat(c).join("/")||""}i(en,"_relative");function Z0(e){if(le(e),e.length===0)return".";const t=dt(e),r=e.endsWith("/")?e.length-1:e.length;let n=-1;for(let o=r-1;o>=0;--o)if(e.charCodeAt(o)===47){n=o;break}return n===-1?t?"/":".":t&&n===0?"/":e.slice(0,n)}i(Z0,"_dirname");function K0(e,t=""){if(le(e),t!==void 0&&typeof t!="string")throw new TypeError("ext must be a string");let r=e.length;if(r===0)return"";for(;r>0&&e.charCodeAt(r-1)===47;)r--;if(r===0)return"/";let n=0;for(let a=r-1;a>=0;--a)if(e.charCodeAt(a)===47){n=a+1;break}let o=e.slice(n,r);return t&&o.endsWith(t)&&t!==""&&t!==o&&(o=o.slice(0,o.length-t.length)),o}i(K0,"_basename");function q0(e){le(e);let t=-1,r=0,n=-1,o=0;for(let a=e.length-1;a>=0;--a){const s=e.charCodeAt(a);if(s===47){if(n!==-1){r=a+1;break}continue}n===-1&&(n=a+1),s===46?t===-1?t=a:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||n===-1||o===0||t===r?"":e.slice(t,n)}i(q0,"_extname");function tn(e){le(e);const t=dt(e)?"/":"",r=Z0(e),n=K0(e),o=q0(n),a=o?n.slice(0,n.length-o.length):n;return{root:t,dir:r,base:n,ext:o,name:a}}i(tn,"_parse");function rn(e){const t=e.dir||e.root||"",r=e.base||(e.name||"")+(e.ext||"");return t?t.endsWith("/")?t+r:t+"/"+r:r||"."}i(rn,"_format");function nn(e){return e}i(nn,"_toNamespacedPath");const I={sep:Y0,delimiter:Hr,normalize:J0,join:Qr,resolve:It,isAbsolute:dt,relative:en,dirname:Z0,basename:K0,extname:q0,parse:tn,format:rn,toNamespacedPath:nn,posix:null,win32:null};I.posix=I;const nt={get sep(){return O?$().sep:I.sep},get delimiter(){return O?$().delimiter:I.delimiter},normalize:i((...e)=>O?$().normalize(...e):I.normalize(...e),"normalize"),join:i((...e)=>O?$().join(...e):I.join(...e),"join"),resolve:i((...e)=>O?$().resolve(...e):I.resolve(...e),"resolve"),isAbsolute:i((...e)=>O?$().isAbsolute(...e):I.isAbsolute(...e),"isAbsolute"),relative:i((...e)=>O?$().relative(...e):I.relative(...e),"relative"),dirname:i((...e)=>O?$().dirname(...e):I.dirname(...e),"dirname"),basename:i((...e)=>O?$().basename(...e):I.basename(...e),"basename"),extname:i((...e)=>O?$().extname(...e):I.extname(...e),"extname"),parse:i((...e)=>O?$().parse(...e):I.parse(...e),"parse"),format:i((...e)=>O?$().format(...e):I.format(...e),"format"),toNamespacedPath:i((...e)=>O?$().toNamespacedPath(...e):I.toNamespacedPath(...e),"toNamespacedPath"),posix:null,win32:null};nt.posix=nt;const on=new Proxy({},{get(){throw new Error("POSIX-only path module: use the named export `posix` with your VFS.")}});nt.win32=on;const K=nt,gt=.01,u0="src/tests/fixtures/sketchSolverTopology";function Y(e,t){if(!e)throw new Error(t)}i(Y,"assert$k");function ot(e,t){const r=e.points.find(n=>Number(n.id)===Number(t));if(!r)throw new Error(`Point ${t} not found`);return r}i(ot,"getPoint$1");function an(e,t){const r=e.constraints.find(n=>Number(n.id)===Number(t));if(!r)throw new Error(`Constraint ${t} not found`);return r}i(an,"getConstraint$1");function f0(e,t,r){const n=ot(e,t),o=ot(e,r);return Math.hypot(o.x-n.x,o.y-n.y)}i(f0,"dist$1");function p0(e,t){const r=t.map(o=>ot(e,o));let n=0;for(let o=0;o<r.length;o++){const a=r[o],s=r[(o+1)%r.length];n+=a.x*s.y-s.x*a.y}return n*.5}i(p0,"signedArea$1");function m0(e){const t=(e.points||[]).map(o=>Number(o.id)).sort((o,a)=>o-a),r=(e.geometries||[]).map(o=>({id:Number(o.id),type:String(o.type),construction:!!o.construction,points:(o.points||[]).map(a=>Number(a))})).sort((o,a)=>o.id-a.id),n=(e.constraints||[]).map(o=>({id:Number(o.id),type:String(o.type),points:(o.points||[]).map(a=>Number(a))})).sort((o,a)=>o.id-a.id);return{pointIds:t,geometries:r,constraints:n}}i(m0,"topologySnapshot$1");function sn(e,t){const r=new Set((e.points||[]).map(n=>Number(n.id)));for(const n of e.geometries||[])for(const o of n.points||[])Y(r.has(Number(o)),`${t}: geometry ${n.id} references missing point ${o}`);for(const n of e.constraints||[])for(const o of n.points||[])Y(r.has(Number(o)),`${t}: constraint ${n.id} references missing point ${o}`)}i(sn,"assertTopologyIntegrity$1");function cn(e,t="fixture"){const r=String(e||"").trim();return r&&r.toLowerCase().replace(/[^a-z0-9._-]+/g,"_").replace(/^_+|_+$/g,"").slice(0,120)||t}i(cn,"sanitizeName");function yt(e,t,r,n){if(!Number.isFinite(e)||!Number.isFinite(t)||Math.abs(e-t)>r)throw new Error(`${n}. Expected ${t}, got ${e}`)}i(yt,"assertNear$1");function ln(e,t={}){if(typeof e!="string"||!e.trim())return null;const r=Object.keys(t||{}),n=r.map(o=>Number(t[o]));if(!n.every(o=>Number.isFinite(o)))return null;try{const a=Function(...r,`"use strict"; return (${e});`)(...n),s=Number(a);return Number.isFinite(s)?s:null}catch{return null}}i(ln,"evaluateExpressionWithVars");function H0(e,{maxPasses:t=8,stopWhenConstraintsClear:r=!0}={}){const n=Math.max(1,Number(t)||1);let o=null;for(let a=0;a<n;a++){e.solveSketch("full");const s=e.sketchObject,c=JSON.stringify(s?.points||[]),l=Array.isArray(s?.constraints)?s.constraints.some(d=>typeof d?.error=="string"&&d.error.length>0):!1;if(r&&!l||c===o)break;o=c}}i(H0,"solveWithSettle");function dn(e,t,r){const n=t&&typeof t=="object"?t:null;if(!n)throw new Error(`${r}: expressionValues edit requires an object`);for(const o of e.sketchObject?.constraints||[]){if(typeof o?.valueExpr!="string"||!o.valueExpr.length)continue;const a=ln(o.valueExpr,n);if(!Number.isFinite(a))continue;const s=o?.type==="⟺"&&o?.displayStyle==="diameter"&&o?.valueExprMode==="diameter";o.value=s?Number(a)*.5:Number(a)}}i(dn,"applyExpressionValuesToConstraints");function un(e,t,r){for(const n of t||[])if(!(!n||typeof n!="object")){if(Object.prototype.hasOwnProperty.call(n,"expressionValues"))dn(e,n.expressionValues,r);else{const o=Number(n.constraintId),a=Number(n.value);if(!Number.isFinite(o))throw new Error(`${r}: edit has invalid constraintId`);if(!Number.isFinite(a))throw new Error(`${r}: edit for constraint ${o} has invalid value`);const s=an(e.sketchObject,o);s.value=a}H0(e,{maxPasses:Number.isFinite(Number(n.maxPasses))?Number(n.maxPasses):8,stopWhenConstraintsClear:n.stopWhenConstraintsClear!==!1})}}i(un,"applyEdits");function fn({before:e,after:t,expect:r,contextLabel:n}){if(sn(t,n),r?.topologyUnchanged!==!1){const a=JSON.stringify(m0(e)),s=JSON.stringify(m0(t));Y(a===s,`${n}: topology changed`)}for(const a of r?.distances||[]){const s=Number(a.a),c=Number(a.b),l=Number(a.value),d=Number.isFinite(Number(a.tol))?Number(a.tol):gt;Y(Number.isFinite(s)&&Number.isFinite(c),`${n}: invalid distance pair`),yt(f0(t,s,c),l,d,`${n}: distance [${s},${c}] mismatch`)}for(const a of r?.anchors||[]){const s=Number(a.pointId),c=Number.isFinite(Number(a.tol))?Number(a.tol):gt,l=ot(t,s);Number.isFinite(Number(a.x))&&yt(l.x,Number(a.x),c,`${n}: anchor ${s} x drift`),Number.isFinite(Number(a.y))&&yt(l.y,Number(a.y),c,`${n}: anchor ${s} y drift`)}for(const a of r?.coincidentPairs||[]){const s=Number(a.a),c=Number(a.b),l=Number.isFinite(Number(a.tol))?Number(a.tol):gt;Y(Number.isFinite(s)&&Number.isFinite(c),`${n}: invalid coincident pair`),Y(f0(t,s,c)<=l,`${n}: coincident pair [${s},${c}] broke`)}for(const a of r?.orientationLoops||[]){const s=Array.isArray(a?.pointIds)?a.pointIds.map(f=>Number(f)):[];Y(s.length>=3,`${n}: orientation loop needs at least 3 points`);const c=Number.isFinite(Number(a.minAbsArea))?Number(a.minAbsArea):1,l=p0(e,s),d=p0(t,s);Y(Math.abs(d)>c,`${n}: loop collapsed`),a.preserveSign!==!1&&Y(Math.sign(d)===Math.sign(l),`${n}: loop orientation flipped`)}}i(fn,"runExpectations");async function pn(e,t){const n=`sketch fixture ${e?.name||K.basename(t)}`;Y(e&&typeof e=="object",`${n}: fixture is not an object`),Y(Array.isArray(e.edits),`${n}: missing edits array`);let o=null;if(e.sketch&&typeof e.sketch=="object")o=e.sketch;else if(typeof e.sourcePartFile=="string"&&e.sourcePartFile.trim().length){const l=e.sourcePartFile.trim(),d=await b.promises.readFile(l,"utf8"),f=JSON.parse(d),u=Array.isArray(f?.features)?f.features:[];let p=null;if(e.sourceFeatureId!=null){const m=String(e.sourceFeatureId);p=u.find(h=>h?.type==="S"&&(String(h?.inputParams?.id??"")===m||String(h?.inputParams?.featureID??"")===m))||null}p||(p=u.find(m=>m?.type==="S"&&m?.persistentData?.sketch)||null),o=p?.persistentData?.sketch||null}Y(o&&typeof o=="object",`${n}: missing sketch or sourcePartFile sketch`);const a=new L0({sketch:JSON.parse(JSON.stringify(o))});H0(a,{maxPasses:Number.isFinite(Number(e.initialSolvePasses))?Number(e.initialSolvePasses):4,stopWhenConstraintsClear:!0});const s=JSON.parse(JSON.stringify(a.sketchObject));un(a,e.edits,n);const c=a.sketchObject;fn({before:s,after:c,expect:e.expect||{},contextLabel:n})}i(pn,"runFixture");async function mn(e){if(!(typeof process<"u"&&process.versions&&process.versions.node))return 0;const t=new Set((e||[]).map(a=>a?._sourceFile).filter(a=>typeof a=="string"&&a.length>0));let r=[];try{r=await b.promises.readdir(u0)}catch{return 0}const n=r.filter(a=>typeof a=="string"&&a.toLowerCase().endsWith(".json")).sort((a,s)=>a.localeCompare(s));let o=0;for(const a of n){const s=K.join(u0,a);if(t.has(s))continue;let c=null;try{const p=await b.promises.readFile(s,"utf8");c=JSON.parse(p)}catch(p){const m=p?.message||String(p);throw new Error(`Failed to read sketch fixture ${s}: ${m}`)}const l=String(a).replace(/\.[^.]+$/,""),f=`test_sketch_solver_fixture_${cn(c?.name||l,`fixture_${o}`)}`,u=i(async function(){await pn(c,s)},"sketchSolverFixtureTest");try{Object.defineProperty(u,"name",{value:f,configurable:!0})}catch{}e.push({test:u,printArtifacts:!1,exportFaces:!1,exportSolids:!1,resetHistory:!0,_sourceFile:s}),t.add(s),o+=1}return o}i(mn,"registerSketchSolverTopologyFixtureTests");async function hn(e){const t=await e.newFeature("P.CO");t.inputParams.radiusTop=3,t.inputParams.radiusBottom=.5,t.inputParams.height=5.2,t.inputParams.resolution=20;const r=await e.newFeature("P.CU");r.inputParams.sizeX=2,r.inputParams.sizeY=2,r.inputParams.sizeZ=20;const n=await e.newFeature("B");return n.inputParams.targetSolid=r.inputParams.featureID,n.inputParams.boolean={targets:[t.inputParams.featureID],operation:"SUBTRACT"},e}i(hn,"test_boolean_subtract");async function xn(e){const t=await e.newFeature("P.CU");t.inputParams.sizeX=10,t.inputParams.sizeY=10,t.inputParams.sizeZ=10;const r=await e.newFeature("P.CU");return r.inputParams.sizeX=10,r.inputParams.sizeY=10,r.inputParams.sizeZ=10,r.inputParams.transform={position:[5,0,0],rotationEuler:[0,0,0],scale:[1,1,1]},r.inputParams.boolean={operation:"UNION",targets:[t.inputParams.featureID]},e}i(xn,"test_boolean_operation_target_name_preserved");async function gn(e){const t=(e?.features||[]).filter(c=>c?.type==="P.CU");if(t.length<2)throw new Error("[boolean target name] Expected at least two primitive cube features.");const r=t[0]?.inputParams?.featureID,n=t[1]?.inputParams?.featureID;if(!r||!n)throw new Error("[boolean target name] Missing feature IDs for cube setup.");const o=(e?.scene?.children||[]).filter(c=>c?.type==="SOLID");if(o.length!==1)throw new Error(`[boolean target name] Expected exactly one solid after union, got ${o.length}.`);const a=o[0];if(String(a?.name||"")!==String(r))throw new Error(`[boolean target name] Expected result name "${r}", got "${String(a?.name||"")}".`);if(e?.scene?.getObjectByName?.(n))throw new Error(`[boolean target name] Tool-named solid "${n}" should have been replaced.`)}i(gn,"afterRun_boolean_operation_target_name_preserved");function vt(e,t){if(!e)throw new Error(t||"Assertion failed.")}i(vt,"assert$j");async function yn(){const e=new J.Cube({x:10,y:10,z:10,name:"BASE"}),t=new J.Cube({x:6,y:6,z:6,name:"TOOL"});e.setFaceMetadata("BASE_NX",{sourceFeatureId:"BASE_FEATURE",marker:"base-nx"}),t.setFaceMetadata("TOOL_PX",{sourceFeatureId:"TOOL_FEATURE",marker:"tool-px"}),t.bakeTRS({position:[7,2,2],rotationEuler:[0,0,0],scale:[1,1,1]}),e.union=()=>{throw new Error("forced union failure for metadata fallback test")};const r={scene:{getObjectByName(){return null}}},n=await J.applyBooleanOperation(r,e,{operation:"UNION",targets:[t]},"BOOL_META"),o=Array.isArray(n?.added)?n.added[0]:null;vt(o,"Expected boolean to return a result solid.");const a=o.getFaceMetadata("BASE_NX");vt(a&&a.sourceFeatureId==="BASE_FEATURE","Base face provenance should survive union fallback."),vt(a&&a.marker==="base-nx","Base face custom metadata should survive union fallback.")}i(yn,"test_boolean_face_metadata_preserved");function Z(e,t){if(!e)throw new Error(t||"Assertion failed.")}i(Z,"assert$i");function Wt(e,t,r=0){const n=typeof e?.getFace=="function"?e.getFace(t):[];let o=Number.POSITIVE_INFINITY;for(const a of n)for(const s of[a?.p1,a?.p2,a?.p3])!Array.isArray(s)||s.length<3||(o=Math.min(o,Number(s[r])));return o}i(Wt,"faceAxisMin");function vn(e,t,r=0){const n=typeof e?.getFace=="function"?e.getFace(t):[];let o=Number.NEGATIVE_INFINITY;for(const a of n)for(const s of[a?.p1,a?.p2,a?.p3])!Array.isArray(s)||s.length<3||(o=Math.max(o,Number(s[r])));return o}i(vn,"faceAxisMax");function Q0(e,t){const r=new J.Cube({x:1,y:1,z:1,name:e}),n=new J.Cube({x:1,y:1,z:1,name:t});return n.bakeTRS({position:[1,0,0],rotationEuler:[0,0,0],scale:[1,1,1]}),{base:r,tool:n}}i(Q0,"makeTouchingCubePair");function Vt(){return{scene:{getObjectByName(){return null}}}}i(Vt,"makeFakePartHistory");async function er(e){const{base:t,tool:r}=Q0("BASE","TOOL"),n=Object.getPrototypeOf(t),o=n.union;let a=null;n.union=i(function(c){return a===null&&(a=Wt(c,"TOOL_NX",0)),o.call(this,c)},"patchedUnion");try{await J.applyBooleanOperation(Vt(),t,{operation:"UNION",targets:[r],...e},"BOOL_OVERLAP_UNION")}finally{n.union=o}return a}i(er,"captureUnionOperandMinX");async function tr(e){const{base:t,tool:r}=Q0("TARGET","CUTTER"),n=Object.getPrototypeOf(t),o=n.subtract;let a=null;n.subtract=i(function(c){return a===null&&(a=Wt(c,"CUTTER_NX",0)),o.call(this,c)},"patchedSubtract");try{await J.applyBooleanOperation(Vt(),r,{operation:"SUBTRACT",targets:[t],...e},"BOOL_OVERLAP_SUBTRACT")}finally{n.subtract=o}return a}i(tr,"captureSubtractOperandMinX");async function wn(e){const t=new J.Cube({x:1,y:1,z:1,name:"TARGET_Z"}),r=new J.Cube({x:1,y:1,z:2,name:"CUTTER_Z"}),n=Object.getPrototypeOf(t),o=n.subtract;let a=null,s=null;n.subtract=i(function(l){return a===null&&(a=Wt(l,"CUTTER_Z_NZ",2),s=vn(l,"CUTTER_Z_NZ",2)),o.call(this,l)},"patchedSubtract");try{await J.applyBooleanOperation(Vt(),r,{operation:"SUBTRACT",targets:[t],...e},"BOOL_OVERLAP_SUBTRACT_CAP")}finally{n.subtract=o}return{observedMinZ:a,observedMaxZ:s}}i(wn,"captureSubtractOperandMinZForEntryCap");async function _n(){const e=await er({});Z(Number.isFinite(e),"Expected union test to observe the conditioned tool face."),Z(e<1-1e-7,`Expected default union conditioning to push TOOL_NX into the base solid, got minX=${e}`)}i(_n,"test_boolean_overlap_conditioning_union_enabled_by_default");async function En(){const e=await er({overlapConditioningEnabled:!1});Z(Number.isFinite(e),"Expected disabled union test to observe the tool face."),Z(Math.abs(e-1)<=1e-12,`Expected disabled union conditioning to leave TOOL_NX at x=1, got minX=${e}`)}i(En,"test_boolean_overlap_conditioning_union_can_be_disabled");async function bn(){const e=await tr({});Z(Number.isFinite(e),"Expected subtract test to observe the conditioned cutter face."),Z(e<1-1e-7,`Expected default subtract conditioning to push CUTTER_NX into the target solid, got minX=${e}`)}i(bn,"test_boolean_overlap_conditioning_subtract_enabled_by_default");async function Sn(){const{observedMinZ:e,observedMaxZ:t}=await wn({});Z(Number.isFinite(e)&&Number.isFinite(t),"Expected subtract cap test to observe the conditioned cutter cap face."),Z(e<0-1e-7,`Expected subtract conditioning to expand CUTTER_Z_NZ outward beyond z=0, got minZ=${e}`),Z(Math.abs(t-e)<=1e-12,`Expected CUTTER_Z_NZ to remain planar after conditioning, got minZ=${e}, maxZ=${t}`)}i(Sn,"test_boolean_overlap_conditioning_subtract_expands_tool_entry_cap_outward");async function Pn(){const e=await tr({overlapConditioningEnabled:!1});Z(Number.isFinite(e),"Expected disabled subtract test to observe the cutter face."),Z(Math.abs(e-1)<=1e-12,`Expected disabled subtract conditioning to leave CUTTER_NX at x=1, got minX=${e}`)}i(Pn,"test_boolean_overlap_conditioning_subtract_can_be_disabled");async function Fn(e){const t=await e.newFeature("P.CU");t.inputParams.sizeX=20,t.inputParams.sizeY=20,t.inputParams.sizeZ=20;const r=await e.newFeature("CHAMFER");return r.inputParams.edges=[`${t.inputParams.featureID}_PZ`],r.inputParams.distance=3,r.inputParams.inflate=5e-4,r.inputParams.direction="INSET",e}i(Fn,"test_Chamfer");function ut(e,t){const r=e[0]-t[0],n=e[1]-t[1],o=e[2]-t[2];return r*r+n*n+o*o}i(ut,"pointDistanceSq");function me(e,t,r=1e-12){if(ut(e,t)>r*r)throw new Error(`Expected point ${JSON.stringify(e)} near ${JSON.stringify(t)} (eps=${r})`)}i(me,"assertPointNear");async function An(){const e=[[0,0,0],[1,.35,0],[2,-.5,0],[3,.45,0],[4,0,0]],t=i0(e,{fitStrength:1});if(!Array.isArray(t)||t.length!==e.length)throw new Error("Curve fit should return one output point per input point.");if(me(t[0],e[0],1e-12),me(t[t.length-1],e[e.length-1],1e-12),jt(e,t))throw new Error("Fitted polyline should not locally reverse direction against the source edge.");let r=0;for(let o=1;o<e.length-1;o++)ut(e[o],t[o])>1e-12&&r++;if(r<=0)throw new Error("At least one interior point should be snapped to the fitted curve.");const n=i0(e,{fitStrength:0});for(let o=0;o<e.length;o++)me(n[o],e[o],1e-12)}i(An,"test_edge_smooth_curve_fit");function In(e,t){const r=Array.isArray(e)?e:[],n=Array.isArray(t)?t:[],o=r.length;if(o!==n.length||o<3)return!0;for(let a=0;a<o;a++){const s=(a+1)%o,c=r[a],l=r[s],d=n[a],f=n[s],u=[l[0]-c[0],l[1]-c[1],l[2]-c[2]],p=[f[0]-d[0],f[1]-d[1],f[2]-d[2]],m=Math.hypot(u[0],u[1],u[2]),h=Math.hypot(p[0],p[1],p[2]);if(!(m>1e-12)||!(h>1e-12))continue;if((u[0]*p[0]+u[1]*p[1]+u[2]*p[2])/(m*h)<-1e-6)return!0}return!1}i(In,"hasLocalBacktrackingAgainstSourceClosed");async function Tn(){const e=[[1,0,0],[.45,.95,.02],[-.55,.8,-.03],[-1,0,0],[-.45,-.85,.03],[.55,-.75,-.02]],t=c0(e,{fitStrength:1});if(!Array.isArray(t)||t.length!==e.length)throw new Error("Closed-loop curve fit should return one output point per input point.");if(In(e,t))throw new Error("Closed-loop fitted polyline should not locally reverse direction.");let r=0;for(let o=0;o<e.length;o++)ut(e[o],t[o])>1e-12&&r++;if(r<=0)throw new Error("Closed-loop fit should move at least one loop point.");const n=c0(e,{fitStrength:0});for(let o=0;o<e.length;o++)me(n[o],e[o],1e-12)}i(Tn,"test_edge_smooth_curve_fit_closed_loop");async function Nn(){const e=[0,0,0,1,0,0,1,1,0,0,1,0],t=[0,1,2,0,2,3],r=new Map;r.set(1,{x:.2,y:.8,z:0,count:1});const n=Cr(e,t,r,{minArea2Ratio:.04,minNormalDot:.1,minArea2Abs:1e-24});if((Number(n?.movedVertices)||0)!==1)throw new Error("Constrained edge smoothing should move the target vertex.");if((Number(n?.constrainedVertices)||0)<=0)throw new Error("Constrained edge smoothing should scale back fold-causing targets.");const o=e[3],a=e[4];if(!Number.isFinite(o)||!Number.isFinite(a))throw new Error("Constrained edge smoothing produced invalid coordinates.");if(Math.abs(o-.2)<1e-9&&Math.abs(a-.8)<1e-9)throw new Error("Constrained smoothing should not apply a fold-causing target at full displacement.");const s=i((c,l,d)=>{const f=c*3,u=l*3,p=d*3,m=e[u+0]-e[f+0],h=e[u+1]-e[f+1],x=e[p+0]-e[f+0],y=e[p+1]-e[f+1];return m*y-h*x},"triNormalZ");if(!(s(0,1,2)>0))throw new Error("Primary triangle normal flipped after constrained smoothing.");if(!(s(0,2,3)>0))throw new Error("Adjacent triangle normal flipped after constrained smoothing.")}i(Nn,"test_edge_smooth_constraints_prevent_triangle_foldback");function rr(e){const t=Array.isArray(e)?e.map(o=>[o[0],o[1],o[2]]):[],r=[];for(const o of t)r.push(o[0],o[1],o[2]);const n=i((o,a)=>{const s=o.slice(),c=a.map(u=>[u[0],u[1],u[2]]),l={type:"EDGE",name:"MOCK_EDGE_0",userData:{faceA:"FACE_A",faceB:"FACE_B",polylineLocal:c.map(u=>[u[0],u[1],u[2]])},parent:null,parentSolid:null},d={type:"SOLID",name:"MOCK_SOLID",_vertProperties:s,_triVerts:[0,1,2,0,2,3,0,3,4],_triIDs:[0,0,0],_vertKeyToIndex:new Map,_dirty:!1,_faceIndex:null,_manifold:null,traverse(u){typeof u=="function"&&u(l)},visualize(){},_manifoldize(){},getBoundaryEdgePolylines(){return[{name:l.name,faceA:l.userData.faceA,faceB:l.userData.faceB,indices:[0,1,2,3,4],positions:c.map(u=>[u[0],u[1],u[2]]),closedLoop:!1}]},clone(){return n(s,c)}},f={type:"FACE",name:"MOCK_FACE_0",edges:[l],parent:d,parentSolid:d,userData:{faceName:"MOCK_FACE_0"}};return l.parent=d,l.parentSolid=d,d.__testFace=f,d},"createSolid");return n(r,t)}i(rr,"makeMockSolidFromPolyline");async function Mn(){const e=[[0,0,0],[1,.4,0],[2,-.45,0],[3,.35,0],[4,0,0]],t=rr(e),r=new z0;r.inputParams={edges:[t],fitStrength:1,id:"EDGE_SMOOTH_SOLID_TEST"};const n=await r.run();if(!n||!Array.isArray(n.added)||n.added.length!==1)throw new Error("EdgeSmoothFeature should add one smoothed solid when selecting a whole solid.");if(!Array.isArray(n.removed)||n.removed.length!==1||n.removed[0]!==t)throw new Error("EdgeSmoothFeature should remove exactly the selected source solid.");const o=n.added[0],a=Array.isArray(o?._vertProperties)?o._vertProperties:[];if(a.length<15)throw new Error("Smoothed solid is missing expected vertex properties.");const s=[];for(let l=0;l<5;l++){const d=l*3;s.push([a[d+0],a[d+1],a[d+2]])}if(me(s[0],e[0],1e-12),me(s[s.length-1],e[e.length-1],1e-12),jt(e,s))throw new Error("Whole-solid smoothing should not create local edge backtracking.");let c=0;for(let l=1;l<e.length-1;l++)ut(e[l],s[l])>1e-12&&c++;if(c<=0)throw new Error("Whole-solid smoothing should move at least one interior edge point.");if(!r.persistentData||r.persistentData.selectedSolidCount<1)throw new Error("Feature metadata should record at least one selected solid.")}i(Mn,"test_edge_smooth_whole_solid_selection");async function Dn(){const e=[[0,0,0],[1,.3,0],[2,-.35,0],[3,.25,0],[4,0,0]],t=rr(e),r=t.__testFace;if(!r||r.type!=="FACE")throw new Error("Mock setup should provide a face selection target.");const n=new z0;n.inputParams={edges:[r],fitStrength:1,id:"EDGE_SMOOTH_FACE_TEST"};const o=await n.run();if(!o||!Array.isArray(o.added)||o.added.length!==1)throw new Error("EdgeSmoothFeature should add one smoothed solid when selecting a face.");if(!Array.isArray(o.removed)||o.removed.length!==1||o.removed[0]!==t)throw new Error("EdgeSmoothFeature should remove exactly the source solid for face selection.");const a=o.added[0],s=Array.isArray(a?._vertProperties)?a._vertProperties:[];if(s.length<15)throw new Error("Face-selected smoothing output is missing expected vertex properties.");const c=[];for(let l=0;l<5;l++){const d=l*3;c.push([s[d+0],s[d+1],s[d+2]])}if(me(c[0],e[0],1e-12),me(c[c.length-1],e[e.length-1],1e-12),jt(e,c))throw new Error("Face-selected smoothing should not create local edge backtracking.");if(!n.persistentData||n.persistentData.selectedFaceCount<1)throw new Error("Feature metadata should record at least one selected face.")}i(Dn,"test_edge_smooth_face_selection");const Tt=-4,Nt=15.7,Ge=1e-4,Cn=i(()=>({points:[{id:0,x:-2,y:-2,fixed:!0},{id:1,x:2,y:-2,fixed:!1},{id:2,x:2,y:2,fixed:!1},{id:3,x:-2,y:2,fixed:!1}],geometries:[{id:100,type:"line",points:[0,1],construction:!1},{id:101,type:"line",points:[1,2],construction:!1},{id:102,type:"line",points:[2,3],construction:!1},{id:103,type:"line",points:[3,0],construction:!1}],constraints:[{id:0,type:"⏚",points:[0]}]}),"makeRectSketch$1");function On(e){const r=e?.geometry?.getAttribute?.("position");if(!r)return[];const n=[],o=new L;for(let a=0;a<r.count;a++)o.set(r.getX(a),r.getY(a),r.getZ(a)).applyMatrix4(e.matrixWorld),n.push([o.x,o.y,o.z]);return n}i(On,"collectWorldVerticesFromFaceObject");function h0(e){const t=[];for(const r of Array.isArray(e)?e:[])Array.isArray(r?.p1)&&t.push(r.p1),Array.isArray(r?.p2)&&t.push(r.p2),Array.isArray(r?.p3)&&t.push(r.p3);return t}i(h0,"collectTriangleVertices");function x0(e,t,r){let n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,a=0,s=0;for(const c of e){const d=c[0]*t.x+c[1]*t.y+c[2]*t.z-r;d<n&&(n=d),d>o&&(o=d),a+=d,s+=1}return{mean:s?a/s:0,spread:s?o-n:0,count:s}}i(x0,"analyzeProjectedOffsets");async function kn(e){const t=await e.newFeature("P");t.inputParams.orientation="XY";const r=await e.newFeature("S");r.inputParams.sketchPlane=t.inputParams.featureID,r.persistentData.sketch=Cn();const n=await e.newFeature("E");return n.inputParams.profile=r.inputParams.featureID,n.inputParams.consumeProfileSketch=!1,n.inputParams.distance=Tt,n.inputParams.distanceBack=Nt,e}i(kn,"test_extrude_negative_distance_cap_alignment");async function Rn(e){const t=e.features.find(h=>h?.type==="E"),r=e.features.find(h=>h?.type==="S");if(!t?.inputParams?.featureID)throw new Error("[extrude-negative] missing extrude feature id");if(!r?.inputParams?.featureID)throw new Error("[extrude-negative] missing sketch feature id");const n=e.scene.getObjectByName(t.inputParams.featureID);if(!n||typeof n.getFaces!="function")throw new Error("[extrude-negative] extrude solid missing from scene");const o=e.scene.getObjectByName(r.inputParams.featureID),a=o?.children?.find?.(h=>h?.type==="FACE")||o?.children?.find?.(h=>h?.userData?.faceName);if(!a||typeof a.getAverageNormal!="function")throw new Error("[extrude-negative] profile face missing from sketch");const s=a.getAverageNormal().clone();if(s.lengthSq()<1e-20)throw new Error("[extrude-negative] profile normal is degenerate");s.normalize();const c=On(a);if(!c.length)throw new Error("[extrude-negative] profile face has no vertices");const l=c.reduce((h,x)=>h+x[0]*s.x+x[1]*s.y+x[2]*s.z,0)/c.length,d=n.getFaces(!1),f=d.find(h=>String(h?.faceName||"").endsWith("_START")),u=d.find(h=>String(h?.faceName||"").endsWith("_END"));if(!f||!u){const h=d.map(x=>String(x?.faceName||""));throw new Error(`[extrude-negative] missing start/end caps. Faces: ${h.join(", ")}`)}const p=x0(h0(f.triangles),s,l),m=x0(h0(u.triangles),s,l);if(p.count===0||m.count===0)throw new Error("[extrude-negative] cap triangles are empty");if(p.spread>Ge)throw new Error(`[extrude-negative] start cap not planar on expected axis (spread=${p.spread})`);if(m.spread>Ge)throw new Error(`[extrude-negative] end cap not planar on expected axis (spread=${m.spread})`);if(Math.abs(p.mean- -Nt)>Ge)throw new Error(`[extrude-negative] start cap offset mismatch: got ${p.mean}, expected ${-Nt}`);if(Math.abs(m.mean-Tt)>Ge)throw new Error(`[extrude-negative] end cap offset mismatch: got ${m.mean}, expected ${Tt}`)}i(Rn,"afterRun_extrude_negative_distance_cap_alignment");function Ce(e,t){if(!e)throw new Error(t||"Assertion failed.")}i(Ce,"assert$h");async function $n(e){const t=await e.newFeature("P.CY"),r=String(t?.inputParams?.featureID||"");Ce(r,"Cylinder feature should have a featureID."),await e.runHistory();const n=e?.scene?.getObjectByName?.(r)||null;Ce(n,"Expected cylinder solid in the scene."),Ce(typeof n.getFaceMetadata=="function","Expected solid face metadata API.");const o=n.getFaceMetadata(`${r}_S`),a=n.getFaceMetadata(`${r}_T`);Ce(o?.sourceFeatureId===r,"Cylinder side face should be seeded with sourceFeatureId."),Ce(a?.sourceFeatureId===r,"Cylinder top face should be seeded with sourceFeatureId.")}i($n,"test_face_source_feature_seed");async function Bn(e){const t=await e.newFeature("P.CO");t.inputParams.radiusTop=3,t.inputParams.radiusBottom=.5,t.inputParams.height=5.2,t.inputParams.resolution=20;const r=await e.newFeature("E");return r.inputParams.profile=`${t.inputParams.featureID}_T`,r.inputParams.distance=0,r.inputParams.distanceBack=5,r.inputParams.boolean={targets:[t.inputParams.featureID],operation:"UNION"},e}i(Bn,"test_ExtrudeFace");async function Ln(e){const t=await e.newFeature("P.CY");t.inputParams.radius=5,t.inputParams.height=10,t.inputParams.resolution=48;const r=await e.newFeature("F");return r.inputParams.edges=[`${t.inputParams.featureID}_T`],r.inputParams.radius=1,r.inputParams.direction="INSET",e}i(Ln,"test_Fillet");const zn="src/tests/partFiles/fillet_angle_test.BREP.json";async function jn(e){const t=await b.promises.readFile(zn,"utf8");return await e.reset(),await e.fromJSON(t),e.expressions=`//Examples:
4
4
  angle = 35;`,e.currentHistoryStepId="E2",e}i(jn,"test_fillet_angle");async function Un(e){const t=e.features.find(l=>l?.type==="F");if(!t)throw new Error("Fillet feature missing from part file.");const n=(Array.isArray(t.inputParams?.edges)?t.inputParams.edges:[]).find(l=>typeof l=="string")||null;if(!n)throw new Error("Fillet edge name not found in test part file.");const o=e.getObjectByName(n);if(!o)throw new Error(`Edge object "${n}" not found after extrude.`);const a=Number(t.inputParams?.radius)||2,s=String(t.inputParams?.direction||"INSET").toUpperCase(),c=X0(o,a,s);if(!Array.isArray(c.points)||!Array.isArray(c.edge))throw new Error("computeFilletCenterline should return point arrays.");if(!Array.isArray(c.tangentA)||!Array.isArray(c.tangentB))throw new Error("computeFilletCenterline should return tangent arrays.");console.log(`✓ Fillet angle tangent test passed: points=${c.points.length}, tangentsA=${c.tangentA.length}, tangentsB=${c.tangentB.length}`)}i(Un,"afterRun_fillet_angle");const Wn="src/tests/partFiles/fillet_test.BREP.json";async function Vn(e){const t=await b.promises.readFile(Wn,"utf8");return await e.reset(),await e.fromJSON(t),e.currentHistoryStepId="E7",e}i(Vn,"test_fillet_edge_degenerate_segment");async function Xn(e){const t=e.features.find(l=>l?.type==="F");if(!t)throw new Error("Fillet feature missing from part file.");const r=Array.isArray(t.inputParams?.edges)?t.inputParams.edges[0]:null;if(!r)throw new Error("Fillet edge reference missing from part file.");const n=typeof r=="object"?r:e.getObjectByName(String(r));if(!n)throw new Error(`Fillet source edge not found: ${String(r)}`);const o=[.5,.675,1],a=o.map(l=>({radius:l,res:X0(n,l,"INSET")}));for(const{radius:l,res:d}of a){if(!Array.isArray(d.points)||!Array.isArray(d.edge))throw new Error(`computeFilletCenterline should provide point arrays (radius=${l}).`);if(d.points.length<2)throw new Error(`computeFilletCenterline should produce at least 2 points (radius=${l}).`);let f=1/0,u=0;for(let p=1;p<d.points.length;p++){const m=d.points[p-1],h=d.points[p],x=Math.hypot(h.x-m.x,h.y-m.y,h.z-m.z);x<f&&(f=x),x>u&&(u=x)}if(Number.isFinite(f)&&Number.isFinite(u)&&u>0&&f<u*1e-5)throw new Error(`Fillet centerline contains a degenerate segment at radius=${l}: minSeg=${f}, maxSeg=${u}`)}const s=a.map(({res:l})=>l.points.length);if(!s.every(l=>l===s[0]))throw new Error(`Degenerate-edge sampling changed with radius: pointCounts=${JSON.stringify(s)}`);console.log(`✓ Fillet degenerate-edge tangent test passed: radii=${o.join(", ")}, points=${s.join(",")}`)}i(Xn,"afterRun_fillet_edge_degenerate_segment");const Yn="src/tests/partFiles/medium_fillets.BREP.json",Mt="E2",Gn="F3";function g0(e,t){const r=(e?.scene?.children||[]).filter(n=>n?.type==="SOLID");return r.find(n=>String(n?.name||"")===String(t))||r[0]||null}i(g0,"getSolidByName$1");async function Jn(e){const t=await b.promises.readFile(Yn,"utf8");return await e.reset(),await e.fromJSON(t),e.currentHistoryStepId=Mt,e}i(Jn,"test_fillet_preserves_original_face_names");async function Zn(e){const t=g0(e,Mt);if(!t||typeof t.getFaceNames!="function")throw new Error("[fillet face-name preserve] Failed to resolve pre-fillet solid.");const r=(t.getFaceNames()||[]).map(s=>String(s||"").trim()).filter(s=>s.length>0);if(r.length===0)throw new Error("[fillet face-name preserve] Pre-fillet solid has no face names.");e.currentHistoryStepId=Gn,await e.runHistory();const n=g0(e,Mt);if(!n||typeof n.getFaceNames!="function")throw new Error("[fillet face-name preserve] Failed to resolve post-fillet solid.");const o=new Set((n.getFaceNames()||[]).map(s=>String(s||"").trim()).filter(s=>s.length>0)),a=r.filter(s=>!o.has(s));if(a.length>0)throw new Error(`[fillet face-name preserve] Lost ${a.length} original face names: ${a.join(", ")}`);console.log(`✓ Fillet preserved ${r.length} original face names on ${String(n?.name||"solid")}.`)}i(Zn,"afterRun_fillet_preserves_original_face_names");async function Kn(e){const t=await e.newFeature("P.CU");t.inputParams.sizeX=10,t.inputParams.sizeY=10,t.inputParams.sizeZ=10;const r=await e.newFeature("F");return r.inputParams.edges=[`${t.inputParams.featureID}_NX|${t.inputParams.featureID}_NY[0]`,`${t.inputParams.featureID}_NX|${t.inputParams.featureID}_PZ[0]`,`${t.inputParams.featureID}_NX|${t.inputParams.featureID}_PY[0]`],r.inputParams.radius=1.2,r.inputParams.direction="INSET",r.inputParams.resolution=32,e}i(Kn,"test_fillet_corner_bridge");async function qn(e){const t=e.features.find(a=>a?.type==="F");if(!t)throw new Error("Fillet feature missing from history.");const r=t?.persistentData?.miterSummary||null;if(!r||typeof r!="object")throw new Error("Fillet corner bridge summary metadata missing.");const n=Number(r?.cornerBridgeCount||0);if(!Number.isFinite(n)||n<0)throw new Error(`Fillet corner bridge count should be a non-negative number, received ${n}.`);let o=null;for(const a of e.scene?.children||[]){if(a?.owningFeatureID===t.inputParams.featureID&&a?.type==="SOLID"){o=a;break}if(typeof a?.traverse=="function"&&a.traverse(s=>{!o&&s?.owningFeatureID===t.inputParams.featureID&&s?.type==="SOLID"&&(o=s)}),o)break}if(!o||typeof o._manifoldize!="function")throw new Error("Corner-bridge fillet did not produce a manifold-capable solid.");try{o._manifoldize()}catch(a){const s=String(a?.message||a||"Unknown manifold error");throw new Error(`Corner-bridge fillet manifoldization failed: ${s}`)}console.log(`✓ Fillet corner bridge test passed: bridges=${n}`)}i(qn,"afterRun_fillet_corner_bridge");async function Hn(e){const t=await e.newFeature("P.CU");t.inputParams.width=10,t.inputParams.height=10,t.inputParams.depth=10;const r=await e.newFeature("F");return r.inputParams.edges=[`${t.inputParams.featureID}_NX|${t.inputParams.featureID}_NY[0]`],r.inputParams.radius=.5,r.inputParams.direction="INSET",e}i(Hn,"test_Fillet_NonClosed");async function Qn(e){const t=e.features.find(a=>a?.type==="F");if(!t)throw new Error("Fillet feature missing from history");const r=t?.persistentData?.usedSheetMetalPath===!0,n=t?.persistentData?.edgeDirectionDecision||null;if(r||!n||Number(n.totalEdges||0)!==1)throw new Error("Non-closed fillet should produce a normal single-edge fillet result.");let o=0;for(const a of e.scene?.children||[])a?.owningFeatureID===t.inputParams.featureID&&a?.type==="SOLID"&&o++,typeof a?.traverse=="function"&&a.traverse(s=>{s?.owningFeatureID===t.inputParams.featureID&&s?.type==="SOLID"&&o++});if(o===0)throw new Error("Fillet feature should produce at least one solid");console.log(`✓ Non-closed fillet test passed: ${o} solid(s) created`)}i(Qn,"afterRun_Fillet_NonClosed");async function eo(e){const t=await e.newFeature("P.CO");t.inputParams.radiusTop=3,t.inputParams.radiusBottom=.5,t.inputParams.height=5.2,t.inputParams.resolution="128";const r=await e.newFeature("P.CU");r.inputParams.sizeX=5,r.inputParams.sizeY=2,r.inputParams.sizeZ=10,r.inputParams.boolean.targets=[t.inputParams.featureID],r.inputParams.boolean.operation="UNION";const n=await e.newFeature("F");n.inputParams.edges=[`${t.inputParams.featureID}_S|${r.inputParams.featureID}_PY[0]`],n.inputParams.radius=1,n.inputParams.direction="AUTO";const o=await e.newFeature("F");return o.inputParams.edges=[`${t.inputParams.featureID}_S|${t.inputParams.featureID}_T[0]`],o.inputParams.radius=1,o.inputParams.direction="AUTO",e}i(eo,"test_filletsMoreDifficult");async function to(e){return eo(e)}i(to,"test_fillets_more_dificult");async function ro(e){await e.newFeature("P.CU")}i(ro,"test_history_expand_does_not_dirty");async function no(e){const t=Array.isArray(e?.features)?e.features[0]:null;if(!t)throw new Error("Expand-state dirty test requires one feature in history.");const r=Number(t.timestamp);if(!Number.isFinite(r))throw new Error("Feature timestamp missing after initial run.");const n=t.lastRun;if(!n||n.ok!==!0)throw new Error("Feature lastRun state missing after initial run.");if(t.inputParams=t.inputParams||{},t.inputParams.__open=!0,await new Promise(o=>setTimeout(o,5)),await e.runHistory(),Number(t.timestamp)!==r)throw new Error("Expanding a feature should not mark it dirty or rerun.");if(t.lastRun!==n)throw new Error("Expanding a feature should not replace lastRun metadata.");if(t.inputParams.__open=!1,await new Promise(o=>setTimeout(o,5)),await e.runHistory(),Number(t.timestamp)!==r)throw new Error("Collapsing a feature should not mark it dirty or rerun.");if(t.lastRun!==n)throw new Error("Collapsing a feature should not replace lastRun metadata.")}i(no,"afterRun_history_expand_does_not_dirty");const wt=i((e,t,r,n,o=100)=>({points:[{id:0,x:e,y:t,fixed:!0},{id:1,x:r,y:t,fixed:!1},{id:2,x:r,y:n,fixed:!1},{id:3,x:e,y:n,fixed:!1}],geometries:[{id:o+0,type:"line",points:[0,1],construction:!1},{id:o+1,type:"line",points:[1,2],construction:!1},{id:o+2,type:"line",points:[2,3],construction:!1},{id:o+3,type:"line",points:[3,0],construction:!1}],constraints:[{id:0,type:"⏚",points:[0]}]}),"makeRectSketch"),oo=i((e,t,r,n,o=200)=>({points:[{id:0,x:e,y:t,fixed:!0},{id:1,x:r,y:n,fixed:!1}],geometries:[{id:o,type:"line",points:[0,1],construction:!1}],constraints:[{id:0,type:"⏚",points:[0]}]}),"makeLineSketch");async function ao(e){const t=await e.newFeature("D");t.inputParams.transform={position:[1,2,3],rotationEuler:[0,30,0],scale:[1,1,1]};const r=await e.newFeature("SP");r.persistentData.spline={points:[{id:"p0",position:[0,0,0],forwardDistance:1,backwardDistance:1,flipDirection:!1},{id:"p1",position:[5,2,0],forwardDistance:1,backwardDistance:1,flipDirection:!1},{id:"p2",position:[10,0,0],forwardDistance:1,backwardDistance:1,flipDirection:!1}]};const n=await e.newFeature("HX");n.inputParams.radius=2,n.inputParams.endRadius=1.5,n.inputParams.height=8,n.inputParams.turns=2,n.inputParams.resolution=32;const o=await e.newFeature("P");o.inputParams.orientation="XY";const a=await e.newFeature("P");a.inputParams.orientation="XY",a.inputParams.offset_distance=5;const s=await e.newFeature("S");s.inputParams.sketchPlane=o.inputParams.featureID,s.persistentData.sketch=wt(0,0,10,10,100);const c=await e.newFeature("S");c.inputParams.sketchPlane=a.inputParams.featureID,c.persistentData.sketch=wt(2,2,8,8,200);const l=await e.newFeature("LOFT");l.inputParams.profiles=[s.inputParams.featureID,c.inputParams.featureID];const d=await e.newFeature("S");d.inputParams.sketchPlane=o.inputParams.featureID,d.persistentData.sketch=oo(0,-5,0,5,300);const f=`${d.inputParams.featureID}:G300`,u=await e.newFeature("S");u.inputParams.sketchPlane=o.inputParams.featureID,u.persistentData.sketch=wt(4,-2,7,2,400);const p=await e.newFeature("R");p.inputParams.profile=u.inputParams.featureID,p.inputParams.axis=f,p.inputParams.angle=180,p.inputParams.resolution=32;const m=await e.newFeature("P.CU"),h=await e.newFeature("RM");h.inputParams.targetSolid=m.inputParams.featureID,h.inputParams.mode="Simplify",h.inputParams.tolerance=.05;const x=await e.newFeature("P.CU"),y=await e.newFeature("SWS");y.inputParams.targetSolid=x.inputParams.featureID,y.inputParams.subdivisionLoops=1;const g=await e.newFeature("P.CU"),v=await e.newFeature("XFORM");v.inputParams.solids=[g.inputParams.featureID],v.inputParams.translate=[2,0,0],v.inputParams.rotateEulerDeg=[0,0,45],v.inputParams.copy=!0;const w=await e.newFeature("P.CU"),E=await e.newFeature("OVL");E.inputParams.targetSolid=w.inputParams.featureID,E.inputParams.distance=5e-4;const D=await e.newFeature("P.CU"),R=await e.newFeature("PATLIN");R.inputParams.solids=[D.inputParams.featureID],R.inputParams.count=3,R.inputParams.offset={position:[3,0,0],rotationEuler:[0,0,0],scale:[1,1,1]};const ee=await e.newFeature("P.CU"),N=await e.newFeature("PATRAD");N.inputParams.solids=[ee.inputParams.featureID],N.inputParams.axisRef=f,N.inputParams.count=4,N.inputParams.totalAngleDeg=180;const te=await e.newFeature("P.CU"),q=await e.newFeature("PATTERN");q.inputParams.solids=[te.inputParams.featureID],q.inputParams.mode="LINEAR",q.inputParams.count=2;const C=await e.newFeature("ACOMP");C.inputParams.componentName="missing_component";const re=await e.newFeature("IMAGE");re.inputParams.fileToImport="";const Me=await e.newFeature("HEIGHTMAP");return Me.inputParams.fileToImport="",e}i(ao,"test_history_features_basic");async function so(e){const t=i((r,n)=>{const o=e.features.find(c=>c?.type===r);if(!o)throw new Error(`${n} feature missing from history`);const a=o?.inputParams?.featureID;if(!a)throw new Error(`${n} feature missing featureID`);if(!e.scene.getObjectByName(a))throw new Error(`${n} object not found in scene`)},"requireFeatureObject");t("D","Datium"),t("SP","Spline"),t("HX","Helix"),t("LOFT","Loft"),t("R","Revolve")}i(so,"afterRun_history_features_basic");const _=12,Xt=2,nr=6,or=90,io=6,ar=6,Dt=3,sr=7,co=1e-6;function We(e,t){const r=[{id:0,x:0,y:0,fixed:!0},...t.map((n,o)=>({id:o+1,x:n[0],y:n[1],fixed:!1}))];e.persistentData.sketch={points:r,geometries:[],constraints:[{id:0,type:"⏚",points:[0]}]}}i(We,"buildSketchWithPoints");function Ve(e){return e.features.find(t=>t?.type==="H")||null}i(Ve,"findHoleFeature");function Yt(e){let t=0;for(const r of e){const n=r?._faceMetadata;if(n instanceof Map)for(const o of n.values())o?.hole&&t++}return t}i(Yt,"countHoleMetadata");function Gt(e){return(e.scene?.children||[]).filter(r=>r?.type==="SOLID")[0]||null}i(Gt,"getPrimarySolid");function Be(e,t,r){if(!Number.isFinite(e)||Math.abs(e-t)>co)throw new Error(`${r} expected ${t}, got ${e}`)}i(Be,"expectApprox$1");async function lo(e){const t=await e.newFeature("P.CU");t.inputParams.sizeX=_,t.inputParams.sizeY=_,t.inputParams.sizeZ=_;const r=await e.newFeature("P");r.inputParams.orientation="XY";const n=await e.newFeature("S");n.inputParams.sketchPlane=r.inputParams.featureID,We(n,[[_*.5,_*.5]]);const o=await e.newFeature("H");return o.inputParams.face=n.inputParams.featureID,o.inputParams.holeType="SIMPLE",o.inputParams.diameter=Xt,o.inputParams.throughAll=!0,o.inputParams.boolean={targets:[t.inputParams.featureID],operation:"SUBTRACT"},e}i(lo,"test_hole_through");async function uo(e){const t=Ve(e);if(!t)throw new Error("[hole_through] Hole feature missing");const r=t.persistentData?.holes||[];if(!r.length)throw new Error("[hole_through] No hole records");if(!r[0]?.throughAll)throw new Error("[hole_through] Expected through-all hole record");if(String(r[0]?.type||"").toUpperCase()!=="SIMPLE")throw new Error(`[hole_through] Expected SIMPLE hole, got ${r[0]?.type}`);const n=Gt(e);if(!n)throw new Error("[hole_through] No solids created");if((n._faceNameToID?.size||0)<=6)throw new Error("[hole_through] Hole did not add faces");if(Yt([n])===0)throw new Error("[hole_through] No hole face metadata found")}i(uo,"afterRun_hole_through");async function fo(e){const t=await e.newFeature("P.CU");t.inputParams.sizeX=_,t.inputParams.sizeY=_,t.inputParams.sizeZ=_;const r=await e.newFeature("P");r.inputParams.orientation="XY";const n=await e.newFeature("S");n.inputParams.sketchPlane=r.inputParams.featureID,We(n,[[_*.35,_*.35]]);const o=await e.newFeature("H");return o.inputParams.face=n.inputParams.featureID,o.inputParams.holeType="THREADED",o.inputParams.depth=6,o.inputParams.throughAll=!1,o.inputParams.threadStandard="ISO_METRIC",o.inputParams.threadDesignation="M6x1",o.inputParams.threadMode="SYMBOLIC",o.inputParams.boolean={targets:[t.inputParams.featureID],operation:"SUBTRACT"},e}i(fo,"test_hole_thread_symbolic");async function po(e){const t=Ve(e);if(!t)throw new Error("[hole_thread_symbolic] Hole feature missing");const r=t.persistentData?.holes||[];if(!r.length)throw new Error("[hole_thread_symbolic] No hole records");const n=r[0];if(String(n?.type||"").toUpperCase()!=="THREADED")throw new Error(`[hole_thread_symbolic] Expected THREADED hole, got ${n?.type}`);if(!n?.thread||String(n.thread.mode||"").toUpperCase()!=="SYMBOLIC")throw new Error("[hole_thread_symbolic] Expected symbolic thread metadata")}i(po,"afterRun_hole_thread_symbolic");async function mo(e){const t=await e.newFeature("P.CU");t.inputParams.sizeX=_,t.inputParams.sizeY=_,t.inputParams.sizeZ=_;const r=await e.newFeature("P");r.inputParams.orientation="XY";const n=await e.newFeature("S");n.inputParams.sketchPlane=r.inputParams.featureID,We(n,[[_*.65,_*.35]]);const o=await e.newFeature("H");return o.inputParams.face=n.inputParams.featureID,o.inputParams.holeType="THREADED",o.inputParams.depth=4,o.inputParams.throughAll=!1,o.inputParams.threadStandard="ISO_METRIC",o.inputParams.threadDesignation="M6x1",o.inputParams.threadMode="MODELED",o.inputParams.boolean={targets:[t.inputParams.featureID],operation:"SUBTRACT"},e}i(mo,"test_hole_thread_modeled");async function ho(e){const t=Ve(e);if(!t)throw new Error("[hole_thread_modeled] Hole feature missing");const r=t.persistentData?.holes||[];if(!r.length)throw new Error("[hole_thread_modeled] No hole records");const n=r[0];if(String(n?.type||"").toUpperCase()!=="THREADED")throw new Error(`[hole_thread_modeled] Expected THREADED hole, got ${n?.type}`);if(!n?.thread||String(n.thread.mode||"").toUpperCase()!=="MODELED")throw new Error("[hole_thread_modeled] Expected modeled thread metadata")}i(ho,"afterRun_hole_thread_modeled");async function xo(e){const t=await e.newFeature("P.CU");t.inputParams.sizeX=_,t.inputParams.sizeY=_,t.inputParams.sizeZ=_;const r=await e.newFeature("P");r.inputParams.orientation="XY";const n=await e.newFeature("S");n.inputParams.sketchPlane=r.inputParams.featureID,We(n,[[_*.25,_*.65]]);const o=await e.newFeature("H");return o.inputParams.face=n.inputParams.featureID,o.inputParams.holeType="COUNTERSINK",o.inputParams.diameter=Xt,o.inputParams.depth=io,o.inputParams.throughAll=!1,o.inputParams.countersinkDiameter=nr,o.inputParams.countersinkAngle=or,o.inputParams.boolean={targets:[t.inputParams.featureID],operation:"SUBTRACT"},e}i(xo,"test_hole_countersink");async function go(e){const t=Ve(e);if(!t)throw new Error("[hole_countersink] Hole feature missing");const r=t.persistentData?.holes||[];if(!r.length)throw new Error("[hole_countersink] No hole records");const n=r[0];if(String(n?.type||"").toUpperCase()!=="COUNTERSINK")throw new Error(`[hole_countersink] Expected COUNTERSINK hole, got ${n?.type}`);if(n?.throughAll)throw new Error("[hole_countersink] Expected non-through hole");if(!(n?.countersinkHeight>0))throw new Error("[hole_countersink] Expected countersink height > 0");Be(n?.countersinkDiameter,nr,"[hole_countersink] countersink diameter"),Be(n?.countersinkAngle,or,"[hole_countersink] countersink angle");const o=Gt(e);if(!o)throw new Error("[hole_countersink] No solids created");if(Yt([o])===0)throw new Error("[hole_countersink] No hole face metadata found")}i(go,"afterRun_hole_countersink");async function yo(e){const t=await e.newFeature("P.CU");t.inputParams.sizeX=_,t.inputParams.sizeY=_,t.inputParams.sizeZ=_;const r=await e.newFeature("P");r.inputParams.orientation="XY";const n=await e.newFeature("S");n.inputParams.sketchPlane=r.inputParams.featureID,We(n,[[_*.75,_*.65]]);const o=await e.newFeature("H");return o.inputParams.face=n.inputParams.featureID,o.inputParams.holeType="COUNTERBORE",o.inputParams.diameter=Xt,o.inputParams.depth=sr,o.inputParams.throughAll=!1,o.inputParams.counterboreDiameter=ar,o.inputParams.counterboreDepth=Dt,o.inputParams.boolean={targets:[t.inputParams.featureID],operation:"SUBTRACT"},e}i(yo,"test_hole_counterbore");async function vo(e){const t=Ve(e);if(!t)throw new Error("[hole_counterbore] Hole feature missing");const r=t.persistentData?.holes||[];if(!r.length)throw new Error("[hole_counterbore] No hole records");const n=r[0];if(String(n?.type||"").toUpperCase()!=="COUNTERBORE")throw new Error(`[hole_counterbore] Expected COUNTERBORE hole, got ${n?.type}`);if(n?.throughAll)throw new Error("[hole_counterbore] Expected non-through hole");Be(n?.counterboreDiameter,ar,"[hole_counterbore] counterbore diameter"),Be(n?.counterboreDepth,Dt,"[hole_counterbore] counterbore depth"),Be(n?.straightDepth,sr-Dt,"[hole_counterbore] straight depth");const o=Gt(e);if(!o)throw new Error("[hole_counterbore] No solids created");if(Yt([o])===0)throw new Error("[hole_counterbore] No hole face metadata found")}i(vo,"afterRun_hole_counterbore");const ir="IMPORT3D_DECIMATION_BASELINE",cr="IMPORT3D_DECIMATION_REDUCED",Ct="IMPORT3D_DECIMATION_STABILITY",ke="IMPORT3D_DECIMATION_RESTORE",Re="IMPORT3D_DECIMATION_LEGACY_CACHE",et="IMPORT3D_DECIMATION_SNAPSHOT_CLONE_RESILIENCE";function j(e){const t=Number(e);return!Number.isFinite(t)||Math.abs(t)<1e-16?"0":t.toFixed(9)}i(j,"formatNumber$2");function Je(e,t,r,n){const o=r[0]-t[0],a=r[1]-t[1],s=r[2]-t[2],c=n[0]-t[0],l=n[1]-t[1],d=n[2]-t[2];let f=a*d-s*l,u=s*c-o*d,p=o*l-a*c;const m=Math.hypot(f,u,p)||1;f/=m,u/=m,p/=m,e.push(` facet normal ${j(f)} ${j(u)} ${j(p)}`),e.push(" outer loop"),e.push(` vertex ${j(t[0])} ${j(t[1])} ${j(t[2])}`),e.push(` vertex ${j(r[0])} ${j(r[1])} ${j(r[2])}`),e.push(` vertex ${j(n[0])} ${j(n[1])} ${j(n[2])}`),e.push(" endloop"),e.push(" endfacet")}i(Je,"appendFacet$2");function Xe({radius:e=6,height:t=10,segments:r=96}={}){const n=Math.max(24,Number(r)|0),o=Math.max(.1,Number(e)||1),s=Math.max(.1,Number(t)||1)*.5,c=[0,s,0],l=[0,-s,0],d=["solid import3d_decimation_cylinder"];for(let f=0;f<n;f+=1){const u=f/n*Math.PI*2,p=(f+1)/n*Math.PI*2,m=Math.cos(u),h=Math.sin(u),x=Math.cos(p),y=Math.sin(p),g=[o*m,-s,o*h],v=[o*x,-s,o*y],w=[o*m,s,o*h],E=[o*x,s,o*y];Je(d,g,v,E),Je(d,g,E,w),Je(d,c,E,w),Je(d,l,g,v)}return d.push("endsolid import3d_decimation_cylinder"),d.join(`
@@ -1 +1 @@
1
- var be=Object.defineProperty;var g=(e,c)=>be(e,"name",{value:c,configurable:!0});import{aD as Se,bh as G,V as y,bk as B,d as Ae,L as pe,e as xe}from"./featureDialogs-CUWi02Qp.js";import"./browserStorage-CvgF8ovw.js";import"./preload-helper-ZNr0Qq7Q.js";const k=class k extends Se{constructor({edgeToChamfer:c,distance:n=1,sampleCount:o=50,snapSeamToEdge:t=!0,sideStripSubdiv:i=8,seamInsetScale:s=.001,direction:l="INSET",inflate:r=0,flipSide:h=!1,debug:f=!1,debugStride:a=12}){super(),this.edgeToChamfer=c,this.distance=Math.max(1e-9,n),this.sampleCount=Math.max(8,o|0),this.snapSeamToEdge=!!t,this.sideStripSubdiv=Math.max(1,i|0),this.seamInsetScale=Number.isFinite(s)?s:.001,this.direction=(l||"INSET").toUpperCase(),this.inflate=Number.isFinite(r)?r:0,this.flipSide=!!h,this.debug=!!f,this.debugStride=Math.max(1,a|0),this._debugObjects=[],this.operationTargetSolid=null,this.generate()}generate(){if(this.edgeToChamfer&&this.edgeToChamfer.parent)this.operationTargetSolid=this.edgeToChamfer.parent;else throw new Error("Edge must be part of a solid");if(this._debugObjects?.length){const m=this.operationTargetSolid?.parent;if(m)for(const b of this._debugObjects)m.remove(b);this._debugObjects.length=0}const c=this.operationTargetSolid,n=this.edgeToChamfer.faces?.[0],o=this.edgeToChamfer.faces?.[1];if(!n||!o)throw new Error("ChamferSolid: edge must have two adjacent faces.");const t=this.edgeToChamfer.userData?.polylineLocal;if(!Array.isArray(t)||t.length<2)throw new Error("ChamferSolid: edge polyline missing.");const i=G(c,n.name),s=G(c,o.name),l=!!(this.edgeToChamfer.closedLoop||this.edgeToChamfer.userData?.closedLoop);let r;if(this.snapSeamToEdge){const m=t.slice();if(l&&m.length>2){const b=m[0],M=m[m.length-1];b&&M&&b[0]===M[0]&&b[1]===M[1]&&b[2]===M[2]&&m.pop()}r=m}else r=we(t,this.sampleCount,l);const h=[],f=[],a=[],u=[],x=[],d=[],S=r.length/2|0,A=T(r[S]),p=T(r[Math.max(0,S-1)]),v=T(r[Math.min(r.length-1,S+1)]),V=new y().subVectors(v,p).normalize(),C=B(c,n.name,A)||i,L=B(c,o.name,A)||s,ce=C.clone().cross(V).normalize(),re=L.clone().cross(V).normalize(),E=C.clone().add(L);E.lengthSq()>0&&E.normalize();const D=this.direction==="OUTSET"?1:-1,le=ne(ce.dot(E)),ie=ne(re.dot(E)),ae=D*le,he=D*ie,N=this.flipSide?-1:1,R=ae*N,U=he*N;for(let m=0;m<r.length;m++){const b=T(r[m]),M=T(l?r[(m-1+r.length)%r.length]:r[Math.max(0,m-1)]),fe=T(l?r[(m+1)%r.length]:r[Math.min(r.length-1,m+1)]),z=new y().subVectors(fe,M);if(z.lengthSq()<1e-14)continue;z.normalize();const Z=(B(c,n.name,b)||i).clone(),J=(B(c,o.name,b)||s).clone();let q=Z.clone().cross(z),_=J.clone().cross(z);if(q.lengthSq()<1e-12||_.lengthSq()<1e-12)continue;q.normalize(),_.normalize();const K=b.clone().addScaledVector(q,R*this.distance),Q=b.clone().addScaledVector(_,U*this.distance);if(h.push(b.clone()),f.push(K),a.push(Q),u.push(Z.normalize()),x.push(J.normalize()),d.push(z.clone()),this.debug&&m%this.debugStride===0){const X=this.operationTargetSolid?.parent;if(X){const j=g((ue,de,ge)=>{const me=new Ae().setFromPoints([ue,de]),ye=new pe({color:ge}),$=new xe(me,ye);$.renderOrder=10,X.add($),this._debugObjects.push($)},"addLine"),Y=Math.max(.4*this.distance,.001);j(b,b.clone().addScaledVector(q,Y*R),65535),j(b,b.clone().addScaledVector(_,Y*U),16776960),j(K,Q,16711935)}}}ve({railP:h,railA:f,railB:a,normalsA:u,normalsB:x,tangents:d,isClosed:l});const H=!!l,P=`CHAMFER_${n.name}|${o.name}`;let I=h,F=f,O=a;if(Math.abs(this.inflate)>1e-12){const m=Be({railP:h,railA:f,railB:a,normalsA:u,normalsB:x,tangents:d,inflate:this.inflate});m&&(I=m.railP,F=m.railA,O=m.railB)}Te([I,F,O],H),Ie(this,P,I,F,O,H);const W=1e-4;this.pushFace(`${P}_CAP0`,W),this.pushFace(`${P}_CAP1`,W)}};g(k,"ChamferSolid");let ee=k;function T(e){return new y(e[0],e[1],e[2])}g(T,"arrToV");function w(e){return[e.x,e.y,e.z]}g(w,"vToArr");function we(e,c,n){if(!Array.isArray(e)||e.length<2)return e;const o=e.map(T);n&&o.push(o[0].clone());const t=se(o),i=[];for(let s=0;s<c;s++){const r=s/(c-1)*t,h=_e(o,r);i.push([h.x,h.y,h.z])}return i}g(we,"resamplePolyline3");function ne(e){return e>=0?1:-1}g(ne,"signNonZero");function se(e){let c=0;for(let n=1;n<e.length;n++)c+=e[n].distanceTo(e[n-1]);return c}g(se,"polylineLength");function Te(e,c){if(c||!Array.isArray(e)||e.length===0)return;const n=e[0]?.length||0;if(n<4)return;for(const t of e)if(!Array.isArray(t)||t.length!==n)return;const o=Math.min(4096,n*n*e.length);for(let t=0;t<o;t++){let i=null;for(let s=0;s<e.length;s++){const l=Ce(e[s]);l&&(!i||l.i<i.i||l.i===i.i&&l.j<i.j)&&(i={...l})}if(!i)break;Me(e,i)}}g(Te,"resolveChamferSelfIntersections");function Ce(e){const c=ze(e);if(!c)return null;const n=c.planar,o=n.length;if(o<4)return null;for(let t=0;t<o-3;t++){const i=n[t],s=n[t+1];for(let l=t+2;l<o-1;l++){if(l===t+1)continue;const r=n[l],h=n[l+1],f=Le(i,s,r,h);if(f)return{i:t,j:l,t:te(f.t),u:te(f.u)}}}return null}g(Ce,"nextRailSelfIntersection");function Me(e,{i:c,j:n,t:o,u:t}){if(!(n>c+1))return;const i=n-c;for(const s of e)if(!Array.isArray(s)||s.length<=n)return;for(const s of e){const l=Ve(s,c,o,n,t);s.splice(c+1,i,l)}}g(Me,"collapseRailsAtIntersection");function Ve(e,c,n,o,t){const i=e[c],s=e[c+1],l=e[o],r=e[o+1];if(!i||!s||!l||!r)return i?i.clone():new y;const h=i.clone().lerp(s,n),f=l.clone().lerp(r,t);return h.add(f).multiplyScalar(.5)}g(Ve,"averagePointOnSegments");function Le(e,c,n,o,t=1e-12){const i={x:c.x-e.x,y:c.y-e.y},s={x:o.x-n.x,y:o.y-n.y},l=i.x*s.y-i.y*s.x;if(Math.abs(l)<t)return null;const r=n.x-e.x,h=n.y-e.y,f=(r*s.y-h*s.x)/l,a=(r*i.y-h*i.x)/l;return f>=-t&&f<=1+t&&a>=-t&&a<=1+t?{t:f,u:a}:null}g(Le,"segmentIntersection2D");function te(e){return Math.max(0,Math.min(1,e))}g(te,"clamp01");function ze(e){if(!Array.isArray(e)||e.length<2)return null;const c=e[0].clone();let n=null;for(let r=1;r<e.length;r++){const h=e[r].clone().sub(c);if(h.lengthSq()>1e-12){n=h.normalize();break}}if(!n)return null;const o=new y,t=new y,i=new y;for(let r=0;r<e.length-2;r++){t.subVectors(e[r+1],e[r]),i.subVectors(e[r+2],e[r+1]);const h=new y().crossVectors(t,i);h.lengthSq()>1e-16&&o.add(h)}if(o.lengthSq()<1e-16){const r=Math.abs(n.x)<.9?new y(1,0,0):new y(0,1,0);o.crossVectors(n,r),o.lengthSq()<1e-16&&o.set(0,0,1)}o.normalize();const s=new y().crossVectors(o,n);if(s.lengthSq()<1e-16)return null;s.normalize();const l=e.map(r=>{const h=r.clone().sub(c);return{x:h.dot(n),y:h.dot(s)}});return{origin:c,axisU:n,axisV:s,planar:l}}g(ze,"projectPolylineToPlane");function ve({railP:e,railA:c,railB:n,normalsA:o,normalsB:t,tangents:i,isClosed:s}){const l=Ee(e,s);if(!l)return;const r=g(h=>{if(!Array.isArray(h)||h.length!==l.length)return;const f=new Array(l.length);for(let a=0;a<l.length;a++)f[a]=h[l[a]];h.length=0;for(const a of f)h.push(a)},"apply");r(e),r(c),r(n),r(o),r(t),r(i)}g(ve,"reorderChamferRailSamples");function Ee(e,c){if(c||!Array.isArray(e)||e.length<3)return null;const n=e[0],o=e[e.length-1];if(!n||!o||n.distanceTo(o)<1e-9)return null;const t=e.length,i=new Array(t).fill(!1),s=[],l=g(u=>{s.push(u),i[u]=!0},"pushIdx");for(l(0),i[t-1]=!0;s.length<t-1;){const u=e[s[s.length-1]];if(!u)break;let x=-1,d=1/0;for(let S=1;S<t-1;S++){if(i[S])continue;const A=e[S];if(!A)continue;const p=u.distanceTo(A);p<d&&(d=p,x=S)}if(x===-1)break;l(x)}if(s.push(t-1),s.length!==t)return null;let r=!1;for(let u=0;u<t;u++)if(s[u]!==u){r=!0;break}if(!r)return null;const h=se(e),f=qe(e,s),a=Math.max(1e-6,h*1e-4);return f+a<h?s:null}g(Ee,"computeChamferRailOrder");function qe(e,c){if(!Array.isArray(e)||!Array.isArray(c)||c.length<2)return 0;let n=0;for(let o=1;o<c.length;o++){const t=e[c[o-1]],i=e[c[o]];!t||!i||(n+=t.distanceTo(i))}return n}g(qe,"polylineLengthFromOrder");function _e(e,c){let n=0;for(let o=1;o<e.length;o++){const t=e[o].distanceTo(e[o-1]);if(n+t>=c){const i=(c-n)/t;return new y().lerpVectors(e[o-1],e[o],i)}n+=t}return e[e.length-1].clone()}g(_e,"pointAtArcLength");function Be({railP:e,railA:c,railB:n,normalsA:o,normalsB:t,tangents:i,inflate:s}){if(!Number.isFinite(s)||s===0)return null;const l=Math.min(e.length,c.length,n.length,o.length,t.length,i.length);if(l<2)return null;const r=new Array(l),h=new Array(l),f=new Array(l),a=new y,u=new y,x=new y;for(let d=0;d<l;d++){const S=e[d],A=c[d],p=n[d],v=o[d],V=t[d];if(r[d]=Pe(S,v,V,s),!A||!p){h[d]=A?A.clone():new y,f[d]=p?p.clone():new y;continue}const C=i[d];if(!C||C.lengthSq()<1e-14){h[d]=A.clone(),f[d]=p.clone();continue}if(x.copy(C).normalize(),a.copy(p).sub(A),a.lengthSq()<1e-18){h[d]=A.clone(),f[d]=p.clone();continue}u.crossVectors(a,x);const L=u.length();if(L<1e-18){h[d]=A.clone(),f[d]=p.clone();continue}u.multiplyScalar(1/L),h[d]=oe(A,v,u,s),f[d]=oe(p,V,u,s)}return{railP:r,railA:h,railB:f}}g(Be,"inflateChamferRails");function Pe(e,c,n,o){if(!e)return new y;if(!c||!n)return e.clone();const t=c.clone().normalize(),i=n.clone().normalize(),s=t.clone().add(i),l=1+t.dot(i);return Math.abs(l)<1e-9||s.lengthSq()<1e-18?e.clone():e.clone().addScaledVector(s,o/l)}g(Pe,"shiftEdgePoint");function oe(e,c,n,o){if(!e)return new y;if(!c||!n)return e.clone();const t=c.clone().normalize(),i=n.clone().normalize(),s=t.sub(i.clone().multiplyScalar(i.dot(t))),l=s.lengthSq();return l<1e-18?e.clone():e.clone().addScaledVector(s,o/l)}g(oe,"translatePointWithinPlane");function Ie(e,c,n,o,t,i){const s=Math.min(n.length,o.length,t.length);if(s<2)return;const l=`${c}_SIDE_A`,r=`${c}_SIDE_B`,h=`${c}_BEVEL`,f=g((a,u,x,d,S)=>{e.addTriangle(a,w(u),w(d),w(S)),e.addTriangle(a,w(u),w(S),w(x))},"link");for(let a=0;a<s-1;a++)f(l,n[a],n[a+1],o[a],o[a+1]),f(r,n[a],n[a+1],t[a],t[a+1]),f(h,o[a],o[a+1],t[a],t[a+1]);if(i){const a=s-1,u=0;f(l,n[a],n[u],o[a],o[u]),f(r,n[a],n[u],t[a],t[u]),f(h,o[a],o[u],t[a],t[u])}else e.addTriangle(`${c}_CAP0`,w(n[0]),w(o[0]),w(t[0])),e.addTriangle(`${c}_CAP1`,w(n[s-1]),w(t[s-1]),w(o[s-1]))}g(Ie,"buildChamferPrismNamed");export{ee as ChamferSolid};
1
+ var be=Object.defineProperty;var g=(e,c)=>be(e,"name",{value:c,configurable:!0});import{aD as Se,bh as G,V as y,bk as B,d as Ae,L as pe,e as xe}from"./featureDialogs-Bas0NDXF.js";import"./browserStorage-CvgF8ovw.js";import"./preload-helper-ZNr0Qq7Q.js";const k=class k extends Se{constructor({edgeToChamfer:c,distance:n=1,sampleCount:o=50,snapSeamToEdge:t=!0,sideStripSubdiv:i=8,seamInsetScale:s=.001,direction:l="INSET",inflate:r=0,flipSide:h=!1,debug:f=!1,debugStride:a=12}){super(),this.edgeToChamfer=c,this.distance=Math.max(1e-9,n),this.sampleCount=Math.max(8,o|0),this.snapSeamToEdge=!!t,this.sideStripSubdiv=Math.max(1,i|0),this.seamInsetScale=Number.isFinite(s)?s:.001,this.direction=(l||"INSET").toUpperCase(),this.inflate=Number.isFinite(r)?r:0,this.flipSide=!!h,this.debug=!!f,this.debugStride=Math.max(1,a|0),this._debugObjects=[],this.operationTargetSolid=null,this.generate()}generate(){if(this.edgeToChamfer&&this.edgeToChamfer.parent)this.operationTargetSolid=this.edgeToChamfer.parent;else throw new Error("Edge must be part of a solid");if(this._debugObjects?.length){const m=this.operationTargetSolid?.parent;if(m)for(const b of this._debugObjects)m.remove(b);this._debugObjects.length=0}const c=this.operationTargetSolid,n=this.edgeToChamfer.faces?.[0],o=this.edgeToChamfer.faces?.[1];if(!n||!o)throw new Error("ChamferSolid: edge must have two adjacent faces.");const t=this.edgeToChamfer.userData?.polylineLocal;if(!Array.isArray(t)||t.length<2)throw new Error("ChamferSolid: edge polyline missing.");const i=G(c,n.name),s=G(c,o.name),l=!!(this.edgeToChamfer.closedLoop||this.edgeToChamfer.userData?.closedLoop);let r;if(this.snapSeamToEdge){const m=t.slice();if(l&&m.length>2){const b=m[0],M=m[m.length-1];b&&M&&b[0]===M[0]&&b[1]===M[1]&&b[2]===M[2]&&m.pop()}r=m}else r=we(t,this.sampleCount,l);const h=[],f=[],a=[],u=[],x=[],d=[],S=r.length/2|0,A=T(r[S]),p=T(r[Math.max(0,S-1)]),v=T(r[Math.min(r.length-1,S+1)]),V=new y().subVectors(v,p).normalize(),C=B(c,n.name,A)||i,L=B(c,o.name,A)||s,ce=C.clone().cross(V).normalize(),re=L.clone().cross(V).normalize(),E=C.clone().add(L);E.lengthSq()>0&&E.normalize();const D=this.direction==="OUTSET"?1:-1,le=ne(ce.dot(E)),ie=ne(re.dot(E)),ae=D*le,he=D*ie,N=this.flipSide?-1:1,R=ae*N,U=he*N;for(let m=0;m<r.length;m++){const b=T(r[m]),M=T(l?r[(m-1+r.length)%r.length]:r[Math.max(0,m-1)]),fe=T(l?r[(m+1)%r.length]:r[Math.min(r.length-1,m+1)]),z=new y().subVectors(fe,M);if(z.lengthSq()<1e-14)continue;z.normalize();const Z=(B(c,n.name,b)||i).clone(),J=(B(c,o.name,b)||s).clone();let q=Z.clone().cross(z),_=J.clone().cross(z);if(q.lengthSq()<1e-12||_.lengthSq()<1e-12)continue;q.normalize(),_.normalize();const K=b.clone().addScaledVector(q,R*this.distance),Q=b.clone().addScaledVector(_,U*this.distance);if(h.push(b.clone()),f.push(K),a.push(Q),u.push(Z.normalize()),x.push(J.normalize()),d.push(z.clone()),this.debug&&m%this.debugStride===0){const X=this.operationTargetSolid?.parent;if(X){const j=g((ue,de,ge)=>{const me=new Ae().setFromPoints([ue,de]),ye=new pe({color:ge}),$=new xe(me,ye);$.renderOrder=10,X.add($),this._debugObjects.push($)},"addLine"),Y=Math.max(.4*this.distance,.001);j(b,b.clone().addScaledVector(q,Y*R),65535),j(b,b.clone().addScaledVector(_,Y*U),16776960),j(K,Q,16711935)}}}ve({railP:h,railA:f,railB:a,normalsA:u,normalsB:x,tangents:d,isClosed:l});const H=!!l,P=`CHAMFER_${n.name}|${o.name}`;let I=h,F=f,O=a;if(Math.abs(this.inflate)>1e-12){const m=Be({railP:h,railA:f,railB:a,normalsA:u,normalsB:x,tangents:d,inflate:this.inflate});m&&(I=m.railP,F=m.railA,O=m.railB)}Te([I,F,O],H),Ie(this,P,I,F,O,H);const W=1e-4;this.pushFace(`${P}_CAP0`,W),this.pushFace(`${P}_CAP1`,W)}};g(k,"ChamferSolid");let ee=k;function T(e){return new y(e[0],e[1],e[2])}g(T,"arrToV");function w(e){return[e.x,e.y,e.z]}g(w,"vToArr");function we(e,c,n){if(!Array.isArray(e)||e.length<2)return e;const o=e.map(T);n&&o.push(o[0].clone());const t=se(o),i=[];for(let s=0;s<c;s++){const r=s/(c-1)*t,h=_e(o,r);i.push([h.x,h.y,h.z])}return i}g(we,"resamplePolyline3");function ne(e){return e>=0?1:-1}g(ne,"signNonZero");function se(e){let c=0;for(let n=1;n<e.length;n++)c+=e[n].distanceTo(e[n-1]);return c}g(se,"polylineLength");function Te(e,c){if(c||!Array.isArray(e)||e.length===0)return;const n=e[0]?.length||0;if(n<4)return;for(const t of e)if(!Array.isArray(t)||t.length!==n)return;const o=Math.min(4096,n*n*e.length);for(let t=0;t<o;t++){let i=null;for(let s=0;s<e.length;s++){const l=Ce(e[s]);l&&(!i||l.i<i.i||l.i===i.i&&l.j<i.j)&&(i={...l})}if(!i)break;Me(e,i)}}g(Te,"resolveChamferSelfIntersections");function Ce(e){const c=ze(e);if(!c)return null;const n=c.planar,o=n.length;if(o<4)return null;for(let t=0;t<o-3;t++){const i=n[t],s=n[t+1];for(let l=t+2;l<o-1;l++){if(l===t+1)continue;const r=n[l],h=n[l+1],f=Le(i,s,r,h);if(f)return{i:t,j:l,t:te(f.t),u:te(f.u)}}}return null}g(Ce,"nextRailSelfIntersection");function Me(e,{i:c,j:n,t:o,u:t}){if(!(n>c+1))return;const i=n-c;for(const s of e)if(!Array.isArray(s)||s.length<=n)return;for(const s of e){const l=Ve(s,c,o,n,t);s.splice(c+1,i,l)}}g(Me,"collapseRailsAtIntersection");function Ve(e,c,n,o,t){const i=e[c],s=e[c+1],l=e[o],r=e[o+1];if(!i||!s||!l||!r)return i?i.clone():new y;const h=i.clone().lerp(s,n),f=l.clone().lerp(r,t);return h.add(f).multiplyScalar(.5)}g(Ve,"averagePointOnSegments");function Le(e,c,n,o,t=1e-12){const i={x:c.x-e.x,y:c.y-e.y},s={x:o.x-n.x,y:o.y-n.y},l=i.x*s.y-i.y*s.x;if(Math.abs(l)<t)return null;const r=n.x-e.x,h=n.y-e.y,f=(r*s.y-h*s.x)/l,a=(r*i.y-h*i.x)/l;return f>=-t&&f<=1+t&&a>=-t&&a<=1+t?{t:f,u:a}:null}g(Le,"segmentIntersection2D");function te(e){return Math.max(0,Math.min(1,e))}g(te,"clamp01");function ze(e){if(!Array.isArray(e)||e.length<2)return null;const c=e[0].clone();let n=null;for(let r=1;r<e.length;r++){const h=e[r].clone().sub(c);if(h.lengthSq()>1e-12){n=h.normalize();break}}if(!n)return null;const o=new y,t=new y,i=new y;for(let r=0;r<e.length-2;r++){t.subVectors(e[r+1],e[r]),i.subVectors(e[r+2],e[r+1]);const h=new y().crossVectors(t,i);h.lengthSq()>1e-16&&o.add(h)}if(o.lengthSq()<1e-16){const r=Math.abs(n.x)<.9?new y(1,0,0):new y(0,1,0);o.crossVectors(n,r),o.lengthSq()<1e-16&&o.set(0,0,1)}o.normalize();const s=new y().crossVectors(o,n);if(s.lengthSq()<1e-16)return null;s.normalize();const l=e.map(r=>{const h=r.clone().sub(c);return{x:h.dot(n),y:h.dot(s)}});return{origin:c,axisU:n,axisV:s,planar:l}}g(ze,"projectPolylineToPlane");function ve({railP:e,railA:c,railB:n,normalsA:o,normalsB:t,tangents:i,isClosed:s}){const l=Ee(e,s);if(!l)return;const r=g(h=>{if(!Array.isArray(h)||h.length!==l.length)return;const f=new Array(l.length);for(let a=0;a<l.length;a++)f[a]=h[l[a]];h.length=0;for(const a of f)h.push(a)},"apply");r(e),r(c),r(n),r(o),r(t),r(i)}g(ve,"reorderChamferRailSamples");function Ee(e,c){if(c||!Array.isArray(e)||e.length<3)return null;const n=e[0],o=e[e.length-1];if(!n||!o||n.distanceTo(o)<1e-9)return null;const t=e.length,i=new Array(t).fill(!1),s=[],l=g(u=>{s.push(u),i[u]=!0},"pushIdx");for(l(0),i[t-1]=!0;s.length<t-1;){const u=e[s[s.length-1]];if(!u)break;let x=-1,d=1/0;for(let S=1;S<t-1;S++){if(i[S])continue;const A=e[S];if(!A)continue;const p=u.distanceTo(A);p<d&&(d=p,x=S)}if(x===-1)break;l(x)}if(s.push(t-1),s.length!==t)return null;let r=!1;for(let u=0;u<t;u++)if(s[u]!==u){r=!0;break}if(!r)return null;const h=se(e),f=qe(e,s),a=Math.max(1e-6,h*1e-4);return f+a<h?s:null}g(Ee,"computeChamferRailOrder");function qe(e,c){if(!Array.isArray(e)||!Array.isArray(c)||c.length<2)return 0;let n=0;for(let o=1;o<c.length;o++){const t=e[c[o-1]],i=e[c[o]];!t||!i||(n+=t.distanceTo(i))}return n}g(qe,"polylineLengthFromOrder");function _e(e,c){let n=0;for(let o=1;o<e.length;o++){const t=e[o].distanceTo(e[o-1]);if(n+t>=c){const i=(c-n)/t;return new y().lerpVectors(e[o-1],e[o],i)}n+=t}return e[e.length-1].clone()}g(_e,"pointAtArcLength");function Be({railP:e,railA:c,railB:n,normalsA:o,normalsB:t,tangents:i,inflate:s}){if(!Number.isFinite(s)||s===0)return null;const l=Math.min(e.length,c.length,n.length,o.length,t.length,i.length);if(l<2)return null;const r=new Array(l),h=new Array(l),f=new Array(l),a=new y,u=new y,x=new y;for(let d=0;d<l;d++){const S=e[d],A=c[d],p=n[d],v=o[d],V=t[d];if(r[d]=Pe(S,v,V,s),!A||!p){h[d]=A?A.clone():new y,f[d]=p?p.clone():new y;continue}const C=i[d];if(!C||C.lengthSq()<1e-14){h[d]=A.clone(),f[d]=p.clone();continue}if(x.copy(C).normalize(),a.copy(p).sub(A),a.lengthSq()<1e-18){h[d]=A.clone(),f[d]=p.clone();continue}u.crossVectors(a,x);const L=u.length();if(L<1e-18){h[d]=A.clone(),f[d]=p.clone();continue}u.multiplyScalar(1/L),h[d]=oe(A,v,u,s),f[d]=oe(p,V,u,s)}return{railP:r,railA:h,railB:f}}g(Be,"inflateChamferRails");function Pe(e,c,n,o){if(!e)return new y;if(!c||!n)return e.clone();const t=c.clone().normalize(),i=n.clone().normalize(),s=t.clone().add(i),l=1+t.dot(i);return Math.abs(l)<1e-9||s.lengthSq()<1e-18?e.clone():e.clone().addScaledVector(s,o/l)}g(Pe,"shiftEdgePoint");function oe(e,c,n,o){if(!e)return new y;if(!c||!n)return e.clone();const t=c.clone().normalize(),i=n.clone().normalize(),s=t.sub(i.clone().multiplyScalar(i.dot(t))),l=s.lengthSq();return l<1e-18?e.clone():e.clone().addScaledVector(s,o/l)}g(oe,"translatePointWithinPlane");function Ie(e,c,n,o,t,i){const s=Math.min(n.length,o.length,t.length);if(s<2)return;const l=`${c}_SIDE_A`,r=`${c}_SIDE_B`,h=`${c}_BEVEL`,f=g((a,u,x,d,S)=>{e.addTriangle(a,w(u),w(d),w(S)),e.addTriangle(a,w(u),w(S),w(x))},"link");for(let a=0;a<s-1;a++)f(l,n[a],n[a+1],o[a],o[a+1]),f(r,n[a],n[a+1],t[a],t[a+1]),f(h,o[a],o[a+1],t[a],t[a+1]);if(i){const a=s-1,u=0;f(l,n[a],n[u],o[a],o[u]),f(r,n[a],n[u],t[a],t[u]),f(h,o[a],o[u],t[a],t[u])}else e.addTriangle(`${c}_CAP0`,w(n[0]),w(o[0]),w(t[0])),e.addTriangle(`${c}_CAP1`,w(n[s-1]),w(t[s-1]),w(o[s-1]))}g(Ie,"buildChamferPrismNamed");export{ee as ChamferSolid};
@@ -1,4 +1,4 @@
1
- var z=Object.defineProperty;var o=(e,t)=>z(e,"name",{value:t,configurable:!0});import{q as D}from"./featureDialogs-CUWi02Qp.js";let y=!1;const N="Dialogs are rendered live using SchemaForm. Use the automated capture script to export PNGs.";function O({title:e="Dialog Reference",description:t=N,entries:r=[]}={}){M();const l=document.getElementById("app")||document.body;l.classList.add("dialog-capture-page"),l.innerHTML="";const p=document.createElement("header");p.className="dialog-capture-header",p.innerHTML=`
1
+ var z=Object.defineProperty;var o=(e,t)=>z(e,"name",{value:t,configurable:!0});import{q as D}from"./featureDialogs-Bas0NDXF.js";let y=!1;const N="Dialogs are rendered live using SchemaForm. Use the automated capture script to export PNGs.";function O({title:e="Dialog Reference",description:t=N,entries:r=[]}={}){M();const l=document.getElementById("app")||document.body;l.classList.add("dialog-capture-page"),l.innerHTML="";const p=document.createElement("header");p.className="dialog-capture-header",p.innerHTML=`
2
2
  <h1>${w(e)}</h1>
3
3
  <p>${w(t||N)}</p>
4
4
  `;const m=document.createElement("section");m.className="dialog-capture-grid",r.forEach(a=>{const c=h(a?.displayName,"Dialog"),b=h(a?.shortName,c||"Dialog"),C=a?.captureName?h(a.captureName,c):c,S=x(a?.initialParams)||{},j=F(a?.schema),k=a?.formOptions&&typeof a.formOptions=="object"?a.formOptions:void 0;let n=null;try{const s=new D(j,S,k);try{s.refreshFromParams?.()}catch{}n=s.uiElement;try{n&&(n.style.width="100%",n.style.maxWidth="100%")}catch{}}catch(s){n=E(s)}const i=document.createElement("article");i.className="dialog-card",i.dataset.featureName=C,i.dataset.featureShortName=b;const g=document.createElement("div");g.className="dialog-card-head";const f=document.createElement("span");f.className="dialog-short",f.textContent=b;const u=document.createElement("h2");u.className="dialog-title",u.textContent=c,g.append(f,u);const d=document.createElement("div");d.className="dialog-form",n?d.appendChild(n):d.appendChild(E(new Error("Form host missing"))),i.append(g,d),m.appendChild(i)}),l.append(p,m)}o(O,"renderDialogCapturePage");function F(e){return!e||typeof e!="object"?{}:e}o(F,"sanitizeSchema");function h(e,t=""){if(e==null&&e!==0)return t;const r=String(e).trim();return r.length?r:t}o(h,"formatName");function x(e){if(Array.isArray(e))return e.map(t=>x(t));if(e&&typeof e=="object"){const t={};for(const r of Object.keys(e))t[r]=x(e[r]);return t}return e}o(x,"clone");function E(e){const t=document.createElement("div");return t.className="dialog-error",t.textContent=`Failed to render: ${e?.message||e||"Unknown error"}`,t}o(E,"buildErrorState");function w(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}o(w,"escapeHtml");function M(){if(y)return;y=!0;const e=document.createElement("style");e.textContent=`