@bool-ts/guard-sdk 1.0.2-beta.5 → 1.1.0-beta.10

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 (81) hide show
  1. package/dist/decorators/actionGuard.decorator.d.ts +3 -1
  2. package/dist/decorators/controllerGuard.decorator.d.ts +2 -1
  3. package/dist/definers/index.d.ts +1 -0
  4. package/dist/definers/policies.d.ts +5 -0
  5. package/dist/definers/resources.d.ts +11 -0
  6. package/dist/entities/@validators.d.ts +6 -0
  7. package/dist/entities/guard.d.ts +7 -0
  8. package/dist/entities/index.d.ts +1 -2
  9. package/dist/entities/loader.d.ts +7 -2
  10. package/dist/index.d.ts +1 -0
  11. package/dist/index.js +36 -17
  12. package/dist/index.js.map +44 -44
  13. package/dist/instances/client.d.ts +7 -4
  14. package/dist/interfaces/client.interface.d.ts +9 -4
  15. package/dist/interfaces/index.d.ts +1 -1
  16. package/dist/types/actionGuard.d.ts +8 -0
  17. package/dist/types/controllerGuard.d.ts +6 -0
  18. package/dist/types/index.d.ts +3 -0
  19. package/dist/types/policies.d.ts +11 -0
  20. package/dist/types/resources.d.ts +6 -0
  21. package/dist/ultils/functions/deepFreeze.d.ts +2 -0
  22. package/dist/ultils/functions/index.d.ts +1 -0
  23. package/dist/ultils/types/constructor.d.ts +1 -0
  24. package/dist/ultils/types/deepReadonly.d.ts +5 -0
  25. package/dist/ultils/types/enforceUnique.d.ts +8 -0
  26. package/dist/ultils/types/error.d.ts +3 -0
  27. package/dist/ultils/types/extractTuple.d.ts +1 -0
  28. package/dist/ultils/types/inArray.d.ts +1 -0
  29. package/dist/ultils/types/index.d.ts +15 -0
  30. package/dist/ultils/types/mergeTuple.d.ts +3 -0
  31. package/dist/ultils/types/noneEmptyArray.d.ts +1 -0
  32. package/dist/ultils/types/partialTuple.d.ts +4 -0
  33. package/dist/ultils/types/partialTupleUnordered.d.ts +3 -0
  34. package/dist/ultils/types/partialTupleUnorderedNonEmpty.d.ts +3 -0
  35. package/dist/ultils/types/partialTurpleNonEmpty.d.ts +2 -0
  36. package/dist/ultils/types/permutationTuple.d.ts +1 -0
  37. package/dist/ultils/types/shuffleTuple.d.ts +5 -0
  38. package/dist/ultils/types/strictPartial.d.ts +5 -0
  39. package/package.json +10 -10
  40. package/src/decorators/actionGuard.decorator.ts +19 -3
  41. package/src/decorators/controllerGuard.decorator.ts +7 -3
  42. package/src/definers/index.ts +1 -0
  43. package/src/definers/policies.ts +25 -0
  44. package/src/definers/resources.ts +76 -0
  45. package/src/entities/@validators.ts +22 -0
  46. package/src/entities/guard.ts +81 -0
  47. package/src/entities/index.ts +1 -2
  48. package/src/entities/loader.ts +17 -3
  49. package/src/index.ts +1 -0
  50. package/src/instances/client.ts +135 -57
  51. package/src/interfaces/account.interface.ts +4 -1
  52. package/src/interfaces/base.ts +5 -1
  53. package/src/interfaces/client.interface.ts +18 -8
  54. package/src/interfaces/index.ts +6 -1
  55. package/src/types/actionGuard.ts +11 -0
  56. package/src/types/controllerGuard.ts +8 -0
  57. package/src/types/index.ts +3 -0
  58. package/src/types/policies.ts +36 -0
  59. package/src/types/resources.ts +10 -0
  60. package/src/ultils/functions/deepFreeze.ts +13 -0
  61. package/src/ultils/functions/index.ts +1 -0
  62. package/src/ultils/types/constructor.ts +1 -0
  63. package/src/ultils/types/deepReadonly.ts +7 -0
  64. package/src/ultils/types/enforceUnique.ts +33 -0
  65. package/src/ultils/types/error.ts +1 -0
  66. package/src/ultils/types/extractTuple.ts +1 -0
  67. package/src/ultils/types/inArray.ts +7 -0
  68. package/src/ultils/types/index.ts +15 -0
  69. package/src/ultils/types/mergeTuple.ts +3 -0
  70. package/src/ultils/types/noneEmptyArray.ts +1 -0
  71. package/src/ultils/types/partialTuple.ts +6 -0
  72. package/src/ultils/types/partialTupleUnordered.ts +9 -0
  73. package/src/ultils/types/partialTupleUnorderedNonEmpty.ts +9 -0
  74. package/src/ultils/types/partialTurpleNonEmpty.ts +6 -0
  75. package/src/ultils/types/permutationTuple.ts +5 -0
  76. package/src/ultils/types/shuffleTuple.ts +7 -0
  77. package/src/ultils/types/strictPartial.ts +5 -0
  78. package/dist/entities/interceptor.d.ts +0 -5
  79. package/dist/entities/middleware.d.ts +0 -19
  80. package/src/entities/interceptor.ts +0 -47
  81. package/src/entities/middleware.ts +0 -73
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var p3=Object.defineProperty;var m4=(c,K)=>{for(var w in K)p3(c,w,{get:K[w],enumerable:!0,configurable:!0,set:(P)=>K[w]=()=>P})};var Y2=function(c,K,w,P){var S=arguments.length,h=S<3?K:P===null?P=Object.getOwnPropertyDescriptor(K,w):P,M;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")h=Reflect.decorate(c,K,w,P);else for(var I=c.length-1;I>=0;I--)if(M=c[I])h=(S<3?M(h):S>3?M(K,w,h):M(K,w))||h;return S>3&&h&&Object.defineProperty(K,w,h),h},O2=(c,K)=>(w,P)=>K(w,P,c);var x2={};m4(x2,{ETokenAudiences:()=>_6});var _6;((K)=>K.SYSTEM="https://api-guard.booljs.com")(_6||={});var Nc={};m4(Nc,{service:()=>n3,guardMetadata:()=>T3,guardClient:()=>i3,authState:()=>l3});var l3=Symbol.for("__boolGuard::authState"),T3=Symbol.for("__boolGuard::guardMetadata"),n3=Symbol.for("__boolGuard::authService"),i3=Symbol.for("__boolGuard::guardClient");var t3=()=>(c,K)=>{Reflect.defineMetadata(Nc.guardMetadata,void 0,c,K)};var d3=Object.create,{getPrototypeOf:s3,defineProperty:u4,getOwnPropertyNames:a3}=Object,c0=Object.prototype.hasOwnProperty,h4=(c,K,w)=>{w=c!=null?d3(s3(c)):{};let P=K||!c||!c.__esModule?u4(w,"default",{value:c,enumerable:!0}):w;for(let S of a3(c))if(!c0.call(P,S))u4(P,S,{get:()=>c[S],enumerable:!0});return P},_=(c,K)=>()=>(K||c((K={exports:{}}).exports,K),K.exports),K0=(c,K)=>{for(var w in K)u4(c,w,{get:K[w],enumerable:!0,configurable:!0,set:(P)=>K[w]=()=>P})},w0=import.meta.require,e4=_(()=>{/*! *****************************************************************************
2
+ var y5=Object.defineProperty;var m5=(w)=>w;function T5(w,K){this[w]=m5.bind(null,K)}var eK=(w,K)=>{for(var W in K)y5(w,W,{get:K[W],enumerable:!0,configurable:!0,set:T5.bind(K,W)})};var iK=function(w,K,W,J){var P=arguments.length,I=P<3?K:J===null?J=Object.getOwnPropertyDescriptor(K,W):J,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")I=Reflect.decorate(w,K,W,J);else for(var D=w.length-1;D>=0;D--)if(b=w[D])I=(P<3?b(I):P>3?b(K,W,I):b(K,W))||I;return P>3&&I&&Object.defineProperty(K,W,I),I},g2=(w,K)=>(W,J)=>K(W,J,w);var C2={};eK(C2,{ETokenAudiences:()=>O4});var O4;((K)=>K.SYSTEM="https://api-guard.booljs.com")(O4||={});var hw={};eK(hw,{service:()=>f5,guardMetadata:()=>p5,guardClient:()=>e5,authState:()=>l5});var l5=Symbol.for("__boolGuard::authState"),p5=Symbol.for("__boolGuard::guardMetadata"),f5=Symbol.for("__boolGuard::authService"),e5=Symbol.for("__boolGuard::guardClient");var i5=(w)=>(K,W)=>{Reflect.defineMetadata(hw.guardMetadata,w,K.constructor,W)};var d5=Object.create,{getPrototypeOf:n5,defineProperty:dK,getOwnPropertyNames:t5}=Object,a5=Object.prototype.hasOwnProperty,BK=(w,K,W)=>{W=w!=null?d5(n5(w)):{};let J=K||!w||!w.__esModule?dK(W,"default",{value:w,enumerable:!0}):W;for(let P of t5(w))if(!a5.call(J,P))dK(J,P,{get:()=>w[P],enumerable:!0});return J},p=(w,K)=>()=>(K||w((K={exports:{}}).exports,K),K.exports),Q4=(w,K)=>{for(var W in K)dK(w,W,{get:K[W],enumerable:!0,configurable:!0,set:(J)=>K[W]=()=>J})},s5=import.meta.require,w1=p(()=>{/*! *****************************************************************************
3
3
  Copyright (C) Microsoft. All rights reserved.
4
4
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
5
5
  this file except in compliance with the License. You may obtain a copy of the
@@ -12,28 +12,47 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
12
12
 
13
13
  See the Apache Version 2.0 License for specific language governing permissions
14
14
  and limitations under the License.
15
- ***************************************************************************** */var c;(function(K){(function(w){var P=typeof globalThis==="object"?globalThis:typeof global==="object"?global:typeof self==="object"?self:typeof this==="object"?this:G(),S=h(K);if(typeof P.Reflect<"u")S=h(P.Reflect,S);if(w(S,P),typeof P.Reflect>"u")P.Reflect=K;function h(D,B){return function(L,z){if(Object.defineProperty(D,L,{configurable:!0,writable:!0,value:z}),B)B(L,z)}}function M(){try{return Function("return this;")()}catch(D){}}function I(){try{return(0,eval)("(function() { return this; })()")}catch(D){}}function G(){return M()||I()}})(function(w,P){var S=Object.prototype.hasOwnProperty,h=typeof Symbol==="function",M=h&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",I=h&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",G=typeof Object.create==="function",D={__proto__:[]}instanceof Array,B=!G&&!D,L={create:G?function(){return _c(Object.create(null))}:D?function(){return _c({__proto__:null})}:function(){return _c({})},has:B?function(j,U){return S.call(j,U)}:function(j,U){return U in j},get:B?function(j,U){return S.call(j,U)?j[U]:void 0}:function(j,U){return j[U]}},z=Object.getPrototypeOf(Function),V=typeof Map==="function"&&typeof Map.prototype.entries==="function"?Map:R4(),b=typeof Set==="function"&&typeof Set.prototype.entries==="function"?Set:l2(),$=typeof WeakMap==="function"?WeakMap:g4(),q=h?Symbol.for("@reflect-metadata:registry"):void 0,W=dc(),Y=sc(W);function X(j,U,v,Z){if(!y(v)){if(!s(j))throw TypeError();if(!d(U))throw TypeError();if(!d(Z)&&!y(Z)&&!Qc(Z))throw TypeError();if(Qc(Z))Z=void 0;return v=l(v),cc(j,U,v,Z)}else{if(!s(j))throw TypeError();if(!hc(U))throw TypeError();return C(j,U)}}w("decorate",X);function O(j,U){function v(Z,m){if(!d(Z))throw TypeError();if(!y(m)&&!Jc(m))throw TypeError();vc(j,U,Z,m)}return v}w("metadata",O);function H(j,U,v,Z){if(!d(v))throw TypeError();if(!y(Z))Z=l(Z);return vc(j,U,v,Z)}w("defineMetadata",H);function o(j,U,v){if(!d(U))throw TypeError();if(!y(v))v=l(v);return Ic(j,U,v)}w("hasMetadata",o);function Q(j,U,v){if(!d(U))throw TypeError();if(!y(v))v=l(v);return wc(j,U,v)}w("hasOwnMetadata",Q);function r(j,U,v){if(!d(U))throw TypeError();if(!y(v))v=l(v);return Gc(j,U,v)}w("getMetadata",r);function g(j,U,v){if(!d(U))throw TypeError();if(!y(v))v=l(v);return qc(j,U,v)}w("getOwnMetadata",g);function A(j,U){if(!d(j))throw TypeError();if(!y(U))U=l(U);return p(j,U)}w("getMetadataKeys",A);function u(j,U){if(!d(j))throw TypeError();if(!y(U))U=l(U);return jc(j,U)}w("getOwnMetadataKeys",u);function n(j,U,v){if(!d(U))throw TypeError();if(!y(v))v=l(v);if(!d(U))throw TypeError();if(!y(v))v=l(v);var Z=b2(U,v,!1);if(y(Z))return!1;return Z.OrdinaryDeleteMetadata(j,U,v)}w("deleteMetadata",n);function C(j,U){for(var v=j.length-1;v>=0;--v){var Z=j[v],m=Z(U);if(!y(m)&&!Qc(m)){if(!hc(m))throw TypeError();U=m}}return U}function cc(j,U,v,Z){for(var m=j.length-1;m>=0;--m){var Pc=j[m],N=Pc(U,v,Z);if(!y(N)&&!Qc(N)){if(!d(N))throw TypeError();Z=N}}return Z}function Ic(j,U,v){var Z=wc(j,U,v);if(Z)return!0;var m=$c(U);if(!Qc(m))return Ic(j,m,v);return!1}function wc(j,U,v){var Z=b2(U,v,!1);if(y(Z))return!1;return Rc(Z.OrdinaryHasOwnMetadata(j,U,v))}function Gc(j,U,v){var Z=wc(j,U,v);if(Z)return qc(j,U,v);var m=$c(U);if(!Qc(m))return Gc(j,m,v);return}function qc(j,U,v){var Z=b2(U,v,!1);if(y(Z))return;return Z.OrdinaryGetOwnMetadata(j,U,v)}function vc(j,U,v,Z){var m=b2(v,Z,!0);m.OrdinaryDefineOwnMetadata(j,U,v,Z)}function p(j,U){var v=jc(j,U),Z=$c(j);if(Z===null)return v;var m=p(Z,U);if(m.length<=0)return v;if(v.length<=0)return m;var Pc=new b,N=[];for(var J=0,E=v;J<E.length;J++){var k=E[J],x=Pc.has(k);if(!x)Pc.add(k),N.push(k)}for(var R=0,f=m;R<f.length;R++){var k=f[R],x=Pc.has(k);if(!x)Pc.add(k),N.push(k)}return N}function jc(j,U){var v=b2(j,U,!1);if(!v)return[];return v.OrdinaryOwnMetadataKeys(j,U)}function Fc(j){if(j===null)return 1;switch(typeof j){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return j===null?1:6;default:return 6}}function y(j){return j===void 0}function Qc(j){return j===null}function Zc(j){return typeof j==="symbol"}function d(j){return typeof j==="object"?j!==null:typeof j==="function"}function Ec(j,U){switch(Fc(j)){case 0:return j;case 1:return j;case 2:return j;case 3:return j;case 4:return j;case 5:return j}var v=U===3?"string":U===5?"number":"default",Z=Wc(j,M);if(Z!==void 0){var m=Z.call(j,v);if(d(m))throw TypeError();return m}return Yc(j,v==="default"?"number":v)}function Yc(j,U){if(U==="string"){var v=j.toString;if(T(v)){var Z=v.call(j);if(!d(Z))return Z}var m=j.valueOf;if(T(m)){var Z=m.call(j);if(!d(Z))return Z}}else{var m=j.valueOf;if(T(m)){var Z=m.call(j);if(!d(Z))return Z}var Pc=j.toString;if(T(Pc)){var Z=Pc.call(j);if(!d(Z))return Z}}throw TypeError()}function Rc(j){return!!j}function Ac(j){return""+j}function l(j){var U=Ec(j,3);if(Zc(U))return U;return Ac(U)}function s(j){return Array.isArray?Array.isArray(j):j instanceof Object?j instanceof Array:Object.prototype.toString.call(j)==="[object Array]"}function T(j){return typeof j==="function"}function hc(j){return typeof j==="function"}function Jc(j){switch(Fc(j)){case 3:return!0;case 4:return!0;default:return!1}}function Xc(j,U){return j===U||j!==j&&U!==U}function Wc(j,U){var v=j[U];if(v===void 0||v===null)return;if(!T(v))throw TypeError();return v}function yc(j){var U=Wc(j,I);if(!T(U))throw TypeError();var v=U.call(j);if(!d(v))throw TypeError();return v}function Bc(j){return j.value}function zc(j){var U=j.next();return U.done?!1:U}function rc(j){var U=j.return;if(U)U.call(j)}function $c(j){var U=Object.getPrototypeOf(j);if(typeof j!=="function"||j===z)return U;if(U!==z)return U;var v=j.prototype,Z=v&&Object.getPrototypeOf(v);if(Z==null||Z===Object.prototype)return U;var m=Z.constructor;if(typeof m!=="function")return U;if(m===j)return U;return m}function tc(){var j;if(!y(q)&&typeof P.Reflect<"u"&&!(q in P.Reflect)&&typeof P.Reflect.defineMetadata==="function")j=E4(P.Reflect);var U,v,Z,m=new $,Pc={registerProvider:N,getProvider:E,setProvider:x};return Pc;function N(R){if(!Object.isExtensible(Pc))throw Error("Cannot add provider to a frozen registry.");switch(!0){case j===R:break;case y(U):U=R;break;case U===R:break;case y(v):v=R;break;case v===R:break;default:if(Z===void 0)Z=new b;Z.add(R);break}}function J(R,f){if(!y(U)){if(U.isProviderFor(R,f))return U;if(!y(v)){if(v.isProviderFor(R,f))return U;if(!y(Z)){var t=yc(Z);while(!0){var i=zc(t);if(!i)return;var bc=Bc(i);if(bc.isProviderFor(R,f))return rc(t),bc}}}}if(!y(j)&&j.isProviderFor(R,f))return j;return}function E(R,f){var t=m.get(R),i;if(!y(t))i=t.get(f);if(!y(i))return i;if(i=J(R,f),!y(i)){if(y(t))t=new V,m.set(R,t);t.set(f,i)}return i}function k(R){if(y(R))throw TypeError();return U===R||v===R||!y(Z)&&Z.has(R)}function x(R,f,t){if(!k(t))throw Error("Metadata provider not registered.");var i=E(R,f);if(i!==t){if(!y(i))return!1;var bc=m.get(R);if(y(bc))bc=new V,m.set(R,bc);bc.set(f,t)}return!0}}function dc(){var j;if(!y(q)&&d(P.Reflect)&&Object.isExtensible(P.Reflect))j=P.Reflect[q];if(y(j))j=tc();if(!y(q)&&d(P.Reflect)&&Object.isExtensible(P.Reflect))Object.defineProperty(P.Reflect,q,{enumerable:!1,configurable:!1,writable:!1,value:j});return j}function sc(j){var U=new $,v={isProviderFor:function(k,x){var R=U.get(k);if(y(R))return!1;return R.has(x)},OrdinaryDefineOwnMetadata:N,OrdinaryHasOwnMetadata:m,OrdinaryGetOwnMetadata:Pc,OrdinaryOwnMetadataKeys:J,OrdinaryDeleteMetadata:E};return W.registerProvider(v),v;function Z(k,x,R){var f=U.get(k),t=!1;if(y(f)){if(!R)return;f=new V,U.set(k,f),t=!0}var i=f.get(x);if(y(i)){if(!R)return;if(i=new V,f.set(x,i),!j.setProvider(k,x,v)){if(f.delete(x),t)U.delete(k);throw Error("Wrong provider for target.")}}return i}function m(k,x,R){var f=Z(x,R,!1);if(y(f))return!1;return Rc(f.has(k))}function Pc(k,x,R){var f=Z(x,R,!1);if(y(f))return;return f.get(k)}function N(k,x,R,f){var t=Z(R,f,!0);t.set(k,x)}function J(k,x){var R=[],f=Z(k,x,!1);if(y(f))return R;var t=f.keys(),i=yc(t),bc=0;while(!0){var Q2=zc(i);if(!Q2)return R.length=bc,R;var ac=Bc(Q2);try{R[bc]=ac}catch(Hc){try{rc(i)}finally{throw Hc}}bc++}}function E(k,x,R){var f=Z(x,R,!1);if(y(f))return!1;if(!f.delete(k))return!1;if(f.size===0){var t=U.get(x);if(!y(t)){if(t.delete(R),t.size===0)U.delete(t)}}return!0}}function E4(j){var{defineMetadata:U,hasOwnMetadata:v,getOwnMetadata:Z,getOwnMetadataKeys:m,deleteMetadata:Pc}=j,N=new $,J={isProviderFor:function(E,k){var x=N.get(E);if(!y(x)&&x.has(k))return!0;if(m(E,k).length){if(y(x))x=new b,N.set(E,x);return x.add(k),!0}return!1},OrdinaryDefineOwnMetadata:U,OrdinaryHasOwnMetadata:v,OrdinaryGetOwnMetadata:Z,OrdinaryOwnMetadataKeys:m,OrdinaryDeleteMetadata:Pc};return J}function b2(j,U,v){var Z=W.getProvider(j,U);if(!y(Z))return Z;if(v){if(W.setProvider(j,U,Y))return Y;throw Error("Illegal state.")}return}function R4(){var j={},U=[],v=function(){function J(E,k,x){this._index=0,this._keys=E,this._values=k,this._selector=x}return J.prototype["@@iterator"]=function(){return this},J.prototype[I]=function(){return this},J.prototype.next=function(){var E=this._index;if(E>=0&&E<this._keys.length){var k=this._selector(this._keys[E],this._values[E]);if(E+1>=this._keys.length)this._index=-1,this._keys=U,this._values=U;else this._index++;return{value:k,done:!1}}return{value:void 0,done:!0}},J.prototype.throw=function(E){if(this._index>=0)this._index=-1,this._keys=U,this._values=U;throw E},J.prototype.return=function(E){if(this._index>=0)this._index=-1,this._keys=U,this._values=U;return{value:E,done:!0}},J}(),Z=function(){function J(){this._keys=[],this._values=[],this._cacheKey=j,this._cacheIndex=-2}return Object.defineProperty(J.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),J.prototype.has=function(E){return this._find(E,!1)>=0},J.prototype.get=function(E){var k=this._find(E,!1);return k>=0?this._values[k]:void 0},J.prototype.set=function(E,k){var x=this._find(E,!0);return this._values[x]=k,this},J.prototype.delete=function(E){var k=this._find(E,!1);if(k>=0){var x=this._keys.length;for(var R=k+1;R<x;R++)this._keys[R-1]=this._keys[R],this._values[R-1]=this._values[R];if(this._keys.length--,this._values.length--,Xc(E,this._cacheKey))this._cacheKey=j,this._cacheIndex=-2;return!0}return!1},J.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=j,this._cacheIndex=-2},J.prototype.keys=function(){return new v(this._keys,this._values,m)},J.prototype.values=function(){return new v(this._keys,this._values,Pc)},J.prototype.entries=function(){return new v(this._keys,this._values,N)},J.prototype["@@iterator"]=function(){return this.entries()},J.prototype[I]=function(){return this.entries()},J.prototype._find=function(E,k){if(!Xc(this._cacheKey,E)){this._cacheIndex=-1;for(var x=0;x<this._keys.length;x++)if(Xc(this._keys[x],E)){this._cacheIndex=x;break}}if(this._cacheIndex<0&&k)this._cacheIndex=this._keys.length,this._keys.push(E),this._values.push(void 0);return this._cacheIndex},J}();return Z;function m(J,E){return J}function Pc(J,E){return E}function N(J,E){return[J,E]}}function l2(){var j=function(){function U(){this._map=new V}return Object.defineProperty(U.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),U.prototype.has=function(v){return this._map.has(v)},U.prototype.add=function(v){return this._map.set(v,v),this},U.prototype.delete=function(v){return this._map.delete(v)},U.prototype.clear=function(){this._map.clear()},U.prototype.keys=function(){return this._map.keys()},U.prototype.values=function(){return this._map.keys()},U.prototype.entries=function(){return this._map.entries()},U.prototype["@@iterator"]=function(){return this.keys()},U.prototype[I]=function(){return this.keys()},U}();return j}function g4(){var j=16,U=L.create(),v=Z();return function(){function E(){this._key=Z()}return E.prototype.has=function(k){var x=m(k,!1);return x!==void 0?L.has(x,this._key):!1},E.prototype.get=function(k){var x=m(k,!1);return x!==void 0?L.get(x,this._key):void 0},E.prototype.set=function(k,x){var R=m(k,!0);return R[this._key]=x,this},E.prototype.delete=function(k){var x=m(k,!1);return x!==void 0?delete x[this._key]:!1},E.prototype.clear=function(){this._key=Z()},E}();function Z(){var E;do E="@@WeakMap@@"+J();while(L.has(U,E));return U[E]=!0,E}function m(E,k){if(!S.call(E,v)){if(!k)return;Object.defineProperty(E,v,{value:L.create()})}return E[v]}function Pc(E,k){for(var x=0;x<k;++x)E[x]=Math.random()*255|0;return E}function N(E){if(typeof Uint8Array==="function"){var k=new Uint8Array(E);if(typeof crypto<"u")crypto.getRandomValues(k);else if(typeof msCrypto<"u")msCrypto.getRandomValues(k);else Pc(k,E);return k}return Pc(Array(E),E)}function J(){var E=N(j);E[6]=E[6]&79|64,E[8]=E[8]&191|128;var k="";for(var x=0;x<j;++x){var R=E[x];if(x===4||x===6||x===8)k+="-";if(R<16)k+="0";k+=R.toString(16).toLowerCase()}return k}}function _c(j){return j.__=void 0,delete j.__,j}})})(c||(c={}))}),H2=_((c,K)=>{K.exports=TypeError}),P0=_((c,K)=>{K.exports=w0("util").inspect}),M4=_((c,K)=>{var w=typeof Map==="function"&&Map.prototype,P=Object.getOwnPropertyDescriptor&&w?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,S=w&&P&&typeof P.get==="function"?P.get:null,h=w&&Map.prototype.forEach,M=typeof Set==="function"&&Set.prototype,I=Object.getOwnPropertyDescriptor&&M?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,G=M&&I&&typeof I.get==="function"?I.get:null,D=M&&Set.prototype.forEach,B=typeof WeakMap==="function"&&WeakMap.prototype,L=B?WeakMap.prototype.has:null,z=typeof WeakSet==="function"&&WeakSet.prototype,V=z?WeakSet.prototype.has:null,b=typeof WeakRef==="function"&&WeakRef.prototype,$=b?WeakRef.prototype.deref:null,q=Boolean.prototype.valueOf,W=Object.prototype.toString,Y=Function.prototype.toString,X=String.prototype.match,O=String.prototype.slice,H=String.prototype.replace,o=String.prototype.toUpperCase,Q=String.prototype.toLowerCase,r=RegExp.prototype.test,g=Array.prototype.concat,A=Array.prototype.join,u=Array.prototype.slice,n=Math.floor,C=typeof BigInt==="function"?BigInt.prototype.valueOf:null,cc=Object.getOwnPropertySymbols,Ic=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?Symbol.prototype.toString:null,wc=typeof Symbol==="function"&&typeof Symbol.iterator==="object",Gc=typeof Symbol==="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===wc?"object":"symbol")?Symbol.toStringTag:null,qc=Object.prototype.propertyIsEnumerable,vc=(typeof Reflect==="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(N){return N.__proto__}:null);function p(N,J){if(N===1/0||N===-1/0||N!==N||N&&N>-1000&&N<1000||r.call(/e/,J))return J;var E=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof N==="number"){var k=N<0?-n(-N):n(N);if(k!==N){var x=String(k),R=O.call(J,x.length+1);return H.call(x,E,"$&_")+"."+H.call(H.call(R,/([0-9]{3})/g,"$&_"),/_$/,"")}}return H.call(J,E,"$&_")}var jc=P0(),Fc=jc.custom,y=Xc(Fc)?Fc:null,Qc={__proto__:null,double:'"',single:"'"},Zc={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};K.exports=function N(J,E,k,x){var R=E||{};if(Bc(R,"quoteStyle")&&!Bc(Qc,R.quoteStyle))throw TypeError('option "quoteStyle" must be "single" or "double"');if(Bc(R,"maxStringLength")&&(typeof R.maxStringLength==="number"?R.maxStringLength<0&&R.maxStringLength!==1/0:R.maxStringLength!==null))throw TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var f=Bc(R,"customInspect")?R.customInspect:!0;if(typeof f!=="boolean"&&f!=="symbol")throw TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Bc(R,"indent")&&R.indent!==null&&R.indent!=="\t"&&!(parseInt(R.indent,10)===R.indent&&R.indent>0))throw TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Bc(R,"numericSeparator")&&typeof R.numericSeparator!=="boolean")throw TypeError('option "numericSeparator", if provided, must be `true` or `false`');var t=R.numericSeparator;if(typeof J>"u")return"undefined";if(J===null)return"null";if(typeof J==="boolean")return J?"true":"false";if(typeof J==="string")return l2(J,R);if(typeof J==="number"){if(J===0)return 1/0/J>0?"0":"-0";var i=String(J);return t?p(J,i):i}if(typeof J==="bigint"){var bc=String(J)+"n";return t?p(J,bc):bc}var Q2=typeof R.depth>"u"?5:R.depth;if(typeof k>"u")k=0;if(k>=Q2&&Q2>0&&typeof J==="object")return Rc(J)?"[Array]":"[Object]";var ac=Z(R,k);if(typeof x>"u")x=[];else if($c(x,J)>=0)return"[Circular]";function Hc(U2,n2,e3){if(n2)x=u.call(x),x.push(n2);if(e3){var y6={depth:R.depth};if(Bc(R,"quoteStyle"))y6.quoteStyle=R.quoteStyle;return N(U2,y6,k+1,x)}return N(U2,R,k+1,x)}if(typeof J==="function"&&!l(J)){var Z6=rc(J),A6=Pc(J,Hc);return"[Function"+(Z6?": "+Z6:" (anonymous)")+"]"+(A6.length>0?" { "+A.call(A6,", ")+" }":"")}if(Xc(J)){var r6=wc?H.call(String(J),/^(Symbol\(.*\))_[^)]*$/,"$1"):Ic.call(J);return typeof J==="object"&&!wc?_c(r6):r6}if(R4(J)){var k2="<"+Q.call(String(J.nodeName)),k4=J.attributes||[];for(var T2=0;T2<k4.length;T2++)k2+=" "+k4[T2].name+"="+d(Ec(k4[T2].value),"double",R);if(k2+=">",J.childNodes&&J.childNodes.length)k2+="...";return k2+="</"+Q.call(String(J.nodeName))+">",k2}if(Rc(J)){if(J.length===0)return"[]";var x4=Pc(J,Hc);if(ac&&!v(x4))return"["+m(x4,ac)+"]";return"[ "+A.call(x4,", ")+" ]"}if(s(J)){var Z4=Pc(J,Hc);if(!("cause"in Error.prototype)&&"cause"in J&&!qc.call(J,"cause"))return"{ ["+String(J)+"] "+A.call(g.call("[cause]: "+Hc(J.cause),Z4),", ")+" }";if(Z4.length===0)return"["+String(J)+"]";return"{ ["+String(J)+"] "+A.call(Z4,", ")+" }"}if(typeof J==="object"&&f){if(y&&typeof J[y]==="function"&&jc)return jc(J,{depth:Q2-k});else if(f!=="symbol"&&typeof J.inspect==="function")return J.inspect()}if(tc(J)){var o6=[];if(h)h.call(J,function(U2,n2){o6.push(Hc(n2,J,!0)+" => "+Hc(U2,J))});return U("Map",S.call(J),o6,ac)}if(E4(J)){var m6=[];if(D)D.call(J,function(U2){m6.push(Hc(U2,J))});return U("Set",G.call(J),m6,ac)}if(dc(J))return j("WeakMap");if(b2(J))return j("WeakSet");if(sc(J))return j("WeakRef");if(hc(J))return _c(Hc(Number(J)));if(Wc(J))return _c(Hc(C.call(J)));if(Jc(J))return _c(q.call(J));if(T(J))return _c(Hc(String(J)));if(typeof window<"u"&&J===window)return"{ [object Window] }";if(typeof globalThis<"u"&&J===globalThis||typeof global<"u"&&J===global)return"{ [object globalThis] }";if(!Ac(J)&&!l(J)){var A4=Pc(J,Hc),u6=vc?vc(J)===Object.prototype:J instanceof Object||J.constructor===Object,r4=J instanceof Object?"":"null prototype",C6=!u6&&Gc&&Object(J)===J&&Gc in J?O.call(zc(J),8,-1):r4?"Object":"",f3=u6||typeof J.constructor!=="function"?"":J.constructor.name?J.constructor.name+" ":"",o4=f3+(C6||r4?"["+A.call(g.call([],C6||[],r4||[]),": ")+"] ":"");if(A4.length===0)return o4+"{}";if(ac)return o4+"{"+m(A4,ac)+"}";return o4+"{ "+A.call(A4,", ")+" }"}return String(J)};function d(N,J,E){var k=E.quoteStyle||J,x=Qc[k];return x+N+x}function Ec(N){return H.call(String(N),/"/g,"&quot;")}function Yc(N){return!Gc||!(typeof N==="object"&&((Gc in N)||typeof N[Gc]<"u"))}function Rc(N){return zc(N)==="[object Array]"&&Yc(N)}function Ac(N){return zc(N)==="[object Date]"&&Yc(N)}function l(N){return zc(N)==="[object RegExp]"&&Yc(N)}function s(N){return zc(N)==="[object Error]"&&Yc(N)}function T(N){return zc(N)==="[object String]"&&Yc(N)}function hc(N){return zc(N)==="[object Number]"&&Yc(N)}function Jc(N){return zc(N)==="[object Boolean]"&&Yc(N)}function Xc(N){if(wc)return N&&typeof N==="object"&&N instanceof Symbol;if(typeof N==="symbol")return!0;if(!N||typeof N!=="object"||!Ic)return!1;try{return Ic.call(N),!0}catch(J){}return!1}function Wc(N){if(!N||typeof N!=="object"||!C)return!1;try{return C.call(N),!0}catch(J){}return!1}var yc=Object.prototype.hasOwnProperty||function(N){return N in this};function Bc(N,J){return yc.call(N,J)}function zc(N){return W.call(N)}function rc(N){if(N.name)return N.name;var J=X.call(Y.call(N),/^function\s*([\w$]+)/);if(J)return J[1];return null}function $c(N,J){if(N.indexOf)return N.indexOf(J);for(var E=0,k=N.length;E<k;E++)if(N[E]===J)return E;return-1}function tc(N){if(!S||!N||typeof N!=="object")return!1;try{S.call(N);try{G.call(N)}catch(J){return!0}return N instanceof Map}catch(J){}return!1}function dc(N){if(!L||!N||typeof N!=="object")return!1;try{L.call(N,L);try{V.call(N,V)}catch(J){return!0}return N instanceof WeakMap}catch(J){}return!1}function sc(N){if(!$||!N||typeof N!=="object")return!1;try{return $.call(N),!0}catch(J){}return!1}function E4(N){if(!G||!N||typeof N!=="object")return!1;try{G.call(N);try{S.call(N)}catch(J){return!0}return N instanceof Set}catch(J){}return!1}function b2(N){if(!V||!N||typeof N!=="object")return!1;try{V.call(N,V);try{L.call(N,L)}catch(J){return!0}return N instanceof WeakSet}catch(J){}return!1}function R4(N){if(!N||typeof N!=="object")return!1;if(typeof HTMLElement<"u"&&N instanceof HTMLElement)return!0;return typeof N.nodeName==="string"&&typeof N.getAttribute==="function"}function l2(N,J){if(N.length>J.maxStringLength){var E=N.length-J.maxStringLength,k="... "+E+" more character"+(E>1?"s":"");return l2(O.call(N,0,J.maxStringLength),J)+k}var x=Zc[J.quoteStyle||"single"];x.lastIndex=0;var R=H.call(H.call(N,x,"\\$1"),/[\x00-\x1f]/g,g4);return d(R,"single",J)}function g4(N){var J=N.charCodeAt(0),E={8:"b",9:"t",10:"n",12:"f",13:"r"}[J];if(E)return"\\"+E;return"\\x"+(J<16?"0":"")+o.call(J.toString(16))}function _c(N){return"Object("+N+")"}function j(N){return N+" { ? }"}function U(N,J,E,k){var x=k?m(E,k):A.call(E,", ");return N+" ("+J+") {"+x+"}"}function v(N){for(var J=0;J<N.length;J++)if($c(N[J],`
16
- `)>=0)return!1;return!0}function Z(N,J){var E;if(N.indent==="\t")E="\t";else if(typeof N.indent==="number"&&N.indent>0)E=A.call(Array(N.indent+1)," ");else return null;return{base:E,prev:A.call(Array(J+1),E)}}function m(N,J){if(N.length===0)return"";var E=`
17
- `+J.prev+J.base;return E+A.call(N,","+E)+`
18
- `+J.prev}function Pc(N,J){var E=Rc(N),k=[];if(E){k.length=N.length;for(var x=0;x<N.length;x++)k[x]=Bc(N,x)?J(N[x],N):""}var R=typeof cc==="function"?cc(N):[],f;if(wc){f={};for(var t=0;t<R.length;t++)f["$"+R[t]]=R[t]}for(var i in N){if(!Bc(N,i))continue;if(E&&String(Number(i))===i&&i<N.length)continue;if(wc&&f["$"+i]instanceof Symbol)continue;else if(r.call(/[^\w$]/,i))k.push(J(i,N)+": "+J(N[i],N));else k.push(i+": "+J(N[i],N))}if(typeof cc==="function"){for(var bc=0;bc<R.length;bc++)if(qc.call(N,R[bc]))k.push("["+J(R[bc])+"]: "+J(N[R[bc]],N))}return k}}),S0=_((c,K)=>{var w=M4(),P=H2(),S=function(D,B,L){var z=D,V;for(;(V=z.next)!=null;z=V)if(V.key===B){if(z.next=V.next,!L)V.next=D.next,D.next=V;return V}},h=function(D,B){if(!D)return;var L=S(D,B);return L&&L.value},M=function(D,B,L){var z=S(D,B);if(z)z.value=L;else D.next={key:B,next:D.next,value:L}},I=function(D,B){if(!D)return!1;return!!S(D,B)},G=function(D,B){if(D)return S(D,B,!0)};K.exports=function(){var D,B={assert:function(L){if(!B.has(L))throw new P("Side channel does not contain "+w(L))},delete:function(L){var z=D&&D.next,V=G(D,L);if(V&&z&&z===V)D=void 0;return!!V},get:function(L){return h(D,L)},has:function(L){return I(D,L)},set:function(L,z){if(!D)D={next:void 0};M(D,L,z)}};return B}}),p6=_((c,K)=>{K.exports=Object}),h0=_((c,K)=>{K.exports=Error}),M0=_((c,K)=>{K.exports=EvalError}),W0=_((c,K)=>{K.exports=RangeError}),I0=_((c,K)=>{K.exports=ReferenceError}),b0=_((c,K)=>{K.exports=SyntaxError}),O0=_((c,K)=>{K.exports=URIError}),J0=_((c,K)=>{K.exports=Math.abs}),N0=_((c,K)=>{K.exports=Math.floor}),D0=_((c,K)=>{K.exports=Math.max}),G0=_((c,K)=>{K.exports=Math.min}),j0=_((c,K)=>{K.exports=Math.pow}),X0=_((c,K)=>{K.exports=Math.round}),B0=_((c,K)=>{K.exports=Number.isNaN||function(w){return w!==w}}),z0=_((c,K)=>{var w=B0();K.exports=function(P){if(w(P)||P===0)return P;return P<0?-1:1}}),$0=_((c,K)=>{K.exports=Object.getOwnPropertyDescriptor}),l6=_((c,K)=>{var w=$0();if(w)try{w([],"length")}catch(P){w=null}K.exports=w}),Q0=_((c,K)=>{var w=Object.defineProperty||!1;if(w)try{w({},"a",{value:1})}catch(P){w=!1}K.exports=w}),U0=_((c,K)=>{K.exports=function(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var w={},P=Symbol("test"),S=Object(P);if(typeof P==="string")return!1;if(Object.prototype.toString.call(P)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(S)!=="[object Symbol]")return!1;var h=42;w[P]=h;for(var M in w)return!1;if(typeof Object.keys==="function"&&Object.keys(w).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(w).length!==0)return!1;var I=Object.getOwnPropertySymbols(w);if(I.length!==1||I[0]!==P)return!1;if(!Object.prototype.propertyIsEnumerable.call(w,P))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var G=Object.getOwnPropertyDescriptor(w,P);if(G.value!==h||G.enumerable!==!0)return!1}return!0}}),Y0=_((c,K)=>{var w=typeof Symbol<"u"&&Symbol,P=U0();K.exports=function(){if(typeof w!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof w("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return P()}}),T6=_((c,K)=>{K.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null}),n6=_((c,K)=>{var w=p6();K.exports=w.getPrototypeOf||null}),H0=_((c,K)=>{var w="Function.prototype.bind called on incompatible ",P=Object.prototype.toString,S=Math.max,h="[object Function]",M=function(D,B){var L=[];for(var z=0;z<D.length;z+=1)L[z]=D[z];for(var V=0;V<B.length;V+=1)L[V+D.length]=B[V];return L},I=function(D,B){var L=[];for(var z=B||0,V=0;z<D.length;z+=1,V+=1)L[V]=D[z];return L},G=function(D,B){var L="";for(var z=0;z<D.length;z+=1)if(L+=D[z],z+1<D.length)L+=B;return L};K.exports=function(D){var B=this;if(typeof B!=="function"||P.apply(B)!==h)throw TypeError(w+B);var L=I(arguments,1),z,V=function(){if(this instanceof z){var Y=B.apply(this,M(L,arguments));if(Object(Y)===Y)return Y;return this}return B.apply(D,M(L,arguments))},b=S(0,B.length-L.length),$=[];for(var q=0;q<b;q++)$[q]="$"+q;if(z=Function("binder","return function ("+G($,",")+"){ return binder.apply(this,arguments); }")(V),B.prototype){var W=function(){};W.prototype=B.prototype,z.prototype=new W,W.prototype=null}return z}}),W4=_((c,K)=>{var w=H0();K.exports=Function.prototype.bind||w}),p4=_((c,K)=>{K.exports=Function.prototype.call}),i6=_((c,K)=>{K.exports=Function.prototype.apply}),V0=_((c,K)=>{K.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply}),L0=_((c,K)=>{var w=W4(),P=i6(),S=p4(),h=V0();K.exports=h||w.call(S,P)}),t6=_((c,K)=>{var w=W4(),P=H2(),S=p4(),h=L0();K.exports=function(M){if(M.length<1||typeof M[0]!=="function")throw new P("a function is required");return h(w,S,M)}}),q0=_((c,K)=>{var w=t6(),P=l6(),S;try{S=[].__proto__===Array.prototype}catch(G){if(!G||typeof G!=="object"||!("code"in G)||G.code!=="ERR_PROTO_ACCESS")throw G}var h=!!S&&P&&P(Object.prototype,"__proto__"),M=Object,I=M.getPrototypeOf;K.exports=h&&typeof h.get==="function"?w([h.get]):typeof I==="function"?function(G){return I(G==null?G:M(G))}:!1}),v0=_((c,K)=>{var w=T6(),P=n6(),S=q0();K.exports=w?function(h){return w(h)}:P?function(h){if(!h||typeof h!=="object"&&typeof h!=="function")throw TypeError("getProto: not an object");return P(h)}:S?function(h){return S(h)}:null}),F0=_((c,K)=>{var w=Function.prototype.call,P=Object.prototype.hasOwnProperty,S=W4();K.exports=S.call(w,P)}),l4=_((c,K)=>{var w,P=p6(),S=h0(),h=M0(),M=W0(),I=I0(),G=b0(),D=H2(),B=O0(),L=J0(),z=N0(),V=D0(),b=G0(),$=j0(),q=X0(),W=z0(),Y=Function,X=function(l){try{return Y('"use strict"; return ('+l+").constructor;")()}catch(s){}},O=l6(),H=Q0(),o=function(){throw new D},Q=O?function(){try{return arguments.callee,o}catch(l){try{return O(arguments,"callee").get}catch(s){return o}}}():o,r=Y0()(),g=v0(),A=n6(),u=T6(),n=i6(),C=p4(),cc={},Ic=typeof Uint8Array>"u"||!g?w:g(Uint8Array),wc={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?w:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?w:ArrayBuffer,"%ArrayIteratorPrototype%":r&&g?g([][Symbol.iterator]()):w,"%AsyncFromSyncIteratorPrototype%":w,"%AsyncFunction%":cc,"%AsyncGenerator%":cc,"%AsyncGeneratorFunction%":cc,"%AsyncIteratorPrototype%":cc,"%Atomics%":typeof Atomics>"u"?w:Atomics,"%BigInt%":typeof BigInt>"u"?w:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?w:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?w:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?w:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":S,"%eval%":eval,"%EvalError%":h,"%Float16Array%":typeof Float16Array>"u"?w:Float16Array,"%Float32Array%":typeof Float32Array>"u"?w:Float32Array,"%Float64Array%":typeof Float64Array>"u"?w:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?w:FinalizationRegistry,"%Function%":Y,"%GeneratorFunction%":cc,"%Int8Array%":typeof Int8Array>"u"?w:Int8Array,"%Int16Array%":typeof Int16Array>"u"?w:Int16Array,"%Int32Array%":typeof Int32Array>"u"?w:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":r&&g?g(g([][Symbol.iterator]())):w,"%JSON%":typeof JSON==="object"?JSON:w,"%Map%":typeof Map>"u"?w:Map,"%MapIteratorPrototype%":typeof Map>"u"||!r||!g?w:g(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":P,"%Object.getOwnPropertyDescriptor%":O,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?w:Promise,"%Proxy%":typeof Proxy>"u"?w:Proxy,"%RangeError%":M,"%ReferenceError%":I,"%Reflect%":typeof Reflect>"u"?w:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?w:Set,"%SetIteratorPrototype%":typeof Set>"u"||!r||!g?w:g(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?w:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":r&&g?g(""[Symbol.iterator]()):w,"%Symbol%":r?Symbol:w,"%SyntaxError%":G,"%ThrowTypeError%":Q,"%TypedArray%":Ic,"%TypeError%":D,"%Uint8Array%":typeof Uint8Array>"u"?w:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?w:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?w:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?w:Uint32Array,"%URIError%":B,"%WeakMap%":typeof WeakMap>"u"?w:WeakMap,"%WeakRef%":typeof WeakRef>"u"?w:WeakRef,"%WeakSet%":typeof WeakSet>"u"?w:WeakSet,"%Function.prototype.call%":C,"%Function.prototype.apply%":n,"%Object.defineProperty%":H,"%Object.getPrototypeOf%":A,"%Math.abs%":L,"%Math.floor%":z,"%Math.max%":V,"%Math.min%":b,"%Math.pow%":$,"%Math.round%":q,"%Math.sign%":W,"%Reflect.getPrototypeOf%":u};if(g)try{null.error}catch(l){Gc=g(g(l)),wc["%Error.prototype%"]=Gc}var Gc,qc=function l(s){var T;if(s==="%AsyncFunction%")T=X("async function () {}");else if(s==="%GeneratorFunction%")T=X("function* () {}");else if(s==="%AsyncGeneratorFunction%")T=X("async function* () {}");else if(s==="%AsyncGenerator%"){var hc=l("%AsyncGeneratorFunction%");if(hc)T=hc.prototype}else if(s==="%AsyncIteratorPrototype%"){var Jc=l("%AsyncGenerator%");if(Jc&&g)T=g(Jc.prototype)}return wc[s]=T,T},vc={__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"]},p=W4(),jc=F0(),Fc=p.call(C,Array.prototype.concat),y=p.call(n,Array.prototype.splice),Qc=p.call(C,String.prototype.replace),Zc=p.call(C,String.prototype.slice),d=p.call(C,RegExp.prototype.exec),Ec=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Yc=/\\(\\)?/g,Rc=function(l){var s=Zc(l,0,1),T=Zc(l,-1);if(s==="%"&&T!=="%")throw new G("invalid intrinsic syntax, expected closing `%`");else if(T==="%"&&s!=="%")throw new G("invalid intrinsic syntax, expected opening `%`");var hc=[];return Qc(l,Ec,function(Jc,Xc,Wc,yc){hc[hc.length]=Wc?Qc(yc,Yc,"$1"):Xc||Jc}),hc},Ac=function(l,s){var T=l,hc;if(jc(vc,T))hc=vc[T],T="%"+hc[0]+"%";if(jc(wc,T)){var Jc=wc[T];if(Jc===cc)Jc=qc(T);if(typeof Jc>"u"&&!s)throw new D("intrinsic "+l+" exists, but is not available. Please file an issue!");return{alias:hc,name:T,value:Jc}}throw new G("intrinsic "+l+" does not exist!")};K.exports=function(l,s){if(typeof l!=="string"||l.length===0)throw new D("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof s!=="boolean")throw new D('"allowMissing" argument must be a boolean');if(d(/^%?[^%]*%?$/,l)===null)throw new G("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var T=Rc(l),hc=T.length>0?T[0]:"",Jc=Ac("%"+hc+"%",s),Xc=Jc.name,Wc=Jc.value,yc=!1,Bc=Jc.alias;if(Bc)hc=Bc[0],y(T,Fc([0,1],Bc));for(var zc=1,rc=!0;zc<T.length;zc+=1){var $c=T[zc],tc=Zc($c,0,1),dc=Zc($c,-1);if((tc==='"'||tc==="'"||tc==="`"||(dc==='"'||dc==="'"||dc==="`"))&&tc!==dc)throw new G("property names with quotes must have matching quotes");if($c==="constructor"||!rc)yc=!0;if(hc+="."+$c,Xc="%"+hc+"%",jc(wc,Xc))Wc=wc[Xc];else if(Wc!=null){if(!($c in Wc)){if(!s)throw new D("base intrinsic for "+l+" exists, but the property is not available.");return}if(O&&zc+1>=T.length){var sc=O(Wc,$c);if(rc=!!sc,rc&&"get"in sc&&!("originalValue"in sc.get))Wc=sc.get;else Wc=Wc[$c]}else rc=jc(Wc,$c),Wc=Wc[$c];if(rc&&!yc)wc[Xc]=Wc}}return Wc}}),d6=_((c,K)=>{var w=l4(),P=t6(),S=P([w("%String.prototype.indexOf%")]);K.exports=function(h,M){var I=w(h,!!M);if(typeof I==="function"&&S(h,".prototype.")>-1)return P([I]);return I}}),s6=_((c,K)=>{var w=l4(),P=d6(),S=M4(),h=H2(),M=w("%Map%",!0),I=P("Map.prototype.get",!0),G=P("Map.prototype.set",!0),D=P("Map.prototype.has",!0),B=P("Map.prototype.delete",!0),L=P("Map.prototype.size",!0);K.exports=!!M&&function(){var z,V={assert:function(b){if(!V.has(b))throw new h("Side channel does not contain "+S(b))},delete:function(b){if(z){var $=B(z,b);if(L(z)===0)z=void 0;return $}return!1},get:function(b){if(z)return I(z,b)},has:function(b){if(z)return D(z,b);return!1},set:function(b,$){if(!z)z=new M;G(z,b,$)}};return V}}),E0=_((c,K)=>{var w=l4(),P=d6(),S=M4(),h=s6(),M=H2(),I=w("%WeakMap%",!0),G=P("WeakMap.prototype.get",!0),D=P("WeakMap.prototype.set",!0),B=P("WeakMap.prototype.has",!0),L=P("WeakMap.prototype.delete",!0);K.exports=I?function(){var z,V,b={assert:function($){if(!b.has($))throw new M("Side channel does not contain "+S($))},delete:function($){if(I&&$&&(typeof $==="object"||typeof $==="function")){if(z)return L(z,$)}else if(h){if(V)return V.delete($)}return!1},get:function($){if(I&&$&&(typeof $==="object"||typeof $==="function")){if(z)return G(z,$)}return V&&V.get($)},has:function($){if(I&&$&&(typeof $==="object"||typeof $==="function")){if(z)return B(z,$)}return!!V&&V.has($)},set:function($,q){if(I&&$&&(typeof $==="object"||typeof $==="function")){if(!z)z=new I;D(z,$,q)}else if(h){if(!V)V=h();V.set($,q)}}};return b}:h}),R0=_((c,K)=>{var w=H2(),P=M4(),S=S0(),h=s6(),M=E0(),I=M||h||S;K.exports=function(){var G,D={assert:function(B){if(!D.has(B))throw new w("Side channel does not contain "+P(B))},delete:function(B){return!!G&&G.delete(B)},get:function(B){return G&&G.get(B)},has:function(B){return!!G&&G.has(B)},set:function(B,L){if(!G)G=I();G.set(B,L)}};return D}}),T4=_((c,K)=>{var w=String.prototype.replace,P=/%20/g,S={RFC1738:"RFC1738",RFC3986:"RFC3986"};K.exports={default:S.RFC3986,formatters:{RFC1738:function(h){return w.call(h,P,"+")},RFC3986:function(h){return String(h)}},RFC1738:S.RFC1738,RFC3986:S.RFC3986}}),a6=_((c,K)=>{var w=T4(),P=Object.prototype.hasOwnProperty,S=Array.isArray,h=function(){var Y=[];for(var X=0;X<256;++X)Y.push("%"+((X<16?"0":"")+X.toString(16)).toUpperCase());return Y}(),M=function(Y){while(Y.length>1){var X=Y.pop(),O=X.obj[X.prop];if(S(O)){var H=[];for(var o=0;o<O.length;++o)if(typeof O[o]<"u")H.push(O[o]);X.obj[X.prop]=H}}},I=function(Y,X){var O=X&&X.plainObjects?{__proto__:null}:{};for(var H=0;H<Y.length;++H)if(typeof Y[H]<"u")O[H]=Y[H];return O},G=function Y(X,O,H){if(!O)return X;if(typeof O!=="object"&&typeof O!=="function"){if(S(X))X.push(O);else if(X&&typeof X==="object"){if(H&&(H.plainObjects||H.allowPrototypes)||!P.call(Object.prototype,O))X[O]=!0}else return[X,O];return X}if(!X||typeof X!=="object")return[X].concat(O);var o=X;if(S(X)&&!S(O))o=I(X,H);if(S(X)&&S(O))return O.forEach(function(Q,r){if(P.call(X,r)){var g=X[r];if(g&&typeof g==="object"&&Q&&typeof Q==="object")X[r]=Y(g,Q,H);else X.push(Q)}else X[r]=Q}),X;return Object.keys(O).reduce(function(Q,r){var g=O[r];if(P.call(Q,r))Q[r]=Y(Q[r],g,H);else Q[r]=g;return Q},o)},D=function(Y,X){return Object.keys(X).reduce(function(O,H){return O[H]=X[H],O},Y)},B=function(Y,X,O){var H=Y.replace(/\+/g," ");if(O==="iso-8859-1")return H.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(H)}catch(o){return H}},L=1024,z=function(Y,X,O,H,o){if(Y.length===0)return Y;var Q=Y;if(typeof Y==="symbol")Q=Symbol.prototype.toString.call(Y);else if(typeof Y!=="string")Q=String(Y);if(O==="iso-8859-1")return escape(Q).replace(/%u[0-9a-f]{4}/gi,function(cc){return"%26%23"+parseInt(cc.slice(2),16)+"%3B"});var r="";for(var g=0;g<Q.length;g+=L){var A=Q.length>=L?Q.slice(g,g+L):Q,u=[];for(var n=0;n<A.length;++n){var C=A.charCodeAt(n);if(C===45||C===46||C===95||C===126||C>=48&&C<=57||C>=65&&C<=90||C>=97&&C<=122||o===w.RFC1738&&(C===40||C===41)){u[u.length]=A.charAt(n);continue}if(C<128){u[u.length]=h[C];continue}if(C<2048){u[u.length]=h[192|C>>6]+h[128|C&63];continue}if(C<55296||C>=57344){u[u.length]=h[224|C>>12]+h[128|C>>6&63]+h[128|C&63];continue}n+=1,C=65536+((C&1023)<<10|A.charCodeAt(n)&1023),u[u.length]=h[240|C>>18]+h[128|C>>12&63]+h[128|C>>6&63]+h[128|C&63]}r+=u.join("")}return r},V=function(Y){var X=[{obj:{o:Y},prop:"o"}],O=[];for(var H=0;H<X.length;++H){var o=X[H],Q=o.obj[o.prop],r=Object.keys(Q);for(var g=0;g<r.length;++g){var A=r[g],u=Q[A];if(typeof u==="object"&&u!==null&&O.indexOf(u)===-1)X.push({obj:Q,prop:A}),O.push(u)}}return M(X),Y},b=function(Y){return Object.prototype.toString.call(Y)==="[object RegExp]"},$=function(Y){if(!Y||typeof Y!=="object")return!1;return!!(Y.constructor&&Y.constructor.isBuffer&&Y.constructor.isBuffer(Y))},q=function(Y,X){return[].concat(Y,X)},W=function(Y,X){if(S(Y)){var O=[];for(var H=0;H<Y.length;H+=1)O.push(X(Y[H]));return O}return X(Y)};K.exports={arrayToObject:I,assign:D,combine:q,compact:V,decode:B,encode:z,isBuffer:$,isRegExp:b,maybeMap:W,merge:G}}),g0=_((c,K)=>{var w=R0(),P=a6(),S=T4(),h=Object.prototype.hasOwnProperty,M={brackets:function(W){return W+"[]"},comma:"comma",indices:function(W,Y){return W+"["+Y+"]"},repeat:function(W){return W}},I=Array.isArray,G=Array.prototype.push,D=function(W,Y){G.apply(W,I(Y)?Y:[Y])},B=Date.prototype.toISOString,L=S.default,z={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:P.encode,encodeValuesOnly:!1,filter:void 0,format:L,formatter:S.formatters[L],indices:!1,serializeDate:function(W){return B.call(W)},skipNulls:!1,strictNullHandling:!1},V=function(W){return typeof W==="string"||typeof W==="number"||typeof W==="boolean"||typeof W==="symbol"||typeof W==="bigint"},b={},$=function W(Y,X,O,H,o,Q,r,g,A,u,n,C,cc,Ic,wc,Gc,qc,vc){var p=Y,jc=vc,Fc=0,y=!1;while((jc=jc.get(b))!==void 0&&!y){var Qc=jc.get(Y);if(Fc+=1,typeof Qc<"u")if(Qc===Fc)throw RangeError("Cyclic object value");else y=!0;if(typeof jc.get(b)>"u")Fc=0}if(typeof u==="function")p=u(X,p);else if(p instanceof Date)p=cc(p);else if(O==="comma"&&I(p))p=P.maybeMap(p,function(Wc){if(Wc instanceof Date)return cc(Wc);return Wc});if(p===null){if(Q)return A&&!Gc?A(X,z.encoder,qc,"key",Ic):X;p=""}if(V(p)||P.isBuffer(p)){if(A){var Zc=Gc?X:A(X,z.encoder,qc,"key",Ic);return[wc(Zc)+"="+wc(A(p,z.encoder,qc,"value",Ic))]}return[wc(X)+"="+wc(String(p))]}var d=[];if(typeof p>"u")return d;var Ec;if(O==="comma"&&I(p)){if(Gc&&A)p=P.maybeMap(p,A);Ec=[{value:p.length>0?p.join(",")||null:void 0}]}else if(I(u))Ec=u;else{var Yc=Object.keys(p);Ec=n?Yc.sort(n):Yc}var Rc=g?String(X).replace(/\./g,"%2E"):String(X),Ac=H&&I(p)&&p.length===1?Rc+"[]":Rc;if(o&&I(p)&&p.length===0)return Ac+"[]";for(var l=0;l<Ec.length;++l){var s=Ec[l],T=typeof s==="object"&&s&&typeof s.value<"u"?s.value:p[s];if(r&&T===null)continue;var hc=C&&g?String(s).replace(/\./g,"%2E"):String(s),Jc=I(p)?typeof O==="function"?O(Ac,hc):Ac:Ac+(C?"."+hc:"["+hc+"]");vc.set(Y,Fc);var Xc=w();Xc.set(b,vc),D(d,W(T,Jc,O,H,o,Q,r,g,O==="comma"&&Gc&&I(p)?null:A,u,n,C,cc,Ic,wc,Gc,qc,Xc))}return d},q=function(W){if(!W)return z;if(typeof W.allowEmptyArrays<"u"&&typeof W.allowEmptyArrays!=="boolean")throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof W.encodeDotInKeys<"u"&&typeof W.encodeDotInKeys!=="boolean")throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(W.encoder!==null&&typeof W.encoder<"u"&&typeof W.encoder!=="function")throw TypeError("Encoder has to be a function.");var Y=W.charset||z.charset;if(typeof W.charset<"u"&&W.charset!=="utf-8"&&W.charset!=="iso-8859-1")throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var X=S.default;if(typeof W.format<"u"){if(!h.call(S.formatters,W.format))throw TypeError("Unknown format option provided.");X=W.format}var O=S.formatters[X],H=z.filter;if(typeof W.filter==="function"||I(W.filter))H=W.filter;var o;if(W.arrayFormat in M)o=W.arrayFormat;else if("indices"in W)o=W.indices?"indices":"repeat";else o=z.arrayFormat;if("commaRoundTrip"in W&&typeof W.commaRoundTrip!=="boolean")throw TypeError("`commaRoundTrip` must be a boolean, or absent");var Q=typeof W.allowDots>"u"?W.encodeDotInKeys===!0?!0:z.allowDots:!!W.allowDots;return{addQueryPrefix:typeof W.addQueryPrefix==="boolean"?W.addQueryPrefix:z.addQueryPrefix,allowDots:Q,allowEmptyArrays:typeof W.allowEmptyArrays==="boolean"?!!W.allowEmptyArrays:z.allowEmptyArrays,arrayFormat:o,charset:Y,charsetSentinel:typeof W.charsetSentinel==="boolean"?W.charsetSentinel:z.charsetSentinel,commaRoundTrip:!!W.commaRoundTrip,delimiter:typeof W.delimiter>"u"?z.delimiter:W.delimiter,encode:typeof W.encode==="boolean"?W.encode:z.encode,encodeDotInKeys:typeof W.encodeDotInKeys==="boolean"?W.encodeDotInKeys:z.encodeDotInKeys,encoder:typeof W.encoder==="function"?W.encoder:z.encoder,encodeValuesOnly:typeof W.encodeValuesOnly==="boolean"?W.encodeValuesOnly:z.encodeValuesOnly,filter:H,format:X,formatter:O,serializeDate:typeof W.serializeDate==="function"?W.serializeDate:z.serializeDate,skipNulls:typeof W.skipNulls==="boolean"?W.skipNulls:z.skipNulls,sort:typeof W.sort==="function"?W.sort:null,strictNullHandling:typeof W.strictNullHandling==="boolean"?W.strictNullHandling:z.strictNullHandling}};K.exports=function(W,Y){var X=W,O=q(Y),H,o;if(typeof O.filter==="function")o=O.filter,X=o("",X);else if(I(O.filter))o=O.filter,H=o;var Q=[];if(typeof X!=="object"||X===null)return"";var r=M[O.arrayFormat],g=r==="comma"&&O.commaRoundTrip;if(!H)H=Object.keys(X);if(O.sort)H.sort(O.sort);var A=w();for(var u=0;u<H.length;++u){var n=H[u],C=X[n];if(O.skipNulls&&C===null)continue;D(Q,$(C,n,r,g,O.allowEmptyArrays,O.strictNullHandling,O.skipNulls,O.encodeDotInKeys,O.encode?O.encoder:null,O.filter,O.sort,O.allowDots,O.serializeDate,O.format,O.formatter,O.encodeValuesOnly,O.charset,A))}var cc=Q.join(O.delimiter),Ic=O.addQueryPrefix===!0?"?":"";if(O.charsetSentinel)if(O.charset==="iso-8859-1")Ic+="utf8=%26%2310003%3B&";else Ic+="utf8=%E2%9C%93&";return cc.length>0?Ic+cc:""}}),k0=_((c,K)=>{var w=a6(),P=Object.prototype.hasOwnProperty,S=Array.isArray,h={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:w.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1000,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},M=function(b){return b.replace(/&#(\d+);/g,function($,q){return String.fromCharCode(parseInt(q,10))})},I=function(b,$,q){if(b&&typeof b==="string"&&$.comma&&b.indexOf(",")>-1)return b.split(",");if($.throwOnLimitExceeded&&q>=$.arrayLimit)throw RangeError("Array limit exceeded. Only "+$.arrayLimit+" element"+($.arrayLimit===1?"":"s")+" allowed in an array.");return b},G="utf8=%26%2310003%3B",D="utf8=%E2%9C%93",B=function(b,$){var q={__proto__:null},W=$.ignoreQueryPrefix?b.replace(/^\?/,""):b;W=W.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var Y=$.parameterLimit===1/0?void 0:$.parameterLimit,X=W.split($.delimiter,$.throwOnLimitExceeded?Y+1:Y);if($.throwOnLimitExceeded&&X.length>Y)throw RangeError("Parameter limit exceeded. Only "+Y+" parameter"+(Y===1?"":"s")+" allowed.");var O=-1,H,o=$.charset;if($.charsetSentinel){for(H=0;H<X.length;++H)if(X[H].indexOf("utf8=")===0){if(X[H]===D)o="utf-8";else if(X[H]===G)o="iso-8859-1";O=H,H=X.length}}for(H=0;H<X.length;++H){if(H===O)continue;var Q=X[H],r=Q.indexOf("]="),g=r===-1?Q.indexOf("="):r+1,A,u;if(g===-1)A=$.decoder(Q,h.decoder,o,"key"),u=$.strictNullHandling?null:"";else A=$.decoder(Q.slice(0,g),h.decoder,o,"key"),u=w.maybeMap(I(Q.slice(g+1),$,S(q[A])?q[A].length:0),function(C){return $.decoder(C,h.decoder,o,"value")});if(u&&$.interpretNumericEntities&&o==="iso-8859-1")u=M(String(u));if(Q.indexOf("[]=")>-1)u=S(u)?[u]:u;var n=P.call(q,A);if(n&&$.duplicates==="combine")q[A]=w.combine(q[A],u);else if(!n||$.duplicates==="last")q[A]=u}return q},L=function(b,$,q,W){var Y=0;if(b.length>0&&b[b.length-1]==="[]"){var X=b.slice(0,-1).join("");Y=Array.isArray($)&&$[X]?$[X].length:0}var O=W?$:I($,q,Y);for(var H=b.length-1;H>=0;--H){var o,Q=b[H];if(Q==="[]"&&q.parseArrays)o=q.allowEmptyArrays&&(O===""||q.strictNullHandling&&O===null)?[]:w.combine([],O);else{o=q.plainObjects?{__proto__:null}:{};var r=Q.charAt(0)==="["&&Q.charAt(Q.length-1)==="]"?Q.slice(1,-1):Q,g=q.decodeDotInKeys?r.replace(/%2E/g,"."):r,A=parseInt(g,10);if(!q.parseArrays&&g==="")o={0:O};else if(!isNaN(A)&&Q!==g&&String(A)===g&&A>=0&&(q.parseArrays&&A<=q.arrayLimit))o=[],o[A]=O;else if(g!=="__proto__")o[g]=O}O=o}return O},z=function(b,$,q,W){if(!b)return;var Y=q.allowDots?b.replace(/\.([^.[]+)/g,"[$1]"):b,X=/(\[[^[\]]*])/,O=/(\[[^[\]]*])/g,H=q.depth>0&&X.exec(Y),o=H?Y.slice(0,H.index):Y,Q=[];if(o){if(!q.plainObjects&&P.call(Object.prototype,o)){if(!q.allowPrototypes)return}Q.push(o)}var r=0;while(q.depth>0&&(H=O.exec(Y))!==null&&r<q.depth){if(r+=1,!q.plainObjects&&P.call(Object.prototype,H[1].slice(1,-1))){if(!q.allowPrototypes)return}Q.push(H[1])}if(H){if(q.strictDepth===!0)throw RangeError("Input depth exceeded depth option of "+q.depth+" and strictDepth is true");Q.push("["+Y.slice(H.index)+"]")}return L(Q,$,q,W)},V=function(b){if(!b)return h;if(typeof b.allowEmptyArrays<"u"&&typeof b.allowEmptyArrays!=="boolean")throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof b.decodeDotInKeys<"u"&&typeof b.decodeDotInKeys!=="boolean")throw TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(b.decoder!==null&&typeof b.decoder<"u"&&typeof b.decoder!=="function")throw TypeError("Decoder has to be a function.");if(typeof b.charset<"u"&&b.charset!=="utf-8"&&b.charset!=="iso-8859-1")throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof b.throwOnLimitExceeded<"u"&&typeof b.throwOnLimitExceeded!=="boolean")throw TypeError("`throwOnLimitExceeded` option must be a boolean");var $=typeof b.charset>"u"?h.charset:b.charset,q=typeof b.duplicates>"u"?h.duplicates:b.duplicates;if(q!=="combine"&&q!=="first"&&q!=="last")throw TypeError("The duplicates option must be either combine, first, or last");var W=typeof b.allowDots>"u"?b.decodeDotInKeys===!0?!0:h.allowDots:!!b.allowDots;return{allowDots:W,allowEmptyArrays:typeof b.allowEmptyArrays==="boolean"?!!b.allowEmptyArrays:h.allowEmptyArrays,allowPrototypes:typeof b.allowPrototypes==="boolean"?b.allowPrototypes:h.allowPrototypes,allowSparse:typeof b.allowSparse==="boolean"?b.allowSparse:h.allowSparse,arrayLimit:typeof b.arrayLimit==="number"?b.arrayLimit:h.arrayLimit,charset:$,charsetSentinel:typeof b.charsetSentinel==="boolean"?b.charsetSentinel:h.charsetSentinel,comma:typeof b.comma==="boolean"?b.comma:h.comma,decodeDotInKeys:typeof b.decodeDotInKeys==="boolean"?b.decodeDotInKeys:h.decodeDotInKeys,decoder:typeof b.decoder==="function"?b.decoder:h.decoder,delimiter:typeof b.delimiter==="string"||w.isRegExp(b.delimiter)?b.delimiter:h.delimiter,depth:typeof b.depth==="number"||b.depth===!1?+b.depth:h.depth,duplicates:q,ignoreQueryPrefix:b.ignoreQueryPrefix===!0,interpretNumericEntities:typeof b.interpretNumericEntities==="boolean"?b.interpretNumericEntities:h.interpretNumericEntities,parameterLimit:typeof b.parameterLimit==="number"?b.parameterLimit:h.parameterLimit,parseArrays:b.parseArrays!==!1,plainObjects:typeof b.plainObjects==="boolean"?b.plainObjects:h.plainObjects,strictDepth:typeof b.strictDepth==="boolean"?!!b.strictDepth:h.strictDepth,strictNullHandling:typeof b.strictNullHandling==="boolean"?b.strictNullHandling:h.strictNullHandling,throwOnLimitExceeded:typeof b.throwOnLimitExceeded==="boolean"?b.throwOnLimitExceeded:!1}};K.exports=function(b,$){var q=V($);if(b===""||b===null||typeof b>"u")return q.plainObjects?{__proto__:null}:{};var W=typeof b==="string"?B(b,q):b,Y=q.plainObjects?{__proto__:null}:{},X=Object.keys(W);for(var O=0;O<X.length;++O){var H=X[O],o=z(H,W[H],q,typeof b==="string");Y=w.merge(Y,o,q)}if(q.allowSparse===!0)return Y;return w.compact(Y)}}),x0=_((c,K)=>{var w=g0(),P=k0(),S=T4();K.exports={formats:S,parse:P,stringify:w}}),t9=h4(e4(),1),Z0={};K0(Z0,{zodSchemaKey:()=>o0,webSocketServerArgsKey:()=>N2,webSocketMessageArgsKey:()=>t2,webSocketKey:()=>P4,webSocketEventKey:()=>m0,webSocketEventArgumentsKey:()=>A0,webSocketConnectionArgsKey:()=>D2,webSocketCloseReasonArgsKey:()=>P8,webSocketCloseCodeArgsKey:()=>w8,routeModelArgsKey:()=>mc,responseStatusTextArgsKey:()=>h8,responseStatusArgsKey:()=>s2,responseHeadersArgsKey:()=>oc,responseBodyArgsKey:()=>d2,requestHeadersArgsKey:()=>K2,requestHeaderArgsKey:()=>ec,requestBodyArgsKey:()=>G2,requestArgsKey:()=>pc,queryArgsKey:()=>S8,paramsArgsKey:()=>y4,paramArgsKey:()=>j2,moduleKey:()=>i2,middlewareKey:()=>i4,interceptorKey:()=>n4,injectableKey:()=>K8,injectKey:()=>w4,httpServerArgsKey:()=>fc,guardKey:()=>c8,controllerKey:()=>K4,controllerHttpKey:()=>r0,contextArgsKey:()=>w2,containerKey:()=>J2,configKey:()=>C4,argumentsKey:()=>Uc});var Uc=Symbol.for("____boolTypescriptCore:arguments__"),A0=Symbol.for("____boolTypescriptCore:webSocketEventArguments__"),C4=Symbol.for("____boolTypescriptCore:config__"),K4=Symbol.for("____boolTypescriptCore:controller__"),n4=Symbol.for("____boolTypescriptCore:interceptor__"),c8=Symbol.for("____boolTypescriptCore:guard__"),r0=Symbol.for("____boolTypescriptCore:controller.http__"),w4=Symbol.for("____boolTypescriptCore:inject__"),K8=Symbol.for("____boolTypescriptCore:injectable__"),i4=Symbol.for("____boolTypescriptCore:middleware__"),i2=Symbol.for("____boolTypescriptCore:module__"),J2=Symbol.for("____boolTypescriptCore:container__"),o0=Symbol.for("____boolTypescriptCore:zodSchema__"),P4=Symbol.for("____boolTypescriptCore:webSocket__"),m0=Symbol.for("____boolTypescriptCore:webSocket:event__"),N2=Symbol.for("____boolTypescriptCore:webSocketArguments:server__"),D2=Symbol.for("____boolTypescriptCore:webSocketArguments:connection__"),t2=Symbol.for("____boolTypescriptCore:webSocketArguments:message__"),w8=Symbol.for("____boolTypescriptCore:webSocketArguments:closeCode__"),P8=Symbol.for("____boolTypescriptCore:webSocketArguments:closeReason__"),fc=Symbol.for("____boolTypescriptCore:httpArguments:server__"),K2=Symbol.for("____boolTypescriptCore:httpArguments:requestHeaders__"),ec=Symbol.for("____boolTypescriptCore:httpArguments:requestHeader__"),G2=Symbol.for("____boolTypescriptCore:httpArguments:requestBody__"),y4=Symbol.for("____boolTypescriptCore:httpArguments:params__"),j2=Symbol.for("____boolTypescriptCore:httpArguments:param__"),S8=Symbol.for("____boolTypescriptCore:httpArguments:query__"),pc=Symbol.for("____boolTypescriptCore:httpArguments:request__"),oc=Symbol.for("____boolTypescriptCore:httpArguments:responseHeaders__"),w2=Symbol.for("____boolTypescriptCore:httpArguments:context__"),mc=Symbol.for("____boolTypescriptCore:httpArguments:routeModel__"),d2=Symbol.for("____boolTypescriptCore:httpArguments:responseBody__"),s2=Symbol.for("____boolTypescriptCore:httpArguments:responseStatus__"),h8=Symbol.for("____boolTypescriptCore:httpArguments:responseStatusText__"),M8=(c)=>(K,w,P)=>{if(!w)return;let S=Reflect.getOwnMetadata(Uc,K.constructor,w)||{};S[`argumentIndexes.${P}`]={index:P,type:K2,validationSchema:c},Reflect.defineMetadata(Uc,S,K.constructor,w)};var I4=(c)=>(K,w,P)=>{if(!w)return;let S=Reflect.getOwnMetadata(Uc,K.constructor,w)||{};S[`argumentIndexes.${P}`]={index:P,type:w2,key:c},Reflect.defineMetadata(Uc,S,K.constructor,w)},W8=()=>(c,K,w)=>{if(!K)return;let P=Reflect.getOwnMetadata(Uc,c.constructor,K)||{};P[`argumentIndexes.${w}`]={index:w,type:mc},Reflect.defineMetadata(Uc,P,c.constructor,K)};var I8=(c)=>(K,w,P)=>{let S=Reflect.getMetadata(w4,K)||[];S[P]=c,Reflect.defineMetadata(w4,S,K)};var b8=()=>(c)=>{Reflect.defineMetadata(n4,void 0,c)},O8=()=>(c)=>{Reflect.defineMetadata(i4,void 0,c)};var d9=Symbol("__bool:webSocket.upgrade__");var u0=Object.freeze({400:"BAD_REQUEST",401:"UNAUTHORIZED",402:"PAYMENT_REQUIRED",403:"FORBIDDEN",404:"NOT_FOUND",405:"METHOD_NOT_ALLOWED",406:"NOT_ACCEPTABLE",407:"PROXY_AUTHENCATION_REQUIRED",408:"REQUEST_TIMEOUT",409:"CONFLICT",410:"GONE",411:"LENGTH_REQUIRED",412:"PRECONDITION_FAILED",413:"PAYLOAD_TOO_LARGE",414:"URI_TOO_LONG",415:"UNSUPPORTED_MEDIA_TYPE",416:"RANGE_NOT_SATISFIABLE",417:"EXPECTATION_FAILED",418:"IM_A_TEAPOT",421:"MISDIRECTED_REQUEST",422:"UNPROCESSABLE_ENTITY",423:"LOCKED",424:"FAILED_DEPENDENCY",425:"TOO_EARLY_",426:"UPGRAGE_REQUIRED",428:"PRECONDITION_REQUIRED",429:"TOO_MANY_REQUESTS",431:"REQUEST_HEADER_FIELDS_TOO_LARGE",451:"UNAVAILABLE_FOR_LEGAL_REASONS"});class P2 extends Error{httpCode;message;data;constructor({httpCode:c,data:K,message:w}){super();this.httpCode=c,this.message=!w?.trim()?u0[c]:w.trim(),this.data=K}}var C0=Object.freeze({500:"INTERNAL_SERVER_ERROR",501:"NOT_IMPLEMENTED",502:"BAD_GATEWAY",503:"SERVICE_UNAVAILABLE",504:"GATEWAY_TIMEOUT",505:"HTTP_VERSION_NOT_SUPPORTED",506:"VARIANT_ALSO_NEGOTIATES",507:"INSUFFICIENT_STORAGE",508:"LOOP_DETECTED",510:"NOT_EXTENDED",511:"NETWORK_AUTHENTICATION_REQUIRED"});class t4 extends Error{httpCode;message;data;constructor({httpCode:c,data:K,message:w}){super();this.httpCode=c,this.message=!w?.trim()?C0[c]:w.trim(),this.data=K}}var y0=(c,K=new Headers)=>{if(K.set("Content-Type","application/json"),c instanceof P2||c instanceof t4)return new Response(JSON.stringify(c),{status:c.httpCode,statusText:c.message,headers:K});return new Response(JSON.stringify((()=>{switch(typeof c){case"object":return!(c instanceof Error)?c:{message:c.message,code:c.name,cause:c.cause};case"string":return{message:c};case"number":return{code:c};default:return}})()),{status:500,statusText:"INTERNAL SERVER ERROR",headers:K})},gc;(function(c){c.year="year",c.month="month",c.day="day",c.hours="hours",c.minutes="minutes",c.seconds="seconds",c.miliseconds="miliseconds"})(gc||(gc={}));var _0=(c,K,w=gc.day)=>{let P=c instanceof Date?c:new Date(c);switch(w){case gc.year:P.setFullYear(P.getFullYear()+K);break;case gc.month:P.setMonth(P.getMonth()+K);break;case gc.day:P.setDate(P.getDate()+K);break;case gc.hours:P.setHours(P.getHours()+K);break;case gc.minutes:P.setMinutes(P.getMinutes()+K);break;case gc.seconds:P.setSeconds(P.getSeconds()+K);break;case gc.miliseconds:P.setMilliseconds(P.getMilliseconds()+K);break}return P},f0=h4(x0(),1),s9=async function(){}.constructor,f6=Object.freeze({black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37,gray:90}),e6=Object.freeze({black:40,red:41,green:42,yellow:43,blue:44,magenta:45,cyan:46,white:47,gray:100}),c2=(c,K={})=>{let{color:w,backgroundColor:P,bold:S,underline:h}=K,M="";if(S)M+="\x1B[1m";if(h)M+="\x1B[4m";if(w&&f6[w])M+=`\x1B[${f6[w]}m`;if(P&&e6[P])M+=`\x1B[${e6[P]}m`;return`${M}${c}\x1B[0m`},e0=(c)=>{let{headers:K,method:w}=c,P=K.get("upgrade")?.toLowerCase()||"",S=K.get("connection")?.toLowerCase()||"";return w==="GET"&&P?.toLowerCase()==="websocket"&&S?.toLowerCase().includes("upgrade")};class a2{_staticMap=new Map;_dynamicMap=new Map;_options=void 0;constructor(...c){c.forEach((K)=>{K.staticEntries.forEach(([w,P])=>this.set(w,P,{isStatic:!0,isPassthrough:!0})),K.dynamicEntries.forEach(([w,P])=>this.set(w,P,{isStatic:!1}))})}get(c,K){return!(K||this._options)?.isStatic?this._dynamicMap.get(c):this._staticMap.get(c)}has(c,K){return!(K||this._options)?.isStatic?this._dynamicMap.has(c):this._staticMap.has(c)}set(c,K,w){let P=w||this._options;if(!P?.isStatic)this._dynamicMap.set(c,K);else if(!this._staticMap.has(c))this._staticMap.set(c,K);else if(!P.isPassthrough)throw Error(`${String(c)} already exists in context static collection.`);return this}setOptions(c){return this._options=c,this}get staticEntries(){return[...this._staticMap.entries()]}get dynamicEntries(){return[...this._dynamicMap.entries()]}}class lc{static rootPattern=":([a-z0-9A-Z_-]{1,})";static innerRootPattern="([a-z0-9A-Z_-]{1,})";alias;_map=new Map;constructor(c){this.alias=this._thinAlias(c)}test(c,K){try{let w=this._map.get(K),P=this.alias.split("/"),S=this._thinAlias(c).split("/");if(!w)return;if(P.length!==S.length)return;let h=Object(),M=this.alias.replace(new RegExp(lc.rootPattern,"g"),lc.innerRootPattern);if(!new RegExp(M).test(this._thinAlias(c)))return;for(let I=0;I<P.length;I++){let G=P[I],D=S[I];if(!new RegExp(lc.rootPattern,"g").test(G)){if(G!==D)return}else{let B=!1;if(G.replace(new RegExp(lc.rootPattern,"g"),(L,z,V)=>{if(V===0)D.replace(new RegExp(lc.innerRootPattern,"g"),(b,$,q)=>{if(q===0)Object.assign(h,{[z]:b});return b});return L}),B)return}continue}return Object.freeze({parameters:h,model:w})}catch(w){return console.error(w),!1}}isMatch(c,K){try{if(!this._map.get(K))return;let w=this.alias.split("/"),P=this._thinAlias(c).split("/");if(w.length!==P.length)return!1;let S=Object();for(let h=0;h<w.length;h++){let M=w[h],I=P[h];if(!new RegExp(lc.rootPattern,"g").test(M)){if(M!==I)return!1}else{let G=!1;if(M.replace(new RegExp(lc.rootPattern,"g"),(D,B,L)=>{if(!new RegExp(L,"g").test(I))G=!0;else Object.assign(S,{[B]:I});return""}),G)return!1}continue}return!0}catch(w){console.error(w);return}}get(c){if(!this._map.get("GET"))this._map.set("GET",c);return this}post(c){if(!this._map.get("POST"))this._map.set("POST",c);return this}put(c){if(!this._map.get("PUT"))this._map.set("PUT",c);return this}delete(c){if(!this._map.get("DELETE"))this._map.set("DELETE",c);return this}connect(c){if(!this._map.get("CONNECT"))return this._map.set("CONNECT",c);return this}options(c){if(!this._map.get("OPTIONS"))return this._map.set("OPTIONS",c);return this}trace(c){if(!this._map.get("TRACE"))return this._map.set("TRACE",c);return this}patch(c){if(!this._map.get("PATCH"))return this._map.set("PATCH",c);return this}_thinAlias(c){return c.replace(new RegExp("[/]{2,}","g"),"/").replace(new RegExp("^[/]|[/]$","g"),"")}get _fullPath(){return this.alias.split("/").map((c,K)=>{let w=new RegExp(":([a-z0-9A-Z_.-]{1,})(\\(.*?\\))","g");if(!w.test(c)){if(w=new RegExp(":([a-z0-9A-Z_.-]{1,})","g"),!w.test(c))return c;return c.replace(w,(P,S)=>`${P}(.*?)`)}return c}).join("/")}get _filteredPath(){return this.alias.split("/").map((c,K)=>{let w=new RegExp(":([a-z0-9A-Z_.-]{1,})((.*?))","g");if(!w.test(c)){if(w=new RegExp(":([a-z0-9A-Z_.-]{1,})","g"),!w.test(c))return c;return c.replace(w,(P,S)=>"(.*?)")}return c.replace(w,(P,S,h)=>h)}).join("/")}}var p0=lc;class _4{alias;_routes=new Map;constructor(c){this.alias=this._thinAlias(c)}route(c){let K=this._thinAlias(`${this.alias}/${c}`),w=this._routes.get(K),P=!w?new p0(`${this.alias}/${c}`):w;if(!w)this._routes.set(K,P);return P}_thinAlias(c){return c.replace(new RegExp("[/]{2,}","g"),"/").replace(new RegExp("^[/]|[/]$","g"),"")}get routes(){return this._routes}}class f4{_routers=new Map;add(...c){for(let K of c){if(this._routers.has(K.alias))continue;this._routers.set(K.alias,K)}return this}find(c,K){for(let w of this._routers.values())for(let P of w.routes.values()){let S=P.test(c,K);if(!S)continue;return S}return}}var a9=h4(e4(),1);class c4{_mapper=new Map;constructor(...c){c.forEach((K)=>{K.entries.forEach(([w,P])=>{this._mapper.set(w,P)})})}get(c){if(this._mapper.has(c))return this._mapper.get(c);if(typeof c!=="function")return;let K=Reflect.getMetadataKeys(c);if(![K8,K4,i4,c8,n4,P4].some((S)=>K.includes(S)))throw Error("Missing dependency declaration, please check @Injectable() used on dependency(ies).");let w=(Reflect.getOwnMetadata(w4,c)||[]).map((S)=>this.get(S)),P=new c(...w);return this._mapper.set(c,P),P}set(c,K){if(this._mapper.has(c))throw Error(`${String(c)} already exists in injector collection.`);this._mapper.set(c,K)}get entries(){return[...this._mapper.entries()]}}class J8{error;constructor(c){this.error=c}}var l0=J8;class N8{eventName;metadata;_context=void 0;constructor({eventName:c,metadata:K}){this.eventName=c,this.metadata=K}bind(c){return this._context=c,this}execute(){if(this._context&&typeof this.metadata.descriptor.value==="function")this.metadata.descriptor.value=this.metadata.descriptor.value.bind(this._context);return Object.freeze({methodName:this.metadata.methodName,descriptor:this.metadata.descriptor,arguments:this.metadata.arguments})}}class d4{rawAlias;alias;routes=[];constructor(c="/"){this.rawAlias=c,this.alias=d4.thinAlias(c)}addRoutes(...c){for(let K of c)if(!this.routes.includes(K))this.routes.push(K);return this}bind(c){for(let K of this.routes)K.bind(c);return this}execute(){let c=new Map;for(let K of this.routes)c.set(`${this.alias}:::${K.eventName}`,K.execute());return c}static thinAlias(c){return c.replace(new RegExp("[/]{2,}","g"),"/").replace(new RegExp("^[/]|[/]$","g"),"")}}class S4{rawPrefix;prefix;routers=[];constructor(c="/"){this.rawPrefix=c,this.prefix=S4.thinPrefix(c)}addRouters(...c){for(let K=0;K<c.length;K++)if(!this.routers.includes(c[K]))this.routers.push(c[K]);for(let K of c)if(!this.routers.includes(K))this.routers.push(K);return this}execute(){let c=new Map;for(let K of this.routers){let w=K.execute();for(let[P,S]of w.entries())c.set(`/${S4.thinPrefix(`${this.prefix}/${P}`)}`,S)}return c}static thinPrefix(c){return c.replace(new RegExp("[/]{2,}","g"),"/").replace(new RegExp("^[/]|[/]$","g"),"")}}class T0{classConstructor;options;#c;#K;#w=new c4;#P=new Map;#h;#M=900;#S;constructor(c,K){if(this.classConstructor=c,this.options=K,this.#K=Reflect.getOwnMetadataKeys(c),!this.#K.includes(J2)&&!this.#K.includes(i2))throw Error(`Can not detect! ${c.name} class is not a container or module.`);this.#M=typeof K.static?.cacheTimeInSeconds!=="number"?900:K.static.cacheTimeInSeconds,this.#h=Object.freeze({allowLogsMethods:this.options?.log?.methods||[],staticOption:this.options.static,allowOrigins:!this.options.cors?.origins?["*"]:typeof this.options.cors.origins!=="string"?this.options.cors.origins.includes("*")||this.options.cors.origins.length<1?["*"]:this.options.cors.origins:[this.options.cors.origins!=="*"?this.options.cors.origins:"*"],allowMethods:this.options.cors?.methods||["GET","POST","PUT","PATCH","DELETE","OPTIONS"],allowCredentials:!this.options.cors?.credentials?!1:!0,allowHeaders:!this.options.cors?.headers||this.options.cors.headers.includes("*")?["*"]:this.options.cors.headers})}useValidator(c){this.#S=c}async preLaunch(){if(this.#c)return this.#c;let c=!this.#K.includes(J2)?void 0:Reflect.getOwnMetadata(J2,this.classConstructor),K=!this.#K.includes(J2)?[this.classConstructor]:c?.modules||[],w=!c?void 0:await this.containerResolution({containerClass:this.classConstructor,options:this.options,extendInjector:this.#w}),P=await Promise.all(K.map((M)=>this.moduleResolution({moduleClass:M,options:this.options,extendInjector:!w?this.#w:w.injector})));if([...new Set(P.map((M)=>M.prefix))].length!==P.length)throw Error("Module prefix should be unique.");let S=new Map;for(let M of P){let I=M.webSocketRouterGroup.execute();for(let[G,D]of I.entries())S.set(G,D)}let h=Object.freeze({containerMetadata:c,modulesConverted:K,resolutedContainer:w,resolutedModules:P,webSocketsMap:S});return this.#c=h,h}async listen(){let{allowLogsMethods:c,allowOrigins:K,allowMethods:w,allowHeaders:P,allowCredentials:S,staticOption:h}=this.#h,{resolutedContainer:M,resolutedModules:I,webSocketsMap:G}=await this.preLaunch(),D=Bun.serve({port:this.options.port,fetch:async(B,L)=>{let z=performance.now(),V=new URL(B.url),b=f0.parse(V.searchParams.toString(),this.options.queryParser),$=B.headers.get("origin")||"*",q=B.method.toUpperCase(),W=new Headers,Y=new a2().setOptions({isStatic:!0}).set(fc,L).set(pc,B).set(ec,B.headers).set(oc,W).set(S8,b);try{let X=e0(B),O;if(X){for(let A of I){let u=A.webSocketHttpRouterGroup.find(V.pathname,B.method);if(u){O=Object.freeze({route:u,resolution:A});break}}if(!O)return this.finalizeResponse(new Response(JSON.stringify({httpCode:404,message:"Route not found",data:void 0}),{status:404,statusText:"Not found.",headers:W}));let g=await this.webSocketFetcher({request:B,server:L},{query:b,responseHeaders:W,route:O.route,moduleResolution:O.resolution});return g instanceof Response?g:void 0}if([...!S?[]:[{key:"Access-Control-Allow-Credentials",value:"true"}],{key:"Access-Control-Allow-Origin",value:K.includes("*")?"*":!K.includes($)?K[0]:$},{key:"Access-Control-Allow-Methods",value:w.join(", ")},{key:"Access-Control-Allow-Headers",value:P.join(", ")}].forEach(({key:g,value:A})=>W.set(g,A)),!w.includes(q))return this.finalizeResponse(new Response(void 0,{status:405,statusText:"Method Not Allowed.",headers:W}));if(B.method.toUpperCase()==="OPTIONS")return this.finalizeResponse(K.includes("*")||K.includes($)?new Response(void 0,{status:204,statusText:"No Content.",headers:W}):new Response(void 0,{status:417,statusText:"Expectation Failed.",headers:W}));if(h){let{path:g,headers:A}=h,u=`${g}/${V.pathname}`,n=this.#P.get(u);if(!n){let C=Bun.file(u);if(await C.exists()){if(A)for(let[cc,Ic]of Object.entries(A))W.set(cc,Ic);return W.set("Content-Type",C.type),this.finalizeResponse(new Response(await C.arrayBuffer(),{status:200,statusText:"SUCCESS",headers:W}))}}else{let C=new Date>n.expiredAt;if(C)this.#P.delete(u);let cc=!C?n.file:Bun.file(u);if(await cc.exists()){if(this.#P.set(u,Object.freeze({expiredAt:_0(new Date,this.#M,gc.seconds),file:cc})),A)for(let[Ic,wc]of Object.entries(A))W.set(Ic,wc);return W.set("Content-Type",cc.type),this.finalizeResponse(new Response(await cc.arrayBuffer(),{status:200,statusText:"SUCCESS",headers:W}))}}}if(M){let{context:g}=await this.httpFetcher({context:Y,resolutedMap:{injector:M.injector,startMiddlewareGroup:M.startMiddlewareGroup,guardGroup:M.guardGroup},options:{isContainer:!0}});Y=g}for(let g of I){let A=g.controllerRouterGroup.find(V.pathname,q);if(A){O=Object.freeze({route:A,resolution:g});break}}if(!O)Y.setOptions({isStatic:!1}).set(s2,404).set(h8,"Not found.").set(d2,{httpCode:404,message:"Route not found",data:void 0});else{let{context:g}=await this.httpFetcher({context:Y,route:O.route,resolutedMap:O.resolution});Y=g}if(M){let{context:g}=await this.httpFetcher({context:Y,resolutedMap:{injector:M.injector,endMiddlewareGroup:M.endMiddlewareGroup},options:{isContainer:!0}});Y=g}let H=Y.get(oc,{isStatic:!0})||new Headers,o=Y.get(d2,{isStatic:!1})||void 0,Q=Y.get(s2,{isStatic:!1}),r=Y.get(s2,{isStatic:!1});return this.serializeResponse({status:typeof Q!=="number"?void 0:Q,statusText:typeof r!=="string"?void 0:r,headers:H,data:o})}catch(X){return this.options.debug&&console.error(X),this.finalizeResponse(y0(X,W))}finally{if(c){let X=performance.now(),O=c2(V.pathname,{color:"blue"}),H=`${Bun.color("yellow","ansi")}${process.pid}`,o=c2(B.method,{color:"yellow",backgroundColor:"blue"}),Q=c2(`${B.headers.get("x-forwarded-for")||B.headers.get("x-real-ip")||L.requestIP(B)?.address||"<Unknown>"}`,{color:"yellow"}),r=c2(`${Math.round((X-z+Number.EPSILON)*100)/100}ms`,{color:"yellow",backgroundColor:"blue"});c.includes(B.method.toUpperCase())&&console.info(`PID: ${H} - Method: ${o} - IP: ${Q} - ${O} - Time: ${r}`)}}},websocket:{open:(B)=>{let L=`${B.data.pathname}:::open`,z=G.get(L);if(!z)return;let V=z.arguments||{},b=[];for(let[$,q]of Object.entries(V))switch(q.type){case D2:b[q.index]=B;break;case N2:b[q.index]=D;break}z.descriptor.value(...b)},close:(B,L,z)=>{let V=`${B.data.pathname}:::close`,b=G.get(V);if(!b)return;let $=b.arguments||{},q=[];for(let[W,Y]of Object.entries($))switch(Y.type){case D2:q[Y.index]=B;break;case N2:q[Y.index]=D;break;case w8:q[Y.index]=L;break;case P8:q[Y.index]=z;break}b.descriptor.value(...q)},message:(B,L)=>{let z=`${B.data.pathname}:::message`,V=G.get(z);if(!V)return;let b=V.arguments||{},$=[];for(let[q,W]of Object.entries(b))switch(W.type){case D2:$[W.index]=B;break;case t2:$[W.index]=L;break;case N2:$[W.index]=D;break}V.descriptor.value(...$)},drain:(B)=>{let L=`${B.data.pathname}:::drain`,z=G.get(L);if(!z)return;let V=z.arguments||{},b=[];for(let[$,q]of Object.entries(V))switch(q.type){case D2:b[q.index]=B;break;case N2:b[q.index]=D;break}z.descriptor.value(...b)},ping:(B,L)=>{let z=`${B.data.pathname}:::ping`,V=G.get(z);if(!V)return;let b=V.arguments||{},$=[];for(let[q,W]of Object.entries(b))switch(W.type){case D2:$[W.index]=B;break;case N2:$[W.index]=D;break;case t2:$[W.index]=L;break}V.descriptor.value(...$)},pong:(B,L)=>{let z=`${B.data.pathname}:::pong`,V=G.get(z);if(!V)return;let b=V.arguments||{},$=[];for(let[q,W]of Object.entries(b))switch(W.type){case D2:$[W.index]=B;break;case N2:$[W.index]=D;break;case t2:$[W.index]=L;break}V.descriptor.value(...$)}}})}async containerResolution({containerClass:c,options:K,extendInjector:w}){if(!Reflect.getOwnMetadataKeys(c).includes(J2))throw Error(`${c.name} is not a container.`);let P=new c4(w),S=Reflect.getOwnMetadata(J2,c),{loaders:h,middlewares:M,guards:I,dependencies:G,config:D}=S||{},{config:B}=Object.freeze({config:{...typeof K.config!=="function"?K.config:await K.config(),...typeof D!=="function"?typeof D!=="object"?void 0:("key"in D)&&("value"in D)&&typeof D.key==="symbol"?typeof D.value!=="function"?D.value:await D.value():D:await D()}});if(P.set(D&&"key"in D&&"value"in D&&typeof D.key==="symbol"?D.key:C4,B),h){let b=[];for(let[q,W]of Object.entries(h))b.push(async()=>{try{let Y=await W({config:B});return console.info(`${c2(" INFO ",{color:"white",backgroundColor:"blue",bold:!0})} Loader [${q}] initialized successfully.`),Y}catch(Y){throw console.error(`${c2(" WARN ",{color:"yellow",backgroundColor:"red",bold:!0})} Loader [${q}] initialization failed.`),K.debug&&console.error(Y),Y}});let $=await Promise.all(b.map((q)=>q()));for(let[q,W]of $)P.set(q,W)}!G||G.map((b)=>P.get(b));let L=[],z=[];!M||M.forEach((b)=>{let $=P.get(b);if($.start&&typeof $.start==="function"){let q=Reflect.getOwnMetadata(Uc,b,"start")||{};L.push(Object.freeze({class:b,funcName:"start",func:$.start.bind($),argumentsMetadata:q}))}if($.end&&typeof $.end==="function"){let q=Reflect.getOwnMetadata(Uc,b,"end")||{};z.push(Object.freeze({class:b,funcName:"end",func:$.end.bind($),argumentsMetadata:q}))}});let V=!I?[]:I.map((b)=>{let $=P.get(b),q=Reflect.getOwnMetadata(Uc,b,"enforce")||{};return Object.freeze({class:b,funcName:"enforce",func:$.enforce.bind($),argumentsMetadata:q})});return Object.freeze({injector:P,startMiddlewareGroup:L,endMiddlewareGroup:z,guardGroup:V})}async moduleResolution({moduleClass:c,options:K,extendInjector:w}){if(!Reflect.getOwnMetadataKeys(c).includes(i2))throw Error(`${c.name} is not a module.`);let P=new c4(w),S=Reflect.getOwnMetadata(i2,c),{loaders:h,middlewares:M,guards:I,interceptors:G,controllers:D,dependencies:B,webSockets:L,prefix:z,config:V}=S||{},b=`${K.prefix||""}/${z||""}`,{config:$}=Object.freeze({config:{...typeof K.config!=="function"?K.config:await K.config(),...typeof V!=="function"?typeof V!=="object"?void 0:("key"in V)&&("value"in V)&&typeof V.key==="symbol"?typeof V.value!=="function"?V.value:await V.value():V:await V()}});if(P.set(V&&"key"in V&&"value"in V&&typeof V.key==="symbol"?V.key:C4,$),h){let r=[];for(let[A,u]of Object.entries(h))r.push(async()=>{try{let n=await u({config:$});return console.info(`${c2(" INFO ",{color:"white",backgroundColor:"blue",bold:!0})} Loader [${A}] initialized successfully.`),n}catch(n){throw console.error(`${c2(" WARN ",{color:"yellow",backgroundColor:"red",bold:!0})} Loader [${A}] initialization failed.`),K.debug&&console.error(n),n}});let g=await Promise.all(r.map((A)=>A()));for(let A=0;A<g.length;A++){let[u,n]=g[A];P.set(u,n)}}!B||B.map((r)=>P.get(r));let q=[],W=[];!M||M.forEach((r)=>{let g=P.get(r);if(g.start&&typeof g.start==="function"){let A=Reflect.getOwnMetadata(Uc,r,"start")||{};q.push(Object.freeze({class:r,funcName:"start",func:g.start.bind(g),argumentsMetadata:A}))}if(g.end&&typeof g.end==="function"){let A=Reflect.getOwnMetadata(Uc,r,"end")||{};W.push(Object.freeze({class:r,funcName:"end",func:g.end.bind(g),argumentsMetadata:A}))}});let Y=!I?[]:I.map((r)=>{let g=P.get(r),A=Reflect.getOwnMetadata(Uc,r,"enforce")||{};return Object.freeze({class:r,funcName:"enforce",func:g.enforce.bind(g),argumentsMetadata:A})}),X=[],O=[];!G||G.forEach((r)=>{let g=P.get(r);if(g.open&&typeof g.open==="function"){let A=Reflect.getOwnMetadata(Uc,r,"open")||{};X.push(Object.freeze({class:r,funcName:"open",func:g.open.bind(g),argumentsMetadata:A}))}if(g.close&&typeof g.close==="function"){let A=Reflect.getOwnMetadata(Uc,r,"close")||{};O.push(Object.freeze({class:r,funcName:"close",func:g.close.bind(g),argumentsMetadata:A}))}});let H=new f4;!D||D.forEach((r)=>this.initControllerInstance({controllerConstructor:r,httpRouterGroup:H,injector:P,prefix:b}));let o=new f4,Q=new S4;return L&&L.forEach((r)=>this.initWebSocketInstance({webSocketConstructor:r,httpRouterGroup:o,webSocketRouterGroup:Q,injector:P,prefix:b})),Object.freeze({prefix:z||"",injector:P,startMiddlewareGroup:q,endMiddlewareGroup:W,guardGroup:Y,openInterceptorGroup:X,closeInterceptorGroup:O,controllerRouterGroup:H,webSocketHttpRouterGroup:o,webSocketRouterGroup:Q})}async argumentsResolution(c,K,w,P){if(!this.#S)return c;try{let S=await this.#S.validate(c,K,w,P);if(!(S instanceof l0))return S;throw new P2({httpCode:400,message:`Validation at the [${P.toString()}] method fails at positional argument [${w}].`,data:S.error})}catch(S){if(S instanceof P2)throw S;throw new t4({httpCode:500,message:`Validation at the [${P.toString()}] method error at positional argument [${w}].`,data:!(S instanceof Error)?S:[{message:S.message,code:S.name,cause:S.cause}]})}}initControllerInstance({controllerConstructor:c,httpRouterGroup:K,injector:w,prefix:P}){if(!Reflect.getOwnMetadataKeys(c).includes(K4))throw Error(`${c.name} is not a controller.`);let S=w.get(c);if(!S)throw Error("Can not initialize controller.");let h=Reflect.getOwnMetadata(K4,c)||{prefix:"/",httpMetadata:[]},M=new _4(`/${P||""}/${h.prefix}`);return h.httpMetadata.forEach((I)=>{if(typeof I.descriptor.value!=="function")return;let G=M.route(I.path),D=I.descriptor.value.bind(S),B=Object.freeze({class:c,funcName:I.methodName,func:D,argumentsMetadata:I.argumentsMetadata});switch(I.httpMethod){case"GET":return G.get(B);case"POST":return G.post(B);case"PUT":return G.put(B);case"PATCH":return G.patch(B);case"DELETE":return G.delete(B);case"OPTIONS":return G.options(B)}}),K.add(M)}initWebSocketInstance({injector:c,httpRouterGroup:K,prefix:w,webSocketRouterGroup:P,webSocketConstructor:S}){if(!Reflect.getOwnMetadataKeys(S).includes(P4))throw Error(`${S.name} is not a websocket route.`);let h=c.get(S);if(!h)throw Error("Can not initialize webSocket.");let M=Reflect.getOwnMetadata(P4,S)||{prefix:"/",events:[],http:[]},I=`/${w||""}/${M.prefix}`,G=new _4(I);for(let[B,L]of Object.entries(M.http)){if(typeof L.descriptor?.value!=="function")continue;let z=G.route(L.path),V=L.descriptor.value.bind(h),b=Object.freeze({class:S,funcName:L.methodName,func:V,argumentsMetadata:L.argumentsMetadata});switch(L.httpMethod){case"GET":z.get(b);break;case"POST":z.post(b);break}}K.add(G);let D=new d4(I);for(let[B,L]of Object.entries(M.events)){let z=new N8({eventName:B,metadata:L});D.addRoutes(z)}return D.bind(h),P.addRouters(D),Object.freeze({httpRouterGroup:K,webSocketRouterGroup:P})}serializeResponse({status:c,statusText:K,headers:w,data:P}){let S=w.get("Content-Type")||"text/plain";if(S.includes("application/json"))return this.finalizeResponse(new Response(P instanceof ReadableStream?P:JSON.stringify(P),{status:c,statusText:K,headers:w}));if(S.includes("text/plain")||S.includes("text/html"))return this.finalizeResponse(new Response(P instanceof ReadableStream?P:String(P),{status:c,statusText:K,headers:w}));if(S.includes("application/octet-stream")){if(P instanceof Uint8Array||P instanceof ArrayBuffer||P instanceof Blob||P instanceof ReadableStream)return this.finalizeResponse(new Response(P instanceof Uint8Array?String.fromCharCode(...new Uint8Array(P)):P,{status:c,statusText:K,headers:w}));throw Error("Invalid data type for application/octet-stream")}if(S.includes("multipart/form-data")){if(P instanceof FormData)return this.finalizeResponse(new Response(P,{status:c,statusText:K,headers:w}));throw Error("multipart/form-data requires FormData object")}return this.finalizeResponse(new Response(String(P),{status:c,statusText:K,headers:w}))}finalizeResponse(c){return c.headers.set("X-Powered-By","Bool Typescript"),c}async httpFetcher({context:c,route:K,options:w,resolutedMap:P}){let S={isStatic:!0},h=(!c?new a2:new a2(c)).setOptions(S);if(K)h.set(y4,K.parameters).set(mc,K.model);let M=h.get(fc,S)||void 0,I=h.get(pc,S)||void 0,G=h.get(ec,S)||void 0,D=h.get(oc,S)||void 0,B=h.get(y4,S)||void 0,L=h.get(mc,S)||void 0;if(P){let{startMiddlewareGroup:z,guardGroup:V}=P;if(z)for(let b=0;b<z.length;b++){let $=[],{func:q,funcName:W,argumentsMetadata:Y}=z[b];for(let[X,O]of Object.entries(Y))switch(O.type){case w2:$[O.index]=!O.key?h:h.get(O.key,S);break;case pc:$[O.index]=!O.validationSchema?I:await this.argumentsResolution(I,O.validationSchema,O.index,W);break;case G2:$[O.index]=!O.validationSchema?await I?.[O.parser||"json"]():await this.argumentsResolution(await I?.[O.parser||"json"](),O.validationSchema,O.index,W);break;case K2:$[O.index]=!O.validationSchema?G:await this.argumentsResolution(G?.toJSON(),O.validationSchema,O.index,W);break;case ec:$[O.index]=!O.validationSchema?G?.get(O.key)||void 0:await this.argumentsResolution(G?.get(O.key)||void 0,O.validationSchema,O.index,W);break;case j2:$[O.index]=!O.validationSchema?B?.[O.key]||void 0:await this.argumentsResolution(B?.[O.key]||void 0,O.validationSchema,O.index,W);break;case mc:$[O.index]=L;break;case oc:$[O.index]=D;break;case fc:$[O.index]=M;break;default:$[O.index]=!O.validationSchema?!h.has(O.type,S)?void 0:h.get(O.type,S):await this.argumentsResolution(!(O.type in h)?void 0:h.get(O.type,S),O.validationSchema,O.index,W);break}await q(...$)}if(V)for(let b=0;b<V.length;b++){let $=[],{func:q,funcName:W,argumentsMetadata:Y}=V[b];for(let[O,H]of Object.entries(Y))switch(H.type){case pc:$[H.index]=!H.validationSchema?I:await this.argumentsResolution(I,H.validationSchema,H.index,W);break;case G2:$[H.index]=!H.validationSchema?await I?.[H.parser||"json"]():await this.argumentsResolution(await I?.[H.parser||"json"](),H.validationSchema,H.index,W);break;case w2:$[H.index]=!H.key?h:h.get(H.key);break;case K2:$[H.index]=!H.validationSchema?G:await this.argumentsResolution(G?.toJSON(),H.validationSchema,H.index,W);break;case oc:$[H.index]=D;break;case ec:$[H.index]=!H.validationSchema?G?.get(H.key)||void 0:await this.argumentsResolution(G?.get(H.key)||void 0,H.validationSchema,H.index,W);break;case j2:$[H.index]=!H.validationSchema?B?.[H.key]||void 0:await this.argumentsResolution(B?.[H.key],H.validationSchema,H.index,W);break;case mc:$[H.index]=L;break;case fc:$[H.index]=M;break;default:$[H.index]=!H.validationSchema?!h.has(H.type)?void 0:h.get(H.type):await this.argumentsResolution(h.get(H.type),H.validationSchema,H.index,W);break}let X=await q(...$);if(typeof X!=="boolean"||!X)throw new P2({httpCode:401,message:"Unauthorization.",data:void 0})}}if(L&&!w?.isContainer){if(P&&"openInterceptorGroup"in P&&P.openInterceptorGroup){let{openInterceptorGroup:q}=P;for(let W=0;W<q.length;W++){let Y=[],{func:X,funcName:O,argumentsMetadata:H}=q[W];for(let[o,Q]of Object.entries(H))switch(Q.type){case pc:Y[Q.index]=!Q.validationSchema?I:await this.argumentsResolution(I,Q.validationSchema,Q.index,O);break;case G2:Y[Q.index]=!Q.validationSchema?await I?.[Q.parser||"json"]():await this.argumentsResolution(await I?.[Q.parser||"json"](),Q.validationSchema,Q.index,O);break;case w2:Y[Q.index]=!Q.key?h:h.get(Q.key);break;case K2:Y[Q.index]=!Q.validationSchema?G:await this.argumentsResolution(G?.toJSON(),Q.validationSchema,Q.index,O);break;case ec:Y[Q.index]=!Q.validationSchema?G?.get(Q.key)||void 0:await this.argumentsResolution(G?.get(Q.key)||void 0,Q.validationSchema,Q.index,O);break;case oc:Y[Q.index]=D;break;case j2:Y[Q.index]=!Q.validationSchema?B?.[Q.key]||void 0:await this.argumentsResolution(B?.[Q.key]||void 0,Q.validationSchema,Q.index,O);break;case mc:Y[Q.index]=L;break;case fc:Y[Q.index]=M;break;default:Y[Q.index]=!Q.validationSchema?!h.has(Q.type)?void 0:h.get(Q.type):await this.argumentsResolution(h.get(Q.type),Q.validationSchema,Q.index,O);break}await X(...Y)}}let z=[],{func:V,funcName:b,argumentsMetadata:$}=L;for(let[q,W]of Object.entries($))switch(W.type){case pc:z[W.index]=!W.validationSchema?I:await this.argumentsResolution(I,W.validationSchema,W.index,b);break;case G2:z[W.index]=!W.validationSchema?await I?.[W.parser||"json"]():await this.argumentsResolution(await I?.[W.parser||"json"](),W.validationSchema,W.index,b);break;case w2:z[W.index]=!W.key?h:h.get(W.key);break;case K2:z[W.index]=!W.validationSchema?G:await this.argumentsResolution(G?.toJSON(),W.validationSchema,W.index,b);break;case ec:z[W.index]=!W.validationSchema?G?.get(W.key)||void 0:await this.argumentsResolution(G?.get(W.key)||void 0,W.validationSchema,W.index,b);break;case oc:z[W.index]=D;break;case j2:z[W.index]=!W.validationSchema?B?.[W.key]||void 0:await this.argumentsResolution(B?.[W.key]||void 0,W.validationSchema,W.index,b);break;case mc:z[W.index]=L;break;case fc:z[W.index]=M;break;default:z[W.index]=!W.validationSchema?!h.has(W.type)?void 0:h.get(W.type):await this.argumentsResolution(h.get(W.type),W.validationSchema,W.index,b);break}if(h.set(d2,await V(...z),{isStatic:!1}),P&&"closeInterceptorGroup"in P&&P.closeInterceptorGroup){let{closeInterceptorGroup:q}=P;for(let W=0;W<q.length;W++){let Y=[],{func:X,funcName:O,argumentsMetadata:H}=q[W];for(let[o,Q]of Object.entries(H))switch(Q.type){case pc:Y[Q.index]=!Q.validationSchema?I:await this.argumentsResolution(I,Q.validationSchema,Q.index,O);break;case G2:Y[Q.index]=!Q.validationSchema?await I?.[Q.parser||"json"]():await this.argumentsResolution(await I?.[Q.parser||"json"](),Q.validationSchema,Q.index,O);break;case w2:Y[Q.index]=!Q.key?h:h.get(Q.key);break;case K2:Y[Q.index]=!Q.validationSchema?G:await this.argumentsResolution(G?.toJSON(),Q.validationSchema,Q.index,O);break;case oc:Y[Q.index]=h.get(Q.type);break;case ec:Y[Q.index]=!Q.validationSchema?G?.get(Q.key)||void 0:await this.argumentsResolution(G?.get(Q.key)||void 0,Q.validationSchema,Q.index,O);break;case j2:Y[Q.index]=!Q.validationSchema?B?.[Q.key]||void 0:await this.argumentsResolution(B?.[Q.key]||void 0,Q.validationSchema,Q.index,O);break;case mc:Y[Q.index]=L;break;case fc:Y[Q.index]=M;break;default:Y[Q.index]=!Q.validationSchema?!h.has(Q.type)?void 0:h.get(Q.type):await this.argumentsResolution(h.get(Q.type),Q.validationSchema,Q.index,O);break}await X(...Y)}}}if(P){let{endMiddlewareGroup:z}=P;if(z)for(let V=0;V<z.length;V++){let b=[],{func:$,funcName:q,argumentsMetadata:W}=z[V];for(let[Y,X]of Object.entries(W))switch(X.type){case pc:b[X.index]=!X.validationSchema?I:await this.argumentsResolution(I,X.validationSchema,X.index,q);break;case G2:b[X.index]=!X.validationSchema?await I?.[X.parser||"json"]():await this.argumentsResolution(await I?.[X.parser||"json"](),X.validationSchema,X.index,q);break;case w2:b[X.index]=!X.key?h:h.get(X.key);break;case K2:b[X.index]=!X.validationSchema?G:await this.argumentsResolution(G?.toJSON(),X.validationSchema,X.index,q);break;case oc:b[X.index]=h.get(X.type);break;case ec:b[X.index]=!X.validationSchema?G?.get(X.key)||void 0:await this.argumentsResolution(G?.get(X.key)||void 0,X.validationSchema,X.index,q);break;case j2:b[X.index]=!X.validationSchema?B?.[X.key]||void 0:await this.argumentsResolution(B?.[X.key]||void 0,X.validationSchema,X.index,q);break;case mc:b[X.index]=L;break;case fc:b[X.index]=M;break;default:b[X.index]=!X.validationSchema?!h.has(X.type)?void 0:h.get(X.type):await this.argumentsResolution(!(X.type in h)?void 0:h.get(X.type),X.validationSchema,X.index,q);break}await $(...b)}}return Object.freeze({context:h})}async webSocketFetcher(c,K){let{request:w,server:P}=c,{query:S,responseHeaders:h,route:{model:M}}=K,I=await M.func(...[P,w,S]);if(typeof I!=="boolean")return this.finalizeResponse(new Response(JSON.stringify({httpCode:500,message:"Can not detect webSocket upgrade result.",data:void 0}),{status:500,statusText:"Internal server error.",headers:h}));if(!I)return this.finalizeResponse(new Response(JSON.stringify({httpCode:500,message:"Can not upgrade.",data:void 0}),{status:500,statusText:"Internal server error.",headers:h}));return I}}var cw=h4(e4(),1);var s4=()=>I4(Nc.authState);var n0=()=>(c)=>{Reflect.defineMetadata(Nc.guardMetadata,void 0,c)};class a4{open(c,K){if(Reflect.getOwnMetadataKeys(c.class.prototype,c.funcName).includes(Nc.authState)){if(!K)throw new P2({httpCode:401,message:"Unauthorized",data:void 0});return}if(Reflect.getOwnMetadataKeys(c.class).includes(Nc.authState)){if(!K)throw new P2({httpCode:401,message:"Unauthorized",data:void 0});return}}}Y2([O2(0,W8()),O2(1,s4())],a4.prototype,"open",null),a4=Y2([b8()],a4);var Tc=new TextEncoder,V2=new TextDecoder;function D8(...c){let K=c.reduce((S,{length:h})=>S+h,0),w=new Uint8Array(K),P=0;for(let S of c)w.set(S,P),P+=S.length;return w}function G8(c){if(Uint8Array.prototype.toBase64)return c.toBase64();let K=32768,w=[];for(let P=0;P<c.length;P+=K)w.push(String.fromCharCode.apply(null,c.subarray(P,P+K)));return btoa(w.join(""))}function j8(c){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(c);let K=atob(c),w=new Uint8Array(K.length);for(let P=0;P<K.length;P++)w[P]=K.charCodeAt(P);return w}function X8(c){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof c==="string"?c:V2.decode(c),{alphabet:"base64url"});let K=c;if(K instanceof Uint8Array)K=V2.decode(K);K=K.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return j8(K)}catch{throw TypeError("The input to be decoded is not correctly encoded.")}}function b4(c){let K=c;if(typeof K==="string")K=Tc.encode(K);if(Uint8Array.prototype.toBase64)return K.toBase64({alphabet:"base64url",omitPadding:!0});return G8(K).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}class O4 extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(c,K){super(c,K);this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class kc extends O4{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class S2 extends O4{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"}class c6 extends O4{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}function uc(c,K="algorithm.name"){return TypeError(`CryptoKey does not support this operation, its ${K} must be ${c}`)}function L2(c,K){return c.name===K}function K6(c){return parseInt(c.name.slice(4),10)}function d0(c){switch(c){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw Error("unreachable")}}function s0(c,K){if(K&&!c.usages.includes(K))throw TypeError(`CryptoKey does not support this operation, its usages must include ${K}.`)}function B8(c,K,w){switch(K){case"HS256":case"HS384":case"HS512":{if(!L2(c.algorithm,"HMAC"))throw uc("HMAC");let P=parseInt(K.slice(2),10);if(K6(c.algorithm.hash)!==P)throw uc(`SHA-${P}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!L2(c.algorithm,"RSASSA-PKCS1-v1_5"))throw uc("RSASSA-PKCS1-v1_5");let P=parseInt(K.slice(2),10);if(K6(c.algorithm.hash)!==P)throw uc(`SHA-${P}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!L2(c.algorithm,"RSA-PSS"))throw uc("RSA-PSS");let P=parseInt(K.slice(2),10);if(K6(c.algorithm.hash)!==P)throw uc(`SHA-${P}`,"algorithm.hash");break}case"Ed25519":case"EdDSA":{if(!L2(c.algorithm,"Ed25519"))throw uc("Ed25519");break}case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":{if(!L2(c.algorithm,K))throw uc(K);break}case"ES256":case"ES384":case"ES512":{if(!L2(c.algorithm,"ECDSA"))throw uc("ECDSA");let P=d0(K);if(c.algorithm.namedCurve!==P)throw uc(P,"algorithm.namedCurve");break}default:throw TypeError("CryptoKey does not support this operation")}s0(c,w)}function z8(c,K,...w){if(w=w.filter(Boolean),w.length>2){let P=w.pop();c+=`one of type ${w.join(", ")}, or ${P}.`}else if(w.length===2)c+=`one of type ${w[0]} or ${w[1]}.`;else c+=`of type ${w[0]}.`;if(K==null)c+=` Received ${K}`;else if(typeof K==="function"&&K.name)c+=` Received function ${K.name}`;else if(typeof K==="object"&&K!=null){if(K.constructor?.name)c+=` Received an instance of ${K.constructor.name}`}return c}var $8=(c,...K)=>{return z8("Key must be ",c,...K)};function w6(c,K,...w){return z8(`Key for the ${c} algorithm must be `,K,...w)}function P6(c){return c?.[Symbol.toStringTag]==="CryptoKey"}function S6(c){return c?.[Symbol.toStringTag]==="KeyObject"}var h6=(c)=>{return P6(c)||S6(c)};var Q8=(...c)=>{let K=c.filter(Boolean);if(K.length===0||K.length===1)return!0;let w;for(let P of K){let S=Object.keys(P);if(!w||w.size===0){w=new Set(S);continue}for(let h of S){if(w.has(h))return!1;w.add(h)}}return!0};function a0(c){return typeof c==="object"&&c!==null}var J4=(c)=>{if(!a0(c)||Object.prototype.toString.call(c)!=="[object Object]")return!1;if(Object.getPrototypeOf(c)===null)return!0;let K=c;while(Object.getPrototypeOf(K)!==null)K=Object.getPrototypeOf(K);return Object.getPrototypeOf(c)===K};var U8=(c,K)=>{if(c.startsWith("RS")||c.startsWith("PS")){let{modulusLength:w}=K.algorithm;if(typeof w!=="number"||w<2048)throw TypeError(`${c} requires key modulusLength to be 2048 bits or larger`)}};function c1(c){let K,w;switch(c.kty){case"AKP":{switch(c.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":K={name:c.alg},w=c.priv?["sign"]:["verify"];break;default:throw new kc('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"RSA":{switch(c.alg){case"PS256":case"PS384":case"PS512":K={name:"RSA-PSS",hash:`SHA-${c.alg.slice(-3)}`},w=c.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":K={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${c.alg.slice(-3)}`},w=c.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":K={name:"RSA-OAEP",hash:`SHA-${parseInt(c.alg.slice(-3),10)||1}`},w=c.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new kc('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(c.alg){case"ES256":K={name:"ECDSA",namedCurve:"P-256"},w=c.d?["sign"]:["verify"];break;case"ES384":K={name:"ECDSA",namedCurve:"P-384"},w=c.d?["sign"]:["verify"];break;case"ES512":K={name:"ECDSA",namedCurve:"P-521"},w=c.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":K={name:"ECDH",namedCurve:c.crv},w=c.d?["deriveBits"]:[];break;default:throw new kc('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(c.alg){case"Ed25519":case"EdDSA":K={name:"Ed25519"},w=c.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":K={name:c.crv},w=c.d?["deriveBits"]:[];break;default:throw new kc('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new kc('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:K,keyUsages:w}}var Y8=async(c)=>{if(!c.alg)throw TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:K,keyUsages:w}=c1(c),P={...c};if(P.kty!=="AKP")delete P.alg;return delete P.use,crypto.subtle.importKey("jwk",P,K,c.ext??(c.d||c.priv?!1:!0),c.key_ops??w)};var H8=(c,K,w,P,S)=>{if(S.crit!==void 0&&P?.crit===void 0)throw new c('"crit" (Critical) Header Parameter MUST be integrity protected');if(!P||P.crit===void 0)return new Set;if(!Array.isArray(P.crit)||P.crit.length===0||P.crit.some((M)=>typeof M!=="string"||M.length===0))throw new c('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let h;if(w!==void 0)h=new Map([...Object.entries(w),...K.entries()]);else h=K;for(let M of P.crit){if(!h.has(M))throw new kc(`Extension Header Parameter "${M}" is not recognized`);if(S[M]===void 0)throw new c(`Extension Header Parameter "${M}" is missing`);if(h.get(M)&&P[M]===void 0)throw new c(`Extension Header Parameter "${M}" MUST be integrity protected`)}return new Set(P.crit)};function Z2(c){return J4(c)&&typeof c.kty==="string"}function V8(c){return c.kty!=="oct"&&(c.kty==="AKP"&&typeof c.priv==="string"||typeof c.d==="string")}function L8(c){return c.kty!=="oct"&&typeof c.d>"u"&&typeof c.priv>"u"}function q8(c){return c.kty==="oct"&&typeof c.k==="string"}var q2,v8=async(c,K,w,P=!1)=>{q2||=new WeakMap;let S=q2.get(c);if(S?.[w])return S[w];let h=await Y8({...K,alg:w});if(P)Object.freeze(c);if(!S)q2.set(c,{[w]:h});else S[w]=h;return h},w1=(c,K)=>{q2||=new WeakMap;let w=q2.get(c);if(w?.[K])return w[K];let P=c.type==="public",S=P?!0:!1,h;if(c.asymmetricKeyType==="x25519"){switch(K){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw TypeError("given KeyObject instance cannot be used for this algorithm")}h=c.toCryptoKey(c.asymmetricKeyType,S,P?[]:["deriveBits"])}if(c.asymmetricKeyType==="ed25519"){if(K!=="EdDSA"&&K!=="Ed25519")throw TypeError("given KeyObject instance cannot be used for this algorithm");h=c.toCryptoKey(c.asymmetricKeyType,S,[P?"verify":"sign"])}switch(c.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":{if(K!==c.asymmetricKeyType.toUpperCase())throw TypeError("given KeyObject instance cannot be used for this algorithm");h=c.toCryptoKey(c.asymmetricKeyType,S,[P?"verify":"sign"])}}if(c.asymmetricKeyType==="rsa"){let M;switch(K){case"RSA-OAEP":M="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":M="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":M="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":M="SHA-512";break;default:throw TypeError("given KeyObject instance cannot be used for this algorithm")}if(K.startsWith("RSA-OAEP"))return c.toCryptoKey({name:"RSA-OAEP",hash:M},S,P?["encrypt"]:["decrypt"]);h=c.toCryptoKey({name:K.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:M},S,[P?"verify":"sign"])}if(c.asymmetricKeyType==="ec"){let I=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(c.asymmetricKeyDetails?.namedCurve);if(!I)throw TypeError("given KeyObject instance cannot be used for this algorithm");if(K==="ES256"&&I==="P-256")h=c.toCryptoKey({name:"ECDSA",namedCurve:I},S,[P?"verify":"sign"]);if(K==="ES384"&&I==="P-384")h=c.toCryptoKey({name:"ECDSA",namedCurve:I},S,[P?"verify":"sign"]);if(K==="ES512"&&I==="P-521")h=c.toCryptoKey({name:"ECDSA",namedCurve:I},S,[P?"verify":"sign"]);if(K.startsWith("ECDH-ES"))h=c.toCryptoKey({name:"ECDH",namedCurve:I},S,P?[]:["deriveBits"])}if(!h)throw TypeError("given KeyObject instance cannot be used for this algorithm");if(!w)q2.set(c,{[K]:h});else w[K]=h;return h},F8=async(c,K)=>{if(c instanceof Uint8Array)return c;if(P6(c))return c;if(S6(c)){if(c.type==="secret")return c.export();if("toCryptoKey"in c&&typeof c.toCryptoKey==="function")try{return w1(c,K)}catch(P){if(P instanceof TypeError)throw P}let w=c.export({format:"jwk"});return v8(c,w,K)}if(Z2(c)){if(c.k)return X8(c.k);return v8(c,c,K,!0)}throw Error("unreachable")};var v2=(c)=>c?.[Symbol.toStringTag],M6=(c,K,w)=>{if(K.use!==void 0){let P;switch(w){case"sign":case"verify":P="sig";break;case"encrypt":case"decrypt":P="enc";break}if(K.use!==P)throw TypeError(`Invalid key for this operation, its "use" must be "${P}" when present`)}if(K.alg!==void 0&&K.alg!==c)throw TypeError(`Invalid key for this operation, its "alg" must be "${c}" when present`);if(Array.isArray(K.key_ops)){let P;switch(!0){case(w==="sign"||w==="verify"):case c==="dir":case c.includes("CBC-HS"):P=w;break;case c.startsWith("PBES2"):P="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(c):if(!c.includes("GCM")&&c.endsWith("KW"))P=w==="encrypt"?"wrapKey":"unwrapKey";else P=w;break;case(w==="encrypt"&&c.startsWith("RSA")):P="wrapKey";break;case w==="decrypt":P=c.startsWith("RSA")?"unwrapKey":"deriveBits";break}if(P&&K.key_ops?.includes?.(P)===!1)throw TypeError(`Invalid key for this operation, its "key_ops" must include "${P}" when present`)}return!0},P1=(c,K,w)=>{if(K instanceof Uint8Array)return;if(Z2(K)){if(q8(K)&&M6(c,K,w))return;throw TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!h6(K))throw TypeError(w6(c,K,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if(K.type!=="secret")throw TypeError(`${v2(K)} instances for symmetric algorithms must be of type "secret"`)},S1=(c,K,w)=>{if(Z2(K))switch(w){case"decrypt":case"sign":if(V8(K)&&M6(c,K,w))return;throw TypeError("JSON Web Key for this operation be a private JWK");case"encrypt":case"verify":if(L8(K)&&M6(c,K,w))return;throw TypeError("JSON Web Key for this operation be a public JWK")}if(!h6(K))throw TypeError(w6(c,K,"CryptoKey","KeyObject","JSON Web Key"));if(K.type==="secret")throw TypeError(`${v2(K)} instances for asymmetric algorithms must not be of type "secret"`);if(K.type==="public")switch(w){case"sign":throw TypeError(`${v2(K)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw TypeError(`${v2(K)} instances for asymmetric algorithm decryption must be of type "private"`);default:break}if(K.type==="private")switch(w){case"verify":throw TypeError(`${v2(K)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw TypeError(`${v2(K)} instances for asymmetric algorithm encryption must be of type "public"`);default:break}},E8=(c,K,w)=>{if(c.startsWith("HS")||c==="dir"||c.startsWith("PBES2")||/^A(?:128|192|256)(?:GCM)?(?:KW)?$/.test(c)||/^A(?:128|192|256)CBC-HS(?:256|384|512)$/.test(c))P1(c,K,w);else S1(c,K,w)};var R8=(c,K)=>{let w=`SHA-${c.slice(-3)}`;switch(c){case"HS256":case"HS384":case"HS512":return{hash:w,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:w,name:"RSA-PSS",saltLength:parseInt(c.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:w,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:w,name:"ECDSA",namedCurve:K.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:c};default:throw new kc(`alg ${c} is not supported either by JOSE or your javascript runtime`)}};var g8=async(c,K,w)=>{if(K instanceof Uint8Array){if(!c.startsWith("HS"))throw TypeError($8(K,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",K,{hash:`SHA-${c.slice(-3)}`,name:"HMAC"},!1,[w])}return B8(K,c,w),K};var h2=(c)=>Math.floor(c.getTime()/1000);var h1=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,N4=(c)=>{let K=h1.exec(c);if(!K||K[4]&&K[1])throw TypeError("Invalid time period format");let w=parseFloat(K[2]),P=K[3].toLowerCase(),S;switch(P){case"sec":case"secs":case"second":case"seconds":case"s":S=Math.round(w);break;case"minute":case"minutes":case"min":case"mins":case"m":S=Math.round(w*60);break;case"hour":case"hours":case"hr":case"hrs":case"h":S=Math.round(w*3600);break;case"day":case"days":case"d":S=Math.round(w*86400);break;case"week":case"weeks":case"w":S=Math.round(w*604800);break;default:S=Math.round(w*31557600);break}if(K[1]==="-"||K[4]==="ago")return-S;return S};function X2(c,K){if(!Number.isFinite(K))throw TypeError(`Invalid ${c} input`);return K}class W6{#c;constructor(c){if(!J4(c))throw TypeError("JWT Claims Set MUST be an object");this.#c=structuredClone(c)}data(){return Tc.encode(JSON.stringify(this.#c))}get iss(){return this.#c.iss}set iss(c){this.#c.iss=c}get sub(){return this.#c.sub}set sub(c){this.#c.sub=c}get aud(){return this.#c.aud}set aud(c){this.#c.aud=c}set jti(c){this.#c.jti=c}set nbf(c){if(typeof c==="number")this.#c.nbf=X2("setNotBefore",c);else if(c instanceof Date)this.#c.nbf=X2("setNotBefore",h2(c));else this.#c.nbf=h2(new Date)+N4(c)}set exp(c){if(typeof c==="number")this.#c.exp=X2("setExpirationTime",c);else if(c instanceof Date)this.#c.exp=X2("setExpirationTime",h2(c));else this.#c.exp=h2(new Date)+N4(c)}set iat(c){if(typeof c>"u")this.#c.iat=h2(new Date);else if(c instanceof Date)this.#c.iat=X2("setIssuedAt",h2(c));else if(typeof c==="string")this.#c.iat=X2("setIssuedAt",h2(new Date)+N4(c));else this.#c.iat=X2("setIssuedAt",c)}}var k8=async(c,K,w)=>{let P=await g8(c,K,"sign");U8(c,P);let S=await crypto.subtle.sign(R8(c,P.algorithm),P,w);return new Uint8Array(S)};class I6{#c;#K;#w;constructor(c){if(!(c instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");this.#c=c}setProtectedHeader(c){if(this.#K)throw TypeError("setProtectedHeader can only be called once");return this.#K=c,this}setUnprotectedHeader(c){if(this.#w)throw TypeError("setUnprotectedHeader can only be called once");return this.#w=c,this}async sign(c,K){if(!this.#K&&!this.#w)throw new S2("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!Q8(this.#K,this.#w))throw new S2("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let w={...this.#K,...this.#w},P=H8(S2,new Map([["b64",!0]]),K?.crit,this.#K,w),S=!0;if(P.has("b64")){if(S=this.#K.b64,typeof S!=="boolean")throw new S2('The "b64" (base64url-encode payload) Header Parameter must be a boolean')}let{alg:h}=w;if(typeof h!=="string"||!h)throw new S2('JWS "alg" (Algorithm) Header Parameter missing or invalid');E8(h,c,"sign");let M=this.#c;if(S)M=Tc.encode(b4(M));let I;if(this.#K)I=Tc.encode(b4(JSON.stringify(this.#K)));else I=Tc.encode("");let G=D8(I,Tc.encode("."),M),D=await F8(c,h),B=await k8(h,D,G),L={signature:b4(B),payload:""};if(S)L.payload=V2.decode(M);if(this.#w)L.header=this.#w;if(this.#K)L.protected=V2.decode(I);return L}}class b6{#c;constructor(c){this.#c=new I6(c)}setProtectedHeader(c){return this.#c.setProtectedHeader(c),this}async sign(c,K){let w=await this.#c.sign(c,K);if(w.payload===void 0)throw TypeError("use the flattened module for creating JWS with b64: false");return`${w.protected}.${w.payload}.${w.signature}`}}class D4{#c;#K;constructor(c={}){this.#K=new W6(c)}setIssuer(c){return this.#K.iss=c,this}setSubject(c){return this.#K.sub=c,this}setAudience(c){return this.#K.aud=c,this}setJti(c){return this.#K.jti=c,this}setNotBefore(c){return this.#K.nbf=c,this}setExpirationTime(c){return this.#K.exp=c,this}setIssuedAt(c){return this.#K.iat=c,this}setProtectedHeader(c){return this.#c=c,this}async sign(c,K){let w=new b6(this.#K.data());if(w.setProtectedHeader(this.#c),Array.isArray(this.#c?.crit)&&this.#c.crit.includes("b64")&&this.#c.b64===!1)throw new c6("JWTs MUST NOT use unencoded payload");return w.sign(c,K)}}var $P=Object.freeze({status:"aborted"});function F(c,K,w){function P(I,G){var D;Object.defineProperty(I,"_zod",{value:I._zod??{},enumerable:!1}),(D=I._zod).traits??(D.traits=new Set),I._zod.traits.add(c),K(I,G);for(let B in M.prototype)if(!(B in I))Object.defineProperty(I,B,{value:M.prototype[B].bind(I)});I._zod.constr=M,I._zod.def=G}let S=w?.Parent??Object;class h extends S{}Object.defineProperty(h,"name",{value:c});function M(I){var G;let D=w?.Parent?new h:this;P(D,I),(G=D._zod).deferred??(G.deferred=[]);for(let B of D._zod.deferred)B();return D}return Object.defineProperty(M,"init",{value:P}),Object.defineProperty(M,Symbol.hasInstance,{value:(I)=>{if(w?.Parent&&I instanceof w.Parent)return!0;return I?._zod?.traits?.has(c)}}),Object.defineProperty(M,"name",{value:c}),M}var QP=Symbol("zod_brand");class nc extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class A2 extends Error{constructor(c){super(`Encountered unidirectional transform during encode: ${c}`);this.name="ZodEncodeError"}}var G4={};function ic(c){if(c)Object.assign(G4,c);return G4}var a={};m4(a,{unwrapMessage:()=>r2,uint8ArrayToHex:()=>g1,uint8ArrayToBase64url:()=>E1,uint8ArrayToBase64:()=>_8,stringifyPrimitive:()=>o8,shallowClone:()=>A8,safeExtend:()=>H1,required:()=>q1,randomString:()=>X1,propertyKeyTypes:()=>D6,promiseAllObject:()=>j1,primitiveTypes:()=>r8,prefixIssues:()=>C2,pick:()=>Q1,partial:()=>L1,optionalKeys:()=>G6,omit:()=>U1,objectClone:()=>N1,numKeys:()=>B1,nullish:()=>m2,normalizeParams:()=>e,mergeDefs:()=>W2,merge:()=>V1,jsonStringifyReplacer:()=>E2,joinValues:()=>J1,issue:()=>R2,isPlainObject:()=>B2,isObject:()=>F2,hexToUint8Array:()=>R1,getSizableOrigin:()=>C8,getParsedType:()=>z1,getLengthableOrigin:()=>y2,getEnumValues:()=>J6,getElementAtPath:()=>G1,floatSafeRemainder:()=>Z8,finalizeIssue:()=>Cc,extend:()=>Y1,escapeRegex:()=>z2,esc:()=>j4,defineLazy:()=>Kc,createTransparentProxy:()=>$1,cloneDef:()=>D1,clone:()=>xc,cleanRegex:()=>u2,cleanEnum:()=>v1,captureStackTrace:()=>X4,cached:()=>o2,base64urlToUint8Array:()=>F1,base64ToUint8Array:()=>y8,assignProp:()=>M2,assertNotEqual:()=>W1,assertNever:()=>b1,assertIs:()=>I1,assertEqual:()=>M1,assert:()=>O1,allowsEval:()=>N6,aborted:()=>I2,NUMBER_FORMAT_RANGES:()=>m8,Class:()=>f8,BIGINT_FORMAT_RANGES:()=>u8});function M1(c){return c}function W1(c){return c}function I1(c){}function b1(c){throw Error()}function O1(c){}function J6(c){let K=Object.values(c).filter((P)=>typeof P==="number");return Object.entries(c).filter(([P,S])=>K.indexOf(+P)===-1).map(([P,S])=>S)}function J1(c,K="|"){return c.map((w)=>o8(w)).join(K)}function E2(c,K){if(typeof K==="bigint")return K.toString();return K}function o2(c){return{get value(){{let w=c();return Object.defineProperty(this,"value",{value:w}),w}throw Error("cached value already set")}}}function m2(c){return c===null||c===void 0}function u2(c){let K=c.startsWith("^")?1:0,w=c.endsWith("$")?c.length-1:c.length;return c.slice(K,w)}function Z8(c,K){let w=(c.toString().split(".")[1]||"").length,P=K.toString(),S=(P.split(".")[1]||"").length;if(S===0&&/\d?e-\d?/.test(P)){let G=P.match(/\d?e-(\d?)/);if(G?.[1])S=Number.parseInt(G[1])}let h=w>S?w:S,M=Number.parseInt(c.toFixed(h).replace(".","")),I=Number.parseInt(K.toFixed(h).replace(".",""));return M%I/10**h}var x8=Symbol("evaluating");function Kc(c,K,w){let P=void 0;Object.defineProperty(c,K,{get(){if(P===x8)return;if(P===void 0)P=x8,P=w();return P},set(S){Object.defineProperty(c,K,{value:S})},configurable:!0})}function N1(c){return Object.create(Object.getPrototypeOf(c),Object.getOwnPropertyDescriptors(c))}function M2(c,K,w){Object.defineProperty(c,K,{value:w,writable:!0,enumerable:!0,configurable:!0})}function W2(...c){let K={};for(let w of c){let P=Object.getOwnPropertyDescriptors(w);Object.assign(K,P)}return Object.defineProperties({},K)}function D1(c){return W2(c._zod.def)}function G1(c,K){if(!K)return c;return K.reduce((w,P)=>w?.[P],c)}function j1(c){let K=Object.keys(c),w=K.map((P)=>c[P]);return Promise.all(w).then((P)=>{let S={};for(let h=0;h<K.length;h++)S[K[h]]=P[h];return S})}function X1(c=10){let w="";for(let P=0;P<c;P++)w+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return w}function j4(c){return JSON.stringify(c)}var X4="captureStackTrace"in Error?Error.captureStackTrace:(...c)=>{};function F2(c){return typeof c==="object"&&c!==null&&!Array.isArray(c)}var N6=o2(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(c){return!1}});function B2(c){if(F2(c)===!1)return!1;let K=c.constructor;if(K===void 0)return!0;let w=K.prototype;if(F2(w)===!1)return!1;if(Object.prototype.hasOwnProperty.call(w,"isPrototypeOf")===!1)return!1;return!0}function A8(c){if(B2(c))return{...c};if(Array.isArray(c))return[...c];return c}function B1(c){let K=0;for(let w in c)if(Object.prototype.hasOwnProperty.call(c,w))K++;return K}var z1=(c)=>{let K=typeof c;switch(K){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(c)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(c))return"array";if(c===null)return"null";if(c.then&&typeof c.then==="function"&&c.catch&&typeof c.catch==="function")return"promise";if(typeof Map<"u"&&c instanceof Map)return"map";if(typeof Set<"u"&&c instanceof Set)return"set";if(typeof Date<"u"&&c instanceof Date)return"date";if(typeof File<"u"&&c instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${K}`)}},D6=new Set(["string","number","symbol"]),r8=new Set(["string","number","bigint","boolean","symbol","undefined"]);function z2(c){return c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xc(c,K,w){let P=new c._zod.constr(K??c._zod.def);if(!K||w?.parent)P._zod.parent=c;return P}function e(c){let K=c;if(!K)return{};if(typeof K==="string")return{error:()=>K};if(K?.message!==void 0){if(K?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");K.error=K.message}if(delete K.message,typeof K.error==="string")return{...K,error:()=>K.error};return K}function $1(c){let K;return new Proxy({},{get(w,P,S){return K??(K=c()),Reflect.get(K,P,S)},set(w,P,S,h){return K??(K=c()),Reflect.set(K,P,S,h)},has(w,P){return K??(K=c()),Reflect.has(K,P)},deleteProperty(w,P){return K??(K=c()),Reflect.deleteProperty(K,P)},ownKeys(w){return K??(K=c()),Reflect.ownKeys(K)},getOwnPropertyDescriptor(w,P){return K??(K=c()),Reflect.getOwnPropertyDescriptor(K,P)},defineProperty(w,P,S){return K??(K=c()),Reflect.defineProperty(K,P,S)}})}function o8(c){if(typeof c==="bigint")return c.toString()+"n";if(typeof c==="string")return`"${c}"`;return`${c}`}function G6(c){return Object.keys(c).filter((K)=>{return c[K]._zod.optin==="optional"&&c[K]._zod.optout==="optional"})}var m8={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},u8={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Q1(c,K){let w=c._zod.def,P=W2(c._zod.def,{get shape(){let S={};for(let h in K){if(!(h in w.shape))throw Error(`Unrecognized key: "${h}"`);if(!K[h])continue;S[h]=w.shape[h]}return M2(this,"shape",S),S},checks:[]});return xc(c,P)}function U1(c,K){let w=c._zod.def,P=W2(c._zod.def,{get shape(){let S={...c._zod.def.shape};for(let h in K){if(!(h in w.shape))throw Error(`Unrecognized key: "${h}"`);if(!K[h])continue;delete S[h]}return M2(this,"shape",S),S},checks:[]});return xc(c,P)}function Y1(c,K){if(!B2(K))throw Error("Invalid input to extend: expected a plain object");let w=c._zod.def.checks;if(w&&w.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let S=W2(c._zod.def,{get shape(){let h={...c._zod.def.shape,...K};return M2(this,"shape",h),h},checks:[]});return xc(c,S)}function H1(c,K){if(!B2(K))throw Error("Invalid input to safeExtend: expected a plain object");let w={...c._zod.def,get shape(){let P={...c._zod.def.shape,...K};return M2(this,"shape",P),P},checks:c._zod.def.checks};return xc(c,w)}function V1(c,K){let w=W2(c._zod.def,{get shape(){let P={...c._zod.def.shape,...K._zod.def.shape};return M2(this,"shape",P),P},get catchall(){return K._zod.def.catchall},checks:[]});return xc(c,w)}function L1(c,K,w){let P=W2(K._zod.def,{get shape(){let S=K._zod.def.shape,h={...S};if(w)for(let M in w){if(!(M in S))throw Error(`Unrecognized key: "${M}"`);if(!w[M])continue;h[M]=c?new c({type:"optional",innerType:S[M]}):S[M]}else for(let M in S)h[M]=c?new c({type:"optional",innerType:S[M]}):S[M];return M2(this,"shape",h),h},checks:[]});return xc(K,P)}function q1(c,K,w){let P=W2(K._zod.def,{get shape(){let S=K._zod.def.shape,h={...S};if(w)for(let M in w){if(!(M in h))throw Error(`Unrecognized key: "${M}"`);if(!w[M])continue;h[M]=new c({type:"nonoptional",innerType:S[M]})}else for(let M in S)h[M]=new c({type:"nonoptional",innerType:S[M]});return M2(this,"shape",h),h},checks:[]});return xc(K,P)}function I2(c,K=0){if(c.aborted===!0)return!0;for(let w=K;w<c.issues.length;w++)if(c.issues[w]?.continue!==!0)return!0;return!1}function C2(c,K){return K.map((w)=>{var P;return(P=w).path??(P.path=[]),w.path.unshift(c),w})}function r2(c){return typeof c==="string"?c:c?.message}function Cc(c,K,w){let P={...c,path:c.path??[]};if(!c.message){let S=r2(c.inst?._zod.def?.error?.(c))??r2(K?.error?.(c))??r2(w.customError?.(c))??r2(w.localeError?.(c))??"Invalid input";P.message=S}if(delete P.inst,delete P.continue,!K?.reportInput)delete P.input;return P}function C8(c){if(c instanceof Set)return"set";if(c instanceof Map)return"map";if(c instanceof File)return"file";return"unknown"}function y2(c){if(Array.isArray(c))return"array";if(typeof c==="string")return"string";return"unknown"}function R2(...c){let[K,w,P]=c;if(typeof K==="string")return{message:K,code:"custom",input:w,inst:P};return{...K}}function v1(c){return Object.entries(c).filter(([K,w])=>{return Number.isNaN(Number.parseInt(K,10))}).map((K)=>K[1])}function y8(c){let K=atob(c),w=new Uint8Array(K.length);for(let P=0;P<K.length;P++)w[P]=K.charCodeAt(P);return w}function _8(c){let K="";for(let w=0;w<c.length;w++)K+=String.fromCharCode(c[w]);return btoa(K)}function F1(c){let K=c.replace(/-/g,"+").replace(/_/g,"/"),w="=".repeat((4-K.length%4)%4);return y8(K+w)}function E1(c){return _8(c).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function R1(c){let K=c.replace(/^0x/,"");if(K.length%2!==0)throw Error("Invalid hex string length");let w=new Uint8Array(K.length/2);for(let P=0;P<K.length;P+=2)w[P/2]=Number.parseInt(K.slice(P,P+2),16);return w}function g1(c){return Array.from(c).map((K)=>K.toString(16).padStart(2,"0")).join("")}class f8{constructor(...c){}}var e8=(c,K)=>{c.name="$ZodError",Object.defineProperty(c,"_zod",{value:c._zod,enumerable:!1}),Object.defineProperty(c,"issues",{value:K,enumerable:!1}),c.message=JSON.stringify(K,E2,2),Object.defineProperty(c,"toString",{value:()=>c.message,enumerable:!1})},B4=F("$ZodError",e8),j6=F("$ZodError",e8,{Parent:Error});function p8(c,K=(w)=>w.message){let w={},P=[];for(let S of c.issues)if(S.path.length>0)w[S.path[0]]=w[S.path[0]]||[],w[S.path[0]].push(K(S));else P.push(K(S));return{formErrors:P,fieldErrors:w}}function l8(c,K){let w=K||function(h){return h.message},P={_errors:[]},S=(h)=>{for(let M of h.issues)if(M.code==="invalid_union"&&M.errors.length)M.errors.map((I)=>S({issues:I}));else if(M.code==="invalid_key")S({issues:M.issues});else if(M.code==="invalid_element")S({issues:M.issues});else if(M.path.length===0)P._errors.push(w(M));else{let I=P,G=0;while(G<M.path.length){let D=M.path[G];if(G!==M.path.length-1)I[D]=I[D]||{_errors:[]};else I[D]=I[D]||{_errors:[]},I[D]._errors.push(w(M));I=I[D],G++}}};return S(c),P}var z4=(c)=>(K,w,P,S)=>{let h=P?Object.assign(P,{async:!1}):{async:!1},M=K._zod.run({value:w,issues:[]},h);if(M instanceof Promise)throw new nc;if(M.issues.length){let I=new(S?.Err??c)(M.issues.map((G)=>Cc(G,h,ic())));throw X4(I,S?.callee),I}return M.value};var $4=(c)=>async(K,w,P,S)=>{let h=P?Object.assign(P,{async:!0}):{async:!0},M=K._zod.run({value:w,issues:[]},h);if(M instanceof Promise)M=await M;if(M.issues.length){let I=new(S?.Err??c)(M.issues.map((G)=>Cc(G,h,ic())));throw X4(I,S?.callee),I}return M.value};var _2=(c)=>(K,w,P)=>{let S=P?{...P,async:!1}:{async:!1},h=K._zod.run({value:w,issues:[]},S);if(h instanceof Promise)throw new nc;return h.issues.length?{success:!1,error:new(c??B4)(h.issues.map((M)=>Cc(M,S,ic())))}:{success:!0,data:h.value}},T8=_2(j6),f2=(c)=>async(K,w,P)=>{let S=P?Object.assign(P,{async:!0}):{async:!0},h=K._zod.run({value:w,issues:[]},S);if(h instanceof Promise)h=await h;return h.issues.length?{success:!1,error:new c(h.issues.map((M)=>Cc(M,S,ic())))}:{success:!0,data:h.value}},n8=f2(j6),i8=(c)=>(K,w,P)=>{let S=P?Object.assign(P,{direction:"backward"}):{direction:"backward"};return z4(c)(K,w,S)};var t8=(c)=>(K,w,P)=>{return z4(c)(K,w,P)};var d8=(c)=>async(K,w,P)=>{let S=P?Object.assign(P,{direction:"backward"}):{direction:"backward"};return $4(c)(K,w,S)};var s8=(c)=>async(K,w,P)=>{return $4(c)(K,w,P)};var a8=(c)=>(K,w,P)=>{let S=P?Object.assign(P,{direction:"backward"}):{direction:"backward"};return _2(c)(K,w,S)};var cK=(c)=>(K,w,P)=>{return _2(c)(K,w,P)};var KK=(c)=>async(K,w,P)=>{let S=P?Object.assign(P,{direction:"backward"}):{direction:"backward"};return f2(c)(K,w,S)};var wK=(c)=>async(K,w,P)=>{return f2(c)(K,w,P)};var PK=/^[cC][^\s-]{8,}$/,SK=/^[0-9a-z]+$/,hK=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,MK=/^[0-9a-vA-V]{20}$/,WK=/^[A-Za-z0-9]{27}$/,IK=/^[a-zA-Z0-9_-]{21}$/,bK=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var OK=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,X6=(c)=>{if(!c)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${c}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var JK=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function NK(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var DK=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,GK=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,jK=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,XK=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,BK=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,B6=/^[A-Za-z0-9_-]*$/,zK=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;var $K=/^\+(?:[0-9]){6,14}[0-9]$/,QK="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",UK=new RegExp(`^${QK}$`);function YK(c){return typeof c.precision==="number"?c.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":c.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${c.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function HK(c){return new RegExp(`^${YK(c)}$`)}function VK(c){let K=YK({precision:c.precision}),w=["Z"];if(c.local)w.push("");if(c.offset)w.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let P=`${K}(?:${w.join("|")})`;return new RegExp(`^${QK}T(?:${P})$`)}var LK=(c)=>{let K=c?`[\\s\\S]{${c?.minimum??0},${c?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${K}$`)};var qK=/^[^A-Z]*$/,vK=/^[^a-z]*$/;var Vc=F("$ZodCheck",(c,K)=>{var w;c._zod??(c._zod={}),c._zod.def=K,(w=c._zod).onattach??(w.onattach=[])});var FK=F("$ZodCheckMaxLength",(c,K)=>{var w;Vc.init(c,K),(w=c._zod.def).when??(w.when=(P)=>{let S=P.value;return!m2(S)&&S.length!==void 0}),c._zod.onattach.push((P)=>{let S=P._zod.bag.maximum??Number.POSITIVE_INFINITY;if(K.maximum<S)P._zod.bag.maximum=K.maximum}),c._zod.check=(P)=>{let S=P.value;if(S.length<=K.maximum)return;let M=y2(S);P.issues.push({origin:M,code:"too_big",maximum:K.maximum,inclusive:!0,input:S,inst:c,continue:!K.abort})}}),EK=F("$ZodCheckMinLength",(c,K)=>{var w;Vc.init(c,K),(w=c._zod.def).when??(w.when=(P)=>{let S=P.value;return!m2(S)&&S.length!==void 0}),c._zod.onattach.push((P)=>{let S=P._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(K.minimum>S)P._zod.bag.minimum=K.minimum}),c._zod.check=(P)=>{let S=P.value;if(S.length>=K.minimum)return;let M=y2(S);P.issues.push({origin:M,code:"too_small",minimum:K.minimum,inclusive:!0,input:S,inst:c,continue:!K.abort})}}),RK=F("$ZodCheckLengthEquals",(c,K)=>{var w;Vc.init(c,K),(w=c._zod.def).when??(w.when=(P)=>{let S=P.value;return!m2(S)&&S.length!==void 0}),c._zod.onattach.push((P)=>{let S=P._zod.bag;S.minimum=K.length,S.maximum=K.length,S.length=K.length}),c._zod.check=(P)=>{let S=P.value,h=S.length;if(h===K.length)return;let M=y2(S),I=h>K.length;P.issues.push({origin:M,...I?{code:"too_big",maximum:K.length}:{code:"too_small",minimum:K.length},inclusive:!0,exact:!0,input:P.value,inst:c,continue:!K.abort})}}),e2=F("$ZodCheckStringFormat",(c,K)=>{var w,P;if(Vc.init(c,K),c._zod.onattach.push((S)=>{let h=S._zod.bag;if(h.format=K.format,K.pattern)h.patterns??(h.patterns=new Set),h.patterns.add(K.pattern)}),K.pattern)(w=c._zod).check??(w.check=(S)=>{if(K.pattern.lastIndex=0,K.pattern.test(S.value))return;S.issues.push({origin:"string",code:"invalid_format",format:K.format,input:S.value,...K.pattern?{pattern:K.pattern.toString()}:{},inst:c,continue:!K.abort})});else(P=c._zod).check??(P.check=()=>{})}),gK=F("$ZodCheckRegex",(c,K)=>{e2.init(c,K),c._zod.check=(w)=>{if(K.pattern.lastIndex=0,K.pattern.test(w.value))return;w.issues.push({origin:"string",code:"invalid_format",format:"regex",input:w.value,pattern:K.pattern.toString(),inst:c,continue:!K.abort})}}),kK=F("$ZodCheckLowerCase",(c,K)=>{K.pattern??(K.pattern=qK),e2.init(c,K)}),xK=F("$ZodCheckUpperCase",(c,K)=>{K.pattern??(K.pattern=vK),e2.init(c,K)}),ZK=F("$ZodCheckIncludes",(c,K)=>{Vc.init(c,K);let w=z2(K.includes),P=new RegExp(typeof K.position==="number"?`^.{${K.position}}${w}`:w);K.pattern=P,c._zod.onattach.push((S)=>{let h=S._zod.bag;h.patterns??(h.patterns=new Set),h.patterns.add(P)}),c._zod.check=(S)=>{if(S.value.includes(K.includes,K.position))return;S.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:K.includes,input:S.value,inst:c,continue:!K.abort})}}),AK=F("$ZodCheckStartsWith",(c,K)=>{Vc.init(c,K);let w=new RegExp(`^${z2(K.prefix)}.*`);K.pattern??(K.pattern=w),c._zod.onattach.push((P)=>{let S=P._zod.bag;S.patterns??(S.patterns=new Set),S.patterns.add(w)}),c._zod.check=(P)=>{if(P.value.startsWith(K.prefix))return;P.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:K.prefix,input:P.value,inst:c,continue:!K.abort})}}),rK=F("$ZodCheckEndsWith",(c,K)=>{Vc.init(c,K);let w=new RegExp(`.*${z2(K.suffix)}$`);K.pattern??(K.pattern=w),c._zod.onattach.push((P)=>{let S=P._zod.bag;S.patterns??(S.patterns=new Set),S.patterns.add(w)}),c._zod.check=(P)=>{if(P.value.endsWith(K.suffix))return;P.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:K.suffix,input:P.value,inst:c,continue:!K.abort})}});var oK=F("$ZodCheckOverwrite",(c,K)=>{Vc.init(c,K),c._zod.check=(w)=>{w.value=K.tx(w.value)}});class z6{constructor(c=[]){if(this.content=[],this.indent=0,this)this.args=c}indented(c){this.indent+=1,c(this),this.indent-=1}write(c){if(typeof c==="function"){c(this,{execution:"sync"}),c(this,{execution:"async"});return}let w=c.split(`
19
- `).filter((h)=>h),P=Math.min(...w.map((h)=>h.length-h.trimStart().length)),S=w.map((h)=>h.slice(P)).map((h)=>" ".repeat(this.indent*2)+h);for(let h of S)this.content.push(h)}compile(){let c=Function,K=this?.args,P=[...(this?.content??[""]).map((S)=>` ${S}`)];return new c(...K,P.join(`
20
- `))}}var uK={major:4,minor:1,patch:9};var Oc=F("$ZodType",(c,K)=>{var w;c??(c={}),c._zod.def=K,c._zod.bag=c._zod.bag||{},c._zod.version=uK;let P=[...c._zod.def.checks??[]];if(c._zod.traits.has("$ZodCheck"))P.unshift(c);for(let S of P)for(let h of S._zod.onattach)h(c);if(P.length===0)(w=c._zod).deferred??(w.deferred=[]),c._zod.deferred?.push(()=>{c._zod.run=c._zod.parse});else{let S=(M,I,G)=>{let D=I2(M),B;for(let L of I){if(L._zod.def.when){if(!L._zod.def.when(M))continue}else if(D)continue;let z=M.issues.length,V=L._zod.check(M);if(V instanceof Promise&&G?.async===!1)throw new nc;if(B||V instanceof Promise)B=(B??Promise.resolve()).then(async()=>{if(await V,M.issues.length===z)return;if(!D)D=I2(M,z)});else{if(M.issues.length===z)continue;if(!D)D=I2(M,z)}}if(B)return B.then(()=>{return M});return M},h=(M,I,G)=>{if(I2(M))return M.aborted=!0,M;let D=S(I,P,G);if(D instanceof Promise){if(G.async===!1)throw new nc;return D.then((B)=>c._zod.parse(B,G))}return c._zod.parse(D,G)};c._zod.run=(M,I)=>{if(I.skipChecks)return c._zod.parse(M,I);if(I.direction==="backward"){let D=c._zod.parse({value:M.value,issues:[]},{...I,skipChecks:!0});if(D instanceof Promise)return D.then((B)=>{return h(B,M,I)});return h(D,M,I)}let G=c._zod.parse(M,I);if(G instanceof Promise){if(I.async===!1)throw new nc;return G.then((D)=>S(D,P,I))}return S(G,P,I)}}c["~standard"]={validate:(S)=>{try{let h=T8(c,S);return h.success?{value:h.data}:{issues:h.error?.issues}}catch(h){return n8(c,S).then((M)=>M.success?{value:M.data}:{issues:M.error?.issues})}},vendor:"zod",version:1}}),H4=F("$ZodString",(c,K)=>{Oc.init(c,K),c._zod.pattern=[...c?._zod.bag?.patterns??[]].pop()??LK(c._zod.bag),c._zod.parse=(w,P)=>{if(K.coerce)try{w.value=String(w.value)}catch(S){}if(typeof w.value==="string")return w;return w.issues.push({expected:"string",code:"invalid_type",input:w.value,inst:c}),w}}),Sc=F("$ZodStringFormat",(c,K)=>{e2.init(c,K),H4.init(c,K)}),nK=F("$ZodGUID",(c,K)=>{K.pattern??(K.pattern=OK),Sc.init(c,K)}),iK=F("$ZodUUID",(c,K)=>{if(K.version){let P={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[K.version];if(P===void 0)throw Error(`Invalid UUID version: "${K.version}"`);K.pattern??(K.pattern=X6(P))}else K.pattern??(K.pattern=X6());Sc.init(c,K)}),tK=F("$ZodEmail",(c,K)=>{K.pattern??(K.pattern=JK),Sc.init(c,K)}),dK=F("$ZodURL",(c,K)=>{Sc.init(c,K),c._zod.check=(w)=>{try{let P=w.value.trim(),S=new URL(P);if(K.hostname){if(K.hostname.lastIndex=0,!K.hostname.test(S.hostname))w.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:zK.source,input:w.value,inst:c,continue:!K.abort})}if(K.protocol){if(K.protocol.lastIndex=0,!K.protocol.test(S.protocol.endsWith(":")?S.protocol.slice(0,-1):S.protocol))w.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:K.protocol.source,input:w.value,inst:c,continue:!K.abort})}if(K.normalize)w.value=S.href;else w.value=P;return}catch(P){w.issues.push({code:"invalid_format",format:"url",input:w.value,inst:c,continue:!K.abort})}}}),sK=F("$ZodEmoji",(c,K)=>{K.pattern??(K.pattern=NK()),Sc.init(c,K)}),aK=F("$ZodNanoID",(c,K)=>{K.pattern??(K.pattern=IK),Sc.init(c,K)}),c5=F("$ZodCUID",(c,K)=>{K.pattern??(K.pattern=PK),Sc.init(c,K)}),K5=F("$ZodCUID2",(c,K)=>{K.pattern??(K.pattern=SK),Sc.init(c,K)}),w5=F("$ZodULID",(c,K)=>{K.pattern??(K.pattern=hK),Sc.init(c,K)}),P5=F("$ZodXID",(c,K)=>{K.pattern??(K.pattern=MK),Sc.init(c,K)}),S5=F("$ZodKSUID",(c,K)=>{K.pattern??(K.pattern=WK),Sc.init(c,K)}),h5=F("$ZodISODateTime",(c,K)=>{K.pattern??(K.pattern=VK(K)),Sc.init(c,K)}),M5=F("$ZodISODate",(c,K)=>{K.pattern??(K.pattern=UK),Sc.init(c,K)}),W5=F("$ZodISOTime",(c,K)=>{K.pattern??(K.pattern=HK(K)),Sc.init(c,K)}),I5=F("$ZodISODuration",(c,K)=>{K.pattern??(K.pattern=bK),Sc.init(c,K)}),b5=F("$ZodIPv4",(c,K)=>{K.pattern??(K.pattern=DK),Sc.init(c,K),c._zod.onattach.push((w)=>{let P=w._zod.bag;P.format="ipv4"})}),O5=F("$ZodIPv6",(c,K)=>{K.pattern??(K.pattern=GK),Sc.init(c,K),c._zod.onattach.push((w)=>{let P=w._zod.bag;P.format="ipv6"}),c._zod.check=(w)=>{try{new URL(`http://[${w.value}]`)}catch{w.issues.push({code:"invalid_format",format:"ipv6",input:w.value,inst:c,continue:!K.abort})}}}),J5=F("$ZodCIDRv4",(c,K)=>{K.pattern??(K.pattern=jK),Sc.init(c,K)}),N5=F("$ZodCIDRv6",(c,K)=>{K.pattern??(K.pattern=XK),Sc.init(c,K),c._zod.check=(w)=>{let P=w.value.split("/");try{if(P.length!==2)throw Error();let[S,h]=P;if(!h)throw Error();let M=Number(h);if(`${M}`!==h)throw Error();if(M<0||M>128)throw Error();new URL(`http://[${S}]`)}catch{w.issues.push({code:"invalid_format",format:"cidrv6",input:w.value,inst:c,continue:!K.abort})}}});function D5(c){if(c==="")return!0;if(c.length%4!==0)return!1;try{return atob(c),!0}catch{return!1}}var G5=F("$ZodBase64",(c,K)=>{K.pattern??(K.pattern=BK),Sc.init(c,K),c._zod.onattach.push((w)=>{w._zod.bag.contentEncoding="base64"}),c._zod.check=(w)=>{if(D5(w.value))return;w.issues.push({code:"invalid_format",format:"base64",input:w.value,inst:c,continue:!K.abort})}});function x1(c){if(!B6.test(c))return!1;let K=c.replace(/[-_]/g,(P)=>P==="-"?"+":"/"),w=K.padEnd(Math.ceil(K.length/4)*4,"=");return D5(w)}var j5=F("$ZodBase64URL",(c,K)=>{K.pattern??(K.pattern=B6),Sc.init(c,K),c._zod.onattach.push((w)=>{w._zod.bag.contentEncoding="base64url"}),c._zod.check=(w)=>{if(x1(w.value))return;w.issues.push({code:"invalid_format",format:"base64url",input:w.value,inst:c,continue:!K.abort})}}),X5=F("$ZodE164",(c,K)=>{K.pattern??(K.pattern=$K),Sc.init(c,K)});function Z1(c,K=null){try{let w=c.split(".");if(w.length!==3)return!1;let[P]=w;if(!P)return!1;let S=JSON.parse(atob(P));if("typ"in S&&S?.typ!=="JWT")return!1;if(!S.alg)return!1;if(K&&(!("alg"in S)||S.alg!==K))return!1;return!0}catch{return!1}}var B5=F("$ZodJWT",(c,K)=>{Sc.init(c,K),c._zod.check=(w)=>{if(Z1(w.value,K.alg))return;w.issues.push({code:"invalid_format",format:"jwt",input:w.value,inst:c,continue:!K.abort})}});var z5=F("$ZodUnknown",(c,K)=>{Oc.init(c,K),c._zod.parse=(w)=>w}),$5=F("$ZodNever",(c,K)=>{Oc.init(c,K),c._zod.parse=(w,P)=>{return w.issues.push({expected:"never",code:"invalid_type",input:w.value,inst:c}),w}});function CK(c,K,w){if(c.issues.length)K.issues.push(...C2(w,c.issues));K.value[w]=c.value}var Q5=F("$ZodArray",(c,K)=>{Oc.init(c,K),c._zod.parse=(w,P)=>{let S=w.value;if(!Array.isArray(S))return w.issues.push({expected:"array",code:"invalid_type",input:S,inst:c}),w;w.value=Array(S.length);let h=[];for(let M=0;M<S.length;M++){let I=S[M],G=K.element._zod.run({value:I,issues:[]},P);if(G instanceof Promise)h.push(G.then((D)=>CK(D,w,M)));else CK(G,w,M)}if(h.length)return Promise.all(h).then(()=>w);return w}});function Y4(c,K,w,P){if(c.issues.length)K.issues.push(...C2(w,c.issues));if(c.value===void 0){if(w in P)K.value[w]=void 0}else K.value[w]=c.value}function U5(c){let K=Object.keys(c.shape);for(let P of K)if(!c.shape?.[P]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${P}": expected a Zod schema`);let w=G6(c.shape);return{...c,keys:K,keySet:new Set(K),numKeys:K.length,optionalKeys:new Set(w)}}function Y5(c,K,w,P,S,h){let M=[],I=S.keySet,G=S.catchall._zod,D=G.def.type;for(let B of Object.keys(K)){if(I.has(B))continue;if(D==="never"){M.push(B);continue}let L=G.run({value:K[B],issues:[]},P);if(L instanceof Promise)c.push(L.then((z)=>Y4(z,w,B,K)));else Y4(L,w,B,K)}if(M.length)w.issues.push({code:"unrecognized_keys",keys:M,input:K,inst:h});if(!c.length)return w;return Promise.all(c).then(()=>{return w})}var A1=F("$ZodObject",(c,K)=>{Oc.init(c,K);let w=o2(()=>U5(K));Kc(c._zod,"propValues",()=>{let M=K.shape,I={};for(let G in M){let D=M[G]._zod;if(D.values){I[G]??(I[G]=new Set);for(let B of D.values)I[G].add(B)}}return I});let P=F2,S=K.catchall,h;c._zod.parse=(M,I)=>{h??(h=w.value);let G=M.value;if(!P(G))return M.issues.push({expected:"object",code:"invalid_type",input:G,inst:c}),M;M.value={};let D=[],B=h.shape;for(let L of h.keys){let V=B[L]._zod.run({value:G[L],issues:[]},I);if(V instanceof Promise)D.push(V.then((b)=>Y4(b,M,L,G)));else Y4(V,M,L,G)}if(!S)return D.length?Promise.all(D).then(()=>M):M;return Y5(D,G,M,I,w.value,c)}}),H5=F("$ZodObjectJIT",(c,K)=>{A1.init(c,K);let w=c._zod.parse,P=o2(()=>U5(K)),S=(z)=>{let V=new z6(["shape","payload","ctx"]),b=P.value,$=(X)=>{let O=j4(X);return`shape[${O}]._zod.run({ value: input[${O}], issues: [] }, ctx)`};V.write("const input = payload.value;");let q=Object.create(null),W=0;for(let X of b.keys)q[X]=`key_${W++}`;V.write("const newResult = {};");for(let X of b.keys){let O=q[X],H=j4(X);V.write(`const ${O} = ${$(X)};`),V.write(`
21
- if (${O}.issues.length) {
22
- payload.issues = payload.issues.concat(${O}.issues.map(iss => ({
15
+ ***************************************************************************** */var w;(function(K){(function(W){var J=typeof globalThis==="object"?globalThis:typeof global==="object"?global:typeof self==="object"?self:typeof this==="object"?this:A(),P=I(K);if(typeof J.Reflect<"u")P=I(J.Reflect,P);if(W(P,J),typeof J.Reflect>"u")J.Reflect=K;function I(M,N){return function(Q,B){if(Object.defineProperty(M,Q,{configurable:!0,writable:!0,value:B}),N)N(Q,B)}}function b(){try{return Function("return this;")()}catch(M){}}function D(){try{return(0,eval)("(function() { return this; })()")}catch(M){}}function A(){return b()||D()}})(function(W,J){var P=Object.prototype.hasOwnProperty,I=typeof Symbol==="function",b=I&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",D=I&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",A=typeof Object.create==="function",M={__proto__:[]}instanceof Array,N=!A&&!M,Q={create:A?function(){return lw(Object.create(null))}:M?function(){return lw({__proto__:null})}:function(){return lw({})},has:N?function(Y,V){return P.call(Y,V)}:function(Y,V){return V in Y},get:N?function(Y,V){return P.call(Y,V)?Y[V]:void 0}:function(Y,V){return Y[V]}},B=Object.getPrototypeOf(Function),L=typeof Map==="function"&&typeof Map.prototype.entries==="function"?Map:_K(),g=typeof Set==="function"&&typeof Set.prototype.entries==="function"?Set:WK(),O=typeof WeakMap==="function"?WeakMap:uK(),v=I?Symbol.for("@reflect-metadata:registry"):void 0,G=nw(),u=tw(G);function o(Y,V,H,C){if(!y(H)){if(!Pw(Y))throw TypeError();if(!Jw(V))throw TypeError();if(!Jw(C)&&!y(C)&&!qw(C))throw TypeError();if(qw(C))C=void 0;return H=i(H),Ww(Y,V,H,C)}else{if(!Pw(Y))throw TypeError();if(!Aw(V))throw TypeError();return T(Y,V)}}W("decorate",o);function z(Y,V){function H(C,_){if(!Jw(C))throw TypeError();if(!y(_)&&!Qw(_))throw TypeError();m(Y,V,C,_)}return H}W("metadata",z);function Z(Y,V,H,C){if(!Jw(H))throw TypeError();if(!y(C))C=i(C);return m(Y,V,H,C)}W("defineMetadata",Z);function x(Y,V,H){if(!Jw(V))throw TypeError();if(!y(H))H=i(H);return ww(Y,V,H)}W("hasMetadata",x);function r(Y,V,H){if(!Jw(V))throw TypeError();if(!y(H))H=i(H);return a(Y,V,H)}W("hasOwnMetadata",r);function E(Y,V,H){if(!Jw(V))throw TypeError();if(!y(H))H=i(H);return d(Y,V,H)}W("getMetadata",E);function X(Y,V,H){if(!Jw(V))throw TypeError();if(!y(H))H=i(H);return Kw(Y,V,H)}W("getOwnMetadata",X);function U(Y,V){if(!Jw(Y))throw TypeError();if(!y(V))V=i(V);return l(Y,V)}W("getMetadataKeys",U);function q(Y,V){if(!Jw(Y))throw TypeError();if(!y(V))V=i(V);return Vw(Y,V)}W("getOwnMetadataKeys",q);function c(Y,V,H){if(!Jw(V))throw TypeError();if(!y(H))H=i(H);if(!Jw(V))throw TypeError();if(!y(H))H=i(H);var C=b2(V,H,!1);if(y(C))return!1;return C.OrdinaryDeleteMetadata(Y,V,H)}W("deleteMetadata",c);function T(Y,V){for(var H=Y.length-1;H>=0;--H){var C=Y[H],_=C(V);if(!y(_)&&!qw(_)){if(!Aw(_))throw TypeError();V=_}}return V}function Ww(Y,V,H,C){for(var _=Y.length-1;_>=0;--_){var Dw=Y[_],$=Dw(V,H,C);if(!y($)&&!qw($)){if(!Jw($))throw TypeError();C=$}}return C}function ww(Y,V,H){var C=a(Y,V,H);if(C)return!0;var _=Hw(V);if(!qw(_))return ww(Y,_,H);return!1}function a(Y,V,H){var C=b2(V,H,!1);if(y(C))return!1;return xw(C.OrdinaryHasOwnMetadata(Y,V,H))}function d(Y,V,H){var C=a(Y,V,H);if(C)return Kw(Y,V,H);var _=Hw(V);if(!qw(_))return d(Y,_,H);return}function Kw(Y,V,H){var C=b2(V,H,!1);if(y(C))return;return C.OrdinaryGetOwnMetadata(Y,V,H)}function m(Y,V,H,C){var _=b2(H,C,!0);_.OrdinaryDefineOwnMetadata(Y,V,H,C)}function l(Y,V){var H=Vw(Y,V),C=Hw(Y);if(C===null)return H;var _=l(C,V);if(_.length<=0)return H;if(H.length<=0)return _;var Dw=new g,$=[];for(var S=0,F=H;S<F.length;S++){var j=F[S],k=Dw.has(j);if(!k)Dw.add(j),$.push(j)}for(var R=0,f=_;R<f.length;R++){var j=f[R],k=Dw.has(j);if(!k)Dw.add(j),$.push(j)}return $}function Vw(Y,V){var H=b2(Y,V,!1);if(!H)return[];return H.OrdinaryOwnMetadataKeys(Y,V)}function kw(Y){if(Y===null)return 1;switch(typeof Y){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return Y===null?1:6;default:return 6}}function y(Y){return Y===void 0}function qw(Y){return Y===null}function _w(Y){return typeof Y==="symbol"}function Jw(Y){return typeof Y==="object"?Y!==null:typeof Y==="function"}function ow(Y,V){switch(kw(Y)){case 0:return Y;case 1:return Y;case 2:return Y;case 3:return Y;case 4:return Y;case 5:return Y}var H=V===3?"string":V===5?"number":"default",C=Ow(Y,b);if(C!==void 0){var _=C.call(Y,H);if(Jw(_))throw TypeError();return _}return zw(Y,H==="default"?"number":H)}function zw(Y,V){if(V==="string"){var H=Y.toString;if(n(H)){var C=H.call(Y);if(!Jw(C))return C}var _=Y.valueOf;if(n(_)){var C=_.call(Y);if(!Jw(C))return C}}else{var _=Y.valueOf;if(n(_)){var C=_.call(Y);if(!Jw(C))return C}var Dw=Y.toString;if(n(Dw)){var C=Dw.call(Y);if(!Jw(C))return C}}throw TypeError()}function xw(Y){return!!Y}function uw(Y){return""+Y}function i(Y){var V=ow(Y,3);if(_w(V))return V;return uw(V)}function Pw(Y){return Array.isArray?Array.isArray(Y):Y instanceof Object?Y instanceof Array:Object.prototype.toString.call(Y)==="[object Array]"}function n(Y){return typeof Y==="function"}function Aw(Y){return typeof Y==="function"}function Qw(Y){switch(kw(Y)){case 3:return!0;case 4:return!0;default:return!1}}function Lw(Y,V){return Y===V||Y!==Y&&V!==V}function Ow(Y,V){var H=Y[V];if(H===void 0||H===null)return;if(!n(H))throw TypeError();return H}function Tw(Y){var V=Ow(Y,D);if(!n(V))throw TypeError();var H=V.call(Y);if(!Jw(H))throw TypeError();return H}function Ew(Y){return Y.value}function Uw(Y){var V=Y.next();return V.done?!1:V}function yw(Y){var V=Y.return;if(V)V.call(Y)}function Hw(Y){var V=Object.getPrototypeOf(Y);if(typeof Y!=="function"||Y===B)return V;if(V!==B)return V;var H=Y.prototype,C=H&&Object.getPrototypeOf(H);if(C==null||C===Object.prototype)return V;var _=C.constructor;if(typeof _!=="function")return V;if(_===Y)return V;return _}function dw(){var Y;if(!y(v)&&typeof J.Reflect<"u"&&!(v in J.Reflect)&&typeof J.Reflect.defineMetadata==="function")Y=rK(J.Reflect);var V,H,C,_=new O,Dw={registerProvider:$,getProvider:F,setProvider:k};return Dw;function $(R){if(!Object.isExtensible(Dw))throw Error("Cannot add provider to a frozen registry.");switch(!0){case Y===R:break;case y(V):V=R;break;case V===R:break;case y(H):H=R;break;case H===R:break;default:if(C===void 0)C=new g;C.add(R);break}}function S(R,f){if(!y(V)){if(V.isProviderFor(R,f))return V;if(!y(H)){if(H.isProviderFor(R,f))return V;if(!y(C)){var s=Tw(C);while(!0){var t=Uw(s);if(!t)return;var Bw=Ew(t);if(Bw.isProviderFor(R,f))return yw(s),Bw}}}}if(!y(Y)&&Y.isProviderFor(R,f))return Y;return}function F(R,f){var s=_.get(R),t;if(!y(s))t=s.get(f);if(!y(t))return t;if(t=S(R,f),!y(t)){if(y(s))s=new L,_.set(R,s);s.set(f,t)}return t}function j(R){if(y(R))throw TypeError();return V===R||H===R||!y(C)&&C.has(R)}function k(R,f,s){if(!j(s))throw Error("Metadata provider not registered.");var t=F(R,f);if(t!==s){if(!y(t))return!1;var Bw=_.get(R);if(y(Bw))Bw=new L,_.set(R,Bw);Bw.set(f,s)}return!0}}function nw(){var Y;if(!y(v)&&Jw(J.Reflect)&&Object.isExtensible(J.Reflect))Y=J.Reflect[v];if(y(Y))Y=dw();if(!y(v)&&Jw(J.Reflect)&&Object.isExtensible(J.Reflect))Object.defineProperty(J.Reflect,v,{enumerable:!1,configurable:!1,writable:!1,value:Y});return Y}function tw(Y){var V=new O,H={isProviderFor:function(j,k){var R=V.get(j);if(y(R))return!1;return R.has(k)},OrdinaryDefineOwnMetadata:$,OrdinaryHasOwnMetadata:_,OrdinaryGetOwnMetadata:Dw,OrdinaryOwnMetadataKeys:S,OrdinaryDeleteMetadata:F};return G.registerProvider(H),H;function C(j,k,R){var f=V.get(j),s=!1;if(y(f)){if(!R)return;f=new L,V.set(j,f),s=!0}var t=f.get(k);if(y(t)){if(!R)return;if(t=new L,f.set(k,t),!Y.setProvider(j,k,H)){if(f.delete(k),s)V.delete(j);throw Error("Wrong provider for target.")}}return t}function _(j,k,R){var f=C(k,R,!1);if(y(f))return!1;return xw(f.has(j))}function Dw(j,k,R){var f=C(k,R,!1);if(y(f))return;return f.get(j)}function $(j,k,R,f){var s=C(R,f,!0);s.set(j,k)}function S(j,k){var R=[],f=C(j,k,!1);if(y(f))return R;var s=f.keys(),t=Tw(s),Bw=0;while(!0){var Y2=Uw(t);if(!Y2)return R.length=Bw,R;var aw=Ew(Y2);try{R[Bw]=aw}catch(vw){try{yw(t)}finally{throw vw}}Bw++}}function F(j,k,R){var f=C(k,R,!1);if(y(f))return!1;if(!f.delete(j))return!1;if(f.size===0){var s=V.get(k);if(!y(s)){if(s.delete(R),s.size===0)V.delete(s)}}return!0}}function rK(Y){var{defineMetadata:V,hasOwnMetadata:H,getOwnMetadata:C,getOwnMetadataKeys:_,deleteMetadata:Dw}=Y,$=new O,S={isProviderFor:function(F,j){var k=$.get(F);if(!y(k)&&k.has(j))return!0;if(_(F,j).length){if(y(k))k=new g,$.set(F,k);return k.add(j),!0}return!1},OrdinaryDefineOwnMetadata:V,OrdinaryHasOwnMetadata:H,OrdinaryGetOwnMetadata:C,OrdinaryOwnMetadataKeys:_,OrdinaryDeleteMetadata:Dw};return S}function b2(Y,V,H){var C=G.getProvider(Y,V);if(!y(C))return C;if(H){if(G.setProvider(Y,V,u))return u;throw Error("Illegal state.")}return}function _K(){var Y={},V=[],H=function(){function S(F,j,k){this._index=0,this._keys=F,this._values=j,this._selector=k}return S.prototype["@@iterator"]=function(){return this},S.prototype[D]=function(){return this},S.prototype.next=function(){var F=this._index;if(F>=0&&F<this._keys.length){var j=this._selector(this._keys[F],this._values[F]);if(F+1>=this._keys.length)this._index=-1,this._keys=V,this._values=V;else this._index++;return{value:j,done:!1}}return{value:void 0,done:!0}},S.prototype.throw=function(F){if(this._index>=0)this._index=-1,this._keys=V,this._values=V;throw F},S.prototype.return=function(F){if(this._index>=0)this._index=-1,this._keys=V,this._values=V;return{value:F,done:!0}},S}(),C=function(){function S(){this._keys=[],this._values=[],this._cacheKey=Y,this._cacheIndex=-2}return Object.defineProperty(S.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),S.prototype.has=function(F){return this._find(F,!1)>=0},S.prototype.get=function(F){var j=this._find(F,!1);return j>=0?this._values[j]:void 0},S.prototype.set=function(F,j){var k=this._find(F,!0);return this._values[k]=j,this},S.prototype.delete=function(F){var j=this._find(F,!1);if(j>=0){var k=this._keys.length;for(var R=j+1;R<k;R++)this._keys[R-1]=this._keys[R],this._values[R-1]=this._values[R];if(this._keys.length--,this._values.length--,Lw(F,this._cacheKey))this._cacheKey=Y,this._cacheIndex=-2;return!0}return!1},S.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=Y,this._cacheIndex=-2},S.prototype.keys=function(){return new H(this._keys,this._values,_)},S.prototype.values=function(){return new H(this._keys,this._values,Dw)},S.prototype.entries=function(){return new H(this._keys,this._values,$)},S.prototype["@@iterator"]=function(){return this.entries()},S.prototype[D]=function(){return this.entries()},S.prototype._find=function(F,j){if(!Lw(this._cacheKey,F)){this._cacheIndex=-1;for(var k=0;k<this._keys.length;k++)if(Lw(this._keys[k],F)){this._cacheIndex=k;break}}if(this._cacheIndex<0&&j)this._cacheIndex=this._keys.length,this._keys.push(F),this._values.push(void 0);return this._cacheIndex},S}();return C;function _(S,F){return S}function Dw(S,F){return F}function $(S,F){return[S,F]}}function WK(){var Y=function(){function V(){this._map=new L}return Object.defineProperty(V.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),V.prototype.has=function(H){return this._map.has(H)},V.prototype.add=function(H){return this._map.set(H,H),this},V.prototype.delete=function(H){return this._map.delete(H)},V.prototype.clear=function(){this._map.clear()},V.prototype.keys=function(){return this._map.keys()},V.prototype.values=function(){return this._map.keys()},V.prototype.entries=function(){return this._map.entries()},V.prototype["@@iterator"]=function(){return this.keys()},V.prototype[D]=function(){return this.keys()},V}();return Y}function uK(){var Y=16,V=Q.create(),H=C();return function(){function F(){this._key=C()}return F.prototype.has=function(j){var k=_(j,!1);return k!==void 0?Q.has(k,this._key):!1},F.prototype.get=function(j){var k=_(j,!1);return k!==void 0?Q.get(k,this._key):void 0},F.prototype.set=function(j,k){var R=_(j,!0);return R[this._key]=k,this},F.prototype.delete=function(j){var k=_(j,!1);return k!==void 0?delete k[this._key]:!1},F.prototype.clear=function(){this._key=C()},F}();function C(){var F;do F="@@WeakMap@@"+S();while(Q.has(V,F));return V[F]=!0,F}function _(F,j){if(!P.call(F,H)){if(!j)return;Object.defineProperty(F,H,{value:Q.create()})}return F[H]}function Dw(F,j){for(var k=0;k<j;++k)F[k]=Math.random()*255|0;return F}function $(F){if(typeof Uint8Array==="function"){var j=new Uint8Array(F);if(typeof crypto<"u")crypto.getRandomValues(j);else if(typeof msCrypto<"u")msCrypto.getRandomValues(j);else Dw(j,F);return j}return Dw(Array(F),F)}function S(){var F=$(Y);F[6]=F[6]&79|64,F[8]=F[8]&191|128;var j="";for(var k=0;k<Y;++k){var R=F[k];if(k===4||k===6||k===8)j+="-";if(R<16)j+="0";j+=R.toString(16).toLowerCase()}return j}}function lw(Y){return Y.__=void 0,delete Y.__,Y}})})(w||(w={}))}),H2=p((w,K)=>{K.exports=TypeError}),w0=p((w,K)=>{K.exports=s5("util").inspect}),NK=p((w,K)=>{var W=typeof Map==="function"&&Map.prototype,J=Object.getOwnPropertyDescriptor&&W?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,P=W&&J&&typeof J.get==="function"?J.get:null,I=W&&Map.prototype.forEach,b=typeof Set==="function"&&Set.prototype,D=Object.getOwnPropertyDescriptor&&b?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,A=b&&D&&typeof D.get==="function"?D.get:null,M=b&&Set.prototype.forEach,N=typeof WeakMap==="function"&&WeakMap.prototype,Q=N?WeakMap.prototype.has:null,B=typeof WeakSet==="function"&&WeakSet.prototype,L=B?WeakSet.prototype.has:null,g=typeof WeakRef==="function"&&WeakRef.prototype,O=g?WeakRef.prototype.deref:null,v=Boolean.prototype.valueOf,G=Object.prototype.toString,u=Function.prototype.toString,o=String.prototype.match,z=String.prototype.slice,Z=String.prototype.replace,x=String.prototype.toUpperCase,r=String.prototype.toLowerCase,E=RegExp.prototype.test,X=Array.prototype.concat,U=Array.prototype.join,q=Array.prototype.slice,c=Math.floor,T=typeof BigInt==="function"?BigInt.prototype.valueOf:null,Ww=Object.getOwnPropertySymbols,ww=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?Symbol.prototype.toString:null,a=typeof Symbol==="function"&&typeof Symbol.iterator==="object",d=typeof Symbol==="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===a?"object":"symbol")?Symbol.toStringTag:null,Kw=Object.prototype.propertyIsEnumerable,m=(typeof Reflect==="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function($){return $.__proto__}:null);function l($,S){if($===1/0||$===-1/0||$!==$||$&&$>-1000&&$<1000||E.call(/e/,S))return S;var F=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof $==="number"){var j=$<0?-c(-$):c($);if(j!==$){var k=String(j),R=z.call(S,k.length+1);return Z.call(k,F,"$&_")+"."+Z.call(Z.call(R,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Z.call(S,F,"$&_")}var Vw=w0(),kw=Vw.custom,y=Lw(kw)?kw:null,qw={__proto__:null,double:'"',single:"'"},_w={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};K.exports=function $(S,F,j,k){var R=F||{};if(Ew(R,"quoteStyle")&&!Ew(qw,R.quoteStyle))throw TypeError('option "quoteStyle" must be "single" or "double"');if(Ew(R,"maxStringLength")&&(typeof R.maxStringLength==="number"?R.maxStringLength<0&&R.maxStringLength!==1/0:R.maxStringLength!==null))throw TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var f=Ew(R,"customInspect")?R.customInspect:!0;if(typeof f!=="boolean"&&f!=="symbol")throw TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Ew(R,"indent")&&R.indent!==null&&R.indent!=="\t"&&!(parseInt(R.indent,10)===R.indent&&R.indent>0))throw TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Ew(R,"numericSeparator")&&typeof R.numericSeparator!=="boolean")throw TypeError('option "numericSeparator", if provided, must be `true` or `false`');var s=R.numericSeparator;if(typeof S>"u")return"undefined";if(S===null)return"null";if(typeof S==="boolean")return S?"true":"false";if(typeof S==="string")return WK(S,R);if(typeof S==="number"){if(S===0)return 1/0/S>0?"0":"-0";var t=String(S);return s?l(S,t):t}if(typeof S==="bigint"){var Bw=String(S)+"n";return s?l(S,Bw):Bw}var Y2=typeof R.depth>"u"?5:R.depth;if(typeof j>"u")j=0;if(j>=Y2&&Y2>0&&typeof S==="object")return xw(S)?"[Array]":"[Object]";var aw=C(R,j);if(typeof k>"u")k=[];else if(Hw(k,S)>=0)return"[Circular]";function vw(X2,PK,u5){if(PK)k=q.call(k),k.push(PK);if(u5){var M4={depth:R.depth};if(Ew(R,"quoteStyle"))M4.quoteStyle=R.quoteStyle;return $(X2,M4,j+1,k)}return $(X2,R,j+1,k)}if(typeof S==="function"&&!i(S)){var J4=yw(S),P4=Dw(S,vw);return"[Function"+(J4?": "+J4:" (anonymous)")+"]"+(P4.length>0?" { "+U.call(P4,", ")+" }":"")}if(Lw(S)){var I4=a?Z.call(String(S),/^(Symbol\(.*\))_[^)]*$/,"$1"):ww.call(S);return typeof S==="object"&&!a?lw(I4):I4}if(_K(S)){var k2="<"+r.call(String(S.nodeName)),yK=S.attributes||[];for(var JK=0;JK<yK.length;JK++)k2+=" "+yK[JK].name+"="+Jw(ow(yK[JK].value),"double",R);if(k2+=">",S.childNodes&&S.childNodes.length)k2+="...";return k2+="</"+r.call(String(S.nodeName))+">",k2}if(xw(S)){if(S.length===0)return"[]";var mK=Dw(S,vw);if(aw&&!H(mK))return"["+_(mK,aw)+"]";return"[ "+U.call(mK,", ")+" ]"}if(Pw(S)){var TK=Dw(S,vw);if(!("cause"in Error.prototype)&&"cause"in S&&!Kw.call(S,"cause"))return"{ ["+String(S)+"] "+U.call(X.call("[cause]: "+vw(S.cause),TK),", ")+" }";if(TK.length===0)return"["+String(S)+"]";return"{ ["+String(S)+"] "+U.call(TK,", ")+" }"}if(typeof S==="object"&&f){if(y&&typeof S[y]==="function"&&Vw)return Vw(S,{depth:Y2-j});else if(f!=="symbol"&&typeof S.inspect==="function")return S.inspect()}if(dw(S)){var b4=[];if(I)I.call(S,function(X2,PK){b4.push(vw(PK,S,!0)+" => "+vw(X2,S))});return V("Map",P.call(S),b4,aw)}if(rK(S)){var D4=[];if(M)M.call(S,function(X2){D4.push(vw(X2,S))});return V("Set",A.call(S),D4,aw)}if(nw(S))return Y("WeakMap");if(b2(S))return Y("WeakSet");if(tw(S))return Y("WeakRef");if(Aw(S))return lw(vw(Number(S)));if(Ow(S))return lw(vw(T.call(S)));if(Qw(S))return lw(v.call(S));if(n(S))return lw(vw(String(S)));if(typeof window<"u"&&S===window)return"{ [object Window] }";if(typeof globalThis<"u"&&S===globalThis||typeof global<"u"&&S===global)return"{ [object globalThis] }";if(!uw(S)&&!i(S)){var lK=Dw(S,vw),G4=m?m(S)===Object.prototype:S instanceof Object||S.constructor===Object,pK=S instanceof Object?"":"null prototype",A4=!G4&&d&&Object(S)===S&&d in S?z.call(Uw(S),8,-1):pK?"Object":"",_5=G4||typeof S.constructor!=="function"?"":S.constructor.name?S.constructor.name+" ":"",fK=_5+(A4||pK?"["+U.call(X.call([],A4||[],pK||[]),": ")+"] ":"");if(lK.length===0)return fK+"{}";if(aw)return fK+"{"+_(lK,aw)+"}";return fK+"{ "+U.call(lK,", ")+" }"}return String(S)};function Jw($,S,F){var j=F.quoteStyle||S,k=qw[j];return k+$+k}function ow($){return Z.call(String($),/"/g,"&quot;")}function zw($){return!d||!(typeof $==="object"&&((d in $)||typeof $[d]<"u"))}function xw($){return Uw($)==="[object Array]"&&zw($)}function uw($){return Uw($)==="[object Date]"&&zw($)}function i($){return Uw($)==="[object RegExp]"&&zw($)}function Pw($){return Uw($)==="[object Error]"&&zw($)}function n($){return Uw($)==="[object String]"&&zw($)}function Aw($){return Uw($)==="[object Number]"&&zw($)}function Qw($){return Uw($)==="[object Boolean]"&&zw($)}function Lw($){if(a)return $&&typeof $==="object"&&$ instanceof Symbol;if(typeof $==="symbol")return!0;if(!$||typeof $!=="object"||!ww)return!1;try{return ww.call($),!0}catch(S){}return!1}function Ow($){if(!$||typeof $!=="object"||!T)return!1;try{return T.call($),!0}catch(S){}return!1}var Tw=Object.prototype.hasOwnProperty||function($){return $ in this};function Ew($,S){return Tw.call($,S)}function Uw($){return G.call($)}function yw($){if($.name)return $.name;var S=o.call(u.call($),/^function\s*([\w$]+)/);if(S)return S[1];return null}function Hw($,S){if($.indexOf)return $.indexOf(S);for(var F=0,j=$.length;F<j;F++)if($[F]===S)return F;return-1}function dw($){if(!P||!$||typeof $!=="object")return!1;try{P.call($);try{A.call($)}catch(S){return!0}return $ instanceof Map}catch(S){}return!1}function nw($){if(!Q||!$||typeof $!=="object")return!1;try{Q.call($,Q);try{L.call($,L)}catch(S){return!0}return $ instanceof WeakMap}catch(S){}return!1}function tw($){if(!O||!$||typeof $!=="object")return!1;try{return O.call($),!0}catch(S){}return!1}function rK($){if(!A||!$||typeof $!=="object")return!1;try{A.call($);try{P.call($)}catch(S){return!0}return $ instanceof Set}catch(S){}return!1}function b2($){if(!L||!$||typeof $!=="object")return!1;try{L.call($,L);try{Q.call($,Q)}catch(S){return!0}return $ instanceof WeakSet}catch(S){}return!1}function _K($){if(!$||typeof $!=="object")return!1;if(typeof HTMLElement<"u"&&$ instanceof HTMLElement)return!0;return typeof $.nodeName==="string"&&typeof $.getAttribute==="function"}function WK($,S){if($.length>S.maxStringLength){var F=$.length-S.maxStringLength,j="... "+F+" more character"+(F>1?"s":"");return WK(z.call($,0,S.maxStringLength),S)+j}var k=_w[S.quoteStyle||"single"];k.lastIndex=0;var R=Z.call(Z.call($,k,"\\$1"),/[\x00-\x1f]/g,uK);return Jw(R,"single",S)}function uK($){var S=$.charCodeAt(0),F={8:"b",9:"t",10:"n",12:"f",13:"r"}[S];if(F)return"\\"+F;return"\\x"+(S<16?"0":"")+x.call(S.toString(16))}function lw($){return"Object("+$+")"}function Y($){return $+" { ? }"}function V($,S,F,j){var k=j?_(F,j):U.call(F,", ");return $+" ("+S+") {"+k+"}"}function H($){for(var S=0;S<$.length;S++)if(Hw($[S],`
16
+ `)>=0)return!1;return!0}function C($,S){var F;if($.indent==="\t")F="\t";else if(typeof $.indent==="number"&&$.indent>0)F=U.call(Array($.indent+1)," ");else return null;return{base:F,prev:U.call(Array(S+1),F)}}function _($,S){if($.length===0)return"";var F=`
17
+ `+S.prev+S.base;return F+U.call($,","+F)+`
18
+ `+S.prev}function Dw($,S){var F=xw($),j=[];if(F){j.length=$.length;for(var k=0;k<$.length;k++)j[k]=Ew($,k)?S($[k],$):""}var R=typeof Ww==="function"?Ww($):[],f;if(a){f={};for(var s=0;s<R.length;s++)f["$"+R[s]]=R[s]}for(var t in $){if(!Ew($,t))continue;if(F&&String(Number(t))===t&&t<$.length)continue;if(a&&f["$"+t]instanceof Symbol)continue;else if(E.call(/[^\w$]/,t))j.push(S(t,$)+": "+S($[t],$));else j.push(t+": "+S($[t],$))}if(typeof Ww==="function"){for(var Bw=0;Bw<R.length;Bw++)if(Kw.call($,R[Bw]))j.push("["+S(R[Bw])+"]: "+S($[R[Bw]],$))}return j}}),K0=p((w,K)=>{var W=NK(),J=H2(),P=function(M,N,Q){var B=M,L;for(;(L=B.next)!=null;B=L)if(L.key===N){if(B.next=L.next,!Q)L.next=M.next,M.next=L;return L}},I=function(M,N){if(!M)return;var Q=P(M,N);return Q&&Q.value},b=function(M,N,Q){var B=P(M,N);if(B)B.value=Q;else M.next={key:N,next:M.next,value:Q}},D=function(M,N){if(!M)return!1;return!!P(M,N)},A=function(M,N){if(M)return P(M,N,!0)};K.exports=function(){var M,N={assert:function(Q){if(!N.has(Q))throw new J("Side channel does not contain "+W(Q))},delete:function(Q){var B=M&&M.next,L=A(M,Q);if(L&&B&&B===L)M=void 0;return!!L},get:function(Q){return I(M,Q)},has:function(Q){return D(M,Q)},set:function(Q,B){if(!M)M={next:void 0};b(M,Q,B)}};return N}}),S4=p((w,K)=>{K.exports=Object}),W0=p((w,K)=>{K.exports=Error}),J0=p((w,K)=>{K.exports=EvalError}),P0=p((w,K)=>{K.exports=RangeError}),I0=p((w,K)=>{K.exports=ReferenceError}),b0=p((w,K)=>{K.exports=SyntaxError}),D0=p((w,K)=>{K.exports=URIError}),G0=p((w,K)=>{K.exports=Math.abs}),A0=p((w,K)=>{K.exports=Math.floor}),M0=p((w,K)=>{K.exports=Math.max}),O0=p((w,K)=>{K.exports=Math.min}),B0=p((w,K)=>{K.exports=Math.pow}),N0=p((w,K)=>{K.exports=Math.round}),Q0=p((w,K)=>{K.exports=Number.isNaN||function(W){return W!==W}}),S0=p((w,K)=>{var W=Q0();K.exports=function(J){if(W(J)||J===0)return J;return J<0?-1:1}}),$0=p((w,K)=>{K.exports=Object.getOwnPropertyDescriptor}),$4=p((w,K)=>{var W=$0();if(W)try{W([],"length")}catch(J){W=null}K.exports=W}),Y0=p((w,K)=>{var W=Object.defineProperty||!1;if(W)try{W({},"a",{value:1})}catch(J){W=!1}K.exports=W}),X0=p((w,K)=>{K.exports=function(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var W={},J=Symbol("test"),P=Object(J);if(typeof J==="string")return!1;if(Object.prototype.toString.call(J)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(P)!=="[object Symbol]")return!1;var I=42;W[J]=I;for(var b in W)return!1;if(typeof Object.keys==="function"&&Object.keys(W).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(W).length!==0)return!1;var D=Object.getOwnPropertySymbols(W);if(D.length!==1||D[0]!==J)return!1;if(!Object.prototype.propertyIsEnumerable.call(W,J))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var A=Object.getOwnPropertyDescriptor(W,J);if(A.value!==I||A.enumerable!==!0)return!1}return!0}}),V0=p((w,K)=>{var W=typeof Symbol<"u"&&Symbol,J=X0();K.exports=function(){if(typeof W!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof W("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return J()}}),Y4=p((w,K)=>{K.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null}),X4=p((w,K)=>{var W=S4();K.exports=W.getPrototypeOf||null}),L0=p((w,K)=>{var W="Function.prototype.bind called on incompatible ",J=Object.prototype.toString,P=Math.max,I="[object Function]",b=function(M,N){var Q=[];for(var B=0;B<M.length;B+=1)Q[B]=M[B];for(var L=0;L<N.length;L+=1)Q[L+M.length]=N[L];return Q},D=function(M,N){var Q=[];for(var B=N||0,L=0;B<M.length;B+=1,L+=1)Q[L]=M[B];return Q},A=function(M,N){var Q="";for(var B=0;B<M.length;B+=1)if(Q+=M[B],B+1<M.length)Q+=N;return Q};K.exports=function(M){var N=this;if(typeof N!=="function"||J.apply(N)!==I)throw TypeError(W+N);var Q=D(arguments,1),B,L=function(){if(this instanceof B){var u=N.apply(this,b(Q,arguments));if(Object(u)===u)return u;return this}return N.apply(M,b(Q,arguments))},g=P(0,N.length-Q.length),O=[];for(var v=0;v<g;v++)O[v]="$"+v;if(B=Function("binder","return function ("+A(O,",")+"){ return binder.apply(this,arguments); }")(L),N.prototype){var G=function(){};G.prototype=N.prototype,B.prototype=new G,G.prototype=null}return B}}),QK=p((w,K)=>{var W=L0();K.exports=Function.prototype.bind||W}),K1=p((w,K)=>{K.exports=Function.prototype.call}),V4=p((w,K)=>{K.exports=Function.prototype.apply}),E0=p((w,K)=>{K.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply}),U0=p((w,K)=>{var W=QK(),J=V4(),P=K1(),I=E0();K.exports=I||W.call(P,J)}),L4=p((w,K)=>{var W=QK(),J=H2(),P=K1(),I=U0();K.exports=function(b){if(b.length<1||typeof b[0]!=="function")throw new J("a function is required");return I(W,P,b)}}),H0=p((w,K)=>{var W=L4(),J=$4(),P;try{P=[].__proto__===Array.prototype}catch(A){if(!A||typeof A!=="object"||!("code"in A)||A.code!=="ERR_PROTO_ACCESS")throw A}var I=!!P&&J&&J(Object.prototype,"__proto__"),b=Object,D=b.getPrototypeOf;K.exports=I&&typeof I.get==="function"?W([I.get]):typeof D==="function"?function(A){return D(A==null?A:b(A))}:!1}),q0=p((w,K)=>{var W=Y4(),J=X4(),P=H0();K.exports=W?function(I){return W(I)}:J?function(I){if(!I||typeof I!=="object"&&typeof I!=="function")throw TypeError("getProto: not an object");return J(I)}:P?function(I){return P(I)}:null}),h0=p((w,K)=>{var W=Function.prototype.call,J=Object.prototype.hasOwnProperty,P=QK();K.exports=P.call(W,J)}),W1=p((w,K)=>{var W,J=S4(),P=W0(),I=J0(),b=P0(),D=I0(),A=b0(),M=H2(),N=D0(),Q=G0(),B=A0(),L=M0(),g=O0(),O=B0(),v=N0(),G=S0(),u=Function,o=function(i){try{return u('"use strict"; return ('+i+").constructor;")()}catch(Pw){}},z=$4(),Z=Y0(),x=function(){throw new M},r=z?function(){try{return arguments.callee,x}catch(i){try{return z(arguments,"callee").get}catch(Pw){return x}}}():x,E=V0()(),X=q0(),U=X4(),q=Y4(),c=V4(),T=K1(),Ww={},ww=typeof Uint8Array>"u"||!X?W:X(Uint8Array),a={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?W:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?W:ArrayBuffer,"%ArrayIteratorPrototype%":E&&X?X([][Symbol.iterator]()):W,"%AsyncFromSyncIteratorPrototype%":W,"%AsyncFunction%":Ww,"%AsyncGenerator%":Ww,"%AsyncGeneratorFunction%":Ww,"%AsyncIteratorPrototype%":Ww,"%Atomics%":typeof Atomics>"u"?W:Atomics,"%BigInt%":typeof BigInt>"u"?W:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?W:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?W:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?W:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":P,"%eval%":eval,"%EvalError%":I,"%Float16Array%":typeof Float16Array>"u"?W:Float16Array,"%Float32Array%":typeof Float32Array>"u"?W:Float32Array,"%Float64Array%":typeof Float64Array>"u"?W:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?W:FinalizationRegistry,"%Function%":u,"%GeneratorFunction%":Ww,"%Int8Array%":typeof Int8Array>"u"?W:Int8Array,"%Int16Array%":typeof Int16Array>"u"?W:Int16Array,"%Int32Array%":typeof Int32Array>"u"?W:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":E&&X?X(X([][Symbol.iterator]())):W,"%JSON%":typeof JSON==="object"?JSON:W,"%Map%":typeof Map>"u"?W:Map,"%MapIteratorPrototype%":typeof Map>"u"||!E||!X?W:X(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":J,"%Object.getOwnPropertyDescriptor%":z,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?W:Promise,"%Proxy%":typeof Proxy>"u"?W:Proxy,"%RangeError%":b,"%ReferenceError%":D,"%Reflect%":typeof Reflect>"u"?W:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?W:Set,"%SetIteratorPrototype%":typeof Set>"u"||!E||!X?W:X(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?W:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":E&&X?X(""[Symbol.iterator]()):W,"%Symbol%":E?Symbol:W,"%SyntaxError%":A,"%ThrowTypeError%":r,"%TypedArray%":ww,"%TypeError%":M,"%Uint8Array%":typeof Uint8Array>"u"?W:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?W:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?W:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?W:Uint32Array,"%URIError%":N,"%WeakMap%":typeof WeakMap>"u"?W:WeakMap,"%WeakRef%":typeof WeakRef>"u"?W:WeakRef,"%WeakSet%":typeof WeakSet>"u"?W:WeakSet,"%Function.prototype.call%":T,"%Function.prototype.apply%":c,"%Object.defineProperty%":Z,"%Object.getPrototypeOf%":U,"%Math.abs%":Q,"%Math.floor%":B,"%Math.max%":L,"%Math.min%":g,"%Math.pow%":O,"%Math.round%":v,"%Math.sign%":G,"%Reflect.getPrototypeOf%":q};if(X)try{null.error}catch(i){d=X(X(i)),a["%Error.prototype%"]=d}var d,Kw=function i(Pw){var n;if(Pw==="%AsyncFunction%")n=o("async function () {}");else if(Pw==="%GeneratorFunction%")n=o("function* () {}");else if(Pw==="%AsyncGeneratorFunction%")n=o("async function* () {}");else if(Pw==="%AsyncGenerator%"){var Aw=i("%AsyncGeneratorFunction%");if(Aw)n=Aw.prototype}else if(Pw==="%AsyncIteratorPrototype%"){var Qw=i("%AsyncGenerator%");if(Qw&&X)n=X(Qw.prototype)}return a[Pw]=n,n},m={__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"]},l=QK(),Vw=h0(),kw=l.call(T,Array.prototype.concat),y=l.call(c,Array.prototype.splice),qw=l.call(T,String.prototype.replace),_w=l.call(T,String.prototype.slice),Jw=l.call(T,RegExp.prototype.exec),ow=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,zw=/\\(\\)?/g,xw=function(i){var Pw=_w(i,0,1),n=_w(i,-1);if(Pw==="%"&&n!=="%")throw new A("invalid intrinsic syntax, expected closing `%`");else if(n==="%"&&Pw!=="%")throw new A("invalid intrinsic syntax, expected opening `%`");var Aw=[];return qw(i,ow,function(Qw,Lw,Ow,Tw){Aw[Aw.length]=Ow?qw(Tw,zw,"$1"):Lw||Qw}),Aw},uw=function(i,Pw){var n=i,Aw;if(Vw(m,n))Aw=m[n],n="%"+Aw[0]+"%";if(Vw(a,n)){var Qw=a[n];if(Qw===Ww)Qw=Kw(n);if(typeof Qw>"u"&&!Pw)throw new M("intrinsic "+i+" exists, but is not available. Please file an issue!");return{alias:Aw,name:n,value:Qw}}throw new A("intrinsic "+i+" does not exist!")};K.exports=function(i,Pw){if(typeof i!=="string"||i.length===0)throw new M("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof Pw!=="boolean")throw new M('"allowMissing" argument must be a boolean');if(Jw(/^%?[^%]*%?$/,i)===null)throw new A("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=xw(i),Aw=n.length>0?n[0]:"",Qw=uw("%"+Aw+"%",Pw),Lw=Qw.name,Ow=Qw.value,Tw=!1,Ew=Qw.alias;if(Ew)Aw=Ew[0],y(n,kw([0,1],Ew));for(var Uw=1,yw=!0;Uw<n.length;Uw+=1){var Hw=n[Uw],dw=_w(Hw,0,1),nw=_w(Hw,-1);if((dw==='"'||dw==="'"||dw==="`"||(nw==='"'||nw==="'"||nw==="`"))&&dw!==nw)throw new A("property names with quotes must have matching quotes");if(Hw==="constructor"||!yw)Tw=!0;if(Aw+="."+Hw,Lw="%"+Aw+"%",Vw(a,Lw))Ow=a[Lw];else if(Ow!=null){if(!(Hw in Ow)){if(!Pw)throw new M("base intrinsic for "+i+" exists, but the property is not available.");return}if(z&&Uw+1>=n.length){var tw=z(Ow,Hw);if(yw=!!tw,yw&&"get"in tw&&!("originalValue"in tw.get))Ow=tw.get;else Ow=Ow[Hw]}else yw=Vw(Ow,Hw),Ow=Ow[Hw];if(yw&&!Tw)a[Lw]=Ow}}return Ow}}),E4=p((w,K)=>{var W=W1(),J=L4(),P=J([W("%String.prototype.indexOf%")]);K.exports=function(I,b){var D=W(I,!!b);if(typeof D==="function"&&P(I,".prototype.")>-1)return J([D]);return D}}),U4=p((w,K)=>{var W=W1(),J=E4(),P=NK(),I=H2(),b=W("%Map%",!0),D=J("Map.prototype.get",!0),A=J("Map.prototype.set",!0),M=J("Map.prototype.has",!0),N=J("Map.prototype.delete",!0),Q=J("Map.prototype.size",!0);K.exports=!!b&&function(){var B,L={assert:function(g){if(!L.has(g))throw new I("Side channel does not contain "+P(g))},delete:function(g){if(B){var O=N(B,g);if(Q(B)===0)B=void 0;return O}return!1},get:function(g){if(B)return D(B,g)},has:function(g){if(B)return M(B,g);return!1},set:function(g,O){if(!B)B=new b;A(B,g,O)}};return L}}),F0=p((w,K)=>{var W=W1(),J=E4(),P=NK(),I=U4(),b=H2(),D=W("%WeakMap%",!0),A=J("WeakMap.prototype.get",!0),M=J("WeakMap.prototype.set",!0),N=J("WeakMap.prototype.has",!0),Q=J("WeakMap.prototype.delete",!0);K.exports=D?function(){var B,L,g={assert:function(O){if(!g.has(O))throw new b("Side channel does not contain "+P(O))},delete:function(O){if(D&&O&&(typeof O==="object"||typeof O==="function")){if(B)return Q(B,O)}else if(I){if(L)return L.delete(O)}return!1},get:function(O){if(D&&O&&(typeof O==="object"||typeof O==="function")){if(B)return A(B,O)}return L&&L.get(O)},has:function(O){if(D&&O&&(typeof O==="object"||typeof O==="function")){if(B)return N(B,O)}return!!L&&L.has(O)},set:function(O,v){if(D&&O&&(typeof O==="object"||typeof O==="function")){if(!B)B=new D;M(B,O,v)}else if(I){if(!L)L=I();L.set(O,v)}}};return g}:I}),H4=p((w,K)=>{var W=H2(),J=NK(),P=K0(),I=U4(),b=F0(),D=b||I||P;K.exports=function(){var A,M={assert:function(N){if(!M.has(N))throw new W("Side channel does not contain "+J(N))},delete:function(N){return!!A&&A.delete(N)},get:function(N){return A&&A.get(N)},has:function(N){return!!A&&A.has(N)},set:function(N,Q){if(!A)A=D();A.set(N,Q)}};return M}}),J1=p((w,K)=>{var W=String.prototype.replace,J=/%20/g,P={RFC1738:"RFC1738",RFC3986:"RFC3986"};K.exports={default:P.RFC3986,formatters:{RFC1738:function(I){return W.call(I,J,"+")},RFC3986:function(I){return String(I)}},RFC1738:P.RFC1738,RFC3986:P.RFC3986}}),q4=p((w,K)=>{var W=J1(),J=H4(),P=Object.prototype.hasOwnProperty,I=Array.isArray,b=J(),D=function(E,X){return b.set(E,X),E},A=function(E){return b.has(E)},M=function(E){return b.get(E)},N=function(E,X){b.set(E,X)},Q=function(){var E=[];for(var X=0;X<256;++X)E.push("%"+((X<16?"0":"")+X.toString(16)).toUpperCase());return E}(),B=function(E){while(E.length>1){var X=E.pop(),U=X.obj[X.prop];if(I(U)){var q=[];for(var c=0;c<U.length;++c)if(typeof U[c]<"u")q.push(U[c]);X.obj[X.prop]=q}}},L=function(E,X){var U=X&&X.plainObjects?{__proto__:null}:{};for(var q=0;q<E.length;++q)if(typeof E[q]<"u")U[q]=E[q];return U},g=function E(X,U,q){if(!U)return X;if(typeof U!=="object"&&typeof U!=="function"){if(I(X))X.push(U);else if(X&&typeof X==="object"){if(A(X)){var c=M(X)+1;X[c]=U,N(X,c)}else if(q&&(q.plainObjects||q.allowPrototypes)||!P.call(Object.prototype,U))X[U]=!0}else return[X,U];return X}if(!X||typeof X!=="object"){if(A(U)){var T=Object.keys(U),Ww=q&&q.plainObjects?{__proto__:null,0:X}:{0:X};for(var ww=0;ww<T.length;ww++){var a=parseInt(T[ww],10);Ww[a+1]=U[T[ww]]}return D(Ww,M(U)+1)}return[X].concat(U)}var d=X;if(I(X)&&!I(U))d=L(X,q);if(I(X)&&I(U))return U.forEach(function(Kw,m){if(P.call(X,m)){var l=X[m];if(l&&typeof l==="object"&&Kw&&typeof Kw==="object")X[m]=E(l,Kw,q);else X.push(Kw)}else X[m]=Kw}),X;return Object.keys(U).reduce(function(Kw,m){var l=U[m];if(P.call(Kw,m))Kw[m]=E(Kw[m],l,q);else Kw[m]=l;return Kw},d)},O=function(E,X){return Object.keys(X).reduce(function(U,q){return U[q]=X[q],U},E)},v=function(E,X,U){var q=E.replace(/\+/g," ");if(U==="iso-8859-1")return q.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(q)}catch(c){return q}},G=1024,u=function(E,X,U,q,c){if(E.length===0)return E;var T=E;if(typeof E==="symbol")T=Symbol.prototype.toString.call(E);else if(typeof E!=="string")T=String(E);if(U==="iso-8859-1")return escape(T).replace(/%u[0-9a-f]{4}/gi,function(l){return"%26%23"+parseInt(l.slice(2),16)+"%3B"});var Ww="";for(var ww=0;ww<T.length;ww+=G){var a=T.length>=G?T.slice(ww,ww+G):T,d=[];for(var Kw=0;Kw<a.length;++Kw){var m=a.charCodeAt(Kw);if(m===45||m===46||m===95||m===126||m>=48&&m<=57||m>=65&&m<=90||m>=97&&m<=122||c===W.RFC1738&&(m===40||m===41)){d[d.length]=a.charAt(Kw);continue}if(m<128){d[d.length]=Q[m];continue}if(m<2048){d[d.length]=Q[192|m>>6]+Q[128|m&63];continue}if(m<55296||m>=57344){d[d.length]=Q[224|m>>12]+Q[128|m>>6&63]+Q[128|m&63];continue}Kw+=1,m=65536+((m&1023)<<10|a.charCodeAt(Kw)&1023),d[d.length]=Q[240|m>>18]+Q[128|m>>12&63]+Q[128|m>>6&63]+Q[128|m&63]}Ww+=d.join("")}return Ww},o=function(E){var X=[{obj:{o:E},prop:"o"}],U=[];for(var q=0;q<X.length;++q){var c=X[q],T=c.obj[c.prop],Ww=Object.keys(T);for(var ww=0;ww<Ww.length;++ww){var a=Ww[ww],d=T[a];if(typeof d==="object"&&d!==null&&U.indexOf(d)===-1)X.push({obj:T,prop:a}),U.push(d)}}return B(X),E},z=function(E){return Object.prototype.toString.call(E)==="[object RegExp]"},Z=function(E){if(!E||typeof E!=="object")return!1;return!!(E.constructor&&E.constructor.isBuffer&&E.constructor.isBuffer(E))},x=function(E,X,U,q){if(A(E)){var c=M(E)+1;return E[c]=X,N(E,c),E}var T=[].concat(E,X);if(T.length>U)return D(L(T,{plainObjects:q}),T.length-1);return T},r=function(E,X){if(I(E)){var U=[];for(var q=0;q<E.length;q+=1)U.push(X(E[q]));return U}return X(E)};K.exports={arrayToObject:L,assign:O,combine:x,compact:o,decode:v,encode:u,isBuffer:Z,isOverflow:A,isRegExp:z,maybeMap:r,merge:g}}),z0=p((w,K)=>{var W=H4(),J=q4(),P=J1(),I=Object.prototype.hasOwnProperty,b={brackets:function(G){return G+"[]"},comma:"comma",indices:function(G,u){return G+"["+u+"]"},repeat:function(G){return G}},D=Array.isArray,A=Array.prototype.push,M=function(G,u){A.apply(G,D(u)?u:[u])},N=Date.prototype.toISOString,Q=P.default,B={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:J.encode,encodeValuesOnly:!1,filter:void 0,format:Q,formatter:P.formatters[Q],indices:!1,serializeDate:function(G){return N.call(G)},skipNulls:!1,strictNullHandling:!1},L=function(G){return typeof G==="string"||typeof G==="number"||typeof G==="boolean"||typeof G==="symbol"||typeof G==="bigint"},g={},O=function G(u,o,z,Z,x,r,E,X,U,q,c,T,Ww,ww,a,d,Kw,m){var l=u,Vw=m,kw=0,y=!1;while((Vw=Vw.get(g))!==void 0&&!y){var qw=Vw.get(u);if(kw+=1,typeof qw<"u")if(qw===kw)throw RangeError("Cyclic object value");else y=!0;if(typeof Vw.get(g)>"u")kw=0}if(typeof q==="function")l=q(o,l);else if(l instanceof Date)l=Ww(l);else if(z==="comma"&&D(l))l=J.maybeMap(l,function(Ow){if(Ow instanceof Date)return Ww(Ow);return Ow});if(l===null){if(r)return U&&!d?U(o,B.encoder,Kw,"key",ww):o;l=""}if(L(l)||J.isBuffer(l)){if(U){var _w=d?o:U(o,B.encoder,Kw,"key",ww);return[a(_w)+"="+a(U(l,B.encoder,Kw,"value",ww))]}return[a(o)+"="+a(String(l))]}var Jw=[];if(typeof l>"u")return Jw;var ow;if(z==="comma"&&D(l)){if(d&&U)l=J.maybeMap(l,U);ow=[{value:l.length>0?l.join(",")||null:void 0}]}else if(D(q))ow=q;else{var zw=Object.keys(l);ow=c?zw.sort(c):zw}var xw=X?String(o).replace(/\./g,"%2E"):String(o),uw=Z&&D(l)&&l.length===1?xw+"[]":xw;if(x&&D(l)&&l.length===0)return uw+"[]";for(var i=0;i<ow.length;++i){var Pw=ow[i],n=typeof Pw==="object"&&Pw&&typeof Pw.value<"u"?Pw.value:l[Pw];if(E&&n===null)continue;var Aw=T&&X?String(Pw).replace(/\./g,"%2E"):String(Pw),Qw=D(l)?typeof z==="function"?z(uw,Aw):uw:uw+(T?"."+Aw:"["+Aw+"]");m.set(u,kw);var Lw=W();Lw.set(g,m),M(Jw,G(n,Qw,z,Z,x,r,E,X,z==="comma"&&d&&D(l)?null:U,q,c,T,Ww,ww,a,d,Kw,Lw))}return Jw},v=function(G){if(!G)return B;if(typeof G.allowEmptyArrays<"u"&&typeof G.allowEmptyArrays!=="boolean")throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof G.encodeDotInKeys<"u"&&typeof G.encodeDotInKeys!=="boolean")throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(G.encoder!==null&&typeof G.encoder<"u"&&typeof G.encoder!=="function")throw TypeError("Encoder has to be a function.");var u=G.charset||B.charset;if(typeof G.charset<"u"&&G.charset!=="utf-8"&&G.charset!=="iso-8859-1")throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var o=P.default;if(typeof G.format<"u"){if(!I.call(P.formatters,G.format))throw TypeError("Unknown format option provided.");o=G.format}var z=P.formatters[o],Z=B.filter;if(typeof G.filter==="function"||D(G.filter))Z=G.filter;var x;if(G.arrayFormat in b)x=G.arrayFormat;else if("indices"in G)x=G.indices?"indices":"repeat";else x=B.arrayFormat;if("commaRoundTrip"in G&&typeof G.commaRoundTrip!=="boolean")throw TypeError("`commaRoundTrip` must be a boolean, or absent");var r=typeof G.allowDots>"u"?G.encodeDotInKeys===!0?!0:B.allowDots:!!G.allowDots;return{addQueryPrefix:typeof G.addQueryPrefix==="boolean"?G.addQueryPrefix:B.addQueryPrefix,allowDots:r,allowEmptyArrays:typeof G.allowEmptyArrays==="boolean"?!!G.allowEmptyArrays:B.allowEmptyArrays,arrayFormat:x,charset:u,charsetSentinel:typeof G.charsetSentinel==="boolean"?G.charsetSentinel:B.charsetSentinel,commaRoundTrip:!!G.commaRoundTrip,delimiter:typeof G.delimiter>"u"?B.delimiter:G.delimiter,encode:typeof G.encode==="boolean"?G.encode:B.encode,encodeDotInKeys:typeof G.encodeDotInKeys==="boolean"?G.encodeDotInKeys:B.encodeDotInKeys,encoder:typeof G.encoder==="function"?G.encoder:B.encoder,encodeValuesOnly:typeof G.encodeValuesOnly==="boolean"?G.encodeValuesOnly:B.encodeValuesOnly,filter:Z,format:o,formatter:z,serializeDate:typeof G.serializeDate==="function"?G.serializeDate:B.serializeDate,skipNulls:typeof G.skipNulls==="boolean"?G.skipNulls:B.skipNulls,sort:typeof G.sort==="function"?G.sort:null,strictNullHandling:typeof G.strictNullHandling==="boolean"?G.strictNullHandling:B.strictNullHandling}};K.exports=function(G,u){var o=G,z=v(u),Z,x;if(typeof z.filter==="function")x=z.filter,o=x("",o);else if(D(z.filter))x=z.filter,Z=x;var r=[];if(typeof o!=="object"||o===null)return"";var E=b[z.arrayFormat],X=E==="comma"&&z.commaRoundTrip;if(!Z)Z=Object.keys(o);if(z.sort)Z.sort(z.sort);var U=W();for(var q=0;q<Z.length;++q){var c=Z[q],T=o[c];if(z.skipNulls&&T===null)continue;M(r,O(T,c,E,X,z.allowEmptyArrays,z.strictNullHandling,z.skipNulls,z.encodeDotInKeys,z.encode?z.encoder:null,z.filter,z.sort,z.allowDots,z.serializeDate,z.format,z.formatter,z.encodeValuesOnly,z.charset,U))}var Ww=r.join(z.delimiter),ww=z.addQueryPrefix===!0?"?":"";if(z.charsetSentinel)if(z.charset==="iso-8859-1")ww+="utf8=%26%2310003%3B&";else ww+="utf8=%E2%9C%93&";return Ww.length>0?ww+Ww:""}}),R0=p((w,K)=>{var W=q4(),J=Object.prototype.hasOwnProperty,P=Array.isArray,I={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:W.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1000,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},b=function(O){return O.replace(/&#(\d+);/g,function(v,G){return String.fromCharCode(parseInt(G,10))})},D=function(O,v,G){if(O&&typeof O==="string"&&v.comma&&O.indexOf(",")>-1)return O.split(",");if(v.throwOnLimitExceeded&&G>=v.arrayLimit)throw RangeError("Array limit exceeded. Only "+v.arrayLimit+" element"+(v.arrayLimit===1?"":"s")+" allowed in an array.");return O},A="utf8=%26%2310003%3B",M="utf8=%E2%9C%93",N=function(O,v){var G={__proto__:null},u=v.ignoreQueryPrefix?O.replace(/^\?/,""):O;u=u.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=v.parameterLimit===1/0?void 0:v.parameterLimit,z=u.split(v.delimiter,v.throwOnLimitExceeded?o+1:o);if(v.throwOnLimitExceeded&&z.length>o)throw RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var Z=-1,x,r=v.charset;if(v.charsetSentinel){for(x=0;x<z.length;++x)if(z[x].indexOf("utf8=")===0){if(z[x]===M)r="utf-8";else if(z[x]===A)r="iso-8859-1";Z=x,x=z.length}}for(x=0;x<z.length;++x){if(x===Z)continue;var E=z[x],X=E.indexOf("]="),U=X===-1?E.indexOf("="):X+1,q,c;if(U===-1)q=v.decoder(E,I.decoder,r,"key"),c=v.strictNullHandling?null:"";else if(q=v.decoder(E.slice(0,U),I.decoder,r,"key"),q!==null)c=W.maybeMap(D(E.slice(U+1),v,P(G[q])?G[q].length:0),function(Ww){return v.decoder(Ww,I.decoder,r,"value")});if(c&&v.interpretNumericEntities&&r==="iso-8859-1")c=b(String(c));if(E.indexOf("[]=")>-1)c=P(c)?[c]:c;if(q!==null){var T=J.call(G,q);if(T&&v.duplicates==="combine")G[q]=W.combine(G[q],c,v.arrayLimit,v.plainObjects);else if(!T||v.duplicates==="last")G[q]=c}}return G},Q=function(O,v,G,u){var o=0;if(O.length>0&&O[O.length-1]==="[]"){var z=O.slice(0,-1).join("");o=Array.isArray(v)&&v[z]?v[z].length:0}var Z=u?v:D(v,G,o);for(var x=O.length-1;x>=0;--x){var r,E=O[x];if(E==="[]"&&G.parseArrays)if(W.isOverflow(Z))r=Z;else r=G.allowEmptyArrays&&(Z===""||G.strictNullHandling&&Z===null)?[]:W.combine([],Z,G.arrayLimit,G.plainObjects);else{r=G.plainObjects?{__proto__:null}:{};var X=E.charAt(0)==="["&&E.charAt(E.length-1)==="]"?E.slice(1,-1):E,U=G.decodeDotInKeys?X.replace(/%2E/g,"."):X,q=parseInt(U,10);if(!G.parseArrays&&U==="")r={0:Z};else if(!isNaN(q)&&E!==U&&String(q)===U&&q>=0&&(G.parseArrays&&q<=G.arrayLimit))r=[],r[q]=Z;else if(U!=="__proto__")r[U]=Z}Z=r}return Z},B=function(O,v){var G=v.allowDots?O.replace(/\.([^.[]+)/g,"[$1]"):O;if(v.depth<=0){if(!v.plainObjects&&J.call(Object.prototype,G)){if(!v.allowPrototypes)return}return[G]}var u=/(\[[^[\]]*])/,o=/(\[[^[\]]*])/g,z=u.exec(G),Z=z?G.slice(0,z.index):G,x=[];if(Z){if(!v.plainObjects&&J.call(Object.prototype,Z)){if(!v.allowPrototypes)return}x.push(Z)}var r=0;while((z=o.exec(G))!==null&&r<v.depth){r+=1;var E=z[1].slice(1,-1);if(!v.plainObjects&&J.call(Object.prototype,E)){if(!v.allowPrototypes)return}x.push(z[1])}if(z){if(v.strictDepth===!0)throw RangeError("Input depth exceeded depth option of "+v.depth+" and strictDepth is true");x.push("["+G.slice(z.index)+"]")}return x},L=function(O,v,G,u){if(!O)return;var o=B(O,G);if(!o)return;return Q(o,v,G,u)},g=function(O){if(!O)return I;if(typeof O.allowEmptyArrays<"u"&&typeof O.allowEmptyArrays!=="boolean")throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof O.decodeDotInKeys<"u"&&typeof O.decodeDotInKeys!=="boolean")throw TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(O.decoder!==null&&typeof O.decoder<"u"&&typeof O.decoder!=="function")throw TypeError("Decoder has to be a function.");if(typeof O.charset<"u"&&O.charset!=="utf-8"&&O.charset!=="iso-8859-1")throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof O.throwOnLimitExceeded<"u"&&typeof O.throwOnLimitExceeded!=="boolean")throw TypeError("`throwOnLimitExceeded` option must be a boolean");var v=typeof O.charset>"u"?I.charset:O.charset,G=typeof O.duplicates>"u"?I.duplicates:O.duplicates;if(G!=="combine"&&G!=="first"&&G!=="last")throw TypeError("The duplicates option must be either combine, first, or last");var u=typeof O.allowDots>"u"?O.decodeDotInKeys===!0?!0:I.allowDots:!!O.allowDots;return{allowDots:u,allowEmptyArrays:typeof O.allowEmptyArrays==="boolean"?!!O.allowEmptyArrays:I.allowEmptyArrays,allowPrototypes:typeof O.allowPrototypes==="boolean"?O.allowPrototypes:I.allowPrototypes,allowSparse:typeof O.allowSparse==="boolean"?O.allowSparse:I.allowSparse,arrayLimit:typeof O.arrayLimit==="number"?O.arrayLimit:I.arrayLimit,charset:v,charsetSentinel:typeof O.charsetSentinel==="boolean"?O.charsetSentinel:I.charsetSentinel,comma:typeof O.comma==="boolean"?O.comma:I.comma,decodeDotInKeys:typeof O.decodeDotInKeys==="boolean"?O.decodeDotInKeys:I.decodeDotInKeys,decoder:typeof O.decoder==="function"?O.decoder:I.decoder,delimiter:typeof O.delimiter==="string"||W.isRegExp(O.delimiter)?O.delimiter:I.delimiter,depth:typeof O.depth==="number"||O.depth===!1?+O.depth:I.depth,duplicates:G,ignoreQueryPrefix:O.ignoreQueryPrefix===!0,interpretNumericEntities:typeof O.interpretNumericEntities==="boolean"?O.interpretNumericEntities:I.interpretNumericEntities,parameterLimit:typeof O.parameterLimit==="number"?O.parameterLimit:I.parameterLimit,parseArrays:O.parseArrays!==!1,plainObjects:typeof O.plainObjects==="boolean"?O.plainObjects:I.plainObjects,strictDepth:typeof O.strictDepth==="boolean"?!!O.strictDepth:I.strictDepth,strictNullHandling:typeof O.strictNullHandling==="boolean"?O.strictNullHandling:I.strictNullHandling,throwOnLimitExceeded:typeof O.throwOnLimitExceeded==="boolean"?O.throwOnLimitExceeded:!1}};K.exports=function(O,v){var G=g(v);if(O===""||O===null||typeof O>"u")return G.plainObjects?{__proto__:null}:{};var u=typeof O==="string"?N(O,G):O,o=G.plainObjects?{__proto__:null}:{},z=Object.keys(u);for(var Z=0;Z<z.length;++Z){var x=z[Z],r=L(x,u[x],G,typeof O==="string");o=W.merge(o,r,G)}if(G.allowSparse===!0)return o;return W.compact(o)}}),v0=p((w,K)=>{var W=z0(),J=R0(),P=J1();K.exports={formats:P,parse:J,stringify:W}}),WJ=BK(w1(),1),j0={};Q4(j0,{zodSchemaKey:()=>g0,webSocketServerArgsKey:()=>Rw,webSocketMessageArgsKey:()=>bK,webSocketKey:()=>AK,webSocketEventKey:()=>C0,webSocketEventArgumentsKey:()=>Z0,webSocketConnectionArgsKey:()=>D2,webSocketCloseReasonArgsKey:()=>v4,webSocketCloseCodeArgsKey:()=>R4,routeModelArgsKey:()=>fw,responseStatusTextArgsKey:()=>_2,responseStatusArgsKey:()=>V2,responseHeadersArgsKey:()=>sw,responseBodyArgsKey:()=>r2,requestHeadersArgsKey:()=>L2,requestHeaderArgsKey:()=>A2,requestBodyArgsKey:()=>x2,requestArgsKey:()=>M2,queryArgsKey:()=>j4,paramsArgsKey:()=>tK,paramArgsKey:()=>c2,moduleKey:()=>IK,middlewareKey:()=>z4,interceptorKey:()=>h4,injectableKey:()=>F4,injectKey:()=>GK,httpServerArgsKey:()=>G2,guardKey:()=>P1,controllerKey:()=>DK,controllerHttpKey:()=>k0,contextArgsKey:()=>E2,containerKey:()=>o2,configKey:()=>nK,argumentsKey:()=>Xw});var Xw=Symbol.for("____boolTypescriptCore:arguments__"),Z0=Symbol.for("____boolTypescriptCore:webSocketEventArguments__"),nK=Symbol.for("____boolTypescriptCore:config__"),DK=Symbol.for("____boolTypescriptCore:controller__"),h4=Symbol.for("____boolTypescriptCore:interceptor__"),P1=Symbol.for("____boolTypescriptCore:guard__"),k0=Symbol.for("____boolTypescriptCore:controller.http__"),GK=Symbol.for("____boolTypescriptCore:inject__"),F4=Symbol.for("____boolTypescriptCore:injectable__"),z4=Symbol.for("____boolTypescriptCore:middleware__"),IK=Symbol.for("____boolTypescriptCore:module__"),o2=Symbol.for("____boolTypescriptCore:container__"),g0=Symbol.for("____boolTypescriptCore:zodSchema__"),AK=Symbol.for("____boolTypescriptCore:webSocket__"),C0=Symbol.for("____boolTypescriptCore:webSocket:event__"),Rw=Symbol.for("____boolTypescriptCore:webSocketArguments:server__"),D2=Symbol.for("____boolTypescriptCore:webSocketArguments:connection__"),bK=Symbol.for("____boolTypescriptCore:webSocketArguments:message__"),R4=Symbol.for("____boolTypescriptCore:webSocketArguments:closeCode__"),v4=Symbol.for("____boolTypescriptCore:webSocketArguments:closeReason__"),G2=Symbol.for("____boolTypescriptCore:httpArguments:server__"),L2=Symbol.for("____boolTypescriptCore:httpArguments:requestHeaders__"),A2=Symbol.for("____boolTypescriptCore:httpArguments:requestHeader__"),x2=Symbol.for("____boolTypescriptCore:httpArguments:requestBody__"),tK=Symbol.for("____boolTypescriptCore:httpArguments:params__"),c2=Symbol.for("____boolTypescriptCore:httpArguments:param__"),j4=Symbol.for("____boolTypescriptCore:httpArguments:query__"),M2=Symbol.for("____boolTypescriptCore:httpArguments:request__"),sw=Symbol.for("____boolTypescriptCore:httpArguments:responseHeaders__"),E2=Symbol.for("____boolTypescriptCore:httpArguments:context__"),fw=Symbol.for("____boolTypescriptCore:httpArguments:routeModel__"),r2=Symbol.for("____boolTypescriptCore:httpArguments:responseBody__"),V2=Symbol.for("____boolTypescriptCore:httpArguments:responseStatus__"),_2=Symbol.for("____boolTypescriptCore:httpArguments:responseStatusText__"),Yw={};Q4(Yw,{successfulStatuses:()=>k4,serverErrorStatuses:()=>o4,redirectionStatuses:()=>g4,informationalStatuses:()=>Z4,httpStatuses:()=>o0,clientErrorStatuses:()=>C4});var Z4=Object.freeze({CONTINUE:Object.freeze({status:100,statusText:"Continue"}),SWITCHING_PROTOCOLS:Object.freeze({status:101,statusText:"Switching Protocols"}),EARLY_HINTS:Object.freeze({status:103,statusText:"Early Hints"})}),k4=Object.freeze({OK:Object.freeze({status:200,statusText:"OK"}),CREATED:Object.freeze({status:201,statusText:"Created"}),ACCEPTED:Object.freeze({status:202,statusText:"Accepted"}),NON_AUTHORITATIVE_INFORMATION:Object.freeze({status:203,statusText:"Non-Authoritative Information"}),NO_CONTENT:Object.freeze({status:204,statusText:"No Content"}),RESET_CONTENT:Object.freeze({status:205,statusText:"Reset Content"}),PARTIAL_CONTENT:Object.freeze({status:206,statusText:"Partial Content"}),MULTI_STATUS:Object.freeze({status:207,statusText:"Multi-Status"}),ALREADY_REPORTED:Object.freeze({status:208,statusText:"Already Reported"}),IM_USED:Object.freeze({status:226,statusText:"IM Used"})}),g4=Object.freeze({MULTIPLE_CHOICES:Object.freeze({status:300,statusText:"Multiple Choices"}),MOVED_PERMANENTLY:Object.freeze({status:301,statusText:"Moved Permanently"}),FOUND:Object.freeze({status:302,statusText:"Found"}),SEE_OTHER:Object.freeze({status:303,statusText:"See Other"}),NOT_MODIFIED:Object.freeze({status:304,statusText:"Not Modified"}),UNUSED:Object.freeze({status:306,statusText:"Unused"}),TEMPORARY_REDIRECT:Object.freeze({status:307,statusText:"Temporary Redirect"}),PERMANENT_REDIRECT:Object.freeze({status:308,statusText:"Permanent Redirect"})}),C4=Object.freeze({BAD_REQUEST:Object.freeze({status:400,statusText:"Bad Request"}),UNAUTHORIZED:Object.freeze({status:401,statusText:"Unauthorized"}),PAYMENT_REQUIRED:Object.freeze({status:402,statusText:"Payment Required"}),FORBIDDEN:Object.freeze({status:403,statusText:"Forbidden"}),NOT_FOUND:Object.freeze({status:404,statusText:"Not Found"}),METHOD_NOT_ALLOWED:Object.freeze({status:405,statusText:"Method Not Allowed"}),NOT_ACCEPTABLE:Object.freeze({status:406,statusText:"Not Acceptable"}),PROXY_AUTHENTICATION_REQUIRED:Object.freeze({status:407,statusText:"Proxy Authentication Required"}),REQUEST_TIMEOUT:Object.freeze({status:408,statusText:"Request Timeout"}),CONFLICT:Object.freeze({status:409,statusText:"Conflict"}),GONE:Object.freeze({status:410,statusText:"Gone"}),LENGTH_REQUIRED:Object.freeze({status:411,statusText:"Length Required"}),PRECONDITION_FAILED:Object.freeze({status:412,statusText:"Precondition Failed"}),CONTENT_TOO_LARGE:Object.freeze({status:413,statusText:"Content Too Large"}),URI_TOO_LONG:Object.freeze({status:414,statusText:"URI Too Long"}),UNSUPPORTED_MEDIA_TYPE:Object.freeze({status:415,statusText:"Unsupported Media Type"}),RANGE_NOT_SATISFIABLE:Object.freeze({status:416,statusText:"Range Not Satisfiable"}),EXPECTATION_FAILED:Object.freeze({status:417,statusText:"Expectation Failed"}),I_AM_A_TEAPOT:Object.freeze({status:418,statusText:"I'm a teapot"}),MISDIRECTED_REQUEST:Object.freeze({status:421,statusText:"Misdirected Request"}),UNPROCESSABLE_CONTENT:Object.freeze({status:422,statusText:"Unprocessable Content"}),LOCKED:Object.freeze({status:423,statusText:"Locked"}),FAILED_DEPENDENCY:Object.freeze({status:424,statusText:"Failed Dependency"}),TOO_EARLY:Object.freeze({status:425,statusText:"Too Early"}),UPGRADE_REQUIRED:Object.freeze({status:426,statusText:"Upgrade Required"}),PRECONDITION_REQUIRED:Object.freeze({status:428,statusText:"Precondition Required"}),TOO_MANY_REQUESTS:Object.freeze({status:429,statusText:"Too Many Requests"}),REQUEST_HEADER_FIELDS_TOO_LARGE:Object.freeze({status:431,statusText:"Request Header Fields Too Large"}),UNAVAILABLE_FOR_LEGAL_REASONS:Object.freeze({status:451,statusText:"Unavailable For Legal Reasons"})}),o4=Object.freeze({INTERNAL_SERVER_ERROR:Object.freeze({status:500,statusText:"Internal Server Error"}),NOT_IMPLEMENTED:Object.freeze({status:501,statusText:"Not Implemented"}),BAD_GATEWAY:Object.freeze({status:502,statusText:"Bad Gateway"}),SERVICE_UNAVAILABLE:Object.freeze({status:503,statusText:"Service Unavailable"}),GATEWAY_TIMEOUT:Object.freeze({status:504,statusText:"Gateway Timeout"}),HTTP_VERSION_NOT_SUPPORTED:Object.freeze({status:505,statusText:"HTTP Version Not Supported"}),VARIANT_ALSO_NEGOTIATES:Object.freeze({status:506,statusText:"Variant Also Negotiates"}),INSUFFICIENT_STORAGE:Object.freeze({status:507,statusText:"Insufficient Storage"}),LOOP_DETECTED:Object.freeze({status:508,statusText:"Loop Detected"}),NOT_EXTENDED:Object.freeze({status:510,statusText:"Not Extended"}),NETWORK_AUTHENTICATION_REQUIRED:Object.freeze({status:511,statusText:"Network Authentication Required"})}),o0=Object.freeze({...Z4,...k4,...g4,...C4,...o4}),x4=(w)=>(K,W,J)=>{if(!W)return;let P=Reflect.getOwnMetadata(Xw,K.constructor,W)||{};P[`argumentIndexes.${J}`]={index:J,type:L2,validationSchema:w},Reflect.defineMetadata(Xw,P,K.constructor,W)};var SK=(w)=>(K,W,J)=>{if(!W)return;let P=Reflect.getOwnMetadata(Xw,K.constructor,W)||{};P[`argumentIndexes.${J}`]={index:J,type:E2,key:w},Reflect.defineMetadata(Xw,P,K.constructor,W)},c4=()=>(w,K,W)=>{if(!K)return;let J=Reflect.getOwnMetadata(Xw,w.constructor,K)||{};J[`argumentIndexes.${W}`]={index:W,type:fw},Reflect.defineMetadata(Xw,J,w.constructor,K)};var r4=()=>(w)=>{if(!("enforce"in w.prototype)||typeof w.prototype.enforce!=="function")return;let K=void 0;return Reflect.defineMetadata(P1,K,w),w};var _4=(w)=>(K,W,J)=>{let P=Reflect.getMetadata(GK,K)||[];P[J]=w,Reflect.defineMetadata(GK,P,K)};var JJ=Symbol("__bool:webSocket.upgrade__");var cw;(function(w){w.year="year",w.month="month",w.day="day",w.hours="hours",w.minutes="minutes",w.seconds="seconds",w.miliseconds="miliseconds"})(cw||(cw={}));var x0=(w,K,W=cw.day)=>{let J=w instanceof Date?w:new Date(w);switch(W){case cw.year:J.setFullYear(J.getFullYear()+K);break;case cw.month:J.setMonth(J.getMonth()+K);break;case cw.day:J.setDate(J.getDate()+K);break;case cw.hours:J.setHours(J.getHours()+K);break;case cw.minutes:J.setMinutes(J.getMinutes()+K);break;case cw.seconds:J.setSeconds(J.getSeconds()+K);break;case cw.miliseconds:J.setMilliseconds(J.getMilliseconds()+K);break}return J},c0=BK(v0(),1),{serve:r0}=globalThis.Bun,PJ=async function(){}.constructor,B4=Object.freeze({black:"38;5;16",red:"38;5;196",green:"38;5;46",yellow:"38;5;226",blue:"38;5;21",magenta:"38;5;201",cyan:"38;5;51",white:"38;5;231",gray:"38;5;244"}),N4=Object.freeze({black:"48;5;16",red:"48;5;196",green:"48;5;46",yellow:"48;5;226",blue:"48;5;21",magenta:"48;5;201",cyan:"48;5;51",white:"48;5;231",gray:"48;5;244"}),pw=(w,K={})=>{let{color:W,backgroundColor:J,bold:P,underline:I}=K,b=[];if(P)b.push("1");if(I)b.push("4");if(W&&B4[W])b.push(B4[W]);if(J&&N4[J])b.push(N4[J]);if(b.length===0)return w;return`\x1B[${b.join(";")}m${w}\x1B[0m`},MK=(w)=>{for(let[K,W]of Object.entries(Yw.httpStatuses)){if(W.status!==w)continue;return W.statusText}return"Unknown error"},_0=(w)=>{let{headers:K,method:W}=w,J=K.get("upgrade")?.toLowerCase()||"",P=K.get("connection")?.toLowerCase()||"";return W==="GET"&&J?.toLowerCase()==="websocket"&&P?.toLowerCase().includes("upgrade")};class OK extends Error{httpCode;message;data;constructor({httpCode:w,data:K,message:W}){super();this.httpCode=w,this.message=!W?.trim()?MK(w):W.trim(),this.data=K}}class I1 extends Error{httpCode;message;data;constructor({httpCode:w,data:K,message:W}){super();this.httpCode=w,this.message=!W?.trim()?MK(w):W.trim(),this.data=K}}var u4=["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"],u0=(w)=>!!u4.find((K)=>K===w),y0=(w,K=new Headers)=>{if(K.set("Content-Type","application/json"),w instanceof OK||w instanceof I1)return new Response(JSON.stringify(w),{status:w.httpCode,statusText:w.message,headers:K});return new Response(JSON.stringify((()=>{switch(typeof w){case"object":return!(w instanceof Error)?w:{message:w.message,code:w.name,cause:w.cause};case"string":return{message:w};case"number":return{code:w};default:return}})()),{status:500,statusText:"INTERNAL SERVER ERROR",headers:K})};class aK{_staticMap=new Map;_dynamicMap=new Map;_options=void 0;constructor(...w){w.forEach((K)=>{K.staticEntries.forEach(([W,J])=>this.set(W,J,{isStatic:!0,isPassthrough:!0})),K.dynamicEntries.forEach(([W,J])=>this.set(W,J,{isStatic:!1}))})}get(w,K){return!{...this._options,...K}.isStatic?this._dynamicMap.get(w):this._staticMap.get(w)}has(w,K){return!{...this._options,...K}.isStatic?this._dynamicMap.has(w):this._staticMap.has(w)}set(w,K,W){let J={...this._options,...W};if(!J?.isStatic)this._dynamicMap.set(w,K);else if(!this._staticMap.has(w))this._staticMap.set(w,K);else if(!J.isPassthrough)throw Error(`${String(w)} already exists in context static collection.`);return this}setOptions(w){return this._options=w,this}get staticEntries(){return[...this._staticMap.entries()]}get dynamicEntries(){return[...this._dynamicMap.entries()]}}class y4{alias;#w=new Map;#K;constructor({alias:w}){let K=this._thinAlias(w);this.alias=K,this.#K=new URLPattern({pathname:K,baseURL:"https://www.booljs.com"})}test({pathname:w}){try{return this.#K.test({pathname:this._thinAlias(w),baseURL:"https://www.booljs.com"})}catch(K){return console.error(K),!1}}exec({pathname:w,method:K}){try{let W=this.#w.get(K);if(!W)return null;let J=this.#K.exec({pathname:this._thinAlias(w),baseURL:"https://www.booljs.com"});if(!J)return null;let P=J.pathname.groups;return Object.freeze({parameters:P,model:W})}catch(W){return console.error(W),null}}get({model:w}){if(!this.#w.get("GET"))this.#w.set("GET",w);return this}post({model:w}){if(!this.#w.get("POST"))this.#w.set("POST",w);return this}put({model:w}){if(!this.#w.get("PUT"))this.#w.set("PUT",w);return this}delete({model:w}){if(!this.#w.get("DELETE"))this.#w.set("DELETE",w);return this}connect({model:w}){if(!this.#w.get("CONNECT"))return this.#w.set("CONNECT",w);return this}options({model:w}){if(!this.#w.get("OPTIONS"))return this.#w.set("OPTIONS",w);return this}trace({model:w}){if(!this.#w.get("TRACE"))return this.#w.set("TRACE",w);return this}patch({model:w}){if(!this.#w.get("PATCH"))return this.#w.set("PATCH",w);return this}_thinAlias(w){return w.replace(new RegExp("[/]{2,}","g"),"/").replace(new RegExp("^[/]|[/]$","g"),"")}get _fullPath(){return this.alias.split("/").map((w,K)=>{let W=new RegExp(":([a-z0-9A-Z_.-]{1,})(\\(.*?\\))","g");if(!W.test(w)){if(W=new RegExp(":([a-z0-9A-Z_.-]{1,})","g"),!W.test(w))return w;return w.replace(W,(J,P)=>`${J}(.*?)`)}return w}).join("/")}get _filteredPath(){return this.alias.split("/").map((w,K)=>{let W=new RegExp(":([a-z0-9A-Z_.-]{1,})((.*?))","g");if(!W.test(w)){if(W=new RegExp(":([a-z0-9A-Z_.-]{1,})","g"),!W.test(w))return w;return w.replace(W,(J,P)=>"(.*?)")}return w.replace(W,(J,P,I)=>I)}).join("/")}}var m0=y4;class sK{alias;#w=new Map;#K;#J;#I;constructor({alias:w,guardHandlers:K=[],openInterceptorHandlers:W=[],closeInterceptorHandlers:J=[]}){this.alias=this._thinAlias(w),this.#K=K,this.#J=W,this.#I=J}route({alias:w}){let K=this._thinAlias(`${this.alias}/${w}`),W=this.#w.get(K),J=!W?new m0({alias:`${this.alias}/${w}`}):W;if(!W)this.#w.set(K,J);return J}_thinAlias(w){return w.replace(new RegExp("[/]{2,}","g"),"/").replace(new RegExp("^[/]|[/]$","g"),"")}get routes(){return this.#w}get pipes(){return Object.freeze({guardHandlers:[...this.#K],openInterceptorHandlers:[...this.#J],closeInterceptorHandlers:[...this.#I]})}}class O2{#w=new Map;add(...w){for(let K of w){if(this.#w.has(K.alias))continue;this.#w.set(K.alias,K)}return this}find({pathname:w,method:K}){for(let W of this.#w.values())for(let J of W.routes.values()){if(!J.test({pathname:w}))continue;let P=J.exec({pathname:w,method:K});if(!P)continue;return Object.freeze({...P,...W.pipes})}return null}}var IJ=BK(w1(),1);class B2{_mapper=new Map;constructor(...w){w.forEach((K)=>{K.entries.forEach(([W,J])=>{this._mapper.set(W,J)})})}get(w){if(this._mapper.has(w))return this._mapper.get(w);if(typeof w!=="function")return;let K=Reflect.getMetadataKeys(w);if(![F4,DK,z4,P1,h4,AK].some((P)=>K.includes(P)))throw Error("Missing dependency declaration, please check @Injectable() used on dependency(ies).");let W=(Reflect.getOwnMetadata(GK,w)||[]).map((P)=>this.get(P)),J=new w(...W);return this._mapper.set(w,J),J}set(w,K){if(this._mapper.has(w))throw Error(`${String(w)} already exists in injector collection.`);this._mapper.set(w,K)}get entries(){return[...this._mapper.entries()]}}class m4{error;constructor(w){this.error=w}}class T4{eventName;metadata;_context=void 0;constructor({eventName:w,metadata:K}){this.eventName=w,this.metadata=K}bind(w){return this._context=w,this}execute(){if(this._context&&typeof this.metadata.descriptor.value==="function")this.metadata.descriptor.value=this.metadata.descriptor.value.bind(this._context);return Object.freeze({methodName:this.metadata.methodName,descriptor:this.metadata.descriptor,arguments:this.metadata.arguments})}}class b1{rawAlias;alias;routes=[];constructor(w="/"){this.rawAlias=w,this.alias=b1.thinAlias(w)}addRoutes(...w){for(let K of w)if(!this.routes.includes(K))this.routes.push(K);return this}bind(w){for(let K of this.routes)K.bind(w);return this}execute(){let w=new Map;for(let K of this.routes)w.set(`${this.alias}:::${K.eventName}`,K.execute());return w}static thinAlias(w){return w.replace(new RegExp("[/]{2,}","g"),"/").replace(new RegExp("^[/]|[/]$","g"),"")}}class U2{rawPrefix;prefix;routers=[];constructor(w="/"){this.rawPrefix=w,this.prefix=U2.thinPrefix(w)}addRouters(...w){for(let K=0;K<w.length;K++)if(!this.routers.includes(w[K]))this.routers.push(w[K]);for(let K of w)if(!this.routers.includes(K))this.routers.push(K);return this}execute(){let w=new Map;for(let K of this.routers){let W=K.execute();for(let[J,P]of W.entries())w.set(`/${U2.thinPrefix(`${this.prefix}/${J}`)}`,P)}return w}static thinPrefix(w){return w.replace(new RegExp("[/]{2,}","g"),"/").replace(new RegExp("^[/]|[/]$","g"),"")}}class l4{classConstructor;options;#w;#K;#J=new Map;#I;#G=900;#D;#b=new aK;constructor(w,K){this.classConstructor=w,this.options=K;let W=Reflect.getOwnMetadataKeys(w);if(!W.includes(o2)&&!W.includes(IK))throw Error(`Can not detect! ${w.name} class is not a container or module.`);this.#K=!W.includes(o2)?"MODULE":"CONTAINER",this.#G=typeof K.static?.cacheTimeInSeconds!=="number"?900:K.static.cacheTimeInSeconds,this.#I=Object.freeze({allowLogsMethods:this.options?.log?.methods||[],staticOption:this.options.static,allowOrigins:!this.options.cors?.origins?["*"]:typeof this.options.cors.origins!=="string"?this.options.cors.origins.includes("*")||this.options.cors.origins.length<1?["*"]:this.options.cors.origins:[this.options.cors.origins!=="*"?this.options.cors.origins:"*"],allowMethods:this.options.cors?.methods||u4,allowCredentials:!this.options.cors?.credentials?!1:!0,allowHeaders:!this.options.cors?.headers||this.options.cors.headers.includes("*")?["*"]:this.options.cors.headers,pipelineStrategy:(()=>{switch(K.pipelineStrategy?.type){case"SIMPLE":return Object.freeze({startMiddlewares:"FIFO",endMiddlewares:K.pipelineStrategy.targets?.middlewares||"FIFO",openInterceptors:"FIFO",closeInterceptors:K.pipelineStrategy.targets?.interceptors||"FIFO"});default:return Object.freeze({startMiddlewares:"FIFO",endMiddlewares:"FIFO",openInterceptors:"FIFO",closeInterceptors:"FIFO"})}})()})}static async create(w,K){let W=new l4(w,K);return await W.preLaunch(),W}useValidator(w){this.#D=w}async preLaunch(){if(this.#w)return this.#w;let{startMiddlewareHandlers:w,endMiddlewareHandlers:K,controllerRouterGroup:W,webSocketHttpRouterGroup:J,webSocketRouterGroup:P}=this.#K!=="MODULE"?await this.#S({containerClass:this.classConstructor,prefix:this.options.prefix,options:this.options}):await this.#A({moduleClass:this.classConstructor,prefix:this.options.prefix,options:this.options}),I=new Map,b=P.execute();for(let[D,A]of b.entries())I.set(D,A);return this.#w=Object.freeze({startMiddlewareHandlers:w,endMiddlewareHandlers:K,controllerRouterGroup:W,webSocketHttpRouterGroup:J,webSocketRouterGroup:P,webSocketsMap:I}),this.#w}async listen(){let w=r0({port:this.options.port,idleTimeout:typeof this.options.idleTimeoutInSeconds!=="number"||this.options.idleTimeoutInSeconds<=0?void 0:this.options.idleTimeoutInSeconds,fetch:this.#M.bind(this),websocket:await this.#O.bind(this)()});this.#b.set(Rw,w)}async#M(w,K){let{allowLogsMethods:W,allowOrigins:J,allowMethods:P,allowHeaders:I,allowCredentials:b,staticOption:D}=this.#I,{startMiddlewareHandlers:A,endMiddlewareHandlers:M,controllerRouterGroup:N,webSocketHttpRouterGroup:Q}=await this.preLaunch(),B=performance.now(),L=new URL(w.url),g=c0.parse(L.searchParams.toString(),this.options.queryParser),O=w.headers.get("origin")||"*",v=w.method.toUpperCase(),G=new Headers,u=new aK().setOptions({isStatic:!0}).set(G2,K).set(M2,w).set(A2,w.headers).set(sw,G).set(j4,g);try{if([...!b?[]:[{key:"Access-Control-Allow-Credentials",value:"true"}],{key:"Access-Control-Allow-Origin",value:J.includes("*")?"*":!J.includes(O)?J[0]:O},{key:"Access-Control-Allow-Methods",value:P.join(", ")},{key:"Access-Control-Allow-Headers",value:I.join(", ")}].forEach(({key:o,value:z})=>G.set(o,z)),!u0(v)||!P.includes(v))return this.finalizeResponse(new Response(void 0,{...Yw.clientErrorStatuses.METHOD_NOT_ALLOWED,headers:G}));if(_0(w))return await this.#B({request:w,server:K,context:u,url:L,query:g,method:v,responseHeaders:G,httpRouterGroup:Q,startMiddlewareHandlers:A,endMiddlewareHandlers:M});if(w.method.toUpperCase()==="OPTIONS")return this.finalizeResponse(J.includes("*")||J.includes(O)?new Response(void 0,{...Yw.successfulStatuses.NO_CONTENT,headers:G}):new Response(void 0,{...Yw.clientErrorStatuses.EXPECTATION_FAILED,headers:G}));if(D){let o=await this.#N({url:L,responseHeaders:G,path:D.path,headers:D.headers,cacheTimeInSeconds:D.cacheTimeInSeconds});if(o instanceof Response)return o}return await this.#Q({url:L,method:v,context:u,httpRouterGroup:N,startMiddlewareHandlers:A,endMiddlewareHandlers:M})}catch(o){return this.options.debug&&console.error(o),this.finalizeResponse(y0(o,G))}finally{if(W){let o=performance.now(),z=u.get(V2,{isStatic:!1}),Z=typeof z!=="number"||!z?0:z,x=pw(L.pathname,{color:"blue"}),r=`${Bun.color("yellow","ansi")}${process.pid}`,E=pw(` ${w.method} `,{color:"yellow",backgroundColor:"blue"}),X=pw(`${w.headers.get("x-forwarded-for")||w.headers.get("x-real-ip")||K.requestIP(w)?.address||"<Unknown>"}`,{color:"yellow"}),U=pw(` ${Math.round((o-B+Number.EPSILON)*100)/100}ms `,{color:"yellow",backgroundColor:"blue"}),q=pw(` ${Z} (${MK(Z)}) `,(()=>{if(Z>=100&&Z<200)return{color:"white",backgroundColor:"cyan"};else if(Z>=200&&Z<300)return{color:"white",backgroundColor:"blue"};else if(Z>=300&&Z<400)return{color:"black",backgroundColor:"magenta"};else if(Z>=400&&Z<500)return{color:"black",backgroundColor:"yellow"};else if(Z>=500&&Z<600)return{color:"white",backgroundColor:"red"};else return{color:"black",backgroundColor:"gray"}})());W.includes(w.method.toUpperCase())&&console.info([`PID: ${r}`,`Method: ${E}`,`IP: ${X}`,x,`Time: ${U}`,typeof z!=="number"||!z?void 0:q].filter((c)=>!!c?.trim()).join(" - "))}}}async#O(){let{webSocketsMap:w}=await this.preLaunch();return{open:(K)=>{let W=`${K.data.pathname}:::open`,J=w.get(W);if(!J)return;let P=J.arguments||{},I=[];for(let[,b]of Object.entries(P))switch(b.type){case D2:I[b.index]=K;break;case Rw:I[b.index]=this.#b.get(Rw);break}J.descriptor.value(...I)},close:(K,W,J)=>{let P=`${K.data.pathname}:::close`,I=w.get(P);if(!I)return;let b=I.arguments||{},D=[];for(let[,A]of Object.entries(b))switch(A.type){case D2:D[A.index]=K;break;case R4:D[A.index]=W;break;case v4:D[A.index]=J;break;case Rw:D[A.index]=this.#b.get(Rw);break}I.descriptor.value(...D)},message:(K,W)=>{let J=`${K.data.pathname}:::message`,P=w.get(J);if(!P)return;let I=P.arguments||{},b=[];for(let[,D]of Object.entries(I))switch(D.type){case D2:b[D.index]=K;break;case bK:b[D.index]=W;break;case Rw:b[D.index]=this.#b.get(Rw);break}P.descriptor.value(...b)},drain:(K)=>{let W=`${K.data.pathname}:::drain`,J=w.get(W);if(!J)return;let P=J.arguments||{},I=[];for(let[,b]of Object.entries(P))switch(b.type){case D2:I[b.index]=K;break;case Rw:I[b.index]=this.#b.get(Rw);break}J.descriptor.value(...I)},ping:(K,W)=>{let J=`${K.data.pathname}:::ping`,P=w.get(J);if(!P)return;let I=P.arguments||{},b=[];for(let[,D]of Object.entries(I))switch(D.type){case D2:b[D.index]=K;break;case bK:b[D.index]=W;break;case Rw:b[D.index]=this.#b.get(Rw);break}P.descriptor.value(...b)},pong:(K,W)=>{let J=`${K.data.pathname}:::pong`,P=w.get(J);if(!P)return;let I=P.arguments||{},b=[];for(let[,D]of Object.entries(I))switch(D.type){case D2:b[D.index]=K;break;case bK:b[D.index]=W;break;case Rw:b[D.index]=this.#b.get(Rw);break}P.descriptor.value(...b)}}}async#B({request:w,server:K,context:W,url:J,query:P,method:I,responseHeaders:b,httpRouterGroup:D,startMiddlewareHandlers:A,endMiddlewareHandlers:M}){try{await this.#P({type:"START_MIDDLEWARES",handlers:A,context:W});let N=D.find({pathname:J.pathname,method:I}),Q=this.finalizeResponse(new Response(void 0,{...Yw.serverErrorStatuses.INTERNAL_SERVER_ERROR,headers:b}));if(N){let B=await this.#P({type:"GUARDS",handlers:N.guardHandlers,context:W});if(B!==!0)Q=this.finalizeResponse(new Response(void 0,{...!B||B==="UNAUTHORIZATION"?Yw.clientErrorStatuses.UNAUTHORIZED:Yw.clientErrorStatuses.FORBIDDEN,headers:b}));else{W.set(fw,N.model),await this.#P({type:"OPEN_INTERCEPTORS",handlers:N.openInterceptorHandlers,context:W});let L=await N.model.func(...[K,w,P]);if(await this.#P({type:"CLOSE_INTERCEPTORS",handlers:N.closeInterceptorHandlers,context:W}),typeof L!=="boolean"||!L)Q=this.finalizeResponse(new Response(void 0,{...Yw.serverErrorStatuses.INTERNAL_SERVER_ERROR,headers:b}));else Q=void 0}}return await this.#P({type:"END_MIDDLEWARES",handlers:M,context:W}),Q}catch(N){throw console.error(N),N}}async#N({url:w,path:K,headers:W,cacheTimeInSeconds:J,responseHeaders:P}){let I=`${K}/${w.pathname}`,b=this.#J.get(I);if(!b){let D=Bun.file(I);if(await D.exists()){if(W)for(let[A,M]of Object.entries(W))P.set(A,M);return P.set("Content-Type",D.type),this.finalizeResponse(new Response(await D.arrayBuffer(),{...Yw.successfulStatuses.OK,headers:P}))}}else{let D=new Date>b.expiredAt;if(D)this.#J.delete(I);let A=!D?b.file:Bun.file(I);if(await A.exists()){if(this.#J.set(I,Object.freeze({expiredAt:x0(new Date,this.#G,cw.seconds),file:A})),W)for(let[M,N]of Object.entries(W))P.set(M,N);return P.set("Content-Type",A.type),this.finalizeResponse(new Response(await A.arrayBuffer(),{...Yw.successfulStatuses.OK,headers:P}))}}}async#Q({context:w,url:K,method:W,httpRouterGroup:J,startMiddlewareHandlers:P=[],endMiddlewareHandlers:I=[]}){let b={isStatic:!0};w.setOptions(b),await this.#P({type:"START_MIDDLEWARES",handlers:P,context:w});let D=J.find({pathname:K.pathname,method:W});if(!D)w.setOptions({isStatic:!1}).set(V2,Yw.clientErrorStatuses.NOT_FOUND.status).set(_2,Yw.clientErrorStatuses.NOT_FOUND.statusText).set(r2,void 0);else{w.set(fw,D.model),w.set(tK,D.parameters);let B=await this.#P({type:"GUARDS",handlers:D.guardHandlers,context:w});if(B!==!0)w.setOptions({isStatic:!1}).set(V2,!B||B==="UNAUTHORIZATION"?Yw.clientErrorStatuses.UNAUTHORIZED.status:Yw.clientErrorStatuses.FORBIDDEN.status).set(_2,!B||B==="UNAUTHORIZATION"?Yw.clientErrorStatuses.UNAUTHORIZED.statusText:Yw.clientErrorStatuses.FORBIDDEN.statusText).set(r2,void 0);else await this.#P({type:"OPEN_INTERCEPTORS",handlers:D.openInterceptorHandlers,context:w}),await this.#P({type:"CONTROLLER",context:w}),await this.#P({type:"CLOSE_INTERCEPTORS",handlers:D.closeInterceptorHandlers,context:w})}await this.#P({type:"END_MIDDLEWARES",handlers:I,context:w});let A=w.get(sw,{isStatic:!0})||new Headers,M=w.get(r2,{isStatic:!1})||void 0,N=w.get(V2,{isStatic:!1}),Q=w.get(_2,{isStatic:!1});return this.serializeResponse({status:typeof N!=="number"?W==="POST"?201:void 0:N,statusText:typeof Q!=="string"?void 0:Q,headers:A,data:M})}async#S({prefix:w="",startMiddlewareHandlers:K=[],endMiddlewareHandlers:W=[],guardHandlers:J=[],openInterceptorHandlers:P=[],closeInterceptorHandlers:I=[],controllerRouterGroup:b=new O2,webSocketHttpRouterGroup:D=new O2,webSocketRouterGroup:A=new U2,containerClass:M,options:N,extendInjector:Q}){if(!Reflect.getOwnMetadataKeys(M).includes(o2))throw Error(`[${M.name}] is not a container.`);let B=!Q?new B2:new B2(Q),L=Reflect.getOwnMetadata(o2,M),{loaders:g,middlewares:O,dependencies:v,modules:G,guards:u,interceptors:o,prefix:z,config:Z}=L||{},{config:x}=Object.freeze({config:{...typeof N.config!=="function"?N.config:await N.config(),...typeof Z!=="function"?typeof Z!=="object"?void 0:("key"in Z)&&("value"in Z)&&typeof Z.key==="symbol"?typeof Z.value!=="function"?Z.value:await Z.value():Z:await Z()}});if(B.set(Z&&"key"in Z&&"value"in Z&&typeof Z.key==="symbol"?Z.key:nK,x),g){let r=[];for(let[X,U]of Object.entries(g))r.push(async()=>{try{let q=await U({config:x});return console.info(`${pw(" INFO ",{color:"white",backgroundColor:"blue",bold:!0})} Loader [${X}] initialized successfully.`),q}catch(q){throw console.error(`${pw(" WARN ",{color:"yellow",backgroundColor:"red",bold:!0})} Loader [${X}] initialization failed.`),N.debug&&console.error(q),q}});let E=await Promise.all(r.map((X)=>X()));for(let[X,U]of E)B.set(X,U)}if(v){for(let r of v)if(!B.get(r))throw Error(`Can not collect dependency [${r.name}].`)}if(O){let r=(E,X)=>!!E;for(let E of O){let X=B.get(E);if(!X||!r(X,E))throw Error(`Can not collect middleware [${E.name}].`);if(X.start&&typeof X.start==="function"){let U=Reflect.getOwnMetadata(Xw,E,"start")||{};K.push(Object.freeze({class:E,funcName:"start",func:X.start.bind(X),argumentsMetadata:U}))}if(X.end&&typeof X.end==="function"){let U=Reflect.getOwnMetadata(Xw,E,"end")||{};W.push(Object.freeze({class:E,funcName:"end",func:X.end.bind(X),argumentsMetadata:U}))}}}if(u){let r=(E,X)=>!!E;for(let E of u){let X=B.get(E);if(!X||!r(X,E))throw Error(`Can not collect guard [${E.name}].`);let U=Reflect.getOwnMetadata(Xw,E,"enforce")||{};J.push(Object.freeze({class:E,funcName:"enforce",func:X.enforce.bind(X),argumentsMetadata:U}))}}if(o){let r=(E,X)=>!!E;for(let E of o){let X=B.get(E);if(!X||!r(X,E))throw Error(`Can not collect interceptor [${E.name}].`);if(X){if(X.open&&typeof X.open==="function"){let U=Reflect.getOwnMetadata(Xw,E,"open")||{};P.push(Object.freeze({class:E,funcName:"open",func:X.open.bind(X),argumentsMetadata:U}))}if(X.close&&typeof X.close==="function"){let U=Reflect.getOwnMetadata(Xw,E,"close")||{};I.push(Object.freeze({class:E,funcName:"close",func:X.close.bind(X),argumentsMetadata:U}))}}}}if(G){let r=[w.trim(),z?.trim()||""].filter((E)=>E.length>0).join("/");for(let E of G)try{await this.#A({prefix:r,moduleClass:E,extendInjector:B,options:N,startMiddlewareHandlers:K,endMiddlewareHandlers:W,guardHandlers:[...J],openInterceptorHandlers:[...P],closeInterceptorHandlers:[...I],controllerRouterGroup:b,webSocketHttpRouterGroup:D,webSocketRouterGroup:A})}catch(X){throw console.group(`Can not resolve module: [${E.name}].`),console.error(X),console.groupEnd(),X}}return Object.freeze({startMiddlewareHandlers:K,endMiddlewareHandlers:W,controllerRouterGroup:b,webSocketHttpRouterGroup:D,webSocketRouterGroup:A})}async#A({prefix:w="",startMiddlewareHandlers:K=[],endMiddlewareHandlers:W=[],guardHandlers:J=[],openInterceptorHandlers:P=[],closeInterceptorHandlers:I=[],controllerRouterGroup:b=new O2,webSocketHttpRouterGroup:D=new O2,webSocketRouterGroup:A=new U2,moduleClass:M,options:N,extendInjector:Q}){if(!Reflect.getOwnMetadataKeys(M).includes(IK))throw Error(`[${M.name}] is not a module.`);let B=!Q?new B2:new B2(Q),L=Reflect.getOwnMetadata(IK,M),{loaders:g,middlewares:O,guards:v,interceptors:G,controllers:u,dependencies:o,webSockets:z,prefix:Z,config:x}=L||{},r=[w.trim(),Z?.trim()||""].filter((X)=>X.length>0).join("/"),{config:E}=Object.freeze({config:!x?void 0:{...typeof N.config!=="function"?N.config:await N.config(),...typeof x!=="function"?typeof x!=="object"?void 0:("key"in x)&&("value"in x)&&typeof x.key==="symbol"?typeof x.value!=="function"?x.value:await x.value():x:await x()}});if(E&&B.set(x&&"key"in x&&"value"in x&&typeof x.key==="symbol"?x.key:nK,E),g){let X=[];for(let[q,c]of Object.entries(g))X.push(async()=>{try{let T=await c({config:E});return console.info(`${pw(" INFO ",{color:"white",backgroundColor:"blue",bold:!0})} Loader [${q}] initialized successfully.`),T}catch(T){throw console.error(`${pw(" WARN ",{color:"yellow",backgroundColor:"red",bold:!0})} Loader [${q}] initialization failed.`),N.debug&&console.error(T),T}});let U=await Promise.all(X.map((q)=>q()));for(let q=0;q<U.length;q++){let[c,T]=U[q];B.set(c,T)}}if(o){for(let X of o)if(!B.get(X))throw Error(`Can not collect dependency [${X.name}].`)}if(O){let X=(U,q)=>!!U;for(let U of O){let q=B.get(U);if(!q||!X(q,U))throw Error(`Can not collect middleware [${U.name}].`);if(q.start&&typeof q.start==="function"){let c=Reflect.getOwnMetadata(Xw,U,"start")||{};K.push(Object.freeze({class:U,funcName:"start",func:q.start.bind(q),argumentsMetadata:c}))}if(q.end&&typeof q.end==="function"){let c=Reflect.getOwnMetadata(Xw,U,"end")||{};W.push(Object.freeze({class:U,funcName:"end",func:q.end.bind(q),argumentsMetadata:c}))}}}if(v){let X=(U,q)=>!!U;for(let U of v){let q=B.get(U);if(!q||!X(q,U))throw Error(`Can not collect guard [${U.name}].`);let c=Reflect.getOwnMetadata(Xw,U,"enforce")||{};J.push(Object.freeze({class:U,funcName:"enforce",func:q.enforce.bind(q),argumentsMetadata:c}))}}if(G){let X=(U,q)=>!!U;for(let U of G){let q=B.get(U);if(!q||!X(q,U))throw Error(`Can not collect interceptor [${U.name}].`);if(q){if(q.open&&typeof q.open==="function"){let c=Reflect.getOwnMetadata(Xw,U,"open")||{};P.push(Object.freeze({class:U,funcName:"open",func:q.open.bind(q),argumentsMetadata:c}))}if(q.close&&typeof q.close==="function"){let c=Reflect.getOwnMetadata(Xw,U,"close")||{};I.push(Object.freeze({class:U,funcName:"close",func:q.close.bind(q),argumentsMetadata:c}))}}}}if(u)for(let X of u)this.#$({controllerConstructor:X,prefix:r,injector:B,httpRouterGroup:b,guardHandlers:[...J],openInterceptorHandlers:[...P],closeInterceptorHandlers:[...I]});if(z)for(let X of z)this.#Y({webSocketConstructor:X,injector:B,prefix:r,webSocketHttpRouterGroup:D,webSocketRouterGroup:A});return Object.freeze({startMiddlewareHandlers:K,endMiddlewareHandlers:W,controllerRouterGroup:b,webSocketHttpRouterGroup:D,webSocketRouterGroup:A})}#$({controllerConstructor:w,prefix:K="",injector:W=new B2,httpRouterGroup:J=new O2,guardHandlers:P=[],openInterceptorHandlers:I=[],closeInterceptorHandlers:b=[]}){if(!Reflect.getOwnMetadataKeys(w).includes(DK))throw Error(`[${w.name}] is not a controller.`);let D=W.get(w);if(!D)throw Error("Can not initialize controller.");let A=Reflect.getOwnMetadata(DK,w)||{prefix:"/",httpMetadata:[]},M=[K.trim(),A.prefix.trim()].filter((Q)=>Q.length>0).join("/"),N=new sK({alias:M,guardHandlers:P,openInterceptorHandlers:I,closeInterceptorHandlers:b});for(let Q of A.httpMetadata){if(typeof Q.descriptor.value!=="function")continue;let B=N.route({alias:Q.path}),L=Q.descriptor.value.bind(D),g=Object.freeze({class:w,funcName:Q.methodName,func:L,argumentsMetadata:Q.argumentsMetadata});switch(Q.httpMethod){case"GET":B.get({model:g});break;case"POST":B.post({model:g});break;case"PUT":B.put({model:g});break;case"PATCH":B.patch({model:g});break;case"DELETE":B.delete({model:g});break;case"OPTIONS":B.options({model:g});break}}return J.add(N)}async#W({data:w,validationSchema:K,argumentIndex:W,funcName:J}){if(!this.#D)return w;try{let P=await this.#D.validate(w,K,W,J);if(!(P instanceof m4))return P;throw new OK({httpCode:400,message:`Validation at the [${J.toString()}] method fails at positional argument [${W}].`,data:P.error})}catch(P){if(P instanceof OK)throw P;throw new I1({httpCode:500,message:`Validation at the [${J.toString()}] method error at positional argument [${W}].`,data:!(P instanceof Error)?P:[{message:P.message,code:P.name,cause:P.cause}]})}}#Y({webSocketConstructor:w,prefix:K="",injector:W=new B2,webSocketHttpRouterGroup:J=new O2,webSocketRouterGroup:P=new U2,guardHandlers:I=[],openInterceptorHandlers:b=[],closeInterceptorHandlers:D=[]}){if(!Reflect.getOwnMetadataKeys(w).includes(AK))throw Error(`[${w.name}] is not a websocket route.`);let A=W.get(w);if(!A)throw Error("Can not initialize webSocket.");let M=Reflect.getOwnMetadata(AK,w)||{prefix:"/",events:[],http:[]},N=`/${K}/${M.prefix}`,Q=new sK({alias:N,guardHandlers:I,openInterceptorHandlers:b,closeInterceptorHandlers:D});for(let[L,g]of Object.entries(M.http)){if(typeof g.descriptor?.value!=="function")continue;let O=Q.route({alias:g.path}),v=g.descriptor.value.bind(A),G=Object.freeze({class:w,funcName:g.methodName,func:v,argumentsMetadata:g.argumentsMetadata});switch(g.httpMethod){case"GET":O.get({model:G});break;case"POST":O.post({model:G});break}}J.add(Q);let B=new b1(N);for(let[L,g]of Object.entries(M.events)){let O=new T4({eventName:L,metadata:g});B.addRoutes(O)}return B.bind(A),P.addRouters(B),Object.freeze({webSocketHttpRouterGroup:J,webSocketRouterGroup:P})}async#P({type:w,handlers:K,context:W}){let J={isStatic:!0};W.setOptions(J);let P=W.get(G2,J)||void 0,I=W.get(M2,J)||void 0,b=W.get(A2,J)||void 0,D=W.get(sw,J)||void 0,A=W.get(tK,J)||void 0,M=W.get(fw,J)||void 0;if(w==="START_MIDDLEWARES"||w==="END_MIDDLEWARES"){let N=w==="START_MIDDLEWARES"?this.#I.pipelineStrategy.startMiddlewares:this.#I.pipelineStrategy.endMiddlewares;for(let Q=N==="FIFO"?0:K.length-1;N==="FIFO"?Q<K.length:Q>-1;N==="FIFO"?Q++:Q--){let B=[],{func:L,funcName:g,argumentsMetadata:O}=K[Q];for(let[v,G]of Object.entries(O))switch(G.type){case E2:B[G.index]=!G.key?W:W.get(G.key,J);break;case M2:B[G.index]=I;break;case x2:B[G.index]=!G.validationSchema?await I?.[G.parser||"json"]():await this.#W({data:await I?.[G.parser||"json"](),validationSchema:G.validationSchema,argumentIndex:G.index,funcName:g});break;case L2:B[G.index]=!G.validationSchema?b:await this.#W({data:b?.toJSON(),validationSchema:G.validationSchema,argumentIndex:G.index,funcName:g});break;case A2:B[G.index]=!G.validationSchema?b?.get(G.key)||void 0:await this.#W({data:b?.get(G.key)||void 0,validationSchema:G.validationSchema,argumentIndex:G.index,funcName:g});break;case c2:B[G.index]=!G.validationSchema?A?.[G.key]||void 0:await this.#W({data:A?.[G.key]||void 0,validationSchema:G.validationSchema,argumentIndex:G.index,funcName:g});break;case fw:B[G.index]=void 0;break;case sw:B[G.index]=D;break;case G2:B[G.index]=P;break;default:B[G.index]=!G.validationSchema?W.get(G.type,J):await this.#W({data:W.get(G.type,J),validationSchema:G.validationSchema,argumentIndex:G.index,funcName:g});break}await L(...B)}}else if(w==="GUARDS"){if(!M||K.length===0)return!0;for(let N=0;N<K.length;N++){let Q=[],{func:B,funcName:L,argumentsMetadata:g}=K[N];for(let[v,G]of Object.entries(g))switch(G.type){case M2:Q[G.index]=I;break;case x2:Q[G.index]=!G.validationSchema?await I?.[G.parser||"json"]():await this.#W({data:await I?.[G.parser||"json"](),validationSchema:G.validationSchema,argumentIndex:G.index,funcName:L});break;case E2:Q[G.index]=!G.key?W:W.get(G.key);break;case L2:Q[G.index]=!G.validationSchema?b:await this.#W({data:b?.toJSON(),validationSchema:G.validationSchema,argumentIndex:G.index,funcName:L});break;case sw:Q[G.index]=D;break;case A2:Q[G.index]=!G.validationSchema?b?.get(G.key)||void 0:await this.#W({data:b?.get(G.key)||void 0,validationSchema:G.validationSchema,argumentIndex:G.index,funcName:L});break;case c2:Q[G.index]=!G.validationSchema?A?.[G.key]||void 0:await this.#W({data:A?.[G.key],validationSchema:G.validationSchema,argumentIndex:G.index,funcName:L});break;case fw:Q[G.index]=M;break;case G2:Q[G.index]=P;break;default:Q[G.index]=!G.validationSchema?W.get(G.type):await this.#W({data:W.get(G.type),validationSchema:G.validationSchema,argumentIndex:G.index,funcName:L});break}let O=await B(...Q);if(O!==!0)return O}return!0}else if(w==="OPEN_INTERCEPTORS"||w==="CLOSE_INTERCEPTORS"){if(!M)return;let N=w==="OPEN_INTERCEPTORS"?this.#I.pipelineStrategy.openInterceptors:this.#I.pipelineStrategy.closeInterceptors;for(let Q=N==="FIFO"?0:K.length-1;N==="FIFO"?Q<K.length:Q>-1;N==="FIFO"?Q++:Q--){let B=[],{func:L,funcName:g,argumentsMetadata:O}=K[Q];for(let[v,G]of Object.entries(O))switch(G.type){case M2:B[G.index]=I;break;case x2:B[G.index]=!G.validationSchema?await I?.[G.parser||"json"]():await this.#W({data:await I?.[G.parser||"json"](),validationSchema:G.validationSchema,argumentIndex:G.index,funcName:g});break;case E2:B[G.index]=!G.key?W:W.get(G.key);break;case L2:B[G.index]=!G.validationSchema?b:await this.#W({data:b?.toJSON(),validationSchema:G.validationSchema,argumentIndex:G.index,funcName:g});break;case A2:B[G.index]=!G.validationSchema?b?.get(G.key)||void 0:await this.#W({data:b?.get(G.key)||void 0,validationSchema:G.validationSchema,argumentIndex:G.index,funcName:g});break;case sw:B[G.index]=D;break;case c2:B[G.index]=!G.validationSchema?A?.[G.key]||void 0:await this.#W({data:A?.[G.key]||void 0,validationSchema:G.validationSchema,argumentIndex:G.index,funcName:g});break;case fw:B[G.index]=M;break;case G2:B[G.index]=P;break;default:B[G.index]=!G.validationSchema?W.get(G.type):await this.#W({data:W.get(G.type),validationSchema:G.validationSchema,argumentIndex:G.index,funcName:g});break}await L(...B)}}else if(w==="CONTROLLER"){if(!M){W.setOptions({isStatic:!1}).set(V2,404).set(_2,"Not found.");return}let N=[],{func:Q,funcName:B,argumentsMetadata:L}=M;for(let[g,O]of Object.entries(L))switch(O.type){case M2:N[O.index]=I;break;case x2:N[O.index]=!O.validationSchema?await I?.[O.parser||"json"]():await this.#W({data:await I?.[O.parser||"json"](),validationSchema:O.validationSchema,argumentIndex:O.index,funcName:B});break;case E2:N[O.index]=!O.key?W:W.get(O.key);break;case L2:N[O.index]=!O.validationSchema?b:await this.#W({data:b?.toJSON(),validationSchema:O.validationSchema,argumentIndex:O.index,funcName:B});break;case A2:N[O.index]=!O.validationSchema?b?.get(O.key)||void 0:await this.#W({data:b?.get(O.key)||void 0,validationSchema:O.validationSchema,argumentIndex:O.index,funcName:B});break;case sw:N[O.index]=D;break;case c2:N[O.index]=!O.validationSchema?A?.[O.key]||void 0:await this.#W({data:A?.[O.key]||void 0,validationSchema:O.validationSchema,argumentIndex:O.index,funcName:B});break;case fw:N[O.index]=M;break;case G2:N[O.index]=P;break;default:N[O.index]=!O.validationSchema?W.get(O.type):await this.#W({data:W.get(O.type),validationSchema:O.validationSchema,argumentIndex:O.index,funcName:B});break}W.set(r2,await Q(...N),{isStatic:!1})}return}serializeResponse({status:w,statusText:K,headers:W,data:J}){let P=W.get("Content-Type")||"text/plain",I=!w?!J?204:200:w,b=MK(I);if(P.includes("application/json"))return this.finalizeResponse(new Response(!J?void 0:J instanceof ReadableStream?J:JSON.stringify(J),{status:I,statusText:b,headers:W}));if(P.includes("text/plain")||P.includes("text/html"))return this.finalizeResponse(new Response(!J?void 0:J instanceof ReadableStream?J:String(J),{status:I,statusText:b,headers:W}));if(P.includes("application/octet-stream")){if(J instanceof Uint8Array||J instanceof ArrayBuffer||J instanceof Blob||J instanceof ReadableStream)return this.finalizeResponse(new Response(J,{status:I,statusText:b,headers:W}));throw Error("Invalid data type for application/octet-stream")}if(P.includes("multipart/form-data")){if(J instanceof FormData)return this.finalizeResponse(new Response(J,{status:I,statusText:b,headers:W}));throw Error("multipart/form-data requires FormData object")}return this.finalizeResponse(new Response(!J?void 0:String(J),{status:I,statusText:b,headers:W}))}finalizeResponse(w){return w.headers.set("X-Powered-By","Bool Typescript"),w}}var bJ=BK(w1(),1);var T0=()=>SK(hw.authState);var l0=()=>(w)=>{Reflect.defineMetadata(hw.guardMetadata,void 0,w)};var D1=Object.freeze({status:"aborted"});function h(w,K,W){function J(D,A){if(!D._zod)Object.defineProperty(D,"_zod",{value:{def:A,constr:b,traits:new Set},enumerable:!1});if(D._zod.traits.has(w))return;D._zod.traits.add(w),K(D,A);let M=b.prototype,N=Object.keys(M);for(let Q=0;Q<N.length;Q++){let B=N[Q];if(!(B in D))D[B]=M[B].bind(D)}}let P=W?.Parent??Object;class I extends P{}Object.defineProperty(I,"name",{value:w});function b(D){var A;let M=W?.Parent?new I:this;J(M,D),(A=M._zod).deferred??(A.deferred=[]);for(let N of M._zod.deferred)N();return M}return Object.defineProperty(b,"init",{value:J}),Object.defineProperty(b,Symbol.hasInstance,{value:(D)=>{if(W?.Parent&&D instanceof W.Parent)return!0;return D?._zod?.traits?.has(w)}}),Object.defineProperty(b,"name",{value:w}),b}var p0=Symbol("zod_brand");class ew extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class u2 extends Error{constructor(w){super(`Encountered unidirectional transform during encode: ${w}`);this.name="ZodEncodeError"}}var $K={};function gw(w){if(w)Object.assign($K,w);return $K}var bw={};eK(bw,{unwrapMessage:()=>y2,uint8ArrayToHex:()=>$9,uint8ArrayToBase64url:()=>Q9,uint8ArrayToBase64:()=>s4,stringifyPrimitive:()=>LK,slugify:()=>A1,shallowClone:()=>e4,safeExtend:()=>G9,required:()=>O9,randomString:()=>K9,propertyKeyTypes:()=>O1,promiseAllObject:()=>w9,primitiveTypes:()=>i4,prefixIssues:()=>f2,pick:()=>I9,partial:()=>M9,parsedType:()=>N1,optionalKeys:()=>B1,omit:()=>b9,objectClone:()=>t0,numKeys:()=>W9,nullish:()=>l2,normalizeParams:()=>e,mergeDefs:()=>iw,merge:()=>A9,jsonStringifyReplacer:()=>h2,joinValues:()=>YK,issue:()=>F2,isPlainObject:()=>N2,isObject:()=>q2,hexToUint8Array:()=>S9,getSizableOrigin:()=>t4,getParsedType:()=>J9,getLengthableOrigin:()=>e2,getEnumValues:()=>m2,getElementAtPath:()=>s0,floatSafeRemainder:()=>f4,finalizeIssue:()=>mw,extend:()=>D9,escapeRegex:()=>Q2,esc:()=>XK,defineLazy:()=>Iw,createTransparentProxy:()=>P9,cloneDef:()=>a0,clone:()=>Cw,cleanRegex:()=>p2,cleanEnum:()=>B9,captureStackTrace:()=>VK,cached:()=>T2,base64urlToUint8Array:()=>N9,base64ToUint8Array:()=>a4,assignProp:()=>w2,assertNotEqual:()=>e0,assertNever:()=>d0,assertIs:()=>i0,assertEqual:()=>f0,assert:()=>n0,allowsEval:()=>M1,aborted:()=>K2,NUMBER_FORMAT_RANGES:()=>d4,Class:()=>w6,BIGINT_FORMAT_RANGES:()=>n4});function f0(w){return w}function e0(w){return w}function i0(w){}function d0(w){throw Error("Unexpected value in exhaustive check")}function n0(w){}function m2(w){let K=Object.values(w).filter((J)=>typeof J==="number");return Object.entries(w).filter(([J,P])=>K.indexOf(+J)===-1).map(([J,P])=>P)}function YK(w,K="|"){return w.map((W)=>LK(W)).join(K)}function h2(w,K){if(typeof K==="bigint")return K.toString();return K}function T2(w){return{get value(){{let W=w();return Object.defineProperty(this,"value",{value:W}),W}throw Error("cached value already set")}}}function l2(w){return w===null||w===void 0}function p2(w){let K=w.startsWith("^")?1:0,W=w.endsWith("$")?w.length-1:w.length;return w.slice(K,W)}function f4(w,K){let W=(w.toString().split(".")[1]||"").length,J=K.toString(),P=(J.split(".")[1]||"").length;if(P===0&&/\d?e-\d?/.test(J)){let A=J.match(/\d?e-(\d?)/);if(A?.[1])P=Number.parseInt(A[1])}let I=W>P?W:P,b=Number.parseInt(w.toFixed(I).replace(".","")),D=Number.parseInt(K.toFixed(I).replace(".",""));return b%D/10**I}var p4=Symbol("evaluating");function Iw(w,K,W){let J=void 0;Object.defineProperty(w,K,{get(){if(J===p4)return;if(J===void 0)J=p4,J=W();return J},set(P){Object.defineProperty(w,K,{value:P})},configurable:!0})}function t0(w){return Object.create(Object.getPrototypeOf(w),Object.getOwnPropertyDescriptors(w))}function w2(w,K,W){Object.defineProperty(w,K,{value:W,writable:!0,enumerable:!0,configurable:!0})}function iw(...w){let K={};for(let W of w){let J=Object.getOwnPropertyDescriptors(W);Object.assign(K,J)}return Object.defineProperties({},K)}function a0(w){return iw(w._zod.def)}function s0(w,K){if(!K)return w;return K.reduce((W,J)=>W?.[J],w)}function w9(w){let K=Object.keys(w),W=K.map((J)=>w[J]);return Promise.all(W).then((J)=>{let P={};for(let I=0;I<K.length;I++)P[K[I]]=J[I];return P})}function K9(w=10){let W="";for(let J=0;J<w;J++)W+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return W}function XK(w){return JSON.stringify(w)}function A1(w){return w.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var VK="captureStackTrace"in Error?Error.captureStackTrace:(...w)=>{};function q2(w){return typeof w==="object"&&w!==null&&!Array.isArray(w)}var M1=T2(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(w){return!1}});function N2(w){if(q2(w)===!1)return!1;let K=w.constructor;if(K===void 0)return!0;if(typeof K!=="function")return!0;let W=K.prototype;if(q2(W)===!1)return!1;if(Object.prototype.hasOwnProperty.call(W,"isPrototypeOf")===!1)return!1;return!0}function e4(w){if(N2(w))return{...w};if(Array.isArray(w))return[...w];return w}function W9(w){let K=0;for(let W in w)if(Object.prototype.hasOwnProperty.call(w,W))K++;return K}var J9=(w)=>{let K=typeof w;switch(K){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(w)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(w))return"array";if(w===null)return"null";if(w.then&&typeof w.then==="function"&&w.catch&&typeof w.catch==="function")return"promise";if(typeof Map<"u"&&w instanceof Map)return"map";if(typeof Set<"u"&&w instanceof Set)return"set";if(typeof Date<"u"&&w instanceof Date)return"date";if(typeof File<"u"&&w instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${K}`)}},O1=new Set(["string","number","symbol"]),i4=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Q2(w){return w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Cw(w,K,W){let J=new w._zod.constr(K??w._zod.def);if(!K||W?.parent)J._zod.parent=w;return J}function e(w){let K=w;if(!K)return{};if(typeof K==="string")return{error:()=>K};if(K?.message!==void 0){if(K?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");K.error=K.message}if(delete K.message,typeof K.error==="string")return{...K,error:()=>K.error};return K}function P9(w){let K;return new Proxy({},{get(W,J,P){return K??(K=w()),Reflect.get(K,J,P)},set(W,J,P,I){return K??(K=w()),Reflect.set(K,J,P,I)},has(W,J){return K??(K=w()),Reflect.has(K,J)},deleteProperty(W,J){return K??(K=w()),Reflect.deleteProperty(K,J)},ownKeys(W){return K??(K=w()),Reflect.ownKeys(K)},getOwnPropertyDescriptor(W,J){return K??(K=w()),Reflect.getOwnPropertyDescriptor(K,J)},defineProperty(W,J,P){return K??(K=w()),Reflect.defineProperty(K,J,P)}})}function LK(w){if(typeof w==="bigint")return w.toString()+"n";if(typeof w==="string")return`"${w}"`;return`${w}`}function B1(w){return Object.keys(w).filter((K)=>{return w[K]._zod.optin==="optional"&&w[K]._zod.optout==="optional"})}var d4={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},n4={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function I9(w,K){let W=w._zod.def,J=W.checks;if(J&&J.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let I=iw(w._zod.def,{get shape(){let b={};for(let D in K){if(!(D in W.shape))throw Error(`Unrecognized key: "${D}"`);if(!K[D])continue;b[D]=W.shape[D]}return w2(this,"shape",b),b},checks:[]});return Cw(w,I)}function b9(w,K){let W=w._zod.def,J=W.checks;if(J&&J.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let I=iw(w._zod.def,{get shape(){let b={...w._zod.def.shape};for(let D in K){if(!(D in W.shape))throw Error(`Unrecognized key: "${D}"`);if(!K[D])continue;delete b[D]}return w2(this,"shape",b),b},checks:[]});return Cw(w,I)}function D9(w,K){if(!N2(K))throw Error("Invalid input to extend: expected a plain object");let W=w._zod.def.checks;if(W&&W.length>0){let I=w._zod.def.shape;for(let b in K)if(Object.getOwnPropertyDescriptor(I,b)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let P=iw(w._zod.def,{get shape(){let I={...w._zod.def.shape,...K};return w2(this,"shape",I),I}});return Cw(w,P)}function G9(w,K){if(!N2(K))throw Error("Invalid input to safeExtend: expected a plain object");let W=iw(w._zod.def,{get shape(){let J={...w._zod.def.shape,...K};return w2(this,"shape",J),J}});return Cw(w,W)}function A9(w,K){let W=iw(w._zod.def,{get shape(){let J={...w._zod.def.shape,...K._zod.def.shape};return w2(this,"shape",J),J},get catchall(){return K._zod.def.catchall},checks:[]});return Cw(w,W)}function M9(w,K,W){let P=K._zod.def.checks;if(P&&P.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let b=iw(K._zod.def,{get shape(){let D=K._zod.def.shape,A={...D};if(W)for(let M in W){if(!(M in D))throw Error(`Unrecognized key: "${M}"`);if(!W[M])continue;A[M]=w?new w({type:"optional",innerType:D[M]}):D[M]}else for(let M in D)A[M]=w?new w({type:"optional",innerType:D[M]}):D[M];return w2(this,"shape",A),A},checks:[]});return Cw(K,b)}function O9(w,K,W){let J=iw(K._zod.def,{get shape(){let P=K._zod.def.shape,I={...P};if(W)for(let b in W){if(!(b in I))throw Error(`Unrecognized key: "${b}"`);if(!W[b])continue;I[b]=new w({type:"nonoptional",innerType:P[b]})}else for(let b in P)I[b]=new w({type:"nonoptional",innerType:P[b]});return w2(this,"shape",I),I}});return Cw(K,J)}function K2(w,K=0){if(w.aborted===!0)return!0;for(let W=K;W<w.issues.length;W++)if(w.issues[W]?.continue!==!0)return!0;return!1}function f2(w,K){return K.map((W)=>{var J;return(J=W).path??(J.path=[]),W.path.unshift(w),W})}function y2(w){return typeof w==="string"?w:w?.message}function mw(w,K,W){let J={...w,path:w.path??[]};if(!w.message){let P=y2(w.inst?._zod.def?.error?.(w))??y2(K?.error?.(w))??y2(W.customError?.(w))??y2(W.localeError?.(w))??"Invalid input";J.message=P}if(delete J.inst,delete J.continue,!K?.reportInput)delete J.input;return J}function t4(w){if(w instanceof Set)return"set";if(w instanceof Map)return"map";if(w instanceof File)return"file";return"unknown"}function e2(w){if(Array.isArray(w))return"array";if(typeof w==="string")return"string";return"unknown"}function N1(w){let K=typeof w;switch(K){case"number":return Number.isNaN(w)?"nan":"number";case"object":{if(w===null)return"null";if(Array.isArray(w))return"array";let W=w;if(W&&Object.getPrototypeOf(W)!==Object.prototype&&"constructor"in W&&W.constructor)return W.constructor.name}}return K}function F2(...w){let[K,W,J]=w;if(typeof K==="string")return{message:K,code:"custom",input:W,inst:J};return{...K}}function B9(w){return Object.entries(w).filter(([K,W])=>{return Number.isNaN(Number.parseInt(K,10))}).map((K)=>K[1])}function a4(w){let K=atob(w),W=new Uint8Array(K.length);for(let J=0;J<K.length;J++)W[J]=K.charCodeAt(J);return W}function s4(w){let K="";for(let W=0;W<w.length;W++)K+=String.fromCharCode(w[W]);return btoa(K)}function N9(w){let K=w.replace(/-/g,"+").replace(/_/g,"/"),W="=".repeat((4-K.length%4)%4);return a4(K+W)}function Q9(w){return s4(w).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function S9(w){let K=w.replace(/^0x/,"");if(K.length%2!==0)throw Error("Invalid hex string length");let W=new Uint8Array(K.length/2);for(let J=0;J<K.length;J+=2)W[J/2]=Number.parseInt(K.slice(J,J+2),16);return W}function $9(w){return Array.from(w).map((K)=>K.toString(16).padStart(2,"0")).join("")}class w6{constructor(...w){}}var K6=(w,K)=>{w.name="$ZodError",Object.defineProperty(w,"_zod",{value:w._zod,enumerable:!1}),Object.defineProperty(w,"issues",{value:K,enumerable:!1}),w.message=JSON.stringify(K,h2,2),Object.defineProperty(w,"toString",{value:()=>w.message,enumerable:!1})},EK=h("$ZodError",K6),Q1=h("$ZodError",K6,{Parent:Error});function S1(w,K=(W)=>W.message){let W={},J=[];for(let P of w.issues)if(P.path.length>0)W[P.path[0]]=W[P.path[0]]||[],W[P.path[0]].push(K(P));else J.push(K(P));return{formErrors:J,fieldErrors:W}}function $1(w,K=(W)=>W.message){let W={_errors:[]},J=(P)=>{for(let I of P.issues)if(I.code==="invalid_union"&&I.errors.length)I.errors.map((b)=>J({issues:b}));else if(I.code==="invalid_key")J({issues:I.issues});else if(I.code==="invalid_element")J({issues:I.issues});else if(I.path.length===0)W._errors.push(K(I));else{let b=W,D=0;while(D<I.path.length){let A=I.path[D];if(D!==I.path.length-1)b[A]=b[A]||{_errors:[]};else b[A]=b[A]||{_errors:[]},b[A]._errors.push(K(I));b=b[A],D++}}};return J(w),W}var UK=(w)=>(K,W,J,P)=>{let I=J?Object.assign(J,{async:!1}):{async:!1},b=K._zod.run({value:W,issues:[]},I);if(b instanceof Promise)throw new ew;if(b.issues.length){let D=new(P?.Err??w)(b.issues.map((A)=>mw(A,I,gw())));throw VK(D,P?.callee),D}return b.value};var HK=(w)=>async(K,W,J,P)=>{let I=J?Object.assign(J,{async:!0}):{async:!0},b=K._zod.run({value:W,issues:[]},I);if(b instanceof Promise)b=await b;if(b.issues.length){let D=new(P?.Err??w)(b.issues.map((A)=>mw(A,I,gw())));throw VK(D,P?.callee),D}return b.value};var i2=(w)=>(K,W,J)=>{let P=J?{...J,async:!1}:{async:!1},I=K._zod.run({value:W,issues:[]},P);if(I instanceof Promise)throw new ew;return I.issues.length?{success:!1,error:new(w??EK)(I.issues.map((b)=>mw(b,P,gw())))}:{success:!0,data:I.value}},W6=i2(Q1),d2=(w)=>async(K,W,J)=>{let P=J?Object.assign(J,{async:!0}):{async:!0},I=K._zod.run({value:W,issues:[]},P);if(I instanceof Promise)I=await I;return I.issues.length?{success:!1,error:new w(I.issues.map((b)=>mw(b,P,gw())))}:{success:!0,data:I.value}},J6=d2(Q1),P6=(w)=>(K,W,J)=>{let P=J?Object.assign(J,{direction:"backward"}):{direction:"backward"};return UK(w)(K,W,P)};var I6=(w)=>(K,W,J)=>{return UK(w)(K,W,J)};var b6=(w)=>async(K,W,J)=>{let P=J?Object.assign(J,{direction:"backward"}):{direction:"backward"};return HK(w)(K,W,P)};var D6=(w)=>async(K,W,J)=>{return HK(w)(K,W,J)};var G6=(w)=>(K,W,J)=>{let P=J?Object.assign(J,{direction:"backward"}):{direction:"backward"};return i2(w)(K,W,P)};var A6=(w)=>(K,W,J)=>{return i2(w)(K,W,J)};var M6=(w)=>async(K,W,J)=>{let P=J?Object.assign(J,{direction:"backward"}):{direction:"backward"};return d2(w)(K,W,P)};var O6=(w)=>async(K,W,J)=>{return d2(w)(K,W,J)};var B6=/^[cC][^\s-]{8,}$/,N6=/^[0-9a-z]+$/,Q6=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,S6=/^[0-9a-vA-V]{20}$/,$6=/^[A-Za-z0-9]{27}$/,Y6=/^[a-zA-Z0-9_-]{21}$/,X6=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var V6=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Y1=(w)=>{if(!w)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${w}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var L6=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var X9="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function E6(){return new RegExp(X9,"u")}var U6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,H6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var q6=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,h6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,F6=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,X1=/^[A-Za-z0-9_-]*$/;var z6=/^\+[1-9]\d{6,14}$/,R6="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",v6=new RegExp(`^${R6}$`);function j6(w){return typeof w.precision==="number"?w.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":w.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${w.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Z6(w){return new RegExp(`^${j6(w)}$`)}function k6(w){let K=j6({precision:w.precision}),W=["Z"];if(w.local)W.push("");if(w.offset)W.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let J=`${K}(?:${W.join("|")})`;return new RegExp(`^${R6}T(?:${J})$`)}var g6=(w)=>{let K=w?`[\\s\\S]{${w?.minimum??0},${w?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${K}$`)};var C6=/^[^A-Z]*$/,o6=/^[^a-z]*$/;var jw=h("$ZodCheck",(w,K)=>{var W;w._zod??(w._zod={}),w._zod.def=K,(W=w._zod).onattach??(W.onattach=[])});var x6=h("$ZodCheckMaxLength",(w,K)=>{var W;jw.init(w,K),(W=w._zod.def).when??(W.when=(J)=>{let P=J.value;return!l2(P)&&P.length!==void 0}),w._zod.onattach.push((J)=>{let P=J._zod.bag.maximum??Number.POSITIVE_INFINITY;if(K.maximum<P)J._zod.bag.maximum=K.maximum}),w._zod.check=(J)=>{let P=J.value;if(P.length<=K.maximum)return;let b=e2(P);J.issues.push({origin:b,code:"too_big",maximum:K.maximum,inclusive:!0,input:P,inst:w,continue:!K.abort})}}),c6=h("$ZodCheckMinLength",(w,K)=>{var W;jw.init(w,K),(W=w._zod.def).when??(W.when=(J)=>{let P=J.value;return!l2(P)&&P.length!==void 0}),w._zod.onattach.push((J)=>{let P=J._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(K.minimum>P)J._zod.bag.minimum=K.minimum}),w._zod.check=(J)=>{let P=J.value;if(P.length>=K.minimum)return;let b=e2(P);J.issues.push({origin:b,code:"too_small",minimum:K.minimum,inclusive:!0,input:P,inst:w,continue:!K.abort})}}),r6=h("$ZodCheckLengthEquals",(w,K)=>{var W;jw.init(w,K),(W=w._zod.def).when??(W.when=(J)=>{let P=J.value;return!l2(P)&&P.length!==void 0}),w._zod.onattach.push((J)=>{let P=J._zod.bag;P.minimum=K.length,P.maximum=K.length,P.length=K.length}),w._zod.check=(J)=>{let P=J.value,I=P.length;if(I===K.length)return;let b=e2(P),D=I>K.length;J.issues.push({origin:b,...D?{code:"too_big",maximum:K.length}:{code:"too_small",minimum:K.length},inclusive:!0,exact:!0,input:J.value,inst:w,continue:!K.abort})}}),t2=h("$ZodCheckStringFormat",(w,K)=>{var W,J;if(jw.init(w,K),w._zod.onattach.push((P)=>{let I=P._zod.bag;if(I.format=K.format,K.pattern)I.patterns??(I.patterns=new Set),I.patterns.add(K.pattern)}),K.pattern)(W=w._zod).check??(W.check=(P)=>{if(K.pattern.lastIndex=0,K.pattern.test(P.value))return;P.issues.push({origin:"string",code:"invalid_format",format:K.format,input:P.value,...K.pattern?{pattern:K.pattern.toString()}:{},inst:w,continue:!K.abort})});else(J=w._zod).check??(J.check=()=>{})}),_6=h("$ZodCheckRegex",(w,K)=>{t2.init(w,K),w._zod.check=(W)=>{if(K.pattern.lastIndex=0,K.pattern.test(W.value))return;W.issues.push({origin:"string",code:"invalid_format",format:"regex",input:W.value,pattern:K.pattern.toString(),inst:w,continue:!K.abort})}}),u6=h("$ZodCheckLowerCase",(w,K)=>{K.pattern??(K.pattern=C6),t2.init(w,K)}),y6=h("$ZodCheckUpperCase",(w,K)=>{K.pattern??(K.pattern=o6),t2.init(w,K)}),m6=h("$ZodCheckIncludes",(w,K)=>{jw.init(w,K);let W=Q2(K.includes),J=new RegExp(typeof K.position==="number"?`^.{${K.position}}${W}`:W);K.pattern=J,w._zod.onattach.push((P)=>{let I=P._zod.bag;I.patterns??(I.patterns=new Set),I.patterns.add(J)}),w._zod.check=(P)=>{if(P.value.includes(K.includes,K.position))return;P.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:K.includes,input:P.value,inst:w,continue:!K.abort})}}),T6=h("$ZodCheckStartsWith",(w,K)=>{jw.init(w,K);let W=new RegExp(`^${Q2(K.prefix)}.*`);K.pattern??(K.pattern=W),w._zod.onattach.push((J)=>{let P=J._zod.bag;P.patterns??(P.patterns=new Set),P.patterns.add(W)}),w._zod.check=(J)=>{if(J.value.startsWith(K.prefix))return;J.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:K.prefix,input:J.value,inst:w,continue:!K.abort})}}),l6=h("$ZodCheckEndsWith",(w,K)=>{jw.init(w,K);let W=new RegExp(`.*${Q2(K.suffix)}$`);K.pattern??(K.pattern=W),w._zod.onattach.push((J)=>{let P=J._zod.bag;P.patterns??(P.patterns=new Set),P.patterns.add(W)}),w._zod.check=(J)=>{if(J.value.endsWith(K.suffix))return;J.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:K.suffix,input:J.value,inst:w,continue:!K.abort})}});var p6=h("$ZodCheckOverwrite",(w,K)=>{jw.init(w,K),w._zod.check=(W)=>{W.value=K.tx(W.value)}});class V1{constructor(w=[]){if(this.content=[],this.indent=0,this)this.args=w}indented(w){this.indent+=1,w(this),this.indent-=1}write(w){if(typeof w==="function"){w(this,{execution:"sync"}),w(this,{execution:"async"});return}let W=w.split(`
19
+ `).filter((I)=>I),J=Math.min(...W.map((I)=>I.length-I.trimStart().length)),P=W.map((I)=>I.slice(J)).map((I)=>" ".repeat(this.indent*2)+I);for(let I of P)this.content.push(I)}compile(){let w=Function,K=this?.args,J=[...(this?.content??[""]).map((P)=>` ${P}`)];return new w(...K,J.join(`
20
+ `))}}var e6={major:4,minor:3,patch:6};var Nw=h("$ZodType",(w,K)=>{var W;w??(w={}),w._zod.def=K,w._zod.bag=w._zod.bag||{},w._zod.version=e6;let J=[...w._zod.def.checks??[]];if(w._zod.traits.has("$ZodCheck"))J.unshift(w);for(let P of J)for(let I of P._zod.onattach)I(w);if(J.length===0)(W=w._zod).deferred??(W.deferred=[]),w._zod.deferred?.push(()=>{w._zod.run=w._zod.parse});else{let P=(b,D,A)=>{let M=K2(b),N;for(let Q of D){if(Q._zod.def.when){if(!Q._zod.def.when(b))continue}else if(M)continue;let B=b.issues.length,L=Q._zod.check(b);if(L instanceof Promise&&A?.async===!1)throw new ew;if(N||L instanceof Promise)N=(N??Promise.resolve()).then(async()=>{if(await L,b.issues.length===B)return;if(!M)M=K2(b,B)});else{if(b.issues.length===B)continue;if(!M)M=K2(b,B)}}if(N)return N.then(()=>{return b});return b},I=(b,D,A)=>{if(K2(b))return b.aborted=!0,b;let M=P(D,J,A);if(M instanceof Promise){if(A.async===!1)throw new ew;return M.then((N)=>w._zod.parse(N,A))}return w._zod.parse(M,A)};w._zod.run=(b,D)=>{if(D.skipChecks)return w._zod.parse(b,D);if(D.direction==="backward"){let M=w._zod.parse({value:b.value,issues:[]},{...D,skipChecks:!0});if(M instanceof Promise)return M.then((N)=>{return I(N,b,D)});return I(M,b,D)}let A=w._zod.parse(b,D);if(A instanceof Promise){if(D.async===!1)throw new ew;return A.then((M)=>P(M,J,D))}return P(A,J,D)}}Iw(w,"~standard",()=>({validate:(P)=>{try{let I=W6(w,P);return I.success?{value:I.data}:{issues:I.error?.issues}}catch(I){return J6(w,P).then((b)=>b.success?{value:b.data}:{issues:b.error?.issues})}},vendor:"zod",version:1}))}),FK=h("$ZodString",(w,K)=>{Nw.init(w,K),w._zod.pattern=[...w?._zod.bag?.patterns??[]].pop()??g6(w._zod.bag),w._zod.parse=(W,J)=>{if(K.coerce)try{W.value=String(W.value)}catch(P){}if(typeof W.value==="string")return W;return W.issues.push({expected:"string",code:"invalid_type",input:W.value,inst:w}),W}}),Gw=h("$ZodStringFormat",(w,K)=>{t2.init(w,K),FK.init(w,K)}),W8=h("$ZodGUID",(w,K)=>{K.pattern??(K.pattern=V6),Gw.init(w,K)}),J8=h("$ZodUUID",(w,K)=>{if(K.version){let J={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[K.version];if(J===void 0)throw Error(`Invalid UUID version: "${K.version}"`);K.pattern??(K.pattern=Y1(J))}else K.pattern??(K.pattern=Y1());Gw.init(w,K)}),P8=h("$ZodEmail",(w,K)=>{K.pattern??(K.pattern=L6),Gw.init(w,K)}),I8=h("$ZodURL",(w,K)=>{Gw.init(w,K),w._zod.check=(W)=>{try{let J=W.value.trim(),P=new URL(J);if(K.hostname){if(K.hostname.lastIndex=0,!K.hostname.test(P.hostname))W.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:K.hostname.source,input:W.value,inst:w,continue:!K.abort})}if(K.protocol){if(K.protocol.lastIndex=0,!K.protocol.test(P.protocol.endsWith(":")?P.protocol.slice(0,-1):P.protocol))W.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:K.protocol.source,input:W.value,inst:w,continue:!K.abort})}if(K.normalize)W.value=P.href;else W.value=J;return}catch(J){W.issues.push({code:"invalid_format",format:"url",input:W.value,inst:w,continue:!K.abort})}}}),b8=h("$ZodEmoji",(w,K)=>{K.pattern??(K.pattern=E6()),Gw.init(w,K)}),D8=h("$ZodNanoID",(w,K)=>{K.pattern??(K.pattern=Y6),Gw.init(w,K)}),G8=h("$ZodCUID",(w,K)=>{K.pattern??(K.pattern=B6),Gw.init(w,K)}),A8=h("$ZodCUID2",(w,K)=>{K.pattern??(K.pattern=N6),Gw.init(w,K)}),M8=h("$ZodULID",(w,K)=>{K.pattern??(K.pattern=Q6),Gw.init(w,K)}),O8=h("$ZodXID",(w,K)=>{K.pattern??(K.pattern=S6),Gw.init(w,K)}),B8=h("$ZodKSUID",(w,K)=>{K.pattern??(K.pattern=$6),Gw.init(w,K)}),N8=h("$ZodISODateTime",(w,K)=>{K.pattern??(K.pattern=k6(K)),Gw.init(w,K)}),Q8=h("$ZodISODate",(w,K)=>{K.pattern??(K.pattern=v6),Gw.init(w,K)}),S8=h("$ZodISOTime",(w,K)=>{K.pattern??(K.pattern=Z6(K)),Gw.init(w,K)}),$8=h("$ZodISODuration",(w,K)=>{K.pattern??(K.pattern=X6),Gw.init(w,K)}),Y8=h("$ZodIPv4",(w,K)=>{K.pattern??(K.pattern=U6),Gw.init(w,K),w._zod.bag.format="ipv4"}),X8=h("$ZodIPv6",(w,K)=>{K.pattern??(K.pattern=H6),Gw.init(w,K),w._zod.bag.format="ipv6",w._zod.check=(W)=>{try{new URL(`http://[${W.value}]`)}catch{W.issues.push({code:"invalid_format",format:"ipv6",input:W.value,inst:w,continue:!K.abort})}}});var V8=h("$ZodCIDRv4",(w,K)=>{K.pattern??(K.pattern=q6),Gw.init(w,K)}),L8=h("$ZodCIDRv6",(w,K)=>{K.pattern??(K.pattern=h6),Gw.init(w,K),w._zod.check=(W)=>{let J=W.value.split("/");try{if(J.length!==2)throw Error();let[P,I]=J;if(!I)throw Error();let b=Number(I);if(`${b}`!==I)throw Error();if(b<0||b>128)throw Error();new URL(`http://[${P}]`)}catch{W.issues.push({code:"invalid_format",format:"cidrv6",input:W.value,inst:w,continue:!K.abort})}}});function E8(w){if(w==="")return!0;if(w.length%4!==0)return!1;try{return atob(w),!0}catch{return!1}}var U8=h("$ZodBase64",(w,K)=>{K.pattern??(K.pattern=F6),Gw.init(w,K),w._zod.bag.contentEncoding="base64",w._zod.check=(W)=>{if(E8(W.value))return;W.issues.push({code:"invalid_format",format:"base64",input:W.value,inst:w,continue:!K.abort})}});function V9(w){if(!X1.test(w))return!1;let K=w.replace(/[-_]/g,(J)=>J==="-"?"+":"/"),W=K.padEnd(Math.ceil(K.length/4)*4,"=");return E8(W)}var H8=h("$ZodBase64URL",(w,K)=>{K.pattern??(K.pattern=X1),Gw.init(w,K),w._zod.bag.contentEncoding="base64url",w._zod.check=(W)=>{if(V9(W.value))return;W.issues.push({code:"invalid_format",format:"base64url",input:W.value,inst:w,continue:!K.abort})}}),q8=h("$ZodE164",(w,K)=>{K.pattern??(K.pattern=z6),Gw.init(w,K)});function L9(w,K=null){try{let W=w.split(".");if(W.length!==3)return!1;let[J]=W;if(!J)return!1;let P=JSON.parse(atob(J));if("typ"in P&&P?.typ!=="JWT")return!1;if(!P.alg)return!1;if(K&&(!("alg"in P)||P.alg!==K))return!1;return!0}catch{return!1}}var h8=h("$ZodJWT",(w,K)=>{Gw.init(w,K),w._zod.check=(W)=>{if(L9(W.value,K.alg))return;W.issues.push({code:"invalid_format",format:"jwt",input:W.value,inst:w,continue:!K.abort})}});var F8=h("$ZodUnknown",(w,K)=>{Nw.init(w,K),w._zod.parse=(W)=>W}),z8=h("$ZodNever",(w,K)=>{Nw.init(w,K),w._zod.parse=(W,J)=>{return W.issues.push({expected:"never",code:"invalid_type",input:W.value,inst:w}),W}});function i6(w,K,W){if(w.issues.length)K.issues.push(...f2(W,w.issues));K.value[W]=w.value}var R8=h("$ZodArray",(w,K)=>{Nw.init(w,K),w._zod.parse=(W,J)=>{let P=W.value;if(!Array.isArray(P))return W.issues.push({expected:"array",code:"invalid_type",input:P,inst:w}),W;W.value=Array(P.length);let I=[];for(let b=0;b<P.length;b++){let D=P[b],A=K.element._zod.run({value:D,issues:[]},J);if(A instanceof Promise)I.push(A.then((M)=>i6(M,W,b)));else i6(A,W,b)}if(I.length)return Promise.all(I).then(()=>W);return W}});function hK(w,K,W,J,P){if(w.issues.length){if(P&&!(W in J))return;K.issues.push(...f2(W,w.issues))}if(w.value===void 0){if(W in J)K.value[W]=void 0}else K.value[W]=w.value}function v8(w){let K=Object.keys(w.shape);for(let J of K)if(!w.shape?.[J]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${J}": expected a Zod schema`);let W=B1(w.shape);return{...w,keys:K,keySet:new Set(K),numKeys:K.length,optionalKeys:new Set(W)}}function j8(w,K,W,J,P,I){let b=[],D=P.keySet,A=P.catchall._zod,M=A.def.type,N=A.optout==="optional";for(let Q in K){if(D.has(Q))continue;if(M==="never"){b.push(Q);continue}let B=A.run({value:K[Q],issues:[]},J);if(B instanceof Promise)w.push(B.then((L)=>hK(L,W,Q,K,N)));else hK(B,W,Q,K,N)}if(b.length)W.issues.push({code:"unrecognized_keys",keys:b,input:K,inst:I});if(!w.length)return W;return Promise.all(w).then(()=>{return W})}var E9=h("$ZodObject",(w,K)=>{if(Nw.init(w,K),!Object.getOwnPropertyDescriptor(K,"shape")?.get){let D=K.shape;Object.defineProperty(K,"shape",{get:()=>{let A={...D};return Object.defineProperty(K,"shape",{value:A}),A}})}let J=T2(()=>v8(K));Iw(w._zod,"propValues",()=>{let D=K.shape,A={};for(let M in D){let N=D[M]._zod;if(N.values){A[M]??(A[M]=new Set);for(let Q of N.values)A[M].add(Q)}}return A});let P=q2,I=K.catchall,b;w._zod.parse=(D,A)=>{b??(b=J.value);let M=D.value;if(!P(M))return D.issues.push({expected:"object",code:"invalid_type",input:M,inst:w}),D;D.value={};let N=[],Q=b.shape;for(let B of b.keys){let L=Q[B],g=L._zod.optout==="optional",O=L._zod.run({value:M[B],issues:[]},A);if(O instanceof Promise)N.push(O.then((v)=>hK(v,D,B,M,g)));else hK(O,D,B,M,g)}if(!I)return N.length?Promise.all(N).then(()=>D):D;return j8(N,M,D,A,J.value,w)}}),Z8=h("$ZodObjectJIT",(w,K)=>{E9.init(w,K);let W=w._zod.parse,J=T2(()=>v8(K)),P=(B)=>{let L=new V1(["shape","payload","ctx"]),g=J.value,O=(o)=>{let z=XK(o);return`shape[${z}]._zod.run({ value: input[${z}], issues: [] }, ctx)`};L.write("const input = payload.value;");let v=Object.create(null),G=0;for(let o of g.keys)v[o]=`key_${G++}`;L.write("const newResult = {};");for(let o of g.keys){let z=v[o],Z=XK(o),r=B[o]?._zod?.optout==="optional";if(L.write(`const ${z} = ${O(o)};`),r)L.write(`
21
+ if (${z}.issues.length) {
22
+ if (${Z} in input) {
23
+ payload.issues = payload.issues.concat(${z}.issues.map(iss => ({
24
+ ...iss,
25
+ path: iss.path ? [${Z}, ...iss.path] : [${Z}]
26
+ })));
27
+ }
28
+ }
29
+
30
+ if (${z}.value === undefined) {
31
+ if (${Z} in input) {
32
+ newResult[${Z}] = undefined;
33
+ }
34
+ } else {
35
+ newResult[${Z}] = ${z}.value;
36
+ }
37
+
38
+ `);else L.write(`
39
+ if (${z}.issues.length) {
40
+ payload.issues = payload.issues.concat(${z}.issues.map(iss => ({
23
41
  ...iss,
24
- path: iss.path ? [${H}, ...iss.path] : [${H}]
42
+ path: iss.path ? [${Z}, ...iss.path] : [${Z}]
25
43
  })));
26
44
  }
27
45
 
28
-
29
- if (${O}.value === undefined) {
30
- if (${H} in input) {
31
- newResult[${H}] = undefined;
46
+ if (${z}.value === undefined) {
47
+ if (${Z} in input) {
48
+ newResult[${Z}] = undefined;
32
49
  }
33
50
  } else {
34
- newResult[${H}] = ${O}.value;
51
+ newResult[${Z}] = ${z}.value;
35
52
  }
36
53
 
37
- `)}V.write("payload.value = newResult;"),V.write("return payload;");let Y=V.compile();return(X,O)=>Y(z,X,O)},h,M=F2,I=!G4.jitless,D=I&&N6.value,B=K.catchall,L;c._zod.parse=(z,V)=>{L??(L=P.value);let b=z.value;if(!M(b))return z.issues.push({expected:"object",code:"invalid_type",input:b,inst:c}),z;if(I&&D&&V?.async===!1&&V.jitless!==!0){if(!h)h=S(K.shape);if(z=h(z,V),!B)return z;return Y5([],b,z,V,L,c)}return w(z,V)}});function yK(c,K,w,P){for(let h of c)if(h.issues.length===0)return K.value=h.value,K;let S=c.filter((h)=>!I2(h));if(S.length===1)return K.value=S[0].value,S[0];return K.issues.push({code:"invalid_union",input:K.value,inst:w,errors:c.map((h)=>h.issues.map((M)=>Cc(M,P,ic())))}),K}var V5=F("$ZodUnion",(c,K)=>{Oc.init(c,K),Kc(c._zod,"optin",()=>K.options.some((S)=>S._zod.optin==="optional")?"optional":void 0),Kc(c._zod,"optout",()=>K.options.some((S)=>S._zod.optout==="optional")?"optional":void 0),Kc(c._zod,"values",()=>{if(K.options.every((S)=>S._zod.values))return new Set(K.options.flatMap((S)=>Array.from(S._zod.values)));return}),Kc(c._zod,"pattern",()=>{if(K.options.every((S)=>S._zod.pattern)){let S=K.options.map((h)=>h._zod.pattern);return new RegExp(`^(${S.map((h)=>u2(h.source)).join("|")})$`)}return});let w=K.options.length===1,P=K.options[0]._zod.run;c._zod.parse=(S,h)=>{if(w)return P(S,h);let M=!1,I=[];for(let G of K.options){let D=G._zod.run({value:S.value,issues:[]},h);if(D instanceof Promise)I.push(D),M=!0;else{if(D.issues.length===0)return D;I.push(D)}}if(!M)return yK(I,S,c,h);return Promise.all(I).then((G)=>{return yK(G,S,c,h)})}});var L5=F("$ZodIntersection",(c,K)=>{Oc.init(c,K),c._zod.parse=(w,P)=>{let S=w.value,h=K.left._zod.run({value:S,issues:[]},P),M=K.right._zod.run({value:S,issues:[]},P);if(h instanceof Promise||M instanceof Promise)return Promise.all([h,M]).then(([G,D])=>{return _K(w,G,D)});return _K(w,h,M)}});function $6(c,K){if(c===K)return{valid:!0,data:c};if(c instanceof Date&&K instanceof Date&&+c===+K)return{valid:!0,data:c};if(B2(c)&&B2(K)){let w=Object.keys(K),P=Object.keys(c).filter((h)=>w.indexOf(h)!==-1),S={...c,...K};for(let h of P){let M=$6(c[h],K[h]);if(!M.valid)return{valid:!1,mergeErrorPath:[h,...M.mergeErrorPath]};S[h]=M.data}return{valid:!0,data:S}}if(Array.isArray(c)&&Array.isArray(K)){if(c.length!==K.length)return{valid:!1,mergeErrorPath:[]};let w=[];for(let P=0;P<c.length;P++){let S=c[P],h=K[P],M=$6(S,h);if(!M.valid)return{valid:!1,mergeErrorPath:[P,...M.mergeErrorPath]};w.push(M.data)}return{valid:!0,data:w}}return{valid:!1,mergeErrorPath:[]}}function _K(c,K,w){if(K.issues.length)c.issues.push(...K.issues);if(w.issues.length)c.issues.push(...w.issues);if(I2(c))return c;let P=$6(K.value,w.value);if(!P.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(P.mergeErrorPath)}`);return c.value=P.data,c}var q5=F("$ZodEnum",(c,K)=>{Oc.init(c,K);let w=J6(K.entries),P=new Set(w);c._zod.values=P,c._zod.pattern=new RegExp(`^(${w.filter((S)=>D6.has(typeof S)).map((S)=>typeof S==="string"?z2(S):S.toString()).join("|")})$`),c._zod.parse=(S,h)=>{let M=S.value;if(P.has(M))return S;return S.issues.push({code:"invalid_value",values:w,input:M,inst:c}),S}});var v5=F("$ZodTransform",(c,K)=>{Oc.init(c,K),c._zod.parse=(w,P)=>{if(P.direction==="backward")throw new A2(c.constructor.name);let S=K.transform(w.value,w);if(P.async)return(S instanceof Promise?S:Promise.resolve(S)).then((M)=>{return w.value=M,w});if(S instanceof Promise)throw new nc;return w.value=S,w}});function fK(c,K){if(c.issues.length&&K===void 0)return{issues:[],value:void 0};return c}var F5=F("$ZodOptional",(c,K)=>{Oc.init(c,K),c._zod.optin="optional",c._zod.optout="optional",Kc(c._zod,"values",()=>{return K.innerType._zod.values?new Set([...K.innerType._zod.values,void 0]):void 0}),Kc(c._zod,"pattern",()=>{let w=K.innerType._zod.pattern;return w?new RegExp(`^(${u2(w.source)})?$`):void 0}),c._zod.parse=(w,P)=>{if(K.innerType._zod.optin==="optional"){let S=K.innerType._zod.run(w,P);if(S instanceof Promise)return S.then((h)=>fK(h,w.value));return fK(S,w.value)}if(w.value===void 0)return w;return K.innerType._zod.run(w,P)}}),E5=F("$ZodNullable",(c,K)=>{Oc.init(c,K),Kc(c._zod,"optin",()=>K.innerType._zod.optin),Kc(c._zod,"optout",()=>K.innerType._zod.optout),Kc(c._zod,"pattern",()=>{let w=K.innerType._zod.pattern;return w?new RegExp(`^(${u2(w.source)}|null)$`):void 0}),Kc(c._zod,"values",()=>{return K.innerType._zod.values?new Set([...K.innerType._zod.values,null]):void 0}),c._zod.parse=(w,P)=>{if(w.value===null)return w;return K.innerType._zod.run(w,P)}}),R5=F("$ZodDefault",(c,K)=>{Oc.init(c,K),c._zod.optin="optional",Kc(c._zod,"values",()=>K.innerType._zod.values),c._zod.parse=(w,P)=>{if(P.direction==="backward")return K.innerType._zod.run(w,P);if(w.value===void 0)return w.value=K.defaultValue,w;let S=K.innerType._zod.run(w,P);if(S instanceof Promise)return S.then((h)=>eK(h,K));return eK(S,K)}});function eK(c,K){if(c.value===void 0)c.value=K.defaultValue;return c}var g5=F("$ZodPrefault",(c,K)=>{Oc.init(c,K),c._zod.optin="optional",Kc(c._zod,"values",()=>K.innerType._zod.values),c._zod.parse=(w,P)=>{if(P.direction==="backward")return K.innerType._zod.run(w,P);if(w.value===void 0)w.value=K.defaultValue;return K.innerType._zod.run(w,P)}}),k5=F("$ZodNonOptional",(c,K)=>{Oc.init(c,K),Kc(c._zod,"values",()=>{let w=K.innerType._zod.values;return w?new Set([...w].filter((P)=>P!==void 0)):void 0}),c._zod.parse=(w,P)=>{let S=K.innerType._zod.run(w,P);if(S instanceof Promise)return S.then((h)=>pK(h,c));return pK(S,c)}});function pK(c,K){if(!c.issues.length&&c.value===void 0)c.issues.push({code:"invalid_type",expected:"nonoptional",input:c.value,inst:K});return c}var x5=F("$ZodCatch",(c,K)=>{Oc.init(c,K),Kc(c._zod,"optin",()=>K.innerType._zod.optin),Kc(c._zod,"optout",()=>K.innerType._zod.optout),Kc(c._zod,"values",()=>K.innerType._zod.values),c._zod.parse=(w,P)=>{if(P.direction==="backward")return K.innerType._zod.run(w,P);let S=K.innerType._zod.run(w,P);if(S instanceof Promise)return S.then((h)=>{if(w.value=h.value,h.issues.length)w.value=K.catchValue({...w,error:{issues:h.issues.map((M)=>Cc(M,P,ic()))},input:w.value}),w.issues=[];return w});if(w.value=S.value,S.issues.length)w.value=K.catchValue({...w,error:{issues:S.issues.map((h)=>Cc(h,P,ic()))},input:w.value}),w.issues=[];return w}});var Z5=F("$ZodPipe",(c,K)=>{Oc.init(c,K),Kc(c._zod,"values",()=>K.in._zod.values),Kc(c._zod,"optin",()=>K.in._zod.optin),Kc(c._zod,"optout",()=>K.out._zod.optout),Kc(c._zod,"propValues",()=>K.in._zod.propValues),c._zod.parse=(w,P)=>{if(P.direction==="backward"){let h=K.out._zod.run(w,P);if(h instanceof Promise)return h.then((M)=>U4(M,K.in,P));return U4(h,K.in,P)}let S=K.in._zod.run(w,P);if(S instanceof Promise)return S.then((h)=>U4(h,K.out,P));return U4(S,K.out,P)}});function U4(c,K,w){if(c.issues.length)return c.aborted=!0,c;return K._zod.run({value:c.value,issues:c.issues},w)}var A5=F("$ZodReadonly",(c,K)=>{Oc.init(c,K),Kc(c._zod,"propValues",()=>K.innerType._zod.propValues),Kc(c._zod,"values",()=>K.innerType._zod.values),Kc(c._zod,"optin",()=>K.innerType._zod.optin),Kc(c._zod,"optout",()=>K.innerType._zod.optout),c._zod.parse=(w,P)=>{if(P.direction==="backward")return K.innerType._zod.run(w,P);let S=K.innerType._zod.run(w,P);if(S instanceof Promise)return S.then(lK);return lK(S)}});function lK(c){return c.value=Object.freeze(c.value),c}var r5=F("$ZodCustom",(c,K)=>{Vc.init(c,K),Oc.init(c,K),c._zod.parse=(w,P)=>{return w},c._zod.check=(w)=>{let P=w.value,S=K.fn(P);if(S instanceof Promise)return S.then((h)=>TK(h,w,P,c));TK(S,w,P,c);return}});function TK(c,K,w,P){if(!c){let S={code:"custom",input:w,inst:P,path:[...P._zod.def.path??[]],continue:!P._zod.def.abort};if(P._zod.def.params)S.params=P._zod.def.params;K.issues.push(R2(S))}}var CP=Symbol("ZodOutput"),yP=Symbol("ZodInput");class o5{constructor(){this._map=new WeakMap,this._idmap=new Map}add(c,...K){let w=K[0];if(this._map.set(c,w),w&&typeof w==="object"&&"id"in w){if(this._idmap.has(w.id))throw Error(`ID ${w.id} already exists in the registry`);this._idmap.set(w.id,c)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(c){let K=this._map.get(c);if(K&&typeof K==="object"&&"id"in K)this._idmap.delete(K.id);return this._map.delete(c),this}get(c){let K=c._zod.parent;if(K){let w={...this.get(K)??{}};delete w.id;let P={...w,...this._map.get(c)};return Object.keys(P).length?P:void 0}return this._map.get(c)}has(c){return this._map.has(c)}}function r1(){return new o5}var p2=r1();function m5(c,K){return new c({type:"string",...e(K)})}function Q6(c,K){return new c({type:"string",format:"email",check:"string_format",abort:!1,...e(K)})}function U6(c,K){return new c({type:"string",format:"guid",check:"string_format",abort:!1,...e(K)})}function u5(c,K){return new c({type:"string",format:"uuid",check:"string_format",abort:!1,...e(K)})}function C5(c,K){return new c({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...e(K)})}function y5(c,K){return new c({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...e(K)})}function _5(c,K){return new c({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...e(K)})}function f5(c,K){return new c({type:"string",format:"url",check:"string_format",abort:!1,...e(K)})}function e5(c,K){return new c({type:"string",format:"emoji",check:"string_format",abort:!1,...e(K)})}function p5(c,K){return new c({type:"string",format:"nanoid",check:"string_format",abort:!1,...e(K)})}function l5(c,K){return new c({type:"string",format:"cuid",check:"string_format",abort:!1,...e(K)})}function T5(c,K){return new c({type:"string",format:"cuid2",check:"string_format",abort:!1,...e(K)})}function n5(c,K){return new c({type:"string",format:"ulid",check:"string_format",abort:!1,...e(K)})}function i5(c,K){return new c({type:"string",format:"xid",check:"string_format",abort:!1,...e(K)})}function t5(c,K){return new c({type:"string",format:"ksuid",check:"string_format",abort:!1,...e(K)})}function d5(c,K){return new c({type:"string",format:"ipv4",check:"string_format",abort:!1,...e(K)})}function s5(c,K){return new c({type:"string",format:"ipv6",check:"string_format",abort:!1,...e(K)})}function a5(c,K){return new c({type:"string",format:"cidrv4",check:"string_format",abort:!1,...e(K)})}function c3(c,K){return new c({type:"string",format:"cidrv6",check:"string_format",abort:!1,...e(K)})}function K3(c,K){return new c({type:"string",format:"base64",check:"string_format",abort:!1,...e(K)})}function w3(c,K){return new c({type:"string",format:"base64url",check:"string_format",abort:!1,...e(K)})}function P3(c,K){return new c({type:"string",format:"e164",check:"string_format",abort:!1,...e(K)})}function S3(c,K){return new c({type:"string",format:"jwt",check:"string_format",abort:!1,...e(K)})}function h3(c,K){return new c({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...e(K)})}function M3(c,K){return new c({type:"string",format:"date",check:"string_format",...e(K)})}function W3(c,K){return new c({type:"string",format:"time",check:"string_format",precision:null,...e(K)})}function I3(c,K){return new c({type:"string",format:"duration",check:"string_format",...e(K)})}function b3(c){return new c({type:"unknown"})}function O3(c,K){return new c({type:"never",...e(K)})}function V4(c,K){return new FK({check:"max_length",...e(K),maximum:c})}function g2(c,K){return new EK({check:"min_length",...e(K),minimum:c})}function L4(c,K){return new RK({check:"length_equals",...e(K),length:c})}function Y6(c,K){return new gK({check:"string_format",format:"regex",...e(K),pattern:c})}function H6(c){return new kK({check:"string_format",format:"lowercase",...e(c)})}function V6(c){return new xK({check:"string_format",format:"uppercase",...e(c)})}function L6(c,K){return new ZK({check:"string_format",format:"includes",...e(K),includes:c})}function q6(c,K){return new AK({check:"string_format",format:"starts_with",...e(K),prefix:c})}function v6(c,K){return new rK({check:"string_format",format:"ends_with",...e(K),suffix:c})}function $2(c){return new oK({check:"overwrite",tx:c})}function F6(c){return $2((K)=>K.normalize(c))}function E6(){return $2((c)=>c.trim())}function R6(){return $2((c)=>c.toLowerCase())}function g6(){return $2((c)=>c.toUpperCase())}function J3(c,K,w){return new c({type:"array",element:K,...e(w)})}function N3(c,K,w){return new c({type:"custom",check:"custom",fn:K,...e(w)})}function D3(c){let K=o1((w)=>{return w.addIssue=(P)=>{if(typeof P==="string")w.issues.push(R2(P,w.value,K._zod.def));else{let S=P;if(S.fatal)S.continue=!1;S.code??(S.code="custom"),S.input??(S.input=w.value),S.inst??(S.inst=K),S.continue??(S.continue=!K._zod.def.abort),w.issues.push(R2(S))}},c(w.value,w)});return K}function o1(c,K){let w=new Vc({check:"custom",...e(K)});return w._zod.check=c,w}var n1=F("ZodISODateTime",(c,K)=>{h5.init(c,K),Mc.init(c,K)});function G3(c){return h3(n1,c)}var i1=F("ZodISODate",(c,K)=>{M5.init(c,K),Mc.init(c,K)});function j3(c){return M3(i1,c)}var t1=F("ZodISOTime",(c,K)=>{W5.init(c,K),Mc.init(c,K)});function X3(c){return W3(t1,c)}var d1=F("ZodISODuration",(c,K)=>{I5.init(c,K),Mc.init(c,K)});function B3(c){return I3(d1,c)}var z3=(c,K)=>{B4.init(c,K),c.name="ZodError",Object.defineProperties(c,{format:{value:(w)=>l8(c,w)},flatten:{value:(w)=>p8(c,w)},addIssue:{value:(w)=>{c.issues.push(w),c.message=JSON.stringify(c.issues,E2,2)}},addIssues:{value:(w)=>{c.issues.push(...w),c.message=JSON.stringify(c.issues,E2,2)}},isEmpty:{get(){return c.issues.length===0}}})},BS=F("ZodError",z3),Lc=F("ZodError",z3,{Parent:Error});var $3=z4(Lc),Q3=$4(Lc),U3=_2(Lc),Y3=f2(Lc),H3=i8(Lc),V3=t8(Lc),L3=d8(Lc),q3=s8(Lc),v3=a8(Lc),F3=cK(Lc),E3=KK(Lc),R3=wK(Lc);var Dc=F("ZodType",(c,K)=>{return Oc.init(c,K),c.def=K,c.type=K.type,Object.defineProperty(c,"_def",{value:K}),c.check=(...w)=>{return c.clone({...K,checks:[...K.checks??[],...w.map((P)=>typeof P==="function"?{_zod:{check:P,def:{check:"custom"},onattach:[]}}:P)]})},c.clone=(w,P)=>xc(c,w,P),c.brand=()=>c,c.register=(w,P)=>{return w.add(c,P),c},c.parse=(w,P)=>$3(c,w,P,{callee:c.parse}),c.safeParse=(w,P)=>U3(c,w,P),c.parseAsync=async(w,P)=>Q3(c,w,P,{callee:c.parseAsync}),c.safeParseAsync=async(w,P)=>Y3(c,w,P),c.spa=c.safeParseAsync,c.encode=(w,P)=>H3(c,w,P),c.decode=(w,P)=>V3(c,w,P),c.encodeAsync=async(w,P)=>L3(c,w,P),c.decodeAsync=async(w,P)=>q3(c,w,P),c.safeEncode=(w,P)=>v3(c,w,P),c.safeDecode=(w,P)=>F3(c,w,P),c.safeEncodeAsync=async(w,P)=>E3(c,w,P),c.safeDecodeAsync=async(w,P)=>R3(c,w,P),c.refine=(w,P)=>c.check(f9(w,P)),c.superRefine=(w)=>c.check(e9(w)),c.overwrite=(w)=>c.check($2(w)),c.optional=()=>x3(c),c.nullable=()=>Z3(c),c.nullish=()=>x3(Z3(c)),c.nonoptional=(w)=>r9(c,w),c.array=()=>Y9(c),c.or=(w)=>L9([c,w]),c.and=(w)=>v9(c,w),c.transform=(w)=>A3(c,R9(w)),c.default=(w)=>x9(c,w),c.prefault=(w)=>A9(c,w),c.catch=(w)=>m9(c,w),c.pipe=(w)=>A3(c,w),c.readonly=()=>y9(c),c.describe=(w)=>{let P=c.clone();return p2.add(P,{description:w}),P},Object.defineProperty(c,"description",{get(){return p2.get(c)?.description},configurable:!0}),c.meta=(...w)=>{if(w.length===0)return p2.get(c);let P=c.clone();return p2.add(P,w[0]),P},c.isOptional=()=>c.safeParse(void 0).success,c.isNullable=()=>c.safeParse(null).success,c}),r3=F("_ZodString",(c,K)=>{H4.init(c,K),Dc.init(c,K);let w=c._zod.bag;c.format=w.format??null,c.minLength=w.minimum??null,c.maxLength=w.maximum??null,c.regex=(...P)=>c.check(Y6(...P)),c.includes=(...P)=>c.check(L6(...P)),c.startsWith=(...P)=>c.check(q6(...P)),c.endsWith=(...P)=>c.check(v6(...P)),c.min=(...P)=>c.check(g2(...P)),c.max=(...P)=>c.check(V4(...P)),c.length=(...P)=>c.check(L4(...P)),c.nonempty=(...P)=>c.check(g2(1,...P)),c.lowercase=(P)=>c.check(H6(P)),c.uppercase=(P)=>c.check(V6(P)),c.trim=()=>c.check(E6()),c.normalize=(...P)=>c.check(F6(...P)),c.toLowerCase=()=>c.check(R6()),c.toUpperCase=()=>c.check(g6())}),K9=F("ZodString",(c,K)=>{H4.init(c,K),r3.init(c,K),c.email=(w)=>c.check(Q6(m3,w)),c.url=(w)=>c.check(f5(w9,w)),c.jwt=(w)=>c.check(S3(B9,w)),c.emoji=(w)=>c.check(e5(P9,w)),c.guid=(w)=>c.check(U6(g3,w)),c.uuid=(w)=>c.check(u5(v4,w)),c.uuidv4=(w)=>c.check(C5(v4,w)),c.uuidv6=(w)=>c.check(y5(v4,w)),c.uuidv7=(w)=>c.check(_5(v4,w)),c.nanoid=(w)=>c.check(p5(S9,w)),c.guid=(w)=>c.check(U6(g3,w)),c.cuid=(w)=>c.check(l5(h9,w)),c.cuid2=(w)=>c.check(T5(M9,w)),c.ulid=(w)=>c.check(n5(W9,w)),c.base64=(w)=>c.check(K3(G9,w)),c.base64url=(w)=>c.check(w3(j9,w)),c.xid=(w)=>c.check(i5(I9,w)),c.ksuid=(w)=>c.check(t5(b9,w)),c.ipv4=(w)=>c.check(d5(O9,w)),c.ipv6=(w)=>c.check(s5(J9,w)),c.cidrv4=(w)=>c.check(a5(N9,w)),c.cidrv6=(w)=>c.check(c3(D9,w)),c.e164=(w)=>c.check(P3(X9,w)),c.datetime=(w)=>c.check(G3(w)),c.date=(w)=>c.check(j3(w)),c.time=(w)=>c.check(X3(w)),c.duration=(w)=>c.check(B3(w))});function o3(c){return m5(K9,c)}var Mc=F("ZodStringFormat",(c,K)=>{Sc.init(c,K),r3.init(c,K)}),m3=F("ZodEmail",(c,K)=>{tK.init(c,K),Mc.init(c,K)});function u3(c){return Q6(m3,c)}var g3=F("ZodGUID",(c,K)=>{nK.init(c,K),Mc.init(c,K)});var v4=F("ZodUUID",(c,K)=>{iK.init(c,K),Mc.init(c,K)});var w9=F("ZodURL",(c,K)=>{dK.init(c,K),Mc.init(c,K)});var P9=F("ZodEmoji",(c,K)=>{sK.init(c,K),Mc.init(c,K)});var S9=F("ZodNanoID",(c,K)=>{aK.init(c,K),Mc.init(c,K)});var h9=F("ZodCUID",(c,K)=>{c5.init(c,K),Mc.init(c,K)});var M9=F("ZodCUID2",(c,K)=>{K5.init(c,K),Mc.init(c,K)});var W9=F("ZodULID",(c,K)=>{w5.init(c,K),Mc.init(c,K)});var I9=F("ZodXID",(c,K)=>{P5.init(c,K),Mc.init(c,K)});var b9=F("ZodKSUID",(c,K)=>{S5.init(c,K),Mc.init(c,K)});var O9=F("ZodIPv4",(c,K)=>{b5.init(c,K),Mc.init(c,K)});var J9=F("ZodIPv6",(c,K)=>{O5.init(c,K),Mc.init(c,K)});var N9=F("ZodCIDRv4",(c,K)=>{J5.init(c,K),Mc.init(c,K)});var D9=F("ZodCIDRv6",(c,K)=>{N5.init(c,K),Mc.init(c,K)});var G9=F("ZodBase64",(c,K)=>{G5.init(c,K),Mc.init(c,K)});var j9=F("ZodBase64URL",(c,K)=>{j5.init(c,K),Mc.init(c,K)});var X9=F("ZodE164",(c,K)=>{X5.init(c,K),Mc.init(c,K)});var B9=F("ZodJWT",(c,K)=>{B5.init(c,K),Mc.init(c,K)});var z9=F("ZodUnknown",(c,K)=>{z5.init(c,K),Dc.init(c,K)});function k3(){return b3(z9)}var $9=F("ZodNever",(c,K)=>{$5.init(c,K),Dc.init(c,K)});function Q9(c){return O3($9,c)}var U9=F("ZodArray",(c,K)=>{Q5.init(c,K),Dc.init(c,K),c.element=K.element,c.min=(w,P)=>c.check(g2(w,P)),c.nonempty=(w)=>c.check(g2(1,w)),c.max=(w,P)=>c.check(V4(w,P)),c.length=(w,P)=>c.check(L4(w,P)),c.unwrap=()=>c.element});function Y9(c,K){return J3(U9,c,K)}var H9=F("ZodObject",(c,K)=>{H5.init(c,K),Dc.init(c,K),a.defineLazy(c,"shape",()=>K.shape),c.keyof=()=>F9(Object.keys(c._zod.def.shape)),c.catchall=(w)=>c.clone({...c._zod.def,catchall:w}),c.passthrough=()=>c.clone({...c._zod.def,catchall:k3()}),c.loose=()=>c.clone({...c._zod.def,catchall:k3()}),c.strict=()=>c.clone({...c._zod.def,catchall:Q9()}),c.strip=()=>c.clone({...c._zod.def,catchall:void 0}),c.extend=(w)=>{return a.extend(c,w)},c.safeExtend=(w)=>{return a.safeExtend(c,w)},c.merge=(w)=>a.merge(c,w),c.pick=(w)=>a.pick(c,w),c.omit=(w)=>a.omit(c,w),c.partial=(...w)=>a.partial(y3,c,w[0]),c.required=(...w)=>a.required(_3,c,w[0])});function C3(c,K){let w={type:"object",get shape(){return a.assignProp(this,"shape",c?a.objectClone(c):{}),this.shape},...a.normalizeParams(K)};return new H9(w)}var V9=F("ZodUnion",(c,K)=>{V5.init(c,K),Dc.init(c,K),c.options=K.options});function L9(c,K){return new V9({type:"union",options:c,...a.normalizeParams(K)})}var q9=F("ZodIntersection",(c,K)=>{L5.init(c,K),Dc.init(c,K)});function v9(c,K){return new q9({type:"intersection",left:c,right:K})}var k6=F("ZodEnum",(c,K)=>{q5.init(c,K),Dc.init(c,K),c.enum=K.entries,c.options=Object.values(K.entries);let w=new Set(Object.keys(K.entries));c.extract=(P,S)=>{let h={};for(let M of P)if(w.has(M))h[M]=K.entries[M];else throw Error(`Key ${M} not found in enum`);return new k6({...K,checks:[],...a.normalizeParams(S),entries:h})},c.exclude=(P,S)=>{let h={...K.entries};for(let M of P)if(w.has(M))delete h[M];else throw Error(`Key ${M} not found in enum`);return new k6({...K,checks:[],...a.normalizeParams(S),entries:h})}});function F9(c,K){let w=Array.isArray(c)?Object.fromEntries(c.map((P)=>[P,P])):c;return new k6({type:"enum",entries:w,...a.normalizeParams(K)})}var E9=F("ZodTransform",(c,K)=>{v5.init(c,K),Dc.init(c,K),c._zod.parse=(w,P)=>{if(P.direction==="backward")throw new A2(c.constructor.name);w.addIssue=(h)=>{if(typeof h==="string")w.issues.push(a.issue(h,w.value,K));else{let M=h;if(M.fatal)M.continue=!1;M.code??(M.code="custom"),M.input??(M.input=w.value),M.inst??(M.inst=c),w.issues.push(a.issue(M))}};let S=K.transform(w.value,w);if(S instanceof Promise)return S.then((h)=>{return w.value=h,w});return w.value=S,w}});function R9(c){return new E9({type:"transform",transform:c})}var y3=F("ZodOptional",(c,K)=>{F5.init(c,K),Dc.init(c,K),c.unwrap=()=>c._zod.def.innerType});function x3(c){return new y3({type:"optional",innerType:c})}var g9=F("ZodNullable",(c,K)=>{E5.init(c,K),Dc.init(c,K),c.unwrap=()=>c._zod.def.innerType});function Z3(c){return new g9({type:"nullable",innerType:c})}var k9=F("ZodDefault",(c,K)=>{R5.init(c,K),Dc.init(c,K),c.unwrap=()=>c._zod.def.innerType,c.removeDefault=c.unwrap});function x9(c,K){return new k9({type:"default",innerType:c,get defaultValue(){return typeof K==="function"?K():a.shallowClone(K)}})}var Z9=F("ZodPrefault",(c,K)=>{g5.init(c,K),Dc.init(c,K),c.unwrap=()=>c._zod.def.innerType});function A9(c,K){return new Z9({type:"prefault",innerType:c,get defaultValue(){return typeof K==="function"?K():a.shallowClone(K)}})}var _3=F("ZodNonOptional",(c,K)=>{k5.init(c,K),Dc.init(c,K),c.unwrap=()=>c._zod.def.innerType});function r9(c,K){return new _3({type:"nonoptional",innerType:c,...a.normalizeParams(K)})}var o9=F("ZodCatch",(c,K)=>{x5.init(c,K),Dc.init(c,K),c.unwrap=()=>c._zod.def.innerType,c.removeCatch=c.unwrap});function m9(c,K){return new o9({type:"catch",innerType:c,catchValue:typeof K==="function"?K:()=>K})}var u9=F("ZodPipe",(c,K)=>{Z5.init(c,K),Dc.init(c,K),c.in=K.in,c.out=K.out});function A3(c,K){return new u9({type:"pipe",in:c,out:K})}var C9=F("ZodReadonly",(c,K)=>{A5.init(c,K),Dc.init(c,K),c.unwrap=()=>c._zod.def.innerType});function y9(c){return new C9({type:"readonly",innerType:c})}var _9=F("ZodCustom",(c,K)=>{r5.init(c,K),Dc.init(c,K)});function f9(c,K={}){return N3(_9,c,K)}function e9(c){return D3(c)}class F4{configs;options;#c=x2.ETokenAudiences.SYSTEM;token;constructor(c,K){this.configs=c;this.options=K}async signToken(){try{let c=new Uint8Array(Buffer.from(this.configs.secretKey,"base64")),K=await crypto.subtle.importKey("raw",c,{name:"HMAC",hash:"SHA-512"},!1,["sign","verify"]),w=await new D4({tenantId:this.configs.tenantId,appId:this.configs.appId,modeId:this.configs.modeId,iss:this.configs.tenantId,aud:x2.ETokenAudiences.SYSTEM}).setProtectedHeader({alg:"HS512"}).sign(K);return this.token=w,w}catch(c){if(this.options?.logs)console.error("[BoolGuard] Sign token error:",c);throw c}}async ping(){try{let c=this.token||await this.signToken(),K=new Headers;K.append("X-Tenant-ID",this.configs.tenantId),K.append("X-App-ID",this.configs.appId),K.append("X-Mode-ID",this.configs.modeId),K.append("Authorization",`Bearer ${c}`);let w=await fetch(`${this.#c}/v${this.options?.version}/tenant-app-modes/ping`,{method:"GET",headers:K});if(!w.ok)throw await w.json();return w.ok}catch(c){if(this.options?.logs)console.error("[BoolGuard] Ping error:",c);return!1}}async createPlainAccount({identity:c,password:K,metadata:w}){try{let P=this.token||await this.signToken(),S=new Headers;S.append("X-Tenant-ID",this.configs.tenantId),S.append("X-App-ID",this.configs.appId),S.append("X-Mode-ID",this.configs.modeId),S.append("Authorization",`Bearer ${P}`),S.append("Content-Type","application/json");let h=await fetch(`${this.#c}/v${this.options?.version}/tenant-app-mode-accounts`,{method:"POST",headers:S,body:JSON.stringify({data:{type:"plain",identity:c,password:K,metadata:w}})});if(!h.ok)throw await h.json();let{data:M}=await h.json();return Object.freeze({account:M.account,credential:M.credential})}catch(P){if(this.options?.logs)console.error("[BoolGuard] Create plain account error:",P);throw P}}async createEmailAccount({identity:c,password:K,metadata:w}){try{let P=this.token||await this.signToken(),S=new Headers;S.append("X-Tenant-ID",this.configs.tenantId),S.append("X-App-ID",this.configs.appId),S.append("X-Mode-ID",this.configs.modeId),S.append("Authorization",`Bearer ${P}`),S.append("Content-Type","application/json");let h=await fetch(`${this.#c}/v${this.options?.version}/tenant-app-mode-accounts`,{method:"POST",headers:S,body:JSON.stringify({data:{type:"email",identity:c,password:K,metadata:w}})});if(!h.ok)throw await h.json();let{data:M}=await h.json();return Object.freeze({account:M.account,credential:M.credential})}catch(P){if(this.options?.logs)console.error("[BoolGuard] Create email account error:",P);throw P}}async authenticate({identity:c,password:K}){try{let w=this.token||await this.signToken(),P=await u3().safeParseAsync(c),S=new Headers;S.append("X-Tenant-ID",this.configs.tenantId),S.append("X-App-ID",this.configs.appId),S.append("X-Mode-ID",this.configs.modeId),S.append("Authorization",`Bearer ${w}`),S.append("Content-Type","application/json");let h=await fetch(`${this.#c}/v${this.options?.version}/tenant-app-mode-accounts/authenticate`,{method:"POST",headers:S,body:JSON.stringify({data:{type:!P.success?"plain":"email",identity:c,password:K}})});if(!h.ok)throw await h.json();let{data:M}=await h.json();return Object.freeze({account:M.account,credential:M.credential,token:M.token})}catch(w){if(this.options?.logs)console.error("[BoolGuard] Authenticate error:",w);throw w}}async verifyToken({token:c}){try{let K=this.token||await this.signToken(),w=new Headers;w.append("X-Tenant-ID",this.configs.tenantId),w.append("X-App-ID",this.configs.appId),w.append("X-Mode-ID",this.configs.modeId),w.append("Authorization",`Bearer ${K}`),w.append("Content-Type","application/json");let P=await fetch(`${this.#c}/v${this.options?.version}/tenant-app-mode-accounts/verify`,{method:"POST",headers:w,body:JSON.stringify({data:{token:c}})});if(!P.ok)throw await P.json();let{data:S}=await P.json();return Object.freeze({account:S.account,credential:S.credential})}catch(K){if(this.options?.logs)console.error("[BoolGuard] Verify token error:",K);throw K}}}var Qh=async(c,K)=>{let w=new F4(c,K);if(await w.signToken(),!await w.ping())throw Error("Ping to Bool Guard service failed!");return[Nc.guardClient,w]};var p9=C3({authorization:o3().startsWith("Bearer ").min(24).transform((c)=>{let[K,w]=c.split(" ");return Object.freeze({schema:K,token:w})})});class x6{clientInstance;constructor(c){this.clientInstance=c}async start(c,K){let w=await p9.safeParseAsync(K.toJSON());if(!w.success)return c.set(Nc.authState,void 0);else{let{authorization:{token:P}}=w.data;try{let{account:S,credential:h}=await this.clientInstance.verifyToken({token:P}),M=Object.freeze({account:S,credential:h});return c.set(Nc.authState,M)}catch(S){return console.error(S),c.set(Nc.authState,void 0)}}}}Y2([O2(0,I4()),O2(1,M8())],x6.prototype,"start",null),x6=Y2([O8(),O2(0,I8(Nc.guardClient))],x6);export{Qh as loader,x6 as Middleware,Nc as Keys,a4 as Interceptor,x2 as Enums,n0 as ControllerGuard,F4 as Client,s4 as AuthState,t3 as ActionGuard};
54
+ `)}L.write("payload.value = newResult;"),L.write("return payload;");let u=L.compile();return(o,z)=>u(B,o,z)},I,b=q2,D=!$K.jitless,M=D&&M1.value,N=K.catchall,Q;w._zod.parse=(B,L)=>{Q??(Q=J.value);let g=B.value;if(!b(g))return B.issues.push({expected:"object",code:"invalid_type",input:g,inst:w}),B;if(D&&M&&L?.async===!1&&L.jitless!==!0){if(!I)I=P(K.shape);if(B=I(B,L),!N)return B;return j8([],g,B,L,Q,w)}return W(B,L)}});function d6(w,K,W,J){for(let I of w)if(I.issues.length===0)return K.value=I.value,K;let P=w.filter((I)=>!K2(I));if(P.length===1)return K.value=P[0].value,P[0];return K.issues.push({code:"invalid_union",input:K.value,inst:W,errors:w.map((I)=>I.issues.map((b)=>mw(b,J,gw())))}),K}var k8=h("$ZodUnion",(w,K)=>{Nw.init(w,K),Iw(w._zod,"optin",()=>K.options.some((P)=>P._zod.optin==="optional")?"optional":void 0),Iw(w._zod,"optout",()=>K.options.some((P)=>P._zod.optout==="optional")?"optional":void 0),Iw(w._zod,"values",()=>{if(K.options.every((P)=>P._zod.values))return new Set(K.options.flatMap((P)=>Array.from(P._zod.values)));return}),Iw(w._zod,"pattern",()=>{if(K.options.every((P)=>P._zod.pattern)){let P=K.options.map((I)=>I._zod.pattern);return new RegExp(`^(${P.map((I)=>p2(I.source)).join("|")})$`)}return});let W=K.options.length===1,J=K.options[0]._zod.run;w._zod.parse=(P,I)=>{if(W)return J(P,I);let b=!1,D=[];for(let A of K.options){let M=A._zod.run({value:P.value,issues:[]},I);if(M instanceof Promise)D.push(M),b=!0;else{if(M.issues.length===0)return M;D.push(M)}}if(!b)return d6(D,P,w,I);return Promise.all(D).then((A)=>{return d6(A,P,w,I)})}});var g8=h("$ZodIntersection",(w,K)=>{Nw.init(w,K),w._zod.parse=(W,J)=>{let P=W.value,I=K.left._zod.run({value:P,issues:[]},J),b=K.right._zod.run({value:P,issues:[]},J);if(I instanceof Promise||b instanceof Promise)return Promise.all([I,b]).then(([A,M])=>{return n6(W,A,M)});return n6(W,I,b)}});function L1(w,K){if(w===K)return{valid:!0,data:w};if(w instanceof Date&&K instanceof Date&&+w===+K)return{valid:!0,data:w};if(N2(w)&&N2(K)){let W=Object.keys(K),J=Object.keys(w).filter((I)=>W.indexOf(I)!==-1),P={...w,...K};for(let I of J){let b=L1(w[I],K[I]);if(!b.valid)return{valid:!1,mergeErrorPath:[I,...b.mergeErrorPath]};P[I]=b.data}return{valid:!0,data:P}}if(Array.isArray(w)&&Array.isArray(K)){if(w.length!==K.length)return{valid:!1,mergeErrorPath:[]};let W=[];for(let J=0;J<w.length;J++){let P=w[J],I=K[J],b=L1(P,I);if(!b.valid)return{valid:!1,mergeErrorPath:[J,...b.mergeErrorPath]};W.push(b.data)}return{valid:!0,data:W}}return{valid:!1,mergeErrorPath:[]}}function n6(w,K,W){let J=new Map,P;for(let D of K.issues)if(D.code==="unrecognized_keys"){P??(P=D);for(let A of D.keys){if(!J.has(A))J.set(A,{});J.get(A).l=!0}}else w.issues.push(D);for(let D of W.issues)if(D.code==="unrecognized_keys")for(let A of D.keys){if(!J.has(A))J.set(A,{});J.get(A).r=!0}else w.issues.push(D);let I=[...J].filter(([,D])=>D.l&&D.r).map(([D])=>D);if(I.length&&P)w.issues.push({...P,keys:I});if(K2(w))return w;let b=L1(K.value,W.value);if(!b.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(b.mergeErrorPath)}`);return w.value=b.data,w}var C8=h("$ZodEnum",(w,K)=>{Nw.init(w,K);let W=m2(K.entries),J=new Set(W);w._zod.values=J,w._zod.pattern=new RegExp(`^(${W.filter((P)=>O1.has(typeof P)).map((P)=>typeof P==="string"?Q2(P):P.toString()).join("|")})$`),w._zod.parse=(P,I)=>{let b=P.value;if(J.has(b))return P;return P.issues.push({code:"invalid_value",values:W,input:b,inst:w}),P}});var o8=h("$ZodTransform",(w,K)=>{Nw.init(w,K),w._zod.parse=(W,J)=>{if(J.direction==="backward")throw new u2(w.constructor.name);let P=K.transform(W.value,W);if(J.async)return(P instanceof Promise?P:Promise.resolve(P)).then((b)=>{return W.value=b,W});if(P instanceof Promise)throw new ew;return W.value=P,W}});function t6(w,K){if(w.issues.length&&K===void 0)return{issues:[],value:void 0};return w}var E1=h("$ZodOptional",(w,K)=>{Nw.init(w,K),w._zod.optin="optional",w._zod.optout="optional",Iw(w._zod,"values",()=>{return K.innerType._zod.values?new Set([...K.innerType._zod.values,void 0]):void 0}),Iw(w._zod,"pattern",()=>{let W=K.innerType._zod.pattern;return W?new RegExp(`^(${p2(W.source)})?$`):void 0}),w._zod.parse=(W,J)=>{if(K.innerType._zod.optin==="optional"){let P=K.innerType._zod.run(W,J);if(P instanceof Promise)return P.then((I)=>t6(I,W.value));return t6(P,W.value)}if(W.value===void 0)return W;return K.innerType._zod.run(W,J)}}),x8=h("$ZodExactOptional",(w,K)=>{E1.init(w,K),Iw(w._zod,"values",()=>K.innerType._zod.values),Iw(w._zod,"pattern",()=>K.innerType._zod.pattern),w._zod.parse=(W,J)=>{return K.innerType._zod.run(W,J)}}),c8=h("$ZodNullable",(w,K)=>{Nw.init(w,K),Iw(w._zod,"optin",()=>K.innerType._zod.optin),Iw(w._zod,"optout",()=>K.innerType._zod.optout),Iw(w._zod,"pattern",()=>{let W=K.innerType._zod.pattern;return W?new RegExp(`^(${p2(W.source)}|null)$`):void 0}),Iw(w._zod,"values",()=>{return K.innerType._zod.values?new Set([...K.innerType._zod.values,null]):void 0}),w._zod.parse=(W,J)=>{if(W.value===null)return W;return K.innerType._zod.run(W,J)}}),r8=h("$ZodDefault",(w,K)=>{Nw.init(w,K),w._zod.optin="optional",Iw(w._zod,"values",()=>K.innerType._zod.values),w._zod.parse=(W,J)=>{if(J.direction==="backward")return K.innerType._zod.run(W,J);if(W.value===void 0)return W.value=K.defaultValue,W;let P=K.innerType._zod.run(W,J);if(P instanceof Promise)return P.then((I)=>a6(I,K));return a6(P,K)}});function a6(w,K){if(w.value===void 0)w.value=K.defaultValue;return w}var _8=h("$ZodPrefault",(w,K)=>{Nw.init(w,K),w._zod.optin="optional",Iw(w._zod,"values",()=>K.innerType._zod.values),w._zod.parse=(W,J)=>{if(J.direction==="backward")return K.innerType._zod.run(W,J);if(W.value===void 0)W.value=K.defaultValue;return K.innerType._zod.run(W,J)}}),u8=h("$ZodNonOptional",(w,K)=>{Nw.init(w,K),Iw(w._zod,"values",()=>{let W=K.innerType._zod.values;return W?new Set([...W].filter((J)=>J!==void 0)):void 0}),w._zod.parse=(W,J)=>{let P=K.innerType._zod.run(W,J);if(P instanceof Promise)return P.then((I)=>s6(I,w));return s6(P,w)}});function s6(w,K){if(!w.issues.length&&w.value===void 0)w.issues.push({code:"invalid_type",expected:"nonoptional",input:w.value,inst:K});return w}var y8=h("$ZodCatch",(w,K)=>{Nw.init(w,K),Iw(w._zod,"optin",()=>K.innerType._zod.optin),Iw(w._zod,"optout",()=>K.innerType._zod.optout),Iw(w._zod,"values",()=>K.innerType._zod.values),w._zod.parse=(W,J)=>{if(J.direction==="backward")return K.innerType._zod.run(W,J);let P=K.innerType._zod.run(W,J);if(P instanceof Promise)return P.then((I)=>{if(W.value=I.value,I.issues.length)W.value=K.catchValue({...W,error:{issues:I.issues.map((b)=>mw(b,J,gw()))},input:W.value}),W.issues=[];return W});if(W.value=P.value,P.issues.length)W.value=K.catchValue({...W,error:{issues:P.issues.map((I)=>mw(I,J,gw()))},input:W.value}),W.issues=[];return W}});var m8=h("$ZodPipe",(w,K)=>{Nw.init(w,K),Iw(w._zod,"values",()=>K.in._zod.values),Iw(w._zod,"optin",()=>K.in._zod.optin),Iw(w._zod,"optout",()=>K.out._zod.optout),Iw(w._zod,"propValues",()=>K.in._zod.propValues),w._zod.parse=(W,J)=>{if(J.direction==="backward"){let I=K.out._zod.run(W,J);if(I instanceof Promise)return I.then((b)=>qK(b,K.in,J));return qK(I,K.in,J)}let P=K.in._zod.run(W,J);if(P instanceof Promise)return P.then((I)=>qK(I,K.out,J));return qK(P,K.out,J)}});function qK(w,K,W){if(w.issues.length)return w.aborted=!0,w;return K._zod.run({value:w.value,issues:w.issues},W)}var T8=h("$ZodReadonly",(w,K)=>{Nw.init(w,K),Iw(w._zod,"propValues",()=>K.innerType._zod.propValues),Iw(w._zod,"values",()=>K.innerType._zod.values),Iw(w._zod,"optin",()=>K.innerType?._zod?.optin),Iw(w._zod,"optout",()=>K.innerType?._zod?.optout),w._zod.parse=(W,J)=>{if(J.direction==="backward")return K.innerType._zod.run(W,J);let P=K.innerType._zod.run(W,J);if(P instanceof Promise)return P.then(w8);return w8(P)}});function w8(w){return w.value=Object.freeze(w.value),w}var l8=h("$ZodCustom",(w,K)=>{jw.init(w,K),Nw.init(w,K),w._zod.parse=(W,J)=>{return W},w._zod.check=(W)=>{let J=W.value,P=K.fn(J);if(P instanceof Promise)return P.then((I)=>K8(I,W,J,w));K8(P,W,J,w);return}});function K8(w,K,W,J){if(!w){let P={code:"custom",input:W,inst:J,path:[...J._zod.def.path??[]],continue:!J._zod.def.abort};if(J._zod.def.params)P.params=J._zod.def.params;K.issues.push(F2(P))}}var U9=()=>{let w={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function K(P){return w[P]??null}let W={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},J={nan:"NaN"};return(P)=>{switch(P.code){case"invalid_type":{let I=J[P.expected]??P.expected,b=N1(P.input),D=J[b]??b;return`Invalid input: expected ${I}, received ${D}`}case"invalid_value":if(P.values.length===1)return`Invalid input: expected ${LK(P.values[0])}`;return`Invalid option: expected one of ${YK(P.values,"|")}`;case"too_big":{let I=P.inclusive?"<=":"<",b=K(P.origin);if(b)return`Too big: expected ${P.origin??"value"} to have ${I}${P.maximum.toString()} ${b.unit??"elements"}`;return`Too big: expected ${P.origin??"value"} to be ${I}${P.maximum.toString()}`}case"too_small":{let I=P.inclusive?">=":">",b=K(P.origin);if(b)return`Too small: expected ${P.origin} to have ${I}${P.minimum.toString()} ${b.unit}`;return`Too small: expected ${P.origin} to be ${I}${P.minimum.toString()}`}case"invalid_format":{let I=P;if(I.format==="starts_with")return`Invalid string: must start with "${I.prefix}"`;if(I.format==="ends_with")return`Invalid string: must end with "${I.suffix}"`;if(I.format==="includes")return`Invalid string: must include "${I.includes}"`;if(I.format==="regex")return`Invalid string: must match pattern ${I.pattern}`;return`Invalid ${W[I.format]??P.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${P.divisor}`;case"unrecognized_keys":return`Unrecognized key${P.keys.length>1?"s":""}: ${YK(P.keys,", ")}`;case"invalid_key":return`Invalid key in ${P.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${P.origin}`;default:return"Invalid input"}}};function U1(){return{localeError:U9()}}var p8,H9=Symbol("ZodOutput"),q9=Symbol("ZodInput");class f8{constructor(){this._map=new WeakMap,this._idmap=new Map}add(w,...K){let W=K[0];if(this._map.set(w,W),W&&typeof W==="object"&&"id"in W)this._idmap.set(W.id,w);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(w){let K=this._map.get(w);if(K&&typeof K==="object"&&"id"in K)this._idmap.delete(K.id);return this._map.delete(w),this}get(w){let K=w._zod.parent;if(K){let W={...this.get(K)??{}};delete W.id;let J={...W,...this._map.get(w)};return Object.keys(J).length?J:void 0}return this._map.get(w)}has(w){return this._map.has(w)}}function e8(){return new f8}(p8=globalThis).__zod_globalRegistry??(p8.__zod_globalRegistry=e8());var W2=globalThis.__zod_globalRegistry;function i8(w,K){return new w({type:"string",...e(K)})}function H1(w,K){return new w({type:"string",format:"email",check:"string_format",abort:!1,...e(K)})}function q1(w,K){return new w({type:"string",format:"guid",check:"string_format",abort:!1,...e(K)})}function d8(w,K){return new w({type:"string",format:"uuid",check:"string_format",abort:!1,...e(K)})}function n8(w,K){return new w({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...e(K)})}function t8(w,K){return new w({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...e(K)})}function a8(w,K){return new w({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...e(K)})}function s8(w,K){return new w({type:"string",format:"url",check:"string_format",abort:!1,...e(K)})}function w3(w,K){return new w({type:"string",format:"emoji",check:"string_format",abort:!1,...e(K)})}function K3(w,K){return new w({type:"string",format:"nanoid",check:"string_format",abort:!1,...e(K)})}function W3(w,K){return new w({type:"string",format:"cuid",check:"string_format",abort:!1,...e(K)})}function J3(w,K){return new w({type:"string",format:"cuid2",check:"string_format",abort:!1,...e(K)})}function P3(w,K){return new w({type:"string",format:"ulid",check:"string_format",abort:!1,...e(K)})}function I3(w,K){return new w({type:"string",format:"xid",check:"string_format",abort:!1,...e(K)})}function b3(w,K){return new w({type:"string",format:"ksuid",check:"string_format",abort:!1,...e(K)})}function D3(w,K){return new w({type:"string",format:"ipv4",check:"string_format",abort:!1,...e(K)})}function G3(w,K){return new w({type:"string",format:"ipv6",check:"string_format",abort:!1,...e(K)})}function A3(w,K){return new w({type:"string",format:"cidrv4",check:"string_format",abort:!1,...e(K)})}function M3(w,K){return new w({type:"string",format:"cidrv6",check:"string_format",abort:!1,...e(K)})}function O3(w,K){return new w({type:"string",format:"base64",check:"string_format",abort:!1,...e(K)})}function B3(w,K){return new w({type:"string",format:"base64url",check:"string_format",abort:!1,...e(K)})}function N3(w,K){return new w({type:"string",format:"e164",check:"string_format",abort:!1,...e(K)})}function h1(w,K){return new w({type:"string",format:"jwt",check:"string_format",abort:!1,...e(K)})}function Q3(w,K){return new w({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...e(K)})}function S3(w,K){return new w({type:"string",format:"date",check:"string_format",...e(K)})}function $3(w,K){return new w({type:"string",format:"time",check:"string_format",precision:null,...e(K)})}function Y3(w,K){return new w({type:"string",format:"duration",check:"string_format",...e(K)})}function X3(w){return new w({type:"unknown"})}function V3(w,K){return new w({type:"never",...e(K)})}function zK(w,K){return new x6({check:"max_length",...e(K),maximum:w})}function z2(w,K){return new c6({check:"min_length",...e(K),minimum:w})}function RK(w,K){return new r6({check:"length_equals",...e(K),length:w})}function F1(w,K){return new _6({check:"string_format",format:"regex",...e(K),pattern:w})}function z1(w){return new u6({check:"string_format",format:"lowercase",...e(w)})}function R1(w){return new y6({check:"string_format",format:"uppercase",...e(w)})}function v1(w,K){return new m6({check:"string_format",format:"includes",...e(K),includes:w})}function j1(w,K){return new T6({check:"string_format",format:"starts_with",...e(K),prefix:w})}function Z1(w,K){return new l6({check:"string_format",format:"ends_with",...e(K),suffix:w})}function J2(w){return new p6({check:"overwrite",tx:w})}function k1(w){return J2((K)=>K.normalize(w))}function g1(){return J2((w)=>w.trim())}function C1(){return J2((w)=>w.toLowerCase())}function o1(){return J2((w)=>w.toUpperCase())}function x1(){return J2((w)=>A1(w))}function L3(w,K,W){return new w({type:"array",element:K,...e(W)})}function E3(w,K,W){return new w({type:"custom",check:"custom",fn:K,...e(W)})}function U3(w){let K=h9((W)=>{return W.addIssue=(J)=>{if(typeof J==="string")W.issues.push(F2(J,W.value,K._zod.def));else{let P=J;if(P.fatal)P.continue=!1;P.code??(P.code="custom"),P.input??(P.input=W.value),P.inst??(P.inst=K),P.continue??(P.continue=!K._zod.def.abort),W.issues.push(F2(P))}},w(W.value,W)});return K}function h9(w,K){let W=new jw({check:"custom",...e(K)});return W._zod.check=w,W}function c1(w){let K=w?.target??"draft-2020-12";if(K==="draft-4")K="draft-04";if(K==="draft-7")K="draft-07";return{processors:w.processors??{},metadataRegistry:w?.metadata??W2,target:K,unrepresentable:w?.unrepresentable??"throw",override:w?.override??(()=>{}),io:w?.io??"output",counter:0,seen:new Map,cycles:w?.cycles??"ref",reused:w?.reused??"inline",external:w?.external??void 0}}function $w(w,K,W={path:[],schemaPath:[]}){var J;let P=w._zod.def,I=K.seen.get(w);if(I){if(I.count++,W.schemaPath.includes(w))I.cycle=W.path;return I.schema}let b={schema:{},count:1,cycle:void 0,path:W.path};K.seen.set(w,b);let D=w._zod.toJSONSchema?.();if(D)b.schema=D;else{let N={...W,schemaPath:[...W.schemaPath,w],path:W.path};if(w._zod.processJSONSchema)w._zod.processJSONSchema(K,b.schema,N);else{let B=b.schema,L=K.processors[P.type];if(!L)throw Error(`[toJSONSchema]: Non-representable type encountered: ${P.type}`);L(w,K,B,N)}let Q=w._zod.parent;if(Q){if(!b.ref)b.ref=Q;$w(Q,K,N),K.seen.get(Q).isParent=!0}}let A=K.metadataRegistry.get(w);if(A)Object.assign(b.schema,A);if(K.io==="input"&&Fw(w))delete b.schema.examples,delete b.schema.default;if(K.io==="input"&&b.schema._prefault)(J=b.schema).default??(J.default=b.schema._prefault);return delete b.schema._prefault,K.seen.get(w).schema}function r1(w,K){let W=w.seen.get(K);if(!W)throw Error("Unprocessed schema. This is a bug in Zod.");let J=new Map;for(let b of w.seen.entries()){let D=w.metadataRegistry.get(b[0])?.id;if(D){let A=J.get(D);if(A&&A!==b[0])throw Error(`Duplicate schema id "${D}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);J.set(D,b[0])}}let P=(b)=>{let D=w.target==="draft-2020-12"?"$defs":"definitions";if(w.external){let Q=w.external.registry.get(b[0])?.id,B=w.external.uri??((g)=>g);if(Q)return{ref:B(Q)};let L=b[1].defId??b[1].schema.id??`schema${w.counter++}`;return b[1].defId=L,{defId:L,ref:`${B("__shared")}#/${D}/${L}`}}if(b[1]===W)return{ref:"#"};let M=`${"#"}/${D}/`,N=b[1].schema.id??`__schema${w.counter++}`;return{defId:N,ref:M+N}},I=(b)=>{if(b[1].schema.$ref)return;let D=b[1],{ref:A,defId:M}=P(b);if(D.def={...D.schema},M)D.defId=M;let N=D.schema;for(let Q in N)delete N[Q];N.$ref=A};if(w.cycles==="throw")for(let b of w.seen.entries()){let D=b[1];if(D.cycle)throw Error(`Cycle detected: #/${D.cycle?.join("/")}/<root>
55
+
56
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let b of w.seen.entries()){let D=b[1];if(K===b[0]){I(b);continue}if(w.external){let M=w.external.registry.get(b[0])?.id;if(K!==b[0]&&M){I(b);continue}}if(w.metadataRegistry.get(b[0])?.id){I(b);continue}if(D.cycle){I(b);continue}if(D.count>1){if(w.reused==="ref"){I(b);continue}}}}function _1(w,K){let W=w.seen.get(K);if(!W)throw Error("Unprocessed schema. This is a bug in Zod.");let J=(b)=>{let D=w.seen.get(b);if(D.ref===null)return;let A=D.def??D.schema,M={...A},N=D.ref;if(D.ref=null,N){J(N);let B=w.seen.get(N),L=B.schema;if(L.$ref&&(w.target==="draft-07"||w.target==="draft-04"||w.target==="openapi-3.0"))A.allOf=A.allOf??[],A.allOf.push(L);else Object.assign(A,L);if(Object.assign(A,M),b._zod.parent===N)for(let O in A){if(O==="$ref"||O==="allOf")continue;if(!(O in M))delete A[O]}if(L.$ref&&B.def)for(let O in A){if(O==="$ref"||O==="allOf")continue;if(O in B.def&&JSON.stringify(A[O])===JSON.stringify(B.def[O]))delete A[O]}}let Q=b._zod.parent;if(Q&&Q!==N){J(Q);let B=w.seen.get(Q);if(B?.schema.$ref){if(A.$ref=B.schema.$ref,B.def)for(let L in A){if(L==="$ref"||L==="allOf")continue;if(L in B.def&&JSON.stringify(A[L])===JSON.stringify(B.def[L]))delete A[L]}}}w.override({zodSchema:b,jsonSchema:A,path:D.path??[]})};for(let b of[...w.seen.entries()].reverse())J(b[0]);let P={};if(w.target==="draft-2020-12")P.$schema="https://json-schema.org/draft/2020-12/schema";else if(w.target==="draft-07")P.$schema="http://json-schema.org/draft-07/schema#";else if(w.target==="draft-04")P.$schema="http://json-schema.org/draft-04/schema#";else if(w.target==="openapi-3.0");if(w.external?.uri){let b=w.external.registry.get(K)?.id;if(!b)throw Error("Schema is missing an `id` property");P.$id=w.external.uri(b)}Object.assign(P,W.def??W.schema);let I=w.external?.defs??{};for(let b of w.seen.entries()){let D=b[1];if(D.def&&D.defId)I[D.defId]=D.def}if(w.external);else if(Object.keys(I).length>0)if(w.target==="draft-2020-12")P.$defs=I;else P.definitions=I;try{let b=JSON.parse(JSON.stringify(P));return Object.defineProperty(b,"~standard",{value:{...K["~standard"],jsonSchema:{input:a2(K,"input",w.processors),output:a2(K,"output",w.processors)}},enumerable:!1,writable:!1}),b}catch(b){throw Error("Error converting schema to JSON.")}}function Fw(w,K){let W=K??{seen:new Set};if(W.seen.has(w))return!1;W.seen.add(w);let J=w._zod.def;if(J.type==="transform")return!0;if(J.type==="array")return Fw(J.element,W);if(J.type==="set")return Fw(J.valueType,W);if(J.type==="lazy")return Fw(J.getter(),W);if(J.type==="promise"||J.type==="optional"||J.type==="nonoptional"||J.type==="nullable"||J.type==="readonly"||J.type==="default"||J.type==="prefault")return Fw(J.innerType,W);if(J.type==="intersection")return Fw(J.left,W)||Fw(J.right,W);if(J.type==="record"||J.type==="map")return Fw(J.keyType,W)||Fw(J.valueType,W);if(J.type==="pipe")return Fw(J.in,W)||Fw(J.out,W);if(J.type==="object"){for(let P in J.shape)if(Fw(J.shape[P],W))return!0;return!1}if(J.type==="union"){for(let P of J.options)if(Fw(P,W))return!0;return!1}if(J.type==="tuple"){for(let P of J.items)if(Fw(P,W))return!0;if(J.rest&&Fw(J.rest,W))return!0;return!1}return!1}var H3=(w,K={})=>(W)=>{let J=c1({...W,processors:K});return $w(w,J),r1(J,w),_1(J,w)},a2=(w,K,W={})=>(J)=>{let{libraryOptions:P,target:I}=J??{},b=c1({...P??{},target:I,io:K,processors:W});return $w(w,b),r1(b,w),_1(b,w)};var F9={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},q3=(w,K,W,J)=>{let P=W;P.type="string";let{minimum:I,maximum:b,format:D,patterns:A,contentEncoding:M}=w._zod.bag;if(typeof I==="number")P.minLength=I;if(typeof b==="number")P.maxLength=b;if(D){if(P.format=F9[D]??D,P.format==="")delete P.format;if(D==="time")delete P.format}if(M)P.contentEncoding=M;if(A&&A.size>0){let N=[...A];if(N.length===1)P.pattern=N[0].source;else if(N.length>1)P.allOf=[...N.map((Q)=>({...K.target==="draft-07"||K.target==="draft-04"||K.target==="openapi-3.0"?{type:"string"}:{},pattern:Q.source}))]}};var h3=(w,K,W,J)=>{W.not={}};var F3=(w,K,W,J)=>{};var z3=(w,K,W,J)=>{let P=w._zod.def,I=m2(P.entries);if(I.every((b)=>typeof b==="number"))W.type="number";if(I.every((b)=>typeof b==="string"))W.type="string";W.enum=I};var R3=(w,K,W,J)=>{if(K.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var v3=(w,K,W,J)=>{if(K.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var j3=(w,K,W,J)=>{let P=W,I=w._zod.def,{minimum:b,maximum:D}=w._zod.bag;if(typeof b==="number")P.minItems=b;if(typeof D==="number")P.maxItems=D;P.type="array",P.items=$w(I.element,K,{...J,path:[...J.path,"items"]})},Z3=(w,K,W,J)=>{let P=W,I=w._zod.def;P.type="object",P.properties={};let b=I.shape;for(let M in b)P.properties[M]=$w(b[M],K,{...J,path:[...J.path,"properties",M]});let D=new Set(Object.keys(b)),A=new Set([...D].filter((M)=>{let N=I.shape[M]._zod;if(K.io==="input")return N.optin===void 0;else return N.optout===void 0}));if(A.size>0)P.required=Array.from(A);if(I.catchall?._zod.def.type==="never")P.additionalProperties=!1;else if(!I.catchall){if(K.io==="output")P.additionalProperties=!1}else if(I.catchall)P.additionalProperties=$w(I.catchall,K,{...J,path:[...J.path,"additionalProperties"]})},k3=(w,K,W,J)=>{let P=w._zod.def,I=P.inclusive===!1,b=P.options.map((D,A)=>$w(D,K,{...J,path:[...J.path,I?"oneOf":"anyOf",A]}));if(I)W.oneOf=b;else W.anyOf=b},g3=(w,K,W,J)=>{let P=w._zod.def,I=$w(P.left,K,{...J,path:[...J.path,"allOf",0]}),b=$w(P.right,K,{...J,path:[...J.path,"allOf",1]}),D=(M)=>("allOf"in M)&&Object.keys(M).length===1,A=[...D(I)?I.allOf:[I],...D(b)?b.allOf:[b]];W.allOf=A};var C3=(w,K,W,J)=>{let P=w._zod.def,I=$w(P.innerType,K,J),b=K.seen.get(w);if(K.target==="openapi-3.0")b.ref=P.innerType,W.nullable=!0;else W.anyOf=[I,{type:"null"}]},o3=(w,K,W,J)=>{let P=w._zod.def;$w(P.innerType,K,J);let I=K.seen.get(w);I.ref=P.innerType},x3=(w,K,W,J)=>{let P=w._zod.def;$w(P.innerType,K,J);let I=K.seen.get(w);I.ref=P.innerType,W.default=JSON.parse(JSON.stringify(P.defaultValue))},c3=(w,K,W,J)=>{let P=w._zod.def;$w(P.innerType,K,J);let I=K.seen.get(w);if(I.ref=P.innerType,K.io==="input")W._prefault=JSON.parse(JSON.stringify(P.defaultValue))},r3=(w,K,W,J)=>{let P=w._zod.def;$w(P.innerType,K,J);let I=K.seen.get(w);I.ref=P.innerType;let b;try{b=P.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}W.default=b},_3=(w,K,W,J)=>{let P=w._zod.def,I=K.io==="input"?P.in._zod.def.type==="transform"?P.out:P.in:P.out;$w(I,K,J);let b=K.seen.get(w);b.ref=I},u3=(w,K,W,J)=>{let P=w._zod.def;$w(P.innerType,K,J);let I=K.seen.get(w);I.ref=P.innerType,W.readOnly=!0};var u1=(w,K,W,J)=>{let P=w._zod.def;$w(P.innerType,K,J);let I=K.seen.get(w);I.ref=P.innerType};var _9=h("ZodISODateTime",(w,K)=>{N8.init(w,K),Mw.init(w,K)});function y3(w){return Q3(_9,w)}var u9=h("ZodISODate",(w,K)=>{Q8.init(w,K),Mw.init(w,K)});function m3(w){return S3(u9,w)}var y9=h("ZodISOTime",(w,K)=>{S8.init(w,K),Mw.init(w,K)});function T3(w){return $3(y9,w)}var m9=h("ZodISODuration",(w,K)=>{$8.init(w,K),Mw.init(w,K)});function l3(w){return Y3(m9,w)}var f3=(w,K)=>{EK.init(w,K),w.name="ZodError",Object.defineProperties(w,{format:{value:(W)=>$1(w,W)},flatten:{value:(W)=>S1(w,W)},addIssue:{value:(W)=>{w.issues.push(W),w.message=JSON.stringify(w.issues,h2,2)}},addIssues:{value:(W)=>{w.issues.push(...W),w.message=JSON.stringify(w.issues,h2,2)}},isEmpty:{get(){return w.issues.length===0}}})},$P=h("ZodError",f3),Zw=h("ZodError",f3,{Parent:Error});var e3=UK(Zw),i3=HK(Zw),d3=i2(Zw),n3=d2(Zw),t3=P6(Zw),a3=I6(Zw),s3=b6(Zw),w5=D6(Zw),K5=G6(Zw),W5=A6(Zw),J5=M6(Zw),P5=O6(Zw);var Sw=h("ZodType",(w,K)=>{return Nw.init(w,K),Object.assign(w["~standard"],{jsonSchema:{input:a2(w,"input"),output:a2(w,"output")}}),w.toJSONSchema=H3(w,{}),w.def=K,w.type=K.type,Object.defineProperty(w,"_def",{value:K}),w.check=(...W)=>{return w.clone(bw.mergeDefs(K,{checks:[...K.checks??[],...W.map((J)=>typeof J==="function"?{_zod:{check:J,def:{check:"custom"},onattach:[]}}:J)]}),{parent:!0})},w.with=w.check,w.clone=(W,J)=>Cw(w,W,J),w.brand=()=>w,w.register=(W,J)=>{return W.add(w,J),w},w.parse=(W,J)=>e3(w,W,J,{callee:w.parse}),w.safeParse=(W,J)=>d3(w,W,J),w.parseAsync=async(W,J)=>i3(w,W,J,{callee:w.parseAsync}),w.safeParseAsync=async(W,J)=>n3(w,W,J),w.spa=w.safeParseAsync,w.encode=(W,J)=>t3(w,W,J),w.decode=(W,J)=>a3(w,W,J),w.encodeAsync=async(W,J)=>s3(w,W,J),w.decodeAsync=async(W,J)=>w5(w,W,J),w.safeEncode=(W,J)=>K5(w,W,J),w.safeDecode=(W,J)=>W5(w,W,J),w.safeEncodeAsync=async(W,J)=>J5(w,W,J),w.safeDecodeAsync=async(W,J)=>P5(w,W,J),w.refine=(W,J)=>w.check(CW(W,J)),w.superRefine=(W)=>w.check(oW(W)),w.overwrite=(W)=>w.check(J2(W)),w.optional=()=>D5(w),w.exactOptional=()=>EW(w),w.nullable=()=>G5(w),w.nullish=()=>D5(G5(w)),w.nonoptional=(W)=>zW(w,W),w.array=()=>OW(w),w.or=(W)=>QW([w,W]),w.and=(W)=>$W(w,W),w.transform=(W)=>A5(w,VW(W)),w.default=(W)=>qW(w,W),w.prefault=(W)=>FW(w,W),w.catch=(W)=>vW(w,W),w.pipe=(W)=>A5(w,W),w.readonly=()=>kW(w),w.describe=(W)=>{let J=w.clone();return W2.add(J,{description:W}),J},Object.defineProperty(w,"description",{get(){return W2.get(w)?.description},configurable:!0}),w.meta=(...W)=>{if(W.length===0)return W2.get(w);let J=w.clone();return W2.add(J,W[0]),J},w.isOptional=()=>w.safeParse(void 0).success,w.isNullable=()=>w.safeParse(null).success,w.apply=(W)=>W(w),w}),M5=h("_ZodString",(w,K)=>{FK.init(w,K),Sw.init(w,K),w._zod.processJSONSchema=(J,P,I)=>q3(w,J,P,I);let W=w._zod.bag;w.format=W.format??null,w.minLength=W.minimum??null,w.maxLength=W.maximum??null,w.regex=(...J)=>w.check(F1(...J)),w.includes=(...J)=>w.check(v1(...J)),w.startsWith=(...J)=>w.check(j1(...J)),w.endsWith=(...J)=>w.check(Z1(...J)),w.min=(...J)=>w.check(z2(...J)),w.max=(...J)=>w.check(zK(...J)),w.length=(...J)=>w.check(RK(...J)),w.nonempty=(...J)=>w.check(z2(1,...J)),w.lowercase=(J)=>w.check(z1(J)),w.uppercase=(J)=>w.check(R1(J)),w.trim=()=>w.check(g1()),w.normalize=(...J)=>w.check(k1(...J)),w.toLowerCase=()=>w.check(C1()),w.toUpperCase=()=>w.check(o1()),w.slugify=()=>w.check(x1())}),p9=h("ZodString",(w,K)=>{FK.init(w,K),M5.init(w,K),w.email=(W)=>w.check(H1(B5,W)),w.url=(W)=>w.check(s8(f9,W)),w.jwt=(W)=>w.check(h1(Q5,W)),w.emoji=(W)=>w.check(w3(e9,W)),w.guid=(W)=>w.check(q1(I5,W)),w.uuid=(W)=>w.check(d8(vK,W)),w.uuidv4=(W)=>w.check(n8(vK,W)),w.uuidv6=(W)=>w.check(t8(vK,W)),w.uuidv7=(W)=>w.check(a8(vK,W)),w.nanoid=(W)=>w.check(K3(i9,W)),w.guid=(W)=>w.check(q1(I5,W)),w.cuid=(W)=>w.check(W3(d9,W)),w.cuid2=(W)=>w.check(J3(n9,W)),w.ulid=(W)=>w.check(P3(t9,W)),w.base64=(W)=>w.check(O3(PW,W)),w.base64url=(W)=>w.check(B3(IW,W)),w.xid=(W)=>w.check(I3(a9,W)),w.ksuid=(W)=>w.check(b3(s9,W)),w.ipv4=(W)=>w.check(D3(wW,W)),w.ipv6=(W)=>w.check(G3(KW,W)),w.cidrv4=(W)=>w.check(A3(WW,W)),w.cidrv6=(W)=>w.check(M3(JW,W)),w.e164=(W)=>w.check(N3(bW,W)),w.datetime=(W)=>w.check(y3(W)),w.date=(W)=>w.check(m3(W)),w.time=(W)=>w.check(T3(W)),w.duration=(W)=>w.check(l3(W))});function O5(w){return i8(p9,w)}var Mw=h("ZodStringFormat",(w,K)=>{Gw.init(w,K),M5.init(w,K)}),B5=h("ZodEmail",(w,K)=>{P8.init(w,K),Mw.init(w,K)});function N5(w){return H1(B5,w)}var I5=h("ZodGUID",(w,K)=>{W8.init(w,K),Mw.init(w,K)});var vK=h("ZodUUID",(w,K)=>{J8.init(w,K),Mw.init(w,K)});var f9=h("ZodURL",(w,K)=>{I8.init(w,K),Mw.init(w,K)});var e9=h("ZodEmoji",(w,K)=>{b8.init(w,K),Mw.init(w,K)});var i9=h("ZodNanoID",(w,K)=>{D8.init(w,K),Mw.init(w,K)});var d9=h("ZodCUID",(w,K)=>{G8.init(w,K),Mw.init(w,K)});var n9=h("ZodCUID2",(w,K)=>{A8.init(w,K),Mw.init(w,K)});var t9=h("ZodULID",(w,K)=>{M8.init(w,K),Mw.init(w,K)});var a9=h("ZodXID",(w,K)=>{O8.init(w,K),Mw.init(w,K)});var s9=h("ZodKSUID",(w,K)=>{B8.init(w,K),Mw.init(w,K)});var wW=h("ZodIPv4",(w,K)=>{Y8.init(w,K),Mw.init(w,K)});var KW=h("ZodIPv6",(w,K)=>{X8.init(w,K),Mw.init(w,K)});var WW=h("ZodCIDRv4",(w,K)=>{V8.init(w,K),Mw.init(w,K)});var JW=h("ZodCIDRv6",(w,K)=>{L8.init(w,K),Mw.init(w,K)});var PW=h("ZodBase64",(w,K)=>{U8.init(w,K),Mw.init(w,K)});var IW=h("ZodBase64URL",(w,K)=>{H8.init(w,K),Mw.init(w,K)});var bW=h("ZodE164",(w,K)=>{q8.init(w,K),Mw.init(w,K)});var Q5=h("ZodJWT",(w,K)=>{h8.init(w,K),Mw.init(w,K)});function S5(w){return h1(Q5,w)}var DW=h("ZodUnknown",(w,K)=>{F8.init(w,K),Sw.init(w,K),w._zod.processJSONSchema=(W,J,P)=>F3(w,W,J,P)});function b5(){return X3(DW)}var GW=h("ZodNever",(w,K)=>{z8.init(w,K),Sw.init(w,K),w._zod.processJSONSchema=(W,J,P)=>h3(w,W,J,P)});function AW(w){return V3(GW,w)}var MW=h("ZodArray",(w,K)=>{R8.init(w,K),Sw.init(w,K),w._zod.processJSONSchema=(W,J,P)=>j3(w,W,J,P),w.element=K.element,w.min=(W,J)=>w.check(z2(W,J)),w.nonempty=(W)=>w.check(z2(1,W)),w.max=(W,J)=>w.check(zK(W,J)),w.length=(W,J)=>w.check(RK(W,J)),w.unwrap=()=>w.element});function OW(w,K){return L3(MW,w,K)}var BW=h("ZodObject",(w,K)=>{Z8.init(w,K),Sw.init(w,K),w._zod.processJSONSchema=(W,J,P)=>Z3(w,W,J,P),bw.defineLazy(w,"shape",()=>{return K.shape}),w.keyof=()=>YW(Object.keys(w._zod.def.shape)),w.catchall=(W)=>w.clone({...w._zod.def,catchall:W}),w.passthrough=()=>w.clone({...w._zod.def,catchall:b5()}),w.loose=()=>w.clone({...w._zod.def,catchall:b5()}),w.strict=()=>w.clone({...w._zod.def,catchall:AW()}),w.strip=()=>w.clone({...w._zod.def,catchall:void 0}),w.extend=(W)=>{return bw.extend(w,W)},w.safeExtend=(W)=>{return bw.safeExtend(w,W)},w.merge=(W)=>bw.merge(w,W),w.pick=(W)=>bw.pick(w,W),w.omit=(W)=>bw.omit(w,W),w.partial=(...W)=>bw.partial(Y5,w,W[0]),w.required=(...W)=>bw.required(X5,w,W[0])});function $5(w,K){let W={type:"object",shape:w??{},...bw.normalizeParams(K)};return new BW(W)}var NW=h("ZodUnion",(w,K)=>{k8.init(w,K),Sw.init(w,K),w._zod.processJSONSchema=(W,J,P)=>k3(w,W,J,P),w.options=K.options});function QW(w,K){return new NW({type:"union",options:w,...bw.normalizeParams(K)})}var SW=h("ZodIntersection",(w,K)=>{g8.init(w,K),Sw.init(w,K),w._zod.processJSONSchema=(W,J,P)=>g3(w,W,J,P)});function $W(w,K){return new SW({type:"intersection",left:w,right:K})}var y1=h("ZodEnum",(w,K)=>{C8.init(w,K),Sw.init(w,K),w._zod.processJSONSchema=(J,P,I)=>z3(w,J,P,I),w.enum=K.entries,w.options=Object.values(K.entries);let W=new Set(Object.keys(K.entries));w.extract=(J,P)=>{let I={};for(let b of J)if(W.has(b))I[b]=K.entries[b];else throw Error(`Key ${b} not found in enum`);return new y1({...K,checks:[],...bw.normalizeParams(P),entries:I})},w.exclude=(J,P)=>{let I={...K.entries};for(let b of J)if(W.has(b))delete I[b];else throw Error(`Key ${b} not found in enum`);return new y1({...K,checks:[],...bw.normalizeParams(P),entries:I})}});function YW(w,K){let W=Array.isArray(w)?Object.fromEntries(w.map((J)=>[J,J])):w;return new y1({type:"enum",entries:W,...bw.normalizeParams(K)})}var XW=h("ZodTransform",(w,K)=>{o8.init(w,K),Sw.init(w,K),w._zod.processJSONSchema=(W,J,P)=>v3(w,W,J,P),w._zod.parse=(W,J)=>{if(J.direction==="backward")throw new u2(w.constructor.name);W.addIssue=(I)=>{if(typeof I==="string")W.issues.push(bw.issue(I,W.value,K));else{let b=I;if(b.fatal)b.continue=!1;b.code??(b.code="custom"),b.input??(b.input=W.value),b.inst??(b.inst=w),W.issues.push(bw.issue(b))}};let P=K.transform(W.value,W);if(P instanceof Promise)return P.then((I)=>{return W.value=I,W});return W.value=P,W}});function VW(w){return new XW({type:"transform",transform:w})}var Y5=h("ZodOptional",(w,K)=>{E1.init(w,K),Sw.init(w,K),w._zod.processJSONSchema=(W,J,P)=>u1(w,W,J,P),w.unwrap=()=>w._zod.def.innerType});function D5(w){return new Y5({type:"optional",innerType:w})}var LW=h("ZodExactOptional",(w,K)=>{x8.init(w,K),Sw.init(w,K),w._zod.processJSONSchema=(W,J,P)=>u1(w,W,J,P),w.unwrap=()=>w._zod.def.innerType});function EW(w){return new LW({type:"optional",innerType:w})}var UW=h("ZodNullable",(w,K)=>{c8.init(w,K),Sw.init(w,K),w._zod.processJSONSchema=(W,J,P)=>C3(w,W,J,P),w.unwrap=()=>w._zod.def.innerType});function G5(w){return new UW({type:"nullable",innerType:w})}var HW=h("ZodDefault",(w,K)=>{r8.init(w,K),Sw.init(w,K),w._zod.processJSONSchema=(W,J,P)=>x3(w,W,J,P),w.unwrap=()=>w._zod.def.innerType,w.removeDefault=w.unwrap});function qW(w,K){return new HW({type:"default",innerType:w,get defaultValue(){return typeof K==="function"?K():bw.shallowClone(K)}})}var hW=h("ZodPrefault",(w,K)=>{_8.init(w,K),Sw.init(w,K),w._zod.processJSONSchema=(W,J,P)=>c3(w,W,J,P),w.unwrap=()=>w._zod.def.innerType});function FW(w,K){return new hW({type:"prefault",innerType:w,get defaultValue(){return typeof K==="function"?K():bw.shallowClone(K)}})}var X5=h("ZodNonOptional",(w,K)=>{u8.init(w,K),Sw.init(w,K),w._zod.processJSONSchema=(W,J,P)=>o3(w,W,J,P),w.unwrap=()=>w._zod.def.innerType});function zW(w,K){return new X5({type:"nonoptional",innerType:w,...bw.normalizeParams(K)})}var RW=h("ZodCatch",(w,K)=>{y8.init(w,K),Sw.init(w,K),w._zod.processJSONSchema=(W,J,P)=>r3(w,W,J,P),w.unwrap=()=>w._zod.def.innerType,w.removeCatch=w.unwrap});function vW(w,K){return new RW({type:"catch",innerType:w,catchValue:typeof K==="function"?K:()=>K})}var jW=h("ZodPipe",(w,K)=>{m8.init(w,K),Sw.init(w,K),w._zod.processJSONSchema=(W,J,P)=>_3(w,W,J,P),w.in=K.in,w.out=K.out});function A5(w,K){return new jW({type:"pipe",in:w,out:K})}var ZW=h("ZodReadonly",(w,K)=>{T8.init(w,K),Sw.init(w,K),w._zod.processJSONSchema=(W,J,P)=>u3(w,W,J,P),w.unwrap=()=>w._zod.def.innerType});function kW(w){return new ZW({type:"readonly",innerType:w})}var gW=h("ZodCustom",(w,K)=>{l8.init(w,K),Sw.init(w,K),w._zod.processJSONSchema=(W,J,P)=>R3(w,W,J,P)});function CW(w,K={}){return E3(gW,w,K)}function oW(w){return U3(w)}gw(U1());var V5=$5({authorization:O5().startsWith("Bearer ").transform((w,K)=>{let[W,J]=w.split(" ");if(!S5().safeParse(J).success)return K.addIssue("Token must be match jsonwebtoken format."),D1;return Object.freeze({schema:W,token:J})})});class m1{clientInstance;constructor(w){this.clientInstance=w}async enforce(w,K,W){if(!this.clientInstance)throw Error("Bool guard instance not found.");let J=Reflect.getOwnMetadataKeys(w.class,w.funcName),P=Reflect.getOwnMetadataKeys(w.class),I=J.includes(hw.guardMetadata),b=P.includes(hw.guardMetadata);if(!I&&!b)return!0;let D=await V5.safeParseAsync(K.toJSON());if(!D.success)return!1;try{let{authorization:{token:A}}=D.data,{account:M,credential:N}=await this.clientInstance.verifyToken({token:A}),Q=Object.freeze({account:M,credential:N});return W.set(hw.authState,Q),!0}catch{return!1}}}iK([g2(0,c4()),g2(1,x4()),g2(2,SK())],m1.prototype,"enforce",null),m1=iK([r4(),g2(0,_4(hw.guardClient))],m1);var jK=new TextEncoder,ZK=new TextDecoder;function L5(...w){let K=w.reduce((P,{length:I})=>P+I,0),W=new Uint8Array(K),J=0;for(let P of w)W.set(P,J),J+=P.length;return W}function kK(w){let K=new Uint8Array(w.length);for(let W=0;W<w.length;W++){let J=w.charCodeAt(W);if(J>127)throw TypeError("non-ASCII string encountered in encode()");K[W]=J}return K}function E5(w){if(Uint8Array.prototype.toBase64)return w.toBase64();let K=32768,W=[];for(let J=0;J<w.length;J+=K)W.push(String.fromCharCode.apply(null,w.subarray(J,J+K)));return btoa(W.join(""))}function U5(w){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(w);let K=atob(w),W=new Uint8Array(K.length);for(let J=0;J<K.length;J++)W[J]=K.charCodeAt(J);return W}function H5(w){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof w==="string"?w:ZK.decode(w),{alphabet:"base64url"});let K=w;if(K instanceof Uint8Array)K=ZK.decode(K);K=K.replace(/-/g,"+").replace(/_/g,"/");try{return U5(K)}catch{throw TypeError("The input to be decoded is not correctly encoded.")}}function gK(w){let K=w;if(typeof K==="string")K=jK.encode(K);if(Uint8Array.prototype.toBase64)return K.toBase64({alphabet:"base64url",omitPadding:!0});return E5(K).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var P2=(w,K="algorithm.name")=>TypeError(`CryptoKey does not support this operation, its ${K} must be ${w}`),R2=(w,K)=>w.name===K;function xW(w){return parseInt(w.name.slice(4),10)}function T1(w,K){if(xW(w.hash)!==K)throw P2(`SHA-${K}`,"algorithm.hash")}function cW(w){switch(w){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw Error("unreachable")}}function rW(w,K){if(K&&!w.usages.includes(K))throw TypeError(`CryptoKey does not support this operation, its usages must include ${K}.`)}function q5(w,K,W){switch(K){case"HS256":case"HS384":case"HS512":{if(!R2(w.algorithm,"HMAC"))throw P2("HMAC");T1(w.algorithm,parseInt(K.slice(2),10));break}case"RS256":case"RS384":case"RS512":{if(!R2(w.algorithm,"RSASSA-PKCS1-v1_5"))throw P2("RSASSA-PKCS1-v1_5");T1(w.algorithm,parseInt(K.slice(2),10));break}case"PS256":case"PS384":case"PS512":{if(!R2(w.algorithm,"RSA-PSS"))throw P2("RSA-PSS");T1(w.algorithm,parseInt(K.slice(2),10));break}case"Ed25519":case"EdDSA":{if(!R2(w.algorithm,"Ed25519"))throw P2("Ed25519");break}case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":{if(!R2(w.algorithm,K))throw P2(K);break}case"ES256":case"ES384":case"ES512":{if(!R2(w.algorithm,"ECDSA"))throw P2("ECDSA");let J=cW(K);if(w.algorithm.namedCurve!==J)throw P2(J,"algorithm.namedCurve");break}default:throw TypeError("CryptoKey does not support this operation")}rW(w,W)}function h5(w,K,...W){if(W=W.filter(Boolean),W.length>2){let J=W.pop();w+=`one of type ${W.join(", ")}, or ${J}.`}else if(W.length===2)w+=`one of type ${W[0]} or ${W[1]}.`;else w+=`of type ${W[0]}.`;if(K==null)w+=` Received ${K}`;else if(typeof K==="function"&&K.name)w+=` Received function ${K.name}`;else if(typeof K==="object"&&K!=null){if(K.constructor?.name)w+=` Received an instance of ${K.constructor.name}`}return w}var F5=(w,...K)=>h5("Key must be ",w,...K),l1=(w,K,...W)=>h5(`Key for the ${w} algorithm must be `,K,...W);class CK extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(w,K){super(w,K);this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class rw extends CK{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class I2 extends CK{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"}class p1 extends CK{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}var f1=(w)=>{if(w?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return w instanceof CryptoKey}catch{return!1}},e1=(w)=>w?.[Symbol.toStringTag]==="KeyObject",i1=(w)=>f1(w)||e1(w);var Sb=Symbol();function d1(w,K){if(w)throw TypeError(`${K} can only be called once`)}var _W=(w)=>typeof w==="object"&&w!==null;function n1(w){if(!_W(w)||Object.prototype.toString.call(w)!=="[object Object]")return!1;if(Object.getPrototypeOf(w)===null)return!0;let K=w;while(Object.getPrototypeOf(K)!==null)K=Object.getPrototypeOf(K);return Object.getPrototypeOf(w)===K}function z5(...w){let K=w.filter(Boolean);if(K.length===0||K.length===1)return!0;let W;for(let J of K){let P=Object.keys(J);if(!W||W.size===0){W=new Set(P);continue}for(let I of P){if(W.has(I))return!1;W.add(I)}}return!0}var wK=(w)=>n1(w)&&typeof w.kty==="string",R5=(w)=>w.kty!=="oct"&&(w.kty==="AKP"&&typeof w.priv==="string"||typeof w.d==="string"),v5=(w)=>w.kty!=="oct"&&w.d===void 0&&w.priv===void 0,j5=(w)=>w.kty==="oct"&&typeof w.k==="string";function yW(w,K){if(w.startsWith("RS")||w.startsWith("PS")){let{modulusLength:W}=K.algorithm;if(typeof W!=="number"||W<2048)throw TypeError(`${w} requires key modulusLength to be 2048 bits or larger`)}}function mW(w,K){let W=`SHA-${w.slice(-3)}`;switch(w){case"HS256":case"HS384":case"HS512":return{hash:W,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:W,name:"RSA-PSS",saltLength:parseInt(w.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:W,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:W,name:"ECDSA",namedCurve:K.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:w};default:throw new rw(`alg ${w} is not supported either by JOSE or your javascript runtime`)}}async function TW(w,K,W){if(K instanceof Uint8Array){if(!w.startsWith("HS"))throw TypeError(F5(K,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",K,{hash:`SHA-${w.slice(-3)}`,name:"HMAC"},!1,[W])}return q5(K,w,W),K}async function Z5(w,K,W){let J=await TW(w,K,"sign");yW(w,J);let P=await crypto.subtle.sign(mW(w,J.algorithm),J,W);return new Uint8Array(P)}var oK='Invalid or unsupported JWK "alg" (Algorithm) Parameter value';function lW(w){let K,W;switch(w.kty){case"AKP":{switch(w.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":K={name:w.alg},W=w.priv?["sign"]:["verify"];break;default:throw new rw(oK)}break}case"RSA":{switch(w.alg){case"PS256":case"PS384":case"PS512":K={name:"RSA-PSS",hash:`SHA-${w.alg.slice(-3)}`},W=w.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":K={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${w.alg.slice(-3)}`},W=w.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":K={name:"RSA-OAEP",hash:`SHA-${parseInt(w.alg.slice(-3),10)||1}`},W=w.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new rw(oK)}break}case"EC":{switch(w.alg){case"ES256":case"ES384":case"ES512":K={name:"ECDSA",namedCurve:{ES256:"P-256",ES384:"P-384",ES512:"P-521"}[w.alg]},W=w.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":K={name:"ECDH",namedCurve:w.crv},W=w.d?["deriveBits"]:[];break;default:throw new rw(oK)}break}case"OKP":{switch(w.alg){case"Ed25519":case"EdDSA":K={name:"Ed25519"},W=w.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":K={name:w.crv},W=w.d?["deriveBits"]:[];break;default:throw new rw(oK)}break}default:throw new rw('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:K,keyUsages:W}}async function k5(w){if(!w.alg)throw TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:K,keyUsages:W}=lW(w),J={...w};if(J.kty!=="AKP")delete J.alg;return delete J.use,crypto.subtle.importKey("jwk",J,K,w.ext??(w.d||w.priv?!1:!0),w.key_ops??W)}var v2="given KeyObject instance cannot be used for this algorithm",j2,g5=async(w,K,W,J=!1)=>{j2||=new WeakMap;let P=j2.get(w);if(P?.[W])return P[W];let I=await k5({...K,alg:W});if(J)Object.freeze(w);if(!P)j2.set(w,{[W]:I});else P[W]=I;return I},pW=(w,K)=>{j2||=new WeakMap;let W=j2.get(w);if(W?.[K])return W[K];let J=w.type==="public",P=J?!0:!1,I;if(w.asymmetricKeyType==="x25519"){switch(K){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw TypeError(v2)}I=w.toCryptoKey(w.asymmetricKeyType,P,J?[]:["deriveBits"])}if(w.asymmetricKeyType==="ed25519"){if(K!=="EdDSA"&&K!=="Ed25519")throw TypeError(v2);I=w.toCryptoKey(w.asymmetricKeyType,P,[J?"verify":"sign"])}switch(w.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":{if(K!==w.asymmetricKeyType.toUpperCase())throw TypeError(v2);I=w.toCryptoKey(w.asymmetricKeyType,P,[J?"verify":"sign"])}}if(w.asymmetricKeyType==="rsa"){let b;switch(K){case"RSA-OAEP":b="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":b="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":b="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":b="SHA-512";break;default:throw TypeError(v2)}if(K.startsWith("RSA-OAEP"))return w.toCryptoKey({name:"RSA-OAEP",hash:b},P,J?["encrypt"]:["decrypt"]);I=w.toCryptoKey({name:K.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:b},P,[J?"verify":"sign"])}if(w.asymmetricKeyType==="ec"){let D=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(w.asymmetricKeyDetails?.namedCurve);if(!D)throw TypeError(v2);let A={ES256:"P-256",ES384:"P-384",ES512:"P-521"};if(A[K]&&D===A[K])I=w.toCryptoKey({name:"ECDSA",namedCurve:D},P,[J?"verify":"sign"]);if(K.startsWith("ECDH-ES"))I=w.toCryptoKey({name:"ECDH",namedCurve:D},P,J?[]:["deriveBits"])}if(!I)throw TypeError(v2);if(!W)j2.set(w,{[K]:I});else W[K]=I;return I};async function C5(w,K){if(w instanceof Uint8Array)return w;if(f1(w))return w;if(e1(w)){if(w.type==="secret")return w.export();if("toCryptoKey"in w&&typeof w.toCryptoKey==="function")try{return pW(w,K)}catch(J){if(J instanceof TypeError)throw J}let W=w.export({format:"jwk"});return g5(w,W,K)}if(wK(w)){if(w.k)return H5(w.k);return g5(w,w,K,!0)}throw Error("unreachable")}function o5(w,K,W,J,P){if(P.crit!==void 0&&J?.crit===void 0)throw new w('"crit" (Critical) Header Parameter MUST be integrity protected');if(!J||J.crit===void 0)return new Set;if(!Array.isArray(J.crit)||J.crit.length===0||J.crit.some((b)=>typeof b!=="string"||b.length===0))throw new w('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let I;if(W!==void 0)I=new Map([...Object.entries(W),...K.entries()]);else I=K;for(let b of J.crit){if(!I.has(b))throw new rw(`Extension Header Parameter "${b}" is not recognized`);if(P[b]===void 0)throw new w(`Extension Header Parameter "${b}" is missing`);if(I.get(b)&&J[b]===void 0)throw new w(`Extension Header Parameter "${b}" MUST be integrity protected`)}return new Set(J.crit)}var Z2=(w)=>w?.[Symbol.toStringTag],t1=(w,K,W)=>{if(K.use!==void 0){let J;switch(W){case"sign":case"verify":J="sig";break;case"encrypt":case"decrypt":J="enc";break}if(K.use!==J)throw TypeError(`Invalid key for this operation, its "use" must be "${J}" when present`)}if(K.alg!==void 0&&K.alg!==w)throw TypeError(`Invalid key for this operation, its "alg" must be "${w}" when present`);if(Array.isArray(K.key_ops)){let J;switch(!0){case(W==="sign"||W==="verify"):case w==="dir":case w.includes("CBC-HS"):J=W;break;case w.startsWith("PBES2"):J="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(w):if(!w.includes("GCM")&&w.endsWith("KW"))J=W==="encrypt"?"wrapKey":"unwrapKey";else J=W;break;case(W==="encrypt"&&w.startsWith("RSA")):J="wrapKey";break;case W==="decrypt":J=w.startsWith("RSA")?"unwrapKey":"deriveBits";break}if(J&&K.key_ops?.includes?.(J)===!1)throw TypeError(`Invalid key for this operation, its "key_ops" must include "${J}" when present`)}return!0},fW=(w,K,W)=>{if(K instanceof Uint8Array)return;if(wK(K)){if(j5(K)&&t1(w,K,W))return;throw TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!i1(K))throw TypeError(l1(w,K,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if(K.type!=="secret")throw TypeError(`${Z2(K)} instances for symmetric algorithms must be of type "secret"`)},eW=(w,K,W)=>{if(wK(K))switch(W){case"decrypt":case"sign":if(R5(K)&&t1(w,K,W))return;throw TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if(v5(K)&&t1(w,K,W))return;throw TypeError("JSON Web Key for this operation must be a public JWK")}if(!i1(K))throw TypeError(l1(w,K,"CryptoKey","KeyObject","JSON Web Key"));if(K.type==="secret")throw TypeError(`${Z2(K)} instances for asymmetric algorithms must not be of type "secret"`);if(K.type==="public")switch(W){case"sign":throw TypeError(`${Z2(K)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw TypeError(`${Z2(K)} instances for asymmetric algorithm decryption must be of type "private"`)}if(K.type==="private")switch(W){case"verify":throw TypeError(`${Z2(K)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw TypeError(`${Z2(K)} instances for asymmetric algorithm encryption must be of type "public"`)}};function x5(w,K,W){switch(w.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":fW(w,K,W);break;default:eW(w,K,W)}}var S2=(w)=>Math.floor(w.getTime()/1000),c5=60,r5=c5*60,s1=r5*24,iW=s1*7,dW=s1*365.25,nW=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function a1(w){let K=nW.exec(w);if(!K||K[4]&&K[1])throw TypeError("Invalid time period format");let W=parseFloat(K[2]),J=K[3].toLowerCase(),P;switch(J){case"sec":case"secs":case"second":case"seconds":case"s":P=Math.round(W);break;case"minute":case"minutes":case"min":case"mins":case"m":P=Math.round(W*c5);break;case"hour":case"hours":case"hr":case"hrs":case"h":P=Math.round(W*r5);break;case"day":case"days":case"d":P=Math.round(W*s1);break;case"week":case"weeks":case"w":P=Math.round(W*iW);break;default:P=Math.round(W*dW);break}if(K[1]==="-"||K[4]==="ago")return-P;return P}function $2(w,K){if(!Number.isFinite(K))throw TypeError(`Invalid ${w} input`);return K}class w4{#w;constructor(w){if(!n1(w))throw TypeError("JWT Claims Set MUST be an object");this.#w=structuredClone(w)}data(){return jK.encode(JSON.stringify(this.#w))}get iss(){return this.#w.iss}set iss(w){this.#w.iss=w}get sub(){return this.#w.sub}set sub(w){this.#w.sub=w}get aud(){return this.#w.aud}set aud(w){this.#w.aud=w}set jti(w){this.#w.jti=w}set nbf(w){if(typeof w==="number")this.#w.nbf=$2("setNotBefore",w);else if(w instanceof Date)this.#w.nbf=$2("setNotBefore",S2(w));else this.#w.nbf=S2(new Date)+a1(w)}set exp(w){if(typeof w==="number")this.#w.exp=$2("setExpirationTime",w);else if(w instanceof Date)this.#w.exp=$2("setExpirationTime",S2(w));else this.#w.exp=S2(new Date)+a1(w)}set iat(w){if(w===void 0)this.#w.iat=S2(new Date);else if(w instanceof Date)this.#w.iat=$2("setIssuedAt",S2(w));else if(typeof w==="string")this.#w.iat=$2("setIssuedAt",S2(new Date)+a1(w));else this.#w.iat=$2("setIssuedAt",w)}}class K4{#w;#K;#J;constructor(w){if(!(w instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");this.#w=w}setProtectedHeader(w){return d1(this.#K,"setProtectedHeader"),this.#K=w,this}setUnprotectedHeader(w){return d1(this.#J,"setUnprotectedHeader"),this.#J=w,this}async sign(w,K){if(!this.#K&&!this.#J)throw new I2("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!z5(this.#K,this.#J))throw new I2("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let W={...this.#K,...this.#J},J=o5(I2,new Map([["b64",!0]]),K?.crit,this.#K,W),P=!0;if(J.has("b64")){if(P=this.#K.b64,typeof P!=="boolean")throw new I2('The "b64" (base64url-encode payload) Header Parameter must be a boolean')}let{alg:I}=W;if(typeof I!=="string"||!I)throw new I2('JWS "alg" (Algorithm) Header Parameter missing or invalid');x5(I,w,"sign");let b,D;if(P)b=gK(this.#w),D=kK(b);else D=this.#w,b="";let A,M;if(this.#K)A=gK(JSON.stringify(this.#K)),M=kK(A);else A="",M=new Uint8Array;let N=L5(M,kK("."),D),Q=await C5(w,I),B=await Z5(I,Q,N),L={signature:gK(B),payload:b};if(this.#J)L.header=this.#J;if(this.#K)L.protected=A;return L}}class W4{#w;constructor(w){this.#w=new K4(w)}setProtectedHeader(w){return this.#w.setProtectedHeader(w),this}async sign(w,K){let W=await this.#w.sign(w,K);if(W.payload===void 0)throw TypeError("use the flattened module for creating JWS with b64: false");return`${W.protected}.${W.payload}.${W.signature}`}}class xK{#w;#K;constructor(w={}){this.#K=new w4(w)}setIssuer(w){return this.#K.iss=w,this}setSubject(w){return this.#K.sub=w,this}setAudience(w){return this.#K.aud=w,this}setJti(w){return this.#K.jti=w,this}setNotBefore(w){return this.#K.nbf=w,this}setExpirationTime(w){return this.#K.exp=w,this}setIssuedAt(w){return this.#K.iat=w,this}setProtectedHeader(w){return this.#w=w,this}async sign(w,K){let W=new W4(this.#K.data());if(W.setProtectedHeader(this.#w),Array.isArray(this.#w?.crit)&&this.#w.crit.includes("b64")&&this.#w.b64===!1)throw new p1("JWTs MUST NOT use unencoded payload");return W.sign(w,K)}}class cK{params;#w=C2.ETokenAudiences.SYSTEM;#K=1;token;constructor(w){this.params=w}async signToken(){let{params:{credential:{tenantId:w,appId:K,modeId:W,secretKey:J},options:P}}=this;try{let I=new Uint8Array(Buffer.from(J,"base64")),b=await crypto.subtle.importKey("raw",I,{name:"HMAC",hash:"SHA-512"},!1,["sign","verify"]),D=await new xK({tenantId:w,appId:K,modeId:W,iss:w,aud:C2.ETokenAudiences.SYSTEM}).setProtectedHeader({alg:"HS512"}).sign(b);return this.token=D,D}catch(I){if(P?.logs)console.error("[BoolGuard] Sign token error:",I);throw I}}async ping(){let{token:w,params:{credential:{tenantId:K,appId:W,modeId:J},options:P}}=this;try{let I=w||await this.signToken(),b=new Headers;b.append("X-Tenant-ID",K),b.append("X-App-ID",W),b.append("X-Mode-ID",J),b.append("Authorization",`Bearer ${I}`);let D=await fetch(`${this.#w}/v${P?.version||this.#K}/tenant-app-modes/ping`,{method:"GET",headers:b});if(!D.ok)throw await D.json();return D.ok}catch(I){if(P?.logs)console.error("[BoolGuard] Ping error:",I);return!1}}async createPlainAccount({identity:w,password:K,metadata:W}){let{token:J,params:{credential:{tenantId:P,appId:I,modeId:b},options:D}}=this;try{let A=J||await this.signToken(),M=new Headers;M.append("X-Tenant-ID",P),M.append("X-App-ID",I),M.append("X-Mode-ID",b),M.append("Authorization",`Bearer ${A}`),M.append("Content-Type","application/json");let N=await fetch(`${this.#w}/v${D?.version||this.#K}/tenant-app-mode-accounts`,{method:"POST",headers:M,body:JSON.stringify({data:Object.freeze({type:"plain",identity:w,password:K,metadata:W})})});if(!N.ok)throw await N.json();let{data:Q}=await N.json();return Object.freeze({account:Q.account,credential:Q.credential})}catch(A){if(D?.logs)console.error("[BoolGuard] Create plain account error:",A);throw A}}async createEmailAccount({identity:w,password:K,metadata:W}){let{token:J,params:{credential:{tenantId:P,appId:I,modeId:b},options:D}}=this;try{let A=J||await this.signToken(),M=new Headers;M.append("X-Tenant-ID",P),M.append("X-App-ID",I),M.append("X-Mode-ID",b),M.append("Authorization",`Bearer ${A}`),M.append("Content-Type","application/json");let N=await fetch(`${this.#w}/v${D?.version||this.#K}/tenant-app-mode-accounts`,{method:"POST",headers:M,body:JSON.stringify({data:Object.freeze({type:"email",identity:w,password:K,metadata:W})})});if(!N.ok)throw await N.json();let{data:Q}=await N.json();return Object.freeze({account:Q.account,credential:Q.credential})}catch(A){if(D?.logs)console.error("[BoolGuard] Create email account error:",A);throw A}}async authenticate({identity:w,password:K}){let{token:W,params:{credential:{tenantId:J,appId:P,modeId:I},options:b}}=this;try{let D=W||await this.signToken(),A=await N5().safeParseAsync(w),M=new Headers;M.append("X-Tenant-ID",J),M.append("X-App-ID",P),M.append("X-Mode-ID",I),M.append("Authorization",`Bearer ${D}`),M.append("Content-Type","application/json");let N=await fetch(`${this.#w}/v${b?.version||this.#K}/tenant-app-mode-accounts/authenticate`,{method:"POST",headers:M,body:JSON.stringify({data:Object.freeze({type:!A.success?"plain":"email",identity:w,password:K})})});if(!N.ok)throw await N.json();let{data:Q}=await N.json();return Object.freeze({account:Q.account,credential:Q.credential,token:Q.token})}catch(D){if(b?.logs)console.error("[BoolGuard] Authenticate error:",D);throw D}}async verifyToken({token:w}){let{params:{credential:{tenantId:K,appId:W,modeId:J},options:P}}=this;try{let I=this.token||await this.signToken(),b=new Headers;b.append("X-Tenant-ID",K),b.append("X-App-ID",W),b.append("X-Mode-ID",J),b.append("Authorization",`Bearer ${I}`),b.append("Content-Type","application/json");let D=await fetch(`${this.#w}/v${P?.version||this.#K}/tenant-app-mode-accounts/verify`,{method:"POST",headers:b,body:JSON.stringify({data:Object.freeze({token:w})})});if(!D.ok)throw await D.json();let{data:A}=await D.json();return Object.freeze({account:A.account,credential:A.credential})}catch(I){if(P?.logs)console.error("[BoolGuard] Verify token error:",I);throw I}}}var DD=async({credential:w,definition:K,options:W})=>{let J=new cK({credential:w,definition:K,options:W});if(await J.signToken(),!await J.ping())throw Error("Ping to Bool Guard service failed!");return[hw.guardClient,J]};function KK(w){if(typeof w!=="object"||w===null)return w;Object.freeze(w);for(let K of Object.keys(w)){let W=w[K];if(typeof W==="object"&&W!==null&&!Object.isFrozen(W))KK(W)}return w}var tW=(w)=>{if(w==='Duplicate key "alias" found'||new Set([...w.map((W)=>typeof W==="string"?void 0:W.alias).filter((W)=>typeof W<"u")]).size!==w.length)throw Error("Duplicated resource alias.");let K=KK(w);if(K==='Duplicate key "alias" found')throw Error("Duplicated resource alias.");return Object.freeze({getResource:(W)=>{let J=K.findIndex(({alias:P})=>W===P);if(J===-1)throw Error("Resource not found, intialize resources error.");return K[J]},resources:K,definePolicies:(W)=>{if(W==='Duplicate key "alias" found'||new Set([...W.map((J)=>typeof J==="string"?void 0:J.alias).filter((J)=>typeof J<"u")]).size!==W.length)throw Error("Duplicated policy alias.");return Object.freeze({policies:KK(W)})}})};export{DD as loader,tW as defineResources,hw as Keys,m1 as Guard,C2 as Enums,l0 as ControllerGuard,cK as Client,T0 as AuthState,i5 as ActionGuard};
38
57
 
39
- //# debugId=45F168FE1775F6E764756E2164756E21
58
+ //# debugId=1643AF2ADCA9757264756E2164756E21