@bymos/agentkit-sdk 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agentkit-widget.iife.js +292 -12
- package/agentkit-widget.js +2056 -1560
- package/index.cjs +293 -13
- package/index.js +2098 -1607
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let Yr=require("preact/compat/client"),O=require("preact/compat"),l=require("preact/jsx-runtime");var I;(function(e){e.assertEqual=a=>{};function t(a){}e.assertIs=t;function r(a){throw new Error}e.assertNever=r,e.arrayToEnum=a=>{const i={};for(const s of a)i[s]=s;return i},e.getValidEnumValues=a=>{const i=e.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),s={};for(const o of i)s[o]=a[o];return e.objectValues(s)},e.objectValues=a=>e.objectKeys(a).map(function(i){return a[i]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const i=[];for(const s in a)Object.prototype.hasOwnProperty.call(a,s)&&i.push(s);return i},e.find=(a,i)=>{for(const s of a)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,i=" | "){return a.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(I||(I={}));var Rt;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Rt||(Rt={}));var v=I.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ne=e=>{switch(typeof e){case"undefined":return v.undefined;case"string":return v.string;case"number":return Number.isNaN(e)?v.nan:v.number;case"boolean":return v.boolean;case"function":return v.function;case"bigint":return v.bigint;case"symbol":return v.symbol;case"object":return Array.isArray(e)?v.array:e===null?v.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?v.promise:typeof Map<"u"&&e instanceof Map?v.map:typeof Set<"u"&&e instanceof Set?v.set:typeof Date<"u"&&e instanceof Date?v.date:v.object;default:return v.unknown}},f=I.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"]),G=class Qt extends Error{get errors(){return this.issues}constructor(t){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=t}format(t){const r=t||function(i){return i.message},n={_errors:[]},a=i=>{for(const s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(a);else if(s.code==="invalid_return_type")a(s.returnTypeError);else if(s.code==="invalid_arguments")a(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let o=n,c=0;for(;c<s.path.length;){const d=s.path[c];c!==s.path.length-1?o[d]=o[d]||{_errors:[]}:(o[d]=o[d]||{_errors:[]},o[d]._errors.push(r(s))),o=o[d],c++}}};return a(this),n}static assert(t){if(!(t instanceof Qt))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,I.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){const r={},n=[];for(const a of this.issues)if(a.path.length>0){const i=a.path[0];r[i]=r[i]||[],r[i].push(t(a))}else n.push(t(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};G.create=e=>new G(e);var xe=(e,t)=>{let r;switch(e.code){case f.invalid_type:e.received===v.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case f.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,I.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:r=`Unrecognized key(s) in object: ${I.joinValues(e.keys,", ")}`;break;case f.invalid_union:r="Invalid input";break;case f.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${I.joinValues(e.options)}`;break;case f.invalid_enum_value:r=`Invalid enum value. Expected ${I.joinValues(e.options)}, received '${e.received}'`;break;case f.invalid_arguments:r="Invalid function arguments";break;case f.invalid_return_type:r="Invalid function return type";break;case f.invalid_date:r="Invalid date";break;case f.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:I.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case f.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case f.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case f.custom:r="Invalid input";break;case f.invalid_intersection_types:r="Intersection results could not be merged";break;case f.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case f.not_finite:r="Number must be finite";break;default:r=t.defaultError,I.assertNever(e)}return{message:r}},Hr=xe;function qe(){return Hr}var et=e=>{const{data:t,path:r,errorMaps:n,issueData:a}=e,i=[...r,...a.path||[]],s={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let o="";const c=n.filter(d=>!!d).slice().reverse();for(const d of c)o=d(s,{data:t,defaultError:o}).message;return{...a,path:i,message:o}};function g(e,t){const r=qe(),n=et({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===xe?void 0:xe].filter(a=>!!a)});e.common.issues.push(n)}var F=class Kt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const n=[];for(const a of r){if(a.status==="aborted")return k;a.status==="dirty"&&t.dirty(),n.push(a.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){const n=[];for(const a of r){const i=await a.key,s=await a.value;n.push({key:i,value:s})}return Kt.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const a of r){const{key:i,value:s}=a;if(i.status==="aborted"||s.status==="aborted")return k;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||a.alwaysSet)&&(n[i.value]=s.value)}return{status:t.value,value:n}}},k=Object.freeze({status:"aborted"}),ye=e=>({status:"dirty",value:e}),V=e=>({status:"valid",value:e}),Et=e=>e.status==="aborted",Mt=e=>e.status==="dirty",ge=e=>e.status==="valid",Re=e=>typeof Promise<"u"&&e instanceof Promise,y;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(y||(y={}));var Y=class{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Ot=(e,t)=>{if(ge(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){return this._error?this._error:(this._error=new G(e.common.issues),this._error)}}};function w(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:a}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:(s,o)=>{const{message:c}=e;return s.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:c??r??o.defaultError}},description:a}}var C=class{get description(){return this._def.description}_getType(e){return ne(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ne(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new F,ctx:{common:e.parent.common,data:e.data,parsedType:ne(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Re(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){const r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ne(e)};return Ot(r,this._parseSync({data:e,path:r.path,parent:r}))}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ne(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:t});return ge(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>ge(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ne(e)},n=this._parse({data:e,path:r.path,parent:r});return Ot(r,await(Re(n)?n:Promise.resolve(n)))}refine(e,t){const r=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{const i=e(n),s=()=>a.addIssue({code:f.custom,...r(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(o=>o?!0:(s(),!1)):i?!0:(s(),!1)})}refinement(e,t){return this._refinement((r,n)=>e(r)?!0:(n.addIssue(typeof t=="function"?t(r,n):t),!1))}_refinement(e){return new ee({schema:this,typeName:x.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}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.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return q.create(this,this._def)}nullable(){return ce.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ve.create(this)}promise(){return _e.create(this,this._def)}or(e){return Ve.create([this,e],this._def)}and(e){return Pe.create(this,e,this._def)}transform(e){return new ee({...w(this._def),schema:this,typeName:x.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new De({...w(this._def),innerType:this,defaultValue:t,typeName:x.ZodDefault})}brand(){return new ir({typeName:x.ZodBranded,type:this,...w(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ue({...w(this._def),innerType:this,catchValue:t,typeName:x.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return sr.create(this,e)}readonly(){return $e.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Xr=/^c[^\s-]{8,}$/i,Jr=/^[0-9a-z]+$/,Qr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Kr=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,qr=/^[a-z0-9_-]{21}$/i,en=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,tn=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,rn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,nn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Xe,an=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,sn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,on=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,cn=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,dn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ln=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,qt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",un=new RegExp(`^${qt}$`);function er(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function hn(e){return new RegExp(`^${er(e)}$`)}function fn(e){let t=`${qt}T${er(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function mn(e,t){return!!((t==="v4"||!t)&&an.test(e)||(t==="v6"||!t)&&on.test(e))}function pn(e,t){if(!en.test(e))return!1;try{const[r]=e.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||t&&a.alg!==t)}catch{return!1}}function gn(e,t){return!!((t==="v4"||!t)&&sn.test(e)||(t==="v6"||!t)&&cn.test(e))}var Ee=class be extends C{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==v.string){const a=this._getOrReturnCtx(t);return g(a,{code:f.invalid_type,expected:v.string,received:a.parsedType}),k}const r=new F;let n;for(const a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(n=this._getOrReturnCtx(t,n),g(n,{code:f.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")t.data.length>a.value&&(n=this._getOrReturnCtx(t,n),g(n,{code:f.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){const i=t.data.length>a.value,s=t.data.length<a.value;(i||s)&&(n=this._getOrReturnCtx(t,n),i?g(n,{code:f.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&g(n,{code:f.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")rn.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"email",code:f.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")Xe||(Xe=new RegExp(nn,"u")),Xe.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"emoji",code:f.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Kr.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"uuid",code:f.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")qr.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"nanoid",code:f.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Xr.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"cuid",code:f.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")Jr.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"cuid2",code:f.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Qr.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"ulid",code:f.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{n=this._getOrReturnCtx(t,n),g(n,{validation:"url",code:f.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"regex",code:f.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?t.data=t.data.trim():a.kind==="includes"?t.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(t,n),g(n,{code:f.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?t.data=t.data.toLowerCase():a.kind==="toUpperCase"?t.data=t.data.toUpperCase():a.kind==="startsWith"?t.data.startsWith(a.value)||(n=this._getOrReturnCtx(t,n),g(n,{code:f.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(n=this._getOrReturnCtx(t,n),g(n,{code:f.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?fn(a).test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{code:f.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?un.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{code:f.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?hn(a).test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{code:f.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?tn.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"duration",code:f.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?mn(t.data,a.version)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"ip",code:f.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?pn(t.data,a.alg)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"jwt",code:f.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?gn(t.data,a.version)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"cidr",code:f.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?dn.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"base64",code:f.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?ln.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"base64url",code:f.invalid_string,message:a.message}),r.dirty()):I.assertNever(a);return{status:r.value,value:t.data}}_regex(t,r,n){return this.refinement(a=>t.test(a),{validation:r,code:f.invalid_string,...y.errToObj(n)})}_addCheck(t){return new be({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...y.errToObj(t)})}url(t){return this._addCheck({kind:"url",...y.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...y.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...y.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...y.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...y.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...y.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...y.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...y.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...y.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...y.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...y.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...y.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...y.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...y.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...y.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...y.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...y.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...y.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...y.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...y.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...y.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...y.errToObj(r)})}nonempty(t){return this.min(1,y.errToObj(t))}trim(){return new be({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new be({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new be({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Ee.create=e=>new Ee({checks:[],typeName:x.ZodString,coerce:e?.coerce??!1,...w(e)});function vn(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=r>n?r:n;return Number.parseInt(e.toFixed(a).replace(".",""))%Number.parseInt(t.toFixed(a).replace(".",""))/10**a}var tt=class rt extends C{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==v.number){const a=this._getOrReturnCtx(t);return g(a,{code:f.invalid_type,expected:v.number,received:a.parsedType}),k}let r;const n=new F;for(const a of this._def.checks)a.kind==="int"?I.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),g(r,{code:f.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(r=this._getOrReturnCtx(t,r),g(r,{code:f.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(r=this._getOrReturnCtx(t,r),g(r,{code:f.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?vn(t.data,a.value)!==0&&(r=this._getOrReturnCtx(t,r),g(r,{code:f.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),g(r,{code:f.not_finite,message:a.message}),n.dirty()):I.assertNever(a);return{status:n.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,y.toString(r))}gt(t,r){return this.setLimit("min",t,!1,y.toString(r))}lte(t,r){return this.setLimit("max",t,!0,y.toString(r))}lt(t,r){return this.setLimit("max",t,!1,y.toString(r))}setLimit(t,r,n,a){return new rt({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:y.toString(a)}]})}_addCheck(t){return new rt({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:y.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:y.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:y.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&I.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};tt.create=e=>new tt({checks:[],typeName:x.ZodNumber,coerce:e?.coerce||!1,...w(e)});var nt=class at extends C{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==v.bigint)return this._getInvalidInput(t);let r;const n=new F;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(r=this._getOrReturnCtx(t,r),g(r,{code:f.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(r=this._getOrReturnCtx(t,r),g(r,{code:f.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),g(r,{code:f.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):I.assertNever(a);return{status:n.value,value:t.data}}_getInvalidInput(t){const r=this._getOrReturnCtx(t);return g(r,{code:f.invalid_type,expected:v.bigint,received:r.parsedType}),k}gte(t,r){return this.setLimit("min",t,!0,y.toString(r))}gt(t,r){return this.setLimit("min",t,!1,y.toString(r))}lte(t,r){return this.setLimit("max",t,!0,y.toString(r))}lt(t,r){return this.setLimit("max",t,!1,y.toString(r))}setLimit(t,r,n,a){return new at({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:y.toString(a)}]})}_addCheck(t){return new at({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:y.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};nt.create=e=>new nt({checks:[],typeName:x.ZodBigInt,coerce:e?.coerce??!1,...w(e)});var it=class extends C{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==v.boolean){const t=this._getOrReturnCtx(e);return g(t,{code:f.invalid_type,expected:v.boolean,received:t.parsedType}),k}return V(e.data)}};it.create=e=>new it({typeName:x.ZodBoolean,coerce:e?.coerce||!1,...w(e)});var st=class tr extends C{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==v.date){const a=this._getOrReturnCtx(t);return g(a,{code:f.invalid_type,expected:v.date,received:a.parsedType}),k}if(Number.isNaN(t.data.getTime()))return g(this._getOrReturnCtx(t),{code:f.invalid_date}),k;const r=new F;let n;for(const a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(n=this._getOrReturnCtx(t,n),g(n,{code:f.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?t.data.getTime()>a.value&&(n=this._getOrReturnCtx(t,n),g(n,{code:f.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):I.assertNever(a);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new tr({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:y.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:y.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};st.create=e=>new st({checks:[],coerce:e?.coerce||!1,typeName:x.ZodDate,...w(e)});var ot=class extends C{_parse(e){if(this._getType(e)!==v.symbol){const t=this._getOrReturnCtx(e);return g(t,{code:f.invalid_type,expected:v.symbol,received:t.parsedType}),k}return V(e.data)}};ot.create=e=>new ot({typeName:x.ZodSymbol,...w(e)});var Me=class extends C{_parse(e){if(this._getType(e)!==v.undefined){const t=this._getOrReturnCtx(e);return g(t,{code:f.invalid_type,expected:v.undefined,received:t.parsedType}),k}return V(e.data)}};Me.create=e=>new Me({typeName:x.ZodUndefined,...w(e)});var Oe=class extends C{_parse(e){if(this._getType(e)!==v.null){const t=this._getOrReturnCtx(e);return g(t,{code:f.invalid_type,expected:v.null,received:t.parsedType}),k}return V(e.data)}};Oe.create=e=>new Oe({typeName:x.ZodNull,...w(e)});var ct=class extends C{constructor(){super(...arguments),this._any=!0}_parse(e){return V(e.data)}};ct.create=e=>new ct({typeName:x.ZodAny,...w(e)});var me=class extends C{constructor(){super(...arguments),this._unknown=!0}_parse(e){return V(e.data)}};me.create=e=>new me({typeName:x.ZodUnknown,...w(e)});var ae=class extends C{_parse(e){const t=this._getOrReturnCtx(e);return g(t,{code:f.invalid_type,expected:v.never,received:t.parsedType}),k}};ae.create=e=>new ae({typeName:x.ZodNever,...w(e)});var dt=class extends C{_parse(e){if(this._getType(e)!==v.undefined){const t=this._getOrReturnCtx(e);return g(t,{code:f.invalid_type,expected:v.void,received:t.parsedType}),k}return V(e.data)}};dt.create=e=>new dt({typeName:x.ZodVoid,...w(e)});var ve=class Ne extends C{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),a=this._def;if(r.parsedType!==v.array)return g(r,{code:f.invalid_type,expected:v.array,received:r.parsedType}),k;if(a.exactLength!==null){const s=r.data.length>a.exactLength.value,o=r.data.length<a.exactLength.value;(s||o)&&(g(r,{code:s?f.too_big:f.too_small,minimum:o?a.exactLength.value:void 0,maximum:s?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(g(r,{code:f.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(g(r,{code:f.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((s,o)=>a.type._parseAsync(new Y(r,s,r.path,o)))).then(s=>F.mergeArray(n,s));const i=[...r.data].map((s,o)=>a.type._parseSync(new Y(r,s,r.path,o)));return F.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new Ne({...this._def,minLength:{value:t,message:y.toString(r)}})}max(t,r){return new Ne({...this._def,maxLength:{value:t,message:y.toString(r)}})}length(t,r){return new Ne({...this._def,exactLength:{value:t,message:y.toString(r)}})}nonempty(t){return this.min(1,t)}};ve.create=(e,t)=>new ve({type:e,minLength:null,maxLength:null,exactLength:null,typeName:x.ZodArray,...w(t)});function fe(e){if(e instanceof $){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=q.create(fe(n))}return new $({...e._def,shape:()=>t})}else return e instanceof ve?new ve({...e._def,type:fe(e.element)}):e instanceof q?q.create(fe(e.unwrap())):e instanceof ce?ce.create(fe(e.unwrap())):e instanceof oe?oe.create(e.items.map(t=>fe(t))):e}var $=class D extends C{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape();return this._cached={shape:t,keys:I.objectKeys(t)},this._cached}_parse(t){if(this._getType(t)!==v.object){const c=this._getOrReturnCtx(t);return g(c,{code:f.invalid_type,expected:v.object,received:c.parsedType}),k}const{status:r,ctx:n}=this._processInputParams(t),{shape:a,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof ae&&this._def.unknownKeys==="strip"))for(const c in n.data)i.includes(c)||s.push(c);const o=[];for(const c of i){const d=a[c],u=n.data[c];o.push({key:{status:"valid",value:c},value:d._parse(new Y(n,u,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof ae){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of s)o.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(c==="strict")s.length>0&&(g(n,{code:f.unrecognized_keys,keys:s}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of s){const u=n.data[d];o.push({key:{status:"valid",value:d},value:c._parse(new Y(n,u,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of o){const u=await d.key,h=await d.value;c.push({key:u,value:h,alwaysSet:d.alwaysSet})}return c}).then(c=>F.mergeObjectSync(r,c)):F.mergeObjectSync(r,o)}get shape(){return this._def.shape()}strict(t){return y.errToObj,new D({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{const a=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:y.errToObj(t).message??a}:{message:a}}}:{}})}strip(){return new D({...this._def,unknownKeys:"strip"})}passthrough(){return new D({...this._def,unknownKeys:"passthrough"})}extend(t){return new D({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new D({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:x.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new D({...this._def,catchall:t})}pick(t){const r={};for(const n of I.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new D({...this._def,shape:()=>r})}omit(t){const r={};for(const n of I.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new D({...this._def,shape:()=>r})}deepPartial(){return fe(this)}partial(t){const r={};for(const n of I.objectKeys(this.shape)){const a=this.shape[n];t&&!t[n]?r[n]=a:r[n]=a.optional()}return new D({...this._def,shape:()=>r})}required(t){const r={};for(const n of I.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof q;)a=a._def.innerType;r[n]=a}return new D({...this._def,shape:()=>r})}keyof(){return ar(I.objectKeys(this.shape))}};$.create=(e,t)=>new $({shape:()=>e,unknownKeys:"strip",catchall:ae.create(),typeName:x.ZodObject,...w(t)});$.strictCreate=(e,t)=>new $({shape:()=>e,unknownKeys:"strict",catchall:ae.create(),typeName:x.ZodObject,...w(t)});$.lazycreate=(e,t)=>new $({shape:e,unknownKeys:"strip",catchall:ae.create(),typeName:x.ZodObject,...w(t)});var Ve=class extends C{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function n(a){for(const s of a)if(s.result.status==="valid")return s.result;for(const s of a)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;const i=a.map(s=>new G(s.ctx.common.issues));return g(t,{code:f.invalid_union,unionErrors:i}),k}if(t.common.async)return Promise.all(r.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a;const i=[];for(const o of r){const c={...t,common:{...t.common,issues:[]},parent:null},d=o._parseSync({data:t.data,path:t.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!a&&(a={result:d,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const s=i.map(o=>new G(o));return g(t,{code:f.invalid_union,unionErrors:s}),k}}get options(){return this._def.options}};Ve.create=(e,t)=>new Ve({options:e,typeName:x.ZodUnion,...w(t)});var Q=e=>e instanceof Fe?Q(e.schema):e instanceof ee?Q(e.innerType()):e instanceof We?[e.value]:e instanceof Ge?e.options:e instanceof ze?I.objectValues(e.enum):e instanceof De?Q(e._def.innerType):e instanceof Me?[void 0]:e instanceof Oe?[null]:e instanceof q?[void 0,...Q(e.unwrap())]:e instanceof ce?[null,...Q(e.unwrap())]:e instanceof ir||e instanceof $e?Q(e.unwrap()):e instanceof Ue?Q(e._def.innerType):[],yn=class rr extends C{_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==v.object)return g(r,{code:f.invalid_type,expected:v.object,received:r.parsedType}),k;const n=this.discriminator,a=r.data[n],i=this.optionsMap.get(a);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(g(r,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),k)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){const a=new Map;for(const i of r){const s=Q(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const o of s){if(a.has(o))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(o)}`);a.set(o,i)}}return new rr({typeName:x.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:a,...w(n)})}};function lt(e,t){const r=ne(e),n=ne(t);if(e===t)return{valid:!0,data:e};if(r===v.object&&n===v.object){const a=I.objectKeys(t),i=I.objectKeys(e).filter(o=>a.indexOf(o)!==-1),s={...e,...t};for(const o of i){const c=lt(e[o],t[o]);if(!c.valid)return{valid:!1};s[o]=c.data}return{valid:!0,data:s}}else if(r===v.array&&n===v.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let i=0;i<e.length;i++){const s=e[i],o=t[i],c=lt(s,o);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else return r===v.date&&n===v.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Pe=class extends C{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(a,i)=>{if(Et(a)||Et(i))return k;const s=lt(a.value,i.value);return s.valid?((Mt(a)||Mt(i))&&t.dirty(),{status:t.value,value:s.data}):(g(r,{code:f.invalid_intersection_types}),k)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Pe.create=(e,t,r)=>new Pe({left:e,right:t,typeName:x.ZodIntersection,...w(r)});var oe=class nr extends C{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==v.array)return g(n,{code:f.invalid_type,expected:v.array,received:n.parsedType}),k;if(n.data.length<this._def.items.length)return g(n,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),k;!this._def.rest&&n.data.length>this._def.items.length&&(g(n,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const a=[...n.data].map((i,s)=>{const o=this._def.items[s]||this._def.rest;return o?o._parse(new Y(n,i,n.path,s)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>F.mergeArray(r,i)):F.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new nr({...this._def,rest:t})}};oe.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new oe({items:e,typeName:x.ZodTuple,rest:null,...w(t)})};var bn=class ut extends C{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==v.object)return g(n,{code:f.invalid_type,expected:v.object,received:n.parsedType}),k;const a=[],i=this._def.keyType,s=this._def.valueType;for(const o in n.data)a.push({key:i._parse(new Y(n,o,n.path,o)),value:s._parse(new Y(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?F.mergeObjectAsync(r,a):F.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof C?new ut({keyType:t,valueType:r,typeName:x.ZodRecord,...w(n)}):new ut({keyType:Ee.create(),valueType:t,typeName:x.ZodRecord,...w(r)})}},ht=class extends C{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==v.map)return g(r,{code:f.invalid_type,expected:v.map,received:r.parsedType}),k;const n=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([s,o],c)=>({key:n._parse(new Y(r,s,r.path,[c,"key"])),value:a._parse(new Y(r,o,r.path,[c,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const o of i){const c=await o.key,d=await o.value;if(c.status==="aborted"||d.status==="aborted")return k;(c.status==="dirty"||d.status==="dirty")&&t.dirty(),s.set(c.value,d.value)}return{status:t.value,value:s}})}else{const s=new Map;for(const o of i){const c=o.key,d=o.value;if(c.status==="aborted"||d.status==="aborted")return k;(c.status==="dirty"||d.status==="dirty")&&t.dirty(),s.set(c.value,d.value)}return{status:t.value,value:s}}}};ht.create=(e,t,r)=>new ht({valueType:t,keyType:e,typeName:x.ZodMap,...w(r)});var ft=class mt extends C{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==v.set)return g(n,{code:f.invalid_type,expected:v.set,received:n.parsedType}),k;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(g(n,{code:f.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(g(n,{code:f.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const i=this._def.valueType;function s(c){const d=new Set;for(const u of c){if(u.status==="aborted")return k;u.status==="dirty"&&r.dirty(),d.add(u.value)}return{status:r.value,value:d}}const o=[...n.data.values()].map((c,d)=>i._parse(new Y(n,c,n.path,d)));return n.common.async?Promise.all(o).then(c=>s(c)):s(o)}min(t,r){return new mt({...this._def,minSize:{value:t,message:y.toString(r)}})}max(t,r){return new mt({...this._def,maxSize:{value:t,message:y.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};ft.create=(e,t)=>new ft({valueType:e,minSize:null,maxSize:null,typeName:x.ZodSet,...w(t)});var kn=class Le extends C{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==v.function)return g(r,{code:f.invalid_type,expected:v.function,received:r.parsedType}),k;function n(o,c){return et({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,qe(),xe].filter(d=>!!d),issueData:{code:f.invalid_arguments,argumentsError:c}})}function a(o,c){return et({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,qe(),xe].filter(d=>!!d),issueData:{code:f.invalid_return_type,returnTypeError:c}})}const i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof _e){const o=this;return V(async function(...c){const d=new G([]),u=await o._def.args.parseAsync(c,i).catch(m=>{throw d.addIssue(n(c,m)),d}),h=await Reflect.apply(s,this,u);return await o._def.returns._def.type.parseAsync(h,i).catch(m=>{throw d.addIssue(a(h,m)),d})})}else{const o=this;return V(function(...c){const d=o._def.args.safeParse(c,i);if(!d.success)throw new G([n(c,d.error)]);const u=Reflect.apply(s,this,d.data),h=o._def.returns.safeParse(u,i);if(!h.success)throw new G([a(u,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Le({...this._def,args:oe.create(t).rest(me.create())})}returns(t){return new Le({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new Le({args:t||oe.create([]).rest(me.create()),returns:r||me.create(),typeName:x.ZodFunction,...w(n)})}},Fe=class extends C{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Fe.create=(e,t)=>new Fe({getter:e,typeName:x.ZodLazy,...w(t)});var We=class extends C{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return g(t,{received:t.data,code:f.invalid_literal,expected:this._def.value}),k}return{status:"valid",value:e.data}}get value(){return this._def.value}};We.create=(e,t)=>new We({value:e,typeName:x.ZodLiteral,...w(t)});function ar(e,t){return new Ge({values:e,typeName:x.ZodEnum,...w(t)})}var Ge=class pt extends C{_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return g(r,{expected:I.joinValues(n),received:r.parsedType,code:f.invalid_type}),k}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const r=this._getOrReturnCtx(t),n=this._def.values;return g(r,{received:r.data,code:f.invalid_enum_value,options:n}),k}return V(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return pt.create(t,{...this._def,...r})}exclude(t,r=this._def){return pt.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Ge.create=ar;var ze=class extends C{_parse(e){const t=I.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==v.string&&r.parsedType!==v.number){const n=I.objectValues(t);return g(r,{expected:I.joinValues(n),received:r.parsedType,code:f.invalid_type}),k}if(this._cache||(this._cache=new Set(I.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=I.objectValues(t);return g(r,{received:r.data,code:f.invalid_enum_value,options:n}),k}return V(e.data)}get enum(){return this._def.values}};ze.create=(e,t)=>new ze({values:e,typeName:x.ZodNativeEnum,...w(t)});var _e=class extends C{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);return t.parsedType!==v.promise&&t.common.async===!1?(g(t,{code:f.invalid_type,expected:v.promise,received:t.parsedType}),k):V((t.parsedType===v.promise?t.data:Promise.resolve(t.data)).then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};_e.create=(e,t)=>new _e({type:e,typeName:x.ZodPromise,...w(t)});var ee=class extends C{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===x.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{g(r,i),i.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const i=n.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(async s=>{if(t.value==="aborted")return k;const o=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return o.status==="aborted"?k:o.status==="dirty"||t.value==="dirty"?ye(o.value):o});{if(t.value==="aborted")return k;const s=this._def.schema._parseSync({data:i,path:r.path,parent:r});return s.status==="aborted"?k:s.status==="dirty"||t.value==="dirty"?ye(s.value):s}}if(n.type==="refinement"){const i=s=>{const o=n.refinement(s,a);if(r.common.async)return Promise.resolve(o);if(o instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?k:(s.status==="dirty"&&t.dirty(),i(s.value),{status:t.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?k:(s.status==="dirty"&&t.dirty(),i(s.value).then(()=>({status:t.value,value:s.value}))))}if(n.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ge(i))return k;const s=n.transform(i.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>ge(i)?Promise.resolve(n.transform(i.value,a)).then(s=>({status:t.value,value:s})):k);I.assertNever(n)}};ee.create=(e,t,r)=>new ee({schema:e,typeName:x.ZodEffects,effect:t,...w(r)});ee.createWithPreprocess=(e,t,r)=>new ee({schema:t,effect:{type:"preprocess",transform:e},typeName:x.ZodEffects,...w(r)});var q=class extends C{_parse(e){return this._getType(e)===v.undefined?V(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};q.create=(e,t)=>new q({innerType:e,typeName:x.ZodOptional,...w(t)});var ce=class extends C{_parse(e){return this._getType(e)===v.null?V(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ce.create=(e,t)=>new ce({innerType:e,typeName:x.ZodNullable,...w(t)});var De=class extends C{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===v.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};De.create=(e,t)=>new De({innerType:e,typeName:x.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...w(t)});var Ue=class extends C{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Re(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new G(r.common.issues)},input:r.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new G(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Ue.create=(e,t)=>new Ue({innerType:e,typeName:x.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...w(t)});var gt=class extends C{_parse(e){if(this._getType(e)!==v.nan){const t=this._getOrReturnCtx(e);return g(t,{code:f.invalid_type,expected:v.nan,received:t.parsedType}),k}return{status:"valid",value:e.data}}};gt.create=e=>new gt({typeName:x.ZodNaN,...w(e)});var ir=class extends C{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},sr=class or extends C{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?k:i.status==="dirty"?(r.dirty(),ye(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?k:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(t,r){return new or({in:t,out:r,typeName:x.ZodPipeline})}},$e=class extends C{_parse(e){const t=this._def.innerType._parse(e),r=n=>(ge(n)&&(n.value=Object.freeze(n.value)),n);return Re(t)?t.then(n=>r(n)):r(t)}unwrap(){return this._def.innerType}};$e.create=(e,t)=>new $e({innerType:e,typeName:x.ZodReadonly,...w(t)});var hs={object:$.lazycreate},x;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(x||(x={}));var R=Ee.create,fs=tt.create,ms=gt.create,ps=nt.create,xn=it.create,gs=st.create,vs=ot.create,ys=Me.create,bs=Oe.create,ks=ct.create,_n=me.create,xs=ae.create,_s=dt.create,ws=ve.create,cr=$.create,Ss=$.strictCreate,js=Ve.create,Cs=yn.create,Is=Pe.create,Ts=oe.create,wn=bn.create,Ns=ht.create,Ls=ft.create,As=kn.create,Zs=Fe.create,Rs=We.create,dr=Ge.create,Es=ze.create,Ms=_e.create,Os=ee.create,Vs=q.create,Ps=ce.create,Fs=ee.createWithPreprocess,Ws=sr.create,Sn=cr({mode:dr(["light","dark","system"]).optional(),accentColor:R().optional(),fontFamily:R().optional(),borderRadius:R().optional()}),lr=cr({agentId:R().min(1,"agentId is required"),apiBaseUrl:R().url("apiBaseUrl must be a valid URL"),tenantId:R().optional(),userId:R().optional(),name:R().optional(),email:R().optional(),authUserId:R().optional(),sessionId:R().optional(),mode:dr(["floating","inline"]).optional(),title:R().optional(),subtitle:R().optional(),greeting:R().optional(),avatarUrl:R().optional(),privacyPolicyUrl:R().optional(),streaming:xn().optional(),metadata:wn(_n()).optional(),theme:Sn.optional()}),jn=lr.omit({agentId:!0,apiBaseUrl:!0}).partial(),se={mode:"floating",streaming:!0,title:"AI Assistant",theme:{mode:"light",accentColor:"#6366f1",fontFamily:"system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",borderRadius:"12px"}};function Ye(e,t){lr.parse(e);let r;const n=t?{...t}:void 0;n&&typeof n.theme=="object"&&n.theme!==null?(r=n.theme,delete n.theme):n&&typeof n.theme=="string"&&(r={mode:n.theme},delete n.theme);const a=n?jn.passthrough().safeParse(n).data:void 0,i=a?ur(a,e):e,s={mode:i.theme?.mode??r?.mode??se.theme.mode,accentColor:i.theme?.accentColor??r?.accentColor??se.theme.accentColor,fontFamily:i.theme?.fontFamily??r?.fontFamily??se.theme.fontFamily,borderRadius:i.theme?.borderRadius??r?.borderRadius??se.theme.borderRadius};return{agentId:i.agentId,apiBaseUrl:i.apiBaseUrl.replace(/\/$/,""),tenantId:i.tenantId,userId:i.userId,name:i.name,email:i.email,authUserId:i.authUserId,sessionId:i.sessionId,mode:i.mode??se.mode,title:i.title??se.title,subtitle:i.subtitle,greeting:i.greeting,avatarUrl:i.avatarUrl,privacyPolicyUrl:i.privacyPolicyUrl,streaming:i.streaming??se.streaming,metadata:i.metadata??{},theme:s,thinkingEnabled:a?.thinkingEnabled===!0,thinkingViewable:a?.thinkingViewable===!0}}function ur(e,t){const r={...e};for(const n of Object.keys(t)){const a=t[n];a!=null&&(typeof a=="object"&&!Array.isArray(a)&&r[n]!==null&&typeof r[n]=="object"?r[n]=ur(r[n],a):r[n]=a)}return r}var vt=function(){return vt=Object.assign||function(t){for(var r,n=1,a=arguments.length;n<a;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},vt.apply(this,arguments)};function H(e,t,r,n){function a(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function o(u){try{d(n.next(u))}catch(h){s(h)}}function c(u){try{d(n.throw(u))}catch(h){s(h)}}function d(u){u.done?i(u.value):a(u.value).then(o,c)}d((n=n.apply(e,t||[])).next())})}function X(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,a,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=o(0),s.throw=o(1),s.return=o(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(d){return function(u){return c([d,u])}}function c(d){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,d[0]&&(r=0)),r;)try{if(n=1,a&&(i=d[0]&2?a.return:d[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,d[1])).done)return i;switch(a=0,i&&(d=[d[0]&2,i.value]),d[0]){case 0:case 1:i=d;break;case 4:return r.label++,{value:d[1],done:!1};case 5:r.label++,a=d[1],d=[0];continue;case 7:d=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(d[0]===6||d[0]===2)){r=0;continue}if(d[0]===3&&(!i||d[1]>i[0]&&d[1]<i[3])){r.label=d[1];break}if(d[0]===6&&r.label<i[1]){r.label=i[1],i=d;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(d);break}i[2]&&r.ops.pop(),r.trys.pop();continue}d=t.call(e,r)}catch(u){d=[6,u],a=0}finally{n=i=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function hr(e,t,r){if(r||arguments.length===2)for(var n=0,a=t.length,i;n<a;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}var fr="4.6.2";function Be(e,t){return new Promise(function(r){return setTimeout(r,e,t)})}function Cn(){return new Promise(function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})}function In(e,t){t===void 0&&(t=1/0);var r=window.requestIdleCallback;return r?new Promise(function(n){return r.call(window,function(){return n()},{timeout:t})}):Be(Math.min(e,t))}function mr(e){return!!e&&typeof e.then=="function"}function Vt(e,t){try{var r=e();mr(r)?r.then(function(n){return t(!0,n)},function(n){return t(!1,n)}):t(!0,r)}catch(n){t(!1,n)}}function Pt(e,t,r){return r===void 0&&(r=16),H(this,void 0,void 0,function(){var n,a,i,s;return X(this,function(o){switch(o.label){case 0:n=Array(e.length),a=Date.now(),i=0,o.label=1;case 1:return i<e.length?(n[i]=t(e[i],i),s=Date.now(),s>=a+r?(a=s,[4,Cn()]):[3,3]):[3,4];case 2:o.sent(),o.label=3;case 3:return++i,[3,1];case 4:return[2,n]}})})}function we(e){return e.then(void 0,function(){}),e}function Tn(e,t){for(var r=0,n=e.length;r<n;++r)if(e[r]===t)return!0;return!1}function Nn(e,t){return!Tn(e,t)}function St(e){return parseInt(e)}function U(e){return parseFloat(e)}function K(e,t){return typeof e=="number"&&isNaN(e)?t:e}function M(e){return e.reduce(function(t,r){return t+(r?1:0)},0)}function pr(e,t){if(t===void 0&&(t=1),Math.abs(t)>=1)return Math.round(e/t)*t;var r=1/t;return Math.round(e*r)/r}function Ln(e){for(var t,r,n="Unexpected syntax '".concat(e,"'"),a=/^\s*([a-z-]*)(.*)$/i.exec(e),i=a[1]||void 0,s={},o=/([.:#][\w-]+|\[.+?\])/gi,c=function(m,p){s[m]=s[m]||[],s[m].push(p)};;){var d=o.exec(a[2]);if(!d)break;var u=d[0];switch(u[0]){case".":c("class",u.slice(1));break;case"#":c("id",u.slice(1));break;case"[":var h=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(u);if(h)c(h[1],(r=(t=h[4])!==null&&t!==void 0?t:h[5])!==null&&r!==void 0?r:"");else throw new Error(n);break;default:throw new Error(n)}}return[i,s]}function An(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;r++){var n=e.charCodeAt(r);if(n>127)return new TextEncoder().encode(e);t[r]=n}return t}function re(e,t){var r=e[0]>>>16,n=e[0]&65535,a=e[1]>>>16,i=e[1]&65535,s=t[0]>>>16,o=t[0]&65535,c=t[1]>>>16,d=t[1]&65535,u=0,h=0,m=0,p=0;p+=i+d,m+=p>>>16,p&=65535,m+=a+c,h+=m>>>16,m&=65535,h+=n+o,u+=h>>>16,h&=65535,u+=r+s,u&=65535,e[0]=u<<16|h,e[1]=m<<16|p}function W(e,t){var r=e[0]>>>16,n=e[0]&65535,a=e[1]>>>16,i=e[1]&65535,s=t[0]>>>16,o=t[0]&65535,c=t[1]>>>16,d=t[1]&65535,u=0,h=0,m=0,p=0;p+=i*d,m+=p>>>16,p&=65535,m+=a*d,h+=m>>>16,m&=65535,m+=i*c,h+=m>>>16,m&=65535,h+=n*d,u+=h>>>16,h&=65535,h+=a*c,u+=h>>>16,h&=65535,h+=i*o,u+=h>>>16,h&=65535,u+=r*d+n*c+a*o+i*s,u&=65535,e[0]=u<<16|h,e[1]=m<<16|p}function le(e,t){var r=e[0];t%=64,t===32?(e[0]=e[1],e[1]=r):t<32?(e[0]=r<<t|e[1]>>>32-t,e[1]=e[1]<<t|r>>>32-t):(t-=32,e[0]=e[1]<<t|r>>>32-t,e[1]=r<<t|e[1]>>>32-t)}function P(e,t){t%=64,t!==0&&(t<32?(e[0]=e[1]>>>32-t,e[1]=e[1]<<t):(e[0]=e[1]<<t-32,e[1]=0))}function A(e,t){e[0]^=t[0],e[1]^=t[1]}var Zn=[4283543511,3981806797],Rn=[3301882366,444984403];function Ft(e){var t=[0,e[0]>>>1];A(e,t),W(e,Zn),t[1]=e[0]>>>1,A(e,t),W(e,Rn),t[1]=e[0]>>>1,A(e,t)}var Ie=[2277735313,289559509],Te=[1291169091,658871167],Wt=[0,5],En=[0,1390208809],Mn=[0,944331445];function On(e,t){var r=An(e);t=t||0;var n=[0,r.length],a=n[1]%16,i=n[1]-a,s=[0,t],o=[0,t],c=[0,0],d=[0,0],u;for(u=0;u<i;u=u+16)c[0]=r[u+4]|r[u+5]<<8|r[u+6]<<16|r[u+7]<<24,c[1]=r[u]|r[u+1]<<8|r[u+2]<<16|r[u+3]<<24,d[0]=r[u+12]|r[u+13]<<8|r[u+14]<<16|r[u+15]<<24,d[1]=r[u+8]|r[u+9]<<8|r[u+10]<<16|r[u+11]<<24,W(c,Ie),le(c,31),W(c,Te),A(s,c),le(s,27),re(s,o),W(s,Wt),re(s,En),W(d,Te),le(d,33),W(d,Ie),A(o,d),le(o,31),re(o,s),W(o,Wt),re(o,Mn);c[0]=0,c[1]=0,d[0]=0,d[1]=0;var h=[0,0];switch(a){case 15:h[1]=r[u+14],P(h,48),A(d,h);case 14:h[1]=r[u+13],P(h,40),A(d,h);case 13:h[1]=r[u+12],P(h,32),A(d,h);case 12:h[1]=r[u+11],P(h,24),A(d,h);case 11:h[1]=r[u+10],P(h,16),A(d,h);case 10:h[1]=r[u+9],P(h,8),A(d,h);case 9:h[1]=r[u+8],A(d,h),W(d,Te),le(d,33),W(d,Ie),A(o,d);case 8:h[1]=r[u+7],P(h,56),A(c,h);case 7:h[1]=r[u+6],P(h,48),A(c,h);case 6:h[1]=r[u+5],P(h,40),A(c,h);case 5:h[1]=r[u+4],P(h,32),A(c,h);case 4:h[1]=r[u+3],P(h,24),A(c,h);case 3:h[1]=r[u+2],P(h,16),A(c,h);case 2:h[1]=r[u+1],P(h,8),A(c,h);case 1:h[1]=r[u],A(c,h),W(c,Ie),le(c,31),W(c,Te),A(s,c)}return A(s,n),A(o,n),re(s,o),re(o,s),Ft(s),Ft(o),re(s,o),re(o,s),("00000000"+(s[0]>>>0).toString(16)).slice(-8)+("00000000"+(s[1]>>>0).toString(16)).slice(-8)+("00000000"+(o[0]>>>0).toString(16)).slice(-8)+("00000000"+(o[1]>>>0).toString(16)).slice(-8)}function Vn(e){var t;return vt({name:e.name,message:e.message,stack:(t=e.stack)===null||t===void 0?void 0:t.split(`
|
|
2
|
-
`)},e)}function Pn(e){return/^function\s.*?\{\s*\[native code]\s*}$/.test(String(e))}function Fn(e){return typeof e!="function"}function Wn(e,t){var r=we(new Promise(function(n){var a=Date.now();Vt(e.bind(null,t),function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var o=Date.now()-a;if(!i[0])return n(function(){return{error:i[1],duration:o}});var c=i[1];if(Fn(c))return n(function(){return{value:c,duration:o}});n(function(){return new Promise(function(d){var u=Date.now();Vt(c,function(){for(var h=[],m=0;m<arguments.length;m++)h[m]=arguments[m];var p=o+Date.now()-u;if(!h[0])return d({error:h[1],duration:p});d({value:h[1],duration:p})})})})})}));return function(){return r.then(function(a){return a()})}}function zn(e,t,r,n){var a=Object.keys(e).filter(function(s){return Nn(r,s)}),i=we(Pt(a,function(s){return Wn(e[s],t)},n));return function(){return H(this,void 0,void 0,function(){var o,c,d,u,h;return X(this,function(m){switch(m.label){case 0:return[4,i];case 1:return o=m.sent(),[4,Pt(o,function(p){return we(p())},n)];case 2:return c=m.sent(),[4,Promise.all(c)];case 3:for(d=m.sent(),u={},h=0;h<a.length;++h)u[a[h]]=d[h];return[2,u]}})})}}function gr(){var e=window,t=navigator;return M(["MSCSSMatrix"in e,"msSetImmediate"in e,"msIndexedDB"in e,"msMaxTouchPoints"in t,"msPointerEnabled"in t])>=4}function Dn(){var e=window,t=navigator;return M(["msWriteProfilerMark"in e,"MSStream"in e,"msLaunchUri"in t,"msSaveBlob"in t])>=3&&!gr()}function Se(){var e=window,t=navigator;return M(["webkitPersistentStorage"in t,"webkitTemporaryStorage"in t,(t.vendor||"").indexOf("Google")===0,"webkitResolveLocalFileSystemURL"in e,"BatteryManager"in e,"webkitMediaStream"in e,"webkitSpeechGrammar"in e])>=5}function B(){var e=window,t=navigator;return M(["ApplePayError"in e,"CSSPrimitiveValue"in e,"Counter"in e,t.vendor.indexOf("Apple")===0,"RGBColor"in e,"WebKitMediaKeys"in e])>=4}function jt(){var e=window,t=e.HTMLElement,r=e.Document;return M(["safari"in e,!("ongestureend"in e),!("TouchEvent"in e),!("orientation"in e),t&&!("autocapitalize"in t.prototype),r&&"pointerLockElement"in r.prototype])>=4}function je(){var e=window;return Pn(e.print)&&String(e.browser)==="[object WebPageNamespace]"}function vr(){var e,t,r=window;return M(["buildID"in navigator,"MozAppearance"in((t=(e=document.documentElement)===null||e===void 0?void 0:e.style)!==null&&t!==void 0?t:{}),"onmozfullscreenchange"in r,"mozInnerScreenX"in r,"CSSMozDocumentRule"in r,"CanvasCaptureMediaStream"in r])>=4}function Un(){var e=window;return M([!("MediaSettingsRange"in e),"RTCEncodedAudioFrame"in e,""+e.Intl=="[object Intl]",""+e.Reflect=="[object Reflect]"])>=3}function $n(){var e=window,t=e.URLPattern;return M(["union"in Set.prototype,"Iterator"in e,t&&"hasRegExpGroups"in t.prototype,"RGB8"in WebGLRenderingContext.prototype])>=3}function Bn(){var e=window;return M(["DOMRectList"in e,"RTCPeerConnectionIceEvent"in e,"SVGGeometryElement"in e,"ontransitioncancel"in e])>=3}function Ce(){var e=window,t=navigator,r=e.CSS,n=e.HTMLButtonElement;return M([!("getStorageUpdates"in t),n&&"popover"in n.prototype,"CSSCounterStyleRule"in e,r.supports("font-size-adjust: ex-height 0.5"),r.supports("text-transform: full-width")])>=4}function Gn(){if(navigator.platform==="iPad")return!0;var e=screen,t=e.width/e.height;return M(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,t>.65&&t<1.53])>=2}function Yn(){var e=document;return e.fullscreenElement||e.msFullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement||null}function Hn(){var e=document;return(e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen).call(e)}function Ct(){var e=Se(),t=vr(),r=window,n=navigator,a="connection";return e?M([!("SharedWorker"in r),n[a]&&"ontypechange"in n[a],!("sinkId"in new Audio)])>=2:t?M(["onorientationchange"in r,"orientation"in r,/android/i.test(n.appVersion)])>=2:!1}function Xn(){var e=navigator,t=window,r=Audio.prototype,n=t.visualViewport;return M(["srLatency"in r,"srChannelCount"in r,"devicePosture"in e,n&&"segments"in n,"getTextInformation"in Image.prototype])>=3}function Jn(){return qn()?-4:Qn()}function Qn(){var e=window,t=e.OfflineAudioContext||e.webkitOfflineAudioContext;if(!t)return-2;if(Kn())return-1;var r=4500,n=new t(1,5e3,44100),a=n.createOscillator();a.type="triangle",a.frequency.value=1e4;var i=n.createDynamicsCompressor();i.threshold.value=-50,i.knee.value=40,i.ratio.value=12,i.attack.value=0,i.release.value=.25,a.connect(i),i.connect(n.destination),a.start(0);var s=ea(n),o=s[0],c=s[1],d=we(o.then(function(u){return ta(u.getChannelData(0).subarray(r))},function(u){if(u.name==="timeout"||u.name==="suspended")return-3;throw u}));return function(){return c(),d}}function Kn(){return B()&&!jt()&&!Bn()}function qn(){return B()&&Ce()&&je()||Se()&&Xn()&&$n()}function ea(e){var t=3,r=500,n=500,a=5e3,i=function(){};return[new Promise(function(s,o){var c=!1,d=0,u=0;e.oncomplete=function(p){return s(p.renderedBuffer)};var h=function(){setTimeout(function(){return o(zt("timeout"))},Math.min(n,u+a-Date.now()))},m=function(){try{var p=e.startRendering();switch(mr(p)&&we(p),e.state){case"running":u=Date.now(),c&&h();break;case"suspended":document.hidden||d++,c&&d>=t?o(zt("suspended")):setTimeout(m,r);break}}catch(j){o(j)}};m(),i=function(){c||(c=!0,u>0&&h())}}),i]}function ta(e){for(var t=0,r=0;r<e.length;++r)t+=Math.abs(e[r]);return t}function zt(e){var t=new Error(e);return t.name=e,t}function yr(e,t,r){var n,a,i;return r===void 0&&(r=50),H(this,void 0,void 0,function(){var s,o;return X(this,function(c){switch(c.label){case 0:s=document,c.label=1;case 1:return s.body?[3,3]:[4,Be(r)];case 2:return c.sent(),[3,1];case 3:o=s.createElement("iframe"),c.label=4;case 4:return c.trys.push([4,,10,11]),[4,new Promise(function(d,u){var h=!1,m=function(){h=!0,d()},p=function(Z){h=!0,u(Z)};o.onload=m,o.onerror=p;var j=o.style;j.setProperty("display","block","important"),j.position="absolute",j.top="0",j.left="0",j.visibility="hidden",t&&"srcdoc"in o?o.srcdoc=t:o.src="about:blank",s.body.appendChild(o);var b=function(){var Z,S;h||(((S=(Z=o.contentWindow)===null||Z===void 0?void 0:Z.document)===null||S===void 0?void 0:S.readyState)==="complete"?m():setTimeout(b,10))};b()})];case 5:c.sent(),c.label=6;case 6:return!((a=(n=o.contentWindow)===null||n===void 0?void 0:n.document)===null||a===void 0)&&a.body?[3,8]:[4,Be(r)];case 7:return c.sent(),[3,6];case 8:return[4,e(o,o.contentWindow)];case 9:return[2,c.sent()];case 10:return(i=o.parentNode)===null||i===void 0||i.removeChild(o),[7];case 11:return[2]}})})}function ra(e){for(var t=Ln(e),r=t[0],n=t[1],a=document.createElement(r??"div"),i=0,s=Object.keys(n);i<s.length;i++){var o=s[i],c=n[o].join(" ");o==="style"?na(a.style,c):a.setAttribute(o,c)}return a}function na(e,t){for(var r=0,n=t.split(";");r<n.length;r++){var a=n[r],i=/^\s*([\w-]+)\s*:\s*(.+?)(\s*!([\w-]+))?\s*$/.exec(a);if(i){var s=i[1],o=i[2],c=i[4];e.setProperty(s,o,c||"")}}}function aa(){for(var e=window;;){var t=e.parent;if(!t||t===e)return!1;try{if(t.location.origin!==e.location.origin)return!0}catch(r){if(r instanceof Error&&r.name==="SecurityError")return!0;throw r}e=t}}var ia="mmMwWLliI0O&1",sa="48px",ue=["monospace","sans-serif","serif"],Dt=["sans-serif-thin","ARNO PRO","Agency FB","Arabic Typesetting","Arial Unicode MS","AvantGarde Bk BT","BankGothic Md BT","Batang","Bitstream Vera Sans Mono","Calibri","Century","Century Gothic","Clarendon","EUROSTILE","Franklin Gothic","Futura Bk BT","Futura Md BT","GOTHAM","Gill Sans","HELV","Haettenschweiler","Helvetica Neue","Humanst521 BT","Leelawadee","Letter Gothic","Levenim MT","Lucida Bright","Lucida Sans","Menlo","MS Mincho","MS Outlook","MS Reference Specialty","MS UI Gothic","MT Extra","MYRIAD PRO","Marlett","Meiryo UI","Microsoft Uighur","Minion Pro","Monotype Corsiva","PMingLiU","Pristina","SCRIPTINA","Segoe UI Light","Serifa","SimHei","Small Fonts","Staccato222 BT","TRAJAN PRO","Univers CE 55 Medium","Vrinda","ZWAdobeF"];function oa(){var e=this;return yr(function(t,r){var n=r.document;return H(e,void 0,void 0,function(){var a,i,s,o,c,d,u,h,m,p,j,b;return X(this,function(Z){for(a=n.body,a.style.fontSize=sa,i=n.createElement("div"),i.style.setProperty("visibility","hidden","important"),s={},o={},c=function(S){var _=n.createElement("span"),L=_.style;return L.position="absolute",L.top="0",L.left="0",L.fontFamily=S,_.textContent=ia,i.appendChild(_),_},d=function(S,_){return c("'".concat(S,"',").concat(_))},u=function(){return ue.map(c)},h=function(){for(var S={},_=function(te){S[te]=ue.map(function(de){return d(te,de)})},L=0,J=Dt;L<J.length;L++){var ie=J[L];_(ie)}return S},m=function(S){return ue.some(function(_,L){return S[L].offsetWidth!==s[_]||S[L].offsetHeight!==o[_]})},p=u(),j=h(),a.appendChild(i),b=0;b<ue.length;b++)s[ue[b]]=p[b].offsetWidth,o[ue[b]]=p[b].offsetHeight;return[2,Dt.filter(function(S){return m(j[S])})]})})})}function ca(){var e=navigator.plugins;if(e){for(var t=[],r=0;r<e.length;++r){var n=e[r];if(n){for(var a=[],i=0;i<n.length;++i){var s=n[i];a.push({type:s.type,suffixes:s.suffixes})}t.push({name:n.name,description:n.description,mimeTypes:a})}}return t}}function da(){return la(va())}function la(e){var t,r=!1,n,a,i=ua(),s=i[0],o=i[1];return ha(s,o)?(r=fa(o),e?n=a="skipped":(t=ma(s,o),n=t[0],a=t[1])):n=a="unsupported",{winding:r,geometry:n,text:a}}function ua(){var e=document.createElement("canvas");return e.width=1,e.height=1,[e,e.getContext("2d")]}function ha(e,t){return!!(t&&e.toDataURL)}function fa(e){return e.rect(0,0,10,10),e.rect(2,2,6,6),!e.isPointInPath(5,5,"evenodd")}function ma(e,t){pa(e,t);var r=Je(e);return r!==Je(e)?["unstable","unstable"]:(ga(e,t),[Je(e),r])}function pa(e,t){e.width=240,e.height=60,t.textBaseline="alphabetic",t.fillStyle="#f60",t.fillRect(100,1,62,20),t.fillStyle="#069",t.font='11pt "Times New Roman"';var r="Cwm fjordbank gly ".concat("😃");t.fillText(r,2,15),t.fillStyle="rgba(102, 204, 0, 0.2)",t.font="18pt Arial",t.fillText(r,4,45)}function ga(e,t){e.width=122,e.height=110,t.globalCompositeOperation="multiply";for(var r=0,n=[["#f2f",40,40],["#2ff",80,40],["#ff2",60,80]];r<n.length;r++){var a=n[r],i=a[0],s=a[1],o=a[2];t.fillStyle=i,t.beginPath(),t.arc(s,o,40,0,Math.PI*2,!0),t.closePath(),t.fill()}t.fillStyle="#f9c",t.arc(60,60,60,0,Math.PI*2,!0),t.arc(60,60,20,0,Math.PI*2,!0),t.fill("evenodd")}function Je(e){return e.toDataURL()}function va(){return B()&&Ce()&&je()}function ya(){var e=navigator,t=0,r;e.maxTouchPoints!==void 0?t=St(e.maxTouchPoints):e.msMaxTouchPoints!==void 0&&(t=e.msMaxTouchPoints);try{document.createEvent("TouchEvent"),r=!0}catch{r=!1}var n="ontouchstart"in window;return{maxTouchPoints:t,touchEvent:r,touchStart:n}}function ba(){return navigator.oscpu}function ka(){var e=navigator,t=[],r=e.language||e.userLanguage||e.browserLanguage||e.systemLanguage;if(r!==void 0&&t.push([r]),Array.isArray(e.languages))Se()&&Un()||t.push(e.languages);else if(typeof e.languages=="string"){var n=e.languages;n&&t.push(n.split(","))}return t}function xa(){return window.screen.colorDepth}function _a(){return K(U(navigator.deviceMemory),void 0)}function wa(){if(!(B()&&Ce()&&je()))return Sa()}function Sa(){var e=screen,t=function(n){return K(St(n),null)},r=[t(e.width),t(e.height)];return r.sort().reverse(),r}var ja=2500,Ca=10,Ae,Qe;function Ia(){if(Qe===void 0){var e=function(){var t=yt();bt(t)?Qe=setTimeout(e,ja):(Ae=t,Qe=void 0)};e()}}function Ta(){var e=this;return Ia(),function(){return H(e,void 0,void 0,function(){var t;return X(this,function(r){switch(r.label){case 0:return t=yt(),bt(t)?Ae?[2,hr([],Ae,!0)]:Yn()?[4,Hn()]:[3,2]:[3,2];case 1:r.sent(),t=yt(),r.label=2;case 2:return bt(t)||(Ae=t),[2,t]}})})}}function Na(){var e=this;if(B()&&Ce()&&je())return function(){return Promise.resolve(void 0)};var t=Ta();return function(){return H(e,void 0,void 0,function(){var r,n;return X(this,function(a){switch(a.label){case 0:return[4,t()];case 1:return r=a.sent(),n=function(i){return i===null?null:pr(i,Ca)},[2,[n(r[0]),n(r[1]),n(r[2]),n(r[3])]]}})})}}function yt(){var e=screen;return[K(U(e.availTop),null),K(U(e.width)-U(e.availWidth)-K(U(e.availLeft),0),null),K(U(e.height)-U(e.availHeight)-K(U(e.availTop),0),null),K(U(e.availLeft),null)]}function bt(e){for(var t=0;t<4;++t)if(e[t])return!1;return!0}function La(){return K(St(navigator.hardwareConcurrency),void 0)}function Aa(){var e,t=(e=window.Intl)===null||e===void 0?void 0:e.DateTimeFormat;if(t){var r=new t().resolvedOptions().timeZone;if(r)return r}var n=-Za();return"UTC".concat(n>=0?"+":"").concat(n)}function Za(){var e=new Date().getFullYear();return Math.max(U(new Date(e,0,1).getTimezoneOffset()),U(new Date(e,6,1).getTimezoneOffset()))}function Ra(){try{return!!window.sessionStorage}catch{return!0}}function Ea(){try{return!!window.localStorage}catch{return!0}}function Ma(){if(!(gr()||Dn()))try{return!!window.indexedDB}catch{return!0}}function Oa(){return!!window.openDatabase}function Va(){return navigator.cpuClass}function Pa(){var e=navigator.platform;return e==="MacIntel"&&B()&&!jt()?Gn()?"iPad":"iPhone":e}function Fa(){return navigator.vendor||""}function Wa(){for(var e=[],t=0,r=["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"];t<r.length;t++){var n=r[t],a=window[n];a&&typeof a=="object"&&e.push(n)}return e.sort()}function za(){var e=document;try{e.cookie="cookietest=1; SameSite=Strict;";var t=e.cookie.indexOf("cookietest=")!==-1;return e.cookie="cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT",t}catch{return!1}}function Da(){var e=atob;return{abpIndo:["#Iklan-Melayang","#Kolom-Iklan-728","#SidebarIklan-wrapper",'[title="ALIENBOLA" i]',e("I0JveC1CYW5uZXItYWRz")],abpvn:[".quangcao","#mobileCatfish",e("LmNsb3NlLWFkcw=="),'[id^="bn_bottom_fixed_"]',"#pmadv"],adBlockFinland:[".mainostila",e("LnNwb25zb3JpdA=="),".ylamainos",e("YVtocmVmKj0iL2NsaWNrdGhyZ2guYXNwPyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hcHAucmVhZHBlYWsuY29tL2FkcyJd")],adBlockPersian:["#navbar_notice_50",".kadr",'TABLE[width="140px"]',"#divAgahi",e("YVtocmVmXj0iaHR0cDovL2cxLnYuZndtcm0ubmV0L2FkLyJd")],adBlockWarningRemoval:["#adblock-honeypot",".adblocker-root",".wp_adblock_detect",e("LmhlYWRlci1ibG9ja2VkLWFk"),e("I2FkX2Jsb2NrZXI=")],adGuardAnnoyances:[".hs-sosyal","#cookieconsentdiv",'div[class^="app_gdpr"]',".as-oil",'[data-cypress="soft-push-notification-modal"]'],adGuardBase:[".BetterJsPopOverlay",e("I2FkXzMwMFgyNTA="),e("I2Jhbm5lcmZsb2F0MjI="),e("I2NhbXBhaWduLWJhbm5lcg=="),e("I0FkLUNvbnRlbnQ=")],adGuardChinese:[e("LlppX2FkX2FfSA=="),e("YVtocmVmKj0iLmh0aGJldDM0LmNvbSJd"),"#widget-quan",e("YVtocmVmKj0iLzg0OTkyMDIwLnh5eiJd"),e("YVtocmVmKj0iLjE5NTZobC5jb20vIl0=")],adGuardFrench:["#pavePub",e("LmFkLWRlc2t0b3AtcmVjdGFuZ2xl"),".mobile_adhesion",".widgetadv",e("LmFkc19iYW4=")],adGuardGerman:['aside[data-portal-id="leaderboard"]'],adGuardJapanese:["#kauli_yad_1",e("YVtocmVmXj0iaHR0cDovL2FkMi50cmFmZmljZ2F0ZS5uZXQvIl0="),e("Ll9wb3BJbl9pbmZpbml0ZV9hZA=="),e("LmFkZ29vZ2xl"),e("Ll9faXNib29zdFJldHVybkFk")],adGuardMobile:[e("YW1wLWF1dG8tYWRz"),e("LmFtcF9hZA=="),'amp-embed[type="24smi"]',"#mgid_iframe1",e("I2FkX2ludmlld19hcmVh")],adGuardRussian:[e("YVtocmVmXj0iaHR0cHM6Ly9hZC5sZXRtZWFkcy5jb20vIl0="),e("LnJlY2xhbWE="),'div[id^="smi2adblock"]',e("ZGl2W2lkXj0iQWRGb3hfYmFubmVyXyJd"),"#psyduckpockeball"],adGuardSocial:[e("YVtocmVmXj0iLy93d3cuc3R1bWJsZXVwb24uY29tL3N1Ym1pdD91cmw9Il0="),e("YVtocmVmXj0iLy90ZWxlZ3JhbS5tZS9zaGFyZS91cmw/Il0="),".etsy-tweet","#inlineShare",".popup-social"],adGuardSpanishPortuguese:["#barraPublicidade","#Publicidade","#publiEspecial","#queTooltip",".cnt-publi"],adGuardTrackingProtection:["#qoo-counter",e("YVtocmVmXj0iaHR0cDovL2NsaWNrLmhvdGxvZy5ydS8iXQ=="),e("YVtocmVmXj0iaHR0cDovL2hpdGNvdW50ZXIucnUvdG9wL3N0YXQucGhwIl0="),e("YVtocmVmXj0iaHR0cDovL3RvcC5tYWlsLnJ1L2p1bXAiXQ=="),"#top100counter"],adGuardTurkish:["#backkapat",e("I3Jla2xhbWk="),e("YVtocmVmXj0iaHR0cDovL2Fkc2Vydi5vbnRlay5jb20udHIvIl0="),e("YVtocmVmXj0iaHR0cDovL2l6bGVuemkuY29tL2NhbXBhaWduLyJd"),e("YVtocmVmXj0iaHR0cDovL3d3dy5pbnN0YWxsYWRzLm5ldC8iXQ==")],bulgarian:[e("dGQjZnJlZW5ldF90YWJsZV9hZHM="),"#ea_intext_div",".lapni-pop-over","#xenium_hot_offers"],easyList:[".yb-floorad",e("LndpZGdldF9wb19hZHNfd2lkZ2V0"),e("LnRyYWZmaWNqdW5reS1hZA=="),".textad_headline",e("LnNwb25zb3JlZC10ZXh0LWxpbmtz")],easyListChina:[e("LmFwcGd1aWRlLXdyYXBbb25jbGljayo9ImJjZWJvcy5jb20iXQ=="),e("LmZyb250cGFnZUFkdk0="),"#taotaole","#aafoot.top_box",".cfa_popup"],easyListCookie:[".ezmob-footer",".cc-CookieWarning","[data-cookie-number]",e("LmF3LWNvb2tpZS1iYW5uZXI="),".sygnal24-gdpr-modal-wrap"],easyListCzechSlovak:["#onlajny-stickers",e("I3Jla2xhbW5pLWJveA=="),e("LnJla2xhbWEtbWVnYWJvYXJk"),".sklik",e("W2lkXj0ic2tsaWtSZWtsYW1hIl0=")],easyListDutch:[e("I2FkdmVydGVudGll"),e("I3ZpcEFkbWFya3RCYW5uZXJCbG9jaw=="),".adstekst",e("YVtocmVmXj0iaHR0cHM6Ly94bHR1YmUubmwvY2xpY2svIl0="),"#semilo-lrectangle"],easyListGermany:["#SSpotIMPopSlider",e("LnNwb25zb3JsaW5rZ3J1ZW4="),e("I3dlcmJ1bmdza3k="),e("I3Jla2xhbWUtcmVjaHRzLW1pdHRl"),e("YVtocmVmXj0iaHR0cHM6Ly9iZDc0Mi5jb20vIl0=")],easyListItaly:[e("LmJveF9hZHZfYW5udW5jaQ=="),".sb-box-pubbliredazionale",e("YVtocmVmXj0iaHR0cDovL2FmZmlsaWF6aW9uaWFkcy5zbmFpLml0LyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hZHNlcnZlci5odG1sLml0LyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hZmZpbGlhemlvbmlhZHMuc25haS5pdC8iXQ==")],easyListLithuania:[e("LnJla2xhbW9zX3RhcnBhcw=="),e("LnJla2xhbW9zX251b3JvZG9z"),e("aW1nW2FsdD0iUmVrbGFtaW5pcyBza3lkZWxpcyJd"),e("aW1nW2FsdD0iRGVkaWt1b3RpLmx0IHNlcnZlcmlhaSJd"),e("aW1nW2FsdD0iSG9zdGluZ2FzIFNlcnZlcmlhaS5sdCJd")],estonian:[e("QVtocmVmKj0iaHR0cDovL3BheTRyZXN1bHRzMjQuZXUiXQ==")],fanboyAnnoyances:["#ac-lre-player",".navigate-to-top","#subscribe_popup",".newsletter_holder","#back-top"],fanboyAntiFacebook:[".util-bar-module-firefly-visible"],fanboyEnhancedTrackers:[".open.pushModal","#issuem-leaky-paywall-articles-zero-remaining-nag","#sovrn_container",'div[class$="-hide"][zoompage-fontsize][style="display: block;"]',".BlockNag__Card"],fanboySocial:["#FollowUs","#meteored_share","#social_follow",".article-sharer",".community__social-desc"],frellwitSwedish:[e("YVtocmVmKj0iY2FzaW5vcHJvLnNlIl1bdGFyZ2V0PSJfYmxhbmsiXQ=="),e("YVtocmVmKj0iZG9rdG9yLXNlLm9uZWxpbmsubWUiXQ=="),"article.category-samarbete",e("ZGl2LmhvbGlkQWRz"),"ul.adsmodern"],greekAdBlock:[e("QVtocmVmKj0iYWRtYW4ub3RlbmV0LmdyL2NsaWNrPyJd"),e("QVtocmVmKj0iaHR0cDovL2F4aWFiYW5uZXJzLmV4b2R1cy5nci8iXQ=="),e("QVtocmVmKj0iaHR0cDovL2ludGVyYWN0aXZlLmZvcnRobmV0LmdyL2NsaWNrPyJd"),"DIV.agores300","TABLE.advright"],hungarian:["#cemp_doboz",".optimonk-iframe-container",e("LmFkX19tYWlu"),e("W2NsYXNzKj0iR29vZ2xlQWRzIl0="),"#hirdetesek_box"],iDontCareAboutCookies:['.alert-info[data-block-track*="CookieNotice"]',".ModuleTemplateCookieIndicator",".o--cookies--container","#cookies-policy-sticky","#stickyCookieBar"],icelandicAbp:[e("QVtocmVmXj0iL2ZyYW1ld29yay9yZXNvdXJjZXMvZm9ybXMvYWRzLmFzcHgiXQ==")],latvian:[e("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiAxMjBweDsgaGVpZ2h0OiA0MHB4OyBvdmVyZmxvdzogaGlkZGVuOyBwb3NpdGlvbjogcmVsYXRpdmU7Il0="),e("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiA4OHB4OyBoZWlnaHQ6IDMxcHg7IG92ZXJmbG93OiBoaWRkZW47IHBvc2l0aW9uOiByZWxhdGl2ZTsiXQ==")],listKr:[e("YVtocmVmKj0iLy9hZC5wbGFuYnBsdXMuY28ua3IvIl0="),e("I2xpdmVyZUFkV3JhcHBlcg=="),e("YVtocmVmKj0iLy9hZHYuaW1hZHJlcC5jby5rci8iXQ=="),e("aW5zLmZhc3R2aWV3LWFk"),".revenue_unit_item.dable"],listeAr:[e("LmdlbWluaUxCMUFk"),".right-and-left-sponsers",e("YVtocmVmKj0iLmFmbGFtLmluZm8iXQ=="),e("YVtocmVmKj0iYm9vcmFxLm9yZyJd"),e("YVtocmVmKj0iZHViaXp6bGUuY29tL2FyLz91dG1fc291cmNlPSJd")],listeFr:[e("YVtocmVmXj0iaHR0cDovL3Byb21vLnZhZG9yLmNvbS8iXQ=="),e("I2FkY29udGFpbmVyX3JlY2hlcmNoZQ=="),e("YVtocmVmKj0id2Vib3JhbWEuZnIvZmNnaS1iaW4vIl0="),".site-pub-interstitiel",'div[id^="crt-"][data-criteo-id]'],officialPolish:["#ceneo-placeholder-ceneo-12",e("W2hyZWZePSJodHRwczovL2FmZi5zZW5kaHViLnBsLyJd"),e("YVtocmVmXj0iaHR0cDovL2Fkdm1hbmFnZXIudGVjaGZ1bi5wbC9yZWRpcmVjdC8iXQ=="),e("YVtocmVmXj0iaHR0cDovL3d3dy50cml6ZXIucGwvP3V0bV9zb3VyY2UiXQ=="),e("ZGl2I3NrYXBpZWNfYWQ=")],ro:[e("YVtocmVmXj0iLy9hZmZ0cmsuYWx0ZXgucm8vQ291bnRlci9DbGljayJd"),e("YVtocmVmXj0iaHR0cHM6Ly9ibGFja2ZyaWRheXNhbGVzLnJvL3Ryay9zaG9wLyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9ldmVudC4ycGVyZm9ybWFudC5jb20vZXZlbnRzL2NsaWNrIl0="),e("YVtocmVmXj0iaHR0cHM6Ly9sLnByb2ZpdHNoYXJlLnJvLyJd"),'a[href^="/url/"]'],ruAd:[e("YVtocmVmKj0iLy9mZWJyYXJlLnJ1LyJd"),e("YVtocmVmKj0iLy91dGltZy5ydS8iXQ=="),e("YVtocmVmKj0iOi8vY2hpa2lkaWtpLnJ1Il0="),"#pgeldiz",".yandex-rtb-block"],thaiAds:["a[href*=macau-uta-popup]",e("I2Fkcy1nb29nbGUtbWlkZGxlX3JlY3RhbmdsZS1ncm91cA=="),e("LmFkczMwMHM="),".bumq",".img-kosana"],webAnnoyancesUltralist:["#mod-social-share-2","#social-tools",e("LmN0cGwtZnVsbGJhbm5lcg=="),".zergnet-recommend",".yt.btn-link.btn-md.btn"]}}function Ua(e){var t=(e===void 0?{}:e).debug;return H(this,void 0,void 0,function(){var r,n,a,i,s,o;return X(this,function(c){switch(c.label){case 0:return $a()?(r=Da(),n=Object.keys(r),a=(o=[]).concat.apply(o,n.map(function(d){return r[d]})),[4,Ba(a)]):[2,void 0];case 1:return i=c.sent(),t&&Ga(r,i),s=n.filter(function(d){var u=r[d];return M(u.map(function(h){return i[h]}))>u.length*.6}),s.sort(),[2,s]}})})}function $a(){return B()||Ct()}function Ba(e){var t;return H(this,void 0,void 0,function(){var r,n,a,i,c,s,o,c;return X(this,function(d){switch(d.label){case 0:for(r=document,n=r.createElement("div"),a=new Array(e.length),i={},Ut(n),c=0;c<e.length;++c)s=ra(e[c]),s.tagName==="DIALOG"&&s.show(),o=r.createElement("div"),Ut(o),o.appendChild(s),n.appendChild(o),a[c]=s;d.label=1;case 1:return r.body?[3,3]:[4,Be(50)];case 2:return d.sent(),[3,1];case 3:r.body.appendChild(n);try{for(c=0;c<e.length;++c)a[c].offsetParent||(i[e[c]]=!0)}finally{(t=n.parentNode)===null||t===void 0||t.removeChild(n)}return[2,i]}})})}function Ut(e){e.style.setProperty("visibility","hidden","important"),e.style.setProperty("display","block","important")}function Ga(e,t){for(var r="DOM blockers debug:\n```",n=0,a=Object.keys(e);n<a.length;n++){var i=a[n];r+=`
|
|
3
|
-
`.concat(i,":");for(var s=0,o=e[i];s<o.length;s++){var
|
|
4
|
-
`.concat(t[c]?"🚫":"➡️"," ").concat(c)}}}function Ya(){for(var e=0,t=["rec2020","p3","srgb"];e<t.length;e++){var r=t[e];if(matchMedia("(color-gamut: ".concat(r,")")).matches)return r}}function Ha(){if($t("inverted"))return!0;if($t("none"))return!1}function $t(e){return matchMedia("(inverted-colors: ".concat(e,")")).matches}function Xa(){if(Bt("active"))return!0;if(Bt("none"))return!1}function Bt(e){return matchMedia("(forced-colors: ".concat(e,")")).matches}var Ja=100;function Qa(){if(matchMedia("(min-monochrome: 0)").matches){for(var e=0;e<=Ja;++e)if(matchMedia("(max-monochrome: ".concat(e,")")).matches)return e;throw new Error("Too high value")}}function Ka(){if(he("no-preference"))return 0;if(he("high")||he("more"))return 1;if(he("low")||he("less"))return-1;if(he("forced"))return 10}function he(e){return matchMedia("(prefers-contrast: ".concat(e,")")).matches}function qa(){if(Gt("reduce"))return!0;if(Gt("no-preference"))return!1}function Gt(e){return matchMedia("(prefers-reduced-motion: ".concat(e,")")).matches}function ei(){if(Yt("reduce"))return!0;if(Yt("no-preference"))return!1}function Yt(e){return matchMedia("(prefers-reduced-transparency: ".concat(e,")")).matches}function ti(){if(Ht("high"))return!0;if(Ht("standard"))return!1}function Ht(e){return matchMedia("(dynamic-range: ".concat(e,")")).matches}var T=Math,E=function(){return 0};function ri(){var e=T.acos||E,t=T.acosh||E,r=T.asin||E,n=T.asinh||E,a=T.atanh||E,i=T.atan||E,s=T.sin||E,o=T.sinh||E,c=T.cos||E,d=T.cosh||E,u=T.tan||E,h=T.tanh||E,m=T.exp||E,p=T.expm1||E,j=T.log1p||E,b=function(N){return T.pow(T.PI,N)},Z=function(N){return T.log(N+T.sqrt(N*N-1))},S=function(N){return T.log(N+T.sqrt(N*N+1))},_=function(N){return T.log((1+N)/(1-N))/2},L=function(N){return T.exp(N)-1/T.exp(N)/2},J=function(N){return(T.exp(N)+1/T.exp(N))/2},ie=function(N){return T.exp(N)-1},te=function(N){return(T.exp(2*N)-1)/(T.exp(2*N)+1)},de=function(N){return T.log(1+N)};return{acos:e(.12312423423423424),acosh:t(1e308),acoshPf:Z(1e154),asin:r(.12312423423423424),asinh:n(1),asinhPf:S(1),atanh:a(.5),atanhPf:_(.5),atan:i(.5),sin:s(-1e300),sinh:o(1),sinhPf:L(1),cos:c(10.000000000123),cosh:d(1),coshPf:J(1),tan:u(-1e300),tanh:h(1),tanhPf:te(1),exp:m(1),expm1:p(1),expm1Pf:ie(1),log1p:j(10),log1pPf:de(10),powPI:b(-100)}}var ni="mmMwWLliI0fiflO&1",Ke={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};function ai(){return ii(function(e,t){for(var r={},n={},a=0,i=Object.keys(Ke);a<i.length;a++){var s=i[a],o=Ke[s],c=o[0],d=c===void 0?{}:c,u=o[1],h=u===void 0?ni:u,m=e.createElement("span");m.textContent=h,m.style.whiteSpace="nowrap";for(var p=0,j=Object.keys(d);p<j.length;p++){var b=j[p],Z=d[b];Z!==void 0&&(m.style[b]=Z)}r[s]=m,t.append(e.createElement("br"),m)}for(var S=0,_=Object.keys(Ke);S<_.length;S++){var s=_[S];n[s]=r[s].getBoundingClientRect().width}return n})}function ii(e,t){return t===void 0&&(t=4e3),yr(function(r,n){var a=n.document,i=a.body,s=i.style;s.width="".concat(t,"px"),s.webkitTextSizeAdjust=s.textSizeAdjust="none",Se()?i.style.zoom="".concat(1/n.devicePixelRatio):B()&&(i.style.zoom="reset");var o=a.createElement("div");return o.textContent=hr([],Array(t/20<<0),!0).map(function(){return"word"}).join(" "),i.appendChild(o),e(a,i)},'<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">')}function si(){return navigator.pdfViewerEnabled}function oi(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],t[3]}function ci(){var e=window.ApplePaySession;if(typeof e?.canMakePayments!="function")return-1;if(di())return-3;try{return e.canMakePayments()?1:0}catch(t){return li(t)}}var di=aa;function li(e){if(e instanceof Error&&e.name==="InvalidAccessError"&&/\bfrom\b.*\binsecure\b/i.test(e.message))return-2;throw e}function ui(){var e,t=document.createElement("a"),r=(e=t.attributionSourceId)!==null&&e!==void 0?e:t.attributionsourceid;return r===void 0?void 0:String(r)}var br=-1,kr=-2,hi=new Set([10752,2849,2884,2885,2886,2928,2929,2930,2931,2932,2960,2961,2962,2963,2964,2965,2966,2967,2968,2978,3024,3042,3088,3089,3106,3107,32773,32777,32777,32823,32824,32936,32937,32938,32939,32968,32969,32970,32971,3317,33170,3333,3379,3386,33901,33902,34016,34024,34076,3408,3410,3411,3412,3413,3414,3415,34467,34816,34817,34818,34819,34877,34921,34930,35660,35661,35724,35738,35739,36003,36004,36005,36347,36348,36349,37440,37441,37443,7936,7937,7938]),fi=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),mi=["FRAGMENT_SHADER","VERTEX_SHADER"],pi=["LOW_FLOAT","MEDIUM_FLOAT","HIGH_FLOAT","LOW_INT","MEDIUM_INT","HIGH_INT"],xr="WEBGL_debug_renderer_info",gi="WEBGL_polygon_mode";function vi(e){var t,r,n,a,i,s,o=e.cache,c=_r(o);if(!c)return br;if(!Sr(c))return kr;var d=wr()?null:c.getExtension(xr);return{version:((t=c.getParameter(c.VERSION))===null||t===void 0?void 0:t.toString())||"",vendor:((r=c.getParameter(c.VENDOR))===null||r===void 0?void 0:r.toString())||"",vendorUnmasked:d?(n=c.getParameter(d.UNMASKED_VENDOR_WEBGL))===null||n===void 0?void 0:n.toString():"",renderer:((a=c.getParameter(c.RENDERER))===null||a===void 0?void 0:a.toString())||"",rendererUnmasked:d?(i=c.getParameter(d.UNMASKED_RENDERER_WEBGL))===null||i===void 0?void 0:i.toString():"",shadingLanguageVersion:((s=c.getParameter(c.SHADING_LANGUAGE_VERSION))===null||s===void 0?void 0:s.toString())||""}}function yi(e){var t=e.cache,r=_r(t);if(!r)return br;if(!Sr(r))return kr;var n=r.getSupportedExtensions(),a=r.getContextAttributes(),i=[],s=[],o=[],c=[],d=[];if(a)for(var u=0,h=Object.keys(a);u<h.length;u++){var m=h[u];s.push("".concat(m,"=").concat(a[m]))}for(var p=Xt(r),j=0,b=p;j<b.length;j++){var Z=b[j],S=r[Z];o.push("".concat(Z,"=").concat(S).concat(hi.has(S)?"=".concat(r.getParameter(S)):""))}if(n)for(var _=0,L=n;_<L.length;_++){var J=L[_];if(!(J===xr&&wr()||J===gi&&xi())){var ie=r.getExtension(J);if(!ie){i.push(J);continue}for(var te=0,de=Xt(ie);te<de.length;te++){var Z=de[te],S=ie[Z];c.push("".concat(Z,"=").concat(S).concat(fi.has(S)?"=".concat(r.getParameter(S)):""))}}}for(var N=0,Nt=mi;N<Nt.length;N++)for(var Lt=Nt[N],He=0,At=pi;He<At.length;He++){var Zt=At[He],Gr=bi(r,Lt,Zt);d.push("".concat(Lt,".").concat(Zt,"=").concat(Gr.join(",")))}return c.sort(),o.sort(),{contextAttributes:s,parameters:o,shaderPrecisions:d,extensions:n,extensionParameters:c,unsupportedExtensions:i}}function _r(e){if(e.webgl)return e.webgl.context;var t=document.createElement("canvas"),r;t.addEventListener("webglCreateContextError",function(){r=void 0});for(var n=0,a=["webgl","experimental-webgl"];n<a.length;n++){var i=a[n];try{r=t.getContext(i)}catch{}if(r)break}return e.webgl={context:r},r}function bi(e,t,r){var n=e.getShaderPrecisionFormat(e[t],e[r]);return n?[n.rangeMin,n.rangeMax,n.precision]:[]}function Xt(e){return Object.keys(e.__proto__).filter(ki)}function ki(e){return typeof e=="string"&&!e.match(/[^A-Z0-9_x]/)}function wr(){return vr()}function xi(){return Se()||B()}function Sr(e){return typeof e.getParameter=="function"}function _i(){if(!(Ct()||B()))return-2;if(!window.AudioContext)return-1;var e=new AudioContext().baseLatency;return e==null?-1:isFinite(e)?e:-3}function wi(){if(!window.Intl)return-1;var e=window.Intl.DateTimeFormat;if(!e)return-2;var t=e().resolvedOptions().locale;return!t&&t!==""?-3:t}var Si={fonts:oa,domBlockers:Ua,fontPreferences:ai,audio:Jn,screenFrame:Na,canvas:da,osCpu:ba,languages:ka,colorDepth:xa,deviceMemory:_a,screenResolution:wa,hardwareConcurrency:La,timezone:Aa,sessionStorage:Ra,localStorage:Ea,indexedDB:Ma,openDatabase:Oa,cpuClass:Va,platform:Pa,plugins:ca,touchSupport:ya,vendor:Fa,vendorFlavors:Wa,cookiesEnabled:za,colorGamut:Ya,invertedColors:Ha,forcedColors:Xa,monochrome:Qa,contrast:Ka,reducedMotion:qa,reducedTransparency:ei,hdr:ti,math:ri,pdfViewerEnabled:si,architecture:oi,applePay:ci,privateClickMeasurement:ui,audioBaseLatency:_i,dateTimeLocale:wi,webGlBasics:vi,webGlExtensions:yi};function ji(e){return zn(Si,e,[])}var Ci="$ if upgrade to Pro: https://fpjs.dev/pro";function Ii(e){var t=Ti(e),r=Ni(t);return{score:t,comment:Ci.replace(/\$/g,"".concat(r))}}function Ti(e){if(Ct())return .4;if(B())return jt()&&!(Ce()&&je())?.5:.3;var t="value"in e.platform?e.platform.value:"";return/^Win/.test(t)?.6:/^Mac/.test(t)?.5:.7}function Ni(e){return pr(.99+.01*e,1e-4)}function Li(e){for(var t="",r=0,n=Object.keys(e).sort();r<n.length;r++){var a=n[r],i=e[a],s="error"in i?"error":JSON.stringify(i.value);t+="".concat(t?"|":"").concat(a.replace(/([:|\\])/g,"\\$1"),":").concat(s)}return t}function Ai(e){return JSON.stringify(e,function(t,r){return r instanceof Error?Vn(r):r},2)}function jr(e){return On(Li(e))}function Zi(e){var t;return{get visitorId(){return t===void 0&&(t=jr(this.components)),t},set visitorId(r){t=r},confidence:Ii(e),components:e,version:fr}}function Ri(e){return e===void 0&&(e=50),In(e,e*2)}function Ei(e,t){var r=Date.now();return{get:function(n){return H(this,void 0,void 0,function(){var a,i,s;return X(this,function(o){switch(o.label){case 0:return a=Date.now(),[4,e()];case 1:return i=o.sent(),s=Zi(i),t||n?.debug,[2,s]}})})}}}function Mi(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var e=new XMLHttpRequest;e.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(fr,"/npm-monitoring"),!0),e.send()}catch{}}function Oi(e){var t;return e===void 0&&(e={}),H(this,void 0,void 0,function(){var r,n,a;return X(this,function(i){switch(i.label){case 0:return(!((t=e.monitoring)!==null&&t!==void 0)||t)&&Mi(),r=e.delayFallback,n=e.debug,[4,Ri(r)];case 1:return i.sent(),a=ji({cache:{},debug:n}),[2,Ei(a,n)]}})})}var Vi={load:Oi,hashComponents:jr,componentsToDebugString:Ai},Cr=class{constructor(e){this.baseUrl=e}async validateWidget(e,t){if(!t)return{valid:!1,error:"Widget is not configured: tenantId is required"};try{const r=new URLSearchParams({agentId:e,tenantId:t}),n=await fetch(`${this.baseUrl}/v1/widget/validate?${r}`),a=await n.json();return n.ok&&a.success?{valid:!0,agentId:a.data.agentId,tenantId:a.data.tenantId}:{valid:!1,error:a.error??`Widget configuration is invalid (${n.status})`}}catch{return{valid:!1,error:"Unable to reach the AgentForge API to validate widget configuration"}}}async chat(e){const t=await fetch(`${this.baseUrl}/v1/agents/${encodeURIComponent(e.agentId)}/responses`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e.message,sessionId:e.sessionId,tenantId:e.tenantId,userId:e.userId,name:e.name,email:e.email,authUserId:e.authUserId,fingerprint:e.fingerprint,metadata:e.metadata,imageUrl:e.imageUrl})});if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);const r=await t.json();if(!r.success)throw new Error(r.error??"Unknown API error");return{content:r.data?.text??"",sessionId:r.data?.sessionId,images:r.data?.images}}async fetchSessionMessages(e){try{const t=await fetch(`${this.baseUrl}/v1/sessions/${encodeURIComponent(e)}/messages`);if(t.status===410||!t.ok)return null;const r=await t.json();return r.success?r.data?.messages??null:null}catch{return null}}async uploadImage(e,t,r){const n=await fetch(`${this.baseUrl}/v1/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:e,mimeType:t,fileName:r})});if(!n.ok)throw new Error(`Upload error: ${n.status} ${n.statusText}`);const a=await n.json();if(!a.success)throw new Error(a.error??"Upload failed");return{url:a.data.url}}async fetchWidgetConfig(e,t){try{const r=t?`?tenantId=${encodeURIComponent(t)}`:"",n=await fetch(`${this.baseUrl}/v1/agents/${encodeURIComponent(e)}/widget-config${r}`);if(!n.ok)return null;const a=await n.json();return a.success?a.data:null}catch{return null}}},Pi=6e4;function Fi(e){return Promise.race([e.read(),new Promise((t,r)=>setTimeout(()=>r(new Error("Stream timed out — no data received for 60s")),Pi))])}async function Ir(e,t,r){let n="",a="";try{const i=await fetch(`${e}/v1/agents/${encodeURIComponent(t.agentId)}/responses:stream`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:t.message,sessionId:t.sessionId,tenantId:t.tenantId,userId:t.userId,name:t.name,email:t.email,authUserId:t.authUserId,fingerprint:t.fingerprint,metadata:t.metadata,imageUrl:t.imageUrl})});if(!i.ok||!i.body)throw new Error(`Stream error: ${i.status} ${i.statusText}`);const s=i.headers.get("x-session-id");s&&r.onSession&&r.onSession(s);const o=i.body.getReader(),c=new TextDecoder;let d="";const u=h=>{if(!h.startsWith("data: "))return!1;const m=h.slice(6).trim();if(!m)return!1;if(m==="[DONE]")return r.onEnd(n),!0;try{const p=JSON.parse(m);if(p.type==="session"){const b=p.sessionId;return b&&r.onSession&&r.onSession(b),!1}if(p.type==="done"||p.type==="stop")return r.onEnd(n),!0;if(p.type==="error")throw new Error(p.message??"Stream error");if(p.type==="images"){const b=p.images;return b&&r.onImages&&r.onImages(b),!1}if(p.type==="thinking_chunk"){const b=p.content;return b&&r.onThinkingDelta&&(a+=b,r.onThinkingDelta(b,a)),!1}const j=Wi(p);j&&(n+=j,r.onDelta(j,n))}catch(p){if(!(p instanceof SyntaxError))throw p}return!1};e:for(;;){const{done:h,value:m}=await Fi(o);if(h)break;d+=c.decode(m,{stream:!0});const p=d.lastIndexOf(`
|
|
5
|
-
`);if(p===-1)continue;const
|
|
6
|
-
`))if(u(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let Yr=require("preact/compat/client"),A=require("preact/compat"),d=require("preact/jsx-runtime");var I;(function(e){e.assertEqual=a=>{};function t(a){}e.assertIs=t;function r(a){throw new Error}e.assertNever=r,e.arrayToEnum=a=>{const i={};for(const s of a)i[s]=s;return i},e.getValidEnumValues=a=>{const i=e.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),s={};for(const o of i)s[o]=a[o];return e.objectValues(s)},e.objectValues=a=>e.objectKeys(a).map(function(i){return a[i]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const i=[];for(const s in a)Object.prototype.hasOwnProperty.call(a,s)&&i.push(s);return i},e.find=(a,i)=>{for(const s of a)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,i=" | "){return a.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(I||(I={}));var Et;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Et||(Et={}));var v=I.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),oe=e=>{switch(typeof e){case"undefined":return v.undefined;case"string":return v.string;case"number":return Number.isNaN(e)?v.nan:v.number;case"boolean":return v.boolean;case"function":return v.function;case"bigint":return v.bigint;case"symbol":return v.symbol;case"object":return Array.isArray(e)?v.array:e===null?v.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?v.promise:typeof Map<"u"&&e instanceof Map?v.map:typeof Set<"u"&&e instanceof Set?v.set:typeof Date<"u"&&e instanceof Date?v.date:v.object;default:return v.unknown}},f=I.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"]),J=class Kt extends Error{get errors(){return this.issues}constructor(t){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=t}format(t){const r=t||function(i){return i.message},n={_errors:[]},a=i=>{for(const s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(a);else if(s.code==="invalid_return_type")a(s.returnTypeError);else if(s.code==="invalid_arguments")a(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let o=n,l=0;for(;l<s.path.length;){const c=s.path[l];l!==s.path.length-1?o[c]=o[c]||{_errors:[]}:(o[c]=o[c]||{_errors:[]},o[c]._errors.push(r(s))),o=o[c],l++}}};return a(this),n}static assert(t){if(!(t instanceof Kt))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,I.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){const r={},n=[];for(const a of this.issues)if(a.path.length>0){const i=a.path[0];r[i]=r[i]||[],r[i].push(t(a))}else n.push(t(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};J.create=e=>new J(e);var we=(e,t)=>{let r;switch(e.code){case f.invalid_type:e.received===v.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case f.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,I.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:r=`Unrecognized key(s) in object: ${I.joinValues(e.keys,", ")}`;break;case f.invalid_union:r="Invalid input";break;case f.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${I.joinValues(e.options)}`;break;case f.invalid_enum_value:r=`Invalid enum value. Expected ${I.joinValues(e.options)}, received '${e.received}'`;break;case f.invalid_arguments:r="Invalid function arguments";break;case f.invalid_return_type:r="Invalid function return type";break;case f.invalid_date:r="Invalid date";break;case f.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:I.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case f.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case f.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case f.custom:r="Invalid input";break;case f.invalid_intersection_types:r="Intersection results could not be merged";break;case f.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case f.not_finite:r="Number must be finite";break;default:r=t.defaultError,I.assertNever(e)}return{message:r}},Hr=we;function rt(){return Hr}var nt=e=>{const{data:t,path:r,errorMaps:n,issueData:a}=e,i=[...r,...a.path||[]],s={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let o="";const l=n.filter(c=>!!c).slice().reverse();for(const c of l)o=c(s,{data:t,defaultError:o}).message;return{...a,path:i,message:o}};function g(e,t){const r=rt(),n=nt({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===we?void 0:we].filter(a=>!!a)});e.common.issues.push(n)}var z=class qt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const n=[];for(const a of r){if(a.status==="aborted")return b;a.status==="dirty"&&t.dirty(),n.push(a.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){const n=[];for(const a of r){const i=await a.key,s=await a.value;n.push({key:i,value:s})}return qt.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const a of r){const{key:i,value:s}=a;if(i.status==="aborted"||s.status==="aborted")return b;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||a.alwaysSet)&&(n[i.value]=s.value)}return{status:t.value,value:n}}},b=Object.freeze({status:"aborted"}),xe=e=>({status:"dirty",value:e}),F=e=>({status:"valid",value:e}),Mt=e=>e.status==="aborted",Ot=e=>e.status==="dirty",ye=e=>e.status==="valid",Ve=e=>typeof Promise<"u"&&e instanceof Promise,y;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(y||(y={}));var Q=class{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Vt=(e,t)=>{if(ye(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){return this._error?this._error:(this._error=new J(e.common.issues),this._error)}}};function S(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:a}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:(s,o)=>{const{message:l}=e;return s.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??n??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:l??r??o.defaultError}},description:a}}var j=class{get description(){return this._def.description}_getType(e){return oe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:oe(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:oe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Ve(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){const r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:oe(e)};return Vt(r,this._parseSync({data:e,path:r.path,parent:r}))}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:oe(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:t});return ye(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>ye(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:oe(e)},n=this._parse({data:e,path:r.path,parent:r});return Vt(r,await(Ve(n)?n:Promise.resolve(n)))}refine(e,t){const r=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{const i=e(n),s=()=>a.addIssue({code:f.custom,...r(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(o=>o?!0:(s(),!1)):i?!0:(s(),!1)})}refinement(e,t){return this._refinement((r,n)=>e(r)?!0:(n.addIssue(typeof t=="function"?t(r,n):t),!1))}_refinement(e){return new ae({schema:this,typeName:x.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}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.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return ne.create(this,this._def)}nullable(){return ue.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ke.create(this)}promise(){return Se.create(this,this._def)}or(e){return ze.create([this,e],this._def)}and(e){return De.create(this,e,this._def)}transform(e){return new ae({...S(this._def),schema:this,typeName:x.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Ge({...S(this._def),innerType:this,defaultValue:t,typeName:x.ZodDefault})}brand(){return new sr({typeName:x.ZodBranded,type:this,...S(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ye({...S(this._def),innerType:this,catchValue:t,typeName:x.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return or.create(this,e)}readonly(){return He.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Xr=/^c[^\s-]{8,}$/i,Jr=/^[0-9a-z]+$/,Qr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Kr=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,qr=/^[a-z0-9_-]{21}$/i,en=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,tn=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,rn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,nn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ke,an=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,sn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,on=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,cn=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,dn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ln=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,er="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",un=new RegExp(`^${er}$`);function tr(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function hn(e){return new RegExp(`^${tr(e)}$`)}function fn(e){let t=`${er}T${tr(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function mn(e,t){return!!((t==="v4"||!t)&&an.test(e)||(t==="v6"||!t)&&on.test(e))}function pn(e,t){if(!en.test(e))return!1;try{const[r]=e.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||t&&a.alg!==t)}catch{return!1}}function gn(e,t){return!!((t==="v4"||!t)&&sn.test(e)||(t==="v6"||!t)&&cn.test(e))}var Pe=class _e extends j{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==v.string){const a=this._getOrReturnCtx(t);return g(a,{code:f.invalid_type,expected:v.string,received:a.parsedType}),b}const r=new z;let n;for(const a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(n=this._getOrReturnCtx(t,n),g(n,{code:f.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")t.data.length>a.value&&(n=this._getOrReturnCtx(t,n),g(n,{code:f.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){const i=t.data.length>a.value,s=t.data.length<a.value;(i||s)&&(n=this._getOrReturnCtx(t,n),i?g(n,{code:f.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&g(n,{code:f.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")rn.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"email",code:f.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")Ke||(Ke=new RegExp(nn,"u")),Ke.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"emoji",code:f.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Kr.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"uuid",code:f.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")qr.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"nanoid",code:f.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Xr.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"cuid",code:f.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")Jr.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"cuid2",code:f.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Qr.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"ulid",code:f.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{n=this._getOrReturnCtx(t,n),g(n,{validation:"url",code:f.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"regex",code:f.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?t.data=t.data.trim():a.kind==="includes"?t.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(t,n),g(n,{code:f.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?t.data=t.data.toLowerCase():a.kind==="toUpperCase"?t.data=t.data.toUpperCase():a.kind==="startsWith"?t.data.startsWith(a.value)||(n=this._getOrReturnCtx(t,n),g(n,{code:f.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(n=this._getOrReturnCtx(t,n),g(n,{code:f.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?fn(a).test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{code:f.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?un.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{code:f.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?hn(a).test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{code:f.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?tn.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"duration",code:f.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?mn(t.data,a.version)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"ip",code:f.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?pn(t.data,a.alg)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"jwt",code:f.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?gn(t.data,a.version)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"cidr",code:f.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?dn.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"base64",code:f.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?ln.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"base64url",code:f.invalid_string,message:a.message}),r.dirty()):I.assertNever(a);return{status:r.value,value:t.data}}_regex(t,r,n){return this.refinement(a=>t.test(a),{validation:r,code:f.invalid_string,...y.errToObj(n)})}_addCheck(t){return new _e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...y.errToObj(t)})}url(t){return this._addCheck({kind:"url",...y.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...y.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...y.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...y.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...y.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...y.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...y.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...y.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...y.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...y.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...y.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...y.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...y.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...y.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...y.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...y.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...y.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...y.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...y.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...y.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...y.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...y.errToObj(r)})}nonempty(t){return this.min(1,y.errToObj(t))}trim(){return new _e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new _e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new _e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Pe.create=e=>new Pe({checks:[],typeName:x.ZodString,coerce:e?.coerce??!1,...S(e)});function vn(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=r>n?r:n;return Number.parseInt(e.toFixed(a).replace(".",""))%Number.parseInt(t.toFixed(a).replace(".",""))/10**a}var at=class it extends j{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==v.number){const a=this._getOrReturnCtx(t);return g(a,{code:f.invalid_type,expected:v.number,received:a.parsedType}),b}let r;const n=new z;for(const a of this._def.checks)a.kind==="int"?I.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),g(r,{code:f.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(r=this._getOrReturnCtx(t,r),g(r,{code:f.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(r=this._getOrReturnCtx(t,r),g(r,{code:f.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?vn(t.data,a.value)!==0&&(r=this._getOrReturnCtx(t,r),g(r,{code:f.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),g(r,{code:f.not_finite,message:a.message}),n.dirty()):I.assertNever(a);return{status:n.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,y.toString(r))}gt(t,r){return this.setLimit("min",t,!1,y.toString(r))}lte(t,r){return this.setLimit("max",t,!0,y.toString(r))}lt(t,r){return this.setLimit("max",t,!1,y.toString(r))}setLimit(t,r,n,a){return new it({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:y.toString(a)}]})}_addCheck(t){return new it({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:y.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:y.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:y.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&I.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};at.create=e=>new at({checks:[],typeName:x.ZodNumber,coerce:e?.coerce||!1,...S(e)});var st=class ot extends j{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==v.bigint)return this._getInvalidInput(t);let r;const n=new z;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(r=this._getOrReturnCtx(t,r),g(r,{code:f.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(r=this._getOrReturnCtx(t,r),g(r,{code:f.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),g(r,{code:f.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):I.assertNever(a);return{status:n.value,value:t.data}}_getInvalidInput(t){const r=this._getOrReturnCtx(t);return g(r,{code:f.invalid_type,expected:v.bigint,received:r.parsedType}),b}gte(t,r){return this.setLimit("min",t,!0,y.toString(r))}gt(t,r){return this.setLimit("min",t,!1,y.toString(r))}lte(t,r){return this.setLimit("max",t,!0,y.toString(r))}lt(t,r){return this.setLimit("max",t,!1,y.toString(r))}setLimit(t,r,n,a){return new ot({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:y.toString(a)}]})}_addCheck(t){return new ot({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:y.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};st.create=e=>new st({checks:[],typeName:x.ZodBigInt,coerce:e?.coerce??!1,...S(e)});var ct=class extends j{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==v.boolean){const t=this._getOrReturnCtx(e);return g(t,{code:f.invalid_type,expected:v.boolean,received:t.parsedType}),b}return F(e.data)}};ct.create=e=>new ct({typeName:x.ZodBoolean,coerce:e?.coerce||!1,...S(e)});var dt=class rr extends j{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==v.date){const a=this._getOrReturnCtx(t);return g(a,{code:f.invalid_type,expected:v.date,received:a.parsedType}),b}if(Number.isNaN(t.data.getTime()))return g(this._getOrReturnCtx(t),{code:f.invalid_date}),b;const r=new z;let n;for(const a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(n=this._getOrReturnCtx(t,n),g(n,{code:f.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?t.data.getTime()>a.value&&(n=this._getOrReturnCtx(t,n),g(n,{code:f.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):I.assertNever(a);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new rr({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:y.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:y.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};dt.create=e=>new dt({checks:[],coerce:e?.coerce||!1,typeName:x.ZodDate,...S(e)});var lt=class extends j{_parse(e){if(this._getType(e)!==v.symbol){const t=this._getOrReturnCtx(e);return g(t,{code:f.invalid_type,expected:v.symbol,received:t.parsedType}),b}return F(e.data)}};lt.create=e=>new lt({typeName:x.ZodSymbol,...S(e)});var Fe=class extends j{_parse(e){if(this._getType(e)!==v.undefined){const t=this._getOrReturnCtx(e);return g(t,{code:f.invalid_type,expected:v.undefined,received:t.parsedType}),b}return F(e.data)}};Fe.create=e=>new Fe({typeName:x.ZodUndefined,...S(e)});var We=class extends j{_parse(e){if(this._getType(e)!==v.null){const t=this._getOrReturnCtx(e);return g(t,{code:f.invalid_type,expected:v.null,received:t.parsedType}),b}return F(e.data)}};We.create=e=>new We({typeName:x.ZodNull,...S(e)});var ut=class extends j{constructor(){super(...arguments),this._any=!0}_parse(e){return F(e.data)}};ut.create=e=>new ut({typeName:x.ZodAny,...S(e)});var ge=class extends j{constructor(){super(...arguments),this._unknown=!0}_parse(e){return F(e.data)}};ge.create=e=>new ge({typeName:x.ZodUnknown,...S(e)});var ce=class extends j{_parse(e){const t=this._getOrReturnCtx(e);return g(t,{code:f.invalid_type,expected:v.never,received:t.parsedType}),b}};ce.create=e=>new ce({typeName:x.ZodNever,...S(e)});var ht=class extends j{_parse(e){if(this._getType(e)!==v.undefined){const t=this._getOrReturnCtx(e);return g(t,{code:f.invalid_type,expected:v.void,received:t.parsedType}),b}return F(e.data)}};ht.create=e=>new ht({typeName:x.ZodVoid,...S(e)});var ke=class Ze extends j{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),a=this._def;if(r.parsedType!==v.array)return g(r,{code:f.invalid_type,expected:v.array,received:r.parsedType}),b;if(a.exactLength!==null){const s=r.data.length>a.exactLength.value,o=r.data.length<a.exactLength.value;(s||o)&&(g(r,{code:s?f.too_big:f.too_small,minimum:o?a.exactLength.value:void 0,maximum:s?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(g(r,{code:f.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(g(r,{code:f.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((s,o)=>a.type._parseAsync(new Q(r,s,r.path,o)))).then(s=>z.mergeArray(n,s));const i=[...r.data].map((s,o)=>a.type._parseSync(new Q(r,s,r.path,o)));return z.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new Ze({...this._def,minLength:{value:t,message:y.toString(r)}})}max(t,r){return new Ze({...this._def,maxLength:{value:t,message:y.toString(r)}})}length(t,r){return new Ze({...this._def,exactLength:{value:t,message:y.toString(r)}})}nonempty(t){return this.min(1,t)}};ke.create=(e,t)=>new ke({type:e,minLength:null,maxLength:null,exactLength:null,typeName:x.ZodArray,...S(t)});function pe(e){if(e instanceof Y){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=ne.create(pe(n))}return new Y({...e._def,shape:()=>t})}else return e instanceof ke?new ke({...e._def,type:pe(e.element)}):e instanceof ne?ne.create(pe(e.unwrap())):e instanceof ue?ue.create(pe(e.unwrap())):e instanceof le?le.create(e.items.map(t=>pe(t))):e}var Y=class B extends j{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape();return this._cached={shape:t,keys:I.objectKeys(t)},this._cached}_parse(t){if(this._getType(t)!==v.object){const l=this._getOrReturnCtx(t);return g(l,{code:f.invalid_type,expected:v.object,received:l.parsedType}),b}const{status:r,ctx:n}=this._processInputParams(t),{shape:a,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof ce&&this._def.unknownKeys==="strip"))for(const l in n.data)i.includes(l)||s.push(l);const o=[];for(const l of i){const c=a[l],u=n.data[l];o.push({key:{status:"valid",value:l},value:c._parse(new Q(n,u,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof ce){const l=this._def.unknownKeys;if(l==="passthrough")for(const c of s)o.push({key:{status:"valid",value:c},value:{status:"valid",value:n.data[c]}});else if(l==="strict")s.length>0&&(g(n,{code:f.unrecognized_keys,keys:s}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const c of s){const u=n.data[c];o.push({key:{status:"valid",value:c},value:l._parse(new Q(n,u,n.path,c)),alwaysSet:c in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const l=[];for(const c of o){const u=await c.key,h=await c.value;l.push({key:u,value:h,alwaysSet:c.alwaysSet})}return l}).then(l=>z.mergeObjectSync(r,l)):z.mergeObjectSync(r,o)}get shape(){return this._def.shape()}strict(t){return y.errToObj,new B({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{const a=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:y.errToObj(t).message??a}:{message:a}}}:{}})}strip(){return new B({...this._def,unknownKeys:"strip"})}passthrough(){return new B({...this._def,unknownKeys:"passthrough"})}extend(t){return new B({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new B({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:x.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new B({...this._def,catchall:t})}pick(t){const r={};for(const n of I.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new B({...this._def,shape:()=>r})}omit(t){const r={};for(const n of I.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new B({...this._def,shape:()=>r})}deepPartial(){return pe(this)}partial(t){const r={};for(const n of I.objectKeys(this.shape)){const a=this.shape[n];t&&!t[n]?r[n]=a:r[n]=a.optional()}return new B({...this._def,shape:()=>r})}required(t){const r={};for(const n of I.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof ne;)a=a._def.innerType;r[n]=a}return new B({...this._def,shape:()=>r})}keyof(){return ir(I.objectKeys(this.shape))}};Y.create=(e,t)=>new Y({shape:()=>e,unknownKeys:"strip",catchall:ce.create(),typeName:x.ZodObject,...S(t)});Y.strictCreate=(e,t)=>new Y({shape:()=>e,unknownKeys:"strict",catchall:ce.create(),typeName:x.ZodObject,...S(t)});Y.lazycreate=(e,t)=>new Y({shape:e,unknownKeys:"strip",catchall:ce.create(),typeName:x.ZodObject,...S(t)});var ze=class extends j{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function n(a){for(const s of a)if(s.result.status==="valid")return s.result;for(const s of a)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;const i=a.map(s=>new J(s.ctx.common.issues));return g(t,{code:f.invalid_union,unionErrors:i}),b}if(t.common.async)return Promise.all(r.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a;const i=[];for(const o of r){const l={...t,common:{...t.common,issues:[]},parent:null},c=o._parseSync({data:t.data,path:t.path,parent:l});if(c.status==="valid")return c;c.status==="dirty"&&!a&&(a={result:c,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const s=i.map(o=>new J(o));return g(t,{code:f.invalid_union,unionErrors:s}),b}}get options(){return this._def.options}};ze.create=(e,t)=>new ze({options:e,typeName:x.ZodUnion,...S(t)});var te=e=>e instanceof $e?te(e.schema):e instanceof ae?te(e.innerType()):e instanceof Ue?[e.value]:e instanceof Je?e.options:e instanceof Be?I.objectValues(e.enum):e instanceof Ge?te(e._def.innerType):e instanceof Fe?[void 0]:e instanceof We?[null]:e instanceof ne?[void 0,...te(e.unwrap())]:e instanceof ue?[null,...te(e.unwrap())]:e instanceof sr||e instanceof He?te(e.unwrap()):e instanceof Ye?te(e._def.innerType):[],yn=class nr extends j{_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==v.object)return g(r,{code:f.invalid_type,expected:v.object,received:r.parsedType}),b;const n=this.discriminator,a=r.data[n],i=this.optionsMap.get(a);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(g(r,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),b)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){const a=new Map;for(const i of r){const s=te(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const o of s){if(a.has(o))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(o)}`);a.set(o,i)}}return new nr({typeName:x.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:a,...S(n)})}};function ft(e,t){const r=oe(e),n=oe(t);if(e===t)return{valid:!0,data:e};if(r===v.object&&n===v.object){const a=I.objectKeys(t),i=I.objectKeys(e).filter(o=>a.indexOf(o)!==-1),s={...e,...t};for(const o of i){const l=ft(e[o],t[o]);if(!l.valid)return{valid:!1};s[o]=l.data}return{valid:!0,data:s}}else if(r===v.array&&n===v.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let i=0;i<e.length;i++){const s=e[i],o=t[i],l=ft(s,o);if(!l.valid)return{valid:!1};a.push(l.data)}return{valid:!0,data:a}}else return r===v.date&&n===v.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var De=class extends j{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(a,i)=>{if(Mt(a)||Mt(i))return b;const s=ft(a.value,i.value);return s.valid?((Ot(a)||Ot(i))&&t.dirty(),{status:t.value,value:s.data}):(g(r,{code:f.invalid_intersection_types}),b)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};De.create=(e,t,r)=>new De({left:e,right:t,typeName:x.ZodIntersection,...S(r)});var le=class ar extends j{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==v.array)return g(n,{code:f.invalid_type,expected:v.array,received:n.parsedType}),b;if(n.data.length<this._def.items.length)return g(n,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b;!this._def.rest&&n.data.length>this._def.items.length&&(g(n,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const a=[...n.data].map((i,s)=>{const o=this._def.items[s]||this._def.rest;return o?o._parse(new Q(n,i,n.path,s)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>z.mergeArray(r,i)):z.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new ar({...this._def,rest:t})}};le.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new le({items:e,typeName:x.ZodTuple,rest:null,...S(t)})};var kn=class mt extends j{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==v.object)return g(n,{code:f.invalid_type,expected:v.object,received:n.parsedType}),b;const a=[],i=this._def.keyType,s=this._def.valueType;for(const o in n.data)a.push({key:i._parse(new Q(n,o,n.path,o)),value:s._parse(new Q(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?z.mergeObjectAsync(r,a):z.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof j?new mt({keyType:t,valueType:r,typeName:x.ZodRecord,...S(n)}):new mt({keyType:Pe.create(),valueType:t,typeName:x.ZodRecord,...S(r)})}},pt=class extends j{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==v.map)return g(r,{code:f.invalid_type,expected:v.map,received:r.parsedType}),b;const n=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([s,o],l)=>({key:n._parse(new Q(r,s,r.path,[l,"key"])),value:a._parse(new Q(r,o,r.path,[l,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const o of i){const l=await o.key,c=await o.value;if(l.status==="aborted"||c.status==="aborted")return b;(l.status==="dirty"||c.status==="dirty")&&t.dirty(),s.set(l.value,c.value)}return{status:t.value,value:s}})}else{const s=new Map;for(const o of i){const l=o.key,c=o.value;if(l.status==="aborted"||c.status==="aborted")return b;(l.status==="dirty"||c.status==="dirty")&&t.dirty(),s.set(l.value,c.value)}return{status:t.value,value:s}}}};pt.create=(e,t,r)=>new pt({valueType:t,keyType:e,typeName:x.ZodMap,...S(r)});var gt=class vt extends j{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==v.set)return g(n,{code:f.invalid_type,expected:v.set,received:n.parsedType}),b;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(g(n,{code:f.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(g(n,{code:f.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const i=this._def.valueType;function s(l){const c=new Set;for(const u of l){if(u.status==="aborted")return b;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}const o=[...n.data.values()].map((l,c)=>i._parse(new Q(n,l,n.path,c)));return n.common.async?Promise.all(o).then(l=>s(l)):s(o)}min(t,r){return new vt({...this._def,minSize:{value:t,message:y.toString(r)}})}max(t,r){return new vt({...this._def,maxSize:{value:t,message:y.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};gt.create=(e,t)=>new gt({valueType:e,minSize:null,maxSize:null,typeName:x.ZodSet,...S(t)});var bn=class Ee extends j{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==v.function)return g(r,{code:f.invalid_type,expected:v.function,received:r.parsedType}),b;function n(o,l){return nt({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,rt(),we].filter(c=>!!c),issueData:{code:f.invalid_arguments,argumentsError:l}})}function a(o,l){return nt({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,rt(),we].filter(c=>!!c),issueData:{code:f.invalid_return_type,returnTypeError:l}})}const i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Se){const o=this;return F(async function(...l){const c=new J([]),u=await o._def.args.parseAsync(l,i).catch(m=>{throw c.addIssue(n(l,m)),c}),h=await Reflect.apply(s,this,u);return await o._def.returns._def.type.parseAsync(h,i).catch(m=>{throw c.addIssue(a(h,m)),c})})}else{const o=this;return F(function(...l){const c=o._def.args.safeParse(l,i);if(!c.success)throw new J([n(l,c.error)]);const u=Reflect.apply(s,this,c.data),h=o._def.returns.safeParse(u,i);if(!h.success)throw new J([a(u,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Ee({...this._def,args:le.create(t).rest(ge.create())})}returns(t){return new Ee({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new Ee({args:t||le.create([]).rest(ge.create()),returns:r||ge.create(),typeName:x.ZodFunction,...S(n)})}},$e=class extends j{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};$e.create=(e,t)=>new $e({getter:e,typeName:x.ZodLazy,...S(t)});var Ue=class extends j{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return g(t,{received:t.data,code:f.invalid_literal,expected:this._def.value}),b}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ue.create=(e,t)=>new Ue({value:e,typeName:x.ZodLiteral,...S(t)});function ir(e,t){return new Je({values:e,typeName:x.ZodEnum,...S(t)})}var Je=class yt extends j{_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return g(r,{expected:I.joinValues(n),received:r.parsedType,code:f.invalid_type}),b}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const r=this._getOrReturnCtx(t),n=this._def.values;return g(r,{received:r.data,code:f.invalid_enum_value,options:n}),b}return F(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return yt.create(t,{...this._def,...r})}exclude(t,r=this._def){return yt.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Je.create=ir;var Be=class extends j{_parse(e){const t=I.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==v.string&&r.parsedType!==v.number){const n=I.objectValues(t);return g(r,{expected:I.joinValues(n),received:r.parsedType,code:f.invalid_type}),b}if(this._cache||(this._cache=new Set(I.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=I.objectValues(t);return g(r,{received:r.data,code:f.invalid_enum_value,options:n}),b}return F(e.data)}get enum(){return this._def.values}};Be.create=(e,t)=>new Be({values:e,typeName:x.ZodNativeEnum,...S(t)});var Se=class extends j{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);return t.parsedType!==v.promise&&t.common.async===!1?(g(t,{code:f.invalid_type,expected:v.promise,received:t.parsedType}),b):F((t.parsedType===v.promise?t.data:Promise.resolve(t.data)).then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Se.create=(e,t)=>new Se({type:e,typeName:x.ZodPromise,...S(t)});var ae=class extends j{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===x.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{g(r,i),i.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const i=n.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(async s=>{if(t.value==="aborted")return b;const o=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return o.status==="aborted"?b:o.status==="dirty"||t.value==="dirty"?xe(o.value):o});{if(t.value==="aborted")return b;const s=this._def.schema._parseSync({data:i,path:r.path,parent:r});return s.status==="aborted"?b:s.status==="dirty"||t.value==="dirty"?xe(s.value):s}}if(n.type==="refinement"){const i=s=>{const o=n.refinement(s,a);if(r.common.async)return Promise.resolve(o);if(o instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?b:(s.status==="dirty"&&t.dirty(),i(s.value),{status:t.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?b:(s.status==="dirty"&&t.dirty(),i(s.value).then(()=>({status:t.value,value:s.value}))))}if(n.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ye(i))return b;const s=n.transform(i.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>ye(i)?Promise.resolve(n.transform(i.value,a)).then(s=>({status:t.value,value:s})):b);I.assertNever(n)}};ae.create=(e,t,r)=>new ae({schema:e,typeName:x.ZodEffects,effect:t,...S(r)});ae.createWithPreprocess=(e,t,r)=>new ae({schema:t,effect:{type:"preprocess",transform:e},typeName:x.ZodEffects,...S(r)});var ne=class extends j{_parse(e){return this._getType(e)===v.undefined?F(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ne.create=(e,t)=>new ne({innerType:e,typeName:x.ZodOptional,...S(t)});var ue=class extends j{_parse(e){return this._getType(e)===v.null?F(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ue.create=(e,t)=>new ue({innerType:e,typeName:x.ZodNullable,...S(t)});var Ge=class extends j{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===v.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Ge.create=(e,t)=>new Ge({innerType:e,typeName:x.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...S(t)});var Ye=class extends j{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ve(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new J(r.common.issues)},input:r.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new J(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Ye.create=(e,t)=>new Ye({innerType:e,typeName:x.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...S(t)});var kt=class extends j{_parse(e){if(this._getType(e)!==v.nan){const t=this._getOrReturnCtx(e);return g(t,{code:f.invalid_type,expected:v.nan,received:t.parsedType}),b}return{status:"valid",value:e.data}}};kt.create=e=>new kt({typeName:x.ZodNaN,...S(e)});var sr=class extends j{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},or=class cr extends j{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?b:i.status==="dirty"?(r.dirty(),xe(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?b:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(t,r){return new cr({in:t,out:r,typeName:x.ZodPipeline})}},He=class extends j{_parse(e){const t=this._def.innerType._parse(e),r=n=>(ye(n)&&(n.value=Object.freeze(n.value)),n);return Ve(t)?t.then(n=>r(n)):r(t)}unwrap(){return this._def.innerType}};He.create=(e,t)=>new He({innerType:e,typeName:x.ZodReadonly,...S(t)});var gs={object:Y.lazycreate},x;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(x||(x={}));var M=Pe.create,vs=at.create,ys=kt.create,ks=st.create,xn=ct.create,bs=dt.create,xs=lt.create,_s=Fe.create,ws=We.create,Ss=ut.create,_n=ge.create,js=ce.create,Cs=ht.create,Is=ke.create,It=Y.create,Ns=Y.strictCreate,Ts=ze.create,Ls=yn.create,Rs=De.create,As=le.create,wn=kn.create,Zs=pt.create,Es=gt.create,Ms=bn.create,Os=$e.create,Vs=Ue.create,dr=Je.create,Ps=Be.create,Fs=Se.create,Ws=ae.create,zs=ne.create,Ds=ue.create,$s=ae.createWithPreprocess,Us=or.create,Sn=It({mode:dr(["light","dark","system"]).optional(),accentColor:M().optional(),fontFamily:M().optional(),borderRadius:M().optional()}),jn=It({externalId:M().optional(),authId:M().optional(),name:M().optional(),email:M().optional()}),lr=It({agentId:M().min(1,"agentId is required"),apiBaseUrl:M().url("apiBaseUrl must be a valid URL"),tenantId:M().optional(),user:jn.optional(),sessionId:M().optional(),mode:dr(["floating","inline"]).optional(),title:M().optional(),subtitle:M().optional(),description:M().optional(),greeting:M().optional(),avatarUrl:M().optional(),privacyPolicyUrl:M().optional(),streaming:xn().optional(),metadata:wn(_n()).optional(),theme:Sn.optional()}),Cn=lr.omit({agentId:!0,apiBaseUrl:!0}).partial(),de={mode:"floating",streaming:!0,title:"AI Assistant",theme:{mode:"light",accentColor:"#6366f1",fontFamily:"system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",borderRadius:"12px"}};function Qe(e,t){lr.parse(e);let r;const n=t?{...t}:void 0;n&&typeof n.theme=="object"&&n.theme!==null?(r=n.theme,delete n.theme):n&&typeof n.theme=="string"&&(r={mode:n.theme},delete n.theme);const a=n?Cn.passthrough().safeParse(n).data:void 0,i=a?ur(a,e):e,s={mode:i.theme?.mode??r?.mode??de.theme.mode,accentColor:i.theme?.accentColor??r?.accentColor??de.theme.accentColor,fontFamily:i.theme?.fontFamily??r?.fontFamily??de.theme.fontFamily,borderRadius:i.theme?.borderRadius??r?.borderRadius??de.theme.borderRadius};return{agentId:i.agentId,apiBaseUrl:i.apiBaseUrl.replace(/\/$/,""),tenantId:i.tenantId,user:{externalId:i.user?.externalId,authId:i.user?.authId,name:i.user?.name,email:i.user?.email},sessionId:i.sessionId,mode:i.mode??de.mode,title:i.title??de.title,subtitle:i.subtitle,description:i.description,greeting:i.greeting,avatarUrl:i.avatarUrl,privacyPolicyUrl:i.privacyPolicyUrl,streaming:i.streaming??de.streaming,metadata:i.metadata??{},theme:s,thinkingEnabled:a?.thinkingEnabled===!0,thinkingViewable:a?.thinkingViewable===!0,photoSendingEnabled:a?.photoSendingEnabled===!0}}function ur(e,t){const r={...e};for(const n of Object.keys(t)){const a=t[n];a!=null&&(typeof a=="object"&&!Array.isArray(a)&&r[n]!==null&&typeof r[n]=="object"?r[n]=ur(r[n],a):r[n]=a)}return r}var bt=function(){return bt=Object.assign||function(t){for(var r,n=1,a=arguments.length;n<a;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},bt.apply(this,arguments)};function K(e,t,r,n){function a(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?i(u.value):a(u.value).then(o,l)}c((n=n.apply(e,t||[])).next())})}function q(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,a,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=o(0),s.throw=o(1),s.return=o(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(c){return function(u){return l([c,u])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(r=0)),r;)try{if(n=1,a&&(i=c[0]&2?a.return:c[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,c[1])).done)return i;switch(a=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,a=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(u){c=[6,u],a=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function hr(e,t,r){if(r||arguments.length===2)for(var n=0,a=t.length,i;n<a;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}var fr="4.6.2";function Xe(e,t){return new Promise(function(r){return setTimeout(r,e,t)})}function In(){return new Promise(function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})}function Nn(e,t){t===void 0&&(t=1/0);var r=window.requestIdleCallback;return r?new Promise(function(n){return r.call(window,function(){return n()},{timeout:t})}):Xe(Math.min(e,t))}function mr(e){return!!e&&typeof e.then=="function"}function Pt(e,t){try{var r=e();mr(r)?r.then(function(n){return t(!0,n)},function(n){return t(!1,n)}):t(!0,r)}catch(n){t(!1,n)}}function Ft(e,t,r){return r===void 0&&(r=16),K(this,void 0,void 0,function(){var n,a,i,s;return q(this,function(o){switch(o.label){case 0:n=Array(e.length),a=Date.now(),i=0,o.label=1;case 1:return i<e.length?(n[i]=t(e[i],i),s=Date.now(),s>=a+r?(a=s,[4,In()]):[3,3]):[3,4];case 2:o.sent(),o.label=3;case 3:return++i,[3,1];case 4:return[2,n]}})})}function je(e){return e.then(void 0,function(){}),e}function Tn(e,t){for(var r=0,n=e.length;r<n;++r)if(e[r]===t)return!0;return!1}function Ln(e,t){return!Tn(e,t)}function Nt(e){return parseInt(e)}function G(e){return parseFloat(e)}function re(e,t){return typeof e=="number"&&isNaN(e)?t:e}function P(e){return e.reduce(function(t,r){return t+(r?1:0)},0)}function pr(e,t){if(t===void 0&&(t=1),Math.abs(t)>=1)return Math.round(e/t)*t;var r=1/t;return Math.round(e*r)/r}function Rn(e){for(var t,r,n="Unexpected syntax '".concat(e,"'"),a=/^\s*([a-z-]*)(.*)$/i.exec(e),i=a[1]||void 0,s={},o=/([.:#][\w-]+|\[.+?\])/gi,l=function(m,p){s[m]=s[m]||[],s[m].push(p)};;){var c=o.exec(a[2]);if(!c)break;var u=c[0];switch(u[0]){case".":l("class",u.slice(1));break;case"#":l("id",u.slice(1));break;case"[":var h=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(u);if(h)l(h[1],(r=(t=h[4])!==null&&t!==void 0?t:h[5])!==null&&r!==void 0?r:"");else throw new Error(n);break;default:throw new Error(n)}}return[i,s]}function An(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;r++){var n=e.charCodeAt(r);if(n>127)return new TextEncoder().encode(e);t[r]=n}return t}function se(e,t){var r=e[0]>>>16,n=e[0]&65535,a=e[1]>>>16,i=e[1]&65535,s=t[0]>>>16,o=t[0]&65535,l=t[1]>>>16,c=t[1]&65535,u=0,h=0,m=0,p=0;p+=i+c,m+=p>>>16,p&=65535,m+=a+l,h+=m>>>16,m&=65535,h+=n+o,u+=h>>>16,h&=65535,u+=r+s,u&=65535,e[0]=u<<16|h,e[1]=m<<16|p}function D(e,t){var r=e[0]>>>16,n=e[0]&65535,a=e[1]>>>16,i=e[1]&65535,s=t[0]>>>16,o=t[0]&65535,l=t[1]>>>16,c=t[1]&65535,u=0,h=0,m=0,p=0;p+=i*c,m+=p>>>16,p&=65535,m+=a*c,h+=m>>>16,m&=65535,m+=i*l,h+=m>>>16,m&=65535,h+=n*c,u+=h>>>16,h&=65535,h+=a*l,u+=h>>>16,h&=65535,h+=i*o,u+=h>>>16,h&=65535,u+=r*c+n*l+a*o+i*s,u&=65535,e[0]=u<<16|h,e[1]=m<<16|p}function he(e,t){var r=e[0];t%=64,t===32?(e[0]=e[1],e[1]=r):t<32?(e[0]=r<<t|e[1]>>>32-t,e[1]=e[1]<<t|r>>>32-t):(t-=32,e[0]=e[1]<<t|r>>>32-t,e[1]=r<<t|e[1]>>>32-t)}function W(e,t){t%=64,t!==0&&(t<32?(e[0]=e[1]>>>32-t,e[1]=e[1]<<t):(e[0]=e[1]<<t-32,e[1]=0))}function R(e,t){e[0]^=t[0],e[1]^=t[1]}var Zn=[4283543511,3981806797],En=[3301882366,444984403];function Wt(e){var t=[0,e[0]>>>1];R(e,t),D(e,Zn),t[1]=e[0]>>>1,R(e,t),D(e,En),t[1]=e[0]>>>1,R(e,t)}var Le=[2277735313,289559509],Re=[1291169091,658871167],zt=[0,5],Mn=[0,1390208809],On=[0,944331445];function Vn(e,t){var r=An(e);t=t||0;var n=[0,r.length],a=n[1]%16,i=n[1]-a,s=[0,t],o=[0,t],l=[0,0],c=[0,0],u;for(u=0;u<i;u=u+16)l[0]=r[u+4]|r[u+5]<<8|r[u+6]<<16|r[u+7]<<24,l[1]=r[u]|r[u+1]<<8|r[u+2]<<16|r[u+3]<<24,c[0]=r[u+12]|r[u+13]<<8|r[u+14]<<16|r[u+15]<<24,c[1]=r[u+8]|r[u+9]<<8|r[u+10]<<16|r[u+11]<<24,D(l,Le),he(l,31),D(l,Re),R(s,l),he(s,27),se(s,o),D(s,zt),se(s,Mn),D(c,Re),he(c,33),D(c,Le),R(o,c),he(o,31),se(o,s),D(o,zt),se(o,On);l[0]=0,l[1]=0,c[0]=0,c[1]=0;var h=[0,0];switch(a){case 15:h[1]=r[u+14],W(h,48),R(c,h);case 14:h[1]=r[u+13],W(h,40),R(c,h);case 13:h[1]=r[u+12],W(h,32),R(c,h);case 12:h[1]=r[u+11],W(h,24),R(c,h);case 11:h[1]=r[u+10],W(h,16),R(c,h);case 10:h[1]=r[u+9],W(h,8),R(c,h);case 9:h[1]=r[u+8],R(c,h),D(c,Re),he(c,33),D(c,Le),R(o,c);case 8:h[1]=r[u+7],W(h,56),R(l,h);case 7:h[1]=r[u+6],W(h,48),R(l,h);case 6:h[1]=r[u+5],W(h,40),R(l,h);case 5:h[1]=r[u+4],W(h,32),R(l,h);case 4:h[1]=r[u+3],W(h,24),R(l,h);case 3:h[1]=r[u+2],W(h,16),R(l,h);case 2:h[1]=r[u+1],W(h,8),R(l,h);case 1:h[1]=r[u],R(l,h),D(l,Le),he(l,31),D(l,Re),R(s,l)}return R(s,n),R(o,n),se(s,o),se(o,s),Wt(s),Wt(o),se(s,o),se(o,s),("00000000"+(s[0]>>>0).toString(16)).slice(-8)+("00000000"+(s[1]>>>0).toString(16)).slice(-8)+("00000000"+(o[0]>>>0).toString(16)).slice(-8)+("00000000"+(o[1]>>>0).toString(16)).slice(-8)}function Pn(e){var t;return bt({name:e.name,message:e.message,stack:(t=e.stack)===null||t===void 0?void 0:t.split(`
|
|
2
|
+
`)},e)}function Fn(e){return/^function\s.*?\{\s*\[native code]\s*}$/.test(String(e))}function Wn(e){return typeof e!="function"}function zn(e,t){var r=je(new Promise(function(n){var a=Date.now();Pt(e.bind(null,t),function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var o=Date.now()-a;if(!i[0])return n(function(){return{error:i[1],duration:o}});var l=i[1];if(Wn(l))return n(function(){return{value:l,duration:o}});n(function(){return new Promise(function(c){var u=Date.now();Pt(l,function(){for(var h=[],m=0;m<arguments.length;m++)h[m]=arguments[m];var p=o+Date.now()-u;if(!h[0])return c({error:h[1],duration:p});c({value:h[1],duration:p})})})})})}));return function(){return r.then(function(a){return a()})}}function Dn(e,t,r,n){var a=Object.keys(e).filter(function(s){return Ln(r,s)}),i=je(Ft(a,function(s){return zn(e[s],t)},n));return function(){return K(this,void 0,void 0,function(){var o,l,c,u,h;return q(this,function(m){switch(m.label){case 0:return[4,i];case 1:return o=m.sent(),[4,Ft(o,function(p){return je(p())},n)];case 2:return l=m.sent(),[4,Promise.all(l)];case 3:for(c=m.sent(),u={},h=0;h<a.length;++h)u[a[h]]=c[h];return[2,u]}})})}}function gr(){var e=window,t=navigator;return P(["MSCSSMatrix"in e,"msSetImmediate"in e,"msIndexedDB"in e,"msMaxTouchPoints"in t,"msPointerEnabled"in t])>=4}function $n(){var e=window,t=navigator;return P(["msWriteProfilerMark"in e,"MSStream"in e,"msLaunchUri"in t,"msSaveBlob"in t])>=3&&!gr()}function Ce(){var e=window,t=navigator;return P(["webkitPersistentStorage"in t,"webkitTemporaryStorage"in t,(t.vendor||"").indexOf("Google")===0,"webkitResolveLocalFileSystemURL"in e,"BatteryManager"in e,"webkitMediaStream"in e,"webkitSpeechGrammar"in e])>=5}function H(){var e=window,t=navigator;return P(["ApplePayError"in e,"CSSPrimitiveValue"in e,"Counter"in e,t.vendor.indexOf("Apple")===0,"RGBColor"in e,"WebKitMediaKeys"in e])>=4}function Tt(){var e=window,t=e.HTMLElement,r=e.Document;return P(["safari"in e,!("ongestureend"in e),!("TouchEvent"in e),!("orientation"in e),t&&!("autocapitalize"in t.prototype),r&&"pointerLockElement"in r.prototype])>=4}function Ie(){var e=window;return Fn(e.print)&&String(e.browser)==="[object WebPageNamespace]"}function vr(){var e,t,r=window;return P(["buildID"in navigator,"MozAppearance"in((t=(e=document.documentElement)===null||e===void 0?void 0:e.style)!==null&&t!==void 0?t:{}),"onmozfullscreenchange"in r,"mozInnerScreenX"in r,"CSSMozDocumentRule"in r,"CanvasCaptureMediaStream"in r])>=4}function Un(){var e=window;return P([!("MediaSettingsRange"in e),"RTCEncodedAudioFrame"in e,""+e.Intl=="[object Intl]",""+e.Reflect=="[object Reflect]"])>=3}function Bn(){var e=window,t=e.URLPattern;return P(["union"in Set.prototype,"Iterator"in e,t&&"hasRegExpGroups"in t.prototype,"RGB8"in WebGLRenderingContext.prototype])>=3}function Gn(){var e=window;return P(["DOMRectList"in e,"RTCPeerConnectionIceEvent"in e,"SVGGeometryElement"in e,"ontransitioncancel"in e])>=3}function Ne(){var e=window,t=navigator,r=e.CSS,n=e.HTMLButtonElement;return P([!("getStorageUpdates"in t),n&&"popover"in n.prototype,"CSSCounterStyleRule"in e,r.supports("font-size-adjust: ex-height 0.5"),r.supports("text-transform: full-width")])>=4}function Yn(){if(navigator.platform==="iPad")return!0;var e=screen,t=e.width/e.height;return P(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,t>.65&&t<1.53])>=2}function Hn(){var e=document;return e.fullscreenElement||e.msFullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement||null}function Xn(){var e=document;return(e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen).call(e)}function Lt(){var e=Ce(),t=vr(),r=window,n=navigator,a="connection";return e?P([!("SharedWorker"in r),n[a]&&"ontypechange"in n[a],!("sinkId"in new Audio)])>=2:t?P(["onorientationchange"in r,"orientation"in r,/android/i.test(n.appVersion)])>=2:!1}function Jn(){var e=navigator,t=window,r=Audio.prototype,n=t.visualViewport;return P(["srLatency"in r,"srChannelCount"in r,"devicePosture"in e,n&&"segments"in n,"getTextInformation"in Image.prototype])>=3}function Qn(){return ea()?-4:Kn()}function Kn(){var e=window,t=e.OfflineAudioContext||e.webkitOfflineAudioContext;if(!t)return-2;if(qn())return-1;var r=4500,n=new t(1,5e3,44100),a=n.createOscillator();a.type="triangle",a.frequency.value=1e4;var i=n.createDynamicsCompressor();i.threshold.value=-50,i.knee.value=40,i.ratio.value=12,i.attack.value=0,i.release.value=.25,a.connect(i),i.connect(n.destination),a.start(0);var s=ta(n),o=s[0],l=s[1],c=je(o.then(function(u){return ra(u.getChannelData(0).subarray(r))},function(u){if(u.name==="timeout"||u.name==="suspended")return-3;throw u}));return function(){return l(),c}}function qn(){return H()&&!Tt()&&!Gn()}function ea(){return H()&&Ne()&&Ie()||Ce()&&Jn()&&Bn()}function ta(e){var t=3,r=500,n=500,a=5e3,i=function(){};return[new Promise(function(s,o){var l=!1,c=0,u=0;e.oncomplete=function(p){return s(p.renderedBuffer)};var h=function(){setTimeout(function(){return o(Dt("timeout"))},Math.min(n,u+a-Date.now()))},m=function(){try{var p=e.startRendering();switch(mr(p)&&je(p),e.state){case"running":u=Date.now(),l&&h();break;case"suspended":document.hidden||c++,l&&c>=t?o(Dt("suspended")):setTimeout(m,r);break}}catch(_){o(_)}};m(),i=function(){l||(l=!0,u>0&&h())}}),i]}function ra(e){for(var t=0,r=0;r<e.length;++r)t+=Math.abs(e[r]);return t}function Dt(e){var t=new Error(e);return t.name=e,t}function yr(e,t,r){var n,a,i;return r===void 0&&(r=50),K(this,void 0,void 0,function(){var s,o;return q(this,function(l){switch(l.label){case 0:s=document,l.label=1;case 1:return s.body?[3,3]:[4,Xe(r)];case 2:return l.sent(),[3,1];case 3:o=s.createElement("iframe"),l.label=4;case 4:return l.trys.push([4,,10,11]),[4,new Promise(function(c,u){var h=!1,m=function(){h=!0,c()},p=function(L){h=!0,u(L)};o.onload=m,o.onerror=p;var _=o.style;_.setProperty("display","block","important"),_.position="absolute",_.top="0",_.left="0",_.visibility="hidden",t&&"srcdoc"in o?o.srcdoc=t:o.src="about:blank",s.body.appendChild(o);var k=function(){var L,w;h||(((w=(L=o.contentWindow)===null||L===void 0?void 0:L.document)===null||w===void 0?void 0:w.readyState)==="complete"?m():setTimeout(k,10))};k()})];case 5:l.sent(),l.label=6;case 6:return!((a=(n=o.contentWindow)===null||n===void 0?void 0:n.document)===null||a===void 0)&&a.body?[3,8]:[4,Xe(r)];case 7:return l.sent(),[3,6];case 8:return[4,e(o,o.contentWindow)];case 9:return[2,l.sent()];case 10:return(i=o.parentNode)===null||i===void 0||i.removeChild(o),[7];case 11:return[2]}})})}function na(e){for(var t=Rn(e),r=t[0],n=t[1],a=document.createElement(r??"div"),i=0,s=Object.keys(n);i<s.length;i++){var o=s[i],l=n[o].join(" ");o==="style"?aa(a.style,l):a.setAttribute(o,l)}return a}function aa(e,t){for(var r=0,n=t.split(";");r<n.length;r++){var a=n[r],i=/^\s*([\w-]+)\s*:\s*(.+?)(\s*!([\w-]+))?\s*$/.exec(a);if(i){var s=i[1],o=i[2],l=i[4];e.setProperty(s,o,l||"")}}}function ia(){for(var e=window;;){var t=e.parent;if(!t||t===e)return!1;try{if(t.location.origin!==e.location.origin)return!0}catch(r){if(r instanceof Error&&r.name==="SecurityError")return!0;throw r}e=t}}var sa="mmMwWLliI0O&1",oa="48px",fe=["monospace","sans-serif","serif"],$t=["sans-serif-thin","ARNO PRO","Agency FB","Arabic Typesetting","Arial Unicode MS","AvantGarde Bk BT","BankGothic Md BT","Batang","Bitstream Vera Sans Mono","Calibri","Century","Century Gothic","Clarendon","EUROSTILE","Franklin Gothic","Futura Bk BT","Futura Md BT","GOTHAM","Gill Sans","HELV","Haettenschweiler","Helvetica Neue","Humanst521 BT","Leelawadee","Letter Gothic","Levenim MT","Lucida Bright","Lucida Sans","Menlo","MS Mincho","MS Outlook","MS Reference Specialty","MS UI Gothic","MT Extra","MYRIAD PRO","Marlett","Meiryo UI","Microsoft Uighur","Minion Pro","Monotype Corsiva","PMingLiU","Pristina","SCRIPTINA","Segoe UI Light","Serifa","SimHei","Small Fonts","Staccato222 BT","TRAJAN PRO","Univers CE 55 Medium","Vrinda","ZWAdobeF"];function ca(){var e=this;return yr(function(t,r){var n=r.document;return K(e,void 0,void 0,function(){var a,i,s,o,l,c,u,h,m,p,_,k;return q(this,function(L){for(a=n.body,a.style.fontSize=oa,i=n.createElement("div"),i.style.setProperty("visibility","hidden","important"),s={},o={},l=function(w){var C=n.createElement("span"),Z=C.style;return Z.position="absolute",Z.top="0",Z.left="0",Z.fontFamily=w,C.textContent=sa,i.appendChild(C),C},c=function(w,C){return l("'".concat(w,"',").concat(C))},u=function(){return fe.map(l)},h=function(){for(var w={},C=function(X){w[X]=fe.map(function(ie){return c(X,ie)})},Z=0,$=$t;Z<$.length;Z++){var ee=$[Z];C(ee)}return w},m=function(w){return fe.some(function(C,Z){return w[Z].offsetWidth!==s[C]||w[Z].offsetHeight!==o[C]})},p=u(),_=h(),a.appendChild(i),k=0;k<fe.length;k++)s[fe[k]]=p[k].offsetWidth,o[fe[k]]=p[k].offsetHeight;return[2,$t.filter(function(w){return m(_[w])})]})})})}function da(){var e=navigator.plugins;if(e){for(var t=[],r=0;r<e.length;++r){var n=e[r];if(n){for(var a=[],i=0;i<n.length;++i){var s=n[i];a.push({type:s.type,suffixes:s.suffixes})}t.push({name:n.name,description:n.description,mimeTypes:a})}}return t}}function la(){return ua(ya())}function ua(e){var t,r=!1,n,a,i=ha(),s=i[0],o=i[1];return fa(s,o)?(r=ma(o),e?n=a="skipped":(t=pa(s,o),n=t[0],a=t[1])):n=a="unsupported",{winding:r,geometry:n,text:a}}function ha(){var e=document.createElement("canvas");return e.width=1,e.height=1,[e,e.getContext("2d")]}function fa(e,t){return!!(t&&e.toDataURL)}function ma(e){return e.rect(0,0,10,10),e.rect(2,2,6,6),!e.isPointInPath(5,5,"evenodd")}function pa(e,t){ga(e,t);var r=qe(e);return r!==qe(e)?["unstable","unstable"]:(va(e,t),[qe(e),r])}function ga(e,t){e.width=240,e.height=60,t.textBaseline="alphabetic",t.fillStyle="#f60",t.fillRect(100,1,62,20),t.fillStyle="#069",t.font='11pt "Times New Roman"';var r="Cwm fjordbank gly ".concat("😃");t.fillText(r,2,15),t.fillStyle="rgba(102, 204, 0, 0.2)",t.font="18pt Arial",t.fillText(r,4,45)}function va(e,t){e.width=122,e.height=110,t.globalCompositeOperation="multiply";for(var r=0,n=[["#f2f",40,40],["#2ff",80,40],["#ff2",60,80]];r<n.length;r++){var a=n[r],i=a[0],s=a[1],o=a[2];t.fillStyle=i,t.beginPath(),t.arc(s,o,40,0,Math.PI*2,!0),t.closePath(),t.fill()}t.fillStyle="#f9c",t.arc(60,60,60,0,Math.PI*2,!0),t.arc(60,60,20,0,Math.PI*2,!0),t.fill("evenodd")}function qe(e){return e.toDataURL()}function ya(){return H()&&Ne()&&Ie()}function ka(){var e=navigator,t=0,r;e.maxTouchPoints!==void 0?t=Nt(e.maxTouchPoints):e.msMaxTouchPoints!==void 0&&(t=e.msMaxTouchPoints);try{document.createEvent("TouchEvent"),r=!0}catch{r=!1}var n="ontouchstart"in window;return{maxTouchPoints:t,touchEvent:r,touchStart:n}}function ba(){return navigator.oscpu}function xa(){var e=navigator,t=[],r=e.language||e.userLanguage||e.browserLanguage||e.systemLanguage;if(r!==void 0&&t.push([r]),Array.isArray(e.languages))Ce()&&Un()||t.push(e.languages);else if(typeof e.languages=="string"){var n=e.languages;n&&t.push(n.split(","))}return t}function _a(){return window.screen.colorDepth}function wa(){return re(G(navigator.deviceMemory),void 0)}function Sa(){if(!(H()&&Ne()&&Ie()))return ja()}function ja(){var e=screen,t=function(n){return re(Nt(n),null)},r=[t(e.width),t(e.height)];return r.sort().reverse(),r}var Ca=2500,Ia=10,Me,et;function Na(){if(et===void 0){var e=function(){var t=xt();_t(t)?et=setTimeout(e,Ca):(Me=t,et=void 0)};e()}}function Ta(){var e=this;return Na(),function(){return K(e,void 0,void 0,function(){var t;return q(this,function(r){switch(r.label){case 0:return t=xt(),_t(t)?Me?[2,hr([],Me,!0)]:Hn()?[4,Xn()]:[3,2]:[3,2];case 1:r.sent(),t=xt(),r.label=2;case 2:return _t(t)||(Me=t),[2,t]}})})}}function La(){var e=this;if(H()&&Ne()&&Ie())return function(){return Promise.resolve(void 0)};var t=Ta();return function(){return K(e,void 0,void 0,function(){var r,n;return q(this,function(a){switch(a.label){case 0:return[4,t()];case 1:return r=a.sent(),n=function(i){return i===null?null:pr(i,Ia)},[2,[n(r[0]),n(r[1]),n(r[2]),n(r[3])]]}})})}}function xt(){var e=screen;return[re(G(e.availTop),null),re(G(e.width)-G(e.availWidth)-re(G(e.availLeft),0),null),re(G(e.height)-G(e.availHeight)-re(G(e.availTop),0),null),re(G(e.availLeft),null)]}function _t(e){for(var t=0;t<4;++t)if(e[t])return!1;return!0}function Ra(){return re(Nt(navigator.hardwareConcurrency),void 0)}function Aa(){var e,t=(e=window.Intl)===null||e===void 0?void 0:e.DateTimeFormat;if(t){var r=new t().resolvedOptions().timeZone;if(r)return r}var n=-Za();return"UTC".concat(n>=0?"+":"").concat(n)}function Za(){var e=new Date().getFullYear();return Math.max(G(new Date(e,0,1).getTimezoneOffset()),G(new Date(e,6,1).getTimezoneOffset()))}function Ea(){try{return!!window.sessionStorage}catch{return!0}}function Ma(){try{return!!window.localStorage}catch{return!0}}function Oa(){if(!(gr()||$n()))try{return!!window.indexedDB}catch{return!0}}function Va(){return!!window.openDatabase}function Pa(){return navigator.cpuClass}function Fa(){var e=navigator.platform;return e==="MacIntel"&&H()&&!Tt()?Yn()?"iPad":"iPhone":e}function Wa(){return navigator.vendor||""}function za(){for(var e=[],t=0,r=["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"];t<r.length;t++){var n=r[t],a=window[n];a&&typeof a=="object"&&e.push(n)}return e.sort()}function Da(){var e=document;try{e.cookie="cookietest=1; SameSite=Strict;";var t=e.cookie.indexOf("cookietest=")!==-1;return e.cookie="cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT",t}catch{return!1}}function $a(){var e=atob;return{abpIndo:["#Iklan-Melayang","#Kolom-Iklan-728","#SidebarIklan-wrapper",'[title="ALIENBOLA" i]',e("I0JveC1CYW5uZXItYWRz")],abpvn:[".quangcao","#mobileCatfish",e("LmNsb3NlLWFkcw=="),'[id^="bn_bottom_fixed_"]',"#pmadv"],adBlockFinland:[".mainostila",e("LnNwb25zb3JpdA=="),".ylamainos",e("YVtocmVmKj0iL2NsaWNrdGhyZ2guYXNwPyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hcHAucmVhZHBlYWsuY29tL2FkcyJd")],adBlockPersian:["#navbar_notice_50",".kadr",'TABLE[width="140px"]',"#divAgahi",e("YVtocmVmXj0iaHR0cDovL2cxLnYuZndtcm0ubmV0L2FkLyJd")],adBlockWarningRemoval:["#adblock-honeypot",".adblocker-root",".wp_adblock_detect",e("LmhlYWRlci1ibG9ja2VkLWFk"),e("I2FkX2Jsb2NrZXI=")],adGuardAnnoyances:[".hs-sosyal","#cookieconsentdiv",'div[class^="app_gdpr"]',".as-oil",'[data-cypress="soft-push-notification-modal"]'],adGuardBase:[".BetterJsPopOverlay",e("I2FkXzMwMFgyNTA="),e("I2Jhbm5lcmZsb2F0MjI="),e("I2NhbXBhaWduLWJhbm5lcg=="),e("I0FkLUNvbnRlbnQ=")],adGuardChinese:[e("LlppX2FkX2FfSA=="),e("YVtocmVmKj0iLmh0aGJldDM0LmNvbSJd"),"#widget-quan",e("YVtocmVmKj0iLzg0OTkyMDIwLnh5eiJd"),e("YVtocmVmKj0iLjE5NTZobC5jb20vIl0=")],adGuardFrench:["#pavePub",e("LmFkLWRlc2t0b3AtcmVjdGFuZ2xl"),".mobile_adhesion",".widgetadv",e("LmFkc19iYW4=")],adGuardGerman:['aside[data-portal-id="leaderboard"]'],adGuardJapanese:["#kauli_yad_1",e("YVtocmVmXj0iaHR0cDovL2FkMi50cmFmZmljZ2F0ZS5uZXQvIl0="),e("Ll9wb3BJbl9pbmZpbml0ZV9hZA=="),e("LmFkZ29vZ2xl"),e("Ll9faXNib29zdFJldHVybkFk")],adGuardMobile:[e("YW1wLWF1dG8tYWRz"),e("LmFtcF9hZA=="),'amp-embed[type="24smi"]',"#mgid_iframe1",e("I2FkX2ludmlld19hcmVh")],adGuardRussian:[e("YVtocmVmXj0iaHR0cHM6Ly9hZC5sZXRtZWFkcy5jb20vIl0="),e("LnJlY2xhbWE="),'div[id^="smi2adblock"]',e("ZGl2W2lkXj0iQWRGb3hfYmFubmVyXyJd"),"#psyduckpockeball"],adGuardSocial:[e("YVtocmVmXj0iLy93d3cuc3R1bWJsZXVwb24uY29tL3N1Ym1pdD91cmw9Il0="),e("YVtocmVmXj0iLy90ZWxlZ3JhbS5tZS9zaGFyZS91cmw/Il0="),".etsy-tweet","#inlineShare",".popup-social"],adGuardSpanishPortuguese:["#barraPublicidade","#Publicidade","#publiEspecial","#queTooltip",".cnt-publi"],adGuardTrackingProtection:["#qoo-counter",e("YVtocmVmXj0iaHR0cDovL2NsaWNrLmhvdGxvZy5ydS8iXQ=="),e("YVtocmVmXj0iaHR0cDovL2hpdGNvdW50ZXIucnUvdG9wL3N0YXQucGhwIl0="),e("YVtocmVmXj0iaHR0cDovL3RvcC5tYWlsLnJ1L2p1bXAiXQ=="),"#top100counter"],adGuardTurkish:["#backkapat",e("I3Jla2xhbWk="),e("YVtocmVmXj0iaHR0cDovL2Fkc2Vydi5vbnRlay5jb20udHIvIl0="),e("YVtocmVmXj0iaHR0cDovL2l6bGVuemkuY29tL2NhbXBhaWduLyJd"),e("YVtocmVmXj0iaHR0cDovL3d3dy5pbnN0YWxsYWRzLm5ldC8iXQ==")],bulgarian:[e("dGQjZnJlZW5ldF90YWJsZV9hZHM="),"#ea_intext_div",".lapni-pop-over","#xenium_hot_offers"],easyList:[".yb-floorad",e("LndpZGdldF9wb19hZHNfd2lkZ2V0"),e("LnRyYWZmaWNqdW5reS1hZA=="),".textad_headline",e("LnNwb25zb3JlZC10ZXh0LWxpbmtz")],easyListChina:[e("LmFwcGd1aWRlLXdyYXBbb25jbGljayo9ImJjZWJvcy5jb20iXQ=="),e("LmZyb250cGFnZUFkdk0="),"#taotaole","#aafoot.top_box",".cfa_popup"],easyListCookie:[".ezmob-footer",".cc-CookieWarning","[data-cookie-number]",e("LmF3LWNvb2tpZS1iYW5uZXI="),".sygnal24-gdpr-modal-wrap"],easyListCzechSlovak:["#onlajny-stickers",e("I3Jla2xhbW5pLWJveA=="),e("LnJla2xhbWEtbWVnYWJvYXJk"),".sklik",e("W2lkXj0ic2tsaWtSZWtsYW1hIl0=")],easyListDutch:[e("I2FkdmVydGVudGll"),e("I3ZpcEFkbWFya3RCYW5uZXJCbG9jaw=="),".adstekst",e("YVtocmVmXj0iaHR0cHM6Ly94bHR1YmUubmwvY2xpY2svIl0="),"#semilo-lrectangle"],easyListGermany:["#SSpotIMPopSlider",e("LnNwb25zb3JsaW5rZ3J1ZW4="),e("I3dlcmJ1bmdza3k="),e("I3Jla2xhbWUtcmVjaHRzLW1pdHRl"),e("YVtocmVmXj0iaHR0cHM6Ly9iZDc0Mi5jb20vIl0=")],easyListItaly:[e("LmJveF9hZHZfYW5udW5jaQ=="),".sb-box-pubbliredazionale",e("YVtocmVmXj0iaHR0cDovL2FmZmlsaWF6aW9uaWFkcy5zbmFpLml0LyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hZHNlcnZlci5odG1sLml0LyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hZmZpbGlhemlvbmlhZHMuc25haS5pdC8iXQ==")],easyListLithuania:[e("LnJla2xhbW9zX3RhcnBhcw=="),e("LnJla2xhbW9zX251b3JvZG9z"),e("aW1nW2FsdD0iUmVrbGFtaW5pcyBza3lkZWxpcyJd"),e("aW1nW2FsdD0iRGVkaWt1b3RpLmx0IHNlcnZlcmlhaSJd"),e("aW1nW2FsdD0iSG9zdGluZ2FzIFNlcnZlcmlhaS5sdCJd")],estonian:[e("QVtocmVmKj0iaHR0cDovL3BheTRyZXN1bHRzMjQuZXUiXQ==")],fanboyAnnoyances:["#ac-lre-player",".navigate-to-top","#subscribe_popup",".newsletter_holder","#back-top"],fanboyAntiFacebook:[".util-bar-module-firefly-visible"],fanboyEnhancedTrackers:[".open.pushModal","#issuem-leaky-paywall-articles-zero-remaining-nag","#sovrn_container",'div[class$="-hide"][zoompage-fontsize][style="display: block;"]',".BlockNag__Card"],fanboySocial:["#FollowUs","#meteored_share","#social_follow",".article-sharer",".community__social-desc"],frellwitSwedish:[e("YVtocmVmKj0iY2FzaW5vcHJvLnNlIl1bdGFyZ2V0PSJfYmxhbmsiXQ=="),e("YVtocmVmKj0iZG9rdG9yLXNlLm9uZWxpbmsubWUiXQ=="),"article.category-samarbete",e("ZGl2LmhvbGlkQWRz"),"ul.adsmodern"],greekAdBlock:[e("QVtocmVmKj0iYWRtYW4ub3RlbmV0LmdyL2NsaWNrPyJd"),e("QVtocmVmKj0iaHR0cDovL2F4aWFiYW5uZXJzLmV4b2R1cy5nci8iXQ=="),e("QVtocmVmKj0iaHR0cDovL2ludGVyYWN0aXZlLmZvcnRobmV0LmdyL2NsaWNrPyJd"),"DIV.agores300","TABLE.advright"],hungarian:["#cemp_doboz",".optimonk-iframe-container",e("LmFkX19tYWlu"),e("W2NsYXNzKj0iR29vZ2xlQWRzIl0="),"#hirdetesek_box"],iDontCareAboutCookies:['.alert-info[data-block-track*="CookieNotice"]',".ModuleTemplateCookieIndicator",".o--cookies--container","#cookies-policy-sticky","#stickyCookieBar"],icelandicAbp:[e("QVtocmVmXj0iL2ZyYW1ld29yay9yZXNvdXJjZXMvZm9ybXMvYWRzLmFzcHgiXQ==")],latvian:[e("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiAxMjBweDsgaGVpZ2h0OiA0MHB4OyBvdmVyZmxvdzogaGlkZGVuOyBwb3NpdGlvbjogcmVsYXRpdmU7Il0="),e("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiA4OHB4OyBoZWlnaHQ6IDMxcHg7IG92ZXJmbG93OiBoaWRkZW47IHBvc2l0aW9uOiByZWxhdGl2ZTsiXQ==")],listKr:[e("YVtocmVmKj0iLy9hZC5wbGFuYnBsdXMuY28ua3IvIl0="),e("I2xpdmVyZUFkV3JhcHBlcg=="),e("YVtocmVmKj0iLy9hZHYuaW1hZHJlcC5jby5rci8iXQ=="),e("aW5zLmZhc3R2aWV3LWFk"),".revenue_unit_item.dable"],listeAr:[e("LmdlbWluaUxCMUFk"),".right-and-left-sponsers",e("YVtocmVmKj0iLmFmbGFtLmluZm8iXQ=="),e("YVtocmVmKj0iYm9vcmFxLm9yZyJd"),e("YVtocmVmKj0iZHViaXp6bGUuY29tL2FyLz91dG1fc291cmNlPSJd")],listeFr:[e("YVtocmVmXj0iaHR0cDovL3Byb21vLnZhZG9yLmNvbS8iXQ=="),e("I2FkY29udGFpbmVyX3JlY2hlcmNoZQ=="),e("YVtocmVmKj0id2Vib3JhbWEuZnIvZmNnaS1iaW4vIl0="),".site-pub-interstitiel",'div[id^="crt-"][data-criteo-id]'],officialPolish:["#ceneo-placeholder-ceneo-12",e("W2hyZWZePSJodHRwczovL2FmZi5zZW5kaHViLnBsLyJd"),e("YVtocmVmXj0iaHR0cDovL2Fkdm1hbmFnZXIudGVjaGZ1bi5wbC9yZWRpcmVjdC8iXQ=="),e("YVtocmVmXj0iaHR0cDovL3d3dy50cml6ZXIucGwvP3V0bV9zb3VyY2UiXQ=="),e("ZGl2I3NrYXBpZWNfYWQ=")],ro:[e("YVtocmVmXj0iLy9hZmZ0cmsuYWx0ZXgucm8vQ291bnRlci9DbGljayJd"),e("YVtocmVmXj0iaHR0cHM6Ly9ibGFja2ZyaWRheXNhbGVzLnJvL3Ryay9zaG9wLyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9ldmVudC4ycGVyZm9ybWFudC5jb20vZXZlbnRzL2NsaWNrIl0="),e("YVtocmVmXj0iaHR0cHM6Ly9sLnByb2ZpdHNoYXJlLnJvLyJd"),'a[href^="/url/"]'],ruAd:[e("YVtocmVmKj0iLy9mZWJyYXJlLnJ1LyJd"),e("YVtocmVmKj0iLy91dGltZy5ydS8iXQ=="),e("YVtocmVmKj0iOi8vY2hpa2lkaWtpLnJ1Il0="),"#pgeldiz",".yandex-rtb-block"],thaiAds:["a[href*=macau-uta-popup]",e("I2Fkcy1nb29nbGUtbWlkZGxlX3JlY3RhbmdsZS1ncm91cA=="),e("LmFkczMwMHM="),".bumq",".img-kosana"],webAnnoyancesUltralist:["#mod-social-share-2","#social-tools",e("LmN0cGwtZnVsbGJhbm5lcg=="),".zergnet-recommend",".yt.btn-link.btn-md.btn"]}}function Ua(e){var t=(e===void 0?{}:e).debug;return K(this,void 0,void 0,function(){var r,n,a,i,s,o;return q(this,function(l){switch(l.label){case 0:return Ba()?(r=$a(),n=Object.keys(r),a=(o=[]).concat.apply(o,n.map(function(c){return r[c]})),[4,Ga(a)]):[2,void 0];case 1:return i=l.sent(),t&&Ya(r,i),s=n.filter(function(c){var u=r[c];return P(u.map(function(h){return i[h]}))>u.length*.6}),s.sort(),[2,s]}})})}function Ba(){return H()||Lt()}function Ga(e){var t;return K(this,void 0,void 0,function(){var r,n,a,i,l,s,o,l;return q(this,function(c){switch(c.label){case 0:for(r=document,n=r.createElement("div"),a=new Array(e.length),i={},Ut(n),l=0;l<e.length;++l)s=na(e[l]),s.tagName==="DIALOG"&&s.show(),o=r.createElement("div"),Ut(o),o.appendChild(s),n.appendChild(o),a[l]=s;c.label=1;case 1:return r.body?[3,3]:[4,Xe(50)];case 2:return c.sent(),[3,1];case 3:r.body.appendChild(n);try{for(l=0;l<e.length;++l)a[l].offsetParent||(i[e[l]]=!0)}finally{(t=n.parentNode)===null||t===void 0||t.removeChild(n)}return[2,i]}})})}function Ut(e){e.style.setProperty("visibility","hidden","important"),e.style.setProperty("display","block","important")}function Ya(e,t){for(var r="DOM blockers debug:\n```",n=0,a=Object.keys(e);n<a.length;n++){var i=a[n];r+=`
|
|
3
|
+
`.concat(i,":");for(var s=0,o=e[i];s<o.length;s++){var l=o[s];r+=`
|
|
4
|
+
`.concat(t[l]?"🚫":"➡️"," ").concat(l)}}}function Ha(){for(var e=0,t=["rec2020","p3","srgb"];e<t.length;e++){var r=t[e];if(matchMedia("(color-gamut: ".concat(r,")")).matches)return r}}function Xa(){if(Bt("inverted"))return!0;if(Bt("none"))return!1}function Bt(e){return matchMedia("(inverted-colors: ".concat(e,")")).matches}function Ja(){if(Gt("active"))return!0;if(Gt("none"))return!1}function Gt(e){return matchMedia("(forced-colors: ".concat(e,")")).matches}var Qa=100;function Ka(){if(matchMedia("(min-monochrome: 0)").matches){for(var e=0;e<=Qa;++e)if(matchMedia("(max-monochrome: ".concat(e,")")).matches)return e;throw new Error("Too high value")}}function qa(){if(me("no-preference"))return 0;if(me("high")||me("more"))return 1;if(me("low")||me("less"))return-1;if(me("forced"))return 10}function me(e){return matchMedia("(prefers-contrast: ".concat(e,")")).matches}function ei(){if(Yt("reduce"))return!0;if(Yt("no-preference"))return!1}function Yt(e){return matchMedia("(prefers-reduced-motion: ".concat(e,")")).matches}function ti(){if(Ht("reduce"))return!0;if(Ht("no-preference"))return!1}function Ht(e){return matchMedia("(prefers-reduced-transparency: ".concat(e,")")).matches}function ri(){if(Xt("high"))return!0;if(Xt("standard"))return!1}function Xt(e){return matchMedia("(dynamic-range: ".concat(e,")")).matches}var T=Math,V=function(){return 0};function ni(){var e=T.acos||V,t=T.acosh||V,r=T.asin||V,n=T.asinh||V,a=T.atanh||V,i=T.atan||V,s=T.sin||V,o=T.sinh||V,l=T.cos||V,c=T.cosh||V,u=T.tan||V,h=T.tanh||V,m=T.exp||V,p=T.expm1||V,_=T.log1p||V,k=function(N){return T.pow(T.PI,N)},L=function(N){return T.log(N+T.sqrt(N*N-1))},w=function(N){return T.log(N+T.sqrt(N*N+1))},C=function(N){return T.log((1+N)/(1-N))/2},Z=function(N){return T.exp(N)-1/T.exp(N)/2},$=function(N){return(T.exp(N)+1/T.exp(N))/2},ee=function(N){return T.exp(N)-1},X=function(N){return(T.exp(2*N)-1)/(T.exp(2*N)+1)},ie=function(N){return T.log(1+N)};return{acos:e(.12312423423423424),acosh:t(1e308),acoshPf:L(1e154),asin:r(.12312423423423424),asinh:n(1),asinhPf:w(1),atanh:a(.5),atanhPf:C(.5),atan:i(.5),sin:s(-1e300),sinh:o(1),sinhPf:Z(1),cos:l(10.000000000123),cosh:c(1),coshPf:$(1),tan:u(-1e300),tanh:h(1),tanhPf:X(1),exp:m(1),expm1:p(1),expm1Pf:ee(1),log1p:_(10),log1pPf:ie(10),powPI:k(-100)}}var ai="mmMwWLliI0fiflO&1",tt={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};function ii(){return si(function(e,t){for(var r={},n={},a=0,i=Object.keys(tt);a<i.length;a++){var s=i[a],o=tt[s],l=o[0],c=l===void 0?{}:l,u=o[1],h=u===void 0?ai:u,m=e.createElement("span");m.textContent=h,m.style.whiteSpace="nowrap";for(var p=0,_=Object.keys(c);p<_.length;p++){var k=_[p],L=c[k];L!==void 0&&(m.style[k]=L)}r[s]=m,t.append(e.createElement("br"),m)}for(var w=0,C=Object.keys(tt);w<C.length;w++){var s=C[w];n[s]=r[s].getBoundingClientRect().width}return n})}function si(e,t){return t===void 0&&(t=4e3),yr(function(r,n){var a=n.document,i=a.body,s=i.style;s.width="".concat(t,"px"),s.webkitTextSizeAdjust=s.textSizeAdjust="none",Ce()?i.style.zoom="".concat(1/n.devicePixelRatio):H()&&(i.style.zoom="reset");var o=a.createElement("div");return o.textContent=hr([],Array(t/20<<0),!0).map(function(){return"word"}).join(" "),i.appendChild(o),e(a,i)},'<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">')}function oi(){return navigator.pdfViewerEnabled}function ci(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],t[3]}function di(){var e=window.ApplePaySession;if(typeof e?.canMakePayments!="function")return-1;if(li())return-3;try{return e.canMakePayments()?1:0}catch(t){return ui(t)}}var li=ia;function ui(e){if(e instanceof Error&&e.name==="InvalidAccessError"&&/\bfrom\b.*\binsecure\b/i.test(e.message))return-2;throw e}function hi(){var e,t=document.createElement("a"),r=(e=t.attributionSourceId)!==null&&e!==void 0?e:t.attributionsourceid;return r===void 0?void 0:String(r)}var kr=-1,br=-2,fi=new Set([10752,2849,2884,2885,2886,2928,2929,2930,2931,2932,2960,2961,2962,2963,2964,2965,2966,2967,2968,2978,3024,3042,3088,3089,3106,3107,32773,32777,32777,32823,32824,32936,32937,32938,32939,32968,32969,32970,32971,3317,33170,3333,3379,3386,33901,33902,34016,34024,34076,3408,3410,3411,3412,3413,3414,3415,34467,34816,34817,34818,34819,34877,34921,34930,35660,35661,35724,35738,35739,36003,36004,36005,36347,36348,36349,37440,37441,37443,7936,7937,7938]),mi=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),pi=["FRAGMENT_SHADER","VERTEX_SHADER"],gi=["LOW_FLOAT","MEDIUM_FLOAT","HIGH_FLOAT","LOW_INT","MEDIUM_INT","HIGH_INT"],xr="WEBGL_debug_renderer_info",vi="WEBGL_polygon_mode";function yi(e){var t,r,n,a,i,s,o=e.cache,l=_r(o);if(!l)return kr;if(!Sr(l))return br;var c=wr()?null:l.getExtension(xr);return{version:((t=l.getParameter(l.VERSION))===null||t===void 0?void 0:t.toString())||"",vendor:((r=l.getParameter(l.VENDOR))===null||r===void 0?void 0:r.toString())||"",vendorUnmasked:c?(n=l.getParameter(c.UNMASKED_VENDOR_WEBGL))===null||n===void 0?void 0:n.toString():"",renderer:((a=l.getParameter(l.RENDERER))===null||a===void 0?void 0:a.toString())||"",rendererUnmasked:c?(i=l.getParameter(c.UNMASKED_RENDERER_WEBGL))===null||i===void 0?void 0:i.toString():"",shadingLanguageVersion:((s=l.getParameter(l.SHADING_LANGUAGE_VERSION))===null||s===void 0?void 0:s.toString())||""}}function ki(e){var t=e.cache,r=_r(t);if(!r)return kr;if(!Sr(r))return br;var n=r.getSupportedExtensions(),a=r.getContextAttributes(),i=[],s=[],o=[],l=[],c=[];if(a)for(var u=0,h=Object.keys(a);u<h.length;u++){var m=h[u];s.push("".concat(m,"=").concat(a[m]))}for(var p=Jt(r),_=0,k=p;_<k.length;_++){var L=k[_],w=r[L];o.push("".concat(L,"=").concat(w).concat(fi.has(w)?"=".concat(r.getParameter(w)):""))}if(n)for(var C=0,Z=n;C<Z.length;C++){var $=Z[C];if(!($===xr&&wr()||$===vi&&_i())){var ee=r.getExtension($);if(!ee){i.push($);continue}for(var X=0,ie=Jt(ee);X<ie.length;X++){var L=ie[X],w=ee[L];l.push("".concat(L,"=").concat(w).concat(mi.has(w)?"=".concat(r.getParameter(w)):""))}}}for(var N=0,E=pi;N<E.length;N++)for(var O=E[N],be=0,Te=gi;be<Te.length;be++){var Zt=Te[be],Gr=bi(r,O,Zt);c.push("".concat(O,".").concat(Zt,"=").concat(Gr.join(",")))}return l.sort(),o.sort(),{contextAttributes:s,parameters:o,shaderPrecisions:c,extensions:n,extensionParameters:l,unsupportedExtensions:i}}function _r(e){if(e.webgl)return e.webgl.context;var t=document.createElement("canvas"),r;t.addEventListener("webglCreateContextError",function(){r=void 0});for(var n=0,a=["webgl","experimental-webgl"];n<a.length;n++){var i=a[n];try{r=t.getContext(i)}catch{}if(r)break}return e.webgl={context:r},r}function bi(e,t,r){var n=e.getShaderPrecisionFormat(e[t],e[r]);return n?[n.rangeMin,n.rangeMax,n.precision]:[]}function Jt(e){return Object.keys(e.__proto__).filter(xi)}function xi(e){return typeof e=="string"&&!e.match(/[^A-Z0-9_x]/)}function wr(){return vr()}function _i(){return Ce()||H()}function Sr(e){return typeof e.getParameter=="function"}function wi(){if(!(Lt()||H()))return-2;if(!window.AudioContext)return-1;var e=new AudioContext().baseLatency;return e==null?-1:isFinite(e)?e:-3}function Si(){if(!window.Intl)return-1;var e=window.Intl.DateTimeFormat;if(!e)return-2;var t=e().resolvedOptions().locale;return!t&&t!==""?-3:t}var ji={fonts:ca,domBlockers:Ua,fontPreferences:ii,audio:Qn,screenFrame:La,canvas:la,osCpu:ba,languages:xa,colorDepth:_a,deviceMemory:wa,screenResolution:Sa,hardwareConcurrency:Ra,timezone:Aa,sessionStorage:Ea,localStorage:Ma,indexedDB:Oa,openDatabase:Va,cpuClass:Pa,platform:Fa,plugins:da,touchSupport:ka,vendor:Wa,vendorFlavors:za,cookiesEnabled:Da,colorGamut:Ha,invertedColors:Xa,forcedColors:Ja,monochrome:Ka,contrast:qa,reducedMotion:ei,reducedTransparency:ti,hdr:ri,math:ni,pdfViewerEnabled:oi,architecture:ci,applePay:di,privateClickMeasurement:hi,audioBaseLatency:wi,dateTimeLocale:Si,webGlBasics:yi,webGlExtensions:ki};function Ci(e){return Dn(ji,e,[])}var Ii="$ if upgrade to Pro: https://fpjs.dev/pro";function Ni(e){var t=Ti(e),r=Li(t);return{score:t,comment:Ii.replace(/\$/g,"".concat(r))}}function Ti(e){if(Lt())return .4;if(H())return Tt()&&!(Ne()&&Ie())?.5:.3;var t="value"in e.platform?e.platform.value:"";return/^Win/.test(t)?.6:/^Mac/.test(t)?.5:.7}function Li(e){return pr(.99+.01*e,1e-4)}function Ri(e){for(var t="",r=0,n=Object.keys(e).sort();r<n.length;r++){var a=n[r],i=e[a],s="error"in i?"error":JSON.stringify(i.value);t+="".concat(t?"|":"").concat(a.replace(/([:|\\])/g,"\\$1"),":").concat(s)}return t}function Ai(e){return JSON.stringify(e,function(t,r){return r instanceof Error?Pn(r):r},2)}function jr(e){return Vn(Ri(e))}function Zi(e){var t;return{get visitorId(){return t===void 0&&(t=jr(this.components)),t},set visitorId(r){t=r},confidence:Ni(e),components:e,version:fr}}function Ei(e){return e===void 0&&(e=50),Nn(e,e*2)}function Mi(e,t){var r=Date.now();return{get:function(n){return K(this,void 0,void 0,function(){var a,i,s;return q(this,function(o){switch(o.label){case 0:return a=Date.now(),[4,e()];case 1:return i=o.sent(),s=Zi(i),t||n?.debug,[2,s]}})})}}}function Oi(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var e=new XMLHttpRequest;e.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(fr,"/npm-monitoring"),!0),e.send()}catch{}}function Vi(e){var t;return e===void 0&&(e={}),K(this,void 0,void 0,function(){var r,n,a;return q(this,function(i){switch(i.label){case 0:return(!((t=e.monitoring)!==null&&t!==void 0)||t)&&Oi(),r=e.delayFallback,n=e.debug,[4,Ei(r)];case 1:return i.sent(),a=Ci({cache:{},debug:n}),[2,Mi(a,n)]}})})}var Pi={load:Vi,hashComponents:jr,componentsToDebugString:Ai},Cr=class{constructor(e){this.baseUrl=e}async validateWidget(e,t){if(!t)return{valid:!1,error:"Widget is not configured: tenantId is required"};try{const r=new URLSearchParams({agentId:e,tenantId:t}),n=await fetch(`${this.baseUrl}/v1/widget/validate?${r}`),a=await n.json();return n.ok&&a.success?{valid:!0,agentId:a.data.agentId,tenantId:a.data.tenantId}:{valid:!1,error:a.error??`Widget configuration is invalid (${n.status})`}}catch{return{valid:!1,error:"Unable to reach the AgentForge API to validate widget configuration"}}}async chat(e){const t=await fetch(`${this.baseUrl}/v1/agents/${encodeURIComponent(e.agentId)}/responses`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e.message,sessionId:e.sessionId,tenantId:e.tenantId,externalId:e.externalId,name:e.name,email:e.email,authId:e.authId,fingerprint:e.fingerprint,metadata:e.metadata,imageUrl:e.imageUrl})});if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);const r=await t.json();if(!r.success)throw new Error(r.error??"Unknown API error");return{content:r.data?.text??"",sessionId:r.data?.sessionId,images:r.data?.images}}async fetchSessionMessages(e){try{const t=await fetch(`${this.baseUrl}/v1/sessions/${encodeURIComponent(e)}/messages`);if(t.status===410||!t.ok)return null;const r=await t.json();return r.success?r.data?.messages??null:null}catch{return null}}async uploadImage(e,t,r,n,a){const i=await fetch(`${this.baseUrl}/v1/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:e,mimeType:t,fileName:r,agentId:n,tenantId:a})});if(!i.ok)throw new Error(`Upload error: ${i.status} ${i.statusText}`);const s=await i.json();if(!s.success)throw new Error(s.error??"Upload failed");return{url:s.data.url}}async fetchWidgetConfig(e,t){try{const r=t?`?tenantId=${encodeURIComponent(t)}`:"",n=await fetch(`${this.baseUrl}/v1/agents/${encodeURIComponent(e)}/widget-config${r}`);if(!n.ok)return null;const a=await n.json();return a.success?a.data:null}catch{return null}}async endSession(e,t,r,n,a){const i=await fetch(`${this.baseUrl}/v1/sessions/${encodeURIComponent(e)}/end`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tenantId:t,agentId:r,fingerprint:n,externalId:a})});if(!i.ok)throw new Error(`Failed to end session: ${i.status} ${i.statusText}`);const s=await i.json();if(!s.success)throw new Error(s.error??"Failed to end session")}},Fi=12e4;function Wi(e){return Promise.race([e.read(),new Promise((t,r)=>setTimeout(()=>r(new Error("Stream timed out — no data received for 120s")),Fi))])}async function Ir(e,t,r){let n="",a="";try{const i=await fetch(`${e}/v1/agents/${encodeURIComponent(t.agentId)}/responses:stream`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:t.message,sessionId:t.sessionId,tenantId:t.tenantId,externalId:t.externalId,name:t.name,email:t.email,authId:t.authId,fingerprint:t.fingerprint,metadata:t.metadata,imageUrl:t.imageUrl})});if(!i.ok||!i.body){let h=`${i.status} ${i.statusText}`;try{const m=await i.json();m.error&&(h=m.error)}catch{}throw new Error(h)}const s=i.headers.get("x-session-id");s&&r.onSession&&r.onSession(s);const o=i.body.getReader(),l=new TextDecoder;let c="";const u=h=>{if(!h.startsWith("data: "))return!1;const m=h.slice(6).trim();if(!m)return!1;if(m==="[DONE]")return r.onEnd(n),!0;try{const p=JSON.parse(m);if(p.type==="session"){const k=p.sessionId;return k&&r.onSession&&r.onSession(k),!1}if(p.type==="done"||p.type==="stop")return r.onEnd(n),!0;if(p.type==="error")throw new Error(p.message??"Stream error");if(p.type==="images"){const k=p.images;return k&&r.onImages&&r.onImages(k),!1}if(p.type==="thinking_chunk"){const k=p.content;return k&&r.onThinkingDelta&&(a+=k,r.onThinkingDelta(k,a)),!1}const _=zi(p);_&&(n+=_,r.onDelta(_,n))}catch(p){if(!(p instanceof SyntaxError))throw p}return!1};e:for(;;){const{done:h,value:m}=await Wi(o);if(h)break;c+=l.decode(m,{stream:!0});const p=c.lastIndexOf(`
|
|
5
|
+
`);if(p===-1)continue;const _=c.slice(0,p);c=c.slice(p+1);for(const k of _.split(`
|
|
6
|
+
`))if(u(k))break e}r.onEnd(n)}catch(i){r.onError(i instanceof Error?i:new Error(String(i)))}}function zi(e){const t=e.choices;if(Array.isArray(t)&&t.length>0){const a=t[0]?.delta,i=a?.content??a?.text??"";if(i)return i}const r=e.delta;if(r){const a=r.content??r.text??"";if(a)return a}const n=e.response;return n||(e.text??e.content??"")}var Nr=class{listeners=new Map;on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t)}off(e,t){this.listeners.get(e)?.delete(t)}emit(...e){const[t,r]=e;this.listeners.get(t)?.forEach(n=>n(r))}removeAllListeners(){this.listeners.clear()}},Di="agentforge";function Rt(e){return`${Di}:session:${e}`}function Tr(e){try{return sessionStorage.getItem(Rt(e))??void 0}catch{return}}function Oe(e,t){try{sessionStorage.setItem(Rt(e),t)}catch{}}function wt(e){try{sessionStorage.removeItem(Rt(e))}catch{}}function Ae(){return`msg-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`}var Lr=class{config;apiClient;state;fingerprint;emitter;constructor(e,t,r){this.hostConfig=t,this.onStateChange=r,this.config=e,this.apiClient=new Cr(e.apiBaseUrl),this.emitter=new Nr,this.initializeFingerprint();const n=e.sessionId??Tr(e.agentId);e.sessionId&&Oe(e.agentId,e.sessionId);const a=e.mode==="inline";this.state={isOpen:a,messages:[],isLoading:!1,error:null,sessionId:n,initStatus:"validating",initError:null},a&&queueMicrotask(()=>this.openWithGreeting())}async initializeFingerprint(){try{this.fingerprint=(await(await Pi.load()).get()).visitorId}catch{this.fingerprint=void 0}}getState(){return{...this.state,messages:[...this.state.messages]}}setOpen(e){e?this.openWithGreeting():this.setState({isOpen:!1})}openWithGreeting(){this.state.initStatus!=="error"&&this.setState({isOpen:!0})}async hydrate(){const e=await this.apiClient.validateWidget(this.config.agentId,this.config.tenantId);if(!e.valid){this.setState({initStatus:"error",initError:e.error});return}const t=await this.apiClient.fetchWidgetConfig(this.config.agentId,this.config.tenantId);if(t&&(this.config=Qe(this.hostConfig,t),this.onStateChange(this.getState(),this.config)),this.setState({initStatus:"ready"}),!this.state.sessionId)return;const r=await this.apiClient.fetchSessionMessages(this.state.sessionId);if(r===null){this.handleSessionExpired();return}if(r.length===0)return;const n=r.map(a=>({id:Ae(),role:a.role,content:a.content,images:a.images&&a.images.length>0?a.images:void 0,uploadedImageUrl:a.imageUrl||void 0,createdAt:a.createdAt??new Date().toISOString(),status:"sent"}));this.setState({messages:[...this.state.messages,...n]})}setState(e){this.state={...this.state,...e},this.onStateChange(this.getState(),this.config)}updateMessage(e,t){this.state={...this.state,messages:this.state.messages.map(r=>r.id===e?{...r,...t}:r)},this.onStateChange(this.getState(),this.config)}async resetConversation(){if(this.state.sessionId)try{await this.apiClient.endSession(this.state.sessionId,this.config.tenantId,this.config.agentId,this.fingerprint,this.config.user.externalId)}catch{}wt(this.config.agentId),this.setState({sessionId:void 0,messages:[],isLoading:!1,error:null}),this.emitter.emit("reset",void 0),this.state.isOpen&&this.openWithGreeting()}handleSessionExpired(){wt(this.config.agentId),this.setState({sessionId:void 0})}async sendMessage(e,t){if(this.state.isLoading||!e.trim()&&!t||this.state.initStatus!=="ready")return;let r;if(t)try{const i=await $i(t);r=(await this.apiClient.uploadImage(i,t.type,t.name,this.config.agentId,this.config.tenantId)).url}catch(i){const s=i instanceof Error?i.message:"Image upload failed";this.setState({error:s});return}const n={id:Ae(),role:"user",content:e.trim(),uploadedImageUrl:r,createdAt:new Date().toISOString(),status:"sent"},a=!this.state.messages.some(i=>i.role==="user");this.setState({messages:[...this.state.messages,n],isLoading:!0,error:null}),this.emitter.emit("message:sent",n),a&&this.emitter.emit("conversation:started",{sessionId:this.state.sessionId}),this.config.streaming?await this.sendStreaming(e.trim(),r):await this.sendNonStreaming(e.trim(),r)}async sendNonStreaming(e,t,r=!1){try{const n=await this.apiClient.chat({agentId:this.config.agentId,message:e,sessionId:this.state.sessionId,tenantId:this.config.tenantId,externalId:this.config.user.externalId,name:this.config.user.name,email:this.config.user.email,authId:this.config.user.authId,fingerprint:this.fingerprint,metadata:this.config.metadata,imageUrl:t}),a={id:Ae(),role:"assistant",content:n.content,images:n.images,createdAt:new Date().toISOString(),status:"sent"};this.setState({messages:[...this.state.messages,a],isLoading:!1,...n.sessionId?{sessionId:n.sessionId}:{}}),n.sessionId&&Oe(this.config.agentId,n.sessionId),this.emitter.emit("message:received",a)}catch(n){const a=n instanceof Error?n.message:"Failed to send message";if(!r&&a.includes("410"))return this.handleSessionExpired(),this.sendNonStreaming(e,t,!0);this.setState({isLoading:!1,error:a}),this.emitter.emit("message:error",{error:a,message:null})}}async sendStreaming(e,t,r=!1){const n=Ae(),a={id:n,role:"assistant",content:"",createdAt:new Date().toISOString(),status:"streaming",isThinking:this.config.thinkingEnabled?!0:void 0};this.setState({messages:[...this.state.messages,a]}),this.emitter.emit("stream:start");let i=!1;await Ir(this.config.apiBaseUrl,{agentId:this.config.agentId,message:e,sessionId:this.state.sessionId,tenantId:this.config.tenantId,externalId:this.config.user.externalId,name:this.config.user.name,email:this.config.user.email,authId:this.config.user.authId,fingerprint:this.fingerprint,metadata:this.config.metadata,imageUrl:t},{onSession:s=>{this.setState({sessionId:s}),Oe(this.config.agentId,s)},onImages:s=>{this.updateMessage(n,{images:s})},onThinkingDelta:(s,o)=>{this.updateMessage(n,{thinking:o,isThinking:!0}),this.emitter.emit("thinking:delta",{delta:s,accumulated:o})},onDelta:(s,o)=>{this.updateMessage(n,{content:o,isThinking:!1}),this.emitter.emit("stream:delta",{delta:s,accumulated:o})},onEnd:s=>{this.updateMessage(n,{content:s,status:"sent",isThinking:!1}),this.setState({isLoading:!1}),this.emitter.emit("stream:end",{content:s});const o=this.state.messages.find(l=>l.id===n);o&&(o.thinking&&this.emitter.emit("thinking:end",{content:o.thinking}),this.emitter.emit("message:received",o))},onError:s=>{if(!r&&s.message.includes("410")){i=!0,this.setState({messages:this.state.messages.filter(c=>c.id!==n),isLoading:!1});return}const o=this.state.messages.find(c=>c.id===n)?.content??"",l=s.message||"Something went wrong. Please try again.";this.updateMessage(n,{content:o||l,status:"error"}),this.setState({isLoading:!1,error:l}),this.emitter.emit("message:error",{error:s.message,message:null})}}),i&&(this.handleSessionExpired(),await this.sendStreaming(e,t,!0))}};function $i(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>{const a=n.result;t(a.split(",")[1]??"")},n.onerror=()=>r(new Error("Failed to read file")),n.readAsDataURL(e)})}function Rr(e){const t=document.createElement("div");t.setAttribute("data-agentkit-widget",""),e.appendChild(t);const r=t.attachShadow({mode:"open"}),n=document.createElement("style");r.appendChild(n);const a=document.createElement("div");return a.style.cssText="display: contents;",r.appendChild(a),{host:t,shadowRoot:r,styleSlot:n,mountPoint:a}}function Ar(e,t){e.textContent=t}function Zr(e){e.remove()}function Er(){const e=document.createElement("div");return e.setAttribute("data-agentkit-root","floating"),e.style.cssText=["position: fixed","bottom: 24px","right: 24px","z-index: 2147483647","pointer-events: none"].join("; "),document.body.appendChild(e),e}function Ui(e){getComputedStyle(e).position==="static"&&(e.style.position="relative");const t=document.createElement("div");return t.setAttribute("data-agentkit-root","floating"),t.style.cssText=["position: absolute","bottom: 24px","right: 24px","z-index: 2147483647","pointer-events: none"].join("; "),e.appendChild(t),t}function Mr(e){return e.setAttribute("data-agentkit-root","inline"),getComputedStyle(e).position==="static"&&(e.style.position="relative"),e}function Bi(e){e.remove()}function Gi(e){e.removeAttribute("data-agentkit-root")}function At(e,t,r,n,a){const i=e.mode==="inline";let s=!1;const o=i&&a?Mr(a):!i&&a?Ui(a):Er(),l=Rr(o);Ar(l.styleSlot,n);const c=new Lr(e,t,(m,p)=>{s||u.update(m,p)}),u=r(l.mountPoint,e,c.getState(),{onOpen:()=>h.open(),onClose:()=>h.close(),onSendMessage:(m,p)=>{c.sendMessage(m,p)},onReset:()=>{c.resetConversation()}});c.hydrate(),setTimeout(()=>{s||c.emitter.emit("ready",c.getState())},0);const h={open(){s||(c.setOpen(!0),c.emitter.emit("open"))},close(){s||(c.setOpen(!1),c.emitter.emit("close"))},toggle(){c.getState().isOpen?h.close():h.open()},async sendMessage(m,p){await c.sendMessage(m,p)},reset(){s||(c.resetConversation(),c.emitter.emit("reset"))},destroy(){s||(s=!0,u.destroy(),Zr(l.host),i&&a?Gi(a):Bi(o),c.emitter.emit("destroy"),c.emitter.removeAllListeners())},on(m,p){c.emitter.on(m,p)},off(m,p){c.emitter.off(m,p)},getState(){return c.getState()}};return h}var ve=new Map,Yi=0;function Or(e){const t=`agentkit-widget-${++Yi}`,r=e.destroy.bind(e);return e.destroy=()=>{ve.delete(t),r()},ve.set(t,e),t}function Hi(e,t,r){const n={...e,mode:"floating"},a=At(Qe(n),n,t,r);return Or(a),a}function Xi(e,t,r,n){const a={...t,mode:"inline"},i=At(Qe(a),a,r,n,e);return Or(i),i}function Ji(e){e?ve.get(e)?.destroy():(ve.forEach(t=>t.destroy()),ve.clear())}function Qi(){return Array.from(ve.keys())}function Vr(e){const{theme:t}=e,r=[`--ak-accent: ${t.accentColor}`,`--ak-font: ${t.fontFamily}`,`--ak-radius: ${t.borderRadius}`];return r.push(`--ak-accent-hover: color-mix(in srgb, ${t.accentColor} 85%, black)`),`:host { ${r.join("; ")} }`}function Pr(e){return e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Fr=`
|
|
7
7
|
*, *::before, *::after {
|
|
8
8
|
box-sizing: border-box;
|
|
9
9
|
margin: 0;
|
|
@@ -146,6 +146,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let Yr=requir
|
|
|
146
146
|
/* ── Header ──────────────────────────────────────────────────── */
|
|
147
147
|
.ak-header {
|
|
148
148
|
display: flex;
|
|
149
|
+
flex-direction: row;
|
|
149
150
|
align-items: center;
|
|
150
151
|
justify-content: space-between;
|
|
151
152
|
padding: 14px 18px;
|
|
@@ -154,6 +155,19 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let Yr=requir
|
|
|
154
155
|
flex-shrink: 0;
|
|
155
156
|
gap: 8px;
|
|
156
157
|
}
|
|
158
|
+
.ak-header--confirming {
|
|
159
|
+
flex-direction: column;
|
|
160
|
+
align-items: stretch;
|
|
161
|
+
justify-content: flex-start;
|
|
162
|
+
gap: 0;
|
|
163
|
+
}
|
|
164
|
+
.ak-header__row {
|
|
165
|
+
display: flex;
|
|
166
|
+
align-items: center;
|
|
167
|
+
justify-content: space-between;
|
|
168
|
+
width: 100%;
|
|
169
|
+
gap: 8px;
|
|
170
|
+
}
|
|
157
171
|
.ak-header__status {
|
|
158
172
|
width: 8px;
|
|
159
173
|
height: 8px;
|
|
@@ -218,6 +232,103 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let Yr=requir
|
|
|
218
232
|
color: #fff;
|
|
219
233
|
flex-shrink: 0;
|
|
220
234
|
}
|
|
235
|
+
.ak-header__button {
|
|
236
|
+
width: 28px;
|
|
237
|
+
height: 28px;
|
|
238
|
+
border-radius: 50%;
|
|
239
|
+
background: transparent;
|
|
240
|
+
border: none;
|
|
241
|
+
cursor: pointer;
|
|
242
|
+
display: flex;
|
|
243
|
+
align-items: center;
|
|
244
|
+
justify-content: center;
|
|
245
|
+
color: #fff;
|
|
246
|
+
transition: background 0.15s;
|
|
247
|
+
flex-shrink: 0;
|
|
248
|
+
}
|
|
249
|
+
.ak-header__button:hover {
|
|
250
|
+
background: rgba(255, 255, 255, 0.15);
|
|
251
|
+
}
|
|
252
|
+
.ak-header__button--active {
|
|
253
|
+
background: rgba(255, 255, 255, 0.3);
|
|
254
|
+
}
|
|
255
|
+
.ak-header__confirm {
|
|
256
|
+
width: 100%;
|
|
257
|
+
display: flex;
|
|
258
|
+
align-items: center;
|
|
259
|
+
justify-content: space-between;
|
|
260
|
+
gap: 8px;
|
|
261
|
+
padding: 8px 0 0;
|
|
262
|
+
margin: 8px 0 0;
|
|
263
|
+
border-top: 1px solid rgba(255, 255, 255, 0.2);
|
|
264
|
+
animation: ak-confirm-in 0.18s ease-out;
|
|
265
|
+
}
|
|
266
|
+
@keyframes ak-confirm-in {
|
|
267
|
+
from { opacity: 0; transform: translateY(-4px); }
|
|
268
|
+
to { opacity: 1; transform: translateY(0); }
|
|
269
|
+
}
|
|
270
|
+
.ak-header__confirm-text {
|
|
271
|
+
display: flex;
|
|
272
|
+
flex-direction: column;
|
|
273
|
+
gap: 1px;
|
|
274
|
+
flex: 1;
|
|
275
|
+
min-width: 0;
|
|
276
|
+
}
|
|
277
|
+
.ak-header__confirm-title {
|
|
278
|
+
font-size: 13px;
|
|
279
|
+
font-weight: 600;
|
|
280
|
+
color: #fff;
|
|
281
|
+
line-height: 1.3;
|
|
282
|
+
}
|
|
283
|
+
.ak-header__confirm-sub {
|
|
284
|
+
font-size: 11px;
|
|
285
|
+
color: rgba(255, 255, 255, 0.75);
|
|
286
|
+
line-height: 1.3;
|
|
287
|
+
}
|
|
288
|
+
.ak-header__confirm-actions {
|
|
289
|
+
display: flex;
|
|
290
|
+
align-items: center;
|
|
291
|
+
gap: 6px;
|
|
292
|
+
flex-shrink: 0;
|
|
293
|
+
}
|
|
294
|
+
.ak-header__confirm-cancel {
|
|
295
|
+
padding: 5px 10px;
|
|
296
|
+
border-radius: 6px;
|
|
297
|
+
border: 1px solid rgba(255, 255, 255, 0.4);
|
|
298
|
+
background: transparent;
|
|
299
|
+
color: #fff;
|
|
300
|
+
font-family: var(--ak-font);
|
|
301
|
+
font-size: 12px;
|
|
302
|
+
font-weight: 500;
|
|
303
|
+
cursor: pointer;
|
|
304
|
+
transition: background 0.15s;
|
|
305
|
+
white-space: nowrap;
|
|
306
|
+
}
|
|
307
|
+
.ak-header__confirm-cancel:hover {
|
|
308
|
+
background: rgba(255, 255, 255, 0.15);
|
|
309
|
+
}
|
|
310
|
+
.ak-header__confirm-cancel:active {
|
|
311
|
+
background: rgba(255, 255, 255, 0.25);
|
|
312
|
+
}
|
|
313
|
+
.ak-header__confirm-ok {
|
|
314
|
+
padding: 5px 10px;
|
|
315
|
+
border-radius: 6px;
|
|
316
|
+
border: none;
|
|
317
|
+
background: rgba(255, 255, 255, 0.2);
|
|
318
|
+
color: #fff;
|
|
319
|
+
font-family: var(--ak-font);
|
|
320
|
+
font-size: 12px;
|
|
321
|
+
font-weight: 600;
|
|
322
|
+
cursor: pointer;
|
|
323
|
+
transition: background 0.15s;
|
|
324
|
+
white-space: nowrap;
|
|
325
|
+
}
|
|
326
|
+
.ak-header__confirm-ok:hover {
|
|
327
|
+
background: rgba(239, 68, 68, 0.7);
|
|
328
|
+
}
|
|
329
|
+
.ak-header__confirm-ok:active {
|
|
330
|
+
background: rgba(239, 68, 68, 0.85);
|
|
331
|
+
}
|
|
221
332
|
|
|
222
333
|
/* ── Message list ────────────────────────────────────────────── */
|
|
223
334
|
.ak-messages {
|
|
@@ -237,6 +348,115 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let Yr=requir
|
|
|
237
348
|
border-radius: 4px;
|
|
238
349
|
}
|
|
239
350
|
|
|
351
|
+
/* ── Empty state ─────────────────────────────────────────────── */
|
|
352
|
+
.ak-empty-state {
|
|
353
|
+
flex: 1;
|
|
354
|
+
position: relative;
|
|
355
|
+
display: flex;
|
|
356
|
+
flex-direction: column;
|
|
357
|
+
align-items: center;
|
|
358
|
+
justify-content: center;
|
|
359
|
+
padding: 0;
|
|
360
|
+
text-align: center;
|
|
361
|
+
gap: 16px;
|
|
362
|
+
overflow-y: auto;
|
|
363
|
+
overflow-x: hidden;
|
|
364
|
+
min-height: 0;
|
|
365
|
+
background: radial-gradient(ellipse 110% 55% at 50% 0%,
|
|
366
|
+
color-mix(in srgb, var(--ak-accent) 10%, var(--ak-bg)),
|
|
367
|
+
var(--ak-bg) 72%
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
/* Decorative blurred orb behind the avatar */
|
|
371
|
+
.ak-empty-state__glow {
|
|
372
|
+
position: absolute;
|
|
373
|
+
top: -24px;
|
|
374
|
+
left: 50%;
|
|
375
|
+
transform: translateX(-50%);
|
|
376
|
+
width: 180px;
|
|
377
|
+
height: 180px;
|
|
378
|
+
border-radius: 50%;
|
|
379
|
+
background: color-mix(in srgb, var(--ak-accent) 18%, transparent);
|
|
380
|
+
filter: blur(48px);
|
|
381
|
+
pointer-events: none;
|
|
382
|
+
}
|
|
383
|
+
.ak-empty-state__body {
|
|
384
|
+
display: flex;
|
|
385
|
+
flex-direction: column;
|
|
386
|
+
align-items: center;
|
|
387
|
+
gap: 8px;
|
|
388
|
+
position: relative;
|
|
389
|
+
}
|
|
390
|
+
.ak-empty-state__avatar {
|
|
391
|
+
width: 64px;
|
|
392
|
+
height: 64px;
|
|
393
|
+
border-radius: 50%;
|
|
394
|
+
background: var(--ak-bg);
|
|
395
|
+
border: 2px solid color-mix(in srgb, var(--ak-accent) 25%, var(--ak-border));
|
|
396
|
+
box-shadow:
|
|
397
|
+
0 0 0 4px color-mix(in srgb, var(--ak-accent) 10%, transparent),
|
|
398
|
+
0 4px 16px color-mix(in srgb, var(--ak-accent) 20%, transparent);
|
|
399
|
+
display: flex;
|
|
400
|
+
align-items: center;
|
|
401
|
+
justify-content: center;
|
|
402
|
+
color: var(--ak-accent);
|
|
403
|
+
margin-bottom: 4px;
|
|
404
|
+
flex-shrink: 0;
|
|
405
|
+
}
|
|
406
|
+
.ak-empty-state__avatar-img {
|
|
407
|
+
width: 64px;
|
|
408
|
+
height: 64px;
|
|
409
|
+
border-radius: 50%;
|
|
410
|
+
object-fit: cover;
|
|
411
|
+
}
|
|
412
|
+
.ak-empty-state__bot-icon {
|
|
413
|
+
display: flex;
|
|
414
|
+
align-items: center;
|
|
415
|
+
justify-content: center;
|
|
416
|
+
}
|
|
417
|
+
.ak-empty-state__title {
|
|
418
|
+
margin: 0;
|
|
419
|
+
font-size: 16px;
|
|
420
|
+
font-weight: 700;
|
|
421
|
+
color: var(--ak-text);
|
|
422
|
+
line-height: 1.3;
|
|
423
|
+
letter-spacing: -0.01em;
|
|
424
|
+
}
|
|
425
|
+
.ak-empty-state__description {
|
|
426
|
+
margin: 0;
|
|
427
|
+
font-size: 13px;
|
|
428
|
+
color: var(--ak-text-muted);
|
|
429
|
+
line-height: 1.55;
|
|
430
|
+
max-width: 260px;
|
|
431
|
+
}
|
|
432
|
+
/* Quoted greeting block */
|
|
433
|
+
.ak-empty-state__quote {
|
|
434
|
+
position: relative;
|
|
435
|
+
max-width: 280px;
|
|
436
|
+
width: calc(100% - 32px);
|
|
437
|
+
background: color-mix(in srgb, var(--ak-accent) 6%, var(--ak-bg));
|
|
438
|
+
border: 1px solid color-mix(in srgb, var(--ak-accent) 18%, var(--ak-border));
|
|
439
|
+
border-radius: 12px;
|
|
440
|
+
padding: 12px 14px 12px 16px;
|
|
441
|
+
text-align: left;
|
|
442
|
+
}
|
|
443
|
+
.ak-empty-state__quote-mark {
|
|
444
|
+
display: block;
|
|
445
|
+
font-size: 32px;
|
|
446
|
+
line-height: 1;
|
|
447
|
+
color: var(--ak-accent);
|
|
448
|
+
margin-bottom: 2px;
|
|
449
|
+
font-family: Georgia, serif;
|
|
450
|
+
opacity: 0.7;
|
|
451
|
+
}
|
|
452
|
+
.ak-empty-state__quote-text {
|
|
453
|
+
margin: 0;
|
|
454
|
+
font-size: 13px;
|
|
455
|
+
color: var(--ak-text-muted);
|
|
456
|
+
line-height: 1.55;
|
|
457
|
+
font-style: italic;
|
|
458
|
+
}
|
|
459
|
+
|
|
240
460
|
/* ── Message bubbles ─────────────────────────────────────────── */
|
|
241
461
|
.ak-message {
|
|
242
462
|
display: flex;
|
|
@@ -266,6 +486,9 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let Yr=requir
|
|
|
266
486
|
max-width: 100%;
|
|
267
487
|
min-width: 0;
|
|
268
488
|
}
|
|
489
|
+
.ak-message__bubble--md {
|
|
490
|
+
white-space: normal;
|
|
491
|
+
}
|
|
269
492
|
.ak-message--user .ak-message__bubble {
|
|
270
493
|
background: var(--ak-user-bg);
|
|
271
494
|
color: var(--ak-user-text);
|
|
@@ -435,6 +658,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let Yr=requir
|
|
|
435
658
|
|
|
436
659
|
/* ── Composer ────────────────────────────────────────────────── */
|
|
437
660
|
.ak-composer {
|
|
661
|
+
position: relative; /* establishes positioning context for the attachment submenu */
|
|
438
662
|
padding: 10px 14px 12px;
|
|
439
663
|
border-top: 1px solid var(--ak-border);
|
|
440
664
|
display: flex;
|
|
@@ -464,6 +688,11 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let Yr=requir
|
|
|
464
688
|
border-color: var(--ak-accent);
|
|
465
689
|
}
|
|
466
690
|
|
|
691
|
+
/* Attach button wrapper */
|
|
692
|
+
.ak-composer__attach-wrap {
|
|
693
|
+
flex-shrink: 0;
|
|
694
|
+
}
|
|
695
|
+
|
|
467
696
|
/* "+" attachment button — square with rounded corners */
|
|
468
697
|
.ak-composer__attach {
|
|
469
698
|
width: 28px;
|
|
@@ -476,18 +705,62 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let Yr=requir
|
|
|
476
705
|
align-items: center;
|
|
477
706
|
justify-content: center;
|
|
478
707
|
color: var(--ak-text-muted);
|
|
479
|
-
transition: color 0.15s, border-color 0.15s;
|
|
708
|
+
transition: color 0.15s, border-color 0.15s, background 0.15s;
|
|
480
709
|
flex-shrink: 0;
|
|
481
710
|
}
|
|
482
711
|
.ak-composer__attach:hover:not(:disabled) {
|
|
483
712
|
color: var(--ak-accent);
|
|
484
713
|
border-color: var(--ak-accent);
|
|
485
714
|
}
|
|
715
|
+
.ak-composer__attach--open {
|
|
716
|
+
color: var(--ak-accent);
|
|
717
|
+
border-color: var(--ak-accent);
|
|
718
|
+
background: color-mix(in srgb, var(--ak-accent) 8%, transparent);
|
|
719
|
+
}
|
|
486
720
|
.ak-composer__attach:disabled {
|
|
487
721
|
opacity: 0.4;
|
|
488
722
|
cursor: not-allowed;
|
|
489
723
|
}
|
|
490
724
|
|
|
725
|
+
/* Attachment submenu — floats above the composer, positioned relative to .ak-composer */
|
|
726
|
+
.ak-composer__attach-menu {
|
|
727
|
+
position: absolute;
|
|
728
|
+
bottom: calc(100% + 6px);
|
|
729
|
+
left: 14px;
|
|
730
|
+
background: var(--ak-surface);
|
|
731
|
+
border: 1px solid var(--ak-border);
|
|
732
|
+
border-radius: 10px;
|
|
733
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
734
|
+
padding: 4px;
|
|
735
|
+
min-width: 130px;
|
|
736
|
+
z-index: 10;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
/* Individual item inside the attachment submenu */
|
|
740
|
+
.ak-composer__attach-menu-item {
|
|
741
|
+
display: flex;
|
|
742
|
+
align-items: center;
|
|
743
|
+
gap: 8px;
|
|
744
|
+
width: 100%;
|
|
745
|
+
padding: 7px 10px;
|
|
746
|
+
border: none;
|
|
747
|
+
border-radius: 7px;
|
|
748
|
+
background: transparent;
|
|
749
|
+
color: var(--ak-text);
|
|
750
|
+
font-family: var(--ak-font);
|
|
751
|
+
font-size: 13px;
|
|
752
|
+
cursor: pointer;
|
|
753
|
+
transition: background 0.12s;
|
|
754
|
+
text-align: left;
|
|
755
|
+
}
|
|
756
|
+
.ak-composer__attach-menu-item:hover:not(:disabled) {
|
|
757
|
+
background: var(--ak-bg);
|
|
758
|
+
}
|
|
759
|
+
.ak-composer__attach-menu-item:disabled {
|
|
760
|
+
opacity: 0.4;
|
|
761
|
+
cursor: not-allowed;
|
|
762
|
+
}
|
|
763
|
+
|
|
491
764
|
/* Textarea — borderless, transparent, sits inside the container */
|
|
492
765
|
.ak-composer__input {
|
|
493
766
|
flex: 1;
|
|
@@ -605,11 +878,16 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let Yr=requir
|
|
|
605
878
|
min-width: 0;
|
|
606
879
|
}
|
|
607
880
|
.ak-message__bubble--md .ak-md-p {
|
|
608
|
-
margin
|
|
881
|
+
margin: 0 0 0.4em 0;
|
|
609
882
|
}
|
|
610
883
|
.ak-message__bubble--md .ak-md-p:last-child {
|
|
611
884
|
margin-bottom: 0;
|
|
612
885
|
}
|
|
886
|
+
/* Collapse margins between paragraph and following list */
|
|
887
|
+
.ak-message__bubble--md .ak-md-p + .ak-md-ul,
|
|
888
|
+
.ak-message__bubble--md .ak-md-p + .ak-md-ol {
|
|
889
|
+
margin-top: 0;
|
|
890
|
+
}
|
|
613
891
|
.ak-message__bubble--md .ak-md-h1,
|
|
614
892
|
.ak-message__bubble--md .ak-md-h2,
|
|
615
893
|
.ak-message__bubble--md .ak-md-h3 {
|
|
@@ -628,7 +906,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let Yr=requir
|
|
|
628
906
|
.ak-message__bubble--md .ak-md-ul,
|
|
629
907
|
.ak-message__bubble--md .ak-md-ol {
|
|
630
908
|
padding-left: 1.4em;
|
|
631
|
-
margin: 0.
|
|
909
|
+
margin: 0.4em 0;
|
|
632
910
|
}
|
|
633
911
|
.ak-message__bubble--md .ak-md-ul li,
|
|
634
912
|
.ak-message__bubble--md .ak-md-ol li {
|
|
@@ -859,7 +1137,9 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let Yr=requir
|
|
|
859
1137
|
opacity: 0.75;
|
|
860
1138
|
letter-spacing: -0.01em;
|
|
861
1139
|
}
|
|
862
|
-
`;function Ki(){return(0,
|
|
863
|
-
|
|
864
|
-
`)})})]},a++));continue}const o=i.match(/^(#{1,6})(\s+.*)?$/);if(o){const d=o[1].length,u=o[2]?z(o[2].trim()):"";d===1?r.push((0,l.jsx)("h1",{className:"ak-md-h1",children:u},a++)):d===2?r.push((0,l.jsx)("h2",{className:"ak-md-h2",children:u},a++)):d===3?r.push((0,l.jsx)("h3",{className:"ak-md-h3",children:u},a++)):d===4?r.push((0,l.jsx)("h4",{className:"ak-md-h4",children:u},a++)):d===5?r.push((0,l.jsx)("h5",{className:"ak-md-h5",children:u},a++)):r.push((0,l.jsx)("h6",{className:"ak-md-h6",children:u},a++)),n++;continue}if(/^[-*_]{3,}$/.test(i.trim())){r.push((0,l.jsx)("hr",{className:"ak-md-hr"},a++)),n++;continue}if(/^[-*+]\s/.test(i)){const d=[];let u=n;for(;u<t.length&&(/^[-*+]\s/.test(t[u])||t[u].trim()==="");){if(t[u].trim()===""){u++;continue}const h=t[u].length-t[u].trimStart().length,m=t[u].replace(/^[-*+]\s+/,""),p=[],j=[];let b=u+1;for(;b<t.length&&b<u+20;){const S=t[b];if(S.length-S.trimStart().length>h&&S.trim()!==""){const _=S.trim();/^[-*+]\s/.test(_)?p.push((0,l.jsx)("li",{children:z(_.replace(/^[-*+]\s+/,""))},`nested-${b}`)):j.push((0,l.jsx)("p",{style:{margin:"0.2em 0 0"},children:z(_)},`cont-${b}`)),b++}else break}const Z=j.length>0||p.length>0?(0,l.jsxs)(l.Fragment,{children:[z(m),j,p.length>0&&(0,l.jsx)("ul",{style:{margin:"0.2em 0 0",paddingLeft:"1.2em"},children:p})]}):z(m);d.push((0,l.jsx)("li",{children:Z},`item-${u}`)),u=b}r.push((0,l.jsx)("ul",{className:"ak-md-ul",children:d},a++)),n=u;continue}if(/^\d+\.\s/.test(i)){const d=[];let u=n;for(;u<t.length&&(/^\d+\.\s/.test(t[u])||t[u].trim()==="");){if(t[u].trim()===""){u++;continue}const h=t[u].length-t[u].trimStart().length,m=t[u].replace(/^\d+\.\s+/,""),p=[],j=[];let b=u+1;for(;b<t.length&&b<u+20;){const S=t[b];if(S.length-S.trimStart().length>h&&S.trim()!==""){const _=S.trim();/^\d+\.\s/.test(_)?p.push((0,l.jsx)("li",{children:z(_.replace(/^\d+\.\s+/,""))},`nested-order-${b}`)):/^[-*+]\s/.test(_)?p.push((0,l.jsx)("li",{children:z(_.replace(/^[-*+]\s+/,""))},`nested-unorder-${b}`)):j.push((0,l.jsx)("p",{style:{margin:"0.2em 0 0"},children:z(_)},`cont-${b}`)),b++}else break}const Z=j.length>0||p.length>0?(0,l.jsxs)(l.Fragment,{children:[z(m),j,p.length>0&&(0,l.jsx)("ol",{style:{margin:"0.2em 0 0",paddingLeft:"1.2em"},children:p})]}):z(m);d.push((0,l.jsx)("li",{children:Z},`order-item-${u}`)),u=b}r.push((0,l.jsx)("ol",{className:"ak-md-ol",children:d},a++)),n=u;continue}if(i.trim()===""){n++;continue}const c=[];for(;n<t.length&&t[n].trim()!==""&&!t[n].startsWith("#")&&!/^\s*```/.test(t[n])&&!/^[-*+]\s/.test(t[n])&&!/^\d+\.\s/.test(t[n])&&!/^[-*_]{3,}$/.test(t[n].trim());)c.push(t[n]),n++;if(c.length>0){const d=[];c.forEach((u,h)=>{d.push(...z(u)),h<c.length-1&&d.push((0,l.jsx)("br",{},`br-${h}`))}),r.push((0,l.jsx)("p",{className:"ak-md-p",children:d},a++))}}return(0,l.jsx)(l.Fragment,{children:r})}function zr({message:e,thinkingViewable:t=!1}){const r=e.role==="user",n=e.status==="error",a=e.status==="streaming",i=!!(e.images&&e.images.length>0),s=!!(r&&e.uploadedImageUrl),o=i||s,c=!r&&!n,d=r?"ak-message--user":n?"ak-message--assistant ak-message--error":"ak-message--assistant",u=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:["ak-message__bubble",c?"ak-message__bubble--md":"",o?"ak-message__bubble--has-image":""].filter(Boolean).join(" "),children:[s&&(0,l.jsx)("div",{className:"ak-message__images",children:(0,l.jsxs)("div",{className:"ak-message__image-wrap",children:[(0,l.jsx)("a",{href:e.uploadedImageUrl,className:"ak-message__image-link",children:(0,l.jsx)("img",{src:e.uploadedImageUrl,alt:"Uploaded image",className:"ak-message__image"})}),(0,l.jsx)("a",{href:e.uploadedImageUrl,download:!0,className:"ak-message__image-dl-icon",title:"Download image",onClick:m=>m.stopPropagation(),children:(0,l.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,l.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,l.jsx)("polyline",{points:"7 10 12 15 17 10"}),(0,l.jsx)("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})})]})}),i&&(0,l.jsx)("div",{className:"ak-message__images",children:e.images.map((m,p)=>{const j=m.url??(m.base64?`data:${m.mimeType};base64,${m.base64}`:null);return j?(0,l.jsxs)("div",{className:"ak-message__image-wrap",children:[(0,l.jsx)("a",{href:j,className:"ak-message__image-link",children:(0,l.jsx)("img",{src:j,alt:"Generated image",className:"ak-message__image"})}),(0,l.jsx)("a",{href:j,download:!0,className:"ak-message__image-dl-icon",title:"Download image",onClick:b=>b.stopPropagation(),children:(0,l.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,l.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,l.jsx)("polyline",{points:"7 10 12 15 17 10"}),(0,l.jsx)("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})})]},p):null})}),(e.content||a&&!e.isThinking)&&(0,l.jsxs)("div",{className:o?"ak-message__image-caption":void 0,children:[c?rs(e.content):e.content,a&&!e.isThinking&&(0,l.jsxs)("span",{className:"ak-cursor","aria-hidden":"true",children:[(0,l.jsx)("span",{className:"ak-cursor__dot"}),(0,l.jsx)("span",{className:"ak-cursor__dot"}),(0,l.jsx)("span",{className:"ak-cursor__dot"})]})]})]}),(0,l.jsx)("span",{className:"ak-message__time",children:ts(e.createdAt)})]}),h=!e.isThinking||!!e.content;return(0,l.jsxs)("div",{className:`ak-message ${d}`,children:[!r&&(0,l.jsx)(es,{thinking:e.thinking,isThinking:e.isThinking??!1,thinkingViewable:t}),h&&u]})}function Dr(){return(0,l.jsxs)("div",{className:"ak-typing","aria-label":"Assistant is typing",children:[(0,l.jsx)("span",{className:"ak-typing__dot"}),(0,l.jsx)("span",{className:"ak-typing__dot"}),(0,l.jsx)("span",{className:"ak-typing__dot"})]})}function Ur({messages:e,isLoading:t,thinkingViewable:r}){const n=(0,O.useRef)(null),a=e.find(s=>s.status==="streaming")?.content??"",i=e.find(s=>s.isThinking)?.thinking??"";return(0,O.useEffect)(()=>{n.current?.scrollIntoView({behavior:"smooth"})},[e.length,t,a,i]),(0,l.jsxs)("div",{className:"ak-messages",role:"log","aria-live":"polite","aria-label":"Conversation",children:[e.map(s=>(0,l.jsx)(zr,{message:s,thinkingViewable:r},s.id)),t&&!e.some(s=>s.status==="streaming")&&(0,l.jsx)(Dr,{}),(0,l.jsx)("div",{ref:n})]})}function ns(){return(0,l.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,l.jsx)("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),(0,l.jsx)("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})}function as(){return(0,l.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[(0,l.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,l.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function is(){return(0,l.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,l.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,l.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function $r({onSend:e,disabled:t=!1,placeholder:r="Type a message…",privacyPolicyUrl:n}){const[a,i]=(0,O.useState)(""),[s,o]=(0,O.useState)(null),[c,d]=(0,O.useState)(null),u=(0,O.useRef)(null),h=(0,O.useRef)(null);(0,O.useEffect)(()=>()=>{c&&URL.revokeObjectURL(c)},[c]),(0,O.useEffect)(()=>{t||u.current?.focus()},[t]);function m(){o(null),c&&URL.revokeObjectURL(c),d(null),h.current&&(h.current.value="")}function p(){const _=a.trim();!_&&!s||t||(e(_,s??void 0),i(""),m(),u.current&&(u.current.style.height="auto"))}function j(_){_.key==="Enter"&&!_.shiftKey&&(_.preventDefault(),p())}function b(_){const L=_.currentTarget;i(L.value),L.style.height="auto",L.style.height=`${L.scrollHeight}px`}function Z(_){const L=_.currentTarget.files?.[0];if(L){if(L.size>5*1024*1024){alert("Image must be smaller than 5 MB."),_.currentTarget.value="";return}c&&URL.revokeObjectURL(c),o(L),d(URL.createObjectURL(L))}}const S=!t&&(!!a.trim()||!!s);return(0,l.jsxs)("div",{className:"ak-composer",children:[c&&(0,l.jsx)("div",{className:"ak-composer__preview",children:(0,l.jsxs)("div",{className:"ak-composer__preview-wrap",children:[(0,l.jsx)("img",{src:c,alt:"Selected",className:"ak-composer__preview-img"}),(0,l.jsx)("button",{className:"ak-composer__preview-remove",onClick:m,type:"button","aria-label":"Remove image",disabled:t,children:(0,l.jsx)(is,{})})]})}),(0,l.jsxs)("div",{className:"ak-composer__input-wrap",children:[(0,l.jsx)("input",{ref:h,type:"file",accept:"image/jpeg,image/png,image/gif,image/webp",className:"ak-composer__file-input",onChange:Z,disabled:t,"aria-label":"Attach image"}),(0,l.jsx)("button",{className:"ak-composer__attach",onClick:()=>h.current?.click(),disabled:t,"aria-label":"Attach image",type:"button",children:(0,l.jsx)(as,{})}),(0,l.jsx)("textarea",{ref:u,className:"ak-composer__input",value:a,onInput:b,onKeyDown:j,placeholder:r,disabled:t,rows:1,"aria-label":"Message input"}),(0,l.jsx)("button",{className:"ak-composer__send",onClick:p,disabled:!S,"aria-label":"Send message",type:"button",children:(0,l.jsx)(ns,{})})]}),(0,l.jsxs)("p",{className:"ak-composer__disclaimer",children:["By chatting with us, you agree to our"," ",n?(0,l.jsx)("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}):"Privacy Policy"]})]})}function xt({message:e}){return e.includes("Origin not allowed")?(0,l.jsxs)("div",{className:"ak-error ak-error--origin",role:"alert",children:[(0,l.jsx)("div",{className:"ak-error__icon",children:"🔒"}),(0,l.jsxs)("div",{className:"ak-error__content",children:[(0,l.jsx)("h3",{className:"ak-error__title",children:"Access Restricted"}),(0,l.jsx)("p",{className:"ak-error__description",children:"This widget has been restricted to specific websites only."}),(0,l.jsx)("p",{className:"ak-error__message",children:"Contact the website administrator if you believe this is an error."})]})]}):(0,l.jsxs)("div",{className:"ak-error",role:"alert",children:[(0,l.jsx)("div",{className:"ak-error__icon",children:"⚠️"}),(0,l.jsx)("div",{className:"ak-error__content",children:(0,l.jsx)("p",{className:"ak-error__message",children:e})})]})}function ss(){return(0,l.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:"ak-branding__logo",children:[(0,l.jsx)("rect",{width:"24",height:"24",rx:"5",fill:"currentColor"}),(0,l.jsx)("path",{d:"M12 5L7 13h3.5v6l6.5-9H13.5V5z",fill:"white"})]})}function os(){return(0,l.jsxs)("div",{className:"ak-branding",children:[(0,l.jsx)(ss,{}),(0,l.jsx)("span",{className:"ak-branding__label",children:"Powered by"}),(0,l.jsx)("span",{className:"ak-branding__name",children:"AgentForge"})]})}function _t({config:e,messages:t,isLoading:r,error:n,isInline:a,initStatus:i,initError:s,callbacks:o}){return(0,l.jsxs)("div",{className:a?"ak-shell-wrap":"ak-shell-wrap ak-shell-enter",children:[(0,l.jsxs)("div",{className:a?"ak-shell ak-shell--inline":"ak-shell ak-shell--floating",role:"dialog","aria-label":e.title,children:[(0,l.jsx)(Wr,{title:e.title,subtitle:e.subtitle,avatarUrl:e.avatarUrl,onClose:o.onClose,hideClose:a}),i==="validating"&&(0,l.jsx)("div",{className:"ak-init-status",children:(0,l.jsx)("div",{className:"ak-init-spinner","aria-label":"Connecting…"})}),i==="error"&&(0,l.jsx)("div",{className:"ak-init-status ak-init-status--error",children:(0,l.jsx)(xt,{message:s??"Widget configuration is invalid."})}),i==="ready"&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Ur,{messages:t,isLoading:r,thinkingViewable:e.thinkingViewable}),n&&(0,l.jsx)(xt,{message:n}),(0,l.jsx)($r,{onSend:o.onSendMessage,disabled:r,placeholder:"Type a message…",privacyPolicyUrl:e.privacyPolicyUrl})]})]}),!a&&(0,l.jsx)(os,{})]})}function cs(){return(0,l.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,l.jsx)("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function ds(){return(0,l.jsxs)("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[(0,l.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,l.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function Br({isOpen:e,onClick:t,avatarUrl:r,ariaLabel:n="Toggle chat"}){const a=!e&&!!r;return(0,l.jsx)("button",{className:`ak-launcher${a?" ak-launcher--avatar":""}`,onClick:t,"aria-label":n,"aria-expanded":e,type:"button",children:e?(0,l.jsx)(ds,{}):a?(0,l.jsx)("img",{src:r,alt:"",className:"ak-launcher__avatar-img","aria-hidden":"true"}):(0,l.jsx)(cs,{})})}function wt({config:e,state:t,callbacks:r}){const n=e.mode==="inline",a=(0,O.useRef)(null);return(0,O.useEffect)(()=>{const i=a.current?.getRootNode()?.host;if(!i)return;const s=Pr(e.theme.mode);i.setAttribute("data-theme",s)},[e.theme.mode]),n?(0,l.jsx)("div",{ref:a,className:"ak-inline",children:(0,l.jsx)(_t,{config:e,messages:t.messages,isLoading:t.isLoading,error:t.error,isInline:!0,initStatus:t.initStatus,initError:t.initError,callbacks:r})}):(0,l.jsxs)("div",{ref:a,className:"ak-floating",children:[t.isOpen&&(0,l.jsx)(_t,{config:e,messages:t.messages,isLoading:t.isLoading,error:t.error,isInline:!1,initStatus:t.initStatus,initError:t.initError,callbacks:r}),(0,l.jsx)(Br,{isOpen:t.isOpen,onClick:t.isOpen?r.onClose:r.onOpen,avatarUrl:e.avatarUrl})]})}var ls=(e,t,r,n)=>{const a=(0,Yr.createRoot)(e);return a.render((0,O.createElement)(wt,{config:t,state:r,callbacks:n})),{update(i,s){a.render((0,O.createElement)(wt,{config:s,state:i,callbacks:n}))},destroy(){setTimeout(()=>{a.unmount()},0)}}};function us(e){return Fr+`
|
|
865
|
-
|
|
1140
|
+
`;function Ki(){return(0,d.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("rect",{x:"3",y:"11",width:"18",height:"10",rx:"2"}),(0,d.jsx)("circle",{cx:"12",cy:"5",r:"2"}),(0,d.jsx)("path",{d:"M12 7v4"}),(0,d.jsx)("line",{x1:"8",y1:"16",x2:"8",y2:"16"}),(0,d.jsx)("line",{x1:"16",y1:"16",x2:"16",y2:"16"})]})}function qi(){return(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function es(){return(0,d.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),(0,d.jsx)("path",{d:"M3 3v5h5"})]})}function Wr({title:e,subtitle:t,avatarUrl:r,onClose:n,onReset:a,hideClose:i=!1}){const[s,o]=(0,A.useState)(!1);return(0,d.jsxs)("div",{className:`ak-header${s?" ak-header--confirming":""}`,children:[(0,d.jsxs)("div",{className:"ak-header__row",children:[r?(0,d.jsx)("img",{src:r,alt:"",className:"ak-header__avatar","aria-hidden":"true"}):(0,d.jsx)("span",{className:"ak-header__bot-icon","aria-hidden":"true",children:(0,d.jsx)(Ki,{})}),(0,d.jsxs)("div",{className:"ak-header__title-group",children:[(0,d.jsx)("span",{className:"ak-header__title",children:e}),t&&(0,d.jsx)("span",{className:"ak-header__subtitle",children:t})]}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,d.jsx)("span",{className:"ak-header__status","aria-hidden":"true"}),a&&(0,d.jsx)("button",{className:`ak-header__button${s?" ak-header__button--active":""}`,onClick:()=>o(!0),"aria-label":"New conversation",type:"button",title:"Start a new conversation (Retains current conversation to memory)",children:(0,d.jsx)(es,{})}),!i&&(0,d.jsx)("button",{className:"ak-header__close",onClick:n,"aria-label":"Close chat",type:"button",children:(0,d.jsx)(qi,{})})]})]}),s&&(0,d.jsxs)("div",{className:"ak-header__confirm",role:"alert",children:[(0,d.jsxs)("div",{className:"ak-header__confirm-text",children:[(0,d.jsx)("span",{className:"ak-header__confirm-title",children:"End this conversation?"}),(0,d.jsx)("span",{className:"ak-header__confirm-sub",children:"All messages will be removed"})]}),(0,d.jsxs)("div",{className:"ak-header__confirm-actions",children:[(0,d.jsx)("button",{className:"ak-header__confirm-cancel",type:"button",onClick:()=>o(!1),children:"Cancel"}),(0,d.jsx)("button",{className:"ak-header__confirm-ok",type:"button",onClick:()=>{a?.(),o(!1)},children:"End chat"})]})]})]})}function ts({thinking:e,isThinking:t,thinkingViewable:r}){const[n,a]=(0,A.useState)(!1);return!t&&!e?null:t?(0,d.jsx)("div",{className:"ak-thinking",children:(0,d.jsxs)("div",{className:"ak-thinking__indicator",children:[(0,d.jsx)("span",{className:"ak-thinking__label",children:"Thinking"}),(0,d.jsxs)("span",{className:"ak-cursor","aria-hidden":"true",children:[(0,d.jsx)("span",{className:"ak-cursor__dot"}),(0,d.jsx)("span",{className:"ak-cursor__dot"}),(0,d.jsx)("span",{className:"ak-cursor__dot"})]})]})}):!r||!e?null:(0,d.jsxs)("div",{className:"ak-thinking ak-thinking--done",children:[(0,d.jsxs)("button",{className:"ak-thinking__toggle",onClick:()=>a(i=>!i),"aria-expanded":n,type:"button",children:[(0,d.jsx)("svg",{className:`ak-thinking__chevron${n?" ak-thinking__chevron--open":""}`,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,d.jsx)("polyline",{points:"6 9 12 15 18 9"})}),(0,d.jsx)("span",{children:"Thought for a moment"})]}),n&&(0,d.jsx)("div",{className:"ak-thinking__content",children:e})]})}function rs(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}var Qt=/(`[^`\n]+`|\*\*[^*\n]+\*\*|\*[^*\n]+\*|!\[[^\]\n]*\]\([^)\n]+\)|\[[^\]\n]+\]\([^)\n]+\))/g;function U(e){const t=[];let r=0,n=0;Qt.lastIndex=0;let a;for(;(a=Qt.exec(e))!==null;){a.index>r&&t.push(e.slice(r,a.index));const i=a[0];if(i.startsWith("`"))t.push((0,d.jsx)("code",{className:"ak-md-ic",children:i.slice(1,-1)},n++));else if(i.startsWith("**"))t.push((0,d.jsx)("strong",{children:i.slice(2,-2)},n++));else if(i.startsWith("*"))t.push((0,d.jsx)("em",{children:i.slice(1,-1)},n++));else if(i.startsWith("![")){const s=i.match(/!\[([^\]]*)\]\(([^)]+)\)/);s&&t.push((0,d.jsx)("a",{href:s[2],target:"_blank",rel:"noopener noreferrer",children:s[1]||"image"},n++))}else{const s=i.match(/\[(.+?)\]\((.+?)\)/);s?t.push((0,d.jsx)("a",{href:s[2],target:"_blank",rel:"noopener noreferrer",children:s[1]},n++)):t.push(i)}r=a.index+i.length}return r<e.length&&t.push(e.slice(r)),t}function ns(e){e=e.replace(/\\text\{([^}]*)\}/g,"$1").replace(/\\implies/g,"→").replace(/\\Rightarrow/g,"⟹").replace(/\\times/g,"×").replace(/\\div/g,"÷").replace(/\\cdot/g,"·").replace(/\\quad/g," ").replace(/\\qquad/g," ").replace(/\\leq/g,"≤").replace(/\\geq/g,"≥").replace(/\\neq/g,"≠").replace(/\\approx/g,"≈").replace(/\\infty/g,"∞").replace(/\\\((.+?)\\\)/gs,"$1").replace(/\\\[[\s\S]+?\\\]/g,"").replace(/\\\$/g,"\0DOLLAR\0").replace(/\$\$[\s\S]+?\$\$/g,"").replace(/\$([^$]+)\$/g,"$1").replace(/\x00DOLLAR\x00/g,"$").replace(/\\[a-zA-Z]+\*?/g,"").replace(/\n{3,}/g,`
|
|
1141
|
+
|
|
1142
|
+
`);const t=e.split(`
|
|
1143
|
+
`),r=[];let n=0,a=0;for(;n<t.length;){const i=t[n],s=i.match(/^(\s*)```/);if(s){const c=s[1],u=i.trimStart().match(/^```(\w+)?\s*$/)?.[1]||"",h=[];for(n++;n<t.length&&!t[n].trimStart().startsWith("```");)h.push(t[n].startsWith(c)?t[n].slice(c.length):t[n]),n++;n<t.length&&t[n].trimStart().startsWith("```")&&n++,r.push((0,d.jsxs)("div",{className:"ak-md-pre-wrap",children:[u&&(0,d.jsx)("span",{className:"ak-md-pre-lang",children:u}),(0,d.jsx)("pre",{className:`ak-md-pre${u?` ak-md-pre--${u}`:""}`,children:(0,d.jsx)("code",{className:"ak-md-code",children:h.join(`
|
|
1144
|
+
`)})})]},a++));continue}const o=i.match(/^(#{1,6})(\s+.*)?$/);if(o){const c=o[1].length,u=o[2]?U(o[2].trim()):"";c===1?r.push((0,d.jsx)("h1",{className:"ak-md-h1",children:u},a++)):c===2?r.push((0,d.jsx)("h2",{className:"ak-md-h2",children:u},a++)):c===3?r.push((0,d.jsx)("h3",{className:"ak-md-h3",children:u},a++)):c===4?r.push((0,d.jsx)("h4",{className:"ak-md-h4",children:u},a++)):c===5?r.push((0,d.jsx)("h5",{className:"ak-md-h5",children:u},a++)):r.push((0,d.jsx)("h6",{className:"ak-md-h6",children:u},a++)),n++;continue}if(/^[-*_]{3,}$/.test(i.trim())){r.push((0,d.jsx)("hr",{className:"ak-md-hr"},a++)),n++;continue}if(/^[-*+]\s/.test(i)){const c=[];let u=n;for(;u<t.length&&(/^[-*+]\s/.test(t[u])||t[u].trim()==="");){if(t[u].trim()===""){u++;continue}const h=t[u].length-t[u].trimStart().length,m=t[u].replace(/^[-*+]\s+/,""),p=[],_=[];let k=u+1;for(;k<t.length&&k<u+20;){const w=t[k];if(w.length-w.trimStart().length>h&&w.trim()!==""){const C=w.trim();/^[-*+]\s/.test(C)?p.push((0,d.jsx)("li",{children:U(C.replace(/^[-*+]\s+/,""))},`nested-${k}`)):_.push((0,d.jsx)("p",{style:{margin:"0.2em 0 0"},children:U(C)},`cont-${k}`)),k++}else break}const L=_.length>0||p.length>0?(0,d.jsxs)(d.Fragment,{children:[U(m),_,p.length>0&&(0,d.jsx)("ul",{style:{margin:"0.2em 0 0",paddingLeft:"1.2em"},children:p})]}):U(m);c.push((0,d.jsx)("li",{children:L},`item-${u}`)),u=k}r.push((0,d.jsx)("ul",{className:"ak-md-ul",children:c},a++)),n=u;continue}if(/^\d+\.\s/.test(i)){const c=[];let u=n;for(;u<t.length&&(/^\d+\.\s/.test(t[u])||t[u].trim()==="");){if(t[u].trim()===""){u++;continue}const h=t[u].length-t[u].trimStart().length,m=t[u].replace(/^\d+\.\s+/,""),p=[],_=[];let k=u+1;for(;k<t.length&&k<u+20;){const w=t[k];if(w.length-w.trimStart().length>h&&w.trim()!==""){const C=w.trim();/^\d+\.\s/.test(C)?p.push((0,d.jsx)("li",{children:U(C.replace(/^\d+\.\s+/,""))},`nested-order-${k}`)):/^[-*+]\s/.test(C)?p.push((0,d.jsx)("li",{children:U(C.replace(/^[-*+]\s+/,""))},`nested-unorder-${k}`)):_.push((0,d.jsx)("p",{style:{margin:"0.2em 0 0"},children:U(C)},`cont-${k}`)),k++}else break}const L=_.length>0||p.length>0?(0,d.jsxs)(d.Fragment,{children:[U(m),_,p.length>0&&(0,d.jsx)("ol",{style:{margin:"0.2em 0 0",paddingLeft:"1.2em"},children:p})]}):U(m);c.push((0,d.jsx)("li",{children:L},`order-item-${u}`)),u=k}r.push((0,d.jsx)("ol",{className:"ak-md-ol",children:c},a++)),n=u;continue}if(i.trim()===""){n++;continue}const l=[];for(;n<t.length&&t[n].trim()!==""&&!t[n].startsWith("#")&&!/^\s*```/.test(t[n])&&!/^[-*+]\s/.test(t[n])&&!/^\d+\.\s/.test(t[n])&&!/^[-*_]{3,}$/.test(t[n].trim());)l.push(t[n]),n++;if(l.length>0){const c=[];l.forEach((u,h)=>{c.push(...U(u)),h<l.length-1&&c.push((0,d.jsx)("br",{},`br-${h}`))}),r.push((0,d.jsx)("p",{className:"ak-md-p",children:c},a++))}}return(0,d.jsx)(d.Fragment,{children:r})}function zr({message:e,thinkingViewable:t=!1}){const r=e.role==="user",n=e.status==="error",a=e.status==="streaming",i=!!(e.images&&e.images.length>0),s=!!(r&&e.uploadedImageUrl),o=i||s,l=!r&&!n,c=r?"ak-message--user":n?"ak-message--assistant ak-message--error":"ak-message--assistant",u=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:["ak-message__bubble",l?"ak-message__bubble--md":"",o?"ak-message__bubble--has-image":""].filter(Boolean).join(" "),children:[s&&(0,d.jsx)("div",{className:"ak-message__images",children:(0,d.jsxs)("div",{className:"ak-message__image-wrap",children:[(0,d.jsx)("a",{href:e.uploadedImageUrl,className:"ak-message__image-link",children:(0,d.jsx)("img",{src:e.uploadedImageUrl,alt:"Uploaded image",className:"ak-message__image"})}),(0,d.jsx)("a",{href:e.uploadedImageUrl,download:!0,className:"ak-message__image-dl-icon",title:"Download image",onClick:m=>m.stopPropagation(),children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,d.jsx)("polyline",{points:"7 10 12 15 17 10"}),(0,d.jsx)("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})})]})}),i&&(0,d.jsx)("div",{className:"ak-message__images",children:e.images.map((m,p)=>{const _=m.url??(m.base64?`data:${m.mimeType};base64,${m.base64}`:null);return _?(0,d.jsxs)("div",{className:"ak-message__image-wrap",children:[(0,d.jsx)("a",{href:_,className:"ak-message__image-link",children:(0,d.jsx)("img",{src:_,alt:"Generated image",className:"ak-message__image"})}),(0,d.jsx)("a",{href:_,download:!0,className:"ak-message__image-dl-icon",title:"Download image",onClick:k=>k.stopPropagation(),children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,d.jsx)("polyline",{points:"7 10 12 15 17 10"}),(0,d.jsx)("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})})]},`${e.id}-img-${p}`):null})}),(e.content||a&&!e.isThinking)&&(0,d.jsxs)("div",{className:o?"ak-message__image-caption":void 0,children:[l?ns(e.content):e.content,a&&!e.isThinking&&(0,d.jsxs)("span",{className:"ak-cursor","aria-hidden":"true",children:[(0,d.jsx)("span",{className:"ak-cursor__dot"}),(0,d.jsx)("span",{className:"ak-cursor__dot"}),(0,d.jsx)("span",{className:"ak-cursor__dot"})]})]})]}),(0,d.jsx)("span",{className:"ak-message__time",children:rs(e.createdAt)})]}),h=!e.isThinking||!!e.content;return(0,d.jsxs)("div",{className:`ak-message ${c}`,children:[!r&&(0,d.jsx)(ts,{thinking:e.thinking,isThinking:e.isThinking??!1,thinkingViewable:t}),h&&u]})}function Dr(){return(0,d.jsxs)("div",{className:"ak-typing","aria-label":"Assistant is typing",children:[(0,d.jsx)("span",{className:"ak-typing__dot"}),(0,d.jsx)("span",{className:"ak-typing__dot"}),(0,d.jsx)("span",{className:"ak-typing__dot"})]})}function $r({messages:e,isLoading:t,thinkingViewable:r}){const n=(0,A.useRef)(null),a=e.find(s=>s.status==="streaming")?.content??"",i=e.find(s=>s.isThinking)?.thinking??"";return(0,A.useEffect)(()=>{n.current?.scrollIntoView({behavior:"smooth"})},[e.length,t,a,i]),(0,d.jsxs)("div",{className:"ak-messages",role:"log","aria-live":"polite","aria-label":"Conversation",children:[e.map(s=>(0,d.jsx)(zr,{message:s,thinkingViewable:r},s.id)),t&&!e.some(s=>s.status==="streaming")&&(0,d.jsx)(Dr,{}),(0,d.jsx)("div",{ref:n})]})}function as(){return(0,d.jsxs)("svg",{width:"30",height:"30",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,d.jsx)("rect",{x:"3",y:"11",width:"18",height:"10",rx:"2"}),(0,d.jsx)("circle",{cx:"12",cy:"5",r:"2"}),(0,d.jsx)("path",{d:"M12 7v4"}),(0,d.jsx)("line",{x1:"8",y1:"16",x2:"8",y2:"16"}),(0,d.jsx)("line",{x1:"16",y1:"16",x2:"16",y2:"16"})]})}function is({title:e,description:t,greeting:r,avatarUrl:n}){return(0,d.jsxs)("div",{className:"ak-empty-state","aria-label":"Start a conversation",children:[(0,d.jsx)("div",{className:"ak-empty-state__glow","aria-hidden":"true"}),(0,d.jsxs)("div",{className:"ak-empty-state__body",children:[(0,d.jsx)("div",{className:"ak-empty-state__avatar",children:n?(0,d.jsx)("img",{src:n,alt:"",className:"ak-empty-state__avatar-img","aria-hidden":"true"}):(0,d.jsx)("span",{className:"ak-empty-state__bot-icon","aria-hidden":"true",children:(0,d.jsx)(as,{})})}),(0,d.jsx)("p",{className:"ak-empty-state__title",children:e}),t&&(0,d.jsx)("p",{className:"ak-empty-state__description",children:t})]}),r&&(0,d.jsxs)("div",{className:"ak-empty-state__quote",children:[(0,d.jsx)("span",{className:"ak-empty-state__quote-mark","aria-hidden":"true",children:'"'}),(0,d.jsx)("p",{className:"ak-empty-state__quote-text",children:r})]})]})}function ss(){return(0,d.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),(0,d.jsx)("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})}function os(){return(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[(0,d.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,d.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function cs(){return(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"}),(0,d.jsx)("circle",{cx:"12",cy:"13",r:"4"})]})}function ds(){return(0,d.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,d.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function Ur({onSend:e,disabled:t=!1,placeholder:r="Type a message…",privacyPolicyUrl:n,photoSendingEnabled:a=!1}){const[i,s]=(0,A.useState)(""),[o,l]=(0,A.useState)(null),[c,u]=(0,A.useState)(null),[h,m]=(0,A.useState)(!1),p=(0,A.useRef)(null),_=(0,A.useRef)(null),k=(0,A.useRef)(null),L=(0,A.useRef)(null);(0,A.useEffect)(()=>()=>{c&&URL.revokeObjectURL(c)},[c]),(0,A.useEffect)(()=>{t||p.current?.focus()},[t]);const w=(0,A.useCallback)(E=>{if(!h)return;const O=E.composedPath?E.composedPath():[],be=!!k.current&&O.includes(k.current),Te=!!L.current&&O.includes(L.current);!be&&!Te&&m(!1)},[h]);(0,A.useEffect)(()=>{if(h)return document.addEventListener("click",w),()=>document.removeEventListener("click",w)},[h,w]),(0,A.useEffect)(()=>{a||m(!1)},[a]);function C(){l(null),c&&URL.revokeObjectURL(c),u(null),_.current&&(_.current.value="")}function Z(){const E=i.trim();!E&&!o||t||(e(E,o??void 0),s(""),C(),p.current&&(p.current.style.height="auto"))}function $(E){E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),Z())}function ee(E){const O=E.currentTarget;s(O.value),O.style.height="auto",O.style.height=`${O.scrollHeight}px`}function X(E){const O=E.currentTarget.files?.[0];if(O){if(O.size>5*1024*1024){alert("Image must be smaller than 5 MB."),E.currentTarget.value="";return}c&&URL.revokeObjectURL(c),l(O),u(URL.createObjectURL(O))}}function ie(){m(!1),_.current?.click()}const N=!t&&(!!i.trim()||!!o);return(0,d.jsxs)("div",{className:"ak-composer",children:[a&&h&&(0,d.jsx)("div",{ref:k,className:"ak-composer__attach-menu",role:"menu",children:(0,d.jsxs)("button",{className:"ak-composer__attach-menu-item",onClick:ie,type:"button",role:"menuitem",disabled:t,children:[(0,d.jsx)(cs,{}),(0,d.jsx)("span",{children:"Photo"})]})}),c&&(0,d.jsx)("div",{className:"ak-composer__preview",children:(0,d.jsxs)("div",{className:"ak-composer__preview-wrap",children:[(0,d.jsx)("img",{src:c,alt:"Selected",className:"ak-composer__preview-img"}),(0,d.jsx)("button",{className:"ak-composer__preview-remove",onClick:C,type:"button","aria-label":"Remove image",disabled:t,children:(0,d.jsx)(ds,{})})]})}),(0,d.jsxs)("div",{className:"ak-composer__input-wrap",children:[a&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("input",{ref:_,type:"file",accept:"image/jpeg,image/png,image/gif,image/webp",className:"ak-composer__file-input",onChange:X,disabled:t,"aria-label":"Attach image"}),(0,d.jsx)("div",{className:"ak-composer__attach-wrap",children:(0,d.jsx)("button",{ref:L,className:`ak-composer__attach${h?" ak-composer__attach--open":""}`,onClick:()=>m(E=>!E),disabled:t,"aria-label":"Attachment options","aria-haspopup":"true","aria-expanded":h,type:"button",children:(0,d.jsx)(os,{})})})]}),(0,d.jsx)("textarea",{ref:p,className:"ak-composer__input",value:i,onInput:ee,onKeyDown:$,placeholder:r,disabled:t,rows:1,"aria-label":"Message input"}),(0,d.jsx)("button",{className:"ak-composer__send",onClick:Z,disabled:!N,"aria-label":"Send message",type:"button",children:(0,d.jsx)(ss,{})})]}),(0,d.jsxs)("p",{className:"ak-composer__disclaimer",children:["By chatting with us, you agree to our"," ",n?(0,d.jsx)("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}):"Privacy Policy"]})]})}function St({message:e}){return e.includes("Origin not allowed")?(0,d.jsxs)("div",{className:"ak-error ak-error--origin",role:"alert",children:[(0,d.jsx)("div",{className:"ak-error__icon",children:"🔒"}),(0,d.jsxs)("div",{className:"ak-error__content",children:[(0,d.jsx)("h3",{className:"ak-error__title",children:"Access Restricted"}),(0,d.jsx)("p",{className:"ak-error__description",children:"This widget has been restricted to specific websites only. Contact the website administrator if you believe this is an error."})]})]}):(0,d.jsxs)("div",{className:"ak-error",role:"alert",children:[(0,d.jsx)("div",{className:"ak-error__icon",children:"⚠️"}),(0,d.jsx)("div",{className:"ak-error__content",children:(0,d.jsx)("p",{className:"ak-error__message",children:e})})]})}function ls(){return(0,d.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:"ak-branding__logo",children:[(0,d.jsx)("rect",{width:"24",height:"24",rx:"5",fill:"currentColor"}),(0,d.jsx)("path",{d:"M12 5L7 13h3.5v6l6.5-9H13.5V5z",fill:"white"})]})}function us(){return(0,d.jsxs)("div",{className:"ak-branding",children:[(0,d.jsx)(ls,{}),(0,d.jsx)("span",{className:"ak-branding__label",children:"Powered by"}),(0,d.jsx)("span",{className:"ak-branding__name",children:"AgentForge"})]})}function jt({config:e,messages:t,isLoading:r,error:n,isInline:a,initStatus:i,initError:s,callbacks:o}){return(0,d.jsxs)("div",{className:a?"ak-shell-wrap":"ak-shell-wrap ak-shell-enter",children:[(0,d.jsxs)("div",{className:a?"ak-shell ak-shell--inline":"ak-shell ak-shell--floating",role:"dialog","aria-label":e.title,children:[(0,d.jsx)(Wr,{title:e.title,subtitle:e.subtitle,avatarUrl:e.avatarUrl,onClose:o.onClose,onReset:o.onReset,hideClose:!0}),i==="validating"&&(0,d.jsx)("div",{className:"ak-init-status",children:(0,d.jsx)("div",{className:"ak-init-spinner","aria-label":"Connecting…"})}),i==="error"&&(0,d.jsx)("div",{className:"ak-init-status ak-init-status--error",children:(0,d.jsx)(St,{message:s??"Widget configuration is invalid."})}),i==="ready"&&(0,d.jsxs)(d.Fragment,{children:[t.length===0?(0,d.jsx)(is,{title:e.title,description:e.description??e.subtitle,greeting:e.greeting,avatarUrl:e.avatarUrl}):(0,d.jsx)($r,{messages:t,isLoading:r,thinkingViewable:e.thinkingViewable}),n&&(0,d.jsx)(St,{message:n}),(0,d.jsx)(Ur,{onSend:o.onSendMessage,disabled:r,placeholder:"Type a message…",privacyPolicyUrl:e.privacyPolicyUrl,photoSendingEnabled:e.photoSendingEnabled})]})]}),!a&&(0,d.jsx)(us,{})]})}function hs(){return(0,d.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function fs(){return(0,d.jsx)("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("polyline",{points:"6,9 12,15 18,9"})})}function Br({isOpen:e,onClick:t,avatarUrl:r,ariaLabel:n="Toggle chat"}){const a=!e&&!!r;return(0,d.jsx)("button",{className:`ak-launcher${a?" ak-launcher--avatar":""}`,onClick:t,"aria-label":n,"aria-expanded":e,type:"button",children:e?(0,d.jsx)(fs,{}):a?(0,d.jsx)("img",{src:r,alt:"",className:"ak-launcher__avatar-img","aria-hidden":"true"}):(0,d.jsx)(hs,{})})}function Ct({config:e,state:t,callbacks:r}){const n=e.mode==="inline",a=(0,A.useRef)(null);return(0,A.useEffect)(()=>{const i=a.current?.getRootNode()?.host;if(!i)return;const s=Pr(e.theme.mode);i.setAttribute("data-theme",s)},[e.theme.mode]),n?(0,d.jsx)("div",{ref:a,className:"ak-inline",children:(0,d.jsx)(jt,{config:e,messages:t.messages,isLoading:t.isLoading,error:t.error,isInline:!0,initStatus:t.initStatus,initError:t.initError,callbacks:r})}):(0,d.jsxs)("div",{ref:a,className:"ak-floating",children:[t.isOpen&&(0,d.jsx)(jt,{config:e,messages:t.messages,isLoading:t.isLoading,error:t.error,isInline:!1,initStatus:t.initStatus,initError:t.initError,callbacks:r}),(0,d.jsx)(Br,{isOpen:t.isOpen,onClick:t.isOpen?r.onClose:r.onOpen,avatarUrl:e.avatarUrl})]})}var ms=(e,t,r,n)=>{const a=(0,Yr.createRoot)(e);return a.render((0,A.createElement)(Ct,{config:t,state:r,callbacks:n})),{update(i,s){a.render((0,A.createElement)(Ct,{config:s,state:i,callbacks:n}))},destroy(){setTimeout(()=>{a.unmount()},0)}}};function ps(e){return Fr+`
|
|
1145
|
+
`+Vr(e)}exports.ApiClient=Cr;exports.Composer=Ur;exports.ErrorState=St;exports.EventEmitter=Nr;exports.Header=Wr;exports.Launcher=Br;exports.MessageBubble=zr;exports.MessageList=$r;exports.TypingIndicator=Dr;exports.WidgetApp=Ct;exports.WidgetClient=Lr;exports.WidgetShell=jt;exports.buildThemeVars=Vr;exports.buildWidgetCSS=ps;exports.clearSession=wt;exports.createFloatingContainer=Er;exports.createShadowHost=Rr;exports.createWidget=At;exports.destroyWidget=Ji;exports.getSessionId=Tr;exports.init=Hi;exports.injectStyles=Ar;exports.listWidgets=Qi;exports.mount=Xi;exports.normalizeConfig=Qe;exports.prepareInlineContainer=Mr;exports.removeShadowHost=Zr;exports.renderWidget=ms;exports.resolveThemeMode=Pr;exports.setSessionId=Oe;exports.streamChat=Ir;exports.widgetCSS=Fr;
|