@interactive-inc/claude-funnel 0.68.0 → 0.68.1

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,9 +1,9 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var tw=Object.create;var{getPrototypeOf:Ew,defineProperty:Ar,getOwnPropertyNames:cw}=Object;var Cw=Object.prototype.hasOwnProperty;function Rw(i){return this[i]}var Fw,ow,xX=(i,$,n)=>{var g=i!=null&&typeof i==="object";if(g){var v=$?Fw??=new WeakMap:ow??=new WeakMap,r=v.get(i);if(r)return r}n=i!=null?tw(Ew(i)):{};let b=$||!i||!i.__esModule?Ar(n,"default",{value:i,enumerable:!0}):n;for(let u of cw(i))if(!Cw.call(b,u))Ar(b,u,{get:Rw.bind(i,u),enumerable:!0});if(g)v.set(i,b);return b};var NX=(i,$)=>()=>($||i(($={exports:{}}).exports,$),$.exports);var mw=(i)=>i;function yw(i,$){this[i]=mw.bind(null,$)}var Gi=(i,$)=>{for(var n in $)Ar(i,n,{get:$[n],enumerable:!0,configurable:!0,set:yw.bind($,n)})};var tX=import.meta.require;import{mkdirSync as Lw,readFileSync as SX,unlinkSync as Tw,writeFileSync as AX}from"fs";import{join as lX}from"path";class $${}var Yi=(i)=>{if(i.literal!==void 0&&i.literal!=="")return i.literal;if(i.envVar!==void 0&&i.envVar!==""){let $=i.env[i.envVar];if($!==void 0&&$!=="")return $;throw Error(`${i.label} references env var "${i.envVar}" but it is not set in the environment`)}throw Error(`${i.label} has neither a literal token nor an env var reference`)};class Uv{}class Di extends Uv{constructor(){super();Object.freeze(this)}async fetch(i){let $=await globalThis.fetch(i.url,{method:i.method,headers:i.headers,body:i.body});return{status:$.status,ok:$.ok,text:()=>$.text(),json:()=>$.json()}}}var hw="https://discord.com/api/v10",dw=new Di;class lr extends $${token;http;constructor(i){super();this.token=Yi({literal:i.config.botToken,envVar:i.config.botTokenEnv,env:i.env??process.env,label:`${i.config.name}.botToken`}),this.http=i.http??dw,Object.freeze(this)}async call(i){let $=(i.method||"GET").toUpperCase(),n=i.path.startsWith("/")?i.path:`/${i.path}`,g=i.body,v=g!==null&&typeof g==="object"&&$!=="GET"&&Object.keys(g).length>0,r=await this.http.fetch({method:$,url:`${hw}${n}`,headers:{Authorization:`Bot ${this.token}`,"Content-Type":"application/json"},body:v?JSON.stringify(i.body):void 0});if(!r.ok)throw Error(`Discord API failed (${r.status}): ${await r.text()}`);if(r.status===204)return null;return await r.json()}}var D={};Gi(D,{xor:()=>E0,xid:()=>I0,void:()=>Z0,uuidv7:()=>$0,uuidv6:()=>i0,uuidv4:()=>s1,uuid:()=>e1,util:()=>X,url:()=>v0,uppercase:()=>l$,unknown:()=>_$,union:()=>dg,undefined:()=>L0,ulid:()=>U0,uint64:()=>l0,uint32:()=>z0,tuple:()=>eU,trim:()=>M$,treeifyError:()=>Rr,transform:()=>pg,toUpperCase:()=>N$,toLowerCase:()=>x$,toJSONSchema:()=>Qg,templateLiteral:()=>iD,symbol:()=>B0,superRefine:()=>HI,success:()=>a0,stringbool:()=>UD,stringFormat:()=>X0,string:()=>Lv,strictObject:()=>N0,startsWith:()=>L$,slugify:()=>t$,size:()=>u$,setErrorMap:()=>AO,set:()=>o0,safeParseAsync:()=>HU,safeParse:()=>YU,safeEncodeAsync:()=>TU,safeEncode:()=>BU,safeDecodeAsync:()=>ZU,safeDecode:()=>LU,registry:()=>yn,regexes:()=>ri,regex:()=>S$,refine:()=>YI,record:()=>sU,readonly:()=>VI,property:()=>Wg,promise:()=>$D,prettifyError:()=>Fr,preprocess:()=>_D,prefault:()=>DI,positive:()=>jg,pipe:()=>Ag,partialRecord:()=>C0,parseAsync:()=>GU,parse:()=>KU,overwrite:()=>ki,optional:()=>Zv,object:()=>x0,number:()=>MU,nullish:()=>d0,nullable:()=>qv,null:()=>cU,normalize:()=>q$,nonpositive:()=>Jg,nonoptional:()=>kI,nonnegative:()=>Pg,never:()=>hg,negative:()=>Og,nativeEnum:()=>m0,nanoid:()=>r0,nan:()=>p0,multipleOf:()=>oi,minSize:()=>Wi,minLength:()=>zi,mime:()=>Z$,meta:()=>bD,maxSize:()=>mi,maxLength:()=>U$,map:()=>F0,mac:()=>k0,lte:()=>bi,lt:()=>Ji,lowercase:()=>A$,looseRecord:()=>R0,looseObject:()=>t0,locales:()=>Sv,literal:()=>y0,length:()=>I$,lazy:()=>QI,ksuid:()=>_0,keyof:()=>M0,jwt:()=>V0,json:()=>ID,iso:()=>C$,ipv6:()=>w0,ipv4:()=>D0,invertCodec:()=>s0,intersection:()=>aU,int64:()=>A0,int32:()=>H0,int:()=>Sg,instanceof:()=>uD,includes:()=>B$,httpUrl:()=>n0,hostname:()=>f0,hex:()=>Q0,hash:()=>K0,guid:()=>p1,gte:()=>e,gt:()=>Pi,globalRegistry:()=>m,getErrorMap:()=>lO,function:()=>vD,fromJSONSchema:()=>kD,formatError:()=>Pv,float64:()=>Y0,float32:()=>G0,flattenError:()=>Jv,file:()=>h0,exactOptional:()=>bI,enum:()=>ag,endsWith:()=>T$,encodeAsync:()=>AU,encode:()=>zU,emoji:()=>g0,email:()=>a1,e164:()=>W0,discriminatedUnion:()=>c0,describe:()=>rD,decodeAsync:()=>lU,decode:()=>SU,date:()=>q0,custom:()=>gD,cuid2:()=>u0,cuid:()=>b0,core:()=>Si,config:()=>E,coerce:()=>SI,codec:()=>e0,clone:()=>a,cidrv6:()=>O0,cidrv4:()=>j0,check:()=>nD,catch:()=>OI,boolean:()=>xU,bigint:()=>S0,base64url:()=>P0,base64:()=>J0,array:()=>tv,any:()=>T0,_function:()=>vD,_default:()=>II,_ZodString:()=>lg,ZodXor:()=>yU,ZodXID:()=>xg,ZodVoid:()=>oU,ZodUnknown:()=>RU,ZodUnion:()=>cv,ZodUndefined:()=>tU,ZodUUID:()=>Vi,ZodURL:()=>xv,ZodULID:()=>Mg,ZodType:()=>H,ZodTuple:()=>pU,ZodTransform:()=>gI,ZodTemplateLiteral:()=>XI,ZodSymbol:()=>NU,ZodSuccess:()=>wI,ZodStringFormat:()=>q,ZodString:()=>o$,ZodSet:()=>$I,ZodRecord:()=>R$,ZodRealError:()=>ni,ZodReadonly:()=>WI,ZodPromise:()=>KI,ZodPreprocess:()=>PI,ZodPrefault:()=>_I,ZodPipe:()=>Cv,ZodOptional:()=>eg,ZodObject:()=>Ev,ZodNumberFormat:()=>D$,ZodNumber:()=>y$,ZodNullable:()=>uI,ZodNull:()=>EU,ZodNonOptional:()=>sg,ZodNever:()=>FU,ZodNanoID:()=>Tg,ZodNaN:()=>JI,ZodMap:()=>iI,ZodMAC:()=>qU,ZodLiteral:()=>vI,ZodLazy:()=>fI,ZodKSUID:()=>Ng,ZodJWT:()=>mg,ZodIssueCode:()=>SO,ZodIntersection:()=>dU,ZodISOTime:()=>Hg,ZodISODuration:()=>zg,ZodISODateTime:()=>Gg,ZodISODate:()=>Yg,ZodIPv6:()=>Eg,ZodIPv4:()=>tg,ZodGUID:()=>Tv,ZodFunction:()=>GI,ZodFirstPartyTypeKind:()=>zI,ZodFile:()=>nI,ZodExactOptional:()=>rI,ZodError:()=>HO,ZodEnum:()=>F$,ZodEmoji:()=>Lg,ZodEmail:()=>Bg,ZodE164:()=>og,ZodDiscriminatedUnion:()=>hU,ZodDefault:()=>UI,ZodDate:()=>Nv,ZodCustomStringFormat:()=>m$,ZodCustom:()=>Fv,ZodCodec:()=>Rv,ZodCatch:()=>jI,ZodCUID2:()=>qg,ZodCUID:()=>Zg,ZodCIDRv6:()=>Cg,ZodCIDRv4:()=>cg,ZodBoolean:()=>h$,ZodBigIntFormat:()=>yg,ZodBigInt:()=>d$,ZodBase64URL:()=>Fg,ZodBase64:()=>Rg,ZodArray:()=>mU,ZodAny:()=>CU,TimePrecision:()=>e6,NEVER:()=>Br,$output:()=>m6,$input:()=>y6,$brand:()=>Lr});var Si={};Gi(Si,{version:()=>Eb,util:()=>X,treeifyError:()=>Rr,toJSONSchema:()=>Qg,toDotPath:()=>O1,safeParseAsync:()=>mr,safeParse:()=>or,safeEncodeAsync:()=>S2,safeEncode:()=>H2,safeDecodeAsync:()=>A2,safeDecode:()=>z2,registry:()=>yn,regexes:()=>ri,process:()=>B,prettifyError:()=>Fr,parseAsync:()=>Yn,parse:()=>Gn,meta:()=>Lu,locales:()=>Sv,isValidJWT:()=>x1,isValidBase64URL:()=>M1,isValidBase64:()=>U4,initializeContext:()=>yi,globalRegistry:()=>m,globalConfig:()=>v$,formatError:()=>Pv,flattenError:()=>Jv,finalize:()=>di,extractDefs:()=>hi,encodeAsync:()=>G2,encode:()=>Q2,describe:()=>Bu,decodeAsync:()=>Y2,decode:()=>K2,createToJSONSchemaMethod:()=>Zu,createStandardJSONSchemaMethod:()=>c$,config:()=>E,clone:()=>a,_xor:()=>vO,_xid:()=>gg,_void:()=>Qu,_uuidv7:()=>en,_uuidv6:()=>pn,_uuidv4:()=>an,_uuid:()=>dn,_url:()=>lv,_uppercase:()=>l$,_unknown:()=>Xu,_union:()=>$O,_undefined:()=>Pu,_ulid:()=>ng,_uint64:()=>Ou,_uint32:()=>Iu,_tuple:()=>rO,_trim:()=>M$,_transform:()=>kO,_toUpperCase:()=>N$,_toLowerCase:()=>x$,_templateLiteral:()=>fO,_symbol:()=>Ju,_superRefine:()=>lu,_success:()=>PO,_stringbool:()=>Tu,_stringFormat:()=>E$,_string:()=>d6,_startsWith:()=>L$,_slugify:()=>t$,_size:()=>u$,_set:()=>UO,_safeParseAsync:()=>Y$,_safeParse:()=>G$,_safeEncodeAsync:()=>Ln,_safeEncode:()=>ln,_safeDecodeAsync:()=>Tn,_safeDecode:()=>Bn,_regex:()=>S$,_refine:()=>Au,_record:()=>bO,_readonly:()=>XO,_property:()=>Wg,_promise:()=>KO,_positive:()=>jg,_pipe:()=>VO,_parseAsync:()=>K$,_parse:()=>Q$,_overwrite:()=>ki,_optional:()=>wO,_number:()=>nu,_nullable:()=>jO,_null:()=>Wu,_normalize:()=>q$,_nonpositive:()=>Jg,_nonoptional:()=>JO,_nonnegative:()=>Pg,_never:()=>fu,_negative:()=>Og,_nativeEnum:()=>_O,_nanoid:()=>ig,_nan:()=>Yu,_multipleOf:()=>oi,_minSize:()=>Wi,_minLength:()=>zi,_min:()=>e,_mime:()=>Z$,_maxSize:()=>mi,_maxLength:()=>U$,_max:()=>bi,_map:()=>uO,_mac:()=>p6,_lte:()=>bi,_lt:()=>Ji,_lowercase:()=>A$,_literal:()=>DO,_length:()=>I$,_lazy:()=>QO,_ksuid:()=>rg,_jwt:()=>wg,_isoTime:()=>$u,_isoDuration:()=>vu,_isoDateTime:()=>s6,_isoDate:()=>iu,_ipv6:()=>ug,_ipv4:()=>bg,_intersection:()=>gO,_int64:()=>ju,_int32:()=>Uu,_int:()=>ru,_includes:()=>B$,_guid:()=>Av,_gte:()=>e,_gt:()=>Pi,_float64:()=>uu,_float32:()=>bu,_file:()=>zu,_enum:()=>IO,_endsWith:()=>T$,_encodeAsync:()=>Sn,_encode:()=>Hn,_emoji:()=>sn,_email:()=>hn,_e164:()=>kg,_discriminatedUnion:()=>nO,_default:()=>OO,_decodeAsync:()=>An,_decode:()=>zn,_date:()=>Ku,_custom:()=>Su,_cuid2:()=>vg,_cuid:()=>$g,_coercedString:()=>a6,_coercedNumber:()=>gu,_coercedDate:()=>Gu,_coercedBoolean:()=>Du,_coercedBigint:()=>wu,_cidrv6:()=>Ig,_cidrv4:()=>Ug,_check:()=>m1,_catch:()=>WO,_boolean:()=>_u,_bigint:()=>ku,_base64url:()=>Dg,_base64:()=>_g,_array:()=>Hu,_any:()=>Vu,TimePrecision:()=>e6,NEVER:()=>Br,JSONSchemaGenerator:()=>WU,JSONSchema:()=>y1,Doc:()=>xn,$output:()=>m6,$input:()=>y6,$constructor:()=>w,$brand:()=>Lr,$ZodXor:()=>H4,$ZodXID:()=>pb,$ZodVoid:()=>Q4,$ZodUnknown:()=>X4,$ZodUnion:()=>Qv,$ZodUndefined:()=>P4,$ZodUUID:()=>Rb,$ZodURL:()=>ob,$ZodULID:()=>ab,$ZodType:()=>Y,$ZodTuple:()=>Fn,$ZodTransform:()=>q4,$ZodTemplateLiteral:()=>m4,$ZodSymbol:()=>J4,$ZodSuccess:()=>c4,$ZodStringFormat:()=>Z,$ZodString:()=>b$,$ZodSet:()=>B4,$ZodRegistry:()=>h6,$ZodRecord:()=>A4,$ZodRealError:()=>vi,$ZodReadonly:()=>o4,$ZodPromise:()=>h4,$ZodPreprocess:()=>F4,$ZodPrefault:()=>t4,$ZodPipe:()=>mn,$ZodOptional:()=>on,$ZodObjectJIT:()=>Y4,$ZodObject:()=>E1,$ZodNumberFormat:()=>j4,$ZodNumber:()=>Cn,$ZodNullable:()=>x4,$ZodNull:()=>W4,$ZodNonOptional:()=>E4,$ZodNever:()=>f4,$ZodNanoID:()=>yb,$ZodNaN:()=>R4,$ZodMap:()=>l4,$ZodMAC:()=>r4,$ZodLiteral:()=>T4,$ZodLazy:()=>d4,$ZodKSUID:()=>eb,$ZodJWT:()=>k4,$ZodIntersection:()=>S4,$ZodISOTime:()=>$4,$ZodISODuration:()=>v4,$ZodISODateTime:()=>sb,$ZodISODate:()=>i4,$ZodIPv6:()=>g4,$ZodIPv4:()=>n4,$ZodGUID:()=>Cb,$ZodFunction:()=>y4,$ZodFile:()=>Z4,$ZodExactOptional:()=>M4,$ZodError:()=>Ov,$ZodEnum:()=>L4,$ZodEncodeError:()=>n$,$ZodEmoji:()=>mb,$ZodEmail:()=>Fb,$ZodE164:()=>D4,$ZodDiscriminatedUnion:()=>z4,$ZodDefault:()=>N4,$ZodDate:()=>K4,$ZodCustomStringFormat:()=>w4,$ZodCustom:()=>a4,$ZodCodec:()=>Kv,$ZodCheckUpperCase:()=>Tb,$ZodCheckStringFormat:()=>H$,$ZodCheckStartsWith:()=>qb,$ZodCheckSizeEquals:()=>zb,$ZodCheckRegex:()=>Bb,$ZodCheckProperty:()=>xb,$ZodCheckOverwrite:()=>tb,$ZodCheckNumberFormat:()=>Kb,$ZodCheckMultipleOf:()=>Qb,$ZodCheckMinSize:()=>Hb,$ZodCheckMinLength:()=>Ab,$ZodCheckMimeType:()=>Nb,$ZodCheckMaxSize:()=>Yb,$ZodCheckMaxLength:()=>Sb,$ZodCheckLowerCase:()=>Lb,$ZodCheckLessThan:()=>qn,$ZodCheckLengthEquals:()=>lb,$ZodCheckIncludes:()=>Zb,$ZodCheckGreaterThan:()=>Mn,$ZodCheckEndsWith:()=>Mb,$ZodCheckBigIntFormat:()=>Gb,$ZodCheck:()=>M,$ZodCatch:()=>C4,$ZodCUID2:()=>db,$ZodCUID:()=>hb,$ZodCIDRv6:()=>u4,$ZodCIDRv4:()=>b4,$ZodBoolean:()=>fv,$ZodBigIntFormat:()=>O4,$ZodBigInt:()=>Rn,$ZodBase64URL:()=>_4,$ZodBase64:()=>I4,$ZodAsyncError:()=>Oi,$ZodArray:()=>G4,$ZodAny:()=>V4});var I1,Br=Object.freeze({status:"aborted"});function w(i,$,n){function g(u,I){if(!u._zod)Object.defineProperty(u,"_zod",{value:{def:I,constr:b,traits:new Set},enumerable:!1});if(u._zod.traits.has(i))return;u._zod.traits.add(i),$(u,I);let U=b.prototype,_=Object.keys(U);for(let k=0;k<_.length;k++){let O=_[k];if(!(O in u))u[O]=U[O].bind(u)}}let v=n?.Parent??Object;class r extends v{}Object.defineProperty(r,"name",{value:i});function b(u){var I;let U=n?.Parent?new r:this;g(U,u),(I=U._zod).deferred??(I.deferred=[]);for(let _ of U._zod.deferred)_();return U}return Object.defineProperty(b,"init",{value:g}),Object.defineProperty(b,Symbol.hasInstance,{value:(u)=>{if(n?.Parent&&u instanceof n.Parent)return!0;return u?._zod?.traits?.has(i)}}),Object.defineProperty(b,"name",{value:i}),b}var Lr=Symbol("zod_brand");class Oi extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class n$ extends Error{constructor(i){super(`Encountered unidirectional transform during encode: ${i}`);this.name="ZodEncodeError"}}(I1=globalThis).__zod_globalConfig??(I1.__zod_globalConfig={});var v$=globalThis.__zod_globalConfig;function E(i){if(i)Object.assign(v$,i);return v$}var X={};Gi(X,{unwrapMessage:()=>Iv,uint8ArrayToHex:()=>X2,uint8ArrayToBase64url:()=>W2,uint8ArrayToBase64:()=>k1,stringifyPrimitive:()=>W,slugify:()=>qr,shallowClone:()=>xr,safeExtend:()=>k2,required:()=>O2,randomString:()=>r2,propertyKeyTypes:()=>kv,promiseAllObject:()=>g2,primitiveTypes:()=>Nr,prefixIssues:()=>$i,pick:()=>I2,partial:()=>j2,parsedType:()=>V,optionalKeys:()=>tr,omit:()=>_2,objectClone:()=>$2,numKeys:()=>b2,nullish:()=>ci,normalizeParams:()=>f,mergeDefs:()=>Hi,merge:()=>w2,jsonStringifyReplacer:()=>V$,joinValues:()=>j,issue:()=>f$,isPlainObject:()=>Ri,isObject:()=>g$,hexToUint8Array:()=>V2,getSizableOrigin:()=>wv,getParsedType:()=>u2,getLengthableOrigin:()=>jv,getEnumValues:()=>_v,getElementAtPath:()=>n2,floatSafeRemainder:()=>Zr,finalizeIssue:()=>p,extend:()=>D2,explicitlyAborted:()=>Cr,escapeRegex:()=>Ui,esc:()=>Qn,defineLazy:()=>S,createTransparentProxy:()=>U2,cloneDef:()=>v2,clone:()=>a,cleanRegex:()=>Dv,cleanEnum:()=>J2,captureStackTrace:()=>Kn,cached:()=>X$,base64urlToUint8Array:()=>P2,base64ToUint8Array:()=>D1,assignProp:()=>Ci,assertNotEqual:()=>pw,assertNever:()=>sw,assertIs:()=>ew,assertEqual:()=>aw,assert:()=>i2,allowsEval:()=>Mr,aborted:()=>Fi,NUMBER_FORMAT_RANGES:()=>Er,Class:()=>w1,BIGINT_FORMAT_RANGES:()=>cr});function aw(i){return i}function pw(i){return i}function ew(i){}function sw(i){throw Error("Unexpected value in exhaustive check")}function i2(i){}function _v(i){let $=Object.values(i).filter((g)=>typeof g==="number");return Object.entries(i).filter(([g,v])=>$.indexOf(+g)===-1).map(([g,v])=>v)}function j(i,$="|"){return i.map((n)=>W(n)).join($)}function V$(i,$){if(typeof $==="bigint")return $.toString();return $}function X$(i){return{get value(){{let n=i();return Object.defineProperty(this,"value",{value:n}),n}throw Error("cached value already set")}}}function ci(i){return i===null||i===void 0}function Dv(i){let $=i.startsWith("^")?1:0,n=i.endsWith("$")?i.length-1:i.length;return i.slice($,n)}function Zr(i,$){let n=i/$,g=Math.round(n),v=Number.EPSILON*Math.max(Math.abs(n),1);if(Math.abs(n-g)<v)return 0;return n-g}var _1=Symbol("evaluating");function S(i,$,n){let g=void 0;Object.defineProperty(i,$,{get(){if(g===_1)return;if(g===void 0)g=_1,g=n();return g},set(v){Object.defineProperty(i,$,{value:v})},configurable:!0})}function $2(i){return Object.create(Object.getPrototypeOf(i),Object.getOwnPropertyDescriptors(i))}function Ci(i,$,n){Object.defineProperty(i,$,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Hi(...i){let $={};for(let n of i){let g=Object.getOwnPropertyDescriptors(n);Object.assign($,g)}return Object.defineProperties({},$)}function v2(i){return Hi(i._zod.def)}function n2(i,$){if(!$)return i;return $.reduce((n,g)=>n?.[g],i)}function g2(i){let $=Object.keys(i),n=$.map((g)=>i[g]);return Promise.all(n).then((g)=>{let v={};for(let r=0;r<$.length;r++)v[$[r]]=g[r];return v})}function r2(i=10){let n="";for(let g=0;g<i;g++)n+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return n}function Qn(i){return JSON.stringify(i)}function qr(i){return i.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Kn="captureStackTrace"in Error?Error.captureStackTrace:(...i)=>{};function g$(i){return typeof i==="object"&&i!==null&&!Array.isArray(i)}var Mr=X$(()=>{if(v$.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(i){return!1}});function Ri(i){if(g$(i)===!1)return!1;let $=i.constructor;if($===void 0)return!0;if(typeof $!=="function")return!0;let n=$.prototype;if(g$(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function xr(i){if(Ri(i))return{...i};if(Array.isArray(i))return[...i];if(i instanceof Map)return new Map(i);if(i instanceof Set)return new Set(i);return i}function b2(i){let $=0;for(let n in i)if(Object.prototype.hasOwnProperty.call(i,n))$++;return $}var u2=(i)=>{let $=typeof i;switch($){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(i)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(i))return"array";if(i===null)return"null";if(i.then&&typeof i.then==="function"&&i.catch&&typeof i.catch==="function")return"promise";if(typeof Map<"u"&&i instanceof Map)return"map";if(typeof Set<"u"&&i instanceof Set)return"set";if(typeof Date<"u"&&i instanceof Date)return"date";if(typeof File<"u"&&i instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${$}`)}},kv=new Set(["string","number","symbol"]),Nr=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Ui(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function a(i,$,n){let g=new i._zod.constr($??i._zod.def);if(!$||n?.parent)g._zod.parent=i;return g}function f(i){let $=i;if(!$)return{};if(typeof $==="string")return{error:()=>$};if($?.message!==void 0){if($?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");$.error=$.message}if(delete $.message,typeof $.error==="string")return{...$,error:()=>$.error};return $}function U2(i){let $;return new Proxy({},{get(n,g,v){return $??($=i()),Reflect.get($,g,v)},set(n,g,v,r){return $??($=i()),Reflect.set($,g,v,r)},has(n,g){return $??($=i()),Reflect.has($,g)},deleteProperty(n,g){return $??($=i()),Reflect.deleteProperty($,g)},ownKeys(n){return $??($=i()),Reflect.ownKeys($)},getOwnPropertyDescriptor(n,g){return $??($=i()),Reflect.getOwnPropertyDescriptor($,g)},defineProperty(n,g,v){return $??($=i()),Reflect.defineProperty($,g,v)}})}function W(i){if(typeof i==="bigint")return i.toString()+"n";if(typeof i==="string")return`"${i}"`;return`${i}`}function tr(i){return Object.keys(i).filter(($)=>{return i[$]._zod.optin==="optional"&&i[$]._zod.optout==="optional"})}var Er={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},cr={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function I2(i,$){let n=i._zod.def,g=n.checks;if(g&&g.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let r=Hi(i._zod.def,{get shape(){let b={};for(let u in $){if(!(u in n.shape))throw Error(`Unrecognized key: "${u}"`);if(!$[u])continue;b[u]=n.shape[u]}return Ci(this,"shape",b),b},checks:[]});return a(i,r)}function _2(i,$){let n=i._zod.def,g=n.checks;if(g&&g.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let r=Hi(i._zod.def,{get shape(){let b={...i._zod.def.shape};for(let u in $){if(!(u in n.shape))throw Error(`Unrecognized key: "${u}"`);if(!$[u])continue;delete b[u]}return Ci(this,"shape",b),b},checks:[]});return a(i,r)}function D2(i,$){if(!Ri($))throw Error("Invalid input to extend: expected a plain object");let n=i._zod.def.checks;if(n&&n.length>0){let r=i._zod.def.shape;for(let b in $)if(Object.getOwnPropertyDescriptor(r,b)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let v=Hi(i._zod.def,{get shape(){let r={...i._zod.def.shape,...$};return Ci(this,"shape",r),r}});return a(i,v)}function k2(i,$){if(!Ri($))throw Error("Invalid input to safeExtend: expected a plain object");let n=Hi(i._zod.def,{get shape(){let g={...i._zod.def.shape,...$};return Ci(this,"shape",g),g}});return a(i,n)}function w2(i,$){if(i._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n=Hi(i._zod.def,{get shape(){let g={...i._zod.def.shape,...$._zod.def.shape};return Ci(this,"shape",g),g},get catchall(){return $._zod.def.catchall},checks:$._zod.def.checks??[]});return a(i,n)}function j2(i,$,n){let v=$._zod.def.checks;if(v&&v.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let b=Hi($._zod.def,{get shape(){let u=$._zod.def.shape,I={...u};if(n)for(let U in n){if(!(U in u))throw Error(`Unrecognized key: "${U}"`);if(!n[U])continue;I[U]=i?new i({type:"optional",innerType:u[U]}):u[U]}else for(let U in u)I[U]=i?new i({type:"optional",innerType:u[U]}):u[U];return Ci(this,"shape",I),I},checks:[]});return a($,b)}function O2(i,$,n){let g=Hi($._zod.def,{get shape(){let v=$._zod.def.shape,r={...v};if(n)for(let b in n){if(!(b in r))throw Error(`Unrecognized key: "${b}"`);if(!n[b])continue;r[b]=new i({type:"nonoptional",innerType:v[b]})}else for(let b in v)r[b]=new i({type:"nonoptional",innerType:v[b]});return Ci(this,"shape",r),r}});return a($,g)}function Fi(i,$=0){if(i.aborted===!0)return!0;for(let n=$;n<i.issues.length;n++)if(i.issues[n]?.continue!==!0)return!0;return!1}function Cr(i,$=0){if(i.aborted===!0)return!0;for(let n=$;n<i.issues.length;n++)if(i.issues[n]?.continue===!1)return!0;return!1}function $i(i,$){return $.map((n)=>{var g;return(g=n).path??(g.path=[]),n.path.unshift(i),n})}function Iv(i){return typeof i==="string"?i:i?.message}function p(i,$,n){let g=i.message?i.message:Iv(i.inst?._zod.def?.error?.(i))??Iv($?.error?.(i))??Iv(n.customError?.(i))??Iv(n.localeError?.(i))??"Invalid input",{inst:v,continue:r,input:b,...u}=i;if(u.path??(u.path=[]),u.message=g,$?.reportInput)u.input=b;return u}function wv(i){if(i instanceof Set)return"set";if(i instanceof Map)return"map";if(i instanceof File)return"file";return"unknown"}function jv(i){if(Array.isArray(i))return"array";if(typeof i==="string")return"string";return"unknown"}function V(i){let $=typeof i;switch($){case"number":return Number.isNaN(i)?"nan":"number";case"object":{if(i===null)return"null";if(Array.isArray(i))return"array";let n=i;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return $}function f$(...i){let[$,n,g]=i;if(typeof $==="string")return{message:$,code:"custom",input:n,inst:g};return{...$}}function J2(i){return Object.entries(i).filter(([$,n])=>{return Number.isNaN(Number.parseInt($,10))}).map(($)=>$[1])}function D1(i){let $=atob(i),n=new Uint8Array($.length);for(let g=0;g<$.length;g++)n[g]=$.charCodeAt(g);return n}function k1(i){let $="";for(let n=0;n<i.length;n++)$+=String.fromCharCode(i[n]);return btoa($)}function P2(i){let $=i.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-$.length%4)%4);return D1($+n)}function W2(i){return k1(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function V2(i){let $=i.replace(/^0x/,"");if($.length%2!==0)throw Error("Invalid hex string length");let n=new Uint8Array($.length/2);for(let g=0;g<$.length;g+=2)n[g/2]=Number.parseInt($.slice(g,g+2),16);return n}function X2(i){return Array.from(i).map(($)=>$.toString(16).padStart(2,"0")).join("")}class w1{constructor(...i){}}var j1=(i,$)=>{i.name="$ZodError",Object.defineProperty(i,"_zod",{value:i._zod,enumerable:!1}),Object.defineProperty(i,"issues",{value:$,enumerable:!1}),i.message=JSON.stringify($,V$,2),Object.defineProperty(i,"toString",{value:()=>i.message,enumerable:!1})},Ov=w("$ZodError",j1),vi=w("$ZodError",j1,{Parent:Error});function Jv(i,$=(n)=>n.message){let n={},g=[];for(let v of i.issues)if(v.path.length>0)n[v.path[0]]=n[v.path[0]]||[],n[v.path[0]].push($(v));else g.push($(v));return{formErrors:g,fieldErrors:n}}function Pv(i,$=(n)=>n.message){let n={_errors:[]},g=(v,r=[])=>{for(let b of v.issues)if(b.code==="invalid_union"&&b.errors.length)b.errors.map((u)=>g({issues:u},[...r,...b.path]));else if(b.code==="invalid_key")g({issues:b.issues},[...r,...b.path]);else if(b.code==="invalid_element")g({issues:b.issues},[...r,...b.path]);else{let u=[...r,...b.path];if(u.length===0)n._errors.push($(b));else{let I=n,U=0;while(U<u.length){let _=u[U];if(U!==u.length-1)I[_]=I[_]||{_errors:[]};else I[_]=I[_]||{_errors:[]},I[_]._errors.push($(b));I=I[_],U++}}}};return g(i),n}function Rr(i,$=(n)=>n.message){let n={errors:[]},g=(v,r=[])=>{var b,u;for(let I of v.issues)if(I.code==="invalid_union"&&I.errors.length)I.errors.map((U)=>g({issues:U},[...r,...I.path]));else if(I.code==="invalid_key")g({issues:I.issues},[...r,...I.path]);else if(I.code==="invalid_element")g({issues:I.issues},[...r,...I.path]);else{let U=[...r,...I.path];if(U.length===0){n.errors.push($(I));continue}let _=n,k=0;while(k<U.length){let O=U[k],J=k===U.length-1;if(typeof O==="string")_.properties??(_.properties={}),(b=_.properties)[O]??(b[O]={errors:[]}),_=_.properties[O];else _.items??(_.items=[]),(u=_.items)[O]??(u[O]={errors:[]}),_=_.items[O];if(J)_.errors.push($(I));k++}}};return g(i),n}function O1(i){let $=[],n=i.map((g)=>typeof g==="object"?g.key:g);for(let g of n)if(typeof g==="number")$.push(`[${g}]`);else if(typeof g==="symbol")$.push(`[${JSON.stringify(String(g))}]`);else if(/[^\w$]/.test(g))$.push(`[${JSON.stringify(g)}]`);else{if($.length)$.push(".");$.push(g)}return $.join("")}function Fr(i){let $=[],n=[...i.issues].sort((g,v)=>(g.path??[]).length-(v.path??[]).length);for(let g of n)if($.push(`\u2716 ${g.message}`),g.path?.length)$.push(` \u2192 at ${O1(g.path)}`);return $.join(`
4
- `)}var Q$=(i)=>($,n,g,v)=>{let r=g?{...g,async:!1}:{async:!1},b=$._zod.run({value:n,issues:[]},r);if(b instanceof Promise)throw new Oi;if(b.issues.length){let u=new(v?.Err??i)(b.issues.map((I)=>p(I,r,E())));throw Kn(u,v?.callee),u}return b.value},Gn=Q$(vi),K$=(i)=>async($,n,g,v)=>{let r=g?{...g,async:!0}:{async:!0},b=$._zod.run({value:n,issues:[]},r);if(b instanceof Promise)b=await b;if(b.issues.length){let u=new(v?.Err??i)(b.issues.map((I)=>p(I,r,E())));throw Kn(u,v?.callee),u}return b.value},Yn=K$(vi),G$=(i)=>($,n,g)=>{let v=g?{...g,async:!1}:{async:!1},r=$._zod.run({value:n,issues:[]},v);if(r instanceof Promise)throw new Oi;return r.issues.length?{success:!1,error:new(i??Ov)(r.issues.map((b)=>p(b,v,E())))}:{success:!0,data:r.value}},or=G$(vi),Y$=(i)=>async($,n,g)=>{let v=g?{...g,async:!0}:{async:!0},r=$._zod.run({value:n,issues:[]},v);if(r instanceof Promise)r=await r;return r.issues.length?{success:!1,error:new i(r.issues.map((b)=>p(b,v,E())))}:{success:!0,data:r.value}},mr=Y$(vi),Hn=(i)=>($,n,g)=>{let v=g?{...g,direction:"backward"}:{direction:"backward"};return Q$(i)($,n,v)},Q2=Hn(vi),zn=(i)=>($,n,g)=>{return Q$(i)($,n,g)},K2=zn(vi),Sn=(i)=>async($,n,g)=>{let v=g?{...g,direction:"backward"}:{direction:"backward"};return K$(i)($,n,v)},G2=Sn(vi),An=(i)=>async($,n,g)=>{return K$(i)($,n,g)},Y2=An(vi),ln=(i)=>($,n,g)=>{let v=g?{...g,direction:"backward"}:{direction:"backward"};return G$(i)($,n,v)},H2=ln(vi),Bn=(i)=>($,n,g)=>{return G$(i)($,n,g)},z2=Bn(vi),Ln=(i)=>async($,n,g)=>{let v=g?{...g,direction:"backward"}:{direction:"backward"};return Y$(i)($,n,v)},S2=Ln(vi),Tn=(i)=>async($,n,g)=>{return Y$(i)($,n,g)},A2=Tn(vi);var ri={};Gi(ri,{xid:()=>ar,uuid7:()=>T2,uuid6:()=>L2,uuid4:()=>B2,uuid:()=>r$,uppercase:()=>fb,unicodeEmail:()=>J1,undefined:()=>Vb,ulid:()=>dr,time:()=>kb,string:()=>jb,sha512_hex:()=>ij,sha512_base64url:()=>vj,sha512_base64:()=>$j,sha384_hex:()=>p2,sha384_base64url:()=>s2,sha384_base64:()=>e2,sha256_hex:()=>h2,sha256_base64url:()=>a2,sha256_base64:()=>d2,sha1_hex:()=>o2,sha1_base64url:()=>y2,sha1_base64:()=>m2,rfc5322Email:()=>q2,number:()=>Wv,null:()=>Wb,nanoid:()=>er,md5_hex:()=>C2,md5_base64url:()=>F2,md5_base64:()=>R2,mac:()=>rb,lowercase:()=>Xb,ksuid:()=>pr,ipv6:()=>gb,ipv4:()=>nb,integer:()=>Jb,idnEmail:()=>M2,httpProtocol:()=>Ib,html5Email:()=>Z2,hostname:()=>t2,hex:()=>c2,guid:()=>ib,extendedDuration:()=>l2,emoji:()=>vb,email:()=>$b,e164:()=>_b,duration:()=>sr,domain:()=>E2,datetime:()=>wb,date:()=>Db,cuid2:()=>hr,cuid:()=>yr,cidrv6:()=>ub,cidrv4:()=>bb,browserEmail:()=>x2,boolean:()=>Pb,bigint:()=>Ob,base64url:()=>Zn,base64:()=>Ub});var yr=/^[cC][0-9a-z]{6,}$/,hr=/^[0-9a-z]+$/,dr=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ar=/^[0-9a-vA-V]{20}$/,pr=/^[A-Za-z0-9]{27}$/,er=/^[a-zA-Z0-9_-]{21}$/,sr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,l2=/^[-+]?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)?)??$/,ib=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,r$=(i)=>{if(!i)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${i}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},B2=r$(4),L2=r$(6),T2=r$(7),$b=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Z2=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,q2=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,J1=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,M2=J1,x2=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,N2="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function vb(){return new RegExp(N2,"u")}var nb=/^(?:(?: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])$/,gb=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,rb=(i)=>{let $=Ui(i??":");return new RegExp(`^(?:[0-9A-F]{2}${$}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${$}){5}[0-9a-f]{2}$`)},bb=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ub=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ub=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Zn=/^[A-Za-z0-9_-]*$/,t2=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,E2=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Ib=/^https?$/,_b=/^\+[1-9]\d{6,14}$/,P1="(?:(?:\\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])))",Db=new RegExp(`^${P1}$`);function W1(i){return typeof i.precision==="number"?i.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":i.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${i.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function kb(i){return new RegExp(`^${W1(i)}$`)}function wb(i){let $=W1({precision:i.precision}),n=["Z"];if(i.local)n.push("");if(i.offset)n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let g=`${$}(?:${n.join("|")})`;return new RegExp(`^${P1}T(?:${g})$`)}var jb=(i)=>{let $=i?`[\\s\\S]{${i?.minimum??0},${i?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${$}$`)},Ob=/^-?\d+n?$/,Jb=/^-?\d+$/,Wv=/^-?\d+(?:\.\d+)?$/,Pb=/^(?:true|false)$/i,Wb=/^null$/i;var Vb=/^undefined$/i;var Xb=/^[^A-Z]*$/,fb=/^[^a-z]*$/,c2=/^[0-9a-fA-F]*$/;function Vv(i,$){return new RegExp(`^[A-Za-z0-9+/]{${i}}${$}$`)}function Xv(i){return new RegExp(`^[A-Za-z0-9_-]{${i}}$`)}var C2=/^[0-9a-fA-F]{32}$/,R2=Vv(22,"=="),F2=Xv(22),o2=/^[0-9a-fA-F]{40}$/,m2=Vv(27,"="),y2=Xv(27),h2=/^[0-9a-fA-F]{64}$/,d2=Vv(43,"="),a2=Xv(43),p2=/^[0-9a-fA-F]{96}$/,e2=Vv(64,""),s2=Xv(64),ij=/^[0-9a-fA-F]{128}$/,$j=Vv(86,"=="),vj=Xv(86);var M=w("$ZodCheck",(i,$)=>{var n;i._zod??(i._zod={}),i._zod.def=$,(n=i._zod).onattach??(n.onattach=[])}),X1={number:"number",bigint:"bigint",object:"date"},qn=w("$ZodCheckLessThan",(i,$)=>{M.init(i,$);let n=X1[typeof $.value];i._zod.onattach.push((g)=>{let v=g._zod.bag,r=($.inclusive?v.maximum:v.exclusiveMaximum)??Number.POSITIVE_INFINITY;if($.value<r)if($.inclusive)v.maximum=$.value;else v.exclusiveMaximum=$.value}),i._zod.check=(g)=>{if($.inclusive?g.value<=$.value:g.value<$.value)return;g.issues.push({origin:n,code:"too_big",maximum:typeof $.value==="object"?$.value.getTime():$.value,input:g.value,inclusive:$.inclusive,inst:i,continue:!$.abort})}}),Mn=w("$ZodCheckGreaterThan",(i,$)=>{M.init(i,$);let n=X1[typeof $.value];i._zod.onattach.push((g)=>{let v=g._zod.bag,r=($.inclusive?v.minimum:v.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if($.value>r)if($.inclusive)v.minimum=$.value;else v.exclusiveMinimum=$.value}),i._zod.check=(g)=>{if($.inclusive?g.value>=$.value:g.value>$.value)return;g.issues.push({origin:n,code:"too_small",minimum:typeof $.value==="object"?$.value.getTime():$.value,input:g.value,inclusive:$.inclusive,inst:i,continue:!$.abort})}}),Qb=w("$ZodCheckMultipleOf",(i,$)=>{M.init(i,$),i._zod.onattach.push((n)=>{var g;(g=n._zod.bag).multipleOf??(g.multipleOf=$.value)}),i._zod.check=(n)=>{if(typeof n.value!==typeof $.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?n.value%$.value===BigInt(0):Zr(n.value,$.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:$.value,input:n.value,inst:i,continue:!$.abort})}}),Kb=w("$ZodCheckNumberFormat",(i,$)=>{M.init(i,$),$.format=$.format||"float64";let n=$.format?.includes("int"),g=n?"int":"number",[v,r]=Er[$.format];i._zod.onattach.push((b)=>{let u=b._zod.bag;if(u.format=$.format,u.minimum=v,u.maximum=r,n)u.pattern=Jb}),i._zod.check=(b)=>{let u=b.value;if(n){if(!Number.isInteger(u)){b.issues.push({expected:g,format:$.format,code:"invalid_type",continue:!1,input:u,inst:i});return}if(!Number.isSafeInteger(u)){if(u>0)b.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:i,origin:g,inclusive:!0,continue:!$.abort});else b.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:i,origin:g,inclusive:!0,continue:!$.abort});return}}if(u<v)b.issues.push({origin:"number",input:u,code:"too_small",minimum:v,inclusive:!0,inst:i,continue:!$.abort});if(u>r)b.issues.push({origin:"number",input:u,code:"too_big",maximum:r,inclusive:!0,inst:i,continue:!$.abort})}}),Gb=w("$ZodCheckBigIntFormat",(i,$)=>{M.init(i,$);let[n,g]=cr[$.format];i._zod.onattach.push((v)=>{let r=v._zod.bag;r.format=$.format,r.minimum=n,r.maximum=g}),i._zod.check=(v)=>{let r=v.value;if(r<n)v.issues.push({origin:"bigint",input:r,code:"too_small",minimum:n,inclusive:!0,inst:i,continue:!$.abort});if(r>g)v.issues.push({origin:"bigint",input:r,code:"too_big",maximum:g,inclusive:!0,inst:i,continue:!$.abort})}}),Yb=w("$ZodCheckMaxSize",(i,$)=>{var n;M.init(i,$),(n=i._zod.def).when??(n.when=(g)=>{let v=g.value;return!ci(v)&&v.size!==void 0}),i._zod.onattach.push((g)=>{let v=g._zod.bag.maximum??Number.POSITIVE_INFINITY;if($.maximum<v)g._zod.bag.maximum=$.maximum}),i._zod.check=(g)=>{let v=g.value;if(v.size<=$.maximum)return;g.issues.push({origin:wv(v),code:"too_big",maximum:$.maximum,inclusive:!0,input:v,inst:i,continue:!$.abort})}}),Hb=w("$ZodCheckMinSize",(i,$)=>{var n;M.init(i,$),(n=i._zod.def).when??(n.when=(g)=>{let v=g.value;return!ci(v)&&v.size!==void 0}),i._zod.onattach.push((g)=>{let v=g._zod.bag.minimum??Number.NEGATIVE_INFINITY;if($.minimum>v)g._zod.bag.minimum=$.minimum}),i._zod.check=(g)=>{let v=g.value;if(v.size>=$.minimum)return;g.issues.push({origin:wv(v),code:"too_small",minimum:$.minimum,inclusive:!0,input:v,inst:i,continue:!$.abort})}}),zb=w("$ZodCheckSizeEquals",(i,$)=>{var n;M.init(i,$),(n=i._zod.def).when??(n.when=(g)=>{let v=g.value;return!ci(v)&&v.size!==void 0}),i._zod.onattach.push((g)=>{let v=g._zod.bag;v.minimum=$.size,v.maximum=$.size,v.size=$.size}),i._zod.check=(g)=>{let v=g.value,r=v.size;if(r===$.size)return;let b=r>$.size;g.issues.push({origin:wv(v),...b?{code:"too_big",maximum:$.size}:{code:"too_small",minimum:$.size},inclusive:!0,exact:!0,input:g.value,inst:i,continue:!$.abort})}}),Sb=w("$ZodCheckMaxLength",(i,$)=>{var n;M.init(i,$),(n=i._zod.def).when??(n.when=(g)=>{let v=g.value;return!ci(v)&&v.length!==void 0}),i._zod.onattach.push((g)=>{let v=g._zod.bag.maximum??Number.POSITIVE_INFINITY;if($.maximum<v)g._zod.bag.maximum=$.maximum}),i._zod.check=(g)=>{let v=g.value;if(v.length<=$.maximum)return;let b=jv(v);g.issues.push({origin:b,code:"too_big",maximum:$.maximum,inclusive:!0,input:v,inst:i,continue:!$.abort})}}),Ab=w("$ZodCheckMinLength",(i,$)=>{var n;M.init(i,$),(n=i._zod.def).when??(n.when=(g)=>{let v=g.value;return!ci(v)&&v.length!==void 0}),i._zod.onattach.push((g)=>{let v=g._zod.bag.minimum??Number.NEGATIVE_INFINITY;if($.minimum>v)g._zod.bag.minimum=$.minimum}),i._zod.check=(g)=>{let v=g.value;if(v.length>=$.minimum)return;let b=jv(v);g.issues.push({origin:b,code:"too_small",minimum:$.minimum,inclusive:!0,input:v,inst:i,continue:!$.abort})}}),lb=w("$ZodCheckLengthEquals",(i,$)=>{var n;M.init(i,$),(n=i._zod.def).when??(n.when=(g)=>{let v=g.value;return!ci(v)&&v.length!==void 0}),i._zod.onattach.push((g)=>{let v=g._zod.bag;v.minimum=$.length,v.maximum=$.length,v.length=$.length}),i._zod.check=(g)=>{let v=g.value,r=v.length;if(r===$.length)return;let b=jv(v),u=r>$.length;g.issues.push({origin:b,...u?{code:"too_big",maximum:$.length}:{code:"too_small",minimum:$.length},inclusive:!0,exact:!0,input:g.value,inst:i,continue:!$.abort})}}),H$=w("$ZodCheckStringFormat",(i,$)=>{var n,g;if(M.init(i,$),i._zod.onattach.push((v)=>{let r=v._zod.bag;if(r.format=$.format,$.pattern)r.patterns??(r.patterns=new Set),r.patterns.add($.pattern)}),$.pattern)(n=i._zod).check??(n.check=(v)=>{if($.pattern.lastIndex=0,$.pattern.test(v.value))return;v.issues.push({origin:"string",code:"invalid_format",format:$.format,input:v.value,...$.pattern?{pattern:$.pattern.toString()}:{},inst:i,continue:!$.abort})});else(g=i._zod).check??(g.check=()=>{})}),Bb=w("$ZodCheckRegex",(i,$)=>{H$.init(i,$),i._zod.check=(n)=>{if($.pattern.lastIndex=0,$.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:$.pattern.toString(),inst:i,continue:!$.abort})}}),Lb=w("$ZodCheckLowerCase",(i,$)=>{$.pattern??($.pattern=Xb),H$.init(i,$)}),Tb=w("$ZodCheckUpperCase",(i,$)=>{$.pattern??($.pattern=fb),H$.init(i,$)}),Zb=w("$ZodCheckIncludes",(i,$)=>{M.init(i,$);let n=Ui($.includes),g=new RegExp(typeof $.position==="number"?`^.{${$.position}}${n}`:n);$.pattern=g,i._zod.onattach.push((v)=>{let r=v._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(g)}),i._zod.check=(v)=>{if(v.value.includes($.includes,$.position))return;v.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:$.includes,input:v.value,inst:i,continue:!$.abort})}}),qb=w("$ZodCheckStartsWith",(i,$)=>{M.init(i,$);let n=new RegExp(`^${Ui($.prefix)}.*`);$.pattern??($.pattern=n),i._zod.onattach.push((g)=>{let v=g._zod.bag;v.patterns??(v.patterns=new Set),v.patterns.add(n)}),i._zod.check=(g)=>{if(g.value.startsWith($.prefix))return;g.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:$.prefix,input:g.value,inst:i,continue:!$.abort})}}),Mb=w("$ZodCheckEndsWith",(i,$)=>{M.init(i,$);let n=new RegExp(`.*${Ui($.suffix)}$`);$.pattern??($.pattern=n),i._zod.onattach.push((g)=>{let v=g._zod.bag;v.patterns??(v.patterns=new Set),v.patterns.add(n)}),i._zod.check=(g)=>{if(g.value.endsWith($.suffix))return;g.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:$.suffix,input:g.value,inst:i,continue:!$.abort})}});function V1(i,$,n){if(i.issues.length)$.issues.push(...$i(n,i.issues))}var xb=w("$ZodCheckProperty",(i,$)=>{M.init(i,$),i._zod.check=(n)=>{let g=$.schema._zod.run({value:n.value[$.property],issues:[]},{});if(g instanceof Promise)return g.then((v)=>V1(v,n,$.property));V1(g,n,$.property);return}}),Nb=w("$ZodCheckMimeType",(i,$)=>{M.init(i,$);let n=new Set($.mime);i._zod.onattach.push((g)=>{g._zod.bag.mime=$.mime}),i._zod.check=(g)=>{if(n.has(g.value.type))return;g.issues.push({code:"invalid_value",values:$.mime,input:g.value.type,inst:i,continue:!$.abort})}}),tb=w("$ZodCheckOverwrite",(i,$)=>{M.init(i,$),i._zod.check=(n)=>{n.value=$.tx(n.value)}});class xn{constructor(i=[]){if(this.content=[],this.indent=0,this)this.args=i}indented(i){this.indent+=1,i(this),this.indent-=1}write(i){if(typeof i==="function"){i(this,{execution:"sync"}),i(this,{execution:"async"});return}let n=i.split(`
3
+ var t2=Object.create;var{getPrototypeOf:c2,defineProperty:Ar,getOwnPropertyNames:C2}=Object;var R2=Object.prototype.hasOwnProperty;function F2(i){return this[i]}var o2,m2,tX=(i,$,n)=>{var g=i!=null&&typeof i==="object";if(g){var v=$?o2??=new WeakMap:m2??=new WeakMap,r=v.get(i);if(r)return r}n=i!=null?t2(c2(i)):{};let b=$||!i||!i.__esModule?Ar(n,"default",{value:i,enumerable:!0}):n;for(let u of C2(i))if(!R2.call(b,u))Ar(b,u,{get:F2.bind(i,u),enumerable:!0});if(g)v.set(i,b);return b};var cX=(i,$)=>()=>($||i(($={exports:{}}).exports,$),$.exports);var y2=(i)=>i;function h2(i,$){this[i]=y2.bind(null,$)}var Gi=(i,$)=>{for(var n in $)Ar(i,n,{get:$[n],enumerable:!0,configurable:!0,set:h2.bind($,n)})};var CX=import.meta.require;import{mkdirSync as T2,readFileSync as lX,unlinkSync as Z2,writeFileSync as LX}from"fs";import{join as TX}from"path";class $${}var Yi=(i)=>{if(i.literal!==void 0&&i.literal!=="")return i.literal;if(i.envVar!==void 0&&i.envVar!==""){let $=i.env[i.envVar];if($!==void 0&&$!=="")return $;throw Error(`${i.label} references env var "${i.envVar}" but it is not set in the environment`)}throw Error(`${i.label} has neither a literal token nor an env var reference`)};class Uv{}class Di extends Uv{constructor(){super();Object.freeze(this)}async fetch(i){let $=await globalThis.fetch(i.url,{method:i.method,headers:i.headers,body:i.body});return{status:$.status,ok:$.ok,text:()=>$.text(),json:()=>$.json()}}}var d2="https://discord.com/api/v10",a2=new Di;class Br extends $${token;http;constructor(i){super();this.token=Yi({literal:i.config.botToken,envVar:i.config.botTokenEnv,env:i.env??process.env,label:`${i.config.name}.botToken`}),this.http=i.http??a2,Object.freeze(this)}async call(i){let $=(i.method||"GET").toUpperCase(),n=i.path.startsWith("/")?i.path:`/${i.path}`,g=i.body,v=g!==null&&typeof g==="object"&&$!=="GET"&&Object.keys(g).length>0,r=await this.http.fetch({method:$,url:`${d2}${n}`,headers:{Authorization:`Bot ${this.token}`,"Content-Type":"application/json"},body:v?JSON.stringify(i.body):void 0});if(!r.ok)throw Error(`Discord API failed (${r.status}): ${await r.text()}`);if(r.status===204)return null;return await r.json()}}var D={};Gi(D,{xor:()=>t0,xid:()=>I0,void:()=>Z0,uuidv7:()=>$0,uuidv6:()=>i0,uuidv4:()=>s1,uuid:()=>e1,util:()=>X,url:()=>v0,uppercase:()=>l$,unknown:()=>_$,union:()=>dg,undefined:()=>L0,ulid:()=>U0,uint64:()=>B0,uint32:()=>z0,tuple:()=>eU,trim:()=>x$,treeifyError:()=>Rr,transform:()=>pg,toUpperCase:()=>E$,toLowerCase:()=>N$,toJSONSchema:()=>Qg,templateLiteral:()=>iD,symbol:()=>l0,superRefine:()=>HI,success:()=>a0,stringbool:()=>UD,stringFormat:()=>X0,string:()=>Lv,strictObject:()=>N0,startsWith:()=>T$,slugify:()=>t$,size:()=>u$,setErrorMap:()=>BO,set:()=>o0,safeParseAsync:()=>HU,safeParse:()=>YU,safeEncodeAsync:()=>TU,safeEncode:()=>lU,safeDecodeAsync:()=>ZU,safeDecode:()=>LU,registry:()=>yn,regexes:()=>ri,regex:()=>A$,refine:()=>YI,record:()=>sU,readonly:()=>VI,property:()=>Wg,promise:()=>$D,prettifyError:()=>Fr,preprocess:()=>_D,prefault:()=>DI,positive:()=>jg,pipe:()=>Ag,partialRecord:()=>C0,parseAsync:()=>GU,parse:()=>KU,overwrite:()=>ki,optional:()=>Zv,object:()=>x0,number:()=>MU,nullish:()=>d0,nullable:()=>qv,null:()=>cU,normalize:()=>M$,nonpositive:()=>Jg,nonoptional:()=>kI,nonnegative:()=>Pg,never:()=>hg,negative:()=>Og,nativeEnum:()=>m0,nanoid:()=>r0,nan:()=>p0,multipleOf:()=>oi,minSize:()=>Wi,minLength:()=>zi,mime:()=>q$,meta:()=>bD,maxSize:()=>mi,maxLength:()=>U$,map:()=>F0,mac:()=>k0,lte:()=>bi,lt:()=>Ji,lowercase:()=>B$,looseRecord:()=>R0,looseObject:()=>E0,locales:()=>Sv,literal:()=>y0,length:()=>I$,lazy:()=>QI,ksuid:()=>_0,keyof:()=>M0,jwt:()=>V0,json:()=>ID,iso:()=>R$,ipv6:()=>w0,ipv4:()=>D0,invertCodec:()=>s0,intersection:()=>aU,int64:()=>A0,int32:()=>H0,int:()=>Sg,instanceof:()=>uD,includes:()=>L$,httpUrl:()=>n0,hostname:()=>f0,hex:()=>Q0,hash:()=>K0,guid:()=>p1,gte:()=>e,gt:()=>Pi,globalRegistry:()=>m,getErrorMap:()=>lO,function:()=>vD,fromJSONSchema:()=>kD,formatError:()=>Pv,float64:()=>Y0,float32:()=>G0,flattenError:()=>Jv,file:()=>h0,exactOptional:()=>bI,enum:()=>ag,endsWith:()=>Z$,encodeAsync:()=>AU,encode:()=>zU,emoji:()=>g0,email:()=>a1,e164:()=>W0,discriminatedUnion:()=>c0,describe:()=>rD,decodeAsync:()=>BU,decode:()=>SU,date:()=>q0,custom:()=>gD,cuid2:()=>u0,cuid:()=>b0,core:()=>Si,config:()=>t,coerce:()=>SI,codec:()=>e0,clone:()=>a,cidrv6:()=>O0,cidrv4:()=>j0,check:()=>nD,catch:()=>OI,boolean:()=>xU,bigint:()=>S0,base64url:()=>P0,base64:()=>J0,array:()=>Ev,any:()=>T0,_function:()=>vD,_default:()=>II,_ZodString:()=>Bg,ZodXor:()=>yU,ZodXID:()=>xg,ZodVoid:()=>oU,ZodUnknown:()=>RU,ZodUnion:()=>cv,ZodUndefined:()=>EU,ZodUUID:()=>Vi,ZodURL:()=>xv,ZodULID:()=>Mg,ZodType:()=>H,ZodTuple:()=>pU,ZodTransform:()=>gI,ZodTemplateLiteral:()=>XI,ZodSymbol:()=>NU,ZodSuccess:()=>wI,ZodStringFormat:()=>q,ZodString:()=>m$,ZodSet:()=>$I,ZodRecord:()=>F$,ZodRealError:()=>ni,ZodReadonly:()=>WI,ZodPromise:()=>KI,ZodPreprocess:()=>PI,ZodPrefault:()=>_I,ZodPipe:()=>Cv,ZodOptional:()=>eg,ZodObject:()=>tv,ZodNumberFormat:()=>D$,ZodNumber:()=>h$,ZodNullable:()=>uI,ZodNull:()=>tU,ZodNonOptional:()=>sg,ZodNever:()=>FU,ZodNanoID:()=>Tg,ZodNaN:()=>JI,ZodMap:()=>iI,ZodMAC:()=>qU,ZodLiteral:()=>vI,ZodLazy:()=>fI,ZodKSUID:()=>Ng,ZodJWT:()=>mg,ZodIssueCode:()=>AO,ZodIntersection:()=>dU,ZodISOTime:()=>Hg,ZodISODuration:()=>zg,ZodISODateTime:()=>Gg,ZodISODate:()=>Yg,ZodIPv6:()=>tg,ZodIPv4:()=>Eg,ZodGUID:()=>Tv,ZodFunction:()=>GI,ZodFirstPartyTypeKind:()=>zI,ZodFile:()=>nI,ZodExactOptional:()=>rI,ZodError:()=>zO,ZodEnum:()=>o$,ZodEmoji:()=>Lg,ZodEmail:()=>lg,ZodE164:()=>og,ZodDiscriminatedUnion:()=>hU,ZodDefault:()=>UI,ZodDate:()=>Nv,ZodCustomStringFormat:()=>y$,ZodCustom:()=>Fv,ZodCodec:()=>Rv,ZodCatch:()=>jI,ZodCUID2:()=>qg,ZodCUID:()=>Zg,ZodCIDRv6:()=>Cg,ZodCIDRv4:()=>cg,ZodBoolean:()=>d$,ZodBigIntFormat:()=>yg,ZodBigInt:()=>a$,ZodBase64URL:()=>Fg,ZodBase64:()=>Rg,ZodArray:()=>mU,ZodAny:()=>CU,TimePrecision:()=>e6,NEVER:()=>lr,$output:()=>m6,$input:()=>y6,$brand:()=>Lr});var Si={};Gi(Si,{version:()=>tb,util:()=>X,treeifyError:()=>Rr,toJSONSchema:()=>Qg,toDotPath:()=>O1,safeParseAsync:()=>mr,safeParse:()=>or,safeEncodeAsync:()=>Aw,safeEncode:()=>zw,safeDecodeAsync:()=>Bw,safeDecode:()=>Sw,registry:()=>yn,regexes:()=>ri,process:()=>l,prettifyError:()=>Fr,parseAsync:()=>Yn,parse:()=>Gn,meta:()=>Lu,locales:()=>Sv,isValidJWT:()=>x1,isValidBase64URL:()=>M1,isValidBase64:()=>U4,initializeContext:()=>yi,globalRegistry:()=>m,globalConfig:()=>v$,formatError:()=>Pv,flattenError:()=>Jv,finalize:()=>di,extractDefs:()=>hi,encodeAsync:()=>Yw,encode:()=>Kw,describe:()=>lu,decodeAsync:()=>Hw,decode:()=>Gw,createToJSONSchemaMethod:()=>Zu,createStandardJSONSchemaMethod:()=>C$,config:()=>t,clone:()=>a,_xor:()=>nO,_xid:()=>gg,_void:()=>Qu,_uuidv7:()=>en,_uuidv6:()=>pn,_uuidv4:()=>an,_uuid:()=>dn,_url:()=>Bv,_uppercase:()=>l$,_unknown:()=>Xu,_union:()=>vO,_undefined:()=>Pu,_ulid:()=>ng,_uint64:()=>Ou,_uint32:()=>Iu,_tuple:()=>bO,_trim:()=>x$,_transform:()=>wO,_toUpperCase:()=>E$,_toLowerCase:()=>N$,_templateLiteral:()=>QO,_symbol:()=>Ju,_superRefine:()=>Bu,_success:()=>WO,_stringbool:()=>Tu,_stringFormat:()=>c$,_string:()=>d6,_startsWith:()=>T$,_slugify:()=>t$,_size:()=>u$,_set:()=>IO,_safeParseAsync:()=>H$,_safeParse:()=>Y$,_safeEncodeAsync:()=>Ln,_safeEncode:()=>Bn,_safeDecodeAsync:()=>Tn,_safeDecode:()=>ln,_regex:()=>A$,_refine:()=>Au,_record:()=>uO,_readonly:()=>fO,_property:()=>Wg,_promise:()=>GO,_positive:()=>jg,_pipe:()=>XO,_parseAsync:()=>G$,_parse:()=>K$,_overwrite:()=>ki,_optional:()=>jO,_number:()=>nu,_nullable:()=>OO,_null:()=>Wu,_normalize:()=>M$,_nonpositive:()=>Jg,_nonoptional:()=>PO,_nonnegative:()=>Pg,_never:()=>fu,_negative:()=>Og,_nativeEnum:()=>DO,_nanoid:()=>ig,_nan:()=>Yu,_multipleOf:()=>oi,_minSize:()=>Wi,_minLength:()=>zi,_min:()=>e,_mime:()=>q$,_maxSize:()=>mi,_maxLength:()=>U$,_max:()=>bi,_map:()=>UO,_mac:()=>p6,_lte:()=>bi,_lt:()=>Ji,_lowercase:()=>B$,_literal:()=>kO,_length:()=>I$,_lazy:()=>KO,_ksuid:()=>rg,_jwt:()=>wg,_isoTime:()=>$u,_isoDuration:()=>vu,_isoDateTime:()=>s6,_isoDate:()=>iu,_ipv6:()=>ug,_ipv4:()=>bg,_intersection:()=>rO,_int64:()=>ju,_int32:()=>Uu,_int:()=>ru,_includes:()=>L$,_guid:()=>Av,_gte:()=>e,_gt:()=>Pi,_float64:()=>uu,_float32:()=>bu,_file:()=>zu,_enum:()=>_O,_endsWith:()=>Z$,_encodeAsync:()=>Sn,_encode:()=>Hn,_emoji:()=>sn,_email:()=>hn,_e164:()=>kg,_discriminatedUnion:()=>gO,_default:()=>JO,_decodeAsync:()=>An,_decode:()=>zn,_date:()=>Ku,_custom:()=>Su,_cuid2:()=>vg,_cuid:()=>$g,_coercedString:()=>a6,_coercedNumber:()=>gu,_coercedDate:()=>Gu,_coercedBoolean:()=>Du,_coercedBigint:()=>wu,_cidrv6:()=>Ig,_cidrv4:()=>Ug,_check:()=>m1,_catch:()=>VO,_boolean:()=>_u,_bigint:()=>ku,_base64url:()=>Dg,_base64:()=>_g,_array:()=>Hu,_any:()=>Vu,TimePrecision:()=>e6,NEVER:()=>lr,JSONSchemaGenerator:()=>WU,JSONSchema:()=>y1,Doc:()=>xn,$output:()=>m6,$input:()=>y6,$constructor:()=>w,$brand:()=>Lr,$ZodXor:()=>H4,$ZodXID:()=>pb,$ZodVoid:()=>Q4,$ZodUnknown:()=>X4,$ZodUnion:()=>Qv,$ZodUndefined:()=>P4,$ZodUUID:()=>Rb,$ZodURL:()=>ob,$ZodULID:()=>ab,$ZodType:()=>Y,$ZodTuple:()=>Fn,$ZodTransform:()=>q4,$ZodTemplateLiteral:()=>m4,$ZodSymbol:()=>J4,$ZodSuccess:()=>c4,$ZodStringFormat:()=>Z,$ZodString:()=>b$,$ZodSet:()=>l4,$ZodRegistry:()=>h6,$ZodRecord:()=>A4,$ZodRealError:()=>vi,$ZodReadonly:()=>o4,$ZodPromise:()=>h4,$ZodPreprocess:()=>F4,$ZodPrefault:()=>E4,$ZodPipe:()=>mn,$ZodOptional:()=>on,$ZodObjectJIT:()=>Y4,$ZodObject:()=>t1,$ZodNumberFormat:()=>j4,$ZodNumber:()=>Cn,$ZodNullable:()=>x4,$ZodNull:()=>W4,$ZodNonOptional:()=>t4,$ZodNever:()=>f4,$ZodNanoID:()=>yb,$ZodNaN:()=>R4,$ZodMap:()=>B4,$ZodMAC:()=>r4,$ZodLiteral:()=>T4,$ZodLazy:()=>d4,$ZodKSUID:()=>eb,$ZodJWT:()=>k4,$ZodIntersection:()=>S4,$ZodISOTime:()=>$4,$ZodISODuration:()=>v4,$ZodISODateTime:()=>sb,$ZodISODate:()=>i4,$ZodIPv6:()=>g4,$ZodIPv4:()=>n4,$ZodGUID:()=>Cb,$ZodFunction:()=>y4,$ZodFile:()=>Z4,$ZodExactOptional:()=>M4,$ZodError:()=>Ov,$ZodEnum:()=>L4,$ZodEncodeError:()=>n$,$ZodEmoji:()=>mb,$ZodEmail:()=>Fb,$ZodE164:()=>D4,$ZodDiscriminatedUnion:()=>z4,$ZodDefault:()=>N4,$ZodDate:()=>K4,$ZodCustomStringFormat:()=>w4,$ZodCustom:()=>a4,$ZodCodec:()=>Kv,$ZodCheckUpperCase:()=>Tb,$ZodCheckStringFormat:()=>z$,$ZodCheckStartsWith:()=>qb,$ZodCheckSizeEquals:()=>zb,$ZodCheckRegex:()=>lb,$ZodCheckProperty:()=>xb,$ZodCheckOverwrite:()=>Eb,$ZodCheckNumberFormat:()=>Kb,$ZodCheckMultipleOf:()=>Qb,$ZodCheckMinSize:()=>Hb,$ZodCheckMinLength:()=>Ab,$ZodCheckMimeType:()=>Nb,$ZodCheckMaxSize:()=>Yb,$ZodCheckMaxLength:()=>Sb,$ZodCheckLowerCase:()=>Lb,$ZodCheckLessThan:()=>qn,$ZodCheckLengthEquals:()=>Bb,$ZodCheckIncludes:()=>Zb,$ZodCheckGreaterThan:()=>Mn,$ZodCheckEndsWith:()=>Mb,$ZodCheckBigIntFormat:()=>Gb,$ZodCheck:()=>M,$ZodCatch:()=>C4,$ZodCUID2:()=>db,$ZodCUID:()=>hb,$ZodCIDRv6:()=>u4,$ZodCIDRv4:()=>b4,$ZodBoolean:()=>fv,$ZodBigIntFormat:()=>O4,$ZodBigInt:()=>Rn,$ZodBase64URL:()=>_4,$ZodBase64:()=>I4,$ZodAsyncError:()=>Oi,$ZodArray:()=>G4,$ZodAny:()=>V4});var I1,lr=Object.freeze({status:"aborted"});function w(i,$,n){function g(u,U){if(!u._zod)Object.defineProperty(u,"_zod",{value:{def:U,constr:b,traits:new Set},enumerable:!1});if(u._zod.traits.has(i))return;u._zod.traits.add(i),$(u,U);let I=b.prototype,_=Object.keys(I);for(let k=0;k<_.length;k++){let O=_[k];if(!(O in u))u[O]=I[O].bind(u)}}let v=n?.Parent??Object;class r extends v{}Object.defineProperty(r,"name",{value:i});function b(u){var U;let I=n?.Parent?new r:this;g(I,u),(U=I._zod).deferred??(U.deferred=[]);for(let _ of I._zod.deferred)_();return I}return Object.defineProperty(b,"init",{value:g}),Object.defineProperty(b,Symbol.hasInstance,{value:(u)=>{if(n?.Parent&&u instanceof n.Parent)return!0;return u?._zod?.traits?.has(i)}}),Object.defineProperty(b,"name",{value:i}),b}var Lr=Symbol("zod_brand");class Oi extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class n$ extends Error{constructor(i){super(`Encountered unidirectional transform during encode: ${i}`);this.name="ZodEncodeError"}}(I1=globalThis).__zod_globalConfig??(I1.__zod_globalConfig={});var v$=globalThis.__zod_globalConfig;function t(i){if(i)Object.assign(v$,i);return v$}var X={};Gi(X,{unwrapMessage:()=>Iv,uint8ArrayToHex:()=>fw,uint8ArrayToBase64url:()=>Vw,uint8ArrayToBase64:()=>k1,stringifyPrimitive:()=>W,slugify:()=>qr,shallowClone:()=>xr,safeExtend:()=>ww,required:()=>Jw,randomString:()=>bw,propertyKeyTypes:()=>kv,promiseAllObject:()=>rw,primitiveTypes:()=>Nr,prefixIssues:()=>$i,pick:()=>_w,partial:()=>Ow,parsedType:()=>V,optionalKeys:()=>Er,omit:()=>Dw,objectClone:()=>vw,numKeys:()=>uw,nullish:()=>ci,normalizeParams:()=>f,mergeDefs:()=>Hi,merge:()=>jw,jsonStringifyReplacer:()=>X$,joinValues:()=>j,issue:()=>Q$,isPlainObject:()=>Ri,isObject:()=>g$,hexToUint8Array:()=>Xw,getSizableOrigin:()=>wv,getParsedType:()=>Uw,getLengthableOrigin:()=>jv,getEnumValues:()=>_v,getElementAtPath:()=>gw,floatSafeRemainder:()=>Zr,finalizeIssue:()=>p,extend:()=>kw,explicitlyAborted:()=>Cr,escapeRegex:()=>Ui,esc:()=>Qn,defineLazy:()=>S,createTransparentProxy:()=>Iw,cloneDef:()=>nw,clone:()=>a,cleanRegex:()=>Dv,cleanEnum:()=>Pw,captureStackTrace:()=>Kn,cached:()=>f$,base64urlToUint8Array:()=>Ww,base64ToUint8Array:()=>D1,assignProp:()=>Ci,assertNotEqual:()=>e2,assertNever:()=>iw,assertIs:()=>s2,assertEqual:()=>p2,assert:()=>$w,allowsEval:()=>Mr,aborted:()=>Fi,NUMBER_FORMAT_RANGES:()=>tr,Class:()=>w1,BIGINT_FORMAT_RANGES:()=>cr});function p2(i){return i}function e2(i){return i}function s2(i){}function iw(i){throw Error("Unexpected value in exhaustive check")}function $w(i){}function _v(i){let $=Object.values(i).filter((g)=>typeof g==="number");return Object.entries(i).filter(([g,v])=>$.indexOf(+g)===-1).map(([g,v])=>v)}function j(i,$="|"){return i.map((n)=>W(n)).join($)}function X$(i,$){if(typeof $==="bigint")return $.toString();return $}function f$(i){return{get value(){{let n=i();return Object.defineProperty(this,"value",{value:n}),n}throw Error("cached value already set")}}}function ci(i){return i===null||i===void 0}function Dv(i){let $=i.startsWith("^")?1:0,n=i.endsWith("$")?i.length-1:i.length;return i.slice($,n)}function Zr(i,$){let n=i/$,g=Math.round(n),v=Number.EPSILON*Math.max(Math.abs(n),1);if(Math.abs(n-g)<v)return 0;return n-g}var _1=Symbol("evaluating");function S(i,$,n){let g=void 0;Object.defineProperty(i,$,{get(){if(g===_1)return;if(g===void 0)g=_1,g=n();return g},set(v){Object.defineProperty(i,$,{value:v})},configurable:!0})}function vw(i){return Object.create(Object.getPrototypeOf(i),Object.getOwnPropertyDescriptors(i))}function Ci(i,$,n){Object.defineProperty(i,$,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Hi(...i){let $={};for(let n of i){let g=Object.getOwnPropertyDescriptors(n);Object.assign($,g)}return Object.defineProperties({},$)}function nw(i){return Hi(i._zod.def)}function gw(i,$){if(!$)return i;return $.reduce((n,g)=>n?.[g],i)}function rw(i){let $=Object.keys(i),n=$.map((g)=>i[g]);return Promise.all(n).then((g)=>{let v={};for(let r=0;r<$.length;r++)v[$[r]]=g[r];return v})}function bw(i=10){let n="";for(let g=0;g<i;g++)n+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return n}function Qn(i){return JSON.stringify(i)}function qr(i){return i.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Kn="captureStackTrace"in Error?Error.captureStackTrace:(...i)=>{};function g$(i){return typeof i==="object"&&i!==null&&!Array.isArray(i)}var Mr=f$(()=>{if(v$.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(i){return!1}});function Ri(i){if(g$(i)===!1)return!1;let $=i.constructor;if($===void 0)return!0;if(typeof $!=="function")return!0;let n=$.prototype;if(g$(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function xr(i){if(Ri(i))return{...i};if(Array.isArray(i))return[...i];if(i instanceof Map)return new Map(i);if(i instanceof Set)return new Set(i);return i}function uw(i){let $=0;for(let n in i)if(Object.prototype.hasOwnProperty.call(i,n))$++;return $}var Uw=(i)=>{let $=typeof i;switch($){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(i)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(i))return"array";if(i===null)return"null";if(i.then&&typeof i.then==="function"&&i.catch&&typeof i.catch==="function")return"promise";if(typeof Map<"u"&&i instanceof Map)return"map";if(typeof Set<"u"&&i instanceof Set)return"set";if(typeof Date<"u"&&i instanceof Date)return"date";if(typeof File<"u"&&i instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${$}`)}},kv=new Set(["string","number","symbol"]),Nr=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Ui(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function a(i,$,n){let g=new i._zod.constr($??i._zod.def);if(!$||n?.parent)g._zod.parent=i;return g}function f(i){let $=i;if(!$)return{};if(typeof $==="string")return{error:()=>$};if($?.message!==void 0){if($?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");$.error=$.message}if(delete $.message,typeof $.error==="string")return{...$,error:()=>$.error};return $}function Iw(i){let $;return new Proxy({},{get(n,g,v){return $??($=i()),Reflect.get($,g,v)},set(n,g,v,r){return $??($=i()),Reflect.set($,g,v,r)},has(n,g){return $??($=i()),Reflect.has($,g)},deleteProperty(n,g){return $??($=i()),Reflect.deleteProperty($,g)},ownKeys(n){return $??($=i()),Reflect.ownKeys($)},getOwnPropertyDescriptor(n,g){return $??($=i()),Reflect.getOwnPropertyDescriptor($,g)},defineProperty(n,g,v){return $??($=i()),Reflect.defineProperty($,g,v)}})}function W(i){if(typeof i==="bigint")return i.toString()+"n";if(typeof i==="string")return`"${i}"`;return`${i}`}function Er(i){return Object.keys(i).filter(($)=>{return i[$]._zod.optin==="optional"&&i[$]._zod.optout==="optional"})}var tr={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},cr={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function _w(i,$){let n=i._zod.def,g=n.checks;if(g&&g.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let r=Hi(i._zod.def,{get shape(){let b={};for(let u in $){if(!(u in n.shape))throw Error(`Unrecognized key: "${u}"`);if(!$[u])continue;b[u]=n.shape[u]}return Ci(this,"shape",b),b},checks:[]});return a(i,r)}function Dw(i,$){let n=i._zod.def,g=n.checks;if(g&&g.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let r=Hi(i._zod.def,{get shape(){let b={...i._zod.def.shape};for(let u in $){if(!(u in n.shape))throw Error(`Unrecognized key: "${u}"`);if(!$[u])continue;delete b[u]}return Ci(this,"shape",b),b},checks:[]});return a(i,r)}function kw(i,$){if(!Ri($))throw Error("Invalid input to extend: expected a plain object");let n=i._zod.def.checks;if(n&&n.length>0){let r=i._zod.def.shape;for(let b in $)if(Object.getOwnPropertyDescriptor(r,b)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let v=Hi(i._zod.def,{get shape(){let r={...i._zod.def.shape,...$};return Ci(this,"shape",r),r}});return a(i,v)}function ww(i,$){if(!Ri($))throw Error("Invalid input to safeExtend: expected a plain object");let n=Hi(i._zod.def,{get shape(){let g={...i._zod.def.shape,...$};return Ci(this,"shape",g),g}});return a(i,n)}function jw(i,$){if(i._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n=Hi(i._zod.def,{get shape(){let g={...i._zod.def.shape,...$._zod.def.shape};return Ci(this,"shape",g),g},get catchall(){return $._zod.def.catchall},checks:$._zod.def.checks??[]});return a(i,n)}function Ow(i,$,n){let v=$._zod.def.checks;if(v&&v.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let b=Hi($._zod.def,{get shape(){let u=$._zod.def.shape,U={...u};if(n)for(let I in n){if(!(I in u))throw Error(`Unrecognized key: "${I}"`);if(!n[I])continue;U[I]=i?new i({type:"optional",innerType:u[I]}):u[I]}else for(let I in u)U[I]=i?new i({type:"optional",innerType:u[I]}):u[I];return Ci(this,"shape",U),U},checks:[]});return a($,b)}function Jw(i,$,n){let g=Hi($._zod.def,{get shape(){let v=$._zod.def.shape,r={...v};if(n)for(let b in n){if(!(b in r))throw Error(`Unrecognized key: "${b}"`);if(!n[b])continue;r[b]=new i({type:"nonoptional",innerType:v[b]})}else for(let b in v)r[b]=new i({type:"nonoptional",innerType:v[b]});return Ci(this,"shape",r),r}});return a($,g)}function Fi(i,$=0){if(i.aborted===!0)return!0;for(let n=$;n<i.issues.length;n++)if(i.issues[n]?.continue!==!0)return!0;return!1}function Cr(i,$=0){if(i.aborted===!0)return!0;for(let n=$;n<i.issues.length;n++)if(i.issues[n]?.continue===!1)return!0;return!1}function $i(i,$){return $.map((n)=>{var g;return(g=n).path??(g.path=[]),n.path.unshift(i),n})}function Iv(i){return typeof i==="string"?i:i?.message}function p(i,$,n){let g=i.message?i.message:Iv(i.inst?._zod.def?.error?.(i))??Iv($?.error?.(i))??Iv(n.customError?.(i))??Iv(n.localeError?.(i))??"Invalid input",{inst:v,continue:r,input:b,...u}=i;if(u.path??(u.path=[]),u.message=g,$?.reportInput)u.input=b;return u}function wv(i){if(i instanceof Set)return"set";if(i instanceof Map)return"map";if(i instanceof File)return"file";return"unknown"}function jv(i){if(Array.isArray(i))return"array";if(typeof i==="string")return"string";return"unknown"}function V(i){let $=typeof i;switch($){case"number":return Number.isNaN(i)?"nan":"number";case"object":{if(i===null)return"null";if(Array.isArray(i))return"array";let n=i;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return $}function Q$(...i){let[$,n,g]=i;if(typeof $==="string")return{message:$,code:"custom",input:n,inst:g};return{...$}}function Pw(i){return Object.entries(i).filter(([$,n])=>{return Number.isNaN(Number.parseInt($,10))}).map(($)=>$[1])}function D1(i){let $=atob(i),n=new Uint8Array($.length);for(let g=0;g<$.length;g++)n[g]=$.charCodeAt(g);return n}function k1(i){let $="";for(let n=0;n<i.length;n++)$+=String.fromCharCode(i[n]);return btoa($)}function Ww(i){let $=i.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-$.length%4)%4);return D1($+n)}function Vw(i){return k1(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Xw(i){let $=i.replace(/^0x/,"");if($.length%2!==0)throw Error("Invalid hex string length");let n=new Uint8Array($.length/2);for(let g=0;g<$.length;g+=2)n[g/2]=Number.parseInt($.slice(g,g+2),16);return n}function fw(i){return Array.from(i).map(($)=>$.toString(16).padStart(2,"0")).join("")}class w1{constructor(...i){}}var j1=(i,$)=>{i.name="$ZodError",Object.defineProperty(i,"_zod",{value:i._zod,enumerable:!1}),Object.defineProperty(i,"issues",{value:$,enumerable:!1}),i.message=JSON.stringify($,X$,2),Object.defineProperty(i,"toString",{value:()=>i.message,enumerable:!1})},Ov=w("$ZodError",j1),vi=w("$ZodError",j1,{Parent:Error});function Jv(i,$=(n)=>n.message){let n={},g=[];for(let v of i.issues)if(v.path.length>0)n[v.path[0]]=n[v.path[0]]||[],n[v.path[0]].push($(v));else g.push($(v));return{formErrors:g,fieldErrors:n}}function Pv(i,$=(n)=>n.message){let n={_errors:[]},g=(v,r=[])=>{for(let b of v.issues)if(b.code==="invalid_union"&&b.errors.length)b.errors.map((u)=>g({issues:u},[...r,...b.path]));else if(b.code==="invalid_key")g({issues:b.issues},[...r,...b.path]);else if(b.code==="invalid_element")g({issues:b.issues},[...r,...b.path]);else{let u=[...r,...b.path];if(u.length===0)n._errors.push($(b));else{let U=n,I=0;while(I<u.length){let _=u[I];if(I!==u.length-1)U[_]=U[_]||{_errors:[]};else U[_]=U[_]||{_errors:[]},U[_]._errors.push($(b));U=U[_],I++}}}};return g(i),n}function Rr(i,$=(n)=>n.message){let n={errors:[]},g=(v,r=[])=>{var b,u;for(let U of v.issues)if(U.code==="invalid_union"&&U.errors.length)U.errors.map((I)=>g({issues:I},[...r,...U.path]));else if(U.code==="invalid_key")g({issues:U.issues},[...r,...U.path]);else if(U.code==="invalid_element")g({issues:U.issues},[...r,...U.path]);else{let I=[...r,...U.path];if(I.length===0){n.errors.push($(U));continue}let _=n,k=0;while(k<I.length){let O=I[k],J=k===I.length-1;if(typeof O==="string")_.properties??(_.properties={}),(b=_.properties)[O]??(b[O]={errors:[]}),_=_.properties[O];else _.items??(_.items=[]),(u=_.items)[O]??(u[O]={errors:[]}),_=_.items[O];if(J)_.errors.push($(U));k++}}};return g(i),n}function O1(i){let $=[],n=i.map((g)=>typeof g==="object"?g.key:g);for(let g of n)if(typeof g==="number")$.push(`[${g}]`);else if(typeof g==="symbol")$.push(`[${JSON.stringify(String(g))}]`);else if(/[^\w$]/.test(g))$.push(`[${JSON.stringify(g)}]`);else{if($.length)$.push(".");$.push(g)}return $.join("")}function Fr(i){let $=[],n=[...i.issues].sort((g,v)=>(g.path??[]).length-(v.path??[]).length);for(let g of n)if($.push(`\u2716 ${g.message}`),g.path?.length)$.push(` \u2192 at ${O1(g.path)}`);return $.join(`
4
+ `)}var K$=(i)=>($,n,g,v)=>{let r=g?{...g,async:!1}:{async:!1},b=$._zod.run({value:n,issues:[]},r);if(b instanceof Promise)throw new Oi;if(b.issues.length){let u=new(v?.Err??i)(b.issues.map((U)=>p(U,r,t())));throw Kn(u,v?.callee),u}return b.value},Gn=K$(vi),G$=(i)=>async($,n,g,v)=>{let r=g?{...g,async:!0}:{async:!0},b=$._zod.run({value:n,issues:[]},r);if(b instanceof Promise)b=await b;if(b.issues.length){let u=new(v?.Err??i)(b.issues.map((U)=>p(U,r,t())));throw Kn(u,v?.callee),u}return b.value},Yn=G$(vi),Y$=(i)=>($,n,g)=>{let v=g?{...g,async:!1}:{async:!1},r=$._zod.run({value:n,issues:[]},v);if(r instanceof Promise)throw new Oi;return r.issues.length?{success:!1,error:new(i??Ov)(r.issues.map((b)=>p(b,v,t())))}:{success:!0,data:r.value}},or=Y$(vi),H$=(i)=>async($,n,g)=>{let v=g?{...g,async:!0}:{async:!0},r=$._zod.run({value:n,issues:[]},v);if(r instanceof Promise)r=await r;return r.issues.length?{success:!1,error:new i(r.issues.map((b)=>p(b,v,t())))}:{success:!0,data:r.value}},mr=H$(vi),Hn=(i)=>($,n,g)=>{let v=g?{...g,direction:"backward"}:{direction:"backward"};return K$(i)($,n,v)},Kw=Hn(vi),zn=(i)=>($,n,g)=>{return K$(i)($,n,g)},Gw=zn(vi),Sn=(i)=>async($,n,g)=>{let v=g?{...g,direction:"backward"}:{direction:"backward"};return G$(i)($,n,v)},Yw=Sn(vi),An=(i)=>async($,n,g)=>{return G$(i)($,n,g)},Hw=An(vi),Bn=(i)=>($,n,g)=>{let v=g?{...g,direction:"backward"}:{direction:"backward"};return Y$(i)($,n,v)},zw=Bn(vi),ln=(i)=>($,n,g)=>{return Y$(i)($,n,g)},Sw=ln(vi),Ln=(i)=>async($,n,g)=>{let v=g?{...g,direction:"backward"}:{direction:"backward"};return H$(i)($,n,v)},Aw=Ln(vi),Tn=(i)=>async($,n,g)=>{return H$(i)($,n,g)},Bw=Tn(vi);var ri={};Gi(ri,{xid:()=>ar,uuid7:()=>Zw,uuid6:()=>Tw,uuid4:()=>Lw,uuid:()=>r$,uppercase:()=>fb,unicodeEmail:()=>J1,undefined:()=>Vb,ulid:()=>dr,time:()=>kb,string:()=>jb,sha512_hex:()=>$j,sha512_base64url:()=>nj,sha512_base64:()=>vj,sha384_hex:()=>ew,sha384_base64url:()=>ij,sha384_base64:()=>sw,sha256_hex:()=>dw,sha256_base64url:()=>pw,sha256_base64:()=>aw,sha1_hex:()=>mw,sha1_base64url:()=>hw,sha1_base64:()=>yw,rfc5322Email:()=>Mw,number:()=>Wv,null:()=>Wb,nanoid:()=>er,md5_hex:()=>Rw,md5_base64url:()=>ow,md5_base64:()=>Fw,mac:()=>rb,lowercase:()=>Xb,ksuid:()=>pr,ipv6:()=>gb,ipv4:()=>nb,integer:()=>Jb,idnEmail:()=>xw,httpProtocol:()=>Ib,html5Email:()=>qw,hostname:()=>tw,hex:()=>Cw,guid:()=>ib,extendedDuration:()=>lw,emoji:()=>vb,email:()=>$b,e164:()=>_b,duration:()=>sr,domain:()=>cw,datetime:()=>wb,date:()=>Db,cuid2:()=>hr,cuid:()=>yr,cidrv6:()=>ub,cidrv4:()=>bb,browserEmail:()=>Nw,boolean:()=>Pb,bigint:()=>Ob,base64url:()=>Zn,base64:()=>Ub});var yr=/^[cC][0-9a-z]{6,}$/,hr=/^[0-9a-z]+$/,dr=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ar=/^[0-9a-vA-V]{20}$/,pr=/^[A-Za-z0-9]{27}$/,er=/^[a-zA-Z0-9_-]{21}$/,sr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,lw=/^[-+]?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)?)??$/,ib=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,r$=(i)=>{if(!i)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${i}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},Lw=r$(4),Tw=r$(6),Zw=r$(7),$b=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,qw=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Mw=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,J1=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,xw=J1,Nw=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Ew="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function vb(){return new RegExp(Ew,"u")}var nb=/^(?:(?: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])$/,gb=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,rb=(i)=>{let $=Ui(i??":");return new RegExp(`^(?:[0-9A-F]{2}${$}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${$}){5}[0-9a-f]{2}$`)},bb=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ub=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ub=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Zn=/^[A-Za-z0-9_-]*$/,tw=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,cw=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Ib=/^https?$/,_b=/^\+[1-9]\d{6,14}$/,P1="(?:(?:\\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])))",Db=new RegExp(`^${P1}$`);function W1(i){return typeof i.precision==="number"?i.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":i.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${i.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function kb(i){return new RegExp(`^${W1(i)}$`)}function wb(i){let $=W1({precision:i.precision}),n=["Z"];if(i.local)n.push("");if(i.offset)n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let g=`${$}(?:${n.join("|")})`;return new RegExp(`^${P1}T(?:${g})$`)}var jb=(i)=>{let $=i?`[\\s\\S]{${i?.minimum??0},${i?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${$}$`)},Ob=/^-?\d+n?$/,Jb=/^-?\d+$/,Wv=/^-?\d+(?:\.\d+)?$/,Pb=/^(?:true|false)$/i,Wb=/^null$/i;var Vb=/^undefined$/i;var Xb=/^[^A-Z]*$/,fb=/^[^a-z]*$/,Cw=/^[0-9a-fA-F]*$/;function Vv(i,$){return new RegExp(`^[A-Za-z0-9+/]{${i}}${$}$`)}function Xv(i){return new RegExp(`^[A-Za-z0-9_-]{${i}}$`)}var Rw=/^[0-9a-fA-F]{32}$/,Fw=Vv(22,"=="),ow=Xv(22),mw=/^[0-9a-fA-F]{40}$/,yw=Vv(27,"="),hw=Xv(27),dw=/^[0-9a-fA-F]{64}$/,aw=Vv(43,"="),pw=Xv(43),ew=/^[0-9a-fA-F]{96}$/,sw=Vv(64,""),ij=Xv(64),$j=/^[0-9a-fA-F]{128}$/,vj=Vv(86,"=="),nj=Xv(86);var M=w("$ZodCheck",(i,$)=>{var n;i._zod??(i._zod={}),i._zod.def=$,(n=i._zod).onattach??(n.onattach=[])}),X1={number:"number",bigint:"bigint",object:"date"},qn=w("$ZodCheckLessThan",(i,$)=>{M.init(i,$);let n=X1[typeof $.value];i._zod.onattach.push((g)=>{let v=g._zod.bag,r=($.inclusive?v.maximum:v.exclusiveMaximum)??Number.POSITIVE_INFINITY;if($.value<r)if($.inclusive)v.maximum=$.value;else v.exclusiveMaximum=$.value}),i._zod.check=(g)=>{if($.inclusive?g.value<=$.value:g.value<$.value)return;g.issues.push({origin:n,code:"too_big",maximum:typeof $.value==="object"?$.value.getTime():$.value,input:g.value,inclusive:$.inclusive,inst:i,continue:!$.abort})}}),Mn=w("$ZodCheckGreaterThan",(i,$)=>{M.init(i,$);let n=X1[typeof $.value];i._zod.onattach.push((g)=>{let v=g._zod.bag,r=($.inclusive?v.minimum:v.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if($.value>r)if($.inclusive)v.minimum=$.value;else v.exclusiveMinimum=$.value}),i._zod.check=(g)=>{if($.inclusive?g.value>=$.value:g.value>$.value)return;g.issues.push({origin:n,code:"too_small",minimum:typeof $.value==="object"?$.value.getTime():$.value,input:g.value,inclusive:$.inclusive,inst:i,continue:!$.abort})}}),Qb=w("$ZodCheckMultipleOf",(i,$)=>{M.init(i,$),i._zod.onattach.push((n)=>{var g;(g=n._zod.bag).multipleOf??(g.multipleOf=$.value)}),i._zod.check=(n)=>{if(typeof n.value!==typeof $.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?n.value%$.value===BigInt(0):Zr(n.value,$.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:$.value,input:n.value,inst:i,continue:!$.abort})}}),Kb=w("$ZodCheckNumberFormat",(i,$)=>{M.init(i,$),$.format=$.format||"float64";let n=$.format?.includes("int"),g=n?"int":"number",[v,r]=tr[$.format];i._zod.onattach.push((b)=>{let u=b._zod.bag;if(u.format=$.format,u.minimum=v,u.maximum=r,n)u.pattern=Jb}),i._zod.check=(b)=>{let u=b.value;if(n){if(!Number.isInteger(u)){b.issues.push({expected:g,format:$.format,code:"invalid_type",continue:!1,input:u,inst:i});return}if(!Number.isSafeInteger(u)){if(u>0)b.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:i,origin:g,inclusive:!0,continue:!$.abort});else b.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:i,origin:g,inclusive:!0,continue:!$.abort});return}}if(u<v)b.issues.push({origin:"number",input:u,code:"too_small",minimum:v,inclusive:!0,inst:i,continue:!$.abort});if(u>r)b.issues.push({origin:"number",input:u,code:"too_big",maximum:r,inclusive:!0,inst:i,continue:!$.abort})}}),Gb=w("$ZodCheckBigIntFormat",(i,$)=>{M.init(i,$);let[n,g]=cr[$.format];i._zod.onattach.push((v)=>{let r=v._zod.bag;r.format=$.format,r.minimum=n,r.maximum=g}),i._zod.check=(v)=>{let r=v.value;if(r<n)v.issues.push({origin:"bigint",input:r,code:"too_small",minimum:n,inclusive:!0,inst:i,continue:!$.abort});if(r>g)v.issues.push({origin:"bigint",input:r,code:"too_big",maximum:g,inclusive:!0,inst:i,continue:!$.abort})}}),Yb=w("$ZodCheckMaxSize",(i,$)=>{var n;M.init(i,$),(n=i._zod.def).when??(n.when=(g)=>{let v=g.value;return!ci(v)&&v.size!==void 0}),i._zod.onattach.push((g)=>{let v=g._zod.bag.maximum??Number.POSITIVE_INFINITY;if($.maximum<v)g._zod.bag.maximum=$.maximum}),i._zod.check=(g)=>{let v=g.value;if(v.size<=$.maximum)return;g.issues.push({origin:wv(v),code:"too_big",maximum:$.maximum,inclusive:!0,input:v,inst:i,continue:!$.abort})}}),Hb=w("$ZodCheckMinSize",(i,$)=>{var n;M.init(i,$),(n=i._zod.def).when??(n.when=(g)=>{let v=g.value;return!ci(v)&&v.size!==void 0}),i._zod.onattach.push((g)=>{let v=g._zod.bag.minimum??Number.NEGATIVE_INFINITY;if($.minimum>v)g._zod.bag.minimum=$.minimum}),i._zod.check=(g)=>{let v=g.value;if(v.size>=$.minimum)return;g.issues.push({origin:wv(v),code:"too_small",minimum:$.minimum,inclusive:!0,input:v,inst:i,continue:!$.abort})}}),zb=w("$ZodCheckSizeEquals",(i,$)=>{var n;M.init(i,$),(n=i._zod.def).when??(n.when=(g)=>{let v=g.value;return!ci(v)&&v.size!==void 0}),i._zod.onattach.push((g)=>{let v=g._zod.bag;v.minimum=$.size,v.maximum=$.size,v.size=$.size}),i._zod.check=(g)=>{let v=g.value,r=v.size;if(r===$.size)return;let b=r>$.size;g.issues.push({origin:wv(v),...b?{code:"too_big",maximum:$.size}:{code:"too_small",minimum:$.size},inclusive:!0,exact:!0,input:g.value,inst:i,continue:!$.abort})}}),Sb=w("$ZodCheckMaxLength",(i,$)=>{var n;M.init(i,$),(n=i._zod.def).when??(n.when=(g)=>{let v=g.value;return!ci(v)&&v.length!==void 0}),i._zod.onattach.push((g)=>{let v=g._zod.bag.maximum??Number.POSITIVE_INFINITY;if($.maximum<v)g._zod.bag.maximum=$.maximum}),i._zod.check=(g)=>{let v=g.value;if(v.length<=$.maximum)return;let b=jv(v);g.issues.push({origin:b,code:"too_big",maximum:$.maximum,inclusive:!0,input:v,inst:i,continue:!$.abort})}}),Ab=w("$ZodCheckMinLength",(i,$)=>{var n;M.init(i,$),(n=i._zod.def).when??(n.when=(g)=>{let v=g.value;return!ci(v)&&v.length!==void 0}),i._zod.onattach.push((g)=>{let v=g._zod.bag.minimum??Number.NEGATIVE_INFINITY;if($.minimum>v)g._zod.bag.minimum=$.minimum}),i._zod.check=(g)=>{let v=g.value;if(v.length>=$.minimum)return;let b=jv(v);g.issues.push({origin:b,code:"too_small",minimum:$.minimum,inclusive:!0,input:v,inst:i,continue:!$.abort})}}),Bb=w("$ZodCheckLengthEquals",(i,$)=>{var n;M.init(i,$),(n=i._zod.def).when??(n.when=(g)=>{let v=g.value;return!ci(v)&&v.length!==void 0}),i._zod.onattach.push((g)=>{let v=g._zod.bag;v.minimum=$.length,v.maximum=$.length,v.length=$.length}),i._zod.check=(g)=>{let v=g.value,r=v.length;if(r===$.length)return;let b=jv(v),u=r>$.length;g.issues.push({origin:b,...u?{code:"too_big",maximum:$.length}:{code:"too_small",minimum:$.length},inclusive:!0,exact:!0,input:g.value,inst:i,continue:!$.abort})}}),z$=w("$ZodCheckStringFormat",(i,$)=>{var n,g;if(M.init(i,$),i._zod.onattach.push((v)=>{let r=v._zod.bag;if(r.format=$.format,$.pattern)r.patterns??(r.patterns=new Set),r.patterns.add($.pattern)}),$.pattern)(n=i._zod).check??(n.check=(v)=>{if($.pattern.lastIndex=0,$.pattern.test(v.value))return;v.issues.push({origin:"string",code:"invalid_format",format:$.format,input:v.value,...$.pattern?{pattern:$.pattern.toString()}:{},inst:i,continue:!$.abort})});else(g=i._zod).check??(g.check=()=>{})}),lb=w("$ZodCheckRegex",(i,$)=>{z$.init(i,$),i._zod.check=(n)=>{if($.pattern.lastIndex=0,$.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:$.pattern.toString(),inst:i,continue:!$.abort})}}),Lb=w("$ZodCheckLowerCase",(i,$)=>{$.pattern??($.pattern=Xb),z$.init(i,$)}),Tb=w("$ZodCheckUpperCase",(i,$)=>{$.pattern??($.pattern=fb),z$.init(i,$)}),Zb=w("$ZodCheckIncludes",(i,$)=>{M.init(i,$);let n=Ui($.includes),g=new RegExp(typeof $.position==="number"?`^.{${$.position}}${n}`:n);$.pattern=g,i._zod.onattach.push((v)=>{let r=v._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(g)}),i._zod.check=(v)=>{if(v.value.includes($.includes,$.position))return;v.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:$.includes,input:v.value,inst:i,continue:!$.abort})}}),qb=w("$ZodCheckStartsWith",(i,$)=>{M.init(i,$);let n=new RegExp(`^${Ui($.prefix)}.*`);$.pattern??($.pattern=n),i._zod.onattach.push((g)=>{let v=g._zod.bag;v.patterns??(v.patterns=new Set),v.patterns.add(n)}),i._zod.check=(g)=>{if(g.value.startsWith($.prefix))return;g.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:$.prefix,input:g.value,inst:i,continue:!$.abort})}}),Mb=w("$ZodCheckEndsWith",(i,$)=>{M.init(i,$);let n=new RegExp(`.*${Ui($.suffix)}$`);$.pattern??($.pattern=n),i._zod.onattach.push((g)=>{let v=g._zod.bag;v.patterns??(v.patterns=new Set),v.patterns.add(n)}),i._zod.check=(g)=>{if(g.value.endsWith($.suffix))return;g.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:$.suffix,input:g.value,inst:i,continue:!$.abort})}});function V1(i,$,n){if(i.issues.length)$.issues.push(...$i(n,i.issues))}var xb=w("$ZodCheckProperty",(i,$)=>{M.init(i,$),i._zod.check=(n)=>{let g=$.schema._zod.run({value:n.value[$.property],issues:[]},{});if(g instanceof Promise)return g.then((v)=>V1(v,n,$.property));V1(g,n,$.property);return}}),Nb=w("$ZodCheckMimeType",(i,$)=>{M.init(i,$);let n=new Set($.mime);i._zod.onattach.push((g)=>{g._zod.bag.mime=$.mime}),i._zod.check=(g)=>{if(n.has(g.value.type))return;g.issues.push({code:"invalid_value",values:$.mime,input:g.value.type,inst:i,continue:!$.abort})}}),Eb=w("$ZodCheckOverwrite",(i,$)=>{M.init(i,$),i._zod.check=(n)=>{n.value=$.tx(n.value)}});class xn{constructor(i=[]){if(this.content=[],this.indent=0,this)this.args=i}indented(i){this.indent+=1,i(this),this.indent-=1}write(i){if(typeof i==="function"){i(this,{execution:"sync"}),i(this,{execution:"async"});return}let n=i.split(`
5
5
  `).filter((r)=>r),g=Math.min(...n.map((r)=>r.length-r.trimStart().length)),v=n.map((r)=>r.slice(g)).map((r)=>" ".repeat(this.indent*2)+r);for(let r of v)this.content.push(r)}compile(){let i=Function,$=this?.args,g=[...(this?.content??[""]).map((v)=>` ${v}`)];return new i(...$,g.join(`
6
- `))}}var Eb={major:4,minor:4,patch:3};var Y=w("$ZodType",(i,$)=>{var n;i??(i={}),i._zod.def=$,i._zod.bag=i._zod.bag||{},i._zod.version=Eb;let g=[...i._zod.def.checks??[]];if(i._zod.traits.has("$ZodCheck"))g.unshift(i);for(let v of g)for(let r of v._zod.onattach)r(i);if(g.length===0)(n=i._zod).deferred??(n.deferred=[]),i._zod.deferred?.push(()=>{i._zod.run=i._zod.parse});else{let v=(b,u,I)=>{let U=Fi(b),_;for(let k of u){if(k._zod.def.when){if(Cr(b))continue;if(!k._zod.def.when(b))continue}else if(U)continue;let O=b.issues.length,J=k._zod.check(b);if(J instanceof Promise&&I?.async===!1)throw new Oi;if(_||J instanceof Promise)_=(_??Promise.resolve()).then(async()=>{if(await J,b.issues.length===O)return;if(!U)U=Fi(b,O)});else{if(b.issues.length===O)continue;if(!U)U=Fi(b,O)}}if(_)return _.then(()=>{return b});return b},r=(b,u,I)=>{if(Fi(b))return b.aborted=!0,b;let U=v(u,g,I);if(U instanceof Promise){if(I.async===!1)throw new Oi;return U.then((_)=>i._zod.parse(_,I))}return i._zod.parse(U,I)};i._zod.run=(b,u)=>{if(u.skipChecks)return i._zod.parse(b,u);if(u.direction==="backward"){let U=i._zod.parse({value:b.value,issues:[]},{...u,skipChecks:!0});if(U instanceof Promise)return U.then((_)=>{return r(_,b,u)});return r(U,b,u)}let I=i._zod.parse(b,u);if(I instanceof Promise){if(u.async===!1)throw new Oi;return I.then((U)=>v(U,g,u))}return v(I,g,u)}}S(i,"~standard",()=>({validate:(v)=>{try{let r=or(i,v);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return mr(i,v).then((b)=>b.success?{value:b.data}:{issues:b.error?.issues})}},vendor:"zod",version:1}))}),b$=w("$ZodString",(i,$)=>{Y.init(i,$),i._zod.pattern=[...i?._zod.bag?.patterns??[]].pop()??jb(i._zod.bag),i._zod.parse=(n,g)=>{if($.coerce)try{n.value=String(n.value)}catch(v){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:i}),n}}),Z=w("$ZodStringFormat",(i,$)=>{H$.init(i,$),b$.init(i,$)}),Cb=w("$ZodGUID",(i,$)=>{$.pattern??($.pattern=ib),Z.init(i,$)}),Rb=w("$ZodUUID",(i,$)=>{if($.version){let g={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[$.version];if(g===void 0)throw Error(`Invalid UUID version: "${$.version}"`);$.pattern??($.pattern=r$(g))}else $.pattern??($.pattern=r$());Z.init(i,$)}),Fb=w("$ZodEmail",(i,$)=>{$.pattern??($.pattern=$b),Z.init(i,$)}),ob=w("$ZodURL",(i,$)=>{Z.init(i,$),i._zod.check=(n)=>{try{let g=n.value.trim();if(!$.normalize&&$.protocol?.source===Ib.source){if(!/^https?:\/\//i.test(g)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:i,continue:!$.abort});return}}let v=new URL(g);if($.hostname){if($.hostname.lastIndex=0,!$.hostname.test(v.hostname))n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:$.hostname.source,input:n.value,inst:i,continue:!$.abort})}if($.protocol){if($.protocol.lastIndex=0,!$.protocol.test(v.protocol.endsWith(":")?v.protocol.slice(0,-1):v.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:$.protocol.source,input:n.value,inst:i,continue:!$.abort})}if($.normalize)n.value=v.href;else n.value=g;return}catch(g){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:i,continue:!$.abort})}}}),mb=w("$ZodEmoji",(i,$)=>{$.pattern??($.pattern=vb()),Z.init(i,$)}),yb=w("$ZodNanoID",(i,$)=>{$.pattern??($.pattern=er),Z.init(i,$)}),hb=w("$ZodCUID",(i,$)=>{$.pattern??($.pattern=yr),Z.init(i,$)}),db=w("$ZodCUID2",(i,$)=>{$.pattern??($.pattern=hr),Z.init(i,$)}),ab=w("$ZodULID",(i,$)=>{$.pattern??($.pattern=dr),Z.init(i,$)}),pb=w("$ZodXID",(i,$)=>{$.pattern??($.pattern=ar),Z.init(i,$)}),eb=w("$ZodKSUID",(i,$)=>{$.pattern??($.pattern=pr),Z.init(i,$)}),sb=w("$ZodISODateTime",(i,$)=>{$.pattern??($.pattern=wb($)),Z.init(i,$)}),i4=w("$ZodISODate",(i,$)=>{$.pattern??($.pattern=Db),Z.init(i,$)}),$4=w("$ZodISOTime",(i,$)=>{$.pattern??($.pattern=kb($)),Z.init(i,$)}),v4=w("$ZodISODuration",(i,$)=>{$.pattern??($.pattern=sr),Z.init(i,$)}),n4=w("$ZodIPv4",(i,$)=>{$.pattern??($.pattern=nb),Z.init(i,$),i._zod.bag.format="ipv4"}),g4=w("$ZodIPv6",(i,$)=>{$.pattern??($.pattern=gb),Z.init(i,$),i._zod.bag.format="ipv6",i._zod.check=(n)=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:i,continue:!$.abort})}}}),r4=w("$ZodMAC",(i,$)=>{$.pattern??($.pattern=rb($.delimiter)),Z.init(i,$),i._zod.bag.format="mac"}),b4=w("$ZodCIDRv4",(i,$)=>{$.pattern??($.pattern=bb),Z.init(i,$)}),u4=w("$ZodCIDRv6",(i,$)=>{$.pattern??($.pattern=ub),Z.init(i,$),i._zod.check=(n)=>{let g=n.value.split("/");try{if(g.length!==2)throw Error();let[v,r]=g;if(!r)throw Error();let b=Number(r);if(`${b}`!==r)throw Error();if(b<0||b>128)throw Error();new URL(`http://[${v}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:i,continue:!$.abort})}}});function U4(i){if(i==="")return!0;if(/\s/.test(i))return!1;if(i.length%4!==0)return!1;try{return atob(i),!0}catch{return!1}}var I4=w("$ZodBase64",(i,$)=>{$.pattern??($.pattern=Ub),Z.init(i,$),i._zod.bag.contentEncoding="base64",i._zod.check=(n)=>{if(U4(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:i,continue:!$.abort})}});function M1(i){if(!Zn.test(i))return!1;let $=i.replace(/[-_]/g,(g)=>g==="-"?"+":"/"),n=$.padEnd(Math.ceil($.length/4)*4,"=");return U4(n)}var _4=w("$ZodBase64URL",(i,$)=>{$.pattern??($.pattern=Zn),Z.init(i,$),i._zod.bag.contentEncoding="base64url",i._zod.check=(n)=>{if(M1(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:i,continue:!$.abort})}}),D4=w("$ZodE164",(i,$)=>{$.pattern??($.pattern=_b),Z.init(i,$)});function x1(i,$=null){try{let n=i.split(".");if(n.length!==3)return!1;let[g]=n;if(!g)return!1;let v=JSON.parse(atob(g));if("typ"in v&&v?.typ!=="JWT")return!1;if(!v.alg)return!1;if($&&(!("alg"in v)||v.alg!==$))return!1;return!0}catch{return!1}}var k4=w("$ZodJWT",(i,$)=>{Z.init(i,$),i._zod.check=(n)=>{if(x1(n.value,$.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:i,continue:!$.abort})}}),w4=w("$ZodCustomStringFormat",(i,$)=>{Z.init(i,$),i._zod.check=(n)=>{if($.fn(n.value))return;n.issues.push({code:"invalid_format",format:$.format,input:n.value,inst:i,continue:!$.abort})}}),Cn=w("$ZodNumber",(i,$)=>{Y.init(i,$),i._zod.pattern=i._zod.bag.pattern??Wv,i._zod.parse=(n,g)=>{if($.coerce)try{n.value=Number(n.value)}catch(b){}let v=n.value;if(typeof v==="number"&&!Number.isNaN(v)&&Number.isFinite(v))return n;let r=typeof v==="number"?Number.isNaN(v)?"NaN":!Number.isFinite(v)?"Infinity":void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:v,inst:i,...r?{received:r}:{}}),n}}),j4=w("$ZodNumberFormat",(i,$)=>{Kb.init(i,$),Cn.init(i,$)}),fv=w("$ZodBoolean",(i,$)=>{Y.init(i,$),i._zod.pattern=Pb,i._zod.parse=(n,g)=>{if($.coerce)try{n.value=Boolean(n.value)}catch(r){}let v=n.value;if(typeof v==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:v,inst:i}),n}}),Rn=w("$ZodBigInt",(i,$)=>{Y.init(i,$),i._zod.pattern=Ob,i._zod.parse=(n,g)=>{if($.coerce)try{n.value=BigInt(n.value)}catch(v){}if(typeof n.value==="bigint")return n;return n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:i}),n}}),O4=w("$ZodBigIntFormat",(i,$)=>{Gb.init(i,$),Rn.init(i,$)}),J4=w("$ZodSymbol",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{let v=n.value;if(typeof v==="symbol")return n;return n.issues.push({expected:"symbol",code:"invalid_type",input:v,inst:i}),n}}),P4=w("$ZodUndefined",(i,$)=>{Y.init(i,$),i._zod.pattern=Vb,i._zod.values=new Set([void 0]),i._zod.parse=(n,g)=>{let v=n.value;if(typeof v>"u")return n;return n.issues.push({expected:"undefined",code:"invalid_type",input:v,inst:i}),n}}),W4=w("$ZodNull",(i,$)=>{Y.init(i,$),i._zod.pattern=Wb,i._zod.values=new Set([null]),i._zod.parse=(n,g)=>{let v=n.value;if(v===null)return n;return n.issues.push({expected:"null",code:"invalid_type",input:v,inst:i}),n}}),V4=w("$ZodAny",(i,$)=>{Y.init(i,$),i._zod.parse=(n)=>n}),X4=w("$ZodUnknown",(i,$)=>{Y.init(i,$),i._zod.parse=(n)=>n}),f4=w("$ZodNever",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{return n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:i}),n}}),Q4=w("$ZodVoid",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{let v=n.value;if(typeof v>"u")return n;return n.issues.push({expected:"void",code:"invalid_type",input:v,inst:i}),n}}),K4=w("$ZodDate",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{if($.coerce)try{n.value=new Date(n.value)}catch(u){}let v=n.value,r=v instanceof Date;if(r&&!Number.isNaN(v.getTime()))return n;return n.issues.push({expected:"date",code:"invalid_type",input:v,...r?{received:"Invalid Date"}:{},inst:i}),n}});function Q1(i,$,n){if(i.issues.length)$.issues.push(...$i(n,i.issues));$.value[n]=i.value}var G4=w("$ZodArray",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{let v=n.value;if(!Array.isArray(v))return n.issues.push({expected:"array",code:"invalid_type",input:v,inst:i}),n;n.value=Array(v.length);let r=[];for(let b=0;b<v.length;b++){let u=v[b],I=$.element._zod.run({value:u,issues:[]},g);if(I instanceof Promise)r.push(I.then((U)=>Q1(U,n,b)));else Q1(I,n,b)}if(r.length)return Promise.all(r).then(()=>n);return n}});function cn(i,$,n,g,v,r){let b=n in g;if(i.issues.length){if(v&&r&&!b)return;$.issues.push(...$i(n,i.issues))}if(!b&&!v){if(!i.issues.length)$.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}if(i.value===void 0){if(b)$.value[n]=void 0}else $.value[n]=i.value}function N1(i){let $=Object.keys(i.shape);for(let g of $)if(!i.shape?.[g]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${g}": expected a Zod schema`);let n=tr(i.shape);return{...i,keys:$,keySet:new Set($),numKeys:$.length,optionalKeys:new Set(n)}}function t1(i,$,n,g,v,r){let b=[],u=v.keySet,I=v.catchall._zod,U=I.def.type,_=I.optin==="optional",k=I.optout==="optional";for(let O in $){if(O==="__proto__")continue;if(u.has(O))continue;if(U==="never"){b.push(O);continue}let J=I.run({value:$[O],issues:[]},g);if(J instanceof Promise)i.push(J.then((Q)=>cn(Q,n,O,$,_,k)));else cn(J,n,O,$,_,k)}if(b.length)n.issues.push({code:"unrecognized_keys",keys:b,input:$,inst:r});if(!i.length)return n;return Promise.all(i).then(()=>{return n})}var E1=w("$ZodObject",(i,$)=>{if(Y.init(i,$),!Object.getOwnPropertyDescriptor($,"shape")?.get){let u=$.shape;Object.defineProperty($,"shape",{get:()=>{let I={...u};return Object.defineProperty($,"shape",{value:I}),I}})}let g=X$(()=>N1($));S(i._zod,"propValues",()=>{let u=$.shape,I={};for(let U in u){let _=u[U]._zod;if(_.values){I[U]??(I[U]=new Set);for(let k of _.values)I[U].add(k)}}return I});let v=g$,r=$.catchall,b;i._zod.parse=(u,I)=>{b??(b=g.value);let U=u.value;if(!v(U))return u.issues.push({expected:"object",code:"invalid_type",input:U,inst:i}),u;u.value={};let _=[],k=b.shape;for(let O of b.keys){let J=k[O],Q=J._zod.optin==="optional",A=J._zod.optout==="optional",z=J._zod.run({value:U[O],issues:[]},I);if(z instanceof Promise)_.push(z.then((l)=>cn(l,u,O,U,Q,A)));else cn(z,u,O,U,Q,A)}if(!r)return _.length?Promise.all(_).then(()=>u):u;return t1(_,U,u,I,g.value,i)}}),Y4=w("$ZodObjectJIT",(i,$)=>{E1.init(i,$);let n=i._zod.parse,g=X$(()=>N1($)),v=(O)=>{let J=new xn(["shape","payload","ctx"]),Q=g.value,A=(y)=>{let N=Qn(y);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};J.write("const input = payload.value;");let z=Object.create(null),l=0;for(let y of Q.keys)z[y]=`key_${l++}`;J.write("const newResult = {};");for(let y of Q.keys){let N=z[y],C=Qn(y),ui=O[y],Wn=ui?._zod?.optin==="optional",Vn=ui?._zod?.optout==="optional";if(J.write(`const ${N} = ${A(y)};`),Wn&&Vn)J.write(`
6
+ `))}}var tb={major:4,minor:4,patch:3};var Y=w("$ZodType",(i,$)=>{var n;i??(i={}),i._zod.def=$,i._zod.bag=i._zod.bag||{},i._zod.version=tb;let g=[...i._zod.def.checks??[]];if(i._zod.traits.has("$ZodCheck"))g.unshift(i);for(let v of g)for(let r of v._zod.onattach)r(i);if(g.length===0)(n=i._zod).deferred??(n.deferred=[]),i._zod.deferred?.push(()=>{i._zod.run=i._zod.parse});else{let v=(b,u,U)=>{let I=Fi(b),_;for(let k of u){if(k._zod.def.when){if(Cr(b))continue;if(!k._zod.def.when(b))continue}else if(I)continue;let O=b.issues.length,J=k._zod.check(b);if(J instanceof Promise&&U?.async===!1)throw new Oi;if(_||J instanceof Promise)_=(_??Promise.resolve()).then(async()=>{if(await J,b.issues.length===O)return;if(!I)I=Fi(b,O)});else{if(b.issues.length===O)continue;if(!I)I=Fi(b,O)}}if(_)return _.then(()=>{return b});return b},r=(b,u,U)=>{if(Fi(b))return b.aborted=!0,b;let I=v(u,g,U);if(I instanceof Promise){if(U.async===!1)throw new Oi;return I.then((_)=>i._zod.parse(_,U))}return i._zod.parse(I,U)};i._zod.run=(b,u)=>{if(u.skipChecks)return i._zod.parse(b,u);if(u.direction==="backward"){let I=i._zod.parse({value:b.value,issues:[]},{...u,skipChecks:!0});if(I instanceof Promise)return I.then((_)=>{return r(_,b,u)});return r(I,b,u)}let U=i._zod.parse(b,u);if(U instanceof Promise){if(u.async===!1)throw new Oi;return U.then((I)=>v(I,g,u))}return v(U,g,u)}}S(i,"~standard",()=>({validate:(v)=>{try{let r=or(i,v);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return mr(i,v).then((b)=>b.success?{value:b.data}:{issues:b.error?.issues})}},vendor:"zod",version:1}))}),b$=w("$ZodString",(i,$)=>{Y.init(i,$),i._zod.pattern=[...i?._zod.bag?.patterns??[]].pop()??jb(i._zod.bag),i._zod.parse=(n,g)=>{if($.coerce)try{n.value=String(n.value)}catch(v){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:i}),n}}),Z=w("$ZodStringFormat",(i,$)=>{z$.init(i,$),b$.init(i,$)}),Cb=w("$ZodGUID",(i,$)=>{$.pattern??($.pattern=ib),Z.init(i,$)}),Rb=w("$ZodUUID",(i,$)=>{if($.version){let g={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[$.version];if(g===void 0)throw Error(`Invalid UUID version: "${$.version}"`);$.pattern??($.pattern=r$(g))}else $.pattern??($.pattern=r$());Z.init(i,$)}),Fb=w("$ZodEmail",(i,$)=>{$.pattern??($.pattern=$b),Z.init(i,$)}),ob=w("$ZodURL",(i,$)=>{Z.init(i,$),i._zod.check=(n)=>{try{let g=n.value.trim();if(!$.normalize&&$.protocol?.source===Ib.source){if(!/^https?:\/\//i.test(g)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:i,continue:!$.abort});return}}let v=new URL(g);if($.hostname){if($.hostname.lastIndex=0,!$.hostname.test(v.hostname))n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:$.hostname.source,input:n.value,inst:i,continue:!$.abort})}if($.protocol){if($.protocol.lastIndex=0,!$.protocol.test(v.protocol.endsWith(":")?v.protocol.slice(0,-1):v.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:$.protocol.source,input:n.value,inst:i,continue:!$.abort})}if($.normalize)n.value=v.href;else n.value=g;return}catch(g){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:i,continue:!$.abort})}}}),mb=w("$ZodEmoji",(i,$)=>{$.pattern??($.pattern=vb()),Z.init(i,$)}),yb=w("$ZodNanoID",(i,$)=>{$.pattern??($.pattern=er),Z.init(i,$)}),hb=w("$ZodCUID",(i,$)=>{$.pattern??($.pattern=yr),Z.init(i,$)}),db=w("$ZodCUID2",(i,$)=>{$.pattern??($.pattern=hr),Z.init(i,$)}),ab=w("$ZodULID",(i,$)=>{$.pattern??($.pattern=dr),Z.init(i,$)}),pb=w("$ZodXID",(i,$)=>{$.pattern??($.pattern=ar),Z.init(i,$)}),eb=w("$ZodKSUID",(i,$)=>{$.pattern??($.pattern=pr),Z.init(i,$)}),sb=w("$ZodISODateTime",(i,$)=>{$.pattern??($.pattern=wb($)),Z.init(i,$)}),i4=w("$ZodISODate",(i,$)=>{$.pattern??($.pattern=Db),Z.init(i,$)}),$4=w("$ZodISOTime",(i,$)=>{$.pattern??($.pattern=kb($)),Z.init(i,$)}),v4=w("$ZodISODuration",(i,$)=>{$.pattern??($.pattern=sr),Z.init(i,$)}),n4=w("$ZodIPv4",(i,$)=>{$.pattern??($.pattern=nb),Z.init(i,$),i._zod.bag.format="ipv4"}),g4=w("$ZodIPv6",(i,$)=>{$.pattern??($.pattern=gb),Z.init(i,$),i._zod.bag.format="ipv6",i._zod.check=(n)=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:i,continue:!$.abort})}}}),r4=w("$ZodMAC",(i,$)=>{$.pattern??($.pattern=rb($.delimiter)),Z.init(i,$),i._zod.bag.format="mac"}),b4=w("$ZodCIDRv4",(i,$)=>{$.pattern??($.pattern=bb),Z.init(i,$)}),u4=w("$ZodCIDRv6",(i,$)=>{$.pattern??($.pattern=ub),Z.init(i,$),i._zod.check=(n)=>{let g=n.value.split("/");try{if(g.length!==2)throw Error();let[v,r]=g;if(!r)throw Error();let b=Number(r);if(`${b}`!==r)throw Error();if(b<0||b>128)throw Error();new URL(`http://[${v}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:i,continue:!$.abort})}}});function U4(i){if(i==="")return!0;if(/\s/.test(i))return!1;if(i.length%4!==0)return!1;try{return atob(i),!0}catch{return!1}}var I4=w("$ZodBase64",(i,$)=>{$.pattern??($.pattern=Ub),Z.init(i,$),i._zod.bag.contentEncoding="base64",i._zod.check=(n)=>{if(U4(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:i,continue:!$.abort})}});function M1(i){if(!Zn.test(i))return!1;let $=i.replace(/[-_]/g,(g)=>g==="-"?"+":"/"),n=$.padEnd(Math.ceil($.length/4)*4,"=");return U4(n)}var _4=w("$ZodBase64URL",(i,$)=>{$.pattern??($.pattern=Zn),Z.init(i,$),i._zod.bag.contentEncoding="base64url",i._zod.check=(n)=>{if(M1(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:i,continue:!$.abort})}}),D4=w("$ZodE164",(i,$)=>{$.pattern??($.pattern=_b),Z.init(i,$)});function x1(i,$=null){try{let n=i.split(".");if(n.length!==3)return!1;let[g]=n;if(!g)return!1;let v=JSON.parse(atob(g));if("typ"in v&&v?.typ!=="JWT")return!1;if(!v.alg)return!1;if($&&(!("alg"in v)||v.alg!==$))return!1;return!0}catch{return!1}}var k4=w("$ZodJWT",(i,$)=>{Z.init(i,$),i._zod.check=(n)=>{if(x1(n.value,$.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:i,continue:!$.abort})}}),w4=w("$ZodCustomStringFormat",(i,$)=>{Z.init(i,$),i._zod.check=(n)=>{if($.fn(n.value))return;n.issues.push({code:"invalid_format",format:$.format,input:n.value,inst:i,continue:!$.abort})}}),Cn=w("$ZodNumber",(i,$)=>{Y.init(i,$),i._zod.pattern=i._zod.bag.pattern??Wv,i._zod.parse=(n,g)=>{if($.coerce)try{n.value=Number(n.value)}catch(b){}let v=n.value;if(typeof v==="number"&&!Number.isNaN(v)&&Number.isFinite(v))return n;let r=typeof v==="number"?Number.isNaN(v)?"NaN":!Number.isFinite(v)?"Infinity":void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:v,inst:i,...r?{received:r}:{}}),n}}),j4=w("$ZodNumberFormat",(i,$)=>{Kb.init(i,$),Cn.init(i,$)}),fv=w("$ZodBoolean",(i,$)=>{Y.init(i,$),i._zod.pattern=Pb,i._zod.parse=(n,g)=>{if($.coerce)try{n.value=Boolean(n.value)}catch(r){}let v=n.value;if(typeof v==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:v,inst:i}),n}}),Rn=w("$ZodBigInt",(i,$)=>{Y.init(i,$),i._zod.pattern=Ob,i._zod.parse=(n,g)=>{if($.coerce)try{n.value=BigInt(n.value)}catch(v){}if(typeof n.value==="bigint")return n;return n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:i}),n}}),O4=w("$ZodBigIntFormat",(i,$)=>{Gb.init(i,$),Rn.init(i,$)}),J4=w("$ZodSymbol",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{let v=n.value;if(typeof v==="symbol")return n;return n.issues.push({expected:"symbol",code:"invalid_type",input:v,inst:i}),n}}),P4=w("$ZodUndefined",(i,$)=>{Y.init(i,$),i._zod.pattern=Vb,i._zod.values=new Set([void 0]),i._zod.parse=(n,g)=>{let v=n.value;if(typeof v>"u")return n;return n.issues.push({expected:"undefined",code:"invalid_type",input:v,inst:i}),n}}),W4=w("$ZodNull",(i,$)=>{Y.init(i,$),i._zod.pattern=Wb,i._zod.values=new Set([null]),i._zod.parse=(n,g)=>{let v=n.value;if(v===null)return n;return n.issues.push({expected:"null",code:"invalid_type",input:v,inst:i}),n}}),V4=w("$ZodAny",(i,$)=>{Y.init(i,$),i._zod.parse=(n)=>n}),X4=w("$ZodUnknown",(i,$)=>{Y.init(i,$),i._zod.parse=(n)=>n}),f4=w("$ZodNever",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{return n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:i}),n}}),Q4=w("$ZodVoid",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{let v=n.value;if(typeof v>"u")return n;return n.issues.push({expected:"void",code:"invalid_type",input:v,inst:i}),n}}),K4=w("$ZodDate",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{if($.coerce)try{n.value=new Date(n.value)}catch(u){}let v=n.value,r=v instanceof Date;if(r&&!Number.isNaN(v.getTime()))return n;return n.issues.push({expected:"date",code:"invalid_type",input:v,...r?{received:"Invalid Date"}:{},inst:i}),n}});function Q1(i,$,n){if(i.issues.length)$.issues.push(...$i(n,i.issues));$.value[n]=i.value}var G4=w("$ZodArray",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{let v=n.value;if(!Array.isArray(v))return n.issues.push({expected:"array",code:"invalid_type",input:v,inst:i}),n;n.value=Array(v.length);let r=[];for(let b=0;b<v.length;b++){let u=v[b],U=$.element._zod.run({value:u,issues:[]},g);if(U instanceof Promise)r.push(U.then((I)=>Q1(I,n,b)));else Q1(U,n,b)}if(r.length)return Promise.all(r).then(()=>n);return n}});function cn(i,$,n,g,v,r){let b=n in g;if(i.issues.length){if(v&&r&&!b)return;$.issues.push(...$i(n,i.issues))}if(!b&&!v){if(!i.issues.length)$.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}if(i.value===void 0){if(b)$.value[n]=void 0}else $.value[n]=i.value}function N1(i){let $=Object.keys(i.shape);for(let g of $)if(!i.shape?.[g]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${g}": expected a Zod schema`);let n=Er(i.shape);return{...i,keys:$,keySet:new Set($),numKeys:$.length,optionalKeys:new Set(n)}}function E1(i,$,n,g,v,r){let b=[],u=v.keySet,U=v.catchall._zod,I=U.def.type,_=U.optin==="optional",k=U.optout==="optional";for(let O in $){if(O==="__proto__")continue;if(u.has(O))continue;if(I==="never"){b.push(O);continue}let J=U.run({value:$[O],issues:[]},g);if(J instanceof Promise)i.push(J.then((Q)=>cn(Q,n,O,$,_,k)));else cn(J,n,O,$,_,k)}if(b.length)n.issues.push({code:"unrecognized_keys",keys:b,input:$,inst:r});if(!i.length)return n;return Promise.all(i).then(()=>{return n})}var t1=w("$ZodObject",(i,$)=>{if(Y.init(i,$),!Object.getOwnPropertyDescriptor($,"shape")?.get){let u=$.shape;Object.defineProperty($,"shape",{get:()=>{let U={...u};return Object.defineProperty($,"shape",{value:U}),U}})}let g=f$(()=>N1($));S(i._zod,"propValues",()=>{let u=$.shape,U={};for(let I in u){let _=u[I]._zod;if(_.values){U[I]??(U[I]=new Set);for(let k of _.values)U[I].add(k)}}return U});let v=g$,r=$.catchall,b;i._zod.parse=(u,U)=>{b??(b=g.value);let I=u.value;if(!v(I))return u.issues.push({expected:"object",code:"invalid_type",input:I,inst:i}),u;u.value={};let _=[],k=b.shape;for(let O of b.keys){let J=k[O],Q=J._zod.optin==="optional",A=J._zod.optout==="optional",z=J._zod.run({value:I[O],issues:[]},U);if(z instanceof Promise)_.push(z.then((B)=>cn(B,u,O,I,Q,A)));else cn(z,u,O,I,Q,A)}if(!r)return _.length?Promise.all(_).then(()=>u):u;return E1(_,I,u,U,g.value,i)}}),Y4=w("$ZodObjectJIT",(i,$)=>{t1.init(i,$);let n=i._zod.parse,g=f$(()=>N1($)),v=(O)=>{let J=new xn(["shape","payload","ctx"]),Q=g.value,A=(y)=>{let N=Qn(y);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};J.write("const input = payload.value;");let z=Object.create(null),B=0;for(let y of Q.keys)z[y]=`key_${B++}`;J.write("const newResult = {};");for(let y of Q.keys){let N=z[y],C=Qn(y),ui=O[y],Wn=ui?._zod?.optin==="optional",Vn=ui?._zod?.optout==="optional";if(J.write(`const ${N} = ${A(y)};`),Wn&&Vn)J.write(`
7
7
  if (${N}.issues.length) {
8
8
  if (${C} in input) {
9
9
  payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
@@ -62,18 +62,18 @@ var tw=Object.create;var{getPrototypeOf:Ew,defineProperty:Ar,getOwnPropertyNames
62
62
  newResult[${C}] = ${N}.value;
63
63
  }
64
64
 
65
- `)}J.write("payload.value = newResult;"),J.write("return payload;");let Ii=J.compile();return(y,N)=>Ii(O,y,N)},r,b=g$,u=!v$.jitless,U=u&&Mr.value,_=$.catchall,k;i._zod.parse=(O,J)=>{k??(k=g.value);let Q=O.value;if(!b(Q))return O.issues.push({expected:"object",code:"invalid_type",input:Q,inst:i}),O;if(u&&U&&J?.async===!1&&J.jitless!==!0){if(!r)r=v($.shape);if(O=r(O,J),!_)return O;return t1([],Q,O,J,k,i)}return n(O,J)}});function K1(i,$,n,g){for(let r of i)if(r.issues.length===0)return $.value=r.value,$;let v=i.filter((r)=>!Fi(r));if(v.length===1)return $.value=v[0].value,v[0];return $.issues.push({code:"invalid_union",input:$.value,inst:n,errors:i.map((r)=>r.issues.map((b)=>p(b,g,E())))}),$}var Qv=w("$ZodUnion",(i,$)=>{Y.init(i,$),S(i._zod,"optin",()=>$.options.some((g)=>g._zod.optin==="optional")?"optional":void 0),S(i._zod,"optout",()=>$.options.some((g)=>g._zod.optout==="optional")?"optional":void 0),S(i._zod,"values",()=>{if($.options.every((g)=>g._zod.values))return new Set($.options.flatMap((g)=>Array.from(g._zod.values)));return}),S(i._zod,"pattern",()=>{if($.options.every((g)=>g._zod.pattern)){let g=$.options.map((v)=>v._zod.pattern);return new RegExp(`^(${g.map((v)=>Dv(v.source)).join("|")})$`)}return});let n=$.options.length===1?$.options[0]._zod.run:null;i._zod.parse=(g,v)=>{if(n)return n(g,v);let r=!1,b=[];for(let u of $.options){let I=u._zod.run({value:g.value,issues:[]},v);if(I instanceof Promise)b.push(I),r=!0;else{if(I.issues.length===0)return I;b.push(I)}}if(!r)return K1(b,g,i,v);return Promise.all(b).then((u)=>{return K1(u,g,i,v)})}});function G1(i,$,n,g){let v=i.filter((r)=>r.issues.length===0);if(v.length===1)return $.value=v[0].value,$;if(v.length===0)$.issues.push({code:"invalid_union",input:$.value,inst:n,errors:i.map((r)=>r.issues.map((b)=>p(b,g,E())))});else $.issues.push({code:"invalid_union",input:$.value,inst:n,errors:[],inclusive:!1});return $}var H4=w("$ZodXor",(i,$)=>{Qv.init(i,$),$.inclusive=!1;let n=$.options.length===1?$.options[0]._zod.run:null;i._zod.parse=(g,v)=>{if(n)return n(g,v);let r=!1,b=[];for(let u of $.options){let I=u._zod.run({value:g.value,issues:[]},v);if(I instanceof Promise)b.push(I),r=!0;else b.push(I)}if(!r)return G1(b,g,i,v);return Promise.all(b).then((u)=>{return G1(u,g,i,v)})}}),z4=w("$ZodDiscriminatedUnion",(i,$)=>{$.inclusive=!1,Qv.init(i,$);let n=i._zod.parse;S(i._zod,"propValues",()=>{let v={};for(let r of $.options){let b=r._zod.propValues;if(!b||Object.keys(b).length===0)throw Error(`Invalid discriminated union option at index "${$.options.indexOf(r)}"`);for(let[u,I]of Object.entries(b)){if(!v[u])v[u]=new Set;for(let U of I)v[u].add(U)}}return v});let g=X$(()=>{let v=$.options,r=new Map;for(let b of v){let u=b._zod.propValues?.[$.discriminator];if(!u||u.size===0)throw Error(`Invalid discriminated union option at index "${$.options.indexOf(b)}"`);for(let I of u){if(r.has(I))throw Error(`Duplicate discriminator value "${String(I)}"`);r.set(I,b)}}return r});i._zod.parse=(v,r)=>{let b=v.value;if(!g$(b))return v.issues.push({code:"invalid_type",expected:"object",input:b,inst:i}),v;let u=g.value.get(b?.[$.discriminator]);if(u)return u._zod.run(v,r);if($.unionFallback||r.direction==="backward")return n(v,r);return v.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:$.discriminator,options:Array.from(g.value.keys()),input:b,path:[$.discriminator],inst:i}),v}}),S4=w("$ZodIntersection",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{let v=n.value,r=$.left._zod.run({value:v,issues:[]},g),b=$.right._zod.run({value:v,issues:[]},g);if(r instanceof Promise||b instanceof Promise)return Promise.all([r,b]).then(([I,U])=>{return Y1(n,I,U)});return Y1(n,r,b)}});function cb(i,$){if(i===$)return{valid:!0,data:i};if(i instanceof Date&&$ instanceof Date&&+i===+$)return{valid:!0,data:i};if(Ri(i)&&Ri($)){let n=Object.keys($),g=Object.keys(i).filter((r)=>n.indexOf(r)!==-1),v={...i,...$};for(let r of g){let b=cb(i[r],$[r]);if(!b.valid)return{valid:!1,mergeErrorPath:[r,...b.mergeErrorPath]};v[r]=b.data}return{valid:!0,data:v}}if(Array.isArray(i)&&Array.isArray($)){if(i.length!==$.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let g=0;g<i.length;g++){let v=i[g],r=$[g],b=cb(v,r);if(!b.valid)return{valid:!1,mergeErrorPath:[g,...b.mergeErrorPath]};n.push(b.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Y1(i,$,n){let g=new Map,v;for(let u of $.issues)if(u.code==="unrecognized_keys"){v??(v=u);for(let I of u.keys){if(!g.has(I))g.set(I,{});g.get(I).l=!0}}else i.issues.push(u);for(let u of n.issues)if(u.code==="unrecognized_keys")for(let I of u.keys){if(!g.has(I))g.set(I,{});g.get(I).r=!0}else i.issues.push(u);let r=[...g].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(r.length&&v)i.issues.push({...v,keys:r});if(Fi(i))return i;let b=cb($.value,n.value);if(!b.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(b.mergeErrorPath)}`);return i.value=b.data,i}var Fn=w("$ZodTuple",(i,$)=>{Y.init(i,$);let n=$.items;i._zod.parse=(g,v)=>{let r=g.value;if(!Array.isArray(r))return g.issues.push({input:r,inst:i,expected:"tuple",code:"invalid_type"}),g;g.value=[];let b=[],u=H1(n,"optin"),I=H1(n,"optout");if(!$.rest){if(r.length<u)return g.issues.push({code:"too_small",minimum:u,inclusive:!0,input:r,inst:i,origin:"array"}),g;if(r.length>n.length)g.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:r,inst:i,origin:"array"})}let U=Array(n.length);for(let _=0;_<n.length;_++){let k=n[_]._zod.run({value:r[_],issues:[]},v);if(k instanceof Promise)b.push(k.then((O)=>{U[_]=O}));else U[_]=k}if($.rest){let _=n.length-1,k=r.slice(n.length);for(let O of k){_++;let J=$.rest._zod.run({value:O,issues:[]},v);if(J instanceof Promise)b.push(J.then((Q)=>z1(Q,g,_)));else z1(J,g,_)}}if(b.length)return Promise.all(b).then(()=>S1(U,g,n,r,I));return S1(U,g,n,r,I)}});function H1(i,$){for(let n=i.length-1;n>=0;n--)if(i[n]._zod[$]!=="optional")return n+1;return 0}function z1(i,$,n){if(i.issues.length)$.issues.push(...$i(n,i.issues));$.value[n]=i.value}function S1(i,$,n,g,v){for(let r=0;r<n.length;r++){let b=i[r],u=r<g.length;if(b.issues.length){if(!u&&r>=v){$.value.length=r;break}$.issues.push(...$i(r,b.issues))}$.value[r]=b.value}for(let r=$.value.length-1;r>=g.length;r--)if(n[r]._zod.optout==="optional"&&$.value[r]===void 0)$.value.length=r;else break;return $}var A4=w("$ZodRecord",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{let v=n.value;if(!Ri(v))return n.issues.push({expected:"record",code:"invalid_type",input:v,inst:i}),n;let r=[],b=$.keyType._zod.values;if(b){n.value={};let u=new Set;for(let U of b)if(typeof U==="string"||typeof U==="number"||typeof U==="symbol"){u.add(typeof U==="number"?U.toString():U);let _=$.keyType._zod.run({value:U,issues:[]},g);if(_ instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(_.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:_.issues.map((J)=>p(J,g,E())),input:U,path:[U],inst:i});continue}let k=_.value,O=$.valueType._zod.run({value:v[U],issues:[]},g);if(O instanceof Promise)r.push(O.then((J)=>{if(J.issues.length)n.issues.push(...$i(U,J.issues));n.value[k]=J.value}));else{if(O.issues.length)n.issues.push(...$i(U,O.issues));n.value[k]=O.value}}let I;for(let U in v)if(!u.has(U))I=I??[],I.push(U);if(I&&I.length>0)n.issues.push({code:"unrecognized_keys",input:v,inst:i,keys:I})}else{n.value={};for(let u of Reflect.ownKeys(v)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(v,u))continue;let I=$.keyType._zod.run({value:u,issues:[]},g);if(I instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&Wv.test(u)&&I.issues.length){let k=$.keyType._zod.run({value:Number(u),issues:[]},g);if(k instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(k.issues.length===0)I=k}if(I.issues.length){if($.mode==="loose")n.value[u]=v[u];else n.issues.push({code:"invalid_key",origin:"record",issues:I.issues.map((k)=>p(k,g,E())),input:u,path:[u],inst:i});continue}let _=$.valueType._zod.run({value:v[u],issues:[]},g);if(_ instanceof Promise)r.push(_.then((k)=>{if(k.issues.length)n.issues.push(...$i(u,k.issues));n.value[I.value]=k.value}));else{if(_.issues.length)n.issues.push(...$i(u,_.issues));n.value[I.value]=_.value}}}if(r.length)return Promise.all(r).then(()=>n);return n}}),l4=w("$ZodMap",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{let v=n.value;if(!(v instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:v,inst:i}),n;let r=[];n.value=new Map;for(let[b,u]of v){let I=$.keyType._zod.run({value:b,issues:[]},g),U=$.valueType._zod.run({value:u,issues:[]},g);if(I instanceof Promise||U instanceof Promise)r.push(Promise.all([I,U]).then(([_,k])=>{A1(_,k,n,b,v,i,g)}));else A1(I,U,n,b,v,i,g)}if(r.length)return Promise.all(r).then(()=>n);return n}});function A1(i,$,n,g,v,r,b){if(i.issues.length)if(kv.has(typeof g))n.issues.push(...$i(g,i.issues));else n.issues.push({code:"invalid_key",origin:"map",input:v,inst:r,issues:i.issues.map((u)=>p(u,b,E()))});if($.issues.length)if(kv.has(typeof g))n.issues.push(...$i(g,$.issues));else n.issues.push({origin:"map",code:"invalid_element",input:v,inst:r,key:g,issues:$.issues.map((u)=>p(u,b,E()))});n.value.set(i.value,$.value)}var B4=w("$ZodSet",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{let v=n.value;if(!(v instanceof Set))return n.issues.push({input:v,inst:i,expected:"set",code:"invalid_type"}),n;let r=[];n.value=new Set;for(let b of v){let u=$.valueType._zod.run({value:b,issues:[]},g);if(u instanceof Promise)r.push(u.then((I)=>l1(I,n)));else l1(u,n)}if(r.length)return Promise.all(r).then(()=>n);return n}});function l1(i,$){if(i.issues.length)$.issues.push(...i.issues);$.value.add(i.value)}var L4=w("$ZodEnum",(i,$)=>{Y.init(i,$);let n=_v($.entries),g=new Set(n);i._zod.values=g,i._zod.pattern=new RegExp(`^(${n.filter((v)=>kv.has(typeof v)).map((v)=>typeof v==="string"?Ui(v):v.toString()).join("|")})$`),i._zod.parse=(v,r)=>{let b=v.value;if(g.has(b))return v;return v.issues.push({code:"invalid_value",values:n,input:b,inst:i}),v}}),T4=w("$ZodLiteral",(i,$)=>{if(Y.init(i,$),$.values.length===0)throw Error("Cannot create literal schema with no valid values");let n=new Set($.values);i._zod.values=n,i._zod.pattern=new RegExp(`^(${$.values.map((g)=>typeof g==="string"?Ui(g):g?Ui(g.toString()):String(g)).join("|")})$`),i._zod.parse=(g,v)=>{let r=g.value;if(n.has(r))return g;return g.issues.push({code:"invalid_value",values:$.values,input:r,inst:i}),g}}),Z4=w("$ZodFile",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{let v=n.value;if(v instanceof File)return n;return n.issues.push({expected:"file",code:"invalid_type",input:v,inst:i}),n}}),q4=w("$ZodTransform",(i,$)=>{Y.init(i,$),i._zod.optin="optional",i._zod.parse=(n,g)=>{if(g.direction==="backward")throw new n$(i.constructor.name);let v=$.transform(n.value,n);if(g.async)return(v instanceof Promise?v:Promise.resolve(v)).then((b)=>{return n.value=b,n.fallback=!0,n});if(v instanceof Promise)throw new Oi;return n.value=v,n.fallback=!0,n}});function B1(i,$){if($===void 0&&(i.issues.length||i.fallback))return{issues:[],value:void 0};return i}var on=w("$ZodOptional",(i,$)=>{Y.init(i,$),i._zod.optin="optional",i._zod.optout="optional",S(i._zod,"values",()=>{return $.innerType._zod.values?new Set([...$.innerType._zod.values,void 0]):void 0}),S(i._zod,"pattern",()=>{let n=$.innerType._zod.pattern;return n?new RegExp(`^(${Dv(n.source)})?$`):void 0}),i._zod.parse=(n,g)=>{if($.innerType._zod.optin==="optional"){let v=n.value,r=$.innerType._zod.run(n,g);if(r instanceof Promise)return r.then((b)=>B1(b,v));return B1(r,v)}if(n.value===void 0)return n;return $.innerType._zod.run(n,g)}}),M4=w("$ZodExactOptional",(i,$)=>{on.init(i,$),S(i._zod,"values",()=>$.innerType._zod.values),S(i._zod,"pattern",()=>$.innerType._zod.pattern),i._zod.parse=(n,g)=>{return $.innerType._zod.run(n,g)}}),x4=w("$ZodNullable",(i,$)=>{Y.init(i,$),S(i._zod,"optin",()=>$.innerType._zod.optin),S(i._zod,"optout",()=>$.innerType._zod.optout),S(i._zod,"pattern",()=>{let n=$.innerType._zod.pattern;return n?new RegExp(`^(${Dv(n.source)}|null)$`):void 0}),S(i._zod,"values",()=>{return $.innerType._zod.values?new Set([...$.innerType._zod.values,null]):void 0}),i._zod.parse=(n,g)=>{if(n.value===null)return n;return $.innerType._zod.run(n,g)}}),N4=w("$ZodDefault",(i,$)=>{Y.init(i,$),i._zod.optin="optional",S(i._zod,"values",()=>$.innerType._zod.values),i._zod.parse=(n,g)=>{if(g.direction==="backward")return $.innerType._zod.run(n,g);if(n.value===void 0)return n.value=$.defaultValue,n;let v=$.innerType._zod.run(n,g);if(v instanceof Promise)return v.then((r)=>L1(r,$));return L1(v,$)}});function L1(i,$){if(i.value===void 0)i.value=$.defaultValue;return i}var t4=w("$ZodPrefault",(i,$)=>{Y.init(i,$),i._zod.optin="optional",S(i._zod,"values",()=>$.innerType._zod.values),i._zod.parse=(n,g)=>{if(g.direction==="backward")return $.innerType._zod.run(n,g);if(n.value===void 0)n.value=$.defaultValue;return $.innerType._zod.run(n,g)}}),E4=w("$ZodNonOptional",(i,$)=>{Y.init(i,$),S(i._zod,"values",()=>{let n=$.innerType._zod.values;return n?new Set([...n].filter((g)=>g!==void 0)):void 0}),i._zod.parse=(n,g)=>{let v=$.innerType._zod.run(n,g);if(v instanceof Promise)return v.then((r)=>T1(r,i));return T1(v,i)}});function T1(i,$){if(!i.issues.length&&i.value===void 0)i.issues.push({code:"invalid_type",expected:"nonoptional",input:i.value,inst:$});return i}var c4=w("$ZodSuccess",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{if(g.direction==="backward")throw new n$("ZodSuccess");let v=$.innerType._zod.run(n,g);if(v instanceof Promise)return v.then((r)=>{return n.value=r.issues.length===0,n});return n.value=v.issues.length===0,n}}),C4=w("$ZodCatch",(i,$)=>{Y.init(i,$),i._zod.optin="optional",S(i._zod,"optout",()=>$.innerType._zod.optout),S(i._zod,"values",()=>$.innerType._zod.values),i._zod.parse=(n,g)=>{if(g.direction==="backward")return $.innerType._zod.run(n,g);let v=$.innerType._zod.run(n,g);if(v instanceof Promise)return v.then((r)=>{if(n.value=r.value,r.issues.length)n.value=$.catchValue({...n,error:{issues:r.issues.map((b)=>p(b,g,E()))},input:n.value}),n.issues=[],n.fallback=!0;return n});if(n.value=v.value,v.issues.length)n.value=$.catchValue({...n,error:{issues:v.issues.map((r)=>p(r,g,E()))},input:n.value}),n.issues=[],n.fallback=!0;return n}}),R4=w("$ZodNaN",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{if(typeof n.value!=="number"||!Number.isNaN(n.value))return n.issues.push({input:n.value,inst:i,expected:"nan",code:"invalid_type"}),n;return n}}),mn=w("$ZodPipe",(i,$)=>{Y.init(i,$),S(i._zod,"values",()=>$.in._zod.values),S(i._zod,"optin",()=>$.in._zod.optin),S(i._zod,"optout",()=>$.out._zod.optout),S(i._zod,"propValues",()=>$.in._zod.propValues),i._zod.parse=(n,g)=>{if(g.direction==="backward"){let r=$.out._zod.run(n,g);if(r instanceof Promise)return r.then((b)=>Nn(b,$.in,g));return Nn(r,$.in,g)}let v=$.in._zod.run(n,g);if(v instanceof Promise)return v.then((r)=>Nn(r,$.out,g));return Nn(v,$.out,g)}});function Nn(i,$,n){if(i.issues.length)return i.aborted=!0,i;return $._zod.run({value:i.value,issues:i.issues,fallback:i.fallback},n)}var Kv=w("$ZodCodec",(i,$)=>{Y.init(i,$),S(i._zod,"values",()=>$.in._zod.values),S(i._zod,"optin",()=>$.in._zod.optin),S(i._zod,"optout",()=>$.out._zod.optout),S(i._zod,"propValues",()=>$.in._zod.propValues),i._zod.parse=(n,g)=>{if((g.direction||"forward")==="forward"){let r=$.in._zod.run(n,g);if(r instanceof Promise)return r.then((b)=>tn(b,$,g));return tn(r,$,g)}else{let r=$.out._zod.run(n,g);if(r instanceof Promise)return r.then((b)=>tn(b,$,g));return tn(r,$,g)}}});function tn(i,$,n){if(i.issues.length)return i.aborted=!0,i;if((n.direction||"forward")==="forward"){let v=$.transform(i.value,i);if(v instanceof Promise)return v.then((r)=>En(i,r,$.out,n));return En(i,v,$.out,n)}else{let v=$.reverseTransform(i.value,i);if(v instanceof Promise)return v.then((r)=>En(i,r,$.in,n));return En(i,v,$.in,n)}}function En(i,$,n,g){if(i.issues.length)return i.aborted=!0,i;return n._zod.run({value:$,issues:i.issues},g)}var F4=w("$ZodPreprocess",(i,$)=>{mn.init(i,$)}),o4=w("$ZodReadonly",(i,$)=>{Y.init(i,$),S(i._zod,"propValues",()=>$.innerType._zod.propValues),S(i._zod,"values",()=>$.innerType._zod.values),S(i._zod,"optin",()=>$.innerType?._zod?.optin),S(i._zod,"optout",()=>$.innerType?._zod?.optout),i._zod.parse=(n,g)=>{if(g.direction==="backward")return $.innerType._zod.run(n,g);let v=$.innerType._zod.run(n,g);if(v instanceof Promise)return v.then(Z1);return Z1(v)}});function Z1(i){return i.value=Object.freeze(i.value),i}var m4=w("$ZodTemplateLiteral",(i,$)=>{Y.init(i,$);let n=[];for(let g of $.parts)if(typeof g==="object"&&g!==null){if(!g._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...g._zod.traits].shift()}`);let v=g._zod.pattern instanceof RegExp?g._zod.pattern.source:g._zod.pattern;if(!v)throw Error(`Invalid template literal part: ${g._zod.traits}`);let r=v.startsWith("^")?1:0,b=v.endsWith("$")?v.length-1:v.length;n.push(v.slice(r,b))}else if(g===null||Nr.has(typeof g))n.push(Ui(`${g}`));else throw Error(`Invalid template literal part: ${g}`);i._zod.pattern=new RegExp(`^${n.join("")}$`),i._zod.parse=(g,v)=>{if(typeof g.value!=="string")return g.issues.push({input:g.value,inst:i,expected:"string",code:"invalid_type"}),g;if(i._zod.pattern.lastIndex=0,!i._zod.pattern.test(g.value))return g.issues.push({input:g.value,inst:i,code:"invalid_format",format:$.format??"template_literal",pattern:i._zod.pattern.source}),g;return g}}),y4=w("$ZodFunction",(i,$)=>{return Y.init(i,$),i._def=$,i._zod.def=$,i.implement=(n)=>{if(typeof n!=="function")throw Error("implement() must be called with a function");return function(...g){let v=i._def.input?Gn(i._def.input,g):g,r=Reflect.apply(n,this,v);if(i._def.output)return Gn(i._def.output,r);return r}},i.implementAsync=(n)=>{if(typeof n!=="function")throw Error("implementAsync() must be called with a function");return async function(...g){let v=i._def.input?await Yn(i._def.input,g):g,r=await Reflect.apply(n,this,v);if(i._def.output)return await Yn(i._def.output,r);return r}},i._zod.parse=(n,g)=>{if(typeof n.value!=="function")return n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:i}),n;if(i._def.output&&i._def.output._zod.def.type==="promise")n.value=i.implementAsync(n.value);else n.value=i.implement(n.value);return n},i.input=(...n)=>{let g=i.constructor;if(Array.isArray(n[0]))return new g({type:"function",input:new Fn({type:"tuple",items:n[0],rest:n[1]}),output:i._def.output});return new g({type:"function",input:n[0],output:i._def.output})},i.output=(n)=>{return new i.constructor({type:"function",input:i._def.input,output:n})},i}),h4=w("$ZodPromise",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{return Promise.resolve(n.value).then((v)=>$.innerType._zod.run({value:v,issues:[]},g))}}),d4=w("$ZodLazy",(i,$)=>{Y.init(i,$),S(i._zod,"innerType",()=>{let n=$;if(!n._cachedInner)n._cachedInner=$.getter();return n._cachedInner}),S(i._zod,"pattern",()=>i._zod.innerType?._zod?.pattern),S(i._zod,"propValues",()=>i._zod.innerType?._zod?.propValues),S(i._zod,"optin",()=>i._zod.innerType?._zod?.optin??void 0),S(i._zod,"optout",()=>i._zod.innerType?._zod?.optout??void 0),i._zod.parse=(n,g)=>{return i._zod.innerType._zod.run(n,g)}}),a4=w("$ZodCustom",(i,$)=>{M.init(i,$),Y.init(i,$),i._zod.parse=(n,g)=>{return n},i._zod.check=(n)=>{let g=n.value,v=$.fn(g);if(v instanceof Promise)return v.then((r)=>q1(r,n,g,i));q1(v,n,g,i);return}});function q1(i,$,n,g){if(!i){let v={code:"custom",input:n,inst:g,path:[...g._zod.def.path??[]],continue:!g._zod.def.abort};if(g._zod.def.params)v.params=g._zod.def.params;$.issues.push(f$(v))}}var Sv={};Gi(Sv,{zhTW:()=>F6,zhCN:()=>R6,yo:()=>o6,vi:()=>C6,uz:()=>c6,ur:()=>E6,uk:()=>zv,ua:()=>t6,tr:()=>N6,th:()=>x6,ta:()=>M6,sv:()=>q6,sl:()=>Z6,ru:()=>T6,ro:()=>L6,pt:()=>B6,ps:()=>A6,pl:()=>l6,ota:()=>S6,no:()=>z6,nl:()=>H6,ms:()=>Y6,mk:()=>G6,lt:()=>K6,ko:()=>Q6,km:()=>Yv,kh:()=>f6,ka:()=>X6,ja:()=>V6,it:()=>W6,is:()=>P6,id:()=>J6,hy:()=>O6,hu:()=>j6,hr:()=>w6,he:()=>k6,frCA:()=>D6,fr:()=>_6,fi:()=>I6,fa:()=>U6,es:()=>u6,eo:()=>b6,en:()=>Gv,el:()=>r6,de:()=>g6,da:()=>n6,cs:()=>v6,ca:()=>$6,bg:()=>i6,be:()=>s4,az:()=>e4,ar:()=>p4});var gj=()=>{let i={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function $(v){return i[v]??null}let n={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${v.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${u}`;return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${r}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${u}`}case"invalid_value":if(v.values.length===1)return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${W(v.values[0])}`;return`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${v.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${r} ${v.maximum.toString()} ${b.unit??"\u0639\u0646\u0635\u0631"}`;return`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${v.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${r} ${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${v.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${r} ${v.minimum.toString()} ${b.unit}`;return`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${v.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${r} ${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${v.prefix}"`;if(r.format==="ends_with")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${r.suffix}"`;if(r.format==="includes")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${r.includes}"`;if(r.format==="regex")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${r.pattern}`;return`${n[r.format]??v.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${v.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${v.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${v.keys.length>1?"\u0629":""}: ${j(v.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${v.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${v.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function p4(){return{localeError:gj()}}var rj=()=>{let i={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function $(v){return i[v]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${v.expected}, daxil olan ${u}`;return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${r}, daxil olan ${u}`}case"invalid_value":if(v.values.length===1)return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${W(v.values[0])}`;return`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${v.origin??"d\u0259y\u0259r"} ${r}${v.maximum.toString()} ${b.unit??"element"}`;return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${v.origin??"d\u0259y\u0259r"} ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${v.origin} ${r}${v.minimum.toString()} ${b.unit}`;return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${v.origin} ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Yanl\u0131\u015F m\u0259tn: "${r.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`;if(r.format==="ends_with")return`Yanl\u0131\u015F m\u0259tn: "${r.suffix}" il\u0259 bitm\u0259lidir`;if(r.format==="includes")return`Yanl\u0131\u015F m\u0259tn: "${r.includes}" daxil olmal\u0131d\u0131r`;if(r.format==="regex")return`Yanl\u0131\u015F m\u0259tn: ${r.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`;return`Yanl\u0131\u015F ${n[r.format]??v.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${v.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${v.keys.length>1?"lar":""}: ${j(v.keys,", ")}`;case"invalid_key":return`${v.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${v.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function e4(){return{localeError:rj()}}function c1(i,$,n,g){let v=Math.abs(i),r=v%10,b=v%100;if(b>=11&&b<=19)return g;if(r===1)return $;if(r>=2&&r<=4)return n;return g}var bj=()=>{let i={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function $(v){return i[v]??null}let n={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},g={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${v.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${u}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${r}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${u}`}case"invalid_value":if(v.values.length===1)return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${W(v.values[0])}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b){let u=Number(v.maximum),I=c1(u,b.unit.one,b.unit.few,b.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${v.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${b.verb} ${r}${v.maximum.toString()} ${I}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${v.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b){let u=Number(v.minimum),I=c1(u,b.unit.one,b.unit.few,b.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${v.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${b.verb} ${r}${v.minimum.toString()} ${I}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${v.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${r.prefix}"`;if(r.format==="ends_with")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${r.suffix}"`;if(r.format==="includes")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${r.includes}"`;if(r.format==="regex")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${r.pattern}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${n[r.format]??v.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${v.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${v.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${j(v.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${v.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${v.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function s4(){return{localeError:bj()}}var uj=()=>{let i={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function $(v){return i[v]??null}let n={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},g={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${v.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${u}`;return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${r}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${u}`}case"invalid_value":if(v.values.length===1)return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${W(v.values[0])}`;return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${v.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${r}${v.maximum.toString()} ${b.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`;return`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${v.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${v.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${r}${v.minimum.toString()} ${b.unit}`;return`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${v.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${r.prefix}"`;if(r.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${r.suffix}"`;if(r.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${r.includes}"`;if(r.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${r.pattern}`;let b="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";if(r.format==="emoji")b="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E";if(r.format==="datetime")b="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E";if(r.format==="date")b="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430";if(r.format==="time")b="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E";if(r.format==="duration")b="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430";return`${b} ${n[r.format]??v.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${v.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${v.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${v.keys.length>1?"\u043E\u0432\u0435":""}: ${j(v.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${v.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${v.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}};function i6(){return{localeError:uj()}}var Uj=()=>{let i={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function $(v){return i[v]??null}let n={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Tipus inv\xE0lid: s'esperava instanceof ${v.expected}, s'ha rebut ${u}`;return`Tipus inv\xE0lid: s'esperava ${r}, s'ha rebut ${u}`}case"invalid_value":if(v.values.length===1)return`Valor inv\xE0lid: s'esperava ${W(v.values[0])}`;return`Opci\xF3 inv\xE0lida: s'esperava una de ${j(v.values," o ")}`;case"too_big":{let r=v.inclusive?"com a m\xE0xim":"menys de",b=$(v.origin);if(b)return`Massa gran: s'esperava que ${v.origin??"el valor"} contingu\xE9s ${r} ${v.maximum.toString()} ${b.unit??"elements"}`;return`Massa gran: s'esperava que ${v.origin??"el valor"} fos ${r} ${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?"com a m\xEDnim":"m\xE9s de",b=$(v.origin);if(b)return`Massa petit: s'esperava que ${v.origin} contingu\xE9s ${r} ${v.minimum.toString()} ${b.unit}`;return`Massa petit: s'esperava que ${v.origin} fos ${r} ${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Format inv\xE0lid: ha de comen\xE7ar amb "${r.prefix}"`;if(r.format==="ends_with")return`Format inv\xE0lid: ha d'acabar amb "${r.suffix}"`;if(r.format==="includes")return`Format inv\xE0lid: ha d'incloure "${r.includes}"`;if(r.format==="regex")return`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${r.pattern}`;return`Format inv\xE0lid per a ${n[r.format]??v.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${v.divisor}`;case"unrecognized_keys":return`Clau${v.keys.length>1?"s":""} no reconeguda${v.keys.length>1?"s":""}: ${j(v.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${v.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${v.origin}`;default:return"Entrada inv\xE0lida"}}};function $6(){return{localeError:Uj()}}var Ij=()=>{let i={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function $(v){return i[v]??null}let n={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"},g={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${v.expected}, obdr\u017Eeno ${u}`;return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${r}, obdr\u017Eeno ${u}`}case"invalid_value":if(v.values.length===1)return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${W(v.values[0])}`;return`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${v.origin??"hodnota"} mus\xED m\xEDt ${r}${v.maximum.toString()} ${b.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${v.origin??"hodnota"} mus\xED b\xFDt ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${v.origin??"hodnota"} mus\xED m\xEDt ${r}${v.minimum.toString()} ${b.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${v.origin??"hodnota"} mus\xED b\xFDt ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${r.prefix}"`;if(r.format==="ends_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${r.suffix}"`;if(r.format==="includes")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${r.includes}"`;if(r.format==="regex")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${r.pattern}`;return`Neplatn\xFD form\xE1t ${n[r.format]??v.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${v.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${j(v.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${v.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${v.origin}`;default:return"Neplatn\xFD vstup"}}};function v6(){return{localeError:Ij()}}var _j=()=>{let i={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function $(v){return i[v]??null}let n={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},g={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Ugyldigt input: forventede instanceof ${v.expected}, fik ${u}`;return`Ugyldigt input: forventede ${r}, fik ${u}`}case"invalid_value":if(v.values.length===1)return`Ugyldig v\xE6rdi: forventede ${W(v.values[0])}`;return`Ugyldigt valg: forventede en af f\xF8lgende ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin),u=g[v.origin]??v.origin;if(b)return`For stor: forventede ${u??"value"} ${b.verb} ${r} ${v.maximum.toString()} ${b.unit??"elementer"}`;return`For stor: forventede ${u??"value"} havde ${r} ${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin),u=g[v.origin]??v.origin;if(b)return`For lille: forventede ${u} ${b.verb} ${r} ${v.minimum.toString()} ${b.unit}`;return`For lille: forventede ${u} havde ${r} ${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Ugyldig streng: skal starte med "${r.prefix}"`;if(r.format==="ends_with")return`Ugyldig streng: skal ende med "${r.suffix}"`;if(r.format==="includes")return`Ugyldig streng: skal indeholde "${r.includes}"`;if(r.format==="regex")return`Ugyldig streng: skal matche m\xF8nsteret ${r.pattern}`;return`Ugyldig ${n[r.format]??v.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${v.divisor}`;case"unrecognized_keys":return`${v.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${j(v.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${v.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${v.origin}`;default:return"Ugyldigt input"}}};function n6(){return{localeError:_j()}}var Dj=()=>{let i={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function $(v){return i[v]??null}let n={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},g={nan:"NaN",number:"Zahl",array:"Array"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Ung\xFCltige Eingabe: erwartet instanceof ${v.expected}, erhalten ${u}`;return`Ung\xFCltige Eingabe: erwartet ${r}, erhalten ${u}`}case"invalid_value":if(v.values.length===1)return`Ung\xFCltige Eingabe: erwartet ${W(v.values[0])}`;return`Ung\xFCltige Option: erwartet eine von ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Zu gro\xDF: erwartet, dass ${v.origin??"Wert"} ${r}${v.maximum.toString()} ${b.unit??"Elemente"} hat`;return`Zu gro\xDF: erwartet, dass ${v.origin??"Wert"} ${r}${v.maximum.toString()} ist`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Zu klein: erwartet, dass ${v.origin} ${r}${v.minimum.toString()} ${b.unit} hat`;return`Zu klein: erwartet, dass ${v.origin} ${r}${v.minimum.toString()} ist`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Ung\xFCltiger String: muss mit "${r.prefix}" beginnen`;if(r.format==="ends_with")return`Ung\xFCltiger String: muss mit "${r.suffix}" enden`;if(r.format==="includes")return`Ung\xFCltiger String: muss "${r.includes}" enthalten`;if(r.format==="regex")return`Ung\xFCltiger String: muss dem Muster ${r.pattern} entsprechen`;return`Ung\xFCltig: ${n[r.format]??v.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${v.divisor} sein`;case"unrecognized_keys":return`${v.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${j(v.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${v.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${v.origin}`;default:return"Ung\xFCltige Eingabe"}}};function g6(){return{localeError:Dj()}}var kj=()=>{let i={string:{unit:"\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},file:{unit:"bytes",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},array:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},set:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},map:{unit:"\u03BA\u03B1\u03C4\u03B1\u03C7\u03C9\u03C1\u03AE\u03C3\u03B5\u03B9\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"}};function $(v){return i[v]??null}let n={regex:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2",email:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03CE\u03C1\u03B1",date:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1",time:"ISO \u03CE\u03C1\u03B1",duration:"ISO \u03B4\u03B9\u03AC\u03C1\u03BA\u03B5\u03B9\u03B1",ipv4:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv4",ipv6:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv6",mac:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 MAC",cidrv4:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv4",cidrv6:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv6",base64:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64",base64url:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64url",json_string:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",e164:"\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",jwt:"JWT",template_literal:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(typeof v.expected==="string"&&/^[A-Z]/.test(v.expected))return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD instanceof ${v.expected}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${u}`;return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${r}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${u}`}case"invalid_value":if(v.values.length===1)return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${W(v.values[0])}`;return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD \u03AD\u03BD\u03B1 \u03B1\u03C0\u03CC ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${v.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${r}${v.maximum.toString()} ${b.unit??"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"}`;return`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${v.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${v.origin} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${r}${v.minimum.toString()} ${b.unit}`;return`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${v.origin} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03BE\u03B5\u03BA\u03B9\u03BD\u03AC \u03BC\u03B5 "${r.prefix}"`;if(r.format==="ends_with")return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03BD\u03B5\u03B9 \u03BC\u03B5 "${r.suffix}"`;if(r.format==="includes")return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9 "${r.includes}"`;if(r.format==="regex")return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B1\u03B9\u03C1\u03B9\u03AC\u03B6\u03B5\u03B9 \u03BC\u03B5 \u03C4\u03BF \u03BC\u03BF\u03C4\u03AF\u03B2\u03BF ${r.pattern}`;return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF: ${n[r.format]??v.format}`}case"not_multiple_of":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF\u03C2 \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03BF\u03BB\u03BB\u03B1\u03C0\u03BB\u03AC\u03C3\u03B9\u03BF \u03C4\u03BF\u03C5 ${v.divisor}`;case"unrecognized_keys":return`\u0386\u03B3\u03BD\u03C9\u03C3\u03C4${v.keys.length>1?"\u03B1":"\u03BF"} \u03BA\u03BB\u03B5\u03B9\u03B4${v.keys.length>1?"\u03B9\u03AC":"\u03AF"}: ${j(v.keys,", ")}`;case"invalid_key":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03BA\u03BB\u03B5\u03B9\u03B4\u03AF \u03C3\u03C4\u03BF ${v.origin}`;case"invalid_union":return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2";case"invalid_element":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C4\u03B9\u03BC\u03AE \u03C3\u03C4\u03BF ${v.origin}`;default:return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"}}};function r6(){return{localeError:kj()}}var wj=()=>{let i={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function $(v){return i[v]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;return`Invalid input: expected ${r}, received ${u}`}case"invalid_value":if(v.values.length===1)return`Invalid input: expected ${W(v.values[0])}`;return`Invalid option: expected one of ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Too big: expected ${v.origin??"value"} to have ${r}${v.maximum.toString()} ${b.unit??"elements"}`;return`Too big: expected ${v.origin??"value"} to be ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Too small: expected ${v.origin} to have ${r}${v.minimum.toString()} ${b.unit}`;return`Too small: expected ${v.origin} to be ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Invalid string: must start with "${r.prefix}"`;if(r.format==="ends_with")return`Invalid string: must end with "${r.suffix}"`;if(r.format==="includes")return`Invalid string: must include "${r.includes}"`;if(r.format==="regex")return`Invalid string: must match pattern ${r.pattern}`;return`Invalid ${n[r.format]??v.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${v.divisor}`;case"unrecognized_keys":return`Unrecognized key${v.keys.length>1?"s":""}: ${j(v.keys,", ")}`;case"invalid_key":return`Invalid key in ${v.origin}`;case"invalid_union":if(v.options&&Array.isArray(v.options)&&v.options.length>0)return`Invalid discriminator value. Expected ${v.options.map((b)=>`'${b}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${v.origin}`;default:return"Invalid input"}}};function Gv(){return{localeError:wj()}}var jj=()=>{let i={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function $(v){return i[v]??null}let n={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},g={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Nevalida enigo: atendi\u011Dis instanceof ${v.expected}, ricevi\u011Dis ${u}`;return`Nevalida enigo: atendi\u011Dis ${r}, ricevi\u011Dis ${u}`}case"invalid_value":if(v.values.length===1)return`Nevalida enigo: atendi\u011Dis ${W(v.values[0])}`;return`Nevalida opcio: atendi\u011Dis unu el ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Tro granda: atendi\u011Dis ke ${v.origin??"valoro"} havu ${r}${v.maximum.toString()} ${b.unit??"elementojn"}`;return`Tro granda: atendi\u011Dis ke ${v.origin??"valoro"} havu ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Tro malgranda: atendi\u011Dis ke ${v.origin} havu ${r}${v.minimum.toString()} ${b.unit}`;return`Tro malgranda: atendi\u011Dis ke ${v.origin} estu ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Nevalida karaktraro: devas komenci\u011Di per "${r.prefix}"`;if(r.format==="ends_with")return`Nevalida karaktraro: devas fini\u011Di per "${r.suffix}"`;if(r.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${r.includes}"`;if(r.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${r.pattern}`;return`Nevalida ${n[r.format]??v.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${v.divisor}`;case"unrecognized_keys":return`Nekonata${v.keys.length>1?"j":""} \u015Dlosilo${v.keys.length>1?"j":""}: ${j(v.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${v.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${v.origin}`;default:return"Nevalida enigo"}}};function b6(){return{localeError:jj()}}var Oj=()=>{let i={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function $(v){return i[v]??null}let n={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},g={nan:"NaN",string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Entrada inv\xE1lida: se esperaba instanceof ${v.expected}, recibido ${u}`;return`Entrada inv\xE1lida: se esperaba ${r}, recibido ${u}`}case"invalid_value":if(v.values.length===1)return`Entrada inv\xE1lida: se esperaba ${W(v.values[0])}`;return`Opci\xF3n inv\xE1lida: se esperaba una de ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin),u=g[v.origin]??v.origin;if(b)return`Demasiado grande: se esperaba que ${u??"valor"} tuviera ${r}${v.maximum.toString()} ${b.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${u??"valor"} fuera ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin),u=g[v.origin]??v.origin;if(b)return`Demasiado peque\xF1o: se esperaba que ${u} tuviera ${r}${v.minimum.toString()} ${b.unit}`;return`Demasiado peque\xF1o: se esperaba que ${u} fuera ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Cadena inv\xE1lida: debe comenzar con "${r.prefix}"`;if(r.format==="ends_with")return`Cadena inv\xE1lida: debe terminar en "${r.suffix}"`;if(r.format==="includes")return`Cadena inv\xE1lida: debe incluir "${r.includes}"`;if(r.format==="regex")return`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${r.pattern}`;return`Inv\xE1lido ${n[r.format]??v.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${v.divisor}`;case"unrecognized_keys":return`Llave${v.keys.length>1?"s":""} desconocida${v.keys.length>1?"s":""}: ${j(v.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${g[v.origin]??v.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${g[v.origin]??v.origin}`;default:return"Entrada inv\xE1lida"}}};function u6(){return{localeError:Oj()}}var Jj=()=>{let i={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function $(v){return i[v]??null}let n={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},g={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${v.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${u} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${r} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${u} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":if(v.values.length===1)return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${W(v.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`;return`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${j(v.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${v.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${r}${v.maximum.toString()} ${b.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${v.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${r}${v.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${v.origin} \u0628\u0627\u06CC\u062F ${r}${v.minimum.toString()} ${b.unit} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${v.origin} \u0628\u0627\u06CC\u062F ${r}${v.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${r.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`;if(r.format==="ends_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${r.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`;if(r.format==="includes")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${r.includes}" \u0628\u0627\u0634\u062F`;if(r.format==="regex")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${r.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`;return`${n[r.format]??v.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${v.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${v.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${j(v.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${v.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${v.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function U6(){return{localeError:Jj()}}var Pj=()=>{let i={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function $(v){return i[v]??null}let n={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Virheellinen tyyppi: odotettiin instanceof ${v.expected}, oli ${u}`;return`Virheellinen tyyppi: odotettiin ${r}, oli ${u}`}case"invalid_value":if(v.values.length===1)return`Virheellinen sy\xF6te: t\xE4ytyy olla ${W(v.values[0])}`;return`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Liian suuri: ${b.subject} t\xE4ytyy olla ${r}${v.maximum.toString()} ${b.unit}`.trim();return`Liian suuri: arvon t\xE4ytyy olla ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Liian pieni: ${b.subject} t\xE4ytyy olla ${r}${v.minimum.toString()} ${b.unit}`.trim();return`Liian pieni: arvon t\xE4ytyy olla ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${r.prefix}"`;if(r.format==="ends_with")return`Virheellinen sy\xF6te: t\xE4ytyy loppua "${r.suffix}"`;if(r.format==="includes")return`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${r.includes}"`;if(r.format==="regex")return`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${r.pattern}`;return`Virheellinen ${n[r.format]??v.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${v.divisor} monikerta`;case"unrecognized_keys":return`${v.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${j(v.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function I6(){return{localeError:Pj()}}var Wj=()=>{let i={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function $(v){return i[v]??null}let n={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},g={string:"cha\xEEne",number:"nombre",int:"entier",boolean:"bool\xE9en",bigint:"grand entier",symbol:"symbole",undefined:"ind\xE9fini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Entr\xE9e invalide : instanceof ${v.expected} attendu, ${u} re\xE7u`;return`Entr\xE9e invalide : ${r} attendu, ${u} re\xE7u`}case"invalid_value":if(v.values.length===1)return`Entr\xE9e invalide : ${W(v.values[0])} attendu`;return`Option invalide : une valeur parmi ${j(v.values,"|")} attendue`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Trop grand : ${g[v.origin]??"valeur"} doit ${b.verb} ${r}${v.maximum.toString()} ${b.unit??"\xE9l\xE9ment(s)"}`;return`Trop grand : ${g[v.origin]??"valeur"} doit \xEAtre ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Trop petit : ${g[v.origin]??"valeur"} doit ${b.verb} ${r}${v.minimum.toString()} ${b.unit}`;return`Trop petit : ${g[v.origin]??"valeur"} doit \xEAtre ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${r.prefix}"`;if(r.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${r.suffix}"`;if(r.format==="includes")return`Cha\xEEne invalide : doit inclure "${r.includes}"`;if(r.format==="regex")return`Cha\xEEne invalide : doit correspondre au mod\xE8le ${r.pattern}`;return`${n[r.format]??v.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${v.divisor}`;case"unrecognized_keys":return`Cl\xE9${v.keys.length>1?"s":""} non reconnue${v.keys.length>1?"s":""} : ${j(v.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${v.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${v.origin}`;default:return"Entr\xE9e invalide"}}};function _6(){return{localeError:Wj()}}var Vj=()=>{let i={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function $(v){return i[v]??null}let n={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Entr\xE9e invalide : attendu instanceof ${v.expected}, re\xE7u ${u}`;return`Entr\xE9e invalide : attendu ${r}, re\xE7u ${u}`}case"invalid_value":if(v.values.length===1)return`Entr\xE9e invalide : attendu ${W(v.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"\u2264":"<",b=$(v.origin);if(b)return`Trop grand : attendu que ${v.origin??"la valeur"} ait ${r}${v.maximum.toString()} ${b.unit}`;return`Trop grand : attendu que ${v.origin??"la valeur"} soit ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?"\u2265":">",b=$(v.origin);if(b)return`Trop petit : attendu que ${v.origin} ait ${r}${v.minimum.toString()} ${b.unit}`;return`Trop petit : attendu que ${v.origin} soit ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${r.prefix}"`;if(r.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${r.suffix}"`;if(r.format==="includes")return`Cha\xEEne invalide : doit inclure "${r.includes}"`;if(r.format==="regex")return`Cha\xEEne invalide : doit correspondre au motif ${r.pattern}`;return`${n[r.format]??v.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${v.divisor}`;case"unrecognized_keys":return`Cl\xE9${v.keys.length>1?"s":""} non reconnue${v.keys.length>1?"s":""} : ${j(v.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${v.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${v.origin}`;default:return"Entr\xE9e invalide"}}};function D6(){return{localeError:Vj()}}var Xj=()=>{let i={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},$={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},n=(U)=>U?i[U]:void 0,g=(U)=>{let _=n(U);if(_)return _.label;return U??i.unknown.label},v=(U)=>`\u05D4${g(U)}`,r=(U)=>{return(n(U)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA"},b=(U)=>{if(!U)return null;return $[U]??null},u={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}},I={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let _=U.expected,k=I[_??""]??g(_),O=V(U.input),J=I[O]??i[O]?.label??O;if(/^[A-Z]/.test(U.expected))return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${U.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${J}`;return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${k}, \u05D4\u05EA\u05E7\u05D1\u05DC ${J}`}case"invalid_value":{if(U.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${W(U.values[0])}`;let _=U.values.map((J)=>W(J));if(U.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${_[0]} \u05D0\u05D5 ${_[1]}`;let k=_[_.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${_.slice(0,-1).join(", ")} \u05D0\u05D5 ${k}`}case"too_big":{let _=b(U.origin),k=v(U.origin??"value");if(U.origin==="string")return`${_?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${k} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${U.maximum.toString()} ${_?.unit??""} ${U.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(U.origin==="number"){let Q=U.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${U.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${U.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${k} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${Q}`}if(U.origin==="array"||U.origin==="set"){let Q=U.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",A=U.inclusive?`${U.maximum} ${_?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${U.maximum} ${_?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${k} ${Q} \u05DC\u05D4\u05DB\u05D9\u05DC ${A}`.trim()}let O=U.inclusive?"<=":"<",J=r(U.origin??"value");if(_?.unit)return`${_.longLabel} \u05DE\u05D3\u05D9: ${k} ${J} ${O}${U.maximum.toString()} ${_.unit}`;return`${_?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${k} ${J} ${O}${U.maximum.toString()}`}case"too_small":{let _=b(U.origin),k=v(U.origin??"value");if(U.origin==="string")return`${_?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${k} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${U.minimum.toString()} ${_?.unit??""} ${U.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(U.origin==="number"){let Q=U.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${U.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${U.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${k} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${Q}`}if(U.origin==="array"||U.origin==="set"){let Q=U.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(U.minimum===1&&U.inclusive){let z=U.origin==="set"?"\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3":"\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3";return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${k} ${Q} \u05DC\u05D4\u05DB\u05D9\u05DC ${z}`}let A=U.inclusive?`${U.minimum} ${_?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${U.minimum} ${_?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${k} ${Q} \u05DC\u05D4\u05DB\u05D9\u05DC ${A}`.trim()}let O=U.inclusive?">=":">",J=r(U.origin??"value");if(_?.unit)return`${_.shortLabel} \u05DE\u05D3\u05D9: ${k} ${J} ${O}${U.minimum.toString()} ${_.unit}`;return`${_?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${k} ${J} ${O}${U.minimum.toString()}`}case"invalid_format":{let _=U;if(_.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${_.prefix}"`;if(_.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${_.suffix}"`;if(_.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${_.includes}"`;if(_.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${_.pattern}`;let k=u[_.format],O=k?.label??_.format,Q=(k?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${O} \u05DC\u05D0 ${Q}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${U.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${U.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${U.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${j(U.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${v(U.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function k6(){return{localeError:Xj()}}var fj=()=>{let i={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function $(v){return i[v]??null}let n={regex:"unos",email:"email adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},g={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Neispravan unos: o\u010Dekuje se instanceof ${v.expected}, a primljeno je ${u}`;return`Neispravan unos: o\u010Dekuje se ${r}, a primljeno je ${u}`}case"invalid_value":if(v.values.length===1)return`Neispravna vrijednost: o\u010Dekivano ${W(v.values[0])}`;return`Neispravna opcija: o\u010Dekivano jedno od ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin),u=g[v.origin]??v.origin;if(b)return`Preveliko: o\u010Dekivano da ${u??"vrijednost"} ima ${r}${v.maximum.toString()} ${b.unit??"elemenata"}`;return`Preveliko: o\u010Dekivano da ${u??"vrijednost"} bude ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin),u=g[v.origin]??v.origin;if(b)return`Premalo: o\u010Dekivano da ${u} ima ${r}${v.minimum.toString()} ${b.unit}`;return`Premalo: o\u010Dekivano da ${u} bude ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Neispravan tekst: mora zapo\u010Dinjati s "${r.prefix}"`;if(r.format==="ends_with")return`Neispravan tekst: mora zavr\u0161avati s "${r.suffix}"`;if(r.format==="includes")return`Neispravan tekst: mora sadr\u017Eavati "${r.includes}"`;if(r.format==="regex")return`Neispravan tekst: mora odgovarati uzorku ${r.pattern}`;return`Neispravna ${n[r.format]??v.format}`}case"not_multiple_of":return`Neispravan broj: mora biti vi\u0161ekratnik od ${v.divisor}`;case"unrecognized_keys":return`Neprepoznat${v.keys.length>1?"i klju\u010Devi":" klju\u010D"}: ${j(v.keys,", ")}`;case"invalid_key":return`Neispravan klju\u010D u ${g[v.origin]??v.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${g[v.origin]??v.origin}`;default:return"Neispravan unos"}}};function w6(){return{localeError:fj()}}var Qj=()=>{let i={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function $(v){return i[v]??null}let n={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"},g={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${v.expected}, a kapott \xE9rt\xE9k ${u}`;return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${r}, a kapott \xE9rt\xE9k ${u}`}case"invalid_value":if(v.values.length===1)return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${W(v.values[0])}`;return`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`T\xFAl nagy: ${v.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${r}${v.maximum.toString()} ${b.unit??"elem"}`;return`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${v.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${v.origin} m\xE9rete t\xFAl kicsi ${r}${v.minimum.toString()} ${b.unit}`;return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${v.origin} t\xFAl kicsi ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\xC9rv\xE9nytelen string: "${r.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`;if(r.format==="ends_with")return`\xC9rv\xE9nytelen string: "${r.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`;if(r.format==="includes")return`\xC9rv\xE9nytelen string: "${r.includes}" \xE9rt\xE9ket kell tartalmaznia`;if(r.format==="regex")return`\xC9rv\xE9nytelen string: ${r.pattern} mint\xE1nak kell megfelelnie`;return`\xC9rv\xE9nytelen ${n[r.format]??v.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${v.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${v.keys.length>1?"s":""}: ${j(v.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${v.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${v.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function j6(){return{localeError:Qj()}}function C1(i,$,n){return Math.abs(i)===1?$:n}function z$(i){if(!i)return"";let $=["\u0561","\u0565","\u0568","\u056B","\u0578","\u0578\u0582","\u0585"],n=i[i.length-1];return i+($.includes(n)?"\u0576":"\u0568")}var Kj=()=>{let i={string:{unit:{one:"\u0576\u0577\u0561\u0576",many:"\u0576\u0577\u0561\u0576\u0576\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},file:{unit:{one:"\u0562\u0561\u0575\u0569",many:"\u0562\u0561\u0575\u0569\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},array:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},set:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"}};function $(v){return i[v]??null}let n={regex:"\u0574\u0578\u0582\u057F\u0584",email:"\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",url:"URL",emoji:"\u0567\u0574\u0578\u057B\u056B",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",date:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",time:"ISO \u056A\u0561\u0574",duration:"ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",ipv4:"IPv4 \u0570\u0561\u057D\u0581\u0565",ipv6:"IPv6 \u0570\u0561\u057D\u0581\u0565",cidrv4:"IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",cidrv6:"IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",base64:"base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",base64url:"base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",json_string:"JSON \u057F\u0578\u0572",e164:"E.164 \u0570\u0561\u0574\u0561\u0580",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},g={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${v.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${u}`;return`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${r}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${u}`}case"invalid_value":if(v.values.length===1)return`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${W(v.values[1])}`;return`\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b){let u=Number(v.maximum),I=C1(u,b.unit.one,b.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${z$(v.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${r}${v.maximum.toString()} ${I}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${z$(v.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b){let u=Number(v.minimum),I=C1(u,b.unit.one,b.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${z$(v.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${r}${v.minimum.toString()} ${I}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${z$(v.origin)} \u056C\u056B\u0576\u056B ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${r.prefix}"-\u0578\u057E`;if(r.format==="ends_with")return`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${r.suffix}"-\u0578\u057E`;if(r.format==="includes")return`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${r.includes}"`;if(r.format==="regex")return`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${r.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`;return`\u054D\u056D\u0561\u056C ${n[r.format]??v.format}`}case"not_multiple_of":return`\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${v.divisor}-\u056B`;case"unrecognized_keys":return`\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${v.keys.length>1?"\u0576\u0565\u0580":""}. ${j(v.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${z$(v.origin)}-\u0578\u0582\u0574`;case"invalid_union":return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574";case"invalid_element":return`\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${z$(v.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}};function O6(){return{localeError:Kj()}}var Gj=()=>{let i={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function $(v){return i[v]??null}let n={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Input tidak valid: diharapkan instanceof ${v.expected}, diterima ${u}`;return`Input tidak valid: diharapkan ${r}, diterima ${u}`}case"invalid_value":if(v.values.length===1)return`Input tidak valid: diharapkan ${W(v.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Terlalu besar: diharapkan ${v.origin??"value"} memiliki ${r}${v.maximum.toString()} ${b.unit??"elemen"}`;return`Terlalu besar: diharapkan ${v.origin??"value"} menjadi ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Terlalu kecil: diharapkan ${v.origin} memiliki ${r}${v.minimum.toString()} ${b.unit}`;return`Terlalu kecil: diharapkan ${v.origin} menjadi ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`String tidak valid: harus dimulai dengan "${r.prefix}"`;if(r.format==="ends_with")return`String tidak valid: harus berakhir dengan "${r.suffix}"`;if(r.format==="includes")return`String tidak valid: harus menyertakan "${r.includes}"`;if(r.format==="regex")return`String tidak valid: harus sesuai pola ${r.pattern}`;return`${n[r.format]??v.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${v.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${v.keys.length>1?"s":""}: ${j(v.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${v.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${v.origin}`;default:return"Input tidak valid"}}};function J6(){return{localeError:Gj()}}var Yj=()=>{let i={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function $(v){return i[v]??null}let n={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"},g={nan:"NaN",number:"n\xFAmer",array:"fylki"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Rangt gildi: \xDE\xFA sl\xF3st inn ${u} \xFEar sem \xE1 a\xF0 vera instanceof ${v.expected}`;return`Rangt gildi: \xDE\xFA sl\xF3st inn ${u} \xFEar sem \xE1 a\xF0 vera ${r}`}case"invalid_value":if(v.values.length===1)return`Rangt gildi: gert r\xE1\xF0 fyrir ${W(v.values[0])}`;return`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${v.origin??"gildi"} hafi ${r}${v.maximum.toString()} ${b.unit??"hluti"}`;return`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${v.origin??"gildi"} s\xE9 ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${v.origin} hafi ${r}${v.minimum.toString()} ${b.unit}`;return`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${v.origin} s\xE9 ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${r.prefix}"`;if(r.format==="ends_with")return`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${r.suffix}"`;if(r.format==="includes")return`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${r.includes}"`;if(r.format==="regex")return`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${r.pattern}`;return`Rangt ${n[r.format]??v.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${v.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${v.keys.length>1?"ir lyklar":"ur lykill"}: ${j(v.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${v.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${v.origin}`;default:return"Rangt gildi"}}};function P6(){return{localeError:Yj()}}var Hj=()=>{let i={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function $(v){return i[v]??null}let n={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},g={nan:"NaN",number:"numero",array:"vettore"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Input non valido: atteso instanceof ${v.expected}, ricevuto ${u}`;return`Input non valido: atteso ${r}, ricevuto ${u}`}case"invalid_value":if(v.values.length===1)return`Input non valido: atteso ${W(v.values[0])}`;return`Opzione non valida: atteso uno tra ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Troppo grande: ${v.origin??"valore"} deve avere ${r}${v.maximum.toString()} ${b.unit??"elementi"}`;return`Troppo grande: ${v.origin??"valore"} deve essere ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Troppo piccolo: ${v.origin} deve avere ${r}${v.minimum.toString()} ${b.unit}`;return`Troppo piccolo: ${v.origin} deve essere ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Stringa non valida: deve iniziare con "${r.prefix}"`;if(r.format==="ends_with")return`Stringa non valida: deve terminare con "${r.suffix}"`;if(r.format==="includes")return`Stringa non valida: deve includere "${r.includes}"`;if(r.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${r.pattern}`;return`Input non valido: ${n[r.format]??v.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${v.divisor}`;case"unrecognized_keys":return`Chiav${v.keys.length>1?"i":"e"} non riconosciut${v.keys.length>1?"e":"a"}: ${j(v.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${v.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${v.origin}`;default:return"Input non valido"}}};function W6(){return{localeError:Hj()}}var zj=()=>{let i={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function $(v){return i[v]??null}let n={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},g={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u7121\u52B9\u306A\u5165\u529B: instanceof ${v.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${u}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;return`\u7121\u52B9\u306A\u5165\u529B: ${r}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${u}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":if(v.values.length===1)return`\u7121\u52B9\u306A\u5165\u529B: ${W(v.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`;return`\u7121\u52B9\u306A\u9078\u629E: ${j(v.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let r=v.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",b=$(v.origin);if(b)return`\u5927\u304D\u3059\u304E\u308B\u5024: ${v.origin??"\u5024"}\u306F${v.maximum.toString()}${b.unit??"\u8981\u7D20"}${r}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5927\u304D\u3059\u304E\u308B\u5024: ${v.origin??"\u5024"}\u306F${v.maximum.toString()}${r}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let r=v.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",b=$(v.origin);if(b)return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${v.origin}\u306F${v.minimum.toString()}${b.unit}${r}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${v.origin}\u306F${v.minimum.toString()}${r}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${r.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(r.format==="ends_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${r.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(r.format==="includes")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${r.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(r.format==="regex")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${r.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u7121\u52B9\u306A${n[r.format]??v.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${v.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${v.keys.length>1?"\u7FA4":""}: ${j(v.keys,"\u3001")}`;case"invalid_key":return`${v.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${v.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function V6(){return{localeError:zj()}}var Sj=()=>{let i={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function $(v){return i[v]??null}let n={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",json_string:"JSON \u10D5\u10D4\u10DA\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},g={nan:"NaN",number:"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",string:"\u10D5\u10D4\u10DA\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",array:"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${v.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${u}`;return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${r}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${u}`}case"invalid_value":if(v.values.length===1)return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${W(v.values[0])}`;return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${j(v.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${v.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${b.verb} ${r}${v.maximum.toString()} ${b.unit}`;return`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${v.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${v.origin} ${b.verb} ${r}${v.minimum.toString()} ${b.unit}`;return`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${v.origin} \u10D8\u10E7\u10DD\u10E1 ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${r.prefix}"-\u10D8\u10D7`;if(r.format==="ends_with")return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${r.suffix}"-\u10D8\u10D7`;if(r.format==="includes")return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${r.includes}"-\u10E1`;if(r.format==="regex")return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${r.pattern}`;return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${n[r.format]??v.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${v.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${v.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${j(v.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${v.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${v.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}};function X6(){return{localeError:Sj()}}var Aj=()=>{let i={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function $(v){return i[v]??null}let n={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},g={nan:"NaN",number:"\u179B\u17C1\u1781",array:"\u17A2\u17B6\u179A\u17C1 (Array)",null:"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${v.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${u}`;return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${u}`}case"invalid_value":if(v.values.length===1)return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${W(v.values[0])}`;return`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${v.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${r} ${v.maximum.toString()} ${b.unit??"\u1792\u17B6\u178F\u17BB"}`;return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${v.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${r} ${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${v.origin} ${r} ${v.minimum.toString()} ${b.unit}`;return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${v.origin} ${r} ${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${r.prefix}"`;if(r.format==="ends_with")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${r.suffix}"`;if(r.format==="includes")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${r.includes}"`;if(r.format==="regex")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${r.pattern}`;return`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${n[r.format]??v.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${v.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${j(v.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${v.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${v.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function Yv(){return{localeError:Aj()}}function f6(){return Yv()}var lj=()=>{let i={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function $(v){return i[v]??null}let n={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${v.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${u}\uC785\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${r}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${u}\uC785\uB2C8\uB2E4`}case"invalid_value":if(v.values.length===1)return`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${W(v.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C \uC635\uC158: ${j(v.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let r=v.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",b=r==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",u=$(v.origin),I=u?.unit??"\uC694\uC18C";if(u)return`${v.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${v.maximum.toString()}${I} ${r}${b}`;return`${v.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${v.maximum.toString()} ${r}${b}`}case"too_small":{let r=v.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",b=r==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",u=$(v.origin),I=u?.unit??"\uC694\uC18C";if(u)return`${v.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${v.minimum.toString()}${I} ${r}${b}`;return`${v.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${v.minimum.toString()} ${r}${b}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${r.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`;if(r.format==="ends_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${r.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`;if(r.format==="includes")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${r.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`;if(r.format==="regex")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${r.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C ${n[r.format]??v.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${v.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${j(v.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${v.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${v.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function Q6(){return{localeError:lj()}}var Hv=(i)=>{return i.charAt(0).toUpperCase()+i.slice(1)};function R1(i){let $=Math.abs(i),n=$%10,g=$%100;if(g>=11&&g<=19||n===0)return"many";if(n===1)return"one";return"few"}var Bj=()=>{let i={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function $(v,r,b,u){let I=i[v]??null;if(I===null)return I;return{unit:I.unit[r],verb:I.verb[u][b?"inclusive":"notInclusive"]}}let n={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"},g={nan:"NaN",number:"skai\u010Dius",bigint:"sveikasis skai\u010Dius",string:"eilut\u0117",boolean:"login\u0117 reik\u0161m\u0117",undefined:"neapibr\u0117\u017Eta reik\u0161m\u0117",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulin\u0117 reik\u0161m\u0117"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Gautas tipas ${u}, o tik\u0117tasi - instanceof ${v.expected}`;return`Gautas tipas ${u}, o tik\u0117tasi - ${r}`}case"invalid_value":if(v.values.length===1)return`Privalo b\u016Bti ${W(v.values[0])}`;return`Privalo b\u016Bti vienas i\u0161 ${j(v.values,"|")} pasirinkim\u0173`;case"too_big":{let r=g[v.origin]??v.origin,b=$(v.origin,R1(Number(v.maximum)),v.inclusive??!1,"smaller");if(b?.verb)return`${Hv(r??v.origin??"reik\u0161m\u0117")} ${b.verb} ${v.maximum.toString()} ${b.unit??"element\u0173"}`;let u=v.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${Hv(r??v.origin??"reik\u0161m\u0117")} turi b\u016Bti ${u} ${v.maximum.toString()} ${b?.unit}`}case"too_small":{let r=g[v.origin]??v.origin,b=$(v.origin,R1(Number(v.minimum)),v.inclusive??!1,"bigger");if(b?.verb)return`${Hv(r??v.origin??"reik\u0161m\u0117")} ${b.verb} ${v.minimum.toString()} ${b.unit??"element\u0173"}`;let u=v.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${Hv(r??v.origin??"reik\u0161m\u0117")} turi b\u016Bti ${u} ${v.minimum.toString()} ${b?.unit}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Eilut\u0117 privalo prasid\u0117ti "${r.prefix}"`;if(r.format==="ends_with")return`Eilut\u0117 privalo pasibaigti "${r.suffix}"`;if(r.format==="includes")return`Eilut\u0117 privalo \u012Ftraukti "${r.includes}"`;if(r.format==="regex")return`Eilut\u0117 privalo atitikti ${r.pattern}`;return`Neteisingas ${n[r.format]??v.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${v.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${v.keys.length>1?"i":"as"} rakt${v.keys.length>1?"ai":"as"}: ${j(v.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let r=g[v.origin]??v.origin;return`${Hv(r??v.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function K6(){return{localeError:Bj()}}var Lj=()=>{let i={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function $(v){return i[v]??null}let n={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},g={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${v.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${u}`;return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${u}`}case"invalid_value":if(v.values.length===1)return`Invalid input: expected ${W(v.values[0])}`;return`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${v.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${r}${v.maximum.toString()} ${b.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`;return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${v.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${v.origin} \u0434\u0430 \u0438\u043C\u0430 ${r}${v.minimum.toString()} ${b.unit}`;return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${v.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${r.prefix}"`;if(r.format==="ends_with")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${r.suffix}"`;if(r.format==="includes")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${r.includes}"`;if(r.format==="regex")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${r.pattern}`;return`Invalid ${n[r.format]??v.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${v.divisor}`;case"unrecognized_keys":return`${v.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${j(v.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${v.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${v.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function G6(){return{localeError:Lj()}}var Tj=()=>{let i={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function $(v){return i[v]??null}let n={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},g={nan:"NaN",number:"nombor"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Input tidak sah: dijangka instanceof ${v.expected}, diterima ${u}`;return`Input tidak sah: dijangka ${r}, diterima ${u}`}case"invalid_value":if(v.values.length===1)return`Input tidak sah: dijangka ${W(v.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Terlalu besar: dijangka ${v.origin??"nilai"} ${b.verb} ${r}${v.maximum.toString()} ${b.unit??"elemen"}`;return`Terlalu besar: dijangka ${v.origin??"nilai"} adalah ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Terlalu kecil: dijangka ${v.origin} ${b.verb} ${r}${v.minimum.toString()} ${b.unit}`;return`Terlalu kecil: dijangka ${v.origin} adalah ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`String tidak sah: mesti bermula dengan "${r.prefix}"`;if(r.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${r.suffix}"`;if(r.format==="includes")return`String tidak sah: mesti mengandungi "${r.includes}"`;if(r.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${r.pattern}`;return`${n[r.format]??v.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${v.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${j(v.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${v.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${v.origin}`;default:return"Input tidak sah"}}};function Y6(){return{localeError:Tj()}}var Zj=()=>{let i={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function $(v){return i[v]??null}let n={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},g={nan:"NaN",number:"getal"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Ongeldige invoer: verwacht instanceof ${v.expected}, ontving ${u}`;return`Ongeldige invoer: verwacht ${r}, ontving ${u}`}case"invalid_value":if(v.values.length===1)return`Ongeldige invoer: verwacht ${W(v.values[0])}`;return`Ongeldige optie: verwacht \xE9\xE9n van ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin),u=v.origin==="date"?"laat":v.origin==="string"?"lang":"groot";if(b)return`Te ${u}: verwacht dat ${v.origin??"waarde"} ${r}${v.maximum.toString()} ${b.unit??"elementen"} ${b.verb}`;return`Te ${u}: verwacht dat ${v.origin??"waarde"} ${r}${v.maximum.toString()} is`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin),u=v.origin==="date"?"vroeg":v.origin==="string"?"kort":"klein";if(b)return`Te ${u}: verwacht dat ${v.origin} ${r}${v.minimum.toString()} ${b.unit} ${b.verb}`;return`Te ${u}: verwacht dat ${v.origin} ${r}${v.minimum.toString()} is`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Ongeldige tekst: moet met "${r.prefix}" beginnen`;if(r.format==="ends_with")return`Ongeldige tekst: moet op "${r.suffix}" eindigen`;if(r.format==="includes")return`Ongeldige tekst: moet "${r.includes}" bevatten`;if(r.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${r.pattern}`;return`Ongeldig: ${n[r.format]??v.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${v.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${v.keys.length>1?"s":""}: ${j(v.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${v.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${v.origin}`;default:return"Ongeldige invoer"}}};function H6(){return{localeError:Zj()}}var qj=()=>{let i={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function $(v){return i[v]??null}let n={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},g={nan:"NaN",number:"tall",array:"liste"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Ugyldig input: forventet instanceof ${v.expected}, fikk ${u}`;return`Ugyldig input: forventet ${r}, fikk ${u}`}case"invalid_value":if(v.values.length===1)return`Ugyldig verdi: forventet ${W(v.values[0])}`;return`Ugyldig valg: forventet en av ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`For stor(t): forventet ${v.origin??"value"} til \xE5 ha ${r}${v.maximum.toString()} ${b.unit??"elementer"}`;return`For stor(t): forventet ${v.origin??"value"} til \xE5 ha ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`For lite(n): forventet ${v.origin} til \xE5 ha ${r}${v.minimum.toString()} ${b.unit}`;return`For lite(n): forventet ${v.origin} til \xE5 ha ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Ugyldig streng: m\xE5 starte med "${r.prefix}"`;if(r.format==="ends_with")return`Ugyldig streng: m\xE5 ende med "${r.suffix}"`;if(r.format==="includes")return`Ugyldig streng: m\xE5 inneholde "${r.includes}"`;if(r.format==="regex")return`Ugyldig streng: m\xE5 matche m\xF8nsteret ${r.pattern}`;return`Ugyldig ${n[r.format]??v.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${v.divisor}`;case"unrecognized_keys":return`${v.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${j(v.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${v.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${v.origin}`;default:return"Ugyldig input"}}};function z6(){return{localeError:qj()}}var Mj=()=>{let i={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function $(v){return i[v]??null}let n={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"},g={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`F\xE2sit giren: umulan instanceof ${v.expected}, al\u0131nan ${u}`;return`F\xE2sit giren: umulan ${r}, al\u0131nan ${u}`}case"invalid_value":if(v.values.length===1)return`F\xE2sit giren: umulan ${W(v.values[0])}`;return`F\xE2sit tercih: m\xFBteberler ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Fazla b\xFCy\xFCk: ${v.origin??"value"}, ${r}${v.maximum.toString()} ${b.unit??"elements"} sahip olmal\u0131yd\u0131.`;return`Fazla b\xFCy\xFCk: ${v.origin??"value"}, ${r}${v.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Fazla k\xFC\xE7\xFCk: ${v.origin}, ${r}${v.minimum.toString()} ${b.unit} sahip olmal\u0131yd\u0131.`;return`Fazla k\xFC\xE7\xFCk: ${v.origin}, ${r}${v.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`F\xE2sit metin: "${r.prefix}" ile ba\u015Flamal\u0131.`;if(r.format==="ends_with")return`F\xE2sit metin: "${r.suffix}" ile bitmeli.`;if(r.format==="includes")return`F\xE2sit metin: "${r.includes}" ihtiv\xE2 etmeli.`;if(r.format==="regex")return`F\xE2sit metin: ${r.pattern} nak\u015F\u0131na uymal\u0131.`;return`F\xE2sit ${n[r.format]??v.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${v.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${v.keys.length>1?"s":""}: ${j(v.keys,", ")}`;case"invalid_key":return`${v.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${v.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function S6(){return{localeError:Mj()}}var xj=()=>{let i={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function $(v){return i[v]??null}let n={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},g={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${v.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${u} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`;return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${r} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${u} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":if(v.values.length===1)return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${W(v.values[0])} \u0648\u0627\u06CC`;return`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${j(v.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${v.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${r}${v.maximum.toString()} ${b.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`;return`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${v.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${r}${v.maximum.toString()} \u0648\u064A`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${v.origin} \u0628\u0627\u06CC\u062F ${r}${v.minimum.toString()} ${b.unit} \u0648\u0644\u0631\u064A`;return`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${v.origin} \u0628\u0627\u06CC\u062F ${r}${v.minimum.toString()} \u0648\u064A`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${r.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`;if(r.format==="ends_with")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${r.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`;if(r.format==="includes")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${r.includes}" \u0648\u0644\u0631\u064A`;if(r.format==="regex")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${r.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`;return`${n[r.format]??v.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${v.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${v.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${j(v.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${v.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${v.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function A6(){return{localeError:xj()}}var Nj=()=>{let i={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function $(v){return i[v]??null}let n={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"},g={nan:"NaN",number:"liczba",array:"tablica"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${v.expected}, otrzymano ${u}`;return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${r}, otrzymano ${u}`}case"invalid_value":if(v.values.length===1)return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${W(v.values[0])}`;return`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${v.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${r}${v.maximum.toString()} ${b.unit??"element\xF3w"}`;return`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${v.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${v.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${r}${v.minimum.toString()} ${b.unit??"element\xF3w"}`;return`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${v.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${r.prefix}"`;if(r.format==="ends_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${r.suffix}"`;if(r.format==="includes")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${r.includes}"`;if(r.format==="regex")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${r.pattern}`;return`Nieprawid\u0142ow(y/a/e) ${n[r.format]??v.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${v.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${v.keys.length>1?"s":""}: ${j(v.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${v.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${v.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function l6(){return{localeError:Nj()}}var tj=()=>{let i={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function $(v){return i[v]??null}let n={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},g={nan:"NaN",number:"n\xFAmero",null:"nulo"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Tipo inv\xE1lido: esperado instanceof ${v.expected}, recebido ${u}`;return`Tipo inv\xE1lido: esperado ${r}, recebido ${u}`}case"invalid_value":if(v.values.length===1)return`Entrada inv\xE1lida: esperado ${W(v.values[0])}`;return`Op\xE7\xE3o inv\xE1lida: esperada uma das ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Muito grande: esperado que ${v.origin??"valor"} tivesse ${r}${v.maximum.toString()} ${b.unit??"elementos"}`;return`Muito grande: esperado que ${v.origin??"valor"} fosse ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Muito pequeno: esperado que ${v.origin} tivesse ${r}${v.minimum.toString()} ${b.unit}`;return`Muito pequeno: esperado que ${v.origin} fosse ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Texto inv\xE1lido: deve come\xE7ar com "${r.prefix}"`;if(r.format==="ends_with")return`Texto inv\xE1lido: deve terminar com "${r.suffix}"`;if(r.format==="includes")return`Texto inv\xE1lido: deve incluir "${r.includes}"`;if(r.format==="regex")return`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${r.pattern}`;return`${n[r.format]??v.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${v.divisor}`;case"unrecognized_keys":return`Chave${v.keys.length>1?"s":""} desconhecida${v.keys.length>1?"s":""}: ${j(v.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${v.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${v.origin}`;default:return"Campo inv\xE1lido"}}};function B6(){return{localeError:tj()}}var Ej=()=>{let i={string:{unit:"caractere",verb:"s\u0103 aib\u0103"},file:{unit:"octe\u021Bi",verb:"s\u0103 aib\u0103"},array:{unit:"elemente",verb:"s\u0103 aib\u0103"},set:{unit:"elemente",verb:"s\u0103 aib\u0103"},map:{unit:"intr\u0103ri",verb:"s\u0103 aib\u0103"}};function $(v){return i[v]??null}let n={regex:"intrare",email:"adres\u0103 de email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dat\u0103 \u0219i or\u0103 ISO",date:"dat\u0103 ISO",time:"or\u0103 ISO",duration:"durat\u0103 ISO",ipv4:"adres\u0103 IPv4",ipv6:"adres\u0103 IPv6",mac:"adres\u0103 MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"\u0219ir codat base64",base64url:"\u0219ir codat base64url",json_string:"\u0219ir JSON",e164:"num\u0103r E.164",jwt:"JWT",template_literal:"intrare"},g={nan:"NaN",string:"\u0219ir",number:"num\u0103r",boolean:"boolean",function:"func\u021Bie",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"num\u0103r mare",void:"void",never:"never",map:"hart\u0103",set:"set"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;return`Intrare invalid\u0103: a\u0219teptat ${r}, primit ${u}`}case"invalid_value":if(v.values.length===1)return`Intrare invalid\u0103: a\u0219teptat ${W(v.values[0])}`;return`Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Prea mare: a\u0219teptat ca ${v.origin??"valoarea"} ${b.verb} ${r}${v.maximum.toString()} ${b.unit??"elemente"}`;return`Prea mare: a\u0219teptat ca ${v.origin??"valoarea"} s\u0103 fie ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Prea mic: a\u0219teptat ca ${v.origin} ${b.verb} ${r}${v.minimum.toString()} ${b.unit}`;return`Prea mic: a\u0219teptat ca ${v.origin} s\u0103 fie ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u0218ir invalid: trebuie s\u0103 \xEEnceap\u0103 cu "${r.prefix}"`;if(r.format==="ends_with")return`\u0218ir invalid: trebuie s\u0103 se termine cu "${r.suffix}"`;if(r.format==="includes")return`\u0218ir invalid: trebuie s\u0103 includ\u0103 "${r.includes}"`;if(r.format==="regex")return`\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${r.pattern}`;return`Format invalid: ${n[r.format]??v.format}`}case"not_multiple_of":return`Num\u0103r invalid: trebuie s\u0103 fie multiplu de ${v.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${j(v.keys,", ")}`;case"invalid_key":return`Cheie invalid\u0103 \xEEn ${v.origin}`;case"invalid_union":return"Intrare invalid\u0103";case"invalid_element":return`Valoare invalid\u0103 \xEEn ${v.origin}`;default:return"Intrare invalid\u0103"}}};function L6(){return{localeError:Ej()}}function F1(i,$,n,g){let v=Math.abs(i),r=v%10,b=v%100;if(b>=11&&b<=19)return g;if(r===1)return $;if(r>=2&&r<=4)return n;return g}var cj=()=>{let i={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function $(v){return i[v]??null}let n={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},g={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${v.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${u}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${r}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${u}`}case"invalid_value":if(v.values.length===1)return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${W(v.values[0])}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b){let u=Number(v.maximum),I=F1(u,b.unit.one,b.unit.few,b.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${v.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${r}${v.maximum.toString()} ${I}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${v.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b){let u=Number(v.minimum),I=F1(u,b.unit.one,b.unit.few,b.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${v.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${r}${v.minimum.toString()} ${I}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${v.origin} \u0431\u0443\u0434\u0435\u0442 ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${r.prefix}"`;if(r.format==="ends_with")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${r.suffix}"`;if(r.format==="includes")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${r.includes}"`;if(r.format==="regex")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${r.pattern}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${n[r.format]??v.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${v.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${v.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${v.keys.length>1?"\u0438":""}: ${j(v.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${v.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${v.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function T6(){return{localeError:cj()}}var Cj=()=>{let i={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function $(v){return i[v]??null}let n={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"},g={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Neveljaven vnos: pri\u010Dakovano instanceof ${v.expected}, prejeto ${u}`;return`Neveljaven vnos: pri\u010Dakovano ${r}, prejeto ${u}`}case"invalid_value":if(v.values.length===1)return`Neveljaven vnos: pri\u010Dakovano ${W(v.values[0])}`;return`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Preveliko: pri\u010Dakovano, da bo ${v.origin??"vrednost"} imelo ${r}${v.maximum.toString()} ${b.unit??"elementov"}`;return`Preveliko: pri\u010Dakovano, da bo ${v.origin??"vrednost"} ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Premajhno: pri\u010Dakovano, da bo ${v.origin} imelo ${r}${v.minimum.toString()} ${b.unit}`;return`Premajhno: pri\u010Dakovano, da bo ${v.origin} ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Neveljaven niz: mora se za\u010Deti z "${r.prefix}"`;if(r.format==="ends_with")return`Neveljaven niz: mora se kon\u010Dati z "${r.suffix}"`;if(r.format==="includes")return`Neveljaven niz: mora vsebovati "${r.includes}"`;if(r.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${r.pattern}`;return`Neveljaven ${n[r.format]??v.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${v.divisor}`;case"unrecognized_keys":return`Neprepoznan${v.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${j(v.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${v.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${v.origin}`;default:return"Neveljaven vnos"}}};function Z6(){return{localeError:Cj()}}var Rj=()=>{let i={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function $(v){return i[v]??null}let n={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},g={nan:"NaN",number:"antal",array:"lista"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${v.expected}, fick ${u}`;return`Ogiltig inmatning: f\xF6rv\xE4ntat ${r}, fick ${u}`}case"invalid_value":if(v.values.length===1)return`Ogiltig inmatning: f\xF6rv\xE4ntat ${W(v.values[0])}`;return`Ogiltigt val: f\xF6rv\xE4ntade en av ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`F\xF6r stor(t): f\xF6rv\xE4ntade ${v.origin??"v\xE4rdet"} att ha ${r}${v.maximum.toString()} ${b.unit??"element"}`;return`F\xF6r stor(t): f\xF6rv\xE4ntat ${v.origin??"v\xE4rdet"} att ha ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`F\xF6r lite(t): f\xF6rv\xE4ntade ${v.origin??"v\xE4rdet"} att ha ${r}${v.minimum.toString()} ${b.unit}`;return`F\xF6r lite(t): f\xF6rv\xE4ntade ${v.origin??"v\xE4rdet"} att ha ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${r.prefix}"`;if(r.format==="ends_with")return`Ogiltig str\xE4ng: m\xE5ste sluta med "${r.suffix}"`;if(r.format==="includes")return`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${r.includes}"`;if(r.format==="regex")return`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${r.pattern}"`;return`Ogiltig(t) ${n[r.format]??v.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${v.divisor}`;case"unrecognized_keys":return`${v.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${j(v.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${v.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${v.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function q6(){return{localeError:Rj()}}var Fj=()=>{let i={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function $(v){return i[v]??null}let n={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"},g={nan:"NaN",number:"\u0B8E\u0BA3\u0BCD",array:"\u0B85\u0BA3\u0BBF",null:"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${v.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${u}`;return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${u}`}case"invalid_value":if(v.values.length===1)return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${W(v.values[0])}`;return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${j(v.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${v.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${r}${v.maximum.toString()} ${b.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${v.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${r}${v.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${v.origin} ${r}${v.minimum.toString()} ${b.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${v.origin} ${r}${v.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${r.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(r.format==="ends_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${r.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(r.format==="includes")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${r.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(r.format==="regex")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${r.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${n[r.format]??v.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${v.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${v.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${j(v.keys,", ")}`;case"invalid_key":return`${v.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${v.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function M6(){return{localeError:Fj()}}var oj=()=>{let i={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function $(v){return i[v]??null}let n={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},g={nan:"NaN",number:"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02",array:"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)",null:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${v.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${u}`;return`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${r} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${u}`}case"invalid_value":if(v.values.length===1)return`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${W(v.values[0])}`;return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",b=$(v.origin);if(b)return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${v.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${r} ${v.maximum.toString()} ${b.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`;return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${v.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${r} ${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",b=$(v.origin);if(b)return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${v.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${r} ${v.minimum.toString()} ${b.unit}`;return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${v.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${r} ${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${r.prefix}"`;if(r.format==="ends_with")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${r.suffix}"`;if(r.format==="includes")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${r.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`;if(r.format==="regex")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${r.pattern}`;return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${n[r.format]??v.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${v.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${j(v.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${v.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${v.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function x6(){return{localeError:oj()}}var mj=()=>{let i={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function $(v){return i[v]??null}let n={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${v.expected}, al\u0131nan ${u}`;return`Ge\xE7ersiz de\u011Fer: beklenen ${r}, al\u0131nan ${u}`}case"invalid_value":if(v.values.length===1)return`Ge\xE7ersiz de\u011Fer: beklenen ${W(v.values[0])}`;return`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\xC7ok b\xFCy\xFCk: beklenen ${v.origin??"de\u011Fer"} ${r}${v.maximum.toString()} ${b.unit??"\xF6\u011Fe"}`;return`\xC7ok b\xFCy\xFCk: beklenen ${v.origin??"de\u011Fer"} ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\xC7ok k\xFC\xE7\xFCk: beklenen ${v.origin} ${r}${v.minimum.toString()} ${b.unit}`;return`\xC7ok k\xFC\xE7\xFCk: beklenen ${v.origin} ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Ge\xE7ersiz metin: "${r.prefix}" ile ba\u015Flamal\u0131`;if(r.format==="ends_with")return`Ge\xE7ersiz metin: "${r.suffix}" ile bitmeli`;if(r.format==="includes")return`Ge\xE7ersiz metin: "${r.includes}" i\xE7ermeli`;if(r.format==="regex")return`Ge\xE7ersiz metin: ${r.pattern} desenine uymal\u0131`;return`Ge\xE7ersiz ${n[r.format]??v.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${v.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${v.keys.length>1?"lar":""}: ${j(v.keys,", ")}`;case"invalid_key":return`${v.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${v.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function N6(){return{localeError:mj()}}var yj=()=>{let i={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function $(v){return i[v]??null}let n={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},g={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${v.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${u}`;return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${r}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${u}`}case"invalid_value":if(v.values.length===1)return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${W(v.values[0])}`;return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${v.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${b.verb} ${r}${v.maximum.toString()} ${b.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`;return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${v.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${v.origin} ${b.verb} ${r}${v.minimum.toString()} ${b.unit}`;return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${v.origin} \u0431\u0443\u0434\u0435 ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${r.prefix}"`;if(r.format==="ends_with")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${r.suffix}"`;if(r.format==="includes")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${r.includes}"`;if(r.format==="regex")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${r.pattern}`;return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${n[r.format]??v.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${v.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${v.keys.length>1?"\u0456":""}: ${j(v.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${v.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${v.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function zv(){return{localeError:yj()}}function t6(){return zv()}var hj=()=>{let i={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function $(v){return i[v]??null}let n={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},g={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${v.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${u} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${r} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${u} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":if(v.values.length===1)return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${W(v.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;return`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${j(v.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u0628\u06C1\u062A \u0628\u0691\u0627: ${v.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${r}${v.maximum.toString()} ${b.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;return`\u0628\u06C1\u062A \u0628\u0691\u0627: ${v.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${r}${v.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${v.origin} \u06A9\u06D2 ${r}${v.minimum.toString()} ${b.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${v.origin} \u06A9\u0627 ${r}${v.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${r.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(r.format==="ends_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${r.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(r.format==="includes")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${r.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(r.format==="regex")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${r.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;return`\u063A\u0644\u0637 ${n[r.format]??v.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${v.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${v.keys.length>1?"\u0632":""}: ${j(v.keys,"\u060C ")}`;case"invalid_key":return`${v.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${v.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function E6(){return{localeError:hj()}}var dj=()=>{let i={string:{unit:"belgi",verb:"bo\u2018lishi kerak"},file:{unit:"bayt",verb:"bo\u2018lishi kerak"},array:{unit:"element",verb:"bo\u2018lishi kerak"},set:{unit:"element",verb:"bo\u2018lishi kerak"},map:{unit:"yozuv",verb:"bo\u2018lishi kerak"}};function $(v){return i[v]??null}let n={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},g={nan:"NaN",number:"raqam",array:"massiv"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${v.expected}, qabul qilingan ${u}`;return`Noto\u2018g\u2018ri kirish: kutilgan ${r}, qabul qilingan ${u}`}case"invalid_value":if(v.values.length===1)return`Noto\u2018g\u2018ri kirish: kutilgan ${W(v.values[0])}`;return`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Juda katta: kutilgan ${v.origin??"qiymat"} ${r}${v.maximum.toString()} ${b.unit} ${b.verb}`;return`Juda katta: kutilgan ${v.origin??"qiymat"} ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Juda kichik: kutilgan ${v.origin} ${r}${v.minimum.toString()} ${b.unit} ${b.verb}`;return`Juda kichik: kutilgan ${v.origin} ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Noto\u2018g\u2018ri satr: "${r.prefix}" bilan boshlanishi kerak`;if(r.format==="ends_with")return`Noto\u2018g\u2018ri satr: "${r.suffix}" bilan tugashi kerak`;if(r.format==="includes")return`Noto\u2018g\u2018ri satr: "${r.includes}" ni o\u2018z ichiga olishi kerak`;if(r.format==="regex")return`Noto\u2018g\u2018ri satr: ${r.pattern} shabloniga mos kelishi kerak`;return`Noto\u2018g\u2018ri ${n[r.format]??v.format}`}case"not_multiple_of":return`Noto\u2018g\u2018ri raqam: ${v.divisor} ning karralisi bo\u2018lishi kerak`;case"unrecognized_keys":return`Noma\u2019lum kalit${v.keys.length>1?"lar":""}: ${j(v.keys,", ")}`;case"invalid_key":return`${v.origin} dagi kalit noto\u2018g\u2018ri`;case"invalid_union":return"Noto\u2018g\u2018ri kirish";case"invalid_element":return`${v.origin} da noto\u2018g\u2018ri qiymat`;default:return"Noto\u2018g\u2018ri kirish"}}};function c6(){return{localeError:dj()}}var aj=()=>{let i={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function $(v){return i[v]??null}let n={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},g={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${v.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${u}`;return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${r}, nh\u1EADn \u0111\u01B0\u1EE3c ${u}`}case"invalid_value":if(v.values.length===1)return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${W(v.values[0])}`;return`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${v.origin??"gi\xE1 tr\u1ECB"} ${b.verb} ${r}${v.maximum.toString()} ${b.unit??"ph\u1EA7n t\u1EED"}`;return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${v.origin??"gi\xE1 tr\u1ECB"} ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${v.origin} ${b.verb} ${r}${v.minimum.toString()} ${b.unit}`;return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${v.origin} ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${r.prefix}"`;if(r.format==="ends_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${r.suffix}"`;if(r.format==="includes")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${r.includes}"`;if(r.format==="regex")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${r.pattern}`;return`${n[r.format]??v.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${v.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${j(v.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${v.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${v.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function C6(){return{localeError:aj()}}var pj=()=>{let i={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function $(v){return i[v]??null}let n={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"},g={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${v.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${u}`;return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${r}\uFF0C\u5B9E\u9645\u63A5\u6536 ${u}`}case"invalid_value":if(v.values.length===1)return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${W(v.values[0])}`;return`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${v.origin??"\u503C"} ${r}${v.maximum.toString()} ${b.unit??"\u4E2A\u5143\u7D20"}`;return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${v.origin??"\u503C"} ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${v.origin} ${r}${v.minimum.toString()} ${b.unit}`;return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${v.origin} ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${r.prefix}" \u5F00\u5934`;if(r.format==="ends_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${r.suffix}" \u7ED3\u5C3E`;if(r.format==="includes")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${r.includes}"`;if(r.format==="regex")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${r.pattern}`;return`\u65E0\u6548${n[r.format]??v.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${v.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${j(v.keys,", ")}`;case"invalid_key":return`${v.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${v.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function R6(){return{localeError:pj()}}var ej=()=>{let i={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function $(v){return i[v]??null}let n={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${v.expected}\uFF0C\u4F46\u6536\u5230 ${u}`;return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${r}\uFF0C\u4F46\u6536\u5230 ${u}`}case"invalid_value":if(v.values.length===1)return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${W(v.values[0])}`;return`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${v.origin??"\u503C"} \u61C9\u70BA ${r}${v.maximum.toString()} ${b.unit??"\u500B\u5143\u7D20"}`;return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${v.origin??"\u503C"} \u61C9\u70BA ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${v.origin} \u61C9\u70BA ${r}${v.minimum.toString()} ${b.unit}`;return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${v.origin} \u61C9\u70BA ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${r.prefix}" \u958B\u982D`;if(r.format==="ends_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${r.suffix}" \u7D50\u5C3E`;if(r.format==="includes")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${r.includes}"`;if(r.format==="regex")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${r.pattern}`;return`\u7121\u6548\u7684 ${n[r.format]??v.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${v.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${v.keys.length>1?"\u5011":""}\uFF1A${j(v.keys,"\u3001")}`;case"invalid_key":return`${v.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${v.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function F6(){return{localeError:ej()}}var sj=()=>{let i={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function $(v){return i[v]??null}let n={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},g={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${v.expected}, \xE0m\u1ECD\u0300 a r\xED ${u}`;return`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${r}, \xE0m\u1ECD\u0300 a r\xED ${u}`}case"invalid_value":if(v.values.length===1)return`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${W(v.values[0])}`;return`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${v.origin??"iye"} ${b.verb} ${r}${v.maximum} ${b.unit}`;return`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${r}${v.maximum}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${v.origin} ${b.verb} ${r}${v.minimum} ${b.unit}`;return`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${r}${v.minimum}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${r.prefix}"`;if(r.format==="ends_with")return`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${r.suffix}"`;if(r.format==="includes")return`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${r.includes}"`;if(r.format==="regex")return`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${r.pattern}`;return`A\u1E63\xEC\u1E63e: ${n[r.format]??v.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${v.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${j(v.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${v.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${v.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}};function o6(){return{localeError:sj()}}var o1,m6=Symbol("ZodOutput"),y6=Symbol("ZodInput");class h6{constructor(){this._map=new WeakMap,this._idmap=new Map}add(i,...$){let n=$[0];if(this._map.set(i,n),n&&typeof n==="object"&&"id"in n)this._idmap.set(n.id,i);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(i){let $=this._map.get(i);if($&&typeof $==="object"&&"id"in $)this._idmap.delete($.id);return this._map.delete(i),this}get(i){let $=i._zod.parent;if($){let n={...this.get($)??{}};delete n.id;let g={...n,...this._map.get(i)};return Object.keys(g).length?g:void 0}return this._map.get(i)}has(i){return this._map.has(i)}}function yn(){return new h6}(o1=globalThis).__zod_globalRegistry??(o1.__zod_globalRegistry=yn());var m=globalThis.__zod_globalRegistry;function d6(i,$){return new i({type:"string",...f($)})}function a6(i,$){return new i({type:"string",coerce:!0,...f($)})}function hn(i,$){return new i({type:"string",format:"email",check:"string_format",abort:!1,...f($)})}function Av(i,$){return new i({type:"string",format:"guid",check:"string_format",abort:!1,...f($)})}function dn(i,$){return new i({type:"string",format:"uuid",check:"string_format",abort:!1,...f($)})}function an(i,$){return new i({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...f($)})}function pn(i,$){return new i({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...f($)})}function en(i,$){return new i({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...f($)})}function lv(i,$){return new i({type:"string",format:"url",check:"string_format",abort:!1,...f($)})}function sn(i,$){return new i({type:"string",format:"emoji",check:"string_format",abort:!1,...f($)})}function ig(i,$){return new i({type:"string",format:"nanoid",check:"string_format",abort:!1,...f($)})}function $g(i,$){return new i({type:"string",format:"cuid",check:"string_format",abort:!1,...f($)})}function vg(i,$){return new i({type:"string",format:"cuid2",check:"string_format",abort:!1,...f($)})}function ng(i,$){return new i({type:"string",format:"ulid",check:"string_format",abort:!1,...f($)})}function gg(i,$){return new i({type:"string",format:"xid",check:"string_format",abort:!1,...f($)})}function rg(i,$){return new i({type:"string",format:"ksuid",check:"string_format",abort:!1,...f($)})}function bg(i,$){return new i({type:"string",format:"ipv4",check:"string_format",abort:!1,...f($)})}function ug(i,$){return new i({type:"string",format:"ipv6",check:"string_format",abort:!1,...f($)})}function p6(i,$){return new i({type:"string",format:"mac",check:"string_format",abort:!1,...f($)})}function Ug(i,$){return new i({type:"string",format:"cidrv4",check:"string_format",abort:!1,...f($)})}function Ig(i,$){return new i({type:"string",format:"cidrv6",check:"string_format",abort:!1,...f($)})}function _g(i,$){return new i({type:"string",format:"base64",check:"string_format",abort:!1,...f($)})}function Dg(i,$){return new i({type:"string",format:"base64url",check:"string_format",abort:!1,...f($)})}function kg(i,$){return new i({type:"string",format:"e164",check:"string_format",abort:!1,...f($)})}function wg(i,$){return new i({type:"string",format:"jwt",check:"string_format",abort:!1,...f($)})}var e6={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function s6(i,$){return new i({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...f($)})}function iu(i,$){return new i({type:"string",format:"date",check:"string_format",...f($)})}function $u(i,$){return new i({type:"string",format:"time",check:"string_format",precision:null,...f($)})}function vu(i,$){return new i({type:"string",format:"duration",check:"string_format",...f($)})}function nu(i,$){return new i({type:"number",checks:[],...f($)})}function gu(i,$){return new i({type:"number",coerce:!0,checks:[],...f($)})}function ru(i,$){return new i({type:"number",check:"number_format",abort:!1,format:"safeint",...f($)})}function bu(i,$){return new i({type:"number",check:"number_format",abort:!1,format:"float32",...f($)})}function uu(i,$){return new i({type:"number",check:"number_format",abort:!1,format:"float64",...f($)})}function Uu(i,$){return new i({type:"number",check:"number_format",abort:!1,format:"int32",...f($)})}function Iu(i,$){return new i({type:"number",check:"number_format",abort:!1,format:"uint32",...f($)})}function _u(i,$){return new i({type:"boolean",...f($)})}function Du(i,$){return new i({type:"boolean",coerce:!0,...f($)})}function ku(i,$){return new i({type:"bigint",...f($)})}function wu(i,$){return new i({type:"bigint",coerce:!0,...f($)})}function ju(i,$){return new i({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...f($)})}function Ou(i,$){return new i({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...f($)})}function Ju(i,$){return new i({type:"symbol",...f($)})}function Pu(i,$){return new i({type:"undefined",...f($)})}function Wu(i,$){return new i({type:"null",...f($)})}function Vu(i){return new i({type:"any"})}function Xu(i){return new i({type:"unknown"})}function fu(i,$){return new i({type:"never",...f($)})}function Qu(i,$){return new i({type:"void",...f($)})}function Ku(i,$){return new i({type:"date",...f($)})}function Gu(i,$){return new i({type:"date",coerce:!0,...f($)})}function Yu(i,$){return new i({type:"nan",...f($)})}function Ji(i,$){return new qn({check:"less_than",...f($),value:i,inclusive:!1})}function bi(i,$){return new qn({check:"less_than",...f($),value:i,inclusive:!0})}function Pi(i,$){return new Mn({check:"greater_than",...f($),value:i,inclusive:!1})}function e(i,$){return new Mn({check:"greater_than",...f($),value:i,inclusive:!0})}function jg(i){return Pi(0,i)}function Og(i){return Ji(0,i)}function Jg(i){return bi(0,i)}function Pg(i){return e(0,i)}function oi(i,$){return new Qb({check:"multiple_of",...f($),value:i})}function mi(i,$){return new Yb({check:"max_size",...f($),maximum:i})}function Wi(i,$){return new Hb({check:"min_size",...f($),minimum:i})}function u$(i,$){return new zb({check:"size_equals",...f($),size:i})}function U$(i,$){return new Sb({check:"max_length",...f($),maximum:i})}function zi(i,$){return new Ab({check:"min_length",...f($),minimum:i})}function I$(i,$){return new lb({check:"length_equals",...f($),length:i})}function S$(i,$){return new Bb({check:"string_format",format:"regex",...f($),pattern:i})}function A$(i){return new Lb({check:"string_format",format:"lowercase",...f(i)})}function l$(i){return new Tb({check:"string_format",format:"uppercase",...f(i)})}function B$(i,$){return new Zb({check:"string_format",format:"includes",...f($),includes:i})}function L$(i,$){return new qb({check:"string_format",format:"starts_with",...f($),prefix:i})}function T$(i,$){return new Mb({check:"string_format",format:"ends_with",...f($),suffix:i})}function Wg(i,$,n){return new xb({check:"property",property:i,schema:$,...f(n)})}function Z$(i,$){return new Nb({check:"mime_type",mime:i,...f($)})}function ki(i){return new tb({check:"overwrite",tx:i})}function q$(i){return ki(($)=>$.normalize(i))}function M$(){return ki((i)=>i.trim())}function x$(){return ki((i)=>i.toLowerCase())}function N$(){return ki((i)=>i.toUpperCase())}function t$(){return ki((i)=>qr(i))}function Hu(i,$,n){return new i({type:"array",element:$,...f(n)})}function $O(i,$,n){return new i({type:"union",options:$,...f(n)})}function vO(i,$,n){return new i({type:"union",options:$,inclusive:!1,...f(n)})}function nO(i,$,n,g){return new i({type:"union",options:n,discriminator:$,...f(g)})}function gO(i,$,n){return new i({type:"intersection",left:$,right:n})}function rO(i,$,n,g){let v=n instanceof Y;return new i({type:"tuple",items:$,rest:v?n:null,...f(v?g:n)})}function bO(i,$,n,g){return new i({type:"record",keyType:$,valueType:n,...f(g)})}function uO(i,$,n,g){return new i({type:"map",keyType:$,valueType:n,...f(g)})}function UO(i,$,n){return new i({type:"set",valueType:$,...f(n)})}function IO(i,$,n){let g=Array.isArray($)?Object.fromEntries($.map((v)=>[v,v])):$;return new i({type:"enum",entries:g,...f(n)})}function _O(i,$,n){return new i({type:"enum",entries:$,...f(n)})}function DO(i,$,n){return new i({type:"literal",values:Array.isArray($)?$:[$],...f(n)})}function zu(i,$){return new i({type:"file",...f($)})}function kO(i,$){return new i({type:"transform",transform:$})}function wO(i,$){return new i({type:"optional",innerType:$})}function jO(i,$){return new i({type:"nullable",innerType:$})}function OO(i,$,n){return new i({type:"default",innerType:$,get defaultValue(){return typeof n==="function"?n():xr(n)}})}function JO(i,$,n){return new i({type:"nonoptional",innerType:$,...f(n)})}function PO(i,$){return new i({type:"success",innerType:$})}function WO(i,$,n){return new i({type:"catch",innerType:$,catchValue:typeof n==="function"?n:()=>n})}function VO(i,$,n){return new i({type:"pipe",in:$,out:n})}function XO(i,$){return new i({type:"readonly",innerType:$})}function fO(i,$,n){return new i({type:"template_literal",parts:$,...f(n)})}function QO(i,$){return new i({type:"lazy",getter:$})}function KO(i,$){return new i({type:"promise",innerType:$})}function Su(i,$,n){let g=f(n);return g.abort??(g.abort=!0),new i({type:"custom",check:"custom",fn:$,...g})}function Au(i,$,n){return new i({type:"custom",check:"custom",fn:$,...f(n)})}function lu(i,$){let n=m1((g)=>{return g.addIssue=(v)=>{if(typeof v==="string")g.issues.push(f$(v,g.value,n._zod.def));else{let r=v;if(r.fatal)r.continue=!1;r.code??(r.code="custom"),r.input??(r.input=g.value),r.inst??(r.inst=n),r.continue??(r.continue=!n._zod.def.abort),g.issues.push(f$(r))}},i(g.value,g)},$);return n}function m1(i,$){let n=new M({check:"custom",...f($)});return n._zod.check=i,n}function Bu(i){let $=new M({check:"describe"});return $._zod.onattach=[(n)=>{let g=m.get(n)??{};m.add(n,{...g,description:i})}],$._zod.check=()=>{},$}function Lu(i){let $=new M({check:"meta"});return $._zod.onattach=[(n)=>{let g=m.get(n)??{};m.add(n,{...g,...i})}],$._zod.check=()=>{},$}function Tu(i,$){let n=f($),g=n.truthy??["true","1","yes","on","y","enabled"],v=n.falsy??["false","0","no","off","n","disabled"];if(n.case!=="sensitive")g=g.map((J)=>typeof J==="string"?J.toLowerCase():J),v=v.map((J)=>typeof J==="string"?J.toLowerCase():J);let r=new Set(g),b=new Set(v),u=i.Codec??Kv,I=i.Boolean??fv,_=new(i.String??b$)({type:"string",error:n.error}),k=new I({type:"boolean",error:n.error}),O=new u({type:"pipe",in:_,out:k,transform:(J,Q)=>{let A=J;if(n.case!=="sensitive")A=A.toLowerCase();if(r.has(A))return!0;else if(b.has(A))return!1;else return Q.issues.push({code:"invalid_value",expected:"stringbool",values:[...r,...b],input:Q.value,inst:O,continue:!1}),{}},reverseTransform:(J,Q)=>{if(J===!0)return g[0]||"true";else return v[0]||"false"},error:n.error});return O}function E$(i,$,n,g={}){let v=f(g),r={...f(g),check:"string_format",type:"string",format:$,fn:typeof n==="function"?n:(u)=>n.test(u),...v};if(n instanceof RegExp)r.pattern=n;return new i(r)}function yi(i){let $=i?.target??"draft-2020-12";if($==="draft-4")$="draft-04";if($==="draft-7")$="draft-07";return{processors:i.processors??{},metadataRegistry:i?.metadata??m,target:$,unrepresentable:i?.unrepresentable??"throw",override:i?.override??(()=>{}),io:i?.io??"output",counter:0,seen:new Map,cycles:i?.cycles??"ref",reused:i?.reused??"inline",external:i?.external??void 0}}function B(i,$,n={path:[],schemaPath:[]}){var g;let v=i._zod.def,r=$.seen.get(i);if(r){if(r.count++,n.schemaPath.includes(i))r.cycle=n.path;return r.schema}let b={schema:{},count:1,cycle:void 0,path:n.path};$.seen.set(i,b);let u=i._zod.toJSONSchema?.();if(u)b.schema=u;else{let _={...n,schemaPath:[...n.schemaPath,i],path:n.path};if(i._zod.processJSONSchema)i._zod.processJSONSchema($,b.schema,_);else{let O=b.schema,J=$.processors[v.type];if(!J)throw Error(`[toJSONSchema]: Non-representable type encountered: ${v.type}`);J(i,$,O,_)}let k=i._zod.parent;if(k){if(!b.ref)b.ref=k;B(k,$,_),$.seen.get(k).isParent=!0}}let I=$.metadataRegistry.get(i);if(I)Object.assign(b.schema,I);if($.io==="input"&&s(i))delete b.schema.examples,delete b.schema.default;if($.io==="input"&&"_prefault"in b.schema)(g=b.schema).default??(g.default=b.schema._prefault);return delete b.schema._prefault,$.seen.get(i).schema}function hi(i,$){let n=i.seen.get($);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let g=new Map;for(let b of i.seen.entries()){let u=i.metadataRegistry.get(b[0])?.id;if(u){let I=g.get(u);if(I&&I!==b[0])throw Error(`Duplicate schema id "${u}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);g.set(u,b[0])}}let v=(b)=>{let u=i.target==="draft-2020-12"?"$defs":"definitions";if(i.external){let k=i.external.registry.get(b[0])?.id,O=i.external.uri??((Q)=>Q);if(k)return{ref:O(k)};let J=b[1].defId??b[1].schema.id??`schema${i.counter++}`;return b[1].defId=J,{defId:J,ref:`${O("__shared")}#/${u}/${J}`}}if(b[1]===n)return{ref:"#"};let U=`${"#"}/${u}/`,_=b[1].schema.id??`__schema${i.counter++}`;return{defId:_,ref:U+_}},r=(b)=>{if(b[1].schema.$ref)return;let u=b[1],{ref:I,defId:U}=v(b);if(u.def={...u.schema},U)u.defId=U;let _=u.schema;for(let k in _)delete _[k];_.$ref=I};if(i.cycles==="throw")for(let b of i.seen.entries()){let u=b[1];if(u.cycle)throw Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
66
-
67
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let b of i.seen.entries()){let u=b[1];if($===b[0]){r(b);continue}if(i.external){let U=i.external.registry.get(b[0])?.id;if($!==b[0]&&U){r(b);continue}}if(i.metadataRegistry.get(b[0])?.id){r(b);continue}if(u.cycle){r(b);continue}if(u.count>1){if(i.reused==="ref"){r(b);continue}}}}function di(i,$){let n=i.seen.get($);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let g=(u)=>{let I=i.seen.get(u);if(I.ref===null)return;let U=I.def??I.schema,_={...U},k=I.ref;if(I.ref=null,k){g(k);let J=i.seen.get(k),Q=J.schema;if(Q.$ref&&(i.target==="draft-07"||i.target==="draft-04"||i.target==="openapi-3.0"))U.allOf=U.allOf??[],U.allOf.push(Q);else Object.assign(U,Q);if(Object.assign(U,_),u._zod.parent===k)for(let z in U){if(z==="$ref"||z==="allOf")continue;if(!(z in _))delete U[z]}if(Q.$ref&&J.def)for(let z in U){if(z==="$ref"||z==="allOf")continue;if(z in J.def&&JSON.stringify(U[z])===JSON.stringify(J.def[z]))delete U[z]}}let O=u._zod.parent;if(O&&O!==k){g(O);let J=i.seen.get(O);if(J?.schema.$ref){if(U.$ref=J.schema.$ref,J.def)for(let Q in U){if(Q==="$ref"||Q==="allOf")continue;if(Q in J.def&&JSON.stringify(U[Q])===JSON.stringify(J.def[Q]))delete U[Q]}}}i.override({zodSchema:u,jsonSchema:U,path:I.path??[]})};for(let u of[...i.seen.entries()].reverse())g(u[0]);let v={};if(i.target==="draft-2020-12")v.$schema="https://json-schema.org/draft/2020-12/schema";else if(i.target==="draft-07")v.$schema="http://json-schema.org/draft-07/schema#";else if(i.target==="draft-04")v.$schema="http://json-schema.org/draft-04/schema#";else if(i.target==="openapi-3.0");if(i.external?.uri){let u=i.external.registry.get($)?.id;if(!u)throw Error("Schema is missing an `id` property");v.$id=i.external.uri(u)}Object.assign(v,n.def??n.schema);let r=i.metadataRegistry.get($)?.id;if(r!==void 0&&v.id===r)delete v.id;let b=i.external?.defs??{};for(let u of i.seen.entries()){let I=u[1];if(I.def&&I.defId){if(I.def.id===I.defId)delete I.def.id;b[I.defId]=I.def}}if(i.external);else if(Object.keys(b).length>0)if(i.target==="draft-2020-12")v.$defs=b;else v.definitions=b;try{let u=JSON.parse(JSON.stringify(v));return Object.defineProperty(u,"~standard",{value:{...$["~standard"],jsonSchema:{input:c$($,"input",i.processors),output:c$($,"output",i.processors)}},enumerable:!1,writable:!1}),u}catch(u){throw Error("Error converting schema to JSON.")}}function s(i,$){let n=$??{seen:new Set};if(n.seen.has(i))return!1;n.seen.add(i);let g=i._zod.def;if(g.type==="transform")return!0;if(g.type==="array")return s(g.element,n);if(g.type==="set")return s(g.valueType,n);if(g.type==="lazy")return s(g.getter(),n);if(g.type==="promise"||g.type==="optional"||g.type==="nonoptional"||g.type==="nullable"||g.type==="readonly"||g.type==="default"||g.type==="prefault")return s(g.innerType,n);if(g.type==="intersection")return s(g.left,n)||s(g.right,n);if(g.type==="record"||g.type==="map")return s(g.keyType,n)||s(g.valueType,n);if(g.type==="pipe"){if(i._zod.traits.has("$ZodCodec"))return!0;return s(g.in,n)||s(g.out,n)}if(g.type==="object"){for(let v in g.shape)if(s(g.shape[v],n))return!0;return!1}if(g.type==="union"){for(let v of g.options)if(s(v,n))return!0;return!1}if(g.type==="tuple"){for(let v of g.items)if(s(v,n))return!0;if(g.rest&&s(g.rest,n))return!0;return!1}return!1}var Zu=(i,$={})=>(n)=>{let g=yi({...n,processors:$});return B(i,g),hi(g,i),di(g,i)},c$=(i,$,n={})=>(g)=>{let{libraryOptions:v,target:r}=g??{},b=yi({...v??{},target:r,io:$,processors:n});return B(i,b),hi(b,i),di(b,i)};var GO={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},qu=(i,$,n,g)=>{let v=n;v.type="string";let{minimum:r,maximum:b,format:u,patterns:I,contentEncoding:U}=i._zod.bag;if(typeof r==="number")v.minLength=r;if(typeof b==="number")v.maxLength=b;if(u){if(v.format=GO[u]??u,v.format==="")delete v.format;if(u==="time")delete v.format}if(U)v.contentEncoding=U;if(I&&I.size>0){let _=[...I];if(_.length===1)v.pattern=_[0].source;else if(_.length>1)v.allOf=[..._.map((k)=>({...$.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"?{type:"string"}:{},pattern:k.source}))]}},Mu=(i,$,n,g)=>{let v=n,{minimum:r,maximum:b,format:u,multipleOf:I,exclusiveMaximum:U,exclusiveMinimum:_}=i._zod.bag;if(typeof u==="string"&&u.includes("int"))v.type="integer";else v.type="number";let k=typeof _==="number"&&_>=(r??Number.NEGATIVE_INFINITY),O=typeof U==="number"&&U<=(b??Number.POSITIVE_INFINITY),J=$.target==="draft-04"||$.target==="openapi-3.0";if(k)if(J)v.minimum=_,v.exclusiveMinimum=!0;else v.exclusiveMinimum=_;else if(typeof r==="number")v.minimum=r;if(O)if(J)v.maximum=U,v.exclusiveMaximum=!0;else v.exclusiveMaximum=U;else if(typeof b==="number")v.maximum=b;if(typeof I==="number")v.multipleOf=I},xu=(i,$,n,g)=>{n.type="boolean"},Nu=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},tu=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},Eu=(i,$,n,g)=>{if($.target==="openapi-3.0")n.type="string",n.nullable=!0,n.enum=[null];else n.type="null"},cu=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},Cu=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},Ru=(i,$,n,g)=>{n.not={}},Fu=(i,$,n,g)=>{},ou=(i,$,n,g)=>{},mu=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},yu=(i,$,n,g)=>{let v=i._zod.def,r=_v(v.entries);if(r.every((b)=>typeof b==="number"))n.type="number";if(r.every((b)=>typeof b==="string"))n.type="string";n.enum=r},hu=(i,$,n,g)=>{let v=i._zod.def,r=[];for(let b of v.values)if(b===void 0){if($.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof b==="bigint")if($.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else r.push(Number(b));else r.push(b);if(r.length===0);else if(r.length===1){let b=r[0];if(n.type=b===null?"null":typeof b,$.target==="draft-04"||$.target==="openapi-3.0")n.enum=[b];else n.const=b}else{if(r.every((b)=>typeof b==="number"))n.type="number";if(r.every((b)=>typeof b==="string"))n.type="string";if(r.every((b)=>typeof b==="boolean"))n.type="boolean";if(r.every((b)=>b===null))n.type="null";n.enum=r}},du=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},au=(i,$,n,g)=>{let v=n,r=i._zod.pattern;if(!r)throw Error("Pattern not found in template literal");v.type="string",v.pattern=r.source},pu=(i,$,n,g)=>{let v=n,r={type:"string",format:"binary",contentEncoding:"binary"},{minimum:b,maximum:u,mime:I}=i._zod.bag;if(b!==void 0)r.minLength=b;if(u!==void 0)r.maxLength=u;if(I)if(I.length===1)r.contentMediaType=I[0],Object.assign(v,r);else Object.assign(v,r),v.anyOf=I.map((U)=>({contentMediaType:U}));else Object.assign(v,r)},eu=(i,$,n,g)=>{n.type="boolean"},su=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},iU=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},$U=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},vU=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},nU=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},gU=(i,$,n,g)=>{let v=n,r=i._zod.def,{minimum:b,maximum:u}=i._zod.bag;if(typeof b==="number")v.minItems=b;if(typeof u==="number")v.maxItems=u;v.type="array",v.items=B(r.element,$,{...g,path:[...g.path,"items"]})},rU=(i,$,n,g)=>{let v=n,r=i._zod.def;v.type="object",v.properties={};let b=r.shape;for(let U in b)v.properties[U]=B(b[U],$,{...g,path:[...g.path,"properties",U]});let u=new Set(Object.keys(b)),I=new Set([...u].filter((U)=>{let _=r.shape[U]._zod;if($.io==="input")return _.optin===void 0;else return _.optout===void 0}));if(I.size>0)v.required=Array.from(I);if(r.catchall?._zod.def.type==="never")v.additionalProperties=!1;else if(!r.catchall){if($.io==="output")v.additionalProperties=!1}else if(r.catchall)v.additionalProperties=B(r.catchall,$,{...g,path:[...g.path,"additionalProperties"]})},Xg=(i,$,n,g)=>{let v=i._zod.def,r=v.inclusive===!1,b=v.options.map((u,I)=>B(u,$,{...g,path:[...g.path,r?"oneOf":"anyOf",I]}));if(r)n.oneOf=b;else n.anyOf=b},bU=(i,$,n,g)=>{let v=i._zod.def,r=B(v.left,$,{...g,path:[...g.path,"allOf",0]}),b=B(v.right,$,{...g,path:[...g.path,"allOf",1]}),u=(U)=>("allOf"in U)&&Object.keys(U).length===1,I=[...u(r)?r.allOf:[r],...u(b)?b.allOf:[b]];n.allOf=I},uU=(i,$,n,g)=>{let v=n,r=i._zod.def;v.type="array";let b=$.target==="draft-2020-12"?"prefixItems":"items",u=$.target==="draft-2020-12"?"items":$.target==="openapi-3.0"?"items":"additionalItems",I=r.items.map((O,J)=>B(O,$,{...g,path:[...g.path,b,J]})),U=r.rest?B(r.rest,$,{...g,path:[...g.path,u,...$.target==="openapi-3.0"?[r.items.length]:[]]}):null;if($.target==="draft-2020-12"){if(v.prefixItems=I,U)v.items=U}else if($.target==="openapi-3.0"){if(v.items={anyOf:I},U)v.items.anyOf.push(U);if(v.minItems=I.length,!U)v.maxItems=I.length}else if(v.items=I,U)v.additionalItems=U;let{minimum:_,maximum:k}=i._zod.bag;if(typeof _==="number")v.minItems=_;if(typeof k==="number")v.maxItems=k},UU=(i,$,n,g)=>{let v=n,r=i._zod.def;v.type="object";let b=r.keyType,I=b._zod.bag?.patterns;if(r.mode==="loose"&&I&&I.size>0){let _=B(r.valueType,$,{...g,path:[...g.path,"patternProperties","*"]});v.patternProperties={};for(let k of I)v.patternProperties[k.source]=_}else{if($.target==="draft-07"||$.target==="draft-2020-12")v.propertyNames=B(r.keyType,$,{...g,path:[...g.path,"propertyNames"]});v.additionalProperties=B(r.valueType,$,{...g,path:[...g.path,"additionalProperties"]})}let U=b._zod.values;if(U){let _=[...U].filter((k)=>typeof k==="string"||typeof k==="number");if(_.length>0)v.required=_}},IU=(i,$,n,g)=>{let v=i._zod.def,r=B(v.innerType,$,g),b=$.seen.get(i);if($.target==="openapi-3.0")b.ref=v.innerType,n.nullable=!0;else n.anyOf=[r,{type:"null"}]},_U=(i,$,n,g)=>{let v=i._zod.def;B(v.innerType,$,g);let r=$.seen.get(i);r.ref=v.innerType},DU=(i,$,n,g)=>{let v=i._zod.def;B(v.innerType,$,g);let r=$.seen.get(i);r.ref=v.innerType,n.default=JSON.parse(JSON.stringify(v.defaultValue))},kU=(i,$,n,g)=>{let v=i._zod.def;B(v.innerType,$,g);let r=$.seen.get(i);if(r.ref=v.innerType,$.io==="input")n._prefault=JSON.parse(JSON.stringify(v.defaultValue))},wU=(i,$,n,g)=>{let v=i._zod.def;B(v.innerType,$,g);let r=$.seen.get(i);r.ref=v.innerType;let b;try{b=v.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}n.default=b},jU=(i,$,n,g)=>{let v=i._zod.def,r=v.in._zod.traits.has("$ZodTransform"),b=$.io==="input"?r?v.out:v.in:v.out;B(b,$,g);let u=$.seen.get(i);u.ref=b},OU=(i,$,n,g)=>{let v=i._zod.def;B(v.innerType,$,g);let r=$.seen.get(i);r.ref=v.innerType,n.readOnly=!0},JU=(i,$,n,g)=>{let v=i._zod.def;B(v.innerType,$,g);let r=$.seen.get(i);r.ref=v.innerType},fg=(i,$,n,g)=>{let v=i._zod.def;B(v.innerType,$,g);let r=$.seen.get(i);r.ref=v.innerType},PU=(i,$,n,g)=>{let v=i._zod.innerType;B(v,$,g);let r=$.seen.get(i);r.ref=v},Vg={string:qu,number:Mu,boolean:xu,bigint:Nu,symbol:tu,null:Eu,undefined:cu,void:Cu,never:Ru,any:Fu,unknown:ou,date:mu,enum:yu,literal:hu,nan:du,template_literal:au,file:pu,success:eu,custom:su,function:iU,transform:$U,map:vU,set:nU,array:gU,object:rU,union:Xg,intersection:bU,tuple:uU,record:UU,nullable:IU,nonoptional:_U,default:DU,prefault:kU,catch:wU,pipe:jU,readonly:OU,promise:JU,optional:fg,lazy:PU};function Qg(i,$){if("_idmap"in i){let g=i,v=yi({...$,processors:Vg}),r={};for(let I of g._idmap.entries()){let[U,_]=I;B(_,v)}let b={},u={registry:g,uri:$?.uri,defs:r};v.external=u;for(let I of g._idmap.entries()){let[U,_]=I;hi(v,_),b[U]=di(v,_)}if(Object.keys(r).length>0){let I=v.target==="draft-2020-12"?"$defs":"definitions";b.__shared={[I]:r}}return{schemas:b}}let n=yi({...$,processors:Vg});return B(i,n),hi(n,i),di(n,i)}class WU{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(i){this.ctx.counter=i}get seen(){return this.ctx.seen}constructor(i){let $=i?.target??"draft-2020-12";if($==="draft-4")$="draft-04";if($==="draft-7")$="draft-07";this.ctx=yi({processors:Vg,target:$,...i?.metadata&&{metadata:i.metadata},...i?.unrepresentable&&{unrepresentable:i.unrepresentable},...i?.override&&{override:i.override},...i?.io&&{io:i.io}})}process(i,$={path:[],schemaPath:[]}){return B(i,this.ctx,$)}emit(i,$){if($){if($.cycles)this.ctx.cycles=$.cycles;if($.reused)this.ctx.reused=$.reused;if($.external)this.ctx.external=$.external}hi(this.ctx,i);let n=di(this.ctx,i),{"~standard":g,...v}=n;return v}}var y1={};var Bv={};Gi(Bv,{xor:()=>E0,xid:()=>I0,void:()=>Z0,uuidv7:()=>$0,uuidv6:()=>i0,uuidv4:()=>s1,uuid:()=>e1,url:()=>v0,unknown:()=>_$,union:()=>dg,undefined:()=>L0,ulid:()=>U0,uint64:()=>l0,uint32:()=>z0,tuple:()=>eU,transform:()=>pg,templateLiteral:()=>iD,symbol:()=>B0,superRefine:()=>HI,success:()=>a0,stringbool:()=>UD,stringFormat:()=>X0,string:()=>Lv,strictObject:()=>N0,set:()=>o0,refine:()=>YI,record:()=>sU,readonly:()=>VI,promise:()=>$D,preprocess:()=>_D,prefault:()=>DI,pipe:()=>Ag,partialRecord:()=>C0,optional:()=>Zv,object:()=>x0,number:()=>MU,nullish:()=>d0,nullable:()=>qv,null:()=>cU,nonoptional:()=>kI,never:()=>hg,nativeEnum:()=>m0,nanoid:()=>r0,nan:()=>p0,meta:()=>bD,map:()=>F0,mac:()=>k0,looseRecord:()=>R0,looseObject:()=>t0,literal:()=>y0,lazy:()=>QI,ksuid:()=>_0,keyof:()=>M0,jwt:()=>V0,json:()=>ID,ipv6:()=>w0,ipv4:()=>D0,invertCodec:()=>s0,intersection:()=>aU,int64:()=>A0,int32:()=>H0,int:()=>Sg,instanceof:()=>uD,httpUrl:()=>n0,hostname:()=>f0,hex:()=>Q0,hash:()=>K0,guid:()=>p1,function:()=>vD,float64:()=>Y0,float32:()=>G0,file:()=>h0,exactOptional:()=>bI,enum:()=>ag,emoji:()=>g0,email:()=>a1,e164:()=>W0,discriminatedUnion:()=>c0,describe:()=>rD,date:()=>q0,custom:()=>gD,cuid2:()=>u0,cuid:()=>b0,codec:()=>e0,cidrv6:()=>O0,cidrv4:()=>j0,check:()=>nD,catch:()=>OI,boolean:()=>xU,bigint:()=>S0,base64url:()=>P0,base64:()=>J0,array:()=>tv,any:()=>T0,_function:()=>vD,_default:()=>II,_ZodString:()=>lg,ZodXor:()=>yU,ZodXID:()=>xg,ZodVoid:()=>oU,ZodUnknown:()=>RU,ZodUnion:()=>cv,ZodUndefined:()=>tU,ZodUUID:()=>Vi,ZodURL:()=>xv,ZodULID:()=>Mg,ZodType:()=>H,ZodTuple:()=>pU,ZodTransform:()=>gI,ZodTemplateLiteral:()=>XI,ZodSymbol:()=>NU,ZodSuccess:()=>wI,ZodStringFormat:()=>q,ZodString:()=>o$,ZodSet:()=>$I,ZodRecord:()=>R$,ZodReadonly:()=>WI,ZodPromise:()=>KI,ZodPreprocess:()=>PI,ZodPrefault:()=>_I,ZodPipe:()=>Cv,ZodOptional:()=>eg,ZodObject:()=>Ev,ZodNumberFormat:()=>D$,ZodNumber:()=>y$,ZodNullable:()=>uI,ZodNull:()=>EU,ZodNonOptional:()=>sg,ZodNever:()=>FU,ZodNanoID:()=>Tg,ZodNaN:()=>JI,ZodMap:()=>iI,ZodMAC:()=>qU,ZodLiteral:()=>vI,ZodLazy:()=>fI,ZodKSUID:()=>Ng,ZodJWT:()=>mg,ZodIntersection:()=>dU,ZodIPv6:()=>Eg,ZodIPv4:()=>tg,ZodGUID:()=>Tv,ZodFunction:()=>GI,ZodFile:()=>nI,ZodExactOptional:()=>rI,ZodEnum:()=>F$,ZodEmoji:()=>Lg,ZodEmail:()=>Bg,ZodE164:()=>og,ZodDiscriminatedUnion:()=>hU,ZodDefault:()=>UI,ZodDate:()=>Nv,ZodCustomStringFormat:()=>m$,ZodCustom:()=>Fv,ZodCodec:()=>Rv,ZodCatch:()=>jI,ZodCUID2:()=>qg,ZodCUID:()=>Zg,ZodCIDRv6:()=>Cg,ZodCIDRv4:()=>cg,ZodBoolean:()=>h$,ZodBigIntFormat:()=>yg,ZodBigInt:()=>d$,ZodBase64URL:()=>Fg,ZodBase64:()=>Rg,ZodArray:()=>mU,ZodAny:()=>CU});var Kg={};Gi(Kg,{uppercase:()=>l$,trim:()=>M$,toUpperCase:()=>N$,toLowerCase:()=>x$,startsWith:()=>L$,slugify:()=>t$,size:()=>u$,regex:()=>S$,property:()=>Wg,positive:()=>jg,overwrite:()=>ki,normalize:()=>q$,nonpositive:()=>Jg,nonnegative:()=>Pg,negative:()=>Og,multipleOf:()=>oi,minSize:()=>Wi,minLength:()=>zi,mime:()=>Z$,maxSize:()=>mi,maxLength:()=>U$,lte:()=>bi,lt:()=>Ji,lowercase:()=>A$,length:()=>I$,includes:()=>B$,gte:()=>e,gt:()=>Pi,endsWith:()=>T$});var C$={};Gi(C$,{time:()=>fU,duration:()=>QU,datetime:()=>VU,date:()=>XU,ZodISOTime:()=>Hg,ZodISODuration:()=>zg,ZodISODateTime:()=>Gg,ZodISODate:()=>Yg});var Gg=w("ZodISODateTime",(i,$)=>{sb.init(i,$),q.init(i,$)});function VU(i){return s6(Gg,i)}var Yg=w("ZodISODate",(i,$)=>{i4.init(i,$),q.init(i,$)});function XU(i){return iu(Yg,i)}var Hg=w("ZodISOTime",(i,$)=>{$4.init(i,$),q.init(i,$)});function fU(i){return $u(Hg,i)}var zg=w("ZodISODuration",(i,$)=>{v4.init(i,$),q.init(i,$)});function QU(i){return vu(zg,i)}var h1=(i,$)=>{Ov.init(i,$),i.name="ZodError",Object.defineProperties(i,{format:{value:(n)=>Pv(i,n)},flatten:{value:(n)=>Jv(i,n)},addIssue:{value:(n)=>{i.issues.push(n),i.message=JSON.stringify(i.issues,V$,2)}},addIssues:{value:(n)=>{i.issues.push(...n),i.message=JSON.stringify(i.issues,V$,2)}},isEmpty:{get(){return i.issues.length===0}}})},HO=w("ZodError",h1),ni=w("ZodError",h1,{Parent:Error});var KU=Q$(ni),GU=K$(ni),YU=G$(ni),HU=Y$(ni),zU=Hn(ni),SU=zn(ni),AU=Sn(ni),lU=An(ni),BU=ln(ni),LU=Bn(ni),TU=Ln(ni),ZU=Tn(ni);var d1=new WeakMap;function Mv(i,$,n){let g=Object.getPrototypeOf(i),v=d1.get(g);if(!v)v=new Set,d1.set(g,v);if(v.has($))return;v.add($);for(let r in n){let b=n[r];Object.defineProperty(g,r,{configurable:!0,enumerable:!1,get(){let u=b.bind(this);return Object.defineProperty(this,r,{configurable:!0,writable:!0,enumerable:!0,value:u}),u},set(u){Object.defineProperty(this,r,{configurable:!0,writable:!0,enumerable:!0,value:u})}})}}var H=w("ZodType",(i,$)=>{return Y.init(i,$),Object.assign(i["~standard"],{jsonSchema:{input:c$(i,"input"),output:c$(i,"output")}}),i.toJSONSchema=Zu(i,{}),i.def=$,i.type=$.type,Object.defineProperty(i,"_def",{value:$}),i.parse=(n,g)=>KU(i,n,g,{callee:i.parse}),i.safeParse=(n,g)=>YU(i,n,g),i.parseAsync=async(n,g)=>GU(i,n,g,{callee:i.parseAsync}),i.safeParseAsync=async(n,g)=>HU(i,n,g),i.spa=i.safeParseAsync,i.encode=(n,g)=>zU(i,n,g),i.decode=(n,g)=>SU(i,n,g),i.encodeAsync=async(n,g)=>AU(i,n,g),i.decodeAsync=async(n,g)=>lU(i,n,g),i.safeEncode=(n,g)=>BU(i,n,g),i.safeDecode=(n,g)=>LU(i,n,g),i.safeEncodeAsync=async(n,g)=>TU(i,n,g),i.safeDecodeAsync=async(n,g)=>ZU(i,n,g),Mv(i,"ZodType",{check(...n){let g=this.def;return this.clone(X.mergeDefs(g,{checks:[...g.checks??[],...n.map((v)=>typeof v==="function"?{_zod:{check:v,def:{check:"custom"},onattach:[]}}:v)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,g){return a(this,n,g)},brand(){return this},register(n,g){return n.add(this,g),this},refine(n,g){return this.check(YI(n,g))},superRefine(n,g){return this.check(HI(n,g))},overwrite(n){return this.check(ki(n))},optional(){return Zv(this)},exactOptional(){return bI(this)},nullable(){return qv(this)},nullish(){return Zv(qv(this))},nonoptional(n){return kI(this,n)},array(){return tv(this)},or(n){return dg([this,n])},and(n){return aU(this,n)},transform(n){return Ag(this,pg(n))},default(n){return II(this,n)},prefault(n){return DI(this,n)},catch(n){return OI(this,n)},pipe(n){return Ag(this,n)},readonly(){return VI(this)},describe(n){let g=this.clone();return m.add(g,{description:n}),g},meta(...n){if(n.length===0)return m.get(this);let g=this.clone();return m.add(g,n[0]),g},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(i,"description",{get(){return m.get(i)?.description},configurable:!0}),i}),lg=w("_ZodString",(i,$)=>{b$.init(i,$),H.init(i,$),i._zod.processJSONSchema=(g,v,r)=>qu(i,g,v,r);let n=i._zod.bag;i.format=n.format??null,i.minLength=n.minimum??null,i.maxLength=n.maximum??null,Mv(i,"_ZodString",{regex(...g){return this.check(S$(...g))},includes(...g){return this.check(B$(...g))},startsWith(...g){return this.check(L$(...g))},endsWith(...g){return this.check(T$(...g))},min(...g){return this.check(zi(...g))},max(...g){return this.check(U$(...g))},length(...g){return this.check(I$(...g))},nonempty(...g){return this.check(zi(1,...g))},lowercase(g){return this.check(A$(g))},uppercase(g){return this.check(l$(g))},trim(){return this.check(M$())},normalize(...g){return this.check(q$(...g))},toLowerCase(){return this.check(x$())},toUpperCase(){return this.check(N$())},slugify(){return this.check(t$())}})}),o$=w("ZodString",(i,$)=>{b$.init(i,$),lg.init(i,$),i.email=(n)=>i.check(hn(Bg,n)),i.url=(n)=>i.check(lv(xv,n)),i.jwt=(n)=>i.check(wg(mg,n)),i.emoji=(n)=>i.check(sn(Lg,n)),i.guid=(n)=>i.check(Av(Tv,n)),i.uuid=(n)=>i.check(dn(Vi,n)),i.uuidv4=(n)=>i.check(an(Vi,n)),i.uuidv6=(n)=>i.check(pn(Vi,n)),i.uuidv7=(n)=>i.check(en(Vi,n)),i.nanoid=(n)=>i.check(ig(Tg,n)),i.guid=(n)=>i.check(Av(Tv,n)),i.cuid=(n)=>i.check($g(Zg,n)),i.cuid2=(n)=>i.check(vg(qg,n)),i.ulid=(n)=>i.check(ng(Mg,n)),i.base64=(n)=>i.check(_g(Rg,n)),i.base64url=(n)=>i.check(Dg(Fg,n)),i.xid=(n)=>i.check(gg(xg,n)),i.ksuid=(n)=>i.check(rg(Ng,n)),i.ipv4=(n)=>i.check(bg(tg,n)),i.ipv6=(n)=>i.check(ug(Eg,n)),i.cidrv4=(n)=>i.check(Ug(cg,n)),i.cidrv6=(n)=>i.check(Ig(Cg,n)),i.e164=(n)=>i.check(kg(og,n)),i.datetime=(n)=>i.check(VU(n)),i.date=(n)=>i.check(XU(n)),i.time=(n)=>i.check(fU(n)),i.duration=(n)=>i.check(QU(n))});function Lv(i){return d6(o$,i)}var q=w("ZodStringFormat",(i,$)=>{Z.init(i,$),lg.init(i,$)}),Bg=w("ZodEmail",(i,$)=>{Fb.init(i,$),q.init(i,$)});function a1(i){return hn(Bg,i)}var Tv=w("ZodGUID",(i,$)=>{Cb.init(i,$),q.init(i,$)});function p1(i){return Av(Tv,i)}var Vi=w("ZodUUID",(i,$)=>{Rb.init(i,$),q.init(i,$)});function e1(i){return dn(Vi,i)}function s1(i){return an(Vi,i)}function i0(i){return pn(Vi,i)}function $0(i){return en(Vi,i)}var xv=w("ZodURL",(i,$)=>{ob.init(i,$),q.init(i,$)});function v0(i){return lv(xv,i)}function n0(i){return lv(xv,{protocol:ri.httpProtocol,hostname:ri.domain,...X.normalizeParams(i)})}var Lg=w("ZodEmoji",(i,$)=>{mb.init(i,$),q.init(i,$)});function g0(i){return sn(Lg,i)}var Tg=w("ZodNanoID",(i,$)=>{yb.init(i,$),q.init(i,$)});function r0(i){return ig(Tg,i)}var Zg=w("ZodCUID",(i,$)=>{hb.init(i,$),q.init(i,$)});function b0(i){return $g(Zg,i)}var qg=w("ZodCUID2",(i,$)=>{db.init(i,$),q.init(i,$)});function u0(i){return vg(qg,i)}var Mg=w("ZodULID",(i,$)=>{ab.init(i,$),q.init(i,$)});function U0(i){return ng(Mg,i)}var xg=w("ZodXID",(i,$)=>{pb.init(i,$),q.init(i,$)});function I0(i){return gg(xg,i)}var Ng=w("ZodKSUID",(i,$)=>{eb.init(i,$),q.init(i,$)});function _0(i){return rg(Ng,i)}var tg=w("ZodIPv4",(i,$)=>{n4.init(i,$),q.init(i,$)});function D0(i){return bg(tg,i)}var qU=w("ZodMAC",(i,$)=>{r4.init(i,$),q.init(i,$)});function k0(i){return p6(qU,i)}var Eg=w("ZodIPv6",(i,$)=>{g4.init(i,$),q.init(i,$)});function w0(i){return ug(Eg,i)}var cg=w("ZodCIDRv4",(i,$)=>{b4.init(i,$),q.init(i,$)});function j0(i){return Ug(cg,i)}var Cg=w("ZodCIDRv6",(i,$)=>{u4.init(i,$),q.init(i,$)});function O0(i){return Ig(Cg,i)}var Rg=w("ZodBase64",(i,$)=>{I4.init(i,$),q.init(i,$)});function J0(i){return _g(Rg,i)}var Fg=w("ZodBase64URL",(i,$)=>{_4.init(i,$),q.init(i,$)});function P0(i){return Dg(Fg,i)}var og=w("ZodE164",(i,$)=>{D4.init(i,$),q.init(i,$)});function W0(i){return kg(og,i)}var mg=w("ZodJWT",(i,$)=>{k4.init(i,$),q.init(i,$)});function V0(i){return wg(mg,i)}var m$=w("ZodCustomStringFormat",(i,$)=>{w4.init(i,$),q.init(i,$)});function X0(i,$,n={}){return E$(m$,i,$,n)}function f0(i){return E$(m$,"hostname",ri.hostname,i)}function Q0(i){return E$(m$,"hex",ri.hex,i)}function K0(i,$){let n=$?.enc??"hex",g=`${i}_${n}`,v=ri[g];if(!v)throw Error(`Unrecognized hash format: ${g}`);return E$(m$,g,v,$)}var y$=w("ZodNumber",(i,$)=>{Cn.init(i,$),H.init(i,$),i._zod.processJSONSchema=(g,v,r)=>Mu(i,g,v,r),Mv(i,"ZodNumber",{gt(g,v){return this.check(Pi(g,v))},gte(g,v){return this.check(e(g,v))},min(g,v){return this.check(e(g,v))},lt(g,v){return this.check(Ji(g,v))},lte(g,v){return this.check(bi(g,v))},max(g,v){return this.check(bi(g,v))},int(g){return this.check(Sg(g))},safe(g){return this.check(Sg(g))},positive(g){return this.check(Pi(0,g))},nonnegative(g){return this.check(e(0,g))},negative(g){return this.check(Ji(0,g))},nonpositive(g){return this.check(bi(0,g))},multipleOf(g,v){return this.check(oi(g,v))},step(g,v){return this.check(oi(g,v))},finite(){return this}});let n=i._zod.bag;i.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,i.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,i.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??0.5),i.isFinite=!0,i.format=n.format??null});function MU(i){return nu(y$,i)}var D$=w("ZodNumberFormat",(i,$)=>{j4.init(i,$),y$.init(i,$)});function Sg(i){return ru(D$,i)}function G0(i){return bu(D$,i)}function Y0(i){return uu(D$,i)}function H0(i){return Uu(D$,i)}function z0(i){return Iu(D$,i)}var h$=w("ZodBoolean",(i,$)=>{fv.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>xu(i,n,g,v)});function xU(i){return _u(h$,i)}var d$=w("ZodBigInt",(i,$)=>{Rn.init(i,$),H.init(i,$),i._zod.processJSONSchema=(g,v,r)=>Nu(i,g,v,r),i.gte=(g,v)=>i.check(e(g,v)),i.min=(g,v)=>i.check(e(g,v)),i.gt=(g,v)=>i.check(Pi(g,v)),i.gte=(g,v)=>i.check(e(g,v)),i.min=(g,v)=>i.check(e(g,v)),i.lt=(g,v)=>i.check(Ji(g,v)),i.lte=(g,v)=>i.check(bi(g,v)),i.max=(g,v)=>i.check(bi(g,v)),i.positive=(g)=>i.check(Pi(BigInt(0),g)),i.negative=(g)=>i.check(Ji(BigInt(0),g)),i.nonpositive=(g)=>i.check(bi(BigInt(0),g)),i.nonnegative=(g)=>i.check(e(BigInt(0),g)),i.multipleOf=(g,v)=>i.check(oi(g,v));let n=i._zod.bag;i.minValue=n.minimum??null,i.maxValue=n.maximum??null,i.format=n.format??null});function S0(i){return ku(d$,i)}var yg=w("ZodBigIntFormat",(i,$)=>{O4.init(i,$),d$.init(i,$)});function A0(i){return ju(yg,i)}function l0(i){return Ou(yg,i)}var NU=w("ZodSymbol",(i,$)=>{J4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>tu(i,n,g,v)});function B0(i){return Ju(NU,i)}var tU=w("ZodUndefined",(i,$)=>{P4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>cu(i,n,g,v)});function L0(i){return Pu(tU,i)}var EU=w("ZodNull",(i,$)=>{W4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>Eu(i,n,g,v)});function cU(i){return Wu(EU,i)}var CU=w("ZodAny",(i,$)=>{V4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>Fu(i,n,g,v)});function T0(){return Vu(CU)}var RU=w("ZodUnknown",(i,$)=>{X4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>ou(i,n,g,v)});function _$(){return Xu(RU)}var FU=w("ZodNever",(i,$)=>{f4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>Ru(i,n,g,v)});function hg(i){return fu(FU,i)}var oU=w("ZodVoid",(i,$)=>{Q4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>Cu(i,n,g,v)});function Z0(i){return Qu(oU,i)}var Nv=w("ZodDate",(i,$)=>{K4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(g,v,r)=>mu(i,g,v,r),i.min=(g,v)=>i.check(e(g,v)),i.max=(g,v)=>i.check(bi(g,v));let n=i._zod.bag;i.minDate=n.minimum?new Date(n.minimum):null,i.maxDate=n.maximum?new Date(n.maximum):null});function q0(i){return Ku(Nv,i)}var mU=w("ZodArray",(i,$)=>{G4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>gU(i,n,g,v),i.element=$.element,Mv(i,"ZodArray",{min(n,g){return this.check(zi(n,g))},nonempty(n){return this.check(zi(1,n))},max(n,g){return this.check(U$(n,g))},length(n,g){return this.check(I$(n,g))},unwrap(){return this.element}})});function tv(i,$){return Hu(mU,i,$)}function M0(i){let $=i._zod.def.shape;return ag(Object.keys($))}var Ev=w("ZodObject",(i,$)=>{Y4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>rU(i,n,g,v),X.defineLazy(i,"shape",()=>{return $.shape}),Mv(i,"ZodObject",{keyof(){return ag(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:_$()})},loose(){return this.clone({...this._zod.def,catchall:_$()})},strict(){return this.clone({...this._zod.def,catchall:hg()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return X.extend(this,n)},safeExtend(n){return X.safeExtend(this,n)},merge(n){return X.merge(this,n)},pick(n){return X.pick(this,n)},omit(n){return X.omit(this,n)},partial(...n){return X.partial(eg,this,n[0])},required(...n){return X.required(sg,this,n[0])}})});function x0(i,$){let n={type:"object",shape:i??{},...X.normalizeParams($)};return new Ev(n)}function N0(i,$){return new Ev({type:"object",shape:i,catchall:hg(),...X.normalizeParams($)})}function t0(i,$){return new Ev({type:"object",shape:i,catchall:_$(),...X.normalizeParams($)})}var cv=w("ZodUnion",(i,$)=>{Qv.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>Xg(i,n,g,v),i.options=$.options});function dg(i,$){return new cv({type:"union",options:i,...X.normalizeParams($)})}var yU=w("ZodXor",(i,$)=>{cv.init(i,$),H4.init(i,$),i._zod.processJSONSchema=(n,g,v)=>Xg(i,n,g,v),i.options=$.options});function E0(i,$){return new yU({type:"union",options:i,inclusive:!1,...X.normalizeParams($)})}var hU=w("ZodDiscriminatedUnion",(i,$)=>{cv.init(i,$),z4.init(i,$)});function c0(i,$,n){return new hU({type:"union",options:$,discriminator:i,...X.normalizeParams(n)})}var dU=w("ZodIntersection",(i,$)=>{S4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>bU(i,n,g,v)});function aU(i,$){return new dU({type:"intersection",left:i,right:$})}var pU=w("ZodTuple",(i,$)=>{Fn.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>uU(i,n,g,v),i.rest=(n)=>i.clone({...i._zod.def,rest:n})});function eU(i,$,n){let g=$ instanceof Y,v=g?n:$;return new pU({type:"tuple",items:i,rest:g?$:null,...X.normalizeParams(v)})}var R$=w("ZodRecord",(i,$)=>{A4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>UU(i,n,g,v),i.keyType=$.keyType,i.valueType=$.valueType});function sU(i,$,n){if(!$||!$._zod)return new R$({type:"record",keyType:Lv(),valueType:i,...X.normalizeParams($)});return new R$({type:"record",keyType:i,valueType:$,...X.normalizeParams(n)})}function C0(i,$,n){let g=a(i);return g._zod.values=void 0,new R$({type:"record",keyType:g,valueType:$,...X.normalizeParams(n)})}function R0(i,$,n){return new R$({type:"record",keyType:i,valueType:$,mode:"loose",...X.normalizeParams(n)})}var iI=w("ZodMap",(i,$)=>{l4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>vU(i,n,g,v),i.keyType=$.keyType,i.valueType=$.valueType,i.min=(...n)=>i.check(Wi(...n)),i.nonempty=(n)=>i.check(Wi(1,n)),i.max=(...n)=>i.check(mi(...n)),i.size=(...n)=>i.check(u$(...n))});function F0(i,$,n){return new iI({type:"map",keyType:i,valueType:$,...X.normalizeParams(n)})}var $I=w("ZodSet",(i,$)=>{B4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>nU(i,n,g,v),i.min=(...n)=>i.check(Wi(...n)),i.nonempty=(n)=>i.check(Wi(1,n)),i.max=(...n)=>i.check(mi(...n)),i.size=(...n)=>i.check(u$(...n))});function o0(i,$){return new $I({type:"set",valueType:i,...X.normalizeParams($)})}var F$=w("ZodEnum",(i,$)=>{L4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(g,v,r)=>yu(i,g,v,r),i.enum=$.entries,i.options=Object.values($.entries);let n=new Set(Object.keys($.entries));i.extract=(g,v)=>{let r={};for(let b of g)if(n.has(b))r[b]=$.entries[b];else throw Error(`Key ${b} not found in enum`);return new F$({...$,checks:[],...X.normalizeParams(v),entries:r})},i.exclude=(g,v)=>{let r={...$.entries};for(let b of g)if(n.has(b))delete r[b];else throw Error(`Key ${b} not found in enum`);return new F$({...$,checks:[],...X.normalizeParams(v),entries:r})}});function ag(i,$){let n=Array.isArray(i)?Object.fromEntries(i.map((g)=>[g,g])):i;return new F$({type:"enum",entries:n,...X.normalizeParams($)})}function m0(i,$){return new F$({type:"enum",entries:i,...X.normalizeParams($)})}var vI=w("ZodLiteral",(i,$)=>{T4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>hu(i,n,g,v),i.values=new Set($.values),Object.defineProperty(i,"value",{get(){if($.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return $.values[0]}})});function y0(i,$){return new vI({type:"literal",values:Array.isArray(i)?i:[i],...X.normalizeParams($)})}var nI=w("ZodFile",(i,$)=>{Z4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>pu(i,n,g,v),i.min=(n,g)=>i.check(Wi(n,g)),i.max=(n,g)=>i.check(mi(n,g)),i.mime=(n,g)=>i.check(Z$(Array.isArray(n)?n:[n],g))});function h0(i){return zu(nI,i)}var gI=w("ZodTransform",(i,$)=>{q4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>$U(i,n,g,v),i._zod.parse=(n,g)=>{if(g.direction==="backward")throw new n$(i.constructor.name);n.addIssue=(r)=>{if(typeof r==="string")n.issues.push(X.issue(r,n.value,$));else{let b=r;if(b.fatal)b.continue=!1;b.code??(b.code="custom"),b.input??(b.input=n.value),b.inst??(b.inst=i),n.issues.push(X.issue(b))}};let v=$.transform(n.value,n);if(v instanceof Promise)return v.then((r)=>{return n.value=r,n.fallback=!0,n});return n.value=v,n.fallback=!0,n}});function pg(i){return new gI({type:"transform",transform:i})}var eg=w("ZodOptional",(i,$)=>{on.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>fg(i,n,g,v),i.unwrap=()=>i._zod.def.innerType});function Zv(i){return new eg({type:"optional",innerType:i})}var rI=w("ZodExactOptional",(i,$)=>{M4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>fg(i,n,g,v),i.unwrap=()=>i._zod.def.innerType});function bI(i){return new rI({type:"optional",innerType:i})}var uI=w("ZodNullable",(i,$)=>{x4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>IU(i,n,g,v),i.unwrap=()=>i._zod.def.innerType});function qv(i){return new uI({type:"nullable",innerType:i})}function d0(i){return Zv(qv(i))}var UI=w("ZodDefault",(i,$)=>{N4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>DU(i,n,g,v),i.unwrap=()=>i._zod.def.innerType,i.removeDefault=i.unwrap});function II(i,$){return new UI({type:"default",innerType:i,get defaultValue(){return typeof $==="function"?$():X.shallowClone($)}})}var _I=w("ZodPrefault",(i,$)=>{t4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>kU(i,n,g,v),i.unwrap=()=>i._zod.def.innerType});function DI(i,$){return new _I({type:"prefault",innerType:i,get defaultValue(){return typeof $==="function"?$():X.shallowClone($)}})}var sg=w("ZodNonOptional",(i,$)=>{E4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>_U(i,n,g,v),i.unwrap=()=>i._zod.def.innerType});function kI(i,$){return new sg({type:"nonoptional",innerType:i,...X.normalizeParams($)})}var wI=w("ZodSuccess",(i,$)=>{c4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>eu(i,n,g,v),i.unwrap=()=>i._zod.def.innerType});function a0(i){return new wI({type:"success",innerType:i})}var jI=w("ZodCatch",(i,$)=>{C4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>wU(i,n,g,v),i.unwrap=()=>i._zod.def.innerType,i.removeCatch=i.unwrap});function OI(i,$){return new jI({type:"catch",innerType:i,catchValue:typeof $==="function"?$:()=>$})}var JI=w("ZodNaN",(i,$)=>{R4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>du(i,n,g,v)});function p0(i){return Yu(JI,i)}var Cv=w("ZodPipe",(i,$)=>{mn.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>jU(i,n,g,v),i.in=$.in,i.out=$.out});function Ag(i,$){return new Cv({type:"pipe",in:i,out:$})}var Rv=w("ZodCodec",(i,$)=>{Cv.init(i,$),Kv.init(i,$)});function e0(i,$,n){return new Rv({type:"pipe",in:i,out:$,transform:n.decode,reverseTransform:n.encode})}function s0(i){let $=i._zod.def;return new Rv({type:"pipe",in:$.out,out:$.in,transform:$.reverseTransform,reverseTransform:$.transform})}var PI=w("ZodPreprocess",(i,$)=>{Cv.init(i,$),F4.init(i,$)}),WI=w("ZodReadonly",(i,$)=>{o4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>OU(i,n,g,v),i.unwrap=()=>i._zod.def.innerType});function VI(i){return new WI({type:"readonly",innerType:i})}var XI=w("ZodTemplateLiteral",(i,$)=>{m4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>au(i,n,g,v)});function iD(i,$){return new XI({type:"template_literal",parts:i,...X.normalizeParams($)})}var fI=w("ZodLazy",(i,$)=>{d4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>PU(i,n,g,v),i.unwrap=()=>i._zod.def.getter()});function QI(i){return new fI({type:"lazy",getter:i})}var KI=w("ZodPromise",(i,$)=>{h4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>JU(i,n,g,v),i.unwrap=()=>i._zod.def.innerType});function $D(i){return new KI({type:"promise",innerType:i})}var GI=w("ZodFunction",(i,$)=>{y4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>iU(i,n,g,v)});function vD(i){return new GI({type:"function",input:Array.isArray(i?.input)?eU(i?.input):i?.input??tv(_$()),output:i?.output??_$()})}var Fv=w("ZodCustom",(i,$)=>{a4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>su(i,n,g,v)});function nD(i){let $=new M({check:"custom"});return $._zod.check=i,$}function gD(i,$){return Su(Fv,i??(()=>!0),$)}function YI(i,$={}){return Au(Fv,i,$)}function HI(i,$){return lu(i,$)}var rD=Bu,bD=Lu;function uD(i,$={}){let n=new Fv({type:"custom",check:"custom",fn:(g)=>g instanceof i,abort:!0,...X.normalizeParams($)});return n._zod.bag.Class=i,n._zod.check=(g)=>{if(!(g.value instanceof i))g.issues.push({code:"invalid_type",expected:i.name,input:g.value,inst:n,path:[...n._zod.def.path??[]]})},n}var UD=(...i)=>Tu({Codec:Rv,Boolean:h$,String:o$},...i);function ID(i){let $=QI(()=>{return dg([Lv(i),MU(),xU(),cU(),tv($),sU(Lv(),$)])});return $}function _D(i,$){return new PI({type:"pipe",in:pg(i),out:$})}var SO={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function AO(i){E({customError:i})}function lO(){return E().customError}var zI;(function(i){})(zI||(zI={}));var K={...Bv,...Kg,iso:C$},BO=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function LO(i,$){let n=i.$schema;if(n==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(n==="http://json-schema.org/draft-07/schema#")return"draft-7";if(n==="http://json-schema.org/draft-04/schema#")return"draft-4";return $??"draft-2020-12"}function TO(i,$){if(!i.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let n=i.slice(1).split("/").filter(Boolean);if(n.length===0)return $.rootSchema;let g=$.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===g){let v=n[1];if(!v||!$.defs[v])throw Error(`Reference not found: ${i}`);return $.defs[v]}throw Error(`Reference not found: ${i}`)}function DD(i,$){if(i.not!==void 0){if(typeof i.not==="object"&&Object.keys(i.not).length===0)return K.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(i.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if(i.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if(i.if!==void 0||i.then!==void 0||i.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if(i.dependentSchemas!==void 0||i.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if(i.$ref){let v=i.$ref;if($.refs.has(v))return $.refs.get(v);if($.processing.has(v))return K.lazy(()=>{if(!$.refs.has(v))throw Error(`Circular reference not resolved: ${v}`);return $.refs.get(v)});$.processing.add(v);let r=TO(v,$),b=h(r,$);return $.refs.set(v,b),$.processing.delete(v),b}if(i.enum!==void 0){let v=i.enum;if($.version==="openapi-3.0"&&i.nullable===!0&&v.length===1&&v[0]===null)return K.null();if(v.length===0)return K.never();if(v.length===1)return K.literal(v[0]);if(v.every((b)=>typeof b==="string"))return K.enum(v);let r=v.map((b)=>K.literal(b));if(r.length<2)return r[0];return K.union([r[0],r[1],...r.slice(2)])}if(i.const!==void 0)return K.literal(i.const);let n=i.type;if(Array.isArray(n)){let v=n.map((r)=>{let b={...i,type:r};return DD(b,$)});if(v.length===0)return K.never();if(v.length===1)return v[0];return K.union(v)}if(!n)return K.any();let g;switch(n){case"string":{let v=K.string();if(i.format){let r=i.format;if(r==="email")v=v.check(K.email());else if(r==="uri"||r==="uri-reference")v=v.check(K.url());else if(r==="uuid"||r==="guid")v=v.check(K.uuid());else if(r==="date-time")v=v.check(K.iso.datetime());else if(r==="date")v=v.check(K.iso.date());else if(r==="time")v=v.check(K.iso.time());else if(r==="duration")v=v.check(K.iso.duration());else if(r==="ipv4")v=v.check(K.ipv4());else if(r==="ipv6")v=v.check(K.ipv6());else if(r==="mac")v=v.check(K.mac());else if(r==="cidr")v=v.check(K.cidrv4());else if(r==="cidr-v6")v=v.check(K.cidrv6());else if(r==="base64")v=v.check(K.base64());else if(r==="base64url")v=v.check(K.base64url());else if(r==="e164")v=v.check(K.e164());else if(r==="jwt")v=v.check(K.jwt());else if(r==="emoji")v=v.check(K.emoji());else if(r==="nanoid")v=v.check(K.nanoid());else if(r==="cuid")v=v.check(K.cuid());else if(r==="cuid2")v=v.check(K.cuid2());else if(r==="ulid")v=v.check(K.ulid());else if(r==="xid")v=v.check(K.xid());else if(r==="ksuid")v=v.check(K.ksuid())}if(typeof i.minLength==="number")v=v.min(i.minLength);if(typeof i.maxLength==="number")v=v.max(i.maxLength);if(i.pattern)v=v.regex(new RegExp(i.pattern));g=v;break}case"number":case"integer":{let v=n==="integer"?K.number().int():K.number();if(typeof i.minimum==="number")v=v.min(i.minimum);if(typeof i.maximum==="number")v=v.max(i.maximum);if(typeof i.exclusiveMinimum==="number")v=v.gt(i.exclusiveMinimum);else if(i.exclusiveMinimum===!0&&typeof i.minimum==="number")v=v.gt(i.minimum);if(typeof i.exclusiveMaximum==="number")v=v.lt(i.exclusiveMaximum);else if(i.exclusiveMaximum===!0&&typeof i.maximum==="number")v=v.lt(i.maximum);if(typeof i.multipleOf==="number")v=v.multipleOf(i.multipleOf);g=v;break}case"boolean":{g=K.boolean();break}case"null":{g=K.null();break}case"object":{let v={},r=i.properties||{},b=new Set(i.required||[]);for(let[I,U]of Object.entries(r)){let _=h(U,$);v[I]=b.has(I)?_:_.optional()}if(i.propertyNames){let I=h(i.propertyNames,$),U=i.additionalProperties&&typeof i.additionalProperties==="object"?h(i.additionalProperties,$):K.any();if(Object.keys(v).length===0){g=K.record(I,U);break}let _=K.object(v).passthrough(),k=K.looseRecord(I,U);g=K.intersection(_,k);break}if(i.patternProperties){let I=i.patternProperties,U=Object.keys(I),_=[];for(let O of U){let J=h(I[O],$),Q=K.string().regex(new RegExp(O));_.push(K.looseRecord(Q,J))}let k=[];if(Object.keys(v).length>0)k.push(K.object(v).passthrough());if(k.push(..._),k.length===0)g=K.object({}).passthrough();else if(k.length===1)g=k[0];else{let O=K.intersection(k[0],k[1]);for(let J=2;J<k.length;J++)O=K.intersection(O,k[J]);g=O}break}let u=K.object(v);if(i.additionalProperties===!1)g=u.strict();else if(typeof i.additionalProperties==="object")g=u.catchall(h(i.additionalProperties,$));else g=u.passthrough();break}case"array":{let{prefixItems:v,items:r}=i;if(v&&Array.isArray(v)){let b=v.map((I)=>h(I,$)),u=r&&typeof r==="object"&&!Array.isArray(r)?h(r,$):void 0;if(u)g=K.tuple(b).rest(u);else g=K.tuple(b);if(typeof i.minItems==="number")g=g.check(K.minLength(i.minItems));if(typeof i.maxItems==="number")g=g.check(K.maxLength(i.maxItems))}else if(Array.isArray(r)){let b=r.map((I)=>h(I,$)),u=i.additionalItems&&typeof i.additionalItems==="object"?h(i.additionalItems,$):void 0;if(u)g=K.tuple(b).rest(u);else g=K.tuple(b);if(typeof i.minItems==="number")g=g.check(K.minLength(i.minItems));if(typeof i.maxItems==="number")g=g.check(K.maxLength(i.maxItems))}else if(r!==void 0){let b=h(r,$),u=K.array(b);if(typeof i.minItems==="number")u=u.min(i.minItems);if(typeof i.maxItems==="number")u=u.max(i.maxItems);g=u}else g=K.array(K.any());break}default:throw Error(`Unsupported type: ${n}`)}return g}function h(i,$){if(typeof i==="boolean")return i?K.any():K.never();let n=DD(i,$),g=i.type||i.enum!==void 0||i.const!==void 0;if(i.anyOf&&Array.isArray(i.anyOf)){let u=i.anyOf.map((U)=>h(U,$)),I=K.union(u);n=g?K.intersection(n,I):I}if(i.oneOf&&Array.isArray(i.oneOf)){let u=i.oneOf.map((U)=>h(U,$)),I=K.xor(u);n=g?K.intersection(n,I):I}if(i.allOf&&Array.isArray(i.allOf))if(i.allOf.length===0)n=g?n:K.any();else{let u=g?n:h(i.allOf[0],$),I=g?0:1;for(let U=I;U<i.allOf.length;U++)u=K.intersection(u,h(i.allOf[U],$));n=u}if(i.nullable===!0&&$.version==="openapi-3.0")n=K.nullable(n);if(i.readOnly===!0)n=K.readonly(n);if(i.default!==void 0)n=n.default(i.default);let v={},r=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let u of r)if(u in i)v[u]=i[u];let b=["contentEncoding","contentMediaType","contentSchema"];for(let u of b)if(u in i)v[u]=i[u];for(let u of Object.keys(i))if(!BO.has(u))v[u]=i[u];if(Object.keys(v).length>0)$.registry.add(n,v);if(i.description)n=n.describe(i.description);return n}function kD(i,$){if(typeof i==="boolean")return i?K.any():K.never();let n;try{n=JSON.parse(JSON.stringify(i))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let g=LO(n,$?.defaultTarget),v=n.$defs||n.definitions||{},r={version:g,defs:v,refs:new Map,processing:new Set,rootSchema:n,registry:$?.registry??m};return h(n,r)}var SI={};Gi(SI,{string:()=>ZO,number:()=>qO,date:()=>NO,boolean:()=>MO,bigint:()=>xO});function ZO(i){return a6(o$,i)}function qO(i){return gu(y$,i)}function MO(i){return Du(h$,i)}function xO(i){return wu(d$,i)}function NO(i){return Gu(Nv,i)}E(Gv());var Ai=D.object({id:D.string(),name:D.string(),type:D.literal("discord"),botToken:D.string().min(10).optional(),botTokenEnv:D.string().optional(),createdAt:D.string().datetime().optional(),updatedAt:D.string().datetime().optional()});function P(i){try{if(i.error instanceof Error){let $=i.error.message;if(typeof $==="string")return $;return"<non-string error message>"}}catch{return"<unreadable error message>"}try{return String(i.error)}catch{return"<unprintable error>"}}function L(i){try{if(i.value instanceof Error)return i.value}catch{}let $=P({error:i.value});try{return Error($)}catch{try{return Error("unknown error")}catch{let n=Object.create(Error.prototype);return n.name="Error",n.message="unknown error",n}}}function tO(i){if(typeof i!=="object"&&typeof i!=="function")return!1;if(i===null)return!1;return"then"in i&&typeof i.then==="function"}function G(i){try{let $=i();if($ instanceof Promise)return $.catch((n)=>L({value:n}));if(tO($))return Promise.resolve($).then((n)=>n,(n)=>L({value:n}));return $}catch($){return L({value:$})}}var ii=class extends Error{constructor(i,$){super(i,$?.cause===void 0?void 0:{cause:$.cause});this.name="FlumeParseError",Object.freeze(this)}},gi=class extends Error{constructor(i,$){super(i,$?.cause===void 0?void 0:{cause:$.cause});this.name="FlumeStartError",Object.freeze(this)}};function d(i){try{let $=i.deps.now();if(typeof $==="number"&&Number.isFinite($))return $}catch{}try{return Date.now()}catch{return 0}}var li=class i{props;constructor($){this.props=$,Object.freeze(this)}debug($){this.emit("debug",$)}info($){this.emit("info",$)}warn($){this.emit("warn",$)}error($){this.emit("error",$)}get handler(){return this.props.handler}child($){return new i({source:$,handler:this.props.handler,deps:this.props.deps})}emit($,n){let g=this.props.handler;if(!g)return;let v={level:$,source:this.props.source,action:n.action,message:n.message,timestamp:d({deps:this.props.deps}),error:n.error,detail:n.detail};try{Promise.resolve(g(v)).catch(()=>{})}catch{}}};function ai(i){try{Promise.resolve(i.fn()).catch(($)=>{try{i.onError(L({value:$}))}catch{}}).catch(()=>{})}catch($){try{i.onError(L({value:$}))}catch{}}}var AI=class{props;chain=Promise.resolve();depth=0;cancelled=!1;constructor(i={}){this.props=i}add(i){if(this.cancelled)return Promise.resolve();if(this.props.maxDepth!==void 0&&this.depth>=this.props.maxDepth)return this.props.onOverflow?.({dropped:1,depth:this.depth}),Promise.resolve();this.depth++;let $=this.chain.then(async()=>{try{if(!this.cancelled)await i()}catch{}finally{this.depth--}});return this.chain=$,$}async drain(){while(!0){let i=this.chain;if(await i,this.chain===i)return}}cancel(){this.cancelled=!0}size(){return this.depth}isCancelled(){return this.cancelled}},EO=class{props;currentStatus="disconnected";currentDetail=null;constructor(i){this.props=i}get value(){return this.currentStatus}set(i,$){let n=$??null;if(this.currentStatus===i&&this.currentDetail===n)return;let g=this.currentStatus,v=$?` (${$})`:"";this.props.log.info({action:"status",message:`${g} \u2192 ${i}${v}`,detail:{from:g,to:i,reason:n}}),this.currentStatus=i,this.currentDetail=n;let r=this.props.onStatus;if(!r)return;ai({fn:$!==void 0?()=>r(i,$):()=>r(i),onError:(b)=>{this.props.log.error({action:"onStatus.error",message:P({error:b}),error:b})}})}},k$=class{consumed=!1;stopped=!1;stopPromise=null;ctx=null;statusEmitter=null;abortHandler=null;queue=new AI;async start(i){if(this.consumed)return new gi(`${this.name}: already started`);if(this.stopped)return new gi(`${this.name}: already stopped`);if(this.consumed=!0,this.ctx=i,this.statusEmitter=new EO({log:i.log,onStatus:i.onStatus}),this.isSignalAborted(i))return new gi(`${this.name}: aborted before connect`);this.attachAbortListener(i);let $=await G(async()=>await this.connect(i));return this.detachAbortListener(i),$ instanceof Error?L({value:$}):$}async stop(){if(this.stopPromise!==null)return this.stopPromise;return this.stopped=!0,this.stopPromise=this.runStop(),this.stopPromise}async runStop(){let i=await G(async()=>{await this.disconnect()});return await this.queue.drain(),this.statusEmitter?.set("disconnected"),this.ctx=null,i instanceof Error?i:null}status(){return this.statusEmitter?.value??"disconnected"}emit(i){let $=this.ctx;if(!$)return;this.queue.add(async()=>{let n=await G(()=>Promise.resolve($.onEvent(i)));if(n instanceof Error)$.log.error({action:"onEvent.error",message:P({error:n}),error:n})})}setStatus(i,$){this.statusEmitter?.set(i,$)}get currentStatus(){return this.statusEmitter?.value??"disconnected"}get context(){return this.ctx}isSignalAborted(i){let $=i.signal;if(!$)return!1;let n=G(()=>$.aborted===!0);return n instanceof Error?!0:n}attachAbortListener(i){let $=i.signal;if(!$)return;let n=()=>{G(async()=>{await this.stop()})},g=G(()=>$.addEventListener("abort",n,{once:!0}));if(g instanceof Error){i.log.warn({action:"signal.addListener.failed",message:P({error:g}),error:g});return}this.abortHandler=n}detachAbortListener(i){let $=this.abortHandler;if(!$)return;this.abortHandler=null;let n=i.signal;if(!n)return;G(()=>n.removeEventListener("abort",$))}};var T=class extends Error{code;constructor(i,$){super(i,$?.cause===void 0?void 0:{cause:$.cause});this.name="FlumeConnectionError",this.code=$?.code??null,Object.freeze(this)}};function ir(i){try{let $=i.deps.random();if(typeof $==="number"&&Number.isFinite($)&&$>=0&&$<1)return $}catch{}try{let $=Math.random();if(typeof $==="number"&&Number.isFinite($)&&$>=0&&$<1)return $;return 0.5}catch{return 0.5}}var cO=2147483647,$r=class{props;currentAttempt=0;isAborted=!1;timer=null;generation=0;constructor(i){this.props=i}get attempt(){return this.currentAttempt}get aborted(){return this.isAborted}schedule(i,$){if(this.isAborted)return{kind:"refused"};if(this.currentAttempt>=this.props.maxAttempts)return this.generation++,this.clearTimer(),{kind:"exhausted"};this.clearTimer();let n=this.computeDelay($?.minDelayMs??0),g=++this.generation,v=G(()=>this.props.deps.setTimeout(()=>this.runRetry(i,g),n));if(v instanceof Error)return this.props.log.error({action:"reconnect.timer.schedule.error",message:P({error:v}),error:v}),this.timer=null,{kind:"refused"};return this.currentAttempt++,this.timer=v,{kind:"scheduled",delayMs:n}}reset(){this.currentAttempt=0}cancel(){this.isAborted=!0,this.generation++,this.clearTimer()}runRetry(i,$){if(this.isAborted)return;if($!==this.generation)return;this.timer=null,ai({fn:i,onError:(n)=>{this.props.log.error({action:"reconnect.timer.error",message:P({error:n}),error:n})}})}clearTimer(){if(this.timer===null)return;let i=this.timer,$=G(()=>this.props.deps.clearTimeout(i));if($ instanceof Error)this.props.log.error({action:"reconnect.timer.clear.error",message:P({error:$}),error:$});this.timer=null}computeDelay(i){let $=Math.min(this.props.baseDelay*2**this.currentAttempt,this.props.maxDelay)*(0.5+ir({deps:this.props.deps})*0.5);return Math.min(Math.max($,Number.isFinite(i)&&i>0?i:0),cO)}};function vr(i){if(!i.reconnector){i.log.info({action:"reconnect.disabled",message:"reconnect is disabled, staying disconnected"}),i.setStatus("disconnected");return}if(i.reconnector.aborted){i.log.info({action:"reconnect.aborted",message:"reconnector cancelled, staying disconnected"}),i.setStatus("disconnected");return}let $=i.reconnector.schedule(i.retry,{minDelayMs:i.minDelayMs});if($.kind==="exhausted"){let n=new T(`reconnect exhausted after ${i.reconnector.attempt} attempts`);i.log.error({action:"reconnect.exhausted",message:P({error:n}),error:n}),i.setStatus("disconnected");return}if($.kind==="refused"){let n=new T("reconnect timer could not be scheduled");i.log.error({action:"reconnect.refused",message:P({error:n}),error:n}),i.setStatus("disconnected");return}i.setStatus("reconnecting"),i.log.info({action:"reconnect.scheduled",message:`next attempt in ${Math.round($.delayMs)}ms`,detail:{attempt:i.reconnector.attempt,delayMs:Math.round($.delayMs)}})}function nr(i){let $=G(()=>JSON.stringify(i));if($ instanceof Error)return $;if(typeof $!=="string")return new ii("value is not JSON-serializable (undefined / function / symbol)");return $}function Bi(i){return typeof i==="object"&&i!==null}function w$(i){try{return JSON.parse(i)}catch($){return new ii($ instanceof Error?`invalid JSON: ${$.message}`:"invalid JSON",{cause:$})}}var CO=class i{sessionId;resumeUrl;seq;constructor($){this.sessionId=$.sessionId,this.resumeUrl=$.resumeUrl,this.seq=$.seq,Object.freeze(this)}static empty(){return new i({sessionId:null,resumeUrl:null,seq:null})}canResume(){return this.sessionId!==null}withSeq($){return new i({sessionId:this.sessionId,resumeUrl:this.resumeUrl,seq:$})}withReady($,n){return new i({sessionId:$,resumeUrl:n,seq:this.seq})}withReset(){return i.empty()}},RO=class{props;initialTimer=null;intervalTimer=null;ackReceived=!0;generation=0;constructor(i){this.props=i}start(i){this.stop(),this.ackReceived=!0;let $=++this.generation,n=ir({deps:this.props.deps})*i,g=G(()=>this.props.deps.setTimeout(()=>{if($!==this.generation)return;if(this.initialTimer=null,this.safeFire(),$!==this.generation)return;let v=G(()=>this.props.deps.setInterval(()=>{if($===this.generation)this.safeFire()},i));if(v instanceof Error)this.props.log.error({action:"heartbeat.interval.schedule.error",message:P({error:v}),error:v}),this.intervalTimer=null,this.safeZombie();else this.intervalTimer=v},n));if(g instanceof Error)return this.props.log.error({action:"heartbeat.initial.schedule.error",message:P({error:g}),error:g}),this.initialTimer=null,g;else this.initialTimer=g;return null}stop(){if(this.generation++,this.initialTimer!==null){let i=this.initialTimer,$=G(()=>this.props.deps.clearTimeout(i));if($ instanceof Error)this.props.log.error({action:"heartbeat.initial.clear.error",message:P({error:$}),error:$});this.initialTimer=null}if(this.intervalTimer!==null){let i=this.intervalTimer,$=G(()=>this.props.deps.clearInterval(i));if($ instanceof Error)this.props.log.error({action:"heartbeat.interval.clear.error",message:P({error:$}),error:$});this.intervalTimer=null}}ack(){this.ackReceived=!0}request(){this.safeFire()}isRunning(){return this.initialTimer!==null||this.intervalTimer!==null}safeFire(){ai({fn:()=>this.fire(),onError:(i)=>{this.props.log.error({action:"heartbeat.fire.error",message:P({error:i}),error:i})}})}safeZombie(){ai({fn:this.props.onZombie,onError:(i)=>{this.props.log.error({action:"heartbeat.zombie.error",message:P({error:i}),error:i})}})}fire(){if(!this.ackReceived){this.props.onZombie();return}this.ackReceived=!1,this.props.onSend()}},FO=D.object({op:D.number(),d:D.unknown().optional(),s:D.number().nullish(),t:D.string().nullish()});function oO(i){let $=w$(i);if($ instanceof ii)return $;let n=FO.safeParse($);if(!n.success)return new ii(`invalid gateway message frame (${i.length} bytes)`,{cause:n.error});return{op:n.data.op,d:n.data.d??null,s:n.data.s??null,t:n.data.t??null}}var wD="wss://gateway.discord.gg/?v=10&encoding=json",mO="10",yO="json",hO=30000,dO=5000,JD=0,lI=1,PD=2,WD=6,VD=7,XD=9,fD=10,QD=11,jD={[JD]:"DISPATCH",[lI]:"HEARTBEAT",[PD]:"IDENTIFY",[WD]:"RESUME",[VD]:"RECONNECT",[XD]:"INVALID_SESSION",[fD]:"HELLO",[QD]:"HEARTBEAT_ACK"},OD=1,aO=new Set([4004,4010,4011,4012,4013,4014]),pO=new Set([4007,4009]),eO=class{props;log;ws=null;heartbeat=null;currentSession;isStoppedFlag=!1;hasConnected=!1;pendingResolve=null;pendingResolved=!1;invalidSessionTimer=null;handshakeTimer=null;forcedCloseFallbackTimer=null;teardownDone=!1;constructor(i){this.props=i,this.currentSession=i.session??CO.empty(),this.log=new li({source:"discord.gateway",handler:i.onLog,deps:i.deps})}get session(){return this.currentSession}get isStopped(){return this.isStoppedFlag}connect(i){let $=this.props.deps.WebSocket;if(!$){let r=new T("WebSocket runtime not available");return this.log.error({action:"ws.error",message:P({error:r}),error:r}),Promise.resolve(r)}let n=this.resolveTargetUrl(i),g=G(()=>new URL(n).hostname),v=g instanceof Error?"unknown":g;return this.log.info({action:"connect.start",message:`host=${v}`}),this.pendingResolved=!1,this.hasConnected=!1,this.teardownDone=!1,new Promise((r)=>{this.pendingResolve=r;let b=G(()=>new $(n));if(b instanceof Error){let U=new T(`WebSocket construction failed: ${P({error:b})}`,{cause:b});this.log.error({action:"ws.construct.error",message:P({error:U}),error:U}),this.ws=null,this.pendingResolved=!0,r(U);return}let u=b;this.ws=u;let I=G(()=>{u.addEventListener("message",(U)=>this.safeOnMessage(U,u)),u.addEventListener("close",(U)=>this.safeOnClose(U)),u.addEventListener("error",()=>this.safeOnError())});if(I instanceof Error){let U=new T(`WebSocket listener registration failed: ${P({error:I})}`,{cause:I});this.log.error({action:"ws.listener.error",message:P({error:U}),error:U}),this.closeSocket({ws:u}),this.ws=null,this.pendingResolved=!0,r(U);return}this.armHandshakeTimer()})}disconnect(){this.log.info({action:"disconnect",message:"shutting down gateway"}),this.isStoppedFlag=!0,this.heartbeat?.stop(),this.clearInvalidSessionTimer(),this.clearForcedCloseFallbackTimer(),this.completeConnect(new T("gateway disconnected before ready")),this.closeSocket({ws:this.ws,code:1000,reason:"shutdown"}),this.ws=null}isConnected(){return this.ws!==null&&this.ws.readyState===OD}resolveTargetUrl(i){if(i===void 0)return wD;let $=G(()=>{let n=new URL(i);return n.searchParams.set("v",mO),n.searchParams.set("encoding",yO),n.toString()});if($ instanceof Error)return this.log.warn({action:"resume.url.invalid",message:`resume url unparseable, dropping session and identifying fresh: ${P({error:$})}`}),this.currentSession=this.currentSession.withReset(),wD;return $}resolveHandshakeTimeoutMs(){let i=this.props.handshakeTimeoutMs;if(typeof i!=="number"||!Number.isFinite(i)||i<=0)return hO;return i}armHandshakeTimer(){this.clearHandshakeTimer();let i=this.resolveHandshakeTimeoutMs(),$=G(()=>this.props.deps.setTimeout(()=>{this.handshakeTimer=null,this.onHandshakeTimeout(i)},i));if($ instanceof Error){let n=new T(`handshake timer scheduling failed: ${P({error:$})}`,{cause:$});this.log.error({action:"handshake.timer.schedule.error",message:P({error:n}),error:n}),this.handshakeTimer=null,this.completeConnect(n),this.forceClose({code:4000,reason:"handshake timer failure"});return}this.handshakeTimer=$}clearHandshakeTimer(){if(this.handshakeTimer===null)return;let i=this.handshakeTimer,$=G(()=>this.props.deps.clearTimeout(i));if($ instanceof Error)this.log.error({action:"handshake.timer.clear.error",message:P({error:$}),error:$});this.handshakeTimer=null}onHandshakeTimeout(i){if(this.pendingResolved)return;let $=new T(`handshake timeout after ${i}ms (no READY/RESUMED)`);this.log.error({action:"handshake.timeout",message:P({error:$}),error:$}),this.completeConnect($),this.forceClose({code:4000,reason:"handshake timeout"})}forceClose(i){this.heartbeat?.stop(),this.closeSocket({ws:i.ws??this.ws,code:i.code,reason:i.reason}),this.armForcedCloseFallback()}armForcedCloseFallback(){if(this.teardownDone)return;if(this.forcedCloseFallbackTimer!==null)return;let i=G(()=>this.props.deps.setTimeout(()=>{this.forcedCloseFallbackTimer=null,this.synthesizeTeardown()},dO));if(i instanceof Error){this.log.error({action:"ws.close.fallback.schedule.error",message:P({error:i}),error:i}),this.forcedCloseFallbackTimer=null,this.synthesizeTeardown();return}this.forcedCloseFallbackTimer=i}clearForcedCloseFallbackTimer(){if(this.forcedCloseFallbackTimer===null)return;let i=this.forcedCloseFallbackTimer,$=G(()=>this.props.deps.clearTimeout(i));if($ instanceof Error)this.log.error({action:"ws.close.fallback.clear.error",message:P({error:$}),error:$});this.forcedCloseFallbackTimer=null}synthesizeTeardown(){if(this.teardownDone)return;if(this.teardownDone=!0,this.log.warn({action:"ws.close.synthesized",message:"close event not received after forced close, synthesizing teardown"}),this.ws=null,this.heartbeat?.stop(),this.clearInvalidSessionTimer(),!this.pendingResolved)this.completeConnect(new T("WebSocket force-closed (no close event)"));if(this.hasConnected&&!this.isStoppedFlag)this.props.onStatus("disconnected")}completeConnect(i){if(this.clearHandshakeTimer(),this.pendingResolved||!this.pendingResolve)return;this.pendingResolved=!0,this.pendingResolve(i)}safeOnMessage(i,$){let n=G(()=>this.onMessage(String(i.data),$));if(n instanceof Error)this.log.error({action:"ws.message.threw",message:P({error:n}),error:n})}safeOnClose(i){let $=G(()=>this.onClose(i));if($ instanceof Error)this.log.error({action:"ws.close.threw",message:P({error:$}),error:$})}safeOnError(){let i=G(()=>this.onError());if(i instanceof Error)this.log.error({action:"ws.error.threw",message:P({error:i}),error:i})}onMessage(i,$){if(this.isStoppedFlag)return;let n=oO(i);if(n instanceof ii){this.log.error({action:"ws.parse.error",message:n.message,error:n,detail:{length:i.length}});return}if(this.log.debug({action:"ws.recv",message:`op=${jD[n.op]??n.op} t=${n.t??"-"} s=${n.s??"-"} length=${i.length}`,detail:{op:n.op,t:n.t,s:n.s,length:i.length}}),typeof n.s==="number")this.currentSession=this.currentSession.withSeq(n.s);if(n.op===fD)return this.onHello(n);if(n.op===QD)return this.onHeartbeatAck();if(n.op===lI)return this.onHeartbeatRequest();if(n.op===VD)return this.onReconnectRequest($);if(n.op===XD)return this.onInvalidSession(n,$);if(n.op===JD)return this.onDispatch(n);this.log.warn({action:"ws.op.unknown",message:`unknown op=${n.op}`,detail:{op:n.op}})}onHello(i){let $=Bi(i.d)?i.d:null,n=$===null?null:$.heartbeat_interval;if(typeof n!=="number"||!Number.isFinite(n)||n<=0){let r=new T("malformed HELLO: heartbeat_interval is not a finite number > 0");this.log.error({action:"gateway.hello.invalid",message:P({error:r}),error:r,detail:{intervalType:typeof n}}),this.completeConnect(r),this.forceClose({code:4000,reason:"malformed HELLO"});return}let g=n;this.log.info({action:"gateway.hello",message:`heartbeat_interval=${g}ms`,detail:{interval:g}}),this.heartbeat?.stop(),this.heartbeat=new RO({log:this.log,deps:this.props.deps,onSend:()=>{this.log.debug({action:"heartbeat.send",message:`seq=${this.currentSession.seq}`}),this.send({op:lI,d:this.currentSession.seq})},onZombie:()=>{this.log.warn({action:"heartbeat.zombie",message:"no ACK received, closing connection"}),this.forceClose({code:4000,reason:"zombie connection"})}});let v=this.heartbeat.start(g);if(v instanceof Error){let r=new T(`heartbeat timer scheduling failed: ${P({error:v})}`,{cause:v});this.completeConnect(r),this.forceClose({code:4000,reason:"heartbeat timer failure"});return}if(this.currentSession.canResume())this.sendResume();else this.sendIdentify()}onHeartbeatAck(){this.log.debug({action:"heartbeat.ack",message:"received"}),this.heartbeat?.ack()}onHeartbeatRequest(){this.log.debug({action:"heartbeat.requested",message:"server requested heartbeat"}),this.heartbeat?.request()}onReconnectRequest(i){this.log.info({action:"ws.reconnect.requested",message:"server requested reconnect"}),this.forceClose({ws:i,code:4000,reason:"reconnect requested"})}onInvalidSession(i,$){let n=i.d===!0||Bi(i.d)&&i.d.resumable===!0;this.log.warn({action:"session.invalid",message:`resumable=${n}`,detail:{resumable:n}});let g=1000+ir({deps:this.props.deps})*4000;if(!n)this.currentSession=this.currentSession.withReset();this.clearInvalidSessionTimer();let v=G(()=>this.props.deps.setTimeout(()=>{this.invalidSessionTimer=null,this.forceClose({ws:$,code:4000,reason:"invalid session"})},g));if(v instanceof Error)this.log.error({action:"session.invalid.timer.error",message:P({error:v}),error:v}),this.invalidSessionTimer=null,this.forceClose({ws:$,code:4000,reason:"invalid session timer failure"});else this.invalidSessionTimer=v}onDispatch(i){let $=Bi(i.d)?i.d:null;if(i.t==="READY"&&$){let n=typeof $.session_id==="string"?$.session_id:"",g=typeof $.resume_gateway_url==="string"?$.resume_gateway_url:"";this.currentSession=this.currentSession.withReady(n,g),this.log.info({action:"gateway.ready",message:"session ready",detail:{hasResumeUrl:g!==""}}),this.hasConnected=!0,this.props.onStatus("connected"),this.completeConnect(null)}if(i.t==="RESUMED")this.log.info({action:"gateway.resumed",message:`seq=${this.currentSession.seq}`}),this.hasConnected=!0,this.props.onStatus("connected"),this.completeConnect(null);if(i.t&&$)this.props.onDispatch(i.t,$);else if(i.t)this.log.debug({action:"dispatch.empty",message:`dropped ${i.t} (no payload)`,detail:{type:i.t}})}onClose(i){if(this.clearForcedCloseFallbackTimer(),this.teardownDone){this.log.debug({action:"ws.close.stale",message:`ignored close after synthesized teardown (code=${i.code})`,detail:{code:i.code}});return}this.teardownDone=!0;let $=aO.has(i.code);if(this.log.info({action:"ws.close",message:`code=${i.code} reason=${i.reason||"none"}${$?" (terminal)":""}`,detail:{code:i.code,reason:i.reason,terminal:$}}),this.ws=null,this.heartbeat?.stop(),this.clearInvalidSessionTimer(),pO.has(i.code))this.log.info({action:"session.reset",message:`close code ${i.code} invalidates session, next attempt will identify`,detail:{code:i.code}}),this.currentSession=this.currentSession.withReset();if($)this.isStoppedFlag=!0;if(this.hasConnected||$)this.props.onStatus("disconnected");if(!this.pendingResolved){let n=new T(`WebSocket closed before ready (code=${i.code})`,{code:i.code});this.completeConnect(n)}}onError(){let i=new T("WebSocket connection error");this.log.error({action:"ws.error",message:P({error:i}),error:i}),this.completeConnect(i)}clearInvalidSessionTimer(){if(this.invalidSessionTimer===null)return;let i=this.invalidSessionTimer,$=G(()=>this.props.deps.clearTimeout(i));if($ instanceof Error)this.log.error({action:"session.invalid.timer.clear.error",message:P({error:$}),error:$});this.invalidSessionTimer=null}closeSocket(i){if(i.ws===null)return;let $=i.ws,n=G(()=>{if(i.code!==void 0)$.close(i.code,i.reason??"");else $.close()});if(n instanceof Error)this.log.error({action:"ws.close.error",message:P({error:n}),error:n})}send(i){let $=this.safeSerialize(i);if($===null)return;this.log.debug({action:"ws.send",message:`op=${jD[i.op]??i.op} length=${$.length}`,detail:{op:i.op,length:$.length}});let n=this.ws;if(n===null){this.log.warn({action:"ws.send",message:"ws.send skipped: socket is null"});return}if(n.readyState!==OD){this.log.warn({action:"ws.send",message:`ws.send skipped: readyState=${n.readyState} (not OPEN)`,detail:{readyState:n.readyState}});return}let g=G(()=>n.send($));if(g instanceof Error)this.log.error({action:"ws.send",message:`ws.send failed: ${P({error:g})}`,error:g})}safeSerialize(i){let $=nr({op:i.op,d:i.d??null});if($ instanceof Error)return this.log.error({action:"ws.send.serialize.error",message:P({error:$}),error:$,detail:{op:i.op}}),null;return $}sendIdentify(){this.log.info({action:"gateway.identify",message:`intents=${this.props.intents}`}),this.send({op:PD,d:{token:this.props.token,intents:this.props.intents,properties:{os:"linux",browser:"open-flume",device:"open-flume"}}})}sendResume(){this.log.info({action:"gateway.resume",message:`seq=${this.currentSession.seq}`}),this.send({op:WD,d:{token:this.props.token,session_id:this.currentSession.sessionId,seq:this.currentSession.seq}})}},pi={Guilds:1,GuildMembers:2,GuildModeration:4,GuildExpressions:8,GuildIntegrations:16,GuildWebhooks:32,GuildInvites:64,GuildVoiceStates:128,GuildPresences:256,GuildMessages:512,GuildMessageReactions:1024,GuildMessageTyping:2048,DirectMessages:4096,DirectMessageReactions:8192,DirectMessageTyping:16384,MessageContent:32768,GuildScheduledEvents:65536,AutoModerationConfiguration:1048576,AutoModerationExecution:2097152,GuildMessagePolls:16777216,DirectMessagePolls:33554432};function sO(i,$){let n={event_type:i};if(typeof $.channel_id==="string")n.channel_id=$.channel_id;if(typeof $.guild_id==="string")n.guild_id=$.guild_id;if(typeof $.user_id==="string")n.user_id=$.user_id;else if(Bi($.author)&&typeof $.author.id==="string")n.user_id=$.author.id;return n}var iJ=pi.Guilds|pi.GuildMessages|pi.DirectMessages,$J=5000,KD=class extends k${options;name="discord";gateway=null;reconnector=null;constructor(i){super();this.options=i}async connect(i){if(!this.hasWebSocket(i))return new gi("Discord source: deps.WebSocket is null (no WebSocket runtime available)");if(i.reconnect&&!this.reconnector)this.reconnector=new $r({...i.reconnect,log:i.log,deps:i.deps});return await this.connectInternal(i)}disconnect(){if(this.reconnector&&!this.reconnector.aborted)this.context?.log.debug({action:"reconnect.cancel",message:"aborting reconnector"});this.reconnector?.cancel(),this.gateway?.disconnect(),this.gateway=null}hasWebSocket(i){let $=G(()=>Boolean(i.deps.WebSocket));if($ instanceof Error){let n=L({value:$});return i.log.error({action:"deps.web-socket.read.error",message:P({error:n}),error:n}),!1}return $}async connectInternal(i,$){this.setStatus("connecting");let n=new eO({token:this.options.token,intents:this.options.intents??iJ,handshakeTimeoutMs:this.options.handshakeTimeoutMs,session:$,onLog:i.log.handler,deps:i.deps,onDispatch:(r,b)=>this.dispatch(i,r,b),onStatus:(r)=>this.handleGatewayStatus(i,n,r)});this.gateway=n;let g=$!==void 0&&$.canResume()&&$.resumeUrl!==null?$.resumeUrl:void 0,v=await n.connect(g);if(v instanceof T){if(i.log.error({action:"connect.failed",message:P({error:v}),error:v}),n.isStopped||!this.reconnector||this.reconnector.aborted)return this.setStatus("disconnected"),v;this.scheduleReconnect(i,n)}return null}dispatch(i,$,n){this.emit({source:"discord",type:$,data:n,meta:this.safeExtractMeta(i,$,n),receivedAt:d({deps:i.deps})})}safeExtractMeta(i,$,n){let g=G(()=>sO($,n));if(g instanceof Error){let v=L({value:g});return i.log.warn({action:"meta.extract.error",message:P({error:v}),error:v,detail:{eventName:$}}),{event_type:$}}return g}handleGatewayStatus(i,$,n){if($!==this.gateway){i.log.debug({action:"gateway.status.stale",message:`ignored ${n} from replaced gateway`});return}if(n==="connected"){if(this.reconnector&&this.reconnector.attempt>0)i.log.info({action:"reconnect.reset",message:`cleared ${this.reconnector.attempt} attempts`});this.reconnector?.reset(),this.setStatus("connected");return}if($.isStopped){this.setStatus("disconnected");return}this.scheduleReconnect(i,$)}scheduleReconnect(i,$){let n=$.session.canResume()?$.session:void 0;vr({reconnector:this.reconnector,log:i.log,setStatus:(g)=>this.setStatus(g),minDelayMs:n===void 0?$J:void 0,retry:()=>{this.connectInternal(i,n).catch((g)=>{let v=L({value:g});i.log.error({action:"reconnect.unhandled",message:P({error:v}),error:v}),this.setStatus("disconnected")})}})}};var t=(i)=>{return i instanceof Error?i.message:String(i)};class BI{ownUserId;constructor(i){this.ownUserId=i.ownUserId}process(i){if(i.authorIsBot)return{skip:!0};let $=this.ownUserId?i.mentionedUserIds.includes(this.ownUserId):!1;return{skip:!1,content:JSON.stringify(i.raw),meta:{event_type:"discord",channel_id:i.channelId,user_id:i.authorId,mentioned:String($),guild_id:i.guildId??""}}}}var o=class extends Error{status;code;retryAfterMs;constructor(i){super(i.message,i.cause===void 0?void 0:{cause:i.cause});this.name="FlumeHttpError",this.status=i.status,this.code=i.code??null,this.retryAfterMs=i.retryAfterMs??null,Object.freeze(this)}};function vJ(){let i=G(()=>globalThis.WebSocket);if(i instanceof Error||typeof i!=="function")return null;return i}function TI(){return{fetch:(i,$)=>globalThis.fetch(i,$),get WebSocket(){return vJ()},now:()=>Date.now(),random:()=>Math.random(),setTimeout:(i,$)=>globalThis.setTimeout(i,$),clearTimeout:(i)=>globalThis.clearTimeout(i),setInterval:(i,$)=>globalThis.setInterval(i,$),clearInterval:(i)=>globalThis.clearInterval(i)}}function LI(){return{value:void 0,done:!0}}var nJ=class{props;items=[];resolvers=[];closed=!1;droppedCount=0;constructor(i){this.props=i}push(i){if(this.closed)return;let $=this.resolvers.shift();if($){$({value:i,done:!1});return}if(this.items.length>=this.props.buffer){if(this.recordDrop(),this.props.onOverflow==="drop-newest")return;this.items.shift()}this.items.push(i)}close(){if(this.closed)return;this.closed=!0;while(this.resolvers.length>0){let i=this.resolvers.shift();if(i)i(LI())}}get dropped(){return this.droppedCount}next(){let i=this.items.shift();if(i!==void 0)return Promise.resolve({value:i,done:!1});if(this.closed)return Promise.resolve(LI());return new Promise(($)=>this.resolvers.push($))}return(){return this.items.splice(0),this.close(),this.props.onClose(),Promise.resolve(LI())}throw(i){return this.items.splice(0),this.close(),this.props.onClose(),Promise.reject(i)}[Symbol.asyncIterator](){return this}recordDrop(){if(this.droppedCount++,this.droppedCount>1)return;this.props.onDrop?.({dropped:1})}},YD=1000;function gJ(i){if(typeof i!=="number"||!Number.isFinite(i))return YD;if(i<1)return 1;return Math.floor(i)}var rJ=class{props;streams=new Set;startupItems=[];startupDropNotified=!1;hasSubscribed=!1;closed=!1;constructor(i={}){this.props=i}get isClosed(){return this.closed}publish(i){if(this.closed)return;if(!this.hasSubscribed){if(this.startupItems.length>=YD){if(this.startupItems.shift(),!this.startupDropNotified)this.startupDropNotified=!0,this.props.onDrop?.({dropped:1})}this.startupItems.push(i);return}for(let $ of this.streams)$.push(i)}subscribe(i){let $=new nJ({buffer:gJ(i?.buffer),onOverflow:i?.onOverflow??"drop-oldest",onClose:()=>this.streams.delete($),onDrop:this.props.onDrop});if(this.closed)return $.close(),$;if(!this.hasSubscribed){this.hasSubscribed=!0;for(let n of this.startupItems)$.push(n);this.startupItems.splice(0)}return this.streams.add($),$}close(){if(this.closed)return;this.closed=!0;for(let i of this.streams)i.close();this.streams.clear(),this.startupItems.splice(0)}},GD=class{kind="closed";finalStatuses;closeErrors;constructor(i){this.finalStatuses=Object.freeze(i.finalStatuses.map(($)=>Object.freeze({...$}))),this.closeErrors=Object.freeze(i.closeErrors.map(($)=>Object.freeze({...$}))),Object.freeze(this)}statuses(){return this.finalStatuses}errors(){return this.closeErrors}},bJ=class{props;kind="running";closePromise=null;onAbort;constructor(i){this.props=i,this.onAbort=()=>{this.props.log.info({action:"flume.abort",message:"signal aborted, closing"}),ai({fn:()=>this.close(),onError:(n)=>{this.props.log.error({action:"flume.abort.close.failed",message:P({error:n}),error:n})}})};let $=i.signal;if($){let n=G(()=>$.addEventListener("abort",this.onAbort,{once:!0}));if(n instanceof Error){let g=L({value:n});i.log.error({action:"signal.addListener.failed",message:P({error:g}),error:g})}}}close(){if(this.closePromise)return this.closePromise;return this.closePromise=this.runClose(),this.closePromise}statuses(){return this.snapshotStatuses()}stream(i){return this.props.hub.subscribe(i)}get signal(){return this.props.signal}async runClose(){let i=[];try{this.props.log.info({action:"flume.close",message:`closing ${this.props.sources.length} source(s)`});let $=await Promise.allSettled(this.props.sources.map((g)=>Promise.resolve().then(()=>g.stop())));for(let[g,v]of $.entries()){let r=this.props.sources[g],b=r?this.sourceName(r):"?",u=v.status==="rejected"?L({value:v.reason}):v.value instanceof Error?v.value:null;if(u===null)continue;i.push({source:b,error:u}),this.props.log.error({action:"flume.close.failed",message:`${b}: ${P({error:u})}`,error:u,detail:{source:b}})}let n=this.props.signal;if(n){let g=G(()=>n.removeEventListener("abort",this.onAbort));if(g instanceof Error){let v=L({value:g});this.props.log.error({action:"signal.removeListener.failed",message:P({error:v}),error:v})}}return await this.props.callbackQueue.drain(),this.props.log.info({action:"flume.close.complete",message:"all sources closed"}),await this.props.callbackQueue.drain(),this.props.hub.close(),new GD({finalStatuses:this.snapshotStatuses(),closeErrors:i})}catch($){let n=L({value:$});return this.props.log.error({action:"flume.close.unhandled",message:P({error:n}),error:n}),this.props.hub.close(),new GD({finalStatuses:this.snapshotStatuses(),closeErrors:i})}}snapshotStatuses(){return this.props.sources.map((i)=>{let $=this.sourceName(i),n=G(()=>i.status());if(n instanceof Error){let g=L({value:n});return this.props.log.error({action:"source.status.failed",message:`${$}: ${P({error:g})}`,error:g,detail:{source:$}}),{source:$,status:"disconnected"}}return{source:$,status:n}})}sourceName(i){let $=G(()=>i.name);if($ instanceof Error)return"?";if(typeof $!=="string")return"?";return $}},a$={maxAttempts:1/0,baseDelay:1000,maxDelay:30000};function uJ(i){if(typeof i!=="number"||!Number.isFinite(i))return a$.baseDelay;if(i<1)return a$.baseDelay;return i}function UJ(i,$){if(typeof i!=="number"||!Number.isFinite(i))return Math.max(a$.maxDelay,$);if(i<$)return $;return i}function IJ(i){if(typeof i!=="number"||Number.isNaN(i))return a$.maxAttempts;if(i===1/0)return 1/0;if(!Number.isInteger(i)||i<1)return a$.maxAttempts;return i}function _J(i){if(i===!1||i===void 0)return null;if(i===!0)return{...a$};let $=uJ(i.baseDelay);return{maxAttempts:IJ(i.maxAttempts),baseDelay:$,maxDelay:UJ(i.maxDelay,$)}}var HD=class{options;consumed=!1;log;deps;sources;sourceEventHandler;hub;callbackQueue=new AI;constructor(i){this.options=i,this.sources=[...i.sources],this.deps=i.deps??TI(),this.hub=new rJ({onDrop:()=>this.notifyStreamOverflow()}),this.log=new li({source:"flume",handler:this.buildLogHandler(),deps:this.deps}),this.sourceEventHandler=($)=>this.emitItem({kind:"event",event:$})}notifyStreamOverflow(){if(!this.options.onEvent)return;let i={level:"warn",source:"flume",action:"stream.overflow",message:"stream buffer overflowed, dropping items (notified once per stream; see FlumeStreamOptions.buffer)",timestamp:d({deps:this.deps})};this.enqueueCallback({kind:"log",log:i})}buildLogHandler(){return(i)=>{this.emitItem({kind:"log",log:i});let $=this.options.onError;if(!$||i.level!=="error")return;try{Promise.resolve($(i)).catch(()=>{})}catch{}}}emitItem(i){if(this.hub.isClosed)return Promise.resolve();return this.hub.publish(i),this.enqueueCallback(i)}enqueueCallback(i){let $=this.options.onEvent;if(!$)return Promise.resolve();return this.callbackQueue.add(async()=>{await G(()=>Promise.resolve($(i)))})}async open(){let i=this.guardOpen();if(i)return i;this.consumed=!0,this.log.info({action:"flume.open",message:`opening ${this.sources.length} source(s)`,detail:{count:this.sources.length}});let $=this.resolveReconnect(),n=await Promise.allSettled(this.sources.map((b)=>this.safeStart(b,$))),g=[];for(let[b,u]of n.entries()){let I=this.sources[b];if(I===void 0)continue;let U=this.sourceName(I);if(u.status==="rejected"){g.push({name:U,error:L({value:u.reason})});continue}if(u.value instanceof Error)g.push({name:U,error:u.value})}if(g.length>0){for(let I of g)this.log.error({action:"flume.source.failed",message:`${I.name}: ${P({error:I.error})}`,error:I.error,detail:{source:I.name}});await this.rollback(this.sources);let b=g.map((I)=>`${I.name}: ${P({error:I.error})}`).join("; "),u=new gi(`Flume.open: ${g.length} source(s) failed: ${b}`);return this.log.error({action:"flume.open.failed",message:P({error:u}),error:u}),await this.callbackQueue.drain(),u}if(this.isSignalAborted()){await this.rollback(this.sources);let b=new gi("Flume.open: aborted during open");return this.log.warn({action:"flume.open.aborted",message:P({error:b}),error:b}),await this.callbackQueue.drain(),b}if(this.log.info({action:"flume.open.complete",message:"all sources opened"}),await this.callbackQueue.drain(),this.isSignalAborted()){await this.rollback(this.sources);let b=new gi("Flume.open: aborted during completion");return this.log.warn({action:"flume.open.aborted",message:P({error:b}),error:b}),await this.callbackQueue.drain(),b}let v=new bJ({sources:this.sources,signal:this.options.signal,log:this.log,hub:this.hub,callbackQueue:this.callbackQueue});if(!this.isSignalAborted())return v;await v.close();let r=new gi("Flume.open: aborted while entering running state");return this.log.warn({action:"flume.open.aborted",message:P({error:r}),error:r}),await this.callbackQueue.drain(),r}guardOpen(){if(this.consumed){let i=new gi("Flume.open: already opened");return this.log.warn({action:"flume.open.refused",message:P({error:i}),error:i}),i}if(this.isSignalAborted()){let i=new gi("Flume.open: signal already aborted");return this.log.warn({action:"flume.open.refused",message:P({error:i}),error:i}),i}return null}resolveReconnect(){let i=G(()=>_J(this.options.reconnect));if(i instanceof Error)return this.log.warn({action:"reconnect.config.invalid",message:P({error:i}),error:i}),null;return i}isSignalAborted(){let i=this.options.signal;if(!i)return!1;let $=G(()=>i.aborted===!0);return $ instanceof Error?!0:$}sourceName(i){let $=G(()=>i.name);if($ instanceof Error)return"?";if(typeof $!=="string")return"?";return $}safeStart(i,$){let n=this.sourceName(i),g={onEvent:this.sourceEventHandler,log:this.log.child(n),deps:this.deps,reconnect:$,signal:this.options.signal};return Promise.resolve().then(()=>i.start(g))}async rollback(i){let $=await Promise.allSettled(i.map((n)=>Promise.resolve().then(()=>n.stop())));for(let[n,g]of $.entries()){let v=i[n],r=v?this.sourceName(v):"?";if(g.status==="rejected"){let b=L({value:g.reason});this.logRollbackFailure(r,b);continue}if(g.value instanceof Error)this.logRollbackFailure(r,g.value)}}logRollbackFailure(i,$){this.log.error({action:"flume.rollback.failed",message:`${i}: ${P({error:$})}`,error:$,detail:{source:i}})}};var p$=(i)=>{if(!i||Object.keys(i).length===0)return;return{...TI(),...i}},e$=(i)=>{if(!i)return;return($)=>{if($.level==="debug")return;let n=`${$.source}/${$.action}: ${$.message}`,g=DJ($);if($.level==="error"){i.error(n,g);return}if($.level==="warn"){i.warn(n,g);return}i.info(n,g)}},DJ=(i)=>{let $={...i.detail};if(i.error){if($.error=i.error.message,i.error.stack)$.stack=i.error.stack;if(i.error.name&&i.error.name!=="Error")$.errorName=i.error.name}return Object.keys($).length>0?$:void 0};class ov{isAlive(){return!0}}class mv{props;constructor(i){this.props=i;Object.freeze(this)}recordRaw(i,$){this.props.log?.recordRaw({eventId:i,type:this.props.type,connectorId:this.props.connectorId,channelId:this.props.channelId,payload:$})}recordProcessed(i,$,n){this.props.log?.recordProcessed({eventId:i,type:this.props.type,connectorId:this.props.connectorId,channelId:this.props.channelId,outcome:$,payload:n})}recordConnection(i,$){this.props.log?.recordConnection({type:this.props.type,connectorId:this.props.connectorId,channelId:this.props.channelId,status:i,detail:$})}}class j$ extends ov{logger;diagnostics;type;running=null;connected=!1;reconnecting=!1;deliveryChain=Promise.resolve();constructor(i){super();this.type=i.type,this.logger=i.logger,this.diagnostics=new mv({type:i.type,connectorId:i.connectorId,channelId:i.channelId,log:i.diagnosticLog})}async runStart(i){let $=i.reconnect??!0,n=$===!1?void 0:$===!0?{}:$,g=(u)=>{if(u.kind==="event"){this.deliveryChain=this.deliveryChain.catch(()=>{}).then(()=>Promise.resolve(i.onEvent(u.event)));return}let I=u.log,U=jJ(I);if(U)this.handleStatus(U);i.onLog?.(I)},v={sources:[i.source],onEvent:g};if(i.deps)v.deps=i.deps;if(i.signal)v.signal=i.signal;if(n)v.reconnect=n;let b=await new HD(v).open();if(b instanceof Error)throw this.diagnostics.recordConnection("error",t(b)),b;this.running=b}async stop(){if(!this.running)return;try{await this.running.close(),this.diagnostics.recordConnection("disconnected","")}catch(i){this.diagnostics.recordConnection("error",t(i)),this.logger?.error(`${this.type} stop error`,{error:t(i)})}finally{this.running=null,this.connected=!1,this.reconnecting=!1,this.deliveryChain=Promise.resolve(),this.onStop(),this.diagnostics.recordConnection("stopped","")}}isAlive(){if(this.running===null)return!1;return this.connected||this.reconnecting}handleStatus(i){if(i.status==="connected"){this.connected=!0,this.reconnecting=!1,this.diagnostics.recordConnection("connected",i.detail??"");return}if(i.status==="disconnected"){this.connected=!1,this.reconnecting=!1,this.diagnostics.recordConnection("disconnected",i.detail??"");return}if(i.status==="reconnecting")this.connected=!1,this.reconnecting=!0}onStop(){}}var kJ=["disconnected","connecting","connected","reconnecting"],wJ=(i)=>typeof i==="string"&&kJ.includes(i),jJ=(i)=>{if(i.action!=="status")return null;let $=i.detail;if(!$)return null;let n=$.to;if(!wJ(n))return null;let g=typeof $.reason==="string"?$.reason:null;return{source:i.source,status:n,detail:g}};var OJ=["MESSAGE_CREATE","MESSAGE_UPDATE"],ZI=(i)=>typeof i==="object"&&i!==null&&!Array.isArray(i),qI=(i,$)=>{let n=i[$];return typeof n==="string"?n:void 0};class MI extends j${config;env;flumeDeps;signal;eventTypes;processor=null;constructor(i){super({type:"discord",connectorId:i.config.id,channelId:i.channelId??null,logger:i.logger,diagnosticLog:i.diagnosticLog});this.config=i.config,this.env=i.env??process.env,this.flumeDeps=i.flumeDeps??{},this.signal=i.signal,this.eventTypes=i.eventTypes==="all"?"all":new Set(i.eventTypes??OJ)}async start(i){this.diagnostics.recordConnection("started","");let $;try{$=Yi({literal:this.config.botToken,envVar:this.config.botTokenEnv,env:this.env,label:`${this.config.name}.botToken`})}catch(g){throw this.diagnostics.recordConnection("auth-failed",t(g)),g}let n=new KD({token:$,intents:pi.Guilds|pi.GuildMessages|pi.MessageContent|pi.DirectMessages});await this.runStart({source:n,onLog:e$(this.logger),deps:p$(this.flumeDeps),signal:this.signal,onEvent:(g)=>{if(g.source!=="discord")return Promise.resolve();return this.handleEvent(g,i)}})}onStop(){this.processor=null}async handleEvent(i,$){if(i.type==="READY"){this.adoptReady(i.data);return}if(!this.processor){let O=crypto.randomUUID();this.diagnostics.recordRaw(O,JSON.stringify(i.data)),this.diagnostics.recordProcessed(O,"skip:pre-ready","");return}if(this.eventTypes!=="all"&&!this.eventTypes.has(i.type)){let O=crypto.randomUUID();this.diagnostics.recordRaw(O,JSON.stringify(i.data)),this.diagnostics.recordProcessed(O,`skip:filtered:${i.type}`,"");return}let n=i.data,g=ZI(n.author)?n.author:null,v=g!==null&&g.bot===!0,r=i.meta.user_id??"",b=i.meta.channel_id??"",u=i.meta.guild_id??null,I=Array.isArray(n.mentions)?n.mentions.map((O)=>ZI(O)?qI(O,"id")??"":"").filter((O)=>O!==""):[],U=crypto.randomUUID(),_=JSON.stringify(n);this.diagnostics.recordRaw(U,_);let k=this.processor.process({authorId:r,authorIsBot:v,channelId:b,guildId:u,mentionedUserIds:I,raw:n});if(k.skip){this.diagnostics.recordProcessed(U,"skip:bot",_),this.logger?.info("discord skip",{reason:"bot author"});return}await this.deliver($,U,_,k.content,k.meta)}adoptReady(i){let $=ZI(i.user)?qI(i.user,"id"):void 0,n=qI(i,"user_id"),g=$??n??"";if(!g){let v=crypto.randomUUID();this.diagnostics.recordRaw(v,JSON.stringify(i)),this.diagnostics.recordProcessed(v,"skip:ready-missing-user-id",""),this.diagnostics.recordConnection("error","discord READY payload had neither user.id nor user_id; processor not initialized"),this.logger?.error("discord READY missing user id",{connector:this.config.name});return}this.processor=new BI({ownUserId:g})}async deliver(i,$,n,g,v){try{await i(g,v)}catch(r){this.diagnostics.recordProcessed($,"emitted:delivery-failed",g||n),this.logger?.error("discord notify error",{error:t(r)});return}this.diagnostics.recordProcessed($,"emitted",g)}}var O$=(i,$,n,g)=>{let v=n[i];if(typeof v==="string")return{[i]:v};let r=n[$];if(typeof r==="string")return{[$]:r};let b={},u=g[i],I=g[$];if(typeof u==="string")b[i]=u;if(typeof I==="string")b[$]=I;return b};var zD=(i={})=>({type:"discord",toolExposed:!0,createListener($,n){return new MI({config:Ai.parse($),channelId:n.channelId,logger:n.logger,diagnosticLog:n.diagnosticLog,signal:n.signal,eventTypes:i.eventTypes})},createAdapter($,n){return new lr({config:Ai.parse($),http:n.http})},secretTokens($){return[Ai.parse($).botToken].filter((g)=>g!==void 0)},buildConfig($,n){return Ai.parse({id:n.id,type:"discord",name:$.name,...typeof $.botToken==="string"?{botToken:$.botToken}:{},...typeof $.botTokenEnv==="string"?{botTokenEnv:$.botTokenEnv}:{},createdAt:n.now,updatedAt:n.now})},applyUpdate($,n,g){let v=Ai.parse($);return Ai.parse({id:v.id,name:v.name,type:"discord",createdAt:v.createdAt,updatedAt:g.now,...O$("botToken","botTokenEnv",n,v)})},operations:{}});import{openSync as AD}from"fs";function SD(i){let $=[],n=Array.from(i),g="",v=!1,r=0;while(r<n.length){let b=n[r]??"";if(v){if(b==='"'&&n[r+1]==='"'){g+='"',r+=2;continue}if(b==='"'){v=!1,r+=1;continue}g+=b,r+=1;continue}if(b==='"'){v=!0,r+=1;continue}if(b===","){$.push(g),g="",r+=1;continue}g+=b,r+=1}return $.push(g),$}class yv{}var xI=(i)=>{if(!i)return;let $={};for(let[n,g]of Object.entries(process.env))if(typeof g==="string")$[n]=g;for(let[n,g]of Object.entries(i))$[n]=g;return $},NI=()=>process.platform==="win32";class R extends yv{constructor(){super();Object.freeze(this)}runSync(i){let $=Bun.spawnSync(i,{stdout:"pipe",stderr:"pipe"});return{exitCode:$.exitCode??0,stdout:$.stdout.toString(),stderr:$.stderr.toString()}}async run(i,$={}){let n=Bun.spawn(i,{cwd:$.cwd,env:xI($.env),stdin:$.input!==void 0?"pipe":"ignore",stdout:"pipe",stderr:"pipe"});if($.input!==void 0&&n.stdin)n.stdin.write($.input),n.stdin.end();let g=await n.exited,v=await new Response(n.stdout).text(),r=await new Response(n.stderr).text();return{exitCode:g,stdout:v,stderr:r}}async attach(i,$={}){let n=Bun.spawn(i,{cwd:$.cwd,env:xI($.env),stdio:["inherit","inherit","inherit"]});if($.onSpawned)$.onSpawned(n.pid);return await n.exited}detach(i,$={}){let n=$.stdoutFile?AD($.stdoutFile,"a"):"ignore",g=$.stderrFile?$.stderrFile===$.stdoutFile&&typeof n==="number"?n:AD($.stderrFile,"a"):"ignore";Bun.spawn(i,{env:xI($.env),stdio:["ignore",n,g],windowsHide:!0}).unref()}kill(i,$="SIGTERM"){try{process.kill(i,$)}catch{}}isAlive(i){if(!Number.isInteger(i)||i<=0)return!1;if(NI())return this.isAliveWindows(i);return this.isAlivePosix(i)}listProcessesContaining(i){if(!i)return[];if(NI())return this.listProcessesContainingWindows(i);return this.listProcessesContainingPosix(i)}getStartTime(i){if(!Number.isInteger(i)||i<=0)return null;if(NI())return this.getStartTimeWindows(i);return this.getStartTimePosix(i)}isAlivePosix(i){let $=this.runSync(["ps","-p",String(i),"-o","state="]);if($.exitCode!==0)return!1;let n=$.stdout.trim();if(!n)return!1;return!n.startsWith("Z")}isAliveWindows(i){let $=this.runSync(["tasklist","/FI",`PID eq ${i}`,"/NH","/FO","CSV"]);if($.exitCode!==0)return!1;return $.stdout.includes(`"${i}"`)}listProcessesContainingPosix(i){let $=this.runSync(["ps","-e","-o","pid=,args="]);if($.exitCode!==0)return[];let n=[];for(let g of $.stdout.split(`
68
- `)){let v=g.trim();if(!v)continue;let r=/^(\d+)\s+(.+)$/.exec(v);if(!r)continue;let b=Number(r[1]),u=r[2]??"";if(!Number.isInteger(b)||b<=0)continue;if(!u.includes(i))continue;n.push({pid:b,command:u})}return n}getStartTimePosix(i){let $=this.runSync(["ps","-p",String(i),"-o","lstart="]);if($.exitCode!==0)return null;let n=$.stdout.trim();if(!n)return null;return n}getStartTimeWindows(i){let $=`Get-CimInstance Win32_Process -Filter "ProcessId=${i}" | Select-Object -ExpandProperty CreationDate | ForEach-Object { $_.ToString("o") }`,n=this.runSync(["powershell","-NoProfile","-Command",$]);if(n.exitCode!==0)return null;let g=n.stdout.trim();if(!g)return null;return g}listProcessesContainingWindows(i){let n=this.runSync(["powershell","-NoProfile","-Command","Get-CimInstance Win32_Process | Select-Object ProcessId,CommandLine | ConvertTo-Csv -NoTypeInformation"]);if(n.exitCode!==0)return[];let g=[],v=n.stdout.split(/\r?\n/).slice(1);for(let r of v){let b=r.trim();if(!b)continue;let u=SD(b);if(u.length<2)continue;let I=Number(u[0]),U=u[1]??"";if(!Number.isInteger(I)||I<=0)continue;if(!U.includes(i))continue;g.push({pid:I,command:U})}return g}}var JJ=new R;class tI extends $${process;constructor(i={}){super();this.process=i.process??JJ,Object.freeze(this)}async call(i){let $=["api",i.path];if(i.method&&i.method.toLowerCase()!=="get")$.push("-X",i.method.toUpperCase());let n=i.body&&typeof i.body==="object"&&Object.keys(i.body).length>0;if(n)$.push("--input","-");let g=await this.process.run(["gh",...$],{input:n?JSON.stringify(i.body):void 0});if(g.exitCode!==0)throw Error(`gh api failed: ${g.stderr.trim()||g.stdout.trim()}`);try{return JSON.parse(g.stdout)}catch{return g.stdout}}}var Li=D.object({id:D.string(),name:D.string(),type:D.literal("gh"),pollInterval:D.number().int().positive().optional(),token:D.string().optional(),tokenEnv:D.string().optional(),createdAt:D.string().datetime().optional(),updatedAt:D.string().datetime().optional()});async function hv(i){try{return await i.response.text()}catch($){let n=G(()=>i.response.status),g=typeof n==="number"?n:0;return new o({message:`${i.context}: failed to read body: ${P({error:$})}`,status:g,cause:$})}}function PJ(i){return{event_type:"notification",reason:i.reason,subject_type:i.subject.type,repository:i.repository.full_name,thread_id:i.id}}var WJ=D.object({id:D.string(),reason:D.string(),unread:D.boolean(),updated_at:D.string(),subject:D.object({title:D.string(),url:D.string().nullable(),type:D.string()}),repository:D.object({full_name:D.string()})}),VJ=class{props;seen=new Map;constructor(i){this.props=i}has(i,$){return this.seen.get(i)===$}add(i,$){this.seen.delete(i),this.seen.set(i,$)}trim(){if(this.seen.size<=this.props.maxSize)return;let i=this.seen.size-this.props.maxSize;for(let $ of this.seen.keys()){if(i<=0)break;this.seen.delete($),i--}}get size(){return this.seen.size}},XJ="https://api.github.com/notifications",fJ=3,QJ=5000,lD=1000,EI=2147483647,KJ=class{props;log;cache=new VJ({maxSize:QJ});timer=null;rateLimitTimer=null;rateLimitPauseActive=!1;since=null;etag=null;lastModified=null;bootstrapped=!1;isStoppedFlag=!1;inFlight=!1;consecutiveErrors=0;degraded=!1;effectiveIntervalSec;controller=null;constructor(i){this.props=i,this.log=new li({source:"github.poller",handler:i.onLog,deps:i.deps}),this.effectiveIntervalSec=i.interval}get isStopped(){return this.isStoppedFlag}async start(){this.isStoppedFlag=!1;let i=G(()=>new AbortController);if(i instanceof Error)this.log.error({action:"github.abort-controller.new.error",message:P({error:i}),error:i}),this.controller=null;else this.controller=i;this.log.info({action:"poller.start",message:`polling every ${this.effectiveIntervalSec}s`});let $=await this.poll();if($)return $;if(this.isStoppedFlag)return null;if(this.rateLimitPauseActive)return null;return this.scheduleInterval(),null}stop(){this.log.info({action:"poller.stop",message:"stopping poller"}),this.isStoppedFlag=!0,this.controller?.abort(),this.controller=null,this.clearTimer(),this.clearRateLimitTimer(),this.rateLimitPauseActive=!1}scheduleInterval(){this.clearTimer();let i=G(()=>this.props.deps.setInterval(()=>{this.poll().catch(($)=>{let n=L({value:$});this.log.error({action:"poll.unhandled",message:P({error:n}),error:n})})},Math.min(this.effectiveIntervalSec*1000,EI)));if(i instanceof Error){if(this.log.error({action:"poller.interval.schedule.error",message:P({error:i}),error:i}),this.timer=null,!this.isStoppedFlag)this.props.onDisconnected("interval scheduling rejected by runtime");return}this.timer=i}async poll(){if(this.inFlight||this.isStoppedFlag)return null;this.inFlight=!0;try{return await this.pollOnce()}catch(i){let $=L({value:i}),n=new o({message:`poll loop threw: ${P({error:$})}`,status:0,cause:$});if(this.log.error({action:"poll.unhandled",message:P({error:n}),error:n}),!this.bootstrapped)return n;return null}finally{this.inFlight=!1}}async pollOnce(){let i=new URLSearchParams({all:"false",per_page:"50"});if(this.since)i.set("since",this.since);let $=await this.fetchPage(`${XJ}?${i}`,!0);if(this.isStoppedFlag)return null;if($ instanceof Error)return this.recordFailure({kind:"network",message:$.message,cause:$});if(this.followPollIntervalHeader($.headers.get("X-Poll-Interval")),$.status===304)return this.consecutiveErrors=0,this.log.debug({action:"poll.not-modified",message:"304 Not Modified"}),this.notifyRecoveredIfDegraded(),null;if(await this.isRateLimited($))return this.handleRateLimit($),null;if(!$.ok){let r=new o({message:`HTTP ${$.status}`,status:$.status});return this.recordFailure({kind:"http",message:P({error:r}),error:r})}let n=$.headers.get("ETag"),g=$.headers.get("Last-Modified"),v=await this.collectPages($);if(!Array.isArray(v))return v;return this.processNotifications(v),this.consecutiveErrors=0,this.etag=n,this.lastModified=g,this.advanceCursor(),this.notifyRecoveredIfDegraded(),null}async collectPages(i){let $=[],n=i,g=1;while(!0){let v=await this.readPageBody(n);if(this.isStoppedFlag)return null;if(v instanceof Error)return this.recordFailure({kind:"http",message:v.message,error:v});if(v===null)return null;for(let u of v)$.push(u);let r=this.findNextPageUrl(n.headers.get("Link"));if(r===null)return $;if(g>=lD){let u=new o({message:`pagination exceeded the safety limit of ${lD} pages`,status:0});return this.recordFailure({kind:"http",message:u.message,error:u})}let b=await this.fetchPage(r,!1);if(this.isStoppedFlag)return null;if(b instanceof Error)return this.recordFailure({kind:"network",message:b.message,cause:b});if(await this.isRateLimited(b))return this.handleRateLimit(b),null;if(!b.ok){let u=new o({message:`HTTP ${b.status}`,status:b.status});return this.recordFailure({kind:"http",message:P({error:u}),error:u})}n=b,g++}}async fetchPage(i,$){this.log.debug({action:"http.request",message:`GET ${i}`});let n={Authorization:`Bearer ${this.props.token}`,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"};if($&&this.etag)n["If-None-Match"]=this.etag;if($&&this.lastModified)n["If-Modified-Since"]=this.lastModified;let g=await G(()=>this.props.deps.fetch(i,{headers:n,signal:this.controller?.signal}));if(g instanceof Error)return this.log.error({action:"http.error",message:P({error:g}),error:g}),g;return this.log.debug({action:"http.response",message:`GET ${g.status}`,detail:{status:g.status,url:i}}),g}async readPageBody(i){let $=await hv({response:i,context:"notifications"});if($ instanceof o)return this.log.warn({action:"http.body.read",message:P({error:$}),error:$}),$;let n=w$($);if(n instanceof ii)return this.log.warn({action:"http.body.parse",message:n.message,error:n}),null;if(!Array.isArray(n))return this.log.warn({action:"http.body.shape",message:"response body is not an array, dropping",detail:{bodyType:typeof n}}),null;return n}findNextPageUrl(i){if(i===null)return null;for(let $ of i.split(",")){if(!$.includes('rel="next"'))continue;let n=$.match(/<([^>]+)>/)?.[1];if(n!==void 0)return n}return null}recordFailure(i){this.consecutiveErrors++;let $=i.error??new o({message:i.message,status:0,cause:i.cause});if(this.log.error({action:"http.error",message:i.message,error:$,detail:{consecutiveErrors:this.consecutiveErrors}}),this.consecutiveErrors>=fJ&&!this.isStoppedFlag)this.degraded=!0,this.props.onDisconnected(i.kind==="network"?"network error":i.message);if(!this.bootstrapped)return $;return null}notifyRecoveredIfDegraded(){if(!this.degraded)return;this.degraded=!1,this.props.onConnected()}async isRateLimited(i){if(i.status===429)return!0;if(i.status!==403)return!1;if(i.headers.get("Retry-After")!==null)return!0;if(i.headers.get("X-RateLimit-Remaining")==="0")return!0;let $=G(()=>i.clone());if($ instanceof Error)return!1;let n=await hv({response:$,context:"rate limit response"});if(n instanceof Error)return!1;let g=n.toLowerCase();return g.includes("secondary rate limit")||g.includes("abuse detection")}handleRateLimit(i){let $=i.headers.get("Retry-After"),n=i.headers.get("X-RateLimit-Reset"),g=Math.floor(d({deps:this.props.deps})/1000),v=$!==null?Number.parseInt($,10):NaN,r=n!==null?Number.parseInt(n,10)-g:NaN,b=Number.isFinite(v)&&v>0?v:Number.isFinite(r)&&r>0?r:60;this.log.warn({action:"rate.limit",message:`rate limited, pausing for ${b}s`,detail:{status:i.status,delaySec:b}}),this.clearTimer(),this.clearRateLimitTimer(),this.rateLimitPauseActive=!0;let u=G(()=>this.props.deps.setTimeout(()=>{if(this.rateLimitTimer=null,this.rateLimitPauseActive=!1,this.isStoppedFlag)return;this.scheduleInterval(),this.poll().catch((I)=>{let U=L({value:I});this.log.error({action:"poll.unhandled",message:P({error:U}),error:U})})},Math.min(b*1000,EI)));if(u instanceof Error){if(this.log.error({action:"poller.rate-limit.schedule.error",message:P({error:u}),error:u}),this.rateLimitTimer=null,!this.isStoppedFlag)this.props.onDisconnected("rate-limit timer scheduling rejected by runtime")}else this.rateLimitTimer=u}clearTimer(){if(this.timer===null)return;let i=this.timer,$=G(()=>this.props.deps.clearInterval(i));if($ instanceof Error)this.log.error({action:"poller.timer.clear.error",message:P({error:$}),error:$});this.timer=null}clearRateLimitTimer(){if(this.rateLimitTimer===null)return;let i=this.rateLimitTimer,$=G(()=>this.props.deps.clearTimeout(i));if($ instanceof Error)this.log.error({action:"poller.rate-limit.clear.error",message:P({error:$}),error:$});this.rateLimitTimer=null}followPollIntervalHeader(i){if(i===null)return;let $=Number.parseInt(i,10);if(!Number.isFinite($))return;let n=Math.min(Math.max(this.props.interval,$),Math.floor(EI/1000));if(n===this.effectiveIntervalSec)return;if(this.log.info({action:"poll.interval.follow",message:`adjusting interval ${this.effectiveIntervalSec}s -> ${n}s per X-Poll-Interval`,detail:{from:this.effectiveIntervalSec,to:n}}),this.effectiveIntervalSec=n,this.timer!==null)this.scheduleInterval()}processNotifications(i){let $=i.map((r)=>WJ.safeParse(r));for(let r of $){if(r.success)continue;this.log.warn({action:"parse.skip",message:"notification did not match schema",detail:{issues:r.error.issues.map((b)=>({path:b.path,message:b.message}))}})}let n=$.flatMap((r)=>r.success?[r.data]:[]),g=i.length-n.length;if(g>0)this.log.warn({action:"parse.summary",message:`${g}/${i.length} notifications dropped by schema`});if(!this.bootstrapped){this.bootstrapped=!0;for(let r of n)this.cache.add(r.id,r.updated_at);this.log.info({action:"poller.bootstrap",message:`seeded ${n.length} existing notifications`}),this.degraded=!1,this.props.onConnected();return}let v=n.filter((r)=>{if(this.cache.has(r.id,r.updated_at))return!1;return this.cache.add(r.id,r.updated_at),!0});if(this.cache.trim(),v.length>0){this.log.info({action:"poll.fresh",message:`${v.length} new notifications`,detail:{count:v.length}}),this.props.onNotifications(v);return}this.log.debug({action:"poll.idle",message:"0 new notifications"})}advanceCursor(){if(this.lastModified!==null){let n=new Date(this.lastModified);if(!Number.isNaN(n.getTime())){let g=G(()=>n.toISOString());if(!(g instanceof Error)){this.since=g;return}}}let i=d({deps:this.props.deps});if(!Number.isFinite(i)){this.log.warn({action:"cursor.advance.skip",message:"deps.now() returned non-finite, leaving since cursor unchanged"});return}let $=G(()=>new Date(i).toISOString());if($ instanceof Error){let n=L({value:$});this.log.warn({action:"cursor.advance.skip",message:P({error:n}),error:n});return}this.since=$}},cI=60,GJ=Math.floor(2147483.647),BD=class extends k${options;name="github";poller=null;constructor(i){super();this.options=i}async connect(i){this.setStatus("connecting"),this.poller=new KJ({token:this.options.token,interval:this.getPollIntervalSec(),onLog:i.log.handler,deps:i.deps,onNotifications:(n)=>this.handleNotifications(i,n),onConnected:()=>this.setStatus("connected"),onDisconnected:(n)=>this.setStatus("disconnected",n)});let $=await this.poller.start();if($ instanceof Error)return i.log.error({action:"source.start.failed",message:P({error:$}),error:$}),this.setStatus("disconnected",$.message),$;return null}disconnect(){this.poller?.stop(),this.poller=null}getPollIntervalSec(){let i=this.options.pollInterval;if(typeof i!=="number")return cI;if(!Number.isFinite(i))return cI;if(i<=0)return cI;return Math.min(i,GJ)}handleNotifications(i,$){for(let n of $)this.emit({source:"github",type:"notification",data:n,meta:this.safeExtractMeta(i,n),receivedAt:d({deps:i.deps})})}safeExtractMeta(i,$){let n=G(()=>PJ($));if(n instanceof Error){let g=L({value:n});return i.log.warn({action:"meta.extract.error",message:P({error:g}),error:g,detail:{notificationId:$.id}}),{event_type:"notification"}}return n}};var YJ=new R;class CI extends j${config;env;process;flumeDeps;signal;constructor(i){super({type:"gh",connectorId:i.config.id,channelId:i.channelId??null,logger:i.logger,diagnosticLog:i.diagnosticLog});this.config=i.config,this.env=i.env??process.env,this.process=i.process??YJ,this.flumeDeps=i.flumeDeps??{},this.signal=i.signal}async start(i){this.diagnostics.recordConnection("started","");let $;try{$=await this.resolveToken()}catch(g){throw this.diagnostics.recordConnection("auth-failed",t(g)),g}let n=new BD({token:$,pollInterval:this.config.pollInterval??60});await this.runStart({source:n,onLog:e$(this.logger),deps:p$(this.flumeDeps),signal:this.signal,onEvent:(g)=>{if(g.source!=="github")return Promise.resolve();return this.handleEvent(g,i)}})}async resolveToken(){if(this.config.token)return this.config.token;if(this.config.tokenEnv){let $=this.env[this.config.tokenEnv];if(typeof $==="string"&&$!=="")return $;throw Error(`${this.config.name}.token references env var "${this.config.tokenEnv}" but it is not set`)}let i=await this.process.run(["gh","auth","token"]);if(i.exitCode!==0)throw Error(`gh auth token failed: ${i.stderr.trim()||i.stdout.trim()}`);return i.stdout.trim()}async handleEvent(i,$){let n=i.data.id,g=JSON.stringify(i.data);this.diagnostics.recordRaw(n,g);let v={...i.meta,event_type:"gh",subject_url:i.data.subject.url??"",updated_at:i.data.updated_at};await this.deliver($,n,g,v)}async deliver(i,$,n,g){try{await i(n,g)}catch(v){this.diagnostics.recordProcessed($,"emitted:delivery-failed",n),this.logger?.error("gh notify error",{error:t(v)});return}this.diagnostics.recordProcessed($,"emitted",n)}}var LD=()=>({type:"gh",toolExposed:!0,createListener(i,$){return new CI({config:Li.parse(i),channelId:$.channelId,process:$.process,logger:$.logger,diagnosticLog:$.diagnosticLog,signal:$.signal})},createAdapter(i,$){return Li.parse(i),new tI({process:$.process})},secretTokens(i){return[Li.parse(i).token].filter((n)=>n!==void 0)},buildConfig(i,$){return Li.parse({id:$.id,type:"gh",name:i.name,...typeof i.pollInterval==="number"?{pollInterval:i.pollInterval}:{},...typeof i.token==="string"?{token:i.token}:{},...typeof i.tokenEnv==="string"?{tokenEnv:i.tokenEnv}:{},createdAt:$.now,updatedAt:$.now})},applyUpdate(i,$,n){let g=Li.parse(i);return Li.parse({id:g.id,name:g.name,type:"gh",pollInterval:typeof $.pollInterval==="number"?$.pollInterval:g.pollInterval,createdAt:g.createdAt,updatedAt:n.now,...O$("token","tokenEnv",$,g)})},operations:{}});import{join as pJ}from"path";var dv=(i,$,n)=>{let g=new Set;for(let v of i.split(",")){if(v.length===0)throw Error(`invalid empty cron list item: "${i}"`);let r=v.split("/");if(r.length>2)throw Error(`invalid cron step: "${v}"`);let b=r[0],u=r[1];if(r.length===2&&u==="")throw Error(`invalid cron step: "${v}"`);let I=u?Number(u):1;if(!Number.isInteger(I)||I<=0)throw Error(`invalid cron step: "${u}"`);let U=$,_=n;if(b==="*"||b===void 0||b==="")U=$,_=n;else if(b.includes("-")){let k=b.split("-");if(k.length!==2)throw Error(`invalid cron range: "${b}"`);let O=k[0],J=k[1],Q=Number(O),A=Number(J);if(!Number.isInteger(Q)||!Number.isInteger(A))throw Error(`invalid cron range: "${b}"`);U=Q,_=A}else{let k=Number(b);if(!Number.isInteger(k))throw Error(`invalid cron value: "${b}"`);U=k,_=u?n:k}if(U<$||_>n||U>_)throw Error(`cron value out of range: ${b} (must be ${$}-${n})`);for(let k=U;k<=_;k+=I)g.add(k)}return{min:$,max:n,values:g}},TD=(i)=>{let $=i.trim().split(/\s+/);if($.length!==5)throw Error(`cron must have 5 fields (got ${$.length}): "${i}"`);let[n,g,v,r,b]=$;if(!n||!g||!v||!r||!b)throw Error(`cron has empty fields: "${i}"`);return{minute:dv(n,0,59),hour:dv(g,0,23),dayOfMonth:dv(v,1,31),month:dv(r,1,12),dayOfWeek:dv(b,0,7),dayOfMonthRestricted:v!=="*",dayOfWeekRestricted:b!=="*"}},ZD=(i)=>{TD(i)},gr=(i,$)=>{let n=TD(i);if(!n.minute.values.has($.getMinutes()))return!1;if(!n.hour.values.has($.getHours()))return!1;if(!n.month.values.has($.getMonth()+1))return!1;let g=n.dayOfMonth.values.has($.getDate()),v=$.getDay(),r=n.dayOfWeek.values.has(v)||v===0&&n.dayOfWeek.values.has(7);if(n.dayOfMonthRestricted&&n.dayOfWeekRestricted)return g||r;return g&&r};var qD=D.enum(["latest","all","skip"]),MD=D.string().superRefine((i,$)=>{try{ZD(i)}catch(n){$.addIssue({code:"custom",message:n instanceof Error?n.message:String(n)})}}),xD=D.object({id:D.string(),prompt:D.string(),enabled:D.boolean().default(!0),catchupPolicy:qD.default("latest"),createdAt:D.string().datetime().optional()}),ND=D.object({id:D.string().optional(),prompt:D.string(),enabled:D.boolean().optional(),catchupPolicy:qD.optional()}),HJ=ND.extend({cron:MD}).strict(),zJ=ND.extend({runAt:D.string().datetime({offset:!0})}).strict(),tD=D.union([zJ,HJ]),SJ=xD.extend({kind:D.literal("cron").default("cron"),cron:MD}),AJ=xD.extend({kind:D.literal("once"),runAt:D.string().datetime({offset:!0})}),RI=D.union([AJ,SJ]),Xi=D.object({id:D.string(),name:D.string(),type:D.literal("schedule"),entries:D.array(RI).default([]),createdAt:D.string().datetime().optional(),updatedAt:D.string().datetime().optional()});var ED=1440;class FI extends ov{config;lastFiredStore;logger;diagnostics;now;onFired;timer=null;stopped=!1;tickScheduled=!1;constructor(i){super();this.config=i.config,this.lastFiredStore=i.lastFiredStore,this.logger=i.logger,this.diagnostics=new mv({type:"schedule",connectorId:i.config.id,channelId:i.channelId??null,log:i.diagnosticLog}),this.now=i.now??(()=>new Date),this.onFired=i.onFired??null}async start(i){this.stopped=!1,this.tickScheduled=!0,this.diagnostics.recordConnection("started","");let $=()=>{if(this.stopped)return;let n=this.now(),g=60000-(n.getSeconds()*1000+n.getMilliseconds());this.timer=setTimeout(async()=>{if(this.stopped)return;try{await this.tick(i)}catch(v){this.recordTickError(v)}$()},g),this.timer.unref(),this.tickScheduled=!0};try{await this.tick(i)}catch(n){this.recordTickError(n)}this.diagnostics.recordConnection("connected",""),$()}async stop(){if(this.stopped=!0,this.tickScheduled=!1,this.timer)clearTimeout(this.timer),this.timer=null;this.diagnostics.recordConnection("disconnected",""),this.diagnostics.recordConnection("stopped","")}recordTickError(i){let $=t(i);this.diagnostics.recordConnection("error",`tick: ${$}`),this.logger?.error("schedule tick failed",{connector:this.config.name,error:$})}isAlive(){return!this.stopped&&this.tickScheduled}async tick(i){let $=this.truncateToMinute(this.now()),n=this.lastFiredStore.load(),g=[this.pruneRemovedEntries(n)];for(let v of this.config.entries){if(!v.enabled)continue;let r=await this.fireEntry(v,$,n,i);g.push(r)}if(g.includes(!0))this.lastFiredStore.save(n)}async fireEntry(i,$,n,g){if(i.kind==="once")return this.fireOnceEntry(i,$,n,g);return this.fireCronEntry(i,$,n,g)}async fireOnceEntry(i,$,n,g){if(n.has(i.id))return!1;let v=new Date(i.runAt);if($.getTime()<v.getTime())return!1;let r=$.getTime()-v.getTime();if(i.catchupPolicy==="skip"&&r>=60000)return n.set(i.id,v),!0;return await this.notifyOne(i,v,g,r>0),n.set(i.id,v),!0}async fireCronEntry(i,$,n,g){let v=n.get(i.id),r=i.createdAt?this.truncateToMinute(new Date(i.createdAt)):$,b=v?new Date(v.getTime()+60000):r;if(b.getTime()>$.getTime())return!1;if(i.catchupPolicy==="skip"){try{if(!gr(i.cron,$))return!1}catch(I){return this.logInvalidCron(i,I),!1}return await this.notifyOne(i,$,g,!1),n.set(i.id,$),!0}if(i.catchupPolicy==="all"){let I=this.findAllMatches(i.cron,b,$,i.id);if(I.length===0)return this.seedSearchWatermark(i.id,v,$,n);for(let U of I)await this.notifyOne(i,U,g,U.getTime()!==$.getTime());return n.set(i.id,I[I.length-1]??$),!0}let u=this.findMostRecentMatch(i.cron,b,$,i.id);if(!u)return this.seedSearchWatermark(i.id,v,$,n);return await this.notifyOne(i,u,g,u.getTime()!==$.getTime()),n.set(i.id,u),!0}seedSearchWatermark(i,$,n,g){if($!==void 0)return!1;return g.set(i,n),!0}async notifyOne(i,$,n,g){let v={event_type:"schedule",schedule_id:i.id,schedule_kind:i.kind,fired_at:$.toISOString(),catchup_policy:i.catchupPolicy};if(i.kind==="cron")v.cron=i.cron;else v.run_at=i.runAt;if(g)v.catchup="true";let r=`${i.id}@${$.toISOString()}`;this.diagnostics.recordRaw(r,JSON.stringify({schedule_id:i.id,kind:i.kind,...i.kind==="cron"?{cron:i.cron}:{run_at:i.runAt},prompt:i.prompt,fired_at:$.toISOString(),catchup:g}));try{await n(i.prompt,v)}catch(b){throw this.diagnostics.recordProcessed(r,"emitted:delivery-failed",i.prompt),b}if(this.diagnostics.recordProcessed(r,"emitted",i.prompt),this.onFired)try{await this.onFired(i,$)}catch(b){this.logger?.error("schedule onFired callback failed",{connector:this.config.name,id:i.id,error:t(b)})}}findMostRecentMatch(i,$,n,g){let v=Math.min(ED,Math.floor((n.getTime()-$.getTime())/60000)+1);for(let r=0;r<v;r++){let b=new Date(n.getTime()-r*60000);try{if(gr(i,b))return b}catch(u){return this.logInvalidCron({id:g,cron:i},u),null}}return null}findAllMatches(i,$,n,g){let v=Math.min(ED,Math.floor((n.getTime()-$.getTime())/60000)+1),r=[];for(let b=0;b<v;b++){let u=new Date($.getTime()+b*60000);if(u.getTime()>n.getTime())break;try{if(gr(i,u))r.push(u)}catch(I){return this.logInvalidCron({id:g,cron:i},I),[]}}return r}logInvalidCron(i,$){let n=t($);this.diagnostics.recordConnection("error",`invalid cron "${i.cron}" (entry ${i.id}): ${n}`),this.logger?.error("invalid cron expression in schedule",{connector:this.config.name,id:i.id,cron:i.cron,error:n})}truncateToMinute(i){let $=new Date(i.getTime());return $.setSeconds(0,0),$}pruneRemovedEntries(i){let $=new Set(this.config.entries.map((g)=>g.id)),n=[];for(let g of i.keys()){if($.has(g))continue;i.delete(g),n.push(g)}return n.length>0}}import{dirname as dJ}from"path";import{appendFileSync as lJ,chmodSync as BJ,closeSync as LJ,existsSync as TJ,mkdirSync as ZJ,openSync as qJ,readdirSync as MJ,readFileSync as RD,renameSync as xJ,statSync as FD,unlinkSync as pv,writeFileSync as oD}from"fs";import{dirname as NJ,basename as tJ}from"path";class av{}var EJ=384,oI=0,cJ=()=>{return oI=oI+1|0,`${process.pid}-${oI}-${Math.floor(Math.random()*1e9)}`};class F extends av{constructor(){super();Object.freeze(this)}existsSync(i){return TJ(i)}readFileSync(i){return RD(i,"utf-8")}writeFileSync(i,$){CD(i,$,null)}writeSecretFileSync(i,$){CD(i,$,EJ)}appendFileSync(i,$){lJ(i,$)}unlink(i){try{pv(i)}catch($){if(mI($,"ENOENT"))return;throw $}}mkdirSync(i,$){ZJ(i,{recursive:$?.recursive??!1})}readdirSync(i){return MJ(i)}statSync(i){let $=FD(i);return{mtimeMs:$.mtimeMs,mode:$.mode&511}}withFileLock(i,$){let n=oJ(i);try{return $()}finally{try{LJ(n)}catch{}try{pv(i)}catch{}}}}var CJ=10,RJ=100,cD=5000,FJ=30000,oJ=(i)=>{let $=performance.now()+cD,n=0;while(!0)try{let g=qJ(i,"wx",384);return oD(g,String(process.pid)),g}catch(g){if(!mI(g,"EEXIST"))throw g;if(performance.now()>=$)throw Error(`failed to acquire file lock ${i} within ${cD}ms`);mJ(i);let v=Math.min(RJ,CJ*2**Math.min(n,4));hJ(v),n=n+1}},mJ=(i)=>{let $,n;try{n=FD(i).mtimeMs,$=Number(RD(i,"utf-8").trim())}catch{return}if(Date.now()-n>FJ){try{pv(i)}catch{}return}if($>0&&!yJ($))try{pv(i)}catch{}},yJ=(i)=>{try{return process.kill(i,0),!0}catch($){if(mI($,"EPERM"))return!0;return!1}},hJ=(i)=>{let $=new SharedArrayBuffer(4),n=new Int32Array($);Atomics.wait(n,0,0,i)},mI=(i,$)=>{if(!(i instanceof Error))return!1;if(!("code"in i))return!1;return i.code===$},CD=(i,$,n)=>{let v=`${NJ(i)}/.${tJ(i)}.${cJ()}.tmp`,r=n===null?void 0:{mode:n};try{if(oD(v,$,r),n!==null)try{BJ(v,n)}catch{}xJ(v,i)}catch(b){try{pv(v)}catch{}throw b}};var aJ=new F;class yI{path;fs;constructor(i){this.path=i.path,this.fs=i.fs??aJ,Object.freeze(this)}load(){let i=new Map;if(!this.fs.existsSync(this.path))return i;let $=JSON.parse(this.fs.readFileSync(this.path));if($===null||typeof $!=="object")return i;for(let[n,g]of Object.entries($))if(typeof g==="string")i.set(n,new Date(g));return i}save(i){let $={};for(let[n,g]of i)$[n]=g.toISOString();this.fs.mkdirSync(dJ(this.path),{recursive:!0}),this.fs.writeFileSync(this.path,`${JSON.stringify($,null,2)}
69
- `)}}var eJ=D.object({id:D.string()}),mD=(i={})=>({type:"schedule",toolExposed:!1,createListener($,n){let g=Xi.parse($);return new FI({config:g,lastFiredStore:new yI({path:pJ(n.connectorDir(n.channelId,g.id),"state.json"),fs:n.fs}),channelId:n.channelId,logger:n.logger,diagnosticLog:n.diagnosticLog,onFired:i.onFired,now:()=>n.clock.now()})},createAdapter:null,secretTokens(){return[]},buildConfig($,n){return Xi.parse({id:n.id,type:"schedule",name:$.name,entries:Array.isArray($.entries)?$.entries:[],createdAt:n.now,updatedAt:n.now})},applyUpdate($,n,g){let v=Xi.parse($);return Xi.parse({...v,updatedAt:g.now})},operations:{listEntries($){let n=Xi.parse($.config);return{config:$.config,result:n.entries}},addEntry($){let n=Xi.parse($.config),g=tD.parse($.args),v=g.id??$.context.generateId();if(n.entries.some((b)=>b.id===v))throw Error(`schedule entry "${v}" already exists`);let r=RI.parse({id:v,..."cron"in g?{kind:"cron",cron:g.cron}:{kind:"once",runAt:g.runAt},prompt:g.prompt,createdAt:$.context.now,...g.enabled!==void 0?{enabled:g.enabled}:{},...g.catchupPolicy!==void 0?{catchupPolicy:g.catchupPolicy}:{}});return{config:Xi.parse({...n,entries:[...n.entries,r],updatedAt:$.context.now}),result:r}},removeEntry($){let n=Xi.parse($.config),g=eJ.parse($.args);if(!n.entries.some((v)=>v.id===g.id))throw Error(`schedule entry "${g.id}" not found`);return{config:Xi.parse({...n,entries:n.entries.filter((v)=>v.id!==g.id),updatedAt:$.context.now}),result:null}}}});var sJ="https://slack.com/api/",iP=(i)=>{let $={};for(let[n,g]of Object.entries(i))$[n]=g;return $};class hI extends $${token;http;constructor(i){super();this.token=Yi({literal:i.config.botToken,envVar:i.config.botTokenEnv,env:i.env??process.env,label:`${i.config.name}.botToken`}),this.http=i.http??new Di,Object.freeze(this)}async call(i){let $=`${sJ}${i.path}`,n=i.body!==null&&typeof i.body==="object"?iP(i.body):{},g=new URLSearchParams;for(let[b,u]of Object.entries(n))g.set(b,typeof u==="string"?u:JSON.stringify(u));let r=await(await this.http.fetch({method:"POST",url:$,headers:{Authorization:`Bearer ${this.token}`,"Content-Type":"application/x-www-form-urlencoded"},body:g.toString()})).text();try{return JSON.parse(r)}catch{return{ok:!1,error:`non-JSON response: ${r.slice(0,200)}`}}}async postMessage(i){return this.call({method:"post",path:"chat.postMessage",body:{channel:i.channel,text:i.text,...i.threadTs?{thread_ts:i.threadTs}:{}}})}async addReaction(i){return this.call({method:"post",path:"reactions.add",body:{channel:i.channel,timestamp:i.timestamp,name:i.name}})}async removeReaction(i){return this.call({method:"post",path:"reactions.remove",body:{channel:i.channel,timestamp:i.timestamp,name:i.name}})}}var Ti=D.object({id:D.string(),name:D.string(),type:D.literal("slack"),botToken:D.string().startsWith("xoxb-").optional(),appToken:D.string().startsWith("xapp-").optional(),botTokenEnv:D.string().optional(),appTokenEnv:D.string().optional(),minify:D.boolean().default(!0),createdAt:D.string().datetime().optional(),updatedAt:D.string().datetime().optional()});function $P(i){let $={event_type:i.type},n=Bi(i.payload.event)?i.payload.event:null;if(typeof i.payload.channel_id==="string")$.channel_id=i.payload.channel_id;else if(n&&typeof n.channel==="string")$.channel_id=n.channel;if(typeof i.payload.user_id==="string")$.user_id=i.payload.user_id;else if(n&&typeof n.user==="string")$.user_id=n.user;if(n&&typeof n.thread_ts==="string")$.thread_ts=n.thread_ts;if(n&&typeof n.type==="string")$.slack_event_type=n.type;return $}var vP=class{props;seen=new Map;constructor(i){this.props=i}has(i){let $=this.seen.get(i);if($===void 0)return!1;if(d({deps:this.props.deps})-$>this.props.ttlMs)return this.seen.delete(i),!1;return!0}add(i){this.seen.set(i,d({deps:this.props.deps}))}trim(){let i=d({deps:this.props.deps})-this.props.ttlMs;for(let[n,g]of this.seen)if(g<i)this.seen.delete(n);if(this.seen.size<=this.props.maxSize)return;let $=this.seen.size-this.props.maxSize;for(let n of this.seen.keys()){if($<=0)break;this.seen.delete(n),$--}}get size(){return this.seen.size}},nP=D.object({ok:D.boolean(),url:D.string().optional(),error:D.string().optional()});function gP(i){let $=G(()=>i.response.headers.get("retry-after"));if($ instanceof Error)return null;if(typeof $!=="string")return null;let n=$.trim();if(!/^\d+$/.test(n))return null;let g=Number(n);if(!Number.isFinite(g))return null;return g*1000}var dI="https://slack.com/api/apps.connections.open";async function rP(i){let $=new li({source:"slack.url",handler:i.onLog,deps:i.deps});$.debug({action:"http.request",message:`POST ${dI}`});let n=await G(()=>i.deps.fetch(dI,{method:"POST",headers:{Authorization:`Bearer ${i.appToken}`},signal:i.signal}));if(n instanceof Error){let I=L({value:n});return $.error({action:"http.error",message:P({error:I}),error:I}),new T(`apps.connections.open transport: ${n.message}`,{cause:n})}$.debug({action:"http.response",message:`POST ${n.status}`,detail:{status:n.status,url:dI}});let g=gP({response:n});if(n.status===429)return $.warn({action:"http.rate-limited",message:`apps.connections.open: rate limited (429), retry-after ${g??"unknown"}ms`,detail:{retryAfterMs:g}}),new o({message:"apps.connections.open: rate limited (429)",status:n.status,retryAfterMs:g});let v=await hv({response:n,context:"apps.connections.open"});if(v instanceof o)return $.warn({action:"http.body.read",message:P({error:v}),error:v}),v;let r=w$(v);if(r instanceof ii)return $.warn({action:"http.body.parse",message:r.message,error:r}),new o({message:"apps.connections.open: invalid JSON body",status:n.status,cause:r,retryAfterMs:g});let b=Bi(r)?r:{};$.debug({action:"http.body",message:"apps.connections.open response",detail:{ok:b.ok,error:b.error}});let u=nP.safeParse(r);if(!u.success)return $.warn({action:"http.body.schema",message:"apps.connections.open: invalid response shape",detail:{issues:u.error.issues.map((I)=>({path:I.path,message:I.message}))}}),new o({message:"apps.connections.open: invalid response shape",status:n.status,cause:u.error,retryAfterMs:g});if(!u.data.ok||!u.data.url)return $.warn({action:"slack.api.error",message:`apps.connections.open failed: ${u.data.error??"no url"}`,detail:{code:u.data.error??null}}),new o({message:`apps.connections.open failed: ${u.data.error??"no url"}`,status:n.status,code:u.data.error??null,retryAfterMs:g});return $.info({action:"slack.url.obtained",message:"WSS URL obtained"}),u.data.url}var bP=D.object({envelope_id:D.string(),type:D.string(),payload:D.record(D.string(),D.unknown()),accepts_response_payload:D.boolean().optional(),retry_attempt:D.number().optional(),retry_reason:D.string().optional()}),uP=15000,UP=30000,yD=5000,hD=1,IP=class{props;log;ws=null;isStoppedFlag=!1;hasConnected=!1;pendingResolve=null;pendingResolved=!1;lastFrameAt=0;idleWatchdog=null;handshakeTimer=null;closeFallbackTimer=null;closeHandled=!1;constructor(i){this.props=i,this.log=new li({source:"slack.socket-mode",handler:i.onLog,deps:i.deps})}get isStopped(){return this.isStoppedFlag}async connect(i){this.log.info({action:"connect.start",message:"opening WebSocket connection"});let $=await rP({appToken:this.props.appToken,signal:i?.signal,onLog:this.props.onLog,deps:this.props.deps});if($ instanceof o)return this.log.error({action:"http.error",message:$.message,error:$}),$;if($ instanceof T)return this.log.error({action:"url.error",message:$.message,error:$}),$;if(this.isStoppedFlag){let n=new T("stopped before WebSocket open");return this.log.info({action:"connect.aborted",message:P({error:n})}),n}return this.log.info({action:"slack.url.obtained",message:"WebSocket URL obtained"}),this.openSocket($)}disconnect(){this.log.info({action:"disconnect",message:"stopping socket mode"}),this.isStoppedFlag=!0,this.disarmIdleWatchdog(),this.clearCloseFallback(),this.completeConnect(new T("stopped before hello")),this.closeSocket(this.ws),this.ws=null}armIdleWatchdog(){this.disarmIdleWatchdog();let i=this.props.idleTimeoutMs;if(typeof i!=="number"||!Number.isFinite(i)||i<=0)return;let $=G(()=>this.props.deps.setInterval(()=>this.checkIdle(i),uP));if($ instanceof Error){this.log.error({action:"idle.watchdog.schedule.error",message:P({error:$}),error:$});return}this.idleWatchdog=$}disarmIdleWatchdog(){if(!this.idleWatchdog)return;let i=this.idleWatchdog;this.idleWatchdog=null;let $=G(()=>this.props.deps.clearInterval(i));if($ instanceof Error)this.log.error({action:"idle.watchdog.clear.error",message:P({error:$}),error:$})}checkIdle(i){if(!this.hasConnected||this.isStoppedFlag)return;let $=d({deps:this.props.deps})-this.lastFrameAt;if($<i)return;this.log.warn({action:"idle.timeout",message:`no frames for ${$}ms (limit ${i}ms) \u2014 force-closing socket`,detail:{elapsedMs:$,limitMs:i}}),this.disarmIdleWatchdog(),this.forceClose()}isConnected(){return this.ws!==null&&this.ws.readyState===hD}openSocket(i){let $=this.props.deps.WebSocket;if(!$){let n=new T("WebSocket runtime not available");return this.log.error({action:"ws.error",message:P({error:n}),error:n}),Promise.resolve(n)}return this.pendingResolved=!1,this.hasConnected=!1,this.closeHandled=!1,new Promise((n)=>{this.pendingResolve=n;let g=G(()=>new $(i));if(g instanceof Error){let b=new T(`WebSocket construction failed: ${P({error:g})}`,{cause:g});this.log.error({action:"ws.construct.error",message:P({error:b}),error:b}),this.ws=null,this.pendingResolved=!0,n(b);return}let v=g;this.ws=v;let r=G(()=>{v.addEventListener("message",(b)=>this.safeOnMessage(b,v)),v.addEventListener("close",(b)=>this.safeOnClose(b)),v.addEventListener("error",()=>this.safeOnError())});if(r instanceof Error){let b=new T(`WebSocket listener registration failed: ${P({error:r})}`,{cause:r});this.log.error({action:"ws.listener.error",message:P({error:b}),error:b}),this.closeSocket(v),this.ws=null,this.pendingResolved=!0,n(b);return}this.armHandshakeTimer()})}completeConnect(i){if(this.clearHandshakeTimer(),this.pendingResolved||!this.pendingResolve)return;this.pendingResolved=!0,this.pendingResolve(i)}armHandshakeTimer(){let i=this.props.handshakeTimeoutMs,$=typeof i==="number"&&Number.isFinite(i)&&i>0?i:UP,n=G(()=>this.props.deps.setTimeout(()=>this.onHandshakeTimeout($),$));if(n instanceof Error){let g=new T(`handshake timer scheduling failed: ${P({error:n})}`,{cause:n});this.log.error({action:"handshake.timer.schedule.error",message:P({error:g}),error:g}),this.completeConnect(g),this.forceClose();return}this.handshakeTimer=n}clearHandshakeTimer(){if(this.handshakeTimer===null)return;let i=this.handshakeTimer;this.handshakeTimer=null;let $=G(()=>this.props.deps.clearTimeout(i));if($ instanceof Error)this.log.error({action:"handshake.timer.clear.error",message:P({error:$}),error:$})}onHandshakeTimeout(i){if(this.handshakeTimer=null,this.pendingResolved||this.isStoppedFlag)return;let $=new T(`handshake timeout: no hello within ${i}ms \u2014 force-closing socket`);this.log.error({action:"handshake.timeout",message:P({error:$}),error:$,detail:{timeoutMs:i}}),this.completeConnect($),this.forceClose()}forceClose(){let i=this.ws;if(i===null)return;this.armCloseFallback(),this.closeSocket(i)}armCloseFallback(){if(this.closeFallbackTimer!==null)return;let i=G(()=>this.props.deps.setTimeout(()=>this.onCloseFallback(),yD));if(i instanceof Error){this.log.error({action:"ws.close.fallback.schedule.error",message:P({error:i}),error:i}),this.onCloseFallback();return}this.closeFallbackTimer=i}clearCloseFallback(){if(this.closeFallbackTimer===null)return;let i=this.closeFallbackTimer;this.closeFallbackTimer=null;let $=G(()=>this.props.deps.clearTimeout(i));if($ instanceof Error)this.log.error({action:"ws.close.fallback.clear.error",message:P({error:$}),error:$})}onCloseFallback(){if(this.closeFallbackTimer=null,this.closeHandled||this.isStoppedFlag)return;this.log.warn({action:"ws.close.fallback",message:`close event not delivered within ${yD}ms \u2014 synthesizing teardown`}),this.settleClose({code:null})}settleClose(i){if(this.closeHandled)return;if(this.closeHandled=!0,this.clearCloseFallback(),this.disarmIdleWatchdog(),this.ws=null,this.hasConnected)this.props.onDisconnected();if(this.pendingResolved)return;let $=i.code===null?new T("WebSocket closed before hello (code=none)"):new T(`WebSocket closed before hello (code=${i.code})`,{code:i.code});this.completeConnect($)}safeOnMessage(i,$){let n=G(()=>this.onMessage(String(i.data),$));if(n instanceof Error)this.log.error({action:"ws.message.threw",message:P({error:n}),error:n})}safeOnClose(i){let $=G(()=>this.onClose(i));if($ instanceof Error)this.log.error({action:"ws.close.threw",message:P({error:$}),error:$})}safeOnError(){let i=G(()=>this.onError());if(i instanceof Error)this.log.error({action:"ws.error.threw",message:P({error:i}),error:i})}onMessage(i,$){if(this.lastFrameAt=d({deps:this.props.deps}),this.isStoppedFlag)return;let n=w$(i);if(n instanceof ii){this.log.error({action:"ws.parse.error",message:n.message,error:n,detail:{length:i.length}});return}if(!Bi(n)){this.log.error({action:"ws.parse.error",message:"expected JSON object",error:new ii(`non-object frame (${typeof n})`)});return}if(this.log.debug({action:"ws.recv",message:`type=${typeof n.type==="string"?n.type:"-"} length=${i.length}`,detail:{length:i.length}}),n.type==="hello"){this.log.info({action:"socket.hello",message:"connection ready"}),this.hasConnected=!0,this.armIdleWatchdog(),this.props.onConnected(),this.completeConnect(null);return}if(n.type==="disconnect"){let v=typeof n.reason==="string"?n.reason:"unknown";this.log.info({action:"ws.disconnect.requested",message:`reason=${v}`,detail:{reason:v}}),this.forceClose();return}if(typeof n.envelope_id==="string"){this.log.debug({action:"ws.ack",message:`envelope_id=${n.envelope_id}`});let v=this.safeSerialize({envelope_id:n.envelope_id});if(v!==null)this.send($,v)}let g=bP.safeParse(n);if(g.success){this.log.debug({action:"envelope.recv",message:`type=${g.data.type} envelope_id=${g.data.envelope_id}`,detail:{type:g.data.type,envelopeId:g.data.envelope_id}}),this.props.onMessage(g.data);return}this.log.warn({action:"envelope.parse.error",message:"unrecognised envelope shape, dropping",detail:{type:typeof n.type==="string"?n.type:"unknown",issues:g.error.issues.map((v)=>({path:v.path,message:v.message}))}})}onClose(i){if(this.log.info({action:"ws.close",message:`code=${i.code} reason=${i.reason||"none"}`,detail:{code:i.code,reason:i.reason}}),this.closeHandled){this.log.debug({action:"ws.close.late",message:"close event arrived after synthesized teardown, ignoring"});return}this.settleClose({code:i.code})}onError(){let i=new T("WebSocket connection error");this.log.error({action:"ws.error",message:P({error:i}),error:i}),this.completeConnect(i)}closeSocket(i){if(i===null)return;let $=G(()=>i.close());if($ instanceof Error)this.log.error({action:"ws.close.error",message:P({error:$}),error:$})}send(i,$){if(i.readyState!==hD){this.log.warn({action:"ws.send",message:`ws.send skipped: readyState=${i.readyState} (not OPEN)`,detail:{readyState:i.readyState}});return}let n=G(()=>i.send($));if(n instanceof Error)this.log.error({action:"ws.send",message:`ws.send failed: ${P({error:n})}`,error:n})}safeSerialize(i){let $=nr(i);if($ instanceof Error)return this.log.error({action:"ws.send.serialize.error",message:P({error:$}),error:$}),null;return $}},_P=1024,DP=300000,kP=new Set(["invalid_auth","account_inactive","token_revoked","not_authed","not_allowed_token_type","token_expired","missing_scope"]),dD=class extends k${options;name="slack";socket=null;reconnector=null;internalController=null;seen=null;constructor(i){super();this.options=i}async connect(i){if(!this.hasWebSocket(i))return new gi("Slack source: deps.WebSocket is null (no WebSocket runtime available)");if(this.seen=new vP({maxSize:_P,ttlMs:DP,deps:i.deps}),i.reconnect&&!this.reconnector)this.reconnector=new $r({...i.reconnect,log:i.log,deps:i.deps});let $=G(()=>new AbortController);if($ instanceof Error){let n=L({value:$});i.log.error({action:"slack.abort-controller.new.error",message:P({error:n}),error:n}),this.internalController=null}else this.internalController=$;return await this.connectInternal(i)}disconnect(){let i=this.context;if(i&&this.reconnector&&!this.reconnector.aborted)i.log.debug({action:"reconnect.cancel",message:"aborting reconnector"});this.reconnector?.cancel(),this.internalController?.abort(),this.socket?.disconnect(),this.socket=null,this.internalController=null}hasWebSocket(i){let $=G(()=>Boolean(i.deps.WebSocket));if($ instanceof Error){let n=L({value:$});return i.log.error({action:"deps.web-socket.read.error",message:P({error:n}),error:n}),!1}return $}async connectInternal(i){this.setStatus("connecting");let $=new IP({appToken:this.options.appToken,idleTimeoutMs:this.options.idleTimeoutMs,handshakeTimeoutMs:this.options.handshakeTimeoutMs,onLog:i.log.handler,deps:i.deps,onMessage:(g)=>this.handleMessage(i,g),onConnected:()=>{if(this.reconnector&&this.reconnector.attempt>0)i.log.info({action:"reconnect.reset",message:`cleared ${this.reconnector.attempt} attempts`});this.reconnector?.reset(),this.setStatus("connected")},onDisconnected:()=>{if($.isStopped){this.setStatus("disconnected");return}this.scheduleReconnect(i)}});this.socket=$;let n=await $.connect({signal:this.internalController?.signal});if(n instanceof Error){if(i.log.error({action:"connect.failed",message:P({error:n}),error:n}),this.isTerminalSlackError(n))return i.log.error({action:"reconnect.terminal",message:`permanent Slack API error, not reconnecting: ${P({error:n})}`,error:n}),this.setStatus("disconnected"),n;if($.isStopped||!this.reconnector||this.reconnector.aborted)return this.setStatus("disconnected"),n;this.scheduleReconnect(i,this.minRetryDelayMs(n))}return null}isTerminalSlackError(i){if(!(i instanceof o))return!1;if(i.code===null)return!1;return kP.has(i.code)}minRetryDelayMs(i){if(!(i instanceof o))return;return i.retryAfterMs??void 0}handleMessage(i,$){let n=this.seen;if(!n)return;let g=this.toDedupKey($);if(n.has(g)){i.log.debug({action:"dedup.skip",message:`duplicate key=${g}`,detail:{dedup_key:g,envelope_id:$.envelope_id,retry_attempt:$.retry_attempt}});return}n.add(g),n.trim(),this.emit({source:"slack",type:$.type,data:$.payload,meta:this.safeExtractMeta(i,$),receivedAt:d({deps:i.deps})})}toDedupKey(i){let $=i.payload.event_id;if(typeof $==="string"&&$.length>0)return $;return i.envelope_id}safeExtractMeta(i,$){let n=G(()=>$P($));if(n instanceof Error){let g=L({value:n});return i.log.warn({action:"meta.extract.error",message:P({error:g}),error:g,detail:{envelopeType:$.type}}),{event_type:$.type}}return n}scheduleReconnect(i,$){vr({reconnector:this.reconnector,log:i.log,setStatus:(n)=>this.setStatus(n),minDelayMs:$,retry:()=>{this.connectInternal(i).catch((n)=>{let g=L({value:n});i.log.error({action:"reconnect.unhandled",message:P({error:g}),error:g}),this.setStatus("disconnected")})}})}};class ev extends Error{constructor(i,$){super(i);if(this.name=new.target.name,$?.cause!==void 0)Object.defineProperty(this,"cause",{value:$.cause,enumerable:!1})}}class sv extends ev{channel;code="channel-not-found";constructor(i,$){super(`channel not found: ${i}`,$);this.channel=i}}class rr extends ev{channel;code="channel-already-exists";constructor(i,$){super(`channel already exists: ${i}`,$);this.channel=i}}class s$ extends ev{channel;connector;code="connector-not-found";constructor(i,$,n){super(`connector not found in ${i}: ${$}`,n);this.channel=i;this.connector=$}}class $n extends ev{connector;detail;code="auth-failed";constructor(i,$,n){super(`${i}: auth failed \u2014 ${$}`,n);this.connector=i;this.detail=$}}var wP=["type","subtype","user","bot_id","text","ts","thread_ts","channel","channel_type","files","attachments"],jP=["id","name","mimetype","filetype","size","url_private","permalink"],OP=["title","text","fallback"],br=(i)=>{return typeof i==="object"&&i!==null&&!Array.isArray(i)},aI=(i,$)=>{let n={};for(let g of $)if(i[g]!==void 0)n[g]=i[g];return n},JP=(i)=>{return Object.keys(i).some(($)=>$.startsWith("thumb")||$.startsWith("preview"))},PP=(i)=>{if(!br(i))return i;let $=aI(i,jP);if(JP(i))$._funnel_omitted=["thumb_*"];return $},pI=(i)=>{if(!br(i))return"";let $=i.text;if(typeof $==="string")return $;let n=i.elements;if(!Array.isArray(n))return"";return n.map(pI).join("")},WP=(i)=>{if(!Array.isArray(i))return"";return i.map(pI).join("\t")},VP=(i)=>{if(!br(i))return"";if(i.type==="table"&&Array.isArray(i.rows))return i.rows.map(WP).join(`
70
- `);return pI(i)},XP=(i)=>{return i.map(VP).filter(($)=>$.length>0).join(`
71
- `)},fP=(i)=>{if(!br(i))return i;let $=aI(i,OP),n=i.blocks;if(Array.isArray(n)){let g=XP(n),v=typeof $.text==="string"?$.text:"";$.text=v?`${v}
72
- ${g}`:g,$._funnel_omitted=["blocks"]}return $},aD=(i)=>{let $=aI(i,wP);if(Array.isArray($.files))$.files=$.files.map(PP);if(Array.isArray($.attachments))$.attachments=$.attachments.map(fP);return $};var QP=new Set(["message","app_mention"]),KP=new Set([void 0,"thread_broadcast","bot_message","file_share"]),GP=1e4,wi=(i,$)=>{let n=i[$];return typeof n==="string"?n:void 0};class eI{ownBotUserId;ownBotId;minify;now;dedup=new Map;constructor(i){this.ownBotUserId=i.ownBotUserId,this.ownBotId=i.ownBotId,this.minify=i.minify??!0,this.now=i.now??(()=>Date.now())}process(i){let $=wi(i,"type");if(!$||!QP.has($))return{skip:!0,reason:"skip:type"};let n=wi(i,"subtype");if(!KP.has(n))return{skip:!0,reason:"skip:subtype"};let g=wi(i,"channel")??"",v=wi(i,"event_ts")??wi(i,"ts")??"",r=`${g}:${v}`,b=this.now();if(this.dedup.has(r))return{skip:!0,reason:"skip:dedup"};this.dedup.set(r,b);for(let z of this.dedup.keys())if((this.dedup.get(z)??0)<b-GP)this.dedup.delete(z);let u=wi(i,"user"),I=wi(i,"bot_id");if(u===this.ownBotUserId)return{skip:!0,reason:"skip:self-user"};if(I===this.ownBotId)return{skip:!0,reason:"skip:self-bot"};let U=wi(i,"text")??"",_=U.includes(`<@${this.ownBotUserId}>`),k=wi(i,"thread_ts")??wi(i,"ts")??"",O=wi(i,"ts")??"",J=$==="app_mention"?"app_mention":"message",Q=this.minify?aD(i):i;return{skip:!1,event:{kind:"message",channel:g,user:u??"",rawText:U,text:YP(U,this.ownBotUserId),threadTs:k,ts:O,isThreadRoot:k===O,mentioned:_,source:J},content:JSON.stringify(Q),meta:{event_type:"slack",channel_id:g,user_id:u??"",mentioned:String(_),thread_ts:k},shouldReact:_,channel:g,timestamp:O}}}var YP=(i,$)=>i.replace(new RegExp(`<@${$}>`,"g"),"").trim();var HP=D.object({ok:D.boolean(),user_id:D.string().optional(),bot_id:D.string().optional(),error:D.string().optional()}),zP="https://slack.com/api/auth.test";class sI extends j${config;env;flumeDeps;http;signal;preprocessEvent;onInteractive;processor=null;botToken="";constructor(i){super({type:"slack",connectorId:i.config.id,channelId:i.channelId??null,logger:i.logger,diagnosticLog:i.diagnosticLog});this.config=i.config,this.env=i.env??process.env,this.flumeDeps=i.flumeDeps??{},this.http=i.http??new Di,this.signal=i.signal,this.preprocessEvent=i.preprocessEvent,this.onInteractive=i.onInteractive}async start(i){this.diagnostics.recordConnection("started","");let $,n;try{$=Yi({literal:this.config.appToken,envVar:this.config.appTokenEnv,env:this.env,label:`${this.config.name}.appToken`}),n=Yi({literal:this.config.botToken,envVar:this.config.botTokenEnv,env:this.env,label:`${this.config.name}.botToken`})}catch(r){throw this.diagnostics.recordConnection("auth-failed",t(r)),r}this.botToken=n;let g=await this.callAuthTest();if(!g.ok){let r=g.error??"auth.test returned ok=false";throw this.diagnostics.recordConnection("auth-failed",r),new $n(this.config.name,r)}this.processor=new eI({ownBotUserId:g.user_id??"",ownBotId:g.bot_id??"",minify:this.config.minify});let v=new dD({appToken:$,botToken:this.botToken});await this.runStart({source:v,onLog:e$(this.logger),deps:p$(this.flumeDeps),signal:this.signal,onEvent:(r)=>{if(r.source!=="slack")return Promise.resolve();return this.handleEvent(r,i)}})}onStop(){this.processor=null}async handleInteractive(i){let $=crypto.randomUUID(),n=JSON.stringify(i);if(this.diagnostics.recordRaw($,n),!this.onInteractive){this.diagnostics.recordProcessed($,"skip:no-interactive-handler","");return}let g=typeof i.type==="string"?i.type:"unknown";try{await this.onInteractive(i),this.diagnostics.recordProcessed($,`interactive:${g}`,"")}catch(v){let r=t(v);this.diagnostics.recordProcessed($,`interactive-error:${g}`,r),this.logger?.error(`slack interactive handler error (${g})`,{error:r})}}async callAuthTest(){let i;try{i=await(await this.http.fetch({method:"POST",url:zP,headers:{Authorization:`Bearer ${this.botToken}`,"Content-Type":"application/x-www-form-urlencoded"}})).text()}catch(n){throw this.diagnostics.recordConnection("auth-failed",t(n)),n}let $=HP.safeParse(pD(i));if(!$.success)return{ok:!1,error:`non-JSON auth.test response: ${i.slice(0,200)}`};return $.data}async handleEvent(i,$){if(!this.processor)return;if(i.type==="interactive"){await this.handleInteractive(i.data);return}let n=i.data.event;if(!SP(n)){let u=crypto.randomUUID();this.diagnostics.recordRaw(u,JSON.stringify(i.data)),this.diagnostics.recordProcessed(u,"skip:non-object-event","");return}let g=crypto.randomUUID(),v=JSON.stringify(n);this.diagnostics.recordRaw(g,v);let r=n;if(this.preprocessEvent){let u=await this.preprocessEvent(n);if(u===null){this.diagnostics.recordProcessed(g,"skip:preprocess",v);return}r=u}let b=this.processor.process(r);if(b.skip){this.diagnostics.recordProcessed(g,b.reason,v);return}await this.deliver($,g,v,b.content,b.meta,b.shouldReact)}async deliver(i,$,n,g,v,r){try{await i(g,v)}catch(b){this.diagnostics.recordProcessed($,"emitted:delivery-failed",g||n),this.logger?.error("slack notify error",{error:t(b)});return}if(this.diagnostics.recordProcessed($,"emitted",g),r)this.postReaction(v).catch((b)=>{this.diagnostics.recordProcessed($,"emitted:reaction-failed",t(b)),this.logger?.warn("slack reaction failed",{error:t(b)})})}async postReaction(i){let $=await this.http.fetch({method:"POST",url:"https://slack.com/api/reactions.add",headers:{Authorization:`Bearer ${this.botToken}`,"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({channel:i.channel_id??"",timestamp:i.thread_ts??"",name:"eyes"}).toString()}),n=await $.text(),g=lP(n);if(!g.ok)throw Error(`slack reactions.add: ${g.error??`status=${$.status}`}`)}}var SP=(i)=>typeof i==="object"&&i!==null&&!Array.isArray(i),pD=(i)=>{try{return JSON.parse(i)}catch{return null}},AP=D.object({ok:D.boolean(),error:D.string().optional()}),lP=(i)=>{let $=AP.safeParse(pD(i));if(!$.success)return{ok:!1,error:`non-JSON response: ${i.slice(0,200)}`};return $.data};var eD=(i={})=>({type:"slack",toolExposed:!0,createListener($,n){let g=Ti.parse($);return new sI({config:g,channelId:n.channelId,logger:n.logger,diagnosticLog:n.diagnosticLog,http:n.http,signal:n.signal,preprocessEvent:i.preprocessEvent,onInteractive:i.onInteractive})},createAdapter($,n){return new hI({config:Ti.parse($),http:n.http})},secretTokens($){let n=Ti.parse($);return[n.botToken,n.appToken].filter((g)=>g!==void 0)},buildConfig($,n){return Ti.parse({id:n.id,type:"slack",name:$.name,...typeof $.botToken==="string"?{botToken:$.botToken}:{},...typeof $.appToken==="string"?{appToken:$.appToken}:{},...typeof $.botTokenEnv==="string"?{botTokenEnv:$.botTokenEnv}:{},...typeof $.appTokenEnv==="string"?{appTokenEnv:$.appTokenEnv}:{},minify:typeof $.minify==="boolean"?$.minify:!0,createdAt:n.now,updatedAt:n.now})},applyUpdate($,n,g){let v=Ti.parse($);return Ti.parse({id:v.id,name:v.name,type:"slack",minify:v.minify,createdAt:v.createdAt,updatedAt:g.now,...O$("botToken","botTokenEnv",n,v),...O$("appToken","appTokenEnv",n,v)})},operations:{}});var sD=()=>[eD(),LD(),zD(),mD()];import{homedir as i_}from"os";import{dirname as vk,join as $_}from"path";class vn{}class Zi extends vn{generate(){return crypto.randomUUID()}}class nn{}var ik=D.object({id:D.string(),name:D.string(),type:D.string(),createdAt:D.string().datetime().optional(),updatedAt:D.string().datetime().optional()});var BP=ik.loose(),LP=D.enum(["fanout","exclusive"]),TP=D.object({id:D.string(),name:D.string(),delivery:LP.default("fanout"),connectors:D.array(BP).default([])}),ZP=D.object({id:D.string(),name:D.string(),path:D.string(),channelId:D.string(),options:D.array(D.string()).default([]),env:D.record(D.string(),D.string()).default({}),resume:D.boolean().default(!0),sessionId:D.string().optional()}),qi=1,$k=D.object({version:D.literal(qi).default(qi),channels:D.array(TP).default([]),profiles:D.array(ZP).default([])});function ur(){let i=process.env.FUNNEL_DIR;if(i&&i.length>0)return qP(i);return $_(i_(),".funnel")}function qP(i){let $=i_(),n=i;if(n==="~")return $;if(n.startsWith("~/")||n.startsWith("~\\"))n=$+n.slice(1);return n=n.split("${HOME}").join($),n=n.split("${USERPROFILE}").join($),n.replace(/\\/g,"/")}var MP=9742;function Mi(){return Number(process.env.FUNNEL_PORT)||MP}var ji=$_(i_(),".funnel"),xP=$_(ji,"settings.json"),NP=new F,tP=new Zi;class v_ extends nn{path;fs;idGenerator;constructor(i={}){super();this.path=i.path??xP,this.fs=i.fs??NP,this.idGenerator=i.idGenerator??tP,Object.freeze(this)}read(){if(!this.fs.existsSync(this.path))return{version:qi,channels:[],profiles:[]};let i=this.fs.readFileSync(this.path),$=JSON.parse(i);if(this.looksLikeLegacy($))throw Error(`legacy settings.json detected at ${this.path}. The schema changed (channel.connectors are now nested objects with ids; profile fields renamed). Migration is intentionally not provided. Back up and remove the old file:
65
+ `)}J.write("payload.value = newResult;"),J.write("return payload;");let Ii=J.compile();return(y,N)=>Ii(O,y,N)},r,b=g$,u=!v$.jitless,I=u&&Mr.value,_=$.catchall,k;i._zod.parse=(O,J)=>{k??(k=g.value);let Q=O.value;if(!b(Q))return O.issues.push({expected:"object",code:"invalid_type",input:Q,inst:i}),O;if(u&&I&&J?.async===!1&&J.jitless!==!0){if(!r)r=v($.shape);if(O=r(O,J),!_)return O;return E1([],Q,O,J,k,i)}return n(O,J)}});function K1(i,$,n,g){for(let r of i)if(r.issues.length===0)return $.value=r.value,$;let v=i.filter((r)=>!Fi(r));if(v.length===1)return $.value=v[0].value,v[0];return $.issues.push({code:"invalid_union",input:$.value,inst:n,errors:i.map((r)=>r.issues.map((b)=>p(b,g,t())))}),$}var Qv=w("$ZodUnion",(i,$)=>{Y.init(i,$),S(i._zod,"optin",()=>$.options.some((g)=>g._zod.optin==="optional")?"optional":void 0),S(i._zod,"optout",()=>$.options.some((g)=>g._zod.optout==="optional")?"optional":void 0),S(i._zod,"values",()=>{if($.options.every((g)=>g._zod.values))return new Set($.options.flatMap((g)=>Array.from(g._zod.values)));return}),S(i._zod,"pattern",()=>{if($.options.every((g)=>g._zod.pattern)){let g=$.options.map((v)=>v._zod.pattern);return new RegExp(`^(${g.map((v)=>Dv(v.source)).join("|")})$`)}return});let n=$.options.length===1?$.options[0]._zod.run:null;i._zod.parse=(g,v)=>{if(n)return n(g,v);let r=!1,b=[];for(let u of $.options){let U=u._zod.run({value:g.value,issues:[]},v);if(U instanceof Promise)b.push(U),r=!0;else{if(U.issues.length===0)return U;b.push(U)}}if(!r)return K1(b,g,i,v);return Promise.all(b).then((u)=>{return K1(u,g,i,v)})}});function G1(i,$,n,g){let v=i.filter((r)=>r.issues.length===0);if(v.length===1)return $.value=v[0].value,$;if(v.length===0)$.issues.push({code:"invalid_union",input:$.value,inst:n,errors:i.map((r)=>r.issues.map((b)=>p(b,g,t())))});else $.issues.push({code:"invalid_union",input:$.value,inst:n,errors:[],inclusive:!1});return $}var H4=w("$ZodXor",(i,$)=>{Qv.init(i,$),$.inclusive=!1;let n=$.options.length===1?$.options[0]._zod.run:null;i._zod.parse=(g,v)=>{if(n)return n(g,v);let r=!1,b=[];for(let u of $.options){let U=u._zod.run({value:g.value,issues:[]},v);if(U instanceof Promise)b.push(U),r=!0;else b.push(U)}if(!r)return G1(b,g,i,v);return Promise.all(b).then((u)=>{return G1(u,g,i,v)})}}),z4=w("$ZodDiscriminatedUnion",(i,$)=>{$.inclusive=!1,Qv.init(i,$);let n=i._zod.parse;S(i._zod,"propValues",()=>{let v={};for(let r of $.options){let b=r._zod.propValues;if(!b||Object.keys(b).length===0)throw Error(`Invalid discriminated union option at index "${$.options.indexOf(r)}"`);for(let[u,U]of Object.entries(b)){if(!v[u])v[u]=new Set;for(let I of U)v[u].add(I)}}return v});let g=f$(()=>{let v=$.options,r=new Map;for(let b of v){let u=b._zod.propValues?.[$.discriminator];if(!u||u.size===0)throw Error(`Invalid discriminated union option at index "${$.options.indexOf(b)}"`);for(let U of u){if(r.has(U))throw Error(`Duplicate discriminator value "${String(U)}"`);r.set(U,b)}}return r});i._zod.parse=(v,r)=>{let b=v.value;if(!g$(b))return v.issues.push({code:"invalid_type",expected:"object",input:b,inst:i}),v;let u=g.value.get(b?.[$.discriminator]);if(u)return u._zod.run(v,r);if($.unionFallback||r.direction==="backward")return n(v,r);return v.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:$.discriminator,options:Array.from(g.value.keys()),input:b,path:[$.discriminator],inst:i}),v}}),S4=w("$ZodIntersection",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{let v=n.value,r=$.left._zod.run({value:v,issues:[]},g),b=$.right._zod.run({value:v,issues:[]},g);if(r instanceof Promise||b instanceof Promise)return Promise.all([r,b]).then(([U,I])=>{return Y1(n,U,I)});return Y1(n,r,b)}});function cb(i,$){if(i===$)return{valid:!0,data:i};if(i instanceof Date&&$ instanceof Date&&+i===+$)return{valid:!0,data:i};if(Ri(i)&&Ri($)){let n=Object.keys($),g=Object.keys(i).filter((r)=>n.indexOf(r)!==-1),v={...i,...$};for(let r of g){let b=cb(i[r],$[r]);if(!b.valid)return{valid:!1,mergeErrorPath:[r,...b.mergeErrorPath]};v[r]=b.data}return{valid:!0,data:v}}if(Array.isArray(i)&&Array.isArray($)){if(i.length!==$.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let g=0;g<i.length;g++){let v=i[g],r=$[g],b=cb(v,r);if(!b.valid)return{valid:!1,mergeErrorPath:[g,...b.mergeErrorPath]};n.push(b.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Y1(i,$,n){let g=new Map,v;for(let u of $.issues)if(u.code==="unrecognized_keys"){v??(v=u);for(let U of u.keys){if(!g.has(U))g.set(U,{});g.get(U).l=!0}}else i.issues.push(u);for(let u of n.issues)if(u.code==="unrecognized_keys")for(let U of u.keys){if(!g.has(U))g.set(U,{});g.get(U).r=!0}else i.issues.push(u);let r=[...g].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(r.length&&v)i.issues.push({...v,keys:r});if(Fi(i))return i;let b=cb($.value,n.value);if(!b.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(b.mergeErrorPath)}`);return i.value=b.data,i}var Fn=w("$ZodTuple",(i,$)=>{Y.init(i,$);let n=$.items;i._zod.parse=(g,v)=>{let r=g.value;if(!Array.isArray(r))return g.issues.push({input:r,inst:i,expected:"tuple",code:"invalid_type"}),g;g.value=[];let b=[],u=H1(n,"optin"),U=H1(n,"optout");if(!$.rest){if(r.length<u)return g.issues.push({code:"too_small",minimum:u,inclusive:!0,input:r,inst:i,origin:"array"}),g;if(r.length>n.length)g.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:r,inst:i,origin:"array"})}let I=Array(n.length);for(let _=0;_<n.length;_++){let k=n[_]._zod.run({value:r[_],issues:[]},v);if(k instanceof Promise)b.push(k.then((O)=>{I[_]=O}));else I[_]=k}if($.rest){let _=n.length-1,k=r.slice(n.length);for(let O of k){_++;let J=$.rest._zod.run({value:O,issues:[]},v);if(J instanceof Promise)b.push(J.then((Q)=>z1(Q,g,_)));else z1(J,g,_)}}if(b.length)return Promise.all(b).then(()=>S1(I,g,n,r,U));return S1(I,g,n,r,U)}});function H1(i,$){for(let n=i.length-1;n>=0;n--)if(i[n]._zod[$]!=="optional")return n+1;return 0}function z1(i,$,n){if(i.issues.length)$.issues.push(...$i(n,i.issues));$.value[n]=i.value}function S1(i,$,n,g,v){for(let r=0;r<n.length;r++){let b=i[r],u=r<g.length;if(b.issues.length){if(!u&&r>=v){$.value.length=r;break}$.issues.push(...$i(r,b.issues))}$.value[r]=b.value}for(let r=$.value.length-1;r>=g.length;r--)if(n[r]._zod.optout==="optional"&&$.value[r]===void 0)$.value.length=r;else break;return $}var A4=w("$ZodRecord",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{let v=n.value;if(!Ri(v))return n.issues.push({expected:"record",code:"invalid_type",input:v,inst:i}),n;let r=[],b=$.keyType._zod.values;if(b){n.value={};let u=new Set;for(let I of b)if(typeof I==="string"||typeof I==="number"||typeof I==="symbol"){u.add(typeof I==="number"?I.toString():I);let _=$.keyType._zod.run({value:I,issues:[]},g);if(_ instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(_.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:_.issues.map((J)=>p(J,g,t())),input:I,path:[I],inst:i});continue}let k=_.value,O=$.valueType._zod.run({value:v[I],issues:[]},g);if(O instanceof Promise)r.push(O.then((J)=>{if(J.issues.length)n.issues.push(...$i(I,J.issues));n.value[k]=J.value}));else{if(O.issues.length)n.issues.push(...$i(I,O.issues));n.value[k]=O.value}}let U;for(let I in v)if(!u.has(I))U=U??[],U.push(I);if(U&&U.length>0)n.issues.push({code:"unrecognized_keys",input:v,inst:i,keys:U})}else{n.value={};for(let u of Reflect.ownKeys(v)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(v,u))continue;let U=$.keyType._zod.run({value:u,issues:[]},g);if(U instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&Wv.test(u)&&U.issues.length){let k=$.keyType._zod.run({value:Number(u),issues:[]},g);if(k instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(k.issues.length===0)U=k}if(U.issues.length){if($.mode==="loose")n.value[u]=v[u];else n.issues.push({code:"invalid_key",origin:"record",issues:U.issues.map((k)=>p(k,g,t())),input:u,path:[u],inst:i});continue}let _=$.valueType._zod.run({value:v[u],issues:[]},g);if(_ instanceof Promise)r.push(_.then((k)=>{if(k.issues.length)n.issues.push(...$i(u,k.issues));n.value[U.value]=k.value}));else{if(_.issues.length)n.issues.push(...$i(u,_.issues));n.value[U.value]=_.value}}}if(r.length)return Promise.all(r).then(()=>n);return n}}),B4=w("$ZodMap",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{let v=n.value;if(!(v instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:v,inst:i}),n;let r=[];n.value=new Map;for(let[b,u]of v){let U=$.keyType._zod.run({value:b,issues:[]},g),I=$.valueType._zod.run({value:u,issues:[]},g);if(U instanceof Promise||I instanceof Promise)r.push(Promise.all([U,I]).then(([_,k])=>{A1(_,k,n,b,v,i,g)}));else A1(U,I,n,b,v,i,g)}if(r.length)return Promise.all(r).then(()=>n);return n}});function A1(i,$,n,g,v,r,b){if(i.issues.length)if(kv.has(typeof g))n.issues.push(...$i(g,i.issues));else n.issues.push({code:"invalid_key",origin:"map",input:v,inst:r,issues:i.issues.map((u)=>p(u,b,t()))});if($.issues.length)if(kv.has(typeof g))n.issues.push(...$i(g,$.issues));else n.issues.push({origin:"map",code:"invalid_element",input:v,inst:r,key:g,issues:$.issues.map((u)=>p(u,b,t()))});n.value.set(i.value,$.value)}var l4=w("$ZodSet",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{let v=n.value;if(!(v instanceof Set))return n.issues.push({input:v,inst:i,expected:"set",code:"invalid_type"}),n;let r=[];n.value=new Set;for(let b of v){let u=$.valueType._zod.run({value:b,issues:[]},g);if(u instanceof Promise)r.push(u.then((U)=>B1(U,n)));else B1(u,n)}if(r.length)return Promise.all(r).then(()=>n);return n}});function B1(i,$){if(i.issues.length)$.issues.push(...i.issues);$.value.add(i.value)}var L4=w("$ZodEnum",(i,$)=>{Y.init(i,$);let n=_v($.entries),g=new Set(n);i._zod.values=g,i._zod.pattern=new RegExp(`^(${n.filter((v)=>kv.has(typeof v)).map((v)=>typeof v==="string"?Ui(v):v.toString()).join("|")})$`),i._zod.parse=(v,r)=>{let b=v.value;if(g.has(b))return v;return v.issues.push({code:"invalid_value",values:n,input:b,inst:i}),v}}),T4=w("$ZodLiteral",(i,$)=>{if(Y.init(i,$),$.values.length===0)throw Error("Cannot create literal schema with no valid values");let n=new Set($.values);i._zod.values=n,i._zod.pattern=new RegExp(`^(${$.values.map((g)=>typeof g==="string"?Ui(g):g?Ui(g.toString()):String(g)).join("|")})$`),i._zod.parse=(g,v)=>{let r=g.value;if(n.has(r))return g;return g.issues.push({code:"invalid_value",values:$.values,input:r,inst:i}),g}}),Z4=w("$ZodFile",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{let v=n.value;if(v instanceof File)return n;return n.issues.push({expected:"file",code:"invalid_type",input:v,inst:i}),n}}),q4=w("$ZodTransform",(i,$)=>{Y.init(i,$),i._zod.optin="optional",i._zod.parse=(n,g)=>{if(g.direction==="backward")throw new n$(i.constructor.name);let v=$.transform(n.value,n);if(g.async)return(v instanceof Promise?v:Promise.resolve(v)).then((b)=>{return n.value=b,n.fallback=!0,n});if(v instanceof Promise)throw new Oi;return n.value=v,n.fallback=!0,n}});function l1(i,$){if($===void 0&&(i.issues.length||i.fallback))return{issues:[],value:void 0};return i}var on=w("$ZodOptional",(i,$)=>{Y.init(i,$),i._zod.optin="optional",i._zod.optout="optional",S(i._zod,"values",()=>{return $.innerType._zod.values?new Set([...$.innerType._zod.values,void 0]):void 0}),S(i._zod,"pattern",()=>{let n=$.innerType._zod.pattern;return n?new RegExp(`^(${Dv(n.source)})?$`):void 0}),i._zod.parse=(n,g)=>{if($.innerType._zod.optin==="optional"){let v=n.value,r=$.innerType._zod.run(n,g);if(r instanceof Promise)return r.then((b)=>l1(b,v));return l1(r,v)}if(n.value===void 0)return n;return $.innerType._zod.run(n,g)}}),M4=w("$ZodExactOptional",(i,$)=>{on.init(i,$),S(i._zod,"values",()=>$.innerType._zod.values),S(i._zod,"pattern",()=>$.innerType._zod.pattern),i._zod.parse=(n,g)=>{return $.innerType._zod.run(n,g)}}),x4=w("$ZodNullable",(i,$)=>{Y.init(i,$),S(i._zod,"optin",()=>$.innerType._zod.optin),S(i._zod,"optout",()=>$.innerType._zod.optout),S(i._zod,"pattern",()=>{let n=$.innerType._zod.pattern;return n?new RegExp(`^(${Dv(n.source)}|null)$`):void 0}),S(i._zod,"values",()=>{return $.innerType._zod.values?new Set([...$.innerType._zod.values,null]):void 0}),i._zod.parse=(n,g)=>{if(n.value===null)return n;return $.innerType._zod.run(n,g)}}),N4=w("$ZodDefault",(i,$)=>{Y.init(i,$),i._zod.optin="optional",S(i._zod,"values",()=>$.innerType._zod.values),i._zod.parse=(n,g)=>{if(g.direction==="backward")return $.innerType._zod.run(n,g);if(n.value===void 0)return n.value=$.defaultValue,n;let v=$.innerType._zod.run(n,g);if(v instanceof Promise)return v.then((r)=>L1(r,$));return L1(v,$)}});function L1(i,$){if(i.value===void 0)i.value=$.defaultValue;return i}var E4=w("$ZodPrefault",(i,$)=>{Y.init(i,$),i._zod.optin="optional",S(i._zod,"values",()=>$.innerType._zod.values),i._zod.parse=(n,g)=>{if(g.direction==="backward")return $.innerType._zod.run(n,g);if(n.value===void 0)n.value=$.defaultValue;return $.innerType._zod.run(n,g)}}),t4=w("$ZodNonOptional",(i,$)=>{Y.init(i,$),S(i._zod,"values",()=>{let n=$.innerType._zod.values;return n?new Set([...n].filter((g)=>g!==void 0)):void 0}),i._zod.parse=(n,g)=>{let v=$.innerType._zod.run(n,g);if(v instanceof Promise)return v.then((r)=>T1(r,i));return T1(v,i)}});function T1(i,$){if(!i.issues.length&&i.value===void 0)i.issues.push({code:"invalid_type",expected:"nonoptional",input:i.value,inst:$});return i}var c4=w("$ZodSuccess",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{if(g.direction==="backward")throw new n$("ZodSuccess");let v=$.innerType._zod.run(n,g);if(v instanceof Promise)return v.then((r)=>{return n.value=r.issues.length===0,n});return n.value=v.issues.length===0,n}}),C4=w("$ZodCatch",(i,$)=>{Y.init(i,$),i._zod.optin="optional",S(i._zod,"optout",()=>$.innerType._zod.optout),S(i._zod,"values",()=>$.innerType._zod.values),i._zod.parse=(n,g)=>{if(g.direction==="backward")return $.innerType._zod.run(n,g);let v=$.innerType._zod.run(n,g);if(v instanceof Promise)return v.then((r)=>{if(n.value=r.value,r.issues.length)n.value=$.catchValue({...n,error:{issues:r.issues.map((b)=>p(b,g,t()))},input:n.value}),n.issues=[],n.fallback=!0;return n});if(n.value=v.value,v.issues.length)n.value=$.catchValue({...n,error:{issues:v.issues.map((r)=>p(r,g,t()))},input:n.value}),n.issues=[],n.fallback=!0;return n}}),R4=w("$ZodNaN",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{if(typeof n.value!=="number"||!Number.isNaN(n.value))return n.issues.push({input:n.value,inst:i,expected:"nan",code:"invalid_type"}),n;return n}}),mn=w("$ZodPipe",(i,$)=>{Y.init(i,$),S(i._zod,"values",()=>$.in._zod.values),S(i._zod,"optin",()=>$.in._zod.optin),S(i._zod,"optout",()=>$.out._zod.optout),S(i._zod,"propValues",()=>$.in._zod.propValues),i._zod.parse=(n,g)=>{if(g.direction==="backward"){let r=$.out._zod.run(n,g);if(r instanceof Promise)return r.then((b)=>Nn(b,$.in,g));return Nn(r,$.in,g)}let v=$.in._zod.run(n,g);if(v instanceof Promise)return v.then((r)=>Nn(r,$.out,g));return Nn(v,$.out,g)}});function Nn(i,$,n){if(i.issues.length)return i.aborted=!0,i;return $._zod.run({value:i.value,issues:i.issues,fallback:i.fallback},n)}var Kv=w("$ZodCodec",(i,$)=>{Y.init(i,$),S(i._zod,"values",()=>$.in._zod.values),S(i._zod,"optin",()=>$.in._zod.optin),S(i._zod,"optout",()=>$.out._zod.optout),S(i._zod,"propValues",()=>$.in._zod.propValues),i._zod.parse=(n,g)=>{if((g.direction||"forward")==="forward"){let r=$.in._zod.run(n,g);if(r instanceof Promise)return r.then((b)=>En(b,$,g));return En(r,$,g)}else{let r=$.out._zod.run(n,g);if(r instanceof Promise)return r.then((b)=>En(b,$,g));return En(r,$,g)}}});function En(i,$,n){if(i.issues.length)return i.aborted=!0,i;if((n.direction||"forward")==="forward"){let v=$.transform(i.value,i);if(v instanceof Promise)return v.then((r)=>tn(i,r,$.out,n));return tn(i,v,$.out,n)}else{let v=$.reverseTransform(i.value,i);if(v instanceof Promise)return v.then((r)=>tn(i,r,$.in,n));return tn(i,v,$.in,n)}}function tn(i,$,n,g){if(i.issues.length)return i.aborted=!0,i;return n._zod.run({value:$,issues:i.issues},g)}var F4=w("$ZodPreprocess",(i,$)=>{mn.init(i,$)}),o4=w("$ZodReadonly",(i,$)=>{Y.init(i,$),S(i._zod,"propValues",()=>$.innerType._zod.propValues),S(i._zod,"values",()=>$.innerType._zod.values),S(i._zod,"optin",()=>$.innerType?._zod?.optin),S(i._zod,"optout",()=>$.innerType?._zod?.optout),i._zod.parse=(n,g)=>{if(g.direction==="backward")return $.innerType._zod.run(n,g);let v=$.innerType._zod.run(n,g);if(v instanceof Promise)return v.then(Z1);return Z1(v)}});function Z1(i){return i.value=Object.freeze(i.value),i}var m4=w("$ZodTemplateLiteral",(i,$)=>{Y.init(i,$);let n=[];for(let g of $.parts)if(typeof g==="object"&&g!==null){if(!g._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...g._zod.traits].shift()}`);let v=g._zod.pattern instanceof RegExp?g._zod.pattern.source:g._zod.pattern;if(!v)throw Error(`Invalid template literal part: ${g._zod.traits}`);let r=v.startsWith("^")?1:0,b=v.endsWith("$")?v.length-1:v.length;n.push(v.slice(r,b))}else if(g===null||Nr.has(typeof g))n.push(Ui(`${g}`));else throw Error(`Invalid template literal part: ${g}`);i._zod.pattern=new RegExp(`^${n.join("")}$`),i._zod.parse=(g,v)=>{if(typeof g.value!=="string")return g.issues.push({input:g.value,inst:i,expected:"string",code:"invalid_type"}),g;if(i._zod.pattern.lastIndex=0,!i._zod.pattern.test(g.value))return g.issues.push({input:g.value,inst:i,code:"invalid_format",format:$.format??"template_literal",pattern:i._zod.pattern.source}),g;return g}}),y4=w("$ZodFunction",(i,$)=>{return Y.init(i,$),i._def=$,i._zod.def=$,i.implement=(n)=>{if(typeof n!=="function")throw Error("implement() must be called with a function");return function(...g){let v=i._def.input?Gn(i._def.input,g):g,r=Reflect.apply(n,this,v);if(i._def.output)return Gn(i._def.output,r);return r}},i.implementAsync=(n)=>{if(typeof n!=="function")throw Error("implementAsync() must be called with a function");return async function(...g){let v=i._def.input?await Yn(i._def.input,g):g,r=await Reflect.apply(n,this,v);if(i._def.output)return await Yn(i._def.output,r);return r}},i._zod.parse=(n,g)=>{if(typeof n.value!=="function")return n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:i}),n;if(i._def.output&&i._def.output._zod.def.type==="promise")n.value=i.implementAsync(n.value);else n.value=i.implement(n.value);return n},i.input=(...n)=>{let g=i.constructor;if(Array.isArray(n[0]))return new g({type:"function",input:new Fn({type:"tuple",items:n[0],rest:n[1]}),output:i._def.output});return new g({type:"function",input:n[0],output:i._def.output})},i.output=(n)=>{return new i.constructor({type:"function",input:i._def.input,output:n})},i}),h4=w("$ZodPromise",(i,$)=>{Y.init(i,$),i._zod.parse=(n,g)=>{return Promise.resolve(n.value).then((v)=>$.innerType._zod.run({value:v,issues:[]},g))}}),d4=w("$ZodLazy",(i,$)=>{Y.init(i,$),S(i._zod,"innerType",()=>{let n=$;if(!n._cachedInner)n._cachedInner=$.getter();return n._cachedInner}),S(i._zod,"pattern",()=>i._zod.innerType?._zod?.pattern),S(i._zod,"propValues",()=>i._zod.innerType?._zod?.propValues),S(i._zod,"optin",()=>i._zod.innerType?._zod?.optin??void 0),S(i._zod,"optout",()=>i._zod.innerType?._zod?.optout??void 0),i._zod.parse=(n,g)=>{return i._zod.innerType._zod.run(n,g)}}),a4=w("$ZodCustom",(i,$)=>{M.init(i,$),Y.init(i,$),i._zod.parse=(n,g)=>{return n},i._zod.check=(n)=>{let g=n.value,v=$.fn(g);if(v instanceof Promise)return v.then((r)=>q1(r,n,g,i));q1(v,n,g,i);return}});function q1(i,$,n,g){if(!i){let v={code:"custom",input:n,inst:g,path:[...g._zod.def.path??[]],continue:!g._zod.def.abort};if(g._zod.def.params)v.params=g._zod.def.params;$.issues.push(Q$(v))}}var Sv={};Gi(Sv,{zhTW:()=>F6,zhCN:()=>R6,yo:()=>o6,vi:()=>C6,uz:()=>c6,ur:()=>t6,uk:()=>zv,ua:()=>E6,tr:()=>N6,th:()=>x6,ta:()=>M6,sv:()=>q6,sl:()=>Z6,ru:()=>T6,ro:()=>L6,pt:()=>l6,ps:()=>A6,pl:()=>B6,ota:()=>S6,no:()=>z6,nl:()=>H6,ms:()=>Y6,mk:()=>G6,lt:()=>K6,ko:()=>Q6,km:()=>Yv,kh:()=>f6,ka:()=>X6,ja:()=>V6,it:()=>W6,is:()=>P6,id:()=>J6,hy:()=>O6,hu:()=>j6,hr:()=>w6,he:()=>k6,frCA:()=>D6,fr:()=>_6,fi:()=>I6,fa:()=>U6,es:()=>u6,eo:()=>b6,en:()=>Gv,el:()=>r6,de:()=>g6,da:()=>n6,cs:()=>v6,ca:()=>$6,bg:()=>i6,be:()=>s4,az:()=>e4,ar:()=>p4});var rj=()=>{let i={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function $(v){return i[v]??null}let n={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${v.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${u}`;return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${r}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${u}`}case"invalid_value":if(v.values.length===1)return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${W(v.values[0])}`;return`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${v.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${r} ${v.maximum.toString()} ${b.unit??"\u0639\u0646\u0635\u0631"}`;return`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${v.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${r} ${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${v.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${r} ${v.minimum.toString()} ${b.unit}`;return`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${v.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${r} ${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${v.prefix}"`;if(r.format==="ends_with")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${r.suffix}"`;if(r.format==="includes")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${r.includes}"`;if(r.format==="regex")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${r.pattern}`;return`${n[r.format]??v.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${v.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${v.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${v.keys.length>1?"\u0629":""}: ${j(v.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${v.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${v.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function p4(){return{localeError:rj()}}var bj=()=>{let i={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function $(v){return i[v]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${v.expected}, daxil olan ${u}`;return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${r}, daxil olan ${u}`}case"invalid_value":if(v.values.length===1)return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${W(v.values[0])}`;return`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${v.origin??"d\u0259y\u0259r"} ${r}${v.maximum.toString()} ${b.unit??"element"}`;return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${v.origin??"d\u0259y\u0259r"} ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${v.origin} ${r}${v.minimum.toString()} ${b.unit}`;return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${v.origin} ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Yanl\u0131\u015F m\u0259tn: "${r.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`;if(r.format==="ends_with")return`Yanl\u0131\u015F m\u0259tn: "${r.suffix}" il\u0259 bitm\u0259lidir`;if(r.format==="includes")return`Yanl\u0131\u015F m\u0259tn: "${r.includes}" daxil olmal\u0131d\u0131r`;if(r.format==="regex")return`Yanl\u0131\u015F m\u0259tn: ${r.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`;return`Yanl\u0131\u015F ${n[r.format]??v.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${v.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${v.keys.length>1?"lar":""}: ${j(v.keys,", ")}`;case"invalid_key":return`${v.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${v.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function e4(){return{localeError:bj()}}function c1(i,$,n,g){let v=Math.abs(i),r=v%10,b=v%100;if(b>=11&&b<=19)return g;if(r===1)return $;if(r>=2&&r<=4)return n;return g}var uj=()=>{let i={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function $(v){return i[v]??null}let n={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},g={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${v.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${u}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${r}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${u}`}case"invalid_value":if(v.values.length===1)return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${W(v.values[0])}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b){let u=Number(v.maximum),U=c1(u,b.unit.one,b.unit.few,b.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${v.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${b.verb} ${r}${v.maximum.toString()} ${U}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${v.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b){let u=Number(v.minimum),U=c1(u,b.unit.one,b.unit.few,b.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${v.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${b.verb} ${r}${v.minimum.toString()} ${U}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${v.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${r.prefix}"`;if(r.format==="ends_with")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${r.suffix}"`;if(r.format==="includes")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${r.includes}"`;if(r.format==="regex")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${r.pattern}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${n[r.format]??v.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${v.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${v.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${j(v.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${v.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${v.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function s4(){return{localeError:uj()}}var Uj=()=>{let i={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function $(v){return i[v]??null}let n={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},g={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${v.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${u}`;return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${r}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${u}`}case"invalid_value":if(v.values.length===1)return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${W(v.values[0])}`;return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${v.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${r}${v.maximum.toString()} ${b.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`;return`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${v.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${v.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${r}${v.minimum.toString()} ${b.unit}`;return`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${v.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${r.prefix}"`;if(r.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${r.suffix}"`;if(r.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${r.includes}"`;if(r.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${r.pattern}`;let b="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";if(r.format==="emoji")b="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E";if(r.format==="datetime")b="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E";if(r.format==="date")b="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430";if(r.format==="time")b="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E";if(r.format==="duration")b="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430";return`${b} ${n[r.format]??v.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${v.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${v.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${v.keys.length>1?"\u043E\u0432\u0435":""}: ${j(v.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${v.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${v.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}};function i6(){return{localeError:Uj()}}var Ij=()=>{let i={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function $(v){return i[v]??null}let n={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Tipus inv\xE0lid: s'esperava instanceof ${v.expected}, s'ha rebut ${u}`;return`Tipus inv\xE0lid: s'esperava ${r}, s'ha rebut ${u}`}case"invalid_value":if(v.values.length===1)return`Valor inv\xE0lid: s'esperava ${W(v.values[0])}`;return`Opci\xF3 inv\xE0lida: s'esperava una de ${j(v.values," o ")}`;case"too_big":{let r=v.inclusive?"com a m\xE0xim":"menys de",b=$(v.origin);if(b)return`Massa gran: s'esperava que ${v.origin??"el valor"} contingu\xE9s ${r} ${v.maximum.toString()} ${b.unit??"elements"}`;return`Massa gran: s'esperava que ${v.origin??"el valor"} fos ${r} ${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?"com a m\xEDnim":"m\xE9s de",b=$(v.origin);if(b)return`Massa petit: s'esperava que ${v.origin} contingu\xE9s ${r} ${v.minimum.toString()} ${b.unit}`;return`Massa petit: s'esperava que ${v.origin} fos ${r} ${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Format inv\xE0lid: ha de comen\xE7ar amb "${r.prefix}"`;if(r.format==="ends_with")return`Format inv\xE0lid: ha d'acabar amb "${r.suffix}"`;if(r.format==="includes")return`Format inv\xE0lid: ha d'incloure "${r.includes}"`;if(r.format==="regex")return`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${r.pattern}`;return`Format inv\xE0lid per a ${n[r.format]??v.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${v.divisor}`;case"unrecognized_keys":return`Clau${v.keys.length>1?"s":""} no reconeguda${v.keys.length>1?"s":""}: ${j(v.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${v.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${v.origin}`;default:return"Entrada inv\xE0lida"}}};function $6(){return{localeError:Ij()}}var _j=()=>{let i={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function $(v){return i[v]??null}let n={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"},g={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${v.expected}, obdr\u017Eeno ${u}`;return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${r}, obdr\u017Eeno ${u}`}case"invalid_value":if(v.values.length===1)return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${W(v.values[0])}`;return`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${v.origin??"hodnota"} mus\xED m\xEDt ${r}${v.maximum.toString()} ${b.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${v.origin??"hodnota"} mus\xED b\xFDt ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${v.origin??"hodnota"} mus\xED m\xEDt ${r}${v.minimum.toString()} ${b.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${v.origin??"hodnota"} mus\xED b\xFDt ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${r.prefix}"`;if(r.format==="ends_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${r.suffix}"`;if(r.format==="includes")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${r.includes}"`;if(r.format==="regex")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${r.pattern}`;return`Neplatn\xFD form\xE1t ${n[r.format]??v.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${v.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${j(v.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${v.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${v.origin}`;default:return"Neplatn\xFD vstup"}}};function v6(){return{localeError:_j()}}var Dj=()=>{let i={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function $(v){return i[v]??null}let n={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},g={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Ugyldigt input: forventede instanceof ${v.expected}, fik ${u}`;return`Ugyldigt input: forventede ${r}, fik ${u}`}case"invalid_value":if(v.values.length===1)return`Ugyldig v\xE6rdi: forventede ${W(v.values[0])}`;return`Ugyldigt valg: forventede en af f\xF8lgende ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin),u=g[v.origin]??v.origin;if(b)return`For stor: forventede ${u??"value"} ${b.verb} ${r} ${v.maximum.toString()} ${b.unit??"elementer"}`;return`For stor: forventede ${u??"value"} havde ${r} ${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin),u=g[v.origin]??v.origin;if(b)return`For lille: forventede ${u} ${b.verb} ${r} ${v.minimum.toString()} ${b.unit}`;return`For lille: forventede ${u} havde ${r} ${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Ugyldig streng: skal starte med "${r.prefix}"`;if(r.format==="ends_with")return`Ugyldig streng: skal ende med "${r.suffix}"`;if(r.format==="includes")return`Ugyldig streng: skal indeholde "${r.includes}"`;if(r.format==="regex")return`Ugyldig streng: skal matche m\xF8nsteret ${r.pattern}`;return`Ugyldig ${n[r.format]??v.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${v.divisor}`;case"unrecognized_keys":return`${v.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${j(v.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${v.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${v.origin}`;default:return"Ugyldigt input"}}};function n6(){return{localeError:Dj()}}var kj=()=>{let i={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function $(v){return i[v]??null}let n={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},g={nan:"NaN",number:"Zahl",array:"Array"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Ung\xFCltige Eingabe: erwartet instanceof ${v.expected}, erhalten ${u}`;return`Ung\xFCltige Eingabe: erwartet ${r}, erhalten ${u}`}case"invalid_value":if(v.values.length===1)return`Ung\xFCltige Eingabe: erwartet ${W(v.values[0])}`;return`Ung\xFCltige Option: erwartet eine von ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Zu gro\xDF: erwartet, dass ${v.origin??"Wert"} ${r}${v.maximum.toString()} ${b.unit??"Elemente"} hat`;return`Zu gro\xDF: erwartet, dass ${v.origin??"Wert"} ${r}${v.maximum.toString()} ist`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Zu klein: erwartet, dass ${v.origin} ${r}${v.minimum.toString()} ${b.unit} hat`;return`Zu klein: erwartet, dass ${v.origin} ${r}${v.minimum.toString()} ist`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Ung\xFCltiger String: muss mit "${r.prefix}" beginnen`;if(r.format==="ends_with")return`Ung\xFCltiger String: muss mit "${r.suffix}" enden`;if(r.format==="includes")return`Ung\xFCltiger String: muss "${r.includes}" enthalten`;if(r.format==="regex")return`Ung\xFCltiger String: muss dem Muster ${r.pattern} entsprechen`;return`Ung\xFCltig: ${n[r.format]??v.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${v.divisor} sein`;case"unrecognized_keys":return`${v.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${j(v.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${v.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${v.origin}`;default:return"Ung\xFCltige Eingabe"}}};function g6(){return{localeError:kj()}}var wj=()=>{let i={string:{unit:"\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},file:{unit:"bytes",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},array:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},set:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},map:{unit:"\u03BA\u03B1\u03C4\u03B1\u03C7\u03C9\u03C1\u03AE\u03C3\u03B5\u03B9\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"}};function $(v){return i[v]??null}let n={regex:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2",email:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03CE\u03C1\u03B1",date:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1",time:"ISO \u03CE\u03C1\u03B1",duration:"ISO \u03B4\u03B9\u03AC\u03C1\u03BA\u03B5\u03B9\u03B1",ipv4:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv4",ipv6:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv6",mac:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 MAC",cidrv4:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv4",cidrv6:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv6",base64:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64",base64url:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64url",json_string:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",e164:"\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",jwt:"JWT",template_literal:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(typeof v.expected==="string"&&/^[A-Z]/.test(v.expected))return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD instanceof ${v.expected}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${u}`;return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${r}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${u}`}case"invalid_value":if(v.values.length===1)return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${W(v.values[0])}`;return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD \u03AD\u03BD\u03B1 \u03B1\u03C0\u03CC ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${v.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${r}${v.maximum.toString()} ${b.unit??"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"}`;return`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${v.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${v.origin} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${r}${v.minimum.toString()} ${b.unit}`;return`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${v.origin} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03BE\u03B5\u03BA\u03B9\u03BD\u03AC \u03BC\u03B5 "${r.prefix}"`;if(r.format==="ends_with")return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03BD\u03B5\u03B9 \u03BC\u03B5 "${r.suffix}"`;if(r.format==="includes")return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9 "${r.includes}"`;if(r.format==="regex")return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B1\u03B9\u03C1\u03B9\u03AC\u03B6\u03B5\u03B9 \u03BC\u03B5 \u03C4\u03BF \u03BC\u03BF\u03C4\u03AF\u03B2\u03BF ${r.pattern}`;return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF: ${n[r.format]??v.format}`}case"not_multiple_of":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF\u03C2 \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03BF\u03BB\u03BB\u03B1\u03C0\u03BB\u03AC\u03C3\u03B9\u03BF \u03C4\u03BF\u03C5 ${v.divisor}`;case"unrecognized_keys":return`\u0386\u03B3\u03BD\u03C9\u03C3\u03C4${v.keys.length>1?"\u03B1":"\u03BF"} \u03BA\u03BB\u03B5\u03B9\u03B4${v.keys.length>1?"\u03B9\u03AC":"\u03AF"}: ${j(v.keys,", ")}`;case"invalid_key":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03BA\u03BB\u03B5\u03B9\u03B4\u03AF \u03C3\u03C4\u03BF ${v.origin}`;case"invalid_union":return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2";case"invalid_element":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C4\u03B9\u03BC\u03AE \u03C3\u03C4\u03BF ${v.origin}`;default:return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"}}};function r6(){return{localeError:wj()}}var jj=()=>{let i={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function $(v){return i[v]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;return`Invalid input: expected ${r}, received ${u}`}case"invalid_value":if(v.values.length===1)return`Invalid input: expected ${W(v.values[0])}`;return`Invalid option: expected one of ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Too big: expected ${v.origin??"value"} to have ${r}${v.maximum.toString()} ${b.unit??"elements"}`;return`Too big: expected ${v.origin??"value"} to be ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Too small: expected ${v.origin} to have ${r}${v.minimum.toString()} ${b.unit}`;return`Too small: expected ${v.origin} to be ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Invalid string: must start with "${r.prefix}"`;if(r.format==="ends_with")return`Invalid string: must end with "${r.suffix}"`;if(r.format==="includes")return`Invalid string: must include "${r.includes}"`;if(r.format==="regex")return`Invalid string: must match pattern ${r.pattern}`;return`Invalid ${n[r.format]??v.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${v.divisor}`;case"unrecognized_keys":return`Unrecognized key${v.keys.length>1?"s":""}: ${j(v.keys,", ")}`;case"invalid_key":return`Invalid key in ${v.origin}`;case"invalid_union":if(v.options&&Array.isArray(v.options)&&v.options.length>0)return`Invalid discriminator value. Expected ${v.options.map((b)=>`'${b}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${v.origin}`;default:return"Invalid input"}}};function Gv(){return{localeError:jj()}}var Oj=()=>{let i={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function $(v){return i[v]??null}let n={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},g={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Nevalida enigo: atendi\u011Dis instanceof ${v.expected}, ricevi\u011Dis ${u}`;return`Nevalida enigo: atendi\u011Dis ${r}, ricevi\u011Dis ${u}`}case"invalid_value":if(v.values.length===1)return`Nevalida enigo: atendi\u011Dis ${W(v.values[0])}`;return`Nevalida opcio: atendi\u011Dis unu el ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Tro granda: atendi\u011Dis ke ${v.origin??"valoro"} havu ${r}${v.maximum.toString()} ${b.unit??"elementojn"}`;return`Tro granda: atendi\u011Dis ke ${v.origin??"valoro"} havu ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Tro malgranda: atendi\u011Dis ke ${v.origin} havu ${r}${v.minimum.toString()} ${b.unit}`;return`Tro malgranda: atendi\u011Dis ke ${v.origin} estu ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Nevalida karaktraro: devas komenci\u011Di per "${r.prefix}"`;if(r.format==="ends_with")return`Nevalida karaktraro: devas fini\u011Di per "${r.suffix}"`;if(r.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${r.includes}"`;if(r.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${r.pattern}`;return`Nevalida ${n[r.format]??v.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${v.divisor}`;case"unrecognized_keys":return`Nekonata${v.keys.length>1?"j":""} \u015Dlosilo${v.keys.length>1?"j":""}: ${j(v.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${v.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${v.origin}`;default:return"Nevalida enigo"}}};function b6(){return{localeError:Oj()}}var Jj=()=>{let i={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function $(v){return i[v]??null}let n={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},g={nan:"NaN",string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Entrada inv\xE1lida: se esperaba instanceof ${v.expected}, recibido ${u}`;return`Entrada inv\xE1lida: se esperaba ${r}, recibido ${u}`}case"invalid_value":if(v.values.length===1)return`Entrada inv\xE1lida: se esperaba ${W(v.values[0])}`;return`Opci\xF3n inv\xE1lida: se esperaba una de ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin),u=g[v.origin]??v.origin;if(b)return`Demasiado grande: se esperaba que ${u??"valor"} tuviera ${r}${v.maximum.toString()} ${b.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${u??"valor"} fuera ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin),u=g[v.origin]??v.origin;if(b)return`Demasiado peque\xF1o: se esperaba que ${u} tuviera ${r}${v.minimum.toString()} ${b.unit}`;return`Demasiado peque\xF1o: se esperaba que ${u} fuera ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Cadena inv\xE1lida: debe comenzar con "${r.prefix}"`;if(r.format==="ends_with")return`Cadena inv\xE1lida: debe terminar en "${r.suffix}"`;if(r.format==="includes")return`Cadena inv\xE1lida: debe incluir "${r.includes}"`;if(r.format==="regex")return`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${r.pattern}`;return`Inv\xE1lido ${n[r.format]??v.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${v.divisor}`;case"unrecognized_keys":return`Llave${v.keys.length>1?"s":""} desconocida${v.keys.length>1?"s":""}: ${j(v.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${g[v.origin]??v.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${g[v.origin]??v.origin}`;default:return"Entrada inv\xE1lida"}}};function u6(){return{localeError:Jj()}}var Pj=()=>{let i={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function $(v){return i[v]??null}let n={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},g={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${v.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${u} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${r} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${u} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":if(v.values.length===1)return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${W(v.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`;return`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${j(v.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${v.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${r}${v.maximum.toString()} ${b.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${v.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${r}${v.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${v.origin} \u0628\u0627\u06CC\u062F ${r}${v.minimum.toString()} ${b.unit} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${v.origin} \u0628\u0627\u06CC\u062F ${r}${v.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${r.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`;if(r.format==="ends_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${r.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`;if(r.format==="includes")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${r.includes}" \u0628\u0627\u0634\u062F`;if(r.format==="regex")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${r.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`;return`${n[r.format]??v.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${v.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${v.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${j(v.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${v.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${v.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function U6(){return{localeError:Pj()}}var Wj=()=>{let i={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function $(v){return i[v]??null}let n={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Virheellinen tyyppi: odotettiin instanceof ${v.expected}, oli ${u}`;return`Virheellinen tyyppi: odotettiin ${r}, oli ${u}`}case"invalid_value":if(v.values.length===1)return`Virheellinen sy\xF6te: t\xE4ytyy olla ${W(v.values[0])}`;return`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Liian suuri: ${b.subject} t\xE4ytyy olla ${r}${v.maximum.toString()} ${b.unit}`.trim();return`Liian suuri: arvon t\xE4ytyy olla ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Liian pieni: ${b.subject} t\xE4ytyy olla ${r}${v.minimum.toString()} ${b.unit}`.trim();return`Liian pieni: arvon t\xE4ytyy olla ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${r.prefix}"`;if(r.format==="ends_with")return`Virheellinen sy\xF6te: t\xE4ytyy loppua "${r.suffix}"`;if(r.format==="includes")return`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${r.includes}"`;if(r.format==="regex")return`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${r.pattern}`;return`Virheellinen ${n[r.format]??v.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${v.divisor} monikerta`;case"unrecognized_keys":return`${v.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${j(v.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function I6(){return{localeError:Wj()}}var Vj=()=>{let i={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function $(v){return i[v]??null}let n={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},g={string:"cha\xEEne",number:"nombre",int:"entier",boolean:"bool\xE9en",bigint:"grand entier",symbol:"symbole",undefined:"ind\xE9fini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Entr\xE9e invalide : instanceof ${v.expected} attendu, ${u} re\xE7u`;return`Entr\xE9e invalide : ${r} attendu, ${u} re\xE7u`}case"invalid_value":if(v.values.length===1)return`Entr\xE9e invalide : ${W(v.values[0])} attendu`;return`Option invalide : une valeur parmi ${j(v.values,"|")} attendue`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Trop grand : ${g[v.origin]??"valeur"} doit ${b.verb} ${r}${v.maximum.toString()} ${b.unit??"\xE9l\xE9ment(s)"}`;return`Trop grand : ${g[v.origin]??"valeur"} doit \xEAtre ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Trop petit : ${g[v.origin]??"valeur"} doit ${b.verb} ${r}${v.minimum.toString()} ${b.unit}`;return`Trop petit : ${g[v.origin]??"valeur"} doit \xEAtre ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${r.prefix}"`;if(r.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${r.suffix}"`;if(r.format==="includes")return`Cha\xEEne invalide : doit inclure "${r.includes}"`;if(r.format==="regex")return`Cha\xEEne invalide : doit correspondre au mod\xE8le ${r.pattern}`;return`${n[r.format]??v.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${v.divisor}`;case"unrecognized_keys":return`Cl\xE9${v.keys.length>1?"s":""} non reconnue${v.keys.length>1?"s":""} : ${j(v.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${v.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${v.origin}`;default:return"Entr\xE9e invalide"}}};function _6(){return{localeError:Vj()}}var Xj=()=>{let i={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function $(v){return i[v]??null}let n={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Entr\xE9e invalide : attendu instanceof ${v.expected}, re\xE7u ${u}`;return`Entr\xE9e invalide : attendu ${r}, re\xE7u ${u}`}case"invalid_value":if(v.values.length===1)return`Entr\xE9e invalide : attendu ${W(v.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"\u2264":"<",b=$(v.origin);if(b)return`Trop grand : attendu que ${v.origin??"la valeur"} ait ${r}${v.maximum.toString()} ${b.unit}`;return`Trop grand : attendu que ${v.origin??"la valeur"} soit ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?"\u2265":">",b=$(v.origin);if(b)return`Trop petit : attendu que ${v.origin} ait ${r}${v.minimum.toString()} ${b.unit}`;return`Trop petit : attendu que ${v.origin} soit ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${r.prefix}"`;if(r.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${r.suffix}"`;if(r.format==="includes")return`Cha\xEEne invalide : doit inclure "${r.includes}"`;if(r.format==="regex")return`Cha\xEEne invalide : doit correspondre au motif ${r.pattern}`;return`${n[r.format]??v.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${v.divisor}`;case"unrecognized_keys":return`Cl\xE9${v.keys.length>1?"s":""} non reconnue${v.keys.length>1?"s":""} : ${j(v.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${v.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${v.origin}`;default:return"Entr\xE9e invalide"}}};function D6(){return{localeError:Xj()}}var fj=()=>{let i={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},$={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},n=(I)=>I?i[I]:void 0,g=(I)=>{let _=n(I);if(_)return _.label;return I??i.unknown.label},v=(I)=>`\u05D4${g(I)}`,r=(I)=>{return(n(I)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA"},b=(I)=>{if(!I)return null;return $[I]??null},u={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}},U={nan:"NaN"};return(I)=>{switch(I.code){case"invalid_type":{let _=I.expected,k=U[_??""]??g(_),O=V(I.input),J=U[O]??i[O]?.label??O;if(/^[A-Z]/.test(I.expected))return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${I.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${J}`;return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${k}, \u05D4\u05EA\u05E7\u05D1\u05DC ${J}`}case"invalid_value":{if(I.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${W(I.values[0])}`;let _=I.values.map((J)=>W(J));if(I.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${_[0]} \u05D0\u05D5 ${_[1]}`;let k=_[_.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${_.slice(0,-1).join(", ")} \u05D0\u05D5 ${k}`}case"too_big":{let _=b(I.origin),k=v(I.origin??"value");if(I.origin==="string")return`${_?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${k} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${I.maximum.toString()} ${_?.unit??""} ${I.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(I.origin==="number"){let Q=I.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${I.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${I.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${k} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${Q}`}if(I.origin==="array"||I.origin==="set"){let Q=I.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",A=I.inclusive?`${I.maximum} ${_?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${I.maximum} ${_?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${k} ${Q} \u05DC\u05D4\u05DB\u05D9\u05DC ${A}`.trim()}let O=I.inclusive?"<=":"<",J=r(I.origin??"value");if(_?.unit)return`${_.longLabel} \u05DE\u05D3\u05D9: ${k} ${J} ${O}${I.maximum.toString()} ${_.unit}`;return`${_?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${k} ${J} ${O}${I.maximum.toString()}`}case"too_small":{let _=b(I.origin),k=v(I.origin??"value");if(I.origin==="string")return`${_?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${k} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${I.minimum.toString()} ${_?.unit??""} ${I.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(I.origin==="number"){let Q=I.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${I.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${I.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${k} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${Q}`}if(I.origin==="array"||I.origin==="set"){let Q=I.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(I.minimum===1&&I.inclusive){let z=I.origin==="set"?"\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3":"\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3";return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${k} ${Q} \u05DC\u05D4\u05DB\u05D9\u05DC ${z}`}let A=I.inclusive?`${I.minimum} ${_?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${I.minimum} ${_?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${k} ${Q} \u05DC\u05D4\u05DB\u05D9\u05DC ${A}`.trim()}let O=I.inclusive?">=":">",J=r(I.origin??"value");if(_?.unit)return`${_.shortLabel} \u05DE\u05D3\u05D9: ${k} ${J} ${O}${I.minimum.toString()} ${_.unit}`;return`${_?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${k} ${J} ${O}${I.minimum.toString()}`}case"invalid_format":{let _=I;if(_.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${_.prefix}"`;if(_.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${_.suffix}"`;if(_.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${_.includes}"`;if(_.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${_.pattern}`;let k=u[_.format],O=k?.label??_.format,Q=(k?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${O} \u05DC\u05D0 ${Q}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${I.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${I.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${I.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${j(I.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${v(I.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function k6(){return{localeError:fj()}}var Qj=()=>{let i={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function $(v){return i[v]??null}let n={regex:"unos",email:"email adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},g={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Neispravan unos: o\u010Dekuje se instanceof ${v.expected}, a primljeno je ${u}`;return`Neispravan unos: o\u010Dekuje se ${r}, a primljeno je ${u}`}case"invalid_value":if(v.values.length===1)return`Neispravna vrijednost: o\u010Dekivano ${W(v.values[0])}`;return`Neispravna opcija: o\u010Dekivano jedno od ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin),u=g[v.origin]??v.origin;if(b)return`Preveliko: o\u010Dekivano da ${u??"vrijednost"} ima ${r}${v.maximum.toString()} ${b.unit??"elemenata"}`;return`Preveliko: o\u010Dekivano da ${u??"vrijednost"} bude ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin),u=g[v.origin]??v.origin;if(b)return`Premalo: o\u010Dekivano da ${u} ima ${r}${v.minimum.toString()} ${b.unit}`;return`Premalo: o\u010Dekivano da ${u} bude ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Neispravan tekst: mora zapo\u010Dinjati s "${r.prefix}"`;if(r.format==="ends_with")return`Neispravan tekst: mora zavr\u0161avati s "${r.suffix}"`;if(r.format==="includes")return`Neispravan tekst: mora sadr\u017Eavati "${r.includes}"`;if(r.format==="regex")return`Neispravan tekst: mora odgovarati uzorku ${r.pattern}`;return`Neispravna ${n[r.format]??v.format}`}case"not_multiple_of":return`Neispravan broj: mora biti vi\u0161ekratnik od ${v.divisor}`;case"unrecognized_keys":return`Neprepoznat${v.keys.length>1?"i klju\u010Devi":" klju\u010D"}: ${j(v.keys,", ")}`;case"invalid_key":return`Neispravan klju\u010D u ${g[v.origin]??v.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${g[v.origin]??v.origin}`;default:return"Neispravan unos"}}};function w6(){return{localeError:Qj()}}var Kj=()=>{let i={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function $(v){return i[v]??null}let n={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"},g={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${v.expected}, a kapott \xE9rt\xE9k ${u}`;return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${r}, a kapott \xE9rt\xE9k ${u}`}case"invalid_value":if(v.values.length===1)return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${W(v.values[0])}`;return`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`T\xFAl nagy: ${v.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${r}${v.maximum.toString()} ${b.unit??"elem"}`;return`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${v.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${v.origin} m\xE9rete t\xFAl kicsi ${r}${v.minimum.toString()} ${b.unit}`;return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${v.origin} t\xFAl kicsi ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\xC9rv\xE9nytelen string: "${r.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`;if(r.format==="ends_with")return`\xC9rv\xE9nytelen string: "${r.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`;if(r.format==="includes")return`\xC9rv\xE9nytelen string: "${r.includes}" \xE9rt\xE9ket kell tartalmaznia`;if(r.format==="regex")return`\xC9rv\xE9nytelen string: ${r.pattern} mint\xE1nak kell megfelelnie`;return`\xC9rv\xE9nytelen ${n[r.format]??v.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${v.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${v.keys.length>1?"s":""}: ${j(v.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${v.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${v.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function j6(){return{localeError:Kj()}}function C1(i,$,n){return Math.abs(i)===1?$:n}function S$(i){if(!i)return"";let $=["\u0561","\u0565","\u0568","\u056B","\u0578","\u0578\u0582","\u0585"],n=i[i.length-1];return i+($.includes(n)?"\u0576":"\u0568")}var Gj=()=>{let i={string:{unit:{one:"\u0576\u0577\u0561\u0576",many:"\u0576\u0577\u0561\u0576\u0576\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},file:{unit:{one:"\u0562\u0561\u0575\u0569",many:"\u0562\u0561\u0575\u0569\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},array:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},set:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"}};function $(v){return i[v]??null}let n={regex:"\u0574\u0578\u0582\u057F\u0584",email:"\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",url:"URL",emoji:"\u0567\u0574\u0578\u057B\u056B",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",date:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",time:"ISO \u056A\u0561\u0574",duration:"ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",ipv4:"IPv4 \u0570\u0561\u057D\u0581\u0565",ipv6:"IPv6 \u0570\u0561\u057D\u0581\u0565",cidrv4:"IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",cidrv6:"IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",base64:"base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",base64url:"base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",json_string:"JSON \u057F\u0578\u0572",e164:"E.164 \u0570\u0561\u0574\u0561\u0580",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},g={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${v.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${u}`;return`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${r}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${u}`}case"invalid_value":if(v.values.length===1)return`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${W(v.values[1])}`;return`\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b){let u=Number(v.maximum),U=C1(u,b.unit.one,b.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${S$(v.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${r}${v.maximum.toString()} ${U}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${S$(v.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b){let u=Number(v.minimum),U=C1(u,b.unit.one,b.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${S$(v.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${r}${v.minimum.toString()} ${U}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${S$(v.origin)} \u056C\u056B\u0576\u056B ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${r.prefix}"-\u0578\u057E`;if(r.format==="ends_with")return`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${r.suffix}"-\u0578\u057E`;if(r.format==="includes")return`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${r.includes}"`;if(r.format==="regex")return`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${r.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`;return`\u054D\u056D\u0561\u056C ${n[r.format]??v.format}`}case"not_multiple_of":return`\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${v.divisor}-\u056B`;case"unrecognized_keys":return`\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${v.keys.length>1?"\u0576\u0565\u0580":""}. ${j(v.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${S$(v.origin)}-\u0578\u0582\u0574`;case"invalid_union":return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574";case"invalid_element":return`\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${S$(v.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}};function O6(){return{localeError:Gj()}}var Yj=()=>{let i={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function $(v){return i[v]??null}let n={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Input tidak valid: diharapkan instanceof ${v.expected}, diterima ${u}`;return`Input tidak valid: diharapkan ${r}, diterima ${u}`}case"invalid_value":if(v.values.length===1)return`Input tidak valid: diharapkan ${W(v.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Terlalu besar: diharapkan ${v.origin??"value"} memiliki ${r}${v.maximum.toString()} ${b.unit??"elemen"}`;return`Terlalu besar: diharapkan ${v.origin??"value"} menjadi ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Terlalu kecil: diharapkan ${v.origin} memiliki ${r}${v.minimum.toString()} ${b.unit}`;return`Terlalu kecil: diharapkan ${v.origin} menjadi ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`String tidak valid: harus dimulai dengan "${r.prefix}"`;if(r.format==="ends_with")return`String tidak valid: harus berakhir dengan "${r.suffix}"`;if(r.format==="includes")return`String tidak valid: harus menyertakan "${r.includes}"`;if(r.format==="regex")return`String tidak valid: harus sesuai pola ${r.pattern}`;return`${n[r.format]??v.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${v.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${v.keys.length>1?"s":""}: ${j(v.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${v.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${v.origin}`;default:return"Input tidak valid"}}};function J6(){return{localeError:Yj()}}var Hj=()=>{let i={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function $(v){return i[v]??null}let n={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"},g={nan:"NaN",number:"n\xFAmer",array:"fylki"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Rangt gildi: \xDE\xFA sl\xF3st inn ${u} \xFEar sem \xE1 a\xF0 vera instanceof ${v.expected}`;return`Rangt gildi: \xDE\xFA sl\xF3st inn ${u} \xFEar sem \xE1 a\xF0 vera ${r}`}case"invalid_value":if(v.values.length===1)return`Rangt gildi: gert r\xE1\xF0 fyrir ${W(v.values[0])}`;return`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${v.origin??"gildi"} hafi ${r}${v.maximum.toString()} ${b.unit??"hluti"}`;return`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${v.origin??"gildi"} s\xE9 ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${v.origin} hafi ${r}${v.minimum.toString()} ${b.unit}`;return`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${v.origin} s\xE9 ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${r.prefix}"`;if(r.format==="ends_with")return`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${r.suffix}"`;if(r.format==="includes")return`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${r.includes}"`;if(r.format==="regex")return`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${r.pattern}`;return`Rangt ${n[r.format]??v.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${v.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${v.keys.length>1?"ir lyklar":"ur lykill"}: ${j(v.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${v.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${v.origin}`;default:return"Rangt gildi"}}};function P6(){return{localeError:Hj()}}var zj=()=>{let i={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function $(v){return i[v]??null}let n={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},g={nan:"NaN",number:"numero",array:"vettore"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Input non valido: atteso instanceof ${v.expected}, ricevuto ${u}`;return`Input non valido: atteso ${r}, ricevuto ${u}`}case"invalid_value":if(v.values.length===1)return`Input non valido: atteso ${W(v.values[0])}`;return`Opzione non valida: atteso uno tra ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Troppo grande: ${v.origin??"valore"} deve avere ${r}${v.maximum.toString()} ${b.unit??"elementi"}`;return`Troppo grande: ${v.origin??"valore"} deve essere ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Troppo piccolo: ${v.origin} deve avere ${r}${v.minimum.toString()} ${b.unit}`;return`Troppo piccolo: ${v.origin} deve essere ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Stringa non valida: deve iniziare con "${r.prefix}"`;if(r.format==="ends_with")return`Stringa non valida: deve terminare con "${r.suffix}"`;if(r.format==="includes")return`Stringa non valida: deve includere "${r.includes}"`;if(r.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${r.pattern}`;return`Input non valido: ${n[r.format]??v.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${v.divisor}`;case"unrecognized_keys":return`Chiav${v.keys.length>1?"i":"e"} non riconosciut${v.keys.length>1?"e":"a"}: ${j(v.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${v.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${v.origin}`;default:return"Input non valido"}}};function W6(){return{localeError:zj()}}var Sj=()=>{let i={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function $(v){return i[v]??null}let n={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},g={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u7121\u52B9\u306A\u5165\u529B: instanceof ${v.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${u}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;return`\u7121\u52B9\u306A\u5165\u529B: ${r}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${u}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":if(v.values.length===1)return`\u7121\u52B9\u306A\u5165\u529B: ${W(v.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`;return`\u7121\u52B9\u306A\u9078\u629E: ${j(v.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let r=v.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",b=$(v.origin);if(b)return`\u5927\u304D\u3059\u304E\u308B\u5024: ${v.origin??"\u5024"}\u306F${v.maximum.toString()}${b.unit??"\u8981\u7D20"}${r}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5927\u304D\u3059\u304E\u308B\u5024: ${v.origin??"\u5024"}\u306F${v.maximum.toString()}${r}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let r=v.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",b=$(v.origin);if(b)return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${v.origin}\u306F${v.minimum.toString()}${b.unit}${r}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${v.origin}\u306F${v.minimum.toString()}${r}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${r.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(r.format==="ends_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${r.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(r.format==="includes")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${r.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(r.format==="regex")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${r.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u7121\u52B9\u306A${n[r.format]??v.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${v.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${v.keys.length>1?"\u7FA4":""}: ${j(v.keys,"\u3001")}`;case"invalid_key":return`${v.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${v.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function V6(){return{localeError:Sj()}}var Aj=()=>{let i={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function $(v){return i[v]??null}let n={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",json_string:"JSON \u10D5\u10D4\u10DA\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},g={nan:"NaN",number:"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",string:"\u10D5\u10D4\u10DA\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",array:"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${v.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${u}`;return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${r}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${u}`}case"invalid_value":if(v.values.length===1)return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${W(v.values[0])}`;return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${j(v.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${v.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${b.verb} ${r}${v.maximum.toString()} ${b.unit}`;return`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${v.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${v.origin} ${b.verb} ${r}${v.minimum.toString()} ${b.unit}`;return`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${v.origin} \u10D8\u10E7\u10DD\u10E1 ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${r.prefix}"-\u10D8\u10D7`;if(r.format==="ends_with")return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${r.suffix}"-\u10D8\u10D7`;if(r.format==="includes")return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${r.includes}"-\u10E1`;if(r.format==="regex")return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${r.pattern}`;return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${n[r.format]??v.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${v.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${v.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${j(v.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${v.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${v.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}};function X6(){return{localeError:Aj()}}var Bj=()=>{let i={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function $(v){return i[v]??null}let n={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},g={nan:"NaN",number:"\u179B\u17C1\u1781",array:"\u17A2\u17B6\u179A\u17C1 (Array)",null:"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${v.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${u}`;return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${u}`}case"invalid_value":if(v.values.length===1)return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${W(v.values[0])}`;return`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${v.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${r} ${v.maximum.toString()} ${b.unit??"\u1792\u17B6\u178F\u17BB"}`;return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${v.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${r} ${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${v.origin} ${r} ${v.minimum.toString()} ${b.unit}`;return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${v.origin} ${r} ${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${r.prefix}"`;if(r.format==="ends_with")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${r.suffix}"`;if(r.format==="includes")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${r.includes}"`;if(r.format==="regex")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${r.pattern}`;return`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${n[r.format]??v.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${v.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${j(v.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${v.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${v.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function Yv(){return{localeError:Bj()}}function f6(){return Yv()}var lj=()=>{let i={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function $(v){return i[v]??null}let n={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${v.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${u}\uC785\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${r}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${u}\uC785\uB2C8\uB2E4`}case"invalid_value":if(v.values.length===1)return`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${W(v.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C \uC635\uC158: ${j(v.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let r=v.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",b=r==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",u=$(v.origin),U=u?.unit??"\uC694\uC18C";if(u)return`${v.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${v.maximum.toString()}${U} ${r}${b}`;return`${v.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${v.maximum.toString()} ${r}${b}`}case"too_small":{let r=v.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",b=r==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",u=$(v.origin),U=u?.unit??"\uC694\uC18C";if(u)return`${v.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${v.minimum.toString()}${U} ${r}${b}`;return`${v.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${v.minimum.toString()} ${r}${b}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${r.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`;if(r.format==="ends_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${r.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`;if(r.format==="includes")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${r.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`;if(r.format==="regex")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${r.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C ${n[r.format]??v.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${v.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${j(v.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${v.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${v.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function Q6(){return{localeError:lj()}}var Hv=(i)=>{return i.charAt(0).toUpperCase()+i.slice(1)};function R1(i){let $=Math.abs(i),n=$%10,g=$%100;if(g>=11&&g<=19||n===0)return"many";if(n===1)return"one";return"few"}var Lj=()=>{let i={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function $(v,r,b,u){let U=i[v]??null;if(U===null)return U;return{unit:U.unit[r],verb:U.verb[u][b?"inclusive":"notInclusive"]}}let n={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"},g={nan:"NaN",number:"skai\u010Dius",bigint:"sveikasis skai\u010Dius",string:"eilut\u0117",boolean:"login\u0117 reik\u0161m\u0117",undefined:"neapibr\u0117\u017Eta reik\u0161m\u0117",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulin\u0117 reik\u0161m\u0117"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Gautas tipas ${u}, o tik\u0117tasi - instanceof ${v.expected}`;return`Gautas tipas ${u}, o tik\u0117tasi - ${r}`}case"invalid_value":if(v.values.length===1)return`Privalo b\u016Bti ${W(v.values[0])}`;return`Privalo b\u016Bti vienas i\u0161 ${j(v.values,"|")} pasirinkim\u0173`;case"too_big":{let r=g[v.origin]??v.origin,b=$(v.origin,R1(Number(v.maximum)),v.inclusive??!1,"smaller");if(b?.verb)return`${Hv(r??v.origin??"reik\u0161m\u0117")} ${b.verb} ${v.maximum.toString()} ${b.unit??"element\u0173"}`;let u=v.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${Hv(r??v.origin??"reik\u0161m\u0117")} turi b\u016Bti ${u} ${v.maximum.toString()} ${b?.unit}`}case"too_small":{let r=g[v.origin]??v.origin,b=$(v.origin,R1(Number(v.minimum)),v.inclusive??!1,"bigger");if(b?.verb)return`${Hv(r??v.origin??"reik\u0161m\u0117")} ${b.verb} ${v.minimum.toString()} ${b.unit??"element\u0173"}`;let u=v.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${Hv(r??v.origin??"reik\u0161m\u0117")} turi b\u016Bti ${u} ${v.minimum.toString()} ${b?.unit}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Eilut\u0117 privalo prasid\u0117ti "${r.prefix}"`;if(r.format==="ends_with")return`Eilut\u0117 privalo pasibaigti "${r.suffix}"`;if(r.format==="includes")return`Eilut\u0117 privalo \u012Ftraukti "${r.includes}"`;if(r.format==="regex")return`Eilut\u0117 privalo atitikti ${r.pattern}`;return`Neteisingas ${n[r.format]??v.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${v.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${v.keys.length>1?"i":"as"} rakt${v.keys.length>1?"ai":"as"}: ${j(v.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let r=g[v.origin]??v.origin;return`${Hv(r??v.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function K6(){return{localeError:Lj()}}var Tj=()=>{let i={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function $(v){return i[v]??null}let n={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},g={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${v.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${u}`;return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${r}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${u}`}case"invalid_value":if(v.values.length===1)return`Invalid input: expected ${W(v.values[0])}`;return`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${v.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${r}${v.maximum.toString()} ${b.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`;return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${v.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${v.origin} \u0434\u0430 \u0438\u043C\u0430 ${r}${v.minimum.toString()} ${b.unit}`;return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${v.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${r.prefix}"`;if(r.format==="ends_with")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${r.suffix}"`;if(r.format==="includes")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${r.includes}"`;if(r.format==="regex")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${r.pattern}`;return`Invalid ${n[r.format]??v.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${v.divisor}`;case"unrecognized_keys":return`${v.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${j(v.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${v.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${v.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function G6(){return{localeError:Tj()}}var Zj=()=>{let i={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function $(v){return i[v]??null}let n={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},g={nan:"NaN",number:"nombor"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Input tidak sah: dijangka instanceof ${v.expected}, diterima ${u}`;return`Input tidak sah: dijangka ${r}, diterima ${u}`}case"invalid_value":if(v.values.length===1)return`Input tidak sah: dijangka ${W(v.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Terlalu besar: dijangka ${v.origin??"nilai"} ${b.verb} ${r}${v.maximum.toString()} ${b.unit??"elemen"}`;return`Terlalu besar: dijangka ${v.origin??"nilai"} adalah ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Terlalu kecil: dijangka ${v.origin} ${b.verb} ${r}${v.minimum.toString()} ${b.unit}`;return`Terlalu kecil: dijangka ${v.origin} adalah ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`String tidak sah: mesti bermula dengan "${r.prefix}"`;if(r.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${r.suffix}"`;if(r.format==="includes")return`String tidak sah: mesti mengandungi "${r.includes}"`;if(r.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${r.pattern}`;return`${n[r.format]??v.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${v.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${j(v.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${v.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${v.origin}`;default:return"Input tidak sah"}}};function Y6(){return{localeError:Zj()}}var qj=()=>{let i={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function $(v){return i[v]??null}let n={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},g={nan:"NaN",number:"getal"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Ongeldige invoer: verwacht instanceof ${v.expected}, ontving ${u}`;return`Ongeldige invoer: verwacht ${r}, ontving ${u}`}case"invalid_value":if(v.values.length===1)return`Ongeldige invoer: verwacht ${W(v.values[0])}`;return`Ongeldige optie: verwacht \xE9\xE9n van ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin),u=v.origin==="date"?"laat":v.origin==="string"?"lang":"groot";if(b)return`Te ${u}: verwacht dat ${v.origin??"waarde"} ${r}${v.maximum.toString()} ${b.unit??"elementen"} ${b.verb}`;return`Te ${u}: verwacht dat ${v.origin??"waarde"} ${r}${v.maximum.toString()} is`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin),u=v.origin==="date"?"vroeg":v.origin==="string"?"kort":"klein";if(b)return`Te ${u}: verwacht dat ${v.origin} ${r}${v.minimum.toString()} ${b.unit} ${b.verb}`;return`Te ${u}: verwacht dat ${v.origin} ${r}${v.minimum.toString()} is`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Ongeldige tekst: moet met "${r.prefix}" beginnen`;if(r.format==="ends_with")return`Ongeldige tekst: moet op "${r.suffix}" eindigen`;if(r.format==="includes")return`Ongeldige tekst: moet "${r.includes}" bevatten`;if(r.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${r.pattern}`;return`Ongeldig: ${n[r.format]??v.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${v.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${v.keys.length>1?"s":""}: ${j(v.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${v.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${v.origin}`;default:return"Ongeldige invoer"}}};function H6(){return{localeError:qj()}}var Mj=()=>{let i={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function $(v){return i[v]??null}let n={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},g={nan:"NaN",number:"tall",array:"liste"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Ugyldig input: forventet instanceof ${v.expected}, fikk ${u}`;return`Ugyldig input: forventet ${r}, fikk ${u}`}case"invalid_value":if(v.values.length===1)return`Ugyldig verdi: forventet ${W(v.values[0])}`;return`Ugyldig valg: forventet en av ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`For stor(t): forventet ${v.origin??"value"} til \xE5 ha ${r}${v.maximum.toString()} ${b.unit??"elementer"}`;return`For stor(t): forventet ${v.origin??"value"} til \xE5 ha ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`For lite(n): forventet ${v.origin} til \xE5 ha ${r}${v.minimum.toString()} ${b.unit}`;return`For lite(n): forventet ${v.origin} til \xE5 ha ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Ugyldig streng: m\xE5 starte med "${r.prefix}"`;if(r.format==="ends_with")return`Ugyldig streng: m\xE5 ende med "${r.suffix}"`;if(r.format==="includes")return`Ugyldig streng: m\xE5 inneholde "${r.includes}"`;if(r.format==="regex")return`Ugyldig streng: m\xE5 matche m\xF8nsteret ${r.pattern}`;return`Ugyldig ${n[r.format]??v.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${v.divisor}`;case"unrecognized_keys":return`${v.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${j(v.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${v.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${v.origin}`;default:return"Ugyldig input"}}};function z6(){return{localeError:Mj()}}var xj=()=>{let i={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function $(v){return i[v]??null}let n={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"},g={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`F\xE2sit giren: umulan instanceof ${v.expected}, al\u0131nan ${u}`;return`F\xE2sit giren: umulan ${r}, al\u0131nan ${u}`}case"invalid_value":if(v.values.length===1)return`F\xE2sit giren: umulan ${W(v.values[0])}`;return`F\xE2sit tercih: m\xFBteberler ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Fazla b\xFCy\xFCk: ${v.origin??"value"}, ${r}${v.maximum.toString()} ${b.unit??"elements"} sahip olmal\u0131yd\u0131.`;return`Fazla b\xFCy\xFCk: ${v.origin??"value"}, ${r}${v.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Fazla k\xFC\xE7\xFCk: ${v.origin}, ${r}${v.minimum.toString()} ${b.unit} sahip olmal\u0131yd\u0131.`;return`Fazla k\xFC\xE7\xFCk: ${v.origin}, ${r}${v.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`F\xE2sit metin: "${r.prefix}" ile ba\u015Flamal\u0131.`;if(r.format==="ends_with")return`F\xE2sit metin: "${r.suffix}" ile bitmeli.`;if(r.format==="includes")return`F\xE2sit metin: "${r.includes}" ihtiv\xE2 etmeli.`;if(r.format==="regex")return`F\xE2sit metin: ${r.pattern} nak\u015F\u0131na uymal\u0131.`;return`F\xE2sit ${n[r.format]??v.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${v.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${v.keys.length>1?"s":""}: ${j(v.keys,", ")}`;case"invalid_key":return`${v.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${v.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function S6(){return{localeError:xj()}}var Nj=()=>{let i={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function $(v){return i[v]??null}let n={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},g={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${v.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${u} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`;return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${r} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${u} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":if(v.values.length===1)return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${W(v.values[0])} \u0648\u0627\u06CC`;return`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${j(v.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${v.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${r}${v.maximum.toString()} ${b.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`;return`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${v.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${r}${v.maximum.toString()} \u0648\u064A`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${v.origin} \u0628\u0627\u06CC\u062F ${r}${v.minimum.toString()} ${b.unit} \u0648\u0644\u0631\u064A`;return`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${v.origin} \u0628\u0627\u06CC\u062F ${r}${v.minimum.toString()} \u0648\u064A`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${r.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`;if(r.format==="ends_with")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${r.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`;if(r.format==="includes")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${r.includes}" \u0648\u0644\u0631\u064A`;if(r.format==="regex")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${r.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`;return`${n[r.format]??v.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${v.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${v.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${j(v.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${v.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${v.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function A6(){return{localeError:Nj()}}var Ej=()=>{let i={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function $(v){return i[v]??null}let n={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"},g={nan:"NaN",number:"liczba",array:"tablica"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${v.expected}, otrzymano ${u}`;return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${r}, otrzymano ${u}`}case"invalid_value":if(v.values.length===1)return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${W(v.values[0])}`;return`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${v.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${r}${v.maximum.toString()} ${b.unit??"element\xF3w"}`;return`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${v.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${v.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${r}${v.minimum.toString()} ${b.unit??"element\xF3w"}`;return`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${v.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${r.prefix}"`;if(r.format==="ends_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${r.suffix}"`;if(r.format==="includes")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${r.includes}"`;if(r.format==="regex")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${r.pattern}`;return`Nieprawid\u0142ow(y/a/e) ${n[r.format]??v.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${v.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${v.keys.length>1?"s":""}: ${j(v.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${v.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${v.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function B6(){return{localeError:Ej()}}var tj=()=>{let i={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function $(v){return i[v]??null}let n={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},g={nan:"NaN",number:"n\xFAmero",null:"nulo"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Tipo inv\xE1lido: esperado instanceof ${v.expected}, recebido ${u}`;return`Tipo inv\xE1lido: esperado ${r}, recebido ${u}`}case"invalid_value":if(v.values.length===1)return`Entrada inv\xE1lida: esperado ${W(v.values[0])}`;return`Op\xE7\xE3o inv\xE1lida: esperada uma das ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Muito grande: esperado que ${v.origin??"valor"} tivesse ${r}${v.maximum.toString()} ${b.unit??"elementos"}`;return`Muito grande: esperado que ${v.origin??"valor"} fosse ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Muito pequeno: esperado que ${v.origin} tivesse ${r}${v.minimum.toString()} ${b.unit}`;return`Muito pequeno: esperado que ${v.origin} fosse ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Texto inv\xE1lido: deve come\xE7ar com "${r.prefix}"`;if(r.format==="ends_with")return`Texto inv\xE1lido: deve terminar com "${r.suffix}"`;if(r.format==="includes")return`Texto inv\xE1lido: deve incluir "${r.includes}"`;if(r.format==="regex")return`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${r.pattern}`;return`${n[r.format]??v.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${v.divisor}`;case"unrecognized_keys":return`Chave${v.keys.length>1?"s":""} desconhecida${v.keys.length>1?"s":""}: ${j(v.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${v.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${v.origin}`;default:return"Campo inv\xE1lido"}}};function l6(){return{localeError:tj()}}var cj=()=>{let i={string:{unit:"caractere",verb:"s\u0103 aib\u0103"},file:{unit:"octe\u021Bi",verb:"s\u0103 aib\u0103"},array:{unit:"elemente",verb:"s\u0103 aib\u0103"},set:{unit:"elemente",verb:"s\u0103 aib\u0103"},map:{unit:"intr\u0103ri",verb:"s\u0103 aib\u0103"}};function $(v){return i[v]??null}let n={regex:"intrare",email:"adres\u0103 de email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dat\u0103 \u0219i or\u0103 ISO",date:"dat\u0103 ISO",time:"or\u0103 ISO",duration:"durat\u0103 ISO",ipv4:"adres\u0103 IPv4",ipv6:"adres\u0103 IPv6",mac:"adres\u0103 MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"\u0219ir codat base64",base64url:"\u0219ir codat base64url",json_string:"\u0219ir JSON",e164:"num\u0103r E.164",jwt:"JWT",template_literal:"intrare"},g={nan:"NaN",string:"\u0219ir",number:"num\u0103r",boolean:"boolean",function:"func\u021Bie",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"num\u0103r mare",void:"void",never:"never",map:"hart\u0103",set:"set"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;return`Intrare invalid\u0103: a\u0219teptat ${r}, primit ${u}`}case"invalid_value":if(v.values.length===1)return`Intrare invalid\u0103: a\u0219teptat ${W(v.values[0])}`;return`Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Prea mare: a\u0219teptat ca ${v.origin??"valoarea"} ${b.verb} ${r}${v.maximum.toString()} ${b.unit??"elemente"}`;return`Prea mare: a\u0219teptat ca ${v.origin??"valoarea"} s\u0103 fie ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Prea mic: a\u0219teptat ca ${v.origin} ${b.verb} ${r}${v.minimum.toString()} ${b.unit}`;return`Prea mic: a\u0219teptat ca ${v.origin} s\u0103 fie ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u0218ir invalid: trebuie s\u0103 \xEEnceap\u0103 cu "${r.prefix}"`;if(r.format==="ends_with")return`\u0218ir invalid: trebuie s\u0103 se termine cu "${r.suffix}"`;if(r.format==="includes")return`\u0218ir invalid: trebuie s\u0103 includ\u0103 "${r.includes}"`;if(r.format==="regex")return`\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${r.pattern}`;return`Format invalid: ${n[r.format]??v.format}`}case"not_multiple_of":return`Num\u0103r invalid: trebuie s\u0103 fie multiplu de ${v.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${j(v.keys,", ")}`;case"invalid_key":return`Cheie invalid\u0103 \xEEn ${v.origin}`;case"invalid_union":return"Intrare invalid\u0103";case"invalid_element":return`Valoare invalid\u0103 \xEEn ${v.origin}`;default:return"Intrare invalid\u0103"}}};function L6(){return{localeError:cj()}}function F1(i,$,n,g){let v=Math.abs(i),r=v%10,b=v%100;if(b>=11&&b<=19)return g;if(r===1)return $;if(r>=2&&r<=4)return n;return g}var Cj=()=>{let i={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function $(v){return i[v]??null}let n={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},g={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${v.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${u}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${r}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${u}`}case"invalid_value":if(v.values.length===1)return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${W(v.values[0])}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b){let u=Number(v.maximum),U=F1(u,b.unit.one,b.unit.few,b.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${v.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${r}${v.maximum.toString()} ${U}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${v.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b){let u=Number(v.minimum),U=F1(u,b.unit.one,b.unit.few,b.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${v.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${r}${v.minimum.toString()} ${U}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${v.origin} \u0431\u0443\u0434\u0435\u0442 ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${r.prefix}"`;if(r.format==="ends_with")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${r.suffix}"`;if(r.format==="includes")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${r.includes}"`;if(r.format==="regex")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${r.pattern}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${n[r.format]??v.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${v.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${v.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${v.keys.length>1?"\u0438":""}: ${j(v.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${v.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${v.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function T6(){return{localeError:Cj()}}var Rj=()=>{let i={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function $(v){return i[v]??null}let n={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"},g={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Neveljaven vnos: pri\u010Dakovano instanceof ${v.expected}, prejeto ${u}`;return`Neveljaven vnos: pri\u010Dakovano ${r}, prejeto ${u}`}case"invalid_value":if(v.values.length===1)return`Neveljaven vnos: pri\u010Dakovano ${W(v.values[0])}`;return`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Preveliko: pri\u010Dakovano, da bo ${v.origin??"vrednost"} imelo ${r}${v.maximum.toString()} ${b.unit??"elementov"}`;return`Preveliko: pri\u010Dakovano, da bo ${v.origin??"vrednost"} ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Premajhno: pri\u010Dakovano, da bo ${v.origin} imelo ${r}${v.minimum.toString()} ${b.unit}`;return`Premajhno: pri\u010Dakovano, da bo ${v.origin} ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Neveljaven niz: mora se za\u010Deti z "${r.prefix}"`;if(r.format==="ends_with")return`Neveljaven niz: mora se kon\u010Dati z "${r.suffix}"`;if(r.format==="includes")return`Neveljaven niz: mora vsebovati "${r.includes}"`;if(r.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${r.pattern}`;return`Neveljaven ${n[r.format]??v.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${v.divisor}`;case"unrecognized_keys":return`Neprepoznan${v.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${j(v.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${v.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${v.origin}`;default:return"Neveljaven vnos"}}};function Z6(){return{localeError:Rj()}}var Fj=()=>{let i={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function $(v){return i[v]??null}let n={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},g={nan:"NaN",number:"antal",array:"lista"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${v.expected}, fick ${u}`;return`Ogiltig inmatning: f\xF6rv\xE4ntat ${r}, fick ${u}`}case"invalid_value":if(v.values.length===1)return`Ogiltig inmatning: f\xF6rv\xE4ntat ${W(v.values[0])}`;return`Ogiltigt val: f\xF6rv\xE4ntade en av ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`F\xF6r stor(t): f\xF6rv\xE4ntade ${v.origin??"v\xE4rdet"} att ha ${r}${v.maximum.toString()} ${b.unit??"element"}`;return`F\xF6r stor(t): f\xF6rv\xE4ntat ${v.origin??"v\xE4rdet"} att ha ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`F\xF6r lite(t): f\xF6rv\xE4ntade ${v.origin??"v\xE4rdet"} att ha ${r}${v.minimum.toString()} ${b.unit}`;return`F\xF6r lite(t): f\xF6rv\xE4ntade ${v.origin??"v\xE4rdet"} att ha ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${r.prefix}"`;if(r.format==="ends_with")return`Ogiltig str\xE4ng: m\xE5ste sluta med "${r.suffix}"`;if(r.format==="includes")return`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${r.includes}"`;if(r.format==="regex")return`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${r.pattern}"`;return`Ogiltig(t) ${n[r.format]??v.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${v.divisor}`;case"unrecognized_keys":return`${v.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${j(v.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${v.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${v.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function q6(){return{localeError:Fj()}}var oj=()=>{let i={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function $(v){return i[v]??null}let n={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"},g={nan:"NaN",number:"\u0B8E\u0BA3\u0BCD",array:"\u0B85\u0BA3\u0BBF",null:"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${v.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${u}`;return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${u}`}case"invalid_value":if(v.values.length===1)return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${W(v.values[0])}`;return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${j(v.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${v.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${r}${v.maximum.toString()} ${b.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${v.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${r}${v.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${v.origin} ${r}${v.minimum.toString()} ${b.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${v.origin} ${r}${v.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${r.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(r.format==="ends_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${r.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(r.format==="includes")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${r.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(r.format==="regex")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${r.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${n[r.format]??v.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${v.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${v.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${j(v.keys,", ")}`;case"invalid_key":return`${v.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${v.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function M6(){return{localeError:oj()}}var mj=()=>{let i={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function $(v){return i[v]??null}let n={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},g={nan:"NaN",number:"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02",array:"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)",null:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${v.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${u}`;return`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${r} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${u}`}case"invalid_value":if(v.values.length===1)return`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${W(v.values[0])}`;return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",b=$(v.origin);if(b)return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${v.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${r} ${v.maximum.toString()} ${b.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`;return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${v.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${r} ${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",b=$(v.origin);if(b)return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${v.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${r} ${v.minimum.toString()} ${b.unit}`;return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${v.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${r} ${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${r.prefix}"`;if(r.format==="ends_with")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${r.suffix}"`;if(r.format==="includes")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${r.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`;if(r.format==="regex")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${r.pattern}`;return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${n[r.format]??v.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${v.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${j(v.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${v.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${v.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function x6(){return{localeError:mj()}}var yj=()=>{let i={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function $(v){return i[v]??null}let n={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${v.expected}, al\u0131nan ${u}`;return`Ge\xE7ersiz de\u011Fer: beklenen ${r}, al\u0131nan ${u}`}case"invalid_value":if(v.values.length===1)return`Ge\xE7ersiz de\u011Fer: beklenen ${W(v.values[0])}`;return`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\xC7ok b\xFCy\xFCk: beklenen ${v.origin??"de\u011Fer"} ${r}${v.maximum.toString()} ${b.unit??"\xF6\u011Fe"}`;return`\xC7ok b\xFCy\xFCk: beklenen ${v.origin??"de\u011Fer"} ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\xC7ok k\xFC\xE7\xFCk: beklenen ${v.origin} ${r}${v.minimum.toString()} ${b.unit}`;return`\xC7ok k\xFC\xE7\xFCk: beklenen ${v.origin} ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Ge\xE7ersiz metin: "${r.prefix}" ile ba\u015Flamal\u0131`;if(r.format==="ends_with")return`Ge\xE7ersiz metin: "${r.suffix}" ile bitmeli`;if(r.format==="includes")return`Ge\xE7ersiz metin: "${r.includes}" i\xE7ermeli`;if(r.format==="regex")return`Ge\xE7ersiz metin: ${r.pattern} desenine uymal\u0131`;return`Ge\xE7ersiz ${n[r.format]??v.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${v.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${v.keys.length>1?"lar":""}: ${j(v.keys,", ")}`;case"invalid_key":return`${v.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${v.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function N6(){return{localeError:yj()}}var hj=()=>{let i={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function $(v){return i[v]??null}let n={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},g={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${v.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${u}`;return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${r}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${u}`}case"invalid_value":if(v.values.length===1)return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${W(v.values[0])}`;return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${v.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${b.verb} ${r}${v.maximum.toString()} ${b.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`;return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${v.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${v.origin} ${b.verb} ${r}${v.minimum.toString()} ${b.unit}`;return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${v.origin} \u0431\u0443\u0434\u0435 ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${r.prefix}"`;if(r.format==="ends_with")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${r.suffix}"`;if(r.format==="includes")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${r.includes}"`;if(r.format==="regex")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${r.pattern}`;return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${n[r.format]??v.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${v.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${v.keys.length>1?"\u0456":""}: ${j(v.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${v.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${v.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function zv(){return{localeError:hj()}}function E6(){return zv()}var dj=()=>{let i={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function $(v){return i[v]??null}let n={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},g={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${v.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${u} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${r} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${u} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":if(v.values.length===1)return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${W(v.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;return`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${j(v.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u0628\u06C1\u062A \u0628\u0691\u0627: ${v.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${r}${v.maximum.toString()} ${b.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;return`\u0628\u06C1\u062A \u0628\u0691\u0627: ${v.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${r}${v.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${v.origin} \u06A9\u06D2 ${r}${v.minimum.toString()} ${b.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${v.origin} \u06A9\u0627 ${r}${v.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${r.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(r.format==="ends_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${r.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(r.format==="includes")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${r.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(r.format==="regex")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${r.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;return`\u063A\u0644\u0637 ${n[r.format]??v.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${v.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${v.keys.length>1?"\u0632":""}: ${j(v.keys,"\u060C ")}`;case"invalid_key":return`${v.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${v.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function t6(){return{localeError:dj()}}var aj=()=>{let i={string:{unit:"belgi",verb:"bo\u2018lishi kerak"},file:{unit:"bayt",verb:"bo\u2018lishi kerak"},array:{unit:"element",verb:"bo\u2018lishi kerak"},set:{unit:"element",verb:"bo\u2018lishi kerak"},map:{unit:"yozuv",verb:"bo\u2018lishi kerak"}};function $(v){return i[v]??null}let n={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},g={nan:"NaN",number:"raqam",array:"massiv"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${v.expected}, qabul qilingan ${u}`;return`Noto\u2018g\u2018ri kirish: kutilgan ${r}, qabul qilingan ${u}`}case"invalid_value":if(v.values.length===1)return`Noto\u2018g\u2018ri kirish: kutilgan ${W(v.values[0])}`;return`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Juda katta: kutilgan ${v.origin??"qiymat"} ${r}${v.maximum.toString()} ${b.unit} ${b.verb}`;return`Juda katta: kutilgan ${v.origin??"qiymat"} ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Juda kichik: kutilgan ${v.origin} ${r}${v.minimum.toString()} ${b.unit} ${b.verb}`;return`Juda kichik: kutilgan ${v.origin} ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Noto\u2018g\u2018ri satr: "${r.prefix}" bilan boshlanishi kerak`;if(r.format==="ends_with")return`Noto\u2018g\u2018ri satr: "${r.suffix}" bilan tugashi kerak`;if(r.format==="includes")return`Noto\u2018g\u2018ri satr: "${r.includes}" ni o\u2018z ichiga olishi kerak`;if(r.format==="regex")return`Noto\u2018g\u2018ri satr: ${r.pattern} shabloniga mos kelishi kerak`;return`Noto\u2018g\u2018ri ${n[r.format]??v.format}`}case"not_multiple_of":return`Noto\u2018g\u2018ri raqam: ${v.divisor} ning karralisi bo\u2018lishi kerak`;case"unrecognized_keys":return`Noma\u2019lum kalit${v.keys.length>1?"lar":""}: ${j(v.keys,", ")}`;case"invalid_key":return`${v.origin} dagi kalit noto\u2018g\u2018ri`;case"invalid_union":return"Noto\u2018g\u2018ri kirish";case"invalid_element":return`${v.origin} da noto\u2018g\u2018ri qiymat`;default:return"Noto\u2018g\u2018ri kirish"}}};function c6(){return{localeError:aj()}}var pj=()=>{let i={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function $(v){return i[v]??null}let n={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},g={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${v.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${u}`;return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${r}, nh\u1EADn \u0111\u01B0\u1EE3c ${u}`}case"invalid_value":if(v.values.length===1)return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${W(v.values[0])}`;return`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${v.origin??"gi\xE1 tr\u1ECB"} ${b.verb} ${r}${v.maximum.toString()} ${b.unit??"ph\u1EA7n t\u1EED"}`;return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${v.origin??"gi\xE1 tr\u1ECB"} ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${v.origin} ${b.verb} ${r}${v.minimum.toString()} ${b.unit}`;return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${v.origin} ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${r.prefix}"`;if(r.format==="ends_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${r.suffix}"`;if(r.format==="includes")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${r.includes}"`;if(r.format==="regex")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${r.pattern}`;return`${n[r.format]??v.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${v.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${j(v.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${v.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${v.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function C6(){return{localeError:pj()}}var ej=()=>{let i={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function $(v){return i[v]??null}let n={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"},g={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${v.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${u}`;return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${r}\uFF0C\u5B9E\u9645\u63A5\u6536 ${u}`}case"invalid_value":if(v.values.length===1)return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${W(v.values[0])}`;return`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${v.origin??"\u503C"} ${r}${v.maximum.toString()} ${b.unit??"\u4E2A\u5143\u7D20"}`;return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${v.origin??"\u503C"} ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${v.origin} ${r}${v.minimum.toString()} ${b.unit}`;return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${v.origin} ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${r.prefix}" \u5F00\u5934`;if(r.format==="ends_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${r.suffix}" \u7ED3\u5C3E`;if(r.format==="includes")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${r.includes}"`;if(r.format==="regex")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${r.pattern}`;return`\u65E0\u6548${n[r.format]??v.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${v.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${j(v.keys,", ")}`;case"invalid_key":return`${v.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${v.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function R6(){return{localeError:ej()}}var sj=()=>{let i={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function $(v){return i[v]??null}let n={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"},g={nan:"NaN"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${v.expected}\uFF0C\u4F46\u6536\u5230 ${u}`;return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${r}\uFF0C\u4F46\u6536\u5230 ${u}`}case"invalid_value":if(v.values.length===1)return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${W(v.values[0])}`;return`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${v.origin??"\u503C"} \u61C9\u70BA ${r}${v.maximum.toString()} ${b.unit??"\u500B\u5143\u7D20"}`;return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${v.origin??"\u503C"} \u61C9\u70BA ${r}${v.maximum.toString()}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${v.origin} \u61C9\u70BA ${r}${v.minimum.toString()} ${b.unit}`;return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${v.origin} \u61C9\u70BA ${r}${v.minimum.toString()}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${r.prefix}" \u958B\u982D`;if(r.format==="ends_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${r.suffix}" \u7D50\u5C3E`;if(r.format==="includes")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${r.includes}"`;if(r.format==="regex")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${r.pattern}`;return`\u7121\u6548\u7684 ${n[r.format]??v.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${v.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${v.keys.length>1?"\u5011":""}\uFF1A${j(v.keys,"\u3001")}`;case"invalid_key":return`${v.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${v.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function F6(){return{localeError:sj()}}var iO=()=>{let i={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function $(v){return i[v]??null}let n={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},g={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return(v)=>{switch(v.code){case"invalid_type":{let r=g[v.expected]??v.expected,b=V(v.input),u=g[b]??b;if(/^[A-Z]/.test(v.expected))return`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${v.expected}, \xE0m\u1ECD\u0300 a r\xED ${u}`;return`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${r}, \xE0m\u1ECD\u0300 a r\xED ${u}`}case"invalid_value":if(v.values.length===1)return`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${W(v.values[0])}`;return`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${j(v.values,"|")}`;case"too_big":{let r=v.inclusive?"<=":"<",b=$(v.origin);if(b)return`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${v.origin??"iye"} ${b.verb} ${r}${v.maximum} ${b.unit}`;return`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${r}${v.maximum}`}case"too_small":{let r=v.inclusive?">=":">",b=$(v.origin);if(b)return`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${v.origin} ${b.verb} ${r}${v.minimum} ${b.unit}`;return`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${r}${v.minimum}`}case"invalid_format":{let r=v;if(r.format==="starts_with")return`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${r.prefix}"`;if(r.format==="ends_with")return`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${r.suffix}"`;if(r.format==="includes")return`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${r.includes}"`;if(r.format==="regex")return`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${r.pattern}`;return`A\u1E63\xEC\u1E63e: ${n[r.format]??v.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${v.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${j(v.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${v.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${v.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}};function o6(){return{localeError:iO()}}var o1,m6=Symbol("ZodOutput"),y6=Symbol("ZodInput");class h6{constructor(){this._map=new WeakMap,this._idmap=new Map}add(i,...$){let n=$[0];if(this._map.set(i,n),n&&typeof n==="object"&&"id"in n)this._idmap.set(n.id,i);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(i){let $=this._map.get(i);if($&&typeof $==="object"&&"id"in $)this._idmap.delete($.id);return this._map.delete(i),this}get(i){let $=i._zod.parent;if($){let n={...this.get($)??{}};delete n.id;let g={...n,...this._map.get(i)};return Object.keys(g).length?g:void 0}return this._map.get(i)}has(i){return this._map.has(i)}}function yn(){return new h6}(o1=globalThis).__zod_globalRegistry??(o1.__zod_globalRegistry=yn());var m=globalThis.__zod_globalRegistry;function d6(i,$){return new i({type:"string",...f($)})}function a6(i,$){return new i({type:"string",coerce:!0,...f($)})}function hn(i,$){return new i({type:"string",format:"email",check:"string_format",abort:!1,...f($)})}function Av(i,$){return new i({type:"string",format:"guid",check:"string_format",abort:!1,...f($)})}function dn(i,$){return new i({type:"string",format:"uuid",check:"string_format",abort:!1,...f($)})}function an(i,$){return new i({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...f($)})}function pn(i,$){return new i({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...f($)})}function en(i,$){return new i({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...f($)})}function Bv(i,$){return new i({type:"string",format:"url",check:"string_format",abort:!1,...f($)})}function sn(i,$){return new i({type:"string",format:"emoji",check:"string_format",abort:!1,...f($)})}function ig(i,$){return new i({type:"string",format:"nanoid",check:"string_format",abort:!1,...f($)})}function $g(i,$){return new i({type:"string",format:"cuid",check:"string_format",abort:!1,...f($)})}function vg(i,$){return new i({type:"string",format:"cuid2",check:"string_format",abort:!1,...f($)})}function ng(i,$){return new i({type:"string",format:"ulid",check:"string_format",abort:!1,...f($)})}function gg(i,$){return new i({type:"string",format:"xid",check:"string_format",abort:!1,...f($)})}function rg(i,$){return new i({type:"string",format:"ksuid",check:"string_format",abort:!1,...f($)})}function bg(i,$){return new i({type:"string",format:"ipv4",check:"string_format",abort:!1,...f($)})}function ug(i,$){return new i({type:"string",format:"ipv6",check:"string_format",abort:!1,...f($)})}function p6(i,$){return new i({type:"string",format:"mac",check:"string_format",abort:!1,...f($)})}function Ug(i,$){return new i({type:"string",format:"cidrv4",check:"string_format",abort:!1,...f($)})}function Ig(i,$){return new i({type:"string",format:"cidrv6",check:"string_format",abort:!1,...f($)})}function _g(i,$){return new i({type:"string",format:"base64",check:"string_format",abort:!1,...f($)})}function Dg(i,$){return new i({type:"string",format:"base64url",check:"string_format",abort:!1,...f($)})}function kg(i,$){return new i({type:"string",format:"e164",check:"string_format",abort:!1,...f($)})}function wg(i,$){return new i({type:"string",format:"jwt",check:"string_format",abort:!1,...f($)})}var e6={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function s6(i,$){return new i({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...f($)})}function iu(i,$){return new i({type:"string",format:"date",check:"string_format",...f($)})}function $u(i,$){return new i({type:"string",format:"time",check:"string_format",precision:null,...f($)})}function vu(i,$){return new i({type:"string",format:"duration",check:"string_format",...f($)})}function nu(i,$){return new i({type:"number",checks:[],...f($)})}function gu(i,$){return new i({type:"number",coerce:!0,checks:[],...f($)})}function ru(i,$){return new i({type:"number",check:"number_format",abort:!1,format:"safeint",...f($)})}function bu(i,$){return new i({type:"number",check:"number_format",abort:!1,format:"float32",...f($)})}function uu(i,$){return new i({type:"number",check:"number_format",abort:!1,format:"float64",...f($)})}function Uu(i,$){return new i({type:"number",check:"number_format",abort:!1,format:"int32",...f($)})}function Iu(i,$){return new i({type:"number",check:"number_format",abort:!1,format:"uint32",...f($)})}function _u(i,$){return new i({type:"boolean",...f($)})}function Du(i,$){return new i({type:"boolean",coerce:!0,...f($)})}function ku(i,$){return new i({type:"bigint",...f($)})}function wu(i,$){return new i({type:"bigint",coerce:!0,...f($)})}function ju(i,$){return new i({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...f($)})}function Ou(i,$){return new i({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...f($)})}function Ju(i,$){return new i({type:"symbol",...f($)})}function Pu(i,$){return new i({type:"undefined",...f($)})}function Wu(i,$){return new i({type:"null",...f($)})}function Vu(i){return new i({type:"any"})}function Xu(i){return new i({type:"unknown"})}function fu(i,$){return new i({type:"never",...f($)})}function Qu(i,$){return new i({type:"void",...f($)})}function Ku(i,$){return new i({type:"date",...f($)})}function Gu(i,$){return new i({type:"date",coerce:!0,...f($)})}function Yu(i,$){return new i({type:"nan",...f($)})}function Ji(i,$){return new qn({check:"less_than",...f($),value:i,inclusive:!1})}function bi(i,$){return new qn({check:"less_than",...f($),value:i,inclusive:!0})}function Pi(i,$){return new Mn({check:"greater_than",...f($),value:i,inclusive:!1})}function e(i,$){return new Mn({check:"greater_than",...f($),value:i,inclusive:!0})}function jg(i){return Pi(0,i)}function Og(i){return Ji(0,i)}function Jg(i){return bi(0,i)}function Pg(i){return e(0,i)}function oi(i,$){return new Qb({check:"multiple_of",...f($),value:i})}function mi(i,$){return new Yb({check:"max_size",...f($),maximum:i})}function Wi(i,$){return new Hb({check:"min_size",...f($),minimum:i})}function u$(i,$){return new zb({check:"size_equals",...f($),size:i})}function U$(i,$){return new Sb({check:"max_length",...f($),maximum:i})}function zi(i,$){return new Ab({check:"min_length",...f($),minimum:i})}function I$(i,$){return new Bb({check:"length_equals",...f($),length:i})}function A$(i,$){return new lb({check:"string_format",format:"regex",...f($),pattern:i})}function B$(i){return new Lb({check:"string_format",format:"lowercase",...f(i)})}function l$(i){return new Tb({check:"string_format",format:"uppercase",...f(i)})}function L$(i,$){return new Zb({check:"string_format",format:"includes",...f($),includes:i})}function T$(i,$){return new qb({check:"string_format",format:"starts_with",...f($),prefix:i})}function Z$(i,$){return new Mb({check:"string_format",format:"ends_with",...f($),suffix:i})}function Wg(i,$,n){return new xb({check:"property",property:i,schema:$,...f(n)})}function q$(i,$){return new Nb({check:"mime_type",mime:i,...f($)})}function ki(i){return new Eb({check:"overwrite",tx:i})}function M$(i){return ki(($)=>$.normalize(i))}function x$(){return ki((i)=>i.trim())}function N$(){return ki((i)=>i.toLowerCase())}function E$(){return ki((i)=>i.toUpperCase())}function t$(){return ki((i)=>qr(i))}function Hu(i,$,n){return new i({type:"array",element:$,...f(n)})}function vO(i,$,n){return new i({type:"union",options:$,...f(n)})}function nO(i,$,n){return new i({type:"union",options:$,inclusive:!1,...f(n)})}function gO(i,$,n,g){return new i({type:"union",options:n,discriminator:$,...f(g)})}function rO(i,$,n){return new i({type:"intersection",left:$,right:n})}function bO(i,$,n,g){let v=n instanceof Y;return new i({type:"tuple",items:$,rest:v?n:null,...f(v?g:n)})}function uO(i,$,n,g){return new i({type:"record",keyType:$,valueType:n,...f(g)})}function UO(i,$,n,g){return new i({type:"map",keyType:$,valueType:n,...f(g)})}function IO(i,$,n){return new i({type:"set",valueType:$,...f(n)})}function _O(i,$,n){let g=Array.isArray($)?Object.fromEntries($.map((v)=>[v,v])):$;return new i({type:"enum",entries:g,...f(n)})}function DO(i,$,n){return new i({type:"enum",entries:$,...f(n)})}function kO(i,$,n){return new i({type:"literal",values:Array.isArray($)?$:[$],...f(n)})}function zu(i,$){return new i({type:"file",...f($)})}function wO(i,$){return new i({type:"transform",transform:$})}function jO(i,$){return new i({type:"optional",innerType:$})}function OO(i,$){return new i({type:"nullable",innerType:$})}function JO(i,$,n){return new i({type:"default",innerType:$,get defaultValue(){return typeof n==="function"?n():xr(n)}})}function PO(i,$,n){return new i({type:"nonoptional",innerType:$,...f(n)})}function WO(i,$){return new i({type:"success",innerType:$})}function VO(i,$,n){return new i({type:"catch",innerType:$,catchValue:typeof n==="function"?n:()=>n})}function XO(i,$,n){return new i({type:"pipe",in:$,out:n})}function fO(i,$){return new i({type:"readonly",innerType:$})}function QO(i,$,n){return new i({type:"template_literal",parts:$,...f(n)})}function KO(i,$){return new i({type:"lazy",getter:$})}function GO(i,$){return new i({type:"promise",innerType:$})}function Su(i,$,n){let g=f(n);return g.abort??(g.abort=!0),new i({type:"custom",check:"custom",fn:$,...g})}function Au(i,$,n){return new i({type:"custom",check:"custom",fn:$,...f(n)})}function Bu(i,$){let n=m1((g)=>{return g.addIssue=(v)=>{if(typeof v==="string")g.issues.push(Q$(v,g.value,n._zod.def));else{let r=v;if(r.fatal)r.continue=!1;r.code??(r.code="custom"),r.input??(r.input=g.value),r.inst??(r.inst=n),r.continue??(r.continue=!n._zod.def.abort),g.issues.push(Q$(r))}},i(g.value,g)},$);return n}function m1(i,$){let n=new M({check:"custom",...f($)});return n._zod.check=i,n}function lu(i){let $=new M({check:"describe"});return $._zod.onattach=[(n)=>{let g=m.get(n)??{};m.add(n,{...g,description:i})}],$._zod.check=()=>{},$}function Lu(i){let $=new M({check:"meta"});return $._zod.onattach=[(n)=>{let g=m.get(n)??{};m.add(n,{...g,...i})}],$._zod.check=()=>{},$}function Tu(i,$){let n=f($),g=n.truthy??["true","1","yes","on","y","enabled"],v=n.falsy??["false","0","no","off","n","disabled"];if(n.case!=="sensitive")g=g.map((J)=>typeof J==="string"?J.toLowerCase():J),v=v.map((J)=>typeof J==="string"?J.toLowerCase():J);let r=new Set(g),b=new Set(v),u=i.Codec??Kv,U=i.Boolean??fv,_=new(i.String??b$)({type:"string",error:n.error}),k=new U({type:"boolean",error:n.error}),O=new u({type:"pipe",in:_,out:k,transform:(J,Q)=>{let A=J;if(n.case!=="sensitive")A=A.toLowerCase();if(r.has(A))return!0;else if(b.has(A))return!1;else return Q.issues.push({code:"invalid_value",expected:"stringbool",values:[...r,...b],input:Q.value,inst:O,continue:!1}),{}},reverseTransform:(J,Q)=>{if(J===!0)return g[0]||"true";else return v[0]||"false"},error:n.error});return O}function c$(i,$,n,g={}){let v=f(g),r={...f(g),check:"string_format",type:"string",format:$,fn:typeof n==="function"?n:(u)=>n.test(u),...v};if(n instanceof RegExp)r.pattern=n;return new i(r)}function yi(i){let $=i?.target??"draft-2020-12";if($==="draft-4")$="draft-04";if($==="draft-7")$="draft-07";return{processors:i.processors??{},metadataRegistry:i?.metadata??m,target:$,unrepresentable:i?.unrepresentable??"throw",override:i?.override??(()=>{}),io:i?.io??"output",counter:0,seen:new Map,cycles:i?.cycles??"ref",reused:i?.reused??"inline",external:i?.external??void 0}}function l(i,$,n={path:[],schemaPath:[]}){var g;let v=i._zod.def,r=$.seen.get(i);if(r){if(r.count++,n.schemaPath.includes(i))r.cycle=n.path;return r.schema}let b={schema:{},count:1,cycle:void 0,path:n.path};$.seen.set(i,b);let u=i._zod.toJSONSchema?.();if(u)b.schema=u;else{let _={...n,schemaPath:[...n.schemaPath,i],path:n.path};if(i._zod.processJSONSchema)i._zod.processJSONSchema($,b.schema,_);else{let O=b.schema,J=$.processors[v.type];if(!J)throw Error(`[toJSONSchema]: Non-representable type encountered: ${v.type}`);J(i,$,O,_)}let k=i._zod.parent;if(k){if(!b.ref)b.ref=k;l(k,$,_),$.seen.get(k).isParent=!0}}let U=$.metadataRegistry.get(i);if(U)Object.assign(b.schema,U);if($.io==="input"&&s(i))delete b.schema.examples,delete b.schema.default;if($.io==="input"&&"_prefault"in b.schema)(g=b.schema).default??(g.default=b.schema._prefault);return delete b.schema._prefault,$.seen.get(i).schema}function hi(i,$){let n=i.seen.get($);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let g=new Map;for(let b of i.seen.entries()){let u=i.metadataRegistry.get(b[0])?.id;if(u){let U=g.get(u);if(U&&U!==b[0])throw Error(`Duplicate schema id "${u}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);g.set(u,b[0])}}let v=(b)=>{let u=i.target==="draft-2020-12"?"$defs":"definitions";if(i.external){let k=i.external.registry.get(b[0])?.id,O=i.external.uri??((Q)=>Q);if(k)return{ref:O(k)};let J=b[1].defId??b[1].schema.id??`schema${i.counter++}`;return b[1].defId=J,{defId:J,ref:`${O("__shared")}#/${u}/${J}`}}if(b[1]===n)return{ref:"#"};let I=`${"#"}/${u}/`,_=b[1].schema.id??`__schema${i.counter++}`;return{defId:_,ref:I+_}},r=(b)=>{if(b[1].schema.$ref)return;let u=b[1],{ref:U,defId:I}=v(b);if(u.def={...u.schema},I)u.defId=I;let _=u.schema;for(let k in _)delete _[k];_.$ref=U};if(i.cycles==="throw")for(let b of i.seen.entries()){let u=b[1];if(u.cycle)throw Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
66
+
67
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let b of i.seen.entries()){let u=b[1];if($===b[0]){r(b);continue}if(i.external){let I=i.external.registry.get(b[0])?.id;if($!==b[0]&&I){r(b);continue}}if(i.metadataRegistry.get(b[0])?.id){r(b);continue}if(u.cycle){r(b);continue}if(u.count>1){if(i.reused==="ref"){r(b);continue}}}}function di(i,$){let n=i.seen.get($);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let g=(u)=>{let U=i.seen.get(u);if(U.ref===null)return;let I=U.def??U.schema,_={...I},k=U.ref;if(U.ref=null,k){g(k);let J=i.seen.get(k),Q=J.schema;if(Q.$ref&&(i.target==="draft-07"||i.target==="draft-04"||i.target==="openapi-3.0"))I.allOf=I.allOf??[],I.allOf.push(Q);else Object.assign(I,Q);if(Object.assign(I,_),u._zod.parent===k)for(let z in I){if(z==="$ref"||z==="allOf")continue;if(!(z in _))delete I[z]}if(Q.$ref&&J.def)for(let z in I){if(z==="$ref"||z==="allOf")continue;if(z in J.def&&JSON.stringify(I[z])===JSON.stringify(J.def[z]))delete I[z]}}let O=u._zod.parent;if(O&&O!==k){g(O);let J=i.seen.get(O);if(J?.schema.$ref){if(I.$ref=J.schema.$ref,J.def)for(let Q in I){if(Q==="$ref"||Q==="allOf")continue;if(Q in J.def&&JSON.stringify(I[Q])===JSON.stringify(J.def[Q]))delete I[Q]}}}i.override({zodSchema:u,jsonSchema:I,path:U.path??[]})};for(let u of[...i.seen.entries()].reverse())g(u[0]);let v={};if(i.target==="draft-2020-12")v.$schema="https://json-schema.org/draft/2020-12/schema";else if(i.target==="draft-07")v.$schema="http://json-schema.org/draft-07/schema#";else if(i.target==="draft-04")v.$schema="http://json-schema.org/draft-04/schema#";else if(i.target==="openapi-3.0");if(i.external?.uri){let u=i.external.registry.get($)?.id;if(!u)throw Error("Schema is missing an `id` property");v.$id=i.external.uri(u)}Object.assign(v,n.def??n.schema);let r=i.metadataRegistry.get($)?.id;if(r!==void 0&&v.id===r)delete v.id;let b=i.external?.defs??{};for(let u of i.seen.entries()){let U=u[1];if(U.def&&U.defId){if(U.def.id===U.defId)delete U.def.id;b[U.defId]=U.def}}if(i.external);else if(Object.keys(b).length>0)if(i.target==="draft-2020-12")v.$defs=b;else v.definitions=b;try{let u=JSON.parse(JSON.stringify(v));return Object.defineProperty(u,"~standard",{value:{...$["~standard"],jsonSchema:{input:C$($,"input",i.processors),output:C$($,"output",i.processors)}},enumerable:!1,writable:!1}),u}catch(u){throw Error("Error converting schema to JSON.")}}function s(i,$){let n=$??{seen:new Set};if(n.seen.has(i))return!1;n.seen.add(i);let g=i._zod.def;if(g.type==="transform")return!0;if(g.type==="array")return s(g.element,n);if(g.type==="set")return s(g.valueType,n);if(g.type==="lazy")return s(g.getter(),n);if(g.type==="promise"||g.type==="optional"||g.type==="nonoptional"||g.type==="nullable"||g.type==="readonly"||g.type==="default"||g.type==="prefault")return s(g.innerType,n);if(g.type==="intersection")return s(g.left,n)||s(g.right,n);if(g.type==="record"||g.type==="map")return s(g.keyType,n)||s(g.valueType,n);if(g.type==="pipe"){if(i._zod.traits.has("$ZodCodec"))return!0;return s(g.in,n)||s(g.out,n)}if(g.type==="object"){for(let v in g.shape)if(s(g.shape[v],n))return!0;return!1}if(g.type==="union"){for(let v of g.options)if(s(v,n))return!0;return!1}if(g.type==="tuple"){for(let v of g.items)if(s(v,n))return!0;if(g.rest&&s(g.rest,n))return!0;return!1}return!1}var Zu=(i,$={})=>(n)=>{let g=yi({...n,processors:$});return l(i,g),hi(g,i),di(g,i)},C$=(i,$,n={})=>(g)=>{let{libraryOptions:v,target:r}=g??{},b=yi({...v??{},target:r,io:$,processors:n});return l(i,b),hi(b,i),di(b,i)};var YO={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},qu=(i,$,n,g)=>{let v=n;v.type="string";let{minimum:r,maximum:b,format:u,patterns:U,contentEncoding:I}=i._zod.bag;if(typeof r==="number")v.minLength=r;if(typeof b==="number")v.maxLength=b;if(u){if(v.format=YO[u]??u,v.format==="")delete v.format;if(u==="time")delete v.format}if(I)v.contentEncoding=I;if(U&&U.size>0){let _=[...U];if(_.length===1)v.pattern=_[0].source;else if(_.length>1)v.allOf=[..._.map((k)=>({...$.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"?{type:"string"}:{},pattern:k.source}))]}},Mu=(i,$,n,g)=>{let v=n,{minimum:r,maximum:b,format:u,multipleOf:U,exclusiveMaximum:I,exclusiveMinimum:_}=i._zod.bag;if(typeof u==="string"&&u.includes("int"))v.type="integer";else v.type="number";let k=typeof _==="number"&&_>=(r??Number.NEGATIVE_INFINITY),O=typeof I==="number"&&I<=(b??Number.POSITIVE_INFINITY),J=$.target==="draft-04"||$.target==="openapi-3.0";if(k)if(J)v.minimum=_,v.exclusiveMinimum=!0;else v.exclusiveMinimum=_;else if(typeof r==="number")v.minimum=r;if(O)if(J)v.maximum=I,v.exclusiveMaximum=!0;else v.exclusiveMaximum=I;else if(typeof b==="number")v.maximum=b;if(typeof U==="number")v.multipleOf=U},xu=(i,$,n,g)=>{n.type="boolean"},Nu=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},Eu=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},tu=(i,$,n,g)=>{if($.target==="openapi-3.0")n.type="string",n.nullable=!0,n.enum=[null];else n.type="null"},cu=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},Cu=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},Ru=(i,$,n,g)=>{n.not={}},Fu=(i,$,n,g)=>{},ou=(i,$,n,g)=>{},mu=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},yu=(i,$,n,g)=>{let v=i._zod.def,r=_v(v.entries);if(r.every((b)=>typeof b==="number"))n.type="number";if(r.every((b)=>typeof b==="string"))n.type="string";n.enum=r},hu=(i,$,n,g)=>{let v=i._zod.def,r=[];for(let b of v.values)if(b===void 0){if($.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof b==="bigint")if($.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else r.push(Number(b));else r.push(b);if(r.length===0);else if(r.length===1){let b=r[0];if(n.type=b===null?"null":typeof b,$.target==="draft-04"||$.target==="openapi-3.0")n.enum=[b];else n.const=b}else{if(r.every((b)=>typeof b==="number"))n.type="number";if(r.every((b)=>typeof b==="string"))n.type="string";if(r.every((b)=>typeof b==="boolean"))n.type="boolean";if(r.every((b)=>b===null))n.type="null";n.enum=r}},du=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},au=(i,$,n,g)=>{let v=n,r=i._zod.pattern;if(!r)throw Error("Pattern not found in template literal");v.type="string",v.pattern=r.source},pu=(i,$,n,g)=>{let v=n,r={type:"string",format:"binary",contentEncoding:"binary"},{minimum:b,maximum:u,mime:U}=i._zod.bag;if(b!==void 0)r.minLength=b;if(u!==void 0)r.maxLength=u;if(U)if(U.length===1)r.contentMediaType=U[0],Object.assign(v,r);else Object.assign(v,r),v.anyOf=U.map((I)=>({contentMediaType:I}));else Object.assign(v,r)},eu=(i,$,n,g)=>{n.type="boolean"},su=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},iU=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},$U=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},vU=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},nU=(i,$,n,g)=>{if($.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},gU=(i,$,n,g)=>{let v=n,r=i._zod.def,{minimum:b,maximum:u}=i._zod.bag;if(typeof b==="number")v.minItems=b;if(typeof u==="number")v.maxItems=u;v.type="array",v.items=l(r.element,$,{...g,path:[...g.path,"items"]})},rU=(i,$,n,g)=>{let v=n,r=i._zod.def;v.type="object",v.properties={};let b=r.shape;for(let I in b)v.properties[I]=l(b[I],$,{...g,path:[...g.path,"properties",I]});let u=new Set(Object.keys(b)),U=new Set([...u].filter((I)=>{let _=r.shape[I]._zod;if($.io==="input")return _.optin===void 0;else return _.optout===void 0}));if(U.size>0)v.required=Array.from(U);if(r.catchall?._zod.def.type==="never")v.additionalProperties=!1;else if(!r.catchall){if($.io==="output")v.additionalProperties=!1}else if(r.catchall)v.additionalProperties=l(r.catchall,$,{...g,path:[...g.path,"additionalProperties"]})},Xg=(i,$,n,g)=>{let v=i._zod.def,r=v.inclusive===!1,b=v.options.map((u,U)=>l(u,$,{...g,path:[...g.path,r?"oneOf":"anyOf",U]}));if(r)n.oneOf=b;else n.anyOf=b},bU=(i,$,n,g)=>{let v=i._zod.def,r=l(v.left,$,{...g,path:[...g.path,"allOf",0]}),b=l(v.right,$,{...g,path:[...g.path,"allOf",1]}),u=(I)=>("allOf"in I)&&Object.keys(I).length===1,U=[...u(r)?r.allOf:[r],...u(b)?b.allOf:[b]];n.allOf=U},uU=(i,$,n,g)=>{let v=n,r=i._zod.def;v.type="array";let b=$.target==="draft-2020-12"?"prefixItems":"items",u=$.target==="draft-2020-12"?"items":$.target==="openapi-3.0"?"items":"additionalItems",U=r.items.map((O,J)=>l(O,$,{...g,path:[...g.path,b,J]})),I=r.rest?l(r.rest,$,{...g,path:[...g.path,u,...$.target==="openapi-3.0"?[r.items.length]:[]]}):null;if($.target==="draft-2020-12"){if(v.prefixItems=U,I)v.items=I}else if($.target==="openapi-3.0"){if(v.items={anyOf:U},I)v.items.anyOf.push(I);if(v.minItems=U.length,!I)v.maxItems=U.length}else if(v.items=U,I)v.additionalItems=I;let{minimum:_,maximum:k}=i._zod.bag;if(typeof _==="number")v.minItems=_;if(typeof k==="number")v.maxItems=k},UU=(i,$,n,g)=>{let v=n,r=i._zod.def;v.type="object";let b=r.keyType,U=b._zod.bag?.patterns;if(r.mode==="loose"&&U&&U.size>0){let _=l(r.valueType,$,{...g,path:[...g.path,"patternProperties","*"]});v.patternProperties={};for(let k of U)v.patternProperties[k.source]=_}else{if($.target==="draft-07"||$.target==="draft-2020-12")v.propertyNames=l(r.keyType,$,{...g,path:[...g.path,"propertyNames"]});v.additionalProperties=l(r.valueType,$,{...g,path:[...g.path,"additionalProperties"]})}let I=b._zod.values;if(I){let _=[...I].filter((k)=>typeof k==="string"||typeof k==="number");if(_.length>0)v.required=_}},IU=(i,$,n,g)=>{let v=i._zod.def,r=l(v.innerType,$,g),b=$.seen.get(i);if($.target==="openapi-3.0")b.ref=v.innerType,n.nullable=!0;else n.anyOf=[r,{type:"null"}]},_U=(i,$,n,g)=>{let v=i._zod.def;l(v.innerType,$,g);let r=$.seen.get(i);r.ref=v.innerType},DU=(i,$,n,g)=>{let v=i._zod.def;l(v.innerType,$,g);let r=$.seen.get(i);r.ref=v.innerType,n.default=JSON.parse(JSON.stringify(v.defaultValue))},kU=(i,$,n,g)=>{let v=i._zod.def;l(v.innerType,$,g);let r=$.seen.get(i);if(r.ref=v.innerType,$.io==="input")n._prefault=JSON.parse(JSON.stringify(v.defaultValue))},wU=(i,$,n,g)=>{let v=i._zod.def;l(v.innerType,$,g);let r=$.seen.get(i);r.ref=v.innerType;let b;try{b=v.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}n.default=b},jU=(i,$,n,g)=>{let v=i._zod.def,r=v.in._zod.traits.has("$ZodTransform"),b=$.io==="input"?r?v.out:v.in:v.out;l(b,$,g);let u=$.seen.get(i);u.ref=b},OU=(i,$,n,g)=>{let v=i._zod.def;l(v.innerType,$,g);let r=$.seen.get(i);r.ref=v.innerType,n.readOnly=!0},JU=(i,$,n,g)=>{let v=i._zod.def;l(v.innerType,$,g);let r=$.seen.get(i);r.ref=v.innerType},fg=(i,$,n,g)=>{let v=i._zod.def;l(v.innerType,$,g);let r=$.seen.get(i);r.ref=v.innerType},PU=(i,$,n,g)=>{let v=i._zod.innerType;l(v,$,g);let r=$.seen.get(i);r.ref=v},Vg={string:qu,number:Mu,boolean:xu,bigint:Nu,symbol:Eu,null:tu,undefined:cu,void:Cu,never:Ru,any:Fu,unknown:ou,date:mu,enum:yu,literal:hu,nan:du,template_literal:au,file:pu,success:eu,custom:su,function:iU,transform:$U,map:vU,set:nU,array:gU,object:rU,union:Xg,intersection:bU,tuple:uU,record:UU,nullable:IU,nonoptional:_U,default:DU,prefault:kU,catch:wU,pipe:jU,readonly:OU,promise:JU,optional:fg,lazy:PU};function Qg(i,$){if("_idmap"in i){let g=i,v=yi({...$,processors:Vg}),r={};for(let U of g._idmap.entries()){let[I,_]=U;l(_,v)}let b={},u={registry:g,uri:$?.uri,defs:r};v.external=u;for(let U of g._idmap.entries()){let[I,_]=U;hi(v,_),b[I]=di(v,_)}if(Object.keys(r).length>0){let U=v.target==="draft-2020-12"?"$defs":"definitions";b.__shared={[U]:r}}return{schemas:b}}let n=yi({...$,processors:Vg});return l(i,n),hi(n,i),di(n,i)}class WU{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(i){this.ctx.counter=i}get seen(){return this.ctx.seen}constructor(i){let $=i?.target??"draft-2020-12";if($==="draft-4")$="draft-04";if($==="draft-7")$="draft-07";this.ctx=yi({processors:Vg,target:$,...i?.metadata&&{metadata:i.metadata},...i?.unrepresentable&&{unrepresentable:i.unrepresentable},...i?.override&&{override:i.override},...i?.io&&{io:i.io}})}process(i,$={path:[],schemaPath:[]}){return l(i,this.ctx,$)}emit(i,$){if($){if($.cycles)this.ctx.cycles=$.cycles;if($.reused)this.ctx.reused=$.reused;if($.external)this.ctx.external=$.external}hi(this.ctx,i);let n=di(this.ctx,i),{"~standard":g,...v}=n;return v}}var y1={};var lv={};Gi(lv,{xor:()=>t0,xid:()=>I0,void:()=>Z0,uuidv7:()=>$0,uuidv6:()=>i0,uuidv4:()=>s1,uuid:()=>e1,url:()=>v0,unknown:()=>_$,union:()=>dg,undefined:()=>L0,ulid:()=>U0,uint64:()=>B0,uint32:()=>z0,tuple:()=>eU,transform:()=>pg,templateLiteral:()=>iD,symbol:()=>l0,superRefine:()=>HI,success:()=>a0,stringbool:()=>UD,stringFormat:()=>X0,string:()=>Lv,strictObject:()=>N0,set:()=>o0,refine:()=>YI,record:()=>sU,readonly:()=>VI,promise:()=>$D,preprocess:()=>_D,prefault:()=>DI,pipe:()=>Ag,partialRecord:()=>C0,optional:()=>Zv,object:()=>x0,number:()=>MU,nullish:()=>d0,nullable:()=>qv,null:()=>cU,nonoptional:()=>kI,never:()=>hg,nativeEnum:()=>m0,nanoid:()=>r0,nan:()=>p0,meta:()=>bD,map:()=>F0,mac:()=>k0,looseRecord:()=>R0,looseObject:()=>E0,literal:()=>y0,lazy:()=>QI,ksuid:()=>_0,keyof:()=>M0,jwt:()=>V0,json:()=>ID,ipv6:()=>w0,ipv4:()=>D0,invertCodec:()=>s0,intersection:()=>aU,int64:()=>A0,int32:()=>H0,int:()=>Sg,instanceof:()=>uD,httpUrl:()=>n0,hostname:()=>f0,hex:()=>Q0,hash:()=>K0,guid:()=>p1,function:()=>vD,float64:()=>Y0,float32:()=>G0,file:()=>h0,exactOptional:()=>bI,enum:()=>ag,emoji:()=>g0,email:()=>a1,e164:()=>W0,discriminatedUnion:()=>c0,describe:()=>rD,date:()=>q0,custom:()=>gD,cuid2:()=>u0,cuid:()=>b0,codec:()=>e0,cidrv6:()=>O0,cidrv4:()=>j0,check:()=>nD,catch:()=>OI,boolean:()=>xU,bigint:()=>S0,base64url:()=>P0,base64:()=>J0,array:()=>Ev,any:()=>T0,_function:()=>vD,_default:()=>II,_ZodString:()=>Bg,ZodXor:()=>yU,ZodXID:()=>xg,ZodVoid:()=>oU,ZodUnknown:()=>RU,ZodUnion:()=>cv,ZodUndefined:()=>EU,ZodUUID:()=>Vi,ZodURL:()=>xv,ZodULID:()=>Mg,ZodType:()=>H,ZodTuple:()=>pU,ZodTransform:()=>gI,ZodTemplateLiteral:()=>XI,ZodSymbol:()=>NU,ZodSuccess:()=>wI,ZodStringFormat:()=>q,ZodString:()=>m$,ZodSet:()=>$I,ZodRecord:()=>F$,ZodReadonly:()=>WI,ZodPromise:()=>KI,ZodPreprocess:()=>PI,ZodPrefault:()=>_I,ZodPipe:()=>Cv,ZodOptional:()=>eg,ZodObject:()=>tv,ZodNumberFormat:()=>D$,ZodNumber:()=>h$,ZodNullable:()=>uI,ZodNull:()=>tU,ZodNonOptional:()=>sg,ZodNever:()=>FU,ZodNanoID:()=>Tg,ZodNaN:()=>JI,ZodMap:()=>iI,ZodMAC:()=>qU,ZodLiteral:()=>vI,ZodLazy:()=>fI,ZodKSUID:()=>Ng,ZodJWT:()=>mg,ZodIntersection:()=>dU,ZodIPv6:()=>tg,ZodIPv4:()=>Eg,ZodGUID:()=>Tv,ZodFunction:()=>GI,ZodFile:()=>nI,ZodExactOptional:()=>rI,ZodEnum:()=>o$,ZodEmoji:()=>Lg,ZodEmail:()=>lg,ZodE164:()=>og,ZodDiscriminatedUnion:()=>hU,ZodDefault:()=>UI,ZodDate:()=>Nv,ZodCustomStringFormat:()=>y$,ZodCustom:()=>Fv,ZodCodec:()=>Rv,ZodCatch:()=>jI,ZodCUID2:()=>qg,ZodCUID:()=>Zg,ZodCIDRv6:()=>Cg,ZodCIDRv4:()=>cg,ZodBoolean:()=>d$,ZodBigIntFormat:()=>yg,ZodBigInt:()=>a$,ZodBase64URL:()=>Fg,ZodBase64:()=>Rg,ZodArray:()=>mU,ZodAny:()=>CU});var Kg={};Gi(Kg,{uppercase:()=>l$,trim:()=>x$,toUpperCase:()=>E$,toLowerCase:()=>N$,startsWith:()=>T$,slugify:()=>t$,size:()=>u$,regex:()=>A$,property:()=>Wg,positive:()=>jg,overwrite:()=>ki,normalize:()=>M$,nonpositive:()=>Jg,nonnegative:()=>Pg,negative:()=>Og,multipleOf:()=>oi,minSize:()=>Wi,minLength:()=>zi,mime:()=>q$,maxSize:()=>mi,maxLength:()=>U$,lte:()=>bi,lt:()=>Ji,lowercase:()=>B$,length:()=>I$,includes:()=>L$,gte:()=>e,gt:()=>Pi,endsWith:()=>Z$});var R$={};Gi(R$,{time:()=>fU,duration:()=>QU,datetime:()=>VU,date:()=>XU,ZodISOTime:()=>Hg,ZodISODuration:()=>zg,ZodISODateTime:()=>Gg,ZodISODate:()=>Yg});var Gg=w("ZodISODateTime",(i,$)=>{sb.init(i,$),q.init(i,$)});function VU(i){return s6(Gg,i)}var Yg=w("ZodISODate",(i,$)=>{i4.init(i,$),q.init(i,$)});function XU(i){return iu(Yg,i)}var Hg=w("ZodISOTime",(i,$)=>{$4.init(i,$),q.init(i,$)});function fU(i){return $u(Hg,i)}var zg=w("ZodISODuration",(i,$)=>{v4.init(i,$),q.init(i,$)});function QU(i){return vu(zg,i)}var h1=(i,$)=>{Ov.init(i,$),i.name="ZodError",Object.defineProperties(i,{format:{value:(n)=>Pv(i,n)},flatten:{value:(n)=>Jv(i,n)},addIssue:{value:(n)=>{i.issues.push(n),i.message=JSON.stringify(i.issues,X$,2)}},addIssues:{value:(n)=>{i.issues.push(...n),i.message=JSON.stringify(i.issues,X$,2)}},isEmpty:{get(){return i.issues.length===0}}})},zO=w("ZodError",h1),ni=w("ZodError",h1,{Parent:Error});var KU=K$(ni),GU=G$(ni),YU=Y$(ni),HU=H$(ni),zU=Hn(ni),SU=zn(ni),AU=Sn(ni),BU=An(ni),lU=Bn(ni),LU=ln(ni),TU=Ln(ni),ZU=Tn(ni);var d1=new WeakMap;function Mv(i,$,n){let g=Object.getPrototypeOf(i),v=d1.get(g);if(!v)v=new Set,d1.set(g,v);if(v.has($))return;v.add($);for(let r in n){let b=n[r];Object.defineProperty(g,r,{configurable:!0,enumerable:!1,get(){let u=b.bind(this);return Object.defineProperty(this,r,{configurable:!0,writable:!0,enumerable:!0,value:u}),u},set(u){Object.defineProperty(this,r,{configurable:!0,writable:!0,enumerable:!0,value:u})}})}}var H=w("ZodType",(i,$)=>{return Y.init(i,$),Object.assign(i["~standard"],{jsonSchema:{input:C$(i,"input"),output:C$(i,"output")}}),i.toJSONSchema=Zu(i,{}),i.def=$,i.type=$.type,Object.defineProperty(i,"_def",{value:$}),i.parse=(n,g)=>KU(i,n,g,{callee:i.parse}),i.safeParse=(n,g)=>YU(i,n,g),i.parseAsync=async(n,g)=>GU(i,n,g,{callee:i.parseAsync}),i.safeParseAsync=async(n,g)=>HU(i,n,g),i.spa=i.safeParseAsync,i.encode=(n,g)=>zU(i,n,g),i.decode=(n,g)=>SU(i,n,g),i.encodeAsync=async(n,g)=>AU(i,n,g),i.decodeAsync=async(n,g)=>BU(i,n,g),i.safeEncode=(n,g)=>lU(i,n,g),i.safeDecode=(n,g)=>LU(i,n,g),i.safeEncodeAsync=async(n,g)=>TU(i,n,g),i.safeDecodeAsync=async(n,g)=>ZU(i,n,g),Mv(i,"ZodType",{check(...n){let g=this.def;return this.clone(X.mergeDefs(g,{checks:[...g.checks??[],...n.map((v)=>typeof v==="function"?{_zod:{check:v,def:{check:"custom"},onattach:[]}}:v)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,g){return a(this,n,g)},brand(){return this},register(n,g){return n.add(this,g),this},refine(n,g){return this.check(YI(n,g))},superRefine(n,g){return this.check(HI(n,g))},overwrite(n){return this.check(ki(n))},optional(){return Zv(this)},exactOptional(){return bI(this)},nullable(){return qv(this)},nullish(){return Zv(qv(this))},nonoptional(n){return kI(this,n)},array(){return Ev(this)},or(n){return dg([this,n])},and(n){return aU(this,n)},transform(n){return Ag(this,pg(n))},default(n){return II(this,n)},prefault(n){return DI(this,n)},catch(n){return OI(this,n)},pipe(n){return Ag(this,n)},readonly(){return VI(this)},describe(n){let g=this.clone();return m.add(g,{description:n}),g},meta(...n){if(n.length===0)return m.get(this);let g=this.clone();return m.add(g,n[0]),g},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(i,"description",{get(){return m.get(i)?.description},configurable:!0}),i}),Bg=w("_ZodString",(i,$)=>{b$.init(i,$),H.init(i,$),i._zod.processJSONSchema=(g,v,r)=>qu(i,g,v,r);let n=i._zod.bag;i.format=n.format??null,i.minLength=n.minimum??null,i.maxLength=n.maximum??null,Mv(i,"_ZodString",{regex(...g){return this.check(A$(...g))},includes(...g){return this.check(L$(...g))},startsWith(...g){return this.check(T$(...g))},endsWith(...g){return this.check(Z$(...g))},min(...g){return this.check(zi(...g))},max(...g){return this.check(U$(...g))},length(...g){return this.check(I$(...g))},nonempty(...g){return this.check(zi(1,...g))},lowercase(g){return this.check(B$(g))},uppercase(g){return this.check(l$(g))},trim(){return this.check(x$())},normalize(...g){return this.check(M$(...g))},toLowerCase(){return this.check(N$())},toUpperCase(){return this.check(E$())},slugify(){return this.check(t$())}})}),m$=w("ZodString",(i,$)=>{b$.init(i,$),Bg.init(i,$),i.email=(n)=>i.check(hn(lg,n)),i.url=(n)=>i.check(Bv(xv,n)),i.jwt=(n)=>i.check(wg(mg,n)),i.emoji=(n)=>i.check(sn(Lg,n)),i.guid=(n)=>i.check(Av(Tv,n)),i.uuid=(n)=>i.check(dn(Vi,n)),i.uuidv4=(n)=>i.check(an(Vi,n)),i.uuidv6=(n)=>i.check(pn(Vi,n)),i.uuidv7=(n)=>i.check(en(Vi,n)),i.nanoid=(n)=>i.check(ig(Tg,n)),i.guid=(n)=>i.check(Av(Tv,n)),i.cuid=(n)=>i.check($g(Zg,n)),i.cuid2=(n)=>i.check(vg(qg,n)),i.ulid=(n)=>i.check(ng(Mg,n)),i.base64=(n)=>i.check(_g(Rg,n)),i.base64url=(n)=>i.check(Dg(Fg,n)),i.xid=(n)=>i.check(gg(xg,n)),i.ksuid=(n)=>i.check(rg(Ng,n)),i.ipv4=(n)=>i.check(bg(Eg,n)),i.ipv6=(n)=>i.check(ug(tg,n)),i.cidrv4=(n)=>i.check(Ug(cg,n)),i.cidrv6=(n)=>i.check(Ig(Cg,n)),i.e164=(n)=>i.check(kg(og,n)),i.datetime=(n)=>i.check(VU(n)),i.date=(n)=>i.check(XU(n)),i.time=(n)=>i.check(fU(n)),i.duration=(n)=>i.check(QU(n))});function Lv(i){return d6(m$,i)}var q=w("ZodStringFormat",(i,$)=>{Z.init(i,$),Bg.init(i,$)}),lg=w("ZodEmail",(i,$)=>{Fb.init(i,$),q.init(i,$)});function a1(i){return hn(lg,i)}var Tv=w("ZodGUID",(i,$)=>{Cb.init(i,$),q.init(i,$)});function p1(i){return Av(Tv,i)}var Vi=w("ZodUUID",(i,$)=>{Rb.init(i,$),q.init(i,$)});function e1(i){return dn(Vi,i)}function s1(i){return an(Vi,i)}function i0(i){return pn(Vi,i)}function $0(i){return en(Vi,i)}var xv=w("ZodURL",(i,$)=>{ob.init(i,$),q.init(i,$)});function v0(i){return Bv(xv,i)}function n0(i){return Bv(xv,{protocol:ri.httpProtocol,hostname:ri.domain,...X.normalizeParams(i)})}var Lg=w("ZodEmoji",(i,$)=>{mb.init(i,$),q.init(i,$)});function g0(i){return sn(Lg,i)}var Tg=w("ZodNanoID",(i,$)=>{yb.init(i,$),q.init(i,$)});function r0(i){return ig(Tg,i)}var Zg=w("ZodCUID",(i,$)=>{hb.init(i,$),q.init(i,$)});function b0(i){return $g(Zg,i)}var qg=w("ZodCUID2",(i,$)=>{db.init(i,$),q.init(i,$)});function u0(i){return vg(qg,i)}var Mg=w("ZodULID",(i,$)=>{ab.init(i,$),q.init(i,$)});function U0(i){return ng(Mg,i)}var xg=w("ZodXID",(i,$)=>{pb.init(i,$),q.init(i,$)});function I0(i){return gg(xg,i)}var Ng=w("ZodKSUID",(i,$)=>{eb.init(i,$),q.init(i,$)});function _0(i){return rg(Ng,i)}var Eg=w("ZodIPv4",(i,$)=>{n4.init(i,$),q.init(i,$)});function D0(i){return bg(Eg,i)}var qU=w("ZodMAC",(i,$)=>{r4.init(i,$),q.init(i,$)});function k0(i){return p6(qU,i)}var tg=w("ZodIPv6",(i,$)=>{g4.init(i,$),q.init(i,$)});function w0(i){return ug(tg,i)}var cg=w("ZodCIDRv4",(i,$)=>{b4.init(i,$),q.init(i,$)});function j0(i){return Ug(cg,i)}var Cg=w("ZodCIDRv6",(i,$)=>{u4.init(i,$),q.init(i,$)});function O0(i){return Ig(Cg,i)}var Rg=w("ZodBase64",(i,$)=>{I4.init(i,$),q.init(i,$)});function J0(i){return _g(Rg,i)}var Fg=w("ZodBase64URL",(i,$)=>{_4.init(i,$),q.init(i,$)});function P0(i){return Dg(Fg,i)}var og=w("ZodE164",(i,$)=>{D4.init(i,$),q.init(i,$)});function W0(i){return kg(og,i)}var mg=w("ZodJWT",(i,$)=>{k4.init(i,$),q.init(i,$)});function V0(i){return wg(mg,i)}var y$=w("ZodCustomStringFormat",(i,$)=>{w4.init(i,$),q.init(i,$)});function X0(i,$,n={}){return c$(y$,i,$,n)}function f0(i){return c$(y$,"hostname",ri.hostname,i)}function Q0(i){return c$(y$,"hex",ri.hex,i)}function K0(i,$){let n=$?.enc??"hex",g=`${i}_${n}`,v=ri[g];if(!v)throw Error(`Unrecognized hash format: ${g}`);return c$(y$,g,v,$)}var h$=w("ZodNumber",(i,$)=>{Cn.init(i,$),H.init(i,$),i._zod.processJSONSchema=(g,v,r)=>Mu(i,g,v,r),Mv(i,"ZodNumber",{gt(g,v){return this.check(Pi(g,v))},gte(g,v){return this.check(e(g,v))},min(g,v){return this.check(e(g,v))},lt(g,v){return this.check(Ji(g,v))},lte(g,v){return this.check(bi(g,v))},max(g,v){return this.check(bi(g,v))},int(g){return this.check(Sg(g))},safe(g){return this.check(Sg(g))},positive(g){return this.check(Pi(0,g))},nonnegative(g){return this.check(e(0,g))},negative(g){return this.check(Ji(0,g))},nonpositive(g){return this.check(bi(0,g))},multipleOf(g,v){return this.check(oi(g,v))},step(g,v){return this.check(oi(g,v))},finite(){return this}});let n=i._zod.bag;i.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,i.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,i.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??0.5),i.isFinite=!0,i.format=n.format??null});function MU(i){return nu(h$,i)}var D$=w("ZodNumberFormat",(i,$)=>{j4.init(i,$),h$.init(i,$)});function Sg(i){return ru(D$,i)}function G0(i){return bu(D$,i)}function Y0(i){return uu(D$,i)}function H0(i){return Uu(D$,i)}function z0(i){return Iu(D$,i)}var d$=w("ZodBoolean",(i,$)=>{fv.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>xu(i,n,g,v)});function xU(i){return _u(d$,i)}var a$=w("ZodBigInt",(i,$)=>{Rn.init(i,$),H.init(i,$),i._zod.processJSONSchema=(g,v,r)=>Nu(i,g,v,r),i.gte=(g,v)=>i.check(e(g,v)),i.min=(g,v)=>i.check(e(g,v)),i.gt=(g,v)=>i.check(Pi(g,v)),i.gte=(g,v)=>i.check(e(g,v)),i.min=(g,v)=>i.check(e(g,v)),i.lt=(g,v)=>i.check(Ji(g,v)),i.lte=(g,v)=>i.check(bi(g,v)),i.max=(g,v)=>i.check(bi(g,v)),i.positive=(g)=>i.check(Pi(BigInt(0),g)),i.negative=(g)=>i.check(Ji(BigInt(0),g)),i.nonpositive=(g)=>i.check(bi(BigInt(0),g)),i.nonnegative=(g)=>i.check(e(BigInt(0),g)),i.multipleOf=(g,v)=>i.check(oi(g,v));let n=i._zod.bag;i.minValue=n.minimum??null,i.maxValue=n.maximum??null,i.format=n.format??null});function S0(i){return ku(a$,i)}var yg=w("ZodBigIntFormat",(i,$)=>{O4.init(i,$),a$.init(i,$)});function A0(i){return ju(yg,i)}function B0(i){return Ou(yg,i)}var NU=w("ZodSymbol",(i,$)=>{J4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>Eu(i,n,g,v)});function l0(i){return Ju(NU,i)}var EU=w("ZodUndefined",(i,$)=>{P4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>cu(i,n,g,v)});function L0(i){return Pu(EU,i)}var tU=w("ZodNull",(i,$)=>{W4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>tu(i,n,g,v)});function cU(i){return Wu(tU,i)}var CU=w("ZodAny",(i,$)=>{V4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>Fu(i,n,g,v)});function T0(){return Vu(CU)}var RU=w("ZodUnknown",(i,$)=>{X4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>ou(i,n,g,v)});function _$(){return Xu(RU)}var FU=w("ZodNever",(i,$)=>{f4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>Ru(i,n,g,v)});function hg(i){return fu(FU,i)}var oU=w("ZodVoid",(i,$)=>{Q4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>Cu(i,n,g,v)});function Z0(i){return Qu(oU,i)}var Nv=w("ZodDate",(i,$)=>{K4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(g,v,r)=>mu(i,g,v,r),i.min=(g,v)=>i.check(e(g,v)),i.max=(g,v)=>i.check(bi(g,v));let n=i._zod.bag;i.minDate=n.minimum?new Date(n.minimum):null,i.maxDate=n.maximum?new Date(n.maximum):null});function q0(i){return Ku(Nv,i)}var mU=w("ZodArray",(i,$)=>{G4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>gU(i,n,g,v),i.element=$.element,Mv(i,"ZodArray",{min(n,g){return this.check(zi(n,g))},nonempty(n){return this.check(zi(1,n))},max(n,g){return this.check(U$(n,g))},length(n,g){return this.check(I$(n,g))},unwrap(){return this.element}})});function Ev(i,$){return Hu(mU,i,$)}function M0(i){let $=i._zod.def.shape;return ag(Object.keys($))}var tv=w("ZodObject",(i,$)=>{Y4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>rU(i,n,g,v),X.defineLazy(i,"shape",()=>{return $.shape}),Mv(i,"ZodObject",{keyof(){return ag(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:_$()})},loose(){return this.clone({...this._zod.def,catchall:_$()})},strict(){return this.clone({...this._zod.def,catchall:hg()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return X.extend(this,n)},safeExtend(n){return X.safeExtend(this,n)},merge(n){return X.merge(this,n)},pick(n){return X.pick(this,n)},omit(n){return X.omit(this,n)},partial(...n){return X.partial(eg,this,n[0])},required(...n){return X.required(sg,this,n[0])}})});function x0(i,$){let n={type:"object",shape:i??{},...X.normalizeParams($)};return new tv(n)}function N0(i,$){return new tv({type:"object",shape:i,catchall:hg(),...X.normalizeParams($)})}function E0(i,$){return new tv({type:"object",shape:i,catchall:_$(),...X.normalizeParams($)})}var cv=w("ZodUnion",(i,$)=>{Qv.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>Xg(i,n,g,v),i.options=$.options});function dg(i,$){return new cv({type:"union",options:i,...X.normalizeParams($)})}var yU=w("ZodXor",(i,$)=>{cv.init(i,$),H4.init(i,$),i._zod.processJSONSchema=(n,g,v)=>Xg(i,n,g,v),i.options=$.options});function t0(i,$){return new yU({type:"union",options:i,inclusive:!1,...X.normalizeParams($)})}var hU=w("ZodDiscriminatedUnion",(i,$)=>{cv.init(i,$),z4.init(i,$)});function c0(i,$,n){return new hU({type:"union",options:$,discriminator:i,...X.normalizeParams(n)})}var dU=w("ZodIntersection",(i,$)=>{S4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>bU(i,n,g,v)});function aU(i,$){return new dU({type:"intersection",left:i,right:$})}var pU=w("ZodTuple",(i,$)=>{Fn.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>uU(i,n,g,v),i.rest=(n)=>i.clone({...i._zod.def,rest:n})});function eU(i,$,n){let g=$ instanceof Y,v=g?n:$;return new pU({type:"tuple",items:i,rest:g?$:null,...X.normalizeParams(v)})}var F$=w("ZodRecord",(i,$)=>{A4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>UU(i,n,g,v),i.keyType=$.keyType,i.valueType=$.valueType});function sU(i,$,n){if(!$||!$._zod)return new F$({type:"record",keyType:Lv(),valueType:i,...X.normalizeParams($)});return new F$({type:"record",keyType:i,valueType:$,...X.normalizeParams(n)})}function C0(i,$,n){let g=a(i);return g._zod.values=void 0,new F$({type:"record",keyType:g,valueType:$,...X.normalizeParams(n)})}function R0(i,$,n){return new F$({type:"record",keyType:i,valueType:$,mode:"loose",...X.normalizeParams(n)})}var iI=w("ZodMap",(i,$)=>{B4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>vU(i,n,g,v),i.keyType=$.keyType,i.valueType=$.valueType,i.min=(...n)=>i.check(Wi(...n)),i.nonempty=(n)=>i.check(Wi(1,n)),i.max=(...n)=>i.check(mi(...n)),i.size=(...n)=>i.check(u$(...n))});function F0(i,$,n){return new iI({type:"map",keyType:i,valueType:$,...X.normalizeParams(n)})}var $I=w("ZodSet",(i,$)=>{l4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>nU(i,n,g,v),i.min=(...n)=>i.check(Wi(...n)),i.nonempty=(n)=>i.check(Wi(1,n)),i.max=(...n)=>i.check(mi(...n)),i.size=(...n)=>i.check(u$(...n))});function o0(i,$){return new $I({type:"set",valueType:i,...X.normalizeParams($)})}var o$=w("ZodEnum",(i,$)=>{L4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(g,v,r)=>yu(i,g,v,r),i.enum=$.entries,i.options=Object.values($.entries);let n=new Set(Object.keys($.entries));i.extract=(g,v)=>{let r={};for(let b of g)if(n.has(b))r[b]=$.entries[b];else throw Error(`Key ${b} not found in enum`);return new o$({...$,checks:[],...X.normalizeParams(v),entries:r})},i.exclude=(g,v)=>{let r={...$.entries};for(let b of g)if(n.has(b))delete r[b];else throw Error(`Key ${b} not found in enum`);return new o$({...$,checks:[],...X.normalizeParams(v),entries:r})}});function ag(i,$){let n=Array.isArray(i)?Object.fromEntries(i.map((g)=>[g,g])):i;return new o$({type:"enum",entries:n,...X.normalizeParams($)})}function m0(i,$){return new o$({type:"enum",entries:i,...X.normalizeParams($)})}var vI=w("ZodLiteral",(i,$)=>{T4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>hu(i,n,g,v),i.values=new Set($.values),Object.defineProperty(i,"value",{get(){if($.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return $.values[0]}})});function y0(i,$){return new vI({type:"literal",values:Array.isArray(i)?i:[i],...X.normalizeParams($)})}var nI=w("ZodFile",(i,$)=>{Z4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>pu(i,n,g,v),i.min=(n,g)=>i.check(Wi(n,g)),i.max=(n,g)=>i.check(mi(n,g)),i.mime=(n,g)=>i.check(q$(Array.isArray(n)?n:[n],g))});function h0(i){return zu(nI,i)}var gI=w("ZodTransform",(i,$)=>{q4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>$U(i,n,g,v),i._zod.parse=(n,g)=>{if(g.direction==="backward")throw new n$(i.constructor.name);n.addIssue=(r)=>{if(typeof r==="string")n.issues.push(X.issue(r,n.value,$));else{let b=r;if(b.fatal)b.continue=!1;b.code??(b.code="custom"),b.input??(b.input=n.value),b.inst??(b.inst=i),n.issues.push(X.issue(b))}};let v=$.transform(n.value,n);if(v instanceof Promise)return v.then((r)=>{return n.value=r,n.fallback=!0,n});return n.value=v,n.fallback=!0,n}});function pg(i){return new gI({type:"transform",transform:i})}var eg=w("ZodOptional",(i,$)=>{on.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>fg(i,n,g,v),i.unwrap=()=>i._zod.def.innerType});function Zv(i){return new eg({type:"optional",innerType:i})}var rI=w("ZodExactOptional",(i,$)=>{M4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>fg(i,n,g,v),i.unwrap=()=>i._zod.def.innerType});function bI(i){return new rI({type:"optional",innerType:i})}var uI=w("ZodNullable",(i,$)=>{x4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>IU(i,n,g,v),i.unwrap=()=>i._zod.def.innerType});function qv(i){return new uI({type:"nullable",innerType:i})}function d0(i){return Zv(qv(i))}var UI=w("ZodDefault",(i,$)=>{N4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>DU(i,n,g,v),i.unwrap=()=>i._zod.def.innerType,i.removeDefault=i.unwrap});function II(i,$){return new UI({type:"default",innerType:i,get defaultValue(){return typeof $==="function"?$():X.shallowClone($)}})}var _I=w("ZodPrefault",(i,$)=>{E4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>kU(i,n,g,v),i.unwrap=()=>i._zod.def.innerType});function DI(i,$){return new _I({type:"prefault",innerType:i,get defaultValue(){return typeof $==="function"?$():X.shallowClone($)}})}var sg=w("ZodNonOptional",(i,$)=>{t4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>_U(i,n,g,v),i.unwrap=()=>i._zod.def.innerType});function kI(i,$){return new sg({type:"nonoptional",innerType:i,...X.normalizeParams($)})}var wI=w("ZodSuccess",(i,$)=>{c4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>eu(i,n,g,v),i.unwrap=()=>i._zod.def.innerType});function a0(i){return new wI({type:"success",innerType:i})}var jI=w("ZodCatch",(i,$)=>{C4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>wU(i,n,g,v),i.unwrap=()=>i._zod.def.innerType,i.removeCatch=i.unwrap});function OI(i,$){return new jI({type:"catch",innerType:i,catchValue:typeof $==="function"?$:()=>$})}var JI=w("ZodNaN",(i,$)=>{R4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>du(i,n,g,v)});function p0(i){return Yu(JI,i)}var Cv=w("ZodPipe",(i,$)=>{mn.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>jU(i,n,g,v),i.in=$.in,i.out=$.out});function Ag(i,$){return new Cv({type:"pipe",in:i,out:$})}var Rv=w("ZodCodec",(i,$)=>{Cv.init(i,$),Kv.init(i,$)});function e0(i,$,n){return new Rv({type:"pipe",in:i,out:$,transform:n.decode,reverseTransform:n.encode})}function s0(i){let $=i._zod.def;return new Rv({type:"pipe",in:$.out,out:$.in,transform:$.reverseTransform,reverseTransform:$.transform})}var PI=w("ZodPreprocess",(i,$)=>{Cv.init(i,$),F4.init(i,$)}),WI=w("ZodReadonly",(i,$)=>{o4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>OU(i,n,g,v),i.unwrap=()=>i._zod.def.innerType});function VI(i){return new WI({type:"readonly",innerType:i})}var XI=w("ZodTemplateLiteral",(i,$)=>{m4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>au(i,n,g,v)});function iD(i,$){return new XI({type:"template_literal",parts:i,...X.normalizeParams($)})}var fI=w("ZodLazy",(i,$)=>{d4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>PU(i,n,g,v),i.unwrap=()=>i._zod.def.getter()});function QI(i){return new fI({type:"lazy",getter:i})}var KI=w("ZodPromise",(i,$)=>{h4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>JU(i,n,g,v),i.unwrap=()=>i._zod.def.innerType});function $D(i){return new KI({type:"promise",innerType:i})}var GI=w("ZodFunction",(i,$)=>{y4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>iU(i,n,g,v)});function vD(i){return new GI({type:"function",input:Array.isArray(i?.input)?eU(i?.input):i?.input??Ev(_$()),output:i?.output??_$()})}var Fv=w("ZodCustom",(i,$)=>{a4.init(i,$),H.init(i,$),i._zod.processJSONSchema=(n,g,v)=>su(i,n,g,v)});function nD(i){let $=new M({check:"custom"});return $._zod.check=i,$}function gD(i,$){return Su(Fv,i??(()=>!0),$)}function YI(i,$={}){return Au(Fv,i,$)}function HI(i,$){return Bu(i,$)}var rD=lu,bD=Lu;function uD(i,$={}){let n=new Fv({type:"custom",check:"custom",fn:(g)=>g instanceof i,abort:!0,...X.normalizeParams($)});return n._zod.bag.Class=i,n._zod.check=(g)=>{if(!(g.value instanceof i))g.issues.push({code:"invalid_type",expected:i.name,input:g.value,inst:n,path:[...n._zod.def.path??[]]})},n}var UD=(...i)=>Tu({Codec:Rv,Boolean:d$,String:m$},...i);function ID(i){let $=QI(()=>{return dg([Lv(i),MU(),xU(),cU(),Ev($),sU(Lv(),$)])});return $}function _D(i,$){return new PI({type:"pipe",in:pg(i),out:$})}var AO={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function BO(i){t({customError:i})}function lO(){return t().customError}var zI;(function(i){})(zI||(zI={}));var K={...lv,...Kg,iso:R$},LO=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function TO(i,$){let n=i.$schema;if(n==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(n==="http://json-schema.org/draft-07/schema#")return"draft-7";if(n==="http://json-schema.org/draft-04/schema#")return"draft-4";return $??"draft-2020-12"}function ZO(i,$){if(!i.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let n=i.slice(1).split("/").filter(Boolean);if(n.length===0)return $.rootSchema;let g=$.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===g){let v=n[1];if(!v||!$.defs[v])throw Error(`Reference not found: ${i}`);return $.defs[v]}throw Error(`Reference not found: ${i}`)}function DD(i,$){if(i.not!==void 0){if(typeof i.not==="object"&&Object.keys(i.not).length===0)return K.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(i.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if(i.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if(i.if!==void 0||i.then!==void 0||i.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if(i.dependentSchemas!==void 0||i.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if(i.$ref){let v=i.$ref;if($.refs.has(v))return $.refs.get(v);if($.processing.has(v))return K.lazy(()=>{if(!$.refs.has(v))throw Error(`Circular reference not resolved: ${v}`);return $.refs.get(v)});$.processing.add(v);let r=ZO(v,$),b=h(r,$);return $.refs.set(v,b),$.processing.delete(v),b}if(i.enum!==void 0){let v=i.enum;if($.version==="openapi-3.0"&&i.nullable===!0&&v.length===1&&v[0]===null)return K.null();if(v.length===0)return K.never();if(v.length===1)return K.literal(v[0]);if(v.every((b)=>typeof b==="string"))return K.enum(v);let r=v.map((b)=>K.literal(b));if(r.length<2)return r[0];return K.union([r[0],r[1],...r.slice(2)])}if(i.const!==void 0)return K.literal(i.const);let n=i.type;if(Array.isArray(n)){let v=n.map((r)=>{let b={...i,type:r};return DD(b,$)});if(v.length===0)return K.never();if(v.length===1)return v[0];return K.union(v)}if(!n)return K.any();let g;switch(n){case"string":{let v=K.string();if(i.format){let r=i.format;if(r==="email")v=v.check(K.email());else if(r==="uri"||r==="uri-reference")v=v.check(K.url());else if(r==="uuid"||r==="guid")v=v.check(K.uuid());else if(r==="date-time")v=v.check(K.iso.datetime());else if(r==="date")v=v.check(K.iso.date());else if(r==="time")v=v.check(K.iso.time());else if(r==="duration")v=v.check(K.iso.duration());else if(r==="ipv4")v=v.check(K.ipv4());else if(r==="ipv6")v=v.check(K.ipv6());else if(r==="mac")v=v.check(K.mac());else if(r==="cidr")v=v.check(K.cidrv4());else if(r==="cidr-v6")v=v.check(K.cidrv6());else if(r==="base64")v=v.check(K.base64());else if(r==="base64url")v=v.check(K.base64url());else if(r==="e164")v=v.check(K.e164());else if(r==="jwt")v=v.check(K.jwt());else if(r==="emoji")v=v.check(K.emoji());else if(r==="nanoid")v=v.check(K.nanoid());else if(r==="cuid")v=v.check(K.cuid());else if(r==="cuid2")v=v.check(K.cuid2());else if(r==="ulid")v=v.check(K.ulid());else if(r==="xid")v=v.check(K.xid());else if(r==="ksuid")v=v.check(K.ksuid())}if(typeof i.minLength==="number")v=v.min(i.minLength);if(typeof i.maxLength==="number")v=v.max(i.maxLength);if(i.pattern)v=v.regex(new RegExp(i.pattern));g=v;break}case"number":case"integer":{let v=n==="integer"?K.number().int():K.number();if(typeof i.minimum==="number")v=v.min(i.minimum);if(typeof i.maximum==="number")v=v.max(i.maximum);if(typeof i.exclusiveMinimum==="number")v=v.gt(i.exclusiveMinimum);else if(i.exclusiveMinimum===!0&&typeof i.minimum==="number")v=v.gt(i.minimum);if(typeof i.exclusiveMaximum==="number")v=v.lt(i.exclusiveMaximum);else if(i.exclusiveMaximum===!0&&typeof i.maximum==="number")v=v.lt(i.maximum);if(typeof i.multipleOf==="number")v=v.multipleOf(i.multipleOf);g=v;break}case"boolean":{g=K.boolean();break}case"null":{g=K.null();break}case"object":{let v={},r=i.properties||{},b=new Set(i.required||[]);for(let[U,I]of Object.entries(r)){let _=h(I,$);v[U]=b.has(U)?_:_.optional()}if(i.propertyNames){let U=h(i.propertyNames,$),I=i.additionalProperties&&typeof i.additionalProperties==="object"?h(i.additionalProperties,$):K.any();if(Object.keys(v).length===0){g=K.record(U,I);break}let _=K.object(v).passthrough(),k=K.looseRecord(U,I);g=K.intersection(_,k);break}if(i.patternProperties){let U=i.patternProperties,I=Object.keys(U),_=[];for(let O of I){let J=h(U[O],$),Q=K.string().regex(new RegExp(O));_.push(K.looseRecord(Q,J))}let k=[];if(Object.keys(v).length>0)k.push(K.object(v).passthrough());if(k.push(..._),k.length===0)g=K.object({}).passthrough();else if(k.length===1)g=k[0];else{let O=K.intersection(k[0],k[1]);for(let J=2;J<k.length;J++)O=K.intersection(O,k[J]);g=O}break}let u=K.object(v);if(i.additionalProperties===!1)g=u.strict();else if(typeof i.additionalProperties==="object")g=u.catchall(h(i.additionalProperties,$));else g=u.passthrough();break}case"array":{let{prefixItems:v,items:r}=i;if(v&&Array.isArray(v)){let b=v.map((U)=>h(U,$)),u=r&&typeof r==="object"&&!Array.isArray(r)?h(r,$):void 0;if(u)g=K.tuple(b).rest(u);else g=K.tuple(b);if(typeof i.minItems==="number")g=g.check(K.minLength(i.minItems));if(typeof i.maxItems==="number")g=g.check(K.maxLength(i.maxItems))}else if(Array.isArray(r)){let b=r.map((U)=>h(U,$)),u=i.additionalItems&&typeof i.additionalItems==="object"?h(i.additionalItems,$):void 0;if(u)g=K.tuple(b).rest(u);else g=K.tuple(b);if(typeof i.minItems==="number")g=g.check(K.minLength(i.minItems));if(typeof i.maxItems==="number")g=g.check(K.maxLength(i.maxItems))}else if(r!==void 0){let b=h(r,$),u=K.array(b);if(typeof i.minItems==="number")u=u.min(i.minItems);if(typeof i.maxItems==="number")u=u.max(i.maxItems);g=u}else g=K.array(K.any());break}default:throw Error(`Unsupported type: ${n}`)}return g}function h(i,$){if(typeof i==="boolean")return i?K.any():K.never();let n=DD(i,$),g=i.type||i.enum!==void 0||i.const!==void 0;if(i.anyOf&&Array.isArray(i.anyOf)){let u=i.anyOf.map((I)=>h(I,$)),U=K.union(u);n=g?K.intersection(n,U):U}if(i.oneOf&&Array.isArray(i.oneOf)){let u=i.oneOf.map((I)=>h(I,$)),U=K.xor(u);n=g?K.intersection(n,U):U}if(i.allOf&&Array.isArray(i.allOf))if(i.allOf.length===0)n=g?n:K.any();else{let u=g?n:h(i.allOf[0],$),U=g?0:1;for(let I=U;I<i.allOf.length;I++)u=K.intersection(u,h(i.allOf[I],$));n=u}if(i.nullable===!0&&$.version==="openapi-3.0")n=K.nullable(n);if(i.readOnly===!0)n=K.readonly(n);if(i.default!==void 0)n=n.default(i.default);let v={},r=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let u of r)if(u in i)v[u]=i[u];let b=["contentEncoding","contentMediaType","contentSchema"];for(let u of b)if(u in i)v[u]=i[u];for(let u of Object.keys(i))if(!LO.has(u))v[u]=i[u];if(Object.keys(v).length>0)$.registry.add(n,v);if(i.description)n=n.describe(i.description);return n}function kD(i,$){if(typeof i==="boolean")return i?K.any():K.never();let n;try{n=JSON.parse(JSON.stringify(i))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let g=TO(n,$?.defaultTarget),v=n.$defs||n.definitions||{},r={version:g,defs:v,refs:new Map,processing:new Set,rootSchema:n,registry:$?.registry??m};return h(n,r)}var SI={};Gi(SI,{string:()=>qO,number:()=>MO,date:()=>EO,boolean:()=>xO,bigint:()=>NO});function qO(i){return a6(m$,i)}function MO(i){return gu(h$,i)}function xO(i){return Du(d$,i)}function NO(i){return wu(a$,i)}function EO(i){return Gu(Nv,i)}t(Gv());var Ai=D.object({id:D.string(),name:D.string(),type:D.literal("discord"),botToken:D.string().min(10).optional(),botTokenEnv:D.string().optional(),createdAt:D.string().datetime().optional(),updatedAt:D.string().datetime().optional()});function P(i){try{if(i.error instanceof Error){let $=i.error.message;if(typeof $==="string")return $;return"<non-string error message>"}}catch{return"<unreadable error message>"}try{return String(i.error)}catch{return"<unprintable error>"}}function L(i){try{if(i.value instanceof Error)return i.value}catch{}let $=P({error:i.value});try{return Error($)}catch{try{return Error("unknown error")}catch{let n=Object.create(Error.prototype);return n.name="Error",n.message="unknown error",n}}}function tO(i){if(typeof i!=="object"&&typeof i!=="function")return!1;if(i===null)return!1;return"then"in i&&typeof i.then==="function"}function G(i){try{let $=i();if($ instanceof Promise)return $.catch((n)=>L({value:n}));if(tO($))return Promise.resolve($).then((n)=>n,(n)=>L({value:n}));return $}catch($){return L({value:$})}}var ii=class extends Error{constructor(i,$){super(i,$?.cause===void 0?void 0:{cause:$.cause});this.name="FlumeParseError",Object.freeze(this)}},gi=class extends Error{constructor(i,$){super(i,$?.cause===void 0?void 0:{cause:$.cause});this.name="FlumeStartError",Object.freeze(this)}};function d(i){try{let $=i.deps.now();if(typeof $==="number"&&Number.isFinite($))return $}catch{}try{return Date.now()}catch{return 0}}var Bi=class i{props;constructor($){this.props=$,Object.freeze(this)}debug($){this.emit("debug",$)}info($){this.emit("info",$)}warn($){this.emit("warn",$)}error($){this.emit("error",$)}get handler(){return this.props.handler}child($){return new i({source:$,handler:this.props.handler,deps:this.props.deps})}emit($,n){let g=this.props.handler;if(!g)return;let v={level:$,source:this.props.source,action:n.action,message:n.message,timestamp:d({deps:this.props.deps}),error:n.error,detail:n.detail};try{Promise.resolve(g(v)).catch(()=>{})}catch{}}};function ai(i){try{Promise.resolve(i.fn()).catch(($)=>{try{i.onError(L({value:$}))}catch{}}).catch(()=>{})}catch($){try{i.onError(L({value:$}))}catch{}}}var AI=class{props;chain=Promise.resolve();depth=0;cancelled=!1;constructor(i={}){this.props=i}add(i){if(this.cancelled)return Promise.resolve();if(this.props.maxDepth!==void 0&&this.depth>=this.props.maxDepth)return this.props.onOverflow?.({dropped:1,depth:this.depth}),Promise.resolve();this.depth++;let $=this.chain.then(async()=>{try{if(!this.cancelled)await i()}catch{}finally{this.depth--}});return this.chain=$,$}async drain(){while(!0){let i=this.chain;if(await i,this.chain===i)return}}cancel(){this.cancelled=!0}size(){return this.depth}isCancelled(){return this.cancelled}},cO=class{props;currentStatus="disconnected";currentDetail=null;constructor(i){this.props=i}get value(){return this.currentStatus}set(i,$){let n=$??null;if(this.currentStatus===i&&this.currentDetail===n)return;let g=this.currentStatus,v=$?` (${$})`:"";this.props.log.info({action:"status",message:`${g} \u2192 ${i}${v}`,detail:{from:g,to:i,reason:n}}),this.currentStatus=i,this.currentDetail=n;let r=this.props.onStatus;if(!r)return;ai({fn:$!==void 0?()=>r(i,$):()=>r(i),onError:(b)=>{this.props.log.error({action:"onStatus.error",message:P({error:b}),error:b})}})}},k$=class{consumed=!1;stopped=!1;stopPromise=null;ctx=null;statusEmitter=null;abortHandler=null;queue=new AI;async start(i){if(this.consumed)return new gi(`${this.name}: already started`);if(this.stopped)return new gi(`${this.name}: already stopped`);if(this.consumed=!0,this.ctx=i,this.statusEmitter=new cO({log:i.log,onStatus:i.onStatus}),this.isSignalAborted(i))return new gi(`${this.name}: aborted before connect`);this.attachAbortListener(i);let $=await G(async()=>await this.connect(i));return this.detachAbortListener(i),$ instanceof Error?L({value:$}):$}async stop(){if(this.stopPromise!==null)return this.stopPromise;return this.stopped=!0,this.stopPromise=this.runStop(),this.stopPromise}async runStop(){let i=await G(async()=>{await this.disconnect()});return await this.queue.drain(),this.statusEmitter?.set("disconnected"),this.ctx=null,i instanceof Error?i:null}status(){return this.statusEmitter?.value??"disconnected"}emit(i){let $=this.ctx;if(!$)return;this.queue.add(async()=>{let n=await G(()=>Promise.resolve($.onEvent(i)));if(n instanceof Error)$.log.error({action:"onEvent.error",message:P({error:n}),error:n})})}setStatus(i,$){this.statusEmitter?.set(i,$)}get currentStatus(){return this.statusEmitter?.value??"disconnected"}get context(){return this.ctx}isSignalAborted(i){let $=i.signal;if(!$)return!1;let n=G(()=>$.aborted===!0);return n instanceof Error?!0:n}attachAbortListener(i){let $=i.signal;if(!$)return;let n=()=>{G(async()=>{await this.stop()})},g=G(()=>$.addEventListener("abort",n,{once:!0}));if(g instanceof Error){i.log.warn({action:"signal.addListener.failed",message:P({error:g}),error:g});return}this.abortHandler=n}detachAbortListener(i){let $=this.abortHandler;if(!$)return;this.abortHandler=null;let n=i.signal;if(!n)return;G(()=>n.removeEventListener("abort",$))}};var T=class extends Error{code;constructor(i,$){super(i,$?.cause===void 0?void 0:{cause:$.cause});this.name="FlumeConnectionError",this.code=$?.code??null,Object.freeze(this)}};function ir(i){try{let $=i.deps.random();if(typeof $==="number"&&Number.isFinite($)&&$>=0&&$<1)return $}catch{}try{let $=Math.random();if(typeof $==="number"&&Number.isFinite($)&&$>=0&&$<1)return $;return 0.5}catch{return 0.5}}var CO=2147483647,$r=class{props;currentAttempt=0;isAborted=!1;timer=null;generation=0;constructor(i){this.props=i}get attempt(){return this.currentAttempt}get aborted(){return this.isAborted}schedule(i,$){if(this.isAborted)return{kind:"refused"};if(this.currentAttempt>=this.props.maxAttempts)return this.generation++,this.clearTimer(),{kind:"exhausted"};this.clearTimer();let n=this.computeDelay($?.minDelayMs??0),g=++this.generation,v=G(()=>this.props.deps.setTimeout(()=>this.runRetry(i,g),n));if(v instanceof Error)return this.props.log.error({action:"reconnect.timer.schedule.error",message:P({error:v}),error:v}),this.timer=null,{kind:"refused"};return this.currentAttempt++,this.timer=v,{kind:"scheduled",delayMs:n}}reset(){this.currentAttempt=0}cancel(){this.isAborted=!0,this.generation++,this.clearTimer()}runRetry(i,$){if(this.isAborted)return;if($!==this.generation)return;this.timer=null,ai({fn:i,onError:(n)=>{this.props.log.error({action:"reconnect.timer.error",message:P({error:n}),error:n})}})}clearTimer(){if(this.timer===null)return;let i=this.timer,$=G(()=>this.props.deps.clearTimeout(i));if($ instanceof Error)this.props.log.error({action:"reconnect.timer.clear.error",message:P({error:$}),error:$});this.timer=null}computeDelay(i){let $=Math.min(this.props.baseDelay*2**this.currentAttempt,this.props.maxDelay)*(0.5+ir({deps:this.props.deps})*0.5);return Math.min(Math.max($,Number.isFinite(i)&&i>0?i:0),CO)}};function vr(i){if(!i.reconnector){i.log.info({action:"reconnect.disabled",message:"reconnect is disabled, staying disconnected"}),i.setStatus("disconnected");return}if(i.reconnector.aborted){i.log.info({action:"reconnect.aborted",message:"reconnector cancelled, staying disconnected"}),i.setStatus("disconnected");return}let $=i.reconnector.schedule(i.retry,{minDelayMs:i.minDelayMs});if($.kind==="exhausted"){let n=new T(`reconnect exhausted after ${i.reconnector.attempt} attempts`);i.log.error({action:"reconnect.exhausted",message:P({error:n}),error:n}),i.setStatus("disconnected");return}if($.kind==="refused"){let n=new T("reconnect timer could not be scheduled");i.log.error({action:"reconnect.refused",message:P({error:n}),error:n}),i.setStatus("disconnected");return}i.setStatus("reconnecting"),i.log.info({action:"reconnect.scheduled",message:`next attempt in ${Math.round($.delayMs)}ms`,detail:{attempt:i.reconnector.attempt,delayMs:Math.round($.delayMs)}})}function nr(i){let $=G(()=>JSON.stringify(i));if($ instanceof Error)return $;if(typeof $!=="string")return new ii("value is not JSON-serializable (undefined / function / symbol)");return $}function li(i){return typeof i==="object"&&i!==null}function w$(i){try{return JSON.parse(i)}catch($){return new ii($ instanceof Error?`invalid JSON: ${$.message}`:"invalid JSON",{cause:$})}}var RO=class i{sessionId;resumeUrl;seq;constructor($){this.sessionId=$.sessionId,this.resumeUrl=$.resumeUrl,this.seq=$.seq,Object.freeze(this)}static empty(){return new i({sessionId:null,resumeUrl:null,seq:null})}canResume(){return this.sessionId!==null}withSeq($){return new i({sessionId:this.sessionId,resumeUrl:this.resumeUrl,seq:$})}withReady($,n){return new i({sessionId:$,resumeUrl:n,seq:this.seq})}withReset(){return i.empty()}},FO=class{props;initialTimer=null;intervalTimer=null;ackReceived=!0;generation=0;constructor(i){this.props=i}start(i){this.stop(),this.ackReceived=!0;let $=++this.generation,n=ir({deps:this.props.deps})*i,g=G(()=>this.props.deps.setTimeout(()=>{if($!==this.generation)return;if(this.initialTimer=null,this.safeFire(),$!==this.generation)return;let v=G(()=>this.props.deps.setInterval(()=>{if($===this.generation)this.safeFire()},i));if(v instanceof Error)this.props.log.error({action:"heartbeat.interval.schedule.error",message:P({error:v}),error:v}),this.intervalTimer=null,this.safeZombie();else this.intervalTimer=v},n));if(g instanceof Error)return this.props.log.error({action:"heartbeat.initial.schedule.error",message:P({error:g}),error:g}),this.initialTimer=null,g;else this.initialTimer=g;return null}stop(){if(this.generation++,this.initialTimer!==null){let i=this.initialTimer,$=G(()=>this.props.deps.clearTimeout(i));if($ instanceof Error)this.props.log.error({action:"heartbeat.initial.clear.error",message:P({error:$}),error:$});this.initialTimer=null}if(this.intervalTimer!==null){let i=this.intervalTimer,$=G(()=>this.props.deps.clearInterval(i));if($ instanceof Error)this.props.log.error({action:"heartbeat.interval.clear.error",message:P({error:$}),error:$});this.intervalTimer=null}}ack(){this.ackReceived=!0}request(){this.safeFire()}isRunning(){return this.initialTimer!==null||this.intervalTimer!==null}safeFire(){ai({fn:()=>this.fire(),onError:(i)=>{this.props.log.error({action:"heartbeat.fire.error",message:P({error:i}),error:i})}})}safeZombie(){ai({fn:this.props.onZombie,onError:(i)=>{this.props.log.error({action:"heartbeat.zombie.error",message:P({error:i}),error:i})}})}fire(){if(!this.ackReceived){this.props.onZombie();return}this.ackReceived=!1,this.props.onSend()}},oO=D.object({op:D.number(),d:D.unknown().optional(),s:D.number().nullish(),t:D.string().nullish()});function mO(i){let $=w$(i);if($ instanceof ii)return $;let n=oO.safeParse($);if(!n.success)return new ii(`invalid gateway message frame (${i.length} bytes)`,{cause:n.error});return{op:n.data.op,d:n.data.d??null,s:n.data.s??null,t:n.data.t??null}}var wD="wss://gateway.discord.gg/?v=10&encoding=json",yO="10",hO="json",dO=30000,aO=5000,JD=0,BI=1,PD=2,WD=6,VD=7,XD=9,fD=10,QD=11,jD={[JD]:"DISPATCH",[BI]:"HEARTBEAT",[PD]:"IDENTIFY",[WD]:"RESUME",[VD]:"RECONNECT",[XD]:"INVALID_SESSION",[fD]:"HELLO",[QD]:"HEARTBEAT_ACK"},OD=1,pO=new Set([4004,4010,4011,4012,4013,4014]),eO=new Set([4007,4009]),sO=class{props;log;ws=null;heartbeat=null;currentSession;isStoppedFlag=!1;hasConnected=!1;pendingResolve=null;pendingResolved=!1;invalidSessionTimer=null;handshakeTimer=null;forcedCloseFallbackTimer=null;teardownDone=!1;constructor(i){this.props=i,this.currentSession=i.session??RO.empty(),this.log=new Bi({source:"discord.gateway",handler:i.onLog,deps:i.deps})}get session(){return this.currentSession}get isStopped(){return this.isStoppedFlag}connect(i){let $=this.props.deps.WebSocket;if(!$){let r=new T("WebSocket runtime not available");return this.log.error({action:"ws.error",message:P({error:r}),error:r}),Promise.resolve(r)}let n=this.resolveTargetUrl(i),g=G(()=>new URL(n).hostname),v=g instanceof Error?"unknown":g;return this.log.info({action:"connect.start",message:`host=${v}`}),this.pendingResolved=!1,this.hasConnected=!1,this.teardownDone=!1,new Promise((r)=>{this.pendingResolve=r;let b=G(()=>new $(n));if(b instanceof Error){let I=new T(`WebSocket construction failed: ${P({error:b})}`,{cause:b});this.log.error({action:"ws.construct.error",message:P({error:I}),error:I}),this.ws=null,this.pendingResolved=!0,r(I);return}let u=b;this.ws=u;let U=G(()=>{u.addEventListener("message",(I)=>this.safeOnMessage(I,u)),u.addEventListener("close",(I)=>this.safeOnClose(I)),u.addEventListener("error",()=>this.safeOnError())});if(U instanceof Error){let I=new T(`WebSocket listener registration failed: ${P({error:U})}`,{cause:U});this.log.error({action:"ws.listener.error",message:P({error:I}),error:I}),this.closeSocket({ws:u}),this.ws=null,this.pendingResolved=!0,r(I);return}this.armHandshakeTimer()})}disconnect(){this.log.info({action:"disconnect",message:"shutting down gateway"}),this.isStoppedFlag=!0,this.heartbeat?.stop(),this.clearInvalidSessionTimer(),this.clearForcedCloseFallbackTimer(),this.completeConnect(new T("gateway disconnected before ready")),this.closeSocket({ws:this.ws,code:1000,reason:"shutdown"}),this.ws=null}isConnected(){return this.ws!==null&&this.ws.readyState===OD}resolveTargetUrl(i){if(i===void 0)return wD;let $=G(()=>{let n=new URL(i);return n.searchParams.set("v",yO),n.searchParams.set("encoding",hO),n.toString()});if($ instanceof Error)return this.log.warn({action:"resume.url.invalid",message:`resume url unparseable, dropping session and identifying fresh: ${P({error:$})}`}),this.currentSession=this.currentSession.withReset(),wD;return $}resolveHandshakeTimeoutMs(){let i=this.props.handshakeTimeoutMs;if(typeof i!=="number"||!Number.isFinite(i)||i<=0)return dO;return i}armHandshakeTimer(){this.clearHandshakeTimer();let i=this.resolveHandshakeTimeoutMs(),$=G(()=>this.props.deps.setTimeout(()=>{this.handshakeTimer=null,this.onHandshakeTimeout(i)},i));if($ instanceof Error){let n=new T(`handshake timer scheduling failed: ${P({error:$})}`,{cause:$});this.log.error({action:"handshake.timer.schedule.error",message:P({error:n}),error:n}),this.handshakeTimer=null,this.completeConnect(n),this.forceClose({code:4000,reason:"handshake timer failure"});return}this.handshakeTimer=$}clearHandshakeTimer(){if(this.handshakeTimer===null)return;let i=this.handshakeTimer,$=G(()=>this.props.deps.clearTimeout(i));if($ instanceof Error)this.log.error({action:"handshake.timer.clear.error",message:P({error:$}),error:$});this.handshakeTimer=null}onHandshakeTimeout(i){if(this.pendingResolved)return;let $=new T(`handshake timeout after ${i}ms (no READY/RESUMED)`);this.log.error({action:"handshake.timeout",message:P({error:$}),error:$}),this.completeConnect($),this.forceClose({code:4000,reason:"handshake timeout"})}forceClose(i){this.heartbeat?.stop(),this.closeSocket({ws:i.ws??this.ws,code:i.code,reason:i.reason}),this.armForcedCloseFallback()}armForcedCloseFallback(){if(this.teardownDone)return;if(this.forcedCloseFallbackTimer!==null)return;let i=G(()=>this.props.deps.setTimeout(()=>{this.forcedCloseFallbackTimer=null,this.synthesizeTeardown()},aO));if(i instanceof Error){this.log.error({action:"ws.close.fallback.schedule.error",message:P({error:i}),error:i}),this.forcedCloseFallbackTimer=null,this.synthesizeTeardown();return}this.forcedCloseFallbackTimer=i}clearForcedCloseFallbackTimer(){if(this.forcedCloseFallbackTimer===null)return;let i=this.forcedCloseFallbackTimer,$=G(()=>this.props.deps.clearTimeout(i));if($ instanceof Error)this.log.error({action:"ws.close.fallback.clear.error",message:P({error:$}),error:$});this.forcedCloseFallbackTimer=null}synthesizeTeardown(){if(this.teardownDone)return;if(this.teardownDone=!0,this.log.warn({action:"ws.close.synthesized",message:"close event not received after forced close, synthesizing teardown"}),this.ws=null,this.heartbeat?.stop(),this.clearInvalidSessionTimer(),!this.pendingResolved)this.completeConnect(new T("WebSocket force-closed (no close event)"));if(this.hasConnected&&!this.isStoppedFlag)this.props.onStatus("disconnected")}completeConnect(i){if(this.clearHandshakeTimer(),this.pendingResolved||!this.pendingResolve)return;this.pendingResolved=!0,this.pendingResolve(i)}safeOnMessage(i,$){let n=G(()=>this.onMessage(String(i.data),$));if(n instanceof Error)this.log.error({action:"ws.message.threw",message:P({error:n}),error:n})}safeOnClose(i){let $=G(()=>this.onClose(i));if($ instanceof Error)this.log.error({action:"ws.close.threw",message:P({error:$}),error:$})}safeOnError(){let i=G(()=>this.onError());if(i instanceof Error)this.log.error({action:"ws.error.threw",message:P({error:i}),error:i})}onMessage(i,$){if(this.isStoppedFlag)return;let n=mO(i);if(n instanceof ii){this.log.error({action:"ws.parse.error",message:n.message,error:n,detail:{length:i.length}});return}if(this.log.debug({action:"ws.recv",message:`op=${jD[n.op]??n.op} t=${n.t??"-"} s=${n.s??"-"} length=${i.length}`,detail:{op:n.op,t:n.t,s:n.s,length:i.length}}),typeof n.s==="number")this.currentSession=this.currentSession.withSeq(n.s);if(n.op===fD)return this.onHello(n);if(n.op===QD)return this.onHeartbeatAck();if(n.op===BI)return this.onHeartbeatRequest();if(n.op===VD)return this.onReconnectRequest($);if(n.op===XD)return this.onInvalidSession(n,$);if(n.op===JD)return this.onDispatch(n);this.log.warn({action:"ws.op.unknown",message:`unknown op=${n.op}`,detail:{op:n.op}})}onHello(i){let $=li(i.d)?i.d:null,n=$===null?null:$.heartbeat_interval;if(typeof n!=="number"||!Number.isFinite(n)||n<=0){let r=new T("malformed HELLO: heartbeat_interval is not a finite number > 0");this.log.error({action:"gateway.hello.invalid",message:P({error:r}),error:r,detail:{intervalType:typeof n}}),this.completeConnect(r),this.forceClose({code:4000,reason:"malformed HELLO"});return}let g=n;this.log.info({action:"gateway.hello",message:`heartbeat_interval=${g}ms`,detail:{interval:g}}),this.heartbeat?.stop(),this.heartbeat=new FO({log:this.log,deps:this.props.deps,onSend:()=>{this.log.debug({action:"heartbeat.send",message:`seq=${this.currentSession.seq}`}),this.send({op:BI,d:this.currentSession.seq})},onZombie:()=>{this.log.warn({action:"heartbeat.zombie",message:"no ACK received, closing connection"}),this.forceClose({code:4000,reason:"zombie connection"})}});let v=this.heartbeat.start(g);if(v instanceof Error){let r=new T(`heartbeat timer scheduling failed: ${P({error:v})}`,{cause:v});this.completeConnect(r),this.forceClose({code:4000,reason:"heartbeat timer failure"});return}if(this.currentSession.canResume())this.sendResume();else this.sendIdentify()}onHeartbeatAck(){this.log.debug({action:"heartbeat.ack",message:"received"}),this.heartbeat?.ack()}onHeartbeatRequest(){this.log.debug({action:"heartbeat.requested",message:"server requested heartbeat"}),this.heartbeat?.request()}onReconnectRequest(i){this.log.info({action:"ws.reconnect.requested",message:"server requested reconnect"}),this.forceClose({ws:i,code:4000,reason:"reconnect requested"})}onInvalidSession(i,$){let n=i.d===!0||li(i.d)&&i.d.resumable===!0;this.log.warn({action:"session.invalid",message:`resumable=${n}`,detail:{resumable:n}});let g=1000+ir({deps:this.props.deps})*4000;if(!n)this.currentSession=this.currentSession.withReset();this.clearInvalidSessionTimer();let v=G(()=>this.props.deps.setTimeout(()=>{this.invalidSessionTimer=null,this.forceClose({ws:$,code:4000,reason:"invalid session"})},g));if(v instanceof Error)this.log.error({action:"session.invalid.timer.error",message:P({error:v}),error:v}),this.invalidSessionTimer=null,this.forceClose({ws:$,code:4000,reason:"invalid session timer failure"});else this.invalidSessionTimer=v}onDispatch(i){let $=li(i.d)?i.d:null;if(i.t==="READY"&&$){let n=typeof $.session_id==="string"?$.session_id:"",g=typeof $.resume_gateway_url==="string"?$.resume_gateway_url:"";this.currentSession=this.currentSession.withReady(n,g),this.log.info({action:"gateway.ready",message:"session ready",detail:{hasResumeUrl:g!==""}}),this.hasConnected=!0,this.props.onStatus("connected"),this.completeConnect(null)}if(i.t==="RESUMED")this.log.info({action:"gateway.resumed",message:`seq=${this.currentSession.seq}`}),this.hasConnected=!0,this.props.onStatus("connected"),this.completeConnect(null);if(i.t&&$)this.props.onDispatch(i.t,$);else if(i.t)this.log.debug({action:"dispatch.empty",message:`dropped ${i.t} (no payload)`,detail:{type:i.t}})}onClose(i){if(this.clearForcedCloseFallbackTimer(),this.teardownDone){this.log.debug({action:"ws.close.stale",message:`ignored close after synthesized teardown (code=${i.code})`,detail:{code:i.code}});return}this.teardownDone=!0;let $=pO.has(i.code);if(this.log.info({action:"ws.close",message:`code=${i.code} reason=${i.reason||"none"}${$?" (terminal)":""}`,detail:{code:i.code,reason:i.reason,terminal:$}}),this.ws=null,this.heartbeat?.stop(),this.clearInvalidSessionTimer(),eO.has(i.code))this.log.info({action:"session.reset",message:`close code ${i.code} invalidates session, next attempt will identify`,detail:{code:i.code}}),this.currentSession=this.currentSession.withReset();if($)this.isStoppedFlag=!0;if(this.hasConnected||$)this.props.onStatus("disconnected");if(!this.pendingResolved){let n=new T(`WebSocket closed before ready (code=${i.code})`,{code:i.code});this.completeConnect(n)}}onError(){let i=new T("WebSocket connection error");this.log.error({action:"ws.error",message:P({error:i}),error:i}),this.completeConnect(i)}clearInvalidSessionTimer(){if(this.invalidSessionTimer===null)return;let i=this.invalidSessionTimer,$=G(()=>this.props.deps.clearTimeout(i));if($ instanceof Error)this.log.error({action:"session.invalid.timer.clear.error",message:P({error:$}),error:$});this.invalidSessionTimer=null}closeSocket(i){if(i.ws===null)return;let $=i.ws,n=G(()=>{if(i.code!==void 0)$.close(i.code,i.reason??"");else $.close()});if(n instanceof Error)this.log.error({action:"ws.close.error",message:P({error:n}),error:n})}send(i){let $=this.safeSerialize(i);if($===null)return;this.log.debug({action:"ws.send",message:`op=${jD[i.op]??i.op} length=${$.length}`,detail:{op:i.op,length:$.length}});let n=this.ws;if(n===null){this.log.warn({action:"ws.send",message:"ws.send skipped: socket is null"});return}if(n.readyState!==OD){this.log.warn({action:"ws.send",message:`ws.send skipped: readyState=${n.readyState} (not OPEN)`,detail:{readyState:n.readyState}});return}let g=G(()=>n.send($));if(g instanceof Error)this.log.error({action:"ws.send",message:`ws.send failed: ${P({error:g})}`,error:g})}safeSerialize(i){let $=nr({op:i.op,d:i.d??null});if($ instanceof Error)return this.log.error({action:"ws.send.serialize.error",message:P({error:$}),error:$,detail:{op:i.op}}),null;return $}sendIdentify(){this.log.info({action:"gateway.identify",message:`intents=${this.props.intents}`}),this.send({op:PD,d:{token:this.props.token,intents:this.props.intents,properties:{os:"linux",browser:"open-flume",device:"open-flume"}}})}sendResume(){this.log.info({action:"gateway.resume",message:`seq=${this.currentSession.seq}`}),this.send({op:WD,d:{token:this.props.token,session_id:this.currentSession.sessionId,seq:this.currentSession.seq}})}},pi={Guilds:1,GuildMembers:2,GuildModeration:4,GuildExpressions:8,GuildIntegrations:16,GuildWebhooks:32,GuildInvites:64,GuildVoiceStates:128,GuildPresences:256,GuildMessages:512,GuildMessageReactions:1024,GuildMessageTyping:2048,DirectMessages:4096,DirectMessageReactions:8192,DirectMessageTyping:16384,MessageContent:32768,GuildScheduledEvents:65536,AutoModerationConfiguration:1048576,AutoModerationExecution:2097152,GuildMessagePolls:16777216,DirectMessagePolls:33554432};function iJ(i,$){let n={event_type:i};if(typeof $.channel_id==="string")n.channel_id=$.channel_id;if(typeof $.guild_id==="string")n.guild_id=$.guild_id;if(typeof $.user_id==="string")n.user_id=$.user_id;else if(li($.author)&&typeof $.author.id==="string")n.user_id=$.author.id;return n}var $J=pi.Guilds|pi.GuildMessages|pi.DirectMessages,vJ=5000,KD=class extends k${options;name="discord";gateway=null;reconnector=null;constructor(i){super();this.options=i}async connect(i){if(!this.hasWebSocket(i))return new gi("Discord source: deps.WebSocket is null (no WebSocket runtime available)");if(i.reconnect&&!this.reconnector)this.reconnector=new $r({...i.reconnect,log:i.log,deps:i.deps});return await this.connectInternal(i)}disconnect(){if(this.reconnector&&!this.reconnector.aborted)this.context?.log.debug({action:"reconnect.cancel",message:"aborting reconnector"});this.reconnector?.cancel(),this.gateway?.disconnect(),this.gateway=null}hasWebSocket(i){let $=G(()=>Boolean(i.deps.WebSocket));if($ instanceof Error){let n=L({value:$});return i.log.error({action:"deps.web-socket.read.error",message:P({error:n}),error:n}),!1}return $}async connectInternal(i,$){this.setStatus("connecting");let n=new sO({token:this.options.token,intents:this.options.intents??$J,handshakeTimeoutMs:this.options.handshakeTimeoutMs,session:$,onLog:i.log.handler,deps:i.deps,onDispatch:(r,b)=>this.dispatch(i,r,b),onStatus:(r)=>this.handleGatewayStatus(i,n,r)});this.gateway=n;let g=$!==void 0&&$.canResume()&&$.resumeUrl!==null?$.resumeUrl:void 0,v=await n.connect(g);if(v instanceof T){if(i.log.error({action:"connect.failed",message:P({error:v}),error:v}),n.isStopped||!this.reconnector||this.reconnector.aborted)return this.setStatus("disconnected"),v;this.scheduleReconnect(i,n)}return null}dispatch(i,$,n){this.emit({source:"discord",type:$,data:n,meta:this.safeExtractMeta(i,$,n),receivedAt:d({deps:i.deps})})}safeExtractMeta(i,$,n){let g=G(()=>iJ($,n));if(g instanceof Error){let v=L({value:g});return i.log.warn({action:"meta.extract.error",message:P({error:v}),error:v,detail:{eventName:$}}),{event_type:$}}return g}handleGatewayStatus(i,$,n){if($!==this.gateway){i.log.debug({action:"gateway.status.stale",message:`ignored ${n} from replaced gateway`});return}if(n==="connected"){if(this.reconnector&&this.reconnector.attempt>0)i.log.info({action:"reconnect.reset",message:`cleared ${this.reconnector.attempt} attempts`});this.reconnector?.reset(),this.setStatus("connected");return}if($.isStopped){this.setStatus("disconnected");return}this.scheduleReconnect(i,$)}scheduleReconnect(i,$){let n=$.session.canResume()?$.session:void 0;vr({reconnector:this.reconnector,log:i.log,setStatus:(g)=>this.setStatus(g),minDelayMs:n===void 0?vJ:void 0,retry:()=>{this.connectInternal(i,n).catch((g)=>{let v=L({value:g});i.log.error({action:"reconnect.unhandled",message:P({error:v}),error:v}),this.setStatus("disconnected")})}})}};var E=(i)=>{return i instanceof Error?i.message:String(i)};class lI{ownUserId;constructor(i){this.ownUserId=i.ownUserId}process(i){if(i.authorIsBot)return{skip:!0};let $=this.ownUserId?i.mentionedUserIds.includes(this.ownUserId):!1;return{skip:!1,content:JSON.stringify(i.raw),meta:{event_type:"discord",channel_id:i.channelId,user_id:i.authorId,mentioned:String($),guild_id:i.guildId??""}}}}var o=class extends Error{status;code;retryAfterMs;constructor(i){super(i.message,i.cause===void 0?void 0:{cause:i.cause});this.name="FlumeHttpError",this.status=i.status,this.code=i.code??null,this.retryAfterMs=i.retryAfterMs??null,Object.freeze(this)}};function nJ(){let i=G(()=>globalThis.WebSocket);if(i instanceof Error||typeof i!=="function")return null;return i}function TI(){return{fetch:(i,$)=>globalThis.fetch(i,$),get WebSocket(){return nJ()},now:()=>Date.now(),random:()=>Math.random(),setTimeout:(i,$)=>globalThis.setTimeout(i,$),clearTimeout:(i)=>globalThis.clearTimeout(i),setInterval:(i,$)=>globalThis.setInterval(i,$),clearInterval:(i)=>globalThis.clearInterval(i)}}function LI(){return{value:void 0,done:!0}}var gJ=class{props;items=[];resolvers=[];closed=!1;droppedCount=0;constructor(i){this.props=i}push(i){if(this.closed)return;let $=this.resolvers.shift();if($){$({value:i,done:!1});return}if(this.items.length>=this.props.buffer){if(this.recordDrop(),this.props.onOverflow==="drop-newest")return;this.items.shift()}this.items.push(i)}close(){if(this.closed)return;this.closed=!0;while(this.resolvers.length>0){let i=this.resolvers.shift();if(i)i(LI())}}get dropped(){return this.droppedCount}next(){let i=this.items.shift();if(i!==void 0)return Promise.resolve({value:i,done:!1});if(this.closed)return Promise.resolve(LI());return new Promise(($)=>this.resolvers.push($))}return(){return this.items.splice(0),this.close(),this.props.onClose(),Promise.resolve(LI())}throw(i){return this.items.splice(0),this.close(),this.props.onClose(),Promise.reject(i)}[Symbol.asyncIterator](){return this}recordDrop(){if(this.droppedCount++,this.droppedCount>1)return;this.props.onDrop?.({dropped:1})}},YD=1000;function rJ(i){if(typeof i!=="number"||!Number.isFinite(i))return YD;if(i<1)return 1;return Math.floor(i)}var bJ=class{props;streams=new Set;startupItems=[];startupDropNotified=!1;hasSubscribed=!1;closed=!1;constructor(i={}){this.props=i}get isClosed(){return this.closed}publish(i){if(this.closed)return;if(!this.hasSubscribed){if(this.startupItems.length>=YD){if(this.startupItems.shift(),!this.startupDropNotified)this.startupDropNotified=!0,this.props.onDrop?.({dropped:1})}this.startupItems.push(i);return}for(let $ of this.streams)$.push(i)}subscribe(i){let $=new gJ({buffer:rJ(i?.buffer),onOverflow:i?.onOverflow??"drop-oldest",onClose:()=>this.streams.delete($),onDrop:this.props.onDrop});if(this.closed)return $.close(),$;if(!this.hasSubscribed){this.hasSubscribed=!0;for(let n of this.startupItems)$.push(n);this.startupItems.splice(0)}return this.streams.add($),$}close(){if(this.closed)return;this.closed=!0;for(let i of this.streams)i.close();this.streams.clear(),this.startupItems.splice(0)}},GD=class{kind="closed";finalStatuses;closeErrors;constructor(i){this.finalStatuses=Object.freeze(i.finalStatuses.map(($)=>Object.freeze({...$}))),this.closeErrors=Object.freeze(i.closeErrors.map(($)=>Object.freeze({...$}))),Object.freeze(this)}statuses(){return this.finalStatuses}errors(){return this.closeErrors}},uJ=class{props;kind="running";closePromise=null;onAbort;constructor(i){this.props=i,this.onAbort=()=>{this.props.log.info({action:"flume.abort",message:"signal aborted, closing"}),ai({fn:()=>this.close(),onError:(n)=>{this.props.log.error({action:"flume.abort.close.failed",message:P({error:n}),error:n})}})};let $=i.signal;if($){let n=G(()=>$.addEventListener("abort",this.onAbort,{once:!0}));if(n instanceof Error){let g=L({value:n});i.log.error({action:"signal.addListener.failed",message:P({error:g}),error:g})}}}close(){if(this.closePromise)return this.closePromise;return this.closePromise=this.runClose(),this.closePromise}statuses(){return this.snapshotStatuses()}stream(i){return this.props.hub.subscribe(i)}get signal(){return this.props.signal}async runClose(){let i=[];try{this.props.log.info({action:"flume.close",message:`closing ${this.props.sources.length} source(s)`});let $=await Promise.allSettled(this.props.sources.map((g)=>Promise.resolve().then(()=>g.stop())));for(let[g,v]of $.entries()){let r=this.props.sources[g],b=r?this.sourceName(r):"?",u=v.status==="rejected"?L({value:v.reason}):v.value instanceof Error?v.value:null;if(u===null)continue;i.push({source:b,error:u}),this.props.log.error({action:"flume.close.failed",message:`${b}: ${P({error:u})}`,error:u,detail:{source:b}})}let n=this.props.signal;if(n){let g=G(()=>n.removeEventListener("abort",this.onAbort));if(g instanceof Error){let v=L({value:g});this.props.log.error({action:"signal.removeListener.failed",message:P({error:v}),error:v})}}return await this.props.callbackQueue.drain(),this.props.log.info({action:"flume.close.complete",message:"all sources closed"}),await this.props.callbackQueue.drain(),this.props.hub.close(),new GD({finalStatuses:this.snapshotStatuses(),closeErrors:i})}catch($){let n=L({value:$});return this.props.log.error({action:"flume.close.unhandled",message:P({error:n}),error:n}),this.props.hub.close(),new GD({finalStatuses:this.snapshotStatuses(),closeErrors:i})}}snapshotStatuses(){return this.props.sources.map((i)=>{let $=this.sourceName(i),n=G(()=>i.status());if(n instanceof Error){let g=L({value:n});return this.props.log.error({action:"source.status.failed",message:`${$}: ${P({error:g})}`,error:g,detail:{source:$}}),{source:$,status:"disconnected"}}return{source:$,status:n}})}sourceName(i){let $=G(()=>i.name);if($ instanceof Error)return"?";if(typeof $!=="string")return"?";return $}},p$={maxAttempts:1/0,baseDelay:1000,maxDelay:30000};function UJ(i){if(typeof i!=="number"||!Number.isFinite(i))return p$.baseDelay;if(i<1)return p$.baseDelay;return i}function IJ(i,$){if(typeof i!=="number"||!Number.isFinite(i))return Math.max(p$.maxDelay,$);if(i<$)return $;return i}function _J(i){if(typeof i!=="number"||Number.isNaN(i))return p$.maxAttempts;if(i===1/0)return 1/0;if(!Number.isInteger(i)||i<1)return p$.maxAttempts;return i}function DJ(i){if(i===!1||i===void 0)return null;if(i===!0)return{...p$};let $=UJ(i.baseDelay);return{maxAttempts:_J(i.maxAttempts),baseDelay:$,maxDelay:IJ(i.maxDelay,$)}}var HD=class{options;consumed=!1;log;deps;sources;sourceEventHandler;hub;callbackQueue=new AI;constructor(i){this.options=i,this.sources=[...i.sources],this.deps=i.deps??TI(),this.hub=new bJ({onDrop:()=>this.notifyStreamOverflow()}),this.log=new Bi({source:"flume",handler:this.buildLogHandler(),deps:this.deps}),this.sourceEventHandler=($)=>this.emitItem({kind:"event",event:$})}notifyStreamOverflow(){if(!this.options.onEvent)return;let i={level:"warn",source:"flume",action:"stream.overflow",message:"stream buffer overflowed, dropping items (notified once per stream; see FlumeStreamOptions.buffer)",timestamp:d({deps:this.deps})};this.enqueueCallback({kind:"log",log:i})}buildLogHandler(){return(i)=>{this.emitItem({kind:"log",log:i});let $=this.options.onError;if(!$||i.level!=="error")return;try{Promise.resolve($(i)).catch(()=>{})}catch{}}}emitItem(i){if(this.hub.isClosed)return Promise.resolve();return this.hub.publish(i),this.enqueueCallback(i)}enqueueCallback(i){let $=this.options.onEvent;if(!$)return Promise.resolve();return this.callbackQueue.add(async()=>{await G(()=>Promise.resolve($(i)))})}async open(){let i=this.guardOpen();if(i)return i;this.consumed=!0,this.log.info({action:"flume.open",message:`opening ${this.sources.length} source(s)`,detail:{count:this.sources.length}});let $=this.resolveReconnect(),n=await Promise.allSettled(this.sources.map((b)=>this.safeStart(b,$))),g=[];for(let[b,u]of n.entries()){let U=this.sources[b];if(U===void 0)continue;let I=this.sourceName(U);if(u.status==="rejected"){g.push({name:I,error:L({value:u.reason})});continue}if(u.value instanceof Error)g.push({name:I,error:u.value})}if(g.length>0){for(let U of g)this.log.error({action:"flume.source.failed",message:`${U.name}: ${P({error:U.error})}`,error:U.error,detail:{source:U.name}});await this.rollback(this.sources);let b=g.map((U)=>`${U.name}: ${P({error:U.error})}`).join("; "),u=new gi(`Flume.open: ${g.length} source(s) failed: ${b}`);return this.log.error({action:"flume.open.failed",message:P({error:u}),error:u}),await this.callbackQueue.drain(),u}if(this.isSignalAborted()){await this.rollback(this.sources);let b=new gi("Flume.open: aborted during open");return this.log.warn({action:"flume.open.aborted",message:P({error:b}),error:b}),await this.callbackQueue.drain(),b}if(this.log.info({action:"flume.open.complete",message:"all sources opened"}),await this.callbackQueue.drain(),this.isSignalAborted()){await this.rollback(this.sources);let b=new gi("Flume.open: aborted during completion");return this.log.warn({action:"flume.open.aborted",message:P({error:b}),error:b}),await this.callbackQueue.drain(),b}let v=new uJ({sources:this.sources,signal:this.options.signal,log:this.log,hub:this.hub,callbackQueue:this.callbackQueue});if(!this.isSignalAborted())return v;await v.close();let r=new gi("Flume.open: aborted while entering running state");return this.log.warn({action:"flume.open.aborted",message:P({error:r}),error:r}),await this.callbackQueue.drain(),r}guardOpen(){if(this.consumed){let i=new gi("Flume.open: already opened");return this.log.warn({action:"flume.open.refused",message:P({error:i}),error:i}),i}if(this.isSignalAborted()){let i=new gi("Flume.open: signal already aborted");return this.log.warn({action:"flume.open.refused",message:P({error:i}),error:i}),i}return null}resolveReconnect(){let i=G(()=>DJ(this.options.reconnect));if(i instanceof Error)return this.log.warn({action:"reconnect.config.invalid",message:P({error:i}),error:i}),null;return i}isSignalAborted(){let i=this.options.signal;if(!i)return!1;let $=G(()=>i.aborted===!0);return $ instanceof Error?!0:$}sourceName(i){let $=G(()=>i.name);if($ instanceof Error)return"?";if(typeof $!=="string")return"?";return $}safeStart(i,$){let n=this.sourceName(i),g={onEvent:this.sourceEventHandler,log:this.log.child(n),deps:this.deps,reconnect:$,signal:this.options.signal};return Promise.resolve().then(()=>i.start(g))}async rollback(i){let $=await Promise.allSettled(i.map((n)=>Promise.resolve().then(()=>n.stop())));for(let[n,g]of $.entries()){let v=i[n],r=v?this.sourceName(v):"?";if(g.status==="rejected"){let b=L({value:g.reason});this.logRollbackFailure(r,b);continue}if(g.value instanceof Error)this.logRollbackFailure(r,g.value)}}logRollbackFailure(i,$){this.log.error({action:"flume.rollback.failed",message:`${i}: ${P({error:$})}`,error:$,detail:{source:i}})}};var e$=(i)=>{if(!i||Object.keys(i).length===0)return;return{...TI(),...i}},s$=(i)=>{if(!i)return;return($)=>{if($.level==="debug")return;let n=`${$.source}/${$.action}: ${$.message}`,g=kJ($);if($.level==="error"){i.error(n,g);return}if($.level==="warn"){i.warn(n,g);return}i.info(n,g)}},kJ=(i)=>{let $={...i.detail};if(i.error){if($.error=i.error.message,i.error.stack)$.stack=i.error.stack;if(i.error.name&&i.error.name!=="Error")$.errorName=i.error.name}return Object.keys($).length>0?$:void 0};class ov{isAlive(){return!0}}class mv{props;constructor(i){this.props=i;Object.freeze(this)}recordRaw(i,$){this.props.log?.recordRaw({eventId:i,type:this.props.type,connectorId:this.props.connectorId,channelId:this.props.channelId,payload:$})}recordProcessed(i,$,n){this.props.log?.recordProcessed({eventId:i,type:this.props.type,connectorId:this.props.connectorId,channelId:this.props.channelId,outcome:$,payload:n})}recordConnection(i,$){this.props.log?.recordConnection({type:this.props.type,connectorId:this.props.connectorId,channelId:this.props.channelId,status:i,detail:$})}}class j$ extends ov{logger;diagnostics;type;running=null;connected=!1;reconnecting=!1;deliveryChain=Promise.resolve();constructor(i){super();this.type=i.type,this.logger=i.logger,this.diagnostics=new mv({type:i.type,connectorId:i.connectorId,channelId:i.channelId,log:i.diagnosticLog})}async runStart(i){let $=i.reconnect??!0,n=$===!1?void 0:$===!0?{}:$,g=(u)=>{if(u.kind==="event"){this.deliveryChain=this.deliveryChain.catch(()=>{}).then(()=>Promise.resolve(i.onEvent(u.event)));return}let U=u.log,I=OJ(U);if(I)this.handleStatus(I);i.onLog?.(U)},v={sources:[i.source],onEvent:g};if(i.deps)v.deps=i.deps;if(i.signal)v.signal=i.signal;if(n)v.reconnect=n;let b=await new HD(v).open();if(b instanceof Error)throw this.diagnostics.recordConnection("error",E(b)),b;this.running=b}async stop(){if(!this.running)return;try{await this.running.close(),this.diagnostics.recordConnection("disconnected","")}catch(i){this.diagnostics.recordConnection("error",E(i)),this.logger?.error(`${this.type} stop error`,{error:E(i)})}finally{this.running=null,this.connected=!1,this.reconnecting=!1,this.deliveryChain=Promise.resolve(),this.onStop(),this.diagnostics.recordConnection("stopped","")}}isAlive(){if(this.running===null)return!1;return this.connected||this.reconnecting}handleStatus(i){if(i.status==="connected"){this.connected=!0,this.reconnecting=!1,this.diagnostics.recordConnection("connected",i.detail??"");return}if(i.status==="disconnected"){this.connected=!1,this.reconnecting=!1,this.diagnostics.recordConnection("disconnected",i.detail??"");return}if(i.status==="reconnecting")this.connected=!1,this.reconnecting=!0}onStop(){}}var wJ=["disconnected","connecting","connected","reconnecting"],jJ=(i)=>typeof i==="string"&&wJ.includes(i),OJ=(i)=>{if(i.action!=="status")return null;let $=i.detail;if(!$)return null;let n=$.to;if(!jJ(n))return null;let g=typeof $.reason==="string"?$.reason:null;return{source:i.source,status:n,detail:g}};var JJ=["MESSAGE_CREATE","MESSAGE_UPDATE"],ZI=(i)=>typeof i==="object"&&i!==null&&!Array.isArray(i),qI=(i,$)=>{let n=i[$];return typeof n==="string"?n:void 0};class MI extends j${config;env;flumeDeps;signal;eventTypes;processor=null;constructor(i){super({type:"discord",connectorId:i.config.id,channelId:i.channelId??null,logger:i.logger,diagnosticLog:i.diagnosticLog});this.config=i.config,this.env=i.env??process.env,this.flumeDeps=i.flumeDeps??{},this.signal=i.signal,this.eventTypes=i.eventTypes==="all"?"all":new Set(i.eventTypes??JJ)}async start(i){this.diagnostics.recordConnection("started","");let $;try{$=Yi({literal:this.config.botToken,envVar:this.config.botTokenEnv,env:this.env,label:`${this.config.name}.botToken`})}catch(g){throw this.diagnostics.recordConnection("auth-failed",E(g)),g}let n=new KD({token:$,intents:pi.Guilds|pi.GuildMessages|pi.MessageContent|pi.DirectMessages});await this.runStart({source:n,onLog:s$(this.logger),deps:e$(this.flumeDeps),signal:this.signal,onEvent:(g)=>{if(g.source!=="discord")return Promise.resolve();return this.handleEvent(g,i)}})}onStop(){this.processor=null}async handleEvent(i,$){if(i.type==="READY"){this.adoptReady(i.data);return}if(!this.processor){let O=crypto.randomUUID();this.diagnostics.recordRaw(O,JSON.stringify(i.data)),this.diagnostics.recordProcessed(O,"skip:pre-ready","");return}if(this.eventTypes!=="all"&&!this.eventTypes.has(i.type)){let O=crypto.randomUUID();this.diagnostics.recordRaw(O,JSON.stringify(i.data)),this.diagnostics.recordProcessed(O,`skip:filtered:${i.type}`,"");return}let n=i.data,g=ZI(n.author)?n.author:null,v=g!==null&&g.bot===!0,r=i.meta.user_id??"",b=i.meta.channel_id??"",u=i.meta.guild_id??null,U=Array.isArray(n.mentions)?n.mentions.map((O)=>ZI(O)?qI(O,"id")??"":"").filter((O)=>O!==""):[],I=crypto.randomUUID(),_=JSON.stringify(n);this.diagnostics.recordRaw(I,_);let k=this.processor.process({authorId:r,authorIsBot:v,channelId:b,guildId:u,mentionedUserIds:U,raw:n});if(k.skip){this.diagnostics.recordProcessed(I,"skip:bot",_),this.logger?.info("discord skip",{reason:"bot author"});return}await this.deliver($,I,_,k.content,k.meta)}adoptReady(i){let $=ZI(i.user)?qI(i.user,"id"):void 0,n=qI(i,"user_id"),g=$??n??"";if(!g){let v=crypto.randomUUID();this.diagnostics.recordRaw(v,JSON.stringify(i)),this.diagnostics.recordProcessed(v,"skip:ready-missing-user-id",""),this.diagnostics.recordConnection("error","discord READY payload had neither user.id nor user_id; processor not initialized"),this.logger?.error("discord READY missing user id",{connector:this.config.name});return}this.processor=new lI({ownUserId:g})}async deliver(i,$,n,g,v){try{await i(g,v)}catch(r){this.diagnostics.recordProcessed($,"emitted:delivery-failed",g||n),this.logger?.error("discord notify error",{error:E(r)});return}this.diagnostics.recordProcessed($,"emitted",g)}}var O$=(i,$,n,g)=>{let v=n[i];if(typeof v==="string")return{[i]:v};let r=n[$];if(typeof r==="string")return{[$]:r};let b={},u=g[i],U=g[$];if(typeof u==="string")b[i]=u;if(typeof U==="string")b[$]=U;return b};var zD=(i={})=>({type:"discord",toolExposed:!0,createListener($,n){return new MI({config:Ai.parse($),channelId:n.channelId,logger:n.logger,diagnosticLog:n.diagnosticLog,signal:n.signal,eventTypes:i.eventTypes})},createAdapter($,n){return new Br({config:Ai.parse($),http:n.http})},secretTokens($){return[Ai.parse($).botToken].filter((g)=>g!==void 0)},buildConfig($,n){return Ai.parse({id:n.id,type:"discord",name:$.name,...typeof $.botToken==="string"?{botToken:$.botToken}:{},...typeof $.botTokenEnv==="string"?{botTokenEnv:$.botTokenEnv}:{},createdAt:n.now,updatedAt:n.now})},applyUpdate($,n,g){let v=Ai.parse($);return Ai.parse({id:v.id,name:v.name,type:"discord",createdAt:v.createdAt,updatedAt:g.now,...O$("botToken","botTokenEnv",n,v)})},operations:{}});import{openSync as AD}from"fs";function SD(i){let $=[],n=Array.from(i),g="",v=!1,r=0;while(r<n.length){let b=n[r]??"";if(v){if(b==='"'&&n[r+1]==='"'){g+='"',r+=2;continue}if(b==='"'){v=!1,r+=1;continue}g+=b,r+=1;continue}if(b==='"'){v=!0,r+=1;continue}if(b===","){$.push(g),g="",r+=1;continue}g+=b,r+=1}return $.push(g),$}class yv{}var xI=(i)=>{if(!i)return;let $={};for(let[n,g]of Object.entries(process.env))if(typeof g==="string")$[n]=g;for(let[n,g]of Object.entries(i))$[n]=g;return $},NI=()=>process.platform==="win32";class R extends yv{constructor(){super();Object.freeze(this)}runSync(i){let $=Bun.spawnSync(i,{stdout:"pipe",stderr:"pipe"});return{exitCode:$.exitCode??0,stdout:$.stdout.toString(),stderr:$.stderr.toString()}}async run(i,$={}){let n=Bun.spawn(i,{cwd:$.cwd,env:xI($.env),stdin:$.input!==void 0?"pipe":"ignore",stdout:"pipe",stderr:"pipe"});if($.input!==void 0&&n.stdin)n.stdin.write($.input),n.stdin.end();let g=await n.exited,v=await new Response(n.stdout).text(),r=await new Response(n.stderr).text();return{exitCode:g,stdout:v,stderr:r}}async attach(i,$={}){let n=Bun.spawn(i,{cwd:$.cwd,env:xI($.env),stdio:["inherit","inherit","inherit"]});if($.onSpawned)$.onSpawned(n.pid);return await n.exited}detach(i,$={}){let n=$.stdoutFile?AD($.stdoutFile,"a"):"ignore",g=$.stderrFile?$.stderrFile===$.stdoutFile&&typeof n==="number"?n:AD($.stderrFile,"a"):"ignore";Bun.spawn(i,{env:xI($.env),stdio:["ignore",n,g],windowsHide:!0}).unref()}kill(i,$="SIGTERM"){try{process.kill(i,$)}catch{}}isAlive(i){if(!Number.isInteger(i)||i<=0)return!1;if(NI())return this.isAliveWindows(i);return this.isAlivePosix(i)}listProcessesContaining(i){if(!i)return[];if(NI())return this.listProcessesContainingWindows(i);return this.listProcessesContainingPosix(i)}getStartTime(i){if(!Number.isInteger(i)||i<=0)return null;if(NI())return this.getStartTimeWindows(i);return this.getStartTimePosix(i)}isAlivePosix(i){let $=this.runSync(["ps","-p",String(i),"-o","state="]);if($.exitCode!==0)return!1;let n=$.stdout.trim();if(!n)return!1;return!n.startsWith("Z")}isAliveWindows(i){let $=this.runSync(["tasklist","/FI",`PID eq ${i}`,"/NH","/FO","CSV"]);if($.exitCode!==0)return!1;return $.stdout.includes(`"${i}"`)}listProcessesContainingPosix(i){let $=this.runSync(["ps","-e","-o","pid=,args="]);if($.exitCode!==0)return[];let n=[];for(let g of $.stdout.split(`
68
+ `)){let v=g.trim();if(!v)continue;let r=/^(\d+)\s+(.+)$/.exec(v);if(!r)continue;let b=Number(r[1]),u=r[2]??"";if(!Number.isInteger(b)||b<=0)continue;if(!u.includes(i))continue;n.push({pid:b,command:u})}return n}getStartTimePosix(i){let $=this.runSync(["ps","-p",String(i),"-o","lstart="]);if($.exitCode!==0)return null;let n=$.stdout.trim();if(!n)return null;return n}getStartTimeWindows(i){let $=`Get-CimInstance Win32_Process -Filter "ProcessId=${i}" | Select-Object -ExpandProperty CreationDate | ForEach-Object { $_.ToString("o") }`,n=this.runSync(["powershell","-NoProfile","-Command",$]);if(n.exitCode!==0)return null;let g=n.stdout.trim();if(!g)return null;return g}listProcessesContainingWindows(i){let n=this.runSync(["powershell","-NoProfile","-Command","Get-CimInstance Win32_Process | Select-Object ProcessId,CommandLine | ConvertTo-Csv -NoTypeInformation"]);if(n.exitCode!==0)return[];let g=[],v=n.stdout.split(/\r?\n/).slice(1);for(let r of v){let b=r.trim();if(!b)continue;let u=SD(b);if(u.length<2)continue;let U=Number(u[0]),I=u[1]??"";if(!Number.isInteger(U)||U<=0)continue;if(!I.includes(i))continue;g.push({pid:U,command:I})}return g}}var PJ=new R;class EI extends $${process;constructor(i={}){super();this.process=i.process??PJ,Object.freeze(this)}async call(i){let $=["api",i.path];if(i.method&&i.method.toLowerCase()!=="get")$.push("-X",i.method.toUpperCase());let n=i.body&&typeof i.body==="object"&&Object.keys(i.body).length>0;if(n)$.push("--input","-");let g=await this.process.run(["gh",...$],{input:n?JSON.stringify(i.body):void 0});if(g.exitCode!==0)throw Error(`gh api failed: ${g.stderr.trim()||g.stdout.trim()}`);try{return JSON.parse(g.stdout)}catch{return g.stdout}}}var Li=D.object({id:D.string(),name:D.string(),type:D.literal("gh"),pollInterval:D.number().int().positive().optional(),token:D.string().optional(),tokenEnv:D.string().optional(),createdAt:D.string().datetime().optional(),updatedAt:D.string().datetime().optional()});async function hv(i){try{return await i.response.text()}catch($){let n=G(()=>i.response.status),g=typeof n==="number"?n:0;return new o({message:`${i.context}: failed to read body: ${P({error:$})}`,status:g,cause:$})}}function WJ(i){return{event_type:"notification",reason:i.reason,subject_type:i.subject.type,repository:i.repository.full_name,thread_id:i.id}}var VJ=D.object({id:D.string(),reason:D.string(),unread:D.boolean(),updated_at:D.string(),subject:D.object({title:D.string(),url:D.string().nullable(),type:D.string()}),repository:D.object({full_name:D.string()})}),XJ=class{props;seen=new Map;constructor(i){this.props=i}has(i,$){return this.seen.get(i)===$}add(i,$){this.seen.delete(i),this.seen.set(i,$)}trim(){if(this.seen.size<=this.props.maxSize)return;let i=this.seen.size-this.props.maxSize;for(let $ of this.seen.keys()){if(i<=0)break;this.seen.delete($),i--}}get size(){return this.seen.size}},fJ="https://api.github.com/notifications",QJ=3,KJ=5000,BD=1000,tI=2147483647,GJ=class{props;log;cache=new XJ({maxSize:KJ});timer=null;rateLimitTimer=null;rateLimitPauseActive=!1;since=null;etag=null;lastModified=null;bootstrapped=!1;isStoppedFlag=!1;inFlight=!1;consecutiveErrors=0;degraded=!1;effectiveIntervalSec;controller=null;constructor(i){this.props=i,this.log=new Bi({source:"github.poller",handler:i.onLog,deps:i.deps}),this.effectiveIntervalSec=i.interval}get isStopped(){return this.isStoppedFlag}async start(){this.isStoppedFlag=!1;let i=G(()=>new AbortController);if(i instanceof Error)this.log.error({action:"github.abort-controller.new.error",message:P({error:i}),error:i}),this.controller=null;else this.controller=i;this.log.info({action:"poller.start",message:`polling every ${this.effectiveIntervalSec}s`});let $=await this.poll();if($)return $;if(this.isStoppedFlag)return null;if(this.rateLimitPauseActive)return null;return this.scheduleInterval(),null}stop(){this.log.info({action:"poller.stop",message:"stopping poller"}),this.isStoppedFlag=!0,this.controller?.abort(),this.controller=null,this.clearTimer(),this.clearRateLimitTimer(),this.rateLimitPauseActive=!1}scheduleInterval(){this.clearTimer();let i=G(()=>this.props.deps.setInterval(()=>{this.poll().catch(($)=>{let n=L({value:$});this.log.error({action:"poll.unhandled",message:P({error:n}),error:n})})},Math.min(this.effectiveIntervalSec*1000,tI)));if(i instanceof Error){if(this.log.error({action:"poller.interval.schedule.error",message:P({error:i}),error:i}),this.timer=null,!this.isStoppedFlag)this.props.onDisconnected("interval scheduling rejected by runtime");return}this.timer=i}async poll(){if(this.inFlight||this.isStoppedFlag)return null;this.inFlight=!0;try{return await this.pollOnce()}catch(i){let $=L({value:i}),n=new o({message:`poll loop threw: ${P({error:$})}`,status:0,cause:$});if(this.log.error({action:"poll.unhandled",message:P({error:n}),error:n}),!this.bootstrapped)return n;return null}finally{this.inFlight=!1}}async pollOnce(){let i=new URLSearchParams({all:"false",per_page:"50"});if(this.since)i.set("since",this.since);let $=await this.fetchPage(`${fJ}?${i}`,!0);if(this.isStoppedFlag)return null;if($ instanceof Error)return this.recordFailure({kind:"network",message:$.message,cause:$});if(this.followPollIntervalHeader($.headers.get("X-Poll-Interval")),$.status===304)return this.consecutiveErrors=0,this.log.debug({action:"poll.not-modified",message:"304 Not Modified"}),this.notifyRecoveredIfDegraded(),null;if(await this.isRateLimited($))return this.handleRateLimit($),null;if(!$.ok){let r=new o({message:`HTTP ${$.status}`,status:$.status});return this.recordFailure({kind:"http",message:P({error:r}),error:r})}let n=$.headers.get("ETag"),g=$.headers.get("Last-Modified"),v=await this.collectPages($);if(!Array.isArray(v))return v;return this.processNotifications(v),this.consecutiveErrors=0,this.etag=n,this.lastModified=g,this.advanceCursor(),this.notifyRecoveredIfDegraded(),null}async collectPages(i){let $=[],n=i,g=1;while(!0){let v=await this.readPageBody(n);if(this.isStoppedFlag)return null;if(v instanceof Error)return this.recordFailure({kind:"http",message:v.message,error:v});if(v===null)return null;for(let u of v)$.push(u);let r=this.findNextPageUrl(n.headers.get("Link"));if(r===null)return $;if(g>=BD){let u=new o({message:`pagination exceeded the safety limit of ${BD} pages`,status:0});return this.recordFailure({kind:"http",message:u.message,error:u})}let b=await this.fetchPage(r,!1);if(this.isStoppedFlag)return null;if(b instanceof Error)return this.recordFailure({kind:"network",message:b.message,cause:b});if(await this.isRateLimited(b))return this.handleRateLimit(b),null;if(!b.ok){let u=new o({message:`HTTP ${b.status}`,status:b.status});return this.recordFailure({kind:"http",message:P({error:u}),error:u})}n=b,g++}}async fetchPage(i,$){this.log.debug({action:"http.request",message:`GET ${i}`});let n={Authorization:`Bearer ${this.props.token}`,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"};if($&&this.etag)n["If-None-Match"]=this.etag;if($&&this.lastModified)n["If-Modified-Since"]=this.lastModified;let g=await G(()=>this.props.deps.fetch(i,{headers:n,signal:this.controller?.signal}));if(g instanceof Error)return this.log.error({action:"http.error",message:P({error:g}),error:g}),g;return this.log.debug({action:"http.response",message:`GET ${g.status}`,detail:{status:g.status,url:i}}),g}async readPageBody(i){let $=await hv({response:i,context:"notifications"});if($ instanceof o)return this.log.warn({action:"http.body.read",message:P({error:$}),error:$}),$;let n=w$($);if(n instanceof ii)return this.log.warn({action:"http.body.parse",message:n.message,error:n}),null;if(!Array.isArray(n))return this.log.warn({action:"http.body.shape",message:"response body is not an array, dropping",detail:{bodyType:typeof n}}),null;return n}findNextPageUrl(i){if(i===null)return null;for(let $ of i.split(",")){if(!$.includes('rel="next"'))continue;let n=$.match(/<([^>]+)>/)?.[1];if(n!==void 0)return n}return null}recordFailure(i){this.consecutiveErrors++;let $=i.error??new o({message:i.message,status:0,cause:i.cause});if(this.log.error({action:"http.error",message:i.message,error:$,detail:{consecutiveErrors:this.consecutiveErrors}}),this.consecutiveErrors>=QJ&&!this.isStoppedFlag)this.degraded=!0,this.props.onDisconnected(i.kind==="network"?"network error":i.message);if(!this.bootstrapped)return $;return null}notifyRecoveredIfDegraded(){if(!this.degraded)return;this.degraded=!1,this.props.onConnected()}async isRateLimited(i){if(i.status===429)return!0;if(i.status!==403)return!1;if(i.headers.get("Retry-After")!==null)return!0;if(i.headers.get("X-RateLimit-Remaining")==="0")return!0;let $=G(()=>i.clone());if($ instanceof Error)return!1;let n=await hv({response:$,context:"rate limit response"});if(n instanceof Error)return!1;let g=n.toLowerCase();return g.includes("secondary rate limit")||g.includes("abuse detection")}handleRateLimit(i){let $=i.headers.get("Retry-After"),n=i.headers.get("X-RateLimit-Reset"),g=Math.floor(d({deps:this.props.deps})/1000),v=$!==null?Number.parseInt($,10):NaN,r=n!==null?Number.parseInt(n,10)-g:NaN,b=Number.isFinite(v)&&v>0?v:Number.isFinite(r)&&r>0?r:60;this.log.warn({action:"rate.limit",message:`rate limited, pausing for ${b}s`,detail:{status:i.status,delaySec:b}}),this.clearTimer(),this.clearRateLimitTimer(),this.rateLimitPauseActive=!0;let u=G(()=>this.props.deps.setTimeout(()=>{if(this.rateLimitTimer=null,this.rateLimitPauseActive=!1,this.isStoppedFlag)return;this.scheduleInterval(),this.poll().catch((U)=>{let I=L({value:U});this.log.error({action:"poll.unhandled",message:P({error:I}),error:I})})},Math.min(b*1000,tI)));if(u instanceof Error){if(this.log.error({action:"poller.rate-limit.schedule.error",message:P({error:u}),error:u}),this.rateLimitTimer=null,!this.isStoppedFlag)this.props.onDisconnected("rate-limit timer scheduling rejected by runtime")}else this.rateLimitTimer=u}clearTimer(){if(this.timer===null)return;let i=this.timer,$=G(()=>this.props.deps.clearInterval(i));if($ instanceof Error)this.log.error({action:"poller.timer.clear.error",message:P({error:$}),error:$});this.timer=null}clearRateLimitTimer(){if(this.rateLimitTimer===null)return;let i=this.rateLimitTimer,$=G(()=>this.props.deps.clearTimeout(i));if($ instanceof Error)this.log.error({action:"poller.rate-limit.clear.error",message:P({error:$}),error:$});this.rateLimitTimer=null}followPollIntervalHeader(i){if(i===null)return;let $=Number.parseInt(i,10);if(!Number.isFinite($))return;let n=Math.min(Math.max(this.props.interval,$),Math.floor(tI/1000));if(n===this.effectiveIntervalSec)return;if(this.log.info({action:"poll.interval.follow",message:`adjusting interval ${this.effectiveIntervalSec}s -> ${n}s per X-Poll-Interval`,detail:{from:this.effectiveIntervalSec,to:n}}),this.effectiveIntervalSec=n,this.timer!==null)this.scheduleInterval()}processNotifications(i){let $=i.map((r)=>VJ.safeParse(r));for(let r of $){if(r.success)continue;this.log.warn({action:"parse.skip",message:"notification did not match schema",detail:{issues:r.error.issues.map((b)=>({path:b.path,message:b.message}))}})}let n=$.flatMap((r)=>r.success?[r.data]:[]),g=i.length-n.length;if(g>0)this.log.warn({action:"parse.summary",message:`${g}/${i.length} notifications dropped by schema`});if(!this.bootstrapped){this.bootstrapped=!0;for(let r of n)this.cache.add(r.id,r.updated_at);this.log.info({action:"poller.bootstrap",message:`seeded ${n.length} existing notifications`}),this.degraded=!1,this.props.onConnected();return}let v=n.filter((r)=>{if(this.cache.has(r.id,r.updated_at))return!1;return this.cache.add(r.id,r.updated_at),!0});if(this.cache.trim(),v.length>0){this.log.info({action:"poll.fresh",message:`${v.length} new notifications`,detail:{count:v.length}}),this.props.onNotifications(v);return}this.log.debug({action:"poll.idle",message:"0 new notifications"})}advanceCursor(){if(this.lastModified!==null){let n=new Date(this.lastModified);if(!Number.isNaN(n.getTime())){let g=G(()=>n.toISOString());if(!(g instanceof Error)){this.since=g;return}}}let i=d({deps:this.props.deps});if(!Number.isFinite(i)){this.log.warn({action:"cursor.advance.skip",message:"deps.now() returned non-finite, leaving since cursor unchanged"});return}let $=G(()=>new Date(i).toISOString());if($ instanceof Error){let n=L({value:$});this.log.warn({action:"cursor.advance.skip",message:P({error:n}),error:n});return}this.since=$}},cI=60,YJ=Math.floor(2147483.647),lD=class extends k${options;name="github";poller=null;constructor(i){super();this.options=i}async connect(i){this.setStatus("connecting"),this.poller=new GJ({token:this.options.token,interval:this.getPollIntervalSec(),onLog:i.log.handler,deps:i.deps,onNotifications:(n)=>this.handleNotifications(i,n),onConnected:()=>this.setStatus("connected"),onDisconnected:(n)=>this.setStatus("disconnected",n)});let $=await this.poller.start();if($ instanceof Error)return i.log.error({action:"source.start.failed",message:P({error:$}),error:$}),this.setStatus("disconnected",$.message),$;return null}disconnect(){this.poller?.stop(),this.poller=null}getPollIntervalSec(){let i=this.options.pollInterval;if(typeof i!=="number")return cI;if(!Number.isFinite(i))return cI;if(i<=0)return cI;return Math.min(i,YJ)}handleNotifications(i,$){for(let n of $)this.emit({source:"github",type:"notification",data:n,meta:this.safeExtractMeta(i,n),receivedAt:d({deps:i.deps})})}safeExtractMeta(i,$){let n=G(()=>WJ($));if(n instanceof Error){let g=L({value:n});return i.log.warn({action:"meta.extract.error",message:P({error:g}),error:g,detail:{notificationId:$.id}}),{event_type:"notification"}}return n}};var HJ=new R;class CI extends j${config;env;process;flumeDeps;signal;constructor(i){super({type:"gh",connectorId:i.config.id,channelId:i.channelId??null,logger:i.logger,diagnosticLog:i.diagnosticLog});this.config=i.config,this.env=i.env??process.env,this.process=i.process??HJ,this.flumeDeps=i.flumeDeps??{},this.signal=i.signal}async start(i){this.diagnostics.recordConnection("started","");let $;try{$=await this.resolveToken()}catch(g){throw this.diagnostics.recordConnection("auth-failed",E(g)),g}let n=new lD({token:$,pollInterval:this.config.pollInterval??60});await this.runStart({source:n,onLog:s$(this.logger),deps:e$(this.flumeDeps),signal:this.signal,onEvent:(g)=>{if(g.source!=="github")return Promise.resolve();return this.handleEvent(g,i)}})}async resolveToken(){if(this.config.token)return this.config.token;if(this.config.tokenEnv){let $=this.env[this.config.tokenEnv];if(typeof $==="string"&&$!=="")return $;throw Error(`${this.config.name}.token references env var "${this.config.tokenEnv}" but it is not set`)}let i=await this.process.run(["gh","auth","token"]);if(i.exitCode!==0)throw Error(`gh auth token failed: ${i.stderr.trim()||i.stdout.trim()}`);return i.stdout.trim()}async handleEvent(i,$){let n=i.data.id,g=JSON.stringify(i.data);this.diagnostics.recordRaw(n,g);let v={...i.meta,event_type:"gh",subject_url:i.data.subject.url??"",updated_at:i.data.updated_at};await this.deliver($,n,g,v)}async deliver(i,$,n,g){try{await i(n,g)}catch(v){this.diagnostics.recordProcessed($,"emitted:delivery-failed",n),this.logger?.error("gh notify error",{error:E(v)});return}this.diagnostics.recordProcessed($,"emitted",n)}}var LD=()=>({type:"gh",toolExposed:!0,createListener(i,$){return new CI({config:Li.parse(i),channelId:$.channelId,process:$.process,logger:$.logger,diagnosticLog:$.diagnosticLog,signal:$.signal})},createAdapter(i,$){return Li.parse(i),new EI({process:$.process})},secretTokens(i){return[Li.parse(i).token].filter((n)=>n!==void 0)},buildConfig(i,$){return Li.parse({id:$.id,type:"gh",name:i.name,...typeof i.pollInterval==="number"?{pollInterval:i.pollInterval}:{},...typeof i.token==="string"?{token:i.token}:{},...typeof i.tokenEnv==="string"?{tokenEnv:i.tokenEnv}:{},createdAt:$.now,updatedAt:$.now})},applyUpdate(i,$,n){let g=Li.parse(i);return Li.parse({id:g.id,name:g.name,type:"gh",pollInterval:typeof $.pollInterval==="number"?$.pollInterval:g.pollInterval,createdAt:g.createdAt,updatedAt:n.now,...O$("token","tokenEnv",$,g)})},operations:{}});import{join as eJ}from"path";var dv=(i,$,n)=>{let g=new Set;for(let v of i.split(",")){if(v.length===0)throw Error(`invalid empty cron list item: "${i}"`);let r=v.split("/");if(r.length>2)throw Error(`invalid cron step: "${v}"`);let b=r[0],u=r[1];if(r.length===2&&u==="")throw Error(`invalid cron step: "${v}"`);let U=u?Number(u):1;if(!Number.isInteger(U)||U<=0)throw Error(`invalid cron step: "${u}"`);let I=$,_=n;if(b==="*"||b===void 0||b==="")I=$,_=n;else if(b.includes("-")){let k=b.split("-");if(k.length!==2)throw Error(`invalid cron range: "${b}"`);let O=k[0],J=k[1],Q=Number(O),A=Number(J);if(!Number.isInteger(Q)||!Number.isInteger(A))throw Error(`invalid cron range: "${b}"`);I=Q,_=A}else{let k=Number(b);if(!Number.isInteger(k))throw Error(`invalid cron value: "${b}"`);I=k,_=u?n:k}if(I<$||_>n||I>_)throw Error(`cron value out of range: ${b} (must be ${$}-${n})`);for(let k=I;k<=_;k+=U)g.add(k)}return{min:$,max:n,values:g}},TD=(i)=>{let $=i.trim().split(/\s+/);if($.length!==5)throw Error(`cron must have 5 fields (got ${$.length}): "${i}"`);let[n,g,v,r,b]=$;if(!n||!g||!v||!r||!b)throw Error(`cron has empty fields: "${i}"`);return{minute:dv(n,0,59),hour:dv(g,0,23),dayOfMonth:dv(v,1,31),month:dv(r,1,12),dayOfWeek:dv(b,0,7),dayOfMonthRestricted:v!=="*",dayOfWeekRestricted:b!=="*"}},ZD=(i)=>{TD(i)},gr=(i,$)=>{let n=TD(i);if(!n.minute.values.has($.getMinutes()))return!1;if(!n.hour.values.has($.getHours()))return!1;if(!n.month.values.has($.getMonth()+1))return!1;let g=n.dayOfMonth.values.has($.getDate()),v=$.getDay(),r=n.dayOfWeek.values.has(v)||v===0&&n.dayOfWeek.values.has(7);if(n.dayOfMonthRestricted&&n.dayOfWeekRestricted)return g||r;return g&&r};var qD=D.enum(["latest","all","skip"]),MD=D.string().superRefine((i,$)=>{try{ZD(i)}catch(n){$.addIssue({code:"custom",message:n instanceof Error?n.message:String(n)})}}),xD=D.object({id:D.string(),prompt:D.string(),enabled:D.boolean().default(!0),catchupPolicy:qD.default("latest"),createdAt:D.string().datetime().optional()}),ND=D.object({id:D.string().optional(),prompt:D.string(),enabled:D.boolean().optional(),catchupPolicy:qD.optional()}),zJ=ND.extend({cron:MD}).strict(),SJ=ND.extend({runAt:D.string().datetime({offset:!0})}).strict(),ED=D.union([SJ,zJ]),AJ=xD.extend({kind:D.literal("cron").default("cron"),cron:MD}),BJ=xD.extend({kind:D.literal("once"),runAt:D.string().datetime({offset:!0})}),RI=D.union([BJ,AJ]),Xi=D.object({id:D.string(),name:D.string(),type:D.literal("schedule"),entries:D.array(RI).default([]),createdAt:D.string().datetime().optional(),updatedAt:D.string().datetime().optional()});var tD=1440;class FI extends ov{config;lastFiredStore;logger;diagnostics;now;onFired;timer=null;stopped=!1;tickScheduled=!1;constructor(i){super();this.config=i.config,this.lastFiredStore=i.lastFiredStore,this.logger=i.logger,this.diagnostics=new mv({type:"schedule",connectorId:i.config.id,channelId:i.channelId??null,log:i.diagnosticLog}),this.now=i.now??(()=>new Date),this.onFired=i.onFired??null}async start(i){this.stopped=!1,this.tickScheduled=!0,this.diagnostics.recordConnection("started","");let $=()=>{if(this.stopped)return;let n=this.now(),g=60000-(n.getSeconds()*1000+n.getMilliseconds());this.timer=setTimeout(async()=>{if(this.stopped)return;try{await this.tick(i)}catch(v){this.recordTickError(v)}$()},g),this.timer.unref(),this.tickScheduled=!0};try{await this.tick(i)}catch(n){this.recordTickError(n)}this.diagnostics.recordConnection("connected",""),$()}async stop(){if(this.stopped=!0,this.tickScheduled=!1,this.timer)clearTimeout(this.timer),this.timer=null;this.diagnostics.recordConnection("disconnected",""),this.diagnostics.recordConnection("stopped","")}recordTickError(i){let $=E(i);this.diagnostics.recordConnection("error",`tick: ${$}`),this.logger?.error("schedule tick failed",{connector:this.config.name,error:$})}isAlive(){return!this.stopped&&this.tickScheduled}async tick(i){let $=this.truncateToMinute(this.now()),n=this.lastFiredStore.load(),g=[this.pruneRemovedEntries(n)];for(let v of this.config.entries){if(!v.enabled)continue;let r=await this.fireEntry(v,$,n,i);g.push(r)}if(g.includes(!0))this.lastFiredStore.save(n)}async fireEntry(i,$,n,g){if(i.kind==="once")return this.fireOnceEntry(i,$,n,g);return this.fireCronEntry(i,$,n,g)}async fireOnceEntry(i,$,n,g){if(n.has(i.id))return!1;let v=new Date(i.runAt);if($.getTime()<v.getTime())return!1;let r=$.getTime()-v.getTime();if(i.catchupPolicy==="skip"&&r>=60000)return n.set(i.id,v),!0;return await this.notifyOne(i,v,g,r>0),n.set(i.id,v),!0}async fireCronEntry(i,$,n,g){let v=n.get(i.id),r=i.createdAt?this.truncateToMinute(new Date(i.createdAt)):$,b=v?new Date(v.getTime()+60000):r;if(b.getTime()>$.getTime())return!1;if(i.catchupPolicy==="skip"){try{if(!gr(i.cron,$))return!1}catch(U){return this.logInvalidCron(i,U),!1}return await this.notifyOne(i,$,g,!1),n.set(i.id,$),!0}if(i.catchupPolicy==="all"){let U=this.findAllMatches(i.cron,b,$,i.id);if(U.length===0)return this.seedSearchWatermark(i.id,v,$,n);for(let I of U)await this.notifyOne(i,I,g,I.getTime()!==$.getTime());return n.set(i.id,U[U.length-1]??$),!0}let u=this.findMostRecentMatch(i.cron,b,$,i.id);if(!u)return this.seedSearchWatermark(i.id,v,$,n);return await this.notifyOne(i,u,g,u.getTime()!==$.getTime()),n.set(i.id,u),!0}seedSearchWatermark(i,$,n,g){if($!==void 0)return!1;return g.set(i,n),!0}async notifyOne(i,$,n,g){let v={event_type:"schedule",schedule_id:i.id,schedule_kind:i.kind,fired_at:$.toISOString(),catchup_policy:i.catchupPolicy};if(i.kind==="cron")v.cron=i.cron;else v.run_at=i.runAt;if(g)v.catchup="true";let r=`${i.id}@${$.toISOString()}`;this.diagnostics.recordRaw(r,JSON.stringify({schedule_id:i.id,kind:i.kind,...i.kind==="cron"?{cron:i.cron}:{run_at:i.runAt},prompt:i.prompt,fired_at:$.toISOString(),catchup:g}));try{await n(i.prompt,v)}catch(b){throw this.diagnostics.recordProcessed(r,"emitted:delivery-failed",i.prompt),b}if(this.diagnostics.recordProcessed(r,"emitted",i.prompt),this.onFired)try{await this.onFired(i,$)}catch(b){this.logger?.error("schedule onFired callback failed",{connector:this.config.name,id:i.id,error:E(b)})}}findMostRecentMatch(i,$,n,g){let v=Math.min(tD,Math.floor((n.getTime()-$.getTime())/60000)+1);for(let r=0;r<v;r++){let b=new Date(n.getTime()-r*60000);try{if(gr(i,b))return b}catch(u){return this.logInvalidCron({id:g,cron:i},u),null}}return null}findAllMatches(i,$,n,g){let v=Math.min(tD,Math.floor((n.getTime()-$.getTime())/60000)+1),r=[];for(let b=0;b<v;b++){let u=new Date($.getTime()+b*60000);if(u.getTime()>n.getTime())break;try{if(gr(i,u))r.push(u)}catch(U){return this.logInvalidCron({id:g,cron:i},U),[]}}return r}logInvalidCron(i,$){let n=E($);this.diagnostics.recordConnection("error",`invalid cron "${i.cron}" (entry ${i.id}): ${n}`),this.logger?.error("invalid cron expression in schedule",{connector:this.config.name,id:i.id,cron:i.cron,error:n})}truncateToMinute(i){let $=new Date(i.getTime());return $.setSeconds(0,0),$}pruneRemovedEntries(i){let $=new Set(this.config.entries.map((g)=>g.id)),n=[];for(let g of i.keys()){if($.has(g))continue;i.delete(g),n.push(g)}return n.length>0}}import{dirname as aJ}from"path";import{appendFileSync as lJ,chmodSync as LJ,closeSync as TJ,existsSync as ZJ,mkdirSync as qJ,openSync as MJ,readdirSync as xJ,readFileSync as RD,renameSync as NJ,statSync as FD,unlinkSync as pv,writeFileSync as oD}from"fs";import{dirname as EJ,basename as tJ}from"path";class av{}var cJ=384,oI=0,CJ=()=>{return oI=oI+1|0,`${process.pid}-${oI}-${Math.floor(Math.random()*1e9)}`};class F extends av{constructor(){super();Object.freeze(this)}existsSync(i){return ZJ(i)}readFileSync(i){return RD(i,"utf-8")}writeFileSync(i,$){CD(i,$,null)}writeSecretFileSync(i,$){CD(i,$,cJ)}appendFileSync(i,$){lJ(i,$)}unlink(i){try{pv(i)}catch($){if(mI($,"ENOENT"))return;throw $}}mkdirSync(i,$){qJ(i,{recursive:$?.recursive??!1})}readdirSync(i){return xJ(i)}statSync(i){let $=FD(i);return{mtimeMs:$.mtimeMs,mode:$.mode&511}}withFileLock(i,$){let n=mJ(i);try{return $()}finally{try{TJ(n)}catch{}try{pv(i)}catch{}}}}var RJ=10,FJ=100,cD=5000,oJ=30000,mJ=(i)=>{let $=performance.now()+cD,n=0;while(!0)try{let g=MJ(i,"wx",384);return oD(g,String(process.pid)),g}catch(g){if(!mI(g,"EEXIST"))throw g;if(performance.now()>=$)throw Error(`failed to acquire file lock ${i} within ${cD}ms`);yJ(i);let v=Math.min(FJ,RJ*2**Math.min(n,4));dJ(v),n=n+1}},yJ=(i)=>{let $,n;try{n=FD(i).mtimeMs,$=Number(RD(i,"utf-8").trim())}catch{return}if(Date.now()-n>oJ){try{pv(i)}catch{}return}if($>0&&!hJ($))try{pv(i)}catch{}},hJ=(i)=>{try{return process.kill(i,0),!0}catch($){if(mI($,"EPERM"))return!0;return!1}},dJ=(i)=>{let $=new SharedArrayBuffer(4),n=new Int32Array($);Atomics.wait(n,0,0,i)},mI=(i,$)=>{if(!(i instanceof Error))return!1;if(!("code"in i))return!1;return i.code===$},CD=(i,$,n)=>{let v=`${EJ(i)}/.${tJ(i)}.${CJ()}.tmp`,r=n===null?void 0:{mode:n};try{if(oD(v,$,r),n!==null)try{LJ(v,n)}catch{}NJ(v,i)}catch(b){try{pv(v)}catch{}throw b}};var pJ=new F;class yI{path;fs;constructor(i){this.path=i.path,this.fs=i.fs??pJ,Object.freeze(this)}load(){let i=new Map;if(!this.fs.existsSync(this.path))return i;let $=JSON.parse(this.fs.readFileSync(this.path));if($===null||typeof $!=="object")return i;for(let[n,g]of Object.entries($))if(typeof g==="string")i.set(n,new Date(g));return i}save(i){let $={};for(let[n,g]of i)$[n]=g.toISOString();this.fs.mkdirSync(aJ(this.path),{recursive:!0}),this.fs.writeFileSync(this.path,`${JSON.stringify($,null,2)}
69
+ `)}}var sJ=D.object({id:D.string()}),mD=(i={})=>({type:"schedule",toolExposed:!1,createListener($,n){let g=Xi.parse($);return new FI({config:g,lastFiredStore:new yI({path:eJ(n.connectorDir(n.channelId,g.id),"state.json"),fs:n.fs}),channelId:n.channelId,logger:n.logger,diagnosticLog:n.diagnosticLog,onFired:i.onFired,now:()=>n.clock.now()})},createAdapter:null,secretTokens(){return[]},buildConfig($,n){return Xi.parse({id:n.id,type:"schedule",name:$.name,entries:Array.isArray($.entries)?$.entries:[],createdAt:n.now,updatedAt:n.now})},applyUpdate($,n,g){let v=Xi.parse($);return Xi.parse({...v,updatedAt:g.now})},operations:{listEntries($){let n=Xi.parse($.config);return{config:$.config,result:n.entries}},addEntry($){let n=Xi.parse($.config),g=ED.parse($.args),v=g.id??$.context.generateId();if(n.entries.some((b)=>b.id===v))throw Error(`schedule entry "${v}" already exists`);let r=RI.parse({id:v,..."cron"in g?{kind:"cron",cron:g.cron}:{kind:"once",runAt:g.runAt},prompt:g.prompt,createdAt:$.context.now,...g.enabled!==void 0?{enabled:g.enabled}:{},...g.catchupPolicy!==void 0?{catchupPolicy:g.catchupPolicy}:{}});return{config:Xi.parse({...n,entries:[...n.entries,r],updatedAt:$.context.now}),result:r}},removeEntry($){let n=Xi.parse($.config),g=sJ.parse($.args);if(!n.entries.some((v)=>v.id===g.id))throw Error(`schedule entry "${g.id}" not found`);return{config:Xi.parse({...n,entries:n.entries.filter((v)=>v.id!==g.id),updatedAt:$.context.now}),result:null}}}});var iP="https://slack.com/api/",$P=(i)=>{let $={};for(let[n,g]of Object.entries(i))$[n]=g;return $};class hI extends $${token;http;constructor(i){super();this.token=Yi({literal:i.config.botToken,envVar:i.config.botTokenEnv,env:i.env??process.env,label:`${i.config.name}.botToken`}),this.http=i.http??new Di,Object.freeze(this)}async call(i){let $=`${iP}${i.path}`,n=i.body!==null&&typeof i.body==="object"?$P(i.body):{},g=new URLSearchParams;for(let[b,u]of Object.entries(n))g.set(b,typeof u==="string"?u:JSON.stringify(u));let r=await(await this.http.fetch({method:"POST",url:$,headers:{Authorization:`Bearer ${this.token}`,"Content-Type":"application/x-www-form-urlencoded"},body:g.toString()})).text();try{return JSON.parse(r)}catch{return{ok:!1,error:`non-JSON response: ${r.slice(0,200)}`}}}async postMessage(i){return this.call({method:"post",path:"chat.postMessage",body:{channel:i.channel,text:i.text,...i.threadTs?{thread_ts:i.threadTs}:{}}})}async addReaction(i){return this.call({method:"post",path:"reactions.add",body:{channel:i.channel,timestamp:i.timestamp,name:i.name}})}async removeReaction(i){return this.call({method:"post",path:"reactions.remove",body:{channel:i.channel,timestamp:i.timestamp,name:i.name}})}}var Ti=D.object({id:D.string(),name:D.string(),type:D.literal("slack"),botToken:D.string().startsWith("xoxb-").optional(),appToken:D.string().startsWith("xapp-").optional(),botTokenEnv:D.string().optional(),appTokenEnv:D.string().optional(),minify:D.boolean().default(!0),createdAt:D.string().datetime().optional(),updatedAt:D.string().datetime().optional()});function vP(i){let $={event_type:i.type},n=li(i.payload.event)?i.payload.event:null;if(typeof i.payload.channel_id==="string")$.channel_id=i.payload.channel_id;else if(n&&typeof n.channel==="string")$.channel_id=n.channel;if(typeof i.payload.user_id==="string")$.user_id=i.payload.user_id;else if(n&&typeof n.user==="string")$.user_id=n.user;if(n&&typeof n.thread_ts==="string")$.thread_ts=n.thread_ts;if(n&&typeof n.type==="string")$.slack_event_type=n.type;return $}var nP=class{props;seen=new Map;constructor(i){this.props=i}has(i){let $=this.seen.get(i);if($===void 0)return!1;if(d({deps:this.props.deps})-$>this.props.ttlMs)return this.seen.delete(i),!1;return!0}add(i){this.seen.set(i,d({deps:this.props.deps}))}trim(){let i=d({deps:this.props.deps})-this.props.ttlMs;for(let[n,g]of this.seen)if(g<i)this.seen.delete(n);if(this.seen.size<=this.props.maxSize)return;let $=this.seen.size-this.props.maxSize;for(let n of this.seen.keys()){if($<=0)break;this.seen.delete(n),$--}}get size(){return this.seen.size}},gP=D.object({ok:D.boolean(),url:D.string().optional(),error:D.string().optional()});function rP(i){let $=G(()=>i.response.headers.get("retry-after"));if($ instanceof Error)return null;if(typeof $!=="string")return null;let n=$.trim();if(!/^\d+$/.test(n))return null;let g=Number(n);if(!Number.isFinite(g))return null;return g*1000}var dI="https://slack.com/api/apps.connections.open";async function bP(i){let $=new Bi({source:"slack.url",handler:i.onLog,deps:i.deps});$.debug({action:"http.request",message:`POST ${dI}`});let n=await G(()=>i.deps.fetch(dI,{method:"POST",headers:{Authorization:`Bearer ${i.appToken}`},signal:i.signal}));if(n instanceof Error){let U=L({value:n});return $.error({action:"http.error",message:P({error:U}),error:U}),new T(`apps.connections.open transport: ${n.message}`,{cause:n})}$.debug({action:"http.response",message:`POST ${n.status}`,detail:{status:n.status,url:dI}});let g=rP({response:n});if(n.status===429)return $.warn({action:"http.rate-limited",message:`apps.connections.open: rate limited (429), retry-after ${g??"unknown"}ms`,detail:{retryAfterMs:g}}),new o({message:"apps.connections.open: rate limited (429)",status:n.status,retryAfterMs:g});let v=await hv({response:n,context:"apps.connections.open"});if(v instanceof o)return $.warn({action:"http.body.read",message:P({error:v}),error:v}),v;let r=w$(v);if(r instanceof ii)return $.warn({action:"http.body.parse",message:r.message,error:r}),new o({message:"apps.connections.open: invalid JSON body",status:n.status,cause:r,retryAfterMs:g});let b=li(r)?r:{};$.debug({action:"http.body",message:"apps.connections.open response",detail:{ok:b.ok,error:b.error}});let u=gP.safeParse(r);if(!u.success)return $.warn({action:"http.body.schema",message:"apps.connections.open: invalid response shape",detail:{issues:u.error.issues.map((U)=>({path:U.path,message:U.message}))}}),new o({message:"apps.connections.open: invalid response shape",status:n.status,cause:u.error,retryAfterMs:g});if(!u.data.ok||!u.data.url)return $.warn({action:"slack.api.error",message:`apps.connections.open failed: ${u.data.error??"no url"}`,detail:{code:u.data.error??null}}),new o({message:`apps.connections.open failed: ${u.data.error??"no url"}`,status:n.status,code:u.data.error??null,retryAfterMs:g});return $.info({action:"slack.url.obtained",message:"WSS URL obtained"}),u.data.url}var uP=D.object({envelope_id:D.string(),type:D.string(),payload:D.record(D.string(),D.unknown()),accepts_response_payload:D.boolean().optional(),retry_attempt:D.number().optional(),retry_reason:D.string().optional()}),UP=15000,IP=30000,yD=5000,hD=1,_P=class{props;log;ws=null;isStoppedFlag=!1;hasConnected=!1;pendingResolve=null;pendingResolved=!1;lastFrameAt=0;idleWatchdog=null;handshakeTimer=null;closeFallbackTimer=null;closeHandled=!1;constructor(i){this.props=i,this.log=new Bi({source:"slack.socket-mode",handler:i.onLog,deps:i.deps})}get isStopped(){return this.isStoppedFlag}async connect(i){this.log.info({action:"connect.start",message:"opening WebSocket connection"});let $=await bP({appToken:this.props.appToken,signal:i?.signal,onLog:this.props.onLog,deps:this.props.deps});if($ instanceof o)return this.log.error({action:"http.error",message:$.message,error:$}),$;if($ instanceof T)return this.log.error({action:"url.error",message:$.message,error:$}),$;if(this.isStoppedFlag){let n=new T("stopped before WebSocket open");return this.log.info({action:"connect.aborted",message:P({error:n})}),n}return this.log.info({action:"slack.url.obtained",message:"WebSocket URL obtained"}),this.openSocket($)}disconnect(){this.log.info({action:"disconnect",message:"stopping socket mode"}),this.isStoppedFlag=!0,this.disarmIdleWatchdog(),this.clearCloseFallback(),this.completeConnect(new T("stopped before hello")),this.closeSocket(this.ws),this.ws=null}armIdleWatchdog(){this.disarmIdleWatchdog();let i=this.props.idleTimeoutMs;if(typeof i!=="number"||!Number.isFinite(i)||i<=0)return;let $=G(()=>this.props.deps.setInterval(()=>this.checkIdle(i),UP));if($ instanceof Error){this.log.error({action:"idle.watchdog.schedule.error",message:P({error:$}),error:$});return}this.idleWatchdog=$}disarmIdleWatchdog(){if(!this.idleWatchdog)return;let i=this.idleWatchdog;this.idleWatchdog=null;let $=G(()=>this.props.deps.clearInterval(i));if($ instanceof Error)this.log.error({action:"idle.watchdog.clear.error",message:P({error:$}),error:$})}checkIdle(i){if(!this.hasConnected||this.isStoppedFlag)return;let $=d({deps:this.props.deps})-this.lastFrameAt;if($<i)return;this.log.warn({action:"idle.timeout",message:`no frames for ${$}ms (limit ${i}ms) \u2014 force-closing socket`,detail:{elapsedMs:$,limitMs:i}}),this.disarmIdleWatchdog(),this.forceClose()}isConnected(){return this.ws!==null&&this.ws.readyState===hD}openSocket(i){let $=this.props.deps.WebSocket;if(!$){let n=new T("WebSocket runtime not available");return this.log.error({action:"ws.error",message:P({error:n}),error:n}),Promise.resolve(n)}return this.pendingResolved=!1,this.hasConnected=!1,this.closeHandled=!1,new Promise((n)=>{this.pendingResolve=n;let g=G(()=>new $(i));if(g instanceof Error){let b=new T(`WebSocket construction failed: ${P({error:g})}`,{cause:g});this.log.error({action:"ws.construct.error",message:P({error:b}),error:b}),this.ws=null,this.pendingResolved=!0,n(b);return}let v=g;this.ws=v;let r=G(()=>{v.addEventListener("message",(b)=>this.safeOnMessage(b,v)),v.addEventListener("close",(b)=>this.safeOnClose(b)),v.addEventListener("error",()=>this.safeOnError())});if(r instanceof Error){let b=new T(`WebSocket listener registration failed: ${P({error:r})}`,{cause:r});this.log.error({action:"ws.listener.error",message:P({error:b}),error:b}),this.closeSocket(v),this.ws=null,this.pendingResolved=!0,n(b);return}this.armHandshakeTimer()})}completeConnect(i){if(this.clearHandshakeTimer(),this.pendingResolved||!this.pendingResolve)return;this.pendingResolved=!0,this.pendingResolve(i)}armHandshakeTimer(){let i=this.props.handshakeTimeoutMs,$=typeof i==="number"&&Number.isFinite(i)&&i>0?i:IP,n=G(()=>this.props.deps.setTimeout(()=>this.onHandshakeTimeout($),$));if(n instanceof Error){let g=new T(`handshake timer scheduling failed: ${P({error:n})}`,{cause:n});this.log.error({action:"handshake.timer.schedule.error",message:P({error:g}),error:g}),this.completeConnect(g),this.forceClose();return}this.handshakeTimer=n}clearHandshakeTimer(){if(this.handshakeTimer===null)return;let i=this.handshakeTimer;this.handshakeTimer=null;let $=G(()=>this.props.deps.clearTimeout(i));if($ instanceof Error)this.log.error({action:"handshake.timer.clear.error",message:P({error:$}),error:$})}onHandshakeTimeout(i){if(this.handshakeTimer=null,this.pendingResolved||this.isStoppedFlag)return;let $=new T(`handshake timeout: no hello within ${i}ms \u2014 force-closing socket`);this.log.error({action:"handshake.timeout",message:P({error:$}),error:$,detail:{timeoutMs:i}}),this.completeConnect($),this.forceClose()}forceClose(){let i=this.ws;if(i===null)return;this.armCloseFallback(),this.closeSocket(i)}armCloseFallback(){if(this.closeFallbackTimer!==null)return;let i=G(()=>this.props.deps.setTimeout(()=>this.onCloseFallback(),yD));if(i instanceof Error){this.log.error({action:"ws.close.fallback.schedule.error",message:P({error:i}),error:i}),this.onCloseFallback();return}this.closeFallbackTimer=i}clearCloseFallback(){if(this.closeFallbackTimer===null)return;let i=this.closeFallbackTimer;this.closeFallbackTimer=null;let $=G(()=>this.props.deps.clearTimeout(i));if($ instanceof Error)this.log.error({action:"ws.close.fallback.clear.error",message:P({error:$}),error:$})}onCloseFallback(){if(this.closeFallbackTimer=null,this.closeHandled||this.isStoppedFlag)return;this.log.warn({action:"ws.close.fallback",message:`close event not delivered within ${yD}ms \u2014 synthesizing teardown`}),this.settleClose({code:null})}settleClose(i){if(this.closeHandled)return;if(this.closeHandled=!0,this.clearCloseFallback(),this.disarmIdleWatchdog(),this.ws=null,this.hasConnected)this.props.onDisconnected();if(this.pendingResolved)return;let $=i.code===null?new T("WebSocket closed before hello (code=none)"):new T(`WebSocket closed before hello (code=${i.code})`,{code:i.code});this.completeConnect($)}safeOnMessage(i,$){let n=G(()=>this.onMessage(String(i.data),$));if(n instanceof Error)this.log.error({action:"ws.message.threw",message:P({error:n}),error:n})}safeOnClose(i){let $=G(()=>this.onClose(i));if($ instanceof Error)this.log.error({action:"ws.close.threw",message:P({error:$}),error:$})}safeOnError(){let i=G(()=>this.onError());if(i instanceof Error)this.log.error({action:"ws.error.threw",message:P({error:i}),error:i})}onMessage(i,$){if(this.lastFrameAt=d({deps:this.props.deps}),this.isStoppedFlag)return;let n=w$(i);if(n instanceof ii){this.log.error({action:"ws.parse.error",message:n.message,error:n,detail:{length:i.length}});return}if(!li(n)){this.log.error({action:"ws.parse.error",message:"expected JSON object",error:new ii(`non-object frame (${typeof n})`)});return}if(this.log.debug({action:"ws.recv",message:`type=${typeof n.type==="string"?n.type:"-"} length=${i.length}`,detail:{length:i.length}}),n.type==="hello"){this.log.info({action:"socket.hello",message:"connection ready"}),this.hasConnected=!0,this.armIdleWatchdog(),this.props.onConnected(),this.completeConnect(null);return}if(n.type==="disconnect"){let v=typeof n.reason==="string"?n.reason:"unknown";this.log.info({action:"ws.disconnect.requested",message:`reason=${v}`,detail:{reason:v}}),this.forceClose();return}if(typeof n.envelope_id==="string"){this.log.debug({action:"ws.ack",message:`envelope_id=${n.envelope_id}`});let v=this.safeSerialize({envelope_id:n.envelope_id});if(v!==null)this.send($,v)}let g=uP.safeParse(n);if(g.success){this.log.debug({action:"envelope.recv",message:`type=${g.data.type} envelope_id=${g.data.envelope_id}`,detail:{type:g.data.type,envelopeId:g.data.envelope_id}}),this.props.onMessage(g.data);return}this.log.warn({action:"envelope.parse.error",message:"unrecognised envelope shape, dropping",detail:{type:typeof n.type==="string"?n.type:"unknown",issues:g.error.issues.map((v)=>({path:v.path,message:v.message}))}})}onClose(i){if(this.log.info({action:"ws.close",message:`code=${i.code} reason=${i.reason||"none"}`,detail:{code:i.code,reason:i.reason}}),this.closeHandled){this.log.debug({action:"ws.close.late",message:"close event arrived after synthesized teardown, ignoring"});return}this.settleClose({code:i.code})}onError(){let i=new T("WebSocket connection error");this.log.error({action:"ws.error",message:P({error:i}),error:i}),this.completeConnect(i)}closeSocket(i){if(i===null)return;let $=G(()=>i.close());if($ instanceof Error)this.log.error({action:"ws.close.error",message:P({error:$}),error:$})}send(i,$){if(i.readyState!==hD){this.log.warn({action:"ws.send",message:`ws.send skipped: readyState=${i.readyState} (not OPEN)`,detail:{readyState:i.readyState}});return}let n=G(()=>i.send($));if(n instanceof Error)this.log.error({action:"ws.send",message:`ws.send failed: ${P({error:n})}`,error:n})}safeSerialize(i){let $=nr(i);if($ instanceof Error)return this.log.error({action:"ws.send.serialize.error",message:P({error:$}),error:$}),null;return $}},DP=1024,kP=300000,wP=new Set(["invalid_auth","account_inactive","token_revoked","not_authed","not_allowed_token_type","token_expired","missing_scope"]),dD=class extends k${options;name="slack";socket=null;reconnector=null;internalController=null;seen=null;constructor(i){super();this.options=i}async connect(i){if(!this.hasWebSocket(i))return new gi("Slack source: deps.WebSocket is null (no WebSocket runtime available)");if(this.seen=new nP({maxSize:DP,ttlMs:kP,deps:i.deps}),i.reconnect&&!this.reconnector)this.reconnector=new $r({...i.reconnect,log:i.log,deps:i.deps});let $=G(()=>new AbortController);if($ instanceof Error){let n=L({value:$});i.log.error({action:"slack.abort-controller.new.error",message:P({error:n}),error:n}),this.internalController=null}else this.internalController=$;return await this.connectInternal(i)}disconnect(){let i=this.context;if(i&&this.reconnector&&!this.reconnector.aborted)i.log.debug({action:"reconnect.cancel",message:"aborting reconnector"});this.reconnector?.cancel(),this.internalController?.abort(),this.socket?.disconnect(),this.socket=null,this.internalController=null}hasWebSocket(i){let $=G(()=>Boolean(i.deps.WebSocket));if($ instanceof Error){let n=L({value:$});return i.log.error({action:"deps.web-socket.read.error",message:P({error:n}),error:n}),!1}return $}async connectInternal(i){this.setStatus("connecting");let $=new _P({appToken:this.options.appToken,idleTimeoutMs:this.options.idleTimeoutMs,handshakeTimeoutMs:this.options.handshakeTimeoutMs,onLog:i.log.handler,deps:i.deps,onMessage:(g)=>this.handleMessage(i,g),onConnected:()=>{if(this.reconnector&&this.reconnector.attempt>0)i.log.info({action:"reconnect.reset",message:`cleared ${this.reconnector.attempt} attempts`});this.reconnector?.reset(),this.setStatus("connected")},onDisconnected:()=>{if($.isStopped){this.setStatus("disconnected");return}this.scheduleReconnect(i)}});this.socket=$;let n=await $.connect({signal:this.internalController?.signal});if(n instanceof Error){if(i.log.error({action:"connect.failed",message:P({error:n}),error:n}),this.isTerminalSlackError(n))return i.log.error({action:"reconnect.terminal",message:`permanent Slack API error, not reconnecting: ${P({error:n})}`,error:n}),this.setStatus("disconnected"),n;if($.isStopped||!this.reconnector||this.reconnector.aborted)return this.setStatus("disconnected"),n;this.scheduleReconnect(i,this.minRetryDelayMs(n))}return null}isTerminalSlackError(i){if(!(i instanceof o))return!1;if(i.code===null)return!1;return wP.has(i.code)}minRetryDelayMs(i){if(!(i instanceof o))return;return i.retryAfterMs??void 0}handleMessage(i,$){let n=this.seen;if(!n)return;let g=this.toDedupKey($);if(n.has(g)){i.log.debug({action:"dedup.skip",message:`duplicate key=${g}`,detail:{dedup_key:g,envelope_id:$.envelope_id,retry_attempt:$.retry_attempt}});return}n.add(g),n.trim(),this.emit({source:"slack",type:$.type,data:$.payload,meta:this.safeExtractMeta(i,$),receivedAt:d({deps:i.deps})})}toDedupKey(i){let $=i.payload.event_id;if(typeof $==="string"&&$.length>0)return $;return i.envelope_id}safeExtractMeta(i,$){let n=G(()=>vP($));if(n instanceof Error){let g=L({value:n});return i.log.warn({action:"meta.extract.error",message:P({error:g}),error:g,detail:{envelopeType:$.type}}),{event_type:$.type}}return n}scheduleReconnect(i,$){vr({reconnector:this.reconnector,log:i.log,setStatus:(n)=>this.setStatus(n),minDelayMs:$,retry:()=>{this.connectInternal(i).catch((n)=>{let g=L({value:n});i.log.error({action:"reconnect.unhandled",message:P({error:g}),error:g}),this.setStatus("disconnected")})}})}};class ev extends Error{constructor(i,$){super(i);if(this.name=new.target.name,$?.cause!==void 0)Object.defineProperty(this,"cause",{value:$.cause,enumerable:!1})}}class sv extends ev{channel;code="channel-not-found";constructor(i,$){super(`channel not found: ${i}`,$);this.channel=i}}class rr extends ev{channel;code="channel-already-exists";constructor(i,$){super(`channel already exists: ${i}`,$);this.channel=i}}class iv extends ev{channel;connector;code="connector-not-found";constructor(i,$,n){super(`connector not found in ${i}: ${$}`,n);this.channel=i;this.connector=$}}class $n extends ev{connector;detail;code="auth-failed";constructor(i,$,n){super(`${i}: auth failed \u2014 ${$}`,n);this.connector=i;this.detail=$}}var jP=["type","subtype","user","bot_id","text","ts","thread_ts","channel","channel_type","files","attachments"],OP=["id","name","mimetype","filetype","size","url_private","permalink"],JP=["title","text","fallback"],br=(i)=>{return typeof i==="object"&&i!==null&&!Array.isArray(i)},aI=(i,$)=>{let n={};for(let g of $)if(i[g]!==void 0)n[g]=i[g];return n},PP=(i)=>{return Object.keys(i).some(($)=>$.startsWith("thumb")||$.startsWith("preview"))},WP=(i)=>{if(!br(i))return i;let $=aI(i,OP);if(PP(i))$._funnel_omitted=["thumb_*"];return $},pI=(i)=>{if(!br(i))return"";let $=i.text;if(typeof $==="string")return $;let n=i.elements;if(!Array.isArray(n))return"";return n.map(pI).join("")},VP=(i)=>{if(!Array.isArray(i))return"";return i.map(pI).join("\t")},XP=(i)=>{if(!br(i))return"";if(i.type==="table"&&Array.isArray(i.rows))return i.rows.map(VP).join(`
70
+ `);return pI(i)},fP=(i)=>{return i.map(XP).filter(($)=>$.length>0).join(`
71
+ `)},QP=(i)=>{if(!br(i))return i;let $=aI(i,JP),n=i.blocks;if(Array.isArray(n)){let g=fP(n),v=typeof $.text==="string"?$.text:"";$.text=v?`${v}
72
+ ${g}`:g,$._funnel_omitted=["blocks"]}return $},aD=(i)=>{let $=aI(i,jP);if(Array.isArray($.files))$.files=$.files.map(WP);if(Array.isArray($.attachments))$.attachments=$.attachments.map(QP);return $};var KP=new Set(["message","app_mention"]),GP=new Set([void 0,"thread_broadcast","bot_message","file_share"]),YP=1e4,wi=(i,$)=>{let n=i[$];return typeof n==="string"?n:void 0};class eI{ownBotUserId;ownBotId;minify;now;dedup=new Map;constructor(i){this.ownBotUserId=i.ownBotUserId,this.ownBotId=i.ownBotId,this.minify=i.minify??!0,this.now=i.now??(()=>Date.now())}process(i){let $=wi(i,"type");if(!$||!KP.has($))return{skip:!0,reason:"skip:type"};let n=wi(i,"subtype");if(!GP.has(n))return{skip:!0,reason:"skip:subtype"};let g=wi(i,"channel")??"",v=wi(i,"event_ts")??wi(i,"ts")??"",r=`${g}:${v}`,b=this.now();if(this.dedup.has(r))return{skip:!0,reason:"skip:dedup"};this.dedup.set(r,b);for(let z of this.dedup.keys())if((this.dedup.get(z)??0)<b-YP)this.dedup.delete(z);let u=wi(i,"user"),U=wi(i,"bot_id");if(u===this.ownBotUserId)return{skip:!0,reason:"skip:self-user"};if(U===this.ownBotId)return{skip:!0,reason:"skip:self-bot"};let I=wi(i,"text")??"",_=I.includes(`<@${this.ownBotUserId}>`),k=wi(i,"thread_ts")??wi(i,"ts")??"",O=wi(i,"ts")??"",J=$==="app_mention"?"app_mention":"message",Q=this.minify?aD(i):i;return{skip:!1,event:{kind:"message",channel:g,user:u??"",rawText:I,text:HP(I,this.ownBotUserId),threadTs:k,ts:O,isThreadRoot:k===O,mentioned:_,source:J},content:JSON.stringify(Q),meta:{event_type:"slack",channel_id:g,user_id:u??"",mentioned:String(_),thread_ts:k},shouldReact:_,channel:g,timestamp:O}}}var HP=(i,$)=>i.replace(new RegExp(`<@${$}>`,"g"),"").trim();var zP=D.object({ok:D.boolean(),user_id:D.string().optional(),bot_id:D.string().optional(),error:D.string().optional()}),SP="https://slack.com/api/auth.test";class sI extends j${config;env;flumeDeps;http;signal;preprocessEvent;onInteractive;processor=null;botToken="";constructor(i){super({type:"slack",connectorId:i.config.id,channelId:i.channelId??null,logger:i.logger,diagnosticLog:i.diagnosticLog});this.config=i.config,this.env=i.env??process.env,this.flumeDeps=i.flumeDeps??{},this.http=i.http??new Di,this.signal=i.signal,this.preprocessEvent=i.preprocessEvent,this.onInteractive=i.onInteractive}async start(i){this.diagnostics.recordConnection("started","");let $,n;try{$=Yi({literal:this.config.appToken,envVar:this.config.appTokenEnv,env:this.env,label:`${this.config.name}.appToken`}),n=Yi({literal:this.config.botToken,envVar:this.config.botTokenEnv,env:this.env,label:`${this.config.name}.botToken`})}catch(r){throw this.diagnostics.recordConnection("auth-failed",E(r)),r}this.botToken=n;let g=await this.callAuthTest();if(!g.ok){let r=g.error??"auth.test returned ok=false";throw this.diagnostics.recordConnection("auth-failed",r),new $n(this.config.name,r)}this.processor=new eI({ownBotUserId:g.user_id??"",ownBotId:g.bot_id??"",minify:this.config.minify});let v=new dD({appToken:$,botToken:this.botToken});await this.runStart({source:v,onLog:s$(this.logger),deps:e$(this.flumeDeps),signal:this.signal,onEvent:(r)=>{if(r.source!=="slack")return Promise.resolve();return this.handleEvent(r,i)}})}onStop(){this.processor=null}async handleInteractive(i){let $=crypto.randomUUID(),n=JSON.stringify(i);if(this.diagnostics.recordRaw($,n),!this.onInteractive){this.diagnostics.recordProcessed($,"skip:no-interactive-handler","");return}let g=typeof i.type==="string"?i.type:"unknown";try{await this.onInteractive(i),this.diagnostics.recordProcessed($,`interactive:${g}`,"")}catch(v){let r=E(v);this.diagnostics.recordProcessed($,`interactive-error:${g}`,r),this.logger?.error(`slack interactive handler error (${g})`,{error:r})}}async callAuthTest(){let i;try{i=await(await this.http.fetch({method:"POST",url:SP,headers:{Authorization:`Bearer ${this.botToken}`,"Content-Type":"application/x-www-form-urlencoded"}})).text()}catch(n){throw this.diagnostics.recordConnection("error",E(n)),n}let $=zP.safeParse(pD(i));if(!$.success)return{ok:!1,error:`non-JSON auth.test response: ${i.slice(0,200)}`};return $.data}async handleEvent(i,$){if(!this.processor)return;if(i.type==="interactive"){await this.handleInteractive(i.data);return}let n=i.data.event;if(!AP(n)){let u=crypto.randomUUID();this.diagnostics.recordRaw(u,JSON.stringify(i.data)),this.diagnostics.recordProcessed(u,"skip:non-object-event","");return}let g=crypto.randomUUID(),v=JSON.stringify(n);this.diagnostics.recordRaw(g,v);let r=n;if(this.preprocessEvent){let u=await this.preprocessEvent(n);if(u===null){this.diagnostics.recordProcessed(g,"skip:preprocess",v);return}r=u}let b=this.processor.process(r);if(b.skip){this.diagnostics.recordProcessed(g,b.reason,v);return}await this.deliver($,g,v,b.content,b.meta,b.shouldReact)}async deliver(i,$,n,g,v,r){try{await i(g,v)}catch(b){this.diagnostics.recordProcessed($,"emitted:delivery-failed",g||n),this.logger?.error("slack notify error",{error:E(b)});return}if(this.diagnostics.recordProcessed($,"emitted",g),r)this.postReaction(v).catch((b)=>{this.diagnostics.recordProcessed($,"emitted:reaction-failed",E(b)),this.logger?.warn("slack reaction failed",{error:E(b)})})}async postReaction(i){let $=await this.http.fetch({method:"POST",url:"https://slack.com/api/reactions.add",headers:{Authorization:`Bearer ${this.botToken}`,"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({channel:i.channel_id??"",timestamp:i.thread_ts??"",name:"eyes"}).toString()}),n=await $.text(),g=lP(n);if(!g.ok)throw Error(`slack reactions.add: ${g.error??`status=${$.status}`}`)}}var AP=(i)=>typeof i==="object"&&i!==null&&!Array.isArray(i),pD=(i)=>{try{return JSON.parse(i)}catch{return null}},BP=D.object({ok:D.boolean(),error:D.string().optional()}),lP=(i)=>{let $=BP.safeParse(pD(i));if(!$.success)return{ok:!1,error:`non-JSON response: ${i.slice(0,200)}`};return $.data};var eD=(i={})=>({type:"slack",toolExposed:!0,createListener($,n){let g=Ti.parse($);return new sI({config:g,channelId:n.channelId,logger:n.logger,diagnosticLog:n.diagnosticLog,http:n.http,signal:n.signal,preprocessEvent:i.preprocessEvent,onInteractive:i.onInteractive})},createAdapter($,n){return new hI({config:Ti.parse($),http:n.http})},secretTokens($){let n=Ti.parse($);return[n.botToken,n.appToken].filter((g)=>g!==void 0)},buildConfig($,n){return Ti.parse({id:n.id,type:"slack",name:$.name,...typeof $.botToken==="string"?{botToken:$.botToken}:{},...typeof $.appToken==="string"?{appToken:$.appToken}:{},...typeof $.botTokenEnv==="string"?{botTokenEnv:$.botTokenEnv}:{},...typeof $.appTokenEnv==="string"?{appTokenEnv:$.appTokenEnv}:{},minify:typeof $.minify==="boolean"?$.minify:!0,createdAt:n.now,updatedAt:n.now})},applyUpdate($,n,g){let v=Ti.parse($);return Ti.parse({id:v.id,name:v.name,type:"slack",minify:v.minify,createdAt:v.createdAt,updatedAt:g.now,...O$("botToken","botTokenEnv",n,v),...O$("appToken","appTokenEnv",n,v)})},operations:{}});var sD=()=>[eD(),LD(),zD(),mD()];import{homedir as i_}from"os";import{dirname as vk,join as $_}from"path";class vn{}class Zi extends vn{generate(){return crypto.randomUUID()}}class nn{}var ik=D.object({id:D.string(),name:D.string(),type:D.string(),createdAt:D.string().datetime().optional(),updatedAt:D.string().datetime().optional()});var LP=ik.loose(),TP=D.enum(["fanout","exclusive"]),ZP=D.object({id:D.string(),name:D.string(),delivery:TP.default("fanout"),connectors:D.array(LP).default([])}),qP=D.object({id:D.string(),name:D.string(),path:D.string(),channelId:D.string(),options:D.array(D.string()).default([]),env:D.record(D.string(),D.string()).default({}),resume:D.boolean().default(!0),sessionId:D.string().optional()}),qi=1,$k=D.object({version:D.literal(qi).default(qi),channels:D.array(ZP).default([]),profiles:D.array(qP).default([])});function ur(){let i=process.env.FUNNEL_DIR;if(i&&i.length>0)return MP(i);return $_(i_(),".funnel")}function MP(i){let $=i_(),n=i;if(n==="~")return $;if(n.startsWith("~/")||n.startsWith("~\\"))n=$+n.slice(1);return n=n.split("${HOME}").join($),n=n.split("${USERPROFILE}").join($),n.replace(/\\/g,"/")}var xP=9742;function Mi(){return Number(process.env.FUNNEL_PORT)||xP}var ji=$_(i_(),".funnel"),NP=$_(ji,"settings.json"),EP=new F,tP=new Zi;class v_ extends nn{path;fs;idGenerator;constructor(i={}){super();this.path=i.path??NP,this.fs=i.fs??EP,this.idGenerator=i.idGenerator??tP,Object.freeze(this)}read(){if(!this.fs.existsSync(this.path))return{version:qi,channels:[],profiles:[]};let i=this.fs.readFileSync(this.path),$=JSON.parse(i);if(this.looksLikeLegacy($))throw Error(`legacy settings.json detected at ${this.path}. The schema changed (channel.connectors are now nested objects with ids; profile fields renamed). Migration is intentionally not provided. Back up and remove the old file:
73
73
  mv ${this.path} ${this.path}.bak`);if($&&typeof $==="object"&&"version"in $&&$.version!==qi)throw Error(`unsupported settings.json version (${this.path}): expected ${qi}, got ${String($.version)}`);let n=this.backfillProfileIds($),g=$k.safeParse($);if(!g.success)throw Error(`invalid settings.json (${this.path}): ${g.error.issues.map((v)=>`${v.path.join(".")}: ${v.message}`).join(", ")}`);if(n)this.write(g.data);return g.data}looksLikeLegacy(i){if(!i||typeof i!=="object")return!1;let $=i;if(Array.isArray($.channels))for(let n of $.channels){if(!n||typeof n!=="object")continue;let g=n;if(Array.isArray(g.connectors)&&g.connectors.some((v)=>typeof v==="string"))return!0;if(!("id"in g)&&"name"in g)return!0}if(Array.isArray($.connectors))return!0;if(Array.isArray($.repositories))return!0;if(Array.isArray($.profiles))for(let n of $.profiles){if(!n||typeof n!=="object")continue;let g=n;if("repository"in g||"envFiles"in g||"channel"in g&&!("channelId"in g))return!0}return!1}backfillProfileIds(i){if(!i||typeof i!=="object")return!1;let $=i;if(!Array.isArray($.profiles))return!1;let n=!1;for(let g of $.profiles){if(!g||typeof g!=="object")continue;let v=g;if(typeof v.id!=="string")v.id=this.idGenerator.generate(),n=!0}return n}write(i){this.fs.mkdirSync(vk(this.path),{recursive:!0});let $={...i,version:qi};this.fs.writeSecretFileSync(this.path,`${JSON.stringify($,null,2)}
74
- `)}update(i){return this.fs.mkdirSync(vk(this.path),{recursive:!0}),this.fs.withFileLock(`${this.path}.lock`,()=>{let $=this.read(),n=i($);return this.write($),n})}}import{tmpdir as EP}from"os";import{join as cP}from"path";function fi(){let i=process.env.FUNNEL_TMP_DIR;if(i&&i.length>0)return i;return cP(EP(),"funnel")}import{join as _X}from"path";var g_=(i)=>{let $=i.split("/");if($[0]==="")$.shift();return $},nk=(i)=>{let{groups:$,path:n}=CP(i),g=g_(n);return RP(g,$)},CP=(i)=>{let $=[];return i=i.replace(/\{[^}]+\}/g,(n,g)=>{let v=`@${g}`;return $.push([v,n]),v}),{groups:$,path:i}},RP=(i,$)=>{for(let n=$.length-1;n>=0;n--){let[g]=$[n];for(let v=i.length-1;v>=0;v--)if(i[v].includes(g)){i[v]=i[v].replace(g,$[n][1]);break}}return i},Ur={},gk=(i,$)=>{if(i==="*")return"*";let n=i.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(n){let g=`${i}#${$}`;if(!Ur[g])if(n[2])Ur[g]=$&&$[0]!==":"&&$[0]!=="*"?[g,n[1],new RegExp(`^${n[2]}(?=/${$})`)]:[i,n[1],new RegExp(`^${n[2]}$`)];else Ur[g]=[i,n[1],!0];return Ur[g]}return null},iv=(i,$)=>{try{return $(i)}catch{return i.replace(/(?:%[0-9A-Fa-f]{2})+/g,(n)=>{try{return $(n)}catch{return n}})}},FP=(i)=>iv(i,decodeURI),r_=(i)=>{let $=i.url,n=$.indexOf("/",$.indexOf(":")+4),g=n;for(;g<$.length;g++){let v=$.charCodeAt(g);if(v===37){let r=$.indexOf("?",g),b=$.indexOf("#",g),u=r===-1?b===-1?void 0:b:b===-1?r:Math.min(r,b),I=$.slice(n,u);return FP(I.includes("%25")?I.replace(/%25/g,"%2525"):I)}else if(v===63||v===35)break}return $.slice(n,g)};var rk=(i)=>{let $=r_(i);return $.length>1&&$.at(-1)==="/"?$.slice(0,-1):$},ei=(i,$,...n)=>{if(n.length)$=ei($,...n);return`${i?.[0]==="/"?"":"/"}${i}${$==="/"?"":`${i?.at(-1)==="/"?"":"/"}${$?.[0]==="/"?$.slice(1):$}`}`},Ir=(i)=>{if(i.charCodeAt(i.length-1)!==63||!i.includes(":"))return null;let $=i.split("/"),n=[],g="";return $.forEach((v)=>{if(v!==""&&!/\:/.test(v))g+="/"+v;else if(/\:/.test(v))if(/\?/.test(v)){if(n.length===0&&g==="")n.push("/");else n.push(g);let r=v.replace("?","");g+="/"+r,n.push(g)}else g+="/"+v}),n.filter((v,r,b)=>b.indexOf(v)===r)},n_=(i)=>{if(!/[%+]/.test(i))return i;if(i.indexOf("+")!==-1)i=i.replace(/\+/g," ");return i.indexOf("%")!==-1?iv(i,gn):i},bk=(i,$,n)=>{let g;if(!n&&$&&!/[%+]/.test($)){let b=i.indexOf("?",8);if(b===-1)return;if(!i.startsWith($,b+1))b=i.indexOf(`&${$}`,b+1);while(b!==-1){let u=i.charCodeAt(b+$.length+1);if(u===61){let I=b+$.length+2,U=i.indexOf("&",I);return n_(i.slice(I,U===-1?void 0:U))}else if(u==38||isNaN(u))return"";b=i.indexOf(`&${$}`,b+1)}if(g=/[%+]/.test(i),!g)return}let v=Object.create(null);g??=/[%+]/.test(i);let r=i.indexOf("?",8);while(r!==-1){let b=i.indexOf("&",r+1),u=i.indexOf("=",r);if(u>b&&b!==-1)u=-1;let I=i.slice(r+1,u===-1?b===-1?void 0:b:u);if(g)I=n_(I);if(r=b,I==="")continue;let U;if(u===-1)U="";else if(U=i.slice(u+1,b===-1?void 0:b),g)U=n_(U);if(n){if(!(v[I]&&Array.isArray(v[I])))v[I]=[];v[I].push(U)}else v[I]??=U}return $?v[$]:v},uk=bk,Uk=(i,$)=>{return bk(i,$,!0)},gn=decodeURIComponent;var _k=/^[\w!#$%&'*.^`|~+-]+$/,oP=/^[ !#-:<-[\]-~]*$/,Ik=(i)=>{let $=0,n=i.length;while($<n){let g=i.charCodeAt($);if(g!==32&&g!==9)break;$++}while(n>$){let g=i.charCodeAt(n-1);if(g!==32&&g!==9)break;n--}return $===0&&n===i.length?i:i.slice($,n)},b_=(i,$)=>{if($&&i.indexOf($)===-1)return{};let n=i.split(";"),g=Object.create(null);for(let v of n){let r=v.indexOf("=");if(r===-1)continue;let b=Ik(v.substring(0,r));if($&&$!==b||!_k.test(b)||b in g)continue;let u=Ik(v.substring(r+1));if(u.startsWith('"')&&u.endsWith('"'))u=u.slice(1,-1);if(oP.test(u)){if(g[b]=u.indexOf("%")!==-1?iv(u,gn):u,$)break}}return g};var mP=(i,$,n={})=>{if(!_k.test(i))throw Error("Invalid cookie name");let g=`${i}=${$}`;if(i.startsWith("__Secure-")&&!n.secure)throw Error("__Secure- Cookie must have Secure attributes");if(i.startsWith("__Host-")){if(!n.secure)throw Error("__Host- Cookie must have Secure attributes");if(n.path!=="/")throw Error('__Host- Cookie must have Path attributes with "/"');if(n.domain)throw Error("__Host- Cookie must not have Domain attributes")}for(let v of["domain","path","sameSite","priority"])if(n[v]&&/[;\r\n]/.test(n[v]))throw Error(`${v} must not contain ";", "\\r", or "\\n"`);if(n&&typeof n.maxAge==="number"&&n.maxAge>=0){if(n.maxAge>34560000)throw Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");g+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!=="host")g+=`; Domain=${n.domain}`;if(n.path)g+=`; Path=${n.path}`;if(n.expires){if(n.expires.getTime()-Date.now()>34560000000)throw Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");g+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly)g+="; HttpOnly";if(n.secure)g+="; Secure";if(n.sameSite)g+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`;if(n.priority)g+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`;if(n.partitioned){if(!n.secure)throw Error("Partitioned Cookie must have Secure attributes");g+="; Partitioned"}return g},u_=(i,$,n)=>{return $=encodeURIComponent($),mP(i,$,n)};var Dk=(i,$)=>{return i=i.replace(/\/+$/,""),i=i+"/",$=$.replace(/^\/+/,""),i+$},Dr=(i,$)=>{for(let[n,g]of Object.entries($)){let v=new RegExp("/:"+n+"(?:{[^/]+})?\\??(?=/|$)");i=i.replace(v,g?`/${g}`:"")}return i},kk=(i)=>{let $=new URLSearchParams;for(let[n,g]of Object.entries(i)){if(g===void 0)continue;if(Array.isArray(g))for(let v of g)$.append(n,v);else $.set(n,g)}return $},wk=(i,$)=>{switch($){case"ws":return i.replace(/^http/,"ws");case"http":return i.replace(/^ws/,"http")}},U_=(i)=>{if(/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(i))return i.replace(/\/index(?=\?|$)/,"/");return i.replace(/\/index(?=\?|$)/,"")};function _r(i){return typeof i==="object"&&i!==null&&!Array.isArray(i)}function I_(i,$){if(!_r(i)&&!_r($))return $;let n={...i};for(let g in $){let v=$[g];if(_r(n[g])&&_r(v))n[g]=I_(n[g],v);else n[g]=v}return n}var jk=(i,$)=>{return new Proxy(()=>{},{get(g,v){if(typeof v!=="string"||v==="then")return;return jk(i,[...$,v])},apply(g,v,r){return i({path:$,args:r})}})},hP=class{url;method;buildSearchParams;queryParams=void 0;pathParams={};rBody;cType=void 0;constructor(i,$,n){this.url=i,this.method=$,this.buildSearchParams=n.buildSearchParams}fetch=async(i,$)=>{if(i){if(i.query)this.queryParams=this.buildSearchParams(i.query);if(i.form){let u=new FormData;for(let[I,U]of Object.entries(i.form)){if(U===void 0)continue;if(Array.isArray(U))for(let _ of U)u.append(I,_);else u.append(I,U)}this.rBody=u}if(i.json)this.rBody=JSON.stringify(i.json),this.cType="application/json";if(i.param)this.pathParams=i.param}let n=this.method.toUpperCase(),g={...i?.header,...typeof $?.headers==="function"?await $.headers():$?.headers};if(i?.cookie){let u=[];for(let[I,U]of Object.entries(i.cookie))u.push(u_(I,U,{path:"/"}));g.Cookie=u.join(",")}if(this.cType)g["Content-Type"]=this.cType;let v=new Headers(g??void 0),r=this.url;if(r=U_(r),r=Dr(r,this.pathParams),this.queryParams)r=r+"?"+this.queryParams.toString();n=this.method.toUpperCase();let b=!(n==="GET"||n==="HEAD");return($?.fetch||fetch)(r,{body:b?this.rBody:void 0,method:n,headers:v,...$?.init})}},__=(i,$)=>jk(function n(g){let v=$?.buildSearchParams??kk,r=[...g.path],b=r.slice(-3).reverse();if(b[0]==="toString"){if(b[1]==="name")return b[2]||"";return n.toString()}if(b[0]==="valueOf"){if(b[1]==="name")return b[2]||"";return n}let u="";if(/^\$/.test(b[0])){let k=r.pop();if(k)u=k.replace(/^\$/,"")}let I=r.join("/"),U=Dk(i,I);if(u==="url"||u==="path"){let k=U;if(g.args[0]){if(g.args[0].param)k=Dr(U,g.args[0].param);if(g.args[0].query)k=k+"?"+v(g.args[0].query).toString()}if(k=U_(k),u==="url")return new URL(k);return k.slice(i.replace(/\/+$/,"").length).replace(/^\/?/,"/")}if(u==="ws"){let k=wk(g.args[0]&&g.args[0].param?Dr(U,g.args[0].param):U,"ws"),O=new URL(k),J=g.args[0]?.query;if(J)Object.entries(J).forEach(([A,z])=>{if(Array.isArray(z))z.forEach((l)=>O.searchParams.append(A,l));else O.searchParams.set(A,z)});return((...A)=>{if($?.webSocket!==void 0&&typeof $.webSocket==="function")return $.webSocket(...A);return new WebSocket(...A)})(O.toString())}let _=new hP(U,u,{buildSearchParams:v});if(u){$??={};let k={...g.args[1]},O=$.headers,J=k.headers;if(O&&J)k.headers=async()=>({...typeof O==="function"?await O():O,...typeof J==="function"?await J():J});let Q=I_($,k);return _.fetch(g.args[0],Q)}return _},[]);function xi(i){return`http://127.0.0.1:${i}`}import{join as Ok}from"path";class rn{millis(){return this.now().getTime()}iso(){return this.now().toISOString()}}class Ni extends rn{now(){return new Date}}var dP=new F,aP=new R,pP=new Di,eP=new Ni;class D_{descriptors;fs;process;http;clock;logger;diagnosticLog;signal;dir;constructor(i){this.descriptors=new Map(i.descriptors.map(($)=>[$.type,$])),this.fs=i.fs??dP,this.process=i.process??aP,this.http=i.http??pP,this.clock=i.clock??eP,this.logger=i.logger,this.diagnosticLog=i.diagnosticLog,this.signal=i.signal,this.dir=i.dir??ji,Object.freeze(this)}has(i){return this.descriptors.has(i)}types(){return[...this.descriptors.keys()]}createListener(i,$){return this.require($.type).createListener($,this.listenerDeps(i))}createAdapter(i){let $=this.require(i.type);if(!$.createAdapter)return null;return $.createAdapter(i,this.adapterDeps())}secretTokens(i){return this.require(i.type).secretTokens(i)}buildConfig(i,$){let n=typeof i.type==="string"?i.type:"";return this.require(n).buildConfig(i,$)}applyUpdate(i,$,n){return this.require(i.type).applyUpdate(i,$,n)}runOperation(i,$,n,g){let r=this.require(i.type).operations[$];if(!r)throw Error(`connector type "${i.type}" has no operation "${$}"`);return r({config:i,args:n,context:g})}connectorDir(i,$){return Ok(this.dir,"channels",i,"connectors",$)}channelDir(i){return Ok(this.dir,"channels",i)}require(i){let $=this.descriptors.get(i);if(!$)throw Error(`unknown connector type "${i}". Pass its descriptor to new Funnel({ connectors: [...] }).`);return $}listenerDeps(i){return{channelId:i,fs:this.fs,process:this.process,http:this.http,clock:this.clock,logger:this.logger,diagnosticLog:this.diagnosticLog,signal:this.signal,connectorDir:($,n)=>this.connectorDir($,n)}}adapterDeps(){return{fs:this.fs,process:this.process,http:this.http,logger:this.logger}}}var sP=new Ni,iW=new Zi;class k_{store;registry;profileChecker;clock;idGenerator;constructor(i){this.store=i.store,this.registry=i.registry,this.profileChecker=i.profileChecker??null,this.clock=i.clock??sP,this.idGenerator=i.idGenerator??iW,Object.freeze(this)}list(){return this.store.read().channels}get(i){return this.list().find(($)=>$.name===i)??null}getById(i){return this.list().find(($)=>$.id===i)??null}add(i){return this.store.update(($)=>{if($.channels.some((g)=>g.name===i.name))throw new rr(i.name);let n={id:this.idGenerator.generate(),name:i.name,delivery:i.delivery??"fanout",connectors:[]};return $.channels.push(n),n})}setDelivery(i,$){this.store.update((n)=>{let g=this.requireChannel(n,i);g.delivery=$})}remove(i){this.store.update(($)=>{let n=$.channels.findIndex((v)=>v.name===i);if(n<0)throw new sv(i);let g=$.channels[n];if(g&&this.profileChecker?.hasChannelRef(g.id))throw Error(`channel "${i}" is referenced by a profile`);$.channels.splice(n,1)})}rename(i,$){this.store.update((n)=>{let g=n.channels.find((v)=>v.name===i);if(!g)throw new sv(i);if(n.channels.some((v)=>v.name===$))throw new rr($);g.name=$})}listConnectors(i){return this.requireChannel(this.store.read(),i).connectors}getConnector(i,$){let n=this.get(i);if(!n)return null;return n.connectors.find((g)=>g.name===$)??null}listAllConnectors(){let i=[];for(let $ of this.list())for(let n of $.connectors)i.push({...n,channelId:$.id,channelName:$.name});return i}addConnector(i,$){return this.store.update((n)=>{let g=this.requireChannel(n,i);if(g.connectors.some((r)=>r.name===$.name))throw Error(`connector "${$.name}" already exists in channel "${i}"`);let v=this.registry.buildConfig($,{id:this.idGenerator.generate(),now:this.clock.iso()});return this.assertNoTokenCollision(n,v),g.connectors.push(v),v})}removeConnector(i,$){this.store.update((n)=>{let g=this.requireChannel(n,i),v=g.connectors.findIndex((r)=>r.name===$);if(v<0)throw new s$(i,$);g.connectors.splice(v,1)})}renameConnector(i,$,n){this.store.update((g)=>{let v=this.requireChannel(g,i),r=v.connectors.find((b)=>b.name===$);if(!r)throw Error(`connector "${$}" not found in channel "${i}"`);if(v.connectors.some((b)=>b.name===n))throw Error(`connector "${n}" already exists in channel "${i}"`);r.name=n,r.updatedAt=this.clock.iso()})}updateConnector(i,$,n){this.store.update((g)=>{let v=this.requireChannel(g,i),r=v.connectors.find((u)=>u.name===$);if(!r)throw new s$(i,$);let b=this.registry.applyUpdate(r,n,{now:this.clock.iso()});this.assertNoTokenCollision(g,b),this.replaceConnector(v,r.name,b)})}updateSlackConnector(i,$,n){this.updateConnector(i,$,n)}updateGhConnector(i,$,n){this.updateConnector(i,$,n)}updateDiscordConnector(i,$,n){this.updateConnector(i,$,n)}connectorOp(i,$,n,g){return this.store.update((v)=>{let r=this.requireChannel(v,i),b=r.connectors.find((I)=>I.name===$);if(!b)throw new s$(i,$);let u=this.registry.runOperation(b,n,g,{generateId:()=>this.idGenerator.generate(),now:this.clock.iso()});if(u.config!==b)this.replaceConnector(r,b.name,u.config);return u.result})}async call(i,$,n){let g=this.getConnector(i,$);if(!g)throw new s$(i,$);let v=this.registry.createAdapter(g);if(!v)throw Error(`connector type "${g.type}" does not support outbound calls`);return await v.call(n)}createListener(i,$){let n=this.get(i);if(!n)return null;let g=n.connectors.find((v)=>v.name===$);if(!g)return null;return{config:g,channelId:n.id,listener:this.registry.createListener(n.id,g)}}createAllListeners(){let i=[];for(let $ of this.list())for(let n of $.connectors)i.push({config:n,channelId:$.id,channelName:$.name,listener:this.registry.createListener($.id,n)});return i}requireChannel(i,$){let n=i.channels.find((g)=>g.name===$);if(!n)throw new sv($);return n}replaceConnector(i,$,n){let g=i.connectors.findIndex((v)=>v.name===$);if(g<0)throw Error(`connector "${$}" not found in channel "${i.name}"`);i.connectors[g]=n}assertNoTokenCollision(i,$){let n=this.registry.secretTokens($);if(n.length===0)return;for(let g of i.channels)for(let v of g.connectors){if(v.id===$.id)continue;for(let r of this.registry.secretTokens(v))if(n.includes(r))throw Error(`token already in use by connector "${v.name}" in channel "${g.name}"`)}}}var $W=new R,vW=new Zi;class w_{channels;mcp;gateway;sessions;guard;process;idGenerator;logger;dir;constructor(i){this.channels=i.channels,this.mcp=i.mcp,this.gateway=i.gateway,this.sessions=i.sessions,this.guard=i.guard,this.process=i.process??$W,this.idGenerator=i.idGenerator??vW,this.logger=i.logger,this.dir=i.dir,Object.freeze(this)}async launch(i){let $=this.channels.get(i.channel)??this.channels.getById(i.channel);if(!$)throw Error(`channel "${i.channel}" not found`);if(i.profileId&&this.guard.isRunning(i.profileId))throw Error(`profile "${i.profileId}" is already running`);let n=i.cwd??globalThis.process.cwd();if((i.installMcp??!0)&&!this.mcp.findInstalledName(n))this.mcp.install(n),this.logger?.info("added funnel MCP to .mcp.json",{cwd:n});if(!this.gateway.isRunning()){if(this.logger?.info("starting gateway automatically"),!await this.gateway.start())throw Error(`gateway failed to start on port ${Mi()}; another funnel daemon (a different repo/scope) may already hold it. See 'fnl gateway logs' and 'ps -o pid,args= | grep funnel-gateway'.`)}if(i.profileId)this.guard.acquire(i.profileId);let r=(i.resume??!1)&&i.profileId?this.resolveSession(i.profileId,n,i.userArgs??[],i.env??{}):null,b=this.buildArgs(i.options??[],i.userArgs??[],n,r),u=this.buildEnv($.id,i.env??{});this.logger?.info("claude launch",{channel:i.channel,channelId:$.id,cwd:n});try{return await this.process.attach(["claude",...b],{cwd:n,env:u,onSpawned:i.onSpawned})}finally{if(i.profileId)this.guard.release(i.profileId)}}buildArgs(i,$,n,g){let v=[...i,...$];if(g!==null)if(g.mode==="resume")v.push("--resume",g.id);else v.push("--session-id",g.id);let r=this.mcp.findInstalledName(n);if(r&&!v.includes("--dangerously-load-development-channels")&&!v.includes("--channels"))v.push("--dangerously-load-development-channels",`server:${r}`);return v}resolveSession(i,$,n,g){for(let b of n){if(b==="-c"||b==="--continue")return null;if(b==="--resume"||b.startsWith("--resume="))return null;if(b==="--session-id"||b.startsWith("--session-id="))return null}let v=this.sessions.getSessionId(i);if(v!==null&&this.sessions.sessionFileExists($,v,g))return{id:v,mode:"resume"};let r=this.idGenerator.generate();return this.sessions.setSessionId(i,r),{id:r,mode:"new"}}buildEnv(i,$){let n={};for(let[g,v]of Object.entries($))n[g]=v;for(let[g,v]of Object.entries(globalThis.process.env))if(typeof v==="string")n[g]=v;if(n.FUNNEL_CHANNEL_ID=i,n.FUNNEL_PORT=String(Mi()),this.dir!==void 0)n.FUNNEL_DIR=this.dir;return n}}import{join as Jk}from"path";var nW=new F,gW=new R;class kr{fs;process;pidDir;constructor(i={}){this.fs=i.fs??nW,this.process=i.process??gW,this.pidDir=Jk(i.dir??ji,"claude"),Object.freeze(this)}isRunning(i){let $=this.readRecord(i);if(!$)return!1;if(!this.process.isAlive($.pid))return this.release(i),!1;if($.startTime!==null){let n=this.process.getStartTime($.pid);if(n===null)return this.release(i),!1;if(n!==$.startTime)return this.release(i),!1}return!0}acquire(i){this.fs.mkdirSync(this.pidDir,{recursive:!0});let $=globalThis.process.pid,n=this.process.getStartTime($),g={pid:$,startTime:n};this.fs.writeFileSync(this.pidPath(i),JSON.stringify(g)),globalThis.process.once("exit",()=>this.release(i))}release(i){let $=this.pidPath(i);if(this.fs.existsSync($))this.fs.unlink($)}pidPath(i){return Jk(this.pidDir,`${i}.pid`)}readRecord(i){let $=this.pidPath(i);if(!this.fs.existsSync($))return null;try{let n=this.fs.readFileSync($).trim();if(!n)return null;if(n.startsWith("{")){let v=JSON.parse(n),r=typeof v.pid==="number"?v.pid:Number(v.pid);if(!Number.isInteger(r)||r<=0)return null;let b=typeof v.startTime==="string"?v.startTime:null;return{pid:r,startTime:b}}let g=Number(n);if(!g||g<=0)return null;return{pid:g,startTime:null}}catch{return null}}}import{dirname as Wk,join as bW}from"path";import{homedir as rW}from"os";import{join as Pk}from"path";function wr(i){let $=i.env.CLAUDE_CONFIG_DIR??globalThis.process.env.CLAUDE_CONFIG_DIR??Pk(rW(),".claude"),n=i.cwd.replace(/\//g,"-"),g=Pk($,"projects",n,`${i.sessionId}.jsonl`);if(!i.fs.existsSync(g))return!1;return i.fs.readFileSync(g).trim().length>0}var uW=D.record(D.string(),D.string());class j_{fs;path;constructor(i){this.fs=i.fs,this.path=bW(i.dir,"claude","local-sessions.json"),Object.freeze(this)}getSessionId(i){return this.fs.mkdirSync(Wk(this.path),{recursive:!0}),this.fs.withFileLock(`${this.path}.lock`,()=>this.read()[i]??null)}setSessionId(i,$){this.fs.mkdirSync(Wk(this.path),{recursive:!0}),this.fs.withFileLock(`${this.path}.lock`,()=>{let n=this.read();n[i]=$,this.fs.writeFileSync(this.path,`${JSON.stringify(n,null,2)}
75
- `)})}sessionFileExists(i,$,n){return wr({fs:this.fs,cwd:i,sessionId:$,env:n})}read(){if(!this.fs.existsSync(this.path))return{};let i=JSON.parse(this.fs.readFileSync(this.path)),$=uW.safeParse(i);if(!$.success)throw Error(`invalid local profile session store (${this.path})`);return $.data}}class O_{global;local;constructor(i){this.global=i.global,this.local=i.local,Object.freeze(this)}getSessionId(i){return this.storeFor(i).getSessionId(i)}setSessionId(i,$){this.storeFor(i).setSessionId(i,$)}sessionFileExists(i,$,n){return this.global.sessionFileExists(i,$,n)}storeFor(i){return i.startsWith("local-")?this.local:this.global}}import{existsSync as IW,readFileSync as _W}from"fs";import{join as DW}from"path";var J$=async(i,$={},n=5000)=>{let g=AbortSignal.timeout(n),v=$.signal?AbortSignal.any([$.signal,g]):g;return fetch(i,{...$,signal:v})};var bn=(i)=>typeof i==="string"&&i.length>0?i:null;var UW=(i)=>i!==null&&typeof i==="object"&&!Array.isArray(i),J_=(i)=>{if(i===null)return null;try{let $=JSON.parse(i);if(UW($))return $}catch{return null}return null},Vk=(i,$)=>i.length<=$?i:`${i.slice(0,$)}\u2026`,Xk=(i)=>{if(typeof i!=="string"||i.length===0)return null;let $=J_(i);if($!==null&&"text"in $)return Vk(String($.text),60);return Vk(i,60)};var $v=(i)=>({seq:i.seq,ts:i.ts,type:i.type,outcome:i.outcome,eventId:i.eventId,payload:bn(i.payload),payloadParsed:J_(bn(i.payload)),preview:Xk(i.payload)}),fk=(i)=>({seq:i.seq,ts:i.ts,type:i.type,outcome:"",eventId:i.eventId,payload:bn(i.payload),payloadParsed:J_(bn(i.payload)),preview:Xk(i.payload)}),vv=(i)=>({seq:i.seq,ts:i.ts,type:i.type,status:i.status,detail:bn(i.detail)});var kW=(i)=>{if(i===null||typeof i!=="object")return!1;if(!("clients"in i)||!Array.isArray(i.clients))return!1;if(!("listeners"in i)||!Array.isArray(i.listeners))return!1;return!0},wW=(i,$)=>{if($===null)return;return i.connectors?.find((n)=>n.id===$)?.name},Qk=3,jW=(i)=>{let n=(i.connectionErrors[i.connectionErrors.length-1]??null)?.detail??null,g=i.channel;if(!i.gateway.running)return{status:"error",message:"gateway is not running",nextActions:["fnl gateway start"],rootCause:null};if(i.gateway.statusError!==null)return{status:"error",message:`gateway running but status probe failed: ${i.gateway.statusError}`,nextActions:["fnl gateway restart"],rootCause:i.gateway.statusError};if(i.configuredConnectors>i.listeners.length)return{status:"error",message:`${i.configuredConnectors} connector(s) configured but ${i.listeners.length} registered with supervisor`,nextActions:["fnl gateway restart"],rootCause:"supervisor missing listeners declared in settings.json"};if(i.configuredConnectors===0)return{status:"warn",message:"no connectors configured on this channel",nextActions:[`fnl channels ${g} connectors add <name> --type=slack ...`],rootCause:null};let v=i.connectionErrors.filter((_)=>_.status==="auth-failed");if(v.length>0){let _=v[v.length-1]?.detail??null;return{status:"error",message:"connector credentials rejected (auth-failed)",nextActions:[`fnl channels ${g} connectors set <connector> --bot-token=<new>`,"fnl gateway restart"],rootCause:_??"token rejected by upstream auth.test"}}let r=i.listeners.every((_)=>!_.alive),b=i.listeners.some((_)=>!_.alive);if(r)return{status:"error",message:"all listeners are dead",nextActions:["fnl doctor --fix","fnl doctor --fix --aggressive"],rootCause:n};if(b)return{status:"warn",message:"some listeners are dead",nextActions:["fnl doctor --fix"],rootCause:n};let u=i.listeners.filter((_)=>_.errors>=Qk);if(u.length>0)return{status:"warn",message:`listener(s) flapping (\u2265${Qk} errors): ${u.map((_)=>_.name).join(", ")}`,nextActions:["fnl gateway logs"],rootCause:n};if(i.claudeClients===0)return{status:"warn",message:"no Claude connected to this channel",nextActions:[`fnl claude --channel ${g}`],rootCause:null};if(i.listeners.some((_)=>_.errors>0))return{status:"warn",message:"listeners have errors",nextActions:["fnl gateway logs"],rootCause:n};let U=OW(i);if(U!==null)return U;return{status:"ok",message:"everything looks healthy",nextActions:[],rootCause:null}},OW=(i)=>{if(!i.listeners.some((r)=>r.type==="slack")||i.recentEvents.length===0)return null;let n=i.recentEvents.filter((r)=>r.type==="slack").map((r)=>r.payloadParsed?.type);if(n.length===0)return null;let g=n.includes("app_mention"),v=n.includes("message");if(!g||v)return null;return{status:"warn",message:"Slack is only delivering app_mention events; unmentioned thread replies may not arrive",nextActions:["Add Slack bot events: message.channels, message.groups, message.im, message.mpim; reinstall the app; then restart the gateway"],rootCause:"Slack Event Subscriptions likely omit message.* events"}};class P_{props;constructor(i){this.props=i;Object.freeze(this)}async diagnose(i){let $=this.props.channels.list(),n=i?$.find((v)=>v.name===i)??null:$[0]??null;if(!n)return null;let g=await this.fetchGatewayStatus();return this.buildChannelDiagnosis(n,g,5)}async diagnoseAll(){let i=this.props.channels.list(),$=await this.fetchGatewayStatus(),n=await Promise.all(i.map((u)=>this.buildChannelDiagnosis(u,$,5))),g=n.filter((u)=>u.diagnosis.status==="error").map((u)=>u.channel),v=n.filter((u)=>u.diagnosis.status==="warn").map((u)=>u.channel),r=n.filter((u)=>u.diagnosis.status==="ok").map((u)=>u.channel),b=[...new Set(n.flatMap((u)=>u.diagnosis.nextActions))];return{summary:{total:n.length,ok:r.length,warn:v.length,error:g.length,criticalChannels:g,warnChannels:v,suggestedActions:b},channels:n}}async recentEvents(i,$={}){let n=$.limit??20,g=this.resolveScope(i,$.connector);if(g===null)return[];return this.queryLog((v)=>v.queryProcessed({...g,limit:n})).map($v)}async droppedEvents(i,$={}){let n=$.limit??20,g=this.resolveScope(i,$.connector);if(g===null)return[];return this.queryLog((v)=>v.queryProcessed({...g,outcomePrefix:"skip:",limit:n})).map($v)}async rawEvents(i,$={}){let n=$.limit??20,g=this.resolveScope(i,$.connector);if(g===null)return[];return this.queryLog((v)=>v.queryRaw({...g,limit:n})).map(fk)}async connectionErrors(i,$={}){let n=$.limit??20,g=this.resolveScope(i,$.connector);if(g===null)return[];return this.queryLog((v)=>v.queryConnection({...g,statuses:["auth-failed","error"],limit:n})).map(vv)}async connectionTimeline(i,$={}){let n=$.limit??20,g=this.resolveScope(i,$.connector);if(g===null)return[];return this.queryLog((v)=>v.queryConnection({...g,limit:n})).map(vv)}async recentLogs(i={}){let $=i.limit??200,n=DW(this.props.tmpDir,"funnel.log");if(!IW(n))return{lines:[],path:null,truncated:!1};let g;try{g=_W(n,"utf-8")}catch(U){return{lines:[`(read failed: ${t(U)})`],path:n,truncated:!1}}let v=g.split(`
76
- `).filter((U)=>U.length>0),r=i.grep?.toLowerCase(),b=r?v.filter((U)=>U.toLowerCase().includes(r)):v,u=b.length>$;return{lines:u?b.slice(b.length-$):b,path:n,truncated:u}}async replay(i,$){let g=this.props.channels.list().find((Q)=>Q.name===i);if(!g)return{state:"not-found"};if(!this.props.diagnosticLog)return{state:"error",reason:"no diagnostic log configured"};let v=this.queryLogResult((Q)=>Q.queryProcessed({channelId:g.id,...$!==void 0?{seq:$}:{outcomePrefix:"emitted"},limit:1}));if(v instanceof Error)return{state:"error",reason:v.message};let r=v[0];if(!r)return{state:"not-found"};let{seq:b,eventId:u,connectorId:I}=r,U=r.payload.length>0?r.payload:null,_=U===null?this.queryLog((Q)=>Q.queryRaw({eventId:u,limit:1}))[0]?.payload??null:null,k=U??_;if(!k)return{state:"error",reason:"event has no payload to replay"};let O=wW(g,I),J=await this.props.publisher.publish(g.name,{content:k,connector:O});if(J.state==="offline")return{state:"offline"};if(J.state==="error")return{state:"error",reason:J.reason};return{state:"ok",seq:b,offset:J.offset,preview:k.slice(0,60)}}resolveScope(i,$){if(!i)return{};let g=this.props.channels.list().find((r)=>r.name===i)??null;if(!g)return null;if(!$)return{channelId:g.id};let v=g.connectors?.find((r)=>r.name===$)?.id??null;if(!v)return null;return{channelId:g.id,connectorId:v}}queryLog(i){let $=this.queryLogResult(i);return $ instanceof Error?[]:$}queryLogResult(i){let $=this.props.diagnosticLog;if(!$)return Error("no diagnostic log configured");try{return i($)}catch(n){return Error(t(n))}}async fetchGatewayStatus(){let i=this.props.gateway.getStatus();if(!i.running)return{body:null,error:null};let $=this.props.gatewayToken.read(),n=$?{Authorization:`Bearer ${$}`}:{},g=null;try{g=await J$(`${xi(i.port)}/status`,{headers:n})}catch(r){return{body:null,error:`fetch failed: ${t(r)}`}}if(!g.ok)return{body:null,error:`gateway /status returned ${g.status}`};let v;try{v=await g.json()}catch(r){return{body:null,error:`gateway /status body parse failed: ${t(r)}`}}if(!kW(v))return{body:null,error:"gateway /status returned an unrecognized shape"};return{body:v,error:null}}async buildChannelDiagnosis(i,$,n){let g=this.props.gateway.getStatus(),v=i.name,r=$.body,b={channel:v,channelId:i.id,gateway:{running:g.running,pid:g.pid,port:g.running?g.port:null,uptimeMs:r?.uptimeMs??null,statusError:$.error},configuredConnectors:i.connectors?.length??0,listeners:[],claudeClients:0,recentEvents:[],connectionErrors:[]};if(r)b.listeners=r.listeners.filter((u)=>u.channelName===v).map((u)=>({name:u.name,type:u.type,alive:u.alive,events:u.events,errors:u.errors,lastEventAt:u.lastEventAt})),b.claudeClients=r.clients.filter((u)=>u.channelName===v).length;if(this.props.diagnosticLog){let u=this.queryLog((U)=>U.queryProcessed({channelId:i.id,limit:n}));b.recentEvents=u.map($v);let I=this.queryLog((U)=>U.queryConnection({channelId:i.id,statuses:["auth-failed","error"],limit:3}));b.connectionErrors=I.map(vv)}return{...b,diagnosis:jW(b)}}}class W_{props;constructor(i){this.props=i;Object.freeze(this)}async run(i="off"){if(i==="off"){let u=await this.props.diagnostics.diagnoseAll();return this.buildReport({before:null,after:u,appliedActions:[],fixFailed:!1})}let $=await this.props.diagnostics.diagnoseAll(),n=[],g=!1;if($.channels.some((u)=>u.diagnosis.status==="error"&&!u.gateway.running)){let u=await this.props.recovery.ensureGatewayRunning();if(n.push(...u.actions),!u.ok)g=!0}if($.channels.some((u)=>u.listeners.some((I)=>!I.alive))){let u=await this.props.recovery.restartAllDeadListeners();if(n.push(...u.actions),!u.ok&&u.actions.length===0)g=!0}if(i==="aggressive"){if((await this.props.diagnostics.diagnoseAll()).channels.some((U)=>U.diagnosis.status==="error")){let U=await this.props.recovery.restartGateway();if(n.push(...U.actions),!U.ok)g=!0}}let b=await this.props.diagnostics.diagnoseAll();return this.buildReport({before:$,after:b,appliedActions:n,fixFailed:g})}buildReport(i){let $=i.after.channels.filter((v)=>v.diagnosis.status!=="ok").map((v)=>({channel:v.channel,diagnosis:v.diagnosis})),n=i.fixFailed?"error":$.length===0?"ok":"warn",g=JW({mode:i.before===null?"off":"fix",status:n,appliedCount:i.appliedActions.length,remainingCount:$.length});return{status:n,message:g,before:i.before,after:i.after,appliedActions:i.appliedActions,remainingIssues:$}}}var JW=(i)=>{if(i.mode==="off"){if(i.remainingCount===0)return"all channels healthy";return`${i.remainingCount} channel(s) need attention \u2014 run \`fnl doctor --fix\` to apply suggested fixes`}if(i.status==="error")return"one or more fix steps failed \u2014 check fnl gateway logs";if(i.status==="ok")return`applied ${i.appliedCount} fix(es), all channels healthy`;return`applied ${i.appliedCount} fix(es), ${i.remainingCount} channel(s) still need attention`};var Kk=`funnel docs architecture \u2014 how Funnel routes events
74
+ `)}update(i){return this.fs.mkdirSync(vk(this.path),{recursive:!0}),this.fs.withFileLock(`${this.path}.lock`,()=>{let $=this.read(),n=i($);return this.write($),n})}}import{tmpdir as cP}from"os";import{join as CP}from"path";function fi(){let i=process.env.FUNNEL_TMP_DIR;if(i&&i.length>0)return i;return CP(cP(),"funnel")}import{join as wX}from"path";var g_=(i)=>{let $=i.split("/");if($[0]==="")$.shift();return $},nk=(i)=>{let{groups:$,path:n}=RP(i),g=g_(n);return FP(g,$)},RP=(i)=>{let $=[];return i=i.replace(/\{[^}]+\}/g,(n,g)=>{let v=`@${g}`;return $.push([v,n]),v}),{groups:$,path:i}},FP=(i,$)=>{for(let n=$.length-1;n>=0;n--){let[g]=$[n];for(let v=i.length-1;v>=0;v--)if(i[v].includes(g)){i[v]=i[v].replace(g,$[n][1]);break}}return i},Ur={},gk=(i,$)=>{if(i==="*")return"*";let n=i.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(n){let g=`${i}#${$}`;if(!Ur[g])if(n[2])Ur[g]=$&&$[0]!==":"&&$[0]!=="*"?[g,n[1],new RegExp(`^${n[2]}(?=/${$})`)]:[i,n[1],new RegExp(`^${n[2]}$`)];else Ur[g]=[i,n[1],!0];return Ur[g]}return null},$v=(i,$)=>{try{return $(i)}catch{return i.replace(/(?:%[0-9A-Fa-f]{2})+/g,(n)=>{try{return $(n)}catch{return n}})}},oP=(i)=>$v(i,decodeURI),r_=(i)=>{let $=i.url,n=$.indexOf("/",$.indexOf(":")+4),g=n;for(;g<$.length;g++){let v=$.charCodeAt(g);if(v===37){let r=$.indexOf("?",g),b=$.indexOf("#",g),u=r===-1?b===-1?void 0:b:b===-1?r:Math.min(r,b),U=$.slice(n,u);return oP(U.includes("%25")?U.replace(/%25/g,"%2525"):U)}else if(v===63||v===35)break}return $.slice(n,g)};var rk=(i)=>{let $=r_(i);return $.length>1&&$.at(-1)==="/"?$.slice(0,-1):$},ei=(i,$,...n)=>{if(n.length)$=ei($,...n);return`${i?.[0]==="/"?"":"/"}${i}${$==="/"?"":`${i?.at(-1)==="/"?"":"/"}${$?.[0]==="/"?$.slice(1):$}`}`},Ir=(i)=>{if(i.charCodeAt(i.length-1)!==63||!i.includes(":"))return null;let $=i.split("/"),n=[],g="";return $.forEach((v)=>{if(v!==""&&!/\:/.test(v))g+="/"+v;else if(/\:/.test(v))if(/\?/.test(v)){if(n.length===0&&g==="")n.push("/");else n.push(g);let r=v.replace("?","");g+="/"+r,n.push(g)}else g+="/"+v}),n.filter((v,r,b)=>b.indexOf(v)===r)},n_=(i)=>{if(!/[%+]/.test(i))return i;if(i.indexOf("+")!==-1)i=i.replace(/\+/g," ");return i.indexOf("%")!==-1?$v(i,gn):i},bk=(i,$,n)=>{let g;if(!n&&$&&!/[%+]/.test($)){let b=i.indexOf("?",8);if(b===-1)return;if(!i.startsWith($,b+1))b=i.indexOf(`&${$}`,b+1);while(b!==-1){let u=i.charCodeAt(b+$.length+1);if(u===61){let U=b+$.length+2,I=i.indexOf("&",U);return n_(i.slice(U,I===-1?void 0:I))}else if(u==38||isNaN(u))return"";b=i.indexOf(`&${$}`,b+1)}if(g=/[%+]/.test(i),!g)return}let v=Object.create(null);g??=/[%+]/.test(i);let r=i.indexOf("?",8);while(r!==-1){let b=i.indexOf("&",r+1),u=i.indexOf("=",r);if(u>b&&b!==-1)u=-1;let U=i.slice(r+1,u===-1?b===-1?void 0:b:u);if(g)U=n_(U);if(r=b,U==="")continue;let I;if(u===-1)I="";else if(I=i.slice(u+1,b===-1?void 0:b),g)I=n_(I);if(n){if(!(v[U]&&Array.isArray(v[U])))v[U]=[];v[U].push(I)}else v[U]??=I}return $?v[$]:v},uk=bk,Uk=(i,$)=>{return bk(i,$,!0)},gn=decodeURIComponent;var _k=/^[\w!#$%&'*.^`|~+-]+$/,mP=/^[ !#-:<-[\]-~]*$/,Ik=(i)=>{let $=0,n=i.length;while($<n){let g=i.charCodeAt($);if(g!==32&&g!==9)break;$++}while(n>$){let g=i.charCodeAt(n-1);if(g!==32&&g!==9)break;n--}return $===0&&n===i.length?i:i.slice($,n)},b_=(i,$)=>{if($&&i.indexOf($)===-1)return{};let n=i.split(";"),g=Object.create(null);for(let v of n){let r=v.indexOf("=");if(r===-1)continue;let b=Ik(v.substring(0,r));if($&&$!==b||!_k.test(b)||b in g)continue;let u=Ik(v.substring(r+1));if(u.startsWith('"')&&u.endsWith('"'))u=u.slice(1,-1);if(mP.test(u)){if(g[b]=u.indexOf("%")!==-1?$v(u,gn):u,$)break}}return g};var yP=(i,$,n={})=>{if(!_k.test(i))throw Error("Invalid cookie name");let g=`${i}=${$}`;if(i.startsWith("__Secure-")&&!n.secure)throw Error("__Secure- Cookie must have Secure attributes");if(i.startsWith("__Host-")){if(!n.secure)throw Error("__Host- Cookie must have Secure attributes");if(n.path!=="/")throw Error('__Host- Cookie must have Path attributes with "/"');if(n.domain)throw Error("__Host- Cookie must not have Domain attributes")}for(let v of["domain","path","sameSite","priority"])if(n[v]&&/[;\r\n]/.test(n[v]))throw Error(`${v} must not contain ";", "\\r", or "\\n"`);if(n&&typeof n.maxAge==="number"&&n.maxAge>=0){if(n.maxAge>34560000)throw Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");g+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!=="host")g+=`; Domain=${n.domain}`;if(n.path)g+=`; Path=${n.path}`;if(n.expires){if(n.expires.getTime()-Date.now()>34560000000)throw Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");g+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly)g+="; HttpOnly";if(n.secure)g+="; Secure";if(n.sameSite)g+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`;if(n.priority)g+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`;if(n.partitioned){if(!n.secure)throw Error("Partitioned Cookie must have Secure attributes");g+="; Partitioned"}return g},u_=(i,$,n)=>{return $=encodeURIComponent($),yP(i,$,n)};var Dk=(i,$)=>{return i=i.replace(/\/+$/,""),i=i+"/",$=$.replace(/^\/+/,""),i+$},Dr=(i,$)=>{for(let[n,g]of Object.entries($)){let v=new RegExp("/:"+n+"(?:{[^/]+})?\\??(?=/|$)");i=i.replace(v,g?`/${g}`:"")}return i},kk=(i)=>{let $=new URLSearchParams;for(let[n,g]of Object.entries(i)){if(g===void 0)continue;if(Array.isArray(g))for(let v of g)$.append(n,v);else $.set(n,g)}return $},wk=(i,$)=>{switch($){case"ws":return i.replace(/^http/,"ws");case"http":return i.replace(/^ws/,"http")}},U_=(i)=>{if(/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(i))return i.replace(/\/index(?=\?|$)/,"/");return i.replace(/\/index(?=\?|$)/,"")};function _r(i){return typeof i==="object"&&i!==null&&!Array.isArray(i)}function I_(i,$){if(!_r(i)&&!_r($))return $;let n={...i};for(let g in $){let v=$[g];if(_r(n[g])&&_r(v))n[g]=I_(n[g],v);else n[g]=v}return n}var jk=(i,$)=>{return new Proxy(()=>{},{get(g,v){if(typeof v!=="string"||v==="then")return;return jk(i,[...$,v])},apply(g,v,r){return i({path:$,args:r})}})},dP=class{url;method;buildSearchParams;queryParams=void 0;pathParams={};rBody;cType=void 0;constructor(i,$,n){this.url=i,this.method=$,this.buildSearchParams=n.buildSearchParams}fetch=async(i,$)=>{if(i){if(i.query)this.queryParams=this.buildSearchParams(i.query);if(i.form){let u=new FormData;for(let[U,I]of Object.entries(i.form)){if(I===void 0)continue;if(Array.isArray(I))for(let _ of I)u.append(U,_);else u.append(U,I)}this.rBody=u}if(i.json)this.rBody=JSON.stringify(i.json),this.cType="application/json";if(i.param)this.pathParams=i.param}let n=this.method.toUpperCase(),g={...i?.header,...typeof $?.headers==="function"?await $.headers():$?.headers};if(i?.cookie){let u=[];for(let[U,I]of Object.entries(i.cookie))u.push(u_(U,I,{path:"/"}));g.Cookie=u.join(",")}if(this.cType)g["Content-Type"]=this.cType;let v=new Headers(g??void 0),r=this.url;if(r=U_(r),r=Dr(r,this.pathParams),this.queryParams)r=r+"?"+this.queryParams.toString();n=this.method.toUpperCase();let b=!(n==="GET"||n==="HEAD");return($?.fetch||fetch)(r,{body:b?this.rBody:void 0,method:n,headers:v,...$?.init})}},__=(i,$)=>jk(function n(g){let v=$?.buildSearchParams??kk,r=[...g.path],b=r.slice(-3).reverse();if(b[0]==="toString"){if(b[1]==="name")return b[2]||"";return n.toString()}if(b[0]==="valueOf"){if(b[1]==="name")return b[2]||"";return n}let u="";if(/^\$/.test(b[0])){let k=r.pop();if(k)u=k.replace(/^\$/,"")}let U=r.join("/"),I=Dk(i,U);if(u==="url"||u==="path"){let k=I;if(g.args[0]){if(g.args[0].param)k=Dr(I,g.args[0].param);if(g.args[0].query)k=k+"?"+v(g.args[0].query).toString()}if(k=U_(k),u==="url")return new URL(k);return k.slice(i.replace(/\/+$/,"").length).replace(/^\/?/,"/")}if(u==="ws"){let k=wk(g.args[0]&&g.args[0].param?Dr(I,g.args[0].param):I,"ws"),O=new URL(k),J=g.args[0]?.query;if(J)Object.entries(J).forEach(([A,z])=>{if(Array.isArray(z))z.forEach((B)=>O.searchParams.append(A,B));else O.searchParams.set(A,z)});return((...A)=>{if($?.webSocket!==void 0&&typeof $.webSocket==="function")return $.webSocket(...A);return new WebSocket(...A)})(O.toString())}let _=new dP(I,u,{buildSearchParams:v});if(u){$??={};let k={...g.args[1]},O=$.headers,J=k.headers;if(O&&J)k.headers=async()=>({...typeof O==="function"?await O():O,...typeof J==="function"?await J():J});let Q=I_($,k);return _.fetch(g.args[0],Q)}return _},[]);function xi(i){return`http://127.0.0.1:${i}`}import{join as Ok}from"path";class rn{millis(){return this.now().getTime()}iso(){return this.now().toISOString()}}class Ni extends rn{now(){return new Date}}var aP=new F,pP=new R,eP=new Di,sP=new Ni;class D_{descriptors;fs;process;http;clock;logger;diagnosticLog;signal;dir;constructor(i){this.descriptors=new Map(i.descriptors.map(($)=>[$.type,$])),this.fs=i.fs??aP,this.process=i.process??pP,this.http=i.http??eP,this.clock=i.clock??sP,this.logger=i.logger,this.diagnosticLog=i.diagnosticLog,this.signal=i.signal,this.dir=i.dir??ji,Object.freeze(this)}has(i){return this.descriptors.has(i)}types(){return[...this.descriptors.keys()]}createListener(i,$){return this.require($.type).createListener($,this.listenerDeps(i))}createAdapter(i){let $=this.require(i.type);if(!$.createAdapter)return null;return $.createAdapter(i,this.adapterDeps())}secretTokens(i){return this.require(i.type).secretTokens(i)}buildConfig(i,$){let n=typeof i.type==="string"?i.type:"";return this.require(n).buildConfig(i,$)}applyUpdate(i,$,n){return this.require(i.type).applyUpdate(i,$,n)}runOperation(i,$,n,g){let r=this.require(i.type).operations[$];if(!r)throw Error(`connector type "${i.type}" has no operation "${$}"`);return r({config:i,args:n,context:g})}connectorDir(i,$){return Ok(this.dir,"channels",i,"connectors",$)}channelDir(i){return Ok(this.dir,"channels",i)}require(i){let $=this.descriptors.get(i);if(!$)throw Error(`unknown connector type "${i}". Pass its descriptor to new Funnel({ connectors: [...] }).`);return $}listenerDeps(i){return{channelId:i,fs:this.fs,process:this.process,http:this.http,clock:this.clock,logger:this.logger,diagnosticLog:this.diagnosticLog,signal:this.signal,connectorDir:($,n)=>this.connectorDir($,n)}}adapterDeps(){return{fs:this.fs,process:this.process,http:this.http,logger:this.logger}}}var iW=new Ni,$W=new Zi;class k_{store;registry;profileChecker;clock;idGenerator;constructor(i){this.store=i.store,this.registry=i.registry,this.profileChecker=i.profileChecker??null,this.clock=i.clock??iW,this.idGenerator=i.idGenerator??$W,Object.freeze(this)}list(){return this.store.read().channels}get(i){return this.list().find(($)=>$.name===i)??null}getById(i){return this.list().find(($)=>$.id===i)??null}add(i){return this.store.update(($)=>{if($.channels.some((g)=>g.name===i.name))throw new rr(i.name);let n={id:this.idGenerator.generate(),name:i.name,delivery:i.delivery??"fanout",connectors:[]};return $.channels.push(n),n})}setDelivery(i,$){this.store.update((n)=>{let g=this.requireChannel(n,i);g.delivery=$})}remove(i){this.store.update(($)=>{let n=$.channels.findIndex((v)=>v.name===i);if(n<0)throw new sv(i);let g=$.channels[n];if(g&&this.profileChecker?.hasChannelRef(g.id))throw Error(`channel "${i}" is referenced by a profile`);$.channels.splice(n,1)})}rename(i,$){this.store.update((n)=>{let g=n.channels.find((v)=>v.name===i);if(!g)throw new sv(i);if(n.channels.some((v)=>v.name===$))throw new rr($);g.name=$})}listConnectors(i){return this.requireChannel(this.store.read(),i).connectors}getConnector(i,$){let n=this.get(i);if(!n)return null;return n.connectors.find((g)=>g.name===$)??null}listAllConnectors(){let i=[];for(let $ of this.list())for(let n of $.connectors)i.push({...n,channelId:$.id,channelName:$.name});return i}addConnector(i,$){return this.store.update((n)=>{let g=this.requireChannel(n,i);if(g.connectors.some((r)=>r.name===$.name))throw Error(`connector "${$.name}" already exists in channel "${i}"`);let v=this.registry.buildConfig($,{id:this.idGenerator.generate(),now:this.clock.iso()});return this.assertNoTokenCollision(n,v),g.connectors.push(v),v})}removeConnector(i,$){this.store.update((n)=>{let g=this.requireChannel(n,i),v=g.connectors.findIndex((r)=>r.name===$);if(v<0)throw new iv(i,$);g.connectors.splice(v,1)})}renameConnector(i,$,n){this.store.update((g)=>{let v=this.requireChannel(g,i),r=v.connectors.find((b)=>b.name===$);if(!r)throw Error(`connector "${$}" not found in channel "${i}"`);if(v.connectors.some((b)=>b.name===n))throw Error(`connector "${n}" already exists in channel "${i}"`);r.name=n,r.updatedAt=this.clock.iso()})}updateConnector(i,$,n){this.store.update((g)=>{let v=this.requireChannel(g,i),r=v.connectors.find((u)=>u.name===$);if(!r)throw new iv(i,$);let b=this.registry.applyUpdate(r,n,{now:this.clock.iso()});this.assertNoTokenCollision(g,b),this.replaceConnector(v,r.name,b)})}updateSlackConnector(i,$,n){this.updateConnector(i,$,n)}updateGhConnector(i,$,n){this.updateConnector(i,$,n)}updateDiscordConnector(i,$,n){this.updateConnector(i,$,n)}connectorOp(i,$,n,g){return this.store.update((v)=>{let r=this.requireChannel(v,i),b=r.connectors.find((U)=>U.name===$);if(!b)throw new iv(i,$);let u=this.registry.runOperation(b,n,g,{generateId:()=>this.idGenerator.generate(),now:this.clock.iso()});if(u.config!==b)this.replaceConnector(r,b.name,u.config);return u.result})}async call(i,$,n){let g=this.getConnector(i,$);if(!g)throw new iv(i,$);let v=this.registry.createAdapter(g);if(!v)throw Error(`connector type "${g.type}" does not support outbound calls`);return await v.call(n)}createListener(i,$){let n=this.get(i);if(!n)return null;let g=n.connectors.find((v)=>v.name===$);if(!g)return null;return{config:g,channelId:n.id,listener:this.registry.createListener(n.id,g)}}createAllListeners(){let i=[];for(let $ of this.list())for(let n of $.connectors)i.push({config:n,channelId:$.id,channelName:$.name,listener:this.registry.createListener($.id,n)});return i}requireChannel(i,$){let n=i.channels.find((g)=>g.name===$);if(!n)throw new sv($);return n}replaceConnector(i,$,n){let g=i.connectors.findIndex((v)=>v.name===$);if(g<0)throw Error(`connector "${$}" not found in channel "${i.name}"`);i.connectors[g]=n}assertNoTokenCollision(i,$){let n=this.registry.secretTokens($);if(n.length===0)return;for(let g of i.channels)for(let v of g.connectors){if(v.id===$.id)continue;for(let r of this.registry.secretTokens(v))if(n.includes(r))throw Error(`token already in use by connector "${v.name}" in channel "${g.name}"`)}}}var vW=new R,nW=new Zi;class w_{channels;mcp;gateway;sessions;guard;process;idGenerator;logger;dir;constructor(i){this.channels=i.channels,this.mcp=i.mcp,this.gateway=i.gateway,this.sessions=i.sessions,this.guard=i.guard,this.process=i.process??vW,this.idGenerator=i.idGenerator??nW,this.logger=i.logger,this.dir=i.dir,Object.freeze(this)}async launch(i){let $=this.channels.get(i.channel)??this.channels.getById(i.channel);if(!$)throw Error(`channel "${i.channel}" not found`);if(i.profileId&&this.guard.isRunning(i.profileId))throw Error(`profile "${i.profileId}" is already running`);let n=i.cwd??globalThis.process.cwd();if((i.installMcp??!0)&&!this.mcp.findInstalledName(n))this.mcp.install(n),this.logger?.info("added funnel MCP to .mcp.json",{cwd:n});if(!this.gateway.isRunning()){if(this.logger?.info("starting gateway automatically"),!await this.gateway.start())throw Error(`gateway failed to start on port ${Mi()}; another funnel daemon (a different repo/scope) may already hold it. See 'fnl gateway logs' and 'ps -o pid,args= | grep funnel-gateway'.`)}if(i.profileId)this.guard.acquire(i.profileId);let r=(i.resume??!1)&&i.profileId?this.resolveSession(i.profileId,n,i.userArgs??[],i.env??{}):null,b=this.buildArgs(i.options??[],i.userArgs??[],n,r),u=this.buildEnv($.id,i.env??{});this.logger?.info("claude launch",{channel:i.channel,channelId:$.id,cwd:n});try{return await this.process.attach(["claude",...b],{cwd:n,env:u,onSpawned:i.onSpawned})}finally{if(i.profileId)this.guard.release(i.profileId)}}buildArgs(i,$,n,g){let v=[...i,...$];if(g!==null)if(g.mode==="resume")v.push("--resume",g.id);else v.push("--session-id",g.id);let r=this.mcp.findInstalledName(n);if(r&&!v.includes("--dangerously-load-development-channels")&&!v.includes("--channels"))v.push("--dangerously-load-development-channels",`server:${r}`);return v}resolveSession(i,$,n,g){for(let b of n){if(b==="-c"||b==="--continue")return null;if(b==="--resume"||b.startsWith("--resume="))return null;if(b==="--session-id"||b.startsWith("--session-id="))return null}let v=this.sessions.getSessionId(i);if(v!==null&&this.sessions.sessionFileExists($,v,g))return{id:v,mode:"resume"};let r=this.idGenerator.generate();return this.sessions.setSessionId(i,r),{id:r,mode:"new"}}buildEnv(i,$){let n={};for(let[g,v]of Object.entries($))n[g]=v;for(let[g,v]of Object.entries(globalThis.process.env))if(typeof v==="string")n[g]=v;if(n.FUNNEL_CHANNEL_ID=i,n.FUNNEL_PORT=String(Mi()),this.dir!==void 0)n.FUNNEL_DIR=this.dir;return n}}import{join as Jk}from"path";var gW=new F,rW=new R;class kr{fs;process;pidDir;constructor(i={}){this.fs=i.fs??gW,this.process=i.process??rW,this.pidDir=Jk(i.dir??ji,"claude"),Object.freeze(this)}isRunning(i){let $=this.readRecord(i);if(!$)return!1;if(!this.process.isAlive($.pid))return this.release(i),!1;if($.startTime!==null){let n=this.process.getStartTime($.pid);if(n===null)return this.release(i),!1;if(n!==$.startTime)return this.release(i),!1}return!0}acquire(i){this.fs.mkdirSync(this.pidDir,{recursive:!0});let $=globalThis.process.pid,n=this.process.getStartTime($),g={pid:$,startTime:n};this.fs.writeFileSync(this.pidPath(i),JSON.stringify(g)),globalThis.process.once("exit",()=>this.release(i))}release(i){let $=this.pidPath(i);if(this.fs.existsSync($))this.fs.unlink($)}pidPath(i){return Jk(this.pidDir,`${i}.pid`)}readRecord(i){let $=this.pidPath(i);if(!this.fs.existsSync($))return null;try{let n=this.fs.readFileSync($).trim();if(!n)return null;if(n.startsWith("{")){let v=JSON.parse(n),r=typeof v.pid==="number"?v.pid:Number(v.pid);if(!Number.isInteger(r)||r<=0)return null;let b=typeof v.startTime==="string"?v.startTime:null;return{pid:r,startTime:b}}let g=Number(n);if(!g||g<=0)return null;return{pid:g,startTime:null}}catch{return null}}}import{dirname as Wk,join as uW}from"path";import{homedir as bW}from"os";import{join as Pk}from"path";function wr(i){let $=i.env.CLAUDE_CONFIG_DIR??globalThis.process.env.CLAUDE_CONFIG_DIR??Pk(bW(),".claude"),n=i.cwd.replace(/\//g,"-"),g=Pk($,"projects",n,`${i.sessionId}.jsonl`);if(!i.fs.existsSync(g))return!1;return i.fs.readFileSync(g).trim().length>0}var UW=D.record(D.string(),D.string());class j_{fs;path;constructor(i){this.fs=i.fs,this.path=uW(i.dir,"claude","local-sessions.json"),Object.freeze(this)}getSessionId(i){return this.fs.mkdirSync(Wk(this.path),{recursive:!0}),this.fs.withFileLock(`${this.path}.lock`,()=>this.read()[i]??null)}setSessionId(i,$){this.fs.mkdirSync(Wk(this.path),{recursive:!0}),this.fs.withFileLock(`${this.path}.lock`,()=>{let n=this.read();n[i]=$,this.fs.writeFileSync(this.path,`${JSON.stringify(n,null,2)}
75
+ `)})}sessionFileExists(i,$,n){return wr({fs:this.fs,cwd:i,sessionId:$,env:n})}read(){if(!this.fs.existsSync(this.path))return{};let i=JSON.parse(this.fs.readFileSync(this.path)),$=UW.safeParse(i);if(!$.success)throw Error(`invalid local profile session store (${this.path})`);return $.data}}class O_{global;local;constructor(i){this.global=i.global,this.local=i.local,Object.freeze(this)}getSessionId(i){return this.storeFor(i).getSessionId(i)}setSessionId(i,$){this.storeFor(i).setSessionId(i,$)}sessionFileExists(i,$,n){return this.global.sessionFileExists(i,$,n)}storeFor(i){return i.startsWith("local-")?this.local:this.global}}import{existsSync as _W,readFileSync as DW}from"fs";import{join as kW}from"path";var J$=async(i,$={},n=5000)=>{let g=AbortSignal.timeout(n),v=$.signal?AbortSignal.any([$.signal,g]):g;return fetch(i,{...$,signal:v})};var bn=(i)=>typeof i==="string"&&i.length>0?i:null;var IW=(i)=>i!==null&&typeof i==="object"&&!Array.isArray(i),J_=(i)=>{if(i===null)return null;try{let $=JSON.parse(i);if(IW($))return $}catch{return null}return null},Vk=(i,$)=>i.length<=$?i:`${i.slice(0,$)}\u2026`,Xk=(i)=>{if(typeof i!=="string"||i.length===0)return null;let $=J_(i);if($!==null&&"text"in $)return Vk(String($.text),60);return Vk(i,60)};var vv=(i)=>({seq:i.seq,ts:i.ts,type:i.type,outcome:i.outcome,eventId:i.eventId,payload:bn(i.payload),payloadParsed:J_(bn(i.payload)),preview:Xk(i.payload)}),fk=(i)=>({seq:i.seq,ts:i.ts,type:i.type,outcome:"",eventId:i.eventId,payload:bn(i.payload),payloadParsed:J_(bn(i.payload)),preview:Xk(i.payload)}),P$=(i)=>({seq:i.seq,ts:i.ts,type:i.type,status:i.status,detail:bn(i.detail)});var wW=(i)=>{if(i===null||typeof i!=="object")return!1;if(!("clients"in i)||!Array.isArray(i.clients))return!1;if(!("listeners"in i)||!Array.isArray(i.listeners))return!1;return!0},jW=(i,$)=>{if($===null)return;return i.connectors?.find((n)=>n.id===$)?.name},Qk=3,OW=100,Kk=(i)=>`${i.type}\x00${i.connectorId??""}`,JW=(i)=>{let $=new Map;return i.forEach((n,g)=>{if(n.status==="connected")$.set(Kk(n),g)}),i.filter((n,g)=>{if(n.status!=="auth-failed"&&n.status!=="error")return!1;return($.get(Kk(n))??-1)<g})},PW=(i,$=i.connectionErrors)=>{let g=($[$.length-1]??null)?.detail??null,v=i.channel;if(!i.gateway.running)return{status:"error",message:"gateway is not running",nextActions:["fnl gateway start"],rootCause:null};if(i.gateway.statusError!==null)return{status:"error",message:`gateway running but status probe failed: ${i.gateway.statusError}`,nextActions:["fnl gateway restart"],rootCause:i.gateway.statusError};if(i.configuredConnectors>i.listeners.length)return{status:"error",message:`${i.configuredConnectors} connector(s) configured but ${i.listeners.length} registered with supervisor`,nextActions:["fnl gateway restart"],rootCause:"supervisor missing listeners declared in settings.json"};if(i.configuredConnectors===0)return{status:"warn",message:"no connectors configured on this channel",nextActions:[`fnl channels ${v} connectors add <name> --type=slack ...`],rootCause:null};let r=$.filter((k)=>k.status==="auth-failed");if(r.length>0){let k=r[r.length-1]?.detail??null;return{status:"error",message:"connector credentials rejected (auth-failed)",nextActions:[`fnl channels ${v} connectors set <connector> --bot-token=<new>`,"fnl gateway restart"],rootCause:k??"token rejected by upstream auth.test"}}let b=i.listeners.every((k)=>!k.alive),u=i.listeners.some((k)=>!k.alive);if(b)return{status:"error",message:"all listeners are dead",nextActions:["fnl doctor --fix","fnl doctor --fix --aggressive"],rootCause:g};if(u)return{status:"warn",message:"some listeners are dead",nextActions:["fnl doctor --fix"],rootCause:g};let U=i.listeners.filter((k)=>k.errors>=Qk);if(U.length>0)return{status:"warn",message:`listener(s) flapping (\u2265${Qk} errors): ${U.map((k)=>k.name).join(", ")}`,nextActions:["fnl gateway logs"],rootCause:g};if(i.claudeClients===0)return{status:"warn",message:"no Claude connected to this channel",nextActions:[`fnl claude --channel ${v}`],rootCause:null};if(i.listeners.some((k)=>k.errors>0))return{status:"warn",message:"listeners have errors",nextActions:["fnl gateway logs"],rootCause:g};let _=WW(i);if(_!==null)return _;return{status:"ok",message:"everything looks healthy",nextActions:[],rootCause:null}},WW=(i)=>{if(!i.listeners.some((r)=>r.type==="slack")||i.recentEvents.length===0)return null;let n=i.recentEvents.filter((r)=>r.type==="slack").map((r)=>r.payloadParsed?.type);if(n.length===0)return null;let g=n.includes("app_mention"),v=n.includes("message");if(!g||v)return null;return{status:"warn",message:"Slack is only delivering app_mention events; unmentioned thread replies may not arrive",nextActions:["Add Slack bot events: message.channels, message.groups, message.im, message.mpim; reinstall the app; then restart the gateway"],rootCause:"Slack Event Subscriptions likely omit message.* events"}};class P_{props;constructor(i){this.props=i;Object.freeze(this)}async diagnose(i){let $=this.props.channels.list(),n=i?$.find((v)=>v.name===i)??null:$[0]??null;if(!n)return null;let g=await this.fetchGatewayStatus();return this.buildChannelDiagnosis(n,g,5)}async diagnoseAll(){let i=this.props.channels.list(),$=await this.fetchGatewayStatus(),n=await Promise.all(i.map((u)=>this.buildChannelDiagnosis(u,$,5))),g=n.filter((u)=>u.diagnosis.status==="error").map((u)=>u.channel),v=n.filter((u)=>u.diagnosis.status==="warn").map((u)=>u.channel),r=n.filter((u)=>u.diagnosis.status==="ok").map((u)=>u.channel),b=[...new Set(n.flatMap((u)=>u.diagnosis.nextActions))];return{summary:{total:n.length,ok:r.length,warn:v.length,error:g.length,criticalChannels:g,warnChannels:v,suggestedActions:b},channels:n}}async recentEvents(i,$={}){let n=$.limit??20,g=this.resolveScope(i,$.connector);if(g===null)return[];return this.queryLog((v)=>v.queryProcessed({...g,limit:n})).map(vv)}async droppedEvents(i,$={}){let n=$.limit??20,g=this.resolveScope(i,$.connector);if(g===null)return[];return this.queryLog((v)=>v.queryProcessed({...g,outcomePrefix:"skip:",limit:n})).map(vv)}async rawEvents(i,$={}){let n=$.limit??20,g=this.resolveScope(i,$.connector);if(g===null)return[];return this.queryLog((v)=>v.queryRaw({...g,limit:n})).map(fk)}async connectionErrors(i,$={}){let n=$.limit??20,g=this.resolveScope(i,$.connector);if(g===null)return[];return this.queryLog((v)=>v.queryConnection({...g,statuses:["auth-failed","error"],limit:n})).map(P$)}async connectionTimeline(i,$={}){let n=$.limit??20,g=this.resolveScope(i,$.connector);if(g===null)return[];return this.queryLog((v)=>v.queryConnection({...g,limit:n})).map(P$)}async recentLogs(i={}){let $=i.limit??200,n=kW(this.props.tmpDir,"funnel.log");if(!_W(n))return{lines:[],path:null,truncated:!1};let g;try{g=DW(n,"utf-8")}catch(I){return{lines:[`(read failed: ${E(I)})`],path:n,truncated:!1}}let v=g.split(`
76
+ `).filter((I)=>I.length>0),r=i.grep?.toLowerCase(),b=r?v.filter((I)=>I.toLowerCase().includes(r)):v,u=b.length>$;return{lines:u?b.slice(b.length-$):b,path:n,truncated:u}}async replay(i,$){let g=this.props.channels.list().find((Q)=>Q.name===i);if(!g)return{state:"not-found"};if(!this.props.diagnosticLog)return{state:"error",reason:"no diagnostic log configured"};let v=this.queryLogResult((Q)=>Q.queryProcessed({channelId:g.id,...$!==void 0?{seq:$}:{outcomePrefix:"emitted"},limit:1}));if(v instanceof Error)return{state:"error",reason:v.message};let r=v[0];if(!r)return{state:"not-found"};let{seq:b,eventId:u,connectorId:U}=r,I=r.payload.length>0?r.payload:null,_=I===null?this.queryLog((Q)=>Q.queryRaw({eventId:u,limit:1}))[0]?.payload??null:null,k=I??_;if(!k)return{state:"error",reason:"event has no payload to replay"};let O=jW(g,U),J=await this.props.publisher.publish(g.name,{content:k,connector:O});if(J.state==="offline")return{state:"offline"};if(J.state==="error")return{state:"error",reason:J.reason};return{state:"ok",seq:b,offset:J.offset,preview:k.slice(0,60)}}resolveScope(i,$){if(!i)return{};let g=this.props.channels.list().find((r)=>r.name===i)??null;if(!g)return null;if(!$)return{channelId:g.id};let v=g.connectors?.find((r)=>r.name===$)?.id??null;if(!v)return null;return{channelId:g.id,connectorId:v}}queryLog(i){let $=this.queryLogResult(i);return $ instanceof Error?[]:$}queryLogResult(i){let $=this.props.diagnosticLog;if(!$)return Error("no diagnostic log configured");try{return i($)}catch(n){return Error(E(n))}}async fetchGatewayStatus(){let i=this.props.gateway.getStatus();if(!i.running)return{body:null,error:null};let $=this.props.gatewayToken.read(),n=$?{Authorization:`Bearer ${$}`}:{},g=null;try{g=await J$(`${xi(i.port)}/status`,{headers:n})}catch(r){return{body:null,error:`fetch failed: ${E(r)}`}}if(!g.ok)return{body:null,error:`gateway /status returned ${g.status}`};let v;try{v=await g.json()}catch(r){return{body:null,error:`gateway /status body parse failed: ${E(r)}`}}if(!wW(v))return{body:null,error:"gateway /status returned an unrecognized shape"};return{body:v,error:null}}async buildChannelDiagnosis(i,$,n){let g=this.props.gateway.getStatus(),v=i.name,r=$.body,b={channel:v,channelId:i.id,gateway:{running:g.running,pid:g.pid,port:g.running?g.port:null,uptimeMs:r?.uptimeMs??null,statusError:$.error},configuredConnectors:i.connectors?.length??0,listeners:[],claudeClients:0,recentEvents:[],connectionErrors:[]};if(r)b.listeners=r.listeners.filter((U)=>U.channelName===v).map((U)=>({name:U.name,type:U.type,alive:U.alive,events:U.events,errors:U.errors,lastEventAt:U.lastEventAt})),b.claudeClients=r.clients.filter((U)=>U.channelName===v).length;let u=[];if(this.props.diagnosticLog){let U=this.queryLog((k)=>k.queryProcessed({channelId:i.id,limit:n}));b.recentEvents=U.map(vv);let I=this.queryLog((k)=>k.queryConnection({channelId:i.id,limit:OW})),_=I.filter((k)=>k.status==="auth-failed"||k.status==="error").slice(-3);b.connectionErrors=_.map(P$),u=JW(I).map(P$)}return{...b,diagnosis:PW(b,u)}}}class W_{props;constructor(i){this.props=i;Object.freeze(this)}async run(i="off"){if(i==="off"){let u=await this.props.diagnostics.diagnoseAll();return this.buildReport({before:null,after:u,appliedActions:[],fixFailed:!1})}let $=await this.props.diagnostics.diagnoseAll(),n=[],g=!1;if($.channels.some((u)=>u.diagnosis.status==="error"&&!u.gateway.running)){let u=await this.props.recovery.ensureGatewayRunning();if(n.push(...u.actions),!u.ok)g=!0}if($.channels.some((u)=>u.listeners.some((U)=>!U.alive))){let u=await this.props.recovery.restartAllDeadListeners();if(n.push(...u.actions),!u.ok&&u.actions.length===0)g=!0}if(i==="aggressive"){if((await this.props.diagnostics.diagnoseAll()).channels.some((I)=>I.diagnosis.status==="error")){let I=await this.props.recovery.restartGateway();if(n.push(...I.actions),!I.ok)g=!0}}let b=await this.props.diagnostics.diagnoseAll();return this.buildReport({before:$,after:b,appliedActions:n,fixFailed:g})}buildReport(i){let $=i.after.channels.filter((v)=>v.diagnosis.status!=="ok").map((v)=>({channel:v.channel,diagnosis:v.diagnosis})),n=i.fixFailed?"error":$.length===0?"ok":"warn",g=VW({mode:i.before===null?"off":"fix",status:n,appliedCount:i.appliedActions.length,remainingCount:$.length});return{status:n,message:g,before:i.before,after:i.after,appliedActions:i.appliedActions,remainingIssues:$}}}var VW=(i)=>{if(i.mode==="off"){if(i.remainingCount===0)return"all channels healthy";return`${i.remainingCount} channel(s) need attention \u2014 run \`fnl doctor --fix\` to apply suggested fixes`}if(i.status==="error")return"one or more fix steps failed \u2014 check fnl gateway logs";if(i.status==="ok")return`applied ${i.appliedCount} fix(es), all channels healthy`;return`applied ${i.appliedCount} fix(es), ${i.remainingCount} channel(s) still need attention`};var Gk=`funnel docs architecture \u2014 how Funnel routes events
77
77
 
78
78
  Funnel is a hub between external sources (Slack / GitHub / Discord / cron) and
79
79
  Claude Code agents. Events flow one way; replies flow back via MCP tools.
@@ -112,7 +112,7 @@ key invariants:
112
112
  - per-repo state is fully isolated from global state \u2014 they never mix
113
113
  - URL building is type-safe via channelWsUrl / gatewayLoopbackUrl helpers
114
114
 
115
- related: fnl docs channels, fnl docs profiles, fnl docs mcp`;var Gk=`funnel docs channels \u2014 what a channel is
115
+ related: fnl docs channels, fnl docs profiles, fnl docs mcp`;var Yk=`funnel docs channels \u2014 what a channel is
116
116
 
117
117
  A channel is a subscription mailbox. It owns connectors and decides how events
118
118
  fan out to subscribers.
@@ -148,7 +148,7 @@ operations:
148
148
 
149
149
  connectors live nested inside a channel \u2014 see fnl docs connectors.
150
150
 
151
- related: fnl docs connectors, fnl docs profiles`;var Yk=`funnel docs claude \u2014 launching Claude Code through funnel
151
+ related: fnl docs connectors, fnl docs profiles`;var Hk=`funnel docs claude \u2014 launching Claude Code through funnel
152
152
 
153
153
  \`fnl claude\` spawns Claude with the channel subscription wired in. The
154
154
  resolution order is:
@@ -183,7 +183,7 @@ double-launch guard:
183
183
  ~/.funnel/projects/<id>/profiles/<profile-id>/pid. Stale PID files are
184
184
  cleaned up automatically when the recorded process is gone.
185
185
 
186
- related: fnl docs profiles, fnl docs mcp, fnl docs local-config`;var Hk=`funnel docs connectors \u2014 external service bindings
186
+ related: fnl docs profiles, fnl docs mcp, fnl docs local-config`;var zk=`funnel docs connectors \u2014 external service bindings
187
187
 
188
188
  A connector is one connection to one external service. It is nested inside a
189
189
  channel \u2014 a channel can host several connectors of different types.
@@ -226,7 +226,7 @@ tokens:
226
226
  \u2026or leave unset and fnl claude will TTY-prompt at first launch and persist
227
227
  to ~/.funnel/projects/<id>/settings.json.
228
228
 
229
- related: fnl docs channels, fnl docs debugging`;var zk=`funnel docs debugging \u2014 diagnose and self-heal in one shot
229
+ related: fnl docs channels, fnl docs debugging`;var Sk=`funnel docs debugging \u2014 diagnose and self-heal in one shot
230
230
 
231
231
  Funnel ships with a single entry point that diagnoses every channel and, when
232
232
  asked, applies safe self-healing fixes. Use this from the CLI (fnl doctor),
@@ -312,7 +312,7 @@ Claude in any repo calls these tools without leaving MCP:
312
312
  CLI, MCP, and the SDK share exactly one implementation \u2014 the CLI is a thin
313
313
  presentation layer over funnel.doctor.
314
314
 
315
- related: fnl docs gateway, fnl docs mcp, fnl docs recipes`;var Sk=`funnel docs gateway \u2014 the WebSocket + HTTP daemon
315
+ related: fnl docs gateway, fnl docs mcp, fnl docs recipes`;var Ak=`funnel docs gateway \u2014 the WebSocket + HTTP daemon
316
316
 
317
317
  The gateway is a long-lived Bun.serve process that hosts every realtime
318
318
  boundary in funnel. Without it: store edits work, but no events flow and
@@ -362,7 +362,7 @@ when do you need the gateway?
362
362
  fnl debug (reads /status + /tmp/funnel/*.db)
363
363
  no gateway: fnl channels add / remove, fnl profiles add, fnl schema
364
364
 
365
- related: fnl docs debugging, fnl docs architecture`;var Ak=`funnel docs glossary \u2014 vocabulary reference
365
+ related: fnl docs debugging, fnl docs architecture`;var Bk=`funnel docs glossary \u2014 vocabulary reference
366
366
 
367
367
  Channel
368
368
  Subscription mailbox. Holds connectors and decides fan-out behavior.
@@ -460,7 +460,7 @@ generating the schema for editors:
460
460
  # then in funnel.json:
461
461
  { "$schema": "./funnel.schema.json", ... }
462
462
 
463
- related: fnl docs profiles, fnl docs channels, fnl schema`;var Bk=`funnel docs mcp \u2014 the MCP server inside funnel
463
+ related: fnl docs profiles, fnl docs channels, fnl schema`;var Lk=`funnel docs mcp \u2014 the MCP server inside funnel
464
464
 
465
465
  \`fnl mcp\` is invoked by Claude Code via .mcp.json (auto-installed when fnl
466
466
  claude runs in a repo). It hosts two independent pipes over one stdio MCP
@@ -503,7 +503,7 @@ operations:
503
503
  fnl mcp run as MCP server (do not invoke manually \u2014 Claude
504
504
  launches it via .mcp.json)
505
505
 
506
- related: fnl docs claude, fnl docs debugging`;var Lk=`funnel docs profiles \u2014 launch presets for Claude
506
+ related: fnl docs claude, fnl docs debugging`;var Tk=`funnel docs profiles \u2014 launch presets for Claude
507
507
 
508
508
  A profile is a saved recipe for launching Claude bound to a specific channel.
509
509
  Profiles are NOT required \u2014 \`fnl claude --channel <name>\` works without one.
@@ -545,7 +545,7 @@ operations:
545
545
  fnl profiles <name> run spawn Claude using this profile
546
546
  fnl claude --profile <name> equivalent to <name> run
547
547
 
548
- related: fnl docs claude, fnl docs channels`;var Tk=`funnel docs programmable-api \u2014 Funnel as an SDK
548
+ related: fnl docs claude, fnl docs channels`;var Zk=`funnel docs programmable-api \u2014 Funnel as an SDK
549
549
 
550
550
  Everything funnel does as a CLI is also a programmable API. Build your own CLI,
551
551
  TUI, web UI, or service on top of the same engine \u2014 the CLI itself is a thin
@@ -737,7 +737,7 @@ fast, hermetic tests:
737
737
  funnel.channels.add({ name: "ops" })
738
738
  expect(funnel.channels.list()).toHaveLength(1)
739
739
 
740
- related: fnl docs architecture, fnl docs debugging, fnl docs mcp`;var Zk=`funnel docs recipes \u2014 common task playbooks
740
+ related: fnl docs architecture, fnl docs debugging, fnl docs mcp`;var qk=`funnel docs recipes \u2014 common task playbooks
741
741
 
742
742
  \u2014 bootstrap a new repo \u2014
743
743
 
@@ -790,8 +790,8 @@ related: fnl docs architecture, fnl docs debugging, fnl docs mcp`;var Zk=`funnel
790
790
  fnl gateway restart
791
791
  fnl debug --all --json # verify everything came back up
792
792
 
793
- related: fnl docs debugging, fnl docs channels, fnl docs profiles`;var V_={architecture:Kk,channels:Gk,claude:Yk,connectors:Hk,debugging:zk,gateway:Sk,glossary:Ak,"local-config":lk,mcp:Bk,profiles:Lk,"programmable-api":Tk,recipes:Zk},PW={architecture:"how Funnel routes events end-to-end",channels:"what a channel is and how delivery modes work",connectors:"external service bindings nested in channels",profiles:"named Claude launch presets",claude:"fnl claude resolution order and argv assembly",mcp:"the MCP server, inbound notifications, outbound tools",gateway:"the WebSocket + HTTP daemon","local-config":"the per-repo funnel.json file",debugging:"ladder for diagnosing event delivery problems","programmable-api":"Funnel as an SDK; build your own CLI/UI on the engine",recipes:"common task playbooks",glossary:"vocabulary reference"};class X_{constructor(){Object.freeze(this)}list(){return Object.keys(V_).sort().map((i)=>({name:i,summary:PW[i]??""}))}get(i){return V_[i]??null}topics(){return Object.keys(V_).sort()}}import{join as YW}from"path";var WW=D.object({type:D.literal("slack"),name:D.string(),minify:D.boolean().optional()}),VW=D.object({type:D.literal("discord"),name:D.string()}),XW=D.object({type:D.literal("gh"),name:D.string(),pollInterval:D.number().int().positive().optional()}),fW=D.object({type:D.literal("schedule"),name:D.string()}),QW=D.discriminatedUnion("type",[WW,VW,XW,fW]),KW=D.object({name:D.string(),connectors:D.array(QW).optional()}),GW=D.object({name:D.string(),channel:D.string(),options:D.array(D.string()).optional(),env:D.record(D.string(),D.string()).optional(),resume:D.boolean().optional()}),qk=D.object({$schema:D.string().optional(),id:D.string().optional(),channels:D.array(KW).min(1),profiles:D.array(GW).optional()}),nv="funnel.json";class f_{fs;constructor(i){this.fs=i.fs,Object.freeze(this)}read(i){let $=YW(i,nv);if(!this.fs.existsSync($))return null;let n=this.fs.readFileSync($),g=(()=>{try{return JSON.parse(n)}catch(r){let b=r instanceof Error?r.message:String(r);throw Error(`${nv} is not valid JSON: ${b}`)}})(),v=qk.safeParse(g);if(!v.success)throw Error(`${nv} is invalid: ${v.error.message}`);return this.assertProfilesValid(v.data),v.data}assertProfilesValid(i){let $=i.profiles??[];if($.length===0)return;let n=new Set(i.channels.map((v)=>v.name)),g=new Set;for(let v of $){if(!n.has(v.channel))throw Error(`${nv} is invalid: profile "${v.name}" binds channel "${v.channel}", which is not declared in channels[]`);if(g.has(v.name))throw Error(`${nv} is invalid: more than one profile is named "${v.name}" \u2014 names must be unique`);g.add(v.name)}}}function Q_(i){if(i.env!==void 0)return{botTokenEnv:i.env};if(i.literal!==void 0)return{botToken:i.literal};return{}}function Mk(i){if(i.env!==void 0)return{appTokenEnv:i.env};if(i.literal!==void 0)return{appToken:i.literal};return{}}class K_{channels;prompter;constructor(i){this.channels=i.channels,this.prompter=i.prompter,Object.freeze(this)}async ensure(i){if(!this.channels.get(i.name))this.channels.add({name:i.name});if(i.connectors===void 0)return{touched:[],removed:[]};let n=[],g=new Set;for(let r of i.connectors){let b=await this.ensureConnector(i.name,r);n.push({name:b.name,changed:b.changed}),g.add(b.id)}let v=this.removeExtras(i.name,g);return{touched:n,removed:v}}async ensureConnector(i,$){if($.type==="slack")return await this.ensureSlack(i,$);if($.type==="discord")return await this.ensureDiscord(i,$);if($.type==="gh")return this.ensureGh(i,$);return this.ensureSchedule(i,$)}async ensureSlack(i,$){let n=this.findExistingSlack(i,$.name),g=await this.resolveSlot({label:`${$.name}.botToken`,existingLiteral:n?.botToken,existingEnv:n?.botTokenEnv}),v=await this.resolveSlot({label:`${$.name}.appToken`,existingLiteral:n?.appToken,existingEnv:n?.appTokenEnv}),r={botToken:g.token,botTokenEnv:g.tokenEnv,appToken:v.token,appTokenEnv:v.tokenEnv};if(n){if(!(n.botToken===g.token&&n.botTokenEnv===g.tokenEnv&&n.appToken===v.token&&n.appTokenEnv===v.tokenEnv))return this.channels.updateSlackConnector(i,$.name,r),{id:n.id,name:$.name,changed:!0};return{id:n.id,name:$.name,changed:!1}}return{id:this.channels.addConnector(i,{type:"slack",name:$.name,...Q_({literal:g.token,env:g.tokenEnv}),...Mk({literal:v.token,env:v.tokenEnv}),...$.minify!==void 0?{minify:$.minify}:{}}).id,name:$.name,changed:!0}}async ensureDiscord(i,$){let n=this.findExistingDiscord(i,$.name),g=await this.resolveSlot({label:`${$.name}.botToken`,existingLiteral:n?.botToken,existingEnv:n?.botTokenEnv}),v={botToken:g.token,botTokenEnv:g.tokenEnv};if(n){if(n.botToken!==g.token||n.botTokenEnv!==g.tokenEnv)return this.channels.updateDiscordConnector(i,$.name,v),{id:n.id,name:$.name,changed:!0};return{id:n.id,name:$.name,changed:!1}}return{id:this.channels.addConnector(i,{type:"discord",name:$.name,...Q_({literal:g.token,env:g.tokenEnv})}).id,name:$.name,changed:!0}}ensureGh(i,$){let n=this.channels.getConnector(i,$.name);if(n&&n.type!=="gh")throw Error(`connector "${$.name}" exists in channel "${i}" with type "${n.type}", funnel.json declares "gh"`);if(n&&n.type==="gh"){let v=Li.parse(n);if($.pollInterval!==void 0&&v.pollInterval!==$.pollInterval)return this.channels.updateGhConnector(i,$.name,{pollInterval:$.pollInterval}),{id:v.id,name:$.name,changed:!0};return{id:v.id,name:$.name,changed:!1}}return{id:this.channels.addConnector(i,{type:"gh",name:$.name,...$.pollInterval!==void 0?{pollInterval:$.pollInterval}:{}}).id,name:$.name,changed:!0}}ensureSchedule(i,$){let n=this.channels.getConnector(i,$.name);if(n&&n.type!=="schedule")throw Error(`connector "${$.name}" exists in channel "${i}" with type "${n.type}", funnel.json declares "schedule"`);if(n&&n.type==="schedule")return{id:n.id,name:$.name,changed:!1};return{id:this.channels.addConnector(i,{type:"schedule",name:$.name}).id,name:$.name,changed:!0}}findExistingSlack(i,$){let n=this.channels.getConnector(i,$);if(!n)return null;if(n.type!=="slack")throw Error(`connector "${$}" exists in channel "${i}" with type "${n.type}", funnel.json declares "slack"`);return Ti.parse(n)}findExistingDiscord(i,$){let n=this.channels.getConnector(i,$);if(!n)return null;if(n.type!=="discord")throw Error(`connector "${$}" exists in channel "${i}" with type "${n.type}", funnel.json declares "discord"`);return Ai.parse(n)}removeExtras(i,$){let n=this.channels.get(i);if(!n)return[];let g=n.connectors.filter((v)=>!$.has(v.id));for(let v of g)this.channels.removeConnector(i,v.name);return g.map((v)=>v.name)}async resolveSlot(i){if(i.existingEnv!==void 0)return{token:void 0,tokenEnv:i.existingEnv};if(i.existingLiteral!==void 0)return{token:i.existingLiteral,tokenEnv:void 0};return{token:await this.prompter.promptSecret(i.label),tokenEnv:void 0}}}import{join as jr}from"path";var HW="bun",zW=["funnel","mcp"],SW="funnel",AW=new F,un=(i)=>{return typeof i==="object"&&i!==null&&!Array.isArray(i)};class G_{fs;constructor(i={}){this.fs=i.fs??AW,Object.freeze(this)}install(i){if(!this.fs.existsSync(i))throw Error(`repository does not exist: ${i}`);this.fs.withFileLock(jr(i,".mcp.json.lock"),()=>{let $=this.readConfig(i),n=$.mcpServers,g=un(n)?n:{},r=this.findServerName(g)??SW;g[r]={command:HW,args:zW},$.mcpServers=g,this.writeConfig(i,$)})}uninstall(i){if(!this.fs.existsSync(i))return;this.fs.withFileLock(jr(i,".mcp.json.lock"),()=>{let $=this.readConfig(i),n=$.mcpServers;if(!un(n))return;let g=this.findServerName(n);if(!g)return;delete n[g],this.writeConfig(i,$)})}findInstalledName(i){let n=this.readConfig(i).mcpServers;return un(n)?this.findServerName(n):null}findServerName(i){for(let $ of Object.entries(i))if(this.isFunnelEntry($[1]))return $[0];return null}isFunnelEntry(i){if(!un(i))return!1;let{command:$,args:n}=i;if($==="bun"&&Array.isArray(n)&&n[0]==="funnel")return!0;if($==="funnel")return!0;return!1}readConfig(i){let $=jr(i,".mcp.json");if(!this.fs.existsSync($))return{};let n=this.fs.readFileSync($).trim();if(!n)return{};let g;try{g=JSON.parse(n)}catch(v){throw Error(`invalid .mcp.json (${$}): ${v instanceof Error?v.message:String(v)}`)}if(!un(g))throw Error(`invalid .mcp.json (${$}): expected a JSON object`);return g}writeConfig(i,$){let n=jr(i,".mcp.json");this.fs.writeFileSync(n,`${JSON.stringify($,null,2)}
794
- `)}}var lW=new F;class Y_{store;idGenerator;fs;constructor(i){this.store=i.store,this.idGenerator=i.idGenerator,this.fs=i.fs??lW,Object.freeze(this)}list(){return this.store.read().profiles}get(i){return this.list().find(($)=>$.name===i)??null}getById(i){return this.list().find(($)=>$.id===i)??null}getDefault(){return this.list()[0]??null}add(i){this.store.update(($)=>{if($.profiles.some((n)=>n.name===i.name))throw Error(`profile "${i.name}" already exists`);if(!$.channels.some((n)=>n.id===i.channelId))throw Error(`channel id "${i.channelId}" not found`);$.profiles.push({id:this.idGenerator.generate(),name:i.name,path:i.path,channelId:i.channelId,options:i.options??[],env:i.env??{},resume:i.resume??!0})})}remove(i){this.store.update(($)=>{let n=$.profiles.findIndex((g)=>g.name===i);if(n<0)throw Error(`profile "${i}" not found`);$.profiles.splice(n,1)})}rename(i,$){this.store.update((n)=>{let g=n.profiles.find((v)=>v.name===i);if(!g)throw Error(`profile "${i}" not found`);if(n.profiles.some((v)=>v.name===$))throw Error(`profile "${$}" already exists`);g.name=$})}asDefault(i){this.store.update(($)=>{let n=$.profiles.findIndex((v)=>v.name===i);if(n<0)throw Error(`profile "${i}" not found`);if(n===0)return;let[g]=$.profiles.splice(n,1);if(!g)return;$.profiles.unshift(g)})}hasChannelRef(i){return this.store.read().profiles.some(($)=>$.channelId===i)}getSessionId(i){return this.getById(i)?.sessionId??null}setSessionId(i,$){this.store.update((n)=>{let g=n.profiles.find((v)=>v.id===i);if(!g)throw Error(`profile id "${i}" not found`);g.sessionId=$})}sessionFileExists(i,$,n){return wr({fs:this.fs,cwd:i,sessionId:$,env:n})}update(i,$){this.store.update((n)=>{let g=n.profiles.find((v)=>v.name===i);if(!g)throw Error(`profile "${i}" not found`);if($.channelId!==void 0){if(!n.channels.some((v)=>v.id===$.channelId))throw Error(`channel id "${$.channelId}" not found`);g.channelId=$.channelId}if($.path!==void 0)g.path=$.path;if($.options!==void 0)g.options=$.options;if($.env!==void 0)g.env=$.env;if($.resume!==void 0)g.resume=$.resume})}}class H_{props;constructor(i){this.props=i;Object.freeze(this)}async ensureGatewayRunning(){if(this.props.gateway.isRunning())return{ok:!0,actions:[{kind:"gateway:already-running"}],message:"gateway is already running"};if(!await this.props.gateway.start())return{ok:!1,actions:[],message:"gateway failed to start \u2014 check `fnl gateway logs`"};return{ok:!0,actions:[{kind:"gateway:started"}],message:"gateway started"}}async restartGateway(){if(!(await this.props.gateway.restart()).ok)return{ok:!1,actions:[],message:"gateway restart failed \u2014 check `fnl gateway logs`"};return{ok:!0,actions:[{kind:"gateway:restarted"}],message:"gateway restarted"}}async restartListener(i,$){let n=await this.props.listeners.restart(i,$);if(n.state==="offline")return{ok:!1,actions:[],message:"gateway is not running \u2014 call ensureGatewayRunning() first"};if(n.state==="not-found")return{ok:!1,actions:[{kind:"listener:skipped",channel:i,connector:$,reason:"not-found"}],message:`listener not found: ${i}/${$}`};if(n.state==="error")return{ok:!1,actions:[{kind:"listener:skipped",channel:i,connector:$,reason:n.reason}],message:`listener restart failed: ${n.reason}`};return{ok:!0,actions:[{kind:"listener:restarted",channel:i,connector:$}],message:`restarted ${i}/${$}`}}async restartAllDeadListeners(){let i=await this.props.listeners.list();if(i.state==="offline")return{ok:!1,actions:[],message:"gateway is not running \u2014 call ensureGatewayRunning() first"};if(i.state==="error")return{ok:!1,actions:[],message:`could not list listeners: ${i.reason}`};let $=i.listeners.filter((v)=>!v.alive);if($.length===0)return{ok:!0,actions:[],message:"no dead listeners found"};let n=[];for(let v of $){let r=await this.props.listeners.restart(v.channelName,v.name);if(r.state==="ok")n.push({kind:"listener:restarted",channel:v.channelName,connector:v.name});else{let b=r.state==="error"?r.reason:r.state;n.push({kind:"listener:skipped",channel:v.channelName,connector:v.name,reason:b})}}let g=n.filter((v)=>v.kind==="listener:restarted").length;return{ok:g>0,actions:n,message:`restarted ${g}/${$.length} dead listener(s)`}}}import{stderr as Or,stdin as Qi}from"process";class Un{}var BW="*",LW="\r",xk=`
795
- `,TW=String.fromCharCode(8),ZW=String.fromCharCode(127),qW=String.fromCharCode(3),MW=String.fromCharCode(4);class z_ extends Un{async promptSecret(i){if(!Qi.isTTY)throw Error(`cannot prompt for "${i}": stdin is not a TTY. Set the matching env var or run \`fnl channels <ch> connectors add ...\` first.`);Or.write(`${i}: `);let $=Qi.isRaw;Qi.setRawMode(!0),Qi.resume();try{return await this.readSecret()}finally{Qi.setRawMode($),Qi.pause(),Or.write(xk)}}readSecret(){return new Promise((i,$)=>{let n="",g=(v)=>{for(let r of v){let b=String.fromCharCode(r);if(b===xk||b===LW){Qi.off("data",g),i(n);return}if(b===qW){Qi.off("data",g),$(Error("prompt cancelled"));return}if(b===MW){if(Qi.off("data",g),n.length===0)$(Error("prompt cancelled"));else i(n);return}if(b===TW||b===ZW){if(n.length>0)n=n.slice(0,-1),Or.write("\b \b");continue}n+=b,Or.write(BW)}};Qi.on("data",g)})}}var xW=384;class S_ extends av{dirs;files;mtimes;modes;now;constructor(i={}){super();this.dirs=new Set(i.dirs??[]),this.files=new Map(Object.entries(i.files??{})),this.mtimes=new Map(Object.entries(i.mtimes??{})),this.modes=new Map(Object.entries(i.modes??{})),this.now=i.now??(()=>Date.now())}existsSync(i){return this.dirs.has(i)||this.files.has(i)}readFileSync(i){return this.files.get(i)??""}writeFileSync(i,$){this.files.set(i,$),this.touch(i)}writeSecretFileSync(i,$){this.files.set(i,$),this.modes.set(i,xW),this.touch(i)}appendFileSync(i,$){let n=this.files.get(i)??"";this.files.set(i,n+$),this.touch(i)}unlink(i){this.files.delete(i),this.mtimes.delete(i),this.modes.delete(i)}mkdirSync(i,$){this.dirs.add(i)}readdirSync(i){let $=i.endsWith("/")?i:`${i}/`,n=[];for(let g of this.files.keys()){if(!g.startsWith($))continue;let v=g.slice($.length);if(!v.includes("/"))n.push(v)}return n}statSync(i){let $=this.mtimes.get(i);if($===void 0)throw Error(`not found: ${i}`);return{mtimeMs:$,mode:this.modes.get(i)??null}}withFileLock(i,$){return $()}setMtime(i,$){this.mtimes.set(i,$)}setMode(i,$){this.modes.set(i,$)}touch(i){if(!this.mtimes.has(i))this.mtimes.set(i,this.now());else this.mtimes.set(i,this.now())}}class A_ extends vn{counter=0;prefix;constructor(i={}){super();this.prefix=i.prefix??"id"}generate(){return this.counter++,`${this.prefix}-${this.counter}`}}class In{}class l_ extends In{file=null;entries=[];info(i,$){this.entries.push({level:"info",message:i,meta:$})}warn(i,$){this.entries.push({level:"warn",message:i,meta:$})}error(i,$){this.entries.push({level:"error",message:i,meta:$})}clear(){this.entries.length=0}}var Nk={exitCode:0,stdout:"",stderr:""};class B_ extends yv{calls=[];killed=[];handler=()=>Nk;syncHandler=()=>Nk;aliveStub=null;listStub=null;startTimeStub=null;on(i){return this.handler=i,this}onSync(i){return this.syncHandler=i,this}onIsAlive(i){return this.aliveStub=i,this}onListProcessesContaining(i){return this.listStub=i,this}onGetStartTime(i){return this.startTimeStub=i,this}async run(i,$={}){this.calls.push({kind:"run",command:i,options:$});let n=await this.handler(i);return{exitCode:n.exitCode??0,stdout:n.stdout??"",stderr:n.stderr??""}}runSync(i){this.calls.push({kind:"runSync",command:i});let $=this.syncHandler(i);return{exitCode:$.exitCode??0,stdout:$.stdout??"",stderr:$.stderr??""}}async attach(i,$={}){if(this.calls.push({kind:"attach",command:i,options:$}),$.onSpawned)$.onSpawned(1);return(await this.handler(i)).exitCode??0}detach(i,$={}){this.calls.push({kind:"detach",command:i,options:$})}kill(i,$="SIGTERM"){this.calls.push({kind:"kill",command:[String(i),$]}),this.killed.push({pid:i,signal:$})}isAlive(i){if(this.aliveStub)return this.aliveStub(i);let $=this.syncHandler(["ps","-p",String(i),"-o","state="]);if(($.exitCode??0)!==0)return!1;let n=($.stdout??"").trim();if(!n)return!1;return!n.startsWith("Z")}listProcessesContaining(i){if(this.listStub)return this.listStub(i);return[]}getStartTime(i){if(this.startTimeStub)return this.startTimeStub(i);return null}}var NW=(i={})=>({version:qi,channels:[],profiles:[],...i});class L_ extends nn{state;constructor(i){super();this.state=NW(i)}read(){return this.state}write(i){this.state=i}update(i){return i(this.state)}}class T_ extends rn{current;constructor(i={}){super();this.current=i.start??new Date(0)}now(){return new Date(this.current.getTime())}set(i){this.current=i}advance(i){this.current=new Date(this.current.getTime()+i)}}class Z_ extends Uv{calls=[];handler=()=>({status:200,body:""});on(i){return this.handler=i,this}async fetch(i){this.calls.push(i);let $=await this.handler(i),n=$.status??200,g=$.body??"";return{status:n,ok:n>=200&&n<300,text:async()=>g,json:async()=>JSON.parse(g)}}}class q_ extends Un{answers;asked=[];constructor(i={}){super();this.answers=new Map(Object.entries(i.answers??{}))}async promptSecret(i){this.asked.push(i);let $=this.answers.get(i);if($===void 0)throw Error(`no answer seeded for prompt "${i}"`);return $}}var tW=["started","connected","disconnected","auth-failed","stopped","error"],H7=D.object({event_id:D.string(),type:D.string(),connector_id:D.string().nullable(),channel_id:D.string().nullable(),payload:D.string()}),z7=D.object({event_id:D.string(),type:D.string(),connector_id:D.string().nullable(),channel_id:D.string().nullable(),outcome:D.string(),payload:D.string()}),tk=D.object({type:D.string(),connector_id:D.string().nullable(),channel_id:D.string().nullable(),status:D.enum(tW),detail:D.string()});class _n{}class N_ extends _n{now;raws=[];processeds=[];connections=[];constructor(i=()=>Date.now()){super();this.now=i;Object.freeze(this)}recordRaw(i){this.raws.push({...i,seq:this.raws.length+1,ts:this.now()})}recordProcessed(i){this.processeds.push({...i,seq:this.processeds.length+1,ts:this.now()})}recordConnection(i){this.connections.push({...i,seq:this.connections.length+1,ts:this.now()})}queryRaw(i){let $=this.raws.filter((n)=>{if(!M_(n,i))return!1;if(i.eventId!==void 0&&n.eventId!==i.eventId)return!1;return!0});return x_($,i.limit)}queryProcessed(i){let $=this.processeds.filter((n)=>{if(!M_(n,i))return!1;if(i.eventId!==void 0&&n.eventId!==i.eventId)return!1;if(i.outcome!==void 0&&n.outcome!==i.outcome)return!1;if(i.outcomePrefix!==void 0&&!n.outcome.startsWith(i.outcomePrefix))return!1;return!0});return x_($,i.limit)}queryConnection(i){let $=this.connections.filter((n)=>{if(!M_(n,i))return!1;if(i.status!==void 0&&n.status!==i.status)return!1;if(i.statuses!==void 0&&!i.statuses.includes(n.status))return!1;return!0});return x_($,i.limit)}clear(){this.raws.length=0,this.processeds.length=0,this.connections.length=0}close(){}}var M_=(i,$)=>{if($.type!==void 0&&i.type!==$.type)return!1;if($.connectorId!==void 0&&i.connectorId!==$.connectorId)return!1;if($.channelId!==void 0&&i.channelId!==$.channelId)return!1;if("seq"in i&&$.seq!==void 0&&i.seq!==$.seq)return!1;return!0},x_=(i,$)=>{if($===void 0)return i;if($<=0)return[];return i.slice(-$)};var Ek=D.object({content:D.string().min(1),meta:D.record(D.string(),D.string()).optional(),connector:D.string().min(1).optional(),target:D.string().min(1).optional()}),ck=D.object({ok:D.literal(!0),offset:D.number().int().nonnegative()});var EW={state:"offline"};class t_{port;isDaemonRunning;getToken;constructor(i){this.port=i.port,this.isDaemonRunning=i.isDaemonRunning,this.getToken=i.getToken??(()=>null),Object.freeze(this)}async publish(i,$){if(!this.isDaemonRunning())return EW;try{let n=`${xi(this.port)}/channels/${encodeURIComponent(i)}/publish`,g=await J$(n,{method:"POST",headers:{...this.authHeaders(),"content-type":"application/json"},body:JSON.stringify($)});if(!g.ok)return{state:"error",reason:await g.text()||`HTTP ${g.status}`};let v=ck.safeParse(await g.json());if(!v.success)return{state:"error",reason:"malformed daemon response"};return{state:"ok",offset:v.data.offset}}catch(n){return{state:"error",reason:n instanceof Error?n.message:String(n)}}}authHeaders(){let i=this.getToken();return i?{authorization:`Bearer ${i}`}:{}}}import{join as Ck}from"path";import{existsSync as cW}from"fs";import{dirname as CW,resolve as E_}from"path";import{fileURLToPath as RW}from"url";var Jr=()=>{let i=CW(RW(import.meta.url)),$=[E_(i,"./daemon.ts"),E_(i,"./daemon.js"),E_(i,"./gateway/daemon.js")];for(let n of $)if(cW(n))return n;throw Error(`daemon script not found (looked in ${$.join(", ")})`)};var FW=5000,oW=2000,Rk=100,mW=200,yW=new R,hW=new F,dW=new Ni,aW=(i)=>new Promise(($)=>{setTimeout($,i)});class c_{process;fs;clock;dir;pidFile;gatewayLog;tmpDir;port;sleep;constructor(i={}){this.process=i.process??yW,this.fs=i.fs??hW,this.clock=i.clock??dW,this.dir=i.dir??ji,this.tmpDir=i.tmpDir??fi(),this.pidFile=Ck(this.dir,"gateway.pid"),this.gatewayLog=Ck(this.tmpDir,"gateway.log"),this.port=i.port??Mi(),this.sleep=i.sleep??aW,Object.freeze(this)}isRunning(){let i=this.readPid();if(!i)return!1;return this.isProcessAlive(i)}getStatus(){let i=this.readPid(),$=i!==null&&this.isProcessAlive(i);return{running:$,pid:$?i:null,port:this.port}}async start(i={}){if(this.isRunning())return!0;this.fs.mkdirSync(this.tmpDir,{recursive:!0});let $=Jr(),n=this.buildStartCommand($,i);this.process.detach(n,{env:{FUNNEL_DIR:this.dir,FUNNEL_PORT:String(this.port),FUNNEL_TMP_DIR:this.tmpDir},stdoutFile:this.gatewayLog,stderrFile:this.gatewayLog});let g=this.clock.millis()+FW;while(this.clock.millis()<g){if(this.isRunning())return!0;await this.sleep(Rk)}return this.isRunning()}buildStartCommand(i,$={}){let n=`funnel-gateway[${this.dir}]`;if($.caffeinate!==!1&&globalThis.process.platform==="darwin")return["caffeinate","-is","bun",i,n];return["bun",i,n]}async stop(){let i=this.readPid();if(!i)return!0;if(!this.isProcessAlive(i))return this.removePid(),!0;try{this.process.kill(i,"SIGTERM")}catch{return!1}let $=this.clock.millis()+oW;while(this.clock.millis()<$){if(!this.isProcessAlive(i))return this.removePid(),!0;await this.sleep(Rk)}try{this.process.kill(i,"SIGKILL")}catch{}return await this.sleep(mW),this.removePid(),!this.isProcessAlive(i)}async restart(i={}){let $=this.isRunning();if(i.onlyIfRunning&&!$)return{ok:!0,wasRunning:!1,stopped:!1,started:!1};let n=$?await this.stop():!0;if(!n)return{ok:!1,wasRunning:$,stopped:!1,started:!1};let g=await this.start({caffeinate:i.caffeinate});return{ok:g,wasRunning:$,stopped:n,started:g}}getGatewayLog(){return this.gatewayLog}getPort(){return this.port}readPid(){if(!this.fs.existsSync(this.pidFile))return null;try{let i=this.fs.readFileSync(this.pidFile).trim(),$=Number(i);if(!$||$<=0)return null;return $}catch{return null}}removePid(){this.fs.unlink(this.pidFile)}isProcessAlive(i){return this.process.isAlive(i)}}import{existsSync as aV,mkdirSync as pV}from"fs";import{dirname as eV}from"path";import{timingSafeEqual as pW}from"crypto";var ti=(i)=>{return async($,n)=>{let r=($.req.header("authorization")??"").match(/^Bearer\s+(.+)$/i)?.[1]??"";if(!Pr(r,i.expected))return $.text("unauthorized",401);return await n()}},Pr=(i,$)=>{let n=Buffer.from(i,"utf-8"),g=Buffer.from($,"utf-8"),v=Math.max(n.length,g.length,1),r=Buffer.alloc(v),b=Buffer.alloc(v);return n.copy(r),g.copy(b),pW(r,b)&&n.length===g.length};var C_=(i,$,n)=>{return(g,v)=>{let r=-1;return b(0);async function b(u){if(u<=r)throw Error("next() called multiple times");r=u;let I,U=!1,_;if(i[u])_=i[u][0][0],g.req.routeIndex=u;else _=u===i.length&&v||void 0;if(_)try{I=await _(g,()=>b(u+1))}catch(k){if(k instanceof Error&&$)g.error=k,I=await $(k,g),U=!0;else throw k}else if(g.finalized===!1&&n)I=await n(g);if(I&&(g.finalized===!1||U))g.res=I;return g}}};var si=class extends Error{res;status;constructor(i=500,$){super($?.message,{cause:$?.cause});this.res=$?.res,this.status=i}getResponse(){if(this.res)return new Response(this.res.body,{status:this.status,headers:this.res.headers});return new Response(this.message,{status:this.status})}};var Fk=Symbol();var Wr=(i,$)=>{return new Response(i,{headers:{"Content-Type":$.replace(/^[^;]+/,(g)=>g.toLowerCase())}}).formData()};var Vr=(i)=>("headers"in i),mk=async(i,$=Object.create(null))=>{let{all:n=!1,dot:g=!1}=$,b=(Vr(i)?i.headers:i.raw.headers).get("Content-Type")?.split(";")[0].trim().toLowerCase();if(b==="multipart/form-data"||b==="application/x-www-form-urlencoded")return eW(i,{all:n,dot:g});return{}};async function eW(i,$){if(!Vr(i)&&i.bodyCache.formData)return ok(await i.bodyCache.formData,$);let n=Vr(i)?i.headers:i.raw.headers,g=await i.arrayBuffer(),v=Wr(g,n.get("Content-Type")||"");if(!Vr(i))i.bodyCache.formData=v;let r=await v;if(r)return ok(r,$);return{}}function ok(i,$){let n=Object.create(null);if(i.forEach((g,v)=>{if(!($.all||v.endsWith("[]")))n[v]=g;else sW(n,v,g)}),$.dot)Object.entries(n).forEach(([g,v])=>{if(g.includes("."))iV(n,g,v),delete n[g]});return n}var sW=(i,$,n)=>{if(i[$]!==void 0)if(Array.isArray(i[$]))i[$].push(n);else i[$]=[i[$],n];else if(!$.endsWith("[]"))i[$]=n;else i[$]=[n]},iV=(i,$,n)=>{if(/(?:^|\.)__proto__\./.test($))return;let g=i,v=$.split(".");v.forEach((r,b)=>{if(b===v.length-1)g[r]=n;else{if(!g[r]||typeof g[r]!=="object"||Array.isArray(g[r])||g[r]instanceof File)g[r]=Object.create(null);g=g[r]}})};var yk=(i)=>iv(i,gn),hk=class{raw;#i;#$;routeIndex=0;path;bodyCache={};constructor(i,$="/",n=[[]]){this.raw=i,this.path=$,this.#$=n,this.#i={}}param(i){return i?this.#v(i):this.#r()}#v(i){let $=this.#$[0][this.routeIndex][1][i],n=this.#g($);return n&&/\%/.test(n)?yk(n):n}#r(){let i={},$=Object.keys(this.#$[0][this.routeIndex][1]);for(let n of $){let g=this.#g(this.#$[0][this.routeIndex][1][n]);if(g!==void 0)i[n]=/\%/.test(g)?yk(g):g}return i}#g(i){return this.#$[1]?this.#$[1][i]:i}query(i){return uk(this.url,i)}queries(i){return Uk(this.url,i)}header(i){if(i)return this.raw.headers.get(i)??void 0;let $=Object.create(null);return this.raw.headers.forEach((n,g)=>{$[g]=n}),$}async parseBody(i){return mk(this,i)}#n=(i)=>{let{bodyCache:$,raw:n}=this,g=$[i];if(g)return g;let v=Object.keys($)[0];if(v)return $[v].then((r)=>{if(v==="json")r=JSON.stringify(r);return new Response(r)[i]()});return $[i]=n[i]()};json(){return this.#n("text").then((i)=>JSON.parse(i))}text(){return this.#n("text")}arrayBuffer(){return this.#n("arrayBuffer")}bytes(){return this.#n("arrayBuffer").then((i)=>new Uint8Array(i))}blob(){return this.#n("blob")}formData(){return this.#n("formData")}addValidatedData(i,$){this.#i[i]=$}valid(i){return this.#i[i]}get url(){return this.raw.url}get method(){return this.raw.method}get[Fk](){return this.#$}get matchedRoutes(){return this.#$[0].map(([[,i]])=>i)}get routePath(){return this.#$[0].map(([[,i]])=>i)[this.routeIndex].path}};var dk={Stringify:1,BeforeStream:2,Stream:3},$V=(i,$)=>{let n=new String(i);return n.isEscaped=!0,n.callbacks=$,n};var R_=async(i,$,n,g,v)=>{if(typeof i==="object"&&!(i instanceof String)){if(!(i instanceof Promise))i=i.toString();if(i instanceof Promise)i=await i}let r=i.callbacks;if(!r?.length)return Promise.resolve(i);if(v)v[0]+=i;else v=[i];let b=Promise.all(r.map((u)=>u({phase:$,buffer:v,context:g}))).then((u)=>Promise.all(u.filter(Boolean).map((I)=>R_(I,$,!1,g,v))).then(()=>v[0]));if(n)return $V(await b,r);else return b};var vV="text/plain; charset=UTF-8",F_=(i,$)=>{return{"Content-Type":i,...$}},Dn=(i,$)=>new Response(i,$),o_=class{#i;#$;env={};#v;finalized=!1;error;#r;#g;#n;#_;#U;#I;#u;#D;#k;constructor(i,$){if(this.#i=i,$)this.#g=$.executionCtx,this.env=$.env,this.#I=$.notFoundHandler,this.#k=$.path,this.#D=$.matchResult}get req(){return this.#$??=new hk(this.#i,this.#k,this.#D),this.#$}get event(){if(this.#g&&"respondWith"in this.#g)return this.#g;else throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#g)return this.#g;else throw Error("This context has no ExecutionContext")}get res(){return this.#n||=Dn(null,{headers:this.#u??=new Headers})}set res(i){if(this.#n&&i){i=Dn(i.body,i);for(let[$,n]of this.#n.headers.entries()){if($==="content-type")continue;if($==="set-cookie"){let g=this.#n.headers.getSetCookie();i.headers.delete("set-cookie");for(let v of g)i.headers.append("set-cookie",v)}else i.headers.set($,n)}}this.#n=i,this.finalized=!0}render=(...i)=>{return this.#U??=($)=>this.html($),this.#U(...i)};setLayout=(i)=>this.#_=i;getLayout=()=>this.#_;setRenderer=(i)=>{this.#U=i};header=(i,$,n)=>{if(this.finalized)this.#n=Dn(this.#n.body,this.#n);let g=this.#n?this.#n.headers:this.#u??=new Headers;if($===void 0)g.delete(i);else if(n?.append)g.append(i,$);else g.set(i,$)};status=(i)=>{this.#r=i};set=(i,$)=>{this.#v??=new Map,this.#v.set(i,$)};get=(i)=>{return this.#v?this.#v.get(i):void 0};get var(){if(!this.#v)return{};return Object.fromEntries(this.#v)}#b(i,$,n){let g=this.#n?new Headers(this.#n.headers):this.#u??new Headers;if(typeof $==="object"&&"headers"in $){let r=$.headers instanceof Headers?$.headers:new Headers($.headers);for(let[b,u]of r)if(b.toLowerCase()==="set-cookie")g.append(b,u);else g.set(b,u)}if(n)for(let[r,b]of Object.entries(n))if(typeof b==="string")g.set(r,b);else{g.delete(r);for(let u of b)g.append(r,u)}let v=typeof $==="number"?$:$?.status??this.#r;return Dn(i,{status:v,headers:g})}newResponse=(...i)=>this.#b(...i);body=(i,$,n)=>this.#b(i,$,n);text=(i,$,n)=>{return!this.#u&&!this.#r&&!$&&!n&&!this.finalized?new Response(i):this.#b(i,$,F_(vV,n))};json=(i,$,n)=>{return this.#b(JSON.stringify(i),$,F_("application/json",n))};html=(i,$,n)=>{let g=(v)=>this.#b(v,$,F_("text/html; charset=UTF-8",n));return typeof i==="object"?R_(i,dk.Stringify,!1,{}).then(g):g(i)};redirect=(i,$)=>{let n=String(i);return this.header("Location",!/[^\x00-\xFF]/.test(n)?n:encodeURI(n)),this.newResponse(null,$??302)};notFound=()=>{return this.#I??=()=>Dn(),this.#I(this)}};var x="ALL",ak="all",pk=["get","post","put","delete","options","patch"],Xr="Can not add a route since the matcher is already built.",fr=class extends Error{};var ek="__COMPOSED_HANDLER";var nV=(i)=>{return i.text("404 Not Found",404)},sk=(i,$)=>{if("getResponse"in i){let n=i.getResponse();return $.newResponse(n.body,n)}return console.error(i),$.text("Internal Server Error",500)},iw=class i{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#i="/";routes=[];constructor($={}){[...pk,ak].forEach((r)=>{this[r]=(b,...u)=>{if(typeof b==="string")this.#i=b;else this.#r(r,this.#i,b);return u.forEach((I)=>{this.#r(r,this.#i,I)}),this}}),this.on=(r,b,...u)=>{for(let I of[b].flat()){this.#i=I;for(let U of[r].flat())u.map((_)=>{this.#r(U.toUpperCase(),this.#i,_)})}return this},this.use=(r,...b)=>{if(typeof r==="string")this.#i=r;else this.#i="*",b.unshift(r);return b.forEach((u)=>{this.#r(x,this.#i,u)}),this};let{strict:g,...v}=$;Object.assign(this,v),this.getPath=g??!0?$.getPath??r_:rk}#$(){let $=new i({router:this.router,getPath:this.getPath});return $.errorHandler=this.errorHandler,$.#v=this.#v,$.routes=this.routes,$}#v=nV;errorHandler=sk;route($,n){let g=this.basePath($);return n.routes.map((v)=>{let r;if(n.errorHandler===sk)r=v.handler;else r=async(b,u)=>(await C_([],n.errorHandler)(b,()=>v.handler(b,u))).res,r[ek]=v.handler;g.#r(v.method,v.path,r,v.basePath)}),this}basePath($){let n=this.#$();return n._basePath=ei(this._basePath,$),n}onError=($)=>{return this.errorHandler=$,this};notFound=($)=>{return this.#v=$,this};mount($,n,g){let v,r;if(g)if(typeof g==="function")r=g;else if(r=g.optionHandler,g.replaceRequest===!1)v=(I)=>I;else v=g.replaceRequest;let b=r?(I)=>{let U=r(I);return Array.isArray(U)?U:[U]}:(I)=>{let U=void 0;try{U=I.executionCtx}catch{}return[I.env,U]};v||=(()=>{let I=ei(this._basePath,$),U=I==="/"?0:I.length;return(_)=>{let k=new URL(_.url);return k.pathname=this.getPath(_).slice(U)||"/",new Request(k,_)}})();let u=async(I,U)=>{let _=await n(v(I.req.raw),...b(I));if(_)return _;await U()};return this.#r(x,ei($,"*"),u),this}#r($,n,g,v){$=$.toUpperCase(),n=ei(this._basePath,n);let r={basePath:v!==void 0?ei(this._basePath,v):this._basePath,path:n,method:$,handler:g};this.router.add($,n,[g,r]),this.routes.push(r)}#g($,n){if($ instanceof Error)return this.errorHandler($,n);throw $}#n($,n,g,v){if(v==="HEAD")return(async()=>new Response(null,await this.#n($,n,g,"GET")))();let r=this.getPath($,{env:g}),b=this.router.match(v,r),u=new o_($,{path:r,matchResult:b,env:g,executionCtx:n,notFoundHandler:this.#v});if(b[0].length===1){let U;try{U=b[0][0][0][0](u,async()=>{u.res=await this.#v(u)})}catch(_){return this.#g(_,u)}return U instanceof Promise?U.then((_)=>_||(u.finalized?u.res:this.#v(u))).catch((_)=>this.#g(_,u)):U??this.#v(u)}let I=C_(b[0],this.errorHandler,this.#v);return(async()=>{try{let U=await I(u);if(!U.finalized)throw Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return U.res}catch(U){return this.#g(U,u)}})()}fetch=($,...n)=>{return this.#n($,n[1],n[0],$.method)};request=($,n,g,v)=>{if($ instanceof Request)return this.fetch(n?new Request($,n):$,g,v);return $=$.toString(),this.fetch(new Request(/^https?:\/\//.test($)?$:`http://localhost${ei("/",$)}`,n),g,v)};fire=()=>{addEventListener("fetch",($)=>{$.respondWith(this.#n($.request,$,void 0,$.request.method))})}};var kn=[];function Qr(i,$){let n=this.buildAllMatchers(),g=(v,r)=>{let b=n[v]||n[x],u=b[2][r];if(u)return u;let I=r.match(b[0]);if(!I)return[[],kn];let U=I.indexOf("",1);return[b[1][U],I]};return this.match=g,g(i,$)}var Kr="[^/]+",wn=".*",jn="(?:|/.*)",P$=Symbol(),gV=new Set(".\\+*[^]$()");function rV(i,$){if(i.length===1)return $.length===1?i<$?-1:1:-1;if($.length===1)return 1;if(i===wn||i===jn)return 1;else if($===wn||$===jn)return-1;if(i===Kr)return 1;else if($===Kr)return-1;return i.length===$.length?i<$?-1:1:$.length-i.length}var $w=class i{#i;#$;#v=Object.create(null);insert($,n,g,v,r){if($.length===0){if(this.#i!==void 0)throw P$;if(r)return;this.#i=n;return}let[b,...u]=$,I=b==="*"?u.length===0?["","",wn]:["","",Kr]:b==="/*"?["","",jn]:b.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),U;if(I){let _=I[1],k=I[2]||Kr;if(_&&I[2]){if(k===".*")throw P$;if(k=k.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(k))throw P$}if(U=this.#v[k],!U){if(Object.keys(this.#v).some((O)=>O!==wn&&O!==jn))throw P$;if(r)return;if(U=this.#v[k]=new i,_!=="")U.#$=v.varIndex++}if(!r&&_!=="")g.push([_,U.#$])}else if(U=this.#v[b],!U){if(Object.keys(this.#v).some((_)=>_.length>1&&_!==wn&&_!==jn))throw P$;if(r)return;U=this.#v[b]=new i}U.insert(u,n,g,v,r)}buildRegExpStr(){let n=Object.keys(this.#v).sort(rV).map((g)=>{let v=this.#v[g];return(typeof v.#$==="number"?`(${g})@${v.#$}`:gV.has(g)?`\\${g}`:g)+v.buildRegExpStr()});if(typeof this.#i==="number")n.unshift(`#${this.#i}`);if(n.length===0)return"";if(n.length===1)return n[0];return"(?:"+n.join("|")+")"}};var vw=class{#i={varIndex:0};#$=new $w;insert(i,$,n){let g=[],v=[];for(let b=0;;){let u=!1;if(i=i.replace(/\{[^}]+\}/g,(I)=>{let U=`@\\${b}`;return v[b]=[U,I],b++,u=!0,U}),!u)break}let r=i.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let b=v.length-1;b>=0;b--){let[u]=v[b];for(let I=r.length-1;I>=0;I--)if(r[I].indexOf(u)!==-1){r[I]=r[I].replace(u,v[b][1]);break}}return this.#$.insert(r,$,g,this.#i,n),g}buildRegExp(){let i=this.#$.buildRegExpStr();if(i==="")return[/^$/,[],[]];let $=0,n=[],g=[];return i=i.replace(/#(\d+)|@(\d+)|\.\*\$/g,(v,r,b)=>{if(r!==void 0)return n[++$]=Number(r),"$()";if(b!==void 0)return g[Number(b)]=++$,"";return""}),[new RegExp(`^${i}`),n,g]}};var bV=[/^$/,[],Object.create(null)],nw=Object.create(null);function gw(i){return nw[i]??=new RegExp(i==="*"?"":`^${i.replace(/\/\*$|([.\\+*[^\]$()])/g,($,n)=>n?`\\${n}`:"(?:|/.*)")}$`)}function uV(){nw=Object.create(null)}function UV(i){let $=new vw,n=[];if(i.length===0)return bV;let g=i.map((U)=>[!/\*|\/:/.test(U[0]),...U]).sort(([U,_],[k,O])=>U?1:k?-1:_.length-O.length),v=Object.create(null);for(let U=0,_=-1,k=g.length;U<k;U++){let[O,J,Q]=g[U];if(O)v[J]=[Q.map(([z])=>[z,Object.create(null)]),kn];else _++;let A;try{A=$.insert(J,_,O)}catch(z){throw z===P$?new fr(J):z}if(O)continue;n[_]=Q.map(([z,l])=>{let Ii=Object.create(null);l-=1;for(;l>=0;l--){let[y,N]=A[l];Ii[y]=N}return[z,Ii]})}let[r,b,u]=$.buildRegExp();for(let U=0,_=n.length;U<_;U++)for(let k=0,O=n[U].length;k<O;k++){let J=n[U][k]?.[1];if(!J)continue;let Q=Object.keys(J);for(let A=0,z=Q.length;A<z;A++)J[Q[A]]=u[J[Q[A]]]}let I=[];for(let U in b)I[U]=n[b[U]];return[r,I,v]}function gv(i,$){if(!i)return;for(let n of Object.keys(i).sort((g,v)=>v.length-g.length))if(gw(n).test($))return[...i[n]];return}var Gr=class{name="RegExpRouter";#i;#$;constructor(){this.#i={[x]:Object.create(null)},this.#$={[x]:Object.create(null)}}add(i,$,n){let g=this.#i,v=this.#$;if(!g||!v)throw Error(Xr);if(!g[i])[g,v].forEach((u)=>{u[i]=Object.create(null),Object.keys(u[x]).forEach((I)=>{u[i][I]=[...u[x][I]]})});if($==="/*")$="*";let r=($.match(/\/:/g)||[]).length;if(/\*$/.test($)){let u=gw($);if(i===x)Object.keys(g).forEach((I)=>{g[I][$]||=gv(g[I],$)||gv(g[x],$)||[]});else g[i][$]||=gv(g[i],$)||gv(g[x],$)||[];Object.keys(g).forEach((I)=>{if(i===x||i===I)Object.keys(g[I]).forEach((U)=>{u.test(U)&&g[I][U].push([n,r])})}),Object.keys(v).forEach((I)=>{if(i===x||i===I)Object.keys(v[I]).forEach((U)=>u.test(U)&&v[I][U].push([n,r]))});return}let b=Ir($)||[$];for(let u=0,I=b.length;u<I;u++){let U=b[u];Object.keys(v).forEach((_)=>{if(i===x||i===_)v[_][U]||=[...gv(g[_],U)||gv(g[x],U)||[]],v[_][U].push([n,r-I+u+1])})}}match=Qr;buildAllMatchers(){let i=Object.create(null);return Object.keys(this.#$).concat(Object.keys(this.#i)).forEach(($)=>{i[$]||=this.#v($)}),this.#i=this.#$=void 0,uV(),i}#v(i){let $=[],n=i===x;if([this.#i,this.#$].forEach((g)=>{let v=g[i]?Object.keys(g[i]).map((r)=>[r,g[i][r]]):[];if(v.length!==0)n||=!0,$.push(...v);else if(i!==x)$.push(...Object.keys(g[x]).map((r)=>[r,g[x][r]]))}),!n)return null;else return UV($)}};var IV=class{name="PreparedRegExpRouter";#i;#$;constructor(i,$){this.#i=i,this.#$=$}#v(i,$){let n=this.#i[i];n[1].forEach((g)=>g&&g.push($)),Object.values(n[2]).forEach((g)=>g[0].push($))}#r(i,$,n,g,v){let r=this.#i[i];if(!v)r[2][$][0].push([n,{}]);else g.forEach((b)=>{if(typeof b==="number")r[1][b].push([n,v]);else r[2][b||$][0].push([n,v])})}add(i,$,n){if(!this.#i[i]){let v=this.#i[x],r={};for(let b in v[2])r[b]=[v[2][b][0].slice(),kn];this.#i[i]=[v[0],v[1].map((b)=>Array.isArray(b)?b.slice():0),r]}if($==="/*"||$==="*"){let v=[n,{}];if(i===x)for(let r in this.#i)this.#v(r,v);else this.#v(i,v);return}let g=this.#$[$];if(!g)throw Error(`Path ${$} is not registered`);for(let[v,r]of g)if(i===x)for(let b in this.#i)this.#r(b,$,n,v,r);else this.#r(i,$,n,v,r)}buildAllMatchers(){return this.#i}match=Qr};var m_=class{name="SmartRouter";#i=[];#$=[];constructor(i){this.#i=i.routers}add(i,$,n){if(!this.#$)throw Error(Xr);this.#$.push([i,$,n])}match(i,$){if(!this.#$)throw Error("Fatal error");let n=this.#i,g=this.#$,v=n.length,r=0,b;for(;r<v;r++){let u=n[r];try{for(let I=0,U=g.length;I<U;I++)u.add(...g[I]);b=u.match(i,$)}catch(I){if(I instanceof fr)continue;throw I}this.match=u.match.bind(u),this.#i=[u],this.#$=void 0;break}if(r===v)throw Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,b}get activeRouter(){if(this.#$||this.#i.length!==1)throw Error("No active router has been determined yet.");return this.#i[0]}};var On=Object.create(null),_V=(i)=>{for(let $ in i)return!0;return!1},rw=class i{#i;#$;#v;#r=0;#g=On;constructor($,n,g){if(this.#$=g||Object.create(null),this.#i=[],$&&n){let v=Object.create(null);v[$]={handler:n,possibleKeys:[],score:0},this.#i=[v]}this.#v=[]}insert($,n,g){this.#r=++this.#r;let v=this,r=nk(n),b=[];for(let u=0,I=r.length;u<I;u++){let U=r[u],_=r[u+1],k=gk(U,_),O=Array.isArray(k)?k[0]:U;if(O in v.#$){if(v=v.#$[O],k)b.push(k[1]);continue}if(v.#$[O]=new i,k)v.#v.push(k),b.push(k[1]);v=v.#$[O]}return v.#i.push({[$]:{handler:g,possibleKeys:b.filter((u,I,U)=>U.indexOf(u)===I),score:this.#r}}),v}#n($,n,g,v,r){for(let b=0,u=n.#i.length;b<u;b++){let I=n.#i[b],U=I[g]||I[x],_={};if(U!==void 0){if(U.params=Object.create(null),$.push(U),v!==On||r&&r!==On)for(let k=0,O=U.possibleKeys.length;k<O;k++){let J=U.possibleKeys[k],Q=_[U.score];U.params[J]=r?.[J]&&!Q?r[J]:v[J]??r?.[J],_[U.score]=!0}}}}search($,n){let g=[];this.#g=On;let r=[this],b=g_(n),u=[],I=b.length,U=null;for(let _=0;_<I;_++){let k=b[_],O=_===I-1,J=[];for(let A=0,z=r.length;A<z;A++){let l=r[A],Ii=l.#$[k];if(Ii)if(Ii.#g=l.#g,O){if(Ii.#$["*"])this.#n(g,Ii.#$["*"],$,l.#g);this.#n(g,Ii,$,l.#g)}else J.push(Ii);for(let y=0,N=l.#v.length;y<N;y++){let C=l.#v[y],ui=l.#g===On?{}:{...l.#g};if(C==="*"){let i$=l.#$["*"];if(i$)this.#n(g,i$,$,l.#g),i$.#g=ui,J.push(i$);continue}let[Wn,Vn,bv]=C;if(!k&&!(bv instanceof RegExp))continue;let _i=l.#$[Wn];if(bv instanceof RegExp){if(U===null){U=Array(I);let fn=n[0]==="/"?1:0;for(let uv=0;uv<I;uv++)U[uv]=fn,fn+=b[uv].length+1}let i$=n.substring(U[_]),Xn=bv.exec(i$);if(Xn){if(ui[Vn]=Xn[0],this.#n(g,_i,$,l.#g,ui),Xn[0].length===i$.length&&_i.#$["*"])this.#n(g,_i.#$["*"],$,l.#g,ui);if(_V(_i.#$)){_i.#g=ui;let fn=Xn[0].match(/\//)?.length??0;(u[fn]||=[]).push(_i)}continue}}if(bv===!0||bv.test(k))if(ui[Vn]=k,O){if(this.#n(g,_i,$,ui,l.#g),_i.#$["*"])this.#n(g,_i.#$["*"],$,ui,l.#g)}else _i.#g=ui,J.push(_i)}}let Q=u.shift();r=Q?J.concat(Q):J}if(g.length>1)g.sort((_,k)=>{return _.score-k.score});return[g.map(({handler:_,params:k})=>[_,k])]}};var y_=class{name="TrieRouter";#i;constructor(){this.#i=new rw}add(i,$,n){let g=Ir($);if(g){for(let v=0,r=g.length;v<r;v++)this.#i.insert(i,g[v],n);return}this.#i.insert(i,$,n)}match(i,$){return this.#i.search(i,$)}};var Jn=class extends iw{constructor(i={}){super(i);this.router=i.router??new m_({routers:[new Gr,new y_]})}};var DV=class{initApp;#i;constructor(i){this.initApp=i?.initApp,this.#i=i?.defaultAppOptions}createApp=(i)=>{let $=new Jn(i&&this.#i?{...this.#i,...i}:i??this.#i);if(this.initApp)this.initApp($);return $};createMiddleware=(i)=>i;createHandlers=(...i)=>{return i.filter(($)=>$!==void 0)}},bw=(i)=>new DV(i);var c=bw();var uw=(i)=>{let $=Buffer.byteLength(i.content,"utf-8");if(i.meta)for(let[n,g]of Object.entries(i.meta))$+=Buffer.byteLength(n,"utf-8")+Buffer.byteLength(g,"utf-8");return $},kV=1048576,wV=200,jV=4194304,OV=()=>{};class h_{clients=new Map;subscribers=new Set;logger;onError;maxBufferedBytes;now;replayBufferSize;replayBufferMaxBytes;replayBuffer=[];persistentReplay;exclusiveCursor=new Map;replayBufferBytes=0;eventsBroadcast=0;droppedSlowClients=0;lastBroadcastAt=null;latestOffset=0;constructor(i={}){this.logger=i.logger,this.onError=i.onError??OV,this.maxBufferedBytes=i.maxBufferedBytes??kV,this.now=i.now??(()=>Date.now()),this.replayBufferSize=Math.max(0,i.replayBufferSize??wV),this.replayBufferMaxBytes=Math.max(0,i.replayBufferMaxBytes??jV),this.persistentReplay=i.persistentReplay??null}getMetrics(){return{clients:this.clients.size,subscribers:this.subscribers.size,eventsBroadcast:this.eventsBroadcast,droppedSlowClients:this.droppedSlowClients,lastBroadcastAt:this.lastBroadcastAt?new Date(this.lastBroadcastAt).toISOString():null,latestOffset:this.latestOffset,oldestReplayableOffset:this.replayBuffer[0]?.offset??null}}replaySince(i,$){let n=this.replayBuffer[0]?.offset,g=this.persistentReplay&&(n===void 0||i<n-1),v=this.replayBuffer.filter((I)=>I.offset>i&&this.matchesClient(I,$));if(!g)return v;let r=this.persistentReplay?this.persistentReplay.loadSince(i).filter((I)=>this.matchesClient(I,$)):[],b=n??Number.POSITIVE_INFINITY;return[...r.filter((I)=>I.offset<b),...v]}matchesClient(i,$){let n=i.meta?.target;if(n&&n!==$.subscriberId)return!1;let g=i.meta?.channelId;if(g&&g!==$.channel)return!1;let v=i.meta?.connector;if(!v)return!0;return $.connectors.includes(v)}pickRecipients(i){let $=new Map,n=[];for(let[g,v]of this.clients){if(!this.matchesClient(i,v))continue;if(v.delivery==="exclusive"){let r=$.get(v.channel)??[];r.push(g),$.set(v.channel,r);continue}n.push(g)}for(let[g,v]of $){if(v.length===0)continue;let r=this.exclusiveCursor.get(g)??0,b=v[r%v.length];if(b)n.push(b);this.exclusiveCursor.set(g,r+1)}return n}addClient(i,$){this.clients.set(i,$)}removeClient(i){this.clients.delete(i)}getClientCount(){return this.clients.size}listChannels(){return[...this.clients.values()].map((i)=>({...i}))}subscribe(i){return this.subscribers.add(i),()=>{this.subscribers.delete(i)}}broadcast(i,$){this.latestOffset+=1;let n={content:i,meta:$,offset:this.latestOffset},g=JSON.stringify(n);if(this.eventsBroadcast+=1,this.lastBroadcastAt=this.now(),this.replayBufferSize>0){let r=uw(n);this.replayBuffer.push(n),this.replayBufferBytes+=r;while((this.replayBuffer.length>this.replayBufferSize||this.replayBufferBytes>this.replayBufferMaxBytes)&&this.replayBuffer.length>0){let b=this.replayBuffer.shift();if(b)this.replayBufferBytes-=uw(b)}}let v=this.pickRecipients(n);for(let r of v){let b=r.getBufferedAmount();if(b>this.maxBufferedBytes){let u=this.clients.get(r);this.logger?.warn("dropping slow WS client (backpressure)",{channel:u?.channel,buffered:b,max:this.maxBufferedBytes});try{r.close(1009,"backpressure")}catch{}this.clients.delete(r),this.droppedSlowClients+=1;continue}try{r.send(g)}catch(u){let I=u instanceof Error?u:Error(String(u)),U=this.clients.get(r);this.logger?.warn("ws.send failed; dropping client",{channel:U?.channel,error:I.message}),this.clients.delete(r)}}for(let r of this.subscribers){let b=(u)=>{let I=u instanceof Error?u:Error(String(u));this.logger?.error("broadcast subscriber threw",{error:I.message}),this.onError(I,{component:"broadcaster.subscriber",offset:n.offset,connector:n.meta?.connector??null,channel:n.meta?.channel??null})};try{let u=r(n);if(u instanceof Promise)u.catch(b)}catch(u){b(u)}}return n}seedLatestOffset(i){if(i>this.latestOffset)this.latestOffset=i}}var K3=D.object({type:D.string(),content:D.string(),channel_id:D.string().nullable(),connector_id:D.string().nullable(),meta:D.record(D.string(),D.string()).nullable()});class d_{}import{Database as JV}from"bun:sqlite";import{existsSync as PV,mkdirSync as WV}from"fs";import{dirname as VV}from"path";var XV=/^[a-z_][a-z0-9_]*$/,fV=500,QV=new Set(["seq","ts","type","event"]),Uw=[["CREATE TABLE IF NOT EXISTS logs (seq INTEGER PRIMARY KEY, ts INTEGER NOT NULL, type TEXT, event TEXT NOT NULL)","CREATE INDEX IF NOT EXISTS idx_logs_ts ON logs (ts)","CREATE INDEX IF NOT EXISTS idx_logs_type ON logs (type)"],["DROP TABLE IF EXISTS leuco_log","CREATE TABLE IF NOT EXISTS logs (seq INTEGER PRIMARY KEY, ts INTEGER NOT NULL, type TEXT, event TEXT NOT NULL)","CREATE INDEX IF NOT EXISTS idx_logs_ts ON logs (ts)","CREATE INDEX IF NOT EXISTS idx_logs_type ON logs (type)"]];class W${db;maxRows;maxAgeMs;maxBytes;targetBytes;now;indexes;extractIndexes;insertStmt;insertWithSeqStmt;maxSeqStmt;countStmt;trimRowsStmt;trimAgeStmt;trimOldestStmt;insertsSinceByteCheck=0;constructor(i){if(i.path!==":memory:"){let r=VV(i.path);if(!PV(r))WV(r,{recursive:!0})}if(this.db=new JV(i.path),this.db.run("PRAGMA journal_mode = WAL"),this.migrate(),this.maxRows=i.maxRows??null,this.maxAgeMs=i.maxAgeMs??null,this.maxBytes=i.maxBytes??null,this.targetBytes=i.targetBytes??(i.maxBytes!==void 0?Math.floor(i.maxBytes/4):null),this.now=i.now??(()=>Date.now()),this.indexes=i.indexes??[],this.indexes.length>0)GV(this.indexes),this.extractIndexes=i.extractIndexes??null,this.syncIndexColumns();else this.extractIndexes=null;let $=["ts","type","event",...this.indexes],n=$.map(()=>"?").join(", ");this.insertStmt=this.db.prepare(`INSERT INTO logs (${$.join(", ")}) VALUES (${n})`);let g=["seq",...$],v=g.map(()=>"?").join(", ");this.insertWithSeqStmt=this.db.prepare(`INSERT INTO logs (${g.join(", ")}) VALUES (${v})`),this.maxSeqStmt=this.db.prepare("SELECT COALESCE(MAX(seq), 0) AS max FROM logs"),this.countStmt=this.db.prepare("SELECT COUNT(*) AS n FROM logs"),this.trimRowsStmt=this.db.prepare("DELETE FROM logs WHERE seq <= (SELECT seq FROM logs ORDER BY seq DESC LIMIT 1 OFFSET ?)"),this.trimAgeStmt=this.db.prepare("DELETE FROM logs WHERE ts < ?"),this.trimOldestStmt=this.db.prepare("DELETE FROM logs WHERE seq IN (SELECT seq FROM logs ORDER BY seq ASC LIMIT ?)")}insert(i){try{let $=this.buildInsertParams(i.ts,i.event),n=this.insertStmt.run(...$),g=Number(n.lastInsertRowid);return this.trim(),{seq:g,ts:i.ts,event:i.event}}catch($){return $ instanceof Error?$:Error(String($))}}insertMany(i){if(i.length===0)return[];try{let $=[];return this.db.transaction((g)=>{for(let v of g){let r=this.buildInsertParams(v.ts,v.event),b=this.insertStmt.run(...r);$.push({seq:Number(b.lastInsertRowid),ts:v.ts,event:v.event})}})(i),this.trim(),$}catch($){return $ instanceof Error?$:Error(String($))}}write(i){try{let $=[i.seq,...this.buildInsertParams(i.ts,i.event)];this.insertWithSeqStmt.run(...$),this.trim()}catch($){return $ instanceof Error?$:Error(String($))}}getMaxSeq(){let i=this.maxSeqStmt.get();return i?i.max:0}query(i={}){let $=[],n=[];if(i.seq!==void 0)$.push("seq = ?"),n.push(i.seq);else $.push("seq > ?"),n.push(i.sinceSeq??0);if(typeof i.type==="string")$.push("type = ?"),n.push(i.type);if(i.where)this.appendWhereConditions(i.where,$,n);if(i.wherePrefix)this.appendPrefixConditions(i.wherePrefix,$,n);if(i.whereIn)this.appendSetConditions(i.whereIn,$,n);let g=i.limit??1000;n.push(g);let v=i.order==="desc"?"DESC":"ASC",r=`SELECT seq, ts, type, event FROM logs WHERE ${$.join(" AND ")} ORDER BY seq ${v} LIMIT ?`,u=this.db.prepare(r).all(...n);if(v==="DESC")u.reverse();return u.map(HV)}getSchemaVersion(){return this.db.prepare("PRAGMA user_version").get()?.user_version??0}close(){this.db.close()}buildInsertParams(i,$){let n=YV($),g=JSON.stringify($);if(this.indexes.length===0)return[i,n,g];let v=this.extractIndexes?this.extractIndexes($):null,r=this.indexes.map((b)=>v?.[b]??null);return[i,n,g,...r]}appendWhereConditions(i,$,n){for(let g of this.indexKeys()){let v=i[g];if(v===void 0)continue;if(v===null)$.push(`${g} IS NULL`);else $.push(`${g} = ?`),n.push(v)}}appendPrefixConditions(i,$,n){for(let g of this.indexKeys()){let v=i[g];if(v===void 0)continue;$.push(`${g} LIKE ? ESCAPE '\\'`),n.push(`${KV(v)}%`)}}appendSetConditions(i,$,n){for(let g of this.indexKeys()){let v=i[g];if(v===void 0)continue;if(v.length===0){$.push("1 = 0");continue}let r=v.filter((I)=>I!==null),b=r.length!==v.length,u=[];if(r.length>0)u.push(`${g} IN (${r.map(()=>"?").join(", ")})`),n.push(...r);if(b)u.push(`${g} IS NULL`);$.push(`(${u.join(" OR ")})`)}}trim(){if(this.maxRows!==null){let i=this.countStmt.get();if(i&&i.n>this.maxRows)this.trimRowsStmt.run(this.maxRows)}if(this.maxAgeMs!==null)this.trimAgeStmt.run(this.now()-this.maxAgeMs);this.maybeTrimBytes()}indexKeys(){return this.indexes}maybeTrimBytes(){if(this.maxBytes===null||this.targetBytes===null)return;if(this.insertsSinceByteCheck+=1,this.insertsSinceByteCheck<fV)return;this.insertsSinceByteCheck=0;let i=this.byteSize();if(i<=this.maxBytes)return;let $=this.countStmt.get()?.n??0;if($===0)return;let n=i-this.targetBytes,g=i/$,v=Math.min($,Math.ceil(n/g));this.trimOldestStmt.run(v),this.db.run("VACUUM")}byteSize(){let i=this.db.prepare("PRAGMA page_count").get()?.n??0,$=this.db.prepare("PRAGMA page_size").get()?.n??0;return i*$}clear(){this.db.run("DELETE FROM logs"),this.db.run("VACUUM"),this.insertsSinceByteCheck=0}syncIndexColumns(){let i=new Set(this.db.prepare("PRAGMA table_info(logs)").all().map(($)=>$.name));for(let $ of this.indexes){if(!i.has($))this.db.run(`ALTER TABLE logs ADD COLUMN ${$} TEXT`);this.db.run(`CREATE INDEX IF NOT EXISTS idx_logs_${$} ON logs (${$})`)}}migrate(){let $=this.db.prepare("PRAGMA user_version").get()?.user_version??0;if($>=Uw.length)return;let n=Uw.slice($),g=$;for(let v of n)g+=1,this.db.transaction(()=>{for(let b of v)this.db.run(b);this.db.run(`PRAGMA user_version = ${g}`)})()}}function KV(i){return i.replaceAll("\\","\\\\").replaceAll("%","\\%").replaceAll("_","\\_")}function GV(i){for(let $ of i){if(!XV.test($))throw Error(`invalid index column name: ${$}`);if(QV.has($))throw Error(`reserved index column name: ${$}`)}}function YV(i){if(typeof i!=="object"||i===null)return null;if(!("type"in i))return null;let $=i.type;return typeof $==="string"?$:null}function HV(i){return{seq:i.seq,ts:i.ts,event:JSON.parse(i.event)}}var Iw=2000;class a_ extends d_{sink;now;logger;onError;constructor(i){super();this.now=i.now??(()=>Date.now()),this.logger=i.logger,this.onError=i.onError,this.sink=new W$({path:i.path,indexes:["channel_id","connector_id"],extractIndexes:($)=>({channel_id:$.channel_id,connector_id:$.connector_id}),now:this.now,...i.maxRows!==void 0?{maxRows:i.maxRows}:{},...i.maxAgeMs!==void 0?{maxAgeMs:i.maxAgeMs}:{},...i.maxBytes!==void 0?{maxBytes:i.maxBytes}:{},...i.targetBytes!==void 0?{targetBytes:i.targetBytes}:{}})}record(i){let $={type:i.meta?.event_type??"unknown",content:zV(i.content),channel_id:i.channelId,connector_id:i.connectorId,meta:i.meta},n=this.sink.write({seq:i.offset,ts:this.now(),event:$});if(n instanceof Error)this.logger?.error("event log write failed",{offset:i.offset,error:n.message}),this.onError?.(n,{component:"sqlite-event-log",op:"record",offset:i.offset,channelId:i.channelId,connectorId:i.connectorId})}loadSince(i){let $=this.sink.query({sinceSeq:i,limit:Number.MAX_SAFE_INTEGER}),n=[];for(let g of $)n.push({content:g.event.content,meta:g.event.meta??void 0,offset:g.seq});return n}loadForChannel(i){let $={channel_id:i.channelId};if(i.connectorId!==void 0)$.connector_id=i.connectorId;let n=this.sink.query({where:$,...i.sinceSeq!==void 0?{sinceSeq:i.sinceSeq}:{},...i.limit!==void 0?{limit:i.limit}:{}}),g=[];for(let v of n)g.push({content:v.event.content,meta:v.event.meta??void 0,offset:v.seq});return g}findMaxOffset(){return this.sink.getMaxSeq()}clear(){this.sink.clear()}close(){this.sink.close()}}function zV(i){if(i.length<=Iw)return i;return`${i.slice(0,Iw)}...`}var SV=()=>{},AV=30000,lV=60000,BV=30000,LV=(i)=>new Promise(($)=>{setTimeout($,i)});class Ei{channels;notify;logger;onError;running=new Map;failureCounts=new Map;starting=new Set;stats=new Map;healthCheckIntervalMs;maxBackoffMs;startTimeoutMs;sleep;now;healthCheckTimer=null;healthCheckInFlight=!1;pendingRetry=new Map;constructor(i){this.channels=i.channels,this.notify=i.notify,this.logger=i.logger,this.onError=i.onError??SV,this.healthCheckIntervalMs=i.healthCheckIntervalMs??AV,this.maxBackoffMs=i.maxBackoffMs??lV,this.startTimeoutMs=i.startTimeoutMs??BV,this.sleep=i.sleep??LV,this.now=i.now??(()=>Date.now())}static keyOf(i,$){return`${i}/${$}`}isRunning(i,$){return this.running.has(Ei.keyOf(i,$))}list(){return[...this.running.entries()].map(([i,$])=>{let n=this.stats.get(i);return{channelName:$.channelName,channelId:$.channelId,name:$.config.name,type:$.config.type,alive:$.listener.isAlive(),events:n?.events??0,errors:n?.errors??0,failureCount:this.failureCounts.get(i)??0,lastEventAt:n?.lastEventAt??null}})}async start(i,$){let n=Ei.keyOf(i,$);if(this.running.has(n))return{ok:!0,reason:"already running"};if(this.starting.has(n))return{ok:!1,reason:"already starting",retriable:!0};this.starting.add(n);try{return await this.startLocked(i,$,n)}finally{this.starting.delete(n)}}async startLocked(i,$,n){let g=this.channels.createListener(i,$);if(!g)return{ok:!1,reason:`connector "${$}" not found in channel "${i}"`};let v=async(r,b)=>{try{await this.notify(i,$,r,b),this.recordEvent(n)}catch(u){throw this.recordError(n),u}};try{return await Promise.race([g.listener.start(v),this.sleep(this.startTimeoutMs).then(()=>{throw Error(`listener start timed out after ${this.startTimeoutMs}ms`)})]),this.running.set(n,{config:g.config,channelName:i,channelId:g.channelId,listener:g.listener}),this.pendingRetry.delete(n),this.ensureStats(n),this.logger?.info(`${g.config.type} listener started`,{channel:i,connector:$}),{ok:!0}}catch(r){let b=r instanceof Error?r:Error(String(r));try{await g.listener.stop()}catch{}this.logger?.error(`${g.config.type} listener failed to start`,{channel:i,connector:$,error:b.message}),this.onError(b,{component:"listener-registry.start",channel:i,connector:$,type:g.config.type});let u=!(b instanceof $n);return{ok:!1,reason:b.message,retriable:u}}}async stop(i,$){let n=Ei.keyOf(i,$),g=this.running.get(n);if(!g)return{ok:!0,reason:"not running"};try{return await g.listener.stop(),this.logger?.info(`${g.config.type} listener stopped`,{channel:i,connector:$}),{ok:!0}}catch(v){let r=v instanceof Error?v:Error(String(v));return this.logger?.error(`${g.config.type} listener failed to stop`,{channel:i,connector:$,error:r.message}),this.onError(r,{component:"listener-registry.stop",channel:i,connector:$,type:g.config.type}),{ok:!1,reason:r.message}}finally{this.running.delete(n),this.failureCounts.delete(n)}}async restart(i,$){let n=await this.stop(i,$);if(!n.ok)return n;return await this.start(i,$)}async startAll(){let i=this.channels.listAllConnectors(),$=await Promise.allSettled(i.map((n)=>this.start(n.channelName,n.name)));for(let n=0;n<$.length;n++){let g=$[n],v=i[n];if(g.status==="rejected"){let r=Ei.keyOf(v.channelName,v.name);this.pendingRetry.set(r,{channelName:v.channelName,connectorName:v.name});continue}if(g.status==="fulfilled"&&!g.value.ok){if(g.value.retriable===!1)continue;let r=Ei.keyOf(v.channelName,v.name);this.pendingRetry.set(r,{channelName:v.channelName,connectorName:v.name})}}this.startHealthCheck()}async stopAll(){this.stopHealthCheck(),this.pendingRetry.clear();for(let[,i]of this.running.entries())await this.stop(i.channelName,i.config.name)}ensureStats(i){let $=this.stats.get(i);if($)return $;let n={events:0,errors:0,failureCount:0,lastEventAt:null};return this.stats.set(i,n),n}recordEvent(i){let $=this.ensureStats(i);$.events+=1,$.lastEventAt=new Date(this.now()).toISOString()}recordError(i){this.ensureStats(i).errors+=1}startHealthCheck(){if(this.healthCheckTimer)return;this.healthCheckTimer=setInterval(()=>{this.runHealthCheck().catch((i)=>{let $=i instanceof Error?i:Error(String(i));this.logger?.error("health check pass failed",{error:$.message}),this.onError($,{component:"listener-registry.health-check"})})},this.healthCheckIntervalMs),this.healthCheckTimer.unref()}stopHealthCheck(){if(!this.healthCheckTimer)return;clearInterval(this.healthCheckTimer),this.healthCheckTimer=null}async runHealthCheckForTest(){await this.runHealthCheck()}async runHealthCheck(){if(this.healthCheckInFlight)return;this.healthCheckInFlight=!0;try{let i=[];for(let[n,g]of this.running.entries()){if(g.listener.isAlive()){this.failureCounts.delete(n);continue}i.push({channelName:g.channelName,connectorName:g.config.name,type:g.config.type})}await Promise.all(i.map((n)=>this.recoverDead(n.channelName,n.connectorName,n.type)));let $=[];for(let[n,g]of this.pendingRetry.entries()){if(this.running.has(n)){this.pendingRetry.delete(n);continue}$.push({key:n,channelName:g.channelName,connectorName:g.connectorName})}await Promise.all($.map((n)=>this.attemptRetry(n)))}finally{this.healthCheckInFlight=!1}}async attemptRetry(i){this.logger?.info("retrying failed listener",{channel:i.channelName,connector:i.connectorName});let $=this.failureCounts.get(i.key)??0,n=Math.min(1000*2**$,this.maxBackoffMs);await this.sleep(n);let g=await this.start(i.channelName,i.connectorName);if(g.ok){this.pendingRetry.delete(i.key),this.failureCounts.delete(i.key);return}if(g.retriable===!1){this.pendingRetry.delete(i.key),this.failureCounts.delete(i.key),this.logger?.warn("dropping listener from retry queue (non-retriable)",{channel:i.channelName,connector:i.connectorName,reason:g.reason});return}this.failureCounts.set(i.key,$+1)}async recoverDead(i,$,n){let g=Ei.keyOf(i,$),v=this.failureCounts.get(g)??0,r=Math.min(1000*2**v,this.maxBackoffMs);this.logger?.warn(`${n} listener unhealthy, restarting`,{channel:i,connector:$,attempt:v+1,backoffMs:r}),await this.stop(i,$),await this.sleep(r);let b=await this.start(i,$);if(b.ok)this.failureCounts.delete(g),this.logger?.info(`${n} listener recovered`,{channel:i,connector:$});else if(b.retriable===!1)this.failureCounts.delete(g),this.logger?.warn(`${n} listener cannot recover (non-retriable)`,{channel:i,connector:$,reason:b.reason});else this.failureCounts.set(g,v+1)}}var TV=new R,ZV=3000,qV=100,MV=200,xV=(i)=>new Promise(($)=>{setTimeout($,i)}),NV=(i)=>`funnel-gateway[${i}]`,tV=async(i)=>{let $=i.now()+ZV;while(i.now()<$){if(i.pids.every((n)=>!i.runner.isAlive(n)))return;await i.sleep(qV)}for(let n of i.pids){if(!i.runner.isAlive(n))continue;try{i.runner.kill(n,"SIGKILL")}catch{}}await i.sleep(MV)},_w=async(i)=>{let $=i.process??TV,n=i.logger,g=NV(i.dir),v=$.listProcessesContaining(g),r=[];for(let b of v){if(b.pid===i.selfPid)continue;$.kill(b.pid,"SIGTERM"),r.push(b.pid),n?.info("killed competing Slack gateway process",{pid:b.pid,args:b.command.slice(0,160)})}if(r.length===0)return r;return await tV({runner:$,pids:r,sleep:i.sleep??xV,now:i.now??(()=>Date.now())}),r};var Dw=(i,$,n)=>{let g=i.req.raw.headers.get("Cookie");if(typeof $==="string"){if(!g)return;let r=$;if(n==="secure")r="__Secure-"+$;else if(n==="host")r="__Host-"+$;return b_(g,r)[r]}if(!g)return{};return b_(g)};var EV=/^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/i,cV=/^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/i,CV=/^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/i,p_=(i,$)=>{return async(n,g)=>{let v={},r=n.req.header("Content-Type");switch(i){case"json":if(!r||!EV.test(r))break;try{v=await n.req.json()}catch{throw new si(400,{message:"Malformed JSON in request body"})}break;case"form":{if(!r||!(cV.test(r)||CV.test(r)))break;let u;if(n.req.bodyCache.formData)u=await n.req.bodyCache.formData;else try{let U=await n.req.arrayBuffer();u=await Wr(U,r),n.req.bodyCache.formData=u}catch(U){let _="Malformed FormData request.";throw _+=U instanceof Error?` ${U.message}`:` ${String(U)}`,new si(400,{message:_})}let I=Object.create(null);u.forEach((U,_)=>{if(_.endsWith("[]"))(I[_]??=[]).push(U);else if(Array.isArray(I[_]))I[_].push(U);else if(Object.hasOwn(I,_))I[_]=[I[_],U];else I[_]=U}),v=I;break}case"query":v=Object.fromEntries(Object.entries(n.req.queries()).map(([u,I])=>{return I.length===1?[u,I[0]]:[u,I]}));break;case"param":v=n.req.param();break;case"header":v=n.req.header();break;case"cookie":v=Dw(n);break}let b=await $(v,n);if(b instanceof Response)return b;return n.req.addValidatedData(i,b),await g()}};function RV(i,$,n,g){return p_(i,async(v,r)=>{let b=v;if(i==="header"&&"_def"in $||i==="header"&&"_zod"in $){let I=Object.keys("in"in $?$.in.shape:$.shape),U=Object.fromEntries(I.map((_)=>[_.toLowerCase(),_]));b=Object.fromEntries(Object.entries(v).map(([_,k])=>[U[_]||_,k]))}let u=g&&g.validationFunction?await g.validationFunction($,b):await $.safeParseAsync(b);if(n){let I=await n({data:b,...u,target:i},r);if(I){if(I instanceof Response)return I;if("response"in I)return I.response}}if(!u.success)return r.json(u,400);return u.data})}var Yr=RV;var Ki=(i)=>Yr("param",i,($,n)=>{if($.success)return;let g=$.error.issues[0],v=g?`${g.path.join(".")}: ${g.message}`:"invalid request";return n.json({ok:!1,reason:v},400)});var e_=D.lazy(()=>D.union([D.string(),D.number(),D.boolean(),D.null(),D.array(e_),D.record(D.string(),e_)])),FV=D.object({method:D.string().min(1),path:D.string().min(1),body:e_.optional()}),kw=c.createHandlers(Ki(D.object({channel:D.string().min(1),connector:D.string().min(1)})),async(i)=>{let $=i.req.valid("param"),n=null;try{n=await i.req.json()}catch{n=null}let g=FV.safeParse(n);if(!g.success)throw new si(400,{message:g.error.issues[0]?.message??"invalid body"});let v=await i.var.deps.channels.call($.channel,$.connector,{method:g.data.method,path:g.data.path,body:g.data.body});return i.json({ok:!0,result:v})});var ww=c.createHandlers(Ki(D.object({channel:D.string().min(1)})),Yr("json",Ek,(i,$)=>{if(i.success)return;let n=i.error.issues[0],g=n?`${n.path.join(".")}: ${n.message}`:"invalid body";return $.json({ok:!1,reason:g},400)}),(i)=>{let $=i.req.valid("param"),n=i.req.valid("json"),g=n.target?{...n.meta,target:n.target}:n.meta,r={ok:!0,offset:i.var.deps.emit({channel:$.channel,connector:n.connector,content:n.content,meta:g}).offset};return i.json(r)});var oV=(i)=>{let n=(i.connectionErrors[i.connectionErrors.length-1]??null)?.detail??null;if(i.connectors.length===0)return{status:"warn",message:"no connectors configured on this channel",nextActions:[`fnl channels ${i.name} connectors add <name> --type=slack ...`],rootCause:null};if(!i.listener)return{status:"error",message:"no listener running for this channel",nextActions:["fnl gateway restart"],rootCause:n};if(!i.listener.alive)return{status:"error",message:"listener is dead",nextActions:["fnl gateway logs","fnl gateway restart"],rootCause:n};if(i.claudeClients===0)return{status:"warn",message:"no Claude connected to this channel",nextActions:[`fnl claude --channel ${i.name}`],rootCause:null};if(i.listener.errors>0)return{status:"warn",message:"listener has errors",nextActions:["fnl gateway logs"],rootCause:n};return{status:"ok",message:"healthy",nextActions:[],rootCause:null}},jw=c.createHandlers(async(i)=>{let $=i.var.deps,n=i.req.query("channel")??null,g=$.channels.list(),v=n?g.filter((U)=>U.name===n||U.id===n):g,r=$.registry.list(),b=$.broadcaster.listChannels(),u=$.broadcaster.getMetrics(),I=v.map((U)=>{let _=r.find((l)=>l.channelName===U.name)??null,k=_?{alive:_.alive,events:_.events,errors:_.errors,lastEventAt:_.lastEventAt}:null,O=b.filter((l)=>l.channel===U.id||l.channel===U.name).length,J=(()=>{if(!$.diagnosticLog)return[];try{return $.diagnosticLog.queryProcessed({channelId:U.id,limit:10}).map($v)}catch{return[]}})(),Q=k&&(!k.alive||k.errors>0)||!k,A=(()=>{if(!Q||!$.diagnosticLog)return[];try{return $.diagnosticLog.queryConnection({channelId:U.id,statuses:["auth-failed","error"],limit:3}).map(vv)}catch{return[]}})(),z={id:U.id,name:U.name,connectors:U.connectors.map((l)=>l.name),listener:k,claudeClients:O,recentEvents:J,connectionErrors:A};return{...z,diagnosis:oV(z)}});return i.json({pid:$.selfPid,uptimeMs:$.uptimeMs(),eventsBroadcast:u.eventsBroadcast,channels:I})});var Ow=c.createHandlers((i)=>{let $=i.var.deps;return i.json({ok:!0,pid:$.selfPid,funnelDir:$.dir,clients:$.broadcaster.getClientCount(),listeners:$.registry.list()})});var Jw=c.createHandlers((i)=>{return i.json({listeners:i.var.deps.registry.list()})});var Pw=c.createHandlers(Ki(D.object({channel:D.string().min(1),connector:D.string().min(1)})),async(i)=>{let $=i.req.valid("param"),n=await i.var.deps.registry.restart($.channel,$.connector);return i.json(n,n.ok?200:400)});var Ww=c.createHandlers(Ki(D.object({channel:D.string().min(1),connector:D.string().min(1)})),async(i)=>{let $=i.req.valid("param"),n=await i.var.deps.registry.start($.channel,$.connector);return i.json(n,n.ok?200:400)});var Vw=c.createHandlers(Ki(D.object({channel:D.string().min(1),connector:D.string().min(1)})),async(i)=>{let $=i.req.valid("param"),n=await i.var.deps.registry.stop($.channel,$.connector);return i.json(n,n.ok?200:400)});var Xw=c.createHandlers((i)=>{let $=i.var.deps;return i.json({ok:!0,pid:$.selfPid,funnelDir:$.dir,uptimeMs:$.uptimeMs(),clients:$.broadcaster.listChannels(),listeners:$.registry.list(),broadcaster:$.broadcaster.getMetrics()})});function mV(){return c.createApp().onError((i,$)=>{if(i instanceof si)return i.getResponse();let n=i instanceof Error?i.message:String(i);return $.json({error:n},500)}).get("/health",...Ow).get("/status",...Xw).get("/debug",...jw).get("/listeners",...Jw).post("/listeners/:channel/:connector/start",...Ww).delete("/listeners/:channel/:connector",...Vw).post("/listeners/:channel/:connector/restart",...Pw).post("/channels/:channel/connectors/:connector/call",...kw).post("/channels/:channel/publish",...ww)}var fw=mV();import{createHash as yV,randomUUID as hV}from"crypto";import{join as dV}from"path";function Qw(i){let $=i.port===0?hV():String(i.port),n=yV("sha256").update(`${i.funnelDir}\x00${$}`).digest("hex").slice(0,20);return dV(i.tmpDir,"events",`${n}.db`)}var sV="127.0.0.1",iX=new Set(["127.0.0.1","localhost","::1","::ffff:127.0.0.1"]),$X=()=>{};class s_{channels;configuredPort;configuredHostname;dbPath;process;logger;onError;selfPid;dir;killCompetingSlack;token;allowInsecureHost;broadcaster;eventLog;registry;nowMs;extraRoutes;ownsEventLog;diagnosticLog;startedAt=null;server=null;disposed=!1;constructor(i){this.channels=i.channels,this.configuredPort=i.port??Mi(),this.configuredHostname=i.hostname??sV,this.dir=i.dir??ji,this.dbPath=i.dbPath??Qw({tmpDir:i.tmpDir??fi(),funnelDir:this.dir,port:this.configuredPort}),this.process=i.process,this.logger=i.logger,this.onError=i.onError??$X,this.selfPid=i.selfPid??globalThis.process.pid,this.killCompetingSlack=i.killCompetingSlack??!0,this.token=i.token??"",this.allowInsecureHost=i.allowInsecureHost??!1,this.extraRoutes=i.extraRoutes??null,this.diagnosticLog=i.diagnosticLog;let $=i.clock;if(this.nowMs=$?()=>$.millis():()=>Date.now(),i.eventLog)this.eventLog=i.eventLog,this.ownsEventLog=!1;else{let n=eV(this.dbPath);if(!aV(n))pV(n,{recursive:!0});this.eventLog=new a_({path:this.dbPath,now:this.nowMs,logger:this.logger,onError:this.onError}),this.ownsEventLog=!0}this.broadcaster=new h_({logger:this.logger,onError:this.onError,now:this.nowMs,persistentReplay:this.eventLog}),this.broadcaster.seedLatestOffset(this.eventLog.findMaxOffset()),this.registry=new Ei({channels:this.channels,logger:this.logger,onError:this.onError,notify:async(n,g,v,r)=>{this.emit({channel:n,connector:g,content:v,meta:r})},now:this.nowMs})}get port(){return this.server?.port??this.configuredPort}get hostname(){return this.server?.hostname??this.configuredHostname}async start(){if(this.disposed)throw Error("FunnelGatewayServer is single-use: construct a new instance to start again");if(this.server)return;if(!this.token&&!iX.has(this.configuredHostname)&&!this.allowInsecureHost)throw Error(`refusing to start gateway: hostname "${this.configuredHostname}" is reachable off-box but no token is set. Set a token, bind to loopback (127.0.0.1), or pass allowInsecureHost: true.`);let i=this.buildApp();await this.killCompetingSlackIfNeeded(),this.startedAt=this.nowMs(),this.server=Bun.serve({port:this.configuredPort,hostname:this.configuredHostname,development:!1,fetch:($,n)=>this.handleFetch($,n,i),websocket:{open:($)=>this.handleWsOpen($),close:($)=>this.handleWsClose($),message(){}}}),this.logServerStarted();try{await this.bootListeners()}catch($){throw this.server.stop(),this.server=null,$}}async stop(){if(await this.registry.stopAll(),this.server)this.server.stop(),this.server=null;if(this.ownsEventLog)this.eventLog.close();this.disposed=!0}getStatus(){return{clients:this.broadcaster.getClientCount(),channels:this.broadcaster.listChannels()}}getBroadcaster(){return this.broadcaster}getRegistry(){return this.registry}getEventLog(){return this.eventLog}onEvent(i){return this.broadcaster.subscribe(i)}handleFetch(i,$,n){let g=new URL(i.url);if(g.pathname==="/ws"&&i.headers.get("upgrade")==="websocket"){if(this.token&&!this.tokenMatchesUpgrade(i))return new Response("unauthorized",{status:401});let v=g.searchParams.get("channel")??"",r=v?this.resolveChannel(v):null;if(v&&!r)return new Response(`unknown channel "${v}"`,{status:404});let b=r?.id??v,u=r?.name??null,I=r?.connectors??[],U=r?.delivery??"fanout",_=g.searchParams.get("since"),k=_===null?Number.NaN:Number.parseInt(_,10),O=Number.isFinite(k)&&k>=0?k:void 0,J=g.searchParams.get("id")??void 0;if($.upgrade(i,{data:{channel:b,channelName:u,connectors:I,delivery:U,subscriberId:J,since:O}}))return;return new Response("WebSocket upgrade failed",{status:400})}return n.fetch(i)}handleWsOpen(i){if(typeof i.data.since==="number"){let $=this.broadcaster.replaySince(i.data.since,i.data);try{for(let n of $)i.send(JSON.stringify(n))}catch(n){let g=n instanceof Error?n:Error(String(n));this.logger?.warn("replay send failed during ws.open",{error:g.message}),this.onError(g,{component:"gateway-server.replay"});return}}this.broadcaster.addClient(i,i.data),this.logger?.info("channel connected",{event_type:"system",action:"channel_connect",channel:i.data.channelName??"",channelId:i.data.channel,connectors:i.data.connectors.join(","),total:String(this.broadcaster.getClientCount())})}handleWsClose(i){this.broadcaster.removeClient(i),this.logger?.info("channel disconnected",{event_type:"system",action:"channel_disconnect",channel:i.data.channelName??"",channelId:i.data.channel,total:String(this.broadcaster.getClientCount())})}logServerStarted(){this.logger?.info("gateway started",{event_type:"system",action:"gateway_start",port:String(this.port),pid:String(this.selfPid)}),this.logger?.info("funnel gateway listening",{url:`http://localhost:${this.port}`,websocket:`ws://localhost:${this.port}/ws`,health:`http://localhost:${this.port}/health`})}buildApp(){let i=c.createApp();if(i.use((n,g)=>{return n.set("deps",{selfPid:this.selfPid,dir:this.dir,broadcaster:this.broadcaster,registry:this.registry,channels:this.channels,uptimeMs:()=>this.startedAt?this.nowMs()-this.startedAt:0,emit:(v)=>this.emit(v),diagnosticLog:this.diagnosticLog}),g()}),this.token)i.use("/listeners/*",ti({expected:this.token})),i.use("/status",ti({expected:this.token})),i.use("/debug",ti({expected:this.token})),i.use("/channels/*",ti({expected:this.token}));return(this.extraRoutes?i.route("/",this.extraRoutes):i).route("/",fw)}tokenMatchesUpgrade(i){let $=(i.headers.get("sec-websocket-protocol")??"").split(",").map((v)=>v.trim()).filter((v)=>v.length>0);for(let v of $)if(v.startsWith("funnel.token.")&&Pr(v.slice(13),this.token))return!0;let g=(i.headers.get("authorization")??"").match(/^Bearer\s+(.+)$/i);if(g&&Pr(g[1]??"",this.token))return!0;return!1}resolveChannel(i){let $=this.channels.get(i)??this.channels.getById(i);if(!$)return null;return{id:$.id,name:$.name,connectors:$.connectors.map((n)=>n.name),delivery:$.delivery}}async killCompetingSlackIfNeeded(){if(!this.killCompetingSlack)return;if(!this.channels.listAllConnectors().some((n)=>n.type==="slack"))return;let $=await _w({selfPid:this.selfPid,dir:this.dir,process:this.process,logger:this.logger});if($.length>0)this.logger?.info("killed competing Slack gateway processes",{event_type:"system",action:"kill_competing",pids:$.join(",")})}async bootListeners(){await this.registry.startAll();for(let i of this.registry.list())this.logger?.info(`${i.type} listener started: ${i.name}`,{event_type:"system",action:`${i.type}_connect`,channel:i.channelName,connector:i.name});this.logger?.info(`event store: ${this.dbPath}`),this.logger?.info("funnel gateway running")}emit(i){let $=this.lookupChannelId(i.channel),n=$&&i.connector?this.lookupConnectorId($,i.connector):null,g={...i.meta,channel:i.channel};if(i.connector)g.connector=i.connector;if($)g.channelId=$;if(n)g.connectorId=n;let v=this.broadcaster.broadcast(i.content,g);return this.eventLog.record({content:i.content,channelId:$??null,connectorId:n??null,meta:g,offset:v.offset}),{offset:v.offset}}lookupChannelId(i){return this.channels.get(i)?.id??this.channels.getById(i)?.id??null}lookupConnectorId(i,$){return this.channels.getById(i)?.connectors.find((g)=>g.name===$)?.id??null}}import{homedir as vX}from"os";import{dirname as nX,join as Kw}from"path";var Gw="gateway.token",gX=32,rX=new F,bX=()=>{let i=new Uint8Array(gX);return crypto.getRandomValues(i),[...i].map(($)=>$.toString(16).padStart(2,"0")).join("")};class i1{fs;path;generate;constructor(i={}){this.fs=i.fs??rX,this.path=Kw(i.dir??ji,Gw),this.generate=i.generate??bX,Object.freeze(this)}read(){if(!this.fs.existsSync(this.path))return null;let i=this.fs.readFileSync(this.path).trim();return i.length>0?i:null}ensure(){return this.fs.mkdirSync(nX(this.path),{recursive:!0}),this.fs.withFileLock(`${this.path}.lock`,()=>{let i=this.read();if(i)return i;let $=this.generate();return this.fs.writeSecretFileSync(this.path,`${$}
796
- `),$})}getPath(){return this.path}}var bS=Kw(vX(),".funnel",Gw);var uX=D.object({channelName:D.string(),channelId:D.string(),name:D.string(),type:D.string(),alive:D.boolean()}),UX=D.object({listeners:D.array(uX)}),IX=D.object({reason:D.string().optional()}),$1={state:"offline"};class v1{port;isDaemonRunning;getToken;constructor(i){this.port=i.port,this.isDaemonRunning=i.isDaemonRunning,this.getToken=i.getToken??(()=>null),Object.freeze(this)}async list(){if(!this.isDaemonRunning())return{state:"offline"};try{let i=await J$(`${xi(this.port)}/listeners`,{headers:this.authHeaders()});if(!i.ok)return{state:"error",reason:`HTTP ${i.status}`};let $=UX.safeParse(await i.json());if(!$.success)return{state:"error",reason:"malformed daemon response"};return{state:"ok",listeners:$.data.listeners}}catch(i){return{state:"error",reason:i instanceof Error?i.message:String(i)}}}async start(i,$){if(!this.isDaemonRunning())return $1;return await this.call("POST",`/listeners/${this.path(i,$)}/start`)}async stop(i,$){if(!this.isDaemonRunning())return $1;return await this.call("DELETE",`/listeners/${this.path(i,$)}`)}async restart(i,$){if(!this.isDaemonRunning())return $1;return await this.call("POST",`/listeners/${this.path(i,$)}/restart`)}path(i,$){return`${encodeURIComponent(i)}/${encodeURIComponent($)}`}authHeaders(){let i=this.getToken();return i?{authorization:`Bearer ${i}`}:{}}async call(i,$){try{let n=await J$(`${xi(this.port)}${$}`,{method:i,headers:this.authHeaders()},30000);if(!n.ok){let g=null;try{g=await n.json()}catch{g=null}let v=IX.safeParse(g);return{state:"error",reason:(v.success?v.data.reason:void 0)??`HTTP ${n.status}`}}return{state:"ok"}}catch(n){return{state:"error",reason:n instanceof Error?n.message:String(n)}}}}var DX="/sandbox/.funnel",kX="/sandbox/tmp",wX=()=>{};class Hr{paths;channels;gateway;gatewayToken;publisher;listeners;claude;profiles;localConfig;localConfigSync;diagnostics;recovery;doctor;docs;fs;process;logger;clock;http;onError;diagnosticLog;constructor(i={}){let $=i.dir??ur(),n=i.tmpDir??fi(),g=i.fs??new F,v=i.process??new R,r=i.clock??new Ni,b=i.idGenerator??new Zi,u=i.http??new Di;this.paths={dir:$,tmpDir:n,settings:_X($,"settings.json")},this.fs=g,this.process=v,this.logger=i.logger,this.clock=r,this.http=u,this.onError=i.onError??wX,this.diagnosticLog=i.diagnosticLog;let I=i.store??new v_({path:this.paths.settings,fs:g,idGenerator:b}),U=new D_({descriptors:i.connectors??[],fs:g,process:v,http:u,clock:r,logger:this.logger,diagnosticLog:this.diagnosticLog,signal:i.signal,dir:$});this.profiles=new Y_({store:I,idGenerator:b,fs:g}),this.channels=new k_({store:I,registry:U,clock:r,idGenerator:b,profileChecker:this.profiles}),this.gateway=new c_({fs:g,process:v,clock:r,dir:$,tmpDir:n,port:i.port}),this.gatewayToken=new i1({fs:g,dir:$}),this.publisher=new t_({port:this.gateway.getPort(),isDaemonRunning:()=>this.gateway.isRunning(),getToken:()=>this.gatewayToken.read()}),this.listeners=new v1({port:this.gateway.getPort(),isDaemonRunning:()=>this.gateway.isRunning(),getToken:()=>this.gatewayToken.read()});let _=new G_({fs:g});this.localConfig=new f_({fs:g}),this.localConfigSync=new K_({channels:this.channels,prompter:i.tokenPrompter??new z_});let k=new O_({global:this.profiles,local:new j_({fs:g,dir:$})});this.claude=new w_({channels:this.channels,mcp:_,gateway:this.gateway,sessions:k,guard:new kr({fs:g,process:v,dir:$}),process:v,logger:this.logger,dir:$}),this.diagnostics=new P_({gateway:this.gateway,gatewayToken:this.gatewayToken,channels:this.channels,publisher:this.publisher,diagnosticLog:this.diagnosticLog,tmpDir:n}),this.recovery=new H_({gateway:this.gateway,listeners:this.listeners,channels:this.channels}),this.doctor=new W_({diagnostics:this.diagnostics,recovery:this.recovery}),this.docs=new X_,Object.freeze(this)}static inMemory(i={}){return new Hr({...i,store:i.store??new L_,fs:i.fs??new S_,process:i.process??new B_,logger:i.logger??new l_,clock:i.clock??new T_,idGenerator:i.idGenerator??new A_,http:i.http??new Z_,tokenPrompter:i.tokenPrompter??new q_,diagnosticLog:i.diagnosticLog??new N_,dir:i.dir??DX,tmpDir:i.tmpDir??kX})}gatewayServer(i={}){return new s_({channels:this.channels,port:i.port,hostname:i.hostname,...i.eventLog?{eventLog:i.eventLog}:{dbPath:i.dbPath},process:this.process,clock:this.clock,logger:this.logger,onError:this.onError,dir:this.paths.dir,tmpDir:this.paths.tmpDir,killCompetingSlack:i.killCompetingSlack,token:i.token??this.gatewayToken.ensure(),allowInsecureHost:i.allowInsecureHost,extraRoutes:i.extraRoutes,diagnosticLog:this.diagnosticLog})}createProcessGuard(){return new kr({fs:this.fs,process:this.process,dir:this.paths.dir})}async runGatewayForeground(i={}){let $=Jr(),g=i.caffeinate!==!1&&globalThis.process.platform==="darwin"?["caffeinate","-is","bun",$]:["bun",$];return this.process.attach(g,{env:{FUNNEL_DIR:this.paths.dir,FUNNEL_PORT:String(this.gateway.getPort()),FUNNEL_TMP_DIR:this.paths.tmpDir}})}gatewayClient(){let{port:i}=this.gateway.getStatus();return __(xi(i))}}import{appendFileSync as OX,mkdirSync as JX}from"fs";import{dirname as PX,join as WX}from"path";var jX=[/xox[abprs]-[A-Za-z0-9-]{10,}/g,/xapp-[A-Za-z0-9-]{10,}/g,/gh[pousr]_[A-Za-z0-9]{20,}/g,/github_pat_[A-Za-z0-9_]{20,}/g,/Bot [A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{4,}\.[A-Za-z0-9_-]{20,}/g,/Bearer [A-Za-z0-9._~+/-]{16,}/g],Yw=(i)=>{let $=i;for(let n of jX)$=$.replace(n,"[redacted]");return $};var VX=()=>WX(fi(),"funnel.log");class n1 extends In{file;now;constructor(i={}){super();this.file=i.file??VX(),this.now=i.now??(()=>new Date),Object.freeze(this)}info(i,$){this.write("info",i,$)}warn(i,$){this.write("warn",i,$)}error(i,$){this.write("error",i,$)}write(i,$,n){JX(PX(this.file),{recursive:!0});let g={time:this.now().toISOString(),level:i,message:$,...n?{meta:n}:{}};OX(this.file,`${Yw(JSON.stringify(g))}
797
- `)}}var zw=(i)=>{let $=new Jn;if(i.token)$.use("/diagnostics",ti({expected:i.token})),$.use("/diagnostics/*",ti({expected:i.token})),$.use("/doctor",ti({expected:i.token}));return $.get("/diagnostics",async(n)=>{let g=n.req.query("channel");if(n.req.query("all")!==void 0){let b=await i.diagnostics.diagnoseAll();return n.json(b)}let r=await i.diagnostics.diagnose(g??void 0);if(!r)return n.json({error:"channel not found"},404);return n.json(r)}),$.get("/diagnostics/events",async(n)=>{let g=n.req.query("channel")??null,v=n.req.query("connector"),r=Number(n.req.query("limit")??"20"),b=await i.diagnostics.recentEvents(g,{connector:v,limit:r});return n.json(b)}),$.get("/diagnostics/dropped",async(n)=>{let g=n.req.query("channel")??null,v=n.req.query("connector"),r=Number(n.req.query("limit")??"20"),b=await i.diagnostics.droppedEvents(g,{connector:v,limit:r});return n.json(b)}),$.get("/diagnostics/errors",async(n)=>{let g=n.req.query("channel")??null,v=n.req.query("connector"),r=Number(n.req.query("limit")??"20"),b=await i.diagnostics.connectionErrors(g,{connector:v,limit:r});return n.json(b)}),$.get("/diagnostics/raw",async(n)=>{let g=n.req.query("channel")??null,v=n.req.query("connector"),r=Number(n.req.query("limit")??"20"),b=await i.diagnostics.rawEvents(g,{connector:v,limit:r});return n.json(b)}),$.get("/diagnostics/connection",async(n)=>{let g=n.req.query("channel")??null,v=n.req.query("connector"),r=Number(n.req.query("limit")??"20"),b=await i.diagnostics.connectionTimeline(g,{connector:v,limit:r});return n.json(b)}),$.get("/diagnostics/logs",async(n)=>{let g=n.req.query("grep")??void 0,v=Number(n.req.query("limit")??"200"),r=await i.diagnostics.recentLogs({grep:g,limit:v});return n.json(r)}),$.post("/diagnostics/replay",async(n)=>{let g=await Hw(n),v=typeof g.channel==="string"?g.channel:null,r=typeof g.seq==="number"?g.seq:void 0;if(!v)return n.json({error:"channel is required"},400);let b=await i.diagnostics.replay(v,r);return n.json(b)}),$.post("/doctor",async(n)=>{let g=await Hw(n),v=g.mode==="safe"||g.mode==="aggressive"||g.mode==="off"?g.mode:"off",r=await i.doctor.run(v);return n.json(r)}),$},XX=(i)=>i!==null&&typeof i==="object"&&!Array.isArray(i),Hw=async(i)=>{try{let $=await i.req.json();return XX($)?$:{}}catch{return{}}};var Sw=(i)=>{if(!(i instanceof Error))return!1;if(("code"in i?String(Reflect.get(i,"code")):"")==="EADDRINUSE")return!0;let n=i.message;return n.includes("EADDRINUSE")||n.includes("address already in use")||n.includes("in use")};import{chmodSync as fX}from"fs";var QX=262144;class b1 extends _n{raw;processed;connection;now;logger;constructor(i){super();this.now=i.now??(()=>Date.now()),this.logger=i.logger;let $=i.maxAgeMs!==void 0?{maxAgeMs:i.maxAgeMs}:{},n={now:this.now,...$,...i.maxRows!==void 0?{maxRows:i.maxRows}:{}},g=i.rawMaxRows??i.maxRows,v={now:this.now,...$,...g!==void 0?{maxRows:g}:{}};this.raw=new W$({path:i.rawPath,indexes:["event_id","connector_id","channel_id"],extractIndexes:(r)=>({event_id:r.event_id,connector_id:r.connector_id,channel_id:r.channel_id}),...v}),this.processed=new W$({path:i.processedPath,indexes:["event_id","connector_id","channel_id","outcome"],extractIndexes:(r)=>({event_id:r.event_id,connector_id:r.connector_id,channel_id:r.channel_id,outcome:r.outcome}),...n}),this.connection=new W$({path:i.connectionPath,indexes:["connector_id","channel_id","status"],extractIndexes:(r)=>({connector_id:r.connector_id,channel_id:r.channel_id,status:r.status}),...n}),g1(i.rawPath),g1(i.processedPath),g1(i.connectionPath),Object.freeze(this)}recordRaw(i){let $={event_id:i.eventId,type:i.type,connector_id:i.connectorId,channel_id:i.channelId,payload:YX(i.payload,i.type)};this.report("raw",this.raw.insert({ts:this.now(),event:$}))}recordProcessed(i){let $={event_id:i.eventId,type:i.type,connector_id:i.connectorId,channel_id:i.channelId,outcome:i.outcome,payload:i.payload};this.report("processed",this.processed.insert({ts:this.now(),event:$}))}recordConnection(i){let $={type:i.type,connector_id:i.connectorId,channel_id:i.channelId,status:i.status,detail:i.detail};this.report("connection",this.connection.insert({ts:this.now(),event:$}))}report(i,$){if($ instanceof Error)this.logger?.error("diagnostic log insert failed",{table:i,error:$.message})}queryRaw(i){let $=r1(i);if(i.eventId!==void 0)$.event_id=i.eventId;return this.raw.query({...i.type!==void 0?{type:i.type}:{},...i.seq!==void 0?{seq:i.seq}:{},...i.limit!==void 0?{limit:i.limit}:{},where:$,order:"desc"}).map((g)=>({seq:g.seq,ts:g.ts,eventId:g.event.event_id,type:g.event.type,connectorId:g.event.connector_id,channelId:g.event.channel_id,payload:g.event.payload}))}queryProcessed(i){let $=r1(i);if(i.eventId!==void 0)$.event_id=i.eventId;if(i.outcome!==void 0)$.outcome=i.outcome;return this.processed.query({...i.type!==void 0?{type:i.type}:{},...i.seq!==void 0?{seq:i.seq}:{},...i.limit!==void 0?{limit:i.limit}:{},where:$,...i.outcomePrefix!==void 0?{wherePrefix:{outcome:i.outcomePrefix}}:{},order:"desc"}).map((g)=>({seq:g.seq,ts:g.ts,eventId:g.event.event_id,type:g.event.type,connectorId:g.event.connector_id,channelId:g.event.channel_id,outcome:g.event.outcome,payload:g.event.payload}))}queryConnection(i){let $=r1(i);if(i.status!==void 0)$.status=i.status;return this.connection.query({...i.type!==void 0?{type:i.type}:{},...i.seq!==void 0?{seq:i.seq}:{},...i.limit!==void 0?{limit:i.limit}:{},where:$,...i.statuses!==void 0?{whereIn:{status:i.statuses}}:{},order:"desc"}).map((g)=>({seq:g.seq,ts:g.ts,type:g.event.type,connectorId:g.event.connector_id,channelId:g.event.channel_id,status:GX(g.event.status),detail:g.event.detail}))}clear(){this.raw.clear(),this.processed.clear(),this.connection.clear()}close(){this.raw.close(),this.processed.close(),this.connection.close()}}var g1=(i)=>{if(i===":memory:")return;for(let $ of["","-wal","-shm"])try{fX(`${i}${$}`,384)}catch{}},r1=(i)=>{let $={};if(i.connectorId!==void 0)$.connector_id=i.connectorId;if(i.channelId!==void 0)$.channel_id=i.channelId;return $},KX=tk.shape.status,GX=(i)=>{let $=KX.safeParse(i);return $.success?$.data:"error"},YX=(i,$)=>{let n=Buffer.byteLength(i,"utf8");if(n<=QX)return i;return JSON.stringify({...zX(i),_funnel_oversized:n,_funnel_type:$})},HX=["type","subtype","ts","channel","channel_type","user","bot_id"],zX=(i)=>{try{let $=JSON.parse(i);if(typeof $!=="object"||$===null)return{};let n=$,g={};for(let v of HX)if(n[v]!==void 0)g[v]=n[v];return g}catch{return{}}};import{join as u1}from"path";var Aw=(i)=>({rawPath:u1(i,"connector-raw.db"),processedPath:u1(i,"connector-processed.db"),connectionPath:u1(i,"connector-connection.db")});var BX=5000,LX=50000,TX=604800000,U1=Mi(),ZX=process.env.FUNNEL_HOST||"127.0.0.1",Pn=ur(),zr=lX(Pn,"gateway.pid");process.title=`funnel-gateway[${Pn}]`;var rv=new n1,qX=new R;Lw(Pn,{recursive:!0});var lw=()=>{try{return AX(zr,String(process.pid),{flag:"wx"}),!0}catch(i){if(!(i instanceof Error)||!("code"in i)||i.code!=="EEXIST")throw i;return!1}};if(!lw()){let i=Number(SX(zr,"utf-8").trim());if(i>0&&qX.isAlive(i))rv.error("funnel gateway already running",{pid:i}),process.exit(1);if(Tw(zr),!lw())rv.error("funnel gateway PID file claimed by another daemon mid-race"),process.exit(1)}process.on("exit",()=>{try{Tw(zr)}catch{}});var Zw=fi();Lw(Zw,{recursive:!0});var qw=new b1({...Aw(Zw),rawMaxRows:BX,maxRows:LX,maxAgeMs:TX,logger:rv});process.on("exit",()=>{try{qw.close()}catch{}});var Sr=new Hr({logger:rv,diagnosticLog:qw,dir:Pn,connectors:sD()}),Mw=Sr.gatewayToken.ensure(),MX=zw({diagnostics:Sr.diagnostics,doctor:Sr.doctor,token:Mw}),xw=Sr.gatewayServer({port:U1,hostname:ZX,extraRoutes:MX,token:Mw});try{await xw.start()}catch(i){if(Sw(i))rv.error(`gateway port ${U1} is already in use by another funnel daemon (a different repo/scope). Set FUNNEL_PORT to a distinct port, or stop the other daemon.`,{port:U1,dir:Pn});else rv.error("gateway failed to start",{error:i instanceof Error?i.message:String(i)});process.exit(1)}var Bw=!1,Nw=async(i)=>{if(Bw)return;Bw=!0;try{await Promise.race([xw.stop(),new Promise(($)=>setTimeout($,3000))])}catch{}process.exit(i)};process.on("SIGINT",()=>{Nw(130)});process.on("SIGTERM",()=>{Nw(143)});
793
+ related: fnl docs debugging, fnl docs channels, fnl docs profiles`;var V_={architecture:Gk,channels:Yk,claude:Hk,connectors:zk,debugging:Sk,gateway:Ak,glossary:Bk,"local-config":lk,mcp:Lk,profiles:Tk,"programmable-api":Zk,recipes:qk},XW={architecture:"how Funnel routes events end-to-end",channels:"what a channel is and how delivery modes work",connectors:"external service bindings nested in channels",profiles:"named Claude launch presets",claude:"fnl claude resolution order and argv assembly",mcp:"the MCP server, inbound notifications, outbound tools",gateway:"the WebSocket + HTTP daemon","local-config":"the per-repo funnel.json file",debugging:"ladder for diagnosing event delivery problems","programmable-api":"Funnel as an SDK; build your own CLI/UI on the engine",recipes:"common task playbooks",glossary:"vocabulary reference"};class X_{constructor(){Object.freeze(this)}list(){return Object.keys(V_).sort().map((i)=>({name:i,summary:XW[i]??""}))}get(i){return V_[i]??null}topics(){return Object.keys(V_).sort()}}import{join as SW}from"path";var fW=D.object({type:D.literal("slack"),name:D.string(),minify:D.boolean().optional()}),QW=D.object({type:D.literal("discord"),name:D.string()}),KW=D.object({type:D.literal("gh"),name:D.string(),pollInterval:D.number().int().positive().optional()}),GW=D.object({type:D.literal("schedule"),name:D.string()}),YW=D.discriminatedUnion("type",[fW,QW,KW,GW]),HW=D.object({name:D.string(),connectors:D.array(YW).optional()}),zW=D.object({name:D.string(),channel:D.string(),options:D.array(D.string()).optional(),env:D.record(D.string(),D.string()).optional(),resume:D.boolean().optional()}),Mk=D.object({$schema:D.string().optional(),id:D.string().optional(),channels:D.array(HW).min(1),profiles:D.array(zW).optional()}),nv="funnel.json";class f_{fs;constructor(i){this.fs=i.fs,Object.freeze(this)}read(i){let $=SW(i,nv);if(!this.fs.existsSync($))return null;let n=this.fs.readFileSync($),g=(()=>{try{return JSON.parse(n)}catch(r){let b=r instanceof Error?r.message:String(r);throw Error(`${nv} is not valid JSON: ${b}`)}})(),v=Mk.safeParse(g);if(!v.success)throw Error(`${nv} is invalid: ${v.error.message}`);return this.assertProfilesValid(v.data),v.data}assertProfilesValid(i){let $=i.profiles??[];if($.length===0)return;let n=new Set(i.channels.map((v)=>v.name)),g=new Set;for(let v of $){if(!n.has(v.channel))throw Error(`${nv} is invalid: profile "${v.name}" binds channel "${v.channel}", which is not declared in channels[]`);if(g.has(v.name))throw Error(`${nv} is invalid: more than one profile is named "${v.name}" \u2014 names must be unique`);g.add(v.name)}}}function Q_(i){if(i.env!==void 0)return{botTokenEnv:i.env};if(i.literal!==void 0)return{botToken:i.literal};return{}}function xk(i){if(i.env!==void 0)return{appTokenEnv:i.env};if(i.literal!==void 0)return{appToken:i.literal};return{}}class K_{channels;prompter;constructor(i){this.channels=i.channels,this.prompter=i.prompter,Object.freeze(this)}async ensure(i){if(!this.channels.get(i.name))this.channels.add({name:i.name});if(i.connectors===void 0)return{touched:[],removed:[]};let n=[],g=new Set;for(let r of i.connectors){let b=await this.ensureConnector(i.name,r);n.push({name:b.name,changed:b.changed}),g.add(b.id)}let v=this.removeExtras(i.name,g);return{touched:n,removed:v}}async ensureConnector(i,$){if($.type==="slack")return await this.ensureSlack(i,$);if($.type==="discord")return await this.ensureDiscord(i,$);if($.type==="gh")return this.ensureGh(i,$);return this.ensureSchedule(i,$)}async ensureSlack(i,$){let n=this.findExistingSlack(i,$.name),g=await this.resolveSlot({label:`${$.name}.botToken`,existingLiteral:n?.botToken,existingEnv:n?.botTokenEnv}),v=await this.resolveSlot({label:`${$.name}.appToken`,existingLiteral:n?.appToken,existingEnv:n?.appTokenEnv}),r={botToken:g.token,botTokenEnv:g.tokenEnv,appToken:v.token,appTokenEnv:v.tokenEnv};if(n){if(!(n.botToken===g.token&&n.botTokenEnv===g.tokenEnv&&n.appToken===v.token&&n.appTokenEnv===v.tokenEnv))return this.channels.updateSlackConnector(i,$.name,r),{id:n.id,name:$.name,changed:!0};return{id:n.id,name:$.name,changed:!1}}return{id:this.channels.addConnector(i,{type:"slack",name:$.name,...Q_({literal:g.token,env:g.tokenEnv}),...xk({literal:v.token,env:v.tokenEnv}),...$.minify!==void 0?{minify:$.minify}:{}}).id,name:$.name,changed:!0}}async ensureDiscord(i,$){let n=this.findExistingDiscord(i,$.name),g=await this.resolveSlot({label:`${$.name}.botToken`,existingLiteral:n?.botToken,existingEnv:n?.botTokenEnv}),v={botToken:g.token,botTokenEnv:g.tokenEnv};if(n){if(n.botToken!==g.token||n.botTokenEnv!==g.tokenEnv)return this.channels.updateDiscordConnector(i,$.name,v),{id:n.id,name:$.name,changed:!0};return{id:n.id,name:$.name,changed:!1}}return{id:this.channels.addConnector(i,{type:"discord",name:$.name,...Q_({literal:g.token,env:g.tokenEnv})}).id,name:$.name,changed:!0}}ensureGh(i,$){let n=this.channels.getConnector(i,$.name);if(n&&n.type!=="gh")throw Error(`connector "${$.name}" exists in channel "${i}" with type "${n.type}", funnel.json declares "gh"`);if(n&&n.type==="gh"){let v=Li.parse(n);if($.pollInterval!==void 0&&v.pollInterval!==$.pollInterval)return this.channels.updateGhConnector(i,$.name,{pollInterval:$.pollInterval}),{id:v.id,name:$.name,changed:!0};return{id:v.id,name:$.name,changed:!1}}return{id:this.channels.addConnector(i,{type:"gh",name:$.name,...$.pollInterval!==void 0?{pollInterval:$.pollInterval}:{}}).id,name:$.name,changed:!0}}ensureSchedule(i,$){let n=this.channels.getConnector(i,$.name);if(n&&n.type!=="schedule")throw Error(`connector "${$.name}" exists in channel "${i}" with type "${n.type}", funnel.json declares "schedule"`);if(n&&n.type==="schedule")return{id:n.id,name:$.name,changed:!1};return{id:this.channels.addConnector(i,{type:"schedule",name:$.name}).id,name:$.name,changed:!0}}findExistingSlack(i,$){let n=this.channels.getConnector(i,$);if(!n)return null;if(n.type!=="slack")throw Error(`connector "${$}" exists in channel "${i}" with type "${n.type}", funnel.json declares "slack"`);return Ti.parse(n)}findExistingDiscord(i,$){let n=this.channels.getConnector(i,$);if(!n)return null;if(n.type!=="discord")throw Error(`connector "${$}" exists in channel "${i}" with type "${n.type}", funnel.json declares "discord"`);return Ai.parse(n)}removeExtras(i,$){let n=this.channels.get(i);if(!n)return[];let g=n.connectors.filter((v)=>!$.has(v.id));for(let v of g)this.channels.removeConnector(i,v.name);return g.map((v)=>v.name)}async resolveSlot(i){if(i.existingEnv!==void 0)return{token:void 0,tokenEnv:i.existingEnv};if(i.existingLiteral!==void 0)return{token:i.existingLiteral,tokenEnv:void 0};return{token:await this.prompter.promptSecret(i.label),tokenEnv:void 0}}}import{join as jr}from"path";var AW="bun",BW=["funnel","mcp"],lW="funnel",LW=new F,un=(i)=>{return typeof i==="object"&&i!==null&&!Array.isArray(i)};class G_{fs;constructor(i={}){this.fs=i.fs??LW,Object.freeze(this)}install(i){if(!this.fs.existsSync(i))throw Error(`repository does not exist: ${i}`);this.fs.withFileLock(jr(i,".mcp.json.lock"),()=>{let $=this.readConfig(i),n=$.mcpServers,g=un(n)?n:{},r=this.findServerName(g)??lW;g[r]={command:AW,args:BW},$.mcpServers=g,this.writeConfig(i,$)})}uninstall(i){if(!this.fs.existsSync(i))return;this.fs.withFileLock(jr(i,".mcp.json.lock"),()=>{let $=this.readConfig(i),n=$.mcpServers;if(!un(n))return;let g=this.findServerName(n);if(!g)return;delete n[g],this.writeConfig(i,$)})}findInstalledName(i){let n=this.readConfig(i).mcpServers;return un(n)?this.findServerName(n):null}findServerName(i){for(let $ of Object.entries(i))if(this.isFunnelEntry($[1]))return $[0];return null}isFunnelEntry(i){if(!un(i))return!1;let{command:$,args:n}=i;if($==="bun"&&Array.isArray(n)&&n[0]==="funnel")return!0;if($==="funnel")return!0;return!1}readConfig(i){let $=jr(i,".mcp.json");if(!this.fs.existsSync($))return{};let n=this.fs.readFileSync($).trim();if(!n)return{};let g;try{g=JSON.parse(n)}catch(v){throw Error(`invalid .mcp.json (${$}): ${v instanceof Error?v.message:String(v)}`)}if(!un(g))throw Error(`invalid .mcp.json (${$}): expected a JSON object`);return g}writeConfig(i,$){let n=jr(i,".mcp.json");this.fs.writeFileSync(n,`${JSON.stringify($,null,2)}
794
+ `)}}var TW=new F;class Y_{store;idGenerator;fs;constructor(i){this.store=i.store,this.idGenerator=i.idGenerator,this.fs=i.fs??TW,Object.freeze(this)}list(){return this.store.read().profiles}get(i){return this.list().find(($)=>$.name===i)??null}getById(i){return this.list().find(($)=>$.id===i)??null}getDefault(){return this.list()[0]??null}add(i){this.store.update(($)=>{if($.profiles.some((n)=>n.name===i.name))throw Error(`profile "${i.name}" already exists`);if(!$.channels.some((n)=>n.id===i.channelId))throw Error(`channel id "${i.channelId}" not found`);$.profiles.push({id:this.idGenerator.generate(),name:i.name,path:i.path,channelId:i.channelId,options:i.options??[],env:i.env??{},resume:i.resume??!0})})}remove(i){this.store.update(($)=>{let n=$.profiles.findIndex((g)=>g.name===i);if(n<0)throw Error(`profile "${i}" not found`);$.profiles.splice(n,1)})}rename(i,$){this.store.update((n)=>{let g=n.profiles.find((v)=>v.name===i);if(!g)throw Error(`profile "${i}" not found`);if(n.profiles.some((v)=>v.name===$))throw Error(`profile "${$}" already exists`);g.name=$})}asDefault(i){this.store.update(($)=>{let n=$.profiles.findIndex((v)=>v.name===i);if(n<0)throw Error(`profile "${i}" not found`);if(n===0)return;let[g]=$.profiles.splice(n,1);if(!g)return;$.profiles.unshift(g)})}hasChannelRef(i){return this.store.read().profiles.some(($)=>$.channelId===i)}getSessionId(i){return this.getById(i)?.sessionId??null}setSessionId(i,$){this.store.update((n)=>{let g=n.profiles.find((v)=>v.id===i);if(!g)throw Error(`profile id "${i}" not found`);g.sessionId=$})}sessionFileExists(i,$,n){return wr({fs:this.fs,cwd:i,sessionId:$,env:n})}update(i,$){this.store.update((n)=>{let g=n.profiles.find((v)=>v.name===i);if(!g)throw Error(`profile "${i}" not found`);if($.channelId!==void 0){if(!n.channels.some((v)=>v.id===$.channelId))throw Error(`channel id "${$.channelId}" not found`);g.channelId=$.channelId}if($.path!==void 0)g.path=$.path;if($.options!==void 0)g.options=$.options;if($.env!==void 0)g.env=$.env;if($.resume!==void 0)g.resume=$.resume})}}class H_{props;constructor(i){this.props=i;Object.freeze(this)}async ensureGatewayRunning(){if(this.props.gateway.isRunning())return{ok:!0,actions:[{kind:"gateway:already-running"}],message:"gateway is already running"};if(!await this.props.gateway.start())return{ok:!1,actions:[],message:"gateway failed to start \u2014 check `fnl gateway logs`"};return{ok:!0,actions:[{kind:"gateway:started"}],message:"gateway started"}}async restartGateway(){if(!(await this.props.gateway.restart()).ok)return{ok:!1,actions:[],message:"gateway restart failed \u2014 check `fnl gateway logs`"};return{ok:!0,actions:[{kind:"gateway:restarted"}],message:"gateway restarted"}}async restartListener(i,$){let n=await this.props.listeners.restart(i,$);if(n.state==="offline")return{ok:!1,actions:[],message:"gateway is not running \u2014 call ensureGatewayRunning() first"};if(n.state==="not-found")return{ok:!1,actions:[{kind:"listener:skipped",channel:i,connector:$,reason:"not-found"}],message:`listener not found: ${i}/${$}`};if(n.state==="error")return{ok:!1,actions:[{kind:"listener:skipped",channel:i,connector:$,reason:n.reason}],message:`listener restart failed: ${n.reason}`};return{ok:!0,actions:[{kind:"listener:restarted",channel:i,connector:$}],message:`restarted ${i}/${$}`}}async restartAllDeadListeners(){let i=await this.props.listeners.list();if(i.state==="offline")return{ok:!1,actions:[],message:"gateway is not running \u2014 call ensureGatewayRunning() first"};if(i.state==="error")return{ok:!1,actions:[],message:`could not list listeners: ${i.reason}`};let $=i.listeners.filter((v)=>!v.alive);if($.length===0)return{ok:!0,actions:[],message:"no dead listeners found"};let n=[];for(let v of $){let r=await this.props.listeners.restart(v.channelName,v.name);if(r.state==="ok")n.push({kind:"listener:restarted",channel:v.channelName,connector:v.name});else{let b=r.state==="error"?r.reason:r.state;n.push({kind:"listener:skipped",channel:v.channelName,connector:v.name,reason:b})}}let g=n.filter((v)=>v.kind==="listener:restarted").length;return{ok:g>0,actions:n,message:`restarted ${g}/${$.length} dead listener(s)`}}}import{stderr as Or,stdin as Qi}from"process";class Un{}var ZW="*",qW="\r",Nk=`
795
+ `,MW=String.fromCharCode(8),xW=String.fromCharCode(127),NW=String.fromCharCode(3),EW=String.fromCharCode(4);class z_ extends Un{async promptSecret(i){if(!Qi.isTTY)throw Error(`cannot prompt for "${i}": stdin is not a TTY. Set the matching env var or run \`fnl channels <ch> connectors add ...\` first.`);Or.write(`${i}: `);let $=Qi.isRaw;Qi.setRawMode(!0),Qi.resume();try{return await this.readSecret()}finally{Qi.setRawMode($),Qi.pause(),Or.write(Nk)}}readSecret(){return new Promise((i,$)=>{let n="",g=(v)=>{for(let r of v){let b=String.fromCharCode(r);if(b===Nk||b===qW){Qi.off("data",g),i(n);return}if(b===NW){Qi.off("data",g),$(Error("prompt cancelled"));return}if(b===EW){if(Qi.off("data",g),n.length===0)$(Error("prompt cancelled"));else i(n);return}if(b===MW||b===xW){if(n.length>0)n=n.slice(0,-1),Or.write("\b \b");continue}n+=b,Or.write(ZW)}};Qi.on("data",g)})}}var tW=384;class S_ extends av{dirs;files;mtimes;modes;now;constructor(i={}){super();this.dirs=new Set(i.dirs??[]),this.files=new Map(Object.entries(i.files??{})),this.mtimes=new Map(Object.entries(i.mtimes??{})),this.modes=new Map(Object.entries(i.modes??{})),this.now=i.now??(()=>Date.now())}existsSync(i){return this.dirs.has(i)||this.files.has(i)}readFileSync(i){return this.files.get(i)??""}writeFileSync(i,$){this.files.set(i,$),this.touch(i)}writeSecretFileSync(i,$){this.files.set(i,$),this.modes.set(i,tW),this.touch(i)}appendFileSync(i,$){let n=this.files.get(i)??"";this.files.set(i,n+$),this.touch(i)}unlink(i){this.files.delete(i),this.mtimes.delete(i),this.modes.delete(i)}mkdirSync(i,$){this.dirs.add(i)}readdirSync(i){let $=i.endsWith("/")?i:`${i}/`,n=[];for(let g of this.files.keys()){if(!g.startsWith($))continue;let v=g.slice($.length);if(!v.includes("/"))n.push(v)}return n}statSync(i){let $=this.mtimes.get(i);if($===void 0)throw Error(`not found: ${i}`);return{mtimeMs:$,mode:this.modes.get(i)??null}}withFileLock(i,$){return $()}setMtime(i,$){this.mtimes.set(i,$)}setMode(i,$){this.modes.set(i,$)}touch(i){if(!this.mtimes.has(i))this.mtimes.set(i,this.now());else this.mtimes.set(i,this.now())}}class A_ extends vn{counter=0;prefix;constructor(i={}){super();this.prefix=i.prefix??"id"}generate(){return this.counter++,`${this.prefix}-${this.counter}`}}class In{}class B_ extends In{file=null;entries=[];info(i,$){this.entries.push({level:"info",message:i,meta:$})}warn(i,$){this.entries.push({level:"warn",message:i,meta:$})}error(i,$){this.entries.push({level:"error",message:i,meta:$})}clear(){this.entries.length=0}}var Ek={exitCode:0,stdout:"",stderr:""};class l_ extends yv{calls=[];killed=[];handler=()=>Ek;syncHandler=()=>Ek;aliveStub=null;listStub=null;startTimeStub=null;on(i){return this.handler=i,this}onSync(i){return this.syncHandler=i,this}onIsAlive(i){return this.aliveStub=i,this}onListProcessesContaining(i){return this.listStub=i,this}onGetStartTime(i){return this.startTimeStub=i,this}async run(i,$={}){this.calls.push({kind:"run",command:i,options:$});let n=await this.handler(i);return{exitCode:n.exitCode??0,stdout:n.stdout??"",stderr:n.stderr??""}}runSync(i){this.calls.push({kind:"runSync",command:i});let $=this.syncHandler(i);return{exitCode:$.exitCode??0,stdout:$.stdout??"",stderr:$.stderr??""}}async attach(i,$={}){if(this.calls.push({kind:"attach",command:i,options:$}),$.onSpawned)$.onSpawned(1);return(await this.handler(i)).exitCode??0}detach(i,$={}){this.calls.push({kind:"detach",command:i,options:$})}kill(i,$="SIGTERM"){this.calls.push({kind:"kill",command:[String(i),$]}),this.killed.push({pid:i,signal:$})}isAlive(i){if(this.aliveStub)return this.aliveStub(i);let $=this.syncHandler(["ps","-p",String(i),"-o","state="]);if(($.exitCode??0)!==0)return!1;let n=($.stdout??"").trim();if(!n)return!1;return!n.startsWith("Z")}listProcessesContaining(i){if(this.listStub)return this.listStub(i);return[]}getStartTime(i){if(this.startTimeStub)return this.startTimeStub(i);return null}}var cW=(i={})=>({version:qi,channels:[],profiles:[],...i});class L_ extends nn{state;constructor(i){super();this.state=cW(i)}read(){return this.state}write(i){this.state=i}update(i){return i(this.state)}}class T_ extends rn{current;constructor(i={}){super();this.current=i.start??new Date(0)}now(){return new Date(this.current.getTime())}set(i){this.current=i}advance(i){this.current=new Date(this.current.getTime()+i)}}class Z_ extends Uv{calls=[];handler=()=>({status:200,body:""});on(i){return this.handler=i,this}async fetch(i){this.calls.push(i);let $=await this.handler(i),n=$.status??200,g=$.body??"";return{status:n,ok:n>=200&&n<300,text:async()=>g,json:async()=>JSON.parse(g)}}}class q_ extends Un{answers;asked=[];constructor(i={}){super();this.answers=new Map(Object.entries(i.answers??{}))}async promptSecret(i){this.asked.push(i);let $=this.answers.get(i);if($===void 0)throw Error(`no answer seeded for prompt "${i}"`);return $}}var CW=["started","connected","disconnected","auth-failed","stopped","error"],A7=D.object({event_id:D.string(),type:D.string(),connector_id:D.string().nullable(),channel_id:D.string().nullable(),payload:D.string()}),B7=D.object({event_id:D.string(),type:D.string(),connector_id:D.string().nullable(),channel_id:D.string().nullable(),outcome:D.string(),payload:D.string()}),tk=D.object({type:D.string(),connector_id:D.string().nullable(),channel_id:D.string().nullable(),status:D.enum(CW),detail:D.string()});class _n{}class N_ extends _n{now;raws=[];processeds=[];connections=[];constructor(i=()=>Date.now()){super();this.now=i;Object.freeze(this)}recordRaw(i){this.raws.push({...i,seq:this.raws.length+1,ts:this.now()})}recordProcessed(i){this.processeds.push({...i,seq:this.processeds.length+1,ts:this.now()})}recordConnection(i){this.connections.push({...i,seq:this.connections.length+1,ts:this.now()})}queryRaw(i){let $=this.raws.filter((n)=>{if(!M_(n,i))return!1;if(i.eventId!==void 0&&n.eventId!==i.eventId)return!1;return!0});return x_($,i.limit)}queryProcessed(i){let $=this.processeds.filter((n)=>{if(!M_(n,i))return!1;if(i.eventId!==void 0&&n.eventId!==i.eventId)return!1;if(i.outcome!==void 0&&n.outcome!==i.outcome)return!1;if(i.outcomePrefix!==void 0&&!n.outcome.startsWith(i.outcomePrefix))return!1;return!0});return x_($,i.limit)}queryConnection(i){let $=this.connections.filter((n)=>{if(!M_(n,i))return!1;if(i.status!==void 0&&n.status!==i.status)return!1;if(i.statuses!==void 0&&!i.statuses.includes(n.status))return!1;return!0});return x_($,i.limit)}clear(){this.raws.length=0,this.processeds.length=0,this.connections.length=0}close(){}}var M_=(i,$)=>{if($.type!==void 0&&i.type!==$.type)return!1;if($.connectorId!==void 0&&i.connectorId!==$.connectorId)return!1;if($.channelId!==void 0&&i.channelId!==$.channelId)return!1;if("seq"in i&&$.seq!==void 0&&i.seq!==$.seq)return!1;return!0},x_=(i,$)=>{if($===void 0)return i;if($<=0)return[];return i.slice(-$)};var ck=D.object({content:D.string().min(1),meta:D.record(D.string(),D.string()).optional(),connector:D.string().min(1).optional(),target:D.string().min(1).optional()}),Ck=D.object({ok:D.literal(!0),offset:D.number().int().nonnegative()});var RW={state:"offline"};class E_{port;isDaemonRunning;getToken;constructor(i){this.port=i.port,this.isDaemonRunning=i.isDaemonRunning,this.getToken=i.getToken??(()=>null),Object.freeze(this)}async publish(i,$){if(!this.isDaemonRunning())return RW;try{let n=`${xi(this.port)}/channels/${encodeURIComponent(i)}/publish`,g=await J$(n,{method:"POST",headers:{...this.authHeaders(),"content-type":"application/json"},body:JSON.stringify($)});if(!g.ok)return{state:"error",reason:await g.text()||`HTTP ${g.status}`};let v=Ck.safeParse(await g.json());if(!v.success)return{state:"error",reason:"malformed daemon response"};return{state:"ok",offset:v.data.offset}}catch(n){return{state:"error",reason:n instanceof Error?n.message:String(n)}}}authHeaders(){let i=this.getToken();return i?{authorization:`Bearer ${i}`}:{}}}import{join as Rk}from"path";import{existsSync as FW}from"fs";import{dirname as oW,resolve as t_}from"path";import{fileURLToPath as mW}from"url";var Jr=()=>{let i=oW(mW(import.meta.url)),$=[t_(i,"./daemon.ts"),t_(i,"./daemon.js"),t_(i,"./gateway/daemon.js")];for(let n of $)if(FW(n))return n;throw Error(`daemon script not found (looked in ${$.join(", ")})`)};var yW=5000,hW=2000,Fk=100,dW=200,aW=new R,pW=new F,eW=new Ni,sW=(i)=>new Promise(($)=>{setTimeout($,i)});class c_{process;fs;clock;dir;pidFile;gatewayLog;tmpDir;port;sleep;constructor(i={}){this.process=i.process??aW,this.fs=i.fs??pW,this.clock=i.clock??eW,this.dir=i.dir??ji,this.tmpDir=i.tmpDir??fi(),this.pidFile=Rk(this.dir,"gateway.pid"),this.gatewayLog=Rk(this.tmpDir,"gateway.log"),this.port=i.port??Mi(),this.sleep=i.sleep??sW,Object.freeze(this)}isRunning(){let i=this.readPid();if(!i)return!1;return this.isProcessAlive(i)}getStatus(){let i=this.readPid(),$=i!==null&&this.isProcessAlive(i);return{running:$,pid:$?i:null,port:this.port}}async start(i={}){if(this.isRunning())return!0;this.fs.mkdirSync(this.tmpDir,{recursive:!0});let $=Jr(),n=this.buildStartCommand($,i);this.process.detach(n,{env:{FUNNEL_DIR:this.dir,FUNNEL_PORT:String(this.port),FUNNEL_TMP_DIR:this.tmpDir},stdoutFile:this.gatewayLog,stderrFile:this.gatewayLog});let g=this.clock.millis()+yW;while(this.clock.millis()<g){if(this.isRunning())return!0;await this.sleep(Fk)}return this.isRunning()}buildStartCommand(i,$={}){let n=`funnel-gateway[${this.dir}]`;if($.caffeinate!==!1&&globalThis.process.platform==="darwin")return["caffeinate","-is","bun",i,n];return["bun",i,n]}async stop(){let i=this.readPid();if(!i)return!0;if(!this.isProcessAlive(i))return this.removePid(),!0;try{this.process.kill(i,"SIGTERM")}catch{return!1}let $=this.clock.millis()+hW;while(this.clock.millis()<$){if(!this.isProcessAlive(i))return this.removePid(),!0;await this.sleep(Fk)}try{this.process.kill(i,"SIGKILL")}catch{}return await this.sleep(dW),this.removePid(),!this.isProcessAlive(i)}async restart(i={}){let $=this.isRunning();if(i.onlyIfRunning&&!$)return{ok:!0,wasRunning:!1,stopped:!1,started:!1};let n=$?await this.stop():!0;if(!n)return{ok:!1,wasRunning:$,stopped:!1,started:!1};let g=await this.start({caffeinate:i.caffeinate});return{ok:g,wasRunning:$,stopped:n,started:g}}getGatewayLog(){return this.gatewayLog}getPort(){return this.port}readPid(){if(!this.fs.existsSync(this.pidFile))return null;try{let i=this.fs.readFileSync(this.pidFile).trim(),$=Number(i);if(!$||$<=0)return null;return $}catch{return null}}removePid(){this.fs.unlink(this.pidFile)}isProcessAlive(i){return this.process.isAlive(i)}}import{existsSync as sV,mkdirSync as iX}from"fs";import{dirname as $X}from"path";import{timingSafeEqual as iV}from"crypto";var Ei=(i)=>{return async($,n)=>{let r=($.req.header("authorization")??"").match(/^Bearer\s+(.+)$/i)?.[1]??"";if(!Pr(r,i.expected))return $.text("unauthorized",401);return await n()}},Pr=(i,$)=>{let n=Buffer.from(i,"utf-8"),g=Buffer.from($,"utf-8"),v=Math.max(n.length,g.length,1),r=Buffer.alloc(v),b=Buffer.alloc(v);return n.copy(r),g.copy(b),iV(r,b)&&n.length===g.length};var C_=(i,$,n)=>{return(g,v)=>{let r=-1;return b(0);async function b(u){if(u<=r)throw Error("next() called multiple times");r=u;let U,I=!1,_;if(i[u])_=i[u][0][0],g.req.routeIndex=u;else _=u===i.length&&v||void 0;if(_)try{U=await _(g,()=>b(u+1))}catch(k){if(k instanceof Error&&$)g.error=k,U=await $(k,g),I=!0;else throw k}else if(g.finalized===!1&&n)U=await n(g);if(U&&(g.finalized===!1||I))g.res=U;return g}}};var si=class extends Error{res;status;constructor(i=500,$){super($?.message,{cause:$?.cause});this.res=$?.res,this.status=i}getResponse(){if(this.res)return new Response(this.res.body,{status:this.status,headers:this.res.headers});return new Response(this.message,{status:this.status})}};var ok=Symbol();var Wr=(i,$)=>{return new Response(i,{headers:{"Content-Type":$.replace(/^[^;]+/,(g)=>g.toLowerCase())}}).formData()};var Vr=(i)=>("headers"in i),yk=async(i,$=Object.create(null))=>{let{all:n=!1,dot:g=!1}=$,b=(Vr(i)?i.headers:i.raw.headers).get("Content-Type")?.split(";")[0].trim().toLowerCase();if(b==="multipart/form-data"||b==="application/x-www-form-urlencoded")return $V(i,{all:n,dot:g});return{}};async function $V(i,$){if(!Vr(i)&&i.bodyCache.formData)return mk(await i.bodyCache.formData,$);let n=Vr(i)?i.headers:i.raw.headers,g=await i.arrayBuffer(),v=Wr(g,n.get("Content-Type")||"");if(!Vr(i))i.bodyCache.formData=v;let r=await v;if(r)return mk(r,$);return{}}function mk(i,$){let n=Object.create(null);if(i.forEach((g,v)=>{if(!($.all||v.endsWith("[]")))n[v]=g;else vV(n,v,g)}),$.dot)Object.entries(n).forEach(([g,v])=>{if(g.includes("."))nV(n,g,v),delete n[g]});return n}var vV=(i,$,n)=>{if(i[$]!==void 0)if(Array.isArray(i[$]))i[$].push(n);else i[$]=[i[$],n];else if(!$.endsWith("[]"))i[$]=n;else i[$]=[n]},nV=(i,$,n)=>{if(/(?:^|\.)__proto__\./.test($))return;let g=i,v=$.split(".");v.forEach((r,b)=>{if(b===v.length-1)g[r]=n;else{if(!g[r]||typeof g[r]!=="object"||Array.isArray(g[r])||g[r]instanceof File)g[r]=Object.create(null);g=g[r]}})};var hk=(i)=>$v(i,gn),dk=class{raw;#i;#$;routeIndex=0;path;bodyCache={};constructor(i,$="/",n=[[]]){this.raw=i,this.path=$,this.#$=n,this.#i={}}param(i){return i?this.#v(i):this.#r()}#v(i){let $=this.#$[0][this.routeIndex][1][i],n=this.#g($);return n&&/\%/.test(n)?hk(n):n}#r(){let i={},$=Object.keys(this.#$[0][this.routeIndex][1]);for(let n of $){let g=this.#g(this.#$[0][this.routeIndex][1][n]);if(g!==void 0)i[n]=/\%/.test(g)?hk(g):g}return i}#g(i){return this.#$[1]?this.#$[1][i]:i}query(i){return uk(this.url,i)}queries(i){return Uk(this.url,i)}header(i){if(i)return this.raw.headers.get(i)??void 0;let $=Object.create(null);return this.raw.headers.forEach((n,g)=>{$[g]=n}),$}async parseBody(i){return yk(this,i)}#n=(i)=>{let{bodyCache:$,raw:n}=this,g=$[i];if(g)return g;let v=Object.keys($)[0];if(v)return $[v].then((r)=>{if(v==="json")r=JSON.stringify(r);return new Response(r)[i]()});return $[i]=n[i]()};json(){return this.#n("text").then((i)=>JSON.parse(i))}text(){return this.#n("text")}arrayBuffer(){return this.#n("arrayBuffer")}bytes(){return this.#n("arrayBuffer").then((i)=>new Uint8Array(i))}blob(){return this.#n("blob")}formData(){return this.#n("formData")}addValidatedData(i,$){this.#i[i]=$}valid(i){return this.#i[i]}get url(){return this.raw.url}get method(){return this.raw.method}get[ok](){return this.#$}get matchedRoutes(){return this.#$[0].map(([[,i]])=>i)}get routePath(){return this.#$[0].map(([[,i]])=>i)[this.routeIndex].path}};var ak={Stringify:1,BeforeStream:2,Stream:3},gV=(i,$)=>{let n=new String(i);return n.isEscaped=!0,n.callbacks=$,n};var R_=async(i,$,n,g,v)=>{if(typeof i==="object"&&!(i instanceof String)){if(!(i instanceof Promise))i=i.toString();if(i instanceof Promise)i=await i}let r=i.callbacks;if(!r?.length)return Promise.resolve(i);if(v)v[0]+=i;else v=[i];let b=Promise.all(r.map((u)=>u({phase:$,buffer:v,context:g}))).then((u)=>Promise.all(u.filter(Boolean).map((U)=>R_(U,$,!1,g,v))).then(()=>v[0]));if(n)return gV(await b,r);else return b};var rV="text/plain; charset=UTF-8",F_=(i,$)=>{return{"Content-Type":i,...$}},Dn=(i,$)=>new Response(i,$),o_=class{#i;#$;env={};#v;finalized=!1;error;#r;#g;#n;#_;#U;#I;#u;#D;#k;constructor(i,$){if(this.#i=i,$)this.#g=$.executionCtx,this.env=$.env,this.#I=$.notFoundHandler,this.#k=$.path,this.#D=$.matchResult}get req(){return this.#$??=new dk(this.#i,this.#k,this.#D),this.#$}get event(){if(this.#g&&"respondWith"in this.#g)return this.#g;else throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#g)return this.#g;else throw Error("This context has no ExecutionContext")}get res(){return this.#n||=Dn(null,{headers:this.#u??=new Headers})}set res(i){if(this.#n&&i){i=Dn(i.body,i);for(let[$,n]of this.#n.headers.entries()){if($==="content-type")continue;if($==="set-cookie"){let g=this.#n.headers.getSetCookie();i.headers.delete("set-cookie");for(let v of g)i.headers.append("set-cookie",v)}else i.headers.set($,n)}}this.#n=i,this.finalized=!0}render=(...i)=>{return this.#U??=($)=>this.html($),this.#U(...i)};setLayout=(i)=>this.#_=i;getLayout=()=>this.#_;setRenderer=(i)=>{this.#U=i};header=(i,$,n)=>{if(this.finalized)this.#n=Dn(this.#n.body,this.#n);let g=this.#n?this.#n.headers:this.#u??=new Headers;if($===void 0)g.delete(i);else if(n?.append)g.append(i,$);else g.set(i,$)};status=(i)=>{this.#r=i};set=(i,$)=>{this.#v??=new Map,this.#v.set(i,$)};get=(i)=>{return this.#v?this.#v.get(i):void 0};get var(){if(!this.#v)return{};return Object.fromEntries(this.#v)}#b(i,$,n){let g=this.#n?new Headers(this.#n.headers):this.#u??new Headers;if(typeof $==="object"&&"headers"in $){let r=$.headers instanceof Headers?$.headers:new Headers($.headers);for(let[b,u]of r)if(b.toLowerCase()==="set-cookie")g.append(b,u);else g.set(b,u)}if(n)for(let[r,b]of Object.entries(n))if(typeof b==="string")g.set(r,b);else{g.delete(r);for(let u of b)g.append(r,u)}let v=typeof $==="number"?$:$?.status??this.#r;return Dn(i,{status:v,headers:g})}newResponse=(...i)=>this.#b(...i);body=(i,$,n)=>this.#b(i,$,n);text=(i,$,n)=>{return!this.#u&&!this.#r&&!$&&!n&&!this.finalized?new Response(i):this.#b(i,$,F_(rV,n))};json=(i,$,n)=>{return this.#b(JSON.stringify(i),$,F_("application/json",n))};html=(i,$,n)=>{let g=(v)=>this.#b(v,$,F_("text/html; charset=UTF-8",n));return typeof i==="object"?R_(i,ak.Stringify,!1,{}).then(g):g(i)};redirect=(i,$)=>{let n=String(i);return this.header("Location",!/[^\x00-\xFF]/.test(n)?n:encodeURI(n)),this.newResponse(null,$??302)};notFound=()=>{return this.#I??=()=>Dn(),this.#I(this)}};var x="ALL",pk="all",ek=["get","post","put","delete","options","patch"],Xr="Can not add a route since the matcher is already built.",fr=class extends Error{};var sk="__COMPOSED_HANDLER";var bV=(i)=>{return i.text("404 Not Found",404)},i2=(i,$)=>{if("getResponse"in i){let n=i.getResponse();return $.newResponse(n.body,n)}return console.error(i),$.text("Internal Server Error",500)},$2=class i{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#i="/";routes=[];constructor($={}){[...ek,pk].forEach((r)=>{this[r]=(b,...u)=>{if(typeof b==="string")this.#i=b;else this.#r(r,this.#i,b);return u.forEach((U)=>{this.#r(r,this.#i,U)}),this}}),this.on=(r,b,...u)=>{for(let U of[b].flat()){this.#i=U;for(let I of[r].flat())u.map((_)=>{this.#r(I.toUpperCase(),this.#i,_)})}return this},this.use=(r,...b)=>{if(typeof r==="string")this.#i=r;else this.#i="*",b.unshift(r);return b.forEach((u)=>{this.#r(x,this.#i,u)}),this};let{strict:g,...v}=$;Object.assign(this,v),this.getPath=g??!0?$.getPath??r_:rk}#$(){let $=new i({router:this.router,getPath:this.getPath});return $.errorHandler=this.errorHandler,$.#v=this.#v,$.routes=this.routes,$}#v=bV;errorHandler=i2;route($,n){let g=this.basePath($);return n.routes.map((v)=>{let r;if(n.errorHandler===i2)r=v.handler;else r=async(b,u)=>(await C_([],n.errorHandler)(b,()=>v.handler(b,u))).res,r[sk]=v.handler;g.#r(v.method,v.path,r,v.basePath)}),this}basePath($){let n=this.#$();return n._basePath=ei(this._basePath,$),n}onError=($)=>{return this.errorHandler=$,this};notFound=($)=>{return this.#v=$,this};mount($,n,g){let v,r;if(g)if(typeof g==="function")r=g;else if(r=g.optionHandler,g.replaceRequest===!1)v=(U)=>U;else v=g.replaceRequest;let b=r?(U)=>{let I=r(U);return Array.isArray(I)?I:[I]}:(U)=>{let I=void 0;try{I=U.executionCtx}catch{}return[U.env,I]};v||=(()=>{let U=ei(this._basePath,$),I=U==="/"?0:U.length;return(_)=>{let k=new URL(_.url);return k.pathname=this.getPath(_).slice(I)||"/",new Request(k,_)}})();let u=async(U,I)=>{let _=await n(v(U.req.raw),...b(U));if(_)return _;await I()};return this.#r(x,ei($,"*"),u),this}#r($,n,g,v){$=$.toUpperCase(),n=ei(this._basePath,n);let r={basePath:v!==void 0?ei(this._basePath,v):this._basePath,path:n,method:$,handler:g};this.router.add($,n,[g,r]),this.routes.push(r)}#g($,n){if($ instanceof Error)return this.errorHandler($,n);throw $}#n($,n,g,v){if(v==="HEAD")return(async()=>new Response(null,await this.#n($,n,g,"GET")))();let r=this.getPath($,{env:g}),b=this.router.match(v,r),u=new o_($,{path:r,matchResult:b,env:g,executionCtx:n,notFoundHandler:this.#v});if(b[0].length===1){let I;try{I=b[0][0][0][0](u,async()=>{u.res=await this.#v(u)})}catch(_){return this.#g(_,u)}return I instanceof Promise?I.then((_)=>_||(u.finalized?u.res:this.#v(u))).catch((_)=>this.#g(_,u)):I??this.#v(u)}let U=C_(b[0],this.errorHandler,this.#v);return(async()=>{try{let I=await U(u);if(!I.finalized)throw Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return I.res}catch(I){return this.#g(I,u)}})()}fetch=($,...n)=>{return this.#n($,n[1],n[0],$.method)};request=($,n,g,v)=>{if($ instanceof Request)return this.fetch(n?new Request($,n):$,g,v);return $=$.toString(),this.fetch(new Request(/^https?:\/\//.test($)?$:`http://localhost${ei("/",$)}`,n),g,v)};fire=()=>{addEventListener("fetch",($)=>{$.respondWith(this.#n($.request,$,void 0,$.request.method))})}};var kn=[];function Qr(i,$){let n=this.buildAllMatchers(),g=(v,r)=>{let b=n[v]||n[x],u=b[2][r];if(u)return u;let U=r.match(b[0]);if(!U)return[[],kn];let I=U.indexOf("",1);return[b[1][I],U]};return this.match=g,g(i,$)}var Kr="[^/]+",wn=".*",jn="(?:|/.*)",W$=Symbol(),uV=new Set(".\\+*[^]$()");function UV(i,$){if(i.length===1)return $.length===1?i<$?-1:1:-1;if($.length===1)return 1;if(i===wn||i===jn)return 1;else if($===wn||$===jn)return-1;if(i===Kr)return 1;else if($===Kr)return-1;return i.length===$.length?i<$?-1:1:$.length-i.length}var v2=class i{#i;#$;#v=Object.create(null);insert($,n,g,v,r){if($.length===0){if(this.#i!==void 0)throw W$;if(r)return;this.#i=n;return}let[b,...u]=$,U=b==="*"?u.length===0?["","",wn]:["","",Kr]:b==="/*"?["","",jn]:b.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),I;if(U){let _=U[1],k=U[2]||Kr;if(_&&U[2]){if(k===".*")throw W$;if(k=k.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(k))throw W$}if(I=this.#v[k],!I){if(Object.keys(this.#v).some((O)=>O!==wn&&O!==jn))throw W$;if(r)return;if(I=this.#v[k]=new i,_!=="")I.#$=v.varIndex++}if(!r&&_!=="")g.push([_,I.#$])}else if(I=this.#v[b],!I){if(Object.keys(this.#v).some((_)=>_.length>1&&_!==wn&&_!==jn))throw W$;if(r)return;I=this.#v[b]=new i}I.insert(u,n,g,v,r)}buildRegExpStr(){let n=Object.keys(this.#v).sort(UV).map((g)=>{let v=this.#v[g];return(typeof v.#$==="number"?`(${g})@${v.#$}`:uV.has(g)?`\\${g}`:g)+v.buildRegExpStr()});if(typeof this.#i==="number")n.unshift(`#${this.#i}`);if(n.length===0)return"";if(n.length===1)return n[0];return"(?:"+n.join("|")+")"}};var n2=class{#i={varIndex:0};#$=new v2;insert(i,$,n){let g=[],v=[];for(let b=0;;){let u=!1;if(i=i.replace(/\{[^}]+\}/g,(U)=>{let I=`@\\${b}`;return v[b]=[I,U],b++,u=!0,I}),!u)break}let r=i.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let b=v.length-1;b>=0;b--){let[u]=v[b];for(let U=r.length-1;U>=0;U--)if(r[U].indexOf(u)!==-1){r[U]=r[U].replace(u,v[b][1]);break}}return this.#$.insert(r,$,g,this.#i,n),g}buildRegExp(){let i=this.#$.buildRegExpStr();if(i==="")return[/^$/,[],[]];let $=0,n=[],g=[];return i=i.replace(/#(\d+)|@(\d+)|\.\*\$/g,(v,r,b)=>{if(r!==void 0)return n[++$]=Number(r),"$()";if(b!==void 0)return g[Number(b)]=++$,"";return""}),[new RegExp(`^${i}`),n,g]}};var IV=[/^$/,[],Object.create(null)],g2=Object.create(null);function r2(i){return g2[i]??=new RegExp(i==="*"?"":`^${i.replace(/\/\*$|([.\\+*[^\]$()])/g,($,n)=>n?`\\${n}`:"(?:|/.*)")}$`)}function _V(){g2=Object.create(null)}function DV(i){let $=new n2,n=[];if(i.length===0)return IV;let g=i.map((I)=>[!/\*|\/:/.test(I[0]),...I]).sort(([I,_],[k,O])=>I?1:k?-1:_.length-O.length),v=Object.create(null);for(let I=0,_=-1,k=g.length;I<k;I++){let[O,J,Q]=g[I];if(O)v[J]=[Q.map(([z])=>[z,Object.create(null)]),kn];else _++;let A;try{A=$.insert(J,_,O)}catch(z){throw z===W$?new fr(J):z}if(O)continue;n[_]=Q.map(([z,B])=>{let Ii=Object.create(null);B-=1;for(;B>=0;B--){let[y,N]=A[B];Ii[y]=N}return[z,Ii]})}let[r,b,u]=$.buildRegExp();for(let I=0,_=n.length;I<_;I++)for(let k=0,O=n[I].length;k<O;k++){let J=n[I][k]?.[1];if(!J)continue;let Q=Object.keys(J);for(let A=0,z=Q.length;A<z;A++)J[Q[A]]=u[J[Q[A]]]}let U=[];for(let I in b)U[I]=n[b[I]];return[r,U,v]}function gv(i,$){if(!i)return;for(let n of Object.keys(i).sort((g,v)=>v.length-g.length))if(r2(n).test($))return[...i[n]];return}var Gr=class{name="RegExpRouter";#i;#$;constructor(){this.#i={[x]:Object.create(null)},this.#$={[x]:Object.create(null)}}add(i,$,n){let g=this.#i,v=this.#$;if(!g||!v)throw Error(Xr);if(!g[i])[g,v].forEach((u)=>{u[i]=Object.create(null),Object.keys(u[x]).forEach((U)=>{u[i][U]=[...u[x][U]]})});if($==="/*")$="*";let r=($.match(/\/:/g)||[]).length;if(/\*$/.test($)){let u=r2($);if(i===x)Object.keys(g).forEach((U)=>{g[U][$]||=gv(g[U],$)||gv(g[x],$)||[]});else g[i][$]||=gv(g[i],$)||gv(g[x],$)||[];Object.keys(g).forEach((U)=>{if(i===x||i===U)Object.keys(g[U]).forEach((I)=>{u.test(I)&&g[U][I].push([n,r])})}),Object.keys(v).forEach((U)=>{if(i===x||i===U)Object.keys(v[U]).forEach((I)=>u.test(I)&&v[U][I].push([n,r]))});return}let b=Ir($)||[$];for(let u=0,U=b.length;u<U;u++){let I=b[u];Object.keys(v).forEach((_)=>{if(i===x||i===_)v[_][I]||=[...gv(g[_],I)||gv(g[x],I)||[]],v[_][I].push([n,r-U+u+1])})}}match=Qr;buildAllMatchers(){let i=Object.create(null);return Object.keys(this.#$).concat(Object.keys(this.#i)).forEach(($)=>{i[$]||=this.#v($)}),this.#i=this.#$=void 0,_V(),i}#v(i){let $=[],n=i===x;if([this.#i,this.#$].forEach((g)=>{let v=g[i]?Object.keys(g[i]).map((r)=>[r,g[i][r]]):[];if(v.length!==0)n||=!0,$.push(...v);else if(i!==x)$.push(...Object.keys(g[x]).map((r)=>[r,g[x][r]]))}),!n)return null;else return DV($)}};var kV=class{name="PreparedRegExpRouter";#i;#$;constructor(i,$){this.#i=i,this.#$=$}#v(i,$){let n=this.#i[i];n[1].forEach((g)=>g&&g.push($)),Object.values(n[2]).forEach((g)=>g[0].push($))}#r(i,$,n,g,v){let r=this.#i[i];if(!v)r[2][$][0].push([n,{}]);else g.forEach((b)=>{if(typeof b==="number")r[1][b].push([n,v]);else r[2][b||$][0].push([n,v])})}add(i,$,n){if(!this.#i[i]){let v=this.#i[x],r={};for(let b in v[2])r[b]=[v[2][b][0].slice(),kn];this.#i[i]=[v[0],v[1].map((b)=>Array.isArray(b)?b.slice():0),r]}if($==="/*"||$==="*"){let v=[n,{}];if(i===x)for(let r in this.#i)this.#v(r,v);else this.#v(i,v);return}let g=this.#$[$];if(!g)throw Error(`Path ${$} is not registered`);for(let[v,r]of g)if(i===x)for(let b in this.#i)this.#r(b,$,n,v,r);else this.#r(i,$,n,v,r)}buildAllMatchers(){return this.#i}match=Qr};var m_=class{name="SmartRouter";#i=[];#$=[];constructor(i){this.#i=i.routers}add(i,$,n){if(!this.#$)throw Error(Xr);this.#$.push([i,$,n])}match(i,$){if(!this.#$)throw Error("Fatal error");let n=this.#i,g=this.#$,v=n.length,r=0,b;for(;r<v;r++){let u=n[r];try{for(let U=0,I=g.length;U<I;U++)u.add(...g[U]);b=u.match(i,$)}catch(U){if(U instanceof fr)continue;throw U}this.match=u.match.bind(u),this.#i=[u],this.#$=void 0;break}if(r===v)throw Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,b}get activeRouter(){if(this.#$||this.#i.length!==1)throw Error("No active router has been determined yet.");return this.#i[0]}};var On=Object.create(null),wV=(i)=>{for(let $ in i)return!0;return!1},b2=class i{#i;#$;#v;#r=0;#g=On;constructor($,n,g){if(this.#$=g||Object.create(null),this.#i=[],$&&n){let v=Object.create(null);v[$]={handler:n,possibleKeys:[],score:0},this.#i=[v]}this.#v=[]}insert($,n,g){this.#r=++this.#r;let v=this,r=nk(n),b=[];for(let u=0,U=r.length;u<U;u++){let I=r[u],_=r[u+1],k=gk(I,_),O=Array.isArray(k)?k[0]:I;if(O in v.#$){if(v=v.#$[O],k)b.push(k[1]);continue}if(v.#$[O]=new i,k)v.#v.push(k),b.push(k[1]);v=v.#$[O]}return v.#i.push({[$]:{handler:g,possibleKeys:b.filter((u,U,I)=>I.indexOf(u)===U),score:this.#r}}),v}#n($,n,g,v,r){for(let b=0,u=n.#i.length;b<u;b++){let U=n.#i[b],I=U[g]||U[x],_={};if(I!==void 0){if(I.params=Object.create(null),$.push(I),v!==On||r&&r!==On)for(let k=0,O=I.possibleKeys.length;k<O;k++){let J=I.possibleKeys[k],Q=_[I.score];I.params[J]=r?.[J]&&!Q?r[J]:v[J]??r?.[J],_[I.score]=!0}}}}search($,n){let g=[];this.#g=On;let r=[this],b=g_(n),u=[],U=b.length,I=null;for(let _=0;_<U;_++){let k=b[_],O=_===U-1,J=[];for(let A=0,z=r.length;A<z;A++){let B=r[A],Ii=B.#$[k];if(Ii)if(Ii.#g=B.#g,O){if(Ii.#$["*"])this.#n(g,Ii.#$["*"],$,B.#g);this.#n(g,Ii,$,B.#g)}else J.push(Ii);for(let y=0,N=B.#v.length;y<N;y++){let C=B.#v[y],ui=B.#g===On?{}:{...B.#g};if(C==="*"){let i$=B.#$["*"];if(i$)this.#n(g,i$,$,B.#g),i$.#g=ui,J.push(i$);continue}let[Wn,Vn,bv]=C;if(!k&&!(bv instanceof RegExp))continue;let _i=B.#$[Wn];if(bv instanceof RegExp){if(I===null){I=Array(U);let fn=n[0]==="/"?1:0;for(let uv=0;uv<U;uv++)I[uv]=fn,fn+=b[uv].length+1}let i$=n.substring(I[_]),Xn=bv.exec(i$);if(Xn){if(ui[Vn]=Xn[0],this.#n(g,_i,$,B.#g,ui),Xn[0].length===i$.length&&_i.#$["*"])this.#n(g,_i.#$["*"],$,B.#g,ui);if(wV(_i.#$)){_i.#g=ui;let fn=Xn[0].match(/\//)?.length??0;(u[fn]||=[]).push(_i)}continue}}if(bv===!0||bv.test(k))if(ui[Vn]=k,O){if(this.#n(g,_i,$,ui,B.#g),_i.#$["*"])this.#n(g,_i.#$["*"],$,ui,B.#g)}else _i.#g=ui,J.push(_i)}}let Q=u.shift();r=Q?J.concat(Q):J}if(g.length>1)g.sort((_,k)=>{return _.score-k.score});return[g.map(({handler:_,params:k})=>[_,k])]}};var y_=class{name="TrieRouter";#i;constructor(){this.#i=new b2}add(i,$,n){let g=Ir($);if(g){for(let v=0,r=g.length;v<r;v++)this.#i.insert(i,g[v],n);return}this.#i.insert(i,$,n)}match(i,$){return this.#i.search(i,$)}};var Jn=class extends $2{constructor(i={}){super(i);this.router=i.router??new m_({routers:[new Gr,new y_]})}};var jV=class{initApp;#i;constructor(i){this.initApp=i?.initApp,this.#i=i?.defaultAppOptions}createApp=(i)=>{let $=new Jn(i&&this.#i?{...this.#i,...i}:i??this.#i);if(this.initApp)this.initApp($);return $};createMiddleware=(i)=>i;createHandlers=(...i)=>{return i.filter(($)=>$!==void 0)}},u2=(i)=>new jV(i);var c=u2();var U2=(i)=>{let $=Buffer.byteLength(i.content,"utf-8");if(i.meta)for(let[n,g]of Object.entries(i.meta))$+=Buffer.byteLength(n,"utf-8")+Buffer.byteLength(g,"utf-8");return $},OV=1048576,JV=200,PV=4194304,WV=()=>{};class h_{clients=new Map;subscribers=new Set;logger;onError;maxBufferedBytes;now;replayBufferSize;replayBufferMaxBytes;replayBuffer=[];persistentReplay;exclusiveCursor=new Map;replayBufferBytes=0;eventsBroadcast=0;droppedSlowClients=0;lastBroadcastAt=null;latestOffset=0;constructor(i={}){this.logger=i.logger,this.onError=i.onError??WV,this.maxBufferedBytes=i.maxBufferedBytes??OV,this.now=i.now??(()=>Date.now()),this.replayBufferSize=Math.max(0,i.replayBufferSize??JV),this.replayBufferMaxBytes=Math.max(0,i.replayBufferMaxBytes??PV),this.persistentReplay=i.persistentReplay??null}getMetrics(){return{clients:this.clients.size,subscribers:this.subscribers.size,eventsBroadcast:this.eventsBroadcast,droppedSlowClients:this.droppedSlowClients,lastBroadcastAt:this.lastBroadcastAt?new Date(this.lastBroadcastAt).toISOString():null,latestOffset:this.latestOffset,oldestReplayableOffset:this.replayBuffer[0]?.offset??null}}replaySince(i,$){let n=this.replayBuffer[0]?.offset,g=this.persistentReplay&&(n===void 0||i<n-1),v=this.replayBuffer.filter((U)=>U.offset>i&&this.matchesClient(U,$));if(!g)return v;let r=this.persistentReplay?this.persistentReplay.loadSince(i).filter((U)=>this.matchesClient(U,$)):[],b=n??Number.POSITIVE_INFINITY;return[...r.filter((U)=>U.offset<b),...v]}matchesClient(i,$){let n=i.meta?.target;if(n&&n!==$.subscriberId)return!1;let g=i.meta?.channelId;if(g&&g!==$.channel)return!1;let v=i.meta?.connector;if(!v)return!0;return $.connectors.includes(v)}pickRecipients(i){let $=new Map,n=[];for(let[g,v]of this.clients){if(!this.matchesClient(i,v))continue;if(v.delivery==="exclusive"){let r=$.get(v.channel)??[];r.push(g),$.set(v.channel,r);continue}n.push(g)}for(let[g,v]of $){if(v.length===0)continue;let r=this.exclusiveCursor.get(g)??0,b=v[r%v.length];if(b)n.push(b);this.exclusiveCursor.set(g,r+1)}return n}addClient(i,$){this.clients.set(i,$)}removeClient(i){this.clients.delete(i)}getClientCount(){return this.clients.size}listChannels(){return[...this.clients.values()].map((i)=>({...i}))}subscribe(i){return this.subscribers.add(i),()=>{this.subscribers.delete(i)}}broadcast(i,$){this.latestOffset+=1;let n={content:i,meta:$,offset:this.latestOffset},g=JSON.stringify(n);if(this.eventsBroadcast+=1,this.lastBroadcastAt=this.now(),this.replayBufferSize>0){let r=U2(n);this.replayBuffer.push(n),this.replayBufferBytes+=r;while((this.replayBuffer.length>this.replayBufferSize||this.replayBufferBytes>this.replayBufferMaxBytes)&&this.replayBuffer.length>0){let b=this.replayBuffer.shift();if(b)this.replayBufferBytes-=U2(b)}}let v=this.pickRecipients(n);for(let r of v){let b=r.getBufferedAmount();if(b>this.maxBufferedBytes){let u=this.clients.get(r);this.logger?.warn("dropping slow WS client (backpressure)",{channel:u?.channel,buffered:b,max:this.maxBufferedBytes});try{r.close(1009,"backpressure")}catch{}this.clients.delete(r),this.droppedSlowClients+=1;continue}try{r.send(g)}catch(u){let U=u instanceof Error?u:Error(String(u)),I=this.clients.get(r);this.logger?.warn("ws.send failed; dropping client",{channel:I?.channel,error:U.message}),this.clients.delete(r)}}for(let r of this.subscribers){let b=(u)=>{let U=u instanceof Error?u:Error(String(u));this.logger?.error("broadcast subscriber threw",{error:U.message}),this.onError(U,{component:"broadcaster.subscriber",offset:n.offset,connector:n.meta?.connector??null,channel:n.meta?.channel??null})};try{let u=r(n);if(u instanceof Promise)u.catch(b)}catch(u){b(u)}}return n}seedLatestOffset(i){if(i>this.latestOffset)this.latestOffset=i}}var H3=D.object({type:D.string(),content:D.string(),channel_id:D.string().nullable(),connector_id:D.string().nullable(),meta:D.record(D.string(),D.string()).nullable()});class d_{}import{Database as VV}from"bun:sqlite";import{existsSync as XV,mkdirSync as fV}from"fs";import{dirname as QV}from"path";var KV=/^[a-z_][a-z0-9_]*$/,GV=500,YV=new Set(["seq","ts","type","event"]),I2=[["CREATE TABLE IF NOT EXISTS logs (seq INTEGER PRIMARY KEY, ts INTEGER NOT NULL, type TEXT, event TEXT NOT NULL)","CREATE INDEX IF NOT EXISTS idx_logs_ts ON logs (ts)","CREATE INDEX IF NOT EXISTS idx_logs_type ON logs (type)"],["DROP TABLE IF EXISTS leuco_log","CREATE TABLE IF NOT EXISTS logs (seq INTEGER PRIMARY KEY, ts INTEGER NOT NULL, type TEXT, event TEXT NOT NULL)","CREATE INDEX IF NOT EXISTS idx_logs_ts ON logs (ts)","CREATE INDEX IF NOT EXISTS idx_logs_type ON logs (type)"]];class V${db;maxRows;maxAgeMs;maxBytes;targetBytes;now;indexes;extractIndexes;insertStmt;insertWithSeqStmt;maxSeqStmt;countStmt;trimRowsStmt;trimAgeStmt;trimOldestStmt;insertsSinceByteCheck=0;constructor(i){if(i.path!==":memory:"){let r=QV(i.path);if(!XV(r))fV(r,{recursive:!0})}if(this.db=new VV(i.path),this.db.run("PRAGMA journal_mode = WAL"),this.migrate(),this.maxRows=i.maxRows??null,this.maxAgeMs=i.maxAgeMs??null,this.maxBytes=i.maxBytes??null,this.targetBytes=i.targetBytes??(i.maxBytes!==void 0?Math.floor(i.maxBytes/4):null),this.now=i.now??(()=>Date.now()),this.indexes=i.indexes??[],this.indexes.length>0)zV(this.indexes),this.extractIndexes=i.extractIndexes??null,this.syncIndexColumns();else this.extractIndexes=null;let $=["ts","type","event",...this.indexes],n=$.map(()=>"?").join(", ");this.insertStmt=this.db.prepare(`INSERT INTO logs (${$.join(", ")}) VALUES (${n})`);let g=["seq",...$],v=g.map(()=>"?").join(", ");this.insertWithSeqStmt=this.db.prepare(`INSERT INTO logs (${g.join(", ")}) VALUES (${v})`),this.maxSeqStmt=this.db.prepare("SELECT COALESCE(MAX(seq), 0) AS max FROM logs"),this.countStmt=this.db.prepare("SELECT COUNT(*) AS n FROM logs"),this.trimRowsStmt=this.db.prepare("DELETE FROM logs WHERE seq <= (SELECT seq FROM logs ORDER BY seq DESC LIMIT 1 OFFSET ?)"),this.trimAgeStmt=this.db.prepare("DELETE FROM logs WHERE ts < ?"),this.trimOldestStmt=this.db.prepare("DELETE FROM logs WHERE seq IN (SELECT seq FROM logs ORDER BY seq ASC LIMIT ?)")}insert(i){try{let $=this.buildInsertParams(i.ts,i.event),n=this.insertStmt.run(...$),g=Number(n.lastInsertRowid);return this.trim(),{seq:g,ts:i.ts,event:i.event}}catch($){return $ instanceof Error?$:Error(String($))}}insertMany(i){if(i.length===0)return[];try{let $=[];return this.db.transaction((g)=>{for(let v of g){let r=this.buildInsertParams(v.ts,v.event),b=this.insertStmt.run(...r);$.push({seq:Number(b.lastInsertRowid),ts:v.ts,event:v.event})}})(i),this.trim(),$}catch($){return $ instanceof Error?$:Error(String($))}}write(i){try{let $=[i.seq,...this.buildInsertParams(i.ts,i.event)];this.insertWithSeqStmt.run(...$),this.trim()}catch($){return $ instanceof Error?$:Error(String($))}}getMaxSeq(){let i=this.maxSeqStmt.get();return i?i.max:0}query(i={}){let $=[],n=[];if(i.seq!==void 0)$.push("seq = ?"),n.push(i.seq);else $.push("seq > ?"),n.push(i.sinceSeq??0);if(typeof i.type==="string")$.push("type = ?"),n.push(i.type);if(i.where)this.appendWhereConditions(i.where,$,n);if(i.wherePrefix)this.appendPrefixConditions(i.wherePrefix,$,n);if(i.whereIn)this.appendSetConditions(i.whereIn,$,n);let g=i.limit??1000;n.push(g);let v=i.order==="desc"?"DESC":"ASC",r=`SELECT seq, ts, type, event FROM logs WHERE ${$.join(" AND ")} ORDER BY seq ${v} LIMIT ?`,u=this.db.prepare(r).all(...n);if(v==="DESC")u.reverse();return u.map(AV)}getSchemaVersion(){return this.db.prepare("PRAGMA user_version").get()?.user_version??0}close(){this.db.close()}buildInsertParams(i,$){let n=SV($),g=JSON.stringify($);if(this.indexes.length===0)return[i,n,g];let v=this.extractIndexes?this.extractIndexes($):null,r=this.indexes.map((b)=>v?.[b]??null);return[i,n,g,...r]}appendWhereConditions(i,$,n){for(let g of this.indexKeys()){let v=i[g];if(v===void 0)continue;if(v===null)$.push(`${g} IS NULL`);else $.push(`${g} = ?`),n.push(v)}}appendPrefixConditions(i,$,n){for(let g of this.indexKeys()){let v=i[g];if(v===void 0)continue;$.push(`${g} LIKE ? ESCAPE '\\'`),n.push(`${HV(v)}%`)}}appendSetConditions(i,$,n){for(let g of this.indexKeys()){let v=i[g];if(v===void 0)continue;if(v.length===0){$.push("1 = 0");continue}let r=v.filter((U)=>U!==null),b=r.length!==v.length,u=[];if(r.length>0)u.push(`${g} IN (${r.map(()=>"?").join(", ")})`),n.push(...r);if(b)u.push(`${g} IS NULL`);$.push(`(${u.join(" OR ")})`)}}trim(){if(this.maxRows!==null){let i=this.countStmt.get();if(i&&i.n>this.maxRows)this.trimRowsStmt.run(this.maxRows)}if(this.maxAgeMs!==null)this.trimAgeStmt.run(this.now()-this.maxAgeMs);this.maybeTrimBytes()}indexKeys(){return this.indexes}maybeTrimBytes(){if(this.maxBytes===null||this.targetBytes===null)return;if(this.insertsSinceByteCheck+=1,this.insertsSinceByteCheck<GV)return;this.insertsSinceByteCheck=0;let i=this.byteSize();if(i<=this.maxBytes)return;let $=this.countStmt.get()?.n??0;if($===0)return;let n=i-this.targetBytes,g=i/$,v=Math.min($,Math.ceil(n/g));this.trimOldestStmt.run(v),this.db.run("VACUUM")}byteSize(){let i=this.db.prepare("PRAGMA page_count").get()?.n??0,$=this.db.prepare("PRAGMA page_size").get()?.n??0;return i*$}clear(){this.db.run("DELETE FROM logs"),this.db.run("VACUUM"),this.insertsSinceByteCheck=0}syncIndexColumns(){let i=new Set(this.db.prepare("PRAGMA table_info(logs)").all().map(($)=>$.name));for(let $ of this.indexes){if(!i.has($))this.db.run(`ALTER TABLE logs ADD COLUMN ${$} TEXT`);this.db.run(`CREATE INDEX IF NOT EXISTS idx_logs_${$} ON logs (${$})`)}}migrate(){let $=this.db.prepare("PRAGMA user_version").get()?.user_version??0;if($>=I2.length)return;let n=I2.slice($),g=$;for(let v of n)g+=1,this.db.transaction(()=>{for(let b of v)this.db.run(b);this.db.run(`PRAGMA user_version = ${g}`)})()}}function HV(i){return i.replaceAll("\\","\\\\").replaceAll("%","\\%").replaceAll("_","\\_")}function zV(i){for(let $ of i){if(!KV.test($))throw Error(`invalid index column name: ${$}`);if(YV.has($))throw Error(`reserved index column name: ${$}`)}}function SV(i){if(typeof i!=="object"||i===null)return null;if(!("type"in i))return null;let $=i.type;return typeof $==="string"?$:null}function AV(i){return{seq:i.seq,ts:i.ts,event:JSON.parse(i.event)}}var _2=2000;class a_ extends d_{sink;now;logger;onError;constructor(i){super();this.now=i.now??(()=>Date.now()),this.logger=i.logger,this.onError=i.onError,this.sink=new V$({path:i.path,indexes:["channel_id","connector_id"],extractIndexes:($)=>({channel_id:$.channel_id,connector_id:$.connector_id}),now:this.now,...i.maxRows!==void 0?{maxRows:i.maxRows}:{},...i.maxAgeMs!==void 0?{maxAgeMs:i.maxAgeMs}:{},...i.maxBytes!==void 0?{maxBytes:i.maxBytes}:{},...i.targetBytes!==void 0?{targetBytes:i.targetBytes}:{}})}record(i){let $={type:i.meta?.event_type??"unknown",content:BV(i.content),channel_id:i.channelId,connector_id:i.connectorId,meta:i.meta},n=this.sink.write({seq:i.offset,ts:this.now(),event:$});if(n instanceof Error)this.logger?.error("event log write failed",{offset:i.offset,error:n.message}),this.onError?.(n,{component:"sqlite-event-log",op:"record",offset:i.offset,channelId:i.channelId,connectorId:i.connectorId})}loadSince(i){let $=this.sink.query({sinceSeq:i,limit:Number.MAX_SAFE_INTEGER}),n=[];for(let g of $)n.push({content:g.event.content,meta:g.event.meta??void 0,offset:g.seq});return n}loadForChannel(i){let $={channel_id:i.channelId};if(i.connectorId!==void 0)$.connector_id=i.connectorId;let n=this.sink.query({where:$,...i.sinceSeq!==void 0?{sinceSeq:i.sinceSeq}:{},...i.limit!==void 0?{limit:i.limit}:{}}),g=[];for(let v of n)g.push({content:v.event.content,meta:v.event.meta??void 0,offset:v.seq});return g}findMaxOffset(){return this.sink.getMaxSeq()}clear(){this.sink.clear()}close(){this.sink.close()}}function BV(i){if(i.length<=_2)return i;return`${i.slice(0,_2)}...`}var lV=()=>{},LV=30000,TV=60000,ZV=30000,qV=(i)=>new Promise(($)=>{setTimeout($,i)});class ti{channels;notify;logger;onError;running=new Map;failureCounts=new Map;starting=new Set;stats=new Map;healthCheckIntervalMs;maxBackoffMs;startTimeoutMs;sleep;now;healthCheckTimer=null;healthCheckInFlight=!1;pendingRetry=new Map;constructor(i){this.channels=i.channels,this.notify=i.notify,this.logger=i.logger,this.onError=i.onError??lV,this.healthCheckIntervalMs=i.healthCheckIntervalMs??LV,this.maxBackoffMs=i.maxBackoffMs??TV,this.startTimeoutMs=i.startTimeoutMs??ZV,this.sleep=i.sleep??qV,this.now=i.now??(()=>Date.now())}static keyOf(i,$){return`${i}/${$}`}isRunning(i,$){return this.running.has(ti.keyOf(i,$))}list(){return[...this.running.entries()].map(([i,$])=>{let n=this.stats.get(i);return{channelName:$.channelName,channelId:$.channelId,name:$.config.name,type:$.config.type,alive:$.listener.isAlive(),events:n?.events??0,errors:n?.errors??0,failureCount:this.failureCounts.get(i)??0,lastEventAt:n?.lastEventAt??null}})}async start(i,$){let n=ti.keyOf(i,$);if(this.running.has(n))return{ok:!0,reason:"already running"};if(this.starting.has(n))return{ok:!1,reason:"already starting",retriable:!0};this.starting.add(n);try{return await this.startLocked(i,$,n)}finally{this.starting.delete(n)}}async startLocked(i,$,n){let g=this.channels.createListener(i,$);if(!g)return{ok:!1,reason:`connector "${$}" not found in channel "${i}"`};let v=async(r,b)=>{try{await this.notify(i,$,r,b),this.recordEvent(n)}catch(u){throw this.recordError(n),u}};try{return await Promise.race([g.listener.start(v),this.sleep(this.startTimeoutMs).then(()=>{throw Error(`listener start timed out after ${this.startTimeoutMs}ms`)})]),this.running.set(n,{config:g.config,channelName:i,channelId:g.channelId,listener:g.listener}),this.pendingRetry.delete(n),this.ensureStats(n),this.logger?.info(`${g.config.type} listener started`,{channel:i,connector:$}),{ok:!0}}catch(r){let b=r instanceof Error?r:Error(String(r));try{await g.listener.stop()}catch{}this.logger?.error(`${g.config.type} listener failed to start`,{channel:i,connector:$,error:b.message}),this.onError(b,{component:"listener-registry.start",channel:i,connector:$,type:g.config.type});let u=!(b instanceof $n);return{ok:!1,reason:b.message,retriable:u}}}async stop(i,$){let n=ti.keyOf(i,$),g=this.running.get(n);if(!g)return{ok:!0,reason:"not running"};try{return await g.listener.stop(),this.logger?.info(`${g.config.type} listener stopped`,{channel:i,connector:$}),{ok:!0}}catch(v){let r=v instanceof Error?v:Error(String(v));return this.logger?.error(`${g.config.type} listener failed to stop`,{channel:i,connector:$,error:r.message}),this.onError(r,{component:"listener-registry.stop",channel:i,connector:$,type:g.config.type}),{ok:!1,reason:r.message}}finally{this.running.delete(n),this.failureCounts.delete(n)}}async restart(i,$){let n=await this.stop(i,$);if(!n.ok)return n;return await this.start(i,$)}async startAll(){let i=this.channels.listAllConnectors(),$=await Promise.allSettled(i.map((n)=>this.start(n.channelName,n.name)));for(let n=0;n<$.length;n++){let g=$[n],v=i[n];if(g.status==="rejected"){let r=ti.keyOf(v.channelName,v.name);this.pendingRetry.set(r,{channelName:v.channelName,connectorName:v.name});continue}if(g.status==="fulfilled"&&!g.value.ok){if(g.value.retriable===!1)continue;let r=ti.keyOf(v.channelName,v.name);this.pendingRetry.set(r,{channelName:v.channelName,connectorName:v.name})}}this.startHealthCheck()}async stopAll(){this.stopHealthCheck(),this.pendingRetry.clear();for(let[,i]of this.running.entries())await this.stop(i.channelName,i.config.name)}ensureStats(i){let $=this.stats.get(i);if($)return $;let n={events:0,errors:0,failureCount:0,lastEventAt:null};return this.stats.set(i,n),n}recordEvent(i){let $=this.ensureStats(i);$.events+=1,$.lastEventAt=new Date(this.now()).toISOString()}recordError(i){this.ensureStats(i).errors+=1}startHealthCheck(){if(this.healthCheckTimer)return;this.healthCheckTimer=setInterval(()=>{this.runHealthCheck().catch((i)=>{let $=i instanceof Error?i:Error(String(i));this.logger?.error("health check pass failed",{error:$.message}),this.onError($,{component:"listener-registry.health-check"})})},this.healthCheckIntervalMs),this.healthCheckTimer.unref()}stopHealthCheck(){if(!this.healthCheckTimer)return;clearInterval(this.healthCheckTimer),this.healthCheckTimer=null}async runHealthCheckForTest(){await this.runHealthCheck()}async runHealthCheck(){if(this.healthCheckInFlight)return;this.healthCheckInFlight=!0;try{let i=[];for(let[n,g]of this.running.entries()){if(g.listener.isAlive()){this.failureCounts.delete(n);continue}i.push({channelName:g.channelName,connectorName:g.config.name,type:g.config.type})}await Promise.all(i.map((n)=>this.recoverDead(n.channelName,n.connectorName,n.type)));let $=[];for(let[n,g]of this.pendingRetry.entries()){if(this.running.has(n)){this.pendingRetry.delete(n);continue}$.push({key:n,channelName:g.channelName,connectorName:g.connectorName})}await Promise.all($.map((n)=>this.attemptRetry(n)))}finally{this.healthCheckInFlight=!1}}async attemptRetry(i){this.logger?.info("retrying failed listener",{channel:i.channelName,connector:i.connectorName});let $=this.failureCounts.get(i.key)??0,n=Math.min(1000*2**$,this.maxBackoffMs);await this.sleep(n);let g=await this.start(i.channelName,i.connectorName);if(g.ok){this.pendingRetry.delete(i.key),this.failureCounts.delete(i.key);return}if(g.retriable===!1){this.pendingRetry.delete(i.key),this.failureCounts.delete(i.key),this.logger?.warn("dropping listener from retry queue (non-retriable)",{channel:i.channelName,connector:i.connectorName,reason:g.reason});return}this.failureCounts.set(i.key,$+1)}async recoverDead(i,$,n){let g=ti.keyOf(i,$),v=this.failureCounts.get(g)??0,r=Math.min(1000*2**v,this.maxBackoffMs);this.logger?.warn(`${n} listener unhealthy, restarting`,{channel:i,connector:$,attempt:v+1,backoffMs:r}),await this.stop(i,$),await this.sleep(r);let b=await this.start(i,$);if(b.ok)this.failureCounts.delete(g),this.logger?.info(`${n} listener recovered`,{channel:i,connector:$});else if(b.retriable===!1)this.failureCounts.delete(g),this.logger?.warn(`${n} listener cannot recover (non-retriable)`,{channel:i,connector:$,reason:b.reason});else this.failureCounts.set(g,v+1)}}var MV=new R,xV=3000,NV=100,EV=200,tV=(i)=>new Promise(($)=>{setTimeout($,i)}),cV=(i)=>`funnel-gateway[${i}]`,CV=async(i)=>{let $=i.now()+xV;while(i.now()<$){if(i.pids.every((n)=>!i.runner.isAlive(n)))return;await i.sleep(NV)}for(let n of i.pids){if(!i.runner.isAlive(n))continue;try{i.runner.kill(n,"SIGKILL")}catch{}}await i.sleep(EV)},D2=async(i)=>{let $=i.process??MV,n=i.logger,g=cV(i.dir),v=$.listProcessesContaining(g),r=[];for(let b of v){if(b.pid===i.selfPid)continue;$.kill(b.pid,"SIGTERM"),r.push(b.pid),n?.info("killed competing Slack gateway process",{pid:b.pid,args:b.command.slice(0,160)})}if(r.length===0)return r;return await CV({runner:$,pids:r,sleep:i.sleep??tV,now:i.now??(()=>Date.now())}),r};var k2=(i,$,n)=>{let g=i.req.raw.headers.get("Cookie");if(typeof $==="string"){if(!g)return;let r=$;if(n==="secure")r="__Secure-"+$;else if(n==="host")r="__Host-"+$;return b_(g,r)[r]}if(!g)return{};return b_(g)};var RV=/^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/i,FV=/^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/i,oV=/^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/i,p_=(i,$)=>{return async(n,g)=>{let v={},r=n.req.header("Content-Type");switch(i){case"json":if(!r||!RV.test(r))break;try{v=await n.req.json()}catch{throw new si(400,{message:"Malformed JSON in request body"})}break;case"form":{if(!r||!(FV.test(r)||oV.test(r)))break;let u;if(n.req.bodyCache.formData)u=await n.req.bodyCache.formData;else try{let I=await n.req.arrayBuffer();u=await Wr(I,r),n.req.bodyCache.formData=u}catch(I){let _="Malformed FormData request.";throw _+=I instanceof Error?` ${I.message}`:` ${String(I)}`,new si(400,{message:_})}let U=Object.create(null);u.forEach((I,_)=>{if(_.endsWith("[]"))(U[_]??=[]).push(I);else if(Array.isArray(U[_]))U[_].push(I);else if(Object.hasOwn(U,_))U[_]=[U[_],I];else U[_]=I}),v=U;break}case"query":v=Object.fromEntries(Object.entries(n.req.queries()).map(([u,U])=>{return U.length===1?[u,U[0]]:[u,U]}));break;case"param":v=n.req.param();break;case"header":v=n.req.header();break;case"cookie":v=k2(n);break}let b=await $(v,n);if(b instanceof Response)return b;return n.req.addValidatedData(i,b),await g()}};function mV(i,$,n,g){return p_(i,async(v,r)=>{let b=v;if(i==="header"&&"_def"in $||i==="header"&&"_zod"in $){let U=Object.keys("in"in $?$.in.shape:$.shape),I=Object.fromEntries(U.map((_)=>[_.toLowerCase(),_]));b=Object.fromEntries(Object.entries(v).map(([_,k])=>[I[_]||_,k]))}let u=g&&g.validationFunction?await g.validationFunction($,b):await $.safeParseAsync(b);if(n){let U=await n({data:b,...u,target:i},r);if(U){if(U instanceof Response)return U;if("response"in U)return U.response}}if(!u.success)return r.json(u,400);return u.data})}var Yr=mV;var Ki=(i)=>Yr("param",i,($,n)=>{if($.success)return;let g=$.error.issues[0],v=g?`${g.path.join(".")}: ${g.message}`:"invalid request";return n.json({ok:!1,reason:v},400)});var e_=D.lazy(()=>D.union([D.string(),D.number(),D.boolean(),D.null(),D.array(e_),D.record(D.string(),e_)])),yV=D.object({method:D.string().min(1),path:D.string().min(1),body:e_.optional()}),w2=c.createHandlers(Ki(D.object({channel:D.string().min(1),connector:D.string().min(1)})),async(i)=>{let $=i.req.valid("param"),n=null;try{n=await i.req.json()}catch{n=null}let g=yV.safeParse(n);if(!g.success)throw new si(400,{message:g.error.issues[0]?.message??"invalid body"});let v=await i.var.deps.channels.call($.channel,$.connector,{method:g.data.method,path:g.data.path,body:g.data.body});return i.json({ok:!0,result:v})});var j2=c.createHandlers(Ki(D.object({channel:D.string().min(1)})),Yr("json",ck,(i,$)=>{if(i.success)return;let n=i.error.issues[0],g=n?`${n.path.join(".")}: ${n.message}`:"invalid body";return $.json({ok:!1,reason:g},400)}),(i)=>{let $=i.req.valid("param"),n=i.req.valid("json"),g=n.target?{...n.meta,target:n.target}:n.meta,r={ok:!0,offset:i.var.deps.emit({channel:$.channel,connector:n.connector,content:n.content,meta:g}).offset};return i.json(r)});var hV=(i)=>{let n=(i.connectionErrors[i.connectionErrors.length-1]??null)?.detail??null;if(i.connectors.length===0)return{status:"warn",message:"no connectors configured on this channel",nextActions:[`fnl channels ${i.name} connectors add <name> --type=slack ...`],rootCause:null};if(!i.listener)return{status:"error",message:"no listener running for this channel",nextActions:["fnl gateway restart"],rootCause:n};if(!i.listener.alive)return{status:"error",message:"listener is dead",nextActions:["fnl gateway logs","fnl gateway restart"],rootCause:n};if(i.claudeClients===0)return{status:"warn",message:"no Claude connected to this channel",nextActions:[`fnl claude --channel ${i.name}`],rootCause:null};if(i.listener.errors>0)return{status:"warn",message:"listener has errors",nextActions:["fnl gateway logs"],rootCause:n};return{status:"ok",message:"healthy",nextActions:[],rootCause:null}},O2=c.createHandlers(async(i)=>{let $=i.var.deps,n=i.req.query("channel")??null,g=$.channels.list(),v=n?g.filter((I)=>I.name===n||I.id===n):g,r=$.registry.list(),b=$.broadcaster.listChannels(),u=$.broadcaster.getMetrics(),U=v.map((I)=>{let _=r.find((B)=>B.channelName===I.name)??null,k=_?{alive:_.alive,events:_.events,errors:_.errors,lastEventAt:_.lastEventAt}:null,O=b.filter((B)=>B.channel===I.id||B.channel===I.name).length,J=(()=>{if(!$.diagnosticLog)return[];try{return $.diagnosticLog.queryProcessed({channelId:I.id,limit:10}).map(vv)}catch{return[]}})(),Q=k&&(!k.alive||k.errors>0)||!k,A=(()=>{if(!Q||!$.diagnosticLog)return[];try{return $.diagnosticLog.queryConnection({channelId:I.id,statuses:["auth-failed","error"],limit:3}).map(P$)}catch{return[]}})(),z={id:I.id,name:I.name,connectors:I.connectors.map((B)=>B.name),listener:k,claudeClients:O,recentEvents:J,connectionErrors:A};return{...z,diagnosis:hV(z)}});return i.json({pid:$.selfPid,uptimeMs:$.uptimeMs(),eventsBroadcast:u.eventsBroadcast,channels:U})});var J2=c.createHandlers((i)=>{let $=i.var.deps;return i.json({ok:!0,pid:$.selfPid,funnelDir:$.dir,clients:$.broadcaster.getClientCount(),listeners:$.registry.list()})});var P2=c.createHandlers((i)=>{return i.json({listeners:i.var.deps.registry.list()})});var W2=c.createHandlers(Ki(D.object({channel:D.string().min(1),connector:D.string().min(1)})),async(i)=>{let $=i.req.valid("param"),n=await i.var.deps.registry.restart($.channel,$.connector);return i.json(n,n.ok?200:400)});var V2=c.createHandlers(Ki(D.object({channel:D.string().min(1),connector:D.string().min(1)})),async(i)=>{let $=i.req.valid("param"),n=await i.var.deps.registry.start($.channel,$.connector);return i.json(n,n.ok?200:400)});var X2=c.createHandlers(Ki(D.object({channel:D.string().min(1),connector:D.string().min(1)})),async(i)=>{let $=i.req.valid("param"),n=await i.var.deps.registry.stop($.channel,$.connector);return i.json(n,n.ok?200:400)});var f2=c.createHandlers((i)=>{let $=i.var.deps;return i.json({ok:!0,pid:$.selfPid,funnelDir:$.dir,uptimeMs:$.uptimeMs(),clients:$.broadcaster.listChannels(),listeners:$.registry.list(),broadcaster:$.broadcaster.getMetrics()})});function dV(){return c.createApp().onError((i,$)=>{if(i instanceof si)return i.getResponse();let n=i instanceof Error?i.message:String(i);return $.json({error:n},500)}).get("/health",...J2).get("/status",...f2).get("/debug",...O2).get("/listeners",...P2).post("/listeners/:channel/:connector/start",...V2).delete("/listeners/:channel/:connector",...X2).post("/listeners/:channel/:connector/restart",...W2).post("/channels/:channel/connectors/:connector/call",...w2).post("/channels/:channel/publish",...j2)}var Q2=dV();import{createHash as aV,randomUUID as pV}from"crypto";import{join as eV}from"path";function K2(i){let $=i.port===0?pV():String(i.port),n=aV("sha256").update(`${i.funnelDir}\x00${$}`).digest("hex").slice(0,20);return eV(i.tmpDir,"events",`${n}.db`)}var vX="127.0.0.1",nX=new Set(["127.0.0.1","localhost","::1","::ffff:127.0.0.1"]),gX=()=>{};class s_{channels;configuredPort;configuredHostname;dbPath;process;logger;onError;selfPid;dir;killCompetingSlack;token;allowInsecureHost;broadcaster;eventLog;registry;nowMs;extraRoutes;ownsEventLog;diagnosticLog;startedAt=null;server=null;disposed=!1;constructor(i){this.channels=i.channels,this.configuredPort=i.port??Mi(),this.configuredHostname=i.hostname??vX,this.dir=i.dir??ji,this.dbPath=i.dbPath??K2({tmpDir:i.tmpDir??fi(),funnelDir:this.dir,port:this.configuredPort}),this.process=i.process,this.logger=i.logger,this.onError=i.onError??gX,this.selfPid=i.selfPid??globalThis.process.pid,this.killCompetingSlack=i.killCompetingSlack??!0,this.token=i.token??"",this.allowInsecureHost=i.allowInsecureHost??!1,this.extraRoutes=i.extraRoutes??null,this.diagnosticLog=i.diagnosticLog;let $=i.clock;if(this.nowMs=$?()=>$.millis():()=>Date.now(),i.eventLog)this.eventLog=i.eventLog,this.ownsEventLog=!1;else{let n=$X(this.dbPath);if(!sV(n))iX(n,{recursive:!0});this.eventLog=new a_({path:this.dbPath,now:this.nowMs,logger:this.logger,onError:this.onError}),this.ownsEventLog=!0}this.broadcaster=new h_({logger:this.logger,onError:this.onError,now:this.nowMs,persistentReplay:this.eventLog}),this.broadcaster.seedLatestOffset(this.eventLog.findMaxOffset()),this.registry=new ti({channels:this.channels,logger:this.logger,onError:this.onError,notify:async(n,g,v,r)=>{this.emit({channel:n,connector:g,content:v,meta:r})},now:this.nowMs})}get port(){return this.server?.port??this.configuredPort}get hostname(){return this.server?.hostname??this.configuredHostname}async start(){if(this.disposed)throw Error("FunnelGatewayServer is single-use: construct a new instance to start again");if(this.server)return;if(!this.token&&!nX.has(this.configuredHostname)&&!this.allowInsecureHost)throw Error(`refusing to start gateway: hostname "${this.configuredHostname}" is reachable off-box but no token is set. Set a token, bind to loopback (127.0.0.1), or pass allowInsecureHost: true.`);let i=this.buildApp();await this.killCompetingSlackIfNeeded(),this.startedAt=this.nowMs(),this.server=Bun.serve({port:this.configuredPort,hostname:this.configuredHostname,development:!1,fetch:($,n)=>this.handleFetch($,n,i),websocket:{open:($)=>this.handleWsOpen($),close:($)=>this.handleWsClose($),message(){}}}),this.logServerStarted();try{await this.bootListeners()}catch($){throw this.server.stop(),this.server=null,$}}async stop(){if(await this.registry.stopAll(),this.server)this.server.stop(),this.server=null;if(this.ownsEventLog)this.eventLog.close();this.disposed=!0}getStatus(){return{clients:this.broadcaster.getClientCount(),channels:this.broadcaster.listChannels()}}getBroadcaster(){return this.broadcaster}getRegistry(){return this.registry}getEventLog(){return this.eventLog}onEvent(i){return this.broadcaster.subscribe(i)}handleFetch(i,$,n){let g=new URL(i.url);if(g.pathname==="/ws"&&i.headers.get("upgrade")==="websocket"){if(this.token&&!this.tokenMatchesUpgrade(i))return new Response("unauthorized",{status:401});let v=g.searchParams.get("channel")??"",r=v?this.resolveChannel(v):null;if(v&&!r)return new Response(`unknown channel "${v}"`,{status:404});let b=r?.id??v,u=r?.name??null,U=r?.connectors??[],I=r?.delivery??"fanout",_=g.searchParams.get("since"),k=_===null?Number.NaN:Number.parseInt(_,10),O=Number.isFinite(k)&&k>=0?k:void 0,J=g.searchParams.get("id")??void 0;if($.upgrade(i,{data:{channel:b,channelName:u,connectors:U,delivery:I,subscriberId:J,since:O}}))return;return new Response("WebSocket upgrade failed",{status:400})}return n.fetch(i)}handleWsOpen(i){if(typeof i.data.since==="number"){let $=this.broadcaster.replaySince(i.data.since,i.data);try{for(let n of $)i.send(JSON.stringify(n))}catch(n){let g=n instanceof Error?n:Error(String(n));this.logger?.warn("replay send failed during ws.open",{error:g.message}),this.onError(g,{component:"gateway-server.replay"});return}}this.broadcaster.addClient(i,i.data),this.logger?.info("channel connected",{event_type:"system",action:"channel_connect",channel:i.data.channelName??"",channelId:i.data.channel,connectors:i.data.connectors.join(","),total:String(this.broadcaster.getClientCount())})}handleWsClose(i){this.broadcaster.removeClient(i),this.logger?.info("channel disconnected",{event_type:"system",action:"channel_disconnect",channel:i.data.channelName??"",channelId:i.data.channel,total:String(this.broadcaster.getClientCount())})}logServerStarted(){this.logger?.info("gateway started",{event_type:"system",action:"gateway_start",port:String(this.port),pid:String(this.selfPid)}),this.logger?.info("funnel gateway listening",{url:`http://localhost:${this.port}`,websocket:`ws://localhost:${this.port}/ws`,health:`http://localhost:${this.port}/health`})}buildApp(){let i=c.createApp();if(i.use((n,g)=>{return n.set("deps",{selfPid:this.selfPid,dir:this.dir,broadcaster:this.broadcaster,registry:this.registry,channels:this.channels,uptimeMs:()=>this.startedAt?this.nowMs()-this.startedAt:0,emit:(v)=>this.emit(v),diagnosticLog:this.diagnosticLog}),g()}),this.token)i.use("/listeners/*",Ei({expected:this.token})),i.use("/status",Ei({expected:this.token})),i.use("/debug",Ei({expected:this.token})),i.use("/channels/*",Ei({expected:this.token}));return(this.extraRoutes?i.route("/",this.extraRoutes):i).route("/",Q2)}tokenMatchesUpgrade(i){let $=(i.headers.get("sec-websocket-protocol")??"").split(",").map((v)=>v.trim()).filter((v)=>v.length>0);for(let v of $)if(v.startsWith("funnel.token.")&&Pr(v.slice(13),this.token))return!0;let g=(i.headers.get("authorization")??"").match(/^Bearer\s+(.+)$/i);if(g&&Pr(g[1]??"",this.token))return!0;return!1}resolveChannel(i){let $=this.channels.get(i)??this.channels.getById(i);if(!$)return null;return{id:$.id,name:$.name,connectors:$.connectors.map((n)=>n.name),delivery:$.delivery}}async killCompetingSlackIfNeeded(){if(!this.killCompetingSlack)return;if(!this.channels.listAllConnectors().some((n)=>n.type==="slack"))return;let $=await D2({selfPid:this.selfPid,dir:this.dir,process:this.process,logger:this.logger});if($.length>0)this.logger?.info("killed competing Slack gateway processes",{event_type:"system",action:"kill_competing",pids:$.join(",")})}async bootListeners(){await this.registry.startAll();for(let i of this.registry.list())this.logger?.info(`${i.type} listener started: ${i.name}`,{event_type:"system",action:`${i.type}_connect`,channel:i.channelName,connector:i.name});this.logger?.info(`event store: ${this.dbPath}`),this.logger?.info("funnel gateway running")}emit(i){let $=this.lookupChannelId(i.channel),n=$&&i.connector?this.lookupConnectorId($,i.connector):null,g={...i.meta,channel:i.channel};if(i.connector)g.connector=i.connector;if($)g.channelId=$;if(n)g.connectorId=n;let v=this.broadcaster.broadcast(i.content,g);return this.eventLog.record({content:i.content,channelId:$??null,connectorId:n??null,meta:g,offset:v.offset}),{offset:v.offset}}lookupChannelId(i){return this.channels.get(i)?.id??this.channels.getById(i)?.id??null}lookupConnectorId(i,$){return this.channels.getById(i)?.connectors.find((g)=>g.name===$)?.id??null}}import{homedir as rX}from"os";import{dirname as bX,join as G2}from"path";var Y2="gateway.token",uX=32,UX=new F,IX=()=>{let i=new Uint8Array(uX);return crypto.getRandomValues(i),[...i].map(($)=>$.toString(16).padStart(2,"0")).join("")};class i1{fs;path;generate;constructor(i={}){this.fs=i.fs??UX,this.path=G2(i.dir??ji,Y2),this.generate=i.generate??IX,Object.freeze(this)}read(){if(!this.fs.existsSync(this.path))return null;let i=this.fs.readFileSync(this.path).trim();return i.length>0?i:null}ensure(){return this.fs.mkdirSync(bX(this.path),{recursive:!0}),this.fs.withFileLock(`${this.path}.lock`,()=>{let i=this.read();if(i)return i;let $=this.generate();return this.fs.writeSecretFileSync(this.path,`${$}
796
+ `),$})}getPath(){return this.path}}var IS=G2(rX(),".funnel",Y2);var _X=D.object({channelName:D.string(),channelId:D.string(),name:D.string(),type:D.string(),alive:D.boolean()}),DX=D.object({listeners:D.array(_X)}),kX=D.object({reason:D.string().optional()}),$1={state:"offline"};class v1{port;isDaemonRunning;getToken;constructor(i){this.port=i.port,this.isDaemonRunning=i.isDaemonRunning,this.getToken=i.getToken??(()=>null),Object.freeze(this)}async list(){if(!this.isDaemonRunning())return{state:"offline"};try{let i=await J$(`${xi(this.port)}/listeners`,{headers:this.authHeaders()});if(!i.ok)return{state:"error",reason:`HTTP ${i.status}`};let $=DX.safeParse(await i.json());if(!$.success)return{state:"error",reason:"malformed daemon response"};return{state:"ok",listeners:$.data.listeners}}catch(i){return{state:"error",reason:i instanceof Error?i.message:String(i)}}}async start(i,$){if(!this.isDaemonRunning())return $1;return await this.call("POST",`/listeners/${this.path(i,$)}/start`)}async stop(i,$){if(!this.isDaemonRunning())return $1;return await this.call("DELETE",`/listeners/${this.path(i,$)}`)}async restart(i,$){if(!this.isDaemonRunning())return $1;return await this.call("POST",`/listeners/${this.path(i,$)}/restart`)}path(i,$){return`${encodeURIComponent(i)}/${encodeURIComponent($)}`}authHeaders(){let i=this.getToken();return i?{authorization:`Bearer ${i}`}:{}}async call(i,$){try{let n=await J$(`${xi(this.port)}${$}`,{method:i,headers:this.authHeaders()},30000);if(!n.ok){let g=null;try{g=await n.json()}catch{g=null}let v=kX.safeParse(g);return{state:"error",reason:(v.success?v.data.reason:void 0)??`HTTP ${n.status}`}}return{state:"ok"}}catch(n){return{state:"error",reason:n instanceof Error?n.message:String(n)}}}}var jX="/sandbox/.funnel",OX="/sandbox/tmp",JX=()=>{};class Hr{paths;channels;gateway;gatewayToken;publisher;listeners;claude;profiles;localConfig;localConfigSync;diagnostics;recovery;doctor;docs;fs;process;logger;clock;http;onError;diagnosticLog;constructor(i={}){let $=i.dir??ur(),n=i.tmpDir??fi(),g=i.fs??new F,v=i.process??new R,r=i.clock??new Ni,b=i.idGenerator??new Zi,u=i.http??new Di;this.paths={dir:$,tmpDir:n,settings:wX($,"settings.json")},this.fs=g,this.process=v,this.logger=i.logger,this.clock=r,this.http=u,this.onError=i.onError??JX,this.diagnosticLog=i.diagnosticLog;let U=i.store??new v_({path:this.paths.settings,fs:g,idGenerator:b}),I=new D_({descriptors:i.connectors??[],fs:g,process:v,http:u,clock:r,logger:this.logger,diagnosticLog:this.diagnosticLog,signal:i.signal,dir:$});this.profiles=new Y_({store:U,idGenerator:b,fs:g}),this.channels=new k_({store:U,registry:I,clock:r,idGenerator:b,profileChecker:this.profiles}),this.gateway=new c_({fs:g,process:v,clock:r,dir:$,tmpDir:n,port:i.port}),this.gatewayToken=new i1({fs:g,dir:$}),this.publisher=new E_({port:this.gateway.getPort(),isDaemonRunning:()=>this.gateway.isRunning(),getToken:()=>this.gatewayToken.read()}),this.listeners=new v1({port:this.gateway.getPort(),isDaemonRunning:()=>this.gateway.isRunning(),getToken:()=>this.gatewayToken.read()});let _=new G_({fs:g});this.localConfig=new f_({fs:g}),this.localConfigSync=new K_({channels:this.channels,prompter:i.tokenPrompter??new z_});let k=new O_({global:this.profiles,local:new j_({fs:g,dir:$})});this.claude=new w_({channels:this.channels,mcp:_,gateway:this.gateway,sessions:k,guard:new kr({fs:g,process:v,dir:$}),process:v,logger:this.logger,dir:$}),this.diagnostics=new P_({gateway:this.gateway,gatewayToken:this.gatewayToken,channels:this.channels,publisher:this.publisher,diagnosticLog:this.diagnosticLog,tmpDir:n}),this.recovery=new H_({gateway:this.gateway,listeners:this.listeners,channels:this.channels}),this.doctor=new W_({diagnostics:this.diagnostics,recovery:this.recovery}),this.docs=new X_,Object.freeze(this)}static inMemory(i={}){return new Hr({...i,store:i.store??new L_,fs:i.fs??new S_,process:i.process??new l_,logger:i.logger??new B_,clock:i.clock??new T_,idGenerator:i.idGenerator??new A_,http:i.http??new Z_,tokenPrompter:i.tokenPrompter??new q_,diagnosticLog:i.diagnosticLog??new N_,dir:i.dir??jX,tmpDir:i.tmpDir??OX})}gatewayServer(i={}){return new s_({channels:this.channels,port:i.port,hostname:i.hostname,...i.eventLog?{eventLog:i.eventLog}:{dbPath:i.dbPath},process:this.process,clock:this.clock,logger:this.logger,onError:this.onError,dir:this.paths.dir,tmpDir:this.paths.tmpDir,killCompetingSlack:i.killCompetingSlack,token:i.token??this.gatewayToken.ensure(),allowInsecureHost:i.allowInsecureHost,extraRoutes:i.extraRoutes,diagnosticLog:this.diagnosticLog})}createProcessGuard(){return new kr({fs:this.fs,process:this.process,dir:this.paths.dir})}async runGatewayForeground(i={}){let $=Jr(),g=i.caffeinate!==!1&&globalThis.process.platform==="darwin"?["caffeinate","-is","bun",$]:["bun",$];return this.process.attach(g,{env:{FUNNEL_DIR:this.paths.dir,FUNNEL_PORT:String(this.gateway.getPort()),FUNNEL_TMP_DIR:this.paths.tmpDir}})}gatewayClient(){let{port:i}=this.gateway.getStatus();return __(xi(i))}}import{appendFileSync as WX,mkdirSync as VX}from"fs";import{dirname as XX,join as fX}from"path";var PX=[/xox[abprs]-[A-Za-z0-9-]{10,}/g,/xapp-[A-Za-z0-9-]{10,}/g,/gh[pousr]_[A-Za-z0-9]{20,}/g,/github_pat_[A-Za-z0-9_]{20,}/g,/Bot [A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{4,}\.[A-Za-z0-9_-]{20,}/g,/Bearer [A-Za-z0-9._~+/-]{16,}/g],H2=(i)=>{let $=i;for(let n of PX)$=$.replace(n,"[redacted]");return $};var QX=()=>fX(fi(),"funnel.log");class n1 extends In{file;now;constructor(i={}){super();this.file=i.file??QX(),this.now=i.now??(()=>new Date),Object.freeze(this)}info(i,$){this.write("info",i,$)}warn(i,$){this.write("warn",i,$)}error(i,$){this.write("error",i,$)}write(i,$,n){VX(XX(this.file),{recursive:!0});let g={time:this.now().toISOString(),level:i,message:$,...n?{meta:n}:{}};WX(this.file,`${H2(JSON.stringify(g))}
797
+ `)}}var S2=(i)=>{let $=new Jn;if(i.token)$.use("/diagnostics",Ei({expected:i.token})),$.use("/diagnostics/*",Ei({expected:i.token})),$.use("/doctor",Ei({expected:i.token}));return $.get("/diagnostics",async(n)=>{let g=n.req.query("channel");if(n.req.query("all")!==void 0){let b=await i.diagnostics.diagnoseAll();return n.json(b)}let r=await i.diagnostics.diagnose(g??void 0);if(!r)return n.json({error:"channel not found"},404);return n.json(r)}),$.get("/diagnostics/events",async(n)=>{let g=n.req.query("channel")??null,v=n.req.query("connector"),r=Number(n.req.query("limit")??"20"),b=await i.diagnostics.recentEvents(g,{connector:v,limit:r});return n.json(b)}),$.get("/diagnostics/dropped",async(n)=>{let g=n.req.query("channel")??null,v=n.req.query("connector"),r=Number(n.req.query("limit")??"20"),b=await i.diagnostics.droppedEvents(g,{connector:v,limit:r});return n.json(b)}),$.get("/diagnostics/errors",async(n)=>{let g=n.req.query("channel")??null,v=n.req.query("connector"),r=Number(n.req.query("limit")??"20"),b=await i.diagnostics.connectionErrors(g,{connector:v,limit:r});return n.json(b)}),$.get("/diagnostics/raw",async(n)=>{let g=n.req.query("channel")??null,v=n.req.query("connector"),r=Number(n.req.query("limit")??"20"),b=await i.diagnostics.rawEvents(g,{connector:v,limit:r});return n.json(b)}),$.get("/diagnostics/connection",async(n)=>{let g=n.req.query("channel")??null,v=n.req.query("connector"),r=Number(n.req.query("limit")??"20"),b=await i.diagnostics.connectionTimeline(g,{connector:v,limit:r});return n.json(b)}),$.get("/diagnostics/logs",async(n)=>{let g=n.req.query("grep")??void 0,v=Number(n.req.query("limit")??"200"),r=await i.diagnostics.recentLogs({grep:g,limit:v});return n.json(r)}),$.post("/diagnostics/replay",async(n)=>{let g=await z2(n),v=typeof g.channel==="string"?g.channel:null,r=typeof g.seq==="number"?g.seq:void 0;if(!v)return n.json({error:"channel is required"},400);let b=await i.diagnostics.replay(v,r);return n.json(b)}),$.post("/doctor",async(n)=>{let g=await z2(n),v=g.mode==="safe"||g.mode==="aggressive"||g.mode==="off"?g.mode:"off",r=await i.doctor.run(v);return n.json(r)}),$},KX=(i)=>i!==null&&typeof i==="object"&&!Array.isArray(i),z2=async(i)=>{try{let $=await i.req.json();return KX($)?$:{}}catch{return{}}};var A2=(i)=>{if(!(i instanceof Error))return!1;if(("code"in i?String(Reflect.get(i,"code")):"")==="EADDRINUSE")return!0;let n=i.message;return n.includes("EADDRINUSE")||n.includes("address already in use")||n.includes("in use")};import{chmodSync as GX}from"fs";var YX=262144;class b1 extends _n{raw;processed;connection;now;logger;constructor(i){super();this.now=i.now??(()=>Date.now()),this.logger=i.logger;let $=i.maxAgeMs!==void 0?{maxAgeMs:i.maxAgeMs}:{},n={now:this.now,...$,...i.maxRows!==void 0?{maxRows:i.maxRows}:{}},g=i.rawMaxRows??i.maxRows,v={now:this.now,...$,...g!==void 0?{maxRows:g}:{}};this.raw=new V$({path:i.rawPath,indexes:["event_id","connector_id","channel_id"],extractIndexes:(r)=>({event_id:r.event_id,connector_id:r.connector_id,channel_id:r.channel_id}),...v}),this.processed=new V$({path:i.processedPath,indexes:["event_id","connector_id","channel_id","outcome"],extractIndexes:(r)=>({event_id:r.event_id,connector_id:r.connector_id,channel_id:r.channel_id,outcome:r.outcome}),...n}),this.connection=new V$({path:i.connectionPath,indexes:["connector_id","channel_id","status"],extractIndexes:(r)=>({connector_id:r.connector_id,channel_id:r.channel_id,status:r.status}),...n}),g1(i.rawPath),g1(i.processedPath),g1(i.connectionPath),Object.freeze(this)}recordRaw(i){let $={event_id:i.eventId,type:i.type,connector_id:i.connectorId,channel_id:i.channelId,payload:SX(i.payload,i.type)};this.report("raw",this.raw.insert({ts:this.now(),event:$}))}recordProcessed(i){let $={event_id:i.eventId,type:i.type,connector_id:i.connectorId,channel_id:i.channelId,outcome:i.outcome,payload:i.payload};this.report("processed",this.processed.insert({ts:this.now(),event:$}))}recordConnection(i){let $={type:i.type,connector_id:i.connectorId,channel_id:i.channelId,status:i.status,detail:i.detail};this.report("connection",this.connection.insert({ts:this.now(),event:$}))}report(i,$){if($ instanceof Error)this.logger?.error("diagnostic log insert failed",{table:i,error:$.message})}queryRaw(i){let $=r1(i);if(i.eventId!==void 0)$.event_id=i.eventId;return this.raw.query({...i.type!==void 0?{type:i.type}:{},...i.seq!==void 0?{seq:i.seq}:{},...i.limit!==void 0?{limit:i.limit}:{},where:$,order:"desc"}).map((g)=>({seq:g.seq,ts:g.ts,eventId:g.event.event_id,type:g.event.type,connectorId:g.event.connector_id,channelId:g.event.channel_id,payload:g.event.payload}))}queryProcessed(i){let $=r1(i);if(i.eventId!==void 0)$.event_id=i.eventId;if(i.outcome!==void 0)$.outcome=i.outcome;return this.processed.query({...i.type!==void 0?{type:i.type}:{},...i.seq!==void 0?{seq:i.seq}:{},...i.limit!==void 0?{limit:i.limit}:{},where:$,...i.outcomePrefix!==void 0?{wherePrefix:{outcome:i.outcomePrefix}}:{},order:"desc"}).map((g)=>({seq:g.seq,ts:g.ts,eventId:g.event.event_id,type:g.event.type,connectorId:g.event.connector_id,channelId:g.event.channel_id,outcome:g.event.outcome,payload:g.event.payload}))}queryConnection(i){let $=r1(i);if(i.status!==void 0)$.status=i.status;return this.connection.query({...i.type!==void 0?{type:i.type}:{},...i.seq!==void 0?{seq:i.seq}:{},...i.limit!==void 0?{limit:i.limit}:{},where:$,...i.statuses!==void 0?{whereIn:{status:i.statuses}}:{},order:"desc"}).map((g)=>({seq:g.seq,ts:g.ts,type:g.event.type,connectorId:g.event.connector_id,channelId:g.event.channel_id,status:zX(g.event.status),detail:g.event.detail}))}clear(){this.raw.clear(),this.processed.clear(),this.connection.clear()}close(){this.raw.close(),this.processed.close(),this.connection.close()}}var g1=(i)=>{if(i===":memory:")return;for(let $ of["","-wal","-shm"])try{GX(`${i}${$}`,384)}catch{}},r1=(i)=>{let $={};if(i.connectorId!==void 0)$.connector_id=i.connectorId;if(i.channelId!==void 0)$.channel_id=i.channelId;return $},HX=tk.shape.status,zX=(i)=>{let $=HX.safeParse(i);return $.success?$.data:"error"},SX=(i,$)=>{let n=Buffer.byteLength(i,"utf8");if(n<=YX)return i;return JSON.stringify({...BX(i),_funnel_oversized:n,_funnel_type:$})},AX=["type","subtype","ts","channel","channel_type","user","bot_id"],BX=(i)=>{try{let $=JSON.parse(i);if(typeof $!=="object"||$===null)return{};let n=$,g={};for(let v of AX)if(n[v]!==void 0)g[v]=n[v];return g}catch{return{}}};import{join as u1}from"path";var B2=(i)=>({rawPath:u1(i,"connector-raw.db"),processedPath:u1(i,"connector-processed.db"),connectionPath:u1(i,"connector-connection.db")});var ZX=5000,qX=50000,MX=604800000,U1=Mi(),xX=process.env.FUNNEL_HOST||"127.0.0.1",Pn=ur(),zr=TX(Pn,"gateway.pid");process.title=`funnel-gateway[${Pn}]`;var rv=new n1,NX=new R;T2(Pn,{recursive:!0});var l2=()=>{try{return LX(zr,String(process.pid),{flag:"wx"}),!0}catch(i){if(!(i instanceof Error)||!("code"in i)||i.code!=="EEXIST")throw i;return!1}};if(!l2()){let i=Number(lX(zr,"utf-8").trim());if(i>0&&NX.isAlive(i))rv.error("funnel gateway already running",{pid:i}),process.exit(1);if(Z2(zr),!l2())rv.error("funnel gateway PID file claimed by another daemon mid-race"),process.exit(1)}process.on("exit",()=>{try{Z2(zr)}catch{}});var q2=fi();T2(q2,{recursive:!0});var M2=new b1({...B2(q2),rawMaxRows:ZX,maxRows:qX,maxAgeMs:MX,logger:rv});process.on("exit",()=>{try{M2.close()}catch{}});var Sr=new Hr({logger:rv,diagnosticLog:M2,dir:Pn,connectors:sD()}),x2=Sr.gatewayToken.ensure(),EX=S2({diagnostics:Sr.diagnostics,doctor:Sr.doctor,token:x2}),N2=Sr.gatewayServer({port:U1,hostname:xX,extraRoutes:EX,token:x2});try{await N2.start()}catch(i){if(A2(i))rv.error(`gateway port ${U1} is already in use by another funnel daemon (a different repo/scope). Set FUNNEL_PORT to a distinct port, or stop the other daemon.`,{port:U1,dir:Pn});else rv.error("gateway failed to start",{error:i instanceof Error?i.message:String(i)});process.exit(1)}var L2=!1,E2=async(i)=>{if(L2)return;L2=!0;try{await Promise.race([N2.stop(),new Promise(($)=>setTimeout($,3000))])}catch{}process.exit(i)};process.on("SIGINT",()=>{E2(130)});process.on("SIGTERM",()=>{E2(143)});