fetch-xhr-shim 0.0.1-beta

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.
Files changed (51) hide show
  1. package/dist/cjs/dev.js +55 -0
  2. package/dist/cjs/encoding/TextDecoderP.js +179 -0
  3. package/dist/cjs/encoding/TextEncoderP.js +121 -0
  4. package/dist/cjs/event-system/AbortControllerP.js +28 -0
  5. package/dist/cjs/event-system/AbortSignalP.js +117 -0
  6. package/dist/cjs/event-system/CustomEventP.js +35 -0
  7. package/dist/cjs/event-system/EventP.js +125 -0
  8. package/dist/cjs/event-system/EventTargetP.js +181 -0
  9. package/dist/cjs/event-system/ProgressEventP.js +54 -0
  10. package/dist/cjs/fetch-api/BodyImpl.js +176 -0
  11. package/dist/cjs/fetch-api/HeadersP.js +184 -0
  12. package/dist/cjs/fetch-api/RequestP.js +188 -0
  13. package/dist/cjs/fetch-api/ResponseP.js +93 -0
  14. package/dist/cjs/fetch-api/fetchP.js +129 -0
  15. package/dist/cjs/file-system/BlobP.js +171 -0
  16. package/dist/cjs/file-system/FileP.js +53 -0
  17. package/dist/cjs/file-system/FileReaderP.js +201 -0
  18. package/dist/cjs/fixes.js +243 -0
  19. package/dist/cjs/index.js +59 -0
  20. package/dist/cjs/network/FormDataP.js +308 -0
  21. package/dist/cjs/network/URLSearchParamsP.js +235 -0
  22. package/dist/cjs/polyfill.js +87 -0
  23. package/dist/cjs/utils.js +70 -0
  24. package/dist/dev.d.ts +145 -0
  25. package/dist/esm/dev.js +13 -0
  26. package/dist/esm/encoding/TextDecoderP.js +175 -0
  27. package/dist/esm/encoding/TextEncoderP.js +118 -0
  28. package/dist/esm/event-system/AbortControllerP.js +25 -0
  29. package/dist/esm/event-system/AbortSignalP.js +112 -0
  30. package/dist/esm/event-system/CustomEventP.js +32 -0
  31. package/dist/esm/event-system/EventP.js +121 -0
  32. package/dist/esm/event-system/EventTargetP.js +174 -0
  33. package/dist/esm/event-system/ProgressEventP.js +51 -0
  34. package/dist/esm/fetch-api/BodyImpl.js +172 -0
  35. package/dist/esm/fetch-api/HeadersP.js +176 -0
  36. package/dist/esm/fetch-api/RequestP.js +184 -0
  37. package/dist/esm/fetch-api/ResponseP.js +90 -0
  38. package/dist/esm/fetch-api/fetchP.js +125 -0
  39. package/dist/esm/file-system/BlobP.js +164 -0
  40. package/dist/esm/file-system/FileP.js +50 -0
  41. package/dist/esm/file-system/FileReaderP.js +197 -0
  42. package/dist/esm/fixes.js +239 -0
  43. package/dist/esm/index.js +17 -0
  44. package/dist/esm/network/FormDataP.js +301 -0
  45. package/dist/esm/network/URLSearchParamsP.js +231 -0
  46. package/dist/esm/polyfill.js +85 -0
  47. package/dist/esm/utils.js +60 -0
  48. package/dist/fetch-xhr-shim.cjs.min.js +1 -0
  49. package/dist/fetch-xhr-shim.esm.min.js +1 -0
  50. package/dist/index.d.ts +300 -0
  51. package/package.json +59 -0
