/* aaio-js v1.9.0 */ (function(){"use strict";var Rn=typeof global=="object"&&global&&global.Object===Object&&global;const Kt=Rn;var Nn=typeof self=="object"&&self&&self.Object===Object&&self,On=Kt||Nn||Function("return this")();const $=On;var An=$.Symbol;const ce=An;var qt=Object.prototype,xn=qt.hasOwnProperty,Mn=qt.toString,Pe=ce?ce.toStringTag:void 0;function Pn(t){var e=xn.call(t,Pe),r=t[Pe];try{t[Pe]=void 0;var n=!0}catch{}var a=Mn.call(t);return n&&(e?t[Pe]=r:delete t[Pe]),a}var Un=Object.prototype,kn=Un.toString;function Dn(t){return kn.call(t)}var Fn="[object Null]",Zn="[object Undefined]",$t=ce?ce.toStringTag:void 0;function Ie(t){return t==null?t===void 0?Zn:Fn:$t&&$t in Object(t)?Pn(t):Dn(t)}function Ce(t){return t!=null&&typeof t=="object"}var jn="[object Symbol]";function Qe(t){return typeof t=="symbol"||Ce(t)&&Ie(t)==jn}function Vn(t,e){for(var r=-1,n=t==null?0:t.length,a=Array(n);++r-1&&t%1==0&&t-1&&t%1==0&&t<=wa}function lr(t){return t!=null&&vt(t.length)&&!sr(t)}var ba=Object.prototype;function Ta(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||ba;return t===r}function Ea(t,e){for(var r=-1,n=Array(t);++r-1}function Ds(t,e){var r=this.__data__,n=He(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}function ne(t){var e=-1,r=t==null?0:t.length;for(this.clear();++eo))return!1;var l=s.get(t),u=s.get(e);if(l&&u)return l==e&&u==t;var _=-1,y=!0,b=r&Ai?new $e:void 0;for(s.set(t,e),s.set(e,t);++_=e||C<0||_&&M>=s}function O(){var T=At();if(I(T))return D(T);o=setTimeout(O,x(T))}function D(T){return o=void 0,y&&n?b(T):(n=a=void 0,i)}function V(){o!==void 0&&clearTimeout(o),l=0,n=c=a=o=void 0}function F(){return o===void 0?i:D(At())}function L(){var T=At(),C=I(T);if(n=arguments,a=this,c=T,C){if(o===void 0)return N(c);if(_)return clearTimeout(o),o=setTimeout(O,e),b(c)}return o===void 0&&(o=setTimeout(O,e)),i}return L.cancel=V,L.flush=F,L}var Ao=Object.prototype,xo=Ao.hasOwnProperty,Mo=Io(function(t,e,r){xo.call(t,r)?t[r].push(e):va(t,r,[e])});const jr=Mo;var A;(function(t){t.assertEqual=a=>a;function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{const s={};for(const i of a)s[i]=i;return s},t.getValidEnumValues=a=>{const s=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),i={};for(const o of s)i[o]=a[o];return t.objectValues(i)},t.objectValues=a=>t.objectKeys(a).map(function(s){return a[s]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const s=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&s.push(i);return s},t.find=(a,s)=>{for(const i of a)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(A||(A={}));var xt;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(xt||(xt={}));const f=A.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),le=t=>{switch(typeof t){case"undefined":return f.undefined;case"string":return f.string;case"number":return isNaN(t)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(t)?f.array:t===null?f.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?f.promise:typeof Map<"u"&&t instanceof Map?f.map:typeof Set<"u"&&t instanceof Set?f.set:typeof Date<"u"&&t instanceof Date?f.date:f.object;default:return f.unknown}},h=A.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"]),Po=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class z extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const r=e||function(s){return s.message},n={_errors:[]},a=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let o=n,c=0;for(;cr.message){const r={},n=[];for(const a of this.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}z.create=t=>new z(t);const Fe=(t,e)=>{let r;switch(t.code){case h.invalid_type:t.received===f.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case h.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,A.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:r=`Unrecognized key(s) in object: ${A.joinValues(t.keys,", ")}`;break;case h.invalid_union:r="Invalid input";break;case h.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${A.joinValues(t.options)}`;break;case h.invalid_enum_value:r=`Invalid enum value. Expected ${A.joinValues(t.options)}, received '${t.received}'`;break;case h.invalid_arguments:r="Invalid function arguments";break;case h.invalid_return_type:r="Invalid function return type";break;case h.invalid_date:r="Invalid date";break;case h.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:A.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case h.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case h.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case h.custom:r="Invalid input";break;case h.invalid_intersection_types:r="Intersection results could not be merged";break;case h.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case h.not_finite:r="Number must be finite";break;default:r=e.defaultError,A.assertNever(t)}return{message:r}};let Vr=Fe;function Uo(t){Vr=t}function tt(){return Vr}const rt=t=>{const{data:e,path:r,errorMaps:n,issueData:a}=t,s=[...r,...a.path||[]],i={...a,path:s};let o="";const c=n.filter(l=>!!l).slice().reverse();for(const l of c)o=l(i,{data:e,defaultError:o}).message;return{...a,path:s,message:a.message||o}},ko=[];function p(t,e){const r=rt({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,tt(),Fe].filter(n=>!!n)});t.common.issues.push(r)}class Z{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const a of r){if(a.status==="aborted")return E;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const a of r)n.push({key:await a.key,value:await a.value});return Z.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const a of r){const{key:s,value:i}=a;if(s.status==="aborted"||i.status==="aborted")return E;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),(typeof i.value<"u"||a.alwaysSet)&&(n[s.value]=i.value)}return{status:e.value,value:n}}}const E=Object.freeze({status:"aborted"}),Lr=t=>({status:"dirty",value:t}),W=t=>({status:"valid",value:t}),Mt=t=>t.status==="aborted",Pt=t=>t.status==="dirty",nt=t=>t.status==="valid",at=t=>typeof Promise<"u"&&t instanceof Promise;var v;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(v||(v={}));class te{constructor(e,r,n,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Wr=(t,e)=>{if(nt(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new z(t.common.issues);return this._error=r,this._error}}};function S(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:a}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,o)=>i.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:r??o.defaultError},description:a}}class R{constructor(e){this.spa=this.safeParseAsync,this._def=e,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.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return le(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:le(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Z,ctx:{common:e.parent.common,data:e.data,parsedType:le(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(at(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;const a={common:{issues:[],async:(n=r==null?void 0:r.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:le(e)},s=this._parseSync({data:e,path:a.path,parent:a});return Wr(a,s)}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:le(e)},a=this._parse({data:e,path:n.path,parent:n}),s=await(at(a)?a:Promise.resolve(a));return Wr(n,s)}refine(e,r){const n=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,s)=>{const i=e(a),o=()=>s.addIssue({code:h.custom,...n(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(e){return new H({schema:this,typeName:w.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return oe.create(this,this._def)}nullable(){return Te.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Q.create(this,this._def)}promise(){return xe.create(this,this._def)}or(e){return Le.create([this,e],this._def)}and(e){return We.create(this,e,this._def)}transform(e){return new H({...S(this._def),schema:this,typeName:w.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new ze({...S(this._def),innerType:this,defaultValue:r,typeName:w.ZodDefault})}brand(){return new Yr({typeName:w.ZodBranded,type:this,...S(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new lt({...S(this._def),innerType:this,catchValue:r,typeName:w.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Be.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Do=/^c[^\s-]{8,}$/i,Fo=/^[a-z][a-z0-9]*$/,Zo=/[0-9A-HJKMNP-TV-Z]{26}/,jo=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,Vo=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/,Lo=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,Wo=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Go=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Yo=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function Jo(t,e){return!!((e==="v4"||!e)&&Wo.test(t)||(e==="v6"||!e)&&Go.test(t))}class B extends R{constructor(){super(...arguments),this._regex=(e,r,n)=>this.refinement(a=>e.test(a),{validation:r,code:h.invalid_string,...v.errToObj(n)}),this.nonempty=e=>this.min(1,v.errToObj(e)),this.trim=()=>new B({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new B({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new B({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){const s=this._getOrReturnCtx(e);return p(s,{code:h.invalid_type,expected:f.string,received:s.parsedType}),E}const n=new Z;let a;for(const s of this._def.checks)if(s.kind==="min")e.data.lengths.value&&(a=this._getOrReturnCtx(e,a),p(a,{code:h.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const i=e.data.length>s.value,o=e.data.length"u"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!==null&&r!==void 0?r:!1,...v.errToObj(e==null?void 0:e.message)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...v.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...v.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...v.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...v.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...v.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...v.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...v.errToObj(r)})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value{var e;return new B({checks:[],typeName:w.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...S(t)})};function Xo(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=r>n?r:n,s=parseInt(t.toFixed(a).replace(".","")),i=parseInt(e.toFixed(a).replace(".",""));return s%i/Math.pow(10,a)}class ue extends R{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){const s=this._getOrReturnCtx(e);return p(s,{code:h.invalid_type,expected:f.number,received:s.parsedType}),E}let n;const a=new Z;for(const s of this._def.checks)s.kind==="int"?A.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:h.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?Xo(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_finite,message:s.message}),a.dirty()):A.assertNever(s);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,v.toString(r))}gt(e,r){return this.setLimit("min",e,!1,v.toString(r))}lte(e,r){return this.setLimit("max",e,!0,v.toString(r))}lt(e,r){return this.setLimit("max",e,!1,v.toString(r))}setLimit(e,r,n,a){return new ue({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:v.toString(a)}]})}_addCheck(e){return new ue({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:v.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&A.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.valuenew ue({checks:[],typeName:w.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...S(t)});class he extends R{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==f.bigint){const s=this._getOrReturnCtx(e);return p(s,{code:h.invalid_type,expected:f.bigint,received:s.parsedType}),E}let n;const a=new Z;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),p(n,{code:h.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):A.assertNever(s);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,v.toString(r))}gt(e,r){return this.setLimit("min",e,!1,v.toString(r))}lte(e,r){return this.setLimit("max",e,!0,v.toString(r))}lt(e,r){return this.setLimit("max",e,!1,v.toString(r))}setLimit(e,r,n,a){return new he({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:v.toString(a)}]})}_addCheck(e){return new he({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value{var e;return new he({checks:[],typeName:w.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...S(t)})};class Ze extends R{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:f.boolean,received:n.parsedType}),E}return W(e.data)}}Ze.create=t=>new Ze({typeName:w.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...S(t)});class ve extends R{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){const s=this._getOrReturnCtx(e);return p(s,{code:h.invalid_type,expected:f.date,received:s.parsedType}),E}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return p(s,{code:h.invalid_date}),E}const n=new Z;let a;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()s.value&&(a=this._getOrReturnCtx(e,a),p(a,{code:h.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):A.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ve({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:v.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:v.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew ve({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:w.ZodDate,...S(t)});class st extends R{_parse(e){if(this._getType(e)!==f.symbol){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:f.symbol,received:n.parsedType}),E}return W(e.data)}}st.create=t=>new st({typeName:w.ZodSymbol,...S(t)});class je extends R{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:f.undefined,received:n.parsedType}),E}return W(e.data)}}je.create=t=>new je({typeName:w.ZodUndefined,...S(t)});class Ve extends R{_parse(e){if(this._getType(e)!==f.null){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:f.null,received:n.parsedType}),E}return W(e.data)}}Ve.create=t=>new Ve({typeName:w.ZodNull,...S(t)});class Ne extends R{constructor(){super(...arguments),this._any=!0}_parse(e){return W(e.data)}}Ne.create=t=>new Ne({typeName:w.ZodAny,...S(t)});class we extends R{constructor(){super(...arguments),this._unknown=!0}_parse(e){return W(e.data)}}we.create=t=>new we({typeName:w.ZodUnknown,...S(t)});class ie extends R{_parse(e){const r=this._getOrReturnCtx(e);return p(r,{code:h.invalid_type,expected:f.never,received:r.parsedType}),E}}ie.create=t=>new ie({typeName:w.ZodNever,...S(t)});class it extends R{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:f.void,received:n.parsedType}),E}return W(e.data)}}it.create=t=>new it({typeName:w.ZodVoid,...S(t)});class Q extends R{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),a=this._def;if(r.parsedType!==f.array)return p(r,{code:h.invalid_type,expected:f.array,received:r.parsedType}),E;if(a.exactLength!==null){const i=r.data.length>a.exactLength.value,o=r.data.lengtha.maxLength.value&&(p(r,{code:h.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>a.type._parseAsync(new te(r,i,r.path,o)))).then(i=>Z.mergeArray(n,i));const s=[...r.data].map((i,o)=>a.type._parseSync(new te(r,i,r.path,o)));return Z.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new Q({...this._def,minLength:{value:e,message:v.toString(r)}})}max(e,r){return new Q({...this._def,maxLength:{value:e,message:v.toString(r)}})}length(e,r){return new Q({...this._def,exactLength:{value:e,message:v.toString(r)}})}nonempty(e){return this.min(1,e)}}Q.create=(t,e)=>new Q({type:t,minLength:null,maxLength:null,exactLength:null,typeName:w.ZodArray,...S(e)});function Oe(t){if(t instanceof k){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=oe.create(Oe(n))}return new k({...t._def,shape:()=>e})}else return t instanceof Q?new Q({...t._def,type:Oe(t.element)}):t instanceof oe?oe.create(Oe(t.unwrap())):t instanceof Te?Te.create(Oe(t.unwrap())):t instanceof re?re.create(t.items.map(e=>Oe(e))):t}class k extends R{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=A.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==f.object){const l=this._getOrReturnCtx(e);return p(l,{code:h.invalid_type,expected:f.object,received:l.parsedType}),E}const{status:n,ctx:a}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ie&&this._def.unknownKeys==="strip"))for(const l in a.data)i.includes(l)||o.push(l);const c=[];for(const l of i){const u=s[l],_=a.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new te(a,_,a.path,l)),alwaysSet:l in a.data})}if(this._def.catchall instanceof ie){const l=this._def.unknownKeys;if(l==="passthrough")for(const u of o)c.push({key:{status:"valid",value:u},value:{status:"valid",value:a.data[u]}});else if(l==="strict")o.length>0&&(p(a,{code:h.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const u of o){const _=a.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new te(a,_,a.path,u)),alwaysSet:u in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const l=[];for(const u of c){const _=await u.key;l.push({key:_,value:await u.value,alwaysSet:u.alwaysSet})}return l}).then(l=>Z.mergeObjectSync(n,l)):Z.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return v.errToObj,new k({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var a,s,i,o;const c=(i=(s=(a=this._def).errorMap)===null||s===void 0?void 0:s.call(a,r,n).message)!==null&&i!==void 0?i:n.defaultError;return r.code==="unrecognized_keys"?{message:(o=v.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new k({...this._def,unknownKeys:"strip"})}passthrough(){return new k({...this._def,unknownKeys:"passthrough"})}extend(e){return new k({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new k({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:w.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new k({...this._def,catchall:e})}pick(e){const r={};return A.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new k({...this._def,shape:()=>r})}omit(e){const r={};return A.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new k({...this._def,shape:()=>r})}deepPartial(){return Oe(this)}partial(e){const r={};return A.objectKeys(this.shape).forEach(n=>{const a=this.shape[n];e&&!e[n]?r[n]=a:r[n]=a.optional()}),new k({...this._def,shape:()=>r})}required(e){const r={};return A.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof oe;)s=s._def.innerType;r[n]=s}}),new k({...this._def,shape:()=>r})}keyof(){return Gr(A.objectKeys(this.shape))}}k.create=(t,e)=>new k({shape:()=>t,unknownKeys:"strip",catchall:ie.create(),typeName:w.ZodObject,...S(e)}),k.strictCreate=(t,e)=>new k({shape:()=>t,unknownKeys:"strict",catchall:ie.create(),typeName:w.ZodObject,...S(e)}),k.lazycreate=(t,e)=>new k({shape:t,unknownKeys:"strip",catchall:ie.create(),typeName:w.ZodObject,...S(e)});class Le extends R{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function a(s){for(const o of s)if(o.result.status==="valid")return o.result;for(const o of s)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const i=s.map(o=>new z(o.ctx.common.issues));return p(r,{code:h.invalid_union,unionErrors:i}),E}if(r.common.async)return Promise.all(n.map(async s=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(a);{let s;const i=[];for(const c of n){const l={...r,common:{...r.common,issues:[]},parent:null},u=c._parseSync({data:r.data,path:r.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;const o=i.map(c=>new z(c));return p(r,{code:h.invalid_union,unionErrors:o}),E}}get options(){return this._def.options}}Le.create=(t,e)=>new Le({options:t,typeName:w.ZodUnion,...S(e)});const ot=t=>t instanceof Ye?ot(t.schema):t instanceof H?ot(t.innerType()):t instanceof Je?[t.value]:t instanceof fe?t.options:t instanceof Xe?Object.keys(t.enum):t instanceof ze?ot(t._def.innerType):t instanceof je?[void 0]:t instanceof Ve?[null]:null;class ct extends R{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==f.object)return p(r,{code:h.invalid_type,expected:f.object,received:r.parsedType}),E;const n=this.discriminator,a=r.data[n],s=this.optionsMap.get(a);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(p(r,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),E)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){const a=new Map;for(const s of r){const i=ot(s.shape[e]);if(!i)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,s)}}return new ct({typeName:w.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:a,...S(n)})}}function Ut(t,e){const r=le(t),n=le(e);if(t===e)return{valid:!0,data:t};if(r===f.object&&n===f.object){const a=A.objectKeys(e),s=A.objectKeys(t).filter(o=>a.indexOf(o)!==-1),i={...t,...e};for(const o of s){const c=Ut(t[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(r===f.array&&n===f.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let s=0;s{if(Mt(s)||Mt(i))return E;const o=Ut(s.value,i.value);return o.valid?((Pt(s)||Pt(i))&&r.dirty(),{status:r.value,value:o.data}):(p(n,{code:h.invalid_intersection_types}),E)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,i])=>a(s,i)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}We.create=(t,e,r)=>new We({left:t,right:e,typeName:w.ZodIntersection,...S(r)});class re extends R{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.array)return p(n,{code:h.invalid_type,expected:f.array,received:n.parsedType}),E;if(n.data.lengththis._def.items.length&&(p(n,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const s=[...n.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new te(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>Z.mergeArray(r,i)):Z.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new re({...this._def,rest:e})}}re.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new re({items:t,typeName:w.ZodTuple,rest:null,...S(e)})};class Ge extends R{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.object)return p(n,{code:h.invalid_type,expected:f.object,received:n.parsedType}),E;const a=[],s=this._def.keyType,i=this._def.valueType;for(const o in n.data)a.push({key:s._parse(new te(n,o,n.path,o)),value:i._parse(new te(n,n.data[o],n.path,o))});return n.common.async?Z.mergeObjectAsync(r,a):Z.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof R?new Ge({keyType:e,valueType:r,typeName:w.ZodRecord,...S(n)}):new Ge({keyType:B.create(),valueType:e,typeName:w.ZodRecord,...S(r)})}}class dt extends R{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.map)return p(n,{code:h.invalid_type,expected:f.map,received:n.parsedType}),E;const a=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([o,c],l)=>({key:a._parse(new te(n,o,n.path,[l,"key"])),value:s._parse(new te(n,c,n.path,[l,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return E;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),o.set(l.value,u.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const c of i){const l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return E;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),o.set(l.value,u.value)}return{status:r.value,value:o}}}}dt.create=(t,e,r)=>new dt({valueType:e,keyType:t,typeName:w.ZodMap,...S(r)});class be extends R{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.set)return p(n,{code:h.invalid_type,expected:f.set,received:n.parsedType}),E;const a=this._def;a.minSize!==null&&n.data.sizea.maxSize.value&&(p(n,{code:h.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const s=this._def.valueType;function i(c){const l=new Set;for(const u of c){if(u.status==="aborted")return E;u.status==="dirty"&&r.dirty(),l.add(u.value)}return{status:r.value,value:l}}const o=[...n.data.values()].map((c,l)=>s._parse(new te(n,c,n.path,l)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,r){return new be({...this._def,minSize:{value:e,message:v.toString(r)}})}max(e,r){return new be({...this._def,maxSize:{value:e,message:v.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}be.create=(t,e)=>new be({valueType:t,minSize:null,maxSize:null,typeName:w.ZodSet,...S(e)});class Ae extends R{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==f.function)return p(r,{code:h.invalid_type,expected:f.function,received:r.parsedType}),E;function n(o,c){return rt({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,tt(),Fe].filter(l=>!!l),issueData:{code:h.invalid_arguments,argumentsError:c}})}function a(o,c){return rt({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,tt(),Fe].filter(l=>!!l),issueData:{code:h.invalid_return_type,returnTypeError:c}})}const s={errorMap:r.common.contextualErrorMap},i=r.data;return this._def.returns instanceof xe?W(async(...o)=>{const c=new z([]),l=await this._def.args.parseAsync(o,s).catch(y=>{throw c.addIssue(n(o,y)),c}),u=await i(...l);return await this._def.returns._def.type.parseAsync(u,s).catch(y=>{throw c.addIssue(a(u,y)),c})}):W((...o)=>{const c=this._def.args.safeParse(o,s);if(!c.success)throw new z([n(o,c.error)]);const l=i(...c.data),u=this._def.returns.safeParse(l,s);if(!u.success)throw new z([a(l,u.error)]);return u.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ae({...this._def,args:re.create(e).rest(we.create())})}returns(e){return new Ae({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new Ae({args:e||re.create([]).rest(we.create()),returns:r||we.create(),typeName:w.ZodFunction,...S(n)})}}class Ye extends R{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}Ye.create=(t,e)=>new Ye({getter:t,typeName:w.ZodLazy,...S(e)});class Je extends R{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return p(r,{received:r.data,code:h.invalid_literal,expected:this._def.value}),E}return{status:"valid",value:e.data}}get value(){return this._def.value}}Je.create=(t,e)=>new Je({value:t,typeName:w.ZodLiteral,...S(e)});function Gr(t,e){return new fe({values:t,typeName:w.ZodEnum,...S(e)})}class fe extends R{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return p(r,{expected:A.joinValues(n),received:r.parsedType,code:h.invalid_type}),E}if(this._def.values.indexOf(e.data)===-1){const r=this._getOrReturnCtx(e),n=this._def.values;return p(r,{received:r.data,code:h.invalid_enum_value,options:n}),E}return W(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e){return fe.create(e)}exclude(e){return fe.create(this.options.filter(r=>!e.includes(r)))}}fe.create=Gr;class Xe extends R{_parse(e){const r=A.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==f.string&&n.parsedType!==f.number){const a=A.objectValues(r);return p(n,{expected:A.joinValues(a),received:n.parsedType,code:h.invalid_type}),E}if(r.indexOf(e.data)===-1){const a=A.objectValues(r);return p(n,{received:n.data,code:h.invalid_enum_value,options:a}),E}return W(e.data)}get enum(){return this._def.values}}Xe.create=(t,e)=>new Xe({values:t,typeName:w.ZodNativeEnum,...S(e)});class xe extends R{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==f.promise&&r.common.async===!1)return p(r,{code:h.invalid_type,expected:f.promise,received:r.parsedType}),E;const n=r.parsedType===f.promise?r.data:Promise.resolve(r.data);return W(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}}xe.create=(t,e)=>new xe({type:t,typeName:w.ZodPromise,...S(e)});class H extends R{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===w.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=this._def.effect||null;if(a.type==="preprocess"){const i=a.transform(n.data);return n.common.async?Promise.resolve(i).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:i,path:n.path,parent:n})}const s={addIssue:i=>{p(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="refinement"){const i=o=>{const c=a.refinement(o,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?E:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?E:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(a.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!nt(i))return i;const o=a.transform(i.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>nt(i)?Promise.resolve(a.transform(i.value,s)).then(o=>({status:r.value,value:o})):i);A.assertNever(a)}}H.create=(t,e,r)=>new H({schema:t,typeName:w.ZodEffects,effect:e,...S(r)}),H.createWithPreprocess=(t,e,r)=>new H({schema:e,effect:{type:"preprocess",transform:t},typeName:w.ZodEffects,...S(r)});class oe extends R{_parse(e){return this._getType(e)===f.undefined?W(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}oe.create=(t,e)=>new oe({innerType:t,typeName:w.ZodOptional,...S(e)});class Te extends R{_parse(e){return this._getType(e)===f.null?W(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Te.create=(t,e)=>new Te({innerType:t,typeName:w.ZodNullable,...S(e)});class ze extends R{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===f.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}ze.create=(t,e)=>new ze({innerType:t,typeName:w.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...S(e)});class lt extends R{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return at(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new z(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new z(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}lt.create=(t,e)=>new lt({innerType:t,typeName:w.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...S(e)});class ut extends R{_parse(e){if(this._getType(e)!==f.nan){const n=this._getOrReturnCtx(e);return p(n,{code:h.invalid_type,expected:f.nan,received:n.parsedType}),E}return{status:"valid",value:e.data}}}ut.create=t=>new ut({typeName:w.ZodNaN,...S(t)});const zo=Symbol("zod_brand");class Yr extends R{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class Be extends R{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?E:s.status==="dirty"?(r.dirty(),Lr(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?E:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,r){return new Be({in:e,out:r,typeName:w.ZodPipeline})}}const Jr=(t,e={},r)=>t?Ne.create().superRefine((n,a)=>{var s,i;if(!t(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(i=(s=o.fatal)!==null&&s!==void 0?s:r)!==null&&i!==void 0?i:!0,l=typeof o=="string"?{message:o}:o;a.addIssue({code:"custom",...l,fatal:c})}}):Ne.create(),Bo={object:k.lazycreate};var w;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline"})(w||(w={}));const Qo=(t,e={message:`Input not instance of ${t.name}`})=>Jr(r=>r instanceof t,e),Xr=B.create,zr=ue.create,Ho=ut.create,Ko=he.create,Br=Ze.create,qo=ve.create,$o=st.create,ec=je.create,tc=Ve.create,rc=Ne.create,nc=we.create,ac=ie.create,sc=it.create,ic=Q.create,oc=k.create,cc=k.strictCreate,dc=Le.create,lc=ct.create,uc=We.create,hc=re.create,fc=Ge.create,pc=dt.create,_c=be.create,mc=Ae.create,gc=Ye.create,yc=Je.create,vc=fe.create,wc=Xe.create,bc=xe.create,Qr=H.create,Tc=oe.create,Ec=Te.create,Sc=H.createWithPreprocess,Ic=Be.create;var d=Object.freeze({__proto__:null,defaultErrorMap:Fe,setErrorMap:Uo,getErrorMap:tt,makeIssue:rt,EMPTY_PATH:ko,addIssueToContext:p,ParseStatus:Z,INVALID:E,DIRTY:Lr,OK:W,isAborted:Mt,isDirty:Pt,isValid:nt,isAsync:at,get util(){return A},get objectUtil(){return xt},ZodParsedType:f,getParsedType:le,ZodType:R,ZodString:B,ZodNumber:ue,ZodBigInt:he,ZodBoolean:Ze,ZodDate:ve,ZodSymbol:st,ZodUndefined:je,ZodNull:Ve,ZodAny:Ne,ZodUnknown:we,ZodNever:ie,ZodVoid:it,ZodArray:Q,ZodObject:k,ZodUnion:Le,ZodDiscriminatedUnion:ct,ZodIntersection:We,ZodTuple:re,ZodRecord:Ge,ZodMap:dt,ZodSet:be,ZodFunction:Ae,ZodLazy:Ye,ZodLiteral:Je,ZodEnum:fe,ZodNativeEnum:Xe,ZodPromise:xe,ZodEffects:H,ZodTransformer:H,ZodOptional:oe,ZodNullable:Te,ZodDefault:ze,ZodCatch:lt,ZodNaN:ut,BRAND:zo,ZodBranded:Yr,ZodPipeline:Be,custom:Jr,Schema:R,ZodSchema:R,late:Bo,get ZodFirstPartyTypeKind(){return w},coerce:{string:t=>B.create({...t,coerce:!0}),number:t=>ue.create({...t,coerce:!0}),boolean:t=>Ze.create({...t,coerce:!0}),bigint:t=>he.create({...t,coerce:!0}),date:t=>ve.create({...t,coerce:!0})},any:rc,array:ic,bigint:Ko,boolean:Br,date:qo,discriminatedUnion:lc,effect:Qr,enum:vc,function:mc,instanceof:Qo,intersection:uc,lazy:gc,literal:yc,map:pc,nan:Ho,nativeEnum:wc,never:ac,null:tc,nullable:Ec,number:zr,object:oc,oboolean:()=>Br().optional(),onumber:()=>zr().optional(),optional:Tc,ostring:()=>Xr().optional(),pipeline:Ic,preprocess:Sc,promise:bc,record:fc,set:_c,strictObject:cc,string:Xr,symbol:$o,transformer:Qr,tuple:hc,undefined:ec,union:dc,unknown:nc,void:sc,NEVER:E,ZodIssueCode:h,quotelessJson:Po,ZodError:z}),P=(t=>(t.HTML="CUSTOM_HTML",t.Widget="WIDGET",t))(P||{}),Me=(t=>(t.EachEvent="each_event",t.EachPage="each_page",t))(Me||{}),m=(t=>(t.Sitesearch="sitesearch",t.Pixel="pixel",t.Awoo="awoo",t.AwooCategoryPage="awoo_category_page",t.AwooSearchBar="awoo_search_bar",t.AwooSearchResultPage="awoo_search_result_page",t.AwooProductTags="awoo_product_tags",t.AwooProductRelatedProducts="awoo_product_related_products",t.AwooClassifyProductType="awoo_classify_product_type",t.AwooPopularTags="awoo_popular_tags",t.AwooPopularProducts="awoo_popular_products",t.AwooCartRelatedProducts="awoo_cart_related_products",t.AwooCompleteRelatedProducts="awoo_complete_related_products",t.AwooFavoriteRelatedProducts="awoo_favorite_related_products",t.AwooNotFoundProducts="awoo_not_found_products",t.AwooNoResultProducts="awoo_no_result_products",t.AwooCampaignPage="awoo_campaign_page",t.SitesearchSearchBarV2WithBasicTs="sitesearch_search_bar_v2_with_basic_ts",t.SitesearchSearchBarV2WithSpTs="sitesearch_search_bar_v2_with_sp_ts",t.AwooCampaignBuilder="awoo_campaign_builder",t))(m||{}),J=(t=>(t.PageView="PAGE_VIEW",t.Click="CLICK",t.CustomEvent="CUSTOM_EVENT",t))(J||{}),X=(t=>(t.PageURL="PAGE_URL",t.DomSelector="DOM_SELECTOR",t))(X||{}),j=(t=>(t.Contain="_cn",t.NotContain="_not_cn",t.Regex="_regex",t.RegexInsensitive="_regex_i",t.Equal="_eq",t.EqualDom="_eq_dom",t))(j||{});const Cc=d.object({metric:d.nativeEnum(X),function:d.nativeEnum(j),value:d.string().min(1)}),Rc=d.object({type:d.nativeEnum(J),event_name:d.string().optional().nullable(),id:d.number(),name:d.string(),predicates:Cc.array()}),Nc=d.object({id:d.number(),insert_html:d.string(),type:d.nativeEnum(P),advanced_conditions:d.object({trigger_setting:d.nativeEnum(Me).optional()}).optional(),metafields:d.object({widget:d.nativeEnum(m).optional()}).optional()}),Oc=d.object({trigger_id:d.number(),code_id:d.number()}),Ac=d.object({id:d.string(),host:d.string(),version:d.string(),pixelOn:d.boolean(),triggers:Rc.array(),codes:Nc.array(),rules:Oc.array()}),xc=(t,e)=>{const n={[X.PageURL]:()=>window.location.toString(),[X.DomSelector]:()=>e==null?void 0:e.target}[t];return n()||null},Mc=t=>{const e={[j.Regex]:(n,a)=>new RegExp(a).test(n),[j.RegexInsensitive]:(n,a)=>new RegExp(a,"i").test(n),[j.Contain]:(n,a)=>n.includes(a),[j.NotContain]:(n,a)=>!n.includes(a),[j.Equal]:(n,a)=>n===a,[j.EqualDom]:(n,a)=>Array.from(window.document.querySelectorAll(a)).includes(n),default:(n,a)=>!1};return e[t]||e.default},kt=(t,e)=>{const{metric:r,function:n,value:a}=t,s=xc(r,e);return Mc(n)(s,a)};function Hr(t){return new Promise((e,r)=>{try{const n=document.createRange().createContextualFragment(t);document.head.appendChild(n),e()}catch(n){r(n)}})}function Pc(t,e){const{url:r,id:n,targetSelector:a,getSDK:s,initSDK:i}=t,o=document.createElement("script");o.type="text/javascript",o.id=n,o.async=!0,o.charset="UTF-8",o.onload=async()=>{const l=s();if(!l){console.error("SDK is undefined. id: ",n);return}a&&await Uc(a),i(l,e)},o.src=r;const c=document.getElementsByTagName("script")[0];c&&c.parentNode?c.parentNode.insertBefore(o,c):document.head.appendChild(o)}function Ee(t,e,r){window.awooConfig||(window.awooConfig={});const n={get(a,s){return a[s]},set(a,s,i){return a[s]=i,e.includes(s)&&t()&&r(),!0}};window.awooConfig=new Proxy(window.awooConfig,n),t()&&r()}function Uc(t){return new Promise(e=>{if(document.querySelector(t))return e(document.querySelector(t));const r=new MutationObserver(de(()=>{document.querySelector(t)&&(e(document.querySelector(t)),r.disconnect())},300));r.observe(document.body,{subtree:!0,childList:!0})})}function kc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Dt={exports:{}};const Kr=t=>typeof t=="object"&&t!==null,qr=Symbol("skip"),$r=t=>Kr(t)&&!(t instanceof RegExp)&&!(t instanceof Error)&&!(t instanceof Date),Ft=(t,e,r,n=new WeakMap)=>{if(r={deep:!1,target:{},...r},n.has(t))return n.get(t);n.set(t,r.target);const{target:a}=r;delete r.target;const s=i=>i.map(o=>$r(o)?Ft(o,e,r,n):o);if(Array.isArray(t))return s(t);for(const[i,o]of Object.entries(t)){const c=e(i,o,t);if(c===qr)continue;let[l,u,{shouldRecurse:_=!0}={}]=c;l!=="__proto__"&&(r.deep&&_&&$r(u)&&(u=Array.isArray(u)?s(u):Ft(u,e,r,n)),a[l]=u)}return a};Dt.exports=(t,e,r)=>{if(!Kr(t))throw new TypeError(`Expected an object, got \`${t}\` (${typeof t})`);return Ft(t,e,r)},Dt.exports.mapObjectSkip=qr;var Dc=Dt.exports;const en=kc(Dc),Fc=/[\p{Lu}]/u,Zc=/[\p{Ll}]/u,tn=/^[\p{Lu}](?![\p{Lu}])/gu,rn=/([\p{Alpha}\p{N}_]|$)/u,Zt=/[_.\- ]+/,jc=new RegExp("^"+Zt.source),nn=new RegExp(Zt.source+rn.source,"gu"),an=new RegExp("\\d+"+rn.source,"gu"),Vc=(t,e,r,n)=>{let a=!1,s=!1,i=!1,o=!1;for(let c=0;c2?t[c-3]==="-":!0,a&&Fc.test(l)?(t=t.slice(0,c)+"-"+t.slice(c),a=!1,i=s,s=!0,c++):s&&i&&Zc.test(l)&&(!o||n)?(t=t.slice(0,c-1)+"-"+t.slice(c-1),i=s,s=!1,a=!0):(a=e(l)===l&&r(l)!==l,i=s,s=r(l)===l&&e(l)!==l)}return t},Lc=(t,e)=>(tn.lastIndex=0,t.replace(tn,r=>e(r))),Wc=(t,e)=>(nn.lastIndex=0,an.lastIndex=0,t.replace(nn,(r,n)=>e(n)).replace(an,r=>e(r)));function Gc(t,e){if(!(typeof t=="string"||Array.isArray(t)))throw new TypeError("Expected the input to be `string | string[]`");if(e={pascalCase:!1,preserveConsecutiveUppercase:!1,...e},Array.isArray(t)?t=t.map(s=>s.trim()).filter(s=>s.length).join("-"):t=t.trim(),t.length===0)return"";const r=e.locale===!1?s=>s.toLowerCase():s=>s.toLocaleLowerCase(e.locale),n=e.locale===!1?s=>s.toUpperCase():s=>s.toLocaleUpperCase(e.locale);return t.length===1?Zt.test(t)?"":e.pascalCase?n(t):r(t):(t!==r(t)&&(t=Vc(t,r,n,e.preserveConsecutiveUppercase)),t=t.replace(jc,""),t=e.preserveConsecutiveUppercase?Lc(t,r):r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),Wc(t,n))}class Yc extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if(typeof e.maxAge=="number"&&e.maxAge===0)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if(typeof this.onEviction=="function")for(const[r,n]of e)this.onEviction(r,n.value)}_deleteIfExpired(e,r){return typeof r.expiry=="number"&&r.expiry<=Date.now()?(typeof this.onEviction=="function"&&this.onEviction(e,r.value),this.delete(e)):!1}_getOrDeleteIfExpired(e,r){if(this._deleteIfExpired(e,r)===!1)return r.value}_getItemValue(e,r){return r.expiry?this._getOrDeleteIfExpired(e,r):r.value}_peek(e,r){const n=r.get(e);return this._getItemValue(e,n)}_set(e,r){this.cache.set(e,r),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,r){this.oldCache.delete(e),this._set(e,r)}*_entriesAscending(){for(const e of this.oldCache){const[r,n]=e;this.cache.has(r)||this._deleteIfExpired(r,n)===!1&&(yield e)}for(const e of this.cache){const[r,n]=e;this._deleteIfExpired(r,n)===!1&&(yield e)}}get(e){if(this.cache.has(e)){const r=this.cache.get(e);return this._getItemValue(e,r)}if(this.oldCache.has(e)){const r=this.oldCache.get(e);if(this._deleteIfExpired(e,r)===!1)return this._moveToRecent(e,r),r.value}}set(e,r,{maxAge:n=this.maxAge}={}){const a=typeof n=="number"&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;this.cache.has(e)?this.cache.set(e,{value:r,expiry:a}):this._set(e,{value:r,expiry:a})}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):this.oldCache.has(e)?!this._deleteIfExpired(e,this.oldCache.get(e)):!1}peek(e){if(this.cache.has(e))return this._peek(e,this.cache);if(this.oldCache.has(e))return this._peek(e,this.oldCache)}delete(e){const r=this.cache.delete(e);return r&&this._size--,this.oldCache.delete(e)||r}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const r=[...this._entriesAscending()],n=r.length-e;n<0?(this.cache=new Map(r),this.oldCache=new Map,this._size=r.length):(n>0&&this._emitEvictions(r.slice(0,n)),this.oldCache=new Map(r.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[r,n]=e;this._deleteIfExpired(r,n)===!1&&(yield[r,n.value])}for(const e of this.oldCache){const[r,n]=e;this.cache.has(r)||this._deleteIfExpired(r,n)===!1&&(yield[r,n.value])}}*entriesDescending(){let e=[...this.cache];for(let r=e.length-1;r>=0;--r){const n=e[r],[a,s]=n;this._deleteIfExpired(a,s)===!1&&(yield[a,s.value])}e=[...this.oldCache];for(let r=e.length-1;r>=0;--r){const n=e[r],[a,s]=n;this.cache.has(a)||this._deleteIfExpired(a,s)===!1&&(yield[a,s.value])}}*entriesAscending(){for(const[e,r]of this._entriesAscending())yield[e,r.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const r of this.oldCache.keys())this.cache.has(r)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,r=this){for(const[n,a]of this.entriesAscending())e.call(r,a,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}const Jc=(t,e)=>t.some(r=>typeof r=="string"?r===e:(r.lastIndex=0,r.test(e))),jt=new Yc({maxSize:1e5}),sn=t=>typeof t=="object"&&t!==null&&!(t instanceof RegExp)&&!(t instanceof Error)&&!(t instanceof Date),on=(t,e)=>{if(!sn(t))return t;e={deep:!1,pascalCase:!1,...e};const{exclude:r,pascalCase:n,stopPaths:a,deep:s}=e,i=new Set(a),o=c=>(l,u)=>{if(s&&sn(u)){const _=c===void 0?l:`${c}.${l}`;i.has(_)||(u=en(u,o(_)))}if(!(r&&Jc(r,l))){const _=n?`${l}_`:l;if(jt.has(_))l=jt.get(_);else{const y=Gc(l,{pascalCase:n,locale:!1});l.length<100&&jt.set(_,y),l=y}}return[l,u]};return en(t,o(void 0))};function K(t,e){return Array.isArray(t)?Object.keys(t).map(r=>on(t[r],e)):on(t,e)}var g=(t=>(t.AMP_PAGE="ampPage",t.CART_PAGE="cartPage",t.CATEGORY_PAGE="categoryPage",t.HOME_PAGE="homepage",t.PRODUCT_PAGE_RECOMMENDATION="productPageRecommendation",t.SEARCH_NO_RESULT_404="searchNoResult404",t.SITESEARCH_IN_AWOO_SDK="sitesearchInAwooSdk",t.SYSTEM="system",t.TERM_SUGGESTION_IN_SITESEARCH_SDK="termSuggestionInSitesearchSdk",t.CAMPAIGN_TAGGER="campaignTagger",t.TAG_FILTER="tagFilter",t))(g||{});const Xc=d.object(K({category_page_tag_title:d.string(),page_api_sort:d.number().array(),tag_filter:d.boolean(),category_suggestion_open:d.boolean(),category_page_limit:d.number(),category_page_sort:d.number(),show_out_of_stock_tag:d.boolean(),content_api_ver:d.string()})),zc=d.object({fields:Xc}),Vt=["free_delivery","low_price","latest_product"],Bc=d.object(K({favoriteRelatedProductsSort:d.enum(Vt),completeRelatedProductsSort:d.enum(Vt),cartRelatedProductsSort:d.enum(Vt),cart_related_product_title:d.string(),favorite_related_products_title:d.string(),complete_related_products_title:d.string(),related_products_limit:d.number().min(1).max(20),related_products_api_ver:d.string(),cart_total_price:d.number(),recommend_product_brand_rule:d.string(),recommend_product_brand_rule_enabled:d.number()})),Qc=d.object({fields:Bc}),Hc=d.object(K({classify_product_type_sorting_type:d.string(),classify_product_type_api_ver:d.string(),classify_api_ver:d.string()})),Kc=d.object({fields:Hc}),qc=d.object(K({popular_tag_title:d.string(),popular_product_title:d.string(),keyword_api_ver:d.string(),keyword_api_limit:d.number().min(1).max(20)})),$c=d.object({fields:qc}),ed=d.object(K({v_related_products_title:d.string(),h_related_products_title:d.string(),related_products_tags_limit:d.number().min(15).max(30),related_products_tags_direction:d.string(),product_tags_api_ver:d.string(),recommend_product_brand_rule:d.string(),recommend_product_brand_rule_enabled:d.number()})),td=d.object({fields:ed}),rd=d.object(K({search_query_keyword:d.string().max(100),popular_products_limit:d.number().min(1).max(20),popular_products_api_ver:d.string(),no_result_products_title:d.string(),not_found_products_title:d.string()})),nd=d.object({fields:rd}),ad=d.object(K({site_search_sort:d.array(d.number()),search_result_page_limit:d.number().min(1).max(300),search_result_tag_title:d.string(),search_result_page_sort:d.number(),search_result_page_path:d.string(),site_search_api_ver:d.string(),term_suggestion_api_ver:d.string(),auto_render_search_bar:d.boolean(),s_b_sku_switch:d.boolean(),s_b_ui_setting:d.string(),search_bar_v2_render:d.boolean()})),sd=d.object({fields:ad}),id=d.object(K({japanese_yen_product_price_mode:d.boolean(),lang:d.string(),pixel_on:d.boolean()})),od=d.object({fields:id}),cd=d.object(K({t_s_debounce_time:d.number(),limit_query_keyword:d.string(),mobile_product_preview:d.boolean(),page_query_keyword:d.string(),t_s_popper_position:d.string(),t_s_product_suggestion_enable:d.boolean(),t_s_product_suggestion_search_btn_enable:d.boolean(),t_s_product_suggestion_search_btn:d.string(),t_s_product_suggestion_sort:d.number(),t_s_product_suggestion_title:d.string(),search_btn_border:d.string(),search_btn_background:d.string(),search_btn_border_color:d.string(),search_btn_border_radius:d.string(),search_query_keyword:d.string(),search_result_page_limit:d.number().min(1).max(300),search_result_page_path:d.string(),search_result_page_sort:d.number(),t_s_show_product_image:d.boolean(),t_s_show_product_price:d.boolean(),t_s_show_product_sale_price:d.boolean(),t_s_show_product_title:d.boolean(),site_search_api_ver:d.string(),sort_query_keyword:d.string(),t_s_product_suggestion_template:d.string(),t_s_product_suggestion_template_model:d.string(),t_s_products_per_term:d.number(),t_s_terms_per_request:d.number(),term_suggestion_api_ver:d.string()})),dd=d.object({fields:cd}),ld=d.object(K({campaign_code_url_template:d.string(),campaign_code_url_template_mobile:d.string(),campaign_term_url_template:d.string(),campaign_term_url_template_mobile:d.string()})),ud=d.object({fields:ld}),hd=d.object(K({t_g_pinned_tag:d.number(),t_g_min_tags_count:d.number(),t_g_max_tags_count:d.number(),t_g_view_more:d.enum(["enable,disable"]),t_g_desktop_position:d.enum(["bottom","left","right"]),t_g_desktop_layout:d.enum(["list","tags"]),t_g_mobile_position:d.enum(["bottom"]),t_g_mobile_layout:d.enum(["list","tags"]),t_g_title:d.string(),t_g_font:d.string(),t_g_font_size_px:d.string(),t_g_border:d.enum(["round","half round","angle"]),t_g_border_weight:d.string(),t_g_selected_font_color:d.string(),t_g_selected_check_color:d.string(),t_g_selected_border_color:d.string(),t_g_selected_background_color:d.string(),t_g_unselected_font_color:d.string(),t_g_unselected_border_color:d.string(),t_g_unselected_background_color:d.string(),t_g_hover_background_color:d.string(),t_g_hover_font_color:d.string(),t_g_hover_border_color:d.string(),t_g_button_font_color:d.string(),t_g_button_background_color:d.string(),t_g_button_hover_color:d.string(),t_g_button_border_color:d.string(),t_g_cancel_font_color:d.string(),t_g_cancel_background_color:d.string(),t_g_cancel_hover_color:d.string(),t_g_cancel_border_color:d.string(),t_g_enable_pinned_tags:d.boolean(),t_g_enable_filter_list:d.boolean()})),fd=d.object({fields:hd});d.object({ampPage:zc,cartPage:Qc,categoryPage:Kc,homepage:$c,productPageRecommendation:td,searchNoResult404:nd,sitesearchInAwooSdk:sd,system:od,termSuggestionInSitesearchSdk:dd,campaignTagger:ud,tagFilter:fd});const pd={[m.Sitesearch]:{url:"https://api.awoo.org/libs/sitesearch-sdk-js-latest.min.js",id:"awoo-site-search-js",targetSelector:".awoo-search,#awoo-search",getSDK:()=>window.SiteSearchSDK,initSDK:(t,e)=>{new t(e)}},[m.SitesearchSearchBarV2WithBasicTs]:{url:"https://api.awoo.org/libs/sitesearch-sdk-js-latest.min.js",id:"awoo-site-search-js",targetSelector:".awoo-search,#awoo-search",getSDK:()=>window.NewSiteSearchSDK,initSDK:(t,e)=>{new t(e).renderSearchBarWithBasicTs()}},[m.SitesearchSearchBarV2WithSpTs]:{url:"https://api.awoo.org/libs/sitesearch-sdk-js-latest.min.js",id:"awoo-site-search-js",targetSelector:".awoo-search,#awoo-search",getSDK:()=>window.NewSiteSearchSDK,initSDK:(t,e)=>{new t(e).renderSearchBarWithSpTs()}},[m.Awoo]:{url:"https://api.awoo.org/libs/awoo-sdk-js-latest.min.js",id:"awoo-sdk-js",getSDK:()=>window.AwooSDK,initSDK:(t,e)=>{Ee(()=>!0,["productId","productType","productTypeFilter","relatedProductIds","cartTotalPrice"],de(()=>{new t({...e,productId:window.awooConfig.productId,productType:window.awooConfig.productType,productTypeFilter:window.awooConfig.productTypeFilter,relatedProductIds:window.awooConfig.relatedProductIds,cartTotalPrice:window.awooConfig.cartTotalPrice})},0))}},[m.AwooCategoryPage]:{url:"https://api.awoo.org/libs/awoo-sdk-js-latest.min.js",id:"awoo-sdk-js",targetSelector:"#awoo-category-page,.awoo-category-page-title,.awoo-category-page-tags,.awoo-category-page-product-list,#awoo-category-page-title,#awoo-category-page-tags,#awoo-category-page-product-list",getSDK:()=>window.AwooSDK,initSDK:(t,e)=>{const r=new t(e.id,e.lang,"aaio");return e.contentApiVer==="v2.0"?r.renderCategoryPageV2(e):r.renderCategoryPage(e)}},[m.AwooSearchBar]:{url:"https://api.awoo.org/libs/awoo-sdk-js-latest.min.js",id:"awoo-sdk-js",targetSelector:".awoo-search",getSDK:()=>window.AwooSDK,initSDK:(t,e)=>{new t(e.id,e.lang,"aaio").renderSearchBar(e)}},[m.AwooSearchResultPage]:{url:"https://api.awoo.org/libs/awoo-sdk-js-latest.min.js",id:"awoo-sdk-js",targetSelector:"#awoo-search-result-page",getSDK:()=>window.AwooSDK,initSDK:(t,e)=>{new t(e.id,e.lang,"aaio").renderSearchResultPage(e)}},[m.AwooProductTags]:{url:"https://api.awoo.org/libs/awoo-sdk-js-latest.min.js",id:"awoo-sdk-js",targetSelector:".awoo-product-tags,#awoo-product-tags",getSDK:()=>window.AwooSDK,initSDK:(t,e)=>{Ee(()=>!!window.awooConfig.productId,["productId","productTypeFilter"],de(()=>{new t(e.id,e.lang,"aaio").renderOnlyProductTags({...e,productId:window.awooConfig.productId,productTypeFilter:window.awooConfig.productTypeFilter})},0))}},[m.AwooProductRelatedProducts]:{url:"https://api.awoo.org/libs/awoo-sdk-js-latest.min.js",id:"awoo-sdk-js",targetSelector:".awoo-related-products,#awoo-related-products",getSDK:()=>window.AwooSDK,initSDK:(t,e)=>{Ee(()=>!!window.awooConfig.productId,["productId","productTypeFilter"],de(()=>{new t(e.id,e.lang,"aaio").renderRelatedProducts({...e,productId:window.awooConfig.productId,productTypeFilter:window.awooConfig.productTypeFilter})},0))}},[m.AwooClassifyProductType]:{url:"https://api.awoo.org/libs/awoo-sdk-js-latest.min.js",id:"awoo-sdk-js",targetSelector:".awoo-classify,#awoo-classify",getSDK:()=>window.AwooSDK,initSDK:(t,e)=>{Ee(()=>!!window.awooConfig.productType||!!window.awooConfig.classifyProductIds,["productType","productTypeFilter","classifyProductIds"],de(()=>{new t(e.id,e.lang,"aaio").renderClassifyProductType({...e,productType:window.awooConfig.productType,productTypeFilter:window.awooConfig.productTypeFilter,classifyProductIds:window.awooConfig.classifyProductIds})},0))}},[m.AwooPopularTags]:{url:"https://api.awoo.org/libs/awoo-sdk-js-latest.min.js",id:"awoo-sdk-js",targetSelector:".awoo-keyword-popular-tags,#awoo-keyword-popular-tags",getSDK:()=>window.AwooSDK,initSDK:(t,e)=>{new t(e.id,e.lang,"aaio").renderPopularTags(e)}},[m.AwooPopularProducts]:{url:"https://api.awoo.org/libs/awoo-sdk-js-latest.min.js",id:"awoo-sdk-js",targetSelector:".awoo-keyword-popular-products,#awoo-keyword-popular-products",getSDK:()=>window.AwooSDK,initSDK:(t,e)=>{new t(e.id,e.lang,"aaio").renderPopularProducts(e)}},[m.AwooCartRelatedProducts]:{url:"https://api.awoo.org/libs/awoo-sdk-js-latest.min.js",id:"awoo-sdk-js",targetSelector:".awoo-cart-related-products,#awoo-cart-related-products",getSDK:()=>window.AwooSDK,initSDK:(t,e)=>{Ee(()=>!!window.awooConfig.relatedProductIds,["relatedProductIds","cartTotalPrice"],de(()=>{new t(e.id,e.lang,"aaio").renderCartRelatedProducts({...e,relatedProductIds:window.awooConfig.relatedProductIds,cartTotalPrice:window.awooConfig.cartTotalPrice})},0))}},[m.AwooCompleteRelatedProducts]:{url:"https://api.awoo.org/libs/awoo-sdk-js-latest.min.js",id:"awoo-sdk-js",targetSelector:".awoo-complete-related-products,#awoo-complete-related-products",getSDK:()=>window.AwooSDK,initSDK:(t,e)=>{Ee(()=>!!window.awooConfig.relatedProductIds,["relatedProductIds"],de(()=>{new t(e.id,e.lang,"aaio").renderCompleteRelatedProducts({...e,relatedProductIds:window.awooConfig.relatedProductIds})},0))}},[m.AwooFavoriteRelatedProducts]:{url:"https://api.awoo.org/libs/awoo-sdk-js-latest.min.js",id:"awoo-sdk-js",targetSelector:".awoo-favorite-related-products,#awoo-favorite-related-products",getSDK:()=>window.AwooSDK,initSDK:(t,e)=>{Ee(()=>!!window.awooConfig.relatedProductIds,["relatedProductIds"],de(()=>{new t(e.id,e.lang,"aaio").renderFavoriteRelatedProducts({...e,relatedProductIds:window.awooConfig.relatedProductIds})},0))}},[m.AwooNotFoundProducts]:{url:"https://api.awoo.org/libs/awoo-sdk-js-latest.min.js",id:"awoo-sdk-js",targetSelector:".awoo-not-found-products,#awoo-not-found-products",getSDK:()=>window.AwooSDK,initSDK:(t,e)=>{new t(e.id,e.lang,"aaio").renderNotFoundProducts(e)}},[m.AwooNoResultProducts]:{url:"https://api.awoo.org/libs/awoo-sdk-js-latest.min.js",id:"awoo-sdk-js",targetSelector:".awoo-no-result-products,#awoo-no-result-products",getSDK:()=>window.AwooSDK,initSDK:(t,e)=>{new t(e.id,e.lang,"aaio").renderNoResultProducts(e)}},[m.AwooCampaignPage]:{url:"https://api.awoo.org/libs/awoo-sdk-js-latest.min.js",id:"awoo-sdk-js",targetSelector:"#awoo-campaign-page",getSDK:()=>window.AwooSDK,initSDK:()=>{}},[m.AwooCampaignBuilder]:{url:"https://api.awoo.org/libs/campaign-builder-sdk-js-latest.min.js",id:"awoo-campaign-builder-js",targetSelector:"#awoo-campaign-builder",getSDK:()=>window.CampaignBuilderSDK,initSDK:(t,e)=>{new t(e)}}},_d=t=>pd[t],md={[m.Sitesearch]:[g.SYSTEM,g.TERM_SUGGESTION_IN_SITESEARCH_SDK],[m.Awoo]:[g.AMP_PAGE,g.CART_PAGE,g.CATEGORY_PAGE,g.HOME_PAGE,g.PRODUCT_PAGE_RECOMMENDATION,g.SEARCH_NO_RESULT_404,g.SITESEARCH_IN_AWOO_SDK,g.SYSTEM],[m.AwooCategoryPage]:[g.SYSTEM,g.AMP_PAGE,g.SEARCH_NO_RESULT_404,g.TAG_FILTER],[m.AwooSearchBar]:[g.SYSTEM,g.SITESEARCH_IN_AWOO_SDK,g.SYSTEM],[m.AwooSearchResultPage]:[g.SYSTEM,g.SITESEARCH_IN_AWOO_SDK,g.SEARCH_NO_RESULT_404,g.CATEGORY_PAGE,g.AMP_PAGE,g.SYSTEM],[m.AwooProductTags]:[g.SYSTEM,g.PRODUCT_PAGE_RECOMMENDATION,g.CATEGORY_PAGE],[m.AwooProductRelatedProducts]:[g.SYSTEM,g.PRODUCT_PAGE_RECOMMENDATION,g.CATEGORY_PAGE],[m.AwooClassifyProductType]:[g.SYSTEM,g.CATEGORY_PAGE,g.PRODUCT_PAGE_RECOMMENDATION],[m.AwooPopularTags]:[g.SYSTEM,g.HOME_PAGE],[m.AwooPopularProducts]:[g.SYSTEM,g.HOME_PAGE],[m.AwooCartRelatedProducts]:[g.SYSTEM,g.CART_PAGE],[m.AwooCompleteRelatedProducts]:[g.SYSTEM,g.CART_PAGE],[m.AwooFavoriteRelatedProducts]:[g.SYSTEM,g.CART_PAGE],[m.AwooNoResultProducts]:[g.SYSTEM,g.SEARCH_NO_RESULT_404],[m.AwooNotFoundProducts]:[g.SYSTEM,g.SEARCH_NO_RESULT_404],[m.AwooCampaignPage]:[g.SYSTEM,g.CAMPAIGN_TAGGER],[m.Pixel]:[g.SYSTEM],[m.SitesearchSearchBarV2WithBasicTs]:[g.SYSTEM,g.TERM_SUGGESTION_IN_SITESEARCH_SDK,g.SITESEARCH_IN_AWOO_SDK],[m.SitesearchSearchBarV2WithSpTs]:[g.SYSTEM,g.TERM_SUGGESTION_IN_SITESEARCH_SDK,g.SITESEARCH_IN_AWOO_SDK],[m.AwooCampaignBuilder]:[g.SYSTEM]},gd=t=>md[t],yd=async(t,e)=>{const r=new URLSearchParams;return e.forEach(s=>{r.append("groups[]",s)}),(await(await fetch(`https://api.awoo.org/nununi/sdk/${t}/customerCustomizedConfig?${r}`)).json()).result};class ht{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){const r={listener:e};return this.listeners.add(r),this.onSubscribe(),()=>{this.listeners.delete(r),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}const Lt=typeof window>"u"||"Deno"in window;function q(){}function vd(t,e){return typeof t=="function"?t(e):t}function wd(t){return typeof t=="number"&&t>=0&&t!==1/0}function bd(t,e){return Math.max(t+(e||0)-Date.now(),0)}function ft(t,e,r){return _t(t)?typeof e=="function"?{...r,queryKey:t,queryFn:e}:{...e,queryKey:t}:t}function pe(t,e,r){return _t(t)?[{...e,queryKey:t},r]:[t||{},e]}function cn(t,e){const{type:r="all",exact:n,fetchStatus:a,predicate:s,queryKey:i,stale:o}=t;if(_t(i)){if(n){if(e.queryHash!==Wt(i,e.options))return!1}else if(!pt(e.queryKey,i))return!1}if(r!=="all"){const c=e.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof o=="boolean"&&e.isStale()!==o||typeof a<"u"&&a!==e.state.fetchStatus||s&&!s(e))}function dn(t,e){const{exact:r,fetching:n,predicate:a,mutationKey:s}=t;if(_t(s)){if(!e.options.mutationKey)return!1;if(r){if(Se(e.options.mutationKey)!==Se(s))return!1}else if(!pt(e.options.mutationKey,s))return!1}return!(typeof n=="boolean"&&e.state.status==="loading"!==n||a&&!a(e))}function Wt(t,e){return((e==null?void 0:e.queryKeyHashFn)||Se)(t)}function Se(t){return JSON.stringify(t,(e,r)=>Gt(r)?Object.keys(r).sort().reduce((n,a)=>(n[a]=r[a],n),{}):r)}function pt(t,e){return ln(t,e)}function ln(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(r=>!ln(t[r],e[r])):!1}function un(t,e){if(t===e)return t;const r=hn(t)&&hn(e);if(r||Gt(t)&&Gt(e)){const n=r?t.length:Object.keys(t).length,a=r?e:Object.keys(e),s=a.length,i=r?[]:{};let o=0;for(let c=0;c"u")return!0;const r=e.prototype;return!(!fn(r)||!r.hasOwnProperty("isPrototypeOf"))}function fn(t){return Object.prototype.toString.call(t)==="[object Object]"}function _t(t){return Array.isArray(t)}function pn(t){return new Promise(e=>{setTimeout(e,t)})}function _n(t){pn(0).then(t)}function Td(){if(typeof AbortController=="function")return new AbortController}function Ed(t,e,r){return r.isDataEqual!=null&&r.isDataEqual(t,e)?t:typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?un(t,e):e}class Sd extends ht{constructor(){super(),this.setup=e=>{if(!Lt&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),window.addEventListener("focus",r,!1),()=>{window.removeEventListener("visibilitychange",r),window.removeEventListener("focus",r)}}}}onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var e;(e=this.cleanup)==null||e.call(this),this.cleanup=void 0}}setEventListener(e){var r;this.setup=e,(r=this.cleanup)==null||r.call(this),this.cleanup=e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()})}setFocused(e){this.focused!==e&&(this.focused=e,this.onFocus())}onFocus(){this.listeners.forEach(({listener:e})=>{e()})}isFocused(){return typeof this.focused=="boolean"?this.focused:typeof document>"u"?!0:[void 0,"visible","prerender"].includes(document.visibilityState)}}const Yt=new Sd,mn=["online","offline"];class Id extends ht{constructor(){super(),this.setup=e=>{if(!Lt&&window.addEventListener){const r=()=>e();return mn.forEach(n=>{window.addEventListener(n,r,!1)}),()=>{mn.forEach(n=>{window.removeEventListener(n,r)})}}}}onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var e;(e=this.cleanup)==null||e.call(this),this.cleanup=void 0}}setEventListener(e){var r;this.setup=e,(r=this.cleanup)==null||r.call(this),this.cleanup=e(n=>{typeof n=="boolean"?this.setOnline(n):this.onOnline()})}setOnline(e){this.online!==e&&(this.online=e,this.onOnline())}onOnline(){this.listeners.forEach(({listener:e})=>{e()})}isOnline(){return typeof this.online=="boolean"?this.online:typeof navigator>"u"||typeof navigator.onLine>"u"?!0:navigator.onLine}}const mt=new Id;function Cd(t){return Math.min(1e3*2**t,3e4)}function Jt(t){return(t??"online")==="online"?mt.isOnline():!0}class gn{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}}function Xt(t){return t instanceof gn}function yn(t){let e=!1,r=0,n=!1,a,s,i;const o=new Promise((I,O)=>{s=I,i=O}),c=I=>{n||(b(new gn(I)),t.abort==null||t.abort())},l=()=>{e=!0},u=()=>{e=!1},_=()=>!Yt.isFocused()||t.networkMode!=="always"&&!mt.isOnline(),y=I=>{n||(n=!0,t.onSuccess==null||t.onSuccess(I),a==null||a(),s(I))},b=I=>{n||(n=!0,t.onError==null||t.onError(I),a==null||a(),i(I))},N=()=>new Promise(I=>{a=O=>{const D=n||!_();return D&&I(O),D},t.onPause==null||t.onPause()}).then(()=>{a=void 0,n||t.onContinue==null||t.onContinue()}),x=()=>{if(n)return;let I;try{I=t.fn()}catch(O){I=Promise.reject(O)}Promise.resolve(I).then(y).catch(O=>{var D,V;if(n)return;const F=(D=t.retry)!=null?D:3,L=(V=t.retryDelay)!=null?V:Cd,T=typeof L=="function"?L(r,O):L,C=F===!0||typeof F=="number"&&r{if(_())return N()}).then(()=>{e?b(O):x()})})};return Jt(t.networkMode)?x():N().then(x),{promise:o,cancel:c,continue:()=>(a==null?void 0:a())?o:Promise.resolve(),cancelRetry:l,continueRetry:u}}const zt=console;function Rd(){let t=[],e=0,r=u=>{u()},n=u=>{u()};const a=u=>{let _;e++;try{_=u()}finally{e--,e||o()}return _},s=u=>{e?t.push(u):_n(()=>{r(u)})},i=u=>(..._)=>{s(()=>{u(..._)})},o=()=>{const u=t;t=[],u.length&&_n(()=>{n(()=>{u.forEach(_=>{r(_)})})})};return{batch:a,batchCalls:i,schedule:s,setNotifyFunction:u=>{r=u},setBatchNotifyFunction:u=>{n=u}}}const G=Rd();class vn{destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),wd(this.cacheTime)&&(this.gcTimeout=setTimeout(()=>{this.optionalRemove()},this.cacheTime))}updateCacheTime(e){this.cacheTime=Math.max(this.cacheTime||0,e??(Lt?1/0:5*60*1e3))}clearGcTimeout(){this.gcTimeout&&(clearTimeout(this.gcTimeout),this.gcTimeout=void 0)}}class Nd extends vn{constructor(e){super(),this.abortSignalConsumed=!1,this.defaultOptions=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.cache=e.cache,this.logger=e.logger||zt,this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.initialState=e.state||Od(this.options),this.state=this.initialState,this.scheduleGc()}get meta(){return this.options.meta}setOptions(e){this.options={...this.defaultOptions,...e},this.updateCacheTime(this.options.cacheTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.cache.remove(this)}setData(e,r){const n=Ed(this.state.data,e,this.options);return this.dispatch({data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(e,r){this.dispatch({type:"setState",state:e,setStateOptions:r})}cancel(e){var r;const n=this.promise;return(r=this.retryer)==null||r.cancel(e),n?n.then(q).catch(q):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.initialState)}isActive(){return this.observers.some(e=>e.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||this.observers.some(e=>e.getCurrentResult().isStale)}isStaleByTime(e=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!bd(this.state.dataUpdatedAt,e)}onFocus(){var e;const r=this.observers.find(n=>n.shouldFetchOnWindowFocus());r&&r.refetch({cancelRefetch:!1}),(e=this.retryer)==null||e.continue()}onOnline(){var e;const r=this.observers.find(n=>n.shouldFetchOnReconnect());r&&r.refetch({cancelRefetch:!1}),(e=this.retryer)==null||e.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.cache.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(r=>r!==e),this.observers.length||(this.retryer&&(this.abortSignalConsumed?this.retryer.cancel({revert:!0}):this.retryer.cancelRetry()),this.scheduleGc()),this.cache.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.dispatch({type:"invalidate"})}fetch(e,r){var n,a;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&r!=null&&r.cancelRefetch)this.cancel({silent:!0});else if(this.promise){var s;return(s=this.retryer)==null||s.continueRetry(),this.promise}}if(e&&this.setOptions(e),!this.options.queryFn){const b=this.observers.find(N=>N.options.queryFn);b&&this.setOptions(b.options)}Array.isArray(this.options.queryKey);const i=Td(),o={queryKey:this.queryKey,pageParam:void 0,meta:this.meta},c=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>{if(i)return this.abortSignalConsumed=!0,i.signal}})};c(o);const l=()=>this.options.queryFn?(this.abortSignalConsumed=!1,this.options.queryFn(o)):Promise.reject("Missing queryFn for queryKey '"+this.options.queryHash+"'"),u={fetchOptions:r,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:l};if(c(u),(n=this.options.behavior)==null||n.onFetch(u),this.revertState=this.state,this.state.fetchStatus==="idle"||this.state.fetchMeta!==((a=u.fetchOptions)==null?void 0:a.meta)){var _;this.dispatch({type:"fetch",meta:(_=u.fetchOptions)==null?void 0:_.meta})}const y=b=>{if(Xt(b)&&b.silent||this.dispatch({type:"error",error:b}),!Xt(b)){var N,x,I,O;(N=(x=this.cache.config).onError)==null||N.call(x,b,this),(I=(O=this.cache.config).onSettled)==null||I.call(O,this.state.data,b,this)}this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return this.retryer=yn({fn:u.fetchFn,abort:i==null?void 0:i.abort.bind(i),onSuccess:b=>{var N,x,I,O;if(typeof b>"u"){y(new Error(this.queryHash+" data is undefined"));return}this.setData(b),(N=(x=this.cache.config).onSuccess)==null||N.call(x,b,this),(I=(O=this.cache.config).onSettled)==null||I.call(O,b,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:y,onFail:(b,N)=>{this.dispatch({type:"failed",failureCount:b,error:N})},onPause:()=>{this.dispatch({type:"pause"})},onContinue:()=>{this.dispatch({type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode}),this.promise=this.retryer.promise,this.promise}dispatch(e){const r=n=>{var a,s;switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:(a=e.meta)!=null?a:null,fetchStatus:Jt(this.options.networkMode)?"fetching":"paused",...!n.dataUpdatedAt&&{error:null,status:"loading"}};case"success":return{...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:(s=e.dataUpdatedAt)!=null?s:Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=e.error;return Xt(i)&&i.revert&&this.revertState?{...this.revertState}:{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=r(this.state),G.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate(e)}),this.cache.notify({query:this,type:"updated",action:e})})}}function Od(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=typeof e<"u",n=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"loading",fetchStatus:"idle"}}class Ad extends ht{constructor(e){super(),this.config=e||{},this.queries=[],this.queriesMap={}}build(e,r,n){var a;const s=r.queryKey,i=(a=r.queryHash)!=null?a:Wt(s,r);let o=this.get(i);return o||(o=new Nd({cache:this,logger:e.getLogger(),queryKey:s,queryHash:i,options:e.defaultQueryOptions(r),state:n,defaultOptions:e.getQueryDefaults(s)}),this.add(o)),o}add(e){this.queriesMap[e.queryHash]||(this.queriesMap[e.queryHash]=e,this.queries.push(e),this.notify({type:"added",query:e}))}remove(e){const r=this.queriesMap[e.queryHash];r&&(e.destroy(),this.queries=this.queries.filter(n=>n!==e),r===e&&delete this.queriesMap[e.queryHash],this.notify({type:"removed",query:e}))}clear(){G.batch(()=>{this.queries.forEach(e=>{this.remove(e)})})}get(e){return this.queriesMap[e]}getAll(){return this.queries}find(e,r){const[n]=pe(e,r);return typeof n.exact>"u"&&(n.exact=!0),this.queries.find(a=>cn(n,a))}findAll(e,r){const[n]=pe(e,r);return Object.keys(n).length>0?this.queries.filter(a=>cn(n,a)):this.queries}notify(e){G.batch(()=>{this.listeners.forEach(({listener:r})=>{r(e)})})}onFocus(){G.batch(()=>{this.queries.forEach(e=>{e.onFocus()})})}onOnline(){G.batch(()=>{this.queries.forEach(e=>{e.onOnline()})})}}class xd extends vn{constructor(e){super(),this.defaultOptions=e.defaultOptions,this.mutationId=e.mutationId,this.mutationCache=e.mutationCache,this.logger=e.logger||zt,this.observers=[],this.state=e.state||Md(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options={...this.defaultOptions,...e},this.updateCacheTime(this.options.cacheTime)}get meta(){return this.options.meta}setState(e){this.dispatch({type:"setState",state:e})}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.mutationCache.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.observers=this.observers.filter(r=>r!==e),this.scheduleGc(),this.mutationCache.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.observers.length||(this.state.status==="loading"?this.scheduleGc():this.mutationCache.remove(this))}continue(){var e,r;return(e=(r=this.retryer)==null?void 0:r.continue())!=null?e:this.execute()}async execute(){const e=()=>{var C;return this.retryer=yn({fn:()=>this.options.mutationFn?this.options.mutationFn(this.state.variables):Promise.reject("No mutationFn found"),onFail:(M,Y)=>{this.dispatch({type:"failed",failureCount:M,error:Y})},onPause:()=>{this.dispatch({type:"pause"})},onContinue:()=>{this.dispatch({type:"continue"})},retry:(C=this.options.retry)!=null?C:0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode}),this.retryer.promise},r=this.state.status==="loading";try{var n,a,s,i,o,c,l,u;if(!r){var _,y,b,N;this.dispatch({type:"loading",variables:this.options.variables}),await((_=(y=this.mutationCache.config).onMutate)==null?void 0:_.call(y,this.state.variables,this));const M=await((b=(N=this.options).onMutate)==null?void 0:b.call(N,this.state.variables));M!==this.state.context&&this.dispatch({type:"loading",context:M,variables:this.state.variables})}const C=await e();return await((n=(a=this.mutationCache.config).onSuccess)==null?void 0:n.call(a,C,this.state.variables,this.state.context,this)),await((s=(i=this.options).onSuccess)==null?void 0:s.call(i,C,this.state.variables,this.state.context)),await((o=(c=this.mutationCache.config).onSettled)==null?void 0:o.call(c,C,null,this.state.variables,this.state.context,this)),await((l=(u=this.options).onSettled)==null?void 0:l.call(u,C,null,this.state.variables,this.state.context)),this.dispatch({type:"success",data:C}),C}catch(C){try{var x,I,O,D,V,F,L,T;throw await((x=(I=this.mutationCache.config).onError)==null?void 0:x.call(I,C,this.state.variables,this.state.context,this)),await((O=(D=this.options).onError)==null?void 0:O.call(D,C,this.state.variables,this.state.context)),await((V=(F=this.mutationCache.config).onSettled)==null?void 0:V.call(F,void 0,C,this.state.variables,this.state.context,this)),await((L=(T=this.options).onSettled)==null?void 0:L.call(T,void 0,C,this.state.variables,this.state.context)),C}finally{this.dispatch({type:"error",error:C})}}}dispatch(e){const r=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"loading":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!Jt(this.options.networkMode),status:"loading",variables:e.variables};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"};case"setState":return{...n,...e.state}}};this.state=r(this.state),G.batch(()=>{this.observers.forEach(n=>{n.onMutationUpdate(e)}),this.mutationCache.notify({mutation:this,type:"updated",action:e})})}}function Md(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0}}class Pd extends ht{constructor(e){super(),this.config=e||{},this.mutations=[],this.mutationId=0}build(e,r,n){const a=new xd({mutationCache:this,logger:e.getLogger(),mutationId:++this.mutationId,options:e.defaultMutationOptions(r),state:n,defaultOptions:r.mutationKey?e.getMutationDefaults(r.mutationKey):void 0});return this.add(a),a}add(e){this.mutations.push(e),this.notify({type:"added",mutation:e})}remove(e){this.mutations=this.mutations.filter(r=>r!==e),this.notify({type:"removed",mutation:e})}clear(){G.batch(()=>{this.mutations.forEach(e=>{this.remove(e)})})}getAll(){return this.mutations}find(e){return typeof e.exact>"u"&&(e.exact=!0),this.mutations.find(r=>dn(e,r))}findAll(e){return this.mutations.filter(r=>dn(e,r))}notify(e){G.batch(()=>{this.listeners.forEach(({listener:r})=>{r(e)})})}resumePausedMutations(){var e;return this.resuming=((e=this.resuming)!=null?e:Promise.resolve()).then(()=>{const r=this.mutations.filter(n=>n.state.isPaused);return G.batch(()=>r.reduce((n,a)=>n.then(()=>a.continue().catch(q)),Promise.resolve()))}).then(()=>{this.resuming=void 0}),this.resuming}}function Ud(){return{onFetch:t=>{t.fetchFn=()=>{var e,r,n,a,s,i;const o=(e=t.fetchOptions)==null||(r=e.meta)==null?void 0:r.refetchPage,c=(n=t.fetchOptions)==null||(a=n.meta)==null?void 0:a.fetchMore,l=c==null?void 0:c.pageParam,u=(c==null?void 0:c.direction)==="forward",_=(c==null?void 0:c.direction)==="backward",y=((s=t.state.data)==null?void 0:s.pages)||[],b=((i=t.state.data)==null?void 0:i.pageParams)||[];let N=b,x=!1;const I=T=>{Object.defineProperty(T,"signal",{enumerable:!0,get:()=>{var C;if((C=t.signal)!=null&&C.aborted)x=!0;else{var M;(M=t.signal)==null||M.addEventListener("abort",()=>{x=!0})}return t.signal}})},O=t.options.queryFn||(()=>Promise.reject("Missing queryFn for queryKey '"+t.options.queryHash+"'")),D=(T,C,M,Y)=>(N=Y?[C,...N]:[...N,C],Y?[M,...T]:[...T,M]),V=(T,C,M,Y)=>{if(x)return Promise.reject("Cancelled");if(typeof M>"u"&&!C&&T.length)return Promise.resolve(T);const Qt={queryKey:t.queryKey,pageParam:M,meta:t.options.meta};I(Qt);const Ht=O(Qt);return Promise.resolve(Ht).then(ul=>D(T,M,ul,Y))};let F;if(!y.length)F=V([]);else if(u){const T=typeof l<"u",C=T?l:wn(t.options,y);F=V(y,T,C)}else if(_){const T=typeof l<"u",C=T?l:kd(t.options,y);F=V(y,T,C,!0)}else{N=[];const T=typeof t.options.getNextPageParam>"u";F=(o&&y[0]?o(y[0],0,y):!0)?V([],T,b[0]):Promise.resolve(D([],b[0],y[0]));for(let M=1;M{if(o&&y[M]?o(y[M],M,y):!0){const Ht=T?b[M]:wn(t.options,Y);return V(Y,T,Ht)}return Promise.resolve(D(Y,b[M],y[M]))})}return F.then(T=>({pages:T,pageParams:N}))}}}}function wn(t,e){return t.getNextPageParam==null?void 0:t.getNextPageParam(e[e.length-1],e)}function kd(t,e){return t.getPreviousPageParam==null?void 0:t.getPreviousPageParam(e[0],e)}class Dd{constructor(e={}){this.queryCache=e.queryCache||new Ad,this.mutationCache=e.mutationCache||new Pd,this.logger=e.logger||zt,this.defaultOptions=e.defaultOptions||{},this.queryDefaults=[],this.mutationDefaults=[],this.mountCount=0}mount(){this.mountCount++,this.mountCount===1&&(this.unsubscribeFocus=Yt.subscribe(()=>{Yt.isFocused()&&(this.resumePausedMutations(),this.queryCache.onFocus())}),this.unsubscribeOnline=mt.subscribe(()=>{mt.isOnline()&&(this.resumePausedMutations(),this.queryCache.onOnline())}))}unmount(){var e,r;this.mountCount--,this.mountCount===0&&((e=this.unsubscribeFocus)==null||e.call(this),this.unsubscribeFocus=void 0,(r=this.unsubscribeOnline)==null||r.call(this),this.unsubscribeOnline=void 0)}isFetching(e,r){const[n]=pe(e,r);return n.fetchStatus="fetching",this.queryCache.findAll(n).length}isMutating(e){return this.mutationCache.findAll({...e,fetching:!0}).length}getQueryData(e,r){var n;return(n=this.queryCache.find(e,r))==null?void 0:n.state.data}ensureQueryData(e,r,n){const a=ft(e,r,n),s=this.getQueryData(a.queryKey);return s?Promise.resolve(s):this.fetchQuery(a)}getQueriesData(e){return this.getQueryCache().findAll(e).map(({queryKey:r,state:n})=>{const a=n.data;return[r,a]})}setQueryData(e,r,n){const a=this.queryCache.find(e),s=a==null?void 0:a.state.data,i=vd(r,s);if(typeof i>"u")return;const o=ft(e),c=this.defaultQueryOptions(o);return this.queryCache.build(this,c).setData(i,{...n,manual:!0})}setQueriesData(e,r,n){return G.batch(()=>this.getQueryCache().findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,r,n)]))}getQueryState(e,r){var n;return(n=this.queryCache.find(e,r))==null?void 0:n.state}removeQueries(e,r){const[n]=pe(e,r),a=this.queryCache;G.batch(()=>{a.findAll(n).forEach(s=>{a.remove(s)})})}resetQueries(e,r,n){const[a,s]=pe(e,r,n),i=this.queryCache,o={type:"active",...a};return G.batch(()=>(i.findAll(a).forEach(c=>{c.reset()}),this.refetchQueries(o,s)))}cancelQueries(e,r,n){const[a,s={}]=pe(e,r,n);typeof s.revert>"u"&&(s.revert=!0);const i=G.batch(()=>this.queryCache.findAll(a).map(o=>o.cancel(s)));return Promise.all(i).then(q).catch(q)}invalidateQueries(e,r,n){const[a,s]=pe(e,r,n);return G.batch(()=>{var i,o;if(this.queryCache.findAll(a).forEach(l=>{l.invalidate()}),a.refetchType==="none")return Promise.resolve();const c={...a,type:(i=(o=a.refetchType)!=null?o:a.type)!=null?i:"active"};return this.refetchQueries(c,s)})}refetchQueries(e,r,n){const[a,s]=pe(e,r,n),i=G.batch(()=>this.queryCache.findAll(a).filter(c=>!c.isDisabled()).map(c=>{var l;return c.fetch(void 0,{...s,cancelRefetch:(l=s==null?void 0:s.cancelRefetch)!=null?l:!0,meta:{refetchPage:a.refetchPage}})}));let o=Promise.all(i).then(q);return s!=null&&s.throwOnError||(o=o.catch(q)),o}fetchQuery(e,r,n){const a=ft(e,r,n),s=this.defaultQueryOptions(a);typeof s.retry>"u"&&(s.retry=!1);const i=this.queryCache.build(this,s);return i.isStaleByTime(s.staleTime)?i.fetch(s):Promise.resolve(i.state.data)}prefetchQuery(e,r,n){return this.fetchQuery(e,r,n).then(q).catch(q)}fetchInfiniteQuery(e,r,n){const a=ft(e,r,n);return a.behavior=Ud(),this.fetchQuery(a)}prefetchInfiniteQuery(e,r,n){return this.fetchInfiniteQuery(e,r,n).then(q).catch(q)}resumePausedMutations(){return this.mutationCache.resumePausedMutations()}getQueryCache(){return this.queryCache}getMutationCache(){return this.mutationCache}getLogger(){return this.logger}getDefaultOptions(){return this.defaultOptions}setDefaultOptions(e){this.defaultOptions=e}setQueryDefaults(e,r){const n=this.queryDefaults.find(a=>Se(e)===Se(a.queryKey));n?n.defaultOptions=r:this.queryDefaults.push({queryKey:e,defaultOptions:r})}getQueryDefaults(e){if(!e)return;const r=this.queryDefaults.find(n=>pt(e,n.queryKey));return r==null?void 0:r.defaultOptions}setMutationDefaults(e,r){const n=this.mutationDefaults.find(a=>Se(e)===Se(a.mutationKey));n?n.defaultOptions=r:this.mutationDefaults.push({mutationKey:e,defaultOptions:r})}getMutationDefaults(e){if(!e)return;const r=this.mutationDefaults.find(n=>pt(e,n.mutationKey));return r==null?void 0:r.defaultOptions}defaultQueryOptions(e){if(e!=null&&e._defaulted)return e;const r={...this.defaultOptions.queries,...this.getQueryDefaults(e==null?void 0:e.queryKey),...e,_defaulted:!0};return!r.queryHash&&r.queryKey&&(r.queryHash=Wt(r.queryKey,r)),typeof r.refetchOnReconnect>"u"&&(r.refetchOnReconnect=r.networkMode!=="always"),typeof r.useErrorBoundary>"u"&&(r.useErrorBoundary=!!r.suspense),r}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...this.defaultOptions.mutations,...this.getMutationDefaults(e==null?void 0:e.mutationKey),...e,_defaulted:!0}}clear(){this.queryCache.clear(),this.mutationCache.clear()}}function Fd(t){return{mutationKey:t.options.mutationKey,state:t.state}}function Zd(t){return{state:t.state,queryKey:t.queryKey,queryHash:t.queryHash}}function jd(t){return t.state.isPaused}function Vd(t){return t.state.status==="success"}function Ld(t,e={}){const r=[],n=[];if(e.dehydrateMutations!==!1){const a=e.shouldDehydrateMutation||jd;t.getMutationCache().getAll().forEach(s=>{a(s)&&r.push(Fd(s))})}if(e.dehydrateQueries!==!1){const a=e.shouldDehydrateQuery||Vd;t.getQueryCache().getAll().forEach(s=>{a(s)&&n.push(Zd(s))})}return{mutations:r,queries:n}}function Wd(t,e,r){if(typeof e!="object"||e===null)return;const n=t.getMutationCache(),a=t.getQueryCache(),s=e.mutations||[],i=e.queries||[];s.forEach(o=>{var c;n.build(t,{...r==null||(c=r.defaultOptions)==null?void 0:c.mutations,mutationKey:o.mutationKey},o.state)}),i.forEach(o=>{var c;const l=a.get(o.queryHash),u={...o.state,fetchStatus:"idle"};if(l){l.state.dataUpdatedAtr,o=s.buster!==n;i||o?e.removeClient():Wd(t,s.clientState,a)}else e.removeClient()}catch{e.removeClient()}}async function Tn({queryClient:t,persister:e,buster:r="",dehydrateOptions:n}){const a={buster:r,timestamp:Date.now(),clientState:Ld(t,n)};await e.persistClient(a)}function Jd(t){const e=t.queryClient.getQueryCache().subscribe(n=>{bn(n.type)&&Tn(t)}),r=t.queryClient.getMutationCache().subscribe(n=>{bn(n.type)&&Tn(t)});return()=>{e(),r()}}function Xd(t){let e=!1,r;const n=()=>{e=!0,r==null||r()},a=Yd(t).then(()=>{e||(r=Jd(t))});return[n,a]}function zd({storage:t,key:e="REACT_QUERY_OFFLINE_CACHE",throttleTime:r=1e3,serialize:n=JSON.stringify,deserialize:a=JSON.parse,retry:s}){if(t){const i=o=>{try{t.setItem(e,n(o));return}catch(c){return c}};return{persistClient:Bd(o=>{let c=o,l=i(c),u=0;for(;l&&c;)u++,c=s==null?void 0:s({persistedClient:c,error:l,errorCount:u}),c&&(l=i(c))},r),restoreClient:()=>{const o=t.getItem(e);if(o)return a(o)},removeClient:()=>{t.removeItem(e)}}}return{persistClient:En,restoreClient:()=>{},removeClient:En}}function Bd(t,e=100){let r=null,n;return function(...a){n=a,r===null&&(r=setTimeout(()=>{t(...n),r=null},e))}}function En(){}const Sn=new Dd({defaultOptions:{queries:{staleTime:1e3*60*3}}}),Qd=zd({storage:window.localStorage,key:"aaioSdkConfig"});Xd({queryClient:Sn,persister:Qd});function Bt(t,e){const n={[P.HTML]:()=>Hd(t,e),[P.Widget]:Kd}[t.type];try{n&&n(t)}catch(a){console.error("executeCode error: ",a)}}function Hd(t,e){if(t.insert_html){const r=t.insert_html.replace("{{awooEvent}}",`window.awooDataLayer["${e}"]`);Hr(r)}}async function Kd(t){var s;const e=(s=t.metafields)==null?void 0:s.widget;if(!e)return;const r=_d(e);if(!r)return;r.beforeInit&&r.beforeInit(),t.insert_html&&await Hr(t.insert_html);const{id:n}=window.sdkManagerConfig,a=await qd(n,e);Pc(r,a)}async function qd(t,e){const r=gd(e);if(r.length===0)return{id:t};let n;try{n=await Sn.fetchQuery({queryKey:[...r,t],queryFn:()=>yd(t,r)})}catch(s){return console.error("get customize config error"),console.error(s),{id:t}}return Object.keys(n).reduce((s,i)=>{var o,c;return i==="tagFilter"?{...s,tagFilterFields:(o=n.tagFilter)==null?void 0:o.fields}:(s=Object.assign(s,(c=n[i])==null?void 0:c.fields),s)},{id:t})}function $d(t,e){const r=n=>{t.forEach(a=>{const s=e[a.id],{predicates:i}=a;(i.length===0||i.every(c=>kt(c,n)))&&s.forEach(c=>Bt(c))})};document.readyState==="complete"?r():window.addEventListener("load",n=>r(n))}function el(t,e){window.addEventListener("click",r=>{const n=(a,s)=>{const{predicates:i}=a;(i.length===0||i.every(c=>kt(c,r)))&&s.forEach(c=>Bt(c))};t.forEach(a=>{const s=e[a.id];n(a,s)})})}function tl(t,e){window.dataLayer=window.dataLayer||[],window.awooDataLayer=window.awooDataLayer||{},In({triggers:t,codeListByTriggerId:e,incomingEvents:window.dataLayer});const r=window.dataLayer.push;window.dataLayer.push=function(...n){return In({triggers:t,codeListByTriggerId:e,incomingEvents:n,useTimeout:!0}),r.apply(window.dataLayer,n)}}function In({triggers:t,codeListByTriggerId:e,incomingEvents:r,useTimeout:n=!1}){t.forEach(a=>{const{predicates:s}=a;if(s.length===0||s.every(i=>kt(i)))if(n){const i=setTimeout(()=>{Cn({trigger:a,codeListByTriggerId:e,incomingEvents:r}),clearTimeout(i)},300)}else Cn({trigger:a,codeListByTriggerId:e,incomingEvents:r})})}function Cn({trigger:t,incomingEvents:e,codeListByTriggerId:r}){if(t.type!==J.CustomEvent)return;const n=t.event_name,a=r[t.id];e.forEach(s=>{(!("event"in s)||n!==s.event)&&!(s[0]&&s[1]===n)||a.forEach(i=>{var l;const o=(l=i.advanced_conditions)!=null&&l.trigger_setting?i.advanced_conditions.trigger_setting:Me.EachPage,c=Object.values(window.awooDataLayer).findIndex(u=>u.event===n||u[1]===n)!==-1;o===Me.EachPage&&c||(window.awooDataLayer={...window.awooDataLayer,[s["gtm.uniqueEventId"]]:s},Bt(i,s["gtm.uniqueEventId"]))})})}const rl={[J.PageView]:$d,[J.Click]:el,[J.CustomEvent]:tl},nl=t=>rl[t],al=[{event:"91app.Pageview","91app_PageView":{memberId:"",clientId:"aaca9eac-4135-44ad-9179-4c555706177e",isLogin:!1,shopId:2069,memberHashed:{emailHashed:null,phoneHashed:null,phoneHashedForTealiumIQ:null}},"gtm.uniqueEventId":1},{event:"91app.AddToCart","91app_addToCart":{categoryId:75601,categoryName:"人氣商品推薦",id:8921947,name:"加工原料原味(杏仁香脆肉紙1KG)",price:220,quantity:1,productOuterId:""},"gtm.uniqueEventId":2},{event:"91app.Pageview","91app_PageView":{memberId:"",clientId:"aaca9eac-4135-44ad-9179-4c555706177e",isLogin:!1,shopId:2070,memberHashed:{emailHashed:null,phoneHashed:null,phoneHashedForTealiumIQ:null}},"gtm.uniqueEventId":3},{event:"91app.AddToCart","91app_addToCart":{categoryId:75601,categoryName:"人氣商品推薦",id:8921947,name:"加工原料原味(杏仁香脆肉紙1KG)",price:220,quantity:1,productOuterId:""},"gtm.uniqueEventId":4}],sl={id:"4210269216",host:"localhost",version:"0",pixelOn:!0,triggers:[{id:0,name:"",type:J.PageView,event_name:null,predicates:[{metric:X.PageURL,function:j.Regex,value:".*"},{metric:X.PageURL,function:j.Regex,value:".*"}]},{id:1,name:"",type:J.PageView,event_name:null,predicates:[{metric:X.PageURL,function:j.Regex,value:".*"},{metric:X.PageURL,function:j.Regex,value:".*"}]},{id:2,name:"",type:J.Click,event_name:null,predicates:[{metric:X.DomSelector,function:j.EqualDom,value:"#addToCartBtn"},{metric:X.PageURL,function:j.Regex,value:".*"}]},{id:3,name:"",type:J.CustomEvent,event_name:"91app.Pageview",predicates:[{metric:X.PageURL,function:j.Regex,value:".*"}]},{id:4,name:"",type:J.CustomEvent,event_name:"91app.AddToCart",predicates:[{metric:X.PageURL,function:j.Regex,value:"page/awoo-sdk-test"}]}],codes:[{id:0,type:P.HTML,insert_html:'