veloce-ts 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var jW=Object.create;var{getPrototypeOf:SW,defineProperty:W$,getOwnPropertyNames:q2,getOwnPropertyDescriptor:AW}=Object,Y2=Object.prototype.hasOwnProperty;var H$=($,J,Q)=>{Q=$!=null?jW(SW($)):{};let W=J||!$||!$.__esModule?W$(Q,"default",{value:$,enumerable:!0}):Q;for(let H of q2($))if(!Y2.call(W,H))W$(W,H,{get:()=>$[H],enumerable:!0});return W},X2=new WeakMap,M0=($)=>{var J=X2.get($),Q;if(J)return J;if(J=W$({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function")q2($).map((W)=>!Y2.call(J,W)&&W$(J,W,{get:()=>$[W],enumerable:!(Q=AW($,W))||Q.enumerable}));return X2.set($,J),J},A=($,J)=>()=>(J||$((J={exports:{}}).exports,J),J.exports);var L0=($,J)=>{for(var Q in J)W$($,Q,{get:J[Q],enumerable:!0,configurable:!0,set:(W)=>J[Q]=()=>W})};var G2=($,J)=>()=>($&&(J=$($=0)),J);var z$=A(()=>{/*! *****************************************************************************
1
+ var jW=Object.create;var{getPrototypeOf:SW,defineProperty:H$,getOwnPropertyNames:Y2,getOwnPropertyDescriptor:AW}=Object,G2=Object.prototype.hasOwnProperty;var X$=($,J,Q)=>{Q=$!=null?jW(SW($)):{};let W=J||!$||!$.__esModule?H$(Q,"default",{value:$,enumerable:!0}):Q;for(let H of Y2($))if(!G2.call(W,H))H$(W,H,{get:()=>$[H],enumerable:!0});return W},q2=new WeakMap,M0=($)=>{var J=q2.get($),Q;if(J)return J;if(J=H$({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function")Y2($).map((W)=>!G2.call(J,W)&&H$(J,W,{get:()=>$[W],enumerable:!(Q=AW($,W))||Q.enumerable}));return q2.set($,J),J},A=($,J)=>()=>(J||$((J={exports:{}}).exports,J),J.exports);var L0=($,J)=>{for(var Q in J)H$($,Q,{get:J[Q],enumerable:!0,configurable:!0,set:(W)=>J[Q]=()=>W})};var B2=($,J)=>()=>($&&(J=$($=0)),J);var N$=A(()=>{/*! *****************************************************************************
2
2
  Copyright (C) Microsoft. All rights reserved.
3
3
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
4
  this file except in compliance with the License. You may obtain a copy of the
@@ -11,13 +11,13 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
11
11
 
12
12
  See the Apache Version 2.0 License for specific language governing permissions
13
13
  and limitations under the License.
14
- ***************************************************************************** */var $9;(function($){(function(J){var Q=typeof globalThis==="object"?globalThis:typeof global==="object"?global:typeof self==="object"?self:typeof this==="object"?this:Y(),W=H($);if(typeof Q.Reflect<"u")W=H(Q.Reflect,W);if(J(W,Q),typeof Q.Reflect>"u")Q.Reflect=$;function H(G,B){return function(w,_){if(Object.defineProperty(G,w,{configurable:!0,writable:!0,value:_}),B)B(w,_)}}function X(){try{return Function("return this;")()}catch(G){}}function q(){try{return(0,eval)("(function() { return this; })()")}catch(G){}}function Y(){return X()||q()}})(function(J,Q){var W=Object.prototype.hasOwnProperty,H=typeof Symbol==="function",X=H&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",q=H&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",Y=typeof Object.create==="function",G={__proto__:[]}instanceof Array,B=!Y&&!G,w={create:Y?function(){return G4(Object.create(null))}:G?function(){return G4({__proto__:null})}:function(){return G4({})},has:B?function(D,U){return W.call(D,U)}:function(D,U){return U in D},get:B?function(D,U){return W.call(D,U)?D[U]:void 0}:function(D,U){return D[U]}},_=Object.getPrototypeOf(Function),R=typeof Map==="function"&&typeof Map.prototype.entries==="function"?Map:VW(),S=typeof Set==="function"&&typeof Set.prototype.entries==="function"?Set:FW(),P=typeof WeakMap==="function"?WeakMap:zW(),h=H?Symbol.for("@reflect-metadata:registry"):void 0,o=DW(),W0=UW(o);function z0(D,U,V,j){if(!v(V)){if(!t8(D))throw TypeError();if(!e(U))throw TypeError();if(!e(j)&&!v(j)&&!S1(j))throw TypeError();if(S1(j))j=void 0;return V=g0(V),HW(D,U,V,j)}else{if(!t8(D))throw TypeError();if(!a8(U))throw TypeError();return WW(D,U)}}J("decorate",z0);function t(D,U){function V(j,K){if(!e(j))throw TypeError();if(!v(K)&&!BW(K))throw TypeError();i8(D,U,j,K)}return V}J("metadata",t);function R0(D,U,V,j){if(!e(V))throw TypeError();if(!v(j))j=g0(j);return i8(D,U,V,j)}J("defineMetadata",R0);function H0(D,U,V){if(!e(U))throw TypeError();if(!v(V))V=g0(V);return c8(D,U,V)}J("hasMetadata",H0);function U0(D,U,V){if(!e(U))throw TypeError();if(!v(V))V=g0(V);return X4(D,U,V)}J("hasOwnMetadata",U0);function C0(D,U,V){if(!e(U))throw TypeError();if(!v(V))V=g0(V);return n8(D,U,V)}J("getMetadata",C0);function W4(D,U,V){if(!e(U))throw TypeError();if(!v(V))V=g0(V);return d8(D,U,V)}J("getOwnMetadata",W4);function h0(D,U){if(!e(D))throw TypeError();if(!v(U))U=g0(U);return p8(D,U)}J("getMetadataKeys",h0);function H4(D,U){if(!e(D))throw TypeError();if(!v(U))U=g0(U);return s8(D,U)}J("getOwnMetadataKeys",H4);function m8(D,U,V){if(!e(U))throw TypeError();if(!v(V))V=g0(V);if(!e(U))throw TypeError();if(!v(V))V=g0(V);var j=Q$(U,V,!1);if(v(j))return!1;return j.OrdinaryDeleteMetadata(D,U,V)}J("deleteMetadata",m8);function WW(D,U){for(var V=D.length-1;V>=0;--V){var j=D[V],K=j(U);if(!v(K)&&!S1(K)){if(!a8(K))throw TypeError();U=K}}return U}function HW(D,U,V,j){for(var K=D.length-1;K>=0;--K){var $0=D[K],Q0=$0(U,V,j);if(!v(Q0)&&!S1(Q0)){if(!e(Q0))throw TypeError();j=Q0}}return j}function c8(D,U,V){var j=X4(D,U,V);if(j)return!0;var K=Y4(U);if(!S1(K))return c8(D,K,V);return!1}function X4(D,U,V){var j=Q$(U,V,!1);if(v(j))return!1;return r8(j.OrdinaryHasOwnMetadata(D,U,V))}function n8(D,U,V){var j=X4(D,U,V);if(j)return d8(D,U,V);var K=Y4(U);if(!S1(K))return n8(D,K,V);return}function d8(D,U,V){var j=Q$(U,V,!1);if(v(j))return;return j.OrdinaryGetOwnMetadata(D,U,V)}function i8(D,U,V,j){var K=Q$(V,j,!0);K.OrdinaryDefineOwnMetadata(D,U,V,j)}function p8(D,U){var V=s8(D,U),j=Y4(D);if(j===null)return V;var K=p8(j,U);if(K.length<=0)return V;if(V.length<=0)return K;var $0=new S,Q0=[];for(var l=0,C=V;l<C.length;l++){var b=C[l],Z=$0.has(b);if(!Z)$0.add(b),Q0.push(b)}for(var k=0,c=K;k<c.length;k++){var b=c[k],Z=$0.has(b);if(!Z)$0.add(b),Q0.push(b)}return Q0}function s8(D,U){var V=Q$(D,U,!1);if(!V)return[];return V.OrdinaryOwnMetadataKeys(D,U)}function o8(D){if(D===null)return 1;switch(typeof D){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return D===null?1:6;default:return 6}}function v(D){return D===void 0}function S1(D){return D===null}function XW(D){return typeof D==="symbol"}function e(D){return typeof D==="object"?D!==null:typeof D==="function"}function qW(D,U){switch(o8(D)){case 0:return D;case 1:return D;case 2:return D;case 3:return D;case 4:return D;case 5:return D}var V=U===3?"string":U===5?"number":"default",j=e8(D,X);if(j!==void 0){var K=j.call(D,V);if(e(K))throw TypeError();return K}return YW(D,V==="default"?"number":V)}function YW(D,U){if(U==="string"){var V=D.toString;if(A1(V)){var j=V.call(D);if(!e(j))return j}var K=D.valueOf;if(A1(K)){var j=K.call(D);if(!e(j))return j}}else{var K=D.valueOf;if(A1(K)){var j=K.call(D);if(!e(j))return j}var $0=D.toString;if(A1($0)){var j=$0.call(D);if(!e(j))return j}}throw TypeError()}function r8(D){return!!D}function GW(D){return""+D}function g0(D){var U=qW(D,3);if(XW(U))return U;return GW(U)}function t8(D){return Array.isArray?Array.isArray(D):D instanceof Object?D instanceof Array:Object.prototype.toString.call(D)==="[object Array]"}function A1(D){return typeof D==="function"}function a8(D){return typeof D==="function"}function BW(D){switch(o8(D)){case 3:return!0;case 4:return!0;default:return!1}}function q4(D,U){return D===U||D!==D&&U!==U}function e8(D,U){var V=D[U];if(V===void 0||V===null)return;if(!A1(V))throw TypeError();return V}function $2(D){var U=e8(D,q);if(!A1(U))throw TypeError();var V=U.call(D);if(!e(V))throw TypeError();return V}function J2(D){return D.value}function Q2(D){var U=D.next();return U.done?!1:U}function W2(D){var U=D.return;if(U)U.call(D)}function Y4(D){var U=Object.getPrototypeOf(D);if(typeof D!=="function"||D===_)return U;if(U!==_)return U;var V=D.prototype,j=V&&Object.getPrototypeOf(V);if(j==null||j===Object.prototype)return U;var K=j.constructor;if(typeof K!=="function")return U;if(K===D)return U;return K}function wW(){var D;if(!v(h)&&typeof Q.Reflect<"u"&&!(h in Q.Reflect)&&typeof Q.Reflect.defineMetadata==="function")D=_W(Q.Reflect);var U,V,j,K=new P,$0={registerProvider:Q0,getProvider:C,setProvider:Z};return $0;function Q0(k){if(!Object.isExtensible($0))throw Error("Cannot add provider to a frozen registry.");switch(!0){case D===k:break;case v(U):U=k;break;case U===k:break;case v(V):V=k;break;case V===k:break;default:if(j===void 0)j=new S;j.add(k);break}}function l(k,c){if(!v(U)){if(U.isProviderFor(k,c))return U;if(!v(V)){if(V.isProviderFor(k,c))return U;if(!v(j)){var i=$2(j);while(!0){var J0=Q2(i);if(!J0)return;var O0=J2(J0);if(O0.isProviderFor(k,c))return W2(i),O0}}}}if(!v(D)&&D.isProviderFor(k,c))return D;return}function C(k,c){var i=K.get(k),J0;if(!v(i))J0=i.get(c);if(!v(J0))return J0;if(J0=l(k,c),!v(J0)){if(v(i))i=new R,K.set(k,i);i.set(c,J0)}return J0}function b(k){if(v(k))throw TypeError();return U===k||V===k||!v(j)&&j.has(k)}function Z(k,c,i){if(!b(i))throw Error("Metadata provider not registered.");var J0=C(k,c);if(J0!==i){if(!v(J0))return!1;var O0=K.get(k);if(v(O0))O0=new R,K.set(k,O0);O0.set(c,i)}return!0}}function DW(){var D;if(!v(h)&&e(Q.Reflect)&&Object.isExtensible(Q.Reflect))D=Q.Reflect[h];if(v(D))D=wW();if(!v(h)&&e(Q.Reflect)&&Object.isExtensible(Q.Reflect))Object.defineProperty(Q.Reflect,h,{enumerable:!1,configurable:!1,writable:!1,value:D});return D}function UW(D){var U=new P,V={isProviderFor:function(b,Z){var k=U.get(b);if(v(k))return!1;return k.has(Z)},OrdinaryDefineOwnMetadata:Q0,OrdinaryHasOwnMetadata:K,OrdinaryGetOwnMetadata:$0,OrdinaryOwnMetadataKeys:l,OrdinaryDeleteMetadata:C};return o.registerProvider(V),V;function j(b,Z,k){var c=U.get(b),i=!1;if(v(c)){if(!k)return;c=new R,U.set(b,c),i=!0}var J0=c.get(Z);if(v(J0)){if(!k)return;if(J0=new R,c.set(Z,J0),!D.setProvider(b,Z,V)){if(c.delete(Z),i)U.delete(b);throw Error("Wrong provider for target.")}}return J0}function K(b,Z,k){var c=j(Z,k,!1);if(v(c))return!1;return r8(c.has(b))}function $0(b,Z,k){var c=j(Z,k,!1);if(v(c))return;return c.get(b)}function Q0(b,Z,k,c){var i=j(k,c,!0);i.set(b,Z)}function l(b,Z){var k=[],c=j(b,Z,!1);if(v(c))return k;var i=c.keys(),J0=$2(i),O0=0;while(!0){var H2=Q2(J0);if(!H2)return k.length=O0,k;var NW=J2(H2);try{k[O0]=NW}catch(LW){try{W2(J0)}finally{throw LW}}O0++}}function C(b,Z,k){var c=j(Z,k,!1);if(v(c))return!1;if(!c.delete(b))return!1;if(c.size===0){var i=U.get(Z);if(!v(i)){if(i.delete(k),i.size===0)U.delete(i)}}return!0}}function _W(D){var{defineMetadata:U,hasOwnMetadata:V,getOwnMetadata:j,getOwnMetadataKeys:K,deleteMetadata:$0}=D,Q0=new P,l={isProviderFor:function(C,b){var Z=Q0.get(C);if(!v(Z)&&Z.has(b))return!0;if(K(C,b).length){if(v(Z))Z=new S,Q0.set(C,Z);return Z.add(b),!0}return!1},OrdinaryDefineOwnMetadata:U,OrdinaryHasOwnMetadata:V,OrdinaryGetOwnMetadata:j,OrdinaryOwnMetadataKeys:K,OrdinaryDeleteMetadata:$0};return l}function Q$(D,U,V){var j=o.getProvider(D,U);if(!v(j))return j;if(V){if(o.setProvider(D,U,W0))return W0;throw Error("Illegal state.")}return}function VW(){var D={},U=[],V=function(){function l(C,b,Z){this._index=0,this._keys=C,this._values=b,this._selector=Z}return l.prototype["@@iterator"]=function(){return this},l.prototype[q]=function(){return this},l.prototype.next=function(){var C=this._index;if(C>=0&&C<this._keys.length){var b=this._selector(this._keys[C],this._values[C]);if(C+1>=this._keys.length)this._index=-1,this._keys=U,this._values=U;else this._index++;return{value:b,done:!1}}return{value:void 0,done:!0}},l.prototype.throw=function(C){if(this._index>=0)this._index=-1,this._keys=U,this._values=U;throw C},l.prototype.return=function(C){if(this._index>=0)this._index=-1,this._keys=U,this._values=U;return{value:C,done:!0}},l}(),j=function(){function l(){this._keys=[],this._values=[],this._cacheKey=D,this._cacheIndex=-2}return Object.defineProperty(l.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),l.prototype.has=function(C){return this._find(C,!1)>=0},l.prototype.get=function(C){var b=this._find(C,!1);return b>=0?this._values[b]:void 0},l.prototype.set=function(C,b){var Z=this._find(C,!0);return this._values[Z]=b,this},l.prototype.delete=function(C){var b=this._find(C,!1);if(b>=0){var Z=this._keys.length;for(var k=b+1;k<Z;k++)this._keys[k-1]=this._keys[k],this._values[k-1]=this._values[k];if(this._keys.length--,this._values.length--,q4(C,this._cacheKey))this._cacheKey=D,this._cacheIndex=-2;return!0}return!1},l.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=D,this._cacheIndex=-2},l.prototype.keys=function(){return new V(this._keys,this._values,K)},l.prototype.values=function(){return new V(this._keys,this._values,$0)},l.prototype.entries=function(){return new V(this._keys,this._values,Q0)},l.prototype["@@iterator"]=function(){return this.entries()},l.prototype[q]=function(){return this.entries()},l.prototype._find=function(C,b){if(!q4(this._cacheKey,C)){this._cacheIndex=-1;for(var Z=0;Z<this._keys.length;Z++)if(q4(this._keys[Z],C)){this._cacheIndex=Z;break}}if(this._cacheIndex<0&&b)this._cacheIndex=this._keys.length,this._keys.push(C),this._values.push(void 0);return this._cacheIndex},l}();return j;function K(l,C){return l}function $0(l,C){return C}function Q0(l,C){return[l,C]}}function FW(){var D=function(){function U(){this._map=new R}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[q]=function(){return this.keys()},U}();return D}function zW(){var D=16,U=w.create(),V=j();return function(){function C(){this._key=j()}return C.prototype.has=function(b){var Z=K(b,!1);return Z!==void 0?w.has(Z,this._key):!1},C.prototype.get=function(b){var Z=K(b,!1);return Z!==void 0?w.get(Z,this._key):void 0},C.prototype.set=function(b,Z){var k=K(b,!0);return k[this._key]=Z,this},C.prototype.delete=function(b){var Z=K(b,!1);return Z!==void 0?delete Z[this._key]:!1},C.prototype.clear=function(){this._key=j()},C}();function j(){var C;do C="@@WeakMap@@"+l();while(w.has(U,C));return U[C]=!0,C}function K(C,b){if(!W.call(C,V)){if(!b)return;Object.defineProperty(C,V,{value:w.create()})}return C[V]}function $0(C,b){for(var Z=0;Z<b;++Z)C[Z]=Math.random()*255|0;return C}function Q0(C){if(typeof Uint8Array==="function"){var b=new Uint8Array(C);if(typeof crypto<"u")crypto.getRandomValues(b);else if(typeof msCrypto<"u")msCrypto.getRandomValues(b);else $0(b,C);return b}return $0(Array(C),C)}function l(){var C=Q0(D);C[6]=C[6]&79|64,C[8]=C[8]&191|128;var b="";for(var Z=0;Z<D;++Z){var k=C[Z];if(Z===4||Z===6||Z===8)b+="-";if(k<16)b+="0";b+=k.toString(16).toLowerCase()}return b}}function G4(D){return D.__=void 0,delete D.__,D}})})($9||($9={}))});var N0,V9,F9,z9,N9;var j$=G2(()=>{N0=class N0 extends Error{statusCode;details;constructor($,J,Q){super(J);this.statusCode=$;this.details=Q;if(this.name="HTTPException",Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toJSON(){return{error:this.message,statusCode:this.statusCode,...this.details&&{details:this.details}}}};V9=class V9 extends N0{constructor($="Not Found",J){super(404,$,J);this.name="NotFoundException"}toJSON(){return{error:this.message,statusCode:this.statusCode,...this.details&&{details:this.details}}}};F9=class F9 extends N0{constructor($="Unauthorized",J){super(401,$,J);this.name="UnauthorizedException"}toJSON(){return{error:this.message,statusCode:this.statusCode,...this.details&&{details:this.details}}}};z9=class z9 extends N0{constructor($="Forbidden",J){super(403,$,J);this.name="ForbiddenException"}toJSON(){return{error:this.message,statusCode:this.statusCode,...this.details&&{details:this.details}}}};N9=class N9 extends N0{constructor($="Bad Request",J){super(400,$,J);this.name="BadRequestException"}toJSON(){return{error:this.message,statusCode:this.statusCode,...this.details&&{details:this.details}}}}});var n9={};L0(n9,{TokenRevokedException:()=>n4,TokenExpiredException:()=>Z$,InvalidTokenException:()=>V1,AuthorizationException:()=>B0,AuthenticationException:()=>Y0});var Y0,B0,Z$,V1,n4;var F1=G2(()=>{j$();Y0=class Y0 extends N0{constructor($="Authentication required"){super(401,$);this.name="AuthenticationException"}toJSON(){return{error:"Authentication Error",message:this.message,statusCode:401}}};B0=class B0 extends N0{constructor($="Insufficient permissions"){super(403,$);this.name="AuthorizationException"}toJSON(){return{error:"Authorization Error",message:this.message,statusCode:403}}};Z$=class Z$ extends Y0{constructor($="Token has expired"){super($);this.name="TokenExpiredException"}};V1=class V1 extends Y0{constructor($="Invalid token"){super($);this.name="InvalidTokenException"}};n4=class n4 extends Y0{constructor($="Token has been revoked"){super($);this.name="TokenRevokedException"}}});var i4={};L0(i4,{HonoAdapter:()=>A6});class A6{hono;name="hono";runtime;constructor($){this.hono=$;this.runtime=DX()}listen($,J){switch(this.runtime){case"bun":return this.listenBun($,J);case"deno":return this.listenDeno($,J);case"node":return this.listenNode($,J);case"workerd":throw Error("Cloudflare Workers do not support listen(). Deploy using wrangler or export the handler with getHandler().");default:throw Error(`Unsupported runtime: ${this.runtime}. FastAPI-TS supports Bun, Node.js, Deno, and Cloudflare Workers.`)}}getHandler(){return this.hono.fetch}getRuntime(){return this.runtime}listenBun($,J){let Q=Bun.serve({port:$,fetch:this.hono.fetch});if(J)J();return Q}listenDeno($,J){let Q=new AbortController;return Deno.serve({port:$,signal:Q.signal,onListen:J},this.hono.fetch),{port:$,close:()=>Q.abort()}}listenNode($,J){try{let{serve:Q}=(()=>{throw new Error("Cannot require module "+"@hono/node-server");})();return Q({fetch:this.hono.fetch,port:$},J)}catch(Q){throw Error("Node.js adapter requires @hono/node-server package. Install it with: npm install @hono/node-server")}}}var DX=()=>{if(typeof Bun<"u")return"bun";if(typeof Deno<"u")return"deno";if(typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers")return"workerd";if(typeof process<"u"&&process.versions&&process.versions.node)return"node";return"unknown"};var d9={};L0(d9,{ExpressAdapter:()=>E6});class E6{app;name="express";express;constructor($){this.app=$;try{let J=(()=>{throw new Error("Cannot require module "+"express");})();this.express=J(),this.setupBridge()}catch(J){throw Error("Express adapter requires express package. Install it with: npm install express")}}setupBridge(){let $=this.app.getHono();this.express.use(async(J,Q)=>{try{let W=this.createWebRequest(J),H=await $.fetch(W);await this.sendExpressResponse(Q,H)}catch(W){Q.status(500).json({error:"Internal Server Error",message:W instanceof Error?W.message:"Unknown error"})}})}createWebRequest($){let J=$.protocol||"http",Q=$.get("host")||"localhost",W=`${J}://${Q}${$.originalUrl||$.url}`,H=new Headers;for(let[q,Y]of Object.entries($.headers))if(typeof Y==="string")H.set(q,Y);else if(Array.isArray(Y))Y.forEach((G)=>H.append(q,G));let X={method:$.method,headers:H};if($.method!=="GET"&&$.method!=="HEAD"){if($.body)X.body=JSON.stringify($.body),H.set("content-type","application/json")}return new Request(W,X)}async sendExpressResponse($,J){if($.status(J.status),J.headers.forEach((Q,W)=>{$.setHeader(W,Q)}),J.body){let Q=J.headers.get("content-type")||"";if(Q.includes("application/json")){let W=await J.json();$.json(W)}else if(Q.includes("text/")){let W=await J.text();$.send(W)}else{let W=await J.arrayBuffer();$.send(Buffer.from(W))}}else $.end()}listen($,J){return this.express.listen($,J)}getHandler(){return this.express}getExpressApp(){return this.express}}var d1=A((r4,$5)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var O6=require("buffer"),m0=O6.Buffer;function e9($,J){for(var Q in $)J[Q]=$[Q]}if(m0.from&&m0.alloc&&m0.allocUnsafe&&m0.allocUnsafeSlow)$5.exports=O6;else e9(O6,r4),r4.Buffer=N1;function N1($,J,Q){return m0($,J,Q)}N1.prototype=Object.create(m0.prototype);e9(m0,N1);N1.from=function($,J,Q){if(typeof $==="number")throw TypeError("Argument must not be a number");return m0($,J,Q)};N1.alloc=function($,J,Q){if(typeof $!=="number")throw TypeError("Argument must be a number");var W=m0($);if(J!==void 0)if(typeof Q==="string")W.fill(J,Q);else W.fill(J);else W.fill(0);return W};N1.allocUnsafe=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return m0($)};N1.allocUnsafeSlow=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return O6.SlowBuffer($)}});var t4=A((HN,J5)=>{var M6=d1().Buffer,CX=require("stream"),OX=require("util");function b6($){if(this.buffer=null,this.writable=!0,this.readable=!0,!$)return this.buffer=M6.alloc(0),this;if(typeof $.pipe==="function")return this.buffer=M6.alloc(0),$.pipe(this),this;if($.length||typeof $==="object")return this.buffer=$,this.writable=!1,process.nextTick(function(){this.emit("end",$),this.readable=!1,this.emit("close")}.bind(this)),this;throw TypeError("Unexpected data type ("+typeof $+")")}OX.inherits(b6,CX);b6.prototype.write=function(J){this.buffer=M6.concat([this.buffer,M6.from(J)]),this.emit("data",J)};b6.prototype.end=function(J){if(J)this.write(J);this.emit("end",J),this.emit("close"),this.writable=!1,this.readable=!1};J5.exports=b6});var W5=A((XN,Q5)=>{function a4($){var J=($/8|0)+($%8===0?0:1);return J}var MX={ES256:a4(256),ES384:a4(384),ES512:a4(521)};function bX($){var J=MX[$];if(J)return J;throw Error('Unknown algorithm "'+$+'"')}Q5.exports=bX});var w5=A((qN,B5)=>{var P6=d1().Buffer,X5=W5(),Z6=128,q5=0,PX=32,ZX=16,IX=2,Y5=ZX|PX|q5<<6,I6=IX|q5<<6;function kX($){return $.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function G5($){if(P6.isBuffer($))return $;else if(typeof $==="string")return P6.from($,"base64");throw TypeError("ECDSA signature must be a Base64 string or a Buffer")}function KX($,J){$=G5($);var Q=X5(J),W=Q+1,H=$.length,X=0;if($[X++]!==Y5)throw Error('Could not find expected "seq"');var q=$[X++];if(q===(Z6|1))q=$[X++];if(H-X<q)throw Error('"seq" specified length of "'+q+'", only "'+(H-X)+'" remaining');if($[X++]!==I6)throw Error('Could not find expected "int" for "r"');var Y=$[X++];if(H-X-2<Y)throw Error('"r" specified length of "'+Y+'", only "'+(H-X-2)+'" available');if(W<Y)throw Error('"r" specified length of "'+Y+'", max of "'+W+'" is acceptable');var G=X;if(X+=Y,$[X++]!==I6)throw Error('Could not find expected "int" for "s"');var B=$[X++];if(H-X!==B)throw Error('"s" specified length of "'+B+'", expected "'+(H-X)+'"');if(W<B)throw Error('"s" specified length of "'+B+'", max of "'+W+'" is acceptable');var w=X;if(X+=B,X!==H)throw Error('Expected to consume entire buffer, but "'+(H-X)+'" bytes remain');var _=Q-Y,R=Q-B,S=P6.allocUnsafe(_+Y+R+B);for(X=0;X<_;++X)S[X]=0;$.copy(S,X,G+Math.max(-_,0),G+Y),X=Q;for(var P=X;X<P+R;++X)S[X]=0;return $.copy(S,X,w+Math.max(-R,0),w+B),S=S.toString("base64"),S=kX(S),S}function H5($,J,Q){var W=0;while(J+W<Q&&$[J+W]===0)++W;var H=$[J+W]>=Z6;if(H)--W;return W}function fX($,J){$=G5($);var Q=X5(J),W=$.length;if(W!==Q*2)throw TypeError('"'+J+'" signatures must be "'+Q*2+'" bytes, saw "'+W+'"');var H=H5($,0,Q),X=H5($,Q,$.length),q=Q-H,Y=Q-X,G=2+q+1+1+Y,B=G<Z6,w=P6.allocUnsafe((B?2:3)+G),_=0;if(w[_++]=Y5,B)w[_++]=G;else w[_++]=Z6|1,w[_++]=G&255;if(w[_++]=I6,w[_++]=q,H<0)w[_++]=0,_+=$.copy(w,_,0,Q);else _+=$.copy(w,_,H,Q);if(w[_++]=I6,w[_++]=Y,X<0)w[_++]=0,$.copy(w,_,Q);else $.copy(w,_,Q+X);return w}B5.exports={derToJose:KX,joseToDer:fX}});var U5=A((YN,D5)=>{var f$=require("buffer").Buffer,e4=require("buffer").SlowBuffer;D5.exports=k6;function k6($,J){if(!f$.isBuffer($)||!f$.isBuffer(J))return!1;if($.length!==J.length)return!1;var Q=0;for(var W=0;W<$.length;W++)Q|=$[W]^J[W];return Q===0}k6.install=function(){f$.prototype.equal=e4.prototype.equal=function(J){return k6(this,J)}};var TX=f$.prototype.equal,xX=e4.prototype.equal;k6.restore=function(){f$.prototype.equal=TX,e4.prototype.equal=xX}});var W8=A((GN,A5)=>{var p1=d1().Buffer,j0=require("crypto"),V5=w5(),_5=require("util"),vX=`"%s" is not a valid algorithm.
14
+ ***************************************************************************** */var J9;(function($){(function(J){var Q=typeof globalThis==="object"?globalThis:typeof global==="object"?global:typeof self==="object"?self:typeof this==="object"?this:Y(),W=H($);if(typeof Q.Reflect<"u")W=H(Q.Reflect,W);if(J(W,Q),typeof Q.Reflect>"u")Q.Reflect=$;function H(G,B){return function(w,_){if(Object.defineProperty(G,w,{configurable:!0,writable:!0,value:_}),B)B(w,_)}}function X(){try{return Function("return this;")()}catch(G){}}function q(){try{return(0,eval)("(function() { return this; })()")}catch(G){}}function Y(){return X()||q()}})(function(J,Q){var W=Object.prototype.hasOwnProperty,H=typeof Symbol==="function",X=H&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",q=H&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",Y=typeof Object.create==="function",G={__proto__:[]}instanceof Array,B=!Y&&!G,w={create:Y?function(){return B4(Object.create(null))}:G?function(){return B4({__proto__:null})}:function(){return B4({})},has:B?function(D,U){return W.call(D,U)}:function(D,U){return U in D},get:B?function(D,U){return W.call(D,U)?D[U]:void 0}:function(D,U){return D[U]}},_=Object.getPrototypeOf(Function),R=typeof Map==="function"&&typeof Map.prototype.entries==="function"?Map:VW(),S=typeof Set==="function"&&typeof Set.prototype.entries==="function"?Set:FW(),P=typeof WeakMap==="function"?WeakMap:zW(),h=H?Symbol.for("@reflect-metadata:registry"):void 0,o=DW(),W0=UW(o);function z0(D,U,V,j){if(!v(V)){if(!a8(D))throw TypeError();if(!e(U))throw TypeError();if(!e(j)&&!v(j)&&!S1(j))throw TypeError();if(S1(j))j=void 0;return V=g0(V),HW(D,U,V,j)}else{if(!a8(D))throw TypeError();if(!e8(U))throw TypeError();return WW(D,U)}}J("decorate",z0);function t(D,U){function V(j,K){if(!e(j))throw TypeError();if(!v(K)&&!BW(K))throw TypeError();p8(D,U,j,K)}return V}J("metadata",t);function R0(D,U,V,j){if(!e(V))throw TypeError();if(!v(j))j=g0(j);return p8(D,U,V,j)}J("defineMetadata",R0);function H0(D,U,V){if(!e(U))throw TypeError();if(!v(V))V=g0(V);return n8(D,U,V)}J("hasMetadata",H0);function U0(D,U,V){if(!e(U))throw TypeError();if(!v(V))V=g0(V);return q4(D,U,V)}J("hasOwnMetadata",U0);function C0(D,U,V){if(!e(U))throw TypeError();if(!v(V))V=g0(V);return d8(D,U,V)}J("getMetadata",C0);function H4(D,U,V){if(!e(U))throw TypeError();if(!v(V))V=g0(V);return i8(D,U,V)}J("getOwnMetadata",H4);function h0(D,U){if(!e(D))throw TypeError();if(!v(U))U=g0(U);return s8(D,U)}J("getMetadataKeys",h0);function X4(D,U){if(!e(D))throw TypeError();if(!v(U))U=g0(U);return o8(D,U)}J("getOwnMetadataKeys",X4);function c8(D,U,V){if(!e(U))throw TypeError();if(!v(V))V=g0(V);if(!e(U))throw TypeError();if(!v(V))V=g0(V);var j=W$(U,V,!1);if(v(j))return!1;return j.OrdinaryDeleteMetadata(D,U,V)}J("deleteMetadata",c8);function WW(D,U){for(var V=D.length-1;V>=0;--V){var j=D[V],K=j(U);if(!v(K)&&!S1(K)){if(!e8(K))throw TypeError();U=K}}return U}function HW(D,U,V,j){for(var K=D.length-1;K>=0;--K){var $0=D[K],Q0=$0(U,V,j);if(!v(Q0)&&!S1(Q0)){if(!e(Q0))throw TypeError();j=Q0}}return j}function n8(D,U,V){var j=q4(D,U,V);if(j)return!0;var K=G4(U);if(!S1(K))return n8(D,K,V);return!1}function q4(D,U,V){var j=W$(U,V,!1);if(v(j))return!1;return t8(j.OrdinaryHasOwnMetadata(D,U,V))}function d8(D,U,V){var j=q4(D,U,V);if(j)return i8(D,U,V);var K=G4(U);if(!S1(K))return d8(D,K,V);return}function i8(D,U,V){var j=W$(U,V,!1);if(v(j))return;return j.OrdinaryGetOwnMetadata(D,U,V)}function p8(D,U,V,j){var K=W$(V,j,!0);K.OrdinaryDefineOwnMetadata(D,U,V,j)}function s8(D,U){var V=o8(D,U),j=G4(D);if(j===null)return V;var K=s8(j,U);if(K.length<=0)return V;if(V.length<=0)return K;var $0=new S,Q0=[];for(var l=0,C=V;l<C.length;l++){var b=C[l],Z=$0.has(b);if(!Z)$0.add(b),Q0.push(b)}for(var k=0,c=K;k<c.length;k++){var b=c[k],Z=$0.has(b);if(!Z)$0.add(b),Q0.push(b)}return Q0}function o8(D,U){var V=W$(D,U,!1);if(!V)return[];return V.OrdinaryOwnMetadataKeys(D,U)}function r8(D){if(D===null)return 1;switch(typeof D){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return D===null?1:6;default:return 6}}function v(D){return D===void 0}function S1(D){return D===null}function XW(D){return typeof D==="symbol"}function e(D){return typeof D==="object"?D!==null:typeof D==="function"}function qW(D,U){switch(r8(D)){case 0:return D;case 1:return D;case 2:return D;case 3:return D;case 4:return D;case 5:return D}var V=U===3?"string":U===5?"number":"default",j=$2(D,X);if(j!==void 0){var K=j.call(D,V);if(e(K))throw TypeError();return K}return YW(D,V==="default"?"number":V)}function YW(D,U){if(U==="string"){var V=D.toString;if(A1(V)){var j=V.call(D);if(!e(j))return j}var K=D.valueOf;if(A1(K)){var j=K.call(D);if(!e(j))return j}}else{var K=D.valueOf;if(A1(K)){var j=K.call(D);if(!e(j))return j}var $0=D.toString;if(A1($0)){var j=$0.call(D);if(!e(j))return j}}throw TypeError()}function t8(D){return!!D}function GW(D){return""+D}function g0(D){var U=qW(D,3);if(XW(U))return U;return GW(U)}function a8(D){return Array.isArray?Array.isArray(D):D instanceof Object?D instanceof Array:Object.prototype.toString.call(D)==="[object Array]"}function A1(D){return typeof D==="function"}function e8(D){return typeof D==="function"}function BW(D){switch(r8(D)){case 3:return!0;case 4:return!0;default:return!1}}function Y4(D,U){return D===U||D!==D&&U!==U}function $2(D,U){var V=D[U];if(V===void 0||V===null)return;if(!A1(V))throw TypeError();return V}function J2(D){var U=$2(D,q);if(!A1(U))throw TypeError();var V=U.call(D);if(!e(V))throw TypeError();return V}function Q2(D){return D.value}function W2(D){var U=D.next();return U.done?!1:U}function H2(D){var U=D.return;if(U)U.call(D)}function G4(D){var U=Object.getPrototypeOf(D);if(typeof D!=="function"||D===_)return U;if(U!==_)return U;var V=D.prototype,j=V&&Object.getPrototypeOf(V);if(j==null||j===Object.prototype)return U;var K=j.constructor;if(typeof K!=="function")return U;if(K===D)return U;return K}function wW(){var D;if(!v(h)&&typeof Q.Reflect<"u"&&!(h in Q.Reflect)&&typeof Q.Reflect.defineMetadata==="function")D=_W(Q.Reflect);var U,V,j,K=new P,$0={registerProvider:Q0,getProvider:C,setProvider:Z};return $0;function Q0(k){if(!Object.isExtensible($0))throw Error("Cannot add provider to a frozen registry.");switch(!0){case D===k:break;case v(U):U=k;break;case U===k:break;case v(V):V=k;break;case V===k:break;default:if(j===void 0)j=new S;j.add(k);break}}function l(k,c){if(!v(U)){if(U.isProviderFor(k,c))return U;if(!v(V)){if(V.isProviderFor(k,c))return U;if(!v(j)){var i=J2(j);while(!0){var J0=W2(i);if(!J0)return;var O0=Q2(J0);if(O0.isProviderFor(k,c))return H2(i),O0}}}}if(!v(D)&&D.isProviderFor(k,c))return D;return}function C(k,c){var i=K.get(k),J0;if(!v(i))J0=i.get(c);if(!v(J0))return J0;if(J0=l(k,c),!v(J0)){if(v(i))i=new R,K.set(k,i);i.set(c,J0)}return J0}function b(k){if(v(k))throw TypeError();return U===k||V===k||!v(j)&&j.has(k)}function Z(k,c,i){if(!b(i))throw Error("Metadata provider not registered.");var J0=C(k,c);if(J0!==i){if(!v(J0))return!1;var O0=K.get(k);if(v(O0))O0=new R,K.set(k,O0);O0.set(c,i)}return!0}}function DW(){var D;if(!v(h)&&e(Q.Reflect)&&Object.isExtensible(Q.Reflect))D=Q.Reflect[h];if(v(D))D=wW();if(!v(h)&&e(Q.Reflect)&&Object.isExtensible(Q.Reflect))Object.defineProperty(Q.Reflect,h,{enumerable:!1,configurable:!1,writable:!1,value:D});return D}function UW(D){var U=new P,V={isProviderFor:function(b,Z){var k=U.get(b);if(v(k))return!1;return k.has(Z)},OrdinaryDefineOwnMetadata:Q0,OrdinaryHasOwnMetadata:K,OrdinaryGetOwnMetadata:$0,OrdinaryOwnMetadataKeys:l,OrdinaryDeleteMetadata:C};return o.registerProvider(V),V;function j(b,Z,k){var c=U.get(b),i=!1;if(v(c)){if(!k)return;c=new R,U.set(b,c),i=!0}var J0=c.get(Z);if(v(J0)){if(!k)return;if(J0=new R,c.set(Z,J0),!D.setProvider(b,Z,V)){if(c.delete(Z),i)U.delete(b);throw Error("Wrong provider for target.")}}return J0}function K(b,Z,k){var c=j(Z,k,!1);if(v(c))return!1;return t8(c.has(b))}function $0(b,Z,k){var c=j(Z,k,!1);if(v(c))return;return c.get(b)}function Q0(b,Z,k,c){var i=j(k,c,!0);i.set(b,Z)}function l(b,Z){var k=[],c=j(b,Z,!1);if(v(c))return k;var i=c.keys(),J0=J2(i),O0=0;while(!0){var X2=W2(J0);if(!X2)return k.length=O0,k;var NW=Q2(X2);try{k[O0]=NW}catch(LW){try{H2(J0)}finally{throw LW}}O0++}}function C(b,Z,k){var c=j(Z,k,!1);if(v(c))return!1;if(!c.delete(b))return!1;if(c.size===0){var i=U.get(Z);if(!v(i)){if(i.delete(k),i.size===0)U.delete(i)}}return!0}}function _W(D){var{defineMetadata:U,hasOwnMetadata:V,getOwnMetadata:j,getOwnMetadataKeys:K,deleteMetadata:$0}=D,Q0=new P,l={isProviderFor:function(C,b){var Z=Q0.get(C);if(!v(Z)&&Z.has(b))return!0;if(K(C,b).length){if(v(Z))Z=new S,Q0.set(C,Z);return Z.add(b),!0}return!1},OrdinaryDefineOwnMetadata:U,OrdinaryHasOwnMetadata:V,OrdinaryGetOwnMetadata:j,OrdinaryOwnMetadataKeys:K,OrdinaryDeleteMetadata:$0};return l}function W$(D,U,V){var j=o.getProvider(D,U);if(!v(j))return j;if(V){if(o.setProvider(D,U,W0))return W0;throw Error("Illegal state.")}return}function VW(){var D={},U=[],V=function(){function l(C,b,Z){this._index=0,this._keys=C,this._values=b,this._selector=Z}return l.prototype["@@iterator"]=function(){return this},l.prototype[q]=function(){return this},l.prototype.next=function(){var C=this._index;if(C>=0&&C<this._keys.length){var b=this._selector(this._keys[C],this._values[C]);if(C+1>=this._keys.length)this._index=-1,this._keys=U,this._values=U;else this._index++;return{value:b,done:!1}}return{value:void 0,done:!0}},l.prototype.throw=function(C){if(this._index>=0)this._index=-1,this._keys=U,this._values=U;throw C},l.prototype.return=function(C){if(this._index>=0)this._index=-1,this._keys=U,this._values=U;return{value:C,done:!0}},l}(),j=function(){function l(){this._keys=[],this._values=[],this._cacheKey=D,this._cacheIndex=-2}return Object.defineProperty(l.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),l.prototype.has=function(C){return this._find(C,!1)>=0},l.prototype.get=function(C){var b=this._find(C,!1);return b>=0?this._values[b]:void 0},l.prototype.set=function(C,b){var Z=this._find(C,!0);return this._values[Z]=b,this},l.prototype.delete=function(C){var b=this._find(C,!1);if(b>=0){var Z=this._keys.length;for(var k=b+1;k<Z;k++)this._keys[k-1]=this._keys[k],this._values[k-1]=this._values[k];if(this._keys.length--,this._values.length--,Y4(C,this._cacheKey))this._cacheKey=D,this._cacheIndex=-2;return!0}return!1},l.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=D,this._cacheIndex=-2},l.prototype.keys=function(){return new V(this._keys,this._values,K)},l.prototype.values=function(){return new V(this._keys,this._values,$0)},l.prototype.entries=function(){return new V(this._keys,this._values,Q0)},l.prototype["@@iterator"]=function(){return this.entries()},l.prototype[q]=function(){return this.entries()},l.prototype._find=function(C,b){if(!Y4(this._cacheKey,C)){this._cacheIndex=-1;for(var Z=0;Z<this._keys.length;Z++)if(Y4(this._keys[Z],C)){this._cacheIndex=Z;break}}if(this._cacheIndex<0&&b)this._cacheIndex=this._keys.length,this._keys.push(C),this._values.push(void 0);return this._cacheIndex},l}();return j;function K(l,C){return l}function $0(l,C){return C}function Q0(l,C){return[l,C]}}function FW(){var D=function(){function U(){this._map=new R}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[q]=function(){return this.keys()},U}();return D}function zW(){var D=16,U=w.create(),V=j();return function(){function C(){this._key=j()}return C.prototype.has=function(b){var Z=K(b,!1);return Z!==void 0?w.has(Z,this._key):!1},C.prototype.get=function(b){var Z=K(b,!1);return Z!==void 0?w.get(Z,this._key):void 0},C.prototype.set=function(b,Z){var k=K(b,!0);return k[this._key]=Z,this},C.prototype.delete=function(b){var Z=K(b,!1);return Z!==void 0?delete Z[this._key]:!1},C.prototype.clear=function(){this._key=j()},C}();function j(){var C;do C="@@WeakMap@@"+l();while(w.has(U,C));return U[C]=!0,C}function K(C,b){if(!W.call(C,V)){if(!b)return;Object.defineProperty(C,V,{value:w.create()})}return C[V]}function $0(C,b){for(var Z=0;Z<b;++Z)C[Z]=Math.random()*255|0;return C}function Q0(C){if(typeof Uint8Array==="function"){var b=new Uint8Array(C);if(typeof crypto<"u")crypto.getRandomValues(b);else if(typeof msCrypto<"u")msCrypto.getRandomValues(b);else $0(b,C);return b}return $0(Array(C),C)}function l(){var C=Q0(D);C[6]=C[6]&79|64,C[8]=C[8]&191|128;var b="";for(var Z=0;Z<D;++Z){var k=C[Z];if(Z===4||Z===6||Z===8)b+="-";if(k<16)b+="0";b+=k.toString(16).toLowerCase()}return b}}function B4(D){return D.__=void 0,delete D.__,D}})})(J9||(J9={}))});var N0,F9,z9,N9,X6;var l1=B2(()=>{N0=class N0 extends Error{statusCode;details;constructor($,J,Q){super(J);this.statusCode=$;this.details=Q;if(this.name="HTTPException",Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toJSON(){return{error:this.message,statusCode:this.statusCode,...this.details&&{details:this.details}}}};F9=class F9 extends N0{constructor($="Not Found",J){super(404,$,J);this.name="NotFoundException"}toJSON(){return{error:this.message,statusCode:this.statusCode,...this.details&&{details:this.details}}}};z9=class z9 extends N0{constructor($="Unauthorized",J){super(401,$,J);this.name="UnauthorizedException"}toJSON(){return{error:this.message,statusCode:this.statusCode,...this.details&&{details:this.details}}}};N9=class N9 extends N0{constructor($="Forbidden",J){super(403,$,J);this.name="ForbiddenException"}toJSON(){return{error:this.message,statusCode:this.statusCode,...this.details&&{details:this.details}}}};X6=class X6 extends N0{constructor($="Bad Request",J){super(400,$,J);this.name="BadRequestException"}toJSON(){return{error:this.message,statusCode:this.statusCode,...this.details&&{details:this.details}}}}});var n9={};L0(n9,{TokenRevokedException:()=>d4,TokenExpiredException:()=>Z$,InvalidTokenException:()=>V1,AuthorizationException:()=>B0,AuthenticationException:()=>Y0});var Y0,B0,Z$,V1,d4;var F1=B2(()=>{l1();Y0=class Y0 extends N0{constructor($="Authentication required"){super(401,$);this.name="AuthenticationException"}toJSON(){return{error:"Authentication Error",message:this.message,statusCode:401}}};B0=class B0 extends N0{constructor($="Insufficient permissions"){super(403,$);this.name="AuthorizationException"}toJSON(){return{error:"Authorization Error",message:this.message,statusCode:403}}};Z$=class Z$ extends Y0{constructor($="Token has expired"){super($);this.name="TokenExpiredException"}};V1=class V1 extends Y0{constructor($="Invalid token"){super($);this.name="InvalidTokenException"}};d4=class d4 extends Y0{constructor($="Token has been revoked"){super($);this.name="TokenRevokedException"}}});var p4={};L0(p4,{HonoAdapter:()=>E6});class E6{hono;name="hono";runtime;constructor($){this.hono=$;this.runtime=DX()}listen($,J){switch(this.runtime){case"bun":return this.listenBun($,J);case"deno":return this.listenDeno($,J);case"node":return this.listenNode($,J);case"workerd":throw Error("Cloudflare Workers do not support listen(). Deploy using wrangler or export the handler with getHandler().");default:throw Error(`Unsupported runtime: ${this.runtime}. FastAPI-TS supports Bun, Node.js, Deno, and Cloudflare Workers.`)}}getHandler(){return this.hono.fetch}getRuntime(){return this.runtime}listenBun($,J){let Q=Bun.serve({port:$,fetch:this.hono.fetch});if(J)J();return Q}listenDeno($,J){let Q=new AbortController;return Deno.serve({port:$,signal:Q.signal,onListen:J},this.hono.fetch),{port:$,close:()=>Q.abort()}}listenNode($,J){try{let{serve:Q}=(()=>{throw new Error("Cannot require module "+"@hono/node-server");})();return Q({fetch:this.hono.fetch,port:$},J)}catch(Q){throw Error("Node.js adapter requires @hono/node-server package. Install it with: npm install @hono/node-server")}}}var DX=()=>{if(typeof Bun<"u")return"bun";if(typeof Deno<"u")return"deno";if(typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers")return"workerd";if(typeof process<"u"&&process.versions&&process.versions.node)return"node";return"unknown"};var d9={};L0(d9,{ExpressAdapter:()=>R6});class R6{app;name="express";express;constructor($){this.app=$;try{let J=(()=>{throw new Error("Cannot require module "+"express");})();this.express=J(),this.setupBridge()}catch(J){throw Error("Express adapter requires express package. Install it with: npm install express")}}setupBridge(){let $=this.app.getHono();this.express.use(async(J,Q)=>{try{let W=this.createWebRequest(J),H=await $.fetch(W);await this.sendExpressResponse(Q,H)}catch(W){Q.status(500).json({error:"Internal Server Error",message:W instanceof Error?W.message:"Unknown error"})}})}createWebRequest($){let J=$.protocol||"http",Q=$.get("host")||"localhost",W=`${J}://${Q}${$.originalUrl||$.url}`,H=new Headers;for(let[q,Y]of Object.entries($.headers))if(typeof Y==="string")H.set(q,Y);else if(Array.isArray(Y))Y.forEach((G)=>H.append(q,G));let X={method:$.method,headers:H};if($.method!=="GET"&&$.method!=="HEAD"){if($.body)X.body=JSON.stringify($.body),H.set("content-type","application/json")}return new Request(W,X)}async sendExpressResponse($,J){if($.status(J.status),J.headers.forEach((Q,W)=>{$.setHeader(W,Q)}),J.body){let Q=J.headers.get("content-type")||"";if(Q.includes("application/json")){let W=await J.json();$.json(W)}else if(Q.includes("text/")){let W=await J.text();$.send(W)}else{let W=await J.arrayBuffer();$.send(Buffer.from(W))}}else $.end()}listen($,J){return this.express.listen($,J)}getHandler(){return this.express}getExpressApp(){return this.express}}var i1=A((t4,$5)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var M6=require("buffer"),m0=M6.Buffer;function e9($,J){for(var Q in $)J[Q]=$[Q]}if(m0.from&&m0.alloc&&m0.allocUnsafe&&m0.allocUnsafeSlow)$5.exports=M6;else e9(M6,t4),t4.Buffer=N1;function N1($,J,Q){return m0($,J,Q)}N1.prototype=Object.create(m0.prototype);e9(m0,N1);N1.from=function($,J,Q){if(typeof $==="number")throw TypeError("Argument must not be a number");return m0($,J,Q)};N1.alloc=function($,J,Q){if(typeof $!=="number")throw TypeError("Argument must be a number");var W=m0($);if(J!==void 0)if(typeof Q==="string")W.fill(J,Q);else W.fill(J);else W.fill(0);return W};N1.allocUnsafe=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return m0($)};N1.allocUnsafeSlow=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return M6.SlowBuffer($)}});var a4=A((XN,J5)=>{var b6=i1().Buffer,CX=require("stream"),OX=require("util");function P6($){if(this.buffer=null,this.writable=!0,this.readable=!0,!$)return this.buffer=b6.alloc(0),this;if(typeof $.pipe==="function")return this.buffer=b6.alloc(0),$.pipe(this),this;if($.length||typeof $==="object")return this.buffer=$,this.writable=!1,process.nextTick(function(){this.emit("end",$),this.readable=!1,this.emit("close")}.bind(this)),this;throw TypeError("Unexpected data type ("+typeof $+")")}OX.inherits(P6,CX);P6.prototype.write=function(J){this.buffer=b6.concat([this.buffer,b6.from(J)]),this.emit("data",J)};P6.prototype.end=function(J){if(J)this.write(J);this.emit("end",J),this.emit("close"),this.writable=!1,this.readable=!1};J5.exports=P6});var W5=A((qN,Q5)=>{function e4($){var J=($/8|0)+($%8===0?0:1);return J}var MX={ES256:e4(256),ES384:e4(384),ES512:e4(521)};function bX($){var J=MX[$];if(J)return J;throw Error('Unknown algorithm "'+$+'"')}Q5.exports=bX});var w5=A((YN,B5)=>{var Z6=i1().Buffer,X5=W5(),I6=128,q5=0,PX=32,ZX=16,IX=2,Y5=ZX|PX|q5<<6,k6=IX|q5<<6;function kX($){return $.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function G5($){if(Z6.isBuffer($))return $;else if(typeof $==="string")return Z6.from($,"base64");throw TypeError("ECDSA signature must be a Base64 string or a Buffer")}function KX($,J){$=G5($);var Q=X5(J),W=Q+1,H=$.length,X=0;if($[X++]!==Y5)throw Error('Could not find expected "seq"');var q=$[X++];if(q===(I6|1))q=$[X++];if(H-X<q)throw Error('"seq" specified length of "'+q+'", only "'+(H-X)+'" remaining');if($[X++]!==k6)throw Error('Could not find expected "int" for "r"');var Y=$[X++];if(H-X-2<Y)throw Error('"r" specified length of "'+Y+'", only "'+(H-X-2)+'" available');if(W<Y)throw Error('"r" specified length of "'+Y+'", max of "'+W+'" is acceptable');var G=X;if(X+=Y,$[X++]!==k6)throw Error('Could not find expected "int" for "s"');var B=$[X++];if(H-X!==B)throw Error('"s" specified length of "'+B+'", expected "'+(H-X)+'"');if(W<B)throw Error('"s" specified length of "'+B+'", max of "'+W+'" is acceptable');var w=X;if(X+=B,X!==H)throw Error('Expected to consume entire buffer, but "'+(H-X)+'" bytes remain');var _=Q-Y,R=Q-B,S=Z6.allocUnsafe(_+Y+R+B);for(X=0;X<_;++X)S[X]=0;$.copy(S,X,G+Math.max(-_,0),G+Y),X=Q;for(var P=X;X<P+R;++X)S[X]=0;return $.copy(S,X,w+Math.max(-R,0),w+B),S=S.toString("base64"),S=kX(S),S}function H5($,J,Q){var W=0;while(J+W<Q&&$[J+W]===0)++W;var H=$[J+W]>=I6;if(H)--W;return W}function fX($,J){$=G5($);var Q=X5(J),W=$.length;if(W!==Q*2)throw TypeError('"'+J+'" signatures must be "'+Q*2+'" bytes, saw "'+W+'"');var H=H5($,0,Q),X=H5($,Q,$.length),q=Q-H,Y=Q-X,G=2+q+1+1+Y,B=G<I6,w=Z6.allocUnsafe((B?2:3)+G),_=0;if(w[_++]=Y5,B)w[_++]=G;else w[_++]=I6|1,w[_++]=G&255;if(w[_++]=k6,w[_++]=q,H<0)w[_++]=0,_+=$.copy(w,_,0,Q);else _+=$.copy(w,_,H,Q);if(w[_++]=k6,w[_++]=Y,X<0)w[_++]=0,$.copy(w,_,Q);else $.copy(w,_,Q+X);return w}B5.exports={derToJose:KX,joseToDer:fX}});var U5=A((GN,D5)=>{var f$=require("buffer").Buffer,$8=require("buffer").SlowBuffer;D5.exports=K6;function K6($,J){if(!f$.isBuffer($)||!f$.isBuffer(J))return!1;if($.length!==J.length)return!1;var Q=0;for(var W=0;W<$.length;W++)Q|=$[W]^J[W];return Q===0}K6.install=function(){f$.prototype.equal=$8.prototype.equal=function(J){return K6(this,J)}};var TX=f$.prototype.equal,xX=$8.prototype.equal;K6.restore=function(){f$.prototype.equal=TX,$8.prototype.equal=xX}});var H8=A((BN,A5)=>{var s1=i1().Buffer,j0=require("crypto"),V5=w5(),_5=require("util"),vX=`"%s" is not a valid algorithm.
15
15
  Supported algorithms are:
16
- "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".`,T$="secret must be a string or buffer",i1="key must be a string or a buffer",hX="key must be a string, a buffer or an object",J8=typeof j0.createPublicKey==="function";if(J8)i1+=" or a KeyObject",T$+="or a KeyObject";function F5($){if(p1.isBuffer($))return;if(typeof $==="string")return;if(!J8)throw x0(i1);if(typeof $!=="object")throw x0(i1);if(typeof $.type!=="string")throw x0(i1);if(typeof $.asymmetricKeyType!=="string")throw x0(i1);if(typeof $.export!=="function")throw x0(i1)}function z5($){if(p1.isBuffer($))return;if(typeof $==="string")return;if(typeof $==="object")return;throw x0(hX)}function gX($){if(p1.isBuffer($))return;if(typeof $==="string")return $;if(!J8)throw x0(T$);if(typeof $!=="object")throw x0(T$);if($.type!=="secret")throw x0(T$);if(typeof $.export!=="function")throw x0(T$)}function Q8($){return $.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function N5($){$=$.toString();var J=4-$.length%4;if(J!==4)for(var Q=0;Q<J;++Q)$+="=";return $.replace(/\-/g,"+").replace(/_/g,"/")}function x0($){var J=[].slice.call(arguments,1),Q=_5.format.bind(_5,$).apply(null,J);return TypeError(Q)}function yX($){return p1.isBuffer($)||typeof $==="string"}function x$($){if(!yX($))$=JSON.stringify($);return $}function L5($){return function(Q,W){gX(W),Q=x$(Q);var H=j0.createHmac("sha"+$,W),X=(H.update(Q),H.digest("base64"));return Q8(X)}}var $8,uX="timingSafeEqual"in j0?function(J,Q){if(J.byteLength!==Q.byteLength)return!1;return j0.timingSafeEqual(J,Q)}:function(J,Q){if(!$8)$8=U5();return $8(J,Q)};function lX($){return function(Q,W,H){var X=L5($)(Q,H);return uX(p1.from(W),p1.from(X))}}function j5($){return function(Q,W){z5(W),Q=x$(Q);var H=j0.createSign("RSA-SHA"+$),X=(H.update(Q),H.sign(W,"base64"));return Q8(X)}}function S5($){return function(Q,W,H){F5(H),Q=x$(Q),W=N5(W);var X=j0.createVerify("RSA-SHA"+$);return X.update(Q),X.verify(H,W,"base64")}}function mX($){return function(Q,W){z5(W),Q=x$(Q);var H=j0.createSign("RSA-SHA"+$),X=(H.update(Q),H.sign({key:W,padding:j0.constants.RSA_PKCS1_PSS_PADDING,saltLength:j0.constants.RSA_PSS_SALTLEN_DIGEST},"base64"));return Q8(X)}}function cX($){return function(Q,W,H){F5(H),Q=x$(Q),W=N5(W);var X=j0.createVerify("RSA-SHA"+$);return X.update(Q),X.verify({key:H,padding:j0.constants.RSA_PKCS1_PSS_PADDING,saltLength:j0.constants.RSA_PSS_SALTLEN_DIGEST},W,"base64")}}function nX($){var J=j5($);return function(){var W=J.apply(null,arguments);return W=V5.derToJose(W,"ES"+$),W}}function dX($){var J=S5($);return function(W,H,X){H=V5.joseToDer(H,"ES"+$).toString("base64");var q=J(W,H,X);return q}}function iX(){return function(){return""}}function pX(){return function(J,Q){return Q===""}}A5.exports=function(J){var Q={hs:L5,rs:j5,ps:mX,es:nX,none:iX},W={hs:lX,rs:S5,ps:cX,es:dX,none:pX},H=J.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/i);if(!H)throw x0(vX,J);var X=(H[1]||H[3]).toLowerCase(),q=H[2];return{sign:Q[X](q),verify:W[X](q)}}});var H8=A((BN,E5)=>{var sX=require("buffer").Buffer;E5.exports=function(J){if(typeof J==="string")return J;if(typeof J==="number"||sX.isBuffer(J))return J.toString();return JSON.stringify(J)}});var P5=A((wN,b5)=>{var oX=d1().Buffer,R5=t4(),rX=W8(),tX=require("stream"),C5=H8(),X8=require("util");function O5($,J){return oX.from($,J).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function aX($,J,Q){Q=Q||"utf8";var W=O5(C5($),"binary"),H=O5(C5(J),Q);return X8.format("%s.%s",W,H)}function M5($){var{header:J,payload:Q}=$,W=$.secret||$.privateKey,H=$.encoding,X=rX(J.alg),q=aX(J,Q,H),Y=X.sign(q,W);return X8.format("%s.%s",q,Y)}function K6($){var J=$.secret||$.privateKey||$.key,Q=new R5(J);this.readable=!0,this.header=$.header,this.encoding=$.encoding,this.secret=this.privateKey=this.key=Q,this.payload=new R5($.payload),this.secret.once("close",function(){if(!this.payload.writable&&this.readable)this.sign()}.bind(this)),this.payload.once("close",function(){if(!this.secret.writable&&this.readable)this.sign()}.bind(this))}X8.inherits(K6,tX);K6.prototype.sign=function(){try{var J=M5({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",J),this.emit("data",J),this.emit("end"),this.readable=!1,J}catch(Q){this.readable=!1,this.emit("error",Q),this.emit("close")}};K6.sign=M5;b5.exports=K6});var g5=A((DN,h5)=>{var I5=d1().Buffer,Z5=t4(),eX=W8(),$q=require("stream"),k5=H8(),Jq=require("util"),Qq=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function Wq($){return Object.prototype.toString.call($)==="[object Object]"}function Hq($){if(Wq($))return $;try{return JSON.parse($)}catch(J){return}}function K5($){var J=$.split(".",1)[0];return Hq(I5.from(J,"base64").toString("binary"))}function Xq($){return $.split(".",2).join(".")}function f5($){return $.split(".")[2]}function qq($,J){J=J||"utf8";var Q=$.split(".")[1];return I5.from(Q,"base64").toString(J)}function T5($){return Qq.test($)&&!!K5($)}function x5($,J,Q){if(!J){var W=Error("Missing algorithm parameter for jws.verify");throw W.code="MISSING_ALGORITHM",W}$=k5($);var H=f5($),X=Xq($),q=eX(J);return q.verify(X,H,Q)}function v5($,J){if(J=J||{},$=k5($),!T5($))return null;var Q=K5($);if(!Q)return null;var W=qq($);if(Q.typ==="JWT"||J.json)W=JSON.parse(W,J.encoding);return{header:Q,payload:W,signature:f5($)}}function s1($){$=$||{};var J=$.secret||$.publicKey||$.key,Q=new Z5(J);this.readable=!0,this.algorithm=$.algorithm,this.encoding=$.encoding,this.secret=this.publicKey=this.key=Q,this.signature=new Z5($.signature),this.secret.once("close",function(){if(!this.signature.writable&&this.readable)this.verify()}.bind(this)),this.signature.once("close",function(){if(!this.secret.writable&&this.readable)this.verify()}.bind(this))}Jq.inherits(s1,$q);s1.prototype.verify=function(){try{var J=x5(this.signature.buffer,this.algorithm,this.key.buffer),Q=v5(this.signature.buffer,this.encoding);return this.emit("done",J,Q),this.emit("data",J),this.emit("end"),this.readable=!1,J}catch(W){this.readable=!1,this.emit("error",W),this.emit("close")}};s1.decode=v5;s1.isValid=T5;s1.verify=x5;h5.exports=s1});var T6=A(($1)=>{var y5=P5(),f6=g5(),Yq=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"];$1.ALGORITHMS=Yq;$1.sign=y5.sign;$1.verify=f6.verify;$1.decode=f6.decode;$1.isValid=f6.isValid;$1.createSign=function(J){return new y5(J)};$1.createVerify=function(J){return new f6(J)}});var q8=A((_N,u5)=>{var Gq=T6();u5.exports=function($,J){J=J||{};var Q=Gq.decode($,J);if(!Q)return null;var W=Q.payload;if(typeof W==="string")try{var H=JSON.parse(W);if(H!==null&&typeof H==="object")W=H}catch(X){}if(J.complete===!0)return{header:Q.header,payload:W,signature:Q.signature};return W}});var v$=A((VN,l5)=>{var x6=function($,J){if(Error.call(this,$),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);if(this.name="JsonWebTokenError",this.message=$,J)this.inner=J};x6.prototype=Object.create(Error.prototype);x6.prototype.constructor=x6;l5.exports=x6});var Y8=A((FN,c5)=>{var m5=v$(),v6=function($,J){m5.call(this,$),this.name="NotBeforeError",this.date=J};v6.prototype=Object.create(m5.prototype);v6.prototype.constructor=v6;c5.exports=v6});var G8=A((zN,d5)=>{var n5=v$(),h6=function($,J){n5.call(this,$),this.name="TokenExpiredError",this.expiredAt=J};h6.prototype=Object.create(n5.prototype);h6.prototype.constructor=h6;d5.exports=h6});var p5=A((NN,i5)=>{var o1=1000,r1=o1*60,t1=r1*60,L1=t1*24,Bq=L1*7,wq=L1*365.25;i5.exports=function($,J){J=J||{};var Q=typeof $;if(Q==="string"&&$.length>0)return Dq($);else if(Q==="number"&&isFinite($))return J.long?_q($):Uq($);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify($))};function Dq($){if($=String($),$.length>100)return;var J=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec($);if(!J)return;var Q=parseFloat(J[1]),W=(J[2]||"ms").toLowerCase();switch(W){case"years":case"year":case"yrs":case"yr":case"y":return Q*wq;case"weeks":case"week":case"w":return Q*Bq;case"days":case"day":case"d":return Q*L1;case"hours":case"hour":case"hrs":case"hr":case"h":return Q*t1;case"minutes":case"minute":case"mins":case"min":case"m":return Q*r1;case"seconds":case"second":case"secs":case"sec":case"s":return Q*o1;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return Q;default:return}}function Uq($){var J=Math.abs($);if(J>=L1)return Math.round($/L1)+"d";if(J>=t1)return Math.round($/t1)+"h";if(J>=r1)return Math.round($/r1)+"m";if(J>=o1)return Math.round($/o1)+"s";return $+"ms"}function _q($){var J=Math.abs($);if(J>=L1)return g6($,J,L1,"day");if(J>=t1)return g6($,J,t1,"hour");if(J>=r1)return g6($,J,r1,"minute");if(J>=o1)return g6($,J,o1,"second");return $+" ms"}function g6($,J,Q,W){var H=J>=Q*1.5;return Math.round($/Q)+" "+W+(H?"s":"")}});var B8=A((LN,s5)=>{var Vq=p5();s5.exports=function($,J){var Q=J||Math.floor(Date.now()/1000);if(typeof $==="string"){var W=Vq($);if(typeof W>"u")return;return Math.floor(Q+W/1000)}else if(typeof $==="number")return Q+$;else return}});var h$=A((jN,o5)=>{var Fq=Number.MAX_SAFE_INTEGER||9007199254740991,zq=["major","premajor","minor","preminor","patch","prepatch","prerelease"];o5.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Fq,RELEASE_TYPES:zq,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var g$=A((SN,r5)=>{var Nq=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...$)=>console.error("SEMVER",...$):()=>{};r5.exports=Nq});var a1=A((c0,t5)=>{var{MAX_SAFE_COMPONENT_LENGTH:w8,MAX_SAFE_BUILD_LENGTH:Lq,MAX_LENGTH:jq}=h$(),Sq=g$();c0=t5.exports={};var Aq=c0.re=[],Eq=c0.safeRe=[],O=c0.src=[],Rq=c0.safeSrc=[],M=c0.t={},Cq=0,D8="[a-zA-Z0-9-]",Oq=[["\\s",1],["\\d",jq],[D8,Lq]],Mq=($)=>{for(let[J,Q]of Oq)$=$.split(`${J}*`).join(`${J}{0,${Q}}`).split(`${J}+`).join(`${J}{1,${Q}}`);return $},g=($,J,Q)=>{let W=Mq(J),H=Cq++;Sq($,H,J),M[$]=H,O[H]=J,Rq[H]=W,Aq[H]=new RegExp(J,Q?"g":void 0),Eq[H]=new RegExp(W,Q?"g":void 0)};g("NUMERICIDENTIFIER","0|[1-9]\\d*");g("NUMERICIDENTIFIERLOOSE","\\d+");g("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${D8}*`);g("MAINVERSION",`(${O[M.NUMERICIDENTIFIER]})\\.(${O[M.NUMERICIDENTIFIER]})\\.(${O[M.NUMERICIDENTIFIER]})`);g("MAINVERSIONLOOSE",`(${O[M.NUMERICIDENTIFIERLOOSE]})\\.(${O[M.NUMERICIDENTIFIERLOOSE]})\\.(${O[M.NUMERICIDENTIFIERLOOSE]})`);g("PRERELEASEIDENTIFIER",`(?:${O[M.NONNUMERICIDENTIFIER]}|${O[M.NUMERICIDENTIFIER]})`);g("PRERELEASEIDENTIFIERLOOSE",`(?:${O[M.NONNUMERICIDENTIFIER]}|${O[M.NUMERICIDENTIFIERLOOSE]})`);g("PRERELEASE",`(?:-(${O[M.PRERELEASEIDENTIFIER]}(?:\\.${O[M.PRERELEASEIDENTIFIER]})*))`);g("PRERELEASELOOSE",`(?:-?(${O[M.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${O[M.PRERELEASEIDENTIFIERLOOSE]})*))`);g("BUILDIDENTIFIER",`${D8}+`);g("BUILD",`(?:\\+(${O[M.BUILDIDENTIFIER]}(?:\\.${O[M.BUILDIDENTIFIER]})*))`);g("FULLPLAIN",`v?${O[M.MAINVERSION]}${O[M.PRERELEASE]}?${O[M.BUILD]}?`);g("FULL",`^${O[M.FULLPLAIN]}$`);g("LOOSEPLAIN",`[v=\\s]*${O[M.MAINVERSIONLOOSE]}${O[M.PRERELEASELOOSE]}?${O[M.BUILD]}?`);g("LOOSE",`^${O[M.LOOSEPLAIN]}$`);g("GTLT","((?:<|>)?=?)");g("XRANGEIDENTIFIERLOOSE",`${O[M.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);g("XRANGEIDENTIFIER",`${O[M.NUMERICIDENTIFIER]}|x|X|\\*`);g("XRANGEPLAIN",`[v=\\s]*(${O[M.XRANGEIDENTIFIER]})(?:\\.(${O[M.XRANGEIDENTIFIER]})(?:\\.(${O[M.XRANGEIDENTIFIER]})(?:${O[M.PRERELEASE]})?${O[M.BUILD]}?)?)?`);g("XRANGEPLAINLOOSE",`[v=\\s]*(${O[M.XRANGEIDENTIFIERLOOSE]})(?:\\.(${O[M.XRANGEIDENTIFIERLOOSE]})(?:\\.(${O[M.XRANGEIDENTIFIERLOOSE]})(?:${O[M.PRERELEASELOOSE]})?${O[M.BUILD]}?)?)?`);g("XRANGE",`^${O[M.GTLT]}\\s*${O[M.XRANGEPLAIN]}$`);g("XRANGELOOSE",`^${O[M.GTLT]}\\s*${O[M.XRANGEPLAINLOOSE]}$`);g("COERCEPLAIN",`(^|[^\\d])(\\d{1,${w8}})(?:\\.(\\d{1,${w8}}))?(?:\\.(\\d{1,${w8}}))?`);g("COERCE",`${O[M.COERCEPLAIN]}(?:$|[^\\d])`);g("COERCEFULL",O[M.COERCEPLAIN]+`(?:${O[M.PRERELEASE]})?(?:${O[M.BUILD]})?(?:$|[^\\d])`);g("COERCERTL",O[M.COERCE],!0);g("COERCERTLFULL",O[M.COERCEFULL],!0);g("LONETILDE","(?:~>?)");g("TILDETRIM",`(\\s*)${O[M.LONETILDE]}\\s+`,!0);c0.tildeTrimReplace="$1~";g("TILDE",`^${O[M.LONETILDE]}${O[M.XRANGEPLAIN]}$`);g("TILDELOOSE",`^${O[M.LONETILDE]}${O[M.XRANGEPLAINLOOSE]}$`);g("LONECARET","(?:\\^)");g("CARETTRIM",`(\\s*)${O[M.LONECARET]}\\s+`,!0);c0.caretTrimReplace="$1^";g("CARET",`^${O[M.LONECARET]}${O[M.XRANGEPLAIN]}$`);g("CARETLOOSE",`^${O[M.LONECARET]}${O[M.XRANGEPLAINLOOSE]}$`);g("COMPARATORLOOSE",`^${O[M.GTLT]}\\s*(${O[M.LOOSEPLAIN]})$|^$`);g("COMPARATOR",`^${O[M.GTLT]}\\s*(${O[M.FULLPLAIN]})$|^$`);g("COMPARATORTRIM",`(\\s*)${O[M.GTLT]}\\s*(${O[M.LOOSEPLAIN]}|${O[M.XRANGEPLAIN]})`,!0);c0.comparatorTrimReplace="$1$2$3";g("HYPHENRANGE",`^\\s*(${O[M.XRANGEPLAIN]})\\s+-\\s+(${O[M.XRANGEPLAIN]})\\s*$`);g("HYPHENRANGELOOSE",`^\\s*(${O[M.XRANGEPLAINLOOSE]})\\s+-\\s+(${O[M.XRANGEPLAINLOOSE]})\\s*$`);g("STAR","(<|>)?=?\\s*\\*");g("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");g("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var y6=A((AN,a5)=>{var bq=Object.freeze({loose:!0}),Pq=Object.freeze({}),Zq=($)=>{if(!$)return Pq;if(typeof $!=="object")return bq;return $};a5.exports=Zq});var U8=A((EN,JJ)=>{var e5=/^[0-9]+$/,$J=($,J)=>{if(typeof $==="number"&&typeof J==="number")return $===J?0:$<J?-1:1;let Q=e5.test($),W=e5.test(J);if(Q&&W)$=+$,J=+J;return $===J?0:Q&&!W?-1:W&&!Q?1:$<J?-1:1},Iq=($,J)=>$J(J,$);JJ.exports={compareIdentifiers:$J,rcompareIdentifiers:Iq}});var w0=A((RN,WJ)=>{var u6=g$(),{MAX_LENGTH:QJ,MAX_SAFE_INTEGER:l6}=h$(),{safeRe:m6,t:c6}=a1(),kq=y6(),{compareIdentifiers:_8}=U8();class v0{constructor($,J){if(J=kq(J),$ instanceof v0)if($.loose===!!J.loose&&$.includePrerelease===!!J.includePrerelease)return $;else $=$.version;else if(typeof $!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof $}".`);if($.length>QJ)throw TypeError(`version is longer than ${QJ} characters`);u6("SemVer",$,J),this.options=J,this.loose=!!J.loose,this.includePrerelease=!!J.includePrerelease;let Q=$.trim().match(J.loose?m6[c6.LOOSE]:m6[c6.FULL]);if(!Q)throw TypeError(`Invalid Version: ${$}`);if(this.raw=$,this.major=+Q[1],this.minor=+Q[2],this.patch=+Q[3],this.major>l6||this.major<0)throw TypeError("Invalid major version");if(this.minor>l6||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>l6||this.patch<0)throw TypeError("Invalid patch version");if(!Q[4])this.prerelease=[];else this.prerelease=Q[4].split(".").map((W)=>{if(/^[0-9]+$/.test(W)){let H=+W;if(H>=0&&H<l6)return H}return W});this.build=Q[5]?Q[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare($){if(u6("SemVer.compare",this.version,this.options,$),!($ instanceof v0)){if(typeof $==="string"&&$===this.version)return 0;$=new v0($,this.options)}if($.version===this.version)return 0;return this.compareMain($)||this.comparePre($)}compareMain($){if(!($ instanceof v0))$=new v0($,this.options);if(this.major<$.major)return-1;if(this.major>$.major)return 1;if(this.minor<$.minor)return-1;if(this.minor>$.minor)return 1;if(this.patch<$.patch)return-1;if(this.patch>$.patch)return 1;return 0}comparePre($){if(!($ instanceof v0))$=new v0($,this.options);if(this.prerelease.length&&!$.prerelease.length)return-1;else if(!this.prerelease.length&&$.prerelease.length)return 1;else if(!this.prerelease.length&&!$.prerelease.length)return 0;let J=0;do{let Q=this.prerelease[J],W=$.prerelease[J];if(u6("prerelease compare",J,Q,W),Q===void 0&&W===void 0)return 0;else if(W===void 0)return 1;else if(Q===void 0)return-1;else if(Q===W)continue;else return _8(Q,W)}while(++J)}compareBuild($){if(!($ instanceof v0))$=new v0($,this.options);let J=0;do{let Q=this.build[J],W=$.build[J];if(u6("build compare",J,Q,W),Q===void 0&&W===void 0)return 0;else if(W===void 0)return 1;else if(Q===void 0)return-1;else if(Q===W)continue;else return _8(Q,W)}while(++J)}inc($,J,Q){if($.startsWith("pre")){if(!J&&Q===!1)throw Error("invalid increment argument: identifier is empty");if(J){let W=`-${J}`.match(this.options.loose?m6[c6.PRERELEASELOOSE]:m6[c6.PRERELEASE]);if(!W||W[1]!==J)throw Error(`invalid identifier: ${J}`)}}switch($){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",J,Q);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",J,Q);break;case"prepatch":this.prerelease.length=0,this.inc("patch",J,Q),this.inc("pre",J,Q);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",J,Q);this.inc("pre",J,Q);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let W=Number(Q)?1:0;if(this.prerelease.length===0)this.prerelease=[W];else{let H=this.prerelease.length;while(--H>=0)if(typeof this.prerelease[H]==="number")this.prerelease[H]++,H=-2;if(H===-1){if(J===this.prerelease.join(".")&&Q===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(W)}}if(J){let H=[J,W];if(Q===!1)H=[J];if(_8(this.prerelease[0],J)===0){if(isNaN(this.prerelease[1]))this.prerelease=H}else this.prerelease=H}break}default:throw Error(`invalid increment argument: ${$}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}WJ.exports=v0});var j1=A((CN,XJ)=>{var HJ=w0(),Kq=($,J,Q=!1)=>{if($ instanceof HJ)return $;try{return new HJ($,J)}catch(W){if(!Q)return null;throw W}};XJ.exports=Kq});var YJ=A((ON,qJ)=>{var fq=j1(),Tq=($,J)=>{let Q=fq($,J);return Q?Q.version:null};qJ.exports=Tq});var BJ=A((MN,GJ)=>{var xq=j1(),vq=($,J)=>{let Q=xq($.trim().replace(/^[=v]+/,""),J);return Q?Q.version:null};GJ.exports=vq});var UJ=A((bN,DJ)=>{var wJ=w0(),hq=($,J,Q,W,H)=>{if(typeof Q==="string")H=W,W=Q,Q=void 0;try{return new wJ($ instanceof wJ?$.version:$,Q).inc(J,W,H).version}catch(X){return null}};DJ.exports=hq});var FJ=A((PN,VJ)=>{var _J=j1(),gq=($,J)=>{let Q=_J($,null,!0),W=_J(J,null,!0),H=Q.compare(W);if(H===0)return null;let X=H>0,q=X?Q:W,Y=X?W:Q,G=!!q.prerelease.length;if(!!Y.prerelease.length&&!G){if(!Y.patch&&!Y.minor)return"major";if(Y.compareMain(q)===0){if(Y.minor&&!Y.patch)return"minor";return"patch"}}let w=G?"pre":"";if(Q.major!==W.major)return w+"major";if(Q.minor!==W.minor)return w+"minor";if(Q.patch!==W.patch)return w+"patch";return"prerelease"};VJ.exports=gq});var NJ=A((ZN,zJ)=>{var yq=w0(),uq=($,J)=>new yq($,J).major;zJ.exports=uq});var jJ=A((IN,LJ)=>{var lq=w0(),mq=($,J)=>new lq($,J).minor;LJ.exports=mq});var AJ=A((kN,SJ)=>{var cq=w0(),nq=($,J)=>new cq($,J).patch;SJ.exports=nq});var RJ=A((KN,EJ)=>{var dq=j1(),iq=($,J)=>{let Q=dq($,J);return Q&&Q.prerelease.length?Q.prerelease:null};EJ.exports=iq});var S0=A((fN,OJ)=>{var CJ=w0(),pq=($,J,Q)=>new CJ($,Q).compare(new CJ(J,Q));OJ.exports=pq});var bJ=A((TN,MJ)=>{var sq=S0(),oq=($,J,Q)=>sq(J,$,Q);MJ.exports=oq});var ZJ=A((xN,PJ)=>{var rq=S0(),tq=($,J)=>rq($,J,!0);PJ.exports=tq});var n6=A((vN,kJ)=>{var IJ=w0(),aq=($,J,Q)=>{let W=new IJ($,Q),H=new IJ(J,Q);return W.compare(H)||W.compareBuild(H)};kJ.exports=aq});var fJ=A((hN,KJ)=>{var eq=n6(),$3=($,J)=>$.sort((Q,W)=>eq(Q,W,J));KJ.exports=$3});var xJ=A((gN,TJ)=>{var J3=n6(),Q3=($,J)=>$.sort((Q,W)=>J3(W,Q,J));TJ.exports=Q3});var y$=A((yN,vJ)=>{var W3=S0(),H3=($,J,Q)=>W3($,J,Q)>0;vJ.exports=H3});var d6=A((uN,hJ)=>{var X3=S0(),q3=($,J,Q)=>X3($,J,Q)<0;hJ.exports=q3});var V8=A((lN,gJ)=>{var Y3=S0(),G3=($,J,Q)=>Y3($,J,Q)===0;gJ.exports=G3});var F8=A((mN,yJ)=>{var B3=S0(),w3=($,J,Q)=>B3($,J,Q)!==0;yJ.exports=w3});var i6=A((cN,uJ)=>{var D3=S0(),U3=($,J,Q)=>D3($,J,Q)>=0;uJ.exports=U3});var p6=A((nN,lJ)=>{var _3=S0(),V3=($,J,Q)=>_3($,J,Q)<=0;lJ.exports=V3});var z8=A((dN,mJ)=>{var F3=V8(),z3=F8(),N3=y$(),L3=i6(),j3=d6(),S3=p6(),A3=($,J,Q,W)=>{switch(J){case"===":if(typeof $==="object")$=$.version;if(typeof Q==="object")Q=Q.version;return $===Q;case"!==":if(typeof $==="object")$=$.version;if(typeof Q==="object")Q=Q.version;return $!==Q;case"":case"=":case"==":return F3($,Q,W);case"!=":return z3($,Q,W);case">":return N3($,Q,W);case">=":return L3($,Q,W);case"<":return j3($,Q,W);case"<=":return S3($,Q,W);default:throw TypeError(`Invalid operator: ${J}`)}};mJ.exports=A3});var nJ=A((iN,cJ)=>{var E3=w0(),R3=j1(),{safeRe:s6,t:o6}=a1(),C3=($,J)=>{if($ instanceof E3)return $;if(typeof $==="number")$=String($);if(typeof $!=="string")return null;J=J||{};let Q=null;if(!J.rtl)Q=$.match(J.includePrerelease?s6[o6.COERCEFULL]:s6[o6.COERCE]);else{let G=J.includePrerelease?s6[o6.COERCERTLFULL]:s6[o6.COERCERTL],B;while((B=G.exec($))&&(!Q||Q.index+Q[0].length!==$.length)){if(!Q||B.index+B[0].length!==Q.index+Q[0].length)Q=B;G.lastIndex=B.index+B[1].length+B[2].length}G.lastIndex=-1}if(Q===null)return null;let W=Q[2],H=Q[3]||"0",X=Q[4]||"0",q=J.includePrerelease&&Q[5]?`-${Q[5]}`:"",Y=J.includePrerelease&&Q[6]?`+${Q[6]}`:"";return R3(`${W}.${H}.${X}${q}${Y}`,J)};cJ.exports=C3});var pJ=A((pN,iJ)=>{class dJ{constructor(){this.max=1000,this.map=new Map}get($){let J=this.map.get($);if(J===void 0)return;else return this.map.delete($),this.map.set($,J),J}delete($){return this.map.delete($)}set($,J){if(!this.delete($)&&J!==void 0){if(this.map.size>=this.max){let W=this.map.keys().next().value;this.delete(W)}this.map.set($,J)}return this}}iJ.exports=dJ});var A0=A((sN,tJ)=>{var O3=/\s+/g;class u${constructor($,J){if(J=b3(J),$ instanceof u$)if($.loose===!!J.loose&&$.includePrerelease===!!J.includePrerelease)return $;else return new u$($.raw,J);if($ instanceof N8)return this.raw=$.value,this.set=[[$]],this.formatted=void 0,this;if(this.options=J,this.loose=!!J.loose,this.includePrerelease=!!J.includePrerelease,this.raw=$.trim().replace(O3," "),this.set=this.raw.split("||").map((Q)=>this.parseRange(Q.trim())).filter((Q)=>Q.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let Q=this.set[0];if(this.set=this.set.filter((W)=>!oJ(W[0])),this.set.length===0)this.set=[Q];else if(this.set.length>1){for(let W of this.set)if(W.length===1&&T3(W[0])){this.set=[W];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let $=0;$<this.set.length;$++){if($>0)this.formatted+="||";let J=this.set[$];for(let Q=0;Q<J.length;Q++){if(Q>0)this.formatted+=" ";this.formatted+=J[Q].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange($){let Q=((this.options.includePrerelease&&K3)|(this.options.loose&&f3))+":"+$,W=sJ.get(Q);if(W)return W;let H=this.options.loose,X=H?V0[D0.HYPHENRANGELOOSE]:V0[D0.HYPHENRANGE];$=$.replace(X,n3(this.options.includePrerelease)),p("hyphen replace",$),$=$.replace(V0[D0.COMPARATORTRIM],Z3),p("comparator trim",$),$=$.replace(V0[D0.TILDETRIM],I3),p("tilde trim",$),$=$.replace(V0[D0.CARETTRIM],k3),p("caret trim",$);let q=$.split(" ").map((w)=>x3(w,this.options)).join(" ").split(/\s+/).map((w)=>c3(w,this.options));if(H)q=q.filter((w)=>{return p("loose invalid filter",w,this.options),!!w.match(V0[D0.COMPARATORLOOSE])});p("range list",q);let Y=new Map,G=q.map((w)=>new N8(w,this.options));for(let w of G){if(oJ(w))return[w];Y.set(w.value,w)}if(Y.size>1&&Y.has(""))Y.delete("");let B=[...Y.values()];return sJ.set(Q,B),B}intersects($,J){if(!($ instanceof u$))throw TypeError("a Range is required");return this.set.some((Q)=>{return rJ(Q,J)&&$.set.some((W)=>{return rJ(W,J)&&Q.every((H)=>{return W.every((X)=>{return H.intersects(X,J)})})})})}test($){if(!$)return!1;if(typeof $==="string")try{$=new P3($,this.options)}catch(J){return!1}for(let J=0;J<this.set.length;J++)if(d3(this.set[J],$,this.options))return!0;return!1}}tJ.exports=u$;var M3=pJ(),sJ=new M3,b3=y6(),N8=l$(),p=g$(),P3=w0(),{safeRe:V0,t:D0,comparatorTrimReplace:Z3,tildeTrimReplace:I3,caretTrimReplace:k3}=a1(),{FLAG_INCLUDE_PRERELEASE:K3,FLAG_LOOSE:f3}=h$(),oJ=($)=>$.value==="<0.0.0-0",T3=($)=>$.value==="",rJ=($,J)=>{let Q=!0,W=$.slice(),H=W.pop();while(Q&&W.length)Q=W.every((X)=>{return H.intersects(X,J)}),H=W.pop();return Q},x3=($,J)=>{return $=$.replace(V0[D0.BUILD],""),p("comp",$,J),$=g3($,J),p("caret",$),$=v3($,J),p("tildes",$),$=u3($,J),p("xrange",$),$=m3($,J),p("stars",$),$},F0=($)=>!$||$.toLowerCase()==="x"||$==="*",v3=($,J)=>{return $.trim().split(/\s+/).map((Q)=>h3(Q,J)).join(" ")},h3=($,J)=>{let Q=J.loose?V0[D0.TILDELOOSE]:V0[D0.TILDE];return $.replace(Q,(W,H,X,q,Y)=>{p("tilde",$,W,H,X,q,Y);let G;if(F0(H))G="";else if(F0(X))G=`>=${H}.0.0 <${+H+1}.0.0-0`;else if(F0(q))G=`>=${H}.${X}.0 <${H}.${+X+1}.0-0`;else if(Y)p("replaceTilde pr",Y),G=`>=${H}.${X}.${q}-${Y} <${H}.${+X+1}.0-0`;else G=`>=${H}.${X}.${q} <${H}.${+X+1}.0-0`;return p("tilde return",G),G})},g3=($,J)=>{return $.trim().split(/\s+/).map((Q)=>y3(Q,J)).join(" ")},y3=($,J)=>{p("caret",$,J);let Q=J.loose?V0[D0.CARETLOOSE]:V0[D0.CARET],W=J.includePrerelease?"-0":"";return $.replace(Q,(H,X,q,Y,G)=>{p("caret",$,H,X,q,Y,G);let B;if(F0(X))B="";else if(F0(q))B=`>=${X}.0.0${W} <${+X+1}.0.0-0`;else if(F0(Y))if(X==="0")B=`>=${X}.${q}.0${W} <${X}.${+q+1}.0-0`;else B=`>=${X}.${q}.0${W} <${+X+1}.0.0-0`;else if(G)if(p("replaceCaret pr",G),X==="0")if(q==="0")B=`>=${X}.${q}.${Y}-${G} <${X}.${q}.${+Y+1}-0`;else B=`>=${X}.${q}.${Y}-${G} <${X}.${+q+1}.0-0`;else B=`>=${X}.${q}.${Y}-${G} <${+X+1}.0.0-0`;else if(p("no pr"),X==="0")if(q==="0")B=`>=${X}.${q}.${Y}${W} <${X}.${q}.${+Y+1}-0`;else B=`>=${X}.${q}.${Y}${W} <${X}.${+q+1}.0-0`;else B=`>=${X}.${q}.${Y} <${+X+1}.0.0-0`;return p("caret return",B),B})},u3=($,J)=>{return p("replaceXRanges",$,J),$.split(/\s+/).map((Q)=>l3(Q,J)).join(" ")},l3=($,J)=>{$=$.trim();let Q=J.loose?V0[D0.XRANGELOOSE]:V0[D0.XRANGE];return $.replace(Q,(W,H,X,q,Y,G)=>{p("xRange",$,W,H,X,q,Y,G);let B=F0(X),w=B||F0(q),_=w||F0(Y),R=_;if(H==="="&&R)H="";if(G=J.includePrerelease?"-0":"",B)if(H===">"||H==="<")W="<0.0.0-0";else W="*";else if(H&&R){if(w)q=0;if(Y=0,H===">")if(H=">=",w)X=+X+1,q=0,Y=0;else q=+q+1,Y=0;else if(H==="<=")if(H="<",w)X=+X+1;else q=+q+1;if(H==="<")G="-0";W=`${H+X}.${q}.${Y}${G}`}else if(w)W=`>=${X}.0.0${G} <${+X+1}.0.0-0`;else if(_)W=`>=${X}.${q}.0${G} <${X}.${+q+1}.0-0`;return p("xRange return",W),W})},m3=($,J)=>{return p("replaceStars",$,J),$.trim().replace(V0[D0.STAR],"")},c3=($,J)=>{return p("replaceGTE0",$,J),$.trim().replace(V0[J.includePrerelease?D0.GTE0PRE:D0.GTE0],"")},n3=($)=>(J,Q,W,H,X,q,Y,G,B,w,_,R)=>{if(F0(W))Q="";else if(F0(H))Q=`>=${W}.0.0${$?"-0":""}`;else if(F0(X))Q=`>=${W}.${H}.0${$?"-0":""}`;else if(q)Q=`>=${Q}`;else Q=`>=${Q}${$?"-0":""}`;if(F0(B))G="";else if(F0(w))G=`<${+B+1}.0.0-0`;else if(F0(_))G=`<${B}.${+w+1}.0-0`;else if(R)G=`<=${B}.${w}.${_}-${R}`;else if($)G=`<${B}.${w}.${+_+1}-0`;else G=`<=${G}`;return`${Q} ${G}`.trim()},d3=($,J,Q)=>{for(let W=0;W<$.length;W++)if(!$[W].test(J))return!1;if(J.prerelease.length&&!Q.includePrerelease){for(let W=0;W<$.length;W++){if(p($[W].semver),$[W].semver===N8.ANY)continue;if($[W].semver.prerelease.length>0){let H=$[W].semver;if(H.major===J.major&&H.minor===J.minor&&H.patch===J.patch)return!0}}return!1}return!0}});var l$=A((oN,W7)=>{var m$=Symbol("SemVer ANY");class r6{static get ANY(){return m$}constructor($,J){if(J=aJ(J),$ instanceof r6)if($.loose===!!J.loose)return $;else $=$.value;if($=$.trim().split(/\s+/).join(" "),j8("comparator",$,J),this.options=J,this.loose=!!J.loose,this.parse($),this.semver===m$)this.value="";else this.value=this.operator+this.semver.version;j8("comp",this)}parse($){let J=this.options.loose?eJ[$7.COMPARATORLOOSE]:eJ[$7.COMPARATOR],Q=$.match(J);if(!Q)throw TypeError(`Invalid comparator: ${$}`);if(this.operator=Q[1]!==void 0?Q[1]:"",this.operator==="=")this.operator="";if(!Q[2])this.semver=m$;else this.semver=new J7(Q[2],this.options.loose)}toString(){return this.value}test($){if(j8("Comparator.test",$,this.options.loose),this.semver===m$||$===m$)return!0;if(typeof $==="string")try{$=new J7($,this.options)}catch(J){return!1}return L8($,this.operator,this.semver,this.options)}intersects($,J){if(!($ instanceof r6))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new Q7($.value,J).test(this.value)}else if($.operator===""){if($.value==="")return!0;return new Q7(this.value,J).test($.semver)}if(J=aJ(J),J.includePrerelease&&(this.value==="<0.0.0-0"||$.value==="<0.0.0-0"))return!1;if(!J.includePrerelease&&(this.value.startsWith("<0.0.0")||$.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&$.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&$.operator.startsWith("<"))return!0;if(this.semver.version===$.semver.version&&this.operator.includes("=")&&$.operator.includes("="))return!0;if(L8(this.semver,"<",$.semver,J)&&this.operator.startsWith(">")&&$.operator.startsWith("<"))return!0;if(L8(this.semver,">",$.semver,J)&&this.operator.startsWith("<")&&$.operator.startsWith(">"))return!0;return!1}}W7.exports=r6;var aJ=y6(),{safeRe:eJ,t:$7}=a1(),L8=z8(),j8=g$(),J7=w0(),Q7=A0()});var c$=A((rN,H7)=>{var i3=A0(),p3=($,J,Q)=>{try{J=new i3(J,Q)}catch(W){return!1}return J.test($)};H7.exports=p3});var q7=A((tN,X7)=>{var s3=A0(),o3=($,J)=>new s3($,J).set.map((Q)=>Q.map((W)=>W.value).join(" ").trim().split(" "));X7.exports=o3});var G7=A((aN,Y7)=>{var r3=w0(),t3=A0(),a3=($,J,Q)=>{let W=null,H=null,X=null;try{X=new t3(J,Q)}catch(q){return null}return $.forEach((q)=>{if(X.test(q)){if(!W||H.compare(q)===-1)W=q,H=new r3(W,Q)}}),W};Y7.exports=a3});var w7=A((eN,B7)=>{var e3=w0(),$Y=A0(),JY=($,J,Q)=>{let W=null,H=null,X=null;try{X=new $Y(J,Q)}catch(q){return null}return $.forEach((q)=>{if(X.test(q)){if(!W||H.compare(q)===1)W=q,H=new e3(W,Q)}}),W};B7.exports=JY});var _7=A(($L,U7)=>{var S8=w0(),QY=A0(),D7=y$(),WY=($,J)=>{$=new QY($,J);let Q=new S8("0.0.0");if($.test(Q))return Q;if(Q=new S8("0.0.0-0"),$.test(Q))return Q;Q=null;for(let W=0;W<$.set.length;++W){let H=$.set[W],X=null;if(H.forEach((q)=>{let Y=new S8(q.semver.version);switch(q.operator){case">":if(Y.prerelease.length===0)Y.patch++;else Y.prerelease.push(0);Y.raw=Y.format();case"":case">=":if(!X||D7(Y,X))X=Y;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${q.operator}`)}}),X&&(!Q||D7(Q,X)))Q=X}if(Q&&$.test(Q))return Q;return null};U7.exports=WY});var F7=A((JL,V7)=>{var HY=A0(),XY=($,J)=>{try{return new HY($,J).range||"*"}catch(Q){return null}};V7.exports=XY});var t6=A((QL,j7)=>{var qY=w0(),L7=l$(),{ANY:YY}=L7,GY=A0(),BY=c$(),z7=y$(),N7=d6(),wY=p6(),DY=i6(),UY=($,J,Q,W)=>{$=new qY($,W),J=new GY(J,W);let H,X,q,Y,G;switch(Q){case">":H=z7,X=wY,q=N7,Y=">",G=">=";break;case"<":H=N7,X=DY,q=z7,Y="<",G="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(BY($,J,W))return!1;for(let B=0;B<J.set.length;++B){let w=J.set[B],_=null,R=null;if(w.forEach((S)=>{if(S.semver===YY)S=new L7(">=0.0.0");if(_=_||S,R=R||S,H(S.semver,_.semver,W))_=S;else if(q(S.semver,R.semver,W))R=S}),_.operator===Y||_.operator===G)return!1;if((!R.operator||R.operator===Y)&&X($,R.semver))return!1;else if(R.operator===G&&q($,R.semver))return!1}return!0};j7.exports=UY});var A7=A((WL,S7)=>{var _Y=t6(),VY=($,J,Q)=>_Y($,J,">",Q);S7.exports=VY});var R7=A((HL,E7)=>{var FY=t6(),zY=($,J,Q)=>FY($,J,"<",Q);E7.exports=zY});var M7=A((XL,O7)=>{var C7=A0(),NY=($,J,Q)=>{return $=new C7($,Q),J=new C7(J,Q),$.intersects(J,Q)};O7.exports=NY});var P7=A((qL,b7)=>{var LY=c$(),jY=S0();b7.exports=($,J,Q)=>{let W=[],H=null,X=null,q=$.sort((w,_)=>jY(w,_,Q));for(let w of q)if(LY(w,J,Q)){if(X=w,!H)H=w}else{if(X)W.push([H,X]);X=null,H=null}if(H)W.push([H,null]);let Y=[];for(let[w,_]of W)if(w===_)Y.push(w);else if(!_&&w===q[0])Y.push("*");else if(!_)Y.push(`>=${w}`);else if(w===q[0])Y.push(`<=${_}`);else Y.push(`${w} - ${_}`);let G=Y.join(" || "),B=typeof J.raw==="string"?J.raw:String(J);return G.length<B.length?G:J}});var T7=A((YL,f7)=>{var Z7=A0(),E8=l$(),{ANY:A8}=E8,n$=c$(),R8=S0(),SY=($,J,Q={})=>{if($===J)return!0;$=new Z7($,Q),J=new Z7(J,Q);let W=!1;$:for(let H of $.set){for(let X of J.set){let q=EY(H,X,Q);if(W=W||q!==null,q)continue $}if(W)return!1}return!0},AY=[new E8(">=0.0.0-0")],I7=[new E8(">=0.0.0")],EY=($,J,Q)=>{if($===J)return!0;if($.length===1&&$[0].semver===A8)if(J.length===1&&J[0].semver===A8)return!0;else if(Q.includePrerelease)$=AY;else $=I7;if(J.length===1&&J[0].semver===A8)if(Q.includePrerelease)return!0;else J=I7;let W=new Set,H,X;for(let S of $)if(S.operator===">"||S.operator===">=")H=k7(H,S,Q);else if(S.operator==="<"||S.operator==="<=")X=K7(X,S,Q);else W.add(S.semver);if(W.size>1)return null;let q;if(H&&X){if(q=R8(H.semver,X.semver,Q),q>0)return null;else if(q===0&&(H.operator!==">="||X.operator!=="<="))return null}for(let S of W){if(H&&!n$(S,String(H),Q))return null;if(X&&!n$(S,String(X),Q))return null;for(let P of J)if(!n$(S,String(P),Q))return!1;return!0}let Y,G,B,w,_=X&&!Q.includePrerelease&&X.semver.prerelease.length?X.semver:!1,R=H&&!Q.includePrerelease&&H.semver.prerelease.length?H.semver:!1;if(_&&_.prerelease.length===1&&X.operator==="<"&&_.prerelease[0]===0)_=!1;for(let S of J){if(w=w||S.operator===">"||S.operator===">=",B=B||S.operator==="<"||S.operator==="<=",H){if(R){if(S.semver.prerelease&&S.semver.prerelease.length&&S.semver.major===R.major&&S.semver.minor===R.minor&&S.semver.patch===R.patch)R=!1}if(S.operator===">"||S.operator===">="){if(Y=k7(H,S,Q),Y===S&&Y!==H)return!1}else if(H.operator===">="&&!n$(H.semver,String(S),Q))return!1}if(X){if(_){if(S.semver.prerelease&&S.semver.prerelease.length&&S.semver.major===_.major&&S.semver.minor===_.minor&&S.semver.patch===_.patch)_=!1}if(S.operator==="<"||S.operator==="<="){if(G=K7(X,S,Q),G===S&&G!==X)return!1}else if(X.operator==="<="&&!n$(X.semver,String(S),Q))return!1}if(!S.operator&&(X||H)&&q!==0)return!1}if(H&&B&&!X&&q!==0)return!1;if(X&&w&&!H&&q!==0)return!1;if(R||_)return!1;return!0},k7=($,J,Q)=>{if(!$)return J;let W=R8($.semver,J.semver,Q);return W>0?$:W<0?J:J.operator===">"&&$.operator===">="?J:$},K7=($,J,Q)=>{if(!$)return J;let W=R8($.semver,J.semver,Q);return W<0?$:W>0?J:J.operator==="<"&&$.operator==="<="?J:$};f7.exports=SY});var a6=A((GL,h7)=>{var C8=a1(),x7=h$(),RY=w0(),v7=U8(),CY=j1(),OY=YJ(),MY=BJ(),bY=UJ(),PY=FJ(),ZY=NJ(),IY=jJ(),kY=AJ(),KY=RJ(),fY=S0(),TY=bJ(),xY=ZJ(),vY=n6(),hY=fJ(),gY=xJ(),yY=y$(),uY=d6(),lY=V8(),mY=F8(),cY=i6(),nY=p6(),dY=z8(),iY=nJ(),pY=l$(),sY=A0(),oY=c$(),rY=q7(),tY=G7(),aY=w7(),eY=_7(),$G=F7(),JG=t6(),QG=A7(),WG=R7(),HG=M7(),XG=P7(),qG=T7();h7.exports={parse:CY,valid:OY,clean:MY,inc:bY,diff:PY,major:ZY,minor:IY,patch:kY,prerelease:KY,compare:fY,rcompare:TY,compareLoose:xY,compareBuild:vY,sort:hY,rsort:gY,gt:yY,lt:uY,eq:lY,neq:mY,gte:cY,lte:nY,cmp:dY,coerce:iY,Comparator:pY,Range:sY,satisfies:oY,toComparators:rY,maxSatisfying:tY,minSatisfying:aY,minVersion:eY,validRange:$G,outside:JG,gtr:QG,ltr:WG,intersects:HG,simplifyRange:XG,subset:qG,SemVer:RY,re:C8.re,src:C8.src,tokens:C8.t,SEMVER_SPEC_VERSION:x7.SEMVER_SPEC_VERSION,RELEASE_TYPES:x7.RELEASE_TYPES,compareIdentifiers:v7.compareIdentifiers,rcompareIdentifiers:v7.rcompareIdentifiers}});var y7=A((BL,g7)=>{var YG=a6();g7.exports=YG.satisfies(process.version,">=15.7.0")});var l7=A((wL,u7)=>{var GG=a6();u7.exports=GG.satisfies(process.version,">=16.9.0")});var O8=A((DL,m7)=>{var BG=y7(),wG=l7(),DG={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},UG={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};m7.exports=function($,J){if(!$||!J)return;let Q=J.asymmetricKeyType;if(!Q)return;let W=DG[Q];if(!W)throw Error(`Unknown key type "${Q}".`);if(!W.includes($))throw Error(`"alg" parameter for "${Q}" key type must be one of: ${W.join(", ")}.`);if(BG)switch(Q){case"ec":let H=J.asymmetricKeyDetails.namedCurve,X=UG[$];if(H!==X)throw Error(`"alg" parameter "${$}" requires curve "${X}".`);break;case"rsa-pss":if(wG){let q=parseInt($.slice(-3),10),{hashAlgorithm:Y,mgf1HashAlgorithm:G,saltLength:B}=J.asymmetricKeyDetails;if(Y!==`sha${q}`||G!==Y)throw Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${$}.`);if(B!==void 0&&B>q>>3)throw Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${$}.`)}break}}});var M8=A((UL,c7)=>{var _G=a6();c7.exports=_G.satisfies(process.version,"^6.12.0 || >=8.0.0")});var i7=A((_L,d7)=>{var d=v$(),VG=Y8(),n7=G8(),FG=q8(),zG=B8(),NG=O8(),LG=M8(),jG=T6(),{KeyObject:SG,createSecretKey:AG,createPublicKey:EG}=require("crypto"),b8=["RS256","RS384","RS512"],RG=["ES256","ES384","ES512"],P8=["RS256","RS384","RS512"],CG=["HS256","HS384","HS512"];if(LG)b8.splice(b8.length,0,"PS256","PS384","PS512"),P8.splice(P8.length,0,"PS256","PS384","PS512");d7.exports=function($,J,Q,W){if(typeof Q==="function"&&!W)W=Q,Q={};if(!Q)Q={};Q=Object.assign({},Q);let H;if(W)H=W;else H=function(w,_){if(w)throw w;return _};if(Q.clockTimestamp&&typeof Q.clockTimestamp!=="number")return H(new d("clockTimestamp must be a number"));if(Q.nonce!==void 0&&(typeof Q.nonce!=="string"||Q.nonce.trim()===""))return H(new d("nonce must be a non-empty string"));if(Q.allowInvalidAsymmetricKeyTypes!==void 0&&typeof Q.allowInvalidAsymmetricKeyTypes!=="boolean")return H(new d("allowInvalidAsymmetricKeyTypes must be a boolean"));let X=Q.clockTimestamp||Math.floor(Date.now()/1000);if(!$)return H(new d("jwt must be provided"));if(typeof $!=="string")return H(new d("jwt must be a string"));let q=$.split(".");if(q.length!==3)return H(new d("jwt malformed"));let Y;try{Y=FG($,{complete:!0})}catch(w){return H(w)}if(!Y)return H(new d("invalid token"));let G=Y.header,B;if(typeof J==="function"){if(!W)return H(new d("verify must be called asynchronous if secret or public key is provided as a callback"));B=J}else B=function(w,_){return _(null,J)};return B(G,function(w,_){if(w)return H(new d("error in secret or public key callback: "+w.message));let R=q[2].trim()!=="";if(!R&&_)return H(new d("jwt signature is required"));if(R&&!_)return H(new d("secret or public key must be provided"));if(!R&&!Q.algorithms)return H(new d('please specify "none" in "algorithms" to verify unsigned tokens'));if(_!=null&&!(_ instanceof SG))try{_=EG(_)}catch(h){try{_=AG(typeof _==="string"?Buffer.from(_):_)}catch(o){return H(new d("secretOrPublicKey is not valid key material"))}}if(!Q.algorithms)if(_.type==="secret")Q.algorithms=CG;else if(["rsa","rsa-pss"].includes(_.asymmetricKeyType))Q.algorithms=P8;else if(_.asymmetricKeyType==="ec")Q.algorithms=RG;else Q.algorithms=b8;if(Q.algorithms.indexOf(Y.header.alg)===-1)return H(new d("invalid algorithm"));if(G.alg.startsWith("HS")&&_.type!=="secret")return H(new d(`secretOrPublicKey must be a symmetric key when using ${G.alg}`));else if(/^(?:RS|PS|ES)/.test(G.alg)&&_.type!=="public")return H(new d(`secretOrPublicKey must be an asymmetric key when using ${G.alg}`));if(!Q.allowInvalidAsymmetricKeyTypes)try{NG(G.alg,_)}catch(h){return H(h)}let S;try{S=jG.verify($,Y.header.alg,_)}catch(h){return H(h)}if(!S)return H(new d("invalid signature"));let P=Y.payload;if(typeof P.nbf<"u"&&!Q.ignoreNotBefore){if(typeof P.nbf!=="number")return H(new d("invalid nbf value"));if(P.nbf>X+(Q.clockTolerance||0))return H(new VG("jwt not active",new Date(P.nbf*1000)))}if(typeof P.exp<"u"&&!Q.ignoreExpiration){if(typeof P.exp!=="number")return H(new d("invalid exp value"));if(X>=P.exp+(Q.clockTolerance||0))return H(new n7("jwt expired",new Date(P.exp*1000)))}if(Q.audience){let h=Array.isArray(Q.audience)?Q.audience:[Q.audience];if(!(Array.isArray(P.aud)?P.aud:[P.aud]).some(function(z0){return h.some(function(t){return t instanceof RegExp?t.test(z0):t===z0})}))return H(new d("jwt audience invalid. expected: "+h.join(" or ")))}if(Q.issuer){if(typeof Q.issuer==="string"&&P.iss!==Q.issuer||Array.isArray(Q.issuer)&&Q.issuer.indexOf(P.iss)===-1)return H(new d("jwt issuer invalid. expected: "+Q.issuer))}if(Q.subject){if(P.sub!==Q.subject)return H(new d("jwt subject invalid. expected: "+Q.subject))}if(Q.jwtid){if(P.jti!==Q.jwtid)return H(new d("jwt jwtid invalid. expected: "+Q.jwtid))}if(Q.nonce){if(P.nonce!==Q.nonce)return H(new d("jwt nonce invalid. expected: "+Q.nonce))}if(Q.maxAge){if(typeof P.iat!=="number")return H(new d("iat required when maxAge is specified"));let h=zG(Q.maxAge,P.iat);if(typeof h>"u")return H(new d('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(X>=h+(Q.clockTolerance||0))return H(new n7("maxAge exceeded",new Date(h*1000)))}if(Q.complete===!0){let h=Y.signature;return H(null,{header:G,payload:P,signature:h})}return H(null,P)})}});var a7=A((VL,t7)=>{var p7=1/0,o7=9007199254740991,OG=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,s7=NaN,MG="[object Arguments]",bG="[object Function]",PG="[object GeneratorFunction]",ZG="[object String]",IG="[object Symbol]",kG=/^\s+|\s+$/g,KG=/^[-+]0x[0-9a-f]+$/i,fG=/^0b[01]+$/i,TG=/^0o[0-7]+$/i,xG=/^(?:0|[1-9]\d*)$/,vG=parseInt;function hG($,J){var Q=-1,W=$?$.length:0,H=Array(W);while(++Q<W)H[Q]=J($[Q],Q,$);return H}function gG($,J,Q,W){var H=$.length,X=Q+(W?1:-1);while(W?X--:++X<H)if(J($[X],X,$))return X;return-1}function yG($,J,Q){if(J!==J)return gG($,uG,Q);var W=Q-1,H=$.length;while(++W<H)if($[W]===J)return W;return-1}function uG($){return $!==$}function lG($,J){var Q=-1,W=Array($);while(++Q<$)W[Q]=J(Q);return W}function mG($,J){return hG(J,function(Q){return $[Q]})}function cG($,J){return function(Q){return $(J(Q))}}var e6=Object.prototype,I8=e6.hasOwnProperty,$4=e6.toString,nG=e6.propertyIsEnumerable,dG=cG(Object.keys,Object),iG=Math.max;function pG($,J){var Q=r7($)||aG($)?lG($.length,String):[],W=Q.length,H=!!W;for(var X in $)if((J||I8.call($,X))&&!(H&&(X=="length"||oG(X,W))))Q.push(X);return Q}function sG($){if(!rG($))return dG($);var J=[];for(var Q in Object($))if(I8.call($,Q)&&Q!="constructor")J.push(Q);return J}function oG($,J){return J=J==null?o7:J,!!J&&(typeof $=="number"||xG.test($))&&($>-1&&$%1==0&&$<J)}function rG($){var J=$&&$.constructor,Q=typeof J=="function"&&J.prototype||e6;return $===Q}function tG($,J,Q,W){$=k8($)?$:GB($),Q=Q&&!W?XB(Q):0;var H=$.length;if(Q<0)Q=iG(H+Q,0);return QB($)?Q<=H&&$.indexOf(J,Q)>-1:!!H&&yG($,J,Q)>-1}function aG($){return eG($)&&I8.call($,"callee")&&(!nG.call($,"callee")||$4.call($)==MG)}var r7=Array.isArray;function k8($){return $!=null&&JB($.length)&&!$B($)}function eG($){return K8($)&&k8($)}function $B($){var J=Z8($)?$4.call($):"";return J==bG||J==PG}function JB($){return typeof $=="number"&&$>-1&&$%1==0&&$<=o7}function Z8($){var J=typeof $;return!!$&&(J=="object"||J=="function")}function K8($){return!!$&&typeof $=="object"}function QB($){return typeof $=="string"||!r7($)&&K8($)&&$4.call($)==ZG}function WB($){return typeof $=="symbol"||K8($)&&$4.call($)==IG}function HB($){if(!$)return $===0?$:0;if($=qB($),$===p7||$===-p7){var J=$<0?-1:1;return J*OG}return $===$?$:0}function XB($){var J=HB($),Q=J%1;return J===J?Q?J-Q:J:0}function qB($){if(typeof $=="number")return $;if(WB($))return s7;if(Z8($)){var J=typeof $.valueOf=="function"?$.valueOf():$;$=Z8(J)?J+"":J}if(typeof $!="string")return $===0?$:+$;$=$.replace(kG,"");var Q=fG.test($);return Q||TG.test($)?vG($.slice(2),Q?2:8):KG.test($)?s7:+$}function YB($){return k8($)?pG($):sG($)}function GB($){return $?mG($,YB($)):[]}t7.exports=tG});var $Q=A((FL,e7)=>{var BB="[object Boolean]",wB=Object.prototype,DB=wB.toString;function UB($){return $===!0||$===!1||_B($)&&DB.call($)==BB}function _B($){return!!$&&typeof $=="object"}e7.exports=UB});var XQ=A((zL,HQ)=>{var JQ=1/0,VB=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,QQ=NaN,FB="[object Symbol]",zB=/^\s+|\s+$/g,NB=/^[-+]0x[0-9a-f]+$/i,LB=/^0b[01]+$/i,jB=/^0o[0-7]+$/i,SB=parseInt,AB=Object.prototype,EB=AB.toString;function RB($){return typeof $=="number"&&$==bB($)}function WQ($){var J=typeof $;return!!$&&(J=="object"||J=="function")}function CB($){return!!$&&typeof $=="object"}function OB($){return typeof $=="symbol"||CB($)&&EB.call($)==FB}function MB($){if(!$)return $===0?$:0;if($=PB($),$===JQ||$===-JQ){var J=$<0?-1:1;return J*VB}return $===$?$:0}function bB($){var J=MB($),Q=J%1;return J===J?Q?J-Q:J:0}function PB($){if(typeof $=="number")return $;if(OB($))return QQ;if(WQ($)){var J=typeof $.valueOf=="function"?$.valueOf():$;$=WQ(J)?J+"":J}if(typeof $!="string")return $===0?$:+$;$=$.replace(zB,"");var Q=LB.test($);return Q||jB.test($)?SB($.slice(2),Q?2:8):NB.test($)?QQ:+$}HQ.exports=RB});var YQ=A((NL,qQ)=>{var ZB="[object Number]",IB=Object.prototype,kB=IB.toString;function KB($){return!!$&&typeof $=="object"}function fB($){return typeof $=="number"||KB($)&&kB.call($)==ZB}qQ.exports=fB});var DQ=A((LL,wQ)=>{var TB="[object Object]";function xB($){var J=!1;if($!=null&&typeof $.toString!="function")try{J=!!($+"")}catch(Q){}return J}function vB($,J){return function(Q){return $(J(Q))}}var hB=Function.prototype,GQ=Object.prototype,BQ=hB.toString,gB=GQ.hasOwnProperty,yB=BQ.call(Object),uB=GQ.toString,lB=vB(Object.getPrototypeOf,Object);function mB($){return!!$&&typeof $=="object"}function cB($){if(!mB($)||uB.call($)!=TB||xB($))return!1;var J=lB($);if(J===null)return!0;var Q=gB.call(J,"constructor")&&J.constructor;return typeof Q=="function"&&Q instanceof Q&&BQ.call(Q)==yB}wQ.exports=cB});var _Q=A((jL,UQ)=>{var nB="[object String]",dB=Object.prototype,iB=dB.toString,pB=Array.isArray;function sB($){return!!$&&typeof $=="object"}function oB($){return typeof $=="string"||!pB($)&&sB($)&&iB.call($)==nB}UQ.exports=oB});var LQ=A((SL,NQ)=>{var rB="Expected a function",VQ=1/0,tB=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,FQ=NaN,aB="[object Symbol]",eB=/^\s+|\s+$/g,$w=/^[-+]0x[0-9a-f]+$/i,Jw=/^0b[01]+$/i,Qw=/^0o[0-7]+$/i,Ww=parseInt,Hw=Object.prototype,Xw=Hw.toString;function qw($,J){var Q;if(typeof J!="function")throw TypeError(rB);return $=Dw($),function(){if(--$>0)Q=J.apply(this,arguments);if($<=1)J=void 0;return Q}}function Yw($){return qw(2,$)}function zQ($){var J=typeof $;return!!$&&(J=="object"||J=="function")}function Gw($){return!!$&&typeof $=="object"}function Bw($){return typeof $=="symbol"||Gw($)&&Xw.call($)==aB}function ww($){if(!$)return $===0?$:0;if($=Uw($),$===VQ||$===-VQ){var J=$<0?-1:1;return J*tB}return $===$?$:0}function Dw($){var J=ww($),Q=J%1;return J===J?Q?J-Q:J:0}function Uw($){if(typeof $=="number")return $;if(Bw($))return FQ;if(zQ($)){var J=typeof $.valueOf=="function"?$.valueOf():$;$=zQ(J)?J+"":J}if(typeof $!="string")return $===0?$:+$;$=$.replace(eB,"");var Q=Jw.test($);return Q||Qw.test($)?Ww($.slice(2),Q?2:8):$w.test($)?FQ:+$}NQ.exports=Yw});var bQ=A((AL,MQ)=>{var jQ=B8(),_w=M8(),Vw=O8(),SQ=T6(),Fw=a7(),J4=$Q(),AQ=XQ(),f8=YQ(),RQ=DQ(),J1=_Q(),zw=LQ(),{KeyObject:Nw,createSecretKey:Lw,createPrivateKey:jw}=require("crypto"),CQ=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];if(_w)CQ.splice(3,0,"PS256","PS384","PS512");var Sw={expiresIn:{isValid:function($){return AQ($)||J1($)&&$},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function($){return AQ($)||J1($)&&$},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function($){return J1($)||Array.isArray($)},message:'"audience" must be a string or array'},algorithm:{isValid:Fw.bind(null,CQ),message:'"algorithm" must be a valid string enum value'},header:{isValid:RQ,message:'"header" must be an object'},encoding:{isValid:J1,message:'"encoding" must be a string'},issuer:{isValid:J1,message:'"issuer" must be a string'},subject:{isValid:J1,message:'"subject" must be a string'},jwtid:{isValid:J1,message:'"jwtid" must be a string'},noTimestamp:{isValid:J4,message:'"noTimestamp" must be a boolean'},keyid:{isValid:J1,message:'"keyid" must be a string'},mutatePayload:{isValid:J4,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:J4,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:J4,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},Aw={iat:{isValid:f8,message:'"iat" should be a number of seconds'},exp:{isValid:f8,message:'"exp" should be a number of seconds'},nbf:{isValid:f8,message:'"nbf" should be a number of seconds'}};function OQ($,J,Q,W){if(!RQ(Q))throw Error('Expected "'+W+'" to be a plain object.');Object.keys(Q).forEach(function(H){let X=$[H];if(!X){if(!J)throw Error('"'+H+'" is not allowed in "'+W+'"');return}if(!X.isValid(Q[H]))throw Error(X.message)})}function Ew($){return OQ(Sw,!1,$,"options")}function Rw($){return OQ(Aw,!0,$,"payload")}var EQ={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},Cw=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];MQ.exports=function($,J,Q,W){if(typeof Q==="function")W=Q,Q={};else Q=Q||{};let H=typeof $==="object"&&!Buffer.isBuffer($),X=Object.assign({alg:Q.algorithm||"HS256",typ:H?"JWT":void 0,kid:Q.keyid},Q.header);function q(B){if(W)return W(B);throw B}if(!J&&Q.algorithm!=="none")return q(Error("secretOrPrivateKey must have a value"));if(J!=null&&!(J instanceof Nw))try{J=jw(J)}catch(B){try{J=Lw(typeof J==="string"?Buffer.from(J):J)}catch(w){return q(Error("secretOrPrivateKey is not valid key material"))}}if(X.alg.startsWith("HS")&&J.type!=="secret")return q(Error(`secretOrPrivateKey must be a symmetric key when using ${X.alg}`));else if(/^(?:RS|PS|ES)/.test(X.alg)){if(J.type!=="private")return q(Error(`secretOrPrivateKey must be an asymmetric key when using ${X.alg}`));if(!Q.allowInsecureKeySizes&&!X.alg.startsWith("ES")&&J.asymmetricKeyDetails!==void 0&&J.asymmetricKeyDetails.modulusLength<2048)return q(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${X.alg}`))}if(typeof $>"u")return q(Error("payload is required"));else if(H){try{Rw($)}catch(B){return q(B)}if(!Q.mutatePayload)$=Object.assign({},$)}else{let B=Cw.filter(function(w){return typeof Q[w]<"u"});if(B.length>0)return q(Error("invalid "+B.join(",")+" option for "+typeof $+" payload"))}if(typeof $.exp<"u"&&typeof Q.expiresIn<"u")return q(Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(typeof $.nbf<"u"&&typeof Q.notBefore<"u")return q(Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{Ew(Q)}catch(B){return q(B)}if(!Q.allowInvalidAsymmetricKeyTypes)try{Vw(X.alg,J)}catch(B){return q(B)}let Y=$.iat||Math.floor(Date.now()/1000);if(Q.noTimestamp)delete $.iat;else if(H)$.iat=Y;if(typeof Q.notBefore<"u"){try{$.nbf=jQ(Q.notBefore,Y)}catch(B){return q(B)}if(typeof $.nbf>"u")return q(Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(typeof Q.expiresIn<"u"&&typeof $==="object"){try{$.exp=jQ(Q.expiresIn,Y)}catch(B){return q(B)}if(typeof $.exp>"u")return q(Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(EQ).forEach(function(B){let w=EQ[B];if(typeof Q[B]<"u"){if(typeof $[w]<"u")return q(Error('Bad "options.'+B+'" option. The payload already has an "'+w+'" property.'));$[w]=Q[B]}});let G=Q.encoding||"utf8";if(typeof W==="function")W=W&&zw(W),SQ.createSign({header:X,privateKey:J,payload:$,encoding:G}).once("error",W).once("done",function(B){if(!Q.allowInsecureKeySizes&&/^(?:RS|PS)/.test(X.alg)&&B.length<256)return W(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${X.alg}`));W(null,B)});else{let B=SQ.sign({header:X,payload:$,secret:J,encoding:G});if(!Q.allowInsecureKeySizes&&/^(?:RS|PS)/.test(X.alg)&&B.length<256)throw Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${X.alg}`);return B}}});var ZQ=A((EL,PQ)=>{PQ.exports={decode:q8(),verify:i7(),sign:bQ(),JsonWebTokenError:v$(),NotBeforeError:Y8(),TokenExpiredError:G8()}});var EW={};L0(EW,{createRateLimitMiddleware:()=>q$,createCorsMiddleware:()=>X$,createCompressionMiddleware:()=>Y$});module.exports=M0(EW);function X$($){let{origin:J="*",methods:Q=["GET","POST","PUT","DELETE","PATCH","OPTIONS"],allowedHeaders:W=["Content-Type","Authorization"],exposedHeaders:H=[],credentials:X=!1,maxAge:q=86400}=$||{};return async(Y,G)=>{let B=Y.req.header("origin"),w=Y.req.method,_=null;if(typeof J==="string")_=J;else if(Array.isArray(J)){if(B&&J.includes(B))_=B}else if(typeof J==="function"){if(B&&J(B))_=B}if(_)Y.header("Access-Control-Allow-Origin",_);if(X)Y.header("Access-Control-Allow-Credentials","true");if(H.length>0)Y.header("Access-Control-Expose-Headers",H.join(", "));if(w==="OPTIONS")return Y.header("Access-Control-Allow-Methods",Q.join(", ")),Y.header("Access-Control-Allow-Headers",W.join(", ")),Y.header("Access-Control-Max-Age",q.toString()),Y.body(null,204);await G()}}function q$($){let{windowMs:J=60000,max:Q=100,keyGenerator:W=(q)=>{return q.req.header("x-forwarded-for")||q.req.header("x-real-ip")||"unknown"}}=$,H=new Map,X=setInterval(()=>{let q=Date.now();for(let[Y,G]of H.entries())if(q>G.resetTime)H.delete(Y)},J);if(typeof process<"u"&&process.on)process.on("exit",()=>clearInterval(X));return async(q,Y)=>{let G=W(q),B=Date.now(),w=H.get(G);if(!w||B>w.resetTime)H.set(G,{count:1,resetTime:B+J}),q.header("X-RateLimit-Limit",Q.toString()),q.header("X-RateLimit-Remaining",(Q-1).toString()),q.header("X-RateLimit-Reset",new Date(B+J).toISOString()),await Y();else if(w.count<Q)w.count++,q.header("X-RateLimit-Limit",Q.toString()),q.header("X-RateLimit-Remaining",(Q-w.count).toString()),q.header("X-RateLimit-Reset",new Date(w.resetTime).toISOString()),await Y();else{let _=Math.ceil((w.resetTime-B)/1000);return q.header("X-RateLimit-Limit",Q.toString()),q.header("X-RateLimit-Remaining","0"),q.header("X-RateLimit-Reset",new Date(w.resetTime).toISOString()),q.header("Retry-After",_.toString()),q.json({error:"Too Many Requests",message:`Rate limit exceeded. Please try again in ${_} seconds.`,retryAfter:_},429)}}}function Y$($){let{threshold:J=1024,level:Q=6}=$||{};return async(W,H)=>{await H();let X=W.res;if(!X)return;let q=X.headers.get("content-type")||"",Y=X.headers.get("content-length"),G=W.req.header("accept-encoding")||"";if(!["text/","application/json","application/javascript","application/xml","application/x-www-form-urlencoded"].some((P)=>q.toLowerCase().includes(P)))return;if(Y&&parseInt(Y)<J)return;if(X.headers.get("content-encoding"))return;let _=await X.arrayBuffer();if(_.byteLength<J)return;let R=null,S=null;if(G.includes("br")&&typeof CompressionStream<"u")try{let P=new CompressionStream("deflate"),h=P.writable.getWriter();h.write(new Uint8Array(_)),h.close();let o=P.readable.getReader(),W0=[];while(!0){let{done:H0,value:U0}=await o.read();if(H0)break;W0.push(U0)}let z0=W0.reduce((H0,U0)=>H0+U0.length,0),t=new Uint8Array(z0),R0=0;for(let H0 of W0)t.set(H0,R0),R0+=H0.length;R=t,S="deflate"}catch(P){R=null}if(!R&&G.includes("gzip")&&typeof CompressionStream<"u")try{let P=new CompressionStream("gzip"),h=P.writable.getWriter();h.write(new Uint8Array(_)),h.close();let o=P.readable.getReader(),W0=[];while(!0){let{done:H0,value:U0}=await o.read();if(H0)break;W0.push(U0)}let z0=W0.reduce((H0,U0)=>H0+U0.length,0),t=new Uint8Array(z0),R0=0;for(let H0 of W0)t.set(H0,R0),R0+=H0.length;R=t,S="gzip"}catch(P){R=null}if(R&&S&&R.byteLength<_.byteLength){let P=new Headers(X.headers);return P.set("content-encoding",S),P.set("content-length",R.byteLength.toString()),P.delete("content-length"),new Response(R,{status:X.status,statusText:X.statusText,headers:P})}}}var lH={};L0(lH,{zodToJsonSchema:()=>Q6,ZodToJsonSchemaConverter:()=>p0,OpenAPIGenerator:()=>B1});module.exports=M0(lH);var w2=Symbol("Let zodToJsonSchema decide on which parser to use");var B2={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},D2=($)=>typeof $==="string"?{...B2,name:$}:{...B2,...$};var U2=($)=>{let J=D2($),Q=J.name!==void 0?[...J.basePath,J.definitionPath,J.name]:J.basePath;return{...J,flags:{hasReferencedOpenAiAnyType:!1},currentPath:Q,propertyPath:void 0,seen:new Map(Object.entries(J.definitions).map(([W,H])=>[H._def,{def:H._def,path:[...J.basePath,J.definitionPath,W],jsonSchema:void 0}]))}};function B4($,J,Q,W){if(!W?.errorMessages)return;if(Q)$.errorMessage={...$.errorMessage,[J]:Q}}function n($,J,Q,W,H){$[J]=Q,B4($,J,W,H)}var p$=($,J)=>{let Q=0;for(;Q<$.length&&Q<J.length;Q++)if($[Q]!==J[Q])break;return[($.length-Q).toString(),...J.slice(Q)].join("/")};var z={};L0(z,{void:()=>qH,util:()=>m,unknown:()=>HH,union:()=>wH,undefined:()=>JH,tuple:()=>_H,transformer:()=>RH,symbol:()=>$H,string:()=>A2,strictObject:()=>BH,setErrorMap:()=>OW,set:()=>zH,record:()=>VH,quotelessJson:()=>RW,promise:()=>EH,preprocess:()=>MH,pipeline:()=>bH,ostring:()=>PH,optional:()=>CH,onumber:()=>ZH,oboolean:()=>IH,objectUtil:()=>w4,object:()=>GH,number:()=>E2,nullable:()=>OH,null:()=>QH,never:()=>XH,nativeEnum:()=>AH,nan:()=>tW,map:()=>FH,makeIssue:()=>G$,literal:()=>jH,lazy:()=>LH,late:()=>oW,isValid:()=>s0,isDirty:()=>o$,isAsync:()=>R1,isAborted:()=>s$,intersection:()=>UH,instanceof:()=>rW,getParsedType:()=>y0,getErrorMap:()=>E1,function:()=>NH,enum:()=>SH,effect:()=>RH,discriminatedUnion:()=>DH,defaultErrorMap:()=>n0,datetimeRegex:()=>L2,date:()=>eW,custom:()=>S2,coerce:()=>kH,boolean:()=>R2,bigint:()=>aW,array:()=>YH,any:()=>WH,addIssueToContext:()=>E,ZodVoid:()=>w$,ZodUnknown:()=>o0,ZodUnion:()=>Z1,ZodUndefined:()=>b1,ZodType:()=>u,ZodTuple:()=>l0,ZodTransformer:()=>k0,ZodSymbol:()=>B$,ZodString:()=>b0,ZodSet:()=>Y1,ZodSchema:()=>u,ZodRecord:()=>D$,ZodReadonly:()=>v1,ZodPromise:()=>G1,ZodPipeline:()=>V$,ZodParsedType:()=>L,ZodOptional:()=>Z0,ZodObject:()=>r,ZodNumber:()=>r0,ZodNullable:()=>i0,ZodNull:()=>P1,ZodNever:()=>u0,ZodNativeEnum:()=>f1,ZodNaN:()=>_$,ZodMap:()=>U$,ZodLiteral:()=>K1,ZodLazy:()=>k1,ZodIssueCode:()=>F,ZodIntersection:()=>I1,ZodFunction:()=>O1,ZodFirstPartyTypeKind:()=>N,ZodError:()=>X0,ZodEnum:()=>a0,ZodEffects:()=>k0,ZodDiscriminatedUnion:()=>r$,ZodDefault:()=>T1,ZodDate:()=>X1,ZodCatch:()=>x1,ZodBranded:()=>t$,ZodBoolean:()=>M1,ZodBigInt:()=>t0,ZodArray:()=>P0,ZodAny:()=>q1,Schema:()=>u,ParseStatus:()=>q0,OK:()=>G0,NEVER:()=>KH,INVALID:()=>f,EMPTY_PATH:()=>MW,DIRTY:()=>H1,BRAND:()=>sW});var m;(function($){$.assertEqual=(H)=>{};function J(H){}$.assertIs=J;function Q(H){throw Error()}$.assertNever=Q,$.arrayToEnum=(H)=>{let X={};for(let q of H)X[q]=q;return X},$.getValidEnumValues=(H)=>{let X=$.objectKeys(H).filter((Y)=>typeof H[H[Y]]!=="number"),q={};for(let Y of X)q[Y]=H[Y];return $.objectValues(q)},$.objectValues=(H)=>{return $.objectKeys(H).map(function(X){return H[X]})},$.objectKeys=typeof Object.keys==="function"?(H)=>Object.keys(H):(H)=>{let X=[];for(let q in H)if(Object.prototype.hasOwnProperty.call(H,q))X.push(q);return X},$.find=(H,X)=>{for(let q of H)if(X(q))return q;return},$.isInteger=typeof Number.isInteger==="function"?(H)=>Number.isInteger(H):(H)=>typeof H==="number"&&Number.isFinite(H)&&Math.floor(H)===H;function W(H,X=" | "){return H.map((q)=>typeof q==="string"?`'${q}'`:q).join(X)}$.joinValues=W,$.jsonStringifyReplacer=(H,X)=>{if(typeof X==="bigint")return X.toString();return X}})(m||(m={}));var w4;(function($){$.mergeShapes=(J,Q)=>{return{...J,...Q}}})(w4||(w4={}));var L=m.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),y0=($)=>{switch(typeof $){case"undefined":return L.undefined;case"string":return L.string;case"number":return Number.isNaN($)?L.nan:L.number;case"boolean":return L.boolean;case"function":return L.function;case"bigint":return L.bigint;case"symbol":return L.symbol;case"object":if(Array.isArray($))return L.array;if($===null)return L.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return L.promise;if(typeof Map<"u"&&$ instanceof Map)return L.map;if(typeof Set<"u"&&$ instanceof Set)return L.set;if(typeof Date<"u"&&$ instanceof Date)return L.date;return L.object;default:return L.unknown}};var F=m.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),RW=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")};class X0 extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(Q)=>{this.issues=[...this.issues,Q]},this.addIssues=(Q=[])=>{this.issues=[...this.issues,...Q]};let J=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,J);else this.__proto__=J;this.name="ZodError",this.issues=$}format($){let J=$||function(H){return H.message},Q={_errors:[]},W=(H)=>{for(let X of H.issues)if(X.code==="invalid_union")X.unionErrors.map(W);else if(X.code==="invalid_return_type")W(X.returnTypeError);else if(X.code==="invalid_arguments")W(X.argumentsError);else if(X.path.length===0)Q._errors.push(J(X));else{let q=Q,Y=0;while(Y<X.path.length){let G=X.path[Y];if(Y!==X.path.length-1)q[G]=q[G]||{_errors:[]};else q[G]=q[G]||{_errors:[]},q[G]._errors.push(J(X));q=q[G],Y++}}};return W(this),Q}static assert($){if(!($ instanceof X0))throw Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,m.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(J)=>J.message){let J={},Q=[];for(let W of this.issues)if(W.path.length>0){let H=W.path[0];J[H]=J[H]||[],J[H].push($(W))}else Q.push($(W));return{formErrors:Q,fieldErrors:J}}get formErrors(){return this.flatten()}}X0.create=($)=>{return new X0($)};var CW=($,J)=>{let Q;switch($.code){case F.invalid_type:if($.received===L.undefined)Q="Required";else Q=`Expected ${$.expected}, received ${$.received}`;break;case F.invalid_literal:Q=`Invalid literal value, expected ${JSON.stringify($.expected,m.jsonStringifyReplacer)}`;break;case F.unrecognized_keys:Q=`Unrecognized key(s) in object: ${m.joinValues($.keys,", ")}`;break;case F.invalid_union:Q="Invalid input";break;case F.invalid_union_discriminator:Q=`Invalid discriminator value. Expected ${m.joinValues($.options)}`;break;case F.invalid_enum_value:Q=`Invalid enum value. Expected ${m.joinValues($.options)}, received '${$.received}'`;break;case F.invalid_arguments:Q="Invalid function arguments";break;case F.invalid_return_type:Q="Invalid function return type";break;case F.invalid_date:Q="Invalid date";break;case F.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(Q=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")Q=`${Q} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)Q=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)Q=`Invalid input: must end with "${$.validation.endsWith}"`;else m.assertNever($.validation);else if($.validation!=="regex")Q=`Invalid ${$.validation}`;else Q="Invalid";break;case F.too_small:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="bigint")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else Q="Invalid input";break;case F.too_big:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")Q=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else Q="Invalid input";break;case F.custom:Q="Invalid input";break;case F.invalid_intersection_types:Q="Intersection results could not be merged";break;case F.not_multiple_of:Q=`Number must be a multiple of ${$.multipleOf}`;break;case F.not_finite:Q="Number must be finite";break;default:Q=J.defaultError,m.assertNever($)}return{message:Q}},n0=CW;var _2=n0;function OW($){_2=$}function E1(){return _2}var G$=($)=>{let{data:J,path:Q,errorMaps:W,issueData:H}=$,X=[...Q,...H.path||[]],q={...H,path:X};if(H.message!==void 0)return{...H,path:X,message:H.message};let Y="",G=W.filter((B)=>!!B).slice().reverse();for(let B of G)Y=B(q,{data:J,defaultError:Y}).message;return{...H,path:X,message:Y}},MW=[];function E($,J){let Q=E1(),W=G$({issueData:J,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,Q,Q===n0?void 0:n0].filter((H)=>!!H)});$.common.issues.push(W)}class q0{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,J){let Q=[];for(let W of J){if(W.status==="aborted")return f;if(W.status==="dirty")$.dirty();Q.push(W.value)}return{status:$.value,value:Q}}static async mergeObjectAsync($,J){let Q=[];for(let W of J){let H=await W.key,X=await W.value;Q.push({key:H,value:X})}return q0.mergeObjectSync($,Q)}static mergeObjectSync($,J){let Q={};for(let W of J){let{key:H,value:X}=W;if(H.status==="aborted")return f;if(X.status==="aborted")return f;if(H.status==="dirty")$.dirty();if(X.status==="dirty")$.dirty();if(H.value!=="__proto__"&&(typeof X.value<"u"||W.alwaysSet))Q[H.value]=X.value}return{status:$.value,value:Q}}}var f=Object.freeze({status:"aborted"}),H1=($)=>({status:"dirty",value:$}),G0=($)=>({status:"valid",value:$}),s$=($)=>$.status==="aborted",o$=($)=>$.status==="dirty",s0=($)=>$.status==="valid",R1=($)=>typeof Promise<"u"&&$ instanceof Promise;var I;(function($){$.errToObj=(J)=>typeof J==="string"?{message:J}:J||{},$.toString=(J)=>typeof J==="string"?J:J?.message})(I||(I={}));class I0{constructor($,J,Q,W){this._cachedPath=[],this.parent=$,this.data=J,this._path=Q,this._key=W}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var V2=($,J)=>{if(s0(J))return{success:!0,data:J.value};else{if(!$.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Q=new X0($.common.issues);return this._error=Q,this._error}}}};function y($){if(!$)return{};let{errorMap:J,invalid_type_error:Q,required_error:W,description:H}=$;if(J&&(Q||W))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(J)return{errorMap:J,description:H};return{errorMap:(q,Y)=>{let{message:G}=$;if(q.code==="invalid_enum_value")return{message:G??Y.defaultError};if(typeof Y.data>"u")return{message:G??W??Y.defaultError};if(q.code!=="invalid_type")return{message:Y.defaultError};return{message:G??Q??Y.defaultError}},description:H}}class u{get description(){return this._def.description}_getType($){return y0($.data)}_getOrReturnCtx($,J){return J||{common:$.parent.common,data:$.data,parsedType:y0($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new q0,ctx:{common:$.parent.common,data:$.data,parsedType:y0($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let J=this._parse($);if(R1(J))throw Error("Synchronous parse encountered promise.");return J}_parseAsync($){let J=this._parse($);return Promise.resolve(J)}parse($,J){let Q=this.safeParse($,J);if(Q.success)return Q.data;throw Q.error}safeParse($,J){let Q={common:{issues:[],async:J?.async??!1,contextualErrorMap:J?.errorMap},path:J?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:y0($)},W=this._parseSync({data:$,path:Q.path,parent:Q});return V2(Q,W)}"~validate"($){let J={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:y0($)};if(!this["~standard"].async)try{let Q=this._parseSync({data:$,path:[],parent:J});return s0(Q)?{value:Q.value}:{issues:J.common.issues}}catch(Q){if(Q?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;J.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:J}).then((Q)=>s0(Q)?{value:Q.value}:{issues:J.common.issues})}async parseAsync($,J){let Q=await this.safeParseAsync($,J);if(Q.success)return Q.data;throw Q.error}async safeParseAsync($,J){let Q={common:{issues:[],contextualErrorMap:J?.errorMap,async:!0},path:J?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:y0($)},W=this._parse({data:$,path:Q.path,parent:Q}),H=await(R1(W)?W:Promise.resolve(W));return V2(Q,H)}refine($,J){let Q=(W)=>{if(typeof J==="string"||typeof J>"u")return{message:J};else if(typeof J==="function")return J(W);else return J};return this._refinement((W,H)=>{let X=$(W),q=()=>H.addIssue({code:F.custom,...Q(W)});if(typeof Promise<"u"&&X instanceof Promise)return X.then((Y)=>{if(!Y)return q(),!1;else return!0});if(!X)return q(),!1;else return!0})}refinement($,J){return this._refinement((Q,W)=>{if(!$(Q))return W.addIssue(typeof J==="function"?J(Q,W):J),!1;else return!0})}_refinement($){return new k0({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(J)=>this["~validate"](J)}}optional(){return Z0.create(this,this._def)}nullable(){return i0.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return P0.create(this)}promise(){return G1.create(this,this._def)}or($){return Z1.create([this,$],this._def)}and($){return I1.create(this,$,this._def)}transform($){return new k0({...y(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:$}})}default($){let J=typeof $==="function"?$:()=>$;return new T1({...y(this._def),innerType:this,defaultValue:J,typeName:N.ZodDefault})}brand(){return new t$({typeName:N.ZodBranded,type:this,...y(this._def)})}catch($){let J=typeof $==="function"?$:()=>$;return new x1({...y(this._def),innerType:this,catchValue:J,typeName:N.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return V$.create(this,$)}readonly(){return v1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var bW=/^c[^\s-]{8,}$/i,PW=/^[0-9a-z]+$/,ZW=/^[0-9A-HJKMNP-TV-Z]{26}$/i,IW=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,kW=/^[a-z0-9_-]{21}$/i,KW=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,fW=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,TW=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,xW="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",D4,vW=/^(?:(?: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])$/,hW=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,gW=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,yW=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,uW=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,lW=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,z2="((\\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])))",mW=new RegExp(`^${z2}$`);function N2($){let J="[0-5]\\d";if($.precision)J=`${J}\\.\\d{${$.precision}}`;else if($.precision==null)J=`${J}(\\.\\d+)?`;let Q=$.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${J})${Q}`}function cW($){return new RegExp(`^${N2($)}$`)}function L2($){let J=`${z2}T${N2($)}`,Q=[];if(Q.push($.local?"Z?":"Z"),$.offset)Q.push("([+-]\\d{2}:?\\d{2})");return J=`${J}(${Q.join("|")})`,new RegExp(`^${J}$`)}function nW($,J){if((J==="v4"||!J)&&vW.test($))return!0;if((J==="v6"||!J)&&gW.test($))return!0;return!1}function dW($,J){if(!KW.test($))return!1;try{let[Q]=$.split(".");if(!Q)return!1;let W=Q.replace(/-/g,"+").replace(/_/g,"/").padEnd(Q.length+(4-Q.length%4)%4,"="),H=JSON.parse(atob(W));if(typeof H!=="object"||H===null)return!1;if("typ"in H&&H?.typ!=="JWT")return!1;if(!H.alg)return!1;if(J&&H.alg!==J)return!1;return!0}catch{return!1}}function iW($,J){if((J==="v4"||!J)&&hW.test($))return!0;if((J==="v6"||!J)&&yW.test($))return!0;return!1}class b0 extends u{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==L.string){let H=this._getOrReturnCtx($);return E(H,{code:F.invalid_type,expected:L.string,received:H.parsedType}),f}let Q=new q0,W=void 0;for(let H of this._def.checks)if(H.kind==="min"){if($.data.length<H.value)W=this._getOrReturnCtx($,W),E(W,{code:F.too_small,minimum:H.value,type:"string",inclusive:!0,exact:!1,message:H.message}),Q.dirty()}else if(H.kind==="max"){if($.data.length>H.value)W=this._getOrReturnCtx($,W),E(W,{code:F.too_big,maximum:H.value,type:"string",inclusive:!0,exact:!1,message:H.message}),Q.dirty()}else if(H.kind==="length"){let X=$.data.length>H.value,q=$.data.length<H.value;if(X||q){if(W=this._getOrReturnCtx($,W),X)E(W,{code:F.too_big,maximum:H.value,type:"string",inclusive:!0,exact:!0,message:H.message});else if(q)E(W,{code:F.too_small,minimum:H.value,type:"string",inclusive:!0,exact:!0,message:H.message});Q.dirty()}}else if(H.kind==="email"){if(!TW.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"email",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="emoji"){if(!D4)D4=new RegExp(xW,"u");if(!D4.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"emoji",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="uuid"){if(!IW.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"uuid",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="nanoid"){if(!kW.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"nanoid",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="cuid"){if(!bW.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"cuid",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="cuid2"){if(!PW.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"cuid2",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="ulid"){if(!ZW.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"ulid",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="url")try{new URL($.data)}catch{W=this._getOrReturnCtx($,W),E(W,{validation:"url",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="regex"){if(H.regex.lastIndex=0,!H.regex.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"regex",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="trim")$.data=$.data.trim();else if(H.kind==="includes"){if(!$.data.includes(H.value,H.position))W=this._getOrReturnCtx($,W),E(W,{code:F.invalid_string,validation:{includes:H.value,position:H.position},message:H.message}),Q.dirty()}else if(H.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(H.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(H.kind==="startsWith"){if(!$.data.startsWith(H.value))W=this._getOrReturnCtx($,W),E(W,{code:F.invalid_string,validation:{startsWith:H.value},message:H.message}),Q.dirty()}else if(H.kind==="endsWith"){if(!$.data.endsWith(H.value))W=this._getOrReturnCtx($,W),E(W,{code:F.invalid_string,validation:{endsWith:H.value},message:H.message}),Q.dirty()}else if(H.kind==="datetime"){if(!L2(H).test($.data))W=this._getOrReturnCtx($,W),E(W,{code:F.invalid_string,validation:"datetime",message:H.message}),Q.dirty()}else if(H.kind==="date"){if(!mW.test($.data))W=this._getOrReturnCtx($,W),E(W,{code:F.invalid_string,validation:"date",message:H.message}),Q.dirty()}else if(H.kind==="time"){if(!cW(H).test($.data))W=this._getOrReturnCtx($,W),E(W,{code:F.invalid_string,validation:"time",message:H.message}),Q.dirty()}else if(H.kind==="duration"){if(!fW.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"duration",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="ip"){if(!nW($.data,H.version))W=this._getOrReturnCtx($,W),E(W,{validation:"ip",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="jwt"){if(!dW($.data,H.alg))W=this._getOrReturnCtx($,W),E(W,{validation:"jwt",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="cidr"){if(!iW($.data,H.version))W=this._getOrReturnCtx($,W),E(W,{validation:"cidr",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="base64"){if(!uW.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"base64",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="base64url"){if(!lW.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"base64url",code:F.invalid_string,message:H.message}),Q.dirty()}else m.assertNever(H);return{status:Q.value,value:$.data}}_regex($,J,Q){return this.refinement((W)=>$.test(W),{validation:J,code:F.invalid_string,...I.errToObj(Q)})}_addCheck($){return new b0({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...I.errToObj($)})}url($){return this._addCheck({kind:"url",...I.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...I.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...I.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...I.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...I.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...I.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...I.errToObj($)})}base64($){return this._addCheck({kind:"base64",...I.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...I.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...I.errToObj($)})}ip($){return this._addCheck({kind:"ip",...I.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...I.errToObj($)})}datetime($){if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof $?.precision>"u"?null:$?.precision,offset:$?.offset??!1,local:$?.local??!1,...I.errToObj($?.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof $?.precision>"u"?null:$?.precision,...I.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...I.errToObj($)})}regex($,J){return this._addCheck({kind:"regex",regex:$,...I.errToObj(J)})}includes($,J){return this._addCheck({kind:"includes",value:$,position:J?.position,...I.errToObj(J?.message)})}startsWith($,J){return this._addCheck({kind:"startsWith",value:$,...I.errToObj(J)})}endsWith($,J){return this._addCheck({kind:"endsWith",value:$,...I.errToObj(J)})}min($,J){return this._addCheck({kind:"min",value:$,...I.errToObj(J)})}max($,J){return this._addCheck({kind:"max",value:$,...I.errToObj(J)})}length($,J){return this._addCheck({kind:"length",value:$,...I.errToObj(J)})}nonempty($){return this.min(1,I.errToObj($))}trim(){return new b0({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new b0({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new b0({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxLength(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}}b0.create=($)=>{return new b0({checks:[],typeName:N.ZodString,coerce:$?.coerce??!1,...y($)})};function pW($,J){let Q=($.toString().split(".")[1]||"").length,W=(J.toString().split(".")[1]||"").length,H=Q>W?Q:W,X=Number.parseInt($.toFixed(H).replace(".","")),q=Number.parseInt(J.toFixed(H).replace(".",""));return X%q/10**H}class r0 extends u{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==L.number){let H=this._getOrReturnCtx($);return E(H,{code:F.invalid_type,expected:L.number,received:H.parsedType}),f}let Q=void 0,W=new q0;for(let H of this._def.checks)if(H.kind==="int"){if(!m.isInteger($.data))Q=this._getOrReturnCtx($,Q),E(Q,{code:F.invalid_type,expected:"integer",received:"float",message:H.message}),W.dirty()}else if(H.kind==="min"){if(H.inclusive?$.data<H.value:$.data<=H.value)Q=this._getOrReturnCtx($,Q),E(Q,{code:F.too_small,minimum:H.value,type:"number",inclusive:H.inclusive,exact:!1,message:H.message}),W.dirty()}else if(H.kind==="max"){if(H.inclusive?$.data>H.value:$.data>=H.value)Q=this._getOrReturnCtx($,Q),E(Q,{code:F.too_big,maximum:H.value,type:"number",inclusive:H.inclusive,exact:!1,message:H.message}),W.dirty()}else if(H.kind==="multipleOf"){if(pW($.data,H.value)!==0)Q=this._getOrReturnCtx($,Q),E(Q,{code:F.not_multiple_of,multipleOf:H.value,message:H.message}),W.dirty()}else if(H.kind==="finite"){if(!Number.isFinite($.data))Q=this._getOrReturnCtx($,Q),E(Q,{code:F.not_finite,message:H.message}),W.dirty()}else m.assertNever(H);return{status:W.value,value:$.data}}gte($,J){return this.setLimit("min",$,!0,I.toString(J))}gt($,J){return this.setLimit("min",$,!1,I.toString(J))}lte($,J){return this.setLimit("max",$,!0,I.toString(J))}lt($,J){return this.setLimit("max",$,!1,I.toString(J))}setLimit($,J,Q,W){return new r0({...this._def,checks:[...this._def.checks,{kind:$,value:J,inclusive:Q,message:I.toString(W)}]})}_addCheck($){return new r0({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:I.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:I.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:I.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:I.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:I.toString($)})}multipleOf($,J){return this._addCheck({kind:"multipleOf",value:$,message:I.toString(J)})}finite($){return this._addCheck({kind:"finite",message:I.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:I.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:I.toString($)})}get minValue(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxValue(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&m.isInteger($.value))}get isFinite(){let $=null,J=null;for(let Q of this._def.checks)if(Q.kind==="finite"||Q.kind==="int"||Q.kind==="multipleOf")return!0;else if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}else if(Q.kind==="max"){if($===null||Q.value<$)$=Q.value}return Number.isFinite(J)&&Number.isFinite($)}}r0.create=($)=>{return new r0({checks:[],typeName:N.ZodNumber,coerce:$?.coerce||!1,...y($)})};class t0 extends u{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch{return this._getInvalidInput($)}if(this._getType($)!==L.bigint)return this._getInvalidInput($);let Q=void 0,W=new q0;for(let H of this._def.checks)if(H.kind==="min"){if(H.inclusive?$.data<H.value:$.data<=H.value)Q=this._getOrReturnCtx($,Q),E(Q,{code:F.too_small,type:"bigint",minimum:H.value,inclusive:H.inclusive,message:H.message}),W.dirty()}else if(H.kind==="max"){if(H.inclusive?$.data>H.value:$.data>=H.value)Q=this._getOrReturnCtx($,Q),E(Q,{code:F.too_big,type:"bigint",maximum:H.value,inclusive:H.inclusive,message:H.message}),W.dirty()}else if(H.kind==="multipleOf"){if($.data%H.value!==BigInt(0))Q=this._getOrReturnCtx($,Q),E(Q,{code:F.not_multiple_of,multipleOf:H.value,message:H.message}),W.dirty()}else m.assertNever(H);return{status:W.value,value:$.data}}_getInvalidInput($){let J=this._getOrReturnCtx($);return E(J,{code:F.invalid_type,expected:L.bigint,received:J.parsedType}),f}gte($,J){return this.setLimit("min",$,!0,I.toString(J))}gt($,J){return this.setLimit("min",$,!1,I.toString(J))}lte($,J){return this.setLimit("max",$,!0,I.toString(J))}lt($,J){return this.setLimit("max",$,!1,I.toString(J))}setLimit($,J,Q,W){return new t0({...this._def,checks:[...this._def.checks,{kind:$,value:J,inclusive:Q,message:I.toString(W)}]})}_addCheck($){return new t0({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:I.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:I.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:I.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:I.toString($)})}multipleOf($,J){return this._addCheck({kind:"multipleOf",value:$,message:I.toString(J)})}get minValue(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxValue(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}}t0.create=($)=>{return new t0({checks:[],typeName:N.ZodBigInt,coerce:$?.coerce??!1,...y($)})};class M1 extends u{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==L.boolean){let Q=this._getOrReturnCtx($);return E(Q,{code:F.invalid_type,expected:L.boolean,received:Q.parsedType}),f}return G0($.data)}}M1.create=($)=>{return new M1({typeName:N.ZodBoolean,coerce:$?.coerce||!1,...y($)})};class X1 extends u{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==L.date){let H=this._getOrReturnCtx($);return E(H,{code:F.invalid_type,expected:L.date,received:H.parsedType}),f}if(Number.isNaN($.data.getTime())){let H=this._getOrReturnCtx($);return E(H,{code:F.invalid_date}),f}let Q=new q0,W=void 0;for(let H of this._def.checks)if(H.kind==="min"){if($.data.getTime()<H.value)W=this._getOrReturnCtx($,W),E(W,{code:F.too_small,message:H.message,inclusive:!0,exact:!1,minimum:H.value,type:"date"}),Q.dirty()}else if(H.kind==="max"){if($.data.getTime()>H.value)W=this._getOrReturnCtx($,W),E(W,{code:F.too_big,message:H.message,inclusive:!0,exact:!1,maximum:H.value,type:"date"}),Q.dirty()}else m.assertNever(H);return{status:Q.value,value:new Date($.data.getTime())}}_addCheck($){return new X1({...this._def,checks:[...this._def.checks,$]})}min($,J){return this._addCheck({kind:"min",value:$.getTime(),message:I.toString(J)})}max($,J){return this._addCheck({kind:"max",value:$.getTime(),message:I.toString(J)})}get minDate(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $!=null?new Date($):null}}X1.create=($)=>{return new X1({checks:[],coerce:$?.coerce||!1,typeName:N.ZodDate,...y($)})};class B$ extends u{_parse($){if(this._getType($)!==L.symbol){let Q=this._getOrReturnCtx($);return E(Q,{code:F.invalid_type,expected:L.symbol,received:Q.parsedType}),f}return G0($.data)}}B$.create=($)=>{return new B$({typeName:N.ZodSymbol,...y($)})};class b1 extends u{_parse($){if(this._getType($)!==L.undefined){let Q=this._getOrReturnCtx($);return E(Q,{code:F.invalid_type,expected:L.undefined,received:Q.parsedType}),f}return G0($.data)}}b1.create=($)=>{return new b1({typeName:N.ZodUndefined,...y($)})};class P1 extends u{_parse($){if(this._getType($)!==L.null){let Q=this._getOrReturnCtx($);return E(Q,{code:F.invalid_type,expected:L.null,received:Q.parsedType}),f}return G0($.data)}}P1.create=($)=>{return new P1({typeName:N.ZodNull,...y($)})};class q1 extends u{constructor(){super(...arguments);this._any=!0}_parse($){return G0($.data)}}q1.create=($)=>{return new q1({typeName:N.ZodAny,...y($)})};class o0 extends u{constructor(){super(...arguments);this._unknown=!0}_parse($){return G0($.data)}}o0.create=($)=>{return new o0({typeName:N.ZodUnknown,...y($)})};class u0 extends u{_parse($){let J=this._getOrReturnCtx($);return E(J,{code:F.invalid_type,expected:L.never,received:J.parsedType}),f}}u0.create=($)=>{return new u0({typeName:N.ZodNever,...y($)})};class w$ extends u{_parse($){if(this._getType($)!==L.undefined){let Q=this._getOrReturnCtx($);return E(Q,{code:F.invalid_type,expected:L.void,received:Q.parsedType}),f}return G0($.data)}}w$.create=($)=>{return new w$({typeName:N.ZodVoid,...y($)})};class P0 extends u{_parse($){let{ctx:J,status:Q}=this._processInputParams($),W=this._def;if(J.parsedType!==L.array)return E(J,{code:F.invalid_type,expected:L.array,received:J.parsedType}),f;if(W.exactLength!==null){let X=J.data.length>W.exactLength.value,q=J.data.length<W.exactLength.value;if(X||q)E(J,{code:X?F.too_big:F.too_small,minimum:q?W.exactLength.value:void 0,maximum:X?W.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:W.exactLength.message}),Q.dirty()}if(W.minLength!==null){if(J.data.length<W.minLength.value)E(J,{code:F.too_small,minimum:W.minLength.value,type:"array",inclusive:!0,exact:!1,message:W.minLength.message}),Q.dirty()}if(W.maxLength!==null){if(J.data.length>W.maxLength.value)E(J,{code:F.too_big,maximum:W.maxLength.value,type:"array",inclusive:!0,exact:!1,message:W.maxLength.message}),Q.dirty()}if(J.common.async)return Promise.all([...J.data].map((X,q)=>{return W.type._parseAsync(new I0(J,X,J.path,q))})).then((X)=>{return q0.mergeArray(Q,X)});let H=[...J.data].map((X,q)=>{return W.type._parseSync(new I0(J,X,J.path,q))});return q0.mergeArray(Q,H)}get element(){return this._def.type}min($,J){return new P0({...this._def,minLength:{value:$,message:I.toString(J)}})}max($,J){return new P0({...this._def,maxLength:{value:$,message:I.toString(J)}})}length($,J){return new P0({...this._def,exactLength:{value:$,message:I.toString(J)}})}nonempty($){return this.min(1,$)}}P0.create=($,J)=>{return new P0({type:$,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...y(J)})};function C1($){if($ instanceof r){let J={};for(let Q in $.shape){let W=$.shape[Q];J[Q]=Z0.create(C1(W))}return new r({...$._def,shape:()=>J})}else if($ instanceof P0)return new P0({...$._def,type:C1($.element)});else if($ instanceof Z0)return Z0.create(C1($.unwrap()));else if($ instanceof i0)return i0.create(C1($.unwrap()));else if($ instanceof l0)return l0.create($.items.map((J)=>C1(J)));else return $}class r extends u{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),J=m.objectKeys($);return this._cached={shape:$,keys:J},this._cached}_parse($){if(this._getType($)!==L.object){let G=this._getOrReturnCtx($);return E(G,{code:F.invalid_type,expected:L.object,received:G.parsedType}),f}let{status:Q,ctx:W}=this._processInputParams($),{shape:H,keys:X}=this._getCached(),q=[];if(!(this._def.catchall instanceof u0&&this._def.unknownKeys==="strip")){for(let G in W.data)if(!X.includes(G))q.push(G)}let Y=[];for(let G of X){let B=H[G],w=W.data[G];Y.push({key:{status:"valid",value:G},value:B._parse(new I0(W,w,W.path,G)),alwaysSet:G in W.data})}if(this._def.catchall instanceof u0){let G=this._def.unknownKeys;if(G==="passthrough")for(let B of q)Y.push({key:{status:"valid",value:B},value:{status:"valid",value:W.data[B]}});else if(G==="strict"){if(q.length>0)E(W,{code:F.unrecognized_keys,keys:q}),Q.dirty()}else if(G==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let G=this._def.catchall;for(let B of q){let w=W.data[B];Y.push({key:{status:"valid",value:B},value:G._parse(new I0(W,w,W.path,B)),alwaysSet:B in W.data})}}if(W.common.async)return Promise.resolve().then(async()=>{let G=[];for(let B of Y){let w=await B.key,_=await B.value;G.push({key:w,value:_,alwaysSet:B.alwaysSet})}return G}).then((G)=>{return q0.mergeObjectSync(Q,G)});else return q0.mergeObjectSync(Q,Y)}get shape(){return this._def.shape()}strict($){return I.errToObj,new r({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(J,Q)=>{let W=this._def.errorMap?.(J,Q).message??Q.defaultError;if(J.code==="unrecognized_keys")return{message:I.errToObj($).message??W};return{message:W}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend($){return new r({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new r({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:N.ZodObject})}setKey($,J){return this.augment({[$]:J})}catchall($){return new r({...this._def,catchall:$})}pick($){let J={};for(let Q of m.objectKeys($))if($[Q]&&this.shape[Q])J[Q]=this.shape[Q];return new r({...this._def,shape:()=>J})}omit($){let J={};for(let Q of m.objectKeys(this.shape))if(!$[Q])J[Q]=this.shape[Q];return new r({...this._def,shape:()=>J})}deepPartial(){return C1(this)}partial($){let J={};for(let Q of m.objectKeys(this.shape)){let W=this.shape[Q];if($&&!$[Q])J[Q]=W;else J[Q]=W.optional()}return new r({...this._def,shape:()=>J})}required($){let J={};for(let Q of m.objectKeys(this.shape))if($&&!$[Q])J[Q]=this.shape[Q];else{let H=this.shape[Q];while(H instanceof Z0)H=H._def.innerType;J[Q]=H}return new r({...this._def,shape:()=>J})}keyof(){return j2(m.objectKeys(this.shape))}}r.create=($,J)=>{return new r({shape:()=>$,unknownKeys:"strip",catchall:u0.create(),typeName:N.ZodObject,...y(J)})};r.strictCreate=($,J)=>{return new r({shape:()=>$,unknownKeys:"strict",catchall:u0.create(),typeName:N.ZodObject,...y(J)})};r.lazycreate=($,J)=>{return new r({shape:$,unknownKeys:"strip",catchall:u0.create(),typeName:N.ZodObject,...y(J)})};class Z1 extends u{_parse($){let{ctx:J}=this._processInputParams($),Q=this._def.options;function W(H){for(let q of H)if(q.result.status==="valid")return q.result;for(let q of H)if(q.result.status==="dirty")return J.common.issues.push(...q.ctx.common.issues),q.result;let X=H.map((q)=>new X0(q.ctx.common.issues));return E(J,{code:F.invalid_union,unionErrors:X}),f}if(J.common.async)return Promise.all(Q.map(async(H)=>{let X={...J,common:{...J.common,issues:[]},parent:null};return{result:await H._parseAsync({data:J.data,path:J.path,parent:X}),ctx:X}})).then(W);else{let H=void 0,X=[];for(let Y of Q){let G={...J,common:{...J.common,issues:[]},parent:null},B=Y._parseSync({data:J.data,path:J.path,parent:G});if(B.status==="valid")return B;else if(B.status==="dirty"&&!H)H={result:B,ctx:G};if(G.common.issues.length)X.push(G.common.issues)}if(H)return J.common.issues.push(...H.ctx.common.issues),H.result;let q=X.map((Y)=>new X0(Y));return E(J,{code:F.invalid_union,unionErrors:q}),f}}get options(){return this._def.options}}Z1.create=($,J)=>{return new Z1({options:$,typeName:N.ZodUnion,...y(J)})};var d0=($)=>{if($ instanceof k1)return d0($.schema);else if($ instanceof k0)return d0($.innerType());else if($ instanceof K1)return[$.value];else if($ instanceof a0)return $.options;else if($ instanceof f1)return m.objectValues($.enum);else if($ instanceof T1)return d0($._def.innerType);else if($ instanceof b1)return[void 0];else if($ instanceof P1)return[null];else if($ instanceof Z0)return[void 0,...d0($.unwrap())];else if($ instanceof i0)return[null,...d0($.unwrap())];else if($ instanceof t$)return d0($.unwrap());else if($ instanceof v1)return d0($.unwrap());else if($ instanceof x1)return d0($._def.innerType);else return[]};class r$ extends u{_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==L.object)return E(J,{code:F.invalid_type,expected:L.object,received:J.parsedType}),f;let Q=this.discriminator,W=J.data[Q],H=this.optionsMap.get(W);if(!H)return E(J,{code:F.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Q]}),f;if(J.common.async)return H._parseAsync({data:J.data,path:J.path,parent:J});else return H._parseSync({data:J.data,path:J.path,parent:J})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,J,Q){let W=new Map;for(let H of J){let X=d0(H.shape[$]);if(!X.length)throw Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let q of X){if(W.has(q))throw Error(`Discriminator property ${String($)} has duplicate value ${String(q)}`);W.set(q,H)}}return new r$({typeName:N.ZodDiscriminatedUnion,discriminator:$,options:J,optionsMap:W,...y(Q)})}}function U4($,J){let Q=y0($),W=y0(J);if($===J)return{valid:!0,data:$};else if(Q===L.object&&W===L.object){let H=m.objectKeys(J),X=m.objectKeys($).filter((Y)=>H.indexOf(Y)!==-1),q={...$,...J};for(let Y of X){let G=U4($[Y],J[Y]);if(!G.valid)return{valid:!1};q[Y]=G.data}return{valid:!0,data:q}}else if(Q===L.array&&W===L.array){if($.length!==J.length)return{valid:!1};let H=[];for(let X=0;X<$.length;X++){let q=$[X],Y=J[X],G=U4(q,Y);if(!G.valid)return{valid:!1};H.push(G.data)}return{valid:!0,data:H}}else if(Q===L.date&&W===L.date&&+$===+J)return{valid:!0,data:$};else return{valid:!1}}class I1 extends u{_parse($){let{status:J,ctx:Q}=this._processInputParams($),W=(H,X)=>{if(s$(H)||s$(X))return f;let q=U4(H.value,X.value);if(!q.valid)return E(Q,{code:F.invalid_intersection_types}),f;if(o$(H)||o$(X))J.dirty();return{status:J.value,value:q.data}};if(Q.common.async)return Promise.all([this._def.left._parseAsync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseAsync({data:Q.data,path:Q.path,parent:Q})]).then(([H,X])=>W(H,X));else return W(this._def.left._parseSync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseSync({data:Q.data,path:Q.path,parent:Q}))}}I1.create=($,J,Q)=>{return new I1({left:$,right:J,typeName:N.ZodIntersection,...y(Q)})};class l0 extends u{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==L.array)return E(Q,{code:F.invalid_type,expected:L.array,received:Q.parsedType}),f;if(Q.data.length<this._def.items.length)return E(Q,{code:F.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),f;if(!this._def.rest&&Q.data.length>this._def.items.length)E(Q,{code:F.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),J.dirty();let H=[...Q.data].map((X,q)=>{let Y=this._def.items[q]||this._def.rest;if(!Y)return null;return Y._parse(new I0(Q,X,Q.path,q))}).filter((X)=>!!X);if(Q.common.async)return Promise.all(H).then((X)=>{return q0.mergeArray(J,X)});else return q0.mergeArray(J,H)}get items(){return this._def.items}rest($){return new l0({...this._def,rest:$})}}l0.create=($,J)=>{if(!Array.isArray($))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new l0({items:$,typeName:N.ZodTuple,rest:null,...y(J)})};class D$ extends u{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==L.object)return E(Q,{code:F.invalid_type,expected:L.object,received:Q.parsedType}),f;let W=[],H=this._def.keyType,X=this._def.valueType;for(let q in Q.data)W.push({key:H._parse(new I0(Q,q,Q.path,q)),value:X._parse(new I0(Q,Q.data[q],Q.path,q)),alwaysSet:q in Q.data});if(Q.common.async)return q0.mergeObjectAsync(J,W);else return q0.mergeObjectSync(J,W)}get element(){return this._def.valueType}static create($,J,Q){if(J instanceof u)return new D$({keyType:$,valueType:J,typeName:N.ZodRecord,...y(Q)});return new D$({keyType:b0.create(),valueType:$,typeName:N.ZodRecord,...y(J)})}}class U$ extends u{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==L.map)return E(Q,{code:F.invalid_type,expected:L.map,received:Q.parsedType}),f;let W=this._def.keyType,H=this._def.valueType,X=[...Q.data.entries()].map(([q,Y],G)=>{return{key:W._parse(new I0(Q,q,Q.path,[G,"key"])),value:H._parse(new I0(Q,Y,Q.path,[G,"value"]))}});if(Q.common.async){let q=new Map;return Promise.resolve().then(async()=>{for(let Y of X){let G=await Y.key,B=await Y.value;if(G.status==="aborted"||B.status==="aborted")return f;if(G.status==="dirty"||B.status==="dirty")J.dirty();q.set(G.value,B.value)}return{status:J.value,value:q}})}else{let q=new Map;for(let Y of X){let{key:G,value:B}=Y;if(G.status==="aborted"||B.status==="aborted")return f;if(G.status==="dirty"||B.status==="dirty")J.dirty();q.set(G.value,B.value)}return{status:J.value,value:q}}}}U$.create=($,J,Q)=>{return new U$({valueType:J,keyType:$,typeName:N.ZodMap,...y(Q)})};class Y1 extends u{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==L.set)return E(Q,{code:F.invalid_type,expected:L.set,received:Q.parsedType}),f;let W=this._def;if(W.minSize!==null){if(Q.data.size<W.minSize.value)E(Q,{code:F.too_small,minimum:W.minSize.value,type:"set",inclusive:!0,exact:!1,message:W.minSize.message}),J.dirty()}if(W.maxSize!==null){if(Q.data.size>W.maxSize.value)E(Q,{code:F.too_big,maximum:W.maxSize.value,type:"set",inclusive:!0,exact:!1,message:W.maxSize.message}),J.dirty()}let H=this._def.valueType;function X(Y){let G=new Set;for(let B of Y){if(B.status==="aborted")return f;if(B.status==="dirty")J.dirty();G.add(B.value)}return{status:J.value,value:G}}let q=[...Q.data.values()].map((Y,G)=>H._parse(new I0(Q,Y,Q.path,G)));if(Q.common.async)return Promise.all(q).then((Y)=>X(Y));else return X(q)}min($,J){return new Y1({...this._def,minSize:{value:$,message:I.toString(J)}})}max($,J){return new Y1({...this._def,maxSize:{value:$,message:I.toString(J)}})}size($,J){return this.min($,J).max($,J)}nonempty($){return this.min(1,$)}}Y1.create=($,J)=>{return new Y1({valueType:$,minSize:null,maxSize:null,typeName:N.ZodSet,...y(J)})};class O1 extends u{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==L.function)return E(J,{code:F.invalid_type,expected:L.function,received:J.parsedType}),f;function Q(q,Y){return G$({data:q,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,E1(),n0].filter((G)=>!!G),issueData:{code:F.invalid_arguments,argumentsError:Y}})}function W(q,Y){return G$({data:q,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,E1(),n0].filter((G)=>!!G),issueData:{code:F.invalid_return_type,returnTypeError:Y}})}let H={errorMap:J.common.contextualErrorMap},X=J.data;if(this._def.returns instanceof G1){let q=this;return G0(async function(...Y){let G=new X0([]),B=await q._def.args.parseAsync(Y,H).catch((R)=>{throw G.addIssue(Q(Y,R)),G}),w=await Reflect.apply(X,this,B);return await q._def.returns._def.type.parseAsync(w,H).catch((R)=>{throw G.addIssue(W(w,R)),G})})}else{let q=this;return G0(function(...Y){let G=q._def.args.safeParse(Y,H);if(!G.success)throw new X0([Q(Y,G.error)]);let B=Reflect.apply(X,this,G.data),w=q._def.returns.safeParse(B,H);if(!w.success)throw new X0([W(B,w.error)]);return w.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new O1({...this._def,args:l0.create($).rest(o0.create())})}returns($){return new O1({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,J,Q){return new O1({args:$?$:l0.create([]).rest(o0.create()),returns:J||o0.create(),typeName:N.ZodFunction,...y(Q)})}}class k1 extends u{get schema(){return this._def.getter()}_parse($){let{ctx:J}=this._processInputParams($);return this._def.getter()._parse({data:J.data,path:J.path,parent:J})}}k1.create=($,J)=>{return new k1({getter:$,typeName:N.ZodLazy,...y(J)})};class K1 extends u{_parse($){if($.data!==this._def.value){let J=this._getOrReturnCtx($);return E(J,{received:J.data,code:F.invalid_literal,expected:this._def.value}),f}return{status:"valid",value:$.data}}get value(){return this._def.value}}K1.create=($,J)=>{return new K1({value:$,typeName:N.ZodLiteral,...y(J)})};function j2($,J){return new a0({values:$,typeName:N.ZodEnum,...y(J)})}class a0 extends u{_parse($){if(typeof $.data!=="string"){let J=this._getOrReturnCtx($),Q=this._def.values;return E(J,{expected:m.joinValues(Q),received:J.parsedType,code:F.invalid_type}),f}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has($.data)){let J=this._getOrReturnCtx($),Q=this._def.values;return E(J,{received:J.data,code:F.invalid_enum_value,options:Q}),f}return G0($.data)}get options(){return this._def.values}get enum(){let $={};for(let J of this._def.values)$[J]=J;return $}get Values(){let $={};for(let J of this._def.values)$[J]=J;return $}get Enum(){let $={};for(let J of this._def.values)$[J]=J;return $}extract($,J=this._def){return a0.create($,{...this._def,...J})}exclude($,J=this._def){return a0.create(this.options.filter((Q)=>!$.includes(Q)),{...this._def,...J})}}a0.create=j2;class f1 extends u{_parse($){let J=m.getValidEnumValues(this._def.values),Q=this._getOrReturnCtx($);if(Q.parsedType!==L.string&&Q.parsedType!==L.number){let W=m.objectValues(J);return E(Q,{expected:m.joinValues(W),received:Q.parsedType,code:F.invalid_type}),f}if(!this._cache)this._cache=new Set(m.getValidEnumValues(this._def.values));if(!this._cache.has($.data)){let W=m.objectValues(J);return E(Q,{received:Q.data,code:F.invalid_enum_value,options:W}),f}return G0($.data)}get enum(){return this._def.values}}f1.create=($,J)=>{return new f1({values:$,typeName:N.ZodNativeEnum,...y(J)})};class G1 extends u{unwrap(){return this._def.type}_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==L.promise&&J.common.async===!1)return E(J,{code:F.invalid_type,expected:L.promise,received:J.parsedType}),f;let Q=J.parsedType===L.promise?J.data:Promise.resolve(J.data);return G0(Q.then((W)=>{return this._def.type.parseAsync(W,{path:J.path,errorMap:J.common.contextualErrorMap})}))}}G1.create=($,J)=>{return new G1({type:$,typeName:N.ZodPromise,...y(J)})};class k0 extends u{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:J,ctx:Q}=this._processInputParams($),W=this._def.effect||null,H={addIssue:(X)=>{if(E(Q,X),X.fatal)J.abort();else J.dirty()},get path(){return Q.path}};if(H.addIssue=H.addIssue.bind(H),W.type==="preprocess"){let X=W.transform(Q.data,H);if(Q.common.async)return Promise.resolve(X).then(async(q)=>{if(J.value==="aborted")return f;let Y=await this._def.schema._parseAsync({data:q,path:Q.path,parent:Q});if(Y.status==="aborted")return f;if(Y.status==="dirty")return H1(Y.value);if(J.value==="dirty")return H1(Y.value);return Y});else{if(J.value==="aborted")return f;let q=this._def.schema._parseSync({data:X,path:Q.path,parent:Q});if(q.status==="aborted")return f;if(q.status==="dirty")return H1(q.value);if(J.value==="dirty")return H1(q.value);return q}}if(W.type==="refinement"){let X=(q)=>{let Y=W.refinement(q,H);if(Q.common.async)return Promise.resolve(Y);if(Y instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return q};if(Q.common.async===!1){let q=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(q.status==="aborted")return f;if(q.status==="dirty")J.dirty();return X(q.value),{status:J.value,value:q.value}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((q)=>{if(q.status==="aborted")return f;if(q.status==="dirty")J.dirty();return X(q.value).then(()=>{return{status:J.value,value:q.value}})})}if(W.type==="transform")if(Q.common.async===!1){let X=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(!s0(X))return f;let q=W.transform(X.value,H);if(q instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:J.value,value:q}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((X)=>{if(!s0(X))return f;return Promise.resolve(W.transform(X.value,H)).then((q)=>({status:J.value,value:q}))});m.assertNever(W)}}k0.create=($,J,Q)=>{return new k0({schema:$,typeName:N.ZodEffects,effect:J,...y(Q)})};k0.createWithPreprocess=($,J,Q)=>{return new k0({schema:J,effect:{type:"preprocess",transform:$},typeName:N.ZodEffects,...y(Q)})};class Z0 extends u{_parse($){if(this._getType($)===L.undefined)return G0(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}Z0.create=($,J)=>{return new Z0({innerType:$,typeName:N.ZodOptional,...y(J)})};class i0 extends u{_parse($){if(this._getType($)===L.null)return G0(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}i0.create=($,J)=>{return new i0({innerType:$,typeName:N.ZodNullable,...y(J)})};class T1 extends u{_parse($){let{ctx:J}=this._processInputParams($),Q=J.data;if(J.parsedType===L.undefined)Q=this._def.defaultValue();return this._def.innerType._parse({data:Q,path:J.path,parent:J})}removeDefault(){return this._def.innerType}}T1.create=($,J)=>{return new T1({innerType:$,typeName:N.ZodDefault,defaultValue:typeof J.default==="function"?J.default:()=>J.default,...y(J)})};class x1 extends u{_parse($){let{ctx:J}=this._processInputParams($),Q={...J,common:{...J.common,issues:[]}},W=this._def.innerType._parse({data:Q.data,path:Q.path,parent:{...Q}});if(R1(W))return W.then((H)=>{return{status:"valid",value:H.status==="valid"?H.value:this._def.catchValue({get error(){return new X0(Q.common.issues)},input:Q.data})}});else return{status:"valid",value:W.status==="valid"?W.value:this._def.catchValue({get error(){return new X0(Q.common.issues)},input:Q.data})}}removeCatch(){return this._def.innerType}}x1.create=($,J)=>{return new x1({innerType:$,typeName:N.ZodCatch,catchValue:typeof J.catch==="function"?J.catch:()=>J.catch,...y(J)})};class _$ extends u{_parse($){if(this._getType($)!==L.nan){let Q=this._getOrReturnCtx($);return E(Q,{code:F.invalid_type,expected:L.nan,received:Q.parsedType}),f}return{status:"valid",value:$.data}}}_$.create=($)=>{return new _$({typeName:N.ZodNaN,...y($)})};var sW=Symbol("zod_brand");class t$ extends u{_parse($){let{ctx:J}=this._processInputParams($),Q=J.data;return this._def.type._parse({data:Q,path:J.path,parent:J})}unwrap(){return this._def.type}}class V$ extends u{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.common.async)return(async()=>{let H=await this._def.in._parseAsync({data:Q.data,path:Q.path,parent:Q});if(H.status==="aborted")return f;if(H.status==="dirty")return J.dirty(),H1(H.value);else return this._def.out._parseAsync({data:H.value,path:Q.path,parent:Q})})();else{let W=this._def.in._parseSync({data:Q.data,path:Q.path,parent:Q});if(W.status==="aborted")return f;if(W.status==="dirty")return J.dirty(),{status:"dirty",value:W.value};else return this._def.out._parseSync({data:W.value,path:Q.path,parent:Q})}}static create($,J){return new V$({in:$,out:J,typeName:N.ZodPipeline})}}class v1 extends u{_parse($){let J=this._def.innerType._parse($),Q=(W)=>{if(s0(W))W.value=Object.freeze(W.value);return W};return R1(J)?J.then((W)=>Q(W)):Q(J)}unwrap(){return this._def.innerType}}v1.create=($,J)=>{return new v1({innerType:$,typeName:N.ZodReadonly,...y(J)})};function F2($,J){let Q=typeof $==="function"?$(J):typeof $==="string"?{message:$}:$;return typeof Q==="string"?{message:Q}:Q}function S2($,J={},Q){if($)return q1.create().superRefine((W,H)=>{let X=$(W);if(X instanceof Promise)return X.then((q)=>{if(!q){let Y=F2(J,W),G=Y.fatal??Q??!0;H.addIssue({code:"custom",...Y,fatal:G})}});if(!X){let q=F2(J,W),Y=q.fatal??Q??!0;H.addIssue({code:"custom",...q,fatal:Y})}return});return q1.create()}var oW={object:r.lazycreate},N;(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(N||(N={}));var rW=($,J={message:`Input not instance of ${$.name}`})=>S2((Q)=>Q instanceof $,J),A2=b0.create,E2=r0.create,tW=_$.create,aW=t0.create,R2=M1.create,eW=X1.create,$H=B$.create,JH=b1.create,QH=P1.create,WH=q1.create,HH=o0.create,XH=u0.create,qH=w$.create,YH=P0.create,GH=r.create,BH=r.strictCreate,wH=Z1.create,DH=r$.create,UH=I1.create,_H=l0.create,VH=D$.create,FH=U$.create,zH=Y1.create,NH=O1.create,LH=k1.create,jH=K1.create,SH=a0.create,AH=f1.create,EH=G1.create,RH=k0.create,CH=Z0.create,OH=i0.create,MH=k0.createWithPreprocess,bH=V$.create,PH=()=>A2().optional(),ZH=()=>E2().optional(),IH=()=>R2().optional(),kH={string:($)=>b0.create({...$,coerce:!0}),number:($)=>r0.create({...$,coerce:!0}),boolean:($)=>M1.create({...$,coerce:!0}),bigint:($)=>t0.create({...$,coerce:!0}),date:($)=>X1.create({...$,coerce:!0})};var KH=f;function s($){if($.target!=="openAi")return{};let J=[...$.basePath,$.definitionPath,$.openAiAnyTypeName];return $.flags.hasReferencedOpenAiAnyType=!0,{$ref:$.$refStrategy==="relative"?p$(J,$.currentPath):J.join("/")}}function C2($,J){let Q={type:"array"};if($.type?._def&&$.type?._def?.typeName!==N.ZodAny)Q.items=x($.type._def,{...J,currentPath:[...J.currentPath,"items"]});if($.minLength)n(Q,"minItems",$.minLength.value,$.minLength.message,J);if($.maxLength)n(Q,"maxItems",$.maxLength.value,$.maxLength.message,J);if($.exactLength)n(Q,"minItems",$.exactLength.value,$.exactLength.message,J),n(Q,"maxItems",$.exactLength.value,$.exactLength.message,J);return Q}function O2($,J){let Q={type:"integer",format:"int64"};if(!$.checks)return Q;for(let W of $.checks)switch(W.kind){case"min":if(J.target==="jsonSchema7")if(W.inclusive)n(Q,"minimum",W.value,W.message,J);else n(Q,"exclusiveMinimum",W.value,W.message,J);else{if(!W.inclusive)Q.exclusiveMinimum=!0;n(Q,"minimum",W.value,W.message,J)}break;case"max":if(J.target==="jsonSchema7")if(W.inclusive)n(Q,"maximum",W.value,W.message,J);else n(Q,"exclusiveMaximum",W.value,W.message,J);else{if(!W.inclusive)Q.exclusiveMaximum=!0;n(Q,"maximum",W.value,W.message,J)}break;case"multipleOf":n(Q,"multipleOf",W.value,W.message,J);break}return Q}function M2(){return{type:"boolean"}}function a$($,J){return x($.type._def,J)}var b2=($,J)=>{return x($.innerType._def,J)};function _4($,J,Q){let W=Q??J.dateStrategy;if(Array.isArray(W))return{anyOf:W.map((H,X)=>_4($,J,H))};switch(W){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return fH($,J)}}var fH=($,J)=>{let Q={type:"integer",format:"unix-time"};if(J.target==="openApi3")return Q;for(let W of $.checks)switch(W.kind){case"min":n(Q,"minimum",W.value,W.message,J);break;case"max":n(Q,"maximum",W.value,W.message,J);break}return Q};function P2($,J){return{...x($.innerType._def,J),default:$.defaultValue()}}function Z2($,J){return J.effectStrategy==="input"?x($.schema._def,J):s(J)}function I2($){return{type:"string",enum:Array.from($.values)}}var TH=($)=>{if("type"in $&&$.type==="string")return!1;return"allOf"in $};function k2($,J){let Q=[x($.left._def,{...J,currentPath:[...J.currentPath,"allOf","0"]}),x($.right._def,{...J,currentPath:[...J.currentPath,"allOf","1"]})].filter((X)=>!!X),W=J.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,H=[];return Q.forEach((X)=>{if(TH(X)){if(H.push(...X.allOf),X.unevaluatedProperties===void 0)W=void 0}else{let q=X;if("additionalProperties"in X&&X.additionalProperties===!1){let{additionalProperties:Y,...G}=X;q=G}else W=void 0;H.push(q)}}),H.length?{allOf:H,...W}:void 0}function K2($,J){let Q=typeof $.value;if(Q!=="bigint"&&Q!=="number"&&Q!=="boolean"&&Q!=="string")return{type:Array.isArray($.value)?"array":"object"};if(J.target==="openApi3")return{type:Q==="bigint"?"integer":Q,enum:[$.value]};return{type:Q==="bigint"?"integer":Q,const:$.value}}var V4=void 0,K0={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(V4===void 0)V4=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return V4},uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function e$($,J){let Q={type:"string"};if($.checks)for(let W of $.checks)switch(W.kind){case"min":n(Q,"minLength",typeof Q.minLength==="number"?Math.max(Q.minLength,W.value):W.value,W.message,J);break;case"max":n(Q,"maxLength",typeof Q.maxLength==="number"?Math.min(Q.maxLength,W.value):W.value,W.message,J);break;case"email":switch(J.emailStrategy){case"format:email":f0(Q,"email",W.message,J);break;case"format:idn-email":f0(Q,"idn-email",W.message,J);break;case"pattern:zod":_0(Q,K0.email,W.message,J);break}break;case"url":f0(Q,"uri",W.message,J);break;case"uuid":f0(Q,"uuid",W.message,J);break;case"regex":_0(Q,W.regex,W.message,J);break;case"cuid":_0(Q,K0.cuid,W.message,J);break;case"cuid2":_0(Q,K0.cuid2,W.message,J);break;case"startsWith":_0(Q,RegExp(`^${F4(W.value,J)}`),W.message,J);break;case"endsWith":_0(Q,RegExp(`${F4(W.value,J)}$`),W.message,J);break;case"datetime":f0(Q,"date-time",W.message,J);break;case"date":f0(Q,"date",W.message,J);break;case"time":f0(Q,"time",W.message,J);break;case"duration":f0(Q,"duration",W.message,J);break;case"length":n(Q,"minLength",typeof Q.minLength==="number"?Math.max(Q.minLength,W.value):W.value,W.message,J),n(Q,"maxLength",typeof Q.maxLength==="number"?Math.min(Q.maxLength,W.value):W.value,W.message,J);break;case"includes":{_0(Q,RegExp(F4(W.value,J)),W.message,J);break}case"ip":{if(W.version!=="v6")f0(Q,"ipv4",W.message,J);if(W.version!=="v4")f0(Q,"ipv6",W.message,J);break}case"base64url":_0(Q,K0.base64url,W.message,J);break;case"jwt":_0(Q,K0.jwt,W.message,J);break;case"cidr":{if(W.version!=="v6")_0(Q,K0.ipv4Cidr,W.message,J);if(W.version!=="v4")_0(Q,K0.ipv6Cidr,W.message,J);break}case"emoji":_0(Q,K0.emoji(),W.message,J);break;case"ulid":{_0(Q,K0.ulid,W.message,J);break}case"base64":{switch(J.base64Strategy){case"format:binary":{f0(Q,"binary",W.message,J);break}case"contentEncoding:base64":{n(Q,"contentEncoding","base64",W.message,J);break}case"pattern:zod":{_0(Q,K0.base64,W.message,J);break}}break}case"nanoid":_0(Q,K0.nanoid,W.message,J);case"toLowerCase":case"toUpperCase":case"trim":break;default:((H)=>{})(W)}return Q}function F4($,J){return J.patternStrategy==="escape"?vH($):$}var xH=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function vH($){let J="";for(let Q=0;Q<$.length;Q++){if(!xH.has($[Q]))J+="\\";J+=$[Q]}return J}function f0($,J,Q,W){if($.format||$.anyOf?.some((H)=>H.format)){if(!$.anyOf)$.anyOf=[];if($.format){if($.anyOf.push({format:$.format,...$.errorMessage&&W.errorMessages&&{errorMessage:{format:$.errorMessage.format}}}),delete $.format,$.errorMessage){if(delete $.errorMessage.format,Object.keys($.errorMessage).length===0)delete $.errorMessage}}$.anyOf.push({format:J,...Q&&W.errorMessages&&{errorMessage:{format:Q}}})}else n($,"format",J,Q,W)}function _0($,J,Q,W){if($.pattern||$.allOf?.some((H)=>H.pattern)){if(!$.allOf)$.allOf=[];if($.pattern){if($.allOf.push({pattern:$.pattern,...$.errorMessage&&W.errorMessages&&{errorMessage:{pattern:$.errorMessage.pattern}}}),delete $.pattern,$.errorMessage){if(delete $.errorMessage.pattern,Object.keys($.errorMessage).length===0)delete $.errorMessage}}$.allOf.push({pattern:f2(J,W),...Q&&W.errorMessages&&{errorMessage:{pattern:Q}}})}else n($,"pattern",f2(J,W),Q,W)}function f2($,J){if(!J.applyRegexFlags||!$.flags)return $.source;let Q={i:$.flags.includes("i"),m:$.flags.includes("m"),s:$.flags.includes("s")},W=Q.i?$.source.toLowerCase():$.source,H="",X=!1,q=!1,Y=!1;for(let G=0;G<W.length;G++){if(X){H+=W[G],X=!1;continue}if(Q.i){if(q){if(W[G].match(/[a-z]/)){if(Y)H+=W[G],H+=`${W[G-2]}-${W[G]}`.toUpperCase(),Y=!1;else if(W[G+1]==="-"&&W[G+2]?.match(/[a-z]/))H+=W[G],Y=!0;else H+=`${W[G]}${W[G].toUpperCase()}`;continue}}else if(W[G].match(/[a-z]/)){H+=`[${W[G]}${W[G].toUpperCase()}]`;continue}}if(Q.m){if(W[G]==="^"){H+=`(^|(?<=[\r
16
+ "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".`,T$="secret must be a string or buffer",p1="key must be a string or a buffer",hX="key must be a string, a buffer or an object",Q8=typeof j0.createPublicKey==="function";if(Q8)p1+=" or a KeyObject",T$+="or a KeyObject";function F5($){if(s1.isBuffer($))return;if(typeof $==="string")return;if(!Q8)throw x0(p1);if(typeof $!=="object")throw x0(p1);if(typeof $.type!=="string")throw x0(p1);if(typeof $.asymmetricKeyType!=="string")throw x0(p1);if(typeof $.export!=="function")throw x0(p1)}function z5($){if(s1.isBuffer($))return;if(typeof $==="string")return;if(typeof $==="object")return;throw x0(hX)}function gX($){if(s1.isBuffer($))return;if(typeof $==="string")return $;if(!Q8)throw x0(T$);if(typeof $!=="object")throw x0(T$);if($.type!=="secret")throw x0(T$);if(typeof $.export!=="function")throw x0(T$)}function W8($){return $.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function N5($){$=$.toString();var J=4-$.length%4;if(J!==4)for(var Q=0;Q<J;++Q)$+="=";return $.replace(/\-/g,"+").replace(/_/g,"/")}function x0($){var J=[].slice.call(arguments,1),Q=_5.format.bind(_5,$).apply(null,J);return TypeError(Q)}function yX($){return s1.isBuffer($)||typeof $==="string"}function x$($){if(!yX($))$=JSON.stringify($);return $}function L5($){return function(Q,W){gX(W),Q=x$(Q);var H=j0.createHmac("sha"+$,W),X=(H.update(Q),H.digest("base64"));return W8(X)}}var J8,uX="timingSafeEqual"in j0?function(J,Q){if(J.byteLength!==Q.byteLength)return!1;return j0.timingSafeEqual(J,Q)}:function(J,Q){if(!J8)J8=U5();return J8(J,Q)};function lX($){return function(Q,W,H){var X=L5($)(Q,H);return uX(s1.from(W),s1.from(X))}}function j5($){return function(Q,W){z5(W),Q=x$(Q);var H=j0.createSign("RSA-SHA"+$),X=(H.update(Q),H.sign(W,"base64"));return W8(X)}}function S5($){return function(Q,W,H){F5(H),Q=x$(Q),W=N5(W);var X=j0.createVerify("RSA-SHA"+$);return X.update(Q),X.verify(H,W,"base64")}}function mX($){return function(Q,W){z5(W),Q=x$(Q);var H=j0.createSign("RSA-SHA"+$),X=(H.update(Q),H.sign({key:W,padding:j0.constants.RSA_PKCS1_PSS_PADDING,saltLength:j0.constants.RSA_PSS_SALTLEN_DIGEST},"base64"));return W8(X)}}function cX($){return function(Q,W,H){F5(H),Q=x$(Q),W=N5(W);var X=j0.createVerify("RSA-SHA"+$);return X.update(Q),X.verify({key:H,padding:j0.constants.RSA_PKCS1_PSS_PADDING,saltLength:j0.constants.RSA_PSS_SALTLEN_DIGEST},W,"base64")}}function nX($){var J=j5($);return function(){var W=J.apply(null,arguments);return W=V5.derToJose(W,"ES"+$),W}}function dX($){var J=S5($);return function(W,H,X){H=V5.joseToDer(H,"ES"+$).toString("base64");var q=J(W,H,X);return q}}function iX(){return function(){return""}}function pX(){return function(J,Q){return Q===""}}A5.exports=function(J){var Q={hs:L5,rs:j5,ps:mX,es:nX,none:iX},W={hs:lX,rs:S5,ps:cX,es:dX,none:pX},H=J.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/i);if(!H)throw x0(vX,J);var X=(H[1]||H[3]).toLowerCase(),q=H[2];return{sign:Q[X](q),verify:W[X](q)}}});var X8=A((wN,E5)=>{var sX=require("buffer").Buffer;E5.exports=function(J){if(typeof J==="string")return J;if(typeof J==="number"||sX.isBuffer(J))return J.toString();return JSON.stringify(J)}});var P5=A((DN,b5)=>{var oX=i1().Buffer,R5=a4(),rX=H8(),tX=require("stream"),C5=X8(),q8=require("util");function O5($,J){return oX.from($,J).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function aX($,J,Q){Q=Q||"utf8";var W=O5(C5($),"binary"),H=O5(C5(J),Q);return q8.format("%s.%s",W,H)}function M5($){var{header:J,payload:Q}=$,W=$.secret||$.privateKey,H=$.encoding,X=rX(J.alg),q=aX(J,Q,H),Y=X.sign(q,W);return q8.format("%s.%s",q,Y)}function f6($){var J=$.secret||$.privateKey||$.key,Q=new R5(J);this.readable=!0,this.header=$.header,this.encoding=$.encoding,this.secret=this.privateKey=this.key=Q,this.payload=new R5($.payload),this.secret.once("close",function(){if(!this.payload.writable&&this.readable)this.sign()}.bind(this)),this.payload.once("close",function(){if(!this.secret.writable&&this.readable)this.sign()}.bind(this))}q8.inherits(f6,tX);f6.prototype.sign=function(){try{var J=M5({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",J),this.emit("data",J),this.emit("end"),this.readable=!1,J}catch(Q){this.readable=!1,this.emit("error",Q),this.emit("close")}};f6.sign=M5;b5.exports=f6});var g5=A((UN,h5)=>{var I5=i1().Buffer,Z5=a4(),eX=H8(),$q=require("stream"),k5=X8(),Jq=require("util"),Qq=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function Wq($){return Object.prototype.toString.call($)==="[object Object]"}function Hq($){if(Wq($))return $;try{return JSON.parse($)}catch(J){return}}function K5($){var J=$.split(".",1)[0];return Hq(I5.from(J,"base64").toString("binary"))}function Xq($){return $.split(".",2).join(".")}function f5($){return $.split(".")[2]}function qq($,J){J=J||"utf8";var Q=$.split(".")[1];return I5.from(Q,"base64").toString(J)}function T5($){return Qq.test($)&&!!K5($)}function x5($,J,Q){if(!J){var W=Error("Missing algorithm parameter for jws.verify");throw W.code="MISSING_ALGORITHM",W}$=k5($);var H=f5($),X=Xq($),q=eX(J);return q.verify(X,H,Q)}function v5($,J){if(J=J||{},$=k5($),!T5($))return null;var Q=K5($);if(!Q)return null;var W=qq($);if(Q.typ==="JWT"||J.json)W=JSON.parse(W,J.encoding);return{header:Q,payload:W,signature:f5($)}}function o1($){$=$||{};var J=$.secret||$.publicKey||$.key,Q=new Z5(J);this.readable=!0,this.algorithm=$.algorithm,this.encoding=$.encoding,this.secret=this.publicKey=this.key=Q,this.signature=new Z5($.signature),this.secret.once("close",function(){if(!this.signature.writable&&this.readable)this.verify()}.bind(this)),this.signature.once("close",function(){if(!this.secret.writable&&this.readable)this.verify()}.bind(this))}Jq.inherits(o1,$q);o1.prototype.verify=function(){try{var J=x5(this.signature.buffer,this.algorithm,this.key.buffer),Q=v5(this.signature.buffer,this.encoding);return this.emit("done",J,Q),this.emit("data",J),this.emit("end"),this.readable=!1,J}catch(W){this.readable=!1,this.emit("error",W),this.emit("close")}};o1.decode=v5;o1.isValid=T5;o1.verify=x5;h5.exports=o1});var x6=A(($1)=>{var y5=P5(),T6=g5(),Yq=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"];$1.ALGORITHMS=Yq;$1.sign=y5.sign;$1.verify=T6.verify;$1.decode=T6.decode;$1.isValid=T6.isValid;$1.createSign=function(J){return new y5(J)};$1.createVerify=function(J){return new T6(J)}});var Y8=A((VN,u5)=>{var Gq=x6();u5.exports=function($,J){J=J||{};var Q=Gq.decode($,J);if(!Q)return null;var W=Q.payload;if(typeof W==="string")try{var H=JSON.parse(W);if(H!==null&&typeof H==="object")W=H}catch(X){}if(J.complete===!0)return{header:Q.header,payload:W,signature:Q.signature};return W}});var v$=A((FN,l5)=>{var v6=function($,J){if(Error.call(this,$),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);if(this.name="JsonWebTokenError",this.message=$,J)this.inner=J};v6.prototype=Object.create(Error.prototype);v6.prototype.constructor=v6;l5.exports=v6});var G8=A((zN,c5)=>{var m5=v$(),h6=function($,J){m5.call(this,$),this.name="NotBeforeError",this.date=J};h6.prototype=Object.create(m5.prototype);h6.prototype.constructor=h6;c5.exports=h6});var B8=A((NN,d5)=>{var n5=v$(),g6=function($,J){n5.call(this,$),this.name="TokenExpiredError",this.expiredAt=J};g6.prototype=Object.create(n5.prototype);g6.prototype.constructor=g6;d5.exports=g6});var p5=A((LN,i5)=>{var r1=1000,t1=r1*60,a1=t1*60,L1=a1*24,Bq=L1*7,wq=L1*365.25;i5.exports=function($,J){J=J||{};var Q=typeof $;if(Q==="string"&&$.length>0)return Dq($);else if(Q==="number"&&isFinite($))return J.long?_q($):Uq($);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify($))};function Dq($){if($=String($),$.length>100)return;var J=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec($);if(!J)return;var Q=parseFloat(J[1]),W=(J[2]||"ms").toLowerCase();switch(W){case"years":case"year":case"yrs":case"yr":case"y":return Q*wq;case"weeks":case"week":case"w":return Q*Bq;case"days":case"day":case"d":return Q*L1;case"hours":case"hour":case"hrs":case"hr":case"h":return Q*a1;case"minutes":case"minute":case"mins":case"min":case"m":return Q*t1;case"seconds":case"second":case"secs":case"sec":case"s":return Q*r1;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return Q;default:return}}function Uq($){var J=Math.abs($);if(J>=L1)return Math.round($/L1)+"d";if(J>=a1)return Math.round($/a1)+"h";if(J>=t1)return Math.round($/t1)+"m";if(J>=r1)return Math.round($/r1)+"s";return $+"ms"}function _q($){var J=Math.abs($);if(J>=L1)return y6($,J,L1,"day");if(J>=a1)return y6($,J,a1,"hour");if(J>=t1)return y6($,J,t1,"minute");if(J>=r1)return y6($,J,r1,"second");return $+" ms"}function y6($,J,Q,W){var H=J>=Q*1.5;return Math.round($/Q)+" "+W+(H?"s":"")}});var w8=A((jN,s5)=>{var Vq=p5();s5.exports=function($,J){var Q=J||Math.floor(Date.now()/1000);if(typeof $==="string"){var W=Vq($);if(typeof W>"u")return;return Math.floor(Q+W/1000)}else if(typeof $==="number")return Q+$;else return}});var h$=A((SN,o5)=>{var Fq=Number.MAX_SAFE_INTEGER||9007199254740991,zq=["major","premajor","minor","preminor","patch","prepatch","prerelease"];o5.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Fq,RELEASE_TYPES:zq,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var g$=A((AN,r5)=>{var Nq=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...$)=>console.error("SEMVER",...$):()=>{};r5.exports=Nq});var e1=A((c0,t5)=>{var{MAX_SAFE_COMPONENT_LENGTH:D8,MAX_SAFE_BUILD_LENGTH:Lq,MAX_LENGTH:jq}=h$(),Sq=g$();c0=t5.exports={};var Aq=c0.re=[],Eq=c0.safeRe=[],O=c0.src=[],Rq=c0.safeSrc=[],M=c0.t={},Cq=0,U8="[a-zA-Z0-9-]",Oq=[["\\s",1],["\\d",jq],[U8,Lq]],Mq=($)=>{for(let[J,Q]of Oq)$=$.split(`${J}*`).join(`${J}{0,${Q}}`).split(`${J}+`).join(`${J}{1,${Q}}`);return $},g=($,J,Q)=>{let W=Mq(J),H=Cq++;Sq($,H,J),M[$]=H,O[H]=J,Rq[H]=W,Aq[H]=new RegExp(J,Q?"g":void 0),Eq[H]=new RegExp(W,Q?"g":void 0)};g("NUMERICIDENTIFIER","0|[1-9]\\d*");g("NUMERICIDENTIFIERLOOSE","\\d+");g("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${U8}*`);g("MAINVERSION",`(${O[M.NUMERICIDENTIFIER]})\\.(${O[M.NUMERICIDENTIFIER]})\\.(${O[M.NUMERICIDENTIFIER]})`);g("MAINVERSIONLOOSE",`(${O[M.NUMERICIDENTIFIERLOOSE]})\\.(${O[M.NUMERICIDENTIFIERLOOSE]})\\.(${O[M.NUMERICIDENTIFIERLOOSE]})`);g("PRERELEASEIDENTIFIER",`(?:${O[M.NONNUMERICIDENTIFIER]}|${O[M.NUMERICIDENTIFIER]})`);g("PRERELEASEIDENTIFIERLOOSE",`(?:${O[M.NONNUMERICIDENTIFIER]}|${O[M.NUMERICIDENTIFIERLOOSE]})`);g("PRERELEASE",`(?:-(${O[M.PRERELEASEIDENTIFIER]}(?:\\.${O[M.PRERELEASEIDENTIFIER]})*))`);g("PRERELEASELOOSE",`(?:-?(${O[M.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${O[M.PRERELEASEIDENTIFIERLOOSE]})*))`);g("BUILDIDENTIFIER",`${U8}+`);g("BUILD",`(?:\\+(${O[M.BUILDIDENTIFIER]}(?:\\.${O[M.BUILDIDENTIFIER]})*))`);g("FULLPLAIN",`v?${O[M.MAINVERSION]}${O[M.PRERELEASE]}?${O[M.BUILD]}?`);g("FULL",`^${O[M.FULLPLAIN]}$`);g("LOOSEPLAIN",`[v=\\s]*${O[M.MAINVERSIONLOOSE]}${O[M.PRERELEASELOOSE]}?${O[M.BUILD]}?`);g("LOOSE",`^${O[M.LOOSEPLAIN]}$`);g("GTLT","((?:<|>)?=?)");g("XRANGEIDENTIFIERLOOSE",`${O[M.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);g("XRANGEIDENTIFIER",`${O[M.NUMERICIDENTIFIER]}|x|X|\\*`);g("XRANGEPLAIN",`[v=\\s]*(${O[M.XRANGEIDENTIFIER]})(?:\\.(${O[M.XRANGEIDENTIFIER]})(?:\\.(${O[M.XRANGEIDENTIFIER]})(?:${O[M.PRERELEASE]})?${O[M.BUILD]}?)?)?`);g("XRANGEPLAINLOOSE",`[v=\\s]*(${O[M.XRANGEIDENTIFIERLOOSE]})(?:\\.(${O[M.XRANGEIDENTIFIERLOOSE]})(?:\\.(${O[M.XRANGEIDENTIFIERLOOSE]})(?:${O[M.PRERELEASELOOSE]})?${O[M.BUILD]}?)?)?`);g("XRANGE",`^${O[M.GTLT]}\\s*${O[M.XRANGEPLAIN]}$`);g("XRANGELOOSE",`^${O[M.GTLT]}\\s*${O[M.XRANGEPLAINLOOSE]}$`);g("COERCEPLAIN",`(^|[^\\d])(\\d{1,${D8}})(?:\\.(\\d{1,${D8}}))?(?:\\.(\\d{1,${D8}}))?`);g("COERCE",`${O[M.COERCEPLAIN]}(?:$|[^\\d])`);g("COERCEFULL",O[M.COERCEPLAIN]+`(?:${O[M.PRERELEASE]})?(?:${O[M.BUILD]})?(?:$|[^\\d])`);g("COERCERTL",O[M.COERCE],!0);g("COERCERTLFULL",O[M.COERCEFULL],!0);g("LONETILDE","(?:~>?)");g("TILDETRIM",`(\\s*)${O[M.LONETILDE]}\\s+`,!0);c0.tildeTrimReplace="$1~";g("TILDE",`^${O[M.LONETILDE]}${O[M.XRANGEPLAIN]}$`);g("TILDELOOSE",`^${O[M.LONETILDE]}${O[M.XRANGEPLAINLOOSE]}$`);g("LONECARET","(?:\\^)");g("CARETTRIM",`(\\s*)${O[M.LONECARET]}\\s+`,!0);c0.caretTrimReplace="$1^";g("CARET",`^${O[M.LONECARET]}${O[M.XRANGEPLAIN]}$`);g("CARETLOOSE",`^${O[M.LONECARET]}${O[M.XRANGEPLAINLOOSE]}$`);g("COMPARATORLOOSE",`^${O[M.GTLT]}\\s*(${O[M.LOOSEPLAIN]})$|^$`);g("COMPARATOR",`^${O[M.GTLT]}\\s*(${O[M.FULLPLAIN]})$|^$`);g("COMPARATORTRIM",`(\\s*)${O[M.GTLT]}\\s*(${O[M.LOOSEPLAIN]}|${O[M.XRANGEPLAIN]})`,!0);c0.comparatorTrimReplace="$1$2$3";g("HYPHENRANGE",`^\\s*(${O[M.XRANGEPLAIN]})\\s+-\\s+(${O[M.XRANGEPLAIN]})\\s*$`);g("HYPHENRANGELOOSE",`^\\s*(${O[M.XRANGEPLAINLOOSE]})\\s+-\\s+(${O[M.XRANGEPLAINLOOSE]})\\s*$`);g("STAR","(<|>)?=?\\s*\\*");g("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");g("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var u6=A((EN,a5)=>{var bq=Object.freeze({loose:!0}),Pq=Object.freeze({}),Zq=($)=>{if(!$)return Pq;if(typeof $!=="object")return bq;return $};a5.exports=Zq});var _8=A((RN,JJ)=>{var e5=/^[0-9]+$/,$J=($,J)=>{if(typeof $==="number"&&typeof J==="number")return $===J?0:$<J?-1:1;let Q=e5.test($),W=e5.test(J);if(Q&&W)$=+$,J=+J;return $===J?0:Q&&!W?-1:W&&!Q?1:$<J?-1:1},Iq=($,J)=>$J(J,$);JJ.exports={compareIdentifiers:$J,rcompareIdentifiers:Iq}});var w0=A((CN,WJ)=>{var l6=g$(),{MAX_LENGTH:QJ,MAX_SAFE_INTEGER:m6}=h$(),{safeRe:c6,t:n6}=e1(),kq=u6(),{compareIdentifiers:V8}=_8();class v0{constructor($,J){if(J=kq(J),$ instanceof v0)if($.loose===!!J.loose&&$.includePrerelease===!!J.includePrerelease)return $;else $=$.version;else if(typeof $!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof $}".`);if($.length>QJ)throw TypeError(`version is longer than ${QJ} characters`);l6("SemVer",$,J),this.options=J,this.loose=!!J.loose,this.includePrerelease=!!J.includePrerelease;let Q=$.trim().match(J.loose?c6[n6.LOOSE]:c6[n6.FULL]);if(!Q)throw TypeError(`Invalid Version: ${$}`);if(this.raw=$,this.major=+Q[1],this.minor=+Q[2],this.patch=+Q[3],this.major>m6||this.major<0)throw TypeError("Invalid major version");if(this.minor>m6||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>m6||this.patch<0)throw TypeError("Invalid patch version");if(!Q[4])this.prerelease=[];else this.prerelease=Q[4].split(".").map((W)=>{if(/^[0-9]+$/.test(W)){let H=+W;if(H>=0&&H<m6)return H}return W});this.build=Q[5]?Q[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare($){if(l6("SemVer.compare",this.version,this.options,$),!($ instanceof v0)){if(typeof $==="string"&&$===this.version)return 0;$=new v0($,this.options)}if($.version===this.version)return 0;return this.compareMain($)||this.comparePre($)}compareMain($){if(!($ instanceof v0))$=new v0($,this.options);if(this.major<$.major)return-1;if(this.major>$.major)return 1;if(this.minor<$.minor)return-1;if(this.minor>$.minor)return 1;if(this.patch<$.patch)return-1;if(this.patch>$.patch)return 1;return 0}comparePre($){if(!($ instanceof v0))$=new v0($,this.options);if(this.prerelease.length&&!$.prerelease.length)return-1;else if(!this.prerelease.length&&$.prerelease.length)return 1;else if(!this.prerelease.length&&!$.prerelease.length)return 0;let J=0;do{let Q=this.prerelease[J],W=$.prerelease[J];if(l6("prerelease compare",J,Q,W),Q===void 0&&W===void 0)return 0;else if(W===void 0)return 1;else if(Q===void 0)return-1;else if(Q===W)continue;else return V8(Q,W)}while(++J)}compareBuild($){if(!($ instanceof v0))$=new v0($,this.options);let J=0;do{let Q=this.build[J],W=$.build[J];if(l6("build compare",J,Q,W),Q===void 0&&W===void 0)return 0;else if(W===void 0)return 1;else if(Q===void 0)return-1;else if(Q===W)continue;else return V8(Q,W)}while(++J)}inc($,J,Q){if($.startsWith("pre")){if(!J&&Q===!1)throw Error("invalid increment argument: identifier is empty");if(J){let W=`-${J}`.match(this.options.loose?c6[n6.PRERELEASELOOSE]:c6[n6.PRERELEASE]);if(!W||W[1]!==J)throw Error(`invalid identifier: ${J}`)}}switch($){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",J,Q);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",J,Q);break;case"prepatch":this.prerelease.length=0,this.inc("patch",J,Q),this.inc("pre",J,Q);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",J,Q);this.inc("pre",J,Q);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let W=Number(Q)?1:0;if(this.prerelease.length===0)this.prerelease=[W];else{let H=this.prerelease.length;while(--H>=0)if(typeof this.prerelease[H]==="number")this.prerelease[H]++,H=-2;if(H===-1){if(J===this.prerelease.join(".")&&Q===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(W)}}if(J){let H=[J,W];if(Q===!1)H=[J];if(V8(this.prerelease[0],J)===0){if(isNaN(this.prerelease[1]))this.prerelease=H}else this.prerelease=H}break}default:throw Error(`invalid increment argument: ${$}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}WJ.exports=v0});var j1=A((ON,XJ)=>{var HJ=w0(),Kq=($,J,Q=!1)=>{if($ instanceof HJ)return $;try{return new HJ($,J)}catch(W){if(!Q)return null;throw W}};XJ.exports=Kq});var YJ=A((MN,qJ)=>{var fq=j1(),Tq=($,J)=>{let Q=fq($,J);return Q?Q.version:null};qJ.exports=Tq});var BJ=A((bN,GJ)=>{var xq=j1(),vq=($,J)=>{let Q=xq($.trim().replace(/^[=v]+/,""),J);return Q?Q.version:null};GJ.exports=vq});var UJ=A((PN,DJ)=>{var wJ=w0(),hq=($,J,Q,W,H)=>{if(typeof Q==="string")H=W,W=Q,Q=void 0;try{return new wJ($ instanceof wJ?$.version:$,Q).inc(J,W,H).version}catch(X){return null}};DJ.exports=hq});var FJ=A((ZN,VJ)=>{var _J=j1(),gq=($,J)=>{let Q=_J($,null,!0),W=_J(J,null,!0),H=Q.compare(W);if(H===0)return null;let X=H>0,q=X?Q:W,Y=X?W:Q,G=!!q.prerelease.length;if(!!Y.prerelease.length&&!G){if(!Y.patch&&!Y.minor)return"major";if(Y.compareMain(q)===0){if(Y.minor&&!Y.patch)return"minor";return"patch"}}let w=G?"pre":"";if(Q.major!==W.major)return w+"major";if(Q.minor!==W.minor)return w+"minor";if(Q.patch!==W.patch)return w+"patch";return"prerelease"};VJ.exports=gq});var NJ=A((IN,zJ)=>{var yq=w0(),uq=($,J)=>new yq($,J).major;zJ.exports=uq});var jJ=A((kN,LJ)=>{var lq=w0(),mq=($,J)=>new lq($,J).minor;LJ.exports=mq});var AJ=A((KN,SJ)=>{var cq=w0(),nq=($,J)=>new cq($,J).patch;SJ.exports=nq});var RJ=A((fN,EJ)=>{var dq=j1(),iq=($,J)=>{let Q=dq($,J);return Q&&Q.prerelease.length?Q.prerelease:null};EJ.exports=iq});var S0=A((TN,OJ)=>{var CJ=w0(),pq=($,J,Q)=>new CJ($,Q).compare(new CJ(J,Q));OJ.exports=pq});var bJ=A((xN,MJ)=>{var sq=S0(),oq=($,J,Q)=>sq(J,$,Q);MJ.exports=oq});var ZJ=A((vN,PJ)=>{var rq=S0(),tq=($,J)=>rq($,J,!0);PJ.exports=tq});var d6=A((hN,kJ)=>{var IJ=w0(),aq=($,J,Q)=>{let W=new IJ($,Q),H=new IJ(J,Q);return W.compare(H)||W.compareBuild(H)};kJ.exports=aq});var fJ=A((gN,KJ)=>{var eq=d6(),$3=($,J)=>$.sort((Q,W)=>eq(Q,W,J));KJ.exports=$3});var xJ=A((yN,TJ)=>{var J3=d6(),Q3=($,J)=>$.sort((Q,W)=>J3(W,Q,J));TJ.exports=Q3});var y$=A((uN,vJ)=>{var W3=S0(),H3=($,J,Q)=>W3($,J,Q)>0;vJ.exports=H3});var i6=A((lN,hJ)=>{var X3=S0(),q3=($,J,Q)=>X3($,J,Q)<0;hJ.exports=q3});var F8=A((mN,gJ)=>{var Y3=S0(),G3=($,J,Q)=>Y3($,J,Q)===0;gJ.exports=G3});var z8=A((cN,yJ)=>{var B3=S0(),w3=($,J,Q)=>B3($,J,Q)!==0;yJ.exports=w3});var p6=A((nN,uJ)=>{var D3=S0(),U3=($,J,Q)=>D3($,J,Q)>=0;uJ.exports=U3});var s6=A((dN,lJ)=>{var _3=S0(),V3=($,J,Q)=>_3($,J,Q)<=0;lJ.exports=V3});var N8=A((iN,mJ)=>{var F3=F8(),z3=z8(),N3=y$(),L3=p6(),j3=i6(),S3=s6(),A3=($,J,Q,W)=>{switch(J){case"===":if(typeof $==="object")$=$.version;if(typeof Q==="object")Q=Q.version;return $===Q;case"!==":if(typeof $==="object")$=$.version;if(typeof Q==="object")Q=Q.version;return $!==Q;case"":case"=":case"==":return F3($,Q,W);case"!=":return z3($,Q,W);case">":return N3($,Q,W);case">=":return L3($,Q,W);case"<":return j3($,Q,W);case"<=":return S3($,Q,W);default:throw TypeError(`Invalid operator: ${J}`)}};mJ.exports=A3});var nJ=A((pN,cJ)=>{var E3=w0(),R3=j1(),{safeRe:o6,t:r6}=e1(),C3=($,J)=>{if($ instanceof E3)return $;if(typeof $==="number")$=String($);if(typeof $!=="string")return null;J=J||{};let Q=null;if(!J.rtl)Q=$.match(J.includePrerelease?o6[r6.COERCEFULL]:o6[r6.COERCE]);else{let G=J.includePrerelease?o6[r6.COERCERTLFULL]:o6[r6.COERCERTL],B;while((B=G.exec($))&&(!Q||Q.index+Q[0].length!==$.length)){if(!Q||B.index+B[0].length!==Q.index+Q[0].length)Q=B;G.lastIndex=B.index+B[1].length+B[2].length}G.lastIndex=-1}if(Q===null)return null;let W=Q[2],H=Q[3]||"0",X=Q[4]||"0",q=J.includePrerelease&&Q[5]?`-${Q[5]}`:"",Y=J.includePrerelease&&Q[6]?`+${Q[6]}`:"";return R3(`${W}.${H}.${X}${q}${Y}`,J)};cJ.exports=C3});var pJ=A((sN,iJ)=>{class dJ{constructor(){this.max=1000,this.map=new Map}get($){let J=this.map.get($);if(J===void 0)return;else return this.map.delete($),this.map.set($,J),J}delete($){return this.map.delete($)}set($,J){if(!this.delete($)&&J!==void 0){if(this.map.size>=this.max){let W=this.map.keys().next().value;this.delete(W)}this.map.set($,J)}return this}}iJ.exports=dJ});var A0=A((oN,tJ)=>{var O3=/\s+/g;class u${constructor($,J){if(J=b3(J),$ instanceof u$)if($.loose===!!J.loose&&$.includePrerelease===!!J.includePrerelease)return $;else return new u$($.raw,J);if($ instanceof L8)return this.raw=$.value,this.set=[[$]],this.formatted=void 0,this;if(this.options=J,this.loose=!!J.loose,this.includePrerelease=!!J.includePrerelease,this.raw=$.trim().replace(O3," "),this.set=this.raw.split("||").map((Q)=>this.parseRange(Q.trim())).filter((Q)=>Q.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let Q=this.set[0];if(this.set=this.set.filter((W)=>!oJ(W[0])),this.set.length===0)this.set=[Q];else if(this.set.length>1){for(let W of this.set)if(W.length===1&&T3(W[0])){this.set=[W];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let $=0;$<this.set.length;$++){if($>0)this.formatted+="||";let J=this.set[$];for(let Q=0;Q<J.length;Q++){if(Q>0)this.formatted+=" ";this.formatted+=J[Q].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange($){let Q=((this.options.includePrerelease&&K3)|(this.options.loose&&f3))+":"+$,W=sJ.get(Q);if(W)return W;let H=this.options.loose,X=H?V0[D0.HYPHENRANGELOOSE]:V0[D0.HYPHENRANGE];$=$.replace(X,n3(this.options.includePrerelease)),p("hyphen replace",$),$=$.replace(V0[D0.COMPARATORTRIM],Z3),p("comparator trim",$),$=$.replace(V0[D0.TILDETRIM],I3),p("tilde trim",$),$=$.replace(V0[D0.CARETTRIM],k3),p("caret trim",$);let q=$.split(" ").map((w)=>x3(w,this.options)).join(" ").split(/\s+/).map((w)=>c3(w,this.options));if(H)q=q.filter((w)=>{return p("loose invalid filter",w,this.options),!!w.match(V0[D0.COMPARATORLOOSE])});p("range list",q);let Y=new Map,G=q.map((w)=>new L8(w,this.options));for(let w of G){if(oJ(w))return[w];Y.set(w.value,w)}if(Y.size>1&&Y.has(""))Y.delete("");let B=[...Y.values()];return sJ.set(Q,B),B}intersects($,J){if(!($ instanceof u$))throw TypeError("a Range is required");return this.set.some((Q)=>{return rJ(Q,J)&&$.set.some((W)=>{return rJ(W,J)&&Q.every((H)=>{return W.every((X)=>{return H.intersects(X,J)})})})})}test($){if(!$)return!1;if(typeof $==="string")try{$=new P3($,this.options)}catch(J){return!1}for(let J=0;J<this.set.length;J++)if(d3(this.set[J],$,this.options))return!0;return!1}}tJ.exports=u$;var M3=pJ(),sJ=new M3,b3=u6(),L8=l$(),p=g$(),P3=w0(),{safeRe:V0,t:D0,comparatorTrimReplace:Z3,tildeTrimReplace:I3,caretTrimReplace:k3}=e1(),{FLAG_INCLUDE_PRERELEASE:K3,FLAG_LOOSE:f3}=h$(),oJ=($)=>$.value==="<0.0.0-0",T3=($)=>$.value==="",rJ=($,J)=>{let Q=!0,W=$.slice(),H=W.pop();while(Q&&W.length)Q=W.every((X)=>{return H.intersects(X,J)}),H=W.pop();return Q},x3=($,J)=>{return $=$.replace(V0[D0.BUILD],""),p("comp",$,J),$=g3($,J),p("caret",$),$=v3($,J),p("tildes",$),$=u3($,J),p("xrange",$),$=m3($,J),p("stars",$),$},F0=($)=>!$||$.toLowerCase()==="x"||$==="*",v3=($,J)=>{return $.trim().split(/\s+/).map((Q)=>h3(Q,J)).join(" ")},h3=($,J)=>{let Q=J.loose?V0[D0.TILDELOOSE]:V0[D0.TILDE];return $.replace(Q,(W,H,X,q,Y)=>{p("tilde",$,W,H,X,q,Y);let G;if(F0(H))G="";else if(F0(X))G=`>=${H}.0.0 <${+H+1}.0.0-0`;else if(F0(q))G=`>=${H}.${X}.0 <${H}.${+X+1}.0-0`;else if(Y)p("replaceTilde pr",Y),G=`>=${H}.${X}.${q}-${Y} <${H}.${+X+1}.0-0`;else G=`>=${H}.${X}.${q} <${H}.${+X+1}.0-0`;return p("tilde return",G),G})},g3=($,J)=>{return $.trim().split(/\s+/).map((Q)=>y3(Q,J)).join(" ")},y3=($,J)=>{p("caret",$,J);let Q=J.loose?V0[D0.CARETLOOSE]:V0[D0.CARET],W=J.includePrerelease?"-0":"";return $.replace(Q,(H,X,q,Y,G)=>{p("caret",$,H,X,q,Y,G);let B;if(F0(X))B="";else if(F0(q))B=`>=${X}.0.0${W} <${+X+1}.0.0-0`;else if(F0(Y))if(X==="0")B=`>=${X}.${q}.0${W} <${X}.${+q+1}.0-0`;else B=`>=${X}.${q}.0${W} <${+X+1}.0.0-0`;else if(G)if(p("replaceCaret pr",G),X==="0")if(q==="0")B=`>=${X}.${q}.${Y}-${G} <${X}.${q}.${+Y+1}-0`;else B=`>=${X}.${q}.${Y}-${G} <${X}.${+q+1}.0-0`;else B=`>=${X}.${q}.${Y}-${G} <${+X+1}.0.0-0`;else if(p("no pr"),X==="0")if(q==="0")B=`>=${X}.${q}.${Y}${W} <${X}.${q}.${+Y+1}-0`;else B=`>=${X}.${q}.${Y}${W} <${X}.${+q+1}.0-0`;else B=`>=${X}.${q}.${Y} <${+X+1}.0.0-0`;return p("caret return",B),B})},u3=($,J)=>{return p("replaceXRanges",$,J),$.split(/\s+/).map((Q)=>l3(Q,J)).join(" ")},l3=($,J)=>{$=$.trim();let Q=J.loose?V0[D0.XRANGELOOSE]:V0[D0.XRANGE];return $.replace(Q,(W,H,X,q,Y,G)=>{p("xRange",$,W,H,X,q,Y,G);let B=F0(X),w=B||F0(q),_=w||F0(Y),R=_;if(H==="="&&R)H="";if(G=J.includePrerelease?"-0":"",B)if(H===">"||H==="<")W="<0.0.0-0";else W="*";else if(H&&R){if(w)q=0;if(Y=0,H===">")if(H=">=",w)X=+X+1,q=0,Y=0;else q=+q+1,Y=0;else if(H==="<=")if(H="<",w)X=+X+1;else q=+q+1;if(H==="<")G="-0";W=`${H+X}.${q}.${Y}${G}`}else if(w)W=`>=${X}.0.0${G} <${+X+1}.0.0-0`;else if(_)W=`>=${X}.${q}.0${G} <${X}.${+q+1}.0-0`;return p("xRange return",W),W})},m3=($,J)=>{return p("replaceStars",$,J),$.trim().replace(V0[D0.STAR],"")},c3=($,J)=>{return p("replaceGTE0",$,J),$.trim().replace(V0[J.includePrerelease?D0.GTE0PRE:D0.GTE0],"")},n3=($)=>(J,Q,W,H,X,q,Y,G,B,w,_,R)=>{if(F0(W))Q="";else if(F0(H))Q=`>=${W}.0.0${$?"-0":""}`;else if(F0(X))Q=`>=${W}.${H}.0${$?"-0":""}`;else if(q)Q=`>=${Q}`;else Q=`>=${Q}${$?"-0":""}`;if(F0(B))G="";else if(F0(w))G=`<${+B+1}.0.0-0`;else if(F0(_))G=`<${B}.${+w+1}.0-0`;else if(R)G=`<=${B}.${w}.${_}-${R}`;else if($)G=`<${B}.${w}.${+_+1}-0`;else G=`<=${G}`;return`${Q} ${G}`.trim()},d3=($,J,Q)=>{for(let W=0;W<$.length;W++)if(!$[W].test(J))return!1;if(J.prerelease.length&&!Q.includePrerelease){for(let W=0;W<$.length;W++){if(p($[W].semver),$[W].semver===L8.ANY)continue;if($[W].semver.prerelease.length>0){let H=$[W].semver;if(H.major===J.major&&H.minor===J.minor&&H.patch===J.patch)return!0}}return!1}return!0}});var l$=A((rN,W7)=>{var m$=Symbol("SemVer ANY");class t6{static get ANY(){return m$}constructor($,J){if(J=aJ(J),$ instanceof t6)if($.loose===!!J.loose)return $;else $=$.value;if($=$.trim().split(/\s+/).join(" "),S8("comparator",$,J),this.options=J,this.loose=!!J.loose,this.parse($),this.semver===m$)this.value="";else this.value=this.operator+this.semver.version;S8("comp",this)}parse($){let J=this.options.loose?eJ[$7.COMPARATORLOOSE]:eJ[$7.COMPARATOR],Q=$.match(J);if(!Q)throw TypeError(`Invalid comparator: ${$}`);if(this.operator=Q[1]!==void 0?Q[1]:"",this.operator==="=")this.operator="";if(!Q[2])this.semver=m$;else this.semver=new J7(Q[2],this.options.loose)}toString(){return this.value}test($){if(S8("Comparator.test",$,this.options.loose),this.semver===m$||$===m$)return!0;if(typeof $==="string")try{$=new J7($,this.options)}catch(J){return!1}return j8($,this.operator,this.semver,this.options)}intersects($,J){if(!($ instanceof t6))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new Q7($.value,J).test(this.value)}else if($.operator===""){if($.value==="")return!0;return new Q7(this.value,J).test($.semver)}if(J=aJ(J),J.includePrerelease&&(this.value==="<0.0.0-0"||$.value==="<0.0.0-0"))return!1;if(!J.includePrerelease&&(this.value.startsWith("<0.0.0")||$.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&$.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&$.operator.startsWith("<"))return!0;if(this.semver.version===$.semver.version&&this.operator.includes("=")&&$.operator.includes("="))return!0;if(j8(this.semver,"<",$.semver,J)&&this.operator.startsWith(">")&&$.operator.startsWith("<"))return!0;if(j8(this.semver,">",$.semver,J)&&this.operator.startsWith("<")&&$.operator.startsWith(">"))return!0;return!1}}W7.exports=t6;var aJ=u6(),{safeRe:eJ,t:$7}=e1(),j8=N8(),S8=g$(),J7=w0(),Q7=A0()});var c$=A((tN,H7)=>{var i3=A0(),p3=($,J,Q)=>{try{J=new i3(J,Q)}catch(W){return!1}return J.test($)};H7.exports=p3});var q7=A((aN,X7)=>{var s3=A0(),o3=($,J)=>new s3($,J).set.map((Q)=>Q.map((W)=>W.value).join(" ").trim().split(" "));X7.exports=o3});var G7=A((eN,Y7)=>{var r3=w0(),t3=A0(),a3=($,J,Q)=>{let W=null,H=null,X=null;try{X=new t3(J,Q)}catch(q){return null}return $.forEach((q)=>{if(X.test(q)){if(!W||H.compare(q)===-1)W=q,H=new r3(W,Q)}}),W};Y7.exports=a3});var w7=A(($L,B7)=>{var e3=w0(),$Y=A0(),JY=($,J,Q)=>{let W=null,H=null,X=null;try{X=new $Y(J,Q)}catch(q){return null}return $.forEach((q)=>{if(X.test(q)){if(!W||H.compare(q)===1)W=q,H=new e3(W,Q)}}),W};B7.exports=JY});var _7=A((JL,U7)=>{var A8=w0(),QY=A0(),D7=y$(),WY=($,J)=>{$=new QY($,J);let Q=new A8("0.0.0");if($.test(Q))return Q;if(Q=new A8("0.0.0-0"),$.test(Q))return Q;Q=null;for(let W=0;W<$.set.length;++W){let H=$.set[W],X=null;if(H.forEach((q)=>{let Y=new A8(q.semver.version);switch(q.operator){case">":if(Y.prerelease.length===0)Y.patch++;else Y.prerelease.push(0);Y.raw=Y.format();case"":case">=":if(!X||D7(Y,X))X=Y;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${q.operator}`)}}),X&&(!Q||D7(Q,X)))Q=X}if(Q&&$.test(Q))return Q;return null};U7.exports=WY});var F7=A((QL,V7)=>{var HY=A0(),XY=($,J)=>{try{return new HY($,J).range||"*"}catch(Q){return null}};V7.exports=XY});var a6=A((WL,j7)=>{var qY=w0(),L7=l$(),{ANY:YY}=L7,GY=A0(),BY=c$(),z7=y$(),N7=i6(),wY=s6(),DY=p6(),UY=($,J,Q,W)=>{$=new qY($,W),J=new GY(J,W);let H,X,q,Y,G;switch(Q){case">":H=z7,X=wY,q=N7,Y=">",G=">=";break;case"<":H=N7,X=DY,q=z7,Y="<",G="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(BY($,J,W))return!1;for(let B=0;B<J.set.length;++B){let w=J.set[B],_=null,R=null;if(w.forEach((S)=>{if(S.semver===YY)S=new L7(">=0.0.0");if(_=_||S,R=R||S,H(S.semver,_.semver,W))_=S;else if(q(S.semver,R.semver,W))R=S}),_.operator===Y||_.operator===G)return!1;if((!R.operator||R.operator===Y)&&X($,R.semver))return!1;else if(R.operator===G&&q($,R.semver))return!1}return!0};j7.exports=UY});var A7=A((HL,S7)=>{var _Y=a6(),VY=($,J,Q)=>_Y($,J,">",Q);S7.exports=VY});var R7=A((XL,E7)=>{var FY=a6(),zY=($,J,Q)=>FY($,J,"<",Q);E7.exports=zY});var M7=A((qL,O7)=>{var C7=A0(),NY=($,J,Q)=>{return $=new C7($,Q),J=new C7(J,Q),$.intersects(J,Q)};O7.exports=NY});var P7=A((YL,b7)=>{var LY=c$(),jY=S0();b7.exports=($,J,Q)=>{let W=[],H=null,X=null,q=$.sort((w,_)=>jY(w,_,Q));for(let w of q)if(LY(w,J,Q)){if(X=w,!H)H=w}else{if(X)W.push([H,X]);X=null,H=null}if(H)W.push([H,null]);let Y=[];for(let[w,_]of W)if(w===_)Y.push(w);else if(!_&&w===q[0])Y.push("*");else if(!_)Y.push(`>=${w}`);else if(w===q[0])Y.push(`<=${_}`);else Y.push(`${w} - ${_}`);let G=Y.join(" || "),B=typeof J.raw==="string"?J.raw:String(J);return G.length<B.length?G:J}});var T7=A((GL,f7)=>{var Z7=A0(),R8=l$(),{ANY:E8}=R8,n$=c$(),C8=S0(),SY=($,J,Q={})=>{if($===J)return!0;$=new Z7($,Q),J=new Z7(J,Q);let W=!1;$:for(let H of $.set){for(let X of J.set){let q=EY(H,X,Q);if(W=W||q!==null,q)continue $}if(W)return!1}return!0},AY=[new R8(">=0.0.0-0")],I7=[new R8(">=0.0.0")],EY=($,J,Q)=>{if($===J)return!0;if($.length===1&&$[0].semver===E8)if(J.length===1&&J[0].semver===E8)return!0;else if(Q.includePrerelease)$=AY;else $=I7;if(J.length===1&&J[0].semver===E8)if(Q.includePrerelease)return!0;else J=I7;let W=new Set,H,X;for(let S of $)if(S.operator===">"||S.operator===">=")H=k7(H,S,Q);else if(S.operator==="<"||S.operator==="<=")X=K7(X,S,Q);else W.add(S.semver);if(W.size>1)return null;let q;if(H&&X){if(q=C8(H.semver,X.semver,Q),q>0)return null;else if(q===0&&(H.operator!==">="||X.operator!=="<="))return null}for(let S of W){if(H&&!n$(S,String(H),Q))return null;if(X&&!n$(S,String(X),Q))return null;for(let P of J)if(!n$(S,String(P),Q))return!1;return!0}let Y,G,B,w,_=X&&!Q.includePrerelease&&X.semver.prerelease.length?X.semver:!1,R=H&&!Q.includePrerelease&&H.semver.prerelease.length?H.semver:!1;if(_&&_.prerelease.length===1&&X.operator==="<"&&_.prerelease[0]===0)_=!1;for(let S of J){if(w=w||S.operator===">"||S.operator===">=",B=B||S.operator==="<"||S.operator==="<=",H){if(R){if(S.semver.prerelease&&S.semver.prerelease.length&&S.semver.major===R.major&&S.semver.minor===R.minor&&S.semver.patch===R.patch)R=!1}if(S.operator===">"||S.operator===">="){if(Y=k7(H,S,Q),Y===S&&Y!==H)return!1}else if(H.operator===">="&&!n$(H.semver,String(S),Q))return!1}if(X){if(_){if(S.semver.prerelease&&S.semver.prerelease.length&&S.semver.major===_.major&&S.semver.minor===_.minor&&S.semver.patch===_.patch)_=!1}if(S.operator==="<"||S.operator==="<="){if(G=K7(X,S,Q),G===S&&G!==X)return!1}else if(X.operator==="<="&&!n$(X.semver,String(S),Q))return!1}if(!S.operator&&(X||H)&&q!==0)return!1}if(H&&B&&!X&&q!==0)return!1;if(X&&w&&!H&&q!==0)return!1;if(R||_)return!1;return!0},k7=($,J,Q)=>{if(!$)return J;let W=C8($.semver,J.semver,Q);return W>0?$:W<0?J:J.operator===">"&&$.operator===">="?J:$},K7=($,J,Q)=>{if(!$)return J;let W=C8($.semver,J.semver,Q);return W<0?$:W>0?J:J.operator==="<"&&$.operator==="<="?J:$};f7.exports=SY});var e6=A((BL,h7)=>{var O8=e1(),x7=h$(),RY=w0(),v7=_8(),CY=j1(),OY=YJ(),MY=BJ(),bY=UJ(),PY=FJ(),ZY=NJ(),IY=jJ(),kY=AJ(),KY=RJ(),fY=S0(),TY=bJ(),xY=ZJ(),vY=d6(),hY=fJ(),gY=xJ(),yY=y$(),uY=i6(),lY=F8(),mY=z8(),cY=p6(),nY=s6(),dY=N8(),iY=nJ(),pY=l$(),sY=A0(),oY=c$(),rY=q7(),tY=G7(),aY=w7(),eY=_7(),$G=F7(),JG=a6(),QG=A7(),WG=R7(),HG=M7(),XG=P7(),qG=T7();h7.exports={parse:CY,valid:OY,clean:MY,inc:bY,diff:PY,major:ZY,minor:IY,patch:kY,prerelease:KY,compare:fY,rcompare:TY,compareLoose:xY,compareBuild:vY,sort:hY,rsort:gY,gt:yY,lt:uY,eq:lY,neq:mY,gte:cY,lte:nY,cmp:dY,coerce:iY,Comparator:pY,Range:sY,satisfies:oY,toComparators:rY,maxSatisfying:tY,minSatisfying:aY,minVersion:eY,validRange:$G,outside:JG,gtr:QG,ltr:WG,intersects:HG,simplifyRange:XG,subset:qG,SemVer:RY,re:O8.re,src:O8.src,tokens:O8.t,SEMVER_SPEC_VERSION:x7.SEMVER_SPEC_VERSION,RELEASE_TYPES:x7.RELEASE_TYPES,compareIdentifiers:v7.compareIdentifiers,rcompareIdentifiers:v7.rcompareIdentifiers}});var y7=A((wL,g7)=>{var YG=e6();g7.exports=YG.satisfies(process.version,">=15.7.0")});var l7=A((DL,u7)=>{var GG=e6();u7.exports=GG.satisfies(process.version,">=16.9.0")});var M8=A((UL,m7)=>{var BG=y7(),wG=l7(),DG={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},UG={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};m7.exports=function($,J){if(!$||!J)return;let Q=J.asymmetricKeyType;if(!Q)return;let W=DG[Q];if(!W)throw Error(`Unknown key type "${Q}".`);if(!W.includes($))throw Error(`"alg" parameter for "${Q}" key type must be one of: ${W.join(", ")}.`);if(BG)switch(Q){case"ec":let H=J.asymmetricKeyDetails.namedCurve,X=UG[$];if(H!==X)throw Error(`"alg" parameter "${$}" requires curve "${X}".`);break;case"rsa-pss":if(wG){let q=parseInt($.slice(-3),10),{hashAlgorithm:Y,mgf1HashAlgorithm:G,saltLength:B}=J.asymmetricKeyDetails;if(Y!==`sha${q}`||G!==Y)throw Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${$}.`);if(B!==void 0&&B>q>>3)throw Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${$}.`)}break}}});var b8=A((_L,c7)=>{var _G=e6();c7.exports=_G.satisfies(process.version,"^6.12.0 || >=8.0.0")});var i7=A((VL,d7)=>{var d=v$(),VG=G8(),n7=B8(),FG=Y8(),zG=w8(),NG=M8(),LG=b8(),jG=x6(),{KeyObject:SG,createSecretKey:AG,createPublicKey:EG}=require("crypto"),P8=["RS256","RS384","RS512"],RG=["ES256","ES384","ES512"],Z8=["RS256","RS384","RS512"],CG=["HS256","HS384","HS512"];if(LG)P8.splice(P8.length,0,"PS256","PS384","PS512"),Z8.splice(Z8.length,0,"PS256","PS384","PS512");d7.exports=function($,J,Q,W){if(typeof Q==="function"&&!W)W=Q,Q={};if(!Q)Q={};Q=Object.assign({},Q);let H;if(W)H=W;else H=function(w,_){if(w)throw w;return _};if(Q.clockTimestamp&&typeof Q.clockTimestamp!=="number")return H(new d("clockTimestamp must be a number"));if(Q.nonce!==void 0&&(typeof Q.nonce!=="string"||Q.nonce.trim()===""))return H(new d("nonce must be a non-empty string"));if(Q.allowInvalidAsymmetricKeyTypes!==void 0&&typeof Q.allowInvalidAsymmetricKeyTypes!=="boolean")return H(new d("allowInvalidAsymmetricKeyTypes must be a boolean"));let X=Q.clockTimestamp||Math.floor(Date.now()/1000);if(!$)return H(new d("jwt must be provided"));if(typeof $!=="string")return H(new d("jwt must be a string"));let q=$.split(".");if(q.length!==3)return H(new d("jwt malformed"));let Y;try{Y=FG($,{complete:!0})}catch(w){return H(w)}if(!Y)return H(new d("invalid token"));let G=Y.header,B;if(typeof J==="function"){if(!W)return H(new d("verify must be called asynchronous if secret or public key is provided as a callback"));B=J}else B=function(w,_){return _(null,J)};return B(G,function(w,_){if(w)return H(new d("error in secret or public key callback: "+w.message));let R=q[2].trim()!=="";if(!R&&_)return H(new d("jwt signature is required"));if(R&&!_)return H(new d("secret or public key must be provided"));if(!R&&!Q.algorithms)return H(new d('please specify "none" in "algorithms" to verify unsigned tokens'));if(_!=null&&!(_ instanceof SG))try{_=EG(_)}catch(h){try{_=AG(typeof _==="string"?Buffer.from(_):_)}catch(o){return H(new d("secretOrPublicKey is not valid key material"))}}if(!Q.algorithms)if(_.type==="secret")Q.algorithms=CG;else if(["rsa","rsa-pss"].includes(_.asymmetricKeyType))Q.algorithms=Z8;else if(_.asymmetricKeyType==="ec")Q.algorithms=RG;else Q.algorithms=P8;if(Q.algorithms.indexOf(Y.header.alg)===-1)return H(new d("invalid algorithm"));if(G.alg.startsWith("HS")&&_.type!=="secret")return H(new d(`secretOrPublicKey must be a symmetric key when using ${G.alg}`));else if(/^(?:RS|PS|ES)/.test(G.alg)&&_.type!=="public")return H(new d(`secretOrPublicKey must be an asymmetric key when using ${G.alg}`));if(!Q.allowInvalidAsymmetricKeyTypes)try{NG(G.alg,_)}catch(h){return H(h)}let S;try{S=jG.verify($,Y.header.alg,_)}catch(h){return H(h)}if(!S)return H(new d("invalid signature"));let P=Y.payload;if(typeof P.nbf<"u"&&!Q.ignoreNotBefore){if(typeof P.nbf!=="number")return H(new d("invalid nbf value"));if(P.nbf>X+(Q.clockTolerance||0))return H(new VG("jwt not active",new Date(P.nbf*1000)))}if(typeof P.exp<"u"&&!Q.ignoreExpiration){if(typeof P.exp!=="number")return H(new d("invalid exp value"));if(X>=P.exp+(Q.clockTolerance||0))return H(new n7("jwt expired",new Date(P.exp*1000)))}if(Q.audience){let h=Array.isArray(Q.audience)?Q.audience:[Q.audience];if(!(Array.isArray(P.aud)?P.aud:[P.aud]).some(function(z0){return h.some(function(t){return t instanceof RegExp?t.test(z0):t===z0})}))return H(new d("jwt audience invalid. expected: "+h.join(" or ")))}if(Q.issuer){if(typeof Q.issuer==="string"&&P.iss!==Q.issuer||Array.isArray(Q.issuer)&&Q.issuer.indexOf(P.iss)===-1)return H(new d("jwt issuer invalid. expected: "+Q.issuer))}if(Q.subject){if(P.sub!==Q.subject)return H(new d("jwt subject invalid. expected: "+Q.subject))}if(Q.jwtid){if(P.jti!==Q.jwtid)return H(new d("jwt jwtid invalid. expected: "+Q.jwtid))}if(Q.nonce){if(P.nonce!==Q.nonce)return H(new d("jwt nonce invalid. expected: "+Q.nonce))}if(Q.maxAge){if(typeof P.iat!=="number")return H(new d("iat required when maxAge is specified"));let h=zG(Q.maxAge,P.iat);if(typeof h>"u")return H(new d('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(X>=h+(Q.clockTolerance||0))return H(new n7("maxAge exceeded",new Date(h*1000)))}if(Q.complete===!0){let h=Y.signature;return H(null,{header:G,payload:P,signature:h})}return H(null,P)})}});var a7=A((FL,t7)=>{var p7=1/0,o7=9007199254740991,OG=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,s7=NaN,MG="[object Arguments]",bG="[object Function]",PG="[object GeneratorFunction]",ZG="[object String]",IG="[object Symbol]",kG=/^\s+|\s+$/g,KG=/^[-+]0x[0-9a-f]+$/i,fG=/^0b[01]+$/i,TG=/^0o[0-7]+$/i,xG=/^(?:0|[1-9]\d*)$/,vG=parseInt;function hG($,J){var Q=-1,W=$?$.length:0,H=Array(W);while(++Q<W)H[Q]=J($[Q],Q,$);return H}function gG($,J,Q,W){var H=$.length,X=Q+(W?1:-1);while(W?X--:++X<H)if(J($[X],X,$))return X;return-1}function yG($,J,Q){if(J!==J)return gG($,uG,Q);var W=Q-1,H=$.length;while(++W<H)if($[W]===J)return W;return-1}function uG($){return $!==$}function lG($,J){var Q=-1,W=Array($);while(++Q<$)W[Q]=J(Q);return W}function mG($,J){return hG(J,function(Q){return $[Q]})}function cG($,J){return function(Q){return $(J(Q))}}var $4=Object.prototype,k8=$4.hasOwnProperty,J4=$4.toString,nG=$4.propertyIsEnumerable,dG=cG(Object.keys,Object),iG=Math.max;function pG($,J){var Q=r7($)||aG($)?lG($.length,String):[],W=Q.length,H=!!W;for(var X in $)if((J||k8.call($,X))&&!(H&&(X=="length"||oG(X,W))))Q.push(X);return Q}function sG($){if(!rG($))return dG($);var J=[];for(var Q in Object($))if(k8.call($,Q)&&Q!="constructor")J.push(Q);return J}function oG($,J){return J=J==null?o7:J,!!J&&(typeof $=="number"||xG.test($))&&($>-1&&$%1==0&&$<J)}function rG($){var J=$&&$.constructor,Q=typeof J=="function"&&J.prototype||$4;return $===Q}function tG($,J,Q,W){$=K8($)?$:GB($),Q=Q&&!W?XB(Q):0;var H=$.length;if(Q<0)Q=iG(H+Q,0);return QB($)?Q<=H&&$.indexOf(J,Q)>-1:!!H&&yG($,J,Q)>-1}function aG($){return eG($)&&k8.call($,"callee")&&(!nG.call($,"callee")||J4.call($)==MG)}var r7=Array.isArray;function K8($){return $!=null&&JB($.length)&&!$B($)}function eG($){return f8($)&&K8($)}function $B($){var J=I8($)?J4.call($):"";return J==bG||J==PG}function JB($){return typeof $=="number"&&$>-1&&$%1==0&&$<=o7}function I8($){var J=typeof $;return!!$&&(J=="object"||J=="function")}function f8($){return!!$&&typeof $=="object"}function QB($){return typeof $=="string"||!r7($)&&f8($)&&J4.call($)==ZG}function WB($){return typeof $=="symbol"||f8($)&&J4.call($)==IG}function HB($){if(!$)return $===0?$:0;if($=qB($),$===p7||$===-p7){var J=$<0?-1:1;return J*OG}return $===$?$:0}function XB($){var J=HB($),Q=J%1;return J===J?Q?J-Q:J:0}function qB($){if(typeof $=="number")return $;if(WB($))return s7;if(I8($)){var J=typeof $.valueOf=="function"?$.valueOf():$;$=I8(J)?J+"":J}if(typeof $!="string")return $===0?$:+$;$=$.replace(kG,"");var Q=fG.test($);return Q||TG.test($)?vG($.slice(2),Q?2:8):KG.test($)?s7:+$}function YB($){return K8($)?pG($):sG($)}function GB($){return $?mG($,YB($)):[]}t7.exports=tG});var $Q=A((zL,e7)=>{var BB="[object Boolean]",wB=Object.prototype,DB=wB.toString;function UB($){return $===!0||$===!1||_B($)&&DB.call($)==BB}function _B($){return!!$&&typeof $=="object"}e7.exports=UB});var XQ=A((NL,HQ)=>{var JQ=1/0,VB=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,QQ=NaN,FB="[object Symbol]",zB=/^\s+|\s+$/g,NB=/^[-+]0x[0-9a-f]+$/i,LB=/^0b[01]+$/i,jB=/^0o[0-7]+$/i,SB=parseInt,AB=Object.prototype,EB=AB.toString;function RB($){return typeof $=="number"&&$==bB($)}function WQ($){var J=typeof $;return!!$&&(J=="object"||J=="function")}function CB($){return!!$&&typeof $=="object"}function OB($){return typeof $=="symbol"||CB($)&&EB.call($)==FB}function MB($){if(!$)return $===0?$:0;if($=PB($),$===JQ||$===-JQ){var J=$<0?-1:1;return J*VB}return $===$?$:0}function bB($){var J=MB($),Q=J%1;return J===J?Q?J-Q:J:0}function PB($){if(typeof $=="number")return $;if(OB($))return QQ;if(WQ($)){var J=typeof $.valueOf=="function"?$.valueOf():$;$=WQ(J)?J+"":J}if(typeof $!="string")return $===0?$:+$;$=$.replace(zB,"");var Q=LB.test($);return Q||jB.test($)?SB($.slice(2),Q?2:8):NB.test($)?QQ:+$}HQ.exports=RB});var YQ=A((LL,qQ)=>{var ZB="[object Number]",IB=Object.prototype,kB=IB.toString;function KB($){return!!$&&typeof $=="object"}function fB($){return typeof $=="number"||KB($)&&kB.call($)==ZB}qQ.exports=fB});var DQ=A((jL,wQ)=>{var TB="[object Object]";function xB($){var J=!1;if($!=null&&typeof $.toString!="function")try{J=!!($+"")}catch(Q){}return J}function vB($,J){return function(Q){return $(J(Q))}}var hB=Function.prototype,GQ=Object.prototype,BQ=hB.toString,gB=GQ.hasOwnProperty,yB=BQ.call(Object),uB=GQ.toString,lB=vB(Object.getPrototypeOf,Object);function mB($){return!!$&&typeof $=="object"}function cB($){if(!mB($)||uB.call($)!=TB||xB($))return!1;var J=lB($);if(J===null)return!0;var Q=gB.call(J,"constructor")&&J.constructor;return typeof Q=="function"&&Q instanceof Q&&BQ.call(Q)==yB}wQ.exports=cB});var _Q=A((SL,UQ)=>{var nB="[object String]",dB=Object.prototype,iB=dB.toString,pB=Array.isArray;function sB($){return!!$&&typeof $=="object"}function oB($){return typeof $=="string"||!pB($)&&sB($)&&iB.call($)==nB}UQ.exports=oB});var LQ=A((AL,NQ)=>{var rB="Expected a function",VQ=1/0,tB=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,FQ=NaN,aB="[object Symbol]",eB=/^\s+|\s+$/g,$w=/^[-+]0x[0-9a-f]+$/i,Jw=/^0b[01]+$/i,Qw=/^0o[0-7]+$/i,Ww=parseInt,Hw=Object.prototype,Xw=Hw.toString;function qw($,J){var Q;if(typeof J!="function")throw TypeError(rB);return $=Dw($),function(){if(--$>0)Q=J.apply(this,arguments);if($<=1)J=void 0;return Q}}function Yw($){return qw(2,$)}function zQ($){var J=typeof $;return!!$&&(J=="object"||J=="function")}function Gw($){return!!$&&typeof $=="object"}function Bw($){return typeof $=="symbol"||Gw($)&&Xw.call($)==aB}function ww($){if(!$)return $===0?$:0;if($=Uw($),$===VQ||$===-VQ){var J=$<0?-1:1;return J*tB}return $===$?$:0}function Dw($){var J=ww($),Q=J%1;return J===J?Q?J-Q:J:0}function Uw($){if(typeof $=="number")return $;if(Bw($))return FQ;if(zQ($)){var J=typeof $.valueOf=="function"?$.valueOf():$;$=zQ(J)?J+"":J}if(typeof $!="string")return $===0?$:+$;$=$.replace(eB,"");var Q=Jw.test($);return Q||Qw.test($)?Ww($.slice(2),Q?2:8):$w.test($)?FQ:+$}NQ.exports=Yw});var bQ=A((EL,MQ)=>{var jQ=w8(),_w=b8(),Vw=M8(),SQ=x6(),Fw=a7(),Q4=$Q(),AQ=XQ(),T8=YQ(),RQ=DQ(),J1=_Q(),zw=LQ(),{KeyObject:Nw,createSecretKey:Lw,createPrivateKey:jw}=require("crypto"),CQ=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];if(_w)CQ.splice(3,0,"PS256","PS384","PS512");var Sw={expiresIn:{isValid:function($){return AQ($)||J1($)&&$},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function($){return AQ($)||J1($)&&$},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function($){return J1($)||Array.isArray($)},message:'"audience" must be a string or array'},algorithm:{isValid:Fw.bind(null,CQ),message:'"algorithm" must be a valid string enum value'},header:{isValid:RQ,message:'"header" must be an object'},encoding:{isValid:J1,message:'"encoding" must be a string'},issuer:{isValid:J1,message:'"issuer" must be a string'},subject:{isValid:J1,message:'"subject" must be a string'},jwtid:{isValid:J1,message:'"jwtid" must be a string'},noTimestamp:{isValid:Q4,message:'"noTimestamp" must be a boolean'},keyid:{isValid:J1,message:'"keyid" must be a string'},mutatePayload:{isValid:Q4,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:Q4,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:Q4,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},Aw={iat:{isValid:T8,message:'"iat" should be a number of seconds'},exp:{isValid:T8,message:'"exp" should be a number of seconds'},nbf:{isValid:T8,message:'"nbf" should be a number of seconds'}};function OQ($,J,Q,W){if(!RQ(Q))throw Error('Expected "'+W+'" to be a plain object.');Object.keys(Q).forEach(function(H){let X=$[H];if(!X){if(!J)throw Error('"'+H+'" is not allowed in "'+W+'"');return}if(!X.isValid(Q[H]))throw Error(X.message)})}function Ew($){return OQ(Sw,!1,$,"options")}function Rw($){return OQ(Aw,!0,$,"payload")}var EQ={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},Cw=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];MQ.exports=function($,J,Q,W){if(typeof Q==="function")W=Q,Q={};else Q=Q||{};let H=typeof $==="object"&&!Buffer.isBuffer($),X=Object.assign({alg:Q.algorithm||"HS256",typ:H?"JWT":void 0,kid:Q.keyid},Q.header);function q(B){if(W)return W(B);throw B}if(!J&&Q.algorithm!=="none")return q(Error("secretOrPrivateKey must have a value"));if(J!=null&&!(J instanceof Nw))try{J=jw(J)}catch(B){try{J=Lw(typeof J==="string"?Buffer.from(J):J)}catch(w){return q(Error("secretOrPrivateKey is not valid key material"))}}if(X.alg.startsWith("HS")&&J.type!=="secret")return q(Error(`secretOrPrivateKey must be a symmetric key when using ${X.alg}`));else if(/^(?:RS|PS|ES)/.test(X.alg)){if(J.type!=="private")return q(Error(`secretOrPrivateKey must be an asymmetric key when using ${X.alg}`));if(!Q.allowInsecureKeySizes&&!X.alg.startsWith("ES")&&J.asymmetricKeyDetails!==void 0&&J.asymmetricKeyDetails.modulusLength<2048)return q(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${X.alg}`))}if(typeof $>"u")return q(Error("payload is required"));else if(H){try{Rw($)}catch(B){return q(B)}if(!Q.mutatePayload)$=Object.assign({},$)}else{let B=Cw.filter(function(w){return typeof Q[w]<"u"});if(B.length>0)return q(Error("invalid "+B.join(",")+" option for "+typeof $+" payload"))}if(typeof $.exp<"u"&&typeof Q.expiresIn<"u")return q(Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(typeof $.nbf<"u"&&typeof Q.notBefore<"u")return q(Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{Ew(Q)}catch(B){return q(B)}if(!Q.allowInvalidAsymmetricKeyTypes)try{Vw(X.alg,J)}catch(B){return q(B)}let Y=$.iat||Math.floor(Date.now()/1000);if(Q.noTimestamp)delete $.iat;else if(H)$.iat=Y;if(typeof Q.notBefore<"u"){try{$.nbf=jQ(Q.notBefore,Y)}catch(B){return q(B)}if(typeof $.nbf>"u")return q(Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(typeof Q.expiresIn<"u"&&typeof $==="object"){try{$.exp=jQ(Q.expiresIn,Y)}catch(B){return q(B)}if(typeof $.exp>"u")return q(Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(EQ).forEach(function(B){let w=EQ[B];if(typeof Q[B]<"u"){if(typeof $[w]<"u")return q(Error('Bad "options.'+B+'" option. The payload already has an "'+w+'" property.'));$[w]=Q[B]}});let G=Q.encoding||"utf8";if(typeof W==="function")W=W&&zw(W),SQ.createSign({header:X,privateKey:J,payload:$,encoding:G}).once("error",W).once("done",function(B){if(!Q.allowInsecureKeySizes&&/^(?:RS|PS)/.test(X.alg)&&B.length<256)return W(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${X.alg}`));W(null,B)});else{let B=SQ.sign({header:X,payload:$,secret:J,encoding:G});if(!Q.allowInsecureKeySizes&&/^(?:RS|PS)/.test(X.alg)&&B.length<256)throw Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${X.alg}`);return B}}});var ZQ=A((RL,PQ)=>{PQ.exports={decode:Y8(),verify:i7(),sign:bQ(),JsonWebTokenError:v$(),NotBeforeError:G8(),TokenExpiredError:B8()}});var EW={};L0(EW,{createRateLimitMiddleware:()=>Y$,createCorsMiddleware:()=>q$,createCompressionMiddleware:()=>G$});module.exports=M0(EW);function q$($){let{origin:J="*",methods:Q=["GET","POST","PUT","DELETE","PATCH","OPTIONS"],allowedHeaders:W=["Content-Type","Authorization"],exposedHeaders:H=[],credentials:X=!1,maxAge:q=86400}=$||{};return async(Y,G)=>{let B=Y.req.header("origin"),w=Y.req.method,_=null;if(typeof J==="string")_=J;else if(Array.isArray(J)){if(B&&J.includes(B))_=B}else if(typeof J==="function"){if(B&&J(B))_=B}if(_)Y.header("Access-Control-Allow-Origin",_);if(X)Y.header("Access-Control-Allow-Credentials","true");if(H.length>0)Y.header("Access-Control-Expose-Headers",H.join(", "));if(w==="OPTIONS")return Y.header("Access-Control-Allow-Methods",Q.join(", ")),Y.header("Access-Control-Allow-Headers",W.join(", ")),Y.header("Access-Control-Max-Age",q.toString()),Y.body(null,204);await G()}}function Y$($){let{windowMs:J=60000,max:Q=100,keyGenerator:W=(q)=>{return q.req.header("x-forwarded-for")||q.req.header("x-real-ip")||"unknown"}}=$,H=new Map,X=setInterval(()=>{let q=Date.now();for(let[Y,G]of H.entries())if(q>G.resetTime)H.delete(Y)},J);if(typeof process<"u"&&process.on)process.on("exit",()=>clearInterval(X));return async(q,Y)=>{let G=W(q),B=Date.now(),w=H.get(G);if(!w||B>w.resetTime)H.set(G,{count:1,resetTime:B+J}),q.header("X-RateLimit-Limit",Q.toString()),q.header("X-RateLimit-Remaining",(Q-1).toString()),q.header("X-RateLimit-Reset",new Date(B+J).toISOString()),await Y();else if(w.count<Q)w.count++,q.header("X-RateLimit-Limit",Q.toString()),q.header("X-RateLimit-Remaining",(Q-w.count).toString()),q.header("X-RateLimit-Reset",new Date(w.resetTime).toISOString()),await Y();else{let _=Math.ceil((w.resetTime-B)/1000);return q.header("X-RateLimit-Limit",Q.toString()),q.header("X-RateLimit-Remaining","0"),q.header("X-RateLimit-Reset",new Date(w.resetTime).toISOString()),q.header("Retry-After",_.toString()),q.json({error:"Too Many Requests",message:`Rate limit exceeded. Please try again in ${_} seconds.`,retryAfter:_},429)}}}function G$($){let{threshold:J=1024,level:Q=6}=$||{};return async(W,H)=>{await H();let X=W.res;if(!X)return;let q=X.headers.get("content-type")||"",Y=X.headers.get("content-length"),G=W.req.header("accept-encoding")||"";if(!["text/","application/json","application/javascript","application/xml","application/x-www-form-urlencoded"].some((P)=>q.toLowerCase().includes(P)))return;if(Y&&parseInt(Y)<J)return;if(X.headers.get("content-encoding"))return;let _=await X.arrayBuffer();if(_.byteLength<J)return;let R=null,S=null;if(G.includes("br")&&typeof CompressionStream<"u")try{let P=new CompressionStream("deflate"),h=P.writable.getWriter();h.write(new Uint8Array(_)),h.close();let o=P.readable.getReader(),W0=[];while(!0){let{done:H0,value:U0}=await o.read();if(H0)break;W0.push(U0)}let z0=W0.reduce((H0,U0)=>H0+U0.length,0),t=new Uint8Array(z0),R0=0;for(let H0 of W0)t.set(H0,R0),R0+=H0.length;R=t,S="deflate"}catch(P){R=null}if(!R&&G.includes("gzip")&&typeof CompressionStream<"u")try{let P=new CompressionStream("gzip"),h=P.writable.getWriter();h.write(new Uint8Array(_)),h.close();let o=P.readable.getReader(),W0=[];while(!0){let{done:H0,value:U0}=await o.read();if(H0)break;W0.push(U0)}let z0=W0.reduce((H0,U0)=>H0+U0.length,0),t=new Uint8Array(z0),R0=0;for(let H0 of W0)t.set(H0,R0),R0+=H0.length;R=t,S="gzip"}catch(P){R=null}if(R&&S&&R.byteLength<_.byteLength){let P=new Headers(X.headers);return P.set("content-encoding",S),P.set("content-length",R.byteLength.toString()),P.delete("content-length"),new Response(R,{status:X.status,statusText:X.statusText,headers:P})}}}var lH={};L0(lH,{zodToJsonSchema:()=>Q6,ZodToJsonSchemaConverter:()=>p0,OpenAPIGenerator:()=>B1});module.exports=M0(lH);var D2=Symbol("Let zodToJsonSchema decide on which parser to use");var w2={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},U2=($)=>typeof $==="string"?{...w2,name:$}:{...w2,...$};var _2=($)=>{let J=U2($),Q=J.name!==void 0?[...J.basePath,J.definitionPath,J.name]:J.basePath;return{...J,flags:{hasReferencedOpenAiAnyType:!1},currentPath:Q,propertyPath:void 0,seen:new Map(Object.entries(J.definitions).map(([W,H])=>[H._def,{def:H._def,path:[...J.basePath,J.definitionPath,W],jsonSchema:void 0}]))}};function w4($,J,Q,W){if(!W?.errorMessages)return;if(Q)$.errorMessage={...$.errorMessage,[J]:Q}}function n($,J,Q,W,H){$[J]=Q,w4($,J,W,H)}var p$=($,J)=>{let Q=0;for(;Q<$.length&&Q<J.length;Q++)if($[Q]!==J[Q])break;return[($.length-Q).toString(),...J.slice(Q)].join("/")};var z={};L0(z,{void:()=>qH,util:()=>m,unknown:()=>HH,union:()=>wH,undefined:()=>JH,tuple:()=>_H,transformer:()=>RH,symbol:()=>$H,string:()=>E2,strictObject:()=>BH,setErrorMap:()=>OW,set:()=>zH,record:()=>VH,quotelessJson:()=>RW,promise:()=>EH,preprocess:()=>MH,pipeline:()=>bH,ostring:()=>PH,optional:()=>CH,onumber:()=>ZH,oboolean:()=>IH,objectUtil:()=>D4,object:()=>GH,number:()=>R2,nullable:()=>OH,null:()=>QH,never:()=>XH,nativeEnum:()=>AH,nan:()=>tW,map:()=>FH,makeIssue:()=>B$,literal:()=>jH,lazy:()=>LH,late:()=>oW,isValid:()=>s0,isDirty:()=>o$,isAsync:()=>R1,isAborted:()=>s$,intersection:()=>UH,instanceof:()=>rW,getParsedType:()=>y0,getErrorMap:()=>E1,function:()=>NH,enum:()=>SH,effect:()=>RH,discriminatedUnion:()=>DH,defaultErrorMap:()=>n0,datetimeRegex:()=>j2,date:()=>eW,custom:()=>A2,coerce:()=>kH,boolean:()=>C2,bigint:()=>aW,array:()=>YH,any:()=>WH,addIssueToContext:()=>E,ZodVoid:()=>D$,ZodUnknown:()=>o0,ZodUnion:()=>Z1,ZodUndefined:()=>b1,ZodType:()=>u,ZodTuple:()=>l0,ZodTransformer:()=>k0,ZodSymbol:()=>w$,ZodString:()=>b0,ZodSet:()=>Y1,ZodSchema:()=>u,ZodRecord:()=>U$,ZodReadonly:()=>v1,ZodPromise:()=>G1,ZodPipeline:()=>F$,ZodParsedType:()=>L,ZodOptional:()=>Z0,ZodObject:()=>r,ZodNumber:()=>r0,ZodNullable:()=>i0,ZodNull:()=>P1,ZodNever:()=>u0,ZodNativeEnum:()=>f1,ZodNaN:()=>V$,ZodMap:()=>_$,ZodLiteral:()=>K1,ZodLazy:()=>k1,ZodIssueCode:()=>F,ZodIntersection:()=>I1,ZodFunction:()=>O1,ZodFirstPartyTypeKind:()=>N,ZodError:()=>X0,ZodEnum:()=>a0,ZodEffects:()=>k0,ZodDiscriminatedUnion:()=>r$,ZodDefault:()=>T1,ZodDate:()=>X1,ZodCatch:()=>x1,ZodBranded:()=>t$,ZodBoolean:()=>M1,ZodBigInt:()=>t0,ZodArray:()=>P0,ZodAny:()=>q1,Schema:()=>u,ParseStatus:()=>q0,OK:()=>G0,NEVER:()=>KH,INVALID:()=>f,EMPTY_PATH:()=>MW,DIRTY:()=>H1,BRAND:()=>sW});var m;(function($){$.assertEqual=(H)=>{};function J(H){}$.assertIs=J;function Q(H){throw Error()}$.assertNever=Q,$.arrayToEnum=(H)=>{let X={};for(let q of H)X[q]=q;return X},$.getValidEnumValues=(H)=>{let X=$.objectKeys(H).filter((Y)=>typeof H[H[Y]]!=="number"),q={};for(let Y of X)q[Y]=H[Y];return $.objectValues(q)},$.objectValues=(H)=>{return $.objectKeys(H).map(function(X){return H[X]})},$.objectKeys=typeof Object.keys==="function"?(H)=>Object.keys(H):(H)=>{let X=[];for(let q in H)if(Object.prototype.hasOwnProperty.call(H,q))X.push(q);return X},$.find=(H,X)=>{for(let q of H)if(X(q))return q;return},$.isInteger=typeof Number.isInteger==="function"?(H)=>Number.isInteger(H):(H)=>typeof H==="number"&&Number.isFinite(H)&&Math.floor(H)===H;function W(H,X=" | "){return H.map((q)=>typeof q==="string"?`'${q}'`:q).join(X)}$.joinValues=W,$.jsonStringifyReplacer=(H,X)=>{if(typeof X==="bigint")return X.toString();return X}})(m||(m={}));var D4;(function($){$.mergeShapes=(J,Q)=>{return{...J,...Q}}})(D4||(D4={}));var L=m.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),y0=($)=>{switch(typeof $){case"undefined":return L.undefined;case"string":return L.string;case"number":return Number.isNaN($)?L.nan:L.number;case"boolean":return L.boolean;case"function":return L.function;case"bigint":return L.bigint;case"symbol":return L.symbol;case"object":if(Array.isArray($))return L.array;if($===null)return L.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return L.promise;if(typeof Map<"u"&&$ instanceof Map)return L.map;if(typeof Set<"u"&&$ instanceof Set)return L.set;if(typeof Date<"u"&&$ instanceof Date)return L.date;return L.object;default:return L.unknown}};var F=m.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),RW=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")};class X0 extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(Q)=>{this.issues=[...this.issues,Q]},this.addIssues=(Q=[])=>{this.issues=[...this.issues,...Q]};let J=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,J);else this.__proto__=J;this.name="ZodError",this.issues=$}format($){let J=$||function(H){return H.message},Q={_errors:[]},W=(H)=>{for(let X of H.issues)if(X.code==="invalid_union")X.unionErrors.map(W);else if(X.code==="invalid_return_type")W(X.returnTypeError);else if(X.code==="invalid_arguments")W(X.argumentsError);else if(X.path.length===0)Q._errors.push(J(X));else{let q=Q,Y=0;while(Y<X.path.length){let G=X.path[Y];if(Y!==X.path.length-1)q[G]=q[G]||{_errors:[]};else q[G]=q[G]||{_errors:[]},q[G]._errors.push(J(X));q=q[G],Y++}}};return W(this),Q}static assert($){if(!($ instanceof X0))throw Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,m.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(J)=>J.message){let J={},Q=[];for(let W of this.issues)if(W.path.length>0){let H=W.path[0];J[H]=J[H]||[],J[H].push($(W))}else Q.push($(W));return{formErrors:Q,fieldErrors:J}}get formErrors(){return this.flatten()}}X0.create=($)=>{return new X0($)};var CW=($,J)=>{let Q;switch($.code){case F.invalid_type:if($.received===L.undefined)Q="Required";else Q=`Expected ${$.expected}, received ${$.received}`;break;case F.invalid_literal:Q=`Invalid literal value, expected ${JSON.stringify($.expected,m.jsonStringifyReplacer)}`;break;case F.unrecognized_keys:Q=`Unrecognized key(s) in object: ${m.joinValues($.keys,", ")}`;break;case F.invalid_union:Q="Invalid input";break;case F.invalid_union_discriminator:Q=`Invalid discriminator value. Expected ${m.joinValues($.options)}`;break;case F.invalid_enum_value:Q=`Invalid enum value. Expected ${m.joinValues($.options)}, received '${$.received}'`;break;case F.invalid_arguments:Q="Invalid function arguments";break;case F.invalid_return_type:Q="Invalid function return type";break;case F.invalid_date:Q="Invalid date";break;case F.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(Q=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")Q=`${Q} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)Q=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)Q=`Invalid input: must end with "${$.validation.endsWith}"`;else m.assertNever($.validation);else if($.validation!=="regex")Q=`Invalid ${$.validation}`;else Q="Invalid";break;case F.too_small:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="bigint")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else Q="Invalid input";break;case F.too_big:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")Q=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else Q="Invalid input";break;case F.custom:Q="Invalid input";break;case F.invalid_intersection_types:Q="Intersection results could not be merged";break;case F.not_multiple_of:Q=`Number must be a multiple of ${$.multipleOf}`;break;case F.not_finite:Q="Number must be finite";break;default:Q=J.defaultError,m.assertNever($)}return{message:Q}},n0=CW;var V2=n0;function OW($){V2=$}function E1(){return V2}var B$=($)=>{let{data:J,path:Q,errorMaps:W,issueData:H}=$,X=[...Q,...H.path||[]],q={...H,path:X};if(H.message!==void 0)return{...H,path:X,message:H.message};let Y="",G=W.filter((B)=>!!B).slice().reverse();for(let B of G)Y=B(q,{data:J,defaultError:Y}).message;return{...H,path:X,message:Y}},MW=[];function E($,J){let Q=E1(),W=B$({issueData:J,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,Q,Q===n0?void 0:n0].filter((H)=>!!H)});$.common.issues.push(W)}class q0{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,J){let Q=[];for(let W of J){if(W.status==="aborted")return f;if(W.status==="dirty")$.dirty();Q.push(W.value)}return{status:$.value,value:Q}}static async mergeObjectAsync($,J){let Q=[];for(let W of J){let H=await W.key,X=await W.value;Q.push({key:H,value:X})}return q0.mergeObjectSync($,Q)}static mergeObjectSync($,J){let Q={};for(let W of J){let{key:H,value:X}=W;if(H.status==="aborted")return f;if(X.status==="aborted")return f;if(H.status==="dirty")$.dirty();if(X.status==="dirty")$.dirty();if(H.value!=="__proto__"&&(typeof X.value<"u"||W.alwaysSet))Q[H.value]=X.value}return{status:$.value,value:Q}}}var f=Object.freeze({status:"aborted"}),H1=($)=>({status:"dirty",value:$}),G0=($)=>({status:"valid",value:$}),s$=($)=>$.status==="aborted",o$=($)=>$.status==="dirty",s0=($)=>$.status==="valid",R1=($)=>typeof Promise<"u"&&$ instanceof Promise;var I;(function($){$.errToObj=(J)=>typeof J==="string"?{message:J}:J||{},$.toString=(J)=>typeof J==="string"?J:J?.message})(I||(I={}));class I0{constructor($,J,Q,W){this._cachedPath=[],this.parent=$,this.data=J,this._path=Q,this._key=W}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var F2=($,J)=>{if(s0(J))return{success:!0,data:J.value};else{if(!$.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Q=new X0($.common.issues);return this._error=Q,this._error}}}};function y($){if(!$)return{};let{errorMap:J,invalid_type_error:Q,required_error:W,description:H}=$;if(J&&(Q||W))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(J)return{errorMap:J,description:H};return{errorMap:(q,Y)=>{let{message:G}=$;if(q.code==="invalid_enum_value")return{message:G??Y.defaultError};if(typeof Y.data>"u")return{message:G??W??Y.defaultError};if(q.code!=="invalid_type")return{message:Y.defaultError};return{message:G??Q??Y.defaultError}},description:H}}class u{get description(){return this._def.description}_getType($){return y0($.data)}_getOrReturnCtx($,J){return J||{common:$.parent.common,data:$.data,parsedType:y0($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new q0,ctx:{common:$.parent.common,data:$.data,parsedType:y0($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let J=this._parse($);if(R1(J))throw Error("Synchronous parse encountered promise.");return J}_parseAsync($){let J=this._parse($);return Promise.resolve(J)}parse($,J){let Q=this.safeParse($,J);if(Q.success)return Q.data;throw Q.error}safeParse($,J){let Q={common:{issues:[],async:J?.async??!1,contextualErrorMap:J?.errorMap},path:J?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:y0($)},W=this._parseSync({data:$,path:Q.path,parent:Q});return F2(Q,W)}"~validate"($){let J={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:y0($)};if(!this["~standard"].async)try{let Q=this._parseSync({data:$,path:[],parent:J});return s0(Q)?{value:Q.value}:{issues:J.common.issues}}catch(Q){if(Q?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;J.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:J}).then((Q)=>s0(Q)?{value:Q.value}:{issues:J.common.issues})}async parseAsync($,J){let Q=await this.safeParseAsync($,J);if(Q.success)return Q.data;throw Q.error}async safeParseAsync($,J){let Q={common:{issues:[],contextualErrorMap:J?.errorMap,async:!0},path:J?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:y0($)},W=this._parse({data:$,path:Q.path,parent:Q}),H=await(R1(W)?W:Promise.resolve(W));return F2(Q,H)}refine($,J){let Q=(W)=>{if(typeof J==="string"||typeof J>"u")return{message:J};else if(typeof J==="function")return J(W);else return J};return this._refinement((W,H)=>{let X=$(W),q=()=>H.addIssue({code:F.custom,...Q(W)});if(typeof Promise<"u"&&X instanceof Promise)return X.then((Y)=>{if(!Y)return q(),!1;else return!0});if(!X)return q(),!1;else return!0})}refinement($,J){return this._refinement((Q,W)=>{if(!$(Q))return W.addIssue(typeof J==="function"?J(Q,W):J),!1;else return!0})}_refinement($){return new k0({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(J)=>this["~validate"](J)}}optional(){return Z0.create(this,this._def)}nullable(){return i0.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return P0.create(this)}promise(){return G1.create(this,this._def)}or($){return Z1.create([this,$],this._def)}and($){return I1.create(this,$,this._def)}transform($){return new k0({...y(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:$}})}default($){let J=typeof $==="function"?$:()=>$;return new T1({...y(this._def),innerType:this,defaultValue:J,typeName:N.ZodDefault})}brand(){return new t$({typeName:N.ZodBranded,type:this,...y(this._def)})}catch($){let J=typeof $==="function"?$:()=>$;return new x1({...y(this._def),innerType:this,catchValue:J,typeName:N.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return F$.create(this,$)}readonly(){return v1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var bW=/^c[^\s-]{8,}$/i,PW=/^[0-9a-z]+$/,ZW=/^[0-9A-HJKMNP-TV-Z]{26}$/i,IW=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,kW=/^[a-z0-9_-]{21}$/i,KW=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,fW=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,TW=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,xW="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",U4,vW=/^(?:(?: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])$/,hW=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,gW=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,yW=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,uW=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,lW=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,N2="((\\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])))",mW=new RegExp(`^${N2}$`);function L2($){let J="[0-5]\\d";if($.precision)J=`${J}\\.\\d{${$.precision}}`;else if($.precision==null)J=`${J}(\\.\\d+)?`;let Q=$.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${J})${Q}`}function cW($){return new RegExp(`^${L2($)}$`)}function j2($){let J=`${N2}T${L2($)}`,Q=[];if(Q.push($.local?"Z?":"Z"),$.offset)Q.push("([+-]\\d{2}:?\\d{2})");return J=`${J}(${Q.join("|")})`,new RegExp(`^${J}$`)}function nW($,J){if((J==="v4"||!J)&&vW.test($))return!0;if((J==="v6"||!J)&&gW.test($))return!0;return!1}function dW($,J){if(!KW.test($))return!1;try{let[Q]=$.split(".");if(!Q)return!1;let W=Q.replace(/-/g,"+").replace(/_/g,"/").padEnd(Q.length+(4-Q.length%4)%4,"="),H=JSON.parse(atob(W));if(typeof H!=="object"||H===null)return!1;if("typ"in H&&H?.typ!=="JWT")return!1;if(!H.alg)return!1;if(J&&H.alg!==J)return!1;return!0}catch{return!1}}function iW($,J){if((J==="v4"||!J)&&hW.test($))return!0;if((J==="v6"||!J)&&yW.test($))return!0;return!1}class b0 extends u{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==L.string){let H=this._getOrReturnCtx($);return E(H,{code:F.invalid_type,expected:L.string,received:H.parsedType}),f}let Q=new q0,W=void 0;for(let H of this._def.checks)if(H.kind==="min"){if($.data.length<H.value)W=this._getOrReturnCtx($,W),E(W,{code:F.too_small,minimum:H.value,type:"string",inclusive:!0,exact:!1,message:H.message}),Q.dirty()}else if(H.kind==="max"){if($.data.length>H.value)W=this._getOrReturnCtx($,W),E(W,{code:F.too_big,maximum:H.value,type:"string",inclusive:!0,exact:!1,message:H.message}),Q.dirty()}else if(H.kind==="length"){let X=$.data.length>H.value,q=$.data.length<H.value;if(X||q){if(W=this._getOrReturnCtx($,W),X)E(W,{code:F.too_big,maximum:H.value,type:"string",inclusive:!0,exact:!0,message:H.message});else if(q)E(W,{code:F.too_small,minimum:H.value,type:"string",inclusive:!0,exact:!0,message:H.message});Q.dirty()}}else if(H.kind==="email"){if(!TW.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"email",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="emoji"){if(!U4)U4=new RegExp(xW,"u");if(!U4.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"emoji",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="uuid"){if(!IW.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"uuid",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="nanoid"){if(!kW.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"nanoid",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="cuid"){if(!bW.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"cuid",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="cuid2"){if(!PW.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"cuid2",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="ulid"){if(!ZW.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"ulid",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="url")try{new URL($.data)}catch{W=this._getOrReturnCtx($,W),E(W,{validation:"url",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="regex"){if(H.regex.lastIndex=0,!H.regex.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"regex",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="trim")$.data=$.data.trim();else if(H.kind==="includes"){if(!$.data.includes(H.value,H.position))W=this._getOrReturnCtx($,W),E(W,{code:F.invalid_string,validation:{includes:H.value,position:H.position},message:H.message}),Q.dirty()}else if(H.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(H.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(H.kind==="startsWith"){if(!$.data.startsWith(H.value))W=this._getOrReturnCtx($,W),E(W,{code:F.invalid_string,validation:{startsWith:H.value},message:H.message}),Q.dirty()}else if(H.kind==="endsWith"){if(!$.data.endsWith(H.value))W=this._getOrReturnCtx($,W),E(W,{code:F.invalid_string,validation:{endsWith:H.value},message:H.message}),Q.dirty()}else if(H.kind==="datetime"){if(!j2(H).test($.data))W=this._getOrReturnCtx($,W),E(W,{code:F.invalid_string,validation:"datetime",message:H.message}),Q.dirty()}else if(H.kind==="date"){if(!mW.test($.data))W=this._getOrReturnCtx($,W),E(W,{code:F.invalid_string,validation:"date",message:H.message}),Q.dirty()}else if(H.kind==="time"){if(!cW(H).test($.data))W=this._getOrReturnCtx($,W),E(W,{code:F.invalid_string,validation:"time",message:H.message}),Q.dirty()}else if(H.kind==="duration"){if(!fW.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"duration",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="ip"){if(!nW($.data,H.version))W=this._getOrReturnCtx($,W),E(W,{validation:"ip",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="jwt"){if(!dW($.data,H.alg))W=this._getOrReturnCtx($,W),E(W,{validation:"jwt",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="cidr"){if(!iW($.data,H.version))W=this._getOrReturnCtx($,W),E(W,{validation:"cidr",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="base64"){if(!uW.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"base64",code:F.invalid_string,message:H.message}),Q.dirty()}else if(H.kind==="base64url"){if(!lW.test($.data))W=this._getOrReturnCtx($,W),E(W,{validation:"base64url",code:F.invalid_string,message:H.message}),Q.dirty()}else m.assertNever(H);return{status:Q.value,value:$.data}}_regex($,J,Q){return this.refinement((W)=>$.test(W),{validation:J,code:F.invalid_string,...I.errToObj(Q)})}_addCheck($){return new b0({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...I.errToObj($)})}url($){return this._addCheck({kind:"url",...I.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...I.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...I.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...I.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...I.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...I.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...I.errToObj($)})}base64($){return this._addCheck({kind:"base64",...I.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...I.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...I.errToObj($)})}ip($){return this._addCheck({kind:"ip",...I.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...I.errToObj($)})}datetime($){if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof $?.precision>"u"?null:$?.precision,offset:$?.offset??!1,local:$?.local??!1,...I.errToObj($?.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof $?.precision>"u"?null:$?.precision,...I.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...I.errToObj($)})}regex($,J){return this._addCheck({kind:"regex",regex:$,...I.errToObj(J)})}includes($,J){return this._addCheck({kind:"includes",value:$,position:J?.position,...I.errToObj(J?.message)})}startsWith($,J){return this._addCheck({kind:"startsWith",value:$,...I.errToObj(J)})}endsWith($,J){return this._addCheck({kind:"endsWith",value:$,...I.errToObj(J)})}min($,J){return this._addCheck({kind:"min",value:$,...I.errToObj(J)})}max($,J){return this._addCheck({kind:"max",value:$,...I.errToObj(J)})}length($,J){return this._addCheck({kind:"length",value:$,...I.errToObj(J)})}nonempty($){return this.min(1,I.errToObj($))}trim(){return new b0({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new b0({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new b0({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxLength(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}}b0.create=($)=>{return new b0({checks:[],typeName:N.ZodString,coerce:$?.coerce??!1,...y($)})};function pW($,J){let Q=($.toString().split(".")[1]||"").length,W=(J.toString().split(".")[1]||"").length,H=Q>W?Q:W,X=Number.parseInt($.toFixed(H).replace(".","")),q=Number.parseInt(J.toFixed(H).replace(".",""));return X%q/10**H}class r0 extends u{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==L.number){let H=this._getOrReturnCtx($);return E(H,{code:F.invalid_type,expected:L.number,received:H.parsedType}),f}let Q=void 0,W=new q0;for(let H of this._def.checks)if(H.kind==="int"){if(!m.isInteger($.data))Q=this._getOrReturnCtx($,Q),E(Q,{code:F.invalid_type,expected:"integer",received:"float",message:H.message}),W.dirty()}else if(H.kind==="min"){if(H.inclusive?$.data<H.value:$.data<=H.value)Q=this._getOrReturnCtx($,Q),E(Q,{code:F.too_small,minimum:H.value,type:"number",inclusive:H.inclusive,exact:!1,message:H.message}),W.dirty()}else if(H.kind==="max"){if(H.inclusive?$.data>H.value:$.data>=H.value)Q=this._getOrReturnCtx($,Q),E(Q,{code:F.too_big,maximum:H.value,type:"number",inclusive:H.inclusive,exact:!1,message:H.message}),W.dirty()}else if(H.kind==="multipleOf"){if(pW($.data,H.value)!==0)Q=this._getOrReturnCtx($,Q),E(Q,{code:F.not_multiple_of,multipleOf:H.value,message:H.message}),W.dirty()}else if(H.kind==="finite"){if(!Number.isFinite($.data))Q=this._getOrReturnCtx($,Q),E(Q,{code:F.not_finite,message:H.message}),W.dirty()}else m.assertNever(H);return{status:W.value,value:$.data}}gte($,J){return this.setLimit("min",$,!0,I.toString(J))}gt($,J){return this.setLimit("min",$,!1,I.toString(J))}lte($,J){return this.setLimit("max",$,!0,I.toString(J))}lt($,J){return this.setLimit("max",$,!1,I.toString(J))}setLimit($,J,Q,W){return new r0({...this._def,checks:[...this._def.checks,{kind:$,value:J,inclusive:Q,message:I.toString(W)}]})}_addCheck($){return new r0({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:I.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:I.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:I.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:I.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:I.toString($)})}multipleOf($,J){return this._addCheck({kind:"multipleOf",value:$,message:I.toString(J)})}finite($){return this._addCheck({kind:"finite",message:I.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:I.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:I.toString($)})}get minValue(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxValue(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&m.isInteger($.value))}get isFinite(){let $=null,J=null;for(let Q of this._def.checks)if(Q.kind==="finite"||Q.kind==="int"||Q.kind==="multipleOf")return!0;else if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}else if(Q.kind==="max"){if($===null||Q.value<$)$=Q.value}return Number.isFinite(J)&&Number.isFinite($)}}r0.create=($)=>{return new r0({checks:[],typeName:N.ZodNumber,coerce:$?.coerce||!1,...y($)})};class t0 extends u{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch{return this._getInvalidInput($)}if(this._getType($)!==L.bigint)return this._getInvalidInput($);let Q=void 0,W=new q0;for(let H of this._def.checks)if(H.kind==="min"){if(H.inclusive?$.data<H.value:$.data<=H.value)Q=this._getOrReturnCtx($,Q),E(Q,{code:F.too_small,type:"bigint",minimum:H.value,inclusive:H.inclusive,message:H.message}),W.dirty()}else if(H.kind==="max"){if(H.inclusive?$.data>H.value:$.data>=H.value)Q=this._getOrReturnCtx($,Q),E(Q,{code:F.too_big,type:"bigint",maximum:H.value,inclusive:H.inclusive,message:H.message}),W.dirty()}else if(H.kind==="multipleOf"){if($.data%H.value!==BigInt(0))Q=this._getOrReturnCtx($,Q),E(Q,{code:F.not_multiple_of,multipleOf:H.value,message:H.message}),W.dirty()}else m.assertNever(H);return{status:W.value,value:$.data}}_getInvalidInput($){let J=this._getOrReturnCtx($);return E(J,{code:F.invalid_type,expected:L.bigint,received:J.parsedType}),f}gte($,J){return this.setLimit("min",$,!0,I.toString(J))}gt($,J){return this.setLimit("min",$,!1,I.toString(J))}lte($,J){return this.setLimit("max",$,!0,I.toString(J))}lt($,J){return this.setLimit("max",$,!1,I.toString(J))}setLimit($,J,Q,W){return new t0({...this._def,checks:[...this._def.checks,{kind:$,value:J,inclusive:Q,message:I.toString(W)}]})}_addCheck($){return new t0({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:I.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:I.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:I.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:I.toString($)})}multipleOf($,J){return this._addCheck({kind:"multipleOf",value:$,message:I.toString(J)})}get minValue(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxValue(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}}t0.create=($)=>{return new t0({checks:[],typeName:N.ZodBigInt,coerce:$?.coerce??!1,...y($)})};class M1 extends u{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==L.boolean){let Q=this._getOrReturnCtx($);return E(Q,{code:F.invalid_type,expected:L.boolean,received:Q.parsedType}),f}return G0($.data)}}M1.create=($)=>{return new M1({typeName:N.ZodBoolean,coerce:$?.coerce||!1,...y($)})};class X1 extends u{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==L.date){let H=this._getOrReturnCtx($);return E(H,{code:F.invalid_type,expected:L.date,received:H.parsedType}),f}if(Number.isNaN($.data.getTime())){let H=this._getOrReturnCtx($);return E(H,{code:F.invalid_date}),f}let Q=new q0,W=void 0;for(let H of this._def.checks)if(H.kind==="min"){if($.data.getTime()<H.value)W=this._getOrReturnCtx($,W),E(W,{code:F.too_small,message:H.message,inclusive:!0,exact:!1,minimum:H.value,type:"date"}),Q.dirty()}else if(H.kind==="max"){if($.data.getTime()>H.value)W=this._getOrReturnCtx($,W),E(W,{code:F.too_big,message:H.message,inclusive:!0,exact:!1,maximum:H.value,type:"date"}),Q.dirty()}else m.assertNever(H);return{status:Q.value,value:new Date($.data.getTime())}}_addCheck($){return new X1({...this._def,checks:[...this._def.checks,$]})}min($,J){return this._addCheck({kind:"min",value:$.getTime(),message:I.toString(J)})}max($,J){return this._addCheck({kind:"max",value:$.getTime(),message:I.toString(J)})}get minDate(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $!=null?new Date($):null}}X1.create=($)=>{return new X1({checks:[],coerce:$?.coerce||!1,typeName:N.ZodDate,...y($)})};class w$ extends u{_parse($){if(this._getType($)!==L.symbol){let Q=this._getOrReturnCtx($);return E(Q,{code:F.invalid_type,expected:L.symbol,received:Q.parsedType}),f}return G0($.data)}}w$.create=($)=>{return new w$({typeName:N.ZodSymbol,...y($)})};class b1 extends u{_parse($){if(this._getType($)!==L.undefined){let Q=this._getOrReturnCtx($);return E(Q,{code:F.invalid_type,expected:L.undefined,received:Q.parsedType}),f}return G0($.data)}}b1.create=($)=>{return new b1({typeName:N.ZodUndefined,...y($)})};class P1 extends u{_parse($){if(this._getType($)!==L.null){let Q=this._getOrReturnCtx($);return E(Q,{code:F.invalid_type,expected:L.null,received:Q.parsedType}),f}return G0($.data)}}P1.create=($)=>{return new P1({typeName:N.ZodNull,...y($)})};class q1 extends u{constructor(){super(...arguments);this._any=!0}_parse($){return G0($.data)}}q1.create=($)=>{return new q1({typeName:N.ZodAny,...y($)})};class o0 extends u{constructor(){super(...arguments);this._unknown=!0}_parse($){return G0($.data)}}o0.create=($)=>{return new o0({typeName:N.ZodUnknown,...y($)})};class u0 extends u{_parse($){let J=this._getOrReturnCtx($);return E(J,{code:F.invalid_type,expected:L.never,received:J.parsedType}),f}}u0.create=($)=>{return new u0({typeName:N.ZodNever,...y($)})};class D$ extends u{_parse($){if(this._getType($)!==L.undefined){let Q=this._getOrReturnCtx($);return E(Q,{code:F.invalid_type,expected:L.void,received:Q.parsedType}),f}return G0($.data)}}D$.create=($)=>{return new D$({typeName:N.ZodVoid,...y($)})};class P0 extends u{_parse($){let{ctx:J,status:Q}=this._processInputParams($),W=this._def;if(J.parsedType!==L.array)return E(J,{code:F.invalid_type,expected:L.array,received:J.parsedType}),f;if(W.exactLength!==null){let X=J.data.length>W.exactLength.value,q=J.data.length<W.exactLength.value;if(X||q)E(J,{code:X?F.too_big:F.too_small,minimum:q?W.exactLength.value:void 0,maximum:X?W.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:W.exactLength.message}),Q.dirty()}if(W.minLength!==null){if(J.data.length<W.minLength.value)E(J,{code:F.too_small,minimum:W.minLength.value,type:"array",inclusive:!0,exact:!1,message:W.minLength.message}),Q.dirty()}if(W.maxLength!==null){if(J.data.length>W.maxLength.value)E(J,{code:F.too_big,maximum:W.maxLength.value,type:"array",inclusive:!0,exact:!1,message:W.maxLength.message}),Q.dirty()}if(J.common.async)return Promise.all([...J.data].map((X,q)=>{return W.type._parseAsync(new I0(J,X,J.path,q))})).then((X)=>{return q0.mergeArray(Q,X)});let H=[...J.data].map((X,q)=>{return W.type._parseSync(new I0(J,X,J.path,q))});return q0.mergeArray(Q,H)}get element(){return this._def.type}min($,J){return new P0({...this._def,minLength:{value:$,message:I.toString(J)}})}max($,J){return new P0({...this._def,maxLength:{value:$,message:I.toString(J)}})}length($,J){return new P0({...this._def,exactLength:{value:$,message:I.toString(J)}})}nonempty($){return this.min(1,$)}}P0.create=($,J)=>{return new P0({type:$,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...y(J)})};function C1($){if($ instanceof r){let J={};for(let Q in $.shape){let W=$.shape[Q];J[Q]=Z0.create(C1(W))}return new r({...$._def,shape:()=>J})}else if($ instanceof P0)return new P0({...$._def,type:C1($.element)});else if($ instanceof Z0)return Z0.create(C1($.unwrap()));else if($ instanceof i0)return i0.create(C1($.unwrap()));else if($ instanceof l0)return l0.create($.items.map((J)=>C1(J)));else return $}class r extends u{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),J=m.objectKeys($);return this._cached={shape:$,keys:J},this._cached}_parse($){if(this._getType($)!==L.object){let G=this._getOrReturnCtx($);return E(G,{code:F.invalid_type,expected:L.object,received:G.parsedType}),f}let{status:Q,ctx:W}=this._processInputParams($),{shape:H,keys:X}=this._getCached(),q=[];if(!(this._def.catchall instanceof u0&&this._def.unknownKeys==="strip")){for(let G in W.data)if(!X.includes(G))q.push(G)}let Y=[];for(let G of X){let B=H[G],w=W.data[G];Y.push({key:{status:"valid",value:G},value:B._parse(new I0(W,w,W.path,G)),alwaysSet:G in W.data})}if(this._def.catchall instanceof u0){let G=this._def.unknownKeys;if(G==="passthrough")for(let B of q)Y.push({key:{status:"valid",value:B},value:{status:"valid",value:W.data[B]}});else if(G==="strict"){if(q.length>0)E(W,{code:F.unrecognized_keys,keys:q}),Q.dirty()}else if(G==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let G=this._def.catchall;for(let B of q){let w=W.data[B];Y.push({key:{status:"valid",value:B},value:G._parse(new I0(W,w,W.path,B)),alwaysSet:B in W.data})}}if(W.common.async)return Promise.resolve().then(async()=>{let G=[];for(let B of Y){let w=await B.key,_=await B.value;G.push({key:w,value:_,alwaysSet:B.alwaysSet})}return G}).then((G)=>{return q0.mergeObjectSync(Q,G)});else return q0.mergeObjectSync(Q,Y)}get shape(){return this._def.shape()}strict($){return I.errToObj,new r({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(J,Q)=>{let W=this._def.errorMap?.(J,Q).message??Q.defaultError;if(J.code==="unrecognized_keys")return{message:I.errToObj($).message??W};return{message:W}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend($){return new r({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new r({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:N.ZodObject})}setKey($,J){return this.augment({[$]:J})}catchall($){return new r({...this._def,catchall:$})}pick($){let J={};for(let Q of m.objectKeys($))if($[Q]&&this.shape[Q])J[Q]=this.shape[Q];return new r({...this._def,shape:()=>J})}omit($){let J={};for(let Q of m.objectKeys(this.shape))if(!$[Q])J[Q]=this.shape[Q];return new r({...this._def,shape:()=>J})}deepPartial(){return C1(this)}partial($){let J={};for(let Q of m.objectKeys(this.shape)){let W=this.shape[Q];if($&&!$[Q])J[Q]=W;else J[Q]=W.optional()}return new r({...this._def,shape:()=>J})}required($){let J={};for(let Q of m.objectKeys(this.shape))if($&&!$[Q])J[Q]=this.shape[Q];else{let H=this.shape[Q];while(H instanceof Z0)H=H._def.innerType;J[Q]=H}return new r({...this._def,shape:()=>J})}keyof(){return S2(m.objectKeys(this.shape))}}r.create=($,J)=>{return new r({shape:()=>$,unknownKeys:"strip",catchall:u0.create(),typeName:N.ZodObject,...y(J)})};r.strictCreate=($,J)=>{return new r({shape:()=>$,unknownKeys:"strict",catchall:u0.create(),typeName:N.ZodObject,...y(J)})};r.lazycreate=($,J)=>{return new r({shape:$,unknownKeys:"strip",catchall:u0.create(),typeName:N.ZodObject,...y(J)})};class Z1 extends u{_parse($){let{ctx:J}=this._processInputParams($),Q=this._def.options;function W(H){for(let q of H)if(q.result.status==="valid")return q.result;for(let q of H)if(q.result.status==="dirty")return J.common.issues.push(...q.ctx.common.issues),q.result;let X=H.map((q)=>new X0(q.ctx.common.issues));return E(J,{code:F.invalid_union,unionErrors:X}),f}if(J.common.async)return Promise.all(Q.map(async(H)=>{let X={...J,common:{...J.common,issues:[]},parent:null};return{result:await H._parseAsync({data:J.data,path:J.path,parent:X}),ctx:X}})).then(W);else{let H=void 0,X=[];for(let Y of Q){let G={...J,common:{...J.common,issues:[]},parent:null},B=Y._parseSync({data:J.data,path:J.path,parent:G});if(B.status==="valid")return B;else if(B.status==="dirty"&&!H)H={result:B,ctx:G};if(G.common.issues.length)X.push(G.common.issues)}if(H)return J.common.issues.push(...H.ctx.common.issues),H.result;let q=X.map((Y)=>new X0(Y));return E(J,{code:F.invalid_union,unionErrors:q}),f}}get options(){return this._def.options}}Z1.create=($,J)=>{return new Z1({options:$,typeName:N.ZodUnion,...y(J)})};var d0=($)=>{if($ instanceof k1)return d0($.schema);else if($ instanceof k0)return d0($.innerType());else if($ instanceof K1)return[$.value];else if($ instanceof a0)return $.options;else if($ instanceof f1)return m.objectValues($.enum);else if($ instanceof T1)return d0($._def.innerType);else if($ instanceof b1)return[void 0];else if($ instanceof P1)return[null];else if($ instanceof Z0)return[void 0,...d0($.unwrap())];else if($ instanceof i0)return[null,...d0($.unwrap())];else if($ instanceof t$)return d0($.unwrap());else if($ instanceof v1)return d0($.unwrap());else if($ instanceof x1)return d0($._def.innerType);else return[]};class r$ extends u{_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==L.object)return E(J,{code:F.invalid_type,expected:L.object,received:J.parsedType}),f;let Q=this.discriminator,W=J.data[Q],H=this.optionsMap.get(W);if(!H)return E(J,{code:F.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Q]}),f;if(J.common.async)return H._parseAsync({data:J.data,path:J.path,parent:J});else return H._parseSync({data:J.data,path:J.path,parent:J})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,J,Q){let W=new Map;for(let H of J){let X=d0(H.shape[$]);if(!X.length)throw Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let q of X){if(W.has(q))throw Error(`Discriminator property ${String($)} has duplicate value ${String(q)}`);W.set(q,H)}}return new r$({typeName:N.ZodDiscriminatedUnion,discriminator:$,options:J,optionsMap:W,...y(Q)})}}function _4($,J){let Q=y0($),W=y0(J);if($===J)return{valid:!0,data:$};else if(Q===L.object&&W===L.object){let H=m.objectKeys(J),X=m.objectKeys($).filter((Y)=>H.indexOf(Y)!==-1),q={...$,...J};for(let Y of X){let G=_4($[Y],J[Y]);if(!G.valid)return{valid:!1};q[Y]=G.data}return{valid:!0,data:q}}else if(Q===L.array&&W===L.array){if($.length!==J.length)return{valid:!1};let H=[];for(let X=0;X<$.length;X++){let q=$[X],Y=J[X],G=_4(q,Y);if(!G.valid)return{valid:!1};H.push(G.data)}return{valid:!0,data:H}}else if(Q===L.date&&W===L.date&&+$===+J)return{valid:!0,data:$};else return{valid:!1}}class I1 extends u{_parse($){let{status:J,ctx:Q}=this._processInputParams($),W=(H,X)=>{if(s$(H)||s$(X))return f;let q=_4(H.value,X.value);if(!q.valid)return E(Q,{code:F.invalid_intersection_types}),f;if(o$(H)||o$(X))J.dirty();return{status:J.value,value:q.data}};if(Q.common.async)return Promise.all([this._def.left._parseAsync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseAsync({data:Q.data,path:Q.path,parent:Q})]).then(([H,X])=>W(H,X));else return W(this._def.left._parseSync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseSync({data:Q.data,path:Q.path,parent:Q}))}}I1.create=($,J,Q)=>{return new I1({left:$,right:J,typeName:N.ZodIntersection,...y(Q)})};class l0 extends u{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==L.array)return E(Q,{code:F.invalid_type,expected:L.array,received:Q.parsedType}),f;if(Q.data.length<this._def.items.length)return E(Q,{code:F.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),f;if(!this._def.rest&&Q.data.length>this._def.items.length)E(Q,{code:F.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),J.dirty();let H=[...Q.data].map((X,q)=>{let Y=this._def.items[q]||this._def.rest;if(!Y)return null;return Y._parse(new I0(Q,X,Q.path,q))}).filter((X)=>!!X);if(Q.common.async)return Promise.all(H).then((X)=>{return q0.mergeArray(J,X)});else return q0.mergeArray(J,H)}get items(){return this._def.items}rest($){return new l0({...this._def,rest:$})}}l0.create=($,J)=>{if(!Array.isArray($))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new l0({items:$,typeName:N.ZodTuple,rest:null,...y(J)})};class U$ extends u{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==L.object)return E(Q,{code:F.invalid_type,expected:L.object,received:Q.parsedType}),f;let W=[],H=this._def.keyType,X=this._def.valueType;for(let q in Q.data)W.push({key:H._parse(new I0(Q,q,Q.path,q)),value:X._parse(new I0(Q,Q.data[q],Q.path,q)),alwaysSet:q in Q.data});if(Q.common.async)return q0.mergeObjectAsync(J,W);else return q0.mergeObjectSync(J,W)}get element(){return this._def.valueType}static create($,J,Q){if(J instanceof u)return new U$({keyType:$,valueType:J,typeName:N.ZodRecord,...y(Q)});return new U$({keyType:b0.create(),valueType:$,typeName:N.ZodRecord,...y(J)})}}class _$ extends u{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==L.map)return E(Q,{code:F.invalid_type,expected:L.map,received:Q.parsedType}),f;let W=this._def.keyType,H=this._def.valueType,X=[...Q.data.entries()].map(([q,Y],G)=>{return{key:W._parse(new I0(Q,q,Q.path,[G,"key"])),value:H._parse(new I0(Q,Y,Q.path,[G,"value"]))}});if(Q.common.async){let q=new Map;return Promise.resolve().then(async()=>{for(let Y of X){let G=await Y.key,B=await Y.value;if(G.status==="aborted"||B.status==="aborted")return f;if(G.status==="dirty"||B.status==="dirty")J.dirty();q.set(G.value,B.value)}return{status:J.value,value:q}})}else{let q=new Map;for(let Y of X){let{key:G,value:B}=Y;if(G.status==="aborted"||B.status==="aborted")return f;if(G.status==="dirty"||B.status==="dirty")J.dirty();q.set(G.value,B.value)}return{status:J.value,value:q}}}}_$.create=($,J,Q)=>{return new _$({valueType:J,keyType:$,typeName:N.ZodMap,...y(Q)})};class Y1 extends u{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==L.set)return E(Q,{code:F.invalid_type,expected:L.set,received:Q.parsedType}),f;let W=this._def;if(W.minSize!==null){if(Q.data.size<W.minSize.value)E(Q,{code:F.too_small,minimum:W.minSize.value,type:"set",inclusive:!0,exact:!1,message:W.minSize.message}),J.dirty()}if(W.maxSize!==null){if(Q.data.size>W.maxSize.value)E(Q,{code:F.too_big,maximum:W.maxSize.value,type:"set",inclusive:!0,exact:!1,message:W.maxSize.message}),J.dirty()}let H=this._def.valueType;function X(Y){let G=new Set;for(let B of Y){if(B.status==="aborted")return f;if(B.status==="dirty")J.dirty();G.add(B.value)}return{status:J.value,value:G}}let q=[...Q.data.values()].map((Y,G)=>H._parse(new I0(Q,Y,Q.path,G)));if(Q.common.async)return Promise.all(q).then((Y)=>X(Y));else return X(q)}min($,J){return new Y1({...this._def,minSize:{value:$,message:I.toString(J)}})}max($,J){return new Y1({...this._def,maxSize:{value:$,message:I.toString(J)}})}size($,J){return this.min($,J).max($,J)}nonempty($){return this.min(1,$)}}Y1.create=($,J)=>{return new Y1({valueType:$,minSize:null,maxSize:null,typeName:N.ZodSet,...y(J)})};class O1 extends u{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==L.function)return E(J,{code:F.invalid_type,expected:L.function,received:J.parsedType}),f;function Q(q,Y){return B$({data:q,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,E1(),n0].filter((G)=>!!G),issueData:{code:F.invalid_arguments,argumentsError:Y}})}function W(q,Y){return B$({data:q,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,E1(),n0].filter((G)=>!!G),issueData:{code:F.invalid_return_type,returnTypeError:Y}})}let H={errorMap:J.common.contextualErrorMap},X=J.data;if(this._def.returns instanceof G1){let q=this;return G0(async function(...Y){let G=new X0([]),B=await q._def.args.parseAsync(Y,H).catch((R)=>{throw G.addIssue(Q(Y,R)),G}),w=await Reflect.apply(X,this,B);return await q._def.returns._def.type.parseAsync(w,H).catch((R)=>{throw G.addIssue(W(w,R)),G})})}else{let q=this;return G0(function(...Y){let G=q._def.args.safeParse(Y,H);if(!G.success)throw new X0([Q(Y,G.error)]);let B=Reflect.apply(X,this,G.data),w=q._def.returns.safeParse(B,H);if(!w.success)throw new X0([W(B,w.error)]);return w.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new O1({...this._def,args:l0.create($).rest(o0.create())})}returns($){return new O1({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,J,Q){return new O1({args:$?$:l0.create([]).rest(o0.create()),returns:J||o0.create(),typeName:N.ZodFunction,...y(Q)})}}class k1 extends u{get schema(){return this._def.getter()}_parse($){let{ctx:J}=this._processInputParams($);return this._def.getter()._parse({data:J.data,path:J.path,parent:J})}}k1.create=($,J)=>{return new k1({getter:$,typeName:N.ZodLazy,...y(J)})};class K1 extends u{_parse($){if($.data!==this._def.value){let J=this._getOrReturnCtx($);return E(J,{received:J.data,code:F.invalid_literal,expected:this._def.value}),f}return{status:"valid",value:$.data}}get value(){return this._def.value}}K1.create=($,J)=>{return new K1({value:$,typeName:N.ZodLiteral,...y(J)})};function S2($,J){return new a0({values:$,typeName:N.ZodEnum,...y(J)})}class a0 extends u{_parse($){if(typeof $.data!=="string"){let J=this._getOrReturnCtx($),Q=this._def.values;return E(J,{expected:m.joinValues(Q),received:J.parsedType,code:F.invalid_type}),f}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has($.data)){let J=this._getOrReturnCtx($),Q=this._def.values;return E(J,{received:J.data,code:F.invalid_enum_value,options:Q}),f}return G0($.data)}get options(){return this._def.values}get enum(){let $={};for(let J of this._def.values)$[J]=J;return $}get Values(){let $={};for(let J of this._def.values)$[J]=J;return $}get Enum(){let $={};for(let J of this._def.values)$[J]=J;return $}extract($,J=this._def){return a0.create($,{...this._def,...J})}exclude($,J=this._def){return a0.create(this.options.filter((Q)=>!$.includes(Q)),{...this._def,...J})}}a0.create=S2;class f1 extends u{_parse($){let J=m.getValidEnumValues(this._def.values),Q=this._getOrReturnCtx($);if(Q.parsedType!==L.string&&Q.parsedType!==L.number){let W=m.objectValues(J);return E(Q,{expected:m.joinValues(W),received:Q.parsedType,code:F.invalid_type}),f}if(!this._cache)this._cache=new Set(m.getValidEnumValues(this._def.values));if(!this._cache.has($.data)){let W=m.objectValues(J);return E(Q,{received:Q.data,code:F.invalid_enum_value,options:W}),f}return G0($.data)}get enum(){return this._def.values}}f1.create=($,J)=>{return new f1({values:$,typeName:N.ZodNativeEnum,...y(J)})};class G1 extends u{unwrap(){return this._def.type}_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==L.promise&&J.common.async===!1)return E(J,{code:F.invalid_type,expected:L.promise,received:J.parsedType}),f;let Q=J.parsedType===L.promise?J.data:Promise.resolve(J.data);return G0(Q.then((W)=>{return this._def.type.parseAsync(W,{path:J.path,errorMap:J.common.contextualErrorMap})}))}}G1.create=($,J)=>{return new G1({type:$,typeName:N.ZodPromise,...y(J)})};class k0 extends u{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:J,ctx:Q}=this._processInputParams($),W=this._def.effect||null,H={addIssue:(X)=>{if(E(Q,X),X.fatal)J.abort();else J.dirty()},get path(){return Q.path}};if(H.addIssue=H.addIssue.bind(H),W.type==="preprocess"){let X=W.transform(Q.data,H);if(Q.common.async)return Promise.resolve(X).then(async(q)=>{if(J.value==="aborted")return f;let Y=await this._def.schema._parseAsync({data:q,path:Q.path,parent:Q});if(Y.status==="aborted")return f;if(Y.status==="dirty")return H1(Y.value);if(J.value==="dirty")return H1(Y.value);return Y});else{if(J.value==="aborted")return f;let q=this._def.schema._parseSync({data:X,path:Q.path,parent:Q});if(q.status==="aborted")return f;if(q.status==="dirty")return H1(q.value);if(J.value==="dirty")return H1(q.value);return q}}if(W.type==="refinement"){let X=(q)=>{let Y=W.refinement(q,H);if(Q.common.async)return Promise.resolve(Y);if(Y instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return q};if(Q.common.async===!1){let q=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(q.status==="aborted")return f;if(q.status==="dirty")J.dirty();return X(q.value),{status:J.value,value:q.value}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((q)=>{if(q.status==="aborted")return f;if(q.status==="dirty")J.dirty();return X(q.value).then(()=>{return{status:J.value,value:q.value}})})}if(W.type==="transform")if(Q.common.async===!1){let X=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(!s0(X))return f;let q=W.transform(X.value,H);if(q instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:J.value,value:q}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((X)=>{if(!s0(X))return f;return Promise.resolve(W.transform(X.value,H)).then((q)=>({status:J.value,value:q}))});m.assertNever(W)}}k0.create=($,J,Q)=>{return new k0({schema:$,typeName:N.ZodEffects,effect:J,...y(Q)})};k0.createWithPreprocess=($,J,Q)=>{return new k0({schema:J,effect:{type:"preprocess",transform:$},typeName:N.ZodEffects,...y(Q)})};class Z0 extends u{_parse($){if(this._getType($)===L.undefined)return G0(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}Z0.create=($,J)=>{return new Z0({innerType:$,typeName:N.ZodOptional,...y(J)})};class i0 extends u{_parse($){if(this._getType($)===L.null)return G0(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}i0.create=($,J)=>{return new i0({innerType:$,typeName:N.ZodNullable,...y(J)})};class T1 extends u{_parse($){let{ctx:J}=this._processInputParams($),Q=J.data;if(J.parsedType===L.undefined)Q=this._def.defaultValue();return this._def.innerType._parse({data:Q,path:J.path,parent:J})}removeDefault(){return this._def.innerType}}T1.create=($,J)=>{return new T1({innerType:$,typeName:N.ZodDefault,defaultValue:typeof J.default==="function"?J.default:()=>J.default,...y(J)})};class x1 extends u{_parse($){let{ctx:J}=this._processInputParams($),Q={...J,common:{...J.common,issues:[]}},W=this._def.innerType._parse({data:Q.data,path:Q.path,parent:{...Q}});if(R1(W))return W.then((H)=>{return{status:"valid",value:H.status==="valid"?H.value:this._def.catchValue({get error(){return new X0(Q.common.issues)},input:Q.data})}});else return{status:"valid",value:W.status==="valid"?W.value:this._def.catchValue({get error(){return new X0(Q.common.issues)},input:Q.data})}}removeCatch(){return this._def.innerType}}x1.create=($,J)=>{return new x1({innerType:$,typeName:N.ZodCatch,catchValue:typeof J.catch==="function"?J.catch:()=>J.catch,...y(J)})};class V$ extends u{_parse($){if(this._getType($)!==L.nan){let Q=this._getOrReturnCtx($);return E(Q,{code:F.invalid_type,expected:L.nan,received:Q.parsedType}),f}return{status:"valid",value:$.data}}}V$.create=($)=>{return new V$({typeName:N.ZodNaN,...y($)})};var sW=Symbol("zod_brand");class t$ extends u{_parse($){let{ctx:J}=this._processInputParams($),Q=J.data;return this._def.type._parse({data:Q,path:J.path,parent:J})}unwrap(){return this._def.type}}class F$ extends u{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.common.async)return(async()=>{let H=await this._def.in._parseAsync({data:Q.data,path:Q.path,parent:Q});if(H.status==="aborted")return f;if(H.status==="dirty")return J.dirty(),H1(H.value);else return this._def.out._parseAsync({data:H.value,path:Q.path,parent:Q})})();else{let W=this._def.in._parseSync({data:Q.data,path:Q.path,parent:Q});if(W.status==="aborted")return f;if(W.status==="dirty")return J.dirty(),{status:"dirty",value:W.value};else return this._def.out._parseSync({data:W.value,path:Q.path,parent:Q})}}static create($,J){return new F$({in:$,out:J,typeName:N.ZodPipeline})}}class v1 extends u{_parse($){let J=this._def.innerType._parse($),Q=(W)=>{if(s0(W))W.value=Object.freeze(W.value);return W};return R1(J)?J.then((W)=>Q(W)):Q(J)}unwrap(){return this._def.innerType}}v1.create=($,J)=>{return new v1({innerType:$,typeName:N.ZodReadonly,...y(J)})};function z2($,J){let Q=typeof $==="function"?$(J):typeof $==="string"?{message:$}:$;return typeof Q==="string"?{message:Q}:Q}function A2($,J={},Q){if($)return q1.create().superRefine((W,H)=>{let X=$(W);if(X instanceof Promise)return X.then((q)=>{if(!q){let Y=z2(J,W),G=Y.fatal??Q??!0;H.addIssue({code:"custom",...Y,fatal:G})}});if(!X){let q=z2(J,W),Y=q.fatal??Q??!0;H.addIssue({code:"custom",...q,fatal:Y})}return});return q1.create()}var oW={object:r.lazycreate},N;(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(N||(N={}));var rW=($,J={message:`Input not instance of ${$.name}`})=>A2((Q)=>Q instanceof $,J),E2=b0.create,R2=r0.create,tW=V$.create,aW=t0.create,C2=M1.create,eW=X1.create,$H=w$.create,JH=b1.create,QH=P1.create,WH=q1.create,HH=o0.create,XH=u0.create,qH=D$.create,YH=P0.create,GH=r.create,BH=r.strictCreate,wH=Z1.create,DH=r$.create,UH=I1.create,_H=l0.create,VH=U$.create,FH=_$.create,zH=Y1.create,NH=O1.create,LH=k1.create,jH=K1.create,SH=a0.create,AH=f1.create,EH=G1.create,RH=k0.create,CH=Z0.create,OH=i0.create,MH=k0.createWithPreprocess,bH=F$.create,PH=()=>E2().optional(),ZH=()=>R2().optional(),IH=()=>C2().optional(),kH={string:($)=>b0.create({...$,coerce:!0}),number:($)=>r0.create({...$,coerce:!0}),boolean:($)=>M1.create({...$,coerce:!0}),bigint:($)=>t0.create({...$,coerce:!0}),date:($)=>X1.create({...$,coerce:!0})};var KH=f;function s($){if($.target!=="openAi")return{};let J=[...$.basePath,$.definitionPath,$.openAiAnyTypeName];return $.flags.hasReferencedOpenAiAnyType=!0,{$ref:$.$refStrategy==="relative"?p$(J,$.currentPath):J.join("/")}}function O2($,J){let Q={type:"array"};if($.type?._def&&$.type?._def?.typeName!==N.ZodAny)Q.items=x($.type._def,{...J,currentPath:[...J.currentPath,"items"]});if($.minLength)n(Q,"minItems",$.minLength.value,$.minLength.message,J);if($.maxLength)n(Q,"maxItems",$.maxLength.value,$.maxLength.message,J);if($.exactLength)n(Q,"minItems",$.exactLength.value,$.exactLength.message,J),n(Q,"maxItems",$.exactLength.value,$.exactLength.message,J);return Q}function M2($,J){let Q={type:"integer",format:"int64"};if(!$.checks)return Q;for(let W of $.checks)switch(W.kind){case"min":if(J.target==="jsonSchema7")if(W.inclusive)n(Q,"minimum",W.value,W.message,J);else n(Q,"exclusiveMinimum",W.value,W.message,J);else{if(!W.inclusive)Q.exclusiveMinimum=!0;n(Q,"minimum",W.value,W.message,J)}break;case"max":if(J.target==="jsonSchema7")if(W.inclusive)n(Q,"maximum",W.value,W.message,J);else n(Q,"exclusiveMaximum",W.value,W.message,J);else{if(!W.inclusive)Q.exclusiveMaximum=!0;n(Q,"maximum",W.value,W.message,J)}break;case"multipleOf":n(Q,"multipleOf",W.value,W.message,J);break}return Q}function b2(){return{type:"boolean"}}function a$($,J){return x($.type._def,J)}var P2=($,J)=>{return x($.innerType._def,J)};function V4($,J,Q){let W=Q??J.dateStrategy;if(Array.isArray(W))return{anyOf:W.map((H,X)=>V4($,J,H))};switch(W){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return fH($,J)}}var fH=($,J)=>{let Q={type:"integer",format:"unix-time"};if(J.target==="openApi3")return Q;for(let W of $.checks)switch(W.kind){case"min":n(Q,"minimum",W.value,W.message,J);break;case"max":n(Q,"maximum",W.value,W.message,J);break}return Q};function Z2($,J){return{...x($.innerType._def,J),default:$.defaultValue()}}function I2($,J){return J.effectStrategy==="input"?x($.schema._def,J):s(J)}function k2($){return{type:"string",enum:Array.from($.values)}}var TH=($)=>{if("type"in $&&$.type==="string")return!1;return"allOf"in $};function K2($,J){let Q=[x($.left._def,{...J,currentPath:[...J.currentPath,"allOf","0"]}),x($.right._def,{...J,currentPath:[...J.currentPath,"allOf","1"]})].filter((X)=>!!X),W=J.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,H=[];return Q.forEach((X)=>{if(TH(X)){if(H.push(...X.allOf),X.unevaluatedProperties===void 0)W=void 0}else{let q=X;if("additionalProperties"in X&&X.additionalProperties===!1){let{additionalProperties:Y,...G}=X;q=G}else W=void 0;H.push(q)}}),H.length?{allOf:H,...W}:void 0}function f2($,J){let Q=typeof $.value;if(Q!=="bigint"&&Q!=="number"&&Q!=="boolean"&&Q!=="string")return{type:Array.isArray($.value)?"array":"object"};if(J.target==="openApi3")return{type:Q==="bigint"?"integer":Q,enum:[$.value]};return{type:Q==="bigint"?"integer":Q,const:$.value}}var F4=void 0,K0={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(F4===void 0)F4=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return F4},uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function e$($,J){let Q={type:"string"};if($.checks)for(let W of $.checks)switch(W.kind){case"min":n(Q,"minLength",typeof Q.minLength==="number"?Math.max(Q.minLength,W.value):W.value,W.message,J);break;case"max":n(Q,"maxLength",typeof Q.maxLength==="number"?Math.min(Q.maxLength,W.value):W.value,W.message,J);break;case"email":switch(J.emailStrategy){case"format:email":f0(Q,"email",W.message,J);break;case"format:idn-email":f0(Q,"idn-email",W.message,J);break;case"pattern:zod":_0(Q,K0.email,W.message,J);break}break;case"url":f0(Q,"uri",W.message,J);break;case"uuid":f0(Q,"uuid",W.message,J);break;case"regex":_0(Q,W.regex,W.message,J);break;case"cuid":_0(Q,K0.cuid,W.message,J);break;case"cuid2":_0(Q,K0.cuid2,W.message,J);break;case"startsWith":_0(Q,RegExp(`^${z4(W.value,J)}`),W.message,J);break;case"endsWith":_0(Q,RegExp(`${z4(W.value,J)}$`),W.message,J);break;case"datetime":f0(Q,"date-time",W.message,J);break;case"date":f0(Q,"date",W.message,J);break;case"time":f0(Q,"time",W.message,J);break;case"duration":f0(Q,"duration",W.message,J);break;case"length":n(Q,"minLength",typeof Q.minLength==="number"?Math.max(Q.minLength,W.value):W.value,W.message,J),n(Q,"maxLength",typeof Q.maxLength==="number"?Math.min(Q.maxLength,W.value):W.value,W.message,J);break;case"includes":{_0(Q,RegExp(z4(W.value,J)),W.message,J);break}case"ip":{if(W.version!=="v6")f0(Q,"ipv4",W.message,J);if(W.version!=="v4")f0(Q,"ipv6",W.message,J);break}case"base64url":_0(Q,K0.base64url,W.message,J);break;case"jwt":_0(Q,K0.jwt,W.message,J);break;case"cidr":{if(W.version!=="v6")_0(Q,K0.ipv4Cidr,W.message,J);if(W.version!=="v4")_0(Q,K0.ipv6Cidr,W.message,J);break}case"emoji":_0(Q,K0.emoji(),W.message,J);break;case"ulid":{_0(Q,K0.ulid,W.message,J);break}case"base64":{switch(J.base64Strategy){case"format:binary":{f0(Q,"binary",W.message,J);break}case"contentEncoding:base64":{n(Q,"contentEncoding","base64",W.message,J);break}case"pattern:zod":{_0(Q,K0.base64,W.message,J);break}}break}case"nanoid":_0(Q,K0.nanoid,W.message,J);case"toLowerCase":case"toUpperCase":case"trim":break;default:((H)=>{})(W)}return Q}function z4($,J){return J.patternStrategy==="escape"?vH($):$}var xH=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function vH($){let J="";for(let Q=0;Q<$.length;Q++){if(!xH.has($[Q]))J+="\\";J+=$[Q]}return J}function f0($,J,Q,W){if($.format||$.anyOf?.some((H)=>H.format)){if(!$.anyOf)$.anyOf=[];if($.format){if($.anyOf.push({format:$.format,...$.errorMessage&&W.errorMessages&&{errorMessage:{format:$.errorMessage.format}}}),delete $.format,$.errorMessage){if(delete $.errorMessage.format,Object.keys($.errorMessage).length===0)delete $.errorMessage}}$.anyOf.push({format:J,...Q&&W.errorMessages&&{errorMessage:{format:Q}}})}else n($,"format",J,Q,W)}function _0($,J,Q,W){if($.pattern||$.allOf?.some((H)=>H.pattern)){if(!$.allOf)$.allOf=[];if($.pattern){if($.allOf.push({pattern:$.pattern,...$.errorMessage&&W.errorMessages&&{errorMessage:{pattern:$.errorMessage.pattern}}}),delete $.pattern,$.errorMessage){if(delete $.errorMessage.pattern,Object.keys($.errorMessage).length===0)delete $.errorMessage}}$.allOf.push({pattern:T2(J,W),...Q&&W.errorMessages&&{errorMessage:{pattern:Q}}})}else n($,"pattern",T2(J,W),Q,W)}function T2($,J){if(!J.applyRegexFlags||!$.flags)return $.source;let Q={i:$.flags.includes("i"),m:$.flags.includes("m"),s:$.flags.includes("s")},W=Q.i?$.source.toLowerCase():$.source,H="",X=!1,q=!1,Y=!1;for(let G=0;G<W.length;G++){if(X){H+=W[G],X=!1;continue}if(Q.i){if(q){if(W[G].match(/[a-z]/)){if(Y)H+=W[G],H+=`${W[G-2]}-${W[G]}`.toUpperCase(),Y=!1;else if(W[G+1]==="-"&&W[G+2]?.match(/[a-z]/))H+=W[G],Y=!0;else H+=`${W[G]}${W[G].toUpperCase()}`;continue}}else if(W[G].match(/[a-z]/)){H+=`[${W[G]}${W[G].toUpperCase()}]`;continue}}if(Q.m){if(W[G]==="^"){H+=`(^|(?<=[\r
17
17
  ]))`;continue}else if(W[G]==="$"){H+=`($|(?=[\r
18
18
  ]))`;continue}}if(Q.s&&W[G]==="."){H+=q?`${W[G]}\r
19
19
  `:`[${W[G]}\r
20
- ]`;continue}if(H+=W[G],W[G]==="\\")X=!0;else if(q&&W[G]==="]")q=!1;else if(!q&&W[G]==="[")q=!0}try{new RegExp(H)}catch{return console.warn(`Could not convert regex pattern at ${J.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),$.source}return H}function $6($,J){if(J.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(J.target==="openApi3"&&$.keyType?._def.typeName===N.ZodEnum)return{type:"object",required:$.keyType._def.values,properties:$.keyType._def.values.reduce((W,H)=>({...W,[H]:x($.valueType._def,{...J,currentPath:[...J.currentPath,"properties",H]})??s(J)}),{}),additionalProperties:J.rejectedAdditionalProperties};let Q={type:"object",additionalProperties:x($.valueType._def,{...J,currentPath:[...J.currentPath,"additionalProperties"]})??J.allowedAdditionalProperties};if(J.target==="openApi3")return Q;if($.keyType?._def.typeName===N.ZodString&&$.keyType._def.checks?.length){let{type:W,...H}=e$($.keyType._def,J);return{...Q,propertyNames:H}}else if($.keyType?._def.typeName===N.ZodEnum)return{...Q,propertyNames:{enum:$.keyType._def.values}};else if($.keyType?._def.typeName===N.ZodBranded&&$.keyType._def.type._def.typeName===N.ZodString&&$.keyType._def.type._def.checks?.length){let{type:W,...H}=a$($.keyType._def,J);return{...Q,propertyNames:H}}return Q}function T2($,J){if(J.mapStrategy==="record")return $6($,J);let Q=x($.keyType._def,{...J,currentPath:[...J.currentPath,"items","items","0"]})||s(J),W=x($.valueType._def,{...J,currentPath:[...J.currentPath,"items","items","1"]})||s(J);return{type:"array",maxItems:125,items:{type:"array",items:[Q,W],minItems:2,maxItems:2}}}function x2($){let J=$.values,W=Object.keys($.values).filter((X)=>{return typeof J[J[X]]!=="number"}).map((X)=>J[X]),H=Array.from(new Set(W.map((X)=>typeof X)));return{type:H.length===1?H[0]==="string"?"string":"number":["string","number"],enum:W}}function v2($){return $.target==="openAi"?void 0:{not:s({...$,currentPath:[...$.currentPath,"not"]})}}function h2($){return $.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var F$={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function y2($,J){if(J.target==="openApi3")return g2($,J);let Q=$.options instanceof Map?Array.from($.options.values()):$.options;if(Q.every((W)=>(W._def.typeName in F$)&&(!W._def.checks||!W._def.checks.length))){let W=Q.reduce((H,X)=>{let q=F$[X._def.typeName];return q&&!H.includes(q)?[...H,q]:H},[]);return{type:W.length>1?W:W[0]}}else if(Q.every((W)=>W._def.typeName==="ZodLiteral"&&!W.description)){let W=Q.reduce((H,X)=>{let q=typeof X._def.value;switch(q){case"string":case"number":case"boolean":return[...H,q];case"bigint":return[...H,"integer"];case"object":if(X._def.value===null)return[...H,"null"];case"symbol":case"undefined":case"function":default:return H}},[]);if(W.length===Q.length){let H=W.filter((X,q,Y)=>Y.indexOf(X)===q);return{type:H.length>1?H:H[0],enum:Q.reduce((X,q)=>{return X.includes(q._def.value)?X:[...X,q._def.value]},[])}}}else if(Q.every((W)=>W._def.typeName==="ZodEnum"))return{type:"string",enum:Q.reduce((W,H)=>[...W,...H._def.values.filter((X)=>!W.includes(X))],[])};return g2($,J)}var g2=($,J)=>{let Q=($.options instanceof Map?Array.from($.options.values()):$.options).map((W,H)=>x(W._def,{...J,currentPath:[...J.currentPath,"anyOf",`${H}`]})).filter((W)=>!!W&&(!J.strictUnions||typeof W==="object"&&Object.keys(W).length>0));return Q.length?{anyOf:Q}:void 0};function u2($,J){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes($.innerType._def.typeName)&&(!$.innerType._def.checks||!$.innerType._def.checks.length)){if(J.target==="openApi3")return{type:F$[$.innerType._def.typeName],nullable:!0};return{type:[F$[$.innerType._def.typeName],"null"]}}if(J.target==="openApi3"){let W=x($.innerType._def,{...J,currentPath:[...J.currentPath]});if(W&&"$ref"in W)return{allOf:[W],nullable:!0};return W&&{...W,nullable:!0}}let Q=x($.innerType._def,{...J,currentPath:[...J.currentPath,"anyOf","0"]});return Q&&{anyOf:[Q,{type:"null"}]}}function l2($,J){let Q={type:"number"};if(!$.checks)return Q;for(let W of $.checks)switch(W.kind){case"int":Q.type="integer",B4(Q,"type",W.message,J);break;case"min":if(J.target==="jsonSchema7")if(W.inclusive)n(Q,"minimum",W.value,W.message,J);else n(Q,"exclusiveMinimum",W.value,W.message,J);else{if(!W.inclusive)Q.exclusiveMinimum=!0;n(Q,"minimum",W.value,W.message,J)}break;case"max":if(J.target==="jsonSchema7")if(W.inclusive)n(Q,"maximum",W.value,W.message,J);else n(Q,"exclusiveMaximum",W.value,W.message,J);else{if(!W.inclusive)Q.exclusiveMaximum=!0;n(Q,"maximum",W.value,W.message,J)}break;case"multipleOf":n(Q,"multipleOf",W.value,W.message,J);break}return Q}function m2($,J){let Q=J.target==="openAi",W={type:"object",properties:{}},H=[],X=$.shape();for(let Y in X){let G=X[Y];if(G===void 0||G._def===void 0)continue;let B=gH(G);if(B&&Q){if(G._def.typeName==="ZodOptional")G=G._def.innerType;if(!G.isNullable())G=G.nullable();B=!1}let w=x(G._def,{...J,currentPath:[...J.currentPath,"properties",Y],propertyPath:[...J.currentPath,"properties",Y]});if(w===void 0)continue;if(W.properties[Y]=w,!B)H.push(Y)}if(H.length)W.required=H;let q=hH($,J);if(q!==void 0)W.additionalProperties=q;return W}function hH($,J){if($.catchall._def.typeName!=="ZodNever")return x($.catchall._def,{...J,currentPath:[...J.currentPath,"additionalProperties"]});switch($.unknownKeys){case"passthrough":return J.allowedAdditionalProperties;case"strict":return J.rejectedAdditionalProperties;case"strip":return J.removeAdditionalStrategy==="strict"?J.allowedAdditionalProperties:J.rejectedAdditionalProperties}}function gH($){try{return $.isOptional()}catch{return!0}}var c2=($,J)=>{if(J.currentPath.toString()===J.propertyPath?.toString())return x($.innerType._def,J);let Q=x($.innerType._def,{...J,currentPath:[...J.currentPath,"anyOf","1"]});return Q?{anyOf:[{not:s(J)},Q]}:s(J)};var n2=($,J)=>{if(J.pipeStrategy==="input")return x($.in._def,J);else if(J.pipeStrategy==="output")return x($.out._def,J);let Q=x($.in._def,{...J,currentPath:[...J.currentPath,"allOf","0"]}),W=x($.out._def,{...J,currentPath:[...J.currentPath,"allOf",Q?"1":"0"]});return{allOf:[Q,W].filter((H)=>H!==void 0)}};function d2($,J){return x($.type._def,J)}function i2($,J){let W={type:"array",uniqueItems:!0,items:x($.valueType._def,{...J,currentPath:[...J.currentPath,"items"]})};if($.minSize)n(W,"minItems",$.minSize.value,$.minSize.message,J);if($.maxSize)n(W,"maxItems",$.maxSize.value,$.maxSize.message,J);return W}function p2($,J){if($.rest)return{type:"array",minItems:$.items.length,items:$.items.map((Q,W)=>x(Q._def,{...J,currentPath:[...J.currentPath,"items",`${W}`]})).reduce((Q,W)=>W===void 0?Q:[...Q,W],[]),additionalItems:x($.rest._def,{...J,currentPath:[...J.currentPath,"additionalItems"]})};else return{type:"array",minItems:$.items.length,maxItems:$.items.length,items:$.items.map((Q,W)=>x(Q._def,{...J,currentPath:[...J.currentPath,"items",`${W}`]})).reduce((Q,W)=>W===void 0?Q:[...Q,W],[])}}function s2($){return{not:s($)}}function o2($){return s($)}var r2=($,J)=>{return x($.innerType._def,J)};var t2=($,J,Q)=>{switch(J){case N.ZodString:return e$($,Q);case N.ZodNumber:return l2($,Q);case N.ZodObject:return m2($,Q);case N.ZodBigInt:return O2($,Q);case N.ZodBoolean:return M2();case N.ZodDate:return _4($,Q);case N.ZodUndefined:return s2(Q);case N.ZodNull:return h2(Q);case N.ZodArray:return C2($,Q);case N.ZodUnion:case N.ZodDiscriminatedUnion:return y2($,Q);case N.ZodIntersection:return k2($,Q);case N.ZodTuple:return p2($,Q);case N.ZodRecord:return $6($,Q);case N.ZodLiteral:return K2($,Q);case N.ZodEnum:return I2($);case N.ZodNativeEnum:return x2($);case N.ZodNullable:return u2($,Q);case N.ZodOptional:return c2($,Q);case N.ZodMap:return T2($,Q);case N.ZodSet:return i2($,Q);case N.ZodLazy:return()=>$.getter()._def;case N.ZodPromise:return d2($,Q);case N.ZodNaN:case N.ZodNever:return v2(Q);case N.ZodEffects:return Z2($,Q);case N.ZodAny:return s(Q);case N.ZodUnknown:return o2(Q);case N.ZodDefault:return P2($,Q);case N.ZodBranded:return a$($,Q);case N.ZodReadonly:return r2($,Q);case N.ZodCatch:return b2($,Q);case N.ZodPipeline:return n2($,Q);case N.ZodFunction:case N.ZodVoid:case N.ZodSymbol:return;default:return((W)=>{return})(J)}};function x($,J,Q=!1){let W=J.seen.get($);if(J.override){let Y=J.override?.($,J,W,Q);if(Y!==w2)return Y}if(W&&!Q){let Y=yH(W,J);if(Y!==void 0)return Y}let H={def:$,path:J.currentPath,jsonSchema:void 0};J.seen.set($,H);let X=t2($,$.typeName,J),q=typeof X==="function"?x(X(),J):X;if(q)uH($,J,q);if(J.postProcess){let Y=J.postProcess(q,$,J);return H.jsonSchema=q,Y}return H.jsonSchema=q,q}var yH=($,J)=>{switch(J.$refStrategy){case"root":return{$ref:$.path.join("/")};case"relative":return{$ref:p$(J.currentPath,$.path)};case"none":case"seen":{if($.path.length<J.currentPath.length&&$.path.every((Q,W)=>J.currentPath[W]===Q))return console.warn(`Recursive reference detected at ${J.currentPath.join("/")}! Defaulting to any`),s(J);return J.$refStrategy==="seen"?s(J):void 0}}},uH=($,J,Q)=>{if($.description){if(Q.description=$.description,J.markdownDescription)Q.markdownDescription=$.description}return Q};var J6=($,J)=>{let Q=U2(J),W=typeof J==="object"&&J.definitions?Object.entries(J.definitions).reduce((G,[B,w])=>({...G,[B]:x(w._def,{...Q,currentPath:[...Q.basePath,Q.definitionPath,B]},!0)??s(Q)}),{}):void 0,H=typeof J==="string"?J:J?.nameStrategy==="title"?void 0:J?.name,X=x($._def,H===void 0?Q:{...Q,currentPath:[...Q.basePath,Q.definitionPath,H]},!1)??s(Q),q=typeof J==="object"&&J.name!==void 0&&J.nameStrategy==="title"?J.name:void 0;if(q!==void 0)X.title=q;if(Q.flags.hasReferencedOpenAiAnyType){if(!W)W={};if(!W[Q.openAiAnyTypeName])W[Q.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:Q.$refStrategy==="relative"?"1":[...Q.basePath,Q.definitionPath,Q.openAiAnyTypeName].join("/")}}}let Y=H===void 0?W?{...X,[Q.definitionPath]:W}:X:{$ref:[...Q.$refStrategy==="relative"?[]:Q.basePath,Q.definitionPath,H].join("/"),[Q.definitionPath]:{...W,[H]:X}};if(Q.target==="jsonSchema7")Y.$schema="http://json-schema.org/draft-07/schema#";else if(Q.target==="jsonSchema2019-09"||Q.target==="openAi")Y.$schema="https://json-schema.org/draft/2019-09/schema#";if(Q.target==="openAi"&&(("anyOf"in Y)||("oneOf"in Y)||("allOf"in Y)||("type"in Y)&&Array.isArray(Y.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return Y};var a2=new WeakMap,e2=0;class p0{spec;generatedSchemas=new Set;constructor($){this.spec=$}convert($,J){try{if(J?.reusable||this.shouldBeReusable($))return this.convertToReusableSchema($,J?.name);return this.convertInline($)}catch(Q){return console.warn("Failed to convert Zod schema to JSON Schema:",Q),{type:"object"}}}convertInline($){let J=J6($,{target:"openApi3",$refStrategy:"none"});if(J&&typeof J==="object")delete J.$schema;return J}convertToReusableSchema($,J){let Q=a2.get($);if(Q&&this.generatedSchemas.has(Q))return{$ref:`#/components/schemas/${Q}`};let W=J||Q||this.generateSchemaName();a2.set($,W),this.generatedSchemas.add(W);let H=this.convertInline($);if(!this.spec.components)this.spec.components={schemas:{}};if(!this.spec.components.schemas)this.spec.components.schemas={};return this.spec.components.schemas[W]=H,{$ref:`#/components/schemas/${W}`}}shouldBeReusable($){let J=this.convertInline($);if(J.type==="object"&&J.properties)return Object.keys(J.properties).length>2;if(J.type==="array"&&J.items){let Q=J.items;if(Q.type==="object"&&Q.properties)return!0}if(J.anyOf||J.oneOf||J.allOf)return!0;return!1}generateSchemaName(){return`Schema${++e2}`}static resetCounter(){e2=0}}function Q6($,J){if(J)return new p0(J).convert($);try{let Q=J6($,{target:"openApi3",$refStrategy:"none"});if(Q&&typeof Q==="object")delete Q.$schema;return Q}catch(Q){return console.warn("Failed to convert Zod schema to JSON Schema:",Q),{type:"object"}}}class B1{metadata;options;converter;constructor($,J){this.metadata=$;this.options={title:J?.title||"Veloce-TS API",version:J?.version||"1.0.0",description:J?.description||"API built with Veloce-TS",path:J?.path||"/openapi.json",docsPath:J?.docsPath||"/docs",docs:J?.docs!==!1}}generate(){let $=this.metadata.getRoutes(),J={openapi:"3.0.0",info:{title:this.options.title,version:this.options.version,description:this.options.description},paths:{},components:{schemas:{}}};this.converter=new p0(J);for(let Q of $)this.addRouteToSpec(J,Q);return J}addRouteToSpec($,J){let Q=this.convertPathToOpenAPI(J.path),W=J.method.toLowerCase();if(W==="all"||W==="options")return;if(!$.paths[Q])$.paths[Q]={};let H={summary:J.docs?.summary,description:J.docs?.description,tags:J.docs?.tags||[],deprecated:J.docs?.deprecated||!1,parameters:this.extractParameters(J,$),responses:this.extractResponses(J,$)},X=this.extractRequestBody(J,$);if(X)H.requestBody=X;if(H.parameters.length===0)delete H.parameters;if(H.tags.length===0)delete H.tags;$.paths[Q][W]=H}extractParameters($,J){let Q=[];for(let W of $.parameters)if(W.type==="query"||W.type==="param"||W.type==="header"||W.type==="cookie"){let H=this.parameterToOpenAPI(W,$.path,J);if(H)Q.push(H)}return Q}extractRequestBody($,J){let Q=$.parameters.find((W)=>W.type==="body");if(!Q||!Q.schema)return null;return{required:Q.required,content:{"application/json":{schema:this.zodToOpenAPISchema(Q.schema,J)}}}}extractResponses($,J){let Q={};if($.responses&&$.responses.length>0)for(let W of $.responses)Q[W.statusCode.toString()]={description:W.description||this.getDefaultResponseDescription(W.statusCode),content:W.schema?{"application/json":{schema:this.zodToOpenAPISchema(W.schema,J)}}:void 0};else Q["200"]={description:"Successful response",content:{"application/json":{schema:{type:"object"}}}};if(!Q["422"])Q["422"]={description:"Validation error",content:{"application/json":{schema:{type:"object",properties:{error:{type:"string"},details:{type:"array",items:{type:"object",properties:{path:{type:"string"},message:{type:"string"},code:{type:"string"}}}}}}}}};return Q}convertPathToOpenAPI($){return $.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g,"{$1}")}parameterToOpenAPI($,J,Q){let W,H;switch($.type){case"query":W="query",H=$.name||"query";break;case"param":if(W="path",$.name)H=$.name;else{let q=J.match(/:([a-zA-Z_][a-zA-Z0-9_]*)/);H=q?q[1]:"id"}break;case"header":W="header",H=$.name||"X-Custom-Header";break;case"cookie":W="cookie",H=$.name||"session";break;default:return null}return{name:H,in:W,required:$.required||W==="path",schema:$.schema?this.zodToOpenAPISchema($.schema,Q):{type:"string"}}}zodToOpenAPISchema($,J){if(!this.converter)this.converter=new p0(J);return this.converter.convert($)}getDefaultResponseDescription($){return{200:"Successful response",201:"Created",204:"No content",400:"Bad request",401:"Unauthorized",403:"Forbidden",404:"Not found",422:"Validation error",500:"Internal server error"}[$]||"Response"}}var mH={};L0(mH,{WebSocketPlugin:()=>y1,OpenAPIPlugin:()=>W6,GraphQLPlugin:()=>A$});module.exports=M0(mH);class W6{name="openapi";version="1.0.0";options;constructor($){this.options={title:$?.title||"Veloce-TS API",version:$?.version||"1.0.0",description:$?.description||"API built with Veloce-TS",path:$?.path||"/openapi.json",docsPath:$?.docsPath||"/docs",docs:$?.docs!==!1}}async install($){let J=$.getConfig();if(J.title)this.options.title=J.title;if(J.version)this.options.version=J.version;if(J.description)this.options.description=J.description;$.get(this.options.path,{handler:async()=>{return this.generateSpec($)},docs:{summary:"Get OpenAPI specification",description:"Returns the OpenAPI 3.0 specification for this API",tags:["Documentation"]}})}generateSpec($){let J=$.getMetadata();return new B1(J,this.options).generate()}renderSwaggerUI(){return`<!DOCTYPE html>
20
+ ]`;continue}if(H+=W[G],W[G]==="\\")X=!0;else if(q&&W[G]==="]")q=!1;else if(!q&&W[G]==="[")q=!0}try{new RegExp(H)}catch{return console.warn(`Could not convert regex pattern at ${J.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),$.source}return H}function $6($,J){if(J.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(J.target==="openApi3"&&$.keyType?._def.typeName===N.ZodEnum)return{type:"object",required:$.keyType._def.values,properties:$.keyType._def.values.reduce((W,H)=>({...W,[H]:x($.valueType._def,{...J,currentPath:[...J.currentPath,"properties",H]})??s(J)}),{}),additionalProperties:J.rejectedAdditionalProperties};let Q={type:"object",additionalProperties:x($.valueType._def,{...J,currentPath:[...J.currentPath,"additionalProperties"]})??J.allowedAdditionalProperties};if(J.target==="openApi3")return Q;if($.keyType?._def.typeName===N.ZodString&&$.keyType._def.checks?.length){let{type:W,...H}=e$($.keyType._def,J);return{...Q,propertyNames:H}}else if($.keyType?._def.typeName===N.ZodEnum)return{...Q,propertyNames:{enum:$.keyType._def.values}};else if($.keyType?._def.typeName===N.ZodBranded&&$.keyType._def.type._def.typeName===N.ZodString&&$.keyType._def.type._def.checks?.length){let{type:W,...H}=a$($.keyType._def,J);return{...Q,propertyNames:H}}return Q}function x2($,J){if(J.mapStrategy==="record")return $6($,J);let Q=x($.keyType._def,{...J,currentPath:[...J.currentPath,"items","items","0"]})||s(J),W=x($.valueType._def,{...J,currentPath:[...J.currentPath,"items","items","1"]})||s(J);return{type:"array",maxItems:125,items:{type:"array",items:[Q,W],minItems:2,maxItems:2}}}function v2($){let J=$.values,W=Object.keys($.values).filter((X)=>{return typeof J[J[X]]!=="number"}).map((X)=>J[X]),H=Array.from(new Set(W.map((X)=>typeof X)));return{type:H.length===1?H[0]==="string"?"string":"number":["string","number"],enum:W}}function h2($){return $.target==="openAi"?void 0:{not:s({...$,currentPath:[...$.currentPath,"not"]})}}function g2($){return $.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var z$={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function u2($,J){if(J.target==="openApi3")return y2($,J);let Q=$.options instanceof Map?Array.from($.options.values()):$.options;if(Q.every((W)=>(W._def.typeName in z$)&&(!W._def.checks||!W._def.checks.length))){let W=Q.reduce((H,X)=>{let q=z$[X._def.typeName];return q&&!H.includes(q)?[...H,q]:H},[]);return{type:W.length>1?W:W[0]}}else if(Q.every((W)=>W._def.typeName==="ZodLiteral"&&!W.description)){let W=Q.reduce((H,X)=>{let q=typeof X._def.value;switch(q){case"string":case"number":case"boolean":return[...H,q];case"bigint":return[...H,"integer"];case"object":if(X._def.value===null)return[...H,"null"];case"symbol":case"undefined":case"function":default:return H}},[]);if(W.length===Q.length){let H=W.filter((X,q,Y)=>Y.indexOf(X)===q);return{type:H.length>1?H:H[0],enum:Q.reduce((X,q)=>{return X.includes(q._def.value)?X:[...X,q._def.value]},[])}}}else if(Q.every((W)=>W._def.typeName==="ZodEnum"))return{type:"string",enum:Q.reduce((W,H)=>[...W,...H._def.values.filter((X)=>!W.includes(X))],[])};return y2($,J)}var y2=($,J)=>{let Q=($.options instanceof Map?Array.from($.options.values()):$.options).map((W,H)=>x(W._def,{...J,currentPath:[...J.currentPath,"anyOf",`${H}`]})).filter((W)=>!!W&&(!J.strictUnions||typeof W==="object"&&Object.keys(W).length>0));return Q.length?{anyOf:Q}:void 0};function l2($,J){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes($.innerType._def.typeName)&&(!$.innerType._def.checks||!$.innerType._def.checks.length)){if(J.target==="openApi3")return{type:z$[$.innerType._def.typeName],nullable:!0};return{type:[z$[$.innerType._def.typeName],"null"]}}if(J.target==="openApi3"){let W=x($.innerType._def,{...J,currentPath:[...J.currentPath]});if(W&&"$ref"in W)return{allOf:[W],nullable:!0};return W&&{...W,nullable:!0}}let Q=x($.innerType._def,{...J,currentPath:[...J.currentPath,"anyOf","0"]});return Q&&{anyOf:[Q,{type:"null"}]}}function m2($,J){let Q={type:"number"};if(!$.checks)return Q;for(let W of $.checks)switch(W.kind){case"int":Q.type="integer",w4(Q,"type",W.message,J);break;case"min":if(J.target==="jsonSchema7")if(W.inclusive)n(Q,"minimum",W.value,W.message,J);else n(Q,"exclusiveMinimum",W.value,W.message,J);else{if(!W.inclusive)Q.exclusiveMinimum=!0;n(Q,"minimum",W.value,W.message,J)}break;case"max":if(J.target==="jsonSchema7")if(W.inclusive)n(Q,"maximum",W.value,W.message,J);else n(Q,"exclusiveMaximum",W.value,W.message,J);else{if(!W.inclusive)Q.exclusiveMaximum=!0;n(Q,"maximum",W.value,W.message,J)}break;case"multipleOf":n(Q,"multipleOf",W.value,W.message,J);break}return Q}function c2($,J){let Q=J.target==="openAi",W={type:"object",properties:{}},H=[],X=$.shape();for(let Y in X){let G=X[Y];if(G===void 0||G._def===void 0)continue;let B=gH(G);if(B&&Q){if(G._def.typeName==="ZodOptional")G=G._def.innerType;if(!G.isNullable())G=G.nullable();B=!1}let w=x(G._def,{...J,currentPath:[...J.currentPath,"properties",Y],propertyPath:[...J.currentPath,"properties",Y]});if(w===void 0)continue;if(W.properties[Y]=w,!B)H.push(Y)}if(H.length)W.required=H;let q=hH($,J);if(q!==void 0)W.additionalProperties=q;return W}function hH($,J){if($.catchall._def.typeName!=="ZodNever")return x($.catchall._def,{...J,currentPath:[...J.currentPath,"additionalProperties"]});switch($.unknownKeys){case"passthrough":return J.allowedAdditionalProperties;case"strict":return J.rejectedAdditionalProperties;case"strip":return J.removeAdditionalStrategy==="strict"?J.allowedAdditionalProperties:J.rejectedAdditionalProperties}}function gH($){try{return $.isOptional()}catch{return!0}}var n2=($,J)=>{if(J.currentPath.toString()===J.propertyPath?.toString())return x($.innerType._def,J);let Q=x($.innerType._def,{...J,currentPath:[...J.currentPath,"anyOf","1"]});return Q?{anyOf:[{not:s(J)},Q]}:s(J)};var d2=($,J)=>{if(J.pipeStrategy==="input")return x($.in._def,J);else if(J.pipeStrategy==="output")return x($.out._def,J);let Q=x($.in._def,{...J,currentPath:[...J.currentPath,"allOf","0"]}),W=x($.out._def,{...J,currentPath:[...J.currentPath,"allOf",Q?"1":"0"]});return{allOf:[Q,W].filter((H)=>H!==void 0)}};function i2($,J){return x($.type._def,J)}function p2($,J){let W={type:"array",uniqueItems:!0,items:x($.valueType._def,{...J,currentPath:[...J.currentPath,"items"]})};if($.minSize)n(W,"minItems",$.minSize.value,$.minSize.message,J);if($.maxSize)n(W,"maxItems",$.maxSize.value,$.maxSize.message,J);return W}function s2($,J){if($.rest)return{type:"array",minItems:$.items.length,items:$.items.map((Q,W)=>x(Q._def,{...J,currentPath:[...J.currentPath,"items",`${W}`]})).reduce((Q,W)=>W===void 0?Q:[...Q,W],[]),additionalItems:x($.rest._def,{...J,currentPath:[...J.currentPath,"additionalItems"]})};else return{type:"array",minItems:$.items.length,maxItems:$.items.length,items:$.items.map((Q,W)=>x(Q._def,{...J,currentPath:[...J.currentPath,"items",`${W}`]})).reduce((Q,W)=>W===void 0?Q:[...Q,W],[])}}function o2($){return{not:s($)}}function r2($){return s($)}var t2=($,J)=>{return x($.innerType._def,J)};var a2=($,J,Q)=>{switch(J){case N.ZodString:return e$($,Q);case N.ZodNumber:return m2($,Q);case N.ZodObject:return c2($,Q);case N.ZodBigInt:return M2($,Q);case N.ZodBoolean:return b2();case N.ZodDate:return V4($,Q);case N.ZodUndefined:return o2(Q);case N.ZodNull:return g2(Q);case N.ZodArray:return O2($,Q);case N.ZodUnion:case N.ZodDiscriminatedUnion:return u2($,Q);case N.ZodIntersection:return K2($,Q);case N.ZodTuple:return s2($,Q);case N.ZodRecord:return $6($,Q);case N.ZodLiteral:return f2($,Q);case N.ZodEnum:return k2($);case N.ZodNativeEnum:return v2($);case N.ZodNullable:return l2($,Q);case N.ZodOptional:return n2($,Q);case N.ZodMap:return x2($,Q);case N.ZodSet:return p2($,Q);case N.ZodLazy:return()=>$.getter()._def;case N.ZodPromise:return i2($,Q);case N.ZodNaN:case N.ZodNever:return h2(Q);case N.ZodEffects:return I2($,Q);case N.ZodAny:return s(Q);case N.ZodUnknown:return r2(Q);case N.ZodDefault:return Z2($,Q);case N.ZodBranded:return a$($,Q);case N.ZodReadonly:return t2($,Q);case N.ZodCatch:return P2($,Q);case N.ZodPipeline:return d2($,Q);case N.ZodFunction:case N.ZodVoid:case N.ZodSymbol:return;default:return((W)=>{return})(J)}};function x($,J,Q=!1){let W=J.seen.get($);if(J.override){let Y=J.override?.($,J,W,Q);if(Y!==D2)return Y}if(W&&!Q){let Y=yH(W,J);if(Y!==void 0)return Y}let H={def:$,path:J.currentPath,jsonSchema:void 0};J.seen.set($,H);let X=a2($,$.typeName,J),q=typeof X==="function"?x(X(),J):X;if(q)uH($,J,q);if(J.postProcess){let Y=J.postProcess(q,$,J);return H.jsonSchema=q,Y}return H.jsonSchema=q,q}var yH=($,J)=>{switch(J.$refStrategy){case"root":return{$ref:$.path.join("/")};case"relative":return{$ref:p$(J.currentPath,$.path)};case"none":case"seen":{if($.path.length<J.currentPath.length&&$.path.every((Q,W)=>J.currentPath[W]===Q))return console.warn(`Recursive reference detected at ${J.currentPath.join("/")}! Defaulting to any`),s(J);return J.$refStrategy==="seen"?s(J):void 0}}},uH=($,J,Q)=>{if($.description){if(Q.description=$.description,J.markdownDescription)Q.markdownDescription=$.description}return Q};var J6=($,J)=>{let Q=_2(J),W=typeof J==="object"&&J.definitions?Object.entries(J.definitions).reduce((G,[B,w])=>({...G,[B]:x(w._def,{...Q,currentPath:[...Q.basePath,Q.definitionPath,B]},!0)??s(Q)}),{}):void 0,H=typeof J==="string"?J:J?.nameStrategy==="title"?void 0:J?.name,X=x($._def,H===void 0?Q:{...Q,currentPath:[...Q.basePath,Q.definitionPath,H]},!1)??s(Q),q=typeof J==="object"&&J.name!==void 0&&J.nameStrategy==="title"?J.name:void 0;if(q!==void 0)X.title=q;if(Q.flags.hasReferencedOpenAiAnyType){if(!W)W={};if(!W[Q.openAiAnyTypeName])W[Q.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:Q.$refStrategy==="relative"?"1":[...Q.basePath,Q.definitionPath,Q.openAiAnyTypeName].join("/")}}}let Y=H===void 0?W?{...X,[Q.definitionPath]:W}:X:{$ref:[...Q.$refStrategy==="relative"?[]:Q.basePath,Q.definitionPath,H].join("/"),[Q.definitionPath]:{...W,[H]:X}};if(Q.target==="jsonSchema7")Y.$schema="http://json-schema.org/draft-07/schema#";else if(Q.target==="jsonSchema2019-09"||Q.target==="openAi")Y.$schema="https://json-schema.org/draft/2019-09/schema#";if(Q.target==="openAi"&&(("anyOf"in Y)||("oneOf"in Y)||("allOf"in Y)||("type"in Y)&&Array.isArray(Y.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return Y};var e2=new WeakMap,$9=0;class p0{spec;generatedSchemas=new Set;constructor($){this.spec=$}convert($,J){try{if(J?.reusable||this.shouldBeReusable($))return this.convertToReusableSchema($,J?.name);return this.convertInline($)}catch(Q){return console.warn("Failed to convert Zod schema to JSON Schema:",Q),{type:"object"}}}convertInline($){let J=J6($,{target:"openApi3",$refStrategy:"none"});if(J&&typeof J==="object")delete J.$schema;return J}convertToReusableSchema($,J){let Q=e2.get($);if(Q&&this.generatedSchemas.has(Q))return{$ref:`#/components/schemas/${Q}`};let W=J||Q||this.generateSchemaName();e2.set($,W),this.generatedSchemas.add(W);let H=this.convertInline($);if(!this.spec.components)this.spec.components={schemas:{}};if(!this.spec.components.schemas)this.spec.components.schemas={};return this.spec.components.schemas[W]=H,{$ref:`#/components/schemas/${W}`}}shouldBeReusable($){let J=this.convertInline($);if(J.type==="object"&&J.properties)return Object.keys(J.properties).length>2;if(J.type==="array"&&J.items){let Q=J.items;if(Q.type==="object"&&Q.properties)return!0}if(J.anyOf||J.oneOf||J.allOf)return!0;return!1}generateSchemaName(){return`Schema${++$9}`}static resetCounter(){$9=0}}function Q6($,J){if(J)return new p0(J).convert($);try{let Q=J6($,{target:"openApi3",$refStrategy:"none"});if(Q&&typeof Q==="object")delete Q.$schema;return Q}catch(Q){return console.warn("Failed to convert Zod schema to JSON Schema:",Q),{type:"object"}}}class B1{metadata;options;converter;constructor($,J){this.metadata=$;this.options={title:J?.title||"Veloce-TS API",version:J?.version||"1.0.0",description:J?.description||"API built with Veloce-TS",path:J?.path||"/openapi.json",docsPath:J?.docsPath||"/docs",docs:J?.docs!==!1}}generate(){let $=this.metadata.getRoutes(),J={openapi:"3.0.0",info:{title:this.options.title,version:this.options.version,description:this.options.description},paths:{},components:{schemas:{}}};this.converter=new p0(J);for(let Q of $)this.addRouteToSpec(J,Q);return J}addRouteToSpec($,J){let Q=this.convertPathToOpenAPI(J.path),W=J.method.toLowerCase();if(W==="all"||W==="options")return;if(!$.paths[Q])$.paths[Q]={};let H={summary:J.docs?.summary,description:J.docs?.description,tags:J.docs?.tags||[],deprecated:J.docs?.deprecated||!1,parameters:this.extractParameters(J,$),responses:this.extractResponses(J,$)},X=this.extractRequestBody(J,$);if(X)H.requestBody=X;if(H.parameters.length===0)delete H.parameters;if(H.tags.length===0)delete H.tags;$.paths[Q][W]=H}extractParameters($,J){let Q=[];for(let W of $.parameters)if(W.type==="query"||W.type==="param"||W.type==="header"||W.type==="cookie"){let H=this.parameterToOpenAPI(W,$.path,J);if(H)Q.push(H)}return Q}extractRequestBody($,J){let Q=$.parameters.find((W)=>W.type==="body");if(!Q||!Q.schema)return null;return{required:Q.required,content:{"application/json":{schema:this.zodToOpenAPISchema(Q.schema,J)}}}}extractResponses($,J){let Q={};if($.responses&&$.responses.length>0)for(let W of $.responses)Q[W.statusCode.toString()]={description:W.description||this.getDefaultResponseDescription(W.statusCode),content:W.schema?{"application/json":{schema:this.zodToOpenAPISchema(W.schema,J)}}:void 0};else Q["200"]={description:"Successful response",content:{"application/json":{schema:{type:"object"}}}};if(!Q["422"])Q["422"]={description:"Validation error",content:{"application/json":{schema:{type:"object",properties:{error:{type:"string"},details:{type:"array",items:{type:"object",properties:{path:{type:"string"},message:{type:"string"},code:{type:"string"}}}}}}}}};return Q}convertPathToOpenAPI($){return $.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g,"{$1}")}parameterToOpenAPI($,J,Q){let W,H;switch($.type){case"query":W="query",H=$.name||"query";break;case"param":if(W="path",$.name)H=$.name;else{let q=J.match(/:([a-zA-Z_][a-zA-Z0-9_]*)/);H=q?q[1]:"id"}break;case"header":W="header",H=$.name||"X-Custom-Header";break;case"cookie":W="cookie",H=$.name||"session";break;default:return null}return{name:H,in:W,required:$.required||W==="path",schema:$.schema?this.zodToOpenAPISchema($.schema,Q):{type:"string"}}}zodToOpenAPISchema($,J){if(!this.converter)this.converter=new p0(J);return this.converter.convert($)}getDefaultResponseDescription($){return{200:"Successful response",201:"Created",204:"No content",400:"Bad request",401:"Unauthorized",403:"Forbidden",404:"Not found",422:"Validation error",500:"Internal server error"}[$]||"Response"}}var mH={};L0(mH,{WebSocketPlugin:()=>y1,OpenAPIPlugin:()=>W6,GraphQLPlugin:()=>A$});module.exports=M0(mH);class W6{name="openapi";version="1.0.0";options;constructor($){this.options={title:$?.title||"Veloce-TS API",version:$?.version||"1.0.0",description:$?.description||"API built with Veloce-TS",path:$?.path||"/openapi.json",docsPath:$?.docsPath||"/docs",docs:$?.docs!==!1}}async install($){let J=$.getConfig();if(J.title)this.options.title=J.title;if(J.version)this.options.version=J.version;if(J.description)this.options.description=J.description;$.get(this.options.path,{handler:async()=>{return this.generateSpec($)},docs:{summary:"Get OpenAPI specification",description:"Returns the OpenAPI 3.0 specification for this API",tags:["Documentation"]}})}generateSpec($){let J=$.getMetadata();return new B1(J,this.options).generate()}renderSwaggerUI(){return`<!DOCTYPE html>
21
21
  <html lang="en">
22
22
  <head>
23
23
  <meta charset="UTF-8">
@@ -53,13 +53,13 @@ and limitations under the License.
53
53
  };
54
54
  </script>
55
55
  </body>
56
- </html>`}}class h1{manager;id;_ws;constructor($,J,Q){this.manager=J;this._ws=$,this.id=Q||crypto.randomUUID()}send($){if(!this._ws||this._ws.readyState!==WebSocket.OPEN)return;let J=typeof $==="string"?$:JSON.stringify($);this._ws.send(J)}broadcast($,J){this.manager.broadcast($,J)}join($){this.manager.joinRoom(this.id,$)}leave($){this.manager.leaveRoom(this.id,$)}close($,J){if(this._ws&&this._ws.readyState===WebSocket.OPEN)this._ws.close($,J)}get native(){return this._ws}get isOpen(){return this._ws!==null&&this._ws.readyState===WebSocket.OPEN}_markClosed(){this._ws=null}}class g1{connections=new Map;rooms=new Map;connectionsByRoom=new Map;handleConnection($,J){let Q=new h1($,this);if(this.connections.set(Q.id,Q),J.onConnect)this.executeHandler(J,J.onConnect,Q);return $.addEventListener("message",async(W)=>{await this.handleMessage(W,Q,J)}),$.addEventListener("close",()=>{this.handleDisconnect(Q,J)}),$.addEventListener("error",(W)=>{console.error(`WebSocket error for connection ${Q.id}:`,W)}),Q}async handleMessage($,J,Q){if(!Q.onMessage)return;let W;try{if(W=typeof $.data==="string"?JSON.parse($.data):$.data,Q.messageSchema)W=await Q.messageSchema.parseAsync(W);await this.executeHandler(Q,Q.onMessage,J,W)}catch(H){J.send({error:"Invalid message format",details:H instanceof Error?H.message:"Unknown error"})}}handleDisconnect($,J){if(Array.from(this.connectionsByRoom.entries()).forEach(([Q,W])=>{if(W.delete($),W.size===0)this.connectionsByRoom.delete(Q)}),Array.from(this.rooms.entries()).forEach(([Q,W])=>{if(W.delete($.id),W.size===0)this.rooms.delete(Q)}),this.connections.delete($.id),$._markClosed(),J.onDisconnect)this.executeHandler(J,J.onDisconnect,$)}async executeHandler($,J,Q,W){try{let H=new $.target,X=H[J];if(typeof X==="function")if(W!==void 0)await X.call(H,Q,W);else await X.call(H,Q)}catch(H){console.error(`Error executing WebSocket handler ${J}:`,H)}}broadcast($,J){let Q=J?this.getConnectionsInRoom(J):Array.from(this.connections.values()),W=typeof $==="string"?$:JSON.stringify($);for(let H of Q)if(H.isOpen)H.send(W)}joinRoom($,J){let Q=this.connections.get($);if(!Q)return;if(!this.rooms.has(J))this.rooms.set(J,new Set);if(this.rooms.get(J).add($),!this.connectionsByRoom.has(J))this.connectionsByRoom.set(J,new Set);this.connectionsByRoom.get(J).add(Q)}leaveRoom($,J){let Q=this.connections.get($);if(!Q)return;let W=this.rooms.get(J);if(W){if(W.delete($),W.size===0)this.rooms.delete(J)}let H=this.connectionsByRoom.get(J);if(H){if(H.delete(Q),H.size===0)this.connectionsByRoom.delete(J)}}getConnectionsInRoom($){let J=this.connectionsByRoom.get($);return J?Array.from(J):[]}getConnection($){return this.connections.get($)}getAllConnections(){return Array.from(this.connections.values())}getConnectionCount(){return this.connections.size}getRooms(){return Array.from(this.rooms.keys())}getRoomSize($){return this.rooms.get($)?.size||0}}class y1{name="websocket";version="1.0.0";manager;constructor(){this.manager=new g1}async install($){let Q=$.getMetadata().getWebSockets();for(let W of Q)this.registerWebSocket($,W)}registerWebSocket($,J){$.getHono().get(J.path,async(W)=>{if(W.req.header("upgrade")?.toLowerCase()!=="websocket")return W.text("Expected WebSocket upgrade",426);return this.handleUpgrade(W,J)})}handleUpgrade($,J){if(typeof Bun<"u")return this.handleBunUpgrade($,J);else if(typeof globalThis.Deno<"u")return this.handleDenoUpgrade($,J);else return this.handleNodeUpgrade($,J)}handleBunUpgrade($,J){if(!$.env?.upgrade?.($.req.raw))return $.text("WebSocket upgrade failed",500);return new Response(null,{status:101})}handleDenoUpgrade($,J){let Q=globalThis.Deno,{socket:W,response:H}=Q.upgradeWebSocket($.req.raw);return W.onopen=()=>{this.manager.handleConnection(W,J)},H}handleNodeUpgrade($,J){return $.text("WebSocket support requires Bun or Deno runtime",501)}getManager(){return this.manager}broadcast($,J){this.manager.broadcast($,J)}getConnectionCount(){return this.manager.getConnectionCount()}getRooms(){return this.manager.getRooms()}}var PV=H$(z$()),z4=Symbol("graphql:resolver"),u1=Symbol("graphql:field"),N$=Symbol("graphql:args");function J9($){return(J)=>{let Q={target:J,name:$||J.name};Reflect.defineMetadata(z4,Q,J)}}function Q9($,J){return N4("query",$,J)}function W9($,J){return N4("mutation",$,J)}function H9($,J){return N4("subscription",$,J)}function N4($,J,Q){return(W,H)=>{let X={target:W.constructor,propertyKey:H,type:$,name:J||H,description:Q?.description,deprecated:Q?.deprecated,deprecationReason:Q?.deprecationReason},q=Reflect.getMetadata(u1,W.constructor)||[];q.push(X),Reflect.defineMetadata(u1,q,W.constructor),Reflect.defineMetadata(u1,X,W,H)}}function X9($,J,Q){return(W,H,X)=>{if(!H)return;let q=Reflect.getMetadata(N$,W,H)||[],Y={index:X,name:$,schema:J,description:Q?.description,defaultValue:Q?.defaultValue,nullable:Q?.nullable};q[X]=Y,Reflect.defineMetadata(N$,q,W,H)}}function q9(){return($,J,Q)=>{if(!J)return;let W=Reflect.getMetadata(N$,$,J)||[],H={index:Q,name:"__context__",nullable:!1};W[Q]=H,Reflect.defineMetadata(N$,W,$,J)}}function Y9($){return Reflect.getMetadata(z4,$)}function G9($){return Reflect.getMetadata(u1,$)||[]}function B9($,J){return Reflect.getMetadata(u1,$,J)}function L$($,J){return Reflect.getMetadata(N$,$,J)||[]}function w9($){return Reflect.hasMetadata(z4,$)}function D9($,J){return Reflect.hasMetadata(u1,$,J)}function T0($){let J=$._def.typeName;if(J==="ZodString")return"String";if(J==="ZodNumber"){if($._def.checks?.some((W)=>W.kind==="int"))return"Int";return"Float"}if(J==="ZodBoolean")return"Boolean";if(J==="ZodArray")return`[${T0($._def.type)}]`;if(J==="ZodObject")return"JSON";if(J==="ZodOptional")return T0($._def.innerType);if(J==="ZodNullable")return T0($._def.innerType);if(J==="ZodDefault")return T0($._def.innerType);if(J==="ZodEnum")return"String";if(J==="ZodUnion"){let Q=$._def.options;if(Q&&Q.length>0)return T0(Q[0])}if(J==="ZodLiteral"){let Q=$._def.value;if(typeof Q==="string")return"String";if(typeof Q==="number")return"Float";if(typeof Q==="boolean")return"Boolean"}if(J==="ZodDate")return"String";return"String"}function w1($){let J=$._def.typeName;if(J==="ZodOptional"||J==="ZodNullable")return!0;if(J==="ZodDefault")return w1($._def.innerType);return!1}function H6($){let J=$._def.typeName;if(J==="ZodDefault")return $._def.defaultValue();if(J==="ZodOptional"||J==="ZodNullable"){let Q=$._def.innerType;if(Q)return H6(Q)}return}function U9($,J){if(J._def.typeName!=="ZodObject")throw Error("Schema must be a ZodObject");let W=J._def.shape(),H=[];for(let[X,q]of Object.entries(W)){let Y=q,G=T0(Y),w=w1(Y)?G:`${G}!`;H.push(` ${X}: ${w}`)}return`type ${$} {
56
+ </html>`}}class h1{manager;id;_ws;constructor($,J,Q){this.manager=J;this._ws=$,this.id=Q||crypto.randomUUID()}send($){if(!this._ws||this._ws.readyState!==WebSocket.OPEN)return;let J=typeof $==="string"?$:JSON.stringify($);this._ws.send(J)}broadcast($,J){this.manager.broadcast($,J)}join($){this.manager.joinRoom(this.id,$)}leave($){this.manager.leaveRoom(this.id,$)}close($,J){if(this._ws&&this._ws.readyState===WebSocket.OPEN)this._ws.close($,J)}get native(){return this._ws}get isOpen(){return this._ws!==null&&this._ws.readyState===WebSocket.OPEN}_markClosed(){this._ws=null}}class g1{connections=new Map;rooms=new Map;connectionsByRoom=new Map;handleConnection($,J){let Q=new h1($,this);if(this.connections.set(Q.id,Q),J.onConnect)this.executeHandler(J,J.onConnect,Q);return $.addEventListener("message",async(W)=>{await this.handleMessage(W,Q,J)}),$.addEventListener("close",()=>{this.handleDisconnect(Q,J)}),$.addEventListener("error",(W)=>{console.error(`WebSocket error for connection ${Q.id}:`,W)}),Q}async handleMessage($,J,Q){if(!Q.onMessage)return;let W;try{if(W=typeof $.data==="string"?JSON.parse($.data):$.data,Q.messageSchema)W=await Q.messageSchema.parseAsync(W);await this.executeHandler(Q,Q.onMessage,J,W)}catch(H){J.send({error:"Invalid message format",details:H instanceof Error?H.message:"Unknown error"})}}handleDisconnect($,J){if(Array.from(this.connectionsByRoom.entries()).forEach(([Q,W])=>{if(W.delete($),W.size===0)this.connectionsByRoom.delete(Q)}),Array.from(this.rooms.entries()).forEach(([Q,W])=>{if(W.delete($.id),W.size===0)this.rooms.delete(Q)}),this.connections.delete($.id),$._markClosed(),J.onDisconnect)this.executeHandler(J,J.onDisconnect,$)}async executeHandler($,J,Q,W){try{let H=new $.target,X=H[J];if(typeof X==="function")if(W!==void 0)await X.call(H,Q,W);else await X.call(H,Q)}catch(H){console.error(`Error executing WebSocket handler ${J}:`,H)}}broadcast($,J){let Q=J?this.getConnectionsInRoom(J):Array.from(this.connections.values()),W=typeof $==="string"?$:JSON.stringify($);for(let H of Q)if(H.isOpen)H.send(W)}joinRoom($,J){let Q=this.connections.get($);if(!Q)return;if(!this.rooms.has(J))this.rooms.set(J,new Set);if(this.rooms.get(J).add($),!this.connectionsByRoom.has(J))this.connectionsByRoom.set(J,new Set);this.connectionsByRoom.get(J).add(Q)}leaveRoom($,J){let Q=this.connections.get($);if(!Q)return;let W=this.rooms.get(J);if(W){if(W.delete($),W.size===0)this.rooms.delete(J)}let H=this.connectionsByRoom.get(J);if(H){if(H.delete(Q),H.size===0)this.connectionsByRoom.delete(J)}}getConnectionsInRoom($){let J=this.connectionsByRoom.get($);return J?Array.from(J):[]}getConnection($){return this.connections.get($)}getAllConnections(){return Array.from(this.connections.values())}getConnectionCount(){return this.connections.size}getRooms(){return Array.from(this.rooms.keys())}getRoomSize($){return this.rooms.get($)?.size||0}}class y1{name="websocket";version="1.0.0";manager;constructor(){this.manager=new g1}async install($){let Q=$.getMetadata().getWebSockets();for(let W of Q)this.registerWebSocket($,W)}registerWebSocket($,J){$.getHono().get(J.path,async(W)=>{if(W.req.header("upgrade")?.toLowerCase()!=="websocket")return W.text("Expected WebSocket upgrade",426);return this.handleUpgrade(W,J)})}handleUpgrade($,J){if(typeof Bun<"u")return this.handleBunUpgrade($,J);else if(typeof globalThis.Deno<"u")return this.handleDenoUpgrade($,J);else return this.handleNodeUpgrade($,J)}handleBunUpgrade($,J){if(!$.env?.upgrade?.($.req.raw))return $.text("WebSocket upgrade failed",500);return new Response(null,{status:101})}handleDenoUpgrade($,J){let Q=globalThis.Deno,{socket:W,response:H}=Q.upgradeWebSocket($.req.raw);return W.onopen=()=>{this.manager.handleConnection(W,J)},H}handleNodeUpgrade($,J){return $.text("WebSocket support requires Bun or Deno runtime",501)}getManager(){return this.manager}broadcast($,J){this.manager.broadcast($,J)}getConnectionCount(){return this.manager.getConnectionCount()}getRooms(){return this.manager.getRooms()}}var PV=X$(N$()),N4=Symbol("graphql:resolver"),u1=Symbol("graphql:field"),L$=Symbol("graphql:args");function Q9($){return(J)=>{let Q={target:J,name:$||J.name};Reflect.defineMetadata(N4,Q,J)}}function W9($,J){return L4("query",$,J)}function H9($,J){return L4("mutation",$,J)}function X9($,J){return L4("subscription",$,J)}function L4($,J,Q){return(W,H)=>{let X={target:W.constructor,propertyKey:H,type:$,name:J||H,description:Q?.description,deprecated:Q?.deprecated,deprecationReason:Q?.deprecationReason},q=Reflect.getMetadata(u1,W.constructor)||[];q.push(X),Reflect.defineMetadata(u1,q,W.constructor),Reflect.defineMetadata(u1,X,W,H)}}function q9($,J,Q){return(W,H,X)=>{if(!H)return;let q=Reflect.getMetadata(L$,W,H)||[],Y={index:X,name:$,schema:J,description:Q?.description,defaultValue:Q?.defaultValue,nullable:Q?.nullable};q[X]=Y,Reflect.defineMetadata(L$,q,W,H)}}function Y9(){return($,J,Q)=>{if(!J)return;let W=Reflect.getMetadata(L$,$,J)||[],H={index:Q,name:"__context__",nullable:!1};W[Q]=H,Reflect.defineMetadata(L$,W,$,J)}}function G9($){return Reflect.getMetadata(N4,$)}function B9($){return Reflect.getMetadata(u1,$)||[]}function w9($,J){return Reflect.getMetadata(u1,$,J)}function j$($,J){return Reflect.getMetadata(L$,$,J)||[]}function D9($){return Reflect.hasMetadata(N4,$)}function U9($,J){return Reflect.hasMetadata(u1,$,J)}function T0($){let J=$._def.typeName;if(J==="ZodString")return"String";if(J==="ZodNumber"){if($._def.checks?.some((W)=>W.kind==="int"))return"Int";return"Float"}if(J==="ZodBoolean")return"Boolean";if(J==="ZodArray")return`[${T0($._def.type)}]`;if(J==="ZodObject")return"JSON";if(J==="ZodOptional")return T0($._def.innerType);if(J==="ZodNullable")return T0($._def.innerType);if(J==="ZodDefault")return T0($._def.innerType);if(J==="ZodEnum")return"String";if(J==="ZodUnion"){let Q=$._def.options;if(Q&&Q.length>0)return T0(Q[0])}if(J==="ZodLiteral"){let Q=$._def.value;if(typeof Q==="string")return"String";if(typeof Q==="number")return"Float";if(typeof Q==="boolean")return"Boolean"}if(J==="ZodDate")return"String";return"String"}function w1($){let J=$._def.typeName;if(J==="ZodOptional"||J==="ZodNullable")return!0;if(J==="ZodDefault")return w1($._def.innerType);return!1}function H6($){let J=$._def.typeName;if(J==="ZodDefault")return $._def.defaultValue();if(J==="ZodOptional"||J==="ZodNullable"){let Q=$._def.innerType;if(Q)return H6(Q)}return}function _9($,J){if(J._def.typeName!=="ZodObject")throw Error("Schema must be a ZodObject");let W=J._def.shape(),H=[];for(let[X,q]of Object.entries(W)){let Y=q,G=T0(Y),w=w1(Y)?G:`${G}!`;H.push(` ${X}: ${w}`)}return`type ${$} {
57
57
  ${H.join(`
58
58
  `)}
59
- }`}function _9($,J){if(J._def.typeName!=="ZodObject")throw Error("Schema must be a ZodObject");let W=J._def.shape(),H=[];for(let[X,q]of Object.entries(W)){let Y=q,G=T0(Y),B=w1(Y),w=H6(Y),_=B?G:`${G}!`;if(w!==void 0){let R=JSON.stringify(w);_+=` = ${R}`}H.push(` ${X}: ${_}`)}return`input ${$} {
59
+ }`}function V9($,J){if(J._def.typeName!=="ZodObject")throw Error("Schema must be a ZodObject");let W=J._def.shape(),H=[];for(let[X,q]of Object.entries(W)){let Y=q,G=T0(Y),B=w1(Y),w=H6(Y),_=B?G:`${G}!`;if(w!==void 0){let R=JSON.stringify(w);_+=` = ${R}`}H.push(` ${X}: ${_}`)}return`input ${$} {
60
60
  ${H.join(`
61
61
  `)}
62
- }`}j$();class e0 extends N0{zodError;constructor($){super(422,"Validation failed");this.zodError=$;this.name="ValidationException"}toJSON(){return{error:"Validation Error",statusCode:this.statusCode,details:this.zodError.errors.map(($)=>({path:$.path.join("."),message:$.message,code:$.code}))}}}class D1{schemaCache=new WeakMap;stats={hits:0,misses:0,validations:0};async validate($,J){this.stats.validations++;try{let Q=this.schemaCache.get(J);if(!Q)this.stats.misses++,Q={schema:J,resultCache:new WeakMap},this.schemaCache.set(J,Q);else this.stats.hits++;return await Q.schema.parseAsync($)}catch(Q){if(Q instanceof X0)throw new e0(Q);throw Q}}validateSync($,J){this.stats.validations++;try{let Q=this.schemaCache.get(J);if(!Q)this.stats.misses++,Q={schema:J,resultCache:new WeakMap},this.schemaCache.set(J,Q);else this.stats.hits++;return Q.schema.parse($)}catch(Q){if(Q instanceof X0)throw new e0(Q);throw Q}}getCacheStats(){let $=this.stats.validations>0?this.stats.hits/this.stats.validations*100:0;return{...this.stats,hitRate:Math.round($*100)/100}}resetStats(){this.stats={hits:0,misses:0,validations:0}}clearCache(){this.schemaCache=new WeakMap,this.resetStats()}}class S${metadata;container;validationEngine;customTypes=new Map;constructor($,J){this.metadata=$;this.container=J;this.validationEngine=new D1}build(){let $=this.metadata.getGraphQLResolvers(),J=[],Q=[],W=[],H=[];for(let Y of $){let G=this.metadata.getGraphQLFieldsByResolver(Y.target);for(let B of G){let w=this.buildFieldDefinition(B);switch(B.type){case"query":J.push(w);break;case"mutation":Q.push(w);break;case"subscription":W.push(w);break}}}let X="";if(this.customTypes.size>0)X+=Array.from(this.customTypes.values()).join(`
62
+ }`}l1();class e0 extends N0{zodError;constructor($){super(422,"Validation failed");this.zodError=$;this.name="ValidationException"}toJSON(){return{error:"Validation Error",statusCode:this.statusCode,details:this.zodError.errors.map(($)=>({path:$.path.join("."),message:$.message,code:$.code}))}}}class D1{schemaCache=new WeakMap;stats={hits:0,misses:0,validations:0};async validate($,J){this.stats.validations++;try{let Q=this.schemaCache.get(J);if(!Q)this.stats.misses++,Q={schema:J,resultCache:new WeakMap},this.schemaCache.set(J,Q);else this.stats.hits++;return await Q.schema.parseAsync($)}catch(Q){if(Q instanceof X0)throw new e0(Q);throw Q}}validateSync($,J){this.stats.validations++;try{let Q=this.schemaCache.get(J);if(!Q)this.stats.misses++,Q={schema:J,resultCache:new WeakMap},this.schemaCache.set(J,Q);else this.stats.hits++;return Q.schema.parse($)}catch(Q){if(Q instanceof X0)throw new e0(Q);throw Q}}getCacheStats(){let $=this.stats.validations>0?this.stats.hits/this.stats.validations*100:0;return{...this.stats,hitRate:Math.round($*100)/100}}resetStats(){this.stats={hits:0,misses:0,validations:0}}clearCache(){this.schemaCache=new WeakMap,this.resetStats()}}class S${metadata;container;validationEngine;customTypes=new Map;constructor($,J){this.metadata=$;this.container=J;this.validationEngine=new D1}build(){let $=this.metadata.getGraphQLResolvers(),J=[],Q=[],W=[],H=[];for(let Y of $){let G=this.metadata.getGraphQLFieldsByResolver(Y.target);for(let B of G){let w=this.buildFieldDefinition(B);switch(B.type){case"query":J.push(w);break;case"mutation":Q.push(w);break;case"subscription":W.push(w);break}}}let X="";if(this.customTypes.size>0)X+=Array.from(this.customTypes.values()).join(`
63
63
 
64
64
  `)+`
65
65
 
@@ -77,7 +77,7 @@ ${H.join(`
77
77
  `,X+=W.map((Y)=>` ${Y}`).join(`
78
78
  `),X+=`
79
79
  }
80
- `;let q=this.buildResolvers();return{typeDefs:X.trim(),resolvers:q}}buildFieldDefinition($){let J=L$($.target.prototype,$.propertyKey),Q=[];for(let q of J){if(q.name==="__context__")continue;let Y="String";if(q.schema){if(Y=T0(q.schema),!w1(q.schema)&&!q.nullable)Y+="!"}let G=`${q.name}: ${Y}`;if(q.defaultValue!==void 0)G+=` = ${JSON.stringify(q.defaultValue)}`;Q.push(G)}let W=Q.length>0?`(${Q.join(", ")})`:"",H="String",X=`${$.name}${W}: ${H}`;if($.deprecated){let q=$.deprecationReason||"No longer supported";X+=` @deprecated(reason: "${q}")`}return X}buildResolvers(){let $=this.metadata.getGraphQLResolvers(),J={Query:{},Mutation:{},Subscription:{}};for(let Q of $){let W=this.metadata.getGraphQLFieldsByResolver(Q.target);for(let H of W){let X=this.createResolverFunction(Q.target,H);switch(H.type){case"query":J.Query[H.name]=X;break;case"mutation":J.Mutation[H.name]=X;break;case"subscription":J.Subscription[H.name]=X;break}}}return J}createResolverFunction($,J){return async(Q,W,H,X)=>{try{let q=L$($.prototype,J.propertyKey),Y=[];for(let w of q)if(w.name==="__context__")Y[w.index]=H;else{let _=W[w.name];if(_===void 0&&w.defaultValue!==void 0)_=w.defaultValue;if(w.schema)_=await this.validationEngine.validate(_,w.schema);Y[w.index]=_}return await(await this.container.resolve($,{scope:"request",context:H.request}))[J.propertyKey](...Y)}catch(q){throw q}}}}class A${name="graphql";version="1.0.0";options;schema;constructor($){this.options={path:$?.path||"/graphql",playgroundPath:$?.playgroundPath||"/graphql/playground",playground:$?.playground!==!1,context:$?.context||((J)=>({request:J}))}}async install($){let J=$.getMetadata(),Q=$.getContainer(),W=new S$(J,Q);if(this.schema=W.build(),$.post(this.options.path,{handler:async(H)=>{return this.handleGraphQLRequest(H)},docs:{summary:"GraphQL endpoint",description:"Execute GraphQL queries and mutations",tags:["GraphQL"]}}),$.get(this.options.path,{handler:async(H)=>{let X=H.req.query("query"),q=H.req.query("variables"),Y=H.req.query("operationName");if(!X)return H.json({error:"Query parameter is required"},400);return this.executeGraphQL(H,{query:X,variables:q?JSON.parse(q):void 0,operationName:Y})},docs:{summary:"GraphQL endpoint (GET)",description:"Execute GraphQL queries via GET request",tags:["GraphQL"]}}),this.options.playground)$.get(this.options.playgroundPath,{handler:async(H)=>{return H.html(this.renderPlayground())},docs:{summary:"GraphQL Playground",description:"Interactive GraphQL IDE",tags:["GraphQL"]}})}async handleGraphQLRequest($){try{let J=await $.req.json();return this.executeGraphQL($,J)}catch(J){return $.json({errors:[{message:"Invalid JSON in request body",extensions:{code:"BAD_REQUEST"}}]},400)}}async executeGraphQL($,J){if(!this.schema)return $.json({errors:[{message:"GraphQL schema not initialized",extensions:{code:"INTERNAL_SERVER_ERROR"}}]},500);try{let{query:Q,variables:W,operationName:H}=J,X=await this.options.context($),q=await this.executeOperation(Q,W,X,H);return $.json(q)}catch(Q){return $.json({errors:[{message:Q.message||"Internal server error",extensions:{code:"INTERNAL_SERVER_ERROR",...{stack:Q.stack}}}]},500)}}async executeOperation($,J,Q,W){return{data:null,errors:[{message:"GraphQL execution not fully implemented. Use a GraphQL library like graphql-js for full support.",extensions:{code:"NOT_IMPLEMENTED"}}]}}renderPlayground(){return`
80
+ `;let q=this.buildResolvers();return{typeDefs:X.trim(),resolvers:q}}buildFieldDefinition($){let J=j$($.target.prototype,$.propertyKey),Q=[];for(let q of J){if(q.name==="__context__")continue;let Y="String";if(q.schema){if(Y=T0(q.schema),!w1(q.schema)&&!q.nullable)Y+="!"}let G=`${q.name}: ${Y}`;if(q.defaultValue!==void 0)G+=` = ${JSON.stringify(q.defaultValue)}`;Q.push(G)}let W=Q.length>0?`(${Q.join(", ")})`:"",H="String",X=`${$.name}${W}: ${H}`;if($.deprecated){let q=$.deprecationReason||"No longer supported";X+=` @deprecated(reason: "${q}")`}return X}buildResolvers(){let $=this.metadata.getGraphQLResolvers(),J={Query:{},Mutation:{},Subscription:{}};for(let Q of $){let W=this.metadata.getGraphQLFieldsByResolver(Q.target);for(let H of W){let X=this.createResolverFunction(Q.target,H);switch(H.type){case"query":J.Query[H.name]=X;break;case"mutation":J.Mutation[H.name]=X;break;case"subscription":J.Subscription[H.name]=X;break}}}return J}createResolverFunction($,J){return async(Q,W,H,X)=>{try{let q=j$($.prototype,J.propertyKey),Y=[];for(let w of q)if(w.name==="__context__")Y[w.index]=H;else{let _=W[w.name];if(_===void 0&&w.defaultValue!==void 0)_=w.defaultValue;if(w.schema)_=await this.validationEngine.validate(_,w.schema);Y[w.index]=_}return await(await this.container.resolve($,{scope:"request",context:H.request}))[J.propertyKey](...Y)}catch(q){throw q}}}}class A${name="graphql";version="1.0.0";options;schema;constructor($){this.options={path:$?.path||"/graphql",playgroundPath:$?.playgroundPath||"/graphql/playground",playground:$?.playground!==!1,context:$?.context||((J)=>({request:J}))}}async install($){let J=$.getMetadata(),Q=$.getContainer(),W=new S$(J,Q);if(this.schema=W.build(),$.post(this.options.path,{handler:async(H)=>{return this.handleGraphQLRequest(H)},docs:{summary:"GraphQL endpoint",description:"Execute GraphQL queries and mutations",tags:["GraphQL"]}}),$.get(this.options.path,{handler:async(H)=>{let X=H.req.query("query"),q=H.req.query("variables"),Y=H.req.query("operationName");if(!X)return H.json({error:"Query parameter is required"},400);return this.executeGraphQL(H,{query:X,variables:q?JSON.parse(q):void 0,operationName:Y})},docs:{summary:"GraphQL endpoint (GET)",description:"Execute GraphQL queries via GET request",tags:["GraphQL"]}}),this.options.playground)$.get(this.options.playgroundPath,{handler:async(H)=>{return H.html(this.renderPlayground())},docs:{summary:"GraphQL Playground",description:"Interactive GraphQL IDE",tags:["GraphQL"]}})}async handleGraphQLRequest($){try{let J=await $.req.json();return this.executeGraphQL($,J)}catch(J){return $.json({errors:[{message:"Invalid JSON in request body",extensions:{code:"BAD_REQUEST"}}]},400)}}async executeGraphQL($,J){if(!this.schema)return $.json({errors:[{message:"GraphQL schema not initialized",extensions:{code:"INTERNAL_SERVER_ERROR"}}]},500);try{let{query:Q,variables:W,operationName:H}=J,X=await this.options.context($),q=await this.executeOperation(Q,W,X,H);return $.json(q)}catch(Q){return $.json({errors:[{message:Q.message||"Internal server error",extensions:{code:"INTERNAL_SERVER_ERROR",...{stack:Q.stack}}}]},500)}}async executeOperation($,J,Q,W){return{data:null,errors:[{message:"GraphQL execution not fully implemented. Use a GraphQL library like graphql-js for full support.",extensions:{code:"NOT_IMPLEMENTED"}}]}}renderPlayground(){return`
81
81
  <!DOCTYPE html>
82
82
  <html lang="en">
83
83
  <head>
@@ -120,7 +120,7 @@ ${H.join(`
120
120
  </script>
121
121
  </body>
122
122
  </html>
123
- `.trim()}getSchema(){return this.schema}}var cH={};L0(cH,{WebSocketPlugin:()=>y1,WebSocketManager:()=>g1,WebSocketConnection:()=>h1,WebSocket:()=>A9,OnMessage:()=>R9,OnDisconnect:()=>C9,OnConnect:()=>E9});module.exports=M0(cH);var oV=H$(z$());var pV=H$(z$()),L4=Symbol("route:metadata"),j4=Symbol("controller:metadata"),L9=Symbol("parameter:metadata"),j9=Symbol("dependency:metadata"),S4=Symbol("websocket:metadata"),S9=Symbol("websocket:handler:metadata"),A4=Symbol("graphql:resolver"),E$=Symbol("graphql:field"),E4=Symbol("auth:metadata"),R4=Symbol("oauth:metadata"),C4=Symbol("roles:metadata"),O4=Symbol("permissions:metadata"),M4=Symbol("minimum-role:metadata"),b4=Symbol("resource-permission:metadata"),P4=Symbol("session:metadata"),Z4=Symbol("csrf:metadata");class T{routes=new Map;controllers=new Map;routesByController=new Map;websockets=new Map;graphqlResolvers=new Map;graphqlFields=new Map;registerRoute($){let J=this.getRouteKey($.target,$.propertyKey);if(this.routes.set(J,$),!this.routesByController.has($.target))this.routesByController.set($.target,[]);this.routesByController.get($.target).push($)}registerController($,J){this.controllers.set($,J)}getRoutes(){return Array.from(this.routes.values())}getRoute($,J){let Q=this.getRouteKey($,J);return this.routes.get(Q)}getRoutesByController($){return this.routesByController.get($)||[]}getController($){return this.controllers.get($)}getControllers(){return new Map(this.controllers)}registerWebSocket($){this.websockets.set($.target,$)}getWebSockets(){return Array.from(this.websockets.values())}getWebSocket($){return this.websockets.get($)}registerGraphQLResolver($){this.graphqlResolvers.set($.target,$)}registerGraphQLField($){let J=this.getRouteKey($.target,$.propertyKey);this.graphqlFields.set(J,$)}getGraphQLResolvers(){return Array.from(this.graphqlResolvers.values())}getGraphQLResolver($){return this.graphqlResolvers.get($)}getGraphQLFields(){return Array.from(this.graphqlFields.values())}getGraphQLFieldsByResolver($){return Array.from(this.graphqlFields.values()).filter((J)=>J.target===$)}clear(){this.routes.clear(),this.controllers.clear(),this.routesByController.clear(),this.websockets.clear(),this.graphqlResolvers.clear(),this.graphqlFields.clear()}getRouteKey($,J){return`${$.name}:${J}`}static defineRoute($,J,Q){let W=this.getRouteMetadata($,J),H={...W,...Q,target:$.constructor,propertyKey:J,middleware:[...W?.middleware||[],...Q.middleware||[]],parameters:Q.parameters||W?.parameters||[],dependencies:Q.dependencies||W?.dependencies||[],responses:Q.responses||W?.responses||[],auth:Q.auth||W?.auth,oauth:Q.oauth||W?.oauth,roles:Q.roles||W?.roles,permissions:Q.permissions||W?.permissions,minimumRole:Q.minimumRole||W?.minimumRole,resourcePermission:Q.resourcePermission||W?.resourcePermission,session:Q.session||W?.session,csrf:Q.csrf||W?.csrf};Reflect.defineMetadata(L4,H,$,J)}static defineParameter($,J,Q,W){let H=this.getParameterMetadata($,J)||[];H[Q]=W,Reflect.defineMetadata(L9,H,$,J);let X=this.getRouteMetadata($,J);this.defineRoute($,J,{...X,parameters:H})}static defineDependency($,J,Q,W){let H=this.getDependencyMetadata($,J)||[];H[Q]=W,Reflect.defineMetadata(j9,H,$,J);let X=this.getRouteMetadata($,J);this.defineRoute($,J,{...X,dependencies:H})}static defineController($,J){Reflect.defineMetadata(j4,J,$)}static getRouteMetadata($,J){return Reflect.getMetadata(L4,$,J)}static getParameterMetadata($,J){return Reflect.getMetadata(L9,$,J)}static getDependencyMetadata($,J){return Reflect.getMetadata(j9,$,J)}static getControllerMetadata($){return Reflect.getMetadata(j4,$)}static hasControllerMetadata($){return Reflect.hasMetadata(j4,$)}static hasRouteMetadata($,J){return Reflect.hasMetadata(L4,$,J)}static getRouteMethods($){let J=$.prototype,Q=[],W=Object.getOwnPropertyNames(J);for(let H of W){if(H==="constructor")continue;if(this.hasRouteMetadata(J,H))Q.push(H)}return Q}static defineWebSocket($,J){let W={...this.getWebSocketMetadata($),...J,target:$};Reflect.defineMetadata(S4,W,$)}static defineWebSocketHandler($,J,Q){let W=this.getWebSocketMetadata($.constructor)||{};switch(Q.type){case"connect":W.onConnect=J;break;case"message":W.onMessage=J,W.messageSchema=Q.schema;break;case"disconnect":W.onDisconnect=J;break}this.defineWebSocket($.constructor,W),Reflect.defineMetadata(S9,Q,$,J)}static getWebSocketMetadata($){return Reflect.getMetadata(S4,$)}static getWebSocketHandlerMetadata($,J){return Reflect.getMetadata(S9,$,J)}static hasWebSocketMetadata($){return Reflect.hasMetadata(S4,$)}static defineGraphQLResolver($,J){Reflect.defineMetadata(A4,J,$)}static defineGraphQLField($,J,Q){Reflect.defineMetadata(E$,Q,$,J);let W=this.getGraphQLFieldsMetadata($.constructor)||[];W.push(Q),Reflect.defineMetadata(E$,W,$.constructor)}static getGraphQLResolverMetadata($){return Reflect.getMetadata(A4,$)}static getGraphQLFieldsMetadata($){return Reflect.getMetadata(E$,$)||[]}static getGraphQLFieldMetadata($,J){return Reflect.getMetadata(E$,$,J)}static hasGraphQLResolverMetadata($){return Reflect.hasMetadata(A4,$)}static hasGraphQLFieldMetadata($,J){return Reflect.hasMetadata(E$,$,J)}static defineAuth($,J,Q){Reflect.defineMetadata(E4,Q,$,J);let W=this.getRouteMetadata($,J);this.defineRoute($,J,{...W,auth:Q})}static getAuthMetadata($,J){return Reflect.getMetadata(E4,$,J)}static hasAuthMetadata($,J){return Reflect.hasMetadata(E4,$,J)}static defineOAuth($,J,Q){Reflect.defineMetadata(R4,Q,$,J);let W=this.getRouteMetadata($,J);this.defineRoute($,J,{...W,oauth:Q})}static getOAuthMetadata($,J){return Reflect.getMetadata(R4,$,J)}static hasOAuthMetadata($,J){return Reflect.hasMetadata(R4,$,J)}static defineRoles($,J,Q){Reflect.defineMetadata(C4,Q,$,J);let W=this.getRouteMetadata($,J);this.defineRoute($,J,{...W,roles:Q})}static definePermissions($,J,Q){Reflect.defineMetadata(O4,Q,$,J);let W=this.getRouteMetadata($,J);this.defineRoute($,J,{...W,permissions:Q})}static defineMinimumRole($,J,Q){Reflect.defineMetadata(M4,Q,$,J);let W=this.getRouteMetadata($,J);this.defineRoute($,J,{...W,minimumRole:Q})}static getRolesMetadata($,J){return Reflect.getMetadata(C4,$,J)}static getPermissionsMetadata($,J){return Reflect.getMetadata(O4,$,J)}static getMinimumRoleMetadata($,J){return Reflect.getMetadata(M4,$,J)}static hasRolesMetadata($,J){return Reflect.hasMetadata(C4,$,J)}static hasPermissionsMetadata($,J){return Reflect.hasMetadata(O4,$,J)}static hasMinimumRoleMetadata($,J){return Reflect.hasMetadata(M4,$,J)}static defineResourcePermission($,J,Q){Reflect.defineMetadata(b4,Q,$,J);let W=this.getRouteMetadata($,J);this.defineRoute($,J,{...W,resourcePermission:Q})}static getResourcePermissionMetadata($,J){return Reflect.getMetadata(b4,$,J)}static hasResourcePermissionMetadata($,J){return Reflect.hasMetadata(b4,$,J)}static defineSession($,J,Q){Reflect.defineMetadata(P4,Q,$,J);let W=this.getRouteMetadata($,J);this.defineRoute($,J,{...W,session:Q})}static defineCSRF($,J,Q){Reflect.defineMetadata(Z4,Q,$,J);let W=this.getRouteMetadata($,J);this.defineRoute($,J,{...W,csrf:Q})}static getSessionMetadata($,J){return Reflect.getMetadata(P4,$,J)}static getCSRFMetadata($,J){return Reflect.getMetadata(Z4,$,J)}static hasSessionMetadata($,J){return Reflect.hasMetadata(P4,$,J)}static hasCSRFMetadata($,J){return Reflect.hasMetadata(Z4,$,J)}}function A9($){return(J)=>{T.defineWebSocket(J,{path:$})}}function E9(){return($,J)=>{T.defineWebSocketHandler($,J,{type:"connect",method:J})}}function R9($){return(J,Q)=>{T.defineWebSocketHandler(J,Q,{type:"message",method:Q,schema:$})}}function C9(){return($,J)=>{T.defineWebSocketHandler($,J,{type:"disconnect",method:J})}}var nH={};L0(nH,{zodToGraphQLType:()=>T0,zodObjectToGraphQLType:()=>U9,zodObjectToGraphQLInput:()=>_9,isNullable:()=>w1,hasResolverMetadata:()=>w9,hasFieldMetadata:()=>D9,getResolverMetadata:()=>Y9,getFieldsMetadata:()=>G9,getFieldMetadata:()=>B9,getDefaultValue:()=>H6,getArgumentsMetadata:()=>L$,Subscription:()=>H9,Resolver:()=>J9,Query:()=>Q9,Mutation:()=>W9,GraphQLSubscription:()=>H9,GraphQLSchemaBuilder:()=>S$,GraphQLQuery:()=>Q9,GraphQLPlugin:()=>A$,GraphQLMutation:()=>W9,GraphQLCtx:()=>q9,GQLSubscription:()=>H9,GQLQuery:()=>Q9,GQLMutation:()=>W9,GQLContext:()=>q9,Arg:()=>X9});module.exports=M0(nH);var dH={};L0(dH,{z:()=>z});module.exports=M0(dH);var UX={};L0(UX,{setupTestApp:()=>s4,mockDependency:()=>p4,createTestClient:()=>C6,createTestApp:()=>R6,clearMocks:()=>o4,TestClient:()=>l1});module.exports=M0(UX);class l1{hono;constructor($){this.hono=$.getHono()}async get($,J){return this.request("GET",$,J)}async post($,J){return this.request("POST",$,J)}async put($,J){return this.request("PUT",$,J)}async delete($,J){return this.request("DELETE",$,J)}async patch($,J){return this.request("PATCH",$,J)}async request($,J,Q){let W=this.buildUrl(J,Q?.query),H={method:$,headers:this.buildHeaders(Q)};if(Q?.body!==void 0)H.body=Q.body;else if(Q?.json!==void 0)H.body=JSON.stringify(Q.json);let X=await this.hono.request(W,H),q=await X.text(),Y;try{Y=JSON.parse(q)}catch{Y=q}return{status:X.status,headers:X.headers,body:Y,text:q,json:async()=>JSON.parse(q),ok:X.ok}}buildUrl($,J){if(!J||Object.keys(J).length===0)return $;let Q=new URLSearchParams(J).toString();return`${$}?${Q}`}buildHeaders($){let J={...$?.headers};if($?.json!==void 0&&!J["Content-Type"])J["Content-Type"]="application/json";return J}}var I4=($,J,Q)=>{return(W,H)=>{let X=-1;return q(0);async function q(Y){if(Y<=X)throw Error("next() called multiple times");X=Y;let G,B=!1,w;if($[Y])w=$[Y][0][0],W.req.routeIndex=Y;else w=Y===$.length&&H||void 0;if(w)try{G=await w(W,()=>q(Y+1))}catch(_){if(_ instanceof Error&&J)W.error=_,G=await J(_,W),B=!0;else throw _}else if(W.finalized===!1&&Q)G=await Q(W);if(G&&(W.finalized===!1||B))W.res=G;return W}}};var O9=Symbol();var M9=async($,J=Object.create(null))=>{let{all:Q=!1,dot:W=!1}=J,X=($ instanceof X6?$.raw.headers:$.headers).get("Content-Type");if(X?.startsWith("multipart/form-data")||X?.startsWith("application/x-www-form-urlencoded"))return iH($,{all:Q,dot:W});return{}};async function iH($,J){let Q=await $.formData();if(Q)return pH(Q,J);return{}}function pH($,J){let Q=Object.create(null);if($.forEach((W,H)=>{if(!(J.all||H.endsWith("[]")))Q[H]=W;else sH(Q,H,W)}),J.dot)Object.entries(Q).forEach(([W,H])=>{if(W.includes("."))oH(Q,W,H),delete Q[W]});return Q}var sH=($,J,Q)=>{if($[J]!==void 0)if(Array.isArray($[J]))$[J].push(Q);else $[J]=[$[J],Q];else if(!J.endsWith("[]"))$[J]=Q;else $[J]=[Q]},oH=($,J,Q)=>{let W=$,H=J.split(".");H.forEach((X,q)=>{if(q===H.length-1)W[X]=Q;else{if(!W[X]||typeof W[X]!=="object"||Array.isArray(W[X])||W[X]instanceof File)W[X]=Object.create(null);W=W[X]}})};var K4=($)=>{let J=$.split("/");if(J[0]==="")J.shift();return J},b9=($)=>{let{groups:J,path:Q}=rH($),W=K4(Q);return tH(W,J)},rH=($)=>{let J=[];return $=$.replace(/\{[^}]+\}/g,(Q,W)=>{let H=`@${W}`;return J.push([H,Q]),H}),{groups:J,path:$}},tH=($,J)=>{for(let Q=J.length-1;Q>=0;Q--){let[W]=J[Q];for(let H=$.length-1;H>=0;H--)if($[H].includes(W)){$[H]=$[H].replace(W,J[Q][1]);break}}return $},q6={},P9=($,J)=>{if($==="*")return"*";let Q=$.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(Q){let W=`${$}#${J}`;if(!q6[W])if(Q[2])q6[W]=J&&J[0]!==":"&&J[0]!=="*"?[W,Q[1],new RegExp(`^${Q[2]}(?=/${J})`)]:[$,Q[1],new RegExp(`^${Q[2]}$`)];else q6[W]=[$,Q[1],!0];return q6[W]}return null},m1=($,J)=>{try{return J($)}catch{return $.replace(/(?:%[0-9A-Fa-f]{2})+/g,(Q)=>{try{return J(Q)}catch{return Q}})}},aH=($)=>m1($,decodeURI),f4=($)=>{let J=$.url,Q=J.indexOf("/",J.indexOf(":")+4),W=Q;for(;W<J.length;W++){let H=J.charCodeAt(W);if(H===37){let X=J.indexOf("?",W),q=J.slice(Q,X===-1?void 0:X);return aH(q.includes("%25")?q.replace(/%25/g,"%2525"):q)}else if(H===63)break}return J.slice(Q,W)};var Z9=($)=>{let J=f4($);return J.length>1&&J.at(-1)==="/"?J.slice(0,-1):J},U1=($,J,...Q)=>{if(Q.length)J=U1(J,...Q);return`${$?.[0]==="/"?"":"/"}${$}${J==="/"?"":`${$?.at(-1)==="/"?"":"/"}${J?.[0]==="/"?J.slice(1):J}`}`},Y6=($)=>{if($.charCodeAt($.length-1)!==63||!$.includes(":"))return null;let J=$.split("/"),Q=[],W="";return J.forEach((H)=>{if(H!==""&&!/\:/.test(H))W+="/"+H;else if(/\:/.test(H))if(/\?/.test(H)){if(Q.length===0&&W==="")Q.push("/");else Q.push(W);let X=H.replace("?","");W+="/"+X,Q.push(W)}else W+="/"+H}),Q.filter((H,X,q)=>q.indexOf(H)===X)},k4=($)=>{if(!/[%+]/.test($))return $;if($.indexOf("+")!==-1)$=$.replace(/\+/g," ");return $.indexOf("%")!==-1?m1($,R$):$},I9=($,J,Q)=>{let W;if(!Q&&J&&!/[%+]/.test(J)){let q=$.indexOf(`?${J}`,8);if(q===-1)q=$.indexOf(`&${J}`,8);while(q!==-1){let Y=$.charCodeAt(q+J.length+1);if(Y===61){let G=q+J.length+2,B=$.indexOf("&",G);return k4($.slice(G,B===-1?void 0:B))}else if(Y==38||isNaN(Y))return"";q=$.indexOf(`&${J}`,q+1)}if(W=/[%+]/.test($),!W)return}let H={};W??=/[%+]/.test($);let X=$.indexOf("?",8);while(X!==-1){let q=$.indexOf("&",X+1),Y=$.indexOf("=",X);if(Y>q&&q!==-1)Y=-1;let G=$.slice(X+1,Y===-1?q===-1?void 0:q:Y);if(W)G=k4(G);if(X=q,G==="")continue;let B;if(Y===-1)B="";else if(B=$.slice(Y+1,q===-1?void 0:q),W)B=k4(B);if(Q){if(!(H[G]&&Array.isArray(H[G])))H[G]=[];H[G].push(B)}else H[G]??=B}return J?H[J]:H},k9=I9,K9=($,J)=>{return I9($,J,!0)},R$=decodeURIComponent;var f9=($)=>m1($,R$),X6=class{raw;#J;#$;routeIndex=0;path;bodyCache={};constructor($,J="/",Q=[[]]){this.raw=$,this.path=J,this.#$=Q,this.#J={}}param($){return $?this.#Q($):this.#X()}#Q($){let J=this.#$[0][this.routeIndex][1][$],Q=this.#H(J);return Q&&/\%/.test(Q)?f9(Q):Q}#X(){let $={},J=Object.keys(this.#$[0][this.routeIndex][1]);for(let Q of J){let W=this.#H(this.#$[0][this.routeIndex][1][Q]);if(W!==void 0)$[Q]=/\%/.test(W)?f9(W):W}return $}#H($){return this.#$[1]?this.#$[1][$]:$}query($){return k9(this.url,$)}queries($){return K9(this.url,$)}header($){if($)return this.raw.headers.get($)??void 0;let J={};return this.raw.headers.forEach((Q,W)=>{J[W]=Q}),J}async parseBody($){return this.bodyCache.parsedBody??=await M9(this,$)}#W=($)=>{let{bodyCache:J,raw:Q}=this,W=J[$];if(W)return W;let H=Object.keys(J)[0];if(H)return J[H].then((X)=>{if(H==="json")X=JSON.stringify(X);return new Response(X)[$]()});return J[$]=Q[$]()};json(){return this.#W("text").then(($)=>JSON.parse($))}text(){return this.#W("text")}arrayBuffer(){return this.#W("arrayBuffer")}blob(){return this.#W("blob")}formData(){return this.#W("formData")}addValidatedData($,J){this.#J[$]=J}valid($){return this.#J[$]}get url(){return this.raw.url}get method(){return this.raw.method}get[O9](){return this.#$}get matchedRoutes(){return this.#$[0].map(([[,$]])=>$)}get routePath(){return this.#$[0].map(([[,$]])=>$)[this.routeIndex].path}};var T9={Stringify:1,BeforeStream:2,Stream:3},eH=($,J)=>{let Q=new String($);return Q.isEscaped=!0,Q.callbacks=J,Q};var T4=async($,J,Q,W,H)=>{if(typeof $==="object"&&!($ instanceof String)){if(!($ instanceof Promise))$=$.toString();if($ instanceof Promise)$=await $}let X=$.callbacks;if(!X?.length)return Promise.resolve($);if(H)H[0]+=$;else H=[$];let q=Promise.all(X.map((Y)=>Y({phase:J,buffer:H,context:W}))).then((Y)=>Promise.all(Y.filter(Boolean).map((G)=>T4(G,J,!1,W,H))).then(()=>H[0]));if(Q)return eH(await q,X);else return q};var $X="text/plain; charset=UTF-8",x4=($,J)=>{return{"Content-Type":$,...J}},x9=class{#J;#$;env={};#Q;finalized=!1;error;#X;#H;#W;#w;#G;#B;#Y;#D;#U;constructor($,J){if(this.#J=$,J)this.#H=J.executionCtx,this.env=J.env,this.#B=J.notFoundHandler,this.#U=J.path,this.#D=J.matchResult}get req(){return this.#$??=new X6(this.#J,this.#U,this.#D),this.#$}get event(){if(this.#H&&"respondWith"in this.#H)return this.#H;else throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#H)return this.#H;else throw Error("This context has no ExecutionContext")}get res(){return this.#W||=new Response(null,{headers:this.#Y??=new Headers})}set res($){if(this.#W&&$){$=new Response($.body,$);for(let[J,Q]of this.#W.headers.entries()){if(J==="content-type")continue;if(J==="set-cookie"){let W=this.#W.headers.getSetCookie();$.headers.delete("set-cookie");for(let H of W)$.headers.append("set-cookie",H)}else $.headers.set(J,Q)}}this.#W=$,this.finalized=!0}render=(...$)=>{return this.#G??=(J)=>this.html(J),this.#G(...$)};setLayout=($)=>this.#w=$;getLayout=()=>this.#w;setRenderer=($)=>{this.#G=$};header=($,J,Q)=>{if(this.finalized)this.#W=new Response(this.#W.body,this.#W);let W=this.#W?this.#W.headers:this.#Y??=new Headers;if(J===void 0)W.delete($);else if(Q?.append)W.append($,J);else W.set($,J)};status=($)=>{this.#X=$};set=($,J)=>{this.#Q??=new Map,this.#Q.set($,J)};get=($)=>{return this.#Q?this.#Q.get($):void 0};get var(){if(!this.#Q)return{};return Object.fromEntries(this.#Q)}#q($,J,Q){let W=this.#W?new Headers(this.#W.headers):this.#Y??new Headers;if(typeof J==="object"&&"headers"in J){let X=J.headers instanceof Headers?J.headers:new Headers(J.headers);for(let[q,Y]of X)if(q.toLowerCase()==="set-cookie")W.append(q,Y);else W.set(q,Y)}if(Q)for(let[X,q]of Object.entries(Q))if(typeof q==="string")W.set(X,q);else{W.delete(X);for(let Y of q)W.append(X,Y)}let H=typeof J==="number"?J:J?.status??this.#X;return new Response($,{status:H,headers:W})}newResponse=(...$)=>this.#q(...$);body=($,J,Q)=>this.#q($,J,Q);text=($,J,Q)=>{return!this.#Y&&!this.#X&&!J&&!Q&&!this.finalized?new Response($):this.#q($,J,x4($X,Q))};json=($,J,Q)=>{return this.#q(JSON.stringify($),J,x4("application/json",Q))};html=($,J,Q)=>{let W=(H)=>this.#q(H,J,x4("text/html; charset=UTF-8",Q));return typeof $==="object"?T4($,T9.Stringify,!1,{}).then(W):W($)};redirect=($,J)=>{let Q=String($);return this.header("Location",!/[^\x00-\xFF]/.test(Q)?Q:encodeURI(Q)),this.newResponse(null,J??302)};notFound=()=>{return this.#B??=()=>new Response,this.#B(this)}};var a="ALL",v9="all",h9=["get","post","put","delete","options","patch"],G6="Can not add a route since the matcher is already built.",B6=class extends Error{};var g9="__COMPOSED_HANDLER";var JX=($)=>{return $.text("404 Not Found",404)},y9=($,J)=>{if("getResponse"in $){let Q=$.getResponse();return J.newResponse(Q.body,Q)}return console.error($),J.text("Internal Server Error",500)},v4=class{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#J="/";routes=[];constructor($={}){[...h9,v9].forEach((H)=>{this[H]=(X,...q)=>{if(typeof X==="string")this.#J=X;else this.#X(H,this.#J,X);return q.forEach((Y)=>{this.#X(H,this.#J,Y)}),this}}),this.on=(H,X,...q)=>{for(let Y of[X].flat()){this.#J=Y;for(let G of[H].flat())q.map((B)=>{this.#X(G.toUpperCase(),this.#J,B)})}return this},this.use=(H,...X)=>{if(typeof H==="string")this.#J=H;else this.#J="*",X.unshift(H);return X.forEach((q)=>{this.#X(a,this.#J,q)}),this};let{strict:Q,...W}=$;Object.assign(this,W),this.getPath=Q??!0?$.getPath??f4:Z9}#$(){let $=new v4({router:this.router,getPath:this.getPath});return $.errorHandler=this.errorHandler,$.#Q=this.#Q,$.routes=this.routes,$}#Q=JX;errorHandler=y9;route($,J){let Q=this.basePath($);return J.routes.map((W)=>{let H;if(J.errorHandler===y9)H=W.handler;else H=async(X,q)=>(await I4([],J.errorHandler)(X,()=>W.handler(X,q))).res,H[g9]=W.handler;Q.#X(W.method,W.path,H)}),this}basePath($){let J=this.#$();return J._basePath=U1(this._basePath,$),J}onError=($)=>{return this.errorHandler=$,this};notFound=($)=>{return this.#Q=$,this};mount($,J,Q){let W,H;if(Q)if(typeof Q==="function")H=Q;else if(H=Q.optionHandler,Q.replaceRequest===!1)W=(Y)=>Y;else W=Q.replaceRequest;let X=H?(Y)=>{let G=H(Y);return Array.isArray(G)?G:[G]}:(Y)=>{let G=void 0;try{G=Y.executionCtx}catch{}return[Y.env,G]};W||=(()=>{let Y=U1(this._basePath,$),G=Y==="/"?0:Y.length;return(B)=>{let w=new URL(B.url);return w.pathname=w.pathname.slice(G)||"/",new Request(w,B)}})();let q=async(Y,G)=>{let B=await J(W(Y.req.raw),...X(Y));if(B)return B;await G()};return this.#X(a,U1($,"*"),q),this}#X($,J,Q){$=$.toUpperCase(),J=U1(this._basePath,J);let W={basePath:this._basePath,path:J,method:$,handler:Q};this.router.add($,J,[Q,W]),this.routes.push(W)}#H($,J){if($ instanceof Error)return this.errorHandler($,J);throw $}#W($,J,Q,W){if(W==="HEAD")return(async()=>new Response(null,await this.#W($,J,Q,"GET")))();let H=this.getPath($,{env:Q}),X=this.router.match(W,H),q=new x9($,{path:H,matchResult:X,env:Q,executionCtx:J,notFoundHandler:this.#Q});if(X[0].length===1){let G;try{G=X[0][0][0][0](q,async()=>{q.res=await this.#Q(q)})}catch(B){return this.#H(B,q)}return G instanceof Promise?G.then((B)=>B||(q.finalized?q.res:this.#Q(q))).catch((B)=>this.#H(B,q)):G??this.#Q(q)}let Y=I4(X[0],this.errorHandler,this.#Q);return(async()=>{try{let G=await Y(q);if(!G.finalized)throw Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return G.res}catch(G){return this.#H(G,q)}})()}fetch=($,...J)=>{return this.#W($,J[1],J[0],$.method)};request=($,J,Q,W)=>{if($ instanceof Request)return this.fetch(J?new Request($,J):$,Q,W);return $=$.toString(),this.fetch(new Request(/^https?:\/\//.test($)?$:`http://localhost${U1("/",$)}`,J),Q,W)};fire=()=>{addEventListener("fetch",($)=>{$.respondWith(this.#W($.request,$,void 0,$.request.method))})}};var w6="[^/]+",C$=".*",O$="(?:|/.*)",_1=Symbol(),QX=new Set(".\\+*[^]$()");function WX($,J){if($.length===1)return J.length===1?$<J?-1:1:-1;if(J.length===1)return 1;if($===C$||$===O$)return 1;else if(J===C$||J===O$)return-1;if($===w6)return 1;else if(J===w6)return-1;return $.length===J.length?$<J?-1:1:J.length-$.length}var D6=class{#J;#$;#Q=Object.create(null);insert($,J,Q,W,H){if($.length===0){if(this.#J!==void 0)throw _1;if(H)return;this.#J=J;return}let[X,...q]=$,Y=X==="*"?q.length===0?["","",C$]:["","",w6]:X==="/*"?["","",O$]:X.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),G;if(Y){let B=Y[1],w=Y[2]||w6;if(B&&Y[2]){if(w===".*")throw _1;if(w=w.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(w))throw _1}if(G=this.#Q[w],!G){if(Object.keys(this.#Q).some((_)=>_!==C$&&_!==O$))throw _1;if(H)return;if(G=this.#Q[w]=new D6,B!=="")G.#$=W.varIndex++}if(!H&&B!=="")Q.push([B,G.#$])}else if(G=this.#Q[X],!G){if(Object.keys(this.#Q).some((B)=>B.length>1&&B!==C$&&B!==O$))throw _1;if(H)return;G=this.#Q[X]=new D6}G.insert(q,J,Q,W,H)}buildRegExpStr(){let J=Object.keys(this.#Q).sort(WX).map((Q)=>{let W=this.#Q[Q];return(typeof W.#$==="number"?`(${Q})@${W.#$}`:QX.has(Q)?`\\${Q}`:Q)+W.buildRegExpStr()});if(typeof this.#J==="number")J.unshift(`#${this.#J}`);if(J.length===0)return"";if(J.length===1)return J[0];return"(?:"+J.join("|")+")"}};var u9=class{#J={varIndex:0};#$=new D6;insert($,J,Q){let W=[],H=[];for(let q=0;;){let Y=!1;if($=$.replace(/\{[^}]+\}/g,(G)=>{let B=`@\\${q}`;return H[q]=[B,G],q++,Y=!0,B}),!Y)break}let X=$.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let q=H.length-1;q>=0;q--){let[Y]=H[q];for(let G=X.length-1;G>=0;G--)if(X[G].indexOf(Y)!==-1){X[G]=X[G].replace(Y,H[q][1]);break}}return this.#$.insert(X,J,W,this.#J,Q),W}buildRegExp(){let $=this.#$.buildRegExpStr();if($==="")return[/^$/,[],[]];let J=0,Q=[],W=[];return $=$.replace(/#(\d+)|@(\d+)|\.\*\$/g,(H,X,q)=>{if(X!==void 0)return Q[++J]=Number(X),"$()";if(q!==void 0)return W[Number(q)]=++J,"";return""}),[new RegExp(`^${$}`),Q,W]}};var l9=[],HX=[/^$/,[],Object.create(null)],m9=Object.create(null);function c9($){return m9[$]??=new RegExp($==="*"?"":`^${$.replace(/\/\*$|([.\\+*[^\]$()])/g,(J,Q)=>Q?`\\${Q}`:"(?:|/.*)")}$`)}function XX(){m9=Object.create(null)}function qX($){let J=new u9,Q=[];if($.length===0)return HX;let W=$.map((B)=>[!/\*|\/:/.test(B[0]),...B]).sort(([B,w],[_,R])=>B?1:_?-1:w.length-R.length),H=Object.create(null);for(let B=0,w=-1,_=W.length;B<_;B++){let[R,S,P]=W[B];if(R)H[S]=[P.map(([o])=>[o,Object.create(null)]),l9];else w++;let h;try{h=J.insert(S,w,R)}catch(o){throw o===_1?new B6(S):o}if(R)continue;Q[w]=P.map(([o,W0])=>{let z0=Object.create(null);W0-=1;for(;W0>=0;W0--){let[t,R0]=h[W0];z0[t]=R0}return[o,z0]})}let[X,q,Y]=J.buildRegExp();for(let B=0,w=Q.length;B<w;B++)for(let _=0,R=Q[B].length;_<R;_++){let S=Q[B][_]?.[1];if(!S)continue;let P=Object.keys(S);for(let h=0,o=P.length;h<o;h++)S[P[h]]=Y[S[P[h]]]}let G=[];for(let B in q)G[B]=Q[q[B]];return[X,G,H]}function c1($,J){if(!$)return;for(let Q of Object.keys($).sort((W,H)=>H.length-W.length))if(c9(Q).test(J))return[...$[Q]];return}var h4=class{name="RegExpRouter";#J;#$;constructor(){this.#J={[a]:Object.create(null)},this.#$={[a]:Object.create(null)}}add($,J,Q){let W=this.#J,H=this.#$;if(!W||!H)throw Error(G6);if(!W[$])[W,H].forEach((Y)=>{Y[$]=Object.create(null),Object.keys(Y[a]).forEach((G)=>{Y[$][G]=[...Y[a][G]]})});if(J==="/*")J="*";let X=(J.match(/\/:/g)||[]).length;if(/\*$/.test(J)){let Y=c9(J);if($===a)Object.keys(W).forEach((G)=>{W[G][J]||=c1(W[G],J)||c1(W[a],J)||[]});else W[$][J]||=c1(W[$],J)||c1(W[a],J)||[];Object.keys(W).forEach((G)=>{if($===a||$===G)Object.keys(W[G]).forEach((B)=>{Y.test(B)&&W[G][B].push([Q,X])})}),Object.keys(H).forEach((G)=>{if($===a||$===G)Object.keys(H[G]).forEach((B)=>Y.test(B)&&H[G][B].push([Q,X]))});return}let q=Y6(J)||[J];for(let Y=0,G=q.length;Y<G;Y++){let B=q[Y];Object.keys(H).forEach((w)=>{if($===a||$===w)H[w][B]||=[...c1(W[w],B)||c1(W[a],B)||[]],H[w][B].push([Q,X-G+Y+1])})}}match($,J){XX();let Q=this.#Q();return this.match=(W,H)=>{let X=Q[W]||Q[a],q=X[2][H];if(q)return q;let Y=H.match(X[0]);if(!Y)return[[],l9];let G=Y.indexOf("",1);return[X[1][G],Y]},this.match($,J)}#Q(){let $=Object.create(null);return Object.keys(this.#$).concat(Object.keys(this.#J)).forEach((J)=>{$[J]||=this.#X(J)}),this.#J=this.#$=void 0,$}#X($){let J=[],Q=$===a;if([this.#J,this.#$].forEach((W)=>{let H=W[$]?Object.keys(W[$]).map((X)=>[X,W[$][X]]):[];if(H.length!==0)Q||=!0,J.push(...H);else if($!==a)J.push(...Object.keys(W[a]).map((X)=>[X,W[a][X]]))}),!Q)return null;else return qX(J)}};var g4=class{name="SmartRouter";#J=[];#$=[];constructor($){this.#J=$.routers}add($,J,Q){if(!this.#$)throw Error(G6);this.#$.push([$,J,Q])}match($,J){if(!this.#$)throw Error("Fatal error");let Q=this.#J,W=this.#$,H=Q.length,X=0,q;for(;X<H;X++){let Y=Q[X];try{for(let G=0,B=W.length;G<B;G++)Y.add(...W[G]);q=Y.match($,J)}catch(G){if(G instanceof B6)continue;throw G}this.match=Y.match.bind(Y),this.#J=[Y],this.#$=void 0;break}if(X===H)throw Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,q}get activeRouter(){if(this.#$||this.#J.length!==1)throw Error("No active router has been determined yet.");return this.#J[0]}};var M$=Object.create(null),y4=class{#J;#$;#Q;#X=0;#H=M$;constructor($,J,Q){if(this.#$=Q||Object.create(null),this.#J=[],$&&J){let W=Object.create(null);W[$]={handler:J,possibleKeys:[],score:0},this.#J=[W]}this.#Q=[]}insert($,J,Q){this.#X=++this.#X;let W=this,H=b9(J),X=[];for(let q=0,Y=H.length;q<Y;q++){let G=H[q],B=H[q+1],w=P9(G,B),_=Array.isArray(w)?w[0]:G;if(_ in W.#$){if(W=W.#$[_],w)X.push(w[1]);continue}if(W.#$[_]=new y4,w)W.#Q.push(w),X.push(w[1]);W=W.#$[_]}return W.#J.push({[$]:{handler:Q,possibleKeys:X.filter((q,Y,G)=>G.indexOf(q)===Y),score:this.#X}}),W}#W($,J,Q,W){let H=[];for(let X=0,q=$.#J.length;X<q;X++){let Y=$.#J[X],G=Y[J]||Y[a],B={};if(G!==void 0){if(G.params=Object.create(null),H.push(G),Q!==M$||W&&W!==M$)for(let w=0,_=G.possibleKeys.length;w<_;w++){let R=G.possibleKeys[w],S=B[G.score];G.params[R]=W?.[R]&&!S?W[R]:Q[R]??W?.[R],B[G.score]=!0}}}return H}search($,J){let Q=[];this.#H=M$;let H=[this],X=K4(J),q=[];for(let Y=0,G=X.length;Y<G;Y++){let B=X[Y],w=Y===G-1,_=[];for(let R=0,S=H.length;R<S;R++){let P=H[R],h=P.#$[B];if(h)if(h.#H=P.#H,w){if(h.#$["*"])Q.push(...this.#W(h.#$["*"],$,P.#H));Q.push(...this.#W(h,$,P.#H))}else _.push(h);for(let o=0,W0=P.#Q.length;o<W0;o++){let z0=P.#Q[o],t=P.#H===M$?{}:{...P.#H};if(z0==="*"){let h0=P.#$["*"];if(h0)Q.push(...this.#W(h0,$,P.#H)),h0.#H=t,_.push(h0);continue}let[R0,H0,U0]=z0;if(!B&&!(U0 instanceof RegExp))continue;let C0=P.#$[R0],W4=X.slice(Y).join("/");if(U0 instanceof RegExp){let h0=U0.exec(W4);if(h0){if(t[H0]=h0[0],Q.push(...this.#W(C0,$,P.#H,t)),Object.keys(C0.#$).length){C0.#H=t;let H4=h0[0].match(/\//)?.length??0;(q[H4]||=[]).push(C0)}continue}}if(U0===!0||U0.test(B))if(t[H0]=B,w){if(Q.push(...this.#W(C0,$,t,P.#H)),C0.#$["*"])Q.push(...this.#W(C0.#$["*"],$,t,P.#H))}else C0.#H=t,_.push(C0)}}H=_.concat(q.shift()??[])}if(Q.length>1)Q.sort((Y,G)=>{return Y.score-G.score});return[Q.map(({handler:Y,params:G})=>[Y,G])]}};var u4=class{name="TrieRouter";#J;constructor(){this.#J=new y4}add($,J,Q){let W=Y6(J);if(W){for(let H=0,X=W.length;H<X;H++)this.#J.insert($,W[H],Q);return}this.#J.insert($,J,Q)}match($,J){return this.#J.search($,J)}};var l4=class extends v4{constructor($={}){super($);this.router=$.router??new g4({routers:[new h4,new u4]})}};class b${singletons=new Map;requestScoped=new WeakMap;providers=new Map;resolutionStack=new Set;providerNameCache=new WeakMap;stats={singletonHits:0,singletonMisses:0,requestHits:0,requestMisses:0,transientCreations:0};register($,J){this.providers.set($,J||{scope:"transient"})}async resolve($,J){let Q=this.providers.get($)||{scope:J?.scope||"transient"},W=J?.scope||Q.scope||"transient";if(W==="singleton"){if(this.singletons.has($))return this.stats.singletonHits++,this.singletons.get($);if(this.stats.singletonMisses++,this.resolutionStack.has($))throw Error(`Circular dependency detected: ${this.buildCircularDependencyMessage($)}`);this.resolutionStack.add($);try{let H=await this.create($,Q,J?.context);return this.singletons.set($,H),H}finally{this.resolutionStack.delete($)}}if(W==="request"&&J?.context){let H=this.requestScoped.get(J.context);if(H?.has($))return this.stats.requestHits++,H.get($);if(this.stats.requestMisses++,!H)H=new Map,this.requestScoped.set(J.context,H);if(this.resolutionStack.has($))throw Error(`Circular dependency detected: ${this.buildCircularDependencyMessage($)}`);this.resolutionStack.add($);try{let X=await this.create($,Q,J.context);return H.set($,X),X}finally{this.resolutionStack.delete($)}}if(this.stats.transientCreations++,this.resolutionStack.has($))throw Error(`Circular dependency detected: ${this.buildCircularDependencyMessage($)}`);this.resolutionStack.add($);try{return await this.create($,Q,J?.context)}finally{this.resolutionStack.delete($)}}buildCircularDependencyMessage($){let J=Array.from(this.resolutionStack),Q=this.getProviderName($);return J.map((H)=>this.getProviderName(H)).join(" -> ")+" -> "+Q}async create($,J,Q){if(J.factory)return J.factory();if(typeof $==="function")if($.prototype&&$.prototype.constructor===$){let W=new $;return await this.resolveNestedDependencies(W,Q),W}else{let W=$();return W instanceof Promise?await W:W}throw Error("Invalid provider type")}async resolveNestedDependencies($,J){}getProviderName($){let J=this.providerNameCache.get($);if(J)return J;let Q;if(typeof $==="function")if($.name)Q=$.name;else Q=$.toString().substring(0,50);else Q=String($);return this.providerNameCache.set($,Q),Q}clear(){this.singletons.clear(),this.providers.clear(),this.resolutionStack.clear(),this.providerNameCache=new WeakMap,this.resetStats()}clearRequestScope($){this.requestScoped.delete($)}getStats(){let $=this.stats.singletonHits+this.stats.singletonMisses,J=$>0?this.stats.singletonHits/$*100:0,Q=this.stats.requestHits+this.stats.requestMisses,W=Q>0?this.stats.requestHits/Q*100:0;return{singletonHits:this.stats.singletonHits,singletonMisses:this.stats.singletonMisses,singletonHitRate:Math.round(J*100)/100,requestHits:this.stats.requestHits,requestMisses:this.stats.requestMisses,requestHitRate:Math.round(W*100)/100,transientCreations:this.stats.transientCreations}}resetStats(){this.stats={singletonHits:0,singletonMisses:0,requestHits:0,requestMisses:0,transientCreations:0}}}var YX=/^[\w!#$%&'*.^`|~+-]+$/,GX=/^[ !#-:<-[\]-~]*$/,m4=($,J)=>{if(J&&$.indexOf(J)===-1)return{};let Q=$.trim().split(";"),W={};for(let H of Q){H=H.trim();let X=H.indexOf("=");if(X===-1)continue;let q=H.substring(0,X).trim();if(J&&J!==q||!YX.test(q))continue;let Y=H.substring(X+1).trim();if(Y.startsWith('"')&&Y.endsWith('"'))Y=Y.slice(1,-1);if(GX.test(Y)){if(W[q]=Y.indexOf("%")!==-1?m1(Y,R$):Y,J)break}}return W};var BX=($,J,Q={})=>{let W=`${$}=${J}`;if($.startsWith("__Secure-")&&!Q.secure)throw Error("__Secure- Cookie must have Secure attributes");if($.startsWith("__Host-")){if(!Q.secure)throw Error("__Host- Cookie must have Secure attributes");if(Q.path!=="/")throw Error('__Host- Cookie must have Path attributes with "/"');if(Q.domain)throw Error("__Host- Cookie must not have Domain attributes")}if(Q&&typeof Q.maxAge==="number"&&Q.maxAge>=0){if(Q.maxAge>34560000)throw Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");W+=`; Max-Age=${Q.maxAge|0}`}if(Q.domain&&Q.prefix!=="host")W+=`; Domain=${Q.domain}`;if(Q.path)W+=`; Path=${Q.path}`;if(Q.expires){if(Q.expires.getTime()-Date.now()>34560000000)throw Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");W+=`; Expires=${Q.expires.toUTCString()}`}if(Q.httpOnly)W+="; HttpOnly";if(Q.secure)W+="; Secure";if(Q.sameSite)W+=`; SameSite=${Q.sameSite.charAt(0).toUpperCase()+Q.sameSite.slice(1)}`;if(Q.priority)W+=`; Priority=${Q.priority.charAt(0).toUpperCase()+Q.priority.slice(1)}`;if(Q.partitioned){if(!Q.secure)throw Error("Partitioned Cookie must have Secure attributes");W+="; Partitioned"}return W},U6=($,J,Q)=>{return J=encodeURIComponent(J),BX($,J,Q)};var _6=($,J,Q)=>{let W=$.req.raw.headers.get("Cookie");if(typeof J==="string"){if(!W)return;let X=J;if(Q==="secure")X="__Secure-"+J;else if(Q==="host")X="__Host-"+J;return m4(W,X)[X]}if(!W)return{};return m4(W)};var wX=($,J,Q)=>{let W;if(Q?.prefix==="secure")W=U6("__Secure-"+$,J,{path:"/",...Q,secure:!0});else if(Q?.prefix==="host")W=U6("__Host-"+$,J,{...Q,path:"/",secure:!0,domain:void 0});else W=U6($,J,{path:"/",...Q});return W},V6=($,J,Q,W)=>{let H=wX(J,Q,W);$.header("Set-Cookie",H,{append:!0})};class c4{static json($,J=200,Q){return new F6($,J,Q)}static html($,J=200){return new z6($,J)}static file($,J){return new L6($,J)}static stream($,J){return new j6($,J)}static redirect($,J=302){return new N6($,J)}}class F6{data;status;headers;constructor($,J=200,Q={}){this.data=$;this.status=J;this.headers=Q}toHonoResponse($){return $.json(this.data,this.status,this.headers)}}class z6{content;status;constructor($,J=200){this.content=$;this.status=J}toHonoResponse($){return $.html(this.content,this.status)}}class N6{url;status;constructor($,J=302){this.url=$;this.status=J}toHonoResponse($){return $.redirect(this.url,this.status)}}class L6{path;options;constructor($,J){this.path=$;this.options=J}async toHonoResponse($){try{let J=typeof Bun<"u"?Bun.file(this.path):await this.readFileNode(this.path),W={"Content-Type":this.options?.contentType||this.guessContentType(this.path)};if(this.options?.download||this.options?.filename){let H=this.options?.filename||this.path.split("/").pop()||"download",X=this.options?.download?"attachment":"inline";W["Content-Disposition"]=`${X}; filename="${H}"`}if(typeof Bun<"u"&&J instanceof Blob)return $.body(J,200,W);else return $.body(J,200,W)}catch(J){return $.json({error:"File not found",message:J instanceof Error?J.message:"Unknown error"},404)}}async readFileNode($){throw Error("File reading in Node.js requires fs module - use Bun runtime or implement adapter")}guessContentType($){let J=$.split(".").pop()?.toLowerCase();return{html:"text/html",css:"text/css",js:"application/javascript",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",svg:"image/svg+xml",pdf:"application/pdf",txt:"text/plain",xml:"application/xml"}[J||""]||"application/octet-stream"}}class j6{stream;options;constructor($,J){this.stream=$;this.options=J}toHonoResponse($){let J={"Content-Type":this.options?.contentType||"application/octet-stream",...this.options?.headers};return $.body(this.stream,200,J)}}class S6{static serialize($,J){if(J===null||J===void 0)return $.body(null,204);if(J instanceof c4)return J;if(J instanceof F6)return J.toHonoResponse($);if(J instanceof z6)return J.toHonoResponse($);if(J instanceof L6)return J.toHonoResponse($);if(J instanceof j6)return J.toHonoResponse($);if(J instanceof N6)return J.toHonoResponse($);if(J&&typeof J.toHonoResponse==="function")return J.toHonoResponse($);return $.json(J)}}class P${static compile($){let J=this.compilePathRegex($.path),Q=this.resolveParameterOrder($.parameters),W=this.resolveDependencyOrder($.dependencies),H=this.calculateMaxArgumentIndex($.parameters,$.dependencies),X=this.computeParameterFlags($.parameters);return{...$,pathRegex:J,parameterOrder:Q,dependencyOrder:W,maxArgumentIndex:H,...X}}static compilePathRegex($){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return J=J.replace(/\\\{([^}]+)\\\}/g,"(?<$1>[^/]+)"),J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g,"(?<$1>[^/]+)"),J=`^${J}$`,new RegExp(J)}static resolveParameterOrder($){if(!$||$.length===0)return[];return $.map((J)=>J.index).filter((J)=>J!==void 0).sort((J,Q)=>J-Q)}static resolveDependencyOrder($){if(!$||$.length===0)return[];return $.map((J)=>J.index).filter((J)=>J!==void 0).sort((J,Q)=>J-Q)}static calculateMaxArgumentIndex($,J){let Q=-1;if($&&$.length>0){let W=Math.max(...$.map((H)=>H.index));Q=Math.max(Q,W)}if(J&&J.length>0){let W=Math.max(...J.map((H)=>H.index));Q=Math.max(Q,W)}return Q}static computeParameterFlags($){if(!$||$.length===0)return{hasBody:!1,hasQuery:!1,hasParams:!1,hasHeaders:!1,hasCookies:!1,hasDependencies:!1};return{hasBody:$.some((J)=>J.type==="body"),hasQuery:$.some((J)=>J.type==="query"),hasParams:$.some((J)=>J.type==="param"),hasHeaders:$.some((J)=>J.type==="header"),hasCookies:$.some((J)=>J.type==="cookie"),hasDependencies:!1}}static compileAll($){return $.map((J)=>this.compile(J))}}class I${app;metadata;container;validator;errorHandler;compiledRoutes=new Map;constructor($,J,Q,W,H){this.app=$;this.metadata=J;this.container=Q;this.validator=W;this.errorHandler=H}compile(){let $=this.metadata.getRoutes(),J=P$.compileAll($);for(let Q of J){let W=`${Q.target.name}:${Q.propertyKey}`;this.compiledRoutes.set(W,Q);let H=this.createHandler(Q),X=this.normalizePath(Q.path),q=Q.method.toLowerCase();if(Q.middleware&&Q.middleware.length>0)this.app[q](X,...Q.middleware,H);else this.app[q](X,H)}}normalizePath($){if(!$.startsWith("/"))$="/"+$;if($=$.replace(/\{([^}]+)\}/g,":$1"),$.length>1&&$.endsWith("/"))$=$.slice(0,-1);return $}createHandler($){return async(J)=>{try{J.set("routeMetadata",$);let Q=await this.extractParameters(J,$.parameters),W=await this.resolveDependencies(J,$.dependencies),H=this.mergeArguments(Q,W,$.parameters,$.maxArgumentIndex),X;if($.handler)X=await $.handler(J,...H);else{let q=await this.container.resolve($.target,{scope:"transient",context:J});if(typeof q[$.propertyKey]!=="function")throw Error(`Method ${$.propertyKey} not found on controller ${$.target.name}`);X=await q[$.propertyKey](...H)}return this.serializeResponse(J,X)}catch(Q){return await this.handleError(J,Q)}}}serializeResponse($,J){return S6.serialize($,J)}getRouteMetadataForContext($){return $.get("routeMetadata")||null}isAuthRequired($){if($.auth?.required)return!0;return $.parameters.some((J)=>J.type==="current-user")}async handleError($,J){return await this.errorHandler.handle(J,$)}async extractParameters($,J){let Q=[];for(let W of J){if(!W)continue;let H;switch(W.type){case"body":try{H=await $.req.json()}catch(Y){H=null}break;case"query":if(W.name)H=$.req.query(W.name);else H=$.req.query();break;case"param":if(W.name)H=$.req.param(W.name);else H=$.req.param();break;case"header":if(W.name)H=$.req.header(W.name);else{let Y={};$.req.raw.headers.forEach((G,B)=>{Y[B]=G}),H=Y}break;case"cookie":if(W.name)H=_6($,W.name);else{let Y=$.req.header("cookie");if(Y)H=Object.fromEntries(Y.split(";").map((G)=>{let[B,...w]=G.trim().split("=");return[B,w.join("=")]}));else H={}}break;case"request":H=$.req;break;case"response":case"context":H=$;break;case"current-user":H=$.get("auth.user")||null;let X=this.getRouteMetadataForContext($);if(X&&this.isAuthRequired(X)){if(!H){let Y=$.get("auth.error")||"Authentication required",{AuthenticationException:G}=await Promise.resolve().then(() => (F1(),n9));throw new G(Y)}}break;case"token":H=$.get("auth.token")||null;break;case"oauth-user":H=$.get("oauth.user")||null;break;case"oauth-token":H=$.get("oauth.token")||null;break;case"current-session":H=$.get("session")||null;break;case"session-data":let q=$.get("session");if(q&&W.metadata?.key)H=q.data[W.metadata.key];else if(q)H=q.data;else H=null;break;case"csrf-token":H=$.get("csrf.token")||null;break;case"filtered-resource":H=$.get("filtered.resource")||null;break;case"filtered-attributes":H=$.get("filtered.attributes")||[];break;default:H=void 0}if(W.schema)try{H=await this.validator.validate(H,W.schema)}catch(X){throw X}Q[W.index]=H}return Q}mergeArguments($,J,Q,W){let X=Q.filter((B)=>B!==void 0&&B.index!==void 0).map((B)=>B.index),q=X.length>0?Math.max(...X):-1,Y=W!==void 0&&W>=0?W:Math.max(q,$.length-1,J.length-1,0);if(!Number.isFinite(Y)||Y<0)Y=0;let G=Array(Y+1);for(let B=0;B<=Y;B++)if($[B]!==void 0)G[B]=$[B];else if(J[B]!==void 0)G[B]=J[B];return G}async resolveDependencies($,J){let Q=[];for(let W of J){if(!W)continue;try{let H=await this.container.resolve(W.provider,{scope:W.scope,context:$});Q[W.index]=H}catch(H){throw Error(`Failed to resolve dependency at index ${W.index}: ${H instanceof Error?H.message:"Unknown error"}`)}}return Q}}j$();class k${customHandler;isDevelopment;constructor($){this.customHandler=$,this.isDevelopment=!0}setCustomHandler($){this.customHandler=$}async handle($,J){if(console.log("ErrorHandler.handle called with:",$.constructor.name,$.message),this.customHandler)try{return await this.customHandler($,J)}catch(Q){console.error("Custom error handler failed:",Q)}if($ instanceof e0)return console.log("Handling as ValidationException"),this.handleValidationException($,J);if($ instanceof N0)return console.log("Handling as HTTPException"),this.handleHTTPException($,J);return console.log("Handling as generic error"),this.handleGenericError($,J)}handleValidationException($,J){let Q=$.toJSON();if(this.isDevelopment)console.error("Validation Error:",{path:J.req.path,method:J.req.method,details:Q.details});return J.json(Q,$.statusCode)}handleHTTPException($,J){let Q=$.toJSON();if($.statusCode>=500)console.error("HTTP Exception:",{name:$.name,statusCode:$.statusCode,message:$.message,path:J.req.path,method:J.req.method,...this.isDevelopment&&$.stack?{stack:$.stack}:{}});else if(this.isDevelopment)console.warn("HTTP Exception:",{name:$.name,statusCode:$.statusCode,message:$.message,path:J.req.path,method:J.req.method});return J.json(Q,$.statusCode)}handleGenericError($,J){console.error("Internal Server Error:",{name:$.name,message:$.message,path:J.req.path,method:J.req.method,stack:$.stack});let Q={error:"Internal Server Error",statusCode:500};if(this.isDevelopment){if(Q.message=$.message,Q.name=$.name,$.stack)Q.stack=$.stack.split(`
124
- `).map((W)=>W.trim())}else Q.message="An unexpected error occurred";return J.json(Q,500)}isDevelopmentMode(){return this.isDevelopment}setDevelopmentMode($){this.isDevelopment=$}}class K${plugins=new Map;installed=new Set;register($){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);this.plugins.set($.name,$)}async install($){let J=this.resolveInstallOrder();for(let Q of J)await this.plugins.get(Q).install($),this.installed.add(Q)}isInstalled($){return this.installed.has($)}getPlugin($){return this.plugins.get($)}getPluginNames(){return Array.from(this.plugins.keys())}resolveInstallOrder(){let $=new Set,J=new Set,Q=[],W=(H,X=[])=>{if(J.has(H)){let Y=[...X,H].join(" -> ");throw Error(`Circular dependency detected in plugins: ${Y}`)}if($.has(H))return;J.add(H);let q=this.plugins.get(H);if(!q)throw Error(`Plugin "${H}" is not registered`);if(q.dependencies)for(let Y of q.dependencies){if(!this.plugins.has(Y))throw Error(`Plugin "${H}" depends on "${Y}" which is not registered`);W(Y,[...X,H])}J.delete(H),$.add(H),Q.push(H)};for(let H of this.plugins.keys())W(H);return Q}}class z1{hono;metadata;container;validator;errorHandler;compiler;pluginManager;config;compiled=!1;globalMiddleware=[];groupPrefix="";constructor($){if(this.config={adapter:"hono",title:"Veloce-TS API",version:"1.0.0",docs:!0,...$},this.hono=new l4,this.metadata=new T,this.container=new b$,this.validator=new D1,this.errorHandler=new k$,this.pluginManager=new K$,this.compiler=new I$(this.hono,this.metadata,this.container,this.validator,this.errorHandler),this.config.cors)if(this.config.cors===!0)this.useCors();else this.useCors(this.config.cors)}include($){let J=T.getControllerMetadata($);if(J)this.metadata.registerController($,J);let Q=T.getRouteMethods($);for(let W of Q){let H=T.getRouteMetadata($.prototype,W),X=T.getParameterMetadata($.prototype,W),q=T.getDependencyMetadata($.prototype,W);if(H&&H.method&&H.path!==void 0){let Y=J?.prefix||"",G=this.normalizePath(Y,H.path);this.metadata.registerRoute({target:$,propertyKey:W,method:H.method,path:G,middleware:[...J?.middleware||[],...H.middleware||[]],parameters:X||H.parameters||[],dependencies:q||H.dependencies||[],responses:H.responses||[],docs:H.docs})}}}get($,J){this.registerFunctionalRoute("GET",$,J)}post($,J){this.registerFunctionalRoute("POST",$,J)}put($,J){this.registerFunctionalRoute("PUT",$,J)}delete($,J){this.registerFunctionalRoute("DELETE",$,J)}patch($,J){this.registerFunctionalRoute("PATCH",$,J)}route($){return new p9(this,$)}group($,J){let Q=this.groupPrefix;this.groupPrefix=this.normalizePath(this.groupPrefix,$),J(),this.groupPrefix=Q}registerFunctionalRoute($,J,Q){let W=this.normalizePath(this.groupPrefix,J),H={target:i9,propertyKey:`${$.toLowerCase()}_${W}`,method:$,path:W,middleware:Q.middleware||[],parameters:this.extractParametersFromSchema(Q.schema),dependencies:[],responses:Q.responses||[],docs:Q.docs,handler:Q.handler};this.metadata.registerRoute(H)}extractParametersFromSchema($){let J=[],Q=0;if($?.body)J.push({index:Q++,type:"body",schema:$.body,required:!0});if($?.query)J.push({index:Q++,type:"query",schema:$.query,required:!1});if($?.params)J.push({index:Q++,type:"param",schema:$.params,required:!0});if($?.headers)J.push({index:Q++,type:"header",schema:$.headers,required:!1});return J}use($){this.globalMiddleware.push($),this.hono.use("*",$)}useCors($){let J=X$($);this.use(J)}useRateLimit($){let J=q$($);this.use(J)}useCompression($){let J=Y$($);this.use(J)}usePlugin($){this.pluginManager.register($)}getPluginManager(){return this.pluginManager}onError($){this.errorHandler.setCustomHandler($)}getErrorHandler(){return this.errorHandler}normalizePath(...$){let J=$.filter((Q)=>Q!=="").join("/").replace(/\/+/g,"/").replace(/\/$/,"");return J.startsWith("/")?J:`/${J}`}getHono(){return this.hono}getMetadata(){return this.metadata}getContainer(){return this.container}getCompiler(){return this.compiler}getConfig(){return this.config}isCompiled(){return this.compiled}markCompiled(){this.compiled=!0}async compile(){if(this.compiled){console.warn("Routes have already been compiled. Skipping compilation.");return}await this.pluginManager.install(this),this.compiler.compile(),this.compiled=!0}async listen($,J){if(!this.compiled)await this.compile();return this.createAdapter().listen($,J)}createAdapter(){let $=this.config.adapter||"hono";switch($){case"hono":{let{HonoAdapter:J}=M0(i4);return new J(this.hono)}case"express":{let{ExpressAdapter:J}=M0(d9);return new J(this)}case"native":{let{HonoAdapter:J}=M0(i4);return new J(this.hono)}default:throw Error(`Unknown adapter type: ${$}. Supported adapters: 'hono', 'express', 'native'`)}}}class i9{}class p9{app;path;constructor($,J){this.app=$;this.path=J}get($){return this.app.get(this.path,$),this}post($){return this.app.post(this.path,$),this}put($){return this.app.put(this.path,$),this}delete($){return this.app.delete(this.path,$),this}patch($){return this.app.patch(this.path,$),this}}function R6($){let J={docs:!1,cors:!1,...$};return new z1(J)}function p4($,J,Q,W){let H=$.getContainer(),X=typeof Q==="function"?Q:()=>Q;H.register(J,{scope:W?.scope||"singleton",factory:X})}function C6($){return new l1($)}async function s4($,J){let Q=R6(J);await $(Q),await Q.compile();let W=C6(Q);return{app:Q,client:W}}function o4($){$.getContainer().clear()}var mw={};L0(mw,{zodToJsonSchema:()=>Q6,zodToGraphQLType:()=>T0,zodObjectToGraphQLType:()=>U9,zodObjectToGraphQLInput:()=>_9,z:()=>z,setupTestApp:()=>s4,setSessionData:()=>JW,removeSessionData:()=>QW,mockDependency:()=>p4,isSessionAuthenticated:()=>eQ,isOAuthAuthenticated:()=>cQ,isNullable:()=>w1,isAuthenticated:()=>Tw,hasResolverMetadata:()=>w9,hasFieldMetadata:()=>D9,getUserRoles:()=>y8,getUserPermissions:()=>TQ,getToken:()=>v8,getSessionUserId:()=>$W,getSessionManager:()=>J$,getSessionData:()=>aQ,getResolverMetadata:()=>Y9,getRBACManager:()=>fQ,getOAuthUser:()=>lQ,getOAuthToken:()=>mQ,getOAuthProvider:()=>nQ,getFieldsMetadata:()=>G9,getFieldMetadata:()=>B9,getDefaultValue:()=>H6,getCurrentUser:()=>W1,getCurrentSession:()=>E0,getCSRFProtection:()=>tQ,getAuthError:()=>xw,getArgumentsMetadata:()=>L$,createTestClient:()=>C6,createTestApp:()=>R6,createSessionMiddleware:()=>rQ,createRateLimitMiddleware:()=>q$,createRBACMiddleware:()=>g8,createDefaultRBAC:()=>T8,createCorsMiddleware:()=>X$,createCompressionMiddleware:()=>Y$,createAuthMiddleware:()=>x8,clearMocks:()=>o4,checkUserRole:()=>uw,checkUserPermission:()=>lw,ZodToJsonSchemaConverter:()=>p0,WebSocketPlugin:()=>y1,WebSocketManager:()=>g1,WebSocketConnection:()=>h1,WebSocket:()=>A9,VeloceTS:()=>z1,Veloce:()=>z1,ValidationException:()=>e0,ValidationEngine:()=>D1,UseMiddleware:()=>AX,UnauthorizedException:()=>F9,TokenRevokedException:()=>n4,TokenPayloadSchema:()=>Ow,TokenExpiredException:()=>Z$,Token:()=>fw,TestClient:()=>l1,SuperAdminOnly:()=>gw,Subscription:()=>H9,StreamResponse:()=>j6,SessionManager:()=>u8,SessionGuard:()=>l8,SessionDataSchema:()=>dQ,Session:()=>iQ,RouterCompiler:()=>I$,Roles:()=>kQ,RoleSchema:()=>Pw,RoleAssignmentSchema:()=>Zw,ResponseSerializer:()=>S6,Response:()=>c4,Resolver:()=>J9,RequireRole:()=>h8,RequirePermission:()=>vw,RequireCSRF:()=>oQ,RefreshRequestSchema:()=>bw,RedirectResponse:()=>N6,RBACPlugin:()=>xQ,RBACManager:()=>e1,RBACGuard:()=>i$,Query:()=>Q9,Put:()=>zX,Post:()=>FX,PluginManager:()=>K$,Permissions:()=>KQ,PermissionMatcher:()=>$$,PermissionCheckSchema:()=>Iw,Patch:()=>LX,Param:()=>o9,OpenAPIPlugin:()=>W6,OpenAPIGenerator:()=>B1,OnMessage:()=>R9,OnDisconnect:()=>C9,OnConnect:()=>E9,OAuthUserSchema:()=>hQ,OAuthUser:()=>yQ,OAuthToken:()=>uQ,OAuth:()=>gQ,NotFoundException:()=>V9,Mutation:()=>W9,MinimumRole:()=>yw,MetadataRegistry:()=>T,MetadataCompiler:()=>P$,LoginRequestSchema:()=>Mw,JWTProvider:()=>Q4,JSONResponse:()=>F6,InvalidTokenException:()=>V1,InMemoryUserProvider:()=>IQ,HonoAdapter:()=>A6,Header:()=>r9,HTTPException:()=>N0,HTMLResponse:()=>z6,GraphQLSubscription:()=>H9,GraphQLSchemaBuilder:()=>S$,GraphQLQuery:()=>Q9,GraphQLPlugin:()=>A$,GraphQLMutation:()=>W9,GraphQLCtx:()=>q9,Get:()=>VX,GQLSubscription:()=>H9,GQLQuery:()=>Q9,GQLMutation:()=>W9,GQLContext:()=>q9,ForbiddenException:()=>z9,FileResponse:()=>L6,FastAPITS:()=>z1,ExpressAdapter:()=>E6,ErrorHandler:()=>k$,Depends:()=>SX,Delete:()=>NX,DIContainer:()=>b$,CurrentUser:()=>Kw,CurrentSession:()=>pQ,Ctx:()=>a9,Cookie:()=>t9,Controller:()=>_X,CSRFToken:()=>sQ,Body:()=>s9,BadRequestException:()=>N9,AuthorizationException:()=>B0,AuthenticationException:()=>Y0,AuthService:()=>d$,AuthPlugin:()=>vQ,Auth:()=>kw,Arg:()=>X9,ApiResponse:()=>RX,ApiDoc:()=>EX,All:()=>jX,AdminOnly:()=>hw});module.exports=M0(mw);var Fj=H$(z$());function _X($="",J){return(Q)=>{let W=$.trim();if(W&&!W.startsWith("/"))W="/"+W;if(W.endsWith("/"))W=W.slice(0,-1);T.defineController(Q,{prefix:W,middleware:J?.middleware||[]})}}function n1($){return(J="")=>{return(Q,W)=>{let H=J.trim();if(H&&!H.startsWith("/"))H="/"+H;let X=Reflect.getMetadata("route:middleware",Q,W)||[];T.defineRoute(Q,W,{method:$,path:H,middleware:X,parameters:[],dependencies:[],responses:[]})}}}var VX=n1("GET"),FX=n1("POST"),zX=n1("PUT"),NX=n1("DELETE"),LX=n1("PATCH"),jX=n1("ALL");function s9($){return(J,Q,W)=>{if(!Q)return;let H={index:W,type:"body",schema:$,required:!0};T.defineParameter(J,Q,W,H)}}function o9($){return(J,Q,W)=>{if(!Q)return;let H={index:W,type:"param",name:$,required:!0};T.defineParameter(J,Q,W,H)}}function r9($){return(J,Q,W)=>{if(!Q)return;let H={index:W,type:"header",name:$,required:!1};T.defineParameter(J,Q,W,H)}}function t9($){return(J,Q,W)=>{if(!Q)return;let H={index:W,type:"cookie",name:$,required:!1};T.defineParameter(J,Q,W,H)}}function a9(){return($,J,Q)=>{if(!J)return;let W={index:Q,type:"context",required:!0};T.defineParameter($,J,Q,W)}}function SX($,J="request"){return(Q,W,H)=>{if(W===void 0)throw Error("@Depends decorator can only be used on method parameters, not constructor parameters");T.defineDependency(Q,W,H,{index:H,provider:$,scope:J})}}function AX(...$){return(J,Q)=>{let W=Reflect.getMetadata("route:middleware",J,Q)||[];Reflect.defineMetadata("route:middleware",[...W,...$],J,Q)}}function EX($){return(J,Q)=>{let W=T.getRouteMetadata(J,Q);T.defineRoute(J,Q,{...W,docs:{...W?.docs,...$}})}}function RX($){return(J,Q)=>{let W=T.getRouteMetadata(J,Q),H=W?.responses||[],X=H.findIndex((Y)=>Y.statusCode===$.statusCode),q;if(X>=0)q=[...H],q[X]=$;else q=[...H,$];T.defineRoute(J,Q,{...W,responses:q})}}j$();F1();var Q1=H$(ZQ());class Q4{config;blacklistedTokens=new Set;constructor($){this.config=$;if(!$.secret)throw Error("JWT secret is required")}generateTokens($){let J=Math.floor(Date.now()/1000),Q=this.parseExpiration(this.config.expiresIn||"1h"),W={sub:$.sub,...$,iat:J,exp:J+Q,iss:this.config.issuer,aud:this.config.audience},H=Q1.sign(W,this.config.secret,{algorithm:this.config.algorithm||"HS256"}),X={sub:$.sub,type:"refresh",iat:J,exp:J+this.parseExpiration(this.config.refreshExpiresIn||"7d"),iss:this.config.issuer,aud:this.config.audience},q=Q1.sign(X,this.config.refreshSecret||this.config.secret,{algorithm:this.config.algorithm||"HS256"});return{accessToken:H,refreshToken:q,expiresIn:Q}}verifyAccessToken($){if(this.isBlacklisted($))throw Error("Token has been revoked");try{return Q1.verify($,this.config.secret,{algorithms:[this.config.algorithm||"HS256"],issuer:this.config.issuer,audience:this.config.audience})}catch(J){if(J instanceof Error)throw Error(`Invalid token: ${J.message}`);throw Error("Invalid token")}}verifyRefreshToken($){if(this.isBlacklisted($))throw Error("Refresh token has been revoked");try{let J=Q1.verify($,this.config.refreshSecret||this.config.secret,{algorithms:[this.config.algorithm||"HS256"],issuer:this.config.issuer,audience:this.config.audience});if(J.type!=="refresh")throw Error("Invalid refresh token type");return J}catch(J){if(J instanceof Error)throw Error(`Invalid refresh token: ${J.message}`);throw Error("Invalid refresh token")}}refreshAccessToken($){let J=this.verifyRefreshToken($);return this.blacklistToken($),this.generateTokens({sub:J.sub,...Object.fromEntries(Object.entries(J).filter(([Q])=>!["iat","exp","iss","aud","type"].includes(Q)))})}decodeToken($){try{return Q1.decode($)}catch{return null}}blacklistToken($){this.blacklistedTokens.add($)}isBlacklisted($){return this.blacklistedTokens.has($)}cleanupBlacklist(){let $=Math.floor(Date.now()/1000);for(let J of this.blacklistedTokens){let Q=this.decodeToken(J);if(Q&&Q.exp&&Q.exp<$)this.blacklistedTokens.delete(J)}}parseExpiration($){if(typeof $==="number")return $;let J={s:1,m:60,h:3600,d:86400,w:604800},Q=$.match(/^(\d+)([smhdw])$/);if(!Q)throw Error(`Invalid expiration format: ${$}`);let[,W,H]=Q;return parseInt(W)*J[H]}}var Ow=z.object({sub:z.string(),iat:z.number().optional(),exp:z.number().optional(),iss:z.string().optional(),aud:z.string().optional()}).passthrough(),Mw=z.object({username:z.string().min(1),password:z.string().min(1)}),bw=z.object({refreshToken:z.string().min(1)});F1();class d${config;userProvider;jwtProvider;constructor($,J){this.config=$;this.userProvider=J;this.jwtProvider=new Q4($)}async login($,J){let Q=await this.userProvider.findByCredentials($,J);if(!Q)throw new Y0("Invalid credentials");let W=this.jwtProvider.generateTokens({sub:Q.id,username:Q.username,email:Q.email,roles:Q.roles||[],permissions:Q.permissions||[]});return{user:Q,tokens:W}}async refresh($){try{return this.jwtProvider.refreshAccessToken($)}catch(J){throw new V1(J instanceof Error?J.message:"Invalid refresh token")}}async logout($,J){if(this.jwtProvider.blacklistToken($),J)this.jwtProvider.blacklistToken(J)}async verifyToken($){try{let J=this.jwtProvider.verifyAccessToken($),Q=await this.userProvider.findById(J.sub);if(!Q)throw new Y0("User not found");return Q}catch(J){if(J instanceof Error){if(J.message.includes("expired"))throw new Z$;throw new V1(J.message)}throw new V1("Token verification failed")}}getUserFromToken($){return this.jwtProvider.verifyAccessToken($)}hasRoles($,J){let Q=$.roles||[];return J.every((W)=>Q.includes(W))}hasPermissions($,J){let Q=$.permissions||[];return J.every((W)=>Q.includes(W))}async register($){let J=await this.userProvider.hashPassword($.password),Q={id:crypto.randomUUID(),username:$.username,email:$.email,roles:$.roles||["user"]},W=this.jwtProvider.generateTokens({sub:Q.id,username:Q.username,email:Q.email,roles:Q.roles});return{user:Q,tokens:W}}cleanup(){this.jwtProvider.cleanupBlacklist()}getJWTProvider(){return this.jwtProvider}}class IQ{users=new Map;async findByCredentials($,J){for(let[Q,W]of this.users)if(W.username===$){if(await this.verifyPassword(J,W.passwordHash)){let{passwordHash:X,...q}=W;return q}}return null}async findById($){let J=this.users.get($);if(J){let{passwordHash:Q,...W}=J;return W}return null}async hashPassword($){return Buffer.from($).toString("base64")}async verifyPassword($,J){return await this.hashPassword($)===J}async createUser($){let J=crypto.randomUUID(),Q=await this.hashPassword($.password),W={id:J,username:$.username,email:$.email,roles:$.roles||["user"],passwordHash:Q};this.users.set(J,W);let{passwordHash:H,...X}=W;return X}}class e1{roles=new Map;hierarchy=new Map;compiledPermissions=new Map;defineRole($){if(this.roles.set($.name,$),$.inherits&&$.inherits.length>0)this.hierarchy.set($.name,$.inherits);this.compiledPermissions.clear()}defineRoles($){for(let J of $)this.defineRole(J)}getRolePermissions($){if(this.compiledPermissions.has($))return Array.from(this.compiledPermissions.get($));let J=new Set;return this.collectPermissions($,J,new Set),this.compiledPermissions.set($,J),Array.from(J)}roleHasPermission($,J){return this.getRolePermissions($).includes(J)}userHasPermission($,J){for(let Q of $)if(this.roleHasPermission(Q,J))return!0;return!1}userHasRoles($,J){return J.every((Q)=>$.includes(Q))}userHasAnyRole($,J){return J.some((Q)=>$.includes(Q))}getRolesWithPermission($){let J=[];for(let Q of this.roles.keys())if(this.roleHasPermission(Q,$))J.push(Q);return J}getRoleHierarchy($){let J=[];return this.collectParentRoles($,J,new Set),J}roleInheritsFrom($,J){return this.getRoleHierarchy($).includes(J)}getAllRoles(){return Array.from(this.roles.values())}getRole($){return this.roles.get($)}roleExists($){return this.roles.has($)}validateRoles($){let J=[],Q=[];for(let W of $)if(this.roleExists(W))J.push(W);else Q.push(W);return{valid:J,invalid:Q}}getEffectiveRoles($){let J=new Set;for(let Q of $)J.add(Q),this.getRoleHierarchy(Q).forEach((H)=>J.add(H));return Array.from(J)}compareRoleLevels($,J){let Q=this.getRole($),W=this.getRole(J),H=Q?.level??0,X=W?.level??0;return H-X}getHighestRoleLevel($){let J=0;for(let Q of $){let W=this.getRole(Q);if(W&&W.level&&W.level>J)J=W.level}return J}collectPermissions($,J,Q){if(Q.has($))throw Error(`Circular role inheritance detected: ${$}`);Q.add($);let W=this.roles.get($);if(!W)throw Error(`Role not found: ${$}`);W.permissions.forEach((X)=>J.add(X));let H=this.hierarchy.get($)||[];for(let X of H)this.collectPermissions(X,J,new Set(Q))}collectParentRoles($,J,Q){if(Q.has($))return;Q.add($);let W=this.hierarchy.get($)||[];for(let H of W)J.push(H),this.collectParentRoles(H,J,Q)}}function T8(){let $=new e1;return $.defineRoles([{name:"guest",description:"Guest user with minimal permissions",permissions:["read:public"],level:1},{name:"user",description:"Regular authenticated user",permissions:["read:own","write:own","read:public"],inherits:["guest"],level:10},{name:"moderator",description:"Moderator with content management permissions",permissions:["read:all","write:all","moderate:content"],inherits:["user"],level:50},{name:"admin",description:"Administrator with full system access",permissions:["*"],inherits:["moderator"],level:100},{name:"super-admin",description:"Super administrator with unrestricted access",permissions:["*","system:*"],inherits:["admin"],level:1000}]),$}var Pw=z.object({name:z.string().min(1),description:z.string().optional(),permissions:z.array(z.string()),inherits:z.array(z.string()).optional(),level:z.number().optional()}),Zw=z.object({userId:z.string(),roles:z.array(z.string())}),Iw=z.object({userId:z.string(),permission:z.string()});class $${static matches($,J){if(J==="*")return!0;if(J.endsWith("*")){let Q=J.slice(0,-1);return $.startsWith(Q)}return $===J}static hasPermission($,J){return $.some((Q)=>this.matches(J,Q))}static filterByPattern($,J){return $.filter((Q)=>this.matches(Q,J))}}function kw($){return(J,Q)=>{let W={required:!$?.optional,config:$};T.defineAuth(J,Q,W)}}function Kw(){return($,J,Q)=>{if(J)T.defineParameter($,J,Q,{index:Q,type:"current-user",required:!1})}}function fw(){return($,J,Q)=>{if(J)T.defineParameter($,J,Q,{index:Q,type:"token",required:!1})}}function x8($){return async(J,Q)=>{let W=J.req.header("Authorization");if(!W||!W.startsWith("Bearer "))J.set("auth.error","Missing or invalid Authorization header"),J.set("auth.authenticated",!1);else{let H=W.substring(7);try{let X=$.verifyAccessToken(H);J.set("auth.user",X),J.set("auth.token",H),J.set("auth.authenticated",!0)}catch(X){J.set("auth.error",X instanceof Error?X.message:"Authentication failed"),J.set("auth.authenticated",!1)}}await Q()}}function W1($){return $.get("auth.user")||null}function v8($){return $.get("auth.token")||null}function Tw($){return $.get("auth.authenticated")===!0}function xw($){return $.get("auth.error")||null}F1();function kQ($){return(J,Q)=>{let H={config:Array.isArray($)?{roles:$,requireAll:!1,allowInherited:!0}:{requireAll:!1,allowInherited:!0,...$}};T.defineRoles(J,Q,H)}}function KQ($){return(J,Q)=>{let H={config:Array.isArray($)?{permissions:$,requireAll:!1}:{requireAll:!1,...$}};T.definePermissions(J,Q,H)}}function h8($){return kQ([$])}function vw($){return KQ([$])}function hw(){return h8("admin")}function gw(){return h8("super-admin")}function yw($){return(J,Q)=>{T.defineMinimumRole(J,Q,{roleName:$})}}function g8($){return async(J,Q)=>{J.set("rbac",$),await Q()}}class i${rbac;constructor($){this.rbac=$}checkRoles($,J){let Q=W1($);if(!Q)throw new B0("Authentication required for role check");let W=Q.roles||[],H=J.allowInherited?this.rbac.getEffectiveRoles(W):W,X;if(J.requireAll)X=J.roles.every((q)=>H.includes(q));else X=J.roles.some((q)=>H.includes(q));if(!X){let q=J.requireAll?"all":"any";throw new B0(`Access denied. Required ${q} of roles: ${J.roles.join(", ")}`)}}checkPermissions($,J){let Q=W1($);if(!Q)throw new B0("Authentication required for permission check");let W=Q.roles||[],H=new Set;for(let Y of W)this.rbac.getRolePermissions(Y).forEach((B)=>H.add(B));let X=Array.from(H),q;if(J.requireAll)q=J.permissions.every((Y)=>$$.hasPermission(X,Y));else q=J.permissions.some((Y)=>$$.hasPermission(X,Y));if(!q){let Y=J.requireAll?"all":"any";throw new B0(`Access denied. Required ${Y} of permissions: ${J.permissions.join(", ")}`)}}checkMinimumRole($,J){let Q=W1($);if(!Q)throw new B0("Authentication required for role level check");let W=Q.roles||[],H=this.rbac.getHighestRoleLevel(W),X=this.rbac.getRole(J);if(!X)throw Error(`Required role not found: ${J}`);let q=X.level||0;if(H<q)throw new B0(`Access denied. Minimum role level required: ${J} (level ${q})`)}}function fQ($){return $.get("rbac")||null}function y8($){return W1($)?.roles||[]}function TQ($){let J=fQ($),Q=y8($);if(!J)return[];let W=new Set;for(let H of Q)J.getRolePermissions(H).forEach((q)=>W.add(q));return Array.from(W)}function uw($,J){return y8($).includes(J)}function lw($,J){let Q=TQ($);return $$.hasPermission(Q,J)}class xQ{config;name="rbac";version="1.0.0";dependencies=["auth"];rbac;guard;constructor($={}){this.config=$;if($.rbac)this.rbac=$.rbac;else if($.useDefaults!==!1)this.rbac=T8();else this.rbac=new e1;if($.roles)this.rbac.defineRoles($.roles);this.guard=new i$(this.rbac)}async install($){let J=g8(this.rbac);if($.use(J),$.getContainer().register(e1,{factory:()=>this.rbac,scope:"singleton"}),$.getContainer().register(i$,{factory:()=>this.guard,scope:"singleton"}),this.extendRouterCompiler($),this.config.enableManagementRoutes!==!1)this.addManagementRoutes($)}extendRouterCompiler($){let J=$.compile.bind($);$.compile=async()=>{await J();let Q=$.getMetadata().getRoutes();for(let W of Q)if(W.roles||W.permissions||W.minimumRole)this.addRBACGuards($,W)}}addRBACGuards($,J){}addManagementRoutes($){let J=this.config.routes||{};$.get(J.roles||"/rbac/roles",{handler:(Q)=>{let W=this.rbac.getAllRoles();return Q.json({success:!0,roles:W.map((H)=>({name:H.name,description:H.description,permissions:H.permissions,inherits:H.inherits,level:H.level}))})}}),$.get("/rbac/roles/:roleName",{handler:(Q)=>{let W=Q.req.param("roleName"),H=this.rbac.getRole(W);if(!H)return Q.json({error:"Role not found"},404);let X=this.rbac.getRolePermissions(W),q=this.rbac.getRoleHierarchy(W);return Q.json({success:!0,role:{...H,effectivePermissions:X,hierarchy:q}})}}),$.get("/rbac/roles/:roleName/permissions",{handler:(Q)=>{let W=Q.req.param("roleName");if(!this.rbac.roleExists(W))return Q.json({error:"Role not found"},404);let H=this.rbac.getRolePermissions(W);return Q.json({success:!0,role:W,permissions:H})}}),$.post("/rbac/check-permission",{handler:async(Q)=>{let W=await Q.req.json(),{roles:H,permission:X}=W;if(!Array.isArray(H)||!X)return Q.json({error:"Invalid request body"},400);let q=this.rbac.userHasPermission(H,X);return Q.json({success:!0,hasPermission:q,roles:H,permission:X})}}),$.post("/rbac/check-roles",{handler:async(Q)=>{let W=await Q.req.json(),{userRoles:H,requiredRoles:X,requireAll:q=!1}=W;if(!Array.isArray(H)||!Array.isArray(X))return Q.json({error:"Invalid request body"},400);let Y=q?this.rbac.userHasRoles(H,X):this.rbac.userHasAnyRole(H,X);return Q.json({success:!0,hasRoles:Y,userRoles:H,requiredRoles:X,requireAll:q})}}),$.post("/rbac/effective-roles",{handler:async(Q)=>{let W=await Q.req.json(),{roles:H}=W;if(!Array.isArray(H))return Q.json({error:"Invalid request body"},400);let X=this.rbac.getEffectiveRoles(H);return Q.json({success:!0,inputRoles:H,effectiveRoles:X})}}),$.post("/rbac/user-permissions",{handler:async(Q)=>{let W=await Q.req.json(),{roles:H}=W;if(!Array.isArray(H))return Q.json({error:"Invalid request body"},400);let X=new Set;for(let q of H)if(this.rbac.roleExists(q))this.rbac.getRolePermissions(q).forEach((G)=>X.add(G));return Q.json({success:!0,roles:H,permissions:Array.from(X)})}})}getRBACManager(){return this.rbac}getGuard(){return this.guard}}F1();class vQ{config;name="auth";version="1.0.0";authService;constructor($){this.config=$;this.authService=new d$($.jwt,$.userProvider)}async install($){let J=x8(this.authService.getJWTProvider());if($.use(J),$.getContainer().register(d$,{factory:()=>this.authService,scope:"singleton"}),this.config.enableDefaultRoutes!==!1)this.addDefaultRoutes($);this.extendRouterCompiler($)}extendRouterCompiler($){$.use(async(Q,W)=>{Q.set("authService",this.authService),await W()});let J=$.compile.bind($);$.compile=async()=>{await J();let Q=$.getHono(),W=$.getMetadata().getRoutes();for(let H of W){let X=T.getAuthMetadata(H.target.prototype,H.propertyKey);if(H.auth?.required||X?.required){console.log("Adding auth middleware for route:",H.path,H.method);let Y=H.auth?.config||X?.config;Q.use(H.path,async(G,B)=>{if(console.log("Auth middleware executing for:",G.req.path,G.req.method,"target:",H.path,H.method),G.req.method!==H.method)return console.log("Method mismatch, skipping auth check"),B();console.log("Checking authentication...");let w=G.get("auth.user"),_=G.get("auth.error");if(!w){let R=_||"Authentication required";throw console.log("No user found, throwing auth exception"),new Y0(R)}if(Y?.roles?.length){if(!this.authService.hasRoles(w,Y.roles))throw new B0(`Required roles: ${Y.roles.join(", ")}`)}if(Y?.permissions?.length){if(!this.authService.hasPermissions(w,Y.permissions))throw new B0(`Required permissions: ${Y.permissions.join(", ")}`)}await B()})}}}}buildPath($){return $.path}pathMatches($,J){let Q=$.replace(/:([^/]+)/g,"([^/]+)");return new RegExp(`^${Q}$`).test(J)}addDefaultRoutes($){let J=this.config.routes||{};if($.post(J.login||"/auth/login",{handler:async(Q)=>{let W=await Q.req.json(),{username:H,password:X}=W;try{let q=await this.authService.login(H,X);return{success:!0,user:q.user,tokens:q.tokens}}catch(q){throw new Y0(q instanceof Error?q.message:"Login failed")}},schema:{body:z.object({username:z.string().min(1),password:z.string().min(1)})}}),$.post(J.refresh||"/auth/refresh",{handler:async(Q)=>{let W=await Q.req.json(),{refreshToken:H}=W;try{return{success:!0,tokens:await this.authService.refresh(H)}}catch(X){throw new Y0(X instanceof Error?X.message:"Token refresh failed")}},schema:{body:z.object({refreshToken:z.string().min(1)})}}),$.post(J.logout||"/auth/logout",{handler:async(Q)=>{let W=v8(Q),H=await Q.req.json(),{refreshToken:X}=H;if(W)await this.authService.logout(W,X);return{success:!0,message:"Logged out successfully"}},schema:{body:z.object({refreshToken:z.string().optional()})}}),"createUser"in this.config.userProvider)$.post(J.register||"/auth/register",{handler:async(Q)=>{let W=await Q.req.json(),{username:H,password:X,email:q}=W;try{let Y=await this.authService.register({username:H,password:X,email:q});return{success:!0,user:Y.user,tokens:Y.tokens}}catch(Y){throw new Y0(Y instanceof Error?Y.message:"Registration failed")}},schema:{body:z.object({username:z.string().min(1),password:z.string().min(6),email:z.string().email().optional()})}});$.get("/auth/me",{handler:async(Q)=>{let W=W1(Q);if(!W)throw new Y0("Not authenticated");return{success:!0,user:W}}})}getAuthService(){return this.authService}}var Jj=z.object({code:z.string(),state:z.string(),error:z.string().optional(),error_description:z.string().optional()}),Qj=z.object({accessToken:z.string(),refreshToken:z.string().optional(),expiresIn:z.number().optional(),tokenType:z.string(),scope:z.string().optional()}),hQ=z.object({id:z.string(),email:z.string().optional(),name:z.string().optional(),username:z.string().optional(),avatar:z.string().optional(),provider:z.string()}).passthrough();function gQ($){return(J,Q)=>{let W={provider:$.provider,config:$};T.defineOAuth(J,Q,W)}}function yQ(){return($,J,Q)=>{if(J)T.defineParameter($,J,Q,{index:Q,type:"oauth-user",required:!0})}}function uQ(){return($,J,Q)=>{if(J)T.defineParameter($,J,Q,{index:Q,type:"oauth-token",required:!0})}}function lQ($){return $.get("oauth.user")||null}function mQ($){return $.get("oauth.token")||null}function cQ($){return $.get("oauth.authenticated")===!0}function nQ($){return $.get("oauth.provider")||null}class u8{store;config;constructor($,J){this.store=$;this.config={name:"sessionId",maxAge:86400000,secure:!1,httpOnly:!0,sameSite:"lax",path:"/",rolling:!1,genid:()=>crypto.randomUUID(),...J,domain:J.domain}}async createSession($,J={},Q){let W=this.config.genid(),H=new Date,X=Q?.maxAge||this.config.maxAge,q={id:W,userId:$,data:J,createdAt:H,updatedAt:H,expiresAt:new Date(H.getTime()+X),ipAddress:Q?.ipAddress,userAgent:Q?.userAgent,csrfToken:this.generateCSRFToken()};return await this.store.set(W,q),q}async getSession($){return await this.store.get($)}async updateSession($,J){let Q=await this.store.get($);if(!Q)return null;if(Q.data={...Q.data,...J},Q.updatedAt=new Date,this.config.rolling)Q.expiresAt=new Date(Date.now()+this.config.maxAge);return await this.store.set($,Q),Q}async touchSession($){if(this.config.rolling){let J=await this.store.get($);if(J)J.updatedAt=new Date,J.expiresAt=new Date(Date.now()+this.config.maxAge),await this.store.set($,J)}else await this.store.touch($)}async destroySession($){await this.store.destroy($)}async regenerateSession($){let J=await this.store.get($);if(!J)return null;let Q=this.config.genid(),W={...J,id:Q,updatedAt:new Date,csrfToken:this.generateCSRFToken()};return await this.store.set(Q,W),await this.store.destroy($),W}async getUserSessions($){return(await this.store.all()).filter((Q)=>Q.userId===$)}async destroyUserSessions($){let J=await this.getUserSessions($);for(let Q of J)await this.store.destroy(Q.id)}validateCSRFToken($,J){return $.csrfToken===J}generateCSRFToken(){return crypto.randomUUID()}getCookieOptions(){let $={maxAge:this.config.maxAge,secure:this.config.secure,httpOnly:this.config.httpOnly,sameSite:this.config.sameSite,path:this.config.path};if(this.config.domain)$.domain=this.config.domain;return $}getConfig(){return{...this.config}}getStore(){return this.store}}var dQ=z.object({id:z.string(),userId:z.string(),data:z.record(z.any()),createdAt:z.date(),updatedAt:z.date(),expiresAt:z.date().optional(),ipAddress:z.string().optional(),userAgent:z.string().optional(),csrfToken:z.string().optional()}),Yj=z.object({name:z.string().optional(),secret:z.string(),maxAge:z.number().optional(),secure:z.boolean().optional(),httpOnly:z.boolean().optional(),sameSite:z.enum(["strict","lax","none"]).optional(),domain:z.string().optional(),path:z.string().optional(),rolling:z.boolean().optional()}),Gj=z.object({userId:z.string(),data:z.record(z.any()).optional(),maxAge:z.number().optional(),ipAddress:z.string().optional(),userAgent:z.string().optional()}),Bj=z.object({data:z.record(z.any())});F1();function iQ($={}){return(J,Q)=>{let W={config:$};T.defineSession(J,Q,W)}}function pQ(){return($,J,Q)=>{if(J)T.defineParameter($,J,Q,{index:Q,type:"current-session",required:!0})}}function sQ(){return($,J,Q)=>{if(J)T.defineParameter($,J,Q,{index:Q,type:"csrf-token",required:!0})}}function oQ(){return($,J)=>{T.defineCSRF($,J,{required:!0})}}function rQ($,J){return async(Q,W)=>{let H=$.getConfig(),X=_6(Q,H.name),q=null;if(X){if(q=await $.getSession(X),q)await $.touchSession(X)}Q.set("session",q),Q.set("sessionManager",$),Q.set("csrfProtection",J),await W()}}class l8{sessionManager;csrfProtection;constructor($,J){this.sessionManager=$;this.csrfProtection=J}checkSession($,J){let Q=E0($);if(J.required&&!Q)throw new Y0("Session required");if(Q&&J.csrf)this.checkCSRF($,Q)}checkCSRF($,J){if(!this.csrfProtection)throw Error("CSRF protection not configured");let Q=$.req.header("X-CSRF-Token")||$.req.query("_csrf");if(!Q)throw new B0("CSRF token required");if(!this.csrfProtection.validateToken(J.id,Q))throw new B0("Invalid CSRF token")}async createSession($,J,Q={}){let W=J$($);if(!W)throw Error("Session manager not available");let H=$.req.header("X-Forwarded-For")||$.req.header("X-Real-IP")||"unknown",X=$.req.header("User-Agent")||"unknown",q=await W.createSession(J,Q,{ipAddress:H,userAgent:X}),Y=W.getCookieOptions();return V6($,W.getConfig().name,q.id,Y),$.set("session",q),q}async updateSession($,J){let Q=E0($),W=J$($);if(!Q||!W)return null;let H=await W.updateSession(Q.id,J);if(H)$.set("session",H);return H}async destroySession($){let J=E0($),Q=J$($);if(!J||!Q)return;await Q.destroySession(J.id);let W=Q.getConfig();if(V6($,W.name,"",{...Q.getCookieOptions(),maxAge:0}),$.set("session",null),this.csrfProtection)this.csrfProtection.removeToken(J.id)}async regenerateSession($){let J=E0($),Q=J$($);if(!J||!Q)return null;let W=await Q.regenerateSession(J.id);if(W){let H=Q.getCookieOptions();if(V6($,Q.getConfig().name,W.id,H),$.set("session",W),this.csrfProtection)this.csrfProtection.removeToken(J.id),this.csrfProtection.generateToken(W.id)}return W}generateCSRFToken($){let J=E0($);if(!J||!this.csrfProtection)return null;return this.csrfProtection.generateToken(J.id)}}function E0($){return $.get("session")||null}function J$($){return $.get("sessionManager")||null}function tQ($){return $.get("csrfProtection")||null}function aQ($,J){let Q=E0($);if(!Q)return null;if(J)return Q.data[J];return Q.data}function eQ($){return E0($)!==null}function $W($){return E0($)?.userId||null}function JW($,J,Q){let W=E0($);if(W)W.data[J]=Q,$.set("session",W)}function QW($,J){let Q=E0($);if(Q&&J in Q.data)delete Q.data[J],$.set("session",Q)}
123
+ `.trim()}getSchema(){return this.schema}}var cH={};L0(cH,{WebSocketPlugin:()=>y1,WebSocketManager:()=>g1,WebSocketConnection:()=>h1,WebSocket:()=>A9,OnMessage:()=>R9,OnDisconnect:()=>C9,OnConnect:()=>E9});module.exports=M0(cH);var oV=X$(N$());var pV=X$(N$()),j4=Symbol("route:metadata"),S4=Symbol("controller:metadata"),L9=Symbol("parameter:metadata"),j9=Symbol("dependency:metadata"),A4=Symbol("websocket:metadata"),S9=Symbol("websocket:handler:metadata"),E4=Symbol("graphql:resolver"),E$=Symbol("graphql:field"),R4=Symbol("auth:metadata"),C4=Symbol("oauth:metadata"),O4=Symbol("roles:metadata"),M4=Symbol("permissions:metadata"),b4=Symbol("minimum-role:metadata"),P4=Symbol("resource-permission:metadata"),Z4=Symbol("session:metadata"),I4=Symbol("csrf:metadata");class T{routes=new Map;controllers=new Map;routesByController=new Map;websockets=new Map;graphqlResolvers=new Map;graphqlFields=new Map;registerRoute($){let J=this.getRouteKey($.target,$.propertyKey);if(this.routes.set(J,$),!this.routesByController.has($.target))this.routesByController.set($.target,[]);this.routesByController.get($.target).push($)}registerController($,J){this.controllers.set($,J)}getRoutes(){return Array.from(this.routes.values())}getRoute($,J){let Q=this.getRouteKey($,J);return this.routes.get(Q)}getRoutesByController($){return this.routesByController.get($)||[]}getController($){return this.controllers.get($)}getControllers(){return new Map(this.controllers)}registerWebSocket($){this.websockets.set($.target,$)}getWebSockets(){return Array.from(this.websockets.values())}getWebSocket($){return this.websockets.get($)}registerGraphQLResolver($){this.graphqlResolvers.set($.target,$)}registerGraphQLField($){let J=this.getRouteKey($.target,$.propertyKey);this.graphqlFields.set(J,$)}getGraphQLResolvers(){return Array.from(this.graphqlResolvers.values())}getGraphQLResolver($){return this.graphqlResolvers.get($)}getGraphQLFields(){return Array.from(this.graphqlFields.values())}getGraphQLFieldsByResolver($){return Array.from(this.graphqlFields.values()).filter((J)=>J.target===$)}clear(){this.routes.clear(),this.controllers.clear(),this.routesByController.clear(),this.websockets.clear(),this.graphqlResolvers.clear(),this.graphqlFields.clear()}getRouteKey($,J){return`${$.name}:${J}`}static defineRoute($,J,Q){let W=this.getRouteMetadata($,J),H={...W,...Q,target:$.constructor,propertyKey:J,middleware:[...W?.middleware||[],...Q.middleware||[]],parameters:Q.parameters||W?.parameters||[],dependencies:Q.dependencies||W?.dependencies||[],responses:Q.responses||W?.responses||[],auth:Q.auth||W?.auth,oauth:Q.oauth||W?.oauth,roles:Q.roles||W?.roles,permissions:Q.permissions||W?.permissions,minimumRole:Q.minimumRole||W?.minimumRole,resourcePermission:Q.resourcePermission||W?.resourcePermission,session:Q.session||W?.session,csrf:Q.csrf||W?.csrf};Reflect.defineMetadata(j4,H,$,J)}static defineParameter($,J,Q,W){let H=this.getParameterMetadata($,J)||[];H[Q]=W,Reflect.defineMetadata(L9,H,$,J);let X=this.getRouteMetadata($,J);this.defineRoute($,J,{...X,parameters:H})}static defineDependency($,J,Q,W){let H=this.getDependencyMetadata($,J)||[];H[Q]=W,Reflect.defineMetadata(j9,H,$,J);let X=this.getRouteMetadata($,J);this.defineRoute($,J,{...X,dependencies:H})}static defineController($,J){Reflect.defineMetadata(S4,J,$)}static getRouteMetadata($,J){return Reflect.getMetadata(j4,$,J)}static getParameterMetadata($,J){return Reflect.getMetadata(L9,$,J)}static getDependencyMetadata($,J){return Reflect.getMetadata(j9,$,J)}static getControllerMetadata($){return Reflect.getMetadata(S4,$)}static hasControllerMetadata($){return Reflect.hasMetadata(S4,$)}static hasRouteMetadata($,J){return Reflect.hasMetadata(j4,$,J)}static getRouteMethods($){let J=$.prototype,Q=[],W=Object.getOwnPropertyNames(J);for(let H of W){if(H==="constructor")continue;if(this.hasRouteMetadata(J,H))Q.push(H)}return Q}static defineWebSocket($,J){let W={...this.getWebSocketMetadata($),...J,target:$};Reflect.defineMetadata(A4,W,$)}static defineWebSocketHandler($,J,Q){let W=this.getWebSocketMetadata($.constructor)||{};switch(Q.type){case"connect":W.onConnect=J;break;case"message":W.onMessage=J,W.messageSchema=Q.schema;break;case"disconnect":W.onDisconnect=J;break}this.defineWebSocket($.constructor,W),Reflect.defineMetadata(S9,Q,$,J)}static getWebSocketMetadata($){return Reflect.getMetadata(A4,$)}static getWebSocketHandlerMetadata($,J){return Reflect.getMetadata(S9,$,J)}static hasWebSocketMetadata($){return Reflect.hasMetadata(A4,$)}static defineGraphQLResolver($,J){Reflect.defineMetadata(E4,J,$)}static defineGraphQLField($,J,Q){Reflect.defineMetadata(E$,Q,$,J);let W=this.getGraphQLFieldsMetadata($.constructor)||[];W.push(Q),Reflect.defineMetadata(E$,W,$.constructor)}static getGraphQLResolverMetadata($){return Reflect.getMetadata(E4,$)}static getGraphQLFieldsMetadata($){return Reflect.getMetadata(E$,$)||[]}static getGraphQLFieldMetadata($,J){return Reflect.getMetadata(E$,$,J)}static hasGraphQLResolverMetadata($){return Reflect.hasMetadata(E4,$)}static hasGraphQLFieldMetadata($,J){return Reflect.hasMetadata(E$,$,J)}static defineAuth($,J,Q){Reflect.defineMetadata(R4,Q,$,J);let W=this.getRouteMetadata($,J);this.defineRoute($,J,{...W,auth:Q})}static getAuthMetadata($,J){return Reflect.getMetadata(R4,$,J)}static hasAuthMetadata($,J){return Reflect.hasMetadata(R4,$,J)}static defineOAuth($,J,Q){Reflect.defineMetadata(C4,Q,$,J);let W=this.getRouteMetadata($,J);this.defineRoute($,J,{...W,oauth:Q})}static getOAuthMetadata($,J){return Reflect.getMetadata(C4,$,J)}static hasOAuthMetadata($,J){return Reflect.hasMetadata(C4,$,J)}static defineRoles($,J,Q){Reflect.defineMetadata(O4,Q,$,J);let W=this.getRouteMetadata($,J);this.defineRoute($,J,{...W,roles:Q})}static definePermissions($,J,Q){Reflect.defineMetadata(M4,Q,$,J);let W=this.getRouteMetadata($,J);this.defineRoute($,J,{...W,permissions:Q})}static defineMinimumRole($,J,Q){Reflect.defineMetadata(b4,Q,$,J);let W=this.getRouteMetadata($,J);this.defineRoute($,J,{...W,minimumRole:Q})}static getRolesMetadata($,J){return Reflect.getMetadata(O4,$,J)}static getPermissionsMetadata($,J){return Reflect.getMetadata(M4,$,J)}static getMinimumRoleMetadata($,J){return Reflect.getMetadata(b4,$,J)}static hasRolesMetadata($,J){return Reflect.hasMetadata(O4,$,J)}static hasPermissionsMetadata($,J){return Reflect.hasMetadata(M4,$,J)}static hasMinimumRoleMetadata($,J){return Reflect.hasMetadata(b4,$,J)}static defineResourcePermission($,J,Q){Reflect.defineMetadata(P4,Q,$,J);let W=this.getRouteMetadata($,J);this.defineRoute($,J,{...W,resourcePermission:Q})}static getResourcePermissionMetadata($,J){return Reflect.getMetadata(P4,$,J)}static hasResourcePermissionMetadata($,J){return Reflect.hasMetadata(P4,$,J)}static defineSession($,J,Q){Reflect.defineMetadata(Z4,Q,$,J);let W=this.getRouteMetadata($,J);this.defineRoute($,J,{...W,session:Q})}static defineCSRF($,J,Q){Reflect.defineMetadata(I4,Q,$,J);let W=this.getRouteMetadata($,J);this.defineRoute($,J,{...W,csrf:Q})}static getSessionMetadata($,J){return Reflect.getMetadata(Z4,$,J)}static getCSRFMetadata($,J){return Reflect.getMetadata(I4,$,J)}static hasSessionMetadata($,J){return Reflect.hasMetadata(Z4,$,J)}static hasCSRFMetadata($,J){return Reflect.hasMetadata(I4,$,J)}}function A9($){return(J)=>{T.defineWebSocket(J,{path:$})}}function E9(){return($,J)=>{T.defineWebSocketHandler($,J,{type:"connect",method:J})}}function R9($){return(J,Q)=>{T.defineWebSocketHandler(J,Q,{type:"message",method:Q,schema:$})}}function C9(){return($,J)=>{T.defineWebSocketHandler($,J,{type:"disconnect",method:J})}}var nH={};L0(nH,{zodToGraphQLType:()=>T0,zodObjectToGraphQLType:()=>_9,zodObjectToGraphQLInput:()=>V9,isNullable:()=>w1,hasResolverMetadata:()=>D9,hasFieldMetadata:()=>U9,getResolverMetadata:()=>G9,getFieldsMetadata:()=>B9,getFieldMetadata:()=>w9,getDefaultValue:()=>H6,getArgumentsMetadata:()=>j$,Subscription:()=>X9,Resolver:()=>Q9,Query:()=>W9,Mutation:()=>H9,GraphQLSubscription:()=>X9,GraphQLSchemaBuilder:()=>S$,GraphQLQuery:()=>W9,GraphQLPlugin:()=>A$,GraphQLMutation:()=>H9,GraphQLCtx:()=>Y9,GQLSubscription:()=>X9,GQLQuery:()=>W9,GQLMutation:()=>H9,GQLContext:()=>Y9,Arg:()=>q9});module.exports=M0(nH);var dH={};L0(dH,{z:()=>z});module.exports=M0(dH);var UX={};L0(UX,{setupTestApp:()=>o4,mockDependency:()=>s4,createTestClient:()=>O6,createTestApp:()=>C6,clearMocks:()=>r4,TestClient:()=>m1});module.exports=M0(UX);class m1{hono;constructor($){this.hono=$.getHono()}async get($,J){return this.request("GET",$,J)}async post($,J){return this.request("POST",$,J)}async put($,J){return this.request("PUT",$,J)}async delete($,J){return this.request("DELETE",$,J)}async patch($,J){return this.request("PATCH",$,J)}async request($,J,Q){let W=this.buildUrl(J,Q?.query),H={method:$,headers:this.buildHeaders(Q)};if(Q?.body!==void 0)H.body=Q.body;else if(Q?.json!==void 0)H.body=JSON.stringify(Q.json);let X=await this.hono.request(W,H),q=await X.text(),Y;try{Y=JSON.parse(q)}catch{Y=q}return{status:X.status,headers:X.headers,body:Y,text:q,json:async()=>JSON.parse(q),ok:X.ok}}buildUrl($,J){if(!J||Object.keys(J).length===0)return $;let Q=new URLSearchParams(J).toString();return`${$}?${Q}`}buildHeaders($){let J={...$?.headers};if($?.json!==void 0&&!J["Content-Type"])J["Content-Type"]="application/json";return J}}var k4=($,J,Q)=>{return(W,H)=>{let X=-1;return q(0);async function q(Y){if(Y<=X)throw Error("next() called multiple times");X=Y;let G,B=!1,w;if($[Y])w=$[Y][0][0],W.req.routeIndex=Y;else w=Y===$.length&&H||void 0;if(w)try{G=await w(W,()=>q(Y+1))}catch(_){if(_ instanceof Error&&J)W.error=_,G=await J(_,W),B=!0;else throw _}else if(W.finalized===!1&&Q)G=await Q(W);if(G&&(W.finalized===!1||B))W.res=G;return W}}};var O9=Symbol();var M9=async($,J=Object.create(null))=>{let{all:Q=!1,dot:W=!1}=J,X=($ instanceof q6?$.raw.headers:$.headers).get("Content-Type");if(X?.startsWith("multipart/form-data")||X?.startsWith("application/x-www-form-urlencoded"))return iH($,{all:Q,dot:W});return{}};async function iH($,J){let Q=await $.formData();if(Q)return pH(Q,J);return{}}function pH($,J){let Q=Object.create(null);if($.forEach((W,H)=>{if(!(J.all||H.endsWith("[]")))Q[H]=W;else sH(Q,H,W)}),J.dot)Object.entries(Q).forEach(([W,H])=>{if(W.includes("."))oH(Q,W,H),delete Q[W]});return Q}var sH=($,J,Q)=>{if($[J]!==void 0)if(Array.isArray($[J]))$[J].push(Q);else $[J]=[$[J],Q];else if(!J.endsWith("[]"))$[J]=Q;else $[J]=[Q]},oH=($,J,Q)=>{let W=$,H=J.split(".");H.forEach((X,q)=>{if(q===H.length-1)W[X]=Q;else{if(!W[X]||typeof W[X]!=="object"||Array.isArray(W[X])||W[X]instanceof File)W[X]=Object.create(null);W=W[X]}})};var f4=($)=>{let J=$.split("/");if(J[0]==="")J.shift();return J},b9=($)=>{let{groups:J,path:Q}=rH($),W=f4(Q);return tH(W,J)},rH=($)=>{let J=[];return $=$.replace(/\{[^}]+\}/g,(Q,W)=>{let H=`@${W}`;return J.push([H,Q]),H}),{groups:J,path:$}},tH=($,J)=>{for(let Q=J.length-1;Q>=0;Q--){let[W]=J[Q];for(let H=$.length-1;H>=0;H--)if($[H].includes(W)){$[H]=$[H].replace(W,J[Q][1]);break}}return $},Y6={},P9=($,J)=>{if($==="*")return"*";let Q=$.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(Q){let W=`${$}#${J}`;if(!Y6[W])if(Q[2])Y6[W]=J&&J[0]!==":"&&J[0]!=="*"?[W,Q[1],new RegExp(`^${Q[2]}(?=/${J})`)]:[$,Q[1],new RegExp(`^${Q[2]}$`)];else Y6[W]=[$,Q[1],!0];return Y6[W]}return null},c1=($,J)=>{try{return J($)}catch{return $.replace(/(?:%[0-9A-Fa-f]{2})+/g,(Q)=>{try{return J(Q)}catch{return Q}})}},aH=($)=>c1($,decodeURI),T4=($)=>{let J=$.url,Q=J.indexOf("/",J.indexOf(":")+4),W=Q;for(;W<J.length;W++){let H=J.charCodeAt(W);if(H===37){let X=J.indexOf("?",W),q=J.slice(Q,X===-1?void 0:X);return aH(q.includes("%25")?q.replace(/%25/g,"%2525"):q)}else if(H===63)break}return J.slice(Q,W)};var Z9=($)=>{let J=T4($);return J.length>1&&J.at(-1)==="/"?J.slice(0,-1):J},U1=($,J,...Q)=>{if(Q.length)J=U1(J,...Q);return`${$?.[0]==="/"?"":"/"}${$}${J==="/"?"":`${$?.at(-1)==="/"?"":"/"}${J?.[0]==="/"?J.slice(1):J}`}`},G6=($)=>{if($.charCodeAt($.length-1)!==63||!$.includes(":"))return null;let J=$.split("/"),Q=[],W="";return J.forEach((H)=>{if(H!==""&&!/\:/.test(H))W+="/"+H;else if(/\:/.test(H))if(/\?/.test(H)){if(Q.length===0&&W==="")Q.push("/");else Q.push(W);let X=H.replace("?","");W+="/"+X,Q.push(W)}else W+="/"+H}),Q.filter((H,X,q)=>q.indexOf(H)===X)},K4=($)=>{if(!/[%+]/.test($))return $;if($.indexOf("+")!==-1)$=$.replace(/\+/g," ");return $.indexOf("%")!==-1?c1($,R$):$},I9=($,J,Q)=>{let W;if(!Q&&J&&!/[%+]/.test(J)){let q=$.indexOf(`?${J}`,8);if(q===-1)q=$.indexOf(`&${J}`,8);while(q!==-1){let Y=$.charCodeAt(q+J.length+1);if(Y===61){let G=q+J.length+2,B=$.indexOf("&",G);return K4($.slice(G,B===-1?void 0:B))}else if(Y==38||isNaN(Y))return"";q=$.indexOf(`&${J}`,q+1)}if(W=/[%+]/.test($),!W)return}let H={};W??=/[%+]/.test($);let X=$.indexOf("?",8);while(X!==-1){let q=$.indexOf("&",X+1),Y=$.indexOf("=",X);if(Y>q&&q!==-1)Y=-1;let G=$.slice(X+1,Y===-1?q===-1?void 0:q:Y);if(W)G=K4(G);if(X=q,G==="")continue;let B;if(Y===-1)B="";else if(B=$.slice(Y+1,q===-1?void 0:q),W)B=K4(B);if(Q){if(!(H[G]&&Array.isArray(H[G])))H[G]=[];H[G].push(B)}else H[G]??=B}return J?H[J]:H},k9=I9,K9=($,J)=>{return I9($,J,!0)},R$=decodeURIComponent;var f9=($)=>c1($,R$),q6=class{raw;#J;#$;routeIndex=0;path;bodyCache={};constructor($,J="/",Q=[[]]){this.raw=$,this.path=J,this.#$=Q,this.#J={}}param($){return $?this.#Q($):this.#X()}#Q($){let J=this.#$[0][this.routeIndex][1][$],Q=this.#H(J);return Q&&/\%/.test(Q)?f9(Q):Q}#X(){let $={},J=Object.keys(this.#$[0][this.routeIndex][1]);for(let Q of J){let W=this.#H(this.#$[0][this.routeIndex][1][Q]);if(W!==void 0)$[Q]=/\%/.test(W)?f9(W):W}return $}#H($){return this.#$[1]?this.#$[1][$]:$}query($){return k9(this.url,$)}queries($){return K9(this.url,$)}header($){if($)return this.raw.headers.get($)??void 0;let J={};return this.raw.headers.forEach((Q,W)=>{J[W]=Q}),J}async parseBody($){return this.bodyCache.parsedBody??=await M9(this,$)}#W=($)=>{let{bodyCache:J,raw:Q}=this,W=J[$];if(W)return W;let H=Object.keys(J)[0];if(H)return J[H].then((X)=>{if(H==="json")X=JSON.stringify(X);return new Response(X)[$]()});return J[$]=Q[$]()};json(){return this.#W("text").then(($)=>JSON.parse($))}text(){return this.#W("text")}arrayBuffer(){return this.#W("arrayBuffer")}blob(){return this.#W("blob")}formData(){return this.#W("formData")}addValidatedData($,J){this.#J[$]=J}valid($){return this.#J[$]}get url(){return this.raw.url}get method(){return this.raw.method}get[O9](){return this.#$}get matchedRoutes(){return this.#$[0].map(([[,$]])=>$)}get routePath(){return this.#$[0].map(([[,$]])=>$)[this.routeIndex].path}};var T9={Stringify:1,BeforeStream:2,Stream:3},eH=($,J)=>{let Q=new String($);return Q.isEscaped=!0,Q.callbacks=J,Q};var x4=async($,J,Q,W,H)=>{if(typeof $==="object"&&!($ instanceof String)){if(!($ instanceof Promise))$=$.toString();if($ instanceof Promise)$=await $}let X=$.callbacks;if(!X?.length)return Promise.resolve($);if(H)H[0]+=$;else H=[$];let q=Promise.all(X.map((Y)=>Y({phase:J,buffer:H,context:W}))).then((Y)=>Promise.all(Y.filter(Boolean).map((G)=>x4(G,J,!1,W,H))).then(()=>H[0]));if(Q)return eH(await q,X);else return q};var $X="text/plain; charset=UTF-8",v4=($,J)=>{return{"Content-Type":$,...J}},x9=class{#J;#$;env={};#Q;finalized=!1;error;#X;#H;#W;#w;#G;#B;#Y;#D;#U;constructor($,J){if(this.#J=$,J)this.#H=J.executionCtx,this.env=J.env,this.#B=J.notFoundHandler,this.#U=J.path,this.#D=J.matchResult}get req(){return this.#$??=new q6(this.#J,this.#U,this.#D),this.#$}get event(){if(this.#H&&"respondWith"in this.#H)return this.#H;else throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#H)return this.#H;else throw Error("This context has no ExecutionContext")}get res(){return this.#W||=new Response(null,{headers:this.#Y??=new Headers})}set res($){if(this.#W&&$){$=new Response($.body,$);for(let[J,Q]of this.#W.headers.entries()){if(J==="content-type")continue;if(J==="set-cookie"){let W=this.#W.headers.getSetCookie();$.headers.delete("set-cookie");for(let H of W)$.headers.append("set-cookie",H)}else $.headers.set(J,Q)}}this.#W=$,this.finalized=!0}render=(...$)=>{return this.#G??=(J)=>this.html(J),this.#G(...$)};setLayout=($)=>this.#w=$;getLayout=()=>this.#w;setRenderer=($)=>{this.#G=$};header=($,J,Q)=>{if(this.finalized)this.#W=new Response(this.#W.body,this.#W);let W=this.#W?this.#W.headers:this.#Y??=new Headers;if(J===void 0)W.delete($);else if(Q?.append)W.append($,J);else W.set($,J)};status=($)=>{this.#X=$};set=($,J)=>{this.#Q??=new Map,this.#Q.set($,J)};get=($)=>{return this.#Q?this.#Q.get($):void 0};get var(){if(!this.#Q)return{};return Object.fromEntries(this.#Q)}#q($,J,Q){let W=this.#W?new Headers(this.#W.headers):this.#Y??new Headers;if(typeof J==="object"&&"headers"in J){let X=J.headers instanceof Headers?J.headers:new Headers(J.headers);for(let[q,Y]of X)if(q.toLowerCase()==="set-cookie")W.append(q,Y);else W.set(q,Y)}if(Q)for(let[X,q]of Object.entries(Q))if(typeof q==="string")W.set(X,q);else{W.delete(X);for(let Y of q)W.append(X,Y)}let H=typeof J==="number"?J:J?.status??this.#X;return new Response($,{status:H,headers:W})}newResponse=(...$)=>this.#q(...$);body=($,J,Q)=>this.#q($,J,Q);text=($,J,Q)=>{return!this.#Y&&!this.#X&&!J&&!Q&&!this.finalized?new Response($):this.#q($,J,v4($X,Q))};json=($,J,Q)=>{return this.#q(JSON.stringify($),J,v4("application/json",Q))};html=($,J,Q)=>{let W=(H)=>this.#q(H,J,v4("text/html; charset=UTF-8",Q));return typeof $==="object"?x4($,T9.Stringify,!1,{}).then(W):W($)};redirect=($,J)=>{let Q=String($);return this.header("Location",!/[^\x00-\xFF]/.test(Q)?Q:encodeURI(Q)),this.newResponse(null,J??302)};notFound=()=>{return this.#B??=()=>new Response,this.#B(this)}};var a="ALL",v9="all",h9=["get","post","put","delete","options","patch"],B6="Can not add a route since the matcher is already built.",w6=class extends Error{};var g9="__COMPOSED_HANDLER";var JX=($)=>{return $.text("404 Not Found",404)},y9=($,J)=>{if("getResponse"in $){let Q=$.getResponse();return J.newResponse(Q.body,Q)}return console.error($),J.text("Internal Server Error",500)},h4=class{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#J="/";routes=[];constructor($={}){[...h9,v9].forEach((H)=>{this[H]=(X,...q)=>{if(typeof X==="string")this.#J=X;else this.#X(H,this.#J,X);return q.forEach((Y)=>{this.#X(H,this.#J,Y)}),this}}),this.on=(H,X,...q)=>{for(let Y of[X].flat()){this.#J=Y;for(let G of[H].flat())q.map((B)=>{this.#X(G.toUpperCase(),this.#J,B)})}return this},this.use=(H,...X)=>{if(typeof H==="string")this.#J=H;else this.#J="*",X.unshift(H);return X.forEach((q)=>{this.#X(a,this.#J,q)}),this};let{strict:Q,...W}=$;Object.assign(this,W),this.getPath=Q??!0?$.getPath??T4:Z9}#$(){let $=new h4({router:this.router,getPath:this.getPath});return $.errorHandler=this.errorHandler,$.#Q=this.#Q,$.routes=this.routes,$}#Q=JX;errorHandler=y9;route($,J){let Q=this.basePath($);return J.routes.map((W)=>{let H;if(J.errorHandler===y9)H=W.handler;else H=async(X,q)=>(await k4([],J.errorHandler)(X,()=>W.handler(X,q))).res,H[g9]=W.handler;Q.#X(W.method,W.path,H)}),this}basePath($){let J=this.#$();return J._basePath=U1(this._basePath,$),J}onError=($)=>{return this.errorHandler=$,this};notFound=($)=>{return this.#Q=$,this};mount($,J,Q){let W,H;if(Q)if(typeof Q==="function")H=Q;else if(H=Q.optionHandler,Q.replaceRequest===!1)W=(Y)=>Y;else W=Q.replaceRequest;let X=H?(Y)=>{let G=H(Y);return Array.isArray(G)?G:[G]}:(Y)=>{let G=void 0;try{G=Y.executionCtx}catch{}return[Y.env,G]};W||=(()=>{let Y=U1(this._basePath,$),G=Y==="/"?0:Y.length;return(B)=>{let w=new URL(B.url);return w.pathname=w.pathname.slice(G)||"/",new Request(w,B)}})();let q=async(Y,G)=>{let B=await J(W(Y.req.raw),...X(Y));if(B)return B;await G()};return this.#X(a,U1($,"*"),q),this}#X($,J,Q){$=$.toUpperCase(),J=U1(this._basePath,J);let W={basePath:this._basePath,path:J,method:$,handler:Q};this.router.add($,J,[Q,W]),this.routes.push(W)}#H($,J){if($ instanceof Error)return this.errorHandler($,J);throw $}#W($,J,Q,W){if(W==="HEAD")return(async()=>new Response(null,await this.#W($,J,Q,"GET")))();let H=this.getPath($,{env:Q}),X=this.router.match(W,H),q=new x9($,{path:H,matchResult:X,env:Q,executionCtx:J,notFoundHandler:this.#Q});if(X[0].length===1){let G;try{G=X[0][0][0][0](q,async()=>{q.res=await this.#Q(q)})}catch(B){return this.#H(B,q)}return G instanceof Promise?G.then((B)=>B||(q.finalized?q.res:this.#Q(q))).catch((B)=>this.#H(B,q)):G??this.#Q(q)}let Y=k4(X[0],this.errorHandler,this.#Q);return(async()=>{try{let G=await Y(q);if(!G.finalized)throw Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return G.res}catch(G){return this.#H(G,q)}})()}fetch=($,...J)=>{return this.#W($,J[1],J[0],$.method)};request=($,J,Q,W)=>{if($ instanceof Request)return this.fetch(J?new Request($,J):$,Q,W);return $=$.toString(),this.fetch(new Request(/^https?:\/\//.test($)?$:`http://localhost${U1("/",$)}`,J),Q,W)};fire=()=>{addEventListener("fetch",($)=>{$.respondWith(this.#W($.request,$,void 0,$.request.method))})}};var D6="[^/]+",C$=".*",O$="(?:|/.*)",_1=Symbol(),QX=new Set(".\\+*[^]$()");function WX($,J){if($.length===1)return J.length===1?$<J?-1:1:-1;if(J.length===1)return 1;if($===C$||$===O$)return 1;else if(J===C$||J===O$)return-1;if($===D6)return 1;else if(J===D6)return-1;return $.length===J.length?$<J?-1:1:J.length-$.length}var U6=class{#J;#$;#Q=Object.create(null);insert($,J,Q,W,H){if($.length===0){if(this.#J!==void 0)throw _1;if(H)return;this.#J=J;return}let[X,...q]=$,Y=X==="*"?q.length===0?["","",C$]:["","",D6]:X==="/*"?["","",O$]:X.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),G;if(Y){let B=Y[1],w=Y[2]||D6;if(B&&Y[2]){if(w===".*")throw _1;if(w=w.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(w))throw _1}if(G=this.#Q[w],!G){if(Object.keys(this.#Q).some((_)=>_!==C$&&_!==O$))throw _1;if(H)return;if(G=this.#Q[w]=new U6,B!=="")G.#$=W.varIndex++}if(!H&&B!=="")Q.push([B,G.#$])}else if(G=this.#Q[X],!G){if(Object.keys(this.#Q).some((B)=>B.length>1&&B!==C$&&B!==O$))throw _1;if(H)return;G=this.#Q[X]=new U6}G.insert(q,J,Q,W,H)}buildRegExpStr(){let J=Object.keys(this.#Q).sort(WX).map((Q)=>{let W=this.#Q[Q];return(typeof W.#$==="number"?`(${Q})@${W.#$}`:QX.has(Q)?`\\${Q}`:Q)+W.buildRegExpStr()});if(typeof this.#J==="number")J.unshift(`#${this.#J}`);if(J.length===0)return"";if(J.length===1)return J[0];return"(?:"+J.join("|")+")"}};var u9=class{#J={varIndex:0};#$=new U6;insert($,J,Q){let W=[],H=[];for(let q=0;;){let Y=!1;if($=$.replace(/\{[^}]+\}/g,(G)=>{let B=`@\\${q}`;return H[q]=[B,G],q++,Y=!0,B}),!Y)break}let X=$.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let q=H.length-1;q>=0;q--){let[Y]=H[q];for(let G=X.length-1;G>=0;G--)if(X[G].indexOf(Y)!==-1){X[G]=X[G].replace(Y,H[q][1]);break}}return this.#$.insert(X,J,W,this.#J,Q),W}buildRegExp(){let $=this.#$.buildRegExpStr();if($==="")return[/^$/,[],[]];let J=0,Q=[],W=[];return $=$.replace(/#(\d+)|@(\d+)|\.\*\$/g,(H,X,q)=>{if(X!==void 0)return Q[++J]=Number(X),"$()";if(q!==void 0)return W[Number(q)]=++J,"";return""}),[new RegExp(`^${$}`),Q,W]}};var l9=[],HX=[/^$/,[],Object.create(null)],m9=Object.create(null);function c9($){return m9[$]??=new RegExp($==="*"?"":`^${$.replace(/\/\*$|([.\\+*[^\]$()])/g,(J,Q)=>Q?`\\${Q}`:"(?:|/.*)")}$`)}function XX(){m9=Object.create(null)}function qX($){let J=new u9,Q=[];if($.length===0)return HX;let W=$.map((B)=>[!/\*|\/:/.test(B[0]),...B]).sort(([B,w],[_,R])=>B?1:_?-1:w.length-R.length),H=Object.create(null);for(let B=0,w=-1,_=W.length;B<_;B++){let[R,S,P]=W[B];if(R)H[S]=[P.map(([o])=>[o,Object.create(null)]),l9];else w++;let h;try{h=J.insert(S,w,R)}catch(o){throw o===_1?new w6(S):o}if(R)continue;Q[w]=P.map(([o,W0])=>{let z0=Object.create(null);W0-=1;for(;W0>=0;W0--){let[t,R0]=h[W0];z0[t]=R0}return[o,z0]})}let[X,q,Y]=J.buildRegExp();for(let B=0,w=Q.length;B<w;B++)for(let _=0,R=Q[B].length;_<R;_++){let S=Q[B][_]?.[1];if(!S)continue;let P=Object.keys(S);for(let h=0,o=P.length;h<o;h++)S[P[h]]=Y[S[P[h]]]}let G=[];for(let B in q)G[B]=Q[q[B]];return[X,G,H]}function n1($,J){if(!$)return;for(let Q of Object.keys($).sort((W,H)=>H.length-W.length))if(c9(Q).test(J))return[...$[Q]];return}var g4=class{name="RegExpRouter";#J;#$;constructor(){this.#J={[a]:Object.create(null)},this.#$={[a]:Object.create(null)}}add($,J,Q){let W=this.#J,H=this.#$;if(!W||!H)throw Error(B6);if(!W[$])[W,H].forEach((Y)=>{Y[$]=Object.create(null),Object.keys(Y[a]).forEach((G)=>{Y[$][G]=[...Y[a][G]]})});if(J==="/*")J="*";let X=(J.match(/\/:/g)||[]).length;if(/\*$/.test(J)){let Y=c9(J);if($===a)Object.keys(W).forEach((G)=>{W[G][J]||=n1(W[G],J)||n1(W[a],J)||[]});else W[$][J]||=n1(W[$],J)||n1(W[a],J)||[];Object.keys(W).forEach((G)=>{if($===a||$===G)Object.keys(W[G]).forEach((B)=>{Y.test(B)&&W[G][B].push([Q,X])})}),Object.keys(H).forEach((G)=>{if($===a||$===G)Object.keys(H[G]).forEach((B)=>Y.test(B)&&H[G][B].push([Q,X]))});return}let q=G6(J)||[J];for(let Y=0,G=q.length;Y<G;Y++){let B=q[Y];Object.keys(H).forEach((w)=>{if($===a||$===w)H[w][B]||=[...n1(W[w],B)||n1(W[a],B)||[]],H[w][B].push([Q,X-G+Y+1])})}}match($,J){XX();let Q=this.#Q();return this.match=(W,H)=>{let X=Q[W]||Q[a],q=X[2][H];if(q)return q;let Y=H.match(X[0]);if(!Y)return[[],l9];let G=Y.indexOf("",1);return[X[1][G],Y]},this.match($,J)}#Q(){let $=Object.create(null);return Object.keys(this.#$).concat(Object.keys(this.#J)).forEach((J)=>{$[J]||=this.#X(J)}),this.#J=this.#$=void 0,$}#X($){let J=[],Q=$===a;if([this.#J,this.#$].forEach((W)=>{let H=W[$]?Object.keys(W[$]).map((X)=>[X,W[$][X]]):[];if(H.length!==0)Q||=!0,J.push(...H);else if($!==a)J.push(...Object.keys(W[a]).map((X)=>[X,W[a][X]]))}),!Q)return null;else return qX(J)}};var y4=class{name="SmartRouter";#J=[];#$=[];constructor($){this.#J=$.routers}add($,J,Q){if(!this.#$)throw Error(B6);this.#$.push([$,J,Q])}match($,J){if(!this.#$)throw Error("Fatal error");let Q=this.#J,W=this.#$,H=Q.length,X=0,q;for(;X<H;X++){let Y=Q[X];try{for(let G=0,B=W.length;G<B;G++)Y.add(...W[G]);q=Y.match($,J)}catch(G){if(G instanceof w6)continue;throw G}this.match=Y.match.bind(Y),this.#J=[Y],this.#$=void 0;break}if(X===H)throw Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,q}get activeRouter(){if(this.#$||this.#J.length!==1)throw Error("No active router has been determined yet.");return this.#J[0]}};var M$=Object.create(null),u4=class{#J;#$;#Q;#X=0;#H=M$;constructor($,J,Q){if(this.#$=Q||Object.create(null),this.#J=[],$&&J){let W=Object.create(null);W[$]={handler:J,possibleKeys:[],score:0},this.#J=[W]}this.#Q=[]}insert($,J,Q){this.#X=++this.#X;let W=this,H=b9(J),X=[];for(let q=0,Y=H.length;q<Y;q++){let G=H[q],B=H[q+1],w=P9(G,B),_=Array.isArray(w)?w[0]:G;if(_ in W.#$){if(W=W.#$[_],w)X.push(w[1]);continue}if(W.#$[_]=new u4,w)W.#Q.push(w),X.push(w[1]);W=W.#$[_]}return W.#J.push({[$]:{handler:Q,possibleKeys:X.filter((q,Y,G)=>G.indexOf(q)===Y),score:this.#X}}),W}#W($,J,Q,W){let H=[];for(let X=0,q=$.#J.length;X<q;X++){let Y=$.#J[X],G=Y[J]||Y[a],B={};if(G!==void 0){if(G.params=Object.create(null),H.push(G),Q!==M$||W&&W!==M$)for(let w=0,_=G.possibleKeys.length;w<_;w++){let R=G.possibleKeys[w],S=B[G.score];G.params[R]=W?.[R]&&!S?W[R]:Q[R]??W?.[R],B[G.score]=!0}}}return H}search($,J){let Q=[];this.#H=M$;let H=[this],X=f4(J),q=[];for(let Y=0,G=X.length;Y<G;Y++){let B=X[Y],w=Y===G-1,_=[];for(let R=0,S=H.length;R<S;R++){let P=H[R],h=P.#$[B];if(h)if(h.#H=P.#H,w){if(h.#$["*"])Q.push(...this.#W(h.#$["*"],$,P.#H));Q.push(...this.#W(h,$,P.#H))}else _.push(h);for(let o=0,W0=P.#Q.length;o<W0;o++){let z0=P.#Q[o],t=P.#H===M$?{}:{...P.#H};if(z0==="*"){let h0=P.#$["*"];if(h0)Q.push(...this.#W(h0,$,P.#H)),h0.#H=t,_.push(h0);continue}let[R0,H0,U0]=z0;if(!B&&!(U0 instanceof RegExp))continue;let C0=P.#$[R0],H4=X.slice(Y).join("/");if(U0 instanceof RegExp){let h0=U0.exec(H4);if(h0){if(t[H0]=h0[0],Q.push(...this.#W(C0,$,P.#H,t)),Object.keys(C0.#$).length){C0.#H=t;let X4=h0[0].match(/\//)?.length??0;(q[X4]||=[]).push(C0)}continue}}if(U0===!0||U0.test(B))if(t[H0]=B,w){if(Q.push(...this.#W(C0,$,t,P.#H)),C0.#$["*"])Q.push(...this.#W(C0.#$["*"],$,t,P.#H))}else C0.#H=t,_.push(C0)}}H=_.concat(q.shift()??[])}if(Q.length>1)Q.sort((Y,G)=>{return Y.score-G.score});return[Q.map(({handler:Y,params:G})=>[Y,G])]}};var l4=class{name="TrieRouter";#J;constructor(){this.#J=new u4}add($,J,Q){let W=G6(J);if(W){for(let H=0,X=W.length;H<X;H++)this.#J.insert($,W[H],Q);return}this.#J.insert($,J,Q)}match($,J){return this.#J.search($,J)}};var m4=class extends h4{constructor($={}){super($);this.router=$.router??new y4({routers:[new g4,new l4]})}};class b${singletons=new Map;requestScoped=new WeakMap;providers=new Map;resolutionStack=new Set;providerNameCache=new WeakMap;stats={singletonHits:0,singletonMisses:0,requestHits:0,requestMisses:0,transientCreations:0};register($,J){this.providers.set($,J||{scope:"transient"})}async resolve($,J){let Q=this.providers.get($)||{scope:J?.scope||"transient"},W=J?.scope||Q.scope||"transient";if(W==="singleton"){if(this.singletons.has($))return this.stats.singletonHits++,this.singletons.get($);if(this.stats.singletonMisses++,this.resolutionStack.has($))throw Error(`Circular dependency detected: ${this.buildCircularDependencyMessage($)}`);this.resolutionStack.add($);try{let H=await this.create($,Q,J?.context);return this.singletons.set($,H),H}finally{this.resolutionStack.delete($)}}if(W==="request"&&J?.context){let H=this.requestScoped.get(J.context);if(H?.has($))return this.stats.requestHits++,H.get($);if(this.stats.requestMisses++,!H)H=new Map,this.requestScoped.set(J.context,H);if(this.resolutionStack.has($))throw Error(`Circular dependency detected: ${this.buildCircularDependencyMessage($)}`);this.resolutionStack.add($);try{let X=await this.create($,Q,J.context);return H.set($,X),X}finally{this.resolutionStack.delete($)}}if(this.stats.transientCreations++,this.resolutionStack.has($))throw Error(`Circular dependency detected: ${this.buildCircularDependencyMessage($)}`);this.resolutionStack.add($);try{return await this.create($,Q,J?.context)}finally{this.resolutionStack.delete($)}}buildCircularDependencyMessage($){let J=Array.from(this.resolutionStack),Q=this.getProviderName($);return J.map((H)=>this.getProviderName(H)).join(" -> ")+" -> "+Q}async create($,J,Q){if(J.factory)return J.factory();if(typeof $==="function")if($.prototype&&$.prototype.constructor===$){let W=new $;return await this.resolveNestedDependencies(W,Q),W}else{let W=$();return W instanceof Promise?await W:W}throw Error("Invalid provider type")}async resolveNestedDependencies($,J){}getProviderName($){let J=this.providerNameCache.get($);if(J)return J;let Q;if(typeof $==="function")if($.name)Q=$.name;else Q=$.toString().substring(0,50);else Q=String($);return this.providerNameCache.set($,Q),Q}clear(){this.singletons.clear(),this.providers.clear(),this.resolutionStack.clear(),this.providerNameCache=new WeakMap,this.resetStats()}clearRequestScope($){this.requestScoped.delete($)}getStats(){let $=this.stats.singletonHits+this.stats.singletonMisses,J=$>0?this.stats.singletonHits/$*100:0,Q=this.stats.requestHits+this.stats.requestMisses,W=Q>0?this.stats.requestHits/Q*100:0;return{singletonHits:this.stats.singletonHits,singletonMisses:this.stats.singletonMisses,singletonHitRate:Math.round(J*100)/100,requestHits:this.stats.requestHits,requestMisses:this.stats.requestMisses,requestHitRate:Math.round(W*100)/100,transientCreations:this.stats.transientCreations}}resetStats(){this.stats={singletonHits:0,singletonMisses:0,requestHits:0,requestMisses:0,transientCreations:0}}}var YX=/^[\w!#$%&'*.^`|~+-]+$/,GX=/^[ !#-:<-[\]-~]*$/,c4=($,J)=>{if(J&&$.indexOf(J)===-1)return{};let Q=$.trim().split(";"),W={};for(let H of Q){H=H.trim();let X=H.indexOf("=");if(X===-1)continue;let q=H.substring(0,X).trim();if(J&&J!==q||!YX.test(q))continue;let Y=H.substring(X+1).trim();if(Y.startsWith('"')&&Y.endsWith('"'))Y=Y.slice(1,-1);if(GX.test(Y)){if(W[q]=Y.indexOf("%")!==-1?c1(Y,R$):Y,J)break}}return W};var BX=($,J,Q={})=>{let W=`${$}=${J}`;if($.startsWith("__Secure-")&&!Q.secure)throw Error("__Secure- Cookie must have Secure attributes");if($.startsWith("__Host-")){if(!Q.secure)throw Error("__Host- Cookie must have Secure attributes");if(Q.path!=="/")throw Error('__Host- Cookie must have Path attributes with "/"');if(Q.domain)throw Error("__Host- Cookie must not have Domain attributes")}if(Q&&typeof Q.maxAge==="number"&&Q.maxAge>=0){if(Q.maxAge>34560000)throw Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");W+=`; Max-Age=${Q.maxAge|0}`}if(Q.domain&&Q.prefix!=="host")W+=`; Domain=${Q.domain}`;if(Q.path)W+=`; Path=${Q.path}`;if(Q.expires){if(Q.expires.getTime()-Date.now()>34560000000)throw Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");W+=`; Expires=${Q.expires.toUTCString()}`}if(Q.httpOnly)W+="; HttpOnly";if(Q.secure)W+="; Secure";if(Q.sameSite)W+=`; SameSite=${Q.sameSite.charAt(0).toUpperCase()+Q.sameSite.slice(1)}`;if(Q.priority)W+=`; Priority=${Q.priority.charAt(0).toUpperCase()+Q.priority.slice(1)}`;if(Q.partitioned){if(!Q.secure)throw Error("Partitioned Cookie must have Secure attributes");W+="; Partitioned"}return W},_6=($,J,Q)=>{return J=encodeURIComponent(J),BX($,J,Q)};var V6=($,J,Q)=>{let W=$.req.raw.headers.get("Cookie");if(typeof J==="string"){if(!W)return;let X=J;if(Q==="secure")X="__Secure-"+J;else if(Q==="host")X="__Host-"+J;return c4(W,X)[X]}if(!W)return{};return c4(W)};var wX=($,J,Q)=>{let W;if(Q?.prefix==="secure")W=_6("__Secure-"+$,J,{path:"/",...Q,secure:!0});else if(Q?.prefix==="host")W=_6("__Host-"+$,J,{...Q,path:"/",secure:!0,domain:void 0});else W=_6($,J,{path:"/",...Q});return W},F6=($,J,Q,W)=>{let H=wX(J,Q,W);$.header("Set-Cookie",H,{append:!0})};class n4{static json($,J=200,Q){return new z6($,J,Q)}static html($,J=200){return new N6($,J)}static file($,J){return new j6($,J)}static stream($,J){return new S6($,J)}static redirect($,J=302){return new L6($,J)}}class z6{data;status;headers;constructor($,J=200,Q={}){this.data=$;this.status=J;this.headers=Q}toHonoResponse($){return $.json(this.data,this.status,this.headers)}}class N6{content;status;constructor($,J=200){this.content=$;this.status=J}toHonoResponse($){return $.html(this.content,this.status)}}class L6{url;status;constructor($,J=302){this.url=$;this.status=J}toHonoResponse($){return $.redirect(this.url,this.status)}}class j6{path;options;constructor($,J){this.path=$;this.options=J}async toHonoResponse($){try{let J=typeof Bun<"u"?Bun.file(this.path):await this.readFileNode(this.path),W={"Content-Type":this.options?.contentType||this.guessContentType(this.path)};if(this.options?.download||this.options?.filename){let H=this.options?.filename||this.path.split("/").pop()||"download",X=this.options?.download?"attachment":"inline";W["Content-Disposition"]=`${X}; filename="${H}"`}if(typeof Bun<"u"&&J instanceof Blob)return $.body(J,200,W);else return $.body(J,200,W)}catch(J){return $.json({error:"File not found",message:J instanceof Error?J.message:"Unknown error"},404)}}async readFileNode($){throw Error("File reading in Node.js requires fs module - use Bun runtime or implement adapter")}guessContentType($){let J=$.split(".").pop()?.toLowerCase();return{html:"text/html",css:"text/css",js:"application/javascript",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",svg:"image/svg+xml",pdf:"application/pdf",txt:"text/plain",xml:"application/xml"}[J||""]||"application/octet-stream"}}class S6{stream;options;constructor($,J){this.stream=$;this.options=J}toHonoResponse($){let J={"Content-Type":this.options?.contentType||"application/octet-stream",...this.options?.headers};return $.body(this.stream,200,J)}}class A6{static serialize($,J){if(J===null||J===void 0)return $.body(null,204);if(J instanceof n4)return J;if(J instanceof z6)return J.toHonoResponse($);if(J instanceof N6)return J.toHonoResponse($);if(J instanceof j6)return J.toHonoResponse($);if(J instanceof S6)return J.toHonoResponse($);if(J instanceof L6)return J.toHonoResponse($);if(J&&typeof J.toHonoResponse==="function")return J.toHonoResponse($);return $.json(J)}}class P${static compile($){let J=this.compilePathRegex($.path),Q=this.resolveParameterOrder($.parameters),W=this.resolveDependencyOrder($.dependencies),H=this.calculateMaxArgumentIndex($.parameters,$.dependencies),X=this.computeParameterFlags($.parameters);return{...$,pathRegex:J,parameterOrder:Q,dependencyOrder:W,maxArgumentIndex:H,...X}}static compilePathRegex($){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return J=J.replace(/\\\{([^}]+)\\\}/g,"(?<$1>[^/]+)"),J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g,"(?<$1>[^/]+)"),J=`^${J}$`,new RegExp(J)}static resolveParameterOrder($){if(!$||$.length===0)return[];return $.map((J)=>J.index).filter((J)=>J!==void 0).sort((J,Q)=>J-Q)}static resolveDependencyOrder($){if(!$||$.length===0)return[];return $.map((J)=>J.index).filter((J)=>J!==void 0).sort((J,Q)=>J-Q)}static calculateMaxArgumentIndex($,J){let Q=-1;if($&&$.length>0){let W=Math.max(...$.map((H)=>H.index));Q=Math.max(Q,W)}if(J&&J.length>0){let W=Math.max(...J.map((H)=>H.index));Q=Math.max(Q,W)}return Q}static computeParameterFlags($){if(!$||$.length===0)return{hasBody:!1,hasQuery:!1,hasParams:!1,hasHeaders:!1,hasCookies:!1,hasDependencies:!1};return{hasBody:$.some((J)=>J.type==="body"),hasQuery:$.some((J)=>J.type==="query"),hasParams:$.some((J)=>J.type==="param"),hasHeaders:$.some((J)=>J.type==="header"),hasCookies:$.some((J)=>J.type==="cookie"),hasDependencies:!1}}static compileAll($){return $.map((J)=>this.compile(J))}}l1();class I${app;metadata;container;validator;errorHandler;compiledRoutes=new Map;constructor($,J,Q,W,H){this.app=$;this.metadata=J;this.container=Q;this.validator=W;this.errorHandler=H}compile(){let $=this.metadata.getRoutes(),J=P$.compileAll($);for(let Q of J){let W=`${Q.target.name}:${Q.propertyKey}`;this.compiledRoutes.set(W,Q);let H=this.createHandler(Q),X=this.normalizePath(Q.path),q=Q.method.toLowerCase();if(Q.middleware&&Q.middleware.length>0)this.app[q](X,...Q.middleware,H);else this.app[q](X,H)}}normalizePath($){if(!$.startsWith("/"))$="/"+$;if($=$.replace(/\{([^}]+)\}/g,":$1"),$.length>1&&$.endsWith("/"))$=$.slice(0,-1);return $}createHandler($){return async(J)=>{try{J.set("routeMetadata",$);let Q=await this.extractParameters(J,$.parameters),W=await this.resolveDependencies(J,$.dependencies),H=this.mergeArguments(Q,W,$.parameters,$.maxArgumentIndex),X;if($.handler)X=await $.handler(J,...H);else{let q=await this.container.resolve($.target,{scope:"transient",context:J});if(typeof q[$.propertyKey]!=="function")throw Error(`Method ${$.propertyKey} not found on controller ${$.target.name}`);X=await q[$.propertyKey](...H)}return this.serializeResponse(J,X)}catch(Q){return await this.handleError(J,Q)}}}serializeResponse($,J){return A6.serialize($,J)}getRouteMetadataForContext($){return $.get("routeMetadata")||null}isAuthRequired($){if($.auth?.required)return!0;return $.parameters.some((J)=>J.type==="current-user")}async handleError($,J){return await this.errorHandler.handle(J,$)}async extractParameters($,J){let Q=[];for(let W of J){if(!W)continue;let H;switch(W.type){case"body":try{H=await $.req.json()}catch(Y){H=null}break;case"query":if(W.name)H=$.req.query(W.name);else H=$.req.query();if(W.schema&&H!==void 0)try{H=W.schema.parse(H)}catch(Y){throw new X6(`Invalid query parameter: ${Y}`)}break;case"param":if(W.name)H=$.req.param(W.name);else H=$.req.param();break;case"header":if(W.name)H=$.req.header(W.name);else{let Y={};$.req.raw.headers.forEach((G,B)=>{Y[B]=G}),H=Y}break;case"cookie":if(W.name)H=V6($,W.name);else{let Y=$.req.header("cookie");if(Y)H=Object.fromEntries(Y.split(";").map((G)=>{let[B,...w]=G.trim().split("=");return[B,w.join("=")]}));else H={}}break;case"request":H=$.req;break;case"response":case"context":H=$;break;case"current-user":H=$.get("auth.user")||null;let X=this.getRouteMetadataForContext($);if(X&&this.isAuthRequired(X)){if(!H){let Y=$.get("auth.error")||"Authentication required",{AuthenticationException:G}=await Promise.resolve().then(() => (F1(),n9));throw new G(Y)}}break;case"token":H=$.get("auth.token")||null;break;case"oauth-user":H=$.get("oauth.user")||null;break;case"oauth-token":H=$.get("oauth.token")||null;break;case"current-session":H=$.get("session")||null;break;case"session-data":let q=$.get("session");if(q&&W.metadata?.key)H=q.data[W.metadata.key];else if(q)H=q.data;else H=null;break;case"csrf-token":H=$.get("csrf.token")||null;break;case"filtered-resource":H=$.get("filtered.resource")||null;break;case"filtered-attributes":H=$.get("filtered.attributes")||[];break;default:H=void 0}if(W.schema)try{H=await this.validator.validate(H,W.schema)}catch(X){throw X}Q[W.index]=H}return Q}mergeArguments($,J,Q,W){let X=Q.filter((B)=>B!==void 0&&B.index!==void 0).map((B)=>B.index),q=X.length>0?Math.max(...X):-1,Y=W!==void 0&&W>=0?W:Math.max(q,$.length-1,J.length-1,0);if(!Number.isFinite(Y)||Y<0)Y=0;let G=Array(Y+1);for(let B=0;B<=Y;B++)if($[B]!==void 0)G[B]=$[B];else if(J[B]!==void 0)G[B]=J[B];return G}async resolveDependencies($,J){let Q=[];for(let W of J){if(!W)continue;try{let H=await this.container.resolve(W.provider,{scope:W.scope,context:$});Q[W.index]=H}catch(H){throw Error(`Failed to resolve dependency at index ${W.index}: ${H instanceof Error?H.message:"Unknown error"}`)}}return Q}}l1();class k${customHandler;isDevelopment;constructor($){this.customHandler=$,this.isDevelopment=!0}setCustomHandler($){this.customHandler=$}async handle($,J){if(console.log("ErrorHandler.handle called with:",$.constructor.name,$.message),this.customHandler)try{return await this.customHandler($,J)}catch(Q){console.error("Custom error handler failed:",Q)}if($ instanceof e0)return console.log("Handling as ValidationException"),this.handleValidationException($,J);if($ instanceof N0)return console.log("Handling as HTTPException"),this.handleHTTPException($,J);return console.log("Handling as generic error"),this.handleGenericError($,J)}handleValidationException($,J){let Q=$.toJSON();if(this.isDevelopment)console.error("Validation Error:",{path:J.req.path,method:J.req.method,details:Q.details});return J.json(Q,$.statusCode)}handleHTTPException($,J){let Q=$.toJSON();if($.statusCode>=500)console.error("HTTP Exception:",{name:$.name,statusCode:$.statusCode,message:$.message,path:J.req.path,method:J.req.method,...this.isDevelopment&&$.stack?{stack:$.stack}:{}});else if(this.isDevelopment)console.warn("HTTP Exception:",{name:$.name,statusCode:$.statusCode,message:$.message,path:J.req.path,method:J.req.method});return J.json(Q,$.statusCode)}handleGenericError($,J){console.error("Internal Server Error:",{name:$.name,message:$.message,path:J.req.path,method:J.req.method,stack:$.stack});let Q={error:"Internal Server Error",statusCode:500};if(this.isDevelopment){if(Q.message=$.message,Q.name=$.name,$.stack)Q.stack=$.stack.split(`
124
+ `).map((W)=>W.trim())}else Q.message="An unexpected error occurred";return J.json(Q,500)}isDevelopmentMode(){return this.isDevelopment}setDevelopmentMode($){this.isDevelopment=$}}class K${plugins=new Map;installed=new Set;register($){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);this.plugins.set($.name,$)}async install($){let J=this.resolveInstallOrder();for(let Q of J)await this.plugins.get(Q).install($),this.installed.add(Q)}isInstalled($){return this.installed.has($)}getPlugin($){return this.plugins.get($)}getPluginNames(){return Array.from(this.plugins.keys())}resolveInstallOrder(){let $=new Set,J=new Set,Q=[],W=(H,X=[])=>{if(J.has(H)){let Y=[...X,H].join(" -> ");throw Error(`Circular dependency detected in plugins: ${Y}`)}if($.has(H))return;J.add(H);let q=this.plugins.get(H);if(!q)throw Error(`Plugin "${H}" is not registered`);if(q.dependencies)for(let Y of q.dependencies){if(!this.plugins.has(Y))throw Error(`Plugin "${H}" depends on "${Y}" which is not registered`);W(Y,[...X,H])}J.delete(H),$.add(H),Q.push(H)};for(let H of this.plugins.keys())W(H);return Q}}class z1{hono;metadata;container;validator;errorHandler;compiler;pluginManager;config;compiled=!1;globalMiddleware=[];groupPrefix="";constructor($){if(this.config={adapter:"hono",title:"Veloce-TS API",version:"1.0.0",docs:!0,...$},this.hono=new m4,this.metadata=new T,this.container=new b$,this.validator=new D1,this.errorHandler=new k$,this.pluginManager=new K$,this.compiler=new I$(this.hono,this.metadata,this.container,this.validator,this.errorHandler),this.config.cors)if(this.config.cors===!0)this.useCors();else this.useCors(this.config.cors)}include($){let J=T.getControllerMetadata($);if(J)this.metadata.registerController($,J);let Q=T.getRouteMethods($);for(let W of Q){let H=T.getRouteMetadata($.prototype,W),X=T.getParameterMetadata($.prototype,W),q=T.getDependencyMetadata($.prototype,W);if(H&&H.method&&H.path!==void 0){let Y=J?.prefix||"",G=this.normalizePath(Y,H.path);this.metadata.registerRoute({target:$,propertyKey:W,method:H.method,path:G,middleware:[...J?.middleware||[],...H.middleware||[]],parameters:X||H.parameters||[],dependencies:q||H.dependencies||[],responses:H.responses||[],docs:H.docs})}}}get($,J){this.registerFunctionalRoute("GET",$,J)}post($,J){this.registerFunctionalRoute("POST",$,J)}put($,J){this.registerFunctionalRoute("PUT",$,J)}delete($,J){this.registerFunctionalRoute("DELETE",$,J)}patch($,J){this.registerFunctionalRoute("PATCH",$,J)}route($){return new p9(this,$)}group($,J){let Q=this.groupPrefix;this.groupPrefix=this.normalizePath(this.groupPrefix,$),J(),this.groupPrefix=Q}registerFunctionalRoute($,J,Q){let W=this.normalizePath(this.groupPrefix,J),H={target:i9,propertyKey:`${$.toLowerCase()}_${W}`,method:$,path:W,middleware:Q.middleware||[],parameters:this.extractParametersFromSchema(Q.schema),dependencies:[],responses:Q.responses||[],docs:Q.docs,handler:Q.handler};this.metadata.registerRoute(H)}extractParametersFromSchema($){let J=[],Q=0;if($?.body)J.push({index:Q++,type:"body",schema:$.body,required:!0});if($?.query)J.push({index:Q++,type:"query",schema:$.query,required:!1});if($?.params)J.push({index:Q++,type:"param",schema:$.params,required:!0});if($?.headers)J.push({index:Q++,type:"header",schema:$.headers,required:!1});return J}use($){this.globalMiddleware.push($),this.hono.use("*",$)}useCors($){let J=q$($);this.use(J)}useRateLimit($){let J=Y$($);this.use(J)}useCompression($){let J=G$($);this.use(J)}usePlugin($){this.pluginManager.register($)}getPluginManager(){return this.pluginManager}onError($){this.errorHandler.setCustomHandler($)}getErrorHandler(){return this.errorHandler}normalizePath(...$){let J=$.filter((Q)=>Q!=="").join("/").replace(/\/+/g,"/").replace(/\/$/,"");return J.startsWith("/")?J:`/${J}`}getHono(){return this.hono}getMetadata(){return this.metadata}getContainer(){return this.container}getCompiler(){return this.compiler}getConfig(){return this.config}isCompiled(){return this.compiled}markCompiled(){this.compiled=!0}async compile(){if(this.compiled){console.warn("Routes have already been compiled. Skipping compilation.");return}await this.pluginManager.install(this),this.compiler.compile(),this.compiled=!0}async listen($,J){if(!this.compiled)await this.compile();return this.createAdapter().listen($,J)}createAdapter(){let $=this.config.adapter||"hono";switch($){case"hono":{let{HonoAdapter:J}=M0(p4);return new J(this.hono)}case"express":{let{ExpressAdapter:J}=M0(d9);return new J(this)}case"native":{let{HonoAdapter:J}=M0(p4);return new J(this.hono)}default:throw Error(`Unknown adapter type: ${$}. Supported adapters: 'hono', 'express', 'native'`)}}}class i9{}class p9{app;path;constructor($,J){this.app=$;this.path=J}get($){return this.app.get(this.path,$),this}post($){return this.app.post(this.path,$),this}put($){return this.app.put(this.path,$),this}delete($){return this.app.delete(this.path,$),this}patch($){return this.app.patch(this.path,$),this}}function C6($){let J={docs:!1,cors:!1,...$};return new z1(J)}function s4($,J,Q,W){let H=$.getContainer(),X=typeof Q==="function"?Q:()=>Q;H.register(J,{scope:W?.scope||"singleton",factory:X})}function O6($){return new m1($)}async function o4($,J){let Q=C6(J);await $(Q),await Q.compile();let W=O6(Q);return{app:Q,client:W}}function r4($){$.getContainer().clear()}var mw={};L0(mw,{zodToJsonSchema:()=>Q6,zodToGraphQLType:()=>T0,zodObjectToGraphQLType:()=>_9,zodObjectToGraphQLInput:()=>V9,z:()=>z,setupTestApp:()=>o4,setSessionData:()=>JW,removeSessionData:()=>QW,mockDependency:()=>s4,isSessionAuthenticated:()=>eQ,isOAuthAuthenticated:()=>cQ,isNullable:()=>w1,isAuthenticated:()=>Tw,hasResolverMetadata:()=>D9,hasFieldMetadata:()=>U9,getUserRoles:()=>u8,getUserPermissions:()=>TQ,getToken:()=>h8,getSessionUserId:()=>$W,getSessionManager:()=>Q$,getSessionData:()=>aQ,getResolverMetadata:()=>G9,getRBACManager:()=>fQ,getOAuthUser:()=>lQ,getOAuthToken:()=>mQ,getOAuthProvider:()=>nQ,getFieldsMetadata:()=>B9,getFieldMetadata:()=>w9,getDefaultValue:()=>H6,getCurrentUser:()=>W1,getCurrentSession:()=>E0,getCSRFProtection:()=>tQ,getAuthError:()=>xw,getArgumentsMetadata:()=>j$,createTestClient:()=>O6,createTestApp:()=>C6,createSessionMiddleware:()=>rQ,createRateLimitMiddleware:()=>Y$,createRBACMiddleware:()=>y8,createDefaultRBAC:()=>x8,createCorsMiddleware:()=>q$,createCompressionMiddleware:()=>G$,createAuthMiddleware:()=>v8,clearMocks:()=>r4,checkUserRole:()=>uw,checkUserPermission:()=>lw,ZodToJsonSchemaConverter:()=>p0,WebSocketPlugin:()=>y1,WebSocketManager:()=>g1,WebSocketConnection:()=>h1,WebSocket:()=>A9,VeloceTS:()=>z1,Veloce:()=>z1,ValidationException:()=>e0,ValidationEngine:()=>D1,UseMiddleware:()=>AX,UnauthorizedException:()=>z9,TokenRevokedException:()=>d4,TokenPayloadSchema:()=>Ow,TokenExpiredException:()=>Z$,Token:()=>fw,TestClient:()=>m1,SuperAdminOnly:()=>gw,Subscription:()=>X9,StreamResponse:()=>S6,SessionManager:()=>l8,SessionGuard:()=>m8,SessionDataSchema:()=>dQ,Session:()=>iQ,RouterCompiler:()=>I$,Roles:()=>kQ,RoleSchema:()=>Pw,RoleAssignmentSchema:()=>Zw,ResponseSerializer:()=>A6,Response:()=>n4,Resolver:()=>Q9,RequireRole:()=>g8,RequirePermission:()=>vw,RequireCSRF:()=>oQ,RefreshRequestSchema:()=>bw,RedirectResponse:()=>L6,RBACPlugin:()=>xQ,RBACManager:()=>$$,RBACGuard:()=>i$,Query:()=>W9,Put:()=>zX,Post:()=>FX,PluginManager:()=>K$,Permissions:()=>KQ,PermissionMatcher:()=>J$,PermissionCheckSchema:()=>Iw,Patch:()=>LX,Param:()=>o9,OpenAPIPlugin:()=>W6,OpenAPIGenerator:()=>B1,OnMessage:()=>R9,OnDisconnect:()=>C9,OnConnect:()=>E9,OAuthUserSchema:()=>hQ,OAuthUser:()=>yQ,OAuthToken:()=>uQ,OAuth:()=>gQ,NotFoundException:()=>F9,Mutation:()=>H9,MinimumRole:()=>yw,MetadataRegistry:()=>T,MetadataCompiler:()=>P$,LoginRequestSchema:()=>Mw,JWTProvider:()=>W4,JSONResponse:()=>z6,InvalidTokenException:()=>V1,InMemoryUserProvider:()=>IQ,HonoAdapter:()=>E6,Header:()=>r9,HTTPException:()=>N0,HTMLResponse:()=>N6,GraphQLSubscription:()=>X9,GraphQLSchemaBuilder:()=>S$,GraphQLQuery:()=>W9,GraphQLPlugin:()=>A$,GraphQLMutation:()=>H9,GraphQLCtx:()=>Y9,Get:()=>VX,GQLSubscription:()=>X9,GQLQuery:()=>W9,GQLMutation:()=>H9,GQLContext:()=>Y9,ForbiddenException:()=>N9,FileResponse:()=>j6,FastAPITS:()=>z1,ExpressAdapter:()=>R6,ErrorHandler:()=>k$,Depends:()=>SX,Delete:()=>NX,DIContainer:()=>b$,CurrentUser:()=>Kw,CurrentSession:()=>pQ,Ctx:()=>a9,Cookie:()=>t9,Controller:()=>_X,CSRFToken:()=>sQ,Body:()=>s9,BadRequestException:()=>X6,AuthorizationException:()=>B0,AuthenticationException:()=>Y0,AuthService:()=>d$,AuthPlugin:()=>vQ,Auth:()=>kw,Arg:()=>q9,ApiResponse:()=>RX,ApiDoc:()=>EX,All:()=>jX,AdminOnly:()=>hw});module.exports=M0(mw);var zj=X$(N$());function _X($="",J){return(Q)=>{let W=$.trim();if(W&&!W.startsWith("/"))W="/"+W;if(W.endsWith("/"))W=W.slice(0,-1);T.defineController(Q,{prefix:W,middleware:J?.middleware||[]})}}function d1($){return(J="")=>{return(Q,W)=>{let H=J.trim();if(H&&!H.startsWith("/"))H="/"+H;let X=Reflect.getMetadata("route:middleware",Q,W)||[];T.defineRoute(Q,W,{method:$,path:H,middleware:X,parameters:[],dependencies:[],responses:[]})}}}var VX=d1("GET"),FX=d1("POST"),zX=d1("PUT"),NX=d1("DELETE"),LX=d1("PATCH"),jX=d1("ALL");function s9($){return(J,Q,W)=>{if(!Q)return;let H={index:W,type:"body",schema:$,required:!0};T.defineParameter(J,Q,W,H)}}function o9($){return(J,Q,W)=>{if(!Q)return;let H={index:W,type:"param",name:$,required:!0};T.defineParameter(J,Q,W,H)}}function r9($){return(J,Q,W)=>{if(!Q)return;let H={index:W,type:"header",name:$,required:!1};T.defineParameter(J,Q,W,H)}}function t9($){return(J,Q,W)=>{if(!Q)return;let H={index:W,type:"cookie",name:$,required:!1};T.defineParameter(J,Q,W,H)}}function a9(){return($,J,Q)=>{if(!J)return;let W={index:Q,type:"context",required:!0};T.defineParameter($,J,Q,W)}}function SX($,J="request"){return(Q,W,H)=>{if(W===void 0)throw Error("@Depends decorator can only be used on method parameters, not constructor parameters");T.defineDependency(Q,W,H,{index:H,provider:$,scope:J})}}function AX(...$){return(J,Q)=>{let W=Reflect.getMetadata("route:middleware",J,Q)||[];Reflect.defineMetadata("route:middleware",[...W,...$],J,Q)}}function EX($){return(J,Q)=>{let W=T.getRouteMetadata(J,Q);T.defineRoute(J,Q,{...W,docs:{...W?.docs,...$}})}}function RX($){return(J,Q)=>{let W=T.getRouteMetadata(J,Q),H=W?.responses||[],X=H.findIndex((Y)=>Y.statusCode===$.statusCode),q;if(X>=0)q=[...H],q[X]=$;else q=[...H,$];T.defineRoute(J,Q,{...W,responses:q})}}l1();F1();var Q1=X$(ZQ());class W4{config;blacklistedTokens=new Set;constructor($){this.config=$;if(!$.secret)throw Error("JWT secret is required")}generateTokens($){let J=Math.floor(Date.now()/1000),Q=this.parseExpiration(this.config.expiresIn||"1h"),W={sub:$.sub,...$,iat:J,exp:J+Q,iss:this.config.issuer,aud:this.config.audience},H=Q1.sign(W,this.config.secret,{algorithm:this.config.algorithm||"HS256"}),X={sub:$.sub,type:"refresh",iat:J,exp:J+this.parseExpiration(this.config.refreshExpiresIn||"7d"),iss:this.config.issuer,aud:this.config.audience},q=Q1.sign(X,this.config.refreshSecret||this.config.secret,{algorithm:this.config.algorithm||"HS256"});return{accessToken:H,refreshToken:q,expiresIn:Q}}verifyAccessToken($){if(this.isBlacklisted($))throw Error("Token has been revoked");try{return Q1.verify($,this.config.secret,{algorithms:[this.config.algorithm||"HS256"],issuer:this.config.issuer,audience:this.config.audience})}catch(J){if(J instanceof Error)throw Error(`Invalid token: ${J.message}`);throw Error("Invalid token")}}verifyRefreshToken($){if(this.isBlacklisted($))throw Error("Refresh token has been revoked");try{let J=Q1.verify($,this.config.refreshSecret||this.config.secret,{algorithms:[this.config.algorithm||"HS256"],issuer:this.config.issuer,audience:this.config.audience});if(J.type!=="refresh")throw Error("Invalid refresh token type");return J}catch(J){if(J instanceof Error)throw Error(`Invalid refresh token: ${J.message}`);throw Error("Invalid refresh token")}}refreshAccessToken($){let J=this.verifyRefreshToken($);return this.blacklistToken($),this.generateTokens({sub:J.sub,...Object.fromEntries(Object.entries(J).filter(([Q])=>!["iat","exp","iss","aud","type"].includes(Q)))})}decodeToken($){try{return Q1.decode($)}catch{return null}}blacklistToken($){this.blacklistedTokens.add($)}isBlacklisted($){return this.blacklistedTokens.has($)}cleanupBlacklist(){let $=Math.floor(Date.now()/1000);for(let J of this.blacklistedTokens){let Q=this.decodeToken(J);if(Q&&Q.exp&&Q.exp<$)this.blacklistedTokens.delete(J)}}parseExpiration($){if(typeof $==="number")return $;let J={s:1,m:60,h:3600,d:86400,w:604800},Q=$.match(/^(\d+)([smhdw])$/);if(!Q)throw Error(`Invalid expiration format: ${$}`);let[,W,H]=Q;return parseInt(W)*J[H]}}var Ow=z.object({sub:z.string(),iat:z.number().optional(),exp:z.number().optional(),iss:z.string().optional(),aud:z.string().optional()}).passthrough(),Mw=z.object({username:z.string().min(1),password:z.string().min(1)}),bw=z.object({refreshToken:z.string().min(1)});F1();class d${config;userProvider;jwtProvider;constructor($,J){this.config=$;this.userProvider=J;this.jwtProvider=new W4($)}async login($,J){let Q=await this.userProvider.findByCredentials($,J);if(!Q)throw new Y0("Invalid credentials");let W=this.jwtProvider.generateTokens({sub:Q.id,username:Q.username,email:Q.email,roles:Q.roles||[],permissions:Q.permissions||[]});return{user:Q,tokens:W}}async refresh($){try{return this.jwtProvider.refreshAccessToken($)}catch(J){throw new V1(J instanceof Error?J.message:"Invalid refresh token")}}async logout($,J){if(this.jwtProvider.blacklistToken($),J)this.jwtProvider.blacklistToken(J)}async verifyToken($){try{let J=this.jwtProvider.verifyAccessToken($),Q=await this.userProvider.findById(J.sub);if(!Q)throw new Y0("User not found");return Q}catch(J){if(J instanceof Error){if(J.message.includes("expired"))throw new Z$;throw new V1(J.message)}throw new V1("Token verification failed")}}getUserFromToken($){return this.jwtProvider.verifyAccessToken($)}hasRoles($,J){let Q=$.roles||[];return J.every((W)=>Q.includes(W))}hasPermissions($,J){let Q=$.permissions||[];return J.every((W)=>Q.includes(W))}async register($){let J=await this.userProvider.hashPassword($.password),Q={id:crypto.randomUUID(),username:$.username,email:$.email,roles:$.roles||["user"]},W=this.jwtProvider.generateTokens({sub:Q.id,username:Q.username,email:Q.email,roles:Q.roles});return{user:Q,tokens:W}}cleanup(){this.jwtProvider.cleanupBlacklist()}getJWTProvider(){return this.jwtProvider}}class IQ{users=new Map;async findByCredentials($,J){for(let[Q,W]of this.users)if(W.username===$){if(await this.verifyPassword(J,W.passwordHash)){let{passwordHash:X,...q}=W;return q}}return null}async findById($){let J=this.users.get($);if(J){let{passwordHash:Q,...W}=J;return W}return null}async hashPassword($){return Buffer.from($).toString("base64")}async verifyPassword($,J){return await this.hashPassword($)===J}async createUser($){let J=crypto.randomUUID(),Q=await this.hashPassword($.password),W={id:J,username:$.username,email:$.email,roles:$.roles||["user"],passwordHash:Q};this.users.set(J,W);let{passwordHash:H,...X}=W;return X}}class $${roles=new Map;hierarchy=new Map;compiledPermissions=new Map;defineRole($){if(this.roles.set($.name,$),$.inherits&&$.inherits.length>0)this.hierarchy.set($.name,$.inherits);this.compiledPermissions.clear()}defineRoles($){for(let J of $)this.defineRole(J)}getRolePermissions($){if(this.compiledPermissions.has($))return Array.from(this.compiledPermissions.get($));let J=new Set;return this.collectPermissions($,J,new Set),this.compiledPermissions.set($,J),Array.from(J)}roleHasPermission($,J){return this.getRolePermissions($).includes(J)}userHasPermission($,J){for(let Q of $)if(this.roleHasPermission(Q,J))return!0;return!1}userHasRoles($,J){return J.every((Q)=>$.includes(Q))}userHasAnyRole($,J){return J.some((Q)=>$.includes(Q))}getRolesWithPermission($){let J=[];for(let Q of this.roles.keys())if(this.roleHasPermission(Q,$))J.push(Q);return J}getRoleHierarchy($){let J=[];return this.collectParentRoles($,J,new Set),J}roleInheritsFrom($,J){return this.getRoleHierarchy($).includes(J)}getAllRoles(){return Array.from(this.roles.values())}getRole($){return this.roles.get($)}roleExists($){return this.roles.has($)}validateRoles($){let J=[],Q=[];for(let W of $)if(this.roleExists(W))J.push(W);else Q.push(W);return{valid:J,invalid:Q}}getEffectiveRoles($){let J=new Set;for(let Q of $)J.add(Q),this.getRoleHierarchy(Q).forEach((H)=>J.add(H));return Array.from(J)}compareRoleLevels($,J){let Q=this.getRole($),W=this.getRole(J),H=Q?.level??0,X=W?.level??0;return H-X}getHighestRoleLevel($){let J=0;for(let Q of $){let W=this.getRole(Q);if(W&&W.level&&W.level>J)J=W.level}return J}collectPermissions($,J,Q){if(Q.has($))throw Error(`Circular role inheritance detected: ${$}`);Q.add($);let W=this.roles.get($);if(!W)throw Error(`Role not found: ${$}`);W.permissions.forEach((X)=>J.add(X));let H=this.hierarchy.get($)||[];for(let X of H)this.collectPermissions(X,J,new Set(Q))}collectParentRoles($,J,Q){if(Q.has($))return;Q.add($);let W=this.hierarchy.get($)||[];for(let H of W)J.push(H),this.collectParentRoles(H,J,Q)}}function x8(){let $=new $$;return $.defineRoles([{name:"guest",description:"Guest user with minimal permissions",permissions:["read:public"],level:1},{name:"user",description:"Regular authenticated user",permissions:["read:own","write:own","read:public"],inherits:["guest"],level:10},{name:"moderator",description:"Moderator with content management permissions",permissions:["read:all","write:all","moderate:content"],inherits:["user"],level:50},{name:"admin",description:"Administrator with full system access",permissions:["*"],inherits:["moderator"],level:100},{name:"super-admin",description:"Super administrator with unrestricted access",permissions:["*","system:*"],inherits:["admin"],level:1000}]),$}var Pw=z.object({name:z.string().min(1),description:z.string().optional(),permissions:z.array(z.string()),inherits:z.array(z.string()).optional(),level:z.number().optional()}),Zw=z.object({userId:z.string(),roles:z.array(z.string())}),Iw=z.object({userId:z.string(),permission:z.string()});class J${static matches($,J){if(J==="*")return!0;if(J.endsWith("*")){let Q=J.slice(0,-1);return $.startsWith(Q)}return $===J}static hasPermission($,J){return $.some((Q)=>this.matches(J,Q))}static filterByPattern($,J){return $.filter((Q)=>this.matches(Q,J))}}function kw($){return(J,Q)=>{let W={required:!$?.optional,config:$};T.defineAuth(J,Q,W)}}function Kw(){return($,J,Q)=>{if(J)T.defineParameter($,J,Q,{index:Q,type:"current-user",required:!1})}}function fw(){return($,J,Q)=>{if(J)T.defineParameter($,J,Q,{index:Q,type:"token",required:!1})}}function v8($){return async(J,Q)=>{let W=J.req.header("Authorization");if(!W||!W.startsWith("Bearer "))J.set("auth.error","Missing or invalid Authorization header"),J.set("auth.authenticated",!1);else{let H=W.substring(7);try{let X=$.verifyAccessToken(H);J.set("auth.user",X),J.set("auth.token",H),J.set("auth.authenticated",!0)}catch(X){J.set("auth.error",X instanceof Error?X.message:"Authentication failed"),J.set("auth.authenticated",!1)}}await Q()}}function W1($){return $.get("auth.user")||null}function h8($){return $.get("auth.token")||null}function Tw($){return $.get("auth.authenticated")===!0}function xw($){return $.get("auth.error")||null}F1();function kQ($){return(J,Q)=>{let H={config:Array.isArray($)?{roles:$,requireAll:!1,allowInherited:!0}:{requireAll:!1,allowInherited:!0,...$}};T.defineRoles(J,Q,H)}}function KQ($){return(J,Q)=>{let H={config:Array.isArray($)?{permissions:$,requireAll:!1}:{requireAll:!1,...$}};T.definePermissions(J,Q,H)}}function g8($){return kQ([$])}function vw($){return KQ([$])}function hw(){return g8("admin")}function gw(){return g8("super-admin")}function yw($){return(J,Q)=>{T.defineMinimumRole(J,Q,{roleName:$})}}function y8($){return async(J,Q)=>{J.set("rbac",$),await Q()}}class i${rbac;constructor($){this.rbac=$}checkRoles($,J){let Q=W1($);if(!Q)throw new B0("Authentication required for role check");let W=Q.roles||[],H=J.allowInherited?this.rbac.getEffectiveRoles(W):W,X;if(J.requireAll)X=J.roles.every((q)=>H.includes(q));else X=J.roles.some((q)=>H.includes(q));if(!X){let q=J.requireAll?"all":"any";throw new B0(`Access denied. Required ${q} of roles: ${J.roles.join(", ")}`)}}checkPermissions($,J){let Q=W1($);if(!Q)throw new B0("Authentication required for permission check");let W=Q.roles||[],H=new Set;for(let Y of W)this.rbac.getRolePermissions(Y).forEach((B)=>H.add(B));let X=Array.from(H),q;if(J.requireAll)q=J.permissions.every((Y)=>J$.hasPermission(X,Y));else q=J.permissions.some((Y)=>J$.hasPermission(X,Y));if(!q){let Y=J.requireAll?"all":"any";throw new B0(`Access denied. Required ${Y} of permissions: ${J.permissions.join(", ")}`)}}checkMinimumRole($,J){let Q=W1($);if(!Q)throw new B0("Authentication required for role level check");let W=Q.roles||[],H=this.rbac.getHighestRoleLevel(W),X=this.rbac.getRole(J);if(!X)throw Error(`Required role not found: ${J}`);let q=X.level||0;if(H<q)throw new B0(`Access denied. Minimum role level required: ${J} (level ${q})`)}}function fQ($){return $.get("rbac")||null}function u8($){return W1($)?.roles||[]}function TQ($){let J=fQ($),Q=u8($);if(!J)return[];let W=new Set;for(let H of Q)J.getRolePermissions(H).forEach((q)=>W.add(q));return Array.from(W)}function uw($,J){return u8($).includes(J)}function lw($,J){let Q=TQ($);return J$.hasPermission(Q,J)}class xQ{config;name="rbac";version="1.0.0";dependencies=["auth"];rbac;guard;constructor($={}){this.config=$;if($.rbac)this.rbac=$.rbac;else if($.useDefaults!==!1)this.rbac=x8();else this.rbac=new $$;if($.roles)this.rbac.defineRoles($.roles);this.guard=new i$(this.rbac)}async install($){let J=y8(this.rbac);if($.use(J),$.getContainer().register($$,{factory:()=>this.rbac,scope:"singleton"}),$.getContainer().register(i$,{factory:()=>this.guard,scope:"singleton"}),this.extendRouterCompiler($),this.config.enableManagementRoutes!==!1)this.addManagementRoutes($)}extendRouterCompiler($){let J=$.compile.bind($);$.compile=async()=>{await J();let Q=$.getMetadata().getRoutes();for(let W of Q)if(W.roles||W.permissions||W.minimumRole)this.addRBACGuards($,W)}}addRBACGuards($,J){}addManagementRoutes($){let J=this.config.routes||{};$.get(J.roles||"/rbac/roles",{handler:(Q)=>{let W=this.rbac.getAllRoles();return Q.json({success:!0,roles:W.map((H)=>({name:H.name,description:H.description,permissions:H.permissions,inherits:H.inherits,level:H.level}))})}}),$.get("/rbac/roles/:roleName",{handler:(Q)=>{let W=Q.req.param("roleName"),H=this.rbac.getRole(W);if(!H)return Q.json({error:"Role not found"},404);let X=this.rbac.getRolePermissions(W),q=this.rbac.getRoleHierarchy(W);return Q.json({success:!0,role:{...H,effectivePermissions:X,hierarchy:q}})}}),$.get("/rbac/roles/:roleName/permissions",{handler:(Q)=>{let W=Q.req.param("roleName");if(!this.rbac.roleExists(W))return Q.json({error:"Role not found"},404);let H=this.rbac.getRolePermissions(W);return Q.json({success:!0,role:W,permissions:H})}}),$.post("/rbac/check-permission",{handler:async(Q)=>{let W=await Q.req.json(),{roles:H,permission:X}=W;if(!Array.isArray(H)||!X)return Q.json({error:"Invalid request body"},400);let q=this.rbac.userHasPermission(H,X);return Q.json({success:!0,hasPermission:q,roles:H,permission:X})}}),$.post("/rbac/check-roles",{handler:async(Q)=>{let W=await Q.req.json(),{userRoles:H,requiredRoles:X,requireAll:q=!1}=W;if(!Array.isArray(H)||!Array.isArray(X))return Q.json({error:"Invalid request body"},400);let Y=q?this.rbac.userHasRoles(H,X):this.rbac.userHasAnyRole(H,X);return Q.json({success:!0,hasRoles:Y,userRoles:H,requiredRoles:X,requireAll:q})}}),$.post("/rbac/effective-roles",{handler:async(Q)=>{let W=await Q.req.json(),{roles:H}=W;if(!Array.isArray(H))return Q.json({error:"Invalid request body"},400);let X=this.rbac.getEffectiveRoles(H);return Q.json({success:!0,inputRoles:H,effectiveRoles:X})}}),$.post("/rbac/user-permissions",{handler:async(Q)=>{let W=await Q.req.json(),{roles:H}=W;if(!Array.isArray(H))return Q.json({error:"Invalid request body"},400);let X=new Set;for(let q of H)if(this.rbac.roleExists(q))this.rbac.getRolePermissions(q).forEach((G)=>X.add(G));return Q.json({success:!0,roles:H,permissions:Array.from(X)})}})}getRBACManager(){return this.rbac}getGuard(){return this.guard}}F1();class vQ{config;name="auth";version="1.0.0";authService;constructor($){this.config=$;this.authService=new d$($.jwt,$.userProvider)}async install($){let J=v8(this.authService.getJWTProvider());if($.use(J),$.getContainer().register(d$,{factory:()=>this.authService,scope:"singleton"}),this.config.enableDefaultRoutes!==!1)this.addDefaultRoutes($);this.extendRouterCompiler($)}extendRouterCompiler($){$.use(async(Q,W)=>{Q.set("authService",this.authService),await W()});let J=$.compile.bind($);$.compile=async()=>{await J();let Q=$.getHono(),W=$.getMetadata().getRoutes();for(let H of W){let X=T.getAuthMetadata(H.target.prototype,H.propertyKey);if(H.auth?.required||X?.required){console.log("Adding auth middleware for route:",H.path,H.method);let Y=H.auth?.config||X?.config;Q.use(H.path,async(G,B)=>{if(console.log("Auth middleware executing for:",G.req.path,G.req.method,"target:",H.path,H.method),G.req.method!==H.method)return console.log("Method mismatch, skipping auth check"),B();console.log("Checking authentication...");let w=G.get("auth.user"),_=G.get("auth.error");if(!w){let R=_||"Authentication required";throw console.log("No user found, throwing auth exception"),new Y0(R)}if(Y?.roles?.length){if(!this.authService.hasRoles(w,Y.roles))throw new B0(`Required roles: ${Y.roles.join(", ")}`)}if(Y?.permissions?.length){if(!this.authService.hasPermissions(w,Y.permissions))throw new B0(`Required permissions: ${Y.permissions.join(", ")}`)}await B()})}}}}buildPath($){return $.path}pathMatches($,J){let Q=$.replace(/:([^/]+)/g,"([^/]+)");return new RegExp(`^${Q}$`).test(J)}addDefaultRoutes($){let J=this.config.routes||{};if($.post(J.login||"/auth/login",{handler:async(Q)=>{let W=await Q.req.json(),{username:H,password:X}=W;try{let q=await this.authService.login(H,X);return{success:!0,user:q.user,tokens:q.tokens}}catch(q){throw new Y0(q instanceof Error?q.message:"Login failed")}},schema:{body:z.object({username:z.string().min(1),password:z.string().min(1)})}}),$.post(J.refresh||"/auth/refresh",{handler:async(Q)=>{let W=await Q.req.json(),{refreshToken:H}=W;try{return{success:!0,tokens:await this.authService.refresh(H)}}catch(X){throw new Y0(X instanceof Error?X.message:"Token refresh failed")}},schema:{body:z.object({refreshToken:z.string().min(1)})}}),$.post(J.logout||"/auth/logout",{handler:async(Q)=>{let W=h8(Q),H=await Q.req.json(),{refreshToken:X}=H;if(W)await this.authService.logout(W,X);return{success:!0,message:"Logged out successfully"}},schema:{body:z.object({refreshToken:z.string().optional()})}}),"createUser"in this.config.userProvider)$.post(J.register||"/auth/register",{handler:async(Q)=>{let W=await Q.req.json(),{username:H,password:X,email:q}=W;try{let Y=await this.authService.register({username:H,password:X,email:q});return{success:!0,user:Y.user,tokens:Y.tokens}}catch(Y){throw new Y0(Y instanceof Error?Y.message:"Registration failed")}},schema:{body:z.object({username:z.string().min(1),password:z.string().min(6),email:z.string().email().optional()})}});$.get("/auth/me",{handler:async(Q)=>{let W=W1(Q);if(!W)throw new Y0("Not authenticated");return{success:!0,user:W}}})}getAuthService(){return this.authService}}var Qj=z.object({code:z.string(),state:z.string(),error:z.string().optional(),error_description:z.string().optional()}),Wj=z.object({accessToken:z.string(),refreshToken:z.string().optional(),expiresIn:z.number().optional(),tokenType:z.string(),scope:z.string().optional()}),hQ=z.object({id:z.string(),email:z.string().optional(),name:z.string().optional(),username:z.string().optional(),avatar:z.string().optional(),provider:z.string()}).passthrough();function gQ($){return(J,Q)=>{let W={provider:$.provider,config:$};T.defineOAuth(J,Q,W)}}function yQ(){return($,J,Q)=>{if(J)T.defineParameter($,J,Q,{index:Q,type:"oauth-user",required:!0})}}function uQ(){return($,J,Q)=>{if(J)T.defineParameter($,J,Q,{index:Q,type:"oauth-token",required:!0})}}function lQ($){return $.get("oauth.user")||null}function mQ($){return $.get("oauth.token")||null}function cQ($){return $.get("oauth.authenticated")===!0}function nQ($){return $.get("oauth.provider")||null}class l8{store;config;constructor($,J){this.store=$;this.config={name:"sessionId",maxAge:86400000,secure:!1,httpOnly:!0,sameSite:"lax",path:"/",rolling:!1,genid:()=>crypto.randomUUID(),...J,domain:J.domain}}async createSession($,J={},Q){let W=this.config.genid(),H=new Date,X=Q?.maxAge||this.config.maxAge,q={id:W,userId:$,data:J,createdAt:H,updatedAt:H,expiresAt:new Date(H.getTime()+X),ipAddress:Q?.ipAddress,userAgent:Q?.userAgent,csrfToken:this.generateCSRFToken()};return await this.store.set(W,q),q}async getSession($){return await this.store.get($)}async updateSession($,J){let Q=await this.store.get($);if(!Q)return null;if(Q.data={...Q.data,...J},Q.updatedAt=new Date,this.config.rolling)Q.expiresAt=new Date(Date.now()+this.config.maxAge);return await this.store.set($,Q),Q}async touchSession($){if(this.config.rolling){let J=await this.store.get($);if(J)J.updatedAt=new Date,J.expiresAt=new Date(Date.now()+this.config.maxAge),await this.store.set($,J)}else await this.store.touch($)}async destroySession($){await this.store.destroy($)}async regenerateSession($){let J=await this.store.get($);if(!J)return null;let Q=this.config.genid(),W={...J,id:Q,updatedAt:new Date,csrfToken:this.generateCSRFToken()};return await this.store.set(Q,W),await this.store.destroy($),W}async getUserSessions($){return(await this.store.all()).filter((Q)=>Q.userId===$)}async destroyUserSessions($){let J=await this.getUserSessions($);for(let Q of J)await this.store.destroy(Q.id)}validateCSRFToken($,J){return $.csrfToken===J}generateCSRFToken(){return crypto.randomUUID()}getCookieOptions(){let $={maxAge:this.config.maxAge,secure:this.config.secure,httpOnly:this.config.httpOnly,sameSite:this.config.sameSite,path:this.config.path};if(this.config.domain)$.domain=this.config.domain;return $}getConfig(){return{...this.config}}getStore(){return this.store}}var dQ=z.object({id:z.string(),userId:z.string(),data:z.record(z.any()),createdAt:z.date(),updatedAt:z.date(),expiresAt:z.date().optional(),ipAddress:z.string().optional(),userAgent:z.string().optional(),csrfToken:z.string().optional()}),Gj=z.object({name:z.string().optional(),secret:z.string(),maxAge:z.number().optional(),secure:z.boolean().optional(),httpOnly:z.boolean().optional(),sameSite:z.enum(["strict","lax","none"]).optional(),domain:z.string().optional(),path:z.string().optional(),rolling:z.boolean().optional()}),Bj=z.object({userId:z.string(),data:z.record(z.any()).optional(),maxAge:z.number().optional(),ipAddress:z.string().optional(),userAgent:z.string().optional()}),wj=z.object({data:z.record(z.any())});F1();function iQ($={}){return(J,Q)=>{let W={config:$};T.defineSession(J,Q,W)}}function pQ(){return($,J,Q)=>{if(J)T.defineParameter($,J,Q,{index:Q,type:"current-session",required:!0})}}function sQ(){return($,J,Q)=>{if(J)T.defineParameter($,J,Q,{index:Q,type:"csrf-token",required:!0})}}function oQ(){return($,J)=>{T.defineCSRF($,J,{required:!0})}}function rQ($,J){return async(Q,W)=>{let H=$.getConfig(),X=V6(Q,H.name),q=null;if(X){if(q=await $.getSession(X),q)await $.touchSession(X)}Q.set("session",q),Q.set("sessionManager",$),Q.set("csrfProtection",J),await W()}}class m8{sessionManager;csrfProtection;constructor($,J){this.sessionManager=$;this.csrfProtection=J}checkSession($,J){let Q=E0($);if(J.required&&!Q)throw new Y0("Session required");if(Q&&J.csrf)this.checkCSRF($,Q)}checkCSRF($,J){if(!this.csrfProtection)throw Error("CSRF protection not configured");let Q=$.req.header("X-CSRF-Token")||$.req.query("_csrf");if(!Q)throw new B0("CSRF token required");if(!this.csrfProtection.validateToken(J.id,Q))throw new B0("Invalid CSRF token")}async createSession($,J,Q={}){let W=Q$($);if(!W)throw Error("Session manager not available");let H=$.req.header("X-Forwarded-For")||$.req.header("X-Real-IP")||"unknown",X=$.req.header("User-Agent")||"unknown",q=await W.createSession(J,Q,{ipAddress:H,userAgent:X}),Y=W.getCookieOptions();return F6($,W.getConfig().name,q.id,Y),$.set("session",q),q}async updateSession($,J){let Q=E0($),W=Q$($);if(!Q||!W)return null;let H=await W.updateSession(Q.id,J);if(H)$.set("session",H);return H}async destroySession($){let J=E0($),Q=Q$($);if(!J||!Q)return;await Q.destroySession(J.id);let W=Q.getConfig();if(F6($,W.name,"",{...Q.getCookieOptions(),maxAge:0}),$.set("session",null),this.csrfProtection)this.csrfProtection.removeToken(J.id)}async regenerateSession($){let J=E0($),Q=Q$($);if(!J||!Q)return null;let W=await Q.regenerateSession(J.id);if(W){let H=Q.getCookieOptions();if(F6($,Q.getConfig().name,W.id,H),$.set("session",W),this.csrfProtection)this.csrfProtection.removeToken(J.id),this.csrfProtection.generateToken(W.id)}return W}generateCSRFToken($){let J=E0($);if(!J||!this.csrfProtection)return null;return this.csrfProtection.generateToken(J.id)}}function E0($){return $.get("session")||null}function Q$($){return $.get("sessionManager")||null}function tQ($){return $.get("csrfProtection")||null}function aQ($,J){let Q=E0($);if(!Q)return null;if(J)return Q.data[J];return Q.data}function eQ($){return E0($)!==null}function $W($){return E0($)?.userId||null}function JW($,J,Q){let W=E0($);if(W)W.data[J]=Q,$.set("session",W)}function QW($,J){let Q=E0($);if(Q&&J in Q.data)delete Q.data[J],$.set("session",Q)}
125
125
 
126
- //# debugId=74368B2CC32C861864756E2164756E21
126
+ //# debugId=6B245ED85E35109664756E2164756E21