@snapfail/browser 0.0.10 → 0.0.12

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.
@@ -0,0 +1,7 @@
1
+ import type { CapturedError } from "./collectors/errors.ts";
2
+ export declare function isExtensionError(error: CapturedError): boolean;
3
+ export declare function isKnownExtensionMessage(message: string): boolean;
4
+ export declare function isCrawlerUA(ua: string): boolean;
5
+ export declare function isLegacyBrowserError(error: CapturedError, ua: string): boolean;
6
+ export declare function isEmptyError(error: CapturedError): boolean;
7
+ export declare function shouldIgnore(error: CapturedError): boolean;
package/dist/index.js CHANGED
@@ -4501,6 +4501,105 @@ async function send(endpoint, payload) {
4501
4501
  } catch {}
4502
4502
  }
4503
4503
 
4504
+ // src/filter.ts
4505
+ var EXTENSION_PROTOCOLS = [
4506
+ "chrome-extension://",
4507
+ "moz-extension://",
4508
+ "safari-extension://",
4509
+ "safari-web-extension://",
4510
+ "ms-browser-extension://"
4511
+ ];
4512
+ var EXTENSION_MESSAGES = [
4513
+ "top.GLOBALS",
4514
+ "originalCreateNotification",
4515
+ "canvas.contentDocument",
4516
+ "MyApp_RemoveAllHighlights",
4517
+ "atomicFindClose",
4518
+ "fb_xd_fragment",
4519
+ "bmi_SafeAddOnload",
4520
+ "EBCallBackMessageReceived",
4521
+ "conduitPage",
4522
+ "_avast_submit",
4523
+ "ComboSearch is not defined",
4524
+ "jigsaw is not defined",
4525
+ "__gCrWeb"
4526
+ ];
4527
+ var CROSS_ORIGIN_MESSAGE = "Script error.";
4528
+ var RESIZE_OBSERVER_PATTERN = "ResizeObserver loop completed";
4529
+ var INJECTED_VARIABLE_PATTERNS = [
4530
+ "_AutofillCallbackHandler",
4531
+ "currentInset"
4532
+ ];
4533
+ var CRAWLER_UA_PATTERNS = [
4534
+ "Googlebot",
4535
+ "Bingbot",
4536
+ "Slurp",
4537
+ "DuckDuckBot",
4538
+ "Baiduspider",
4539
+ "YandexBot",
4540
+ "Sogou",
4541
+ "Exabot",
4542
+ "facebot",
4543
+ "ia_archiver",
4544
+ "Prerender",
4545
+ "HeadlessChrome",
4546
+ "PhantomJS",
4547
+ "Selenium",
4548
+ "Puppeteer"
4549
+ ];
4550
+ var NOISY_UA_PATTERNS = ["Instagram", "FBAN", "FBAV"];
4551
+ var IE_UA_PATTERNS = ["MSIE ", "Trident/"];
4552
+ var IE_ERROR_MESSAGES = [
4553
+ "Object doesn't support this property or method",
4554
+ "Access is denied.",
4555
+ "The object invoked has disconnected from its clients",
4556
+ "Unspecified error."
4557
+ ];
4558
+ function isExtensionError(error) {
4559
+ return error.stack.some((frame) => EXTENSION_PROTOCOLS.some((proto) => frame.file?.startsWith(proto)));
4560
+ }
4561
+ function isKnownExtensionMessage(message) {
4562
+ return EXTENSION_MESSAGES.some((pattern) => message.includes(pattern));
4563
+ }
4564
+ function isCrawlerUA(ua) {
4565
+ const lower = ua.toLowerCase();
4566
+ return CRAWLER_UA_PATTERNS.some((pattern) => lower.includes(pattern.toLowerCase()));
4567
+ }
4568
+ function isLegacyBrowserError(error, ua) {
4569
+ if (IE_UA_PATTERNS.some((p) => ua.includes(p)))
4570
+ return true;
4571
+ if (IE_ERROR_MESSAGES.some((p) => error.message.includes(p)))
4572
+ return true;
4573
+ return false;
4574
+ }
4575
+ function isEmptyError(error) {
4576
+ const msg = error.message.trim();
4577
+ return !msg || msg === "undefined" || msg === "null" || msg === "error";
4578
+ }
4579
+ function shouldIgnore(error) {
4580
+ const ua = typeof navigator !== "undefined" ? navigator.userAgent : "";
4581
+ if (isCrawlerUA(ua))
4582
+ return true;
4583
+ if (NOISY_UA_PATTERNS.some((p) => ua.includes(p)))
4584
+ return true;
4585
+ if (isLegacyBrowserError(error, ua))
4586
+ return true;
4587
+ if (isEmptyError(error))
4588
+ return true;
4589
+ const msg = error.message;
4590
+ if (msg === CROSS_ORIGIN_MESSAGE && error.stack.length === 0)
4591
+ return true;
4592
+ if (msg.includes(RESIZE_OBSERVER_PATTERN))
4593
+ return true;
4594
+ if (INJECTED_VARIABLE_PATTERNS.some((p) => msg.includes(p)))
4595
+ return true;
4596
+ if (isKnownExtensionMessage(msg))
4597
+ return true;
4598
+ if (error.stack.length > 0 && isExtensionError(error))
4599
+ return true;
4600
+ return false;
4601
+ }
4602
+
4504
4603
  // src/index.ts
