soonjs 0.0.22 → 0.0.24

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 (40) hide show
  1. package/dist/deps/acorn-4bbswh3l6.js +2895 -0
  2. package/dist/deps/{acorn-tklbyr11e.js → acorn-vpnsvv0vl.js} +10 -10
  3. package/dist/deps/angular-83zjjtd76.js +1448 -0
  4. package/dist/deps/angular-rxw0rdr8c.js +1 -0
  5. package/dist/deps/{babel-48ei1aig4.js → babel-bp403m6zg.js} +10 -10
  6. package/dist/deps/babel-fw6tfzzbf.js +6844 -0
  7. package/dist/deps/{estree-4o5bj9gvd.js → estree-8kj0he6rx.js} +23 -23
  8. package/dist/deps/estree-gg8m4wsex.js +4265 -0
  9. package/dist/deps/flow-6i0s1nbzq.js +26221 -0
  10. package/dist/deps/{flow-xlruu7boa.js → flow-g4yga74xo.js} +15 -15
  11. package/dist/deps/{glimmer-kyfivr6g7.js → glimmer-41uyapmgd.js} +18 -18
  12. package/dist/deps/glimmer-kwpa0i2hl.js +2756 -0
  13. package/dist/deps/graphql-147kg788t.js +1212 -0
  14. package/dist/deps/{graphql-xojtytb2p.js → graphql-k4vvtoaxx.js} +12 -12
  15. package/dist/deps/html-5plv0l5rz.js +2623 -0
  16. package/dist/deps/{html-jal5w2b1p.js → html-qgw95yt0p.js} +17 -17
  17. package/dist/deps/markdown-36u2qw6ev.js +3058 -0
  18. package/dist/deps/{markdown-qhqqns7vp.js → markdown-ctg3s4wvp.js} +40 -40
  19. package/dist/deps/meriyah-ejbnz31wa.js +4 -0
  20. package/dist/deps/meriyah-icy3boh6d.js +2320 -0
  21. package/dist/deps/postcss-d1ptsms6d.js +4664 -0
  22. package/dist/deps/{postcss-vq400h6ym.js → postcss-u5nb3hsle.js} +21 -21
  23. package/dist/deps/soon-id-96lbx7g47.js +30 -0
  24. package/dist/deps/soon-id-j90jf02bq.js +1 -0
  25. package/dist/deps/{typescript-jihynpl9y.js → typescript-jp50r3t1c.js} +11 -11
  26. package/dist/deps/typescript-ss2fqxu8g.js +12794 -0
  27. package/dist/deps/yaml-16o42r2fx.js +4088 -0
  28. package/dist/deps/{yaml-auqgv4vnk.js → yaml-dcz0vkx91.js} +26 -26
  29. package/dist/index.cjs +15 -0
  30. package/dist/index.d.ts +3 -0
  31. package/dist/index.js +2224 -9
  32. package/dist/vite-plugin-soon-client.cjs +249 -0
  33. package/dist/vite-plugin-soon-client.js +48725 -152
  34. package/dist/vite-plugin-soon-server.cjs +272 -0
  35. package/dist/vite-plugin-soon-server.d.ts +1 -0
  36. package/dist/vite-plugin-soon-server.js +3276 -19
  37. package/package.json +18 -1
  38. package/dist/deps/angular-m17t0gdsi.js +0 -1
  39. package/dist/deps/meriyah-sl495y757.js +0 -4
  40. package/dist/deps/soon-id-gmzr57ufv.js +0 -1
