UNPKG

@itk-wasm/image-io

Version:

Input and output for scientific and medical image file formats.

6 lines 237 kB
var _r=Object.defineProperty;var $r=(A,e)=>{for(var t in e)_r(A,t,{get:e[t],enumerable:!0})};var Ai=new Map([["bmp","bmp"],["dcm","gdcm"],["gipl","gipl"],["gipl.gz","gipl"],["hdf5","hdf5"],["jpg","jpeg"],["jpeg","jpeg"],["iwi","wasm"],["iwi.cbor","wasm"],["iwi.cbor.zst","wasmZstd"],["lsm","lsm"],["mnc","mnc"],["mnc.gz","mnc"],["mnc2","mnc"],["mgh","mgh"],["mgz","mgh"],["mgh.gz","mgh"],["mha","meta"],["mhd","meta"],["mrc","mrc"],["nia","nifti"],["nii","nifti"],["nii.gz","nifti"],["hdr","nifti"],["nrrd","nrrd"],["nhdr","nrrd"],["png","png"],["pic","bioRad"],["tif","tiff"],["tiff","tiff"],["vtk","vtk"],["isq","scanco"],["aim","scanco"],["fdf","fdf"]]),Z=Ai;var ei={Int8:"int8",UInt8:"uint8",Int16:"int16",UInt16:"uint16",Int32:"int32",UInt32:"uint32",Int64:"int64",UInt64:"uint64",SizeValueType:"uint64",IdentifierType:"uint64",IndexValueType:"int64",OffsetValueType:"int64"},w=ei;var ti={Float32:"float32",Float64:"float64",SpacePrecisionType:"float64"},W=ti;function ri(A,e){let t=null;switch(A){case w.UInt8:{t=new Uint8Array(e);break}case w.Int8:{t=new Int8Array(e);break}case w.UInt16:{t=new Uint16Array(e);break}case w.Int16:{t=new Int16Array(e);break}case w.UInt32:{t=new Uint32Array(e);break}case w.Int32:{t=new Int32Array(e);break}case w.UInt64:{typeof globalThis.BigUint64Array=="function"?t=new BigUint64Array(e):t=new Uint8Array(e);break}case w.Int64:{typeof globalThis.BigInt64Array=="function"?t=new BigInt64Array(e):t=new Uint8Array(e);break}case W.Float32:{t=new Float32Array(e);break}case W.Float64:{t=new Float64Array(e);break}case"null":{t=null;break}case null:{t=null;break}default:throw new Error("Type is not supported as a TypedArray")}return t}var G=ri;var ii={Unknown:"Unknown",Scalar:"Scalar",RGB:"RGB",RGBA:"RGBA",Offset:"Offset",Vector:"Vector",Point:"Point",CovariantVector:"CovariantVector",SymmetricSecondRankTensor:"SymmetricSecondRankTensor",DiffusionTensor3D:"DiffusionTensor3D",Complex:"Complex",FixedArray:"FixedArray",Array:"Array",Matrix:"Matrix",VariableLengthVector:"VariableLengthVector",VariableSizeMatrix:"VariableSizeMatrix"},wA=ii;var XA=class{dimension;componentType;pixelType;components;constructor(e=2,t=w.UInt8,r=wA.Scalar,o=1){this.dimension=e,this.componentType=t,this.pixelType=r,this.components=o}},bt=XA;function oi(A,e,t,r,o){A[r+t*e]=o}var Wt=oi;var _A=class{imageType;name="Image";origin;spacing;direction;size;metadata;data;constructor(e=new bt){this.imageType=e;let t=e.dimension;this.origin=new Array(t),this.origin.fill(0),this.spacing=new Array(t),this.spacing.fill(1),this.direction=new Float64Array(t*t),this.direction.fill(0);for(let r=0;r<t;r++)Wt(this.direction,t,r,r,1);this.size=new Array(t),this.size.fill(0),this.metadata=new Map,this.data=null}},_=_A;function ai(A){let e=new _(A.imageType);if(e.name=A.name,e.origin=Array.from(A.origin),e.spacing=Array.from(A.spacing),e.direction=A.direction.slice(),e.size=Array.from(A.size),A.data!==null){let t=A.data.constructor;e.data=new t(A.data.length),e.data!=null&&e.data.set(A.data,0)}return e}var $A=ai;function ni(A){if(A.length<1)throw Error("At least one images is required.");let e=A[0];if(e.data===null)throw Error("Image data is null.");let t=new _(e.imageType);t.origin=Array.from(e.origin),t.spacing=Array.from(e.spacing);let r=t.imageType.dimension;t.direction=e.direction.slice();let o=r-1;t.size=Array.from(e.size);let i=A.reduce((a,s)=>a+s.size[o],0);t.size[o]=i;let n=t.size.reduce((a,s)=>a*s,1)*t.imageType.components,Q=e.data.constructor;t.data=new Q(n);let p=t.imageType.components;for(let a=0;a<t.size.length-1;a++)p*=t.size[a];let g=0;if(t.data!=null)for(let a=0;a<A.length;a++)t.data.set(A[a].data,p*g),g+=A[a].size[o];else throw Error("Could not create result image data.");return t}var Ae=ni;function Ii(A){let e=A.slice((A.lastIndexOf(".")-1>>>0)+2);if(e.toLowerCase()==="gz"){let t=A.slice(0,-3).lastIndexOf(".");e=A.slice((t-1>>>0)+2)}else if(e.toLowerCase()==="cbor"){let t=A.slice(0,-5).lastIndexOf(".");e=A.slice((t-1>>>0)+2)}else if(e.toLowerCase()==="zst"){let t=A.slice(0,-10).lastIndexOf(".");e=A.slice((t-1>>>0)+2)}else if(e.toLowerCase()==="zip"){let t=A.slice(0,-4).lastIndexOf(".");e=A.slice((t-1>>>0)+2)}return e}var sA=Ii;function si(A,e){let t={...A.imageType};if(typeof e<"u"&&typeof e.pixelType<"u"&&(t.pixelType=e.pixelType,e.pixelType===wA.Scalar&&t.components!==1))throw new Error("Cannot cast multi-component image to a scalar image");typeof e<"u"&&typeof e.componentType<"u"&&e.componentType!==A.imageType.componentType&&(t.componentType=e.componentType);let r=new _(t);if(r.name=A.name,r.origin=Array.from(A.origin),r.spacing=Array.from(A.spacing),r.direction=A.direction.slice(),r.size=Array.from(A.size),r.metadata=new Map(JSON.parse(JSON.stringify(Array.from(A.metadata)))),A.data!==null)if(typeof e<"u"&&typeof e.componentType<"u"&&e.componentType!==A.imageType.componentType)switch(A.imageType.componentType){case w.UInt8:case w.Int8:case w.UInt16:case w.Int16:case w.UInt32:case w.Int32:case W.Float32:case W.Float64:switch(r.imageType.componentType){case w.UInt8:r.data=new Uint8Array(A.data);break;case w.Int8:r.data=new Int8Array(A.data);break;case w.UInt16:r.data=new Uint16Array(A.data);break;case w.Int16:r.data=new Int16Array(A.data);break;case w.UInt32:r.data=new Uint32Array(A.data);break;case w.Int32:r.data=new Int32Array(A.data);break;case W.Float32:r.data=new Float32Array(A.data);break;case W.Float64:r.data=new Float64Array(A.data);break;case w.UInt64:r.data=new BigUint64Array(A.data.length);for(let o=0;o<r.data.length;o++)r.data[o]=BigInt.asIntN(64,BigInt(A.data[o]));break;case w.Int64:r.data=new BigInt64Array(A.data.length);for(let o=0;o<r.data.length;o++)r.data[o]=BigInt.asUintN(64,BigInt(A.data[o]));break}break;case w.UInt64:case w.Int64:switch(r.imageType.componentType){case w.UInt8:r.data=new Uint8Array(A.data.length);for(let o=0;o<r.data.length;o++)r.data[o]=Number(A.data[o]);break;case w.Int8:r.data=new Int8Array(A.data.length);for(let o=0;o<r.data.length;o++)r.data[o]=Number(A.data[o]);break;case w.UInt16:r.data=new Uint16Array(A.data.length);for(let o=0;o<r.data.length;o++)r.data[o]=Number(A.data[o]);break;case w.Int16:r.data=new Int16Array(A.data.length);for(let o=0;o<r.data.length;o++)r.data[o]=Number(A.data[o]);break;case w.UInt32:r.data=new Uint32Array(A.data.length);for(let o=0;o<r.data.length;o++)r.data[o]=Number(A.data[o]);break;case w.Int32:r.data=new Int32Array(A.data.length);for(let o=0;o<r.data.length;o++)r.data[o]=Number(A.data[o]);break;case W.Float32:r.data=new Float32Array(A.data.length);for(let o=0;o<r.data.length;o++)r.data[o]=Number(A.data[o]);break;case W.Float64:r.data=new Float64Array(A.data.length);for(let o=0;o<r.data.length;o++)r.data[o]=Number(A.data[o]);break;case w.UInt64:r.data=new BigUint64Array(A.data);break;case w.Int64:r.data=new BigInt64Array(A.data);break}break}else{let o=A.data.constructor;r.data=new o(A.data.length),r.data!=null&&r.data.set(A.data,0)}return r}var q=si;var ee=class{fcn;workerQueue;runInfo;constructor(e,t){this.fcn=t,this.workerQueue=new Array(e),this.workerQueue.fill(null),this.runInfo=[]}runTasks(e,t=null){let r={taskQueue:[],results:[],addingTasks:!1,postponed:!1,runningWorkers:0,index:0,completedTasks:0,progressCallback:t,canceled:!1};return this.runInfo.push(r),r.index=this.runInfo.length-1,{promise:new Promise((o,i)=>{r.resolve=o,r.reject=i,r.results=new Array(e.length),r.completedTasks=0,r.addingTasks=!0,e.forEach((n,Q)=>{this.addTask(r.index,Q,n)}),r.addingTasks=!1}),runId:r.index}}terminateWorkers(){for(let e=0;e<this.workerQueue.length;e++){let t=this.workerQueue[e];t?.terminate(),this.workerQueue[e]=null}}cancel(e){let t=this.runInfo[e];t!=null&&(t.canceled=!0)}addTask(e,t,r){let o=this.runInfo[e];if(o?.canceled===!0){o.reject("Remaining tasks canceled"),this.clearTask(o.index);return}if(this.workerQueue.length>0){let i=this.workerQueue.pop();o.runningWorkers++,r[r.length-1].webWorker=i,this.fcn(...r).then(({webWorker:n,...Q})=>{if(this.workerQueue.push(n),this.runInfo[e]!==null){if(o.runningWorkers--,o.results[t]=Q,o.completedTasks++,o.progressCallback!=null&&o.progressCallback(o.completedTasks,o.results.length),o.taskQueue.length>0){let p=o.taskQueue.shift();this.addTask(e,p[0],p[1])}else if(!o.addingTasks&&o.runningWorkers===0){let p=o.results;o.resolve(p),this.clearTask(o.index)}}}).catch(n=>{o.reject(n),this.clearTask(o.index)})}else o.runningWorkers!==0||o.postponed?o.taskQueue.push([t,r]):(o.postponed=!0,setTimeout(()=>{o.postponed=!1,this.addTask(o.index,t,r)},50))}clearTask(e){this.runInfo[e].results=[],this.runInfo[e].taskQueue=[],this.runInfo[e].progressCallback=null,this.runInfo[e].canceled=null,this.runInfo[e].reject=()=>{},this.runInfo[e].resolve=()=>{}}},te=ee;var gi={TextFile:"TextFile",BinaryFile:"BinaryFile",TextStream:"TextStream",BinaryStream:"BinaryStream",Image:"Image",PointSet:"PointSet",Mesh:"Mesh",PolyData:"PolyData",TransformList:"TransformList",JsonCompatible:"JsonCompatible"},C=gi;var Ot=Symbol("Comlink.proxy"),Bi=Symbol("Comlink.endpoint"),oe=Symbol("Comlink.releaseProxy"),re=Symbol("Comlink.finalizer"),RA=Symbol("Comlink.thrown"),Lt=A=>typeof A=="object"&&A!==null||typeof A=="function",Ci={canHandle:A=>Lt(A)&&A[Ot],serialize(A){let{port1:e,port2:t}=new MessageChannel;return Pt(A,e),[t,[t]]},deserialize(A){return A.start(),ae(A)}},Qi={canHandle:A=>Lt(A)&&RA in A,serialize({value:A}){let e;return A instanceof Error?e={isError:!0,value:{message:A.message,name:A.name,stack:A.stack}}:e={isError:!1,value:A},[e,[]]},deserialize(A){throw A.isError?Object.assign(new Error(A.value.message),A.value):A.value}},Jt=new Map([["proxy",Ci],["throw",Qi]]);function li(A,e){for(let t of A)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return!0;return!1}function Pt(A,e=globalThis,t=["*"]){e.addEventListener("message",function r(o){if(!o||!o.data)return;if(!li(t,o.origin)){console.warn(`Invalid origin '${o.origin}' for comlink proxy`);return}let{id:i,type:n,path:Q}=Object.assign({path:[]},o.data),p=(o.data.argumentList||[]).map(z),g;try{let a=Q.slice(0,-1).reduce((l,I)=>l[I],A),s=Q.reduce((l,I)=>l[I],A);switch(n){case"GET":g=s;break;case"SET":a[Q.slice(-1)[0]]=z(o.data.value),g=!0;break;case"APPLY":g=s.apply(a,p);break;case"CONSTRUCT":{let l=new s(...p);g=ci(l)}break;case"ENDPOINT":{let{port1:l,port2:I}=new MessageChannel;Pt(A,I),g=ne(l,[l])}break;case"RELEASE":g=void 0;break;default:return}}catch(a){g={value:a,[RA]:0}}Promise.resolve(g).catch(a=>({value:a,[RA]:0})).then(a=>{let[s,l]=UA(a);e.postMessage(Object.assign(Object.assign({},s),{id:i}),l),n==="RELEASE"&&(e.removeEventListener("message",r),xt(e),re in A&&typeof A[re]=="function"&&A[re]())}).catch(a=>{let[s,l]=UA({value:new TypeError("Unserializable return value"),[RA]:0});e.postMessage(Object.assign(Object.assign({},s),{id:i}),l)})}),e.start&&e.start()}function pi(A){return A.constructor.name==="MessagePort"}function xt(A){pi(A)&&A.close()}function ae(A,e){return ie(A,[],e)}function DA(A){if(A)throw new Error("Proxy has been released and is not useable")}function Mt(A){return $(A,{type:"RELEASE"}).then(()=>{xt(A)})}var kA=new WeakMap,FA="FinalizationRegistry"in globalThis&&new FinalizationRegistry(A=>{let e=(kA.get(A)||0)-1;kA.set(A,e),e===0&&Mt(A)});function Ei(A,e){let t=(kA.get(e)||0)+1;kA.set(e,t),FA&&FA.register(A,e,A)}function mi(A){FA&&FA.unregister(A)}function ie(A,e=[],t=function(){}){let r=!1,o=new Proxy(t,{get(i,n){if(DA(r),n===oe)return()=>{mi(o),Mt(A),r=!0};if(n==="then"){if(e.length===0)return{then:()=>o};let Q=$(A,{type:"GET",path:e.map(p=>p.toString())}).then(z);return Q.then.bind(Q)}return ie(A,[...e,n])},set(i,n,Q){DA(r);let[p,g]=UA(Q);return $(A,{type:"SET",path:[...e,n].map(a=>a.toString()),value:p},g).then(z)},apply(i,n,Q){DA(r);let p=e[e.length-1];if(p===Bi)return $(A,{type:"ENDPOINT"}).then(z);if(p==="bind")return ie(A,e.slice(0,-1));let[g,a]=Gt(Q);return $(A,{type:"APPLY",path:e.map(s=>s.toString()),argumentList:g},a).then(z)},construct(i,n){DA(r);let[Q,p]=Gt(n);return $(A,{type:"CONSTRUCT",path:e.map(g=>g.toString()),argumentList:Q},p).then(z)}});return Ei(o,A),o}function ui(A){return Array.prototype.concat.apply([],A)}function Gt(A){let e=A.map(UA);return[e.map(t=>t[0]),ui(e.map(t=>t[1]))]}var Tt=new WeakMap;function ne(A,e){return Tt.set(A,e),A}function ci(A){return Object.assign(A,{[Ot]:!0})}function UA(A){for(let[e,t]of Jt)if(t.canHandle(A)){let[r,o]=t.serialize(A);return[{type:"HANDLER",name:e,value:r},o]}return[{type:"RAW",value:A},Tt.get(A)||[]]}function z(A){switch(A.type){case"HANDLER":return Jt.get(A.name).deserialize(A.value);case"RAW":return A.value}}function $(A,e,t){return new Promise(r=>{let o=fi();A.addEventListener("message",function i(n){!n.data||!n.data.id||n.data.id!==o||(A.removeEventListener("message",i),r(n.data))}),A.start&&A.start(),A.postMessage(Object.assign({id:o},e),t)})}function fi(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}function gA(A,e){return function(){return A.apply(e,arguments)}}var{toString:di}=Object.prototype,{getPrototypeOf:ge}=Object,SA=(A=>e=>{let t=di.call(e);return A[t]||(A[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),J=A=>(A=A.toLowerCase(),e=>SA(e)===A),bA=A=>e=>typeof e===A,{isArray:AA}=Array,BA=bA("undefined");function yi(A){return A!==null&&!BA(A)&&A.constructor!==null&&!BA(A.constructor)&&O(A.constructor.isBuffer)&&A.constructor.isBuffer(A)}var Kt=J("ArrayBuffer");function hi(A){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(A):e=A&&A.buffer&&Kt(A.buffer),e}var wi=bA("string"),O=bA("function"),jt=bA("number"),WA=A=>A!==null&&typeof A=="object",Di=A=>A===!0||A===!1,NA=A=>{if(SA(A)!=="object")return!1;let e=ge(A);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in A)&&!(Symbol.iterator in A)},Ri=J("Date"),ki=J("File"),Fi=J("Blob"),Ui=J("FileList"),Ni=A=>WA(A)&&O(A.pipe),Si=A=>{let e;return A&&(typeof FormData=="function"&&A instanceof FormData||O(A.append)&&((e=SA(A))==="formdata"||e==="object"&&O(A.toString)&&A.toString()==="[object FormData]"))},bi=J("URLSearchParams"),[Wi,Gi,Oi,Li]=["ReadableStream","Request","Response","Headers"].map(J),Ji=A=>A.trim?A.trim():A.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function CA(A,e,{allOwnKeys:t=!1}={}){if(A===null||typeof A>"u")return;let r,o;if(typeof A!="object"&&(A=[A]),AA(A))for(r=0,o=A.length;r<o;r++)e.call(null,A[r],r,A);else{let i=t?Object.getOwnPropertyNames(A):Object.keys(A),n=i.length,Q;for(r=0;r<n;r++)Q=i[r],e.call(null,A[Q],Q,A)}}function vt(A,e){e=e.toLowerCase();let t=Object.keys(A),r=t.length,o;for(;r-- >0;)if(o=t[r],e===o.toLowerCase())return o;return null}var X=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Vt=A=>!BA(A)&&A!==X;function se(){let{caseless:A}=Vt(this)&&this||{},e={},t=(r,o)=>{let i=A&&vt(e,o)||o;NA(e[i])&&NA(r)?e[i]=se(e[i],r):NA(r)?e[i]=se({},r):AA(r)?e[i]=r.slice():e[i]=r};for(let r=0,o=arguments.length;r<o;r++)arguments[r]&&CA(arguments[r],t);return e}var Pi=(A,e,t,{allOwnKeys:r}={})=>(CA(e,(o,i)=>{t&&O(o)?A[i]=gA(o,t):A[i]=o},{allOwnKeys:r}),A),xi=A=>(A.charCodeAt(0)===65279&&(A=A.slice(1)),A),Mi=(A,e,t,r)=>{A.prototype=Object.create(e.prototype,r),A.prototype.constructor=A,Object.defineProperty(A,"super",{value:e.prototype}),t&&Object.assign(A.prototype,t)},Ti=(A,e,t,r)=>{let o,i,n,Q={};if(e=e||{},A==null)return e;do{for(o=Object.getOwnPropertyNames(A),i=o.length;i-- >0;)n=o[i],(!r||r(n,A,e))&&!Q[n]&&(e[n]=A[n],Q[n]=!0);A=t!==!1&&ge(A)}while(A&&(!t||t(A,e))&&A!==Object.prototype);return e},Hi=(A,e,t)=>{A=String(A),(t===void 0||t>A.length)&&(t=A.length),t-=e.length;let r=A.indexOf(e,t);return r!==-1&&r===t},Yi=A=>{if(!A)return null;if(AA(A))return A;let e=A.length;if(!jt(e))return null;let t=new Array(e);for(;e-- >0;)t[e]=A[e];return t},qi=(A=>e=>A&&e instanceof A)(typeof Uint8Array<"u"&&ge(Uint8Array)),Ki=(A,e)=>{let r=(A&&A[Symbol.iterator]).call(A),o;for(;(o=r.next())&&!o.done;){let i=o.value;e.call(A,i[0],i[1])}},ji=(A,e)=>{let t,r=[];for(;(t=A.exec(e))!==null;)r.push(t);return r},vi=J("HTMLFormElement"),Vi=A=>A.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,o){return r.toUpperCase()+o}),Yt=(({hasOwnProperty:A})=>(e,t)=>A.call(e,t))(Object.prototype),Zi=J("RegExp"),Zt=(A,e)=>{let t=Object.getOwnPropertyDescriptors(A),r={};CA(t,(o,i)=>{let n;(n=e(o,i,A))!==!1&&(r[i]=n||o)}),Object.defineProperties(A,r)},zi=A=>{Zt(A,(e,t)=>{if(O(A)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;let r=A[t];if(O(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},Xi=(A,e)=>{let t={},r=o=>{o.forEach(i=>{t[i]=!0})};return AA(A)?r(A):r(String(A).split(e)),t},_i=()=>{},$i=(A,e)=>A!=null&&Number.isFinite(A=+A)?A:e,Ie="abcdefghijklmnopqrstuvwxyz",qt="0123456789",zt={DIGIT:qt,ALPHA:Ie,ALPHA_DIGIT:Ie+Ie.toUpperCase()+qt},Ao=(A=16,e=zt.ALPHA_DIGIT)=>{let t="",{length:r}=e;for(;A--;)t+=e[Math.random()*r|0];return t};function eo(A){return!!(A&&O(A.append)&&A[Symbol.toStringTag]==="FormData"&&A[Symbol.iterator])}var to=A=>{let e=new Array(10),t=(r,o)=>{if(WA(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[o]=r;let i=AA(r)?[]:{};return CA(r,(n,Q)=>{let p=t(n,o+1);!BA(p)&&(i[Q]=p)}),e[o]=void 0,i}}return r};return t(A,0)},ro=J("AsyncFunction"),io=A=>A&&(WA(A)||O(A))&&O(A.then)&&O(A.catch),Xt=((A,e)=>A?setImmediate:e?((t,r)=>(X.addEventListener("message",({source:o,data:i})=>{o===X&&i===t&&r.length&&r.shift()()},!1),o=>{r.push(o),X.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",O(X.postMessage)),oo=typeof queueMicrotask<"u"?queueMicrotask.bind(X):typeof process<"u"&&process.nextTick||Xt,E={isArray:AA,isArrayBuffer:Kt,isBuffer:yi,isFormData:Si,isArrayBufferView:hi,isString:wi,isNumber:jt,isBoolean:Di,isObject:WA,isPlainObject:NA,isReadableStream:Wi,isRequest:Gi,isResponse:Oi,isHeaders:Li,isUndefined:BA,isDate:Ri,isFile:ki,isBlob:Fi,isRegExp:Zi,isFunction:O,isStream:Ni,isURLSearchParams:bi,isTypedArray:qi,isFileList:Ui,forEach:CA,merge:se,extend:Pi,trim:Ji,stripBOM:xi,inherits:Mi,toFlatObject:Ti,kindOf:SA,kindOfTest:J,endsWith:Hi,toArray:Yi,forEachEntry:Ki,matchAll:ji,isHTMLForm:vi,hasOwnProperty:Yt,hasOwnProp:Yt,reduceDescriptors:Zt,freezeMethods:zi,toObjectSet:Xi,toCamelCase:Vi,noop:_i,toFiniteNumber:$i,findKey:vt,global:X,isContextDefined:Vt,ALPHABET:zt,generateString:Ao,isSpecCompliantForm:eo,toJSONObject:to,isAsyncFn:ro,isThenable:io,setImmediate:Xt,asap:oo};function eA(A,e,t,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=A,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),r&&(this.request=r),o&&(this.response=o)}E.inherits(eA,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:E.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var _t=eA.prototype,$t={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(A=>{$t[A]={value:A}});Object.defineProperties(eA,$t);Object.defineProperty(_t,"isAxiosError",{value:!0});eA.from=(A,e,t,r,o,i)=>{let n=Object.create(_t);return E.toFlatObject(A,n,function(p){return p!==Error.prototype},Q=>Q!=="isAxiosError"),eA.call(n,A.message,e,t,r,o),n.cause=A,n.name=A.name,i&&Object.assign(n,i),n};var h=eA;var GA=null;function Be(A){return E.isPlainObject(A)||E.isArray(A)}function er(A){return E.endsWith(A,"[]")?A.slice(0,-2):A}function Ar(A,e,t){return A?A.concat(e).map(function(o,i){return o=er(o),!t&&i?"["+o+"]":o}).join(t?".":""):e}function ao(A){return E.isArray(A)&&!A.some(Be)}var no=E.toFlatObject(E,{},null,function(e){return/^is[A-Z]/.test(e)});function Io(A,e,t){if(!E.isObject(A))throw new TypeError("target must be an object");e=e||new(GA||FormData),t=E.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(u,m){return!E.isUndefined(m[u])});let r=t.metaTokens,o=t.visitor||a,i=t.dots,n=t.indexes,p=(t.Blob||typeof Blob<"u"&&Blob)&&E.isSpecCompliantForm(e);if(!E.isFunction(o))throw new TypeError("visitor must be a function");function g(B){if(B===null)return"";if(E.isDate(B))return B.toISOString();if(!p&&E.isBlob(B))throw new h("Blob is not supported. Use a Buffer instead.");return E.isArrayBuffer(B)||E.isTypedArray(B)?p&&typeof Blob=="function"?new Blob([B]):Buffer.from(B):B}function a(B,u,m){let R=B;if(B&&!m&&typeof B=="object"){if(E.endsWith(u,"{}"))u=r?u:u.slice(0,-2),B=JSON.stringify(B);else if(E.isArray(B)&&ao(B)||(E.isFileList(B)||E.endsWith(u,"[]"))&&(R=E.toArray(B)))return u=er(u),R.forEach(function(D,L){!(E.isUndefined(D)||D===null)&&e.append(n===!0?Ar([u],L,i):n===null?u:u+"[]",g(D))}),!1}return Be(B)?!0:(e.append(Ar(m,u,i),g(B)),!1)}let s=[],l=Object.assign(no,{defaultVisitor:a,convertValue:g,isVisitable:Be});function I(B,u){if(!E.isUndefined(B)){if(s.indexOf(B)!==-1)throw Error("Circular reference detected in "+u.join("."));s.push(B),E.forEach(B,function(R,S){(!(E.isUndefined(R)||R===null)&&o.call(e,R,E.isString(S)?S.trim():S,u,l))===!0&&I(R,u?u.concat(S):[S])}),s.pop()}}if(!E.isObject(A))throw new TypeError("data must be an object");return I(A),e}var K=Io;function tr(A){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(A).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function rr(A,e){this._pairs=[],A&&K(A,this,e)}var ir=rr.prototype;ir.append=function(e,t){this._pairs.push([e,t])};ir.toString=function(e){let t=e?function(r){return e.call(this,r,tr)}:tr;return this._pairs.map(function(o){return t(o[0])+"="+t(o[1])},"").join("&")};var OA=rr;function so(A){return encodeURIComponent(A).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function QA(A,e,t){if(!e)return A;let r=t&&t.encode||so,o=t&&t.serialize,i;if(o?i=o(e,t):i=E.isURLSearchParams(e)?e.toString():new OA(e,t).toString(r),i){let n=A.indexOf("#");n!==-1&&(A=A.slice(0,n)),A+=(A.indexOf("?")===-1?"?":"&")+i}return A}var Ce=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){E.forEach(this.handlers,function(r){r!==null&&e(r)})}},Qe=Ce;var LA={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var or=typeof URLSearchParams<"u"?URLSearchParams:OA;var ar=typeof FormData<"u"?FormData:null;var nr=typeof Blob<"u"?Blob:null;var Ir={isBrowser:!0,classes:{URLSearchParams:or,FormData:ar,Blob:nr},protocols:["http","https","file","blob","url","data"]};var pe={};$r(pe,{hasBrowserEnv:()=>le,hasStandardBrowserEnv:()=>go,hasStandardBrowserWebWorkerEnv:()=>Bo,origin:()=>Co});var le=typeof window<"u"&&typeof document<"u",go=(A=>le&&["ReactNative","NativeScript","NS"].indexOf(A)<0)(typeof navigator<"u"&&navigator.product),Bo=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Co=le&&window.location.href||"http://localhost";var N={...pe,...Ir};function Ee(A,e){return K(A,new N.classes.URLSearchParams,Object.assign({visitor:function(t,r,o,i){return N.isNode&&E.isBuffer(t)?(this.append(r,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function Qo(A){return E.matchAll(/\w+|\[(\w*)]/g,A).map(e=>e[0]==="[]"?"":e[1]||e[0])}function lo(A){let e={},t=Object.keys(A),r,o=t.length,i;for(r=0;r<o;r++)i=t[r],e[i]=A[i];return e}function po(A){function e(t,r,o,i){let n=t[i++];if(n==="__proto__")return!0;let Q=Number.isFinite(+n),p=i>=t.length;return n=!n&&E.isArray(o)?o.length:n,p?(E.hasOwnProp(o,n)?o[n]=[o[n],r]:o[n]=r,!Q):((!o[n]||!E.isObject(o[n]))&&(o[n]=[]),e(t,r,o[n],i)&&E.isArray(o[n])&&(o[n]=lo(o[n])),!Q)}if(E.isFormData(A)&&E.isFunction(A.entries)){let t={};return E.forEachEntry(A,(r,o)=>{e(Qo(r),o,t,0)}),t}return null}var JA=po;function Eo(A,e,t){if(E.isString(A))try{return(e||JSON.parse)(A),E.trim(A)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(A)}var me={transitional:LA,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){let r=t.getContentType()||"",o=r.indexOf("application/json")>-1,i=E.isObject(e);if(i&&E.isHTMLForm(e)&&(e=new FormData(e)),E.isFormData(e))return o?JSON.stringify(JA(e)):e;if(E.isArrayBuffer(e)||E.isBuffer(e)||E.isStream(e)||E.isFile(e)||E.isBlob(e)||E.isReadableStream(e))return e;if(E.isArrayBufferView(e))return e.buffer;if(E.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let Q;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Ee(e,this.formSerializer).toString();if((Q=E.isFileList(e))||r.indexOf("multipart/form-data")>-1){let p=this.env&&this.env.FormData;return K(Q?{"files[]":e}:e,p&&new p,this.formSerializer)}}return i||o?(t.setContentType("application/json",!1),Eo(e)):e}],transformResponse:[function(e){let t=this.transitional||me.transitional,r=t&&t.forcedJSONParsing,o=this.responseType==="json";if(E.isResponse(e)||E.isReadableStream(e))return e;if(e&&E.isString(e)&&(r&&!this.responseType||o)){let n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e)}catch(Q){if(n)throw Q.name==="SyntaxError"?h.from(Q,h.ERR_BAD_RESPONSE,this,null,this.response):Q}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:N.classes.FormData,Blob:N.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};E.forEach(["delete","get","head","post","put","patch"],A=>{me.headers[A]={}});var tA=me;var mo=E.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),sr=A=>{let e={},t,r,o;return A&&A.split(` `).forEach(function(n){o=n.indexOf(":"),t=n.substring(0,o).trim().toLowerCase(),r=n.substring(o+1).trim(),!(!t||e[t]&&mo[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e};var gr=Symbol("internals");function lA(A){return A&&String(A).trim().toLowerCase()}function PA(A){return A===!1||A==null?A:E.isArray(A)?A.map(PA):String(A)}function uo(A){let e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=t.exec(A);)e[r[1]]=r[2];return e}var co=A=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(A.trim());function ue(A,e,t,r,o){if(E.isFunction(r))return r.call(this,e,t);if(o&&(e=t),!!E.isString(e)){if(E.isString(r))return e.indexOf(r)!==-1;if(E.isRegExp(r))return r.test(e)}}function fo(A){return A.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function yo(A,e){let t=E.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(A,r+t,{value:function(o,i,n){return this[r].call(this,e,o,i,n)},configurable:!0})})}var rA=class{constructor(e){e&&this.set(e)}set(e,t,r){let o=this;function i(Q,p,g){let a=lA(p);if(!a)throw new Error("header name must be a non-empty string");let s=E.findKey(o,a);(!s||o[s]===void 0||g===!0||g===void 0&&o[s]!==!1)&&(o[s||p]=PA(Q))}let n=(Q,p)=>E.forEach(Q,(g,a)=>i(g,a,p));if(E.isPlainObject(e)||e instanceof this.constructor)n(e,t);else if(E.isString(e)&&(e=e.trim())&&!co(e))n(sr(e),t);else if(E.isHeaders(e))for(let[Q,p]of e.entries())i(p,Q,r);else e!=null&&i(t,e,r);return this}get(e,t){if(e=lA(e),e){let r=E.findKey(this,e);if(r){let o=this[r];if(!t)return o;if(t===!0)return uo(o);if(E.isFunction(t))return t.call(this,o,r);if(E.isRegExp(t))return t.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=lA(e),e){let r=E.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||ue(this,this[r],r,t)))}return!1}delete(e,t){let r=this,o=!1;function i(n){if(n=lA(n),n){let Q=E.findKey(r,n);Q&&(!t||ue(r,r[Q],Q,t))&&(delete r[Q],o=!0)}}return E.isArray(e)?e.forEach(i):i(e),o}clear(e){let t=Object.keys(this),r=t.length,o=!1;for(;r--;){let i=t[r];(!e||ue(this,this[i],i,e,!0))&&(delete this[i],o=!0)}return o}normalize(e){let t=this,r={};return E.forEach(this,(o,i)=>{let n=E.findKey(r,i);if(n){t[n]=PA(o),delete t[i];return}let Q=e?fo(i):String(i).trim();Q!==i&&delete t[i],t[Q]=PA(o),r[Q]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return E.forEach(this,(r,o)=>{r!=null&&r!==!1&&(t[o]=e&&E.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let r=new this(e);return t.forEach(o=>r.set(o)),r}static accessor(e){let r=(this[gr]=this[gr]={accessors:{}}).accessors,o=this.prototype;function i(n){let Q=lA(n);r[Q]||(yo(o,n),r[Q]=!0)}return E.isArray(e)?e.forEach(i):i(e),this}};rA.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);E.reduceDescriptors(rA.prototype,({value:A},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>A,set(r){this[t]=r}}});E.freezeMethods(rA);var U=rA;function pA(A,e){let t=this||tA,r=e||t,o=U.from(r.headers),i=r.data;return E.forEach(A,function(Q){i=Q.call(t,i,o.normalize(),e?e.status:void 0)}),o.normalize(),i}function EA(A){return!!(A&&A.__CANCEL__)}function Br(A,e,t){h.call(this,A??"canceled",h.ERR_CANCELED,e,t),this.name="CanceledError"}E.inherits(Br,h,{__CANCEL__:!0});var T=Br;function mA(A,e,t){let r=t.config.validateStatus;!t.status||!r||r(t.status)?A(t):e(new h("Request failed with status code "+t.status,[h.ERR_BAD_REQUEST,h.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function ce(A){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(A);return e&&e[1]||""}function ho(A,e){A=A||10;let t=new Array(A),r=new Array(A),o=0,i=0,n;return e=e!==void 0?e:1e3,function(p){let g=Date.now(),a=r[i];n||(n=g),t[o]=p,r[o]=g;let s=i,l=0;for(;s!==o;)l+=t[s++],s=s%A;if(o=(o+1)%A,o===i&&(i=(i+1)%A),g-n<e)return;let I=a&&g-a;return I?Math.round(l*1e3/I):void 0}}var Cr=ho;function wo(A,e){let t=0,r=1e3/e,o,i,n=(g,a=Date.now())=>{t=a,o=null,i&&(clearTimeout(i),i=null),A.apply(null,g)};return[(...g)=>{let a=Date.now(),s=a-t;s>=r?n(g,a):(o=g,i||(i=setTimeout(()=>{i=null,n(o)},r-s)))},()=>o&&n(o)]}var Qr=wo;var iA=(A,e,t=3)=>{let r=0,o=Cr(50,250);return Qr(i=>{let n=i.loaded,Q=i.lengthComputable?i.total:void 0,p=n-r,g=o(p),a=n<=Q;r=n;let s={loaded:n,total:Q,progress:Q?n/Q:void 0,bytes:p,rate:g||void 0,estimated:g&&Q&&a?(Q-n)/g:void 0,event:i,lengthComputable:Q!=null,[e?"download":"upload"]:!0};A(s)},t)},fe=(A,e)=>{let t=A!=null;return[r=>e[0]({lengthComputable:t,total:A,loaded:r}),e[1]]},de=A=>(...e)=>E.asap(()=>A(...e));var lr=N.hasStandardBrowserEnv?function(){let e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),r;function o(i){let n=i;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return r=o(window.location.href),function(n){let Q=E.isString(n)?o(n):n;return Q.protocol===r.protocol&&Q.host===r.host}}():function(){return function(){return!0}}();var pr=N.hasStandardBrowserEnv?{write(A,e,t,r,o,i){let n=[A+"="+encodeURIComponent(e)];E.isNumber(t)&&n.push("expires="+new Date(t).toGMTString()),E.isString(r)&&n.push("path="+r),E.isString(o)&&n.push("domain="+o),i===!0&&n.push("secure"),document.cookie=n.join("; ")},read(A){let e=document.cookie.match(new RegExp("(^|;\\s*)("+A+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(A){this.write(A,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function ye(A){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(A)}function he(A,e){return e?A.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):A}function uA(A,e){return A&&!ye(e)?he(A,e):e}var Er=A=>A instanceof U?{...A}:A;function P(A,e){e=e||{};let t={};function r(g,a,s){return E.isPlainObject(g)&&E.isPlainObject(a)?E.merge.call({caseless:s},g,a):E.isPlainObject(a)?E.merge({},a):E.isArray(a)?a.slice():a}function o(g,a,s){if(E.isUndefined(a)){if(!E.isUndefined(g))return r(void 0,g,s)}else return r(g,a,s)}function i(g,a){if(!E.isUndefined(a))return r(void 0,a)}function n(g,a){if(E.isUndefined(a)){if(!E.isUndefined(g))return r(void 0,g)}else return r(void 0,a)}function Q(g,a,s){if(s in e)return r(g,a);if(s in A)return r(void 0,g)}let p={url:i,method:i,data:i,baseURL:n,transformRequest:n,transformResponse:n,paramsSerializer:n,timeout:n,timeoutMessage:n,withCredentials:n,withXSRFToken:n,adapter:n,responseType:n,xsrfCookieName:n,xsrfHeaderName:n,onUploadProgress:n,onDownloadProgress:n,decompress:n,maxContentLength:n,maxBodyLength:n,beforeRedirect:n,transport:n,httpAgent:n,httpsAgent:n,cancelToken:n,socketPath:n,responseEncoding:n,validateStatus:Q,headers:(g,a)=>o(Er(g),Er(a),!0)};return E.forEach(Object.keys(Object.assign({},A,e)),function(a){let s=p[a]||o,l=s(A[a],e[a],a);E.isUndefined(l)&&s!==Q||(t[a]=l)}),t}var xA=A=>{let e=P({},A),{data:t,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:n,auth:Q}=e;e.headers=n=U.from(n),e.url=QA(uA(e.baseURL,e.url),A.params,A.paramsSerializer),Q&&n.set("Authorization","Basic "+btoa((Q.username||"")+":"+(Q.password?unescape(encodeURIComponent(Q.password)):"")));let p;if(E.isFormData(t)){if(N.hasStandardBrowserEnv||N.hasStandardBrowserWebWorkerEnv)n.setContentType(void 0);else if((p=n.getContentType())!==!1){let[g,...a]=p?p.split(";").map(s=>s.trim()).filter(Boolean):[];n.setContentType([g||"multipart/form-data",...a].join("; "))}}if(N.hasStandardBrowserEnv&&(r&&E.isFunction(r)&&(r=r(e)),r||r!==!1&&lr(e.url))){let g=o&&i&&pr.read(i);g&&n.set(o,g)}return e};var Do=typeof XMLHttpRequest<"u",mr=Do&&function(A){return new Promise(function(t,r){let o=xA(A),i=o.data,n=U.from(o.headers).normalize(),{responseType:Q,onUploadProgress:p,onDownloadProgress:g}=o,a,s,l,I,B;function u(){I&&I(),B&&B(),o.cancelToken&&o.cancelToken.unsubscribe(a),o.signal&&o.signal.removeEventListener("abort",a)}let m=new XMLHttpRequest;m.open(o.method.toUpperCase(),o.url,!0),m.timeout=o.timeout;function R(){if(!m)return;let D=U.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),V={data:!Q||Q==="text"||Q==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:D,config:A,request:m};mA(function(M){t(M),u()},function(M){r(M),u()},V),m=null}"onloadend"in m?m.onloadend=R:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(R)},m.onabort=function(){m&&(r(new h("Request aborted",h.ECONNABORTED,A,m)),m=null)},m.onerror=function(){r(new h("Network Error",h.ERR_NETWORK,A,m)),m=null},m.ontimeout=function(){let L=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",V=o.transitional||LA;o.timeoutErrorMessage&&(L=o.timeoutErrorMessage),r(new h(L,V.clarifyTimeoutError?h.ETIMEDOUT:h.ECONNABORTED,A,m)),m=null},i===void 0&&n.setContentType(null),"setRequestHeader"in m&&E.forEach(n.toJSON(),function(L,V){m.setRequestHeader(V,L)}),E.isUndefined(o.withCredentials)||(m.withCredentials=!!o.withCredentials),Q&&Q!=="json"&&(m.responseType=o.responseType),g&&([l,B]=iA(g,!0),m.addEventListener("progress",l)),p&&m.upload&&([s,I]=iA(p),m.upload.addEventListener("progress",s),m.upload.addEventListener("loadend",I)),(o.cancelToken||o.signal)&&(a=D=>{m&&(r(!D||D.type?new T(null,A,m):D),m.abort(),m=null)},o.cancelToken&&o.cancelToken.subscribe(a),o.signal&&(o.signal.aborted?a():o.signal.addEventListener("abort",a)));let S=ce(o.url);if(S&&N.protocols.indexOf(S)===-1){r(new h("Unsupported protocol "+S+":",h.ERR_BAD_REQUEST,A));return}m.send(i||null)})};var Ro=(A,e)=>{let t=new AbortController,r,o=function(p){if(!r){r=!0,n();let g=p instanceof Error?p:this.reason;t.abort(g instanceof h?g:new T(g instanceof Error?g.message:g))}},i=e&&setTimeout(()=>{o(new h(`timeout ${e} of ms exceeded`,h.ETIMEDOUT))},e),n=()=>{A&&(i&&clearTimeout(i),i=null,A.forEach(p=>{p&&(p.removeEventListener?p.removeEventListener("abort",o):p.unsubscribe(o))}),A=null)};A.forEach(p=>p&&p.addEventListener&&p.addEventListener("abort",o));let{signal:Q}=t;return Q.unsubscribe=n,[Q,()=>{i&&clearTimeout(i),i=null}]},ur=Ro;var ko=function*(A,e){let t=A.byteLength;if(!e||t<e){yield A;return}let r=0,o;for(;r<t;)o=r+e,yield A.slice(r,o),r=o},Fo=async function*(A,e,t){for await(let r of A)yield*ko(ArrayBuffer.isView(r)?r:await t(String(r)),e)},we=(A,e,t,r,o)=>{let i=Fo(A,e,o),n=0,Q,p=g=>{Q||(Q=!0,r&&r(g))};return new ReadableStream({async pull(g){try{let{done:a,value:s}=await i.next();if(a){p(),g.close();return}let l=s.byteLength;if(t){let I=n+=l;t(I)}g.enqueue(new Uint8Array(s))}catch(a){throw p(a),a}},cancel(g){return p(g),i.return()}},{highWaterMark:2})};var TA=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",fr=TA&&typeof ReadableStream=="function",De=TA&&(typeof TextEncoder=="function"?(A=>e=>A.encode(e))(new TextEncoder):async A=>new Uint8Array(await new Response(A).arrayBuffer())),dr=(A,...e)=>{try{return!!A(...e)}catch{return!1}},Uo=fr&&dr(()=>{let A=!1,e=new Request(N.origin,{body:new ReadableStream,method:"POST",get duplex(){return A=!0,"half"}}).headers.has("Content-Type");return A&&!e}),cr=64*1024,Re=fr&&dr(()=>E.isReadableStream(new Response("").body)),MA={stream:Re&&(A=>A.body)};TA&&(A=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!MA[e]&&(MA[e]=E.isFunction(A[e])?t=>t[e]():(t,r)=>{throw new h(`Response type '${e}' is not supported`,h.ERR_NOT_SUPPORT,r)})})})(new Response);var No=async A=>{if(A==null)return 0;if(E.isBlob(A))return A.size;if(E.isSpecCompliantForm(A))return(await new Request(A).arrayBuffer()).byteLength;if(E.isArrayBufferView(A)||E.isArrayBuffer(A))return A.byteLength;if(E.isURLSearchParams(A)&&(A=A+""),E.isString(A))return(await De(A)).byteLength},So=async(A,e)=>{let t=E.toFiniteNumber(A.getContentLength());return t??No(e)},yr=TA&&(async A=>{let{url:e,method:t,data:r,signal:o,cancelToken:i,timeout:n,onDownloadProgress:Q,onUploadProgress:p,responseType:g,headers:a,withCredentials:s="same-origin",fetchOptions:l}=xA(A);g=g?(g+"").toLowerCase():"text";let[I,B]=o||i||n?ur([o,i],n):[],u,m,R=()=>{!u&&setTimeout(()=>{I&&I.unsubscribe()}),u=!0},S;try{if(p&&Uo&&t!=="get"&&t!=="head"&&(S=await So(a,r))!==0){let x=new Request(e,{method:"POST",body:r,duplex:"half"}),M;if(E.isFormData(r)&&(M=x.headers.get("content-type"))&&a.setContentType(M),x.body){let[zA,hA]=fe(S,iA(de(p)));r=we(x.body,cr,zA,hA,De)}}E.isString(s)||(s=s?"include":"omit"),m=new Request(e,{...l,signal:I,method:t.toUpperCase(),headers:a.normalize().toJSON(),body:r,duplex:"half",credentials:s});let D=await fetch(m),L=Re&&(g==="stream"||g==="response");if(Re&&(Q||L)){let x={};["status","statusText","headers"].forEach(St=>{x[St]=D[St]});let M=E.toFiniteNumber(D.headers.get("content-length")),[zA,hA]=Q&&fe(M,iA(de(Q),!0))||[];D=new Response(we(D.body,cr,zA,()=>{hA&&hA(),L&&R()},De),x)}g=g||"text";let V=await MA[E.findKey(MA,g)||"text"](D,A);return!L&&R(),B&&B(),await new Promise((x,M)=>{mA(x,M,{data:V,headers:U.from(D.headers),status:D.status,statusText:D.statusText,config:A,request:m})})}catch(D){throw R(),D&&D.name==="TypeError"&&/fetch/i.test(D.message)?Object.assign(new h("Network Error",h.ERR_NETWORK,A,m),{cause:D.cause||D}):h.from(D,D&&D.code,A,m)}});var ke={http:GA,xhr:mr,fetch:yr};E.forEach(ke,(A,e)=>{if(A){try{Object.defineProperty(A,"name",{value:e})}catch{}Object.defineProperty(A,"adapterName",{value:e})}});var hr=A=>`- ${A}`,bo=A=>E.isFunction(A)||A===null||A===!1,HA={getAdapter:A=>{A=E.isArray(A)?A:[A];let{length:e}=A,t,r,o={};for(let i=0;i<e;i++){t=A[i];let n;if(r=t,!bo(t)&&(r=ke[(n=String(t)).toLowerCase()],r===void 0))throw new h(`Unknown adapter '${n}'`);if(r)break;o[n||"#"+i]=r}if(!r){let i=Object.entries(o).map(([Q,p])=>`adapter ${Q} `+(p===!1?"is not supported by the environment":"is not available in the build")),n=e?i.length>1?`since : `+i.map(hr).join(` `):" "+hr(i[0]):"as no adapter specified";throw new h("There is no suitable adapter to dispatch the request "+n,"ERR_NOT_SUPPORT")}return r},adapters:ke};function Fe(A){if(A.cancelToken&&A.cancelToken.throwIfRequested(),A.signal&&A.signal.aborted)throw new T(null,A)}function YA(A){return Fe(A),A.headers=U.from(A.headers),A.data=pA.call(A,A.transformRequest),["post","put","patch"].indexOf(A.method)!==-1&&A.headers.setContentType("application/x-www-form-urlencoded",!1),HA.getAdapter(A.adapter||tA.adapter)(A).then(function(r){return Fe(A),r.data=pA.call(A,A.transformResponse,r),r.headers=U.from(r.headers),r},function(r){return EA(r)||(Fe(A),r&&r.response&&(r.response.data=pA.call(A,A.transformResponse,r.response),r.response.headers=U.from(r.response.headers))),Promise.reject(r)})}var qA="1.7.4";var Ue={};["object","boolean","number","function","string","symbol"].forEach((A,e)=>{Ue[A]=function(r){return typeof r===A||"a"+(e<1?"n ":" ")+A}});var wr={};Ue.transitional=function(e,t,r){function o(i,n){return"[Axios v"+qA+"] Transitional option '"+i+"'"+n+(r?". "+r:"")}return(i,n,Q)=>{if(e===!1)throw new h(o(n," has been removed"+(t?" in "+t:"")),h.ERR_DEPRECATED);return t&&!wr[n]&&(wr[n]=!0,console.warn(o(n," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,n,Q):!0}};function Wo(A,e,t){if(typeof A!="object")throw new h("options must be an object",h.ERR_BAD_OPTION_VALUE);let r=Object.keys(A),o=r.length;for(;o-- >0;){let i=r[o],n=e[i];if(n){let Q=A[i],p=Q===void 0||n(Q,i,A);if(p!==!0)throw new h("option "+i+" must be "+p,h.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new h("Unknown option "+i,h.ERR_BAD_OPTION)}}var KA={assertOptions:Wo,validators:Ue};var j=KA.validators,oA=class{constructor(e){this.defaults=e,this.interceptors={request:new Qe,response:new Qe}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let o;Error.captureStackTrace?Error.captureStackTrace(o={}):o=new Error;let i=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` `+i):r.stack=i}catch{}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=P(this.defaults,t);let{transitional:r,paramsSerializer:o,headers:i}=t;r!==void 0&&KA.assertOptions(r,{silentJSONParsing:j.transitional(j.boolean),forcedJSONParsing:j.transitional(j.boolean),clarifyTimeoutError:j.transitional(j.boolean)},!1),o!=null&&(E.isFunction(o)?t.paramsSerializer={serialize:o}:KA.assertOptions(o,{encode:j.function,serialize:j.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let n=i&&E.merge(i.common,i[t.method]);i&&E.forEach(["delete","get","head","post","put","patch","common"],B=>{delete i[B]}),t.headers=U.concat(n,i);let Q=[],p=!0;this.interceptors.request.forEach(function(u){typeof u.runWhen=="function"&&u.runWhen(t)===!1||(p=p&&u.synchronous,Q.unshift(u.fulfilled,u.rejected))});let g=[];this.interceptors.response.forEach(function(u){g.push(u.fulfilled,u.rejected)});let a,s=0,l;if(!p){let B=[YA.bind(this),void 0];for(B.unshift.apply(B,Q),B.push.apply(B,g),l=B.length,a=Promise.resolve(t);s<l;)a=a.then(B[s++],B[s++]);return a}l=Q.length;let I=t;for(s=0;s<l;){let B=Q[s++],u=Q[s++];try{I=B(I)}catch(m){u.call(this,m);break}}try{a=YA.call(this,I)}catch(B){return Promise.reject(B)}for(s=0,l=g.length;s<l;)a=a.then(g[s++],g[s++]);return a}getUri(e){e=P(this.defaults,e);let t=uA(e.baseURL,e.url);return QA(t,e.params,e.paramsSerializer)}};E.forEach(["delete","get","head","options"],function(e){oA.prototype[e]=function(t,r){return this.request(P(r||{},{method:e,url:t,data:(r||{}).data}))}});E.forEach(["post","put","patch"],function(e){function t(r){return function(i,n,Q){return this.request(P(Q||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:n}))}}oA.prototype[e]=t(),oA.prototype[e+"Form"]=t(!0)});var cA=oA;var Ne=class A{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(i){t=i});let r=this;this.promise.then(o=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i,n=new Promise(Q=>{r.subscribe(Q),i=Q}).then(o);return n.cancel=function(){r.unsubscribe(i)},n},e(function(i,n,Q){r.reason||(r.reason=new T(i,n,Q),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}static source(){let e;return{token:new A(function(o){e=o}),cancel:e}}},Dr=Ne;function Se(A){return function(t){return A.apply(null,t)}}function be(A){return E.isObject(A)&&A.isAxiosError===!0}var We={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(We).forEach(([A,e])=>{We[e]=A});var Rr=We;function kr(A){let e=new cA(A),t=gA(cA.prototype.request,e);return E.extend(t,cA.prototype,e,{allOwnKeys:!0}),E.extend(t,e,null,{allOwnKeys:!0}),t.create=function(o){return kr(P(A,o))},t}var k=kr(tA);k.Axios=cA;k.CanceledError=T;k.CancelToken=Dr;k.isCancel=EA;k.VERSION=qA;k.toFormData=K;k.AxiosError=h;k.Cancel=k.CanceledError;k.all=function(e){return Promise.all(e)};k.spread=Se;k.isAxiosError=be;k.mergeConfig=P;k.AxiosHeaders=U;k.formToJSON=A=>JA(E.isHTMLForm(A)?new FormData(A):A);k.getAdapter=HA.getAdapter;k.HttpStatusCode=Rr;k.default=k;var H=k;var{Axios:zg,AxiosError:Xg,CanceledError:_g,isCancel:$g,CancelToken:AB,VERSION:eB,all:tB,Cancel:rB,isAxiosError:iB,spread:oB,toFormData:aB,AxiosHeaders:nB,HttpStatusCode:IB,formToJSON:sB,getAdapter:gB,mergeConfig:BB}=H;async function Go(A,e){let t=A,r=null;if(t==null)r=new Worker(new URL("./web-workers/itk-wasm-pipeline.worker.js",import.meta.url),{type:"module"});else if(t.startsWith("http")){let o=await H.get(t,{responseType:"blob",params:e}),i=URL.createObjectURL(o.data);r=new Worker(i,{type:"module"})}else r=new Worker(t,{type:"module"});return r}var fA=Go;function Fr(A){let e=ae(A),t=A;return t.terminated=!1,t.workerProxy=e,t.originalTerminate=t.terminate,t.terminate=()=>{t.terminated=!0,t.workerProxy[oe](),t.originalTerminate()},{workerProxy:e,worker:t}}async function Oo(A,e,t){let r;if(A!=null){let i=A;return i.workerProxy!==void 0?(r=i.workerProxy,{workerProxy:r,worker:i}):Fr(A)}let o=await fA(e,t);return Fr(o)}var Ur=Oo;var dA,Y,Oe,Ge={env:{emscripten_notify_memory_growth:function(A){Oe=new Uint8Array(Y.exports.memory.buffer)}}},jA=class{init(){return dA||(typeof fetch<"u"?dA=fetch("data:application/wasm;base64,"+Nr).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,Ge)).then(this._init):dA=WebAssembly.instantiate(Buffer.from(Nr,"base64"),Ge).then(this._init),dA)}_init(e){Y=e.instance,Ge.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!Y)throw new Error("ZSTDDecoder: Await .init() before decoding.");let r=e.byteLength,o=Y.exports.malloc(r);Oe.set(e,o),t=t||Number(Y.exports.ZSTD_findDecompressedSize(o,r));let i=Y.exports.malloc(t),n=Y.exports.ZSTD_decompress(i,t,o,r),Q=Oe.slice(i,i+n);return Y.exports.free(o),Y.exports.free(i),Q}},Nr="AGFzbQEAAAABbg5gA39/fwF/YAF/AX9gAn9/AGABfwBgBX9/f39/AX9gA39/fwBgBH9/f38Bf2AAAX9gAn9/AX9gB39/f39/f38Bf2ACf38BfmAIf39/f39/f38Bf2AFf39/f38AYA5/f39/f39/f39/f39/fwF/AicBA2Vudh9lbXNjcmlwdGVuX25vdGlmeV9tZW1vcnlfZ3Jvd3RoAAMDIyIHAAABAQMHAwEACQQABQEICAEFBgQEBAMGAAAKAAULDA0GBAUBcAEBAQUHAQGAAoCAAgYIAX8BQYCjBAsHrgELBm1lbW9yeQIABm1hbGxvYwAFBGZyZWUABgxaU1REX2lzRXJyb3IAEhlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplABwPWlNURF9kZWNvbXByZXNzACIZX19pbmRpcmVjdF9mdW5jdGlvbl90YWJsZQEAEF9fZXJybm9fbG9jYXRpb24AAQlzdGFja1NhdmUABwxzdGFja1Jlc3RvcmUACApzdGFja0FsbG9jAAkKi/IBIgUAQYQfCzMBAX8gAgRAIAAhAwNAIAMgAS0AADoAACADQQFqIQMgAUEBaiEBIAJBAWsiAg0ACwsgAAspAQF/IAIEQCAAIQMDQCADIAE6AAAgA0EBaiEDIAJBAWsiAg0ACwsgAAtsAQJ/QYAfKAIAIgEgAEEHakF4cSICaiEAAkAgAkEAIAAgAU0bDQAgAD8AQRB0SwRAIAA/AEEQdGtB//8DakEQdkAAQX9GBH9BAAVBABAAQQELRQ0BC0GAHyAANgIAIAEPC0GEH0EwNgIAQX8LuScBC38jAEEQayIKJAACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIABB9AFNBEBBiB8oAgAiBkEQIABBC2pBeHEgAEELSRsiBUEDdiIAdiIBQQNxBEACQCABQX9zQQFxIABqIgJBA3