4505
4604
  function initSnapfail(config) {
4506
4605
  if (!config.projectKey) {
@@ -4516,6 +4615,8 @@ function initSnapfail(config) {
4516
4615
  attachReplayCollector(replayBuffer)
4517
4616
  ];
4518
4617
  function triggerCapture(captured) {
4618
+ if (shouldIgnore(captured))
4619
+ return;
4519
4620
  const payload = buildPayload(config, captured, {
4520
4621
  console: consoleBuffer.flush(),
4521
4622
  network: networkBuffer.flush().map(({ timestamp: _, ...e }) => e),
@@ -1,2 +1,2 @@
1
- (()=>{var X$=Object.defineProperty;var G$=(_)=>_;function J$(_,$){this[_]=G$.bind(null,$)}var M$=(_,$)=>{for(var S in $)X$(_,S,{get:$[S],enumerable:!0,configurable:!0,set:J$.bind($,S)})};class Q_{windowMs;events=[];constructor(_){this.windowMs=_}push(_){let $=Date.now()-this.windowMs;this.events=this.events.filter((S)=>S.timestamp>=$),this.events.push(_)}snapshot(){let _=Date.now()-this.windowMs;return this.events.filter(($)=>$.timestamp>=_).slice()}flush(){let _=this.snapshot();return this.events=[],_}clear(){this.events=[]}}var W={};M$(W,{void:()=>d$,util:()=>v,unknown:()=>u$,union:()=>e$,undefined:()=>r$,tuple:()=>SS,transformer:()=>QS,symbol:()=>Z$,string:()=>r_,strictObject:()=>s$,setErrorMap:()=>Y$,set:()=>qS,record:()=>HS,quotelessJson:()=>Q$,promise:()=>MS,preprocess:()=>BS,pipeline:()=>ES,ostring:()=>RS,optional:()=>zS,onumber:()=>jS,oboolean:()=>bS,objectUtil:()=>C_,object:()=>t$,number:()=>o_,nullable:()=>YS,null:()=>o$,never:()=>p$,nativeEnum:()=>JS,nan:()=>y$,map:()=>fS,makeIssue:()=>z_,literal:()=>XS,lazy:()=>WS,late:()=>T$,isValid:()=>n,isDirty:()=>A_,isAsync:()=>s,isAborted:()=>O_,intersection:()=>$S,instanceof:()=>n$,getParsedType:()=>h,getErrorMap:()=>t,function:()=>wS,enum:()=>GS,effect:()=>QS,discriminatedUnion:()=>_S,defaultErrorMap:()=>l,datetimeRegex:()=>x_,date:()=>c$,custom:()=>Z_,coerce:()=>vS,boolean:()=>i_,bigint:()=>x$,array:()=>a$,any:()=>i$,addIssueToContext:()=>Q,ZodVoid:()=>B_,ZodUnknown:()=>y,ZodUnion:()=>f_,ZodUndefined:()=>S_,ZodType:()=>b,ZodTuple:()=>P,ZodTransformer:()=>C,ZodSymbol:()=>Y_,ZodString:()=>F,ZodSet:()=>p,ZodSchema:()=>b,ZodRecord:()=>E_,ZodReadonly:()=>M_,ZodPromise:()=>d,ZodPipeline:()=>b_,ZodParsedType:()=>M,ZodOptional:()=>k,ZodObject:()=>O,ZodNumber:()=>x,ZodNullable:()=>T,ZodNull:()=>H_,ZodNever:()=>I,ZodNativeEnum:()=>X_,ZodNaN:()=>j_,ZodMap:()=>R_,ZodLiteral:()=>W_,ZodLazy:()=>w_,ZodIssueCode:()=>J,ZodIntersection:()=>q_,ZodFunction:()=>__,ZodFirstPartyTypeKind:()=>R,ZodError:()=>D,ZodEnum:()=>Z,ZodEffects:()=>C,ZodDiscriminatedUnion:()=>L_,ZodDefault:()=>G_,ZodDate:()=>i,ZodCatch:()=>J_,ZodBranded:()=>U_,ZodBoolean:()=>$_,ZodBigInt:()=>c,ZodArray:()=>K,ZodAny:()=>u,Schema:()=>b,ParseStatus:()=>U,OK:()=>N,NEVER:()=>OS,INVALID:()=>Y,EMPTY_PATH:()=>B$,DIRTY:()=>o,BRAND:()=>m$});var v;(function(_){_.assertEqual=(H)=>{};function $(H){}_.assertIs=$;function S(H){throw Error()}_.assertNever=S,_.arrayToEnum=(H)=>{let w={};for(let q of H)w[q]=q;return w},_.getValidEnumValues=(H)=>{let w=_.objectKeys(H).filter((X)=>typeof H[H[X]]!=="number"),q={};for(let X of w)q[X]=H[X];return _.objectValues(q)},_.objectValues=(H)=>{return _.objectKeys(H).map(function(w){return H[w]})},_.objectKeys=typeof Object.keys==="function"?(H)=>Object.keys(H):(H)=>{let w=[];for(let q in H)if(Object.prototype.hasOwnProperty.call(H,q))w.push(q);return w},_.find=(H,w)=>{for(let q of H)if(w(q))return q;return},_.isInteger=typeof Number.isInteger==="function"?(H)=>Number.isInteger(H):(H)=>typeof H==="number"&&Number.isFinite(H)&&Math.floor(H)===H;function f(H,w=" | "){return H.map((q)=>typeof q==="string"?`'${q}'`:q).join(w)}_.joinValues=f,_.jsonStringifyReplacer=(H,w)=>{if(typeof w==="bigint")return w.toString();return w}})(v||(v={}));var C_;(function(_){_.mergeShapes=($,S)=>{return{...$,...S}}})(C_||(C_={}));var M=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),h=(_)=>{switch(typeof _){case"undefined":return M.undefined;case"string":return M.string;case"number":return Number.isNaN(_)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":if(Array.isArray(_))return M.array;if(_===null)return M.null;if(_.then&&typeof _.then==="function"&&_.catch&&typeof _.catch==="function")return M.promise;if(typeof Map<"u"&&_ instanceof Map)return M.map;if(typeof Set<"u"&&_ instanceof Set)return M.set;if(typeof Date<"u"&&_ instanceof Date)return M.date;return M.object;default:return M.unknown}};var J=v.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Q$=(_)=>{return JSON.stringify(_,null,2).replace(/"([^"]+)":/g,"$1:")};class D extends Error{get errors(){return this.issues}constructor(_){super();this.issues=[],this.addIssue=(S)=>{this.issues=[...this.issues,S]},this.addIssues=(S=[])=>{this.issues=[...this.issues,...S]};let $=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,$);else this.__proto__=$;this.name="ZodError",this.issues=_}format(_){let $=_||function(H){return H.message},S={_errors:[]},f=(H)=>{for(let w of H.issues)if(w.code==="invalid_union")w.unionErrors.map(f);else if(w.code==="invalid_return_type")f(w.returnTypeError);else if(w.code==="invalid_arguments")f(w.argumentsError);else if(w.path.length===0)S._errors.push($(w));else{let q=S,X=0;while(X<w.path.length){let G=w.path[X];if(X!==w.path.length-1)q[G]=q[G]||{_errors:[]};else q[G]=q[G]||{_errors:[]},q[G]._errors.push($(w));q=q[G],X++}}};return f(this),S}static assert(_){if(!(_ instanceof D))throw Error(`Not a ZodError: ${_}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,v.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(_=($)=>$.message){let $={},S=[];for(let f of this.issues)if(f.path.length>0){let H=f.path[0];$[H]=$[H]||[],$[H].push(_(f))}else S.push(_(f));return{formErrors:S,fieldErrors:$}}get formErrors(){return this.flatten()}}D.create=(_)=>{return new D(_)};var z$=(_,$)=>{let S;switch(_.code){case J.invalid_type:if(_.received===M.undefined)S="Required";else S=`Expected ${_.expected}, received ${_.received}`;break;case J.invalid_literal:S=`Invalid literal value, expected ${JSON.stringify(_.expected,v.jsonStringifyReplacer)}`;break;case J.unrecognized_keys:S=`Unrecognized key(s) in object: ${v.joinValues(_.keys,", ")}`;break;case J.invalid_union:S="Invalid input";break;case J.invalid_union_discriminator:S=`Invalid discriminator value. Expected ${v.joinValues(_.options)}`;break;case J.invalid_enum_value:S=`Invalid enum value. Expected ${v.joinValues(_.options)}, received '${_.received}'`;break;case J.invalid_arguments:S="Invalid function arguments";break;case J.invalid_return_type:S="Invalid function return type";break;case J.invalid_date:S="Invalid date";break;case J.invalid_string:if(typeof _.validation==="object")if("includes"in _.validation){if(S=`Invalid input: must include "${_.validation.includes}"`,typeof _.validation.position==="number")S=`${S} at one or more positions greater than or equal to ${_.validation.position}`}else if("startsWith"in _.validation)S=`Invalid input: must start with "${_.validation.startsWith}"`;else if("endsWith"in _.validation)S=`Invalid input: must end with "${_.validation.endsWith}"`;else v.assertNever(_.validation);else if(_.validation!=="regex")S=`Invalid ${_.validation}`;else S="Invalid";break;case J.too_small:if(_.type==="array")S=`Array must contain ${_.exact?"exactly":_.inclusive?"at least":"more than"} ${_.minimum} element(s)`;else if(_.type==="string")S=`String must contain ${_.exact?"exactly":_.inclusive?"at least":"over"} ${_.minimum} character(s)`;else if(_.type==="number")S=`Number must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${_.minimum}`;else if(_.type==="bigint")S=`Number must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${_.minimum}`;else if(_.type==="date")S=`Date must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(_.minimum))}`;else S="Invalid input";break;case J.too_big:if(_.type==="array")S=`Array must contain ${_.exact?"exactly":_.inclusive?"at most":"less than"} ${_.maximum} element(s)`;else if(_.type==="string")S=`String must contain ${_.exact?"exactly":_.inclusive?"at most":"under"} ${_.maximum} character(s)`;else if(_.type==="number")S=`Number must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`;else if(_.type==="bigint")S=`BigInt must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`;else if(_.type==="date")S=`Date must be ${_.exact?"exactly":_.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(_.maximum))}`;else S="Invalid input";break;case J.custom:S="Invalid input";break;case J.invalid_intersection_types:S="Intersection results could not be merged";break;case J.not_multiple_of:S=`Number must be a multiple of ${_.multipleOf}`;break;case J.not_finite:S="Number must be finite";break;default:S=$.defaultError,v.assertNever(_)}return{message:S}},l=z$;var l_=l;function Y$(_){l_=_}function t(){return l_}var z_=(_)=>{let{data:$,path:S,errorMaps:f,issueData:H}=_,w=[...S,...H.path||[]],q={...H,path:w};if(H.message!==void 0)return{...H,path:w,message:H.message};let X="",G=f.filter((B)=>!!B).slice().reverse();for(let B of G)X=B(q,{data:$,defaultError:X}).message;return{...H,path:w,message:X}},B$=[];function Q(_,$){let S=t(),f=z_({issueData:$,data:_.data,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,S,S===l?void 0:l].filter((H)=>!!H)});_.common.issues.push(f)}class U{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(_,$){let S=[];for(let f of $){if(f.status==="aborted")return Y;if(f.status==="dirty")_.dirty();S.push(f.value)}return{status:_.value,value:S}}static async mergeObjectAsync(_,$){let S=[];for(let f of $){let H=await f.key,w=await f.value;S.push({key:H,value:w})}return U.mergeObjectSync(_,S)}static mergeObjectSync(_,$){let S={};for(let f of $){let{key:H,value:w}=f;if(H.status==="aborted")return Y;if(w.status==="aborted")return Y;if(H.status==="dirty")_.dirty();if(w.status==="dirty")_.dirty();if(H.value!=="__proto__"&&(typeof w.value<"u"||f.alwaysSet))S[H.value]=w.value}return{status:_.value,value:S}}}var Y=Object.freeze({status:"aborted"}),o=(_)=>({status:"dirty",value:_}),N=(_)=>({status:"valid",value:_}),O_=(_)=>_.status==="aborted",A_=(_)=>_.status==="dirty",n=(_)=>_.status==="valid",s=(_)=>typeof Promise<"u"&&_ instanceof Promise;var z;(function(_){_.errToObj=($)=>typeof $==="string"?{message:$}:$||{},_.toString=($)=>typeof $==="string"?$:$?.message})(z||(z={}));class g{constructor(_,$,S,f){this._cachedPath=[],this.parent=_,this.data=$,this._path=S,this._key=f}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var m_=(_,$)=>{if(n($))return{success:!0,data:$.value};else{if(!_.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let S=new D(_.common.issues);return this._error=S,this._error}}}};function j(_){if(!_)return{};let{errorMap:$,invalid_type_error:S,required_error:f,description:H}=_;if($&&(S||f))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if($)return{errorMap:$,description:H};return{errorMap:(q,X)=>{let{message:G}=_;if(q.code==="invalid_enum_value")return{message:G??X.defaultError};if(typeof X.data>"u")return{message:G??f??X.defaultError};if(q.code!=="invalid_type")return{message:X.defaultError};return{message:G??S??X.defaultError}},description:H}}class b{get description(){return this._def.description}_getType(_){return h(_.data)}_getOrReturnCtx(_,$){return $||{common:_.parent.common,data:_.data,parsedType:h(_.data),schemaErrorMap:this._def.errorMap,path:_.path,parent:_.parent}}_processInputParams(_){return{status:new U,ctx:{common:_.parent.common,data:_.data,parsedType:h(_.data),schemaErrorMap:this._def.errorMap,path:_.path,parent:_.parent}}}_parseSync(_){let $=this._parse(_);if(s($))throw Error("Synchronous parse encountered promise.");return $}_parseAsync(_){let $=this._parse(_);return Promise.resolve($)}parse(_,$){let S=this.safeParse(_,$);if(S.success)return S.data;throw S.error}safeParse(_,$){let S={common:{issues:[],async:$?.async??!1,contextualErrorMap:$?.errorMap},path:$?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:_,parsedType:h(_)},f=this._parseSync({data:_,path:S.path,parent:S});return m_(S,f)}"~validate"(_){let $={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:_,parsedType:h(_)};if(!this["~standard"].async)try{let S=this._parseSync({data:_,path:[],parent:$});return n(S)?{value:S.value}:{issues:$.common.issues}}catch(S){if(S?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;$.common={issues:[],async:!0}}return this._parseAsync({data:_,path:[],parent:$}).then((S)=>n(S)?{value:S.value}:{issues:$.common.issues})}async parseAsync(_,$){let S=await this.safeParseAsync(_,$);if(S.success)return S.data;throw S.error}async safeParseAsync(_,$){let S={common:{issues:[],contextualErrorMap:$?.errorMap,async:!0},path:$?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:_,parsedType:h(_)},f=this._parse({data:_,path:S.path,parent:S}),H=await(s(f)?f:Promise.resolve(f));return m_(S,H)}refine(_,$){let S=(f)=>{if(typeof $==="string"||typeof $>"u")return{message:$};else if(typeof $==="function")return $(f);else return $};return this._refinement((f,H)=>{let w=_(f),q=()=>H.addIssue({code:J.custom,...S(f)});if(typeof Promise<"u"&&w instanceof Promise)return w.then((X)=>{if(!X)return q(),!1;else return!0});if(!w)return q(),!1;else return!0})}refinement(_,$){return this._refinement((S,f)=>{if(!_(S))return f.addIssue(typeof $==="function"?$(S,f):$),!1;else return!0})}_refinement(_){return new C({schema:this,typeName:R.ZodEffects,effect:{type:"refinement",refinement:_}})}superRefine(_){return this._refinement(_)}constructor(_){this.spa=this.safeParseAsync,this._def=_,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:($)=>this["~validate"]($)}}optional(){return k.create(this,this._def)}nullable(){return T.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return K.create(this)}promise(){return d.create(this,this._def)}or(_){return f_.create([this,_],this._def)}and(_){return q_.create(this,_,this._def)}transform(_){return new C({...j(this._def),schema:this,typeName:R.ZodEffects,effect:{type:"transform",transform:_}})}default(_){let $=typeof _==="function"?_:()=>_;return new G_({...j(this._def),innerType:this,defaultValue:$,typeName:R.ZodDefault})}brand(){return new U_({typeName:R.ZodBranded,type:this,...j(this._def)})}catch(_){let $=typeof _==="function"?_:()=>_;return new J_({...j(this._def),innerType:this,catchValue:$,typeName:R.ZodCatch})}describe(_){return new this.constructor({...this._def,description:_})}pipe(_){return b_.create(this,_)}readonly(){return M_.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var E$=/^c[^\s-]{8,}$/i,R$=/^[0-9a-z]+$/,j$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,b$=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,v$=/^[a-z0-9_-]{21}$/i,O$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,A$=/^[-+]?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)?)??$/,L$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,U$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",h_,V$=/^(?:(?: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])$/,N$=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,D$=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,F$=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,K$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,k$=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,n_="((\\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])))",g$=new RegExp(`^${n_}$`);function y_(_){let $="[0-5]\\d";if(_.precision)$=`${$}\\.\\d{${_.precision}}`;else if(_.precision==null)$=`${$}(\\.\\d+)?`;let S=_.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${$})${S}`}function C$(_){return new RegExp(`^${y_(_)}$`)}function x_(_){let $=`${n_}T${y_(_)}`,S=[];if(S.push(_.local?"Z?":"Z"),_.offset)S.push("([+-]\\d{2}:?\\d{2})");return $=`${$}(${S.join("|")})`,new RegExp(`^${$}$`)}function h$(_,$){if(($==="v4"||!$)&&V$.test(_))return!0;if(($==="v6"||!$)&&D$.test(_))return!0;return!1}function I$(_,$){if(!O$.test(_))return!1;try{let[S]=_.split(".");if(!S)return!1;let f=S.replace(/-/g,"+").replace(/_/g,"/").padEnd(S.length+(4-S.length%4)%4,"="),H=JSON.parse(atob(f));if(typeof H!=="object"||H===null)return!1;if("typ"in H&&H?.typ!=="JWT")return!1;if(!H.alg)return!1;if($&&H.alg!==$)return!1;return!0}catch{return!1}}function P$(_,$){if(($==="v4"||!$)&&N$.test(_))return!0;if(($==="v6"||!$)&&F$.test(_))return!0;return!1}class F extends b{_parse(_){if(this._def.coerce)_.data=String(_.data);if(this._getType(_)!==M.string){let H=this._getOrReturnCtx(_);return Q(H,{code:J.invalid_type,expected:M.string,received:H.parsedType}),Y}let S=new U,f=void 0;for(let H of this._def.checks)if(H.kind==="min"){if(_.data.length<H.value)f=this._getOrReturnCtx(_,f),Q(f,{code:J.too_small,minimum:H.value,type:"string",inclusive:!0,exact:!1,message:H.message}),S.dirty()}else if(H.kind==="max"){if(_.data.length>H.value)f=this._getOrReturnCtx(_,f),Q(f,{code:J.too_big,maximum:H.value,type:"string",inclusive:!0,exact:!1,message:H.message}),S.dirty()}else if(H.kind==="length"){let w=_.data.length>H.value,q=_.data.length<H.value;if(w||q){if(f=this._getOrReturnCtx(_,f),w)Q(f,{code:J.too_big,maximum:H.value,type:"string",inclusive:!0,exact:!0,message:H.message});else if(q)Q(f,{code:J.too_small,minimum:H.value,type:"string",inclusive:!0,exact:!0,message:H.message});S.dirty()}}else if(H.kind==="email"){if(!L$.test(_.data))f=this._getOrReturnCtx(_,f),Q(f,{validation:"email",code:J.invalid_string,message:H.message}),S.dirty()}else if(H.kind==="emoji"){if(!h_)h_=new RegExp(U$,"u");if(!h_.test(_.data))f=this._getOrReturnCtx(_,f),Q(f,{validation:"emoji",code:J.invalid_string,message:H.message}),S.dirty()}else if(H.kind==="uuid"){if(!b$.test(_.data))f=this._getOrReturnCtx(_,f),Q(f,{validation:"uuid",code:J.invalid_string,message:H.message}),S.dirty()}else if(H.kind==="nanoid"){if(!v$.test(_.data))f=this._getOrReturnCtx(_,f),Q(f,{validation:"nanoid",code:J.invalid_string,message:H.message}),S.dirty()}else if(H.kind==="cuid"){if(!E$.test(_.data))f=this._getOrReturnCtx(_,f),Q(f,{validation:"cuid",code:J.invalid_string,message:H.message}),S.dirty()}else if(H.kind==="cuid2"){if(!R$.test(_.data))f=this._getOrReturnCtx(_,f),Q(f,{validation:"cuid2",code:J.invalid_string,message:H.message}),S.dirty()}else if(H.kind==="ulid"){if(!j$.test(_.data))f=this._getOrReturnCtx(_,f),Q(f,{validation:"ulid",code:J.invalid_string,message:H.message}),S.dirty()}else if(H.kind==="url")try{new URL(_.data)}catch{f=this._getOrReturnCtx(_,f),Q(f,{validation:"url",code:J.invalid_string,message:H.message}),S.dirty()}else if(H.kind==="regex"){if(H.regex.lastIndex=0,!H.regex.test(_.data))f=this._getOrReturnCtx(_,f),Q(f,{validation:"regex",code:J.invalid_string,message:H.message}),S.dirty()}else if(H.kind==="trim")_.data=_.data.trim();else if(H.kind==="includes"){if(!_.data.includes(H.value,H.position))f=this._getOrReturnCtx(_,f),Q(f,{code:J.invalid_string,validation:{includes:H.value,position:H.position},message:H.message}),S.dirty()}else if(H.kind==="toLowerCase")_.data=_.data.toLowerCase();else if(H.kind==="toUpperCase")_.data=_.data.toUpperCase();else if(H.kind==="startsWith"){if(!_.data.startsWith(H.value))f=this._getOrReturnCtx(_,f),Q(f,{code:J.invalid_string,validation:{startsWith:H.value},message:H.message}),S.dirty()}else if(H.kind==="endsWith"){if(!_.data.endsWith(H.value))f=this._getOrReturnCtx(_,f),Q(f,{code:J.invalid_string,validation:{endsWith:H.value},message:H.message}),S.dirty()}else if(H.kind==="datetime"){if(!x_(H).test(_.data))f=this._getOrReturnCtx(_,f),Q(f,{code:J.invalid_string,validation:"datetime",message:H.message}),S.dirty()}else if(H.kind==="date"){if(!g$.test(_.data))f=this._getOrReturnCtx(_,f),Q(f,{code:J.invalid_string,validation:"date",message:H.message}),S.dirty()}else if(H.kind==="time"){if(!C$(H).test(_.data))f=this._getOrReturnCtx(_,f),Q(f,{code:J.invalid_string,validation:"time",message:H.message}),S.dirty()}else if(H.kind==="duration"){if(!A$.test(_.data))f=this._getOrReturnCtx(_,f),Q(f,{validation:"duration",code:J.invalid_string,message:H.message}),S.dirty()}else if(H.kind==="ip"){if(!h$(_.data,H.version))f=this._getOrReturnCtx(_,f),Q(f,{validation:"ip",code:J.invalid_string,message:H.message}),S.dirty()}else if(H.kind==="jwt"){if(!I$(_.data,H.alg))f=this._getOrReturnCtx(_,f),Q(f,{validation:"jwt",code:J.invalid_string,message:H.message}),S.dirty()}else if(H.kind==="cidr"){if(!P$(_.data,H.version))f=this._getOrReturnCtx(_,f),Q(f,{validation:"cidr",code:J.invalid_string,message:H.message}),S.dirty()}else if(H.kind==="base64"){if(!K$.test(_.data))f=this._getOrReturnCtx(_,f),Q(f,{validation:"base64",code:J.invalid_string,message:H.message}),S.dirty()}else if(H.kind==="base64url"){if(!k$.test(_.data))f=this._getOrReturnCtx(_,f),Q(f,{validation:"base64url",code:J.invalid_string,message:H.message}),S.dirty()}else v.assertNever(H);return{status:S.value,value:_.data}}_regex(_,$,S){return this.refinement((f)=>_.test(f),{validation:$,code:J.invalid_string,...z.errToObj(S)})}_addCheck(_){return new F({...this._def,checks:[...this._def.checks,_]})}email(_){return this._addCheck({kind:"email",...z.errToObj(_)})}url(_){return this._addCheck({kind:"url",...z.errToObj(_)})}emoji(_){return this._addCheck({kind:"emoji",...z.errToObj(_)})}uuid(_){return this._addCheck({kind:"uuid",...z.errToObj(_)})}nanoid(_){return this._addCheck({kind:"nanoid",...z.errToObj(_)})}cuid(_){return this._addCheck({kind:"cuid",...z.errToObj(_)})}cuid2(_){return this._addCheck({kind:"cuid2",...z.errToObj(_)})}ulid(_){return this._addCheck({kind:"ulid",...z.errToObj(_)})}base64(_){return this._addCheck({kind:"base64",...z.errToObj(_)})}base64url(_){return this._addCheck({kind:"base64url",...z.errToObj(_)})}jwt(_){return this._addCheck({kind:"jwt",...z.errToObj(_)})}ip(_){return this._addCheck({kind:"ip",...z.errToObj(_)})}cidr(_){return this._addCheck({kind:"cidr",...z.errToObj(_)})}datetime(_){if(typeof _==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:_});return this._addCheck({kind:"datetime",precision:typeof _?.precision>"u"?null:_?.precision,offset:_?.offset??!1,local:_?.local??!1,...z.errToObj(_?.message)})}date(_){return this._addCheck({kind:"date",message:_})}time(_){if(typeof _==="string")return this._addCheck({kind:"time",precision:null,message:_});return this._addCheck({kind:"time",precision:typeof _?.precision>"u"?null:_?.precision,...z.errToObj(_?.message)})}duration(_){return this._addCheck({kind:"duration",...z.errToObj(_)})}regex(_,$){return this._addCheck({kind:"regex",regex:_,...z.errToObj($)})}includes(_,$){return this._addCheck({kind:"includes",value:_,position:$?.position,...z.errToObj($?.message)})}startsWith(_,$){return this._addCheck({kind:"startsWith",value:_,...z.errToObj($)})}endsWith(_,$){return this._addCheck({kind:"endsWith",value:_,...z.errToObj($)})}min(_,$){return this._addCheck({kind:"min",value:_,...z.errToObj($)})}max(_,$){return this._addCheck({kind:"max",value:_,...z.errToObj($)})}length(_,$){return this._addCheck({kind:"length",value:_,...z.errToObj($)})}nonempty(_){return this.min(1,z.errToObj(_))}trim(){return new F({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new F({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new F({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((_)=>_.kind==="datetime")}get isDate(){return!!this._def.checks.find((_)=>_.kind==="date")}get isTime(){return!!this._def.checks.find((_)=>_.kind==="time")}get isDuration(){return!!this._def.checks.find((_)=>_.kind==="duration")}get isEmail(){return!!this._def.checks.find((_)=>_.kind==="email")}get isURL(){return!!this._def.checks.find((_)=>_.kind==="url")}get isEmoji(){return!!this._def.checks.find((_)=>_.kind==="emoji")}get isUUID(){return!!this._def.checks.find((_)=>_.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((_)=>_.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((_)=>_.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((_)=>_.kind==="cuid2")}get isULID(){return!!this._def.checks.find((_)=>_.kind==="ulid")}get isIP(){return!!this._def.checks.find((_)=>_.kind==="ip")}get isCIDR(){return!!this._def.checks.find((_)=>_.kind==="cidr")}get isBase64(){return!!this._def.checks.find((_)=>_.kind==="base64")}get isBase64url(){return!!this._def.checks.find((_)=>_.kind==="base64url")}get minLength(){let _=null;for(let $ of this._def.checks)if($.kind==="min"){if(_===null||$.value>_)_=$.value}return _}get maxLength(){let _=null;for(let $ of this._def.checks)if($.kind==="max"){if(_===null||$.value<_)_=$.value}return _}}F.create=(_)=>{return new F({checks:[],typeName:R.ZodString,coerce:_?.coerce??!1,...j(_)})};function l$(_,$){let S=(_.toString().split(".")[1]||"").length,f=($.toString().split(".")[1]||"").length,H=S>f?S:f,w=Number.parseInt(_.toFixed(H).replace(".","")),q=Number.parseInt($.toFixed(H).replace(".",""));return w%q/10**H}class x extends b{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(_){if(this._def.coerce)_.data=Number(_.data);if(this._getType(_)!==M.number){let H=this._getOrReturnCtx(_);return Q(H,{code:J.invalid_type,expected:M.number,received:H.parsedType}),Y}let S=void 0,f=new U;for(let H of this._def.checks)if(H.kind==="int"){if(!v.isInteger(_.data))S=this._getOrReturnCtx(_,S),Q(S,{code:J.invalid_type,expected:"integer",received:"float",message:H.message}),f.dirty()}else if(H.kind==="min"){if(H.inclusive?_.data<H.value:_.data<=H.value)S=this._getOrReturnCtx(_,S),Q(S,{code:J.too_small,minimum:H.value,type:"number",inclusive:H.inclusive,exact:!1,message:H.message}),f.dirty()}else if(H.kind==="max"){if(H.inclusive?_.data>H.value:_.data>=H.value)S=this._getOrReturnCtx(_,S),Q(S,{code:J.too_big,maximum:H.value,type:"number",inclusive:H.inclusive,exact:!1,message:H.message}),f.dirty()}else if(H.kind==="multipleOf"){if(l$(_.data,H.value)!==0)S=this._getOrReturnCtx(_,S),Q(S,{code:J.not_multiple_of,multipleOf:H.value,message:H.message}),f.dirty()}else if(H.kind==="finite"){if(!Number.isFinite(_.data))S=this._getOrReturnCtx(_,S),Q(S,{code:J.not_finite,message:H.message}),f.dirty()}else v.assertNever(H);return{status:f.value,value:_.data}}gte(_,$){return this.setLimit("min",_,!0,z.toString($))}gt(_,$){return this.setLimit("min",_,!1,z.toString($))}lte(_,$){return this.setLimit("max",_,!0,z.toString($))}lt(_,$){return this.setLimit("max",_,!1,z.toString($))}setLimit(_,$,S,f){return new x({...this._def,checks:[...this._def.checks,{kind:_,value:$,inclusive:S,message:z.toString(f)}]})}_addCheck(_){return new x({...this._def,checks:[...this._def.checks,_]})}int(_){return this._addCheck({kind:"int",message:z.toString(_)})}positive(_){return this._addCheck({kind:"min",value:0,inclusive:!1,message:z.toString(_)})}negative(_){return this._addCheck({kind:"max",value:0,inclusive:!1,message:z.toString(_)})}nonpositive(_){return this._addCheck({kind:"max",value:0,inclusive:!0,message:z.toString(_)})}nonnegative(_){return this._addCheck({kind:"min",value:0,inclusive:!0,message:z.toString(_)})}multipleOf(_,$){return this._addCheck({kind:"multipleOf",value:_,message:z.toString($)})}finite(_){return this._addCheck({kind:"finite",message:z.toString(_)})}safe(_){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:z.toString(_)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:z.toString(_)})}get minValue(){let _=null;for(let $ of this._def.checks)if($.kind==="min"){if(_===null||$.value>_)_=$.value}return _}get maxValue(){let _=null;for(let $ of this._def.checks)if($.kind==="max"){if(_===null||$.value<_)_=$.value}return _}get isInt(){return!!this._def.checks.find((_)=>_.kind==="int"||_.kind==="multipleOf"&&v.isInteger(_.value))}get isFinite(){let _=null,$=null;for(let S of this._def.checks)if(S.kind==="finite"||S.kind==="int"||S.kind==="multipleOf")return!0;else if(S.kind==="min"){if($===null||S.value>$)$=S.value}else if(S.kind==="max"){if(_===null||S.value<_)_=S.value}return Number.isFinite($)&&Number.isFinite(_)}}x.create=(_)=>{return new x({checks:[],typeName:R.ZodNumber,coerce:_?.coerce||!1,...j(_)})};class c extends b{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(_){if(this._def.coerce)try{_.data=BigInt(_.data)}catch{return this._getInvalidInput(_)}if(this._getType(_)!==M.bigint)return this._getInvalidInput(_);let S=void 0,f=new U;for(let H of this._def.checks)if(H.kind==="min"){if(H.inclusive?_.data<H.value:_.data<=H.value)S=this._getOrReturnCtx(_,S),Q(S,{code:J.too_small,type:"bigint",minimum:H.value,inclusive:H.inclusive,message:H.message}),f.dirty()}else if(H.kind==="max"){if(H.inclusive?_.data>H.value:_.data>=H.value)S=this._getOrReturnCtx(_,S),Q(S,{code:J.too_big,type:"bigint",maximum:H.value,inclusive:H.inclusive,message:H.message}),f.dirty()}else if(H.kind==="multipleOf"){if(_.data%H.value!==BigInt(0))S=this._getOrReturnCtx(_,S),Q(S,{code:J.not_multiple_of,multipleOf:H.value,message:H.message}),f.dirty()}else v.assertNever(H);return{status:f.value,value:_.data}}_getInvalidInput(_){let $=this._getOrReturnCtx(_);return Q($,{code:J.invalid_type,expected:M.bigint,received:$.parsedType}),Y}gte(_,$){return this.setLimit("min",_,!0,z.toString($))}gt(_,$){return this.setLimit("min",_,!1,z.toString($))}lte(_,$){return this.setLimit("max",_,!0,z.toString($))}lt(_,$){return this.setLimit("max",_,!1,z.toString($))}setLimit(_,$,S,f){return new c({...this._def,checks:[...this._def.checks,{kind:_,value:$,inclusive:S,message:z.toString(f)}]})}_addCheck(_){return new c({...this._def,checks:[...this._def.checks,_]})}positive(_){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:z.toString(_)})}negative(_){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:z.toString(_)})}nonpositive(_){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:z.toString(_)})}nonnegative(_){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:z.toString(_)})}multipleOf(_,$){return this._addCheck({kind:"multipleOf",value:_,message:z.toString($)})}get minValue(){let _=null;for(let $ of this._def.checks)if($.kind==="min"){if(_===null||$.value>_)_=$.value}return _}get maxValue(){let _=null;for(let $ of this._def.checks)if($.kind==="max"){if(_===null||$.value<_)_=$.value}return _}}c.create=(_)=>{return new c({checks:[],typeName:R.ZodBigInt,coerce:_?.coerce??!1,...j(_)})};class $_ extends b{_parse(_){if(this._def.coerce)_.data=Boolean(_.data);if(this._getType(_)!==M.boolean){let S=this._getOrReturnCtx(_);return Q(S,{code:J.invalid_type,expected:M.boolean,received:S.parsedType}),Y}return N(_.data)}}$_.create=(_)=>{return new $_({typeName:R.ZodBoolean,coerce:_?.coerce||!1,...j(_)})};class i extends b{_parse(_){if(this._def.coerce)_.data=new Date(_.data);if(this._getType(_)!==M.date){let H=this._getOrReturnCtx(_);return Q(H,{code:J.invalid_type,expected:M.date,received:H.parsedType}),Y}if(Number.isNaN(_.data.getTime())){let H=this._getOrReturnCtx(_);return Q(H,{code:J.invalid_date}),Y}let S=new U,f=void 0;for(let H of this._def.checks)if(H.kind==="min"){if(_.data.getTime()<H.value)f=this._getOrReturnCtx(_,f),Q(f,{code:J.too_small,message:H.message,inclusive:!0,exact:!1,minimum:H.value,type:"date"}),S.dirty()}else if(H.kind==="max"){if(_.data.getTime()>H.value)f=this._getOrReturnCtx(_,f),Q(f,{code:J.too_big,message:H.message,inclusive:!0,exact:!1,maximum:H.value,type:"date"}),S.dirty()}else v.assertNever(H);return{status:S.value,value:new Date(_.data.getTime())}}_addCheck(_){return new i({...this._def,checks:[...this._def.checks,_]})}min(_,$){return this._addCheck({kind:"min",value:_.getTime(),message:z.toString($)})}max(_,$){return this._addCheck({kind:"max",value:_.getTime(),message:z.toString($)})}get minDate(){let _=null;for(let $ of this._def.checks)if($.kind==="min"){if(_===null||$.value>_)_=$.value}return _!=null?new Date(_):null}get maxDate(){let _=null;for(let $ of this._def.checks)if($.kind==="max"){if(_===null||$.value<_)_=$.value}return _!=null?new Date(_):null}}i.create=(_)=>{return new i({checks:[],coerce:_?.coerce||!1,typeName:R.ZodDate,...j(_)})};class Y_ extends b{_parse(_){if(this._getType(_)!==M.symbol){let S=this._getOrReturnCtx(_);return Q(S,{code:J.invalid_type,expected:M.symbol,received:S.parsedType}),Y}return N(_.data)}}Y_.create=(_)=>{return new Y_({typeName:R.ZodSymbol,...j(_)})};class S_ extends b{_parse(_){if(this._getType(_)!==M.undefined){let S=this._getOrReturnCtx(_);return Q(S,{code:J.invalid_type,expected:M.undefined,received:S.parsedType}),Y}return N(_.data)}}S_.create=(_)=>{return new S_({typeName:R.ZodUndefined,...j(_)})};class H_ extends b{_parse(_){if(this._getType(_)!==M.null){let S=this._getOrReturnCtx(_);return Q(S,{code:J.invalid_type,expected:M.null,received:S.parsedType}),Y}return N(_.data)}}H_.create=(_)=>{return new H_({typeName:R.ZodNull,...j(_)})};class u extends b{constructor(){super(...arguments);this._any=!0}_parse(_){return N(_.data)}}u.create=(_)=>{return new u({typeName:R.ZodAny,...j(_)})};class y extends b{constructor(){super(...arguments);this._unknown=!0}_parse(_){return N(_.data)}}y.create=(_)=>{return new y({typeName:R.ZodUnknown,...j(_)})};class I extends b{_parse(_){let $=this._getOrReturnCtx(_);return Q($,{code:J.invalid_type,expected:M.never,received:$.parsedType}),Y}}I.create=(_)=>{return new I({typeName:R.ZodNever,...j(_)})};class B_ extends b{_parse(_){if(this._getType(_)!==M.undefined){let S=this._getOrReturnCtx(_);return Q(S,{code:J.invalid_type,expected:M.void,received:S.parsedType}),Y}return N(_.data)}}B_.create=(_)=>{return new B_({typeName:R.ZodVoid,...j(_)})};class K extends b{_parse(_){let{ctx:$,status:S}=this._processInputParams(_),f=this._def;if($.parsedType!==M.array)return Q($,{code:J.invalid_type,expected:M.array,received:$.parsedType}),Y;if(f.exactLength!==null){let w=$.data.length>f.exactLength.value,q=$.data.length<f.exactLength.value;if(w||q)Q($,{code:w?J.too_big:J.too_small,minimum:q?f.exactLength.value:void 0,maximum:w?f.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:f.exactLength.message}),S.dirty()}if(f.minLength!==null){if($.data.length<f.minLength.value)Q($,{code:J.too_small,minimum:f.minLength.value,type:"array",inclusive:!0,exact:!1,message:f.minLength.message}),S.dirty()}if(f.maxLength!==null){if($.data.length>f.maxLength.value)Q($,{code:J.too_big,maximum:f.maxLength.value,type:"array",inclusive:!0,exact:!1,message:f.maxLength.message}),S.dirty()}if($.common.async)return Promise.all([...$.data].map((w,q)=>{return f.type._parseAsync(new g($,w,$.path,q))})).then((w)=>{return U.mergeArray(S,w)});let H=[...$.data].map((w,q)=>{return f.type._parseSync(new g($,w,$.path,q))});return U.mergeArray(S,H)}get element(){return this._def.type}min(_,$){return new K({...this._def,minLength:{value:_,message:z.toString($)}})}max(_,$){return new K({...this._def,maxLength:{value:_,message:z.toString($)}})}length(_,$){return new K({...this._def,exactLength:{value:_,message:z.toString($)}})}nonempty(_){return this.min(1,_)}}K.create=(_,$)=>{return new K({type:_,minLength:null,maxLength:null,exactLength:null,typeName:R.ZodArray,...j($)})};function e(_){if(_ instanceof O){let $={};for(let S in _.shape){let f=_.shape[S];$[S]=k.create(e(f))}return new O({..._._def,shape:()=>$})}else if(_ instanceof K)return new K({..._._def,type:e(_.element)});else if(_ instanceof k)return k.create(e(_.unwrap()));else if(_ instanceof T)return T.create(e(_.unwrap()));else if(_ instanceof P)return P.create(_.items.map(($)=>e($)));else return _}class O extends b{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let _=this._def.shape(),$=v.objectKeys(_);return this._cached={shape:_,keys:$},this._cached}_parse(_){if(this._getType(_)!==M.object){let G=this._getOrReturnCtx(_);return Q(G,{code:J.invalid_type,expected:M.object,received:G.parsedType}),Y}let{status:S,ctx:f}=this._processInputParams(_),{shape:H,keys:w}=this._getCached(),q=[];if(!(this._def.catchall instanceof I&&this._def.unknownKeys==="strip")){for(let G in f.data)if(!w.includes(G))q.push(G)}let X=[];for(let G of w){let B=H[G],E=f.data[G];X.push({key:{status:"valid",value:G},value:B._parse(new g(f,E,f.path,G)),alwaysSet:G in f.data})}if(this._def.catchall instanceof I){let G=this._def.unknownKeys;if(G==="passthrough")for(let B of q)X.push({key:{status:"valid",value:B},value:{status:"valid",value:f.data[B]}});else if(G==="strict"){if(q.length>0)Q(f,{code:J.unrecognized_keys,keys:q}),S.dirty()}else if(G==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let G=this._def.catchall;for(let B of q){let E=f.data[B];X.push({key:{status:"valid",value:B},value:G._parse(new g(f,E,f.path,B)),alwaysSet:B in f.data})}}if(f.common.async)return Promise.resolve().then(async()=>{let G=[];for(let B of X){let E=await B.key,A=await B.value;G.push({key:E,value:A,alwaysSet:B.alwaysSet})}return G}).then((G)=>{return U.mergeObjectSync(S,G)});else return U.mergeObjectSync(S,X)}get shape(){return this._def.shape()}strict(_){return z.errToObj,new O({...this._def,unknownKeys:"strict",..._!==void 0?{errorMap:($,S)=>{let f=this._def.errorMap?.($,S).message??S.defaultError;if($.code==="unrecognized_keys")return{message:z.errToObj(_).message??f};return{message:f}}}:{}})}strip(){return new O({...this._def,unknownKeys:"strip"})}passthrough(){return new O({...this._def,unknownKeys:"passthrough"})}extend(_){return new O({...this._def,shape:()=>({...this._def.shape(),..._})})}merge(_){return new O({unknownKeys:_._def.unknownKeys,catchall:_._def.catchall,shape:()=>({...this._def.shape(),..._._def.shape()}),typeName:R.ZodObject})}setKey(_,$){return this.augment({[_]:$})}catchall(_){return new O({...this._def,catchall:_})}pick(_){let $={};for(let S of v.objectKeys(_))if(_[S]&&this.shape[S])$[S]=this.shape[S];return new O({...this._def,shape:()=>$})}omit(_){let $={};for(let S of v.objectKeys(this.shape))if(!_[S])$[S]=this.shape[S];return new O({...this._def,shape:()=>$})}deepPartial(){return e(this)}partial(_){let $={};for(let S of v.objectKeys(this.shape)){let f=this.shape[S];if(_&&!_[S])$[S]=f;else $[S]=f.optional()}return new O({...this._def,shape:()=>$})}required(_){let $={};for(let S of v.objectKeys(this.shape))if(_&&!_[S])$[S]=this.shape[S];else{let H=this.shape[S];while(H instanceof k)H=H._def.innerType;$[S]=H}return new O({...this._def,shape:()=>$})}keyof(){return c_(v.objectKeys(this.shape))}}O.create=(_,$)=>{return new O({shape:()=>_,unknownKeys:"strip",catchall:I.create(),typeName:R.ZodObject,...j($)})};O.strictCreate=(_,$)=>{return new O({shape:()=>_,unknownKeys:"strict",catchall:I.create(),typeName:R.ZodObject,...j($)})};O.lazycreate=(_,$)=>{return new O({shape:_,unknownKeys:"strip",catchall:I.create(),typeName:R.ZodObject,...j($)})};class f_ extends b{_parse(_){let{ctx:$}=this._processInputParams(_),S=this._def.options;function f(H){for(let q of H)if(q.result.status==="valid")return q.result;for(let q of H)if(q.result.status==="dirty")return $.common.issues.push(...q.ctx.common.issues),q.result;let w=H.map((q)=>new D(q.ctx.common.issues));return Q($,{code:J.invalid_union,unionErrors:w}),Y}if($.common.async)return Promise.all(S.map(async(H)=>{let w={...$,common:{...$.common,issues:[]},parent:null};return{result:await H._parseAsync({data:$.data,path:$.path,parent:w}),ctx:w}})).then(f);else{let H=void 0,w=[];for(let X of S){let G={...$,common:{...$.common,issues:[]},parent:null},B=X._parseSync({data:$.data,path:$.path,parent:G});if(B.status==="valid")return B;else if(B.status==="dirty"&&!H)H={result:B,ctx:G};if(G.common.issues.length)w.push(G.common.issues)}if(H)return $.common.issues.push(...H.ctx.common.issues),H.result;let q=w.map((X)=>new D(X));return Q($,{code:J.invalid_union,unionErrors:q}),Y}}get options(){return this._def.options}}f_.create=(_,$)=>{return new f_({options:_,typeName:R.ZodUnion,...j($)})};var m=(_)=>{if(_ instanceof w_)return m(_.schema);else if(_ instanceof C)return m(_.innerType());else if(_ instanceof W_)return[_.value];else if(_ instanceof Z)return _.options;else if(_ instanceof X_)return v.objectValues(_.enum);else if(_ instanceof G_)return m(_._def.innerType);else if(_ instanceof S_)return[void 0];else if(_ instanceof H_)return[null];else if(_ instanceof k)return[void 0,...m(_.unwrap())];else if(_ instanceof T)return[null,...m(_.unwrap())];else if(_ instanceof U_)return m(_.unwrap());else if(_ instanceof M_)return m(_.unwrap());else if(_ instanceof J_)return m(_._def.innerType);else return[]};class L_ extends b{_parse(_){let{ctx:$}=this._processInputParams(_);if($.parsedType!==M.object)return Q($,{code:J.invalid_type,expected:M.object,received:$.parsedType}),Y;let S=this.discriminator,f=$.data[S],H=this.optionsMap.get(f);if(!H)return Q($,{code:J.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[S]}),Y;if($.common.async)return H._parseAsync({data:$.data,path:$.path,parent:$});else return H._parseSync({data:$.data,path:$.path,parent:$})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(_,$,S){let f=new Map;for(let H of $){let w=m(H.shape[_]);if(!w.length)throw Error(`A discriminator value for key \`${_}\` could not be extracted from all schema options`);for(let q of w){if(f.has(q))throw Error(`Discriminator property ${String(_)} has duplicate value ${String(q)}`);f.set(q,H)}}return new L_({typeName:R.ZodDiscriminatedUnion,discriminator:_,options:$,optionsMap:f,...j(S)})}}function I_(_,$){let S=h(_),f=h($);if(_===$)return{valid:!0,data:_};else if(S===M.object&&f===M.object){let H=v.objectKeys($),w=v.objectKeys(_).filter((X)=>H.indexOf(X)!==-1),q={..._,...$};for(let X of w){let G=I_(_[X],$[X]);if(!G.valid)return{valid:!1};q[X]=G.data}return{valid:!0,data:q}}else if(S===M.array&&f===M.array){if(_.length!==$.length)return{valid:!1};let H=[];for(let w=0;w<_.length;w++){let q=_[w],X=$[w],G=I_(q,X);if(!G.valid)return{valid:!1};H.push(G.data)}return{valid:!0,data:H}}else if(S===M.date&&f===M.date&&+_===+$)return{valid:!0,data:_};else return{valid:!1}}class q_ extends b{_parse(_){let{status:$,ctx:S}=this._processInputParams(_),f=(H,w)=>{if(O_(H)||O_(w))return Y;let q=I_(H.value,w.value);if(!q.valid)return Q(S,{code:J.invalid_intersection_types}),Y;if(A_(H)||A_(w))$.dirty();return{status:$.value,value:q.data}};if(S.common.async)return Promise.all([this._def.left._parseAsync({data:S.data,path:S.path,parent:S}),this._def.right._parseAsync({data:S.data,path:S.path,parent:S})]).then(([H,w])=>f(H,w));else return f(this._def.left._parseSync({data:S.data,path:S.path,parent:S}),this._def.right._parseSync({data:S.data,path:S.path,parent:S}))}}q_.create=(_,$,S)=>{return new q_({left:_,right:$,typeName:R.ZodIntersection,...j(S)})};class P extends b{_parse(_){let{status:$,ctx:S}=this._processInputParams(_);if(S.parsedType!==M.array)return Q(S,{code:J.invalid_type,expected:M.array,received:S.parsedType}),Y;if(S.data.length<this._def.items.length)return Q(S,{code:J.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Y;if(!this._def.rest&&S.data.length>this._def.items.length)Q(S,{code:J.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$.dirty();let H=[...S.data].map((w,q)=>{let X=this._def.items[q]||this._def.rest;if(!X)return null;return X._parse(new g(S,w,S.path,q))}).filter((w)=>!!w);if(S.common.async)return Promise.all(H).then((w)=>{return U.mergeArray($,w)});else return U.mergeArray($,H)}get items(){return this._def.items}rest(_){return new P({...this._def,rest:_})}}P.create=(_,$)=>{if(!Array.isArray(_))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new P({items:_,typeName:R.ZodTuple,rest:null,...j($)})};class E_ extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(_){let{status:$,ctx:S}=this._processInputParams(_);if(S.parsedType!==M.object)return Q(S,{code:J.invalid_type,expected:M.object,received:S.parsedType}),Y;let f=[],H=this._def.keyType,w=this._def.valueType;for(let q in S.data)f.push({key:H._parse(new g(S,q,S.path,q)),value:w._parse(new g(S,S.data[q],S.path,q)),alwaysSet:q in S.data});if(S.common.async)return U.mergeObjectAsync($,f);else return U.mergeObjectSync($,f)}get element(){return this._def.valueType}static create(_,$,S){if($ instanceof b)return new E_({keyType:_,valueType:$,typeName:R.ZodRecord,...j(S)});return new E_({keyType:F.create(),valueType:_,typeName:R.ZodRecord,...j($)})}}class R_ extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(_){let{status:$,ctx:S}=this._processInputParams(_);if(S.parsedType!==M.map)return Q(S,{code:J.invalid_type,expected:M.map,received:S.parsedType}),Y;let f=this._def.keyType,H=this._def.valueType,w=[...S.data.entries()].map(([q,X],G)=>{return{key:f._parse(new g(S,q,S.path,[G,"key"])),value:H._parse(new g(S,X,S.path,[G,"value"]))}});if(S.common.async){let q=new Map;return Promise.resolve().then(async()=>{for(let X of w){let G=await X.key,B=await X.value;if(G.status==="aborted"||B.status==="aborted")return Y;if(G.status==="dirty"||B.status==="dirty")$.dirty();q.set(G.value,B.value)}return{status:$.value,value:q}})}else{let q=new Map;for(let X of w){let{key:G,value:B}=X;if(G.status==="aborted"||B.status==="aborted")return Y;if(G.status==="dirty"||B.status==="dirty")$.dirty();q.set(G.value,B.value)}return{status:$.value,value:q}}}}R_.create=(_,$,S)=>{return new R_({valueType:$,keyType:_,typeName:R.ZodMap,...j(S)})};class p extends b{_parse(_){let{status:$,ctx:S}=this._processInputParams(_);if(S.parsedType!==M.set)return Q(S,{code:J.invalid_type,expected:M.set,received:S.parsedType}),Y;let f=this._def;if(f.minSize!==null){if(S.data.size<f.minSize.value)Q(S,{code:J.too_small,minimum:f.minSize.value,type:"set",inclusive:!0,exact:!1,message:f.minSize.message}),$.dirty()}if(f.maxSize!==null){if(S.data.size>f.maxSize.value)Q(S,{code:J.too_big,maximum:f.maxSize.value,type:"set",inclusive:!0,exact:!1,message:f.maxSize.message}),$.dirty()}let H=this._def.valueType;function w(X){let G=new Set;for(let B of X){if(B.status==="aborted")return Y;if(B.status==="dirty")$.dirty();G.add(B.value)}return{status:$.value,value:G}}let q=[...S.data.values()].map((X,G)=>H._parse(new g(S,X,S.path,G)));if(S.common.async)return Promise.all(q).then((X)=>w(X));else return w(q)}min(_,$){return new p({...this._def,minSize:{value:_,message:z.toString($)}})}max(_,$){return new p({...this._def,maxSize:{value:_,message:z.toString($)}})}size(_,$){return this.min(_,$).max(_,$)}nonempty(_){return this.min(1,_)}}p.create=(_,$)=>{return new p({valueType:_,minSize:null,maxSize:null,typeName:R.ZodSet,...j($)})};class __ extends b{constructor(){super(...arguments);this.validate=this.implement}_parse(_){let{ctx:$}=this._processInputParams(_);if($.parsedType!==M.function)return Q($,{code:J.invalid_type,expected:M.function,received:$.parsedType}),Y;function S(q,X){return z_({data:q,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,t(),l].filter((G)=>!!G),issueData:{code:J.invalid_arguments,argumentsError:X}})}function f(q,X){return z_({data:q,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,t(),l].filter((G)=>!!G),issueData:{code:J.invalid_return_type,returnTypeError:X}})}let H={errorMap:$.common.contextualErrorMap},w=$.data;if(this._def.returns instanceof d){let q=this;return N(async function(...X){let G=new D([]),B=await q._def.args.parseAsync(X,H).catch((V)=>{throw G.addIssue(S(X,V)),G}),E=await Reflect.apply(w,this,B);return await q._def.returns._def.type.parseAsync(E,H).catch((V)=>{throw G.addIssue(f(E,V)),G})})}else{let q=this;return N(function(...X){let G=q._def.args.safeParse(X,H);if(!G.success)throw new D([S(X,G.error)]);let B=Reflect.apply(w,this,G.data),E=q._def.returns.safeParse(B,H);if(!E.success)throw new D([f(B,E.error)]);return E.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(..._){return new __({...this._def,args:P.create(_).rest(y.create())})}returns(_){return new __({...this._def,returns:_})}implement(_){return this.parse(_)}strictImplement(_){return this.parse(_)}static create(_,$,S){return new __({args:_?_:P.create([]).rest(y.create()),returns:$||y.create(),typeName:R.ZodFunction,...j(S)})}}class w_ extends b{get schema(){return this._def.getter()}_parse(_){let{ctx:$}=this._processInputParams(_);return this._def.getter()._parse({data:$.data,path:$.path,parent:$})}}w_.create=(_,$)=>{return new w_({getter:_,typeName:R.ZodLazy,...j($)})};class W_ extends b{_parse(_){if(_.data!==this._def.value){let $=this._getOrReturnCtx(_);return Q($,{received:$.data,code:J.invalid_literal,expected:this._def.value}),Y}return{status:"valid",value:_.data}}get value(){return this._def.value}}W_.create=(_,$)=>{return new W_({value:_,typeName:R.ZodLiteral,...j($)})};function c_(_,$){return new Z({values:_,typeName:R.ZodEnum,...j($)})}class Z extends b{_parse(_){if(typeof _.data!=="string"){let $=this._getOrReturnCtx(_),S=this._def.values;return Q($,{expected:v.joinValues(S),received:$.parsedType,code:J.invalid_type}),Y}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(_.data)){let $=this._getOrReturnCtx(_),S=this._def.values;return Q($,{received:$.data,code:J.invalid_enum_value,options:S}),Y}return N(_.data)}get options(){return this._def.values}get enum(){let _={};for(let $ of this._def.values)_[$]=$;return _}get Values(){let _={};for(let $ of this._def.values)_[$]=$;return _}get Enum(){let _={};for(let $ of this._def.values)_[$]=$;return _}extract(_,$=this._def){return Z.create(_,{...this._def,...$})}exclude(_,$=this._def){return Z.create(this.options.filter((S)=>!_.includes(S)),{...this._def,...$})}}Z.create=c_;class X_ extends b{_parse(_){let $=v.getValidEnumValues(this._def.values),S=this._getOrReturnCtx(_);if(S.parsedType!==M.string&&S.parsedType!==M.number){let f=v.objectValues($);return Q(S,{expected:v.joinValues(f),received:S.parsedType,code:J.invalid_type}),Y}if(!this._cache)this._cache=new Set(v.getValidEnumValues(this._def.values));if(!this._cache.has(_.data)){let f=v.objectValues($);return Q(S,{received:S.data,code:J.invalid_enum_value,options:f}),Y}return N(_.data)}get enum(){return this._def.values}}X_.create=(_,$)=>{return new X_({values:_,typeName:R.ZodNativeEnum,...j($)})};class d extends b{unwrap(){return this._def.type}_parse(_){let{ctx:$}=this._processInputParams(_);if($.parsedType!==M.promise&&$.common.async===!1)return Q($,{code:J.invalid_type,expected:M.promise,received:$.parsedType}),Y;let S=$.parsedType===M.promise?$.data:Promise.resolve($.data);return N(S.then((f)=>{return this._def.type.parseAsync(f,{path:$.path,errorMap:$.common.contextualErrorMap})}))}}d.create=(_,$)=>{return new d({type:_,typeName:R.ZodPromise,...j($)})};class C extends b{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===R.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(_){let{status:$,ctx:S}=this._processInputParams(_),f=this._def.effect||null,H={addIssue:(w)=>{if(Q(S,w),w.fatal)$.abort();else $.dirty()},get path(){return S.path}};if(H.addIssue=H.addIssue.bind(H),f.type==="preprocess"){let w=f.transform(S.data,H);if(S.common.async)return Promise.resolve(w).then(async(q)=>{if($.value==="aborted")return Y;let X=await this._def.schema._parseAsync({data:q,path:S.path,parent:S});if(X.status==="aborted")return Y;if(X.status==="dirty")return o(X.value);if($.value==="dirty")return o(X.value);return X});else{if($.value==="aborted")return Y;let q=this._def.schema._parseSync({data:w,path:S.path,parent:S});if(q.status==="aborted")return Y;if(q.status==="dirty")return o(q.value);if($.value==="dirty")return o(q.value);return q}}if(f.type==="refinement"){let w=(q)=>{let X=f.refinement(q,H);if(S.common.async)return Promise.resolve(X);if(X instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return q};if(S.common.async===!1){let q=this._def.schema._parseSync({data:S.data,path:S.path,parent:S});if(q.status==="aborted")return Y;if(q.status==="dirty")$.dirty();return w(q.value),{status:$.value,value:q.value}}else return this._def.schema._parseAsync({data:S.data,path:S.path,parent:S}).then((q)=>{if(q.status==="aborted")return Y;if(q.status==="dirty")$.dirty();return w(q.value).then(()=>{return{status:$.value,value:q.value}})})}if(f.type==="transform")if(S.common.async===!1){let w=this._def.schema._parseSync({data:S.data,path:S.path,parent:S});if(!n(w))return Y;let q=f.transform(w.value,H);if(q instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:$.value,value:q}}else return this._def.schema._parseAsync({data:S.data,path:S.path,parent:S}).then((w)=>{if(!n(w))return Y;return Promise.resolve(f.transform(w.value,H)).then((q)=>({status:$.value,value:q}))});v.assertNever(f)}}C.create=(_,$,S)=>{return new C({schema:_,typeName:R.ZodEffects,effect:$,...j(S)})};C.createWithPreprocess=(_,$,S)=>{return new C({schema:$,effect:{type:"preprocess",transform:_},typeName:R.ZodEffects,...j(S)})};class k extends b{_parse(_){if(this._getType(_)===M.undefined)return N(void 0);return this._def.innerType._parse(_)}unwrap(){return this._def.innerType}}k.create=(_,$)=>{return new k({innerType:_,typeName:R.ZodOptional,...j($)})};class T extends b{_parse(_){if(this._getType(_)===M.null)return N(null);return this._def.innerType._parse(_)}unwrap(){return this._def.innerType}}T.create=(_,$)=>{return new T({innerType:_,typeName:R.ZodNullable,...j($)})};class G_ extends b{_parse(_){let{ctx:$}=this._processInputParams(_),S=$.data;if($.parsedType===M.undefined)S=this._def.defaultValue();return this._def.innerType._parse({data:S,path:$.path,parent:$})}removeDefault(){return this._def.innerType}}G_.create=(_,$)=>{return new G_({innerType:_,typeName:R.ZodDefault,defaultValue:typeof $.default==="function"?$.default:()=>$.default,...j($)})};class J_ extends b{_parse(_){let{ctx:$}=this._processInputParams(_),S={...$,common:{...$.common,issues:[]}},f=this._def.innerType._parse({data:S.data,path:S.path,parent:{...S}});if(s(f))return f.then((H)=>{return{status:"valid",value:H.status==="valid"?H.value:this._def.catchValue({get error(){return new D(S.common.issues)},input:S.data})}});else return{status:"valid",value:f.status==="valid"?f.value:this._def.catchValue({get error(){return new D(S.common.issues)},input:S.data})}}removeCatch(){return this._def.innerType}}J_.create=(_,$)=>{return new J_({innerType:_,typeName:R.ZodCatch,catchValue:typeof $.catch==="function"?$.catch:()=>$.catch,...j($)})};class j_ extends b{_parse(_){if(this._getType(_)!==M.nan){let S=this._getOrReturnCtx(_);return Q(S,{code:J.invalid_type,expected:M.nan,received:S.parsedType}),Y}return{status:"valid",value:_.data}}}j_.create=(_)=>{return new j_({typeName:R.ZodNaN,...j(_)})};var m$=Symbol("zod_brand");class U_ extends b{_parse(_){let{ctx:$}=this._processInputParams(_),S=$.data;return this._def.type._parse({data:S,path:$.path,parent:$})}unwrap(){return this._def.type}}class b_ extends b{_parse(_){let{status:$,ctx:S}=this._processInputParams(_);if(S.common.async)return(async()=>{let H=await this._def.in._parseAsync({data:S.data,path:S.path,parent:S});if(H.status==="aborted")return Y;if(H.status==="dirty")return $.dirty(),o(H.value);else return this._def.out._parseAsync({data:H.value,path:S.path,parent:S})})();else{let f=this._def.in._parseSync({data:S.data,path:S.path,parent:S});if(f.status==="aborted")return Y;if(f.status==="dirty")return $.dirty(),{status:"dirty",value:f.value};else return this._def.out._parseSync({data:f.value,path:S.path,parent:S})}}static create(_,$){return new b_({in:_,out:$,typeName:R.ZodPipeline})}}class M_ extends b{_parse(_){let $=this._def.innerType._parse(_),S=(f)=>{if(n(f))f.value=Object.freeze(f.value);return f};return s($)?$.then((f)=>S(f)):S($)}unwrap(){return this._def.innerType}}M_.create=(_,$)=>{return new M_({innerType:_,typeName:R.ZodReadonly,...j($)})};function T_(_,$){let S=typeof _==="function"?_($):typeof _==="string"?{message:_}:_;return typeof S==="string"?{message:S}:S}function Z_(_,$={},S){if(_)return u.create().superRefine((f,H)=>{let w=_(f);if(w instanceof Promise)return w.then((q)=>{if(!q){let X=T_($,f),G=X.fatal??S??!0;H.addIssue({code:"custom",...X,fatal:G})}});if(!w){let q=T_($,f),X=q.fatal??S??!0;H.addIssue({code:"custom",...q,fatal:X})}return});return u.create()}var T$={object:O.lazycreate},R;(function(_){_.ZodString="ZodString",_.ZodNumber="ZodNumber",_.ZodNaN="ZodNaN",_.ZodBigInt="ZodBigInt",_.ZodBoolean="ZodBoolean",_.ZodDate="ZodDate",_.ZodSymbol="ZodSymbol",_.ZodUndefined="ZodUndefined",_.ZodNull="ZodNull",_.ZodAny="ZodAny",_.ZodUnknown="ZodUnknown",_.ZodNever="ZodNever",_.ZodVoid="ZodVoid",_.ZodArray="ZodArray",_.ZodObject="ZodObject",_.ZodUnion="ZodUnion",_.ZodDiscriminatedUnion="ZodDiscriminatedUnion",_.ZodIntersection="ZodIntersection",_.ZodTuple="ZodTuple",_.ZodRecord="ZodRecord",_.ZodMap="ZodMap",_.ZodSet="ZodSet",_.ZodFunction="ZodFunction",_.ZodLazy="ZodLazy",_.ZodLiteral="ZodLiteral",_.ZodEnum="ZodEnum",_.ZodEffects="ZodEffects",_.ZodNativeEnum="ZodNativeEnum",_.ZodOptional="ZodOptional",_.ZodNullable="ZodNullable",_.ZodDefault="ZodDefault",_.ZodCatch="ZodCatch",_.ZodPromise="ZodPromise",_.ZodBranded="ZodBranded",_.ZodPipeline="ZodPipeline",_.ZodReadonly="ZodReadonly"})(R||(R={}));var n$=(_,$={message:`Input not instance of ${_.name}`})=>Z_((S)=>S instanceof _,$),r_=F.create,o_=x.create,y$=j_.create,x$=c.create,i_=$_.create,c$=i.create,Z$=Y_.create,r$=S_.create,o$=H_.create,i$=u.create,u$=y.create,p$=I.create,d$=B_.create,a$=K.create,t$=O.create,s$=O.strictCreate,e$=f_.create,_S=L_.create,$S=q_.create,SS=P.create,HS=E_.create,fS=R_.create,qS=p.create,wS=__.create,WS=w_.create,XS=W_.create,GS=Z.create,JS=X_.create,MS=d.create,QS=C.create,zS=k.create,YS=T.create,BS=C.createWithPreprocess,ES=b_.create,RS=()=>r_().optional(),jS=()=>o_().optional(),bS=()=>i_().optional(),vS={string:(_)=>F.create({..._,coerce:!0}),number:(_)=>x.create({..._,coerce:!0}),boolean:(_)=>$_.create({..._,coerce:!0}),bigint:(_)=>c.create({..._,coerce:!0}),date:(_)=>i.create({..._,coerce:!0})};var OS=Y;var u_=W.object({mode:W.enum(["dev","prod"]),url:W.string(),route:W.string().optional(),buildId:W.string().optional(),releaseHash:W.string().optional(),framework:W.string().optional()}),V_=W.object({userAgent:W.string(),viewport:W.object({width:W.number(),height:W.number()}).optional(),language:W.string().optional()}),N_=W.object({file:W.string(),line:W.number().optional(),col:W.number().optional(),fn:W.string().optional(),codeSnippet:W.string().optional()}),D_=W.object({method:W.string(),url:W.string(),status:W.number().optional(),durationMs:W.number().optional(),requestBodySize:W.number().optional(),responseBodySize:W.number().optional(),requestHeaders:W.record(W.string()).optional(),responseHeaders:W.record(W.string()).optional(),error:W.string().optional()}),F_=W.object({level:W.enum(["log","warn","error"]),args:W.array(W.unknown()),timestamp:W.number()}),K_=W.object({localStorage:W.array(W.object({key:W.string(),type:W.string()})).optional(),sessionStorage:W.array(W.object({key:W.string(),type:W.string()})).optional(),cookies:W.array(W.string()).optional()}),k_=W.object({t:W.number(),kind:W.enum(["click","input","scroll","nav","mutation","error"]),target:W.string().optional(),summary:W.string()});var AS=W.enum(["critical","error","warning"]),LS=W.enum(["unresolved","resolved","ignored"]),US=W.enum(["high","medium","low"]),zH=W.object({id:W.string(),fingerprint:W.string(),title:W.string(),errorType:W.string(),severity:AS,status:LS,count:W.number().int().positive(),firstSeen:W.number(),lastSeen:W.number(),environments:W.array(W.enum(["dev","prod"])),sampleIds:W.array(W.string()),diagnosisId:W.string().optional(),projectKey:W.string()}),YH=W.object({id:W.string(),groupId:W.string(),projectKey:W.string(),environmentMode:W.enum(["dev","prod"]),createdAt:W.number(),errorType:W.string(),errorMessage:W.string(),normalizedMessage:W.string(),stackFrames:W.array(N_),consoleEntries:W.array(F_),networkEntries:W.array(D_),storageSnapshot:K_.optional(),timeline:W.array(k_),replayRef:W.string().optional(),device:V_,url:W.string(),route:W.string().optional()}),BH=W.object({id:W.string(),groupId:W.string(),createdAt:W.number(),model:W.string(),rootCause:W.string(),plainSummary:W.string(),fixPrompt:W.string(),confidence:US,analyzedSampleIds:W.array(W.string())});var bH=W.object({projectKey:W.string(),error:W.object({type:W.string(),message:W.string(),stack:W.array(N_)}),environment:u_,device:V_,consoleEntries:W.array(F_).default([]),networkEntries:W.array(D_).default([]),storageSnapshot:K_.optional(),timeline:W.array(k_).default([])});var VS=new Set(["authorization","cookie","set-cookie","x-api-key","x-auth-token","x-secret"]),NS=new Set(["token","key","secret","password","api_key","access_token","refresh_token","client_secret","apikey"]),DS=/eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*/g,FS=/\b(sk-|pk_live_|pk_test_|Bearer\s)\S+/g;function g_(_){try{let $=new URL(_);for(let S of $.searchParams.keys())if(NS.has(S.toLowerCase()))$.searchParams.set(S,"[redacted]");return $.toString()}catch{return _}}function p_(_){let $={};for(let[S,f]of Object.entries(_))if(!VS.has(S.toLowerCase()))$[S]=f;return $}function d_(_){return _.map(($)=>({...$,url:g_($.url),requestHeaders:$.requestHeaders?p_($.requestHeaders):void 0,responseHeaders:$.responseHeaders?p_($.responseHeaders):void 0}))}function KS(_){return _.replace(DS,"[token]").replace(FS,"$1[api-key]")}function a_(_){return _.map(($)=>({...$,args:$.args.map((S)=>typeof S==="string"?KS(S):S)}))}function kS(){try{if("__ASTRO__"in window)return"astro";if("__NEXT_DATA__"in window)return"next";if(document.querySelector("meta[name='generator'][content*='Astro']"))return"astro";let _=import.meta.env;if(_&&Object.keys(_).some(($)=>$.startsWith("VITE_")))return"vite"}catch{}return}function gS(){return{userAgent:navigator.userAgent,viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}function t_(_,$,S){return{projectKey:_.projectKey,error:{type:$.type,message:$.message,stack:$.stack},environment:{mode:_.environment,url:window.location.href,route:window.location.pathname,framework:kS(),buildId:_.buildId},device:gS(),consoleEntries:a_(S.console),networkEntries:d_(S.network),timeline:S.replay}}function P_(_){if(!_)return[];return _.split(`
2
- `).slice(1).map(($)=>$.trim()).filter(($)=>$.startsWith("at ")).map(($)=>{let S=$.match(/^at (.+?) \((.+):(\d+):(\d+)\)$/);if(S)return{fn:S[1],file:S[2],line:parseInt(S[3],10),col:parseInt(S[4],10)};let f=$.match(/^at (.+):(\d+):(\d+)$/);if(f)return{file:f[1],line:parseInt(f[2],10),col:parseInt(f[3],10)};return{file:$.replace(/^at /,"")}})}function s_(_){if(_ instanceof Error)return{type:_.name||"Error",message:_.message,stack:P_(_.stack)};return{type:"UnknownError",message:String(_),stack:[]}}function e_(_){let $=(f)=>{f.preventDefault(),_(s_(f.error??Error(f.message)))},S=(f)=>{f.preventDefault(),_(s_(f.reason))};return window.addEventListener("error",$),window.addEventListener("unhandledrejection",S),()=>{window.removeEventListener("error",$),window.removeEventListener("unhandledrejection",S)}}var _$=["log","warn","error"];function CS(_){if(typeof _==="string"||typeof _==="number"||typeof _==="boolean")return _;try{return String(_)}catch{return"[unserializable]"}}function $$(_){let $={};for(let S of _$)$[S]=console[S].bind(console),console[S]=(...f)=>{$[S](...f),_.push({level:S,args:f.map(CS),timestamp:Date.now()})};return()=>{for(let S of _$)console[S]=$[S]}}function S$(_,$){let S=window.fetch.bind(window),f=XMLHttpRequest.prototype.open,H=XMLHttpRequest.prototype.send;function w(X){return!!$&&X.startsWith($)}window.fetch=async(X,G)=>{let B=G?.method??"GET",E=g_(typeof X==="string"?X:X instanceof URL?X.href:X.url),A=Date.now();if(w(E))return S(X,G);let V;if(G?.body&&typeof G.body==="string")V=new TextEncoder().encode(G.body).length;try{let L=await S(X,G),r=L.clone(),a;try{a=(await r.arrayBuffer()).byteLength}catch{}return _.push({method:B,url:E,status:L.status,durationMs:Date.now()-A,requestBodySize:V,responseBodySize:a,timestamp:Date.now()}),L}catch(L){throw _.push({method:B,url:E,durationMs:Date.now()-A,error:String(L),timestamp:Date.now()}),L}};let q=new WeakMap;return XMLHttpRequest.prototype.open=function(X,G,...B){let E=g_(String(G));return q.set(this,{method:X,url:E,start:0,skip:w(E)}),f.call(this,X,G,...B)},XMLHttpRequest.prototype.send=function(X){let G=q.get(this);if(G)G.start=Date.now();return this.addEventListener("loadend",()=>{if(!G||G.skip)return;_.push({method:G.method,url:G.url,status:this.status||void 0,durationMs:Date.now()-G.start,timestamp:Date.now()})}),H.call(this,X)},()=>{window.fetch=S,XMLHttpRequest.prototype.open=f,XMLHttpRequest.prototype.send=H}}function H$(_){if(_.id)return`#${_.id}`.slice(0,60);let $=Array.from(_.classList).slice(0,2).join(".");return($?`${_.tagName.toLowerCase()}.${$}`:_.tagName.toLowerCase()).slice(0,60)}function f$(_){let $=[],S=0,f=(E)=>{let A=Date.now(),V=E.target instanceof Element?H$(E.target):"unknown",L=E.target instanceof Element?(E.target.textContent??"").trim().slice(0,40):"";_.push({t:A,kind:"click",target:V,summary:L?`click on "${L}"`:`click on ${V}`,timestamp:A})};document.addEventListener("click",f,{capture:!0,passive:!0}),$.push(()=>document.removeEventListener("click",f,{capture:!0}));let H=(E)=>{if(!(E.target instanceof HTMLInputElement))return;let A=Date.now(),V=H$(E.target),L=E.target.type||"text";_.push({t:A,kind:"input",target:V,summary:`input[type=${L}] changed`,timestamp:A})};document.addEventListener("input",H,{capture:!0,passive:!0}),$.push(()=>document.removeEventListener("input",H,{capture:!0}));let w=0,q=()=>{let E=Date.now();if(E-w<500)return;w=E,_.push({t:E,kind:"scroll",summary:`scroll to (${Math.round(window.scrollX)}, ${Math.round(window.scrollY)})`,timestamp:E})};document.addEventListener("scroll",q,{capture:!0,passive:!0}),$.push(()=>document.removeEventListener("scroll",q,{capture:!0}));let X=()=>{let E=Date.now();_.push({t:E,kind:"nav",summary:`nav to ${location.pathname}${location.search}`,timestamp:E})};window.addEventListener("popstate",X),$.push(()=>window.removeEventListener("popstate",X));let G=(E)=>{let A=history[E].bind(history);return history[E]=function(...V){A(...V);let L=Date.now();_.push({t:L,kind:"nav",summary:`nav to ${location.pathname}${location.search}`,timestamp:L})},()=>{history[E]=A}};$.push(G("pushState")),$.push(G("replaceState"));let B=new MutationObserver((E)=>{let A=Date.now();if(A-S<500)return;S=A;let V=E.reduce((a,v_)=>a+v_.addedNodes.length,0),L=E.reduce((a,v_)=>a+v_.removedNodes.length,0),r=[];if(V>0)r.push(`+${V} nodes`);if(L>0)r.push(`-${L} nodes`);if(r.length===0)r.push("attr changed");_.push({t:A,kind:"mutation",summary:`DOM: ${r.join(", ")}`,timestamp:A})});return B.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0}),$.push(()=>B.disconnect()),()=>$.forEach((E)=>E())}async function q$(_,$){try{await fetch(`${_}/api/collect`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($),keepalive:!0})}catch{}}function w$(_){if(!_.projectKey)return{capture(){},destroy(){}};let $=(_.bufferSeconds??15)*1000,S=new Q_($),f=new Q_($),H=new Q_($),w=[$$(S),S$(f,_.endpoint),f$(H)];function q(X){let G=t_(_,X,{console:S.flush(),network:f.flush().map(({timestamp:B,...E})=>E),replay:H.flush().map(({timestamp:B,...E})=>E)});q$(_.endpoint,G)}return w.push(e_(q)),{capture(X){q(hS(X))},destroy(){w.forEach((X)=>X()),S.clear(),f.clear(),H.clear()}}}function hS(_){if(_ instanceof Error)return{type:_.name||"Error",message:_.message,stack:P_(_.stack)};return{type:"UnknownError",message:String(_),stack:[]}}var IS=document.currentScript;function W$(){let _=IS??document.querySelector("script[data-project-key]"),$=_?.dataset.projectKey??"",S=_?.dataset.endpoint??"https://app.snapfail.com",f=_?.dataset.env,H=f==="dev"||f==="prod"?f:location.hostname==="localhost"||location.hostname==="127.0.0.1"?"dev":"prod";if(!$){console.warn("[snapfail] missing data-project-key attribute on <script> tag");return}window.Snapfail=w$({projectKey:$,endpoint:S,environment:H})}if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",W$);else W$();})();
1
+ (()=>{var G_=Object.defineProperty;var J_=($)=>$;function Q_($,_){this[$]=J_.bind(null,_)}var M_=($,_)=>{for(var H in _)G_($,H,{get:_[H],enumerable:!0,configurable:!0,set:Q_.bind(_,H)})};class M${windowMs;events=[];constructor($){this.windowMs=$}push($){let _=Date.now()-this.windowMs;this.events=this.events.filter((H)=>H.timestamp>=_),this.events.push($)}snapshot(){let $=Date.now()-this.windowMs;return this.events.filter((_)=>_.timestamp>=$).slice()}flush(){let $=this.snapshot();return this.events=[],$}clear(){this.events=[]}}var W={};M_(W,{void:()=>a_,util:()=>v,unknown:()=>p_,union:()=>$H,undefined:()=>i_,tuple:()=>fH,transformer:()=>zH,symbol:()=>o_,string:()=>o$,strictObject:()=>e_,setErrorMap:()=>B_,set:()=>SH,record:()=>qH,quotelessJson:()=>z_,promise:()=>MH,preprocess:()=>jH,pipeline:()=>EH,ostring:()=>RH,optional:()=>YH,onumber:()=>bH,oboolean:()=>vH,objectUtil:()=>C$,object:()=>s_,number:()=>i$,nullable:()=>BH,null:()=>u_,never:()=>d_,nativeEnum:()=>QH,nan:()=>x_,map:()=>wH,makeIssue:()=>z$,literal:()=>GH,lazy:()=>XH,late:()=>n_,isValid:()=>n,isDirty:()=>L$,isAsync:()=>s,isAborted:()=>O$,intersection:()=>HH,instanceof:()=>y_,getParsedType:()=>h,getErrorMap:()=>t,function:()=>WH,enum:()=>JH,effect:()=>zH,discriminatedUnion:()=>_H,defaultErrorMap:()=>l,datetimeRegex:()=>x$,date:()=>Z_,custom:()=>Z$,coerce:()=>OH,boolean:()=>u$,bigint:()=>c_,array:()=>t_,any:()=>r_,addIssueToContext:()=>M,ZodVoid:()=>B$,ZodUnknown:()=>y,ZodUnion:()=>q$,ZodUndefined:()=>H$,ZodType:()=>b,ZodTuple:()=>P,ZodTransformer:()=>C,ZodSymbol:()=>Y$,ZodString:()=>F,ZodSet:()=>p,ZodSchema:()=>b,ZodRecord:()=>j$,ZodReadonly:()=>Q$,ZodPromise:()=>d,ZodPipeline:()=>b$,ZodParsedType:()=>Q,ZodOptional:()=>k,ZodObject:()=>O,ZodNumber:()=>x,ZodNullable:()=>T,ZodNull:()=>f$,ZodNever:()=>I,ZodNativeEnum:()=>X$,ZodNaN:()=>R$,ZodMap:()=>E$,ZodLiteral:()=>W$,ZodLazy:()=>S$,ZodIssueCode:()=>J,ZodIntersection:()=>w$,ZodFunction:()=>$$,ZodFirstPartyTypeKind:()=>E,ZodError:()=>N,ZodEnum:()=>Z,ZodEffects:()=>C,ZodDiscriminatedUnion:()=>V$,ZodDefault:()=>G$,ZodDate:()=>u,ZodCatch:()=>J$,ZodBranded:()=>U$,ZodBoolean:()=>_$,ZodBigInt:()=>c,ZodArray:()=>K,ZodAny:()=>r,Schema:()=>b,ParseStatus:()=>U,OK:()=>D,NEVER:()=>LH,INVALID:()=>Y,EMPTY_PATH:()=>j_,DIRTY:()=>i,BRAND:()=>T_});var v;(function($){$.assertEqual=(f)=>{};function _(f){}$.assertIs=_;function H(f){throw Error()}$.assertNever=H,$.arrayToEnum=(f)=>{let w={};for(let S of f)w[S]=S;return w},$.getValidEnumValues=(f)=>{let w=$.objectKeys(f).filter((X)=>typeof f[f[X]]!=="number"),S={};for(let X of w)S[X]=f[X];return $.objectValues(S)},$.objectValues=(f)=>{return $.objectKeys(f).map(function(w){return f[w]})},$.objectKeys=typeof Object.keys==="function"?(f)=>Object.keys(f):(f)=>{let w=[];for(let S in f)if(Object.prototype.hasOwnProperty.call(f,S))w.push(S);return w},$.find=(f,w)=>{for(let S of f)if(w(S))return S;return},$.isInteger=typeof Number.isInteger==="function"?(f)=>Number.isInteger(f):(f)=>typeof f==="number"&&Number.isFinite(f)&&Math.floor(f)===f;function q(f,w=" | "){return f.map((S)=>typeof S==="string"?`'${S}'`:S).join(w)}$.joinValues=q,$.jsonStringifyReplacer=(f,w)=>{if(typeof w==="bigint")return w.toString();return w}})(v||(v={}));var C$;(function($){$.mergeShapes=(_,H)=>{return{..._,...H}}})(C$||(C$={}));var Q=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),h=($)=>{switch(typeof $){case"undefined":return Q.undefined;case"string":return Q.string;case"number":return Number.isNaN($)?Q.nan:Q.number;case"boolean":return Q.boolean;case"function":return Q.function;case"bigint":return Q.bigint;case"symbol":return Q.symbol;case"object":if(Array.isArray($))return Q.array;if($===null)return Q.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return Q.promise;if(typeof Map<"u"&&$ instanceof Map)return Q.map;if(typeof Set<"u"&&$ instanceof Set)return Q.set;if(typeof Date<"u"&&$ instanceof Date)return Q.date;return Q.object;default:return Q.unknown}};var J=v.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),z_=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")};class N extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(H)=>{this.issues=[...this.issues,H]},this.addIssues=(H=[])=>{this.issues=[...this.issues,...H]};let _=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,_);else this.__proto__=_;this.name="ZodError",this.issues=$}format($){let _=$||function(f){return f.message},H={_errors:[]},q=(f)=>{for(let w of f.issues)if(w.code==="invalid_union")w.unionErrors.map(q);else if(w.code==="invalid_return_type")q(w.returnTypeError);else if(w.code==="invalid_arguments")q(w.argumentsError);else if(w.path.length===0)H._errors.push(_(w));else{let S=H,X=0;while(X<w.path.length){let G=w.path[X];if(X!==w.path.length-1)S[G]=S[G]||{_errors:[]};else S[G]=S[G]||{_errors:[]},S[G]._errors.push(_(w));S=S[G],X++}}};return q(this),H}static assert($){if(!($ instanceof N))throw Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,v.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(_)=>_.message){let _={},H=[];for(let q of this.issues)if(q.path.length>0){let f=q.path[0];_[f]=_[f]||[],_[f].push($(q))}else H.push($(q));return{formErrors:H,fieldErrors:_}}get formErrors(){return this.flatten()}}N.create=($)=>{return new N($)};var Y_=($,_)=>{let H;switch($.code){case J.invalid_type:if($.received===Q.undefined)H="Required";else H=`Expected ${$.expected}, received ${$.received}`;break;case J.invalid_literal:H=`Invalid literal value, expected ${JSON.stringify($.expected,v.jsonStringifyReplacer)}`;break;case J.unrecognized_keys:H=`Unrecognized key(s) in object: ${v.joinValues($.keys,", ")}`;break;case J.invalid_union:H="Invalid input";break;case J.invalid_union_discriminator:H=`Invalid discriminator value. Expected ${v.joinValues($.options)}`;break;case J.invalid_enum_value:H=`Invalid enum value. Expected ${v.joinValues($.options)}, received '${$.received}'`;break;case J.invalid_arguments:H="Invalid function arguments";break;case J.invalid_return_type:H="Invalid function return type";break;case J.invalid_date:H="Invalid date";break;case J.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(H=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")H=`${H} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)H=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)H=`Invalid input: must end with "${$.validation.endsWith}"`;else v.assertNever($.validation);else if($.validation!=="regex")H=`Invalid ${$.validation}`;else H="Invalid";break;case J.too_small:if($.type==="array")H=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")H=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")H=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="bigint")H=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")H=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else H="Invalid input";break;case J.too_big:if($.type==="array")H=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")H=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")H=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")H=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")H=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else H="Invalid input";break;case J.custom:H="Invalid input";break;case J.invalid_intersection_types:H="Intersection results could not be merged";break;case J.not_multiple_of:H=`Number must be a multiple of ${$.multipleOf}`;break;case J.not_finite:H="Number must be finite";break;default:H=_.defaultError,v.assertNever($)}return{message:H}},l=Y_;var l$=l;function B_($){l$=$}function t(){return l$}var z$=($)=>{let{data:_,path:H,errorMaps:q,issueData:f}=$,w=[...H,...f.path||[]],S={...f,path:w};if(f.message!==void 0)return{...f,path:w,message:f.message};let X="",G=q.filter((B)=>!!B).slice().reverse();for(let B of G)X=B(S,{data:_,defaultError:X}).message;return{...f,path:w,message:X}},j_=[];function M($,_){let H=t(),q=z$({issueData:_,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,H,H===l?void 0:l].filter((f)=>!!f)});$.common.issues.push(q)}class U{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,_){let H=[];for(let q of _){if(q.status==="aborted")return Y;if(q.status==="dirty")$.dirty();H.push(q.value)}return{status:$.value,value:H}}static async mergeObjectAsync($,_){let H=[];for(let q of _){let f=await q.key,w=await q.value;H.push({key:f,value:w})}return U.mergeObjectSync($,H)}static mergeObjectSync($,_){let H={};for(let q of _){let{key:f,value:w}=q;if(f.status==="aborted")return Y;if(w.status==="aborted")return Y;if(f.status==="dirty")$.dirty();if(w.status==="dirty")$.dirty();if(f.value!=="__proto__"&&(typeof w.value<"u"||q.alwaysSet))H[f.value]=w.value}return{status:$.value,value:H}}}var Y=Object.freeze({status:"aborted"}),i=($)=>({status:"dirty",value:$}),D=($)=>({status:"valid",value:$}),O$=($)=>$.status==="aborted",L$=($)=>$.status==="dirty",n=($)=>$.status==="valid",s=($)=>typeof Promise<"u"&&$ instanceof Promise;var z;(function($){$.errToObj=(_)=>typeof _==="string"?{message:_}:_||{},$.toString=(_)=>typeof _==="string"?_:_?.message})(z||(z={}));class g{constructor($,_,H,q){this._cachedPath=[],this.parent=$,this.data=_,this._path=H,this._key=q}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var m$=($,_)=>{if(n(_))return{success:!0,data:_.value};else{if(!$.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let H=new N($.common.issues);return this._error=H,this._error}}}};function R($){if(!$)return{};let{errorMap:_,invalid_type_error:H,required_error:q,description:f}=$;if(_&&(H||q))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(_)return{errorMap:_,description:f};return{errorMap:(S,X)=>{let{message:G}=$;if(S.code==="invalid_enum_value")return{message:G??X.defaultError};if(typeof X.data>"u")return{message:G??q??X.defaultError};if(S.code!=="invalid_type")return{message:X.defaultError};return{message:G??H??X.defaultError}},description:f}}class b{get description(){return this._def.description}_getType($){return h($.data)}_getOrReturnCtx($,_){return _||{common:$.parent.common,data:$.data,parsedType:h($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new U,ctx:{common:$.parent.common,data:$.data,parsedType:h($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let _=this._parse($);if(s(_))throw Error("Synchronous parse encountered promise.");return _}_parseAsync($){let _=this._parse($);return Promise.resolve(_)}parse($,_){let H=this.safeParse($,_);if(H.success)return H.data;throw H.error}safeParse($,_){let H={common:{issues:[],async:_?.async??!1,contextualErrorMap:_?.errorMap},path:_?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:h($)},q=this._parseSync({data:$,path:H.path,parent:H});return m$(H,q)}"~validate"($){let _={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:h($)};if(!this["~standard"].async)try{let H=this._parseSync({data:$,path:[],parent:_});return n(H)?{value:H.value}:{issues:_.common.issues}}catch(H){if(H?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;_.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:_}).then((H)=>n(H)?{value:H.value}:{issues:_.common.issues})}async parseAsync($,_){let H=await this.safeParseAsync($,_);if(H.success)return H.data;throw H.error}async safeParseAsync($,_){let H={common:{issues:[],contextualErrorMap:_?.errorMap,async:!0},path:_?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:h($)},q=this._parse({data:$,path:H.path,parent:H}),f=await(s(q)?q:Promise.resolve(q));return m$(H,f)}refine($,_){let H=(q)=>{if(typeof _==="string"||typeof _>"u")return{message:_};else if(typeof _==="function")return _(q);else return _};return this._refinement((q,f)=>{let w=$(q),S=()=>f.addIssue({code:J.custom,...H(q)});if(typeof Promise<"u"&&w instanceof Promise)return w.then((X)=>{if(!X)return S(),!1;else return!0});if(!w)return S(),!1;else return!0})}refinement($,_){return this._refinement((H,q)=>{if(!$(H))return q.addIssue(typeof _==="function"?_(H,q):_),!1;else return!0})}_refinement($){return new C({schema:this,typeName:E.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(_)=>this["~validate"](_)}}optional(){return k.create(this,this._def)}nullable(){return T.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return K.create(this)}promise(){return d.create(this,this._def)}or($){return q$.create([this,$],this._def)}and($){return w$.create(this,$,this._def)}transform($){return new C({...R(this._def),schema:this,typeName:E.ZodEffects,effect:{type:"transform",transform:$}})}default($){let _=typeof $==="function"?$:()=>$;return new G$({...R(this._def),innerType:this,defaultValue:_,typeName:E.ZodDefault})}brand(){return new U$({typeName:E.ZodBranded,type:this,...R(this._def)})}catch($){let _=typeof $==="function"?$:()=>$;return new J$({...R(this._def),innerType:this,catchValue:_,typeName:E.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return b$.create(this,$)}readonly(){return Q$.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var E_=/^c[^\s-]{8,}$/i,R_=/^[0-9a-z]+$/,b_=/^[0-9A-HJKMNP-TV-Z]{26}$/i,v_=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,O_=/^[a-z0-9_-]{21}$/i,L_=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,V_=/^[-+]?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)?)??$/,U_=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,A_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",h$,D_=/^(?:(?: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])$/,N_=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,F_=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,K_=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,k_=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,g_=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,n$="((\\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])))",C_=new RegExp(`^${n$}$`);function y$($){let _="[0-5]\\d";if($.precision)_=`${_}\\.\\d{${$.precision}}`;else if($.precision==null)_=`${_}(\\.\\d+)?`;let H=$.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${_})${H}`}function h_($){return new RegExp(`^${y$($)}$`)}function x$($){let _=`${n$}T${y$($)}`,H=[];if(H.push($.local?"Z?":"Z"),$.offset)H.push("([+-]\\d{2}:?\\d{2})");return _=`${_}(${H.join("|")})`,new RegExp(`^${_}$`)}function I_($,_){if((_==="v4"||!_)&&D_.test($))return!0;if((_==="v6"||!_)&&F_.test($))return!0;return!1}function P_($,_){if(!L_.test($))return!1;try{let[H]=$.split(".");if(!H)return!1;let q=H.replace(/-/g,"+").replace(/_/g,"/").padEnd(H.length+(4-H.length%4)%4,"="),f=JSON.parse(atob(q));if(typeof f!=="object"||f===null)return!1;if("typ"in f&&f?.typ!=="JWT")return!1;if(!f.alg)return!1;if(_&&f.alg!==_)return!1;return!0}catch{return!1}}function l_($,_){if((_==="v4"||!_)&&N_.test($))return!0;if((_==="v6"||!_)&&K_.test($))return!0;return!1}class F extends b{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==Q.string){let f=this._getOrReturnCtx($);return M(f,{code:J.invalid_type,expected:Q.string,received:f.parsedType}),Y}let H=new U,q=void 0;for(let f of this._def.checks)if(f.kind==="min"){if($.data.length<f.value)q=this._getOrReturnCtx($,q),M(q,{code:J.too_small,minimum:f.value,type:"string",inclusive:!0,exact:!1,message:f.message}),H.dirty()}else if(f.kind==="max"){if($.data.length>f.value)q=this._getOrReturnCtx($,q),M(q,{code:J.too_big,maximum:f.value,type:"string",inclusive:!0,exact:!1,message:f.message}),H.dirty()}else if(f.kind==="length"){let w=$.data.length>f.value,S=$.data.length<f.value;if(w||S){if(q=this._getOrReturnCtx($,q),w)M(q,{code:J.too_big,maximum:f.value,type:"string",inclusive:!0,exact:!0,message:f.message});else if(S)M(q,{code:J.too_small,minimum:f.value,type:"string",inclusive:!0,exact:!0,message:f.message});H.dirty()}}else if(f.kind==="email"){if(!U_.test($.data))q=this._getOrReturnCtx($,q),M(q,{validation:"email",code:J.invalid_string,message:f.message}),H.dirty()}else if(f.kind==="emoji"){if(!h$)h$=new RegExp(A_,"u");if(!h$.test($.data))q=this._getOrReturnCtx($,q),M(q,{validation:"emoji",code:J.invalid_string,message:f.message}),H.dirty()}else if(f.kind==="uuid"){if(!v_.test($.data))q=this._getOrReturnCtx($,q),M(q,{validation:"uuid",code:J.invalid_string,message:f.message}),H.dirty()}else if(f.kind==="nanoid"){if(!O_.test($.data))q=this._getOrReturnCtx($,q),M(q,{validation:"nanoid",code:J.invalid_string,message:f.message}),H.dirty()}else if(f.kind==="cuid"){if(!E_.test($.data))q=this._getOrReturnCtx($,q),M(q,{validation:"cuid",code:J.invalid_string,message:f.message}),H.dirty()}else if(f.kind==="cuid2"){if(!R_.test($.data))q=this._getOrReturnCtx($,q),M(q,{validation:"cuid2",code:J.invalid_string,message:f.message}),H.dirty()}else if(f.kind==="ulid"){if(!b_.test($.data))q=this._getOrReturnCtx($,q),M(q,{validation:"ulid",code:J.invalid_string,message:f.message}),H.dirty()}else if(f.kind==="url")try{new URL($.data)}catch{q=this._getOrReturnCtx($,q),M(q,{validation:"url",code:J.invalid_string,message:f.message}),H.dirty()}else if(f.kind==="regex"){if(f.regex.lastIndex=0,!f.regex.test($.data))q=this._getOrReturnCtx($,q),M(q,{validation:"regex",code:J.invalid_string,message:f.message}),H.dirty()}else if(f.kind==="trim")$.data=$.data.trim();else if(f.kind==="includes"){if(!$.data.includes(f.value,f.position))q=this._getOrReturnCtx($,q),M(q,{code:J.invalid_string,validation:{includes:f.value,position:f.position},message:f.message}),H.dirty()}else if(f.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(f.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(f.kind==="startsWith"){if(!$.data.startsWith(f.value))q=this._getOrReturnCtx($,q),M(q,{code:J.invalid_string,validation:{startsWith:f.value},message:f.message}),H.dirty()}else if(f.kind==="endsWith"){if(!$.data.endsWith(f.value))q=this._getOrReturnCtx($,q),M(q,{code:J.invalid_string,validation:{endsWith:f.value},message:f.message}),H.dirty()}else if(f.kind==="datetime"){if(!x$(f).test($.data))q=this._getOrReturnCtx($,q),M(q,{code:J.invalid_string,validation:"datetime",message:f.message}),H.dirty()}else if(f.kind==="date"){if(!C_.test($.data))q=this._getOrReturnCtx($,q),M(q,{code:J.invalid_string,validation:"date",message:f.message}),H.dirty()}else if(f.kind==="time"){if(!h_(f).test($.data))q=this._getOrReturnCtx($,q),M(q,{code:J.invalid_string,validation:"time",message:f.message}),H.dirty()}else if(f.kind==="duration"){if(!V_.test($.data))q=this._getOrReturnCtx($,q),M(q,{validation:"duration",code:J.invalid_string,message:f.message}),H.dirty()}else if(f.kind==="ip"){if(!I_($.data,f.version))q=this._getOrReturnCtx($,q),M(q,{validation:"ip",code:J.invalid_string,message:f.message}),H.dirty()}else if(f.kind==="jwt"){if(!P_($.data,f.alg))q=this._getOrReturnCtx($,q),M(q,{validation:"jwt",code:J.invalid_string,message:f.message}),H.dirty()}else if(f.kind==="cidr"){if(!l_($.data,f.version))q=this._getOrReturnCtx($,q),M(q,{validation:"cidr",code:J.invalid_string,message:f.message}),H.dirty()}else if(f.kind==="base64"){if(!k_.test($.data))q=this._getOrReturnCtx($,q),M(q,{validation:"base64",code:J.invalid_string,message:f.message}),H.dirty()}else if(f.kind==="base64url"){if(!g_.test($.data))q=this._getOrReturnCtx($,q),M(q,{validation:"base64url",code:J.invalid_string,message:f.message}),H.dirty()}else v.assertNever(f);return{status:H.value,value:$.data}}_regex($,_,H){return this.refinement((q)=>$.test(q),{validation:_,code:J.invalid_string,...z.errToObj(H)})}_addCheck($){return new F({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...z.errToObj($)})}url($){return this._addCheck({kind:"url",...z.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...z.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...z.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...z.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...z.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...z.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...z.errToObj($)})}base64($){return this._addCheck({kind:"base64",...z.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...z.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...z.errToObj($)})}ip($){return this._addCheck({kind:"ip",...z.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...z.errToObj($)})}datetime($){if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof $?.precision>"u"?null:$?.precision,offset:$?.offset??!1,local:$?.local??!1,...z.errToObj($?.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof $?.precision>"u"?null:$?.precision,...z.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...z.errToObj($)})}regex($,_){return this._addCheck({kind:"regex",regex:$,...z.errToObj(_)})}includes($,_){return this._addCheck({kind:"includes",value:$,position:_?.position,...z.errToObj(_?.message)})}startsWith($,_){return this._addCheck({kind:"startsWith",value:$,...z.errToObj(_)})}endsWith($,_){return this._addCheck({kind:"endsWith",value:$,...z.errToObj(_)})}min($,_){return this._addCheck({kind:"min",value:$,...z.errToObj(_)})}max($,_){return this._addCheck({kind:"max",value:$,...z.errToObj(_)})}length($,_){return this._addCheck({kind:"length",value:$,...z.errToObj(_)})}nonempty($){return this.min(1,z.errToObj($))}trim(){return new F({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new F({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new F({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let _ of this._def.checks)if(_.kind==="min"){if($===null||_.value>$)$=_.value}return $}get maxLength(){let $=null;for(let _ of this._def.checks)if(_.kind==="max"){if($===null||_.value<$)$=_.value}return $}}F.create=($)=>{return new F({checks:[],typeName:E.ZodString,coerce:$?.coerce??!1,...R($)})};function m_($,_){let H=($.toString().split(".")[1]||"").length,q=(_.toString().split(".")[1]||"").length,f=H>q?H:q,w=Number.parseInt($.toFixed(f).replace(".","")),S=Number.parseInt(_.toFixed(f).replace(".",""));return w%S/10**f}class x extends b{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==Q.number){let f=this._getOrReturnCtx($);return M(f,{code:J.invalid_type,expected:Q.number,received:f.parsedType}),Y}let H=void 0,q=new U;for(let f of this._def.checks)if(f.kind==="int"){if(!v.isInteger($.data))H=this._getOrReturnCtx($,H),M(H,{code:J.invalid_type,expected:"integer",received:"float",message:f.message}),q.dirty()}else if(f.kind==="min"){if(f.inclusive?$.data<f.value:$.data<=f.value)H=this._getOrReturnCtx($,H),M(H,{code:J.too_small,minimum:f.value,type:"number",inclusive:f.inclusive,exact:!1,message:f.message}),q.dirty()}else if(f.kind==="max"){if(f.inclusive?$.data>f.value:$.data>=f.value)H=this._getOrReturnCtx($,H),M(H,{code:J.too_big,maximum:f.value,type:"number",inclusive:f.inclusive,exact:!1,message:f.message}),q.dirty()}else if(f.kind==="multipleOf"){if(m_($.data,f.value)!==0)H=this._getOrReturnCtx($,H),M(H,{code:J.not_multiple_of,multipleOf:f.value,message:f.message}),q.dirty()}else if(f.kind==="finite"){if(!Number.isFinite($.data))H=this._getOrReturnCtx($,H),M(H,{code:J.not_finite,message:f.message}),q.dirty()}else v.assertNever(f);return{status:q.value,value:$.data}}gte($,_){return this.setLimit("min",$,!0,z.toString(_))}gt($,_){return this.setLimit("min",$,!1,z.toString(_))}lte($,_){return this.setLimit("max",$,!0,z.toString(_))}lt($,_){return this.setLimit("max",$,!1,z.toString(_))}setLimit($,_,H,q){return new x({...this._def,checks:[...this._def.checks,{kind:$,value:_,inclusive:H,message:z.toString(q)}]})}_addCheck($){return new x({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:z.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:z.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:z.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:z.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:z.toString($)})}multipleOf($,_){return this._addCheck({kind:"multipleOf",value:$,message:z.toString(_)})}finite($){return this._addCheck({kind:"finite",message:z.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:z.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:z.toString($)})}get minValue(){let $=null;for(let _ of this._def.checks)if(_.kind==="min"){if($===null||_.value>$)$=_.value}return $}get maxValue(){let $=null;for(let _ of this._def.checks)if(_.kind==="max"){if($===null||_.value<$)$=_.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&v.isInteger($.value))}get isFinite(){let $=null,_=null;for(let H of this._def.checks)if(H.kind==="finite"||H.kind==="int"||H.kind==="multipleOf")return!0;else if(H.kind==="min"){if(_===null||H.value>_)_=H.value}else if(H.kind==="max"){if($===null||H.value<$)$=H.value}return Number.isFinite(_)&&Number.isFinite($)}}x.create=($)=>{return new x({checks:[],typeName:E.ZodNumber,coerce:$?.coerce||!1,...R($)})};class c extends b{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch{return this._getInvalidInput($)}if(this._getType($)!==Q.bigint)return this._getInvalidInput($);let H=void 0,q=new U;for(let f of this._def.checks)if(f.kind==="min"){if(f.inclusive?$.data<f.value:$.data<=f.value)H=this._getOrReturnCtx($,H),M(H,{code:J.too_small,type:"bigint",minimum:f.value,inclusive:f.inclusive,message:f.message}),q.dirty()}else if(f.kind==="max"){if(f.inclusive?$.data>f.value:$.data>=f.value)H=this._getOrReturnCtx($,H),M(H,{code:J.too_big,type:"bigint",maximum:f.value,inclusive:f.inclusive,message:f.message}),q.dirty()}else if(f.kind==="multipleOf"){if($.data%f.value!==BigInt(0))H=this._getOrReturnCtx($,H),M(H,{code:J.not_multiple_of,multipleOf:f.value,message:f.message}),q.dirty()}else v.assertNever(f);return{status:q.value,value:$.data}}_getInvalidInput($){let _=this._getOrReturnCtx($);return M(_,{code:J.invalid_type,expected:Q.bigint,received:_.parsedType}),Y}gte($,_){return this.setLimit("min",$,!0,z.toString(_))}gt($,_){return this.setLimit("min",$,!1,z.toString(_))}lte($,_){return this.setLimit("max",$,!0,z.toString(_))}lt($,_){return this.setLimit("max",$,!1,z.toString(_))}setLimit($,_,H,q){return new c({...this._def,checks:[...this._def.checks,{kind:$,value:_,inclusive:H,message:z.toString(q)}]})}_addCheck($){return new c({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:z.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:z.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:z.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:z.toString($)})}multipleOf($,_){return this._addCheck({kind:"multipleOf",value:$,message:z.toString(_)})}get minValue(){let $=null;for(let _ of this._def.checks)if(_.kind==="min"){if($===null||_.value>$)$=_.value}return $}get maxValue(){let $=null;for(let _ of this._def.checks)if(_.kind==="max"){if($===null||_.value<$)$=_.value}return $}}c.create=($)=>{return new c({checks:[],typeName:E.ZodBigInt,coerce:$?.coerce??!1,...R($)})};class _$ extends b{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==Q.boolean){let H=this._getOrReturnCtx($);return M(H,{code:J.invalid_type,expected:Q.boolean,received:H.parsedType}),Y}return D($.data)}}_$.create=($)=>{return new _$({typeName:E.ZodBoolean,coerce:$?.coerce||!1,...R($)})};class u extends b{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==Q.date){let f=this._getOrReturnCtx($);return M(f,{code:J.invalid_type,expected:Q.date,received:f.parsedType}),Y}if(Number.isNaN($.data.getTime())){let f=this._getOrReturnCtx($);return M(f,{code:J.invalid_date}),Y}let H=new U,q=void 0;for(let f of this._def.checks)if(f.kind==="min"){if($.data.getTime()<f.value)q=this._getOrReturnCtx($,q),M(q,{code:J.too_small,message:f.message,inclusive:!0,exact:!1,minimum:f.value,type:"date"}),H.dirty()}else if(f.kind==="max"){if($.data.getTime()>f.value)q=this._getOrReturnCtx($,q),M(q,{code:J.too_big,message:f.message,inclusive:!0,exact:!1,maximum:f.value,type:"date"}),H.dirty()}else v.assertNever(f);return{status:H.value,value:new Date($.data.getTime())}}_addCheck($){return new u({...this._def,checks:[...this._def.checks,$]})}min($,_){return this._addCheck({kind:"min",value:$.getTime(),message:z.toString(_)})}max($,_){return this._addCheck({kind:"max",value:$.getTime(),message:z.toString(_)})}get minDate(){let $=null;for(let _ of this._def.checks)if(_.kind==="min"){if($===null||_.value>$)$=_.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let _ of this._def.checks)if(_.kind==="max"){if($===null||_.value<$)$=_.value}return $!=null?new Date($):null}}u.create=($)=>{return new u({checks:[],coerce:$?.coerce||!1,typeName:E.ZodDate,...R($)})};class Y$ extends b{_parse($){if(this._getType($)!==Q.symbol){let H=this._getOrReturnCtx($);return M(H,{code:J.invalid_type,expected:Q.symbol,received:H.parsedType}),Y}return D($.data)}}Y$.create=($)=>{return new Y$({typeName:E.ZodSymbol,...R($)})};class H$ extends b{_parse($){if(this._getType($)!==Q.undefined){let H=this._getOrReturnCtx($);return M(H,{code:J.invalid_type,expected:Q.undefined,received:H.parsedType}),Y}return D($.data)}}H$.create=($)=>{return new H$({typeName:E.ZodUndefined,...R($)})};class f$ extends b{_parse($){if(this._getType($)!==Q.null){let H=this._getOrReturnCtx($);return M(H,{code:J.invalid_type,expected:Q.null,received:H.parsedType}),Y}return D($.data)}}f$.create=($)=>{return new f$({typeName:E.ZodNull,...R($)})};class r extends b{constructor(){super(...arguments);this._any=!0}_parse($){return D($.data)}}r.create=($)=>{return new r({typeName:E.ZodAny,...R($)})};class y extends b{constructor(){super(...arguments);this._unknown=!0}_parse($){return D($.data)}}y.create=($)=>{return new y({typeName:E.ZodUnknown,...R($)})};class I extends b{_parse($){let _=this._getOrReturnCtx($);return M(_,{code:J.invalid_type,expected:Q.never,received:_.parsedType}),Y}}I.create=($)=>{return new I({typeName:E.ZodNever,...R($)})};class B$ extends b{_parse($){if(this._getType($)!==Q.undefined){let H=this._getOrReturnCtx($);return M(H,{code:J.invalid_type,expected:Q.void,received:H.parsedType}),Y}return D($.data)}}B$.create=($)=>{return new B$({typeName:E.ZodVoid,...R($)})};class K extends b{_parse($){let{ctx:_,status:H}=this._processInputParams($),q=this._def;if(_.parsedType!==Q.array)return M(_,{code:J.invalid_type,expected:Q.array,received:_.parsedType}),Y;if(q.exactLength!==null){let w=_.data.length>q.exactLength.value,S=_.data.length<q.exactLength.value;if(w||S)M(_,{code:w?J.too_big:J.too_small,minimum:S?q.exactLength.value:void 0,maximum:w?q.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:q.exactLength.message}),H.dirty()}if(q.minLength!==null){if(_.data.length<q.minLength.value)M(_,{code:J.too_small,minimum:q.minLength.value,type:"array",inclusive:!0,exact:!1,message:q.minLength.message}),H.dirty()}if(q.maxLength!==null){if(_.data.length>q.maxLength.value)M(_,{code:J.too_big,maximum:q.maxLength.value,type:"array",inclusive:!0,exact:!1,message:q.maxLength.message}),H.dirty()}if(_.common.async)return Promise.all([..._.data].map((w,S)=>{return q.type._parseAsync(new g(_,w,_.path,S))})).then((w)=>{return U.mergeArray(H,w)});let f=[..._.data].map((w,S)=>{return q.type._parseSync(new g(_,w,_.path,S))});return U.mergeArray(H,f)}get element(){return this._def.type}min($,_){return new K({...this._def,minLength:{value:$,message:z.toString(_)}})}max($,_){return new K({...this._def,maxLength:{value:$,message:z.toString(_)}})}length($,_){return new K({...this._def,exactLength:{value:$,message:z.toString(_)}})}nonempty($){return this.min(1,$)}}K.create=($,_)=>{return new K({type:$,minLength:null,maxLength:null,exactLength:null,typeName:E.ZodArray,...R(_)})};function e($){if($ instanceof O){let _={};for(let H in $.shape){let q=$.shape[H];_[H]=k.create(e(q))}return new O({...$._def,shape:()=>_})}else if($ instanceof K)return new K({...$._def,type:e($.element)});else if($ instanceof k)return k.create(e($.unwrap()));else if($ instanceof T)return T.create(e($.unwrap()));else if($ instanceof P)return P.create($.items.map((_)=>e(_)));else return $}class O extends b{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),_=v.objectKeys($);return this._cached={shape:$,keys:_},this._cached}_parse($){if(this._getType($)!==Q.object){let G=this._getOrReturnCtx($);return M(G,{code:J.invalid_type,expected:Q.object,received:G.parsedType}),Y}let{status:H,ctx:q}=this._processInputParams($),{shape:f,keys:w}=this._getCached(),S=[];if(!(this._def.catchall instanceof I&&this._def.unknownKeys==="strip")){for(let G in q.data)if(!w.includes(G))S.push(G)}let X=[];for(let G of w){let B=f[G],j=q.data[G];X.push({key:{status:"valid",value:G},value:B._parse(new g(q,j,q.path,G)),alwaysSet:G in q.data})}if(this._def.catchall instanceof I){let G=this._def.unknownKeys;if(G==="passthrough")for(let B of S)X.push({key:{status:"valid",value:B},value:{status:"valid",value:q.data[B]}});else if(G==="strict"){if(S.length>0)M(q,{code:J.unrecognized_keys,keys:S}),H.dirty()}else if(G==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let G=this._def.catchall;for(let B of S){let j=q.data[B];X.push({key:{status:"valid",value:B},value:G._parse(new g(q,j,q.path,B)),alwaysSet:B in q.data})}}if(q.common.async)return Promise.resolve().then(async()=>{let G=[];for(let B of X){let j=await B.key,L=await B.value;G.push({key:j,value:L,alwaysSet:B.alwaysSet})}return G}).then((G)=>{return U.mergeObjectSync(H,G)});else return U.mergeObjectSync(H,X)}get shape(){return this._def.shape()}strict($){return z.errToObj,new O({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(_,H)=>{let q=this._def.errorMap?.(_,H).message??H.defaultError;if(_.code==="unrecognized_keys")return{message:z.errToObj($).message??q};return{message:q}}}:{}})}strip(){return new O({...this._def,unknownKeys:"strip"})}passthrough(){return new O({...this._def,unknownKeys:"passthrough"})}extend($){return new O({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new O({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:E.ZodObject})}setKey($,_){return this.augment({[$]:_})}catchall($){return new O({...this._def,catchall:$})}pick($){let _={};for(let H of v.objectKeys($))if($[H]&&this.shape[H])_[H]=this.shape[H];return new O({...this._def,shape:()=>_})}omit($){let _={};for(let H of v.objectKeys(this.shape))if(!$[H])_[H]=this.shape[H];return new O({...this._def,shape:()=>_})}deepPartial(){return e(this)}partial($){let _={};for(let H of v.objectKeys(this.shape)){let q=this.shape[H];if($&&!$[H])_[H]=q;else _[H]=q.optional()}return new O({...this._def,shape:()=>_})}required($){let _={};for(let H of v.objectKeys(this.shape))if($&&!$[H])_[H]=this.shape[H];else{let f=this.shape[H];while(f instanceof k)f=f._def.innerType;_[H]=f}return new O({...this._def,shape:()=>_})}keyof(){return c$(v.objectKeys(this.shape))}}O.create=($,_)=>{return new O({shape:()=>$,unknownKeys:"strip",catchall:I.create(),typeName:E.ZodObject,...R(_)})};O.strictCreate=($,_)=>{return new O({shape:()=>$,unknownKeys:"strict",catchall:I.create(),typeName:E.ZodObject,...R(_)})};O.lazycreate=($,_)=>{return new O({shape:$,unknownKeys:"strip",catchall:I.create(),typeName:E.ZodObject,...R(_)})};class q$ extends b{_parse($){let{ctx:_}=this._processInputParams($),H=this._def.options;function q(f){for(let S of f)if(S.result.status==="valid")return S.result;for(let S of f)if(S.result.status==="dirty")return _.common.issues.push(...S.ctx.common.issues),S.result;let w=f.map((S)=>new N(S.ctx.common.issues));return M(_,{code:J.invalid_union,unionErrors:w}),Y}if(_.common.async)return Promise.all(H.map(async(f)=>{let w={..._,common:{..._.common,issues:[]},parent:null};return{result:await f._parseAsync({data:_.data,path:_.path,parent:w}),ctx:w}})).then(q);else{let f=void 0,w=[];for(let X of H){let G={..._,common:{..._.common,issues:[]},parent:null},B=X._parseSync({data:_.data,path:_.path,parent:G});if(B.status==="valid")return B;else if(B.status==="dirty"&&!f)f={result:B,ctx:G};if(G.common.issues.length)w.push(G.common.issues)}if(f)return _.common.issues.push(...f.ctx.common.issues),f.result;let S=w.map((X)=>new N(X));return M(_,{code:J.invalid_union,unionErrors:S}),Y}}get options(){return this._def.options}}q$.create=($,_)=>{return new q$({options:$,typeName:E.ZodUnion,...R(_)})};var m=($)=>{if($ instanceof S$)return m($.schema);else if($ instanceof C)return m($.innerType());else if($ instanceof W$)return[$.value];else if($ instanceof Z)return $.options;else if($ instanceof X$)return v.objectValues($.enum);else if($ instanceof G$)return m($._def.innerType);else if($ instanceof H$)return[void 0];else if($ instanceof f$)return[null];else if($ instanceof k)return[void 0,...m($.unwrap())];else if($ instanceof T)return[null,...m($.unwrap())];else if($ instanceof U$)return m($.unwrap());else if($ instanceof Q$)return m($.unwrap());else if($ instanceof J$)return m($._def.innerType);else return[]};class V$ extends b{_parse($){let{ctx:_}=this._processInputParams($);if(_.parsedType!==Q.object)return M(_,{code:J.invalid_type,expected:Q.object,received:_.parsedType}),Y;let H=this.discriminator,q=_.data[H],f=this.optionsMap.get(q);if(!f)return M(_,{code:J.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[H]}),Y;if(_.common.async)return f._parseAsync({data:_.data,path:_.path,parent:_});else return f._parseSync({data:_.data,path:_.path,parent:_})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,_,H){let q=new Map;for(let f of _){let w=m(f.shape[$]);if(!w.length)throw Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let S of w){if(q.has(S))throw Error(`Discriminator property ${String($)} has duplicate value ${String(S)}`);q.set(S,f)}}return new V$({typeName:E.ZodDiscriminatedUnion,discriminator:$,options:_,optionsMap:q,...R(H)})}}function I$($,_){let H=h($),q=h(_);if($===_)return{valid:!0,data:$};else if(H===Q.object&&q===Q.object){let f=v.objectKeys(_),w=v.objectKeys($).filter((X)=>f.indexOf(X)!==-1),S={...$,..._};for(let X of w){let G=I$($[X],_[X]);if(!G.valid)return{valid:!1};S[X]=G.data}return{valid:!0,data:S}}else if(H===Q.array&&q===Q.array){if($.length!==_.length)return{valid:!1};let f=[];for(let w=0;w<$.length;w++){let S=$[w],X=_[w],G=I$(S,X);if(!G.valid)return{valid:!1};f.push(G.data)}return{valid:!0,data:f}}else if(H===Q.date&&q===Q.date&&+$===+_)return{valid:!0,data:$};else return{valid:!1}}class w$ extends b{_parse($){let{status:_,ctx:H}=this._processInputParams($),q=(f,w)=>{if(O$(f)||O$(w))return Y;let S=I$(f.value,w.value);if(!S.valid)return M(H,{code:J.invalid_intersection_types}),Y;if(L$(f)||L$(w))_.dirty();return{status:_.value,value:S.data}};if(H.common.async)return Promise.all([this._def.left._parseAsync({data:H.data,path:H.path,parent:H}),this._def.right._parseAsync({data:H.data,path:H.path,parent:H})]).then(([f,w])=>q(f,w));else return q(this._def.left._parseSync({data:H.data,path:H.path,parent:H}),this._def.right._parseSync({data:H.data,path:H.path,parent:H}))}}w$.create=($,_,H)=>{return new w$({left:$,right:_,typeName:E.ZodIntersection,...R(H)})};class P extends b{_parse($){let{status:_,ctx:H}=this._processInputParams($);if(H.parsedType!==Q.array)return M(H,{code:J.invalid_type,expected:Q.array,received:H.parsedType}),Y;if(H.data.length<this._def.items.length)return M(H,{code:J.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Y;if(!this._def.rest&&H.data.length>this._def.items.length)M(H,{code:J.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_.dirty();let f=[...H.data].map((w,S)=>{let X=this._def.items[S]||this._def.rest;if(!X)return null;return X._parse(new g(H,w,H.path,S))}).filter((w)=>!!w);if(H.common.async)return Promise.all(f).then((w)=>{return U.mergeArray(_,w)});else return U.mergeArray(_,f)}get items(){return this._def.items}rest($){return new P({...this._def,rest:$})}}P.create=($,_)=>{if(!Array.isArray($))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new P({items:$,typeName:E.ZodTuple,rest:null,...R(_)})};class j$ extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:_,ctx:H}=this._processInputParams($);if(H.parsedType!==Q.object)return M(H,{code:J.invalid_type,expected:Q.object,received:H.parsedType}),Y;let q=[],f=this._def.keyType,w=this._def.valueType;for(let S in H.data)q.push({key:f._parse(new g(H,S,H.path,S)),value:w._parse(new g(H,H.data[S],H.path,S)),alwaysSet:S in H.data});if(H.common.async)return U.mergeObjectAsync(_,q);else return U.mergeObjectSync(_,q)}get element(){return this._def.valueType}static create($,_,H){if(_ instanceof b)return new j$({keyType:$,valueType:_,typeName:E.ZodRecord,...R(H)});return new j$({keyType:F.create(),valueType:$,typeName:E.ZodRecord,...R(_)})}}class E$ extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:_,ctx:H}=this._processInputParams($);if(H.parsedType!==Q.map)return M(H,{code:J.invalid_type,expected:Q.map,received:H.parsedType}),Y;let q=this._def.keyType,f=this._def.valueType,w=[...H.data.entries()].map(([S,X],G)=>{return{key:q._parse(new g(H,S,H.path,[G,"key"])),value:f._parse(new g(H,X,H.path,[G,"value"]))}});if(H.common.async){let S=new Map;return Promise.resolve().then(async()=>{for(let X of w){let G=await X.key,B=await X.value;if(G.status==="aborted"||B.status==="aborted")return Y;if(G.status==="dirty"||B.status==="dirty")_.dirty();S.set(G.value,B.value)}return{status:_.value,value:S}})}else{let S=new Map;for(let X of w){let{key:G,value:B}=X;if(G.status==="aborted"||B.status==="aborted")return Y;if(G.status==="dirty"||B.status==="dirty")_.dirty();S.set(G.value,B.value)}return{status:_.value,value:S}}}}E$.create=($,_,H)=>{return new E$({valueType:_,keyType:$,typeName:E.ZodMap,...R(H)})};class p extends b{_parse($){let{status:_,ctx:H}=this._processInputParams($);if(H.parsedType!==Q.set)return M(H,{code:J.invalid_type,expected:Q.set,received:H.parsedType}),Y;let q=this._def;if(q.minSize!==null){if(H.data.size<q.minSize.value)M(H,{code:J.too_small,minimum:q.minSize.value,type:"set",inclusive:!0,exact:!1,message:q.minSize.message}),_.dirty()}if(q.maxSize!==null){if(H.data.size>q.maxSize.value)M(H,{code:J.too_big,maximum:q.maxSize.value,type:"set",inclusive:!0,exact:!1,message:q.maxSize.message}),_.dirty()}let f=this._def.valueType;function w(X){let G=new Set;for(let B of X){if(B.status==="aborted")return Y;if(B.status==="dirty")_.dirty();G.add(B.value)}return{status:_.value,value:G}}let S=[...H.data.values()].map((X,G)=>f._parse(new g(H,X,H.path,G)));if(H.common.async)return Promise.all(S).then((X)=>w(X));else return w(S)}min($,_){return new p({...this._def,minSize:{value:$,message:z.toString(_)}})}max($,_){return new p({...this._def,maxSize:{value:$,message:z.toString(_)}})}size($,_){return this.min($,_).max($,_)}nonempty($){return this.min(1,$)}}p.create=($,_)=>{return new p({valueType:$,minSize:null,maxSize:null,typeName:E.ZodSet,...R(_)})};class $$ extends b{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:_}=this._processInputParams($);if(_.parsedType!==Q.function)return M(_,{code:J.invalid_type,expected:Q.function,received:_.parsedType}),Y;function H(S,X){return z$({data:S,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,t(),l].filter((G)=>!!G),issueData:{code:J.invalid_arguments,argumentsError:X}})}function q(S,X){return z$({data:S,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,t(),l].filter((G)=>!!G),issueData:{code:J.invalid_return_type,returnTypeError:X}})}let f={errorMap:_.common.contextualErrorMap},w=_.data;if(this._def.returns instanceof d){let S=this;return D(async function(...X){let G=new N([]),B=await S._def.args.parseAsync(X,f).catch((A)=>{throw G.addIssue(H(X,A)),G}),j=await Reflect.apply(w,this,B);return await S._def.returns._def.type.parseAsync(j,f).catch((A)=>{throw G.addIssue(q(j,A)),G})})}else{let S=this;return D(function(...X){let G=S._def.args.safeParse(X,f);if(!G.success)throw new N([H(X,G.error)]);let B=Reflect.apply(w,this,G.data),j=S._def.returns.safeParse(B,f);if(!j.success)throw new N([q(B,j.error)]);return j.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new $$({...this._def,args:P.create($).rest(y.create())})}returns($){return new $$({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,_,H){return new $$({args:$?$:P.create([]).rest(y.create()),returns:_||y.create(),typeName:E.ZodFunction,...R(H)})}}class S$ extends b{get schema(){return this._def.getter()}_parse($){let{ctx:_}=this._processInputParams($);return this._def.getter()._parse({data:_.data,path:_.path,parent:_})}}S$.create=($,_)=>{return new S$({getter:$,typeName:E.ZodLazy,...R(_)})};class W$ extends b{_parse($){if($.data!==this._def.value){let _=this._getOrReturnCtx($);return M(_,{received:_.data,code:J.invalid_literal,expected:this._def.value}),Y}return{status:"valid",value:$.data}}get value(){return this._def.value}}W$.create=($,_)=>{return new W$({value:$,typeName:E.ZodLiteral,...R(_)})};function c$($,_){return new Z({values:$,typeName:E.ZodEnum,...R(_)})}class Z extends b{_parse($){if(typeof $.data!=="string"){let _=this._getOrReturnCtx($),H=this._def.values;return M(_,{expected:v.joinValues(H),received:_.parsedType,code:J.invalid_type}),Y}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has($.data)){let _=this._getOrReturnCtx($),H=this._def.values;return M(_,{received:_.data,code:J.invalid_enum_value,options:H}),Y}return D($.data)}get options(){return this._def.values}get enum(){let $={};for(let _ of this._def.values)$[_]=_;return $}get Values(){let $={};for(let _ of this._def.values)$[_]=_;return $}get Enum(){let $={};for(let _ of this._def.values)$[_]=_;return $}extract($,_=this._def){return Z.create($,{...this._def,..._})}exclude($,_=this._def){return Z.create(this.options.filter((H)=>!$.includes(H)),{...this._def,..._})}}Z.create=c$;class X$ extends b{_parse($){let _=v.getValidEnumValues(this._def.values),H=this._getOrReturnCtx($);if(H.parsedType!==Q.string&&H.parsedType!==Q.number){let q=v.objectValues(_);return M(H,{expected:v.joinValues(q),received:H.parsedType,code:J.invalid_type}),Y}if(!this._cache)this._cache=new Set(v.getValidEnumValues(this._def.values));if(!this._cache.has($.data)){let q=v.objectValues(_);return M(H,{received:H.data,code:J.invalid_enum_value,options:q}),Y}return D($.data)}get enum(){return this._def.values}}X$.create=($,_)=>{return new X$({values:$,typeName:E.ZodNativeEnum,...R(_)})};class d extends b{unwrap(){return this._def.type}_parse($){let{ctx:_}=this._processInputParams($);if(_.parsedType!==Q.promise&&_.common.async===!1)return M(_,{code:J.invalid_type,expected:Q.promise,received:_.parsedType}),Y;let H=_.parsedType===Q.promise?_.data:Promise.resolve(_.data);return D(H.then((q)=>{return this._def.type.parseAsync(q,{path:_.path,errorMap:_.common.contextualErrorMap})}))}}d.create=($,_)=>{return new d({type:$,typeName:E.ZodPromise,...R(_)})};class C extends b{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===E.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:_,ctx:H}=this._processInputParams($),q=this._def.effect||null,f={addIssue:(w)=>{if(M(H,w),w.fatal)_.abort();else _.dirty()},get path(){return H.path}};if(f.addIssue=f.addIssue.bind(f),q.type==="preprocess"){let w=q.transform(H.data,f);if(H.common.async)return Promise.resolve(w).then(async(S)=>{if(_.value==="aborted")return Y;let X=await this._def.schema._parseAsync({data:S,path:H.path,parent:H});if(X.status==="aborted")return Y;if(X.status==="dirty")return i(X.value);if(_.value==="dirty")return i(X.value);return X});else{if(_.value==="aborted")return Y;let S=this._def.schema._parseSync({data:w,path:H.path,parent:H});if(S.status==="aborted")return Y;if(S.status==="dirty")return i(S.value);if(_.value==="dirty")return i(S.value);return S}}if(q.type==="refinement"){let w=(S)=>{let X=q.refinement(S,f);if(H.common.async)return Promise.resolve(X);if(X instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return S};if(H.common.async===!1){let S=this._def.schema._parseSync({data:H.data,path:H.path,parent:H});if(S.status==="aborted")return Y;if(S.status==="dirty")_.dirty();return w(S.value),{status:_.value,value:S.value}}else return this._def.schema._parseAsync({data:H.data,path:H.path,parent:H}).then((S)=>{if(S.status==="aborted")return Y;if(S.status==="dirty")_.dirty();return w(S.value).then(()=>{return{status:_.value,value:S.value}})})}if(q.type==="transform")if(H.common.async===!1){let w=this._def.schema._parseSync({data:H.data,path:H.path,parent:H});if(!n(w))return Y;let S=q.transform(w.value,f);if(S instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:_.value,value:S}}else return this._def.schema._parseAsync({data:H.data,path:H.path,parent:H}).then((w)=>{if(!n(w))return Y;return Promise.resolve(q.transform(w.value,f)).then((S)=>({status:_.value,value:S}))});v.assertNever(q)}}C.create=($,_,H)=>{return new C({schema:$,typeName:E.ZodEffects,effect:_,...R(H)})};C.createWithPreprocess=($,_,H)=>{return new C({schema:_,effect:{type:"preprocess",transform:$},typeName:E.ZodEffects,...R(H)})};class k extends b{_parse($){if(this._getType($)===Q.undefined)return D(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}k.create=($,_)=>{return new k({innerType:$,typeName:E.ZodOptional,...R(_)})};class T extends b{_parse($){if(this._getType($)===Q.null)return D(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}T.create=($,_)=>{return new T({innerType:$,typeName:E.ZodNullable,...R(_)})};class G$ extends b{_parse($){let{ctx:_}=this._processInputParams($),H=_.data;if(_.parsedType===Q.undefined)H=this._def.defaultValue();return this._def.innerType._parse({data:H,path:_.path,parent:_})}removeDefault(){return this._def.innerType}}G$.create=($,_)=>{return new G$({innerType:$,typeName:E.ZodDefault,defaultValue:typeof _.default==="function"?_.default:()=>_.default,...R(_)})};class J$ extends b{_parse($){let{ctx:_}=this._processInputParams($),H={..._,common:{..._.common,issues:[]}},q=this._def.innerType._parse({data:H.data,path:H.path,parent:{...H}});if(s(q))return q.then((f)=>{return{status:"valid",value:f.status==="valid"?f.value:this._def.catchValue({get error(){return new N(H.common.issues)},input:H.data})}});else return{status:"valid",value:q.status==="valid"?q.value:this._def.catchValue({get error(){return new N(H.common.issues)},input:H.data})}}removeCatch(){return this._def.innerType}}J$.create=($,_)=>{return new J$({innerType:$,typeName:E.ZodCatch,catchValue:typeof _.catch==="function"?_.catch:()=>_.catch,...R(_)})};class R$ extends b{_parse($){if(this._getType($)!==Q.nan){let H=this._getOrReturnCtx($);return M(H,{code:J.invalid_type,expected:Q.nan,received:H.parsedType}),Y}return{status:"valid",value:$.data}}}R$.create=($)=>{return new R$({typeName:E.ZodNaN,...R($)})};var T_=Symbol("zod_brand");class U$ extends b{_parse($){let{ctx:_}=this._processInputParams($),H=_.data;return this._def.type._parse({data:H,path:_.path,parent:_})}unwrap(){return this._def.type}}class b$ extends b{_parse($){let{status:_,ctx:H}=this._processInputParams($);if(H.common.async)return(async()=>{let f=await this._def.in._parseAsync({data:H.data,path:H.path,parent:H});if(f.status==="aborted")return Y;if(f.status==="dirty")return _.dirty(),i(f.value);else return this._def.out._parseAsync({data:f.value,path:H.path,parent:H})})();else{let q=this._def.in._parseSync({data:H.data,path:H.path,parent:H});if(q.status==="aborted")return Y;if(q.status==="dirty")return _.dirty(),{status:"dirty",value:q.value};else return this._def.out._parseSync({data:q.value,path:H.path,parent:H})}}static create($,_){return new b$({in:$,out:_,typeName:E.ZodPipeline})}}class Q$ extends b{_parse($){let _=this._def.innerType._parse($),H=(q)=>{if(n(q))q.value=Object.freeze(q.value);return q};return s(_)?_.then((q)=>H(q)):H(_)}unwrap(){return this._def.innerType}}Q$.create=($,_)=>{return new Q$({innerType:$,typeName:E.ZodReadonly,...R(_)})};function T$($,_){let H=typeof $==="function"?$(_):typeof $==="string"?{message:$}:$;return typeof H==="string"?{message:H}:H}function Z$($,_={},H){if($)return r.create().superRefine((q,f)=>{let w=$(q);if(w instanceof Promise)return w.then((S)=>{if(!S){let X=T$(_,q),G=X.fatal??H??!0;f.addIssue({code:"custom",...X,fatal:G})}});if(!w){let S=T$(_,q),X=S.fatal??H??!0;f.addIssue({code:"custom",...S,fatal:X})}return});return r.create()}var n_={object:O.lazycreate},E;(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(E||(E={}));var y_=($,_={message:`Input not instance of ${$.name}`})=>Z$((H)=>H instanceof $,_),o$=F.create,i$=x.create,x_=R$.create,c_=c.create,u$=_$.create,Z_=u.create,o_=Y$.create,i_=H$.create,u_=f$.create,r_=r.create,p_=y.create,d_=I.create,a_=B$.create,t_=K.create,s_=O.create,e_=O.strictCreate,$H=q$.create,_H=V$.create,HH=w$.create,fH=P.create,qH=j$.create,wH=E$.create,SH=p.create,WH=$$.create,XH=S$.create,GH=W$.create,JH=Z.create,QH=X$.create,MH=d.create,zH=C.create,YH=k.create,BH=T.create,jH=C.createWithPreprocess,EH=b$.create,RH=()=>o$().optional(),bH=()=>i$().optional(),vH=()=>u$().optional(),OH={string:($)=>F.create({...$,coerce:!0}),number:($)=>x.create({...$,coerce:!0}),boolean:($)=>_$.create({...$,coerce:!0}),bigint:($)=>c.create({...$,coerce:!0}),date:($)=>u.create({...$,coerce:!0})};var LH=Y;var r$=W.object({mode:W.enum(["dev","prod"]),url:W.string(),route:W.string().optional(),buildId:W.string().optional(),releaseHash:W.string().optional(),framework:W.string().optional()}),A$=W.object({userAgent:W.string(),viewport:W.object({width:W.number(),height:W.number()}).optional(),language:W.string().optional()}),D$=W.object({file:W.string(),line:W.number().optional(),col:W.number().optional(),fn:W.string().optional(),codeSnippet:W.string().optional()}),N$=W.object({method:W.string(),url:W.string(),status:W.number().optional(),durationMs:W.number().optional(),requestBodySize:W.number().optional(),responseBodySize:W.number().optional(),requestHeaders:W.record(W.string()).optional(),responseHeaders:W.record(W.string()).optional(),error:W.string().optional()}),F$=W.object({level:W.enum(["log","warn","error"]),args:W.array(W.unknown()),timestamp:W.number()}),K$=W.object({localStorage:W.array(W.object({key:W.string(),type:W.string()})).optional(),sessionStorage:W.array(W.object({key:W.string(),type:W.string()})).optional(),cookies:W.array(W.string()).optional()}),k$=W.object({t:W.number(),kind:W.enum(["click","input","scroll","nav","mutation","error"]),target:W.string().optional(),summary:W.string()});var VH=W.enum(["critical","error","warning"]),UH=W.enum(["unresolved","resolved","ignored"]),AH=W.enum(["high","medium","low"]),Df=W.object({id:W.string(),fingerprint:W.string(),title:W.string(),errorType:W.string(),severity:VH,status:UH,count:W.number().int().positive(),firstSeen:W.number(),lastSeen:W.number(),environments:W.array(W.enum(["dev","prod"])),sampleIds:W.array(W.string()),diagnosisId:W.string().optional(),projectKey:W.string()}),Nf=W.object({id:W.string(),groupId:W.string(),projectKey:W.string(),environmentMode:W.enum(["dev","prod"]),createdAt:W.number(),errorType:W.string(),errorMessage:W.string(),normalizedMessage:W.string(),stackFrames:W.array(D$),consoleEntries:W.array(F$),networkEntries:W.array(N$),storageSnapshot:K$.optional(),timeline:W.array(k$),replayRef:W.string().optional(),device:A$,url:W.string(),route:W.string().optional()}),Ff=W.object({id:W.string(),groupId:W.string(),createdAt:W.number(),model:W.string(),rootCause:W.string(),plainSummary:W.string(),fixPrompt:W.string(),confidence:AH,analyzedSampleIds:W.array(W.string())});var Cf=W.object({projectKey:W.string(),error:W.object({type:W.string(),message:W.string(),stack:W.array(D$)}),environment:r$,device:A$,consoleEntries:W.array(F$).default([]),networkEntries:W.array(N$).default([]),storageSnapshot:K$.optional(),timeline:W.array(k$).default([])});var DH=new Set(["authorization","cookie","set-cookie","x-api-key","x-auth-token","x-secret"]),NH=new Set(["token","key","secret","password","api_key","access_token","refresh_token","client_secret","apikey"]),FH=/eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*/g,KH=/\b(sk-|pk_live_|pk_test_|Bearer\s)\S+/g;function g$($){try{let _=new URL($);for(let H of _.searchParams.keys())if(NH.has(H.toLowerCase()))_.searchParams.set(H,"[redacted]");return _.toString()}catch{return $}}function p$($){let _={};for(let[H,q]of Object.entries($))if(!DH.has(H.toLowerCase()))_[H]=q;return _}function d$($){return $.map((_)=>({..._,url:g$(_.url),requestHeaders:_.requestHeaders?p$(_.requestHeaders):void 0,responseHeaders:_.responseHeaders?p$(_.responseHeaders):void 0}))}function kH($){return $.replace(FH,"[token]").replace(KH,"$1[api-key]")}function a$($){return $.map((_)=>({..._,args:_.args.map((H)=>typeof H==="string"?kH(H):H)}))}function gH(){try{if("__ASTRO__"in window)return"astro";if("__NEXT_DATA__"in window)return"next";if(document.querySelector("meta[name='generator'][content*='Astro']"))return"astro";let $=void 0;if($&&Object.keys($).some((_)=>_.startsWith("VITE_")))return"vite"}catch{}return}function CH(){return{userAgent:navigator.userAgent,viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}function t$($,_,H){return{projectKey:$.projectKey,error:{type:_.type,message:_.message,stack:_.stack},environment:{mode:$.environment,url:window.location.href,route:window.location.pathname,framework:gH(),buildId:$.buildId},device:CH(),consoleEntries:a$(H.console),networkEntries:d$(H.network),timeline:H.replay}}function P$($){if(!$)return[];return $.split(`
2
+ `).slice(1).map((_)=>_.trim()).filter((_)=>_.startsWith("at ")).map((_)=>{let H=_.match(/^at (.+?) \((.+):(\d+):(\d+)\)$/);if(H)return{fn:H[1],file:H[2],line:parseInt(H[3],10),col:parseInt(H[4],10)};let q=_.match(/^at (.+):(\d+):(\d+)$/);if(q)return{file:q[1],line:parseInt(q[2],10),col:parseInt(q[3],10)};return{file:_.replace(/^at /,"")}})}function s$($){if($ instanceof Error)return{type:$.name||"Error",message:$.message,stack:P$($.stack)};return{type:"UnknownError",message:String($),stack:[]}}function e$($){let _=(q)=>{q.preventDefault(),$(s$(q.error??Error(q.message)))},H=(q)=>{q.preventDefault(),$(s$(q.reason))};return window.addEventListener("error",_),window.addEventListener("unhandledrejection",H),()=>{window.removeEventListener("error",_),window.removeEventListener("unhandledrejection",H)}}var $_=["log","warn","error"];function hH($){if(typeof $==="string"||typeof $==="number"||typeof $==="boolean")return $;try{return String($)}catch{return"[unserializable]"}}function __($){let _={};for(let H of $_)_[H]=console[H].bind(console),console[H]=(...q)=>{_[H](...q),$.push({level:H,args:q.map(hH),timestamp:Date.now()})};return()=>{for(let H of $_)console[H]=_[H]}}function H_($,_){let H=window.fetch.bind(window),q=XMLHttpRequest.prototype.open,f=XMLHttpRequest.prototype.send;function w(X){return!!_&&X.startsWith(_)}window.fetch=async(X,G)=>{let B=G?.method??"GET",j=g$(typeof X==="string"?X:X instanceof URL?X.href:X.url),L=Date.now();if(w(j))return H(X,G);let A;if(G?.body&&typeof G.body==="string")A=new TextEncoder().encode(G.body).length;try{let V=await H(X,G),o=V.clone(),a;try{a=(await o.arrayBuffer()).byteLength}catch{}return $.push({method:B,url:j,status:V.status,durationMs:Date.now()-L,requestBodySize:A,responseBodySize:a,timestamp:Date.now()}),V}catch(V){throw $.push({method:B,url:j,durationMs:Date.now()-L,error:String(V),timestamp:Date.now()}),V}};let S=new WeakMap;return XMLHttpRequest.prototype.open=function(X,G,...B){let j=g$(String(G));return S.set(this,{method:X,url:j,start:0,skip:w(j)}),q.call(this,X,G,...B)},XMLHttpRequest.prototype.send=function(X){let G=S.get(this);if(G)G.start=Date.now();return this.addEventListener("loadend",()=>{if(!G||G.skip)return;$.push({method:G.method,url:G.url,status:this.status||void 0,durationMs:Date.now()-G.start,timestamp:Date.now()})}),f.call(this,X)},()=>{window.fetch=H,XMLHttpRequest.prototype.open=q,XMLHttpRequest.prototype.send=f}}function f_($){if($.id)return`#${$.id}`.slice(0,60);let _=Array.from($.classList).slice(0,2).join(".");return(_?`${$.tagName.toLowerCase()}.${_}`:$.tagName.toLowerCase()).slice(0,60)}function q_($){let _=[],H=0,q=(j)=>{let L=Date.now(),A=j.target instanceof Element?f_(j.target):"unknown",V=j.target instanceof Element?(j.target.textContent??"").trim().slice(0,40):"";$.push({t:L,kind:"click",target:A,summary:V?`click on "${V}"`:`click on ${A}`,timestamp:L})};document.addEventListener("click",q,{capture:!0,passive:!0}),_.push(()=>document.removeEventListener("click",q,{capture:!0}));let f=(j)=>{if(!(j.target instanceof HTMLInputElement))return;let L=Date.now(),A=f_(j.target),V=j.target.type||"text";$.push({t:L,kind:"input",target:A,summary:`input[type=${V}] changed`,timestamp:L})};document.addEventListener("input",f,{capture:!0,passive:!0}),_.push(()=>document.removeEventListener("input",f,{capture:!0}));let w=0,S=()=>{let j=Date.now();if(j-w<500)return;w=j,$.push({t:j,kind:"scroll",summary:`scroll to (${Math.round(window.scrollX)}, ${Math.round(window.scrollY)})`,timestamp:j})};document.addEventListener("scroll",S,{capture:!0,passive:!0}),_.push(()=>document.removeEventListener("scroll",S,{capture:!0}));let X=()=>{let j=Date.now();$.push({t:j,kind:"nav",summary:`nav to ${location.pathname}${location.search}`,timestamp:j})};window.addEventListener("popstate",X),_.push(()=>window.removeEventListener("popstate",X));let G=(j)=>{let L=history[j].bind(history);return history[j]=function(...A){L(...A);let V=Date.now();$.push({t:V,kind:"nav",summary:`nav to ${location.pathname}${location.search}`,timestamp:V})},()=>{history[j]=L}};_.push(G("pushState")),_.push(G("replaceState"));let B=new MutationObserver((j)=>{let L=Date.now();if(L-H<500)return;H=L;let A=j.reduce((a,v$)=>a+v$.addedNodes.length,0),V=j.reduce((a,v$)=>a+v$.removedNodes.length,0),o=[];if(A>0)o.push(`+${A} nodes`);if(V>0)o.push(`-${V} nodes`);if(o.length===0)o.push("attr changed");$.push({t:L,kind:"mutation",summary:`DOM: ${o.join(", ")}`,timestamp:L})});return B.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0}),_.push(()=>B.disconnect()),()=>_.forEach((j)=>j())}async function w_($,_){try{await fetch(`${$}/api/collect`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_),keepalive:!0})}catch{}}var IH=["chrome-extension://","moz-extension://","safari-extension://","safari-web-extension://","ms-browser-extension://"],PH=["top.GLOBALS","originalCreateNotification","canvas.contentDocument","MyApp_RemoveAllHighlights","atomicFindClose","fb_xd_fragment","bmi_SafeAddOnload","EBCallBackMessageReceived","conduitPage","_avast_submit","ComboSearch is not defined","jigsaw is not defined","__gCrWeb"];var lH=["_AutofillCallbackHandler","currentInset"],mH=["Googlebot","Bingbot","Slurp","DuckDuckBot","Baiduspider","YandexBot","Sogou","Exabot","facebot","ia_archiver","Prerender","HeadlessChrome","PhantomJS","Selenium","Puppeteer"],TH=["Instagram","FBAN","FBAV"],nH=["MSIE ","Trident/"],yH=["Object doesn't support this property or method","Access is denied.","The object invoked has disconnected from its clients","Unspecified error."];function xH($){return $.stack.some((_)=>IH.some((H)=>_.file?.startsWith(H)))}function cH($){return PH.some((_)=>$.includes(_))}function ZH($){let _=$.toLowerCase();return mH.some((H)=>_.includes(H.toLowerCase()))}function oH($,_){if(nH.some((H)=>_.includes(H)))return!0;if(yH.some((H)=>$.message.includes(H)))return!0;return!1}function iH($){let _=$.message.trim();return!_||_==="undefined"||_==="null"||_==="error"}function S_($){let _=typeof navigator<"u"?navigator.userAgent:"";if(ZH(_))return!0;if(TH.some((q)=>_.includes(q)))return!0;if(oH($,_))return!0;if(iH($))return!0;let H=$.message;if(H==="Script error."&&$.stack.length===0)return!0;if(H.includes("ResizeObserver loop completed"))return!0;if(lH.some((q)=>H.includes(q)))return!0;if(cH(H))return!0;if($.stack.length>0&&xH($))return!0;return!1}function W_($){if(!$.projectKey)return{capture(){},destroy(){}};let _=($.bufferSeconds??15)*1000,H=new M$(_),q=new M$(_),f=new M$(_),w=[__(H),H_(q,$.endpoint),q_(f)];function S(X){if(S_(X))return;let G=t$($,X,{console:H.flush(),network:q.flush().map(({timestamp:B,...j})=>j),replay:f.flush().map(({timestamp:B,...j})=>j)});w_($.endpoint,G)}return w.push(e$(S)),{capture(X){S(uH(X))},destroy(){w.forEach((X)=>X()),H.clear(),q.clear(),f.clear()}}}function uH($){if($ instanceof Error)return{type:$.name||"Error",message:$.message,stack:P$($.stack)};return{type:"UnknownError",message:String($),stack:[]}}var rH=document.currentScript;function X_(){let $=rH??document.querySelector("script[data-project-key]"),_=$?.dataset.projectKey??"",H=$?.dataset.endpoint??"https://app.snapfail.com",q=$?.dataset.buildId??void 0,f=$?.dataset.env,w=f==="dev"||f==="prod"?f:location.hostname==="localhost"||location.hostname==="127.0.0.1"?"dev":"prod";if(!_){console.warn("[snapfail] missing data-project-key attribute on <script> tag");return}window.Snapfail=W_({projectKey:_,endpoint:H,environment:w,buildId:q})}if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",X_);else X_();})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapfail/browser",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "type": "module",
5
5
  "description": "Browser SDK for snapfail — error capture, replay and transport",
6
6
  "license": "MIT",
@@ -14,7 +14,7 @@
14
14
  "files": ["dist"],
15
15
  "scripts": {
16
16
  "build": "bun build src/index.ts --outdir dist --target browser --format esm --sourcemap=none && bun tsc -p tsconfig.build.json --outDir dist",
17
- "build:iife": "bun build src/auto-init.ts --outfile dist/snapfail.iife.js --target browser --format iife --minify",
17
+ "build:iife": "bun build src/auto-init.ts --outfile dist/snapfail.iife.js --target browser --format iife --minify --define 'import.meta.env=undefined'",
18
18
  "prepublishOnly": "bun run build"
19
19
  },
20
20
  "dependencies": {