// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define(["exports","./_commonjsHelpers"],function(ra,S){var B={exports:{}};(function(C,D){D=(()=>{var w="undefined"!==typeof document&&document.currentScript?document.currentScript.src:void 0;return function(q={}){function r(a){return b.locateFile?b.locateFile(a,n):n+a}function x(){var a=K.buffer;b.HEAP8=new Int8Array(a);b.HEAP16=new Int16Array(a);b.HEAPU8=L=new Uint8Array(a);b.HEAPU16=new Uint16Array(a);b.HEAP32=new Int32Array(a);b.HEAPU32=M=new Uint32Array(a);b.HEAPF32=new Float32Array(a);b.HEAPF64= new Float64Array(a)}function Z(a){b.onAbort?.(a);a="Aborted("+a+")";y(a);aa=!0;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");N(a);throw a;}function ba(a){if(a==E&&F)return new Uint8Array(F);if(T)return T(a);throw"both async and sync fetching of the wasm failed";}function sa(a){return F||!ca&&!O||"function"!=typeof fetch?Promise.resolve().then(()=>ba(a)):fetch(a,{credentials:"same-origin"}).then(c=>{if(!c.ok)throw"failed to load wasm binary file at '"+a+"'";return c.arrayBuffer()}).catch(()=> ba(a))}function da(a,c,e){return sa(a).then(d=>WebAssembly.instantiate(d,c)).then(d=>d).then(e,d=>{y(`failed to asynchronously prepare wasm: ${d}`);Z(d)})}function ta(a,c,e,d){return a||"function"!=typeof WebAssembly.instantiateStreaming||c.startsWith("data:application/octet-stream;base64,")||"function"!=typeof fetch?da(c,e,d):fetch(c,{credentials:"same-origin"}).then(f=>WebAssembly.instantiateStreaming(f,e).then(d,function(g){y(`wasm streaming compile failed: ${g}`);y("falling back to ArrayBuffer instantiation"); return da(c,e,d)}))}function ea(){function a(){if(!P&&(P=!0,b.calledRun=!0,!aa)){U(fa);ha(b);if(b.onRuntimeInitialized)b.onRuntimeInitialized();if(b.postRun)for("function"==typeof b.postRun&&(b.postRun=[b.postRun]);b.postRun.length;)ia.unshift(b.postRun.shift());U(ia)}}if(!(0{ha=a;N=c});var ka=Object.assign({},b),ca="object"==typeof window,O="function"==typeof importScripts;"object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;var n="",T;if(ca||O)O?n=self.location.href:"undefined"!=typeof document&&document.currentScript&&(n=document.currentScript.src),w&&(n=w),n=0!==n.indexOf("blob:")?n.substr(0,n.replace(/[?#].*/,"").lastIndexOf("/")+1):"",O&&(T=a=>{var c=new XMLHttpRequest; c.open("GET",a,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)});var ua=b.print||console.log.bind(console),y=b.printErr||console.error.bind(console);Object.assign(b,ka);ka=null;b.arguments&&b.arguments;b.thisProgram&&b.thisProgram;b.quit&&b.quit;var F;b.wasmBinary&&(F=b.wasmBinary);"object"!=typeof WebAssembly&&Z("no native wasm support detected");var K,aa=!1,L,M,ja=[],fa=[],ia=[],t=0,G=null;var E="libtess.wasm";E.startsWith("data:application/octet-stream;base64,")|| (E=r(E));var U=a=>{for(;0{var c=Q[a];c||(a>=Q.length&&(Q.length=a+1),Q[a]=c=ma.get(a));return c},wa={e:()=>{throw Infinity;},g:(a,c,e)=>L.copyWithin(a,c,c+e),f:a=>{var c=L.length;a>>>=0;if(2147483648=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,a+100663296);var f=Math;d=Math.max(a,d);a:{f=(f.min.call(f,2147483648,d+(65536-d%65536)%65536)- K.buffer.byteLength+65535)/65536;try{K.grow(f);x();var g=1;break a}catch(l){}g=void 0}if(g)return!0}return!1},c:(a,c,e,d)=>{for(var f=0,g=0;g>2],na=M[c+4>>2];c+=8;for(var V=0;V=u);)++z;if(16k?u+=String.fromCharCode(k):(k-=65536,u+=String.fromCharCode(55296|k>>10,56320|k&1023))}}else u+=String.fromCharCode(k)}h=u}(1===a?ua:y)(h);W.length=0}else W.push(h)}f+=na}M[d>>2]=f;return 0},b:function(a,c){var e=H();try{return R(a)(c)}catch(d){I(e);if(d!==d+0)throw d;J(1,0)}},h:function(a,c,e,d){var f=H();try{return R(a)(c,e,d)}catch(g){I(f);if(g!==g+0)throw g;J(1,0)}},d:function(a,c){var e=H();try{R(a)(c)}catch(d){I(e);if(d!==d+0)throw d;J(1,0)}}, a:function(a,c,e){var d=H();try{R(a)(c,e)}catch(f){I(d);if(f!==f+0)throw f;J(1,0)}}},m=function(){function a(e,d){m=e.exports;K=m.i;x();ma=m.m;fa.unshift(m.j);t--;b.monitorRunDependencies?.(t);0==t&&G&&(e=G,G=null,e());return m}var c={a:wa};t++;b.monitorRunDependencies?.(t);if(b.instantiateWasm)try{return b.instantiateWasm(c,a)}catch(e){y(`Module.instantiateWasm callback failed with error: ${e}`),N(e)}ta(F,E,c,function(e){a(e.instance)}).catch(N);return{}}();b._malloc=a=>(b._malloc=m.k)(a);b._free= a=>(b._free=m.l)(a);b._triangulate=(a,c,e,d,f,g)=>(b._triangulate=m.n)(a,c,e,d,f,g);var J=(a,c)=>(J=m.o)(a,c),H=()=>(H=m.p)(),I=a=>(I=m.q)(a),P;G=function c(){P||ea();P||(G=c)};if(b.preInit)for("function"==typeof b.preInit&&(b.preInit=[b.preInit]);0{pa||=b._triangulate;var f=b.HEAPF32;const g=b.HEAP32.BYTES_PER_ELEMENT;var l=f.BYTES_PER_ELEMENT;d>qa&&(qa=d,A&&(b._free(A),A=0),v&&(b._free(v),v=0)); A||=b._malloc(d*l);Y||=b._malloc(4E3*g);d*=2;v||=b._malloc(d*l);f=b.HEAPF32;f.set(c,A/l);b.HEAP32.set(e,Y/g);c=pa(A,Y,Math.min(e.length,4E3),2,v,d/2);f=b.HEAPF32;f=f.slice(v/l,v/l+2*c);l={};l.buffer=f;l.vertexCount=c;return l};return q.ready}})();C.exports=D})(B);B=B.exports;S=function(C,D){for(var w=0;wq[r]})}}return Object.freeze(Object.defineProperty(C,Symbol.toStringTag,{value:"Module"}))}({__proto__:null,default:S.getDefaultExportFromCjs(B)},[B]);ra.libtess=S});