forgecad 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/LICENSE +97 -0
  2. package/README.md +354 -0
  3. package/dist/assets/evalWorker-BYHXxh15.js +461 -0
  4. package/dist/assets/index--CYbOPKS.js +5797 -0
  5. package/dist/assets/manifold-65fIQlgQ.js +20 -0
  6. package/dist/assets/manifold-B85M7kop.js +20 -0
  7. package/dist/assets/manifold-B8h_vZ5O.js +16 -0
  8. package/dist/assets/manifold-D9yvTBHx.wasm +0 -0
  9. package/dist/assets/manifold-d1UpyLJ8.js +20 -0
  10. package/dist/assets/reportWorker-B1Zdrz9l.js +494 -0
  11. package/dist/index.html +16 -0
  12. package/dist-cli/forgecad.js +44464 -0
  13. package/dist-skill/SKILL.md +4635 -0
  14. package/examples/3d-printer.forge.js +328 -0
  15. package/examples/5-figen-robot-hand.forge.js +283 -0
  16. package/examples/ac-unit-glm47.forge.js +108 -0
  17. package/examples/ac-unit-glm5.forge.js +174 -0
  18. package/examples/ac-unit-kimi25.forge.js +236 -0
  19. package/examples/ac-unit-minimax.forge.js +123 -0
  20. package/examples/ac-unit.forge.js +126 -0
  21. package/examples/adjustable-table.forge.js +191 -0
  22. package/examples/api/assembly-gear-coupling.forge.js +32 -0
  23. package/examples/api/assembly-mechanism.forge.js +111 -0
  24. package/examples/api/attachTo-basics.forge.js +45 -0
  25. package/examples/api/benchy-style-hull.forge.js +89 -0
  26. package/examples/api/bill-of-materials.forge.js +46 -0
  27. package/examples/api/boolean-operations.forge.js +48 -0
  28. package/examples/api/bounding-box-visualizer.forge.js +58 -0
  29. package/examples/api/brep-exportable.forge.js +19 -0
  30. package/examples/api/center-true-vs-false.forge.js +40 -0
  31. package/examples/api/clone-duplicate.forge.js +41 -0
  32. package/examples/api/colors-union-vs-array.forge.js +27 -0
  33. package/examples/api/coordinate-system.forge.js +54 -0
  34. package/examples/api/curves-surfacing-basics.forge.js +91 -0
  35. package/examples/api/dimensioned-bracket.forge.js +19 -0
  36. package/examples/api/elbow-test.forge.js +23 -0
  37. package/examples/api/exploded-view.forge.js +60 -0
  38. package/examples/api/extrude-options.forge.js +44 -0
  39. package/examples/api/face-gears.forge.js +44 -0
  40. package/examples/api/face-transformation-history.forge.js +45 -0
  41. package/examples/api/feature-created-faces.forge.js +47 -0
  42. package/examples/api/folded-service-panel-cover.forge.js +3 -0
  43. package/examples/api/folded-service-panel-cover.js +117 -0
  44. package/examples/api/gears-bevel-face-joints.forge.js +157 -0
  45. package/examples/api/gears-tier1.forge.js +57 -0
  46. package/examples/api/geometry-info.forge.js +49 -0
  47. package/examples/api/group-test.forge.js +34 -0
  48. package/examples/api/group-vs-union.forge.js +25 -0
  49. package/examples/api/import-args-unit.forge.js +5 -0
  50. package/examples/api/import-args.forge.js +16 -0
  51. package/examples/api/import-dimensions-follow.forge.js +18 -0
  52. package/examples/api/import-placement-references.forge.js +18 -0
  53. package/examples/api/import-placement-widget-source.forge.js +30 -0
  54. package/examples/api/import-relative-paths.forge.js +18 -0
  55. package/examples/api/import-svg-sketch-shape.svg +15 -0
  56. package/examples/api/import-svg-sketch.forge.js +28 -0
  57. package/examples/api/js-module-imports.forge.js +9 -0
  58. package/examples/api/js-module-pillars.js +25 -0
  59. package/examples/api/js-module-scene.js +9 -0
  60. package/examples/api/notebook-assembly-debug.forge-notebook.json +90 -0
  61. package/examples/api/notebook-iteration.forge-notebook.json +75 -0
  62. package/examples/api/patterns.forge.js +32 -0
  63. package/examples/api/pointAlong-orientation.forge.js +52 -0
  64. package/examples/api/profile-2020-b-slot6.forge.js +36 -0
  65. package/examples/api/rotate-around-to.forge.js +31 -0
  66. package/examples/api/runtime-joints-view.forge.js +116 -0
  67. package/examples/api/sdf-rover-demo.forge.js +159 -0
  68. package/examples/api/section-plane-visualization.forge.js +38 -0
  69. package/examples/api/sketch-basics.forge.js +48 -0
  70. package/examples/api/sketch-on-face.forge.js +56 -0
  71. package/examples/api/sketch-rounding-strategies.forge.js +56 -0
  72. package/examples/api/spatial-recipes.forge.js +129 -0
  73. package/examples/bathroom.forge.js +197 -0
  74. package/examples/bolt-and-nut.forge.js +39 -0
  75. package/examples/bolt-pattern.forge.js +18 -0
  76. package/examples/bottle.forge.js +101 -0
  77. package/examples/chair.forge.js +62 -0
  78. package/examples/chess-set.forge.js +232 -0
  79. package/examples/classical-piano.forge.js +203 -0
  80. package/examples/clock.forge.js +169 -0
  81. package/examples/compiler-corpus/README.md +88 -0
  82. package/examples/compiler-corpus/edge-finished-mount.forge.js +18 -0
  83. package/examples/compiler-corpus/enclosure-shell-cuts.forge.js +24 -0
  84. package/examples/compiler-corpus/fastener-plate-variants.forge.js +42 -0
  85. package/examples/compiler-corpus/folded-service-panel-cover.forge.js +5 -0
  86. package/examples/compiler-corpus/motor-mount-plate.forge.js +32 -0
  87. package/examples/compiler-corpus/projection-relay-cover.forge.js +16 -0
  88. package/examples/compiler-corpus/sensor-bracket.forge.js +35 -0
  89. package/examples/compiler-corpus/service-panel-cover.forge.js +53 -0
  90. package/examples/compiler-corpus/trimmed-access-cover.forge.js +26 -0
  91. package/examples/cup.forge.js +25 -0
  92. package/examples/cut-plane-demo.forge.js +28 -0
  93. package/examples/door-with-hinges.forge.js +54 -0
  94. package/examples/frame.sketch.js +4 -0
  95. package/examples/headphone-hanger-profile.sketch.js +18 -0
  96. package/examples/headphone-hanger-v2.forge.js +88 -0
  97. package/examples/headphone-hanger.forge.js +5 -0
  98. package/examples/iphone-stand.forge.js +72 -0
  99. package/examples/iphone.forge.js +114 -0
  100. package/examples/ironman-helmet.js +79 -0
  101. package/examples/kitchen.forge.js +231 -0
  102. package/examples/lamp-shade.sketch.js +17 -0
  103. package/examples/laptop.forge.js +144 -0
  104. package/examples/liquid-soap-dispenser.forge.js +159 -0
  105. package/examples/modern-tv.forge.js +86 -0
  106. package/examples/picture-frame.forge.js +34 -0
  107. package/examples/robot_hand.forge.js +393 -0
  108. package/examples/robot_hand_2.forge.js +622 -0
  109. package/examples/sandbox.forge.js +3 -0
  110. package/examples/shelf/container.forge.js +30 -0
  111. package/examples/shelf/shelf-unit.forge.js +62 -0
  112. package/examples/shoe-rack-doors.forge.js +107 -0
  113. package/examples/shoe-rack.forge.js +65 -0
  114. package/examples/spiderman-cake.forge.js +92 -0
  115. package/examples/table-lamp.forge.js +33 -0
  116. package/examples/table.forge.js +44 -0
  117. package/examples/test-colors.forge.js +19 -0
  118. package/examples/tv-stand.forge.js +21 -0
  119. package/package.json +69 -0