package/dist/index.js CHANGED
@@ -1,15 +1,2230 @@
1
- var dt=Object.defineProperty;var mt=(r,e,t)=>e in r?dt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var x=(r,e,t)=>mt(r,typeof e!="symbol"?e+"":e,t);import{PassThrough as ht}from"stream";import{g as Fr,c as yr,u as vt}from"./deps/soon-id-gmzr57ufv.js";import gt from"util";var k={};Object.defineProperty(k,"__esModule",{value:!0});k.TokenData=void 0;k.parse=Oe;k.compile=$t;var wt=k.match=Ot;k.pathToRegexp=Rt;const bt="/",tr=r=>r,St=new RegExp("^\\p{XID_Continue}$","u"),le="https://git.new/pathToRegexpError",Et={"!":"!","@":"@",";":";",",":",","*":"*","+":"+","?":"?","{":"{","}":"}"};function At(r){const e=[...r],t=[];let n=0;for(;n<e.length;){const a=e[n],o=Et[a];if(o){t.push({type:o,index:n++,value:a});continue}if(a==="\\"){t.push({type:"ESCAPED",index:n++,value:e[n++]});continue}if(a===":"){let i="";for(;St.test(e[++n]);)i+=e[n];if(!i)throw new TypeError(`Missing parameter name at ${n}`);t.push({type:"NAME",index:n,value:i});continue}if(a==="("){const i=n++;let f=1,l="";if(e[n]==="?")throw new TypeError(`Pattern cannot start with "?" at ${n}`);for(;n<e.length;){if(e[n]==="\\"){l+=e[n++]+e[n++];continue}if(e[n]===")"){if(f--,f===0){n++;break}}else if(e[n]==="("&&(f++,e[n+1]!=="?"))throw new TypeError(`Capturing groups are not allowed at ${n}`);l+=e[n++]}if(f)throw new TypeError(`Unbalanced pattern at ${i}`);if(!l)throw new TypeError(`Missing pattern at ${i}`);t.push({type:"PATTERN",index:n,value:l});continue}t.push({type:"CHAR",index:n,value:e[n++]})}return t.push({type:"END",index:n,value:""}),new Pt(t)}class Pt{constructor(e){this.tokens=e,this.index=0}peek(){return this.tokens[this.index]}tryConsume(e){const t=this.peek();if(t.type===e)return this.index++,t.value}consume(e){const t=this.tryConsume(e);if(t!==void 0)return t;const{type:n,index:a}=this.peek();throw new TypeError(`Unexpected ${n} at ${a}, expected ${e}: ${le}`)}text(){let e="",t;for(;t=this.tryConsume("CHAR")||this.tryConsume("ESCAPED");)e+=t;return e}modifier(){return this.tryConsume("?")||this.tryConsume("*")||this.tryConsume("+")}}class se{constructor(e,t){this.tokens=e,this.delimiter=t}}k.TokenData=se;function Oe(r,e={}){const{encodePath:t=tr,delimiter:n=t(bt)}=e,a=[],o=At(r);let i=0;do{const f=o.text();f&&a.push(t(f));const l=o.tryConsume("NAME"),u=o.tryConsume("PATTERN");if(l||u){a.push({name:l||String(i++),pattern:u});const c=o.peek();if(c.type==="*")throw new TypeError(`Unexpected * at ${c.index}, you probably want \`/*\` or \`{/:foo}*\`: ${le}`);continue}if(o.tryConsume("*")){a.push({name:String(i++),pattern:`(?:(?!${J(n)}).)*`,modifier:"*",separator:n});continue}if(o.tryConsume("{")){const c=o.text(),d=o.tryConsume("NAME"),y=o.tryConsume("PATTERN"),m=o.text(),g=o.tryConsume(";")&&o.text();o.consume("}");const S=o.modifier();a.push({name:d||(y?String(i++):""),prefix:t(c),suffix:t(m),pattern:y,modifier:S,separator:g});continue}o.consume("END");break}while(!0);return new se(a,n)}function $t(r,e={}){const t=r instanceof se?r:Oe(r,e);return It(t,e)}function xt(r,e){if(typeof r=="string")return()=>r;const t=e||tr,n=r.modifier==="+"||r.modifier==="*",a=r.modifier==="?"||r.modifier==="*",{prefix:o="",suffix:i="",separator:f=i+o}=r;if(e&&n){const u=(p,c)=>{if(typeof p!="string")throw new TypeError(`Expected "${r.name}/${c}" to be a string`);return t(p)},s=p=>{if(!Array.isArray(p))throw new TypeError(`Expected "${r.name}" to be an array`);return p.length===0?"":o+p.map(u).join(f)+i};return a?p=>{const c=p[r.name];return c==null?"":c.length?s(c):""}:p=>{const c=p[r.name];return s(c)}}const l=u=>{if(typeof u!="string")throw new TypeError(`Expected "${r.name}" to be a string`);return o+t(u)+i};return a?u=>{const s=u[r.name];return s==null?"":l(s)}:u=>{const s=u[r.name];return l(s)}}function It(r,e){const{encode:t=encodeURIComponent,loose:n=!0,validate:a=!0,strict:o=!1}=e,i=Lr(e),f=nr(n,r.delimiter),l=qr(r,f,[],i,o),u=r.tokens.map((s,p)=>{const c=xt(s,t);if(!a||typeof s=="string")return c;const d=new RegExp(`^${l[p]}$`,i);return y=>{const m=c(y);if(!d.test(m))throw new TypeError(`Invalid value for "${s.name}": ${JSON.stringify(m)}`);return m}});return function(p={}){let c="";for(const d of u)c+=d(p);return c}}function Ot(r,e={}){const{decode:t=decodeURIComponent,loose:n=!0}=e,a=r instanceof se?r:Oe(r,e),o=nr(n,a.delimiter),i=[],f=Wr(a,i,e),l=i.map(u=>{if(t&&(u.modifier==="+"||u.modifier==="*")){const{prefix:s="",suffix:p="",separator:c=p+s}=u,d=new RegExp(o(c),"g");return y=>y.split(d).map(t)}return t||tr});return function(s){const p=f.exec(s);if(!p)return!1;const{0:c,index:d}=p,y=Object.create(null);for(let m=1;m<p.length;m++){if(p[m]===void 0)continue;const g=i[m-1],S=l[m-1];y[g.name]=S(p[m])}return{path:c,index:d,params:y}}}function J(r){return r.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function Tt(r,e){const t=J(r);return e?`(?:${t})+(?!${t})`:t}function nr(r,e){if(!r)return J;const t=new RegExp(`(?:(?!${J(e)}).)+|(.)`,"g");return n=>n.replace(t,Tt)}function Lr(r){return r.sensitive?"":"i"}function Wr(r,e,t){const{trailing:n=!0,loose:a=!0,start:o=!0,end:i=!0,strict:f=!1}=t,l=Lr(t),u=nr(a,r.delimiter),s=qr(r,u,e,l,f);let p=o?"^":"";return p+=s.join(""),n&&(p+=`(?:${u(r.delimiter)})?`),p+=i?"$":`(?=${J(r.delimiter)}|$)`,new RegExp(p,l)}function qr(r,e,t,n,a){const o=`(?:(?!${J(r.delimiter)}).)+?`;let i="",f=!0;return r.tokens.map((l,u)=>{if(typeof l=="string")return i=l,e(l);const{prefix:s="",suffix:p="",separator:c=p+s,modifier:d=""}=l,y=e(s),m=e(p);if(l.name){const g=l.pattern?`(?:${l.pattern})`:o,S=Ct(g,l.name,n);if(f||(f=De(S,s||i)),!f)throw new TypeError(`Ambiguous pattern for "${l.name}": ${le}`);if(f=!a||De(S,p),i="",t.push(l),d==="+"||d==="*"){const P=d==="*"?"?":"",h=e(c);if(!h)throw new TypeError(`Missing separator for "${l.name}": ${le}`);if(f||(f=!a||De(S,c)),!f)throw new TypeError(`Ambiguous pattern for "${l.name}" separator: ${le}`);return f=!a,`(?:${y}(${g}(?:${h}${g})*)${m})${P}`}return`(?:${y}(${g})${m})${d}`}return`(?:${y}${m})${d}`})}function Ct(r,e,t){try{return new RegExp(`^${r}$`,t)}catch(n){throw new TypeError(`Invalid pattern for "${e}": ${n.message}`)}}function De(r,e){return e?!r.test(e):!1}function Rt(r,e={}){const t=r instanceof se?r:Oe(r,e),n=[],a=Wr(t,n,e);return Object.assign(a,{keys:n})}var Te={};Object.defineProperty(Te,"__esModule",{value:!0});Te.Observable=void 0;const Gr=r=>!!Symbol[r],ar=r=>Gr(r)?Symbol[r]:"@@"+r,_t=ar("iterator"),Ve=ar("observable"),kr=ar("species");function Ae(r,e){let t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function oe(r){let e=r.constructor;return e!==void 0&&(e=e[kr],e===null&&(e=void 0)),e!==void 0?e:Ce}function Dt(r){return r instanceof Ce}function X(r){X.log?X.log(r):setTimeout(()=>{throw r})}function we(r){Promise.resolve().then(()=>{try{r()}catch(e){X(e)}})}function zr(r){let e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{let t=Ae(e,"unsubscribe");t&&t.call(e)}}catch(t){X(t)}}function Qe(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function Mt(r){let e=r._queue;if(e){r._queue=void 0,r._state="ready";for(let t=0;t<e.length&&(Hr(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function Hr(r,e,t){r._state="running";let n=r._observer;try{let a=Ae(n,e);switch(e){case"next":a&&a.call(n,t);break;case"error":if(Qe(r),a)a.call(n,t);else throw t;break;case"complete":Qe(r),a&&a.call(n);break}}catch(a){X(a)}r._state==="closed"?zr(r):r._state==="running"&&(r._state="ready")}function Me(r,e,t){if(r._state!=="closed"){if(r._state==="buffering"){r._queue.push({type:e,value:t});return}if(r._state!=="ready"){r._state="buffering",r._queue=[{type:e,value:t}],we(()=>Mt(r));return}Hr(r,e,t)}}class Nt{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let n=this,a={get closed(){return n._state==="closed"},next(o){Me(n,"next",o)},error(o){Me(n,"error",o)},complete(){Me(n,"complete")}};try{this._cleanup=t.call(void 0,a)}catch(o){a.error(o)}this._state==="initializing"&&(this._state="ready")}get closed(){return this._state==="closed"}unsubscribe(){this._state!=="closed"&&(Qe(this),zr(this))}}let Ce=class be{constructor(e){if(!(this instanceof be))throw new TypeError("Observable cannot be called as a function");if(typeof e!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return(typeof e!="object"||e===null)&&(e={next:e,error:arguments[1],complete:arguments[2]}),new Nt(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if(typeof e!="function"){n(new TypeError(e+" is not a function"));return}function a(){o.unsubscribe(),t()}let o=this.subscribe({next(i){try{e(i,a)}catch(f){n(f),o.unsubscribe()}},error:n,complete:t})})}map(e){if(typeof e!="function")throw new TypeError(e+" is not a function");let t=oe(this);return new t(n=>this.subscribe({next(a){try{a=e(a)}catch(o){return n.error(o)}n.next(a)},error(a){n.error(a)},complete(){n.complete()}}))}filter(e){if(typeof e!="function")throw new TypeError(e+" is not a function");let t=oe(this);return new t(n=>this.subscribe({next(a){try{if(!e(a))return}catch(o){return n.error(o)}n.next(a)},error(a){n.error(a)},complete(){n.complete()}}))}reduce(e){if(typeof e!="function")throw new TypeError(e+" is not a function");let t=oe(this),n=arguments.length>1,a=!1,i=arguments[1];return new t(f=>this.subscribe({next(l){let u=!a;if(a=!0,!u||n)try{i=e(i,l)}catch(s){return f.error(s)}else i=l},error(l){f.error(l)},complete(){if(!a&&!n)return f.error(new TypeError("Cannot reduce an empty sequence"));f.next(i),f.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=oe(this);return new t(n=>{let a,o=0;function i(f){a=f.subscribe({next(l){n.next(l)},error(l){n.error(l)},complete(){o===e.length?(a=void 0,n.complete()):i(t.from(e[o++]))}})}return i(this),()=>{a&&(a.unsubscribe(),a=void 0)}})}flatMap(e){if(typeof e!="function")throw new TypeError(e+" is not a function");let t=oe(this);return new t(n=>{let a=[],o=this.subscribe({next(f){if(e)try{f=e(f)}catch(u){return n.error(u)}let l=t.from(f).subscribe({next(u){n.next(u)},error(u){n.error(u)},complete(){let u=a.indexOf(l);u>=0&&a.splice(u,1),i()}});a.push(l)},error(f){n.error(f)},complete(){i()}});function i(){o.closed&&a.length===0&&n.complete()}return()=>{a.forEach(f=>f.unsubscribe()),o.unsubscribe()}})}[Ve](){return this}static from(e){let t=typeof this=="function"?this:be;if(e==null)throw new TypeError(e+" is not an object");let n=Ae(e,Ve);if(n){let a=n.call(e);if(Object(a)!==a)throw new TypeError(a+" is not an object");return Dt(a)&&a.constructor===t?a:new t(o=>a.subscribe(o))}if(Gr("iterator")&&(n=Ae(e,_t),n))return new t(a=>{we(()=>{if(!a.closed){for(let o of n.call(e))if(a.next(o),a.closed)return;a.complete()}})});if(Array.isArray(e))return new t(a=>{we(()=>{if(!a.closed){for(let o=0;o<e.length;++o)if(a.next(e[o]),a.closed)return;a.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){let t=typeof this=="function"?this:be;return new t(n=>{we(()=>{if(!n.closed){for(let a=0;a<e.length;++a)if(n.next(e[a]),n.closed)return;n.complete()}})})}static get[kr](){return this}};Te.Observable=Ce;Object.defineProperty(Ce,Symbol("extensions"),{value:{symbol:Ve,hostReportError:X},configurable:!0});var Bt=Te.Observable;const Kr=Fr(Bt);var Ut=Error,Ft=EvalError,Lt=RangeError,Wt=ReferenceError,Vr=SyntaxError,pe=TypeError,qt=URIError,Gt=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var a=42;e[t]=a;for(t in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var i=Object.getOwnPropertyDescriptor(e,t);if(i.value!==a||i.enumerable!==!0)return!1}return!0},dr=typeof Symbol<"u"&&Symbol,kt=Gt,zt=function(){return typeof dr!="function"||typeof Symbol!="function"||typeof dr("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:kt()},Ne={__proto__:null,foo:{}},Ht=Object,Kt=function(){return{__proto__:Ne}.foo===Ne.foo&&!(Ne instanceof Ht)},Vt="Function.prototype.bind called on incompatible ",Qt=Object.prototype.toString,jt=Math.max,Jt="[object Function]",mr=function(e,t){for(var n=[],a=0;a<e.length;a+=1)n[a]=e[a];for(var o=0;o<t.length;o+=1)n[o+e.length]=t[o];return n},Xt=function(e,t){for(var n=[],a=t,o=0;a<e.length;a+=1,o+=1)n[o]=e[a];return n},Yt=function(r,e){for(var t="",n=0;n<r.length;n+=1)t+=r[n],n+1<r.length&&(t+=e);return t},Zt=function(e){var t=this;if(typeof t!="function"||Qt.apply(t)!==Jt)throw new TypeError(Vt+t);for(var n=Xt(arguments,1),a,o=function(){if(this instanceof a){var s=t.apply(this,mr(n,arguments));return Object(s)===s?s:this}return t.apply(e,mr(n,arguments))},i=jt(0,t.length-n.length),f=[],l=0;l<i;l++)f[l]="$"+l;if(a=Function("binder","return function ("+Yt(f,",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var u=function(){};u.prototype=t.prototype,a.prototype=new u,u.prototype=null}return a},en=Zt,or=Function.prototype.bind||en,rn=Function.prototype.call,tn=Object.prototype.hasOwnProperty,nn=or,an=nn.call(rn,tn),v,on=Ut,ln=Ft,fn=Lt,un=Wt,Y=Vr,j=pe,cn=qt,Qr=Function,Be=function(r){try{return Qr('"use strict"; return ('+r+").constructor;")()}catch{}},q=Object.getOwnPropertyDescriptor;if(q)try{q({},"")}catch{q=null}var Ue=function(){throw new j},sn=q?function(){try{return arguments.callee,Ue}catch{try{return q(arguments,"callee").get}catch{return Ue}}}():Ue,K=zt(),pn=Kt(),A=Object.getPrototypeOf||(pn?function(r){return r.__proto__}:null),Q={},yn=typeof Uint8Array>"u"||!A?v:A(Uint8Array),G={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?v:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?v:ArrayBuffer,"%ArrayIteratorPrototype%":K&&A?A([][Symbol.iterator]()):v,"%AsyncFromSyncIteratorPrototype%":v,"%AsyncFunction%":Q,"%AsyncGenerator%":Q,"%AsyncGeneratorFunction%":Q,"%AsyncIteratorPrototype%":Q,"%Atomics%":typeof Atomics>"u"?v:Atomics,"%BigInt%":typeof BigInt>"u"?v:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?v:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?v:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?v:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":on,"%eval%":eval,"%EvalError%":ln,"%Float32Array%":typeof Float32Array>"u"?v:Float32Array,"%Float64Array%":typeof Float64Array>"u"?v:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?v:FinalizationRegistry,"%Function%":Qr,"%GeneratorFunction%":Q,"%Int8Array%":typeof Int8Array>"u"?v:Int8Array,"%Int16Array%":typeof Int16Array>"u"?v:Int16Array,"%Int32Array%":typeof Int32Array>"u"?v:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":K&&A?A(A([][Symbol.iterator]())):v,"%JSON%":typeof JSON=="object"?JSON:v,"%Map%":typeof Map>"u"?v:Map,"%MapIteratorPrototype%":typeof Map>"u"||!K||!A?v:A(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?v:Promise,"%Proxy%":typeof Proxy>"u"?v:Proxy,"%RangeError%":fn,"%ReferenceError%":un,"%Reflect%":typeof Reflect>"u"?v:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?v:Set,"%SetIteratorPrototype%":typeof Set>"u"||!K||!A?v:A(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?v:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":K&&A?A(""[Symbol.iterator]()):v,"%Symbol%":K?Symbol:v,"%SyntaxError%":Y,"%ThrowTypeError%":sn,"%TypedArray%":yn,"%TypeError%":j,"%Uint8Array%":typeof Uint8Array>"u"?v:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?v:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?v:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?v:Uint32Array,"%URIError%":cn,"%WeakMap%":typeof WeakMap>"u"?v:WeakMap,"%WeakRef%":typeof WeakRef>"u"?v:WeakRef,"%WeakSet%":typeof WeakSet>"u"?v:WeakSet};if(A)try{null.error}catch(r){var dn=A(A(r));G["%Error.prototype%"]=dn}var mn=function r(e){var t;if(e==="%AsyncFunction%")t=Be("async function () {}");else if(e==="%GeneratorFunction%")t=Be("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Be("async function* () {}");else if(e==="%AsyncGenerator%"){var n=r("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&A&&(t=A(a.prototype))}return G[e]=t,t},hr={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ye=or,Pe=an,hn=ye.call(Function.call,Array.prototype.concat),vn=ye.call(Function.apply,Array.prototype.splice),vr=ye.call(Function.call,String.prototype.replace),$e=ye.call(Function.call,String.prototype.slice),gn=ye.call(Function.call,RegExp.prototype.exec),wn=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,bn=/\\(\\)?/g,Sn=function(e){var t=$e(e,0,1),n=$e(e,-1);if(t==="%"&&n!=="%")throw new Y("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new Y("invalid intrinsic syntax, expected opening `%`");var a=[];return vr(e,wn,function(o,i,f,l){a[a.length]=f?vr(l,bn,"$1"):i||o}),a},En=function(e,t){var n=e,a;if(Pe(hr,n)&&(a=hr[n],n="%"+a[0]+"%"),Pe(G,n)){var o=G[n];if(o===Q&&(o=mn(n)),typeof o>"u"&&!t)throw new j("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:a,name:n,value:o}}throw new Y("intrinsic "+e+" does not exist!")},re=function(e,t){if(typeof e!="string"||e.length===0)throw new j("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new j('"allowMissing" argument must be a boolean');if(gn(/^%?[^%]*%?$/,e)===null)throw new Y("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Sn(e),a=n.length>0?n[0]:"",o=En("%"+a+"%",t),i=o.name,f=o.value,l=!1,u=o.alias;u&&(a=u[0],vn(n,hn([0,1],u)));for(var s=1,p=!0;s<n.length;s+=1){var c=n[s],d=$e(c,0,1),y=$e(c,-1);if((d==='"'||d==="'"||d==="`"||y==='"'||y==="'"||y==="`")&&d!==y)throw new Y("property names with quotes must have matching quotes");if((c==="constructor"||!p)&&(l=!0),a+="."+c,i="%"+a+"%",Pe(G,i))f=G[i];else if(f!=null){if(!(c in f)){if(!t)throw new j("base intrinsic for "+e+" exists, but the property is not available.");return}if(q&&s+1>=n.length){var m=q(f,c);p=!!m,p&&"get"in m&&!("originalValue"in m.get)?f=m.get:f=f[c]}else p=Pe(f,c),f=f[c];p&&!l&&(G[i]=f)}}return f},jr={exports:{}},Fe,gr;function ir(){if(gr)return Fe;gr=1;var r=re,e=r("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return Fe=e,Fe}var An=re,Se=An("%Object.getOwnPropertyDescriptor%",!0);if(Se)try{Se([],"length")}catch{Se=null}var Jr=Se,wr=ir(),Pn=Vr,V=pe,br=Jr,$n=function(e,t,n){if(!e||typeof e!="object"&&typeof e!="function")throw new V("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new V("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new V("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new V("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new V("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new V("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,i=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,l=!!br&&br(e,t);if(wr)wr(e,t,{configurable:i===null&&l?l.configurable:!i,enumerable:a===null&&l?l.enumerable:!a,value:n,writable:o===null&&l?l.writable:!o});else if(f||!a&&!o&&!i)e[t]=n;else throw new Pn("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},je=ir(),Xr=function(){return!!je};Xr.hasArrayLengthDefineBug=function(){if(!je)return null;try{return je([],"length",{value:1}).length!==1}catch{return!0}};var xn=Xr,In=re,Sr=$n,On=xn(),Er=Jr,Ar=pe,Tn=In("%Math.floor%"),Cn=function(e,t){if(typeof e!="function")throw new Ar("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||Tn(t)!==t)throw new Ar("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],a=!0,o=!0;if("length"in e&&Er){var i=Er(e,"length");i&&!i.configurable&&(a=!1),i&&!i.writable&&(o=!1)}return(a||o||!n)&&(On?Sr(e,"length",t,!0,!0):Sr(e,"length",t)),e};(function(r){var e=or,t=re,n=Cn,a=pe,o=t("%Function.prototype.apply%"),i=t("%Function.prototype.call%"),f=t("%Reflect.apply%",!0)||e.call(i,o),l=ir(),u=t("%Math.max%");r.exports=function(c){if(typeof c!="function")throw new a("a function is required");var d=f(e,i,arguments);return n(d,1+u(0,c.length-(arguments.length-1)),!0)};var s=function(){return f(e,o,arguments)};l?l(r.exports,"apply",{value:s}):r.exports.apply=s})(jr);var Rn=jr.exports,Yr=re,Zr=Rn,_n=Zr(Yr("String.prototype.indexOf")),Dn=function(e,t){var n=Yr(e,!!t);return typeof n=="function"&&_n(e,".prototype.")>-1?Zr(n):n},Mn=gt.inspect,lr=typeof Map=="function"&&Map.prototype,Le=Object.getOwnPropertyDescriptor&&lr?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,xe=lr&&Le&&typeof Le.get=="function"?Le.get:null,Pr=lr&&Map.prototype.forEach,fr=typeof Set=="function"&&Set.prototype,We=Object.getOwnPropertyDescriptor&&fr?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Ie=fr&&We&&typeof We.get=="function"?We.get:null,$r=fr&&Set.prototype.forEach,Nn=typeof WeakMap=="function"&&WeakMap.prototype,fe=Nn?WeakMap.prototype.has:null,Bn=typeof WeakSet=="function"&&WeakSet.prototype,ue=Bn?WeakSet.prototype.has:null,Un=typeof WeakRef=="function"&&WeakRef.prototype,xr=Un?WeakRef.prototype.deref:null,Fn=Boolean.prototype.valueOf,Ln=Object.prototype.toString,Wn=Function.prototype.toString,qn=String.prototype.match,ur=String.prototype.slice,B=String.prototype.replace,Gn=String.prototype.toUpperCase,Ir=String.prototype.toLowerCase,et=RegExp.prototype.test,Or=Array.prototype.concat,C=Array.prototype.join,kn=Array.prototype.slice,Tr=Math.floor,Je=typeof BigInt=="function"?BigInt.prototype.valueOf:null,qe=Object.getOwnPropertySymbols,Xe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Z=typeof Symbol=="function"&&typeof Symbol.iterator=="object",$=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Z||!0)?Symbol.toStringTag:null,rt=Object.prototype.propertyIsEnumerable,Cr=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function Rr(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||et.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var n=r<0?-Tr(-r):Tr(r);if(n!==r){var a=String(n),o=ur.call(e,a.length+1);return B.call(a,t,"$&_")+"."+B.call(B.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return B.call(e,t,"$&_")}var Ye=Mn,_r=Ye.custom,Dr=nt(_r)?_r:null,zn=function r(e,t,n,a){var o=t||{};if(N(o,"quoteStyle")&&o.quoteStyle!=="single"&&o.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(N(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var i=N(o,"customInspect")?o.customInspect:!0;if(typeof i!="boolean"&&i!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(N(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(N(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var f=o.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return ot(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return f?Rr(e,l):l}if(typeof e=="bigint"){var u=String(e)+"n";return f?Rr(e,u):u}var s=typeof o.depth>"u"?5:o.depth;if(typeof n>"u"&&(n=0),n>=s&&s>0&&typeof e=="object")return Ze(e)?"[Array]":"[Object]";var p=fa(o,n);if(typeof a>"u")a=[];else if(at(a,e)>=0)return"[Circular]";function c(I,D,M){if(D&&(a=kn.call(a),a.push(D)),M){var ae={depth:o.depth};return N(o,"quoteStyle")&&(ae.quoteStyle=o.quoteStyle),r(I,ae,n+1,a)}return r(I,o,n+1,a)}if(typeof e=="function"&&!Mr(e)){var d=Zn(e),y=he(e,c);return"[Function"+(d?": "+d:" (anonymous)")+"]"+(y.length>0?" { "+C.call(y,", ")+" }":"")}if(nt(e)){var m=Z?B.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Xe.call(e);return typeof e=="object"&&!Z?ie(m):m}if(oa(e)){for(var g="<"+Ir.call(String(e.nodeName)),S=e.attributes||[],P=0;P<S.length;P++)g+=" "+S[P].name+"="+tt(Hn(S[P].value),"double",o);return g+=">",e.childNodes&&e.childNodes.length&&(g+="..."),g+="</"+Ir.call(String(e.nodeName))+">",g}if(Ze(e)){if(e.length===0)return"[]";var h=he(e,c);return p&&!la(h)?"["+er(h,p)+"]":"[ "+C.call(h,", ")+" ]"}if(Vn(e)){var R=he(e,c);return!("cause"in Error.prototype)&&"cause"in e&&!rt.call(e,"cause")?"{ ["+String(e)+"] "+C.call(Or.call("[cause]: "+c(e.cause),R),", ")+" }":R.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+C.call(R,", ")+" }"}if(typeof e=="object"&&i){if(Dr&&typeof e[Dr]=="function"&&Ye)return Ye(e,{depth:s-n});if(i!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(ea(e)){var F=[];return Pr&&Pr.call(e,function(I,D){F.push(c(D,e,!0)+" => "+c(I,e))}),Nr("Map",xe.call(e),F,p)}if(na(e)){var ne=[];return $r&&$r.call(e,function(I){ne.push(c(I,e))}),Nr("Set",Ie.call(e),ne,p)}if(ra(e))return Ge("WeakMap");if(aa(e))return Ge("WeakSet");if(ta(e))return Ge("WeakRef");if(jn(e))return ie(c(Number(e)));if(Xn(e))return ie(c(Je.call(e)));if(Jn(e))return ie(Fn.call(e));if(Qn(e))return ie(c(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof yr<"u"&&e===yr)return"{ [object globalThis] }";if(!Kn(e)&&!Mr(e)){var z=he(e,c),de=Cr?Cr(e)===Object.prototype:e instanceof Object||e.constructor===Object,L=e instanceof Object?"":"null prototype",_=!de&&$&&Object(e)===e&&$ in e?ur.call(U(e),8,-1):L?"Object":"",me=de||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",H=me+(_||L?"["+C.call(Or.call([],_||[],L||[]),": ")+"] ":"");return z.length===0?H+"{}":p?H+"{"+er(z,p)+"}":H+"{ "+C.call(z,", ")+" }"}return String(e)};function tt(r,e,t){var n=(t.quoteStyle||e)==="double"?'"':"'";return n+r+n}function Hn(r){return B.call(String(r),/"/g,"&quot;")}function Ze(r){return U(r)==="[object Array]"&&(!$||!(typeof r=="object"&&$ in r))}function Kn(r){return U(r)==="[object Date]"&&(!$||!(typeof r=="object"&&$ in r))}function Mr(r){return U(r)==="[object RegExp]"&&(!$||!(typeof r=="object"&&$ in r))}function Vn(r){return U(r)==="[object Error]"&&(!$||!(typeof r=="object"&&$ in r))}function Qn(r){return U(r)==="[object String]"&&(!$||!(typeof r=="object"&&$ in r))}function jn(r){return U(r)==="[object Number]"&&(!$||!(typeof r=="object"&&$ in r))}function Jn(r){return U(r)==="[object Boolean]"&&(!$||!(typeof r=="object"&&$ in r))}function nt(r){if(Z)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Xe)return!1;try{return Xe.call(r),!0}catch{}return!1}function Xn(r){if(!r||typeof r!="object"||!Je)return!1;try{return Je.call(r),!0}catch{}return!1}var Yn=Object.prototype.hasOwnProperty||function(r){return r in this};function N(r,e){return Yn.call(r,e)}function U(r){return Ln.call(r)}function Zn(r){if(r.name)return r.name;var e=qn.call(Wn.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function at(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,n=r.length;t<n;t++)if(r[t]===e)return t;return-1}function ea(r){if(!xe||!r||typeof r!="object")return!1;try{xe.call(r);try{Ie.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function ra(r){if(!fe||!r||typeof r!="object")return!1;try{fe.call(r,fe);try{ue.call(r,ue)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function ta(r){if(!xr||!r||typeof r!="object")return!1;try{return xr.call(r),!0}catch{}return!1}function na(r){if(!Ie||!r||typeof r!="object")return!1;try{Ie.call(r);try{xe.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function aa(r){if(!ue||!r||typeof r!="object")return!1;try{ue.call(r,ue);try{fe.call(r,fe)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function oa(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function ot(r,e){if(r.length>e.maxStringLength){var t=r.length-e.maxStringLength,n="... "+t+" more character"+(t>1?"s":"");return ot(ur.call(r,0,e.maxStringLength),e)+n}var a=B.call(B.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ia);return tt(a,"single",e)}function ia(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+Gn.call(e.toString(16))}function ie(r){return"Object("+r+")"}function Ge(r){return r+" { ? }"}function Nr(r,e,t,n){var a=n?er(t,n):C.call(t,", ");return r+" ("+e+") {"+a+"}"}function la(r){for(var e=0;e<r.length;e++)if(at(r[e],`
2
- `)>=0)return!1;return!0}function fa(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=C.call(Array(r.indent+1)," ");else return null;return{base:t,prev:C.call(Array(e+1),t)}}function er(r,e){if(r.length===0)return"";var t=`
3
- `+e.prev+e.base;return t+C.call(r,","+t)+`
4
- `+e.prev}function he(r,e){var t=Ze(r),n=[];if(t){n.length=r.length;for(var a=0;a<r.length;a++)n[a]=N(r,a)?e(r[a],r):""}var o=typeof qe=="function"?qe(r):[],i;if(Z){i={};for(var f=0;f<o.length;f++)i["$"+o[f]]=o[f]}for(var l in r)N(r,l)&&(t&&String(Number(l))===l&&l<r.length||Z&&i["$"+l]instanceof Symbol||(et.call(/[^\w$]/,l)?n.push(e(l,r)+": "+e(r[l],r)):n.push(l+": "+e(r[l],r))));if(typeof qe=="function")for(var u=0;u<o.length;u++)rt.call(r,o[u])&&n.push("["+e(o[u])+"]: "+e(r[o[u]],r));return n}var it=re,te=Dn,ua=zn,ca=pe,ve=it("%WeakMap%",!0),ge=it("%Map%",!0),sa=te("WeakMap.prototype.get",!0),pa=te("WeakMap.prototype.set",!0),ya=te("WeakMap.prototype.has",!0),da=te("Map.prototype.get",!0),ma=te("Map.prototype.set",!0),ha=te("Map.prototype.has",!0),cr=function(r,e){for(var t=r,n;(n=t.next)!==null;t=n)if(n.key===e)return t.next=n.next,n.next=r.next,r.next=n,n},va=function(r,e){var t=cr(r,e);return t&&t.value},ga=function(r,e,t){var n=cr(r,e);n?n.value=t:r.next={key:e,next:r.next,value:t}},wa=function(r,e){return!!cr(r,e)},ba=function(){var e,t,n,a={assert:function(o){if(!a.has(o))throw new ca("Side channel does not contain "+ua(o))},get:function(o){if(ve&&o&&(typeof o=="object"||typeof o=="function")){if(e)return sa(e,o)}else if(ge){if(t)return da(t,o)}else if(n)return va(n,o)},has:function(o){if(ve&&o&&(typeof o=="object"||typeof o=="function")){if(e)return ya(e,o)}else if(ge){if(t)return ha(t,o)}else if(n)return wa(n,o);return!1},set:function(o,i){ve&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new ve),pa(e,o,i)):ge?(t||(t=new ge),ma(t,o,i)):(n||(n={key:{},next:null}),ga(n,o,i))}};return a},Sa=String.prototype.replace,Ea=/%20/g,ke={RFC1738:"RFC1738",RFC3986:"RFC3986"},sr={default:ke.RFC3986,formatters:{RFC1738:function(r){return Sa.call(r,Ea,"+")},RFC3986:function(r){return String(r)}},RFC1738:ke.RFC1738,RFC3986:ke.RFC3986},Aa=sr,ze=Object.prototype.hasOwnProperty,W=Array.isArray,O=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),Pa=function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(W(n)){for(var a=[],o=0;o<n.length;++o)typeof n[o]<"u"&&a.push(n[o]);t.obj[t.prop]=a}}},lt=function(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},a=0;a<e.length;++a)typeof e[a]<"u"&&(n[a]=e[a]);return n},$a=function r(e,t,n){if(!t)return e;if(typeof t!="object"){if(W(e))e.push(t);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!ze.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);var a=e;return W(e)&&!W(t)&&(a=lt(e,n)),W(e)&&W(t)?(t.forEach(function(o,i){if(ze.call(e,i)){var f=e[i];f&&typeof f=="object"&&o&&typeof o=="object"?e[i]=r(f,o,n):e.push(o)}else e[i]=o}),e):Object.keys(t).reduce(function(o,i){var f=t[i];return ze.call(o,i)?o[i]=r(o[i],f,n):o[i]=f,o},a)},xa=function(e,t){return Object.keys(t).reduce(function(n,a){return n[a]=t[a],n},e)},Ia=function(r,e,t){var n=r.replace(/\+/g," ");if(t==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},He=1024,Oa=function(e,t,n,a,o){if(e.length===0)return e;var i=e;if(typeof e=="symbol"?i=Symbol.prototype.toString.call(e):typeof e!="string"&&(i=String(e)),n==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(d){return"%26%23"+parseInt(d.slice(2),16)+"%3B"});for(var f="",l=0;l<i.length;l+=He){for(var u=i.length>=He?i.slice(l,l+He):i,s=[],p=0;p<u.length;++p){var c=u.charCodeAt(p);if(c===45||c===46||c===95||c===126||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||o===Aa.RFC1738&&(c===40||c===41)){s[s.length]=u.charAt(p);continue}if(c<128){s[s.length]=O[c];continue}if(c<2048){s[s.length]=O[192|c>>6]+O[128|c&63];continue}if(c<55296||c>=57344){s[s.length]=O[224|c>>12]+O[128|c>>6&63]+O[128|c&63];continue}p+=1,c=65536+((c&1023)<<10|u.charCodeAt(p)&1023),s[s.length]=O[240|c>>18]+O[128|c>>12&63]+O[128|c>>6&63]+O[128|c&63]}f+=s.join("")}return f},Ta=function(e){for(var t=[{obj:{o:e},prop:"o"}],n=[],a=0;a<t.length;++a)for(var o=t[a],i=o.obj[o.prop],f=Object.keys(i),l=0;l<f.length;++l){var u=f[l],s=i[u];typeof s=="object"&&s!==null&&n.indexOf(s)===-1&&(t.push({obj:i,prop:u}),n.push(s))}return Pa(t),e},Ca=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Ra=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},_a=function(e,t){return[].concat(e,t)},Da=function(e,t){if(W(e)){for(var n=[],a=0;a<e.length;a+=1)n.push(t(e[a]));return n}return t(e)},ft={arrayToObject:lt,assign:xa,combine:_a,compact:Ta,decode:Ia,encode:Oa,isBuffer:Ra,isRegExp:Ca,maybeMap:Da,merge:$a},ut=ba,Ee=ft,ce=sr,Ma=Object.prototype.hasOwnProperty,ct={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},T=Array.isArray,Na=Array.prototype.push,st=function(r,e){Na.apply(r,T(e)?e:[e])},Ba=Date.prototype.toISOString,Br=ce.default,E={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Ee.encode,encodeValuesOnly:!1,format:Br,formatter:ce.formatters[Br],indices:!1,serializeDate:function(e){return Ba.call(e)},skipNulls:!1,strictNullHandling:!1},Ua=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Ke={},Fa=function r(e,t,n,a,o,i,f,l,u,s,p,c,d,y,m,g,S,P){for(var h=e,R=P,F=0,ne=!1;(R=R.get(Ke))!==void 0&&!ne;){var z=R.get(e);if(F+=1,typeof z<"u"){if(z===F)throw new RangeError("Cyclic object value");ne=!0}typeof R.get(Ke)>"u"&&(F=0)}if(typeof s=="function"?h=s(t,h):h instanceof Date?h=d(h):n==="comma"&&T(h)&&(h=Ee.maybeMap(h,function(_e){return _e instanceof Date?d(_e):_e})),h===null){if(i)return u&&!g?u(t,E.encoder,S,"key",y):t;h=""}if(Ua(h)||Ee.isBuffer(h)){if(u){var de=g?t:u(t,E.encoder,S,"key",y);return[m(de)+"="+m(u(h,E.encoder,S,"value",y))]}return[m(t)+"="+m(String(h))]}var L=[];if(typeof h>"u")return L;var _;if(n==="comma"&&T(h))g&&u&&(h=Ee.maybeMap(h,u)),_=[{value:h.length>0?h.join(",")||null:void 0}];else if(T(s))_=s;else{var me=Object.keys(h);_=p?me.sort(p):me}var H=l?t.replace(/\./g,"%2E"):t,I=a&&T(h)&&h.length===1?H+"[]":H;if(o&&T(h)&&h.length===0)return I+"[]";for(var D=0;D<_.length;++D){var M=_[D],ae=typeof M=="object"&&typeof M.value<"u"?M.value:h[M];if(!(f&&ae===null)){var Re=c&&l?M.replace(/\./g,"%2E"):M,yt=T(h)?typeof n=="function"?n(I,Re):I:I+(c?"."+Re:"["+Re+"]");P.set(e,F);var pr=ut();pr.set(Ke,P),st(L,r(ae,yt,n,a,o,i,f,l,n==="comma"&&g&&T(h)?null:u,s,p,c,d,y,m,g,S,pr))}}return L},La=function(e){if(!e)return E;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var t=e.charset||E.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=ce.default;if(typeof e.format<"u"){if(!Ma.call(ce.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var a=ce.formatters[n],o=E.filter;(typeof e.filter=="function"||T(e.filter))&&(o=e.filter);var i;if(e.arrayFormat in ct?i=e.arrayFormat:"indices"in e?i=e.indices?"indices":"repeat":i=E.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var f=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:E.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:E.addQueryPrefix,allowDots:f,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:E.allowEmptyArrays,arrayFormat:i,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:E.charsetSentinel,commaRoundTrip:e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?E.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:E.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:E.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:E.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:E.encodeValuesOnly,filter:o,format:n,formatter:a,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:E.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:E.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:E.strictNullHandling}},Wa=function(r,e){var t=r,n=La(e),a,o;typeof n.filter=="function"?(o=n.filter,t=o("",t)):T(n.filter)&&(o=n.filter,a=o);var i=[];if(typeof t!="object"||t===null)return"";var f=ct[n.arrayFormat],l=f==="comma"&&n.commaRoundTrip;a||(a=Object.keys(t)),n.sort&&a.sort(n.sort);for(var u=ut(),s=0;s<a.length;++s){var p=a[s];n.skipNulls&&t[p]===null||st(i,Fa(t[p],p,f,l,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,u))}var c=i.join(n.delimiter),d=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),c.length>0?d+c:""},ee=ft,rr=Object.prototype.hasOwnProperty,qa=Array.isArray,b={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:ee.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},Ga=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},pt=function(r,e){return r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1?r.split(","):r},ka="utf8=%26%2310003%3B",za="utf8=%E2%9C%93",Ha=function(e,t){var n={__proto__:null},a=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;a=a.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=t.parameterLimit===1/0?void 0:t.parameterLimit,i=a.split(t.delimiter,o),f=-1,l,u=t.charset;if(t.charsetSentinel)for(l=0;l<i.length;++l)i[l].indexOf("utf8=")===0&&(i[l]===za?u="utf-8":i[l]===ka&&(u="iso-8859-1"),f=l,l=i.length);for(l=0;l<i.length;++l)if(l!==f){var s=i[l],p=s.indexOf("]="),c=p===-1?s.indexOf("="):p+1,d,y;c===-1?(d=t.decoder(s,b.decoder,u,"key"),y=t.strictNullHandling?null:""):(d=t.decoder(s.slice(0,c),b.decoder,u,"key"),y=ee.maybeMap(pt(s.slice(c+1),t),function(g){return t.decoder(g,b.decoder,u,"value")})),y&&t.interpretNumericEntities&&u==="iso-8859-1"&&(y=Ga(y)),s.indexOf("[]=")>-1&&(y=qa(y)?[y]:y);var m=rr.call(n,d);m&&t.duplicates==="combine"?n[d]=ee.combine(n[d],y):(!m||t.duplicates==="last")&&(n[d]=y)}return n},Ka=function(r,e,t,n){for(var a=n?e:pt(e,t),o=r.length-1;o>=0;--o){var i,f=r[o];if(f==="[]"&&t.parseArrays)i=t.allowEmptyArrays&&(a===""||t.strictNullHandling&&a===null)?[]:[].concat(a);else{i=t.plainObjects?Object.create(null):{};var l=f.charAt(0)==="["&&f.charAt(f.length-1)==="]"?f.slice(1,-1):f,u=t.decodeDotInKeys?l.replace(/%2E/g,"."):l,s=parseInt(u,10);!t.parseArrays&&u===""?i={0:a}:!isNaN(s)&&f!==u&&String(s)===u&&s>=0&&t.parseArrays&&s<=t.arrayLimit?(i=[],i[s]=a):u!=="__proto__"&&(i[u]=a)}a=i}return a},Va=function(e,t,n,a){if(e){var o=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,i=/(\[[^[\]]*])/,f=/(\[[^[\]]*])/g,l=n.depth>0&&i.exec(o),u=l?o.slice(0,l.index):o,s=[];if(u){if(!n.plainObjects&&rr.call(Object.prototype,u)&&!n.allowPrototypes)return;s.push(u)}for(var p=0;n.depth>0&&(l=f.exec(o))!==null&&p<n.depth;){if(p+=1,!n.plainObjects&&rr.call(Object.prototype,l[1].slice(1,-1))&&!n.allowPrototypes)return;s.push(l[1])}if(l){if(n.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+n.depth+" and strictDepth is true");s.push("["+o.slice(l.index)+"]")}return Ka(s,t,n,a)}},Qa=function(e){if(!e)return b;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.decodeDotInKeys<"u"&&typeof e.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(e.decoder!==null&&typeof e.decoder<"u"&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=typeof e.charset>"u"?b.charset:e.charset,n=typeof e.duplicates>"u"?b.duplicates:e.duplicates;if(n!=="combine"&&n!=="first"&&n!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var a=typeof e.allowDots>"u"?e.decodeDotInKeys===!0?!0:b.allowDots:!!e.allowDots;return{allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:b.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:b.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:b.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:b.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:b.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:b.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:b.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:b.decoder,delimiter:typeof e.delimiter=="string"||ee.isRegExp(e.delimiter)?e.delimiter:b.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:b.depth,duplicates:n,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:b.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:b.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:b.plainObjects,strictDepth:typeof e.strictDepth=="boolean"?!!e.strictDepth:b.strictDepth,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:b.strictNullHandling}},ja=function(r,e){var t=Qa(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?Object.create(null):{};for(var n=typeof r=="string"?Ha(r,t):r,a=t.plainObjects?Object.create(null):{},o=Object.keys(n),i=0;i<o.length;++i){var f=o[i],l=Va(f,n[f],t,typeof r=="string");a=ee.merge(a,l,t)}return t.allowSparse===!0?a:ee.compact(a)},Ja=Wa,Xa=ja,Ya=sr,Za={formats:Ya,parse:Xa,stringify:Ja};const eo=Fr(Za);function Ur(r){if(!Array.isArray(r))throw new TypeError("Middleware stack must be an array!");for(const e of r)if(typeof e!="function")throw new TypeError("Middleware must be composed of functions!");return function(e,t){let n=-1;return a(0);function a(o){if(o<=n)return Promise.reject(new Error("next() called multiple times"));n=o;let i=r[o];if(o===r.length&&(i=t),!i)return Promise.resolve();try{return Promise.resolve(i(e,a.bind(null,o+1)))}catch(f){return Promise.reject(f)}}}}const w={app:null,appPending:!0,appCb:[],services:new Map,servicePending:new Map,serviceCb:new Map,config:null,configPending:!1,configCb:[]};async function ro(r){if(w.config)return w.config;if(w.configPending)return new Promise(t=>{w.configCb.push(n=>t(n))});w.configPending=!0;const e=await r();return w.config=e,w.configCb.forEach(t=>t(e)),w.configCb=[],w.configPending=!1,e}class to{constructor(e={},t){x(this,"options");x(this,"apis",[]);x(this,"middlewares",[]);x(this,"defaultMiddlewares",[async(e,t)=>{try{await t()}catch(n){e.res.body=n.message||""}}]);x(this,"api404");x(this,"fnMiddleware");x(this,"getId");x(this,"extensions",new Map);x(this,"config");x(this,"apiList");this.options={...e,baseUrl:e.baseUrl??"/"},this.options.baseUrl=this.options.baseUrl.split("/").map(a=>encodeURIComponent(a)).join("/"),this.middlewares.push(...this.defaultMiddlewares),this.middlewares.push(...e.middlewares||[]);const n=((e==null?void 0:e.apis)??[]).sort((a,o)=>{const i=o.path.substr(-1,1),f=i==="*"?0:i==="/"?.1:.2,l=a.path.substr(-1,1),u=l==="*"?0:l==="/"?.1:.2;return o.path.split("/").length+f-(a.path.split("/").length+u)}).map(a=>({...a,method:a.method??(e==null?void 0:e.defaultMethod)??"post"}));this.apiList=n,this.apis=n.filter(a=>!a.disabled),this.api404={path:"*",method:"all",action:(a,o)=>{throw o.res.status=404,Error("Not Found")}},this.fnMiddleware=Ur(this.middlewares),this.getId=vt({workerId:e.workId}),this.init(t)}async init(e){var t,n,a,o;try{if(this.options.config){const i=await this.options.config();this.config=i}await((n=(t=this.options)==null?void 0:t.onInit)==null?void 0:n.call(t,this)),w.app=this,w.appPending=!1,w.appCb.forEach(i=>i(this)),await((o=(a=this.options)==null?void 0:a.onReady)==null?void 0:o.call(a,this)),e==null||e(null,this)}catch(i){e==null||e(i,this)}}async fetchRaw(e,t,n){var c,d;const a=(n==null?void 0:n.url)??e,o=new URL(a,"http://localhost"),i=this.getId(),f={baseUrl:this.options.baseUrl??"",headers:(n==null?void 0:n.headers)??{},method:(n==null?void 0:n.method)??this.options.defaultMethod??"post",body:(n==null?void 0:n.body)??t,params:{},path:o.pathname,queryString:n!=null&&n.query?"?"+eo.stringify(n.query):o.search,query:(n==null?void 0:n.query)??Object.fromEntries(o.searchParams),url:a,reqId:i,requestId:i,ip:(n==null?void 0:n.ip)??"",namespace:(n==null?void 0:n.namespace)??"default"};let l=this.api404;for(let y=0;y<this.apis.length;y++){const m=this.apis[y];if((m.namespace??"default")===f.namespace&&(m.method==="all"||m.method===((d=(c=f.method)==null?void 0:c.toLowerCase)==null?void 0:d.call(c)))){const P=wt((this.options.baseUrl??"")+m.path,{loose:!1,trailing:!1})(f.path);if(P){f.params=P.params,l=m;break}}}const u={body:void 0,headers:{},status:200},s={app:this,currentAPI:l,req:f,request:f,reqId:i,requestId:i,res:u,response:u,platform:n==null?void 0:n.platform,config:this.config,meta:l.meta??{},service:{}},p=async()=>{var g,S;let y=f.body;if(l.bodySchema)if((g=l.bodySchema)!=null&&g.parse)try{y=l.bodySchema.parse(f.body)}catch(P){u.status=400;const h=(S=P==null?void 0:P.issues)==null?void 0:S[0];throw h&&(h.message=(h.path??[]).join(".")+" "+h.message),h?{...h,code:0}:new Error("参数错误")}else throw u.status=500,new Error("bodySchema must be ZodType");const m=await l.action(y,s);m!==void 0&&(u.body=m)};if(l.middlewares&&l.middlewares.length>0){const y=Ur(l.middlewares);await this.fnMiddleware(s,()=>y(s,p))}else await this.fnMiddleware(s,p);return s.res}async fetch(e,t,n){return(await this.fetchRaw(e,t,n)).body}mount(e,t){this.extensions.set(e,t)}get(e){return this.extensions.get(e)}}const no=Symbol("soon-api");function co(r){const e={...r};return e._soon_symbol=no,e}const ao=Symbol("soon-service");function so(r){async function e(){var o;const t=r.service;let n=w.services.get(t);if(n)return n;if(w.servicePending.get(t)){let i=w.serviceCb.get(t);return i||(i=[],w.serviceCb.set(t,i)),new Promise(f=>{i.push(l=>f(l))})}return w.servicePending.set(t,!0),await new Promise(i=>{w.app?i(1):w.appCb.push(()=>i(1))}),n=await t(w.app),w.services.set(t,n),(o=w.serviceCb.get(t))==null||o.forEach(i=>i(n)),w.serviceCb.delete(t),w.servicePending.delete(t),n}return e._soon_symbol=ao,e.serviceName=(r==null?void 0:r.serviceName)??"",e.autoInject=(r==null?void 0:r.autoInject)??!1,e.enableClient=(r==null?void 0:r.enableClient)??!1,e}function po(r){return r}function yo(r){return async function(){return await ro(r)}}async function mo(r){return await new Promise((e,t)=>{new to(r,(n,a)=>{if(n){t(n);return}e(a)})})}class ho extends Error{constructor(t,n){super(t);x(this,"code");this.code=n}}class vo extends Error{constructor(t,n){super(t);x(this,"status");this.status=n}}function go({pingTime:r=0,action:e}){let t=()=>null;const n=new Kr(a=>{let o;r>0&&(o=setInterval(()=>{f.closed?clearInterval(o):a.next({event:"ping",message:`: ping
1
+ var dt = Object.defineProperty;
2
+ var mt = (r, e, t) => e in r ? dt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var x = (r, e, t) => mt(r, typeof e != "symbol" ? e + "" : e, t);
4
+ import { PassThrough as ht } from "stream";
5
+ import { g as Fr, c as yr, u as vt } from "./deps/soon-id-96lbx7g47.js";
6
+ import gt from "util";
7
+ var k = {};
8
+ Object.defineProperty(k, "__esModule", { value: !0 });
9
+ k.TokenData = void 0;
10
+ k.parse = Oe;
11
+ k.compile = $t;
12
+ var wt = k.match = Ot;
13
+ k.pathToRegexp = Rt;
14
+ const bt = "/", tr = (r) => r, St = new RegExp("^\\p{XID_Continue}$", "u"), le = "https://git.new/pathToRegexpError", Et = {
15
+ "!": "!",
16
+ "@": "@",
17
+ ";": ";",
18
+ ",": ",",
19
+ "*": "*",
20
+ "+": "+",
21
+ "?": "?",
22
+ "{": "{",
23
+ "}": "}"
24
+ };
25
+ function At(r) {
26
+ const e = [...r], t = [];
27
+ let n = 0;
28
+ for (; n < e.length; ) {
29
+ const a = e[n], o = Et[a];
30
+ if (o) {
31
+ t.push({ type: o, index: n++, value: a });
32
+ continue;
33
+ }
34
+ if (a === "\\") {
35
+ t.push({ type: "ESCAPED", index: n++, value: e[n++] });
36
+ continue;
37
+ }
38
+ if (a === ":") {
39
+ let i = "";
40
+ for (; St.test(e[++n]); )
41
+ i += e[n];
42
+ if (!i)
43
+ throw new TypeError(`Missing parameter name at ${n}`);
44
+ t.push({ type: "NAME", index: n, value: i });
45
+ continue;
46
+ }
47
+ if (a === "(") {
48
+ const i = n++;
49
+ let f = 1, l = "";
50
+ if (e[n] === "?")
51
+ throw new TypeError(`Pattern cannot start with "?" at ${n}`);
52
+ for (; n < e.length; ) {
53
+ if (e[n] === "\\") {
54
+ l += e[n++] + e[n++];
55
+ continue;
56
+ }
57
+ if (e[n] === ")") {
58
+ if (f--, f === 0) {
59
+ n++;
60
+ break;
61
+ }
62
+ } else if (e[n] === "(" && (f++, e[n + 1] !== "?"))
63
+ throw new TypeError(`Capturing groups are not allowed at ${n}`);
64
+ l += e[n++];
65
+ }
66
+ if (f)
67
+ throw new TypeError(`Unbalanced pattern at ${i}`);
68
+ if (!l)
69
+ throw new TypeError(`Missing pattern at ${i}`);
70
+ t.push({ type: "PATTERN", index: n, value: l });
71
+ continue;
72
+ }
73
+ t.push({ type: "CHAR", index: n, value: e[n++] });
74
+ }
75
+ return t.push({ type: "END", index: n, value: "" }), new Pt(t);
76
+ }
77
+ class Pt {
78
+ constructor(e) {
79
+ this.tokens = e, this.index = 0;
80
+ }
81
+ peek() {
82
+ return this.tokens[this.index];
83
+ }
84
+ tryConsume(e) {
85
+ const t = this.peek();
86
+ if (t.type === e)
87
+ return this.index++, t.value;
88
+ }
89
+ consume(e) {
90
+ const t = this.tryConsume(e);
91
+ if (t !== void 0)
92
+ return t;
93
+ const { type: n, index: a } = this.peek();
94
+ throw new TypeError(`Unexpected ${n} at ${a}, expected ${e}: ${le}`);
95
+ }
96
+ text() {
97
+ let e = "", t;
98
+ for (; t = this.tryConsume("CHAR") || this.tryConsume("ESCAPED"); )
99
+ e += t;
100
+ return e;
101
+ }
102
+ modifier() {
103
+ return this.tryConsume("?") || this.tryConsume("*") || this.tryConsume("+");
104
+ }
105
+ }
106
+ class se {
107
+ constructor(e, t) {
108
+ this.tokens = e, this.delimiter = t;
109
+ }
110
+ }
111
+ k.TokenData = se;
112
+ function Oe(r, e = {}) {
113
+ const { encodePath: t = tr, delimiter: n = t(bt) } = e, a = [], o = At(r);
114
+ let i = 0;
115
+ do {
116
+ const f = o.text();
117
+ f && a.push(t(f));
118
+ const l = o.tryConsume("NAME"), u = o.tryConsume("PATTERN");
119
+ if (l || u) {
120
+ a.push({
121
+ name: l || String(i++),
122
+ pattern: u
123
+ });
124
+ const c = o.peek();
125
+ if (c.type === "*")
126
+ throw new TypeError(`Unexpected * at ${c.index}, you probably want \`/*\` or \`{/:foo}*\`: ${le}`);
127
+ continue;
128
+ }
129
+ if (o.tryConsume("*")) {
130
+ a.push({
131
+ name: String(i++),
132
+ pattern: `(?:(?!${J(n)}).)*`,
133
+ modifier: "*",
134
+ separator: n
135
+ });
136
+ continue;
137
+ }
138
+ if (o.tryConsume("{")) {
139
+ const c = o.text(), d = o.tryConsume("NAME"), y = o.tryConsume("PATTERN"), m = o.text(), g = o.tryConsume(";") && o.text();
140
+ o.consume("}");
141
+ const S = o.modifier();
142
+ a.push({
143
+ name: d || (y ? String(i++) : ""),
144
+ prefix: t(c),
145
+ suffix: t(m),
146
+ pattern: y,
147
+ modifier: S,
148
+ separator: g
149
+ });
150
+ continue;
151
+ }
152
+ o.consume("END");
153
+ break;
154
+ } while (!0);
155
+ return new se(a, n);
156
+ }
157
+ function $t(r, e = {}) {
158
+ const t = r instanceof se ? r : Oe(r, e);
159
+ return It(t, e);
160
+ }
161
+ function xt(r, e) {
162
+ if (typeof r == "string")
163
+ return () => r;
164
+ const t = e || tr, n = r.modifier === "+" || r.modifier === "*", a = r.modifier === "?" || r.modifier === "*", { prefix: o = "", suffix: i = "", separator: f = i + o } = r;
165
+ if (e && n) {
166
+ const u = (p, c) => {
167
+ if (typeof p != "string")
168
+ throw new TypeError(`Expected "${r.name}/${c}" to be a string`);
169
+ return t(p);
170
+ }, s = (p) => {
171
+ if (!Array.isArray(p))
172
+ throw new TypeError(`Expected "${r.name}" to be an array`);
173
+ return p.length === 0 ? "" : o + p.map(u).join(f) + i;
174
+ };
175
+ return a ? (p) => {
176
+ const c = p[r.name];
177
+ return c == null ? "" : c.length ? s(c) : "";
178
+ } : (p) => {
179
+ const c = p[r.name];
180
+ return s(c);
181
+ };
182
+ }
183
+ const l = (u) => {
184
+ if (typeof u != "string")
185
+ throw new TypeError(`Expected "${r.name}" to be a string`);
186
+ return o + t(u) + i;
187
+ };
188
+ return a ? (u) => {
189
+ const s = u[r.name];
190
+ return s == null ? "" : l(s);
191
+ } : (u) => {
192
+ const s = u[r.name];
193
+ return l(s);
194
+ };
195
+ }
196
+ function It(r, e) {
197
+ const { encode: t = encodeURIComponent, loose: n = !0, validate: a = !0, strict: o = !1 } = e, i = Lr(e), f = nr(n, r.delimiter), l = qr(r, f, [], i, o), u = r.tokens.map((s, p) => {
198
+ const c = xt(s, t);
199
+ if (!a || typeof s == "string")
200
+ return c;
201
+ const d = new RegExp(`^${l[p]}$`, i);
202
+ return (y) => {
203
+ const m = c(y);
204
+ if (!d.test(m))
205
+ throw new TypeError(`Invalid value for "${s.name}": ${JSON.stringify(m)}`);
206
+ return m;
207
+ };
208
+ });
209
+ return function(p = {}) {
210
+ let c = "";
211
+ for (const d of u)
212
+ c += d(p);
213
+ return c;
214
+ };
215
+ }
216
+ function Ot(r, e = {}) {
217
+ const { decode: t = decodeURIComponent, loose: n = !0 } = e, a = r instanceof se ? r : Oe(r, e), o = nr(n, a.delimiter), i = [], f = Wr(a, i, e), l = i.map((u) => {
218
+ if (t && (u.modifier === "+" || u.modifier === "*")) {
219
+ const { prefix: s = "", suffix: p = "", separator: c = p + s } = u, d = new RegExp(o(c), "g");
220
+ return (y) => y.split(d).map(t);
221
+ }
222
+ return t || tr;
223
+ });
224
+ return function(s) {
225
+ const p = f.exec(s);
226
+ if (!p)
227
+ return !1;
228
+ const { 0: c, index: d } = p, y = /* @__PURE__ */ Object.create(null);
229
+ for (let m = 1; m < p.length; m++) {
230
+ if (p[m] === void 0)
231
+ continue;
232
+ const g = i[m - 1], S = l[m - 1];
233
+ y[g.name] = S(p[m]);
234
+ }
235
+ return { path: c, index: d, params: y };
236
+ };
237
+ }
238
+ function J(r) {
239
+ return r.replace(/([.+*?^${}()[\]|/\\])/g, "\\$1");
240
+ }
241
+ function Tt(r, e) {
242
+ const t = J(r);
243
+ return e ? `(?:${t})+(?!${t})` : t;
244
+ }
245
+ function nr(r, e) {
246
+ if (!r)
247
+ return J;
248
+ const t = new RegExp(`(?:(?!${J(e)}).)+|(.)`, "g");
249
+ return (n) => n.replace(t, Tt);
250
+ }
251
+ function Lr(r) {
252
+ return r.sensitive ? "" : "i";
253
+ }
254
+ function Wr(r, e, t) {
255
+ const { trailing: n = !0, loose: a = !0, start: o = !0, end: i = !0, strict: f = !1 } = t, l = Lr(t), u = nr(a, r.delimiter), s = qr(r, u, e, l, f);
256
+ let p = o ? "^" : "";
257
+ return p += s.join(""), n && (p += `(?:${u(r.delimiter)})?`), p += i ? "$" : `(?=${J(r.delimiter)}|$)`, new RegExp(p, l);
258
+ }
259
+ function qr(r, e, t, n, a) {
260
+ const o = `(?:(?!${J(r.delimiter)}).)+?`;
261
+ let i = "", f = !0;
262
+ return r.tokens.map((l, u) => {
263
+ if (typeof l == "string")
264
+ return i = l, e(l);
265
+ const { prefix: s = "", suffix: p = "", separator: c = p + s, modifier: d = "" } = l, y = e(s), m = e(p);
266
+ if (l.name) {
267
+ const g = l.pattern ? `(?:${l.pattern})` : o, S = Ct(g, l.name, n);
268
+ if (f || (f = _e(S, s || i)), !f)
269
+ throw new TypeError(`Ambiguous pattern for "${l.name}": ${le}`);
270
+ if (f = !a || _e(S, p), i = "", t.push(l), d === "+" || d === "*") {
271
+ const P = d === "*" ? "?" : "", h = e(c);
272
+ if (!h)
273
+ throw new TypeError(`Missing separator for "${l.name}": ${le}`);
274
+ if (f || (f = !a || _e(S, c)), !f)
275
+ throw new TypeError(`Ambiguous pattern for "${l.name}" separator: ${le}`);
276
+ return f = !a, `(?:${y}(${g}(?:${h}${g})*)${m})${P}`;
277
+ }
278
+ return `(?:${y}(${g})${m})${d}`;
279
+ }
280
+ return `(?:${y}${m})${d}`;
281
+ });
282
+ }
283
+ function Ct(r, e, t) {
284
+ try {
285
+ return new RegExp(`^${r}$`, t);
286
+ } catch (n) {
287
+ throw new TypeError(`Invalid pattern for "${e}": ${n.message}`);
288
+ }
289
+ }
290
+ function _e(r, e) {
291
+ return e ? !r.test(e) : !1;
292
+ }
293
+ function Rt(r, e = {}) {
294
+ const t = r instanceof se ? r : Oe(r, e), n = [], a = Wr(t, n, e);
295
+ return Object.assign(a, { keys: n });
296
+ }
297
+ var Te = {};
298
+ Object.defineProperty(Te, "__esModule", {
299
+ value: !0
300
+ });
301
+ Te.Observable = void 0;
302
+ const Gr = (r) => !!Symbol[r], ar = (r) => Gr(r) ? Symbol[r] : "@@" + r, Dt = ar("iterator"), Ve = ar("observable"), kr = ar("species");
303
+ function Ae(r, e) {
304
+ let t = r[e];
305
+ if (t != null) {
306
+ if (typeof t != "function") throw new TypeError(t + " is not a function");
307
+ return t;
308
+ }
309
+ }
310
+ function oe(r) {
311
+ let e = r.constructor;
312
+ return e !== void 0 && (e = e[kr], e === null && (e = void 0)), e !== void 0 ? e : Ce;
313
+ }
314
+ function _t(r) {
315
+ return r instanceof Ce;
316
+ }
317
+ function X(r) {
318
+ X.log ? X.log(r) : setTimeout(() => {
319
+ throw r;
320
+ });
321
+ }
322
+ function we(r) {
323
+ Promise.resolve().then(() => {
324
+ try {
325
+ r();
326
+ } catch (e) {
327
+ X(e);
328
+ }
329
+ });
330
+ }
331
+ function zr(r) {
332
+ let e = r._cleanup;
333
+ if (e !== void 0 && (r._cleanup = void 0, !!e))
334
+ try {
335
+ if (typeof e == "function")
336
+ e();
337
+ else {
338
+ let t = Ae(e, "unsubscribe");
339
+ t && t.call(e);
340
+ }
341
+ } catch (t) {
342
+ X(t);
343
+ }
344
+ }
345
+ function Qe(r) {
346
+ r._observer = void 0, r._queue = void 0, r._state = "closed";
347
+ }
348
+ function Mt(r) {
349
+ let e = r._queue;
350
+ if (e) {
351
+ r._queue = void 0, r._state = "ready";
352
+ for (let t = 0; t < e.length && (Hr(r, e[t].type, e[t].value), r._state !== "closed"); ++t)
353
+ ;
354
+ }
355
+ }
356
+ function Hr(r, e, t) {
357
+ r._state = "running";
358
+ let n = r._observer;
359
+ try {
360
+ let a = Ae(n, e);
361
+ switch (e) {
362
+ case "next":
363
+ a && a.call(n, t);
364
+ break;
365
+ case "error":
366
+ if (Qe(r), a) a.call(n, t);
367
+ else throw t;
368
+ break;
369
+ case "complete":
370
+ Qe(r), a && a.call(n);
371
+ break;
372
+ }
373
+ } catch (a) {
374
+ X(a);
375
+ }
376
+ r._state === "closed" ? zr(r) : r._state === "running" && (r._state = "ready");
377
+ }
378
+ function Me(r, e, t) {
379
+ if (r._state !== "closed") {
380
+ if (r._state === "buffering") {
381
+ r._queue.push({
382
+ type: e,
383
+ value: t
384
+ });
385
+ return;
386
+ }
387
+ if (r._state !== "ready") {
388
+ r._state = "buffering", r._queue = [{
389
+ type: e,
390
+ value: t
391
+ }], we(() => Mt(r));
392
+ return;
393
+ }
394
+ Hr(r, e, t);
395
+ }
396
+ }
397
+ class Nt {
398
+ constructor(e, t) {
399
+ this._cleanup = void 0, this._observer = e, this._queue = void 0, this._state = "initializing";
400
+ let n = this, a = {
401
+ get closed() {
402
+ return n._state === "closed";
403
+ },
404
+ next(o) {
405
+ Me(n, "next", o);
406
+ },
407
+ error(o) {
408
+ Me(n, "error", o);
409
+ },
410
+ complete() {
411
+ Me(n, "complete");
412
+ }
413
+ };
414
+ try {
415
+ this._cleanup = t.call(void 0, a);
416
+ } catch (o) {
417
+ a.error(o);
418
+ }
419
+ this._state === "initializing" && (this._state = "ready");
420
+ }
421
+ get closed() {
422
+ return this._state === "closed";
423
+ }
424
+ unsubscribe() {
425
+ this._state !== "closed" && (Qe(this), zr(this));
426
+ }
427
+ }
428
+ let Ce = class be {
429
+ constructor(e) {
430
+ if (!(this instanceof be)) throw new TypeError("Observable cannot be called as a function");
431
+ if (typeof e != "function") throw new TypeError("Observable initializer must be a function");
432
+ this._subscriber = e;
433
+ }
434
+ subscribe(e) {
435
+ return (typeof e != "object" || e === null) && (e = {
436
+ next: e,
437
+ error: arguments[1],
438
+ complete: arguments[2]
439
+ }), new Nt(e, this._subscriber);
440
+ }
441
+ forEach(e) {
442
+ return new Promise((t, n) => {
443
+ if (typeof e != "function") {
444
+ n(new TypeError(e + " is not a function"));
445
+ return;
446
+ }
447
+ function a() {
448
+ o.unsubscribe(), t();
449
+ }
450
+ let o = this.subscribe({
451
+ next(i) {
452
+ try {
453
+ e(i, a);
454
+ } catch (f) {
455
+ n(f), o.unsubscribe();
456
+ }
457
+ },
458
+ error: n,
459
+ complete: t
460
+ });
461
+ });
462
+ }
463
+ map(e) {
464
+ if (typeof e != "function") throw new TypeError(e + " is not a function");
465
+ let t = oe(this);
466
+ return new t((n) => this.subscribe({
467
+ next(a) {
468
+ try {
469
+ a = e(a);
470
+ } catch (o) {
471
+ return n.error(o);
472
+ }
473
+ n.next(a);
474
+ },
475
+ error(a) {
476
+ n.error(a);
477
+ },
478
+ complete() {
479
+ n.complete();
480
+ }
481
+ }));
482
+ }
483
+ filter(e) {
484
+ if (typeof e != "function") throw new TypeError(e + " is not a function");
485
+ let t = oe(this);
486
+ return new t((n) => this.subscribe({
487
+ next(a) {
488
+ try {
489
+ if (!e(a)) return;
490
+ } catch (o) {
491
+ return n.error(o);
492
+ }
493
+ n.next(a);
494
+ },
495
+ error(a) {
496
+ n.error(a);
497
+ },
498
+ complete() {
499
+ n.complete();
500
+ }
501
+ }));
502
+ }
503
+ reduce(e) {
504
+ if (typeof e != "function") throw new TypeError(e + " is not a function");
505
+ let t = oe(this), n = arguments.length > 1, a = !1, i = arguments[1];
506
+ return new t((f) => this.subscribe({
507
+ next(l) {
508
+ let u = !a;
509
+ if (a = !0, !u || n)
510
+ try {
511
+ i = e(i, l);
512
+ } catch (s) {
513
+ return f.error(s);
514
+ }
515
+ else
516
+ i = l;
517
+ },
518
+ error(l) {
519
+ f.error(l);
520
+ },
521
+ complete() {
522
+ if (!a && !n) return f.error(new TypeError("Cannot reduce an empty sequence"));
523
+ f.next(i), f.complete();
524
+ }
525
+ }));
526
+ }
527
+ async all() {
528
+ let e = [];
529
+ return await this.forEach((t) => e.push(t)), e;
530
+ }
531
+ concat(...e) {
532
+ let t = oe(this);
533
+ return new t((n) => {
534
+ let a, o = 0;
535
+ function i(f) {
536
+ a = f.subscribe({
537
+ next(l) {
538
+ n.next(l);
539
+ },
540
+ error(l) {
541
+ n.error(l);
542
+ },
543
+ complete() {
544
+ o === e.length ? (a = void 0, n.complete()) : i(t.from(e[o++]));
545
+ }
546
+ });
547
+ }
548
+ return i(this), () => {
549
+ a && (a.unsubscribe(), a = void 0);
550
+ };
551
+ });
552
+ }
553
+ flatMap(e) {
554
+ if (typeof e != "function") throw new TypeError(e + " is not a function");
555
+ let t = oe(this);
556
+ return new t((n) => {
557
+ let a = [], o = this.subscribe({
558
+ next(f) {
559
+ if (e)
560
+ try {
561
+ f = e(f);
562
+ } catch (u) {
563
+ return n.error(u);
564
+ }
565
+ let l = t.from(f).subscribe({
566
+ next(u) {
567
+ n.next(u);
568
+ },
569
+ error(u) {
570
+ n.error(u);
571
+ },
572
+ complete() {
573
+ let u = a.indexOf(l);
574
+ u >= 0 && a.splice(u, 1), i();
575
+ }
576
+ });
577
+ a.push(l);
578
+ },
579
+ error(f) {
580
+ n.error(f);
581
+ },
582
+ complete() {
583
+ i();
584
+ }
585
+ });
586
+ function i() {
587
+ o.closed && a.length === 0 && n.complete();
588
+ }
589
+ return () => {
590
+ a.forEach((f) => f.unsubscribe()), o.unsubscribe();
591
+ };
592
+ });
593
+ }
594
+ [Ve]() {
595
+ return this;
596
+ }
597
+ static from(e) {
598
+ let t = typeof this == "function" ? this : be;
599
+ if (e == null) throw new TypeError(e + " is not an object");
600
+ let n = Ae(e, Ve);
601
+ if (n) {
602
+ let a = n.call(e);
603
+ if (Object(a) !== a) throw new TypeError(a + " is not an object");
604
+ return _t(a) && a.constructor === t ? a : new t((o) => a.subscribe(o));
605
+ }
606
+ if (Gr("iterator") && (n = Ae(e, Dt), n))
607
+ return new t((a) => {
608
+ we(() => {
609
+ if (!a.closed) {
610
+ for (let o of n.call(e))
611
+ if (a.next(o), a.closed) return;
612
+ a.complete();
613
+ }
614
+ });
615
+ });
616
+ if (Array.isArray(e))
617
+ return new t((a) => {
618
+ we(() => {
619
+ if (!a.closed) {
620
+ for (let o = 0; o < e.length; ++o)
621
+ if (a.next(e[o]), a.closed) return;
622
+ a.complete();
623
+ }
624
+ });
625
+ });
626
+ throw new TypeError(e + " is not observable");
627
+ }
628
+ static of(...e) {
629
+ let t = typeof this == "function" ? this : be;
630
+ return new t((n) => {
631
+ we(() => {
632
+ if (!n.closed) {
633
+ for (let a = 0; a < e.length; ++a)
634
+ if (n.next(e[a]), n.closed) return;
635
+ n.complete();
636
+ }
637
+ });
638
+ });
639
+ }
640
+ static get [kr]() {
641
+ return this;
642
+ }
643
+ };
644
+ Te.Observable = Ce;
645
+ Object.defineProperty(Ce, Symbol("extensions"), {
646
+ value: {
647
+ symbol: Ve,
648
+ hostReportError: X
649
+ },
650
+ configurable: !0
651
+ });
652
+ var Bt = Te.Observable;
653
+ const Kr = /* @__PURE__ */ Fr(Bt);
654
+ var Ut = Error, Ft = EvalError, Lt = RangeError, Wt = ReferenceError, Vr = SyntaxError, pe = TypeError, qt = URIError, Gt = function() {
655
+ if (typeof Symbol != "function" || typeof Object.getOwnPropertySymbols != "function")
656
+ return !1;
657
+ if (typeof Symbol.iterator == "symbol")
658
+ return !0;
659
+ var e = {}, t = Symbol("test"), n = Object(t);
660
+ if (typeof t == "string" || Object.prototype.toString.call(t) !== "[object Symbol]" || Object.prototype.toString.call(n) !== "[object Symbol]")
661
+ return !1;
662
+ var a = 42;
663
+ e[t] = a;
664
+ for (t in e)
665
+ return !1;
666
+ if (typeof Object.keys == "function" && Object.keys(e).length !== 0 || typeof Object.getOwnPropertyNames == "function" && Object.getOwnPropertyNames(e).length !== 0)
667
+ return !1;
668
+ var o = Object.getOwnPropertySymbols(e);
669
+ if (o.length !== 1 || o[0] !== t || !Object.prototype.propertyIsEnumerable.call(e, t))
670
+ return !1;
671
+ if (typeof Object.getOwnPropertyDescriptor == "function") {
672
+ var i = Object.getOwnPropertyDescriptor(e, t);
673
+ if (i.value !== a || i.enumerable !== !0)
674
+ return !1;
675
+ }
676
+ return !0;
677
+ }, dr = typeof Symbol < "u" && Symbol, kt = Gt, zt = function() {
678
+ return typeof dr != "function" || typeof Symbol != "function" || typeof dr("foo") != "symbol" || typeof Symbol("bar") != "symbol" ? !1 : kt();
679
+ }, Ne = {
680
+ __proto__: null,
681
+ foo: {}
682
+ }, Ht = Object, Kt = function() {
683
+ return { __proto__: Ne }.foo === Ne.foo && !(Ne instanceof Ht);
684
+ }, Vt = "Function.prototype.bind called on incompatible ", Qt = Object.prototype.toString, jt = Math.max, Jt = "[object Function]", mr = function(e, t) {
685
+ for (var n = [], a = 0; a < e.length; a += 1)
686
+ n[a] = e[a];
687
+ for (var o = 0; o < t.length; o += 1)
688
+ n[o + e.length] = t[o];
689
+ return n;
690
+ }, Xt = function(e, t) {
691
+ for (var n = [], a = t, o = 0; a < e.length; a += 1, o += 1)
692
+ n[o] = e[a];
693
+ return n;
694
+ }, Yt = function(r, e) {
695
+ for (var t = "", n = 0; n < r.length; n += 1)
696
+ t += r[n], n + 1 < r.length && (t += e);
697
+ return t;
698
+ }, Zt = function(e) {
699
+ var t = this;
700
+ if (typeof t != "function" || Qt.apply(t) !== Jt)
701
+ throw new TypeError(Vt + t);
702
+ for (var n = Xt(arguments, 1), a, o = function() {
703
+ if (this instanceof a) {
704
+ var s = t.apply(
705
+ this,
706
+ mr(n, arguments)
707
+ );
708
+ return Object(s) === s ? s : this;
709
+ }
710
+ return t.apply(
711
+ e,
712
+ mr(n, arguments)
713
+ );
714
+ }, i = jt(0, t.length - n.length), f = [], l = 0; l < i; l++)
715
+ f[l] = "$" + l;
716
+ if (a = Function("binder", "return function (" + Yt(f, ",") + "){ return binder.apply(this,arguments); }")(o), t.prototype) {
717
+ var u = function() {
718
+ };
719
+ u.prototype = t.prototype, a.prototype = new u(), u.prototype = null;
720
+ }
721
+ return a;
722
+ }, en = Zt, or = Function.prototype.bind || en, rn = Function.prototype.call, tn = Object.prototype.hasOwnProperty, nn = or, an = nn.call(rn, tn), v, on = Ut, ln = Ft, fn = Lt, un = Wt, Y = Vr, j = pe, cn = qt, Qr = Function, Be = function(r) {
723
+ try {
724
+ return Qr('"use strict"; return (' + r + ").constructor;")();
725
+ } catch {
726
+ }
727
+ }, q = Object.getOwnPropertyDescriptor;
728
+ if (q)
729
+ try {
730
+ q({}, "");
731
+ } catch {
732
+ q = null;
733
+ }
734
+ var Ue = function() {
735
+ throw new j();
736
+ }, sn = q ? function() {
737
+ try {
738
+ return arguments.callee, Ue;
739
+ } catch {
740
+ try {
741
+ return q(arguments, "callee").get;
742
+ } catch {
743
+ return Ue;
744
+ }
745
+ }
746
+ }() : Ue, K = zt(), pn = Kt(), A = Object.getPrototypeOf || (pn ? function(r) {
747
+ return r.__proto__;
748
+ } : null), Q = {}, yn = typeof Uint8Array > "u" || !A ? v : A(Uint8Array), G = {
749
+ __proto__: null,
750
+ "%AggregateError%": typeof AggregateError > "u" ? v : AggregateError,
751
+ "%Array%": Array,
752
+ "%ArrayBuffer%": typeof ArrayBuffer > "u" ? v : ArrayBuffer,
753
+ "%ArrayIteratorPrototype%": K && A ? A([][Symbol.iterator]()) : v,
754
+ "%AsyncFromSyncIteratorPrototype%": v,
755
+ "%AsyncFunction%": Q,
756
+ "%AsyncGenerator%": Q,
757
+ "%AsyncGeneratorFunction%": Q,
758
+ "%AsyncIteratorPrototype%": Q,
759
+ "%Atomics%": typeof Atomics > "u" ? v : Atomics,
760
+ "%BigInt%": typeof BigInt > "u" ? v : BigInt,
761
+ "%BigInt64Array%": typeof BigInt64Array > "u" ? v : BigInt64Array,
762
+ "%BigUint64Array%": typeof BigUint64Array > "u" ? v : BigUint64Array,
763
+ "%Boolean%": Boolean,
764
+ "%DataView%": typeof DataView > "u" ? v : DataView,
765
+ "%Date%": Date,
766
+ "%decodeURI%": decodeURI,
767
+ "%decodeURIComponent%": decodeURIComponent,
768
+ "%encodeURI%": encodeURI,
769
+ "%encodeURIComponent%": encodeURIComponent,
770
+ "%Error%": on,
771
+ "%eval%": eval,
772
+ // eslint-disable-line no-eval
773
+ "%EvalError%": ln,
774
+ "%Float32Array%": typeof Float32Array > "u" ? v : Float32Array,
775
+ "%Float64Array%": typeof Float64Array > "u" ? v : Float64Array,
776
+ "%FinalizationRegistry%": typeof FinalizationRegistry > "u" ? v : FinalizationRegistry,
777
+ "%Function%": Qr,
778
+ "%GeneratorFunction%": Q,
779
+ "%Int8Array%": typeof Int8Array > "u" ? v : Int8Array,
780
+ "%Int16Array%": typeof Int16Array > "u" ? v : Int16Array,
781
+ "%Int32Array%": typeof Int32Array > "u" ? v : Int32Array,
782
+ "%isFinite%": isFinite,
783
+ "%isNaN%": isNaN,
784
+ "%IteratorPrototype%": K && A ? A(A([][Symbol.iterator]())) : v,
785
+ "%JSON%": typeof JSON == "object" ? JSON : v,
786
+ "%Map%": typeof Map > "u" ? v : Map,
787
+ "%MapIteratorPrototype%": typeof Map > "u" || !K || !A ? v : A((/* @__PURE__ */ new Map())[Symbol.iterator]()),
788
+ "%Math%": Math,
789
+ "%Number%": Number,
790
+ "%Object%": Object,
791
+ "%parseFloat%": parseFloat,
792
+ "%parseInt%": parseInt,
793
+ "%Promise%": typeof Promise > "u" ? v : Promise,
794
+ "%Proxy%": typeof Proxy > "u" ? v : Proxy,
795
+ "%RangeError%": fn,
796
+ "%ReferenceError%": un,
797
+ "%Reflect%": typeof Reflect > "u" ? v : Reflect,
798
+ "%RegExp%": RegExp,
799
+ "%Set%": typeof Set > "u" ? v : Set,
800
+ "%SetIteratorPrototype%": typeof Set > "u" || !K || !A ? v : A((/* @__PURE__ */ new Set())[Symbol.iterator]()),
801
+ "%SharedArrayBuffer%": typeof SharedArrayBuffer > "u" ? v : SharedArrayBuffer,
802
+ "%String%": String,
803
+ "%StringIteratorPrototype%": K && A ? A(""[Symbol.iterator]()) : v,
804
+ "%Symbol%": K ? Symbol : v,
805
+ "%SyntaxError%": Y,
806
+ "%ThrowTypeError%": sn,
807
+ "%TypedArray%": yn,
808
+ "%TypeError%": j,
809
+ "%Uint8Array%": typeof Uint8Array > "u" ? v : Uint8Array,
810
+ "%Uint8ClampedArray%": typeof Uint8ClampedArray > "u" ? v : Uint8ClampedArray,
811
+ "%Uint16Array%": typeof Uint16Array > "u" ? v : Uint16Array,
812
+ "%Uint32Array%": typeof Uint32Array > "u" ? v : Uint32Array,
813
+ "%URIError%": cn,
814
+ "%WeakMap%": typeof WeakMap > "u" ? v : WeakMap,
815
+ "%WeakRef%": typeof WeakRef > "u" ? v : WeakRef,
816
+ "%WeakSet%": typeof WeakSet > "u" ? v : WeakSet
817
+ };
818
+ if (A)
819
+ try {
820
+ null.error;
821
+ } catch (r) {
822
+ var dn = A(A(r));
823
+ G["%Error.prototype%"] = dn;
824
+ }
825
+ var mn = function r(e) {
826
+ var t;
827
+ if (e === "%AsyncFunction%")
828
+ t = Be("async function () {}");
829
+ else if (e === "%GeneratorFunction%")
830
+ t = Be("function* () {}");
831
+ else if (e === "%AsyncGeneratorFunction%")
832
+ t = Be("async function* () {}");
833
+ else if (e === "%AsyncGenerator%") {
834
+ var n = r("%AsyncGeneratorFunction%");
835
+ n && (t = n.prototype);
836
+ } else if (e === "%AsyncIteratorPrototype%") {
837
+ var a = r("%AsyncGenerator%");
838
+ a && A && (t = A(a.prototype));
839
+ }
840
+ return G[e] = t, t;
841
+ }, hr = {
842
+ __proto__: null,
843
+ "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
844
+ "%ArrayPrototype%": ["Array", "prototype"],
845
+ "%ArrayProto_entries%": ["Array", "prototype", "entries"],
846
+ "%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
847
+ "%ArrayProto_keys%": ["Array", "prototype", "keys"],
848
+ "%ArrayProto_values%": ["Array", "prototype", "values"],
849
+ "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
850
+ "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
851
+ "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
852
+ "%BooleanPrototype%": ["Boolean", "prototype"],
853
+ "%DataViewPrototype%": ["DataView", "prototype"],
854
+ "%DatePrototype%": ["Date", "prototype"],
855
+ "%ErrorPrototype%": ["Error", "prototype"],
856
+ "%EvalErrorPrototype%": ["EvalError", "prototype"],
857
+ "%Float32ArrayPrototype%": ["Float32Array", "prototype"],
858
+ "%Float64ArrayPrototype%": ["Float64Array", "prototype"],
859
+ "%FunctionPrototype%": ["Function", "prototype"],
860
+ "%Generator%": ["GeneratorFunction", "prototype"],
861
+ "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
862
+ "%Int8ArrayPrototype%": ["Int8Array", "prototype"],
863
+ "%Int16ArrayPrototype%": ["Int16Array", "prototype"],
864
+ "%Int32ArrayPrototype%": ["Int32Array", "prototype"],
865
+ "%JSONParse%": ["JSON", "parse"],
866
+ "%JSONStringify%": ["JSON", "stringify"],
867
+ "%MapPrototype%": ["Map", "prototype"],
868
+ "%NumberPrototype%": ["Number", "prototype"],
869
+ "%ObjectPrototype%": ["Object", "prototype"],
870
+ "%ObjProto_toString%": ["Object", "prototype", "toString"],
871
+ "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
872
+ "%PromisePrototype%": ["Promise", "prototype"],
873
+ "%PromiseProto_then%": ["Promise", "prototype", "then"],
874
+ "%Promise_all%": ["Promise", "all"],
875
+ "%Promise_reject%": ["Promise", "reject"],
876
+ "%Promise_resolve%": ["Promise", "resolve"],
877
+ "%RangeErrorPrototype%": ["RangeError", "prototype"],
878
+ "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
879
+ "%RegExpPrototype%": ["RegExp", "prototype"],
880
+ "%SetPrototype%": ["Set", "prototype"],
881
+ "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
882
+ "%StringPrototype%": ["String", "prototype"],
883
+ "%SymbolPrototype%": ["Symbol", "prototype"],
884
+ "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
885
+ "%TypedArrayPrototype%": ["TypedArray", "prototype"],
886
+ "%TypeErrorPrototype%": ["TypeError", "prototype"],
887
+ "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
888
+ "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
889
+ "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
890
+ "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
891
+ "%URIErrorPrototype%": ["URIError", "prototype"],
892
+ "%WeakMapPrototype%": ["WeakMap", "prototype"],
893
+ "%WeakSetPrototype%": ["WeakSet", "prototype"]
894
+ }, ye = or, Pe = an, hn = ye.call(Function.call, Array.prototype.concat), vn = ye.call(Function.apply, Array.prototype.splice), vr = ye.call(Function.call, String.prototype.replace), $e = ye.call(Function.call, String.prototype.slice), gn = ye.call(Function.call, RegExp.prototype.exec), wn = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, bn = /\\(\\)?/g, Sn = function(e) {
895
+ var t = $e(e, 0, 1), n = $e(e, -1);
896
+ if (t === "%" && n !== "%")
897
+ throw new Y("invalid intrinsic syntax, expected closing `%`");
898
+ if (n === "%" && t !== "%")
899
+ throw new Y("invalid intrinsic syntax, expected opening `%`");
900
+ var a = [];
901
+ return vr(e, wn, function(o, i, f, l) {
902
+ a[a.length] = f ? vr(l, bn, "$1") : i || o;
903
+ }), a;
904
+ }, En = function(e, t) {
905
+ var n = e, a;
906
+ if (Pe(hr, n) && (a = hr[n], n = "%" + a[0] + "%"), Pe(G, n)) {
907
+ var o = G[n];
908
+ if (o === Q && (o = mn(n)), typeof o > "u" && !t)
909
+ throw new j("intrinsic " + e + " exists, but is not available. Please file an issue!");
910
+ return {
911
+ alias: a,
912
+ name: n,
913
+ value: o
914
+ };
915
+ }
916
+ throw new Y("intrinsic " + e + " does not exist!");
917
+ }, re = function(e, t) {
918
+ if (typeof e != "string" || e.length === 0)
919
+ throw new j("intrinsic name must be a non-empty string");
920
+ if (arguments.length > 1 && typeof t != "boolean")
921
+ throw new j('"allowMissing" argument must be a boolean');
922
+ if (gn(/^%?[^%]*%?$/, e) === null)
923
+ throw new Y("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
924
+ var n = Sn(e), a = n.length > 0 ? n[0] : "", o = En("%" + a + "%", t), i = o.name, f = o.value, l = !1, u = o.alias;
925
+ u && (a = u[0], vn(n, hn([0, 1], u)));
926
+ for (var s = 1, p = !0; s < n.length; s += 1) {
927
+ var c = n[s], d = $e(c, 0, 1), y = $e(c, -1);
928
+ if ((d === '"' || d === "'" || d === "`" || y === '"' || y === "'" || y === "`") && d !== y)
929
+ throw new Y("property names with quotes must have matching quotes");
930
+ if ((c === "constructor" || !p) && (l = !0), a += "." + c, i = "%" + a + "%", Pe(G, i))
931
+ f = G[i];
932
+ else if (f != null) {
933
+ if (!(c in f)) {
934
+ if (!t)
935
+ throw new j("base intrinsic for " + e + " exists, but the property is not available.");
936
+ return;
937
+ }
938
+ if (q && s + 1 >= n.length) {
939
+ var m = q(f, c);
940
+ p = !!m, p && "get" in m && !("originalValue" in m.get) ? f = m.get : f = f[c];
941
+ } else
942
+ p = Pe(f, c), f = f[c];
943
+ p && !l && (G[i] = f);
944
+ }
945
+ }
946
+ return f;
947
+ }, jr = { exports: {} }, Fe, gr;
948
+ function ir() {
949
+ if (gr) return Fe;
950
+ gr = 1;
951
+ var r = re, e = r("%Object.defineProperty%", !0) || !1;
952
+ if (e)
953
+ try {
954
+ e({}, "a", { value: 1 });
955
+ } catch {
956
+ e = !1;
957
+ }
958
+ return Fe = e, Fe;
959
+ }
960
+ var An = re, Se = An("%Object.getOwnPropertyDescriptor%", !0);
961
+ if (Se)
962
+ try {
963
+ Se([], "length");
964
+ } catch {
965
+ Se = null;
966
+ }
967
+ var Jr = Se, wr = ir(), Pn = Vr, V = pe, br = Jr, $n = function(e, t, n) {
968
+ if (!e || typeof e != "object" && typeof e != "function")
969
+ throw new V("`obj` must be an object or a function`");
970
+ if (typeof t != "string" && typeof t != "symbol")
971
+ throw new V("`property` must be a string or a symbol`");
972
+ if (arguments.length > 3 && typeof arguments[3] != "boolean" && arguments[3] !== null)
973
+ throw new V("`nonEnumerable`, if provided, must be a boolean or null");
974
+ if (arguments.length > 4 && typeof arguments[4] != "boolean" && arguments[4] !== null)
975
+ throw new V("`nonWritable`, if provided, must be a boolean or null");
976
+ if (arguments.length > 5 && typeof arguments[5] != "boolean" && arguments[5] !== null)
977
+ throw new V("`nonConfigurable`, if provided, must be a boolean or null");
978
+ if (arguments.length > 6 && typeof arguments[6] != "boolean")
979
+ throw new V("`loose`, if provided, must be a boolean");
980
+ var a = arguments.length > 3 ? arguments[3] : null, o = arguments.length > 4 ? arguments[4] : null, i = arguments.length > 5 ? arguments[5] : null, f = arguments.length > 6 ? arguments[6] : !1, l = !!br && br(e, t);
981
+ if (wr)
982
+ wr(e, t, {
983
+ configurable: i === null && l ? l.configurable : !i,
984
+ enumerable: a === null && l ? l.enumerable : !a,
985
+ value: n,
986
+ writable: o === null && l ? l.writable : !o
987
+ });
988
+ else if (f || !a && !o && !i)
989
+ e[t] = n;
990
+ else
991
+ throw new Pn("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
992
+ }, je = ir(), Xr = function() {
993
+ return !!je;
994
+ };
995
+ Xr.hasArrayLengthDefineBug = function() {
996
+ if (!je)
997
+ return null;
998
+ try {
999
+ return je([], "length", { value: 1 }).length !== 1;
1000
+ } catch {
1001
+ return !0;
1002
+ }
1003
+ };
1004
+ var xn = Xr, In = re, Sr = $n, On = xn(), Er = Jr, Ar = pe, Tn = In("%Math.floor%"), Cn = function(e, t) {
1005
+ if (typeof e != "function")
1006
+ throw new Ar("`fn` is not a function");
1007
+ if (typeof t != "number" || t < 0 || t > 4294967295 || Tn(t) !== t)
1008
+ throw new Ar("`length` must be a positive 32-bit integer");
1009
+ var n = arguments.length > 2 && !!arguments[2], a = !0, o = !0;
1010
+ if ("length" in e && Er) {
1011
+ var i = Er(e, "length");
1012
+ i && !i.configurable && (a = !1), i && !i.writable && (o = !1);
1013
+ }
1014
+ return (a || o || !n) && (On ? Sr(
1015
+ /** @type {Parameters<define>[0]} */
1016
+ e,
1017
+ "length",
1018
+ t,
1019
+ !0,
1020
+ !0
1021
+ ) : Sr(
1022
+ /** @type {Parameters<define>[0]} */
1023
+ e,
1024
+ "length",
1025
+ t
1026
+ )), e;
1027
+ };
1028
+ (function(r) {
1029
+ var e = or, t = re, n = Cn, a = pe, o = t("%Function.prototype.apply%"), i = t("%Function.prototype.call%"), f = t("%Reflect.apply%", !0) || e.call(i, o), l = ir(), u = t("%Math.max%");
1030
+ r.exports = function(c) {
1031
+ if (typeof c != "function")
1032
+ throw new a("a function is required");
1033
+ var d = f(e, i, arguments);
1034
+ return n(
1035
+ d,
1036
+ 1 + u(0, c.length - (arguments.length - 1)),
1037
+ !0
1038
+ );
1039
+ };
1040
+ var s = function() {
1041
+ return f(e, o, arguments);
1042
+ };
1043
+ l ? l(r.exports, "apply", { value: s }) : r.exports.apply = s;
1044
+ })(jr);
1045
+ var Rn = jr.exports, Yr = re, Zr = Rn, Dn = Zr(Yr("String.prototype.indexOf")), _n = function(e, t) {
1046
+ var n = Yr(e, !!t);
1047
+ return typeof n == "function" && Dn(e, ".prototype.") > -1 ? Zr(n) : n;
1048
+ }, Mn = gt.inspect, lr = typeof Map == "function" && Map.prototype, Le = Object.getOwnPropertyDescriptor && lr ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, xe = lr && Le && typeof Le.get == "function" ? Le.get : null, Pr = lr && Map.prototype.forEach, fr = typeof Set == "function" && Set.prototype, We = Object.getOwnPropertyDescriptor && fr ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, Ie = fr && We && typeof We.get == "function" ? We.get : null, $r = fr && Set.prototype.forEach, Nn = typeof WeakMap == "function" && WeakMap.prototype, fe = Nn ? WeakMap.prototype.has : null, Bn = typeof WeakSet == "function" && WeakSet.prototype, ue = Bn ? WeakSet.prototype.has : null, Un = typeof WeakRef == "function" && WeakRef.prototype, xr = Un ? WeakRef.prototype.deref : null, Fn = Boolean.prototype.valueOf, Ln = Object.prototype.toString, Wn = Function.prototype.toString, qn = String.prototype.match, ur = String.prototype.slice, B = String.prototype.replace, Gn = String.prototype.toUpperCase, Ir = String.prototype.toLowerCase, et = RegExp.prototype.test, Or = Array.prototype.concat, C = Array.prototype.join, kn = Array.prototype.slice, Tr = Math.floor, Je = typeof BigInt == "function" ? BigInt.prototype.valueOf : null, qe = Object.getOwnPropertySymbols, Xe = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Symbol.prototype.toString : null, Z = typeof Symbol == "function" && typeof Symbol.iterator == "object", $ = typeof Symbol == "function" && Symbol.toStringTag && (typeof Symbol.toStringTag === Z || !0) ? Symbol.toStringTag : null, rt = Object.prototype.propertyIsEnumerable, Cr = (typeof Reflect == "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(r) {
1049
+ return r.__proto__;
1050
+ } : null);
1051
+ function Rr(r, e) {
1052
+ if (r === 1 / 0 || r === -1 / 0 || r !== r || r && r > -1e3 && r < 1e3 || et.call(/e/, e))
1053
+ return e;
1054
+ var t = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
1055
+ if (typeof r == "number") {
1056
+ var n = r < 0 ? -Tr(-r) : Tr(r);
1057
+ if (n !== r) {
1058
+ var a = String(n), o = ur.call(e, a.length + 1);
1059
+ return B.call(a, t, "$&_") + "." + B.call(B.call(o, /([0-9]{3})/g, "$&_"), /_$/, "");
1060
+ }
1061
+ }
1062
+ return B.call(e, t, "$&_");
1063
+ }
1064
+ var Ye = Mn, Dr = Ye.custom, _r = nt(Dr) ? Dr : null, zn = function r(e, t, n, a) {
1065
+ var o = t || {};
1066
+ if (N(o, "quoteStyle") && o.quoteStyle !== "single" && o.quoteStyle !== "double")
1067
+ throw new TypeError('option "quoteStyle" must be "single" or "double"');
1068
+ if (N(o, "maxStringLength") && (typeof o.maxStringLength == "number" ? o.maxStringLength < 0 && o.maxStringLength !== 1 / 0 : o.maxStringLength !== null))
1069
+ throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
1070
+ var i = N(o, "customInspect") ? o.customInspect : !0;
1071
+ if (typeof i != "boolean" && i !== "symbol")
1072
+ throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");
1073
+ if (N(o, "indent") && o.indent !== null && o.indent !== " " && !(parseInt(o.indent, 10) === o.indent && o.indent > 0))
1074
+ throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
1075
+ if (N(o, "numericSeparator") && typeof o.numericSeparator != "boolean")
1076
+ throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
1077
+ var f = o.numericSeparator;
1078
+ if (typeof e > "u")
1079
+ return "undefined";
1080
+ if (e === null)
1081
+ return "null";
1082
+ if (typeof e == "boolean")
1083
+ return e ? "true" : "false";
1084
+ if (typeof e == "string")
1085
+ return ot(e, o);
1086
+ if (typeof e == "number") {
1087
+ if (e === 0)
1088
+ return 1 / 0 / e > 0 ? "0" : "-0";
1089
+ var l = String(e);
1090
+ return f ? Rr(e, l) : l;
1091
+ }
1092
+ if (typeof e == "bigint") {
1093
+ var u = String(e) + "n";
1094
+ return f ? Rr(e, u) : u;
1095
+ }
1096
+ var s = typeof o.depth > "u" ? 5 : o.depth;
1097
+ if (typeof n > "u" && (n = 0), n >= s && s > 0 && typeof e == "object")
1098
+ return Ze(e) ? "[Array]" : "[Object]";
1099
+ var p = fa(o, n);
1100
+ if (typeof a > "u")
1101
+ a = [];
1102
+ else if (at(a, e) >= 0)
1103
+ return "[Circular]";
1104
+ function c(I, _, M) {
1105
+ if (_ && (a = kn.call(a), a.push(_)), M) {
1106
+ var ae = {
1107
+ depth: o.depth
1108
+ };
1109
+ return N(o, "quoteStyle") && (ae.quoteStyle = o.quoteStyle), r(I, ae, n + 1, a);
1110
+ }
1111
+ return r(I, o, n + 1, a);
1112
+ }
1113
+ if (typeof e == "function" && !Mr(e)) {
1114
+ var d = Zn(e), y = he(e, c);
1115
+ return "[Function" + (d ? ": " + d : " (anonymous)") + "]" + (y.length > 0 ? " { " + C.call(y, ", ") + " }" : "");
1116
+ }
1117
+ if (nt(e)) {
1118
+ var m = Z ? B.call(String(e), /^(Symbol\(.*\))_[^)]*$/, "$1") : Xe.call(e);
1119
+ return typeof e == "object" && !Z ? ie(m) : m;
1120
+ }
1121
+ if (oa(e)) {
1122
+ for (var g = "<" + Ir.call(String(e.nodeName)), S = e.attributes || [], P = 0; P < S.length; P++)
1123
+ g += " " + S[P].name + "=" + tt(Hn(S[P].value), "double", o);
1124
+ return g += ">", e.childNodes && e.childNodes.length && (g += "..."), g += "</" + Ir.call(String(e.nodeName)) + ">", g;
1125
+ }
1126
+ if (Ze(e)) {
1127
+ if (e.length === 0)
1128
+ return "[]";
1129
+ var h = he(e, c);
1130
+ return p && !la(h) ? "[" + er(h, p) + "]" : "[ " + C.call(h, ", ") + " ]";
1131
+ }
1132
+ if (Vn(e)) {
1133
+ var R = he(e, c);
1134
+ return !("cause" in Error.prototype) && "cause" in e && !rt.call(e, "cause") ? "{ [" + String(e) + "] " + C.call(Or.call("[cause]: " + c(e.cause), R), ", ") + " }" : R.length === 0 ? "[" + String(e) + "]" : "{ [" + String(e) + "] " + C.call(R, ", ") + " }";
1135
+ }
1136
+ if (typeof e == "object" && i) {
1137
+ if (_r && typeof e[_r] == "function" && Ye)
1138
+ return Ye(e, { depth: s - n });
1139
+ if (i !== "symbol" && typeof e.inspect == "function")
1140
+ return e.inspect();
1141
+ }
1142
+ if (ea(e)) {
1143
+ var F = [];
1144
+ return Pr && Pr.call(e, function(I, _) {
1145
+ F.push(c(_, e, !0) + " => " + c(I, e));
1146
+ }), Nr("Map", xe.call(e), F, p);
1147
+ }
1148
+ if (na(e)) {
1149
+ var ne = [];
1150
+ return $r && $r.call(e, function(I) {
1151
+ ne.push(c(I, e));
1152
+ }), Nr("Set", Ie.call(e), ne, p);
1153
+ }
1154
+ if (ra(e))
1155
+ return Ge("WeakMap");
1156
+ if (aa(e))
1157
+ return Ge("WeakSet");
1158
+ if (ta(e))
1159
+ return Ge("WeakRef");
1160
+ if (jn(e))
1161
+ return ie(c(Number(e)));
1162
+ if (Xn(e))
1163
+ return ie(c(Je.call(e)));
1164
+ if (Jn(e))
1165
+ return ie(Fn.call(e));
1166
+ if (Qn(e))
1167
+ return ie(c(String(e)));
1168
+ if (typeof window < "u" && e === window)
1169
+ return "{ [object Window] }";
1170
+ if (typeof globalThis < "u" && e === globalThis || typeof yr < "u" && e === yr)
1171
+ return "{ [object globalThis] }";
1172
+ if (!Kn(e) && !Mr(e)) {
1173
+ var z = he(e, c), de = Cr ? Cr(e) === Object.prototype : e instanceof Object || e.constructor === Object, L = e instanceof Object ? "" : "null prototype", D = !de && $ && Object(e) === e && $ in e ? ur.call(U(e), 8, -1) : L ? "Object" : "", me = de || typeof e.constructor != "function" ? "" : e.constructor.name ? e.constructor.name + " " : "", H = me + (D || L ? "[" + C.call(Or.call([], D || [], L || []), ": ") + "] " : "");
1174
+ return z.length === 0 ? H + "{}" : p ? H + "{" + er(z, p) + "}" : H + "{ " + C.call(z, ", ") + " }";
1175
+ }
1176
+ return String(e);
1177
+ };
1178
+ function tt(r, e, t) {
1179
+ var n = (t.quoteStyle || e) === "double" ? '"' : "'";
1180
+ return n + r + n;
1181
+ }
1182
+ function Hn(r) {
1183
+ return B.call(String(r), /"/g, "&quot;");
1184
+ }
1185
+ function Ze(r) {
1186
+ return U(r) === "[object Array]" && (!$ || !(typeof r == "object" && $ in r));
1187
+ }
1188
+ function Kn(r) {
1189
+ return U(r) === "[object Date]" && (!$ || !(typeof r == "object" && $ in r));
1190
+ }
1191
+ function Mr(r) {
1192
+ return U(r) === "[object RegExp]" && (!$ || !(typeof r == "object" && $ in r));
1193
+ }
1194
+ function Vn(r) {
1195
+ return U(r) === "[object Error]" && (!$ || !(typeof r == "object" && $ in r));
1196
+ }
1197
+ function Qn(r) {
1198
+ return U(r) === "[object String]" && (!$ || !(typeof r == "object" && $ in r));
1199
+ }
1200
+ function jn(r) {
1201
+ return U(r) === "[object Number]" && (!$ || !(typeof r == "object" && $ in r));
1202
+ }
1203
+ function Jn(r) {
1204
+ return U(r) === "[object Boolean]" && (!$ || !(typeof r == "object" && $ in r));
1205
+ }
1206
+ function nt(r) {
1207
+ if (Z)
1208
+ return r && typeof r == "object" && r instanceof Symbol;
1209
+ if (typeof r == "symbol")
1210
+ return !0;
1211
+ if (!r || typeof r != "object" || !Xe)
1212
+ return !1;
1213
+ try {
1214
+ return Xe.call(r), !0;
1215
+ } catch {
1216
+ }
1217
+ return !1;
1218
+ }
1219
+ function Xn(r) {
1220
+ if (!r || typeof r != "object" || !Je)
1221
+ return !1;
1222
+ try {
1223
+ return Je.call(r), !0;
1224
+ } catch {
1225
+ }
1226
+ return !1;
1227
+ }
1228
+ var Yn = Object.prototype.hasOwnProperty || function(r) {
1229
+ return r in this;
1230
+ };
1231
+ function N(r, e) {
1232
+ return Yn.call(r, e);
1233
+ }
1234
+ function U(r) {
1235
+ return Ln.call(r);
1236
+ }
1237
+ function Zn(r) {
1238
+ if (r.name)
1239
+ return r.name;
1240
+ var e = qn.call(Wn.call(r), /^function\s*([\w$]+)/);
1241
+ return e ? e[1] : null;
1242
+ }
1243
+ function at(r, e) {
1244
+ if (r.indexOf)
1245
+ return r.indexOf(e);
1246
+ for (var t = 0, n = r.length; t < n; t++)
1247
+ if (r[t] === e)
1248
+ return t;
1249
+ return -1;
1250
+ }
1251
+ function ea(r) {
1252
+ if (!xe || !r || typeof r != "object")
1253
+ return !1;
1254
+ try {
1255
+ xe.call(r);
1256
+ try {
1257
+ Ie.call(r);
1258
+ } catch {
1259
+ return !0;
1260
+ }
1261
+ return r instanceof Map;
1262
+ } catch {
1263
+ }
1264
+ return !1;
1265
+ }
1266
+ function ra(r) {
1267
+ if (!fe || !r || typeof r != "object")
1268
+ return !1;
1269
+ try {
1270
+ fe.call(r, fe);
1271
+ try {
1272
+ ue.call(r, ue);
1273
+ } catch {
1274
+ return !0;
1275
+ }
1276
+ return r instanceof WeakMap;
1277
+ } catch {
1278
+ }
1279
+ return !1;
1280
+ }
1281
+ function ta(r) {
1282
+ if (!xr || !r || typeof r != "object")
1283
+ return !1;
1284
+ try {
1285
+ return xr.call(r), !0;
1286
+ } catch {
1287
+ }
1288
+ return !1;
1289
+ }
1290
+ function na(r) {
1291
+ if (!Ie || !r || typeof r != "object")
1292
+ return !1;
1293
+ try {
1294
+ Ie.call(r);
1295
+ try {
1296
+ xe.call(r);
1297
+ } catch {
1298
+ return !0;
1299
+ }
1300
+ return r instanceof Set;
1301
+ } catch {
1302
+ }
1303
+ return !1;
1304
+ }
1305
+ function aa(r) {
1306
+ if (!ue || !r || typeof r != "object")
1307
+ return !1;
1308
+ try {
1309
+ ue.call(r, ue);
1310
+ try {
1311
+ fe.call(r, fe);
1312
+ } catch {
1313
+ return !0;
1314
+ }
1315
+ return r instanceof WeakSet;
1316
+ } catch {
1317
+ }
1318
+ return !1;
1319
+ }
1320
+ function oa(r) {
1321
+ return !r || typeof r != "object" ? !1 : typeof HTMLElement < "u" && r instanceof HTMLElement ? !0 : typeof r.nodeName == "string" && typeof r.getAttribute == "function";
1322
+ }
1323
+ function ot(r, e) {
1324
+ if (r.length > e.maxStringLength) {
1325
+ var t = r.length - e.maxStringLength, n = "... " + t + " more character" + (t > 1 ? "s" : "");
1326
+ return ot(ur.call(r, 0, e.maxStringLength), e) + n;
1327
+ }
1328
+ var a = B.call(B.call(r, /(['\\])/g, "\\$1"), /[\x00-\x1f]/g, ia);
1329
+ return tt(a, "single", e);
1330
+ }
1331
+ function ia(r) {
1332
+ var e = r.charCodeAt(0), t = {
1333
+ 8: "b",
1334
+ 9: "t",
1335
+ 10: "n",
1336
+ 12: "f",
1337
+ 13: "r"
1338
+ }[e];
1339
+ return t ? "\\" + t : "\\x" + (e < 16 ? "0" : "") + Gn.call(e.toString(16));
1340
+ }
1341
+ function ie(r) {
1342
+ return "Object(" + r + ")";
1343
+ }
1344
+ function Ge(r) {
1345
+ return r + " { ? }";
1346
+ }
1347
+ function Nr(r, e, t, n) {
1348
+ var a = n ? er(t, n) : C.call(t, ", ");
1349
+ return r + " (" + e + ") {" + a + "}";
1350
+ }
1351
+ function la(r) {
1352
+ for (var e = 0; e < r.length; e++)
1353
+ if (at(r[e], `
1354
+ `) >= 0)
1355
+ return !1;
1356
+ return !0;
1357
+ }
1358
+ function fa(r, e) {
1359
+ var t;
1360
+ if (r.indent === " ")
1361
+ t = " ";
1362
+ else if (typeof r.indent == "number" && r.indent > 0)
1363
+ t = C.call(Array(r.indent + 1), " ");
1364
+ else
1365
+ return null;
1366
+ return {
1367
+ base: t,
1368
+ prev: C.call(Array(e + 1), t)
1369
+ };
1370
+ }
1371
+ function er(r, e) {
1372
+ if (r.length === 0)
1373
+ return "";
1374
+ var t = `
1375
+ ` + e.prev + e.base;
1376
+ return t + C.call(r, "," + t) + `
1377
+ ` + e.prev;
1378
+ }
1379
+ function he(r, e) {
1380
+ var t = Ze(r), n = [];
1381
+ if (t) {
1382
+ n.length = r.length;
1383
+ for (var a = 0; a < r.length; a++)
1384
+ n[a] = N(r, a) ? e(r[a], r) : "";
1385
+ }
1386
+ var o = typeof qe == "function" ? qe(r) : [], i;
1387
+ if (Z) {
1388
+ i = {};
1389
+ for (var f = 0; f < o.length; f++)
1390
+ i["$" + o[f]] = o[f];
1391
+ }
1392
+ for (var l in r)
1393
+ N(r, l) && (t && String(Number(l)) === l && l < r.length || Z && i["$" + l] instanceof Symbol || (et.call(/[^\w$]/, l) ? n.push(e(l, r) + ": " + e(r[l], r)) : n.push(l + ": " + e(r[l], r))));
1394
+ if (typeof qe == "function")
1395
+ for (var u = 0; u < o.length; u++)
1396
+ rt.call(r, o[u]) && n.push("[" + e(o[u]) + "]: " + e(r[o[u]], r));
1397
+ return n;
1398
+ }
1399
+ var it = re, te = _n, ua = zn, ca = pe, ve = it("%WeakMap%", !0), ge = it("%Map%", !0), sa = te("WeakMap.prototype.get", !0), pa = te("WeakMap.prototype.set", !0), ya = te("WeakMap.prototype.has", !0), da = te("Map.prototype.get", !0), ma = te("Map.prototype.set", !0), ha = te("Map.prototype.has", !0), cr = function(r, e) {
1400
+ for (var t = r, n; (n = t.next) !== null; t = n)
1401
+ if (n.key === e)
1402
+ return t.next = n.next, n.next = /** @type {NonNullable<typeof list.next>} */
1403
+ r.next, r.next = n, n;
1404
+ }, va = function(r, e) {
1405
+ var t = cr(r, e);
1406
+ return t && t.value;
1407
+ }, ga = function(r, e, t) {
1408
+ var n = cr(r, e);
1409
+ n ? n.value = t : r.next = /** @type {import('.').ListNode<typeof value>} */
1410
+ {
1411
+ // eslint-disable-line no-param-reassign, no-extra-parens
1412
+ key: e,
1413
+ next: r.next,
1414
+ value: t
1415
+ };
1416
+ }, wa = function(r, e) {
1417
+ return !!cr(r, e);
1418
+ }, ba = function() {
1419
+ var e, t, n, a = {
1420
+ assert: function(o) {
1421
+ if (!a.has(o))
1422
+ throw new ca("Side channel does not contain " + ua(o));
1423
+ },
1424
+ get: function(o) {
1425
+ if (ve && o && (typeof o == "object" || typeof o == "function")) {
1426
+ if (e)
1427
+ return sa(e, o);
1428
+ } else if (ge) {
1429
+ if (t)
1430
+ return da(t, o);
1431
+ } else if (n)
1432
+ return va(n, o);
1433
+ },
1434
+ has: function(o) {
1435
+ if (ve && o && (typeof o == "object" || typeof o == "function")) {
1436
+ if (e)
1437
+ return ya(e, o);
1438
+ } else if (ge) {
1439
+ if (t)
1440
+ return ha(t, o);
1441
+ } else if (n)
1442
+ return wa(n, o);
1443
+ return !1;
1444
+ },
1445
+ set: function(o, i) {
1446
+ ve && o && (typeof o == "object" || typeof o == "function") ? (e || (e = new ve()), pa(e, o, i)) : ge ? (t || (t = new ge()), ma(t, o, i)) : (n || (n = { key: {}, next: null }), ga(n, o, i));
1447
+ }
1448
+ };
1449
+ return a;
1450
+ }, Sa = String.prototype.replace, Ea = /%20/g, ke = {
1451
+ RFC1738: "RFC1738",
1452
+ RFC3986: "RFC3986"
1453
+ }, sr = {
1454
+ default: ke.RFC3986,
1455
+ formatters: {
1456
+ RFC1738: function(r) {
1457
+ return Sa.call(r, Ea, "+");
1458
+ },
1459
+ RFC3986: function(r) {
1460
+ return String(r);
1461
+ }
1462
+ },
1463
+ RFC1738: ke.RFC1738,
1464
+ RFC3986: ke.RFC3986
1465
+ }, Aa = sr, ze = Object.prototype.hasOwnProperty, W = Array.isArray, O = function() {
1466
+ for (var r = [], e = 0; e < 256; ++e)
1467
+ r.push("%" + ((e < 16 ? "0" : "") + e.toString(16)).toUpperCase());
1468
+ return r;
1469
+ }(), Pa = function(e) {
1470
+ for (; e.length > 1; ) {
1471
+ var t = e.pop(), n = t.obj[t.prop];
1472
+ if (W(n)) {
1473
+ for (var a = [], o = 0; o < n.length; ++o)
1474
+ typeof n[o] < "u" && a.push(n[o]);
1475
+ t.obj[t.prop] = a;
1476
+ }
1477
+ }
1478
+ }, lt = function(e, t) {
1479
+ for (var n = t && t.plainObjects ? /* @__PURE__ */ Object.create(null) : {}, a = 0; a < e.length; ++a)
1480
+ typeof e[a] < "u" && (n[a] = e[a]);
1481
+ return n;
1482
+ }, $a = function r(e, t, n) {
1483
+ if (!t)
1484
+ return e;
1485
+ if (typeof t != "object") {
1486
+ if (W(e))
1487
+ e.push(t);
1488
+ else if (e && typeof e == "object")
1489
+ (n && (n.plainObjects || n.allowPrototypes) || !ze.call(Object.prototype, t)) && (e[t] = !0);
1490
+ else
1491
+ return [e, t];
1492
+ return e;
1493
+ }
1494
+ if (!e || typeof e != "object")
1495
+ return [e].concat(t);
1496
+ var a = e;
1497
+ return W(e) && !W(t) && (a = lt(e, n)), W(e) && W(t) ? (t.forEach(function(o, i) {
1498
+ if (ze.call(e, i)) {
1499
+ var f = e[i];
1500
+ f && typeof f == "object" && o && typeof o == "object" ? e[i] = r(f, o, n) : e.push(o);
1501
+ } else
1502
+ e[i] = o;
1503
+ }), e) : Object.keys(t).reduce(function(o, i) {
1504
+ var f = t[i];
1505
+ return ze.call(o, i) ? o[i] = r(o[i], f, n) : o[i] = f, o;
1506
+ }, a);
1507
+ }, xa = function(e, t) {
1508
+ return Object.keys(t).reduce(function(n, a) {
1509
+ return n[a] = t[a], n;
1510
+ }, e);
1511
+ }, Ia = function(r, e, t) {
1512
+ var n = r.replace(/\+/g, " ");
1513
+ if (t === "iso-8859-1")
1514
+ return n.replace(/%[0-9a-f]{2}/gi, unescape);
1515
+ try {
1516
+ return decodeURIComponent(n);
1517
+ } catch {
1518
+ return n;
1519
+ }
1520
+ }, He = 1024, Oa = function(e, t, n, a, o) {
1521
+ if (e.length === 0)
1522
+ return e;
1523
+ var i = e;
1524
+ if (typeof e == "symbol" ? i = Symbol.prototype.toString.call(e) : typeof e != "string" && (i = String(e)), n === "iso-8859-1")
1525
+ return escape(i).replace(/%u[0-9a-f]{4}/gi, function(d) {
1526
+ return "%26%23" + parseInt(d.slice(2), 16) + "%3B";
1527
+ });
1528
+ for (var f = "", l = 0; l < i.length; l += He) {
1529
+ for (var u = i.length >= He ? i.slice(l, l + He) : i, s = [], p = 0; p < u.length; ++p) {
1530
+ var c = u.charCodeAt(p);
1531
+ if (c === 45 || c === 46 || c === 95 || c === 126 || c >= 48 && c <= 57 || c >= 65 && c <= 90 || c >= 97 && c <= 122 || o === Aa.RFC1738 && (c === 40 || c === 41)) {
1532
+ s[s.length] = u.charAt(p);
1533
+ continue;
1534
+ }
1535
+ if (c < 128) {
1536
+ s[s.length] = O[c];
1537
+ continue;
1538
+ }
1539
+ if (c < 2048) {
1540
+ s[s.length] = O[192 | c >> 6] + O[128 | c & 63];
1541
+ continue;
1542
+ }
1543
+ if (c < 55296 || c >= 57344) {
1544
+ s[s.length] = O[224 | c >> 12] + O[128 | c >> 6 & 63] + O[128 | c & 63];
1545
+ continue;
1546
+ }
1547
+ p += 1, c = 65536 + ((c & 1023) << 10 | u.charCodeAt(p) & 1023), s[s.length] = O[240 | c >> 18] + O[128 | c >> 12 & 63] + O[128 | c >> 6 & 63] + O[128 | c & 63];
1548
+ }
1549
+ f += s.join("");
1550
+ }
1551
+ return f;
1552
+ }, Ta = function(e) {
1553
+ for (var t = [{ obj: { o: e }, prop: "o" }], n = [], a = 0; a < t.length; ++a)
1554
+ for (var o = t[a], i = o.obj[o.prop], f = Object.keys(i), l = 0; l < f.length; ++l) {
1555
+ var u = f[l], s = i[u];
1556
+ typeof s == "object" && s !== null && n.indexOf(s) === -1 && (t.push({ obj: i, prop: u }), n.push(s));
1557
+ }
1558
+ return Pa(t), e;
1559
+ }, Ca = function(e) {
1560
+ return Object.prototype.toString.call(e) === "[object RegExp]";
1561
+ }, Ra = function(e) {
1562
+ return !e || typeof e != "object" ? !1 : !!(e.constructor && e.constructor.isBuffer && e.constructor.isBuffer(e));
1563
+ }, Da = function(e, t) {
1564
+ return [].concat(e, t);
1565
+ }, _a = function(e, t) {
1566
+ if (W(e)) {
1567
+ for (var n = [], a = 0; a < e.length; a += 1)
1568
+ n.push(t(e[a]));
1569
+ return n;
1570
+ }
1571
+ return t(e);
1572
+ }, ft = {
1573
+ arrayToObject: lt,
1574
+ assign: xa,
1575
+ combine: Da,
1576
+ compact: Ta,
1577
+ decode: Ia,
1578
+ encode: Oa,
1579
+ isBuffer: Ra,
1580
+ isRegExp: Ca,
1581
+ maybeMap: _a,
1582
+ merge: $a
1583
+ }, ut = ba, Ee = ft, ce = sr, Ma = Object.prototype.hasOwnProperty, ct = {
1584
+ brackets: function(e) {
1585
+ return e + "[]";
1586
+ },
1587
+ comma: "comma",
1588
+ indices: function(e, t) {
1589
+ return e + "[" + t + "]";
1590
+ },
1591
+ repeat: function(e) {
1592
+ return e;
1593
+ }
1594
+ }, T = Array.isArray, Na = Array.prototype.push, st = function(r, e) {
1595
+ Na.apply(r, T(e) ? e : [e]);
1596
+ }, Ba = Date.prototype.toISOString, Br = ce.default, E = {
1597
+ addQueryPrefix: !1,
1598
+ allowDots: !1,
1599
+ allowEmptyArrays: !1,
1600
+ arrayFormat: "indices",
1601
+ charset: "utf-8",
1602
+ charsetSentinel: !1,
1603
+ delimiter: "&",
1604
+ encode: !0,
1605
+ encodeDotInKeys: !1,
1606
+ encoder: Ee.encode,
1607
+ encodeValuesOnly: !1,
1608
+ format: Br,
1609
+ formatter: ce.formatters[Br],
1610
+ // deprecated
1611
+ indices: !1,
1612
+ serializeDate: function(e) {
1613
+ return Ba.call(e);
1614
+ },
1615
+ skipNulls: !1,
1616
+ strictNullHandling: !1
1617
+ }, Ua = function(e) {
1618
+ return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "symbol" || typeof e == "bigint";
1619
+ }, Ke = {}, Fa = function r(e, t, n, a, o, i, f, l, u, s, p, c, d, y, m, g, S, P) {
1620
+ for (var h = e, R = P, F = 0, ne = !1; (R = R.get(Ke)) !== void 0 && !ne; ) {
1621
+ var z = R.get(e);
1622
+ if (F += 1, typeof z < "u") {
1623
+ if (z === F)
1624
+ throw new RangeError("Cyclic object value");
1625
+ ne = !0;
1626
+ }
1627
+ typeof R.get(Ke) > "u" && (F = 0);
1628
+ }
1629
+ if (typeof s == "function" ? h = s(t, h) : h instanceof Date ? h = d(h) : n === "comma" && T(h) && (h = Ee.maybeMap(h, function(De) {
1630
+ return De instanceof Date ? d(De) : De;
1631
+ })), h === null) {
1632
+ if (i)
1633
+ return u && !g ? u(t, E.encoder, S, "key", y) : t;
1634
+ h = "";
1635
+ }
1636
+ if (Ua(h) || Ee.isBuffer(h)) {
1637
+ if (u) {
1638
+ var de = g ? t : u(t, E.encoder, S, "key", y);
1639
+ return [m(de) + "=" + m(u(h, E.encoder, S, "value", y))];
1640
+ }
1641
+ return [m(t) + "=" + m(String(h))];
1642
+ }
1643
+ var L = [];
1644
+ if (typeof h > "u")
1645
+ return L;
1646
+ var D;
1647
+ if (n === "comma" && T(h))
1648
+ g && u && (h = Ee.maybeMap(h, u)), D = [{ value: h.length > 0 ? h.join(",") || null : void 0 }];
1649
+ else if (T(s))
1650
+ D = s;
1651
+ else {
1652
+ var me = Object.keys(h);
1653
+ D = p ? me.sort(p) : me;
1654
+ }
1655
+ var H = l ? t.replace(/\./g, "%2E") : t, I = a && T(h) && h.length === 1 ? H + "[]" : H;
1656
+ if (o && T(h) && h.length === 0)
1657
+ return I + "[]";
1658
+ for (var _ = 0; _ < D.length; ++_) {
1659
+ var M = D[_], ae = typeof M == "object" && typeof M.value < "u" ? M.value : h[M];
1660
+ if (!(f && ae === null)) {
1661
+ var Re = c && l ? M.replace(/\./g, "%2E") : M, yt = T(h) ? typeof n == "function" ? n(I, Re) : I : I + (c ? "." + Re : "[" + Re + "]");
1662
+ P.set(e, F);
1663
+ var pr = ut();
1664
+ pr.set(Ke, P), st(L, r(
1665
+ ae,
1666
+ yt,
1667
+ n,
1668
+ a,
1669
+ o,
1670
+ i,
1671
+ f,
1672
+ l,
1673
+ n === "comma" && g && T(h) ? null : u,
1674
+ s,
1675
+ p,
1676
+ c,
1677
+ d,
1678
+ y,
1679
+ m,
1680
+ g,
1681
+ S,
1682
+ pr
1683
+ ));
1684
+ }
1685
+ }
1686
+ return L;
1687
+ }, La = function(e) {
1688
+ if (!e)
1689
+ return E;
1690
+ if (typeof e.allowEmptyArrays < "u" && typeof e.allowEmptyArrays != "boolean")
1691
+ throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
1692
+ if (typeof e.encodeDotInKeys < "u" && typeof e.encodeDotInKeys != "boolean")
1693
+ throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");
1694
+ if (e.encoder !== null && typeof e.encoder < "u" && typeof e.encoder != "function")
1695
+ throw new TypeError("Encoder has to be a function.");
1696
+ var t = e.charset || E.charset;
1697
+ if (typeof e.charset < "u" && e.charset !== "utf-8" && e.charset !== "iso-8859-1")
1698
+ throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
1699
+ var n = ce.default;
1700
+ if (typeof e.format < "u") {
1701
+ if (!Ma.call(ce.formatters, e.format))
1702
+ throw new TypeError("Unknown format option provided.");
1703
+ n = e.format;
1704
+ }
1705
+ var a = ce.formatters[n], o = E.filter;
1706
+ (typeof e.filter == "function" || T(e.filter)) && (o = e.filter);
1707
+ var i;
1708
+ if (e.arrayFormat in ct ? i = e.arrayFormat : "indices" in e ? i = e.indices ? "indices" : "repeat" : i = E.arrayFormat, "commaRoundTrip" in e && typeof e.commaRoundTrip != "boolean")
1709
+ throw new TypeError("`commaRoundTrip` must be a boolean, or absent");
1710
+ var f = typeof e.allowDots > "u" ? e.encodeDotInKeys === !0 ? !0 : E.allowDots : !!e.allowDots;
1711
+ return {
1712
+ addQueryPrefix: typeof e.addQueryPrefix == "boolean" ? e.addQueryPrefix : E.addQueryPrefix,
1713
+ allowDots: f,
1714
+ allowEmptyArrays: typeof e.allowEmptyArrays == "boolean" ? !!e.allowEmptyArrays : E.allowEmptyArrays,
1715
+ arrayFormat: i,
1716
+ charset: t,
1717
+ charsetSentinel: typeof e.charsetSentinel == "boolean" ? e.charsetSentinel : E.charsetSentinel,
1718
+ commaRoundTrip: e.commaRoundTrip,
1719
+ delimiter: typeof e.delimiter > "u" ? E.delimiter : e.delimiter,
1720
+ encode: typeof e.encode == "boolean" ? e.encode : E.encode,
1721
+ encodeDotInKeys: typeof e.encodeDotInKeys == "boolean" ? e.encodeDotInKeys : E.encodeDotInKeys,
1722
+ encoder: typeof e.encoder == "function" ? e.encoder : E.encoder,
1723
+ encodeValuesOnly: typeof e.encodeValuesOnly == "boolean" ? e.encodeValuesOnly : E.encodeValuesOnly,
1724
+ filter: o,
1725
+ format: n,
1726
+ formatter: a,
1727
+ serializeDate: typeof e.serializeDate == "function" ? e.serializeDate : E.serializeDate,
1728
+ skipNulls: typeof e.skipNulls == "boolean" ? e.skipNulls : E.skipNulls,
1729
+ sort: typeof e.sort == "function" ? e.sort : null,
1730
+ strictNullHandling: typeof e.strictNullHandling == "boolean" ? e.strictNullHandling : E.strictNullHandling
1731
+ };
1732
+ }, Wa = function(r, e) {
1733
+ var t = r, n = La(e), a, o;
1734
+ typeof n.filter == "function" ? (o = n.filter, t = o("", t)) : T(n.filter) && (o = n.filter, a = o);
1735
+ var i = [];
1736
+ if (typeof t != "object" || t === null)
1737
+ return "";
1738
+ var f = ct[n.arrayFormat], l = f === "comma" && n.commaRoundTrip;
1739
+ a || (a = Object.keys(t)), n.sort && a.sort(n.sort);
1740
+ for (var u = ut(), s = 0; s < a.length; ++s) {
1741
+ var p = a[s];
1742
+ n.skipNulls && t[p] === null || st(i, Fa(
1743
+ t[p],
1744
+ p,
1745
+ f,
1746
+ l,
1747
+ n.allowEmptyArrays,
1748
+ n.strictNullHandling,
1749
+ n.skipNulls,
1750
+ n.encodeDotInKeys,
1751
+ n.encode ? n.encoder : null,
1752
+ n.filter,
1753
+ n.sort,
1754
+ n.allowDots,
1755
+ n.serializeDate,
1756
+ n.format,
1757
+ n.formatter,
1758
+ n.encodeValuesOnly,
1759
+ n.charset,
1760
+ u
1761
+ ));
1762
+ }
1763
+ var c = i.join(n.delimiter), d = n.addQueryPrefix === !0 ? "?" : "";
1764
+ return n.charsetSentinel && (n.charset === "iso-8859-1" ? d += "utf8=%26%2310003%3B&" : d += "utf8=%E2%9C%93&"), c.length > 0 ? d + c : "";
1765
+ }, ee = ft, rr = Object.prototype.hasOwnProperty, qa = Array.isArray, b = {
1766
+ allowDots: !1,
1767
+ allowEmptyArrays: !1,
1768
+ allowPrototypes: !1,
1769
+ allowSparse: !1,
1770
+ arrayLimit: 20,
1771
+ charset: "utf-8",
1772
+ charsetSentinel: !1,
1773
+ comma: !1,
1774
+ decodeDotInKeys: !1,
1775
+ decoder: ee.decode,
1776
+ delimiter: "&",
1777
+ depth: 5,
1778
+ duplicates: "combine",
1779
+ ignoreQueryPrefix: !1,
1780
+ interpretNumericEntities: !1,
1781
+ parameterLimit: 1e3,
1782
+ parseArrays: !0,
1783
+ plainObjects: !1,
1784
+ strictDepth: !1,
1785
+ strictNullHandling: !1
1786
+ }, Ga = function(r) {
1787
+ return r.replace(/&#(\d+);/g, function(e, t) {
1788
+ return String.fromCharCode(parseInt(t, 10));
1789
+ });
1790
+ }, pt = function(r, e) {
1791
+ return r && typeof r == "string" && e.comma && r.indexOf(",") > -1 ? r.split(",") : r;
1792
+ }, ka = "utf8=%26%2310003%3B", za = "utf8=%E2%9C%93", Ha = function(e, t) {
1793
+ var n = { __proto__: null }, a = t.ignoreQueryPrefix ? e.replace(/^\?/, "") : e;
1794
+ a = a.replace(/%5B/gi, "[").replace(/%5D/gi, "]");
1795
+ var o = t.parameterLimit === 1 / 0 ? void 0 : t.parameterLimit, i = a.split(t.delimiter, o), f = -1, l, u = t.charset;
1796
+ if (t.charsetSentinel)
1797
+ for (l = 0; l < i.length; ++l)
1798
+ i[l].indexOf("utf8=") === 0 && (i[l] === za ? u = "utf-8" : i[l] === ka && (u = "iso-8859-1"), f = l, l = i.length);
1799
+ for (l = 0; l < i.length; ++l)
1800
+ if (l !== f) {
1801
+ var s = i[l], p = s.indexOf("]="), c = p === -1 ? s.indexOf("=") : p + 1, d, y;
1802
+ c === -1 ? (d = t.decoder(s, b.decoder, u, "key"), y = t.strictNullHandling ? null : "") : (d = t.decoder(s.slice(0, c), b.decoder, u, "key"), y = ee.maybeMap(
1803
+ pt(s.slice(c + 1), t),
1804
+ function(g) {
1805
+ return t.decoder(g, b.decoder, u, "value");
1806
+ }
1807
+ )), y && t.interpretNumericEntities && u === "iso-8859-1" && (y = Ga(y)), s.indexOf("[]=") > -1 && (y = qa(y) ? [y] : y);
1808
+ var m = rr.call(n, d);
1809
+ m && t.duplicates === "combine" ? n[d] = ee.combine(n[d], y) : (!m || t.duplicates === "last") && (n[d] = y);
1810
+ }
1811
+ return n;
1812
+ }, Ka = function(r, e, t, n) {
1813
+ for (var a = n ? e : pt(e, t), o = r.length - 1; o >= 0; --o) {
1814
+ var i, f = r[o];
1815
+ if (f === "[]" && t.parseArrays)
1816
+ i = t.allowEmptyArrays && (a === "" || t.strictNullHandling && a === null) ? [] : [].concat(a);
1817
+ else {
1818
+ i = t.plainObjects ? /* @__PURE__ */ Object.create(null) : {};
1819
+ var l = f.charAt(0) === "[" && f.charAt(f.length - 1) === "]" ? f.slice(1, -1) : f, u = t.decodeDotInKeys ? l.replace(/%2E/g, ".") : l, s = parseInt(u, 10);
1820
+ !t.parseArrays && u === "" ? i = { 0: a } : !isNaN(s) && f !== u && String(s) === u && s >= 0 && t.parseArrays && s <= t.arrayLimit ? (i = [], i[s] = a) : u !== "__proto__" && (i[u] = a);
1821
+ }
1822
+ a = i;
1823
+ }
1824
+ return a;
1825
+ }, Va = function(e, t, n, a) {
1826
+ if (e) {
1827
+ var o = n.allowDots ? e.replace(/\.([^.[]+)/g, "[$1]") : e, i = /(\[[^[\]]*])/, f = /(\[[^[\]]*])/g, l = n.depth > 0 && i.exec(o), u = l ? o.slice(0, l.index) : o, s = [];
1828
+ if (u) {
1829
+ if (!n.plainObjects && rr.call(Object.prototype, u) && !n.allowPrototypes)
1830
+ return;
1831
+ s.push(u);
1832
+ }
1833
+ for (var p = 0; n.depth > 0 && (l = f.exec(o)) !== null && p < n.depth; ) {
1834
+ if (p += 1, !n.plainObjects && rr.call(Object.prototype, l[1].slice(1, -1)) && !n.allowPrototypes)
1835
+ return;
1836
+ s.push(l[1]);
1837
+ }
1838
+ if (l) {
1839
+ if (n.strictDepth === !0)
1840
+ throw new RangeError("Input depth exceeded depth option of " + n.depth + " and strictDepth is true");
1841
+ s.push("[" + o.slice(l.index) + "]");
1842
+ }
1843
+ return Ka(s, t, n, a);
1844
+ }
1845
+ }, Qa = function(e) {
1846
+ if (!e)
1847
+ return b;
1848
+ if (typeof e.allowEmptyArrays < "u" && typeof e.allowEmptyArrays != "boolean")
1849
+ throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
1850
+ if (typeof e.decodeDotInKeys < "u" && typeof e.decodeDotInKeys != "boolean")
1851
+ throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");
1852
+ if (e.decoder !== null && typeof e.decoder < "u" && typeof e.decoder != "function")
1853
+ throw new TypeError("Decoder has to be a function.");
1854
+ if (typeof e.charset < "u" && e.charset !== "utf-8" && e.charset !== "iso-8859-1")
1855
+ throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
1856
+ var t = typeof e.charset > "u" ? b.charset : e.charset, n = typeof e.duplicates > "u" ? b.duplicates : e.duplicates;
1857
+ if (n !== "combine" && n !== "first" && n !== "last")
1858
+ throw new TypeError("The duplicates option must be either combine, first, or last");
1859
+ var a = typeof e.allowDots > "u" ? e.decodeDotInKeys === !0 ? !0 : b.allowDots : !!e.allowDots;
1860
+ return {
1861
+ allowDots: a,
1862
+ allowEmptyArrays: typeof e.allowEmptyArrays == "boolean" ? !!e.allowEmptyArrays : b.allowEmptyArrays,
1863
+ allowPrototypes: typeof e.allowPrototypes == "boolean" ? e.allowPrototypes : b.allowPrototypes,
1864
+ allowSparse: typeof e.allowSparse == "boolean" ? e.allowSparse : b.allowSparse,
1865
+ arrayLimit: typeof e.arrayLimit == "number" ? e.arrayLimit : b.arrayLimit,
1866
+ charset: t,
1867
+ charsetSentinel: typeof e.charsetSentinel == "boolean" ? e.charsetSentinel : b.charsetSentinel,
1868
+ comma: typeof e.comma == "boolean" ? e.comma : b.comma,
1869
+ decodeDotInKeys: typeof e.decodeDotInKeys == "boolean" ? e.decodeDotInKeys : b.decodeDotInKeys,
1870
+ decoder: typeof e.decoder == "function" ? e.decoder : b.decoder,
1871
+ delimiter: typeof e.delimiter == "string" || ee.isRegExp(e.delimiter) ? e.delimiter : b.delimiter,
1872
+ // eslint-disable-next-line no-implicit-coercion, no-extra-parens
1873
+ depth: typeof e.depth == "number" || e.depth === !1 ? +e.depth : b.depth,
1874
+ duplicates: n,
1875
+ ignoreQueryPrefix: e.ignoreQueryPrefix === !0,
1876
+ interpretNumericEntities: typeof e.interpretNumericEntities == "boolean" ? e.interpretNumericEntities : b.interpretNumericEntities,
1877
+ parameterLimit: typeof e.parameterLimit == "number" ? e.parameterLimit : b.parameterLimit,
1878
+ parseArrays: e.parseArrays !== !1,
1879
+ plainObjects: typeof e.plainObjects == "boolean" ? e.plainObjects : b.plainObjects,
1880
+ strictDepth: typeof e.strictDepth == "boolean" ? !!e.strictDepth : b.strictDepth,
1881
+ strictNullHandling: typeof e.strictNullHandling == "boolean" ? e.strictNullHandling : b.strictNullHandling
1882
+ };
1883
+ }, ja = function(r, e) {
1884
+ var t = Qa(e);
1885
+ if (r === "" || r === null || typeof r > "u")
1886
+ return t.plainObjects ? /* @__PURE__ */ Object.create(null) : {};
1887
+ for (var n = typeof r == "string" ? Ha(r, t) : r, a = t.plainObjects ? /* @__PURE__ */ Object.create(null) : {}, o = Object.keys(n), i = 0; i < o.length; ++i) {
1888
+ var f = o[i], l = Va(f, n[f], t, typeof r == "string");
1889
+ a = ee.merge(a, l, t);
1890
+ }
1891
+ return t.allowSparse === !0 ? a : ee.compact(a);
1892
+ }, Ja = Wa, Xa = ja, Ya = sr, Za = {
1893
+ formats: Ya,
1894
+ parse: Xa,
1895
+ stringify: Ja
1896
+ };
1897
+ const eo = /* @__PURE__ */ Fr(Za);
1898
+ function Ur(r) {
1899
+ if (!Array.isArray(r)) throw new TypeError("Middleware stack must be an array!");
1900
+ for (const e of r)
1901
+ if (typeof e != "function") throw new TypeError("Middleware must be composed of functions!");
1902
+ return function(e, t) {
1903
+ let n = -1;
1904
+ return a(0);
1905
+ function a(o) {
1906
+ if (o <= n) return Promise.reject(new Error("next() called multiple times"));
1907
+ n = o;
1908
+ let i = r[o];
1909
+ if (o === r.length && (i = t), !i) return Promise.resolve();
1910
+ try {
1911
+ return Promise.resolve(i(e, a.bind(null, o + 1)));
1912
+ } catch (f) {
1913
+ return Promise.reject(f);
1914
+ }
1915
+ }
1916
+ };
1917
+ }
1918
+ const w = {
1919
+ app: null,
1920
+ appPending: !0,
1921
+ appCb: [],
1922
+ services: /* @__PURE__ */ new Map(),
1923
+ servicePending: /* @__PURE__ */ new Map(),
1924
+ serviceCb: /* @__PURE__ */ new Map(),
1925
+ config: null,
1926
+ configPending: !1,
1927
+ configCb: []
1928
+ };
1929
+ async function ro(r) {
1930
+ if (w.config)
1931
+ return w.config;
1932
+ if (w.configPending)
1933
+ return new Promise((t) => {
1934
+ w.configCb.push((n) => t(n));
1935
+ });
1936
+ w.configPending = !0;
1937
+ const e = await r();
1938
+ return w.config = e, w.configCb.forEach((t) => t(e)), w.configCb = [], w.configPending = !1, e;
1939
+ }
1940
+ class to {
1941
+ constructor(e = {}, t) {
1942
+ x(this, "options");
1943
+ x(this, "apis", []);
1944
+ x(this, "middlewares", []);
1945
+ x(this, "defaultMiddlewares", [
1946
+ async (e, t) => {
1947
+ try {
1948
+ await t();
1949
+ } catch (n) {
1950
+ e.res.body = n.message || "";
1951
+ }
1952
+ }
1953
+ ]);
1954
+ x(this, "api404");
1955
+ x(this, "fnMiddleware");
1956
+ x(this, "getId");
1957
+ x(this, "extensions", /* @__PURE__ */ new Map());
1958
+ x(this, "onDestroyCbs", []);
1959
+ x(this, "config");
1960
+ x(this, "apiList");
1961
+ this.options = { ...e, baseUrl: e.baseUrl ?? "/" }, this.options.baseUrl = this.options.baseUrl.split("/").map((a) => encodeURIComponent(a)).join("/"), this.middlewares.push(...this.defaultMiddlewares), this.middlewares.push(...e.middlewares || []);
1962
+ const n = ((e == null ? void 0 : e.apis) ?? []).sort((a, o) => {
1963
+ const i = o.path.substr(-1, 1), f = i === "*" ? 0 : i === "/" ? 0.1 : 0.2, l = a.path.substr(-1, 1), u = l === "*" ? 0 : l === "/" ? 0.1 : 0.2;
1964
+ return o.path.split("/").length + f - (a.path.split("/").length + u);
1965
+ }).map((a) => ({
1966
+ ...a,
1967
+ // path: v.path
1968
+ // .split('/')
1969
+ // .map(v => encodeURIComponent(v))
1970
+ // .join('/'),
1971
+ method: a.method ?? (e == null ? void 0 : e.defaultMethod) ?? "post"
1972
+ }));
1973
+ this.apiList = n, this.apis = n.filter((a) => !a.disabled), this.api404 = {
1974
+ path: "*",
1975
+ method: "all",
1976
+ action: (a, o) => {
1977
+ throw o.res.status = 404, Error("Not Found");
1978
+ }
1979
+ }, this.fnMiddleware = Ur(this.middlewares), this.getId = vt({ workerId: e.workId }), this.init(t);
1980
+ }
1981
+ async init(e) {
1982
+ var t, n, a, o;
1983
+ try {
1984
+ if (this.options.config) {
1985
+ const i = await this.options.config();
1986
+ this.config = i;
1987
+ }
1988
+ await ((n = (t = this.options) == null ? void 0 : t.onInit) == null ? void 0 : n.call(t, this)), w.app = this, w.appPending = !1, w.appCb.forEach((i) => i(this)), await ((o = (a = this.options) == null ? void 0 : a.onReady) == null ? void 0 : o.call(a, this)), e == null || e(null, this);
1989
+ } catch (i) {
1990
+ e == null || e(i, this);
1991
+ }
1992
+ }
1993
+ /**
1994
+ * 调用 API
1995
+ */
1996
+ async fetchRaw(e, t, n) {
1997
+ var c, d;
1998
+ const a = (n == null ? void 0 : n.url) ?? e, o = new URL(a, "http://localhost"), i = this.getId(), f = {
1999
+ baseUrl: this.options.baseUrl ?? "",
2000
+ headers: (n == null ? void 0 : n.headers) ?? {},
2001
+ method: (n == null ? void 0 : n.method) ?? this.options.defaultMethod ?? "post",
2002
+ body: (n == null ? void 0 : n.body) ?? t,
2003
+ params: {},
2004
+ path: o.pathname,
2005
+ queryString: n != null && n.query ? "?" + eo.stringify(n.query) : o.search,
2006
+ query: (n == null ? void 0 : n.query) ?? Object.fromEntries(o.searchParams),
2007
+ url: a,
2008
+ reqId: i,
2009
+ requestId: i,
2010
+ ip: (n == null ? void 0 : n.ip) ?? "",
2011
+ namespace: (n == null ? void 0 : n.namespace) ?? "default"
2012
+ };
2013
+ let l = this.api404;
2014
+ for (let y = 0; y < this.apis.length; y++) {
2015
+ const m = this.apis[y];
2016
+ if ((m.namespace ?? "default") === f.namespace && (m.method === "all" || m.method === ((d = (c = f.method) == null ? void 0 : c.toLowerCase) == null ? void 0 : d.call(c)))) {
2017
+ const P = wt((this.options.baseUrl ?? "") + m.path, { loose: !1, trailing: !1 })(f.path);
2018
+ if (P) {
2019
+ f.params = P.params, l = m;
2020
+ break;
2021
+ }
2022
+ }
2023
+ }
2024
+ const u = {
2025
+ body: void 0,
2026
+ headers: {},
2027
+ status: 200
2028
+ }, s = {
2029
+ app: this,
2030
+ currentAPI: l,
2031
+ req: f,
2032
+ request: f,
2033
+ reqId: i,
2034
+ requestId: i,
2035
+ res: u,
2036
+ response: u,
2037
+ platform: n == null ? void 0 : n.platform,
2038
+ config: this.config,
2039
+ meta: l.meta ?? {},
2040
+ service: {}
2041
+ }, p = async () => {
2042
+ var g, S;
2043
+ let y = f.body;
2044
+ if (l.bodySchema)
2045
+ if ((g = l.bodySchema) != null && g.parse)
2046
+ try {
2047
+ y = l.bodySchema.parse(f.body);
2048
+ } catch (P) {
2049
+ u.status = 400;
2050
+ const h = (S = P == null ? void 0 : P.issues) == null ? void 0 : S[0];
2051
+ throw h && (h.message = (h.path ?? []).join(".") + " " + h.message), h ? { ...h, code: 0 } : new Error("参数错误");
2052
+ }
2053
+ else
2054
+ throw u.status = 500, new Error("bodySchema must be ZodType");
2055
+ const m = await l.action(y, s);
2056
+ m !== void 0 && (u.body = m);
2057
+ };
2058
+ if (l.middlewares && l.middlewares.length > 0) {
2059
+ const y = Ur(l.middlewares);
2060
+ await this.fnMiddleware(s, () => y(s, p));
2061
+ } else
2062
+ await this.fnMiddleware(s, p);
2063
+ return s.res;
2064
+ }
2065
+ async fetch(e, t, n) {
2066
+ return (await this.fetchRaw(e, t, n)).body;
2067
+ }
2068
+ mount(e, t) {
2069
+ this.extensions.set(e, t);
2070
+ }
2071
+ get(e) {
2072
+ return this.extensions.get(e);
2073
+ }
2074
+ onUnloadService(e) {
2075
+ this.onDestroyCbs.push(e);
2076
+ }
2077
+ async unloadService() {
2078
+ return Promise.all(this.onDestroyCbs.map((e) => e == null ? void 0 : e()));
2079
+ }
2080
+ }
2081
+ const no = Symbol("soon-api");
2082
+ function co(r) {
2083
+ const e = { ...r };
2084
+ return e._soon_symbol = no, e;
2085
+ }
2086
+ const ao = Symbol("soon-service");
2087
+ function so(r) {
2088
+ async function e() {
2089
+ var o;
2090
+ const t = r.service;
2091
+ let n = w.services.get(t);
2092
+ if (n)
2093
+ return n;
2094
+ if (w.servicePending.get(t)) {
2095
+ let i = w.serviceCb.get(t);
2096
+ return i || (i = [], w.serviceCb.set(t, i)), new Promise((f) => {
2097
+ i.push((l) => f(l));
2098
+ });
2099
+ }
2100
+ return w.servicePending.set(t, !0), await new Promise((i) => {
2101
+ w.app ? i(1) : w.appCb.push(() => i(1));
2102
+ }), n = await t(w.app), w.services.set(t, n), (o = w.serviceCb.get(t)) == null || o.forEach((i) => i(n)), w.serviceCb.delete(t), w.servicePending.delete(t), n;
2103
+ }
2104
+ return e._soon_symbol = ao, e.serviceName = (r == null ? void 0 : r.serviceName) ?? "", e.autoInject = (r == null ? void 0 : r.autoInject) ?? !1, e.enableClient = (r == null ? void 0 : r.enableClient) ?? !1, e;
2105
+ }
2106
+ function po(r) {
2107
+ return r;
2108
+ }
2109
+ function yo(r) {
2110
+ return async function() {
2111
+ return await ro(r);
2112
+ };
2113
+ }
2114
+ async function mo(r) {
2115
+ return await new Promise((e, t) => {
2116
+ new to(r, (n, a) => {
2117
+ if (n) {
2118
+ t(n);
2119
+ return;
2120
+ }
2121
+ e(a);
2122
+ });
2123
+ });
2124
+ }
2125
+ class ho extends Error {
2126
+ constructor(t, n) {
2127
+ super(t);
2128
+ x(this, "code");
2129
+ this.code = n;
2130
+ }
2131
+ }
2132
+ class vo extends Error {
2133
+ constructor(t, n) {
2134
+ super(t);
2135
+ x(this, "status");
2136
+ this.status = n;
2137
+ }
2138
+ }
2139
+ function go({
2140
+ pingTime: r = 0,
2141
+ action: e
2142
+ }) {
2143
+ let t = () => null;
2144
+ const n = new Kr((a) => {
2145
+ let o;
2146
+ r > 0 && (o = setInterval(() => {
2147
+ f.closed ? clearInterval(o) : a.next({ event: "ping", message: `: ping
5
2148
 
6
- `})},r));const i=[],f={send(l){try{a.next({...l,message:`${l.event?`event: ${l.event}
7
- `:""}data: ${typeof l.data=="string"?l.data:JSON.stringify(l.data)}
2149
+ ` });
2150
+ }, r));
2151
+ const i = [], f = {
2152
+ send(l) {
2153
+ try {
2154
+ a.next({
2155
+ ...l,
2156
+ message: `${l.event ? `event: ${l.event}
2157
+ ` : ""}data: ${typeof l.data == "string" ? l.data : JSON.stringify(l.data)}
8
2158
 
9
- `})}catch(u){f.error(u.message)}},error(l){a.next({event:"error",data:l,message:`event: error
2159
+ `
2160
+ });
2161
+ } catch (u) {
2162
+ f.error(u.message);
2163
+ }
2164
+ },
2165
+ error(l) {
2166
+ a.next({ event: "error", data: l, message: `event: error
10
2167
  data: ${l}
11
2168
 
12
- `}),a.complete(),f.closed=!0,i.forEach(u=>u==null?void 0:u())},close(){a.next({event:"close",message:`event: close
2169
+ ` }), a.complete(), f.closed = !0, i.forEach((u) => u == null ? void 0 : u());
2170
+ },
2171
+ close() {
2172
+ a.next({ event: "close", message: `event: close
13
2173
  data:
14
2174
 
15
- `}),a.complete(),f.closed=!0,o&&clearInterval(o),i.forEach(l=>l==null?void 0:l())},closed:!1,onClosed(l){i.push(l)}};t=()=>{f.closed||f.close()},e(f)});return n.streamClose=()=>t==null?void 0:t(),n}function oo(r){return r instanceof Kr}function wo(r){if(oo(r)){const e=new ht;return r.subscribe({next(t){e.write(t.message)},complete(){e.closed||e.end()}}),e.on("close",()=>{var t;return(t=r==null?void 0:r.streamClose)==null?void 0:t.call(r)}),e.on("error",()=>{var t;return(t=r==null?void 0:r.streamClose)==null?void 0:t.call(r)}),e.on("end",()=>{var t;return(t=r==null?void 0:r.streamClose)==null?void 0:t.call(r)}),e}else throw new Error("Not a valid SSE body")}export{ho as BizError,Kr as Observable,to as SoonApp,vo as SoonError,mo as createSoonApp,co as defineApi,yo as defineConfig,po as defineMiddleware,so as defineService,oo as isSSEBody,wo as resolveSSEBody,no as soonApiSymbol,ao as soonServiceSymbol,go as useSSE,vt as useSoonIdGen};
2175
+ ` }), a.complete(), f.closed = !0, o && clearInterval(o), i.forEach((l) => l == null ? void 0 : l());
2176
+ },
2177
+ closed: !1,
2178
+ onClosed(l) {
2179
+ i.push(l);
2180
+ }
2181
+ };
2182
+ t = () => {
2183
+ f.closed || f.close();
2184
+ }, e(f);
2185
+ });
2186
+ return n.streamClose = () => t == null ? void 0 : t(), n;
2187
+ }
2188
+ function oo(r) {
2189
+ return r instanceof Kr;
2190
+ }
2191
+ function wo(r) {
2192
+ if (oo(r)) {
2193
+ const e = new ht();
2194
+ return r.subscribe({
2195
+ next(t) {
2196
+ e.write(t.message);
2197
+ },
2198
+ complete() {
2199
+ e.closed || e.end();
2200
+ }
2201
+ }), e.on("close", () => {
2202
+ var t;
2203
+ return (t = r == null ? void 0 : r.streamClose) == null ? void 0 : t.call(r);
2204
+ }), e.on("error", () => {
2205
+ var t;
2206
+ return (t = r == null ? void 0 : r.streamClose) == null ? void 0 : t.call(r);
2207
+ }), e.on("end", () => {
2208
+ var t;
2209
+ return (t = r == null ? void 0 : r.streamClose) == null ? void 0 : t.call(r);
2210
+ }), e;
2211
+ } else
2212
+ throw new Error("Not a valid SSE body");
2213
+ }
2214
+ export {
2215
+ ho as BizError,
2216
+ Kr as Observable,
2217
+ to as SoonApp,
2218
+ vo as SoonError,
2219
+ mo as createSoonApp,
2220
+ co as defineApi,
2221
+ yo as defineConfig,
2222
+ po as defineMiddleware,
2223
+ so as defineService,
2224
+ oo as isSSEBody,
2225
+ wo as resolveSSEBody,
2226
+ no as soonApiSymbol,
2227
+ ao as soonServiceSymbol,
2228
+ go as useSSE,
2229
+ vt as useSoonIdGen
2230
+ };