forgecad 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{evalWorker-DuS4V-H5.js → evalWorker-1m873KWd.js} +107 -107
- package/dist/assets/{index-d60dJDhX.js → index-Dvz3nSDc.js} +342 -326
- package/dist/assets/{manifold-DEOPQqeC.js → manifold-C38sUiKu.js} +1 -1
- package/dist/assets/{manifold-cL7A7HeM.js → manifold-Dk2u-lhj.js} +1 -1
- package/dist/assets/{manifold-DbvY5u9x.js → manifold-rOWQW9fU.js} +1 -1
- package/dist/assets/{reportWorker-GZVKtf9S.js → reportWorker-Cj587shw.js} +129 -129
- package/dist/index.html +1 -1
- package/dist-cli/forgecad.js +204 -19
- package/dist-skill/SKILL.md +31 -4561
- package/dist-skill/docs/API/README.md +24 -0
- package/dist-skill/docs/API/guides/modeling-recipes.md +246 -0
- package/dist-skill/docs/API/internals/compiler.md +300 -0
- package/dist-skill/docs/API/internals/manifold.md +7 -0
- package/dist-skill/docs/API/model-building/README.md +31 -0
- package/dist-skill/docs/API/model-building/assembly.md +205 -0
- package/dist-skill/docs/API/model-building/coordinate-system.md +43 -0
- package/dist-skill/docs/API/model-building/entities.md +282 -0
- package/dist-skill/docs/API/model-building/geometry-conventions.md +104 -0
- package/dist-skill/docs/API/model-building/positioning.md +170 -0
- package/dist-skill/docs/API/model-building/reference.md +1936 -0
- package/dist-skill/docs/API/model-building/sheet-metal.md +180 -0
- package/dist-skill/docs/API/model-building/sketch-anchor.md +32 -0
- package/dist-skill/docs/API/model-building/sketch-booleans.md +101 -0
- package/dist-skill/docs/API/model-building/sketch-core.md +68 -0
- package/dist-skill/docs/API/model-building/sketch-extrude.md +57 -0
- package/dist-skill/docs/API/model-building/sketch-on-face.md +98 -0
- package/dist-skill/docs/API/model-building/sketch-operations.md +92 -0
- package/dist-skill/docs/API/model-building/sketch-path.md +70 -0
- package/dist-skill/docs/API/model-building/sketch-primitives.md +104 -0
- package/dist-skill/docs/API/model-building/sketch-transforms.md +60 -0
- package/dist-skill/docs/API/output/bom.md +53 -0
- package/dist-skill/docs/API/output/brep-export.md +82 -0
- package/dist-skill/docs/API/output/dimensions.md +62 -0
- package/dist-skill/docs/API/runtime/viewport.md +229 -0
- package/dist-skill/docs/CLI.md +672 -0
- package/dist-skill/docs/CODING.md +345 -0
- package/dist-skill/docs/PROGRAM-LEAD.md +180 -0
- package/dist-skill/docs/VISION.md +77 -0
- package/examples/api/import-group-assembly.forge.js +34 -0
- package/examples/api/import-group-source.forge.js +35 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Pn=(()=>{var Ne=import.meta.url;return(async function(Pr={}){var Ge,i=Pr,qe,Se,wr=new Promise((e,r)=>{qe=e,Se=r}),Cr=typeof window=="object",Ae=typeof WorkerGlobalScope<"u",Fe=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";if(Fe){const{createRequire:e}=await import("./evalWorker-DuS4V-H5.js").then(function(r){return r._});var Re=e(import.meta.url)}var Je=!1;i.setup=function(){if(Je)return;Je=!0,i.initTBB();function e(o,a,l=(v=>v)){if(a)for(let v of a)o.push_back(l(v));return o}function r(o,a=(l=>l)){const l=[],v=o.size();for(let _=0;_<v;_++)l.push(a(o.get(_)));return l}function t(o,a=(l=>l)){const l=[],v=o.size();for(let _=0;_<v;_++){const b=o.get(_),T=b.size(),W=[];for(let w=0;w<T;w++)W.push(a(b.get(w)));l.push(W)}return l}function n(o){return o[0].length<3&&(o=[o]),e(new i.Vector2_vec2,o,a=>e(new i.Vector_vec2,a,l=>l instanceof Array?{x:l[0],y:l[1]}:l))}function s(o){for(let a=0;a<o.size();a++)o.get(a).delete();o.delete()}function u(o){return o[0]instanceof Array?{x:o[0][0],y:o[0][1]}:typeof o[0]=="number"?{x:o[0]||0,y:o[1]||0}:o[0]}function f(o){return o[0]instanceof Array?{x:o[0][0],y:o[0][1],z:o[0][2]}:typeof o[0]=="number"?{x:o[0]||0,y:o[1]||0,z:o[2]||0}:o[0]}function c(o){return o=="EvenOdd"?0:o=="NonZero"?1:o=="Negative"?3:2}function d(o){return o=="Round"?1:o=="Miter"?2:0}const p=i.CrossSection;function h(o,a="Positive"){if(o instanceof p)return o;{const l=n(o),v=new p(l,c(a));return s(l),v}}i.CrossSection.prototype.translate=function(...o){return this._Translate(u(o))},i.CrossSection.prototype.scale=function(o){return typeof o=="number"?this._Scale({x:o,y:o}):this._Scale(u([o]))},i.CrossSection.prototype.mirror=function(o){return this._Mirror(u([o]))},i.CrossSection.prototype.warp=function(o){const a=oe(function(v){const _=O(v,"double"),b=O(v+8,"double"),T=[_,b];o(T),J(v,T[0],"double"),J(v+8,T[1],"double")},"vi"),l=this._Warp(a);return ie(a),l},i.CrossSection.prototype.decompose=function(){const o=this._Decompose(),a=r(o);return o.delete(),a},i.CrossSection.prototype.bounds=function(){const o=this._Bounds();return{min:["x","y"].map(a=>o.min[a]),max:["x","y"].map(a=>o.max[a])}},i.CrossSection.prototype.offset=function(o,a="Square",l=2,v=0){return this._Offset(o,d(a),l,v)},i.CrossSection.prototype.simplify=function(o=1e-6){return this._Simplify(o)},i.CrossSection.prototype.extrude=function(o,a=0,l=0,v=[1,1],_=!1){v=u([v]);const b=i._Extrude(this._ToPolygons(),o,a,l,v);return _?b.translate([0,0,-o/2]):b},i.CrossSection.prototype.revolve=function(o=0,a=360){return i._Revolve(this._ToPolygons(),o,a)},i.CrossSection.prototype.add=function(o){return this._add(h(o))},i.CrossSection.prototype.subtract=function(o){return this._subtract(h(o))},i.CrossSection.prototype.intersect=function(o){return this._intersect(h(o))},i.CrossSection.prototype.toPolygons=function(){const o=this._ToPolygons(),a=t(o,l=>[l.x,l.y]);return o.delete(),a},i.Manifold.prototype.smoothOut=function(o=60,a=0){return this._SmoothOut(o,a)},i.Manifold.prototype.warp=function(o){const a=oe(function(_){const b=O(_,"double"),T=O(_+8,"double"),W=O(_+16,"double"),w=[b,T,W];o(w),J(_,w[0],"double"),J(_+8,w[1],"double"),J(_+16,w[2],"double")},"vi"),l=this._Warp(a);ie(a);const v=l.status();if(v.value!==0)throw new i.ManifoldError(v.value);return l},i.Manifold.prototype.calculateNormals=function(o,a=60){return this._CalculateNormals(o,a)},i.Manifold.prototype.setProperties=function(o,a){const l=this.numProp(),v=oe(function(b,T,W){const w=[];for(let C=0;C<o;++C)w[C]=O(b+8*C,"double");const Z=[];for(let C=0;C<3;++C)Z[C]=O(T+8*C,"double");const Q=[];for(let C=0;C<l;++C)Q[C]=O(W+8*C,"double");a(w,Z,Q);for(let C=0;C<o;++C)J(b+8*C,w[C],"double")},"viii"),_=this._SetProperties(o,v);return ie(v),_},i.Manifold.prototype.translate=function(...o){return this._Translate(f(o))},i.Manifold.prototype.rotate=function(o,a,l){return Array.isArray(o)?this._Rotate(...o):this._Rotate(o,a||0,l||0)},i.Manifold.prototype.scale=function(o){return typeof o=="number"?this._Scale({x:o,y:o,z:o}):this._Scale(f([o]))},i.Manifold.prototype.mirror=function(o){return this._Mirror(f([o]))},i.Manifold.prototype.trimByPlane=function(o,a=0){return this._TrimByPlane(f([o]),a)},i.Manifold.prototype.slice=function(o=0){const a=this._Slice(o),l=new p(a,c("Positive"));return s(a),l},i.Manifold.prototype.project=function(){const o=this._Project(),a=new p(o,c("Positive"));return s(o),a},i.Manifold.prototype.split=function(o){const a=this._Split(o),l=r(a);return a.delete(),l},i.Manifold.prototype.splitByPlane=function(o,a=0){const l=this._SplitByPlane(f([o]),a),v=r(l);return l.delete(),v},i.Manifold.prototype.decompose=function(){const o=this._Decompose(),a=r(o);return o.delete(),a},i.Manifold.prototype.boundingBox=function(){const o=this._boundingBox();return{min:["x","y","z"].map(a=>o.min[a]),max:["x","y","z"].map(a=>o.max[a])}};class y{constructor({numProp:a=3,triVerts:l=new Uint32Array,vertProperties:v=new Float32Array,mergeFromVert:_,mergeToVert:b,runIndex:T,runOriginalID:W,faceID:w,halfedgeTangent:Z,runTransform:Q}={}){this.numProp=a,this.triVerts=l,this.vertProperties=v,this.mergeFromVert=_,this.mergeToVert=b,this.runIndex=T,this.runOriginalID=W,this.faceID=w,this.halfedgeTangent=Z,this.runTransform=Q}get numTri(){return this.triVerts.length/3}get numVert(){return this.vertProperties.length/this.numProp}get numRun(){return this.runOriginalID.length}merge(){const{changed:a,mesh:l}=i._Merge(this);return Object.assign(this,{...l}),a}verts(a){return this.triVerts.subarray(3*a,3*(a+1))}position(a){return this.vertProperties.subarray(this.numProp*a,this.numProp*a+3)}extras(a){return this.vertProperties.subarray(this.numProp*a+3,this.numProp*(a+1))}tangent(a){return this.halfedgeTangent.subarray(4*a,4*(a+1))}transform(a){const l=new Array(16);for(const v of[0,1,2,3])for(const _ of[0,1,2])l[4*v+_]=this.runTransform[12*a+3*v+_];return l[15]=1,l}}i.Mesh=y,i.Manifold.prototype.getMesh=function(o=-1){return new y(this._GetMeshJS(o))},i.ManifoldError=function(a,...l){let v="Unknown error";switch(a){case i.status.NonFiniteVertex.value:v="Non-finite vertex";break;case i.status.NotManifold.value:v="Not manifold";break;case i.status.VertexOutOfBounds.value:v="Vertex index out of bounds";break;case i.status.PropertiesWrongLength.value:v="Properties have wrong length";break;case i.status.MissingPositionProperties.value:v="Less than three properties";break;case i.status.MergeVectorsDifferentLengths.value:v="Merge vectors have different lengths";break;case i.status.MergeIndexOutOfBounds.value:v="Merge index out of bounds";break;case i.status.TransformWrongLength.value:v="Transform vector has wrong length";break;case i.status.RunIndexWrongLength.value:v="Run index vector has wrong length";break;case i.status.FaceIDWrongLength.value:v="Face ID vector has wrong length";case i.status.InvalidConstruction.value:v="Manifold constructed with invalid parameters"}const _=Error.apply(this,[v,...l]);_.name=this.name="ManifoldError",this.message=_.message,this.stack=_.stack,this.code=a},i.ManifoldError.prototype=Object.create(Error.prototype,{constructor:{value:i.ManifoldError,writable:!0,configurable:!0}}),i.CrossSection=function(o,a="Positive"){const l=n(o),v=new p(l,c(a));return s(l),v},i.CrossSection.ofPolygons=function(o,a="Positive"){return new i.CrossSection(o,a)},i.CrossSection.square=function(...o){let a;o.length==0?a={x:1,y:1}:typeof o[0]=="number"?a={x:o[0],y:o[0]}:a=u(o);const l=o[1]||!1;return i._Square(a,l)},i.CrossSection.circle=function(o,a=0){return i._Circle(o,a)};function g(o){return function(...a){a.length==1&&(a=a[0]);const l=new i.Vector_crossSection;for(const _ of a)l.push_back(h(_));const v=i["_crossSection"+o](l);return l.delete(),v}}i.CrossSection.compose=g("Compose"),i.CrossSection.union=g("UnionN"),i.CrossSection.difference=g("DifferenceN"),i.CrossSection.intersection=g("IntersectionN");function F(o,a){e(o,a,l=>l instanceof Array?{x:l[0],y:l[1]}:l)}i.CrossSection.hull=function(...o){o.length==1&&(o=o[0]);let a=new i.Vector_vec2;for(const v of o)if(v instanceof p)i._crossSectionCollectVertices(a,v);else if(v instanceof Array&&v.length==2&&typeof v[0]=="number")a.push_back({x:v[0],y:v[1]});else if(v.x)a.push_back(v);else{const b=v[0].length==2&&typeof v[0][0]=="number"||v[0].x?[v]:v;for(const T of b)F(a,T)}const l=i._crossSectionHullPoints(a);return a.delete(),l},i.CrossSection.prototype=Object.create(p.prototype),Object.defineProperty(i.CrossSection,Symbol.hasInstance,{get:()=>o=>o instanceof p});const $=i.Manifold;i.Manifold=function(o){const a=new $(o),l=a.status();if(l.value!==0)throw new i.ManifoldError(l.value);return a},i.Manifold.ofMesh=function(o){return new i.Manifold(o)},i.Manifold.tetrahedron=function(){return i._Tetrahedron()},i.Manifold.cube=function(...o){let a;o.length==0?a={x:1,y:1,z:1}:typeof o[0]=="number"?a={x:o[0],y:o[0],z:o[0]}:a=f(o);const l=o[1]||!1;return i._Cube(a,l)},i.Manifold.cylinder=function(o,a,l=-1,v=0,_=!1){return i._Cylinder(o,a,l,v,_)},i.Manifold.sphere=function(o,a=0){return i._Sphere(o,a)},i.Manifold.smooth=function(o,a=[]){const l=new i.Vector_smoothness;e(l,a);const v=i._Smooth(o,l);return l.delete(),v},i.Manifold.extrude=function(o,a,l=0,v=0,_=[1,1],b=!1){return(o instanceof p?o:i.CrossSection(o,"Positive")).extrude(a,l,v,_,b)},i.Manifold.revolve=function(o,a=0,l=360){return(o instanceof p?o:i.CrossSection(o,"Positive")).revolve(a,l)},i.Manifold.reserveIDs=function(o){return i._ReserveIDs(o)},i.Manifold.compose=function(o){const a=new i.Vector_manifold;e(a,o);const l=i._manifoldCompose(a);return a.delete(),l};function R(o){return function(...a){a.length==1&&(a=a[0]);const l=new i.Vector_manifold;for(const _ of a)l.push_back(_);const v=i["_manifold"+o+"N"](l);return l.delete(),v}}i.Manifold.union=R("Union"),i.Manifold.difference=R("Difference"),i.Manifold.intersection=R("Intersection"),i.Manifold.levelSet=function(o,a,l,v=0,_=-1){const b={min:{x:a.min[0],y:a.min[1],z:a.min[2]},max:{x:a.max[0],y:a.max[1],z:a.max[2]}},T=oe(function(w){const Z=O(w,"double"),Q=O(w+8,"double"),C=O(w+16,"double");return o([Z,Q,C])},"di"),W=i._LevelSet(T,b,l,v,_);return ie(T),W};function U(o,a){e(o,a,l=>l instanceof Array?{x:l[0],y:l[1],z:l[2]}:l)}i.Manifold.hull=function(...o){o.length==1&&(o=o[0]);let a=new i.Vector_vec3;for(const v of o)v instanceof $?i._manifoldCollectVertices(a,v):v instanceof Array&&v.length==3&&typeof v[0]=="number"?a.push_back({x:v[0],y:v[1],z:v[2]}):v.x?a.push_back(v):U(a,v);const l=i._manifoldHullPoints(a);return a.delete(),l},i.Manifold.prototype=Object.create($.prototype),Object.defineProperty(i.Manifold,Symbol.hasInstance,{get:()=>o=>o instanceof $}),i.triangulate=function(o,a=-1,l=!0){const v=n(o),_=r(i._Triangulate(v,a,l),b=>[b[0],b[1],b[2]]);return s(v),_}};var Ke={...i},k="";function Tr(e){return i.locateFile?i.locateFile(e,k):k+e}var We,se;if(Fe){var Xe=Re("fs"),Sr=Re("path");import.meta.url.startsWith("data:")||(k=Sr.dirname(Re("url").fileURLToPath(import.meta.url))+"/"),se=e=>{e=de(e)?new URL(e):e;var r=Xe.readFileSync(e);return r},We=async(e,r=!0)=>{e=de(e)?new URL(e):e;var t=Xe.readFileSync(e,r?void 0:"utf8");return t},!i.thisProgram&&process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2)}else(Cr||Ae)&&(Ae?k=self.location.href:typeof document<"u"&&document.currentScript&&(k=document.currentScript.src),Ne&&(k=Ne),k.startsWith("blob:")?k="":k=k.slice(0,k.replace(/[?#].*/,"").lastIndexOf("/")+1),Ae&&(se=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),We=async e=>{if(de(e))return new Promise((t,n)=>{var s=new XMLHttpRequest;s.open("GET",e,!0),s.responseType="arraybuffer",s.onload=()=>{if(s.status==200||s.status==0&&s.response){t(s.response);return}n(s.status)},s.onerror=n,s.send(null)});var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)});i.print||console.log.bind(console);var ae=i.printErr||console.error.bind(console);Object.assign(i,Ke),Ke=null,i.arguments&&i.arguments,i.thisProgram&&i.thisProgram;var ue=i.wasmBinary,ce,Ze=!1,E,M,B,Y,H,P,fe,le,Qe,ve,de=e=>e.startsWith("file://");function Ye(){var e=ce.buffer;i.HEAP8=E=new Int8Array(e),i.HEAP16=B=new Int16Array(e),i.HEAPU8=M=new Uint8Array(e),i.HEAPU16=Y=new Uint16Array(e),i.HEAP32=H=new Int32Array(e),i.HEAPU32=P=new Uint32Array(e),i.HEAPF32=fe=new Float32Array(e),i.HEAPF64=ve=new Float64Array(e),i.HEAP64=le=new BigInt64Array(e),i.HEAPU64=Qe=new BigUint64Array(e)}function Ar(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)Ur(i.preRun.shift());er(tr)}function Fr(){j.J()}function Rr(){if(i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)xr(i.postRun.shift());er(rr)}var L=0,ee=null;function Wr(e){var r;L++,(r=i.monitorRunDependencies)==null||r.call(i,L)}function Er(e){var t;if(L--,(t=i.monitorRunDependencies)==null||t.call(i,L),L==0&&ee){var r=ee;ee=null,r()}}function pe(e){var t;(t=i.onAbort)==null||t.call(i,e),e="Aborted("+e+")",ae(e),Ze=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw Se(r),r}var Ee;function Mr(){return i.locateFile?Tr("manifold.wasm"):new URL("/assets/manifold-C44_QbND.wasm",import.meta.url).href}function Vr(e){if(e==Ee&&ue)return new Uint8Array(ue);if(se)return se(e);throw"both async and sync fetching of the wasm failed"}async function kr(e){if(!ue)try{var r=await We(e);return new Uint8Array(r)}catch{}return Vr(e)}async function Or(e,r){try{var t=await kr(e),n=await WebAssembly.instantiate(t,r);return n}catch(s){ae(`failed to asynchronously prepare wasm: ${s}`),pe(s)}}async function Dr(e,r,t){if(!e&&typeof WebAssembly.instantiateStreaming=="function"&&!de(r)&&!Fe)try{var n=fetch(r,{credentials:"same-origin"}),s=await WebAssembly.instantiateStreaming(n,t);return s}catch(u){ae(`wasm streaming compile failed: ${u}`),ae("falling back to ArrayBuffer instantiation")}return Or(r,t)}function Ir(){return{a:mn}}async function jr(){function e(u,f){return j=u.exports,j=bn(j),ce=j.I,Ye(),X=j.L,Er(),j}Wr();function r(u){return e(u.instance)}var t=Ir();if(i.instantiateWasm)return new Promise((u,f)=>{i.instantiateWasm(t,(c,d)=>{e(c),u(c.exports)})});Ee??(Ee=Mr());try{var n=await Dr(ue,Ee,t),s=r(n);return s}catch(u){return Se(u),Promise.reject(u)}}var er=e=>{for(;e.length>0;)e.shift()(i)},rr=[],xr=e=>rr.unshift(e),tr=[],Ur=e=>tr.unshift(e);function O(e,r="i8"){switch(r.endsWith("*")&&(r="*"),r){case"i1":return E[e>>>0];case"i8":return E[e>>>0];case"i16":return B[e>>>1>>>0];case"i32":return H[e>>>2>>>0];case"i64":return le[e>>>3];case"float":return fe[e>>>2>>>0];case"double":return ve[e>>>3>>>0];case"*":return P[e>>>2>>>0];default:pe(`invalid type for getValue: ${r}`)}}i.noExitRuntime;function J(e,r,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":E[e>>>0]=r;break;case"i8":E[e>>>0]=r;break;case"i16":B[e>>>1>>>0]=r;break;case"i32":H[e>>>2>>>0]=r;break;case"i64":le[e>>>3]=BigInt(r);break;case"float":fe[e>>>2>>>0]=r;break;case"double":ve[e>>>3>>>0]=r;break;case"*":P[e>>>2>>>0]=r;break;default:pe(`invalid type for setValue: ${t}`)}}class Br{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){P[this.ptr+4>>>2>>>0]=r}get_type(){return P[this.ptr+4>>>2>>>0]}set_destructor(r){P[this.ptr+8>>>2>>>0]=r}get_destructor(){return P[this.ptr+8>>>2>>>0]}set_caught(r){r=r?1:0,E[this.ptr+12>>>0]=r}get_caught(){return E[this.ptr+12>>>0]!=0}set_rethrown(r){r=r?1:0,E[this.ptr+13>>>0]=r}get_rethrown(){return E[this.ptr+13>>>0]!=0}init(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t)}set_adjusted_ptr(r){P[this.ptr+16>>>2>>>0]=r}get_adjusted_ptr(){return P[this.ptr+16>>>2>>>0]}}var nr=0;function Hr(e,r,t){e>>>=0,r>>>=0,t>>>=0;var n=new Br(e);throw n.init(r,t),nr=e,nr}var Lr=()=>pe(""),he={},Me=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r)}};function re(e){return this.fromWireType(P[e>>>2>>>0])}var K={},z={},ye={},zr=i.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},_e=e=>{throw new zr(e)},N=(e,r,t)=>{e.forEach(c=>ye[c]=r);function n(c){var d=t(c);d.length!==e.length&&_e("Mismatched type converter count");for(var p=0;p<e.length;++p)V(e[p],d[p])}var s=new Array(r.length),u=[],f=0;r.forEach((c,d)=>{z.hasOwnProperty(c)?s[d]=z[c]:(u.push(c),K.hasOwnProperty(c)||(K[c]=[]),K[c].push(()=>{s[d]=z[c],++f,f===u.length&&n(s)}))}),u.length===0&&n(s)},Nr=function(e){e>>>=0;var r=he[e];delete he[e];var t=r.rawConstructor,n=r.rawDestructor,s=r.fields,u=s.map(f=>f.getterReturnType).concat(s.map(f=>f.setterArgumentType));N([e],u,f=>{var c={};return s.forEach((d,p)=>{var h=d.fieldName,y=f[p],g=f[p].optional,F=d.getter,$=d.getterContext,R=f[p+s.length],U=d.setter,o=d.setterContext;c[h]={read:a=>y.fromWireType(F($,a)),write:(a,l)=>{var v=[];U(o,a,R.toWireType(v,l)),Me(v)},optional:g}}),[{name:r.name,fromWireType:d=>{var p={};for(var h in c)p[h]=c[h].read(d);return n(d),p},toWireType:(d,p)=>{for(var h in c)if(!(h in p)&&!c[h].optional)throw new TypeError(`Missing field: "${h}"`);var y=t();for(h in c)c[h].write(y,p[h]);return d!==null&&d.push(n,y),y},argPackAdvance:D,readValueFromPointer:re,destructorFunction:n}]})},me=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},Gr=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);or=e},or,S=e=>{for(var r="",t=e;M[t>>>0];)r+=or[M[t++>>>0]];return r},te=i.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},m=e=>{throw new te(e)};function qr(e,r,t={}){var n=r.name;if(e||m(`type "${n}" must have a positive integer typeid pointer`),z.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;m(`Cannot register type '${n}' twice`)}if(z[e]=r,delete ye[e],K.hasOwnProperty(e)){var s=K[e];delete K[e],s.forEach(u=>u())}}function V(e,r,t={}){return qr(e,r,t)}var ir=(e,r,t)=>{switch(r){case 1:return t?n=>E[n>>>0]:n=>M[n>>>0];case 2:return t?n=>B[n>>>1>>>0]:n=>Y[n>>>1>>>0];case 4:return t?n=>H[n>>>2>>>0]:n=>P[n>>>2>>>0];case 8:return t?n=>le[n>>>3]:n=>Qe[n>>>3];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}};function Jr(e,r,t,n,s){e>>>=0,r>>>=0,t>>>=0,r=S(r);var u=r.indexOf("u")!=-1;V(e,{name:r,fromWireType:f=>f,toWireType:function(f,c){if(typeof c!="bigint"&&typeof c!="number")throw new TypeError(`Cannot convert "${me(c)}" to ${this.name}`);return typeof c=="number"&&(c=BigInt(c)),c},argPackAdvance:D,readValueFromPointer:ir(r,t,!u),destructorFunction:null})}var D=8;function Kr(e,r,t,n){e>>>=0,r>>>=0,r=S(r),V(e,{name:r,fromWireType:function(s){return!!s},toWireType:function(s,u){return u?t:n},argPackAdvance:D,readValueFromPointer:function(s){return this.fromWireType(M[s>>>0])},destructorFunction:null})}var Xr=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Ve=e=>{function r(t){return t.$$.ptrType.registeredClass.name}m(r(e)+" instance already deleted")},ke=!1,sr=e=>{},Zr=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},ar=e=>{e.count.value-=1;var r=e.count.value===0;r&&Zr(e)},ne=e=>typeof FinalizationRegistry>"u"?(ne=r=>r,e):(ke=new FinalizationRegistry(r=>{ar(r.$$)}),ne=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var s={$$:t};ke.register(r,s,r)}return r},sr=r=>ke.unregister(r),ne(e)),Qr=()=>{let e=ge.prototype;Object.assign(e,{isAliasOf(t){if(!(this instanceof ge)||!(t instanceof ge))return!1;var n=this.$$.ptrType.registeredClass,s=this.$$.ptr;t.$$=t.$$;for(var u=t.$$.ptrType.registeredClass,f=t.$$.ptr;n.baseClass;)s=n.upcast(s),n=n.baseClass;for(;u.baseClass;)f=u.upcast(f),u=u.baseClass;return n===u&&s===f},clone(){if(this.$$.ptr||Ve(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t=ne(Object.create(Object.getPrototypeOf(this),{$$:{value:Xr(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||Ve(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&m("Object already scheduled for deletion"),sr(this),ar(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Ve(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&m("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}});const r=Symbol.dispose;r&&(e[r]=e.delete)};function ge(){}var be=(e,r)=>Object.defineProperty(r,"name",{value:e}),ur={},cr=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...s){return e[r].overloadTable.hasOwnProperty(s.length)||m(`Function '${t}' called with an invalid number of arguments (${s.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[s.length].apply(this,s)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},Oe=(e,r,t)=>{i.hasOwnProperty(e)?((t===void 0||i[e].overloadTable!==void 0&&i[e].overloadTable[t]!==void 0)&&m(`Cannot register public name '${e}' twice`),cr(i,e,e),i[e].overloadTable.hasOwnProperty(t)&&m(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),i[e].overloadTable[t]=r):(i[e]=r,i[e].argCount=t)},Yr=48,et=57,rt=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=Yr&&r<=et?`_${e}`:e};function tt(e,r,t,n,s,u,f,c){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=s,this.getActualType=u,this.upcast=f,this.downcast=c,this.pureVirtualFunctions=[]}var De=(e,r,t)=>{for(;r!==t;)r.upcast||m(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function nt(e,r){if(r===null)return this.isReference&&m(`null is not a valid ${this.name}`),0;r.$$||m(`Cannot pass "${me(r)}" as a ${this.name}`),r.$$.ptr||m(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=De(r.$$.ptr,t,this.registeredClass);return n}function ot(e,r){var t;if(r===null)return this.isReference&&m(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&m(`Cannot pass "${me(r)}" as a ${this.name}`),r.$$.ptr||m(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&m(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(t=De(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&m("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:m(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var s=r.clone();t=this.rawShare(t,A.toHandle(()=>s.delete())),e!==null&&e.push(this.rawDestructor,t)}break;default:m("Unsupporting sharing policy")}return t}function it(e,r){if(r===null)return this.isReference&&m(`null is not a valid ${this.name}`),0;r.$$||m(`Cannot pass "${me(r)}" as a ${this.name}`),r.$$.ptr||m(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&m(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=De(r.$$.ptr,t,this.registeredClass);return n}var fr=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=fr(e,r,t.baseClass);return n===null?null:t.downcast(n)},st={},at=(e,r)=>{for(r===void 0&&m("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},ut=(e,r)=>(r=at(e,r),st[r]),$e=(e,r)=>{(!r.ptrType||!r.ptr)&&_e("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&_e("Both smartPtrType and smartPtr must be specified"),r.count={value:1},ne(Object.create(e,{$$:{value:r,writable:!0}}))};function ct(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=ut(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function s(){return this.isSmartPointer?$e(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):$e(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var u=this.registeredClass.getActualType(r),f=ur[u];if(!f)return s.call(this);var c;this.isConst?c=f.constPointerType:c=f.pointerType;var d=fr(r,this.registeredClass,c.registeredClass);return d===null?s.call(this):this.isSmartPointer?$e(c.registeredClass.instancePrototype,{ptrType:c,ptr:d,smartPtrType:this,smartPtr:e}):$e(c.registeredClass.instancePrototype,{ptrType:c,ptr:d})}var ft=()=>{Object.assign(Pe.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){var r;(r=this.rawDestructor)==null||r.call(this,e)},argPackAdvance:D,readValueFromPointer:re,fromWireType:ct})};function Pe(e,r,t,n,s,u,f,c,d,p,h){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=s,this.pointeeType=u,this.sharingPolicy=f,this.rawGetPointee=c,this.rawConstructor=d,this.rawShare=p,this.rawDestructor=h,!s&&r.baseClass===void 0?n?(this.toWireType=nt,this.destructorFunction=null):(this.toWireType=it,this.destructorFunction=null):this.toWireType=ot}var lr=(e,r,t)=>{i.hasOwnProperty(e)||_e("Replacing nonexistent public symbol"),i[e].overloadTable!==void 0&&t!==void 0?i[e].overloadTable[t]=r:(i[e]=r,i[e].argCount=t)},X,we=e=>X.get(e),lt=(e,r,t=[],n=!1)=>{var s=we(r),u=s(...t);return e[0]=="p"?u>>>0:u},vt=(e,r,t=!1)=>(...n)=>lt(e,r,n,t),I=(e,r,t=!1)=>{e=S(e);function n(){if(e.includes("p"))return vt(e,r,t);var u=we(r);return u}var s=n();return typeof s!="function"&&m(`unknown function pointer with signature ${e}: ${r}`),s};class dt extends Error{}var vr=e=>{var r=gn(e),t=S(r);return q(r),t},Ce=(e,r)=>{var t=[],n={};function s(u){if(!n[u]&&!z[u]){if(ye[u]){ye[u].forEach(s);return}t.push(u),n[u]=!0}}throw r.forEach(s),new dt(`${e}: `+t.map(vr).join([", "]))};function pt(e,r,t,n,s,u,f,c,d,p,h,y,g){e>>>=0,r>>>=0,t>>>=0,n>>>=0,s>>>=0,u>>>=0,f>>>=0,c>>>=0,d>>>=0,p>>>=0,h>>>=0,y>>>=0,g>>>=0,h=S(h),u=I(s,u),c&&(c=I(f,c)),p&&(p=I(d,p)),g=I(y,g);var F=rt(h);Oe(F,function(){Ce(`Cannot construct ${h} due to unbound types`,[n])}),N([e,r,t],n?[n]:[],$=>{var T;$=$[0];var R,U;n?(R=$.registeredClass,U=R.instancePrototype):U=ge.prototype;var o=be(h,function(...W){if(Object.getPrototypeOf(this)!==a)throw new te(`Use 'new' to construct ${h}`);if(l.constructor_body===void 0)throw new te(`${h} has no accessible constructor`);var w=l.constructor_body[W.length];if(w===void 0)throw new te(`Tried to invoke ctor of ${h} with invalid number of parameters (${W.length}) - expected (${Object.keys(l.constructor_body).toString()}) parameters instead!`);return w.apply(this,W)}),a=Object.create(U,{constructor:{value:o}});o.prototype=a;var l=new tt(h,o,a,g,R,u,c,p);l.baseClass&&((T=l.baseClass).__derivedClasses??(T.__derivedClasses=[]),l.baseClass.__derivedClasses.push(l));var v=new Pe(h,l,!0,!1,!1),_=new Pe(h+"*",l,!1,!1,!1),b=new Pe(h+" const*",l,!1,!0,!1);return ur[e]={pointerType:_,constPointerType:b},lr(F,o),[v,_,b]})}var Ie=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push(P[r+n*4>>>2>>>0]);return t};function dr(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function ht(e,r,t,n){var s=dr(e),u=e.length-2,f=[],c=["fn"];r&&c.push("thisWired");for(var d=0;d<u;++d)f.push(`arg${d}`),c.push(`arg${d}Wired`);f=f.join(","),c=c.join(",");var p=`return function (${f}) {
|
|
1
|
+
var Pn=(()=>{var Ne=import.meta.url;return(async function(Pr={}){var Ge,i=Pr,qe,Se,wr=new Promise((e,r)=>{qe=e,Se=r}),Cr=typeof window=="object",Ae=typeof WorkerGlobalScope<"u",Fe=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";if(Fe){const{createRequire:e}=await import("./evalWorker-1m873KWd.js").then(function(r){return r._});var Re=e(import.meta.url)}var Je=!1;i.setup=function(){if(Je)return;Je=!0,i.initTBB();function e(o,a,l=(v=>v)){if(a)for(let v of a)o.push_back(l(v));return o}function r(o,a=(l=>l)){const l=[],v=o.size();for(let _=0;_<v;_++)l.push(a(o.get(_)));return l}function t(o,a=(l=>l)){const l=[],v=o.size();for(let _=0;_<v;_++){const b=o.get(_),T=b.size(),W=[];for(let w=0;w<T;w++)W.push(a(b.get(w)));l.push(W)}return l}function n(o){return o[0].length<3&&(o=[o]),e(new i.Vector2_vec2,o,a=>e(new i.Vector_vec2,a,l=>l instanceof Array?{x:l[0],y:l[1]}:l))}function s(o){for(let a=0;a<o.size();a++)o.get(a).delete();o.delete()}function u(o){return o[0]instanceof Array?{x:o[0][0],y:o[0][1]}:typeof o[0]=="number"?{x:o[0]||0,y:o[1]||0}:o[0]}function f(o){return o[0]instanceof Array?{x:o[0][0],y:o[0][1],z:o[0][2]}:typeof o[0]=="number"?{x:o[0]||0,y:o[1]||0,z:o[2]||0}:o[0]}function c(o){return o=="EvenOdd"?0:o=="NonZero"?1:o=="Negative"?3:2}function d(o){return o=="Round"?1:o=="Miter"?2:0}const p=i.CrossSection;function h(o,a="Positive"){if(o instanceof p)return o;{const l=n(o),v=new p(l,c(a));return s(l),v}}i.CrossSection.prototype.translate=function(...o){return this._Translate(u(o))},i.CrossSection.prototype.scale=function(o){return typeof o=="number"?this._Scale({x:o,y:o}):this._Scale(u([o]))},i.CrossSection.prototype.mirror=function(o){return this._Mirror(u([o]))},i.CrossSection.prototype.warp=function(o){const a=oe(function(v){const _=O(v,"double"),b=O(v+8,"double"),T=[_,b];o(T),J(v,T[0],"double"),J(v+8,T[1],"double")},"vi"),l=this._Warp(a);return ie(a),l},i.CrossSection.prototype.decompose=function(){const o=this._Decompose(),a=r(o);return o.delete(),a},i.CrossSection.prototype.bounds=function(){const o=this._Bounds();return{min:["x","y"].map(a=>o.min[a]),max:["x","y"].map(a=>o.max[a])}},i.CrossSection.prototype.offset=function(o,a="Square",l=2,v=0){return this._Offset(o,d(a),l,v)},i.CrossSection.prototype.simplify=function(o=1e-6){return this._Simplify(o)},i.CrossSection.prototype.extrude=function(o,a=0,l=0,v=[1,1],_=!1){v=u([v]);const b=i._Extrude(this._ToPolygons(),o,a,l,v);return _?b.translate([0,0,-o/2]):b},i.CrossSection.prototype.revolve=function(o=0,a=360){return i._Revolve(this._ToPolygons(),o,a)},i.CrossSection.prototype.add=function(o){return this._add(h(o))},i.CrossSection.prototype.subtract=function(o){return this._subtract(h(o))},i.CrossSection.prototype.intersect=function(o){return this._intersect(h(o))},i.CrossSection.prototype.toPolygons=function(){const o=this._ToPolygons(),a=t(o,l=>[l.x,l.y]);return o.delete(),a},i.Manifold.prototype.smoothOut=function(o=60,a=0){return this._SmoothOut(o,a)},i.Manifold.prototype.warp=function(o){const a=oe(function(_){const b=O(_,"double"),T=O(_+8,"double"),W=O(_+16,"double"),w=[b,T,W];o(w),J(_,w[0],"double"),J(_+8,w[1],"double"),J(_+16,w[2],"double")},"vi"),l=this._Warp(a);ie(a);const v=l.status();if(v.value!==0)throw new i.ManifoldError(v.value);return l},i.Manifold.prototype.calculateNormals=function(o,a=60){return this._CalculateNormals(o,a)},i.Manifold.prototype.setProperties=function(o,a){const l=this.numProp(),v=oe(function(b,T,W){const w=[];for(let C=0;C<o;++C)w[C]=O(b+8*C,"double");const Z=[];for(let C=0;C<3;++C)Z[C]=O(T+8*C,"double");const Q=[];for(let C=0;C<l;++C)Q[C]=O(W+8*C,"double");a(w,Z,Q);for(let C=0;C<o;++C)J(b+8*C,w[C],"double")},"viii"),_=this._SetProperties(o,v);return ie(v),_},i.Manifold.prototype.translate=function(...o){return this._Translate(f(o))},i.Manifold.prototype.rotate=function(o,a,l){return Array.isArray(o)?this._Rotate(...o):this._Rotate(o,a||0,l||0)},i.Manifold.prototype.scale=function(o){return typeof o=="number"?this._Scale({x:o,y:o,z:o}):this._Scale(f([o]))},i.Manifold.prototype.mirror=function(o){return this._Mirror(f([o]))},i.Manifold.prototype.trimByPlane=function(o,a=0){return this._TrimByPlane(f([o]),a)},i.Manifold.prototype.slice=function(o=0){const a=this._Slice(o),l=new p(a,c("Positive"));return s(a),l},i.Manifold.prototype.project=function(){const o=this._Project(),a=new p(o,c("Positive"));return s(o),a},i.Manifold.prototype.split=function(o){const a=this._Split(o),l=r(a);return a.delete(),l},i.Manifold.prototype.splitByPlane=function(o,a=0){const l=this._SplitByPlane(f([o]),a),v=r(l);return l.delete(),v},i.Manifold.prototype.decompose=function(){const o=this._Decompose(),a=r(o);return o.delete(),a},i.Manifold.prototype.boundingBox=function(){const o=this._boundingBox();return{min:["x","y","z"].map(a=>o.min[a]),max:["x","y","z"].map(a=>o.max[a])}};class y{constructor({numProp:a=3,triVerts:l=new Uint32Array,vertProperties:v=new Float32Array,mergeFromVert:_,mergeToVert:b,runIndex:T,runOriginalID:W,faceID:w,halfedgeTangent:Z,runTransform:Q}={}){this.numProp=a,this.triVerts=l,this.vertProperties=v,this.mergeFromVert=_,this.mergeToVert=b,this.runIndex=T,this.runOriginalID=W,this.faceID=w,this.halfedgeTangent=Z,this.runTransform=Q}get numTri(){return this.triVerts.length/3}get numVert(){return this.vertProperties.length/this.numProp}get numRun(){return this.runOriginalID.length}merge(){const{changed:a,mesh:l}=i._Merge(this);return Object.assign(this,{...l}),a}verts(a){return this.triVerts.subarray(3*a,3*(a+1))}position(a){return this.vertProperties.subarray(this.numProp*a,this.numProp*a+3)}extras(a){return this.vertProperties.subarray(this.numProp*a+3,this.numProp*(a+1))}tangent(a){return this.halfedgeTangent.subarray(4*a,4*(a+1))}transform(a){const l=new Array(16);for(const v of[0,1,2,3])for(const _ of[0,1,2])l[4*v+_]=this.runTransform[12*a+3*v+_];return l[15]=1,l}}i.Mesh=y,i.Manifold.prototype.getMesh=function(o=-1){return new y(this._GetMeshJS(o))},i.ManifoldError=function(a,...l){let v="Unknown error";switch(a){case i.status.NonFiniteVertex.value:v="Non-finite vertex";break;case i.status.NotManifold.value:v="Not manifold";break;case i.status.VertexOutOfBounds.value:v="Vertex index out of bounds";break;case i.status.PropertiesWrongLength.value:v="Properties have wrong length";break;case i.status.MissingPositionProperties.value:v="Less than three properties";break;case i.status.MergeVectorsDifferentLengths.value:v="Merge vectors have different lengths";break;case i.status.MergeIndexOutOfBounds.value:v="Merge index out of bounds";break;case i.status.TransformWrongLength.value:v="Transform vector has wrong length";break;case i.status.RunIndexWrongLength.value:v="Run index vector has wrong length";break;case i.status.FaceIDWrongLength.value:v="Face ID vector has wrong length";case i.status.InvalidConstruction.value:v="Manifold constructed with invalid parameters"}const _=Error.apply(this,[v,...l]);_.name=this.name="ManifoldError",this.message=_.message,this.stack=_.stack,this.code=a},i.ManifoldError.prototype=Object.create(Error.prototype,{constructor:{value:i.ManifoldError,writable:!0,configurable:!0}}),i.CrossSection=function(o,a="Positive"){const l=n(o),v=new p(l,c(a));return s(l),v},i.CrossSection.ofPolygons=function(o,a="Positive"){return new i.CrossSection(o,a)},i.CrossSection.square=function(...o){let a;o.length==0?a={x:1,y:1}:typeof o[0]=="number"?a={x:o[0],y:o[0]}:a=u(o);const l=o[1]||!1;return i._Square(a,l)},i.CrossSection.circle=function(o,a=0){return i._Circle(o,a)};function g(o){return function(...a){a.length==1&&(a=a[0]);const l=new i.Vector_crossSection;for(const _ of a)l.push_back(h(_));const v=i["_crossSection"+o](l);return l.delete(),v}}i.CrossSection.compose=g("Compose"),i.CrossSection.union=g("UnionN"),i.CrossSection.difference=g("DifferenceN"),i.CrossSection.intersection=g("IntersectionN");function F(o,a){e(o,a,l=>l instanceof Array?{x:l[0],y:l[1]}:l)}i.CrossSection.hull=function(...o){o.length==1&&(o=o[0]);let a=new i.Vector_vec2;for(const v of o)if(v instanceof p)i._crossSectionCollectVertices(a,v);else if(v instanceof Array&&v.length==2&&typeof v[0]=="number")a.push_back({x:v[0],y:v[1]});else if(v.x)a.push_back(v);else{const b=v[0].length==2&&typeof v[0][0]=="number"||v[0].x?[v]:v;for(const T of b)F(a,T)}const l=i._crossSectionHullPoints(a);return a.delete(),l},i.CrossSection.prototype=Object.create(p.prototype),Object.defineProperty(i.CrossSection,Symbol.hasInstance,{get:()=>o=>o instanceof p});const $=i.Manifold;i.Manifold=function(o){const a=new $(o),l=a.status();if(l.value!==0)throw new i.ManifoldError(l.value);return a},i.Manifold.ofMesh=function(o){return new i.Manifold(o)},i.Manifold.tetrahedron=function(){return i._Tetrahedron()},i.Manifold.cube=function(...o){let a;o.length==0?a={x:1,y:1,z:1}:typeof o[0]=="number"?a={x:o[0],y:o[0],z:o[0]}:a=f(o);const l=o[1]||!1;return i._Cube(a,l)},i.Manifold.cylinder=function(o,a,l=-1,v=0,_=!1){return i._Cylinder(o,a,l,v,_)},i.Manifold.sphere=function(o,a=0){return i._Sphere(o,a)},i.Manifold.smooth=function(o,a=[]){const l=new i.Vector_smoothness;e(l,a);const v=i._Smooth(o,l);return l.delete(),v},i.Manifold.extrude=function(o,a,l=0,v=0,_=[1,1],b=!1){return(o instanceof p?o:i.CrossSection(o,"Positive")).extrude(a,l,v,_,b)},i.Manifold.revolve=function(o,a=0,l=360){return(o instanceof p?o:i.CrossSection(o,"Positive")).revolve(a,l)},i.Manifold.reserveIDs=function(o){return i._ReserveIDs(o)},i.Manifold.compose=function(o){const a=new i.Vector_manifold;e(a,o);const l=i._manifoldCompose(a);return a.delete(),l};function R(o){return function(...a){a.length==1&&(a=a[0]);const l=new i.Vector_manifold;for(const _ of a)l.push_back(_);const v=i["_manifold"+o+"N"](l);return l.delete(),v}}i.Manifold.union=R("Union"),i.Manifold.difference=R("Difference"),i.Manifold.intersection=R("Intersection"),i.Manifold.levelSet=function(o,a,l,v=0,_=-1){const b={min:{x:a.min[0],y:a.min[1],z:a.min[2]},max:{x:a.max[0],y:a.max[1],z:a.max[2]}},T=oe(function(w){const Z=O(w,"double"),Q=O(w+8,"double"),C=O(w+16,"double");return o([Z,Q,C])},"di"),W=i._LevelSet(T,b,l,v,_);return ie(T),W};function U(o,a){e(o,a,l=>l instanceof Array?{x:l[0],y:l[1],z:l[2]}:l)}i.Manifold.hull=function(...o){o.length==1&&(o=o[0]);let a=new i.Vector_vec3;for(const v of o)v instanceof $?i._manifoldCollectVertices(a,v):v instanceof Array&&v.length==3&&typeof v[0]=="number"?a.push_back({x:v[0],y:v[1],z:v[2]}):v.x?a.push_back(v):U(a,v);const l=i._manifoldHullPoints(a);return a.delete(),l},i.Manifold.prototype=Object.create($.prototype),Object.defineProperty(i.Manifold,Symbol.hasInstance,{get:()=>o=>o instanceof $}),i.triangulate=function(o,a=-1,l=!0){const v=n(o),_=r(i._Triangulate(v,a,l),b=>[b[0],b[1],b[2]]);return s(v),_}};var Ke={...i},k="";function Tr(e){return i.locateFile?i.locateFile(e,k):k+e}var We,se;if(Fe){var Xe=Re("fs"),Sr=Re("path");import.meta.url.startsWith("data:")||(k=Sr.dirname(Re("url").fileURLToPath(import.meta.url))+"/"),se=e=>{e=de(e)?new URL(e):e;var r=Xe.readFileSync(e);return r},We=async(e,r=!0)=>{e=de(e)?new URL(e):e;var t=Xe.readFileSync(e,r?void 0:"utf8");return t},!i.thisProgram&&process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2)}else(Cr||Ae)&&(Ae?k=self.location.href:typeof document<"u"&&document.currentScript&&(k=document.currentScript.src),Ne&&(k=Ne),k.startsWith("blob:")?k="":k=k.slice(0,k.replace(/[?#].*/,"").lastIndexOf("/")+1),Ae&&(se=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),We=async e=>{if(de(e))return new Promise((t,n)=>{var s=new XMLHttpRequest;s.open("GET",e,!0),s.responseType="arraybuffer",s.onload=()=>{if(s.status==200||s.status==0&&s.response){t(s.response);return}n(s.status)},s.onerror=n,s.send(null)});var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)});i.print||console.log.bind(console);var ae=i.printErr||console.error.bind(console);Object.assign(i,Ke),Ke=null,i.arguments&&i.arguments,i.thisProgram&&i.thisProgram;var ue=i.wasmBinary,ce,Ze=!1,E,M,B,Y,H,P,fe,le,Qe,ve,de=e=>e.startsWith("file://");function Ye(){var e=ce.buffer;i.HEAP8=E=new Int8Array(e),i.HEAP16=B=new Int16Array(e),i.HEAPU8=M=new Uint8Array(e),i.HEAPU16=Y=new Uint16Array(e),i.HEAP32=H=new Int32Array(e),i.HEAPU32=P=new Uint32Array(e),i.HEAPF32=fe=new Float32Array(e),i.HEAPF64=ve=new Float64Array(e),i.HEAP64=le=new BigInt64Array(e),i.HEAPU64=Qe=new BigUint64Array(e)}function Ar(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)Ur(i.preRun.shift());er(tr)}function Fr(){j.J()}function Rr(){if(i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)xr(i.postRun.shift());er(rr)}var L=0,ee=null;function Wr(e){var r;L++,(r=i.monitorRunDependencies)==null||r.call(i,L)}function Er(e){var t;if(L--,(t=i.monitorRunDependencies)==null||t.call(i,L),L==0&&ee){var r=ee;ee=null,r()}}function pe(e){var t;(t=i.onAbort)==null||t.call(i,e),e="Aborted("+e+")",ae(e),Ze=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw Se(r),r}var Ee;function Mr(){return i.locateFile?Tr("manifold.wasm"):new URL("/assets/manifold-C44_QbND.wasm",import.meta.url).href}function Vr(e){if(e==Ee&&ue)return new Uint8Array(ue);if(se)return se(e);throw"both async and sync fetching of the wasm failed"}async function kr(e){if(!ue)try{var r=await We(e);return new Uint8Array(r)}catch{}return Vr(e)}async function Or(e,r){try{var t=await kr(e),n=await WebAssembly.instantiate(t,r);return n}catch(s){ae(`failed to asynchronously prepare wasm: ${s}`),pe(s)}}async function Dr(e,r,t){if(!e&&typeof WebAssembly.instantiateStreaming=="function"&&!de(r)&&!Fe)try{var n=fetch(r,{credentials:"same-origin"}),s=await WebAssembly.instantiateStreaming(n,t);return s}catch(u){ae(`wasm streaming compile failed: ${u}`),ae("falling back to ArrayBuffer instantiation")}return Or(r,t)}function Ir(){return{a:mn}}async function jr(){function e(u,f){return j=u.exports,j=bn(j),ce=j.I,Ye(),X=j.L,Er(),j}Wr();function r(u){return e(u.instance)}var t=Ir();if(i.instantiateWasm)return new Promise((u,f)=>{i.instantiateWasm(t,(c,d)=>{e(c),u(c.exports)})});Ee??(Ee=Mr());try{var n=await Dr(ue,Ee,t),s=r(n);return s}catch(u){return Se(u),Promise.reject(u)}}var er=e=>{for(;e.length>0;)e.shift()(i)},rr=[],xr=e=>rr.unshift(e),tr=[],Ur=e=>tr.unshift(e);function O(e,r="i8"){switch(r.endsWith("*")&&(r="*"),r){case"i1":return E[e>>>0];case"i8":return E[e>>>0];case"i16":return B[e>>>1>>>0];case"i32":return H[e>>>2>>>0];case"i64":return le[e>>>3];case"float":return fe[e>>>2>>>0];case"double":return ve[e>>>3>>>0];case"*":return P[e>>>2>>>0];default:pe(`invalid type for getValue: ${r}`)}}i.noExitRuntime;function J(e,r,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":E[e>>>0]=r;break;case"i8":E[e>>>0]=r;break;case"i16":B[e>>>1>>>0]=r;break;case"i32":H[e>>>2>>>0]=r;break;case"i64":le[e>>>3]=BigInt(r);break;case"float":fe[e>>>2>>>0]=r;break;case"double":ve[e>>>3>>>0]=r;break;case"*":P[e>>>2>>>0]=r;break;default:pe(`invalid type for setValue: ${t}`)}}class Br{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){P[this.ptr+4>>>2>>>0]=r}get_type(){return P[this.ptr+4>>>2>>>0]}set_destructor(r){P[this.ptr+8>>>2>>>0]=r}get_destructor(){return P[this.ptr+8>>>2>>>0]}set_caught(r){r=r?1:0,E[this.ptr+12>>>0]=r}get_caught(){return E[this.ptr+12>>>0]!=0}set_rethrown(r){r=r?1:0,E[this.ptr+13>>>0]=r}get_rethrown(){return E[this.ptr+13>>>0]!=0}init(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t)}set_adjusted_ptr(r){P[this.ptr+16>>>2>>>0]=r}get_adjusted_ptr(){return P[this.ptr+16>>>2>>>0]}}var nr=0;function Hr(e,r,t){e>>>=0,r>>>=0,t>>>=0;var n=new Br(e);throw n.init(r,t),nr=e,nr}var Lr=()=>pe(""),he={},Me=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r)}};function re(e){return this.fromWireType(P[e>>>2>>>0])}var K={},z={},ye={},zr=i.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},_e=e=>{throw new zr(e)},N=(e,r,t)=>{e.forEach(c=>ye[c]=r);function n(c){var d=t(c);d.length!==e.length&&_e("Mismatched type converter count");for(var p=0;p<e.length;++p)V(e[p],d[p])}var s=new Array(r.length),u=[],f=0;r.forEach((c,d)=>{z.hasOwnProperty(c)?s[d]=z[c]:(u.push(c),K.hasOwnProperty(c)||(K[c]=[]),K[c].push(()=>{s[d]=z[c],++f,f===u.length&&n(s)}))}),u.length===0&&n(s)},Nr=function(e){e>>>=0;var r=he[e];delete he[e];var t=r.rawConstructor,n=r.rawDestructor,s=r.fields,u=s.map(f=>f.getterReturnType).concat(s.map(f=>f.setterArgumentType));N([e],u,f=>{var c={};return s.forEach((d,p)=>{var h=d.fieldName,y=f[p],g=f[p].optional,F=d.getter,$=d.getterContext,R=f[p+s.length],U=d.setter,o=d.setterContext;c[h]={read:a=>y.fromWireType(F($,a)),write:(a,l)=>{var v=[];U(o,a,R.toWireType(v,l)),Me(v)},optional:g}}),[{name:r.name,fromWireType:d=>{var p={};for(var h in c)p[h]=c[h].read(d);return n(d),p},toWireType:(d,p)=>{for(var h in c)if(!(h in p)&&!c[h].optional)throw new TypeError(`Missing field: "${h}"`);var y=t();for(h in c)c[h].write(y,p[h]);return d!==null&&d.push(n,y),y},argPackAdvance:D,readValueFromPointer:re,destructorFunction:n}]})},me=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},Gr=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);or=e},or,S=e=>{for(var r="",t=e;M[t>>>0];)r+=or[M[t++>>>0]];return r},te=i.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},m=e=>{throw new te(e)};function qr(e,r,t={}){var n=r.name;if(e||m(`type "${n}" must have a positive integer typeid pointer`),z.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;m(`Cannot register type '${n}' twice`)}if(z[e]=r,delete ye[e],K.hasOwnProperty(e)){var s=K[e];delete K[e],s.forEach(u=>u())}}function V(e,r,t={}){return qr(e,r,t)}var ir=(e,r,t)=>{switch(r){case 1:return t?n=>E[n>>>0]:n=>M[n>>>0];case 2:return t?n=>B[n>>>1>>>0]:n=>Y[n>>>1>>>0];case 4:return t?n=>H[n>>>2>>>0]:n=>P[n>>>2>>>0];case 8:return t?n=>le[n>>>3]:n=>Qe[n>>>3];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}};function Jr(e,r,t,n,s){e>>>=0,r>>>=0,t>>>=0,r=S(r);var u=r.indexOf("u")!=-1;V(e,{name:r,fromWireType:f=>f,toWireType:function(f,c){if(typeof c!="bigint"&&typeof c!="number")throw new TypeError(`Cannot convert "${me(c)}" to ${this.name}`);return typeof c=="number"&&(c=BigInt(c)),c},argPackAdvance:D,readValueFromPointer:ir(r,t,!u),destructorFunction:null})}var D=8;function Kr(e,r,t,n){e>>>=0,r>>>=0,r=S(r),V(e,{name:r,fromWireType:function(s){return!!s},toWireType:function(s,u){return u?t:n},argPackAdvance:D,readValueFromPointer:function(s){return this.fromWireType(M[s>>>0])},destructorFunction:null})}var Xr=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Ve=e=>{function r(t){return t.$$.ptrType.registeredClass.name}m(r(e)+" instance already deleted")},ke=!1,sr=e=>{},Zr=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},ar=e=>{e.count.value-=1;var r=e.count.value===0;r&&Zr(e)},ne=e=>typeof FinalizationRegistry>"u"?(ne=r=>r,e):(ke=new FinalizationRegistry(r=>{ar(r.$$)}),ne=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var s={$$:t};ke.register(r,s,r)}return r},sr=r=>ke.unregister(r),ne(e)),Qr=()=>{let e=ge.prototype;Object.assign(e,{isAliasOf(t){if(!(this instanceof ge)||!(t instanceof ge))return!1;var n=this.$$.ptrType.registeredClass,s=this.$$.ptr;t.$$=t.$$;for(var u=t.$$.ptrType.registeredClass,f=t.$$.ptr;n.baseClass;)s=n.upcast(s),n=n.baseClass;for(;u.baseClass;)f=u.upcast(f),u=u.baseClass;return n===u&&s===f},clone(){if(this.$$.ptr||Ve(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t=ne(Object.create(Object.getPrototypeOf(this),{$$:{value:Xr(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||Ve(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&m("Object already scheduled for deletion"),sr(this),ar(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Ve(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&m("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}});const r=Symbol.dispose;r&&(e[r]=e.delete)};function ge(){}var be=(e,r)=>Object.defineProperty(r,"name",{value:e}),ur={},cr=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...s){return e[r].overloadTable.hasOwnProperty(s.length)||m(`Function '${t}' called with an invalid number of arguments (${s.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[s.length].apply(this,s)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},Oe=(e,r,t)=>{i.hasOwnProperty(e)?((t===void 0||i[e].overloadTable!==void 0&&i[e].overloadTable[t]!==void 0)&&m(`Cannot register public name '${e}' twice`),cr(i,e,e),i[e].overloadTable.hasOwnProperty(t)&&m(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),i[e].overloadTable[t]=r):(i[e]=r,i[e].argCount=t)},Yr=48,et=57,rt=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=Yr&&r<=et?`_${e}`:e};function tt(e,r,t,n,s,u,f,c){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=s,this.getActualType=u,this.upcast=f,this.downcast=c,this.pureVirtualFunctions=[]}var De=(e,r,t)=>{for(;r!==t;)r.upcast||m(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function nt(e,r){if(r===null)return this.isReference&&m(`null is not a valid ${this.name}`),0;r.$$||m(`Cannot pass "${me(r)}" as a ${this.name}`),r.$$.ptr||m(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=De(r.$$.ptr,t,this.registeredClass);return n}function ot(e,r){var t;if(r===null)return this.isReference&&m(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&m(`Cannot pass "${me(r)}" as a ${this.name}`),r.$$.ptr||m(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&m(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(t=De(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&m("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:m(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var s=r.clone();t=this.rawShare(t,A.toHandle(()=>s.delete())),e!==null&&e.push(this.rawDestructor,t)}break;default:m("Unsupporting sharing policy")}return t}function it(e,r){if(r===null)return this.isReference&&m(`null is not a valid ${this.name}`),0;r.$$||m(`Cannot pass "${me(r)}" as a ${this.name}`),r.$$.ptr||m(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&m(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=De(r.$$.ptr,t,this.registeredClass);return n}var fr=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=fr(e,r,t.baseClass);return n===null?null:t.downcast(n)},st={},at=(e,r)=>{for(r===void 0&&m("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},ut=(e,r)=>(r=at(e,r),st[r]),$e=(e,r)=>{(!r.ptrType||!r.ptr)&&_e("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&_e("Both smartPtrType and smartPtr must be specified"),r.count={value:1},ne(Object.create(e,{$$:{value:r,writable:!0}}))};function ct(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=ut(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function s(){return this.isSmartPointer?$e(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):$e(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var u=this.registeredClass.getActualType(r),f=ur[u];if(!f)return s.call(this);var c;this.isConst?c=f.constPointerType:c=f.pointerType;var d=fr(r,this.registeredClass,c.registeredClass);return d===null?s.call(this):this.isSmartPointer?$e(c.registeredClass.instancePrototype,{ptrType:c,ptr:d,smartPtrType:this,smartPtr:e}):$e(c.registeredClass.instancePrototype,{ptrType:c,ptr:d})}var ft=()=>{Object.assign(Pe.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){var r;(r=this.rawDestructor)==null||r.call(this,e)},argPackAdvance:D,readValueFromPointer:re,fromWireType:ct})};function Pe(e,r,t,n,s,u,f,c,d,p,h){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=s,this.pointeeType=u,this.sharingPolicy=f,this.rawGetPointee=c,this.rawConstructor=d,this.rawShare=p,this.rawDestructor=h,!s&&r.baseClass===void 0?n?(this.toWireType=nt,this.destructorFunction=null):(this.toWireType=it,this.destructorFunction=null):this.toWireType=ot}var lr=(e,r,t)=>{i.hasOwnProperty(e)||_e("Replacing nonexistent public symbol"),i[e].overloadTable!==void 0&&t!==void 0?i[e].overloadTable[t]=r:(i[e]=r,i[e].argCount=t)},X,we=e=>X.get(e),lt=(e,r,t=[],n=!1)=>{var s=we(r),u=s(...t);return e[0]=="p"?u>>>0:u},vt=(e,r,t=!1)=>(...n)=>lt(e,r,n,t),I=(e,r,t=!1)=>{e=S(e);function n(){if(e.includes("p"))return vt(e,r,t);var u=we(r);return u}var s=n();return typeof s!="function"&&m(`unknown function pointer with signature ${e}: ${r}`),s};class dt extends Error{}var vr=e=>{var r=gn(e),t=S(r);return q(r),t},Ce=(e,r)=>{var t=[],n={};function s(u){if(!n[u]&&!z[u]){if(ye[u]){ye[u].forEach(s);return}t.push(u),n[u]=!0}}throw r.forEach(s),new dt(`${e}: `+t.map(vr).join([", "]))};function pt(e,r,t,n,s,u,f,c,d,p,h,y,g){e>>>=0,r>>>=0,t>>>=0,n>>>=0,s>>>=0,u>>>=0,f>>>=0,c>>>=0,d>>>=0,p>>>=0,h>>>=0,y>>>=0,g>>>=0,h=S(h),u=I(s,u),c&&(c=I(f,c)),p&&(p=I(d,p)),g=I(y,g);var F=rt(h);Oe(F,function(){Ce(`Cannot construct ${h} due to unbound types`,[n])}),N([e,r,t],n?[n]:[],$=>{var T;$=$[0];var R,U;n?(R=$.registeredClass,U=R.instancePrototype):U=ge.prototype;var o=be(h,function(...W){if(Object.getPrototypeOf(this)!==a)throw new te(`Use 'new' to construct ${h}`);if(l.constructor_body===void 0)throw new te(`${h} has no accessible constructor`);var w=l.constructor_body[W.length];if(w===void 0)throw new te(`Tried to invoke ctor of ${h} with invalid number of parameters (${W.length}) - expected (${Object.keys(l.constructor_body).toString()}) parameters instead!`);return w.apply(this,W)}),a=Object.create(U,{constructor:{value:o}});o.prototype=a;var l=new tt(h,o,a,g,R,u,c,p);l.baseClass&&((T=l.baseClass).__derivedClasses??(T.__derivedClasses=[]),l.baseClass.__derivedClasses.push(l));var v=new Pe(h,l,!0,!1,!1),_=new Pe(h+"*",l,!1,!1,!1),b=new Pe(h+" const*",l,!1,!0,!1);return ur[e]={pointerType:_,constPointerType:b},lr(F,o),[v,_,b]})}var Ie=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push(P[r+n*4>>>2>>>0]);return t};function dr(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function ht(e,r,t,n){var s=dr(e),u=e.length-2,f=[],c=["fn"];r&&c.push("thisWired");for(var d=0;d<u;++d)f.push(`arg${d}`),c.push(`arg${d}Wired`);f=f.join(","),c=c.join(",");var p=`return function (${f}) {
|
|
2
2
|
`;s&&(p+=`var destructors = [];
|
|
3
3
|
`);var h=s?"destructors":"null",y=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];r&&(p+=`var thisWired = classParam['toWireType'](${h}, this);
|
|
4
4
|
`);for(var d=0;d<u;++d)p+=`var arg${d}Wired = argType${d}['toWireType'](${h}, arg${d});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Pn=(()=>{var Ne=import.meta.url;return(async function(Pr={}){var Ge,i=Pr,qe,Se,wr=new Promise((e,r)=>{qe=e,Se=r}),Cr=typeof window=="object",Ae=typeof WorkerGlobalScope<"u",Fe=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";if(Fe){const{createRequire:e}=await import("./reportWorker-GZVKtf9S.js").then(function(r){return r._});var Re=e(import.meta.url)}var Je=!1;i.setup=function(){if(Je)return;Je=!0,i.initTBB();function e(o,a,l=(v=>v)){if(a)for(let v of a)o.push_back(l(v));return o}function r(o,a=(l=>l)){const l=[],v=o.size();for(let _=0;_<v;_++)l.push(a(o.get(_)));return l}function t(o,a=(l=>l)){const l=[],v=o.size();for(let _=0;_<v;_++){const b=o.get(_),T=b.size(),W=[];for(let w=0;w<T;w++)W.push(a(b.get(w)));l.push(W)}return l}function n(o){return o[0].length<3&&(o=[o]),e(new i.Vector2_vec2,o,a=>e(new i.Vector_vec2,a,l=>l instanceof Array?{x:l[0],y:l[1]}:l))}function s(o){for(let a=0;a<o.size();a++)o.get(a).delete();o.delete()}function u(o){return o[0]instanceof Array?{x:o[0][0],y:o[0][1]}:typeof o[0]=="number"?{x:o[0]||0,y:o[1]||0}:o[0]}function f(o){return o[0]instanceof Array?{x:o[0][0],y:o[0][1],z:o[0][2]}:typeof o[0]=="number"?{x:o[0]||0,y:o[1]||0,z:o[2]||0}:o[0]}function c(o){return o=="EvenOdd"?0:o=="NonZero"?1:o=="Negative"?3:2}function d(o){return o=="Round"?1:o=="Miter"?2:0}const p=i.CrossSection;function h(o,a="Positive"){if(o instanceof p)return o;{const l=n(o),v=new p(l,c(a));return s(l),v}}i.CrossSection.prototype.translate=function(...o){return this._Translate(u(o))},i.CrossSection.prototype.scale=function(o){return typeof o=="number"?this._Scale({x:o,y:o}):this._Scale(u([o]))},i.CrossSection.prototype.mirror=function(o){return this._Mirror(u([o]))},i.CrossSection.prototype.warp=function(o){const a=oe(function(v){const _=O(v,"double"),b=O(v+8,"double"),T=[_,b];o(T),J(v,T[0],"double"),J(v+8,T[1],"double")},"vi"),l=this._Warp(a);return ie(a),l},i.CrossSection.prototype.decompose=function(){const o=this._Decompose(),a=r(o);return o.delete(),a},i.CrossSection.prototype.bounds=function(){const o=this._Bounds();return{min:["x","y"].map(a=>o.min[a]),max:["x","y"].map(a=>o.max[a])}},i.CrossSection.prototype.offset=function(o,a="Square",l=2,v=0){return this._Offset(o,d(a),l,v)},i.CrossSection.prototype.simplify=function(o=1e-6){return this._Simplify(o)},i.CrossSection.prototype.extrude=function(o,a=0,l=0,v=[1,1],_=!1){v=u([v]);const b=i._Extrude(this._ToPolygons(),o,a,l,v);return _?b.translate([0,0,-o/2]):b},i.CrossSection.prototype.revolve=function(o=0,a=360){return i._Revolve(this._ToPolygons(),o,a)},i.CrossSection.prototype.add=function(o){return this._add(h(o))},i.CrossSection.prototype.subtract=function(o){return this._subtract(h(o))},i.CrossSection.prototype.intersect=function(o){return this._intersect(h(o))},i.CrossSection.prototype.toPolygons=function(){const o=this._ToPolygons(),a=t(o,l=>[l.x,l.y]);return o.delete(),a},i.Manifold.prototype.smoothOut=function(o=60,a=0){return this._SmoothOut(o,a)},i.Manifold.prototype.warp=function(o){const a=oe(function(_){const b=O(_,"double"),T=O(_+8,"double"),W=O(_+16,"double"),w=[b,T,W];o(w),J(_,w[0],"double"),J(_+8,w[1],"double"),J(_+16,w[2],"double")},"vi"),l=this._Warp(a);ie(a);const v=l.status();if(v.value!==0)throw new i.ManifoldError(v.value);return l},i.Manifold.prototype.calculateNormals=function(o,a=60){return this._CalculateNormals(o,a)},i.Manifold.prototype.setProperties=function(o,a){const l=this.numProp(),v=oe(function(b,T,W){const w=[];for(let C=0;C<o;++C)w[C]=O(b+8*C,"double");const Z=[];for(let C=0;C<3;++C)Z[C]=O(T+8*C,"double");const Q=[];for(let C=0;C<l;++C)Q[C]=O(W+8*C,"double");a(w,Z,Q);for(let C=0;C<o;++C)J(b+8*C,w[C],"double")},"viii"),_=this._SetProperties(o,v);return ie(v),_},i.Manifold.prototype.translate=function(...o){return this._Translate(f(o))},i.Manifold.prototype.rotate=function(o,a,l){return Array.isArray(o)?this._Rotate(...o):this._Rotate(o,a||0,l||0)},i.Manifold.prototype.scale=function(o){return typeof o=="number"?this._Scale({x:o,y:o,z:o}):this._Scale(f([o]))},i.Manifold.prototype.mirror=function(o){return this._Mirror(f([o]))},i.Manifold.prototype.trimByPlane=function(o,a=0){return this._TrimByPlane(f([o]),a)},i.Manifold.prototype.slice=function(o=0){const a=this._Slice(o),l=new p(a,c("Positive"));return s(a),l},i.Manifold.prototype.project=function(){const o=this._Project(),a=new p(o,c("Positive"));return s(o),a},i.Manifold.prototype.split=function(o){const a=this._Split(o),l=r(a);return a.delete(),l},i.Manifold.prototype.splitByPlane=function(o,a=0){const l=this._SplitByPlane(f([o]),a),v=r(l);return l.delete(),v},i.Manifold.prototype.decompose=function(){const o=this._Decompose(),a=r(o);return o.delete(),a},i.Manifold.prototype.boundingBox=function(){const o=this._boundingBox();return{min:["x","y","z"].map(a=>o.min[a]),max:["x","y","z"].map(a=>o.max[a])}};class y{constructor({numProp:a=3,triVerts:l=new Uint32Array,vertProperties:v=new Float32Array,mergeFromVert:_,mergeToVert:b,runIndex:T,runOriginalID:W,faceID:w,halfedgeTangent:Z,runTransform:Q}={}){this.numProp=a,this.triVerts=l,this.vertProperties=v,this.mergeFromVert=_,this.mergeToVert=b,this.runIndex=T,this.runOriginalID=W,this.faceID=w,this.halfedgeTangent=Z,this.runTransform=Q}get numTri(){return this.triVerts.length/3}get numVert(){return this.vertProperties.length/this.numProp}get numRun(){return this.runOriginalID.length}merge(){const{changed:a,mesh:l}=i._Merge(this);return Object.assign(this,{...l}),a}verts(a){return this.triVerts.subarray(3*a,3*(a+1))}position(a){return this.vertProperties.subarray(this.numProp*a,this.numProp*a+3)}extras(a){return this.vertProperties.subarray(this.numProp*a+3,this.numProp*(a+1))}tangent(a){return this.halfedgeTangent.subarray(4*a,4*(a+1))}transform(a){const l=new Array(16);for(const v of[0,1,2,3])for(const _ of[0,1,2])l[4*v+_]=this.runTransform[12*a+3*v+_];return l[15]=1,l}}i.Mesh=y,i.Manifold.prototype.getMesh=function(o=-1){return new y(this._GetMeshJS(o))},i.ManifoldError=function(a,...l){let v="Unknown error";switch(a){case i.status.NonFiniteVertex.value:v="Non-finite vertex";break;case i.status.NotManifold.value:v="Not manifold";break;case i.status.VertexOutOfBounds.value:v="Vertex index out of bounds";break;case i.status.PropertiesWrongLength.value:v="Properties have wrong length";break;case i.status.MissingPositionProperties.value:v="Less than three properties";break;case i.status.MergeVectorsDifferentLengths.value:v="Merge vectors have different lengths";break;case i.status.MergeIndexOutOfBounds.value:v="Merge index out of bounds";break;case i.status.TransformWrongLength.value:v="Transform vector has wrong length";break;case i.status.RunIndexWrongLength.value:v="Run index vector has wrong length";break;case i.status.FaceIDWrongLength.value:v="Face ID vector has wrong length";case i.status.InvalidConstruction.value:v="Manifold constructed with invalid parameters"}const _=Error.apply(this,[v,...l]);_.name=this.name="ManifoldError",this.message=_.message,this.stack=_.stack,this.code=a},i.ManifoldError.prototype=Object.create(Error.prototype,{constructor:{value:i.ManifoldError,writable:!0,configurable:!0}}),i.CrossSection=function(o,a="Positive"){const l=n(o),v=new p(l,c(a));return s(l),v},i.CrossSection.ofPolygons=function(o,a="Positive"){return new i.CrossSection(o,a)},i.CrossSection.square=function(...o){let a;o.length==0?a={x:1,y:1}:typeof o[0]=="number"?a={x:o[0],y:o[0]}:a=u(o);const l=o[1]||!1;return i._Square(a,l)},i.CrossSection.circle=function(o,a=0){return i._Circle(o,a)};function g(o){return function(...a){a.length==1&&(a=a[0]);const l=new i.Vector_crossSection;for(const _ of a)l.push_back(h(_));const v=i["_crossSection"+o](l);return l.delete(),v}}i.CrossSection.compose=g("Compose"),i.CrossSection.union=g("UnionN"),i.CrossSection.difference=g("DifferenceN"),i.CrossSection.intersection=g("IntersectionN");function F(o,a){e(o,a,l=>l instanceof Array?{x:l[0],y:l[1]}:l)}i.CrossSection.hull=function(...o){o.length==1&&(o=o[0]);let a=new i.Vector_vec2;for(const v of o)if(v instanceof p)i._crossSectionCollectVertices(a,v);else if(v instanceof Array&&v.length==2&&typeof v[0]=="number")a.push_back({x:v[0],y:v[1]});else if(v.x)a.push_back(v);else{const b=v[0].length==2&&typeof v[0][0]=="number"||v[0].x?[v]:v;for(const T of b)F(a,T)}const l=i._crossSectionHullPoints(a);return a.delete(),l},i.CrossSection.prototype=Object.create(p.prototype),Object.defineProperty(i.CrossSection,Symbol.hasInstance,{get:()=>o=>o instanceof p});const $=i.Manifold;i.Manifold=function(o){const a=new $(o),l=a.status();if(l.value!==0)throw new i.ManifoldError(l.value);return a},i.Manifold.ofMesh=function(o){return new i.Manifold(o)},i.Manifold.tetrahedron=function(){return i._Tetrahedron()},i.Manifold.cube=function(...o){let a;o.length==0?a={x:1,y:1,z:1}:typeof o[0]=="number"?a={x:o[0],y:o[0],z:o[0]}:a=f(o);const l=o[1]||!1;return i._Cube(a,l)},i.Manifold.cylinder=function(o,a,l=-1,v=0,_=!1){return i._Cylinder(o,a,l,v,_)},i.Manifold.sphere=function(o,a=0){return i._Sphere(o,a)},i.Manifold.smooth=function(o,a=[]){const l=new i.Vector_smoothness;e(l,a);const v=i._Smooth(o,l);return l.delete(),v},i.Manifold.extrude=function(o,a,l=0,v=0,_=[1,1],b=!1){return(o instanceof p?o:i.CrossSection(o,"Positive")).extrude(a,l,v,_,b)},i.Manifold.revolve=function(o,a=0,l=360){return(o instanceof p?o:i.CrossSection(o,"Positive")).revolve(a,l)},i.Manifold.reserveIDs=function(o){return i._ReserveIDs(o)},i.Manifold.compose=function(o){const a=new i.Vector_manifold;e(a,o);const l=i._manifoldCompose(a);return a.delete(),l};function R(o){return function(...a){a.length==1&&(a=a[0]);const l=new i.Vector_manifold;for(const _ of a)l.push_back(_);const v=i["_manifold"+o+"N"](l);return l.delete(),v}}i.Manifold.union=R("Union"),i.Manifold.difference=R("Difference"),i.Manifold.intersection=R("Intersection"),i.Manifold.levelSet=function(o,a,l,v=0,_=-1){const b={min:{x:a.min[0],y:a.min[1],z:a.min[2]},max:{x:a.max[0],y:a.max[1],z:a.max[2]}},T=oe(function(w){const Z=O(w,"double"),Q=O(w+8,"double"),C=O(w+16,"double");return o([Z,Q,C])},"di"),W=i._LevelSet(T,b,l,v,_);return ie(T),W};function U(o,a){e(o,a,l=>l instanceof Array?{x:l[0],y:l[1],z:l[2]}:l)}i.Manifold.hull=function(...o){o.length==1&&(o=o[0]);let a=new i.Vector_vec3;for(const v of o)v instanceof $?i._manifoldCollectVertices(a,v):v instanceof Array&&v.length==3&&typeof v[0]=="number"?a.push_back({x:v[0],y:v[1],z:v[2]}):v.x?a.push_back(v):U(a,v);const l=i._manifoldHullPoints(a);return a.delete(),l},i.Manifold.prototype=Object.create($.prototype),Object.defineProperty(i.Manifold,Symbol.hasInstance,{get:()=>o=>o instanceof $}),i.triangulate=function(o,a=-1,l=!0){const v=n(o),_=r(i._Triangulate(v,a,l),b=>[b[0],b[1],b[2]]);return s(v),_}};var Ke={...i},k="";function Tr(e){return i.locateFile?i.locateFile(e,k):k+e}var We,se;if(Fe){var Xe=Re("fs"),Sr=Re("path");import.meta.url.startsWith("data:")||(k=Sr.dirname(Re("url").fileURLToPath(import.meta.url))+"/"),se=e=>{e=de(e)?new URL(e):e;var r=Xe.readFileSync(e);return r},We=async(e,r=!0)=>{e=de(e)?new URL(e):e;var t=Xe.readFileSync(e,r?void 0:"utf8");return t},!i.thisProgram&&process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2)}else(Cr||Ae)&&(Ae?k=self.location.href:typeof document<"u"&&document.currentScript&&(k=document.currentScript.src),Ne&&(k=Ne),k.startsWith("blob:")?k="":k=k.slice(0,k.replace(/[?#].*/,"").lastIndexOf("/")+1),Ae&&(se=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),We=async e=>{if(de(e))return new Promise((t,n)=>{var s=new XMLHttpRequest;s.open("GET",e,!0),s.responseType="arraybuffer",s.onload=()=>{if(s.status==200||s.status==0&&s.response){t(s.response);return}n(s.status)},s.onerror=n,s.send(null)});var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)});i.print||console.log.bind(console);var ae=i.printErr||console.error.bind(console);Object.assign(i,Ke),Ke=null,i.arguments&&i.arguments,i.thisProgram&&i.thisProgram;var ue=i.wasmBinary,ce,Ze=!1,E,M,B,Y,H,P,fe,le,Qe,ve,de=e=>e.startsWith("file://");function Ye(){var e=ce.buffer;i.HEAP8=E=new Int8Array(e),i.HEAP16=B=new Int16Array(e),i.HEAPU8=M=new Uint8Array(e),i.HEAPU16=Y=new Uint16Array(e),i.HEAP32=H=new Int32Array(e),i.HEAPU32=P=new Uint32Array(e),i.HEAPF32=fe=new Float32Array(e),i.HEAPF64=ve=new Float64Array(e),i.HEAP64=le=new BigInt64Array(e),i.HEAPU64=Qe=new BigUint64Array(e)}function Ar(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)Ur(i.preRun.shift());er(tr)}function Fr(){j.J()}function Rr(){if(i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)xr(i.postRun.shift());er(rr)}var L=0,ee=null;function Wr(e){var r;L++,(r=i.monitorRunDependencies)==null||r.call(i,L)}function Er(e){var t;if(L--,(t=i.monitorRunDependencies)==null||t.call(i,L),L==0&&ee){var r=ee;ee=null,r()}}function pe(e){var t;(t=i.onAbort)==null||t.call(i,e),e="Aborted("+e+")",ae(e),Ze=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw Se(r),r}var Ee;function Mr(){return i.locateFile?Tr("manifold.wasm"):new URL("/assets/manifold-C44_QbND.wasm",import.meta.url).href}function Vr(e){if(e==Ee&&ue)return new Uint8Array(ue);if(se)return se(e);throw"both async and sync fetching of the wasm failed"}async function kr(e){if(!ue)try{var r=await We(e);return new Uint8Array(r)}catch{}return Vr(e)}async function Or(e,r){try{var t=await kr(e),n=await WebAssembly.instantiate(t,r);return n}catch(s){ae(`failed to asynchronously prepare wasm: ${s}`),pe(s)}}async function Dr(e,r,t){if(!e&&typeof WebAssembly.instantiateStreaming=="function"&&!de(r)&&!Fe)try{var n=fetch(r,{credentials:"same-origin"}),s=await WebAssembly.instantiateStreaming(n,t);return s}catch(u){ae(`wasm streaming compile failed: ${u}`),ae("falling back to ArrayBuffer instantiation")}return Or(r,t)}function Ir(){return{a:mn}}async function jr(){function e(u,f){return j=u.exports,j=bn(j),ce=j.I,Ye(),X=j.L,Er(),j}Wr();function r(u){return e(u.instance)}var t=Ir();if(i.instantiateWasm)return new Promise((u,f)=>{i.instantiateWasm(t,(c,d)=>{e(c),u(c.exports)})});Ee??(Ee=Mr());try{var n=await Dr(ue,Ee,t),s=r(n);return s}catch(u){return Se(u),Promise.reject(u)}}var er=e=>{for(;e.length>0;)e.shift()(i)},rr=[],xr=e=>rr.unshift(e),tr=[],Ur=e=>tr.unshift(e);function O(e,r="i8"){switch(r.endsWith("*")&&(r="*"),r){case"i1":return E[e>>>0];case"i8":return E[e>>>0];case"i16":return B[e>>>1>>>0];case"i32":return H[e>>>2>>>0];case"i64":return le[e>>>3];case"float":return fe[e>>>2>>>0];case"double":return ve[e>>>3>>>0];case"*":return P[e>>>2>>>0];default:pe(`invalid type for getValue: ${r}`)}}i.noExitRuntime;function J(e,r,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":E[e>>>0]=r;break;case"i8":E[e>>>0]=r;break;case"i16":B[e>>>1>>>0]=r;break;case"i32":H[e>>>2>>>0]=r;break;case"i64":le[e>>>3]=BigInt(r);break;case"float":fe[e>>>2>>>0]=r;break;case"double":ve[e>>>3>>>0]=r;break;case"*":P[e>>>2>>>0]=r;break;default:pe(`invalid type for setValue: ${t}`)}}class Br{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){P[this.ptr+4>>>2>>>0]=r}get_type(){return P[this.ptr+4>>>2>>>0]}set_destructor(r){P[this.ptr+8>>>2>>>0]=r}get_destructor(){return P[this.ptr+8>>>2>>>0]}set_caught(r){r=r?1:0,E[this.ptr+12>>>0]=r}get_caught(){return E[this.ptr+12>>>0]!=0}set_rethrown(r){r=r?1:0,E[this.ptr+13>>>0]=r}get_rethrown(){return E[this.ptr+13>>>0]!=0}init(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t)}set_adjusted_ptr(r){P[this.ptr+16>>>2>>>0]=r}get_adjusted_ptr(){return P[this.ptr+16>>>2>>>0]}}var nr=0;function Hr(e,r,t){e>>>=0,r>>>=0,t>>>=0;var n=new Br(e);throw n.init(r,t),nr=e,nr}var Lr=()=>pe(""),he={},Me=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r)}};function re(e){return this.fromWireType(P[e>>>2>>>0])}var K={},z={},ye={},zr=i.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},_e=e=>{throw new zr(e)},N=(e,r,t)=>{e.forEach(c=>ye[c]=r);function n(c){var d=t(c);d.length!==e.length&&_e("Mismatched type converter count");for(var p=0;p<e.length;++p)V(e[p],d[p])}var s=new Array(r.length),u=[],f=0;r.forEach((c,d)=>{z.hasOwnProperty(c)?s[d]=z[c]:(u.push(c),K.hasOwnProperty(c)||(K[c]=[]),K[c].push(()=>{s[d]=z[c],++f,f===u.length&&n(s)}))}),u.length===0&&n(s)},Nr=function(e){e>>>=0;var r=he[e];delete he[e];var t=r.rawConstructor,n=r.rawDestructor,s=r.fields,u=s.map(f=>f.getterReturnType).concat(s.map(f=>f.setterArgumentType));N([e],u,f=>{var c={};return s.forEach((d,p)=>{var h=d.fieldName,y=f[p],g=f[p].optional,F=d.getter,$=d.getterContext,R=f[p+s.length],U=d.setter,o=d.setterContext;c[h]={read:a=>y.fromWireType(F($,a)),write:(a,l)=>{var v=[];U(o,a,R.toWireType(v,l)),Me(v)},optional:g}}),[{name:r.name,fromWireType:d=>{var p={};for(var h in c)p[h]=c[h].read(d);return n(d),p},toWireType:(d,p)=>{for(var h in c)if(!(h in p)&&!c[h].optional)throw new TypeError(`Missing field: "${h}"`);var y=t();for(h in c)c[h].write(y,p[h]);return d!==null&&d.push(n,y),y},argPackAdvance:D,readValueFromPointer:re,destructorFunction:n}]})},me=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},Gr=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);or=e},or,S=e=>{for(var r="",t=e;M[t>>>0];)r+=or[M[t++>>>0]];return r},te=i.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},m=e=>{throw new te(e)};function qr(e,r,t={}){var n=r.name;if(e||m(`type "${n}" must have a positive integer typeid pointer`),z.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;m(`Cannot register type '${n}' twice`)}if(z[e]=r,delete ye[e],K.hasOwnProperty(e)){var s=K[e];delete K[e],s.forEach(u=>u())}}function V(e,r,t={}){return qr(e,r,t)}var ir=(e,r,t)=>{switch(r){case 1:return t?n=>E[n>>>0]:n=>M[n>>>0];case 2:return t?n=>B[n>>>1>>>0]:n=>Y[n>>>1>>>0];case 4:return t?n=>H[n>>>2>>>0]:n=>P[n>>>2>>>0];case 8:return t?n=>le[n>>>3]:n=>Qe[n>>>3];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}};function Jr(e,r,t,n,s){e>>>=0,r>>>=0,t>>>=0,r=S(r);var u=r.indexOf("u")!=-1;V(e,{name:r,fromWireType:f=>f,toWireType:function(f,c){if(typeof c!="bigint"&&typeof c!="number")throw new TypeError(`Cannot convert "${me(c)}" to ${this.name}`);return typeof c=="number"&&(c=BigInt(c)),c},argPackAdvance:D,readValueFromPointer:ir(r,t,!u),destructorFunction:null})}var D=8;function Kr(e,r,t,n){e>>>=0,r>>>=0,r=S(r),V(e,{name:r,fromWireType:function(s){return!!s},toWireType:function(s,u){return u?t:n},argPackAdvance:D,readValueFromPointer:function(s){return this.fromWireType(M[s>>>0])},destructorFunction:null})}var Xr=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Ve=e=>{function r(t){return t.$$.ptrType.registeredClass.name}m(r(e)+" instance already deleted")},ke=!1,sr=e=>{},Zr=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},ar=e=>{e.count.value-=1;var r=e.count.value===0;r&&Zr(e)},ne=e=>typeof FinalizationRegistry>"u"?(ne=r=>r,e):(ke=new FinalizationRegistry(r=>{ar(r.$$)}),ne=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var s={$$:t};ke.register(r,s,r)}return r},sr=r=>ke.unregister(r),ne(e)),Qr=()=>{let e=ge.prototype;Object.assign(e,{isAliasOf(t){if(!(this instanceof ge)||!(t instanceof ge))return!1;var n=this.$$.ptrType.registeredClass,s=this.$$.ptr;t.$$=t.$$;for(var u=t.$$.ptrType.registeredClass,f=t.$$.ptr;n.baseClass;)s=n.upcast(s),n=n.baseClass;for(;u.baseClass;)f=u.upcast(f),u=u.baseClass;return n===u&&s===f},clone(){if(this.$$.ptr||Ve(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t=ne(Object.create(Object.getPrototypeOf(this),{$$:{value:Xr(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||Ve(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&m("Object already scheduled for deletion"),sr(this),ar(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Ve(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&m("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}});const r=Symbol.dispose;r&&(e[r]=e.delete)};function ge(){}var be=(e,r)=>Object.defineProperty(r,"name",{value:e}),ur={},cr=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...s){return e[r].overloadTable.hasOwnProperty(s.length)||m(`Function '${t}' called with an invalid number of arguments (${s.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[s.length].apply(this,s)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},Oe=(e,r,t)=>{i.hasOwnProperty(e)?((t===void 0||i[e].overloadTable!==void 0&&i[e].overloadTable[t]!==void 0)&&m(`Cannot register public name '${e}' twice`),cr(i,e,e),i[e].overloadTable.hasOwnProperty(t)&&m(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),i[e].overloadTable[t]=r):(i[e]=r,i[e].argCount=t)},Yr=48,et=57,rt=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=Yr&&r<=et?`_${e}`:e};function tt(e,r,t,n,s,u,f,c){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=s,this.getActualType=u,this.upcast=f,this.downcast=c,this.pureVirtualFunctions=[]}var De=(e,r,t)=>{for(;r!==t;)r.upcast||m(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function nt(e,r){if(r===null)return this.isReference&&m(`null is not a valid ${this.name}`),0;r.$$||m(`Cannot pass "${me(r)}" as a ${this.name}`),r.$$.ptr||m(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=De(r.$$.ptr,t,this.registeredClass);return n}function ot(e,r){var t;if(r===null)return this.isReference&&m(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&m(`Cannot pass "${me(r)}" as a ${this.name}`),r.$$.ptr||m(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&m(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(t=De(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&m("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:m(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var s=r.clone();t=this.rawShare(t,A.toHandle(()=>s.delete())),e!==null&&e.push(this.rawDestructor,t)}break;default:m("Unsupporting sharing policy")}return t}function it(e,r){if(r===null)return this.isReference&&m(`null is not a valid ${this.name}`),0;r.$$||m(`Cannot pass "${me(r)}" as a ${this.name}`),r.$$.ptr||m(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&m(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=De(r.$$.ptr,t,this.registeredClass);return n}var fr=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=fr(e,r,t.baseClass);return n===null?null:t.downcast(n)},st={},at=(e,r)=>{for(r===void 0&&m("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},ut=(e,r)=>(r=at(e,r),st[r]),$e=(e,r)=>{(!r.ptrType||!r.ptr)&&_e("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&_e("Both smartPtrType and smartPtr must be specified"),r.count={value:1},ne(Object.create(e,{$$:{value:r,writable:!0}}))};function ct(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=ut(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function s(){return this.isSmartPointer?$e(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):$e(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var u=this.registeredClass.getActualType(r),f=ur[u];if(!f)return s.call(this);var c;this.isConst?c=f.constPointerType:c=f.pointerType;var d=fr(r,this.registeredClass,c.registeredClass);return d===null?s.call(this):this.isSmartPointer?$e(c.registeredClass.instancePrototype,{ptrType:c,ptr:d,smartPtrType:this,smartPtr:e}):$e(c.registeredClass.instancePrototype,{ptrType:c,ptr:d})}var ft=()=>{Object.assign(Pe.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){var r;(r=this.rawDestructor)==null||r.call(this,e)},argPackAdvance:D,readValueFromPointer:re,fromWireType:ct})};function Pe(e,r,t,n,s,u,f,c,d,p,h){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=s,this.pointeeType=u,this.sharingPolicy=f,this.rawGetPointee=c,this.rawConstructor=d,this.rawShare=p,this.rawDestructor=h,!s&&r.baseClass===void 0?n?(this.toWireType=nt,this.destructorFunction=null):(this.toWireType=it,this.destructorFunction=null):this.toWireType=ot}var lr=(e,r,t)=>{i.hasOwnProperty(e)||_e("Replacing nonexistent public symbol"),i[e].overloadTable!==void 0&&t!==void 0?i[e].overloadTable[t]=r:(i[e]=r,i[e].argCount=t)},X,we=e=>X.get(e),lt=(e,r,t=[],n=!1)=>{var s=we(r),u=s(...t);return e[0]=="p"?u>>>0:u},vt=(e,r,t=!1)=>(...n)=>lt(e,r,n,t),I=(e,r,t=!1)=>{e=S(e);function n(){if(e.includes("p"))return vt(e,r,t);var u=we(r);return u}var s=n();return typeof s!="function"&&m(`unknown function pointer with signature ${e}: ${r}`),s};class dt extends Error{}var vr=e=>{var r=gn(e),t=S(r);return q(r),t},Ce=(e,r)=>{var t=[],n={};function s(u){if(!n[u]&&!z[u]){if(ye[u]){ye[u].forEach(s);return}t.push(u),n[u]=!0}}throw r.forEach(s),new dt(`${e}: `+t.map(vr).join([", "]))};function pt(e,r,t,n,s,u,f,c,d,p,h,y,g){e>>>=0,r>>>=0,t>>>=0,n>>>=0,s>>>=0,u>>>=0,f>>>=0,c>>>=0,d>>>=0,p>>>=0,h>>>=0,y>>>=0,g>>>=0,h=S(h),u=I(s,u),c&&(c=I(f,c)),p&&(p=I(d,p)),g=I(y,g);var F=rt(h);Oe(F,function(){Ce(`Cannot construct ${h} due to unbound types`,[n])}),N([e,r,t],n?[n]:[],$=>{var T;$=$[0];var R,U;n?(R=$.registeredClass,U=R.instancePrototype):U=ge.prototype;var o=be(h,function(...W){if(Object.getPrototypeOf(this)!==a)throw new te(`Use 'new' to construct ${h}`);if(l.constructor_body===void 0)throw new te(`${h} has no accessible constructor`);var w=l.constructor_body[W.length];if(w===void 0)throw new te(`Tried to invoke ctor of ${h} with invalid number of parameters (${W.length}) - expected (${Object.keys(l.constructor_body).toString()}) parameters instead!`);return w.apply(this,W)}),a=Object.create(U,{constructor:{value:o}});o.prototype=a;var l=new tt(h,o,a,g,R,u,c,p);l.baseClass&&((T=l.baseClass).__derivedClasses??(T.__derivedClasses=[]),l.baseClass.__derivedClasses.push(l));var v=new Pe(h,l,!0,!1,!1),_=new Pe(h+"*",l,!1,!1,!1),b=new Pe(h+" const*",l,!1,!0,!1);return ur[e]={pointerType:_,constPointerType:b},lr(F,o),[v,_,b]})}var Ie=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push(P[r+n*4>>>2>>>0]);return t};function dr(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function ht(e,r,t,n){var s=dr(e),u=e.length-2,f=[],c=["fn"];r&&c.push("thisWired");for(var d=0;d<u;++d)f.push(`arg${d}`),c.push(`arg${d}Wired`);f=f.join(","),c=c.join(",");var p=`return function (${f}) {
|
|
1
|
+
var Pn=(()=>{var Ne=import.meta.url;return(async function(Pr={}){var Ge,i=Pr,qe,Se,wr=new Promise((e,r)=>{qe=e,Se=r}),Cr=typeof window=="object",Ae=typeof WorkerGlobalScope<"u",Fe=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";if(Fe){const{createRequire:e}=await import("./reportWorker-Cj587shw.js").then(function(r){return r._});var Re=e(import.meta.url)}var Je=!1;i.setup=function(){if(Je)return;Je=!0,i.initTBB();function e(o,a,l=(v=>v)){if(a)for(let v of a)o.push_back(l(v));return o}function r(o,a=(l=>l)){const l=[],v=o.size();for(let _=0;_<v;_++)l.push(a(o.get(_)));return l}function t(o,a=(l=>l)){const l=[],v=o.size();for(let _=0;_<v;_++){const b=o.get(_),T=b.size(),W=[];for(let w=0;w<T;w++)W.push(a(b.get(w)));l.push(W)}return l}function n(o){return o[0].length<3&&(o=[o]),e(new i.Vector2_vec2,o,a=>e(new i.Vector_vec2,a,l=>l instanceof Array?{x:l[0],y:l[1]}:l))}function s(o){for(let a=0;a<o.size();a++)o.get(a).delete();o.delete()}function u(o){return o[0]instanceof Array?{x:o[0][0],y:o[0][1]}:typeof o[0]=="number"?{x:o[0]||0,y:o[1]||0}:o[0]}function f(o){return o[0]instanceof Array?{x:o[0][0],y:o[0][1],z:o[0][2]}:typeof o[0]=="number"?{x:o[0]||0,y:o[1]||0,z:o[2]||0}:o[0]}function c(o){return o=="EvenOdd"?0:o=="NonZero"?1:o=="Negative"?3:2}function d(o){return o=="Round"?1:o=="Miter"?2:0}const p=i.CrossSection;function h(o,a="Positive"){if(o instanceof p)return o;{const l=n(o),v=new p(l,c(a));return s(l),v}}i.CrossSection.prototype.translate=function(...o){return this._Translate(u(o))},i.CrossSection.prototype.scale=function(o){return typeof o=="number"?this._Scale({x:o,y:o}):this._Scale(u([o]))},i.CrossSection.prototype.mirror=function(o){return this._Mirror(u([o]))},i.CrossSection.prototype.warp=function(o){const a=oe(function(v){const _=O(v,"double"),b=O(v+8,"double"),T=[_,b];o(T),J(v,T[0],"double"),J(v+8,T[1],"double")},"vi"),l=this._Warp(a);return ie(a),l},i.CrossSection.prototype.decompose=function(){const o=this._Decompose(),a=r(o);return o.delete(),a},i.CrossSection.prototype.bounds=function(){const o=this._Bounds();return{min:["x","y"].map(a=>o.min[a]),max:["x","y"].map(a=>o.max[a])}},i.CrossSection.prototype.offset=function(o,a="Square",l=2,v=0){return this._Offset(o,d(a),l,v)},i.CrossSection.prototype.simplify=function(o=1e-6){return this._Simplify(o)},i.CrossSection.prototype.extrude=function(o,a=0,l=0,v=[1,1],_=!1){v=u([v]);const b=i._Extrude(this._ToPolygons(),o,a,l,v);return _?b.translate([0,0,-o/2]):b},i.CrossSection.prototype.revolve=function(o=0,a=360){return i._Revolve(this._ToPolygons(),o,a)},i.CrossSection.prototype.add=function(o){return this._add(h(o))},i.CrossSection.prototype.subtract=function(o){return this._subtract(h(o))},i.CrossSection.prototype.intersect=function(o){return this._intersect(h(o))},i.CrossSection.prototype.toPolygons=function(){const o=this._ToPolygons(),a=t(o,l=>[l.x,l.y]);return o.delete(),a},i.Manifold.prototype.smoothOut=function(o=60,a=0){return this._SmoothOut(o,a)},i.Manifold.prototype.warp=function(o){const a=oe(function(_){const b=O(_,"double"),T=O(_+8,"double"),W=O(_+16,"double"),w=[b,T,W];o(w),J(_,w[0],"double"),J(_+8,w[1],"double"),J(_+16,w[2],"double")},"vi"),l=this._Warp(a);ie(a);const v=l.status();if(v.value!==0)throw new i.ManifoldError(v.value);return l},i.Manifold.prototype.calculateNormals=function(o,a=60){return this._CalculateNormals(o,a)},i.Manifold.prototype.setProperties=function(o,a){const l=this.numProp(),v=oe(function(b,T,W){const w=[];for(let C=0;C<o;++C)w[C]=O(b+8*C,"double");const Z=[];for(let C=0;C<3;++C)Z[C]=O(T+8*C,"double");const Q=[];for(let C=0;C<l;++C)Q[C]=O(W+8*C,"double");a(w,Z,Q);for(let C=0;C<o;++C)J(b+8*C,w[C],"double")},"viii"),_=this._SetProperties(o,v);return ie(v),_},i.Manifold.prototype.translate=function(...o){return this._Translate(f(o))},i.Manifold.prototype.rotate=function(o,a,l){return Array.isArray(o)?this._Rotate(...o):this._Rotate(o,a||0,l||0)},i.Manifold.prototype.scale=function(o){return typeof o=="number"?this._Scale({x:o,y:o,z:o}):this._Scale(f([o]))},i.Manifold.prototype.mirror=function(o){return this._Mirror(f([o]))},i.Manifold.prototype.trimByPlane=function(o,a=0){return this._TrimByPlane(f([o]),a)},i.Manifold.prototype.slice=function(o=0){const a=this._Slice(o),l=new p(a,c("Positive"));return s(a),l},i.Manifold.prototype.project=function(){const o=this._Project(),a=new p(o,c("Positive"));return s(o),a},i.Manifold.prototype.split=function(o){const a=this._Split(o),l=r(a);return a.delete(),l},i.Manifold.prototype.splitByPlane=function(o,a=0){const l=this._SplitByPlane(f([o]),a),v=r(l);return l.delete(),v},i.Manifold.prototype.decompose=function(){const o=this._Decompose(),a=r(o);return o.delete(),a},i.Manifold.prototype.boundingBox=function(){const o=this._boundingBox();return{min:["x","y","z"].map(a=>o.min[a]),max:["x","y","z"].map(a=>o.max[a])}};class y{constructor({numProp:a=3,triVerts:l=new Uint32Array,vertProperties:v=new Float32Array,mergeFromVert:_,mergeToVert:b,runIndex:T,runOriginalID:W,faceID:w,halfedgeTangent:Z,runTransform:Q}={}){this.numProp=a,this.triVerts=l,this.vertProperties=v,this.mergeFromVert=_,this.mergeToVert=b,this.runIndex=T,this.runOriginalID=W,this.faceID=w,this.halfedgeTangent=Z,this.runTransform=Q}get numTri(){return this.triVerts.length/3}get numVert(){return this.vertProperties.length/this.numProp}get numRun(){return this.runOriginalID.length}merge(){const{changed:a,mesh:l}=i._Merge(this);return Object.assign(this,{...l}),a}verts(a){return this.triVerts.subarray(3*a,3*(a+1))}position(a){return this.vertProperties.subarray(this.numProp*a,this.numProp*a+3)}extras(a){return this.vertProperties.subarray(this.numProp*a+3,this.numProp*(a+1))}tangent(a){return this.halfedgeTangent.subarray(4*a,4*(a+1))}transform(a){const l=new Array(16);for(const v of[0,1,2,3])for(const _ of[0,1,2])l[4*v+_]=this.runTransform[12*a+3*v+_];return l[15]=1,l}}i.Mesh=y,i.Manifold.prototype.getMesh=function(o=-1){return new y(this._GetMeshJS(o))},i.ManifoldError=function(a,...l){let v="Unknown error";switch(a){case i.status.NonFiniteVertex.value:v="Non-finite vertex";break;case i.status.NotManifold.value:v="Not manifold";break;case i.status.VertexOutOfBounds.value:v="Vertex index out of bounds";break;case i.status.PropertiesWrongLength.value:v="Properties have wrong length";break;case i.status.MissingPositionProperties.value:v="Less than three properties";break;case i.status.MergeVectorsDifferentLengths.value:v="Merge vectors have different lengths";break;case i.status.MergeIndexOutOfBounds.value:v="Merge index out of bounds";break;case i.status.TransformWrongLength.value:v="Transform vector has wrong length";break;case i.status.RunIndexWrongLength.value:v="Run index vector has wrong length";break;case i.status.FaceIDWrongLength.value:v="Face ID vector has wrong length";case i.status.InvalidConstruction.value:v="Manifold constructed with invalid parameters"}const _=Error.apply(this,[v,...l]);_.name=this.name="ManifoldError",this.message=_.message,this.stack=_.stack,this.code=a},i.ManifoldError.prototype=Object.create(Error.prototype,{constructor:{value:i.ManifoldError,writable:!0,configurable:!0}}),i.CrossSection=function(o,a="Positive"){const l=n(o),v=new p(l,c(a));return s(l),v},i.CrossSection.ofPolygons=function(o,a="Positive"){return new i.CrossSection(o,a)},i.CrossSection.square=function(...o){let a;o.length==0?a={x:1,y:1}:typeof o[0]=="number"?a={x:o[0],y:o[0]}:a=u(o);const l=o[1]||!1;return i._Square(a,l)},i.CrossSection.circle=function(o,a=0){return i._Circle(o,a)};function g(o){return function(...a){a.length==1&&(a=a[0]);const l=new i.Vector_crossSection;for(const _ of a)l.push_back(h(_));const v=i["_crossSection"+o](l);return l.delete(),v}}i.CrossSection.compose=g("Compose"),i.CrossSection.union=g("UnionN"),i.CrossSection.difference=g("DifferenceN"),i.CrossSection.intersection=g("IntersectionN");function F(o,a){e(o,a,l=>l instanceof Array?{x:l[0],y:l[1]}:l)}i.CrossSection.hull=function(...o){o.length==1&&(o=o[0]);let a=new i.Vector_vec2;for(const v of o)if(v instanceof p)i._crossSectionCollectVertices(a,v);else if(v instanceof Array&&v.length==2&&typeof v[0]=="number")a.push_back({x:v[0],y:v[1]});else if(v.x)a.push_back(v);else{const b=v[0].length==2&&typeof v[0][0]=="number"||v[0].x?[v]:v;for(const T of b)F(a,T)}const l=i._crossSectionHullPoints(a);return a.delete(),l},i.CrossSection.prototype=Object.create(p.prototype),Object.defineProperty(i.CrossSection,Symbol.hasInstance,{get:()=>o=>o instanceof p});const $=i.Manifold;i.Manifold=function(o){const a=new $(o),l=a.status();if(l.value!==0)throw new i.ManifoldError(l.value);return a},i.Manifold.ofMesh=function(o){return new i.Manifold(o)},i.Manifold.tetrahedron=function(){return i._Tetrahedron()},i.Manifold.cube=function(...o){let a;o.length==0?a={x:1,y:1,z:1}:typeof o[0]=="number"?a={x:o[0],y:o[0],z:o[0]}:a=f(o);const l=o[1]||!1;return i._Cube(a,l)},i.Manifold.cylinder=function(o,a,l=-1,v=0,_=!1){return i._Cylinder(o,a,l,v,_)},i.Manifold.sphere=function(o,a=0){return i._Sphere(o,a)},i.Manifold.smooth=function(o,a=[]){const l=new i.Vector_smoothness;e(l,a);const v=i._Smooth(o,l);return l.delete(),v},i.Manifold.extrude=function(o,a,l=0,v=0,_=[1,1],b=!1){return(o instanceof p?o:i.CrossSection(o,"Positive")).extrude(a,l,v,_,b)},i.Manifold.revolve=function(o,a=0,l=360){return(o instanceof p?o:i.CrossSection(o,"Positive")).revolve(a,l)},i.Manifold.reserveIDs=function(o){return i._ReserveIDs(o)},i.Manifold.compose=function(o){const a=new i.Vector_manifold;e(a,o);const l=i._manifoldCompose(a);return a.delete(),l};function R(o){return function(...a){a.length==1&&(a=a[0]);const l=new i.Vector_manifold;for(const _ of a)l.push_back(_);const v=i["_manifold"+o+"N"](l);return l.delete(),v}}i.Manifold.union=R("Union"),i.Manifold.difference=R("Difference"),i.Manifold.intersection=R("Intersection"),i.Manifold.levelSet=function(o,a,l,v=0,_=-1){const b={min:{x:a.min[0],y:a.min[1],z:a.min[2]},max:{x:a.max[0],y:a.max[1],z:a.max[2]}},T=oe(function(w){const Z=O(w,"double"),Q=O(w+8,"double"),C=O(w+16,"double");return o([Z,Q,C])},"di"),W=i._LevelSet(T,b,l,v,_);return ie(T),W};function U(o,a){e(o,a,l=>l instanceof Array?{x:l[0],y:l[1],z:l[2]}:l)}i.Manifold.hull=function(...o){o.length==1&&(o=o[0]);let a=new i.Vector_vec3;for(const v of o)v instanceof $?i._manifoldCollectVertices(a,v):v instanceof Array&&v.length==3&&typeof v[0]=="number"?a.push_back({x:v[0],y:v[1],z:v[2]}):v.x?a.push_back(v):U(a,v);const l=i._manifoldHullPoints(a);return a.delete(),l},i.Manifold.prototype=Object.create($.prototype),Object.defineProperty(i.Manifold,Symbol.hasInstance,{get:()=>o=>o instanceof $}),i.triangulate=function(o,a=-1,l=!0){const v=n(o),_=r(i._Triangulate(v,a,l),b=>[b[0],b[1],b[2]]);return s(v),_}};var Ke={...i},k="";function Tr(e){return i.locateFile?i.locateFile(e,k):k+e}var We,se;if(Fe){var Xe=Re("fs"),Sr=Re("path");import.meta.url.startsWith("data:")||(k=Sr.dirname(Re("url").fileURLToPath(import.meta.url))+"/"),se=e=>{e=de(e)?new URL(e):e;var r=Xe.readFileSync(e);return r},We=async(e,r=!0)=>{e=de(e)?new URL(e):e;var t=Xe.readFileSync(e,r?void 0:"utf8");return t},!i.thisProgram&&process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2)}else(Cr||Ae)&&(Ae?k=self.location.href:typeof document<"u"&&document.currentScript&&(k=document.currentScript.src),Ne&&(k=Ne),k.startsWith("blob:")?k="":k=k.slice(0,k.replace(/[?#].*/,"").lastIndexOf("/")+1),Ae&&(se=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),We=async e=>{if(de(e))return new Promise((t,n)=>{var s=new XMLHttpRequest;s.open("GET",e,!0),s.responseType="arraybuffer",s.onload=()=>{if(s.status==200||s.status==0&&s.response){t(s.response);return}n(s.status)},s.onerror=n,s.send(null)});var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)});i.print||console.log.bind(console);var ae=i.printErr||console.error.bind(console);Object.assign(i,Ke),Ke=null,i.arguments&&i.arguments,i.thisProgram&&i.thisProgram;var ue=i.wasmBinary,ce,Ze=!1,E,M,B,Y,H,P,fe,le,Qe,ve,de=e=>e.startsWith("file://");function Ye(){var e=ce.buffer;i.HEAP8=E=new Int8Array(e),i.HEAP16=B=new Int16Array(e),i.HEAPU8=M=new Uint8Array(e),i.HEAPU16=Y=new Uint16Array(e),i.HEAP32=H=new Int32Array(e),i.HEAPU32=P=new Uint32Array(e),i.HEAPF32=fe=new Float32Array(e),i.HEAPF64=ve=new Float64Array(e),i.HEAP64=le=new BigInt64Array(e),i.HEAPU64=Qe=new BigUint64Array(e)}function Ar(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)Ur(i.preRun.shift());er(tr)}function Fr(){j.J()}function Rr(){if(i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)xr(i.postRun.shift());er(rr)}var L=0,ee=null;function Wr(e){var r;L++,(r=i.monitorRunDependencies)==null||r.call(i,L)}function Er(e){var t;if(L--,(t=i.monitorRunDependencies)==null||t.call(i,L),L==0&&ee){var r=ee;ee=null,r()}}function pe(e){var t;(t=i.onAbort)==null||t.call(i,e),e="Aborted("+e+")",ae(e),Ze=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw Se(r),r}var Ee;function Mr(){return i.locateFile?Tr("manifold.wasm"):new URL("/assets/manifold-C44_QbND.wasm",import.meta.url).href}function Vr(e){if(e==Ee&&ue)return new Uint8Array(ue);if(se)return se(e);throw"both async and sync fetching of the wasm failed"}async function kr(e){if(!ue)try{var r=await We(e);return new Uint8Array(r)}catch{}return Vr(e)}async function Or(e,r){try{var t=await kr(e),n=await WebAssembly.instantiate(t,r);return n}catch(s){ae(`failed to asynchronously prepare wasm: ${s}`),pe(s)}}async function Dr(e,r,t){if(!e&&typeof WebAssembly.instantiateStreaming=="function"&&!de(r)&&!Fe)try{var n=fetch(r,{credentials:"same-origin"}),s=await WebAssembly.instantiateStreaming(n,t);return s}catch(u){ae(`wasm streaming compile failed: ${u}`),ae("falling back to ArrayBuffer instantiation")}return Or(r,t)}function Ir(){return{a:mn}}async function jr(){function e(u,f){return j=u.exports,j=bn(j),ce=j.I,Ye(),X=j.L,Er(),j}Wr();function r(u){return e(u.instance)}var t=Ir();if(i.instantiateWasm)return new Promise((u,f)=>{i.instantiateWasm(t,(c,d)=>{e(c),u(c.exports)})});Ee??(Ee=Mr());try{var n=await Dr(ue,Ee,t),s=r(n);return s}catch(u){return Se(u),Promise.reject(u)}}var er=e=>{for(;e.length>0;)e.shift()(i)},rr=[],xr=e=>rr.unshift(e),tr=[],Ur=e=>tr.unshift(e);function O(e,r="i8"){switch(r.endsWith("*")&&(r="*"),r){case"i1":return E[e>>>0];case"i8":return E[e>>>0];case"i16":return B[e>>>1>>>0];case"i32":return H[e>>>2>>>0];case"i64":return le[e>>>3];case"float":return fe[e>>>2>>>0];case"double":return ve[e>>>3>>>0];case"*":return P[e>>>2>>>0];default:pe(`invalid type for getValue: ${r}`)}}i.noExitRuntime;function J(e,r,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":E[e>>>0]=r;break;case"i8":E[e>>>0]=r;break;case"i16":B[e>>>1>>>0]=r;break;case"i32":H[e>>>2>>>0]=r;break;case"i64":le[e>>>3]=BigInt(r);break;case"float":fe[e>>>2>>>0]=r;break;case"double":ve[e>>>3>>>0]=r;break;case"*":P[e>>>2>>>0]=r;break;default:pe(`invalid type for setValue: ${t}`)}}class Br{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){P[this.ptr+4>>>2>>>0]=r}get_type(){return P[this.ptr+4>>>2>>>0]}set_destructor(r){P[this.ptr+8>>>2>>>0]=r}get_destructor(){return P[this.ptr+8>>>2>>>0]}set_caught(r){r=r?1:0,E[this.ptr+12>>>0]=r}get_caught(){return E[this.ptr+12>>>0]!=0}set_rethrown(r){r=r?1:0,E[this.ptr+13>>>0]=r}get_rethrown(){return E[this.ptr+13>>>0]!=0}init(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t)}set_adjusted_ptr(r){P[this.ptr+16>>>2>>>0]=r}get_adjusted_ptr(){return P[this.ptr+16>>>2>>>0]}}var nr=0;function Hr(e,r,t){e>>>=0,r>>>=0,t>>>=0;var n=new Br(e);throw n.init(r,t),nr=e,nr}var Lr=()=>pe(""),he={},Me=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r)}};function re(e){return this.fromWireType(P[e>>>2>>>0])}var K={},z={},ye={},zr=i.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},_e=e=>{throw new zr(e)},N=(e,r,t)=>{e.forEach(c=>ye[c]=r);function n(c){var d=t(c);d.length!==e.length&&_e("Mismatched type converter count");for(var p=0;p<e.length;++p)V(e[p],d[p])}var s=new Array(r.length),u=[],f=0;r.forEach((c,d)=>{z.hasOwnProperty(c)?s[d]=z[c]:(u.push(c),K.hasOwnProperty(c)||(K[c]=[]),K[c].push(()=>{s[d]=z[c],++f,f===u.length&&n(s)}))}),u.length===0&&n(s)},Nr=function(e){e>>>=0;var r=he[e];delete he[e];var t=r.rawConstructor,n=r.rawDestructor,s=r.fields,u=s.map(f=>f.getterReturnType).concat(s.map(f=>f.setterArgumentType));N([e],u,f=>{var c={};return s.forEach((d,p)=>{var h=d.fieldName,y=f[p],g=f[p].optional,F=d.getter,$=d.getterContext,R=f[p+s.length],U=d.setter,o=d.setterContext;c[h]={read:a=>y.fromWireType(F($,a)),write:(a,l)=>{var v=[];U(o,a,R.toWireType(v,l)),Me(v)},optional:g}}),[{name:r.name,fromWireType:d=>{var p={};for(var h in c)p[h]=c[h].read(d);return n(d),p},toWireType:(d,p)=>{for(var h in c)if(!(h in p)&&!c[h].optional)throw new TypeError(`Missing field: "${h}"`);var y=t();for(h in c)c[h].write(y,p[h]);return d!==null&&d.push(n,y),y},argPackAdvance:D,readValueFromPointer:re,destructorFunction:n}]})},me=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},Gr=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);or=e},or,S=e=>{for(var r="",t=e;M[t>>>0];)r+=or[M[t++>>>0]];return r},te=i.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},m=e=>{throw new te(e)};function qr(e,r,t={}){var n=r.name;if(e||m(`type "${n}" must have a positive integer typeid pointer`),z.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;m(`Cannot register type '${n}' twice`)}if(z[e]=r,delete ye[e],K.hasOwnProperty(e)){var s=K[e];delete K[e],s.forEach(u=>u())}}function V(e,r,t={}){return qr(e,r,t)}var ir=(e,r,t)=>{switch(r){case 1:return t?n=>E[n>>>0]:n=>M[n>>>0];case 2:return t?n=>B[n>>>1>>>0]:n=>Y[n>>>1>>>0];case 4:return t?n=>H[n>>>2>>>0]:n=>P[n>>>2>>>0];case 8:return t?n=>le[n>>>3]:n=>Qe[n>>>3];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}};function Jr(e,r,t,n,s){e>>>=0,r>>>=0,t>>>=0,r=S(r);var u=r.indexOf("u")!=-1;V(e,{name:r,fromWireType:f=>f,toWireType:function(f,c){if(typeof c!="bigint"&&typeof c!="number")throw new TypeError(`Cannot convert "${me(c)}" to ${this.name}`);return typeof c=="number"&&(c=BigInt(c)),c},argPackAdvance:D,readValueFromPointer:ir(r,t,!u),destructorFunction:null})}var D=8;function Kr(e,r,t,n){e>>>=0,r>>>=0,r=S(r),V(e,{name:r,fromWireType:function(s){return!!s},toWireType:function(s,u){return u?t:n},argPackAdvance:D,readValueFromPointer:function(s){return this.fromWireType(M[s>>>0])},destructorFunction:null})}var Xr=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Ve=e=>{function r(t){return t.$$.ptrType.registeredClass.name}m(r(e)+" instance already deleted")},ke=!1,sr=e=>{},Zr=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},ar=e=>{e.count.value-=1;var r=e.count.value===0;r&&Zr(e)},ne=e=>typeof FinalizationRegistry>"u"?(ne=r=>r,e):(ke=new FinalizationRegistry(r=>{ar(r.$$)}),ne=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var s={$$:t};ke.register(r,s,r)}return r},sr=r=>ke.unregister(r),ne(e)),Qr=()=>{let e=ge.prototype;Object.assign(e,{isAliasOf(t){if(!(this instanceof ge)||!(t instanceof ge))return!1;var n=this.$$.ptrType.registeredClass,s=this.$$.ptr;t.$$=t.$$;for(var u=t.$$.ptrType.registeredClass,f=t.$$.ptr;n.baseClass;)s=n.upcast(s),n=n.baseClass;for(;u.baseClass;)f=u.upcast(f),u=u.baseClass;return n===u&&s===f},clone(){if(this.$$.ptr||Ve(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t=ne(Object.create(Object.getPrototypeOf(this),{$$:{value:Xr(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||Ve(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&m("Object already scheduled for deletion"),sr(this),ar(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Ve(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&m("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}});const r=Symbol.dispose;r&&(e[r]=e.delete)};function ge(){}var be=(e,r)=>Object.defineProperty(r,"name",{value:e}),ur={},cr=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...s){return e[r].overloadTable.hasOwnProperty(s.length)||m(`Function '${t}' called with an invalid number of arguments (${s.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[s.length].apply(this,s)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},Oe=(e,r,t)=>{i.hasOwnProperty(e)?((t===void 0||i[e].overloadTable!==void 0&&i[e].overloadTable[t]!==void 0)&&m(`Cannot register public name '${e}' twice`),cr(i,e,e),i[e].overloadTable.hasOwnProperty(t)&&m(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),i[e].overloadTable[t]=r):(i[e]=r,i[e].argCount=t)},Yr=48,et=57,rt=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=Yr&&r<=et?`_${e}`:e};function tt(e,r,t,n,s,u,f,c){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=s,this.getActualType=u,this.upcast=f,this.downcast=c,this.pureVirtualFunctions=[]}var De=(e,r,t)=>{for(;r!==t;)r.upcast||m(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function nt(e,r){if(r===null)return this.isReference&&m(`null is not a valid ${this.name}`),0;r.$$||m(`Cannot pass "${me(r)}" as a ${this.name}`),r.$$.ptr||m(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=De(r.$$.ptr,t,this.registeredClass);return n}function ot(e,r){var t;if(r===null)return this.isReference&&m(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&m(`Cannot pass "${me(r)}" as a ${this.name}`),r.$$.ptr||m(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&m(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(t=De(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&m("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:m(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var s=r.clone();t=this.rawShare(t,A.toHandle(()=>s.delete())),e!==null&&e.push(this.rawDestructor,t)}break;default:m("Unsupporting sharing policy")}return t}function it(e,r){if(r===null)return this.isReference&&m(`null is not a valid ${this.name}`),0;r.$$||m(`Cannot pass "${me(r)}" as a ${this.name}`),r.$$.ptr||m(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&m(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=De(r.$$.ptr,t,this.registeredClass);return n}var fr=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=fr(e,r,t.baseClass);return n===null?null:t.downcast(n)},st={},at=(e,r)=>{for(r===void 0&&m("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},ut=(e,r)=>(r=at(e,r),st[r]),$e=(e,r)=>{(!r.ptrType||!r.ptr)&&_e("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&_e("Both smartPtrType and smartPtr must be specified"),r.count={value:1},ne(Object.create(e,{$$:{value:r,writable:!0}}))};function ct(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=ut(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function s(){return this.isSmartPointer?$e(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):$e(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var u=this.registeredClass.getActualType(r),f=ur[u];if(!f)return s.call(this);var c;this.isConst?c=f.constPointerType:c=f.pointerType;var d=fr(r,this.registeredClass,c.registeredClass);return d===null?s.call(this):this.isSmartPointer?$e(c.registeredClass.instancePrototype,{ptrType:c,ptr:d,smartPtrType:this,smartPtr:e}):$e(c.registeredClass.instancePrototype,{ptrType:c,ptr:d})}var ft=()=>{Object.assign(Pe.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){var r;(r=this.rawDestructor)==null||r.call(this,e)},argPackAdvance:D,readValueFromPointer:re,fromWireType:ct})};function Pe(e,r,t,n,s,u,f,c,d,p,h){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=s,this.pointeeType=u,this.sharingPolicy=f,this.rawGetPointee=c,this.rawConstructor=d,this.rawShare=p,this.rawDestructor=h,!s&&r.baseClass===void 0?n?(this.toWireType=nt,this.destructorFunction=null):(this.toWireType=it,this.destructorFunction=null):this.toWireType=ot}var lr=(e,r,t)=>{i.hasOwnProperty(e)||_e("Replacing nonexistent public symbol"),i[e].overloadTable!==void 0&&t!==void 0?i[e].overloadTable[t]=r:(i[e]=r,i[e].argCount=t)},X,we=e=>X.get(e),lt=(e,r,t=[],n=!1)=>{var s=we(r),u=s(...t);return e[0]=="p"?u>>>0:u},vt=(e,r,t=!1)=>(...n)=>lt(e,r,n,t),I=(e,r,t=!1)=>{e=S(e);function n(){if(e.includes("p"))return vt(e,r,t);var u=we(r);return u}var s=n();return typeof s!="function"&&m(`unknown function pointer with signature ${e}: ${r}`),s};class dt extends Error{}var vr=e=>{var r=gn(e),t=S(r);return q(r),t},Ce=(e,r)=>{var t=[],n={};function s(u){if(!n[u]&&!z[u]){if(ye[u]){ye[u].forEach(s);return}t.push(u),n[u]=!0}}throw r.forEach(s),new dt(`${e}: `+t.map(vr).join([", "]))};function pt(e,r,t,n,s,u,f,c,d,p,h,y,g){e>>>=0,r>>>=0,t>>>=0,n>>>=0,s>>>=0,u>>>=0,f>>>=0,c>>>=0,d>>>=0,p>>>=0,h>>>=0,y>>>=0,g>>>=0,h=S(h),u=I(s,u),c&&(c=I(f,c)),p&&(p=I(d,p)),g=I(y,g);var F=rt(h);Oe(F,function(){Ce(`Cannot construct ${h} due to unbound types`,[n])}),N([e,r,t],n?[n]:[],$=>{var T;$=$[0];var R,U;n?(R=$.registeredClass,U=R.instancePrototype):U=ge.prototype;var o=be(h,function(...W){if(Object.getPrototypeOf(this)!==a)throw new te(`Use 'new' to construct ${h}`);if(l.constructor_body===void 0)throw new te(`${h} has no accessible constructor`);var w=l.constructor_body[W.length];if(w===void 0)throw new te(`Tried to invoke ctor of ${h} with invalid number of parameters (${W.length}) - expected (${Object.keys(l.constructor_body).toString()}) parameters instead!`);return w.apply(this,W)}),a=Object.create(U,{constructor:{value:o}});o.prototype=a;var l=new tt(h,o,a,g,R,u,c,p);l.baseClass&&((T=l.baseClass).__derivedClasses??(T.__derivedClasses=[]),l.baseClass.__derivedClasses.push(l));var v=new Pe(h,l,!0,!1,!1),_=new Pe(h+"*",l,!1,!1,!1),b=new Pe(h+" const*",l,!1,!0,!1);return ur[e]={pointerType:_,constPointerType:b},lr(F,o),[v,_,b]})}var Ie=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push(P[r+n*4>>>2>>>0]);return t};function dr(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function ht(e,r,t,n){var s=dr(e),u=e.length-2,f=[],c=["fn"];r&&c.push("thisWired");for(var d=0;d<u;++d)f.push(`arg${d}`),c.push(`arg${d}Wired`);f=f.join(","),c=c.join(",");var p=`return function (${f}) {
|
|
2
2
|
`;s&&(p+=`var destructors = [];
|
|
3
3
|
`);var h=s?"destructors":"null",y=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];r&&(p+=`var thisWired = classParam['toWireType'](${h}, this);
|
|
4
4
|
`);for(var d=0;d<u;++d)p+=`var arg${d}Wired = argType${d}['toWireType'](${h}, arg${d});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as $n}from"./index-d60dJDhX.js";var Cn=(()=>{var Ne=import.meta.url;return(async function(Pr={}){var Ge,i=Pr,qe,Se,wr=new Promise((e,r)=>{qe=e,Se=r}),Cr=typeof window=="object",Ae=typeof WorkerGlobalScope<"u",Fe=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";if(Fe){const{createRequire:e}=await $n(async()=>{const{createRequire:r}=await import("./index-d60dJDhX.js").then(t=>t.a);return{createRequire:r}},[]);var Re=e(import.meta.url)}var Je=!1;i.setup=function(){if(Je)return;Je=!0,i.initTBB();function e(o,a,l=(v=>v)){if(a)for(let v of a)o.push_back(l(v));return o}function r(o,a=(l=>l)){const l=[],v=o.size();for(let _=0;_<v;_++)l.push(a(o.get(_)));return l}function t(o,a=(l=>l)){const l=[],v=o.size();for(let _=0;_<v;_++){const b=o.get(_),T=b.size(),E=[];for(let w=0;w<T;w++)E.push(a(b.get(w)));l.push(E)}return l}function n(o){return o[0].length<3&&(o=[o]),e(new i.Vector2_vec2,o,a=>e(new i.Vector_vec2,a,l=>l instanceof Array?{x:l[0],y:l[1]}:l))}function s(o){for(let a=0;a<o.size();a++)o.get(a).delete();o.delete()}function u(o){return o[0]instanceof Array?{x:o[0][0],y:o[0][1]}:typeof o[0]=="number"?{x:o[0]||0,y:o[1]||0}:o[0]}function f(o){return o[0]instanceof Array?{x:o[0][0],y:o[0][1],z:o[0][2]}:typeof o[0]=="number"?{x:o[0]||0,y:o[1]||0,z:o[2]||0}:o[0]}function c(o){return o=="EvenOdd"?0:o=="NonZero"?1:o=="Negative"?3:2}function d(o){return o=="Round"?1:o=="Miter"?2:0}const p=i.CrossSection;function h(o,a="Positive"){if(o instanceof p)return o;{const l=n(o),v=new p(l,c(a));return s(l),v}}i.CrossSection.prototype.translate=function(...o){return this._Translate(u(o))},i.CrossSection.prototype.scale=function(o){return typeof o=="number"?this._Scale({x:o,y:o}):this._Scale(u([o]))},i.CrossSection.prototype.mirror=function(o){return this._Mirror(u([o]))},i.CrossSection.prototype.warp=function(o){const a=oe(function(v){const _=O(v,"double"),b=O(v+8,"double"),T=[_,b];o(T),J(v,T[0],"double"),J(v+8,T[1],"double")},"vi"),l=this._Warp(a);return ie(a),l},i.CrossSection.prototype.decompose=function(){const o=this._Decompose(),a=r(o);return o.delete(),a},i.CrossSection.prototype.bounds=function(){const o=this._Bounds();return{min:["x","y"].map(a=>o.min[a]),max:["x","y"].map(a=>o.max[a])}},i.CrossSection.prototype.offset=function(o,a="Square",l=2,v=0){return this._Offset(o,d(a),l,v)},i.CrossSection.prototype.simplify=function(o=1e-6){return this._Simplify(o)},i.CrossSection.prototype.extrude=function(o,a=0,l=0,v=[1,1],_=!1){v=u([v]);const b=i._Extrude(this._ToPolygons(),o,a,l,v);return _?b.translate([0,0,-o/2]):b},i.CrossSection.prototype.revolve=function(o=0,a=360){return i._Revolve(this._ToPolygons(),o,a)},i.CrossSection.prototype.add=function(o){return this._add(h(o))},i.CrossSection.prototype.subtract=function(o){return this._subtract(h(o))},i.CrossSection.prototype.intersect=function(o){return this._intersect(h(o))},i.CrossSection.prototype.toPolygons=function(){const o=this._ToPolygons(),a=t(o,l=>[l.x,l.y]);return o.delete(),a},i.Manifold.prototype.smoothOut=function(o=60,a=0){return this._SmoothOut(o,a)},i.Manifold.prototype.warp=function(o){const a=oe(function(_){const b=O(_,"double"),T=O(_+8,"double"),E=O(_+16,"double"),w=[b,T,E];o(w),J(_,w[0],"double"),J(_+8,w[1],"double"),J(_+16,w[2],"double")},"vi"),l=this._Warp(a);ie(a);const v=l.status();if(v.value!==0)throw new i.ManifoldError(v.value);return l},i.Manifold.prototype.calculateNormals=function(o,a=60){return this._CalculateNormals(o,a)},i.Manifold.prototype.setProperties=function(o,a){const l=this.numProp(),v=oe(function(b,T,E){const w=[];for(let C=0;C<o;++C)w[C]=O(b+8*C,"double");const Z=[];for(let C=0;C<3;++C)Z[C]=O(T+8*C,"double");const Q=[];for(let C=0;C<l;++C)Q[C]=O(E+8*C,"double");a(w,Z,Q);for(let C=0;C<o;++C)J(b+8*C,w[C],"double")},"viii"),_=this._SetProperties(o,v);return ie(v),_},i.Manifold.prototype.translate=function(...o){return this._Translate(f(o))},i.Manifold.prototype.rotate=function(o,a,l){return Array.isArray(o)?this._Rotate(...o):this._Rotate(o,a||0,l||0)},i.Manifold.prototype.scale=function(o){return typeof o=="number"?this._Scale({x:o,y:o,z:o}):this._Scale(f([o]))},i.Manifold.prototype.mirror=function(o){return this._Mirror(f([o]))},i.Manifold.prototype.trimByPlane=function(o,a=0){return this._TrimByPlane(f([o]),a)},i.Manifold.prototype.slice=function(o=0){const a=this._Slice(o),l=new p(a,c("Positive"));return s(a),l},i.Manifold.prototype.project=function(){const o=this._Project(),a=new p(o,c("Positive"));return s(o),a},i.Manifold.prototype.split=function(o){const a=this._Split(o),l=r(a);return a.delete(),l},i.Manifold.prototype.splitByPlane=function(o,a=0){const l=this._SplitByPlane(f([o]),a),v=r(l);return l.delete(),v},i.Manifold.prototype.decompose=function(){const o=this._Decompose(),a=r(o);return o.delete(),a},i.Manifold.prototype.boundingBox=function(){const o=this._boundingBox();return{min:["x","y","z"].map(a=>o.min[a]),max:["x","y","z"].map(a=>o.max[a])}};class y{constructor({numProp:a=3,triVerts:l=new Uint32Array,vertProperties:v=new Float32Array,mergeFromVert:_,mergeToVert:b,runIndex:T,runOriginalID:E,faceID:w,halfedgeTangent:Z,runTransform:Q}={}){this.numProp=a,this.triVerts=l,this.vertProperties=v,this.mergeFromVert=_,this.mergeToVert=b,this.runIndex=T,this.runOriginalID=E,this.faceID=w,this.halfedgeTangent=Z,this.runTransform=Q}get numTri(){return this.triVerts.length/3}get numVert(){return this.vertProperties.length/this.numProp}get numRun(){return this.runOriginalID.length}merge(){const{changed:a,mesh:l}=i._Merge(this);return Object.assign(this,{...l}),a}verts(a){return this.triVerts.subarray(3*a,3*(a+1))}position(a){return this.vertProperties.subarray(this.numProp*a,this.numProp*a+3)}extras(a){return this.vertProperties.subarray(this.numProp*a+3,this.numProp*(a+1))}tangent(a){return this.halfedgeTangent.subarray(4*a,4*(a+1))}transform(a){const l=new Array(16);for(const v of[0,1,2,3])for(const _ of[0,1,2])l[4*v+_]=this.runTransform[12*a+3*v+_];return l[15]=1,l}}i.Mesh=y,i.Manifold.prototype.getMesh=function(o=-1){return new y(this._GetMeshJS(o))},i.ManifoldError=function(a,...l){let v="Unknown error";switch(a){case i.status.NonFiniteVertex.value:v="Non-finite vertex";break;case i.status.NotManifold.value:v="Not manifold";break;case i.status.VertexOutOfBounds.value:v="Vertex index out of bounds";break;case i.status.PropertiesWrongLength.value:v="Properties have wrong length";break;case i.status.MissingPositionProperties.value:v="Less than three properties";break;case i.status.MergeVectorsDifferentLengths.value:v="Merge vectors have different lengths";break;case i.status.MergeIndexOutOfBounds.value:v="Merge index out of bounds";break;case i.status.TransformWrongLength.value:v="Transform vector has wrong length";break;case i.status.RunIndexWrongLength.value:v="Run index vector has wrong length";break;case i.status.FaceIDWrongLength.value:v="Face ID vector has wrong length";case i.status.InvalidConstruction.value:v="Manifold constructed with invalid parameters"}const _=Error.apply(this,[v,...l]);_.name=this.name="ManifoldError",this.message=_.message,this.stack=_.stack,this.code=a},i.ManifoldError.prototype=Object.create(Error.prototype,{constructor:{value:i.ManifoldError,writable:!0,configurable:!0}}),i.CrossSection=function(o,a="Positive"){const l=n(o),v=new p(l,c(a));return s(l),v},i.CrossSection.ofPolygons=function(o,a="Positive"){return new i.CrossSection(o,a)},i.CrossSection.square=function(...o){let a;o.length==0?a={x:1,y:1}:typeof o[0]=="number"?a={x:o[0],y:o[0]}:a=u(o);const l=o[1]||!1;return i._Square(a,l)},i.CrossSection.circle=function(o,a=0){return i._Circle(o,a)};function g(o){return function(...a){a.length==1&&(a=a[0]);const l=new i.Vector_crossSection;for(const _ of a)l.push_back(h(_));const v=i["_crossSection"+o](l);return l.delete(),v}}i.CrossSection.compose=g("Compose"),i.CrossSection.union=g("UnionN"),i.CrossSection.difference=g("DifferenceN"),i.CrossSection.intersection=g("IntersectionN");function F(o,a){e(o,a,l=>l instanceof Array?{x:l[0],y:l[1]}:l)}i.CrossSection.hull=function(...o){o.length==1&&(o=o[0]);let a=new i.Vector_vec2;for(const v of o)if(v instanceof p)i._crossSectionCollectVertices(a,v);else if(v instanceof Array&&v.length==2&&typeof v[0]=="number")a.push_back({x:v[0],y:v[1]});else if(v.x)a.push_back(v);else{const b=v[0].length==2&&typeof v[0][0]=="number"||v[0].x?[v]:v;for(const T of b)F(a,T)}const l=i._crossSectionHullPoints(a);return a.delete(),l},i.CrossSection.prototype=Object.create(p.prototype),Object.defineProperty(i.CrossSection,Symbol.hasInstance,{get:()=>o=>o instanceof p});const $=i.Manifold;i.Manifold=function(o){const a=new $(o),l=a.status();if(l.value!==0)throw new i.ManifoldError(l.value);return a},i.Manifold.ofMesh=function(o){return new i.Manifold(o)},i.Manifold.tetrahedron=function(){return i._Tetrahedron()},i.Manifold.cube=function(...o){let a;o.length==0?a={x:1,y:1,z:1}:typeof o[0]=="number"?a={x:o[0],y:o[0],z:o[0]}:a=f(o);const l=o[1]||!1;return i._Cube(a,l)},i.Manifold.cylinder=function(o,a,l=-1,v=0,_=!1){return i._Cylinder(o,a,l,v,_)},i.Manifold.sphere=function(o,a=0){return i._Sphere(o,a)},i.Manifold.smooth=function(o,a=[]){const l=new i.Vector_smoothness;e(l,a);const v=i._Smooth(o,l);return l.delete(),v},i.Manifold.extrude=function(o,a,l=0,v=0,_=[1,1],b=!1){return(o instanceof p?o:i.CrossSection(o,"Positive")).extrude(a,l,v,_,b)},i.Manifold.revolve=function(o,a=0,l=360){return(o instanceof p?o:i.CrossSection(o,"Positive")).revolve(a,l)},i.Manifold.reserveIDs=function(o){return i._ReserveIDs(o)},i.Manifold.compose=function(o){const a=new i.Vector_manifold;e(a,o);const l=i._manifoldCompose(a);return a.delete(),l};function R(o){return function(...a){a.length==1&&(a=a[0]);const l=new i.Vector_manifold;for(const _ of a)l.push_back(_);const v=i["_manifold"+o+"N"](l);return l.delete(),v}}i.Manifold.union=R("Union"),i.Manifold.difference=R("Difference"),i.Manifold.intersection=R("Intersection"),i.Manifold.levelSet=function(o,a,l,v=0,_=-1){const b={min:{x:a.min[0],y:a.min[1],z:a.min[2]},max:{x:a.max[0],y:a.max[1],z:a.max[2]}},T=oe(function(w){const Z=O(w,"double"),Q=O(w+8,"double"),C=O(w+16,"double");return o([Z,Q,C])},"di"),E=i._LevelSet(T,b,l,v,_);return ie(T),E};function U(o,a){e(o,a,l=>l instanceof Array?{x:l[0],y:l[1],z:l[2]}:l)}i.Manifold.hull=function(...o){o.length==1&&(o=o[0]);let a=new i.Vector_vec3;for(const v of o)v instanceof $?i._manifoldCollectVertices(a,v):v instanceof Array&&v.length==3&&typeof v[0]=="number"?a.push_back({x:v[0],y:v[1],z:v[2]}):v.x?a.push_back(v):U(a,v);const l=i._manifoldHullPoints(a);return a.delete(),l},i.Manifold.prototype=Object.create($.prototype),Object.defineProperty(i.Manifold,Symbol.hasInstance,{get:()=>o=>o instanceof $}),i.triangulate=function(o,a=-1,l=!0){const v=n(o),_=r(i._Triangulate(v,a,l),b=>[b[0],b[1],b[2]]);return s(v),_}};var Ke={...i},k="";function Tr(e){return i.locateFile?i.locateFile(e,k):k+e}var Ee,se;if(Fe){var Xe=Re("fs"),Sr=Re("path");import.meta.url.startsWith("data:")||(k=Sr.dirname(Re("url").fileURLToPath(import.meta.url))+"/"),se=e=>{e=de(e)?new URL(e):e;var r=Xe.readFileSync(e);return r},Ee=async(e,r=!0)=>{e=de(e)?new URL(e):e;var t=Xe.readFileSync(e,r?void 0:"utf8");return t},!i.thisProgram&&process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2)}else(Cr||Ae)&&(Ae?k=self.location.href:typeof document<"u"&&document.currentScript&&(k=document.currentScript.src),Ne&&(k=Ne),k.startsWith("blob:")?k="":k=k.slice(0,k.replace(/[?#].*/,"").lastIndexOf("/")+1),Ae&&(se=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),Ee=async e=>{if(de(e))return new Promise((t,n)=>{var s=new XMLHttpRequest;s.open("GET",e,!0),s.responseType="arraybuffer",s.onload=()=>{if(s.status==200||s.status==0&&s.response){t(s.response);return}n(s.status)},s.onerror=n,s.send(null)});var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)});i.print||console.log.bind(console);var ae=i.printErr||console.error.bind(console);Object.assign(i,Ke),Ke=null,i.arguments&&i.arguments,i.thisProgram&&i.thisProgram;var ue=i.wasmBinary,ce,Ze=!1,W,M,B,Y,H,P,fe,le,Qe,ve,de=e=>e.startsWith("file://");function Ye(){var e=ce.buffer;i.HEAP8=W=new Int8Array(e),i.HEAP16=B=new Int16Array(e),i.HEAPU8=M=new Uint8Array(e),i.HEAPU16=Y=new Uint16Array(e),i.HEAP32=H=new Int32Array(e),i.HEAPU32=P=new Uint32Array(e),i.HEAPF32=fe=new Float32Array(e),i.HEAPF64=ve=new Float64Array(e),i.HEAP64=le=new BigInt64Array(e),i.HEAPU64=Qe=new BigUint64Array(e)}function Ar(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)Ur(i.preRun.shift());er(tr)}function Fr(){j.J()}function Rr(){if(i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)xr(i.postRun.shift());er(rr)}var L=0,ee=null;function Er(e){var r;L++,(r=i.monitorRunDependencies)==null||r.call(i,L)}function Wr(e){var t;if(L--,(t=i.monitorRunDependencies)==null||t.call(i,L),L==0&&ee){var r=ee;ee=null,r()}}function pe(e){var t;(t=i.onAbort)==null||t.call(i,e),e="Aborted("+e+")",ae(e),Ze=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw Se(r),r}var We;function Mr(){return i.locateFile?Tr("manifold.wasm"):new URL("/assets/manifold-C44_QbND.wasm",import.meta.url).href}function Vr(e){if(e==We&&ue)return new Uint8Array(ue);if(se)return se(e);throw"both async and sync fetching of the wasm failed"}async function kr(e){if(!ue)try{var r=await Ee(e);return new Uint8Array(r)}catch{}return Vr(e)}async function Or(e,r){try{var t=await kr(e),n=await WebAssembly.instantiate(t,r);return n}catch(s){ae(`failed to asynchronously prepare wasm: ${s}`),pe(s)}}async function Dr(e,r,t){if(!e&&typeof WebAssembly.instantiateStreaming=="function"&&!de(r)&&!Fe)try{var n=fetch(r,{credentials:"same-origin"}),s=await WebAssembly.instantiateStreaming(n,t);return s}catch(u){ae(`wasm streaming compile failed: ${u}`),ae("falling back to ArrayBuffer instantiation")}return Or(r,t)}function Ir(){return{a:mn}}async function jr(){function e(u,f){return j=u.exports,j=bn(j),ce=j.I,Ye(),X=j.L,Wr(),j}Er();function r(u){return e(u.instance)}var t=Ir();if(i.instantiateWasm)return new Promise((u,f)=>{i.instantiateWasm(t,(c,d)=>{e(c),u(c.exports)})});We??(We=Mr());try{var n=await Dr(ue,We,t),s=r(n);return s}catch(u){return Se(u),Promise.reject(u)}}var er=e=>{for(;e.length>0;)e.shift()(i)},rr=[],xr=e=>rr.unshift(e),tr=[],Ur=e=>tr.unshift(e);function O(e,r="i8"){switch(r.endsWith("*")&&(r="*"),r){case"i1":return W[e>>>0];case"i8":return W[e>>>0];case"i16":return B[e>>>1>>>0];case"i32":return H[e>>>2>>>0];case"i64":return le[e>>>3];case"float":return fe[e>>>2>>>0];case"double":return ve[e>>>3>>>0];case"*":return P[e>>>2>>>0];default:pe(`invalid type for getValue: ${r}`)}}i.noExitRuntime;function J(e,r,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":W[e>>>0]=r;break;case"i8":W[e>>>0]=r;break;case"i16":B[e>>>1>>>0]=r;break;case"i32":H[e>>>2>>>0]=r;break;case"i64":le[e>>>3]=BigInt(r);break;case"float":fe[e>>>2>>>0]=r;break;case"double":ve[e>>>3>>>0]=r;break;case"*":P[e>>>2>>>0]=r;break;default:pe(`invalid type for setValue: ${t}`)}}class Br{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){P[this.ptr+4>>>2>>>0]=r}get_type(){return P[this.ptr+4>>>2>>>0]}set_destructor(r){P[this.ptr+8>>>2>>>0]=r}get_destructor(){return P[this.ptr+8>>>2>>>0]}set_caught(r){r=r?1:0,W[this.ptr+12>>>0]=r}get_caught(){return W[this.ptr+12>>>0]!=0}set_rethrown(r){r=r?1:0,W[this.ptr+13>>>0]=r}get_rethrown(){return W[this.ptr+13>>>0]!=0}init(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t)}set_adjusted_ptr(r){P[this.ptr+16>>>2>>>0]=r}get_adjusted_ptr(){return P[this.ptr+16>>>2>>>0]}}var nr=0;function Hr(e,r,t){e>>>=0,r>>>=0,t>>>=0;var n=new Br(e);throw n.init(r,t),nr=e,nr}var Lr=()=>pe(""),he={},Me=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r)}};function re(e){return this.fromWireType(P[e>>>2>>>0])}var K={},z={},ye={},zr=i.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},_e=e=>{throw new zr(e)},N=(e,r,t)=>{e.forEach(c=>ye[c]=r);function n(c){var d=t(c);d.length!==e.length&&_e("Mismatched type converter count");for(var p=0;p<e.length;++p)V(e[p],d[p])}var s=new Array(r.length),u=[],f=0;r.forEach((c,d)=>{z.hasOwnProperty(c)?s[d]=z[c]:(u.push(c),K.hasOwnProperty(c)||(K[c]=[]),K[c].push(()=>{s[d]=z[c],++f,f===u.length&&n(s)}))}),u.length===0&&n(s)},Nr=function(e){e>>>=0;var r=he[e];delete he[e];var t=r.rawConstructor,n=r.rawDestructor,s=r.fields,u=s.map(f=>f.getterReturnType).concat(s.map(f=>f.setterArgumentType));N([e],u,f=>{var c={};return s.forEach((d,p)=>{var h=d.fieldName,y=f[p],g=f[p].optional,F=d.getter,$=d.getterContext,R=f[p+s.length],U=d.setter,o=d.setterContext;c[h]={read:a=>y.fromWireType(F($,a)),write:(a,l)=>{var v=[];U(o,a,R.toWireType(v,l)),Me(v)},optional:g}}),[{name:r.name,fromWireType:d=>{var p={};for(var h in c)p[h]=c[h].read(d);return n(d),p},toWireType:(d,p)=>{for(var h in c)if(!(h in p)&&!c[h].optional)throw new TypeError(`Missing field: "${h}"`);var y=t();for(h in c)c[h].write(y,p[h]);return d!==null&&d.push(n,y),y},argPackAdvance:D,readValueFromPointer:re,destructorFunction:n}]})},me=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},Gr=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);or=e},or,S=e=>{for(var r="",t=e;M[t>>>0];)r+=or[M[t++>>>0]];return r},te=i.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},m=e=>{throw new te(e)};function qr(e,r,t={}){var n=r.name;if(e||m(`type "${n}" must have a positive integer typeid pointer`),z.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;m(`Cannot register type '${n}' twice`)}if(z[e]=r,delete ye[e],K.hasOwnProperty(e)){var s=K[e];delete K[e],s.forEach(u=>u())}}function V(e,r,t={}){return qr(e,r,t)}var ir=(e,r,t)=>{switch(r){case 1:return t?n=>W[n>>>0]:n=>M[n>>>0];case 2:return t?n=>B[n>>>1>>>0]:n=>Y[n>>>1>>>0];case 4:return t?n=>H[n>>>2>>>0]:n=>P[n>>>2>>>0];case 8:return t?n=>le[n>>>3]:n=>Qe[n>>>3];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}};function Jr(e,r,t,n,s){e>>>=0,r>>>=0,t>>>=0,r=S(r);var u=r.indexOf("u")!=-1;V(e,{name:r,fromWireType:f=>f,toWireType:function(f,c){if(typeof c!="bigint"&&typeof c!="number")throw new TypeError(`Cannot convert "${me(c)}" to ${this.name}`);return typeof c=="number"&&(c=BigInt(c)),c},argPackAdvance:D,readValueFromPointer:ir(r,t,!u),destructorFunction:null})}var D=8;function Kr(e,r,t,n){e>>>=0,r>>>=0,r=S(r),V(e,{name:r,fromWireType:function(s){return!!s},toWireType:function(s,u){return u?t:n},argPackAdvance:D,readValueFromPointer:function(s){return this.fromWireType(M[s>>>0])},destructorFunction:null})}var Xr=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Ve=e=>{function r(t){return t.$$.ptrType.registeredClass.name}m(r(e)+" instance already deleted")},ke=!1,sr=e=>{},Zr=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},ar=e=>{e.count.value-=1;var r=e.count.value===0;r&&Zr(e)},ne=e=>typeof FinalizationRegistry>"u"?(ne=r=>r,e):(ke=new FinalizationRegistry(r=>{ar(r.$$)}),ne=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var s={$$:t};ke.register(r,s,r)}return r},sr=r=>ke.unregister(r),ne(e)),Qr=()=>{let e=ge.prototype;Object.assign(e,{isAliasOf(t){if(!(this instanceof ge)||!(t instanceof ge))return!1;var n=this.$$.ptrType.registeredClass,s=this.$$.ptr;t.$$=t.$$;for(var u=t.$$.ptrType.registeredClass,f=t.$$.ptr;n.baseClass;)s=n.upcast(s),n=n.baseClass;for(;u.baseClass;)f=u.upcast(f),u=u.baseClass;return n===u&&s===f},clone(){if(this.$$.ptr||Ve(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t=ne(Object.create(Object.getPrototypeOf(this),{$$:{value:Xr(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||Ve(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&m("Object already scheduled for deletion"),sr(this),ar(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Ve(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&m("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}});const r=Symbol.dispose;r&&(e[r]=e.delete)};function ge(){}var be=(e,r)=>Object.defineProperty(r,"name",{value:e}),ur={},cr=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...s){return e[r].overloadTable.hasOwnProperty(s.length)||m(`Function '${t}' called with an invalid number of arguments (${s.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[s.length].apply(this,s)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},Oe=(e,r,t)=>{i.hasOwnProperty(e)?((t===void 0||i[e].overloadTable!==void 0&&i[e].overloadTable[t]!==void 0)&&m(`Cannot register public name '${e}' twice`),cr(i,e,e),i[e].overloadTable.hasOwnProperty(t)&&m(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),i[e].overloadTable[t]=r):(i[e]=r,i[e].argCount=t)},Yr=48,et=57,rt=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=Yr&&r<=et?`_${e}`:e};function tt(e,r,t,n,s,u,f,c){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=s,this.getActualType=u,this.upcast=f,this.downcast=c,this.pureVirtualFunctions=[]}var De=(e,r,t)=>{for(;r!==t;)r.upcast||m(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function nt(e,r){if(r===null)return this.isReference&&m(`null is not a valid ${this.name}`),0;r.$$||m(`Cannot pass "${me(r)}" as a ${this.name}`),r.$$.ptr||m(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=De(r.$$.ptr,t,this.registeredClass);return n}function ot(e,r){var t;if(r===null)return this.isReference&&m(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&m(`Cannot pass "${me(r)}" as a ${this.name}`),r.$$.ptr||m(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&m(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(t=De(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&m("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:m(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var s=r.clone();t=this.rawShare(t,A.toHandle(()=>s.delete())),e!==null&&e.push(this.rawDestructor,t)}break;default:m("Unsupporting sharing policy")}return t}function it(e,r){if(r===null)return this.isReference&&m(`null is not a valid ${this.name}`),0;r.$$||m(`Cannot pass "${me(r)}" as a ${this.name}`),r.$$.ptr||m(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&m(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=De(r.$$.ptr,t,this.registeredClass);return n}var fr=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=fr(e,r,t.baseClass);return n===null?null:t.downcast(n)},st={},at=(e,r)=>{for(r===void 0&&m("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},ut=(e,r)=>(r=at(e,r),st[r]),$e=(e,r)=>{(!r.ptrType||!r.ptr)&&_e("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&_e("Both smartPtrType and smartPtr must be specified"),r.count={value:1},ne(Object.create(e,{$$:{value:r,writable:!0}}))};function ct(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=ut(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function s(){return this.isSmartPointer?$e(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):$e(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var u=this.registeredClass.getActualType(r),f=ur[u];if(!f)return s.call(this);var c;this.isConst?c=f.constPointerType:c=f.pointerType;var d=fr(r,this.registeredClass,c.registeredClass);return d===null?s.call(this):this.isSmartPointer?$e(c.registeredClass.instancePrototype,{ptrType:c,ptr:d,smartPtrType:this,smartPtr:e}):$e(c.registeredClass.instancePrototype,{ptrType:c,ptr:d})}var ft=()=>{Object.assign(Pe.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){var r;(r=this.rawDestructor)==null||r.call(this,e)},argPackAdvance:D,readValueFromPointer:re,fromWireType:ct})};function Pe(e,r,t,n,s,u,f,c,d,p,h){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=s,this.pointeeType=u,this.sharingPolicy=f,this.rawGetPointee=c,this.rawConstructor=d,this.rawShare=p,this.rawDestructor=h,!s&&r.baseClass===void 0?n?(this.toWireType=nt,this.destructorFunction=null):(this.toWireType=it,this.destructorFunction=null):this.toWireType=ot}var lr=(e,r,t)=>{i.hasOwnProperty(e)||_e("Replacing nonexistent public symbol"),i[e].overloadTable!==void 0&&t!==void 0?i[e].overloadTable[t]=r:(i[e]=r,i[e].argCount=t)},X,we=e=>X.get(e),lt=(e,r,t=[],n=!1)=>{var s=we(r),u=s(...t);return e[0]=="p"?u>>>0:u},vt=(e,r,t=!1)=>(...n)=>lt(e,r,n,t),I=(e,r,t=!1)=>{e=S(e);function n(){if(e.includes("p"))return vt(e,r,t);var u=we(r);return u}var s=n();return typeof s!="function"&&m(`unknown function pointer with signature ${e}: ${r}`),s};class dt extends Error{}var vr=e=>{var r=gn(e),t=S(r);return q(r),t},Ce=(e,r)=>{var t=[],n={};function s(u){if(!n[u]&&!z[u]){if(ye[u]){ye[u].forEach(s);return}t.push(u),n[u]=!0}}throw r.forEach(s),new dt(`${e}: `+t.map(vr).join([", "]))};function pt(e,r,t,n,s,u,f,c,d,p,h,y,g){e>>>=0,r>>>=0,t>>>=0,n>>>=0,s>>>=0,u>>>=0,f>>>=0,c>>>=0,d>>>=0,p>>>=0,h>>>=0,y>>>=0,g>>>=0,h=S(h),u=I(s,u),c&&(c=I(f,c)),p&&(p=I(d,p)),g=I(y,g);var F=rt(h);Oe(F,function(){Ce(`Cannot construct ${h} due to unbound types`,[n])}),N([e,r,t],n?[n]:[],$=>{var T;$=$[0];var R,U;n?(R=$.registeredClass,U=R.instancePrototype):U=ge.prototype;var o=be(h,function(...E){if(Object.getPrototypeOf(this)!==a)throw new te(`Use 'new' to construct ${h}`);if(l.constructor_body===void 0)throw new te(`${h} has no accessible constructor`);var w=l.constructor_body[E.length];if(w===void 0)throw new te(`Tried to invoke ctor of ${h} with invalid number of parameters (${E.length}) - expected (${Object.keys(l.constructor_body).toString()}) parameters instead!`);return w.apply(this,E)}),a=Object.create(U,{constructor:{value:o}});o.prototype=a;var l=new tt(h,o,a,g,R,u,c,p);l.baseClass&&((T=l.baseClass).__derivedClasses??(T.__derivedClasses=[]),l.baseClass.__derivedClasses.push(l));var v=new Pe(h,l,!0,!1,!1),_=new Pe(h+"*",l,!1,!1,!1),b=new Pe(h+" const*",l,!1,!0,!1);return ur[e]={pointerType:_,constPointerType:b},lr(F,o),[v,_,b]})}var Ie=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push(P[r+n*4>>>2>>>0]);return t};function dr(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function ht(e,r,t,n){var s=dr(e),u=e.length-2,f=[],c=["fn"];r&&c.push("thisWired");for(var d=0;d<u;++d)f.push(`arg${d}`),c.push(`arg${d}Wired`);f=f.join(","),c=c.join(",");var p=`return function (${f}) {
|
|
1
|
+
import{_ as $n}from"./index-Dvz3nSDc.js";var Cn=(()=>{var Ne=import.meta.url;return(async function(Pr={}){var Ge,i=Pr,qe,Se,wr=new Promise((e,r)=>{qe=e,Se=r}),Cr=typeof window=="object",Ae=typeof WorkerGlobalScope<"u",Fe=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";if(Fe){const{createRequire:e}=await $n(async()=>{const{createRequire:r}=await import("./index-Dvz3nSDc.js").then(t=>t.a);return{createRequire:r}},[]);var Re=e(import.meta.url)}var Je=!1;i.setup=function(){if(Je)return;Je=!0,i.initTBB();function e(o,a,l=(v=>v)){if(a)for(let v of a)o.push_back(l(v));return o}function r(o,a=(l=>l)){const l=[],v=o.size();for(let _=0;_<v;_++)l.push(a(o.get(_)));return l}function t(o,a=(l=>l)){const l=[],v=o.size();for(let _=0;_<v;_++){const b=o.get(_),T=b.size(),E=[];for(let w=0;w<T;w++)E.push(a(b.get(w)));l.push(E)}return l}function n(o){return o[0].length<3&&(o=[o]),e(new i.Vector2_vec2,o,a=>e(new i.Vector_vec2,a,l=>l instanceof Array?{x:l[0],y:l[1]}:l))}function s(o){for(let a=0;a<o.size();a++)o.get(a).delete();o.delete()}function u(o){return o[0]instanceof Array?{x:o[0][0],y:o[0][1]}:typeof o[0]=="number"?{x:o[0]||0,y:o[1]||0}:o[0]}function f(o){return o[0]instanceof Array?{x:o[0][0],y:o[0][1],z:o[0][2]}:typeof o[0]=="number"?{x:o[0]||0,y:o[1]||0,z:o[2]||0}:o[0]}function c(o){return o=="EvenOdd"?0:o=="NonZero"?1:o=="Negative"?3:2}function d(o){return o=="Round"?1:o=="Miter"?2:0}const p=i.CrossSection;function h(o,a="Positive"){if(o instanceof p)return o;{const l=n(o),v=new p(l,c(a));return s(l),v}}i.CrossSection.prototype.translate=function(...o){return this._Translate(u(o))},i.CrossSection.prototype.scale=function(o){return typeof o=="number"?this._Scale({x:o,y:o}):this._Scale(u([o]))},i.CrossSection.prototype.mirror=function(o){return this._Mirror(u([o]))},i.CrossSection.prototype.warp=function(o){const a=oe(function(v){const _=O(v,"double"),b=O(v+8,"double"),T=[_,b];o(T),J(v,T[0],"double"),J(v+8,T[1],"double")},"vi"),l=this._Warp(a);return ie(a),l},i.CrossSection.prototype.decompose=function(){const o=this._Decompose(),a=r(o);return o.delete(),a},i.CrossSection.prototype.bounds=function(){const o=this._Bounds();return{min:["x","y"].map(a=>o.min[a]),max:["x","y"].map(a=>o.max[a])}},i.CrossSection.prototype.offset=function(o,a="Square",l=2,v=0){return this._Offset(o,d(a),l,v)},i.CrossSection.prototype.simplify=function(o=1e-6){return this._Simplify(o)},i.CrossSection.prototype.extrude=function(o,a=0,l=0,v=[1,1],_=!1){v=u([v]);const b=i._Extrude(this._ToPolygons(),o,a,l,v);return _?b.translate([0,0,-o/2]):b},i.CrossSection.prototype.revolve=function(o=0,a=360){return i._Revolve(this._ToPolygons(),o,a)},i.CrossSection.prototype.add=function(o){return this._add(h(o))},i.CrossSection.prototype.subtract=function(o){return this._subtract(h(o))},i.CrossSection.prototype.intersect=function(o){return this._intersect(h(o))},i.CrossSection.prototype.toPolygons=function(){const o=this._ToPolygons(),a=t(o,l=>[l.x,l.y]);return o.delete(),a},i.Manifold.prototype.smoothOut=function(o=60,a=0){return this._SmoothOut(o,a)},i.Manifold.prototype.warp=function(o){const a=oe(function(_){const b=O(_,"double"),T=O(_+8,"double"),E=O(_+16,"double"),w=[b,T,E];o(w),J(_,w[0],"double"),J(_+8,w[1],"double"),J(_+16,w[2],"double")},"vi"),l=this._Warp(a);ie(a);const v=l.status();if(v.value!==0)throw new i.ManifoldError(v.value);return l},i.Manifold.prototype.calculateNormals=function(o,a=60){return this._CalculateNormals(o,a)},i.Manifold.prototype.setProperties=function(o,a){const l=this.numProp(),v=oe(function(b,T,E){const w=[];for(let C=0;C<o;++C)w[C]=O(b+8*C,"double");const Z=[];for(let C=0;C<3;++C)Z[C]=O(T+8*C,"double");const Q=[];for(let C=0;C<l;++C)Q[C]=O(E+8*C,"double");a(w,Z,Q);for(let C=0;C<o;++C)J(b+8*C,w[C],"double")},"viii"),_=this._SetProperties(o,v);return ie(v),_},i.Manifold.prototype.translate=function(...o){return this._Translate(f(o))},i.Manifold.prototype.rotate=function(o,a,l){return Array.isArray(o)?this._Rotate(...o):this._Rotate(o,a||0,l||0)},i.Manifold.prototype.scale=function(o){return typeof o=="number"?this._Scale({x:o,y:o,z:o}):this._Scale(f([o]))},i.Manifold.prototype.mirror=function(o){return this._Mirror(f([o]))},i.Manifold.prototype.trimByPlane=function(o,a=0){return this._TrimByPlane(f([o]),a)},i.Manifold.prototype.slice=function(o=0){const a=this._Slice(o),l=new p(a,c("Positive"));return s(a),l},i.Manifold.prototype.project=function(){const o=this._Project(),a=new p(o,c("Positive"));return s(o),a},i.Manifold.prototype.split=function(o){const a=this._Split(o),l=r(a);return a.delete(),l},i.Manifold.prototype.splitByPlane=function(o,a=0){const l=this._SplitByPlane(f([o]),a),v=r(l);return l.delete(),v},i.Manifold.prototype.decompose=function(){const o=this._Decompose(),a=r(o);return o.delete(),a},i.Manifold.prototype.boundingBox=function(){const o=this._boundingBox();return{min:["x","y","z"].map(a=>o.min[a]),max:["x","y","z"].map(a=>o.max[a])}};class y{constructor({numProp:a=3,triVerts:l=new Uint32Array,vertProperties:v=new Float32Array,mergeFromVert:_,mergeToVert:b,runIndex:T,runOriginalID:E,faceID:w,halfedgeTangent:Z,runTransform:Q}={}){this.numProp=a,this.triVerts=l,this.vertProperties=v,this.mergeFromVert=_,this.mergeToVert=b,this.runIndex=T,this.runOriginalID=E,this.faceID=w,this.halfedgeTangent=Z,this.runTransform=Q}get numTri(){return this.triVerts.length/3}get numVert(){return this.vertProperties.length/this.numProp}get numRun(){return this.runOriginalID.length}merge(){const{changed:a,mesh:l}=i._Merge(this);return Object.assign(this,{...l}),a}verts(a){return this.triVerts.subarray(3*a,3*(a+1))}position(a){return this.vertProperties.subarray(this.numProp*a,this.numProp*a+3)}extras(a){return this.vertProperties.subarray(this.numProp*a+3,this.numProp*(a+1))}tangent(a){return this.halfedgeTangent.subarray(4*a,4*(a+1))}transform(a){const l=new Array(16);for(const v of[0,1,2,3])for(const _ of[0,1,2])l[4*v+_]=this.runTransform[12*a+3*v+_];return l[15]=1,l}}i.Mesh=y,i.Manifold.prototype.getMesh=function(o=-1){return new y(this._GetMeshJS(o))},i.ManifoldError=function(a,...l){let v="Unknown error";switch(a){case i.status.NonFiniteVertex.value:v="Non-finite vertex";break;case i.status.NotManifold.value:v="Not manifold";break;case i.status.VertexOutOfBounds.value:v="Vertex index out of bounds";break;case i.status.PropertiesWrongLength.value:v="Properties have wrong length";break;case i.status.MissingPositionProperties.value:v="Less than three properties";break;case i.status.MergeVectorsDifferentLengths.value:v="Merge vectors have different lengths";break;case i.status.MergeIndexOutOfBounds.value:v="Merge index out of bounds";break;case i.status.TransformWrongLength.value:v="Transform vector has wrong length";break;case i.status.RunIndexWrongLength.value:v="Run index vector has wrong length";break;case i.status.FaceIDWrongLength.value:v="Face ID vector has wrong length";case i.status.InvalidConstruction.value:v="Manifold constructed with invalid parameters"}const _=Error.apply(this,[v,...l]);_.name=this.name="ManifoldError",this.message=_.message,this.stack=_.stack,this.code=a},i.ManifoldError.prototype=Object.create(Error.prototype,{constructor:{value:i.ManifoldError,writable:!0,configurable:!0}}),i.CrossSection=function(o,a="Positive"){const l=n(o),v=new p(l,c(a));return s(l),v},i.CrossSection.ofPolygons=function(o,a="Positive"){return new i.CrossSection(o,a)},i.CrossSection.square=function(...o){let a;o.length==0?a={x:1,y:1}:typeof o[0]=="number"?a={x:o[0],y:o[0]}:a=u(o);const l=o[1]||!1;return i._Square(a,l)},i.CrossSection.circle=function(o,a=0){return i._Circle(o,a)};function g(o){return function(...a){a.length==1&&(a=a[0]);const l=new i.Vector_crossSection;for(const _ of a)l.push_back(h(_));const v=i["_crossSection"+o](l);return l.delete(),v}}i.CrossSection.compose=g("Compose"),i.CrossSection.union=g("UnionN"),i.CrossSection.difference=g("DifferenceN"),i.CrossSection.intersection=g("IntersectionN");function F(o,a){e(o,a,l=>l instanceof Array?{x:l[0],y:l[1]}:l)}i.CrossSection.hull=function(...o){o.length==1&&(o=o[0]);let a=new i.Vector_vec2;for(const v of o)if(v instanceof p)i._crossSectionCollectVertices(a,v);else if(v instanceof Array&&v.length==2&&typeof v[0]=="number")a.push_back({x:v[0],y:v[1]});else if(v.x)a.push_back(v);else{const b=v[0].length==2&&typeof v[0][0]=="number"||v[0].x?[v]:v;for(const T of b)F(a,T)}const l=i._crossSectionHullPoints(a);return a.delete(),l},i.CrossSection.prototype=Object.create(p.prototype),Object.defineProperty(i.CrossSection,Symbol.hasInstance,{get:()=>o=>o instanceof p});const $=i.Manifold;i.Manifold=function(o){const a=new $(o),l=a.status();if(l.value!==0)throw new i.ManifoldError(l.value);return a},i.Manifold.ofMesh=function(o){return new i.Manifold(o)},i.Manifold.tetrahedron=function(){return i._Tetrahedron()},i.Manifold.cube=function(...o){let a;o.length==0?a={x:1,y:1,z:1}:typeof o[0]=="number"?a={x:o[0],y:o[0],z:o[0]}:a=f(o);const l=o[1]||!1;return i._Cube(a,l)},i.Manifold.cylinder=function(o,a,l=-1,v=0,_=!1){return i._Cylinder(o,a,l,v,_)},i.Manifold.sphere=function(o,a=0){return i._Sphere(o,a)},i.Manifold.smooth=function(o,a=[]){const l=new i.Vector_smoothness;e(l,a);const v=i._Smooth(o,l);return l.delete(),v},i.Manifold.extrude=function(o,a,l=0,v=0,_=[1,1],b=!1){return(o instanceof p?o:i.CrossSection(o,"Positive")).extrude(a,l,v,_,b)},i.Manifold.revolve=function(o,a=0,l=360){return(o instanceof p?o:i.CrossSection(o,"Positive")).revolve(a,l)},i.Manifold.reserveIDs=function(o){return i._ReserveIDs(o)},i.Manifold.compose=function(o){const a=new i.Vector_manifold;e(a,o);const l=i._manifoldCompose(a);return a.delete(),l};function R(o){return function(...a){a.length==1&&(a=a[0]);const l=new i.Vector_manifold;for(const _ of a)l.push_back(_);const v=i["_manifold"+o+"N"](l);return l.delete(),v}}i.Manifold.union=R("Union"),i.Manifold.difference=R("Difference"),i.Manifold.intersection=R("Intersection"),i.Manifold.levelSet=function(o,a,l,v=0,_=-1){const b={min:{x:a.min[0],y:a.min[1],z:a.min[2]},max:{x:a.max[0],y:a.max[1],z:a.max[2]}},T=oe(function(w){const Z=O(w,"double"),Q=O(w+8,"double"),C=O(w+16,"double");return o([Z,Q,C])},"di"),E=i._LevelSet(T,b,l,v,_);return ie(T),E};function U(o,a){e(o,a,l=>l instanceof Array?{x:l[0],y:l[1],z:l[2]}:l)}i.Manifold.hull=function(...o){o.length==1&&(o=o[0]);let a=new i.Vector_vec3;for(const v of o)v instanceof $?i._manifoldCollectVertices(a,v):v instanceof Array&&v.length==3&&typeof v[0]=="number"?a.push_back({x:v[0],y:v[1],z:v[2]}):v.x?a.push_back(v):U(a,v);const l=i._manifoldHullPoints(a);return a.delete(),l},i.Manifold.prototype=Object.create($.prototype),Object.defineProperty(i.Manifold,Symbol.hasInstance,{get:()=>o=>o instanceof $}),i.triangulate=function(o,a=-1,l=!0){const v=n(o),_=r(i._Triangulate(v,a,l),b=>[b[0],b[1],b[2]]);return s(v),_}};var Ke={...i},k="";function Tr(e){return i.locateFile?i.locateFile(e,k):k+e}var Ee,se;if(Fe){var Xe=Re("fs"),Sr=Re("path");import.meta.url.startsWith("data:")||(k=Sr.dirname(Re("url").fileURLToPath(import.meta.url))+"/"),se=e=>{e=de(e)?new URL(e):e;var r=Xe.readFileSync(e);return r},Ee=async(e,r=!0)=>{e=de(e)?new URL(e):e;var t=Xe.readFileSync(e,r?void 0:"utf8");return t},!i.thisProgram&&process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2)}else(Cr||Ae)&&(Ae?k=self.location.href:typeof document<"u"&&document.currentScript&&(k=document.currentScript.src),Ne&&(k=Ne),k.startsWith("blob:")?k="":k=k.slice(0,k.replace(/[?#].*/,"").lastIndexOf("/")+1),Ae&&(se=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),Ee=async e=>{if(de(e))return new Promise((t,n)=>{var s=new XMLHttpRequest;s.open("GET",e,!0),s.responseType="arraybuffer",s.onload=()=>{if(s.status==200||s.status==0&&s.response){t(s.response);return}n(s.status)},s.onerror=n,s.send(null)});var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)});i.print||console.log.bind(console);var ae=i.printErr||console.error.bind(console);Object.assign(i,Ke),Ke=null,i.arguments&&i.arguments,i.thisProgram&&i.thisProgram;var ue=i.wasmBinary,ce,Ze=!1,W,M,B,Y,H,P,fe,le,Qe,ve,de=e=>e.startsWith("file://");function Ye(){var e=ce.buffer;i.HEAP8=W=new Int8Array(e),i.HEAP16=B=new Int16Array(e),i.HEAPU8=M=new Uint8Array(e),i.HEAPU16=Y=new Uint16Array(e),i.HEAP32=H=new Int32Array(e),i.HEAPU32=P=new Uint32Array(e),i.HEAPF32=fe=new Float32Array(e),i.HEAPF64=ve=new Float64Array(e),i.HEAP64=le=new BigInt64Array(e),i.HEAPU64=Qe=new BigUint64Array(e)}function Ar(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)Ur(i.preRun.shift());er(tr)}function Fr(){j.J()}function Rr(){if(i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)xr(i.postRun.shift());er(rr)}var L=0,ee=null;function Er(e){var r;L++,(r=i.monitorRunDependencies)==null||r.call(i,L)}function Wr(e){var t;if(L--,(t=i.monitorRunDependencies)==null||t.call(i,L),L==0&&ee){var r=ee;ee=null,r()}}function pe(e){var t;(t=i.onAbort)==null||t.call(i,e),e="Aborted("+e+")",ae(e),Ze=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw Se(r),r}var We;function Mr(){return i.locateFile?Tr("manifold.wasm"):new URL("/assets/manifold-C44_QbND.wasm",import.meta.url).href}function Vr(e){if(e==We&&ue)return new Uint8Array(ue);if(se)return se(e);throw"both async and sync fetching of the wasm failed"}async function kr(e){if(!ue)try{var r=await Ee(e);return new Uint8Array(r)}catch{}return Vr(e)}async function Or(e,r){try{var t=await kr(e),n=await WebAssembly.instantiate(t,r);return n}catch(s){ae(`failed to asynchronously prepare wasm: ${s}`),pe(s)}}async function Dr(e,r,t){if(!e&&typeof WebAssembly.instantiateStreaming=="function"&&!de(r)&&!Fe)try{var n=fetch(r,{credentials:"same-origin"}),s=await WebAssembly.instantiateStreaming(n,t);return s}catch(u){ae(`wasm streaming compile failed: ${u}`),ae("falling back to ArrayBuffer instantiation")}return Or(r,t)}function Ir(){return{a:mn}}async function jr(){function e(u,f){return j=u.exports,j=bn(j),ce=j.I,Ye(),X=j.L,Wr(),j}Er();function r(u){return e(u.instance)}var t=Ir();if(i.instantiateWasm)return new Promise((u,f)=>{i.instantiateWasm(t,(c,d)=>{e(c),u(c.exports)})});We??(We=Mr());try{var n=await Dr(ue,We,t),s=r(n);return s}catch(u){return Se(u),Promise.reject(u)}}var er=e=>{for(;e.length>0;)e.shift()(i)},rr=[],xr=e=>rr.unshift(e),tr=[],Ur=e=>tr.unshift(e);function O(e,r="i8"){switch(r.endsWith("*")&&(r="*"),r){case"i1":return W[e>>>0];case"i8":return W[e>>>0];case"i16":return B[e>>>1>>>0];case"i32":return H[e>>>2>>>0];case"i64":return le[e>>>3];case"float":return fe[e>>>2>>>0];case"double":return ve[e>>>3>>>0];case"*":return P[e>>>2>>>0];default:pe(`invalid type for getValue: ${r}`)}}i.noExitRuntime;function J(e,r,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":W[e>>>0]=r;break;case"i8":W[e>>>0]=r;break;case"i16":B[e>>>1>>>0]=r;break;case"i32":H[e>>>2>>>0]=r;break;case"i64":le[e>>>3]=BigInt(r);break;case"float":fe[e>>>2>>>0]=r;break;case"double":ve[e>>>3>>>0]=r;break;case"*":P[e>>>2>>>0]=r;break;default:pe(`invalid type for setValue: ${t}`)}}class Br{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){P[this.ptr+4>>>2>>>0]=r}get_type(){return P[this.ptr+4>>>2>>>0]}set_destructor(r){P[this.ptr+8>>>2>>>0]=r}get_destructor(){return P[this.ptr+8>>>2>>>0]}set_caught(r){r=r?1:0,W[this.ptr+12>>>0]=r}get_caught(){return W[this.ptr+12>>>0]!=0}set_rethrown(r){r=r?1:0,W[this.ptr+13>>>0]=r}get_rethrown(){return W[this.ptr+13>>>0]!=0}init(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t)}set_adjusted_ptr(r){P[this.ptr+16>>>2>>>0]=r}get_adjusted_ptr(){return P[this.ptr+16>>>2>>>0]}}var nr=0;function Hr(e,r,t){e>>>=0,r>>>=0,t>>>=0;var n=new Br(e);throw n.init(r,t),nr=e,nr}var Lr=()=>pe(""),he={},Me=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r)}};function re(e){return this.fromWireType(P[e>>>2>>>0])}var K={},z={},ye={},zr=i.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},_e=e=>{throw new zr(e)},N=(e,r,t)=>{e.forEach(c=>ye[c]=r);function n(c){var d=t(c);d.length!==e.length&&_e("Mismatched type converter count");for(var p=0;p<e.length;++p)V(e[p],d[p])}var s=new Array(r.length),u=[],f=0;r.forEach((c,d)=>{z.hasOwnProperty(c)?s[d]=z[c]:(u.push(c),K.hasOwnProperty(c)||(K[c]=[]),K[c].push(()=>{s[d]=z[c],++f,f===u.length&&n(s)}))}),u.length===0&&n(s)},Nr=function(e){e>>>=0;var r=he[e];delete he[e];var t=r.rawConstructor,n=r.rawDestructor,s=r.fields,u=s.map(f=>f.getterReturnType).concat(s.map(f=>f.setterArgumentType));N([e],u,f=>{var c={};return s.forEach((d,p)=>{var h=d.fieldName,y=f[p],g=f[p].optional,F=d.getter,$=d.getterContext,R=f[p+s.length],U=d.setter,o=d.setterContext;c[h]={read:a=>y.fromWireType(F($,a)),write:(a,l)=>{var v=[];U(o,a,R.toWireType(v,l)),Me(v)},optional:g}}),[{name:r.name,fromWireType:d=>{var p={};for(var h in c)p[h]=c[h].read(d);return n(d),p},toWireType:(d,p)=>{for(var h in c)if(!(h in p)&&!c[h].optional)throw new TypeError(`Missing field: "${h}"`);var y=t();for(h in c)c[h].write(y,p[h]);return d!==null&&d.push(n,y),y},argPackAdvance:D,readValueFromPointer:re,destructorFunction:n}]})},me=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},Gr=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);or=e},or,S=e=>{for(var r="",t=e;M[t>>>0];)r+=or[M[t++>>>0]];return r},te=i.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},m=e=>{throw new te(e)};function qr(e,r,t={}){var n=r.name;if(e||m(`type "${n}" must have a positive integer typeid pointer`),z.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;m(`Cannot register type '${n}' twice`)}if(z[e]=r,delete ye[e],K.hasOwnProperty(e)){var s=K[e];delete K[e],s.forEach(u=>u())}}function V(e,r,t={}){return qr(e,r,t)}var ir=(e,r,t)=>{switch(r){case 1:return t?n=>W[n>>>0]:n=>M[n>>>0];case 2:return t?n=>B[n>>>1>>>0]:n=>Y[n>>>1>>>0];case 4:return t?n=>H[n>>>2>>>0]:n=>P[n>>>2>>>0];case 8:return t?n=>le[n>>>3]:n=>Qe[n>>>3];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}};function Jr(e,r,t,n,s){e>>>=0,r>>>=0,t>>>=0,r=S(r);var u=r.indexOf("u")!=-1;V(e,{name:r,fromWireType:f=>f,toWireType:function(f,c){if(typeof c!="bigint"&&typeof c!="number")throw new TypeError(`Cannot convert "${me(c)}" to ${this.name}`);return typeof c=="number"&&(c=BigInt(c)),c},argPackAdvance:D,readValueFromPointer:ir(r,t,!u),destructorFunction:null})}var D=8;function Kr(e,r,t,n){e>>>=0,r>>>=0,r=S(r),V(e,{name:r,fromWireType:function(s){return!!s},toWireType:function(s,u){return u?t:n},argPackAdvance:D,readValueFromPointer:function(s){return this.fromWireType(M[s>>>0])},destructorFunction:null})}var Xr=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Ve=e=>{function r(t){return t.$$.ptrType.registeredClass.name}m(r(e)+" instance already deleted")},ke=!1,sr=e=>{},Zr=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},ar=e=>{e.count.value-=1;var r=e.count.value===0;r&&Zr(e)},ne=e=>typeof FinalizationRegistry>"u"?(ne=r=>r,e):(ke=new FinalizationRegistry(r=>{ar(r.$$)}),ne=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var s={$$:t};ke.register(r,s,r)}return r},sr=r=>ke.unregister(r),ne(e)),Qr=()=>{let e=ge.prototype;Object.assign(e,{isAliasOf(t){if(!(this instanceof ge)||!(t instanceof ge))return!1;var n=this.$$.ptrType.registeredClass,s=this.$$.ptr;t.$$=t.$$;for(var u=t.$$.ptrType.registeredClass,f=t.$$.ptr;n.baseClass;)s=n.upcast(s),n=n.baseClass;for(;u.baseClass;)f=u.upcast(f),u=u.baseClass;return n===u&&s===f},clone(){if(this.$$.ptr||Ve(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t=ne(Object.create(Object.getPrototypeOf(this),{$$:{value:Xr(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||Ve(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&m("Object already scheduled for deletion"),sr(this),ar(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Ve(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&m("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}});const r=Symbol.dispose;r&&(e[r]=e.delete)};function ge(){}var be=(e,r)=>Object.defineProperty(r,"name",{value:e}),ur={},cr=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...s){return e[r].overloadTable.hasOwnProperty(s.length)||m(`Function '${t}' called with an invalid number of arguments (${s.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[s.length].apply(this,s)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},Oe=(e,r,t)=>{i.hasOwnProperty(e)?((t===void 0||i[e].overloadTable!==void 0&&i[e].overloadTable[t]!==void 0)&&m(`Cannot register public name '${e}' twice`),cr(i,e,e),i[e].overloadTable.hasOwnProperty(t)&&m(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),i[e].overloadTable[t]=r):(i[e]=r,i[e].argCount=t)},Yr=48,et=57,rt=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=Yr&&r<=et?`_${e}`:e};function tt(e,r,t,n,s,u,f,c){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=s,this.getActualType=u,this.upcast=f,this.downcast=c,this.pureVirtualFunctions=[]}var De=(e,r,t)=>{for(;r!==t;)r.upcast||m(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function nt(e,r){if(r===null)return this.isReference&&m(`null is not a valid ${this.name}`),0;r.$$||m(`Cannot pass "${me(r)}" as a ${this.name}`),r.$$.ptr||m(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=De(r.$$.ptr,t,this.registeredClass);return n}function ot(e,r){var t;if(r===null)return this.isReference&&m(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&m(`Cannot pass "${me(r)}" as a ${this.name}`),r.$$.ptr||m(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&m(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(t=De(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&m("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:m(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var s=r.clone();t=this.rawShare(t,A.toHandle(()=>s.delete())),e!==null&&e.push(this.rawDestructor,t)}break;default:m("Unsupporting sharing policy")}return t}function it(e,r){if(r===null)return this.isReference&&m(`null is not a valid ${this.name}`),0;r.$$||m(`Cannot pass "${me(r)}" as a ${this.name}`),r.$$.ptr||m(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&m(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=De(r.$$.ptr,t,this.registeredClass);return n}var fr=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=fr(e,r,t.baseClass);return n===null?null:t.downcast(n)},st={},at=(e,r)=>{for(r===void 0&&m("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},ut=(e,r)=>(r=at(e,r),st[r]),$e=(e,r)=>{(!r.ptrType||!r.ptr)&&_e("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&_e("Both smartPtrType and smartPtr must be specified"),r.count={value:1},ne(Object.create(e,{$$:{value:r,writable:!0}}))};function ct(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=ut(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function s(){return this.isSmartPointer?$e(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):$e(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var u=this.registeredClass.getActualType(r),f=ur[u];if(!f)return s.call(this);var c;this.isConst?c=f.constPointerType:c=f.pointerType;var d=fr(r,this.registeredClass,c.registeredClass);return d===null?s.call(this):this.isSmartPointer?$e(c.registeredClass.instancePrototype,{ptrType:c,ptr:d,smartPtrType:this,smartPtr:e}):$e(c.registeredClass.instancePrototype,{ptrType:c,ptr:d})}var ft=()=>{Object.assign(Pe.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){var r;(r=this.rawDestructor)==null||r.call(this,e)},argPackAdvance:D,readValueFromPointer:re,fromWireType:ct})};function Pe(e,r,t,n,s,u,f,c,d,p,h){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=s,this.pointeeType=u,this.sharingPolicy=f,this.rawGetPointee=c,this.rawConstructor=d,this.rawShare=p,this.rawDestructor=h,!s&&r.baseClass===void 0?n?(this.toWireType=nt,this.destructorFunction=null):(this.toWireType=it,this.destructorFunction=null):this.toWireType=ot}var lr=(e,r,t)=>{i.hasOwnProperty(e)||_e("Replacing nonexistent public symbol"),i[e].overloadTable!==void 0&&t!==void 0?i[e].overloadTable[t]=r:(i[e]=r,i[e].argCount=t)},X,we=e=>X.get(e),lt=(e,r,t=[],n=!1)=>{var s=we(r),u=s(...t);return e[0]=="p"?u>>>0:u},vt=(e,r,t=!1)=>(...n)=>lt(e,r,n,t),I=(e,r,t=!1)=>{e=S(e);function n(){if(e.includes("p"))return vt(e,r,t);var u=we(r);return u}var s=n();return typeof s!="function"&&m(`unknown function pointer with signature ${e}: ${r}`),s};class dt extends Error{}var vr=e=>{var r=gn(e),t=S(r);return q(r),t},Ce=(e,r)=>{var t=[],n={};function s(u){if(!n[u]&&!z[u]){if(ye[u]){ye[u].forEach(s);return}t.push(u),n[u]=!0}}throw r.forEach(s),new dt(`${e}: `+t.map(vr).join([", "]))};function pt(e,r,t,n,s,u,f,c,d,p,h,y,g){e>>>=0,r>>>=0,t>>>=0,n>>>=0,s>>>=0,u>>>=0,f>>>=0,c>>>=0,d>>>=0,p>>>=0,h>>>=0,y>>>=0,g>>>=0,h=S(h),u=I(s,u),c&&(c=I(f,c)),p&&(p=I(d,p)),g=I(y,g);var F=rt(h);Oe(F,function(){Ce(`Cannot construct ${h} due to unbound types`,[n])}),N([e,r,t],n?[n]:[],$=>{var T;$=$[0];var R,U;n?(R=$.registeredClass,U=R.instancePrototype):U=ge.prototype;var o=be(h,function(...E){if(Object.getPrototypeOf(this)!==a)throw new te(`Use 'new' to construct ${h}`);if(l.constructor_body===void 0)throw new te(`${h} has no accessible constructor`);var w=l.constructor_body[E.length];if(w===void 0)throw new te(`Tried to invoke ctor of ${h} with invalid number of parameters (${E.length}) - expected (${Object.keys(l.constructor_body).toString()}) parameters instead!`);return w.apply(this,E)}),a=Object.create(U,{constructor:{value:o}});o.prototype=a;var l=new tt(h,o,a,g,R,u,c,p);l.baseClass&&((T=l.baseClass).__derivedClasses??(T.__derivedClasses=[]),l.baseClass.__derivedClasses.push(l));var v=new Pe(h,l,!0,!1,!1),_=new Pe(h+"*",l,!1,!1,!1),b=new Pe(h+" const*",l,!1,!0,!1);return ur[e]={pointerType:_,constPointerType:b},lr(F,o),[v,_,b]})}var Ie=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push(P[r+n*4>>>2>>>0]);return t};function dr(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function ht(e,r,t,n){var s=dr(e),u=e.length-2,f=[],c=["fn"];r&&c.push("thisWired");for(var d=0;d<u;++d)f.push(`arg${d}`),c.push(`arg${d}Wired`);f=f.join(","),c=c.join(",");var p=`return function (${f}) {
|
|
2
2
|
`;s&&(p+=`var destructors = [];
|
|
3
3
|
`);var h=s?"destructors":"null",y=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];r&&(p+=`var thisWired = classParam['toWireType'](${h}, this);
|
|
4
4
|
`);for(var d=0;d<u;++d)p+=`var arg${d}Wired = argType${d}['toWireType'](${h}, arg${d});
|