@@ -0,0 +1,20 @@
1
+ import{_ as kn}from"./index--CYbOPKS.js";var Dn=(()=>{var Ke=import.meta.url;return(async function(Ir={}){var Xe,o=Ir,Qe,de,Or=new Promise((e,r)=>{Qe=e,de=r}),Dr=typeof window=="object",We=typeof importScripts=="function",Ee=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";if(Ee){const{createRequire:e}=await kn(()=>import("./index--CYbOPKS.js").then(r=>r.a),[]);var Me=e(import.meta.url)}var Ye=!1;o.setup=function(){if(Ye)return;Ye=!0,o.initTBB();function e(i,a,f=(p=>p)){if(a)for(let p of a)i.push_back(f(p));return i}function r(i,a=(f=>f)){const f=[],p=i.size();for(let _=0;_<p;_++)f.push(a(i.get(_)));return f}function t(i,a=(f=>f)){const f=[],p=i.size();for(let _=0;_<p;_++){const b=i.get(_),S=b.size(),W=[];for(let w=0;w<S;w++)W.push(a(b.get(w)));f.push(W)}return f}function n(i){return i[0].length<3&&(i=[i]),e(new o.Vector2_vec2,i,a=>e(new o.Vector_vec2,a,f=>f instanceof Array?{x:f[0],y:f[1]}:f))}function s(i){for(let a=0;a<i.size();a++)i.get(a).delete();i.delete()}function u(i){return i[0]instanceof Array?{x:i[0][0],y:i[0][1]}:typeof i[0]=="number"?{x:i[0]||0,y:i[1]||0}:i[0]}function l(i){return i[0]instanceof Array?{x:i[0][0],y:i[0][1],z:i[0][2]}:typeof i[0]=="number"?{x:i[0]||0,y:i[1]||0,z:i[2]||0}:i[0]}function c(i){return i=="EvenOdd"?0:i=="NonZero"?1:i=="Negative"?3:2}function v(i){return i=="Round"?1:i=="Miter"?2:0}const d=o.CrossSection;function h(i,a="Positive"){if(i instanceof d)return i;{const f=n(i),p=new d(f,c(a));return s(f),p}}o.CrossSection.prototype.translate=function(...i){return this._Translate(u(i))},o.CrossSection.prototype.scale=function(i){return typeof i=="number"?this._Scale({x:i,y:i}):this._Scale(u([i]))},o.CrossSection.prototype.mirror=function(i){return this._Mirror(u([i]))},o.CrossSection.prototype.warp=function(i){const a=le(function(p){const _=V(p,"double"),b=V(p+8,"double"),S=[_,b];i(S),Z(p,S[0],"double"),Z(p+8,S[1],"double")},"vi"),f=this._Warp(a);return ve(a),f},o.CrossSection.prototype.decompose=function(){const i=this._Decompose(),a=r(i);return i.delete(),a},o.CrossSection.prototype.bounds=function(){const i=this._Bounds();return{min:["x","y"].map(a=>i.min[a]),max:["x","y"].map(a=>i.max[a])}},o.CrossSection.prototype.offset=function(i,a="Round",f=2,p=0){return this._Offset(i,v(a),f,p)},o.CrossSection.prototype.simplify=function(i=1e-6){return this._Simplify(i)},o.CrossSection.prototype.extrude=function(i,a=0,f=0,p=[1,1],_=!1){p=u([p]);const b=o._Extrude(this._ToPolygons(),i,a,f,p);return _?b.translate([0,0,-i/2]):b},o.CrossSection.prototype.revolve=function(i=0,a=360){return o._Revolve(this._ToPolygons(),i,a)},o.CrossSection.prototype.add=function(i){return this._add(h(i))},o.CrossSection.prototype.subtract=function(i){return this._subtract(h(i))},o.CrossSection.prototype.intersect=function(i){return this._intersect(h(i))},o.CrossSection.prototype.toPolygons=function(){const i=this._ToPolygons(),a=t(i,f=>[f.x,f.y]);return i.delete(),a},o.Manifold.prototype.smoothOut=function(i=60,a=0){return this._SmoothOut(i,a)},o.Manifold.prototype.warp=function(i){const a=le(function(_){const b=V(_,"double"),S=V(_+8,"double"),W=V(_+16,"double"),w=[b,S,W];i(w),Z(_,w[0],"double"),Z(_+8,w[1],"double"),Z(_+16,w[2],"double")},"vi"),f=this._Warp(a);ve(a);const p=f.status();if(p!=="NoError")throw new o.ManifoldError(p);return f},o.Manifold.prototype.calculateNormals=function(i,a=60){return this._CalculateNormals(i,a)},o.Manifold.prototype.setProperties=function(i,a){const f=this.numProp(),p=le(function(b,S,W){const w=[];for(let C=0;C<i;++C)w[C]=V(b+8*C,"double");const ee=[];for(let C=0;C<3;++C)ee[C]=V(S+8*C,"double");const re=[];for(let C=0;C<f;++C)re[C]=V(W+8*C,"double");a(w,ee,re);for(let C=0;C<i;++C)Z(b+8*C,w[C],"double")},"viii"),_=this._SetProperties(i,p);return ve(p),_},o.Manifold.prototype.translate=function(...i){return this._Translate(l(i))},o.Manifold.prototype.rotate=function(i,a,f){return Array.isArray(i)?this._Rotate(...i):this._Rotate(i,a||0,f||0)},o.Manifold.prototype.scale=function(i){return typeof i=="number"?this._Scale({x:i,y:i,z:i}):this._Scale(l([i]))},o.Manifold.prototype.mirror=function(i){return this._Mirror(l([i]))},o.Manifold.prototype.trimByPlane=function(i,a=0){return this._TrimByPlane(l([i]),a)},o.Manifold.prototype.slice=function(i=0){const a=this._Slice(i),f=new d(a,c("Positive"));return s(a),f},o.Manifold.prototype.project=function(){const i=this._Project(),a=new d(i,c("Positive"));return s(i),a},o.Manifold.prototype.split=function(i){const a=this._Split(i),f=r(a);return a.delete(),f},o.Manifold.prototype.splitByPlane=function(i,a=0){const f=this._SplitByPlane(l([i]),a),p=r(f);return f.delete(),p},o.Manifold.prototype.decompose=function(){const i=this._Decompose(),a=r(i);return i.delete(),a},o.Manifold.prototype.boundingBox=function(){const i=this._boundingBox();return{min:["x","y","z"].map(a=>i.min[a]),max:["x","y","z"].map(a=>i.max[a])}};class y{constructor({numProp:a=3,triVerts:f=new Uint32Array,vertProperties:p=new Float32Array,mergeFromVert:_,mergeToVert:b,runIndex:S,runOriginalID:W,faceID:w,halfedgeTangent:ee,runTransform:re}={}){this.numProp=a,this.triVerts=f,this.vertProperties=p,this.mergeFromVert=_,this.mergeToVert=b,this.runIndex=S,this.runOriginalID=W,this.faceID=w,this.halfedgeTangent=ee,this.runTransform=re}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:f}=o._Merge(this);return Object.assign(this,{...f}),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 f=new Array(16);for(const p of[0,1,2,3])for(const _ of[0,1,2])f[4*p+_]=this.runTransform[12*a+3*p+_];return f[15]=1,f}}o.Mesh=y,o.Manifold.prototype.getMesh=function(i=-1){return new y(this._GetMeshJS(i))},o.ManifoldError=function(a,...f){let p="Unknown error";switch(a){case"NonFiniteVertex":p="Non-finite vertex";break;case"NotManifold":p="Not manifold";break;case"VertexOutOfBounds":p="Vertex index out of bounds";break;case"PropertiesWrongLength":p="Properties have wrong length";break;case"MissingPositionProperties":p="Less than three properties";break;case"MergeVectorsDifferentLengths":p="Merge vectors have different lengths";break;case"MergeIndexOutOfBounds":p="Merge index out of bounds";break;case"TransformWrongLength":p="Transform vector has wrong length";break;case"RunIndexWrongLength":p="Run index vector has wrong length";break;case"FaceIDWrongLength":p="Face ID vector has wrong length";case"InvalidConstruction":p="Manifold constructed with invalid parameters"}const _=Error.apply(this,[p,...f]);_.name=this.name="ManifoldError",this.message=_.message,this.stack=_.stack,this.code=a},o.ManifoldError.prototype=Object.create(Error.prototype,{constructor:{value:o.ManifoldError,writable:!0,configurable:!0}}),o.CrossSection=function(i,a="Positive"){const f=n(i),p=new d(f,c(a));return s(f),p},o.CrossSection.ofPolygons=function(i,a="Positive"){return new o.CrossSection(i,a)},o.CrossSection.square=function(...i){let a;i.length==0?a={x:1,y:1}:typeof i[0]=="number"?a={x:i[0],y:i[0]}:a=u(i);const f=i[1]||!1;return o._Square(a,f)},o.CrossSection.circle=function(i,a=0){return o._Circle(i,a)};function g(i){return function(...a){a.length==1&&(a=a[0]);const f=new o.Vector_crossSection;for(const _ of a)f.push_back(h(_));const p=o["_crossSection"+i](f);return f.delete(),p}}o.CrossSection.compose=g("Compose"),o.CrossSection.union=g("UnionN"),o.CrossSection.difference=g("DifferenceN"),o.CrossSection.intersection=g("IntersectionN");function T(i,a){e(i,a,f=>f instanceof Array?{x:f[0],y:f[1]}:f)}o.CrossSection.hull=function(...i){i.length==1&&(i=i[0]);let a=new o.Vector_vec2;for(const p of i)if(p instanceof d)o._crossSectionCollectVertices(a,p);else if(p instanceof Array&&p.length==2&&typeof p[0]=="number")a.push_back({x:p[0],y:p[1]});else if(p.x)a.push_back(p);else{const b=p[0].length==2&&typeof p[0][0]=="number"||p[0].x?[p]:p;for(const S of b)T(a,S)}const f=o._crossSectionHullPoints(a);return a.delete(),f},o.CrossSection.prototype=Object.create(d.prototype),Object.defineProperty(o.CrossSection,Symbol.hasInstance,{get:()=>i=>i instanceof d});const $=o.Manifold;o.Manifold=function(i){const a=new $(i),f=a.status();if(f!=="NoError")throw new o.ManifoldError(f);return a},o.Manifold.ofMesh=function(i){return new o.Manifold(i)},o.Manifold.tetrahedron=function(){return o._Tetrahedron()},o.Manifold.cube=function(...i){let a;i.length==0?a={x:1,y:1,z:1}:typeof i[0]=="number"?a={x:i[0],y:i[0],z:i[0]}:a=l(i);const f=i[1]||!1;return o._Cube(a,f)},o.Manifold.cylinder=function(i,a,f=-1,p=0,_=!1){return o._Cylinder(i,a,f,p,_)},o.Manifold.sphere=function(i,a=0){return o._Sphere(i,a)},o.Manifold.smooth=function(i,a=[]){const f=new o.Vector_smoothness;e(f,a);const p=o._Smooth(i,f);return f.delete(),p},o.Manifold.extrude=function(i,a,f=0,p=0,_=[1,1],b=!1){return(i instanceof d?i:o.CrossSection(i,"Positive")).extrude(a,f,p,_,b)},o.Manifold.revolve=function(i,a=0,f=360){return(i instanceof d?i:o.CrossSection(i,"Positive")).revolve(a,f)},o.Manifold.reserveIDs=function(i){return o._ReserveIDs(i)},o.Manifold.compose=function(i){const a=new o.Vector_manifold;e(a,i);const f=o._manifoldCompose(a);return a.delete(),f};function O(i){return function(...a){a.length==1&&(a=a[0]);const f=new o.Vector_manifold;for(const _ of a)f.push_back(_);const p=o["_manifold"+i+"N"](f);return f.delete(),p}}o.Manifold.union=O("Union"),o.Manifold.difference=O("Difference"),o.Manifold.intersection=O("Intersection"),o.Manifold.levelSet=function(i,a,f,p=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]}},S=le(function(w){const ee=V(w,"double"),re=V(w+8,"double"),C=V(w+16,"double");return i([ee,re,C])},"di"),W=o._LevelSet(S,b,f,p,_);return ve(S),W};function D(i,a){e(i,a,f=>f instanceof Array?{x:f[0],y:f[1],z:f[2]}:f)}o.Manifold.hull=function(...i){i.length==1&&(i=i[0]);let a=new o.Vector_vec3;for(const p of i)p instanceof $?o._manifoldCollectVertices(a,p):p instanceof Array&&p.length==3&&typeof p[0]=="number"?a.push_back({x:p[0],y:p[1],z:p[2]}):p.x?a.push_back(p):D(a,p);const f=o._manifoldHullPoints(a);return a.delete(),f},o.Manifold.prototype=Object.create($.prototype),Object.defineProperty(o.Manifold,Symbol.hasInstance,{get:()=>i=>i instanceof $}),o.triangulate=function(i,a=-1,f=!0){const p=n(i),_=r(o._Triangulate(p,a,f),b=>[b[0],b[1],b[2]]);return s(p),_}};var er=Object.assign({},o),M="";function jr(e){return o.locateFile?o.locateFile(e,M):M+e}var Ve,pe;if(Ee){var rr=Me("fs"),tr=Me("path");M=Me("url").fileURLToPath(new URL("/assets/manifold-B8h_vZ5O.js",import.meta.url)),pe=e=>{e=me(e)?new URL(e):tr.normalize(e);var r=rr.readFileSync(e);return r},Ve=(e,r=!0)=>(e=me(e)?new URL(e):tr.normalize(e),new Promise((t,n)=>{rr.readFile(e,r?void 0:"utf8",(s,u)=>{s?n(s):t(r?u.buffer:u)})})),!o.thisProgram&&process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2)}else(Dr||We)&&(We?M=self.location.href:typeof document<"u"&&document.currentScript&&(M=document.currentScript.src),Ke&&(M=Ke),M.startsWith("blob:")?M="":M=M.substr(0,M.replace(/[?#].*/,"").lastIndexOf("/")+1),We&&(pe=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),Ve=e=>me(e)?new Promise((r,t)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{(n.status==200||n.status==0&&n.response)&&t(n.response),r(n.status)},n.onerror=r,n.send(null)}):fetch(e,{credentials:"same-origin"}).then(r=>r.ok?r.arrayBuffer():Promise.reject(new Error(r.status+" : "+r.url))));o.print||console.log.bind(console);var te=o.printErr||console.error.bind(console);Object.assign(o,er),er=null,o.arguments&&o.arguments,o.thisProgram&&o.thisProgram,o.quit&&o.quit;var ne;o.wasmBinary&&(ne=o.wasmBinary);var he,nr=!1,E,R,H,ie,L,P,ye,_e;function ir(){var e=he.buffer;o.HEAP8=E=new Int8Array(e),o.HEAP16=H=new Int16Array(e),o.HEAPU8=R=new Uint8Array(e),o.HEAPU16=ie=new Uint16Array(e),o.HEAP32=L=new Int32Array(e),o.HEAPU32=P=new Uint32Array(e),o.HEAPF32=ye=new Float32Array(e),o.HEAPF64=_e=new Float64Array(e)}var or=[],sr=[],ar=[];function xr(){if(o.preRun)for(typeof o.preRun=="function"&&(o.preRun=[o.preRun]);o.preRun.length;)Hr(o.preRun.shift());ke(or)}function Ur(){ke(sr)}function Br(){if(o.postRun)for(typeof o.postRun=="function"&&(o.postRun=[o.postRun]);o.postRun.length;)zr(o.postRun.shift());ke(ar)}function Hr(e){or.unshift(e)}function Lr(e){sr.unshift(e)}function zr(e){ar.unshift(e)}var z=0,oe=null;function Nr(e){var r;z++,(r=o.monitorRunDependencies)==null||r.call(o,z)}function qr(e){var t;if(z--,(t=o.monitorRunDependencies)==null||t.call(o,z),z==0&&oe){var r=oe;oe=null,r()}}function J(e){var t;(t=o.onAbort)==null||t.call(o,e),e="Aborted("+e+")",te(e),nr=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw de(r),r}var Gr="data:application/octet-stream;base64,",ur=e=>e.startsWith(Gr),me=e=>e.startsWith("file://");function Jr(){if(o.locateFile){var e="manifold.wasm";return ur(e)?e:jr(e)}return new URL("/assets/manifold-D9yvTBHx.wasm",import.meta.url).href}var ge;function cr(e){if(e==ge&&ne)return new Uint8Array(ne);if(pe)return pe(e);throw"both async and sync fetching of the wasm failed"}function Zr(e){return ne?Promise.resolve().then(()=>cr(e)):Ve(e).then(r=>new Uint8Array(r),()=>cr(e))}function fr(e,r,t){return Zr(e).then(n=>WebAssembly.instantiate(n,r)).then(t,n=>{te(`failed to asynchronously prepare wasm: ${n}`),J(n)})}function Kr(e,r,t,n){return!e&&typeof WebAssembly.instantiateStreaming=="function"&&!ur(r)&&!me(r)&&!Ee&&typeof fetch=="function"?fetch(r,{credentials:"same-origin"}).then(s=>{var u=WebAssembly.instantiateStreaming(s,t);return u.then(n,function(l){return te(`wasm streaming compile failed: ${l}`),te("falling back to ArrayBuffer instantiation"),fr(r,t,n)})}):fr(r,t,n)}function Xr(){return{a:Mn}}function Qr(){var e=Xr();function r(n,s){return I=n.exports,I=Vn(I),he=I.J,ir(),Y=I.M,Lr(I.K),qr(),I}Nr();function t(n){r(n.instance)}if(o.instantiateWasm)try{return o.instantiateWasm(e,r)}catch(n){te(`Module.instantiateWasm callback failed with error: ${n}`),de(n)}return ge||(ge=Jr()),Kr(ne,ge,e,t).catch(de),{}}var ke=e=>{for(;e.length>0;)e.shift()(o)};function V(e,r="i8"){switch(r.endsWith("*")&&(r="*"),r){case"i1":return E[e>>>0];case"i8":return E[e>>>0];case"i16":return H[e>>>1>>>0];case"i32":return L[e>>>2>>>0];case"i64":J("to do getValue(i64) use WASM_BIGINT");case"float":return ye[e>>>2>>>0];case"double":return _e[e>>>3>>>0];case"*":return P[e>>>2>>>0];default:J(`invalid type for getValue: ${r}`)}}o.noExitRuntime;function Z(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":H[e>>>1>>>0]=r;break;case"i32":L[e>>>2>>>0]=r;break;case"i64":J("to do setValue(i64) use WASM_BIGINT");case"float":ye[e>>>2>>>0]=r;break;case"double":_e[e>>>3>>>0]=r;break;case"*":P[e>>>2>>>0]=r;break;default:J(`invalid type for setValue: ${t}`)}}class Yr{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]}get_exception_ptr(){var r=Vr(this.get_type());if(r)return P[this.excPtr>>>2>>>0];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}var lr=0;function et(e,r,t){e>>>=0,r>>>=0,t>>>=0;var n=new Yr(e);throw n.init(r,t),lr=e,lr}var rt=()=>{J("")},be={},Ie=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r)}};function se(e){return this.fromWireType(P[e>>>2>>>0])}var K={},N={},Pe={},vr,$e=e=>{throw new vr(e)},q=(e,r,t)=>{e.forEach(function(c){Pe[c]=r});function n(c){var v=t(c);v.length!==e.length&&$e("Mismatched type converter count");for(var d=0;d<e.length;++d)j(e[d],v[d])}var s=new Array(r.length),u=[],l=0;r.forEach((c,v)=>{N.hasOwnProperty(c)?s[v]=N[c]:(u.push(c),K.hasOwnProperty(c)||(K[c]=[]),K[c].push(()=>{s[v]=N[c],++l,l===u.length&&n(s)}))}),u.length===0&&n(s)},tt=function(e){e>>>=0;var r=be[e];delete be[e];var t=r.rawConstructor,n=r.rawDestructor,s=r.fields,u=s.map(l=>l.getterReturnType).concat(s.map(l=>l.setterArgumentType));q([e],u,l=>{var c={};return s.forEach((v,d)=>{var h=v.fieldName,y=l[d],g=v.getter,T=v.getterContext,$=l[d+s.length],O=v.setter,D=v.setterContext;c[h]={read:i=>y.fromWireType(g(T,i)),write:(i,a)=>{var f=[];O(D,i,$.toWireType(f,a)),Ie(f)}}}),[{name:r.name,fromWireType:v=>{var d={};for(var h in c)d[h]=c[h].read(v);return n(v),d},toWireType:(v,d)=>{for(var h in c)if(!(h in d))throw new TypeError(`Missing field: "${h}"`);var y=t();for(h in c)c[h].write(y,d[h]);return v!==null&&v.push(n,y),y},argPackAdvance:x,readValueFromPointer:se,destructorFunction:n}]})};function nt(e,r,t,n,s){}var it=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);dr=e},dr,F=e=>{for(var r="",t=e;R[t>>>0];)r+=dr[R[t++>>>0]];return r},X,m=e=>{throw new X(e)};function ot(e,r,t={}){var n=r.name;if(e||m(`type "${n}" must have a positive integer typeid pointer`),N.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;m(`Cannot register type '${n}' twice`)}if(N[e]=r,delete Pe[e],K.hasOwnProperty(e)){var s=K[e];delete K[e],s.forEach(u=>u())}}function j(e,r,t={}){if(!("argPackAdvance"in r))throw new TypeError("registerType registeredInstance requires argPackAdvance");return ot(e,r,t)}var x=8;function st(e,r,t,n){e>>>=0,r>>>=0,r=F(r),j(e,{name:r,fromWireType:function(s){return!!s},toWireType:function(s,u){return u?t:n},argPackAdvance:x,readValueFromPointer:function(s){return this.fromWireType(R[s>>>0])},destructorFunction:null})}var at=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Oe=e=>{function r(t){return t.$$.ptrType.registeredClass.name}m(r(e)+" instance already deleted")},De=!1,pr=e=>{},ut=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},hr=e=>{e.count.value-=1;var r=e.count.value===0;r&&ut(e)},yr=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=yr(e,r,t.baseClass);return n===null?null:t.downcast(n)},_r={},ct=()=>Object.keys(ce).length,ft=()=>{var e=[];for(var r in ce)ce.hasOwnProperty(r)&&e.push(ce[r]);return e},ae=[],je=()=>{for(;ae.length;){var e=ae.pop();e.$$.deleteScheduled=!1,e.delete()}},ue,lt=e=>{ue=e,ae.length&&ue&&ue(je)},vt=()=>{o.getInheritedInstanceCount=ct,o.getLiveInheritedInstances=ft,o.flushPendingDeletes=je,o.setDelayFunction=lt},ce={},dt=(e,r)=>{for(r===void 0&&m("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},pt=(e,r)=>(r=dt(e,r),ce[r]),we=(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},fe(Object.create(e,{$$:{value:r,writable:!0}}))};function ht(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=pt(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?we(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):we(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var u=this.registeredClass.getActualType(r),l=_r[u];if(!l)return s.call(this);var c;this.isConst?c=l.constPointerType:c=l.pointerType;var v=yr(r,this.registeredClass,c.registeredClass);return v===null?s.call(this):this.isSmartPointer?we(c.registeredClass.instancePrototype,{ptrType:c,ptr:v,smartPtrType:this,smartPtr:e}):we(c.registeredClass.instancePrototype,{ptrType:c,ptr:v})}var fe=e=>typeof FinalizationRegistry>"u"?(fe=r=>r,e):(De=new FinalizationRegistry(r=>{hr(r.$$)}),fe=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var s={$$:t};De.register(r,s,r)}return r},pr=r=>De.unregister(r),fe(e)),yt=()=>{Object.assign(Ce.prototype,{isAliasOf(e){if(!(this instanceof Ce)||!(e instanceof Ce))return!1;var r=this.$$.ptrType.registeredClass,t=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,s=e.$$.ptr;r.baseClass;)t=r.upcast(t),r=r.baseClass;for(;n.baseClass;)s=n.upcast(s),n=n.baseClass;return r===n&&t===s},clone(){if(this.$$.ptr||Oe(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=fe(Object.create(Object.getPrototypeOf(this),{$$:{value:at(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Oe(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&m("Object already scheduled for deletion"),pr(this),hr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Oe(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&m("Object already scheduled for deletion"),ae.push(this),ae.length===1&&ue&&ue(je),this.$$.deleteScheduled=!0,this}})};function Ce(){}var Q=(e,r)=>Object.defineProperty(r,"name",{value:e}),mr=(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}},xe=(e,r,t)=>{o.hasOwnProperty(e)?((t===void 0||o[e].overloadTable!==void 0&&o[e].overloadTable[t]!==void 0)&&m(`Cannot register public name '${e}' twice`),mr(o,e,e),o.hasOwnProperty(t)&&m(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),o[e].overloadTable[t]=r):(o[e]=r,t!==void 0&&(o[e].numArguments=t))},_t=48,mt=57,gt=e=>{if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=_t&&r<=mt?`_${e}`:e};function bt(e,r,t,n,s,u,l,c){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=s,this.getActualType=u,this.upcast=l,this.downcast=c,this.pureVirtualFunctions=[]}var Ue=(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 Pt(e,r){if(r===null)return this.isReference&&m(`null is not a valid ${this.name}`),0;r.$$||m(`Cannot pass "${Ne(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=Ue(r.$$.ptr,t,this.registeredClass);return n}function $t(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 "${Ne(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=Ue(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 wt(e,r){if(r===null)return this.isReference&&m(`null is not a valid ${this.name}`),0;r.$$||m(`Cannot pass "${Ne(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=Ue(r.$$.ptr,t,this.registeredClass);return n}var Ct=()=>{Object.assign(Te.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){var r;(r=this.rawDestructor)==null||r.call(this,e)},argPackAdvance:x,readValueFromPointer:se,fromWireType:ht})};function Te(e,r,t,n,s,u,l,c,v,d,h){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=s,this.pointeeType=u,this.sharingPolicy=l,this.rawGetPointee=c,this.rawConstructor=v,this.rawShare=d,this.rawDestructor=h,!s&&r.baseClass===void 0?n?(this.toWireType=Pt,this.destructorFunction=null):(this.toWireType=wt,this.destructorFunction=null):this.toWireType=$t}var gr=(e,r,t)=>{o.hasOwnProperty(e)||$e("Replacing nonexistent public symbol"),o[e].overloadTable!==void 0&&t!==void 0?o[e].overloadTable[t]=r:(o[e]=r,o[e].argCount=t)},Tt=(e,r,t)=>{e=e.replace(/p/g,"i");var n=o["dynCall_"+e];return n(r,...t)},Y,Se=e=>Y.get(e),St=(e,r,t=[])=>{if(e.includes("j"))return Tt(e,r,t);var n=Se(r)(...t);return e[0]=="p"?n>>>0:n},br=(e,r)=>(...t)=>St(e,r,t),k=(e,r)=>{e=F(e);function t(){return e.includes("j")||e.includes("p")?br(e,r):Se(r)}var n=t();return typeof n!="function"&&m(`unknown function pointer with signature ${e}: ${r}`),n},At=(e,r)=>{var t=Q(r,function(n){this.name=r,this.message=n;var s=new Error(n).stack;s!==void 0&&(this.stack=this.toString()+`
2
+ `+s.replace(/^Error(:[^\n]*)?\n/,""))});return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},t},Pr,$r=e=>{var r=Mr(e),t=F(r);return B(r),t},Ae=(e,r)=>{var t=[],n={};function s(u){if(!n[u]&&!N[u]){if(Pe[u]){Pe[u].forEach(s);return}t.push(u),n[u]=!0}}throw r.forEach(s),new Pr(`${e}: `+t.map($r).join([", "]))};function Ft(e,r,t,n,s,u,l,c,v,d,h,y,g){e>>>=0,r>>>=0,t>>>=0,n>>>=0,s>>>=0,u>>>=0,l>>>=0,c>>>=0,v>>>=0,d>>>=0,h>>>=0,y>>>=0,g>>>=0,h=F(h),u=k(s,u),c&&(c=k(l,c)),d&&(d=k(v,d)),g=k(y,g);var T=gt(h);xe(T,function(){Ae(`Cannot construct ${h} due to unbound types`,[n])}),q([e,r,t],n?[n]:[],$=>{var S;$=$[0];var O,D;n?(O=$.registeredClass,D=O.instancePrototype):D=Ce.prototype;var i=Q(h,function(...W){if(Object.getPrototypeOf(this)!==a)throw new X("Use 'new' to construct "+h);if(f.constructor_body===void 0)throw new X(h+" has no accessible constructor");var w=f.constructor_body[W.length];if(w===void 0)throw new X(`Tried to invoke ctor of ${h} with invalid number of parameters (${W.length}) - expected (${Object.keys(f.constructor_body).toString()}) parameters instead!`);return w.apply(this,W)}),a=Object.create(D,{constructor:{value:i}});i.prototype=a;var f=new bt(h,i,a,g,O,u,c,d);f.baseClass&&((S=f.baseClass).__derivedClasses??(S.__derivedClasses=[]),f.baseClass.__derivedClasses.push(f));var p=new Te(h,f,!0,!1,!1),_=new Te(h+"*",f,!1,!1,!1),b=new Te(h+" const*",f,!1,!0,!1);return _r[e]={pointerType:_,constPointerType:b},gr(T,i),[p,_,b]})}var Be=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push(P[r+n*4>>>2>>>0]);return t};function wr(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function Cr(e,r){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var t=Q(e.name||"unknownFunctionName",function(){});t.prototype=e.prototype;var n=new t,s=e.apply(n,r);return s instanceof Object?s:n}function Rt(e,r,t,n){for(var s=wr(e),u=e.length,l="",c="",v=0;v<u-2;++v)l+=(v!==0?", ":"")+"arg"+v,c+=(v!==0?", ":"")+"arg"+v+"Wired";var d=`
3
+ return function (${l}) {
4
+ if (arguments.length !== ${u-2}) {
5
+ throwBindingError('function ' + humanName + ' called with ' + arguments.length + ' arguments, expected ${u-2}');
6
+ }`;s&&(d+=`var destructors = [];
7
+ `);var h=s?"destructors":"null",y=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];r&&(d+="var thisWired = classParam['toWireType']("+h+`, this);
8
+ `);for(var v=0;v<u-2;++v)d+="var arg"+v+"Wired = argType"+v+"['toWireType']("+h+", arg"+v+`);
9
+ `,y.push("argType"+v);if(r&&(c="thisWired"+(c.length>0?", ":"")+c),d+=(t||n?"var rv = ":"")+"invoker(fn"+(c.length>0?", ":"")+c+`);
10
+ `,s)d+=`runDestructors(destructors);
11
+ `;else for(var v=r?1:2;v<e.length;++v){var g=v===1?"thisWired":"arg"+(v-2)+"Wired";e[v].destructorFunction!==null&&(d+=`${g}_dtor(${g});
12
+ `,y.push(`${g}_dtor`))}return t&&(d+=`var ret = retType['fromWireType'](rv);
13
+ return ret;
14
+ `),d+=`}
15
+ `,[y,d]}function He(e,r,t,n,s,u){var l=r.length;l<2&&m("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var c=r[1]!==null&&t!==null,v=wr(r),d=r[0].name!=="void",h=[e,m,n,s,Ie,r[0],r[1]],y=0;y<l-2;++y)h.push(r[y+2]);if(!v)for(var y=c?1:2;y<r.length;++y)r[y].destructorFunction!==null&&h.push(r[y].destructorFunction);let[g,T]=Rt(r,c,d,u);g.push(T);var $=Cr(Function,g)(...h);return Q(e,$)}var Wt=function(e,r,t,n,s,u){e>>>=0,t>>>=0,n>>>=0,s>>>=0,u>>>=0;var l=Be(r,t);s=k(n,s),q([],[e],c=>{c=c[0];var v=`constructor ${c.name}`;if(c.registeredClass.constructor_body===void 0&&(c.registeredClass.constructor_body=[]),c.registeredClass.constructor_body[r-1]!==void 0)throw new X(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${c.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return c.registeredClass.constructor_body[r-1]=()=>{Ae(`Cannot construct ${c.name} due to unbound types`,l)},q([],l,d=>(d.splice(1,0,null),c.registeredClass.constructor_body[r-1]=He(v,d,null,s,u),[])),[]})},Tr=e=>{e=e.trim();const r=e.indexOf("(");return r!==-1?e.substr(0,r):e},Et=function(e,r,t,n,s,u,l,c,v){e>>>=0,r>>>=0,n>>>=0,s>>>=0,u>>>=0,l>>>=0;var d=Be(t,n);r=F(r),r=Tr(r),u=k(s,u),q([],[e],h=>{h=h[0];var y=`${h.name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),c&&h.registeredClass.pureVirtualFunctions.push(r);function g(){Ae(`Cannot call ${y} due to unbound types`,d)}var T=h.registeredClass.instancePrototype,$=T[r];return $===void 0||$.overloadTable===void 0&&$.className!==h.name&&$.argCount===t-2?(g.argCount=t-2,g.className=h.name,T[r]=g):(mr(T,r,y),T[r].overloadTable[t-2]=g),q([],d,O=>{var D=He(y,O,h,u,l,v);return T[r].overloadTable===void 0?(D.argCount=t-2,T[r]=D):T[r].overloadTable[t-2]=D,[]}),[]})},Le=[],U=[];function ze(e){e>>>=0,e>9&&--U[e+1]===0&&(U[e]=void 0,Le.push(e))}var Mt=()=>U.length/2-5-Le.length,Vt=()=>{U.push(0,1,void 0,1,null,1,!0,1,!1,1),o.count_emval_handles=Mt},A={toValue:e=>(e||m("Cannot use deleted val. handle = "+e),U[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const r=Le.pop()||U.length;return U[r]=e,U[r+1]=1,r}}}},kt={name:"emscripten::val",fromWireType:e=>{var r=A.toValue(e);return ze(e),r},toWireType:(e,r)=>A.toHandle(r),argPackAdvance:x,readValueFromPointer:se,destructorFunction:null};function Sr(e){return e>>>=0,j(e,kt)}var It=(e,r,t)=>{switch(r){case 1:return t?function(n){return this.fromWireType(E[n>>>0])}:function(n){return this.fromWireType(R[n>>>0])};case 2:return t?function(n){return this.fromWireType(H[n>>>1>>>0])}:function(n){return this.fromWireType(ie[n>>>1>>>0])};case 4:return t?function(n){return this.fromWireType(L[n>>>2>>>0])}:function(n){return this.fromWireType(P[n>>>2>>>0])};default:throw new TypeError(`invalid integer width (${r}): ${e}`)}};function Ot(e,r,t,n){e>>>=0,r>>>=0,t>>>=0,r=F(r);function s(){}s.values={},j(e,{name:r,constructor:s,fromWireType:function(u){return this.constructor.values[u]},toWireType:(u,l)=>l.value,argPackAdvance:x,readValueFromPointer:It(r,t,n),destructorFunction:null}),xe(r,s)}var Fe=(e,r)=>{var t=N[e];return t===void 0&&m(`${r} has unknown type ${$r(e)}`),t};function Dt(e,r,t){e>>>=0,r>>>=0;var n=Fe(e,"enum");r=F(r);var s=n.constructor,u=Object.create(n.constructor.prototype,{value:{value:t},constructor:{value:Q(`${n.name}_${r}`,function(){})}});s.values[t]=u,s[r]=u}var Ne=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},jt=(e,r)=>{switch(r){case 4:return function(t){return this.fromWireType(ye[t>>>2>>>0])};case 8:return function(t){return this.fromWireType(_e[t>>>3>>>0])};default:throw new TypeError(`invalid float width (${r}): ${e}`)}},xt=function(e,r,t){e>>>=0,r>>>=0,t>>>=0,r=F(r),j(e,{name:r,fromWireType:n=>n,toWireType:(n,s)=>s,argPackAdvance:x,readValueFromPointer:jt(r,t),destructorFunction:null})};function Ut(e,r,t,n,s,u,l){e>>>=0,t>>>=0,n>>>=0,s>>>=0,u>>>=0;var c=Be(r,t);e=F(e),e=Tr(e),s=k(n,s),xe(e,function(){Ae(`Cannot call ${e} due to unbound types`,c)},r-1),q([],c,v=>{var d=[v[0],null].concat(v.slice(1));return gr(e,He(e,d,null,s,u,l),r-1),[]})}var Bt=(e,r,t)=>{switch(r){case 1:return t?n=>E[n>>>0]:n=>R[n>>>0];case 2:return t?n=>H[n>>>1>>>0]:n=>ie[n>>>1>>>0];case 4:return t?n=>L[n>>>2>>>0]:n=>P[n>>>2>>>0];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}};function Ht(e,r,t,n,s){e>>>=0,r>>>=0,t>>>=0,r=F(r);var u=h=>h;if(n===0){var l=32-8*t;u=h=>h<<l>>>l}var c=r.includes("unsigned"),v=(h,y)=>{},d;c?d=function(h,y){return v(y,this.name),y>>>0}:d=function(h,y){return v(y,this.name),y},j(e,{name:r,fromWireType:u,toWireType:d,argPackAdvance:x,readValueFromPointer:Bt(r,t,n!==0),destructorFunction:null})}function Lt(e,r,t){e>>>=0,t>>>=0;var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],s=n[r];function u(l){var c=P[l>>>2>>>0],v=P[l+4>>>2>>>0];return new s(E.buffer,v,c)}t=F(t),j(e,{name:t,fromWireType:u,argPackAdvance:x,readValueFromPointer:u},{ignoreDuplicateRegistrations:!0})}function zt(e,r){e>>>=0,Sr(e)}var Nt=(e,r,t,n)=>{if(t>>>=0,!(n>0))return 0;for(var s=t,u=t+n-1,l=0;l<e.length;++l){var c=e.charCodeAt(l);if(c>=55296&&c<=57343){var v=e.charCodeAt(++l);c=65536+((c&1023)<<10)|v&1023}if(c<=127){if(t>=u)break;r[t++>>>0]=c}else if(c<=2047){if(t+1>=u)break;r[t++>>>0]=192|c>>6,r[t++>>>0]=128|c&63}else if(c<=65535){if(t+2>=u)break;r[t++>>>0]=224|c>>12,r[t++>>>0]=128|c>>6&63,r[t++>>>0]=128|c&63}else{if(t+3>=u)break;r[t++>>>0]=240|c>>18,r[t++>>>0]=128|c>>12&63,r[t++>>>0]=128|c>>6&63,r[t++>>>0]=128|c&63}}return r[t>>>0]=0,t-s},qt=(e,r,t)=>Nt(e,R,r,t),Gt=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n<=127?r++:n<=2047?r+=2:n>=55296&&n<=57343?(r+=4,++t):r+=3}return r},Ar=typeof TextDecoder<"u"?new TextDecoder:void 0,Jt=(e,r,t)=>{r>>>=0;for(var n=r+t,s=r;e[s]&&!(s>=n);)++s;if(s-r>16&&e.buffer&&Ar)return Ar.decode(e.subarray(r,s));for(var u="";r<s;){var l=e[r++];if(!(l&128)){u+=String.fromCharCode(l);continue}var c=e[r++]&63;if((l&224)==192){u+=String.fromCharCode((l&31)<<6|c);continue}var v=e[r++]&63;if((l&240)==224?l=(l&15)<<12|c<<6|v:l=(l&7)<<18|c<<12|v<<6|e[r++]&63,l<65536)u+=String.fromCharCode(l);else{var d=l-65536;u+=String.fromCharCode(55296|d>>10,56320|d&1023)}}return u},Zt=(e,r)=>(e>>>=0,e?Jt(R,e,r):"");function Kt(e,r){e>>>=0,r>>>=0,r=F(r);var t=r==="std::string";j(e,{name:r,fromWireType(n){var s=P[n>>>2>>>0],u=n+4,l;if(t)for(var c=u,v=0;v<=s;++v){var d=u+v;if(v==s||R[d>>>0]==0){var h=d-c,y=Zt(c,h);l===void 0?l=y:(l+="\0",l+=y),c=d+1}}else{for(var g=new Array(s),v=0;v<s;++v)g[v]=String.fromCharCode(R[u+v>>>0]);l=g.join("")}return B(n),l},toWireType(n,s){s instanceof ArrayBuffer&&(s=new Uint8Array(s));var u,l=typeof s=="string";l||s instanceof Uint8Array||s instanceof Uint8ClampedArray||s instanceof Int8Array||m("Cannot pass non-string to std::string"),t&&l?u=Gt(s):u=s.length;var c=Ze(4+u+1),v=c+4;if(P[c>>>2>>>0]=u,t&&l)qt(s,v,u+1);else if(l)for(var d=0;d<u;++d){var h=s.charCodeAt(d);h>255&&(B(v),m("String has UTF-16 code units that do not fit in 8 bits")),R[v+d>>>0]=h}else for(var d=0;d<u;++d)R[v+d>>>0]=s[d];return n!==null&&n.push(B,c),c},argPackAdvance:x,readValueFromPointer:se,destructorFunction(n){B(n)}})}var Fr=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,Xt=(e,r)=>{for(var t=e,n=t>>1,s=n+r/2;!(n>=s)&&ie[n>>>0];)++n;if(t=n<<1,t-e>32&&Fr)return Fr.decode(R.subarray(e>>>0,t>>>0));for(var u="",l=0;!(l>=r/2);++l){var c=H[e+l*2>>>1>>>0];if(c==0)break;u+=String.fromCharCode(c)}return u},Qt=(e,r,t)=>{if(t??(t=2147483647),t<2)return 0;t-=2;for(var n=r,s=t<e.length*2?t/2:e.length,u=0;u<s;++u){var l=e.charCodeAt(u);H[r>>>1>>>0]=l,r+=2}return H[r>>>1>>>0]=0,r-n},Yt=e=>e.length*2,en=(e,r)=>{for(var t=0,n="";!(t>=r/4);){var s=L[e+t*4>>>2>>>0];if(s==0)break;if(++t,s>=65536){var u=s-65536;n+=String.fromCharCode(55296|u>>10,56320|u&1023)}else n+=String.fromCharCode(s)}return n},rn=(e,r,t)=>{if(r>>>=0,t??(t=2147483647),t<4)return 0;for(var n=r,s=n+t-4,u=0;u<e.length;++u){var l=e.charCodeAt(u);if(l>=55296&&l<=57343){var c=e.charCodeAt(++u);l=65536+((l&1023)<<10)|c&1023}if(L[r>>>2>>>0]=l,r+=4,r+4>s)break}return L[r>>>2>>>0]=0,r-n},tn=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n>=55296&&n<=57343&&++t,r+=4}return r},nn=function(e,r,t){e>>>=0,r>>>=0,t>>>=0,t=F(t);var n,s,u,l;r===2?(n=Xt,s=Qt,l=Yt,u=c=>ie[c>>>1>>>0]):r===4&&(n=en,s=rn,l=tn,u=c=>P[c>>>2>>>0]),j(e,{name:t,fromWireType:c=>{for(var v=P[c>>>2>>>0],d,h=c+4,y=0;y<=v;++y){var g=c+4+y*r;if(y==v||u(g)==0){var T=g-h,$=n(h,T);d===void 0?d=$:(d+="\0",d+=$),h=g+r}}return B(c),d},toWireType:(c,v)=>{typeof v!="string"&&m(`Cannot pass non-string to C++ string type ${t}`);var d=l(v),h=Ze(4+d+r);return P[h>>>2>>>0]=d/r,s(v,h+4,d+r),c!==null&&c.push(B,h),h},argPackAdvance:x,readValueFromPointer:se,destructorFunction(c){B(c)}})};function on(e,r,t,n,s,u){e>>>=0,r>>>=0,t>>>=0,n>>>=0,s>>>=0,u>>>=0,be[e]={name:F(r),rawConstructor:k(t,n),rawDestructor:k(s,u),fields:[]}}function sn(e,r,t,n,s,u,l,c,v,d){e>>>=0,r>>>=0,t>>>=0,n>>>=0,s>>>=0,u>>>=0,l>>>=0,c>>>=0,v>>>=0,d>>>=0,be[e].fields.push({fieldName:F(r),getterReturnType:t,getter:k(n,s),getterContext:u,setterArgumentType:l,setter:k(c,v),setterContext:d})}var an=function(e,r){e>>>=0,r>>>=0,r=F(r),j(e,{isVoid:!0,name:r,argPackAdvance:0,fromWireType:()=>{},toWireType:(t,n)=>{}})};function un(e,r,t){return e>>>=0,r>>>=0,t>>>=0,R.copyWithin(e>>>0,r>>>0,r+t>>>0)}var Rr=(e,r,t)=>{var n=[],s=e.toWireType(n,t);return n.length&&(P[r>>>2>>>0]=A.toHandle(n)),s};function cn(e,r,t){return e>>>=0,r>>>=0,t>>>=0,e=A.toValue(e),r=Fe(r,"emval::as"),Rr(r,t,e)}var fn={},Wr=e=>{var r=fn[e];return r===void 0?F(e):r},qe=[];function ln(e,r,t,n,s){return e>>>=0,r>>>=0,t>>>=0,n>>>=0,s>>>=0,e=qe[e],r=A.toValue(r),t=Wr(t),e(r,r[t],n,s)}function vn(e,r){return e>>>=0,r>>>=0,e=A.toValue(e),r=A.toValue(r),e==r}var dn=e=>{var r=qe.length;return qe.push(e),r},pn=(e,r)=>{for(var t=new Array(e),n=0;n<e;++n)t[n]=Fe(P[r+n*4>>>2>>>0],"parameter "+n);return t};function hn(e,r,t){r>>>=0;var n=pn(e,r),s=n.shift();e--;var u=`return function (obj, func, destructorsRef, args) {
16
+ `,l=0,c=[];t===0&&c.push("obj");for(var v=["retType"],d=[s],h=0;h<e;++h)c.push("arg"+h),v.push("argType"+h),d.push(n[h]),u+=` var arg${h} = argType${h}.readValueFromPointer(args${l?"+"+l:""});
17
+ `,l+=n[h].argPackAdvance;var y=t===1?"new func":"func.call";u+=` var rv = ${y}(${c.join(", ")});
18
+ `,s.isVoid||(v.push("emval_returnValue"),d.push(Rr),u+=` return emval_returnValue(retType, destructorsRef, rv);
19
+ `),u+=`};
20
+ `,v.push(u);var g=Cr(Function,v)(...d),T=`methodCaller<(${n.map($=>$.name).join(", ")}) => ${s.name}>`;return dn(Q(T,g))}function yn(e,r){return e>>>=0,r>>>=0,e=A.toValue(e),r=A.toValue(r),A.toHandle(e[r])}function _n(e){e>>>=0,e>9&&(U[e+1]+=1)}function mn(e){return e>>>=0,A.toHandle(Wr(e))}function gn(){return A.toHandle({})}function bn(e){e>>>=0;var r=A.toValue(e);Ie(r),ze(e)}function Pn(e,r,t){e>>>=0,r>>>=0,t>>>=0,e=A.toValue(e),r=A.toValue(r),t=A.toValue(t),e[r]=t}function $n(e,r){e>>>=0,r>>>=0,e=Fe(e,"_emval_take_value");var t=e.readValueFromPointer(r);return A.toHandle(t)}var wn=()=>4294901760,Cn=e=>{var r=he.buffer,t=(e-r.byteLength+65535)/65536;try{return he.grow(t),ir(),1}catch{}};function Tn(e){e>>>=0;var r=R.length,t=wn();if(e>t)return!1;for(var n=(v,d)=>v+(d-v%d)%d,s=1;s<=4;s*=2){var u=r*(1+.2/s);u=Math.min(u,e+100663296);var l=Math.min(t,n(Math.max(e,u),65536)),c=Cn(l);if(c)return!0}return!1}var Er=(e,r)=>{e<128?r.push(e):r.push(e%128|128,e>>7)},Sn=e=>{for(var r={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"},t={parameters:[],results:e[0]=="v"?[]:[r[e[0]]]},n=1;n<e.length;++n)t.parameters.push(r[e[n]]);return t},An=(e,r)=>{var t=e.slice(0,1),n=e.slice(1),s={i:127,p:127,j:126,f:125,d:124,e:111};r.push(96),Er(n.length,r);for(var u=0;u<n.length;++u)r.push(s[n[u]]);t=="v"?r.push(0):r.push(1,s[t])},Fn=(e,r)=>{if(typeof WebAssembly.Function=="function")return new WebAssembly.Function(Sn(r),e);var t=[1];An(r,t);var n=[0,97,115,109,1,0,0,0,1];Er(t.length,n),n.push(...t),n.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var s=new WebAssembly.Module(new Uint8Array(n)),u=new WebAssembly.Instance(s,{e:{f:e}}),l=u.exports.f;return l},Rn=(e,r)=>{if(G)for(var t=e;t<e+r;t++){var n=Se(t);n&&G.set(n,t)}},G,Wn=e=>(G||(G=new WeakMap,Rn(0,Y.length)),G.get(e)||0),Ge=[],En=()=>{if(Ge.length)return Ge.pop();try{Y.grow(1)}catch(e){throw e instanceof RangeError?"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.":e}return Y.length-1},Je=(e,r)=>Y.set(e,r),le=(e,r)=>{var t=Wn(e);if(t)return t;var n=En();try{Je(n,e)}catch(u){if(!(u instanceof TypeError))throw u;var s=Fn(e,r);Je(n,s)}return G.set(e,n),n},ve=e=>{G.delete(Se(e)),Je(e,null),Ge.push(e)};vr=o.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},it(),X=o.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},yt(),vt(),Ct(),Pr=o.UnboundTypeError=At(Error,"UnboundTypeError"),Vt();var Mn={i:et,D:rt,n:tt,C:nt,H:st,h:Ft,g:Wt,a:Et,G:Sr,t:Ot,e:Dt,x:xt,c:Ut,j:Ht,f:Lt,k:zt,w:Kt,s:nn,o:on,l:sn,I:an,F:un,v:cn,z:ln,b:ze,m:vn,y:hn,B:yn,u:_n,q:mn,A:gn,p:bn,r:Pn,d:$n,E:Tn},I=Qr(),Mr=e=>(Mr=I.L)(e),Ze=e=>(Ze=I.N)(e),B=e=>(B=I.O)(e),Vr=e=>(Vr=I.P)(e);function Vn(e){e=Object.assign({},e);var r=n=>s=>n(s)>>>0,t=n=>()=>n()>>>0;return e.L=r(e.L),e.N=r(e.N),e._emscripten_stack_alloc=r(e._emscripten_stack_alloc),e.emscripten_stack_get_current=t(e.emscripten_stack_get_current),e}o.addFunction=le,o.removeFunction=ve;var Re;oe=function e(){Re||kr(),Re||(oe=e)};function kr(){if(z>0||(xr(),z>0))return;function e(){var r;Re||(Re=!0,o.calledRun=!0,!nr&&(Ur(),Qe(o),(r=o.onRuntimeInitialized)==null||r.call(o),Br()))}o.setStatus?(o.setStatus("Running..."),setTimeout(function(){setTimeout(function(){o.setStatus("")},1),e()},1)):e()}if(o.preInit)for(typeof o.preInit=="function"&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.pop()();return kr(),Xe=Or,Xe})})();export{Dn as default};