@bymos/agentkit-sdk 0.2.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
- var AgentKit=(function(vt){Object.defineProperty(vt,Symbol.toStringTag,{value:"Module"});var A;(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})(A||(A={}));var or;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(or||(or={}));var v=A.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),fe=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}},p=A.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),ee=class Hn 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 Hn))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,A.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()}};ee.create=e=>new ee(e);var Ne=(e,t)=>{let r;switch(e.code){case p.invalid_type:e.received===v.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case p.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,A.jsonStringifyReplacer)}`;break;case p.unrecognized_keys:r=`Unrecognized key(s) in object: ${A.joinValues(e.keys,", ")}`;break;case p.invalid_union:r="Invalid input";break;case p.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${A.joinValues(e.options)}`;break;case p.invalid_enum_value:r=`Invalid enum value. Expected ${A.joinValues(e.options)}, received '${e.received}'`;break;case p.invalid_arguments:r="Invalid function arguments";break;case p.invalid_return_type:r="Invalid function return type";break;case p.invalid_date:r="Invalid date";break;case p.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}"`:A.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case p.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 p.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 p.custom:r="Invalid input";break;case p.invalid_intersection_types:r="Intersection results could not be merged";break;case p.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case p.not_finite:r="Number must be finite";break;default:r=t.defaultError,A.assertNever(e)}return{message:r}},Qn=Ne;function yt(){return Qn}var bt=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=yt(),n=bt({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Ne?void 0:Ne].filter(a=>!!a)});e.common.issues.push(n)}var $=class Gn{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 w;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 Gn.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 w;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}}},w=Object.freeze({status:"aborted"}),Te=e=>({status:"dirty",value:e}),W=e=>({status:"valid",value:e}),cr=e=>e.status==="aborted",lr=e=>e.status==="dirty",ye=e=>e.status==="valid",$e=e=>typeof Promise<"u"&&e instanceof Promise,k;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(k||(k={}));var te=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}},dr=(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 ee(e.common.issues),this._error)}}};function C(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 T=class{get description(){return this._def.description}_getType(e){return fe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:fe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new $,ctx:{common:e.parent.common,data:e.data,parsedType:fe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if($e(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:fe(e)};return dr(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:fe(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:fe(e)},n=this._parse({data:e,path:r.path,parent:r});return dr(r,await($e(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:p.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 ie({schema:this,typeName:S.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 se.create(this,this._def)}nullable(){return _e.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ke.create(this)}promise(){return Le.create(this,this._def)}or(e){return Be.create([this,e],this._def)}and(e){return He.create(this,e,this._def)}transform(e){return new ie({...C(this._def),schema:this,typeName:S.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Ke({...C(this._def),innerType:this,defaultValue:t,typeName:S.ZodDefault})}brand(){return new mr({typeName:S.ZodBranded,type:this,...C(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Qe({...C(this._def),innerType:this,catchValue:t,typeName:S.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return pr.create(this,e)}readonly(){return qe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},qn=/^c[^\s-]{8,}$/i,ea=/^[0-9a-z]+$/,ta=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ra=/^[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,na=/^[a-z0-9_-]{21}$/i,aa=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ia=/^[-+]?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)?)??$/,sa=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,oa="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",kt,ca=/^(?:(?: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])$/,la=/^(?:(?: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])$/,da=/^(([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]))$/,ua=/^(([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])$/,fa=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ha=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ur="((\\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])))",ma=new RegExp(`^${ur}$`);function fr(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 pa(e){return new RegExp(`^${fr(e)}$`)}function ga(e){let t=`${ur}T${fr(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 _a(e,t){return!!((t==="v4"||!t)&&ca.test(e)||(t==="v6"||!t)&&da.test(e))}function va(e,t){if(!aa.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 ya(e,t){return!!((t==="v4"||!t)&&la.test(e)||(t==="v6"||!t)&&ua.test(e))}var Ue=class We extends T{_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:p.invalid_type,expected:v.string,received:a.parsedType}),w}const r=new $;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:p.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:p.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:p.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&g(n,{code:p.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")sa.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"email",code:p.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")kt||(kt=new RegExp(oa,"u")),kt.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"emoji",code:p.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")ra.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"uuid",code:p.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")na.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"nanoid",code:p.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")qn.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"cuid",code:p.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")ea.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"cuid2",code:p.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")ta.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"ulid",code:p.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:p.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:p.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:p.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:p.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:p.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?ga(a).test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{code:p.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?ma.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{code:p.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?pa(a).test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{code:p.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?ia.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"duration",code:p.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?_a(t.data,a.version)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"ip",code:p.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?va(t.data,a.alg)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"jwt",code:p.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?ya(t.data,a.version)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"cidr",code:p.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?fa.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"base64",code:p.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?ha.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"base64url",code:p.invalid_string,message:a.message}),r.dirty()):A.assertNever(a);return{status:r.value,value:t.data}}_regex(t,r,n){return this.refinement(a=>t.test(a),{validation:r,code:p.invalid_string,...k.errToObj(n)})}_addCheck(t){return new We({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...k.errToObj(t)})}url(t){return this._addCheck({kind:"url",...k.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...k.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...k.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...k.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...k.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...k.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...k.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...k.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...k.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...k.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...k.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...k.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,...k.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,...k.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...k.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...k.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...k.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...k.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...k.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...k.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...k.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...k.errToObj(r)})}nonempty(t){return this.min(1,k.errToObj(t))}trim(){return new We({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new We({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new We({...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}};Ue.create=e=>new Ue({checks:[],typeName:S.ZodString,coerce:e?.coerce??!1,...C(e)});function ba(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 xt=class rr extends T{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:p.invalid_type,expected:v.number,received:a.parsedType}),w}let r;const n=new $;for(const a of this._def.checks)a.kind==="int"?A.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),g(r,{code:p.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:p.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:p.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?ba(t.data,a.value)!==0&&(r=this._getOrReturnCtx(t,r),g(r,{code:p.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:p.not_finite,message:a.message}),n.dirty()):A.assertNever(a);return{status:n.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,k.toString(r))}gt(t,r){return this.setLimit("min",t,!1,k.toString(r))}lte(t,r){return this.setLimit("max",t,!0,k.toString(r))}lt(t,r){return this.setLimit("max",t,!1,k.toString(r))}setLimit(t,r,n,a){return new rr({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:k.toString(a)}]})}_addCheck(t){return new rr({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:k.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:k.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:k.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:k.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:k.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:k.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:k.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:k.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:k.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"&&A.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)}};xt.create=e=>new xt({checks:[],typeName:S.ZodNumber,coerce:e?.coerce||!1,...C(e)});var wt=class nr extends T{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 $;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:p.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:p.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:p.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):A.assertNever(a);return{status:n.value,value:t.data}}_getInvalidInput(t){const r=this._getOrReturnCtx(t);return g(r,{code:p.invalid_type,expected:v.bigint,received:r.parsedType}),w}gte(t,r){return this.setLimit("min",t,!0,k.toString(r))}gt(t,r){return this.setLimit("min",t,!1,k.toString(r))}lte(t,r){return this.setLimit("max",t,!0,k.toString(r))}lt(t,r){return this.setLimit("max",t,!1,k.toString(r))}setLimit(t,r,n,a){return new nr({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:k.toString(a)}]})}_addCheck(t){return new nr({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:k.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:k.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:k.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:k.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:k.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}};wt.create=e=>new wt({checks:[],typeName:S.ZodBigInt,coerce:e?.coerce??!1,...C(e)});var St=class extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==v.boolean){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:v.boolean,received:t.parsedType}),w}return W(e.data)}};St.create=e=>new St({typeName:S.ZodBoolean,coerce:e?.coerce||!1,...C(e)});var Ct=class Yn extends T{_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:p.invalid_type,expected:v.date,received:a.parsedType}),w}if(Number.isNaN(t.data.getTime()))return g(this._getOrReturnCtx(t),{code:p.invalid_date}),w;const r=new $;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:p.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:p.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):A.assertNever(a);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Yn({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:k.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:k.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}};Ct.create=e=>new Ct({checks:[],coerce:e?.coerce||!1,typeName:S.ZodDate,...C(e)});var It=class extends T{_parse(e){if(this._getType(e)!==v.symbol){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:v.symbol,received:t.parsedType}),w}return W(e.data)}};It.create=e=>new It({typeName:S.ZodSymbol,...C(e)});var De=class extends T{_parse(e){if(this._getType(e)!==v.undefined){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:v.undefined,received:t.parsedType}),w}return W(e.data)}};De.create=e=>new De({typeName:S.ZodUndefined,...C(e)});var ze=class extends T{_parse(e){if(this._getType(e)!==v.null){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:v.null,received:t.parsedType}),w}return W(e.data)}};ze.create=e=>new ze({typeName:S.ZodNull,...C(e)});var Nt=class extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return W(e.data)}};Nt.create=e=>new Nt({typeName:S.ZodAny,...C(e)});var be=class extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return W(e.data)}};be.create=e=>new be({typeName:S.ZodUnknown,...C(e)});var he=class extends T{_parse(e){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:v.never,received:t.parsedType}),w}};he.create=e=>new he({typeName:S.ZodNever,...C(e)});var Tt=class extends T{_parse(e){if(this._getType(e)!==v.undefined){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:v.void,received:t.parsedType}),w}return W(e.data)}};Tt.create=e=>new Tt({typeName:S.ZodVoid,...C(e)});var ke=class gt extends T{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),a=this._def;if(r.parsedType!==v.array)return g(r,{code:p.invalid_type,expected:v.array,received:r.parsedType}),w;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?p.too_big:p.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:p.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:p.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 te(r,s,r.path,o)))).then(s=>$.mergeArray(n,s));const i=[...r.data].map((s,o)=>a.type._parseSync(new te(r,s,r.path,o)));return $.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new gt({...this._def,minLength:{value:t,message:k.toString(r)}})}max(t,r){return new gt({...this._def,maxLength:{value:t,message:k.toString(r)}})}length(t,r){return new gt({...this._def,exactLength:{value:t,message:k.toString(r)}})}nonempty(t){return this.min(1,t)}};ke.create=(e,t)=>new ke({type:e,minLength:null,maxLength:null,exactLength:null,typeName:S.ZodArray,...C(t)});function xe(e){if(e instanceof H){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=se.create(xe(n))}return new H({...e._def,shape:()=>t})}else return e instanceof ke?new ke({...e._def,type:xe(e.element)}):e instanceof se?se.create(xe(e.unwrap())):e instanceof _e?_e.create(xe(e.unwrap())):e instanceof ge?ge.create(e.items.map(t=>xe(t))):e}var H=class q extends T{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:A.objectKeys(t)},this._cached}_parse(t){if(this._getType(t)!==v.object){const l=this._getOrReturnCtx(t);return g(l,{code:p.invalid_type,expected:v.object,received:l.parsedType}),w}const{status:r,ctx:n}=this._processInputParams(t),{shape:a,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof he&&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 te(n,u,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof he){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:p.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 te(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,d=await c.value;l.push({key:u,value:d,alwaysSet:c.alwaysSet})}return l}).then(l=>$.mergeObjectSync(r,l)):$.mergeObjectSync(r,o)}get shape(){return this._def.shape()}strict(t){return k.errToObj,new q({...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:k.errToObj(t).message??a}:{message:a}}}:{}})}strip(){return new q({...this._def,unknownKeys:"strip"})}passthrough(){return new q({...this._def,unknownKeys:"passthrough"})}extend(t){return new q({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new q({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:S.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new q({...this._def,catchall:t})}pick(t){const r={};for(const n of A.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new q({...this._def,shape:()=>r})}omit(t){const r={};for(const n of A.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new q({...this._def,shape:()=>r})}deepPartial(){return xe(this)}partial(t){const r={};for(const n of A.objectKeys(this.shape)){const a=this.shape[n];t&&!t[n]?r[n]=a:r[n]=a.optional()}return new q({...this._def,shape:()=>r})}required(t){const r={};for(const n of A.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof se;)a=a._def.innerType;r[n]=a}return new q({...this._def,shape:()=>r})}keyof(){return hr(A.objectKeys(this.shape))}};H.create=(e,t)=>new H({shape:()=>e,unknownKeys:"strip",catchall:he.create(),typeName:S.ZodObject,...C(t)}),H.strictCreate=(e,t)=>new H({shape:()=>e,unknownKeys:"strict",catchall:he.create(),typeName:S.ZodObject,...C(t)}),H.lazycreate=(e,t)=>new H({shape:e,unknownKeys:"strip",catchall:he.create(),typeName:S.ZodObject,...C(t)});var Be=class extends T{_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 ee(s.ctx.common.issues));return g(t,{code:p.invalid_union,unionErrors:i}),w}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 ee(o));return g(t,{code:p.invalid_union,unionErrors:s}),w}}get options(){return this._def.options}};Be.create=(e,t)=>new Be({options:e,typeName:S.ZodUnion,...C(t)});var ae=e=>e instanceof Ge?ae(e.schema):e instanceof ie?ae(e.innerType()):e instanceof Ye?[e.value]:e instanceof Xe?e.options:e instanceof Je?A.objectValues(e.enum):e instanceof Ke?ae(e._def.innerType):e instanceof De?[void 0]:e instanceof ze?[null]:e instanceof se?[void 0,...ae(e.unwrap())]:e instanceof _e?[null,...ae(e.unwrap())]:e instanceof mr||e instanceof qe?ae(e.unwrap()):e instanceof Qe?ae(e._def.innerType):[],ka=class Xn extends T{_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==v.object)return g(r,{code:p.invalid_type,expected:v.object,received:r.parsedType}),w;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:p.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),w)}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=ae(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 Xn({typeName:S.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:a,...C(n)})}};function Lt(e,t){const r=fe(e),n=fe(t);if(e===t)return{valid:!0,data:e};if(r===v.object&&n===v.object){const a=A.objectKeys(t),i=A.objectKeys(e).filter(o=>a.indexOf(o)!==-1),s={...e,...t};for(const o of i){const l=Lt(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=Lt(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 He=class extends T{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(a,i)=>{if(cr(a)||cr(i))return w;const s=Lt(a.value,i.value);return s.valid?((lr(a)||lr(i))&&t.dirty(),{status:t.value,value:s.data}):(g(r,{code:p.invalid_intersection_types}),w)};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}))}};He.create=(e,t,r)=>new He({left:e,right:t,typeName:S.ZodIntersection,...C(r)});var ge=class Jn extends T{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==v.array)return g(n,{code:p.invalid_type,expected:v.array,received:n.parsedType}),w;if(n.data.length<this._def.items.length)return g(n,{code:p.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w;!this._def.rest&&n.data.length>this._def.items.length&&(g(n,{code:p.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 te(n,i,n.path,s)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>$.mergeArray(r,i)):$.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new Jn({...this._def,rest:t})}};ge.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ge({items:e,typeName:S.ZodTuple,rest:null,...C(t)})};var xa=class ar extends T{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:p.invalid_type,expected:v.object,received:n.parsedType}),w;const a=[],i=this._def.keyType,s=this._def.valueType;for(const o in n.data)a.push({key:i._parse(new te(n,o,n.path,o)),value:s._parse(new te(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?$.mergeObjectAsync(r,a):$.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof T?new ar({keyType:t,valueType:r,typeName:S.ZodRecord,...C(n)}):new ar({keyType:Ue.create(),valueType:t,typeName:S.ZodRecord,...C(r)})}},At=class extends T{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:p.invalid_type,expected:v.map,received:r.parsedType}),w;const n=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([s,o],l)=>({key:n._parse(new te(r,s,r.path,[l,"key"])),value:a._parse(new te(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 w;(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 w;(l.status==="dirty"||c.status==="dirty")&&t.dirty(),s.set(l.value,c.value)}return{status:t.value,value:s}}}};At.create=(e,t,r)=>new At({valueType:t,keyType:e,typeName:S.ZodMap,...C(r)});var Rt=class ir extends T{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==v.set)return g(n,{code:p.invalid_type,expected:v.set,received:n.parsedType}),w;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(g(n,{code:p.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:p.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 w;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 te(n,l,n.path,c)));return n.common.async?Promise.all(o).then(l=>s(l)):s(o)}min(t,r){return new ir({...this._def,minSize:{value:t,message:k.toString(r)}})}max(t,r){return new ir({...this._def,maxSize:{value:t,message:k.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Rt.create=(e,t)=>new Rt({valueType:e,minSize:null,maxSize:null,typeName:S.ZodSet,...C(t)});var wa=class _t extends T{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==v.function)return g(r,{code:p.invalid_type,expected:v.function,received:r.parsedType}),w;function n(o,l){return bt({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,yt(),Ne].filter(c=>!!c),issueData:{code:p.invalid_arguments,argumentsError:l}})}function a(o,l){return bt({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,yt(),Ne].filter(c=>!!c),issueData:{code:p.invalid_return_type,returnTypeError:l}})}const i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Le){const o=this;return W(async function(...l){const c=new ee([]),u=await o._def.args.parseAsync(l,i).catch(m=>{throw c.addIssue(n(l,m)),c}),d=await Reflect.apply(s,this,u);return await o._def.returns._def.type.parseAsync(d,i).catch(m=>{throw c.addIssue(a(d,m)),c})})}else{const o=this;return W(function(...l){const c=o._def.args.safeParse(l,i);if(!c.success)throw new ee([n(l,c.error)]);const u=Reflect.apply(s,this,c.data),d=o._def.returns.safeParse(u,i);if(!d.success)throw new ee([a(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new _t({...this._def,args:ge.create(t).rest(be.create())})}returns(t){return new _t({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new _t({args:t||ge.create([]).rest(be.create()),returns:r||be.create(),typeName:S.ZodFunction,...C(n)})}},Ge=class extends T{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})}};Ge.create=(e,t)=>new Ge({getter:e,typeName:S.ZodLazy,...C(t)});var Ye=class extends T{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return g(t,{received:t.data,code:p.invalid_literal,expected:this._def.value}),w}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ye.create=(e,t)=>new Ye({value:e,typeName:S.ZodLiteral,...C(t)});function hr(e,t){return new Xe({values:e,typeName:S.ZodEnum,...C(t)})}var Xe=class sr extends T{_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return g(r,{expected:A.joinValues(n),received:r.parsedType,code:p.invalid_type}),w}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:p.invalid_enum_value,options:n}),w}return W(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 sr.create(t,{...this._def,...r})}exclude(t,r=this._def){return sr.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Xe.create=hr;var Je=class extends T{_parse(e){const t=A.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==v.string&&r.parsedType!==v.number){const n=A.objectValues(t);return g(r,{expected:A.joinValues(n),received:r.parsedType,code:p.invalid_type}),w}if(this._cache||(this._cache=new Set(A.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=A.objectValues(t);return g(r,{received:r.data,code:p.invalid_enum_value,options:n}),w}return W(e.data)}get enum(){return this._def.values}};Je.create=(e,t)=>new Je({values:e,typeName:S.ZodNativeEnum,...C(t)});var Le=class extends T{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:p.invalid_type,expected:v.promise,received:t.parsedType}),w):W((t.parsedType===v.promise?t.data:Promise.resolve(t.data)).then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Le.create=(e,t)=>new Le({type:e,typeName:S.ZodPromise,...C(t)});var ie=class extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===S.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 w;const o=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return o.status==="aborted"?w:o.status==="dirty"||t.value==="dirty"?Te(o.value):o});{if(t.value==="aborted")return w;const s=this._def.schema._parseSync({data:i,path:r.path,parent:r});return s.status==="aborted"?w:s.status==="dirty"||t.value==="dirty"?Te(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"?w:(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"?w:(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 w;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})):w);A.assertNever(n)}};ie.create=(e,t,r)=>new ie({schema:e,typeName:S.ZodEffects,effect:t,...C(r)}),ie.createWithPreprocess=(e,t,r)=>new ie({schema:t,effect:{type:"preprocess",transform:e},typeName:S.ZodEffects,...C(r)});var se=class extends T{_parse(e){return this._getType(e)===v.undefined?W(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};se.create=(e,t)=>new se({innerType:e,typeName:S.ZodOptional,...C(t)});var _e=class extends T{_parse(e){return this._getType(e)===v.null?W(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};_e.create=(e,t)=>new _e({innerType:e,typeName:S.ZodNullable,...C(t)});var Ke=class extends T{_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}};Ke.create=(e,t)=>new Ke({innerType:e,typeName:S.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...C(t)});var Qe=class extends T{_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 $e(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ee(r.common.issues)},input:r.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ee(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Qe.create=(e,t)=>new Qe({innerType:e,typeName:S.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...C(t)});var Zt=class extends T{_parse(e){if(this._getType(e)!==v.nan){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:v.nan,received:t.parsedType}),w}return{status:"valid",value:e.data}}};Zt.create=e=>new Zt({typeName:S.ZodNaN,...C(e)});var mr=class extends T{_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}},pr=class Kn extends T{_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"?w:i.status==="dirty"?(r.dirty(),Te(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"?w: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 Kn({in:t,out:r,typeName:S.ZodPipeline})}},qe=class extends T{_parse(e){const t=this._def.innerType._parse(e),r=n=>(ye(n)&&(n.value=Object.freeze(n.value)),n);return $e(t)?t.then(n=>r(n)):r(t)}unwrap(){return this._def.innerType}};qe.create=(e,t)=>new qe({innerType:e,typeName:S.ZodReadonly,...C(t)});var ac={object:H.lazycreate},S;(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"})(S||(S={}));var P=Ue.create,ic=xt.create,sc=Zt.create,oc=wt.create,Sa=St.create,cc=Ct.create,lc=It.create,dc=De.create,uc=ze.create,fc=Nt.create,Ca=be.create,hc=he.create,mc=Tt.create,pc=ke.create,gr=H.create,gc=H.strictCreate,_c=Be.create,vc=ka.create,yc=He.create,bc=ge.create,Ia=xa.create,kc=At.create,xc=Rt.create,wc=wa.create,Sc=Ge.create,Cc=Ye.create,_r=Xe.create,Ic=Je.create,Nc=Le.create,Tc=ie.create,Lc=se.create,Ac=_e.create,Rc=ie.createWithPreprocess,Zc=pr.create,Na=gr({mode:_r(["light","dark","system"]).optional(),accentColor:P().optional(),fontFamily:P().optional(),borderRadius:P().optional()}),vr=gr({agentId:P().min(1,"agentId is required"),apiBaseUrl:P().url("apiBaseUrl must be a valid URL"),tenantId:P().optional(),userId:P().optional(),name:P().optional(),email:P().optional(),authUserId:P().optional(),sessionId:P().optional(),mode:_r(["floating","inline"]).optional(),title:P().optional(),subtitle:P().optional(),greeting:P().optional(),avatarUrl:P().optional(),privacyPolicyUrl:P().optional(),streaming:Sa().optional(),metadata:Ia(Ca()).optional(),theme:Na.optional()}),Ta=vr.omit({agentId:!0,apiBaseUrl:!0}).partial(),ve={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 Ae(e,t){vr.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?Ta.passthrough().safeParse(n).data:void 0,i=a?yr(a,e):e,s={mode:i.theme?.mode??r?.mode??ve.theme.mode,accentColor:i.theme?.accentColor??r?.accentColor??ve.theme.accentColor,fontFamily:i.theme?.fontFamily??r?.fontFamily??ve.theme.fontFamily,borderRadius:i.theme?.borderRadius??r?.borderRadius??ve.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??ve.mode,title:i.title??ve.title,subtitle:i.subtitle,greeting:i.greeting,avatarUrl:i.avatarUrl,privacyPolicyUrl:i.privacyPolicyUrl,streaming:i.streaming??ve.streaming,metadata:i.metadata??{},theme:s,thinkingEnabled:a?.thinkingEnabled===!0,thinkingViewable:a?.thinkingViewable===!0}}function yr(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]=yr(r[n],a):r[n]=a)}return r}var Et=function(){return Et=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},Et.apply(this,arguments)};function re(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(d){s(d)}}function l(u){try{c(n.throw(u))}catch(d){s(d)}}function c(u){u.done?i(u.value):a(u.value).then(o,l)}c((n=n.apply(e,t||[])).next())})}function ne(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 br(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 kr="4.6.2";function et(e,t){return new Promise(function(r){return setTimeout(r,e,t)})}function La(){return new Promise(function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})}function Aa(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})}):et(Math.min(e,t))}function xr(e){return!!e&&typeof e.then=="function"}function wr(e,t){try{var r=e();xr(r)?r.then(function(n){return t(!0,n)},function(n){return t(!1,n)}):t(!0,r)}catch(n){t(!1,n)}}function Sr(e,t,r){return r===void 0&&(r=16),re(this,void 0,void 0,function(){var n,a,i,s;return ne(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,La()]):[3,3]):[3,4];case 2:o.sent(),o.label=3;case 3:return++i,[3,1];case 4:return[2,n]}})})}function Re(e){return e.then(void 0,function(){}),e}function Ra(e,t){for(var r=0,n=e.length;r<n;++r)if(e[r]===t)return!0;return!1}function Za(e,t){return!Ra(e,t)}function Mt(e){return parseInt(e)}function G(e){return parseFloat(e)}function oe(e,t){return typeof e=="number"&&isNaN(e)?t:e}function V(e){return e.reduce(function(t,r){return t+(r?1:0)},0)}function Cr(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 Ea(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,h){s[m]=s[m]||[],s[m].push(h)};;){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 d=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(u);if(d)l(d[1],(r=(t=d[4])!==null&&t!==void 0?t:d[5])!==null&&r!==void 0?r:"");else throw new Error(n);break;default:throw new Error(n)}}return[i,s]}function Ma(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 me(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,d=0,m=0,h=0;h+=i+c,m+=h>>>16,h&=65535,m+=a+l,d+=m>>>16,m&=65535,d+=n+o,u+=d>>>16,d&=65535,u+=r+s,u&=65535,e[0]=u<<16|d,e[1]=m<<16|h}function B(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,d=0,m=0,h=0;h+=i*c,m+=h>>>16,h&=65535,m+=a*c,d+=m>>>16,m&=65535,m+=i*l,d+=m>>>16,m&=65535,d+=n*c,u+=d>>>16,d&=65535,d+=a*l,u+=d>>>16,d&=65535,d+=i*o,u+=d>>>16,d&=65535,u+=r*c+n*l+a*o+i*s,u&=65535,e[0]=u<<16|d,e[1]=m<<16|h}function we(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 U(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 E(e,t){e[0]^=t[0],e[1]^=t[1]}var ja=[4283543511,3981806797],Oa=[3301882366,444984403];function Ir(e){var t=[0,e[0]>>>1];E(e,t),B(e,ja),t[1]=e[0]>>>1,E(e,t),B(e,Oa),t[1]=e[0]>>>1,E(e,t)}var tt=[2277735313,289559509],rt=[1291169091,658871167],Nr=[0,5],Pa=[0,1390208809],Va=[0,944331445];function Fa(e,t){var r=Ma(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,B(l,tt),we(l,31),B(l,rt),E(s,l),we(s,27),me(s,o),B(s,Nr),me(s,Pa),B(c,rt),we(c,33),B(c,tt),E(o,c),we(o,31),me(o,s),B(o,Nr),me(o,Va);l[0]=0,l[1]=0,c[0]=0,c[1]=0;var d=[0,0];switch(a){case 15:d[1]=r[u+14],U(d,48),E(c,d);case 14:d[1]=r[u+13],U(d,40),E(c,d);case 13:d[1]=r[u+12],U(d,32),E(c,d);case 12:d[1]=r[u+11],U(d,24),E(c,d);case 11:d[1]=r[u+10],U(d,16),E(c,d);case 10:d[1]=r[u+9],U(d,8),E(c,d);case 9:d[1]=r[u+8],E(c,d),B(c,rt),we(c,33),B(c,tt),E(o,c);case 8:d[1]=r[u+7],U(d,56),E(l,d);case 7:d[1]=r[u+6],U(d,48),E(l,d);case 6:d[1]=r[u+5],U(d,40),E(l,d);case 5:d[1]=r[u+4],U(d,32),E(l,d);case 4:d[1]=r[u+3],U(d,24),E(l,d);case 3:d[1]=r[u+2],U(d,16),E(l,d);case 2:d[1]=r[u+1],U(d,8),E(l,d);case 1:d[1]=r[u],E(l,d),B(l,tt),we(l,31),B(l,rt),E(s,l)}return E(s,n),E(o,n),me(s,o),me(o,s),Ir(s),Ir(o),me(s,o),me(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 Wa(e){var t;return Et({name:e.name,message:e.message,stack:(t=e.stack)===null||t===void 0?void 0:t.split(`
2
- `)},e)}function $a(e){return/^function\s.*?\{\s*\[native code]\s*}$/.test(String(e))}function Ua(e){return typeof e!="function"}function Da(e,t){var r=Re(new Promise(function(n){var a=Date.now();wr(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(Ua(l))return n(function(){return{value:l,duration:o}});n(function(){return new Promise(function(c){var u=Date.now();wr(l,function(){for(var d=[],m=0;m<arguments.length;m++)d[m]=arguments[m];var h=o+Date.now()-u;if(!d[0])return c({error:d[1],duration:h});c({value:d[1],duration:h})})})})})}));return function(){return r.then(function(a){return a()})}}function za(e,t,r,n){var a=Object.keys(e).filter(function(s){return Za(r,s)}),i=Re(Sr(a,function(s){return Da(e[s],t)},n));return function(){return re(this,void 0,void 0,function(){var o,l,c,u,d;return ne(this,function(m){switch(m.label){case 0:return[4,i];case 1:return o=m.sent(),[4,Sr(o,function(h){return Re(h())},n)];case 2:return l=m.sent(),[4,Promise.all(l)];case 3:for(c=m.sent(),u={},d=0;d<a.length;++d)u[a[d]]=c[d];return[2,u]}})})}}function Tr(){var e=window,t=navigator;return V(["MSCSSMatrix"in e,"msSetImmediate"in e,"msIndexedDB"in e,"msMaxTouchPoints"in t,"msPointerEnabled"in t])>=4}function Ba(){var e=window,t=navigator;return V(["msWriteProfilerMark"in e,"MSStream"in e,"msLaunchUri"in t,"msSaveBlob"in t])>=3&&!Tr()}function Ze(){var e=window,t=navigator;return V(["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 Y(){var e=window,t=navigator;return V(["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 V(["safari"in e,!("ongestureend"in e),!("TouchEvent"in e),!("orientation"in e),t&&!("autocapitalize"in t.prototype),r&&"pointerLockElement"in r.prototype])>=4}function Ee(){var e=window;return $a(e.print)&&String(e.browser)==="[object WebPageNamespace]"}function Lr(){var e,t,r=window;return V(["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 Ha(){var e=window;return V([!("MediaSettingsRange"in e),"RTCEncodedAudioFrame"in e,""+e.Intl=="[object Intl]",""+e.Reflect=="[object Reflect]"])>=3}function Ga(){var e=window,t=e.URLPattern;return V(["union"in Set.prototype,"Iterator"in e,t&&"hasRegExpGroups"in t.prototype,"RGB8"in WebGLRenderingContext.prototype])>=3}function Ya(){var e=window;return V(["DOMRectList"in e,"RTCPeerConnectionIceEvent"in e,"SVGGeometryElement"in e,"ontransitioncancel"in e])>=3}function Me(){var e=window,t=navigator,r=e.CSS,n=e.HTMLButtonElement;return V([!("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 Xa(){if(navigator.platform==="iPad")return!0;var e=screen,t=e.width/e.height;return V(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,t>.65&&t<1.53])>=2}function Ja(){var e=document;return e.fullscreenElement||e.msFullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement||null}function Ka(){var e=document;return(e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen).call(e)}function Ot(){var e=Ze(),t=Lr(),r=window,n=navigator,a="connection";return e?V([!("SharedWorker"in r),n[a]&&"ontypechange"in n[a],!("sinkId"in new Audio)])>=2:t?V(["onorientationchange"in r,"orientation"in r,/android/i.test(n.appVersion)])>=2:!1}function Qa(){var e=navigator,t=window,r=Audio.prototype,n=t.visualViewport;return V(["srLatency"in r,"srChannelCount"in r,"devicePosture"in e,n&&"segments"in n,"getTextInformation"in Image.prototype])>=3}function qa(){return ri()?-4:ei()}function ei(){var e=window,t=e.OfflineAudioContext||e.webkitOfflineAudioContext;if(!t)return-2;if(ti())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=ni(n),o=s[0],l=s[1],c=Re(o.then(function(u){return ai(u.getChannelData(0).subarray(r))},function(u){if(u.name==="timeout"||u.name==="suspended")return-3;throw u}));return function(){return l(),c}}function ti(){return Y()&&!jt()&&!Ya()}function ri(){return Y()&&Me()&&Ee()||Ze()&&Qa()&&Ga()}function ni(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(h){return s(h.renderedBuffer)};var d=function(){setTimeout(function(){return o(Ar("timeout"))},Math.min(n,u+a-Date.now()))},m=function(){try{var h=e.startRendering();switch(xr(h)&&Re(h),e.state){case"running":u=Date.now(),l&&d();break;case"suspended":document.hidden||c++,l&&c>=t?o(Ar("suspended")):setTimeout(m,r);break}}catch(x){o(x)}};m(),i=function(){l||(l=!0,u>0&&d())}}),i]}function ai(e){for(var t=0,r=0;r<e.length;++r)t+=Math.abs(e[r]);return t}function Ar(e){var t=new Error(e);return t.name=e,t}function Rr(e,t,r){var n,a,i;return r===void 0&&(r=50),re(this,void 0,void 0,function(){var s,o;return ne(this,function(l){switch(l.label){case 0:s=document,l.label=1;case 1:return s.body?[3,3]:[4,et(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 d=!1,m=function(){d=!0,c()},h=function(N){d=!0,u(N)};o.onload=m,o.onerror=h;var x=o.style;x.setProperty("display","block","important"),x.position="absolute",x.top="0",x.left="0",x.visibility="hidden",t&&"srcdoc"in o?o.srcdoc=t:o.src="about:blank",s.body.appendChild(o);var b=function(){var N,y;d||(((y=(N=o.contentWindow)===null||N===void 0?void 0:N.document)===null||y===void 0?void 0:y.readyState)==="complete"?m():setTimeout(b,10))};b()})];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,et(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 ii(e){for(var t=Ea(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"?si(a.style,l):a.setAttribute(o,l)}return a}function si(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 oi(){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 ci="mmMwWLliI0O&1",li="48px",Se=["monospace","sans-serif","serif"],Zr=["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 di(){var e=this;return Rr(function(t,r){var n=r.document;return re(e,void 0,void 0,function(){var a,i,s,o,l,c,u,d,m,h,x,b;return ne(this,function(N){for(a=n.body,a.style.fontSize=li,i=n.createElement("div"),i.style.setProperty("visibility","hidden","important"),s={},o={},l=function(y){var _=n.createElement("span"),L=_.style;return L.position="absolute",L.top="0",L.left="0",L.fontFamily=y,_.textContent=ci,i.appendChild(_),_},c=function(y,_){return l("'".concat(y,"',").concat(_))},u=function(){return Se.map(l)},d=function(){for(var y={},_=function(K){y[K]=Se.map(function(Q){return c(K,Q)})},L=0,O=Zr;L<O.length;L++){var D=O[L];_(D)}return y},m=function(y){return Se.some(function(_,L){return y[L].offsetWidth!==s[_]||y[L].offsetHeight!==o[_]})},h=u(),x=d(),a.appendChild(i),b=0;b<Se.length;b++)s[Se[b]]=h[b].offsetWidth,o[Se[b]]=h[b].offsetHeight;return[2,Zr.filter(function(y){return m(x[y])})]})})})}function ui(){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 fi(){return hi(bi())}function hi(e){var t,r=!1,n,a,i=mi(),s=i[0],o=i[1];return pi(s,o)?(r=gi(o),e?n=a="skipped":(t=_i(s,o),n=t[0],a=t[1])):n=a="unsupported",{winding:r,geometry:n,text:a}}function mi(){var e=document.createElement("canvas");return e.width=1,e.height=1,[e,e.getContext("2d")]}function pi(e,t){return!!(t&&e.toDataURL)}function gi(e){return e.rect(0,0,10,10),e.rect(2,2,6,6),!e.isPointInPath(5,5,"evenodd")}function _i(e,t){vi(e,t);var r=Pt(e);return r!==Pt(e)?["unstable","unstable"]:(yi(e,t),[Pt(e),r])}function vi(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 yi(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 Pt(e){return e.toDataURL()}function bi(){return Y()&&Me()&&Ee()}function ki(){var e=navigator,t=0,r;e.maxTouchPoints!==void 0?t=Mt(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 xi(){return navigator.oscpu}function wi(){var e=navigator,t=[],r=e.language||e.userLanguage||e.browserLanguage||e.systemLanguage;if(r!==void 0&&t.push([r]),Array.isArray(e.languages))Ze()&&Ha()||t.push(e.languages);else if(typeof e.languages=="string"){var n=e.languages;n&&t.push(n.split(","))}return t}function Si(){return window.screen.colorDepth}function Ci(){return oe(G(navigator.deviceMemory),void 0)}function Ii(){if(!(Y()&&Me()&&Ee()))return Ni()}function Ni(){var e=screen,t=function(n){return oe(Mt(n),null)},r=[t(e.width),t(e.height)];return r.sort().reverse(),r}var Ti=2500,Li=10,nt,Vt;function Ai(){if(Vt===void 0){var e=function(){var t=Ft();Wt(t)?Vt=setTimeout(e,Ti):(nt=t,Vt=void 0)};e()}}function Ri(){var e=this;return Ai(),function(){return re(e,void 0,void 0,function(){var t;return ne(this,function(r){switch(r.label){case 0:return t=Ft(),Wt(t)?nt?[2,br([],nt,!0)]:Ja()?[4,Ka()]:[3,2]:[3,2];case 1:r.sent(),t=Ft(),r.label=2;case 2:return Wt(t)||(nt=t),[2,t]}})})}}function Zi(){var e=this;if(Y()&&Me()&&Ee())return function(){return Promise.resolve(void 0)};var t=Ri();return function(){return re(e,void 0,void 0,function(){var r,n;return ne(this,function(a){switch(a.label){case 0:return[4,t()];case 1:return r=a.sent(),n=function(i){return i===null?null:Cr(i,Li)},[2,[n(r[0]),n(r[1]),n(r[2]),n(r[3])]]}})})}}function Ft(){var e=screen;return[oe(G(e.availTop),null),oe(G(e.width)-G(e.availWidth)-oe(G(e.availLeft),0),null),oe(G(e.height)-G(e.availHeight)-oe(G(e.availTop),0),null),oe(G(e.availLeft),null)]}function Wt(e){for(var t=0;t<4;++t)if(e[t])return!1;return!0}function Ei(){return oe(Mt(navigator.hardwareConcurrency),void 0)}function Mi(){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=-ji();return"UTC".concat(n>=0?"+":"").concat(n)}function ji(){var e=new Date().getFullYear();return Math.max(G(new Date(e,0,1).getTimezoneOffset()),G(new Date(e,6,1).getTimezoneOffset()))}function Oi(){try{return!!window.sessionStorage}catch{return!0}}function Pi(){try{return!!window.localStorage}catch{return!0}}function Vi(){if(!(Tr()||Ba()))try{return!!window.indexedDB}catch{return!0}}function Fi(){return!!window.openDatabase}function Wi(){return navigator.cpuClass}function $i(){var e=navigator.platform;return e==="MacIntel"&&Y()&&!jt()?Xa()?"iPad":"iPhone":e}function Ui(){return navigator.vendor||""}function Di(){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 zi(){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 Bi(){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 Hi(e){var t=(e===void 0?{}:e).debug;return re(this,void 0,void 0,function(){var r,n,a,i,s,o;return ne(this,function(l){switch(l.label){case 0:return Gi()?(r=Bi(),n=Object.keys(r),a=(o=[]).concat.apply(o,n.map(function(c){return r[c]})),[4,Yi(a)]):[2,void 0];case 1:return i=l.sent(),t&&Xi(r,i),s=n.filter(function(c){var u=r[c];return V(u.map(function(d){return i[d]}))>u.length*.6}),s.sort(),[2,s]}})})}function Gi(){return Y()||Ot()}function Yi(e){var t;return re(this,void 0,void 0,function(){var r,n,a,i,l,s,o,l;return ne(this,function(c){switch(c.label){case 0:for(r=document,n=r.createElement("div"),a=new Array(e.length),i={},Er(n),l=0;l<e.length;++l)s=ii(e[l]),s.tagName==="DIALOG"&&s.show(),o=r.createElement("div"),Er(o),o.appendChild(s),n.appendChild(o),a[l]=s;c.label=1;case 1:return r.body?[3,3]:[4,et(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 Er(e){e.style.setProperty("visibility","hidden","important"),e.style.setProperty("display","block","important")}function Xi(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 Ji(){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 Ki(){if(Mr("inverted"))return!0;if(Mr("none"))return!1}function Mr(e){return matchMedia("(inverted-colors: ".concat(e,")")).matches}function Qi(){if(jr("active"))return!0;if(jr("none"))return!1}function jr(e){return matchMedia("(forced-colors: ".concat(e,")")).matches}var qi=100;function es(){if(matchMedia("(min-monochrome: 0)").matches){for(var e=0;e<=qi;++e)if(matchMedia("(max-monochrome: ".concat(e,")")).matches)return e;throw new Error("Too high value")}}function ts(){if(Ce("no-preference"))return 0;if(Ce("high")||Ce("more"))return 1;if(Ce("low")||Ce("less"))return-1;if(Ce("forced"))return 10}function Ce(e){return matchMedia("(prefers-contrast: ".concat(e,")")).matches}function rs(){if(Or("reduce"))return!0;if(Or("no-preference"))return!1}function Or(e){return matchMedia("(prefers-reduced-motion: ".concat(e,")")).matches}function ns(){if(Pr("reduce"))return!0;if(Pr("no-preference"))return!1}function Pr(e){return matchMedia("(prefers-reduced-transparency: ".concat(e,")")).matches}function as(){if(Vr("high"))return!0;if(Vr("standard"))return!1}function Vr(e){return matchMedia("(dynamic-range: ".concat(e,")")).matches}var Z=Math,F=function(){return 0};function is(){var e=Z.acos||F,t=Z.acosh||F,r=Z.asin||F,n=Z.asinh||F,a=Z.atanh||F,i=Z.atan||F,s=Z.sin||F,o=Z.sinh||F,l=Z.cos||F,c=Z.cosh||F,u=Z.tan||F,d=Z.tanh||F,m=Z.exp||F,h=Z.expm1||F,x=Z.log1p||F,b=function(R){return Z.pow(Z.PI,R)},N=function(R){return Z.log(R+Z.sqrt(R*R-1))},y=function(R){return Z.log(R+Z.sqrt(R*R+1))},_=function(R){return Z.log((1+R)/(1-R))/2},L=function(R){return Z.exp(R)-1/Z.exp(R)/2},O=function(R){return(Z.exp(R)+1/Z.exp(R))/2},D=function(R){return Z.exp(R)-1},K=function(R){return(Z.exp(2*R)-1)/(Z.exp(2*R)+1)},Q=function(R){return Z.log(1+R)};return{acos:e(.12312423423423424),acosh:t(1e308),acoshPf:N(1e154),asin:r(.12312423423423424),asinh:n(1),asinhPf:y(1),atanh:a(.5),atanhPf:_(.5),atan:i(.5),sin:s(-1e300),sinh:o(1),sinhPf:L(1),cos:l(10.000000000123),cosh:c(1),coshPf:O(1),tan:u(-1e300),tanh:d(1),tanhPf:K(1),exp:m(1),expm1:h(1),expm1Pf:D(1),log1p:x(10),log1pPf:Q(10),powPI:b(-100)}}var ss="mmMwWLliI0fiflO&1",$t={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};function os(){return cs(function(e,t){for(var r={},n={},a=0,i=Object.keys($t);a<i.length;a++){var s=i[a],o=$t[s],l=o[0],c=l===void 0?{}:l,u=o[1],d=u===void 0?ss:u,m=e.createElement("span");m.textContent=d,m.style.whiteSpace="nowrap";for(var h=0,x=Object.keys(c);h<x.length;h++){var b=x[h],N=c[b];N!==void 0&&(m.style[b]=N)}r[s]=m,t.append(e.createElement("br"),m)}for(var y=0,_=Object.keys($t);y<_.length;y++){var s=_[y];n[s]=r[s].getBoundingClientRect().width}return n})}function cs(e,t){return t===void 0&&(t=4e3),Rr(function(r,n){var a=n.document,i=a.body,s=i.style;s.width="".concat(t,"px"),s.webkitTextSizeAdjust=s.textSizeAdjust="none",Ze()?i.style.zoom="".concat(1/n.devicePixelRatio):Y()&&(i.style.zoom="reset");var o=a.createElement("div");return o.textContent=br([],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 ls(){return navigator.pdfViewerEnabled}function ds(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],t[3]}function us(){var e=window.ApplePaySession;if(typeof e?.canMakePayments!="function")return-1;if(fs())return-3;try{return e.canMakePayments()?1:0}catch(t){return hs(t)}}var fs=oi;function hs(e){if(e instanceof Error&&e.name==="InvalidAccessError"&&/\bfrom\b.*\binsecure\b/i.test(e.message))return-2;throw e}function ms(){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 Fr=-1,Wr=-2,ps=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]),gs=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),_s=["FRAGMENT_SHADER","VERTEX_SHADER"],vs=["LOW_FLOAT","MEDIUM_FLOAT","HIGH_FLOAT","LOW_INT","MEDIUM_INT","HIGH_INT"],$r="WEBGL_debug_renderer_info",ys="WEBGL_polygon_mode";function bs(e){var t,r,n,a,i,s,o=e.cache,l=Ur(o);if(!l)return Fr;if(!Br(l))return Wr;var c=zr()?null:l.getExtension($r);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 ks(e){var t=e.cache,r=Ur(t);if(!r)return Fr;if(!Br(r))return Wr;var n=r.getSupportedExtensions(),a=r.getContextAttributes(),i=[],s=[],o=[],l=[],c=[];if(a)for(var u=0,d=Object.keys(a);u<d.length;u++){var m=d[u];s.push("".concat(m,"=").concat(a[m]))}for(var h=Dr(r),x=0,b=h;x<b.length;x++){var N=b[x],y=r[N];o.push("".concat(N,"=").concat(y).concat(ps.has(y)?"=".concat(r.getParameter(y)):""))}if(n)for(var _=0,L=n;_<L.length;_++){var O=L[_];if(!(O===$r&&zr()||O===ys&&Ss())){var D=r.getExtension(O);if(!D){i.push(O);continue}for(var K=0,Q=Dr(D);K<Q.length;K++){var N=Q[K],y=D[N];l.push("".concat(N,"=").concat(y).concat(gs.has(y)?"=".concat(r.getParameter(y)):""))}}}for(var R=0,z=_s;R<z.length;R++)for(var ue=z[R],tr=0,zn=vs;tr<zn.length;tr++){var Bn=zn[tr],nc=xs(r,ue,Bn);c.push("".concat(ue,".").concat(Bn,"=").concat(nc.join(",")))}return l.sort(),o.sort(),{contextAttributes:s,parameters:o,shaderPrecisions:c,extensions:n,extensionParameters:l,unsupportedExtensions:i}}function Ur(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 xs(e,t,r){var n=e.getShaderPrecisionFormat(e[t],e[r]);return n?[n.rangeMin,n.rangeMax,n.precision]:[]}function Dr(e){return Object.keys(e.__proto__).filter(ws)}function ws(e){return typeof e=="string"&&!e.match(/[^A-Z0-9_x]/)}function zr(){return Lr()}function Ss(){return Ze()||Y()}function Br(e){return typeof e.getParameter=="function"}function Cs(){if(!(Ot()||Y()))return-2;if(!window.AudioContext)return-1;var e=new AudioContext().baseLatency;return e==null?-1:isFinite(e)?e:-3}function Is(){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 Ns={fonts:di,domBlockers:Hi,fontPreferences:os,audio:qa,screenFrame:Zi,canvas:fi,osCpu:xi,languages:wi,colorDepth:Si,deviceMemory:Ci,screenResolution:Ii,hardwareConcurrency:Ei,timezone:Mi,sessionStorage:Oi,localStorage:Pi,indexedDB:Vi,openDatabase:Fi,cpuClass:Wi,platform:$i,plugins:ui,touchSupport:ki,vendor:Ui,vendorFlavors:Di,cookiesEnabled:zi,colorGamut:Ji,invertedColors:Ki,forcedColors:Qi,monochrome:es,contrast:ts,reducedMotion:rs,reducedTransparency:ns,hdr:as,math:is,pdfViewerEnabled:ls,architecture:ds,applePay:us,privateClickMeasurement:ms,audioBaseLatency:Cs,dateTimeLocale:Is,webGlBasics:bs,webGlExtensions:ks};function Ts(e){return za(Ns,e,[])}var Ls="$ if upgrade to Pro: https://fpjs.dev/pro";function As(e){var t=Rs(e),r=Zs(t);return{score:t,comment:Ls.replace(/\$/g,"".concat(r))}}function Rs(e){if(Ot())return .4;if(Y())return jt()&&!(Me()&&Ee())?.5:.3;var t="value"in e.platform?e.platform.value:"";return/^Win/.test(t)?.6:/^Mac/.test(t)?.5:.7}function Zs(e){return Cr(.99+.01*e,1e-4)}function Es(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 Ms(e){return JSON.stringify(e,function(t,r){return r instanceof Error?Wa(r):r},2)}function Hr(e){return Fa(Es(e))}function js(e){var t;return{get visitorId(){return t===void 0&&(t=Hr(this.components)),t},set visitorId(r){t=r},confidence:As(e),components:e,version:kr}}function Os(e){return e===void 0&&(e=50),Aa(e,e*2)}function Ps(e,t){var r=Date.now();return{get:function(n){return re(this,void 0,void 0,function(){var a,i,s;return ne(this,function(o){switch(o.label){case 0:return a=Date.now(),[4,e()];case 1:return i=o.sent(),s=js(i),t||n?.debug,[2,s]}})})}}}function Vs(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var e=new XMLHttpRequest;e.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(kr,"/npm-monitoring"),!0),e.send()}catch{}}function Fs(e){var t;return e===void 0&&(e={}),re(this,void 0,void 0,function(){var r,n,a;return ne(this,function(i){switch(i.label){case 0:return(!((t=e.monitoring)!==null&&t!==void 0)||t)&&Vs(),r=e.delayFallback,n=e.debug,[4,Os(r)];case 1:return i.sent(),a=Ts({cache:{},debug:n}),[2,Ps(a,n)]}})})}var Ws={load:Fs,hashComponents:Hr,componentsToDebugString:Ms},$s=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}}},Us=6e4;function Ds(e){return Promise.race([e.read(),new Promise((t,r)=>setTimeout(()=>r(new Error("Stream timed out — no data received for 60s")),Us))])}async function zs(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(),l=new TextDecoder;let c="";const u=d=>{if(!d.startsWith("data: "))return!1;const m=d.slice(6).trim();if(!m)return!1;if(m==="[DONE]")return r.onEnd(n),!0;try{const h=JSON.parse(m);if(h.type==="session"){const b=h.sessionId;return b&&r.onSession&&r.onSession(b),!1}if(h.type==="done"||h.type==="stop")return r.onEnd(n),!0;if(h.type==="error")throw new Error(h.message??"Stream error");if(h.type==="images"){const b=h.images;return b&&r.onImages&&r.onImages(b),!1}if(h.type==="thinking_chunk"){const b=h.content;return b&&r.onThinkingDelta&&(a+=b,r.onThinkingDelta(b,a)),!1}const x=Bs(h);x&&(n+=x,r.onDelta(x,n))}catch(h){if(!(h instanceof SyntaxError))throw h}return!1};e:for(;;){const{done:d,value:m}=await Ds(o);if(d)break;c+=l.decode(m,{stream:!0});const h=c.lastIndexOf(`
5
- `);if(h===-1)continue;const x=c.slice(0,h);c=c.slice(h+1);for(const b of x.split(`
6
- `))if(u(b))break e}r.onEnd(n)}catch(i){r.onError(i instanceof Error?i:new Error(String(i)))}}function Bs(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 Hs=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()}},Gs="agentforge";function Ut(e){return`${Gs}:session:${e}`}function Ys(e){try{return sessionStorage.getItem(Ut(e))??void 0}catch{return}}function Dt(e,t){try{sessionStorage.setItem(Ut(e),t)}catch{}}function Gr(e){try{sessionStorage.removeItem(Ut(e))}catch{}}function je(){return`msg-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`}function Xs(e){return{id:je(),role:"assistant",content:e,createdAt:new Date().toISOString(),status:"sent"}}var Js=class{config;apiClient;state;greetingShown=!1;fingerprint;emitter;constructor(e,t,r){this.hostConfig=t,this.onStateChange=r,this.config=e,this.apiClient=new $s(e.apiBaseUrl),this.emitter=new Hs,this.initializeFingerprint();const n=e.sessionId??Ys(e.agentId);e.sessionId&&Dt(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 Ws.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(){if(this.state.initStatus==="error")return;const e=!this.greetingShown&&!!this.config.greeting;e&&(this.greetingShown=!0),this.setState({isOpen:!0,messages:e?[Xs(this.config.greeting),...this.state.messages]:this.state.messages})}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=Ae(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:je(),role:a.role,content:a.content,images:a.images&&a.images.length>0?a.images:void 0,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)}reset(){Gr(this.config.agentId),this.greetingShown=!1,this.setState({sessionId:void 0,messages:[],isLoading:!1,error:null}),this.state.isOpen&&this.openWithGreeting()}handleSessionExpired(){Gr(this.config.agentId),this.setState({sessionId:void 0})}async sendMessage(e,t){if(this.state.isLoading||!e.trim()||this.state.initStatus!=="ready")return;let r;if(t)try{const i=await Ks(t);r=(await this.apiClient.uploadImage(i,t.type,t.name)).url}catch(i){const s=i instanceof Error?i.message:"Image upload failed";this.setState({error:s});return}const n={id:je(),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,userId:this.config.userId,name:this.config.name,email:this.config.email,authUserId:this.config.authUserId,fingerprint:this.fingerprint,metadata:this.config.metadata,imageUrl:t}),a={id:je(),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&&Dt(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=je(),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 zs(this.config.apiBaseUrl,{agentId:this.config.agentId,message:e,sessionId:this.state.sessionId,tenantId:this.config.tenantId,userId:this.config.userId,name:this.config.name,email:this.config.email,authUserId:this.config.authUserId,fingerprint:this.fingerprint,metadata:this.config.metadata,imageUrl:t},{onSession:s=>{this.setState({sessionId:s}),Dt(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(l=>l.id!==n),isLoading:!1});return}const o=this.state.messages.find(l=>l.id===n)?.content??"";this.updateMessage(n,{content:o||"Something went wrong. Please try again.",status:"error"}),this.setState({isLoading:!1,error:"Something went wrong. Please try again."}),this.emitter.emit("message:error",{error:s.message,message:null})}}),i&&(this.handleSessionExpired(),await this.sendStreaming(e,t,!0))}};function Ks(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 Qs(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 qs(e,t){e.textContent=t}function eo(e){e.remove()}function to(){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 ro(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 no(e){return e.setAttribute("data-agentkit-root","inline"),getComputedStyle(e).position==="static"&&(e.style.position="relative"),e}function ao(e){e.remove()}function io(e){e.removeAttribute("data-agentkit-root")}function Yr(e,t,r,n,a){const i=e.mode==="inline";let s=!1;const o=i&&a?no(a):!i&&a?ro(a):to(),l=Qs(o);qs(l.styleSlot,n);const c=new Js(e,t,(m,h)=>{s||u.update(m,h)}),u=r(l.mountPoint,e,c.getState(),{onOpen:()=>d.open(),onClose:()=>d.close(),onSendMessage:(m,h)=>{c.sendMessage(m,h)}});c.hydrate(),setTimeout(()=>{s||c.emitter.emit("ready",c.getState())},0);const d={open(){s||(c.setOpen(!0),c.emitter.emit("open"))},close(){s||(c.setOpen(!1),c.emitter.emit("close"))},toggle(){c.getState().isOpen?d.close():d.open()},async sendMessage(m,h){await c.sendMessage(m,h)},reset(){s||(c.reset(),c.emitter.emit("reset"))},destroy(){s||(s=!0,u.destroy(),eo(l.host),i&&a?io(a):ao(o),c.emitter.emit("destroy"),c.emitter.removeAllListeners())},on(m,h){c.emitter.on(m,h)},off(m,h){c.emitter.off(m,h)},getState(){return c.getState()}};return d}var Oe=new Map,so=0;function Xr(e){const t=`agentkit-widget-${++so}`,r=e.destroy.bind(e);return e.destroy=()=>{Oe.delete(t),r()},Oe.set(t,e),t}function oo(e,t,r){const n={...e,mode:"floating"},a=Yr(Ae(n),n,t,r);return Xr(a),a}function co(e,t,r,n){const a={...t,mode:"inline"},i=Yr(Ae(a),a,r,n,e);return Xr(i),i}function lo(e){e?Oe.get(e)?.destroy():(Oe.forEach(t=>t.destroy()),Oe.clear())}var at,I,Jr,uo,pe,Kr,Qr,qr,en,zt,Bt,Ht,fo,it={},st=[],ho=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Pe=Array.isArray;function ce(e,t){for(var r in t)e[r]=t[r];return e}function Gt(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ve(e,t,r){var n,a,i,s={};for(i in t)i=="key"?n=t[i]:i=="ref"?a=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?at.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)s[i]===void 0&&(s[i]=e.defaultProps[i]);return ot(e,s,n,a,null)}function ot(e,t,r,n,a){var i={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a??++Jr,__i:-1,__u:0};return a==null&&I.vnode!=null&&I.vnode(i),i}function X(e){return e.children}function le(e,t){this.props=e,this.context=t}function Ie(e,t){if(t==null)return e.__?Ie(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?Ie(e):null}function mo(e){if(e.__P&&e.__d){var t=e.__v,r=t.__e,n=[],a=[],i=ce({},t);i.__v=t.__v+1,I.vnode&&I.vnode(i),Yt(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[r]:null,n,r??Ie(t),!!(32&t.__u),a),i.__v=t.__v,i.__.__k[i.__i]=i,cn(n,i,a),t.__e=t.__=null,i.__e!=r&&tn(i)}}function tn(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),tn(e)}function rn(e){(!e.__d&&(e.__d=!0)&&pe.push(e)&&!ct.__r++||Kr!=I.debounceRendering)&&((Kr=I.debounceRendering)||Qr)(ct)}function ct(){try{for(var e,t=1;pe.length;)pe.length>t&&pe.sort(qr),e=pe.shift(),t=pe.length,mo(e)}finally{pe.length=ct.__r=0}}function nn(e,t,r,n,a,i,s,o,l,c,u){var d,m,h,x,b,N,y,_=n&&n.__k||st,L=t.length;for(l=po(r,t,_,l,L),d=0;d<L;d++)(h=r.__k[d])!=null&&(m=h.__i!=-1&&_[h.__i]||it,h.__i=d,N=Yt(e,h,m,a,i,s,o,l,c,u),x=h.__e,h.ref&&m.ref!=h.ref&&(m.ref&&Jt(m.ref,null,h),u.push(h.ref,h.__c||x,h)),b==null&&x!=null&&(b=x),(y=!!(4&h.__u))||m.__k===h.__k?l=an(h,l,e,y):typeof h.type=="function"&&N!==void 0?l=N:x&&(l=x.nextSibling),h.__u&=-7);return r.__e=b,l}function po(e,t,r,n,a){var i,s,o,l,c,u=r.length,d=u,m=0;for(e.__k=new Array(a),i=0;i<a;i++)(s=t[i])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[i]=ot(null,s,null,null,null):Pe(s)?s=e.__k[i]=ot(X,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[i]=ot(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[i]=s,l=i+m,s.__=e,s.__b=e.__b+1,o=null,(c=s.__i=go(s,r,l,d))!=-1&&(d--,(o=r[c])&&(o.__u|=2)),o==null||o.__v==null?(c==-1&&(a>u?m--:a<u&&m++),typeof s.type!="function"&&(s.__u|=4)):c!=l&&(c==l-1?m--:c==l+1?m++:(c>l?m--:m++,s.__u|=4))):e.__k[i]=null;if(d)for(i=0;i<u;i++)(o=r[i])!=null&&(2&o.__u)==0&&(o.__e==n&&(n=Ie(o)),dn(o,o));return n}function an(e,t,r,n){var a,i;if(typeof e.type=="function"){for(a=e.__k,i=0;a&&i<a.length;i++)a[i]&&(a[i].__=e,t=an(a[i],t,r,n));return t}e.__e!=t&&(n&&(t&&e.type&&!t.parentNode&&(t=Ie(e)),r.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function de(e,t){return t=t||[],e==null||typeof e=="boolean"||(Pe(e)?e.some(function(r){de(r,t)}):t.push(e)),t}function go(e,t,r,n){var a,i,s,o=e.key,l=e.type,c=t[r],u=c!=null&&(2&c.__u)==0;if(c===null&&o==null||u&&o==c.key&&l==c.type)return r;if(n>(u?1:0)){for(a=r-1,i=r+1;a>=0||i<t.length;)if((c=t[s=a>=0?a--:i++])!=null&&(2&c.__u)==0&&o==c.key&&l==c.type)return s}return-1}function sn(e,t,r){t[0]=="-"?e.setProperty(t,r??""):e[t]=r==null?"":typeof r!="number"||ho.test(t)?r:r+"px"}function lt(e,t,r,n,a){var i,s;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||sn(e.style,t,"");if(r)for(t in r)n&&r[t]==n[t]||sn(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(en,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=r,r?n?r.u=n.u:(r.u=zt,e.addEventListener(t,i?Ht:Bt,i)):e.removeEventListener(t,i?Ht:Bt,i);else{if(a=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function on(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.t==null)t.t=zt++;else if(t.t<r.u)return;return r(I.event?I.event(t):t)}}}function Yt(e,t,r,n,a,i,s,o,l,c){var u,d,m,h,x,b,N,y,_,L,O,D,K,Q,R,z=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),i=[o=t.__e=r.__e]),(u=I.__b)&&u(t);e:if(typeof z=="function")try{if(y=t.props,_=z.prototype&&z.prototype.render,L=(u=z.contextType)&&n[u.__c],O=u?L?L.props.value:u.__:n,r.__c?N=(d=t.__c=r.__c).__=d.__E:(_?t.__c=d=new z(y,O):(t.__c=d=new le(y,O),d.constructor=z,d.render=vo),L&&L.sub(d),d.state||(d.state={}),d.__n=n,m=d.__d=!0,d.__h=[],d._sb=[]),_&&d.__s==null&&(d.__s=d.state),_&&z.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=ce({},d.__s)),ce(d.__s,z.getDerivedStateFromProps(y,d.__s))),h=d.props,x=d.state,d.__v=t,m)_&&z.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),_&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(_&&z.getDerivedStateFromProps==null&&y!==h&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(y,O),t.__v==r.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(y,d.__s,O)===!1){t.__v!=r.__v&&(d.props=y,d.state=d.__s,d.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(ue){ue&&(ue.__=t)}),st.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&s.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(y,d.__s,O),_&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(h,x,b)})}if(d.context=O,d.props=y,d.__P=e,d.__e=!1,D=I.__r,K=0,_)d.state=d.__s,d.__d=!1,D&&D(t),u=d.render(d.props,d.state,d.context),st.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,D&&D(t),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++K<25);d.state=d.__s,d.getChildContext!=null&&(n=ce(ce({},n),d.getChildContext())),_&&!m&&d.getSnapshotBeforeUpdate!=null&&(b=d.getSnapshotBeforeUpdate(h,x)),Q=u!=null&&u.type===X&&u.key==null?ln(u.props.children):u,o=nn(e,Pe(Q)?Q:[Q],t,r,n,a,i,s,o,l,c),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),N&&(d.__E=d.__=null)}catch(ue){if(t.__v=null,l||i!=null)if(ue.then){for(t.__u|=l?160:128;o&&o.nodeType==8&&o.nextSibling;)o=o.nextSibling;i[i.indexOf(o)]=null,t.__e=o}else{for(R=i.length;R--;)Gt(i[R]);Xt(t)}else t.__e=r.__e,t.__k=r.__k,ue.then||Xt(t);I.__e(ue,t,r)}else i==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):o=t.__e=_o(r.__e,t,r,n,a,i,s,l,c);return(u=I.diffed)&&u(t),128&t.__u?void 0:o}function Xt(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Xt))}function cn(e,t,r){for(var n=0;n<r.length;n++)Jt(r[n],r[++n],r[++n]);I.__c&&I.__c(t,e),e.some(function(a){try{e=a.__h,a.__h=[],e.some(function(i){i.call(a)})}catch(i){I.__e(i,a.__v)}})}function ln(e){return typeof e!="object"||e==null||e.__b>0?e:Pe(e)?e.map(ln):ce({},e)}function _o(e,t,r,n,a,i,s,o,l){var c,u,d,m,h,x,b,N=r.props||it,y=t.props,_=t.type;if(_=="svg"?a="http://www.w3.org/2000/svg":_=="math"?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c<i.length;c++)if((h=i[c])&&"setAttribute"in h==!!_&&(_?h.localName==_:h.nodeType==3)){e=h,i[c]=null;break}}if(e==null){if(_==null)return document.createTextNode(y);e=document.createElementNS(a,_,y.is&&y),o&&(I.__m&&I.__m(t,i),o=!1),i=null}if(_==null)N===y||o&&e.data==y||(e.data=y);else{if(i=i&&at.call(e.childNodes),!o&&i!=null)for(N={},c=0;c<e.attributes.length;c++)N[(h=e.attributes[c]).name]=h.value;for(c in N)h=N[c],c=="dangerouslySetInnerHTML"?d=h:c=="children"||c in y||c=="value"&&"defaultValue"in y||c=="checked"&&"defaultChecked"in y||lt(e,c,null,h,a);for(c in y)h=y[c],c=="children"?m=h:c=="dangerouslySetInnerHTML"?u=h:c=="value"?x=h:c=="checked"?b=h:o&&typeof h!="function"||N[c]===h||lt(e,c,h,N[c],a);if(u)o||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=""),nn(t.type=="template"?e.content:e,Pe(m)?m:[m],t,r,n,_=="foreignObject"?"http://www.w3.org/1999/xhtml":a,i,s,i?i[0]:r.__k&&Ie(r,0),o,l),i!=null)for(c=i.length;c--;)Gt(i[c]);o||(c="value",_=="progress"&&x==null?e.removeAttribute("value"):x!=null&&(x!==e[c]||_=="progress"&&!x||_=="option"&&x!=N[c])&&lt(e,c,x,N[c],a),c="checked",b!=null&&b!=e[c]&&lt(e,c,b,N[c],a))}return e}function Jt(e,t,r){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(a){I.__e(a,r)}}function dn(e,t,r){var n,a;if(I.unmount&&I.unmount(e),(n=e.ref)&&(n.current&&n.current!=e.__e||Jt(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){I.__e(i,t)}n.base=n.__P=null}if(n=e.__k)for(a=0;a<n.length;a++)n[a]&&dn(n[a],t,r||typeof e.type!="function");r||Gt(e.__e),e.__c=e.__=e.__e=void 0}function vo(e,t,r){return this.constructor(e,r)}function un(e,t,r){var n,a,i,s;t==document&&(t=document.documentElement),I.__&&I.__(e,t),a=(n=typeof r=="function")?null:r&&r.__k||t.__k,i=[],s=[],Yt(t,e=(!n&&r||t).__k=Ve(X,null,[e]),a||it,it,t.namespaceURI,!n&&r?[r]:a?null:t.firstChild?at.call(t.childNodes):null,i,!n&&r?r:a?a.__e:t.firstChild,n,s),cn(i,e,s)}at=st.slice,I={__e:function(e,t,r,n){for(var a,i,s;t=t.__;)if((a=t.__c)&&!a.__)try{if((i=a.constructor)&&i.getDerivedStateFromError!=null&&(a.setState(i.getDerivedStateFromError(e)),s=a.__d),a.componentDidCatch!=null&&(a.componentDidCatch(e,n||{}),s=a.__d),s)return a.__E=a}catch(o){e=o}throw e}},Jr=0,uo=function(e){return e!=null&&e.constructor===void 0},le.prototype.setState=function(e,t){var r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ce({},this.state);typeof e=="function"&&(e=e(ce({},r),this.props)),e&&ce(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),rn(this))},le.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),rn(this))},le.prototype.render=X,pe=[],Qr=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,qr=function(e,t){return e.__v.__b-t.__v.__b},ct.__r=0,en=/(PointerCapture)$|Capture$/i,zt=0,Bt=on(!1),Ht=on(!0),fo=0;var Fe,M,Kt,fn,dt=0,hn=[],j=I,mn=j.__b,pn=j.__r,gn=j.diffed,_n=j.__c,vn=j.unmount,yn=j.__;function Qt(e,t){j.__h&&j.__h(M,e,dt||t),dt=0;var r=M.__H||(M.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function ut(e){return dt=1,yo(xn,e)}function yo(e,t,r){var n=Qt(Fe++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):xn(void 0,t),function(o){var l=n.__N?n.__N[0]:n.__[0],c=n.t(l,o);l!==c&&(n.__N=[c,n.__[1]],n.__c.setState({}))}],n.__c=M,!M.__f)){var a=function(o,l,c){if(!n.__c.__H)return!0;var u=n.__c.__H.__.filter(function(m){return m.__c});if(u.every(function(m){return!m.__N}))return!i||i.call(this,o,l,c);var d=n.__c.props!==o;return u.some(function(m){if(m.__N){var h=m.__[0];m.__=m.__N,m.__N=void 0,h!==m.__[0]&&(d=!0)}}),i&&i.call(this,o,l,c)||d};M.__f=!0;var i=M.shouldComponentUpdate,s=M.componentWillUpdate;M.componentWillUpdate=function(o,l,c){if(this.__e){var u=i;i=void 0,a(o,l,c),i=u}s&&s.call(this,o,l,c)},M.shouldComponentUpdate=a}return n.__N||n.__}function ft(e,t){var r=Qt(Fe++,3);!j.__s&&kn(r.__H,t)&&(r.__=e,r.u=t,M.__H.__h.push(r))}function ht(e){return dt=5,bo(function(){return{current:e}},[])}function bo(e,t){var r=Qt(Fe++,7);return kn(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function ko(){for(var e;e=hn.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(mt),t.__h.some(qt),t.__h=[]}catch(r){t.__h=[],j.__e(r,e.__v)}}}j.__b=function(e){M=null,mn&&mn(e)},j.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),yn&&yn(e,t)},j.__r=function(e){pn&&pn(e),Fe=0;var t=(M=e.__c).__H;t&&(Kt===M?(t.__h=[],M.__h=[],t.__.some(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.some(mt),t.__h.some(qt),t.__h=[],Fe=0)),Kt=M},j.diffed=function(e){gn&&gn(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(hn.push(t)!==1&&fn===j.requestAnimationFrame||((fn=j.requestAnimationFrame)||xo)(ko)),t.__H.__.some(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Kt=M=null},j.__c=function(e,t){t.some(function(r){try{r.__h.some(mt),r.__h=r.__h.filter(function(n){return!n.__||qt(n)})}catch(n){t.some(function(a){a.__h&&(a.__h=[])}),t=[],j.__e(n,r.__v)}}),_n&&_n(e,t)},j.unmount=function(e){vn&&vn(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.some(function(n){try{mt(n)}catch(a){t=a}}),r.__H=void 0,t&&j.__e(t,r.__v))};var bn=typeof requestAnimationFrame=="function";function xo(e){var t,r=function(){clearTimeout(n),bn&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,35);bn&&(t=requestAnimationFrame(r))}function mt(e){var t=M,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),M=t}function qt(e){var t=M;e.__c=e.__(),M=t}function kn(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function xn(e,t){return typeof t=="function"?t(e):t}function wo(e,t){for(var r in t)e[r]=t[r];return e}function wn(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var n in t)if(n!=="__source"&&e[n]!==t[n])return!0;return!1}function Sn(e,t){this.props=e,this.context=t}(Sn.prototype=new le).isPureReactComponent=!0,Sn.prototype.shouldComponentUpdate=function(e,t){return wn(this.props,e)||wn(this.state,t)};var Cn=I.__b;I.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Cn&&Cn(e)};var Ec=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911,In=function(e,t){return e==null?null:de(de(e).map(t))},Mc={map:In,forEach:In,count:function(e){return e?de(e).length:0},only:function(e){var t=de(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:de},So=I.__e;I.__e=function(e,t,r,n){if(e.then){for(var a,i=t;i=i.__;)if((a=i.__c)&&a.__c)return t.__e??(t.__e=r.__e,t.__k=r.__k),a.__c(e,t)}So(e,t,r,n)};var Nn=I.unmount;function Tn(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),e.__c.__H=null),(e=wo({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return Tn(n,t,r)})),e}function Ln(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return Ln(n,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function er(){this.__u=0,this.o=null,this.__b=null}function An(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function pt(){this.i=null,this.l=null}I.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Nn&&Nn(e)},(er.prototype=new le).__c=function(e,t){var r=t.__c,n=this;n.o??=[],n.o.push(r);var a=An(n.__v),i=!1,s=function(){i||n.__z||(i=!0,r.__R=null,a?a(l):l())};r.__R=s;var o=r.__P;r.__P=null;var l=function(){if(!--n.__u){if(n.state.__a){var c=n.state.__a;n.__v.__k[0]=Ln(c,c.__c.__P,c.__c.__O)}var u;for(n.setState({__a:n.__b=null});u=n.o.pop();)u.__P=o,u.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),e.then(s,s)},er.prototype.componentWillUnmount=function(){this.o=[]},er.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=Tn(this.__b,r,n.__O=n.__P)}this.__b=null}var a=t.__a&&Ve(X,null,e.fallback);return a&&(a.__u&=-33),[Ve(X,null,t.__a?null:e.children),a]};var Rn=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};(pt.prototype=new le).__a=function(e){var t=this,r=An(t.__v),n=t.l.get(e);return n[0]++,function(a){var i=function(){t.props.revealOrder?(n.push(a),Rn(t,e,n)):a()};r?r(i):i()}},pt.prototype.render=function(e){this.i=null,this.l=new Map;var t=de(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},pt.prototype.componentDidUpdate=pt.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,r){Rn(e,r,t)})};var Co=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Io=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,No=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,To=/[A-Z0-9]/g,Lo=typeof document<"u",Ao=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function Ro(e,t,r){return t.__k??(t.textContent=""),un(e,t),typeof r=="function"&&r(),e?e.__c:null}le.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(le.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Zn=I.event;I.event=function(e){return Zn&&(e=Zn(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var En,Zo={configurable:!0,get:function(){return this.class}},Mn=I.vnode;I.vnode=function(e){typeof e.type=="string"&&(function(t){var r=t.props,n=t.type,a={},i=n.indexOf("-")==-1;for(var s in r){var o=r[s];if(!(s==="value"&&"defaultValue"in r&&o==null||Lo&&s==="children"&&n==="noscript"||s==="class"||s==="className")){var l=s.toLowerCase();s==="defaultValue"&&"value"in r&&r.value==null?s="value":s==="download"&&o===!0?o="":l==="translate"&&o==="no"?o=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?s="ondblclick":l!=="onchange"||n!=="input"&&n!=="textarea"||Ao(r.type)?l==="onfocus"?s="onfocusin":l==="onblur"?s="onfocusout":No.test(s)&&(s=l):l=s="oninput":i&&Io.test(s)?s=s.replace(To,"-$&").toLowerCase():o===null&&(o=void 0),l==="oninput"&&a[s=l]&&(s="oninputCapture"),a[s]=o}}n=="select"&&(a.multiple&&Array.isArray(a.value)&&(a.value=de(r.children).forEach(function(c){c.props.selected=a.value.indexOf(c.props.value)!=-1})),a.defaultValue!=null&&(a.value=de(r.children).forEach(function(c){c.props.selected=a.multiple?a.defaultValue.indexOf(c.props.value)!=-1:a.defaultValue==c.props.value}))),r.class&&!r.className?(a.class=r.class,Object.defineProperty(a,"className",Zo)):r.className&&(a.class=a.className=r.className),t.props=a})(e),e.$$typeof=Co,Mn&&Mn(e)};var jn=I.__r;I.__r=function(e){jn&&jn(e),En=e.__c};var On=I.diffed;I.diffed=function(e){On&&On(e);var t=e.props,r=e.__e;r!=null&&e.type==="textarea"&&"value"in t&&t.value!==r.value&&(r.value=t.value==null?"":t.value),En=null};function Eo(e){return!!e.__k&&(un(null,e),!0)}function Mo(e){return{render:function(t){Ro(t,e)},unmount:function(){Eo(e)}}}function jo(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 Oo(e){return e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Po=`
1
+ var AgentKit=(function(xt){Object.defineProperty(xt,Symbol.toStringTag,{value:"Module"});var A;(function(e){e.assertEqual=a=>{};function t(a){}e.assertIs=t;function n(a){throw new Error}e.assertNever=n,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 r(a,i=" | "){return a.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(A||(A={}));var hn;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(hn||(hn={}));var y=A.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),he=e=>{switch(typeof e){case"undefined":return y.undefined;case"string":return y.string;case"number":return Number.isNaN(e)?y.nan:y.number;case"boolean":return y.boolean;case"function":return y.function;case"bigint":return y.bigint;case"symbol":return y.symbol;case"object":return Array.isArray(e)?y.array:e===null?y.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?y.promise:typeof Map<"u"&&e instanceof Map?y.map:typeof Set<"u"&&e instanceof Set?y.set:typeof Date<"u"&&e instanceof Date?y.date:y.object;default:return y.unknown}},p=A.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),ne=class Yr extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(i){return i.message},r={_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)r._errors.push(n(s));else{let o=r,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(n(s))),o=o[c],l++}}};return a(this),r}static assert(t){if(!(t instanceof Yr))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,A.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const a of this.issues)if(a.path.length>0){const i=a.path[0];n[i]=n[i]||[],n[i].push(t(a))}else r.push(t(a));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};ne.create=e=>new ne(e);var Re=(e,t)=>{let n;switch(e.code){case p.invalid_type:e.received===y.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case p.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,A.jsonStringifyReplacer)}`;break;case p.unrecognized_keys:n=`Unrecognized key(s) in object: ${A.joinValues(e.keys,", ")}`;break;case p.invalid_union:n="Invalid input";break;case p.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${A.joinValues(e.options)}`;break;case p.invalid_enum_value:n=`Invalid enum value. Expected ${A.joinValues(e.options)}, received '${e.received}'`;break;case p.invalid_arguments:n="Invalid function arguments";break;case p.invalid_return_type:n="Invalid function return type";break;case p.invalid_date:n="Invalid date";break;case p.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:A.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case p.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case p.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case p.custom:n="Invalid input";break;case p.invalid_intersection_types:n="Intersection results could not be merged";break;case p.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case p.not_finite:n="Number must be finite";break;default:n=t.defaultError,A.assertNever(e)}return{message:n}},ea=Re;function wt(){return ea}var St=e=>{const{data:t,path:n,errorMaps:r,issueData:a}=e,i=[...n,...a.path||[]],s={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let o="";const l=r.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 _(e,t){const n=wt(),r=St({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Re?void 0:Re].filter(a=>!!a)});e.common.issues.push(r)}var H=class Xr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const a of n){if(a.status==="aborted")return S;a.status==="dirty"&&t.dirty(),r.push(a.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const a of n){const i=await a.key,s=await a.value;r.push({key:i,value:s})}return Xr.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const a of n){const{key:i,value:s}=a;if(i.status==="aborted"||s.status==="aborted")return S;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||a.alwaysSet)&&(r[i.value]=s.value)}return{status:t.value,value:r}}},S=Object.freeze({status:"aborted"}),Me=e=>({status:"dirty",value:e}),U=e=>({status:"valid",value:e}),mn=e=>e.status==="aborted",pn=e=>e.status==="dirty",ke=e=>e.status==="valid",He=e=>typeof Promise<"u"&&e instanceof Promise,x;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(x||(x={}));var re=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}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}},gn=(e,t)=>{if(ke(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 ne(e.common.issues),this._error)}}};function I(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:a}=e;if(t&&(n||r))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??r??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:l??n??o.defaultError}},description:a}}var T=class{get description(){return this._def.description}_getType(e){return he(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:he(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new H,ctx:{common:e.parent.common,data:e.data,parsedType:he(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(He(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 n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:he(e)};return gn(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:he(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return ke(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>ke(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:he(e)},r=this._parse({data:e,path:n.path,parent:n});return gn(n,await(He(r)?r:Promise.resolve(r)))}refine(e,t){const n=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,a)=>{const i=e(r),s=()=>a.addIssue({code:p.custom,...n(r)});return typeof Promise<"u"&&i instanceof Promise?i.then(o=>o?!0:(s(),!1)):i?!0:(s(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t=="function"?t(n,r):t),!1))}_refinement(e){return new oe({schema:this,typeName:C.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 ce.create(this,this._def)}nullable(){return ve.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xe.create(this)}promise(){return Ze.create(this,this._def)}or(e){return Je.create([this,e],this._def)}and(e){return Qe.create(this,e,this._def)}transform(e){return new oe({...I(this._def),schema:this,typeName:C.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new nt({...I(this._def),innerType:this,defaultValue:t,typeName:C.ZodDefault})}brand(){return new kn({typeName:C.ZodBranded,type:this,...I(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new rt({...I(this._def),innerType:this,catchValue:t,typeName:C.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return bn.create(this,e)}readonly(){return at.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ta=/^c[^\s-]{8,}$/i,na=/^[0-9a-z]+$/,ra=/^[0-9A-HJKMNP-TV-Z]{26}$/i,aa=/^[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,ia=/^[a-z0-9_-]{21}$/i,sa=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,oa=/^[-+]?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)?)??$/,ca=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,la="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ct,da=/^(?:(?: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])$/,ua=/^(?:(?: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])$/,fa=/^(([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]))$/,ha=/^(([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])$/,ma=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,pa=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_n="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ga=new RegExp(`^${_n}$`);function vn(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function _a(e){return new RegExp(`^${vn(e)}$`)}function va(e){let t=`${_n}T${vn(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function ya(e,t){return!!((t==="v4"||!t)&&da.test(e)||(t==="v6"||!t)&&fa.test(e))}function ka(e,t){if(!sa.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||t&&a.alg!==t)}catch{return!1}}function ba(e,t){return!!((t==="v4"||!t)&&ua.test(e)||(t==="v6"||!t)&&ha.test(e))}var Ge=class Be extends T{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==y.string){const a=this._getOrReturnCtx(t);return _(a,{code:p.invalid_type,expected:y.string,received:a.parsedType}),S}const n=new H;let r;for(const a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(r=this._getOrReturnCtx(t,r),_(r,{code:p.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")t.data.length>a.value&&(r=this._getOrReturnCtx(t,r),_(r,{code:p.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=t.data.length>a.value,s=t.data.length<a.value;(i||s)&&(r=this._getOrReturnCtx(t,r),i?_(r,{code:p.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&_(r,{code:p.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")ca.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"email",code:p.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Ct||(Ct=new RegExp(la,"u")),Ct.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"emoji",code:p.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")aa.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"uuid",code:p.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")ia.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"nanoid",code:p.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")ta.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"cuid",code:p.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")na.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"cuid2",code:p.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")ra.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"ulid",code:p.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{r=this._getOrReturnCtx(t,r),_(r,{validation:"url",code:p.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"regex",code:p.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?t.data=t.data.trim():a.kind==="includes"?t.data.includes(a.value,a.position)||(r=this._getOrReturnCtx(t,r),_(r,{code:p.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.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)||(r=this._getOrReturnCtx(t,r),_(r,{code:p.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(r=this._getOrReturnCtx(t,r),_(r,{code:p.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?va(a).test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{code:p.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?ga.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{code:p.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?_a(a).test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{code:p.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?oa.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"duration",code:p.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?ya(t.data,a.version)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"ip",code:p.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?ka(t.data,a.alg)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"jwt",code:p.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?ba(t.data,a.version)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"cidr",code:p.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?ma.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"base64",code:p.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?pa.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"base64url",code:p.invalid_string,message:a.message}),n.dirty()):A.assertNever(a);return{status:n.value,value:t.data}}_regex(t,n,r){return this.refinement(a=>t.test(a),{validation:n,code:p.invalid_string,...x.errToObj(r)})}_addCheck(t){return new Be({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...x.errToObj(t)})}url(t){return this._addCheck({kind:"url",...x.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...x.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...x.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...x.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...x.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...x.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...x.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...x.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...x.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...x.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...x.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...x.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,...x.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,...x.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...x.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...x.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...x.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...x.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...x.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...x.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...x.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...x.errToObj(n)})}nonempty(t){return this.min(1,x.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 n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Ge.create=e=>new Ge({checks:[],typeName:C.ZodString,coerce:e?.coerce??!1,...I(e)});function xa(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,a=n>r?n:r;return Number.parseInt(e.toFixed(a).replace(".",""))%Number.parseInt(t.toFixed(a).replace(".",""))/10**a}var It=class cn extends T{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)!==y.number){const a=this._getOrReturnCtx(t);return _(a,{code:p.invalid_type,expected:y.number,received:a.parsedType}),S}let n;const r=new H;for(const a of this._def.checks)a.kind==="int"?A.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),_(n,{code:p.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),_(n,{code:p.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),_(n,{code:p.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="multipleOf"?xa(t.data,a.value)!==0&&(n=this._getOrReturnCtx(t,n),_(n,{code:p.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),_(n,{code:p.not_finite,message:a.message}),r.dirty()):A.assertNever(a);return{status:r.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,x.toString(n))}gt(t,n){return this.setLimit("min",t,!1,x.toString(n))}lte(t,n){return this.setLimit("max",t,!0,x.toString(n))}lt(t,n){return this.setLimit("max",t,!1,x.toString(n))}setLimit(t,n,r,a){return new cn({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:x.toString(a)}]})}_addCheck(t){return new cn({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:x.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:x.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:x.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:x.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:x.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:x.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:x.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:x.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:x.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&A.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}};It.create=e=>new It({checks:[],typeName:C.ZodNumber,coerce:e?.coerce||!1,...I(e)});var Nt=class ln extends T{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)!==y.bigint)return this._getInvalidInput(t);let n;const r=new H;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),_(n,{code:p.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),_(n,{code:p.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),_(n,{code:p.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):A.assertNever(a);return{status:r.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return _(n,{code:p.invalid_type,expected:y.bigint,received:n.parsedType}),S}gte(t,n){return this.setLimit("min",t,!0,x.toString(n))}gt(t,n){return this.setLimit("min",t,!1,x.toString(n))}lte(t,n){return this.setLimit("max",t,!0,x.toString(n))}lt(t,n){return this.setLimit("max",t,!1,x.toString(n))}setLimit(t,n,r,a){return new ln({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:x.toString(a)}]})}_addCheck(t){return new ln({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:x.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:x.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:x.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:x.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:x.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Nt.create=e=>new Nt({checks:[],typeName:C.ZodBigInt,coerce:e?.coerce??!1,...I(e)});var Tt=class extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==y.boolean){const t=this._getOrReturnCtx(e);return _(t,{code:p.invalid_type,expected:y.boolean,received:t.parsedType}),S}return U(e.data)}};Tt.create=e=>new Tt({typeName:C.ZodBoolean,coerce:e?.coerce||!1,...I(e)});var Lt=class Jr extends T{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==y.date){const a=this._getOrReturnCtx(t);return _(a,{code:p.invalid_type,expected:y.date,received:a.parsedType}),S}if(Number.isNaN(t.data.getTime()))return _(this._getOrReturnCtx(t),{code:p.invalid_date}),S;const n=new H;let r;for(const a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(r=this._getOrReturnCtx(t,r),_(r,{code:p.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?t.data.getTime()>a.value&&(r=this._getOrReturnCtx(t,r),_(r,{code:p.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):A.assertNever(a);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Jr({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:x.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:x.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};Lt.create=e=>new Lt({checks:[],coerce:e?.coerce||!1,typeName:C.ZodDate,...I(e)});var At=class extends T{_parse(e){if(this._getType(e)!==y.symbol){const t=this._getOrReturnCtx(e);return _(t,{code:p.invalid_type,expected:y.symbol,received:t.parsedType}),S}return U(e.data)}};At.create=e=>new At({typeName:C.ZodSymbol,...I(e)});var Ye=class extends T{_parse(e){if(this._getType(e)!==y.undefined){const t=this._getOrReturnCtx(e);return _(t,{code:p.invalid_type,expected:y.undefined,received:t.parsedType}),S}return U(e.data)}};Ye.create=e=>new Ye({typeName:C.ZodUndefined,...I(e)});var Xe=class extends T{_parse(e){if(this._getType(e)!==y.null){const t=this._getOrReturnCtx(e);return _(t,{code:p.invalid_type,expected:y.null,received:t.parsedType}),S}return U(e.data)}};Xe.create=e=>new Xe({typeName:C.ZodNull,...I(e)});var Et=class extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return U(e.data)}};Et.create=e=>new Et({typeName:C.ZodAny,...I(e)});var be=class extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return U(e.data)}};be.create=e=>new be({typeName:C.ZodUnknown,...I(e)});var me=class extends T{_parse(e){const t=this._getOrReturnCtx(e);return _(t,{code:p.invalid_type,expected:y.never,received:t.parsedType}),S}};me.create=e=>new me({typeName:C.ZodNever,...I(e)});var Rt=class extends T{_parse(e){if(this._getType(e)!==y.undefined){const t=this._getOrReturnCtx(e);return _(t,{code:p.invalid_type,expected:y.void,received:t.parsedType}),S}return U(e.data)}};Rt.create=e=>new Rt({typeName:C.ZodVoid,...I(e)});var xe=class kt extends T{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),a=this._def;if(n.parsedType!==y.array)return _(n,{code:p.invalid_type,expected:y.array,received:n.parsedType}),S;if(a.exactLength!==null){const s=n.data.length>a.exactLength.value,o=n.data.length<a.exactLength.value;(s||o)&&(_(n,{code:s?p.too_big:p.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}),r.dirty())}if(a.minLength!==null&&n.data.length<a.minLength.value&&(_(n,{code:p.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&n.data.length>a.maxLength.value&&(_(n,{code:p.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,o)=>a.type._parseAsync(new re(n,s,n.path,o)))).then(s=>H.mergeArray(r,s));const i=[...n.data].map((s,o)=>a.type._parseSync(new re(n,s,n.path,o)));return H.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new kt({...this._def,minLength:{value:t,message:x.toString(n)}})}max(t,n){return new kt({...this._def,maxLength:{value:t,message:x.toString(n)}})}length(t,n){return new kt({...this._def,exactLength:{value:t,message:x.toString(n)}})}nonempty(t){return this.min(1,t)}};xe.create=(e,t)=>new xe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:C.ZodArray,...I(t)});function we(e){if(e instanceof Q){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=ce.create(we(r))}return new Q({...e._def,shape:()=>t})}else return e instanceof xe?new xe({...e._def,type:we(e.element)}):e instanceof ce?ce.create(we(e.unwrap())):e instanceof ve?ve.create(we(e.unwrap())):e instanceof _e?_e.create(e.items.map(t=>we(t))):e}var Q=class te extends T{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:A.objectKeys(t)},this._cached}_parse(t){if(this._getType(t)!==y.object){const l=this._getOrReturnCtx(t);return _(l,{code:p.invalid_type,expected:y.object,received:l.parsedType}),S}const{status:n,ctx:r}=this._processInputParams(t),{shape:a,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof me&&this._def.unknownKeys==="strip"))for(const l in r.data)i.includes(l)||s.push(l);const o=[];for(const l of i){const c=a[l],f=r.data[l];o.push({key:{status:"valid",value:l},value:c._parse(new re(r,f,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof me){const l=this._def.unknownKeys;if(l==="passthrough")for(const c of s)o.push({key:{status:"valid",value:c},value:{status:"valid",value:r.data[c]}});else if(l==="strict")s.length>0&&(_(r,{code:p.unrecognized_keys,keys:s}),n.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 f=r.data[c];o.push({key:{status:"valid",value:c},value:l._parse(new re(r,f,r.path,c)),alwaysSet:c in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const l=[];for(const c of o){const f=await c.key,d=await c.value;l.push({key:f,value:d,alwaysSet:c.alwaysSet})}return l}).then(l=>H.mergeObjectSync(n,l)):H.mergeObjectSync(n,o)}get shape(){return this._def.shape()}strict(t){return x.errToObj,new te({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{const a=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:x.errToObj(t).message??a}:{message:a}}}:{}})}strip(){return new te({...this._def,unknownKeys:"strip"})}passthrough(){return new te({...this._def,unknownKeys:"passthrough"})}extend(t){return new te({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new te({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:C.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new te({...this._def,catchall:t})}pick(t){const n={};for(const r of A.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new te({...this._def,shape:()=>n})}omit(t){const n={};for(const r of A.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new te({...this._def,shape:()=>n})}deepPartial(){return we(this)}partial(t){const n={};for(const r of A.objectKeys(this.shape)){const a=this.shape[r];t&&!t[r]?n[r]=a:n[r]=a.optional()}return new te({...this._def,shape:()=>n})}required(t){const n={};for(const r of A.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof ce;)a=a._def.innerType;n[r]=a}return new te({...this._def,shape:()=>n})}keyof(){return yn(A.objectKeys(this.shape))}};Q.create=(e,t)=>new Q({shape:()=>e,unknownKeys:"strip",catchall:me.create(),typeName:C.ZodObject,...I(t)}),Q.strictCreate=(e,t)=>new Q({shape:()=>e,unknownKeys:"strict",catchall:me.create(),typeName:C.ZodObject,...I(t)}),Q.lazycreate=(e,t)=>new Q({shape:e,unknownKeys:"strip",catchall:me.create(),typeName:C.ZodObject,...I(t)});var Je=class extends T{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function r(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 ne(s.ctx.common.issues));return _(t,{code:p.invalid_union,unionErrors:i}),S}if(t.common.async)return Promise.all(n.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(r);{let a;const i=[];for(const o of n){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 ne(o));return _(t,{code:p.invalid_union,unionErrors:s}),S}}get options(){return this._def.options}};Je.create=(e,t)=>new Je({options:e,typeName:C.ZodUnion,...I(t)});var se=e=>e instanceof qe?se(e.schema):e instanceof oe?se(e.innerType()):e instanceof Ke?[e.value]:e instanceof et?e.options:e instanceof tt?A.objectValues(e.enum):e instanceof nt?se(e._def.innerType):e instanceof Ye?[void 0]:e instanceof Xe?[null]:e instanceof ce?[void 0,...se(e.unwrap())]:e instanceof ve?[null,...se(e.unwrap())]:e instanceof kn||e instanceof at?se(e.unwrap()):e instanceof rt?se(e._def.innerType):[],wa=class Qr extends T{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==y.object)return _(n,{code:p.invalid_type,expected:y.object,received:n.parsedType}),S;const r=this.discriminator,a=n.data[r],i=this.optionsMap.get(a);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(_(n,{code:p.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),S)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const a=new Map;for(const i of n){const s=se(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 Qr({typeName:C.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:a,...I(r)})}};function Mt(e,t){const n=he(e),r=he(t);if(e===t)return{valid:!0,data:e};if(n===y.object&&r===y.object){const a=A.objectKeys(t),i=A.objectKeys(e).filter(o=>a.indexOf(o)!==-1),s={...e,...t};for(const o of i){const l=Mt(e[o],t[o]);if(!l.valid)return{valid:!1};s[o]=l.data}return{valid:!0,data:s}}else if(n===y.array&&r===y.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=Mt(s,o);if(!l.valid)return{valid:!1};a.push(l.data)}return{valid:!0,data:a}}else return n===y.date&&r===y.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Qe=class extends T{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(a,i)=>{if(mn(a)||mn(i))return S;const s=Mt(a.value,i.value);return s.valid?((pn(a)||pn(i))&&t.dirty(),{status:t.value,value:s.data}):(_(n,{code:p.invalid_intersection_types}),S)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>r(a,i)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Qe.create=(e,t,n)=>new Qe({left:e,right:t,typeName:C.ZodIntersection,...I(n)});var _e=class qr extends T{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==y.array)return _(r,{code:p.invalid_type,expected:y.array,received:r.parsedType}),S;if(r.data.length<this._def.items.length)return _(r,{code:p.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),S;!this._def.rest&&r.data.length>this._def.items.length&&(_(r,{code:p.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const a=[...r.data].map((i,s)=>{const o=this._def.items[s]||this._def.rest;return o?o._parse(new re(r,i,r.path,s)):null}).filter(i=>!!i);return r.common.async?Promise.all(a).then(i=>H.mergeArray(n,i)):H.mergeArray(n,a)}get items(){return this._def.items}rest(t){return new qr({...this._def,rest:t})}};_e.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new _e({items:e,typeName:C.ZodTuple,rest:null,...I(t)})};var Sa=class dn extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==y.object)return _(r,{code:p.invalid_type,expected:y.object,received:r.parsedType}),S;const a=[],i=this._def.keyType,s=this._def.valueType;for(const o in r.data)a.push({key:i._parse(new re(r,o,r.path,o)),value:s._parse(new re(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?H.mergeObjectAsync(n,a):H.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof T?new dn({keyType:t,valueType:n,typeName:C.ZodRecord,...I(r)}):new dn({keyType:Ge.create(),valueType:t,typeName:C.ZodRecord,...I(n)})}},Zt=class extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.map)return _(n,{code:p.invalid_type,expected:y.map,received:n.parsedType}),S;const r=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([s,o],l)=>({key:r._parse(new re(n,s,n.path,[l,"key"])),value:a._parse(new re(n,o,n.path,[l,"value"]))}));if(n.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 S;(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 S;(l.status==="dirty"||c.status==="dirty")&&t.dirty(),s.set(l.value,c.value)}return{status:t.value,value:s}}}};Zt.create=(e,t,n)=>new Zt({valueType:t,keyType:e,typeName:C.ZodMap,...I(n)});var jt=class un extends T{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==y.set)return _(r,{code:p.invalid_type,expected:y.set,received:r.parsedType}),S;const a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(_(r,{code:p.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),n.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(_(r,{code:p.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());const i=this._def.valueType;function s(l){const c=new Set;for(const f of l){if(f.status==="aborted")return S;f.status==="dirty"&&n.dirty(),c.add(f.value)}return{status:n.value,value:c}}const o=[...r.data.values()].map((l,c)=>i._parse(new re(r,l,r.path,c)));return r.common.async?Promise.all(o).then(l=>s(l)):s(o)}min(t,n){return new un({...this._def,minSize:{value:t,message:x.toString(n)}})}max(t,n){return new un({...this._def,maxSize:{value:t,message:x.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};jt.create=(e,t)=>new jt({valueType:e,minSize:null,maxSize:null,typeName:C.ZodSet,...I(t)});var Ca=class bt extends T{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==y.function)return _(n,{code:p.invalid_type,expected:y.function,received:n.parsedType}),S;function r(o,l){return St({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,wt(),Re].filter(c=>!!c),issueData:{code:p.invalid_arguments,argumentsError:l}})}function a(o,l){return St({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,wt(),Re].filter(c=>!!c),issueData:{code:p.invalid_return_type,returnTypeError:l}})}const i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof Ze){const o=this;return U(async function(...l){const c=new ne([]),f=await o._def.args.parseAsync(l,i).catch(h=>{throw c.addIssue(r(l,h)),c}),d=await Reflect.apply(s,this,f);return await o._def.returns._def.type.parseAsync(d,i).catch(h=>{throw c.addIssue(a(d,h)),c})})}else{const o=this;return U(function(...l){const c=o._def.args.safeParse(l,i);if(!c.success)throw new ne([r(l,c.error)]);const f=Reflect.apply(s,this,c.data),d=o._def.returns.safeParse(f,i);if(!d.success)throw new ne([a(f,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new bt({...this._def,args:_e.create(t).rest(be.create())})}returns(t){return new bt({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new bt({args:t||_e.create([]).rest(be.create()),returns:n||be.create(),typeName:C.ZodFunction,...I(r)})}},qe=class extends T{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})}};qe.create=(e,t)=>new qe({getter:e,typeName:C.ZodLazy,...I(t)});var Ke=class extends T{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return _(t,{received:t.data,code:p.invalid_literal,expected:this._def.value}),S}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ke.create=(e,t)=>new Ke({value:e,typeName:C.ZodLiteral,...I(t)});function yn(e,t){return new et({values:e,typeName:C.ZodEnum,...I(t)})}var et=class fn extends T{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return _(n,{expected:A.joinValues(r),received:n.parsedType,code:p.invalid_type}),S}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return _(n,{received:n.data,code:p.invalid_enum_value,options:r}),S}return U(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return fn.create(t,{...this._def,...n})}exclude(t,n=this._def){return fn.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}};et.create=yn;var tt=class extends T{_parse(e){const t=A.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==y.string&&n.parsedType!==y.number){const r=A.objectValues(t);return _(n,{expected:A.joinValues(r),received:n.parsedType,code:p.invalid_type}),S}if(this._cache||(this._cache=new Set(A.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=A.objectValues(t);return _(n,{received:n.data,code:p.invalid_enum_value,options:r}),S}return U(e.data)}get enum(){return this._def.values}};tt.create=(e,t)=>new tt({values:e,typeName:C.ZodNativeEnum,...I(t)});var Ze=class extends T{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);return t.parsedType!==y.promise&&t.common.async===!1?(_(t,{code:p.invalid_type,expected:y.promise,received:t.parsedType}),S):U((t.parsedType===y.promise?t.data:Promise.resolve(t.data)).then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Ze.create=(e,t)=>new Ze({type:e,typeName:C.ZodPromise,...I(t)});var oe=class extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:i=>{_(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),r.type==="preprocess"){const i=r.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async s=>{if(t.value==="aborted")return S;const o=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return o.status==="aborted"?S:o.status==="dirty"||t.value==="dirty"?Me(o.value):o});{if(t.value==="aborted")return S;const s=this._def.schema._parseSync({data:i,path:n.path,parent:n});return s.status==="aborted"?S:s.status==="dirty"||t.value==="dirty"?Me(s.value):s}}if(r.type==="refinement"){const i=s=>{const o=r.refinement(s,a);if(n.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(n.common.async===!1){const s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?S:(s.status==="dirty"&&t.dirty(),i(s.value),{status:t.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?S:(s.status==="dirty"&&t.dirty(),i(s.value).then(()=>({status:t.value,value:s.value}))))}if(r.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ke(i))return S;const s=r.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:n.data,path:n.path,parent:n}).then(i=>ke(i)?Promise.resolve(r.transform(i.value,a)).then(s=>({status:t.value,value:s})):S);A.assertNever(r)}};oe.create=(e,t,n)=>new oe({schema:e,typeName:C.ZodEffects,effect:t,...I(n)}),oe.createWithPreprocess=(e,t,n)=>new oe({schema:t,effect:{type:"preprocess",transform:e},typeName:C.ZodEffects,...I(n)});var ce=class extends T{_parse(e){return this._getType(e)===y.undefined?U(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ce.create=(e,t)=>new ce({innerType:e,typeName:C.ZodOptional,...I(t)});var ve=class extends T{_parse(e){return this._getType(e)===y.null?U(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ve.create=(e,t)=>new ve({innerType:e,typeName:C.ZodNullable,...I(t)});var nt=class extends T{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===y.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};nt.create=(e,t)=>new nt({innerType:e,typeName:C.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...I(t)});var rt=class extends T{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return He(r)?r.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ne(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new ne(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};rt.create=(e,t)=>new rt({innerType:e,typeName:C.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...I(t)});var Ot=class extends T{_parse(e){if(this._getType(e)!==y.nan){const t=this._getOrReturnCtx(e);return _(t,{code:p.invalid_type,expected:y.nan,received:t.parsedType}),S}return{status:"valid",value:e.data}}};Ot.create=e=>new Ot({typeName:C.ZodNaN,...I(e)});var kn=class extends T{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},bn=class Kr extends T{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?S:i.status==="dirty"?(n.dirty(),Me(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?S:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(t,n){return new Kr({in:t,out:n,typeName:C.ZodPipeline})}},at=class extends T{_parse(e){const t=this._def.innerType._parse(e),n=r=>(ke(r)&&(r.value=Object.freeze(r.value)),r);return He(t)?t.then(r=>n(r)):n(t)}unwrap(){return this._def.innerType}};at.create=(e,t)=>new at({innerType:e,typeName:C.ZodReadonly,...I(t)});var fc={object:Q.lazycreate},C;(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"})(C||(C={}));var V=Ge.create,hc=It.create,mc=Ot.create,pc=Nt.create,Pt=Tt.create,gc=Lt.create,_c=At.create,vc=Ye.create,yc=Xe.create,kc=Et.create,Ia=be.create,bc=me.create,xc=Rt.create,wc=xe.create,Vt=Q.create,Sc=Q.strictCreate,Cc=Je.create,Ic=wa.create,Nc=Qe.create,Tc=_e.create,Na=Sa.create,Lc=Zt.create,Ac=jt.create,Ec=Ca.create,Rc=qe.create,Mc=Ke.create,xn=et.create,Zc=tt.create,jc=Ze.create,Oc=oe.create,Pc=ce.create,Vc=ve.create,$c=oe.createWithPreprocess,Fc=bn.create,Ta=Vt({mode:xn(["light","dark","system"]).optional(),accentColor:V().optional(),fontFamily:V().optional(),borderRadius:V().optional()}),La=Vt({externalId:V().optional(),authId:V().optional(),name:V().optional(),email:V().optional()}),wn=Vt({agentId:V().min(1,"agentId is required"),apiBaseUrl:V().url("apiBaseUrl must be a valid URL"),tenantId:V().optional(),user:La.optional(),sessionId:V().optional(),mode:xn(["floating","inline"]).optional(),title:V().optional(),subtitle:V().optional(),description:V().optional(),greeting:V().optional(),avatarUrl:V().optional(),privacyPolicyUrl:V().optional(),termsOfServiceUrl:V().optional(),streaming:Pt().optional(),preview:Pt().optional(),skipServerConfigFetch:Pt().optional(),metadata:Na(Ia()).optional(),theme:Ta.optional()}),Aa=wn.omit({agentId:!0,apiBaseUrl:!0}).partial(),ye={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 je(e,t){wn.parse(e);let n;const r=t?{...t}:void 0;r&&typeof r.theme=="object"&&r.theme!==null?(n=r.theme,delete r.theme):r&&typeof r.theme=="string"&&(n={mode:r.theme},delete r.theme);const a=r?Aa.passthrough().safeParse(r).data:void 0,i=a?Sn(a,e):e,s={mode:i.theme?.mode??n?.mode??ye.theme.mode,accentColor:i.theme?.accentColor??n?.accentColor??ye.theme.accentColor,fontFamily:i.theme?.fontFamily??n?.fontFamily??ye.theme.fontFamily,borderRadius:i.theme?.borderRadius??n?.borderRadius??ye.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??ye.mode,title:i.title??ye.title,subtitle:i.subtitle,description:i.description,greeting:i.greeting,avatarUrl:i.avatarUrl,privacyPolicyUrl:i.privacyPolicyUrl,termsOfServiceUrl:i.termsOfServiceUrl,streaming:i.streaming??ye.streaming,preview:i.preview===!0,skipServerConfigFetch:i.skipServerConfigFetch===!0,metadata:i.metadata??{},theme:s,thinkingEnabled:a?.thinkingEnabled===!0,thinkingViewable:a?.thinkingViewable===!0,photoSendingEnabled:a?.photoSendingEnabled===!0}}function Sn(e,t){const n={...e};for(const r of Object.keys(t)){const a=t[r];a!=null&&(typeof a=="object"&&!Array.isArray(a)&&n[r]!==null&&typeof n[r]=="object"?n[r]=Sn(n[r],a):n[r]=a)}return n}var $t=function(){return $t=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},$t.apply(this,arguments)};function ae(e,t,n,r){function a(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function o(f){try{c(r.next(f))}catch(d){s(d)}}function l(f){try{c(r.throw(f))}catch(d){s(d)}}function c(f){f.done?i(f.value):a(f.value).then(o,l)}c((r=r.apply(e,t||[])).next())})}function ie(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,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(f){return l([c,f])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(n=0)),n;)try{if(r=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 n.label++,{value:c[1],done:!1};case 5:n.label++,a=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){n.label=c[1];break}if(c[0]===6&&n.label<i[1]){n.label=i[1],i=c;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(c);break}i[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(f){c=[6,f],a=0}finally{r=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Cn(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,i;r<a;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var In="4.6.2";function it(e,t){return new Promise(function(n){return setTimeout(n,e,t)})}function Ea(){return new Promise(function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})}function Ra(e,t){t===void 0&&(t=1/0);var n=window.requestIdleCallback;return n?new Promise(function(r){return n.call(window,function(){return r()},{timeout:t})}):it(Math.min(e,t))}function Nn(e){return!!e&&typeof e.then=="function"}function Tn(e,t){try{var n=e();Nn(n)?n.then(function(r){return t(!0,r)},function(r){return t(!1,r)}):t(!0,n)}catch(r){t(!1,r)}}function Ln(e,t,n){return n===void 0&&(n=16),ae(this,void 0,void 0,function(){var r,a,i,s;return ie(this,function(o){switch(o.label){case 0:r=Array(e.length),a=Date.now(),i=0,o.label=1;case 1:return i<e.length?(r[i]=t(e[i],i),s=Date.now(),s>=a+n?(a=s,[4,Ea()]):[3,3]):[3,4];case 2:o.sent(),o.label=3;case 3:return++i,[3,1];case 4:return[2,r]}})})}function Oe(e){return e.then(void 0,function(){}),e}function Ma(e,t){for(var n=0,r=e.length;n<r;++n)if(e[n]===t)return!0;return!1}function Za(e,t){return!Ma(e,t)}function Ft(e){return parseInt(e)}function q(e){return parseFloat(e)}function le(e,t){return typeof e=="number"&&isNaN(e)?t:e}function F(e){return e.reduce(function(t,n){return t+(n?1:0)},0)}function An(e,t){if(t===void 0&&(t=1),Math.abs(t)>=1)return Math.round(e/t)*t;var n=1/t;return Math.round(e*n)/n}function ja(e){for(var t,n,r="Unexpected syntax '".concat(e,"'"),a=/^\s*([a-z-]*)(.*)$/i.exec(e),i=a[1]||void 0,s={},o=/([.:#][\w-]+|\[.+?\])/gi,l=function(h,m){s[h]=s[h]||[],s[h].push(m)};;){var c=o.exec(a[2]);if(!c)break;var f=c[0];switch(f[0]){case".":l("class",f.slice(1));break;case"#":l("id",f.slice(1));break;case"[":var d=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(f);if(d)l(d[1],(n=(t=d[4])!==null&&t!==void 0?t:d[5])!==null&&n!==void 0?n:"");else throw new Error(r);break;default:throw new Error(r)}}return[i,s]}function Oa(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r>127)return new TextEncoder().encode(e);t[n]=r}return t}function pe(e,t){var n=e[0]>>>16,r=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,f=0,d=0,h=0,m=0;m+=i+c,h+=m>>>16,m&=65535,h+=a+l,d+=h>>>16,h&=65535,d+=r+o,f+=d>>>16,d&=65535,f+=n+s,f&=65535,e[0]=f<<16|d,e[1]=h<<16|m}function J(e,t){var n=e[0]>>>16,r=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,f=0,d=0,h=0,m=0;m+=i*c,h+=m>>>16,m&=65535,h+=a*c,d+=h>>>16,h&=65535,h+=i*l,d+=h>>>16,h&=65535,d+=r*c,f+=d>>>16,d&=65535,d+=a*l,f+=d>>>16,d&=65535,d+=i*o,f+=d>>>16,d&=65535,f+=n*c+r*l+a*o+i*s,f&=65535,e[0]=f<<16|d,e[1]=h<<16|m}function Se(e,t){var n=e[0];t%=64,t===32?(e[0]=e[1],e[1]=n):t<32?(e[0]=n<<t|e[1]>>>32-t,e[1]=e[1]<<t|n>>>32-t):(t-=32,e[0]=e[1]<<t|n>>>32-t,e[1]=n<<t|e[1]>>>32-t)}function G(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 Z(e,t){e[0]^=t[0],e[1]^=t[1]}var Pa=[4283543511,3981806797],Va=[3301882366,444984403];function En(e){var t=[0,e[0]>>>1];Z(e,t),J(e,Pa),t[1]=e[0]>>>1,Z(e,t),J(e,Va),t[1]=e[0]>>>1,Z(e,t)}var st=[2277735313,289559509],ot=[1291169091,658871167],Rn=[0,5],$a=[0,1390208809],Fa=[0,944331445];function Wa(e,t){var n=Oa(e);t=t||0;var r=[0,n.length],a=r[1]%16,i=r[1]-a,s=[0,t],o=[0,t],l=[0,0],c=[0,0],f;for(f=0;f<i;f=f+16)l[0]=n[f+4]|n[f+5]<<8|n[f+6]<<16|n[f+7]<<24,l[1]=n[f]|n[f+1]<<8|n[f+2]<<16|n[f+3]<<24,c[0]=n[f+12]|n[f+13]<<8|n[f+14]<<16|n[f+15]<<24,c[1]=n[f+8]|n[f+9]<<8|n[f+10]<<16|n[f+11]<<24,J(l,st),Se(l,31),J(l,ot),Z(s,l),Se(s,27),pe(s,o),J(s,Rn),pe(s,$a),J(c,ot),Se(c,33),J(c,st),Z(o,c),Se(o,31),pe(o,s),J(o,Rn),pe(o,Fa);l[0]=0,l[1]=0,c[0]=0,c[1]=0;var d=[0,0];switch(a){case 15:d[1]=n[f+14],G(d,48),Z(c,d);case 14:d[1]=n[f+13],G(d,40),Z(c,d);case 13:d[1]=n[f+12],G(d,32),Z(c,d);case 12:d[1]=n[f+11],G(d,24),Z(c,d);case 11:d[1]=n[f+10],G(d,16),Z(c,d);case 10:d[1]=n[f+9],G(d,8),Z(c,d);case 9:d[1]=n[f+8],Z(c,d),J(c,ot),Se(c,33),J(c,st),Z(o,c);case 8:d[1]=n[f+7],G(d,56),Z(l,d);case 7:d[1]=n[f+6],G(d,48),Z(l,d);case 6:d[1]=n[f+5],G(d,40),Z(l,d);case 5:d[1]=n[f+4],G(d,32),Z(l,d);case 4:d[1]=n[f+3],G(d,24),Z(l,d);case 3:d[1]=n[f+2],G(d,16),Z(l,d);case 2:d[1]=n[f+1],G(d,8),Z(l,d);case 1:d[1]=n[f],Z(l,d),J(l,st),Se(l,31),J(l,ot),Z(s,l)}return Z(s,r),Z(o,r),pe(s,o),pe(o,s),En(s),En(o),pe(s,o),pe(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 Da(e){var t;return $t({name:e.name,message:e.message,stack:(t=e.stack)===null||t===void 0?void 0:t.split(`
2
+ `)},e)}function za(e){return/^function\s.*?\{\s*\[native code]\s*}$/.test(String(e))}function Ua(e){return typeof e!="function"}function Ba(e,t){var n=Oe(new Promise(function(r){var a=Date.now();Tn(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 r(function(){return{error:i[1],duration:o}});var l=i[1];if(Ua(l))return r(function(){return{value:l,duration:o}});r(function(){return new Promise(function(c){var f=Date.now();Tn(l,function(){for(var d=[],h=0;h<arguments.length;h++)d[h]=arguments[h];var m=o+Date.now()-f;if(!d[0])return c({error:d[1],duration:m});c({value:d[1],duration:m})})})})})}));return function(){return n.then(function(a){return a()})}}function Ha(e,t,n,r){var a=Object.keys(e).filter(function(s){return Za(n,s)}),i=Oe(Ln(a,function(s){return Ba(e[s],t)},r));return function(){return ae(this,void 0,void 0,function(){var o,l,c,f,d;return ie(this,function(h){switch(h.label){case 0:return[4,i];case 1:return o=h.sent(),[4,Ln(o,function(m){return Oe(m())},r)];case 2:return l=h.sent(),[4,Promise.all(l)];case 3:for(c=h.sent(),f={},d=0;d<a.length;++d)f[a[d]]=c[d];return[2,f]}})})}}function Mn(){var e=window,t=navigator;return F(["MSCSSMatrix"in e,"msSetImmediate"in e,"msIndexedDB"in e,"msMaxTouchPoints"in t,"msPointerEnabled"in t])>=4}function Ga(){var e=window,t=navigator;return F(["msWriteProfilerMark"in e,"MSStream"in e,"msLaunchUri"in t,"msSaveBlob"in t])>=3&&!Mn()}function Pe(){var e=window,t=navigator;return F(["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 K(){var e=window,t=navigator;return F(["ApplePayError"in e,"CSSPrimitiveValue"in e,"Counter"in e,t.vendor.indexOf("Apple")===0,"RGBColor"in e,"WebKitMediaKeys"in e])>=4}function Wt(){var e=window,t=e.HTMLElement,n=e.Document;return F(["safari"in e,!("ongestureend"in e),!("TouchEvent"in e),!("orientation"in e),t&&!("autocapitalize"in t.prototype),n&&"pointerLockElement"in n.prototype])>=4}function Ve(){var e=window;return za(e.print)&&String(e.browser)==="[object WebPageNamespace]"}function Zn(){var e,t,n=window;return F(["buildID"in navigator,"MozAppearance"in((t=(e=document.documentElement)===null||e===void 0?void 0:e.style)!==null&&t!==void 0?t:{}),"onmozfullscreenchange"in n,"mozInnerScreenX"in n,"CSSMozDocumentRule"in n,"CanvasCaptureMediaStream"in n])>=4}function Ya(){var e=window;return F([!("MediaSettingsRange"in e),"RTCEncodedAudioFrame"in e,""+e.Intl=="[object Intl]",""+e.Reflect=="[object Reflect]"])>=3}function Xa(){var e=window,t=e.URLPattern;return F(["union"in Set.prototype,"Iterator"in e,t&&"hasRegExpGroups"in t.prototype,"RGB8"in WebGLRenderingContext.prototype])>=3}function Ja(){var e=window;return F(["DOMRectList"in e,"RTCPeerConnectionIceEvent"in e,"SVGGeometryElement"in e,"ontransitioncancel"in e])>=3}function $e(){var e=window,t=navigator,n=e.CSS,r=e.HTMLButtonElement;return F([!("getStorageUpdates"in t),r&&"popover"in r.prototype,"CSSCounterStyleRule"in e,n.supports("font-size-adjust: ex-height 0.5"),n.supports("text-transform: full-width")])>=4}function Qa(){if(navigator.platform==="iPad")return!0;var e=screen,t=e.width/e.height;return F(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,t>.65&&t<1.53])>=2}function qa(){var e=document;return e.fullscreenElement||e.msFullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement||null}function Ka(){var e=document;return(e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen).call(e)}function Dt(){var e=Pe(),t=Zn(),n=window,r=navigator,a="connection";return e?F([!("SharedWorker"in n),r[a]&&"ontypechange"in r[a],!("sinkId"in new Audio)])>=2:t?F(["onorientationchange"in n,"orientation"in n,/android/i.test(r.appVersion)])>=2:!1}function ei(){var e=navigator,t=window,n=Audio.prototype,r=t.visualViewport;return F(["srLatency"in n,"srChannelCount"in n,"devicePosture"in e,r&&"segments"in r,"getTextInformation"in Image.prototype])>=3}function ti(){return ai()?-4:ni()}function ni(){var e=window,t=e.OfflineAudioContext||e.webkitOfflineAudioContext;if(!t)return-2;if(ri())return-1;var n=4500,r=new t(1,5e3,44100),a=r.createOscillator();a.type="triangle",a.frequency.value=1e4;var i=r.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(r.destination),a.start(0);var s=ii(r),o=s[0],l=s[1],c=Oe(o.then(function(f){return si(f.getChannelData(0).subarray(n))},function(f){if(f.name==="timeout"||f.name==="suspended")return-3;throw f}));return function(){return l(),c}}function ri(){return K()&&!Wt()&&!Ja()}function ai(){return K()&&$e()&&Ve()||Pe()&&ei()&&Xa()}function ii(e){var t=3,n=500,r=500,a=5e3,i=function(){};return[new Promise(function(s,o){var l=!1,c=0,f=0;e.oncomplete=function(m){return s(m.renderedBuffer)};var d=function(){setTimeout(function(){return o(jn("timeout"))},Math.min(r,f+a-Date.now()))},h=function(){try{var m=e.startRendering();switch(Nn(m)&&Oe(m),e.state){case"running":f=Date.now(),l&&d();break;case"suspended":document.hidden||c++,l&&c>=t?o(jn("suspended")):setTimeout(h,n);break}}catch(g){o(g)}};h(),i=function(){l||(l=!0,f>0&&d())}}),i]}function si(e){for(var t=0,n=0;n<e.length;++n)t+=Math.abs(e[n]);return t}function jn(e){var t=new Error(e);return t.name=e,t}function On(e,t,n){var r,a,i;return n===void 0&&(n=50),ae(this,void 0,void 0,function(){var s,o;return ie(this,function(l){switch(l.label){case 0:s=document,l.label=1;case 1:return s.body?[3,3]:[4,it(n)];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,f){var d=!1,h=function(){d=!0,c()},m=function(b){d=!0,f(b)};o.onload=h,o.onerror=m;var g=o.style;g.setProperty("display","block","important"),g.position="absolute",g.top="0",g.left="0",g.visibility="hidden",t&&"srcdoc"in o?o.srcdoc=t:o.src="about:blank",s.body.appendChild(o);var w=function(){var b,v;d||(((v=(b=o.contentWindow)===null||b===void 0?void 0:b.document)===null||v===void 0?void 0:v.readyState)==="complete"?h():setTimeout(w,10))};w()})];case 5:l.sent(),l.label=6;case 6:return!((a=(r=o.contentWindow)===null||r===void 0?void 0:r.document)===null||a===void 0)&&a.body?[3,8]:[4,it(n)];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 oi(e){for(var t=ja(e),n=t[0],r=t[1],a=document.createElement(n??"div"),i=0,s=Object.keys(r);i<s.length;i++){var o=s[i],l=r[o].join(" ");o==="style"?ci(a.style,l):a.setAttribute(o,l)}return a}function ci(e,t){for(var n=0,r=t.split(";");n<r.length;n++){var a=r[n],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 li(){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(n){if(n instanceof Error&&n.name==="SecurityError")return!0;throw n}e=t}}var di="mmMwWLliI0O&1",ui="48px",Ce=["monospace","sans-serif","serif"],Pn=["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 fi(){var e=this;return On(function(t,n){var r=n.document;return ae(e,void 0,void 0,function(){var a,i,s,o,l,c,f,d,h,m,g,w;return ie(this,function(b){for(a=r.body,a.style.fontSize=ui,i=r.createElement("div"),i.style.setProperty("visibility","hidden","important"),s={},o={},l=function(v){var k=r.createElement("span"),R=k.style;return R.position="absolute",R.top="0",R.left="0",R.fontFamily=v,k.textContent=di,i.appendChild(k),k},c=function(v,k){return l("'".concat(v,"',").concat(k))},f=function(){return Ce.map(l)},d=function(){for(var v={},k=function(Y){v[Y]=Ce.map(function(X){return c(Y,X)})},R=0,P=Pn;R<P.length;R++){var D=P[R];k(D)}return v},h=function(v){return Ce.some(function(k,R){return v[R].offsetWidth!==s[k]||v[R].offsetHeight!==o[k]})},m=f(),g=d(),a.appendChild(i),w=0;w<Ce.length;w++)s[Ce[w]]=m[w].offsetWidth,o[Ce[w]]=m[w].offsetHeight;return[2,Pn.filter(function(v){return h(g[v])})]})})})}function hi(){var e=navigator.plugins;if(e){for(var t=[],n=0;n<e.length;++n){var r=e[n];if(r){for(var a=[],i=0;i<r.length;++i){var s=r[i];a.push({type:s.type,suffixes:s.suffixes})}t.push({name:r.name,description:r.description,mimeTypes:a})}}return t}}function mi(){return pi(xi())}function pi(e){var t,n=!1,r,a,i=gi(),s=i[0],o=i[1];return _i(s,o)?(n=vi(o),e?r=a="skipped":(t=yi(s,o),r=t[0],a=t[1])):r=a="unsupported",{winding:n,geometry:r,text:a}}function gi(){var e=document.createElement("canvas");return e.width=1,e.height=1,[e,e.getContext("2d")]}function _i(e,t){return!!(t&&e.toDataURL)}function vi(e){return e.rect(0,0,10,10),e.rect(2,2,6,6),!e.isPointInPath(5,5,"evenodd")}function yi(e,t){ki(e,t);var n=zt(e);return n!==zt(e)?["unstable","unstable"]:(bi(e,t),[zt(e),n])}function ki(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 n="Cwm fjordbank gly ".concat("😃");t.fillText(n,2,15),t.fillStyle="rgba(102, 204, 0, 0.2)",t.font="18pt Arial",t.fillText(n,4,45)}function bi(e,t){e.width=122,e.height=110,t.globalCompositeOperation="multiply";for(var n=0,r=[["#f2f",40,40],["#2ff",80,40],["#ff2",60,80]];n<r.length;n++){var a=r[n],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 zt(e){return e.toDataURL()}function xi(){return K()&&$e()&&Ve()}function wi(){var e=navigator,t=0,n;e.maxTouchPoints!==void 0?t=Ft(e.maxTouchPoints):e.msMaxTouchPoints!==void 0&&(t=e.msMaxTouchPoints);try{document.createEvent("TouchEvent"),n=!0}catch{n=!1}var r="ontouchstart"in window;return{maxTouchPoints:t,touchEvent:n,touchStart:r}}function Si(){return navigator.oscpu}function Ci(){var e=navigator,t=[],n=e.language||e.userLanguage||e.browserLanguage||e.systemLanguage;if(n!==void 0&&t.push([n]),Array.isArray(e.languages))Pe()&&Ya()||t.push(e.languages);else if(typeof e.languages=="string"){var r=e.languages;r&&t.push(r.split(","))}return t}function Ii(){return window.screen.colorDepth}function Ni(){return le(q(navigator.deviceMemory),void 0)}function Ti(){if(!(K()&&$e()&&Ve()))return Li()}function Li(){var e=screen,t=function(r){return le(Ft(r),null)},n=[t(e.width),t(e.height)];return n.sort().reverse(),n}var Ai=2500,Ei=10,ct,Ut;function Ri(){if(Ut===void 0){var e=function(){var t=Bt();Ht(t)?Ut=setTimeout(e,Ai):(ct=t,Ut=void 0)};e()}}function Mi(){var e=this;return Ri(),function(){return ae(e,void 0,void 0,function(){var t;return ie(this,function(n){switch(n.label){case 0:return t=Bt(),Ht(t)?ct?[2,Cn([],ct,!0)]:qa()?[4,Ka()]:[3,2]:[3,2];case 1:n.sent(),t=Bt(),n.label=2;case 2:return Ht(t)||(ct=t),[2,t]}})})}}function Zi(){var e=this;if(K()&&$e()&&Ve())return function(){return Promise.resolve(void 0)};var t=Mi();return function(){return ae(e,void 0,void 0,function(){var n,r;return ie(this,function(a){switch(a.label){case 0:return[4,t()];case 1:return n=a.sent(),r=function(i){return i===null?null:An(i,Ei)},[2,[r(n[0]),r(n[1]),r(n[2]),r(n[3])]]}})})}}function Bt(){var e=screen;return[le(q(e.availTop),null),le(q(e.width)-q(e.availWidth)-le(q(e.availLeft),0),null),le(q(e.height)-q(e.availHeight)-le(q(e.availTop),0),null),le(q(e.availLeft),null)]}function Ht(e){for(var t=0;t<4;++t)if(e[t])return!1;return!0}function ji(){return le(Ft(navigator.hardwareConcurrency),void 0)}function Oi(){var e,t=(e=window.Intl)===null||e===void 0?void 0:e.DateTimeFormat;if(t){var n=new t().resolvedOptions().timeZone;if(n)return n}var r=-Pi();return"UTC".concat(r>=0?"+":"").concat(r)}function Pi(){var e=new Date().getFullYear();return Math.max(q(new Date(e,0,1).getTimezoneOffset()),q(new Date(e,6,1).getTimezoneOffset()))}function Vi(){try{return!!window.sessionStorage}catch{return!0}}function $i(){try{return!!window.localStorage}catch{return!0}}function Fi(){if(!(Mn()||Ga()))try{return!!window.indexedDB}catch{return!0}}function Wi(){return!!window.openDatabase}function Di(){return navigator.cpuClass}function zi(){var e=navigator.platform;return e==="MacIntel"&&K()&&!Wt()?Qa()?"iPad":"iPhone":e}function Ui(){return navigator.vendor||""}function Bi(){for(var e=[],t=0,n=["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"];t<n.length;t++){var r=n[t],a=window[r];a&&typeof a=="object"&&e.push(r)}return e.sort()}function Hi(){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 Gi(){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 Yi(e){var t=(e===void 0?{}:e).debug;return ae(this,void 0,void 0,function(){var n,r,a,i,s,o;return ie(this,function(l){switch(l.label){case 0:return Xi()?(n=Gi(),r=Object.keys(n),a=(o=[]).concat.apply(o,r.map(function(c){return n[c]})),[4,Ji(a)]):[2,void 0];case 1:return i=l.sent(),t&&Qi(n,i),s=r.filter(function(c){var f=n[c];return F(f.map(function(d){return i[d]}))>f.length*.6}),s.sort(),[2,s]}})})}function Xi(){return K()||Dt()}function Ji(e){var t;return ae(this,void 0,void 0,function(){var n,r,a,i,l,s,o,l;return ie(this,function(c){switch(c.label){case 0:for(n=document,r=n.createElement("div"),a=new Array(e.length),i={},Vn(r),l=0;l<e.length;++l)s=oi(e[l]),s.tagName==="DIALOG"&&s.show(),o=n.createElement("div"),Vn(o),o.appendChild(s),r.appendChild(o),a[l]=s;c.label=1;case 1:return n.body?[3,3]:[4,it(50)];case 2:return c.sent(),[3,1];case 3:n.body.appendChild(r);try{for(l=0;l<e.length;++l)a[l].offsetParent||(i[e[l]]=!0)}finally{(t=r.parentNode)===null||t===void 0||t.removeChild(r)}return[2,i]}})})}function Vn(e){e.style.setProperty("visibility","hidden","important"),e.style.setProperty("display","block","important")}function Qi(e,t){for(var n="DOM blockers debug:\n```",r=0,a=Object.keys(e);r<a.length;r++){var i=a[r];n+=`
3
+ `.concat(i,":");for(var s=0,o=e[i];s<o.length;s++){var l=o[s];n+=`
4
+ `.concat(t[l]?"🚫":"➡️"," ").concat(l)}}}function qi(){for(var e=0,t=["rec2020","p3","srgb"];e<t.length;e++){var n=t[e];if(matchMedia("(color-gamut: ".concat(n,")")).matches)return n}}function Ki(){if($n("inverted"))return!0;if($n("none"))return!1}function $n(e){return matchMedia("(inverted-colors: ".concat(e,")")).matches}function es(){if(Fn("active"))return!0;if(Fn("none"))return!1}function Fn(e){return matchMedia("(forced-colors: ".concat(e,")")).matches}var ts=100;function ns(){if(matchMedia("(min-monochrome: 0)").matches){for(var e=0;e<=ts;++e)if(matchMedia("(max-monochrome: ".concat(e,")")).matches)return e;throw new Error("Too high value")}}function rs(){if(Ie("no-preference"))return 0;if(Ie("high")||Ie("more"))return 1;if(Ie("low")||Ie("less"))return-1;if(Ie("forced"))return 10}function Ie(e){return matchMedia("(prefers-contrast: ".concat(e,")")).matches}function as(){if(Wn("reduce"))return!0;if(Wn("no-preference"))return!1}function Wn(e){return matchMedia("(prefers-reduced-motion: ".concat(e,")")).matches}function is(){if(Dn("reduce"))return!0;if(Dn("no-preference"))return!1}function Dn(e){return matchMedia("(prefers-reduced-transparency: ".concat(e,")")).matches}function ss(){if(zn("high"))return!0;if(zn("standard"))return!1}function zn(e){return matchMedia("(dynamic-range: ".concat(e,")")).matches}var E=Math,W=function(){return 0};function os(){var e=E.acos||W,t=E.acosh||W,n=E.asin||W,r=E.asinh||W,a=E.atanh||W,i=E.atan||W,s=E.sin||W,o=E.sinh||W,l=E.cos||W,c=E.cosh||W,f=E.tan||W,d=E.tanh||W,h=E.exp||W,m=E.expm1||W,g=E.log1p||W,w=function(L){return E.pow(E.PI,L)},b=function(L){return E.log(L+E.sqrt(L*L-1))},v=function(L){return E.log(L+E.sqrt(L*L+1))},k=function(L){return E.log((1+L)/(1-L))/2},R=function(L){return E.exp(L)-1/E.exp(L)/2},P=function(L){return(E.exp(L)+1/E.exp(L))/2},D=function(L){return E.exp(L)-1},Y=function(L){return(E.exp(2*L)-1)/(E.exp(2*L)+1)},X=function(L){return E.log(1+L)};return{acos:e(.12312423423423424),acosh:t(1e308),acoshPf:b(1e154),asin:n(.12312423423423424),asinh:r(1),asinhPf:v(1),atanh:a(.5),atanhPf:k(.5),atan:i(.5),sin:s(-1e300),sinh:o(1),sinhPf:R(1),cos:l(10.000000000123),cosh:c(1),coshPf:P(1),tan:f(-1e300),tanh:d(1),tanhPf:Y(1),exp:h(1),expm1:m(1),expm1Pf:D(1),log1p:g(10),log1pPf:X(10),powPI:w(-100)}}var cs="mmMwWLliI0fiflO&1",Gt={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};function ls(){return ds(function(e,t){for(var n={},r={},a=0,i=Object.keys(Gt);a<i.length;a++){var s=i[a],o=Gt[s],l=o[0],c=l===void 0?{}:l,f=o[1],d=f===void 0?cs:f,h=e.createElement("span");h.textContent=d,h.style.whiteSpace="nowrap";for(var m=0,g=Object.keys(c);m<g.length;m++){var w=g[m],b=c[w];b!==void 0&&(h.style[w]=b)}n[s]=h,t.append(e.createElement("br"),h)}for(var v=0,k=Object.keys(Gt);v<k.length;v++){var s=k[v];r[s]=n[s].getBoundingClientRect().width}return r})}function ds(e,t){return t===void 0&&(t=4e3),On(function(n,r){var a=r.document,i=a.body,s=i.style;s.width="".concat(t,"px"),s.webkitTextSizeAdjust=s.textSizeAdjust="none",Pe()?i.style.zoom="".concat(1/r.devicePixelRatio):K()&&(i.style.zoom="reset");var o=a.createElement("div");return o.textContent=Cn([],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 us(){return navigator.pdfViewerEnabled}function fs(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],t[3]}function hs(){var e=window.ApplePaySession;if(typeof e?.canMakePayments!="function")return-1;if(ms())return-3;try{return e.canMakePayments()?1:0}catch(t){return ps(t)}}var ms=li;function ps(e){if(e instanceof Error&&e.name==="InvalidAccessError"&&/\bfrom\b.*\binsecure\b/i.test(e.message))return-2;throw e}function gs(){var e,t=document.createElement("a"),n=(e=t.attributionSourceId)!==null&&e!==void 0?e:t.attributionsourceid;return n===void 0?void 0:String(n)}var Un=-1,Bn=-2,_s=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]),vs=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),ys=["FRAGMENT_SHADER","VERTEX_SHADER"],ks=["LOW_FLOAT","MEDIUM_FLOAT","HIGH_FLOAT","LOW_INT","MEDIUM_INT","HIGH_INT"],Hn="WEBGL_debug_renderer_info",bs="WEBGL_polygon_mode";function xs(e){var t,n,r,a,i,s,o=e.cache,l=Gn(o);if(!l)return Un;if(!Jn(l))return Bn;var c=Xn()?null:l.getExtension(Hn);return{version:((t=l.getParameter(l.VERSION))===null||t===void 0?void 0:t.toString())||"",vendor:((n=l.getParameter(l.VENDOR))===null||n===void 0?void 0:n.toString())||"",vendorUnmasked:c?(r=l.getParameter(c.UNMASKED_VENDOR_WEBGL))===null||r===void 0?void 0:r.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 ws(e){var t=e.cache,n=Gn(t);if(!n)return Un;if(!Jn(n))return Bn;var r=n.getSupportedExtensions(),a=n.getContextAttributes(),i=[],s=[],o=[],l=[],c=[];if(a)for(var f=0,d=Object.keys(a);f<d.length;f++){var h=d[f];s.push("".concat(h,"=").concat(a[h]))}for(var m=Yn(n),g=0,w=m;g<w.length;g++){var b=w[g],v=n[b];o.push("".concat(b,"=").concat(v).concat(_s.has(v)?"=".concat(n.getParameter(v)):""))}if(r)for(var k=0,R=r;k<R.length;k++){var P=R[k];if(!(P===Hn&&Xn()||P===bs&&Is())){var D=n.getExtension(P);if(!D){i.push(P);continue}for(var Y=0,X=Yn(D);Y<X.length;Y++){var b=X[Y],v=D[b];l.push("".concat(b,"=").concat(v).concat(vs.has(v)?"=".concat(n.getParameter(v)):""))}}}for(var L=0,z=ys;L<z.length;L++)for(var M=z[L],$=0,vt=ks;$<vt.length;$++){var yt=vt[$],uc=Ss(n,M,yt);c.push("".concat(M,".").concat(yt,"=").concat(uc.join(",")))}return l.sort(),o.sort(),{contextAttributes:s,parameters:o,shaderPrecisions:c,extensions:r,extensionParameters:l,unsupportedExtensions:i}}function Gn(e){if(e.webgl)return e.webgl.context;var t=document.createElement("canvas"),n;t.addEventListener("webglCreateContextError",function(){n=void 0});for(var r=0,a=["webgl","experimental-webgl"];r<a.length;r++){var i=a[r];try{n=t.getContext(i)}catch{}if(n)break}return e.webgl={context:n},n}function Ss(e,t,n){var r=e.getShaderPrecisionFormat(e[t],e[n]);return r?[r.rangeMin,r.rangeMax,r.precision]:[]}function Yn(e){return Object.keys(e.__proto__).filter(Cs)}function Cs(e){return typeof e=="string"&&!e.match(/[^A-Z0-9_x]/)}function Xn(){return Zn()}function Is(){return Pe()||K()}function Jn(e){return typeof e.getParameter=="function"}function Ns(){if(!(Dt()||K()))return-2;if(!window.AudioContext)return-1;var e=new AudioContext().baseLatency;return e==null?-1:isFinite(e)?e:-3}function Ts(){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 Ls={fonts:fi,domBlockers:Yi,fontPreferences:ls,audio:ti,screenFrame:Zi,canvas:mi,osCpu:Si,languages:Ci,colorDepth:Ii,deviceMemory:Ni,screenResolution:Ti,hardwareConcurrency:ji,timezone:Oi,sessionStorage:Vi,localStorage:$i,indexedDB:Fi,openDatabase:Wi,cpuClass:Di,platform:zi,plugins:hi,touchSupport:wi,vendor:Ui,vendorFlavors:Bi,cookiesEnabled:Hi,colorGamut:qi,invertedColors:Ki,forcedColors:es,monochrome:ns,contrast:rs,reducedMotion:as,reducedTransparency:is,hdr:ss,math:os,pdfViewerEnabled:us,architecture:fs,applePay:hs,privateClickMeasurement:gs,audioBaseLatency:Ns,dateTimeLocale:Ts,webGlBasics:xs,webGlExtensions:ws};function As(e){return Ha(Ls,e,[])}var Es="$ if upgrade to Pro: https://fpjs.dev/pro";function Rs(e){var t=Ms(e),n=Zs(t);return{score:t,comment:Es.replace(/\$/g,"".concat(n))}}function Ms(e){if(Dt())return .4;if(K())return Wt()&&!($e()&&Ve())?.5:.3;var t="value"in e.platform?e.platform.value:"";return/^Win/.test(t)?.6:/^Mac/.test(t)?.5:.7}function Zs(e){return An(.99+.01*e,1e-4)}function js(e){for(var t="",n=0,r=Object.keys(e).sort();n<r.length;n++){var a=r[n],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 Os(e){return JSON.stringify(e,function(t,n){return n instanceof Error?Da(n):n},2)}function Qn(e){return Wa(js(e))}function Ps(e){var t;return{get visitorId(){return t===void 0&&(t=Qn(this.components)),t},set visitorId(n){t=n},confidence:Rs(e),components:e,version:In}}function Vs(e){return e===void 0&&(e=50),Ra(e,e*2)}function $s(e,t){var n=Date.now();return{get:function(r){return ae(this,void 0,void 0,function(){var a,i,s;return ie(this,function(o){switch(o.label){case 0:return a=Date.now(),[4,e()];case 1:return i=o.sent(),s=Ps(i),t||r?.debug,[2,s]}})})}}}function Fs(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var e=new XMLHttpRequest;e.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(In,"/npm-monitoring"),!0),e.send()}catch{}}function Ws(e){var t;return e===void 0&&(e={}),ae(this,void 0,void 0,function(){var n,r,a;return ie(this,function(i){switch(i.label){case 0:return(!((t=e.monitoring)!==null&&t!==void 0)||t)&&Fs(),n=e.delayFallback,r=e.debug,[4,Vs(n)];case 1:return i.sent(),a=As({cache:{},debug:r}),[2,$s(a,r)]}})})}var Ds={load:Ws,hashComponents:Qn,componentsToDebugString:Os},zs=class{constructor(e,t={}){this.baseUrl=e,this.options=t}get credentials(){return this.options.preview?"include":"same-origin"}async validateWidget(e,t){if(!t)return{valid:!1,error:"Widget is not configured: tenantId is required"};try{const n=new URLSearchParams({agentId:e,tenantId:t}),r=await fetch(`${this.baseUrl}/v1/widget/validate?${n}`,{credentials:this.credentials}),a=await r.json();if(r.ok&&a.success)return{valid:!0,agentId:a.data.agentId,tenantId:a.data.tenantId};const i=a?.code==="AGENT_DISABLED"?"AGENT_DISABLED":r.status===404?"AGENT_NOT_FOUND":void 0;return{valid:!1,error:a.error??`Widget configuration is invalid (${r.status})`,...i?{code:i}:{}}}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",credentials:this.credentials,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 n=await t.json();if(!n.success)throw new Error(n.error??"Unknown API error");return{content:n.data?.text??"",sessionId:n.data?.sessionId,images:n.data?.images,queued:!!n.data?.queued,controlMode:n.data?.controlMode}}async fetchSessionMessages(e,t){try{const n=t?`?tenantId=${encodeURIComponent(t)}`:"",r=await fetch(`${this.baseUrl}/v1/sessions/${encodeURIComponent(e)}/messages${n}`,{credentials:this.credentials});if(r.status===410||!r.ok)return null;const a=await r.json();return a.success?a.data?.messages??null:null}catch{return null}}async uploadImage(e,t,n,r,a){const i=await fetch(`${this.baseUrl}/v1/upload`,{method:"POST",credentials:this.credentials,headers:{"Content-Type":"application/json"},body:JSON.stringify({file:e,mimeType:t,fileName:n,agentId:r,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 n=t?`?tenantId=${encodeURIComponent(t)}`:"",r=await fetch(`${this.baseUrl}/v1/agents/${encodeURIComponent(e)}/widget-config${n}`,{credentials:this.credentials});if(!r.ok)return null;const a=await r.json();return a.success?a.data:null}catch{return null}}async endSession(e,t,n,r,a){const i=await fetch(`${this.baseUrl}/v1/sessions/${encodeURIComponent(e)}/end`,{method:"POST",credentials:this.credentials,headers:{"Content-Type":"application/json"},body:JSON.stringify({tenantId:t,agentId:n,fingerprint:r,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")}},Us=12e4;function Bs(e){return Promise.race([e.read(),new Promise((t,n)=>setTimeout(()=>n(new Error("Stream timed out — no data received for 120s")),Us))])}async function Hs(e,t,n,r={}){let a="",i="";try{const s=await fetch(`${e}/v1/agents/${encodeURIComponent(t.agentId)}/responses:stream`,{method:"POST",credentials:r.preview?"include":"same-origin",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(!s.ok||!s.body){let h=`${s.status} ${s.statusText}`;try{const m=await s.json();m.error&&(h=m.error)}catch{}throw new Error(h)}const o=s.headers.get("x-session-id");o&&n.onSession&&n.onSession(o);const l=s.body.getReader(),c=new TextDecoder;let f="";const d=h=>{if(!h.startsWith("data: "))return!1;const m=h.slice(6).trim();if(!m)return!1;if(m==="[DONE]")return n.onEnd(a),!0;try{const g=JSON.parse(m);if(g.type==="session"){const b=g.sessionId;return b&&n.onSession&&n.onSession(b),!1}if(g.type==="done"||g.type==="stop")return n.onEnd(a),!0;if(g.type==="error")throw new Error(g.message??"Stream error");if(g.type==="images"){const b=g.images;return b&&n.onImages&&n.onImages(b),!1}if(g.type==="control_mode"){const b=g.mode,v=!!g.queued;return b&&n.onControlMode&&n.onControlMode(b,v),v?(n.onEnd(a),!0):!1}if(g.type==="thinking_chunk"){const b=g.content;return b&&n.onThinkingDelta&&(i+=b,n.onThinkingDelta(b,i)),!1}const w=Gs(g);w&&(a+=w,n.onDelta(w,a))}catch(g){if(!(g instanceof SyntaxError))throw g}return!1};e:for(;;){const{done:h,value:m}=await Bs(l);if(h)break;f+=c.decode(m,{stream:!0});const g=f.lastIndexOf(`
5
+ `);if(g===-1)continue;const w=f.slice(0,g);f=f.slice(g+1);for(const b of w.split(`
6
+ `))if(d(b))break e}n.onEnd(a)}catch(s){n.onError(s instanceof Error?s:new Error(String(s)))}}function Gs(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 n=e.delta;if(n){const a=n.content??n.text??"";if(a)return a}const r=e.response;return r||(e.text??e.content??"")}var Ys=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,n]=e;this.listeners.get(t)?.forEach(r=>r(n))}removeAllListeners(){this.listeners.clear()}},Xs="agentforge";function Yt(e){return`${Xs}:session:${e}`}function Js(e){try{return sessionStorage.getItem(Yt(e))??void 0}catch{return}}function lt(e,t){try{sessionStorage.setItem(Yt(e),t)}catch{}}function qn(e){try{sessionStorage.removeItem(Yt(e))}catch{}}function Ne(){return`msg-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`}var Qs=class{config;apiClient;state;fingerprint;eventSource=null;emitter;constructor(e,t,n){this.hostConfig=t,this.onStateChange=n,this.config=e,this.apiClient=new zs(e.apiBaseUrl,{preview:e.preview}),this.emitter=new Ys,this.initializeFingerprint();const r=e.sessionId??Js(e.agentId);e.sessionId&&lt(e.agentId,e.sessionId);const a=e.mode==="inline";this.state={isOpen:a,messages:[],isLoading:!1,error:null,sessionId:r,initStatus:"validating",initError:null},a&&queueMicrotask(()=>this.openWithGreeting())}async initializeFingerprint(){try{this.fingerprint=(await(await Ds.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.state.initStatus==="disabled"||this.setState({isOpen:!0})}async hydrate(){const e=await this.apiClient.validateWidget(this.config.agentId,this.config.tenantId);if(!e.valid){if(e.code==="AGENT_DISABLED"){this.setState({initStatus:"disabled",initError:null});return}this.setState({initStatus:"error",initError:e.error});return}if(!this.config.skipServerConfigFetch){const r=await this.apiClient.fetchWidgetConfig(this.config.agentId,this.config.tenantId);r&&(this.config=je(this.hostConfig,r),this.onStateChange(this.getState(),this.config))}if(this.setState({initStatus:"ready"}),!this.state.sessionId)return;this.openEventStream();const t=await this.apiClient.fetchSessionMessages(this.state.sessionId,this.config.tenantId);if(t===null){this.handleSessionExpired();return}if(t.length===0)return;const n=t.map(r=>{const a=r.direction==="human";return{id:Ne(),role:r.role,content:r.content,images:r.images&&r.images.length>0?r.images:void 0,uploadedImageUrl:r.imageUrl||void 0,createdAt:r.createdAt??new Date().toISOString(),status:"sent",...a?{isHuman:!0,senderDisplay:r.senderDisplay??null}:{}}});this.setState({messages:[...this.state.messages,...n]})}openEventStream(){if(typeof EventSource>"u"||!this.state.sessionId||this.eventSource)return;const e=`${this.config.apiBaseUrl.replace(/\/$/,"")}/v1/sessions/${encodeURIComponent(this.state.sessionId)}/events`,t=new EventSource(e);t.onmessage=n=>{try{const r=JSON.parse(n.data);if(r.type==="control_mode"){const a=r.mode;this.setState({controlMode:a}),this.emitter.emit("control_mode_changed",{mode:a});return}if(r.type==="execution_state"){const a=r.state;a==="ai_thinking"||a==="ai_streaming"||a==="tool_running"?this.setState({isLoading:!0}):a==="idle"&&this.setState({isLoading:!1});return}if(r.type==="message"&&r.message&&typeof r.message=="object"){const a=r.message;if(typeof a.content!="string"||a.id&&this.state.messages.some(i=>i.id===a.id))return;if(a.direction==="human"){const i={id:a.id??Ne(),role:"assistant",content:a.content,createdAt:a.createdAt??new Date().toISOString(),status:"sent",isHuman:!0,senderDisplay:a.senderDisplay??null};this.setState({messages:[...this.state.messages,i],isLoading:!1}),this.emitter.emit("message:received",i);return}if(a.direction==="ai"){const i={id:a.id??Ne(),role:"assistant",content:a.content,createdAt:a.createdAt??new Date().toISOString(),status:"sent"};this.setState({messages:[...this.state.messages,i],isLoading:!1}),this.emitter.emit("message:received",i);return}}}catch{}},t.onerror=()=>{},this.eventSource=t}closeEventStream(){this.eventSource&&(this.eventSource.close(),this.eventSource=null)}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(n=>n.id===e?{...n,...t}:n)},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{}qn(this.config.agentId),this.closeEventStream(),this.setState({sessionId:void 0,messages:[],isLoading:!1,error:null,controlMode:void 0}),this.emitter.emit("reset",void 0),this.state.isOpen&&this.openWithGreeting()}handleSessionExpired(){qn(this.config.agentId),this.closeEventStream(),this.setState({sessionId:void 0,controlMode:void 0})}async sendMessage(e,t){if(this.state.isLoading||!e.trim()&&!t||this.state.initStatus!=="ready")return;let n;if(t)try{const i=await qs(t);n=(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 r={id:Ne(),role:"user",content:e.trim(),uploadedImageUrl:n,createdAt:new Date().toISOString(),status:"sent"},a=!this.state.messages.some(i=>i.role==="user");this.setState({messages:[...this.state.messages,r],isLoading:!0,error:null}),this.emitter.emit("message:sent",r),a&&this.emitter.emit("conversation:started",{sessionId:this.state.sessionId}),this.config.streaming?await this.sendStreaming(e.trim(),n):await this.sendNonStreaming(e.trim(),n)}async sendNonStreaming(e,t,n=!1){try{const r=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});if(r.queued&&r.controlMode==="human"){this.setState({isLoading:!1,controlMode:"human_takeover",...r.sessionId?{sessionId:r.sessionId}:{}}),r.sessionId&&(lt(this.config.agentId,r.sessionId),this.openEventStream());return}const a={id:Ne(),role:"assistant",content:r.content,images:r.images,createdAt:new Date().toISOString(),status:"sent"};this.setState({messages:[...this.state.messages,a],isLoading:!1,...r.sessionId?{sessionId:r.sessionId}:{}}),r.sessionId&&(lt(this.config.agentId,r.sessionId),this.openEventStream()),this.emitter.emit("message:received",a)}catch(r){const a=r instanceof Error?r.message:"Failed to send message";if(!n&&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,n=!1){const r=Ne(),a={id:r,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,s=!1;await Hs(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:o=>{this.setState({sessionId:o}),lt(this.config.agentId,o),this.openEventStream()},onImages:o=>{this.updateMessage(r,{images:o})},onThinkingDelta:(o,l)=>{this.updateMessage(r,{thinking:l,isThinking:!0}),this.emitter.emit("thinking:delta",{delta:o,accumulated:l})},onDelta:(o,l)=>{this.updateMessage(r,{content:l,isThinking:!1}),this.emitter.emit("stream:delta",{delta:o,accumulated:l})},onEnd:o=>{if(s){this.setState({messages:this.state.messages.filter(c=>c.id!==r),isLoading:!1,controlMode:"human_takeover"}),this.emitter.emit("stream:end",{content:""});return}this.updateMessage(r,{content:o,status:"sent",isThinking:!1}),this.setState({isLoading:!1}),this.emitter.emit("stream:end",{content:o});const l=this.state.messages.find(c=>c.id===r);l&&(l.thinking&&this.emitter.emit("thinking:end",{content:l.thinking}),this.emitter.emit("message:received",l))},onControlMode:(o,l)=>{l&&o==="human"&&(s=!0)},onError:o=>{if(!n&&o.message.includes("410")){i=!0,this.setState({messages:this.state.messages.filter(f=>f.id!==r),isLoading:!1});return}const l=this.state.messages.find(f=>f.id===r)?.content??"",c=o.message||"Something went wrong. Please try again.";this.updateMessage(r,{content:l||c,status:"error"}),this.setState({isLoading:!1,error:c}),this.emitter.emit("message:error",{error:o.message,message:null})}},{preview:this.config.preview}),i&&(this.handleSessionExpired(),await this.sendStreaming(e,t,!0))}};function qs(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{const a=r.result;t(a.split(",")[1]??"")},r.onerror=()=>n(new Error("Failed to read file")),r.readAsDataURL(e)})}function Ks(e){const t=document.createElement("div");t.setAttribute("data-agentkit-widget",""),e.appendChild(t);const n=t.attachShadow({mode:"open"}),r=document.createElement("style");n.appendChild(r);const a=document.createElement("div");return a.style.cssText="display: contents;",n.appendChild(a),{host:t,shadowRoot:n,styleSlot:r,mountPoint:a}}function eo(e,t){e.textContent=t}function to(e){e.remove()}function no(){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 ro(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 ao(e){return e.setAttribute("data-agentkit-root","inline"),getComputedStyle(e).position==="static"&&(e.style.position="relative"),e}function io(e){e.remove()}function so(e){e.removeAttribute("data-agentkit-root")}function Kn(e,t,n,r,a){const i=e.mode==="inline";let s=!1;const o=i&&a?ao(a):!i&&a?ro(a):no(),l=Ks(o);eo(l.styleSlot,r);const c=new Qs(e,t,(h,m)=>{s||f.update(h,m)}),f=n(l.mountPoint,e,c.getState(),{onOpen:()=>d.open(),onClose:()=>d.close(),onSendMessage:(h,m)=>{c.sendMessage(h,m)},onReset:()=>{c.resetConversation()}});c.hydrate(),setTimeout(()=>{s||c.emitter.emit("ready",c.getState())},0);const d={open(){s||(c.setOpen(!0),c.emitter.emit("open"))},close(){s||(c.setOpen(!1),c.emitter.emit("close"))},toggle(){c.getState().isOpen?d.close():d.open()},async sendMessage(h,m){await c.sendMessage(h,m)},reset(){s||(c.resetConversation(),c.emitter.emit("reset"))},destroy(){s||(s=!0,f.destroy(),to(l.host),i&&a?so(a):io(o),c.emitter.emit("destroy"),c.emitter.removeAllListeners())},on(h,m){c.emitter.on(h,m)},off(h,m){c.emitter.off(h,m)},getState(){return c.getState()}};return d}var Fe=new Map,oo=0;function er(e){const t=`agentkit-widget-${++oo}`,n=e.destroy.bind(e);return e.destroy=()=>{Fe.delete(t),n()},Fe.set(t,e),t}function co(e,t,n){const r={...e,mode:"floating"},a=Kn(je(r),r,t,n);return er(a),a}function lo(e,t,n,r){const a={...t,mode:"inline"},i=Kn(je(a),a,n,r,e);return er(i),i}function uo(e){e?Fe.get(e)?.destroy():(Fe.forEach(t=>t.destroy()),Fe.clear())}var dt,N,tr,fo,ge,nr,rr,ar,ir,Xt,Jt,Qt,ho,ut={},ft=[],mo=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,We=Array.isArray;function de(e,t){for(var n in t)e[n]=t[n];return e}function qt(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function De(e,t,n){var r,a,i,s={};for(i in t)i=="key"?r=t[i]:i=="ref"?a=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?dt.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)s[i]===void 0&&(s[i]=e.defaultProps[i]);return ht(e,s,r,a,null)}function ht(e,t,n,r,a){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a??++tr,__i:-1,__u:0};return a==null&&N.vnode!=null&&N.vnode(i),i}function B(e){return e.children}function ue(e,t){this.props=e,this.context=t}function Te(e,t){if(t==null)return e.__?Te(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Te(e):null}function po(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],a=[],i=de({},t);i.__v=t.__v+1,N.vnode&&N.vnode(i),Kt(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??Te(t),!!(32&t.__u),a),i.__v=t.__v,i.__.__k[i.__i]=i,fr(r,i,a),t.__e=t.__=null,i.__e!=n&&sr(i)}}function sr(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),sr(e)}function or(e){(!e.__d&&(e.__d=!0)&&ge.push(e)&&!mt.__r++||nr!=N.debounceRendering)&&((nr=N.debounceRendering)||rr)(mt)}function mt(){try{for(var e,t=1;ge.length;)ge.length>t&&ge.sort(ar),e=ge.shift(),t=ge.length,po(e)}finally{ge.length=mt.__r=0}}function cr(e,t,n,r,a,i,s,o,l,c,f){var d,h,m,g,w,b,v,k=r&&r.__k||ft,R=t.length;for(l=go(n,t,k,l,R),d=0;d<R;d++)(m=n.__k[d])!=null&&(h=m.__i!=-1&&k[m.__i]||ut,m.__i=d,b=Kt(e,m,h,a,i,s,o,l,c,f),g=m.__e,m.ref&&h.ref!=m.ref&&(h.ref&&tn(h.ref,null,m),f.push(m.ref,m.__c||g,m)),w==null&&g!=null&&(w=g),(v=!!(4&m.__u))||h.__k===m.__k?l=lr(m,l,e,v):typeof m.type=="function"&&b!==void 0?l=b:g&&(l=g.nextSibling),m.__u&=-7);return n.__e=w,l}function go(e,t,n,r,a){var i,s,o,l,c,f=n.length,d=f,h=0;for(e.__k=new Array(a),i=0;i<a;i++)(s=t[i])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[i]=ht(null,s,null,null,null):We(s)?s=e.__k[i]=ht(B,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[i]=ht(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[i]=s,l=i+h,s.__=e,s.__b=e.__b+1,o=null,(c=s.__i=_o(s,n,l,d))!=-1&&(d--,(o=n[c])&&(o.__u|=2)),o==null||o.__v==null?(c==-1&&(a>f?h--:a<f&&h++),typeof s.type!="function"&&(s.__u|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,s.__u|=4))):e.__k[i]=null;if(d)for(i=0;i<f;i++)(o=n[i])!=null&&(2&o.__u)==0&&(o.__e==r&&(r=Te(o)),mr(o,o));return r}function lr(e,t,n,r){var a,i;if(typeof e.type=="function"){for(a=e.__k,i=0;a&&i<a.length;i++)a[i]&&(a[i].__=e,t=lr(a[i],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Te(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function fe(e,t){return t=t||[],e==null||typeof e=="boolean"||(We(e)?e.some(function(n){fe(n,t)}):t.push(e)),t}function _o(e,t,n,r){var a,i,s,o=e.key,l=e.type,c=t[n],f=c!=null&&(2&c.__u)==0;if(c===null&&o==null||f&&o==c.key&&l==c.type)return n;if(r>(f?1:0)){for(a=n-1,i=n+1;a>=0||i<t.length;)if((c=t[s=a>=0?a--:i++])!=null&&(2&c.__u)==0&&o==c.key&&l==c.type)return s}return-1}function dr(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||mo.test(t)?n:n+"px"}function pt(e,t,n,r,a){var i,s;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||dr(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||dr(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(ir,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n.u=r.u:(n.u=Xt,e.addEventListener(t,i?Qt:Jt,i)):e.removeEventListener(t,i?Qt:Jt,i);else{if(a=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function ur(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=Xt++;else if(t.t<n.u)return;return n(N.event?N.event(t):t)}}}function Kt(e,t,n,r,a,i,s,o,l,c){var f,d,h,m,g,w,b,v,k,R,P,D,Y,X,L,z=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),i=[o=t.__e=n.__e]),(f=N.__b)&&f(t);e:if(typeof z=="function")try{if(v=t.props,k=z.prototype&&z.prototype.render,R=(f=z.contextType)&&r[f.__c],P=f?R?R.props.value:f.__:r,n.__c?b=(d=t.__c=n.__c).__=d.__E:(k?t.__c=d=new z(v,P):(t.__c=d=new ue(v,P),d.constructor=z,d.render=yo),R&&R.sub(d),d.state||(d.state={}),d.__n=r,h=d.__d=!0,d.__h=[],d._sb=[]),k&&d.__s==null&&(d.__s=d.state),k&&z.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=de({},d.__s)),de(d.__s,z.getDerivedStateFromProps(v,d.__s))),m=d.props,g=d.state,d.__v=t,h)k&&z.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),k&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(k&&z.getDerivedStateFromProps==null&&v!==m&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(v,P),t.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(v,d.__s,P)===!1){t.__v!=n.__v&&(d.props=v,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(M){M&&(M.__=t)}),ft.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&s.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(v,d.__s,P),k&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(m,g,w)})}if(d.context=P,d.props=v,d.__P=e,d.__e=!1,D=N.__r,Y=0,k)d.state=d.__s,d.__d=!1,D&&D(t),f=d.render(d.props,d.state,d.context),ft.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,D&&D(t),f=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++Y<25);d.state=d.__s,d.getChildContext!=null&&(r=de(de({},r),d.getChildContext())),k&&!h&&d.getSnapshotBeforeUpdate!=null&&(w=d.getSnapshotBeforeUpdate(m,g)),X=f!=null&&f.type===B&&f.key==null?hr(f.props.children):f,o=cr(e,We(X)?X:[X],t,n,r,a,i,s,o,l,c),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),b&&(d.__E=d.__=null)}catch(M){if(t.__v=null,l||i!=null)if(M.then){for(t.__u|=l?160:128;o&&o.nodeType==8&&o.nextSibling;)o=o.nextSibling;i[i.indexOf(o)]=null,t.__e=o}else{for(L=i.length;L--;)qt(i[L]);en(t)}else t.__e=n.__e,t.__k=n.__k,M.then||en(t);N.__e(M,t,n)}else i==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):o=t.__e=vo(n.__e,t,n,r,a,i,s,l,c);return(f=N.diffed)&&f(t),128&t.__u?void 0:o}function en(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(en))}function fr(e,t,n){for(var r=0;r<n.length;r++)tn(n[r],n[++r],n[++r]);N.__c&&N.__c(t,e),e.some(function(a){try{e=a.__h,a.__h=[],e.some(function(i){i.call(a)})}catch(i){N.__e(i,a.__v)}})}function hr(e){return typeof e!="object"||e==null||e.__b>0?e:We(e)?e.map(hr):de({},e)}function vo(e,t,n,r,a,i,s,o,l){var c,f,d,h,m,g,w,b=n.props||ut,v=t.props,k=t.type;if(k=="svg"?a="http://www.w3.org/2000/svg":k=="math"?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c<i.length;c++)if((m=i[c])&&"setAttribute"in m==!!k&&(k?m.localName==k:m.nodeType==3)){e=m,i[c]=null;break}}if(e==null){if(k==null)return document.createTextNode(v);e=document.createElementNS(a,k,v.is&&v),o&&(N.__m&&N.__m(t,i),o=!1),i=null}if(k==null)b===v||o&&e.data==v||(e.data=v);else{if(i=i&&dt.call(e.childNodes),!o&&i!=null)for(b={},c=0;c<e.attributes.length;c++)b[(m=e.attributes[c]).name]=m.value;for(c in b)m=b[c],c=="dangerouslySetInnerHTML"?d=m:c=="children"||c in v||c=="value"&&"defaultValue"in v||c=="checked"&&"defaultChecked"in v||pt(e,c,null,m,a);for(c in v)m=v[c],c=="children"?h=m:c=="dangerouslySetInnerHTML"?f=m:c=="value"?g=m:c=="checked"?w=m:o&&typeof m!="function"||b[c]===m||pt(e,c,m,b[c],a);if(f)o||d&&(f.__html==d.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(d&&(e.innerHTML=""),cr(t.type=="template"?e.content:e,We(h)?h:[h],t,n,r,k=="foreignObject"?"http://www.w3.org/1999/xhtml":a,i,s,i?i[0]:n.__k&&Te(n,0),o,l),i!=null)for(c=i.length;c--;)qt(i[c]);o||(c="value",k=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[c]||k=="progress"&&!g||k=="option"&&g!=b[c])&&pt(e,c,g,b[c],a),c="checked",w!=null&&w!=e[c]&&pt(e,c,w,b[c],a))}return e}function tn(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(a){N.__e(a,n)}}function mr(e,t,n){var r,a;if(N.unmount&&N.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||tn(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){N.__e(i,t)}r.base=r.__P=null}if(r=e.__k)for(a=0;a<r.length;a++)r[a]&&mr(r[a],t,n||typeof e.type!="function");n||qt(e.__e),e.__c=e.__=e.__e=void 0}function yo(e,t,n){return this.constructor(e,n)}function pr(e,t,n){var r,a,i,s;t==document&&(t=document.documentElement),N.__&&N.__(e,t),a=(r=typeof n=="function")?null:n&&n.__k||t.__k,i=[],s=[],Kt(t,e=(!r&&n||t).__k=De(B,null,[e]),a||ut,ut,t.namespaceURI,!r&&n?[n]:a?null:t.firstChild?dt.call(t.childNodes):null,i,!r&&n?n:a?a.__e:t.firstChild,r,s),fr(i,e,s)}dt=ft.slice,N={__e:function(e,t,n,r){for(var a,i,s;t=t.__;)if((a=t.__c)&&!a.__)try{if((i=a.constructor)&&i.getDerivedStateFromError!=null&&(a.setState(i.getDerivedStateFromError(e)),s=a.__d),a.componentDidCatch!=null&&(a.componentDidCatch(e,r||{}),s=a.__d),s)return a.__E=a}catch(o){e=o}throw e}},tr=0,fo=function(e){return e!=null&&e.constructor===void 0},ue.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=de({},this.state);typeof e=="function"&&(e=e(de({},n),this.props)),e&&de(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),or(this))},ue.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),or(this))},ue.prototype.render=B,ge=[],rr=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ar=function(e,t){return e.__v.__b-t.__v.__b},mt.__r=0,ir=/(PointerCapture)$|Capture$/i,Xt=0,Jt=ur(!1),Qt=ur(!0),ho=0;var ze,j,nn,gr,Ue=0,_r=[],O=N,vr=O.__b,yr=O.__r,kr=O.diffed,br=O.__c,xr=O.unmount,wr=O.__;function rn(e,t){O.__h&&O.__h(j,e,Ue||t),Ue=0;var n=j.__H||(j.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Le(e){return Ue=1,ko(Ir,e)}function ko(e,t,n){var r=rn(ze++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ir(void 0,t),function(o){var l=r.__N?r.__N[0]:r.__[0],c=r.t(l,o);l!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=j,!j.__f)){var a=function(o,l,c){if(!r.__c.__H)return!0;var f=r.__c.__H.__.filter(function(h){return h.__c});if(f.every(function(h){return!h.__N}))return!i||i.call(this,o,l,c);var d=r.__c.props!==o;return f.some(function(h){if(h.__N){var m=h.__[0];h.__=h.__N,h.__N=void 0,m!==h.__[0]&&(d=!0)}}),i&&i.call(this,o,l,c)||d};j.__f=!0;var i=j.shouldComponentUpdate,s=j.componentWillUpdate;j.componentWillUpdate=function(o,l,c){if(this.__e){var f=i;i=void 0,a(o,l,c),i=f}s&&s.call(this,o,l,c)},j.shouldComponentUpdate=a}return r.__N||r.__}function Ae(e,t){var n=rn(ze++,3);!O.__s&&Cr(n.__H,t)&&(n.__=e,n.u=t,j.__H.__h.push(n))}function Ee(e){return Ue=5,an(function(){return{current:e}},[])}function an(e,t){var n=rn(ze++,7);return Cr(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function bo(e,t){return Ue=8,an(function(){return e},t)}function xo(){for(var e;e=_r.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(gt),t.__h.some(sn),t.__h=[]}catch(n){t.__h=[],O.__e(n,e.__v)}}}O.__b=function(e){j=null,vr&&vr(e)},O.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),wr&&wr(e,t)},O.__r=function(e){yr&&yr(e),ze=0;var t=(j=e.__c).__H;t&&(nn===j?(t.__h=[],j.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(gt),t.__h.some(sn),t.__h=[],ze=0)),nn=j},O.diffed=function(e){kr&&kr(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(_r.push(t)!==1&&gr===O.requestAnimationFrame||((gr=O.requestAnimationFrame)||wo)(xo)),t.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),nn=j=null},O.__c=function(e,t){t.some(function(n){try{n.__h.some(gt),n.__h=n.__h.filter(function(r){return!r.__||sn(r)})}catch(r){t.some(function(a){a.__h&&(a.__h=[])}),t=[],O.__e(r,n.__v)}}),br&&br(e,t)},O.unmount=function(e){xr&&xr(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{gt(r)}catch(a){t=a}}),n.__H=void 0,t&&O.__e(t,n.__v))};var Sr=typeof requestAnimationFrame=="function";function wo(e){var t,n=function(){clearTimeout(r),Sr&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Sr&&(t=requestAnimationFrame(n))}function gt(e){var t=j,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),j=t}function sn(e){var t=j;e.__c=e.__(),j=t}function Cr(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Ir(e,t){return typeof t=="function"?t(e):t}function So(e,t){for(var n in t)e[n]=t[n];return e}function Nr(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function Tr(e,t){this.props=e,this.context=t}(Tr.prototype=new ue).isPureReactComponent=!0,Tr.prototype.shouldComponentUpdate=function(e,t){return Nr(this.props,e)||Nr(this.state,t)};var Lr=N.__b;N.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Lr&&Lr(e)};var Wc=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911,Ar=function(e,t){return e==null?null:fe(fe(e).map(t))},Dc={map:Ar,forEach:Ar,count:function(e){return e?fe(e).length:0},only:function(e){var t=fe(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:fe},Co=N.__e;N.__e=function(e,t,n,r){if(e.then){for(var a,i=t;i=i.__;)if((a=i.__c)&&a.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k),a.__c(e,t)}Co(e,t,n,r)};var Er=N.unmount;function Rr(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=So({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Rr(r,t,n)})),e}function Mr(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Mr(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function on(){this.__u=0,this.o=null,this.__b=null}function Zr(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function _t(){this.i=null,this.l=null}N.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Er&&Er(e)},(on.prototype=new ue).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var a=Zr(r.__v),i=!1,s=function(){i||r.__z||(i=!0,n.__R=null,a?a(l):l())};n.__R=s;var o=n.__P;n.__P=null;var l=function(){if(!--r.__u){if(r.state.__a){var c=r.state.__a;r.__v.__k[0]=Mr(c,c.__c.__P,c.__c.__O)}var f;for(r.setState({__a:r.__b=null});f=r.o.pop();)f.__P=o,f.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},on.prototype.componentWillUnmount=function(){this.o=[]},on.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Rr(this.__b,n,r.__O=r.__P)}this.__b=null}var a=t.__a&&De(B,null,e.fallback);return a&&(a.__u&=-33),[De(B,null,t.__a?null:e.children),a]};var jr=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(_t.prototype=new ue).__a=function(e){var t=this,n=Zr(t.__v),r=t.l.get(e);return r[0]++,function(a){var i=function(){t.props.revealOrder?(r.push(a),jr(t,e,r)):a()};n?n(i):i()}},_t.prototype.render=function(e){this.i=null,this.l=new Map;var t=fe(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},_t.prototype.componentDidUpdate=_t.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){jr(e,n,t)})};var Io=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,No=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,To=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Lo=/[A-Z0-9]/g,Ao=typeof document<"u",Eo=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function Ro(e,t,n){return t.__k??(t.textContent=""),pr(e,t),typeof n=="function"&&n(),e?e.__c:null}ue.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(ue.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Or=N.event;N.event=function(e){return Or&&(e=Or(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Pr,Mo={configurable:!0,get:function(){return this.class}},Vr=N.vnode;N.vnode=function(e){typeof e.type=="string"&&(function(t){var n=t.props,r=t.type,a={},i=r.indexOf("-")==-1;for(var s in n){var o=n[s];if(!(s==="value"&&"defaultValue"in n&&o==null||Ao&&s==="children"&&r==="noscript"||s==="class"||s==="className")){var l=s.toLowerCase();s==="defaultValue"&&"value"in n&&n.value==null?s="value":s==="download"&&o===!0?o="":l==="translate"&&o==="no"?o=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?s="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||Eo(n.type)?l==="onfocus"?s="onfocusin":l==="onblur"?s="onfocusout":To.test(s)&&(s=l):l=s="oninput":i&&No.test(s)?s=s.replace(Lo,"-$&").toLowerCase():o===null&&(o=void 0),l==="oninput"&&a[s=l]&&(s="oninputCapture"),a[s]=o}}r=="select"&&(a.multiple&&Array.isArray(a.value)&&(a.value=fe(n.children).forEach(function(c){c.props.selected=a.value.indexOf(c.props.value)!=-1})),a.defaultValue!=null&&(a.value=fe(n.children).forEach(function(c){c.props.selected=a.multiple?a.defaultValue.indexOf(c.props.value)!=-1:a.defaultValue==c.props.value}))),n.class&&!n.className?(a.class=n.class,Object.defineProperty(a,"className",Mo)):n.className&&(a.class=a.className=n.className),t.props=a})(e),e.$$typeof=Io,Vr&&Vr(e)};var $r=N.__r;N.__r=function(e){$r&&$r(e),Pr=e.__c};var Fr=N.diffed;N.diffed=function(e){Fr&&Fr(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),Pr=null};function Zo(e){return!!e.__k&&(pr(null,e),!0)}function jo(e){return{render:function(t){Ro(t,e)},unmount:function(){Zo(e)}}}function Oo(e){const{theme:t}=e,n=[`--ak-accent: ${t.accentColor}`,`--ak-font: ${t.fontFamily}`,`--ak-radius: ${t.borderRadius}`];return n.push(`--ak-accent-hover: color-mix(in srgb, ${t.accentColor} 85%, black)`),`:host { ${n.join("; ")} }`}function Po(e){return e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Vo=`
7
7
  *, *::before, *::after {
8
8
  box-sizing: border-box;
9
9
  margin: 0;
@@ -22,6 +22,9 @@ var AgentKit=(function(vt){Object.defineProperty(vt,Symbol.toStringTag,{value:"M
22
22
  --ak-user-text: #ffffff;
23
23
  --ak-bot-bg: #f3f4f6;
24
24
  --ak-bot-text: #111827;
25
+ --ak-maintenance-fg: #92400e;
26
+ --ak-maintenance-bg: #fffbeb;
27
+ --ak-maintenance-halo: #fcd34d;
25
28
  --ak-font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
26
29
  --ak-radius: 12px;
27
30
  --ak-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 8px 24px rgba(0, 0, 0, 0.08);
@@ -39,6 +42,9 @@ var AgentKit=(function(vt){Object.defineProperty(vt,Symbol.toStringTag,{value:"M
39
42
  --ak-border: #374151;
40
43
  --ak-bot-bg: #374151;
41
44
  --ak-bot-text: #f9fafb;
45
+ --ak-maintenance-fg: #fde68a;
46
+ --ak-maintenance-bg: rgba(253, 230, 138, 0.06);
47
+ --ak-maintenance-halo: #f59e0b;
42
48
  }
43
49
 
44
50
  /* ── Floating layout ─────────────────────────────────────────── */
@@ -146,6 +152,7 @@ var AgentKit=(function(vt){Object.defineProperty(vt,Symbol.toStringTag,{value:"M
146
152
  /* ── Header ──────────────────────────────────────────────────── */
147
153
  .ak-header {
148
154
  display: flex;
155
+ flex-direction: row;
149
156
  align-items: center;
150
157
  justify-content: space-between;
151
158
  padding: 14px 18px;
@@ -154,6 +161,19 @@ var AgentKit=(function(vt){Object.defineProperty(vt,Symbol.toStringTag,{value:"M
154
161
  flex-shrink: 0;
155
162
  gap: 8px;
156
163
  }
164
+ .ak-header--confirming {
165
+ flex-direction: column;
166
+ align-items: stretch;
167
+ justify-content: flex-start;
168
+ gap: 0;
169
+ }
170
+ .ak-header__row {
171
+ display: flex;
172
+ align-items: center;
173
+ justify-content: space-between;
174
+ width: 100%;
175
+ gap: 8px;
176
+ }
157
177
  .ak-header__status {
158
178
  width: 8px;
159
179
  height: 8px;
@@ -218,6 +238,103 @@ var AgentKit=(function(vt){Object.defineProperty(vt,Symbol.toStringTag,{value:"M
218
238
  color: #fff;
219
239
  flex-shrink: 0;
220
240
  }
241
+ .ak-header__button {
242
+ width: 28px;
243
+ height: 28px;
244
+ border-radius: 50%;
245
+ background: transparent;
246
+ border: none;
247
+ cursor: pointer;
248
+ display: flex;
249
+ align-items: center;
250
+ justify-content: center;
251
+ color: #fff;
252
+ transition: background 0.15s;
253
+ flex-shrink: 0;
254
+ }
255
+ .ak-header__button:hover {
256
+ background: rgba(255, 255, 255, 0.15);
257
+ }
258
+ .ak-header__button--active {
259
+ background: rgba(255, 255, 255, 0.3);
260
+ }
261
+ .ak-header__confirm {
262
+ width: 100%;
263
+ display: flex;
264
+ align-items: center;
265
+ justify-content: space-between;
266
+ gap: 8px;
267
+ padding: 8px 0 0;
268
+ margin: 8px 0 0;
269
+ border-top: 1px solid rgba(255, 255, 255, 0.2);
270
+ animation: ak-confirm-in 0.18s ease-out;
271
+ }
272
+ @keyframes ak-confirm-in {
273
+ from { opacity: 0; transform: translateY(-4px); }
274
+ to { opacity: 1; transform: translateY(0); }
275
+ }
276
+ .ak-header__confirm-text {
277
+ display: flex;
278
+ flex-direction: column;
279
+ gap: 1px;
280
+ flex: 1;
281
+ min-width: 0;
282
+ }
283
+ .ak-header__confirm-title {
284
+ font-size: 13px;
285
+ font-weight: 600;
286
+ color: #fff;
287
+ line-height: 1.3;
288
+ }
289
+ .ak-header__confirm-sub {
290
+ font-size: 11px;
291
+ color: rgba(255, 255, 255, 0.75);
292
+ line-height: 1.3;
293
+ }
294
+ .ak-header__confirm-actions {
295
+ display: flex;
296
+ align-items: center;
297
+ gap: 6px;
298
+ flex-shrink: 0;
299
+ }
300
+ .ak-header__confirm-cancel {
301
+ padding: 5px 10px;
302
+ border-radius: 6px;
303
+ border: 1px solid rgba(255, 255, 255, 0.4);
304
+ background: transparent;
305
+ color: #fff;
306
+ font-family: var(--ak-font);
307
+ font-size: 12px;
308
+ font-weight: 500;
309
+ cursor: pointer;
310
+ transition: background 0.15s;
311
+ white-space: nowrap;
312
+ }
313
+ .ak-header__confirm-cancel:hover {
314
+ background: rgba(255, 255, 255, 0.15);
315
+ }
316
+ .ak-header__confirm-cancel:active {
317
+ background: rgba(255, 255, 255, 0.25);
318
+ }
319
+ .ak-header__confirm-ok {
320
+ padding: 5px 10px;
321
+ border-radius: 6px;
322
+ border: none;
323
+ background: rgba(255, 255, 255, 0.2);
324
+ color: #fff;
325
+ font-family: var(--ak-font);
326
+ font-size: 12px;
327
+ font-weight: 600;
328
+ cursor: pointer;
329
+ transition: background 0.15s;
330
+ white-space: nowrap;
331
+ }
332
+ .ak-header__confirm-ok:hover {
333
+ background: rgba(239, 68, 68, 0.7);
334
+ }
335
+ .ak-header__confirm-ok:active {
336
+ background: rgba(239, 68, 68, 0.85);
337
+ }
221
338
 
222
339
  /* ── Message list ────────────────────────────────────────────── */
223
340
  .ak-messages {
@@ -237,6 +354,115 @@ var AgentKit=(function(vt){Object.defineProperty(vt,Symbol.toStringTag,{value:"M
237
354
  border-radius: 4px;
238
355
  }
239
356
 
357
+ /* ── Empty state ─────────────────────────────────────────────── */
358
+ .ak-empty-state {
359
+ flex: 1;
360
+ position: relative;
361
+ display: flex;
362
+ flex-direction: column;
363
+ align-items: center;
364
+ justify-content: center;
365
+ padding: 0 16px;
366
+ text-align: center;
367
+ gap: 16px;
368
+ overflow-y: auto;
369
+ overflow-x: hidden;
370
+ min-height: 0;
371
+ background: radial-gradient(ellipse 110% 55% at 50% 0%,
372
+ color-mix(in srgb, var(--ak-accent) 10%, var(--ak-bg)),
373
+ var(--ak-bg) 72%
374
+ );
375
+ }
376
+ /* Decorative blurred orb behind the avatar */
377
+ .ak-empty-state__glow {
378
+ position: absolute;
379
+ top: -24px;
380
+ left: 50%;
381
+ transform: translateX(-50%);
382
+ width: 180px;
383
+ height: 180px;
384
+ border-radius: 50%;
385
+ background: color-mix(in srgb, var(--ak-accent) 18%, transparent);
386
+ filter: blur(48px);
387
+ pointer-events: none;
388
+ }
389
+ .ak-empty-state__body {
390
+ display: flex;
391
+ flex-direction: column;
392
+ align-items: center;
393
+ gap: 8px;
394
+ position: relative;
395
+ width: 100%;
396
+ }
397
+ .ak-empty-state__avatar {
398
+ width: 64px;
399
+ height: 64px;
400
+ border-radius: 50%;
401
+ background: var(--ak-bg);
402
+ border: 2px solid color-mix(in srgb, var(--ak-accent) 25%, var(--ak-border));
403
+ box-shadow:
404
+ 0 0 0 4px color-mix(in srgb, var(--ak-accent) 10%, transparent),
405
+ 0 4px 16px color-mix(in srgb, var(--ak-accent) 20%, transparent);
406
+ display: flex;
407
+ align-items: center;
408
+ justify-content: center;
409
+ color: var(--ak-accent);
410
+ margin-bottom: 4px;
411
+ flex-shrink: 0;
412
+ }
413
+ .ak-empty-state__avatar-img {
414
+ width: 64px;
415
+ height: 64px;
416
+ border-radius: 50%;
417
+ object-fit: cover;
418
+ }
419
+ .ak-empty-state__bot-icon {
420
+ display: flex;
421
+ align-items: center;
422
+ justify-content: center;
423
+ }
424
+ .ak-empty-state__title {
425
+ margin: 0;
426
+ font-size: 16px;
427
+ font-weight: 700;
428
+ color: var(--ak-text);
429
+ line-height: 1.3;
430
+ letter-spacing: -0.01em;
431
+ }
432
+ .ak-empty-state__description {
433
+ margin: 0;
434
+ font-size: 13px;
435
+ color: var(--ak-text-muted);
436
+ line-height: 1.55;
437
+ width: 100%;
438
+ }
439
+ /* Quoted greeting block */
440
+ .ak-empty-state__quote {
441
+ position: relative;
442
+ width: 100%;
443
+ background: color-mix(in srgb, var(--ak-accent) 6%, var(--ak-bg));
444
+ border: 1px solid color-mix(in srgb, var(--ak-accent) 18%, var(--ak-border));
445
+ border-radius: 12px;
446
+ padding: 12px 14px 12px 16px;
447
+ text-align: left;
448
+ }
449
+ .ak-empty-state__quote-mark {
450
+ display: block;
451
+ font-size: 32px;
452
+ line-height: 1;
453
+ color: var(--ak-accent);
454
+ margin-bottom: 2px;
455
+ font-family: Georgia, serif;
456
+ opacity: 0.7;
457
+ }
458
+ .ak-empty-state__quote-text {
459
+ margin: 0;
460
+ font-size: 13px;
461
+ color: var(--ak-text-muted);
462
+ line-height: 1.55;
463
+ font-style: italic;
464
+ }
465
+
240
466
  /* ── Message bubbles ─────────────────────────────────────────── */
241
467
  .ak-message {
242
468
  display: flex;
@@ -266,6 +492,9 @@ var AgentKit=(function(vt){Object.defineProperty(vt,Symbol.toStringTag,{value:"M
266
492
  max-width: 100%;
267
493
  min-width: 0;
268
494
  }
495
+ .ak-message__bubble--md {
496
+ white-space: normal;
497
+ }
269
498
  .ak-message--user .ak-message__bubble {
270
499
  background: var(--ak-user-bg);
271
500
  color: var(--ak-user-text);
@@ -282,12 +511,71 @@ var AgentKit=(function(vt){Object.defineProperty(vt,Symbol.toStringTag,{value:"M
282
511
  color: #991b1b;
283
512
  border-color: #fca5a5;
284
513
  }
514
+ .ak-message--operator .ak-message__bubble--operator {
515
+ background: color-mix(in srgb, var(--ak-accent) 8%, var(--ak-bot-bg));
516
+ border: 1px solid color-mix(in srgb, var(--ak-accent) 22%, var(--ak-border));
517
+ }
285
518
  .ak-message__time {
286
519
  font-size: 11px;
287
520
  color: var(--ak-text-muted);
288
521
  margin-top: 3px;
289
522
  padding: 0 4px;
290
523
  }
524
+ .ak-message__sender-label {
525
+ font-size: 11px;
526
+ font-weight: 500;
527
+ color: var(--ak-text-muted);
528
+ display: inline-flex;
529
+ align-items: center;
530
+ gap: 6px;
531
+ padding: 0 2px;
532
+ margin-bottom: 4px;
533
+ }
534
+ .ak-message--operator .ak-message__sender-label {
535
+ color: var(--ak-accent);
536
+ font-weight: 600;
537
+ }
538
+ .ak-message__operator-avatar {
539
+ display: inline-flex;
540
+ align-items: center;
541
+ justify-content: center;
542
+ width: 18px;
543
+ height: 18px;
544
+ border-radius: 50%;
545
+ background: var(--ak-accent);
546
+ color: #fff;
547
+ font-size: 10px;
548
+ font-weight: 700;
549
+ line-height: 1;
550
+ flex-shrink: 0;
551
+ }
552
+ .ak-message__operator-name {
553
+ line-height: 1;
554
+ }
555
+ .ak-handoff-divider {
556
+ display: flex;
557
+ align-items: center;
558
+ gap: 10px;
559
+ margin: 8px 4px;
560
+ color: var(--ak-text-muted);
561
+ font-size: 11px;
562
+ font-weight: 500;
563
+ }
564
+ .ak-handoff-divider::before,
565
+ .ak-handoff-divider::after {
566
+ content: '';
567
+ flex: 1;
568
+ height: 1px;
569
+ background: var(--ak-border);
570
+ }
571
+ .ak-handoff-divider__label {
572
+ white-space: nowrap;
573
+ padding: 2px 8px;
574
+ border-radius: 999px;
575
+ background: color-mix(in srgb, var(--ak-accent) 6%, var(--ak-bg));
576
+ border: 1px solid color-mix(in srgb, var(--ak-accent) 14%, var(--ak-border));
577
+ color: color-mix(in srgb, var(--ak-accent) 70%, var(--ak-text));
578
+ }
291
579
  /* ── Message avatar (assistant only, when avatarUrl is set) ─── */
292
580
  .ak-message--with-avatar {
293
581
  flex-direction: row;
@@ -432,9 +720,13 @@ var AgentKit=(function(vt){Object.defineProperty(vt,Symbol.toStringTag,{value:"M
432
720
  .ak-init-status--error {
433
721
  justify-content: flex-start;
434
722
  }
723
+ .ak-init-status--maintenance {
724
+ padding: 28px 24px;
725
+ }
435
726
 
436
727
  /* ── Composer ────────────────────────────────────────────────── */
437
728
  .ak-composer {
729
+ position: relative; /* establishes positioning context for the attachment submenu */
438
730
  padding: 10px 14px 12px;
439
731
  border-top: 1px solid var(--ak-border);
440
732
  display: flex;
@@ -464,6 +756,11 @@ var AgentKit=(function(vt){Object.defineProperty(vt,Symbol.toStringTag,{value:"M
464
756
  border-color: var(--ak-accent);
465
757
  }
466
758
 
759
+ /* Attach button wrapper */
760
+ .ak-composer__attach-wrap {
761
+ flex-shrink: 0;
762
+ }
763
+
467
764
  /* "+" attachment button — square with rounded corners */
468
765
  .ak-composer__attach {
469
766
  width: 28px;
@@ -476,18 +773,62 @@ var AgentKit=(function(vt){Object.defineProperty(vt,Symbol.toStringTag,{value:"M
476
773
  align-items: center;
477
774
  justify-content: center;
478
775
  color: var(--ak-text-muted);
479
- transition: color 0.15s, border-color 0.15s;
776
+ transition: color 0.15s, border-color 0.15s, background 0.15s;
480
777
  flex-shrink: 0;
481
778
  }
482
779
  .ak-composer__attach:hover:not(:disabled) {
483
780
  color: var(--ak-accent);
484
781
  border-color: var(--ak-accent);
485
782
  }
783
+ .ak-composer__attach--open {
784
+ color: var(--ak-accent);
785
+ border-color: var(--ak-accent);
786
+ background: color-mix(in srgb, var(--ak-accent) 8%, transparent);
787
+ }
486
788
  .ak-composer__attach:disabled {
487
789
  opacity: 0.4;
488
790
  cursor: not-allowed;
489
791
  }
490
792
 
793
+ /* Attachment submenu — floats above the composer, positioned relative to .ak-composer */
794
+ .ak-composer__attach-menu {
795
+ position: absolute;
796
+ bottom: calc(100% + 6px);
797
+ left: 14px;
798
+ background: var(--ak-surface);
799
+ border: 1px solid var(--ak-border);
800
+ border-radius: 10px;
801
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
802
+ padding: 4px;
803
+ min-width: 130px;
804
+ z-index: 10;
805
+ }
806
+
807
+ /* Individual item inside the attachment submenu */
808
+ .ak-composer__attach-menu-item {
809
+ display: flex;
810
+ align-items: center;
811
+ gap: 8px;
812
+ width: 100%;
813
+ padding: 7px 10px;
814
+ border: none;
815
+ border-radius: 7px;
816
+ background: transparent;
817
+ color: var(--ak-text);
818
+ font-family: var(--ak-font);
819
+ font-size: 13px;
820
+ cursor: pointer;
821
+ transition: background 0.12s;
822
+ text-align: left;
823
+ }
824
+ .ak-composer__attach-menu-item:hover:not(:disabled) {
825
+ background: var(--ak-bg);
826
+ }
827
+ .ak-composer__attach-menu-item:disabled {
828
+ opacity: 0.4;
829
+ cursor: not-allowed;
830
+ }
831
+
491
832
  /* Textarea — borderless, transparent, sits inside the container */
492
833
  .ak-composer__input {
493
834
  flex: 1;
@@ -605,11 +946,16 @@ var AgentKit=(function(vt){Object.defineProperty(vt,Symbol.toStringTag,{value:"M
605
946
  min-width: 0;
606
947
  }
607
948
  .ak-message__bubble--md .ak-md-p {
608
- margin-bottom: 0.5em;
949
+ margin: 0 0 0.4em 0;
609
950
  }
610
951
  .ak-message__bubble--md .ak-md-p:last-child {
611
952
  margin-bottom: 0;
612
953
  }
954
+ /* Collapse margins between paragraph and following list */
955
+ .ak-message__bubble--md .ak-md-p + .ak-md-ul,
956
+ .ak-message__bubble--md .ak-md-p + .ak-md-ol {
957
+ margin-top: 0;
958
+ }
613
959
  .ak-message__bubble--md .ak-md-h1,
614
960
  .ak-message__bubble--md .ak-md-h2,
615
961
  .ak-message__bubble--md .ak-md-h3 {
@@ -628,7 +974,7 @@ var AgentKit=(function(vt){Object.defineProperty(vt,Symbol.toStringTag,{value:"M
628
974
  .ak-message__bubble--md .ak-md-ul,
629
975
  .ak-message__bubble--md .ak-md-ol {
630
976
  padding-left: 1.4em;
631
- margin: 0.25em 0;
977
+ margin: 0.4em 0;
632
978
  }
633
979
  .ak-message__bubble--md .ak-md-ul li,
634
980
  .ak-message__bubble--md .ak-md-ol li {
@@ -714,6 +1060,86 @@ var AgentKit=(function(vt){Object.defineProperty(vt,Symbol.toStringTag,{value:"M
714
1060
  color: var(--ak-accent);
715
1061
  }
716
1062
 
1063
+ /* ── Maintenance state ───────────────────────────────────────── */
1064
+ .ak-maintenance {
1065
+ position: relative;
1066
+ display: flex;
1067
+ flex-direction: column;
1068
+ align-items: center;
1069
+ text-align: center;
1070
+ max-width: 320px;
1071
+ padding: 8px 4px;
1072
+ animation: ak-maintenance-enter 320ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
1073
+ }
1074
+ .ak-maintenance__halo {
1075
+ position: absolute;
1076
+ top: -6px;
1077
+ left: 50%;
1078
+ width: 120px;
1079
+ height: 120px;
1080
+ transform: translateX(-50%);
1081
+ border-radius: 50%;
1082
+ background: radial-gradient(
1083
+ closest-side,
1084
+ var(--ak-maintenance-halo) 0%,
1085
+ transparent 72%
1086
+ );
1087
+ opacity: 0.22;
1088
+ filter: blur(4px);
1089
+ pointer-events: none;
1090
+ animation: ak-maintenance-pulse 2.8s ease-in-out infinite;
1091
+ }
1092
+ .ak-maintenance__icon {
1093
+ position: relative;
1094
+ display: inline-flex;
1095
+ align-items: center;
1096
+ justify-content: center;
1097
+ width: 56px;
1098
+ height: 56px;
1099
+ border-radius: 50%;
1100
+ background: var(--ak-maintenance-bg);
1101
+ color: var(--ak-maintenance-fg);
1102
+ border: 1px solid color-mix(in srgb, var(--ak-maintenance-halo) 40%, transparent);
1103
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
1104
+ }
1105
+ .ak-maintenance__title {
1106
+ margin-top: 16px;
1107
+ font-size: 15px;
1108
+ font-weight: 600;
1109
+ color: var(--ak-text);
1110
+ line-height: 1.3;
1111
+ letter-spacing: -0.01em;
1112
+ }
1113
+ .ak-maintenance__description {
1114
+ margin-top: 6px;
1115
+ font-size: 13px;
1116
+ color: var(--ak-text-muted);
1117
+ line-height: 1.5;
1118
+ max-width: 28ch;
1119
+ }
1120
+
1121
+ @keyframes ak-maintenance-enter {
1122
+ from {
1123
+ opacity: 0;
1124
+ transform: translateY(6px) scale(0.98);
1125
+ }
1126
+ to {
1127
+ opacity: 1;
1128
+ transform: translateY(0) scale(1);
1129
+ }
1130
+ }
1131
+ @keyframes ak-maintenance-pulse {
1132
+ 0%, 100% { opacity: 0.18; transform: translateX(-50%) scale(1); }
1133
+ 50% { opacity: 0.32; transform: translateX(-50%) scale(1.06); }
1134
+ }
1135
+ @media (prefers-reduced-motion: reduce) {
1136
+ .ak-maintenance,
1137
+ .ak-maintenance__halo,
1138
+ .ak-maintenance__icon {
1139
+ animation: none;
1140
+ }
1141
+ }
1142
+
717
1143
  /* ── Error banner ────────────────────────────────────────────── */
718
1144
  .ak-error {
719
1145
  padding: 12px 16px;
@@ -859,7 +1285,9 @@ var AgentKit=(function(vt){Object.defineProperty(vt,Symbol.toStringTag,{value:"M
859
1285
  opacity: 0.75;
860
1286
  letter-spacing: -0.01em;
861
1287
  }
862
- `,jc=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Vo=0,Oc=Array.isArray;function f(e,t,r,n,a,i){t||(t={});var s,o,l=t;if("ref"in l)for(o in l={},t)o=="ref"?s=t[o]:l[o]=t[o];var c={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Vo,__i:-1,__u:0,__source:a,__self:i};if(typeof e=="function"&&(s=e.defaultProps))for(o in s)l[o]===void 0&&(l[o]=s[o]);return I.vnode&&I.vnode(c),c}function Fo(){return f("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[f("rect",{x:"3",y:"11",width:"18",height:"10",rx:"2"}),f("circle",{cx:"12",cy:"5",r:"2"}),f("path",{d:"M12 7v4"}),f("line",{x1:"8",y1:"16",x2:"8",y2:"16"}),f("line",{x1:"16",y1:"16",x2:"16",y2:"16"})]})}function Wo(){return f("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[f("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),f("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function $o({title:e,subtitle:t,avatarUrl:r,onClose:n,hideClose:a=!1}){return f("div",{className:"ak-header",children:[r?f("img",{src:r,alt:"",className:"ak-header__avatar","aria-hidden":"true"}):f("span",{className:"ak-header__bot-icon","aria-hidden":"true",children:f(Fo,{})}),f("div",{className:"ak-header__title-group",children:[f("span",{className:"ak-header__title",children:e}),t&&f("span",{className:"ak-header__subtitle",children:t})]}),f("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[f("span",{className:"ak-header__status","aria-hidden":"true"}),!a&&f("button",{className:"ak-header__close",onClick:n,"aria-label":"Close chat",type:"button",children:f(Wo,{})})]})]})}function Uo({thinking:e,isThinking:t,thinkingViewable:r}){const[n,a]=ut(!1);return!t&&!e?null:t?f("div",{className:"ak-thinking",children:f("div",{className:"ak-thinking__indicator",children:[f("span",{className:"ak-thinking__label",children:"Thinking"}),f("span",{className:"ak-cursor","aria-hidden":"true",children:[f("span",{className:"ak-cursor__dot"}),f("span",{className:"ak-cursor__dot"}),f("span",{className:"ak-cursor__dot"})]})]})}):!r||!e?null:f("div",{className:"ak-thinking ak-thinking--done",children:[f("button",{className:"ak-thinking__toggle",onClick:()=>a(i=>!i),"aria-expanded":n,type:"button",children:[f("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:f("polyline",{points:"6 9 12 15 18 9"})}),f("span",{children:"Thought for a moment"})]}),n&&f("div",{className:"ak-thinking__content",children:e})]})}function Do(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}var Pn=/(`[^`\n]+`|\*\*[^*\n]+\*\*|\*[^*\n]+\*|!\[[^\]\n]*\]\([^)\n]+\)|\[[^\]\n]+\]\([^)\n]+\))/g;function J(e){const t=[];let r=0,n=0;Pn.lastIndex=0;let a;for(;(a=Pn.exec(e))!==null;){a.index>r&&t.push(e.slice(r,a.index));const i=a[0];if(i.startsWith("`"))t.push(f("code",{className:"ak-md-ic",children:i.slice(1,-1)},n++));else if(i.startsWith("**"))t.push(f("strong",{children:i.slice(2,-2)},n++));else if(i.startsWith("*"))t.push(f("em",{children:i.slice(1,-1)},n++));else if(i.startsWith("![")){const s=i.match(/!\[([^\]]*)\]\(([^)]+)\)/);s&&t.push(f("a",{href:s[2],target:"_blank",rel:"noopener noreferrer",children:s[1]||"image"},n++))}else{const s=i.match(/\[(.+?)\]\((.+?)\)/);s?t.push(f("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 zo(e){const t=e.split(`
863
- `),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]||"",d=[];for(n++;n<t.length&&!t[n].trimStart().startsWith("```");)d.push(t[n].startsWith(c)?t[n].slice(c.length):t[n]),n++;n<t.length&&t[n].trimStart().startsWith("```")&&n++,r.push(f("div",{className:"ak-md-pre-wrap",children:[u&&f("span",{className:"ak-md-pre-lang",children:u}),f("pre",{className:`ak-md-pre${u?` ak-md-pre--${u}`:""}`,children:f("code",{className:"ak-md-code",children:d.join(`
864
- `)})})]},a++));continue}const o=i.match(/^(#{1,6})(\s+.*)?$/);if(o){const c=o[1].length,u=o[2]?J(o[2].trim()):"";c===1?r.push(f("h1",{className:"ak-md-h1",children:u},a++)):c===2?r.push(f("h2",{className:"ak-md-h2",children:u},a++)):c===3?r.push(f("h3",{className:"ak-md-h3",children:u},a++)):c===4?r.push(f("h4",{className:"ak-md-h4",children:u},a++)):c===5?r.push(f("h5",{className:"ak-md-h5",children:u},a++)):r.push(f("h6",{className:"ak-md-h6",children:u},a++)),n++;continue}if(/^[-*_]{3,}$/.test(i.trim())){r.push(f("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 d=t[u].length-t[u].trimStart().length,m=t[u].replace(/^[-*+]\s+/,""),h=[],x=[];let b=u+1;for(;b<t.length&&b<u+20;){const y=t[b];if(y.length-y.trimStart().length>d&&y.trim()!==""){const _=y.trim();/^[-*+]\s/.test(_)?h.push(f("li",{children:J(_.replace(/^[-*+]\s+/,""))},`nested-${b}`)):x.push(f("p",{style:{margin:"0.2em 0 0"},children:J(_)},`cont-${b}`)),b++}else break}const N=x.length>0||h.length>0?f(X,{children:[J(m),x,h.length>0&&f("ul",{style:{margin:"0.2em 0 0",paddingLeft:"1.2em"},children:h})]}):J(m);c.push(f("li",{children:N},`item-${u}`)),u=b}r.push(f("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 d=t[u].length-t[u].trimStart().length,m=t[u].replace(/^\d+\.\s+/,""),h=[],x=[];let b=u+1;for(;b<t.length&&b<u+20;){const y=t[b];if(y.length-y.trimStart().length>d&&y.trim()!==""){const _=y.trim();/^\d+\.\s/.test(_)?h.push(f("li",{children:J(_.replace(/^\d+\.\s+/,""))},`nested-order-${b}`)):/^[-*+]\s/.test(_)?h.push(f("li",{children:J(_.replace(/^[-*+]\s+/,""))},`nested-unorder-${b}`)):x.push(f("p",{style:{margin:"0.2em 0 0"},children:J(_)},`cont-${b}`)),b++}else break}const N=x.length>0||h.length>0?f(X,{children:[J(m),x,h.length>0&&f("ol",{style:{margin:"0.2em 0 0",paddingLeft:"1.2em"},children:h})]}):J(m);c.push(f("li",{children:N},`order-item-${u}`)),u=b}r.push(f("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,d)=>{c.push(...J(u)),d<l.length-1&&c.push(f("br",{},`br-${d}`))}),r.push(f("p",{className:"ak-md-p",children:c},a++))}}return f(X,{children:r})}function Bo({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=f(X,{children:[f("div",{className:["ak-message__bubble",l?"ak-message__bubble--md":"",o?"ak-message__bubble--has-image":""].filter(Boolean).join(" "),children:[s&&f("div",{className:"ak-message__images",children:f("div",{className:"ak-message__image-wrap",children:[f("a",{href:e.uploadedImageUrl,className:"ak-message__image-link",children:f("img",{src:e.uploadedImageUrl,alt:"Uploaded image",className:"ak-message__image"})}),f("a",{href:e.uploadedImageUrl,download:!0,className:"ak-message__image-dl-icon",title:"Download image",onClick:m=>m.stopPropagation(),children:f("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[f("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),f("polyline",{points:"7 10 12 15 17 10"}),f("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})})]})}),i&&f("div",{className:"ak-message__images",children:e.images.map((m,h)=>{const x=m.url??(m.base64?`data:${m.mimeType};base64,${m.base64}`:null);return x?f("div",{className:"ak-message__image-wrap",children:[f("a",{href:x,className:"ak-message__image-link",children:f("img",{src:x,alt:"Generated image",className:"ak-message__image"})}),f("a",{href:x,download:!0,className:"ak-message__image-dl-icon",title:"Download image",onClick:b=>b.stopPropagation(),children:f("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[f("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),f("polyline",{points:"7 10 12 15 17 10"}),f("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})})]},h):null})}),(e.content||a&&!e.isThinking)&&f("div",{className:o?"ak-message__image-caption":void 0,children:[l?zo(e.content):e.content,a&&!e.isThinking&&f("span",{className:"ak-cursor","aria-hidden":"true",children:[f("span",{className:"ak-cursor__dot"}),f("span",{className:"ak-cursor__dot"}),f("span",{className:"ak-cursor__dot"})]})]})]}),f("span",{className:"ak-message__time",children:Do(e.createdAt)})]}),d=!e.isThinking||!!e.content;return f("div",{className:`ak-message ${c}`,children:[!r&&f(Uo,{thinking:e.thinking,isThinking:e.isThinking??!1,thinkingViewable:t}),d&&u]})}function Ho(){return f("div",{className:"ak-typing","aria-label":"Assistant is typing",children:[f("span",{className:"ak-typing__dot"}),f("span",{className:"ak-typing__dot"}),f("span",{className:"ak-typing__dot"})]})}function Go({messages:e,isLoading:t,thinkingViewable:r}){const n=ht(null),a=e.find(s=>s.status==="streaming")?.content??"",i=e.find(s=>s.isThinking)?.thinking??"";return ft(()=>{n.current?.scrollIntoView({behavior:"smooth"})},[e.length,t,a,i]),f("div",{className:"ak-messages",role:"log","aria-live":"polite","aria-label":"Conversation",children:[e.map(s=>f(Bo,{message:s,thinkingViewable:r},s.id)),t&&!e.some(s=>s.status==="streaming")&&f(Ho,{}),f("div",{ref:n})]})}function Yo(){return f("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[f("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),f("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})}function Xo(){return f("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[f("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),f("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function Jo(){return f("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[f("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),f("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function Ko({onSend:e,disabled:t=!1,placeholder:r="Type a message…",privacyPolicyUrl:n}){const[a,i]=ut(""),[s,o]=ut(null),[l,c]=ut(null),u=ht(null),d=ht(null);ft(()=>()=>{l&&URL.revokeObjectURL(l)},[l]),ft(()=>{t||u.current?.focus()},[t]);function m(){o(null),l&&URL.revokeObjectURL(l),c(null),d.current&&(d.current.value="")}function h(){const _=a.trim();!_&&!s||t||(e(_,s??void 0),i(""),m(),u.current&&(u.current.style.height="auto"))}function x(_){_.key==="Enter"&&!_.shiftKey&&(_.preventDefault(),h())}function b(_){const L=_.currentTarget;i(L.value),L.style.height="auto",L.style.height=`${L.scrollHeight}px`}function N(_){const L=_.currentTarget.files?.[0];if(L){if(L.size>5242880){alert("Image must be smaller than 5 MB."),_.currentTarget.value="";return}l&&URL.revokeObjectURL(l),o(L),c(URL.createObjectURL(L))}}const y=!t&&(!!a.trim()||!!s);return f("div",{className:"ak-composer",children:[l&&f("div",{className:"ak-composer__preview",children:f("div",{className:"ak-composer__preview-wrap",children:[f("img",{src:l,alt:"Selected",className:"ak-composer__preview-img"}),f("button",{className:"ak-composer__preview-remove",onClick:m,type:"button","aria-label":"Remove image",disabled:t,children:f(Jo,{})})]})}),f("div",{className:"ak-composer__input-wrap",children:[f("input",{ref:d,type:"file",accept:"image/jpeg,image/png,image/gif,image/webp",className:"ak-composer__file-input",onChange:N,disabled:t,"aria-label":"Attach image"}),f("button",{className:"ak-composer__attach",onClick:()=>d.current?.click(),disabled:t,"aria-label":"Attach image",type:"button",children:f(Xo,{})}),f("textarea",{ref:u,className:"ak-composer__input",value:a,onInput:b,onKeyDown:x,placeholder:r,disabled:t,rows:1,"aria-label":"Message input"}),f("button",{className:"ak-composer__send",onClick:h,disabled:!y,"aria-label":"Send message",type:"button",children:f(Yo,{})})]}),f("p",{className:"ak-composer__disclaimer",children:["By chatting with us, you agree to our"," ",n?f("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}):"Privacy Policy"]})]})}function Vn({message:e}){return e.includes("Origin not allowed")?f("div",{className:"ak-error ak-error--origin",role:"alert",children:[f("div",{className:"ak-error__icon",children:"🔒"}),f("div",{className:"ak-error__content",children:[f("h3",{className:"ak-error__title",children:"Access Restricted"}),f("p",{className:"ak-error__description",children:"This widget has been restricted to specific websites only."}),f("p",{className:"ak-error__message",children:"Contact the website administrator if you believe this is an error."})]})]}):f("div",{className:"ak-error",role:"alert",children:[f("div",{className:"ak-error__icon",children:"⚠️"}),f("div",{className:"ak-error__content",children:f("p",{className:"ak-error__message",children:e})})]})}function Qo(){return f("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:"ak-branding__logo",children:[f("rect",{width:"24",height:"24",rx:"5",fill:"currentColor"}),f("path",{d:"M12 5L7 13h3.5v6l6.5-9H13.5V5z",fill:"white"})]})}function qo(){return f("div",{className:"ak-branding",children:[f(Qo,{}),f("span",{className:"ak-branding__label",children:"Powered by"}),f("span",{className:"ak-branding__name",children:"AgentForge"})]})}function Fn({config:e,messages:t,isLoading:r,error:n,isInline:a,initStatus:i,initError:s,callbacks:o}){return f("div",{className:a?"ak-shell-wrap":"ak-shell-wrap ak-shell-enter",children:[f("div",{className:a?"ak-shell ak-shell--inline":"ak-shell ak-shell--floating",role:"dialog","aria-label":e.title,children:[f($o,{title:e.title,subtitle:e.subtitle,avatarUrl:e.avatarUrl,onClose:o.onClose,hideClose:a}),i==="validating"&&f("div",{className:"ak-init-status",children:f("div",{className:"ak-init-spinner","aria-label":"Connecting…"})}),i==="error"&&f("div",{className:"ak-init-status ak-init-status--error",children:f(Vn,{message:s??"Widget configuration is invalid."})}),i==="ready"&&f(X,{children:[f(Go,{messages:t,isLoading:r,thinkingViewable:e.thinkingViewable}),n&&f(Vn,{message:n}),f(Ko,{onSend:o.onSendMessage,disabled:r,placeholder:"Type a message…",privacyPolicyUrl:e.privacyPolicyUrl})]})]}),!a&&f(qo,{})]})}function ec(){return f("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:f("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 tc(){return f("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[f("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),f("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function rc({isOpen:e,onClick:t,avatarUrl:r,ariaLabel:n="Toggle chat"}){const a=!e&&!!r;return f("button",{className:`ak-launcher${a?" ak-launcher--avatar":""}`,onClick:t,"aria-label":n,"aria-expanded":e,type:"button",children:e?f(tc,{}):a?f("img",{src:r,alt:"",className:"ak-launcher__avatar-img","aria-hidden":"true"}):f(ec,{})})}function Wn({config:e,state:t,callbacks:r}){const n=e.mode==="inline",a=ht(null);return ft(()=>{const i=a.current?.getRootNode()?.host;if(!i)return;const s=Oo(e.theme.mode);i.setAttribute("data-theme",s)},[e.theme.mode]),n?f("div",{ref:a,className:"ak-inline",children:f(Fn,{config:e,messages:t.messages,isLoading:t.isLoading,error:t.error,isInline:!0,initStatus:t.initStatus,initError:t.initError,callbacks:r})}):f("div",{ref:a,className:"ak-floating",children:[t.isOpen&&f(Fn,{config:e,messages:t.messages,isLoading:t.isLoading,error:t.error,isInline:!1,initStatus:t.initStatus,initError:t.initError,callbacks:r}),f(rc,{isOpen:t.isOpen,onClick:t.isOpen?r.onClose:r.onOpen,avatarUrl:e.avatarUrl})]})}var $n=(e,t,r,n)=>{const a=Mo(e);return a.render(Ve(Wn,{config:t,state:r,callbacks:n})),{update(i,s){a.render(Ve(Wn,{config:s,state:i,callbacks:n}))},destroy(){setTimeout(()=>{a.unmount()},0)}}};function Un(e){return Po+`
865
- `+jo(e)}var Dn={init(e){return oo(e,$n,Un(Ae(e)))},mount(e,t){return co(e,t,$n,Un(Ae({...t,mode:"inline"})))},destroy(e){lo(e)}};return window.AgentKit=Dn,vt.AgentKit=Dn,vt})({});
1288
+ `,zc=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,$o=0,Uc=Array.isArray;function u(e,t,n,r,a,i){t||(t={});var s,o,l=t;if("ref"in l)for(o in l={},t)o=="ref"?s=t[o]:l[o]=t[o];var c={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--$o,__i:-1,__u:0,__source:a,__self:i};if(typeof e=="function"&&(s=e.defaultProps))for(o in s)l[o]===void 0&&(l[o]=s[o]);return N.vnode&&N.vnode(c),c}function Fo(){return u("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[u("rect",{x:"3",y:"11",width:"18",height:"10",rx:"2"}),u("circle",{cx:"12",cy:"5",r:"2"}),u("path",{d:"M12 7v4"}),u("line",{x1:"8",y1:"16",x2:"8",y2:"16"}),u("line",{x1:"16",y1:"16",x2:"16",y2:"16"})]})}function Wo(){return u("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[u("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),u("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function Do(){return u("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),u("path",{d:"M3 3v5h5"})]})}function zo({title:e,subtitle:t,avatarUrl:n,onClose:r,onReset:a,hideClose:i=!1}){const[s,o]=Le(!1);return u("div",{className:`ak-header${s?" ak-header--confirming":""}`,children:[u("div",{className:"ak-header__row",children:[n?u("img",{src:n,alt:"",className:"ak-header__avatar","aria-hidden":"true"}):u("span",{className:"ak-header__bot-icon","aria-hidden":"true",children:u(Fo,{})}),u("div",{className:"ak-header__title-group",children:[u("span",{className:"ak-header__title",children:e}),t&&u("span",{className:"ak-header__subtitle",children:t})]}),u("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[u("span",{className:"ak-header__status","aria-hidden":"true"}),a&&u("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:u(Do,{})}),!i&&u("button",{className:"ak-header__close",onClick:r,"aria-label":"Close chat",type:"button",children:u(Wo,{})})]})]}),s&&u("div",{className:"ak-header__confirm",role:"alert",children:[u("div",{className:"ak-header__confirm-text",children:[u("span",{className:"ak-header__confirm-title",children:"End this conversation?"}),u("span",{className:"ak-header__confirm-sub",children:"All messages will be removed"})]}),u("div",{className:"ak-header__confirm-actions",children:[u("button",{className:"ak-header__confirm-cancel",type:"button",onClick:()=>o(!1),children:"Cancel"}),u("button",{className:"ak-header__confirm-ok",type:"button",onClick:()=>{a?.(),o(!1)},children:"End chat"})]})]})]})}function Uo({thinking:e,isThinking:t,thinkingViewable:n}){const[r,a]=Le(!1);return!t&&!e?null:t?u("div",{className:"ak-thinking",children:u("div",{className:"ak-thinking__indicator",children:[u("span",{className:"ak-thinking__label",children:"Thinking"}),u("span",{className:"ak-cursor","aria-hidden":"true",children:[u("span",{className:"ak-cursor__dot"}),u("span",{className:"ak-cursor__dot"}),u("span",{className:"ak-cursor__dot"})]})]})}):!n||!e?null:u("div",{className:"ak-thinking ak-thinking--done",children:[u("button",{className:"ak-thinking__toggle",onClick:()=>a(i=>!i),"aria-expanded":r,type:"button",children:[u("svg",{className:`ak-thinking__chevron${r?" 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:u("polyline",{points:"6 9 12 15 18 9"})}),u("span",{children:"Thought for a moment"})]}),r&&u("div",{className:"ak-thinking__content",children:e})]})}function Bo(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}var Wr=/(`[^`\n]+`|\*\*[^*\n]+\*\*|\*[^*\n]+\*|!\[[^\]\n]*\]\([^)\n]+\)|\[[^\]\n]+\]\([^)\n]+\))/g;function ee(e){const t=[];let n=0,r=0;Wr.lastIndex=0;let a;for(;(a=Wr.exec(e))!==null;){a.index>n&&t.push(e.slice(n,a.index));const i=a[0];if(i.startsWith("`"))t.push(u("code",{className:"ak-md-ic",children:i.slice(1,-1)},r++));else if(i.startsWith("**"))t.push(u("strong",{children:i.slice(2,-2)},r++));else if(i.startsWith("*"))t.push(u("em",{children:i.slice(1,-1)},r++));else if(i.startsWith("![")){const s=i.match(/!\[([^\]]*)\]\(([^)]+)\)/);s&&t.push(u("a",{href:s[2],target:"_blank",rel:"noopener noreferrer",children:s[1]||"image"},r++))}else{const s=i.match(/\[(.+?)\]\((.+?)\)/);s?t.push(u("a",{href:s[2],target:"_blank",rel:"noopener noreferrer",children:s[1]},r++)):t.push(i)}n=a.index+i.length}return n<e.length&&t.push(e.slice(n)),t}function Ho(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,`
1289
+
1290
+ `);const t=e.split(`
1291
+ `),n=[];let r=0,a=0;for(;r<t.length;){const i=t[r],s=i.match(/^(\s*)```/);if(s){const c=s[1],f=i.trimStart().match(/^```(\w+)?\s*$/)?.[1]||"",d=[];for(r++;r<t.length&&!t[r].trimStart().startsWith("```");)d.push(t[r].startsWith(c)?t[r].slice(c.length):t[r]),r++;r<t.length&&t[r].trimStart().startsWith("```")&&r++,n.push(u("div",{className:"ak-md-pre-wrap",children:[f&&u("span",{className:"ak-md-pre-lang",children:f}),u("pre",{className:`ak-md-pre${f?` ak-md-pre--${f}`:""}`,children:u("code",{className:"ak-md-code",children:d.join(`
1292
+ `)})})]},a++));continue}const o=i.match(/^(#{1,6})(\s+.*)?$/);if(o){const c=o[1].length,f=o[2]?ee(o[2].trim()):"";c===1?n.push(u("h1",{className:"ak-md-h1",children:f},a++)):c===2?n.push(u("h2",{className:"ak-md-h2",children:f},a++)):c===3?n.push(u("h3",{className:"ak-md-h3",children:f},a++)):c===4?n.push(u("h4",{className:"ak-md-h4",children:f},a++)):c===5?n.push(u("h5",{className:"ak-md-h5",children:f},a++)):n.push(u("h6",{className:"ak-md-h6",children:f},a++)),r++;continue}if(/^[-*_]{3,}$/.test(i.trim())){n.push(u("hr",{className:"ak-md-hr"},a++)),r++;continue}if(/^[-*+]\s/.test(i)){const c=[];let f=r;for(;f<t.length&&(/^[-*+]\s/.test(t[f])||t[f].trim()==="");){if(t[f].trim()===""){f++;continue}const d=t[f].length-t[f].trimStart().length,h=t[f].replace(/^[-*+]\s+/,""),m=[],g=[];let w=f+1;for(;w<t.length&&w<f+20;){const v=t[w];if(v.length-v.trimStart().length>d&&v.trim()!==""){const k=v.trim();/^[-*+]\s/.test(k)?m.push(u("li",{children:ee(k.replace(/^[-*+]\s+/,""))},`nested-${w}`)):g.push(u("p",{style:{margin:"0.2em 0 0"},children:ee(k)},`cont-${w}`)),w++}else break}const b=g.length>0||m.length>0?u(B,{children:[ee(h),g,m.length>0&&u("ul",{style:{margin:"0.2em 0 0",paddingLeft:"1.2em"},children:m})]}):ee(h);c.push(u("li",{children:b},`item-${f}`)),f=w}n.push(u("ul",{className:"ak-md-ul",children:c},a++)),r=f;continue}if(/^\d+\.\s/.test(i)){const c=[];let f=r;for(;f<t.length&&(/^\d+\.\s/.test(t[f])||t[f].trim()==="");){if(t[f].trim()===""){f++;continue}const d=t[f].length-t[f].trimStart().length,h=t[f].replace(/^\d+\.\s+/,""),m=[],g=[];let w=f+1;for(;w<t.length&&w<f+20;){const v=t[w];if(v.length-v.trimStart().length>d&&v.trim()!==""){const k=v.trim();/^\d+\.\s/.test(k)?m.push(u("li",{children:ee(k.replace(/^\d+\.\s+/,""))},`nested-order-${w}`)):/^[-*+]\s/.test(k)?m.push(u("li",{children:ee(k.replace(/^[-*+]\s+/,""))},`nested-unorder-${w}`)):g.push(u("p",{style:{margin:"0.2em 0 0"},children:ee(k)},`cont-${w}`)),w++}else break}const b=g.length>0||m.length>0?u(B,{children:[ee(h),g,m.length>0&&u("ol",{style:{margin:"0.2em 0 0",paddingLeft:"1.2em"},children:m})]}):ee(h);c.push(u("li",{children:b},`order-item-${f}`)),f=w}n.push(u("ol",{className:"ak-md-ol",children:c},a++)),r=f;continue}if(i.trim()===""){r++;continue}const l=[];for(;r<t.length&&t[r].trim()!==""&&!t[r].startsWith("#")&&!/^\s*```/.test(t[r])&&!/^[-*+]\s/.test(t[r])&&!/^\d+\.\s/.test(t[r])&&!/^[-*_]{3,}$/.test(t[r].trim());)l.push(t[r]),r++;if(l.length>0){const c=[];l.forEach((f,d)=>{c.push(...ee(f)),d<l.length-1&&c.push(u("br",{},`br-${d}`))}),n.push(u("p",{className:"ak-md-p",children:c},a++))}}return u(B,{children:n})}function Go({message:e,thinkingViewable:t=!1}){const n=e.role==="user",r=e.status==="error",a=e.status==="streaming",i=!!(e.images&&e.images.length>0),s=!!(n&&e.uploadedImageUrl),o=i||s,l=!n&&!r,c=!!e.isHuman&&!n,f=n?"ak-message--user":r?"ak-message--assistant ak-message--error":c?"ak-message--assistant ak-message--operator":"ak-message--assistant",d=["ak-message__bubble",l?"ak-message__bubble--md":"",o?"ak-message__bubble--has-image":"",c?"ak-message__bubble--operator":""].filter(Boolean).join(" "),h=c?e.senderDisplay?.trim()||"Operator":null,m=h?h.charAt(0).toUpperCase():"",g=u(B,{children:[u("div",{className:d,children:[s&&u("div",{className:"ak-message__images",children:u("div",{className:"ak-message__image-wrap",children:[u("a",{href:e.uploadedImageUrl,className:"ak-message__image-link",children:u("img",{src:e.uploadedImageUrl,alt:"Uploaded image",className:"ak-message__image"})}),u("a",{href:e.uploadedImageUrl,download:!0,className:"ak-message__image-dl-icon",title:"Download image",onClick:b=>b.stopPropagation(),children:u("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),u("polyline",{points:"7 10 12 15 17 10"}),u("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})})]})}),i&&u("div",{className:"ak-message__images",children:e.images.map((b,v)=>{const k=b.url??(b.base64?`data:${b.mimeType};base64,${b.base64}`:null);return k?u("div",{className:"ak-message__image-wrap",children:[u("a",{href:k,className:"ak-message__image-link",children:u("img",{src:k,alt:"Generated image",className:"ak-message__image"})}),u("a",{href:k,download:!0,className:"ak-message__image-dl-icon",title:"Download image",onClick:R=>R.stopPropagation(),children:u("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),u("polyline",{points:"7 10 12 15 17 10"}),u("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})})]},`${e.id}-img-${v}`):null})}),(e.content||a&&!e.isThinking)&&u("div",{className:o?"ak-message__image-caption":void 0,children:[l?Ho(e.content):e.content,a&&!e.isThinking&&u("span",{className:"ak-cursor","aria-hidden":"true",children:[u("span",{className:"ak-cursor__dot"}),u("span",{className:"ak-cursor__dot"}),u("span",{className:"ak-cursor__dot"})]})]})]}),u("span",{className:"ak-message__time",children:Bo(e.createdAt)})]}),w=!e.isThinking||!!e.content;return u("div",{className:`ak-message ${f}`,children:[!n&&u(Uo,{thinking:e.thinking,isThinking:e.isThinking??!1,thinkingViewable:t}),c&&u("span",{className:"ak-message__sender-label",children:[u("span",{className:"ak-message__operator-avatar","aria-hidden":"true",children:m}),u("span",{className:"ak-message__operator-name",children:h})]}),w&&g]})}function Yo(){return u("div",{className:"ak-typing","aria-label":"Assistant is typing",children:[u("span",{className:"ak-typing__dot"}),u("span",{className:"ak-typing__dot"}),u("span",{className:"ak-typing__dot"})]})}function Xo(e,t){const n=[];let r=null;for(const a of e){if(a.role==="assistant"){const i=!!a.isHuman;r!==null&&r!==i&&n.push({kind:"divider",id:`divider-${a.id}`,label:i?`${a.senderDisplay?.trim()||t} joined the chat`:`${t} left — AI is back`}),r=i}n.push({kind:"message",message:a})}return n}function Jo({messages:e,isLoading:t,thinkingViewable:n,operatorFallbackLabel:r="Operator"}){const a=Ee(null),i=an(()=>Xo(e,r),[e,r]),s=e.find(l=>l.status==="streaming")?.content??"",o=e.find(l=>l.isThinking)?.thinking??"";return Ae(()=>{a.current?.scrollIntoView({behavior:"smooth"})},[e.length,t,s,o]),u("div",{className:"ak-messages",role:"log","aria-live":"polite","aria-label":"Conversation",children:[i.map(l=>l.kind==="divider"?u("div",{className:"ak-handoff-divider",role:"separator",children:u("span",{className:"ak-handoff-divider__label",children:l.label})},l.id):u(Go,{message:l.message,thinkingViewable:n},l.message.id)),t&&!e.some(l=>l.status==="streaming")&&u(Yo,{}),u("div",{ref:a})]})}function Qo(){return u("svg",{width:"30",height:"30",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u("rect",{x:"3",y:"11",width:"18",height:"10",rx:"2"}),u("circle",{cx:"12",cy:"5",r:"2"}),u("path",{d:"M12 7v4"}),u("line",{x1:"8",y1:"16",x2:"8",y2:"16"}),u("line",{x1:"16",y1:"16",x2:"16",y2:"16"})]})}function qo({title:e,description:t,greeting:n,avatarUrl:r}){return u("div",{className:"ak-empty-state","aria-label":"Start a conversation",children:[u("div",{className:"ak-empty-state__glow","aria-hidden":"true"}),u("div",{className:"ak-empty-state__body",children:[u("div",{className:"ak-empty-state__avatar",children:r?u("img",{src:r,alt:"",className:"ak-empty-state__avatar-img","aria-hidden":"true"}):u("span",{className:"ak-empty-state__bot-icon","aria-hidden":"true",children:u(Qo,{})})}),u("p",{className:"ak-empty-state__title",children:e}),t&&u("p",{className:"ak-empty-state__description",children:t})]}),n&&u("div",{className:"ak-empty-state__quote",children:[u("span",{className:"ak-empty-state__quote-mark","aria-hidden":"true",children:'"'}),u("p",{className:"ak-empty-state__quote-text",children:n})]})]})}function Ko(){return u("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),u("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})}function ec(){return u("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[u("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),u("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function tc(){return u("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[u("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"}),u("circle",{cx:"12",cy:"13",r:"4"})]})}function nc(){return u("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[u("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),u("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function rc({onSend:e,disabled:t=!1,placeholder:n="Type a message…",privacyPolicyUrl:r,termsOfServiceUrl:a,photoSendingEnabled:i=!1}){const[s,o]=Le(""),[l,c]=Le(null),[f,d]=Le(null),[h,m]=Le(!1),g=Ee(null),w=Ee(null),b=Ee(null),v=Ee(null);Ae(()=>()=>{f&&URL.revokeObjectURL(f)},[f]),Ae(()=>{t||g.current?.focus()},[t]);const k=bo(M=>{if(!h)return;const $=M.composedPath?M.composedPath():[],vt=!!b.current&&$.includes(b.current),yt=!!v.current&&$.includes(v.current);!vt&&!yt&&m(!1)},[h]);Ae(()=>{if(h)return document.addEventListener("click",k),()=>document.removeEventListener("click",k)},[h,k]),Ae(()=>{i||m(!1)},[i]);function R(){c(null),f&&URL.revokeObjectURL(f),d(null),w.current&&(w.current.value="")}function P(){const M=s.trim();!M&&!l||t||(e(M,l??void 0),o(""),R(),g.current&&(g.current.style.height="auto"))}function D(M){M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),P())}function Y(M){const $=M.currentTarget;o($.value),$.style.height="auto",$.style.height=`${$.scrollHeight}px`}function X(M){const $=M.currentTarget.files?.[0];if($){if($.size>5242880){alert("Image must be smaller than 5 MB."),M.currentTarget.value="";return}f&&URL.revokeObjectURL(f),c($),d(URL.createObjectURL($))}}function L(){m(!1),w.current?.click()}const z=!t&&(!!s.trim()||!!l);return u("div",{className:"ak-composer",children:[i&&h&&u("div",{ref:b,className:"ak-composer__attach-menu",role:"menu",children:u("button",{className:"ak-composer__attach-menu-item",onClick:L,type:"button",role:"menuitem",disabled:t,children:[u(tc,{}),u("span",{children:"Photo"})]})}),f&&u("div",{className:"ak-composer__preview",children:u("div",{className:"ak-composer__preview-wrap",children:[u("img",{src:f,alt:"Selected",className:"ak-composer__preview-img"}),u("button",{className:"ak-composer__preview-remove",onClick:R,type:"button","aria-label":"Remove image",disabled:t,children:u(nc,{})})]})}),u("div",{className:"ak-composer__input-wrap",children:[i&&u(B,{children:[u("input",{ref:w,type:"file",accept:"image/jpeg,image/png,image/gif,image/webp",className:"ak-composer__file-input",onChange:X,disabled:t,"aria-label":"Attach image"}),u("div",{className:"ak-composer__attach-wrap",children:u("button",{ref:v,className:`ak-composer__attach${h?" ak-composer__attach--open":""}`,onClick:()=>m(M=>!M),disabled:t,"aria-label":"Attachment options","aria-haspopup":"true","aria-expanded":h,type:"button",children:u(ec,{})})})]}),u("textarea",{ref:g,className:"ak-composer__input",value:s,onInput:Y,onKeyDown:D,placeholder:n,disabled:t,rows:1,"aria-label":"Message input"}),u("button",{className:"ak-composer__send",onClick:P,disabled:!z,"aria-label":"Send message",type:"button",children:u(Ko,{})})]}),u("p",{className:"ak-composer__disclaimer",children:[(r||a)&&u(B,{children:["By chatting you agree to our"," ",r?u("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}):"Privacy Policy",a&&u(B,{children:[" ","and"," ",u("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})]}),". "]}),"AI can make mistakes. Verify important information."]})]})}function Dr({message:e}){return e.includes("Origin not allowed")?u("div",{className:"ak-error ak-error--origin",role:"alert",children:[u("div",{className:"ak-error__icon",children:"🔒"}),u("div",{className:"ak-error__content",children:[u("h3",{className:"ak-error__title",children:"Access Restricted"}),u("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."})]})]}):u("div",{className:"ak-error",role:"alert",children:[u("div",{className:"ak-error__icon",children:"⚠️"}),u("div",{className:"ak-error__content",children:u("p",{className:"ak-error__message",children:e})})]})}function ac(){return u("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u("circle",{cx:"12",cy:"12",r:"9"}),u("path",{d:"M12 7v5l3 2"})]})}function ic(){return u("div",{className:"ak-maintenance",role:"status","aria-live":"polite",children:[u("div",{className:"ak-maintenance__halo","aria-hidden":"true"}),u("div",{className:"ak-maintenance__icon",children:u(ac,{})}),u("p",{className:"ak-maintenance__title",children:"Under maintenance"}),u("p",{className:"ak-maintenance__description",children:"This assistant is temporarily unavailable. Please check back in a little while."})]})}function sc(){return u("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:"ak-branding__logo",children:[u("rect",{width:"24",height:"24",rx:"5",fill:"currentColor"}),u("path",{d:"M12 5L7 13h3.5v6l6.5-9H13.5V5z",fill:"white"})]})}function oc(){return u("div",{className:"ak-branding",children:[u(sc,{}),u("span",{className:"ak-branding__label",children:"Powered by"}),u("span",{className:"ak-branding__name",children:"AgentForge"})]})}function zr({config:e,messages:t,isLoading:n,error:r,isInline:a,initStatus:i,initError:s,callbacks:o}){return u("div",{className:a?"ak-shell-wrap":"ak-shell-wrap ak-shell-enter",children:[u("div",{className:a?"ak-shell ak-shell--inline":"ak-shell ak-shell--floating",role:"dialog","aria-label":e.title,children:[u(zo,{title:e.title,subtitle:e.subtitle,avatarUrl:e.avatarUrl,onClose:o.onClose,onReset:i==="ready"?o.onReset:void 0,hideClose:!0}),i==="validating"&&u("div",{className:"ak-init-status",children:u("div",{className:"ak-init-spinner","aria-label":"Connecting…"})}),i==="error"&&u("div",{className:"ak-init-status ak-init-status--error",children:u(Dr,{message:s??"Widget configuration is invalid."})}),i==="disabled"&&u("div",{className:"ak-init-status ak-init-status--maintenance",children:u(ic,{})}),i==="ready"&&u(B,{children:[t.length===0?u(qo,{title:e.title,description:e.description??e.subtitle,greeting:e.greeting,avatarUrl:e.avatarUrl}):u(Jo,{messages:t,isLoading:n,thinkingViewable:e.thinkingViewable}),r&&u(Dr,{message:r}),u(rc,{onSend:o.onSendMessage,disabled:n,placeholder:"Type a message…",privacyPolicyUrl:e.privacyPolicyUrl,termsOfServiceUrl:e.termsOfServiceUrl,photoSendingEnabled:e.photoSendingEnabled})]})]}),!a&&u(oc,{})]})}function cc(){return u("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:u("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 lc(){return u("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:u("polyline",{points:"6,9 12,15 18,9"})})}function dc({isOpen:e,onClick:t,avatarUrl:n,ariaLabel:r="Toggle chat"}){const a=!e&&!!n;return u("button",{className:`ak-launcher${a?" ak-launcher--avatar":""}`,onClick:t,"aria-label":r,"aria-expanded":e,type:"button",children:e?u(lc,{}):a?u("img",{src:n,alt:"",className:"ak-launcher__avatar-img","aria-hidden":"true"}):u(cc,{})})}function Ur({config:e,state:t,callbacks:n}){const r=e.mode==="inline",a=Ee(null);return Ae(()=>{const i=a.current?.getRootNode()?.host;if(!i)return;const s=Po(e.theme.mode);i.setAttribute("data-theme",s)},[e.theme.mode]),r?u("div",{ref:a,className:"ak-inline",children:u(zr,{config:e,messages:t.messages,isLoading:t.isLoading,error:t.error,isInline:!0,initStatus:t.initStatus,initError:t.initError,callbacks:n})}):u("div",{ref:a,className:"ak-floating",children:[t.isOpen&&u(zr,{config:e,messages:t.messages,isLoading:t.isLoading,error:t.error,isInline:!1,initStatus:t.initStatus,initError:t.initError,callbacks:n}),u(dc,{isOpen:t.isOpen,onClick:t.isOpen?n.onClose:n.onOpen,avatarUrl:e.avatarUrl})]})}var Br=(e,t,n,r)=>{const a=jo(e);return a.render(De(Ur,{config:t,state:n,callbacks:r})),{update(i,s){a.render(De(Ur,{config:s,state:i,callbacks:r}))},destroy(){setTimeout(()=>{a.unmount()},0)}}};function Hr(e){return Vo+`
1293
+ `+Oo(e)}var Gr={init(e){return co(e,Br,Hr(je(e)))},mount(e,t){return lo(e,t,Br,Hr(je({...t,mode:"inline"})))},destroy(e){uo(e)}};return window.AgentKit=Gr,xt.AgentKit=Gr,xt})({});