@imagemagick/magick-wasm 0.0.35 → 0.0.36

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,4 +1,4 @@
1
- (function(S,ze){typeof exports=="object"&&typeof module<"u"?ze(exports):typeof define=="function"&&define.amd?define(["exports"],ze):(S=typeof globalThis<"u"?globalThis:S||self,ze(S["magick-wasm"]={}))})(this,function(S){"use strict";var ze=typeof document<"u"?document.currentScript:null;function $t(M){return M instanceof Int8Array||M instanceof Uint8Array||M instanceof Uint8ClampedArray}class Ht{fileName;data;constructor(e,n){this.fileName=e,this.data=n}}const Mi={XmlResourceFiles:{log:`<?xml version="1.0" encoding="UTF-8"?>
1
+ (function(y,$e){typeof exports=="object"&&typeof module<"u"?$e(exports):typeof define=="function"&&define.amd?define(["exports"],$e):(y=typeof globalThis<"u"?globalThis:y||self,$e(y["magick-wasm"]={}))})(this,function(y){"use strict";var $e=typeof document<"u"?document.currentScript:null;function Ht(k){return k instanceof Int8Array||k instanceof Uint8Array||k instanceof Uint8ClampedArray}class Yt{fileName;data;constructor(e,n){this.fileName=e,this.data=n}}const Mi={XmlResourceFiles:{log:`<?xml version="1.0" encoding="UTF-8"?>
2
2
  <!DOCTYPE logmap [
3
3
  <!ELEMENT logmap (log)+>
4
4
  <!ELEMENT log (#PCDATA)>
@@ -39,5 +39,5 @@
39
39
  <policy domain="path" rights="none" pattern="@*" />
40
40
  <policy domain="path" rights="none" pattern="|*" />
41
41
  </policymap>
42
- `}};class ft{constructor(){this.log=new Ht("log.xml",Mi.XmlResourceFiles.log),this.policy=new Ht("policy.xml",Mi.XmlResourceFiles.policy)}static default=new ft;*all(){yield this.log,yield this.policy}log;policy}class mt{constructor(e,n,i){this.format=e,this.name=n,this.value=i}format;name;value}class wi{format;constructor(e){this.format=e}createDefine(e,n){return typeof n=="boolean"?new mt(this.format,e,n?"true":"false"):typeof n=="string"?new mt(this.format,e,n):new mt(this.format,e,n.toString())}hasValue(e){return e!=null}}class Xr{_x;_y;_paintMethod;constructor(e,n,i){this._x=e,this._y=n,this._paintMethod=i}draw(e){e.color(this._x,this._y,this._paintMethod)}}class yi{_color;constructor(e){this._color=e}draw(e){e.fillColor(this._color)}}class Si{_opacity;constructor(e){this._opacity=e}draw(e){e.fillOpacity(this._opacity.toDouble()/100)}}class Ci{_pointSize;constructor(e){this._pointSize=e}draw(e){e.fontPointSize(this._pointSize)}}class Ii{constructor(e,n){this.eventType=e,this.message=n??""}eventType;message}const Pi={Undefined:0,Activate:1,Associate:2,Background:3,Copy:4,Deactivate:5,Discrete:6,Disassociate:7,Extract:8,Off:9,On:10,Opaque:11,Remove:12,Set:13,Shape:14,Transparent:15,OffIfOpaque:16},L={Red:0,Cyan:0,Gray:0,Green:1,Magenta:1,Blue:2,Yellow:2,Black:3,Alpha:4,Index:5,Meta0:10,Meta1:11,Meta2:12,Meta3:13,Meta4:14,Meta5:15,Meta6:16,Meta7:17,Meta8:18,Meta9:19,Meta10:20,Meta11:21,Meta12:22,Meta13:23,Meta14:24,Meta15:25,Meta16:26,Meta17:27,Meta18:28,Meta19:29,Meta20:30,Meta21:31,Meta22:32,Meta23:33,Meta24:34,Meta25:35,Meta26:36,Meta27:37,Meta28:38,Meta29:39,Meta30:40,Meta31:41,Meta32:42,Meta33:43,Meta34:44,Meta35:45,Meta36:46,Meta37:47,Meta38:48,Meta39:49,Meta40:50,Meta41:51,Meta42:52,Meta43:53,Meta44:54,Meta45:55,Meta46:56,Meta47:57,Meta48:58,Meta49:59,Meta50:60,Meta51:61,Meta52:62,Composite:64},X={Undefined:0,Red:1,Gray:1,Cyan:1,Green:2,Magenta:2,Blue:4,Yellow:4,Black:8,Alpha:16,Opacity:16,Index:32,Composite:31,TrueAlpha:256,get RGB(){return this.Red|this.Green|this.Blue},get CMYK(){return this.Cyan|this.Magenta|this.Yellow|this.Black},get CMYKA(){return this.Cyan|this.Magenta|this.Yellow|this.Black|this.Alpha},Meta0:1<<L.Meta0,Meta1:1<<L.Meta1,Meta2:1<<L.Meta2,Meta3:1<<L.Meta3,Meta4:1<<L.Meta4,Meta5:1<<L.Meta5,Meta6:1<<L.Meta6,Meta7:1<<L.Meta7,Meta8:1<<L.Meta8,Meta9:1<<L.Meta9,Meta10:1<<L.Meta10,Meta11:1<<L.Meta11,Meta12:1<<L.Meta12,Meta13:1<<L.Meta13,Meta14:1<<L.Meta14,Meta15:1<<L.Meta15,Meta16:1<<L.Meta16,Meta17:1<<L.Meta17,Meta18:1<<L.Meta18,Meta19:1<<L.Meta19,Meta20:1<<L.Meta20,Meta21:1<<L.Meta21,All:134217727};class Ei{constructor(e,n,i,l){this.red=e,this.green=n,this.blue=i,this.white=l}red;green;blue;white}const b={Undefined:0,CMY:1,CMYK:2,Gray:3,HCL:4,HCLp:5,HSB:6,HSI:7,HSL:8,HSV:9,HWB:10,Lab:11,LCH:12,LCHab:13,LCHuv:14,Log:15,LMS:16,Luv:17,OHTA:18,Rec601YCbCr:19,Rec709YCbCr:20,RGB:21,scRGB:22,sRGB:23,Transparent:24,XyY:25,XYZ:26,YCbCr:27,YCC:28,YDbDr:29,YIQ:30,YPbPr:31,YUV:32,LinearGray:33,Jzazbz:34,DisplayP3:35,Adobe98:36,ProPhoto:37,Oklab:38,Oklch:39,CAT02LMSC:40},Ut={[b.Undefined]:"Undefined",[b.CMY]:"CMY",[b.CMYK]:"CMYK",[b.Gray]:"Gray",[b.HCL]:"HCL",[b.HCLp]:"HCLp",[b.HSB]:"HSB",[b.HSI]:"HSI",[b.HSL]:"HSL",[b.HSV]:"HSV",[b.HWB]:"HWB",[b.Lab]:"Lab",[b.LCH]:"LCH",[b.LCHab]:"LCHab",[b.LCHuv]:"LCHuv",[b.Log]:"Log",[b.LMS]:"LMS",[b.Luv]:"Luv",[b.OHTA]:"OHTA",[b.Rec601YCbCr]:"Rec601YCbCr",[b.Rec709YCbCr]:"Rec709YCbCr",[b.RGB]:"RGB",[b.scRGB]:"scRGB",[b.sRGB]:"sRGB",[b.Transparent]:"Transparent",[b.XyY]:"XyY",[b.XYZ]:"XYZ",[b.YCbCr]:"YCbCr",[b.YCC]:"YCC",[b.YDbDr]:"YDbDr",[b.YIQ]:"YIQ",[b.YPbPr]:"YPbPr",[b.YUV]:"YUV",[b.LinearGray]:"LinearGray",[b.Jzazbz]:"Jzazbz",[b.DisplayP3]:"DisplayP3",[b.Adobe98]:"Adobe98",[b.ProPhoto]:"ProPhoto",[b.Oklab]:"Oklab",[b.Oklch]:"Oklch",[b.CAT02LMSC]:"CAT02LMS"};class qr{colorSpace=b.Undefined;copyright=null;description=null;manufacturer=null;model=null}class Kr{_data;_index;constructor(e){this._data=e,this._index=0,this.isLittleEndian=!1}get index(){return this._index}isLittleEndian;readLong(){return this.canRead(4)?this.isLittleEndian?this.readLongLSB():this.readLongMSB():null}readString(e){if(e==0)return"";if(!this.canRead(e))return null;let i=new TextDecoder("utf-8").decode(this._data.subarray(this._index,this._index+e));const l=i.indexOf("\0");return l!=-1&&(i=i.substring(0,l)),this._index+=e,i}seek(e){return e>=this._data.length?!1:(this._index=e,!0)}skip(e){return this._index+e>=this._data.length?!1:(this._index+=e,!0)}canRead(e){return e>this._data.length?!1:this._index+e<=this._data.length}readLongLSB(){let e=this._data[this._index];return e|=this._data[this._index+1]<<8,e|=this._data[this._index+2]<<16,e|=this._data[this._index+3]<<24,this._index+=4,e}readLongMSB(){let e=this._data[this._index]<<24;return e|=this._data[this._index+1]<<16,e|=this._data[this._index+2]<<8,e|=this._data[this._index+3],this._index+=4,e}}class jt{_data=new qr;_reader;constructor(e){this._reader=new Kr(e)}static read(e){const n=new jt(e);return n.readColorSpace(),n.readTagTable(),n._data}readColorSpace(){this._reader.seek(16);const e=this._reader.readString(4);e!=null&&(this._data.colorSpace=this.determineColorSpace(e.trimEnd()))}determineColorSpace(e){switch(e){case"CMY":return b.CMY;case"CMYK":return b.CMYK;case"GRAY":return b.Gray;case"HSL":return b.HSL;case"HSV":return b.HSV;case"Lab":return b.Lab;case"Luv":return b.Luv;case"RGB":return b.sRGB;case"XYZ":return b.XYZ;case"YCbr":return b.YCbCr;default:return b.Undefined}}readTagTable(){if(!this._reader.seek(128))return;const e=this._reader.readLong();if(e!=null)for(let n=0;n<e;n++)switch(this._reader.readLong()){case 1668313716:this._data.copyright=this.readTag();break;case 1684370275:this._data.description=this.readTag();break;case 1684893284:this._data.manufacturer=this.readTag();break;case 1684890724:this._data.model=this.readTag();break;default:this._reader.skip(8);break}}readTag(){const e=this._reader.readLong(),n=this._reader.readLong();if(e===null||n===null)return null;const i=this._reader.index;if(!this._reader.seek(e))return null;const l=this.readTagValue(n);return this._reader.seek(i),l}readTagValue(e){switch(this._reader.readString(4)){case"desc":return this.readTextDescriptionTypeValue();case"text":return this.readTextTypeValue(e);default:return null}}readTextDescriptionTypeValue(){if(!this._reader.skip(4))return null;const e=this._reader.readLong();return e==null?null:this._reader.readString(e)}readTextTypeValue(e){return this._reader.skip(4)?this._reader.readString(e):null}}class Yt{constructor(e,n){this.name=e,this.data=n}name;data}class Di extends Yt{_data;constructor(e){super("icc",e)}get colorSpace(){return this.initialize(),this._data.colorSpace}get copyright(){return this.initialize(),this._data.copyright}get description(){return this.initialize(),this._data.description}get manufacturer(){return this.initialize(),this._data.manufacturer}get model(){return this.initialize(),this._data.model}initialize(){this._data||(this._data=jt.read(this.data))}}const Vt={HighRes:0,Quantum:1};class pt{constructor(e,n){this.distortion=e,this.difference=n}difference;distortion;static _create(e,n){return new pt(e,n)}}class bi{constructor(e){this.metric=e}metric;highlightColor;lowlightColor;masklightColor;_setArtifacts(e){this.highlightColor!==void 0&&e.setArtifact("compare:highlight-color",this.highlightColor),this.lowlightColor!==void 0&&e.setArtifact("compare:lowlight-color",this.lowlightColor),this.masklightColor!==void 0&&e.setArtifact("compare:masklight-color",this.masklightColor)}}const vt={Undefined:0,Alpha:1,Atop:2,Blend:3,Blur:4,Bumpmap:5,ChangeMask:6,Clear:7,ColorBurn:8,ColorDodge:9,Colorize:10,CopyBlack:11,CopyBlue:12,Copy:13,CopyCyan:14,CopyGreen:15,CopyMagenta:16,CopyAlpha:17,CopyRed:18,CopyYellow:19,Darken:20,DarkenIntensity:21,Difference:22,Displace:23,Dissolve:24,Distort:25,DivideDst:26,DivideSrc:27,DstAtop:28,Dst:29,DstIn:30,DstOut:31,DstOver:32,Exclusion:33,HardLight:34,HardMix:35,Hue:36,In:37,Intensity:38,Lighten:39,LightenIntensity:40,LinearBurn:41,LinearDodge:42,LinearLight:43,Luminize:44,Mathematics:45,MinusDst:46,MinusSrc:47,Modulate:48,ModulusAdd:49,ModulusSubtract:50,Multiply:51,No:52,Out:53,Over:54,Overlay:55,PegtopLight:56,PinLight:57,Plus:58,Replace:59,Saturate:60,Screen:61,SoftLight:62,SrcAtop:63,Src:64,SrcIn:65,SrcOut:66,SrcOver:67,Threshold:68,VividLight:69,Xor:70,Stereo:71,Freeze:72,Interpolate:73,Negate:74,Reflect:75,SoftBurn:76,SoftDodge:77,Stamp:78,RMSE:79,SaliencyBlend:80,SeamlessBlend:81},kt={Warning:300,ResourceLimitWarning:300,TypeWarning:305,OptionWarning:310,DelegateWarning:315,MissingDelegateWarning:320,CorruptImageWarning:325,FileOpenWarning:330,BlobWarning:335,StreamWarning:340,CacheWarning:345,CoderWarning:350,FilterWarning:352,ModuleWarning:355,DrawWarning:360,ImageWarning:365,WandWarning:370,RandomWarning:375,XServerWarning:380,MonitorWarning:385,RegistryWarning:390,ConfigureWarning:395,PolicyWarning:399,Error:400,ResourceLimitError:400,TypeError:405,OptionError:410,DelegateError:415,MissingDelegateError:420,CorruptImageError:425,FileOpenError:430,BlobError:435,StreamError:440,CacheError:445,CoderError:450,FilterError:452,ModuleError:455,DrawError:460,ImageError:465,WandError:470,RandomError:475,XServerError:480,MonitorError:485,RegistryError:490,ConfigureError:495,PolicyError:499};class N extends Error{_relatedErrors=[];constructor(e,n=kt.Error){super(e),this.severity=n}severity;get relatedErrors(){return this._relatedErrors}_setRelatedErrors(e){this._relatedErrors=e}}class Fe{static get depth(){return _._api._Quantum_Depth_Get()}static get max(){return _._api._Quantum_Max_Get()}}function le(M,e){return M===0?e??null:_._api.UTF8ToString(M)}function Qr(M,e){const n=le(e);return M._MagickMemory_Relinquish(e),n}function Xt(M,e,n){const i=M.lengthBytesUTF8(e)+1,l=M._malloc(i);try{return M.stringToUTF8(e,l,i),n(l)}finally{M._free(l)}}function R(M,e){return M===null?e(0):Xt(_._api,M,e)}class k{constructor(e,n,i,l,d){if(e!==void 0)if(typeof e=="string"){let m=0;try{m=_._api._MagickColor_Create(),R(e,v=>{if(_._api._MagickColor_Initialize(m,v)===0)throw new N("invalid color specified");this.initialize(m)})}finally{_._api._free(m)}}else this.r=e,this.g=n??0,this.b=i??0,d===void 0?this.a=l??Fe.max:(this.k=l??0,this.a=d,this.isCmyk=!0)}r=0;g=0;b=0;a=0;k=0;isCmyk=!1;static _create(e){const n=new k;return n.initialize(e),n}toShortString(){return this.a!==Fe.max?this.toString():this.isCmyk?`cmyka(${this.r},${this.g},${this.b},${this.k})`:`#${this.toHex(this.r)}${this.toHex(this.g)}${this.toHex(this.b)}`}toString(){return this.isCmyk?`cmyka(${this.r},${this.g},${this.b},${this.k},${(this.a/Fe.max).toFixed(4)})`:`#${this.toHex(this.r)}${this.toHex(this.g)}${this.toHex(this.b)}${this.toHex(this.a)}`}_use(e){let n=0;try{n=_._api._MagickColor_Create(),_._api._MagickColor_Red_Set(n,this.r),_._api._MagickColor_Green_Set(n,this.g),_._api._MagickColor_Blue_Set(n,this.b),_._api._MagickColor_Alpha_Set(n,this.a),_._api._MagickColor_IsCMYK_Set(n,this.isCmyk?1:0),e(n)}finally{_._api._free(n)}}initialize(e){this.r=_._api._MagickColor_Red_Get(e),this.g=_._api._MagickColor_Green_Get(e),this.b=_._api._MagickColor_Blue_Get(e),this.a=_._api._MagickColor_Alpha_Get(e),this.isCmyk=_._api._MagickColor_IsCMYK_Get(e)===1}toHex(e){return e.toString(16).padStart(2,"0")}}var Ce=(M=>(M[M.NoValue=0]="NoValue",M[M.PercentValue=4096]="PercentValue",M[M.IgnoreAspectRatio=8192]="IgnoreAspectRatio",M[M.Less=16384]="Less",M[M.Greater=32768]="Greater",M[M.FillArea=65536]="FillArea",M[M.LimitPixels=131072]="LimitPixels",M[M.AspectRatio=1048576]="AspectRatio",M))(Ce||{});class ne{_includeXyInToString;_width=0;_height=0;_x=0;_y=0;_aspectRatio=!1;_fillArea=!1;_greater=!1;_isPercentage=!1;_ignoreAspectRatio=!1;_less=!1;_limitPixels=!1;constructor(e,n,i,l){if(typeof e=="number"){if(i!==void 0&&l!==void 0?(this._width=i,this._height=l,this._x=e,this._y=n??0,this._includeXyInToString=!0):(this._width=e,this._height=n??this._width,this._x=0,this._y=0,this._includeXyInToString=!1),this._width<0)throw new N("negative width is not allowed");if(this._height<0)throw new N("negative height is not allowed")}else{this._includeXyInToString=e.indexOf("+")>=0||e.indexOf("-")>=0;const d=_._api._MagickGeometry_Create();try{R(e,m=>{const v=_._api._MagickGeometry_Initialize(d,m);if(v===Ce.NoValue)throw new N("invalid geometry specified");this.hasFlag(v,Ce.AspectRatio)?this.initializeFromAspectRation(d,e):this.initialize(d,v)})}finally{_._api._MagickGeometry_Dispose(d)}}}get aspectRatio(){return this._aspectRatio}get fillArea(){return this._fillArea}set fillArea(e){this._fillArea=e}get greater(){return this._greater}set greater(e){this._greater=e}get height(){return this._height}set height(e){this._height=e}get ignoreAspectRatio(){return this._ignoreAspectRatio}set ignoreAspectRatio(e){this._ignoreAspectRatio=e}get isPercentage(){return this._isPercentage}set isPercentage(e){this._isPercentage=e}get less(){return this._less}set less(e){this._less=e}get limitPixels(){return this._limitPixels}set limitPixels(e){this._limitPixels=e}get width(){return this._width}set width(e){this._width=e}get x(){return this._x}set x(e){this._x=e}get y(){return this._y}set y(e){this._y=e}toString(){if(this._aspectRatio)return this._width+":"+this._height;let e="";return this._width==0&&this._height==0?e+="0x0":(this._width>0&&(e+=this._width.toString()),this._height>0?e+="x"+this._height.toString():e+="x"),(this._x!=0||this._y!=0||this._includeXyInToString)&&(this._x>=0&&(e+="+"),e+=this._x,this.y>=0&&(e+="+"),e+=this.y),this._fillArea&&(e+="^"),this._greater&&(e+=">"),this._isPercentage&&(e+="%"),this._ignoreAspectRatio&&(e+="!"),this._less&&(e+="<"),this._limitPixels&&(e+="@"),e}static _fromRectangle(e){if(e===0)throw new N("unable to allocate memory");try{const n=_._api._MagickRectangle_Width_Get(e),i=_._api._MagickRectangle_Height_Get(e),l=_._api._MagickRectangle_X_Get(e),d=_._api._MagickRectangle_Y_Get(e);return new ne(l,d,n,i)}finally{_._api._MagickRectangle_Dispose(e)}}_toRectangle(e){const n=_._api._MagickRectangle_Create();if(n===0)throw new N("unable to allocate memory");try{return _._api._MagickRectangle_Width_Set(n,this._width),_._api._MagickRectangle_Height_Set(n,this._height),_._api._MagickRectangle_X_Set(n,this._x),_._api._MagickRectangle_Y_Set(n,this._y),e(n)}finally{_._api._MagickRectangle_Dispose(n)}}initialize(e,n){this._width=_._api._MagickGeometry_Width_Get(e),this._height=_._api._MagickGeometry_Height_Get(e),this._x=_._api._MagickGeometry_X_Get(e),this._y=_._api._MagickGeometry_Y_Get(e),this._ignoreAspectRatio=this.hasFlag(n,Ce.IgnoreAspectRatio),this._isPercentage=this.hasFlag(n,Ce.PercentValue),this._fillArea=this.hasFlag(n,Ce.FillArea),this._greater=this.hasFlag(n,Ce.Greater),this._less=this.hasFlag(n,Ce.Less),this._limitPixels=this.hasFlag(n,Ce.LimitPixels)}initializeFromAspectRation(e,n){this._aspectRatio=!0;const i=n.split(":");this._width=this.parseNumber(i[0]),this._height=this.parseNumber(i[1]),this._x=_._api._MagickGeometry_X_Get(e),this._y=_._api._MagickGeometry_Y_Get(e)}parseNumber(e){let n=0;for(;n<e.length&&!this.isNumber(e[n]);)n++;const i=n;for(;n<e.length&&this.isNumber(e[n]);)n++;return parseInt(e.substr(i,n-i))}isNumber(e){return e>="0"&&e<="9"}hasFlag(e,n){return(e&n)===n}}class ve{constructor(e,n){this.x=e,this.y=n??e}x;y;static _create(e){return e===0?new ve(0,0):new ve(_._api._PointInfo_X_Get(e),_._api._PointInfo_Y_Get(e))}}class Mt{constructor(e){this.area=_._api._ConnectedComponent_GetArea(e),this.centroid=ve._create(_._api._ConnectedComponent_GetCentroid(e)),this.color=k._create(_._api._ConnectedComponent_GetColor(e)),this.height=_._api._ConnectedComponent_GetHeight(e),this.id=_._api._ConnectedComponent_GetId(e),this.width=_._api._ConnectedComponent_GetWidth(e),this.x=_._api._ConnectedComponent_GetX(e),this.y=_._api._ConnectedComponent_GetY(e)}area;centroid;color;height;id;width;x;y;static _create(e,n){const i=[];if(e===0)return i;for(let l=0;l<n;l++){const d=_._api._ConnectedComponent_GetInstance(e,l);d===0||_._api._ConnectedComponent_GetArea(d)<Number.EPSILON||i.push(new Mt(d))}return i}toGeometry(){return new ne(this.x,this.y,this.width,this.height)}}class Ti{angleThreshold;areaThreshold;circularityThreshold;connectivity;diameterThreshold;eccentricityThreshold;majorAxisThreshold;meanColor;minorAxisThreshold;perimeterThreshold;constructor(e){this.connectivity=e}_setArtifacts(e){this.angleThreshold!==void 0&&e.setArtifact("connected-components:angle-threshold",this.angleThreshold.toString()),this.areaThreshold!==void 0&&e.setArtifact("connected-components:area-threshold",this.areaThreshold.toString()),this.circularityThreshold!==void 0&&e.setArtifact("connected-components:circularity-threshold",this.circularityThreshold.toString()),this.diameterThreshold!==void 0&&e.setArtifact("connected-components:diameter-threshold",this.diameterThreshold.toString()),this.eccentricityThreshold!==void 0&&e.setArtifact("connected-components:eccentricity-threshold",this.eccentricityThreshold.toString()),this.majorAxisThreshold!==void 0&&e.setArtifact("connected-components:major-axis-threshold",this.majorAxisThreshold.toString()),this.meanColor!==void 0&&e.setArtifact("connected-components:mean-color",this.meanColor.toString()),this.minorAxisThreshold!==void 0&&e.setArtifact("connected-components:minor-axis-threshold",this.minorAxisThreshold.toString()),this.perimeterThreshold!==void 0&&e.setArtifact("connected-components:perimeter-threshold",this.perimeterThreshold.toString())}}const xe={Undefined:0,PixelsPerInch:1,PixelsPerCentimeter:2};class $e{constructor(e,n,i){n===void 0?(this.x=e,this.y=e,this.units=xe.PixelsPerInch):i!==void 0?(this.x=e,this.y=n,this.units=i):(this.x=e,this.y=e,this.units=n)}x;y;units;toString(e){return e==this.units||e===xe.Undefined||e===void 0?$e.toString(this.x,this.y,e??xe.Undefined):this.units==xe.PixelsPerCentimeter&&e==xe.PixelsPerInch?$e.toString(this.x*2.54,this.y*2.54,e):$e.toString(this.x/2.54,this.y/2.54,e)}static toString(e,n,i){let l=`${e}x${n}`;switch(i){case xe.PixelsPerCentimeter:l+="cm";break;case xe.PixelsPerInch:l+="inch";break}return l}}class _e{static _disposeAfterExecution(e,n){try{const i=n(e);return i instanceof Promise?Promise.resolve(i).then(l=>(e.dispose(),_e.checkResult(e,l),l)):(e.dispose(),_e.checkResult(e,i),i)}catch(i){throw e.dispose(),i}}static checkResult(e,n){if(n===e)throw new N("The result of the function cannot be the instance that has been disposed.");return n}}class Ai{_pointer;_bytes;_func;constructor(e,n,i){this._pointer=e,this._func=i,this._bytes=_._api.HEAPU8.subarray(e,e+n)}func(e){return e._bytes===void 0?e._func(new Uint8Array):e._func(e._bytes)}dispose(){this._pointer=_._api._MagickMemory_Relinquish(this._pointer)}}class Le{disposeMethod;instance;constructor(e,n){this.instance=e,this.disposeMethod=n}get _instance(){if(this.instance>0)return this.instance;throw this.instance===-1&&this._instanceNotInitialized(),new N("instance is disposed")}set _instance(e){this.disposeInstance(this.instance),this.instance=e}dispose(){this.instance=this.disposeInstance(this.instance)}_instanceNotInitialized(){throw new N("instance is not initialized")}_setInstance(e,n){return n.check(()=>this.instance===0?!1:(this.dispose(),this.instance=e,!0),()=>(this.disposeInstance(e),!0))}disposeInstance(e){return e>0&&(this.onDispose!==void 0&&this.onDispose(),this.disposeMethod(e)),0}}class Jr extends Le{constructor(e){const n=_._api._DrawingSettings_Create(),i=_._api._DrawingSettings_Dispose;if(super(n,i),e.fillColor!==void 0&&e.fillColor._use(l=>{_._api._DrawingSettings_FillColor_Set(this._instance,l)}),e.font!==void 0){const l=we._getFontFileName(e.font);R(l,d=>{_._api._DrawingSettings_Font_Set(this._instance,d)})}e.fontPointsize!==void 0&&_._api._DrawingSettings_FontPointsize_Set(this._instance,e.fontPointsize),e.strokeColor!==void 0&&e.strokeColor._use(l=>{_._api._DrawingSettings_StrokeColor_Set(this._instance,l)}),e.strokeWidth!==void 0&&_._api._DrawingSettings_StrokeWidth_Set(this._instance,e.strokeWidth)}}class wt{backgroundColor;fillColor;font;fontPointsize;strokeColor;strokeWidth;static _create(e){const n=new wt;return n.fillColor=e.fillColor,n.font=e.font,n.fontPointsize=e.fontPointsize,n.strokeColor=e.strokeColor,n.strokeWidth=e.strokeWidth,n}_use(e){const n=new Jr(this);return _e._disposeAfterExecution(n,e)}}class Ri{instance;type;constructor(e,n){this.instance=_._api._malloc(e),this.type=n,_._api.setValue(this.instance,0,this.type)}get ptr(){return this.instance}get value(){return _._api.getValue(this.instance,this.type)}}class Ie extends Ri{constructor(){super(4,"i32")}static use(e){const n=new Ie;try{return e(n)}finally{_._api._free(n.ptr)}}}class A{pointer;constructor(e){this.pointer=e}get ptr(){return this.pointer.ptr}check(e,n){return this.isError()?n():e()}static usePointer(e,n){return Ie.use(i=>{const l=e(i.ptr);return A.checkException(i,l,n)})}static use(e,n){return Ie.use(i=>{const l=e(new A(i));return A.checkException(i,l,n)})}static checkException(e,n,i){if(!A.isRaised(e))return n;const l=A.getErrorSeverity(e.value);if(l>=kt.Error)A.throw(e,l);else if(i!==void 0){const d=A.createError(e.value,l);i(d)}else A.dispose(e);return n}isError(){return A.isRaised(this.pointer)?A.getErrorSeverity(this.pointer.value)>=kt.Error:!1}static getErrorSeverity(e){return _._api._MagickExceptionHelper_Severity(e)}static isRaised(e){return e.value!==0}static throw(e,n){const i=A.createError(e.value,n);throw A.dispose(e),i}static createError(e,n){const i=A.getMessage(e),l=new N(i,n),d=_._api._MagickExceptionHelper_RelatedCount(e);if(d===0)return l;const m=[];for(let v=0;v<d;v++){const C=_._api._MagickExceptionHelper_Related(e,v),F=A.getErrorSeverity(C),z=A.createError(C,F);m.push(z)}return l._setRelatedErrors(m),l}static getMessage(e){const n=_._api._MagickExceptionHelper_Message(e),i=_._api._MagickExceptionHelper_Description(e);let l=le(n,"Unknown error");return i!==0&&(l+=`(${_._api.UTF8ToString(i)})`),l}static dispose(e){_._api._MagickExceptionHelper_Dispose(e.value)}}class yt{constructor(e,n,i,l,d,m,v){this.ascent=e,this.descent=n,this.maxHorizontalAdvance=i,this.textHeight=l,this.textWidth=d,this.underlinePosition=m,this.underlineThickness=v}ascent;descent;maxHorizontalAdvance;textHeight;textWidth;underlinePosition;underlineThickness;static _create(e){if(e==0)return null;try{const n=_._api._TypeMetric_Ascent_Get(e),i=_._api._TypeMetric_Descent_Get(e),l=_._api._TypeMetric_MaxHorizontalAdvance_Get(e),d=_._api._TypeMetric_TextHeight_Get(e),m=_._api._TypeMetric_TextWidth_Get(e),v=_._api._TypeMetric_UnderlinePosition_Get(e),C=_._api._TypeMetric_UnderlineThickness_Get(e);return new yt(n,i,l,d,m,v,C)}finally{_._api._TypeMetric_Dispose(e)}}}class st extends Le{constructor(e,n){const l=wt._create(n)._use(m=>_._api._DrawingWand_Create(e._instance,m._instance)),d=_._api._DrawingWand_Dispose;super(l,d)}color(e,n,i){A.usePointer(l=>{_._api._DrawingWand_Color(this._instance,e,n,i,l)})}draw(e){e.forEach(n=>{n.draw(this)}),A.usePointer(n=>{_._api._DrawingWand_Render(this._instance,n)})}fillColor(e){A.usePointer(n=>{e._use(i=>{_._api._DrawingWand_FillColor(this._instance,i,n)})})}fillOpacity(e){A.usePointer(n=>{_._api._DrawingWand_FillOpacity(this._instance,e,n)})}font(e){A.usePointer(n=>{R(e,i=>{_._api._DrawingWand_Font(this._instance,i,n)})})}fontPointSize(e){A.usePointer(n=>{_._api._DrawingWand_FontPointSize(this._instance,e,n)})}fontTypeMetrics(e,n){return A.usePointer(i=>R(e,l=>{const d=_._api._DrawingWand_FontTypeMetrics(this._instance,l,n?1:0,i);return yt._create(d)}))}gravity(e){A.usePointer(n=>{_._api._DrawingWand_Gravity(this._instance,e,n)})}line(e,n,i,l){A.usePointer(d=>{_._api._DrawingWand_Line(this._instance,e,n,i,l,d)})}point(e,n){A.usePointer(i=>{_._api._DrawingWand_Point(this._instance,e,n,i)})}rectangle(e,n,i,l){A.usePointer(d=>{_._api._DrawingWand_Rectangle(this._instance,e,n,i,l,d)})}roundRectangle(e,n,i,l,d,m){A.usePointer(v=>{_._api._DrawingWand_RoundRectangle(this._instance,e,n,i,l,d,m,v)})}strokeColor(e){A.usePointer(n=>{e._use(i=>{_._api._DrawingWand_StrokeColor(this._instance,i,n)})})}strokeWidth(e){A.usePointer(n=>{_._api._DrawingWand_StrokeWidth(this._instance,e,n)})}text(e,n,i){A.usePointer(l=>{R(i,d=>{_._api._DrawingWand_Text(this._instance,e,n,d,l)})})}textAlignment(e){A.usePointer(n=>{_._api._DrawingWand_TextAlignment(this._instance,e,n)})}textAntialias(e){A.usePointer(n=>{_._api._DrawingWand_TextAntialias(this._instance,e?1:0,n)})}textDecoration(e){A.usePointer(n=>{_._api._DrawingWand_TextDecoration(this._instance,e,n)})}textInterlineSpacing(e){A.usePointer(n=>{_._api._DrawingWand_TextInterlineSpacing(this._instance,e,n)})}textInterwordspacing(e){A.usePointer(n=>{_._api._DrawingWand_TextInterwordSpacing(this._instance,e,n)})}textKerning(e){A.usePointer(n=>{_._api._DrawingWand_TextKerning(this._instance,e,n)})}textUnderColor(e){A.usePointer(n=>{e._use(i=>{_._api._DrawingWand_TextUnderColor(this._instance,i,n)})})}static _use(e,n){const i=new st(e,e.settings);return _e._disposeAfterExecution(i,n)}}class qt extends Ri{constructor(){super(8,"double")}static use(e){const n=new qt;try{return e(n)}finally{_._api._free(n.ptr)}}}const ue={Undefined:0,Forget:0,Northwest:1,North:2,Northeast:3,West:4,Center:5,East:6,Southwest:7,South:8,Southeast:9};function*Gi(M){for(const e of M)switch(e){case ue.North:yield"north";break;case ue.Northeast:yield"north",yield"east";break;case ue.Northwest:yield"north",yield"west";break;case ue.East:yield"east";break;case ue.West:yield"west";break;case ue.South:yield"south";break;case ue.Southeast:yield"south",yield"east";break;case ue.Southwest:yield"south",yield"west"}}class ot{constructor(e,n,i){this.meanErrorPerPixel=e,this.normalizedMeanError=n,this.normalizedMaximumError=i}meanErrorPerPixel;normalizedMaximumError;normalizedMeanError;static _create(e){const n=_._api._MagickImage_MeanErrorPerPixel_Get(e._instance),i=_._api._MagickImage_NormalizedMeanError_Get(e._instance),l=_._api._MagickImage_NormalizedMaximumError_Get(e._instance);return new ot(n,i,l)}}const Pe={Unknown:"UNKNOWN",ThreeFr:"3FR",ThreeG2:"3G2",ThreeGp:"3GP",A:"A",Aai:"AAI",Ai:"AI",APng:"APNG",Art:"ART",Arw:"ARW",Ashlar:"ASHLAR",Avci:"AVCI",Avi:"AVI",Avif:"AVIF",Avs:"AVS",B:"B",Bayer:"BAYER",Bayera:"BAYERA",Bgr:"BGR",Bgra:"BGRA",Bgro:"BGRO",Bmp:"BMP",Bmp2:"BMP2",Bmp3:"BMP3",Brf:"BRF",C:"C",Cal:"CAL",Cals:"CALS",Canvas:"CANVAS",Caption:"CAPTION",Cin:"CIN",Cip:"CIP",Clip:"CLIP",Cmyk:"CMYK",Cmyka:"CMYKA",Cr2:"CR2",Cr3:"CR3",Crw:"CRW",Cube:"CUBE",Cur:"CUR",Cut:"CUT",Data:"DATA",Dcm:"DCM",Dcr:"DCR",Dcraw:"DCRAW",Dcx:"DCX",Dds:"DDS",Dfont:"DFONT",Dng:"DNG",Dpx:"DPX",Dxt1:"DXT1",Dxt5:"DXT5",Epdf:"EPDF",Epi:"EPI",Eps:"EPS",Eps2:"EPS2",Eps3:"EPS3",Epsf:"EPSF",Epsi:"EPSI",Ept:"EPT",Ept2:"EPT2",Ept3:"EPT3",Erf:"ERF",Exr:"EXR",Farbfeld:"FARBFELD",Fax:"FAX",Ff:"FF",Fff:"FFF",File:"FILE",Fits:"FITS",Fl32:"FL32",Flv:"FLV",Fractal:"FRACTAL",Ftp:"FTP",Fts:"FTS",Ftxt:"FTXT",G:"G",G3:"G3",G4:"G4",Gif:"GIF",Gif87:"GIF87",Gradient:"GRADIENT",Gray:"GRAY",Graya:"GRAYA",Group4:"GROUP4",Hald:"HALD",Hdr:"HDR",Heic:"HEIC",Heif:"HEIF",Histogram:"HISTOGRAM",Hrz:"HRZ",Htm:"HTM",Html:"HTML",Http:"HTTP",Https:"HTTPS",Icb:"ICB",Ico:"ICO",Icon:"ICON",Iiq:"IIQ",Info:"INFO",Inline:"INLINE",Ipl:"IPL",Isobrl:"ISOBRL",Isobrl6:"ISOBRL6",J2c:"J2C",J2k:"J2K",Jng:"JNG",Jnx:"JNX",Jp2:"JP2",Jpc:"JPC",Jpe:"JPE",Jpeg:"JPEG",Jpg:"JPG",Jpm:"JPM",Jps:"JPS",Jpt:"JPT",Json:"JSON",Jxl:"JXL",K:"K",K25:"K25",Kdc:"KDC",Label:"LABEL",M:"M",M2v:"M2V",M4v:"M4V",Mac:"MAC",Map:"MAP",Mask:"MASK",Mat:"MAT",Matte:"MATTE",Mdc:"MDC",Mef:"MEF",Miff:"MIFF",Mkv:"MKV",Mng:"MNG",Mono:"MONO",Mov:"MOV",Mos:"MOS",Mp4:"MP4",Mpc:"MPC",Mpeg:"MPEG",Mpg:"MPG",Mpo:"MPO",Mrw:"MRW",Msl:"MSL",Msvg:"MSVG",Mtv:"MTV",Mvg:"MVG",Nef:"NEF",Nrw:"NRW",Null:"NULL",O:"O",Ora:"ORA",Orf:"ORF",Otb:"OTB",Otf:"OTF",Pal:"PAL",Palm:"PALM",Pam:"PAM",Pango:"PANGO",Pattern:"PATTERN",Pbm:"PBM",Pcd:"PCD",Pcds:"PCDS",Pcl:"PCL",Pct:"PCT",Pcx:"PCX",Pdb:"PDB",Pdf:"PDF",Pdfa:"PDFA",Pef:"PEF",Pes:"PES",Pfa:"PFA",Pfb:"PFB",Pfm:"PFM",Pgm:"PGM",Pgx:"PGX",Phm:"PHM",Picon:"PICON",Pict:"PICT",Pix:"PIX",Pjpeg:"PJPEG",Plasma:"PLASMA",Png:"PNG",Png00:"PNG00",Png24:"PNG24",Png32:"PNG32",Png48:"PNG48",Png64:"PNG64",Png8:"PNG8",Pnm:"PNM",Pocketmod:"POCKETMOD",Ppm:"PPM",Ps:"PS",Ps2:"PS2",Ps3:"PS3",Psb:"PSB",Psd:"PSD",Ptif:"PTIF",Pwp:"PWP",Qoi:"QOI",R:"R",RadialGradient:"RADIAL-GRADIENT",Raf:"RAF",Ras:"RAS",Raw:"RAW",Rgb:"RGB",Rgb565:"RGB565",Rgba:"RGBA",Rgbo:"RGBO",Rgf:"RGF",Rla:"RLA",Rle:"RLE",Rmf:"RMF",Rw2:"RW2",Rwl:"RWL",Scr:"SCR",Screenshot:"SCREENSHOT",Sct:"SCT",Sfw:"SFW",Sgi:"SGI",Shtml:"SHTML",Six:"SIX",Sixel:"SIXEL",SparseColor:"SPARSE-COLOR",Sr2:"SR2",Srf:"SRF",Srw:"SRW",Stegano:"STEGANO",Sti:"STI",StrImg:"STRIMG",Sun:"SUN",Svg:"SVG",Svgz:"SVGZ",Text:"TEXT",Tga:"TGA",Thumbnail:"THUMBNAIL",Tif:"TIF",Tiff:"TIFF",Tiff64:"TIFF64",Tile:"TILE",Tim:"TIM",Tm2:"TM2",Ttc:"TTC",Ttf:"TTF",Txt:"TXT",Ubrl:"UBRL",Ubrl6:"UBRL6",Uil:"UIL",Uyvy:"UYVY",Vda:"VDA",Vicar:"VICAR",Vid:"VID",Viff:"VIFF",Vips:"VIPS",Vst:"VST",WebM:"WEBM",WebP:"WEBP",Wbmp:"WBMP",Wmv:"WMV",Wpg:"WPG",X3f:"X3F",Xbm:"XBM",Xc:"XC",Xcf:"XCF",Xpm:"XPM",Xps:"XPS",Xv:"XV",Y:"Y",Yaml:"YAML",Ycbcr:"YCBCR",Ycbcra:"YCBCRA",Yuv:"YUV"},St={Merge:13,Flatten:14,Mosaic:15,Trimbounds:16};class Fi extends Le{constructor(e){const n=_._api._MagickSettings_Create(),i=_._api._MagickSettings_Dispose;if(super(n,i),e._fileName!==void 0&&R(e._fileName,l=>{_._api._MagickSettings_SetFileName(this._instance,l)}),e._ping&&_._api._MagickSettings_SetPing(this._instance,1),e._quality!==void 0&&_._api._MagickSettings_SetQuality(this._instance,e._quality),e.antiAlias!==void 0&&_._api._MagickSettings_AntiAlias_Set(this._instance,e.antiAlias?1:0),e.backgroundColor!==void 0&&e.backgroundColor._use(l=>{_._api._MagickSettings_BackgroundColor_Set(this._instance,l)}),e.colorSpace!==void 0&&_._api._MagickSettings_ColorSpace_Set(this._instance,e.colorSpace),e.colorType!==void 0&&_._api._MagickSettings_ColorType_Set(this._instance,e.colorType),e.compression!==void 0&&_._api._MagickSettings_Compression_Set(this._instance,e.compression),e.debug!==void 0&&_._api._MagickSettings_Debug_Set(this._instance,e.debug?1:0),e.density!==void 0){const l=e.density.toString();R(l,d=>{_._api._MagickSettings_Density_Set(this._instance,d)})}if(e.depth!==void 0&&_._api._MagickSettings_Depth_Set(this._instance,e.depth),e.endian!==void 0&&_._api._MagickSettings_Endian_Set(this._instance,e.endian),e.fillColor!==void 0&&this.setOption("fill",e.fillColor.toString()),e.font!==void 0){const l=we._getFontFileName(e.font);R(l,d=>{_._api._MagickSettings_SetFont(this._instance,d)})}e.fontPointsize!==void 0&&_._api._MagickSettings_FontPointsize_Set(this._instance,e.fontPointsize),e.format!==void 0&&R(e.format,l=>{_._api._MagickSettings_Format_Set(this._instance,l)}),e.interlace!==void 0&&_._api._MagickSettings_Interlace_Set(this._instance,e.interlace),e.strokeColor!==void 0&&this.setOption("stroke",e.strokeColor.toString()),e.strokeWidth!==void 0&&this.setOption("strokeWidth",e.strokeWidth.toString()),e.textInterlineSpacing!==void 0&&this.setOption("interline-spacing",e.textInterlineSpacing.toString()),e.textKerning!==void 0&&this.setOption("kerning",e.textKerning.toString());for(const l in e._options)this.setOption(l,e._options[l])}setOption(e,n){R(e,i=>{R(n,l=>{_._api._MagickSettings_SetOption(this._instance,i,l)})})}}class Je{_options={};_fileName;_ping=!1;_quality;antiAlias;backgroundColor;colorSpace;colorType;compression;debug;density;depth;endian;fillColor;font;fontPointsize;format;interlace;strokeColor;strokeWidth;textInterlineSpacing;textKerning;getDefine(e,n){return n!==void 0?this._options[`${e}:${n}`]??null:this._options[e]??null}setDefine(e,n,i){if(i===void 0)this._options[e]=n;else{const l=this.parseDefine(e,n);typeof i=="string"?this._options[l]=i:typeof i=="number"?this._options[l]=i.toString():this._options[l]=i?"true":"false"}}setDefines(e){e.getDefines().forEach(n=>{n!==void 0&&this.setDefine(n.format,n.name,n.value)})}_clone(){const e=new Je;return Object.assign(e,this),e}_use(e){const n=new Fi(this);return _e._disposeAfterExecution(n,e)}parseDefine(e,n){return e===Pe.Unknown?n:`${e}:${n}`}}class ke extends Je{constructor(e){super(),Object.assign(this,e)}extractArea;frameIndex;frameCount;height;get syncImageWithExifProfile(){const e=this.getDefine("exif:sync-image");return e===null?!0:e.toLowerCase()==="true"}set syncImageWithExifProfile(e){this.setDefine("exif:sync-image",e.toString())}get syncImageWithTiffProperties(){const e=this.getDefine("tiff:sync-image");return e===null?!0:e.toLowerCase()==="true"}set syncImageWithTiffProperties(e){this.setDefine("tiff:sync-image",e.toString())}width;_use(e){const n=new Fi(this),i=this.getSize();if(i!==""&&R(i,l=>{_._api._MagickSettings_SetSize(n._instance,l)}),this.frameIndex!==void 0||this.frameCount!==void 0){const l=this.frameIndex??0,d=this.frameCount??1;_._api._MagickSettings_SetScene(n._instance,l),_._api._MagickSettings_SetNumberScenes(n._instance,d);const m=this.frameCount!==void 0?`${l}-${l+d}`:l.toString();R(m.toString(),v=>{_._api._MagickSettings_SetScenes(n._instance,v)})}return this.extractArea!==void 0&&R(this.extractArea.toString(),l=>{_._api._MagickSettings_Extract_Set(n._instance,l)}),_e._disposeAfterExecution(n,e)}getSize(){return this.width!==void 0&&this.height!==void 0?`${this.width}x${this.height}`:this.width!==void 0?`${this.width}x`:this.height!==void 0?`x${this.height}`:""}}const Kt={Undefined:0,No:1,Riemersma:2,FloydSteinberg:3};class Or extends Le{constructor(e){const n=_._api._QuantizeSettings_Create(),i=_._api._QuantizeSettings_Dispose;super(n,i),_._api._QuantizeSettings_SetColors(this._instance,e.colors),_._api._QuantizeSettings_SetColorSpace(this._instance,e.colorSpace),_._api._QuantizeSettings_SetDitherMethod(this._instance,e.ditherMethod??Kt.No),_._api._QuantizeSettings_SetMeasureErrors(this._instance,e.measureErrors?1:0),_._api._QuantizeSettings_SetTreeDepth(this._instance,e.treeDepth)}}class Ct{constructor(){this.colors=256,this.colorSpace=b.Undefined,this.ditherMethod=Kt.Riemersma,this.measureErrors=!1,this.treeDepth=0}colors;colorSpace;ditherMethod;measureErrors;treeDepth;_use(e){const n=new Or(this);return _e._disposeAfterExecution(n,e)}}class Ee{_image;_names=[];constructor(e){this._image=e}setArtifact(e,n){this._names.push(e),this._image.setArtifact(e,n)}static use(e,n){const i=new Ee(e);try{return n(i)}finally{i.dispose()}}dispose(){for(const e of this._names)this._image.removeArtifact(e)}}function xi(M,e){if(M.byteLength===0)throw new N("The specified array cannot be empty");let n=0;try{return n=_._api._malloc(M.byteLength),_._api.HEAPU8.set(M,n),e(n)}finally{n!==0&&_._api._free(n)}}function Li(M,e){if(M.length===0)throw new N("The specified array cannot be empty");const n=M.length*8;let i=0;try{i=_._api._malloc(n);const l=new ArrayBuffer(n),d=new Float64Array(l);for(let m=0;m<M.length;m++)d[m]=M[m];return _._api.HEAPU8.set(new Int8Array(l),i),e(i)}finally{i!==0&&_._api._free(i)}}function Zr(M,e){if(M.byteLength===0)throw new N("The specified array cannot be empty");let n=0;try{return n=_._api._malloc(M.byteLength),_._api.HEAPU8.set(M,n),e(n)}finally{n!==0&&_._api._free(n)}}class Me extends Array{constructor(){super()}static create(e){const n=Me.createObject();return e!==void 0&&n.read(e),n}dispose(){let e=this.pop();for(;e!==void 0;)e.dispose(),e=this.pop()}appendHorizontally(e){return this.createImage((n,i)=>_._api._MagickImageCollection_Append(n,0,i.ptr),e)}appendVertically(e){return this.createImage((n,i)=>_._api._MagickImageCollection_Append(n,1,i.ptr),e)}clone(e){const n=Me.create();for(let i=0;i<this.length;i++)n.push(te._clone(this[i]));return n._use(e)}coalesce(){this.replaceImages((e,n)=>_._api._MagickImageCollection_Coalesce(e,n.ptr))}combine(e,n){let i=n,l=b.sRGB;return typeof e=="number"?l=e:i=e,this.createImage((d,m)=>_._api._MagickImageCollection_Combine(d,l,m.ptr),i)}complex(e,n){return Ee.use(this[0],i=>(e._setArtifacts(i),this.createImage((l,d)=>_._api._MagickImageCollection_Complex(l,e.complexOperator,d.ptr),n)))}deconstruct(){this.replaceImages((e,n)=>_._api._MagickImageCollection_Deconstruct(e,n.ptr))}evaluate(e,n){return this.createImage((i,l)=>_._api._MagickImageCollection_Evaluate(i,e,l.ptr),n)}flatten(e){return this.mergeImages(St.Flatten,e)}fx(e,n,i){this.throwIfEmpty();let l=X.All,d=i;return typeof n=="number"?l=n:d=n,R(e,m=>this.createImage((v,C)=>_._api._MagickImageCollection_Fx(v,m,l,C.ptr),d))}merge(e){return this.mergeImages(St.Merge,e)}montage(e,n){return this.throwIfEmpty(),this.attachImages(i=>{const l=e._use(d=>A.use(m=>{const v=_._api._MagickImageCollection_Montage(i,d._instance,m.ptr);return this.checkResult(v,m)}));return Me._createFromImages(l,this.getSettings())._use(d=>{const m=e.transparentColor;return m!==void 0&&d.forEach(v=>{v.transparent(m)}),d.merge(n)})})}morph(e){if(this.length<2)throw new N("operation requires at least two images");this.replaceImages((n,i)=>_._api._MagickImageCollection_Morph(n,e,i.ptr))}mosaic(e){return this.mergeImages(St.Mosaic,e)}optimize(){this.replaceImages((e,n)=>_._api._MagickImageCollection_Optimize(e,n.ptr))}optimizePlus(){this.replaceImages((e,n)=>_._api._MagickImageCollection_OptimizePlus(e,n.ptr))}optimizeTransparency(){this.throwIfEmpty(),this.attachImages(e=>{A.usePointer(n=>{_._api._MagickImageCollection_OptimizeTransparency(e,n)})})}ping(e,n){this.readOrPing(!0,e,n)}polynomial(e,n){return this.createImage((i,l)=>Li(e,d=>_._api._MagickImageCollection_Polynomial(i,d,e.length,l.ptr)),n)}quantize(e){this.throwIfEmpty();const n=e===void 0?new Ct:e;return this.attachImages(i=>{n._use(l=>{A.usePointer(d=>{_._api._MagickImageCollection_Quantize(i,l._instance,d)})})}),n.measureErrors?ot._create(this[0]):null}read(e,n){this.readOrPing(!1,e,n)}remap(e,n){this.throwIfEmpty();const i=n===void 0?new Ct:n;this.attachImages(l=>{i._use(d=>{A.use(m=>{_._api._MagickImageCollection_Remap(l,d._instance,e._instance,m.ptr)})})})}resetPage(){this.forEach(e=>{e.resetPage()})}smushHorizontal(e,n){return this.smush(e,!1,n)}smushVertical(e,n){return this.smush(e,!0,n)}trimBounds(){this.mergeImages(St.Trimbounds,()=>{})}write(e,n){this.throwIfEmpty();let i=0,l=0;const d=this[0],m=this.getSettings();n!==void 0?m.format=e:(n=e,m.format=d.format),A.use(C=>{Ie.use(F=>{m._use(z=>{this.attachImages(V=>{i=_._api._MagickImage_WriteBlob(V,z._instance,F.ptr,C.ptr),l=F.value})})})});const v=new Ai(i,l,n);return _e._disposeAfterExecution(v,v.func)}static _createFromImages(e,n){const i=Me.createObject();return i.addImages(e,n._clone()),i}_use(e){return _e._disposeAfterExecution(this,e)}addImages(e,n){n.format=Pe.Unknown;let i=e;for(;i!==0;){const l=_._api._MagickImage_GetNext(i);_._api._MagickImage_SetNext(i,0),this.push(te._createFromImage(i,n)),i=l}}attachImages(e){try{for(let n=0;n<this.length-1;n++)_._api._MagickImage_SetNext(this[n]._instance,this[n+1]._instance);return e(this[0]._instance)}finally{for(let n=0;n<this.length-1;n++)_._api._MagickImage_SetNext(this[n]._instance,0)}}checkResult(e,n){return n.check(()=>e,()=>(_._api._MagickImageCollection_Dispose(e),0))}static createObject(){return Object.create(Me.prototype)}createImage(e,n){this.throwIfEmpty();const i=this.attachImages(d=>A.use(m=>{const v=e(d,m);return this.checkResult(v,m)}));return te._createFromImage(i,this.getSettings())._use(n)}getSettings(){return this[0]._getSettings()._clone()}mergeImages(e,n){return this.createImage((i,l)=>_._api._MagickImageCollection_Merge(i,e,l.ptr),n)}readOrPing(e,n,i){this.dispose(),A.use(l=>{const d=i===void 0?new ke:new ke(i);d._ping=e,typeof n=="string"?(d._fileName=n,d._use(m=>{const v=_._api._MagickImageCollection_ReadFile(m._instance,l.ptr);this.addImages(v,d)})):d._use(m=>{const v=n.byteLength;let C=0;try{C=_._api._malloc(v),_._api.HEAPU8.set(n,C);const F=_._api._MagickImageCollection_ReadBlob(m._instance,C,0,v,l.ptr);this.addImages(F,d)}finally{C!==0&&_._api._free(C)}})})}replaceImages(e){this.throwIfEmpty();const n=this.attachImages(l=>A.use(d=>{const m=e(l,d);return this.checkResult(m,d)})),i=this.getSettings()._clone();this.dispose(),this.addImages(n,i)}smush(e,n,i){return this.createImage((l,d)=>_._api._MagickImageCollection_Smush(l,e,n?1:0,d.ptr),i)}throwIfEmpty(){if(this.length===0)throw new N("operation requires at least one image")}}class ee{_value;constructor(e){this._value=e}static _fromQuantum(e){return new ee(e/Fe.max*100)}multiply(e){return e*this._value/100}toDouble(){return this._value}toString(){return`${parseFloat(this._value.toFixed(2))}%`}_toQuantum(){return Fe.max*(this._value/100)}}class Wi{static use(e,n,i){const l=_._api._MagickRectangle_Create();try{_._api._MagickRectangle_X_Set(l,n.x),_._api._MagickRectangle_Y_Set(l,n.y);let d=n.width,m=n.height;return n.isPercentage&&(d=new ee(n.width).multiply(e.width),m=new ee(n.height).multiply(e.height)),_._api._MagickRectangle_Width_Set(l,d),_._api._MagickRectangle_Height_Set(l,m),i(l)}finally{_._api._MagickRectangle_Dispose(l)}}}class Bi{static _use(e,n,i){let l=0;try{return l=_._api._OffsetInfo_Create(),_._api._PrimaryInfo_X_Set(l,e),_._api._PrimaryInfo_Y_Set(l,n),i(l)}finally{_._api._free(l)}}}class Ni{_values;constructor(){this._values=new Array(7).fill(0)}get(e){return this._values[e]}set(e,n){this._values[e]=n}}class He{_huPhashes=new Map;_hash="";channel;constructor(e,n,i){if(this.channel=e,typeof i=="number")for(let l=0;l<n.length;l++){const d=new Ni;for(let m=0;m<7;m++){const v=_._api._ChannelPerceptualHash_GetHuPhash(i,l,m);d.set(m,v)}this._huPhashes.set(n[l],d)}else this.parseHash(n,i)}huPhash(e,n){if(n<0||n>6)throw new N("Invalid index specified");const i=this._huPhashes.get(e);if(i===void 0)throw new N("Invalid color space specified");return i.get(n)}sumSquaredDistance(e){let n=0;return this._huPhashes.forEach((i,l)=>{for(let d=0;d<7;d++){const m=i.get(d),v=e.huPhash(l,d);n+=(m-v)*(m-v)}}),n}toString(){return this._hash==""&&this.setHash(),this._hash}parseHash(e,n){this._hash=n;let i=0;for(const l of e){const d=new Ni;for(let m=0;m<7;m++,i+=5){const v=Number.parseInt(n.substring(i,i+5),16);if(isNaN(v))throw new N("Invalid hash specified");let C=v/He.powerOfTen(v>>17);(v&65536)!=0&&(C=-C),d.set(m,C)}this._huPhashes.set(l,d)}}static powerOfTen(e){switch(e){case 2:return 100;case 3:return 1e3;case 4:return 1e4;case 5:return 1e5;case 6:return 1e6;default:return 10}}setHash(){this._hash="",this._huPhashes.forEach(e=>{for(let n=0;n<7;n++){let i=e.get(n),l=0;for(;l<7&&Math.abs(i*10)<65356;)i*=10,l++;l<<=1,l<0&&(l|=1),l=(l<<16)+Math.floor(i<0?-(i-.5):i+.5),this._hash+=l.toString(16)}})}}class fe{_red;_green;_blue;constructor(e,n,i){if(typeof e=="string"){const l=n??fe._defaultColorspaces();fe._validateColorSpaces(l);const d=35*l.length;if(e.length!==3*d)throw new N("Invalid hash size");this._red=new He(L.Red,l,e.substring(0,d)),this._blue=new He(L.Blue,l,e.substring(d,d+d)),this._green=new He(L.Green,l,e.substring(d+d))}else this._red=e,this._green=n,this._blue=i}static _create(e,n,i){if(i===0)throw new N("The native operation failed to create an instance");const l=fe.createChannel(e,n,i,L.Red),d=fe.createChannel(e,n,i,L.Green),m=fe.createChannel(e,n,i,L.Blue);return new fe(l,d,m)}static _defaultColorspaces(){return[b.XyY,b.HSB]}static _validateColorSpaces(e){if(e.length<1||e.length>6)throw new N("Invalid number of colorspaces, the minimum is 1 and the maximum is 6");if(new Set(e).size!==e.length)throw new N("Specifying the same colorspace more than once is not allowed")}getChannel(e){switch(e){case L.Red:return this._red;case L.Green:return this._green;case L.Blue:return this._blue;default:return null}}sumSquaredDistance(e){const n=e.getChannel(L.Red),i=e.getChannel(L.Green),l=e.getChannel(L.Blue);if(n===null||i===null||l===null)throw new N("The other perceptual hash should contain a red, green and blue channel.");return this._red.sumSquaredDistance(n)+this._green.sumSquaredDistance(i)+this._blue.sumSquaredDistance(l)}toString(){return this._red.toString()+this._green.toString()+this._blue.toString()}static createChannel(e,n,i,l){const d=_._api._PerceptualHash_GetInstance(e._instance,i,l);return new He(l,n,d)}}class Ue extends Le{image;constructor(e){const n=A.usePointer(l=>_._api._PixelCollection_Create(e._instance,l)),i=_._api._PixelCollection_Dispose;super(n,i),this.image=e}static _create(e){return new Ue(e)}static _use(e,n){const i=new Ue(e);return _e._disposeAfterExecution(i,n)}static _map(e,n,i){const l=new Ue(e);try{l.use(0,0,e.width,e.height,n,d=>{i(d)})}finally{l.dispose()}}getArea(e,n,i,l){return A.usePointer(d=>{const m=_._api._PixelCollection_GetArea(this._instance,e,n,i,l,d),v=i*l*this.image.channelCount;return _._api.HEAPU8.subarray(m,m+v)})}getPixel(e,n){return this.getArea(e,n,1,1)}setArea(e,n,i,l,d){A.usePointer(m=>{const v=d instanceof Uint8Array?d:new Uint8Array(d);Zr(v,C=>{_._api._PixelCollection_SetArea(this._instance,e,n,i,l,C,v.length,m)})})}setPixel(e,n,i){i instanceof Uint8Array?this.setArea(e,n,1,1,i):this.setArea(e,n,1,1,i)}toByteArray(e,n,i,l,d){return this.use(e,n,i,l,d,m=>{if(m===0)return null;const v=i*l*d.length;return _._api.HEAPU8.slice(m,m+v)})}use(e,n,i,l,d,m){return R(d,v=>A.use(C=>{let F=_._api._PixelCollection_ToByteArray(this._instance,e,n,i,l,v,C.ptr);return C.check(()=>{const z=m(F);return F=_._api._MagickMemory_Relinquish(F),z},()=>(F=_._api._MagickMemory_Relinquish(F),null))}))}}const zi={Undefined:0,Average:1,Brightness:2,Lightness:3,MS:4,Rec601Luma:5,Rec601Luminance:6,Rec709Luma:7,Rec709Luminance:8,RMS:9};class We{constructor(e,n,i){this.x=e,this.y=n,this.z=i}x;y;z;static _create(e){return e===0?new We(0,0,0):new We(_._api._PrimaryInfo_X_Get(e),_._api._PrimaryInfo_Y_Get(e),_._api._PrimaryInfo_Z_Get(e))}_use(e){let n=0;try{n=_._api._PrimaryInfo_Create(),_._api._PrimaryInfo_X_Set(n,this.x),_._api._PrimaryInfo_Y_Set(n,this.y),_._api._PrimaryInfo_Z_Set(n,this.z),e(n)}finally{_._api._free(n)}}}class $i{channel;depth;entropy;kurtosis;maximum;mean;minimum;skewness;standardDeviation;constructor(e,n){this.channel=e,this.depth=_._api._ChannelStatistics_Depth_Get(n),this.entropy=_._api._ChannelStatistics_Entropy_Get(n),this.kurtosis=_._api._ChannelStatistics_Kurtosis_Get(n),this.maximum=_._api._ChannelStatistics_Maximum_Get(n),this.mean=_._api._ChannelStatistics_Mean_Get(n),this.minimum=_._api._ChannelStatistics_Minimum_Get(n),this.skewness=_._api._ChannelStatistics_Skewness_Get(n),this.standardDeviation=_._api._ChannelStatistics_StandardDeviation_Get(n)}}class It{_channels=new Map;get channels(){return Array.from(this._channels.keys())}composite(){return this._channels.get(L.Composite)}getChannel(e){const n=this._channels.get(e);return n!==void 0?n:null}static _create(e,n,i){const l=new It;return e.channels.forEach(d=>{(i>>d&1)!=0&&l.addChannel(n,d)}),l.addChannel(n,L.Composite),l}addChannel(e,n){const i=_._api._Statistics_GetInstance(e,n);i!==0&&this._channels.set(n,new $i(n,i))}}class en{static toArray(e){if(e===0)return null;const n=_._api._StringInfo_Datum_Get(e),i=_._api._StringInfo_Length_Get(e);return _._api.HEAPU8.subarray(n,n+i)}}class Qt{constructor(e){this.error=e}error}class te extends Le{_settings;_progress;_warning;constructor(e,n){super(e,_._api._MagickImage_Dispose),this._settings=n}get animationDelay(){return _._api._MagickImage_AnimationDelay_Get(this._instance)}set animationDelay(e){_._api._MagickImage_AnimationDelay_Set(this._instance,e)}get animationIterations(){return _._api._MagickImage_AnimationIterations_Get(this._instance)}set animationIterations(e){_._api._MagickImage_AnimationIterations_Set(this._instance,e)}get animationTicksPerSecond(){return _._api._MagickImage_AnimationTicksPerSecond_Get(this._instance)}set animationTicksPerSecond(e){_._api._MagickImage_AnimationTicksPerSecond_Set(this._instance,e)}get artifactNames(){const e=[];_._api._MagickImage_ResetArtifactIterator(this._instance);let n=_._api._MagickImage_GetNextArtifactName(this._instance);for(;n!==0;)e.push(_._api.UTF8ToString(n)),n=_._api._MagickImage_GetNextArtifactName(this._instance);return e}get attributeNames(){const e=[];_._api._MagickImage_ResetAttributeIterator(this._instance);let n=_._api._MagickImage_GetNextAttributeName(this._instance);for(;n!==0;)e.push(_._api.UTF8ToString(n)),n=_._api._MagickImage_GetNextAttributeName(this._instance);return e}get backgroundColor(){const e=_._api._MagickImage_BackgroundColor_Get(this._instance);return k._create(e)}set backgroundColor(e){e._use(n=>{_._api._MagickImage_BackgroundColor_Set(this._instance,n)})}get baseHeight(){return _._api._MagickImage_BaseHeight_Get(this._instance)}get baseWidth(){return _._api._MagickImage_BaseWidth_Get(this._instance)}get blackPointCompensation(){return _._api._MagickImage_BlackPointCompensation_Get(this._instance)===1}set blackPointCompensation(e){_._api._MagickImage_BlackPointCompensation_Set(this._instance,e?1:0)}get borderColor(){const e=_._api._MagickImage_BorderColor_Get(this._instance);return k._create(e)}set borderColor(e){e._use(n=>{_._api._MagickImage_BorderColor_Set(this._instance,n)})}get boundingBox(){return this.useExceptionPointer(e=>{const n=_._api._MagickImage_BoundingBox_Get(this._instance,e),i=ne._fromRectangle(n);return i.width===0||i.height===0?null:i})}get channelCount(){return _._api._MagickImage_ChannelCount_Get(this._instance)}get channels(){const e=[];return[L.Red,L.Green,L.Blue,L.Black,L.Alpha].forEach(n=>{_._api._MagickImage_HasChannel(this._instance,n)&&e.push(n)}),e}get chromaticity(){return new Ei(We._create(_._api._MagickImage_ChromaRed_Get(this._instance)),We._create(_._api._MagickImage_ChromaGreen_Get(this._instance)),We._create(_._api._MagickImage_ChromaBlue_Get(this._instance)),We._create(_._api._MagickImage_ChromaWhite_Get(this._instance)))}set chromaticity(e){e.blue._use(n=>_._api._MagickImage_ChromaBlue_Set(this._instance,n)),e.green._use(n=>_._api._MagickImage_ChromaGreen_Set(this._instance,n)),e.red._use(n=>_._api._MagickImage_ChromaRed_Set(this._instance,n)),e.white._use(n=>_._api._MagickImage_ChromaWhite_Set(this._instance,n))}get classType(){return _._api._MagickImage_ClassType_Get(this._instance)}set classType(e){this.useExceptionPointer(n=>{_._api._MagickImage_ClassType_Set(this._instance,e,n)})}get colorFuzz(){return ee._fromQuantum(_._api._MagickImage_ColorFuzz_Get(this._instance))}set colorFuzz(e){_._api._MagickImage_ColorFuzz_Set(this._instance,e._toQuantum())}get colormapSize(){return _._api._MagickImage_ColormapSize_Get(this._instance)}set colormapSize(e){this.useExceptionPointer(n=>{_._api._MagickImage_ColormapSize_Set(this._instance,e,n)})}get colorSpace(){return _._api._MagickImage_ColorSpace_Get(this._instance)}set colorSpace(e){this.useExceptionPointer(n=>{_._api._MagickImage_ColorSpace_Set(this._instance,e,n)})}get colorType(){return this.settings.colorType!==void 0?this.settings.colorType:_._api._MagickImage_ColorType_Get(this._instance)}set colorType(e){this.useExceptionPointer(n=>{_._api._MagickImage_ColorType_Set(this._instance,e,n)})}get comment(){return this.getAttribute("comment")}set comment(e){e===null?this.removeAttribute("comment"):this.setAttribute("comment",e)}get compose(){return _._api._MagickImage_Compose_Get(this._instance)}set compose(e){_._api._MagickImage_Compose_Set(this._instance,e)}get compression(){return _._api._MagickImage_Compression_Get(this._instance)}get density(){return new $e(_._api._MagickImage_ResolutionX_Get(this._instance),_._api._MagickImage_ResolutionY_Get(this._instance),_._api._MagickImage_ResolutionUnits_Get(this._instance))}set density(e){_._api._MagickImage_ResolutionX_Set(this._instance,e.x),_._api._MagickImage_ResolutionY_Set(this._instance,e.y),_._api._MagickImage_ResolutionUnits_Set(this._instance,e.units)}get depth(){return _._api._MagickImage_Depth_Get(this._instance)}set depth(e){_._api._MagickImage_Depth_Set(this._instance,e)}get endian(){return _._api._MagickImage_Endian_Get(this._instance)}set endian(e){_._api._MagickImage_Endian_Set(this._instance,e)}get fileName(){const e=_._api._MagickImage_FileName_Get(this._instance);return e===0?null:_._api.UTF8ToString(e)}get filterType(){return _._api._MagickImage_FilterType_Get(this._instance)}set filterType(e){_._api._MagickImage_FilterType_Set(this._instance,e)}get format(){return le(_._api._MagickImage_Format_Get(this._instance),"")}set format(e){R(e.toString(),n=>_._api._MagickImage_Format_Set(this._instance,n))}get gamma(){return _._api._MagickImage_Gamma_Get(this._instance)}get gifDisposeMethod(){return _._api._MagickImage_GifDisposeMethod_Get(this._instance)}set gifDisposeMethod(e){_._api._MagickImage_GifDisposeMethod_Set(this._instance,e)}get hasAlpha(){return this.toBool(_._api._MagickImage_HasAlpha_Get(this._instance))}set hasAlpha(e){this.useExceptionPointer(n=>{e&&this.alpha(Pi.Opaque),_._api._MagickImage_HasAlpha_Set(this._instance,this.fromBool(e),n)})}get height(){return _._api._MagickImage_Height_Get(this._instance)}get interlace(){return _._api._MagickImage_Interlace_Get(this._instance)}get isOpaque(){return this.useExceptionPointer(e=>this.toBool(_._api._MagickImage_IsOpaque_Get(this._instance,e)))}get interpolate(){return _._api._MagickImage_Interpolate_Get(this._instance)}set interpolate(e){_._api._MagickImage_Interpolate_Set(this._instance,e)}get label(){return this.getAttribute("label")}set label(e){e===null?this.removeAttribute("label"):this.setAttribute("label",e)}get matteColor(){const e=_._api._MagickImage_MatteColor_Get(this._instance);return k._create(e)}set matteColor(e){e._use(n=>{_._api._MagickImage_MatteColor_Set(this._instance,n)})}get metaChannelCount(){return _._api._MagickImage_MetaChannelCount_Get(this._instance)}set metaChannelCount(e){this.useExceptionPointer(n=>{_._api._MagickImage_MetaChannelCount_Set(this._instance,e,n)})}get orientation(){return _._api._MagickImage_Orientation_Get(this._instance)}set orientation(e){_._api._MagickImage_Orientation_Set(this._instance,e)}get onProgress(){return this._progress}set onProgress(e){e!==void 0?se.setProgressDelegate(this):this.disposeProgressDelegate(),this._progress=e}get onWarning(){return this._warning}set onWarning(e){this._warning=e}get page(){const e=_._api._MagickImage_Page_Get(this._instance);return ne._fromRectangle(e)}set page(e){e._toRectangle(n=>{_._api._MagickImage_Page_Set(this._instance,n)})}get profileNames(){const e=[];_._api._MagickImage_ResetProfileIterator(this._instance);let n=_._api._MagickImage_GetNextProfileName(this._instance);for(;n!==0;)e.push(_._api.UTF8ToString(n)),n=_._api._MagickImage_GetNextProfileName(this._instance);return e}get quality(){return _._api._MagickImage_Quality_Get(this._instance)}set quality(e){let n=e<1?1:e;n=n>100?100:n,_._api._MagickImage_Quality_Set(this._instance,n),this._settings._quality=n}get renderingIntent(){return _._api._MagickImage_RenderingIntent_Get(this._instance)}set renderingIntent(e){_._api._MagickImage_RenderingIntent_Set(this._instance,e)}get settings(){return this._settings}get signature(){return this.useExceptionPointer(e=>le(_._api._MagickImage_Signature_Get(this._instance,e)))}get totalColors(){return this.useExceptionPointer(e=>_._api._MagickImage_TotalColors_Get(this._instance,e))}get virtualPixelMethod(){return _._api._MagickImage_VirtualPixelMethod_Get(this._instance)}set virtualPixelMethod(e){this.useExceptionPointer(n=>{_._api._MagickImage_VirtualPixelMethod_Set(this._instance,e,n)})}get width(){return _._api._MagickImage_Width_Get(this._instance)}adaptiveBlur(e,n){const i=this.valueOrDefault(e,0),l=this.valueOrDefault(n,1);this.useException(d=>{const m=_._api._MagickImage_AdaptiveBlur(this._instance,i,l,d.ptr);this._setInstance(m,d)})}adaptiveResize(e,n){const i=typeof e=="number"?new ne(0,0,e,n):e;this.useException(l=>{R(i.toString(),d=>{const m=_._api._MagickImage_AdaptiveResize(this._instance,d,l.ptr);this._setInstance(m,l)})})}adaptiveSharpen(e,n,i){let l=0;const d=n??1;let m=i??X.Undefined;e!==void 0&&(n===void 0?m=e:l=e),this.useException(v=>{const C=_._api._MagickImage_AdaptiveSharpen(this._instance,l,d,m,v.ptr);this._setInstance(C,v)})}adaptiveThreshold(e,n,i,l){const d=i instanceof ee?i._toQuantum():0;let m=l??X.Undefined;typeof i=="number"&&(m=i),this.useException(v=>{const C=_._api._MagickImage_AdaptiveThreshold(this._instance,e,n,d,m,v.ptr);this._setInstance(C,v)})}addNoise(e,n,i){let l=1,d=i??X.Undefined;n!==void 0&&(i===void 0?d=n:l=n),this.useException(m=>{const v=_._api._MagickImage_AddNoise(this._instance,e,l,d,m.ptr);this._setInstance(v,m)})}alpha(e){this.useExceptionPointer(n=>{_._api._MagickImage_SetAlpha(this._instance,e,n)})}annotate(e,n,i,l){const d=wt._create(this._settings);return this.useExceptionPointer(m=>d._use(v=>{R(e,C=>{let F=null,z=ue.Undefined,V=0;typeof n=="object"?(F=n.toString(),i!==void 0&&(z=i),l!==void 0&&(V=l)):(z=n,i!==void 0&&(V=i)),R(F,be=>{_._api._MagickImage_Annotate(this._instance,v._instance,C,be,z,V,m)})})}))}autoGamma(e){this.useExceptionPointer(n=>{const i=this.valueOrDefault(e,X.Composite);_._api._MagickImage_AutoGamma(this._instance,i,n)})}autoLevel(e){this.useExceptionPointer(n=>{const i=this.valueOrDefault(e,X.Undefined);_._api._MagickImage_AutoLevel(this._instance,i,n)})}autoOrient(){this.useException(e=>{const n=_._api._MagickImage_AutoOrient(this._instance,e.ptr);this._setInstance(n,e)})}autoThreshold(e){this.useException(n=>{_._api._MagickImage_AutoThreshold(this._instance,e,n.ptr)})}bilateralBlur(e,n,i,l){const d=this.valueOrComputedDefault(i,()=>Math.sqrt(e*e+n*n)),m=this.valueOrDefault(l,d*.25);this.useException(v=>{const C=_._api._MagickImage_BilateralBlur(this._instance,e,n,d,m,v.ptr);this._setInstance(C,v)})}blackThreshold(e,n){const i=this.valueOrDefault(n,X.Composite);this.useException(l=>{R(e.toString(),d=>{_._api._MagickImage_BlackThreshold(this._instance,d,i,l.ptr)})})}blueShift(e){const n=this.valueOrDefault(e,1.5);this.useException(i=>{const l=_._api._MagickImage_BlueShift(this._instance,n,i.ptr);this._setInstance(l,i)})}blur(e,n,i){let l=0;const d=this.valueOrDefault(n,1);let m=this.valueOrDefault(i,X.Undefined);e!==void 0&&(n===void 0?m=e:l=e),this.useException(v=>{const C=_._api._MagickImage_Blur(this._instance,l,d,m,v.ptr);this._setInstance(C,v)})}border(e,n){const i=e,l=this.valueOrDefault(n,e),d=new ne(0,0,i,l);this.useException(m=>{d._toRectangle(v=>{const C=_._api._MagickImage_Border(this._instance,v,m.ptr);this._setInstance(C,m)})})}brightnessContrast(e,n,i){const l=this.valueOrDefault(i,X.Undefined);this.useException(d=>{_._api._MagickImage_BrightnessContrast(this._instance,e.toDouble(),n.toDouble(),l,d.ptr)})}cannyEdge(e,n,i,l){const d=this.valueOrDefault(e,0),m=this.valueOrDefault(n,1),v=this.valueOrDefault(i,new ee(10)).toDouble()/100,C=this.valueOrDefault(l,new ee(30)).toDouble()/100;this.useException(F=>{const z=_._api._MagickImage_CannyEdge(this._instance,d,m,v,C,F.ptr);this._setInstance(z,F)})}charcoal(e,n){const i=e===void 0?0:e,l=n===void 0?1:n;this.useException(d=>{const m=_._api._MagickImage_Charcoal(this._instance,i,l,d.ptr);this._setInstance(m,d)})}chop(e){this.useException(n=>{e._toRectangle(i=>{const l=_._api._MagickImage_Chop(this._instance,i,n.ptr);this._setInstance(l,n)})})}chopHorizontal(e,n){this.chop(new ne(e,0,n,0))}chopVertical(e,n){this.chop(new ne(0,e,0,n))}clahe(e,n,i,l){this.useExceptionPointer(d=>{const m=e instanceof ee?e.multiply(this.width):e,v=n instanceof ee?n.multiply(this.height):n;_._api._MagickImage_Clahe(this._instance,m,v,i,l,d)})}clone(e){return te._clone(this)._use(e)}cloneArea(e,n){return A.usePointer(i=>e._toRectangle(l=>Bi._use(0,0,d=>{const m=_._api._MagickImage_CloneArea(this._instance,e.width,e.height,i);_._api._MagickImage_CopyPixels(m,this._instance,l,d,X.Undefined,i);const v=new te(m,this._settings);return n(v)})))}colorAlpha(e){if(!this.hasAlpha)return;const n=te.create();n.read(e,this.width,this.height),n.composite(this,vt.SrcOver,new ve(0,0)),this._instance=n._instance}compare(e,n,i,l){const d=n instanceof bi,m=d?n.metric:n;let v=i;l!==void 0&&(v=l);let C=X.Undefined;if(typeof v!="function")return v!==void 0&&(C=v),this.useExceptionPointer(z=>_._api._MagickImage_CompareDistortion(this._instance,e._instance,m,C,z));i!==void 0&&typeof i!="function"&&(C=i);const F=Ee.use(this,z=>(d&&n._setArtifacts(z),qt.use(V=>{const be=this.useExceptionPointer(Ze=>_._api._MagickImage_Compare(this._instance,e._instance,m,C,V.ptr,Ze)),je=V.value,Be=te._createFromImage(be,this._settings);return pt._create(je,Be)})));return F.difference._use(()=>v(F))}composite(e,n,i,l,d){let m=0,v=0,C=vt.In,F=X.All,z=null;n instanceof ve?(m=n.x,v=n.y):n!==void 0&&(C=n),i instanceof ve?(m=i.x,v=i.y):typeof i=="string"?z=i:i!==void 0&&(F=i),typeof l=="string"?z=l:l!==void 0&&(F=l),d!==void 0&&(F=d),z!==null&&this.setArtifact("compose:args",z),this.useExceptionPointer(V=>{_._api._MagickImage_Composite(this._instance,e._instance,m,v,C,F,V)}),z!==null&&this.removeArtifact("compose:args")}compositeGravity(e,n,i,l,d,m){let v=0,C=0,F=vt.In,z=X.All,V=null;i instanceof ve?(v=i.x,C=i.y):i!==void 0&&(F=i),l instanceof ve?(v=l.x,C=l.y):typeof l=="string"?V=l:l!==void 0&&(z=l),typeof d=="string"?V=d:d!==void 0&&(z=d),m!==void 0&&(z=m),V!==null&&this.setArtifact("compose:args",V),this.useExceptionPointer(be=>{_._api._MagickImage_CompositeGravity(this._instance,e._instance,n,v,C,F,z,be)}),V!==null&&this.removeArtifact("compose:args")}connectedComponents(e){const n=typeof e=="number"?new Ti(e):e;return Ee.use(this,l=>(n._setArtifacts(l),this.useException(d=>Ie.use(m=>{try{const v=_._api._MagickImage_ConnectedComponents(this._instance,n.connectivity,m.ptr,d.ptr);return this._setInstance(v,d),Mt._create(m.value,this.colormapSize)}finally{m.value!==0&&_._api._ConnectedComponent_DisposeList(m.value)}}))))}contrast=()=>this._contrast(!0);contrastStretch(e,n,i){const l=this.width*this.height,d=e.multiply(l);let m=0,v=this.valueOrDefault(i,X.Undefined);n instanceof ee?m=l-n.multiply(l):(m=l-e.multiply(l),n!==void 0&&(v=n)),this.useExceptionPointer(C=>{_._api._MagickImage_ContrastStretch(this._instance,d,m,v,C)})}static create(e,n,i){const l=new te(te.createInstance(),new Je);return e!==void 0&&l.readOrPing(!1,e,n,i),l}crop(e,n,i){let l,d;typeof e!="number"?(l=e,d=this.valueOrDefault(n,ue.Undefined)):n!==void 0&&(l=new ne(e,n),d=this.valueOrDefault(i,ue.Undefined)),this.useException(m=>{R(l.toString(),v=>{const C=_._api._MagickImage_Crop(this._instance,v,d,m.ptr);this._setInstance(C,m)})})}cropToTiles(e,n,i){let l,d;return typeof e=="number"&&typeof n=="number"&&i!==void 0?(l=new ne(0,0,e,n),d=i):typeof e!="number"&&typeof n!="number"&&(l=e,d=n),this.useException(m=>R(l.toString(),v=>{const C=_._api._MagickImage_CropToTiles(this._instance,v,m.ptr);return Me._createFromImages(C,this._settings)._use(d)}))}deskew(e,n){return Ee.use(this,i=>{n!==void 0&&i.setArtifact("deskew:auto-crop",n),this.useException(d=>{const m=_._api._MagickImage_Deskew(this._instance,e._toQuantum(),d.ptr);this._setInstance(m,d)});const l=Number(this.getArtifact("deskew:angle"));return isNaN(l)?0:l})}distort(e,n){Ee.use(this,i=>{let l,d=0;typeof e=="number"?l=e:(l=e.method,d=e.bestFit?1:0,e._setArtifacts(i)),this.useException(m=>{Li(n,v=>{const C=_._api._MagickImage_Distort(this._instance,l,d,v,n.length,m.ptr);this._setInstance(C,m)})})})}draw(...e){const n=e.flat();n.length!==0&&st._use(this,i=>{i.draw(n)})}evaluate(e,n,i,l){if(typeof n=="number"){const d=n,m=typeof i=="number"?i:i._toQuantum();this.useExceptionPointer(v=>{_._api._MagickImage_EvaluateOperator(this._instance,e,d,m,v)})}else if(l!==void 0){if(typeof i!="number")throw new N("this should not happen");const d=n,m=i,v=typeof l=="number"?l:l._toQuantum();if(d.isPercentage)throw new N("percentage is not supported");this.useExceptionPointer(C=>{Wi.use(this,d,F=>{_._api._MagickImage_EvaluateGeometry(this._instance,e,F,m,v,C)})})}}extent(e,n,i){let l=ue.Undefined,d;typeof e!="number"?d=e:typeof n=="number"&&(d=new ne(e,n)),typeof n=="number"?l=n:n!==void 0&&(this.backgroundColor=n),typeof i=="number"?l=i:i!==void 0&&(this.backgroundColor=i),this.useException(m=>{R(d.toString(),v=>{const C=_._api._MagickImage_Extent(this._instance,v,l,m.ptr);this._setInstance(C,m)})})}flip(){this.useException(e=>{const n=_._api._MagickImage_Flip(this._instance,e.ptr);this._setInstance(n,e)})}flop(){this.useException(e=>{const n=_._api._MagickImage_Flop(this._instance,e.ptr);this._setInstance(n,e)})}formatExpression(e){return this.useExceptionPointer(n=>this._settings._use(i=>R(e,l=>{const d=_._api._MagickImage_FormatExpression(this._instance,i._instance,l,n);return Qr(_._api,d)})))}gammaCorrect(e,n){const i=this.valueOrDefault(n,X.Undefined);this.useExceptionPointer(l=>{_._api._MagickImage_GammaCorrect(this._instance,e,i,l)})}gaussianBlur(e,n,i){const l=this.valueOrDefault(n,1),d=this.valueOrDefault(i,X.Undefined);this.useException(m=>{const v=_._api._MagickImage_GaussianBlur(this._instance,e,l,d,m.ptr);this._setInstance(v,m)})}getArtifact(e){return R(e,n=>{const i=_._api._MagickImage_GetArtifact(this._instance,n);return le(i)})}getAttribute(e){return this.useException(n=>R(e,i=>{const l=_._api._MagickImage_GetAttribute(this._instance,i,n.ptr);return le(l)}))}getColorProfile(){const e=["icc","icm"];for(const n of e){const i=this._getProfile(n);if(i!==null)return new Di(i)}return null}getPixels(e){if(this._settings._ping)throw new N("image contains no pixel data");return Ue._use(this,e)}getProfile(e){const n=this._getProfile(e);return n===null?null:new Yt(e,n)}getWriteMask(e){const n=this.useExceptionPointer(l=>_._api._MagickImage_GetWriteMask(this._instance,l)),i=n===0?null:new te(n,new Je);return i==null?e(i):i._use(e)}grayscale(e=zi.Undefined){this.useExceptionPointer(n=>{_._api._MagickImage_Grayscale(this._instance,e,n)})}hasProfile(e){return R(e,n=>this.toBool(_._api._MagickImage_HasProfile(this._instance,n)))}histogram(){const e=new Map;return this.useExceptionPointer(n=>{Ie.use(i=>{const l=_._api._MagickImage_Histogram(this._instance,i.ptr,n);if(l!==0){const d=i.value;for(let m=0;m<d;m++){const v=_._api._MagickColorCollection_GetInstance(l,m),C=k._create(v),F=_._api._MagickColor_Count_Get(v);e.set(C.toString(),F)}_._api._MagickColorCollection_DisposeList(l)}})}),e}inverseContrast=()=>this._contrast(!1);inverseLevel(e,n,i,l){const d=this.valueOrDefault(i,1),m=this.valueOrDefault(l,X.Composite);this.useExceptionPointer(v=>{_._api._MagickImage_InverseLevel(this._instance,e.toDouble(),n._toQuantum(),d,m,v)})}inverseOpaque=(e,n)=>this._opaque(e,n,!0);inverseSigmoidalContrast(e,n,i){this._sigmoidalContrast(!1,e,n,i)}inverseTransparent=e=>this._transparent(e,!0);level(e,n,i,l){const d=this.valueOrDefault(i,1),m=this.valueOrDefault(l,X.Composite);this.useExceptionPointer(v=>{_._api._MagickImage_Level(this._instance,e.toDouble(),n._toQuantum(),d,m,v)})}linearStretch(e,n){this.useExceptionPointer(i=>{_._api._MagickImage_LinearStretch(this._instance,e.toDouble(),n._toQuantum(),i)})}liquidRescale(e,n){const i=typeof e=="number"?new ne(e,n):e;this.useException(l=>{R(i.toString(),d=>{const m=_._api._MagickImage_LiquidRescale(this._instance,d,i.x,i.y,l.ptr);this._setInstance(m,l)})})}negate(e){this.useExceptionPointer(n=>{const i=this.valueOrDefault(e,X.Undefined);_._api._MagickImage_Negate(this._instance,0,i,n)})}negateGrayScale(e){this.useExceptionPointer(n=>{const i=this.valueOrDefault(e,X.Undefined);_._api._MagickImage_Negate(this._instance,1,i,n)})}normalize(){this.useExceptionPointer(e=>{_._api._MagickImage_Normalize(this._instance,e)})}modulate(e,n,i){const l=this.valueOrDefault(n,new ee(100)),d=this.valueOrDefault(i,new ee(100));this.useExceptionPointer(m=>{const v=`${e.toDouble()}/${l.toDouble()}/${d.toDouble()}`;R(v,C=>{_._api._MagickImage_Modulate(this._instance,C,m)})})}morphology(e){this.useException(n=>{R(e.kernel,i=>{const l=_._api._MagickImage_Morphology(this._instance,e.method,i,e.channels,e.iterations,n.ptr);this._setInstance(l,n)})})}motionBlur(e,n,i){this.useException(l=>{const d=_._api._MagickImage_MotionBlur(this._instance,e,n,i,l.ptr);this._setInstance(d,l)})}oilPaint(e){const n=this.valueOrDefault(e,3),i=0;this.useException(l=>{const d=_._api._MagickImage_OilPaint(this._instance,n,i,l.ptr);this._setInstance(d,l)})}opaque=(e,n)=>this._opaque(e,n,!1);ping(e,n){this.readOrPing(!0,e,n)}perceptualHash(e){const n=this.valueOrDefault(e,fe._defaultColorspaces());return fe._validateColorSpaces(n),Ee.use(this,i=>{const l=n.map(d=>Ut[d]).join(",");return i.setArtifact("phash:colorspaces",l),this.useExceptionPointer(d=>{const m=_._api._MagickImage_PerceptualHash(this._instance,d);return fe._create(this,n,m)})})}quantize(e){const n=this.valueOrDefault(e,new Ct);return this.useException(i=>{n._use(l=>{_._api._MagickImage_Quantize(this._instance,l._instance,i.ptr)})}),n.measureErrors?ot._create(this):null}read(e,n,i){this.readOrPing(!1,e,n,i)}readFromCanvas(e,n){const i=e.getContext("2d",n);if(i===null)return;const l=i.getImageData(0,0,e.width,e.height),d=new ke;d.format=Pe.Rgba,d.width=e.width,d.height=e.height,this.useException(m=>{this.readFromArray(l.data,d,m)})}removeArtifact(e){R(e,n=>{_._api._MagickImage_RemoveArtifact(this._instance,n)})}removeAttribute(e){R(e,n=>{_._api._MagickImage_RemoveAttribute(this._instance,n)})}removeProfile(e){const n=typeof e=="string"?e:e.name;R(n,i=>{_._api._MagickImage_RemoveProfile(this._instance,i)})}removeWriteMask(){this.useExceptionPointer(e=>{_._api._MagickImage_SetWriteMask(this._instance,0,e)})}resetPage(){this.page=new ne(0,0,0,0)}resize(e,n){const i=typeof e=="number"?new ne(e,n):e;this.useException(l=>{R(i.toString(),d=>{const m=_._api._MagickImage_Resize(this._instance,d,this.filterType,l.ptr);this._setInstance(m,l)})})}rotate(e){this.useException(n=>{const i=_._api._MagickImage_Rotate(this._instance,e,n.ptr);this._setInstance(i,n)})}separate(e,n){return this.useException(i=>{let l,d=X.Undefined;if(typeof e=="number"&&n!==void 0)d=e,l=n;else if(typeof e=="function")l=e;else throw new N("invalid arguments");const m=_._api._MagickImage_Separate(this._instance,d,i.ptr);return Me._createFromImages(m,this._settings)._use(l)})}sepiaTone(e=new ee(80)){this.useException(n=>{const i=typeof e=="number"?new ee(e):e,l=_._api._MagickImage_SepiaTone(this._instance,i._toQuantum(),n.ptr);this._setInstance(l,n)})}setArtifact(e,n){let i;typeof n=="string"?i=n:typeof n=="boolean"?i=this.fromBool(n).toString():i=n.toString(),R(e,l=>{R(i,d=>{_._api._MagickImage_SetArtifact(this._instance,l,d)})})}setAttribute(e,n){this.useException(i=>{R(e,l=>{R(n,d=>{_._api._MagickImage_SetAttribute(this._instance,l,d,i.ptr)})})})}setProfile(e,n){const i=typeof e=="string"?e:e.name;let l;n!==void 0?l=n:typeof e!="string"&&(l=e.data),this.useException(d=>{R(i,m=>{xi(l,v=>{_._api._MagickImage_SetProfile(this._instance,m,v,l.byteLength,d.ptr)})})})}setWriteMask(e){this.useExceptionPointer(n=>{_._api._MagickImage_SetWriteMask(this._instance,e._instance,n)})}sharpen(e,n,i){const l=this.valueOrDefault(e,0),d=this.valueOrDefault(n,1),m=this.valueOrDefault(i,X.Undefined);this.useException(v=>{const C=_._api._MagickImage_Sharpen(this._instance,l,d,m,v.ptr);this._setInstance(C,v)})}shave(e,n){this.useException(i=>{const l=_._api._MagickImage_Shave(this._instance,e,n,i.ptr);this._setInstance(l,i)})}sigmoidalContrast(e,n,i){this._sigmoidalContrast(!0,e,n,i)}solarize(e=new ee(50)){this.useException(n=>{const i=typeof e=="number"?new ee(e):e;_._api._MagickImage_Solarize(this._instance,i._toQuantum(),n.ptr)})}splice(e){Wi.use(this,e,n=>{this.useException(i=>{const l=_._api._MagickImage_Splice(this._instance,n,i.ptr);this._setInstance(l,i)})})}statistics(e){const n=this.valueOrDefault(e,X.All);return this.useExceptionPointer(i=>{const l=_._api._MagickImage_Statistics(this._instance,n,i),d=It._create(this,l,n);return _._api._Statistics_DisposeList(l),d})}strip(){this.useExceptionPointer(e=>{_._api._MagickImage_Strip(this._instance,e)})}transformColorSpace(e,n,i){const l=e;let d,m=Vt.Quantum;n!==void 0&&(typeof n=="number"?m=n:d=n),i!==void 0&&(m=i);const v=this.hasProfile("icc")||this.hasProfile("icm");if(d===void 0){if(!v)return!1;d=l}else{if(l.colorSpace!==this.colorSpace)return!1;v||this.setProfile(l)}return m===Vt.Quantum?Ee.use(this,C=>{C.setArtifact("profile:highres-transform",!1),this.setProfile(d)}):this.setProfile(d),!0}threshold(e,n){const i=this.valueOrDefault(n,X.Undefined);this.useExceptionPointer(l=>{_._api._MagickImage_Threshold(this._instance,e._toQuantum(),i,l)})}thumbnail(e,n){const i=typeof e=="number"?new ne(e,n):e;this.useException(l=>{R(i.toString(),d=>{const m=_._api._MagickImage_Thumbnail(this._instance,d,l.ptr);this._setInstance(m,l)})})}toString=()=>`${this.format} ${this.width}x${this.height} ${this.depth}-bit ${Ut[this.colorSpace]}`;transparent(e){e._use(n=>{this.useExceptionPointer(i=>{_._api._MagickImage_Transparent(this._instance,n,0,i)})})}trim(...e){if(e.length>0)if(e.length==1&&e[0]instanceof ee){const n=e[0];this.setArtifact("trim:percent-background",n.toDouble().toString())}else{const n=e,i=[...new Set(Gi(n))].join(",");this.setArtifact("trim:edges",i)}this.useException(n=>{const i=_._api._MagickImage_Trim(this._instance,n.ptr);this._setInstance(i,n),this.removeArtifact("trim:edges"),this.removeArtifact("trim:percent-background")})}wave(e,n,i){const l=this.valueOrDefault(e,this.interpolate),d=this.valueOrDefault(n,25),m=this.valueOrDefault(i,150);this.useException(v=>{const C=_._api._MagickImage_Wave(this._instance,l,d,m,v.ptr);this._setInstance(C,v)})}vignette(e,n,i,l){const d=this.valueOrDefault(e,0),m=this.valueOrDefault(n,1),v=this.valueOrDefault(i,0),C=this.valueOrDefault(l,0);this.useException(F=>{const z=_._api._MagickImage_Vignette(this._instance,d,m,v,C,F.ptr);this._setInstance(z,F)})}whiteThreshold(e,n){const i=this.valueOrDefault(n,X.Composite);this.useException(l=>{R(e.toString(),d=>{_._api._MagickImage_WhiteThreshold(this._instance,d,i,l.ptr)})})}write(e,n){let i=0,l=0;n!==void 0?this._settings.format=e:n=e,this.useException(m=>{Ie.use(v=>{this._settings._use(C=>{try{i=_._api._MagickImage_WriteBlob(this._instance,C._instance,v.ptr,m.ptr),l=v.value}catch{i!==0&&(i=_._api._MagickMemory_Relinquish(i))}})})});const d=new Ai(i,l,n);return _e._disposeAfterExecution(d,d.func)}writeToCanvas(e,n){e.width=this.width,e.height=this.height;const i=e.getContext("2d",n);i!==null&&Ue._map(this,"RGBA",l=>{const d=i.createImageData(this.width,this.height);let m=0;for(let v=0;v<this.height;v++)for(let C=0;C<this.width;C++)d.data[m++]=_._api.HEAPU8[l++],d.data[m++]=_._api.HEAPU8[l++],d.data[m++]=_._api.HEAPU8[l++],d.data[m++]=_._api.HEAPU8[l++];i.putImageData(d,0,0)})}static _createFromImage(e,n){return new te(e,n)}_channelOffset(e){return _._api._MagickImage_HasChannel(this._instance,e)?_._api._MagickImage_ChannelOffset(this._instance,e):-1}static _clone(e){return A.usePointer(n=>new te(_._api._MagickImage_Clone(e._instance,n),e._settings._clone()))}_getSettings(){return this._settings}_instanceNotInitialized(){throw new N("no image has been read")}_setInstance(e,n){if(super._setInstance(e,n)===!0||e===0&&this.onProgress!==void 0)return!0;throw new N("out of memory")}_use(e){return _e._disposeAfterExecution(this,e)}static _create(e){return te.create()._use(e)}onDispose(){this.disposeProgressDelegate()}_contrast(e){this.useExceptionPointer(n=>{_._api._MagickImage_Contrast(this._instance,this.fromBool(e),n)})}_getProfile(e){return R(e,n=>{const i=_._api._MagickImage_GetProfile(this._instance,n),l=en.toArray(i);return l===null?null:l})}_opaque(e,n,i){this.useExceptionPointer(l=>{e._use(d=>{n._use(m=>{_._api._MagickImage_Opaque(this._instance,d,m,this.fromBool(i),l)})})})}_sigmoidalContrast(e,n,i,l){let d;i!==void 0?typeof i=="number"?d=i:d=i.multiply(Fe.max):d=Fe.max*.5;const m=this.valueOrDefault(l,X.Undefined);this.useExceptionPointer(v=>{_._api._MagickImage_SigmoidalContrast(this._instance,this.fromBool(e),n,d,m,v)})}_transparent(e,n){e._use(i=>{this.useExceptionPointer(l=>{_._api._MagickImage_Transparent(this._instance,i,this.fromBool(n),l)})})}static createInstance(){return A.usePointer(e=>_._api._MagickImage_Create(0,e))}fromBool(e){return e?1:0}disposeProgressDelegate(){se.removeProgressDelegate(this),this._progress=void 0}readOrPing(e,n,i,l){this.useException(d=>{const m=i instanceof ke?i:new ke(this._settings);if(m._ping=e,this._settings._ping=e,m.frameCount!==void 0&&m.frameCount>1)throw new N("The frame count can only be set to 1 when a single image is being read.");if(typeof n=="string")m._fileName=n;else if($t(n)){this.readFromArray(n,m,d);return}else m._fileName="xc:"+n.toShortString(),m.width=typeof i=="number"?i:0,m.height=typeof l=="number"?l:0;m._use(v=>{const C=_._api._MagickImage_ReadFile(v._instance,d.ptr);this._setInstance(C,d)})})}readFromArray(e,n,i){n._use(l=>{xi(e,d=>{const m=_._api._MagickImage_ReadBlob(l._instance,d,0,e.byteLength,i.ptr);this._setInstance(m,i)})})}toBool(e){return e===1}valueOrDefault(e,n){return e===void 0?n:e}valueOrComputedDefault(e,n){return e===void 0?n():e}useException(e){return A.use(e,n=>{this.onWarning!==void 0&&this.onWarning(new Qt(n))})}useExceptionPointer(e){return A.usePointer(e,n=>{this.onWarning!==void 0&&this.onWarning(new Qt(n))})}}var tn=(()=>{var M=typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ze&&ze.tagName.toUpperCase()==="SCRIPT"&&ze.src||new URL("index.umd.cjs",document.baseURI).href;return async function(e={}){var n,i=e,l,d,m=new Promise((t,r)=>{l=t,d=r}),v=typeof window=="object",C=typeof WorkerGlobalScope<"u";typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer",(!globalThis.crypto||!globalThis.crypto.getRandomValues)&&(globalThis.crypto={getRandomValues:t=>{for(let r=0;r<t.length;r++)t[r]=Math.random()*256|0}});var F="./this.program",z=(t,r)=>{throw r},V="";function be(t){return i.locateFile?i.locateFile(t,V):V+t}var je,Be;(v||C)&&(C?V=self.location.href:typeof document<"u"&&document.currentScript&&(V=document.currentScript.src),M&&(V=M),V.startsWith("blob:")?V="":V=V.slice(0,V.replace(/[?#].*/,"").lastIndexOf("/")+1),C&&(Be=t=>{var r=new XMLHttpRequest;return r.open("GET",t,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),je=async t=>{if(ur(t))return new Promise((a,o)=>{var c=new XMLHttpRequest;c.open("GET",t,!0),c.responseType="arraybuffer",c.onload=()=>{if(c.status==200||c.status==0&&c.response){a(c.response);return}o(c.status)},c.onerror=o,c.send(null)});var r=await fetch(t,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)});var Ze=console.log.bind(console),Ne=console.error.bind(console),ct,Et,Ot=!1,Q,oe,ge,_t,D,W,Dt,ce,lr,bt,ur=t=>t.startsWith("file://");function gr(){var t=Et.buffer;Q=new Int8Array(t),ge=new Int16Array(t),i.HEAPU8=oe=new Uint8Array(t),_t=new Uint16Array(t),D=new Int32Array(t),W=new Uint32Array(t),Dt=new Float32Array(t),bt=new Float64Array(t),ce=new BigInt64Array(t),lr=new BigUint64Array(t)}function Rn(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)jn(i.preRun.shift());dr(mr)}function Gn(){!i.noFSInit&&!u.initialized&&u.init(),s.cb(),u.ignorePermissions=!1}function Fn(){if(i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)Un(i.postRun.shift());dr(fr)}var Ye=0,lt=null;function hr(t){Ye++,i.monitorRunDependencies?.(Ye)}function Zt(t){if(Ye--,i.monitorRunDependencies?.(Ye),Ye==0&&lt){var r=lt;lt=null,r()}}function ut(t){i.onAbort?.(t),t="Aborted("+t+")",Ne(t),Ot=!0,t+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(t);throw d(r),r}var ei;function xn(){return i.locateFile?be("magick.wasm"):new URL("data:text/plain;base64,").href}function Ln(t){if(t==ei&&ct)return new Uint8Array(ct);if(Be)return Be(t);throw"both async and sync fetching of the wasm failed"}async function Wn(t){if(!ct)try{var r=await je(t);return new Uint8Array(r)}catch{}return Ln(t)}async function Bn(t,r){try{var a=await Wn(t),o=await WebAssembly.instantiate(a,r);return o}catch(c){Ne(`failed to asynchronously prepare wasm: ${c}`),ut(c)}}async function Nn(t,r,a){if(!t&&typeof WebAssembly.instantiateStreaming=="function"&&!ur(r))try{var o=fetch(r,{credentials:"same-origin"}),c=await WebAssembly.instantiateStreaming(o,a);return c}catch(g){Ne(`wasm streaming compile failed: ${g}`),Ne("falling back to ArrayBuffer instantiation")}return Bn(r,a)}function zn(){return{a:bo}}async function $n(){function t(g,h){return s=g.exports,s=dc(s),Et=s.bb,gr(),Ve=s.wb,Zt(),s}hr();function r(g){return t(g.instance)}var a=zn();if(i.instantiateWasm)return new Promise((g,h)=>{i.instantiateWasm(a,(f,p)=>{g(t(f))})});ei??=xn();try{var o=await Nn(ct,ei,a),c=r(o);return c}catch(g){return d(g),Promise.reject(g)}}class Hn{name="ExitStatus";constructor(r){this.message=`Program terminated with exit(${r})`,this.status=r}}var dr=t=>{for(;t.length>0;)t.shift()(i)},fr=[],Un=t=>fr.push(t),mr=[],jn=t=>mr.push(t);function Yn(t,r="i8"){switch(r.endsWith("*")&&(r="*"),r){case"i1":return Q[t>>>0];case"i8":return Q[t>>>0];case"i16":return ge[t>>>1>>>0];case"i32":return D[t>>>2>>>0];case"i64":return ce[t>>>3];case"float":return Dt[t>>>2>>>0];case"double":return bt[t>>>3>>>0];case"*":return W[t>>>2>>>0];default:ut(`invalid type for getValue: ${r}`)}}var ti=!0;function Vn(t,r,a="i8"){switch(a.endsWith("*")&&(a="*"),a){case"i1":Q[t>>>0]=r;break;case"i8":Q[t>>>0]=r;break;case"i16":ge[t>>>1>>>0]=r;break;case"i32":D[t>>>2>>>0]=r;break;case"i64":ce[t>>>3]=BigInt(r);break;case"float":Dt[t>>>2>>>0]=r;break;case"double":bt[t>>>3>>>0]=r;break;case"*":W[t>>>2>>>0]=r;break;default:ut(`invalid type for setValue: ${a}`)}}var $=t=>Go(t),H=()=>Fo(),Xn=9007199254740992,qn=-9007199254740992,Te=t=>t<qn||t>Xn?NaN:Number(t),ii=[],Ve,B=t=>{var r=ii[t];return r||(ii[t]=r=Ve.get(t)),r};function Kn(t,r){return t>>>=0,B(t)(r)}var et=0;class pr{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){W[this.ptr+4>>>2>>>0]=r}get_type(){return W[this.ptr+4>>>2>>>0]}set_destructor(r){W[this.ptr+8>>>2>>>0]=r}get_destructor(){return W[this.ptr+8>>>2>>>0]}set_caught(r){r=r?1:0,Q[this.ptr+12>>>0]=r}get_caught(){return Q[this.ptr+12>>>0]!=0}set_rethrown(r){r=r?1:0,Q[this.ptr+13>>>0]=r}get_rethrown(){return Q[this.ptr+13>>>0]!=0}init(r,a){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(a)}set_adjusted_ptr(r){W[this.ptr+16>>>2>>>0]=r}get_adjusted_ptr(){return W[this.ptr+16>>>2>>>0]}}var Tt=t=>Ro(t),Qn=t=>{var r=et;if(!r)return Tt(0),0;var a=new pr(r);a.set_adjusted_ptr(r);var o=a.get_type();if(!o)return Tt(0),r;for(var c of t){if(c===0||c===o)break;var g=a.ptr+16;if(xo(c,o,g))return Tt(c),r}return Tt(o),r};function Jn(){return Qn([])}function On(t,r,a){t>>>=0,r>>>=0,a>>>=0;var o=new pr(t);throw o.init(r,a),et=t,et}function Zn(t){throw t>>>=0,et||(et=t),et}var q={isAbs:t=>t.charAt(0)==="/",splitPath:t=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(t).slice(1)},normalizeArray:(t,r)=>{for(var a=0,o=t.length-1;o>=0;o--){var c=t[o];c==="."?t.splice(o,1):c===".."?(t.splice(o,1),a++):a&&(t.splice(o,1),a--)}if(r)for(;a;a--)t.unshift("..");return t},normalize:t=>{var r=q.isAbs(t),a=t.slice(-1)==="/";return t=q.normalizeArray(t.split("/").filter(o=>!!o),!r).join("/"),!t&&!r&&(t="."),t&&a&&(t+="/"),(r?"/":"")+t},dirname:t=>{var r=q.splitPath(t),a=r[0],o=r[1];return!a&&!o?".":(o&&(o=o.slice(0,-1)),a+o)},basename:t=>t&&t.match(/([^\/]+|\/)\/*$/)[1],join:(...t)=>q.normalize(t.join("/")),join2:(t,r)=>q.normalize(t+"/"+r)},ea=()=>t=>crypto.getRandomValues(t),ri=t=>{(ri=ea())(t)},tt={resolve:(...t)=>{for(var r="",a=!1,o=t.length-1;o>=-1&&!a;o--){var c=o>=0?t[o]:u.cwd();if(typeof c!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!c)return"";r=c+"/"+r,a=q.isAbs(c)}return r=q.normalizeArray(r.split("/").filter(g=>!!g),!a).join("/"),(a?"/":"")+r||"."},relative:(t,r)=>{t=tt.resolve(t).slice(1),r=tt.resolve(r).slice(1);function a(w){for(var y=0;y<w.length&&w[y]==="";y++);for(var I=w.length-1;I>=0&&w[I]==="";I--);return y>I?[]:w.slice(y,I-y+1)}for(var o=a(t.split("/")),c=a(r.split("/")),g=Math.min(o.length,c.length),h=g,f=0;f<g;f++)if(o[f]!==c[f]){h=f;break}for(var p=[],f=h;f<o.length;f++)p.push("..");return p=p.concat(c.slice(h)),p.join("/")}},vr=typeof TextDecoder<"u"?new TextDecoder:void 0,it=(t,r=0,a=NaN)=>{r>>>=0;for(var o=r+a,c=r;t[c]&&!(c>=o);)++c;if(c-r>16&&t.buffer&&vr)return vr.decode(t.subarray(r,c));for(var g="";r<c;){var h=t[r++];if(!(h&128)){g+=String.fromCharCode(h);continue}var f=t[r++]&63;if((h&224)==192){g+=String.fromCharCode((h&31)<<6|f);continue}var p=t[r++]&63;if((h&240)==224?h=(h&15)<<12|f<<6|p:h=(h&7)<<18|f<<12|p<<6|t[r++]&63,h<65536)g+=String.fromCharCode(h);else{var w=h-65536;g+=String.fromCharCode(55296|w>>10,56320|w&1023)}}return g},ni=[],Xe=t=>{for(var r=0,a=0;a<t.length;++a){var o=t.charCodeAt(a);o<=127?r++:o<=2047?r+=2:o>=55296&&o<=57343?(r+=4,++a):r+=3}return r},ai=(t,r,a,o)=>{if(a>>>=0,!(o>0))return 0;for(var c=a,g=a+o-1,h=0;h<t.length;++h){var f=t.charCodeAt(h);if(f>=55296&&f<=57343){var p=t.charCodeAt(++h);f=65536+((f&1023)<<10)|p&1023}if(f<=127){if(a>=g)break;r[a++>>>0]=f}else if(f<=2047){if(a+1>=g)break;r[a++>>>0]=192|f>>6,r[a++>>>0]=128|f&63}else if(f<=65535){if(a+2>=g)break;r[a++>>>0]=224|f>>12,r[a++>>>0]=128|f>>6&63,r[a++>>>0]=128|f&63}else{if(a+3>=g)break;r[a++>>>0]=240|f>>18,r[a++>>>0]=128|f>>12&63,r[a++>>>0]=128|f>>6&63,r[a++>>>0]=128|f&63}}return r[a>>>0]=0,a-c},kr=(t,r,a)=>{var o=Xe(t)+1,c=new Array(o),g=ai(t,c,0,c.length);return c.length=g,c},ta=()=>{if(!ni.length){var t=null;if(typeof window<"u"&&typeof window.prompt=="function"&&(t=window.prompt("Input: "),t!==null&&(t+=`
43
- `)),!t)return null;ni=kr(t)}return ni.shift()},qe={ttys:[],init(){},shutdown(){},register(t,r){qe.ttys[t]={input:[],output:[],ops:r},u.registerDevice(t,qe.stream_ops)},stream_ops:{open(t){var r=qe.ttys[t.node.rdev];if(!r)throw new u.ErrnoError(43);t.tty=r,t.seekable=!1},close(t){t.tty.ops.fsync(t.tty)},fsync(t){t.tty.ops.fsync(t.tty)},read(t,r,a,o,c){if(!t.tty||!t.tty.ops.get_char)throw new u.ErrnoError(60);for(var g=0,h=0;h<o;h++){var f;try{f=t.tty.ops.get_char(t.tty)}catch{throw new u.ErrnoError(29)}if(f===void 0&&g===0)throw new u.ErrnoError(6);if(f==null)break;g++,r[a+h]=f}return g&&(t.node.atime=Date.now()),g},write(t,r,a,o,c){if(!t.tty||!t.tty.ops.put_char)throw new u.ErrnoError(60);try{for(var g=0;g<o;g++)t.tty.ops.put_char(t.tty,r[a+g])}catch{throw new u.ErrnoError(29)}return o&&(t.node.mtime=t.node.ctime=Date.now()),g}},default_tty_ops:{get_char(t){return ta()},put_char(t,r){r===null||r===10?(Ze(it(t.output)),t.output=[]):r!=0&&t.output.push(r)},fsync(t){t.output?.length>0&&(Ze(it(t.output)),t.output=[])},ioctl_tcgets(t){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(t,r,a){return 0},ioctl_tiocgwinsz(t){return[24,80]}},default_tty1_ops:{put_char(t,r){r===null||r===10?(Ne(it(t.output)),t.output=[]):r!=0&&t.output.push(r)},fsync(t){t.output?.length>0&&(Ne(it(t.output)),t.output=[])}}},ia=(t,r)=>oe.fill(0,t,t+r),Mr=(t,r)=>Math.ceil(t/r)*r,wr=t=>{t=Mr(t,65536);var r=Ao(65536,t);return r&&ia(r,t),r},x={ops_table:null,mount(t){return x.createNode(null,"/",16895,0)},createNode(t,r,a,o){if(u.isBlkdev(a)||u.isFIFO(a))throw new u.ErrnoError(63);x.ops_table||={dir:{node:{getattr:x.node_ops.getattr,setattr:x.node_ops.setattr,lookup:x.node_ops.lookup,mknod:x.node_ops.mknod,rename:x.node_ops.rename,unlink:x.node_ops.unlink,rmdir:x.node_ops.rmdir,readdir:x.node_ops.readdir,symlink:x.node_ops.symlink},stream:{llseek:x.stream_ops.llseek}},file:{node:{getattr:x.node_ops.getattr,setattr:x.node_ops.setattr},stream:{llseek:x.stream_ops.llseek,read:x.stream_ops.read,write:x.stream_ops.write,mmap:x.stream_ops.mmap,msync:x.stream_ops.msync}},link:{node:{getattr:x.node_ops.getattr,setattr:x.node_ops.setattr,readlink:x.node_ops.readlink},stream:{}},chrdev:{node:{getattr:x.node_ops.getattr,setattr:x.node_ops.setattr},stream:u.chrdev_stream_ops}};var c=u.createNode(t,r,a,o);return u.isDir(c.mode)?(c.node_ops=x.ops_table.dir.node,c.stream_ops=x.ops_table.dir.stream,c.contents={}):u.isFile(c.mode)?(c.node_ops=x.ops_table.file.node,c.stream_ops=x.ops_table.file.stream,c.usedBytes=0,c.contents=null):u.isLink(c.mode)?(c.node_ops=x.ops_table.link.node,c.stream_ops=x.ops_table.link.stream):u.isChrdev(c.mode)&&(c.node_ops=x.ops_table.chrdev.node,c.stream_ops=x.ops_table.chrdev.stream),c.atime=c.mtime=c.ctime=Date.now(),t&&(t.contents[r]=c,t.atime=t.mtime=t.ctime=c.atime),c},getFileDataAsTypedArray(t){return t.contents?t.contents.subarray?t.contents.subarray(0,t.usedBytes):new Uint8Array(t.contents):new Uint8Array(0)},expandFileStorage(t,r){var a=t.contents?t.contents.length:0;if(!(a>=r)){var o=1024*1024;r=Math.max(r,a*(a<o?2:1.125)>>>0),a!=0&&(r=Math.max(r,256));var c=t.contents;t.contents=new Uint8Array(r),t.usedBytes>0&&t.contents.set(c.subarray(0,t.usedBytes),0)}},resizeFileStorage(t,r){if(t.usedBytes!=r)if(r==0)t.contents=null,t.usedBytes=0;else{var a=t.contents;t.contents=new Uint8Array(r),a&&t.contents.set(a.subarray(0,Math.min(r,t.usedBytes))),t.usedBytes=r}},node_ops:{getattr(t){var r={};return r.dev=u.isChrdev(t.mode)?t.id:1,r.ino=t.id,r.mode=t.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=t.rdev,u.isDir(t.mode)?r.size=4096:u.isFile(t.mode)?r.size=t.usedBytes:u.isLink(t.mode)?r.size=t.link.length:r.size=0,r.atime=new Date(t.atime),r.mtime=new Date(t.mtime),r.ctime=new Date(t.ctime),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(t,r){for(const a of["mode","atime","mtime","ctime"])r[a]!=null&&(t[a]=r[a]);r.size!==void 0&&x.resizeFileStorage(t,r.size)},lookup(t,r){throw x.doesNotExistError},mknod(t,r,a,o){return x.createNode(t,r,a,o)},rename(t,r,a){var o;try{o=u.lookupNode(r,a)}catch{}if(o){if(u.isDir(t.mode))for(var c in o.contents)throw new u.ErrnoError(55);u.hashRemoveNode(o)}delete t.parent.contents[t.name],r.contents[a]=t,t.name=a,r.ctime=r.mtime=t.parent.ctime=t.parent.mtime=Date.now()},unlink(t,r){delete t.contents[r],t.ctime=t.mtime=Date.now()},rmdir(t,r){var a=u.lookupNode(t,r);for(var o in a.contents)throw new u.ErrnoError(55);delete t.contents[r],t.ctime=t.mtime=Date.now()},readdir(t){return[".","..",...Object.keys(t.contents)]},symlink(t,r,a){var o=x.createNode(t,r,41471,0);return o.link=a,o},readlink(t){if(!u.isLink(t.mode))throw new u.ErrnoError(28);return t.link}},stream_ops:{read(t,r,a,o,c){var g=t.node.contents;if(c>=t.node.usedBytes)return 0;var h=Math.min(t.node.usedBytes-c,o);if(h>8&&g.subarray)r.set(g.subarray(c,c+h),a);else for(var f=0;f<h;f++)r[a+f]=g[c+f];return h},write(t,r,a,o,c,g){if(r.buffer===Q.buffer&&(g=!1),!o)return 0;var h=t.node;if(h.mtime=h.ctime=Date.now(),r.subarray&&(!h.contents||h.contents.subarray)){if(g)return h.contents=r.subarray(a,a+o),h.usedBytes=o,o;if(h.usedBytes===0&&c===0)return h.contents=r.slice(a,a+o),h.usedBytes=o,o;if(c+o<=h.usedBytes)return h.contents.set(r.subarray(a,a+o),c),o}if(x.expandFileStorage(h,c+o),h.contents.subarray&&r.subarray)h.contents.set(r.subarray(a,a+o),c);else for(var f=0;f<o;f++)h.contents[c+f]=r[a+f];return h.usedBytes=Math.max(h.usedBytes,c+o),o},llseek(t,r,a){var o=r;if(a===1?o+=t.position:a===2&&u.isFile(t.node.mode)&&(o+=t.node.usedBytes),o<0)throw new u.ErrnoError(28);return o},mmap(t,r,a,o,c){if(!u.isFile(t.node.mode))throw new u.ErrnoError(43);var g,h,f=t.node.contents;if(!(c&2)&&f&&f.buffer===Q.buffer)h=!1,g=f.byteOffset;else{if(h=!0,g=wr(r),!g)throw new u.ErrnoError(48);f&&((a>0||a+r<f.length)&&(f.subarray?f=f.subarray(a,a+r):f=Array.prototype.slice.call(f,a,a+r)),Q.set(f,g>>>0))}return{ptr:g,allocated:h}},msync(t,r,a,o,c){return x.stream_ops.write(t,r,0,o,a,!1),0}}},ra=async t=>{var r=await je(t);return new Uint8Array(r)},na=(t,r,a,o,c,g)=>{u.createDataFile(t,r,a,o,c,g)},yr=[],aa=(t,r,a,o)=>{typeof Browser<"u"&&Browser.init();var c=!1;return yr.forEach(g=>{c||g.canHandle(r)&&(g.handle(t,r,a,o),c=!0)}),c},sa=(t,r,a,o,c,g,h,f,p,w)=>{var y=r?tt.resolve(q.join2(t,r)):t;function I(E){function P(T){w?.(),f||na(t,r,T,o,c,p),g?.(),Zt()}aa(E,y,P,()=>{h?.(),Zt()})||P(E)}hr(),typeof a=="string"?ra(a).then(I,h):I(a)},oa=t=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},a=r[t];if(typeof a>"u")throw new Error(`Unknown file open mode: ${t}`);return a},si=(t,r)=>{var a=0;return t&&(a|=365),r&&(a|=146),a},u={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,readFiles:{},ErrnoError:class{name="ErrnoError";constructor(t){this.errno=t}},FSStream:class{shared={};get object(){return this.node}set object(t){this.node=t}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(t){this.shared.flags=t}get position(){return this.shared.position}set position(t){this.shared.position=t}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(t,r,a,o){t||(t=this),this.parent=t,this.mount=t.mount,this.id=u.nextInode++,this.name=r,this.mode=a,this.rdev=o,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(t){t?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(t){t?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return u.isDir(this.mode)}get isDevice(){return u.isChrdev(this.mode)}},lookupPath(t,r={}){if(!t)throw new u.ErrnoError(44);r.follow_mount??=!0,q.isAbs(t)||(t=u.cwd()+"/"+t);e:for(var a=0;a<40;a++){for(var o=t.split("/").filter(w=>!!w),c=u.root,g="/",h=0;h<o.length;h++){var f=h===o.length-1;if(f&&r.parent)break;if(o[h]!=="."){if(o[h]===".."){if(g=q.dirname(g),u.isRoot(c)){t=g+"/"+o.slice(h+1).join("/");continue e}else c=c.parent;continue}g=q.join2(g,o[h]);try{c=u.lookupNode(c,o[h])}catch(w){if(w?.errno===44&&f&&r.noent_okay)return{path:g};throw w}if(u.isMountpoint(c)&&(!f||r.follow_mount)&&(c=c.mounted.root),u.isLink(c.mode)&&(!f||r.follow)){if(!c.node_ops.readlink)throw new u.ErrnoError(52);var p=c.node_ops.readlink(c);q.isAbs(p)||(p=q.dirname(g)+"/"+p),t=p+"/"+o.slice(h+1).join("/");continue e}}}return{path:g,node:c}}throw new u.ErrnoError(32)},getPath(t){for(var r;;){if(u.isRoot(t)){var a=t.mount.mountpoint;return r?a[a.length-1]!=="/"?`${a}/${r}`:a+r:a}r=r?`${t.name}/${r}`:t.name,t=t.parent}},hashName(t,r){for(var a=0,o=0;o<r.length;o++)a=(a<<5)-a+r.charCodeAt(o)|0;return(t+a>>>0)%u.nameTable.length},hashAddNode(t){var r=u.hashName(t.parent.id,t.name);t.name_next=u.nameTable[r],u.nameTable[r]=t},hashRemoveNode(t){var r=u.hashName(t.parent.id,t.name);if(u.nameTable[r]===t)u.nameTable[r]=t.name_next;else for(var a=u.nameTable[r];a;){if(a.name_next===t){a.name_next=t.name_next;break}a=a.name_next}},lookupNode(t,r){var a=u.mayLookup(t);if(a)throw new u.ErrnoError(a);for(var o=u.hashName(t.id,r),c=u.nameTable[o];c;c=c.name_next){var g=c.name;if(c.parent.id===t.id&&g===r)return c}return u.lookup(t,r)},createNode(t,r,a,o){var c=new u.FSNode(t,r,a,o);return u.hashAddNode(c),c},destroyNode(t){u.hashRemoveNode(t)},isRoot(t){return t===t.parent},isMountpoint(t){return!!t.mounted},isFile(t){return(t&61440)===32768},isDir(t){return(t&61440)===16384},isLink(t){return(t&61440)===40960},isChrdev(t){return(t&61440)===8192},isBlkdev(t){return(t&61440)===24576},isFIFO(t){return(t&61440)===4096},isSocket(t){return(t&49152)===49152},flagsToPermissionString(t){var r=["r","w","rw"][t&3];return t&512&&(r+="w"),r},nodePermissions(t,r){return u.ignorePermissions?0:r.includes("r")&&!(t.mode&292)||r.includes("w")&&!(t.mode&146)||r.includes("x")&&!(t.mode&73)?2:0},mayLookup(t){if(!u.isDir(t.mode))return 54;var r=u.nodePermissions(t,"x");return r||(t.node_ops.lookup?0:2)},mayCreate(t,r){if(!u.isDir(t.mode))return 54;try{var a=u.lookupNode(t,r);return 20}catch{}return u.nodePermissions(t,"wx")},mayDelete(t,r,a){var o;try{o=u.lookupNode(t,r)}catch(g){return g.errno}var c=u.nodePermissions(t,"wx");if(c)return c;if(a){if(!u.isDir(o.mode))return 54;if(u.isRoot(o)||u.getPath(o)===u.cwd())return 10}else if(u.isDir(o.mode))return 31;return 0},mayOpen(t,r){return t?u.isLink(t.mode)?32:u.isDir(t.mode)&&(u.flagsToPermissionString(r)!=="r"||r&576)?31:u.nodePermissions(t,u.flagsToPermissionString(r)):44},checkOpExists(t,r){if(!t)throw new u.ErrnoError(r);return t},MAX_OPEN_FDS:4096,nextfd(){for(var t=0;t<=u.MAX_OPEN_FDS;t++)if(!u.streams[t])return t;throw new u.ErrnoError(33)},getStreamChecked(t){var r=u.getStream(t);if(!r)throw new u.ErrnoError(8);return r},getStream:t=>u.streams[t],createStream(t,r=-1){return t=Object.assign(new u.FSStream,t),r==-1&&(r=u.nextfd()),t.fd=r,u.streams[r]=t,t},closeStream(t){u.streams[t]=null},dupStream(t,r=-1){var a=u.createStream(t,r);return a.stream_ops?.dup?.(a),a},doSetAttr(t,r,a){var o=t?.stream_ops.setattr,c=o?t:r;o??=r.node_ops.setattr,u.checkOpExists(o,63),o(c,a)},chrdev_stream_ops:{open(t){var r=u.getDevice(t.node.rdev);t.stream_ops=r.stream_ops,t.stream_ops.open?.(t)},llseek(){throw new u.ErrnoError(70)}},major:t=>t>>8,minor:t=>t&255,makedev:(t,r)=>t<<8|r,registerDevice(t,r){u.devices[t]={stream_ops:r}},getDevice:t=>u.devices[t],getMounts(t){for(var r=[],a=[t];a.length;){var o=a.pop();r.push(o),a.push(...o.mounts)}return r},syncfs(t,r){typeof t=="function"&&(r=t,t=!1),u.syncFSRequests++,u.syncFSRequests>1&&Ne(`warning: ${u.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var a=u.getMounts(u.root.mount),o=0;function c(h){return u.syncFSRequests--,r(h)}function g(h){if(h)return g.errored?void 0:(g.errored=!0,c(h));++o>=a.length&&c(null)}a.forEach(h=>{if(!h.type.syncfs)return g(null);h.type.syncfs(h,t,g)})},mount(t,r,a){var o=a==="/",c=!a,g;if(o&&u.root)throw new u.ErrnoError(10);if(!o&&!c){var h=u.lookupPath(a,{follow_mount:!1});if(a=h.path,g=h.node,u.isMountpoint(g))throw new u.ErrnoError(10);if(!u.isDir(g.mode))throw new u.ErrnoError(54)}var f={type:t,opts:r,mountpoint:a,mounts:[]},p=t.mount(f);return p.mount=f,f.root=p,o?u.root=p:g&&(g.mounted=f,g.mount&&g.mount.mounts.push(f)),p},unmount(t){var r=u.lookupPath(t,{follow_mount:!1});if(!u.isMountpoint(r.node))throw new u.ErrnoError(28);var a=r.node,o=a.mounted,c=u.getMounts(o);Object.keys(u.nameTable).forEach(h=>{for(var f=u.nameTable[h];f;){var p=f.name_next;c.includes(f.mount)&&u.destroyNode(f),f=p}}),a.mounted=null;var g=a.mount.mounts.indexOf(o);a.mount.mounts.splice(g,1)},lookup(t,r){return t.node_ops.lookup(t,r)},mknod(t,r,a){var o=u.lookupPath(t,{parent:!0}),c=o.node,g=q.basename(t);if(!g)throw new u.ErrnoError(28);if(g==="."||g==="..")throw new u.ErrnoError(20);var h=u.mayCreate(c,g);if(h)throw new u.ErrnoError(h);if(!c.node_ops.mknod)throw new u.ErrnoError(63);return c.node_ops.mknod(c,g,r,a)},statfs(t){return u.statfsNode(u.lookupPath(t,{follow:!0}).node)},statfsStream(t){return u.statfsNode(t.node)},statfsNode(t){var r={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:u.nextInode,ffree:u.nextInode-1,fsid:42,flags:2,namelen:255};return t.node_ops.statfs&&Object.assign(r,t.node_ops.statfs(t.mount.opts.root)),r},create(t,r=438){return r&=4095,r|=32768,u.mknod(t,r,0)},mkdir(t,r=511){return r&=1023,r|=16384,u.mknod(t,r,0)},mkdirTree(t,r){var a=t.split("/"),o="";for(var c of a)if(c){(o||q.isAbs(t))&&(o+="/"),o+=c;try{u.mkdir(o,r)}catch(g){if(g.errno!=20)throw g}}},mkdev(t,r,a){return typeof a>"u"&&(a=r,r=438),r|=8192,u.mknod(t,r,a)},symlink(t,r){if(!tt.resolve(t))throw new u.ErrnoError(44);var a=u.lookupPath(r,{parent:!0}),o=a.node;if(!o)throw new u.ErrnoError(44);var c=q.basename(r),g=u.mayCreate(o,c);if(g)throw new u.ErrnoError(g);if(!o.node_ops.symlink)throw new u.ErrnoError(63);return o.node_ops.symlink(o,c,t)},rename(t,r){var a=q.dirname(t),o=q.dirname(r),c=q.basename(t),g=q.basename(r),h,f,p;if(h=u.lookupPath(t,{parent:!0}),f=h.node,h=u.lookupPath(r,{parent:!0}),p=h.node,!f||!p)throw new u.ErrnoError(44);if(f.mount!==p.mount)throw new u.ErrnoError(75);var w=u.lookupNode(f,c),y=tt.relative(t,o);if(y.charAt(0)!==".")throw new u.ErrnoError(28);if(y=tt.relative(r,a),y.charAt(0)!==".")throw new u.ErrnoError(55);var I;try{I=u.lookupNode(p,g)}catch{}if(w!==I){var E=u.isDir(w.mode),P=u.mayDelete(f,c,E);if(P)throw new u.ErrnoError(P);if(P=I?u.mayDelete(p,g,E):u.mayCreate(p,g),P)throw new u.ErrnoError(P);if(!f.node_ops.rename)throw new u.ErrnoError(63);if(u.isMountpoint(w)||I&&u.isMountpoint(I))throw new u.ErrnoError(10);if(p!==f&&(P=u.nodePermissions(f,"w"),P))throw new u.ErrnoError(P);u.hashRemoveNode(w);try{f.node_ops.rename(w,p,g),w.parent=p}catch(T){throw T}finally{u.hashAddNode(w)}}},rmdir(t){var r=u.lookupPath(t,{parent:!0}),a=r.node,o=q.basename(t),c=u.lookupNode(a,o),g=u.mayDelete(a,o,!0);if(g)throw new u.ErrnoError(g);if(!a.node_ops.rmdir)throw new u.ErrnoError(63);if(u.isMountpoint(c))throw new u.ErrnoError(10);a.node_ops.rmdir(a,o),u.destroyNode(c)},readdir(t){var r=u.lookupPath(t,{follow:!0}),a=r.node,o=u.checkOpExists(a.node_ops.readdir,54);return o(a)},unlink(t){var r=u.lookupPath(t,{parent:!0}),a=r.node;if(!a)throw new u.ErrnoError(44);var o=q.basename(t),c=u.lookupNode(a,o),g=u.mayDelete(a,o,!1);if(g)throw new u.ErrnoError(g);if(!a.node_ops.unlink)throw new u.ErrnoError(63);if(u.isMountpoint(c))throw new u.ErrnoError(10);a.node_ops.unlink(a,o),u.destroyNode(c)},readlink(t){var r=u.lookupPath(t),a=r.node;if(!a)throw new u.ErrnoError(44);if(!a.node_ops.readlink)throw new u.ErrnoError(28);return a.node_ops.readlink(a)},stat(t,r){var a=u.lookupPath(t,{follow:!r}),o=a.node,c=u.checkOpExists(o.node_ops.getattr,63);return c(o)},fstat(t){var r=u.getStreamChecked(t),a=r.node,o=r.stream_ops.getattr,c=o?r:a;return o??=a.node_ops.getattr,u.checkOpExists(o,63),o(c)},lstat(t){return u.stat(t,!0)},doChmod(t,r,a,o){u.doSetAttr(t,r,{mode:a&4095|r.mode&-4096,ctime:Date.now(),dontFollow:o})},chmod(t,r,a){var o;if(typeof t=="string"){var c=u.lookupPath(t,{follow:!a});o=c.node}else o=t;u.doChmod(null,o,r,a)},lchmod(t,r){u.chmod(t,r,!0)},fchmod(t,r){var a=u.getStreamChecked(t);u.doChmod(a,a.node,r,!1)},doChown(t,r,a){u.doSetAttr(t,r,{timestamp:Date.now(),dontFollow:a})},chown(t,r,a,o){var c;if(typeof t=="string"){var g=u.lookupPath(t,{follow:!o});c=g.node}else c=t;u.doChown(null,c,o)},lchown(t,r,a){u.chown(t,r,a,!0)},fchown(t,r,a){var o=u.getStreamChecked(t);u.doChown(o,o.node,!1)},doTruncate(t,r,a){if(u.isDir(r.mode))throw new u.ErrnoError(31);if(!u.isFile(r.mode))throw new u.ErrnoError(28);var o=u.nodePermissions(r,"w");if(o)throw new u.ErrnoError(o);u.doSetAttr(t,r,{size:a,timestamp:Date.now()})},truncate(t,r){if(r<0)throw new u.ErrnoError(28);var a;if(typeof t=="string"){var o=u.lookupPath(t,{follow:!0});a=o.node}else a=t;u.doTruncate(null,a,r)},ftruncate(t,r){var a=u.getStreamChecked(t);if(r<0||(a.flags&2097155)===0)throw new u.ErrnoError(28);u.doTruncate(a,a.node,r)},utime(t,r,a){var o=u.lookupPath(t,{follow:!0}),c=o.node,g=u.checkOpExists(c.node_ops.setattr,63);g(c,{atime:r,mtime:a})},open(t,r,a=438){if(t==="")throw new u.ErrnoError(44);r=typeof r=="string"?oa(r):r,r&64?a=a&4095|32768:a=0;var o,c;if(typeof t=="object")o=t;else{c=t.endsWith("/");var g=u.lookupPath(t,{follow:!(r&131072),noent_okay:!0});o=g.node,t=g.path}var h=!1;if(r&64)if(o){if(r&128)throw new u.ErrnoError(20)}else{if(c)throw new u.ErrnoError(31);o=u.mknod(t,a|511,0),h=!0}if(!o)throw new u.ErrnoError(44);if(u.isChrdev(o.mode)&&(r&=-513),r&65536&&!u.isDir(o.mode))throw new u.ErrnoError(54);if(!h){var f=u.mayOpen(o,r);if(f)throw new u.ErrnoError(f)}r&512&&!h&&u.truncate(o,0),r&=-131713;var p=u.createStream({node:o,path:u.getPath(o),flags:r,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return p.stream_ops.open&&p.stream_ops.open(p),h&&u.chmod(o,a&511),i.logReadFiles&&!(r&1)&&(t in u.readFiles||(u.readFiles[t]=1)),p},close(t){if(u.isClosed(t))throw new u.ErrnoError(8);t.getdents&&(t.getdents=null);try{t.stream_ops.close&&t.stream_ops.close(t)}catch(r){throw r}finally{u.closeStream(t.fd)}t.fd=null},isClosed(t){return t.fd===null},llseek(t,r,a){if(u.isClosed(t))throw new u.ErrnoError(8);if(!t.seekable||!t.stream_ops.llseek)throw new u.ErrnoError(70);if(a!=0&&a!=1&&a!=2)throw new u.ErrnoError(28);return t.position=t.stream_ops.llseek(t,r,a),t.ungotten=[],t.position},read(t,r,a,o,c){if(o<0||c<0)throw new u.ErrnoError(28);if(u.isClosed(t))throw new u.ErrnoError(8);if((t.flags&2097155)===1)throw new u.ErrnoError(8);if(u.isDir(t.node.mode))throw new u.ErrnoError(31);if(!t.stream_ops.read)throw new u.ErrnoError(28);var g=typeof c<"u";if(!g)c=t.position;else if(!t.seekable)throw new u.ErrnoError(70);var h=t.stream_ops.read(t,r,a,o,c);return g||(t.position+=h),h},write(t,r,a,o,c,g){if(o<0||c<0)throw new u.ErrnoError(28);if(u.isClosed(t))throw new u.ErrnoError(8);if((t.flags&2097155)===0)throw new u.ErrnoError(8);if(u.isDir(t.node.mode))throw new u.ErrnoError(31);if(!t.stream_ops.write)throw new u.ErrnoError(28);t.seekable&&t.flags&1024&&u.llseek(t,0,2);var h=typeof c<"u";if(!h)c=t.position;else if(!t.seekable)throw new u.ErrnoError(70);var f=t.stream_ops.write(t,r,a,o,c,g);return h||(t.position+=f),f},mmap(t,r,a,o,c){if((o&2)!==0&&(c&2)===0&&(t.flags&2097155)!==2)throw new u.ErrnoError(2);if((t.flags&2097155)===1)throw new u.ErrnoError(2);if(!t.stream_ops.mmap)throw new u.ErrnoError(43);if(!r)throw new u.ErrnoError(28);return t.stream_ops.mmap(t,r,a,o,c)},msync(t,r,a,o,c){return t.stream_ops.msync?t.stream_ops.msync(t,r,a,o,c):0},ioctl(t,r,a){if(!t.stream_ops.ioctl)throw new u.ErrnoError(59);return t.stream_ops.ioctl(t,r,a)},readFile(t,r={}){if(r.flags=r.flags||0,r.encoding=r.encoding||"binary",r.encoding!=="utf8"&&r.encoding!=="binary")throw new Error(`Invalid encoding type "${r.encoding}"`);var a,o=u.open(t,r.flags),c=u.stat(t),g=c.size,h=new Uint8Array(g);return u.read(o,h,0,g,0),r.encoding==="utf8"?a=it(h):r.encoding==="binary"&&(a=h),u.close(o),a},writeFile(t,r,a={}){a.flags=a.flags||577;var o=u.open(t,a.flags,a.mode);if(typeof r=="string"){var c=new Uint8Array(Xe(r)+1),g=ai(r,c,0,c.length);u.write(o,c,0,g,void 0,a.canOwn)}else if(ArrayBuffer.isView(r))u.write(o,r,0,r.byteLength,void 0,a.canOwn);else throw new Error("Unsupported data type");u.close(o)},cwd:()=>u.currentPath,chdir(t){var r=u.lookupPath(t,{follow:!0});if(r.node===null)throw new u.ErrnoError(44);if(!u.isDir(r.node.mode))throw new u.ErrnoError(54);var a=u.nodePermissions(r.node,"x");if(a)throw new u.ErrnoError(a);u.currentPath=r.path},createDefaultDirectories(){u.mkdir("/tmp"),u.mkdir("/home"),u.mkdir("/home/web_user")},createDefaultDevices(){u.mkdir("/dev"),u.registerDevice(u.makedev(1,3),{read:()=>0,write:(o,c,g,h,f)=>h,llseek:()=>0}),u.mkdev("/dev/null",u.makedev(1,3)),qe.register(u.makedev(5,0),qe.default_tty_ops),qe.register(u.makedev(6,0),qe.default_tty1_ops),u.mkdev("/dev/tty",u.makedev(5,0)),u.mkdev("/dev/tty1",u.makedev(6,0));var t=new Uint8Array(1024),r=0,a=()=>(r===0&&(ri(t),r=t.byteLength),t[--r]);u.createDevice("/dev","random",a),u.createDevice("/dev","urandom",a),u.mkdir("/dev/shm"),u.mkdir("/dev/shm/tmp")},createSpecialDirectories(){u.mkdir("/proc");var t=u.mkdir("/proc/self");u.mkdir("/proc/self/fd"),u.mount({mount(){var r=u.createNode(t,"fd",16895,73);return r.stream_ops={llseek:x.stream_ops.llseek},r.node_ops={lookup(a,o){var c=+o,g=u.getStreamChecked(c),h={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>g.path},id:c+1};return h.parent=h,h},readdir(){return Array.from(u.streams.entries()).filter(([a,o])=>o).map(([a,o])=>a.toString())}},r}},{},"/proc/self/fd")},createStandardStreams(t,r,a){t?u.createDevice("/dev","stdin",t):u.symlink("/dev/tty","/dev/stdin"),r?u.createDevice("/dev","stdout",null,r):u.symlink("/dev/tty","/dev/stdout"),a?u.createDevice("/dev","stderr",null,a):u.symlink("/dev/tty1","/dev/stderr"),u.open("/dev/stdin",0),u.open("/dev/stdout",1),u.open("/dev/stderr",1)},staticInit(){u.nameTable=new Array(4096),u.mount(x,{},"/"),u.createDefaultDirectories(),u.createDefaultDevices(),u.createSpecialDirectories(),u.filesystems={MEMFS:x}},init(t,r,a){u.initialized=!0,t??=i.stdin,r??=i.stdout,a??=i.stderr,u.createStandardStreams(t,r,a)},quit(){u.initialized=!1;for(var t of u.streams)t&&u.close(t)},findObject(t,r){var a=u.analyzePath(t,r);return a.exists?a.object:null},analyzePath(t,r){try{var a=u.lookupPath(t,{follow:!r});t=a.path}catch{}var o={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var a=u.lookupPath(t,{parent:!0});o.parentExists=!0,o.parentPath=a.path,o.parentObject=a.node,o.name=q.basename(t),a=u.lookupPath(t,{follow:!r}),o.exists=!0,o.path=a.path,o.object=a.node,o.name=a.node.name,o.isRoot=a.path==="/"}catch(c){o.error=c.errno}return o},createPath(t,r,a,o){t=typeof t=="string"?t:u.getPath(t);for(var c=r.split("/").reverse();c.length;){var g=c.pop();if(g){var h=q.join2(t,g);try{u.mkdir(h)}catch(f){if(f.errno!=20)throw f}t=h}}return h},createFile(t,r,a,o,c){var g=q.join2(typeof t=="string"?t:u.getPath(t),r),h=si(o,c);return u.create(g,h)},createDataFile(t,r,a,o,c,g){var h=r;t&&(t=typeof t=="string"?t:u.getPath(t),h=r?q.join2(t,r):t);var f=si(o,c),p=u.create(h,f);if(a){if(typeof a=="string"){for(var w=new Array(a.length),y=0,I=a.length;y<I;++y)w[y]=a.charCodeAt(y);a=w}u.chmod(p,f|146);var E=u.open(p,577);u.write(E,a,0,a.length,0,g),u.close(E),u.chmod(p,f)}},createDevice(t,r,a,o){var c=q.join2(typeof t=="string"?t:u.getPath(t),r),g=si(!!a,!!o);u.createDevice.major??=64;var h=u.makedev(u.createDevice.major++,0);return u.registerDevice(h,{open(f){f.seekable=!1},close(f){o?.buffer?.length&&o(10)},read(f,p,w,y,I){for(var E=0,P=0;P<y;P++){var T;try{T=a()}catch{throw new u.ErrnoError(29)}if(T===void 0&&E===0)throw new u.ErrnoError(6);if(T==null)break;E++,p[w+P]=T}return E&&(f.node.atime=Date.now()),E},write(f,p,w,y,I){for(var E=0;E<y;E++)try{o(p[w+E])}catch{throw new u.ErrnoError(29)}return y&&(f.node.mtime=f.node.ctime=Date.now()),E}}),u.mkdev(c,g,h)},forceLoadFile(t){if(t.isDevice||t.isFolder||t.link||t.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");try{t.contents=Be(t.url),t.usedBytes=t.contents.length}catch{throw new u.ErrnoError(29)}},createLazyFile(t,r,a,o,c){class g{lengthKnown=!1;chunks=[];get(P){if(!(P>this.length-1||P<0)){var T=P%this.chunkSize,j=P/this.chunkSize|0;return this.getter(j)[T]}}setDataGetter(P){this.getter=P}cacheLength(){var P=new XMLHttpRequest;if(P.open("HEAD",a,!1),P.send(null),!(P.status>=200&&P.status<300||P.status===304))throw new Error("Couldn't load "+a+". Status: "+P.status);var T=Number(P.getResponseHeader("Content-length")),j,ie=(j=P.getResponseHeader("Accept-Ranges"))&&j==="bytes",O=(j=P.getResponseHeader("Content-Encoding"))&&j==="gzip",re=1024*1024;ie||(re=T);var J=(de,Ge)=>{if(de>Ge)throw new Error("invalid range ("+de+", "+Ge+") or no bytes requested!");if(Ge>T-1)throw new Error("only "+T+" bytes available! programmer error!");var Z=new XMLHttpRequest;if(Z.open("GET",a,!1),T!==re&&Z.setRequestHeader("Range","bytes="+de+"-"+Ge),Z.responseType="arraybuffer",Z.overrideMimeType&&Z.overrideMimeType("text/plain; charset=x-user-defined"),Z.send(null),!(Z.status>=200&&Z.status<300||Z.status===304))throw new Error("Couldn't load "+a+". Status: "+Z.status);return Z.response!==void 0?new Uint8Array(Z.response||[]):kr(Z.responseText||"")},Se=this;Se.setDataGetter(de=>{var Ge=de*re,Z=(de+1)*re-1;if(Z=Math.min(Z,T-1),typeof Se.chunks[de]>"u"&&(Se.chunks[de]=J(Ge,Z)),typeof Se.chunks[de]>"u")throw new Error("doXHR failed!");return Se.chunks[de]}),(O||!T)&&(re=T=1,T=this.getter(0).length,re=T,Ze("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=T,this._chunkSize=re,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!C)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var h=new g,f={isDevice:!1,contents:h}}else var f={isDevice:!1,url:a};var p=u.createFile(t,r,f,o,c);f.contents?p.contents=f.contents:f.url&&(p.contents=null,p.url=f.url),Object.defineProperties(p,{usedBytes:{get:function(){return this.contents.length}}});var w={},y=Object.keys(p.stream_ops);y.forEach(E=>{var P=p.stream_ops[E];w[E]=(...T)=>(u.forceLoadFile(p),P(...T))});function I(E,P,T,j,ie){var O=E.node.contents;if(ie>=O.length)return 0;var re=Math.min(O.length-ie,j);if(O.slice)for(var J=0;J<re;J++)P[T+J]=O[ie+J];else for(var J=0;J<re;J++)P[T+J]=O.get(ie+J);return re}return w.read=(E,P,T,j,ie)=>(u.forceLoadFile(p),I(E,P,T,j,ie)),w.mmap=(E,P,T,j,ie)=>{u.forceLoadFile(p);var O=wr(P);if(!O)throw new u.ErrnoError(48);return I(E,Q,O,P,T),{ptr:O,allocated:!0}},p.stream_ops=w,p}},oi=(t,r)=>(t>>>=0,t?it(oe,t,r):""),G={DEFAULT_POLLMASK:5,calculateAt(t,r,a){if(q.isAbs(r))return r;var o;if(t===-100)o=u.cwd();else{var c=G.getStreamFromFD(t);o=c.path}if(r.length==0){if(!a)throw new u.ErrnoError(44);return o}return o+"/"+r},writeStat(t,r){D[t>>>2>>>0]=r.dev,D[t+4>>>2>>>0]=r.mode,W[t+8>>>2>>>0]=r.nlink,D[t+12>>>2>>>0]=r.uid,D[t+16>>>2>>>0]=r.gid,D[t+20>>>2>>>0]=r.rdev,ce[t+24>>>3]=BigInt(r.size),D[t+32>>>2>>>0]=4096,D[t+36>>>2>>>0]=r.blocks;var a=r.atime.getTime(),o=r.mtime.getTime(),c=r.ctime.getTime();return ce[t+40>>>3]=BigInt(Math.floor(a/1e3)),W[t+48>>>2>>>0]=a%1e3*1e3*1e3,ce[t+56>>>3]=BigInt(Math.floor(o/1e3)),W[t+64>>>2>>>0]=o%1e3*1e3*1e3,ce[t+72>>>3]=BigInt(Math.floor(c/1e3)),W[t+80>>>2>>>0]=c%1e3*1e3*1e3,ce[t+88>>>3]=BigInt(r.ino),0},writeStatFs(t,r){D[t+4>>>2>>>0]=r.bsize,D[t+40>>>2>>>0]=r.bsize,D[t+8>>>2>>>0]=r.blocks,D[t+12>>>2>>>0]=r.bfree,D[t+16>>>2>>>0]=r.bavail,D[t+20>>>2>>>0]=r.files,D[t+24>>>2>>>0]=r.ffree,D[t+28>>>2>>>0]=r.fsid,D[t+44>>>2>>>0]=r.flags,D[t+36>>>2>>>0]=r.namelen},doMsync(t,r,a,o,c){if(!u.isFile(r.node.mode))throw new u.ErrnoError(43);if(o&2)return 0;var g=oe.slice(t,t+a);u.msync(r,g,c,a,o)},getStreamFromFD(t){var r=u.getStreamChecked(t);return r},varargs:void 0,getStr(t){var r=oi(t);return r}};function ca(t,r){t>>>=0;try{return t=G.getStr(t),u.chmod(t,r),0}catch(a){if(typeof u>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}function _a(t){try{var r=G.getStreamFromFD(t);return u.dupStream(r).fd}catch(a){if(typeof u>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}function la(t,r,a,o){r>>>=0;try{if(r=G.getStr(r),r=G.calculateAt(t,r),a&-8)return-28;var c=u.lookupPath(r,{follow:!0}),g=c.node;if(!g)return-44;var h="";return a&4&&(h+="r"),a&2&&(h+="w"),a&1&&(h+="x"),h&&u.nodePermissions(g,h)?-2:0}catch(f){if(typeof u>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}function ua(t,r,a,o){a=Te(a),o=Te(o);try{if(isNaN(a))return 61;if(r!=0)return-138;if(a<0||o<0)return-28;var c=u.fstat(t).size,g=a+o;return g>c&&u.ftruncate(t,g),0}catch(h){if(typeof u>"u"||h.name!=="ErrnoError")throw h;return-h.errno}}function ga(t,r){try{return u.fchmod(t,r),0}catch(a){if(typeof u>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}var At=()=>{var t=D[+G.varargs>>>2>>>0];return G.varargs+=4,t},rt=At;function ha(t,r,a){a>>>=0,G.varargs=a;try{var o=G.getStreamFromFD(t);switch(r){case 0:{var c=At();if(c<0)return-28;for(;u.streams[c];)c++;var g;return g=u.dupStream(o,c),g.fd}case 1:case 2:return 0;case 3:return o.flags;case 4:{var c=At();return o.flags|=c,0}case 12:{var c=rt(),h=0;return ge[c+h>>>1>>>0]=2,0}case 13:case 14:return 0}return-28}catch(f){if(typeof u>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}function da(t,r){r>>>=0;try{return G.writeStat(r,u.fstat(t))}catch(a){if(typeof u>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}var ye=(t,r,a)=>ai(t,oe,r,a);function fa(t,r){t>>>=0,r>>>=0;try{if(r===0)return-28;var a=u.cwd(),o=Xe(a)+1;return r<o?-68:(ye(a,t,r),o)}catch(c){if(typeof u>"u"||c.name!=="ErrnoError")throw c;return-c.errno}}function ma(t,r,a){r>>>=0,a>>>=0;try{var o=G.getStreamFromFD(t);o.getdents||=u.readdir(o.path);for(var c=280,g=0,h=u.llseek(o,0,1),f=Math.floor(h/c),p=Math.min(o.getdents.length,f+Math.floor(a/c)),w=f;w<p;w++){var y,I,E=o.getdents[w];if(E===".")y=o.node.id,I=4;else if(E===".."){var P=u.lookupPath(o.path,{parent:!0});y=P.node.id,I=4}else{var T;try{T=u.lookupNode(o.node,E)}catch(j){if(j?.errno===28)continue;throw j}y=T.id,I=u.isChrdev(T.mode)?2:u.isDir(T.mode)?4:u.isLink(T.mode)?10:8}ce[r+g>>>3]=BigInt(y),ce[r+g+8>>>3]=BigInt((w+1)*c),ge[r+g+16>>>1>>>0]=280,Q[r+g+18>>>0]=I,ye(E,r+g+19,256),g+=c}return u.llseek(o,w*c,0),g}catch(j){if(typeof u>"u"||j.name!=="ErrnoError")throw j;return-j.errno}}function pa(t,r,a){a>>>=0,G.varargs=a;try{var o=G.getStreamFromFD(t);switch(r){case 21509:return o.tty?0:-59;case 21505:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tcgets){var c=o.tty.ops.ioctl_tcgets(o),g=rt();D[g>>>2>>>0]=c.c_iflag||0,D[g+4>>>2>>>0]=c.c_oflag||0,D[g+8>>>2>>>0]=c.c_cflag||0,D[g+12>>>2>>>0]=c.c_lflag||0;for(var h=0;h<32;h++)Q[g+h+17>>>0]=c.c_cc[h]||0;return 0}return 0}case 21510:case 21511:case 21512:return o.tty?0:-59;case 21506:case 21507:case 21508:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tcsets){for(var g=rt(),f=D[g>>>2>>>0],p=D[g+4>>>2>>>0],w=D[g+8>>>2>>>0],y=D[g+12>>>2>>>0],I=[],h=0;h<32;h++)I.push(Q[g+h+17>>>0]);return o.tty.ops.ioctl_tcsets(o.tty,r,{c_iflag:f,c_oflag:p,c_cflag:w,c_lflag:y,c_cc:I})}return 0}case 21519:{if(!o.tty)return-59;var g=rt();return D[g>>>2>>>0]=0,0}case 21520:return o.tty?-28:-59;case 21531:{var g=rt();return u.ioctl(o,r,g)}case 21523:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tiocgwinsz){var E=o.tty.ops.ioctl_tiocgwinsz(o.tty),g=rt();ge[g>>>1>>>0]=E[0],ge[g+2>>>1>>>0]=E[1]}return 0}case 21524:return o.tty?0:-59;case 21515:return o.tty?0:-59;default:return-28}}catch(P){if(typeof u>"u"||P.name!=="ErrnoError")throw P;return-P.errno}}function va(t,r){t>>>=0,r>>>=0;try{return t=G.getStr(t),G.writeStat(r,u.lstat(t))}catch(a){if(typeof u>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}function ka(t,r,a,o){r>>>=0,a>>>=0;try{r=G.getStr(r);var c=o&256,g=o&4096;return o=o&-6401,r=G.calculateAt(t,r,g),G.writeStat(a,c?u.lstat(r):u.stat(r))}catch(h){if(typeof u>"u"||h.name!=="ErrnoError")throw h;return-h.errno}}function Ma(t,r,a,o){r>>>=0,o>>>=0,G.varargs=o;try{r=G.getStr(r),r=G.calculateAt(t,r);var c=o?At():0;return u.open(r,a,c).fd}catch(g){if(typeof u>"u"||g.name!=="ErrnoError")throw g;return-g.errno}}function wa(t,r,a,o){r>>>=0,a>>>=0,o>>>=0;try{if(r=G.getStr(r),r=G.calculateAt(t,r),o<=0)return-28;var c=u.readlink(r),g=Math.min(o,Xe(c)),h=Q[a+g>>>0];return ye(c,a,o+1),Q[a+g>>>0]=h,g}catch(f){if(typeof u>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}function ya(t,r,a,o){r>>>=0,o>>>=0;try{return r=G.getStr(r),o=G.getStr(o),r=G.calculateAt(t,r),o=G.calculateAt(a,o),u.rename(r,o),0}catch(c){if(typeof u>"u"||c.name!=="ErrnoError")throw c;return-c.errno}}function Sa(t){t>>>=0;try{return t=G.getStr(t),u.rmdir(t),0}catch(r){if(typeof u>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}function Ca(t,r){t>>>=0,r>>>=0;try{return t=G.getStr(t),G.writeStat(r,u.stat(t))}catch(a){if(typeof u>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}function Ia(t,r,a){t>>>=0,a>>>=0;try{return t=G.getStr(t),a=G.getStr(a),a=G.calculateAt(r,a),u.symlink(t,a),0}catch(o){if(typeof u>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function Pa(t,r,a){r>>>=0;try{return r=G.getStr(r),r=G.calculateAt(t,r),a===0?u.unlink(r):a===512?u.rmdir(r):ut("Invalid flags passed to unlinkat"),0}catch(o){if(typeof u>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}var Ea=()=>ut(""),Rt={},ci=t=>{for(;t.length;){var r=t.pop(),a=t.pop();a(r)}};function gt(t){return this.fromWireType(W[t>>>2>>>0])}var nt={},Ke={},Gt={},Da=i.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},Ft=t=>{throw new Da(t)},_i=(t,r,a)=>{t.forEach(f=>Gt[f]=r);function o(f){var p=a(f);p.length!==t.length&&Ft("Mismatched type converter count");for(var w=0;w<t.length;++w)me(t[w],p[w])}var c=new Array(r.length),g=[],h=0;r.forEach((f,p)=>{Ke.hasOwnProperty(f)?c[p]=Ke[f]:(g.push(f),nt.hasOwnProperty(f)||(nt[f]=[]),nt[f].push(()=>{c[p]=Ke[f],++h,h===g.length&&o(c)}))}),g.length===0&&o(c)},ba=function(t){t>>>=0;var r=Rt[t];delete Rt[t];var a=r.rawConstructor,o=r.rawDestructor,c=r.fields,g=c.map(h=>h.getterReturnType).concat(c.map(h=>h.setterArgumentType));_i([t],g,h=>{var f={};return c.forEach((p,w)=>{var y=p.fieldName,I=h[w],E=h[w].optional,P=p.getter,T=p.getterContext,j=h[w+c.length],ie=p.setter,O=p.setterContext;f[y]={read:re=>I.fromWireType(P(T,re)),write:(re,J)=>{var Se=[];ie(O,re,j.toWireType(Se,J)),ci(Se)},optional:E}}),[{name:r.name,fromWireType:p=>{var w={};for(var y in f)w[y]=f[y].read(p);return o(p),w},toWireType:(p,w)=>{for(var y in f)if(!(y in w)&&!f[y].optional)throw new TypeError(`Missing field: "${y}"`);var I=a();for(y in f)f[y].write(I,w[y]);return p!==null&&p.push(o,I),I},argPackAdvance:pe,readValueFromPointer:gt,destructorFunction:o}]})},xt=t=>{if(t===null)return"null";var r=typeof t;return r==="object"||r==="array"||r==="function"?t.toString():""+t},Ta=()=>{for(var t=new Array(256),r=0;r<256;++r)t[r]=String.fromCharCode(r);Sr=t},Sr,ae=t=>{for(var r="",a=t;oe[a>>>0];)r+=Sr[oe[a++>>>0]];return r},Lt=i.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},Y=t=>{throw new Lt(t)};function Aa(t,r,a={}){var o=r.name;if(t||Y(`type "${o}" must have a positive integer typeid pointer`),Ke.hasOwnProperty(t)){if(a.ignoreDuplicateRegistrations)return;Y(`Cannot register type '${o}' twice`)}if(Ke[t]=r,delete Gt[t],nt.hasOwnProperty(t)){var c=nt[t];delete nt[t],c.forEach(g=>g())}}function me(t,r,a={}){return Aa(t,r,a)}var Cr=(t,r,a)=>{switch(r){case 1:return a?o=>Q[o>>>0]:o=>oe[o>>>0];case 2:return a?o=>ge[o>>>1>>>0]:o=>_t[o>>>1>>>0];case 4:return a?o=>D[o>>>2>>>0]:o=>W[o>>>2>>>0];case 8:return a?o=>ce[o>>>3]:o=>lr[o>>>3];default:throw new TypeError(`invalid integer width (${r}): ${t}`)}};function Ra(t,r,a,o,c){t>>>=0,r>>>=0,a>>>=0,r=ae(r);var g=r.indexOf("u")!=-1;me(t,{name:r,fromWireType:h=>h,toWireType:function(h,f){if(typeof f!="bigint"&&typeof f!="number")throw new TypeError(`Cannot convert "${xt(f)}" to ${this.name}`);return typeof f=="number"&&(f=BigInt(f)),f},argPackAdvance:pe,readValueFromPointer:Cr(r,a,!g),destructorFunction:null})}var pe=8;function Ga(t,r,a,o){t>>>=0,r>>>=0,r=ae(r),me(t,{name:r,fromWireType:function(c){return!!c},toWireType:function(c,g){return g?a:o},argPackAdvance:pe,readValueFromPointer:function(c){return this.fromWireType(oe[c>>>0])},destructorFunction:null})}var Fa=t=>({count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType}),li=t=>{function r(a){return a.$$.ptrType.registeredClass.name}Y(r(t)+" instance already deleted")},ui=!1,Ir=t=>{},xa=t=>{t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)},Pr=t=>{t.count.value-=1;var r=t.count.value===0;r&&xa(t)},ht=t=>typeof FinalizationRegistry>"u"?(ht=r=>r,t):(ui=new FinalizationRegistry(r=>{Pr(r.$$)}),ht=r=>{var a=r.$$,o=!!a.smartPtr;if(o){var c={$$:a};ui.register(r,c,r)}return r},Ir=r=>ui.unregister(r),ht(t)),La=()=>{let t=Wt.prototype;Object.assign(t,{isAliasOf(a){if(!(this instanceof Wt)||!(a instanceof Wt))return!1;var o=this.$$.ptrType.registeredClass,c=this.$$.ptr;a.$$=a.$$;for(var g=a.$$.ptrType.registeredClass,h=a.$$.ptr;o.baseClass;)c=o.upcast(c),o=o.baseClass;for(;g.baseClass;)h=g.upcast(h),g=g.baseClass;return o===g&&c===h},clone(){if(this.$$.ptr||li(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var a=ht(Object.create(Object.getPrototypeOf(this),{$$:{value:Fa(this.$$)}}));return a.$$.count.value+=1,a.$$.deleteScheduled=!1,a},delete(){this.$$.ptr||li(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Y("Object already scheduled for deletion"),Ir(this),Pr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||li(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Y("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}});const r=Symbol.dispose;r&&(t[r]=t.delete)};function Wt(){}var Bt=(t,r)=>Object.defineProperty(r,"name",{value:t}),Er={},Wa=(t,r,a)=>{if(t[r].overloadTable===void 0){var o=t[r];t[r]=function(...c){return t[r].overloadTable.hasOwnProperty(c.length)||Y(`Function '${a}' called with an invalid number of arguments (${c.length}) - expects one of (${t[r].overloadTable})!`),t[r].overloadTable[c.length].apply(this,c)},t[r].overloadTable=[],t[r].overloadTable[o.argCount]=o}},gi=(t,r,a)=>{i.hasOwnProperty(t)?((a===void 0||i[t].overloadTable!==void 0&&i[t].overloadTable[a]!==void 0)&&Y(`Cannot register public name '${t}' twice`),Wa(i,t,t),i[t].overloadTable.hasOwnProperty(a)&&Y(`Cannot register multiple overloads of a function with the same number of arguments (${a})!`),i[t].overloadTable[a]=r):(i[t]=r,i[t].argCount=a)},Ba=48,Na=57,za=t=>{t=t.replace(/[^a-zA-Z0-9_]/g,"$");var r=t.charCodeAt(0);return r>=Ba&&r<=Na?`_${t}`:t};function $a(t,r,a,o,c,g,h,f){this.name=t,this.constructor=r,this.instancePrototype=a,this.rawDestructor=o,this.baseClass=c,this.getActualType=g,this.upcast=h,this.downcast=f,this.pureVirtualFunctions=[]}var hi=(t,r,a)=>{for(;r!==a;)r.upcast||Y(`Expected null or instance of ${a.name}, got an instance of ${r.name}`),t=r.upcast(t),r=r.baseClass;return t};function Ha(t,r){if(r===null)return this.isReference&&Y(`null is not a valid ${this.name}`),0;r.$$||Y(`Cannot pass "${xt(r)}" as a ${this.name}`),r.$$.ptr||Y(`Cannot pass deleted object as a pointer of type ${this.name}`);var a=r.$$.ptrType.registeredClass,o=hi(r.$$.ptr,a,this.registeredClass);return o}function Ua(t,r){var a;if(r===null)return this.isReference&&Y(`null is not a valid ${this.name}`),this.isSmartPointer?(a=this.rawConstructor(),t!==null&&t.push(this.rawDestructor,a),a):0;(!r||!r.$$)&&Y(`Cannot pass "${xt(r)}" as a ${this.name}`),r.$$.ptr||Y(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&Y(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var o=r.$$.ptrType.registeredClass;if(a=hi(r.$$.ptr,o,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&Y("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?a=r.$$.smartPtr:Y(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:a=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)a=r.$$.smartPtr;else{var c=r.clone();a=this.rawShare(a,he.toHandle(()=>c.delete())),t!==null&&t.push(this.rawDestructor,a)}break;default:Y("Unsupporting sharing policy")}return a}function ja(t,r){if(r===null)return this.isReference&&Y(`null is not a valid ${this.name}`),0;r.$$||Y(`Cannot pass "${xt(r)}" as a ${this.name}`),r.$$.ptr||Y(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&Y(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var a=r.$$.ptrType.registeredClass,o=hi(r.$$.ptr,a,this.registeredClass);return o}var Dr=(t,r,a)=>{if(r===a)return t;if(a.baseClass===void 0)return null;var o=Dr(t,r,a.baseClass);return o===null?null:a.downcast(o)},Ya={},Va=(t,r)=>{for(r===void 0&&Y("ptr should not be undefined");t.baseClass;)r=t.upcast(r),t=t.baseClass;return r},Xa=(t,r)=>(r=Va(t,r),Ya[r]),Nt=(t,r)=>{(!r.ptrType||!r.ptr)&&Ft("makeClassHandle requires ptr and ptrType");var a=!!r.smartPtrType,o=!!r.smartPtr;return a!==o&&Ft("Both smartPtrType and smartPtr must be specified"),r.count={value:1},ht(Object.create(t,{$$:{value:r,writable:!0}}))};function qa(t){var r=this.getPointee(t);if(!r)return this.destructor(t),null;var a=Xa(this.registeredClass,r);if(a!==void 0){if(a.$$.count.value===0)return a.$$.ptr=r,a.$$.smartPtr=t,a.clone();var o=a.clone();return this.destructor(t),o}function c(){return this.isSmartPointer?Nt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:t}):Nt(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var g=this.registeredClass.getActualType(r),h=Er[g];if(!h)return c.call(this);var f;this.isConst?f=h.constPointerType:f=h.pointerType;var p=Dr(r,this.registeredClass,f.registeredClass);return p===null?c.call(this):this.isSmartPointer?Nt(f.registeredClass.instancePrototype,{ptrType:f,ptr:p,smartPtrType:this,smartPtr:t}):Nt(f.registeredClass.instancePrototype,{ptrType:f,ptr:p})}var Ka=()=>{Object.assign(zt.prototype,{getPointee(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t},destructor(t){this.rawDestructor?.(t)},argPackAdvance:pe,readValueFromPointer:gt,fromWireType:qa})};function zt(t,r,a,o,c,g,h,f,p,w,y){this.name=t,this.registeredClass=r,this.isReference=a,this.isConst=o,this.isSmartPointer=c,this.pointeeType=g,this.sharingPolicy=h,this.rawGetPointee=f,this.rawConstructor=p,this.rawShare=w,this.rawDestructor=y,!c&&r.baseClass===void 0?o?(this.toWireType=Ha,this.destructorFunction=null):(this.toWireType=ja,this.destructorFunction=null):this.toWireType=Ua}var br=(t,r,a)=>{i.hasOwnProperty(t)||Ft("Replacing nonexistent public symbol"),i[t].overloadTable!==void 0&&a!==void 0?i[t].overloadTable[a]=r:(i[t]=r,i[t].argCount=a)},Qa=(t,r,a=[],o=!1)=>{var c=B(r),g=c(...a);return t[0]=="p"?g>>>0:g},Ja=(t,r,a=!1)=>(...o)=>Qa(t,r,o,a),Ae=(t,r,a=!1)=>{t=ae(t);function o(){if(t.includes("p"))return Ja(t,r,a);var g=B(r);return g}var c=o();return typeof c!="function"&&Y(`unknown function pointer with signature ${t}: ${r}`),c};class Oa extends Error{}var Tr=t=>{var r=To(t),a=ae(r);return Qe(r),a},Ar=(t,r)=>{var a=[],o={};function c(g){if(!o[g]&&!Ke[g]){if(Gt[g]){Gt[g].forEach(c);return}a.push(g),o[g]=!0}}throw r.forEach(c),new Oa(`${t}: `+a.map(Tr).join([", "]))};function Za(t,r,a,o,c,g,h,f,p,w,y,I,E){t>>>=0,r>>>=0,a>>>=0,o>>>=0,c>>>=0,g>>>=0,h>>>=0,f>>>=0,p>>>=0,w>>>=0,y>>>=0,I>>>=0,E>>>=0,y=ae(y),g=Ae(c,g),f&&=Ae(h,f),w&&=Ae(p,w),E=Ae(I,E);var P=za(y);gi(P,function(){Ar(`Cannot construct ${y} due to unbound types`,[o])}),_i([t,r,a],o?[o]:[],T=>{T=T[0];var j,ie;o?(j=T.registeredClass,ie=j.instancePrototype):ie=Wt.prototype;var O=Bt(y,function(...Z){if(Object.getPrototypeOf(this)!==re)throw new Lt(`Use 'new' to construct ${y}`);if(J.constructor_body===void 0)throw new Lt(`${y} has no accessible constructor`);var Vr=J.constructor_body[Z.length];if(Vr===void 0)throw new Lt(`Tried to invoke ctor of ${y} with invalid number of parameters (${Z.length}) - expected (${Object.keys(J.constructor_body).toString()}) parameters instead!`);return Vr.apply(this,Z)}),re=Object.create(ie,{constructor:{value:O}});O.prototype=re;var J=new $a(y,O,re,E,j,g,f,w);J.baseClass&&(J.baseClass.__derivedClasses??=[],J.baseClass.__derivedClasses.push(J));var Se=new zt(y,J,!0,!1,!1),de=new zt(y+"*",J,!1,!1,!1),Ge=new zt(y+" const*",J,!1,!0,!1);return Er[t]={pointerType:de,constPointerType:Ge},br(P,O),[Se,de,Ge]})}var di=[],Re=[];function fi(t){t>>>=0,t>9&&--Re[t+1]===0&&(Re[t]=void 0,di.push(t))}var es=()=>Re.length/2-5-di.length,ts=()=>{Re.push(0,1,void 0,1,null,1,!0,1,!1,1),i.count_emval_handles=es},he={toValue:t=>(t||Y(`Cannot use deleted val. handle = ${t}`),Re[t]),toHandle:t=>{switch(t){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const r=di.pop()||Re.length;return Re[r]=t,Re[r+1]=1,r}}}},is={name:"emscripten::val",fromWireType:t=>{var r=he.toValue(t);return fi(t),r},toWireType:(t,r)=>he.toHandle(r),argPackAdvance:pe,readValueFromPointer:gt,destructorFunction:null};function rs(t){return t>>>=0,me(t,is)}var ns=(t,r,a)=>{switch(r){case 1:return a?function(o){return this.fromWireType(Q[o>>>0])}:function(o){return this.fromWireType(oe[o>>>0])};case 2:return a?function(o){return this.fromWireType(ge[o>>>1>>>0])}:function(o){return this.fromWireType(_t[o>>>1>>>0])};case 4:return a?function(o){return this.fromWireType(D[o>>>2>>>0])}:function(o){return this.fromWireType(W[o>>>2>>>0])};default:throw new TypeError(`invalid integer width (${r}): ${t}`)}};function as(t,r,a,o){t>>>=0,r>>>=0,a>>>=0,r=ae(r);function c(){}c.values={},me(t,{name:r,constructor:c,fromWireType:function(g){return this.constructor.values[g]},toWireType:(g,h)=>h.value,argPackAdvance:pe,readValueFromPointer:ns(r,a,o),destructorFunction:null}),gi(r,c)}var mi=(t,r)=>{var a=Ke[t];return a===void 0&&Y(`${r} has unknown type ${Tr(t)}`),a};function ss(t,r,a){t>>>=0,r>>>=0;var o=mi(t,"enum");r=ae(r);var c=o.constructor,g=Object.create(o.constructor.prototype,{value:{value:a},constructor:{value:Bt(`${o.name}_${r}`,function(){})}});c.values[a]=g,c[r]=g}var os=(t,r)=>{switch(r){case 4:return function(a){return this.fromWireType(Dt[a>>>2>>>0])};case 8:return function(a){return this.fromWireType(bt[a>>>3>>>0])};default:throw new TypeError(`invalid float width (${r}): ${t}`)}},cs=function(t,r,a){t>>>=0,r>>>=0,a>>>=0,r=ae(r),me(t,{name:r,fromWireType:o=>o,toWireType:(o,c)=>c,argPackAdvance:pe,readValueFromPointer:os(r,a),destructorFunction:null})};function _s(t){for(var r=1;r<t.length;++r)if(t[r]!==null&&t[r].destructorFunction===void 0)return!0;return!1}var ls={ftf:function(t,r,a,o,c,g,h){return function(){var f=a(o),p=g.fromWireType(f);return p}},ftft:function(t,r,a,o,c,g,h,f,p){return function(w){var y=f.toWireType(null,w),I=a(o,y);p(y);var E=g.fromWireType(I);return E}},fffn:function(t,r,a,o,c,g,h,f){return function(p){var w=f.toWireType(null,p);a(o,w)}},ftfn:function(t,r,a,o,c,g,h,f){return function(p){var w=f.toWireType(null,p),y=a(o,w),I=g.fromWireType(y);return I}},ftfnn:function(t,r,a,o,c,g,h,f,p){return function(w,y){var I=f.toWireType(null,w),E=p.toWireType(null,y),P=a(o,I,E),T=g.fromWireType(P);return T}},ftfnnn:function(t,r,a,o,c,g,h,f,p,w){return function(y,I,E){var P=f.toWireType(null,y),T=p.toWireType(null,I),j=w.toWireType(null,E),ie=a(o,P,T,j),O=g.fromWireType(ie);return O}},ftfnt:function(t,r,a,o,c,g,h,f,p,w){return function(y,I){var E=f.toWireType(null,y),P=p.toWireType(null,I),T=a(o,E,P);w(P);var j=g.fromWireType(T);return j}}};function us(t,r,a,o){const c=["f",a?"t":"f",o?"t":"f"];for(let g=2;g<t.length;++g){const h=t[g];let f="";h.destructorFunction===void 0?f="u":h.destructorFunction===null?f="n":f="t",c.push(f)}return c.join("")}function gs(t,r,a,o,c,g){var h=r.length;h<2&&Y("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var f=r[1]!==null&&a!==null,p=_s(r),w=r[0].name!=="void",y=[t,Y,o,c,ci,r[0],r[1]],I=0;I<h-2;++I)y.push(r[I+2]);if(!p)for(var I=2;I<r.length;++I)r[I].destructorFunction!==null&&y.push(r[I].destructorFunction);var E=us(r,f,w,g),P=ls[E](...y);return Bt(t,P)}var hs=(t,r)=>{for(var a=[],o=0;o<t;o++)a.push(W[r+o*4>>>2>>>0]);return a},ds=t=>{t=t.trim();const r=t.indexOf("(");return r===-1?t:t.slice(0,r)};function fs(t,r,a,o,c,g,h,f){t>>>=0,a>>>=0,o>>>=0,c>>>=0,g>>>=0;var p=hs(r,a);t=ae(t),t=ds(t),c=Ae(o,c,h),gi(t,function(){Ar(`Cannot call ${t} due to unbound types`,p)},r-1),_i([],p,w=>{var y=[w[0],null].concat(w.slice(1));return br(t,gs(t,y,null,c,g,h),r-1),[]})}function ms(t,r,a,o,c){t>>>=0,r>>>=0,a>>>=0,r=ae(r);var g=y=>y;if(o===0){var h=32-8*a;g=y=>y<<h>>>h}var f=r.includes("unsigned"),p=(y,I)=>{},w;f?w=function(y,I){return p(I,this.name),I>>>0}:w=function(y,I){return p(I,this.name),I},me(t,{name:r,fromWireType:g,toWireType:w,argPackAdvance:pe,readValueFromPointer:Cr(r,a,o!==0),destructorFunction:null})}function ps(t,r,a){t>>>=0,a>>>=0;var o=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],c=o[r];function g(h){var f=W[h>>>2>>>0],p=W[h+4>>>2>>>0];return new c(Q.buffer,p,f)}a=ae(a),me(t,{name:a,fromWireType:g,argPackAdvance:pe,readValueFromPointer:g},{ignoreDuplicateRegistrations:!0})}function vs(t,r){t>>>=0,r>>>=0,r=ae(r),me(t,{name:r,fromWireType(a){for(var o=W[a>>>2>>>0],c=a+4,g,h,f=c,h=0;h<=o;++h){var p=c+h;if(h==o||oe[p>>>0]==0){var w=p-f,y=oi(f,w);g===void 0?g=y:(g+="\0",g+=y),f=p+1}}return Qe(a),g},toWireType(a,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var c,g=typeof o=="string";g||ArrayBuffer.isView(o)&&o.BYTES_PER_ELEMENT==1||Y("Cannot pass non-string to std::string"),g?c=Xe(o):c=o.length;var h=Yr(4+c+1),f=h+4;return W[h>>>2>>>0]=c,g?ye(o,f,c+1):oe.set(o,f>>>0),a!==null&&a.push(Qe,h),h},argPackAdvance:pe,readValueFromPointer:gt,destructorFunction(a){Qe(a)}})}var Rr=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,ks=(t,r)=>{for(var a=t,o=a>>1,c=o+r/2;!(o>=c)&&_t[o>>>0];)++o;if(a=o<<1,a-t>32&&Rr)return Rr.decode(oe.subarray(t>>>0,a>>>0));for(var g="",h=0;!(h>=r/2);++h){var f=ge[t+h*2>>>1>>>0];if(f==0)break;g+=String.fromCharCode(f)}return g},Ms=(t,r,a)=>{if(a??=2147483647,a<2)return 0;a-=2;for(var o=r,c=a<t.length*2?a/2:t.length,g=0;g<c;++g){var h=t.charCodeAt(g);ge[r>>>1>>>0]=h,r+=2}return ge[r>>>1>>>0]=0,r-o},ws=t=>t.length*2,ys=(t,r)=>{for(var a=0,o="";!(a>=r/4);){var c=D[t+a*4>>>2>>>0];if(c==0)break;if(++a,c>=65536){var g=c-65536;o+=String.fromCharCode(55296|g>>10,56320|g&1023)}else o+=String.fromCharCode(c)}return o},Ss=(t,r,a)=>{if(r>>>=0,a??=2147483647,a<4)return 0;for(var o=r,c=o+a-4,g=0;g<t.length;++g){var h=t.charCodeAt(g);if(h>=55296&&h<=57343){var f=t.charCodeAt(++g);h=65536+((h&1023)<<10)|f&1023}if(D[r>>>2>>>0]=h,r+=4,r+4>c)break}return D[r>>>2>>>0]=0,r-o},Cs=t=>{for(var r=0,a=0;a<t.length;++a){var o=t.charCodeAt(a);o>=55296&&o<=57343&&++a,r+=4}return r},Is=function(t,r,a){t>>>=0,r>>>=0,a>>>=0,a=ae(a);var o,c,g,h;r===2?(o=ks,c=Ms,h=ws,g=f=>_t[f>>>1>>>0]):r===4&&(o=ys,c=Ss,h=Cs,g=f=>W[f>>>2>>>0]),me(t,{name:a,fromWireType:f=>{for(var p=W[f>>>2>>>0],w,y=f+4,I=0;I<=p;++I){var E=f+4+I*r;if(I==p||g(E)==0){var P=E-y,T=o(y,P);w===void 0?w=T:(w+="\0",w+=T),y=E+r}}return Qe(f),w},toWireType:(f,p)=>{typeof p!="string"&&Y(`Cannot pass non-string to C++ string type ${a}`);var w=h(p),y=Yr(4+w+r);return W[y>>>2>>>0]=w/r,c(p,y+4,w+r),f!==null&&f.push(Qe,y),y},argPackAdvance:pe,readValueFromPointer:gt,destructorFunction(f){Qe(f)}})};function Ps(t,r,a,o,c,g){t>>>=0,r>>>=0,a>>>=0,o>>>=0,c>>>=0,g>>>=0,Rt[t]={name:ae(r),rawConstructor:Ae(a,o),rawDestructor:Ae(c,g),fields:[]}}function Es(t,r,a,o,c,g,h,f,p,w){t>>>=0,r>>>=0,a>>>=0,o>>>=0,c>>>=0,g>>>=0,h>>>=0,f>>>=0,p>>>=0,w>>>=0,Rt[t].fields.push({fieldName:ae(r),getterReturnType:a,getter:Ae(o,c),getterContext:g,setterArgumentType:h,setter:Ae(f,p),setterContext:w})}var Ds=function(t,r){t>>>=0,r>>>=0,r=ae(r),me(t,{isVoid:!0,name:r,argPackAdvance:0,fromWireType:()=>{},toWireType:(a,o)=>{}})},Gr=0,bs=()=>{ti=!1,Gr=0};function Ts(t){return t>>>=0,t?-52:0}var As=()=>{throw 1/0},Rs={},Fr=t=>{var r=Rs[t];return r===void 0?ae(t):r},pi=[];function Gs(t,r,a,o,c){return t>>>=0,r>>>=0,a>>>=0,o>>>=0,c>>>=0,t=pi[t],r=he.toValue(r),a=Fr(a),t(r,r[a],o,c)}var Fs=t=>{var r=pi.length;return pi.push(t),r},xs=(t,r)=>{for(var a=new Array(t),o=0;o<t;++o)a[o]=mi(W[r+o*4>>>2>>>0],`parameter ${o}`);return a},Ls=(t,r,a)=>{var o=[],c=t.toWireType(o,a);return o.length&&(W[r>>>2>>>0]=he.toHandle(o)),c},Ws=Reflect.construct,Bs=function(t,r,a){r>>>=0;var o=xs(t,r),c=o.shift();t--;var g=new Array(t),h=(p,w,y,I)=>{for(var E=0,P=0;P<t;++P)g[P]=o[P].readValueFromPointer(I+E),E+=o[P].argPackAdvance;var T=a===1?Ws(w,g):w.apply(p,g);return Ls(c,y,T)},f=`methodCaller<(${o.map(p=>p.name).join(", ")}) => ${c.name}>`;return Fs(Bt(f,h))};function Ns(t){t>>>=0,t>9&&(Re[t+1]+=1)}function zs(){return he.toHandle([])}function $s(t){return t>>>=0,he.toHandle(Fr(t))}function Hs(){return he.toHandle({})}function Us(t){t>>>=0;var r=he.toValue(t);ci(r),fi(t)}function js(t,r,a){t>>>=0,r>>>=0,a>>>=0,t=he.toValue(t),r=he.toValue(r),a=he.toValue(a),t[r]=a}function Ys(t,r){t>>>=0,r>>>=0,t=mi(t,"_emval_take_value");var a=t.readValueFromPointer(r);return he.toHandle(a)}function Vs(t,r){t=Te(t),r>>>=0;var a=new Date(t*1e3);D[r>>>2>>>0]=a.getUTCSeconds(),D[r+4>>>2>>>0]=a.getUTCMinutes(),D[r+8>>>2>>>0]=a.getUTCHours(),D[r+12>>>2>>>0]=a.getUTCDate(),D[r+16>>>2>>>0]=a.getUTCMonth(),D[r+20>>>2>>>0]=a.getUTCFullYear()-1900,D[r+24>>>2>>>0]=a.getUTCDay();var o=Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0),c=(a.getTime()-o)/(1e3*60*60*24)|0;D[r+28>>>2>>>0]=c}var Xs=t=>t%4===0&&(t%100!==0||t%400===0),qs=[0,31,60,91,121,152,182,213,244,274,305,335],Ks=[0,31,59,90,120,151,181,212,243,273,304,334],xr=t=>{var r=Xs(t.getFullYear()),a=r?qs:Ks,o=a[t.getMonth()]+t.getDate()-1;return o};function Qs(t,r){t=Te(t),r>>>=0;var a=new Date(t*1e3);D[r>>>2>>>0]=a.getSeconds(),D[r+4>>>2>>>0]=a.getMinutes(),D[r+8>>>2>>>0]=a.getHours(),D[r+12>>>2>>>0]=a.getDate(),D[r+16>>>2>>>0]=a.getMonth(),D[r+20>>>2>>>0]=a.getFullYear()-1900,D[r+24>>>2>>>0]=a.getDay();var o=xr(a)|0;D[r+28>>>2>>>0]=o,D[r+36>>>2>>>0]=-(a.getTimezoneOffset()*60);var c=new Date(a.getFullYear(),0,1),g=new Date(a.getFullYear(),6,1).getTimezoneOffset(),h=c.getTimezoneOffset(),f=(g!=h&&a.getTimezoneOffset()==Math.min(h,g))|0;D[r+32>>>2>>>0]=f}var Js=function(t){t>>>=0;var r=(()=>{var a=new Date(D[t+20>>>2>>>0]+1900,D[t+16>>>2>>>0],D[t+12>>>2>>>0],D[t+8>>>2>>>0],D[t+4>>>2>>>0],D[t>>>2>>>0],0),o=D[t+32>>>2>>>0],c=a.getTimezoneOffset(),g=new Date(a.getFullYear(),0,1),h=new Date(a.getFullYear(),6,1).getTimezoneOffset(),f=g.getTimezoneOffset(),p=Math.min(f,h);if(o<0)D[t+32>>>2>>>0]=+(h!=f&&p==c);else if(o>0!=(p==c)){var w=Math.max(f,h),y=o>0?p:w;a.setTime(a.getTime()+(y-c)*6e4)}D[t+24>>>2>>>0]=a.getDay();var I=xr(a)|0;D[t+28>>>2>>>0]=I,D[t>>>2>>>0]=a.getSeconds(),D[t+4>>>2>>>0]=a.getMinutes(),D[t+8>>>2>>>0]=a.getHours(),D[t+12>>>2>>>0]=a.getDate(),D[t+16>>>2>>>0]=a.getMonth(),D[t+20>>>2>>>0]=a.getYear();var E=a.getTime();return isNaN(E)?-1:E/1e3})();return BigInt(r)};function Os(t,r,a,o,c,g,h){t>>>=0,c=Te(c),g>>>=0,h>>>=0;try{if(isNaN(c))return 61;var f=G.getStreamFromFD(o),p=u.mmap(f,t,c,r,a),w=p.ptr;return D[g>>>2>>>0]=p.allocated,W[h>>>2>>>0]=w,0}catch(y){if(typeof u>"u"||y.name!=="ErrnoError")throw y;return-y.errno}}function Zs(t,r,a,o,c,g){t>>>=0,r>>>=0,g=Te(g);try{var h=G.getStreamFromFD(c);a&2&&G.doMsync(t,h,r,o,g)}catch(f){if(typeof u>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}var eo=function(t,r,a,o){t>>>=0,r>>>=0,a>>>=0,o>>>=0;var c=new Date().getFullYear(),g=new Date(c,0,1),h=new Date(c,6,1),f=g.getTimezoneOffset(),p=h.getTimezoneOffset(),w=Math.max(f,p);W[t>>>2>>>0]=w*60,D[r>>>2>>>0]=+(f!=p);var y=P=>{var T=P>=0?"-":"+",j=Math.abs(P),ie=String(Math.floor(j/60)).padStart(2,"0"),O=String(j%60).padStart(2,"0");return`UTC${T}${ie}${O}`},I=y(f),E=y(p);p<f?(ye(I,a,17),ye(E,o,17)):(ye(I,o,17),ye(E,a,17))},Lr=()=>performance.now(),Wr=()=>Date.now(),to=t=>t>=0&&t<=3;function io(t,r,a){if(a>>>=0,!to(t))return 28;var o;t===0?o=Wr():o=Lr();var c=Math.round(o*1e3*1e3);return ce[a>>>3]=BigInt(c),0}var Br=()=>4294901760;function ro(){return Br()}var no=t=>{var r=Et.buffer,a=(t-r.byteLength+65535)/65536|0;try{return Et.grow(a),gr(),1}catch{}};function ao(t){t>>>=0;var r=oe.length,a=Br();if(t>a)return!1;for(var o=1;o<=4;o*=2){var c=r*(1+.2/o);c=Math.min(c,t+100663296);var g=Math.min(a,Mr(Math.max(t,c),65536)),h=no(g);if(h)return!0}return!1}var vi={},so=()=>F||"./this.program",dt=()=>{if(!dt.strings){var t=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:t,_:so()};for(var a in vi)vi[a]===void 0?delete r[a]:r[a]=vi[a];var o=[];for(var a in r)o.push(`${a}=${r[a]}`);dt.strings=o}return dt.strings};function oo(t,r){t>>>=0,r>>>=0;var a=0,o=0;for(var c of dt()){var g=r+a;W[t+o>>>2>>>0]=g,a+=ye(c,g,1/0)+1,o+=4}return 0}function co(t,r){t>>>=0,r>>>=0;var a=dt();W[t>>>2>>>0]=a.length;var o=0;for(var c of a)o+=Xe(c)+1;return W[r>>>2>>>0]=o,0}var _o=()=>ti||Gr>0,Nr=t=>{_o()||(i.onExit?.(t),Ot=!0),z(t,new Hn(t))},lo=(t,r)=>{Nr(t)},uo=lo;function go(t){try{var r=G.getStreamFromFD(t);return u.close(r),0}catch(a){if(typeof u>"u"||a.name!=="ErrnoError")throw a;return a.errno}}function ho(t,r){r>>>=0;try{var a=0,o=0,c=0,g=G.getStreamFromFD(t),h=g.tty?2:u.isDir(g.mode)?3:u.isLink(g.mode)?7:4;return Q[r>>>0]=h,ge[r+2>>>1>>>0]=c,ce[r+8>>>3]=BigInt(a),ce[r+16>>>3]=BigInt(o),0}catch(f){if(typeof u>"u"||f.name!=="ErrnoError")throw f;return f.errno}}var zr=(t,r,a,o)=>{for(var c=0,g=0;g<a;g++){var h=W[r>>>2>>>0],f=W[r+4>>>2>>>0];r+=8;var p=u.read(t,Q,h,f,o);if(p<0)return-1;if(c+=p,p<f)break;typeof o<"u"&&(o+=p)}return c};function fo(t,r,a,o,c){r>>>=0,a>>>=0,o=Te(o),c>>>=0;try{if(isNaN(o))return 61;var g=G.getStreamFromFD(t),h=zr(g,r,a,o);return W[c>>>2>>>0]=h,0}catch(f){if(typeof u>"u"||f.name!=="ErrnoError")throw f;return f.errno}}var $r=(t,r,a,o)=>{for(var c=0,g=0;g<a;g++){var h=W[r>>>2>>>0],f=W[r+4>>>2>>>0];r+=8;var p=u.write(t,Q,h,f,o);if(p<0)return-1;if(c+=p,p<f)break;typeof o<"u"&&(o+=p)}return c};function mo(t,r,a,o,c){r>>>=0,a>>>=0,o=Te(o),c>>>=0;try{if(isNaN(o))return 61;var g=G.getStreamFromFD(t),h=$r(g,r,a,o);return W[c>>>2>>>0]=h,0}catch(f){if(typeof u>"u"||f.name!=="ErrnoError")throw f;return f.errno}}function po(t,r,a,o){r>>>=0,a>>>=0,o>>>=0;try{var c=G.getStreamFromFD(t),g=zr(c,r,a);return W[o>>>2>>>0]=g,0}catch(h){if(typeof u>"u"||h.name!=="ErrnoError")throw h;return h.errno}}function vo(t,r,a,o){r=Te(r),o>>>=0;try{if(isNaN(r))return 61;var c=G.getStreamFromFD(t);return u.llseek(c,r,a),ce[o>>>3]=BigInt(c.position),c.getdents&&r===0&&a===0&&(c.getdents=null),0}catch(g){if(typeof u>"u"||g.name!=="ErrnoError")throw g;return g.errno}}function ko(t){try{var r=G.getStreamFromFD(t);return r.stream_ops?.fsync?r.stream_ops.fsync(r):0}catch(a){if(typeof u>"u"||a.name!=="ErrnoError")throw a;return a.errno}}function Mo(t,r,a,o){r>>>=0,a>>>=0,o>>>=0;try{var c=G.getStreamFromFD(t),g=$r(c,r,a);return W[o>>>2>>>0]=g,0}catch(h){if(typeof u>"u"||h.name!=="ErrnoError")throw h;return h.errno}}function wo(t,r){t>>>=0,r>>>=0;try{return ri(oe.subarray(t>>>0,t+r>>>0)),0}catch(a){if(typeof u>"u"||a.name!=="ErrnoError")throw a;return a.errno}}var Hr=(t,r)=>{t<128?r.push(t):r.push(t%128|128,t>>7)},yo=t=>{for(var r={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"},a={parameters:[],results:t[0]=="v"?[]:[r[t[0]]]},o=1;o<t.length;++o)a.parameters.push(r[t[o]]);return a},So=(t,r)=>{var a=t.slice(0,1),o=t.slice(1),c={i:127,p:127,j:126,f:125,d:124,e:111};r.push(96),Hr(o.length,r);for(var g of o)r.push(c[g]);a=="v"?r.push(0):r.push(1,c[a])},Co=(t,r)=>{if(typeof WebAssembly.Function=="function")return new WebAssembly.Function(yo(r),t);var a=[1];So(r,a);var o=[0,97,115,109,1,0,0,0,1];Hr(a.length,o),o.push(...a),o.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var c=new WebAssembly.Module(new Uint8Array(o)),g=new WebAssembly.Instance(c,{e:{f:t}}),h=g.exports.f;return h},Io=(t,r)=>{if(at)for(var a=t;a<t+r;a++){var o=B(a);o&&at.set(o,a)}},at,Po=t=>(at||(at=new WeakMap,Io(0,Ve.length)),at.get(t)||0),Ur=[],Eo=()=>{if(Ur.length)return Ur.pop();try{Ve.grow(1)}catch(t){throw t instanceof RangeError?"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.":t}return Ve.length-1},jr=(t,r)=>{Ve.set(t,r),ii[t]=Ve.get(t)},Do=(t,r)=>{var a=Po(t);if(a)return a;var o=Eo();try{jr(o,t)}catch(g){if(!(g instanceof TypeError))throw g;var c=Co(t,r);jr(o,c)}return at.set(t,o),o};u.createPreloadedFile=sa,u.staticInit(),x.doesNotExistError=new u.ErrnoError(44),x.doesNotExistError.stack="<generic error, no stack>",Ta(),La(),Ka(),ts(),i.noExitRuntime&&(ti=i.noExitRuntime),i.preloadPlugins&&(yr=i.preloadPlugins),i.print&&(Ze=i.print),i.printErr&&(Ne=i.printErr),i.wasmBinary&&(ct=i.wasmBinary),i.arguments&&i.arguments,i.thisProgram&&(F=i.thisProgram),i.addFunction=Do,i.setValue=Vn,i.getValue=Yn,i.UTF8ToString=oi,i.stringToUTF8=ye,i.lengthBytesUTF8=Xe,i.FS=u;var bo={Z:Kn,B:Jn,a:On,A:Zn,ua:ca,sa:_a,va:la,ba:ua,ra:ga,F:ha,qa:da,la:fa,Y:ma,ya:pa,na:va,oa:ka,D:Ma,ab:wa,_a:ya,$a:Sa,pa:Ca,Za:Ia,X:Pa,wa:Ea,Na:ba,P:Ra,Ha:Ga,I:Za,Fa:rs,w:as,e:ss,O:cs,p:fs,v:ms,n:ps,Ga:vs,G:Is,Oa:Ps,H:Es,Ia:Ds,_:bs,Xa:Ts,Va:As,Ka:Gs,l:fi,La:Bs,Ma:Ns,Q:zs,s:$s,z:Hs,Ja:Us,q:js,o:Ys,ea:Vs,fa:Qs,ha:Js,ca:Os,da:Zs,ia:eo,ta:io,L:Wr,Ya:ro,C:Lr,Wa:ao,za:oo,Aa:co,x:uo,y:go,K:ho,aa:fo,$:mo,M:po,ja:vo,ma:ko,E:Mo,Sa:Zo,J:Ko,c:No,d:Bo,f:Wo,i:Uo,W:Oo,b:Xo,U:ic,m:Vo,Ra:rc,Qa:sc,Ea:lc,Da:uc,r:qo,Ua:Qo,u:Yo,ga:jo,V:ec,k:zo,h:$o,T:nc,S:ac,j:Lo,g:Ho,t:tc,Pa:cc,N:_c,Ca:gc,R:oc,Ba:hc,Ta:Jo,xa:Nr,ka:wo},s=await $n();s.cb;var To=s.db;i._MagickColor_Create=s.eb,i._MagickColor_Dispose=s.fb,i._MagickColor_Count_Get=s.gb,i._MagickColor_Red_Get=s.hb,i._MagickColor_Red_Set=s.ib,i._MagickColor_Green_Get=s.jb,i._MagickColor_Green_Set=s.kb,i._MagickColor_Blue_Get=s.lb,i._MagickColor_Blue_Set=s.mb,i._MagickColor_Alpha_Get=s.nb,i._MagickColor_Alpha_Set=s.ob,i._MagickColor_Black_Get=s.pb,i._MagickColor_Black_Set=s.qb,i._MagickColor_IsCMYK_Get=s.rb,i._MagickColor_IsCMYK_Set=s.sb,i._MagickColor_Clone=s.tb,i._MagickColor_FuzzyEquals=s.ub,i._MagickColor_Initialize=s.vb,i._MagickColorCollection_DisposeList=s.xb,i._MagickColorCollection_GetInstance=s.yb,i._DrawingWand_Create=s.zb,i._DrawingWand_Dispose=s.Ab,i._DrawingWand_Affine=s.Bb,i._DrawingWand_Alpha=s.Cb,i._DrawingWand_Arc=s.Db,i._DrawingWand_Bezier=s.Eb,i._DrawingWand_BorderColor=s.Fb,i._DrawingWand_Circle=s.Gb,i._DrawingWand_ClipPath=s.Hb,i._DrawingWand_ClipRule=s.Ib,i._DrawingWand_ClipUnits=s.Jb,i._DrawingWand_Color=s.Kb,i._DrawingWand_Composite=s.Lb,i._DrawingWand_Density=s.Mb,i._DrawingWand_Ellipse=s.Nb,i._DrawingWand_FillColor=s.Ob,i._DrawingWand_FillOpacity=s.Pb,i._DrawingWand_FillPatternUrl=s.Qb,i._DrawingWand_FillRule=s.Rb,i._DrawingWand_Font=s.Sb,i._DrawingWand_FontFamily=s.Tb,i._DrawingWand_FontPointSize=s.Ub,i._DrawingWand_FontTypeMetrics=s.Vb,i._TypeMetric_Create=s.Wb,i._DrawingWand_Gravity=s.Xb,i._DrawingWand_Line=s.Yb,i._DrawingWand_PathArcAbs=s.Zb,i._DrawingWand_PathArcRel=s._b,i._DrawingWand_PathClose=s.$b,i._DrawingWand_PathCurveToAbs=s.ac,i._DrawingWand_PathCurveToRel=s.bc,i._DrawingWand_PathFinish=s.cc,i._DrawingWand_PathLineToAbs=s.dc,i._DrawingWand_PathLineToHorizontalAbs=s.ec,i._DrawingWand_PathLineToHorizontalRel=s.fc,i._DrawingWand_PathLineToRel=s.gc,i._DrawingWand_PathLineToVerticalAbs=s.hc,i._DrawingWand_PathLineToVerticalRel=s.ic,i._DrawingWand_PathMoveToAbs=s.jc,i._DrawingWand_PathMoveToRel=s.kc,i._DrawingWand_PathQuadraticCurveToAbs=s.lc,i._DrawingWand_PathQuadraticCurveToRel=s.mc,i._DrawingWand_PathSmoothCurveToAbs=s.nc,i._DrawingWand_PathSmoothCurveToRel=s.oc,i._DrawingWand_PathSmoothQuadraticCurveToAbs=s.pc,i._DrawingWand_PathSmoothQuadraticCurveToRel=s.qc,i._DrawingWand_PathStart=s.rc,i._DrawingWand_Point=s.sc,i._DrawingWand_Polygon=s.tc,i._DrawingWand_Polyline=s.uc,i._DrawingWand_PopClipPath=s.vc,i._DrawingWand_PopGraphicContext=s.wc,i._DrawingWand_PopPattern=s.xc,i._DrawingWand_PushClipPath=s.yc,i._DrawingWand_PushGraphicContext=s.zc,i._DrawingWand_PushPattern=s.Ac,i._DrawingWand_Rectangle=s.Bc,i._DrawingWand_Render=s.Cc,i._DrawingWand_Rotation=s.Dc,i._DrawingWand_RoundRectangle=s.Ec,i._DrawingWand_Scaling=s.Fc,i._DrawingWand_SkewX=s.Gc,i._DrawingWand_SkewY=s.Hc,i._DrawingWand_StrokeAntialias=s.Ic,i._DrawingWand_StrokeColor=s.Jc,i._DrawingWand_StrokeDashArray=s.Kc,i._DrawingWand_StrokeDashOffset=s.Lc,i._DrawingWand_StrokeLineCap=s.Mc,i._DrawingWand_StrokeLineJoin=s.Nc,i._DrawingWand_StrokeMiterLimit=s.Oc,i._DrawingWand_StrokeOpacity=s.Pc,i._DrawingWand_StrokePatternUrl=s.Qc,i._DrawingWand_StrokeWidth=s.Rc,i._DrawingWand_Text=s.Sc,i._DrawingWand_TextAlignment=s.Tc,i._DrawingWand_TextAntialias=s.Uc,i._DrawingWand_TextDecoration=s.Vc,i._DrawingWand_TextDirection=s.Wc,i._DrawingWand_TextEncoding=s.Xc,i._DrawingWand_TextInterlineSpacing=s.Yc,i._DrawingWand_TextInterwordSpacing=s.Zc,i._DrawingWand_TextKerning=s._c,i._DrawingWand_TextUnderColor=s.$c,i._DrawingWand_Translation=s.ad,i._DrawingWand_Viewbox=s.bd,i._MagickExceptionHelper_Description=s.cd,i._MagickExceptionHelper_Dispose=s.dd,i._MagickExceptionHelper_Related=s.ed,i._MagickExceptionHelper_RelatedCount=s.fd,i._MagickExceptionHelper_Message=s.gd,i._MagickExceptionHelper_Severity=s.hd,i._PdfInfo_PageCount=s.id,i._Environment_Initialize=s.jd,i._Environment_GetEnv=s.kd,i._Environment_SetEnv=s.ld,i._MagickMemory_Relinquish=s.md,i._Magick_Delegates_Get=s.nd,i._Magick_Features_Get=s.od,i._Magick_ImageMagickVersion_Get=s.pd,i._Magick_GetFonts=s.qd,i._Magick_GetFontFamily=s.rd,i._Magick_GetFontName=s.sd,i._Magick_DisposeFonts=s.td,i._Magick_ResetRandomSeed=s.ud,i._Magick_SetDefaultFontFile=s.vd,i._Magick_SetRandomSeed=s.wd,i._Magick_SetLogDelegate=s.xd,i._Magick_SetLogEvents=s.yd,i._MagickFormatInfo_CreateList=s.zd,i._MagickFormatInfo_DisposeList=s.Ad,i._MagickFormatInfo_CanReadMultithreaded_Get=s.Bd,i._MagickFormatInfo_CanWriteMultithreaded_Get=s.Cd,i._MagickFormatInfo_Description_Get=s.Dd,i._MagickFormatInfo_Format_Get=s.Ed,i._MagickFormatInfo_MimeType_Get=s.Fd,i._MagickFormatInfo_Module_Get=s.Gd,i._MagickFormatInfo_SupportsMultipleFrames_Get=s.Hd,i._MagickFormatInfo_SupportsReading_Get=s.Id,i._MagickFormatInfo_SupportsWriting_Get=s.Jd,i._MagickFormatInfo_GetInfo=s.Kd,i._MagickFormatInfo_GetInfoByName=s.Ld,i._MagickFormatInfo_GetInfoWithBlob=s.Md,i._MagickFormatInfo_Unregister=s.Nd,i._MagickImage_Create=s.Od,i._MagickImage_Dispose=s.Pd,i._MagickImage_AnimationDelay_Get=s.Qd,i._MagickImage_AnimationDelay_Set=s.Rd,i._MagickImage_AnimationIterations_Get=s.Sd,i._MagickImage_AnimationIterations_Set=s.Td,i._MagickImage_AnimationTicksPerSecond_Get=s.Ud,i._MagickImage_AnimationTicksPerSecond_Set=s.Vd,i._MagickImage_BackgroundColor_Get=s.Wd,i._MagickImage_BackgroundColor_Set=s.Xd,i._MagickImage_BaseHeight_Get=s.Yd,i._MagickImage_BaseWidth_Get=s.Zd,i._MagickImage_BlackPointCompensation_Get=s._d,i._MagickImage_BlackPointCompensation_Set=s.$d,i._MagickImage_BorderColor_Get=s.ae,i._MagickImage_BorderColor_Set=s.be,i._MagickImage_BoundingBox_Get=s.ce,i._MagickRectangle_Create=s.de,i._MagickImage_ChannelCount_Get=s.ee,i._MagickImage_ChromaBlue_Get=s.fe,i._PrimaryInfo_Create=s.ge,i._MagickImage_ChromaBlue_Set=s.he,i._MagickImage_ChromaGreen_Get=s.ie,i._MagickImage_ChromaGreen_Set=s.je,i._MagickImage_ChromaRed_Get=s.ke,i._MagickImage_ChromaRed_Set=s.le,i._MagickImage_ChromaWhite_Get=s.me,i._MagickImage_ChromaWhite_Set=s.ne,i._MagickImage_ClassType_Get=s.oe,i._MagickImage_ClassType_Set=s.pe,i._QuantizeSettings_Create=s.qe,i._QuantizeSettings_Dispose=s.re,i._MagickImage_ColorFuzz_Get=s.se,i._MagickImage_ColorFuzz_Set=s.te,i._MagickImage_ColormapSize_Get=s.ue,i._MagickImage_ColormapSize_Set=s.ve,i._MagickImage_ColorSpace_Get=s.we,i._MagickImage_ColorSpace_Set=s.xe,i._MagickImage_ColorType_Get=s.ye,i._MagickImage_ColorType_Set=s.ze,i._MagickImage_Compose_Get=s.Ae,i._MagickImage_Compose_Set=s.Be,i._MagickImage_Compression_Get=s.Ce,i._MagickImage_Compression_Set=s.De,i._MagickImage_Depth_Get=s.Ee,i._MagickImage_Depth_Set=s.Fe,i._MagickImage_EncodingGeometry_Get=s.Ge,i._MagickImage_Endian_Get=s.He,i._MagickImage_Endian_Set=s.Ie,i._MagickImage_FileName_Get=s.Je,i._MagickImage_FileName_Set=s.Ke,i._MagickImage_FilterType_Get=s.Le,i._MagickImage_FilterType_Set=s.Me,i._MagickImage_Format_Get=s.Ne,i._MagickImage_Format_Set=s.Oe,i._MagickImage_Gamma_Get=s.Pe,i._MagickImage_GifDisposeMethod_Get=s.Qe,i._MagickImage_GifDisposeMethod_Set=s.Re,i._MagickImage_HasAlpha_Get=s.Se,i._MagickImage_HasAlpha_Set=s.Te,i._MagickImage_Height_Get=s.Ue,i._MagickImage_Interlace_Get=s.Ve,i._MagickImage_Interlace_Set=s.We,i._MagickImage_Interpolate_Get=s.Xe,i._MagickImage_Interpolate_Set=s.Ye,i._MagickImage_IsOpaque_Get=s.Ze,i._MagickImage_MatteColor_Get=s._e,i._MagickImage_MatteColor_Set=s.$e,i._MagickImage_MeanErrorPerPixel_Get=s.af,i._MagickImage_MetaChannelCount_Get=s.bf,i._MagickImage_MetaChannelCount_Set=s.cf,i._MagickImage_NormalizedMaximumError_Get=s.df,i._MagickImage_NormalizedMeanError_Get=s.ef,i._MagickImage_Orientation_Get=s.ff,i._MagickImage_Orientation_Set=s.gf,i._MagickImage_Page_Get=s.hf,i._MagickImage_Page_Set=s.jf,i._MagickImage_Quality_Get=s.kf,i._MagickImage_Quality_Set=s.lf,i._MagickImage_RenderingIntent_Get=s.mf,i._MagickImage_RenderingIntent_Set=s.nf,i._MagickImage_ResolutionUnits_Get=s.of,i._MagickImage_ResolutionUnits_Set=s.pf,i._MagickImage_ResolutionX_Get=s.qf,i._MagickImage_ResolutionX_Set=s.rf,i._MagickImage_ResolutionY_Get=s.sf,i._MagickImage_ResolutionY_Set=s.tf,i._MagickImage_Signature_Get=s.uf,i._MagickImage_TotalColors_Get=s.vf,i._MagickImage_VirtualPixelMethod_Get=s.wf,i._MagickImage_VirtualPixelMethod_Set=s.xf,i._MagickImage_Width_Get=s.yf,i._MagickImage_AdaptiveBlur=s.zf,i._MagickImage_AdaptiveResize=s.Af,i._MagickImage_AdaptiveSharpen=s.Bf,i._MagickImage_AdaptiveThreshold=s.Cf,i._MagickImage_AddNoise=s.Df,i._MagickImage_AffineTransform=s.Ef,i._MagickImage_Annotate=s.Ff,i._MagickImage_AutoGamma=s.Gf,i._MagickImage_AutoLevel=s.Hf,i._MagickImage_AutoOrient=s.If,i._MagickImage_AutoThreshold=s.Jf,i._MagickImage_BilateralBlur=s.Kf,i._MagickImage_BlackThreshold=s.Lf,i._MagickImage_BlueShift=s.Mf,i._MagickImage_Blur=s.Nf,i._MagickImage_Border=s.Of,i._MagickImage_BrightnessContrast=s.Pf,i._MagickImage_CannyEdge=s.Qf,i._MagickImage_ChannelOffset=s.Rf,i._MagickImage_Charcoal=s.Sf,i._MagickImage_Chop=s.Tf,i._MagickImage_Clahe=s.Uf,i._MagickImage_Clamp=s.Vf,i._MagickImage_ClipPath=s.Wf,i._MagickImage_Clone=s.Xf,i._MagickImage_CloneArea=s.Yf,i._MagickImage_Clut=s.Zf,i._MagickImage_ColorDecisionList=s._f,i._MagickImage_Colorize=s.$f,i._MagickImage_ColorMatrix=s.ag,i._MagickImage_ColorThreshold=s.bg,i._MagickImage_Compare=s.cg,i._MagickImage_CompareDistortion=s.dg,i._MagickImage_Composite=s.eg,i._MagickImage_CompositeGravity=s.fg,i._MagickImage_ConnectedComponents=s.gg,i._MagickImage_Contrast=s.hg,i._MagickImage_ContrastStretch=s.ig,i._MagickImage_ConvexHull=s.jg,i._MagickImage_Convolve=s.kg,i._MagickImage_CopyPixels=s.lg,i._MagickImage_Crop=s.mg,i._MagickImage_CropToTiles=s.ng,i._MagickImage_CycleColormap=s.og,i._MagickImage_Decipher=s.pg,i._MagickImage_Deskew=s.qg,i._MagickImage_Despeckle=s.rg,i._MagickImage_DetermineBitDepth=s.sg,i._MagickImage_DetermineColorType=s.tg,i._MagickImage_Distort=s.ug,i._MagickImage_Edge=s.vg,i._MagickImage_Emboss=s.wg,i._MagickImage_Encipher=s.xg,i._MagickImage_Enhance=s.yg,i._MagickImage_Equalize=s.zg,i._MagickImage_Equals=s.Ag,i._MagickImage_EvaluateFunction=s.Bg,i._MagickImage_EvaluateGeometry=s.Cg,i._MagickImage_EvaluateOperator=s.Dg,i._MagickImage_Extent=s.Eg,i._MagickImage_Flip=s.Fg,i._MagickImage_FloodFill=s.Gg,i._MagickImage_Flop=s.Hg,i._MagickImage_FontTypeMetrics=s.Ig,i._MagickImage_FormatExpression=s.Jg,i._MagickImage_Frame=s.Kg,i._MagickImage_Fx=s.Lg,i._MagickImage_GammaCorrect=s.Mg,i._MagickImage_GaussianBlur=s.Ng,i._MagickImage_GetArtifact=s.Og,i._MagickImage_GetAttribute=s.Pg,i._MagickImage_GetColormapColor=s.Qg,i._MagickImage_GetNext=s.Rg,i._MagickImage_GetNextArtifactName=s.Sg,i._MagickImage_GetNextAttributeName=s.Tg,i._MagickImage_GetNextProfileName=s.Ug,i._MagickImage_GetProfile=s.Vg,i._MagickImage_GetReadMask=s.Wg,i._MagickImage_GetWriteMask=s.Xg,i._MagickImage_Grayscale=s.Yg,i._MagickImage_HaldClut=s.Zg,i._MagickImage_HasChannel=s._g,i._MagickImage_HasProfile=s.$g,i._MagickImage_Histogram=s.ah,i._MagickImage_HoughLine=s.bh,i._MagickImage_Implode=s.ch,i._MagickImage_ImportPixels=s.dh,i._MagickImage_Integral=s.eh,i._MagickImage_InterpolativeResize=s.fh,i._MagickImage_InverseLevel=s.gh,i._MagickImage_Kmeans=s.hh,i._MagickImage_Kuwahara=s.ih,i._MagickImage_Level=s.jh,i._MagickImage_LevelColors=s.kh,i._MagickImage_LinearStretch=s.lh,i._MagickImage_LiquidRescale=s.mh,i._MagickImage_LocalContrast=s.nh,i._MagickImage_Magnify=s.oh,i._MagickImage_MeanShift=s.ph,i._MagickImage_Minify=s.qh,i._MagickImage_MinimumBoundingBox=s.rh,i._MagickImage_Modulate=s.sh,i._MagickImage_Moments=s.th,i._MagickImage_Morphology=s.uh,i._MagickImage_MotionBlur=s.vh,i._MagickImage_Negate=s.wh,i._MagickImage_Normalize=s.xh,i._MagickImage_OilPaint=s.yh,i._MagickImage_Opaque=s.zh,i._MagickImage_OrderedDither=s.Ah,i._MagickImage_Perceptible=s.Bh,i._MagickImage_PerceptualHash=s.Ch,i._MagickImage_Quantize=s.Dh,i._MagickImage_Polaroid=s.Eh,i._MagickImage_Posterize=s.Fh,i._MagickImage_RaiseOrLower=s.Gh,i._MagickImage_RandomThreshold=s.Hh,i._MagickImage_RangeThreshold=s.Ih,i._MagickImage_ReadBlob=s.Jh,i._MagickImage_ReadFile=s.Kh,i._MagickImage_ReadPixels=s.Lh,i._MagickImage_ReadStream=s.Mh,i._MagickImage_RegionMask=s.Nh,i._MagickImage_Remap=s.Oh,i._MagickImage_RemoveArtifact=s.Ph,i._MagickImage_RemoveAttribute=s.Qh,i._MagickImage_RemoveProfile=s.Rh,i._MagickImage_ResetArtifactIterator=s.Sh,i._MagickImage_ResetAttributeIterator=s.Th,i._MagickImage_ResetProfileIterator=s.Uh,i._MagickImage_Resample=s.Vh,i._MagickImage_Resize=s.Wh,i._MagickImage_Roll=s.Xh,i._MagickImage_Rotate=s.Yh,i._MagickImage_RotationalBlur=s.Zh,i._MagickImage_Sample=s._h,i._MagickImage_Scale=s.$h,i._MagickImage_Segment=s.ai,i._MagickImage_SelectiveBlur=s.bi,i._MagickImage_Separate=s.ci,i._MagickImage_SepiaTone=s.di,i._MagickImage_SetAlpha=s.ei,i._MagickImage_SetArtifact=s.fi,i._MagickImage_SetAttribute=s.gi,i._MagickImage_SetBitDepth=s.hi,i._MagickImage_SetClientData=s.ii,i._MagickImage_SetColormapColor=s.ji,i._MagickImage_SetColorMetric=s.ki,i._MagickImage_SetNext=s.li,i._MagickImage_SetProfile=s.mi,i._MagickImage_SetProgressDelegate=s.ni,i._MagickImage_SetReadMask=s.oi,i._MagickImage_SetWriteMask=s.pi,i._MagickImage_Shade=s.qi,i._MagickImage_Shadow=s.ri,i._MagickImage_Sharpen=s.si,i._MagickImage_Shave=s.ti,i._MagickImage_Shear=s.ui,i._MagickImage_SigmoidalContrast=s.vi,i._MagickImage_SparseColor=s.wi,i._MagickImage_Spread=s.xi,i._MagickImage_Sketch=s.yi,i._MagickImage_Solarize=s.zi,i._MagickImage_SortPixels=s.Ai,i._MagickImage_Splice=s.Bi,i._MagickImage_Statistic=s.Ci,i._MagickImage_Statistics=s.Di,i._MagickImage_Stegano=s.Ei,i._MagickImage_Stereo=s.Fi,i._MagickImage_Strip=s.Gi,i._MagickImage_SubImageSearch=s.Hi,i._MagickImage_Swirl=s.Ii,i._MagickImage_Texture=s.Ji,i._MagickImage_Threshold=s.Ki,i._MagickImage_Thumbnail=s.Li,i._MagickImage_Tint=s.Mi,i._MagickImage_Transparent=s.Ni,i._MagickImage_TransparentChroma=s.Oi,i._MagickImage_Transpose=s.Pi,i._MagickImage_Transverse=s.Qi,i._MagickImage_Trim=s.Ri,i._MagickImage_UniqueColors=s.Si,i._MagickImage_UnsharpMask=s.Ti,i._MagickImage_Vignette=s.Ui,i._MagickImage_Wave=s.Vi,i._MagickImage_WaveletDenoise=s.Wi,i._MagickImage_WhiteBalance=s.Xi,i._MagickImage_WhiteThreshold=s.Yi,i._MagickImage_WriteBlob=s.Zi,i._MagickImage_WriteFile=s._i,i._MagickImage_WriteStream=s.$i,i._MagickImageCollection_Append=s.aj,i._MagickImageCollection_Coalesce=s.bj,i._MagickImageCollection_Combine=s.cj,i._MagickImageCollection_Complex=s.dj,i._MagickImageCollection_Deconstruct=s.ej,i._MagickImageCollection_Dispose=s.fj,i._MagickImageCollection_Evaluate=s.gj,i._MagickImageCollection_Fx=s.hj,i._MagickImageCollection_Merge=s.ij,i._MagickImageCollection_Montage=s.jj,i._MagickImageCollection_Morph=s.kj,i._MagickImageCollection_Optimize=s.lj,i._MagickImageCollection_OptimizePlus=s.mj,i._MagickImageCollection_OptimizeTransparency=s.nj,i._MagickImageCollection_Polynomial=s.oj,i._MagickImageCollection_Quantize=s.pj,i._MagickImageCollection_ReadBlob=s.qj,i._MagickImageCollection_ReadFile=s.rj,i._MagickImageCollection_ReadStream=s.sj,i._MagickImageCollection_Remap=s.tj,i._MagickImageCollection_Smush=s.uj,i._MagickImageCollection_WriteFile=s.vj,i._MagickImageCollection_WriteStream=s.wj,i._DoubleMatrix_Create=s.xj,i._DoubleMatrix_Dispose=s.yj,i._OpenCL_GetDevices=s.zj,i._OpenCL_GetDevice=s.Aj,i._OpenCL_GetEnabled=s.Bj,i._OpenCL_SetEnabled=s.Cj,i._OpenCLDevice_DeviceType_Get=s.Dj,i._OpenCLDevice_BenchmarkScore_Get=s.Ej,i._OpenCLDevice_IsEnabled_Get=s.Fj,i._OpenCLDevice_IsEnabled_Set=s.Gj,i._OpenCLDevice_Name_Get=s.Hj,i._OpenCLDevice_Version_Get=s.Ij,i._OpenCLDevice_GetKernelProfileRecords=s.Jj,i._OpenCLDevice_GetKernelProfileRecord=s.Kj,i._OpenCLDevice_SetProfileKernels=s.Lj,i._OpenCLKernelProfileRecord_Count_Get=s.Mj,i._OpenCLKernelProfileRecord_Name_Get=s.Nj,i._OpenCLKernelProfileRecord_MaximumDuration_Get=s.Oj,i._OpenCLKernelProfileRecord_MinimumDuration_Get=s.Pj,i._OpenCLKernelProfileRecord_TotalDuration_Get=s.Qj,i._JpegOptimizer_CompressFile=s.Rj,i._JpegOptimizer_CompressStream=s.Sj;var Yr=i._malloc=s.Tj,Qe=i._free=s.Uj;i._PixelCollection_Create=s.Vj,i._PixelCollection_Dispose=s.Wj,i._PixelCollection_GetArea=s.Xj,i._PixelCollection_GetReadOnlyArea=s.Yj,i._PixelCollection_SetArea=s.Zj,i._PixelCollection_ToByteArray=s._j,i._PixelCollection_ToShortArray=s.$j,i._Quantum_Depth_Get=s.ak,i._Quantum_Max_Get=s.bk,i._ResourceLimits_Area_Get=s.ck,i._ResourceLimits_Area_Set=s.dk,i._ResourceLimits_Disk_Get=s.ek,i._ResourceLimits_Disk_Set=s.fk,i._ResourceLimits_Height_Get=s.gk,i._ResourceLimits_Height_Set=s.hk,i._ResourceLimits_ListLength_Get=s.ik,i._ResourceLimits_ListLength_Set=s.jk,i._ResourceLimits_MaxMemoryRequest_Get=s.kk,i._ResourceLimits_MaxMemoryRequest_Set=s.lk,i._ResourceLimits_MaxProfileSize_Get=s.mk,i._ResourceLimits_MaxProfileSize_Set=s.nk,i._ResourceLimits_Memory_Get=s.ok,i._ResourceLimits_Memory_Set=s.pk,i._ResourceLimits_Thread_Get=s.qk,i._ResourceLimits_Thread_Set=s.rk,i._ResourceLimits_Throttle_Get=s.sk,i._ResourceLimits_Throttle_Set=s.tk,i._ResourceLimits_Time_Get=s.uk,i._ResourceLimits_Time_Set=s.vk,i._ResourceLimits_Width_Get=s.wk,i._ResourceLimits_Width_Set=s.xk,i._ResourceLimits_LimitMemory=s.yk,i._DrawingSettings_Create=s.zk,i._DrawingSettings_Dispose=s.Ak,i._DrawingSettings_BorderColor_Get=s.Bk,i._DrawingSettings_BorderColor_Set=s.Ck,i._DrawingSettings_FillColor_Get=s.Dk,i._DrawingSettings_FillColor_Set=s.Ek,i._DrawingSettings_FillRule_Get=s.Fk,i._DrawingSettings_FillRule_Set=s.Gk,i._DrawingSettings_Font_Get=s.Hk,i._DrawingSettings_Font_Set=s.Ik,i._DrawingSettings_FontFamily_Get=s.Jk,i._DrawingSettings_FontFamily_Set=s.Kk,i._DrawingSettings_FontPointsize_Get=s.Lk,i._DrawingSettings_FontPointsize_Set=s.Mk,i._DrawingSettings_FontStyle_Get=s.Nk,i._DrawingSettings_FontStyle_Set=s.Ok,i._DrawingSettings_FontWeight_Get=s.Pk,i._DrawingSettings_FontWeight_Set=s.Qk,i._DrawingSettings_StrokeAntiAlias_Get=s.Rk,i._DrawingSettings_StrokeAntiAlias_Set=s.Sk,i._DrawingSettings_StrokeColor_Get=s.Tk,i._DrawingSettings_StrokeColor_Set=s.Uk,i._DrawingSettings_StrokeDashOffset_Get=s.Vk,i._DrawingSettings_StrokeDashOffset_Set=s.Wk,i._DrawingSettings_StrokeLineCap_Get=s.Xk,i._DrawingSettings_StrokeLineCap_Set=s.Yk,i._DrawingSettings_StrokeLineJoin_Get=s.Zk,i._DrawingSettings_StrokeLineJoin_Set=s._k,i._DrawingSettings_StrokeMiterLimit_Get=s.$k,i._DrawingSettings_StrokeMiterLimit_Set=s.al,i._DrawingSettings_StrokeWidth_Get=s.bl,i._DrawingSettings_StrokeWidth_Set=s.cl,i._DrawingSettings_TextAntiAlias_Get=s.dl,i._DrawingSettings_TextAntiAlias_Set=s.el,i._DrawingSettings_TextDirection_Get=s.fl,i._DrawingSettings_TextDirection_Set=s.gl,i._DrawingSettings_TextEncoding_Get=s.hl,i._DrawingSettings_TextEncoding_Set=s.il,i._DrawingSettings_TextGravity_Get=s.jl,i._DrawingSettings_TextGravity_Set=s.kl,i._DrawingSettings_TextInterlineSpacing_Get=s.ll,i._DrawingSettings_TextInterlineSpacing_Set=s.ml,i._DrawingSettings_TextInterwordSpacing_Get=s.nl,i._DrawingSettings_TextInterwordSpacing_Set=s.ol,i._DrawingSettings_TextKerning_Get=s.pl,i._DrawingSettings_TextKerning_Set=s.ql,i._DrawingSettings_TextUnderColor_Get=s.rl,i._DrawingSettings_TextUnderColor_Set=s.sl,i._DrawingSettings_SetAffine=s.tl,i._DrawingSettings_SetFillPattern=s.ul,i._DrawingSettings_SetStrokeDashArray=s.vl,i._DrawingSettings_SetStrokePattern=s.wl,i._DrawingSettings_SetText=s.xl,i._MagickSettings_Create=s.yl,i._MagickSettings_Dispose=s.zl,i._MagickSettings_AntiAlias_Get=s.Al,i._MagickSettings_AntiAlias_Set=s.Bl,i._MagickSettings_BackgroundColor_Get=s.Cl,i._MagickSettings_BackgroundColor_Set=s.Dl,i._MagickSettings_ColorSpace_Get=s.El,i._MagickSettings_ColorSpace_Set=s.Fl,i._MagickSettings_ColorType_Get=s.Gl,i._MagickSettings_ColorType_Set=s.Hl,i._MagickSettings_Compression_Get=s.Il,i._MagickSettings_Compression_Set=s.Jl,i._MagickSettings_Debug_Get=s.Kl,i._MagickSettings_Debug_Set=s.Ll,i._MagickSettings_Density_Get=s.Ml,i._MagickSettings_Density_Set=s.Nl,i._MagickSettings_Depth_Get=s.Ol,i._MagickSettings_Depth_Set=s.Pl,i._MagickSettings_Endian_Get=s.Ql,i._MagickSettings_Endian_Set=s.Rl,i._MagickSettings_Extract_Get=s.Sl,i._MagickSettings_Extract_Set=s.Tl,i._MagickSettings_Format_Get=s.Ul,i._MagickSettings_Format_Set=s.Vl,i._MagickSettings_FontPointsize_Get=s.Wl,i._MagickSettings_FontPointsize_Set=s.Xl,i._MagickSettings_Interlace_Get=s.Yl,i._MagickSettings_Interlace_Set=s.Zl,i._MagickSettings_Monochrome_Get=s._l,i._MagickSettings_Monochrome_Set=s.$l,i._MagickSettings_Verbose_Get=s.am,i._MagickSettings_Verbose_Set=s.bm,i._MagickSettings_SetColorFuzz=s.cm,i._MagickSettings_SetFileName=s.dm,i._MagickSettings_SetFont=s.em,i._MagickSettings_SetNumberScenes=s.fm,i._MagickSettings_SetOption=s.gm,i._MagickSettings_SetPage=s.hm,i._MagickSettings_SetPing=s.im,i._MagickSettings_SetQuality=s.jm,i._MagickSettings_SetScenes=s.km,i._MagickSettings_SetScene=s.lm,i._MagickSettings_SetSize=s.mm,i._MontageSettings_Create=s.nm,i._MontageSettings_Dispose=s.om,i._MontageSettings_SetBackgroundColor=s.pm,i._MontageSettings_SetBorderColor=s.qm,i._MontageSettings_SetBorderWidth=s.rm,i._MontageSettings_SetFillColor=s.sm,i._MontageSettings_SetFont=s.tm,i._MontageSettings_SetFontPointsize=s.um,i._MontageSettings_SetFrameGeometry=s.vm,i._MontageSettings_SetGeometry=s.wm,i._MontageSettings_SetGravity=s.xm,i._MontageSettings_SetShadow=s.ym,i._MontageSettings_SetStrokeColor=s.zm,i._MontageSettings_SetTextureFileName=s.Am,i._MontageSettings_SetTileGeometry=s.Bm,i._MontageSettings_SetTitle=s.Cm,i._QuantizeSettings_SetColors=s.Dm,i._QuantizeSettings_SetColorSpace=s.Em,i._QuantizeSettings_SetDitherMethod=s.Fm,i._QuantizeSettings_SetMeasureErrors=s.Gm,i._QuantizeSettings_SetTreeDepth=s.Hm,i._ChannelMoments_Centroid_Get=s.Im,i._ChannelMoments_EllipseAngle_Get=s.Jm,i._ChannelMoments_EllipseAxis_Get=s.Km,i._ChannelMoments_EllipseEccentricity_Get=s.Lm,i._ChannelMoments_EllipseIntensity_Get=s.Mm,i._ChannelMoments_GetHuInvariants=s.Nm,i._ChannelPerceptualHash_GetHuPhash=s.Om,i._ChannelStatistics_Depth_Get=s.Pm,i._ChannelStatistics_Entropy_Get=s.Qm,i._ChannelStatistics_Kurtosis_Get=s.Rm,i._ChannelStatistics_Maximum_Get=s.Sm,i._ChannelStatistics_Mean_Get=s.Tm,i._ChannelStatistics_Minimum_Get=s.Um,i._ChannelStatistics_Skewness_Get=s.Vm,i._ChannelStatistics_StandardDeviation_Get=s.Wm,i._Moments_DisposeList=s.Xm,i._Moments_GetInstance=s.Ym,i._PerceptualHash_DisposeList=s.Zm,i._PerceptualHash_GetInstance=s._m,i._Statistics_DisposeList=s.$m,i._Statistics_GetInstance=s.an,i._ConnectedComponent_DisposeList=s.bn,i._ConnectedComponent_GetArea=s.cn,i._ConnectedComponent_GetCentroid=s.dn,i._ConnectedComponent_GetColor=s.en,i._ConnectedComponent_GetHeight=s.fn,i._ConnectedComponent_GetId=s.gn,i._ConnectedComponent_GetWidth=s.hn,i._ConnectedComponent_GetX=s.jn,i._ConnectedComponent_GetY=s.kn,i._ConnectedComponent_GetInstance=s.ln,i._MagickGeometry_Create=s.mn,i._MagickGeometry_Dispose=s.nn,i._MagickGeometry_X_Get=s.on,i._MagickGeometry_Y_Get=s.pn,i._MagickGeometry_Width_Get=s.qn,i._MagickGeometry_Height_Get=s.rn,i._MagickGeometry_Initialize=s.sn,i._MagickRectangle_Dispose=s.tn,i._MagickRectangle_X_Get=s.un,i._MagickRectangle_X_Set=s.vn,i._MagickRectangle_Y_Get=s.wn,i._MagickRectangle_Y_Set=s.xn,i._MagickRectangle_Width_Get=s.yn,i._MagickRectangle_Width_Set=s.zn,i._MagickRectangle_Height_Get=s.An,i._MagickRectangle_Height_Set=s.Bn,i._MagickRectangle_FromPageSize=s.Cn,i._OffsetInfo_Create=s.Dn,i._OffsetInfo_Dispose=s.En,i._OffsetInfo_SetX=s.Fn,i._OffsetInfo_SetY=s.Gn,i._PointInfo_X_Get=s.Hn,i._PointInfo_Y_Get=s.In,i._PointInfoCollection_Create=s.Jn,i._PointInfoCollection_Dispose=s.Kn,i._PointInfoCollection_GetX=s.Ln,i._PointInfoCollection_GetY=s.Mn,i._PointInfoCollection_Set=s.Nn,i._PrimaryInfo_Dispose=s.On,i._PrimaryInfo_X_Get=s.Pn,i._PrimaryInfo_X_Set=s.Qn,i._PrimaryInfo_Y_Get=s.Rn,i._PrimaryInfo_Y_Set=s.Sn,i._PrimaryInfo_Z_Get=s.Tn,i._PrimaryInfo_Z_Set=s.Un,i._StringInfo_Length_Get=s.Vn,i._StringInfo_Datum_Get=s.Wn,i._TypeMetric_Dispose=s.Xn,i._TypeMetric_Ascent_Get=s.Yn,i._TypeMetric_Descent_Get=s.Zn,i._TypeMetric_MaxHorizontalAdvance_Get=s._n,i._TypeMetric_TextHeight_Get=s.$n,i._TypeMetric_TextWidth_Get=s.ao,i._TypeMetric_UnderlinePosition_Get=s.bo,i._TypeMetric_UnderlineThickness_Get=s.co;var Ao=s.eo,U=s.fo,Ro=s.go,Go=s.ho,Fo=s.io,xo=s.jo;function Lo(t,r,a,o){var c=H();try{B(t)(r,a,o)}catch(g){if($(c),g!==g+0)throw g;U(1,0)}}function Wo(t,r,a,o){var c=H();try{return B(t)(r,a,o)}catch(g){if($(c),g!==g+0)throw g;U(1,0)}}function Bo(t,r,a){var o=H();try{return B(t)(r,a)}catch(c){if($(o),c!==c+0)throw c;U(1,0)}}function No(t,r){var a=H();try{return B(t)(r)}catch(o){if($(a),o!==o+0)throw o;U(1,0)}}function zo(t,r){var a=H();try{B(t)(r)}catch(o){if($(a),o!==o+0)throw o;U(1,0)}}function $o(t,r,a){var o=H();try{B(t)(r,a)}catch(c){if($(o),c!==c+0)throw c;U(1,0)}}function Ho(t,r,a,o,c){var g=H();try{B(t)(r,a,o,c)}catch(h){if($(g),h!==h+0)throw h;U(1,0)}}function Uo(t,r,a,o,c){var g=H();try{return B(t)(r,a,o,c)}catch(h){if($(g),h!==h+0)throw h;U(1,0)}}function jo(t,r,a,o){var c=H();try{return B(t)(r,a,o)}catch(g){if($(c),g!==g+0)throw g;return U(1,0),0n}}function Yo(t,r){var a=H();try{return B(t)(r)}catch(o){if($(a),o!==o+0)throw o;return U(1,0),0n}}function Vo(t,r,a,o,c,g,h,f,p){var w=H();try{return B(t)(r,a,o,c,g,h,f,p)}catch(y){if($(w),y!==y+0)throw y;U(1,0)}}function Xo(t,r,a,o,c,g,h){var f=H();try{return B(t)(r,a,o,c,g,h)}catch(p){if($(f),p!==p+0)throw p;U(1,0)}}function qo(t,r,a,o,c){var g=H();try{return B(t)(r,a,o,c)}catch(h){if($(g),h!==h+0)throw h;U(1,0)}}function Ko(t){var r=H();try{return B(t)()}catch(a){if($(r),a!==a+0)throw a;U(1,0)}}function Qo(t,r,a){var o=H();try{return B(t)(r,a)}catch(c){if($(o),c!==c+0)throw c;U(1,0)}}function Jo(t,r,a){var o=H();try{B(t)(r,a)}catch(c){if($(o),c!==c+0)throw c;U(1,0)}}function Oo(t,r,a,o,c,g){var h=H();try{return B(t)(r,a,o,c,g)}catch(f){if($(h),f!==f+0)throw f;U(1,0)}}function Zo(t,r,a){var o=H();try{return B(t)(r,a)}catch(c){if($(o),c!==c+0)throw c;U(1,0)}}function ec(t){var r=H();try{B(t)()}catch(a){if($(r),a!==a+0)throw a;U(1,0)}}function tc(t,r,a,o,c,g){var h=H();try{B(t)(r,a,o,c,g)}catch(f){if($(h),f!==f+0)throw f;U(1,0)}}function ic(t,r,a,o,c,g,h,f){var p=H();try{return B(t)(r,a,o,c,g,h,f)}catch(w){if($(p),w!==w+0)throw w;U(1,0)}}function rc(t,r,a,o,c,g,h,f,p,w){var y=H();try{return B(t)(r,a,o,c,g,h,f,p,w)}catch(I){if($(y),I!==I+0)throw I;U(1,0)}}function nc(t,r,a,o){var c=H();try{B(t)(r,a,o)}catch(g){if($(c),g!==g+0)throw g;U(1,0)}}function ac(t,r,a,o,c,g,h,f,p,w,y){var I=H();try{B(t)(r,a,o,c,g,h,f,p,w,y)}catch(E){if($(I),E!==E+0)throw E;U(1,0)}}function sc(t,r,a,o,c,g,h,f,p,w,y){var I=H();try{return B(t)(r,a,o,c,g,h,f,p,w,y)}catch(E){if($(I),E!==E+0)throw E;U(1,0)}}function oc(t,r,a,o,c,g,h,f,p,w){var y=H();try{B(t)(r,a,o,c,g,h,f,p,w)}catch(I){if($(y),I!==I+0)throw I;U(1,0)}}function cc(t,r,a,o,c,g,h){var f=H();try{B(t)(r,a,o,c,g,h)}catch(p){if($(f),p!==p+0)throw p;U(1,0)}}function _c(t,r,a,o,c,g,h,f){var p=H();try{B(t)(r,a,o,c,g,h,f)}catch(w){if($(p),w!==w+0)throw w;U(1,0)}}function lc(t,r,a,o,c,g,h,f,p,w,y,I){var E=H();try{return B(t)(r,a,o,c,g,h,f,p,w,y,I)}catch(P){if($(E),P!==P+0)throw P;U(1,0)}}function uc(t,r,a,o,c,g){var h=H();try{return B(t)(r,a,o,c,g)}catch(f){if($(h),f!==f+0)throw f;U(1,0)}}function gc(t,r,a,o,c,g,h,f,p){var w=H();try{B(t)(r,a,o,c,g,h,f,p)}catch(y){if($(w),y!==y+0)throw y;U(1,0)}}function hc(t,r,a,o,c,g,h,f,p,w,y,I){var E=H();try{B(t)(r,a,o,c,g,h,f,p,w,y,I)}catch(P){if($(E),P!==P+0)throw P;U(1,0)}}function dc(t){t=Object.assign({},t);var r=c=>g=>c(g)>>>0,a=c=>(g,h)=>c(g,h)>>>0,o=c=>()=>c()>>>0;return t.db=r(t.db),t.Tj=r(t.Tj),t.eo=a(t.eo),t._emscripten_stack_alloc=r(t._emscripten_stack_alloc),t.io=o(t.io),t}function ki(){if(Ye>0){lt=ki;return}if(Rn(),Ye>0){lt=ki;return}function t(){i.calledRun=!0,!Ot&&(Gn(),l(i),i.onRuntimeInitialized?.(),Fn())}i.setStatus?(i.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>i.setStatus(""),1),t()},1)):t()}function fc(){if(i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.shift()()}return fc(),ki(),n=m,n}})();class rn{constructor(e){if(e instanceof URL){if(e.protocol!=="http:"&&e.protocol!=="https:")throw new N("Only http/https protocol is supported");this.locateFile=()=>e.href}else e instanceof WebAssembly.Module?this.instantiateWasm=(n,i)=>{const l=new WebAssembly.Instance(e,n);i(l)}:this.wasmBinary=e}wasmBinary;instantiateWasm;locateFile}class _{loader;api;constructor(){this.loader=(e,n)=>new Promise((i,l)=>{if(this.api!==void 0){i();return}const d=new rn(e);tn(d).then(m=>{try{this.writeConfigurationFiles(m,n),Xt(m,"MAGICK_CONFIGURE_PATH",v=>{Xt(m,"/xml",C=>{m._Environment_SetEnv(v,C),this.api=m,i()})})}catch(v){l(v)}})})}async _initialize(e,n){await this.loader(e,n)}static get _api(){if(!Pt.api)throw new N("`await initializeImageMagick` should be called to initialize the library");return Pt.api}static set _api(e){Pt.api=e}static read(e,n,i,l){return te._create(d=>{let m=l;if(typeof e!="string"&&!$t(e))typeof n=="number"&&typeof i=="number"&&d.read(e,n,i);else if(typeof n!="number"&&typeof i!="number"){m=i;let v;n instanceof ke?v=n:typeof n=="string"?(v=new ke,v.format=n):m=n,d.read(e,v)}return m(d)})}static readCollection(e,n,i){return Me.create()._use(d=>{let m=i,v;return n instanceof ke?v=n:typeof n=="string"?(v=new ke,v.format=n):m=n,d.read(e,v),m(d)})}static readFromCanvas(e,n,i){return te._create(l=>(l.readFromCanvas(e,i),n(l)))}writeConfigurationFiles(e,n){e.FS.analyzePath("/xml").exists||e.FS.mkdir("/xml");for(const l of n.all()){const d=e.FS.open(`/xml/${l.fileName}`,"w"),m=new TextEncoder().encode(l.data);e.FS.write(d,m,0,m.length),e.FS.close(d)}}}const Pt=new _;async function nn(M,e){await Pt._initialize(M,e??ft.default)}class Hi{constructor(e,n,i){this.origin=e,this.progress=new ee((n+1)/(i*100))}origin;progress;cancel=!1}class se{static _logDelegate=0;static _onLog;static _progressDelegate=0;static _images={};static setLogDelegate(e){se._logDelegate===0&&e!==void 0&&(se._logDelegate=_._api.addFunction(se.logDelegate,"vii")),_._api._Magick_SetLogDelegate(e===void 0?0:se._logDelegate),se._onLog=e}static setProgressDelegate(e){se._progressDelegate===0&&(this._progressDelegate=_._api.addFunction(se.progressDelegate,"iijji")),this._images[e._instance]=e,_._api._MagickImage_SetClientData(e._instance,e._instance),_._api._MagickImage_SetProgressDelegate(e._instance,se._progressDelegate)}static removeProgressDelegate(e){_._api._MagickImage_SetClientData(e._instance,0),_._api._MagickImage_SetProgressDelegate(e._instance,0),delete se._images[e._instance]}static logDelegate(e,n){if(se._onLog===void 0)return;const i=le(n,"");se._onLog(new Ii(e,i))}static progressDelegate(e,n,i,l){const d=se._images[l];if(d===void 0||d.onProgress===void 0)return 1;const m=Number(n),v=Number(i),C=le(e),F=new Hi(C,m,v);return d.onProgress(F),F.cancel?0:1}}class De{static _allFormats;constructor(e,n,i,l,d){this.format=e,this.description=n,this.supportsMultipleFrames=i,this.supportsReading=l,this.supportsWriting=d}description;format;supportsMultipleFrames;supportsReading;supportsWriting;static get all(){return De._allFormats===void 0&&(De._allFormats=De.loadFormats()),De._allFormats}static loadFormats(){return A.usePointer(e=>Ie.use(n=>{const i=_._api._MagickFormatInfo_CreateList(n.ptr,e),l=n.value;try{const d=new Array(l),m=Object.values(Pe);for(let v=0;v<l;v++){const C=_._api._MagickFormatInfo_GetInfo(i,v,e),F=le(_._api._MagickFormatInfo_Format_Get(C)),z=De.convertFormat(F,m),V=le(_._api._MagickFormatInfo_Description_Get(C),""),be=_._api._MagickFormatInfo_SupportsMultipleFrames_Get(C)==1,je=_._api._MagickFormatInfo_SupportsReading_Get(C)==1,Be=_._api._MagickFormatInfo_SupportsWriting_Get(C)==1;d[v]=new De(z,V,be,je,Be)}return d}finally{_._api._MagickFormatInfo_DisposeList(i,l)}}))}static convertFormat(e,n){return e===null?Pe.Unknown:n.includes(e)?e:Pe.Unknown}}const K={None:0,Accelerate:1,Annotate:2,Blob:4,Cache:8,Coder:16,Configure:32,Deprecate:64,Draw:128,Exception:256,Image:512,Locale:1024,Module:2048,Pixel:4096,Policy:8192,Resource:16384,Trace:32768,Transform:65536,User:131072,Wand:262144,Detailed:2147450879,get All(){return this.Detailed|this.Trace}};class we{static get delegates(){return le(_._api._Magick_Delegates_Get(),"Unknown")}static get features(){return le(_._api._Magick_Features_Get()," ").slice(0,-1)}static get imageMagickVersion(){return le(_._api._Magick_ImageMagickVersion_Get(),"Unknown")}static get supportedFormats(){return De.all}static onLog;static addFont(e,n){const i=_._api.FS;i.analyzePath("/fonts").exists||i.mkdir("/fonts");const d=i.open(`/fonts/${e}`,"w");i.write(d,n,0,n.length),i.close(d)}static resetRandomSeed=()=>_._api._Magick_ResetRandomSeed();static setRandomSeed=e=>_._api._Magick_SetRandomSeed(e);static setLogEvents(e){const n=e==K.None?void 0:we.logDelegate;se.setLogDelegate(n);const i=we.getEventTypeString(e);R(i,l=>_._api._Magick_SetLogEvents(l))}static _getFontFileName(e){const n=`/fonts/${e}`;if(!_._api.FS.analyzePath(n).exists)throw`Unable to find a font with the name '${e}', register it with the addFont method of the Magick class.`;return n}static getEventTypeString(e){if(e==K.All)return"All,Trace";if(e==K.Detailed)return"All";switch(e){case K.Accelerate:return"Accelerate";case K.Annotate:return"Annotate";case K.Blob:return"Blob";case K.Cache:return"Cache";case K.Coder:return"Coder";case K.Configure:return"Configure";case K.Deprecate:return"Deprecate";case K.Draw:return"Draw";case K.Exception:return"Exception";case K.Image:return"Image";case K.Locale:return"Locale";case K.Module:return"Module";case K.Pixel:return"Pixel";case K.Policy:return"Policy";case K.Resource:return"Resource";case K.Trace:return"Trace";case K.Transform:return"Transform";case K.User:return"User";case K.Wand:return"Wand";case K.None:default:return"None"}}static logDelegate(e){we.onLog!==void 0&&we.onLog(e)}}class Ui{_font;constructor(e){this._font=e}draw(e){const n=we._getFontFileName(this._font);e.font(n)}}class ji{_gravity;constructor(e){this._gravity=e}draw(e){e.gravity(this._gravity)}}class Yi{_startX;_startY;_endX;_endY;constructor(e,n,i,l){this._startX=e,this._startY=n,this._endX=i,this._endY=l}draw(e){e.line(this._startX,this._startY,this._endX,this._endY)}}class Vi{_x;_y;constructor(e,n){this._x=e,this._y=n}draw(e){e.point(this._x,this._y)}}class Xi{_upperLeftX;_upperLeftY;_lowerRightX;_lowerRightY;constructor(e,n,i,l){this._upperLeftX=e,this._upperLeftY=n,this._lowerRightX=i,this._lowerRightY=l}draw(e){e.rectangle(this._upperLeftX,this._upperLeftY,this._lowerRightX,this._lowerRightY)}}class qi{_upperLeftX;_upperLeftY;_lowerRightX;_lowerRightY;_cornerWidth;_cornerHeight;constructor(e,n,i,l,d,m){this._upperLeftX=e,this._upperLeftY=n,this._lowerRightX=i,this._lowerRightY=l,this._cornerWidth=d,this._cornerHeight=m}draw(e){e.roundRectangle(this._upperLeftX,this._upperLeftY,this._lowerRightX,this._lowerRightY,this._cornerWidth,this._cornerHeight)}}class Ki{_color;constructor(e){this._color=e}draw(e){e.strokeColor(this._color)}}class Qi{_width;constructor(e){this._width=e}draw(e){e.strokeWidth(this._width)}}class Ji{_alignment;constructor(e){this._alignment=e}draw(e){e.textAlignment(this._alignment)}}class Oe{_isEnabled;constructor(e){this._isEnabled=e}static get disabled(){return new Oe(!1)}static get enabled(){return new Oe(!0)}draw(e){e.textAntialias(this._isEnabled)}}class Oi{_decoration;constructor(e){this._decoration=e}draw(e){e.textDecoration(this._decoration)}}class Zi{_spacing;constructor(e){this._spacing=e}draw(e){e.textInterlineSpacing(this._spacing)}}class er{_spacing;constructor(e){this._spacing=e}draw(e){e.textInterwordspacing(this._spacing)}}class tr{_kerning;constructor(e){this._kerning=e}draw(e){e.textKerning(this._kerning)}}class ir{_color;constructor(e){this._color=e}draw(e){e.textUnderColor(this._color)}}class rr{_x;_y;_value;constructor(e,n,i){this._x=e,this._y=n,this._value=i}draw(e){e.text(this._x,this._y,this._value)}}class nr{static get None(){return new k(0,0,0,0)}static get Transparent(){return new k(0,0,0,0)}static get AliceBlue(){return new k(240,248,255,255)}static get AntiqueWhite(){return new k(250,235,215,255)}static get Aqua(){return new k(0,255,255,255)}static get Aquamarine(){return new k(127,255,212,255)}static get Azure(){return new k(240,255,255,255)}static get Beige(){return new k(245,245,220,255)}static get Bisque(){return new k(255,228,196,255)}static get Black(){return new k(0,0,0,255)}static get BlanchedAlmond(){return new k(255,235,205,255)}static get Blue(){return new k(0,0,255,255)}static get BlueViolet(){return new k(138,43,226,255)}static get Brown(){return new k(165,42,42,255)}static get BurlyWood(){return new k(222,184,135,255)}static get CadetBlue(){return new k(95,158,160,255)}static get Chartreuse(){return new k(127,255,0,255)}static get Chocolate(){return new k(210,105,30,255)}static get Coral(){return new k(255,127,80,255)}static get CornflowerBlue(){return new k(100,149,237,255)}static get Cornsilk(){return new k(255,248,220,255)}static get Crimson(){return new k(220,20,60,255)}static get Cyan(){return new k(0,255,255,255)}static get DarkBlue(){return new k(0,0,139,255)}static get DarkCyan(){return new k(0,139,139,255)}static get DarkGoldenrod(){return new k(184,134,11,255)}static get DarkGray(){return new k(169,169,169,255)}static get DarkGreen(){return new k(0,100,0,255)}static get DarkKhaki(){return new k(189,183,107,255)}static get DarkMagenta(){return new k(139,0,139,255)}static get DarkOliveGreen(){return new k(85,107,47,255)}static get DarkOrange(){return new k(255,140,0,255)}static get DarkOrchid(){return new k(153,50,204,255)}static get DarkRed(){return new k(139,0,0,255)}static get DarkSalmon(){return new k(233,150,122,255)}static get DarkSeaGreen(){return new k(143,188,143,255)}static get DarkSlateBlue(){return new k(72,61,139,255)}static get DarkSlateGray(){return new k(47,79,79,255)}static get DarkTurquoise(){return new k(0,206,209,255)}static get DarkViolet(){return new k(148,0,211,255)}static get DeepPink(){return new k(255,20,147,255)}static get DeepSkyBlue(){return new k(0,191,255,255)}static get DimGray(){return new k(105,105,105,255)}static get DodgerBlue(){return new k(30,144,255,255)}static get Firebrick(){return new k(178,34,34,255)}static get FloralWhite(){return new k(255,250,240,255)}static get ForestGreen(){return new k(34,139,34,255)}static get Fuchsia(){return new k(255,0,255,255)}static get Gainsboro(){return new k(220,220,220,255)}static get GhostWhite(){return new k(248,248,255,255)}static get Gold(){return new k(255,215,0,255)}static get Goldenrod(){return new k(218,165,32,255)}static get Gray(){return new k(128,128,128,255)}static get Green(){return new k(0,128,0,255)}static get GreenYellow(){return new k(173,255,47,255)}static get Honeydew(){return new k(240,255,240,255)}static get HotPink(){return new k(255,105,180,255)}static get IndianRed(){return new k(205,92,92,255)}static get Indigo(){return new k(75,0,130,255)}static get Ivory(){return new k(255,255,240,255)}static get Khaki(){return new k(240,230,140,255)}static get Lavender(){return new k(230,230,250,255)}static get LavenderBlush(){return new k(255,240,245,255)}static get LawnGreen(){return new k(124,252,0,255)}static get LemonChiffon(){return new k(255,250,205,255)}static get LightBlue(){return new k(173,216,230,255)}static get LightCoral(){return new k(240,128,128,255)}static get LightCyan(){return new k(224,255,255,255)}static get LightGoldenrodYellow(){return new k(250,250,210,255)}static get LightGreen(){return new k(144,238,144,255)}static get LightGray(){return new k(211,211,211,255)}static get LightPink(){return new k(255,182,193,255)}static get LightSalmon(){return new k(255,160,122,255)}static get LightSeaGreen(){return new k(32,178,170,255)}static get LightSkyBlue(){return new k(135,206,250,255)}static get LightSlateGray(){return new k(119,136,153,255)}static get LightSteelBlue(){return new k(176,196,222,255)}static get LightYellow(){return new k(255,255,224,255)}static get Lime(){return new k(0,255,0,255)}static get LimeGreen(){return new k(50,205,50,255)}static get Linen(){return new k(250,240,230,255)}static get Magenta(){return new k(255,0,255,255)}static get Maroon(){return new k(128,0,0,255)}static get MediumAquamarine(){return new k(102,205,170,255)}static get MediumBlue(){return new k(0,0,205,255)}static get MediumOrchid(){return new k(186,85,211,255)}static get MediumPurple(){return new k(147,112,219,255)}static get MediumSeaGreen(){return new k(60,179,113,255)}static get MediumSlateBlue(){return new k(123,104,238,255)}static get MediumSpringGreen(){return new k(0,250,154,255)}static get MediumTurquoise(){return new k(72,209,204,255)}static get MediumVioletRed(){return new k(199,21,133,255)}static get MidnightBlue(){return new k(25,25,112,255)}static get MintCream(){return new k(245,255,250,255)}static get MistyRose(){return new k(255,228,225,255)}static get Moccasin(){return new k(255,228,181,255)}static get NavajoWhite(){return new k(255,222,173,255)}static get Navy(){return new k(0,0,128,255)}static get OldLace(){return new k(253,245,230,255)}static get Olive(){return new k(128,128,0,255)}static get OliveDrab(){return new k(107,142,35,255)}static get Orange(){return new k(255,165,0,255)}static get OrangeRed(){return new k(255,69,0,255)}static get Orchid(){return new k(218,112,214,255)}static get PaleGoldenrod(){return new k(238,232,170,255)}static get PaleGreen(){return new k(152,251,152,255)}static get PaleTurquoise(){return new k(175,238,238,255)}static get PaleVioletRed(){return new k(219,112,147,255)}static get PapayaWhip(){return new k(255,239,213,255)}static get PeachPuff(){return new k(255,218,185,255)}static get Peru(){return new k(205,133,63,255)}static get Pink(){return new k(255,192,203,255)}static get Plum(){return new k(221,160,221,255)}static get PowderBlue(){return new k(176,224,230,255)}static get Purple(){return new k(128,0,128,255)}static get RebeccaPurple(){return new k(102,51,153,255)}static get Red(){return new k(255,0,0,255)}static get RosyBrown(){return new k(188,143,143,255)}static get RoyalBlue(){return new k(65,105,225,255)}static get SaddleBrown(){return new k(139,69,19,255)}static get Salmon(){return new k(250,128,114,255)}static get SandyBrown(){return new k(244,164,96,255)}static get SeaGreen(){return new k(46,139,87,255)}static get SeaShell(){return new k(255,245,238,255)}static get Sienna(){return new k(160,82,45,255)}static get Silver(){return new k(192,192,192,255)}static get SkyBlue(){return new k(135,206,235,255)}static get SlateBlue(){return new k(106,90,205,255)}static get SlateGray(){return new k(112,128,144,255)}static get Snow(){return new k(255,250,250,255)}static get SpringGreen(){return new k(0,255,127,255)}static get SteelBlue(){return new k(70,130,180,255)}static get Tan(){return new k(210,180,140,255)}static get Teal(){return new k(0,128,128,255)}static get Thistle(){return new k(216,191,216,255)}static get Tomato(){return new k(255,99,71,255)}static get Turquoise(){return new k(64,224,208,255)}static get Violet(){return new k(238,130,238,255)}static get Wheat(){return new k(245,222,179,255)}static get White(){return new k(255,255,255,255)}static get WhiteSmoke(){return new k(245,245,245,255)}static get Yellow(){return new k(255,255,0,255)}static get YellowGreen(){return new k(154,205,50,255)}}class an{_drawables=[];disableStrokeAntialias(){return this._drawables.push(Oe.disabled),this}enableStrokeAntialias(){return this._drawables.push(Oe.enabled),this}fillColor(e){return this._drawables.push(new yi(e)),this}fillOpacity(e){return this._drawables.push(new Si(e)),this}font(e){return this._drawables.push(new Ui(e)),this}fontPointSize(e){return this._drawables.push(new Ci(e)),this}fontTypeMetrics(e,n=!1){return te._create(i=>(i.read(nr.Transparent,1,1),st._use(i,l=>(l.draw(this._drawables),l.fontTypeMetrics(e,n)))))}gravity(e){return this._drawables.push(new ji(e)),this}line(e,n,i,l){return this._drawables.push(new Yi(e,n,i,l)),this}point(e,n){return this._drawables.push(new Vi(e,n)),this}rectangle(e,n,i,l){return this._drawables.push(new Xi(e,n,i,l)),this}roundRectangle(e,n,i,l,d,m){return this._drawables.push(new qi(e,n,i,l,d,m)),this}strokeColor(e){return this._drawables.push(new Ki(e)),this}strokeWidth(e){return this._drawables.push(new Qi(e)),this}text(e,n,i){return this._drawables.push(new rr(e,n,i)),this}textAlignment(e){return this._drawables.push(new Ji(e)),this}textDecoration(e){return this._drawables.push(new Oi(e)),this}textInterlineSpacing(e){return this._drawables.push(new Zi(e)),this}textInterwordSpacing(e){return this._drawables.push(new er(e)),this}textKerning(e){return this._drawables.push(new tr(e)),this}textUnderColor(e){return this._drawables.push(new ir(e)),this}draw(e){return e.draw(this._drawables),this}}const sn={Undefined:0,Kapur:1,OTSU:2,Triangle:3},on={Undefined:0,Direct:1,Pseudo:2},cn={Undefined:0,Bilevel:1,Grayscale:2,GrayscaleAlpha:3,Palette:4,PaletteAlpha:5,TrueColor:6,TrueColorAlpha:7,ColorSeparation:8,ColorSeparationAlpha:9,Optimize:10,PaletteBilevelAlpha:11},_n={Undefined:0,Add:1,Conjugate:2,Divide:3,MagnitudePhase:4,Multiply:5,RealImaginary:6,Subtract:7},ar={Undefined:0,B44A:1,B44:2,BZip:3,DXT1:4,DXT3:5,DXT5:6,Fax:7,Group4:8,JBIG1:9,JBIG2:10,JPEG2000:11,JPEG:12,LosslessJPEG:13,LZMA:14,LZW:15,NoCompression:16,Piz:17,Pxr24:18,RLE:19,Zip:20,ZipS:21,Zstd:22,WebP:23,DWAA:24,DWAB:25,BC7:26,BC5:27},ln={Undefined:0,Affine:1,AffineProjection:2,ScaleRotateTranslate:3,Perspective:4,PerspectiveProjection:5,BilinearForward:6,BilinearReverse:7,Polynomial:8,Arc:9,Polar:10,DePolar:11,Cylinder2Plane:12,Plane2Cylinder:13,Barrel:14,BarrelInverse:15,Shepards:16,Resize:17,Sentinel:18,RigidAffine:19},un={Undefined:0,LSB:1,MSB:2},gn={Undefined:0,Absolute:1,Fuzz:2,MeanAbsolute:3,MeanErrorPerPixel:4,MeanSquared:5,NormalizedCrossCorrelation:6,PeakAbsolute:7,PeakSignalToNoiseRatio:8,PerceptualHash:9,RootMeanSquared:10,StructuralSimilarity:11,StructuralDissimilarity:12},hn={Undefined:0,Abs:1,Add:2,AddModulus:3,And:4,Cosine:5,Divide:6,Exponential:7,GaussianNoise:8,ImpulseNoise:9,LaplacianNoise:10,LeftShift:11,Log:12,Max:13,Mean:14,Median:15,Min:16,MultiplicativeNoise:17,Multiply:18,Or:19,PoissonNoise:20,Pow:21,RightShift:22,RootMeanSquare:23,Set:24,Sine:25,Subtract:26,Sum:27,ThresholdBlack:28,Threshold:29,ThresholdWhite:30,UniformNoise:31,Xor:32,InverseLog:33},dn={Undefined:0,Point:1,Box:2,Triangle:3,Hermite:4,Hann:5,Hamming:6,Blackman:7,Gaussian:8,Quadratic:9,Cubic:10,Catrom:11,Mitchell:12,Jinc:13,Sinc:14,SincFast:15,Kaiser:16,Welch:17,Parzen:18,Bohman:19,Bartlett:20,Lagrange:21,Lanczos:22,LanczosSharp:23,Lanczos2:24,Lanczos2Sharp:25,Robidoux:26,RobidouxSharp:27,Cosine:28,Spline:29,LanczosRadius:30,CubicSpline:31},fn={Undefined:0,None:1,Background:2,Previous:3},sr={Undefined:0,NoInterlace:1,Line:2,Plane:3,Partition:4,Gif:5,Jpeg:6,Png:7},mn={Undefined:"Undefined",Unity:"Unity",Gaussian:"Gaussian",DoG:"DoG",LoG:"LoG",Blur:"Blur",Comet:"Comet",Binomial:"Binomial",Laplacian:"Laplacian",Sobel:"Sobel",FreiChen:"FreiChen",Roberts:"Roberts",Prewitt:"Prewitt",Compass:"Compass",Kirsch:"Kirsch",Diamond:"Diamond",Square:"Square",Rectangle:"Rectangle",Octagon:"Octagon",Disk:"Disk",Plus:"Plus",Cross:"Cross",Ring:"Ring",Peaks:"Peaks",Edges:"Edges",Corners:"Corners",Diagonals:"Diagonals",LineEnds:"LineEnds",LineJunctions:"LineJunctions",Ridges:"Ridges",ConvexHull:"ConvexHull",ThinSE:"ThinSE",Skeleton:"Skeleton",Chebyshev:"Chebyshev",Manhattan:"Manhattan",Octagonal:"Octagonal",Euclidean:"Euclidean",UserDefined:"UserDefined"},pn={Undefined:0,Convolve:1,Correlate:2,Erode:3,Dilate:4,ErodeIntensity:5,DilateIntensity:6,IterativeDistance:7,Open:8,Close:9,OpenIntensity:10,CloseIntensity:11,Smooth:12,EdgeIn:13,EdgeOut:14,Edge:15,TopHat:16,BottomHat:17,HitAndMiss:18,Thinning:19,Thicken:20,Distance:21,Voronoi:22},vn={Undefined:0,Uniform:1,Gaussian:2,MultiplicativeGaussian:3,Impulse:4,Laplacian:5,Poisson:6,Random:7},or={Undefined:0,TopLeft:1,TopRight:2,BottomRight:3,BottomLeft:4,LeftTop:5,RightTop:6,RightBottom:7,LeftBottom:8},kn={Undefined:0,Point:1,Replace:2,Floodfill:3,FillToBorder:4,Reset:5},Mn={Undefined:0,Average:1,Average9:2,Average16:3,Background:4,Bilinear:5,Blend:6,Catrom:7,Integer:8,Mesh:9,Nearest:10,Spline:11},wn={Undefined:0,Saturation:1,Perceptual:2,Absolute:3,Relative:4},yn={Undefined:0,Left:1,Center:2,Right:3},Sn={Undefined:0,None:1,Underline:2,Overline:3,LineThrough:4},Cn={Undefined:0,Background:1,Dither:2,Edge:3,Mirror:4,Random:5,Tile:6,Transparent:7,Mask:8,Black:9,Gray:10,White:11,HorizontalTile:12,VerticalTile:13,HorizontalTileEdge:14,VerticalTileEdge:15,CheckerTile:16};var cr=(M=>(M[M.Disabled=-1]="Disabled",M[M.Linear=0]="Linear",M[M.Vng=1]="Vng",M[M.Ppg=2]="Ppg",M[M.Ahd=3]="Ahd",M[M.DCB=4]="DCB",M[M.Dht=11]="Dht",M[M.ModifiedAhd=12]="ModifiedAhd",M))(cr||{}),_r=(M=>(M[M.Raw=0]="Raw",M[M.SRGB=1]="SRGB",M[M.AdobeRGB=2]="AdobeRGB",M[M.WideGamutRGB=3]="WideGamutRGB",M[M.KodakProPhotoRGB=4]="KodakProPhotoRGB",M[M.XYZ=5]="XYZ",M[M.ACES=6]="ACES",M))(_r||{});class In extends wi{constructor(){super(Pe.Dng)}disableAutoBrightness;interpolationQuality;outputColor;useAutoWhitebalance;useCameraWhitebalance;getDefines(){const e=[];return this.hasValue(this.interpolationQuality)&&e.push(this.createDefine("interpolation-quality",this.interpolationQuality)),this.hasValue(this.disableAutoBrightness)&&e.push(this.createDefine("no-auto-bright",this.disableAutoBrightness)),this.hasValue(this.outputColor)&&e.push(this.createDefine("output-color",this.outputColor)),this.hasValue(this.useCameraWhitebalance)&&e.push(this.createDefine("use-camera-wb",this.useCameraWhitebalance)),this.hasValue(this.useAutoWhitebalance)&&e.push(this.createDefine("use-auto-wb",this.useAutoWhitebalance)),e}}class Jt{_colorSpace=b.Undefined;_compression=ar.Undefined;_density=new $e(0,0);_format=Pe.Unknown;_height=0;_interlace=sr.Undefined;_orientation=or.Undefined;_quality=0;_width=0;get colorSpace(){return this._colorSpace}get compression(){return this._compression}get density(){return this._density}get format(){return this._format}get height(){return this._height}get interlace(){return this._interlace}get orientation(){return this._orientation}get quality(){return this._quality}get width(){return this._width}constructor(){}read(e,n){te._create(i=>{i.ping(e,n),this._colorSpace=i.colorSpace,this._compression=i.compression,this._density=i.density,this._format=i.format,this._height=i.height,this._interlace=i.interlace,this._orientation=i.orientation,this._quality=i.quality,this._width=i.width})}static create(e,n){const i=new Jt;return i.read(e,n),i}}class Pn{constructor(e){this.complexOperator=e}complexOperator;signalToNoiseRatio;_setArtifacts(e){this.signalToNoiseRatio!==void 0&&e.setArtifact("complex:snr",this.signalToNoiseRatio)}}class En{constructor(e){this.method=e}method;bestFit=!1;scale;viewport;_setArtifacts(e){this.scale!==void 0&&e.setArtifact("distort:scale",this.scale.toString()),this.viewport!==void 0&&e.setArtifact("distort:viewport",this.viewport.toString())}}class Dn extends Le{constructor(e){const n=_._api._MontageSettings_Create(),i=_._api._MontageSettings_Dispose;if(super(n,i),e.backgroundColor!==void 0&&e.backgroundColor._use(l=>{_._api._MontageSettings_SetBackgroundColor(this._instance,l)}),e.borderColor!==void 0&&e.borderColor._use(l=>{_._api._MontageSettings_SetBorderColor(this._instance,l)}),e.borderWidth!==void 0&&_._api._MontageSettings_SetBorderWidth(this._instance,e.borderWidth),e.fillColor!==void 0&&e.fillColor._use(l=>{_._api._MontageSettings_SetFillColor(this._instance,l)}),e.font!==void 0){const l=we._getFontFileName(e.font);R(l,d=>{_._api._MontageSettings_SetFont(this._instance,d)})}e.fontPointsize!==void 0&&_._api._MontageSettings_SetFontPointsize(this._instance,e.fontPointsize),e.frameGeometry!==void 0&&R(e.frameGeometry.toString(),l=>{_._api._MontageSettings_SetFrameGeometry(this._instance,l)}),e.geometry!==void 0&&R(e.geometry.toString(),l=>{_._api._MontageSettings_SetGeometry(this._instance,l)}),e.gravity!==void 0&&_._api._MontageSettings_SetGravity(this._instance,e.gravity),e.shadow!==void 0&&_._api._MontageSettings_SetShadow(this._instance,e.shadow?1:0),e.strokeColor!==void 0&&e.strokeColor._use(l=>{_._api._MontageSettings_SetStrokeColor(this._instance,l)}),e.textureFileName!==void 0&&R(e.textureFileName,l=>{_._api._MontageSettings_SetTextureFileName(this._instance,l)}),e.tileGeometry!==void 0&&R(e.tileGeometry.toString(),l=>{_._api._MontageSettings_SetTileGeometry(this._instance,l)}),e.title!==void 0&&R(e.title,l=>{_._api._MontageSettings_SetTitle(this._instance,l)})}}class bn{backgroundColor;borderColor;borderWidth;fillColor;font;fontPointsize;frameGeometry;geometry;gravity;label;shadow;strokeColor;textureFileName;tileGeometry;title;transparentColor;_use(e){const n=new Dn(this);return _e._disposeAfterExecution(n,e)}}class Tn{constructor(e,n,i){this.method=e,this.kernel=n,i!==void 0&&(this.kernel+=`:${i}`)}channels=X.Composite;convolveBias;convolveScale;iterations=1;kernel;method}class An{constructor(e,n=0){this.minimum=e,this.maximum=n}minimum;maximum;toString(){return this.maximum===0?this.minimum.toString():`${this.minimum}-${this.maximum}`}}S.AlphaAction=Pi,S.AutoThresholdMethod=sn,S.ChannelPerceptualHash=He,S.ChannelStatistics=$i,S.Channels=X,S.ChromaticityInfo=Ei,S.ClassType=on,S.ColorProfile=Di,S.ColorSpace=b,S.ColorSpaceNames=Ut,S.ColorTransformMode=Vt,S.ColorType=cn,S.CompareResult=pt,S.CompareSettings=bi,S.ComplexOperator=_n,S.ComplexSettings=Pn,S.CompositeOperator=vt,S.CompressionMethod=ar,S.ConfigurationFile=Ht,S.ConfigurationFiles=ft,S.ConnectedComponent=Mt,S.ConnectedComponentsSettings=Ti,S.DefinesCreator=wi,S.Density=$e,S.DensityUnit=xe,S.DistortMethod=ln,S.DistortSettings=En,S.DitherMethod=Kt,S.DngInterpolation=cr,S.DngOutputColor=_r,S.DngReadDefines=In,S.DrawableColor=Xr,S.DrawableFillColor=yi,S.DrawableFillOpacity=Si,S.DrawableFont=Ui,S.DrawableFontPointSize=Ci,S.DrawableGravity=ji,S.DrawableLine=Yi,S.DrawablePoint=Vi,S.DrawableRectangle=Xi,S.DrawableRoundRectangle=qi,S.DrawableStrokeColor=Ki,S.DrawableStrokeWidth=Qi,S.DrawableText=rr,S.DrawableTextAlignment=Ji,S.DrawableTextAntialias=Oe,S.DrawableTextDecoration=Oi,S.DrawableTextInterlineSpacing=Zi,S.DrawableTextInterwordSpacing=er,S.DrawableTextKerning=tr,S.DrawableTextUnderColor=ir,S.Drawables=an,S.DrawingWand=st,S.Endian=un,S.ErrorMetric=gn,S.EvaluateOperator=hn,S.FilterType=dn,S.GifDisposeMethod=fn,S.Gravity=ue,S.ImageMagick=_,S.ImageProfile=Yt,S.Interlace=sr,S.Kernel=mn,S.LogEvent=Ii,S.LogEventTypes=K,S.Magick=we,S.MagickColor=k,S.MagickColors=nr,S.MagickDefine=mt,S.MagickError=N,S.MagickErrorInfo=ot,S.MagickErrorSeverity=kt,S.MagickFormat=Pe,S.MagickFormatInfo=De,S.MagickGeometry=ne,S.MagickImage=te,S.MagickImageCollection=Me,S.MagickImageInfo=Jt,S.MagickReadSettings=ke,S.MagickSettings=Je,S.MontageSettings=bn,S.MorphologyMethod=pn,S.MorphologySettings=Tn,S.NativeInstance=Le,S.NoiseType=vn,S.OffsetInfo=Bi,S.Orientation=or,S.PaintMethod=kn,S.Percentage=ee,S.PerceptualHash=fe,S.PixelChannel=L,S.PixelCollection=Ue,S.PixelIntensityMethod=zi,S.PixelInterpolateMethod=Mn,S.Point=ve,S.PrimaryInfo=We,S.ProgressEvent=Hi,S.QuantizeSettings=Ct,S.Quantum=Fe,S.RenderingIntent=wn,S.Statistics=It,S.TextAlignment=yn,S.TextDecoration=Sn,S.Threshold=An,S.TypeMetric=yt,S.VirtualPixelMethod=Cn,S.WarningEvent=Qt,S._getEdges=Gi,S._isByteArray=$t,S.initializeImageMagick=nn,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});
42
+ `}};class pt{constructor(){this.log=new Yt("log.xml",Mi.XmlResourceFiles.log),this.policy=new Yt("policy.xml",Mi.XmlResourceFiles.policy)}static default=new pt;*all(){yield this.log,yield this.policy}log;policy}class mt{constructor(e,n,t){this.format=e,this.name=n,this.value=t}format;name;value}class yi{format;constructor(e){this.format=e}createDefine(e,n){return typeof n=="boolean"?new mt(this.format,e,n?"true":"false"):typeof n=="string"?new mt(this.format,e,n):new mt(this.format,e,n.toString())}hasValue(e){return e!=null}}class ue{_scaleX;_scaleY;_shearX;_shearY;_translateX;_translateY;constructor(e=1,n=1,t=0,_=0,g=0,p=0){this._scaleX=e,this._scaleY=n,this._shearX=t,this._shearY=_,this._translateX=g,this._translateY=p}get scaleX(){return this._scaleX}get scaleY(){return this._scaleY}get shearX(){return this._shearX}get shearY(){return this._shearY}get translateX(){return this._translateX}get translateY(){return this._translateY}draw(e){e.affine(this._scaleX,this._scaleY,this._shearX,this._shearY,this._translateX,this._translateY)}reset(){this._scaleX=1,this._scaleY=1,this._shearX=0,this._shearY=0,this._translateX=0,this._translateY=0}transformOrigin(e,n){const t=new ue;t._translateX=e,t._translateY=n,this.transform(t)}transformRotation(e){const n=new ue;n._scaleX=Math.cos(ue.normalizeAngleToRadians(e)),n._scaleY=Math.cos(ue.normalizeAngleToRadians(e)),n._shearX=-Math.sin(ue.normalizeAngleToRadians(e)),n._shearY=Math.sin(ue.normalizeAngleToRadians(e)),this.transform(n)}transformScale(e,n){const t=new ue;t._scaleX=e,t._scaleY=n,this.transform(t)}transformSkewX(e){const n=new ue;n._shearX=Math.tan(ue.normalizeAngleToRadians(e)),this.transform(n)}transformSkewY(e){const n=new ue;n._shearY=Math.tan(ue.normalizeAngleToRadians(e)),this.transform(n)}static normalizeAngleToRadians(e){const t=e/360;let _=Math.round(t);return Math.abs(t-_)===.5&&_%2!==0&&(_=t>0?_-1:_+1),Math.PI*(e-_*360)/180}transform(e){const n=this._scaleX,t=this._scaleY,_=this._shearX,g=this._shearY,p=this._translateX,m=this._translateY;this._scaleX=n*e._scaleX+g*e._shearX,this._scaleY=_*e._shearY+t*e._scaleY,this._shearX=_*e._scaleX+t*e._shearX,this._shearY=n*e._shearY+g*e._scaleY,this._translateX=n*e._translateX+g*e._translateY+p,this._translateY=_*e._translateX+t*e._translateY+m}}class Si{_color;constructor(e){this._color=e}get color(){return this._color}draw(e){e.borderColor(this._color)}}class Ci{_x;_y;_paintMethod;constructor(e,n,t){this._x=e,this._y=n,this._paintMethod=t}get x(){return this._x}get y(){return this._y}get paintMethod(){return this._paintMethod}draw(e){e.color(this._x,this._y,this._paintMethod)}}class Ii{_color;constructor(e){this._color=e}get color(){return this._color}draw(e){e.fillColor(this._color)}}class Pi{_opacity;constructor(e){this._opacity=e}get opacity(){return this._opacity}draw(e){e.fillOpacity(this._opacity.toDouble()/100)}}class Di{_fillRule;constructor(e){this._fillRule=e}get fillRule(){return this._fillRule}draw(e){e.fillRule(this._fillRule)}}class Ei{_pointSize;constructor(e){this._pointSize=e}get pointSize(){return this._pointSize}draw(e){e.fontPointSize(this._pointSize)}}class bi{constructor(e,n){this.eventType=e,this.message=n??""}eventType;message}const Ti={Undefined:0,Activate:1,Associate:2,Background:3,Copy:4,Deactivate:5,Discrete:6,Disassociate:7,Extract:8,Off:9,On:10,Opaque:11,Remove:12,Set:13,Shape:14,Transparent:15,OffIfOpaque:16},x={Red:0,Cyan:0,Gray:0,Green:1,Magenta:1,Blue:2,Yellow:2,Black:3,Alpha:4,Index:5,Meta0:10,Meta1:11,Meta2:12,Meta3:13,Meta4:14,Meta5:15,Meta6:16,Meta7:17,Meta8:18,Meta9:19,Meta10:20,Meta11:21,Meta12:22,Meta13:23,Meta14:24,Meta15:25,Meta16:26,Meta17:27,Meta18:28,Meta19:29,Meta20:30,Meta21:31,Meta22:32,Meta23:33,Meta24:34,Meta25:35,Meta26:36,Meta27:37,Meta28:38,Meta29:39,Meta30:40,Meta31:41,Meta32:42,Meta33:43,Meta34:44,Meta35:45,Meta36:46,Meta37:47,Meta38:48,Meta39:49,Meta40:50,Meta41:51,Meta42:52,Meta43:53,Meta44:54,Meta45:55,Meta46:56,Meta47:57,Meta48:58,Meta49:59,Meta50:60,Meta51:61,Meta52:62,Composite:64},j={Undefined:0,Red:1,Gray:1,Cyan:1,Green:2,Magenta:2,Blue:4,Yellow:4,Black:8,Alpha:16,Opacity:16,Index:32,Composite:31,TrueAlpha:256,get RGB(){return this.Red|this.Green|this.Blue},get CMYK(){return this.Cyan|this.Magenta|this.Yellow|this.Black},get CMYKA(){return this.Cyan|this.Magenta|this.Yellow|this.Black|this.Alpha},Meta0:1<<x.Meta0,Meta1:1<<x.Meta1,Meta2:1<<x.Meta2,Meta3:1<<x.Meta3,Meta4:1<<x.Meta4,Meta5:1<<x.Meta5,Meta6:1<<x.Meta6,Meta7:1<<x.Meta7,Meta8:1<<x.Meta8,Meta9:1<<x.Meta9,Meta10:1<<x.Meta10,Meta11:1<<x.Meta11,Meta12:1<<x.Meta12,Meta13:1<<x.Meta13,Meta14:1<<x.Meta14,Meta15:1<<x.Meta15,Meta16:1<<x.Meta16,Meta17:1<<x.Meta17,Meta18:1<<x.Meta18,Meta19:1<<x.Meta19,Meta20:1<<x.Meta20,Meta21:1<<x.Meta21,All:134217727};class Ai{constructor(e,n,t,_){this.red=e,this.green=n,this.blue=t,this.white=_}red;green;blue;white}const T={Undefined:0,CMY:1,CMYK:2,Gray:3,HCL:4,HCLp:5,HSB:6,HSI:7,HSL:8,HSV:9,HWB:10,Lab:11,LCH:12,LCHab:13,LCHuv:14,Log:15,LMS:16,Luv:17,OHTA:18,Rec601YCbCr:19,Rec709YCbCr:20,RGB:21,scRGB:22,sRGB:23,Transparent:24,XyY:25,XYZ:26,YCbCr:27,YCC:28,YDbDr:29,YIQ:30,YPbPr:31,YUV:32,LinearGray:33,Jzazbz:34,DisplayP3:35,Adobe98:36,ProPhoto:37,Oklab:38,Oklch:39,CAT02LMSC:40},Ut={[T.Undefined]:"Undefined",[T.CMY]:"CMY",[T.CMYK]:"CMYK",[T.Gray]:"Gray",[T.HCL]:"HCL",[T.HCLp]:"HCLp",[T.HSB]:"HSB",[T.HSI]:"HSI",[T.HSL]:"HSL",[T.HSV]:"HSV",[T.HWB]:"HWB",[T.Lab]:"Lab",[T.LCH]:"LCH",[T.LCHab]:"LCHab",[T.LCHuv]:"LCHuv",[T.Log]:"Log",[T.LMS]:"LMS",[T.Luv]:"Luv",[T.OHTA]:"OHTA",[T.Rec601YCbCr]:"Rec601YCbCr",[T.Rec709YCbCr]:"Rec709YCbCr",[T.RGB]:"RGB",[T.scRGB]:"scRGB",[T.sRGB]:"sRGB",[T.Transparent]:"Transparent",[T.XyY]:"XyY",[T.XYZ]:"XYZ",[T.YCbCr]:"YCbCr",[T.YCC]:"YCC",[T.YDbDr]:"YDbDr",[T.YIQ]:"YIQ",[T.YPbPr]:"YPbPr",[T.YUV]:"YUV",[T.LinearGray]:"LinearGray",[T.Jzazbz]:"Jzazbz",[T.DisplayP3]:"DisplayP3",[T.Adobe98]:"Adobe98",[T.ProPhoto]:"ProPhoto",[T.Oklab]:"Oklab",[T.Oklch]:"Oklch",[T.CAT02LMSC]:"CAT02LMS"};class _n{colorSpace=T.Undefined;copyright=null;description=null;manufacturer=null;model=null}class cn{_data;_index;constructor(e){this._data=e,this._index=0,this.isLittleEndian=!1}get index(){return this._index}isLittleEndian;readLong(){return this.canRead(4)?this.isLittleEndian?this.readLongLSB():this.readLongMSB():null}readString(e){if(e==0)return"";if(!this.canRead(e))return null;let t=new TextDecoder("utf-8").decode(this._data.subarray(this._index,this._index+e));const _=t.indexOf("\0");return _!=-1&&(t=t.substring(0,_)),this._index+=e,t}seek(e){return e>=this._data.length?!1:(this._index=e,!0)}skip(e){return this._index+e>=this._data.length?!1:(this._index+=e,!0)}canRead(e){return e>this._data.length?!1:this._index+e<=this._data.length}readLongLSB(){let e=this._data[this._index];return e|=this._data[this._index+1]<<8,e|=this._data[this._index+2]<<16,e|=this._data[this._index+3]<<24,this._index+=4,e}readLongMSB(){let e=this._data[this._index]<<24;return e|=this._data[this._index+1]<<16,e|=this._data[this._index+2]<<8,e|=this._data[this._index+3],this._index+=4,e}}class Xt{_data=new _n;_reader;constructor(e){this._reader=new cn(e)}static read(e){const n=new Xt(e);return n.readColorSpace(),n.readTagTable(),n._data}readColorSpace(){this._reader.seek(16);const e=this._reader.readString(4);e!=null&&(this._data.colorSpace=this.determineColorSpace(e.trimEnd()))}determineColorSpace(e){switch(e){case"CMY":return T.CMY;case"CMYK":return T.CMYK;case"GRAY":return T.Gray;case"HSL":return T.HSL;case"HSV":return T.HSV;case"Lab":return T.Lab;case"Luv":return T.Luv;case"RGB":return T.sRGB;case"XYZ":return T.XYZ;case"YCbr":return T.YCbCr;default:return T.Undefined}}readTagTable(){if(!this._reader.seek(128))return;const e=this._reader.readLong();if(e!=null)for(let n=0;n<e;n++)switch(this._reader.readLong()){case 1668313716:this._data.copyright=this.readTag();break;case 1684370275:this._data.description=this.readTag();break;case 1684893284:this._data.manufacturer=this.readTag();break;case 1684890724:this._data.model=this.readTag();break;default:this._reader.skip(8);break}}readTag(){const e=this._reader.readLong(),n=this._reader.readLong();if(e===null||n===null)return null;const t=this._reader.index;if(!this._reader.seek(e))return null;const _=this.readTagValue(n);return this._reader.seek(t),_}readTagValue(e){switch(this._reader.readString(4)){case"desc":return this.readTextDescriptionTypeValue();case"text":return this.readTextTypeValue(e);default:return null}}readTextDescriptionTypeValue(){if(!this._reader.skip(4))return null;const e=this._reader.readLong();return e==null?null:this._reader.readString(e)}readTextTypeValue(e){return this._reader.skip(4)?this._reader.readString(e):null}}class jt{constructor(e,n){this.name=e,this.data=n}name;data}class Ri extends jt{_data;constructor(e){super("icc",e)}get colorSpace(){return this.initialize(),this._data.colorSpace}get copyright(){return this.initialize(),this._data.copyright}get description(){return this.initialize(),this._data.description}get manufacturer(){return this.initialize(),this._data.manufacturer}get model(){return this.initialize(),this._data.model}initialize(){this._data||(this._data=Xt.read(this.data))}}const Vt={HighRes:0,Quantum:1};class vt{constructor(e,n){this.distortion=e,this.difference=n}difference;distortion;static _create(e,n){return new vt(e,n)}}class Gi{constructor(e){this.metric=e}metric;highlightColor;lowlightColor;masklightColor;_setArtifacts(e){this.highlightColor!==void 0&&e.setArtifact("compare:highlight-color",this.highlightColor),this.lowlightColor!==void 0&&e.setArtifact("compare:lowlight-color",this.lowlightColor),this.masklightColor!==void 0&&e.setArtifact("compare:masklight-color",this.masklightColor)}}const wt={Undefined:0,Alpha:1,Atop:2,Blend:3,Blur:4,Bumpmap:5,ChangeMask:6,Clear:7,ColorBurn:8,ColorDodge:9,Colorize:10,CopyBlack:11,CopyBlue:12,Copy:13,CopyCyan:14,CopyGreen:15,CopyMagenta:16,CopyAlpha:17,CopyRed:18,CopyYellow:19,Darken:20,DarkenIntensity:21,Difference:22,Displace:23,Dissolve:24,Distort:25,DivideDst:26,DivideSrc:27,DstAtop:28,Dst:29,DstIn:30,DstOut:31,DstOver:32,Exclusion:33,HardLight:34,HardMix:35,Hue:36,In:37,Intensity:38,Lighten:39,LightenIntensity:40,LinearBurn:41,LinearDodge:42,LinearLight:43,Luminize:44,Mathematics:45,MinusDst:46,MinusSrc:47,Modulate:48,ModulusAdd:49,ModulusSubtract:50,Multiply:51,No:52,Out:53,Over:54,Overlay:55,PegtopLight:56,PinLight:57,Plus:58,Replace:59,Saturate:60,Screen:61,SoftLight:62,SrcAtop:63,Src:64,SrcIn:65,SrcOut:66,SrcOver:67,Threshold:68,VividLight:69,Xor:70,Stereo:71,Freeze:72,Interpolate:73,Negate:74,Reflect:75,SoftBurn:76,SoftDodge:77,Stamp:78,RMSE:79,SaliencyBlend:80,SeamlessBlend:81},kt={Warning:300,ResourceLimitWarning:300,TypeWarning:305,OptionWarning:310,DelegateWarning:315,MissingDelegateWarning:320,CorruptImageWarning:325,FileOpenWarning:330,BlobWarning:335,StreamWarning:340,CacheWarning:345,CoderWarning:350,FilterWarning:352,ModuleWarning:355,DrawWarning:360,ImageWarning:365,WandWarning:370,RandomWarning:375,XServerWarning:380,MonitorWarning:385,RegistryWarning:390,ConfigureWarning:395,PolicyWarning:399,Error:400,ResourceLimitError:400,TypeError:405,OptionError:410,DelegateError:415,MissingDelegateError:420,CorruptImageError:425,FileOpenError:430,BlobError:435,StreamError:440,CacheError:445,CoderError:450,FilterError:452,ModuleError:455,DrawError:460,ImageError:465,WandError:470,RandomError:475,XServerError:480,MonitorError:485,RegistryError:490,ConfigureError:495,PolicyError:499};class N extends Error{_relatedErrors=[];constructor(e,n=kt.Error){super(e),this.severity=n}severity;get relatedErrors(){return this._relatedErrors}_setRelatedErrors(e){this._relatedErrors=e}}class De{static get depth(){return l._api._Quantum_Depth_Get()}static get max(){return l._api._Quantum_Max_Get()}}function _e(k,e){return k===0?e??null:l._api.UTF8ToString(k)}function ln(k,e){const n=_e(e);return k._MagickMemory_Relinquish(e),n}function qt(k,e,n){const t=k.lengthBytesUTF8(e)+1,_=k._malloc(t);try{return k.stringToUTF8(e,_,t),n(_)}finally{k._free(_)}}function R(k,e){return k===null?e(0):qt(l._api,k,e)}class w{constructor(e,n,t,_,g){if(e!==void 0)if(typeof e=="string"){let p=0;try{p=l._api._MagickColor_Create(),R(e,m=>{if(l._api._MagickColor_Initialize(p,m)===0)throw new N("invalid color specified");this.initialize(p)})}finally{l._api._free(p)}}else this.r=e,this.g=n??0,this.b=t??0,g===void 0?this.a=_??De.max:(this.k=_??0,this.a=g,this.isCmyk=!0)}r=0;g=0;b=0;a=0;k=0;isCmyk=!1;static _create(e){const n=new w;return n.initialize(e),n}toShortString(){return this.a!==De.max?this.toString():this.isCmyk?`cmyka(${this.r},${this.g},${this.b},${this.k})`:`#${this.toHex(this.r)}${this.toHex(this.g)}${this.toHex(this.b)}`}toString(){return this.isCmyk?`cmyka(${this.r},${this.g},${this.b},${this.k},${(this.a/De.max).toFixed(4)})`:`#${this.toHex(this.r)}${this.toHex(this.g)}${this.toHex(this.b)}${this.toHex(this.a)}`}_use(e){let n=0;try{n=l._api._MagickColor_Create(),l._api._MagickColor_Red_Set(n,this.r),l._api._MagickColor_Green_Set(n,this.g),l._api._MagickColor_Blue_Set(n,this.b),l._api._MagickColor_Alpha_Set(n,this.a),this.isCmyk?(l._api._MagickColor_Black_Set(n,this.k),l._api._MagickColor_IsCMYK_Set(n,1)):l._api._MagickColor_IsCMYK_Set(n,0),e(n)}finally{l._api._MagickColor_Dispose(n)}}initialize(e){this.r=l._api._MagickColor_Red_Get(e),this.g=l._api._MagickColor_Green_Get(e),this.b=l._api._MagickColor_Blue_Get(e),this.a=l._api._MagickColor_Alpha_Get(e),this.isCmyk=l._api._MagickColor_IsCMYK_Get(e)===1,this.isCmyk&&(this.k=l._api._MagickColor_Black_Get(e))}toHex(e){return e.toString(16).padStart(2,"0")}}var Ee=(k=>(k[k.NoValue=0]="NoValue",k[k.PercentValue=4096]="PercentValue",k[k.IgnoreAspectRatio=8192]="IgnoreAspectRatio",k[k.Less=16384]="Less",k[k.Greater=32768]="Greater",k[k.FillArea=65536]="FillArea",k[k.LimitPixels=131072]="LimitPixels",k[k.AspectRatio=1048576]="AspectRatio",k))(Ee||{});class ae{_includeXyInToString;_width=0;_height=0;_x=0;_y=0;_aspectRatio=!1;_fillArea=!1;_greater=!1;_isPercentage=!1;_ignoreAspectRatio=!1;_less=!1;_limitPixels=!1;constructor(e,n,t,_){if(typeof e=="number"){if(t!==void 0&&_!==void 0?(this._width=t,this._height=_,this._x=e,this._y=n??0,this._includeXyInToString=!0):(this._width=e,this._height=n??this._width,this._x=0,this._y=0,this._includeXyInToString=!1),this._width<0)throw new N("negative width is not allowed");if(this._height<0)throw new N("negative height is not allowed")}else{this._includeXyInToString=e.indexOf("+")>=0||e.indexOf("-")>=0;const g=l._api._MagickGeometry_Create();try{R(e,p=>{const m=l._api._MagickGeometry_Initialize(g,p);if(m===Ee.NoValue)throw new N("invalid geometry specified");this.hasFlag(m,Ee.AspectRatio)?this.initializeFromAspectRation(g,e):this.initialize(g,m)})}finally{l._api._MagickGeometry_Dispose(g)}}}get aspectRatio(){return this._aspectRatio}get fillArea(){return this._fillArea}set fillArea(e){this._fillArea=e}get greater(){return this._greater}set greater(e){this._greater=e}get height(){return this._height}set height(e){this._height=e}get ignoreAspectRatio(){return this._ignoreAspectRatio}set ignoreAspectRatio(e){this._ignoreAspectRatio=e}get isPercentage(){return this._isPercentage}set isPercentage(e){this._isPercentage=e}get less(){return this._less}set less(e){this._less=e}get limitPixels(){return this._limitPixels}set limitPixels(e){this._limitPixels=e}get width(){return this._width}set width(e){this._width=e}get x(){return this._x}set x(e){this._x=e}get y(){return this._y}set y(e){this._y=e}toString(){if(this._aspectRatio)return this._width+":"+this._height;let e="";return this._width==0&&this._height==0?e+="0x0":(this._width>0&&(e+=this._width.toString()),this._height>0?e+="x"+this._height.toString():e+="x"),(this._x!=0||this._y!=0||this._includeXyInToString)&&(this._x>=0&&(e+="+"),e+=this._x,this.y>=0&&(e+="+"),e+=this.y),this._fillArea&&(e+="^"),this._greater&&(e+=">"),this._isPercentage&&(e+="%"),this._ignoreAspectRatio&&(e+="!"),this._less&&(e+="<"),this._limitPixels&&(e+="@"),e}static _fromRectangle(e){if(e===0)throw new N("unable to allocate memory");try{const n=l._api._MagickRectangle_Width_Get(e),t=l._api._MagickRectangle_Height_Get(e),_=l._api._MagickRectangle_X_Get(e),g=l._api._MagickRectangle_Y_Get(e);return new ae(_,g,n,t)}finally{l._api._MagickRectangle_Dispose(e)}}_toRectangle(e){const n=l._api._MagickRectangle_Create();if(n===0)throw new N("unable to allocate memory");try{return l._api._MagickRectangle_Width_Set(n,this._width),l._api._MagickRectangle_Height_Set(n,this._height),l._api._MagickRectangle_X_Set(n,this._x),l._api._MagickRectangle_Y_Set(n,this._y),e(n)}finally{l._api._MagickRectangle_Dispose(n)}}initialize(e,n){this._width=l._api._MagickGeometry_Width_Get(e),this._height=l._api._MagickGeometry_Height_Get(e),this._x=l._api._MagickGeometry_X_Get(e),this._y=l._api._MagickGeometry_Y_Get(e),this._ignoreAspectRatio=this.hasFlag(n,Ee.IgnoreAspectRatio),this._isPercentage=this.hasFlag(n,Ee.PercentValue),this._fillArea=this.hasFlag(n,Ee.FillArea),this._greater=this.hasFlag(n,Ee.Greater),this._less=this.hasFlag(n,Ee.Less),this._limitPixels=this.hasFlag(n,Ee.LimitPixels)}initializeFromAspectRation(e,n){this._aspectRatio=!0;const t=n.split(":");this._width=this.parseNumber(t[0]),this._height=this.parseNumber(t[1]),this._x=l._api._MagickGeometry_X_Get(e),this._y=l._api._MagickGeometry_Y_Get(e)}parseNumber(e){let n=0;for(;n<e.length&&!this.isNumber(e[n]);)n++;const t=n;for(;n<e.length&&this.isNumber(e[n]);)n++;return parseInt(e.substr(t,n-t))}isNumber(e){return e>="0"&&e<="9"}hasFlag(e,n){return(e&n)===n}}class ke{constructor(e,n){this.x=e,this.y=n??e}x;y;static _create(e){return e===0?new ke(0,0):new ke(l._api._PointInfo_X_Get(e),l._api._PointInfo_Y_Get(e))}}class Mt{constructor(e){this.area=l._api._ConnectedComponent_GetArea(e),this.centroid=ke._create(l._api._ConnectedComponent_GetCentroid(e)),this.color=w._create(l._api._ConnectedComponent_GetColor(e)),this.height=l._api._ConnectedComponent_GetHeight(e),this.id=l._api._ConnectedComponent_GetId(e),this.width=l._api._ConnectedComponent_GetWidth(e),this.x=l._api._ConnectedComponent_GetX(e),this.y=l._api._ConnectedComponent_GetY(e)}area;centroid;color;height;id;width;x;y;static _create(e,n){const t=[];if(e===0)return t;for(let _=0;_<n;_++){const g=l._api._ConnectedComponent_GetInstance(e,_);g===0||l._api._ConnectedComponent_GetArea(g)<Number.EPSILON||t.push(new Mt(g))}return t}toGeometry(){return new ae(this.x,this.y,this.width,this.height)}}class Fi{angleThreshold;areaThreshold;circularityThreshold;connectivity;diameterThreshold;eccentricityThreshold;majorAxisThreshold;meanColor;minorAxisThreshold;perimeterThreshold;constructor(e){this.connectivity=e}_setArtifacts(e){this.angleThreshold!==void 0&&e.setArtifact("connected-components:angle-threshold",this.angleThreshold.toString()),this.areaThreshold!==void 0&&e.setArtifact("connected-components:area-threshold",this.areaThreshold.toString()),this.circularityThreshold!==void 0&&e.setArtifact("connected-components:circularity-threshold",this.circularityThreshold.toString()),this.diameterThreshold!==void 0&&e.setArtifact("connected-components:diameter-threshold",this.diameterThreshold.toString()),this.eccentricityThreshold!==void 0&&e.setArtifact("connected-components:eccentricity-threshold",this.eccentricityThreshold.toString()),this.majorAxisThreshold!==void 0&&e.setArtifact("connected-components:major-axis-threshold",this.majorAxisThreshold.toString()),this.meanColor!==void 0&&e.setArtifact("connected-components:mean-color",this.meanColor.toString()),this.minorAxisThreshold!==void 0&&e.setArtifact("connected-components:minor-axis-threshold",this.minorAxisThreshold.toString()),this.perimeterThreshold!==void 0&&e.setArtifact("connected-components:perimeter-threshold",this.perimeterThreshold.toString())}}const Le={Undefined:0,PixelsPerInch:1,PixelsPerCentimeter:2};class He{constructor(e,n,t){n===void 0?(this.x=e,this.y=e,this.units=Le.PixelsPerInch):t!==void 0?(this.x=e,this.y=n,this.units=t):(this.x=e,this.y=e,this.units=n)}x;y;units;toString(e){return e==this.units||e===Le.Undefined||e===void 0?He.toString(this.x,this.y,e??Le.Undefined):this.units==Le.PixelsPerCentimeter&&e==Le.PixelsPerInch?He.toString(this.x*2.54,this.y*2.54,e):He.toString(this.x/2.54,this.y/2.54,e)}static toString(e,n,t){let _=`${e}x${n}`;switch(t){case Le.PixelsPerCentimeter:_+="cm";break;case Le.PixelsPerInch:_+="inch";break}return _}}class he{static _disposeAfterExecution(e,n){try{const t=n(e);return t instanceof Promise?Promise.resolve(t).then(_=>(e.dispose(),he.checkResult(e,_),_)):(e.dispose(),he.checkResult(e,t),t)}catch(t){throw e.dispose(),t}}static checkResult(e,n){if(n===e)throw new N("The result of the function cannot be the instance that has been disposed.");return n}}class xi{_pointer;_bytes;_func;constructor(e,n,t){this._pointer=e,this._func=t,this._bytes=l._api.HEAPU8.subarray(e,e+n)}func(e){return e._bytes===void 0?e._func(new Uint8Array):e._func(e._bytes)}dispose(){this._pointer=l._api._MagickMemory_Relinquish(this._pointer)}}class Li{instance;type;constructor(e,n){this.instance=l._api._malloc(e),this.type=n,l._api.setValue(this.instance,0,this.type)}get ptr(){return this.instance}get value(){return l._api.getValue(this.instance,this.type)}}class be extends Li{constructor(){super(4,"i32")}static use(e){const n=new be;try{return e(n)}finally{l._api._free(n.ptr)}}}class b{pointer;constructor(e){this.pointer=e}get ptr(){return this.pointer.ptr}check(e,n){return this.isError()?n():e()}static usePointer(e,n){return be.use(t=>{const _=e(t.ptr);return b.checkException(t,_,n)})}static use(e,n){return be.use(t=>{const _=e(new b(t));return b.checkException(t,_,n)})}static checkException(e,n,t){if(!b.isRaised(e))return n;const _=b.getErrorSeverity(e.value);if(_>=kt.Error)b.throw(e,_);else if(t!==void 0){const g=b.createError(e.value,_);t(g)}else b.dispose(e);return n}isError(){return b.isRaised(this.pointer)?b.getErrorSeverity(this.pointer.value)>=kt.Error:!1}static getErrorSeverity(e){return l._api._MagickExceptionHelper_Severity(e)}static isRaised(e){return e.value!==0}static throw(e,n){const t=b.createError(e.value,n);throw b.dispose(e),t}static createError(e,n){const t=b.getMessage(e),_=new N(t,n),g=l._api._MagickExceptionHelper_RelatedCount(e);if(g===0)return _;const p=[];for(let m=0;m<g;m++){const C=l._api._MagickExceptionHelper_Related(e,m),G=b.getErrorSeverity(C),Y=b.createError(C,G);p.push(Y)}return _._setRelatedErrors(p),_}static getMessage(e){const n=l._api._MagickExceptionHelper_Message(e),t=l._api._MagickExceptionHelper_Description(e);let _=_e(n,"Unknown error");return t!==0&&(_+=`(${l._api.UTF8ToString(t)})`),_}static dispose(e){l._api._MagickExceptionHelper_Dispose(e.value)}}class We{disposeMethod;instance;constructor(e,n){this.instance=e,this.disposeMethod=n}get _instance(){if(this.instance>0)return this.instance;throw this.instance===-1&&this._instanceNotInitialized(),new N("instance is disposed")}set _instance(e){this.disposeInstance(this.instance),this.instance=e}dispose(){this.instance=this.disposeInstance(this.instance)}_instanceNotInitialized(){throw new N("instance is not initialized")}_setInstance(e,n){return n.check(()=>this.instance===0?!1:(this.dispose(),this.instance=e,!0),()=>(this.disposeInstance(e),!0))}disposeInstance(e){return e>0&&(this.onDispose!==void 0&&this.onDispose(),this.disposeMethod(e)),0}}class yt{constructor(e,n,t,_,g,p,m){this.ascent=e,this.descent=n,this.maxHorizontalAdvance=t,this.textHeight=_,this.textWidth=g,this.underlinePosition=p,this.underlineThickness=m}ascent;descent;maxHorizontalAdvance;textHeight;textWidth;underlinePosition;underlineThickness;static _create(e){if(e==0)return null;try{const n=l._api._TypeMetric_Ascent_Get(e),t=l._api._TypeMetric_Descent_Get(e),_=l._api._TypeMetric_MaxHorizontalAdvance_Get(e),g=l._api._TypeMetric_TextHeight_Get(e),p=l._api._TypeMetric_TextWidth_Get(e),m=l._api._TypeMetric_UnderlinePosition_Get(e),C=l._api._TypeMetric_UnderlineThickness_Get(e);return new yt(n,t,_,g,p,m,C)}finally{l._api._TypeMetric_Dispose(e)}}}function Wi(k,e){if(k.byteLength===0)throw new N("The specified array cannot be empty");let n=0;try{return n=l._api._malloc(k.byteLength),l._api.HEAPU8.set(k,n),e(n)}finally{n!==0&&l._api._free(n)}}function St(k,e){if(k.length===0)throw new N("The specified array cannot be empty");const n=k.length*8;let t=0;try{t=l._api._malloc(n);const _=new ArrayBuffer(n),g=new Float64Array(_);for(let p=0;p<k.length;p++)g[p]=k[p];return l._api.HEAPU8.set(new Int8Array(_),t),e(t)}finally{t!==0&&l._api._free(t)}}function un(k,e){if(k.byteLength===0)throw new N("The specified array cannot be empty");let n=0;try{return n=l._api._malloc(k.byteLength),l._api.HEAPU8.set(k,n),e(n)}finally{n!==0&&l._api._free(n)}}class _t extends We{constructor(e){const n=e.settings._drawing._use(_=>l._api._DrawingWand_Create(e._instance,_._instance)),t=l._api._DrawingWand_Dispose;super(n,t)}affine(e,n,t,_,g,p){b.usePointer(m=>{l._api._DrawingWand_Affine(this._instance,e,n,t,_,g,p,m)})}borderColor(e){b.usePointer(n=>{e._use(t=>{l._api._DrawingWand_BorderColor(this._instance,t,n)})})}color(e,n,t){b.usePointer(_=>{l._api._DrawingWand_Color(this._instance,e,n,t,_)})}draw(e){e.forEach(n=>{n.draw(this)}),b.usePointer(n=>{l._api._DrawingWand_Render(this._instance,n)})}fillColor(e){b.usePointer(n=>{e._use(t=>{l._api._DrawingWand_FillColor(this._instance,t,n)})})}fillOpacity(e){b.usePointer(n=>{l._api._DrawingWand_FillOpacity(this._instance,e,n)})}fillRule(e){b.usePointer(n=>{l._api._DrawingWand_FillRule(this._instance,e,n)})}font(e){b.usePointer(n=>{R(e,t=>{l._api._DrawingWand_Font(this._instance,t,n)})})}fontPointSize(e){b.usePointer(n=>{l._api._DrawingWand_FontPointSize(this._instance,e,n)})}fontTypeMetrics(e,n){return b.usePointer(t=>R(e,_=>{const g=l._api._DrawingWand_FontTypeMetrics(this._instance,_,n?1:0,t);return yt._create(g)}))}gravity(e){b.usePointer(n=>{l._api._DrawingWand_Gravity(this._instance,e,n)})}line(e,n,t,_){b.usePointer(g=>{l._api._DrawingWand_Line(this._instance,e,n,t,_,g)})}pathFinish(){b.usePointer(e=>{l._api._DrawingWand_PathFinish(this._instance,e)})}pathLineToAbs(e,n){b.usePointer(t=>{l._api._DrawingWand_PathLineToAbs(this._instance,e,n,t)})}pathLineToRel(e,n){b.usePointer(t=>{l._api._DrawingWand_PathLineToRel(this._instance,e,n,t)})}pathMoveToAbs(e,n){b.usePointer(t=>{l._api._DrawingWand_PathMoveToAbs(this._instance,e,n,t)})}pathMoveToRel(e,n){b.usePointer(t=>{l._api._DrawingWand_PathMoveToRel(this._instance,e,n,t)})}pathStart(){b.usePointer(e=>{l._api._DrawingWand_PathStart(this._instance,e)})}point(e,n){b.usePointer(t=>{l._api._DrawingWand_Point(this._instance,e,n,t)})}rectangle(e,n,t,_){b.usePointer(g=>{l._api._DrawingWand_Rectangle(this._instance,e,n,t,_,g)})}roundRectangle(e,n,t,_,g,p){b.usePointer(m=>{l._api._DrawingWand_RoundRectangle(this._instance,e,n,t,_,g,p,m)})}strokeColor(e){b.usePointer(n=>{e._use(t=>{l._api._DrawingWand_StrokeColor(this._instance,t,n)})})}strokeDashArray(e){b.usePointer(n=>{St(e,t=>{l._api._DrawingWand_StrokeDashArray(this._instance,t,e.length,n)})})}strokeDashOffset(e){b.usePointer(n=>{l._api._DrawingWand_StrokeDashOffset(this._instance,e,n)})}strokeWidth(e){b.usePointer(n=>{l._api._DrawingWand_StrokeWidth(this._instance,e,n)})}text(e,n,t){b.usePointer(_=>{R(t,g=>{l._api._DrawingWand_Text(this._instance,e,n,g,_)})})}textAlignment(e){b.usePointer(n=>{l._api._DrawingWand_TextAlignment(this._instance,e,n)})}textAntialias(e){b.usePointer(n=>{l._api._DrawingWand_TextAntialias(this._instance,e?1:0,n)})}textDecoration(e){b.usePointer(n=>{l._api._DrawingWand_TextDecoration(this._instance,e,n)})}textInterlineSpacing(e){b.usePointer(n=>{l._api._DrawingWand_TextInterlineSpacing(this._instance,e,n)})}textInterwordspacing(e){b.usePointer(n=>{l._api._DrawingWand_TextInterwordSpacing(this._instance,e,n)})}textKerning(e){b.usePointer(n=>{l._api._DrawingWand_TextKerning(this._instance,e,n)})}textUnderColor(e){b.usePointer(n=>{e._use(t=>{l._api._DrawingWand_TextUnderColor(this._instance,t,n)})})}static _use(e,n){const t=new _t(e);return he._disposeAfterExecution(t,n)}}class Kt extends Li{constructor(){super(8,"double")}static use(e){const n=new Kt;try{return e(n)}finally{l._api._free(n.ptr)}}}const O={Undefined:0,Forget:0,Northwest:1,North:2,Northeast:3,West:4,Center:5,East:6,Southwest:7,South:8,Southeast:9};function*Bi(k){for(const e of k)switch(e){case O.North:yield"north";break;case O.Northeast:yield"north",yield"east";break;case O.Northwest:yield"north",yield"west";break;case O.East:yield"east";break;case O.West:yield"west";break;case O.South:yield"south";break;case O.Southeast:yield"south",yield"east";break;case O.Southwest:yield"south",yield"west"}}function Ni(k){switch(k){case O.North:return"north";case O.Northeast:return"northeast";case O.Northwest:return"northwest";case O.East:return"east";case O.West:return"west";case O.South:return"south";case O.Southeast:return"southeast";case O.Southwest:return"southwest";case O.Center:return"center";default:return}}class ct{constructor(e,n,t){this.meanErrorPerPixel=e,this.normalizedMeanError=n,this.normalizedMaximumError=t}meanErrorPerPixel;normalizedMaximumError;normalizedMeanError;static _create(e){const n=l._api._MagickImage_MeanErrorPerPixel_Get(e._instance),t=l._api._MagickImage_NormalizedMeanError_Get(e._instance),_=l._api._MagickImage_NormalizedMaximumError_Get(e._instance);return new ct(n,t,_)}}const Te={Unknown:"UNKNOWN",ThreeFr:"3FR",ThreeG2:"3G2",ThreeGp:"3GP",A:"A",Aai:"AAI",Ai:"AI",APng:"APNG",Art:"ART",Arw:"ARW",Ashlar:"ASHLAR",Avci:"AVCI",Avi:"AVI",Avif:"AVIF",Avs:"AVS",B:"B",Bayer:"BAYER",Bayera:"BAYERA",Bgr:"BGR",Bgra:"BGRA",Bgro:"BGRO",Bmp:"BMP",Bmp2:"BMP2",Bmp3:"BMP3",Brf:"BRF",C:"C",Cal:"CAL",Cals:"CALS",Canvas:"CANVAS",Caption:"CAPTION",Cin:"CIN",Cip:"CIP",Clip:"CLIP",Cmyk:"CMYK",Cmyka:"CMYKA",Cr2:"CR2",Cr3:"CR3",Crw:"CRW",Cube:"CUBE",Cur:"CUR",Cut:"CUT",Data:"DATA",Dcm:"DCM",Dcr:"DCR",Dcraw:"DCRAW",Dcx:"DCX",Dds:"DDS",Dfont:"DFONT",Dng:"DNG",Dpx:"DPX",Dxt1:"DXT1",Dxt5:"DXT5",Epdf:"EPDF",Epi:"EPI",Eps:"EPS",Eps2:"EPS2",Eps3:"EPS3",Epsf:"EPSF",Epsi:"EPSI",Ept:"EPT",Ept2:"EPT2",Ept3:"EPT3",Erf:"ERF",Exr:"EXR",Farbfeld:"FARBFELD",Fax:"FAX",Ff:"FF",Fff:"FFF",File:"FILE",Fits:"FITS",Fl32:"FL32",Flv:"FLV",Fractal:"FRACTAL",Ftp:"FTP",Fts:"FTS",Ftxt:"FTXT",G:"G",G3:"G3",G4:"G4",Gif:"GIF",Gif87:"GIF87",Gradient:"GRADIENT",Gray:"GRAY",Graya:"GRAYA",Group4:"GROUP4",Hald:"HALD",Hdr:"HDR",Heic:"HEIC",Heif:"HEIF",Histogram:"HISTOGRAM",Hrz:"HRZ",Htm:"HTM",Html:"HTML",Http:"HTTP",Https:"HTTPS",Icb:"ICB",Ico:"ICO",Icon:"ICON",Icn:"ICN",Iiq:"IIQ",Info:"INFO",Inline:"INLINE",Ipl:"IPL",Isobrl:"ISOBRL",Isobrl6:"ISOBRL6",J2c:"J2C",J2k:"J2K",Jng:"JNG",Jnx:"JNX",Jp2:"JP2",Jpc:"JPC",Jpe:"JPE",Jpeg:"JPEG",Jpg:"JPG",Jpm:"JPM",Jps:"JPS",Jpt:"JPT",Json:"JSON",Jxl:"JXL",K:"K",K25:"K25",Kdc:"KDC",Label:"LABEL",M:"M",M2v:"M2V",M4v:"M4V",Mac:"MAC",Map:"MAP",Mask:"MASK",Mat:"MAT",Matte:"MATTE",Mdc:"MDC",Mef:"MEF",Miff:"MIFF",Mkv:"MKV",Mng:"MNG",Mono:"MONO",Mov:"MOV",Mos:"MOS",Mp4:"MP4",Mpc:"MPC",Mpeg:"MPEG",Mpg:"MPG",Mpo:"MPO",Mrw:"MRW",Msl:"MSL",Msvg:"MSVG",Mtv:"MTV",Mvg:"MVG",Nef:"NEF",Nrw:"NRW",Null:"NULL",O:"O",Ora:"ORA",Orf:"ORF",Otb:"OTB",Otf:"OTF",Pal:"PAL",Palm:"PALM",Pam:"PAM",Pango:"PANGO",Pattern:"PATTERN",Pbm:"PBM",Pcd:"PCD",Pcds:"PCDS",Pcl:"PCL",Pct:"PCT",Pcx:"PCX",Pdb:"PDB",Pdf:"PDF",Pdfa:"PDFA",Pef:"PEF",Pes:"PES",Pfa:"PFA",Pfb:"PFB",Pfm:"PFM",Pgm:"PGM",Pgx:"PGX",Phm:"PHM",Picon:"PICON",Pict:"PICT",Pix:"PIX",Pjpeg:"PJPEG",Plasma:"PLASMA",Png:"PNG",Png00:"PNG00",Png24:"PNG24",Png32:"PNG32",Png48:"PNG48",Png64:"PNG64",Png8:"PNG8",Pnm:"PNM",Pocketmod:"POCKETMOD",Ppm:"PPM",Ps:"PS",Ps2:"PS2",Ps3:"PS3",Psb:"PSB",Psd:"PSD",Ptif:"PTIF",Pwp:"PWP",Qoi:"QOI",R:"R",RadialGradient:"RADIAL-GRADIENT",Raf:"RAF",Ras:"RAS",Raw:"RAW",Rgb:"RGB",Rgb565:"RGB565",Rgba:"RGBA",Rgbo:"RGBO",Rgf:"RGF",Rla:"RLA",Rle:"RLE",Rmf:"RMF",Rw2:"RW2",Rwl:"RWL",Scr:"SCR",Screenshot:"SCREENSHOT",Sct:"SCT",Sf3:"SF3",Sfw:"SFW",Sgi:"SGI",Shtml:"SHTML",Six:"SIX",Sixel:"SIXEL",SparseColor:"SPARSE-COLOR",Sr2:"SR2",Srf:"SRF",Srw:"SRW",Stegano:"STEGANO",Sti:"STI",StrImg:"STRIMG",Sun:"SUN",Svg:"SVG",Svgz:"SVGZ",Text:"TEXT",Tga:"TGA",Thumbnail:"THUMBNAIL",Tif:"TIF",Tiff:"TIFF",Tiff64:"TIFF64",Tile:"TILE",Tim:"TIM",Tm2:"TM2",Ttc:"TTC",Ttf:"TTF",Txt:"TXT",Ubrl:"UBRL",Ubrl6:"UBRL6",Uil:"UIL",Uyvy:"UYVY",Vda:"VDA",Vicar:"VICAR",Vid:"VID",Viff:"VIFF",Vips:"VIPS",Vst:"VST",WebM:"WEBM",WebP:"WEBP",Wbmp:"WBMP",Wmv:"WMV",Wpg:"WPG",X3f:"X3F",Xbm:"XBM",Xc:"XC",Xcf:"XCF",Xpm:"XPM",Xps:"XPS",Xv:"XV",Y:"Y",Yaml:"YAML",Ycbcr:"YCBCR",Ycbcra:"YCBCRA",Yuv:"YUV"},Ct={Merge:13,Flatten:14,Mosaic:15,Trimbounds:16};class hn extends We{constructor(e){const n=l._api._DrawingSettings_Create(),t=l._api._DrawingSettings_Dispose;super(n,t);const _=e.affine;if(_!==void 0&&l._api._DrawingSettings_SetAffine(this._instance,_.scaleX,_.scaleY,_.shearX,_.shearY,_.translateX,_.translateY),e.borderColor!==void 0&&e.borderColor._use(p=>{l._api._DrawingSettings_BorderColor_Set(this._instance,p)}),e.fillColor!==void 0&&e.fillColor._use(p=>{l._api._DrawingSettings_FillColor_Set(this._instance,p)}),e.fillRule!==void 0&&l._api._DrawingSettings_FillRule_Set(this._instance,e.fillRule),e.font!==void 0){const p=Se._getFontFileName(e.font);R(p,m=>{l._api._DrawingSettings_Font_Set(this._instance,m)})}e.fontPointsize!==void 0&&l._api._DrawingSettings_FontPointsize_Set(this._instance,e.fontPointsize),e.strokeColor!==void 0&&e.strokeColor._use(p=>{l._api._DrawingSettings_StrokeColor_Set(this._instance,p)});const g=e.strokeDashArray;g!==void 0&&St(g,p=>{l._api._DrawingSettings_SetStrokeDashArray(this._instance,p,g.length)}),e.strokeDashOffset!==void 0&&l._api._DrawingSettings_StrokeDashOffset_Set(this._instance,e.strokeDashOffset),e.strokeWidth!==void 0&&l._api._DrawingSettings_StrokeWidth_Set(this._instance,e.strokeWidth),e.textAntiAlias!==void 0&&l._api._DrawingSettings_TextAntiAlias_Set(this._instance,e.textAntiAlias?1:0),e.textGravity!==void 0&&l._api._DrawingSettings_TextGravity_Set(this._instance,e.textGravity),e.textKerning!==void 0&&l._api._DrawingSettings_TextKerning_Set(this._instance,e.textKerning),e.textUnderColor!==void 0&&e.textUnderColor._use(p=>{l._api._DrawingSettings_TextUnderColor_Set(this._instance,p)})}setFillColor(e){e!==void 0?e._use(n=>{l._api._DrawingSettings_FillColor_Set(this._instance,n)}):l._api._DrawingSettings_FillColor_Set(this._instance,0)}setFillPattern(e){b.usePointer(n=>{e!==void 0?l._api._DrawingSettings_SetFillPattern(this._instance,e._instance,n):l._api._DrawingSettings_SetFillPattern(this._instance,0,n)})}}class gn{affine;borderColor;backgroundColor;fillColor;fillRule;font;fontPointsize;strokeColor;strokeDashArray;strokeDashOffset;strokeWidth;textAntiAlias;textGravity;textKerning;textUnderColor;_use(e){const n=new hn(this);return he._disposeAfterExecution(n,e)}}const zi={Undefined:0,EvenOdd:1,NonZero:2};class $i extends We{constructor(e){const n=l._api._MagickSettings_Create(),t=l._api._MagickSettings_Dispose;if(super(n,t),e._colorFuzz!==void 0&&l._api._MagickSettings_SetColorFuzz(this._instance,e._colorFuzz),e._fileName!==void 0&&R(e._fileName,_=>{l._api._MagickSettings_SetFileName(this._instance,_)}),e._ping&&l._api._MagickSettings_SetPing(this._instance,1),e._quality!==void 0&&l._api._MagickSettings_SetQuality(this._instance,e._quality),e.antiAlias!==void 0&&l._api._MagickSettings_AntiAlias_Set(this._instance,e.antiAlias?1:0),e.backgroundColor!==void 0&&e.backgroundColor._use(_=>{l._api._MagickSettings_BackgroundColor_Set(this._instance,_)}),e.colorSpace!==void 0&&l._api._MagickSettings_ColorSpace_Set(this._instance,e.colorSpace),e.colorType!==void 0&&l._api._MagickSettings_ColorType_Set(this._instance,e.colorType),e.compression!==void 0&&l._api._MagickSettings_Compression_Set(this._instance,e.compression),e.debug!==void 0&&l._api._MagickSettings_Debug_Set(this._instance,e.debug?1:0),e.density!==void 0){const _=e.density.toString();R(_,g=>{l._api._MagickSettings_Density_Set(this._instance,g)})}if(e.depth!==void 0&&l._api._MagickSettings_Depth_Set(this._instance,e.depth),e.endian!==void 0&&l._api._MagickSettings_Endian_Set(this._instance,e.endian),e.fillColor!==void 0&&this.setOption("fill",e.fillColor.toString()),e.font!==void 0){const _=Se._getFontFileName(e.font);R(_,g=>{l._api._MagickSettings_SetFont(this._instance,g)})}e.fontPointsize!==void 0&&l._api._MagickSettings_FontPointsize_Set(this._instance,e.fontPointsize),e.format!==void 0&&R(e.format,_=>{l._api._MagickSettings_Format_Set(this._instance,_)}),e.interlace!==void 0&&l._api._MagickSettings_Interlace_Set(this._instance,e.interlace),e.page!==void 0&&R(e.page.toString(),_=>{l._api._MagickSettings_SetPage(this._instance,_)}),e.strokeColor!==void 0&&this.setOption("stroke",e.strokeColor.toString()),e.strokeWidth!==void 0&&this.setOption("strokeWidth",e.strokeWidth.toString()),e.textInterlineSpacing!==void 0&&this.setOption("interline-spacing",e.textInterlineSpacing.toString());for(const _ in e._options)this.setOption(_,e._options[_])}setOption(e,n){R(e,t=>{R(n,_=>{l._api._MagickSettings_SetOption(this._instance,t,_)})})}}class et{_colorFuzz;_drawing=new gn;_fileName;_onArtifact;_options={};_ping=!1;_quality;get affine(){return this._drawing.affine}set affine(e){this._drawing.affine=e}antiAlias;backgroundColor;get borderColor(){return this._drawing.borderColor}set borderColor(e){this._drawing.borderColor=e}colorSpace;colorType;compression;debug;density;depth;endian;get fillColor(){return this._drawing.fillColor}set fillColor(e){this.setDefineAndArtifact("fill",e?.toString()),this._drawing.fillColor=e}get fillRule(){return this._drawing.fillRule??zi.Undefined}set fillRule(e){this._drawing.fillRule=e}get font(){return this._drawing.font}set font(e){this._drawing.font=e}get fontPointsize(){return this._drawing.fontPointsize}set fontPointsize(e){this._drawing.fontPointsize=e}format;interlace;page;get strokeColor(){return this._drawing.strokeColor}set strokeColor(e){this._drawing.strokeColor=e}get strokeDashArray(){return this._drawing.strokeDashArray}set strokeDashArray(e){this._drawing.strokeDashArray=e}get strokeDashOffset(){return this._drawing.strokeDashOffset}set strokeDashOffset(e){this._drawing.strokeDashOffset=e}get strokeWidth(){return this._drawing.strokeWidth}set strokeWidth(e){this.setDefineAndArtifact("stroke",e?.toString()),this._drawing.strokeWidth=e}get textAntiAlias(){return this._drawing.textAntiAlias}set textAntiAlias(e){this._drawing.textAntiAlias=e}textInterlineSpacing;get textKerning(){return this._drawing.textKerning}set textKerning(e){this.setDefineAndArtifact("kerning",e?.toString()),this._drawing.textKerning=e}get textGravity(){return this._drawing.textGravity}set textGravity(e){this.setDefineAndArtifact("gravity",Ni(e)),this._drawing.textGravity=e}get textUnderColor(){return this._drawing.textUnderColor}set textUnderColor(e){this._drawing.textUnderColor=e}getDefine(e,n){return n!==void 0?this._options[`${e}:${n}`]??null:this._options[e]??null}removeDefine(e,n){if(n===void 0)delete this._options[e];else{const t=this.parseDefine(e,n);delete this._options[t]}}setDefine(e,n,t){if(t===void 0)this._options[e]=n;else{const _=this.parseDefine(e,n);typeof t=="string"?this._options[_]=t:typeof t=="number"?this._options[_]=t.toString():this._options[_]=t?"true":"false"}}setDefines(e){e.getDefines().forEach(n=>{n!==void 0&&this.setDefine(n.format,n.name,n.value)})}_clone(){const e=new et;return Object.assign(e,this),e}_use(e){const n=new $i(this);return he._disposeAfterExecution(n,e)}parseDefine(e,n){return e===Te.Unknown?n:`${e}:${n}`}setDefineAndArtifact(e,n){n===void 0?this.removeDefine(e):this.setDefine(e,n),this._onArtifact!==void 0&&this._onArtifact(e,n)}}class Me extends et{constructor(e){super(),Object.assign(this,e)}extractArea;frameIndex;frameCount;height;get syncImageWithExifProfile(){const e=this.getDefine("exif:sync-image");return e===null?!0:e.toLowerCase()==="true"}set syncImageWithExifProfile(e){this.setDefine("exif:sync-image",e.toString())}get syncImageWithTiffProperties(){const e=this.getDefine("tiff:sync-image");return e===null?!0:e.toLowerCase()==="true"}set syncImageWithTiffProperties(e){this.setDefine("tiff:sync-image",e.toString())}width;_use(e){const n=new $i(this),t=this.getSize();if(t!==""&&R(t,_=>{l._api._MagickSettings_SetSize(n._instance,_)}),this.frameIndex!==void 0||this.frameCount!==void 0){const _=this.frameIndex??0,g=this.frameCount??1;l._api._MagickSettings_SetScene(n._instance,_),l._api._MagickSettings_SetNumberScenes(n._instance,g);const p=this.frameCount!==void 0?`${_}-${_+g}`:_.toString();R(p.toString(),m=>{l._api._MagickSettings_SetScenes(n._instance,m)})}return this.extractArea!==void 0&&R(this.extractArea.toString(),_=>{l._api._MagickSettings_Extract_Set(n._instance,_)}),he._disposeAfterExecution(n,e)}getSize(){return this.width!==void 0&&this.height!==void 0?`${this.width}x${this.height}`:this.width!==void 0?`${this.width}x`:this.height!==void 0?`x${this.height}`:""}}const Qt={Undefined:0,No:1,Riemersma:2,FloydSteinberg:3};class dn extends We{constructor(e){const n=l._api._QuantizeSettings_Create(),t=l._api._QuantizeSettings_Dispose;super(n,t),l._api._QuantizeSettings_SetColors(this._instance,e.colors),l._api._QuantizeSettings_SetColorSpace(this._instance,e.colorSpace),l._api._QuantizeSettings_SetDitherMethod(this._instance,e.ditherMethod??Qt.No),l._api._QuantizeSettings_SetMeasureErrors(this._instance,e.measureErrors?1:0),l._api._QuantizeSettings_SetTreeDepth(this._instance,e.treeDepth)}}class It{constructor(){this.colors=256,this.colorSpace=T.Undefined,this.ditherMethod=Qt.Riemersma,this.measureErrors=!1,this.treeDepth=0}colors;colorSpace;ditherMethod;measureErrors;treeDepth;_use(e){const n=new dn(this);return he._disposeAfterExecution(n,e)}}class Ae{_image;_names=[];constructor(e){this._image=e}setArtifact(e,n){this._names.push(e),this._image.setArtifact(e,n)}static use(e,n){const t=new Ae(e);try{return n(t)}finally{t.dispose()}}dispose(){for(const e of this._names)this._image.removeArtifact(e)}}class pe extends Array{constructor(){super()}static create(e){const n=pe.createObject();return e!==void 0&&n.read(e),n}dispose(){let e=this.pop();for(;e!==void 0;)e.dispose(),e=this.pop()}appendHorizontally(e){return this.createImage((n,t)=>l._api._MagickImageCollection_Append(n,0,t.ptr),e)}appendVertically(e){return this.createImage((n,t)=>l._api._MagickImageCollection_Append(n,1,t.ptr),e)}clone(e){return pe.use(n=>{for(let t=0;t<this.length;t++)n.push(ie._clone(this[t]));return e(n)})}coalesce(){this.replaceImages((e,n)=>l._api._MagickImageCollection_Coalesce(e,n.ptr))}combine(e,n){let t=n,_=T.sRGB;return typeof e=="number"?_=e:t=e,this.createImage((g,p)=>l._api._MagickImageCollection_Combine(g,_,p.ptr),t)}complex(e,n){return Ae.use(this[0],t=>(e._setArtifacts(t),this.createImage((_,g)=>l._api._MagickImageCollection_Complex(_,e.complexOperator,g.ptr),n)))}deconstruct(){this.replaceImages((e,n)=>l._api._MagickImageCollection_Deconstruct(e,n.ptr))}evaluate(e,n){return this.createImage((t,_)=>l._api._MagickImageCollection_Evaluate(t,e,_.ptr),n)}flatten(e){return this.mergeImages(Ct.Flatten,e)}fx(e,n,t){this.throwIfEmpty();let _=j.All,g=t;return typeof n=="number"?_=n:g=n,R(e,p=>this.createImage((m,C)=>l._api._MagickImageCollection_Fx(m,p,_,C.ptr),g))}merge(e){return this.mergeImages(Ct.Merge,e)}montage(e,n){return this.throwIfEmpty(),this.attachImages(t=>{const _=e._use(g=>b.use(p=>{const m=l._api._MagickImageCollection_Montage(t,g._instance,p.ptr);return this.checkResult(m,p)}));return pe._createFromImages(_,this.getSettings(),g=>{const p=e.transparentColor;return p!==void 0&&g.forEach(m=>{m.transparent(p)}),g.merge(n)})})}morph(e){if(this.length<2)throw new N("operation requires at least two images");this.replaceImages((n,t)=>l._api._MagickImageCollection_Morph(n,e,t.ptr))}mosaic(e){return this.mergeImages(Ct.Mosaic,e)}optimize(){this.replaceImages((e,n)=>l._api._MagickImageCollection_Optimize(e,n.ptr))}optimizePlus(){this.replaceImages((e,n)=>l._api._MagickImageCollection_OptimizePlus(e,n.ptr))}optimizeTransparency(){this.throwIfEmpty(),this.attachImages(e=>{b.usePointer(n=>{l._api._MagickImageCollection_OptimizeTransparency(e,n)})})}ping(e,n){this.readOrPing(!0,e,n)}polynomial(e,n){return this.createImage((t,_)=>St(e,g=>l._api._MagickImageCollection_Polynomial(t,g,e.length,_.ptr)),n)}quantize(e){this.throwIfEmpty();const n=e===void 0?new It:e;return this.attachImages(t=>{n._use(_=>{b.usePointer(g=>{l._api._MagickImageCollection_Quantize(t,_._instance,g)})})}),n.measureErrors?ct._create(this[0]):null}read(e,n){this.readOrPing(!1,e,n)}remap(e,n){this.throwIfEmpty();const t=n===void 0?new It:n;this.attachImages(_=>{t._use(g=>{b.use(p=>{l._api._MagickImageCollection_Remap(_,g._instance,e._instance,p.ptr)})})})}resetPage(){this.forEach(e=>{e.resetPage()})}smushHorizontal(e,n){return this.smush(e,!1,n)}smushVertical(e,n){return this.smush(e,!0,n)}trimBounds(){this.mergeImages(Ct.Trimbounds,()=>{})}static use(e){const n=pe.create();return he._disposeAfterExecution(n,e)}write(e,n){this.throwIfEmpty();let t=0,_=0;const g=this[0],p=this.getSettings();n!==void 0?p.format=e:(n=e,p.format=g.format),b.use(C=>{be.use(G=>{p._use(Y=>{this.attachImages(q=>{t=l._api._MagickImage_WriteBlob(q,Y._instance,G.ptr,C.ptr),_=G.value})})})});const m=new xi(t,_,n);return he._disposeAfterExecution(m,m.func)}static _createFromImages(e,n,t){const _=pe.createObject();return _.addImages(e,n._clone()),t(_)}addImages(e,n){n.format=Te.Unknown;let t=e;for(;t!==0;){const _=l._api._MagickImage_GetNext(t);l._api._MagickImage_SetNext(t,0),this.push(ie._createFromImage(t,n)),t=_}}attachImages(e){try{for(let n=0;n<this.length-1;n++)l._api._MagickImage_SetNext(this[n]._instance,this[n+1]._instance);return e(this[0]._instance)}finally{for(let n=0;n<this.length-1;n++)l._api._MagickImage_SetNext(this[n]._instance,0)}}checkResult(e,n){return n.check(()=>e,()=>(l._api._MagickImageCollection_Dispose(e),0))}static createObject(){return Object.create(pe.prototype)}createImage(e,n){this.throwIfEmpty();const t=this.attachImages(g=>b.use(p=>{const m=e(g,p);return this.checkResult(m,p)}));return ie._createFromImage(t,this.getSettings())._use(n)}getSettings(){return this[0]._getSettings()._clone()}mergeImages(e,n){return this.createImage((t,_)=>l._api._MagickImageCollection_Merge(t,e,_.ptr),n)}readOrPing(e,n,t){this.dispose(),b.use(_=>{const g=t===void 0?new Me:new Me(t);g._ping=e,typeof n=="string"?(g._fileName=n,g._use(p=>{const m=l._api._MagickImageCollection_ReadFile(p._instance,_.ptr);this.addImages(m,g)})):g._use(p=>{const m=n.byteLength;let C=0;try{C=l._api._malloc(m),l._api.HEAPU8.set(n,C);const G=l._api._MagickImageCollection_ReadBlob(p._instance,C,0,m,_.ptr);this.addImages(G,g)}finally{C!==0&&l._api._free(C)}})})}replaceImages(e){this.throwIfEmpty();const n=this.attachImages(_=>b.use(g=>{const p=e(_,g);return this.checkResult(p,g)})),t=this.getSettings()._clone();this.dispose(),this.addImages(n,t)}smush(e,n,t){return this.createImage((_,g)=>l._api._MagickImageCollection_Smush(_,e,n?1:0,g.ptr),t)}throwIfEmpty(){if(this.length===0)throw new N("operation requires at least one image")}}class te{_value;constructor(e){this._value=e}static _fromQuantum(e){return new te(e/De.max*100)}multiply(e){return e*this._value/100}toDouble(){return this._value}toString(){return`${parseFloat(this._value.toFixed(2))}%`}_toQuantum(){return De.max*(this._value/100)}}class fn{static use(e,n,t){const _=l._api._MagickRectangle_Create();try{l._api._MagickRectangle_X_Set(_,n.x),l._api._MagickRectangle_Y_Set(_,n.y);let g=n.width,p=n.height;return n.isPercentage&&(g=new te(n.width).multiply(e.width),p=new te(n.height).multiply(e.height)),l._api._MagickRectangle_Width_Set(_,g),l._api._MagickRectangle_Height_Set(_,p),t(_)}finally{l._api._MagickRectangle_Dispose(_)}}}class Hi{static _use(e,n,t){let _=0;try{return _=l._api._OffsetInfo_Create(),l._api._PrimaryInfo_X_Set(_,e),l._api._PrimaryInfo_Y_Set(_,n),t(_)}finally{l._api._free(_)}}}class Yi{_values;constructor(){this._values=new Array(7).fill(0)}get(e){return this._values[e]}set(e,n){this._values[e]=n}}class Ye{_huPhashes=new Map;_hash="";channel;constructor(e,n,t){if(this.channel=e,typeof t=="number")for(let _=0;_<n.length;_++){const g=new Yi;for(let p=0;p<7;p++){const m=l._api._ChannelPerceptualHash_GetHuPhash(t,_,p);g.set(p,m)}this._huPhashes.set(n[_],g)}else this.parseHash(n,t)}huPhash(e,n){if(n<0||n>6)throw new N("Invalid index specified");const t=this._huPhashes.get(e);if(t===void 0)throw new N("Invalid color space specified");return t.get(n)}sumSquaredDistance(e){let n=0;return this._huPhashes.forEach((t,_)=>{for(let g=0;g<7;g++){const p=t.get(g),m=e.huPhash(_,g);n+=(p-m)*(p-m)}}),n}toString(){return this._hash==""&&this.setHash(),this._hash}parseHash(e,n){this._hash=n;let t=0;for(const _ of e){const g=new Yi;for(let p=0;p<7;p++,t+=5){const m=Number.parseInt(n.substring(t,t+5),16);if(isNaN(m))throw new N("Invalid hash specified");let C=m/Ye.powerOfTen(m>>17);(m&65536)!=0&&(C=-C),g.set(p,C)}this._huPhashes.set(_,g)}}static powerOfTen(e){switch(e){case 2:return 100;case 3:return 1e3;case 4:return 1e4;case 5:return 1e5;case 6:return 1e6;default:return 10}}setHash(){this._hash="",this._huPhashes.forEach(e=>{for(let n=0;n<7;n++){let t=e.get(n),_=0;for(;_<7&&Math.abs(t*10)<65356;)t*=10,_++;_<<=1,_<0&&(_|=1),_=(_<<16)+Math.floor(t<0?-(t-.5):t+.5),this._hash+=_.toString(16)}})}}class me{_red;_green;_blue;constructor(e,n,t){if(typeof e=="string"){const _=n??me._defaultColorspaces();me._validateColorSpaces(_);const g=35*_.length;if(e.length!==3*g)throw new N("Invalid hash size");this._red=new Ye(x.Red,_,e.substring(0,g)),this._blue=new Ye(x.Blue,_,e.substring(g,g+g)),this._green=new Ye(x.Green,_,e.substring(g+g))}else this._red=e,this._green=n,this._blue=t}static _create(e,n,t){if(t===0)throw new N("The native operation failed to create an instance");const _=me.createChannel(e,n,t,x.Red),g=me.createChannel(e,n,t,x.Green),p=me.createChannel(e,n,t,x.Blue);return new me(_,g,p)}static _defaultColorspaces(){return[T.XyY,T.HSB]}static _validateColorSpaces(e){if(e.length<1||e.length>6)throw new N("Invalid number of colorspaces, the minimum is 1 and the maximum is 6");if(new Set(e).size!==e.length)throw new N("Specifying the same colorspace more than once is not allowed")}getChannel(e){switch(e){case x.Red:return this._red;case x.Green:return this._green;case x.Blue:return this._blue;default:return null}}sumSquaredDistance(e){const n=e.getChannel(x.Red),t=e.getChannel(x.Green),_=e.getChannel(x.Blue);if(n===null||t===null||_===null)throw new N("The other perceptual hash should contain a red, green and blue channel.");return this._red.sumSquaredDistance(n)+this._green.sumSquaredDistance(t)+this._blue.sumSquaredDistance(_)}toString(){return this._red.toString()+this._green.toString()+this._blue.toString()}static createChannel(e,n,t,_){const g=l._api._PerceptualHash_GetInstance(e._instance,t,_);return new Ye(_,n,g)}}class Ue extends We{image;constructor(e){const n=b.usePointer(_=>l._api._PixelCollection_Create(e._instance,_)),t=l._api._PixelCollection_Dispose;super(n,t),this.image=e}static _create(e){return new Ue(e)}static _use(e,n){const t=new Ue(e);return he._disposeAfterExecution(t,n)}static _map(e,n,t){const _=new Ue(e);try{_.use(0,0,e.width,e.height,n,g=>{t(g)})}finally{_.dispose()}}getArea(e,n,t,_){return b.usePointer(g=>{const p=l._api._PixelCollection_GetArea(this._instance,e,n,t,_,g),m=t*_*this.image.channelCount;return l._api.HEAPU8.subarray(p,p+m)})}getReadOnlyArea(e,n,t,_){return b.usePointer(g=>{const p=l._api._PixelCollection_GetReadOnlyArea(this.image._instance,e,n,t,_,g),m=t*_*this.image.channelCount;return l._api.HEAPU8.subarray(p,p+m)})}getChannelIndex(e){return this.image._channelOffset(e)}getColor(e,n){const t=this.getArea(e,n,1,1),_=Array.from(t),g=this.image._channelOffset(x.Index);if(g>=0&&_.splice(g,1),_.length===0)return null;if(_.length===1)return new w(_[0],_[0],_[0]);if(_.length===2)return new w(_[0],_[0],_[0],_[1]);const p=this.image._channelOffset(x.Black)>=0,m=this.image._channelOffset(x.Alpha)>=0;return p?_.length===4||!m?new w(_[0],_[1],_[2],_[3],De.max):new w(_[0],_[1],_[2],_[3],_[4]):_.length===3||!m?new w(_[0],_[1],_[2]):new w(_[0],_[1],_[2],_[3])}getPixel(e,n){return this.getArea(e,n,1,1)}setArea(e,n,t,_,g){b.usePointer(p=>{const m=g instanceof Uint8Array?g:new Uint8Array(g);un(m,C=>{l._api._PixelCollection_SetArea(this._instance,e,n,t,_,C,m.length,p)})})}setPixel(e,n,t){t instanceof Uint8Array?this.setArea(e,n,1,1,t):this.setArea(e,n,1,1,t)}toByteArray(e,n,t,_,g){return this.use(e,n,t,_,g,p=>{if(p===0)return null;const m=t*_*g.length;return l._api.HEAPU8.slice(p,p+m)})}use(e,n,t,_,g,p){return R(g,m=>b.use(C=>{let G=l._api._PixelCollection_ToByteArray(this._instance,e,n,t,_,m,C.ptr);return C.check(()=>{const Y=p(G);return G=l._api._MagickMemory_Relinquish(G),Y},()=>(G=l._api._MagickMemory_Relinquish(G),null))}))}}const Ui={Undefined:0,Average:1,Brightness:2,Lightness:3,MS:4,Rec601Luma:5,Rec601Luminance:6,Rec709Luma:7,Rec709Luminance:8,RMS:9},Xi={Undefined:0,Average:1,Average9:2,Average16:3,Background:4,Bilinear:5,Blend:6,Catrom:7,Integer:8,Mesh:9,Nearest:10,Spline:11};class Be{constructor(e,n,t){this.x=e,this.y=n,this.z=t}x;y;z;static _create(e){return e===0?new Be(0,0,0):new Be(l._api._PrimaryInfo_X_Get(e),l._api._PrimaryInfo_Y_Get(e),l._api._PrimaryInfo_Z_Get(e))}_use(e){let n=0;try{n=l._api._PrimaryInfo_Create(),l._api._PrimaryInfo_X_Set(n,this.x),l._api._PrimaryInfo_Y_Set(n,this.y),l._api._PrimaryInfo_Z_Set(n,this.z),e(n)}finally{l._api._PrimaryInfo_Dispose(n)}}}class ji{channel;depth;entropy;kurtosis;maximum;mean;minimum;skewness;standardDeviation;constructor(e,n){this.channel=e,this.depth=l._api._ChannelStatistics_Depth_Get(n),this.entropy=l._api._ChannelStatistics_Entropy_Get(n),this.kurtosis=l._api._ChannelStatistics_Kurtosis_Get(n),this.maximum=l._api._ChannelStatistics_Maximum_Get(n),this.mean=l._api._ChannelStatistics_Mean_Get(n),this.minimum=l._api._ChannelStatistics_Minimum_Get(n),this.skewness=l._api._ChannelStatistics_Skewness_Get(n),this.standardDeviation=l._api._ChannelStatistics_StandardDeviation_Get(n)}}class Pt{_channels=new Map;get channels(){return Array.from(this._channels.keys())}composite(){return this._channels.get(x.Composite)}getChannel(e){const n=this._channels.get(e);return n!==void 0?n:null}static _create(e,n,t){const _=new Pt;return e.channels.forEach(g=>{(t>>g&1)!=0&&_.addChannel(n,g)}),_.addChannel(n,x.Composite),_}addChannel(e,n){const t=l._api._Statistics_GetInstance(e,n);t!==0&&this._channels.set(n,new ji(n,t))}}class pn{static toArray(e){if(e===0)return null;const n=l._api._StringInfo_Datum_Get(e),t=l._api._StringInfo_Length_Get(e);return l._api.HEAPU8.subarray(n,n+t)}}class Jt{constructor(e){this.error=e}error}class ie extends We{_settings;_progress;_warning;constructor(e,n){super(e,l._api._MagickImage_Dispose),this._settings=n,this._settings._onArtifact=this.onSettingsArtifactChanged.bind(this)}get animationDelay(){return l._api._MagickImage_AnimationDelay_Get(this._instance)}set animationDelay(e){l._api._MagickImage_AnimationDelay_Set(this._instance,e)}get animationIterations(){return l._api._MagickImage_AnimationIterations_Get(this._instance)}set animationIterations(e){l._api._MagickImage_AnimationIterations_Set(this._instance,e)}get animationTicksPerSecond(){return l._api._MagickImage_AnimationTicksPerSecond_Get(this._instance)}set animationTicksPerSecond(e){l._api._MagickImage_AnimationTicksPerSecond_Set(this._instance,e)}get artifactNames(){const e=[];l._api._MagickImage_ResetArtifactIterator(this._instance);let n=l._api._MagickImage_GetNextArtifactName(this._instance);for(;n!==0;)e.push(l._api.UTF8ToString(n)),n=l._api._MagickImage_GetNextArtifactName(this._instance);return e}get attributeNames(){const e=[];l._api._MagickImage_ResetAttributeIterator(this._instance);let n=l._api._MagickImage_GetNextAttributeName(this._instance);for(;n!==0;)e.push(l._api.UTF8ToString(n)),n=l._api._MagickImage_GetNextAttributeName(this._instance);return e}get backgroundColor(){const e=l._api._MagickImage_BackgroundColor_Get(this._instance);return w._create(e)}set backgroundColor(e){e._use(n=>{l._api._MagickImage_BackgroundColor_Set(this._instance,n)})}get baseHeight(){return l._api._MagickImage_BaseHeight_Get(this._instance)}get baseWidth(){return l._api._MagickImage_BaseWidth_Get(this._instance)}get blackPointCompensation(){return l._api._MagickImage_BlackPointCompensation_Get(this._instance)===1}set blackPointCompensation(e){l._api._MagickImage_BlackPointCompensation_Set(this._instance,e?1:0)}get borderColor(){const e=l._api._MagickImage_BorderColor_Get(this._instance);return w._create(e)}set borderColor(e){e._use(n=>{l._api._MagickImage_BorderColor_Set(this._instance,n)})}get boundingBox(){return this.useExceptionPointer(e=>{const n=l._api._MagickImage_BoundingBox_Get(this._instance,e),t=ae._fromRectangle(n);return t.width===0||t.height===0?null:t})}get channelCount(){return l._api._MagickImage_ChannelCount_Get(this._instance)}get channels(){const e=[];return[x.Red,x.Green,x.Blue,x.Black,x.Alpha].forEach(n=>{l._api._MagickImage_HasChannel(this._instance,n)&&e.push(n)}),e}get chromaticity(){return new Ai(Be._create(l._api._MagickImage_ChromaRed_Get(this._instance)),Be._create(l._api._MagickImage_ChromaGreen_Get(this._instance)),Be._create(l._api._MagickImage_ChromaBlue_Get(this._instance)),Be._create(l._api._MagickImage_ChromaWhite_Get(this._instance)))}set chromaticity(e){e.blue._use(n=>l._api._MagickImage_ChromaBlue_Set(this._instance,n)),e.green._use(n=>l._api._MagickImage_ChromaGreen_Set(this._instance,n)),e.red._use(n=>l._api._MagickImage_ChromaRed_Set(this._instance,n)),e.white._use(n=>l._api._MagickImage_ChromaWhite_Set(this._instance,n))}get classType(){return l._api._MagickImage_ClassType_Get(this._instance)}set classType(e){this.useExceptionPointer(n=>{l._api._MagickImage_ClassType_Set(this._instance,e,n)})}get colorFuzz(){return te._fromQuantum(l._api._MagickImage_ColorFuzz_Get(this._instance))}set colorFuzz(e){const n=e._toQuantum();l._api._MagickImage_ColorFuzz_Set(this._instance,n),this._settings._colorFuzz=n}get colormapSize(){return l._api._MagickImage_ColormapSize_Get(this._instance)}set colormapSize(e){this.useExceptionPointer(n=>{l._api._MagickImage_ColormapSize_Set(this._instance,e,n)})}get colorSpace(){return l._api._MagickImage_ColorSpace_Get(this._instance)}set colorSpace(e){this.useExceptionPointer(n=>{l._api._MagickImage_ColorSpace_Set(this._instance,e,n)})}get colorType(){return this.settings.colorType!==void 0?this.settings.colorType:l._api._MagickImage_ColorType_Get(this._instance)}set colorType(e){this.useExceptionPointer(n=>{l._api._MagickImage_ColorType_Set(this._instance,e,n)})}get comment(){return this.getAttribute("comment")}set comment(e){e===null?this.removeAttribute("comment"):this.setAttribute("comment",e)}get compose(){return l._api._MagickImage_Compose_Get(this._instance)}set compose(e){l._api._MagickImage_Compose_Set(this._instance,e)}get compression(){return l._api._MagickImage_Compression_Get(this._instance)}get density(){return new He(l._api._MagickImage_ResolutionX_Get(this._instance),l._api._MagickImage_ResolutionY_Get(this._instance),l._api._MagickImage_ResolutionUnits_Get(this._instance))}set density(e){l._api._MagickImage_ResolutionX_Set(this._instance,e.x),l._api._MagickImage_ResolutionY_Set(this._instance,e.y),l._api._MagickImage_ResolutionUnits_Set(this._instance,e.units)}get depth(){return l._api._MagickImage_Depth_Get(this._instance)}set depth(e){l._api._MagickImage_Depth_Set(this._instance,e)}get endian(){return l._api._MagickImage_Endian_Get(this._instance)}set endian(e){l._api._MagickImage_Endian_Set(this._instance,e)}get fileName(){const e=l._api._MagickImage_FileName_Get(this._instance);return e===0?null:l._api.UTF8ToString(e)}get filterType(){return l._api._MagickImage_FilterType_Get(this._instance)}set filterType(e){l._api._MagickImage_FilterType_Set(this._instance,e)}get format(){return _e(l._api._MagickImage_Format_Get(this._instance),"")}set format(e){R(e.toString(),n=>l._api._MagickImage_Format_Set(this._instance,n))}get gamma(){return l._api._MagickImage_Gamma_Get(this._instance)}get gifDisposeMethod(){return l._api._MagickImage_GifDisposeMethod_Get(this._instance)}set gifDisposeMethod(e){l._api._MagickImage_GifDisposeMethod_Set(this._instance,e)}get hasAlpha(){return this.toBool(l._api._MagickImage_HasAlpha_Get(this._instance))}set hasAlpha(e){this.useExceptionPointer(n=>{e&&this.alpha(Ti.Opaque),l._api._MagickImage_HasAlpha_Set(this._instance,this.fromBool(e),n)})}get height(){return l._api._MagickImage_Height_Get(this._instance)}get interlace(){return l._api._MagickImage_Interlace_Get(this._instance)}get isOpaque(){return this.useExceptionPointer(e=>this.toBool(l._api._MagickImage_IsOpaque_Get(this._instance,e)))}get interpolate(){return l._api._MagickImage_Interpolate_Get(this._instance)}set interpolate(e){l._api._MagickImage_Interpolate_Set(this._instance,e)}get label(){return this.getAttribute("label")}set label(e){e===null?this.removeAttribute("label"):this.setAttribute("label",e)}get matteColor(){const e=l._api._MagickImage_MatteColor_Get(this._instance);return w._create(e)}set matteColor(e){e._use(n=>{l._api._MagickImage_MatteColor_Set(this._instance,n)})}get metaChannelCount(){return l._api._MagickImage_MetaChannelCount_Get(this._instance)}set metaChannelCount(e){this.useExceptionPointer(n=>{l._api._MagickImage_MetaChannelCount_Set(this._instance,e,n)})}get orientation(){return l._api._MagickImage_Orientation_Get(this._instance)}set orientation(e){l._api._MagickImage_Orientation_Set(this._instance,e)}get onProgress(){return this._progress}set onProgress(e){e!==void 0?oe.setProgressDelegate(this):this.disposeProgressDelegate(),this._progress=e}get onWarning(){return this._warning}set onWarning(e){this._warning=e}get page(){const e=l._api._MagickImage_Page_Get(this._instance);return ae._fromRectangle(e)}set page(e){e._toRectangle(n=>{l._api._MagickImage_Page_Set(this._instance,n)})}get profileNames(){const e=[];l._api._MagickImage_ResetProfileIterator(this._instance);let n=l._api._MagickImage_GetNextProfileName(this._instance);for(;n!==0;)e.push(l._api.UTF8ToString(n)),n=l._api._MagickImage_GetNextProfileName(this._instance);return e}get quality(){return l._api._MagickImage_Quality_Get(this._instance)}set quality(e){let n=e<1?1:e;n=n>100?100:n,l._api._MagickImage_Quality_Set(this._instance,n),this._settings._quality=n}get renderingIntent(){return l._api._MagickImage_RenderingIntent_Get(this._instance)}set renderingIntent(e){l._api._MagickImage_RenderingIntent_Set(this._instance,e)}get settings(){return this._settings}get signature(){return this.useExceptionPointer(e=>_e(l._api._MagickImage_Signature_Get(this._instance,e)))}get totalColors(){return this.useExceptionPointer(e=>l._api._MagickImage_TotalColors_Get(this._instance,e))}get virtualPixelMethod(){return l._api._MagickImage_VirtualPixelMethod_Get(this._instance)}set virtualPixelMethod(e){this.useExceptionPointer(n=>{l._api._MagickImage_VirtualPixelMethod_Set(this._instance,e,n)})}get width(){return l._api._MagickImage_Width_Get(this._instance)}adaptiveBlur(e,n){const t=this.valueOrDefault(e,0),_=this.valueOrDefault(n,1);this.useException(g=>{const p=l._api._MagickImage_AdaptiveBlur(this._instance,t,_,g.ptr);this._setInstance(p,g)})}adaptiveResize(e,n){const t=typeof e=="number"?new ae(0,0,e,n):e;this.useException(_=>{R(t.toString(),g=>{const p=l._api._MagickImage_AdaptiveResize(this._instance,g,_.ptr);this._setInstance(p,_)})})}adaptiveSharpen(e,n,t){let _=0;const g=n??1;let p=t??j.Undefined;e!==void 0&&(n===void 0?p=e:_=e),this.useException(m=>{const C=l._api._MagickImage_AdaptiveSharpen(this._instance,_,g,p,m.ptr);this._setInstance(C,m)})}adaptiveThreshold(e,n,t,_){const g=t instanceof te?t._toQuantum():0;let p=_??j.Undefined;typeof t=="number"&&(p=t),this.useException(m=>{const C=l._api._MagickImage_AdaptiveThreshold(this._instance,e,n,g,p,m.ptr);this._setInstance(C,m)})}addNoise(e,n,t){let _=1,g=t??j.Undefined;n!==void 0&&(t===void 0?g=n:_=n),this.useException(p=>{const m=l._api._MagickImage_AddNoise(this._instance,e,_,g,p.ptr);this._setInstance(m,p)})}affineTransform(e){this.useException(n=>{const t=l._api._MagickImage_AffineTransform(this._instance,e.scaleX,e.scaleY,e.shearX,e.shearY,e.translateX,e.translateY,n.ptr);this._setInstance(t,n)})}alpha(e){this.useExceptionPointer(n=>{l._api._MagickImage_SetAlpha(this._instance,e,n)})}annotate(e,n,t,_){return this.useExceptionPointer(g=>this._settings._drawing._use(p=>{R(e,m=>{let C=null,G=O.Undefined,Y=0;typeof n=="object"?(C=n.toString(),t!==void 0&&(G=t),_!==void 0&&(Y=_)):(G=n,t!==void 0&&(Y=t)),R(C,q=>{l._api._MagickImage_Annotate(this._instance,p._instance,m,q,G,Y,g)})})}))}autoGamma(e){this.useExceptionPointer(n=>{const t=this.valueOrDefault(e,j.Composite);l._api._MagickImage_AutoGamma(this._instance,t,n)})}autoLevel(e){this.useExceptionPointer(n=>{const t=this.valueOrDefault(e,j.Undefined);l._api._MagickImage_AutoLevel(this._instance,t,n)})}autoOrient(){this.useException(e=>{const n=l._api._MagickImage_AutoOrient(this._instance,e.ptr);this._setInstance(n,e)})}autoThreshold(e){this.useException(n=>{l._api._MagickImage_AutoThreshold(this._instance,e,n.ptr)})}bilateralBlur(e,n,t,_){const g=this.valueOrComputedDefault(t,()=>Math.sqrt(e*e+n*n)),p=this.valueOrDefault(_,g*.25);this.useException(m=>{const C=l._api._MagickImage_BilateralBlur(this._instance,e,n,g,p,m.ptr);this._setInstance(C,m)})}blackThreshold(e,n){const t=this.valueOrDefault(n,j.Composite);this.useException(_=>{R(e.toString(),g=>{l._api._MagickImage_BlackThreshold(this._instance,g,t,_.ptr)})})}blueShift(e){const n=this.valueOrDefault(e,1.5);this.useException(t=>{const _=l._api._MagickImage_BlueShift(this._instance,n,t.ptr);this._setInstance(_,t)})}blur(e,n,t){let _=0;const g=this.valueOrDefault(n,1);let p=this.valueOrDefault(t,j.Undefined);e!==void 0&&(n===void 0?p=e:_=e),this.useException(m=>{const C=l._api._MagickImage_Blur(this._instance,_,g,p,m.ptr);this._setInstance(C,m)})}border(e,n){const t=e,_=this.valueOrDefault(n,e),g=new ae(0,0,t,_);this.useException(p=>{g._toRectangle(m=>{const C=l._api._MagickImage_Border(this._instance,m,p.ptr);this._setInstance(C,p)})})}brightnessContrast(e,n,t){const _=this.valueOrDefault(t,j.Undefined);this.useException(g=>{l._api._MagickImage_BrightnessContrast(this._instance,e.toDouble(),n.toDouble(),_,g.ptr)})}cannyEdge(e,n,t,_){const g=this.valueOrDefault(e,0),p=this.valueOrDefault(n,1),m=this.valueOrDefault(t,new te(10)).toDouble()/100,C=this.valueOrDefault(_,new te(30)).toDouble()/100;this.useException(G=>{const Y=l._api._MagickImage_CannyEdge(this._instance,g,p,m,C,G.ptr);this._setInstance(Y,G)})}charcoal(e,n){const t=e===void 0?0:e,_=n===void 0?1:n;this.useException(g=>{const p=l._api._MagickImage_Charcoal(this._instance,t,_,g.ptr);this._setInstance(p,g)})}chop(e){this.useException(n=>{e._toRectangle(t=>{const _=l._api._MagickImage_Chop(this._instance,t,n.ptr);this._setInstance(_,n)})})}chopHorizontal(e,n){this.chop(new ae(e,0,n,0))}chopVertical(e,n){this.chop(new ae(0,e,0,n))}clahe(e,n,t,_){this.useExceptionPointer(g=>{const p=e instanceof te?e.multiply(this.width):e,m=n instanceof te?n.multiply(this.height):n;l._api._MagickImage_Clahe(this._instance,p,m,t,_,g)})}clone(e){return ie._clone(this)._use(e)}cloneArea(e,n){return b.usePointer(t=>e._toRectangle(_=>Hi._use(0,0,g=>{const p=l._api._MagickImage_CloneArea(this._instance,e.width,e.height,t);l._api._MagickImage_CopyPixels(p,this._instance,_,g,j.Undefined,t);const m=new ie(p,this._settings);return n(m)})))}clut(e,n,t){const _=this.valueOrDefault(n,Xi.Undefined),g=this.valueOrDefault(t,j.Undefined);this.useExceptionPointer(p=>{l._api._MagickImage_Clut(this._instance,e._instance,_,g,p)})}colorAlpha(e){if(!this.hasAlpha)return;const n=ie.create();n.read(e,this.width,this.height),n.composite(this,wt.SrcOver,new ke(0,0)),this._instance=n._instance}compare(e,n,t,_){const g=n instanceof Gi,p=g?n.metric:n;let m=t;_!==void 0&&(m=_);let C=j.Undefined;if(typeof m!="function")return m!==void 0&&(C=m),this.useExceptionPointer(Y=>l._api._MagickImage_CompareDistortion(this._instance,e._instance,p,C,Y));t!==void 0&&typeof t!="function"&&(C=t);const G=Ae.use(this,Y=>(g&&n._setArtifacts(Y),Kt.use(q=>{const Xe=this.useExceptionPointer(ze=>l._api._MagickImage_Compare(this._instance,e._instance,p,C,q.ptr,ze)),je=q.value,Ne=ie._createFromImage(Xe,this._settings);return vt._create(je,Ne)})));return G.difference._use(()=>m(G))}composite(e,n,t,_,g){let p=0,m=0,C=wt.In,G=j.All,Y=null;n instanceof ke?(p=n.x,m=n.y):n!==void 0&&(C=n),t instanceof ke?(p=t.x,m=t.y):typeof t=="string"?Y=t:t!==void 0&&(G=t),typeof _=="string"?Y=_:_!==void 0&&(G=_),g!==void 0&&(G=g),Y!==null&&this.setArtifact("compose:args",Y),this.useExceptionPointer(q=>{l._api._MagickImage_Composite(this._instance,e._instance,p,m,C,G,q)}),Y!==null&&this.removeArtifact("compose:args")}compositeGravity(e,n,t,_,g,p){let m=0,C=0,G=wt.In,Y=j.All,q=null;t instanceof ke?(m=t.x,C=t.y):t!==void 0&&(G=t),_ instanceof ke?(m=_.x,C=_.y):typeof _=="string"?q=_:_!==void 0&&(Y=_),typeof g=="string"?q=g:g!==void 0&&(Y=g),p!==void 0&&(Y=p),q!==null&&this.setArtifact("compose:args",q),this.useExceptionPointer(Xe=>{l._api._MagickImage_CompositeGravity(this._instance,e._instance,n,m,C,G,Y,Xe)}),q!==null&&this.removeArtifact("compose:args")}connectedComponents(e){const n=typeof e=="number"?new Fi(e):e;return Ae.use(this,_=>(n._setArtifacts(_),this.useException(g=>be.use(p=>{try{const m=l._api._MagickImage_ConnectedComponents(this._instance,n.connectivity,p.ptr,g.ptr);return this._setInstance(m,g),Mt._create(p.value,this.colormapSize)}finally{p.value!==0&&l._api._ConnectedComponent_DisposeList(p.value)}}))))}contrast=()=>this.contrastPrivate(!0);contrastStretch(e,n,t){const _=this.width*this.height,g=e.multiply(_);let p=0,m=this.valueOrDefault(t,j.Undefined);n instanceof te?p=_-n.multiply(_):(p=_-e.multiply(_),n!==void 0&&(m=n)),this.useExceptionPointer(C=>{l._api._MagickImage_ContrastStretch(this._instance,g,p,m,C)})}static create(e,n,t){const _=new ie(ie.createInstance(),new et);return e!==void 0&&_.readOrPing(!1,e,n,t),_}crop(e,n,t){let _,g;typeof e!="number"?(_=e,g=this.valueOrDefault(n,O.Undefined)):n!==void 0&&(_=new ae(e,n),g=this.valueOrDefault(t,O.Undefined)),this.useException(p=>{R(_.toString(),m=>{const C=l._api._MagickImage_Crop(this._instance,m,g,p.ptr);this._setInstance(C,p)})})}cropToTiles(e,n,t){let _,g;return typeof e=="number"&&typeof n=="number"&&t!==void 0?(_=new ae(0,0,e,n),g=t):typeof e!="number"&&typeof n!="number"&&(_=e,g=n),this.useException(p=>R(_.toString(),m=>{const C=l._api._MagickImage_CropToTiles(this._instance,m,p.ptr);return pe._createFromImages(C,this._settings,G=>g(G))}))}cycleColormap(e){this.useExceptionPointer(n=>{l._api._MagickImage_CycleColormap(this._instance,e,n)})}deskew(e,n){return Ae.use(this,t=>{n!==void 0&&t.setArtifact("deskew:auto-crop",n),this.useException(g=>{const p=l._api._MagickImage_Deskew(this._instance,e._toQuantum(),g.ptr);this._setInstance(p,g)});const _=Number(this.getArtifact("deskew:angle"));return isNaN(_)?0:_})}distort(e,n){Ae.use(this,t=>{let _,g=0;typeof e=="number"?_=e:(_=e.method,g=e.bestFit?1:0,e._setArtifacts(t)),this.useException(p=>{St(n,m=>{const C=l._api._MagickImage_Distort(this._instance,_,g,m,n.length,p.ptr);this._setInstance(C,p)})})})}draw(...e){const n=e.flat();n.length!==0&&_t._use(this,t=>{t.draw(n)})}evaluate(e,n,t,_){if(typeof n=="number"){const g=n,p=typeof t=="number"?t:t._toQuantum();this.useExceptionPointer(m=>{l._api._MagickImage_EvaluateOperator(this._instance,e,g,p,m)})}else if(_!==void 0){if(typeof t!="number")throw new N("this should not happen");const g=n,p=t,m=typeof _=="number"?_:_._toQuantum();if(g.isPercentage)throw new N("percentage is not supported");this.useExceptionPointer(C=>{fn.use(this,g,G=>{l._api._MagickImage_EvaluateGeometry(this._instance,e,G,p,m,C)})})}}extent(e,n,t){let _=O.Undefined,g;typeof e!="number"?g=e:typeof n=="number"&&(g=new ae(e,n)),typeof n=="number"?_=n:n!==void 0&&(this.backgroundColor=n),typeof t=="number"?_=t:t!==void 0&&(this.backgroundColor=t),this.useException(p=>{R(g.toString(),m=>{const C=l._api._MagickImage_Extent(this._instance,m,_,p.ptr);this._setInstance(C,p)})})}flip(){this.useException(e=>{const n=l._api._MagickImage_Flip(this._instance,e.ptr);this._setInstance(n,e)})}floodFill(e,n,t,_){this.floodFillPrivate(e,n,t,_,!1)}flop(){this.useException(e=>{const n=l._api._MagickImage_Flop(this._instance,e.ptr);this._setInstance(n,e)})}formatExpression(e){return this.useExceptionPointer(n=>this._settings._use(t=>R(e,_=>{const g=l._api._MagickImage_FormatExpression(this._instance,t._instance,_,n);return ln(l._api,g)})))}gammaCorrect(e,n){const t=this.valueOrDefault(n,j.Undefined);this.useExceptionPointer(_=>{l._api._MagickImage_GammaCorrect(this._instance,e,t,_)})}gaussianBlur(e,n,t){const _=this.valueOrDefault(n,1),g=this.valueOrDefault(t,j.Undefined);this.useException(p=>{const m=l._api._MagickImage_GaussianBlur(this._instance,e,_,g,p.ptr);this._setInstance(m,p)})}getArtifact(e){return R(e,n=>{const t=l._api._MagickImage_GetArtifact(this._instance,n);return _e(t)})}getAttribute(e){return this.useException(n=>R(e,t=>{const _=l._api._MagickImage_GetAttribute(this._instance,t,n.ptr);return _e(_)}))}getColormapColor(e){const n=l._api._MagickImage_GetColormapColor(this._instance,e);return n===0?null:w._create(n)}getColorProfile(){const e=["icc","icm"];for(const n of e){const t=this.getProfilePrivate(n);if(t!==null)return new Ri(t)}return null}getPixels(e){if(this._settings._ping)throw new N("image contains no pixel data");return Ue._use(this,e)}getProfile(e){const n=this.getProfilePrivate(e);return n===null?null:new jt(e,n)}getWriteMask(e){const n=this.useExceptionPointer(_=>l._api._MagickImage_GetWriteMask(this._instance,_)),t=n===0?null:new ie(n,new et);return t==null?e(t):t._use(e)}grayscale(e=Ui.Undefined){this.useExceptionPointer(n=>{l._api._MagickImage_Grayscale(this._instance,e,n)})}hasProfile(e){return R(e,n=>this.toBool(l._api._MagickImage_HasProfile(this._instance,n)))}histogram(){const e=new Map;return this.useExceptionPointer(n=>{be.use(t=>{const _=l._api._MagickImage_Histogram(this._instance,t.ptr,n);if(_!==0){const g=t.value;for(let p=0;p<g;p++){const m=l._api._MagickColorCollection_GetInstance(_,p),C=w._create(m),G=l._api._MagickColor_Count_Get(m);e.set(C.toString(),G)}l._api._MagickColorCollection_DisposeList(_)}})}),e}inverseContrast=()=>this.contrastPrivate(!1);inverseFloodFill(e,n,t,_){this.floodFillPrivate(e,n,t,_,!0)}inverseLevel(e,n,t,_){const g=this.valueOrDefault(t,1),p=this.valueOrDefault(_,j.Composite);this.useExceptionPointer(m=>{l._api._MagickImage_InverseLevel(this._instance,e.toDouble(),n._toQuantum(),g,p,m)})}inverseOpaque=(e,n)=>this.opaquePrivate(e,n,!0);inverseSigmoidalContrast(e,n,t){this.sigmoidalContrastPrivate(!1,e,n,t)}inverseTransparent=e=>this.transparentPrivate(e,!0);level(e,n,t,_){const g=this.valueOrDefault(t,1),p=this.valueOrDefault(_,j.Composite);this.useExceptionPointer(m=>{l._api._MagickImage_Level(this._instance,e.toDouble(),n._toQuantum(),g,p,m)})}linearStretch(e,n){this.useExceptionPointer(t=>{l._api._MagickImage_LinearStretch(this._instance,e.toDouble(),n._toQuantum(),t)})}liquidRescale(e,n){const t=typeof e=="number"?new ae(e,n):e;this.useException(_=>{R(t.toString(),g=>{const p=l._api._MagickImage_LiquidRescale(this._instance,g,t.x,t.y,_.ptr);this._setInstance(p,_)})})}negate(e){this.useExceptionPointer(n=>{const t=this.valueOrDefault(e,j.Undefined);l._api._MagickImage_Negate(this._instance,0,t,n)})}negateGrayScale(e){this.useExceptionPointer(n=>{const t=this.valueOrDefault(e,j.Undefined);l._api._MagickImage_Negate(this._instance,1,t,n)})}normalize(){this.useExceptionPointer(e=>{l._api._MagickImage_Normalize(this._instance,e)})}modulate(e,n,t){const _=this.valueOrDefault(n,new te(100)),g=this.valueOrDefault(t,new te(100));this.useExceptionPointer(p=>{const m=`${e.toDouble()}/${_.toDouble()}/${g.toDouble()}`;R(m,C=>{l._api._MagickImage_Modulate(this._instance,C,p)})})}morphology(e){this.useException(n=>{R(e.kernel,t=>{const _=l._api._MagickImage_Morphology(this._instance,e.method,t,e.channels,e.iterations,n.ptr);this._setInstance(_,n)})})}motionBlur(e,n,t){this.useException(_=>{const g=l._api._MagickImage_MotionBlur(this._instance,e,n,t,_.ptr);this._setInstance(g,_)})}oilPaint(e){const n=this.valueOrDefault(e,3),t=0;this.useException(_=>{const g=l._api._MagickImage_OilPaint(this._instance,n,t,_.ptr);this._setInstance(g,_)})}opaque=(e,n)=>this.opaquePrivate(e,n,!1);ping(e,n){this.readOrPing(!0,e,n)}perceptualHash(e){const n=this.valueOrDefault(e,me._defaultColorspaces());return me._validateColorSpaces(n),Ae.use(this,t=>{const _=n.map(g=>Ut[g]).join(",");return t.setArtifact("phash:colorspaces",_),this.useExceptionPointer(g=>{const p=l._api._MagickImage_PerceptualHash(this._instance,g);try{return me._create(this,n,p)}finally{l._api._PerceptualHash_DisposeList(p)}})})}quantize(e){const n=this.valueOrDefault(e,new It);return this.useException(t=>{n._use(_=>{l._api._MagickImage_Quantize(this._instance,_._instance,t.ptr)})}),n.measureErrors?ct._create(this):null}read(e,n,t){this.readOrPing(!1,e,n,t)}readFromCanvas(e,n){const t=e.getContext("2d",n);if(t===null)return;const _=t.getImageData(0,0,e.width,e.height),g=new Me;g.format=Te.Rgba,g.width=e.width,g.height=e.height,this.useException(p=>{this.readFromArray(_.data,g,p)})}removeArtifact(e){R(e,n=>{l._api._MagickImage_RemoveArtifact(this._instance,n)})}removeAttribute(e){R(e,n=>{l._api._MagickImage_RemoveAttribute(this._instance,n)})}removeProfile(e){const n=typeof e=="string"?e:e.name;R(n,t=>{l._api._MagickImage_RemoveProfile(this._instance,t)})}removeWriteMask(){this.useExceptionPointer(e=>{l._api._MagickImage_SetWriteMask(this._instance,0,e)})}resetPage(){this.page=new ae(0,0,0,0)}resize(e,n,t){let _=this.filterType,g;typeof e=="number"?(g=new ae(e,n),t!==void 0&&(_=t)):(g=e,n!==void 0&&(_=n)),this.useException(p=>{R(g.toString(),m=>{const C=l._api._MagickImage_Resize(this._instance,m,_,p.ptr);this._setInstance(C,p)})})}rotate(e){this.useException(n=>{const t=l._api._MagickImage_Rotate(this._instance,e,n.ptr);this._setInstance(t,n)})}separate(e,n){return this.useException(t=>{let _,g=j.Undefined;if(typeof e=="number"&&n!==void 0)g=e,_=n;else if(typeof e=="function")_=e;else throw new N("invalid arguments");const p=l._api._MagickImage_Separate(this._instance,g,t.ptr);return pe._createFromImages(p,this._settings,m=>_(m))})}sepiaTone(e=new te(80)){this.useException(n=>{const t=typeof e=="number"?new te(e):e,_=l._api._MagickImage_SepiaTone(this._instance,t._toQuantum(),n.ptr);this._setInstance(_,n)})}setArtifact(e,n){let t;typeof n=="string"?t=n:typeof n=="boolean"?t=this.fromBool(n).toString():t=n.toString(),R(e,_=>{R(t,g=>{l._api._MagickImage_SetArtifact(this._instance,_,g)})})}setAttribute(e,n){this.useException(t=>{R(e,_=>{R(n,g=>{l._api._MagickImage_SetAttribute(this._instance,_,g,t.ptr)})})})}setProfile(e,n){const t=typeof e=="string"?e:e.name;let _;n!==void 0?_=n:typeof e!="string"&&(_=e.data),this.useException(g=>{R(t,p=>{Wi(_,m=>{l._api._MagickImage_SetProfile(this._instance,p,m,_.byteLength,g.ptr)})})})}setWriteMask(e){this.useExceptionPointer(n=>{l._api._MagickImage_SetWriteMask(this._instance,e._instance,n)})}sharpen(e,n,t){const _=this.valueOrDefault(e,0),g=this.valueOrDefault(n,1),p=this.valueOrDefault(t,j.Undefined);this.useException(m=>{const C=l._api._MagickImage_Sharpen(this._instance,_,g,p,m.ptr);this._setInstance(C,m)})}shave(e,n){this.useException(t=>{const _=l._api._MagickImage_Shave(this._instance,e,n,t.ptr);this._setInstance(_,t)})}sigmoidalContrast(e,n,t){this.sigmoidalContrastPrivate(!0,e,n,t)}solarize(e=new te(50)){this.useException(n=>{const t=typeof e=="number"?new te(e):e;l._api._MagickImage_Solarize(this._instance,t._toQuantum(),n.ptr)})}splice(e,n){const t=this.valueOrDefault(n,O.Undefined);R(e.toString(),_=>{this.useException(g=>{const p=l._api._MagickImage_Splice(this._instance,_,t,g.ptr);this._setInstance(p,g)})})}statistics(e){const n=this.valueOrDefault(e,j.All);return this.useExceptionPointer(t=>{const _=l._api._MagickImage_Statistics(this._instance,n,t),g=Pt._create(this,_,n);return l._api._Statistics_DisposeList(_),g})}strip(){this.useExceptionPointer(e=>{l._api._MagickImage_Strip(this._instance,e)})}transformColorSpace(e,n,t){const _=e;let g,p=Vt.Quantum;n!==void 0&&(typeof n=="number"?p=n:g=n),t!==void 0&&(p=t);const m=this.hasProfile("icc")||this.hasProfile("icm");if(g===void 0){if(!m)return!1;g=_}else{if(_.colorSpace!==this.colorSpace)return!1;m||this.setProfile(_)}return p===Vt.Quantum?Ae.use(this,C=>{C.setArtifact("profile:highres-transform",!1),this.setProfile(g)}):this.setProfile(g),!0}threshold(e,n){const t=this.valueOrDefault(n,j.Undefined);this.useExceptionPointer(_=>{l._api._MagickImage_Threshold(this._instance,e._toQuantum(),t,_)})}thumbnail(e,n){const t=typeof e=="number"?new ae(e,n):e;this.useException(_=>{R(t.toString(),g=>{const p=l._api._MagickImage_Thumbnail(this._instance,g,_.ptr);this._setInstance(p,_)})})}toString=()=>`${this.format} ${this.width}x${this.height} ${this.depth}-bit ${Ut[this.colorSpace]}`;transparent(e){e._use(n=>{this.useExceptionPointer(t=>{l._api._MagickImage_Transparent(this._instance,n,0,t)})})}trim(...e){if(e.length>0)if(e.length==1&&e[0]instanceof te){const n=e[0];this.setArtifact("trim:percent-background",n.toDouble().toString())}else{const n=e,t=[...new Set(Bi(n))].join(",");this.setArtifact("trim:edges",t)}this.useException(n=>{const t=l._api._MagickImage_Trim(this._instance,n.ptr);this._setInstance(t,n),this.removeArtifact("trim:edges"),this.removeArtifact("trim:percent-background")})}wave(e,n,t){const _=this.valueOrDefault(e,this.interpolate),g=this.valueOrDefault(n,25),p=this.valueOrDefault(t,150);this.useException(m=>{const C=l._api._MagickImage_Wave(this._instance,_,g,p,m.ptr);this._setInstance(C,m)})}vignette(e,n,t,_){const g=this.valueOrDefault(e,0),p=this.valueOrDefault(n,1),m=this.valueOrDefault(t,0),C=this.valueOrDefault(_,0);this.useException(G=>{const Y=l._api._MagickImage_Vignette(this._instance,g,p,m,C,G.ptr);this._setInstance(Y,G)})}whiteThreshold(e,n){const t=this.valueOrDefault(n,j.Composite);this.useException(_=>{R(e.toString(),g=>{l._api._MagickImage_WhiteThreshold(this._instance,g,t,_.ptr)})})}write(e,n){let t=0,_=0;n!==void 0?this._settings.format=e:n=e,this.useException(p=>{be.use(m=>{this._settings._use(C=>{try{t=l._api._MagickImage_WriteBlob(this._instance,C._instance,m.ptr,p.ptr),_=m.value}catch{t!==0&&(t=l._api._MagickMemory_Relinquish(t))}})})});const g=new xi(t,_,n);return he._disposeAfterExecution(g,g.func)}writeToCanvas(e,n){e.width=this.width,e.height=this.height;const t=e.getContext("2d",n);t!==null&&Ue._map(this,"RGBA",_=>{const g=t.createImageData(this.width,this.height);let p=0;for(let m=0;m<this.height;m++)for(let C=0;C<this.width;C++)g.data[p++]=l._api.HEAPU8[_++],g.data[p++]=l._api.HEAPU8[_++],g.data[p++]=l._api.HEAPU8[_++],g.data[p++]=l._api.HEAPU8[_++];t.putImageData(g,0,0)})}static _createFromImage(e,n){return new ie(e,n)}_channelOffset(e){return l._api._MagickImage_HasChannel(this._instance,e)?l._api._MagickImage_ChannelOffset(this._instance,e):-1}static _clone(e){return b.usePointer(n=>new ie(l._api._MagickImage_Clone(e._instance,n),e._settings._clone()))}_getSettings(){return this._settings}_instanceNotInitialized(){throw new N("no image has been read")}_setInstance(e,n){if(super._setInstance(e,n)===!0||e===0&&this.onProgress!==void 0)return!0;throw new N("out of memory")}_use(e){return he._disposeAfterExecution(this,e)}static _create(e){return ie.create()._use(e)}onDispose(){this.disposeProgressDelegate()}contrastPrivate(e){this.useExceptionPointer(n=>{l._api._MagickImage_Contrast(this._instance,this.fromBool(e),n)})}static createInstance(){return b.usePointer(e=>l._api._MagickImage_Create(0,e))}disposeProgressDelegate(){oe.removeProgressDelegate(this),this._progress=void 0}floodFillPrivate(e,n,t,_,g){let p=_;p===void 0&&this.getPixels(m=>{const C=m.getColor(n,t);C!==null&&(p=C)}),typeof e=="number"&&p!==void 0&&(p.a=e),this.settings._drawing._use(m=>{e instanceof w?(m.setFillColor(e),m.setFillPattern()):e instanceof ie&&(m.setFillColor(),m.setFillPattern(e)),this.useExceptionPointer(C=>{p!==void 0?p._use(G=>{l._api._MagickImage_FloodFill(this._instance,m._instance,n,t,G,this.fromBool(g),C)}):l._api._MagickImage_FloodFill(this._instance,m._instance,n,t,0,this.fromBool(g),C)})})}fromBool(e){return e?1:0}getProfilePrivate(e){return R(e,n=>{const t=l._api._MagickImage_GetProfile(this._instance,n),_=pn.toArray(t);return _===null?null:_})}onSettingsArtifactChanged(e,n){n===void 0?this.removeArtifact(e):this.setArtifact(e,n)}opaquePrivate(e,n,t){this.useExceptionPointer(_=>{e._use(g=>{n._use(p=>{l._api._MagickImage_Opaque(this._instance,g,p,this.fromBool(t),_)})})})}readOrPing(e,n,t,_){this.useException(g=>{const p=t instanceof Me?t:new Me(this._settings);if(p._ping=e,this._settings._ping=e,p.frameCount!==void 0&&p.frameCount>1)throw new N("The frame count can only be set to 1 when a single image is being read.");if(typeof n=="string")p._fileName=n;else if(Ht(n)){this.readFromArray(n,p,g);return}else p._fileName="xc:"+n.toShortString(),p.width=typeof t=="number"?t:0,p.height=typeof _=="number"?_:0;p._use(m=>{const C=l._api._MagickImage_ReadFile(m._instance,g.ptr);this._setInstance(C,g)})})}readFromArray(e,n,t){n._use(_=>{Wi(e,g=>{const p=l._api._MagickImage_ReadBlob(_._instance,g,0,e.byteLength,t.ptr);this._setInstance(p,t)})})}sigmoidalContrastPrivate(e,n,t,_){let g;t!==void 0?typeof t=="number"?g=t:g=t.multiply(De.max):g=De.max*.5;const p=this.valueOrDefault(_,j.Undefined);this.useExceptionPointer(m=>{l._api._MagickImage_SigmoidalContrast(this._instance,this.fromBool(e),n,g,p,m)})}toBool(e){return e===1}transparentPrivate(e,n){e._use(t=>{this.useExceptionPointer(_=>{l._api._MagickImage_Transparent(this._instance,t,this.fromBool(n),_)})})}valueOrDefault(e,n){return e===void 0?n:e}valueOrComputedDefault(e,n){return e===void 0?n():e}useException(e){return b.use(e,n=>{this.onWarning!==void 0&&this.onWarning(new Jt(n))})}useExceptionPointer(e){return b.usePointer(e,n=>{this.onWarning!==void 0&&this.onWarning(new Jt(n))})}}var mn=(()=>{var k=typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:$e&&$e.tagName.toUpperCase()==="SCRIPT"&&$e.src||new URL("index.umd.cjs",document.baseURI).href;return async function(e={}){var n,t=e,_,g,p=new Promise((i,r)=>{_=i,g=r}),m=typeof window=="object",C=typeof WorkerGlobalScope<"u";typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer",(!globalThis.crypto||!globalThis.crypto.getRandomValues)&&(globalThis.crypto={getRandomValues:i=>{for(let r=0;r<i.length;r++)i[r]=Math.random()*256|0}});var G="./this.program",Y=(i,r)=>{throw r},q="";function Xe(i){return t.locateFile?t.locateFile(i,q):q+i}var je,Ne;(m||C)&&(C?q=self.location.href:typeof document<"u"&&document.currentScript&&(q=document.currentScript.src),k&&(q=k),q.startsWith("blob:")?q="":q=q.slice(0,q.replace(/[?#].*/,"").lastIndexOf("/")+1),C&&(Ne=i=>{var r=new XMLHttpRequest;return r.open("GET",i,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),je=async i=>{if(Ir(i))return new Promise((a,o)=>{var c=new XMLHttpRequest;c.open("GET",i,!0),c.responseType="arraybuffer",c.onload=()=>{if(c.status==200||c.status==0&&c.response){a(c.response);return}o(c.status)},c.onerror=o,c.send(null)});var r=await fetch(i,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)});var ze=console.log.bind(console),Ce=console.error.bind(console),Ve,Et,Zt=!1,Q,ce,ge,lt,E,W,bt,le,Cr,Tt,Ir=i=>i.startsWith("file://");function Pr(){var i=Et.buffer;Q=new Int8Array(i),ge=new Int16Array(i),t.HEAPU8=ce=new Uint8Array(i),lt=new Uint16Array(i),E=new Int32Array(i),W=new Uint32Array(i),bt=new Float32Array(i),Tt=new Float64Array(i),le=new BigInt64Array(i),Cr=new BigUint64Array(i)}function Xn(){if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)ra(t.preRun.shift());Er(Tr)}function jn(){!t.noFSInit&&!u.initialized&&u.init(),s.db(),u.ignorePermissions=!1}function Vn(){if(t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;)ia(t.postRun.shift());Er(br)}var qe=0,ut=null;function Dr(i){qe++,t.monitorRunDependencies?.(qe)}function ei(i){if(qe--,t.monitorRunDependencies?.(qe),qe==0&&ut){var r=ut;ut=null,r()}}function ht(i){t.onAbort?.(i),i="Aborted("+i+")",Ce(i),Zt=!0,i+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(i);throw g(r),r}var ti;function qn(){return t.locateFile?Xe("magick.wasm"):new URL("data:text/plain;base64,").href}function Kn(i){if(i==ti&&Ve)return new Uint8Array(Ve);if(Ne)return Ne(i);throw"both async and sync fetching of the wasm failed"}async function Qn(i){if(!Ve)try{var r=await je(i);return new Uint8Array(r)}catch{}return Kn(i)}async function Jn(i,r){try{var a=await Qn(i),o=await WebAssembly.instantiate(a,r);return o}catch(c){Ce(`failed to asynchronously prepare wasm: ${c}`),ht(c)}}async function On(i,r,a){if(!i&&typeof WebAssembly.instantiateStreaming=="function"&&!Ir(r))try{var o=fetch(r,{credentials:"same-origin"}),c=await WebAssembly.instantiateStreaming(o,a);return c}catch(h){Ce(`wasm streaming compile failed: ${h}`),Ce("falling back to ArrayBuffer instantiation")}return Jn(r,a)}function Zn(){return{a:Ho}}async function ea(){function i(h,d){return s=h.exports,s=E_(s),Et=s.cb,Pr(),Ke=s.xb,ei(),s}Dr();function r(h){return i(h.instance)}var a=Zn();if(t.instantiateWasm)return new Promise((h,d)=>{t.instantiateWasm(a,(f,v)=>{h(i(f))})});ti??=qn();try{var o=await On(Ve,ti,a),c=r(o);return c}catch(h){return g(h),Promise.reject(h)}}class ta{name="ExitStatus";constructor(r){this.message=`Program terminated with exit(${r})`,this.status=r}}var Er=i=>{for(;i.length>0;)i.shift()(t)},br=[],ia=i=>br.push(i),Tr=[],ra=i=>Tr.push(i);function na(i,r="i8"){switch(r.endsWith("*")&&(r="*"),r){case"i1":return Q[i>>>0];case"i8":return Q[i>>>0];case"i16":return ge[i>>>1>>>0];case"i32":return E[i>>>2>>>0];case"i64":return le[i>>>3];case"float":return bt[i>>>2>>>0];case"double":return Tt[i>>>3>>>0];case"*":return W[i>>>2>>>0];default:ht(`invalid type for getValue: ${r}`)}}var ii=!0;function aa(i,r,a="i8"){switch(a.endsWith("*")&&(a="*"),a){case"i1":Q[i>>>0]=r;break;case"i8":Q[i>>>0]=r;break;case"i16":ge[i>>>1>>>0]=r;break;case"i32":E[i>>>2>>>0]=r;break;case"i64":le[i>>>3]=BigInt(r);break;case"float":bt[i>>>2>>>0]=r;break;case"double":Tt[i>>>3>>>0]=r;break;case"*":W[i>>>2>>>0]=r;break;default:ht(`invalid type for setValue: ${a}`)}}var z=i=>jo(i),$=()=>Vo(),sa=9007199254740992,oa=-9007199254740992,Re=i=>i<oa||i>sa?NaN:Number(i),ri=[],Ke,B=i=>{var r=ri[i];return r||(ri[i]=r=Ke.get(i)),r};function _a(i,r){return i>>>=0,B(i)(r)}var it=0;class Ar{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){W[this.ptr+4>>>2>>>0]=r}get_type(){return W[this.ptr+4>>>2>>>0]}set_destructor(r){W[this.ptr+8>>>2>>>0]=r}get_destructor(){return W[this.ptr+8>>>2>>>0]}set_caught(r){r=r?1:0,Q[this.ptr+12>>>0]=r}get_caught(){return Q[this.ptr+12>>>0]!=0}set_rethrown(r){r=r?1:0,Q[this.ptr+13>>>0]=r}get_rethrown(){return Q[this.ptr+13>>>0]!=0}init(r,a){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(a)}set_adjusted_ptr(r){W[this.ptr+16>>>2>>>0]=r}get_adjusted_ptr(){return W[this.ptr+16>>>2>>>0]}}var At=i=>Xo(i),ca=i=>{var r=it;if(!r)return At(0),0;var a=new Ar(r);a.set_adjusted_ptr(r);var o=a.get_type();if(!o)return At(0),r;for(var c of i){if(c===0||c===o)break;var h=a.ptr+16;if(qo(c,o,h))return At(c),r}return At(o),r};function la(){return ca([])}function ua(i,r,a){i>>>=0,r>>>=0,a>>>=0;var o=new Ar(i);throw o.init(r,a),it=i,it}function ha(i){throw i>>>=0,it||(it=i),it}var V={isAbs:i=>i.charAt(0)==="/",splitPath:i=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(i).slice(1)},normalizeArray:(i,r)=>{for(var a=0,o=i.length-1;o>=0;o--){var c=i[o];c==="."?i.splice(o,1):c===".."?(i.splice(o,1),a++):a&&(i.splice(o,1),a--)}if(r)for(;a;a--)i.unshift("..");return i},normalize:i=>{var r=V.isAbs(i),a=i.slice(-1)==="/";return i=V.normalizeArray(i.split("/").filter(o=>!!o),!r).join("/"),!i&&!r&&(i="."),i&&a&&(i+="/"),(r?"/":"")+i},dirname:i=>{var r=V.splitPath(i),a=r[0],o=r[1];return!a&&!o?".":(o&&(o=o.slice(0,-1)),a+o)},basename:i=>i&&i.match(/([^\/]+|\/)\/*$/)[1],join:(...i)=>V.normalize(i.join("/")),join2:(i,r)=>V.normalize(i+"/"+r)},ga=()=>i=>crypto.getRandomValues(i),ni=i=>{(ni=ga())(i)},rt={resolve:(...i)=>{for(var r="",a=!1,o=i.length-1;o>=-1&&!a;o--){var c=o>=0?i[o]:u.cwd();if(typeof c!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!c)return"";r=c+"/"+r,a=V.isAbs(c)}return r=V.normalizeArray(r.split("/").filter(h=>!!h),!a).join("/"),(a?"/":"")+r||"."},relative:(i,r)=>{i=rt.resolve(i).slice(1),r=rt.resolve(r).slice(1);function a(M){for(var S=0;S<M.length&&M[S]==="";S++);for(var I=M.length-1;I>=0&&M[I]==="";I--);return S>I?[]:M.slice(S,I-S+1)}for(var o=a(i.split("/")),c=a(r.split("/")),h=Math.min(o.length,c.length),d=h,f=0;f<h;f++)if(o[f]!==c[f]){d=f;break}for(var v=[],f=d;f<o.length;f++)v.push("..");return v=v.concat(c.slice(d)),v.join("/")}},Rr=typeof TextDecoder<"u"?new TextDecoder:void 0,nt=(i,r=0,a=NaN)=>{r>>>=0;for(var o=r+a,c=r;i[c]&&!(c>=o);)++c;if(c-r>16&&i.buffer&&Rr)return Rr.decode(i.subarray(r,c));for(var h="";r<c;){var d=i[r++];if(!(d&128)){h+=String.fromCharCode(d);continue}var f=i[r++]&63;if((d&224)==192){h+=String.fromCharCode((d&31)<<6|f);continue}var v=i[r++]&63;if((d&240)==224?d=(d&15)<<12|f<<6|v:d=(d&7)<<18|f<<12|v<<6|i[r++]&63,d<65536)h+=String.fromCharCode(d);else{var M=d-65536;h+=String.fromCharCode(55296|M>>10,56320|M&1023)}}return h},ai=[],Qe=i=>{for(var r=0,a=0;a<i.length;++a){var o=i.charCodeAt(a);o<=127?r++:o<=2047?r+=2:o>=55296&&o<=57343?(r+=4,++a):r+=3}return r},si=(i,r,a,o)=>{if(a>>>=0,!(o>0))return 0;for(var c=a,h=a+o-1,d=0;d<i.length;++d){var f=i.charCodeAt(d);if(f>=55296&&f<=57343){var v=i.charCodeAt(++d);f=65536+((f&1023)<<10)|v&1023}if(f<=127){if(a>=h)break;r[a++>>>0]=f}else if(f<=2047){if(a+1>=h)break;r[a++>>>0]=192|f>>6,r[a++>>>0]=128|f&63}else if(f<=65535){if(a+2>=h)break;r[a++>>>0]=224|f>>12,r[a++>>>0]=128|f>>6&63,r[a++>>>0]=128|f&63}else{if(a+3>=h)break;r[a++>>>0]=240|f>>18,r[a++>>>0]=128|f>>12&63,r[a++>>>0]=128|f>>6&63,r[a++>>>0]=128|f&63}}return r[a>>>0]=0,a-c},Gr=(i,r,a)=>{var o=Qe(i)+1,c=new Array(o),h=si(i,c,0,c.length);return c.length=h,c},da=()=>{if(!ai.length){var i=null;if(typeof window<"u"&&typeof window.prompt=="function"&&(i=window.prompt("Input: "),i!==null&&(i+=`
43
+ `)),!i)return null;ai=Gr(i)}return ai.shift()},Je={ttys:[],init(){},shutdown(){},register(i,r){Je.ttys[i]={input:[],output:[],ops:r},u.registerDevice(i,Je.stream_ops)},stream_ops:{open(i){var r=Je.ttys[i.node.rdev];if(!r)throw new u.ErrnoError(43);i.tty=r,i.seekable=!1},close(i){i.tty.ops.fsync(i.tty)},fsync(i){i.tty.ops.fsync(i.tty)},read(i,r,a,o,c){if(!i.tty||!i.tty.ops.get_char)throw new u.ErrnoError(60);for(var h=0,d=0;d<o;d++){var f;try{f=i.tty.ops.get_char(i.tty)}catch{throw new u.ErrnoError(29)}if(f===void 0&&h===0)throw new u.ErrnoError(6);if(f==null)break;h++,r[a+d]=f}return h&&(i.node.atime=Date.now()),h},write(i,r,a,o,c){if(!i.tty||!i.tty.ops.put_char)throw new u.ErrnoError(60);try{for(var h=0;h<o;h++)i.tty.ops.put_char(i.tty,r[a+h])}catch{throw new u.ErrnoError(29)}return o&&(i.node.mtime=i.node.ctime=Date.now()),h}},default_tty_ops:{get_char(i){return da()},put_char(i,r){r===null||r===10?(ze(nt(i.output)),i.output=[]):r!=0&&i.output.push(r)},fsync(i){i.output?.length>0&&(ze(nt(i.output)),i.output=[])},ioctl_tcgets(i){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(i,r,a){return 0},ioctl_tiocgwinsz(i){return[24,80]}},default_tty1_ops:{put_char(i,r){r===null||r===10?(Ce(nt(i.output)),i.output=[]):r!=0&&i.output.push(r)},fsync(i){i.output?.length>0&&(Ce(nt(i.output)),i.output=[])}}},fa=(i,r)=>ce.fill(0,i,i+r),Fr=(i,r)=>Math.ceil(i/r)*r,xr=i=>{i=Fr(i,65536);var r=Uo(65536,i);return r&&fa(r,i),r},L={ops_table:null,mount(i){return L.createNode(null,"/",16895,0)},createNode(i,r,a,o){if(u.isBlkdev(a)||u.isFIFO(a))throw new u.ErrnoError(63);L.ops_table||={dir:{node:{getattr:L.node_ops.getattr,setattr:L.node_ops.setattr,lookup:L.node_ops.lookup,mknod:L.node_ops.mknod,rename:L.node_ops.rename,unlink:L.node_ops.unlink,rmdir:L.node_ops.rmdir,readdir:L.node_ops.readdir,symlink:L.node_ops.symlink},stream:{llseek:L.stream_ops.llseek}},file:{node:{getattr:L.node_ops.getattr,setattr:L.node_ops.setattr},stream:{llseek:L.stream_ops.llseek,read:L.stream_ops.read,write:L.stream_ops.write,mmap:L.stream_ops.mmap,msync:L.stream_ops.msync}},link:{node:{getattr:L.node_ops.getattr,setattr:L.node_ops.setattr,readlink:L.node_ops.readlink},stream:{}},chrdev:{node:{getattr:L.node_ops.getattr,setattr:L.node_ops.setattr},stream:u.chrdev_stream_ops}};var c=u.createNode(i,r,a,o);return u.isDir(c.mode)?(c.node_ops=L.ops_table.dir.node,c.stream_ops=L.ops_table.dir.stream,c.contents={}):u.isFile(c.mode)?(c.node_ops=L.ops_table.file.node,c.stream_ops=L.ops_table.file.stream,c.usedBytes=0,c.contents=null):u.isLink(c.mode)?(c.node_ops=L.ops_table.link.node,c.stream_ops=L.ops_table.link.stream):u.isChrdev(c.mode)&&(c.node_ops=L.ops_table.chrdev.node,c.stream_ops=L.ops_table.chrdev.stream),c.atime=c.mtime=c.ctime=Date.now(),i&&(i.contents[r]=c,i.atime=i.mtime=i.ctime=c.atime),c},getFileDataAsTypedArray(i){return i.contents?i.contents.subarray?i.contents.subarray(0,i.usedBytes):new Uint8Array(i.contents):new Uint8Array(0)},expandFileStorage(i,r){var a=i.contents?i.contents.length:0;if(!(a>=r)){var o=1024*1024;r=Math.max(r,a*(a<o?2:1.125)>>>0),a!=0&&(r=Math.max(r,256));var c=i.contents;i.contents=new Uint8Array(r),i.usedBytes>0&&i.contents.set(c.subarray(0,i.usedBytes),0)}},resizeFileStorage(i,r){if(i.usedBytes!=r)if(r==0)i.contents=null,i.usedBytes=0;else{var a=i.contents;i.contents=new Uint8Array(r),a&&i.contents.set(a.subarray(0,Math.min(r,i.usedBytes))),i.usedBytes=r}},node_ops:{getattr(i){var r={};return r.dev=u.isChrdev(i.mode)?i.id:1,r.ino=i.id,r.mode=i.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=i.rdev,u.isDir(i.mode)?r.size=4096:u.isFile(i.mode)?r.size=i.usedBytes:u.isLink(i.mode)?r.size=i.link.length:r.size=0,r.atime=new Date(i.atime),r.mtime=new Date(i.mtime),r.ctime=new Date(i.ctime),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(i,r){for(const a of["mode","atime","mtime","ctime"])r[a]!=null&&(i[a]=r[a]);r.size!==void 0&&L.resizeFileStorage(i,r.size)},lookup(i,r){throw L.doesNotExistError},mknod(i,r,a,o){return L.createNode(i,r,a,o)},rename(i,r,a){var o;try{o=u.lookupNode(r,a)}catch{}if(o){if(u.isDir(i.mode))for(var c in o.contents)throw new u.ErrnoError(55);u.hashRemoveNode(o)}delete i.parent.contents[i.name],r.contents[a]=i,i.name=a,r.ctime=r.mtime=i.parent.ctime=i.parent.mtime=Date.now()},unlink(i,r){delete i.contents[r],i.ctime=i.mtime=Date.now()},rmdir(i,r){var a=u.lookupNode(i,r);for(var o in a.contents)throw new u.ErrnoError(55);delete i.contents[r],i.ctime=i.mtime=Date.now()},readdir(i){return[".","..",...Object.keys(i.contents)]},symlink(i,r,a){var o=L.createNode(i,r,41471,0);return o.link=a,o},readlink(i){if(!u.isLink(i.mode))throw new u.ErrnoError(28);return i.link}},stream_ops:{read(i,r,a,o,c){var h=i.node.contents;if(c>=i.node.usedBytes)return 0;var d=Math.min(i.node.usedBytes-c,o);if(d>8&&h.subarray)r.set(h.subarray(c,c+d),a);else for(var f=0;f<d;f++)r[a+f]=h[c+f];return d},write(i,r,a,o,c,h){if(r.buffer===Q.buffer&&(h=!1),!o)return 0;var d=i.node;if(d.mtime=d.ctime=Date.now(),r.subarray&&(!d.contents||d.contents.subarray)){if(h)return d.contents=r.subarray(a,a+o),d.usedBytes=o,o;if(d.usedBytes===0&&c===0)return d.contents=r.slice(a,a+o),d.usedBytes=o,o;if(c+o<=d.usedBytes)return d.contents.set(r.subarray(a,a+o),c),o}if(L.expandFileStorage(d,c+o),d.contents.subarray&&r.subarray)d.contents.set(r.subarray(a,a+o),c);else for(var f=0;f<o;f++)d.contents[c+f]=r[a+f];return d.usedBytes=Math.max(d.usedBytes,c+o),o},llseek(i,r,a){var o=r;if(a===1?o+=i.position:a===2&&u.isFile(i.node.mode)&&(o+=i.node.usedBytes),o<0)throw new u.ErrnoError(28);return o},mmap(i,r,a,o,c){if(!u.isFile(i.node.mode))throw new u.ErrnoError(43);var h,d,f=i.node.contents;if(!(c&2)&&f&&f.buffer===Q.buffer)d=!1,h=f.byteOffset;else{if(d=!0,h=xr(r),!h)throw new u.ErrnoError(48);f&&((a>0||a+r<f.length)&&(f.subarray?f=f.subarray(a,a+r):f=Array.prototype.slice.call(f,a,a+r)),Q.set(f,h>>>0))}return{ptr:h,allocated:d}},msync(i,r,a,o,c){return L.stream_ops.write(i,r,0,o,a,!1),0}}},pa=async i=>{var r=await je(i);return new Uint8Array(r)},ma=(i,r,a,o,c,h)=>{u.createDataFile(i,r,a,o,c,h)},Lr=[],va=(i,r,a,o)=>{typeof Browser<"u"&&Browser.init();var c=!1;return Lr.forEach(h=>{c||h.canHandle(r)&&(h.handle(i,r,a,o),c=!0)}),c},wa=(i,r,a,o,c,h,d,f,v,M)=>{var S=r?rt.resolve(V.join2(i,r)):i;function I(D){function P(A){M?.(),f||ma(i,r,A,o,c,v),h?.(),ei()}va(D,S,P,()=>{d?.(),ei()})||P(D)}Dr(),typeof a=="string"?pa(a).then(I,d):I(a)},ka=i=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},a=r[i];if(typeof a>"u")throw new Error(`Unknown file open mode: ${i}`);return a},oi=(i,r)=>{var a=0;return i&&(a|=365),r&&(a|=146),a},u={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,readFiles:{},ErrnoError:class{name="ErrnoError";constructor(i){this.errno=i}},FSStream:class{shared={};get object(){return this.node}set object(i){this.node=i}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(i){this.shared.flags=i}get position(){return this.shared.position}set position(i){this.shared.position=i}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(i,r,a,o){i||(i=this),this.parent=i,this.mount=i.mount,this.id=u.nextInode++,this.name=r,this.mode=a,this.rdev=o,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(i){i?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(i){i?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return u.isDir(this.mode)}get isDevice(){return u.isChrdev(this.mode)}},lookupPath(i,r={}){if(!i)throw new u.ErrnoError(44);r.follow_mount??=!0,V.isAbs(i)||(i=u.cwd()+"/"+i);e:for(var a=0;a<40;a++){for(var o=i.split("/").filter(M=>!!M),c=u.root,h="/",d=0;d<o.length;d++){var f=d===o.length-1;if(f&&r.parent)break;if(o[d]!=="."){if(o[d]===".."){if(h=V.dirname(h),u.isRoot(c)){i=h+"/"+o.slice(d+1).join("/");continue e}else c=c.parent;continue}h=V.join2(h,o[d]);try{c=u.lookupNode(c,o[d])}catch(M){if(M?.errno===44&&f&&r.noent_okay)return{path:h};throw M}if(u.isMountpoint(c)&&(!f||r.follow_mount)&&(c=c.mounted.root),u.isLink(c.mode)&&(!f||r.follow)){if(!c.node_ops.readlink)throw new u.ErrnoError(52);var v=c.node_ops.readlink(c);V.isAbs(v)||(v=V.dirname(h)+"/"+v),i=v+"/"+o.slice(d+1).join("/");continue e}}}return{path:h,node:c}}throw new u.ErrnoError(32)},getPath(i){for(var r;;){if(u.isRoot(i)){var a=i.mount.mountpoint;return r?a[a.length-1]!=="/"?`${a}/${r}`:a+r:a}r=r?`${i.name}/${r}`:i.name,i=i.parent}},hashName(i,r){for(var a=0,o=0;o<r.length;o++)a=(a<<5)-a+r.charCodeAt(o)|0;return(i+a>>>0)%u.nameTable.length},hashAddNode(i){var r=u.hashName(i.parent.id,i.name);i.name_next=u.nameTable[r],u.nameTable[r]=i},hashRemoveNode(i){var r=u.hashName(i.parent.id,i.name);if(u.nameTable[r]===i)u.nameTable[r]=i.name_next;else for(var a=u.nameTable[r];a;){if(a.name_next===i){a.name_next=i.name_next;break}a=a.name_next}},lookupNode(i,r){var a=u.mayLookup(i);if(a)throw new u.ErrnoError(a);for(var o=u.hashName(i.id,r),c=u.nameTable[o];c;c=c.name_next){var h=c.name;if(c.parent.id===i.id&&h===r)return c}return u.lookup(i,r)},createNode(i,r,a,o){var c=new u.FSNode(i,r,a,o);return u.hashAddNode(c),c},destroyNode(i){u.hashRemoveNode(i)},isRoot(i){return i===i.parent},isMountpoint(i){return!!i.mounted},isFile(i){return(i&61440)===32768},isDir(i){return(i&61440)===16384},isLink(i){return(i&61440)===40960},isChrdev(i){return(i&61440)===8192},isBlkdev(i){return(i&61440)===24576},isFIFO(i){return(i&61440)===4096},isSocket(i){return(i&49152)===49152},flagsToPermissionString(i){var r=["r","w","rw"][i&3];return i&512&&(r+="w"),r},nodePermissions(i,r){return u.ignorePermissions?0:r.includes("r")&&!(i.mode&292)||r.includes("w")&&!(i.mode&146)||r.includes("x")&&!(i.mode&73)?2:0},mayLookup(i){if(!u.isDir(i.mode))return 54;var r=u.nodePermissions(i,"x");return r||(i.node_ops.lookup?0:2)},mayCreate(i,r){if(!u.isDir(i.mode))return 54;try{var a=u.lookupNode(i,r);return 20}catch{}return u.nodePermissions(i,"wx")},mayDelete(i,r,a){var o;try{o=u.lookupNode(i,r)}catch(h){return h.errno}var c=u.nodePermissions(i,"wx");if(c)return c;if(a){if(!u.isDir(o.mode))return 54;if(u.isRoot(o)||u.getPath(o)===u.cwd())return 10}else if(u.isDir(o.mode))return 31;return 0},mayOpen(i,r){return i?u.isLink(i.mode)?32:u.isDir(i.mode)&&(u.flagsToPermissionString(r)!=="r"||r&576)?31:u.nodePermissions(i,u.flagsToPermissionString(r)):44},checkOpExists(i,r){if(!i)throw new u.ErrnoError(r);return i},MAX_OPEN_FDS:4096,nextfd(){for(var i=0;i<=u.MAX_OPEN_FDS;i++)if(!u.streams[i])return i;throw new u.ErrnoError(33)},getStreamChecked(i){var r=u.getStream(i);if(!r)throw new u.ErrnoError(8);return r},getStream:i=>u.streams[i],createStream(i,r=-1){return i=Object.assign(new u.FSStream,i),r==-1&&(r=u.nextfd()),i.fd=r,u.streams[r]=i,i},closeStream(i){u.streams[i]=null},dupStream(i,r=-1){var a=u.createStream(i,r);return a.stream_ops?.dup?.(a),a},doSetAttr(i,r,a){var o=i?.stream_ops.setattr,c=o?i:r;o??=r.node_ops.setattr,u.checkOpExists(o,63),o(c,a)},chrdev_stream_ops:{open(i){var r=u.getDevice(i.node.rdev);i.stream_ops=r.stream_ops,i.stream_ops.open?.(i)},llseek(){throw new u.ErrnoError(70)}},major:i=>i>>8,minor:i=>i&255,makedev:(i,r)=>i<<8|r,registerDevice(i,r){u.devices[i]={stream_ops:r}},getDevice:i=>u.devices[i],getMounts(i){for(var r=[],a=[i];a.length;){var o=a.pop();r.push(o),a.push(...o.mounts)}return r},syncfs(i,r){typeof i=="function"&&(r=i,i=!1),u.syncFSRequests++,u.syncFSRequests>1&&Ce(`warning: ${u.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var a=u.getMounts(u.root.mount),o=0;function c(d){return u.syncFSRequests--,r(d)}function h(d){if(d)return h.errored?void 0:(h.errored=!0,c(d));++o>=a.length&&c(null)}a.forEach(d=>{if(!d.type.syncfs)return h(null);d.type.syncfs(d,i,h)})},mount(i,r,a){var o=a==="/",c=!a,h;if(o&&u.root)throw new u.ErrnoError(10);if(!o&&!c){var d=u.lookupPath(a,{follow_mount:!1});if(a=d.path,h=d.node,u.isMountpoint(h))throw new u.ErrnoError(10);if(!u.isDir(h.mode))throw new u.ErrnoError(54)}var f={type:i,opts:r,mountpoint:a,mounts:[]},v=i.mount(f);return v.mount=f,f.root=v,o?u.root=v:h&&(h.mounted=f,h.mount&&h.mount.mounts.push(f)),v},unmount(i){var r=u.lookupPath(i,{follow_mount:!1});if(!u.isMountpoint(r.node))throw new u.ErrnoError(28);var a=r.node,o=a.mounted,c=u.getMounts(o);Object.keys(u.nameTable).forEach(d=>{for(var f=u.nameTable[d];f;){var v=f.name_next;c.includes(f.mount)&&u.destroyNode(f),f=v}}),a.mounted=null;var h=a.mount.mounts.indexOf(o);a.mount.mounts.splice(h,1)},lookup(i,r){return i.node_ops.lookup(i,r)},mknod(i,r,a){var o=u.lookupPath(i,{parent:!0}),c=o.node,h=V.basename(i);if(!h)throw new u.ErrnoError(28);if(h==="."||h==="..")throw new u.ErrnoError(20);var d=u.mayCreate(c,h);if(d)throw new u.ErrnoError(d);if(!c.node_ops.mknod)throw new u.ErrnoError(63);return c.node_ops.mknod(c,h,r,a)},statfs(i){return u.statfsNode(u.lookupPath(i,{follow:!0}).node)},statfsStream(i){return u.statfsNode(i.node)},statfsNode(i){var r={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:u.nextInode,ffree:u.nextInode-1,fsid:42,flags:2,namelen:255};return i.node_ops.statfs&&Object.assign(r,i.node_ops.statfs(i.mount.opts.root)),r},create(i,r=438){return r&=4095,r|=32768,u.mknod(i,r,0)},mkdir(i,r=511){return r&=1023,r|=16384,u.mknod(i,r,0)},mkdirTree(i,r){var a=i.split("/"),o="";for(var c of a)if(c){(o||V.isAbs(i))&&(o+="/"),o+=c;try{u.mkdir(o,r)}catch(h){if(h.errno!=20)throw h}}},mkdev(i,r,a){return typeof a>"u"&&(a=r,r=438),r|=8192,u.mknod(i,r,a)},symlink(i,r){if(!rt.resolve(i))throw new u.ErrnoError(44);var a=u.lookupPath(r,{parent:!0}),o=a.node;if(!o)throw new u.ErrnoError(44);var c=V.basename(r),h=u.mayCreate(o,c);if(h)throw new u.ErrnoError(h);if(!o.node_ops.symlink)throw new u.ErrnoError(63);return o.node_ops.symlink(o,c,i)},rename(i,r){var a=V.dirname(i),o=V.dirname(r),c=V.basename(i),h=V.basename(r),d,f,v;if(d=u.lookupPath(i,{parent:!0}),f=d.node,d=u.lookupPath(r,{parent:!0}),v=d.node,!f||!v)throw new u.ErrnoError(44);if(f.mount!==v.mount)throw new u.ErrnoError(75);var M=u.lookupNode(f,c),S=rt.relative(i,o);if(S.charAt(0)!==".")throw new u.ErrnoError(28);if(S=rt.relative(r,a),S.charAt(0)!==".")throw new u.ErrnoError(55);var I;try{I=u.lookupNode(v,h)}catch{}if(M!==I){var D=u.isDir(M.mode),P=u.mayDelete(f,c,D);if(P)throw new u.ErrnoError(P);if(P=I?u.mayDelete(v,h,D):u.mayCreate(v,h),P)throw new u.ErrnoError(P);if(!f.node_ops.rename)throw new u.ErrnoError(63);if(u.isMountpoint(M)||I&&u.isMountpoint(I))throw new u.ErrnoError(10);if(v!==f&&(P=u.nodePermissions(f,"w"),P))throw new u.ErrnoError(P);u.hashRemoveNode(M);try{f.node_ops.rename(M,v,h),M.parent=v}catch(A){throw A}finally{u.hashAddNode(M)}}},rmdir(i){var r=u.lookupPath(i,{parent:!0}),a=r.node,o=V.basename(i),c=u.lookupNode(a,o),h=u.mayDelete(a,o,!0);if(h)throw new u.ErrnoError(h);if(!a.node_ops.rmdir)throw new u.ErrnoError(63);if(u.isMountpoint(c))throw new u.ErrnoError(10);a.node_ops.rmdir(a,o),u.destroyNode(c)},readdir(i){var r=u.lookupPath(i,{follow:!0}),a=r.node,o=u.checkOpExists(a.node_ops.readdir,54);return o(a)},unlink(i){var r=u.lookupPath(i,{parent:!0}),a=r.node;if(!a)throw new u.ErrnoError(44);var o=V.basename(i),c=u.lookupNode(a,o),h=u.mayDelete(a,o,!1);if(h)throw new u.ErrnoError(h);if(!a.node_ops.unlink)throw new u.ErrnoError(63);if(u.isMountpoint(c))throw new u.ErrnoError(10);a.node_ops.unlink(a,o),u.destroyNode(c)},readlink(i){var r=u.lookupPath(i),a=r.node;if(!a)throw new u.ErrnoError(44);if(!a.node_ops.readlink)throw new u.ErrnoError(28);return a.node_ops.readlink(a)},stat(i,r){var a=u.lookupPath(i,{follow:!r}),o=a.node,c=u.checkOpExists(o.node_ops.getattr,63);return c(o)},fstat(i){var r=u.getStreamChecked(i),a=r.node,o=r.stream_ops.getattr,c=o?r:a;return o??=a.node_ops.getattr,u.checkOpExists(o,63),o(c)},lstat(i){return u.stat(i,!0)},doChmod(i,r,a,o){u.doSetAttr(i,r,{mode:a&4095|r.mode&-4096,ctime:Date.now(),dontFollow:o})},chmod(i,r,a){var o;if(typeof i=="string"){var c=u.lookupPath(i,{follow:!a});o=c.node}else o=i;u.doChmod(null,o,r,a)},lchmod(i,r){u.chmod(i,r,!0)},fchmod(i,r){var a=u.getStreamChecked(i);u.doChmod(a,a.node,r,!1)},doChown(i,r,a){u.doSetAttr(i,r,{timestamp:Date.now(),dontFollow:a})},chown(i,r,a,o){var c;if(typeof i=="string"){var h=u.lookupPath(i,{follow:!o});c=h.node}else c=i;u.doChown(null,c,o)},lchown(i,r,a){u.chown(i,r,a,!0)},fchown(i,r,a){var o=u.getStreamChecked(i);u.doChown(o,o.node,!1)},doTruncate(i,r,a){if(u.isDir(r.mode))throw new u.ErrnoError(31);if(!u.isFile(r.mode))throw new u.ErrnoError(28);var o=u.nodePermissions(r,"w");if(o)throw new u.ErrnoError(o);u.doSetAttr(i,r,{size:a,timestamp:Date.now()})},truncate(i,r){if(r<0)throw new u.ErrnoError(28);var a;if(typeof i=="string"){var o=u.lookupPath(i,{follow:!0});a=o.node}else a=i;u.doTruncate(null,a,r)},ftruncate(i,r){var a=u.getStreamChecked(i);if(r<0||(a.flags&2097155)===0)throw new u.ErrnoError(28);u.doTruncate(a,a.node,r)},utime(i,r,a){var o=u.lookupPath(i,{follow:!0}),c=o.node,h=u.checkOpExists(c.node_ops.setattr,63);h(c,{atime:r,mtime:a})},open(i,r,a=438){if(i==="")throw new u.ErrnoError(44);r=typeof r=="string"?ka(r):r,r&64?a=a&4095|32768:a=0;var o,c;if(typeof i=="object")o=i;else{c=i.endsWith("/");var h=u.lookupPath(i,{follow:!(r&131072),noent_okay:!0});o=h.node,i=h.path}var d=!1;if(r&64)if(o){if(r&128)throw new u.ErrnoError(20)}else{if(c)throw new u.ErrnoError(31);o=u.mknod(i,a|511,0),d=!0}if(!o)throw new u.ErrnoError(44);if(u.isChrdev(o.mode)&&(r&=-513),r&65536&&!u.isDir(o.mode))throw new u.ErrnoError(54);if(!d){var f=u.mayOpen(o,r);if(f)throw new u.ErrnoError(f)}r&512&&!d&&u.truncate(o,0),r&=-131713;var v=u.createStream({node:o,path:u.getPath(o),flags:r,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return v.stream_ops.open&&v.stream_ops.open(v),d&&u.chmod(o,a&511),t.logReadFiles&&!(r&1)&&(i in u.readFiles||(u.readFiles[i]=1)),v},close(i){if(u.isClosed(i))throw new u.ErrnoError(8);i.getdents&&(i.getdents=null);try{i.stream_ops.close&&i.stream_ops.close(i)}catch(r){throw r}finally{u.closeStream(i.fd)}i.fd=null},isClosed(i){return i.fd===null},llseek(i,r,a){if(u.isClosed(i))throw new u.ErrnoError(8);if(!i.seekable||!i.stream_ops.llseek)throw new u.ErrnoError(70);if(a!=0&&a!=1&&a!=2)throw new u.ErrnoError(28);return i.position=i.stream_ops.llseek(i,r,a),i.ungotten=[],i.position},read(i,r,a,o,c){if(o<0||c<0)throw new u.ErrnoError(28);if(u.isClosed(i))throw new u.ErrnoError(8);if((i.flags&2097155)===1)throw new u.ErrnoError(8);if(u.isDir(i.node.mode))throw new u.ErrnoError(31);if(!i.stream_ops.read)throw new u.ErrnoError(28);var h=typeof c<"u";if(!h)c=i.position;else if(!i.seekable)throw new u.ErrnoError(70);var d=i.stream_ops.read(i,r,a,o,c);return h||(i.position+=d),d},write(i,r,a,o,c,h){if(o<0||c<0)throw new u.ErrnoError(28);if(u.isClosed(i))throw new u.ErrnoError(8);if((i.flags&2097155)===0)throw new u.ErrnoError(8);if(u.isDir(i.node.mode))throw new u.ErrnoError(31);if(!i.stream_ops.write)throw new u.ErrnoError(28);i.seekable&&i.flags&1024&&u.llseek(i,0,2);var d=typeof c<"u";if(!d)c=i.position;else if(!i.seekable)throw new u.ErrnoError(70);var f=i.stream_ops.write(i,r,a,o,c,h);return d||(i.position+=f),f},mmap(i,r,a,o,c){if((o&2)!==0&&(c&2)===0&&(i.flags&2097155)!==2)throw new u.ErrnoError(2);if((i.flags&2097155)===1)throw new u.ErrnoError(2);if(!i.stream_ops.mmap)throw new u.ErrnoError(43);if(!r)throw new u.ErrnoError(28);return i.stream_ops.mmap(i,r,a,o,c)},msync(i,r,a,o,c){return i.stream_ops.msync?i.stream_ops.msync(i,r,a,o,c):0},ioctl(i,r,a){if(!i.stream_ops.ioctl)throw new u.ErrnoError(59);return i.stream_ops.ioctl(i,r,a)},readFile(i,r={}){if(r.flags=r.flags||0,r.encoding=r.encoding||"binary",r.encoding!=="utf8"&&r.encoding!=="binary")throw new Error(`Invalid encoding type "${r.encoding}"`);var a,o=u.open(i,r.flags),c=u.stat(i),h=c.size,d=new Uint8Array(h);return u.read(o,d,0,h,0),r.encoding==="utf8"?a=nt(d):r.encoding==="binary"&&(a=d),u.close(o),a},writeFile(i,r,a={}){a.flags=a.flags||577;var o=u.open(i,a.flags,a.mode);if(typeof r=="string"){var c=new Uint8Array(Qe(r)+1),h=si(r,c,0,c.length);u.write(o,c,0,h,void 0,a.canOwn)}else if(ArrayBuffer.isView(r))u.write(o,r,0,r.byteLength,void 0,a.canOwn);else throw new Error("Unsupported data type");u.close(o)},cwd:()=>u.currentPath,chdir(i){var r=u.lookupPath(i,{follow:!0});if(r.node===null)throw new u.ErrnoError(44);if(!u.isDir(r.node.mode))throw new u.ErrnoError(54);var a=u.nodePermissions(r.node,"x");if(a)throw new u.ErrnoError(a);u.currentPath=r.path},createDefaultDirectories(){u.mkdir("/tmp"),u.mkdir("/home"),u.mkdir("/home/web_user")},createDefaultDevices(){u.mkdir("/dev"),u.registerDevice(u.makedev(1,3),{read:()=>0,write:(o,c,h,d,f)=>d,llseek:()=>0}),u.mkdev("/dev/null",u.makedev(1,3)),Je.register(u.makedev(5,0),Je.default_tty_ops),Je.register(u.makedev(6,0),Je.default_tty1_ops),u.mkdev("/dev/tty",u.makedev(5,0)),u.mkdev("/dev/tty1",u.makedev(6,0));var i=new Uint8Array(1024),r=0,a=()=>(r===0&&(ni(i),r=i.byteLength),i[--r]);u.createDevice("/dev","random",a),u.createDevice("/dev","urandom",a),u.mkdir("/dev/shm"),u.mkdir("/dev/shm/tmp")},createSpecialDirectories(){u.mkdir("/proc");var i=u.mkdir("/proc/self");u.mkdir("/proc/self/fd"),u.mount({mount(){var r=u.createNode(i,"fd",16895,73);return r.stream_ops={llseek:L.stream_ops.llseek},r.node_ops={lookup(a,o){var c=+o,h=u.getStreamChecked(c),d={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>h.path},id:c+1};return d.parent=d,d},readdir(){return Array.from(u.streams.entries()).filter(([a,o])=>o).map(([a,o])=>a.toString())}},r}},{},"/proc/self/fd")},createStandardStreams(i,r,a){i?u.createDevice("/dev","stdin",i):u.symlink("/dev/tty","/dev/stdin"),r?u.createDevice("/dev","stdout",null,r):u.symlink("/dev/tty","/dev/stdout"),a?u.createDevice("/dev","stderr",null,a):u.symlink("/dev/tty1","/dev/stderr"),u.open("/dev/stdin",0),u.open("/dev/stdout",1),u.open("/dev/stderr",1)},staticInit(){u.nameTable=new Array(4096),u.mount(L,{},"/"),u.createDefaultDirectories(),u.createDefaultDevices(),u.createSpecialDirectories(),u.filesystems={MEMFS:L}},init(i,r,a){u.initialized=!0,i??=t.stdin,r??=t.stdout,a??=t.stderr,u.createStandardStreams(i,r,a)},quit(){u.initialized=!1;for(var i of u.streams)i&&u.close(i)},findObject(i,r){var a=u.analyzePath(i,r);return a.exists?a.object:null},analyzePath(i,r){try{var a=u.lookupPath(i,{follow:!r});i=a.path}catch{}var o={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var a=u.lookupPath(i,{parent:!0});o.parentExists=!0,o.parentPath=a.path,o.parentObject=a.node,o.name=V.basename(i),a=u.lookupPath(i,{follow:!r}),o.exists=!0,o.path=a.path,o.object=a.node,o.name=a.node.name,o.isRoot=a.path==="/"}catch(c){o.error=c.errno}return o},createPath(i,r,a,o){i=typeof i=="string"?i:u.getPath(i);for(var c=r.split("/").reverse();c.length;){var h=c.pop();if(h){var d=V.join2(i,h);try{u.mkdir(d)}catch(f){if(f.errno!=20)throw f}i=d}}return d},createFile(i,r,a,o,c){var h=V.join2(typeof i=="string"?i:u.getPath(i),r),d=oi(o,c);return u.create(h,d)},createDataFile(i,r,a,o,c,h){var d=r;i&&(i=typeof i=="string"?i:u.getPath(i),d=r?V.join2(i,r):i);var f=oi(o,c),v=u.create(d,f);if(a){if(typeof a=="string"){for(var M=new Array(a.length),S=0,I=a.length;S<I;++S)M[S]=a.charCodeAt(S);a=M}u.chmod(v,f|146);var D=u.open(v,577);u.write(D,a,0,a.length,0,h),u.close(D),u.chmod(v,f)}},createDevice(i,r,a,o){var c=V.join2(typeof i=="string"?i:u.getPath(i),r),h=oi(!!a,!!o);u.createDevice.major??=64;var d=u.makedev(u.createDevice.major++,0);return u.registerDevice(d,{open(f){f.seekable=!1},close(f){o?.buffer?.length&&o(10)},read(f,v,M,S,I){for(var D=0,P=0;P<S;P++){var A;try{A=a()}catch{throw new u.ErrnoError(29)}if(A===void 0&&D===0)throw new u.ErrnoError(6);if(A==null)break;D++,v[M+P]=A}return D&&(f.node.atime=Date.now()),D},write(f,v,M,S,I){for(var D=0;D<S;D++)try{o(v[M+D])}catch{throw new u.ErrnoError(29)}return S&&(f.node.mtime=f.node.ctime=Date.now()),D}}),u.mkdev(c,h,d)},forceLoadFile(i){if(i.isDevice||i.isFolder||i.link||i.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");try{i.contents=Ne(i.url),i.usedBytes=i.contents.length}catch{throw new u.ErrnoError(29)}},createLazyFile(i,r,a,o,c){class h{lengthKnown=!1;chunks=[];get(P){if(!(P>this.length-1||P<0)){var A=P%this.chunkSize,U=P/this.chunkSize|0;return this.getter(U)[A]}}setDataGetter(P){this.getter=P}cacheLength(){var P=new XMLHttpRequest;if(P.open("HEAD",a,!1),P.send(null),!(P.status>=200&&P.status<300||P.status===304))throw new Error("Couldn't load "+a+". Status: "+P.status);var A=Number(P.getResponseHeader("Content-length")),U,re=(U=P.getResponseHeader("Accept-Ranges"))&&U==="bytes",Z=(U=P.getResponseHeader("Content-Encoding"))&&U==="gzip",ne=1024*1024;re||(ne=A);var J=(fe,xe)=>{if(fe>xe)throw new Error("invalid range ("+fe+", "+xe+") or no bytes requested!");if(xe>A-1)throw new Error("only "+A+" bytes available! programmer error!");var ee=new XMLHttpRequest;if(ee.open("GET",a,!1),A!==ne&&ee.setRequestHeader("Range","bytes="+fe+"-"+xe),ee.responseType="arraybuffer",ee.overrideMimeType&&ee.overrideMimeType("text/plain; charset=x-user-defined"),ee.send(null),!(ee.status>=200&&ee.status<300||ee.status===304))throw new Error("Couldn't load "+a+". Status: "+ee.status);return ee.response!==void 0?new Uint8Array(ee.response||[]):Gr(ee.responseText||"")},Pe=this;Pe.setDataGetter(fe=>{var xe=fe*ne,ee=(fe+1)*ne-1;if(ee=Math.min(ee,A-1),typeof Pe.chunks[fe]>"u"&&(Pe.chunks[fe]=J(xe,ee)),typeof Pe.chunks[fe]>"u")throw new Error("doXHR failed!");return Pe.chunks[fe]}),(Z||!A)&&(ne=A=1,A=this.getter(0).length,ne=A,ze("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=A,this._chunkSize=ne,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!C)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var d=new h,f={isDevice:!1,contents:d}}else var f={isDevice:!1,url:a};var v=u.createFile(i,r,f,o,c);f.contents?v.contents=f.contents:f.url&&(v.contents=null,v.url=f.url),Object.defineProperties(v,{usedBytes:{get:function(){return this.contents.length}}});var M={},S=Object.keys(v.stream_ops);S.forEach(D=>{var P=v.stream_ops[D];M[D]=(...A)=>(u.forceLoadFile(v),P(...A))});function I(D,P,A,U,re){var Z=D.node.contents;if(re>=Z.length)return 0;var ne=Math.min(Z.length-re,U);if(Z.slice)for(var J=0;J<ne;J++)P[A+J]=Z[re+J];else for(var J=0;J<ne;J++)P[A+J]=Z.get(re+J);return ne}return M.read=(D,P,A,U,re)=>(u.forceLoadFile(v),I(D,P,A,U,re)),M.mmap=(D,P,A,U,re)=>{u.forceLoadFile(v);var Z=xr(P);if(!Z)throw new u.ErrnoError(48);return I(D,Q,Z,P,A),{ptr:Z,allocated:!0}},v.stream_ops=M,v}},_i=(i,r)=>(i>>>=0,i?nt(ce,i,r):""),F={DEFAULT_POLLMASK:5,calculateAt(i,r,a){if(V.isAbs(r))return r;var o;if(i===-100)o=u.cwd();else{var c=F.getStreamFromFD(i);o=c.path}if(r.length==0){if(!a)throw new u.ErrnoError(44);return o}return o+"/"+r},writeStat(i,r){E[i>>>2>>>0]=r.dev,E[i+4>>>2>>>0]=r.mode,W[i+8>>>2>>>0]=r.nlink,E[i+12>>>2>>>0]=r.uid,E[i+16>>>2>>>0]=r.gid,E[i+20>>>2>>>0]=r.rdev,le[i+24>>>3]=BigInt(r.size),E[i+32>>>2>>>0]=4096,E[i+36>>>2>>>0]=r.blocks;var a=r.atime.getTime(),o=r.mtime.getTime(),c=r.ctime.getTime();return le[i+40>>>3]=BigInt(Math.floor(a/1e3)),W[i+48>>>2>>>0]=a%1e3*1e3*1e3,le[i+56>>>3]=BigInt(Math.floor(o/1e3)),W[i+64>>>2>>>0]=o%1e3*1e3*1e3,le[i+72>>>3]=BigInt(Math.floor(c/1e3)),W[i+80>>>2>>>0]=c%1e3*1e3*1e3,le[i+88>>>3]=BigInt(r.ino),0},writeStatFs(i,r){E[i+4>>>2>>>0]=r.bsize,E[i+40>>>2>>>0]=r.bsize,E[i+8>>>2>>>0]=r.blocks,E[i+12>>>2>>>0]=r.bfree,E[i+16>>>2>>>0]=r.bavail,E[i+20>>>2>>>0]=r.files,E[i+24>>>2>>>0]=r.ffree,E[i+28>>>2>>>0]=r.fsid,E[i+44>>>2>>>0]=r.flags,E[i+36>>>2>>>0]=r.namelen},doMsync(i,r,a,o,c){if(!u.isFile(r.node.mode))throw new u.ErrnoError(43);if(o&2)return 0;var h=ce.slice(i,i+a);u.msync(r,h,c,a,o)},getStreamFromFD(i){var r=u.getStreamChecked(i);return r},varargs:void 0,getStr(i){var r=_i(i);return r}};function Ma(i,r){i>>>=0;try{return i=F.getStr(i),u.chmod(i,r),0}catch(a){if(typeof u>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}function ya(i){try{var r=F.getStreamFromFD(i);return u.dupStream(r).fd}catch(a){if(typeof u>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}function Sa(i,r,a,o){r>>>=0;try{if(r=F.getStr(r),r=F.calculateAt(i,r),a&-8)return-28;var c=u.lookupPath(r,{follow:!0}),h=c.node;if(!h)return-44;var d="";return a&4&&(d+="r"),a&2&&(d+="w"),a&1&&(d+="x"),d&&u.nodePermissions(h,d)?-2:0}catch(f){if(typeof u>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}function Ca(i,r,a,o){a=Re(a),o=Re(o);try{if(isNaN(a))return 61;if(r!=0)return-138;if(a<0||o<0)return-28;var c=u.fstat(i).size,h=a+o;return h>c&&u.ftruncate(i,h),0}catch(d){if(typeof u>"u"||d.name!=="ErrnoError")throw d;return-d.errno}}function Ia(i,r){try{return u.fchmod(i,r),0}catch(a){if(typeof u>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}var Rt=()=>{var i=E[+F.varargs>>>2>>>0];return F.varargs+=4,i},at=Rt;function Pa(i,r,a){a>>>=0,F.varargs=a;try{var o=F.getStreamFromFD(i);switch(r){case 0:{var c=Rt();if(c<0)return-28;for(;u.streams[c];)c++;var h;return h=u.dupStream(o,c),h.fd}case 1:case 2:return 0;case 3:return o.flags;case 4:{var c=Rt();return o.flags|=c,0}case 12:{var c=at(),d=0;return ge[c+d>>>1>>>0]=2,0}case 13:case 14:return 0}return-28}catch(f){if(typeof u>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}function Da(i,r){r>>>=0;try{return F.writeStat(r,u.fstat(i))}catch(a){if(typeof u>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}var Ie=(i,r,a)=>si(i,ce,r,a);function Ea(i,r){i>>>=0,r>>>=0;try{if(r===0)return-28;var a=u.cwd(),o=Qe(a)+1;return r<o?-68:(Ie(a,i,r),o)}catch(c){if(typeof u>"u"||c.name!=="ErrnoError")throw c;return-c.errno}}function ba(i,r,a){r>>>=0,a>>>=0;try{var o=F.getStreamFromFD(i);o.getdents||=u.readdir(o.path);for(var c=280,h=0,d=u.llseek(o,0,1),f=Math.floor(d/c),v=Math.min(o.getdents.length,f+Math.floor(a/c)),M=f;M<v;M++){var S,I,D=o.getdents[M];if(D===".")S=o.node.id,I=4;else if(D===".."){var P=u.lookupPath(o.path,{parent:!0});S=P.node.id,I=4}else{var A;try{A=u.lookupNode(o.node,D)}catch(U){if(U?.errno===28)continue;throw U}S=A.id,I=u.isChrdev(A.mode)?2:u.isDir(A.mode)?4:u.isLink(A.mode)?10:8}le[r+h>>>3]=BigInt(S),le[r+h+8>>>3]=BigInt((M+1)*c),ge[r+h+16>>>1>>>0]=280,Q[r+h+18>>>0]=I,Ie(D,r+h+19,256),h+=c}return u.llseek(o,M*c,0),h}catch(U){if(typeof u>"u"||U.name!=="ErrnoError")throw U;return-U.errno}}function Ta(i,r,a){a>>>=0,F.varargs=a;try{var o=F.getStreamFromFD(i);switch(r){case 21509:return o.tty?0:-59;case 21505:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tcgets){var c=o.tty.ops.ioctl_tcgets(o),h=at();E[h>>>2>>>0]=c.c_iflag||0,E[h+4>>>2>>>0]=c.c_oflag||0,E[h+8>>>2>>>0]=c.c_cflag||0,E[h+12>>>2>>>0]=c.c_lflag||0;for(var d=0;d<32;d++)Q[h+d+17>>>0]=c.c_cc[d]||0;return 0}return 0}case 21510:case 21511:case 21512:return o.tty?0:-59;case 21506:case 21507:case 21508:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tcsets){for(var h=at(),f=E[h>>>2>>>0],v=E[h+4>>>2>>>0],M=E[h+8>>>2>>>0],S=E[h+12>>>2>>>0],I=[],d=0;d<32;d++)I.push(Q[h+d+17>>>0]);return o.tty.ops.ioctl_tcsets(o.tty,r,{c_iflag:f,c_oflag:v,c_cflag:M,c_lflag:S,c_cc:I})}return 0}case 21519:{if(!o.tty)return-59;var h=at();return E[h>>>2>>>0]=0,0}case 21520:return o.tty?-28:-59;case 21531:{var h=at();return u.ioctl(o,r,h)}case 21523:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tiocgwinsz){var D=o.tty.ops.ioctl_tiocgwinsz(o.tty),h=at();ge[h>>>1>>>0]=D[0],ge[h+2>>>1>>>0]=D[1]}return 0}case 21524:return o.tty?0:-59;case 21515:return o.tty?0:-59;default:return-28}}catch(P){if(typeof u>"u"||P.name!=="ErrnoError")throw P;return-P.errno}}function Aa(i,r){i>>>=0,r>>>=0;try{return i=F.getStr(i),F.writeStat(r,u.lstat(i))}catch(a){if(typeof u>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}function Ra(i,r,a,o){r>>>=0,a>>>=0;try{r=F.getStr(r);var c=o&256,h=o&4096;return o=o&-6401,r=F.calculateAt(i,r,h),F.writeStat(a,c?u.lstat(r):u.stat(r))}catch(d){if(typeof u>"u"||d.name!=="ErrnoError")throw d;return-d.errno}}function Ga(i,r,a,o){r>>>=0,o>>>=0,F.varargs=o;try{r=F.getStr(r),r=F.calculateAt(i,r);var c=o?Rt():0;return u.open(r,a,c).fd}catch(h){if(typeof u>"u"||h.name!=="ErrnoError")throw h;return-h.errno}}function Fa(i,r,a,o){r>>>=0,a>>>=0,o>>>=0;try{if(r=F.getStr(r),r=F.calculateAt(i,r),o<=0)return-28;var c=u.readlink(r),h=Math.min(o,Qe(c)),d=Q[a+h>>>0];return Ie(c,a,o+1),Q[a+h>>>0]=d,h}catch(f){if(typeof u>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}function xa(i,r,a,o){r>>>=0,o>>>=0;try{return r=F.getStr(r),o=F.getStr(o),r=F.calculateAt(i,r),o=F.calculateAt(a,o),u.rename(r,o),0}catch(c){if(typeof u>"u"||c.name!=="ErrnoError")throw c;return-c.errno}}function La(i){i>>>=0;try{return i=F.getStr(i),u.rmdir(i),0}catch(r){if(typeof u>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}function Wa(i,r){i>>>=0,r>>>=0;try{return i=F.getStr(i),F.writeStat(r,u.stat(i))}catch(a){if(typeof u>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}function Ba(i,r,a){i>>>=0,a>>>=0;try{return i=F.getStr(i),a=F.getStr(a),a=F.calculateAt(r,a),u.symlink(i,a),0}catch(o){if(typeof u>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function Na(i,r,a){r>>>=0;try{return r=F.getStr(r),r=F.calculateAt(i,r),a===0?u.unlink(r):a===512?u.rmdir(r):ht("Invalid flags passed to unlinkat"),0}catch(o){if(typeof u>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}var za=()=>ht(""),Gt={},ci=i=>{for(;i.length;){var r=i.pop(),a=i.pop();a(r)}};function gt(i){return this.fromWireType(W[i>>>2>>>0])}var st={},Oe={},Ft={},$a=t.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},xt=i=>{throw new $a(i)},li=(i,r,a)=>{i.forEach(f=>Ft[f]=r);function o(f){var v=a(f);v.length!==i.length&&xt("Mismatched type converter count");for(var M=0;M<i.length;++M)ve(i[M],v[M])}var c=new Array(r.length),h=[],d=0;r.forEach((f,v)=>{Oe.hasOwnProperty(f)?c[v]=Oe[f]:(h.push(f),st.hasOwnProperty(f)||(st[f]=[]),st[f].push(()=>{c[v]=Oe[f],++d,d===h.length&&o(c)}))}),h.length===0&&o(c)},Ha=function(i){i>>>=0;var r=Gt[i];delete Gt[i];var a=r.rawConstructor,o=r.rawDestructor,c=r.fields,h=c.map(d=>d.getterReturnType).concat(c.map(d=>d.setterArgumentType));li([i],h,d=>{var f={};return c.forEach((v,M)=>{var S=v.fieldName,I=d[M],D=d[M].optional,P=v.getter,A=v.getterContext,U=d[M+c.length],re=v.setter,Z=v.setterContext;f[S]={read:ne=>I.fromWireType(P(A,ne)),write:(ne,J)=>{var Pe=[];re(Z,ne,U.toWireType(Pe,J)),ci(Pe)},optional:D}}),[{name:r.name,fromWireType:v=>{var M={};for(var S in f)M[S]=f[S].read(v);return o(v),M},toWireType:(v,M)=>{for(var S in f)if(!(S in M)&&!f[S].optional)throw new TypeError(`Missing field: "${S}"`);var I=a();for(S in f)f[S].write(I,M[S]);return v!==null&&v.push(o,I),I},argPackAdvance:we,readValueFromPointer:gt,destructorFunction:o}]})},Lt=i=>{if(i===null)return"null";var r=typeof i;return r==="object"||r==="array"||r==="function"?i.toString():""+i},Ya=()=>{for(var i=new Array(256),r=0;r<256;++r)i[r]=String.fromCharCode(r);Wr=i},Wr,se=i=>{for(var r="",a=i;ce[a>>>0];)r+=Wr[ce[a++>>>0]];return r},Wt=t.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},X=i=>{throw new Wt(i)};function Ua(i,r,a={}){var o=r.name;if(i||X(`type "${o}" must have a positive integer typeid pointer`),Oe.hasOwnProperty(i)){if(a.ignoreDuplicateRegistrations)return;X(`Cannot register type '${o}' twice`)}if(Oe[i]=r,delete Ft[i],st.hasOwnProperty(i)){var c=st[i];delete st[i],c.forEach(h=>h())}}function ve(i,r,a={}){return Ua(i,r,a)}var Br=(i,r,a)=>{switch(r){case 1:return a?o=>Q[o>>>0]:o=>ce[o>>>0];case 2:return a?o=>ge[o>>>1>>>0]:o=>lt[o>>>1>>>0];case 4:return a?o=>E[o>>>2>>>0]:o=>W[o>>>2>>>0];case 8:return a?o=>le[o>>>3]:o=>Cr[o>>>3];default:throw new TypeError(`invalid integer width (${r}): ${i}`)}};function Xa(i,r,a,o,c){i>>>=0,r>>>=0,a>>>=0,r=se(r);var h=r.indexOf("u")!=-1;ve(i,{name:r,fromWireType:d=>d,toWireType:function(d,f){if(typeof f!="bigint"&&typeof f!="number")throw new TypeError(`Cannot convert "${Lt(f)}" to ${this.name}`);return typeof f=="number"&&(f=BigInt(f)),f},argPackAdvance:we,readValueFromPointer:Br(r,a,!h),destructorFunction:null})}var we=8;function ja(i,r,a,o){i>>>=0,r>>>=0,r=se(r),ve(i,{name:r,fromWireType:function(c){return!!c},toWireType:function(c,h){return h?a:o},argPackAdvance:we,readValueFromPointer:function(c){return this.fromWireType(ce[c>>>0])},destructorFunction:null})}var Va=i=>({count:i.count,deleteScheduled:i.deleteScheduled,preservePointerOnDelete:i.preservePointerOnDelete,ptr:i.ptr,ptrType:i.ptrType,smartPtr:i.smartPtr,smartPtrType:i.smartPtrType}),ui=i=>{function r(a){return a.$$.ptrType.registeredClass.name}X(r(i)+" instance already deleted")},hi=!1,Nr=i=>{},qa=i=>{i.smartPtr?i.smartPtrType.rawDestructor(i.smartPtr):i.ptrType.registeredClass.rawDestructor(i.ptr)},zr=i=>{i.count.value-=1;var r=i.count.value===0;r&&qa(i)},dt=i=>typeof FinalizationRegistry>"u"?(dt=r=>r,i):(hi=new FinalizationRegistry(r=>{zr(r.$$)}),dt=r=>{var a=r.$$,o=!!a.smartPtr;if(o){var c={$$:a};hi.register(r,c,r)}return r},Nr=r=>hi.unregister(r),dt(i)),Ka=()=>{let i=Bt.prototype;Object.assign(i,{isAliasOf(a){if(!(this instanceof Bt)||!(a instanceof Bt))return!1;var o=this.$$.ptrType.registeredClass,c=this.$$.ptr;a.$$=a.$$;for(var h=a.$$.ptrType.registeredClass,d=a.$$.ptr;o.baseClass;)c=o.upcast(c),o=o.baseClass;for(;h.baseClass;)d=h.upcast(d),h=h.baseClass;return o===h&&c===d},clone(){if(this.$$.ptr||ui(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var a=dt(Object.create(Object.getPrototypeOf(this),{$$:{value:Va(this.$$)}}));return a.$$.count.value+=1,a.$$.deleteScheduled=!1,a},delete(){this.$$.ptr||ui(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&X("Object already scheduled for deletion"),Nr(this),zr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||ui(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&X("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}});const r=Symbol.dispose;r&&(i[r]=i.delete)};function Bt(){}var Nt=(i,r)=>Object.defineProperty(r,"name",{value:i}),$r={},Qa=(i,r,a)=>{if(i[r].overloadTable===void 0){var o=i[r];i[r]=function(...c){return i[r].overloadTable.hasOwnProperty(c.length)||X(`Function '${a}' called with an invalid number of arguments (${c.length}) - expects one of (${i[r].overloadTable})!`),i[r].overloadTable[c.length].apply(this,c)},i[r].overloadTable=[],i[r].overloadTable[o.argCount]=o}},gi=(i,r,a)=>{t.hasOwnProperty(i)?((a===void 0||t[i].overloadTable!==void 0&&t[i].overloadTable[a]!==void 0)&&X(`Cannot register public name '${i}' twice`),Qa(t,i,i),t[i].overloadTable.hasOwnProperty(a)&&X(`Cannot register multiple overloads of a function with the same number of arguments (${a})!`),t[i].overloadTable[a]=r):(t[i]=r,t[i].argCount=a)},Ja=48,Oa=57,Za=i=>{i=i.replace(/[^a-zA-Z0-9_]/g,"$");var r=i.charCodeAt(0);return r>=Ja&&r<=Oa?`_${i}`:i};function es(i,r,a,o,c,h,d,f){this.name=i,this.constructor=r,this.instancePrototype=a,this.rawDestructor=o,this.baseClass=c,this.getActualType=h,this.upcast=d,this.downcast=f,this.pureVirtualFunctions=[]}var di=(i,r,a)=>{for(;r!==a;)r.upcast||X(`Expected null or instance of ${a.name}, got an instance of ${r.name}`),i=r.upcast(i),r=r.baseClass;return i};function ts(i,r){if(r===null)return this.isReference&&X(`null is not a valid ${this.name}`),0;r.$$||X(`Cannot pass "${Lt(r)}" as a ${this.name}`),r.$$.ptr||X(`Cannot pass deleted object as a pointer of type ${this.name}`);var a=r.$$.ptrType.registeredClass,o=di(r.$$.ptr,a,this.registeredClass);return o}function is(i,r){var a;if(r===null)return this.isReference&&X(`null is not a valid ${this.name}`),this.isSmartPointer?(a=this.rawConstructor(),i!==null&&i.push(this.rawDestructor,a),a):0;(!r||!r.$$)&&X(`Cannot pass "${Lt(r)}" as a ${this.name}`),r.$$.ptr||X(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&X(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var o=r.$$.ptrType.registeredClass;if(a=di(r.$$.ptr,o,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&X("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?a=r.$$.smartPtr:X(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:a=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)a=r.$$.smartPtr;else{var c=r.clone();a=this.rawShare(a,de.toHandle(()=>c.delete())),i!==null&&i.push(this.rawDestructor,a)}break;default:X("Unsupporting sharing policy")}return a}function rs(i,r){if(r===null)return this.isReference&&X(`null is not a valid ${this.name}`),0;r.$$||X(`Cannot pass "${Lt(r)}" as a ${this.name}`),r.$$.ptr||X(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&X(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var a=r.$$.ptrType.registeredClass,o=di(r.$$.ptr,a,this.registeredClass);return o}var Hr=(i,r,a)=>{if(r===a)return i;if(a.baseClass===void 0)return null;var o=Hr(i,r,a.baseClass);return o===null?null:a.downcast(o)},ns={},as=(i,r)=>{for(r===void 0&&X("ptr should not be undefined");i.baseClass;)r=i.upcast(r),i=i.baseClass;return r},ss=(i,r)=>(r=as(i,r),ns[r]),zt=(i,r)=>{(!r.ptrType||!r.ptr)&&xt("makeClassHandle requires ptr and ptrType");var a=!!r.smartPtrType,o=!!r.smartPtr;return a!==o&&xt("Both smartPtrType and smartPtr must be specified"),r.count={value:1},dt(Object.create(i,{$$:{value:r,writable:!0}}))};function os(i){var r=this.getPointee(i);if(!r)return this.destructor(i),null;var a=ss(this.registeredClass,r);if(a!==void 0){if(a.$$.count.value===0)return a.$$.ptr=r,a.$$.smartPtr=i,a.clone();var o=a.clone();return this.destructor(i),o}function c(){return this.isSmartPointer?zt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:i}):zt(this.registeredClass.instancePrototype,{ptrType:this,ptr:i})}var h=this.registeredClass.getActualType(r),d=$r[h];if(!d)return c.call(this);var f;this.isConst?f=d.constPointerType:f=d.pointerType;var v=Hr(r,this.registeredClass,f.registeredClass);return v===null?c.call(this):this.isSmartPointer?zt(f.registeredClass.instancePrototype,{ptrType:f,ptr:v,smartPtrType:this,smartPtr:i}):zt(f.registeredClass.instancePrototype,{ptrType:f,ptr:v})}var _s=()=>{Object.assign($t.prototype,{getPointee(i){return this.rawGetPointee&&(i=this.rawGetPointee(i)),i},destructor(i){this.rawDestructor?.(i)},argPackAdvance:we,readValueFromPointer:gt,fromWireType:os})};function $t(i,r,a,o,c,h,d,f,v,M,S){this.name=i,this.registeredClass=r,this.isReference=a,this.isConst=o,this.isSmartPointer=c,this.pointeeType=h,this.sharingPolicy=d,this.rawGetPointee=f,this.rawConstructor=v,this.rawShare=M,this.rawDestructor=S,!c&&r.baseClass===void 0?o?(this.toWireType=ts,this.destructorFunction=null):(this.toWireType=rs,this.destructorFunction=null):this.toWireType=is}var Yr=(i,r,a)=>{t.hasOwnProperty(i)||xt("Replacing nonexistent public symbol"),t[i].overloadTable!==void 0&&a!==void 0?t[i].overloadTable[a]=r:(t[i]=r,t[i].argCount=a)},cs=(i,r,a=[],o=!1)=>{var c=B(r),h=c(...a);return i[0]=="p"?h>>>0:h},ls=(i,r,a=!1)=>(...o)=>cs(i,r,o,a),Ge=(i,r,a=!1)=>{i=se(i);function o(){if(i.includes("p"))return ls(i,r,a);var h=B(r);return h}var c=o();return typeof c!="function"&&X(`unknown function pointer with signature ${i}: ${r}`),c};class us extends Error{}var Ur=i=>{var r=Yo(i),a=se(r);return Ze(r),a},Xr=(i,r)=>{var a=[],o={};function c(h){if(!o[h]&&!Oe[h]){if(Ft[h]){Ft[h].forEach(c);return}a.push(h),o[h]=!0}}throw r.forEach(c),new us(`${i}: `+a.map(Ur).join([", "]))};function hs(i,r,a,o,c,h,d,f,v,M,S,I,D){i>>>=0,r>>>=0,a>>>=0,o>>>=0,c>>>=0,h>>>=0,d>>>=0,f>>>=0,v>>>=0,M>>>=0,S>>>=0,I>>>=0,D>>>=0,S=se(S),h=Ge(c,h),f&&=Ge(d,f),M&&=Ge(v,M),D=Ge(I,D);var P=Za(S);gi(P,function(){Xr(`Cannot construct ${S} due to unbound types`,[o])}),li([i,r,a],o?[o]:[],A=>{A=A[0];var U,re;o?(U=A.registeredClass,re=U.instancePrototype):re=Bt.prototype;var Z=Nt(S,function(...ee){if(Object.getPrototypeOf(this)!==ne)throw new Wt(`Use 'new' to construct ${S}`);if(J.constructor_body===void 0)throw new Wt(`${S} has no accessible constructor`);var on=J.constructor_body[ee.length];if(on===void 0)throw new Wt(`Tried to invoke ctor of ${S} with invalid number of parameters (${ee.length}) - expected (${Object.keys(J.constructor_body).toString()}) parameters instead!`);return on.apply(this,ee)}),ne=Object.create(re,{constructor:{value:Z}});Z.prototype=ne;var J=new es(S,Z,ne,D,U,h,f,M);J.baseClass&&(J.baseClass.__derivedClasses??=[],J.baseClass.__derivedClasses.push(J));var Pe=new $t(S,J,!0,!1,!1),fe=new $t(S+"*",J,!1,!1,!1),xe=new $t(S+" const*",J,!1,!0,!1);return $r[i]={pointerType:fe,constPointerType:xe},Yr(P,Z),[Pe,fe,xe]})}var fi=[],Fe=[];function pi(i){i>>>=0,i>9&&--Fe[i+1]===0&&(Fe[i]=void 0,fi.push(i))}var gs=()=>Fe.length/2-5-fi.length,ds=()=>{Fe.push(0,1,void 0,1,null,1,!0,1,!1,1),t.count_emval_handles=gs},de={toValue:i=>(i||X(`Cannot use deleted val. handle = ${i}`),Fe[i]),toHandle:i=>{switch(i){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const r=fi.pop()||Fe.length;return Fe[r]=i,Fe[r+1]=1,r}}}},fs={name:"emscripten::val",fromWireType:i=>{var r=de.toValue(i);return pi(i),r},toWireType:(i,r)=>de.toHandle(r),argPackAdvance:we,readValueFromPointer:gt,destructorFunction:null};function ps(i){return i>>>=0,ve(i,fs)}var ms=(i,r,a)=>{switch(r){case 1:return a?function(o){return this.fromWireType(Q[o>>>0])}:function(o){return this.fromWireType(ce[o>>>0])};case 2:return a?function(o){return this.fromWireType(ge[o>>>1>>>0])}:function(o){return this.fromWireType(lt[o>>>1>>>0])};case 4:return a?function(o){return this.fromWireType(E[o>>>2>>>0])}:function(o){return this.fromWireType(W[o>>>2>>>0])};default:throw new TypeError(`invalid integer width (${r}): ${i}`)}};function vs(i,r,a,o){i>>>=0,r>>>=0,a>>>=0,r=se(r);function c(){}c.values={},ve(i,{name:r,constructor:c,fromWireType:function(h){return this.constructor.values[h]},toWireType:(h,d)=>d.value,argPackAdvance:we,readValueFromPointer:ms(r,a,o),destructorFunction:null}),gi(r,c)}var mi=(i,r)=>{var a=Oe[i];return a===void 0&&X(`${r} has unknown type ${Ur(i)}`),a};function ws(i,r,a){i>>>=0,r>>>=0;var o=mi(i,"enum");r=se(r);var c=o.constructor,h=Object.create(o.constructor.prototype,{value:{value:a},constructor:{value:Nt(`${o.name}_${r}`,function(){})}});c.values[a]=h,c[r]=h}var ks=(i,r)=>{switch(r){case 4:return function(a){return this.fromWireType(bt[a>>>2>>>0])};case 8:return function(a){return this.fromWireType(Tt[a>>>3>>>0])};default:throw new TypeError(`invalid float width (${r}): ${i}`)}},Ms=function(i,r,a){i>>>=0,r>>>=0,a>>>=0,r=se(r),ve(i,{name:r,fromWireType:o=>o,toWireType:(o,c)=>c,argPackAdvance:we,readValueFromPointer:ks(r,a),destructorFunction:null})};function ys(i){for(var r=1;r<i.length;++r)if(i[r]!==null&&i[r].destructorFunction===void 0)return!0;return!1}var Ss={ftf:function(i,r,a,o,c,h,d){return function(){var f=a(o),v=h.fromWireType(f);return v}},ftft:function(i,r,a,o,c,h,d,f,v){return function(M){var S=f.toWireType(null,M),I=a(o,S);v(S);var D=h.fromWireType(I);return D}},fffn:function(i,r,a,o,c,h,d,f){return function(v){var M=f.toWireType(null,v);a(o,M)}},ftfn:function(i,r,a,o,c,h,d,f){return function(v){var M=f.toWireType(null,v),S=a(o,M),I=h.fromWireType(S);return I}},ftfnn:function(i,r,a,o,c,h,d,f,v){return function(M,S){var I=f.toWireType(null,M),D=v.toWireType(null,S),P=a(o,I,D),A=h.fromWireType(P);return A}},ftfnnn:function(i,r,a,o,c,h,d,f,v,M){return function(S,I,D){var P=f.toWireType(null,S),A=v.toWireType(null,I),U=M.toWireType(null,D),re=a(o,P,A,U),Z=h.fromWireType(re);return Z}},ftfnt:function(i,r,a,o,c,h,d,f,v,M){return function(S,I){var D=f.toWireType(null,S),P=v.toWireType(null,I),A=a(o,D,P);M(P);var U=h.fromWireType(A);return U}}};function Cs(i,r,a,o){const c=["f",a?"t":"f",o?"t":"f"];for(let h=2;h<i.length;++h){const d=i[h];let f="";d.destructorFunction===void 0?f="u":d.destructorFunction===null?f="n":f="t",c.push(f)}return c.join("")}function Is(i,r,a,o,c,h){var d=r.length;d<2&&X("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var f=r[1]!==null&&a!==null,v=ys(r),M=r[0].name!=="void",S=[i,X,o,c,ci,r[0],r[1]],I=0;I<d-2;++I)S.push(r[I+2]);if(!v)for(var I=2;I<r.length;++I)r[I].destructorFunction!==null&&S.push(r[I].destructorFunction);var D=Cs(r,f,M,h),P=Ss[D](...S);return Nt(i,P)}var Ps=(i,r)=>{for(var a=[],o=0;o<i;o++)a.push(W[r+o*4>>>2>>>0]);return a},Ds=i=>{i=i.trim();const r=i.indexOf("(");return r===-1?i:i.slice(0,r)};function Es(i,r,a,o,c,h,d,f){i>>>=0,a>>>=0,o>>>=0,c>>>=0,h>>>=0;var v=Ps(r,a);i=se(i),i=Ds(i),c=Ge(o,c,d),gi(i,function(){Xr(`Cannot call ${i} due to unbound types`,v)},r-1),li([],v,M=>{var S=[M[0],null].concat(M.slice(1));return Yr(i,Is(i,S,null,c,h,d),r-1),[]})}function bs(i,r,a,o,c){i>>>=0,r>>>=0,a>>>=0,r=se(r);var h=S=>S;if(o===0){var d=32-8*a;h=S=>S<<d>>>d}var f=r.includes("unsigned"),v=(S,I)=>{},M;f?M=function(S,I){return v(I,this.name),I>>>0}:M=function(S,I){return v(I,this.name),I},ve(i,{name:r,fromWireType:h,toWireType:M,argPackAdvance:we,readValueFromPointer:Br(r,a,o!==0),destructorFunction:null})}function Ts(i,r,a){i>>>=0,a>>>=0;var o=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],c=o[r];function h(d){var f=W[d>>>2>>>0],v=W[d+4>>>2>>>0];return new c(Q.buffer,v,f)}a=se(a),ve(i,{name:a,fromWireType:h,argPackAdvance:we,readValueFromPointer:h},{ignoreDuplicateRegistrations:!0})}function As(i,r){i>>>=0,r>>>=0,r=se(r),ve(i,{name:r,fromWireType(a){for(var o=W[a>>>2>>>0],c=a+4,h,d,f=c,d=0;d<=o;++d){var v=c+d;if(d==o||ce[v>>>0]==0){var M=v-f,S=_i(f,M);h===void 0?h=S:(h+="\0",h+=S),f=v+1}}return Ze(a),h},toWireType(a,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var c,h=typeof o=="string";h||ArrayBuffer.isView(o)&&o.BYTES_PER_ELEMENT==1||X("Cannot pass non-string to std::string"),h?c=Qe(o):c=o.length;var d=sn(4+c+1),f=d+4;return W[d>>>2>>>0]=c,h?Ie(o,f,c+1):ce.set(o,f>>>0),a!==null&&a.push(Ze,d),d},argPackAdvance:we,readValueFromPointer:gt,destructorFunction(a){Ze(a)}})}var jr=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,Rs=(i,r)=>{for(var a=i,o=a>>1,c=o+r/2;!(o>=c)&&lt[o>>>0];)++o;if(a=o<<1,a-i>32&&jr)return jr.decode(ce.subarray(i>>>0,a>>>0));for(var h="",d=0;!(d>=r/2);++d){var f=ge[i+d*2>>>1>>>0];if(f==0)break;h+=String.fromCharCode(f)}return h},Gs=(i,r,a)=>{if(a??=2147483647,a<2)return 0;a-=2;for(var o=r,c=a<i.length*2?a/2:i.length,h=0;h<c;++h){var d=i.charCodeAt(h);ge[r>>>1>>>0]=d,r+=2}return ge[r>>>1>>>0]=0,r-o},Fs=i=>i.length*2,xs=(i,r)=>{for(var a=0,o="";!(a>=r/4);){var c=E[i+a*4>>>2>>>0];if(c==0)break;if(++a,c>=65536){var h=c-65536;o+=String.fromCharCode(55296|h>>10,56320|h&1023)}else o+=String.fromCharCode(c)}return o},Ls=(i,r,a)=>{if(r>>>=0,a??=2147483647,a<4)return 0;for(var o=r,c=o+a-4,h=0;h<i.length;++h){var d=i.charCodeAt(h);if(d>=55296&&d<=57343){var f=i.charCodeAt(++h);d=65536+((d&1023)<<10)|f&1023}if(E[r>>>2>>>0]=d,r+=4,r+4>c)break}return E[r>>>2>>>0]=0,r-o},Ws=i=>{for(var r=0,a=0;a<i.length;++a){var o=i.charCodeAt(a);o>=55296&&o<=57343&&++a,r+=4}return r},Bs=function(i,r,a){i>>>=0,r>>>=0,a>>>=0,a=se(a);var o,c,h,d;r===2?(o=Rs,c=Gs,d=Fs,h=f=>lt[f>>>1>>>0]):r===4&&(o=xs,c=Ls,d=Ws,h=f=>W[f>>>2>>>0]),ve(i,{name:a,fromWireType:f=>{for(var v=W[f>>>2>>>0],M,S=f+4,I=0;I<=v;++I){var D=f+4+I*r;if(I==v||h(D)==0){var P=D-S,A=o(S,P);M===void 0?M=A:(M+="\0",M+=A),S=D+r}}return Ze(f),M},toWireType:(f,v)=>{typeof v!="string"&&X(`Cannot pass non-string to C++ string type ${a}`);var M=d(v),S=sn(4+M+r);return W[S>>>2>>>0]=M/r,c(v,S+4,M+r),f!==null&&f.push(Ze,S),S},argPackAdvance:we,readValueFromPointer:gt,destructorFunction(f){Ze(f)}})};function Ns(i,r,a,o,c,h){i>>>=0,r>>>=0,a>>>=0,o>>>=0,c>>>=0,h>>>=0,Gt[i]={name:se(r),rawConstructor:Ge(a,o),rawDestructor:Ge(c,h),fields:[]}}function zs(i,r,a,o,c,h,d,f,v,M){i>>>=0,r>>>=0,a>>>=0,o>>>=0,c>>>=0,h>>>=0,d>>>=0,f>>>=0,v>>>=0,M>>>=0,Gt[i].fields.push({fieldName:se(r),getterReturnType:a,getter:Ge(o,c),getterContext:h,setterArgumentType:d,setter:Ge(f,v),setterContext:M})}var $s=function(i,r){i>>>=0,r>>>=0,r=se(r),ve(i,{isVoid:!0,name:r,argPackAdvance:0,fromWireType:()=>{},toWireType:(a,o)=>{}})},Vr=0,Hs=()=>{ii=!1,Vr=0};function Ys(i){return i>>>=0,i?-52:0}var Us=()=>{throw 1/0},Xs={},qr=i=>{var r=Xs[i];return r===void 0?se(i):r},vi=[];function js(i,r,a,o,c){return i>>>=0,r>>>=0,a>>>=0,o>>>=0,c>>>=0,i=vi[i],r=de.toValue(r),a=qr(a),i(r,r[a],o,c)}var Vs=i=>{var r=vi.length;return vi.push(i),r},qs=(i,r)=>{for(var a=new Array(i),o=0;o<i;++o)a[o]=mi(W[r+o*4>>>2>>>0],`parameter ${o}`);return a},Ks=(i,r,a)=>{var o=[],c=i.toWireType(o,a);return o.length&&(W[r>>>2>>>0]=de.toHandle(o)),c},Qs=Reflect.construct,Js=function(i,r,a){r>>>=0;var o=qs(i,r),c=o.shift();i--;var h=new Array(i),d=(v,M,S,I)=>{for(var D=0,P=0;P<i;++P)h[P]=o[P].readValueFromPointer(I+D),D+=o[P].argPackAdvance;var A=a===1?Qs(M,h):M.apply(v,h);return Ks(c,S,A)},f=`methodCaller<(${o.map(v=>v.name).join(", ")}) => ${c.name}>`;return Vs(Nt(f,d))};function Os(i){i>>>=0,i>9&&(Fe[i+1]+=1)}function Zs(){return de.toHandle([])}function eo(i){return i>>>=0,de.toHandle(qr(i))}function to(){return de.toHandle({})}function io(i){i>>>=0;var r=de.toValue(i);ci(r),pi(i)}function ro(i,r,a){i>>>=0,r>>>=0,a>>>=0,i=de.toValue(i),r=de.toValue(r),a=de.toValue(a),i[r]=a}function no(i,r){i>>>=0,r>>>=0,i=mi(i,"_emval_take_value");var a=i.readValueFromPointer(r);return de.toHandle(a)}function ao(i,r){i=Re(i),r>>>=0;var a=new Date(i*1e3);E[r>>>2>>>0]=a.getUTCSeconds(),E[r+4>>>2>>>0]=a.getUTCMinutes(),E[r+8>>>2>>>0]=a.getUTCHours(),E[r+12>>>2>>>0]=a.getUTCDate(),E[r+16>>>2>>>0]=a.getUTCMonth(),E[r+20>>>2>>>0]=a.getUTCFullYear()-1900,E[r+24>>>2>>>0]=a.getUTCDay();var o=Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0),c=(a.getTime()-o)/(1e3*60*60*24)|0;E[r+28>>>2>>>0]=c}var so=i=>i%4===0&&(i%100!==0||i%400===0),oo=[0,31,60,91,121,152,182,213,244,274,305,335],_o=[0,31,59,90,120,151,181,212,243,273,304,334],Kr=i=>{var r=so(i.getFullYear()),a=r?oo:_o,o=a[i.getMonth()]+i.getDate()-1;return o};function co(i,r){i=Re(i),r>>>=0;var a=new Date(i*1e3);E[r>>>2>>>0]=a.getSeconds(),E[r+4>>>2>>>0]=a.getMinutes(),E[r+8>>>2>>>0]=a.getHours(),E[r+12>>>2>>>0]=a.getDate(),E[r+16>>>2>>>0]=a.getMonth(),E[r+20>>>2>>>0]=a.getFullYear()-1900,E[r+24>>>2>>>0]=a.getDay();var o=Kr(a)|0;E[r+28>>>2>>>0]=o,E[r+36>>>2>>>0]=-(a.getTimezoneOffset()*60);var c=new Date(a.getFullYear(),0,1),h=new Date(a.getFullYear(),6,1).getTimezoneOffset(),d=c.getTimezoneOffset(),f=(h!=d&&a.getTimezoneOffset()==Math.min(d,h))|0;E[r+32>>>2>>>0]=f}var lo=function(i){i>>>=0;var r=(()=>{var a=new Date(E[i+20>>>2>>>0]+1900,E[i+16>>>2>>>0],E[i+12>>>2>>>0],E[i+8>>>2>>>0],E[i+4>>>2>>>0],E[i>>>2>>>0],0),o=E[i+32>>>2>>>0],c=a.getTimezoneOffset(),h=new Date(a.getFullYear(),0,1),d=new Date(a.getFullYear(),6,1).getTimezoneOffset(),f=h.getTimezoneOffset(),v=Math.min(f,d);if(o<0)E[i+32>>>2>>>0]=+(d!=f&&v==c);else if(o>0!=(v==c)){var M=Math.max(f,d),S=o>0?v:M;a.setTime(a.getTime()+(S-c)*6e4)}E[i+24>>>2>>>0]=a.getDay();var I=Kr(a)|0;E[i+28>>>2>>>0]=I,E[i>>>2>>>0]=a.getSeconds(),E[i+4>>>2>>>0]=a.getMinutes(),E[i+8>>>2>>>0]=a.getHours(),E[i+12>>>2>>>0]=a.getDate(),E[i+16>>>2>>>0]=a.getMonth(),E[i+20>>>2>>>0]=a.getYear();var D=a.getTime();return isNaN(D)?-1:D/1e3})();return BigInt(r)};function uo(i,r,a,o,c,h,d){i>>>=0,c=Re(c),h>>>=0,d>>>=0;try{if(isNaN(c))return 61;var f=F.getStreamFromFD(o),v=u.mmap(f,i,c,r,a),M=v.ptr;return E[h>>>2>>>0]=v.allocated,W[d>>>2>>>0]=M,0}catch(S){if(typeof u>"u"||S.name!=="ErrnoError")throw S;return-S.errno}}function ho(i,r,a,o,c,h){i>>>=0,r>>>=0,h=Re(h);try{var d=F.getStreamFromFD(c);a&2&&F.doMsync(i,d,r,o,h)}catch(f){if(typeof u>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}var go=function(i,r,a,o){i>>>=0,r>>>=0,a>>>=0,o>>>=0;var c=new Date().getFullYear(),h=new Date(c,0,1),d=new Date(c,6,1),f=h.getTimezoneOffset(),v=d.getTimezoneOffset(),M=Math.max(f,v);W[i>>>2>>>0]=M*60,E[r>>>2>>>0]=+(f!=v);var S=P=>{var A=P>=0?"-":"+",U=Math.abs(P),re=String(Math.floor(U/60)).padStart(2,"0"),Z=String(U%60).padStart(2,"0");return`UTC${A}${re}${Z}`},I=S(f),D=S(v);v<f?(Ie(I,a,17),Ie(D,o,17)):(Ie(I,o,17),Ie(D,a,17))},Qr=()=>performance.now(),Jr=()=>Date.now(),fo=i=>i>=0&&i<=3;function po(i,r,a){if(a>>>=0,!fo(i))return 28;var o;i===0?o=Jr():o=Qr();var c=Math.round(o*1e3*1e3);return le[a>>>3]=BigInt(c),0}var Or=()=>4294901760;function mo(){return Or()}var vo=i=>{var r=Et.buffer,a=(i-r.byteLength+65535)/65536|0;try{return Et.grow(a),Pr(),1}catch{}};function wo(i){i>>>=0;var r=ce.length,a=Or();if(i>a)return!1;for(var o=1;o<=4;o*=2){var c=r*(1+.2/o);c=Math.min(c,i+100663296);var h=Math.min(a,Fr(Math.max(i,c),65536)),d=vo(h);if(d)return!0}return!1}var wi={},ko=()=>G||"./this.program",ft=()=>{if(!ft.strings){var i=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:i,_:ko()};for(var a in wi)wi[a]===void 0?delete r[a]:r[a]=wi[a];var o=[];for(var a in r)o.push(`${a}=${r[a]}`);ft.strings=o}return ft.strings};function Mo(i,r){i>>>=0,r>>>=0;var a=0,o=0;for(var c of ft()){var h=r+a;W[i+o>>>2>>>0]=h,a+=Ie(c,h,1/0)+1,o+=4}return 0}function yo(i,r){i>>>=0,r>>>=0;var a=ft();W[i>>>2>>>0]=a.length;var o=0;for(var c of a)o+=Qe(c)+1;return W[r>>>2>>>0]=o,0}var So=()=>ii||Vr>0,Zr=i=>{So()||(t.onExit?.(i),Zt=!0),Y(i,new ta(i))},Co=(i,r)=>{Zr(i)},Io=Co;function Po(i){try{var r=F.getStreamFromFD(i);return u.close(r),0}catch(a){if(typeof u>"u"||a.name!=="ErrnoError")throw a;return a.errno}}function Do(i,r){r>>>=0;try{var a=0,o=0,c=0,h=F.getStreamFromFD(i),d=h.tty?2:u.isDir(h.mode)?3:u.isLink(h.mode)?7:4;return Q[r>>>0]=d,ge[r+2>>>1>>>0]=c,le[r+8>>>3]=BigInt(a),le[r+16>>>3]=BigInt(o),0}catch(f){if(typeof u>"u"||f.name!=="ErrnoError")throw f;return f.errno}}var en=(i,r,a,o)=>{for(var c=0,h=0;h<a;h++){var d=W[r>>>2>>>0],f=W[r+4>>>2>>>0];r+=8;var v=u.read(i,Q,d,f,o);if(v<0)return-1;if(c+=v,v<f)break;typeof o<"u"&&(o+=v)}return c};function Eo(i,r,a,o,c){r>>>=0,a>>>=0,o=Re(o),c>>>=0;try{if(isNaN(o))return 61;var h=F.getStreamFromFD(i),d=en(h,r,a,o);return W[c>>>2>>>0]=d,0}catch(f){if(typeof u>"u"||f.name!=="ErrnoError")throw f;return f.errno}}var tn=(i,r,a,o)=>{for(var c=0,h=0;h<a;h++){var d=W[r>>>2>>>0],f=W[r+4>>>2>>>0];r+=8;var v=u.write(i,Q,d,f,o);if(v<0)return-1;if(c+=v,v<f)break;typeof o<"u"&&(o+=v)}return c};function bo(i,r,a,o,c){r>>>=0,a>>>=0,o=Re(o),c>>>=0;try{if(isNaN(o))return 61;var h=F.getStreamFromFD(i),d=tn(h,r,a,o);return W[c>>>2>>>0]=d,0}catch(f){if(typeof u>"u"||f.name!=="ErrnoError")throw f;return f.errno}}function To(i,r,a,o){r>>>=0,a>>>=0,o>>>=0;try{var c=F.getStreamFromFD(i),h=en(c,r,a);return W[o>>>2>>>0]=h,0}catch(d){if(typeof u>"u"||d.name!=="ErrnoError")throw d;return d.errno}}function Ao(i,r,a,o){r=Re(r),o>>>=0;try{if(isNaN(r))return 61;var c=F.getStreamFromFD(i);return u.llseek(c,r,a),le[o>>>3]=BigInt(c.position),c.getdents&&r===0&&a===0&&(c.getdents=null),0}catch(h){if(typeof u>"u"||h.name!=="ErrnoError")throw h;return h.errno}}function Ro(i){try{var r=F.getStreamFromFD(i);return r.stream_ops?.fsync?r.stream_ops.fsync(r):0}catch(a){if(typeof u>"u"||a.name!=="ErrnoError")throw a;return a.errno}}function Go(i,r,a,o){r>>>=0,a>>>=0,o>>>=0;try{var c=F.getStreamFromFD(i),h=tn(c,r,a);return W[o>>>2>>>0]=h,0}catch(d){if(typeof u>"u"||d.name!=="ErrnoError")throw d;return d.errno}}function Fo(i,r){i>>>=0,r>>>=0;try{return ni(ce.subarray(i>>>0,i+r>>>0)),0}catch(a){if(typeof u>"u"||a.name!=="ErrnoError")throw a;return a.errno}}var rn=(i,r)=>{i<128?r.push(i):r.push(i%128|128,i>>7)},xo=i=>{for(var r={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"},a={parameters:[],results:i[0]=="v"?[]:[r[i[0]]]},o=1;o<i.length;++o)a.parameters.push(r[i[o]]);return a},Lo=(i,r)=>{var a=i.slice(0,1),o=i.slice(1),c={i:127,p:127,j:126,f:125,d:124,e:111};r.push(96),rn(o.length,r);for(var h of o)r.push(c[h]);a=="v"?r.push(0):r.push(1,c[a])},Wo=(i,r)=>{if(typeof WebAssembly.Function=="function")return new WebAssembly.Function(xo(r),i);var a=[1];Lo(r,a);var o=[0,97,115,109,1,0,0,0,1];rn(a.length,o),o.push(...a),o.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var c=new WebAssembly.Module(new Uint8Array(o)),h=new WebAssembly.Instance(c,{e:{f:i}}),d=h.exports.f;return d},Bo=(i,r)=>{if(ot)for(var a=i;a<i+r;a++){var o=B(a);o&&ot.set(o,a)}},ot,No=i=>(ot||(ot=new WeakMap,Bo(0,Ke.length)),ot.get(i)||0),nn=[],zo=()=>{if(nn.length)return nn.pop();try{Ke.grow(1)}catch(i){throw i instanceof RangeError?"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.":i}return Ke.length-1},an=(i,r)=>{Ke.set(i,r),ri[i]=Ke.get(i)},$o=(i,r)=>{var a=No(i);if(a)return a;var o=zo();try{an(o,i)}catch(h){if(!(h instanceof TypeError))throw h;var c=Wo(i,r);an(o,c)}return ot.set(i,o),o};u.createPreloadedFile=wa,u.staticInit(),L.doesNotExistError=new u.ErrnoError(44),L.doesNotExistError.stack="<generic error, no stack>",Ya(),Ka(),_s(),ds(),t.noExitRuntime&&(ii=t.noExitRuntime),t.preloadPlugins&&(Lr=t.preloadPlugins),t.print&&(ze=t.print),t.printErr&&(Ce=t.printErr),t.wasmBinary&&(Ve=t.wasmBinary),t.arguments&&t.arguments,t.thisProgram&&(G=t.thisProgram),t.addFunction=$o,t.setValue=aa,t.getValue=na,t.UTF8ToString=_i,t.stringToUTF8=Ie,t.lengthBytesUTF8=Qe,t.FS=u;var Ho={Z:_a,D:la,a:ua,C:ha,ua:Ma,sa:ya,va:Sa,ba:Ca,ra:Ia,H:Pa,qa:Da,la:Ea,bb:ba,ya:Ta,na:Aa,oa:Ra,F:Ga,ab:Fa,_a:xa,$a:La,pa:Wa,Za:Ba,Y:Na,wa:za,Na:Ha,S:Xa,Ha:ja,L:hs,Fa:ps,x:vs,e:ws,R:Ms,p:Es,w:bs,n:Ts,Ga:As,J:Bs,Oa:Ns,K:zs,Ia:$s,_:Hs,Xa:Ys,Va:Us,Ka:js,l:pi,La:Js,Ma:Os,T:Zs,t:eo,B:to,Ja:io,r:ro,o:no,ea:ao,fa:co,ga:lo,ca:uo,da:ho,ia:go,ta:po,O:Jr,Ya:mo,E:Qr,Wa:wo,za:Mo,Aa:yo,y:Io,z:Po,N:Do,aa:Eo,$:bo,P:To,ja:Ao,ma:Ro,G:Go,Sa:h_,A:__,c:Oo,d:Jo,g:Qo,j:i_,X:u_,b:s_,M:f_,m:a_,Ra:p_,Qa:w_,Ea:S_,Da:C_,s:o_,Ua:c_,I:I_,u:n_,ha:r_,v:g_,k:Zo,f:e_,W:m_,V:v_,i:Ko,h:t_,q:d_,Pa:M_,Q:y_,Ca:P_,U:k_,Ba:D_,Ta:l_,xa:Zr,ka:Fo},s=await ea();s.db;var Yo=s.eb;t._MagickColor_Create=s.fb,t._MagickColor_Dispose=s.gb,t._MagickColor_Count_Get=s.hb,t._MagickColor_Red_Get=s.ib,t._MagickColor_Red_Set=s.jb,t._MagickColor_Green_Get=s.kb,t._MagickColor_Green_Set=s.lb,t._MagickColor_Blue_Get=s.mb,t._MagickColor_Blue_Set=s.nb,t._MagickColor_Alpha_Get=s.ob,t._MagickColor_Alpha_Set=s.pb,t._MagickColor_Black_Get=s.qb,t._MagickColor_Black_Set=s.rb,t._MagickColor_IsCMYK_Get=s.sb,t._MagickColor_IsCMYK_Set=s.tb,t._MagickColor_Clone=s.ub,t._MagickColor_FuzzyEquals=s.vb,t._MagickColor_Initialize=s.wb,t._MagickColorCollection_DisposeList=s.yb,t._MagickColorCollection_GetInstance=s.zb,t._DrawingWand_Create=s.Ab,t._DrawingWand_Dispose=s.Bb,t._DrawingWand_Affine=s.Cb,t._DrawingWand_Alpha=s.Db,t._DrawingWand_Arc=s.Eb,t._DrawingWand_Bezier=s.Fb,t._DrawingWand_BorderColor=s.Gb,t._DrawingWand_Circle=s.Hb,t._DrawingWand_ClipPath=s.Ib,t._DrawingWand_ClipRule=s.Jb,t._DrawingWand_ClipUnits=s.Kb,t._DrawingWand_Color=s.Lb,t._DrawingWand_Composite=s.Mb,t._DrawingWand_Density=s.Nb,t._DrawingWand_Ellipse=s.Ob,t._DrawingWand_FillColor=s.Pb,t._DrawingWand_FillOpacity=s.Qb,t._DrawingWand_FillPatternUrl=s.Rb,t._DrawingWand_FillRule=s.Sb,t._DrawingWand_Font=s.Tb,t._DrawingWand_FontFamily=s.Ub,t._DrawingWand_FontPointSize=s.Vb,t._DrawingWand_FontTypeMetrics=s.Wb,t._TypeMetric_Create=s.Xb,t._DrawingWand_Gravity=s.Yb,t._DrawingWand_Line=s.Zb,t._DrawingWand_PathArcAbs=s._b,t._DrawingWand_PathArcRel=s.$b,t._DrawingWand_PathClose=s.ac,t._DrawingWand_PathCurveToAbs=s.bc,t._DrawingWand_PathCurveToRel=s.cc,t._DrawingWand_PathFinish=s.dc,t._DrawingWand_PathLineToAbs=s.ec,t._DrawingWand_PathLineToHorizontalAbs=s.fc,t._DrawingWand_PathLineToHorizontalRel=s.gc,t._DrawingWand_PathLineToRel=s.hc,t._DrawingWand_PathLineToVerticalAbs=s.ic,t._DrawingWand_PathLineToVerticalRel=s.jc,t._DrawingWand_PathMoveToAbs=s.kc,t._DrawingWand_PathMoveToRel=s.lc,t._DrawingWand_PathQuadraticCurveToAbs=s.mc,t._DrawingWand_PathQuadraticCurveToRel=s.nc,t._DrawingWand_PathSmoothCurveToAbs=s.oc,t._DrawingWand_PathSmoothCurveToRel=s.pc,t._DrawingWand_PathSmoothQuadraticCurveToAbs=s.qc,t._DrawingWand_PathSmoothQuadraticCurveToRel=s.rc,t._DrawingWand_PathStart=s.sc,t._DrawingWand_Point=s.tc,t._DrawingWand_Polygon=s.uc,t._DrawingWand_Polyline=s.vc,t._DrawingWand_PopClipPath=s.wc,t._DrawingWand_PopGraphicContext=s.xc,t._DrawingWand_PopPattern=s.yc,t._DrawingWand_PushClipPath=s.zc,t._DrawingWand_PushGraphicContext=s.Ac,t._DrawingWand_PushPattern=s.Bc,t._DrawingWand_Rectangle=s.Cc,t._DrawingWand_Render=s.Dc,t._DrawingWand_Rotation=s.Ec,t._DrawingWand_RoundRectangle=s.Fc,t._DrawingWand_Scaling=s.Gc,t._DrawingWand_SkewX=s.Hc,t._DrawingWand_SkewY=s.Ic,t._DrawingWand_StrokeAntialias=s.Jc,t._DrawingWand_StrokeColor=s.Kc,t._DrawingWand_StrokeDashArray=s.Lc,t._DrawingWand_StrokeDashOffset=s.Mc,t._DrawingWand_StrokeLineCap=s.Nc,t._DrawingWand_StrokeLineJoin=s.Oc,t._DrawingWand_StrokeMiterLimit=s.Pc,t._DrawingWand_StrokeOpacity=s.Qc,t._DrawingWand_StrokePatternUrl=s.Rc,t._DrawingWand_StrokeWidth=s.Sc,t._DrawingWand_Text=s.Tc,t._DrawingWand_TextAlignment=s.Uc,t._DrawingWand_TextAntialias=s.Vc,t._DrawingWand_TextDecoration=s.Wc,t._DrawingWand_TextDirection=s.Xc,t._DrawingWand_TextEncoding=s.Yc,t._DrawingWand_TextInterlineSpacing=s.Zc,t._DrawingWand_TextInterwordSpacing=s._c,t._DrawingWand_TextKerning=s.$c,t._DrawingWand_TextUnderColor=s.ad,t._DrawingWand_Translation=s.bd,t._DrawingWand_Viewbox=s.cd,t._MagickExceptionHelper_Description=s.dd,t._MagickExceptionHelper_Dispose=s.ed,t._MagickExceptionHelper_Related=s.fd,t._MagickExceptionHelper_RelatedCount=s.gd,t._MagickExceptionHelper_Message=s.hd,t._MagickExceptionHelper_Severity=s.id,t._PdfInfo_PageCount=s.jd,t._Environment_Initialize=s.kd,t._Environment_GetEnv=s.ld,t._Environment_SetEnv=s.md,t._MagickMemory_Relinquish=s.nd,t._Magick_Delegates_Get=s.od,t._Magick_Features_Get=s.pd,t._Magick_ImageMagickVersion_Get=s.qd,t._Magick_GetFonts=s.rd,t._Magick_GetFontFamily=s.sd,t._Magick_GetFontName=s.td,t._Magick_GetWindowsResource=s.ud,t._Magick_DisposeFonts=s.vd,t._Magick_ResetRandomSeed=s.wd,t._Magick_SetDefaultFontFile=s.xd,t._Magick_SetRandomSeed=s.yd,t._Magick_SetLogDelegate=s.zd,t._Magick_SetLogEvents=s.Ad,t._MagickFormatInfo_CreateList=s.Bd,t._MagickFormatInfo_DisposeList=s.Cd,t._MagickFormatInfo_CanReadMultithreaded_Get=s.Dd,t._MagickFormatInfo_CanWriteMultithreaded_Get=s.Ed,t._MagickFormatInfo_Description_Get=s.Fd,t._MagickFormatInfo_Format_Get=s.Gd,t._MagickFormatInfo_MimeType_Get=s.Hd,t._MagickFormatInfo_Module_Get=s.Id,t._MagickFormatInfo_SupportsMultipleFrames_Get=s.Jd,t._MagickFormatInfo_SupportsReading_Get=s.Kd,t._MagickFormatInfo_SupportsWriting_Get=s.Ld,t._MagickFormatInfo_GetInfo=s.Md,t._MagickFormatInfo_GetInfoByName=s.Nd,t._MagickFormatInfo_GetInfoWithBlob=s.Od,t._MagickFormatInfo_Unregister=s.Pd,t._MagickImage_Create=s.Qd,t._MagickImage_Dispose=s.Rd,t._MagickImage_AnimationDelay_Get=s.Sd,t._MagickImage_AnimationDelay_Set=s.Td,t._MagickImage_AnimationIterations_Get=s.Ud,t._MagickImage_AnimationIterations_Set=s.Vd,t._MagickImage_AnimationTicksPerSecond_Get=s.Wd,t._MagickImage_AnimationTicksPerSecond_Set=s.Xd,t._MagickImage_BackgroundColor_Get=s.Yd,t._MagickImage_BackgroundColor_Set=s.Zd,t._MagickImage_BaseHeight_Get=s._d,t._MagickImage_BaseWidth_Get=s.$d,t._MagickImage_BlackPointCompensation_Get=s.ae,t._MagickImage_BlackPointCompensation_Set=s.be,t._MagickImage_BorderColor_Get=s.ce,t._MagickImage_BorderColor_Set=s.de,t._MagickImage_BoundingBox_Get=s.ee,t._MagickRectangle_Create=s.fe,t._MagickImage_ChannelCount_Get=s.ge,t._MagickImage_ChromaBlue_Get=s.he,t._PrimaryInfo_Create=s.ie,t._MagickImage_ChromaBlue_Set=s.je,t._MagickImage_ChromaGreen_Get=s.ke,t._MagickImage_ChromaGreen_Set=s.le,t._MagickImage_ChromaRed_Get=s.me,t._MagickImage_ChromaRed_Set=s.ne,t._MagickImage_ChromaWhite_Get=s.oe,t._MagickImage_ChromaWhite_Set=s.pe,t._MagickImage_ClassType_Get=s.qe,t._MagickImage_ClassType_Set=s.re,t._QuantizeSettings_Create=s.se,t._QuantizeSettings_Dispose=s.te,t._MagickImage_ColorFuzz_Get=s.ue,t._MagickImage_ColorFuzz_Set=s.ve,t._MagickImage_ColormapSize_Get=s.we,t._MagickImage_ColormapSize_Set=s.xe,t._MagickImage_ColorSpace_Get=s.ye,t._MagickImage_ColorSpace_Set=s.ze,t._MagickImage_ColorType_Get=s.Ae,t._MagickImage_ColorType_Set=s.Be,t._MagickImage_Compose_Get=s.Ce,t._MagickImage_Compose_Set=s.De,t._MagickImage_Compression_Get=s.Ee,t._MagickImage_Compression_Set=s.Fe,t._MagickImage_Depth_Get=s.Ge,t._MagickImage_Depth_Set=s.He,t._MagickImage_EncodingGeometry_Get=s.Ie,t._MagickImage_Endian_Get=s.Je,t._MagickImage_Endian_Set=s.Ke,t._MagickImage_FileName_Get=s.Le,t._MagickImage_FileName_Set=s.Me,t._MagickImage_FilterType_Get=s.Ne,t._MagickImage_FilterType_Set=s.Oe,t._MagickImage_Format_Get=s.Pe,t._MagickImage_Format_Set=s.Qe,t._MagickImage_Gamma_Get=s.Re,t._MagickImage_GifDisposeMethod_Get=s.Se,t._MagickImage_GifDisposeMethod_Set=s.Te,t._MagickImage_HasAlpha_Get=s.Ue,t._MagickImage_HasAlpha_Set=s.Ve,t._MagickImage_Height_Get=s.We,t._MagickImage_Interlace_Get=s.Xe,t._MagickImage_Interlace_Set=s.Ye,t._MagickImage_Interpolate_Get=s.Ze,t._MagickImage_Interpolate_Set=s._e,t._MagickImage_IsOpaque_Get=s.$e,t._MagickImage_MatteColor_Get=s.af,t._MagickImage_MatteColor_Set=s.bf,t._MagickImage_MeanErrorPerPixel_Get=s.cf,t._MagickImage_MetaChannelCount_Get=s.df,t._MagickImage_MetaChannelCount_Set=s.ef,t._MagickImage_NormalizedMaximumError_Get=s.ff,t._MagickImage_NormalizedMeanError_Get=s.gf,t._MagickImage_Orientation_Get=s.hf,t._MagickImage_Orientation_Set=s.jf,t._MagickImage_Page_Get=s.kf,t._MagickImage_Page_Set=s.lf,t._MagickImage_Quality_Get=s.mf,t._MagickImage_Quality_Set=s.nf,t._MagickImage_RenderingIntent_Get=s.of,t._MagickImage_RenderingIntent_Set=s.pf,t._MagickImage_ResolutionUnits_Get=s.qf,t._MagickImage_ResolutionUnits_Set=s.rf,t._MagickImage_ResolutionX_Get=s.sf,t._MagickImage_ResolutionX_Set=s.tf,t._MagickImage_ResolutionY_Get=s.uf,t._MagickImage_ResolutionY_Set=s.vf,t._MagickImage_Signature_Get=s.wf,t._MagickImage_TotalColors_Get=s.xf,t._MagickImage_VirtualPixelMethod_Get=s.yf,t._MagickImage_VirtualPixelMethod_Set=s.zf,t._MagickImage_Width_Get=s.Af,t._MagickImage_AdaptiveBlur=s.Bf,t._MagickImage_AdaptiveResize=s.Cf,t._MagickImage_AdaptiveSharpen=s.Df,t._MagickImage_AdaptiveThreshold=s.Ef,t._MagickImage_AddNoise=s.Ff,t._MagickImage_AffineTransform=s.Gf,t._MagickImage_Annotate=s.Hf,t._MagickImage_AutoGamma=s.If,t._MagickImage_AutoLevel=s.Jf,t._MagickImage_AutoOrient=s.Kf,t._MagickImage_AutoThreshold=s.Lf,t._MagickImage_BilateralBlur=s.Mf,t._MagickImage_BlackThreshold=s.Nf,t._MagickImage_BlueShift=s.Of,t._MagickImage_Blur=s.Pf,t._MagickImage_Border=s.Qf,t._MagickImage_BrightnessContrast=s.Rf,t._MagickImage_CannyEdge=s.Sf,t._MagickImage_ChannelOffset=s.Tf,t._MagickImage_Charcoal=s.Uf,t._MagickImage_Chop=s.Vf,t._MagickImage_Clahe=s.Wf,t._MagickImage_Clamp=s.Xf,t._MagickImage_ClipPath=s.Yf,t._MagickImage_Clone=s.Zf,t._MagickImage_CloneArea=s._f,t._MagickImage_Clut=s.$f,t._MagickImage_ColorDecisionList=s.ag,t._MagickImage_Colorize=s.bg,t._MagickImage_ColorMatrix=s.cg,t._MagickImage_ColorThreshold=s.dg,t._MagickImage_Compare=s.eg,t._MagickImage_CompareDistortion=s.fg,t._MagickImage_Composite=s.gg,t._MagickImage_CompositeGravity=s.hg,t._MagickImage_ConnectedComponents=s.ig,t._MagickImage_Contrast=s.jg,t._MagickImage_ContrastStretch=s.kg,t._MagickImage_ConvexHull=s.lg,t._MagickImage_Convolve=s.mg,t._MagickImage_CopyPixels=s.ng,t._MagickImage_Crop=s.og,t._MagickImage_CropToTiles=s.pg,t._MagickImage_CycleColormap=s.qg,t._MagickImage_Decipher=s.rg,t._MagickImage_Deskew=s.sg,t._MagickImage_Despeckle=s.tg,t._MagickImage_DetermineBitDepth=s.ug,t._MagickImage_DetermineColorType=s.vg,t._MagickImage_Distort=s.wg,t._MagickImage_Edge=s.xg,t._MagickImage_Emboss=s.yg,t._MagickImage_Encipher=s.zg,t._MagickImage_Enhance=s.Ag,t._MagickImage_Equalize=s.Bg,t._MagickImage_Equals=s.Cg,t._MagickImage_EvaluateFunction=s.Dg,t._MagickImage_EvaluateGeometry=s.Eg,t._MagickImage_EvaluateOperator=s.Fg,t._MagickImage_Extent=s.Gg,t._MagickImage_Flip=s.Hg,t._MagickImage_FloodFill=s.Ig,t._MagickImage_Flop=s.Jg,t._MagickImage_FontTypeMetrics=s.Kg,t._MagickImage_FormatExpression=s.Lg,t._MagickImage_Frame=s.Mg,t._MagickImage_Fx=s.Ng,t._MagickImage_GammaCorrect=s.Og,t._MagickImage_GaussianBlur=s.Pg,t._MagickImage_GetArtifact=s.Qg,t._MagickImage_GetAttribute=s.Rg,t._MagickImage_GetColormapColor=s.Sg,t._MagickImage_GetNext=s.Tg,t._MagickImage_GetNextArtifactName=s.Ug,t._MagickImage_GetNextAttributeName=s.Vg,t._MagickImage_GetNextProfileName=s.Wg,t._MagickImage_GetProfile=s.Xg,t._MagickImage_GetReadMask=s.Yg,t._MagickImage_GetWriteMask=s.Zg,t._MagickImage_Grayscale=s._g,t._MagickImage_HaldClut=s.$g,t._MagickImage_HasChannel=s.ah,t._MagickImage_HasProfile=s.bh,t._MagickImage_Histogram=s.ch,t._MagickImage_HoughLine=s.dh,t._MagickImage_Implode=s.eh,t._MagickImage_ImportPixels=s.fh,t._MagickImage_Integral=s.gh,t._MagickImage_InterpolativeResize=s.hh,t._MagickImage_InverseLevel=s.ih,t._MagickImage_Kmeans=s.jh,t._MagickImage_Kuwahara=s.kh,t._MagickImage_Level=s.lh,t._MagickImage_LevelColors=s.mh,t._MagickImage_LinearStretch=s.nh,t._MagickImage_LiquidRescale=s.oh,t._MagickImage_LocalContrast=s.ph,t._MagickImage_Magnify=s.qh,t._MagickImage_MeanShift=s.rh,t._MagickImage_Minify=s.sh,t._MagickImage_MinimumBoundingBox=s.th,t._MagickImage_Modulate=s.uh,t._MagickImage_Moments=s.vh,t._MagickImage_Morphology=s.wh,t._MagickImage_MotionBlur=s.xh,t._MagickImage_Negate=s.yh,t._MagickImage_Normalize=s.zh,t._MagickImage_OilPaint=s.Ah,t._MagickImage_Opaque=s.Bh,t._MagickImage_OrderedDither=s.Ch,t._MagickImage_Perceptible=s.Dh,t._MagickImage_PerceptualHash=s.Eh,t._MagickImage_Quantize=s.Fh,t._MagickImage_Polaroid=s.Gh,t._MagickImage_Posterize=s.Hh,t._MagickImage_RaiseOrLower=s.Ih,t._MagickImage_RandomThreshold=s.Jh,t._MagickImage_RangeThreshold=s.Kh,t._MagickImage_ReadBlob=s.Lh,t._MagickImage_ReadFile=s.Mh,t._MagickImage_ReadPixels=s.Nh,t._MagickImage_ReadStream=s.Oh,t._MagickImage_RegionMask=s.Ph,t._MagickImage_Remap=s.Qh,t._MagickImage_RemoveArtifact=s.Rh,t._MagickImage_RemoveAttribute=s.Sh,t._MagickImage_RemoveProfile=s.Th,t._MagickImage_ResetArtifactIterator=s.Uh,t._MagickImage_ResetAttributeIterator=s.Vh,t._MagickImage_ResetProfileIterator=s.Wh,t._MagickImage_Resample=s.Xh,t._MagickImage_Resize=s.Yh,t._MagickImage_Roll=s.Zh,t._MagickImage_Rotate=s._h,t._MagickImage_RotationalBlur=s.$h,t._MagickImage_Sample=s.ai,t._MagickImage_Scale=s.bi,t._MagickImage_Segment=s.ci,t._MagickImage_SelectiveBlur=s.di,t._MagickImage_Separate=s.ei,t._MagickImage_SepiaTone=s.fi,t._MagickImage_SetAlpha=s.gi,t._MagickImage_SetArtifact=s.hi,t._MagickImage_SetAttribute=s.ii,t._MagickImage_SetBitDepth=s.ji,t._MagickImage_SetClientData=s.ki,t._MagickImage_SetColormapColor=s.li,t._MagickImage_SetColorMetric=s.mi,t._MagickImage_SetNext=s.ni,t._MagickImage_SetProfile=s.oi,t._MagickImage_SetProgressDelegate=s.pi,t._MagickImage_SetReadMask=s.qi,t._MagickImage_SetWriteMask=s.ri,t._MagickImage_Shade=s.si,t._MagickImage_Shadow=s.ti,t._MagickImage_Sharpen=s.ui,t._MagickImage_Shave=s.vi,t._MagickImage_Shear=s.wi,t._MagickImage_SigmoidalContrast=s.xi,t._MagickImage_SparseColor=s.yi,t._MagickImage_Spread=s.zi,t._MagickImage_Sketch=s.Ai,t._MagickImage_Solarize=s.Bi,t._MagickImage_SortPixels=s.Ci,t._MagickImage_Splice=s.Di,t._MagickImage_Statistic=s.Ei,t._MagickImage_Statistics=s.Fi,t._MagickImage_Stegano=s.Gi,t._MagickImage_Stereo=s.Hi,t._MagickImage_Strip=s.Ii,t._MagickImage_SubImageSearch=s.Ji,t._MagickImage_Swirl=s.Ki,t._MagickImage_Texture=s.Li,t._MagickImage_Threshold=s.Mi,t._MagickImage_Thumbnail=s.Ni,t._MagickImage_Tint=s.Oi,t._MagickImage_Transparent=s.Pi,t._MagickImage_TransparentChroma=s.Qi,t._MagickImage_Transpose=s.Ri,t._MagickImage_Transverse=s.Si,t._MagickImage_Trim=s.Ti,t._MagickImage_UniqueColors=s.Ui,t._MagickImage_UnsharpMask=s.Vi,t._MagickImage_Vignette=s.Wi,t._MagickImage_Wave=s.Xi,t._MagickImage_WaveletDenoise=s.Yi,t._MagickImage_WhiteBalance=s.Zi,t._MagickImage_WhiteThreshold=s._i,t._MagickImage_WriteBlob=s.$i,t._MagickImage_WriteFile=s.aj,t._MagickImage_WriteStream=s.bj,t._MagickImageCollection_Append=s.cj,t._MagickImageCollection_Coalesce=s.dj,t._MagickImageCollection_Combine=s.ej,t._MagickImageCollection_Complex=s.fj,t._MagickImageCollection_Deconstruct=s.gj,t._MagickImageCollection_Dispose=s.hj,t._MagickImageCollection_Evaluate=s.ij,t._MagickImageCollection_Fx=s.jj,t._MagickImageCollection_Merge=s.kj,t._MagickImageCollection_Montage=s.lj,t._MagickImageCollection_Morph=s.mj,t._MagickImageCollection_Optimize=s.nj,t._MagickImageCollection_OptimizePlus=s.oj,t._MagickImageCollection_OptimizeTransparency=s.pj,t._MagickImageCollection_Polynomial=s.qj,t._MagickImageCollection_Quantize=s.rj,t._MagickImageCollection_ReadBlob=s.sj,t._MagickImageCollection_ReadFile=s.tj,t._MagickImageCollection_ReadStream=s.uj,t._MagickImageCollection_Remap=s.vj,t._MagickImageCollection_Smush=s.wj,t._MagickImageCollection_WriteFile=s.xj,t._MagickImageCollection_WriteStream=s.yj,t._DoubleMatrix_Create=s.zj,t._DoubleMatrix_Dispose=s.Aj,t._OpenCL_GetDevices=s.Bj,t._OpenCL_GetDevice=s.Cj,t._OpenCL_GetEnabled=s.Dj,t._OpenCL_SetEnabled=s.Ej,t._OpenCLDevice_DeviceType_Get=s.Fj,t._OpenCLDevice_BenchmarkScore_Get=s.Gj,t._OpenCLDevice_IsEnabled_Get=s.Hj,t._OpenCLDevice_IsEnabled_Set=s.Ij,t._OpenCLDevice_Name_Get=s.Jj,t._OpenCLDevice_Version_Get=s.Kj,t._OpenCLDevice_GetKernelProfileRecords=s.Lj,t._OpenCLDevice_GetKernelProfileRecord=s.Mj,t._OpenCLDevice_SetProfileKernels=s.Nj,t._OpenCLKernelProfileRecord_Count_Get=s.Oj,t._OpenCLKernelProfileRecord_Name_Get=s.Pj,t._OpenCLKernelProfileRecord_MaximumDuration_Get=s.Qj,t._OpenCLKernelProfileRecord_MinimumDuration_Get=s.Rj,t._OpenCLKernelProfileRecord_TotalDuration_Get=s.Sj,t._JpegOptimizer_CompressFile=s.Tj,t._JpegOptimizer_CompressStream=s.Uj;var sn=t._malloc=s.Vj,Ze=t._free=s.Wj;t._PixelCollection_Create=s.Xj,t._PixelCollection_Dispose=s.Yj,t._PixelCollection_GetArea=s.Zj,t._PixelCollection_GetReadOnlyArea=s._j,t._PixelCollection_SetArea=s.$j,t._PixelCollection_ToByteArray=s.ak,t._PixelCollection_ToShortArray=s.bk,t._Quantum_Depth_Get=s.ck,t._Quantum_Max_Get=s.dk,t._ResourceLimits_Area_Get=s.ek,t._ResourceLimits_Area_Set=s.fk,t._ResourceLimits_Disk_Get=s.gk,t._ResourceLimits_Disk_Set=s.hk,t._ResourceLimits_Height_Get=s.ik,t._ResourceLimits_Height_Set=s.jk,t._ResourceLimits_ListLength_Get=s.kk,t._ResourceLimits_ListLength_Set=s.lk,t._ResourceLimits_MaxMemoryRequest_Get=s.mk,t._ResourceLimits_MaxMemoryRequest_Set=s.nk,t._ResourceLimits_MaxProfileSize_Get=s.ok,t._ResourceLimits_MaxProfileSize_Set=s.pk,t._ResourceLimits_Memory_Get=s.qk,t._ResourceLimits_Memory_Set=s.rk,t._ResourceLimits_Thread_Get=s.sk,t._ResourceLimits_Thread_Set=s.tk,t._ResourceLimits_Throttle_Get=s.uk,t._ResourceLimits_Throttle_Set=s.vk,t._ResourceLimits_Time_Get=s.wk,t._ResourceLimits_Time_Set=s.xk,t._ResourceLimits_Width_Get=s.yk,t._ResourceLimits_Width_Set=s.zk,t._ResourceLimits_LimitMemory=s.Ak,t._ResourceLimits_TrimMemory=s.Bk,t._DrawingSettings_Create=s.Ck,t._DrawingSettings_Dispose=s.Dk,t._DrawingSettings_BorderColor_Get=s.Ek,t._DrawingSettings_BorderColor_Set=s.Fk,t._DrawingSettings_FillColor_Get=s.Gk,t._DrawingSettings_FillColor_Set=s.Hk,t._DrawingSettings_FillRule_Get=s.Ik,t._DrawingSettings_FillRule_Set=s.Jk,t._DrawingSettings_Font_Get=s.Kk,t._DrawingSettings_Font_Set=s.Lk,t._DrawingSettings_FontFamily_Get=s.Mk,t._DrawingSettings_FontFamily_Set=s.Nk,t._DrawingSettings_FontPointsize_Get=s.Ok,t._DrawingSettings_FontPointsize_Set=s.Pk,t._DrawingSettings_FontStyle_Get=s.Qk,t._DrawingSettings_FontStyle_Set=s.Rk,t._DrawingSettings_FontWeight_Get=s.Sk,t._DrawingSettings_FontWeight_Set=s.Tk,t._DrawingSettings_StrokeAntiAlias_Get=s.Uk,t._DrawingSettings_StrokeAntiAlias_Set=s.Vk,t._DrawingSettings_StrokeColor_Get=s.Wk,t._DrawingSettings_StrokeColor_Set=s.Xk,t._DrawingSettings_StrokeDashOffset_Get=s.Yk,t._DrawingSettings_StrokeDashOffset_Set=s.Zk,t._DrawingSettings_StrokeLineCap_Get=s._k,t._DrawingSettings_StrokeLineCap_Set=s.$k,t._DrawingSettings_StrokeLineJoin_Get=s.al,t._DrawingSettings_StrokeLineJoin_Set=s.bl,t._DrawingSettings_StrokeMiterLimit_Get=s.cl,t._DrawingSettings_StrokeMiterLimit_Set=s.dl,t._DrawingSettings_StrokeWidth_Get=s.el,t._DrawingSettings_StrokeWidth_Set=s.fl,t._DrawingSettings_TextAntiAlias_Get=s.gl,t._DrawingSettings_TextAntiAlias_Set=s.hl,t._DrawingSettings_TextDirection_Get=s.il,t._DrawingSettings_TextDirection_Set=s.jl,t._DrawingSettings_TextEncoding_Get=s.kl,t._DrawingSettings_TextEncoding_Set=s.ll,t._DrawingSettings_TextGravity_Get=s.ml,t._DrawingSettings_TextGravity_Set=s.nl,t._DrawingSettings_TextInterlineSpacing_Get=s.ol,t._DrawingSettings_TextInterlineSpacing_Set=s.pl,t._DrawingSettings_TextInterwordSpacing_Get=s.ql,t._DrawingSettings_TextInterwordSpacing_Set=s.rl,t._DrawingSettings_TextKerning_Get=s.sl,t._DrawingSettings_TextKerning_Set=s.tl,t._DrawingSettings_TextUnderColor_Get=s.ul,t._DrawingSettings_TextUnderColor_Set=s.vl,t._DrawingSettings_SetAffine=s.wl,t._DrawingSettings_SetFillPattern=s.xl,t._DrawingSettings_SetStrokeDashArray=s.yl,t._DrawingSettings_SetStrokePattern=s.zl,t._DrawingSettings_SetText=s.Al,t._MagickSettings_Create=s.Bl,t._MagickSettings_Dispose=s.Cl,t._MagickSettings_AntiAlias_Get=s.Dl,t._MagickSettings_AntiAlias_Set=s.El,t._MagickSettings_BackgroundColor_Get=s.Fl,t._MagickSettings_BackgroundColor_Set=s.Gl,t._MagickSettings_ColorSpace_Get=s.Hl,t._MagickSettings_ColorSpace_Set=s.Il,t._MagickSettings_ColorType_Get=s.Jl,t._MagickSettings_ColorType_Set=s.Kl,t._MagickSettings_Compression_Get=s.Ll,t._MagickSettings_Compression_Set=s.Ml,t._MagickSettings_Debug_Get=s.Nl,t._MagickSettings_Debug_Set=s.Ol,t._MagickSettings_Density_Get=s.Pl,t._MagickSettings_Density_Set=s.Ql,t._MagickSettings_Depth_Get=s.Rl,t._MagickSettings_Depth_Set=s.Sl,t._MagickSettings_Endian_Get=s.Tl,t._MagickSettings_Endian_Set=s.Ul,t._MagickSettings_Extract_Get=s.Vl,t._MagickSettings_Extract_Set=s.Wl,t._MagickSettings_Format_Get=s.Xl,t._MagickSettings_Format_Set=s.Yl,t._MagickSettings_FontPointsize_Get=s.Zl,t._MagickSettings_FontPointsize_Set=s._l,t._MagickSettings_Interlace_Get=s.$l,t._MagickSettings_Interlace_Set=s.am,t._MagickSettings_Monochrome_Get=s.bm,t._MagickSettings_Monochrome_Set=s.cm,t._MagickSettings_Verbose_Get=s.dm,t._MagickSettings_Verbose_Set=s.em,t._MagickSettings_SetColorFuzz=s.fm,t._MagickSettings_SetFileName=s.gm,t._MagickSettings_SetFont=s.hm,t._MagickSettings_SetNumberScenes=s.im,t._MagickSettings_SetOption=s.jm,t._MagickSettings_SetPage=s.km,t._MagickSettings_SetPing=s.lm,t._MagickSettings_SetQuality=s.mm,t._MagickSettings_SetScenes=s.nm,t._MagickSettings_SetScene=s.om,t._MagickSettings_SetSize=s.pm,t._MontageSettings_Create=s.qm,t._MontageSettings_Dispose=s.rm,t._MontageSettings_SetBackgroundColor=s.sm,t._MontageSettings_SetBorderColor=s.tm,t._MontageSettings_SetBorderWidth=s.um,t._MontageSettings_SetFillColor=s.vm,t._MontageSettings_SetFont=s.wm,t._MontageSettings_SetFontPointsize=s.xm,t._MontageSettings_SetFrameGeometry=s.ym,t._MontageSettings_SetGeometry=s.zm,t._MontageSettings_SetGravity=s.Am,t._MontageSettings_SetShadow=s.Bm,t._MontageSettings_SetStrokeColor=s.Cm,t._MontageSettings_SetTextureFileName=s.Dm,t._MontageSettings_SetTileGeometry=s.Em,t._MontageSettings_SetTitle=s.Fm,t._QuantizeSettings_SetColors=s.Gm,t._QuantizeSettings_SetColorSpace=s.Hm,t._QuantizeSettings_SetDitherMethod=s.Im,t._QuantizeSettings_SetMeasureErrors=s.Jm,t._QuantizeSettings_SetTreeDepth=s.Km,t._ChannelMoments_Centroid_Get=s.Lm,t._ChannelMoments_EllipseAngle_Get=s.Mm,t._ChannelMoments_EllipseAxis_Get=s.Nm,t._ChannelMoments_EllipseEccentricity_Get=s.Om,t._ChannelMoments_EllipseIntensity_Get=s.Pm,t._ChannelMoments_GetHuInvariants=s.Qm,t._ChannelPerceptualHash_GetHuPhash=s.Rm,t._ChannelStatistics_Depth_Get=s.Sm,t._ChannelStatistics_Entropy_Get=s.Tm,t._ChannelStatistics_Kurtosis_Get=s.Um,t._ChannelStatistics_Maximum_Get=s.Vm,t._ChannelStatistics_Mean_Get=s.Wm,t._ChannelStatistics_Minimum_Get=s.Xm,t._ChannelStatistics_Skewness_Get=s.Ym,t._ChannelStatistics_StandardDeviation_Get=s.Zm,t._Moments_DisposeList=s._m,t._Moments_GetInstance=s.$m,t._PerceptualHash_DisposeList=s.an,t._PerceptualHash_GetInstance=s.bn,t._Statistics_DisposeList=s.cn,t._Statistics_GetInstance=s.dn,t._ConnectedComponent_DisposeList=s.en,t._ConnectedComponent_GetArea=s.fn,t._ConnectedComponent_GetCentroid=s.gn,t._ConnectedComponent_GetColor=s.hn,t._ConnectedComponent_GetHeight=s.jn,t._ConnectedComponent_GetId=s.kn,t._ConnectedComponent_GetWidth=s.ln,t._ConnectedComponent_GetX=s.mn,t._ConnectedComponent_GetY=s.nn,t._ConnectedComponent_GetInstance=s.on,t._MagickGeometry_Create=s.pn,t._MagickGeometry_Dispose=s.qn,t._MagickGeometry_X_Get=s.rn,t._MagickGeometry_Y_Get=s.sn,t._MagickGeometry_Width_Get=s.tn,t._MagickGeometry_Height_Get=s.un,t._MagickGeometry_Initialize=s.vn,t._MagickRectangle_Dispose=s.wn,t._MagickRectangle_X_Get=s.xn,t._MagickRectangle_X_Set=s.yn,t._MagickRectangle_Y_Get=s.zn,t._MagickRectangle_Y_Set=s.An,t._MagickRectangle_Width_Get=s.Bn,t._MagickRectangle_Width_Set=s.Cn,t._MagickRectangle_Height_Get=s.Dn,t._MagickRectangle_Height_Set=s.En,t._MagickRectangle_FromPageSize=s.Fn,t._OffsetInfo_Create=s.Gn,t._OffsetInfo_Dispose=s.Hn,t._OffsetInfo_SetX=s.In,t._OffsetInfo_SetY=s.Jn,t._PointInfo_X_Get=s.Kn,t._PointInfo_Y_Get=s.Ln,t._PointInfoCollection_Create=s.Mn,t._PointInfoCollection_Dispose=s.Nn,t._PointInfoCollection_GetX=s.On,t._PointInfoCollection_GetY=s.Pn,t._PointInfoCollection_Set=s.Qn,t._PrimaryInfo_Dispose=s.Rn,t._PrimaryInfo_X_Get=s.Sn,t._PrimaryInfo_X_Set=s.Tn,t._PrimaryInfo_Y_Get=s.Un,t._PrimaryInfo_Y_Set=s.Vn,t._PrimaryInfo_Z_Get=s.Wn,t._PrimaryInfo_Z_Set=s.Xn,t._StringInfo_Length_Get=s.Yn,t._StringInfo_Datum_Get=s.Zn,t._TypeMetric_Dispose=s._n,t._TypeMetric_Ascent_Get=s.$n,t._TypeMetric_Descent_Get=s.ao,t._TypeMetric_MaxHorizontalAdvance_Get=s.bo,t._TypeMetric_TextHeight_Get=s.co,t._TypeMetric_TextWidth_Get=s.eo,t._TypeMetric_UnderlinePosition_Get=s.fo,t._TypeMetric_UnderlineThickness_Get=s.go;var Uo=s.ho,H=s.io,Xo=s.jo,jo=s.ko,Vo=s.lo,qo=s.mo;function Ko(i,r,a,o){var c=$();try{B(i)(r,a,o)}catch(h){if(z(c),h!==h+0)throw h;H(1,0)}}function Qo(i,r,a,o){var c=$();try{return B(i)(r,a,o)}catch(h){if(z(c),h!==h+0)throw h;H(1,0)}}function Jo(i,r,a){var o=$();try{return B(i)(r,a)}catch(c){if(z(o),c!==c+0)throw c;H(1,0)}}function Oo(i,r){var a=$();try{return B(i)(r)}catch(o){if(z(a),o!==o+0)throw o;H(1,0)}}function Zo(i,r){var a=$();try{B(i)(r)}catch(o){if(z(a),o!==o+0)throw o;H(1,0)}}function e_(i,r,a){var o=$();try{B(i)(r,a)}catch(c){if(z(o),c!==c+0)throw c;H(1,0)}}function t_(i,r,a,o,c){var h=$();try{B(i)(r,a,o,c)}catch(d){if(z(h),d!==d+0)throw d;H(1,0)}}function i_(i,r,a,o,c){var h=$();try{return B(i)(r,a,o,c)}catch(d){if(z(h),d!==d+0)throw d;H(1,0)}}function r_(i,r,a,o){var c=$();try{return B(i)(r,a,o)}catch(h){if(z(c),h!==h+0)throw h;return H(1,0),0n}}function n_(i,r){var a=$();try{return B(i)(r)}catch(o){if(z(a),o!==o+0)throw o;return H(1,0),0n}}function a_(i,r,a,o,c,h,d,f,v){var M=$();try{return B(i)(r,a,o,c,h,d,f,v)}catch(S){if(z(M),S!==S+0)throw S;H(1,0)}}function s_(i,r,a,o,c,h,d){var f=$();try{return B(i)(r,a,o,c,h,d)}catch(v){if(z(f),v!==v+0)throw v;H(1,0)}}function o_(i,r,a,o,c){var h=$();try{return B(i)(r,a,o,c)}catch(d){if(z(h),d!==d+0)throw d;H(1,0)}}function __(i){var r=$();try{return B(i)()}catch(a){if(z(r),a!==a+0)throw a;H(1,0)}}function c_(i,r,a){var o=$();try{return B(i)(r,a)}catch(c){if(z(o),c!==c+0)throw c;H(1,0)}}function l_(i,r,a){var o=$();try{B(i)(r,a)}catch(c){if(z(o),c!==c+0)throw c;H(1,0)}}function u_(i,r,a,o,c,h){var d=$();try{return B(i)(r,a,o,c,h)}catch(f){if(z(d),f!==f+0)throw f;H(1,0)}}function h_(i,r,a){var o=$();try{return B(i)(r,a)}catch(c){if(z(o),c!==c+0)throw c;H(1,0)}}function g_(i){var r=$();try{B(i)()}catch(a){if(z(r),a!==a+0)throw a;H(1,0)}}function d_(i,r,a,o,c,h){var d=$();try{B(i)(r,a,o,c,h)}catch(f){if(z(d),f!==f+0)throw f;H(1,0)}}function f_(i,r,a,o,c,h,d,f){var v=$();try{return B(i)(r,a,o,c,h,d,f)}catch(M){if(z(v),M!==M+0)throw M;H(1,0)}}function p_(i,r,a,o,c,h,d,f,v,M){var S=$();try{return B(i)(r,a,o,c,h,d,f,v,M)}catch(I){if(z(S),I!==I+0)throw I;H(1,0)}}function m_(i,r,a,o){var c=$();try{B(i)(r,a,o)}catch(h){if(z(c),h!==h+0)throw h;H(1,0)}}function v_(i,r,a,o,c,h,d,f,v,M,S){var I=$();try{B(i)(r,a,o,c,h,d,f,v,M,S)}catch(D){if(z(I),D!==D+0)throw D;H(1,0)}}function w_(i,r,a,o,c,h,d,f,v,M,S){var I=$();try{return B(i)(r,a,o,c,h,d,f,v,M,S)}catch(D){if(z(I),D!==D+0)throw D;H(1,0)}}function k_(i,r,a,o,c,h,d,f,v,M){var S=$();try{B(i)(r,a,o,c,h,d,f,v,M)}catch(I){if(z(S),I!==I+0)throw I;H(1,0)}}function M_(i,r,a,o,c,h,d){var f=$();try{B(i)(r,a,o,c,h,d)}catch(v){if(z(f),v!==v+0)throw v;H(1,0)}}function y_(i,r,a,o,c,h,d,f){var v=$();try{B(i)(r,a,o,c,h,d,f)}catch(M){if(z(v),M!==M+0)throw M;H(1,0)}}function S_(i,r,a,o,c,h,d,f,v,M,S,I){var D=$();try{return B(i)(r,a,o,c,h,d,f,v,M,S,I)}catch(P){if(z(D),P!==P+0)throw P;H(1,0)}}function C_(i,r,a,o,c,h){var d=$();try{return B(i)(r,a,o,c,h)}catch(f){if(z(d),f!==f+0)throw f;H(1,0)}}function I_(i,r){var a=$();try{return B(i)(r)}catch(o){if(z(a),o!==o+0)throw o;H(1,0)}}function P_(i,r,a,o,c,h,d,f,v){var M=$();try{B(i)(r,a,o,c,h,d,f,v)}catch(S){if(z(M),S!==S+0)throw S;H(1,0)}}function D_(i,r,a,o,c,h,d,f,v,M,S,I){var D=$();try{B(i)(r,a,o,c,h,d,f,v,M,S,I)}catch(P){if(z(D),P!==P+0)throw P;H(1,0)}}function E_(i){i=Object.assign({},i);var r=c=>h=>c(h)>>>0,a=c=>(h,d)=>c(h,d)>>>0,o=c=>()=>c()>>>0;return i.eb=r(i.eb),i.Vj=r(i.Vj),i.ho=a(i.ho),i._emscripten_stack_alloc=r(i._emscripten_stack_alloc),i.lo=o(i.lo),i}function ki(){if(qe>0){ut=ki;return}if(Xn(),qe>0){ut=ki;return}function i(){t.calledRun=!0,!Zt&&(jn(),_(t),t.onRuntimeInitialized?.(),Vn())}t.setStatus?(t.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>t.setStatus(""),1),i()},1)):i()}function b_(){if(t.preInit)for(typeof t.preInit=="function"&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.shift()()}return b_(),ki(),n=p,n}})();class vn{constructor(e){if(e instanceof URL){if(e.protocol!=="http:"&&e.protocol!=="https:")throw new N("Only http/https protocol is supported");this.locateFile=()=>e.href}else e instanceof WebAssembly.Module?this.instantiateWasm=(n,t)=>{const _=new WebAssembly.Instance(e,n);t(_)}:this.wasmBinary=e}wasmBinary;instantiateWasm;locateFile}class l{loader;api;constructor(){this.loader=(e,n)=>new Promise((t,_)=>{if(this.api!==void 0){t();return}const g=new vn(e);mn(g).then(p=>{try{this.writeConfigurationFiles(p,n),qt(p,"MAGICK_CONFIGURE_PATH",m=>{qt(p,"/xml",C=>{p._Environment_SetEnv(m,C),p._Environment_Initialize(),this.api=p,t()})})}catch(m){_(m)}})})}async _initialize(e,n){await this.loader(e,n)}static get _api(){if(!Dt.api)throw new N("`await initializeImageMagick` should be called to initialize the library");return Dt.api}static set _api(e){Dt.api=e}static read(e,n,t,_){return ie._create(g=>{let p=_;if(typeof e!="string"&&!Ht(e))typeof n=="number"&&typeof t=="number"&&g.read(e,n,t);else if(typeof n!="number"&&typeof t!="number"){p=t;let m;n instanceof Me?m=n:typeof n=="string"?(m=new Me,m.format=n):p=n,g.read(e,m)}return p(g)})}static readCollection(e,n,t){return pe.use(_=>{let g=t,p;return n instanceof Me?p=n:typeof n=="string"?(p=new Me,p.format=n):g=n,_.read(e,p),g(_)})}static readFromCanvas(e,n,t){return ie._create(_=>(_.readFromCanvas(e,t),n(_)))}writeConfigurationFiles(e,n){e.FS.analyzePath("/xml").exists||e.FS.mkdir("/xml");for(const _ of n.all()){const g=e.FS.open(`/xml/${_.fileName}`,"w"),p=new TextEncoder().encode(_.data);e.FS.write(g,p,0,p.length),e.FS.close(g)}}}const Dt=new l;async function wn(k,e){await Dt._initialize(k,e??pt.default)}class Vi{constructor(e,n,t){this.origin=e,this.progress=new te((n+1)/(t*100))}origin;progress;cancel=!1}class oe{static _logDelegate=0;static _onLog;static _progressDelegate=0;static _images={};static setLogDelegate(e){oe._logDelegate===0&&e!==void 0&&(oe._logDelegate=l._api.addFunction(oe.logDelegate,"vii")),l._api._Magick_SetLogDelegate(e===void 0?0:oe._logDelegate),oe._onLog=e}static setProgressDelegate(e){oe._progressDelegate===0&&(this._progressDelegate=l._api.addFunction(oe.progressDelegate,"iijji")),this._images[e._instance]=e,l._api._MagickImage_SetClientData(e._instance,e._instance),l._api._MagickImage_SetProgressDelegate(e._instance,oe._progressDelegate)}static removeProgressDelegate(e){l._api._MagickImage_SetClientData(e._instance,0),l._api._MagickImage_SetProgressDelegate(e._instance,0),delete oe._images[e._instance]}static logDelegate(e,n){if(oe._onLog===void 0)return;const t=_e(n,"");oe._onLog(new bi(e,t))}static progressDelegate(e,n,t,_){const g=oe._images[_];if(g===void 0||g.onProgress===void 0)return 1;const p=Number(n),m=Number(t),C=_e(e),G=new Vi(C,p,m);return g.onProgress(G),G.cancel?0:1}}class ye{static _allFormats;constructor(e,n,t,_,g,p,m){this.format=e,this.description=n,this.mimeType=t,this.moduleFormat=_,this.supportsMultipleFrames=g,this.supportsReading=p,this.supportsWriting=m}description;format;mimeType;moduleFormat;supportsMultipleFrames;supportsReading;supportsWriting;static get all(){return ye._allFormats===void 0&&(ye._allFormats=ye.loadFormats()),ye._allFormats}static loadFormats(){return b.usePointer(e=>be.use(n=>{const t=l._api._MagickFormatInfo_CreateList(n.ptr,e),_=n.value;try{const g=new Array(_),p=Object.values(Te);for(let m=0;m<_;m++){const C=l._api._MagickFormatInfo_GetInfo(t,m,e),G=_e(l._api._MagickFormatInfo_Format_Get(C)),Y=ye.convertFormat(G,p),q=_e(l._api._MagickFormatInfo_Description_Get(C),""),Xe=_e(l._api._MagickFormatInfo_MimeType_Get(C)),je=_e(l._api._MagickFormatInfo_Module_Get(C)),Ne=ye.convertFormat(je,p),ze=l._api._MagickFormatInfo_SupportsMultipleFrames_Get(C)==1,Ce=l._api._MagickFormatInfo_SupportsReading_Get(C)==1,Ve=l._api._MagickFormatInfo_SupportsWriting_Get(C)==1;g[m]=new ye(Y,q,Xe,Ne,ze,Ce,Ve)}return g}finally{l._api._MagickFormatInfo_DisposeList(t,_)}}))}static convertFormat(e,n){return e===null?Te.Unknown:n.includes(e)?e:Te.Unknown}}const K={None:0,Accelerate:1,Annotate:2,Blob:4,Cache:8,Coder:16,Configure:32,Deprecate:64,Draw:128,Exception:256,Image:512,Locale:1024,Module:2048,Pixel:4096,Policy:8192,Resource:16384,Trace:32768,Transform:65536,User:131072,Wand:262144,Detailed:2147450879,get All(){return this.Detailed|this.Trace}};class Se{static get delegates(){return _e(l._api._Magick_Delegates_Get(),"Unknown")}static get features(){return _e(l._api._Magick_Features_Get()," ").slice(0,-1)}static get imageMagickVersion(){return _e(l._api._Magick_ImageMagickVersion_Get(),"Unknown")}static get supportedFormats(){return ye.all}static onLog;static addFont(e,n){const t=l._api.FS;t.analyzePath("/fonts").exists||t.mkdir("/fonts");const g=t.open(`/fonts/${e}`,"w");t.write(g,n,0,n.length),t.close(g)}static resetRandomSeed=()=>l._api._Magick_ResetRandomSeed();static setRandomSeed=e=>l._api._Magick_SetRandomSeed(e);static setLogEvents(e){const n=e==K.None?void 0:Se.logDelegate;oe.setLogDelegate(n);const t=Se.getEventTypeString(e);R(t,_=>l._api._Magick_SetLogEvents(_))}static _getFontFileName(e){const n=`/fonts/${e}`;if(!l._api.FS.analyzePath(n).exists)throw`Unable to find a font with the name '${e}', register it with the addFont method of the Magick class.`;return n}static getEventTypeString(e){if(e==K.All)return"All,Trace";if(e==K.Detailed)return"All";switch(e){case K.Accelerate:return"Accelerate";case K.Annotate:return"Annotate";case K.Blob:return"Blob";case K.Cache:return"Cache";case K.Coder:return"Coder";case K.Configure:return"Configure";case K.Deprecate:return"Deprecate";case K.Draw:return"Draw";case K.Exception:return"Exception";case K.Image:return"Image";case K.Locale:return"Locale";case K.Module:return"Module";case K.Pixel:return"Pixel";case K.Policy:return"Policy";case K.Resource:return"Resource";case K.Trace:return"Trace";case K.Transform:return"Transform";case K.User:return"User";case K.Wand:return"Wand";case K.None:default:return"None"}}static logDelegate(e){Se.onLog!==void 0&&Se.onLog(e)}}class qi{_font;constructor(e){this._font=e}get font(){return this._font}draw(e){const n=Se._getFontFileName(this._font);e.font(n)}}class Ki{_gravity;constructor(e){this._gravity=e}get gravity(){return this._gravity}draw(e){e.gravity(this._gravity)}}class Qi{_startX;_startY;_endX;_endY;constructor(e,n,t,_){this._startX=e,this._startY=n,this._endX=t,this._endY=_}get startX(){return this._startX}get startY(){return this._startY}get endX(){return this._endX}get endY(){return this._endY}draw(e){e.line(this._startX,this._startY,this._endX,this._endY)}}class Ji{_paths=[];constructor(e){this._paths=e}draw(e){e.pathStart();for(const n of this._paths)n.draw(e);e.pathFinish()}}class Oi{_x;_y;constructor(e,n){this._x=e,this._y=n}get x(){return this._x}get y(){return this._y}draw(e){e.point(this._x,this._y)}}class Zi{_upperLeftX;_upperLeftY;_lowerRightX;_lowerRightY;constructor(e,n,t,_){this._upperLeftX=e,this._upperLeftY=n,this._lowerRightX=t,this._lowerRightY=_}get upperLeftX(){return this._upperLeftX}get upperLeftY(){return this._upperLeftY}get lowerRightX(){return this._lowerRightX}get lowerRightY(){return this._lowerRightY}draw(e){e.rectangle(this._upperLeftX,this._upperLeftY,this._lowerRightX,this._lowerRightY)}}class er{_upperLeftX;_upperLeftY;_lowerRightX;_lowerRightY;_cornerWidth;_cornerHeight;constructor(e,n,t,_,g,p){this._upperLeftX=e,this._upperLeftY=n,this._lowerRightX=t,this._lowerRightY=_,this._cornerWidth=g,this._cornerHeight=p}get upperLeftX(){return this._upperLeftX}get upperLeftY(){return this._upperLeftY}get lowerRightX(){return this._lowerRightX}get lowerRightY(){return this._lowerRightY}get cornerWidth(){return this._cornerWidth}get cornerHeight(){return this._cornerHeight}draw(e){e.roundRectangle(this._upperLeftX,this._upperLeftY,this._lowerRightX,this._lowerRightY,this._cornerWidth,this._cornerHeight)}}class tr{_color;constructor(e){this._color=e}get color(){return this._color}draw(e){e.strokeColor(this._color)}}class ir{_dash=[];constructor(e){this._dash=[...e]}get dash(){return this._dash}draw(e){e.strokeDashArray(this._dash)}}class rr{_offset;constructor(e){this._offset=e}get offset(){return this._offset}draw(e){e.strokeDashOffset(this._offset)}}class nr{_width;constructor(e){this._width=e}get width(){return this._width}draw(e){e.strokeWidth(this._width)}}class ar{_alignment;constructor(e){this._alignment=e}get alignment(){return this._alignment}draw(e){e.textAlignment(this._alignment)}}class tt{_isEnabled;constructor(e){this._isEnabled=e}static get disabled(){return new tt(!1)}static get enabled(){return new tt(!0)}get isEnabled(){return this._isEnabled}draw(e){e.textAntialias(this._isEnabled)}}class sr{_decoration;constructor(e){this._decoration=e}get decoration(){return this._decoration}draw(e){e.textDecoration(this._decoration)}}class or{_spacing;constructor(e){this._spacing=e}get spacing(){return this._spacing}draw(e){e.textInterlineSpacing(this._spacing)}}class _r{_spacing;constructor(e){this._spacing=e}get spacing(){return this._spacing}draw(e){e.textInterwordspacing(this._spacing)}}class cr{_kerning;constructor(e){this._kerning=e}get kerning(){return this._kerning}draw(e){e.textKerning(this._kerning)}}class lr{_color;constructor(e){this._color=e}get color(){return this._color}draw(e){e.textUnderColor(this._color)}}class ur{_x;_y;_value;constructor(e,n,t){this._x=e,this._y=n,this._value=t}get x(){return this._x}get y(){return this._y}get value(){return this._value}draw(e){e.text(this._x,this._y,this._value)}}class hr{static get None(){return new w(0,0,0,0)}static get Transparent(){return new w(0,0,0,0)}static get AliceBlue(){return new w(240,248,255,255)}static get AntiqueWhite(){return new w(250,235,215,255)}static get Aqua(){return new w(0,255,255,255)}static get Aquamarine(){return new w(127,255,212,255)}static get Azure(){return new w(240,255,255,255)}static get Beige(){return new w(245,245,220,255)}static get Bisque(){return new w(255,228,196,255)}static get Black(){return new w(0,0,0,255)}static get BlanchedAlmond(){return new w(255,235,205,255)}static get Blue(){return new w(0,0,255,255)}static get BlueViolet(){return new w(138,43,226,255)}static get Brown(){return new w(165,42,42,255)}static get BurlyWood(){return new w(222,184,135,255)}static get CadetBlue(){return new w(95,158,160,255)}static get Chartreuse(){return new w(127,255,0,255)}static get Chocolate(){return new w(210,105,30,255)}static get Coral(){return new w(255,127,80,255)}static get CornflowerBlue(){return new w(100,149,237,255)}static get Cornsilk(){return new w(255,248,220,255)}static get Crimson(){return new w(220,20,60,255)}static get Cyan(){return new w(0,255,255,255)}static get DarkBlue(){return new w(0,0,139,255)}static get DarkCyan(){return new w(0,139,139,255)}static get DarkGoldenrod(){return new w(184,134,11,255)}static get DarkGray(){return new w(169,169,169,255)}static get DarkGreen(){return new w(0,100,0,255)}static get DarkKhaki(){return new w(189,183,107,255)}static get DarkMagenta(){return new w(139,0,139,255)}static get DarkOliveGreen(){return new w(85,107,47,255)}static get DarkOrange(){return new w(255,140,0,255)}static get DarkOrchid(){return new w(153,50,204,255)}static get DarkRed(){return new w(139,0,0,255)}static get DarkSalmon(){return new w(233,150,122,255)}static get DarkSeaGreen(){return new w(143,188,143,255)}static get DarkSlateBlue(){return new w(72,61,139,255)}static get DarkSlateGray(){return new w(47,79,79,255)}static get DarkTurquoise(){return new w(0,206,209,255)}static get DarkViolet(){return new w(148,0,211,255)}static get DeepPink(){return new w(255,20,147,255)}static get DeepSkyBlue(){return new w(0,191,255,255)}static get DimGray(){return new w(105,105,105,255)}static get DodgerBlue(){return new w(30,144,255,255)}static get Firebrick(){return new w(178,34,34,255)}static get FloralWhite(){return new w(255,250,240,255)}static get ForestGreen(){return new w(34,139,34,255)}static get Fuchsia(){return new w(255,0,255,255)}static get Gainsboro(){return new w(220,220,220,255)}static get GhostWhite(){return new w(248,248,255,255)}static get Gold(){return new w(255,215,0,255)}static get Goldenrod(){return new w(218,165,32,255)}static get Gray(){return new w(128,128,128,255)}static get Green(){return new w(0,128,0,255)}static get GreenYellow(){return new w(173,255,47,255)}static get Honeydew(){return new w(240,255,240,255)}static get HotPink(){return new w(255,105,180,255)}static get IndianRed(){return new w(205,92,92,255)}static get Indigo(){return new w(75,0,130,255)}static get Ivory(){return new w(255,255,240,255)}static get Khaki(){return new w(240,230,140,255)}static get Lavender(){return new w(230,230,250,255)}static get LavenderBlush(){return new w(255,240,245,255)}static get LawnGreen(){return new w(124,252,0,255)}static get LemonChiffon(){return new w(255,250,205,255)}static get LightBlue(){return new w(173,216,230,255)}static get LightCoral(){return new w(240,128,128,255)}static get LightCyan(){return new w(224,255,255,255)}static get LightGoldenrodYellow(){return new w(250,250,210,255)}static get LightGreen(){return new w(144,238,144,255)}static get LightGray(){return new w(211,211,211,255)}static get LightPink(){return new w(255,182,193,255)}static get LightSalmon(){return new w(255,160,122,255)}static get LightSeaGreen(){return new w(32,178,170,255)}static get LightSkyBlue(){return new w(135,206,250,255)}static get LightSlateGray(){return new w(119,136,153,255)}static get LightSteelBlue(){return new w(176,196,222,255)}static get LightYellow(){return new w(255,255,224,255)}static get Lime(){return new w(0,255,0,255)}static get LimeGreen(){return new w(50,205,50,255)}static get Linen(){return new w(250,240,230,255)}static get Magenta(){return new w(255,0,255,255)}static get Maroon(){return new w(128,0,0,255)}static get MediumAquamarine(){return new w(102,205,170,255)}static get MediumBlue(){return new w(0,0,205,255)}static get MediumOrchid(){return new w(186,85,211,255)}static get MediumPurple(){return new w(147,112,219,255)}static get MediumSeaGreen(){return new w(60,179,113,255)}static get MediumSlateBlue(){return new w(123,104,238,255)}static get MediumSpringGreen(){return new w(0,250,154,255)}static get MediumTurquoise(){return new w(72,209,204,255)}static get MediumVioletRed(){return new w(199,21,133,255)}static get MidnightBlue(){return new w(25,25,112,255)}static get MintCream(){return new w(245,255,250,255)}static get MistyRose(){return new w(255,228,225,255)}static get Moccasin(){return new w(255,228,181,255)}static get NavajoWhite(){return new w(255,222,173,255)}static get Navy(){return new w(0,0,128,255)}static get OldLace(){return new w(253,245,230,255)}static get Olive(){return new w(128,128,0,255)}static get OliveDrab(){return new w(107,142,35,255)}static get Orange(){return new w(255,165,0,255)}static get OrangeRed(){return new w(255,69,0,255)}static get Orchid(){return new w(218,112,214,255)}static get PaleGoldenrod(){return new w(238,232,170,255)}static get PaleGreen(){return new w(152,251,152,255)}static get PaleTurquoise(){return new w(175,238,238,255)}static get PaleVioletRed(){return new w(219,112,147,255)}static get PapayaWhip(){return new w(255,239,213,255)}static get PeachPuff(){return new w(255,218,185,255)}static get Peru(){return new w(205,133,63,255)}static get Pink(){return new w(255,192,203,255)}static get Plum(){return new w(221,160,221,255)}static get PowderBlue(){return new w(176,224,230,255)}static get Purple(){return new w(128,0,128,255)}static get RebeccaPurple(){return new w(102,51,153,255)}static get Red(){return new w(255,0,0,255)}static get RosyBrown(){return new w(188,143,143,255)}static get RoyalBlue(){return new w(65,105,225,255)}static get SaddleBrown(){return new w(139,69,19,255)}static get Salmon(){return new w(250,128,114,255)}static get SandyBrown(){return new w(244,164,96,255)}static get SeaGreen(){return new w(46,139,87,255)}static get SeaShell(){return new w(255,245,238,255)}static get Sienna(){return new w(160,82,45,255)}static get Silver(){return new w(192,192,192,255)}static get SkyBlue(){return new w(135,206,235,255)}static get SlateBlue(){return new w(106,90,205,255)}static get SlateGray(){return new w(112,128,144,255)}static get Snow(){return new w(255,250,250,255)}static get SpringGreen(){return new w(0,255,127,255)}static get SteelBlue(){return new w(70,130,180,255)}static get Tan(){return new w(210,180,140,255)}static get Teal(){return new w(0,128,128,255)}static get Thistle(){return new w(216,191,216,255)}static get Tomato(){return new w(255,99,71,255)}static get Turquoise(){return new w(64,224,208,255)}static get Violet(){return new w(238,130,238,255)}static get Wheat(){return new w(245,222,179,255)}static get White(){return new w(255,255,255,255)}static get WhiteSmoke(){return new w(245,245,245,255)}static get Yellow(){return new w(255,255,0,255)}static get YellowGreen(){return new w(154,205,50,255)}}class gr{_x;_y;constructor(e,n){this._x=e,this._y=n}get x(){return this._x}get y(){return this._y}draw(e){e.pathLineToAbs(this._x,this._y)}}class dr{_x;_y;constructor(e,n){this._x=e,this._y=n}get x(){return this._x}get y(){return this._y}draw(e){e.pathLineToRel(this._x,this._y)}}class fr{_x;_y;constructor(e,n){this._x=e,this._y=n}get x(){return this._x}get y(){return this._y}draw(e){e.pathMoveToAbs(this._x,this._y)}}class pr{_x;_y;constructor(e,n){this._x=e,this._y=n}get x(){return this._x}get y(){return this._y}draw(e){e.pathMoveToRel(this._x,this._y)}}class mr{_drawables;_paths=[];constructor(e){this._drawables=e}drawables(){return this._drawables===void 0?new vr().path(this._paths):this._drawables.path(this._paths)}lineToAbs(e,n){return this._paths.push(new gr(e,n)),this}lineToRel(e,n){return this._paths.push(new dr(e,n)),this}moveToAbs(e,n){return this._paths.push(new fr(e,n)),this}moveToRel(e,n){return this._paths.push(new pr(e,n)),this}}class vr{_drawables=[];affine(e=1,n=1,t=0,_=0,g=0,p=0){return this._drawables.push(new ue(e,n,t,_,g,p)),this}color(e,n,t){return this._drawables.push(new Ci(e,n,t)),this}borderColor(e){return this._drawables.push(new Si(e)),this}disableTextAntiAlias(){return this._drawables.push(tt.disabled),this}draw(e){return e.draw(this._drawables),this}enableTextAntiAlias(){return this._drawables.push(tt.enabled),this}fillColor(e){return this._drawables.push(new Ii(e)),this}fillOpacity(e){return this._drawables.push(new Pi(e)),this}fillRule(e){return this._drawables.push(new Di(e)),this}font(e){return this._drawables.push(new qi(e)),this}fontPointSize(e){return this._drawables.push(new Ei(e)),this}fontTypeMetrics(e,n=!1){return ie._create(t=>(t.read(hr.Transparent,1,1),_t._use(t,_=>(_.draw(this._drawables),_.fontTypeMetrics(e,n)))))}gravity(e){return this._drawables.push(new Ki(e)),this}line(e,n,t,_){return this._drawables.push(new Qi(e,n,t,_)),this}path(e){return this._drawables.push(new Ji(e)),this}paths(){return new mr(this)}point(e,n){return this._drawables.push(new Oi(e,n)),this}rectangle(e,n,t,_){return this._drawables.push(new Zi(e,n,t,_)),this}roundRectangle(e,n,t,_,g,p){return this._drawables.push(new er(e,n,t,_,g,p)),this}strokeColor(e){return this._drawables.push(new tr(e)),this}strokeDashArray(e){return this._drawables.push(new ir(e)),this}strokeDashOffset(e){return this._drawables.push(new rr(e)),this}strokeWidth(e){return this._drawables.push(new nr(e)),this}text(e,n,t){return this._drawables.push(new ur(e,n,t)),this}textAlignment(e){return this._drawables.push(new ar(e)),this}textDecoration(e){return this._drawables.push(new sr(e)),this}textInterlineSpacing(e){return this._drawables.push(new or(e)),this}textInterwordSpacing(e){return this._drawables.push(new _r(e)),this}textKerning(e){return this._drawables.push(new cr(e)),this}textUnderColor(e){return this._drawables.push(new lr(e)),this}}const kn={Undefined:0,Kapur:1,OTSU:2,Triangle:3},Mn={Undefined:0,Direct:1,Pseudo:2},yn={Undefined:0,Bilevel:1,Grayscale:2,GrayscaleAlpha:3,Palette:4,PaletteAlpha:5,TrueColor:6,TrueColorAlpha:7,ColorSeparation:8,ColorSeparationAlpha:9,Optimize:10,PaletteBilevelAlpha:11},Sn={Undefined:0,Add:1,Conjugate:2,Divide:3,MagnitudePhase:4,Multiply:5,RealImaginary:6,Subtract:7},wr={Undefined:0,B44A:1,B44:2,BZip:3,DXT1:4,DXT3:5,DXT5:6,Fax:7,Group4:8,JBIG1:9,JBIG2:10,JPEG2000:11,JPEG:12,LosslessJPEG:13,LZMA:14,LZW:15,NoCompression:16,Piz:17,Pxr24:18,RLE:19,Zip:20,ZipS:21,Zstd:22,WebP:23,DWAA:24,DWAB:25,BC7:26,BC5:27},Cn={Undefined:0,Affine:1,AffineProjection:2,ScaleRotateTranslate:3,Perspective:4,PerspectiveProjection:5,BilinearForward:6,BilinearReverse:7,Polynomial:8,Arc:9,Polar:10,DePolar:11,Cylinder2Plane:12,Plane2Cylinder:13,Barrel:14,BarrelInverse:15,Shepards:16,Resize:17,Sentinel:18,RigidAffine:19},In={Undefined:0,LSB:1,MSB:2},Pn={Undefined:0,Absolute:1,Fuzz:2,MeanAbsolute:3,MeanErrorPerPixel:4,MeanSquared:5,NormalizedCrossCorrelation:6,PeakAbsolute:7,PeakSignalToNoiseRatio:8,PerceptualHash:9,RootMeanSquared:10,StructuralSimilarity:11,StructuralDissimilarity:12},Dn={Undefined:0,Abs:1,Add:2,AddModulus:3,And:4,Cosine:5,Divide:6,Exponential:7,GaussianNoise:8,ImpulseNoise:9,LaplacianNoise:10,LeftShift:11,Log:12,Max:13,Mean:14,Median:15,Min:16,MultiplicativeNoise:17,Multiply:18,Or:19,PoissonNoise:20,Pow:21,RightShift:22,RootMeanSquare:23,Set:24,Sine:25,Subtract:26,Sum:27,ThresholdBlack:28,Threshold:29,ThresholdWhite:30,UniformNoise:31,Xor:32,InverseLog:33},En={Undefined:0,Point:1,Box:2,Triangle:3,Hermite:4,Hann:5,Hamming:6,Blackman:7,Gaussian:8,Quadratic:9,Cubic:10,Catrom:11,Mitchell:12,Jinc:13,Sinc:14,SincFast:15,Kaiser:16,Welch:17,Parzen:18,Bohman:19,Bartlett:20,Lagrange:21,Lanczos:22,LanczosSharp:23,Lanczos2:24,Lanczos2Sharp:25,Robidoux:26,RobidouxSharp:27,Cosine:28,Spline:29,LanczosRadius:30,CubicSpline:31,MagicKernelSharp2013:32,MagicKernelSharp2021:33},bn={Undefined:0,None:1,Background:2,Previous:3},kr={Undefined:0,NoInterlace:1,Line:2,Plane:3,Partition:4,Gif:5,Jpeg:6,Png:7},Tn={Undefined:"Undefined",Unity:"Unity",Gaussian:"Gaussian",DoG:"DoG",LoG:"LoG",Blur:"Blur",Comet:"Comet",Binomial:"Binomial",Laplacian:"Laplacian",Sobel:"Sobel",FreiChen:"FreiChen",Roberts:"Roberts",Prewitt:"Prewitt",Compass:"Compass",Kirsch:"Kirsch",Diamond:"Diamond",Square:"Square",Rectangle:"Rectangle",Octagon:"Octagon",Disk:"Disk",Plus:"Plus",Cross:"Cross",Ring:"Ring",Peaks:"Peaks",Edges:"Edges",Corners:"Corners",Diagonals:"Diagonals",LineEnds:"LineEnds",LineJunctions:"LineJunctions",Ridges:"Ridges",ConvexHull:"ConvexHull",ThinSE:"ThinSE",Skeleton:"Skeleton",Chebyshev:"Chebyshev",Manhattan:"Manhattan",Octagonal:"Octagonal",Euclidean:"Euclidean",UserDefined:"UserDefined"},An={Undefined:0,Convolve:1,Correlate:2,Erode:3,Dilate:4,ErodeIntensity:5,DilateIntensity:6,IterativeDistance:7,Open:8,Close:9,OpenIntensity:10,CloseIntensity:11,Smooth:12,EdgeIn:13,EdgeOut:14,Edge:15,TopHat:16,BottomHat:17,HitAndMiss:18,Thinning:19,Thicken:20,Distance:21,Voronoi:22},Rn={Undefined:0,Uniform:1,Gaussian:2,MultiplicativeGaussian:3,Impulse:4,Laplacian:5,Poisson:6,Random:7},Mr={Undefined:0,TopLeft:1,TopRight:2,BottomRight:3,BottomLeft:4,LeftTop:5,RightTop:6,RightBottom:7,LeftBottom:8},Gn={Undefined:0,Point:1,Replace:2,Floodfill:3,FillToBorder:4,Reset:5},Fn={Undefined:0,Saturation:1,Perceptual:2,Absolute:3,Relative:4},xn={Undefined:0,Left:1,Center:2,Right:3},Ln={Undefined:0,None:1,Underline:2,Overline:3,LineThrough:4},Wn={Undefined:0,Background:1,Dither:2,Edge:3,Mirror:4,Random:5,Tile:6,Transparent:7,Mask:8,Black:9,Gray:10,White:11,HorizontalTile:12,VerticalTile:13,HorizontalTileEdge:14,VerticalTileEdge:15,CheckerTile:16};var yr=(k=>(k[k.Disabled=-1]="Disabled",k[k.Linear=0]="Linear",k[k.Vng=1]="Vng",k[k.Ppg=2]="Ppg",k[k.Ahd=3]="Ahd",k[k.DCB=4]="DCB",k[k.Dht=11]="Dht",k[k.ModifiedAhd=12]="ModifiedAhd",k))(yr||{}),Sr=(k=>(k[k.Raw=0]="Raw",k[k.SRGB=1]="SRGB",k[k.AdobeRGB=2]="AdobeRGB",k[k.WideGamutRGB=3]="WideGamutRGB",k[k.KodakProPhotoRGB=4]="KodakProPhotoRGB",k[k.XYZ=5]="XYZ",k[k.ACES=6]="ACES",k))(Sr||{});class Bn extends yi{constructor(){super(Te.Dng)}disableAutoBrightness;interpolationQuality;outputColor;useAutoWhitebalance;useCameraWhitebalance;getDefines(){const e=[];return this.hasValue(this.interpolationQuality)&&e.push(this.createDefine("interpolation-quality",this.interpolationQuality)),this.hasValue(this.disableAutoBrightness)&&e.push(this.createDefine("no-auto-bright",this.disableAutoBrightness)),this.hasValue(this.outputColor)&&e.push(this.createDefine("output-color",this.outputColor)),this.hasValue(this.useCameraWhitebalance)&&e.push(this.createDefine("use-camera-wb",this.useCameraWhitebalance)),this.hasValue(this.useAutoWhitebalance)&&e.push(this.createDefine("use-auto-wb",this.useAutoWhitebalance)),e}}class Ot{_colorSpace=T.Undefined;_compression=wr.Undefined;_density=new He(0,0);_format=Te.Unknown;_height=0;_interlace=kr.Undefined;_orientation=Mr.Undefined;_quality=0;_width=0;get colorSpace(){return this._colorSpace}get compression(){return this._compression}get density(){return this._density}get format(){return this._format}get height(){return this._height}get interlace(){return this._interlace}get orientation(){return this._orientation}get quality(){return this._quality}get width(){return this._width}constructor(){}read(e,n){ie._create(t=>{t.ping(e,n),this._colorSpace=t.colorSpace,this._compression=t.compression,this._density=t.density,this._format=t.format,this._height=t.height,this._interlace=t.interlace,this._orientation=t.orientation,this._quality=t.quality,this._width=t.width})}static create(e,n){const t=new Ot;return t.read(e,n),t}}class Nn{constructor(e){this.complexOperator=e}complexOperator;signalToNoiseRatio;_setArtifacts(e){this.signalToNoiseRatio!==void 0&&e.setArtifact("complex:snr",this.signalToNoiseRatio)}}class zn{constructor(e){this.method=e}method;bestFit=!1;scale;viewport;_setArtifacts(e){this.scale!==void 0&&e.setArtifact("distort:scale",this.scale.toString()),this.viewport!==void 0&&e.setArtifact("distort:viewport",this.viewport.toString())}}class $n extends We{constructor(e){const n=l._api._MontageSettings_Create(),t=l._api._MontageSettings_Dispose;if(super(n,t),e.backgroundColor!==void 0&&e.backgroundColor._use(_=>{l._api._MontageSettings_SetBackgroundColor(this._instance,_)}),e.borderColor!==void 0&&e.borderColor._use(_=>{l._api._MontageSettings_SetBorderColor(this._instance,_)}),e.borderWidth!==void 0&&l._api._MontageSettings_SetBorderWidth(this._instance,e.borderWidth),e.fillColor!==void 0&&e.fillColor._use(_=>{l._api._MontageSettings_SetFillColor(this._instance,_)}),e.font!==void 0){const _=Se._getFontFileName(e.font);R(_,g=>{l._api._MontageSettings_SetFont(this._instance,g)})}e.fontPointsize!==void 0&&l._api._MontageSettings_SetFontPointsize(this._instance,e.fontPointsize),e.frameGeometry!==void 0&&R(e.frameGeometry.toString(),_=>{l._api._MontageSettings_SetFrameGeometry(this._instance,_)}),e.geometry!==void 0&&R(e.geometry.toString(),_=>{l._api._MontageSettings_SetGeometry(this._instance,_)}),e.gravity!==void 0&&l._api._MontageSettings_SetGravity(this._instance,e.gravity),e.shadow!==void 0&&l._api._MontageSettings_SetShadow(this._instance,e.shadow?1:0),e.strokeColor!==void 0&&e.strokeColor._use(_=>{l._api._MontageSettings_SetStrokeColor(this._instance,_)}),e.textureFileName!==void 0&&R(e.textureFileName,_=>{l._api._MontageSettings_SetTextureFileName(this._instance,_)}),e.tileGeometry!==void 0&&R(e.tileGeometry.toString(),_=>{l._api._MontageSettings_SetTileGeometry(this._instance,_)}),e.title!==void 0&&R(e.title,_=>{l._api._MontageSettings_SetTitle(this._instance,_)})}}class Hn{backgroundColor;borderColor;borderWidth;fillColor;font;fontPointsize;frameGeometry;geometry;gravity;label;shadow;strokeColor;textureFileName;tileGeometry;title;transparentColor;_use(e){const n=new $n(this);return he._disposeAfterExecution(n,e)}}class Yn{constructor(e,n,t){this.method=e,this.kernel=n,t!==void 0&&(this.kernel+=`:${t}`)}channels=j.Composite;convolveBias;convolveScale;iterations=1;kernel;method}class Un{constructor(e,n=0){this.minimum=e,this.maximum=n}minimum;maximum;toString(){return this.maximum===0?this.minimum.toString():`${this.minimum}-${this.maximum}`}}y.AlphaAction=Ti,y.AutoThresholdMethod=kn,y.ChannelPerceptualHash=Ye,y.ChannelStatistics=ji,y.Channels=j,y.ChromaticityInfo=Ai,y.ClassType=Mn,y.ColorProfile=Ri,y.ColorSpace=T,y.ColorSpaceNames=Ut,y.ColorTransformMode=Vt,y.ColorType=yn,y.CompareResult=vt,y.CompareSettings=Gi,y.ComplexOperator=Sn,y.ComplexSettings=Nn,y.CompositeOperator=wt,y.CompressionMethod=wr,y.ConfigurationFile=Yt,y.ConfigurationFiles=pt,y.ConnectedComponent=Mt,y.ConnectedComponentsSettings=Fi,y.DefinesCreator=yi,y.Density=He,y.DensityUnit=Le,y.DistortMethod=Cn,y.DistortSettings=zn,y.DitherMethod=Qt,y.DngInterpolation=yr,y.DngOutputColor=Sr,y.DngReadDefines=Bn,y.DrawableAffine=ue,y.DrawableBorderColor=Si,y.DrawableColor=Ci,y.DrawableFillColor=Ii,y.DrawableFillOpacity=Pi,y.DrawableFillRule=Di,y.DrawableFont=qi,y.DrawableFontPointSize=Ei,y.DrawableGravity=Ki,y.DrawableLine=Qi,y.DrawablePath=Ji,y.DrawablePoint=Oi,y.DrawableRectangle=Zi,y.DrawableRoundRectangle=er,y.DrawableStrokeColor=tr,y.DrawableStrokeDashArray=ir,y.DrawableStrokeDashOffset=rr,y.DrawableStrokeWidth=nr,y.DrawableText=ur,y.DrawableTextAlignment=ar,y.DrawableTextAntiAlias=tt,y.DrawableTextDecoration=sr,y.DrawableTextInterlineSpacing=or,y.DrawableTextInterwordSpacing=_r,y.DrawableTextKerning=cr,y.DrawableTextUnderColor=lr,y.Drawables=vr,y.DrawingWand=_t,y.Endian=In,y.ErrorMetric=Pn,y.EvaluateOperator=Dn,y.FillRule=zi,y.FilterType=En,y.GifDisposeMethod=bn,y.Gravity=O,y.ImageMagick=l,y.ImageProfile=jt,y.Interlace=kr,y.Kernel=Tn,y.LogEvent=bi,y.LogEventTypes=K,y.Magick=Se,y.MagickColor=w,y.MagickColors=hr,y.MagickDefine=mt,y.MagickError=N,y.MagickErrorInfo=ct,y.MagickErrorSeverity=kt,y.MagickFormat=Te,y.MagickFormatInfo=ye,y.MagickGeometry=ae,y.MagickImage=ie,y.MagickImageCollection=pe,y.MagickImageInfo=Ot,y.MagickReadSettings=Me,y.MagickSettings=et,y.MontageSettings=Hn,y.MorphologyMethod=An,y.MorphologySettings=Yn,y.NativeInstance=We,y.NoiseType=Rn,y.OffsetInfo=Hi,y.Orientation=Mr,y.PaintMethod=Gn,y.PathLineToAbs=gr,y.PathLineToRel=dr,y.PathMoveToAbs=fr,y.PathMoveToRel=pr,y.Paths=mr,y.Percentage=te,y.PerceptualHash=me,y.PixelChannel=x,y.PixelCollection=Ue,y.PixelIntensityMethod=Ui,y.PixelInterpolateMethod=Xi,y.Point=ke,y.PrimaryInfo=Be,y.ProgressEvent=Vi,y.QuantizeSettings=It,y.Quantum=De,y.RenderingIntent=Fn,y.Statistics=Pt,y.TextAlignment=xn,y.TextDecoration=Ln,y.Threshold=Un,y.TypeMetric=yt,y.VirtualPixelMethod=Wn,y.WarningEvent=Jt,y._getGravityEdges=Bi,y._getGravityName=Ni,y._isByteArray=Ht,y.initializeImageMagick=wn,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});