@@ -0,0 +1 @@
1
+ "use strict";const e="function"==typeof Symbol&&(Symbol.iterator||"Symbol(Symbol.iterator)"),t="function"==typeof Symbol&&(Symbol.toStringTag||"Symbol(Symbol.toStringTag)");class r extends Error{constructor(e,t){super(e),void 0!==t&&(this.name=""+t)}get[t](){return"DOMException"}get __MPHTTPX__(){return{chain:["DOMException"]}}}const n=(()=>{try{return new DOMException,!0}catch(e){return!1}})()?DOMException:r;function o(e){try{return e.__MPHTTPX__.chain[0]}catch(t){return Object.prototype.toString.call(e).slice(8,-1)}}function s(e,t,r){Object.defineProperty(e,t,{value:r})}function i(e,t){return Object.prototype.toString.call(t)===`[object ${e}]`}function a(e,t,r=!1){const n="__MPHTTPX__";return!!t&&"object"==typeof t&&n in t&&!!t[n]&&"object"==typeof t[n]&&"chain"in t[n]&&Array.isArray(t[n].chain)&&(o=t[n].chain.indexOf(e),r?0===o:o>-1);var o}function l(e){return Array.isArray(e)||!!e&&"object"==typeof e&&"function"==typeof Symbol&&Symbol.iterator&&Symbol.iterator in e&&"function"==typeof e[Symbol.iterator]}function u(e,t,r,n){if(e<t)throw new TypeError(`Failed to ${n?"execute '"+n+"' on":"construct"} '${r}': ${t} argument${t>1?"s":""} required, but only ${e} present.`)}class c{get encoding(){return"utf-8"}encode(e=""){return h("string"==typeof e?e:""+e).encoded}encodeInto(e,t){if(u(arguments.length,2,"TextEncoder","encodeInto"),!Uint8Array.prototype.isPrototypeOf(t)&&!i("Uint8Array",t))throw new TypeError("Failed to execute 'encodeInto' on 'TextEncoder': parameter 2 is not of type 'Uint8Array'.");let r=h("string"==typeof e?e:""+e,t);return{read:r.read,written:r.written}}toString(){return"[object TextEncoder]"}get[t](){return"TextEncoder"}get __MPHTTPX__(){return{chain:["TextEncoder"]}}}function h(e,t){const r=void 0!==t;let n=0,o=0,s=e.length,i=0,a=Math.max(32,s+(s>>1)+7),l=r?t:new Uint8Array(a>>3<<3),u=0,c=0,h=0;for(;n<s;){if(u=e.charCodeAt(n),c=1,u>=55296&&u<=56319)if(n+1<s){let t=e.charCodeAt(n+1);56320==(64512&t)?(c=2,n+=2,u=((1023&u)<<10)+(1023&t)+65536):(n+=1,u=65533)}else n+=1,u=65533;else u>=56320&&u<=57343?(n+=1,u=65533):n+=1;if(!r&&i+4>l.length){a+=8,a*=1+n/e.length*2,a=a>>3<<3;let t=new Uint8Array(a);t.set(l),l=t}if(4294967168&u?4294965248&u?4294901760&u?4292870144&u?(u=65533,h=3):h=4:h=3:h=2:h=1,r&&i+h>l.length)break;switch(h){case 1:l[i++]=u;break;case 2:l[i++]=u>>6&31|192,l[i++]=63&u|128;break;case 3:l[i++]=u>>12&15|224,l[i++]=u>>6&63|128,l[i++]=63&u|128;break;case 4:l[i++]=u>>18&7|240,l[i++]=u>>12&63|128,l[i++]=u>>6&63|128,l[i++]=63&u|128}o+=c}return{encoded:r?t:l.slice(0,i),read:o,written:i}}const d="undefined"!=typeof TextEncoder&&TextEncoder||c,p=["utf-8","utf8","unicode-1-1-utf-8"];class f{constructor(e="utf-8",t){if(-1===p.indexOf(("string"==typeof e?e:""+e).toLowerCase()))throw new RangeError(`Failed to construct 'TextDecoder': encoding ('${e}') not implemented.`);s(this,"__TextDecoder__",new y(t))}get encoding(){return"utf-8"}get fatal(){return g(this).fatal}get ignoreBOM(){return g(this).ignoreBOM}decode(e,t){return function(e,{stream:t=!1}={},r={fatal:!1,ignoreBOM:!1,partial:[]}){if(void 0===e){if(r.partial.length>0&&r.fatal)throw r.partial=[],new TypeError("Incomplete UTF-8 sequence.");return""}let n=b(e)?new Uint8Array(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):(()=>{throw new TypeError("Input could not be converted to any of: ArrayBufferView, ArrayBuffer.")})();if(r.partial.length>0){let e=new Uint8Array(r.partial.length+n.length);e.set(r.partial,0),e.set(n,r.partial.length),n=e,r.partial=[]}!r.ignoreBOM&&n.length>=3&&239===n[0]&&187===n[1]&&191===n[2]&&(n=n.subarray(3));let o=n.length,s=[];if(t&&n.length>0){let e=n.length;for(;e>0&&e>n.length-4;){let t=n[e-1];if(128!=(192&t)){(t>239?4:t>223?3:t>191?2:1)>n.length-(e-1)&&(o=e-1);break}--e}r.partial=Array.from(n.slice(o)),n=n.slice(0,o)}let i=0,a=0,l=0,u=0,c=0,h=0,d=0,p=0;for(;p<o;){if(i=0,u=n[p],l=u>239?4:u>223?3:u>191?2:1,p+l<=o)switch(l){case 1:u<128&&(i=u);break;case 2:c=n[p+1],128==(192&c)&&(a=(31&u)<<6|63&c,a>127&&(i=a));break;case 3:c=n[p+1],h=n[p+2],128==(192&c)&&128==(192&h)&&(a=(15&u)<<12|(63&c)<<6|63&h,a>2047&&(a<55296||a>57343)&&(i=a));break;case 4:c=n[p+1],h=n[p+2],d=n[p+3],128==(192&c)&&128==(192&h)&&128==(192&d)&&(a=(15&u)<<18|(63&c)<<12|(63&h)<<6|63&d,a>65535&&a<1114112&&(i=a))}if(0===i&&(1===l&&0!==u||l>1)){if(r.fatal)throw r.partial=[],new TypeError("Decoding failed.");let e=1;for(;p+e<o&&128==(192&n[p+e]);)e+=1;s.push(65533),p+=e;continue}i>65535&&(i-=65536,s.push(i>>>10&1023|55296),i=56320|1023&i),s.push(i),p+=l}return s.length>16384?function(e){let t=[];for(let r=0,n=e.length;r<n;r+=4096)t.push(String.fromCharCode.apply(String,e.slice(r,r+4096)));return t.join("")}(s):function(e){let t="";for(let r=0,n=e.length;r<n;r+=4096)t+=String.fromCharCode.apply(String,e.slice(r,r+4096));return t}(s)}(e,t,g(this))}toString(){return"[object TextDecoder]"}get[t](){return"TextDecoder"}get __MPHTTPX__(){return{chain:["TextDecoder"]}}}class y{constructor({fatal:e=!1,ignoreBOM:t=!1}={}){this.partial=[],this.fatal=!!e,this.ignoreBOM=!!t}}function g(e){return e.__TextDecoder__}function b(e){return!!e&&"object"==typeof e&&ArrayBuffer.prototype.isPrototypeOf(e)||function(e){return(i("ArrayBuffer",e)||"[object ArrayBuffer]"===String(e))&&"byteLength"in e&&"number"==typeof e.byteLength}(e)}const _="undefined"!=typeof TextDecoder&&TextDecoder||f;class m{static get NONE(){return 0}static get CAPTURING_PHASE(){return 1}static get AT_TARGET(){return 2}static get BUBBLING_PHASE(){return 3}constructor(e,t){u(arguments.length,1,"Event"),s(this,"__Event__",new v);const r=T(this);r.type=""+e,r.bubbles=!!(null==t?void 0:t.bubbles),r.cancelable=!!(null==t?void 0:t.cancelable),r.composed=!!(null==t?void 0:t.composed),Object.defineProperty(this,"isTrusted",{enumerable:!0,get:function(){return"YES"===r.isTrusted}})}get NONE(){return 0}get CAPTURING_PHASE(){return 1}get AT_TARGET(){return 2}get BUBBLING_PHASE(){return 3}get bubbles(){return T(this).bubbles}get cancelBubble(){return T(this).cancelBubble}set cancelBubble(e){e&&(T(this).cancelBubble=!0)}get cancelable(){return T(this).cancelable}get composed(){return T(this).composed}get currentTarget(){return T(this).currentTarget}get defaultPrevented(){return T(this).defaultPrevented}get eventPhase(){return T(this).eventPhase}get returnValue(){return T(this).returnValue}set returnValue(e){e||this.preventDefault()}get srcElement(){return T(this).target}get target(){return T(this).target}get timeStamp(){return T(this).timeStamp}get type(){return T(this).type}composedPath(){let e=this.target?[this.target]:[];return this.currentTarget&&this.currentTarget!==this.target&&e.push(this.currentTarget),e}initEvent(e,t,r){u(arguments.length,1,o(this),"initEvent");let n=T(this);n.eventDispatched||(n.type=""+e,n.bubbles=!!t,n.cancelable=!!r)}preventDefault(){let e=T(this);if(e.passive)return console.warn(`Ignoring 'preventDefault()' call on event of type '${this.type}' from a listener registered as 'passive'.`);this.cancelable&&(e.defaultPrevented=!0,e.returnValue=!1)}stopImmediatePropagation(){T(this).immediatePropagationStopped=!0,this.cancelBubble=!0}stopPropagation(){this.cancelBubble=!0}toString(){return"[object Event]"}get[t](){return"Event"}get __MPHTTPX__(){return{chain:["Event"]}}}class v{constructor(){this.bubbles=!1,this.cancelBubble=!1,this.cancelable=!1,this.composed=!1,this.currentTarget=null,this.defaultPrevented=!1,this.eventPhase=0,this.returnValue=!0,this.target=null,this.timeStamp=(new Date).getTime()-w,this.type="",this.passive=!1,this.eventDispatched=!1,this.immediatePropagationStopped=!1,Object.defineProperty(this,"isTrusted",E())}}function T(e){return e.__Event__}const w=(new Date).getTime();function E(){let e=E.name,t=e.length,r="NO";return{configurable:!1,enumerable:!0,get:function(){return r},set:function(n){e===n.slice(0,t)&&(r=n.slice(t+1))}}}function P(e,t){(T(e)||{}).isTrusted=`${E.name}:${t?"YES":"NO"}`}const x="undefined"!=typeof Event&&Event||m;class S{constructor(){s(this,"__EventTarget__",new R)}addEventListener(e,t,r){if(u(arguments.length,2,o(this),"addEventListener"),"function"!=typeof t&&"object"!=typeof t&&void 0!==t)throw new TypeError(`Failed to execute 'addEventListener' on '${o(this)}': parameter 2 is not of type 'Object'.`);let n=A(this)||{executors:[]},s=new F(e,t),i=s.options.capture="boolean"==typeof r?r:!!(null==r?void 0:r.capture);if(!n.executors.some(e=>e.equals(s))){if(n.executors.push(s),r&&"object"==typeof r){s.options.once=!!r.once,s.options.passive=!!r.passive;const e=r.signal;e&&L(e)&&!e.aborted&&(s.options.signal=e,function(e,t,r){const n=()=>{A(e).executors=A(e).executors.filter(e=>!e.equals(t)),r.removeEventListener("abort",n)};r.addEventListener("abort",n)}(this,s,e))}if(i){let e=e=>e.options.capture?0:1;n.executors=n.executors.sort((t,r)=>e(t)-e(r))}}}dispatchEvent(e){if(u(arguments.length,1,o(this),"dispatchEvent"),a("Event",e))P(e,!1);else{if(!function(e){const t=e=>"[object "===e.slice(0,8)&&"Event]"===e.slice(-6);return!!e&&"object"==typeof e&&(t(Object.prototype.toString.call(e))||t(String(e)))&&"type"in e&&"string"==typeof e.type}(e))throw new TypeError(`Failed to execute 'dispatchEvent' on '${o(this)}': parameter 1 is not of type 'Event'.`);console.warn(`WARNING: undefined behavior when executing 'dispatchEvent' on '${o(this)}': parameter 1 is not of type 'Event(P)'.`)}return B(this,e)}removeEventListener(e,t,r){if(u(arguments.length,2,o(this),"removeEventListener"),"function"!=typeof t&&"object"!=typeof t&&void 0!==t)throw new TypeError(`Failed to execute 'removeEventListener' on '${o(this)}': parameter 2 is not of type 'Object'.`);let n=A(this)||{executors:[]},s=new F(e,t);s.options.capture="boolean"==typeof r?r:!!(null==r?void 0:r.capture),n.executors.some(e=>e.equals(s))&&(n.executors=n.executors.filter(e=>!e.equals(s)))}toString(){return"[object EventTarget]"}get[t](){return"EventTarget"}get __MPHTTPX__(){return{chain:["EventTarget"]}}}class R{constructor(){this.executors=[]}}function A(e){return e.__EventTarget__}class F{constructor(e,t){var r;this.options={},this.type=""+e,this.callback="function"==typeof(r=t)?r:function(e){return!!e&&"object"==typeof e&&"handleEvent"in e&&"function"==typeof e.handleEvent}(r)?r.handleEvent:r}equals(e){return Object.is(this.type,e.type)&&Object.is(this.callback,e.callback)&&Object.is(this.options.capture,e.options.capture)}}function B(e,t){const r=A(e)||{},n=t.__Event__||{};n.target=e,n.currentTarget=e,n.eventPhase=2,n.eventDispatched=!0;let o=[];Array.isArray(r.executors)||(r.executors=[]);for(let s=0;s<r.executors.length&&!n.immediatePropagationStopped;++s){let i=r.executors[s];if(i.type===t.type){i.options.once&&o.push(s),n.passive=!!i.options.passive;try{let r=i.callback;"function"==typeof r&&r.call(e,t)}catch(e){console.error(e)}n.passive=!1}}return o.length>0&&(r.executors=r.executors.reduce((e,t,r)=>(-1===o.indexOf(r)&&e.push(t),e),[])),n.currentTarget=null,n.eventPhase=0,n.eventDispatched=!1,!(t.cancelable&&t.defaultPrevented)}function C(e,t){return function(r){const n="on"+r,o=e[n],s=t[n];"function"==typeof o?S.prototype.addEventListener.call(e,r,s):S.prototype.removeEventListener.call(e,r,s)}}function j(e,t,r){"function"==typeof t&&t.call(e,r)}function L(e){return a("EventTarget",e)||function(e){return!!e&&"object"==typeof e&&"addEventListener"in e&&"function"==typeof e.addEventListener&&"removeEventListener"in e&&"function"==typeof e.removeEventListener}(e)}const H="undefined"!=typeof EventTarget&&EventTarget||S;class O extends m{constructor(e,t){var r;u(arguments.length,1,"CustomEvent"),super(e,t),s(this,"__CustomEvent__",new q),D(this).detail=null!==(r=null==t?void 0:t.detail)&&void 0!==r?r:null}get detail(){return D(this).detail}initCustomEvent(e,t,r,n){u(arguments.length,1,"CustomEvent","initCustomEvent"),this.__Event__.eventDispatched||(this.initEvent(e,t,r),D(this).detail=null!=n?n:null)}toString(){return"[object CustomEvent]"}get[t](){return"CustomEvent"}get __MPHTTPX__(){return{chain:["CustomEvent","Event"]}}}class q{}function D(e){return e.__CustomEvent__}const U="undefined"!=typeof CustomEvent&&CustomEvent||O;class M extends S{static abort(e){let t=$();return I(t,!1,e),t}static any(e){if(u(arguments.length,1,"AbortSignal","any"),!l(e))throw new TypeError("Failed to execute 'any' on 'AbortSignal': The provided value cannot be converted to a sequence.");let t=Array.isArray(e)?e:Array.from(e);t.forEach(e=>{if(!L(e))throw new TypeError("Failed to execute 'any' on 'AbortSignal': Failed to convert value to 'AbortSignal'.")});let r=$(),n=(()=>{for(let e=0;e<t.length;++e){let r=t[e];if(r.aborted)return r}})();if(n)I(r,!1,n.reason);else{function o(){for(let e=0;e<t.length;++e){t[e].removeEventListener("abort",o)}I(r,!0,this.reason)}for(let s=0;s<t.length;++s){t[s].addEventListener("abort",o)}}return r}static timeout(e){if(u(arguments.length,1,"AbortSignal","timeout"),!(e>=0))throw new TypeError("Failed to execute 'timeout' on 'AbortSignal': Value is outside the 'unsigned long long' value range.");const t=$();return setTimeout(()=>I(t,!0,new n("signal timed out","TimeoutError")),e),t}constructor(){if(new.target===M)throw new TypeError("Failed to construct 'AbortSignal': Illegal constructor");super(),s(this,"__AbortSignal__",new X(this))}get aborted(){return N(this).aborted}get reason(){return N(this).reason}throwIfAborted(){if(this.aborted)throw this.reason}get onabort(){return N(this).onabort}set onabort(e){N(this).onabort=e,N(this).attach("abort")}toString(){return"[object AbortSignal]"}get[t](){return"AbortSignal"}get __MPHTTPX__(){return{chain:["AbortSignal","EventTarget"]}}}class X{constructor(e){var t;this.aborted=!1,this.reason=void 0,this.onabort=null,this.attach=C(e,(t=e,{onabort:e=>{j(t,t.onabort,e)}}))}}function N(e){return e.__AbortSignal__}function $(){let e=Object.create(M.prototype);return s(e,"__EventTarget__",{executors:[]}),s(e,"__AbortSignal__",new X(e)),e}function I(e,t=!0,r){if(!e.aborted){let o=N(e)||{};if(o.aborted=!0,o.reason=void 0!==r?r:new n("signal is aborted without reason","AbortError"),t){let t=new m("abort");t.__Event__.target=e,P(t,!0),B(e,t)}}}const k="undefined"!=typeof AbortSignal&&AbortSignal||M;class z{constructor(){s(this,"__AbortController__",new G)}get signal(){return(e=this,e.__AbortController__).signal;var e}abort(e){I(this.signal,!0,e)}toString(){return"[object AbortController]"}get[t](){return"AbortController"}get __MPHTTPX__(){return{chain:["AbortController"]}}}class G{constructor(){this.signal=$()}}const V="undefined"!=typeof AbortController&&AbortController||z,W=d.prototype.encode.bind(new d),Y=_.prototype.decode.bind(new _),J={ReadableStream:"undefined"!=typeof ReadableStream&&ReadableStream||void 0};class K{constructor(e=[],t){if(!l(e))throw new TypeError("Failed to construct 'Blob/File': The provided value cannot be converted to a sequence.");let r=Array.isArray(e)?e:Array.from(e),n=[],o=0;for(let e=0;e<r.length;++e){let t=r[e];if(ne(t))o+=t.size,n.push(t.arrayBuffer().then(e=>new Uint8Array(e)));else{let e=b(t)||ArrayBuffer.isView(t)?ee(t):W(t);o+=e.length,n.push(Promise.resolve(e))}}s(this,"__Blob__",new Q(Promise.all(n).then(e=>function(e){let t=e.reduce((e,t)=>e+t.byteLength,0),r=new Uint8Array(t);return e.reduce((e,t)=>(r.set(t,e),e+t.byteLength),0),r}(e)))),Z(this).size=o,Z(this).type=te(null==t?void 0:t.type)}get size(){return Z(this).size}get type(){return Z(this).type}arrayBuffer(){return Z(this).promise.then(e=>re(e.buffer).buffer)}bytes(){return Z(this).promise.then(e=>re(e.buffer))}slice(e,t,r){let n=null!=e?e:0,o=null!=t?t:this.size,i=Object.create(K.prototype);return s(i,"__Blob__",new Q(Z(this).promise.then(e=>re(e.slice(n,o))))),Z(i).size=function(e,t,r){const n=t=>{let r=Number(t);return isNaN(r)&&(r=0),r=r>=0?Math.min(r,e):Math.max(0,r+e),r};return Math.max(0,n(r)-n(t))}(this.size,n,o),Z(i).type=te(r),i}stream(){let e=J.ReadableStream||(()=>{throw new ReferenceError("ReadableStream is not defined")})(),t=0;try{return new e({type:"bytes",autoAllocateChunkSize:524288,pull:function(e){var r;let n=null===(r=e.byobRequest)||void 0===r?void 0:r.view;return this.slice(t,(null==n?void 0:n.byteLength)?t+n.byteLength:void 0).arrayBuffer().then(function(r){var o;let s=new Uint8Array(r),i=s.byteLength;t+=i,n.set(s),null===(o=e.byobRequest)||void 0===o||o.respond(i),t>=this.size&&e.close()}.bind(this))}.bind(this)})}catch(r){return new e({pull:function(e){return this.slice(t,t+524288).arrayBuffer().then(function(r){t+=r.byteLength;let n=new Uint8Array(r);e.enqueue(n),t==this.size&&e.close()}.bind(this))}.bind(this)})}}text(){return Z(this).promise.then(e=>Y(e))}toString(){return"[object Blob]"}get[t](){return"Blob"}get __MPHTTPX__(){return{chain:["Blob"]}}}class Q{constructor(e){this.size=0,this.type="",this.promise=e}}function Z(e){return e.__Blob__}function ee(e){return b(e)?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function te(e){let t=""+(void 0!==e?e:"");return/[^\u0020-\u007E]/.test(t)?"":t.toLowerCase()}function re(e){let t=ee(e),r=new Uint8Array(new ArrayBuffer(t.byteLength));return r.set(t),r}function ne(e,t=!1){return a("Blob",e,t)||function(e,t=!1){let r=["[object Blob]"];t||r.push("[object File]");return(r.indexOf(Object.prototype.toString.call(e))>-1||r.indexOf(String(e))>-1)&&"size"in e&&"number"==typeof e.size&&"arrayBuffer"in e&&"function"==typeof e.arrayBuffer}(e,t)}const oe=function(){try{return 2===new Blob(["ä"]).size}catch(e){return!1}}()?Blob:K;function se(e){class r extends e{constructor(e,t,r){u(arguments.length,2,"File"),super(e,r),s(this,"__File__",new ie),ae(this).lastModified=+((null==r?void 0:r.lastModified)?new Date(r.lastModified):new Date)||0,ae(this).name=""+t}get lastModified(){return ae(this).lastModified}get name(){return ae(this).name}get webkitRelativePath(){return""}toString(){return"[object File]"}get[t](){return"File"}}return Object.is(e,K)&&Object.defineProperty(r.prototype,"__MPHTTPX__",{configurable:!0,get:function(){return{chain:["File","Blob"]}}}),r}class ie{constructor(){this.lastModified=0,this.name=""}}function ae(e){return e.__File__}const le=se(K),ue=function(){try{return new File([],""),!0}catch(e){return!1}}()?File:Object.is(oe,K)?le:se(oe),ce=["loaded","total"];class he extends m{constructor(e,t){var r,n;super(e,t),s(this,"__ProgressEvent__",new de);const o=pe(this);o.lengthComputable=!!(null==t?void 0:t.lengthComputable),o.loaded=Number(null!==(r=null==t?void 0:t.loaded)&&void 0!==r?r:0),o.total=Number(null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0);for(let e=0;e<ce.length;++e){let t=ce[e];if(isNaN(this[t]))throw new TypeError(`Failed to construct 'ProgressEvent': Failed to read the '${t}' property from 'ProgressEventInit': The provided double value is non-finite.`)}}get lengthComputable(){return pe(this).lengthComputable}get loaded(){return pe(this).loaded}get total(){return pe(this).total}toString(){return"[object ProgressEvent]"}get[t](){return"ProgressEvent"}get __MPHTTPX__(){return{chain:["ProgressEvent","Event"]}}}class de{constructor(){this.lengthComputable=!1,this.loaded=0,this.total=0}}function pe(e){return e.__ProgressEvent__}function fe(e,t,r=0,n=0){let o=new he(t,{lengthComputable:n>0,loaded:r,total:n});o.__Event__.target=e,P(o,!0),B(e,o)}class ye extends S{static get EMPTY(){return 0}static get LOADING(){return 1}static get DONE(){return 2}constructor(){super(),s(this,"__FileReader__",new ge(this))}get EMPTY(){return 0}get LOADING(){return 1}get DONE(){return 2}get error(){return be(this).error}get readyState(){return be(this).readyState}get result(){return be(this).result}abort(){2===be(this).pos&&function(e){let t=be(e);t.pos=5,t.error=new n("An ongoing operation was aborted, typically with a call to abort().","AbortError"),t.result=null,t.readyState=2,fe(e,"abort"),ve(e)}(this)}readAsArrayBuffer(e){_e(this,"readAsArrayBuffer",arguments.length,e),me(this,e.size,()=>e.arrayBuffer())}readAsBinaryString(e){_e(this,"readAsBinaryString",arguments.length,e),me(this,e.size,()=>e.arrayBuffer().then(e=>{let t=[],r=new Uint8Array(e);for(let e=0;e<r.length;++e)t.push(String.fromCharCode(r[e]));return t.join("")}))}readAsDataURL(e){_e(this,"readAsDataURL",arguments.length,e),me(this,e.size,()=>e.arrayBuffer().then(t=>"data:"+(e.type||"application/octet-stream")+";base64,"+function(e){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r=[];for(var n=0;n<e.length;n+=3){let o=e[n],s=n+1<e.length,i=s?e[n+1]:0,a=n+2<e.length,l=a?e[n+2]:0,u=o>>2,c=(3&o)<<4|i>>4,h=(15&i)<<2|l>>6,d=63&l;a||(d=64,s||(h=64)),r.push(t[u],t[c],t[h],t[d])}return r.join("")}(new Uint8Array(t))))}readAsText(e,t){if(_e(this,"readAsText",arguments.length,e),"function"==typeof TextDecoder){let r=new TextDecoder(t);me(this,e.size,()=>e.arrayBuffer().then(e=>r.decode(e)))}else{if(void 0!==t){let e=""+t;-1===["utf-8","utf8","unicode-1-1-utf-8"].indexOf(e.toLowerCase())&&console.warn(`Ignoring the execution of 'readAsText' on 'FileReader': encoding ('${e}') not implemented.`)}me(this,e.size,()=>e.text())}}get onabort(){return be(this).onabort}set onabort(e){be(this).onabort=e,be(this).attach("abort")}get onerror(){return be(this).onerror}set onerror(e){be(this).onerror=e,be(this).attach("error")}get onload(){return be(this).onload}set onload(e){be(this).onload=e,be(this).attach("load")}get onloadend(){return be(this).onloadend}set onloadend(e){be(this).onloadend=e,be(this).attach("loadend")}get onloadstart(){return be(this).onloadstart}set onloadstart(e){be(this).onloadstart=e,be(this).attach("loadstart")}get onprogress(){return be(this).onprogress}set onprogress(e){be(this).onprogress=e,be(this).attach("progress")}toString(){return"[object FileReader]"}get[t](){return"FileReader"}get __MPHTTPX__(){return{chain:["FileReader","EventTarget"]}}}class ge{constructor(e){var t;this.pos=0,this.readyState=0,this.result=null,this.error=null,this.onabort=null,this.onerror=null,this.onload=null,this.onloadend=null,this.onloadstart=null,this.onprogress=null,this.attach=C(e,(t=e,{onabort:e=>{j(t,t.onabort,e)},onerror:e=>{j(t,t.onerror,e)},onload:e=>{j(t,t.onload,e)},onloadend:e=>{j(t,t.onloadend,e)},onloadstart:e=>{j(t,t.onloadstart,e)},onprogress:e=>{j(t,t.onprogress,e)}}))}}function be(e){return e.__FileReader__}function _e(e,t,r,o){if(u(r,1,"FileReader",t),!ne(o))throw new TypeError("Failed to execute '"+t+"' on 'FileReader': parameter 1 is not of type 'Blob'.");if(1===e.readyState)throw new n(`Failed to execute '${t}' on 'FileReader': The object is already busy reading Blobs.`,"InvalidStateError")}function me(e,t,r){!function(e,t,r){let n=be(e);n.pos=1,n.error=null,n.result=null;const o=()=>(fe(e,"loadstart",0,t),r());(function(e,t,r){let n=be(e);n.pos=2,n.readyState=1,Promise.resolve().then(()=>{if(2===n.pos)return r().then(r=>function(e,t,r){let n=be(e);if(2!==n.pos)return;n.pos=3,n.result=r,n.readyState=2,function(e,t){be(e).pos=4,fe(e,"load",t,t),ve(e,t)}(e,t)}(e,t,r)).catch(t=>function(e,t){let r=be(e);if(2!==r.pos)return;r.pos=6,r.error=t,r.result=null,r.readyState=2,fe(e,"error"),ve(e)}(e,t))})})(e,t,o)}(e,t,r)}function ve(e,t=0){be(e).pos=7,fe(e,"loadend",t,t)}const Te="undefined"!=typeof FileReader&&FileReader||ye;class we{constructor(e){if(s(this,"__URLSearchParams__",new Ee),void 0!==e)if(Fe(e))e.forEach((e,t)=>{this.append(t,e)},this);else if(e&&"object"==typeof e)if(l(e)){let t=Array.isArray(e)?e:Array.from(e);for(let e=0;e<t.length;++e){let r=t[e];if(!l(r))throw new TypeError("Failed to construct 'URLSearchParams': The provided value cannot be converted to a sequence.");{let e=Array.isArray(r)?r:Array.from(r);if(2!==e.length)throw new TypeError("Failed to construct 'URLSearchParams': Sequence initializer must only contain pair elements");this.append(e[0],e[1])}}}else Object.getOwnPropertyNames(e).forEach(t=>{this.append(t,e[t])},this);else{let t=""+e;0===t.indexOf("?")&&(t=t.slice(1));let r=t.split("&");for(let e=0;e<r.length;++e){let t=r[e],n=t.indexOf("=");n>-1?this.append(Ae(t.slice(0,n)),Ae(t.slice(n+1))):t&&this.append(Ae(t),"")}}}get size(){return Pe(this).array.length}append(e,t){xe(arguments.length,2,"append"),Pe(this).array.push([""+e,Se(t)])}delete(e,t){xe(arguments.length,1,"delete");let r=""+e,n=-1,o=Pe(this).array,s=[];for(let e=0;e<o.length;++e){let i=o[e];i[0]!==r?s.push(i):(1!==arguments.length&&i[1]!==Se(t)&&s.push(i),n=e)}n>-1&&(Pe(this).array=s)}get(e){xe(arguments.length,1,"get");let t=""+e,r=Pe(this).array;for(let e=0;e<r.length;++e){let n=r[e];if(n[0]===t)return n[1]}return null}getAll(e){xe(arguments.length,1,"getAll");let t=""+e,r=Pe(this).array,n=[];for(let e=0;e<r.length;++e){let o=r[e];o[0]===t&&n.push(o[1])}return n}has(e,t){xe(arguments.length,1,"has");let r=""+e,n=Pe(this).array;for(let e=0;e<n.length;++e){let o=n[e];if(o[0]===r){if(1===arguments.length)return!0;if(o[1]===Se(t))return!0}}return!1}set(e,t){xe(arguments.length,2,"set");let r=""+e,n=Se(t),o=-1,s=Pe(this).array,i=[];for(let e=0;e<s.length;++e){let t=s[e];t[0]!==r?i.push(t):-1===o&&(o=e,i.push([r,n]))}-1===o&&i.push([r,n]),Pe(this).array=i}sort(){Pe(this).array.sort((e,t)=>e[0]<t[0]?-1:e[0]>t[0]?1:0)}forEach(e,t){if(xe(arguments.length,1,"forEach"),"function"!=typeof e)throw new TypeError("Failed to execute 'forEach' on 'URLSearchParams': parameter 1 is not of type 'Function'.");let r=Pe(this).array;for(let n=0;n<r.length;++n){let o=r[n];e.call(t,o[1],o[0],this)}}entries(){return Pe(this).array.map(e=>[e[0],e[1]]).values()}keys(){return Pe(this).array.map(e=>e[0]).values()}values(){return Pe(this).array.map(e=>e[1]).values()}[e](){return this.entries()}toString(){let e=Pe(this).array,t=[];for(let r=0;r<e.length;++r){let n=e[r];t.push(Re(n[0])+"="+Re(n[1]))}return t.join("&")}get[t](){return"URLSearchParams"}get __MPHTTPX__(){return{chain:["URLSearchParams"]}}}class Ee{constructor(){this.array=[]}}function Pe(e){return e.__URLSearchParams__}function xe(e,t,r){u(e,t,"URLSearchParams",r)}function Se(e){return"string"==typeof e?e:null!=e&&"function"==typeof e.toString?e.toString():JSON.stringify(e)}function Re(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'\(\)~]|%20|%00/g,e=>t[e])}function Ae(e){return e.replace(/[ +]/g,"%20").replace(/(%[a-f0-9]{2})+/gi,e=>decodeURIComponent(e))}function Fe(e){return a("URLSearchParams",e)||function(e){return i("URLSearchParams",e)||!!e&&"object"==typeof e&&"undefined"!=typeof URLSearchParams&&URLSearchParams&&URLSearchParams.prototype.isPrototypeOf(e)}(e)}const Be="undefined"!=typeof URLSearchParams&&URLSearchParams||we;class Ce{constructor(e,t){if(s(this,"__FormData__",new je),void 0!==e)try{let t=e.elements;for(let e=0;e<t.length;++e){let r=t[e];if(!r.name||r.disabled||"submit"===r.type||"button"===r.type||r.matches("form fieldset[disabled] *"))return;if("file"===r.type){let e=r.files&&r.files.length?r.files:[new ue([],"",{type:"application/octet-stream"})];for(let t=0;t<e.length;++t)this.append(r.name,e[t])}else if("select-multiple"===r.type||"select-one"===r.type)for(let e=0;e<r.options.length;++e){let t=r.options[e];!t.disabled&&t.selected&&this.append(r.name,t.value)}else if("checkbox"===r.type||"radio"===r.type)r.checked&&this.append(r.name,r.value);else{let e="textarea"===r.type?Ue(r.value):r.value;this.append(r.name,e)}}}catch(e){throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}null!=t&&console.warn("Ignoring the 'submitter' of 'FormData' constructor: parameter 2 not implemented.")}append(e,t,r){He(arguments.length,2,"append"),Le(this).array.push(Oe(e,t,r))}delete(e){He(arguments.length,1,"delete");let t=""+e,r=-1,n=Le(this).array,o=[];for(let e=0;e<n.length;++e){let s=n[e];s[0]!==t?o.push(s):r=e}r>-1&&(Le(this).array=o)}get(e){He(arguments.length,1,"get");let t=""+e,r=Le(this).array;for(let e=0;e<r.length;++e){let n=r[e];if(n[0]===t)return n[1]}return null}getAll(e){He(arguments.length,1,"getAll");let t=""+e,r=Le(this).array,n=[];for(let e=0;e<r.length;++e){let o=r[e];o[0]===t&&n.push(o[1])}return n}has(e){He(arguments.length,1,"has");let t=""+e,r=Le(this).array;for(let e=0;e<r.length;++e){if(r[e][0]===t)return!0}return!1}set(e,t,r){He(arguments.length,2,"set");let n=""+e,o=Oe(e,t,r),s=-1,i=Le(this).array,a=[];for(let e=0;e<i.length;++e){let t=i[e];t[0]!==n?a.push(t):-1===s&&(s=e,a.push(o))}-1===s&&a.push(o),Le(this).array=a}forEach(e,t){if(He(arguments.length,1,"forEach"),"function"!=typeof e)throw new TypeError("Failed to execute 'forEach' on 'FormData': parameter 1 is not of type 'Function'.");let r=Le(this).array;for(let n=0;n<r.length;++n){let o=r[n];e.call(t,o[1],o[0],t)}}entries(){return Le(this).array.map(e=>[e[0],e[1]]).values()}keys(){return Le(this).array.map(e=>e[0]).values()}values(){return Le(this).array.map(e=>e[1]).values()}[e](){return this.entries()}toString(){return"[object FormData]"}get[t](){return"FormData"}get __MPHTTPX__(){return{chain:["FormData"]}}}class je{constructor(){this.array=[]}}function Le(e){return e.__FormData__}function He(e,t,r){return u(e,t,"FormData",r)}function Oe(e,t,r){if(ne(t)){if(r=void 0!==r?""+r:"string"==typeof t.name?t.name:"blob",t.name!==r||ne(t,!0)){t=new(a("Blob",t)?le:ue)([t],r)}return[""+e,t]}return[""+e,""+t]}function qe(e){return a("FormData",e)||function(e){let t="[object FormData]";return(Object.prototype.toString.call(e)===t||String(e)===t)&&"forEach"in e&&"function"==typeof e.forEach}(e)}function De(e,t){const r=t||"----formdata-mphttpx-"+Math.random(),n=`--${r}\r\nContent-Disposition: form-data; name="`;let o=[],s=!0;return e.forEach((e,t)=>{"string"==typeof e?o.push(n+Me(Ue(t))+`"\r\n\r\n${Ue(e)}\r\n`):(s&&a("Blob",e)&&(s=!1),o.push(n+Me(Ue(t))+`"; filename="${Me(e.name)}"\r\nContent-Type: ${e.type||"application/octet-stream"}\r\n\r\n`,e,"\r\n"))}),o.push(`--${r}--`),new(s?oe:K)(o,{type:"multipart/form-data; boundary="+r})}function Ue(e){return e.replace(/\r?\n|\r/g,"\r\n")}function Me(e){return e.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22")}function Xe(e){if(!e)return;if(!/multipart\/form-data/i.test(e))return;let t=e.match(/boundary\s*=\s*([^;]+)/i);if(t&&t[1]){return t[1].trim().replace(/^["']|["']$/g,"")}}const Ne="undefined"!=typeof FormData&&FormData||Ce;class $e{constructor(e,t){if(this._type="",t&&(this.type=t),"string"==typeof e)this.promise=Promise.resolve(e),this.type="text/plain;charset=UTF-8",this.calcLength=()=>W(e).length;else if(Fe(e)){let t=e.toString();this.promise=Promise.resolve(t),this.type="application/x-www-form-urlencoded;charset=UTF-8",this.calcLength=()=>W(t).length}else if(b(e))this.promise=Promise.resolve(e.slice(0)),this.length=e.byteLength;else if(ArrayBuffer.isView(e)){let t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);this.promise=Promise.resolve(t),this.length=t.byteLength}else if(ne(e))this.promise=e.arrayBuffer(),this.type=e.type,this.length=e.size;else if(qe(e)){let r=De(e,t?Xe(t):void 0);this.promise=r.arrayBuffer(),this.type=r.type,this.length=r.size}else if(null==e)this.promise=Promise.resolve(""),this.length=0;else{let t=""+e;this.promise=Promise.resolve(t),this.type="text/plain;charset=UTF-8",this.calcLength=()=>W(t).length}}get type(){return this._type}set type(e){this._type||(this._type=e)}get size(){var e;return"number"!=typeof this.length&&this.calcLength&&(this.length=this.calcLength()),null!==(e=this.length)&&void 0!==e?e:0}text(){return this.promise.then(e=>"string"==typeof e?e:Y(e))}arrayBuffer(){return this.promise.then(e=>b(e)?e:W(e).buffer)}}class Ie{constructor(){if(new.target===Ie)throw new TypeError("Failed to construct 'Body': Illegal constructor");s(this,"__Body__",new ke)}get bodyUsed(){return ze(this).bodyUsed}get body(){throw new TypeError(`Failed to access 'body' on '${o(this)}': property not implemented.`)}arrayBuffer(){const e="arrayBuffer";return We(this,e)||Ve(this,e)}blob(){const e="blob";return We(this,e)||Ve(this,e)}bytes(){const e="bytes";return We(this,e)||Ve(this,e)}formData(){const e="formData";return We(this,e)||Ve(this,e)}json(){const e="json";return We(this,e)||Ve(this,e)}text(){const e="text";return We(this,e)||Ve(this,e)}toString(){return"[object Body]"}get[t](){return"Body"}get __MPHTTPX__(){return{chain:["Body"]}}}class ke{constructor(){this.bodyUsed=!1}}function ze(e){return e.__Body__}function Ge(e,t){const r=e;if((n=t)&&"object"==typeof n&&"undefined"!=typeof ReadableStream&&ReadableStream&&ReadableStream.prototype.isPrototypeOf(n)||function(e){return(i("ReadableStream",e)||"[object ReadableStream]"===String(e))&&"getReader"in e&&"function"==typeof e.getReader}(t))throw new TypeError(`Failed to construct '${o(r)}': ReadableStream not implemented.`);var n;null!=t&&(ze(r).payload=new $e(t))}function Ve(e,t){let r=ze(e).payload||new $e;return"json"===t?r.text().then(e=>JSON.parse(e)):"text"===t?r.text():"arrayBuffer"===t?r.arrayBuffer():"bytes"===t?r.arrayBuffer().then(e=>new Uint8Array(e)):"blob"===t?r.promise.then(e=>new oe([e])):"formData"===t?r.text().then(e=>function(e,t){const r=()=>{throw new TypeError("Could not parse content as FormData.")};"string"==typeof e&&""!==e.trim()||r();let n=e.indexOf("\r\n");-1===n&&r();let o=e.substring(2,n).trim();o||r(),void 0!==t&&t!==o&&r();let s=e.split(`--${o}`).filter(e=>{let t=e.trim();return""!==t&&"--"!==t});0===s.length&&r();let i=[],a=!1;s.forEach(e=>{let t=e.indexOf("\r\n\r\n");-1===t&&r();let n=e.substring(0,t).trim(),o=n.match(/name="([^"]*)"/);(!o||o.length<2)&&r();let s=o[1],l=n.match(/filename="([^"]*)"/),u=e.substring(t+4);if(l){let e=l[1]||"",t=n.match(/Content-Type: ([^\r\n]+)/),r=t?(t[1]||"").trim():"text/plain",o=u.replace(/\r\n/g,"");a=!0,i.push([s,new ue([o],e,{type:r})])}else i.push([s,u.replace(/^[\r\n]+|[\r\n]+$/g,"")])});let l=new(!a||(()=>{try{let e=new Ne;return e.append("file",new ue([],"")),"string"!=typeof e.get("file")}catch(e){return!1}})()?Ne:Ce);return i.forEach(e=>{l.append(e[0],e[1])}),l}(e,Xe(r.type))):r.promise}function We(e,t){if(ze(e).payload){if(e.bodyUsed)return Promise.reject(new TypeError(`Failed to execute '${t}' on '${o(e)}': body stream already read`));ze(e).bodyUsed=!0}}class Ye{constructor(e){if(s(this,"__Headers__",new Je),void 0!==e)if(tt(e))e.forEach((e,t)=>{Qe(this,t,e,"")},this);else if(l(e)){let t=Array.isArray(e)?e:Array.from(e);for(let e=0;e<t.length;++e){let r=t[e];if(!l(r))throw new TypeError("Failed to construct 'Headers': The provided value cannot be converted to a sequence.");{let e=Array.isArray(r)?r:Array.from(r);if(2!==e.length)throw new TypeError("Failed to construct 'Headers': Invalid value");Qe(this,e[0],e[1])}}}else{if(!e||"object"!=typeof e)throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(record<ByteString, ByteString> or sequence<sequence<ByteString>>)'.");Object.getOwnPropertyNames(e).forEach(t=>{Qe(this,t,e[t])},this)}}append(e,t){et(arguments.length,2,"append"),Qe(this,e,t,"append")}delete(e){et(arguments.length,1,"delete"),delete Ke(this).dict[rt(e,Ze("delete"))]}get(e){var t;return et(arguments.length,1,"get"),null!==(t=Ke(this).dict[rt(e,Ze("get"))])&&void 0!==t?t:null}getSetCookie(){let e=this.get("Set-Cookie");return e?e.split(", "):[]}has(e){return et(arguments.length,1,"has"),Ke(this).dict.hasOwnProperty(rt(e,Ze("has")))}set(e,t){et(arguments.length,2,"set"),Ke(this).dict[rt(e,Ze("set"))]=nt(t)}forEach(e,t){if(et(arguments.length,1,"forEach"),"function"!=typeof e)throw new TypeError("Failed to execute 'forEach' on 'Headers': parameter 1 is not of type 'Function'.");let r=Ke(this).dict,n=Object.getOwnPropertyNames(r);for(let o=0;o<n.length;++o){let s=n[o];e.call(t,r[s],s,this)}}entries(){let e=[];return this.forEach((t,r)=>{e.push([r,t])}),e.values()}keys(){let e=[];return this.forEach((t,r)=>{e.push([r,t])}),e.map(e=>e[0]).values()}values(){let e=[];return this.forEach((t,r)=>{e.push([r,t])}),e.map(e=>e[1]).values()}[e](){return this.entries()}toString(){return"[object Headers]"}get[t](){return"Headers"}get __MPHTTPX__(){return{chain:["Headers"]}}}class Je{constructor(){this.dict={}}}function Ke(e){return e.__Headers__}function Qe(e,t,r,n="constructor"){let o=rt(t,n?Ze(n):void 0),s=nt(r),i=Ke(e).dict,a=i[o];i[o]=void 0!==a?`${a}, ${s}`:s}function Ze(e){return()=>{throw new TypeError(`Failed to ${e&&"constructor"!==e?"execute '"+e+"' on":"construct"} 'Headers': Invalid name`)}}function et(e,t,r){u(e,t,"Headers",r)}function tt(e){return a("Headers",e)||function(e){let t="[object Headers]";return(Object.prototype.toString.call(e)===t||String(e)===t)&&"forEach"in e&&"function"==typeof e.forEach}(e)}function rt(e,t){return"string"!=typeof e&&(e=""+e),t&&(/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)&&t(),e.toLowerCase()}function nt(e){return"string"==typeof e?e:""+e}function ot(e){let t=new it;return e.replace(/\r?\n[\t ]+/g," ").split("\r").map(e=>0===e.indexOf("\n")?e.substring(1,e.length):e).forEach(e=>{let r=e.split(":"),n=r.shift().trim();if(n){let e=r.join(":").trim();try{t.append(n,e)}catch(e){console.warn(`SyntaxError: Response.headers: '${n}' is not a valid HTTP header field name.`)}}}),t}function st(e){if(a("Headers",e)&&!Object.is(it,Ye)){let t=new it;return e.forEach((e,r)=>{t.append(r,e)}),t}return new it(e)}const it="undefined"!=typeof Headers&&Headers||Ye;class at extends Ie{constructor(e,t){u(arguments.length,1,"Request"),super(),s(this,"__Request__",new lt);const r=ut(this);let n=null!=t?t:{};if("object"!=typeof n)throw new TypeError("Failed to construct 'Request': The provided value is not of type 'RequestInit'.");let o=n.body,i=!1;if(a("Request",l=e)||function(e){let t="[object Request]";return(Object.prototype.toString.call(e)===t||String(e)===t)&&"arrayBuffer"in e&&"function"==typeof e.arrayBuffer}(l)){if(e.bodyUsed)throw new TypeError("Failed to construct 'Request': Cannot construct a Request with a Request object that has already been used.");r.cache=e.cache,r.credentials=e.credentials,void 0===n.headers&&(ut(this).headers=st(e.headers)),r.method=e.method,r.mode=e.mode,r.signal=e.signal,r.url=e.url,o||(this.__Body__.payload=function(e){let t=Object.create($e.prototype);t.type=e.headers.get("Content-Type")||"";try{t.promise=e.arrayBuffer()}catch(r){try{t.promise=e.text()}catch(r){if("multipart/form-data"===t.type.slice(0,19).toLowerCase())try{t.promise=e.formData().then(e=>new $e(e,t.type).promise)}catch(e){}}}if(!t.promise)throw new TypeError("Failed to construct 'Request': Failed to read request body data, underlying data is in an invalid format.");return t}(e),i=!0)}else r.url=""+e;var l;if(n.cache&&(r.cache=n.cache),n.credentials&&(r.credentials=n.credentials),void 0!==n.headers&&(ut(this).headers=st(n.headers)),n.method&&(r.method=function(e){let t=e.toUpperCase();return ct.indexOf(t)>-1?t:e}(n.method)),n.mode&&(r.mode=n.mode),null!==n.signal&&void 0!==n.signal){if(!L(n.signal))throw new TypeError("Failed to construct 'Request': Failed to read the 'signal' property from 'RequestInit': Failed to convert value to 'AbortSignal'.");r.signal=n.signal}if(("GET"===this.method||"HEAD"===this.method)&&null!=o)throw new TypeError("Failed to construct 'Request': Request with GET/HEAD method cannot have body.");Ge(this,i?null:o);let c=this.__Body__.payload;!this.headers.has("Content-Type")&&c&&c.type&&this.headers.set("Content-Type",c.type),"GET"!==this.method&&"HEAD"!==this.method||"no-cache"!==this.cache&&"no-store"!==this.cache||function(e){let t=/([?&])_=[^&]*/;if(t.test(e.url))ut(e).url=e.url.replace(t,"$1_="+(new Date).getTime());else{let t=/\?/;ut(e).url+=(t.test(e.url)?"&":"?")+"_="+(new Date).getTime()}}(this)}get cache(){return ut(this).cache}get credentials(){return ut(this).credentials}get destination(){return""}get headers(){return ut(this).headers||(ut(this).headers=new it),ut(this).headers}get integrity(){return""}get keepalive(){return!1}get method(){return ut(this).method}get mode(){return ut(this).mode}get redirect(){return"follow"}get referrer(){return ut(this).referrer}get referrerPolicy(){return""}get signal(){return ut(this).signal||(ut(this).signal=(new V).signal),ut(this).signal}get url(){return ut(this).url}clone(){if(this.bodyUsed)throw new TypeError("Failed to execute 'clone' on 'Request': Request body is already used");{let e=new at(this);return this.__Body__.bodyUsed=!1,e}}toString(){return"[object Request]"}get[t](){return"Request"}get __MPHTTPX__(){return{chain:["Request","Body"]}}}class lt{constructor(){this.cache="default",this.credentials="same-origin",this.method="GET",this.mode="cors",this.referrer="about:client",this.url=""}}function ut(e){return e.__Request__}const ct=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];const ht="undefined"!=typeof Request&&Request||at;class dt extends Ie{static json(e,t){u(arguments.length,1,"Response","json");let r=new dt("string"==typeof e?e:JSON.stringify(e),t);return r.headers.set("Content-Type","application/json"),r}static error(){let e=new dt(null,{status:200,statusText:""});return ft(e).status=0,ft(e).type="error",e}static redirect(e,t=302){if(u(arguments.length,1,"Response","redirect"),-1===[301,302,303,307,308].indexOf(t))throw new RangeError("Failed to execute 'redirect' on 'Response': Invalid status code");return new dt(null,{status:t,headers:{location:""+e}})}constructor(e,t){super(),s(this,"__Response__",new pt);const r=ft(this);let n=null!=t?t:{};if("object"!=typeof n)throw new TypeError("Failed to construct 'Response': The provided value is not of type 'ResponseInit'.");void 0!==n.headers&&(ft(this).headers=st(n.headers));let o=void 0===n.status?200:n.status;if(o<200||o>599)throw new RangeError(`Failed to construct 'Response': The status provided (${+o}) is outside the range [200, 599].`);r.status=o,r.statusText=void 0===n.statusText?"":""+n.statusText,Ge(this,e);let i=this.__Body__.payload;!this.headers.has("Content-Type")&&i&&i.type&&this.headers.set("Content-Type",i.type)}get headers(){return ft(this).headers||(ft(this).headers=new it),ft(this).headers}get ok(){return this.status>=200&&this.status<300}get redirected(){return!1}get status(){return ft(this).status}get statusText(){return ft(this).statusText}get type(){return ft(this).type}get url(){return ft(this).url}clone(){if(this.bodyUsed)throw new TypeError("Failed to execute 'clone' on 'Response': Response body is already used");let e=new dt(null,{headers:st(this.headers),status:this.status,statusText:this.statusText});return ft(e).url=this.url,e.__Body__.payload=this.__Body__.payload,e}toString(){return"[object Response]"}get[t](){return"Response"}get __MPHTTPX__(){return{chain:["Response","Body"]}}}class pt{constructor(){this.status=200,this.statusText="",this.type="default",this.url=""}}function ft(e){return e.__Response__}const yt="undefined"!=typeof Response&&Response||dt,gt={XMLHttpRequest:"undefined"!=typeof XMLHttpRequest&&XMLHttpRequest||void 0};function bt(e,t){if(u(arguments.length,1,"Window","fetch"),new.target===bt)throw new TypeError("fetch is not a constructor");return new Promise((r,o)=>{const s=new at(e,t),i=s.__Request__.signal;if(i&&i.aborted)return o(i.reason);let a,l=new(gt.XMLHttpRequest||(()=>{throw new ReferenceError("XMLHttpRequest is not defined")})()),u=!1,c=s.__Body__.payload;if(l.onload=()=>{let e={headers:ot(l.getAllResponseHeaders()||""),status:l.status,statusText:l.statusText};0===s.url.indexOf("file://")&&(l.status<200||l.status>599)&&(e.status=200),setTimeout(()=>{a=new dt("response"in l?l.response:l.responseText,e),a.__Response__.url="responseURL"in l?l.responseURL:e.headers.get("X-Request-URL")||"";let t=a.__Body__.payload,n=a.headers.get("Content-Type")||"";t&&n&&(t.type=n),u?o(_t()):r(a)})},l.onabort=()=>{setTimeout(()=>{o(_t())})},l.onerror=()=>{setTimeout(()=>{o(new TypeError("Failed to fetch"))})},l.ontimeout=()=>{setTimeout(()=>{o(new n("The request timed out.","TimeoutError"))})},l.open(s.method,vt(s.url),!0),"include"===s.credentials?l.withCredentials=!0:"omit"===s.credentials&&(l.withCredentials=!1),"responseType"in l&&(l.responseType="arraybuffer"),t&&"object"==typeof t&&t.headers&&"object"==typeof t.headers&&!tt(t.headers)){let e=t.headers,r=[];Object.getOwnPropertyNames(e).forEach(t=>{r.push(rt(t)),l.setRequestHeader(t,nt(e[t]))}),s.headers.forEach((e,t)=>{-1===r.indexOf(t)&&l.setRequestHeader(t,e)})}else s.headers.forEach((e,t)=>{l.setRequestHeader(t,e)});if(i){const e=()=>{if(a&&!a.bodyUsed){(a.__Body__.payload=new $e).promise=Promise.reject(_t())}u=!0,l.abort(),t()},t=()=>{i.removeEventListener("abort",e)};i.addEventListener("abort",e),l.onreadystatechange=()=>{4===l.readyState&&t()}}c?c.promise.then(e=>{u?o(_t()):l.send(""!==e?e:void 0)}).catch(e=>{console.error(e),o(new TypeError("Failed to fetch"))}):l.send()})}function _t(){return new n("The user aborted a request.","AbortError")}const mt="undefined"!=typeof location&&!!location,vt=e=>""===e&&mt&&(null===location||void 0===location?void 0:location.href)?location.href:e,Tt="undefined"!=typeof fetch&&fetch||bt;exports.AbortController=V,exports.AbortControllerP=z,exports.AbortSignal=k,exports.AbortSignalP=M,exports.Blob=oe,exports.BlobP=K,exports.CustomEvent=U,exports.CustomEventP=O,exports.Event=x,exports.EventP=m,exports.EventTarget=H,exports.EventTargetP=S,exports.File=ue,exports.FileP=le,exports.FileReader=Te,exports.FileReaderP=ye,exports.FormData=Ne,exports.FormDataP=Ce,exports.Headers=it,exports.HeadersP=Ye,exports.Request=ht,exports.RequestP=at,exports.Response=yt,exports.ResponseP=dt,exports.TextDecoder=_,exports.TextDecoderP=f,exports.TextEncoder=d,exports.TextEncoderP=c,exports.URLSearchParams=Be,exports.URLSearchParamsP=we,exports.fetch=Tt,exports.fetchP=bt,exports.fixFetch=function(e){const t=e||"undefined"!=typeof fetch&&fetch;if(!t||t===bt)return bt;if("__MPHTTPX__Polyfill__"in t)return t;function r(e,t){if(e.headers){if((r=e.headers)&&"object"==typeof r&&"has"in r&&"function"==typeof r.has&&"set"in r&&"function"==typeof r.set)e.headers.has("Content-Type")||e.headers.set("Content-Type",t);else if(l(e.headers)){let r=!1,n=Array.isArray(e.headers)?e.headers:Array.from(e.headers);for(let e=0;e<n.length;++e){let t=n[e];if(l(t)){let e=Array.isArray(t)?t:Array.from(t);if(e.length>=2&&"content-type"===String(e[0]).toLowerCase()){r=!0;break}}}r||(n.push(["Content-Type",t]),e.headers=n)}else if("object"==typeof e.headers){let r=!1,n=Object.getOwnPropertyNames(e.headers);for(let e=0;e<n.length;++e){if("content-type"===n[e].toLowerCase()){r=!0;break}}r||(e.headers["Content-Type"]=t)}}else e.headers={"Content-Type":t};var r}function o(e,o){if(a("Request",e))return bt(e,o);if(o&&o.headers&&a("Headers",o.headers))if("undefined"!=typeof Headers&&Headers&&!("__MPHTTPX__"in Headers.prototype)){let e=new Headers;o.headers.forEach((t,r)=>{e.append(r,t)}),o.headers=e}else{let e={};o.headers.forEach((t,r)=>{e[r]=t}),o.headers=e}return new Promise((s,i)=>{if(o&&o.body&&a("FormData",o.body)&&(o.body=De(o.body)),o&&o.body&&a("Blob",o.body)){let a=new $e(o.body);a.type&&r(o,a.type);let l=null,u=!1,c=!0;if(e&&"object"==typeof e&&"signal"in e&&L(e.signal)){let t=()=>{c&&(u=!0),l()};l=()=>{e.signal.removeEventListener("abort",t)},e.signal.addEventListener("abort",t)}a.promise.then(r=>{o.body=""!==r?r:null,u?i(new n("The user aborted a request.","AbortError")):s(t(e,o)),c=!1}).catch(e=>{i(new TypeError("Failed to fetch")),console.error(e),c=!1}).then(()=>{l&&l()})}else o&&o.body&&a("URLSearchParams",o.body)&&r(o,"application/x-www-form-urlencoded;charset=UTF-8"),s(t(e,o))})}return o.__MPHTTPX__Polyfill__=!0,o},exports.fixWebSocket=function(e){const t=e||"undefined"!=typeof WebSocket&&WebSocket;if(!t||"__MPHTTPX__Polyfill__"in t||"__MPHTTPX__"in t.prototype)return;const r=t.prototype.send;t.prototype.send=function(e){if(a("Blob",e)){new $e(e).promise.then(e=>{1===this.readyState&&r.call(this,e)})}else r.call(this,e)},t.__MPHTTPX__Polyfill__=!0},exports.fixXMLHttpRequest=function(e){const t=e||"undefined"!=typeof XMLHttpRequest&&XMLHttpRequest;if(!t||"__MPHTTPX__Polyfill__"in t||"__MPHTTPX__"in t.prototype)return;const r=t.prototype.abort,o=t.prototype.open,i=t.prototype.send,l=t.prototype.setRequestHeader;t.prototype.abort=function(){c(this).processing&&(c(this).aborted=!0),r.call(this),c(this).hasContentType=!1},t.prototype.open=function(e,t,r=!0,n=null,s=null){c(this).processing&&(c(this).aborted=!0),o.call(this,e,t,r,n,s),c(this).hasContentType=!1},t.prototype.send=function(e){if(a("FormData",e)&&(e=De(e),c(this).hasContentType||this.setRequestHeader("Content-Type",e.type)),a("Blob",e)){let t=new $e(e);t.type&&!c(this).hasContentType&&this.setRequestHeader("Content-Type",t.type);const r=this.withCredentials;c(this).processing=!0,t.promise.then(function(e){c(this).aborted||(r!==this.withCredentials&&(console.warn("Illegal to set the 'withCredentials' property on 'XMLHttpRequest': The value may only be set if the object's state is UNSENT or OPENED."),this.withCredentials=r),i.call(this,""!==e?e:void 0)),c(this).aborted=!1,c(this).processing=!1}.bind(this)).catch(function(e){console.error(e),c(this).aborted=!1,c(this).processing=!1}.bind(this))}else a("URLSearchParams",e)&&!c(this).hasContentType&&this.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8"),i.call(this,e)},t.prototype.setRequestHeader=function(e,t){if(c(this).processing)throw new n("Failed to execute 'setRequestHeader' on 'XMLHttpRequest': The object's state must be OPENED.","InvalidStateError");l.call(this,e,t),"content-type"===String(e).toLowerCase()&&(c(this).hasContentType=!0)},t.__MPHTTPX__Polyfill__=!0;class u{constructor(){this.aborted=!1,this.processing=!1,this.hasContentType=!1}}function c(e){const t="__XMLHttpRequest_Polyfill__";return t in e||s(e,t,new u),e[t]}},exports.setReadableStreamClass=function(e){J.ReadableStream=e},exports.setXMLHttpRequestClass=function(e){gt.XMLHttpRequest=e};
@@ -0,0 +1 @@
1
+ const e="function"==typeof Symbol&&(Symbol.iterator||"Symbol(Symbol.iterator)"),t="function"==typeof Symbol&&(Symbol.toStringTag||"Symbol(Symbol.toStringTag)");class r extends Error{constructor(e,t){super(e),void 0!==t&&(this.name=""+t)}get[t](){return"DOMException"}get __MPHTTPX__(){return{chain:["DOMException"]}}}const n=(()=>{try{return new DOMException,!0}catch(e){return!1}})()?DOMException:r;function o(e){try{return e.__MPHTTPX__.chain[0]}catch(t){return Object.prototype.toString.call(e).slice(8,-1)}}function s(e,t,r){Object.defineProperty(e,t,{value:r})}function i(e,t){return Object.prototype.toString.call(t)===`[object ${e}]`}function a(e,t,r=!1){const n="__MPHTTPX__";return!!t&&"object"==typeof t&&n in t&&!!t[n]&&"object"==typeof t[n]&&"chain"in t[n]&&Array.isArray(t[n].chain)&&(o=t[n].chain.indexOf(e),r?0===o:o>-1);var o}function l(e){return Array.isArray(e)||!!e&&"object"==typeof e&&"function"==typeof Symbol&&Symbol.iterator&&Symbol.iterator in e&&"function"==typeof e[Symbol.iterator]}function u(e,t,r,n){if(e<t)throw new TypeError(`Failed to ${n?"execute '"+n+"' on":"construct"} '${r}': ${t} argument${t>1?"s":""} required, but only ${e} present.`)}class c{get encoding(){return"utf-8"}encode(e=""){return h("string"==typeof e?e:""+e).encoded}encodeInto(e,t){if(u(arguments.length,2,"TextEncoder","encodeInto"),!Uint8Array.prototype.isPrototypeOf(t)&&!i("Uint8Array",t))throw new TypeError("Failed to execute 'encodeInto' on 'TextEncoder': parameter 2 is not of type 'Uint8Array'.");let r=h("string"==typeof e?e:""+e,t);return{read:r.read,written:r.written}}toString(){return"[object TextEncoder]"}get[t](){return"TextEncoder"}get __MPHTTPX__(){return{chain:["TextEncoder"]}}}function h(e,t){const r=void 0!==t;let n=0,o=0,s=e.length,i=0,a=Math.max(32,s+(s>>1)+7),l=r?t:new Uint8Array(a>>3<<3),u=0,c=0,h=0;for(;n<s;){if(u=e.charCodeAt(n),c=1,u>=55296&&u<=56319)if(n+1<s){let t=e.charCodeAt(n+1);56320==(64512&t)?(c=2,n+=2,u=((1023&u)<<10)+(1023&t)+65536):(n+=1,u=65533)}else n+=1,u=65533;else u>=56320&&u<=57343?(n+=1,u=65533):n+=1;if(!r&&i+4>l.length){a+=8,a*=1+n/e.length*2,a=a>>3<<3;let t=new Uint8Array(a);t.set(l),l=t}if(4294967168&u?4294965248&u?4294901760&u?4292870144&u?(u=65533,h=3):h=4:h=3:h=2:h=1,r&&i+h>l.length)break;switch(h){case 1:l[i++]=u;break;case 2:l[i++]=u>>6&31|192,l[i++]=63&u|128;break;case 3:l[i++]=u>>12&15|224,l[i++]=u>>6&63|128,l[i++]=63&u|128;break;case 4:l[i++]=u>>18&7|240,l[i++]=u>>12&63|128,l[i++]=u>>6&63|128,l[i++]=63&u|128}o+=c}return{encoded:r?t:l.slice(0,i),read:o,written:i}}const d="undefined"!=typeof TextEncoder&&TextEncoder||c,p=["utf-8","utf8","unicode-1-1-utf-8"];class f{constructor(e="utf-8",t){if(-1===p.indexOf(("string"==typeof e?e:""+e).toLowerCase()))throw new RangeError(`Failed to construct 'TextDecoder': encoding ('${e}') not implemented.`);s(this,"__TextDecoder__",new y(t))}get encoding(){return"utf-8"}get fatal(){return g(this).fatal}get ignoreBOM(){return g(this).ignoreBOM}decode(e,t){return function(e,{stream:t=!1}={},r={fatal:!1,ignoreBOM:!1,partial:[]}){if(void 0===e){if(r.partial.length>0&&r.fatal)throw r.partial=[],new TypeError("Incomplete UTF-8 sequence.");return""}let n=b(e)?new Uint8Array(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):(()=>{throw new TypeError("Input could not be converted to any of: ArrayBufferView, ArrayBuffer.")})();if(r.partial.length>0){let e=new Uint8Array(r.partial.length+n.length);e.set(r.partial,0),e.set(n,r.partial.length),n=e,r.partial=[]}!r.ignoreBOM&&n.length>=3&&239===n[0]&&187===n[1]&&191===n[2]&&(n=n.subarray(3));let o=n.length,s=[];if(t&&n.length>0){let e=n.length;for(;e>0&&e>n.length-4;){let t=n[e-1];if(128!=(192&t)){(t>239?4:t>223?3:t>191?2:1)>n.length-(e-1)&&(o=e-1);break}--e}r.partial=Array.from(n.slice(o)),n=n.slice(0,o)}let i=0,a=0,l=0,u=0,c=0,h=0,d=0,p=0;for(;p<o;){if(i=0,u=n[p],l=u>239?4:u>223?3:u>191?2:1,p+l<=o)switch(l){case 1:u<128&&(i=u);break;case 2:c=n[p+1],128==(192&c)&&(a=(31&u)<<6|63&c,a>127&&(i=a));break;case 3:c=n[p+1],h=n[p+2],128==(192&c)&&128==(192&h)&&(a=(15&u)<<12|(63&c)<<6|63&h,a>2047&&(a<55296||a>57343)&&(i=a));break;case 4:c=n[p+1],h=n[p+2],d=n[p+3],128==(192&c)&&128==(192&h)&&128==(192&d)&&(a=(15&u)<<18|(63&c)<<12|(63&h)<<6|63&d,a>65535&&a<1114112&&(i=a))}if(0===i&&(1===l&&0!==u||l>1)){if(r.fatal)throw r.partial=[],new TypeError("Decoding failed.");let e=1;for(;p+e<o&&128==(192&n[p+e]);)e+=1;s.push(65533),p+=e;continue}i>65535&&(i-=65536,s.push(i>>>10&1023|55296),i=56320|1023&i),s.push(i),p+=l}return s.length>16384?function(e){let t=[];for(let r=0,n=e.length;r<n;r+=4096)t.push(String.fromCharCode.apply(String,e.slice(r,r+4096)));return t.join("")}(s):function(e){let t="";for(let r=0,n=e.length;r<n;r+=4096)t+=String.fromCharCode.apply(String,e.slice(r,r+4096));return t}(s)}(e,t,g(this))}toString(){return"[object TextDecoder]"}get[t](){return"TextDecoder"}get __MPHTTPX__(){return{chain:["TextDecoder"]}}}class y{constructor({fatal:e=!1,ignoreBOM:t=!1}={}){this.partial=[],this.fatal=!!e,this.ignoreBOM=!!t}}function g(e){return e.__TextDecoder__}function b(e){return!!e&&"object"==typeof e&&ArrayBuffer.prototype.isPrototypeOf(e)||function(e){return(i("ArrayBuffer",e)||"[object ArrayBuffer]"===String(e))&&"byteLength"in e&&"number"==typeof e.byteLength}(e)}const _="undefined"!=typeof TextDecoder&&TextDecoder||f;class m{static get NONE(){return 0}static get CAPTURING_PHASE(){return 1}static get AT_TARGET(){return 2}static get BUBBLING_PHASE(){return 3}constructor(e,t){u(arguments.length,1,"Event"),s(this,"__Event__",new v);const r=w(this);r.type=""+e,r.bubbles=!!(null==t?void 0:t.bubbles),r.cancelable=!!(null==t?void 0:t.cancelable),r.composed=!!(null==t?void 0:t.composed),Object.defineProperty(this,"isTrusted",{enumerable:!0,get:function(){return"YES"===r.isTrusted}})}get NONE(){return 0}get CAPTURING_PHASE(){return 1}get AT_TARGET(){return 2}get BUBBLING_PHASE(){return 3}get bubbles(){return w(this).bubbles}get cancelBubble(){return w(this).cancelBubble}set cancelBubble(e){e&&(w(this).cancelBubble=!0)}get cancelable(){return w(this).cancelable}get composed(){return w(this).composed}get currentTarget(){return w(this).currentTarget}get defaultPrevented(){return w(this).defaultPrevented}get eventPhase(){return w(this).eventPhase}get returnValue(){return w(this).returnValue}set returnValue(e){e||this.preventDefault()}get srcElement(){return w(this).target}get target(){return w(this).target}get timeStamp(){return w(this).timeStamp}get type(){return w(this).type}composedPath(){let e=this.target?[this.target]:[];return this.currentTarget&&this.currentTarget!==this.target&&e.push(this.currentTarget),e}initEvent(e,t,r){u(arguments.length,1,o(this),"initEvent");let n=w(this);n.eventDispatched||(n.type=""+e,n.bubbles=!!t,n.cancelable=!!r)}preventDefault(){let e=w(this);if(e.passive)return console.warn(`Ignoring 'preventDefault()' call on event of type '${this.type}' from a listener registered as 'passive'.`);this.cancelable&&(e.defaultPrevented=!0,e.returnValue=!1)}stopImmediatePropagation(){w(this).immediatePropagationStopped=!0,this.cancelBubble=!0}stopPropagation(){this.cancelBubble=!0}toString(){return"[object Event]"}get[t](){return"Event"}get __MPHTTPX__(){return{chain:["Event"]}}}class v{constructor(){this.bubbles=!1,this.cancelBubble=!1,this.cancelable=!1,this.composed=!1,this.currentTarget=null,this.defaultPrevented=!1,this.eventPhase=0,this.returnValue=!0,this.target=null,this.timeStamp=(new Date).getTime()-T,this.type="",this.passive=!1,this.eventDispatched=!1,this.immediatePropagationStopped=!1,Object.defineProperty(this,"isTrusted",E())}}function w(e){return e.__Event__}const T=(new Date).getTime();function E(){let e=E.name,t=e.length,r="NO";return{configurable:!1,enumerable:!0,get:function(){return r},set:function(n){e===n.slice(0,t)&&(r=n.slice(t+1))}}}function P(e,t){(w(e)||{}).isTrusted=`${E.name}:${t?"YES":"NO"}`}const S="undefined"!=typeof Event&&Event||m;class R{constructor(){s(this,"__EventTarget__",new A)}addEventListener(e,t,r){if(u(arguments.length,2,o(this),"addEventListener"),"function"!=typeof t&&"object"!=typeof t&&void 0!==t)throw new TypeError(`Failed to execute 'addEventListener' on '${o(this)}': parameter 2 is not of type 'Object'.`);let n=x(this)||{executors:[]},s=new F(e,t),i=s.options.capture="boolean"==typeof r?r:!!(null==r?void 0:r.capture);if(!n.executors.some(e=>e.equals(s))){if(n.executors.push(s),r&&"object"==typeof r){s.options.once=!!r.once,s.options.passive=!!r.passive;const e=r.signal;e&&L(e)&&!e.aborted&&(s.options.signal=e,function(e,t,r){const n=()=>{x(e).executors=x(e).executors.filter(e=>!e.equals(t)),r.removeEventListener("abort",n)};r.addEventListener("abort",n)}(this,s,e))}if(i){let e=e=>e.options.capture?0:1;n.executors=n.executors.sort((t,r)=>e(t)-e(r))}}}dispatchEvent(e){if(u(arguments.length,1,o(this),"dispatchEvent"),a("Event",e))P(e,!1);else{if(!function(e){const t=e=>"[object "===e.slice(0,8)&&"Event]"===e.slice(-6);return!!e&&"object"==typeof e&&(t(Object.prototype.toString.call(e))||t(String(e)))&&"type"in e&&"string"==typeof e.type}(e))throw new TypeError(`Failed to execute 'dispatchEvent' on '${o(this)}': parameter 1 is not of type 'Event'.`);console.warn(`WARNING: undefined behavior when executing 'dispatchEvent' on '${o(this)}': parameter 1 is not of type 'Event(P)'.`)}return B(this,e)}removeEventListener(e,t,r){if(u(arguments.length,2,o(this),"removeEventListener"),"function"!=typeof t&&"object"!=typeof t&&void 0!==t)throw new TypeError(`Failed to execute 'removeEventListener' on '${o(this)}': parameter 2 is not of type 'Object'.`);let n=x(this)||{executors:[]},s=new F(e,t);s.options.capture="boolean"==typeof r?r:!!(null==r?void 0:r.capture),n.executors.some(e=>e.equals(s))&&(n.executors=n.executors.filter(e=>!e.equals(s)))}toString(){return"[object EventTarget]"}get[t](){return"EventTarget"}get __MPHTTPX__(){return{chain:["EventTarget"]}}}class A{constructor(){this.executors=[]}}function x(e){return e.__EventTarget__}class F{constructor(e,t){var r;this.options={},this.type=""+e,this.callback="function"==typeof(r=t)?r:function(e){return!!e&&"object"==typeof e&&"handleEvent"in e&&"function"==typeof e.handleEvent}(r)?r.handleEvent:r}equals(e){return Object.is(this.type,e.type)&&Object.is(this.callback,e.callback)&&Object.is(this.options.capture,e.options.capture)}}function B(e,t){const r=x(e)||{},n=t.__Event__||{};n.target=e,n.currentTarget=e,n.eventPhase=2,n.eventDispatched=!0;let o=[];Array.isArray(r.executors)||(r.executors=[]);for(let s=0;s<r.executors.length&&!n.immediatePropagationStopped;++s){let i=r.executors[s];if(i.type===t.type){i.options.once&&o.push(s),n.passive=!!i.options.passive;try{let r=i.callback;"function"==typeof r&&r.call(e,t)}catch(e){console.error(e)}n.passive=!1}}return o.length>0&&(r.executors=r.executors.reduce((e,t,r)=>(-1===o.indexOf(r)&&e.push(t),e),[])),n.currentTarget=null,n.eventPhase=0,n.eventDispatched=!1,!(t.cancelable&&t.defaultPrevented)}function j(e,t){return function(r){const n="on"+r,o=e[n],s=t[n];"function"==typeof o?R.prototype.addEventListener.call(e,r,s):R.prototype.removeEventListener.call(e,r,s)}}function C(e,t,r){"function"==typeof t&&t.call(e,r)}function L(e){return a("EventTarget",e)||function(e){return!!e&&"object"==typeof e&&"addEventListener"in e&&"function"==typeof e.addEventListener&&"removeEventListener"in e&&"function"==typeof e.removeEventListener}(e)}const H="undefined"!=typeof EventTarget&&EventTarget||R;class O extends m{constructor(e,t){var r;u(arguments.length,1,"CustomEvent"),super(e,t),s(this,"__CustomEvent__",new q),D(this).detail=null!==(r=null==t?void 0:t.detail)&&void 0!==r?r:null}get detail(){return D(this).detail}initCustomEvent(e,t,r,n){u(arguments.length,1,"CustomEvent","initCustomEvent"),this.__Event__.eventDispatched||(this.initEvent(e,t,r),D(this).detail=null!=n?n:null)}toString(){return"[object CustomEvent]"}get[t](){return"CustomEvent"}get __MPHTTPX__(){return{chain:["CustomEvent","Event"]}}}class q{}function D(e){return e.__CustomEvent__}const U="undefined"!=typeof CustomEvent&&CustomEvent||O;class M extends R{static abort(e){let t=$();return I(t,!1,e),t}static any(e){if(u(arguments.length,1,"AbortSignal","any"),!l(e))throw new TypeError("Failed to execute 'any' on 'AbortSignal': The provided value cannot be converted to a sequence.");let t=Array.isArray(e)?e:Array.from(e);t.forEach(e=>{if(!L(e))throw new TypeError("Failed to execute 'any' on 'AbortSignal': Failed to convert value to 'AbortSignal'.")});let r=$(),n=(()=>{for(let e=0;e<t.length;++e){let r=t[e];if(r.aborted)return r}})();if(n)I(r,!1,n.reason);else{function o(){for(let e=0;e<t.length;++e){t[e].removeEventListener("abort",o)}I(r,!0,this.reason)}for(let s=0;s<t.length;++s){t[s].addEventListener("abort",o)}}return r}static timeout(e){if(u(arguments.length,1,"AbortSignal","timeout"),!(e>=0))throw new TypeError("Failed to execute 'timeout' on 'AbortSignal': Value is outside the 'unsigned long long' value range.");const t=$();return setTimeout(()=>I(t,!0,new n("signal timed out","TimeoutError")),e),t}constructor(){if(new.target===M)throw new TypeError("Failed to construct 'AbortSignal': Illegal constructor");super(),s(this,"__AbortSignal__",new X(this))}get aborted(){return N(this).aborted}get reason(){return N(this).reason}throwIfAborted(){if(this.aborted)throw this.reason}get onabort(){return N(this).onabort}set onabort(e){N(this).onabort=e,N(this).attach("abort")}toString(){return"[object AbortSignal]"}get[t](){return"AbortSignal"}get __MPHTTPX__(){return{chain:["AbortSignal","EventTarget"]}}}class X{constructor(e){var t;this.aborted=!1,this.reason=void 0,this.onabort=null,this.attach=j(e,(t=e,{onabort:e=>{C(t,t.onabort,e)}}))}}function N(e){return e.__AbortSignal__}function $(){let e=Object.create(M.prototype);return s(e,"__EventTarget__",{executors:[]}),s(e,"__AbortSignal__",new X(e)),e}function I(e,t=!0,r){if(!e.aborted){let o=N(e)||{};if(o.aborted=!0,o.reason=void 0!==r?r:new n("signal is aborted without reason","AbortError"),t){let t=new m("abort");t.__Event__.target=e,P(t,!0),B(e,t)}}}const k="undefined"!=typeof AbortSignal&&AbortSignal||M;class z{constructor(){s(this,"__AbortController__",new G)}get signal(){return(e=this,e.__AbortController__).signal;var e}abort(e){I(this.signal,!0,e)}toString(){return"[object AbortController]"}get[t](){return"AbortController"}get __MPHTTPX__(){return{chain:["AbortController"]}}}class G{constructor(){this.signal=$()}}const V="undefined"!=typeof AbortController&&AbortController||z,W=d.prototype.encode.bind(new d),Y=_.prototype.decode.bind(new _),J={ReadableStream:"undefined"!=typeof ReadableStream&&ReadableStream||void 0};function K(e){J.ReadableStream=e}class Q{constructor(e=[],t){if(!l(e))throw new TypeError("Failed to construct 'Blob/File': The provided value cannot be converted to a sequence.");let r=Array.isArray(e)?e:Array.from(e),n=[],o=0;for(let e=0;e<r.length;++e){let t=r[e];if(oe(t))o+=t.size,n.push(t.arrayBuffer().then(e=>new Uint8Array(e)));else{let e=b(t)||ArrayBuffer.isView(t)?te(t):W(t);o+=e.length,n.push(Promise.resolve(e))}}s(this,"__Blob__",new Z(Promise.all(n).then(e=>function(e){let t=e.reduce((e,t)=>e+t.byteLength,0),r=new Uint8Array(t);return e.reduce((e,t)=>(r.set(t,e),e+t.byteLength),0),r}(e)))),ee(this).size=o,ee(this).type=re(null==t?void 0:t.type)}get size(){return ee(this).size}get type(){return ee(this).type}arrayBuffer(){return ee(this).promise.then(e=>ne(e.buffer).buffer)}bytes(){return ee(this).promise.then(e=>ne(e.buffer))}slice(e,t,r){let n=null!=e?e:0,o=null!=t?t:this.size,i=Object.create(Q.prototype);return s(i,"__Blob__",new Z(ee(this).promise.then(e=>ne(e.slice(n,o))))),ee(i).size=function(e,t,r){const n=t=>{let r=Number(t);return isNaN(r)&&(r=0),r=r>=0?Math.min(r,e):Math.max(0,r+e),r};return Math.max(0,n(r)-n(t))}(this.size,n,o),ee(i).type=re(r),i}stream(){let e=J.ReadableStream||(()=>{throw new ReferenceError("ReadableStream is not defined")})(),t=0;try{return new e({type:"bytes",autoAllocateChunkSize:524288,pull:function(e){var r;let n=null===(r=e.byobRequest)||void 0===r?void 0:r.view;return this.slice(t,(null==n?void 0:n.byteLength)?t+n.byteLength:void 0).arrayBuffer().then(function(r){var o;let s=new Uint8Array(r),i=s.byteLength;t+=i,n.set(s),null===(o=e.byobRequest)||void 0===o||o.respond(i),t>=this.size&&e.close()}.bind(this))}.bind(this)})}catch(r){return new e({pull:function(e){return this.slice(t,t+524288).arrayBuffer().then(function(r){t+=r.byteLength;let n=new Uint8Array(r);e.enqueue(n),t==this.size&&e.close()}.bind(this))}.bind(this)})}}text(){return ee(this).promise.then(e=>Y(e))}toString(){return"[object Blob]"}get[t](){return"Blob"}get __MPHTTPX__(){return{chain:["Blob"]}}}class Z{constructor(e){this.size=0,this.type="",this.promise=e}}function ee(e){return e.__Blob__}function te(e){return b(e)?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function re(e){let t=""+(void 0!==e?e:"");return/[^\u0020-\u007E]/.test(t)?"":t.toLowerCase()}function ne(e){let t=te(e),r=new Uint8Array(new ArrayBuffer(t.byteLength));return r.set(t),r}function oe(e,t=!1){return a("Blob",e,t)||function(e,t=!1){let r=["[object Blob]"];t||r.push("[object File]");return(r.indexOf(Object.prototype.toString.call(e))>-1||r.indexOf(String(e))>-1)&&"size"in e&&"number"==typeof e.size&&"arrayBuffer"in e&&"function"==typeof e.arrayBuffer}(e,t)}const se=function(){try{return 2===new Blob(["ä"]).size}catch(e){return!1}}()?Blob:Q;function ie(e){class r extends e{constructor(e,t,r){u(arguments.length,2,"File"),super(e,r),s(this,"__File__",new ae),le(this).lastModified=+((null==r?void 0:r.lastModified)?new Date(r.lastModified):new Date)||0,le(this).name=""+t}get lastModified(){return le(this).lastModified}get name(){return le(this).name}get webkitRelativePath(){return""}toString(){return"[object File]"}get[t](){return"File"}}return Object.is(e,Q)&&Object.defineProperty(r.prototype,"__MPHTTPX__",{configurable:!0,get:function(){return{chain:["File","Blob"]}}}),r}class ae{constructor(){this.lastModified=0,this.name=""}}function le(e){return e.__File__}const ue=ie(Q),ce=function(){try{return new File([],""),!0}catch(e){return!1}}()?File:Object.is(se,Q)?ue:ie(se),he=["loaded","total"];class de extends m{constructor(e,t){var r,n;super(e,t),s(this,"__ProgressEvent__",new pe);const o=fe(this);o.lengthComputable=!!(null==t?void 0:t.lengthComputable),o.loaded=Number(null!==(r=null==t?void 0:t.loaded)&&void 0!==r?r:0),o.total=Number(null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0);for(let e=0;e<he.length;++e){let t=he[e];if(isNaN(this[t]))throw new TypeError(`Failed to construct 'ProgressEvent': Failed to read the '${t}' property from 'ProgressEventInit': The provided double value is non-finite.`)}}get lengthComputable(){return fe(this).lengthComputable}get loaded(){return fe(this).loaded}get total(){return fe(this).total}toString(){return"[object ProgressEvent]"}get[t](){return"ProgressEvent"}get __MPHTTPX__(){return{chain:["ProgressEvent","Event"]}}}class pe{constructor(){this.lengthComputable=!1,this.loaded=0,this.total=0}}function fe(e){return e.__ProgressEvent__}function ye(e,t,r=0,n=0){let o=new de(t,{lengthComputable:n>0,loaded:r,total:n});o.__Event__.target=e,P(o,!0),B(e,o)}class ge extends R{static get EMPTY(){return 0}static get LOADING(){return 1}static get DONE(){return 2}constructor(){super(),s(this,"__FileReader__",new be(this))}get EMPTY(){return 0}get LOADING(){return 1}get DONE(){return 2}get error(){return _e(this).error}get readyState(){return _e(this).readyState}get result(){return _e(this).result}abort(){2===_e(this).pos&&function(e){let t=_e(e);t.pos=5,t.error=new n("An ongoing operation was aborted, typically with a call to abort().","AbortError"),t.result=null,t.readyState=2,ye(e,"abort"),we(e)}(this)}readAsArrayBuffer(e){me(this,"readAsArrayBuffer",arguments.length,e),ve(this,e.size,()=>e.arrayBuffer())}readAsBinaryString(e){me(this,"readAsBinaryString",arguments.length,e),ve(this,e.size,()=>e.arrayBuffer().then(e=>{let t=[],r=new Uint8Array(e);for(let e=0;e<r.length;++e)t.push(String.fromCharCode(r[e]));return t.join("")}))}readAsDataURL(e){me(this,"readAsDataURL",arguments.length,e),ve(this,e.size,()=>e.arrayBuffer().then(t=>"data:"+(e.type||"application/octet-stream")+";base64,"+function(e){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r=[];for(var n=0;n<e.length;n+=3){let o=e[n],s=n+1<e.length,i=s?e[n+1]:0,a=n+2<e.length,l=a?e[n+2]:0,u=o>>2,c=(3&o)<<4|i>>4,h=(15&i)<<2|l>>6,d=63&l;a||(d=64,s||(h=64)),r.push(t[u],t[c],t[h],t[d])}return r.join("")}(new Uint8Array(t))))}readAsText(e,t){if(me(this,"readAsText",arguments.length,e),"function"==typeof TextDecoder){let r=new TextDecoder(t);ve(this,e.size,()=>e.arrayBuffer().then(e=>r.decode(e)))}else{if(void 0!==t){let e=""+t;-1===["utf-8","utf8","unicode-1-1-utf-8"].indexOf(e.toLowerCase())&&console.warn(`Ignoring the execution of 'readAsText' on 'FileReader': encoding ('${e}') not implemented.`)}ve(this,e.size,()=>e.text())}}get onabort(){return _e(this).onabort}set onabort(e){_e(this).onabort=e,_e(this).attach("abort")}get onerror(){return _e(this).onerror}set onerror(e){_e(this).onerror=e,_e(this).attach("error")}get onload(){return _e(this).onload}set onload(e){_e(this).onload=e,_e(this).attach("load")}get onloadend(){return _e(this).onloadend}set onloadend(e){_e(this).onloadend=e,_e(this).attach("loadend")}get onloadstart(){return _e(this).onloadstart}set onloadstart(e){_e(this).onloadstart=e,_e(this).attach("loadstart")}get onprogress(){return _e(this).onprogress}set onprogress(e){_e(this).onprogress=e,_e(this).attach("progress")}toString(){return"[object FileReader]"}get[t](){return"FileReader"}get __MPHTTPX__(){return{chain:["FileReader","EventTarget"]}}}class be{constructor(e){var t;this.pos=0,this.readyState=0,this.result=null,this.error=null,this.onabort=null,this.onerror=null,this.onload=null,this.onloadend=null,this.onloadstart=null,this.onprogress=null,this.attach=j(e,(t=e,{onabort:e=>{C(t,t.onabort,e)},onerror:e=>{C(t,t.onerror,e)},onload:e=>{C(t,t.onload,e)},onloadend:e=>{C(t,t.onloadend,e)},onloadstart:e=>{C(t,t.onloadstart,e)},onprogress:e=>{C(t,t.onprogress,e)}}))}}function _e(e){return e.__FileReader__}function me(e,t,r,o){if(u(r,1,"FileReader",t),!oe(o))throw new TypeError("Failed to execute '"+t+"' on 'FileReader': parameter 1 is not of type 'Blob'.");if(1===e.readyState)throw new n(`Failed to execute '${t}' on 'FileReader': The object is already busy reading Blobs.`,"InvalidStateError")}function ve(e,t,r){!function(e,t,r){let n=_e(e);n.pos=1,n.error=null,n.result=null;const o=()=>(ye(e,"loadstart",0,t),r());(function(e,t,r){let n=_e(e);n.pos=2,n.readyState=1,Promise.resolve().then(()=>{if(2===n.pos)return r().then(r=>function(e,t,r){let n=_e(e);if(2!==n.pos)return;n.pos=3,n.result=r,n.readyState=2,function(e,t){_e(e).pos=4,ye(e,"load",t,t),we(e,t)}(e,t)}(e,t,r)).catch(t=>function(e,t){let r=_e(e);if(2!==r.pos)return;r.pos=6,r.error=t,r.result=null,r.readyState=2,ye(e,"error"),we(e)}(e,t))})})(e,t,o)}(e,t,r)}function we(e,t=0){_e(e).pos=7,ye(e,"loadend",t,t)}const Te="undefined"!=typeof FileReader&&FileReader||ge;class Ee{constructor(e){if(s(this,"__URLSearchParams__",new Pe),void 0!==e)if(Be(e))e.forEach((e,t)=>{this.append(t,e)},this);else if(e&&"object"==typeof e)if(l(e)){let t=Array.isArray(e)?e:Array.from(e);for(let e=0;e<t.length;++e){let r=t[e];if(!l(r))throw new TypeError("Failed to construct 'URLSearchParams': The provided value cannot be converted to a sequence.");{let e=Array.isArray(r)?r:Array.from(r);if(2!==e.length)throw new TypeError("Failed to construct 'URLSearchParams': Sequence initializer must only contain pair elements");this.append(e[0],e[1])}}}else Object.getOwnPropertyNames(e).forEach(t=>{this.append(t,e[t])},this);else{let t=""+e;0===t.indexOf("?")&&(t=t.slice(1));let r=t.split("&");for(let e=0;e<r.length;++e){let t=r[e],n=t.indexOf("=");n>-1?this.append(Fe(t.slice(0,n)),Fe(t.slice(n+1))):t&&this.append(Fe(t),"")}}}get size(){return Se(this).array.length}append(e,t){Re(arguments.length,2,"append"),Se(this).array.push([""+e,Ae(t)])}delete(e,t){Re(arguments.length,1,"delete");let r=""+e,n=-1,o=Se(this).array,s=[];for(let e=0;e<o.length;++e){let i=o[e];i[0]!==r?s.push(i):(1!==arguments.length&&i[1]!==Ae(t)&&s.push(i),n=e)}n>-1&&(Se(this).array=s)}get(e){Re(arguments.length,1,"get");let t=""+e,r=Se(this).array;for(let e=0;e<r.length;++e){let n=r[e];if(n[0]===t)return n[1]}return null}getAll(e){Re(arguments.length,1,"getAll");let t=""+e,r=Se(this).array,n=[];for(let e=0;e<r.length;++e){let o=r[e];o[0]===t&&n.push(o[1])}return n}has(e,t){Re(arguments.length,1,"has");let r=""+e,n=Se(this).array;for(let e=0;e<n.length;++e){let o=n[e];if(o[0]===r){if(1===arguments.length)return!0;if(o[1]===Ae(t))return!0}}return!1}set(e,t){Re(arguments.length,2,"set");let r=""+e,n=Ae(t),o=-1,s=Se(this).array,i=[];for(let e=0;e<s.length;++e){let t=s[e];t[0]!==r?i.push(t):-1===o&&(o=e,i.push([r,n]))}-1===o&&i.push([r,n]),Se(this).array=i}sort(){Se(this).array.sort((e,t)=>e[0]<t[0]?-1:e[0]>t[0]?1:0)}forEach(e,t){if(Re(arguments.length,1,"forEach"),"function"!=typeof e)throw new TypeError("Failed to execute 'forEach' on 'URLSearchParams': parameter 1 is not of type 'Function'.");let r=Se(this).array;for(let n=0;n<r.length;++n){let o=r[n];e.call(t,o[1],o[0],this)}}entries(){return Se(this).array.map(e=>[e[0],e[1]]).values()}keys(){return Se(this).array.map(e=>e[0]).values()}values(){return Se(this).array.map(e=>e[1]).values()}[e](){return this.entries()}toString(){let e=Se(this).array,t=[];for(let r=0;r<e.length;++r){let n=e[r];t.push(xe(n[0])+"="+xe(n[1]))}return t.join("&")}get[t](){return"URLSearchParams"}get __MPHTTPX__(){return{chain:["URLSearchParams"]}}}class Pe{constructor(){this.array=[]}}function Se(e){return e.__URLSearchParams__}function Re(e,t,r){u(e,t,"URLSearchParams",r)}function Ae(e){return"string"==typeof e?e:null!=e&&"function"==typeof e.toString?e.toString():JSON.stringify(e)}function xe(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'\(\)~]|%20|%00/g,e=>t[e])}function Fe(e){return e.replace(/[ +]/g,"%20").replace(/(%[a-f0-9]{2})+/gi,e=>decodeURIComponent(e))}function Be(e){return a("URLSearchParams",e)||function(e){return i("URLSearchParams",e)||!!e&&"object"==typeof e&&"undefined"!=typeof URLSearchParams&&URLSearchParams&&URLSearchParams.prototype.isPrototypeOf(e)}(e)}const je="undefined"!=typeof URLSearchParams&&URLSearchParams||Ee;class Ce{constructor(e,t){if(s(this,"__FormData__",new Le),void 0!==e)try{let t=e.elements;for(let e=0;e<t.length;++e){let r=t[e];if(!r.name||r.disabled||"submit"===r.type||"button"===r.type||r.matches("form fieldset[disabled] *"))return;if("file"===r.type){let e=r.files&&r.files.length?r.files:[new ce([],"",{type:"application/octet-stream"})];for(let t=0;t<e.length;++t)this.append(r.name,e[t])}else if("select-multiple"===r.type||"select-one"===r.type)for(let e=0;e<r.options.length;++e){let t=r.options[e];!t.disabled&&t.selected&&this.append(r.name,t.value)}else if("checkbox"===r.type||"radio"===r.type)r.checked&&this.append(r.name,r.value);else{let e="textarea"===r.type?Me(r.value):r.value;this.append(r.name,e)}}}catch(e){throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}null!=t&&console.warn("Ignoring the 'submitter' of 'FormData' constructor: parameter 2 not implemented.")}append(e,t,r){Oe(arguments.length,2,"append"),He(this).array.push(qe(e,t,r))}delete(e){Oe(arguments.length,1,"delete");let t=""+e,r=-1,n=He(this).array,o=[];for(let e=0;e<n.length;++e){let s=n[e];s[0]!==t?o.push(s):r=e}r>-1&&(He(this).array=o)}get(e){Oe(arguments.length,1,"get");let t=""+e,r=He(this).array;for(let e=0;e<r.length;++e){let n=r[e];if(n[0]===t)return n[1]}return null}getAll(e){Oe(arguments.length,1,"getAll");let t=""+e,r=He(this).array,n=[];for(let e=0;e<r.length;++e){let o=r[e];o[0]===t&&n.push(o[1])}return n}has(e){Oe(arguments.length,1,"has");let t=""+e,r=He(this).array;for(let e=0;e<r.length;++e){if(r[e][0]===t)return!0}return!1}set(e,t,r){Oe(arguments.length,2,"set");let n=""+e,o=qe(e,t,r),s=-1,i=He(this).array,a=[];for(let e=0;e<i.length;++e){let t=i[e];t[0]!==n?a.push(t):-1===s&&(s=e,a.push(o))}-1===s&&a.push(o),He(this).array=a}forEach(e,t){if(Oe(arguments.length,1,"forEach"),"function"!=typeof e)throw new TypeError("Failed to execute 'forEach' on 'FormData': parameter 1 is not of type 'Function'.");let r=He(this).array;for(let n=0;n<r.length;++n){let o=r[n];e.call(t,o[1],o[0],t)}}entries(){return He(this).array.map(e=>[e[0],e[1]]).values()}keys(){return He(this).array.map(e=>e[0]).values()}values(){return He(this).array.map(e=>e[1]).values()}[e](){return this.entries()}toString(){return"[object FormData]"}get[t](){return"FormData"}get __MPHTTPX__(){return{chain:["FormData"]}}}class Le{constructor(){this.array=[]}}function He(e){return e.__FormData__}function Oe(e,t,r){return u(e,t,"FormData",r)}function qe(e,t,r){if(oe(t)){if(r=void 0!==r?""+r:"string"==typeof t.name?t.name:"blob",t.name!==r||oe(t,!0)){t=new(a("Blob",t)?ue:ce)([t],r)}return[""+e,t]}return[""+e,""+t]}function De(e){return a("FormData",e)||function(e){let t="[object FormData]";return(Object.prototype.toString.call(e)===t||String(e)===t)&&"forEach"in e&&"function"==typeof e.forEach}(e)}function Ue(e,t){const r=t||"----formdata-mphttpx-"+Math.random(),n=`--${r}\r\nContent-Disposition: form-data; name="`;let o=[],s=!0;return e.forEach((e,t)=>{"string"==typeof e?o.push(n+Xe(Me(t))+`"\r\n\r\n${Me(e)}\r\n`):(s&&a("Blob",e)&&(s=!1),o.push(n+Xe(Me(t))+`"; filename="${Xe(e.name)}"\r\nContent-Type: ${e.type||"application/octet-stream"}\r\n\r\n`,e,"\r\n"))}),o.push(`--${r}--`),new(s?se:Q)(o,{type:"multipart/form-data; boundary="+r})}function Me(e){return e.replace(/\r?\n|\r/g,"\r\n")}function Xe(e){return e.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22")}function Ne(e){if(!e)return;if(!/multipart\/form-data/i.test(e))return;let t=e.match(/boundary\s*=\s*([^;]+)/i);if(t&&t[1]){return t[1].trim().replace(/^["']|["']$/g,"")}}const $e="undefined"!=typeof FormData&&FormData||Ce;class Ie{constructor(e,t){if(this._type="",t&&(this.type=t),"string"==typeof e)this.promise=Promise.resolve(e),this.type="text/plain;charset=UTF-8",this.calcLength=()=>W(e).length;else if(Be(e)){let t=e.toString();this.promise=Promise.resolve(t),this.type="application/x-www-form-urlencoded;charset=UTF-8",this.calcLength=()=>W(t).length}else if(b(e))this.promise=Promise.resolve(e.slice(0)),this.length=e.byteLength;else if(ArrayBuffer.isView(e)){let t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);this.promise=Promise.resolve(t),this.length=t.byteLength}else if(oe(e))this.promise=e.arrayBuffer(),this.type=e.type,this.length=e.size;else if(De(e)){let r=Ue(e,t?Ne(t):void 0);this.promise=r.arrayBuffer(),this.type=r.type,this.length=r.size}else if(null==e)this.promise=Promise.resolve(""),this.length=0;else{let t=""+e;this.promise=Promise.resolve(t),this.type="text/plain;charset=UTF-8",this.calcLength=()=>W(t).length}}get type(){return this._type}set type(e){this._type||(this._type=e)}get size(){var e;return"number"!=typeof this.length&&this.calcLength&&(this.length=this.calcLength()),null!==(e=this.length)&&void 0!==e?e:0}text(){return this.promise.then(e=>"string"==typeof e?e:Y(e))}arrayBuffer(){return this.promise.then(e=>b(e)?e:W(e).buffer)}}class ke{constructor(){if(new.target===ke)throw new TypeError("Failed to construct 'Body': Illegal constructor");s(this,"__Body__",new ze)}get bodyUsed(){return Ge(this).bodyUsed}get body(){throw new TypeError(`Failed to access 'body' on '${o(this)}': property not implemented.`)}arrayBuffer(){const e="arrayBuffer";return Ye(this,e)||We(this,e)}blob(){const e="blob";return Ye(this,e)||We(this,e)}bytes(){const e="bytes";return Ye(this,e)||We(this,e)}formData(){const e="formData";return Ye(this,e)||We(this,e)}json(){const e="json";return Ye(this,e)||We(this,e)}text(){const e="text";return Ye(this,e)||We(this,e)}toString(){return"[object Body]"}get[t](){return"Body"}get __MPHTTPX__(){return{chain:["Body"]}}}class ze{constructor(){this.bodyUsed=!1}}function Ge(e){return e.__Body__}function Ve(e,t){const r=e;if((n=t)&&"object"==typeof n&&"undefined"!=typeof ReadableStream&&ReadableStream&&ReadableStream.prototype.isPrototypeOf(n)||function(e){return(i("ReadableStream",e)||"[object ReadableStream]"===String(e))&&"getReader"in e&&"function"==typeof e.getReader}(t))throw new TypeError(`Failed to construct '${o(r)}': ReadableStream not implemented.`);var n;null!=t&&(Ge(r).payload=new Ie(t))}function We(e,t){let r=Ge(e).payload||new Ie;return"json"===t?r.text().then(e=>JSON.parse(e)):"text"===t?r.text():"arrayBuffer"===t?r.arrayBuffer():"bytes"===t?r.arrayBuffer().then(e=>new Uint8Array(e)):"blob"===t?r.promise.then(e=>new se([e])):"formData"===t?r.text().then(e=>function(e,t){const r=()=>{throw new TypeError("Could not parse content as FormData.")};"string"==typeof e&&""!==e.trim()||r();let n=e.indexOf("\r\n");-1===n&&r();let o=e.substring(2,n).trim();o||r(),void 0!==t&&t!==o&&r();let s=e.split(`--${o}`).filter(e=>{let t=e.trim();return""!==t&&"--"!==t});0===s.length&&r();let i=[],a=!1;s.forEach(e=>{let t=e.indexOf("\r\n\r\n");-1===t&&r();let n=e.substring(0,t).trim(),o=n.match(/name="([^"]*)"/);(!o||o.length<2)&&r();let s=o[1],l=n.match(/filename="([^"]*)"/),u=e.substring(t+4);if(l){let e=l[1]||"",t=n.match(/Content-Type: ([^\r\n]+)/),r=t?(t[1]||"").trim():"text/plain",o=u.replace(/\r\n/g,"");a=!0,i.push([s,new ce([o],e,{type:r})])}else i.push([s,u.replace(/^[\r\n]+|[\r\n]+$/g,"")])});let l=new(!a||(()=>{try{let e=new $e;return e.append("file",new ce([],"")),"string"!=typeof e.get("file")}catch(e){return!1}})()?$e:Ce);return i.forEach(e=>{l.append(e[0],e[1])}),l}(e,Ne(r.type))):r.promise}function Ye(e,t){if(Ge(e).payload){if(e.bodyUsed)return Promise.reject(new TypeError(`Failed to execute '${t}' on '${o(e)}': body stream already read`));Ge(e).bodyUsed=!0}}class Je{constructor(e){if(s(this,"__Headers__",new Ke),void 0!==e)if(rt(e))e.forEach((e,t)=>{Ze(this,t,e,"")},this);else if(l(e)){let t=Array.isArray(e)?e:Array.from(e);for(let e=0;e<t.length;++e){let r=t[e];if(!l(r))throw new TypeError("Failed to construct 'Headers': The provided value cannot be converted to a sequence.");{let e=Array.isArray(r)?r:Array.from(r);if(2!==e.length)throw new TypeError("Failed to construct 'Headers': Invalid value");Ze(this,e[0],e[1])}}}else{if(!e||"object"!=typeof e)throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(record<ByteString, ByteString> or sequence<sequence<ByteString>>)'.");Object.getOwnPropertyNames(e).forEach(t=>{Ze(this,t,e[t])},this)}}append(e,t){tt(arguments.length,2,"append"),Ze(this,e,t,"append")}delete(e){tt(arguments.length,1,"delete"),delete Qe(this).dict[nt(e,et("delete"))]}get(e){var t;return tt(arguments.length,1,"get"),null!==(t=Qe(this).dict[nt(e,et("get"))])&&void 0!==t?t:null}getSetCookie(){let e=this.get("Set-Cookie");return e?e.split(", "):[]}has(e){return tt(arguments.length,1,"has"),Qe(this).dict.hasOwnProperty(nt(e,et("has")))}set(e,t){tt(arguments.length,2,"set"),Qe(this).dict[nt(e,et("set"))]=ot(t)}forEach(e,t){if(tt(arguments.length,1,"forEach"),"function"!=typeof e)throw new TypeError("Failed to execute 'forEach' on 'Headers': parameter 1 is not of type 'Function'.");let r=Qe(this).dict,n=Object.getOwnPropertyNames(r);for(let o=0;o<n.length;++o){let s=n[o];e.call(t,r[s],s,this)}}entries(){let e=[];return this.forEach((t,r)=>{e.push([r,t])}),e.values()}keys(){let e=[];return this.forEach((t,r)=>{e.push([r,t])}),e.map(e=>e[0]).values()}values(){let e=[];return this.forEach((t,r)=>{e.push([r,t])}),e.map(e=>e[1]).values()}[e](){return this.entries()}toString(){return"[object Headers]"}get[t](){return"Headers"}get __MPHTTPX__(){return{chain:["Headers"]}}}class Ke{constructor(){this.dict={}}}function Qe(e){return e.__Headers__}function Ze(e,t,r,n="constructor"){let o=nt(t,n?et(n):void 0),s=ot(r),i=Qe(e).dict,a=i[o];i[o]=void 0!==a?`${a}, ${s}`:s}function et(e){return()=>{throw new TypeError(`Failed to ${e&&"constructor"!==e?"execute '"+e+"' on":"construct"} 'Headers': Invalid name`)}}function tt(e,t,r){u(e,t,"Headers",r)}function rt(e){return a("Headers",e)||function(e){let t="[object Headers]";return(Object.prototype.toString.call(e)===t||String(e)===t)&&"forEach"in e&&"function"==typeof e.forEach}(e)}function nt(e,t){return"string"!=typeof e&&(e=""+e),t&&(/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)&&t(),e.toLowerCase()}function ot(e){return"string"==typeof e?e:""+e}function st(e){let t=new at;return e.replace(/\r?\n[\t ]+/g," ").split("\r").map(e=>0===e.indexOf("\n")?e.substring(1,e.length):e).forEach(e=>{let r=e.split(":"),n=r.shift().trim();if(n){let e=r.join(":").trim();try{t.append(n,e)}catch(e){console.warn(`SyntaxError: Response.headers: '${n}' is not a valid HTTP header field name.`)}}}),t}function it(e){if(a("Headers",e)&&!Object.is(at,Je)){let t=new at;return e.forEach((e,r)=>{t.append(r,e)}),t}return new at(e)}const at="undefined"!=typeof Headers&&Headers||Je;class lt extends ke{constructor(e,t){u(arguments.length,1,"Request"),super(),s(this,"__Request__",new ut);const r=ct(this);let n=null!=t?t:{};if("object"!=typeof n)throw new TypeError("Failed to construct 'Request': The provided value is not of type 'RequestInit'.");let o=n.body,i=!1;if(a("Request",l=e)||function(e){let t="[object Request]";return(Object.prototype.toString.call(e)===t||String(e)===t)&&"arrayBuffer"in e&&"function"==typeof e.arrayBuffer}(l)){if(e.bodyUsed)throw new TypeError("Failed to construct 'Request': Cannot construct a Request with a Request object that has already been used.");r.cache=e.cache,r.credentials=e.credentials,void 0===n.headers&&(ct(this).headers=it(e.headers)),r.method=e.method,r.mode=e.mode,r.signal=e.signal,r.url=e.url,o||(this.__Body__.payload=function(e){let t=Object.create(Ie.prototype);t.type=e.headers.get("Content-Type")||"";try{t.promise=e.arrayBuffer()}catch(r){try{t.promise=e.text()}catch(r){if("multipart/form-data"===t.type.slice(0,19).toLowerCase())try{t.promise=e.formData().then(e=>new Ie(e,t.type).promise)}catch(e){}}}if(!t.promise)throw new TypeError("Failed to construct 'Request': Failed to read request body data, underlying data is in an invalid format.");return t}(e),i=!0)}else r.url=""+e;var l;if(n.cache&&(r.cache=n.cache),n.credentials&&(r.credentials=n.credentials),void 0!==n.headers&&(ct(this).headers=it(n.headers)),n.method&&(r.method=function(e){let t=e.toUpperCase();return ht.indexOf(t)>-1?t:e}(n.method)),n.mode&&(r.mode=n.mode),null!==n.signal&&void 0!==n.signal){if(!L(n.signal))throw new TypeError("Failed to construct 'Request': Failed to read the 'signal' property from 'RequestInit': Failed to convert value to 'AbortSignal'.");r.signal=n.signal}if(("GET"===this.method||"HEAD"===this.method)&&null!=o)throw new TypeError("Failed to construct 'Request': Request with GET/HEAD method cannot have body.");Ve(this,i?null:o);let c=this.__Body__.payload;!this.headers.has("Content-Type")&&c&&c.type&&this.headers.set("Content-Type",c.type),"GET"!==this.method&&"HEAD"!==this.method||"no-cache"!==this.cache&&"no-store"!==this.cache||function(e){let t=/([?&])_=[^&]*/;if(t.test(e.url))ct(e).url=e.url.replace(t,"$1_="+(new Date).getTime());else{let t=/\?/;ct(e).url+=(t.test(e.url)?"&":"?")+"_="+(new Date).getTime()}}(this)}get cache(){return ct(this).cache}get credentials(){return ct(this).credentials}get destination(){return""}get headers(){return ct(this).headers||(ct(this).headers=new at),ct(this).headers}get integrity(){return""}get keepalive(){return!1}get method(){return ct(this).method}get mode(){return ct(this).mode}get redirect(){return"follow"}get referrer(){return ct(this).referrer}get referrerPolicy(){return""}get signal(){return ct(this).signal||(ct(this).signal=(new V).signal),ct(this).signal}get url(){return ct(this).url}clone(){if(this.bodyUsed)throw new TypeError("Failed to execute 'clone' on 'Request': Request body is already used");{let e=new lt(this);return this.__Body__.bodyUsed=!1,e}}toString(){return"[object Request]"}get[t](){return"Request"}get __MPHTTPX__(){return{chain:["Request","Body"]}}}class ut{constructor(){this.cache="default",this.credentials="same-origin",this.method="GET",this.mode="cors",this.referrer="about:client",this.url=""}}function ct(e){return e.__Request__}const ht=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];const dt="undefined"!=typeof Request&&Request||lt;class pt extends ke{static json(e,t){u(arguments.length,1,"Response","json");let r=new pt("string"==typeof e?e:JSON.stringify(e),t);return r.headers.set("Content-Type","application/json"),r}static error(){let e=new pt(null,{status:200,statusText:""});return yt(e).status=0,yt(e).type="error",e}static redirect(e,t=302){if(u(arguments.length,1,"Response","redirect"),-1===[301,302,303,307,308].indexOf(t))throw new RangeError("Failed to execute 'redirect' on 'Response': Invalid status code");return new pt(null,{status:t,headers:{location:""+e}})}constructor(e,t){super(),s(this,"__Response__",new ft);const r=yt(this);let n=null!=t?t:{};if("object"!=typeof n)throw new TypeError("Failed to construct 'Response': The provided value is not of type 'ResponseInit'.");void 0!==n.headers&&(yt(this).headers=it(n.headers));let o=void 0===n.status?200:n.status;if(o<200||o>599)throw new RangeError(`Failed to construct 'Response': The status provided (${+o}) is outside the range [200, 599].`);r.status=o,r.statusText=void 0===n.statusText?"":""+n.statusText,Ve(this,e);let i=this.__Body__.payload;!this.headers.has("Content-Type")&&i&&i.type&&this.headers.set("Content-Type",i.type)}get headers(){return yt(this).headers||(yt(this).headers=new at),yt(this).headers}get ok(){return this.status>=200&&this.status<300}get redirected(){return!1}get status(){return yt(this).status}get statusText(){return yt(this).statusText}get type(){return yt(this).type}get url(){return yt(this).url}clone(){if(this.bodyUsed)throw new TypeError("Failed to execute 'clone' on 'Response': Response body is already used");let e=new pt(null,{headers:it(this.headers),status:this.status,statusText:this.statusText});return yt(e).url=this.url,e.__Body__.payload=this.__Body__.payload,e}toString(){return"[object Response]"}get[t](){return"Response"}get __MPHTTPX__(){return{chain:["Response","Body"]}}}class ft{constructor(){this.status=200,this.statusText="",this.type="default",this.url=""}}function yt(e){return e.__Response__}const gt="undefined"!=typeof Response&&Response||pt,bt={XMLHttpRequest:"undefined"!=typeof XMLHttpRequest&&XMLHttpRequest||void 0};function _t(e){bt.XMLHttpRequest=e}function mt(e,t){if(u(arguments.length,1,"Window","fetch"),new.target===mt)throw new TypeError("fetch is not a constructor");return new Promise((r,o)=>{const s=new lt(e,t),i=s.__Request__.signal;if(i&&i.aborted)return o(i.reason);let a,l=new(bt.XMLHttpRequest||(()=>{throw new ReferenceError("XMLHttpRequest is not defined")})()),u=!1,c=s.__Body__.payload;if(l.onload=()=>{let e={headers:st(l.getAllResponseHeaders()||""),status:l.status,statusText:l.statusText};0===s.url.indexOf("file://")&&(l.status<200||l.status>599)&&(e.status=200),setTimeout(()=>{a=new pt("response"in l?l.response:l.responseText,e),a.__Response__.url="responseURL"in l?l.responseURL:e.headers.get("X-Request-URL")||"";let t=a.__Body__.payload,n=a.headers.get("Content-Type")||"";t&&n&&(t.type=n),u?o(vt()):r(a)})},l.onabort=()=>{setTimeout(()=>{o(vt())})},l.onerror=()=>{setTimeout(()=>{o(new TypeError("Failed to fetch"))})},l.ontimeout=()=>{setTimeout(()=>{o(new n("The request timed out.","TimeoutError"))})},l.open(s.method,Tt(s.url),!0),"include"===s.credentials?l.withCredentials=!0:"omit"===s.credentials&&(l.withCredentials=!1),"responseType"in l&&(l.responseType="arraybuffer"),t&&"object"==typeof t&&t.headers&&"object"==typeof t.headers&&!rt(t.headers)){let e=t.headers,r=[];Object.getOwnPropertyNames(e).forEach(t=>{r.push(nt(t)),l.setRequestHeader(t,ot(e[t]))}),s.headers.forEach((e,t)=>{-1===r.indexOf(t)&&l.setRequestHeader(t,e)})}else s.headers.forEach((e,t)=>{l.setRequestHeader(t,e)});if(i){const e=()=>{if(a&&!a.bodyUsed){(a.__Body__.payload=new Ie).promise=Promise.reject(vt())}u=!0,l.abort(),t()},t=()=>{i.removeEventListener("abort",e)};i.addEventListener("abort",e),l.onreadystatechange=()=>{4===l.readyState&&t()}}c?c.promise.then(e=>{u?o(vt()):l.send(""!==e?e:void 0)}).catch(e=>{console.error(e),o(new TypeError("Failed to fetch"))}):l.send()})}function vt(){return new n("The user aborted a request.","AbortError")}const wt="undefined"!=typeof location&&!!location,Tt=e=>""===e&&wt&&(null===location||void 0===location?void 0:location.href)?location.href:e,Et="undefined"!=typeof fetch&&fetch||mt;function Pt(e){const t=e||"undefined"!=typeof fetch&&fetch;if(!t||t===mt)return mt;if("__MPHTTPX__Polyfill__"in t)return t;function r(e,t){if(e.headers){if((r=e.headers)&&"object"==typeof r&&"has"in r&&"function"==typeof r.has&&"set"in r&&"function"==typeof r.set)e.headers.has("Content-Type")||e.headers.set("Content-Type",t);else if(l(e.headers)){let r=!1,n=Array.isArray(e.headers)?e.headers:Array.from(e.headers);for(let e=0;e<n.length;++e){let t=n[e];if(l(t)){let e=Array.isArray(t)?t:Array.from(t);if(e.length>=2&&"content-type"===String(e[0]).toLowerCase()){r=!0;break}}}r||(n.push(["Content-Type",t]),e.headers=n)}else if("object"==typeof e.headers){let r=!1,n=Object.getOwnPropertyNames(e.headers);for(let e=0;e<n.length;++e){if("content-type"===n[e].toLowerCase()){r=!0;break}}r||(e.headers["Content-Type"]=t)}}else e.headers={"Content-Type":t};var r}function o(e,o){if(a("Request",e))return mt(e,o);if(o&&o.headers&&a("Headers",o.headers))if("undefined"!=typeof Headers&&Headers&&!("__MPHTTPX__"in Headers.prototype)){let e=new Headers;o.headers.forEach((t,r)=>{e.append(r,t)}),o.headers=e}else{let e={};o.headers.forEach((t,r)=>{e[r]=t}),o.headers=e}return new Promise((s,i)=>{if(o&&o.body&&a("FormData",o.body)&&(o.body=Ue(o.body)),o&&o.body&&a("Blob",o.body)){let a=new Ie(o.body);a.type&&r(o,a.type);let l=null,u=!1,c=!0;if(e&&"object"==typeof e&&"signal"in e&&L(e.signal)){let t=()=>{c&&(u=!0),l()};l=()=>{e.signal.removeEventListener("abort",t)},e.signal.addEventListener("abort",t)}a.promise.then(r=>{o.body=""!==r?r:null,u?i(new n("The user aborted a request.","AbortError")):s(t(e,o)),c=!1}).catch(e=>{i(new TypeError("Failed to fetch")),console.error(e),c=!1}).then(()=>{l&&l()})}else o&&o.body&&a("URLSearchParams",o.body)&&r(o,"application/x-www-form-urlencoded;charset=UTF-8"),s(t(e,o))})}return o.__MPHTTPX__Polyfill__=!0,o}function St(e){const t=e||"undefined"!=typeof XMLHttpRequest&&XMLHttpRequest;if(!t||"__MPHTTPX__Polyfill__"in t||"__MPHTTPX__"in t.prototype)return;const r=t.prototype.abort,o=t.prototype.open,i=t.prototype.send,l=t.prototype.setRequestHeader;t.prototype.abort=function(){c(this).processing&&(c(this).aborted=!0),r.call(this),c(this).hasContentType=!1},t.prototype.open=function(e,t,r=!0,n=null,s=null){c(this).processing&&(c(this).aborted=!0),o.call(this,e,t,r,n,s),c(this).hasContentType=!1},t.prototype.send=function(e){if(a("FormData",e)&&(e=Ue(e),c(this).hasContentType||this.setRequestHeader("Content-Type",e.type)),a("Blob",e)){let t=new Ie(e);t.type&&!c(this).hasContentType&&this.setRequestHeader("Content-Type",t.type);const r=this.withCredentials;c(this).processing=!0,t.promise.then(function(e){c(this).aborted||(r!==this.withCredentials&&(console.warn("Illegal to set the 'withCredentials' property on 'XMLHttpRequest': The value may only be set if the object's state is UNSENT or OPENED."),this.withCredentials=r),i.call(this,""!==e?e:void 0)),c(this).aborted=!1,c(this).processing=!1}.bind(this)).catch(function(e){console.error(e),c(this).aborted=!1,c(this).processing=!1}.bind(this))}else a("URLSearchParams",e)&&!c(this).hasContentType&&this.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8"),i.call(this,e)},t.prototype.setRequestHeader=function(e,t){if(c(this).processing)throw new n("Failed to execute 'setRequestHeader' on 'XMLHttpRequest': The object's state must be OPENED.","InvalidStateError");l.call(this,e,t),"content-type"===String(e).toLowerCase()&&(c(this).hasContentType=!0)},t.__MPHTTPX__Polyfill__=!0;class u{constructor(){this.aborted=!1,this.processing=!1,this.hasContentType=!1}}function c(e){const t="__XMLHttpRequest_Polyfill__";return t in e||s(e,t,new u),e[t]}}function Rt(e){const t=e||"undefined"!=typeof WebSocket&&WebSocket;if(!t||"__MPHTTPX__Polyfill__"in t||"__MPHTTPX__"in t.prototype)return;const r=t.prototype.send;t.prototype.send=function(e){if(a("Blob",e)){new Ie(e).promise.then(e=>{1===this.readyState&&r.call(this,e)})}else r.call(this,e)},t.__MPHTTPX__Polyfill__=!0}export{V as AbortController,z as AbortControllerP,k as AbortSignal,M as AbortSignalP,se as Blob,Q as BlobP,U as CustomEvent,O as CustomEventP,S as Event,m as EventP,H as EventTarget,R as EventTargetP,ce as File,ue as FileP,Te as FileReader,ge as FileReaderP,$e as FormData,Ce as FormDataP,at as Headers,Je as HeadersP,dt as Request,lt as RequestP,gt as Response,pt as ResponseP,_ as TextDecoder,f as TextDecoderP,d as TextEncoder,c as TextEncoderP,je as URLSearchParams,Ee as URLSearchParamsP,Et as fetch,mt as fetchP,Pt as fixFetch,Rt as fixWebSocket,St as fixXMLHttpRequest,K as setReadableStreamClass,_t as setXMLHttpRequestClass};
@@ -0,0 +1,300 @@
1
+ declare class TextEncoderP implements TextEncoder {
2
+ get encoding(): string;
3
+ encode(input?: string): Uint8Array<ArrayBuffer>;
4
+ encodeInto(source: string, destination: Uint8Array<ArrayBufferLike>): TextEncoderEncodeIntoResult;
5
+ }
6
+ declare const TextEncoderE: {
7
+ new (): TextEncoder;
8
+ prototype: TextEncoder;
9
+ };
10
+
11
+ declare class TextDecoderP implements TextDecoder {
12
+ constructor(label?: string, options?: TextDecoderOptions);
13
+ get encoding(): string;
14
+ get fatal(): boolean;
15
+ get ignoreBOM(): boolean;
16
+ decode(input?: AllowSharedBufferSource, options?: TextDecodeOptions): string;
17
+ }
18
+ declare const TextDecoderE: {
19
+ new (label?: string, options?: TextDecoderOptions): TextDecoder;
20
+ prototype: TextDecoder;
21
+ };
22
+
23
+ declare class EventTargetP implements EventTarget {
24
+ constructor();
25
+ addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
26
+ dispatchEvent(event: Event): boolean;
27
+ removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
28
+ }
29
+ declare const EventTargetE: {
30
+ new (): EventTarget;
31
+ prototype: EventTarget;
32
+ };
33
+
34
+ declare class EventP implements Event {
35
+ static get NONE(): 0;
36
+ static get CAPTURING_PHASE(): 1;
37
+ static get AT_TARGET(): 2;
38
+ static get BUBBLING_PHASE(): 3;
39
+ constructor(type: string, eventInitDict?: EventInit);
40
+ get NONE(): 0;
41
+ get CAPTURING_PHASE(): 1;
42
+ get AT_TARGET(): 2;
43
+ get BUBBLING_PHASE(): 3;
44
+ get bubbles(): boolean;
45
+ get cancelBubble(): boolean;
46
+ set cancelBubble(value: boolean);
47
+ get cancelable(): boolean;
48
+ get composed(): boolean;
49
+ get currentTarget(): EventTarget | null;
50
+ get defaultPrevented(): boolean;
51
+ get eventPhase(): number;
52
+ readonly isTrusted: boolean;
53
+ get returnValue(): boolean;
54
+ set returnValue(value: boolean);
55
+ get srcElement(): EventTarget | null;
56
+ get target(): EventTarget | null;
57
+ get timeStamp(): DOMHighResTimeStamp;
58
+ get type(): string;
59
+ composedPath(): EventTarget[];
60
+ initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
61
+ preventDefault(): void;
62
+ stopImmediatePropagation(): void;
63
+ stopPropagation(): void;
64
+ }
65
+ declare const EventE: {
66
+ new (type: string, eventInitDict?: EventInit): Event;
67
+ prototype: Event;
68
+ readonly NONE: 0;
69
+ readonly CAPTURING_PHASE: 1;
70
+ readonly AT_TARGET: 2;
71
+ readonly BUBBLING_PHASE: 3;
72
+ };
73
+
74
+ declare class CustomEventP<T> extends EventP implements CustomEvent {
75
+ constructor(type: string, eventInitDict?: CustomEventInit<T>);
76
+ get detail(): T;
77
+ initCustomEvent(type: string, bubbles?: boolean, cancelable?: boolean, detail?: T): void;
78
+ }
79
+ declare const CustomEventE: {
80
+ new <T>(type: string, eventInitDict?: CustomEventInit<T>): CustomEvent<T>;
81
+ prototype: CustomEvent;
82
+ };
83
+
84
+ declare class AbortControllerP implements AbortController {
85
+ constructor();
86
+ get signal(): AbortSignal;
87
+ abort(reason?: any): void;
88
+ }
89
+ declare const AbortControllerE: {
90
+ new (): AbortController;
91
+ prototype: AbortController;
92
+ };
93
+
94
+ declare class AbortSignalP extends EventTargetP implements AbortSignal {
95
+ static abort(reason?: any): AbortSignal;
96
+ static any(signals: AbortSignal[]): AbortSignal;
97
+ static timeout(milliseconds: number): AbortSignal;
98
+ get aborted(): boolean;
99
+ get reason(): any;
100
+ throwIfAborted(): void;
101
+ get onabort(): ((this: AbortSignal, ev: Event) => any) | null;
102
+ set onabort(value: ((this: AbortSignal, ev: Event) => any) | null);
103
+ }
104
+ declare const AbortSignalE: {
105
+ new (): AbortSignal;
106
+ prototype: AbortSignal;
107
+ abort(reason?: any): AbortSignal;
108
+ any(signals: AbortSignal[]): AbortSignal;
109
+ timeout(milliseconds: number): AbortSignal;
110
+ };
111
+
112
+ declare function setReadableStreamClass(RSClass: unknown): void;
113
+ declare class BlobP implements Blob {
114
+ constructor(blobParts?: BlobPart[], options?: BlobPropertyBag);
115
+ get size(): number;
116
+ get type(): string;
117
+ arrayBuffer(): Promise<ArrayBuffer>;
118
+ bytes(): Promise<Uint8Array<ArrayBuffer>>;
119
+ slice(start?: number, end?: number, contentType?: string): Blob;
120
+ stream(): ReadableStream<Uint8Array<ArrayBuffer>>;
121
+ text(): Promise<string>;
122
+ }
123
+ declare const BlobE: {
124
+ new (blobParts?: BlobPart[], options?: BlobPropertyBag): Blob;
125
+ prototype: Blob;
126
+ };
127
+
128
+ declare class FileP extends BlobE implements File {
129
+ constructor(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag);
130
+ readonly lastModified: number;
131
+ readonly name: string;
132
+ readonly webkitRelativePath: string;
133
+ }
134
+ declare const FilePolyfill: typeof FileP;
135
+ declare const FileE: {
136
+ new (fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File;
137
+ prototype: File;
138
+ };
139
+
140
+ declare class FileReaderP extends EventTargetP implements FileReader {
141
+ static get EMPTY(): 0;
142
+ static get LOADING(): 1;
143
+ static get DONE(): 2;
144
+ constructor();
145
+ get EMPTY(): 0;
146
+ get LOADING(): 1;
147
+ get DONE(): 2;
148
+ get error(): DOMException | null;
149
+ get readyState(): 0 | 1 | 2;
150
+ get result(): string | ArrayBuffer | null;
151
+ abort(): void;
152
+ readAsArrayBuffer(blob: Blob): void;
153
+ readAsBinaryString(blob: Blob): void;
154
+ readAsDataURL(blob: Blob): void;
155
+ readAsText(blob: Blob, encoding?: string): void;
156
+ get onabort(): ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
157
+ set onabort(value: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null);
158
+ get onerror(): ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
159
+ set onerror(value: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null);
160
+ get onload(): ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
161
+ set onload(value: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null);
162
+ get onloadend(): ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
163
+ set onloadend(value: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null);
164
+ get onloadstart(): ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
165
+ set onloadstart(value: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null);
166
+ get onprogress(): ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
167
+ set onprogress(value: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null);
168
+ }
169
+ declare const FileReaderE: {
170
+ new (): FileReader;
171
+ prototype: FileReader;
172
+ readonly EMPTY: 0;
173
+ readonly LOADING: 1;
174
+ readonly DONE: 2;
175
+ };
176
+
177
+ declare class URLSearchParamsP implements URLSearchParams {
178
+ constructor(init?: string[][] | Record<string, string> | string | URLSearchParams);
179
+ get size(): number;
180
+ append(name: string, value: string): void;
181
+ delete(name: string, value?: string): void;
182
+ get(name: string): string | null;
183
+ getAll(name: string): string[];
184
+ has(name: string, value?: string): boolean;
185
+ set(name: string, value: string): void;
186
+ sort(): void;
187
+ forEach(callbackfn: (value: string, key: string, parent: URLSearchParams) => void, thisArg?: any): void;
188
+ entries(): URLSearchParamsIterator<[string, string]>;
189
+ keys(): URLSearchParamsIterator<string>;
190
+ values(): URLSearchParamsIterator<string>;
191
+ [Symbol.iterator]: () => URLSearchParamsIterator<[string, string]>;
192
+ toString(): string;
193
+ }
194
+ declare const URLSearchParamsE: {
195
+ new (init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
196
+ prototype: URLSearchParams;
197
+ };
198
+
199
+ declare class FormDataP implements FormData {
200
+ constructor(form?: HTMLFormElement, submitter?: HTMLElement | null);
201
+ append(name: string, blobValue: string | Blob, filename?: string): void;
202
+ delete(name: string): void;
203
+ get(name: string): FormDataEntryValue | null;
204
+ getAll(name: string): FormDataEntryValue[];
205
+ has(name: string): boolean;
206
+ set(name: string, blobValue: string | Blob, filename?: string): void;
207
+ forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void;
208
+ entries(): FormDataIterator<[string, FormDataEntryValue]>;
209
+ keys(): FormDataIterator<string>;
210
+ values(): FormDataIterator<FormDataEntryValue>;
211
+ [Symbol.iterator]: () => FormDataIterator<[string, FormDataEntryValue]>;
212
+ }
213
+ declare const FormDataE: {
214
+ new (form?: HTMLFormElement, submitter?: HTMLElement | null): FormData;
215
+ prototype: FormData;
216
+ };
217
+
218
+ declare function setXMLHttpRequestClass(XHRClass: unknown): void;
219
+ declare function fetchP(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
220
+ declare const fetchE: typeof fetch;
221
+
222
+ declare class HeadersP implements Headers {
223
+ constructor(init?: HeadersInit);
224
+ append(name: string, value: string): void;
225
+ delete(name: string): void;
226
+ get(name: string): string | null;
227
+ getSetCookie(): string[];
228
+ has(name: string): boolean;
229
+ set(name: string, value: string): void;
230
+ forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
231
+ entries(): HeadersIterator<[string, string]>;
232
+ keys(): HeadersIterator<string>;
233
+ values(): HeadersIterator<string>;
234
+ [Symbol.iterator]: () => HeadersIterator<[string, string]>;
235
+ }
236
+ declare const HeadersE: {
237
+ new (init?: HeadersInit): Headers;
238
+ prototype: Headers;
239
+ };
240
+
241
+ declare class BodyImpl implements Body {
242
+ get bodyUsed(): boolean;
243
+ get body(): ReadableStream<Uint8Array<ArrayBuffer>> | null;
244
+ arrayBuffer(): Promise<ArrayBuffer>;
245
+ blob(): Promise<Blob>;
246
+ bytes(): Promise<Uint8Array<ArrayBuffer>>;
247
+ formData(): Promise<FormData>;
248
+ json(): Promise<any>;
249
+ text(): Promise<string>;
250
+ }
251
+
252
+ declare class RequestP extends BodyImpl implements Request {
253
+ constructor(input: RequestInfo | URL, init?: RequestInit);
254
+ get cache(): RequestCache;
255
+ get credentials(): RequestCredentials;
256
+ get destination(): RequestDestination;
257
+ get headers(): Headers;
258
+ get integrity(): string;
259
+ get keepalive(): boolean;
260
+ get method(): string;
261
+ get mode(): RequestMode;
262
+ get redirect(): RequestRedirect;
263
+ get referrer(): string;
264
+ get referrerPolicy(): ReferrerPolicy;
265
+ get signal(): AbortSignal;
266
+ get url(): string;
267
+ clone(): Request;
268
+ }
269
+ declare const RequestE: {
270
+ new (input: RequestInfo | URL, init?: RequestInit): Request;
271
+ prototype: Request;
272
+ };
273
+
274
+ declare class ResponseP extends BodyImpl implements Response {
275
+ static json(data: any, init?: ResponseInit): Response;
276
+ static error(): Response;
277
+ static redirect(url: string | URL, status?: number): Response;
278
+ constructor(body?: BodyInit | null, init?: ResponseInit);
279
+ get headers(): Headers;
280
+ get ok(): boolean;
281
+ get redirected(): boolean;
282
+ get status(): number;
283
+ get statusText(): string;
284
+ get type(): ResponseType;
285
+ get url(): string;
286
+ clone(): Response;
287
+ }
288
+ declare const ResponseE: {
289
+ new (body?: BodyInit | null, init?: ResponseInit): Response;
290
+ prototype: Response;
291
+ error(): Response;
292
+ json(data: any, init?: ResponseInit): Response;
293
+ redirect(url: string | URL, status?: number): Response;
294
+ };
295
+
296
+ declare function fixFetch(fetchFunc?: typeof fetch): typeof fetch;
297
+ declare function fixXMLHttpRequest(XHRClass?: typeof XMLHttpRequest): void;
298
+ declare function fixWebSocket(WSClass?: typeof WebSocket): void;
299
+
300
+ export { AbortControllerE as AbortController, AbortControllerP, AbortSignalE as AbortSignal, AbortSignalP, BlobE as Blob, BlobP, CustomEventE as CustomEvent, CustomEventP, EventE as Event, EventP, EventTargetE as EventTarget, EventTargetP, FileE as File, FilePolyfill as FileP, FileReaderE as FileReader, FileReaderP, FormDataE as FormData, FormDataP, HeadersE as Headers, HeadersP, RequestE as Request, RequestP, ResponseE as Response, ResponseP, TextDecoderE as TextDecoder, TextDecoderP, TextEncoderE as TextEncoder, TextEncoderP, URLSearchParamsE as URLSearchParams, URLSearchParamsP, fetchE as fetch, fetchP, fixFetch, fixWebSocket, fixXMLHttpRequest, setReadableStreamClass, setXMLHttpRequestClass };
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "fetch-xhr-shim",
3
+ "version": "0.0.1-beta",
4
+ "license": "MIT",
5
+ "author": "Xingzeng Bao",
6
+ "homepage": "https://github.com/baoxingzeng/fetch-xhr",
7
+ "description": "A globalThis.fetch JavaScript polyfill.",
8
+ "type": "module",
9
+ "main": "dist/cjs/index.js",
10
+ "module": "dist/esm/index.js",
11
+ "types": "dist/index.d.ts",
12
+ "files": [
13
+ "README.md",
14
+ "dist",
15
+ "!dist/types/**/*",
16
+ "!dist/cjs/types/**/*",
17
+ "!dist/esm/types/**/*"
18
+ ],
19
+ "exports": {
20
+ ".": {
21
+ "require": "./dist/cjs/index.js",
22
+ "import": "./dist/esm/index.js",
23
+ "types": "./dist/index.d.ts"
24
+ },
25
+ "./dev": {
26
+ "require": "./dist/cjs/dev.js",
27
+ "import": "./dist/esm/dev.js",
28
+ "types": "./dist/dev.d.ts"
29
+ },
30
+ "./polyfill": {
31
+ "require": "./dist/cjs/polyfill.js",
32
+ "import": "./dist/esm/polyfill.js"
33
+ }
34
+ },
35
+ "sideEffects": [
36
+ "./dist/cjs/polyfill.js",
37
+ "./dist/esm/polyfill.js"
38
+ ],
39
+ "scripts": {
40
+ "build": "rollup --config",
41
+ "test": "node tests/test.js"
42
+ },
43
+ "keywords": [
44
+ "fetch",
45
+ "polyfill"
46
+ ],
47
+ "devDependencies": {
48
+ "@rollup/plugin-terser": "^1.0.0",
49
+ "@rollup/plugin-typescript": "^12.3.0",
50
+ "cors": "^2.8.6",
51
+ "express": "^5.2.1",
52
+ "formidable": "^3.5.4",
53
+ "rollup": "^4.61.0",
54
+ "rollup-plugin-dts": "^6.4.1",
55
+ "tslib": "^2.8.1",
56
+ "uvu": "^0.5.6",
57
+ "xhr2": "^0.2.1"
58
+ }
59
+ }