function S(e){let n,t;try{const a=b(e,i.__wbindgen_malloc,i.__wbindgen_realloc),c=l,o=i.chgcar_to_cube(a,c);var r=o[0],s=o[1];if(o[3])throw r=0,s=0,x(o[2]);return n=r,t=s,p(r,s)}finally{i.__wbindgen_free(n,t,1)}}function I(e,n,t){let r,s;try{const o=b(e,i.__wbindgen_malloc,i.__wbindgen_realloc),f=l,E=b(n,i.__wbindgen_malloc,i.__wbindgen_realloc),M=l,R=b(t,i.__wbindgen_malloc,i.__wbindgen_realloc),T=l,w=i.compute_chgdiff(o,f,E,M,R,T);var a=w[0],c=w[1];if(w[3])throw a=0,c=0,x(w[2]);return r=a,s=c,p(a,c)}finally{i.__wbindgen_free(r,s,1)}}function j(){i.wasm_init()}function A(){return{__proto__:null,"./chgdiff_wasm_bg.js":{__proto__:null,__wbg_Error_bce6d499ff0a4aff:function(n,t){return Error(p(n,t))},__wbg_error_a6fa202b58aa1cd3:function(n,t){let r,s;try{r=n,s=t,console.error(p(n,t))}finally{i.__wbindgen_free(r,s,1)}},__wbg_new_227d7c05414eb861:function(){return new Error},__wbg_stack_3b0d974bbf31e44f:function(n,t){const r=t.stack,s=b(r,i.__wbindgen_malloc,i.__wbindgen_realloc),a=l;h().setInt32(n+4,a,!0),h().setInt32(n+0,s,!0)},__wbindgen_init_externref_table:function(){const n=i.__wbindgen_externrefs,t=n.grow(4);n.set(0,void 0),n.set(t+0,void 0),n.set(t+1,null),n.set(t+2,!0),n.set(t+3,!1)}}}}let _=null;function h(){return(_===null||_.buffer.detached===!0||_.buffer.detached===void 0&&_.buffer!==i.memory.buffer)&&(_=new DataView(i.memory.buffer)),_}function p(e,n){return v(e>>>0,n)}let u=null;function g(){return(u===null||u.byteLength===0)&&(u=new Uint8Array(i.memory.buffer)),u}function b(e,n,t){if(t===void 0){const o=d.encode(e),f=n(o.length,1)>>>0;return g().subarray(f,f+o.length).set(o),l=o.length,f}let r=e.length,s=n(r,1)>>>0;const a=g();let c=0;for(;c<r;c++){const o=e.charCodeAt(c);if(o>127)break;a[s+c]=o}if(c!==r){c!==0&&(e=e.slice(c)),s=t(s,r,r=c+e.length*3,1)>>>0;const o=g().subarray(s+c,s+r),f=d.encodeInto(e,o);c+=f.written,s=t(s,r,c,1)>>>0}return l=c,s}function x(e){const n=i.__wbindgen_externrefs.get(e);return i.__externref_table_dealloc(e),n}let y=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});y.decode();const O=2146435072;let m=0;function v(e,n){return m+=n,m>=O&&(y=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),y.decode(),m=n),y.decode(g().subarray(e,e+n))}const d=new TextEncoder;"encodeInto"in d||(d.encodeInto=function(e,n){const t=d.encode(e);return n.set(t),{read:e.length,written:t.length}});let l=0,i;function W(e,n){return i=e.exports,_=null,u=null,i.__wbindgen_start(),i}async function D(e,n){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,n)}catch(s){if(e.ok&&t(e.type)&&e.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",s);else throw s}const r=await e.arrayBuffer();return await WebAssembly.instantiate(r,n)}else{const r=await WebAssembly.instantiate(e,n);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}function t(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}function k(e){if(i!==void 0)return i;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const n=A();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));const t=new WebAssembly.Instance(e,n);return W(t)}async function B(e){if(i!==void 0)return i;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),e===void 0&&(e=new URL("/assets/chgdiff_wasm_bg-B_pZaDa_.wasm",import.meta.url));const n=A();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:t,module:r}=await D(await e,n);return W(t)}export{S as chgcar_to_cube,I as compute_chgdiff,B as default,k as initSync,j as wasm_init};
