@tensorix/metahub 0.5.0 → 0.5.1

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.
@@ -1 +1 @@
1
- function $e(f){dr=()=>f.wasm;var b=[],F="./this.program",O=(e,r)=>{throw r},Ir="";function Se(e){if(f.locateFile)return f.locateFile(e,Ir);return Ir+e}var xn,dr,Lr=console.log.bind(console),gr=console.error.bind(console),hr,Q=!1,N;function zn(e,r){if(!e)zr(r)}var W,S,L,H,_,h,Hr,Vr,M,Br,Re=!1;function xr(){var e=lr.buffer;W=new Int8Array(e),L=new Int16Array(e),S=new Uint8Array(e),H=new Uint16Array(e),_=new Int32Array(e),h=new Uint32Array(e),Hr=new Float32Array(e),Vr=new Float64Array(e),M=new BigInt64Array(e),Br=new BigUint64Array(e)}function Ee(){if(f.preRun){if(typeof f.preRun=="function")f.preRun=[f.preRun];while(f.preRun.length)He(f.preRun.shift())}Yr(Gr)}function We(){Re=!0,ur.aa()}function ke(){if(f.postRun){if(typeof f.postRun=="function")f.postRun=[f.postRun];while(f.postRun.length)Le(f.postRun.shift())}Yr(qr)}function zr(e){f.onAbort?.(e),e="Aborted("+e+")",gr(e),Q=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw r}var _r;function Ue(){return Se("clang-format-esm.wasm")}function De(e){if(e==_r&&hr)return new Uint8Array(hr);if(dr)return dr(e);throw'sync fetching of the wasm failed: you can preload it to Module["wasmBinary"] manually, or emcc.py will do that for you when generating HTML (but not JS)'}function je(e,r){var t,n=De(e);if(t=n,!(t instanceof WebAssembly.Module))t=new WebAssembly.Module(t);var i=new WebAssembly.Instance(t,r);return[i,t]}function Oe(){var e={a:On};return e}function Ie(){function e(n,i){return ur=n.exports,jn(ur),xr(),ur}var r=Oe();if(f.instantiateWasm)return new Promise((n,i)=>{f.instantiateWasm(r,(a,s)=>{n(e(a,s))})});_r??=Ue();var t=je(_r,r);return e(t[0])}class yr{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var Yr=(e)=>{while(e.length>0)e.shift()(f)},qr=[],Le=(e)=>qr.push(e),Gr=[],He=(e)=>Gr.push(e),mr=!0,Jr=(e)=>we.get(e),Ve=(e,r)=>Jr(e)(r);class Kr{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){h[this.ptr+4>>2]=e}get_type(){return h[this.ptr+4>>2]}set_destructor(e){h[this.ptr+8>>2]=e}get_destructor(){return h[this.ptr+8>>2]}set_caught(e){e=e?1:0,W[this.ptr+12]=e}get_caught(){return W[this.ptr+12]!=0}set_rethrown(e){e=e?1:0,W[this.ptr+13]=e}get_rethrown(){return W[this.ptr+13]!=0}init(e,r){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(r)}set_adjusted_ptr(e){h[this.ptr+16>>2]=e}get_adjusted_ptr(){return h[this.ptr+16>>2]}}var Xr=0,Be=0,xe=(e,r,t)=>{var n=new Kr(e);throw n.init(r,t),Xr=e,Be++,Xr},ze=(e)=>{},Ye=(e,r,t,n)=>{},qe=(e,r)=>{},Ge=(e,r)=>{},Je=(e,r,t)=>{},Ke=(e,r)=>{},Xe=(e,r,t,n)=>{},Zr=globalThis.TextDecoder&&new TextDecoder,Qr=(e,r,t,n)=>{var i=r+t;if(n)return i;while(e[r]&&!(r>=i))++r;return r},Nr=(e,r=0,t,n)=>{var i=Qr(e,r,t,n);if(i-r>16&&e.buffer&&Zr)return Zr.decode(e.subarray(r,i));var a="";while(r<i){var s=e[r++];if(!(s&128)){a+=String.fromCharCode(s);continue}var o=e[r++]&63;if((s&224)==192){a+=String.fromCharCode((s&31)<<6|o);continue}var l=e[r++]&63;if((s&240)==224)s=(s&15)<<12|o<<6|l;else s=(s&7)<<18|o<<12|l<<6|e[r++]&63;if(s<65536)a+=String.fromCharCode(s);else{var u=s-65536;a+=String.fromCharCode(55296|u>>10,56320|u&1023)}}return a},Mr=(e,r,t)=>e?Nr(S,e,r,t):"",Ze={varargs:void 0,getStr(e){var r=Mr(e);return r}};function Qe(e,r,t,n){Ze.varargs=n}var Ne=(e,r,t,n)=>{},Me=(e,r)=>{},rt=(e,r,t)=>{},et=(e,r,t)=>{},tt=()=>zr(""),rr={},re=(e)=>{while(e.length){var r=e.pop(),t=e.pop();t(r)}};function G(e){return this.fromWireType(h[e>>2])}var V={},I={},er={},nt=class extends Error{constructor(r){super(r);this.name="InternalError"}},tr=(e)=>{throw new nt(e)},D=(e,r,t)=>{e.forEach((o)=>er[o]=r);function n(o){var l=t(o);if(l.length!==e.length)tr("Mismatched type converter count");for(var u=0;u<e.length;++u)A(e[u],l[u])}var i=Array(r.length),a=[],s=0;for(let[o,l]of r.entries())if(I.hasOwnProperty(l))i[o]=I[l];else{if(a.push(l),!V.hasOwnProperty(l))V[l]=[];V[l].push(()=>{if(i[o]=I[l],++s,s===a.length)n(i)})}if(a.length===0)n(i)},it=(e)=>{var r=rr[e];delete rr[e];var{rawConstructor:t,rawDestructor:n,fields:i}=r,a=i.map((s)=>s.getterReturnType).concat(i.map((s)=>s.setterArgumentType));D([e],a,(s)=>{var o={};for(var[l,u]of i.entries()){let c=s[l],v=u.getter,p=u.getterContext,g=s[l+i.length],w=u.setter,P=u.setterContext;o[u.fieldName]={read:(T)=>c.fromWireType(v(p,T)),write:(T,y)=>{var j=[];w(P,T,g.toWireType(j,y)),re(j)},optional:c.optional}}return[{name:r.name,fromWireType:(c)=>{var v={};for(var p in o)v[p]=o[p].read(c);return n(c),v},toWireType:(c,v)=>{for(var p in o)if(!(p in v)&&!o[p].optional)throw TypeError(`Missing field: "${p}"`);var g=t();for(p in o)o[p].write(g,v[p]);if(c!==null)c.push(n,g);return g},readValueFromPointer:G,destructorFunction:n}]})},C=(e)=>{var r="";while(!0){var t=S[e++];if(!t)return r;r+=String.fromCharCode(t)}},J=class extends Error{constructor(r){super(r);this.name="BindingError"}},d=(e)=>{throw new J(e)};function at(e,r,t={}){var n=r.name;if(!e)d(`type "${n}" must have a positive integer typeid pointer`);if(I.hasOwnProperty(e))if(t.ignoreDuplicateRegistrations)return;else d(`Cannot register type '${n}' twice`);if(I[e]=r,delete er[e],V.hasOwnProperty(e)){var i=V[e];delete V[e],i.forEach((a)=>a())}}function A(e,r,t={}){return at(e,r,t)}var ee=(e,r,t)=>{switch(r){case 1:return t?(n)=>W[n]:(n)=>S[n];case 2:return t?(n)=>L[n>>1]:(n)=>H[n>>1];case 4:return t?(n)=>_[n>>2]:(n)=>h[n>>2];case 8:return t?(n)=>M[n>>3]:(n)=>Br[n>>3];default:throw TypeError(`invalid integer width (${r}): ${e}`)}},st=(e,r,t,n,i)=>{r=C(r);let a=n===0n,s=(o)=>o;if(a){let o=t*8;s=(l)=>BigInt.asUintN(o,l),i=s(i)}A(e,{name:r,fromWireType:s,toWireType:(o,l)=>{if(typeof l=="number")l=BigInt(l);return l},readValueFromPointer:ee(r,t,!a),destructorFunction:null})},ot=(e,r,t,n)=>{r=C(r),A(e,{name:r,fromWireType:function(i){return!!i},toWireType:function(i,a){return a?t:n},readValueFromPointer:function(i){return this.fromWireType(S[i])},destructorFunction:null})},ft=(e)=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),br=(e)=>{function r(t){return t.$$.ptrType.registeredClass.name}d(r(e)+" instance already deleted")},wr=!1,te=(e)=>{},lt=(e)=>{if(e.smartPtr)e.smartPtrType.rawDestructor(e.smartPtr);else e.ptrType.registeredClass.rawDestructor(e.ptr)},ne=(e)=>{e.count.value-=1;var r=e.count.value===0;if(r)lt(e)},K=(e)=>{if(!globalThis.FinalizationRegistry)return K=(r)=>r,e;return wr=new FinalizationRegistry((r)=>{ne(r.$$)}),K=(r)=>{var t=r.$$,n=!!t.smartPtr;if(n){var i={$$:t};wr.register(r,i,r)}return r},te=(r)=>wr.unregister(r),K(e)},nr=[],ut=()=>{while(nr.length){var e=nr.pop();e.$$.deleteScheduled=!1,e.delete()}},ie,ct=()=>{let e=ir.prototype;Object.assign(e,{isAliasOf(t){if(!(this instanceof ir))return!1;if(!(t instanceof ir))return!1;var n=this.$$.ptrType.registeredClass,i=this.$$.ptr;t.$$=t.$$;var a=t.$$.ptrType.registeredClass,s=t.$$.ptr;while(n.baseClass)i=n.upcast(i),n=n.baseClass;while(a.baseClass)s=a.upcast(s),a=a.baseClass;return n===a&&i===s},clone(){if(!this.$$.ptr)br(this);if(this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;else{var t=K(Object.create(Object.getPrototypeOf(this),{$$:{value:ft(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t}},delete(){if(!this.$$.ptr)br(this);if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete)d("Object already scheduled for deletion");if(te(this),ne(this.$$),!this.$$.preservePointerOnDelete)this.$$.smartPtr=void 0,this.$$.ptr=void 0},isDeleted(){return!this.$$.ptr},deleteLater(){if(!this.$$.ptr)br(this);if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete)d("Object already scheduled for deletion");if(nr.push(this),nr.length===1&&ie)ie(ut);return this.$$.deleteScheduled=!0,this}});let r=Symbol.dispose;if(r)e[r]=e.delete};function ir(){}var Tr=(e,r)=>Object.defineProperty(r,"name",{value:e}),ae={},$r=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...i){if(!e[r].overloadTable.hasOwnProperty(i.length))d(`Function '${t}' called with an invalid number of arguments (${i.length}) - expects one of (${e[r].overloadTable})!`);return e[r].overloadTable[i.length].apply(this,i)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},ar=(e,r,t)=>{if(f.hasOwnProperty(e)){if(t===void 0||f[e].overloadTable!==void 0&&f[e].overloadTable[t]!==void 0)d(`Cannot register public name '${e}' twice`);if($r(f,e,e),f[e].overloadTable.hasOwnProperty(t))d(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`);f[e].overloadTable[t]=r}else f[e]=r,f[e].argCount=t},vt=48,pt=57,dt=(e)=>{e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);if(r>=vt&&r<=pt)return`_${e}`;return e};function gt(e,r,t,n,i,a,s,o){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=i,this.getActualType=a,this.upcast=s,this.downcast=o,this.pureVirtualFunctions=[]}var Cr=(e,r,t)=>{while(r!==t){if(!r.upcast)d(`Expected null or instance of ${t.name}, got an instance of ${r.name}`);e=r.upcast(e),r=r.baseClass}return e},Pr=(e)=>{if(e===null)return"null";var r=typeof e;if(r==="object"||r==="array"||r==="function")return e.toString();else return""+e};function ht(e,r){if(r===null){if(this.isReference)d(`null is not a valid ${this.name}`);return 0}if(!r.$$)d(`Cannot pass "${Pr(r)}" as a ${this.name}`);if(!r.$$.ptr)d(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=Cr(r.$$.ptr,t,this.registeredClass);return n}function _t(e,r){var t;if(r===null){if(this.isReference)d(`null is not a valid ${this.name}`);if(this.isSmartPointer){if(t=this.rawConstructor(),e!==null)e.push(this.rawDestructor,t);return t}else return 0}if(!r||!r.$$)d(`Cannot pass "${Pr(r)}" as a ${this.name}`);if(!r.$$.ptr)d(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.isConst&&r.$$.ptrType.isConst)d(`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=Cr(r.$$.ptr,n,this.registeredClass),this.isSmartPointer){if(r.$$.smartPtr===void 0)d("Passing raw pointer to smart pointer is illegal");switch(this.sharingPolicy){case 0:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else d(`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 i=r.clone();if(t=this.rawShare(t,Sr.toHandle(()=>i.delete())),e!==null)e.push(this.rawDestructor,t)}break;default:d("Unsupported sharing policy")}}return t}function yt(e,r){if(r===null){if(this.isReference)d(`null is not a valid ${this.name}`);return 0}if(!r.$$)d(`Cannot pass "${Pr(r)}" as a ${this.name}`);if(!r.$$.ptr)d(`Cannot pass deleted object as a pointer of type ${this.name}`);if(r.$$.ptrType.isConst)d(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=Cr(r.$$.ptr,t,this.registeredClass);return n}var se=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=se(e,r,t.baseClass);if(n===null)return null;return t.downcast(n)},mt={},bt=(e,r)=>{if(r===void 0)d("ptr should not be undefined");while(e.baseClass)r=e.upcast(r),e=e.baseClass;return r},wt=(e,r)=>(r=bt(e,r),mt[r]),sr=(e,r)=>{if(!r.ptrType||!r.ptr)tr("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;if(t!==n)tr("Both smartPtrType and smartPtr must be specified");return r.count={value:1},K(Object.create(e,{$$:{value:r,writable:!0}}))};function Tt(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=wt(this.registeredClass,r);if(t!==void 0)if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();else{var n=t.clone();return this.destructor(e),n}function i(){if(this.isSmartPointer)return sr(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e});else return sr(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var a=this.registeredClass.getActualType(r),s=ae[a];if(!s)return i.call(this);var o;if(this.isConst)o=s.constPointerType;else o=s.pointerType;var l=se(r,this.registeredClass,o.registeredClass);if(l===null)return i.call(this);if(this.isSmartPointer)return sr(o.registeredClass.instancePrototype,{ptrType:o,ptr:l,smartPtrType:this,smartPtr:e});else return sr(o.registeredClass.instancePrototype,{ptrType:o,ptr:l})}var $t=()=>{Object.assign(or.prototype,{getPointee(e){if(this.rawGetPointee)e=this.rawGetPointee(e);return e},destructor(e){this.rawDestructor?.(e)},readValueFromPointer:G,fromWireType:Tt})};function or(e,r,t,n,i,a,s,o,l,u,c){if(this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=i,this.pointeeType=a,this.sharingPolicy=s,this.rawGetPointee=o,this.rawConstructor=l,this.rawShare=u,this.rawDestructor=c,!i&&r.baseClass===void 0)if(n)this.toWireType=ht,this.destructorFunction=null;else this.toWireType=yt,this.destructorFunction=null;else this.toWireType=_t}var Ct=(e,r,t)=>{if(!f.hasOwnProperty(e))tr("Replacing nonexistent public symbol");if(f[e].overloadTable!==void 0&&t!==void 0)f[e].overloadTable[t]=r;else f[e]=r,f[e].argCount=t},E=(e,r,t=!1)=>{e=C(e);function n(){var a=Jr(r);return a}var i=n();if(typeof i!="function")d(`unknown function pointer with signature ${e}: ${r}`);return i};class oe extends Error{}var fe=(e)=>{var r=me(e),t=C(r);return k(r),t},fr=(e,r)=>{var t=[],n={};function i(a){if(n[a])return;if(I[a])return;if(er[a]){er[a].forEach(i);return}t.push(a),n[a]=!0}throw r.forEach(i),new oe(`${e}: `+t.map(fe).join([", "]))},Pt=(e,r,t,n,i,a,s,o,l,u,c,v,p)=>{c=C(c),a=E(i,a),o&&=E(s,o),u&&=E(l,u),p=E(v,p);var g=dt(c);ar(g,function(){fr(`Cannot construct ${c} due to unbound types`,[n])}),D([e,r,t],n?[n]:[],(w)=>{w=w[0];var P,T;if(n)P=w.registeredClass,T=P.instancePrototype;else T=ir.prototype;var y=Tr(c,function(...Ur){if(Object.getPrototypeOf(this)!==j)throw new J(`Use 'new' to construct ${c}`);if(R.constructor_body===void 0)throw new J(`${c} has no accessible constructor`);var Te=R.constructor_body[Ur.length];if(Te===void 0)throw new J(`Tried to invoke ctor of ${c} with invalid number of parameters (${Ur.length}) - expected (${Object.keys(R.constructor_body).toString()}) parameters instead!`);return Te.apply(this,Ur)}),j=Object.create(T,{constructor:{value:y}});y.prototype=j;var R=new gt(c,y,j,p,P,a,o,u);if(R.baseClass)R.baseClass.__derivedClasses??=[],R.baseClass.__derivedClasses.push(R);var kr=new or(c,R,!0,!1,!1),U=new or(c+"*",R,!1,!1,!1),cr=new or(c+" const*",R,!1,!0,!1);return ae[e]={pointerType:U,constPointerType:cr},Ct(g,y),[kr,U,cr]})};function Ft(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function Fr(e,r,t,n,i,a){var s=r.length;if(s<2)d("argTypes array size mismatch! Must at least get return value and 'this' types!");var o=r[1]!==null&&t!==null,l=Ft(r),u=!r[0].isVoid,c=s-2,v=Array(c),p=[],g=[],w=function(...P){g.length=0;var T;if(p.length=o?2:1,p[0]=i,o)T=r[1].toWireType(g,this),p[1]=T;for(var y=0;y<c;++y)v[y]=r[y+2].toWireType(g,P[y]),p.push(v[y]);var j=n(...p);function R(kr){if(l)re(g);else for(var U=o?1:2;U<r.length;U++){var cr=U===1?T:v[U-2];if(r[U].destructorFunction!==null)r[U].destructorFunction(cr)}if(u)return r[0].fromWireType(kr)}return R(j)};return Tr(e,w)}var Ar=(e,r)=>{var t=[];for(var n=0;n<e;n++)t.push(h[r+n*4>>2]);return t},le=(e)=>{e=e.trim();let r=e.indexOf("(");if(r===-1)return e;return e.slice(0,r)},At=(e,r,t,n,i,a,s,o,l)=>{var u=Ar(t,n);r=C(r),r=le(r),a=E(i,a,o),D([],[e],(c)=>{c=c[0];var v=`${c.name}.${r}`;function p(){fr(`Cannot call ${v} due to unbound types`,u)}if(r.startsWith("@@"))r=Symbol[r.substring(2)];var g=c.registeredClass.constructor;if(g[r]===void 0)p.argCount=t-1,g[r]=p;else $r(g,r,v),g[r].overloadTable[t-1]=p;return D([],u,(w)=>{var P=[w[0],null].concat(w.slice(1)),T=Fr(v,P,null,a,s,o);if(g[r].overloadTable===void 0)T.argCount=t-1,g[r]=T;else g[r].overloadTable[t-1]=T;if(c.registeredClass.__derivedClasses){for(let y of c.registeredClass.__derivedClasses)if(!y.constructor.hasOwnProperty(r))y.constructor[r]=T}return[]}),[]})},St=(e,r,t,n,i,a)=>{var s=Ar(r,t);i=E(n,i),D([],[e],(o)=>{o=o[0];var l=`constructor ${o.name}`;if(o.registeredClass.constructor_body===void 0)o.registeredClass.constructor_body=[];if(o.registeredClass.constructor_body[r-1]!==void 0)throw new J(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${o.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return o.registeredClass.constructor_body[r-1]=()=>{fr(`Cannot construct ${o.name} due to unbound types`,s)},D([],s,(u)=>(u.splice(1,0,null),o.registeredClass.constructor_body[r-1]=Fr(l,u,null,i,a),[])),[]})},Rt=(e,r,t,n,i,a,s,o,l,u)=>{var c=Ar(t,n);r=C(r),r=le(r),a=E(i,a,l),D([],[e],(v)=>{v=v[0];var p=`${v.name}.${r}`;if(r.startsWith("@@"))r=Symbol[r.substring(2)];if(o)v.registeredClass.pureVirtualFunctions.push(r);function g(){fr(`Cannot call ${p} due to unbound types`,c)}var w=v.registeredClass.instancePrototype,P=w[r];if(P===void 0||P.overloadTable===void 0&&P.className!==v.name&&P.argCount===t-2)g.argCount=t-2,g.className=v.name,w[r]=g;else $r(w,r,p),w[r].overloadTable[t-2]=g;return D([],c,(T)=>{var y=Fr(p,T,v,a,s,l);if(w[r].overloadTable===void 0)y.argCount=t-2,w[r]=y;else w[r].overloadTable[t-2]=y;return[]}),[]})},ue=[],B=[0,1,,1,null,1,!0,1,!1,1],Et=(e)=>{if(e>9&&--B[e+1]===0)B[e]=void 0,ue.push(e)},Sr={toValue:(e)=>{if(!e)d(`Cannot use deleted val. handle = ${e}`);return B[e]},toHandle:(e)=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let r=ue.pop()||B.length;return B[r]=e,B[r+1]=1,r}}}},Wt={name:"emscripten::val",fromWireType:(e)=>{var r=Sr.toValue(e);return Et(e),r},toWireType:(e,r)=>Sr.toHandle(r),readValueFromPointer:G,destructorFunction:null},kt=(e)=>A(e,Wt),Rr=(e,r,t)=>{switch(r){case 1:return t?function(n){return this.fromWireType(W[n])}:function(n){return this.fromWireType(S[n])};case 2:return t?function(n){return this.fromWireType(L[n>>1])}:function(n){return this.fromWireType(H[n>>1])};case 4:return t?function(n){return this.fromWireType(_[n>>2])}:function(n){return this.fromWireType(h[n>>2])};default:throw TypeError(`invalid integer width (${r}): ${e}`)}};function Ut(e){return e===0?"object":e===1?"number":"string"}var Dt=(e,r,t,n,i)=>{r=C(r);let a=Ut(i);switch(a){case"object":{let u=function(){};u.values={},A(e,{name:r,constructor:u,valueType:a,fromWireType:function(c){return this.constructor.values[c]},toWireType:(c,v)=>v.value,readValueFromPointer:Rr(r,t,n),destructorFunction:null}),ar(r,u);break}case"number":{var s={};A(e,{name:r,keysMap:s,valueType:a,fromWireType:(u)=>u,toWireType:(u,c)=>c,readValueFromPointer:Rr(r,t,n),destructorFunction:null}),ar(r,s),delete f[r].argCount;break}case"string":{var o={},l={},s={};A(e,{name:r,valuesMap:o,reverseMap:l,keysMap:s,valueType:a,fromWireType:function(c){return this.reverseMap[c]},toWireType:function(c,v){return this.valuesMap[v]},readValueFromPointer:Rr(r,t,n),destructorFunction:null}),ar(r,s),delete f[r].argCount;break}}},jt=(e,r)=>{var t=I[e];if(t===void 0)d(`${r} has unknown type ${fe(e)}`);return t},Ot=(e,r,t)=>{var n=jt(e,"enum");switch(r=C(r),n.valueType){case"object":{var i=n.constructor,a=Object.create(n.constructor.prototype,{value:{value:t},constructor:{value:Tr(`${n.name}_${r}`,function(){})}});i.values[t]=a,i[r]=a;break}case"number":{n.keysMap[r]=t;break}case"string":{n.valuesMap[r]=t,n.reverseMap[t]=r,n.keysMap[r]=r;break}}},It=(e,r)=>{switch(r){case 4:return function(t){return this.fromWireType(Hr[t>>2])};case 8:return function(t){return this.fromWireType(Vr[t>>3])};default:throw TypeError(`invalid float width (${r}): ${e}`)}},Lt=(e,r,t)=>{r=C(r),A(e,{name:r,fromWireType:(n)=>n,toWireType:(n,i)=>i,readValueFromPointer:It(r,t),destructorFunction:null})},Ht=(e,r,t,n,i)=>{r=C(r);let a=n===0,s=(l)=>l;if(a){var o=32-8*t;s=(l)=>l<<o>>>o,i=s(i)}A(e,{name:r,fromWireType:s,toWireType:(l,u)=>u,readValueFromPointer:ee(r,t,n!==0),destructorFunction:null})},Vt=(e,r,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],i=n[r];function a(s){var o=h[s>>2],l=h[s+4>>2];return new i(W.buffer,l,o)}t=C(t),A(e,{name:t,fromWireType:a,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},Bt=(e,r,t,n)=>{if(!(n>0))return 0;var i=t,a=t+n-1;for(var s=0;s<e.length;++s){var o=e.codePointAt(s);if(o<=127){if(t>=a)break;r[t++]=o}else if(o<=2047){if(t+1>=a)break;r[t++]=192|o>>6,r[t++]=128|o&63}else if(o<=65535){if(t+2>=a)break;r[t++]=224|o>>12,r[t++]=128|o>>6&63,r[t++]=128|o&63}else{if(t+3>=a)break;r[t++]=240|o>>18,r[t++]=128|o>>12&63,r[t++]=128|o>>6&63,r[t++]=128|o&63,s++}}return r[t]=0,t-i},x=(e,r,t)=>Bt(e,S,r,t),ce=(e)=>{var r=0;for(var t=0;t<e.length;++t){var n=e.charCodeAt(t);if(n<=127)r++;else if(n<=2047)r+=2;else if(n>=55296&&n<=57343)r+=4,++t;else r+=3}return r},xt=(e,r)=>{r=C(r);var t=!0;A(e,{name:r,fromWireType(n){var i=h[n>>2],a=n+4,s;if(t)s=Mr(a,i,!0);else{s="";for(var o=0;o<i;++o)s+=String.fromCharCode(S[a+o])}return k(n),s},toWireType(n,i){if(i instanceof ArrayBuffer)i=new Uint8Array(i);var a,s=typeof i=="string";if(!(s||ArrayBuffer.isView(i)&&i.BYTES_PER_ELEMENT==1))d("Cannot pass non-string to std::string");if(t&&s)a=ce(i);else a=i.length;var o=Wr(4+a+1),l=o+4;if(h[o>>2]=a,s)if(t)x(i,l,a+1);else for(var u=0;u<a;++u){var c=i.charCodeAt(u);if(c>255)k(o),d("String has UTF-16 code units that do not fit in 8 bits");S[l+u]=c}else S.set(i,l);if(n!==null)n.push(k,o);return o},readValueFromPointer:G,destructorFunction(n){k(n)}})},ve=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,zt=(e,r,t)=>{var n=e>>1,i=Qr(H,n,r/2,t);if(i-n>16&&ve)return ve.decode(H.subarray(n,i));var a="";for(var s=n;s<i;++s){var o=H[s];a+=String.fromCharCode(o)}return a},Yt=(e,r,t)=>{if(t??=2147483647,t<2)return 0;t-=2;var n=r,i=t<e.length*2?t/2:e.length;for(var a=0;a<i;++a){var s=e.charCodeAt(a);L[r>>1]=s,r+=2}return L[r>>1]=0,r-n},qt=(e)=>e.length*2,Gt=(e,r,t)=>{var n="",i=e>>2;for(var a=0;!(a>=r/4);a++){var s=h[i+a];if(!s&&!t)break;n+=String.fromCodePoint(s)}return n},Jt=(e,r,t)=>{if(t??=2147483647,t<4)return 0;var n=r,i=n+t-4;for(var a=0;a<e.length;++a){var s=e.codePointAt(a);if(s>65535)a++;if(_[r>>2]=s,r+=4,r+4>i)break}return _[r>>2]=0,r-n},Kt=(e)=>{var r=0;for(var t=0;t<e.length;++t){var n=e.codePointAt(t);if(n>65535)t++;r+=4}return r},Xt=(e,r,t)=>{t=C(t);var n,i,a;if(r===2)n=zt,i=Yt,a=qt;else n=Gt,i=Jt,a=Kt;A(e,{name:t,fromWireType:(s)=>{var o=h[s>>2],l=n(s+4,o*r,!0);return k(s),l},toWireType:(s,o)=>{if(typeof o!="string")d(`Cannot pass non-string to C++ string type ${t}`);var l=a(o),u=Wr(4+l+r);if(h[u>>2]=l/r,i(o,u+4,l+r),s!==null)s.push(k,u);return u},readValueFromPointer:G,destructorFunction(s){k(s)}})},Zt=(e,r,t,n,i,a)=>{rr[e]={name:C(r),rawConstructor:E(t,n),rawDestructor:E(i,a),fields:[]}},Qt=(e,r,t,n,i,a,s,o,l,u)=>{rr[e].fields.push({fieldName:C(r),getterReturnType:t,getter:E(n,i),getterContext:a,setterArgumentType:s,setter:E(o,l),setterContext:u})},Nt=(e,r)=>{r=C(r),A(e,{isVoid:!0,name:r,fromWireType:()=>{return},toWireType:(t,n)=>{return}})},pe=0,Mt=()=>{mr=!1,pe=0},rn=9007199254740992,en=-9007199254740992,z=(e)=>e<en||e>rn?NaN:Number(e);function tn(e,r){e=z(e);var t=new Date(e*1000);_[r>>2]=t.getUTCSeconds(),_[r+4>>2]=t.getUTCMinutes(),_[r+8>>2]=t.getUTCHours(),_[r+12>>2]=t.getUTCDate(),_[r+16>>2]=t.getUTCMonth(),_[r+20>>2]=t.getUTCFullYear()-1900,_[r+24>>2]=t.getUTCDay();var n=Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0),i=(t.getTime()-n)/86400000|0;_[r+28>>2]=i}var nn=(e)=>e%4===0&&(e%100!==0||e%400===0),an=[0,31,60,91,121,152,182,213,244,274,305,335],sn=[0,31,59,90,120,151,181,212,243,273,304,334],on=(e)=>{var r=nn(e.getFullYear()),t=r?an:sn,n=t[e.getMonth()]+e.getDate()-1;return n};function fn(e,r){e=z(e);var t=new Date(e*1000);_[r>>2]=t.getSeconds(),_[r+4>>2]=t.getMinutes(),_[r+8>>2]=t.getHours(),_[r+12>>2]=t.getDate(),_[r+16>>2]=t.getMonth(),_[r+20>>2]=t.getFullYear()-1900,_[r+24>>2]=t.getDay();var n=on(t)|0;_[r+28>>2]=n,_[r+36>>2]=-(t.getTimezoneOffset()*60);var i=new Date(t.getFullYear(),0,1),a=new Date(t.getFullYear(),6,1).getTimezoneOffset(),s=i.getTimezoneOffset(),o=(a!=s&&t.getTimezoneOffset()==Math.min(s,a))|0;_[r+32>>2]=o}function ln(e,r,t,n,i,a,s){return i=z(i),-52}function un(e,r,t,n,i,a){a=z(a)}var X={},de=(e)=>{if(e instanceof yr||e=="unwind")return N;O(1,e)},ge=()=>mr||pe>0,he=(e)=>{if(N=e,!ge())f.onExit?.(e),Q=!0;O(e,new yr(e))},cn=(e,r)=>{N=e,he(e)},_e=cn,vn=()=>{if(!ge())try{_e(N)}catch(e){de(e)}},pn=(e)=>{if(Q)return;try{e(),vn()}catch(r){de(r)}},dn=()=>performance.now(),gn=(e,r)=>{if(X[e])clearTimeout(X[e].id),delete X[e];if(!r)return 0;var t=setTimeout(()=>{delete X[e],pn(()=>be(e,dn()))},r);return X[e]={id:t,timeout_ms:r},0},hn=(e,r,t,n)=>{var i=new Date().getFullYear(),a=new Date(i,0,1),s=new Date(i,6,1),o=a.getTimezoneOffset(),l=s.getTimezoneOffset(),u=Math.max(o,l);h[e>>2]=u*60,_[r>>2]=Number(o!=l);var c=(g)=>{var w=g>=0?"-":"+",P=Math.abs(g),T=String(Math.floor(P/60)).padStart(2,"0"),y=String(P%60).padStart(2,"0");return`UTC${w}${T}${y}`},v=c(o),p=c(l);if(l<o)x(v,t,17),x(p,n,17);else x(v,n,17),x(p,t,17)},_n=()=>Date.now(),ye=()=>2147483648,yn=()=>ye(),mn=(e,r)=>Math.ceil(e/r)*r,bn=(e)=>{var r=lr.buffer.byteLength,t=(e-r+65535)/65536|0;try{return lr.grow(t),xr(),1}catch(n){}},wn=(e)=>{var r=S.length;e>>>=0;var t=ye();if(e>t)return!1;for(var n=1;n<=4;n*=2){var i=r*(1+0.2/n);i=Math.min(i,e+100663296);var a=Math.min(t,mn(Math.max(e,i),65536)),s=bn(a);if(s)return!0}return!1},Er={},Tn=()=>F||"./this.program",Z=()=>{if(!Z.strings){var e=(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:Tn()};for(var t in Er)if(Er[t]===void 0)delete r[t];else r[t]=Er[t];var n=[];for(var t in r)n.push(`${t}=${r[t]}`);Z.strings=n}return Z.strings},$n=(e,r)=>{var t=0,n=0;for(var i of Z()){var a=r+t;h[e+n>>2]=a,t+=x(i,a,1/0)+1,n+=4}return 0},Cn=(e,r)=>{var t=Z();h[e>>2]=t.length;var n=0;for(var i of t)n+=ce(i)+1;return h[r>>2]=n,0},Pn=(e)=>52,Fn=(e,r)=>{var t=0,n=0,i=0;{var a=2;if(e==0)t=2;else if(e==1||e==2)t=64;i=1}return W[r]=a,L[r+2>>1]=i,M[r+8>>3]=BigInt(t),M[r+16>>3]=BigInt(n),0};function An(e,r,t,n,i){return n=z(n),52}var Sn=(e,r,t,n)=>52;function Rn(e,r,t,n){return r=z(r),70}var En=[null,[],[]],Wn=(e,r)=>{var t=En[e];if(r===0||r===10)(e===1?Lr:gr)(Nr(t)),t.length=0;else t.push(r)},kn=(e,r,t,n)=>{var i=0;for(var a=0;a<t;a++){var s=h[r>>2],o=h[r+4>>2];r+=8;for(var l=0;l<o;l++)Wn(e,S[s+l]);i+=o}return h[n>>2]=i,0};ct(),$t();{if(f.noExitRuntime)mr=f.noExitRuntime;if(f.print)Lr=f.print;if(f.printErr)gr=f.printErr;if(f.wasmBinary)hr=f.wasmBinary;if(f.arguments)b=f.arguments;if(f.thisProgram)F=f.thisProgram;if(f.preInit){if(typeof f.preInit=="function")f.preInit=[f.preInit];while(f.preInit.length>0)f.preInit.shift()()}}var Wr,k,me,be,Un,Dn,lr,we;function jn(e){Wr=e.ca,k=e.da,me=e.ea,be=e.fa,Un=lr=e.$,Dn=we=e.ba}var On={w:Ve,k:xe,P:ze,Q:Ye,N:qe,I:Ge,u:Je,J:Ke,K:Xe,z:Qe,t:Ne,M:Me,q:rt,s:et,R:tt,A:it,j:st,Y:ot,p:Pt,g:At,l:St,c:Rt,W:kt,_:Dt,d:Ot,i:Lt,b:Ht,a:Vt,X:xt,e:Xt,L:Zt,f:Qt,Z:Nt,x:Mt,D:tn,E:fn,B:ln,C:un,r:gn,F:hn,O:_n,n:yn,m:wn,T:$n,U:Cn,V:_e,h:Pn,H:Fn,y:An,v:Sn,G:Rn,o:kn,S:he};function In(){Ee();function e(){if(f.calledRun=!0,Q)return;We(),f.onRuntimeInitialized?.(),ke()}if(f.setStatus)f.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>f.setStatus(""),1),e()},1);else e()}var ur=Ie();return In(),f}var Y;function Pe(f){Y=f,pr=()=>{}}var Ce=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((f)=>{f.delete()});class Dr{constructor(){pr(),this._impl=new Y.ClangFormat,Ce.register(this,this._impl,this)}with_style(f){return this._impl.with_style(f),this}with_fallback_style(f){return this._impl.with_fallback_style(f),this}format(f,m="<stdin>"){let b=this._impl.format(f,m);return vr(b)??f}format_range(f,m,b,F="<stdin>"){let O=this._impl.format_range(f,F,m,b);return vr(O)??f}format_line(f,m,b,F="<stdin>"){let O=this._impl.format_line(f,F,m,b);return vr(O)??f}static version(){return pr(),Y.ClangFormat.version()}static dump_config({style:f="file",filename:m="<stdin>",code:b=""}={}){pr();let F=Y.ClangFormat.dump_config(f,m,b);return vr(F)}[Symbol.dispose](){if(this._impl)Ce.unregister(this),this._impl.delete(),this._impl=null}}function pr(){throw Error("uninit")}function vr(f){let{status:m,content:b}=f;if(m===Y.ResultStatus.Error)throw Error(b);if(m===Y.ResultStatus.Unchanged)return null;return b}function jr(f,m="<stdin>",b="LLVM"){let F=new Dr;try{return F.with_style(b).format(f,m)}finally{F[Symbol.dispose]()}}var q;async function Ln(f){if(typeof Response==="function"&&f instanceof Response){if(typeof WebAssembly.compileStreaming==="function")try{return await WebAssembly.compileStreaming(f)}catch(F){if(f.ok&&m(f.type)&&f.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.compileStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",F);else throw F}let b=await f.arrayBuffer();return await WebAssembly.compile(b)}else return await WebAssembly.compile(f);function m(b){switch(b){case"basic":case"cors":case"default":return!0}return!1}}async function Or(f){if(q!==void 0)return q;if(f===void 0)f=new URL("clang-format.wasm",import.meta.url);if(typeof f==="string"||typeof Request==="function"&&f instanceof Request||typeof URL==="function"&&f instanceof URL)f=fetch(f);let m=await Ln(await f);return q=Hn(m)}function Hn(f){return q=$e({wasm:f}),Pe(q),q}var Vn=[{id:"core",js:"/webui-fmt.js",entry:"fmt/fmt-core.ts"},{id:"ruff",js:"/webui-fmt-ruff.js",entry:"fmt/fmt-ruff.ts",wasm:{route:"/webui-fmt-ruff.wasm",pkg:"@wasm-fmt/ruff_fmt",file:"ruff_fmt_bg.wasm"}},{id:"gofmt",js:"/webui-fmt-gofmt.js",entry:"fmt/fmt-gofmt.ts",wasm:{route:"/webui-fmt-gofmt.wasm",pkg:"@wasm-fmt/gofmt",file:"gofmt.wasm"}},{id:"clang",js:"/webui-fmt-clang.js",entry:"fmt/fmt-clang.ts",wasm:{route:"/webui-fmt-clang.wasm",pkg:"@wasm-fmt/clang-format",file:"clang-format.wasm"}},{id:"lua",js:"/webui-fmt-lua.js",entry:"fmt/fmt-lua.ts",wasm:{route:"/webui-fmt-lua.wasm",pkg:"@wasm-fmt/lua_fmt",file:"lua_fmt_bg.wasm"}},{id:"taplo",js:"/webui-fmt-taplo.js",entry:"fmt/fmt-taplo.ts",wasm:{route:"/webui-fmt-taplo.wasm",pkg:"@wasm-fmt/taplo_fmt",file:"taplo_fmt_bg.wasm"}},{id:"sh",js:"/webui-fmt-sh.js",entry:"fmt/fmt-sh.ts"}];function Fe(f){return Vn.find((m)=>m.id===f)}var ni="mh-fmt-clang",Bn={c:"block.c",h:"block.h",cpp:"block.cc","c++":"block.cc",cc:"block.cc",hpp:"block.hpp",csharp:"block.cs",cs:"block.cs",java:"Block.java",objectivec:"block.m",objc:"block.m","objective-c":"block.m",protobuf:"block.proto",proto:"block.proto"},Ae=null;async function ii(f,m,b){return Ae??=Or(Fe("clang").wasm.route),await Ae,{text:jr(f,Bn[m]??"block.cc"),cursor:b}}export{ni as MARKER,ii as format};
1
+ function $e(f){dr=()=>f.wasm;var b=[],F="./this.program",O=(e,r)=>{throw r},Ir="";function Se(e){if(f.locateFile)return f.locateFile(e,Ir);return Ir+e}var xn,dr,Lr=console.log.bind(console),gr=console.error.bind(console),hr,Q=!1,N;function zn(e,r){if(!e)zr(r)}var W,S,L,H,_,h,Hr,Vr,M,Br,Re=!1;function xr(){var e=lr.buffer;W=new Int8Array(e),L=new Int16Array(e),S=new Uint8Array(e),H=new Uint16Array(e),_=new Int32Array(e),h=new Uint32Array(e),Hr=new Float32Array(e),Vr=new Float64Array(e),M=new BigInt64Array(e),Br=new BigUint64Array(e)}function Ee(){if(f.preRun){if(typeof f.preRun=="function")f.preRun=[f.preRun];while(f.preRun.length)He(f.preRun.shift())}Yr(Gr)}function We(){Re=!0,ur.aa()}function ke(){if(f.postRun){if(typeof f.postRun=="function")f.postRun=[f.postRun];while(f.postRun.length)Le(f.postRun.shift())}Yr(qr)}function zr(e){f.onAbort?.(e),e="Aborted("+e+")",gr(e),Q=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw r}var _r;function Ue(){return Se("clang-format-esm.wasm")}function De(e){if(e==_r&&hr)return new Uint8Array(hr);if(dr)return dr(e);throw'sync fetching of the wasm failed: you can preload it to Module["wasmBinary"] manually, or emcc.py will do that for you when generating HTML (but not JS)'}function je(e,r){var t,n=De(e);if(t=n,!(t instanceof WebAssembly.Module))t=new WebAssembly.Module(t);var i=new WebAssembly.Instance(t,r);return[i,t]}function Oe(){var e={a:On};return e}function Ie(){function e(n,i){return ur=n.exports,jn(ur),xr(),ur}var r=Oe();if(f.instantiateWasm)return new Promise((n,i)=>{f.instantiateWasm(r,(a,s)=>{n(e(a,s))})});_r??=Ue();var t=je(_r,r);return e(t[0])}class yr{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var Yr=(e)=>{while(e.length>0)e.shift()(f)},qr=[],Le=(e)=>qr.push(e),Gr=[],He=(e)=>Gr.push(e),mr=!0,Jr=(e)=>we.get(e),Ve=(e,r)=>Jr(e)(r);class Kr{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){h[this.ptr+4>>2]=e}get_type(){return h[this.ptr+4>>2]}set_destructor(e){h[this.ptr+8>>2]=e}get_destructor(){return h[this.ptr+8>>2]}set_caught(e){e=e?1:0,W[this.ptr+12]=e}get_caught(){return W[this.ptr+12]!=0}set_rethrown(e){e=e?1:0,W[this.ptr+13]=e}get_rethrown(){return W[this.ptr+13]!=0}init(e,r){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(r)}set_adjusted_ptr(e){h[this.ptr+16>>2]=e}get_adjusted_ptr(){return h[this.ptr+16>>2]}}var Xr=0,Be=0,xe=(e,r,t)=>{var n=new Kr(e);throw n.init(r,t),Xr=e,Be++,Xr},ze=(e)=>{},Ye=(e,r,t,n)=>{},qe=(e,r)=>{},Ge=(e,r)=>{},Je=(e,r,t)=>{},Ke=(e,r)=>{},Xe=(e,r,t,n)=>{},Zr=globalThis.TextDecoder&&new TextDecoder,Qr=(e,r,t,n)=>{var i=r+t;if(n)return i;while(e[r]&&!(r>=i))++r;return r},Nr=(e,r=0,t,n)=>{var i=Qr(e,r,t,n);if(i-r>16&&e.buffer&&Zr)return Zr.decode(e.subarray(r,i));var a="";while(r<i){var s=e[r++];if(!(s&128)){a+=String.fromCharCode(s);continue}var o=e[r++]&63;if((s&224)==192){a+=String.fromCharCode((s&31)<<6|o);continue}var l=e[r++]&63;if((s&240)==224)s=(s&15)<<12|o<<6|l;else s=(s&7)<<18|o<<12|l<<6|e[r++]&63;if(s<65536)a+=String.fromCharCode(s);else{var u=s-65536;a+=String.fromCharCode(55296|u>>10,56320|u&1023)}}return a},Mr=(e,r,t)=>e?Nr(S,e,r,t):"",Ze={varargs:void 0,getStr(e){var r=Mr(e);return r}};function Qe(e,r,t,n){Ze.varargs=n}var Ne=(e,r,t,n)=>{},Me=(e,r)=>{},rt=(e,r,t)=>{},et=(e,r,t)=>{},tt=()=>zr(""),rr={},re=(e)=>{while(e.length){var r=e.pop(),t=e.pop();t(r)}};function G(e){return this.fromWireType(h[e>>2])}var V={},I={},er={},nt=class extends Error{constructor(r){super(r);this.name="InternalError"}},tr=(e)=>{throw new nt(e)},D=(e,r,t)=>{e.forEach((o)=>er[o]=r);function n(o){var l=t(o);if(l.length!==e.length)tr("Mismatched type converter count");for(var u=0;u<e.length;++u)A(e[u],l[u])}var i=Array(r.length),a=[],s=0;for(let[o,l]of r.entries())if(I.hasOwnProperty(l))i[o]=I[l];else{if(a.push(l),!V.hasOwnProperty(l))V[l]=[];V[l].push(()=>{if(i[o]=I[l],++s,s===a.length)n(i)})}if(a.length===0)n(i)},it=(e)=>{var r=rr[e];delete rr[e];var{rawConstructor:t,rawDestructor:n,fields:i}=r,a=i.map((s)=>s.getterReturnType).concat(i.map((s)=>s.setterArgumentType));D([e],a,(s)=>{var o={};for(var[l,u]of i.entries()){let c=s[l],{getter:v,getterContext:p}=u,g=s[l+i.length],{setter:w,setterContext:P}=u;o[u.fieldName]={read:(T)=>c.fromWireType(v(p,T)),write:(T,y)=>{var j=[];w(P,T,g.toWireType(j,y)),re(j)},optional:c.optional}}return[{name:r.name,fromWireType:(c)=>{var v={};for(var p in o)v[p]=o[p].read(c);return n(c),v},toWireType:(c,v)=>{for(var p in o)if(!(p in v)&&!o[p].optional)throw TypeError(`Missing field: "${p}"`);var g=t();for(p in o)o[p].write(g,v[p]);if(c!==null)c.push(n,g);return g},readValueFromPointer:G,destructorFunction:n}]})},C=(e)=>{var r="";while(!0){var t=S[e++];if(!t)return r;r+=String.fromCharCode(t)}},J=class extends Error{constructor(r){super(r);this.name="BindingError"}},d=(e)=>{throw new J(e)};function at(e,r,t={}){var n=r.name;if(!e)d(`type "${n}" must have a positive integer typeid pointer`);if(I.hasOwnProperty(e))if(t.ignoreDuplicateRegistrations)return;else d(`Cannot register type '${n}' twice`);if(I[e]=r,delete er[e],V.hasOwnProperty(e)){var i=V[e];delete V[e],i.forEach((a)=>a())}}function A(e,r,t={}){return at(e,r,t)}var ee=(e,r,t)=>{switch(r){case 1:return t?(n)=>W[n]:(n)=>S[n];case 2:return t?(n)=>L[n>>1]:(n)=>H[n>>1];case 4:return t?(n)=>_[n>>2]:(n)=>h[n>>2];case 8:return t?(n)=>M[n>>3]:(n)=>Br[n>>3];default:throw TypeError(`invalid integer width (${r}): ${e}`)}},st=(e,r,t,n,i)=>{r=C(r);let a=n===0n,s=(o)=>o;if(a){let o=t*8;s=(l)=>BigInt.asUintN(o,l),i=s(i)}A(e,{name:r,fromWireType:s,toWireType:(o,l)=>{if(typeof l=="number")l=BigInt(l);return l},readValueFromPointer:ee(r,t,!a),destructorFunction:null})},ot=(e,r,t,n)=>{r=C(r),A(e,{name:r,fromWireType:function(i){return!!i},toWireType:function(i,a){return a?t:n},readValueFromPointer:function(i){return this.fromWireType(S[i])},destructorFunction:null})},ft=(e)=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),br=(e)=>{function r(t){return t.$$.ptrType.registeredClass.name}d(r(e)+" instance already deleted")},wr=!1,te=(e)=>{},lt=(e)=>{if(e.smartPtr)e.smartPtrType.rawDestructor(e.smartPtr);else e.ptrType.registeredClass.rawDestructor(e.ptr)},ne=(e)=>{e.count.value-=1;var r=e.count.value===0;if(r)lt(e)},K=(e)=>{if(!globalThis.FinalizationRegistry)return K=(r)=>r,e;return wr=new FinalizationRegistry((r)=>{ne(r.$$)}),K=(r)=>{var t=r.$$,n=!!t.smartPtr;if(n){var i={$$:t};wr.register(r,i,r)}return r},te=(r)=>wr.unregister(r),K(e)},nr=[],ut=()=>{while(nr.length){var e=nr.pop();e.$$.deleteScheduled=!1,e.delete()}},ie,ct=()=>{let e=ir.prototype;Object.assign(e,{isAliasOf(t){if(!(this instanceof ir))return!1;if(!(t instanceof ir))return!1;var n=this.$$.ptrType.registeredClass,i=this.$$.ptr;t.$$=t.$$;var a=t.$$.ptrType.registeredClass,s=t.$$.ptr;while(n.baseClass)i=n.upcast(i),n=n.baseClass;while(a.baseClass)s=a.upcast(s),a=a.baseClass;return n===a&&i===s},clone(){if(!this.$$.ptr)br(this);if(this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;else{var t=K(Object.create(Object.getPrototypeOf(this),{$$:{value:ft(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t}},delete(){if(!this.$$.ptr)br(this);if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete)d("Object already scheduled for deletion");if(te(this),ne(this.$$),!this.$$.preservePointerOnDelete)this.$$.smartPtr=void 0,this.$$.ptr=void 0},isDeleted(){return!this.$$.ptr},deleteLater(){if(!this.$$.ptr)br(this);if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete)d("Object already scheduled for deletion");if(nr.push(this),nr.length===1&&ie)ie(ut);return this.$$.deleteScheduled=!0,this}});let r=Symbol.dispose;if(r)e[r]=e.delete};function ir(){}var Tr=(e,r)=>Object.defineProperty(r,"name",{value:e}),ae={},$r=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...i){if(!e[r].overloadTable.hasOwnProperty(i.length))d(`Function '${t}' called with an invalid number of arguments (${i.length}) - expects one of (${e[r].overloadTable})!`);return e[r].overloadTable[i.length].apply(this,i)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},ar=(e,r,t)=>{if(f.hasOwnProperty(e)){if(t===void 0||f[e].overloadTable!==void 0&&f[e].overloadTable[t]!==void 0)d(`Cannot register public name '${e}' twice`);if($r(f,e,e),f[e].overloadTable.hasOwnProperty(t))d(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`);f[e].overloadTable[t]=r}else f[e]=r,f[e].argCount=t},vt=48,pt=57,dt=(e)=>{e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);if(r>=vt&&r<=pt)return`_${e}`;return e};function gt(e,r,t,n,i,a,s,o){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=i,this.getActualType=a,this.upcast=s,this.downcast=o,this.pureVirtualFunctions=[]}var Cr=(e,r,t)=>{while(r!==t){if(!r.upcast)d(`Expected null or instance of ${t.name}, got an instance of ${r.name}`);e=r.upcast(e),r=r.baseClass}return e},Pr=(e)=>{if(e===null)return"null";var r=typeof e;if(r==="object"||r==="array"||r==="function")return e.toString();else return""+e};function ht(e,r){if(r===null){if(this.isReference)d(`null is not a valid ${this.name}`);return 0}if(!r.$$)d(`Cannot pass "${Pr(r)}" as a ${this.name}`);if(!r.$$.ptr)d(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=Cr(r.$$.ptr,t,this.registeredClass);return n}function _t(e,r){var t;if(r===null){if(this.isReference)d(`null is not a valid ${this.name}`);if(this.isSmartPointer){if(t=this.rawConstructor(),e!==null)e.push(this.rawDestructor,t);return t}else return 0}if(!r||!r.$$)d(`Cannot pass "${Pr(r)}" as a ${this.name}`);if(!r.$$.ptr)d(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.isConst&&r.$$.ptrType.isConst)d(`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=Cr(r.$$.ptr,n,this.registeredClass),this.isSmartPointer){if(r.$$.smartPtr===void 0)d("Passing raw pointer to smart pointer is illegal");switch(this.sharingPolicy){case 0:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else d(`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 i=r.clone();if(t=this.rawShare(t,Sr.toHandle(()=>i.delete())),e!==null)e.push(this.rawDestructor,t)}break;default:d("Unsupported sharing policy")}}return t}function yt(e,r){if(r===null){if(this.isReference)d(`null is not a valid ${this.name}`);return 0}if(!r.$$)d(`Cannot pass "${Pr(r)}" as a ${this.name}`);if(!r.$$.ptr)d(`Cannot pass deleted object as a pointer of type ${this.name}`);if(r.$$.ptrType.isConst)d(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=Cr(r.$$.ptr,t,this.registeredClass);return n}var se=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=se(e,r,t.baseClass);if(n===null)return null;return t.downcast(n)},mt={},bt=(e,r)=>{if(r===void 0)d("ptr should not be undefined");while(e.baseClass)r=e.upcast(r),e=e.baseClass;return r},wt=(e,r)=>(r=bt(e,r),mt[r]),sr=(e,r)=>{if(!r.ptrType||!r.ptr)tr("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;if(t!==n)tr("Both smartPtrType and smartPtr must be specified");return r.count={value:1},K(Object.create(e,{$$:{value:r,writable:!0}}))};function Tt(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=wt(this.registeredClass,r);if(t!==void 0)if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();else{var n=t.clone();return this.destructor(e),n}function i(){if(this.isSmartPointer)return sr(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e});else return sr(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var a=this.registeredClass.getActualType(r),s=ae[a];if(!s)return i.call(this);var o;if(this.isConst)o=s.constPointerType;else o=s.pointerType;var l=se(r,this.registeredClass,o.registeredClass);if(l===null)return i.call(this);if(this.isSmartPointer)return sr(o.registeredClass.instancePrototype,{ptrType:o,ptr:l,smartPtrType:this,smartPtr:e});else return sr(o.registeredClass.instancePrototype,{ptrType:o,ptr:l})}var $t=()=>{Object.assign(or.prototype,{getPointee(e){if(this.rawGetPointee)e=this.rawGetPointee(e);return e},destructor(e){this.rawDestructor?.(e)},readValueFromPointer:G,fromWireType:Tt})};function or(e,r,t,n,i,a,s,o,l,u,c){if(this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=i,this.pointeeType=a,this.sharingPolicy=s,this.rawGetPointee=o,this.rawConstructor=l,this.rawShare=u,this.rawDestructor=c,!i&&r.baseClass===void 0)if(n)this.toWireType=ht,this.destructorFunction=null;else this.toWireType=yt,this.destructorFunction=null;else this.toWireType=_t}var Ct=(e,r,t)=>{if(!f.hasOwnProperty(e))tr("Replacing nonexistent public symbol");if(f[e].overloadTable!==void 0&&t!==void 0)f[e].overloadTable[t]=r;else f[e]=r,f[e].argCount=t},E=(e,r,t=!1)=>{e=C(e);function n(){var a=Jr(r);return a}var i=n();if(typeof i!="function")d(`unknown function pointer with signature ${e}: ${r}`);return i};class oe extends Error{}var fe=(e)=>{var r=me(e),t=C(r);return k(r),t},fr=(e,r)=>{var t=[],n={};function i(a){if(n[a])return;if(I[a])return;if(er[a]){er[a].forEach(i);return}t.push(a),n[a]=!0}throw r.forEach(i),new oe(`${e}: `+t.map(fe).join([", "]))},Pt=(e,r,t,n,i,a,s,o,l,u,c,v,p)=>{c=C(c),a=E(i,a),o&&=E(s,o),u&&=E(l,u),p=E(v,p);var g=dt(c);ar(g,function(){fr(`Cannot construct ${c} due to unbound types`,[n])}),D([e,r,t],n?[n]:[],(w)=>{w=w[0];var P,T;if(n)P=w.registeredClass,T=P.instancePrototype;else T=ir.prototype;var y=Tr(c,function(...Ur){if(Object.getPrototypeOf(this)!==j)throw new J(`Use 'new' to construct ${c}`);if(R.constructor_body===void 0)throw new J(`${c} has no accessible constructor`);var Te=R.constructor_body[Ur.length];if(Te===void 0)throw new J(`Tried to invoke ctor of ${c} with invalid number of parameters (${Ur.length}) - expected (${Object.keys(R.constructor_body).toString()}) parameters instead!`);return Te.apply(this,Ur)}),j=Object.create(T,{constructor:{value:y}});y.prototype=j;var R=new gt(c,y,j,p,P,a,o,u);if(R.baseClass)R.baseClass.__derivedClasses??=[],R.baseClass.__derivedClasses.push(R);var kr=new or(c,R,!0,!1,!1),U=new or(c+"*",R,!1,!1,!1),cr=new or(c+" const*",R,!1,!0,!1);return ae[e]={pointerType:U,constPointerType:cr},Ct(g,y),[kr,U,cr]})};function Ft(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function Fr(e,r,t,n,i,a){var s=r.length;if(s<2)d("argTypes array size mismatch! Must at least get return value and 'this' types!");var o=r[1]!==null&&t!==null,l=Ft(r),u=!r[0].isVoid,c=s-2,v=Array(c),p=[],g=[],w=function(...P){g.length=0;var T;if(p.length=o?2:1,p[0]=i,o)T=r[1].toWireType(g,this),p[1]=T;for(var y=0;y<c;++y)v[y]=r[y+2].toWireType(g,P[y]),p.push(v[y]);var j=n(...p);function R(kr){if(l)re(g);else for(var U=o?1:2;U<r.length;U++){var cr=U===1?T:v[U-2];if(r[U].destructorFunction!==null)r[U].destructorFunction(cr)}if(u)return r[0].fromWireType(kr)}return R(j)};return Tr(e,w)}var Ar=(e,r)=>{var t=[];for(var n=0;n<e;n++)t.push(h[r+n*4>>2]);return t},le=(e)=>{e=e.trim();let r=e.indexOf("(");if(r===-1)return e;return e.slice(0,r)},At=(e,r,t,n,i,a,s,o,l)=>{var u=Ar(t,n);r=C(r),r=le(r),a=E(i,a,o),D([],[e],(c)=>{c=c[0];var v=`${c.name}.${r}`;function p(){fr(`Cannot call ${v} due to unbound types`,u)}if(r.startsWith("@@"))r=Symbol[r.substring(2)];var g=c.registeredClass.constructor;if(g[r]===void 0)p.argCount=t-1,g[r]=p;else $r(g,r,v),g[r].overloadTable[t-1]=p;return D([],u,(w)=>{var P=[w[0],null].concat(w.slice(1)),T=Fr(v,P,null,a,s,o);if(g[r].overloadTable===void 0)T.argCount=t-1,g[r]=T;else g[r].overloadTable[t-1]=T;if(c.registeredClass.__derivedClasses){for(let y of c.registeredClass.__derivedClasses)if(!y.constructor.hasOwnProperty(r))y.constructor[r]=T}return[]}),[]})},St=(e,r,t,n,i,a)=>{var s=Ar(r,t);i=E(n,i),D([],[e],(o)=>{o=o[0];var l=`constructor ${o.name}`;if(o.registeredClass.constructor_body===void 0)o.registeredClass.constructor_body=[];if(o.registeredClass.constructor_body[r-1]!==void 0)throw new J(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${o.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return o.registeredClass.constructor_body[r-1]=()=>{fr(`Cannot construct ${o.name} due to unbound types`,s)},D([],s,(u)=>(u.splice(1,0,null),o.registeredClass.constructor_body[r-1]=Fr(l,u,null,i,a),[])),[]})},Rt=(e,r,t,n,i,a,s,o,l,u)=>{var c=Ar(t,n);r=C(r),r=le(r),a=E(i,a,l),D([],[e],(v)=>{v=v[0];var p=`${v.name}.${r}`;if(r.startsWith("@@"))r=Symbol[r.substring(2)];if(o)v.registeredClass.pureVirtualFunctions.push(r);function g(){fr(`Cannot call ${p} due to unbound types`,c)}var w=v.registeredClass.instancePrototype,P=w[r];if(P===void 0||P.overloadTable===void 0&&P.className!==v.name&&P.argCount===t-2)g.argCount=t-2,g.className=v.name,w[r]=g;else $r(w,r,p),w[r].overloadTable[t-2]=g;return D([],c,(T)=>{var y=Fr(p,T,v,a,s,l);if(w[r].overloadTable===void 0)y.argCount=t-2,w[r]=y;else w[r].overloadTable[t-2]=y;return[]}),[]})},ue=[],B=[0,1,,1,null,1,!0,1,!1,1],Et=(e)=>{if(e>9&&--B[e+1]===0)B[e]=void 0,ue.push(e)},Sr={toValue:(e)=>{if(!e)d(`Cannot use deleted val. handle = ${e}`);return B[e]},toHandle:(e)=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let r=ue.pop()||B.length;return B[r]=e,B[r+1]=1,r}}}},Wt={name:"emscripten::val",fromWireType:(e)=>{var r=Sr.toValue(e);return Et(e),r},toWireType:(e,r)=>Sr.toHandle(r),readValueFromPointer:G,destructorFunction:null},kt=(e)=>A(e,Wt),Rr=(e,r,t)=>{switch(r){case 1:return t?function(n){return this.fromWireType(W[n])}:function(n){return this.fromWireType(S[n])};case 2:return t?function(n){return this.fromWireType(L[n>>1])}:function(n){return this.fromWireType(H[n>>1])};case 4:return t?function(n){return this.fromWireType(_[n>>2])}:function(n){return this.fromWireType(h[n>>2])};default:throw TypeError(`invalid integer width (${r}): ${e}`)}};function Ut(e){return e===0?"object":e===1?"number":"string"}var Dt=(e,r,t,n,i)=>{r=C(r);let a=Ut(i);switch(a){case"object":{let u=function(){};u.values={},A(e,{name:r,constructor:u,valueType:a,fromWireType:function(c){return this.constructor.values[c]},toWireType:(c,v)=>v.value,readValueFromPointer:Rr(r,t,n),destructorFunction:null}),ar(r,u);break}case"number":{var s={};A(e,{name:r,keysMap:s,valueType:a,fromWireType:(u)=>u,toWireType:(u,c)=>c,readValueFromPointer:Rr(r,t,n),destructorFunction:null}),ar(r,s),delete f[r].argCount;break}case"string":{var o={},l={},s={};A(e,{name:r,valuesMap:o,reverseMap:l,keysMap:s,valueType:a,fromWireType:function(c){return this.reverseMap[c]},toWireType:function(c,v){return this.valuesMap[v]},readValueFromPointer:Rr(r,t,n),destructorFunction:null}),ar(r,s),delete f[r].argCount;break}}},jt=(e,r)=>{var t=I[e];if(t===void 0)d(`${r} has unknown type ${fe(e)}`);return t},Ot=(e,r,t)=>{var n=jt(e,"enum");switch(r=C(r),n.valueType){case"object":{var i=n.constructor,a=Object.create(n.constructor.prototype,{value:{value:t},constructor:{value:Tr(`${n.name}_${r}`,function(){})}});i.values[t]=a,i[r]=a;break}case"number":{n.keysMap[r]=t;break}case"string":{n.valuesMap[r]=t,n.reverseMap[t]=r,n.keysMap[r]=r;break}}},It=(e,r)=>{switch(r){case 4:return function(t){return this.fromWireType(Hr[t>>2])};case 8:return function(t){return this.fromWireType(Vr[t>>3])};default:throw TypeError(`invalid float width (${r}): ${e}`)}},Lt=(e,r,t)=>{r=C(r),A(e,{name:r,fromWireType:(n)=>n,toWireType:(n,i)=>i,readValueFromPointer:It(r,t),destructorFunction:null})},Ht=(e,r,t,n,i)=>{r=C(r);let a=n===0,s=(l)=>l;if(a){var o=32-8*t;s=(l)=>l<<o>>>o,i=s(i)}A(e,{name:r,fromWireType:s,toWireType:(l,u)=>u,readValueFromPointer:ee(r,t,n!==0),destructorFunction:null})},Vt=(e,r,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],i=n[r];function a(s){var o=h[s>>2],l=h[s+4>>2];return new i(W.buffer,l,o)}t=C(t),A(e,{name:t,fromWireType:a,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},Bt=(e,r,t,n)=>{if(!(n>0))return 0;var i=t,a=t+n-1;for(var s=0;s<e.length;++s){var o=e.codePointAt(s);if(o<=127){if(t>=a)break;r[t++]=o}else if(o<=2047){if(t+1>=a)break;r[t++]=192|o>>6,r[t++]=128|o&63}else if(o<=65535){if(t+2>=a)break;r[t++]=224|o>>12,r[t++]=128|o>>6&63,r[t++]=128|o&63}else{if(t+3>=a)break;r[t++]=240|o>>18,r[t++]=128|o>>12&63,r[t++]=128|o>>6&63,r[t++]=128|o&63,s++}}return r[t]=0,t-i},x=(e,r,t)=>Bt(e,S,r,t),ce=(e)=>{var r=0;for(var t=0;t<e.length;++t){var n=e.charCodeAt(t);if(n<=127)r++;else if(n<=2047)r+=2;else if(n>=55296&&n<=57343)r+=4,++t;else r+=3}return r},xt=(e,r)=>{r=C(r);var t=!0;A(e,{name:r,fromWireType(n){var i=h[n>>2],a=n+4,s;if(t)s=Mr(a,i,!0);else{s="";for(var o=0;o<i;++o)s+=String.fromCharCode(S[a+o])}return k(n),s},toWireType(n,i){if(i instanceof ArrayBuffer)i=new Uint8Array(i);var a,s=typeof i=="string";if(!(s||ArrayBuffer.isView(i)&&i.BYTES_PER_ELEMENT==1))d("Cannot pass non-string to std::string");if(t&&s)a=ce(i);else a=i.length;var o=Wr(4+a+1),l=o+4;if(h[o>>2]=a,s)if(t)x(i,l,a+1);else for(var u=0;u<a;++u){var c=i.charCodeAt(u);if(c>255)k(o),d("String has UTF-16 code units that do not fit in 8 bits");S[l+u]=c}else S.set(i,l);if(n!==null)n.push(k,o);return o},readValueFromPointer:G,destructorFunction(n){k(n)}})},ve=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,zt=(e,r,t)=>{var n=e>>1,i=Qr(H,n,r/2,t);if(i-n>16&&ve)return ve.decode(H.subarray(n,i));var a="";for(var s=n;s<i;++s){var o=H[s];a+=String.fromCharCode(o)}return a},Yt=(e,r,t)=>{if(t??=2147483647,t<2)return 0;t-=2;var n=r,i=t<e.length*2?t/2:e.length;for(var a=0;a<i;++a){var s=e.charCodeAt(a);L[r>>1]=s,r+=2}return L[r>>1]=0,r-n},qt=(e)=>e.length*2,Gt=(e,r,t)=>{var n="",i=e>>2;for(var a=0;!(a>=r/4);a++){var s=h[i+a];if(!s&&!t)break;n+=String.fromCodePoint(s)}return n},Jt=(e,r,t)=>{if(t??=2147483647,t<4)return 0;var n=r,i=n+t-4;for(var a=0;a<e.length;++a){var s=e.codePointAt(a);if(s>65535)a++;if(_[r>>2]=s,r+=4,r+4>i)break}return _[r>>2]=0,r-n},Kt=(e)=>{var r=0;for(var t=0;t<e.length;++t){var n=e.codePointAt(t);if(n>65535)t++;r+=4}return r},Xt=(e,r,t)=>{t=C(t);var n,i,a;if(r===2)n=zt,i=Yt,a=qt;else n=Gt,i=Jt,a=Kt;A(e,{name:t,fromWireType:(s)=>{var o=h[s>>2],l=n(s+4,o*r,!0);return k(s),l},toWireType:(s,o)=>{if(typeof o!="string")d(`Cannot pass non-string to C++ string type ${t}`);var l=a(o),u=Wr(4+l+r);if(h[u>>2]=l/r,i(o,u+4,l+r),s!==null)s.push(k,u);return u},readValueFromPointer:G,destructorFunction(s){k(s)}})},Zt=(e,r,t,n,i,a)=>{rr[e]={name:C(r),rawConstructor:E(t,n),rawDestructor:E(i,a),fields:[]}},Qt=(e,r,t,n,i,a,s,o,l,u)=>{rr[e].fields.push({fieldName:C(r),getterReturnType:t,getter:E(n,i),getterContext:a,setterArgumentType:s,setter:E(o,l),setterContext:u})},Nt=(e,r)=>{r=C(r),A(e,{isVoid:!0,name:r,fromWireType:()=>{return},toWireType:(t,n)=>{return}})},pe=0,Mt=()=>{mr=!1,pe=0},rn=9007199254740992,en=-9007199254740992,z=(e)=>e<en||e>rn?NaN:Number(e);function tn(e,r){e=z(e);var t=new Date(e*1000);_[r>>2]=t.getUTCSeconds(),_[r+4>>2]=t.getUTCMinutes(),_[r+8>>2]=t.getUTCHours(),_[r+12>>2]=t.getUTCDate(),_[r+16>>2]=t.getUTCMonth(),_[r+20>>2]=t.getUTCFullYear()-1900,_[r+24>>2]=t.getUTCDay();var n=Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0),i=(t.getTime()-n)/86400000|0;_[r+28>>2]=i}var nn=(e)=>e%4===0&&(e%100!==0||e%400===0),an=[0,31,60,91,121,152,182,213,244,274,305,335],sn=[0,31,59,90,120,151,181,212,243,273,304,334],on=(e)=>{var r=nn(e.getFullYear()),t=r?an:sn,n=t[e.getMonth()]+e.getDate()-1;return n};function fn(e,r){e=z(e);var t=new Date(e*1000);_[r>>2]=t.getSeconds(),_[r+4>>2]=t.getMinutes(),_[r+8>>2]=t.getHours(),_[r+12>>2]=t.getDate(),_[r+16>>2]=t.getMonth(),_[r+20>>2]=t.getFullYear()-1900,_[r+24>>2]=t.getDay();var n=on(t)|0;_[r+28>>2]=n,_[r+36>>2]=-(t.getTimezoneOffset()*60);var i=new Date(t.getFullYear(),0,1),a=new Date(t.getFullYear(),6,1).getTimezoneOffset(),s=i.getTimezoneOffset(),o=(a!=s&&t.getTimezoneOffset()==Math.min(s,a))|0;_[r+32>>2]=o}function ln(e,r,t,n,i,a,s){return i=z(i),-52}function un(e,r,t,n,i,a){a=z(a)}var X={},de=(e)=>{if(e instanceof yr||e=="unwind")return N;O(1,e)},ge=()=>mr||pe>0,he=(e)=>{if(N=e,!ge())f.onExit?.(e),Q=!0;O(e,new yr(e))},cn=(e,r)=>{N=e,he(e)},_e=cn,vn=()=>{if(!ge())try{_e(N)}catch(e){de(e)}},pn=(e)=>{if(Q)return;try{e(),vn()}catch(r){de(r)}},dn=()=>performance.now(),gn=(e,r)=>{if(X[e])clearTimeout(X[e].id),delete X[e];if(!r)return 0;var t=setTimeout(()=>{delete X[e],pn(()=>be(e,dn()))},r);return X[e]={id:t,timeout_ms:r},0},hn=(e,r,t,n)=>{var i=new Date().getFullYear(),a=new Date(i,0,1),s=new Date(i,6,1),o=a.getTimezoneOffset(),l=s.getTimezoneOffset(),u=Math.max(o,l);h[e>>2]=u*60,_[r>>2]=Number(o!=l);var c=(g)=>{var w=g>=0?"-":"+",P=Math.abs(g),T=String(Math.floor(P/60)).padStart(2,"0"),y=String(P%60).padStart(2,"0");return`UTC${w}${T}${y}`},v=c(o),p=c(l);if(l<o)x(v,t,17),x(p,n,17);else x(v,n,17),x(p,t,17)},_n=()=>Date.now(),ye=()=>2147483648,yn=()=>ye(),mn=(e,r)=>Math.ceil(e/r)*r,bn=(e)=>{var r=lr.buffer.byteLength,t=(e-r+65535)/65536|0;try{return lr.grow(t),xr(),1}catch(n){}},wn=(e)=>{var r=S.length;e>>>=0;var t=ye();if(e>t)return!1;for(var n=1;n<=4;n*=2){var i=r*(1+0.2/n);i=Math.min(i,e+100663296);var a=Math.min(t,mn(Math.max(e,i),65536)),s=bn(a);if(s)return!0}return!1},Er={},Tn=()=>F||"./this.program",Z=()=>{if(!Z.strings){var e=(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:Tn()};for(var t in Er)if(Er[t]===void 0)delete r[t];else r[t]=Er[t];var n=[];for(var t in r)n.push(`${t}=${r[t]}`);Z.strings=n}return Z.strings},$n=(e,r)=>{var t=0,n=0;for(var i of Z()){var a=r+t;h[e+n>>2]=a,t+=x(i,a,1/0)+1,n+=4}return 0},Cn=(e,r)=>{var t=Z();h[e>>2]=t.length;var n=0;for(var i of t)n+=ce(i)+1;return h[r>>2]=n,0},Pn=(e)=>52,Fn=(e,r)=>{var t=0,n=0,i=0;{var a=2;if(e==0)t=2;else if(e==1||e==2)t=64;i=1}return W[r]=a,L[r+2>>1]=i,M[r+8>>3]=BigInt(t),M[r+16>>3]=BigInt(n),0};function An(e,r,t,n,i){return n=z(n),52}var Sn=(e,r,t,n)=>52;function Rn(e,r,t,n){return r=z(r),70}var En=[null,[],[]],Wn=(e,r)=>{var t=En[e];if(r===0||r===10)(e===1?Lr:gr)(Nr(t)),t.length=0;else t.push(r)},kn=(e,r,t,n)=>{var i=0;for(var a=0;a<t;a++){var s=h[r>>2],o=h[r+4>>2];r+=8;for(var l=0;l<o;l++)Wn(e,S[s+l]);i+=o}return h[n>>2]=i,0};ct(),$t();{if(f.noExitRuntime)mr=f.noExitRuntime;if(f.print)Lr=f.print;if(f.printErr)gr=f.printErr;if(f.wasmBinary)hr=f.wasmBinary;if(f.arguments)b=f.arguments;if(f.thisProgram)F=f.thisProgram;if(f.preInit){if(typeof f.preInit=="function")f.preInit=[f.preInit];while(f.preInit.length>0)f.preInit.shift()()}}var Wr,k,me,be,Un,Dn,lr,we;function jn(e){Wr=e.ca,k=e.da,me=e.ea,be=e.fa,Un=lr=e.$,Dn=we=e.ba}var On={w:Ve,k:xe,P:ze,Q:Ye,N:qe,I:Ge,u:Je,J:Ke,K:Xe,z:Qe,t:Ne,M:Me,q:rt,s:et,R:tt,A:it,j:st,Y:ot,p:Pt,g:At,l:St,c:Rt,W:kt,_:Dt,d:Ot,i:Lt,b:Ht,a:Vt,X:xt,e:Xt,L:Zt,f:Qt,Z:Nt,x:Mt,D:tn,E:fn,B:ln,C:un,r:gn,F:hn,O:_n,n:yn,m:wn,T:$n,U:Cn,V:_e,h:Pn,H:Fn,y:An,v:Sn,G:Rn,o:kn,S:he};function In(){Ee();function e(){if(f.calledRun=!0,Q)return;We(),f.onRuntimeInitialized?.(),ke()}if(f.setStatus)f.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>f.setStatus(""),1),e()},1);else e()}var ur=Ie();return In(),f}var Y;function Pe(f){Y=f,pr=()=>{}}var Ce=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((f)=>{f.delete()});class Dr{constructor(){pr(),this._impl=new Y.ClangFormat,Ce.register(this,this._impl,this)}with_style(f){return this._impl.with_style(f),this}with_fallback_style(f){return this._impl.with_fallback_style(f),this}format(f,m="<stdin>"){let b=this._impl.format(f,m);return vr(b)??f}format_range(f,m,b,F="<stdin>"){let O=this._impl.format_range(f,F,m,b);return vr(O)??f}format_line(f,m,b,F="<stdin>"){let O=this._impl.format_line(f,F,m,b);return vr(O)??f}static version(){return pr(),Y.ClangFormat.version()}static dump_config({style:f="file",filename:m="<stdin>",code:b=""}={}){pr();let F=Y.ClangFormat.dump_config(f,m,b);return vr(F)}[Symbol.dispose](){if(this._impl)Ce.unregister(this),this._impl.delete(),this._impl=null}}function pr(){throw Error("uninit")}function vr(f){let{status:m,content:b}=f;if(m===Y.ResultStatus.Error)throw Error(b);if(m===Y.ResultStatus.Unchanged)return null;return b}function jr(f,m="<stdin>",b="LLVM"){let F=new Dr;try{return F.with_style(b).format(f,m)}finally{F[Symbol.dispose]()}}var q;async function Ln(f){if(typeof Response==="function"&&f instanceof Response){if(typeof WebAssembly.compileStreaming==="function")try{return await WebAssembly.compileStreaming(f)}catch(F){if(f.ok&&m(f.type)&&f.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.compileStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",F);else throw F}let b=await f.arrayBuffer();return await WebAssembly.compile(b)}else return await WebAssembly.compile(f);function m(b){switch(b){case"basic":case"cors":case"default":return!0}return!1}}async function Or(f){if(q!==void 0)return q;if(f===void 0)f=new URL("clang-format.wasm",import.meta.url);if(typeof f==="string"||typeof Request==="function"&&f instanceof Request||typeof URL==="function"&&f instanceof URL)f=fetch(f);let m=await Ln(await f);return q=Hn(m)}function Hn(f){return q=$e({wasm:f}),Pe(q),q}var Vn=[{id:"core",js:"/webui-fmt.js",entry:"fmt/fmt-core.ts"},{id:"ruff",js:"/webui-fmt-ruff.js",entry:"fmt/fmt-ruff.ts",wasm:{route:"/webui-fmt-ruff.wasm",pkg:"@wasm-fmt/ruff_fmt",file:"ruff_fmt_bg.wasm"}},{id:"gofmt",js:"/webui-fmt-gofmt.js",entry:"fmt/fmt-gofmt.ts",wasm:{route:"/webui-fmt-gofmt.wasm",pkg:"@wasm-fmt/gofmt",file:"gofmt.wasm"}},{id:"clang",js:"/webui-fmt-clang.js",entry:"fmt/fmt-clang.ts",wasm:{route:"/webui-fmt-clang.wasm",pkg:"@wasm-fmt/clang-format",file:"clang-format.wasm"}},{id:"lua",js:"/webui-fmt-lua.js",entry:"fmt/fmt-lua.ts",wasm:{route:"/webui-fmt-lua.wasm",pkg:"@wasm-fmt/lua_fmt",file:"lua_fmt_bg.wasm"}},{id:"taplo",js:"/webui-fmt-taplo.js",entry:"fmt/fmt-taplo.ts",wasm:{route:"/webui-fmt-taplo.wasm",pkg:"@wasm-fmt/taplo_fmt",file:"taplo_fmt_bg.wasm"}},{id:"sh",js:"/webui-fmt-sh.js",entry:"fmt/fmt-sh.ts"}];function Fe(f){return Vn.find((m)=>m.id===f)}var ni="mh-fmt-clang",Bn={c:"block.c",h:"block.h",cpp:"block.cc","c++":"block.cc",cc:"block.cc",hpp:"block.hpp",csharp:"block.cs",cs:"block.cs",java:"Block.java",objectivec:"block.m",objc:"block.m","objective-c":"block.m",protobuf:"block.proto",proto:"block.proto"},Ae=null;async function ii(f,m,b){return Ae??=Or(Fe("clang").wasm.route),await Ae,{text:jr(f,Bn[m]??"block.cc"),cursor:b}}export{ni as MARKER,ii as format};