@bymos/agentkit-sdk 0.8.0 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/agentkit-widget.iife.js +238 -96
- package/agentkit-widget.js +239 -97
- package/index.cjs +238 -96
- package/index.d.ts +50 -12
- package/index.js +1004 -833
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("preact/compat/client"),t=require("preact/compat"),n=require("preact/jsx-runtime");var r;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(r||={});var i;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(i||={});var a=r.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),o=e=>{switch(typeof e){case`undefined`:return a.undefined;case`string`:return a.string;case`number`:return Number.isNaN(e)?a.nan:a.number;case`boolean`:return a.boolean;case`function`:return a.function;case`bigint`:return a.bigint;case`symbol`:return a.symbol;case`object`:return Array.isArray(e)?a.array:e===null?a.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?a.promise:typeof Map<`u`&&e instanceof Map?a.map:typeof Set<`u`&&e instanceof Set?a.set:typeof Date<`u`&&e instanceof Date?a.date:a.object;default:return a.unknown}},s=r.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`]),c=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,r.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};c.create=e=>new c(e);var l=(e,t)=>{let n;switch(e.code){case s.invalid_type:n=e.received===a.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case s.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,r.jsonStringifyReplacer)}`;break;case s.unrecognized_keys:n=`Unrecognized key(s) in object: ${r.joinValues(e.keys,`, `)}`;break;case s.invalid_union:n=`Invalid input`;break;case s.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${r.joinValues(e.options)}`;break;case s.invalid_enum_value:n=`Invalid enum value. Expected ${r.joinValues(e.options)}, received '${e.received}'`;break;case s.invalid_arguments:n=`Invalid function arguments`;break;case s.invalid_return_type:n=`Invalid function return type`;break;case s.invalid_date:n=`Invalid date`;break;case s.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}"`:r.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case s.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case s.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case s.custom:n=`Invalid input`;break;case s.invalid_intersection_types:n=`Intersection results could not be merged`;break;case s.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case s.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,r.assertNever(e)}return{message:n}},u=l;function d(){return u}var f=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function p(e,t){let n=d(),r=f({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===l?void 0:l].filter(e=>!!e)});e.common.issues.push(r)}var m=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return h;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return h;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},h=Object.freeze({status:`aborted`}),g=e=>({status:`dirty`,value:e}),_=e=>({status:`valid`,value:e}),v=e=>e.status===`aborted`,y=e=>e.status===`dirty`,b=e=>e.status===`valid`,x=e=>typeof Promise<`u`&&e instanceof Promise,S;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(S||={});var C=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}},w=(e,t)=>{if(b(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new c(e.common.issues);return this._error=t,this._error}}};function T(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var E=class{get description(){return this._def.description}_getType(e){return o(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:o(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new m,ctx:{common:e.parent.common,data:e.data,parsedType:o(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(x(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:o(e)};return w(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:o(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return b(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>b(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:o(e)},r=this._parse({data:e,path:n.path,parent:n});return w(n,await(x(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:s.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!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 N({schema:this,typeName:I.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:e=>this[`~validate`](e)}}optional(){return P.create(this,this._def)}nullable(){return F.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Fe.create(this)}promise(){return Ye.create(this,this._def)}or(e){return Ie.create([this,e],this._def)}and(e){return ze.create(this,e,this._def)}transform(e){return new N({...T(this._def),schema:this,typeName:I.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new Xe({...T(this._def),innerType:this,defaultValue:t,typeName:I.ZodDefault})}brand(){return new $e({typeName:I.ZodBranded,type:this,...T(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new Ze({...T(this._def),innerType:this,catchValue:t,typeName:I.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return et.create(this,e)}readonly(){return tt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},D=/^c[^\s-]{8,}$/i,ee=/^[0-9a-z]+$/,te=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ne=/^[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,re=/^[a-z0-9_-]{21}$/i,ie=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ae=/^[-+]?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)?)??$/,oe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,se=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,ce,le=/^(?:(?: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])$/,ue=/^(?:(?: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])$/,de=/^(([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]))$/,fe=/^(([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])$/,pe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,me=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,he=`((\\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])))`,ge=RegExp(`^${he}$`);function _e(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function ve(e){return RegExp(`^${_e(e)}$`)}function ye(e){let t=`${he}T${_e(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function be(e,t){return!!((t===`v4`||!t)&&le.test(e)||(t===`v6`||!t)&&de.test(e))}function xe(e,t){if(!ie.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function Se(e,t){return!!((t===`v4`||!t)&&ue.test(e)||(t===`v6`||!t)&&fe.test(e))}var Ce=class e extends E{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==a.string){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.string,received:t.parsedType}),h}let t=new m,n;for(let i of this._def.checks)if(i.kind===`min`)e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),p(n,{code:s.too_small,minimum:i.value,type:`string`,inclusive:!0,exact:!1,message:i.message}),t.dirty());else if(i.kind===`max`)e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),p(n,{code:s.too_big,maximum:i.value,type:`string`,inclusive:!0,exact:!1,message:i.message}),t.dirty());else if(i.kind===`length`){let r=e.data.length>i.value,a=e.data.length<i.value;(r||a)&&(n=this._getOrReturnCtx(e,n),r?p(n,{code:s.too_big,maximum:i.value,type:`string`,inclusive:!0,exact:!0,message:i.message}):a&&p(n,{code:s.too_small,minimum:i.value,type:`string`,inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if(i.kind===`email`)oe.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`email`,code:s.invalid_string,message:i.message}),t.dirty());else if(i.kind===`emoji`)ce||=new RegExp(se,`u`),ce.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`emoji`,code:s.invalid_string,message:i.message}),t.dirty());else if(i.kind===`uuid`)ne.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`uuid`,code:s.invalid_string,message:i.message}),t.dirty());else if(i.kind===`nanoid`)re.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`nanoid`,code:s.invalid_string,message:i.message}),t.dirty());else if(i.kind===`cuid`)D.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`cuid`,code:s.invalid_string,message:i.message}),t.dirty());else if(i.kind===`cuid2`)ee.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`cuid2`,code:s.invalid_string,message:i.message}),t.dirty());else if(i.kind===`ulid`)te.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`ulid`,code:s.invalid_string,message:i.message}),t.dirty());else if(i.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),p(n,{validation:`url`,code:s.invalid_string,message:i.message}),t.dirty()}else i.kind===`regex`?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`regex`,code:s.invalid_string,message:i.message}),t.dirty())):i.kind===`trim`?e.data=e.data.trim():i.kind===`includes`?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),p(n,{code:s.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),t.dirty()):i.kind===`toLowerCase`?e.data=e.data.toLowerCase():i.kind===`toUpperCase`?e.data=e.data.toUpperCase():i.kind===`startsWith`?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),p(n,{code:s.invalid_string,validation:{startsWith:i.value},message:i.message}),t.dirty()):i.kind===`endsWith`?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),p(n,{code:s.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty()):i.kind===`datetime`?ye(i).test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:s.invalid_string,validation:`datetime`,message:i.message}),t.dirty()):i.kind===`date`?ge.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:s.invalid_string,validation:`date`,message:i.message}),t.dirty()):i.kind===`time`?ve(i).test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:s.invalid_string,validation:`time`,message:i.message}),t.dirty()):i.kind===`duration`?ae.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`duration`,code:s.invalid_string,message:i.message}),t.dirty()):i.kind===`ip`?be(e.data,i.version)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`ip`,code:s.invalid_string,message:i.message}),t.dirty()):i.kind===`jwt`?xe(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`jwt`,code:s.invalid_string,message:i.message}),t.dirty()):i.kind===`cidr`?Se(e.data,i.version)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`cidr`,code:s.invalid_string,message:i.message}),t.dirty()):i.kind===`base64`?pe.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`base64`,code:s.invalid_string,message:i.message}),t.dirty()):i.kind===`base64url`?me.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`base64url`,code:s.invalid_string,message:i.message}),t.dirty()):r.assertNever(i);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:s.invalid_string,...S.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...S.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...S.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...S.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...S.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...S.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...S.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...S.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...S.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...S.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...S.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...S.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...S.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...S.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...S.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...S.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...S.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...S.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...S.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...S.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...S.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...S.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...S.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...S.errToObj(t)})}nonempty(e){return this.min(1,S.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Ce.create=e=>new Ce({checks:[],typeName:I.ZodString,coerce:e?.coerce??!1,...T(e)});function we(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Te=class e extends E{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==a.number){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.number,received:t.parsedType}),h}let t,n=new m;for(let i of this._def.checks)i.kind===`int`?r.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),p(t,{code:s.invalid_type,expected:`integer`,received:`float`,message:i.message}),n.dirty()):i.kind===`min`?(i.inclusive?e.data<i.value:e.data<=i.value)&&(t=this._getOrReturnCtx(e,t),p(t,{code:s.too_small,minimum:i.value,type:`number`,inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind===`max`?(i.inclusive?e.data>i.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),p(t,{code:s.too_big,maximum:i.value,type:`number`,inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind===`multipleOf`?we(e.data,i.value)!==0&&(t=this._getOrReturnCtx(e,t),p(t,{code:s.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),p(t,{code:s.not_finite,message:i.message}),n.dirty()):r.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,S.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,S.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,S.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,S.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:S.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:S.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:S.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:S.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:S.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:S.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:S.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&r.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};Te.create=e=>new Te({checks:[],typeName:I.ZodNumber,coerce:e?.coerce||!1,...T(e)});var Ee=class e extends E{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==a.bigint)return this._getInvalidInput(e);let t,n=new m;for(let i of this._def.checks)i.kind===`min`?(i.inclusive?e.data<i.value:e.data<=i.value)&&(t=this._getOrReturnCtx(e,t),p(t,{code:s.too_small,type:`bigint`,minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind===`max`?(i.inclusive?e.data>i.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),p(t,{code:s.too_big,type:`bigint`,maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind===`multipleOf`?e.data%i.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),p(t,{code:s.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):r.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.bigint,received:t.parsedType}),h}gte(e,t){return this.setLimit(`min`,e,!0,S.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,S.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,S.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,S.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:S.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:S.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:S.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Ee.create=e=>new Ee({checks:[],typeName:I.ZodBigInt,coerce:e?.coerce??!1,...T(e)});var De=class extends E{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==a.boolean){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.boolean,received:t.parsedType}),h}return _(e.data)}};De.create=e=>new De({typeName:I.ZodBoolean,coerce:e?.coerce||!1,...T(e)});var Oe=class e extends E{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==a.date){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.date,received:t.parsedType}),h}if(Number.isNaN(e.data.getTime()))return p(this._getOrReturnCtx(e),{code:s.invalid_date}),h;let t=new m,n;for(let i of this._def.checks)i.kind===`min`?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),p(n,{code:s.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:`date`}),t.dirty()):i.kind===`max`?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),p(n,{code:s.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:`date`}),t.dirty()):r.assertNever(i);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:S.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:S.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};Oe.create=e=>new Oe({checks:[],coerce:e?.coerce||!1,typeName:I.ZodDate,...T(e)});var ke=class extends E{_parse(e){if(this._getType(e)!==a.symbol){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.symbol,received:t.parsedType}),h}return _(e.data)}};ke.create=e=>new ke({typeName:I.ZodSymbol,...T(e)});var Ae=class extends E{_parse(e){if(this._getType(e)!==a.undefined){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.undefined,received:t.parsedType}),h}return _(e.data)}};Ae.create=e=>new Ae({typeName:I.ZodUndefined,...T(e)});var je=class extends E{_parse(e){if(this._getType(e)!==a.null){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.null,received:t.parsedType}),h}return _(e.data)}};je.create=e=>new je({typeName:I.ZodNull,...T(e)});var Me=class extends E{constructor(){super(...arguments),this._any=!0}_parse(e){return _(e.data)}};Me.create=e=>new Me({typeName:I.ZodAny,...T(e)});var Ne=class extends E{constructor(){super(...arguments),this._unknown=!0}_parse(e){return _(e.data)}};Ne.create=e=>new Ne({typeName:I.ZodUnknown,...T(e)});var O=class extends E{_parse(e){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.never,received:t.parsedType}),h}};O.create=e=>new O({typeName:I.ZodNever,...T(e)});var Pe=class extends E{_parse(e){if(this._getType(e)!==a.undefined){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.void,received:t.parsedType}),h}return _(e.data)}};Pe.create=e=>new Pe({typeName:I.ZodVoid,...T(e)});var Fe=class e extends E{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==a.array)return p(t,{code:s.invalid_type,expected:a.array,received:t.parsedType}),h;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(p(t,{code:e?s.too_big:s.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(p(t,{code:s.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(p(t,{code:s.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new C(t,e,t.path,n)))).then(e=>m.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new C(t,e,t.path,n)));return m.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:S.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:S.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:S.toString(n)}})}nonempty(e){return this.min(1,e)}};Fe.create=(e,t)=>new Fe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:I.ZodArray,...T(t)});function k(e){if(e instanceof A){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=P.create(k(r))}return new A({...e._def,shape:()=>t})}else if(e instanceof Fe)return new Fe({...e._def,type:k(e.element)});else if(e instanceof P)return P.create(k(e.unwrap()));else if(e instanceof F)return F.create(k(e.unwrap()));else if(e instanceof M)return M.create(e.items.map(e=>k(e)));else return e}var A=class e extends E{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=r.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==a.object){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.object,received:t.parsedType}),h}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof O&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||o.push(e);let c=[];for(let e of i){let t=r[e],i=n.data[e];c.push({key:{status:`valid`,value:e},value:t._parse(new C(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof O){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of o)c.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)o.length>0&&(p(n,{code:s.unrecognized_keys,keys:o}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of o){let r=n.data[t];c.push({key:{status:`valid`,value:t},value:e._parse(new C(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of c){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>m.mergeObjectSync(t,e)):m.mergeObjectSync(t,c)}get shape(){return this._def.shape()}strict(t){return S.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:S.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:I.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of r.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of r.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return k(this)}partial(t){let n={};for(let e of r.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of r.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof P;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return Ke(r.objectKeys(this.shape))}};A.create=(e,t)=>new A({shape:()=>e,unknownKeys:`strip`,catchall:O.create(),typeName:I.ZodObject,...T(t)}),A.strictCreate=(e,t)=>new A({shape:()=>e,unknownKeys:`strict`,catchall:O.create(),typeName:I.ZodObject,...T(t)}),A.lazycreate=(e,t)=>new A({shape:e,unknownKeys:`strip`,catchall:O.create(),typeName:I.ZodObject,...T(t)});var Ie=class extends E{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new c(e.ctx.common.issues));return p(t,{code:s.invalid_union,unionErrors:n}),h}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new c(e));return p(t,{code:s.invalid_union,unionErrors:i}),h}}get options(){return this._def.options}};Ie.create=(e,t)=>new Ie({options:e,typeName:I.ZodUnion,...T(t)});var j=e=>e instanceof We?j(e.schema):e instanceof N?j(e.innerType()):e instanceof Ge?[e.value]:e instanceof qe?e.options:e instanceof Je?r.objectValues(e.enum):e instanceof Xe?j(e._def.innerType):e instanceof Ae?[void 0]:e instanceof je?[null]:e instanceof P?[void 0,...j(e.unwrap())]:e instanceof F?[null,...j(e.unwrap())]:e instanceof $e||e instanceof tt?j(e.unwrap()):e instanceof Ze?j(e._def.innerType):[],Le=class e extends E{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==a.object)return p(t,{code:s.invalid_type,expected:a.object,received:t.parsedType}),h;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(p(t,{code:s.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),h)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=j(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:I.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...T(r)})}};function Re(e,t){let n=o(e),i=o(t);if(e===t)return{valid:!0,data:e};if(n===a.object&&i===a.object){let n=r.objectKeys(t),i=r.objectKeys(e).filter(e=>n.indexOf(e)!==-1),a={...e,...t};for(let n of i){let r=Re(e[n],t[n]);if(!r.valid)return{valid:!1};a[n]=r.data}return{valid:!0,data:a}}else if(n===a.array&&i===a.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Re(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===a.date&&i===a.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var ze=class extends E{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(v(e)||v(r))return h;let i=Re(e.value,r.value);return i.valid?((y(e)||y(r))&&t.dirty(),{status:t.value,value:i.data}):(p(n,{code:s.invalid_intersection_types}),h)};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(([e,t])=>r(e,t)):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}))}};ze.create=(e,t,n)=>new ze({left:e,right:t,typeName:I.ZodIntersection,...T(n)});var M=class e extends E{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==a.array)return p(n,{code:s.invalid_type,expected:a.array,received:n.parsedType}),h;if(n.data.length<this._def.items.length)return p(n,{code:s.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),h;!this._def.rest&&n.data.length>this._def.items.length&&(p(n,{code:s.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new C(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>m.mergeArray(t,e)):m.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};M.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new M({items:e,typeName:I.ZodTuple,rest:null,...T(t)})};var Be=class e extends E{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==a.object)return p(n,{code:s.invalid_type,expected:a.object,received:n.parsedType}),h;let r=[],i=this._def.keyType,o=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new C(n,e,n.path,e)),value:o._parse(new C(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?m.mergeObjectAsync(t,r):m.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof E?new e({keyType:t,valueType:n,typeName:I.ZodRecord,...T(r)}):new e({keyType:Ce.create(),valueType:t,typeName:I.ZodRecord,...T(n)})}},Ve=class extends E{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==a.map)return p(n,{code:s.invalid_type,expected:a.map,received:n.parsedType}),h;let r=this._def.keyType,i=this._def.valueType,o=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new C(n,e,n.path,[a,`key`])),value:i._parse(new C(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of o){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return h;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of o){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return h;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};Ve.create=(e,t,n)=>new Ve({valueType:t,keyType:e,typeName:I.ZodMap,...T(n)});var He=class e extends E{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==a.set)return p(n,{code:s.invalid_type,expected:a.set,received:n.parsedType}),h;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(p(n,{code:s.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(p(n,{code:s.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function o(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return h;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let c=[...n.data.values()].map((e,t)=>i._parse(new C(n,e,n.path,t)));return n.common.async?Promise.all(c).then(e=>o(e)):o(c)}min(t,n){return new e({...this._def,minSize:{value:t,message:S.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:S.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};He.create=(e,t)=>new He({valueType:e,minSize:null,maxSize:null,typeName:I.ZodSet,...T(t)});var Ue=class e extends E{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==a.function)return p(t,{code:s.invalid_type,expected:a.function,received:t.parsedType}),h;function n(e,n){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,d(),l].filter(e=>!!e),issueData:{code:s.invalid_arguments,argumentsError:n}})}function r(e,n){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,d(),l].filter(e=>!!e),issueData:{code:s.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Ye){let e=this;return _(async function(...t){let a=new c([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw a.addIssue(n(t,e)),a}),l=await Reflect.apply(o,this,s);return await e._def.returns._def.type.parseAsync(l,i).catch(e=>{throw a.addIssue(r(l,e)),a})})}else{let e=this;return _(function(...t){let a=e._def.args.safeParse(t,i);if(!a.success)throw new c([n(t,a.error)]);let s=Reflect.apply(o,this,a.data),l=e._def.returns.safeParse(s,i);if(!l.success)throw new c([r(s,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:M.create(t).rest(Ne.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||M.create([]).rest(Ne.create()),returns:n||Ne.create(),typeName:I.ZodFunction,...T(r)})}},We=class extends E{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};We.create=(e,t)=>new We({getter:e,typeName:I.ZodLazy,...T(t)});var Ge=class extends E{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return p(t,{received:t.data,code:s.invalid_literal,expected:this._def.value}),h}return{status:`valid`,value:e.data}}get value(){return this._def.value}};Ge.create=(e,t)=>new Ge({value:e,typeName:I.ZodLiteral,...T(t)});function Ke(e,t){return new qe({values:e,typeName:I.ZodEnum,...T(t)})}var qe=class e extends E{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return p(t,{expected:r.joinValues(n),received:t.parsedType,code:s.invalid_type}),h}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return p(t,{received:t.data,code:s.invalid_enum_value,options:n}),h}return _(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};qe.create=Ke;var Je=class extends E{_parse(e){let t=r.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==a.string&&n.parsedType!==a.number){let e=r.objectValues(t);return p(n,{expected:r.joinValues(e),received:n.parsedType,code:s.invalid_type}),h}if(this._cache||=new Set(r.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=r.objectValues(t);return p(n,{received:n.data,code:s.invalid_enum_value,options:e}),h}return _(e.data)}get enum(){return this._def.values}};Je.create=(e,t)=>new Je({values:e,typeName:I.ZodNativeEnum,...T(t)});var Ye=class extends E{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==a.promise&&t.common.async===!1?(p(t,{code:s.invalid_type,expected:a.promise,received:t.parsedType}),h):_((t.parsedType===a.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Ye.create=(e,t)=>new Ye({type:e,typeName:I.ZodPromise,...T(t)});var N=class extends E{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===I.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:e=>{p(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type===`preprocess`){let e=i.transform(n.data,a);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return h;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?h:r.status===`dirty`||t.value===`dirty`?g(r.value):r});{if(t.value===`aborted`)return h;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?h:r.status===`dirty`||t.value===`dirty`?g(r.value):r}}if(i.type===`refinement`){let e=e=>{let t=i.refinement(e,a);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?h:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?h:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(i.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!b(e))return h;let r=i.transform(e.value,a);if(r instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:r}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>b(e)?Promise.resolve(i.transform(e.value,a)).then(e=>({status:t.value,value:e})):h);r.assertNever(i)}};N.create=(e,t,n)=>new N({schema:e,typeName:I.ZodEffects,effect:t,...T(n)}),N.createWithPreprocess=(e,t,n)=>new N({schema:t,effect:{type:`preprocess`,transform:e},typeName:I.ZodEffects,...T(n)});var P=class extends E{_parse(e){return this._getType(e)===a.undefined?_(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};P.create=(e,t)=>new P({innerType:e,typeName:I.ZodOptional,...T(t)});var F=class extends E{_parse(e){return this._getType(e)===a.null?_(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};F.create=(e,t)=>new F({innerType:e,typeName:I.ZodNullable,...T(t)});var Xe=class extends E{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===a.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Xe.create=(e,t)=>new Xe({innerType:e,typeName:I.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...T(t)});var Ze=class extends E{_parse(e){let{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 x(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new c(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new c(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ze.create=(e,t)=>new Ze({innerType:e,typeName:I.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...T(t)});var Qe=class extends E{_parse(e){if(this._getType(e)!==a.nan){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.nan,received:t.parsedType}),h}return{status:`valid`,value:e.data}}};Qe.create=e=>new Qe({typeName:I.ZodNaN,...T(e)});var $e=class extends E{_parse(e){let{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}},et=class e extends E{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?h:e.status===`dirty`?(t.dirty(),g(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?h:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:I.ZodPipeline})}},tt=class extends E{_parse(e){let t=this._def.innerType._parse(e),n=e=>(b(e)&&(e.value=Object.freeze(e.value)),e);return x(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};tt.create=(e,t)=>new tt({innerType:e,typeName:I.ZodReadonly,...T(t)}),A.lazycreate;var I;(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`})(I||={});var L=Ce.create;Te.create,Qe.create,Ee.create;var nt=De.create;Oe.create,ke.create,Ae.create,je.create,Me.create;var rt=Ne.create;O.create,Pe.create,Fe.create;var it=A.create;A.strictCreate,Ie.create,Le.create,ze.create,M.create;var at=Be.create;Ve.create,He.create,Ue.create,We.create,Ge.create;var ot=qe.create;Je.create,Ye.create,N.create,P.create,F.create,N.createWithPreprocess,et.create;var st=it({mode:ot([`light`,`dark`,`system`]).optional(),accentColor:L().optional(),fontFamily:L().optional(),borderRadius:L().optional()}),ct=it({externalId:L().optional(),authId:L().optional(),name:L().optional(),email:L().optional()}),lt=it({agentId:L().min(1,`agentId is required`),apiBaseUrl:L().url(`apiBaseUrl must be a valid URL`),tenantId:L().optional(),user:ct.optional(),sessionId:L().optional(),mode:ot([`floating`,`inline`]).optional(),title:L().optional(),subtitle:L().optional(),description:L().optional(),avatarUrl:L().optional(),streaming:nt().optional(),preview:nt().optional(),skipServerConfigFetch:nt().optional(),configChannel:ot([`draft`,`published`]).optional(),metadata:at(rt()).optional(),theme:st.optional()}),ut=lt.omit({agentId:!0,apiBaseUrl:!0}).partial(),R={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 dt(e,t){lt.parse(e);let n,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);let i=r?ut.passthrough().safeParse(r).data:void 0,a=i?ft(i,e):e,o={mode:a.theme?.mode??n?.mode??R.theme.mode,accentColor:a.theme?.accentColor??n?.accentColor??R.theme.accentColor,fontFamily:a.theme?.fontFamily??n?.fontFamily??R.theme.fontFamily,borderRadius:a.theme?.borderRadius??n?.borderRadius??R.theme.borderRadius};return{agentId:a.agentId,apiBaseUrl:a.apiBaseUrl.replace(/\/$/,``),tenantId:a.tenantId,user:{externalId:a.user?.externalId,authId:a.user?.authId,name:a.user?.name,email:a.user?.email},sessionId:a.sessionId,mode:a.mode??R.mode,title:a.title??R.title,subtitle:a.subtitle,description:a.description,suggestedQuestions:(()=>{let e=i?.suggestedQuestions;return Array.isArray(e)?e:[]})(),avatarUrl:a.avatarUrl,streaming:a.streaming??R.streaming,preview:a.preview===!0,skipServerConfigFetch:a.skipServerConfigFetch===!0,configChannel:a.configChannel,metadata:a.metadata??{},theme:o,photoSendingEnabled:i?.photoSendingEnabled===!0,fileUploadEnabled:i?.fileUploadEnabled===!0,attachmentMaxCount:(()=>{let e=i?.attachmentMaxCount;return typeof e==`number`&&Number.isFinite(e)?e:5})(),attachmentMaxFileSizeMb:(()=>{let e=i?.attachmentMaxFileSizeMb;return typeof e==`number`&&Number.isFinite(e)?e:1})(),turnstileSiteKey:(()=>{let e=i?.turnstileSiteKey;return typeof e==`string`&&e.length>0?e:void 0})()}}function ft(e,t){let n={...e};for(let e of Object.keys(t)){let r=t[e];r!=null&&(typeof r==`object`&&!Array.isArray(r)&&n[e]!==null&&typeof n[e]==`object`?n[e]=ft(n[e],r):n[e]=r)}return n}var pt=function(){return pt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},pt.apply(this,arguments)};function z(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function B(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function mt(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var ht=`4.6.2`;function gt(e,t){return new Promise(function(n){return setTimeout(n,e,t)})}function _t(){return new Promise(function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})}function vt(e,t){t===void 0&&(t=1/0);var n=window.requestIdleCallback;return n?new Promise(function(e){return n.call(window,function(){return e()},{timeout:t})}):gt(Math.min(e,t))}function yt(e){return!!e&&typeof e.then==`function`}function bt(e,t){try{var n=e();yt(n)?n.then(function(e){return t(!0,e)},function(e){return t(!1,e)}):t(!0,n)}catch(e){t(!1,e)}}function xt(e,t,n){return n===void 0&&(n=16),z(this,void 0,void 0,function(){var r,i,a,o;return B(this,function(s){switch(s.label){case 0:r=Array(e.length),i=Date.now(),a=0,s.label=1;case 1:return a<e.length?(r[a]=t(e[a],a),o=Date.now(),o>=i+n?(i=o,[4,_t()]):[3,3]):[3,4];case 2:s.sent(),s.label=3;case 3:return++a,[3,1];case 4:return[2,r]}})})}function St(e){return e.then(void 0,function(){}),e}function Ct(e,t){for(var n=0,r=e.length;n<r;++n)if(e[n]===t)return!0;return!1}function wt(e,t){return!Ct(e,t)}function Tt(e){return parseInt(e)}function V(e){return parseFloat(e)}function H(e,t){return typeof e==`number`&&isNaN(e)?t:e}function U(e){return e.reduce(function(e,t){return e+ +!!t},0)}function Et(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 Dt(e){for(var t=`Unexpected syntax '${e}'`,n=/^\s*([a-z-]*)(.*)$/i.exec(e),r=n[1]||void 0,i={},a=/([.:#][\w-]+|\[.+?\])/gi,o=function(e,t){i[e]=i[e]||[],i[e].push(t)};;){var s=a.exec(n[2]);if(!s)break;var c=s[0];switch(c[0]){case`.`:o(`class`,c.slice(1));break;case`#`:o(`id`,c.slice(1));break;case`[`:var l=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(c);if(l)o(l[1],l[4]??l[5]??``);else throw Error(t);break;default:throw Error(t)}}return[r,i]}function Ot(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 W(e,t){var n=e[0]>>>16,r=e[0]&65535,i=e[1]>>>16,a=e[1]&65535,o=t[0]>>>16,s=t[0]&65535,c=t[1]>>>16,l=t[1]&65535,u=0,d=0,f=0,p=0;p+=a+l,f+=p>>>16,p&=65535,f+=i+c,d+=f>>>16,f&=65535,d+=r+s,u+=d>>>16,d&=65535,u+=n+o,u&=65535,e[0]=u<<16|d,e[1]=f<<16|p}function G(e,t){var n=e[0]>>>16,r=e[0]&65535,i=e[1]>>>16,a=e[1]&65535,o=t[0]>>>16,s=t[0]&65535,c=t[1]>>>16,l=t[1]&65535,u=0,d=0,f=0,p=0;p+=a*l,f+=p>>>16,p&=65535,f+=i*l,d+=f>>>16,f&=65535,f+=a*c,d+=f>>>16,f&=65535,d+=r*l,u+=d>>>16,d&=65535,d+=i*c,u+=d>>>16,d&=65535,d+=a*s,u+=d>>>16,d&=65535,u+=n*l+r*c+i*s+a*o,u&=65535,e[0]=u<<16|d,e[1]=f<<16|p}function K(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 q(e,t){t%=64,t!==0&&(t<32?(e[0]=e[1]>>>32-t,e[1]<<=t):(e[0]=e[1]<<t-32,e[1]=0))}function J(e,t){e[0]^=t[0],e[1]^=t[1]}var kt=[4283543511,3981806797],At=[3301882366,444984403];function jt(e){var t=[0,e[0]>>>1];J(e,t),G(e,kt),t[1]=e[0]>>>1,J(e,t),G(e,At),t[1]=e[0]>>>1,J(e,t)}var Mt=[2277735313,289559509],Nt=[1291169091,658871167],Pt=[0,5],Ft=[0,1390208809],It=[0,944331445];function Lt(e,t){var n=Ot(e);t||=0;var r=[0,n.length],i=r[1]%16,a=r[1]-i,o=[0,t],s=[0,t],c=[0,0],l=[0,0],u;for(u=0;u<a;u+=16)c[0]=n[u+4]|n[u+5]<<8|n[u+6]<<16|n[u+7]<<24,c[1]=n[u]|n[u+1]<<8|n[u+2]<<16|n[u+3]<<24,l[0]=n[u+12]|n[u+13]<<8|n[u+14]<<16|n[u+15]<<24,l[1]=n[u+8]|n[u+9]<<8|n[u+10]<<16|n[u+11]<<24,G(c,Mt),K(c,31),G(c,Nt),J(o,c),K(o,27),W(o,s),G(o,Pt),W(o,Ft),G(l,Nt),K(l,33),G(l,Mt),J(s,l),K(s,31),W(s,o),G(s,Pt),W(s,It);c[0]=0,c[1]=0,l[0]=0,l[1]=0;var d=[0,0];switch(i){case 15:d[1]=n[u+14],q(d,48),J(l,d);case 14:d[1]=n[u+13],q(d,40),J(l,d);case 13:d[1]=n[u+12],q(d,32),J(l,d);case 12:d[1]=n[u+11],q(d,24),J(l,d);case 11:d[1]=n[u+10],q(d,16),J(l,d);case 10:d[1]=n[u+9],q(d,8),J(l,d);case 9:d[1]=n[u+8],J(l,d),G(l,Nt),K(l,33),G(l,Mt),J(s,l);case 8:d[1]=n[u+7],q(d,56),J(c,d);case 7:d[1]=n[u+6],q(d,48),J(c,d);case 6:d[1]=n[u+5],q(d,40),J(c,d);case 5:d[1]=n[u+4],q(d,32),J(c,d);case 4:d[1]=n[u+3],q(d,24),J(c,d);case 3:d[1]=n[u+2],q(d,16),J(c,d);case 2:d[1]=n[u+1],q(d,8),J(c,d);case 1:d[1]=n[u],J(c,d),G(c,Mt),K(c,31),G(c,Nt),J(o,c)}return J(o,r),J(s,r),W(o,s),W(s,o),jt(o),jt(s),W(o,s),W(s,o),(`00000000`+(o[0]>>>0).toString(16)).slice(-8)+(`00000000`+(o[1]>>>0).toString(16)).slice(-8)+(`00000000`+(s[0]>>>0).toString(16)).slice(-8)+(`00000000`+(s[1]>>>0).toString(16)).slice(-8)}function Rt(e){return pt({name:e.name,message:e.message,stack:e.stack?.split(`
|
|
2
|
-
`)},e)}function zt(e){return/^function\s.*?\{\s*\[native code]\s*}$/.test(String(e))}function Bt(e){return typeof e!=`function`}function Vt(e,t){var n=St(new Promise(function(n){var r=Date.now();bt(e.bind(null,t),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=Date.now()-r;if(!e[0])return n(function(){return{error:e[1],duration:i}});var a=e[1];if(Bt(a))return n(function(){return{value:a,duration:i}});n(function(){return new Promise(function(e){var t=Date.now();bt(a,function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var a=i+Date.now()-t;if(!n[0])return e({error:n[1],duration:a});e({value:n[1],duration:a})})})})})}));return function(){return n.then(function(e){return e()})}}function Ht(e,t,n,r){var i=Object.keys(e).filter(function(e){return wt(n,e)}),a=St(xt(i,function(n){return Vt(e[n],t)},r));return function(){return z(this,void 0,void 0,function(){var e,t,n,o,s;return B(this,function(c){switch(c.label){case 0:return[4,a];case 1:return e=c.sent(),[4,xt(e,function(e){return St(e())},r)];case 2:return t=c.sent(),[4,Promise.all(t)];case 3:for(n=c.sent(),o={},s=0;s<i.length;++s)o[i[s]]=n[s];return[2,o]}})})}}function Ut(){var e=window,t=navigator;return U([`MSCSSMatrix`in e,`msSetImmediate`in e,`msIndexedDB`in e,`msMaxTouchPoints`in t,`msPointerEnabled`in t])>=4}function Wt(){var e=window,t=navigator;return U([`msWriteProfilerMark`in e,`MSStream`in e,`msLaunchUri`in t,`msSaveBlob`in t])>=3&&!Ut()}function Gt(){var e=window,t=navigator;return U([`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 U([`ApplePayError`in e,`CSSPrimitiveValue`in e,`Counter`in e,t.vendor.indexOf(`Apple`)===0,`RGBColor`in e,`WebKitMediaKeys`in e])>=4}function Kt(){var e=window,t=e.HTMLElement,n=e.Document;return U([`safari`in e,!(`ongestureend`in e),!(`TouchEvent`in e),!(`orientation`in e),t&&!(`autocapitalize`in t.prototype),n&&`pointerLockElement`in n.prototype])>=4}function qt(){var e=window;return zt(e.print)&&String(e.browser)===`[object WebPageNamespace]`}function Jt(){var e=window;return U([`buildID`in navigator,`MozAppearance`in(document.documentElement?.style??{}),`onmozfullscreenchange`in e,`mozInnerScreenX`in e,`CSSMozDocumentRule`in e,`CanvasCaptureMediaStream`in e])>=4}function Yt(){var e=window;return U([!(`MediaSettingsRange`in e),`RTCEncodedAudioFrame`in e,``+e.Intl==`[object Intl]`,``+e.Reflect==`[object Reflect]`])>=3}function Xt(){var e=window,t=e.URLPattern;return U([`union`in Set.prototype,`Iterator`in e,t&&`hasRegExpGroups`in t.prototype,`RGB8`in WebGLRenderingContext.prototype])>=3}function Zt(){var e=window;return U([`DOMRectList`in e,`RTCPeerConnectionIceEvent`in e,`SVGGeometryElement`in e,`ontransitioncancel`in e])>=3}function Qt(){var e=window,t=navigator,n=e.CSS,r=e.HTMLButtonElement;return U([!(`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 $t(){if(navigator.platform===`iPad`)return!0;var e=screen,t=e.width/e.height;return U([`MediaSource`in window,!!Element.prototype.webkitRequestFullscreen,t>.65&&t<1.53])>=2}function en(){var e=document;return e.fullscreenElement||e.msFullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement||null}function tn(){var e=document;return(e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen).call(e)}function nn(){var e=Gt(),t=Jt(),n=window,r=navigator,i=`connection`;return e?U([!(`SharedWorker`in n),r[i]&&`ontypechange`in r[i],!(`sinkId`in new Audio)])>=2:t?U([`onorientationchange`in n,`orientation`in n,/android/i.test(r.appVersion)])>=2:!1}function rn(){var e=navigator,t=window,n=Audio.prototype,r=t.visualViewport;return U([`srLatency`in n,`srChannelCount`in n,`devicePosture`in e,r&&`segments`in r,`getTextInformation`in Image.prototype])>=3}function an(){return cn()?-4:on()}function on(){var e=window,t=e.OfflineAudioContext||e.webkitOfflineAudioContext;if(!t)return-2;if(sn())return-1;var n=4500,r=new t(1,5e3,44100),i=r.createOscillator();i.type=`triangle`,i.frequency.value=1e4;var a=r.createDynamicsCompressor();a.threshold.value=-50,a.knee.value=40,a.ratio.value=12,a.attack.value=0,a.release.value=.25,i.connect(a),a.connect(r.destination),i.start(0);var o=ln(r),s=o[0],c=o[1],l=St(s.then(function(e){return un(e.getChannelData(0).subarray(n))},function(e){if(e.name===`timeout`||e.name===`suspended`)return-3;throw e}));return function(){return c(),l}}function sn(){return Y()&&!Kt()&&!Zt()}function cn(){return Y()&&Qt()&&qt()||Gt()&&rn()&&Xt()}function ln(e){var t=3,n=500,r=500,i=5e3,a=function(){};return[new Promise(function(o,s){var c=!1,l=0,u=0;e.oncomplete=function(e){return o(e.renderedBuffer)};var d=function(){setTimeout(function(){return s(dn(`timeout`))},Math.min(r,u+i-Date.now()))},f=function(){try{var r=e.startRendering();switch(yt(r)&&St(r),e.state){case`running`:u=Date.now(),c&&d();break;case`suspended`:document.hidden||l++,c&&l>=t?s(dn(`suspended`)):setTimeout(f,n);break}}catch(e){s(e)}};f(),a=function(){c||(c=!0,u>0&&d())}}),a]}function un(e){for(var t=0,n=0;n<e.length;++n)t+=Math.abs(e[n]);return t}function dn(e){var t=Error(e);return t.name=e,t}function fn(e,t,n){var r;return n===void 0&&(n=50),z(this,void 0,void 0,function(){var i,a;return B(this,function(o){switch(o.label){case 0:i=document,o.label=1;case 1:return i.body?[3,3]:[4,gt(n)];case 2:return o.sent(),[3,1];case 3:a=i.createElement(`iframe`),o.label=4;case 4:return o.trys.push([4,,10,11]),[4,new Promise(function(e,n){var r=!1,o=function(){r=!0,e()};a.onload=o,a.onerror=function(e){r=!0,n(e)};var s=a.style;s.setProperty(`display`,`block`,`important`),s.position=`absolute`,s.top=`0`,s.left=`0`,s.visibility=`hidden`,t&&`srcdoc`in a?a.srcdoc=t:a.src=`about:blank`,i.body.appendChild(a);var c=function(){r||(a.contentWindow?.document?.readyState===`complete`?o():setTimeout(c,10))};c()})];case 5:o.sent(),o.label=6;case 6:return a.contentWindow?.document?.body?[3,8]:[4,gt(n)];case 7:return o.sent(),[3,6];case 8:return[4,e(a,a.contentWindow)];case 9:return[2,o.sent()];case 10:return(r=a.parentNode)==null||r.removeChild(a),[7];case 11:return[2]}})})}function pn(e){for(var t=Dt(e),n=t[0],r=t[1],i=document.createElement(n??`div`),a=0,o=Object.keys(r);a<o.length;a++){var s=o[a],c=r[s].join(` `);s===`style`?mn(i.style,c):i.setAttribute(s,c)}return i}function mn(e,t){for(var n=0,r=t.split(`;`);n<r.length;n++){var i=r[n],a=/^\s*([\w-]+)\s*:\s*(.+?)(\s*!([\w-]+))?\s*$/.exec(i);if(a){var o=a[1],s=a[2],c=a[4];e.setProperty(o,s,c||``)}}}function hn(){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(e){if(e instanceof Error&&e.name===`SecurityError`)return!0;throw e}e=t}}var gn=`mmMwWLliI0O&1`,_n=`48px`,vn=[`monospace`,`sans-serif`,`serif`],yn=`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`.split(`.`);function bn(){var e=this;return fn(function(t,n){var r=n.document;return z(e,void 0,void 0,function(){var e,t,n,i,a,o,s,c,l,u,d,f;return B(this,function(p){for(e=r.body,e.style.fontSize=_n,t=r.createElement(`div`),t.style.setProperty(`visibility`,`hidden`,`important`),n={},i={},a=function(e){var n=r.createElement(`span`),i=n.style;return i.position=`absolute`,i.top=`0`,i.left=`0`,i.fontFamily=e,n.textContent=gn,t.appendChild(n),n},o=function(e,t){return a(`'${e}',${t}`)},s=function(){return vn.map(a)},c=function(){for(var e={},t=function(t){e[t]=vn.map(function(e){return o(t,e)})},n=0,r=yn;n<r.length;n++){var i=r[n];t(i)}return e},l=function(e){return vn.some(function(t,r){return e[r].offsetWidth!==n[t]||e[r].offsetHeight!==i[t]})},u=s(),d=c(),e.appendChild(t),f=0;f<vn.length;f++)n[vn[f]]=u[f].offsetWidth,i[vn[f]]=u[f].offsetHeight;return[2,yn.filter(function(e){return l(d[e])})]})})})}function xn(){var e=navigator.plugins;if(e){for(var t=[],n=0;n<e.length;++n){var r=e[n];if(r){for(var i=[],a=0;a<r.length;++a){var o=r[a];i.push({type:o.type,suffixes:o.suffixes})}t.push({name:r.name,description:r.description,mimeTypes:i})}}return t}}function Sn(){return Cn(jn())}function Cn(e){var t,n=!1,r,i,a=wn(),o=a[0],s=a[1];return Tn(o,s)?(n=En(s),e?r=i=`skipped`:(t=Dn(o,s),r=t[0],i=t[1])):r=i=`unsupported`,{winding:n,geometry:r,text:i}}function wn(){var e=document.createElement(`canvas`);return e.width=1,e.height=1,[e,e.getContext(`2d`)]}function Tn(e,t){return!!(t&&e.toDataURL)}function En(e){return e.rect(0,0,10,10),e.rect(2,2,6,6),!e.isPointInPath(5,5,`evenodd`)}function Dn(e,t){On(e,t);var n=An(e);return n===An(e)?(kn(e,t),[An(e),n]):[`unstable`,`unstable`]}function On(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 ${String.fromCharCode(55357,56835)}`;t.fillText(n,2,15),t.fillStyle=`rgba(102, 204, 0, 0.2)`,t.font=`18pt Arial`,t.fillText(n,4,45)}function kn(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 i=r[n],a=i[0],o=i[1],s=i[2];t.fillStyle=a,t.beginPath(),t.arc(o,s,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 An(e){return e.toDataURL()}function jn(){return Y()&&Qt()&&qt()}function Mn(){var e=navigator,t=0,n;e.maxTouchPoints===void 0?e.msMaxTouchPoints!==void 0&&(t=e.msMaxTouchPoints):t=Tt(e.maxTouchPoints);try{document.createEvent(`TouchEvent`),n=!0}catch{n=!1}var r=`ontouchstart`in window;return{maxTouchPoints:t,touchEvent:n,touchStart:r}}function Nn(){return navigator.oscpu}function Pn(){var e=navigator,t=[],n=e.language||e.userLanguage||e.browserLanguage||e.systemLanguage;if(n!==void 0&&t.push([n]),Array.isArray(e.languages))Gt()&&Yt()||t.push(e.languages);else if(typeof e.languages==`string`){var r=e.languages;r&&t.push(r.split(`,`))}return t}function Fn(){return window.screen.colorDepth}function In(){return H(V(navigator.deviceMemory),void 0)}function Ln(){if(!(Y()&&Qt()&&qt()))return Rn()}function Rn(){var e=screen,t=function(e){return H(Tt(e),null)},n=[t(e.width),t(e.height)];return n.sort().reverse(),n}var zn=2500,Bn=10,Vn,Hn;function Un(){if(Hn===void 0){var e=function(){var t=Kn();qn(t)?Hn=setTimeout(e,zn):(Vn=t,Hn=void 0)};e()}}function Wn(){var e=this;return Un(),function(){return z(e,void 0,void 0,function(){var e;return B(this,function(t){switch(t.label){case 0:return e=Kn(),qn(e)?Vn?[2,mt([],Vn,!0)]:en()?[4,tn()]:[3,2]:[3,2];case 1:t.sent(),e=Kn(),t.label=2;case 2:return qn(e)||(Vn=e),[2,e]}})})}}function Gn(){var e=this;if(Y()&&Qt()&&qt())return function(){return Promise.resolve(void 0)};var t=Wn();return function(){return z(e,void 0,void 0,function(){var e,n;return B(this,function(r){switch(r.label){case 0:return[4,t()];case 1:return e=r.sent(),n=function(e){return e===null?null:Et(e,Bn)},[2,[n(e[0]),n(e[1]),n(e[2]),n(e[3])]]}})})}}function Kn(){var e=screen;return[H(V(e.availTop),null),H(V(e.width)-V(e.availWidth)-H(V(e.availLeft),0),null),H(V(e.height)-V(e.availHeight)-H(V(e.availTop),0),null),H(V(e.availLeft),null)]}function qn(e){for(var t=0;t<4;++t)if(e[t])return!1;return!0}function Jn(){return H(Tt(navigator.hardwareConcurrency),void 0)}function Yn(){var e=window.Intl?.DateTimeFormat;if(e){var t=new e().resolvedOptions().timeZone;if(t)return t}var n=-Xn();return`UTC${n>=0?`+`:``}${n}`}function Xn(){var e=new Date().getFullYear();return Math.max(V(new Date(e,0,1).getTimezoneOffset()),V(new Date(e,6,1).getTimezoneOffset()))}function Zn(){try{return!!window.sessionStorage}catch{return!0}}function Qn(){try{return!!window.localStorage}catch{return!0}}function $n(){if(!(Ut()||Wt()))try{return!!window.indexedDB}catch{return!0}}function er(){return!!window.openDatabase}function tr(){return navigator.cpuClass}function nr(){var e=navigator.platform;return e===`MacIntel`&&Y()&&!Kt()?$t()?`iPad`:`iPhone`:e}function rr(){return navigator.vendor||``}function ir(){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],i=window[r];i&&typeof i==`object`&&e.push(r)}return e.sort()}function ar(){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 or(){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 sr(e){var t=(e===void 0?{}:e).debug;return z(this,void 0,void 0,function(){var e,n,r,i,a,o;return B(this,function(s){switch(s.label){case 0:return cr()?(e=or(),n=Object.keys(e),r=(o=[]).concat.apply(o,n.map(function(t){return e[t]})),[4,lr(r)]):[2,void 0];case 1:return i=s.sent(),t&&dr(e,i),a=n.filter(function(t){var n=e[t];return U(n.map(function(e){return i[e]}))>n.length*.6}),a.sort(),[2,a]}})})}function cr(){return Y()||nn()}function lr(e){var t;return z(this,void 0,void 0,function(){var n,r,i,a,o,s,c,o;return B(this,function(l){switch(l.label){case 0:for(n=document,r=n.createElement(`div`),i=Array(e.length),a={},ur(r),o=0;o<e.length;++o)s=pn(e[o]),s.tagName===`DIALOG`&&s.show(),c=n.createElement(`div`),ur(c),c.appendChild(s),r.appendChild(c),i[o]=s;l.label=1;case 1:return n.body?[3,3]:[4,gt(50)];case 2:return l.sent(),[3,1];case 3:n.body.appendChild(r);try{for(o=0;o<e.length;++o)i[o].offsetParent||(a[e[o]]=!0)}finally{(t=r.parentNode)==null||t.removeChild(r)}return[2,a]}})})}function ur(e){e.style.setProperty(`visibility`,`hidden`,`important`),e.style.setProperty(`display`,`block`,`important`)}function dr(e,t){for(var n="DOM blockers debug:\n```",r=0,i=Object.keys(e);r<i.length;r++){var a=i[r];n+=`
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("preact/compat/client"),t=require("preact/compat"),n=require("preact/jsx-runtime");var r;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(r||={});var i;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(i||={});var a=r.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),o=e=>{switch(typeof e){case`undefined`:return a.undefined;case`string`:return a.string;case`number`:return Number.isNaN(e)?a.nan:a.number;case`boolean`:return a.boolean;case`function`:return a.function;case`bigint`:return a.bigint;case`symbol`:return a.symbol;case`object`:return Array.isArray(e)?a.array:e===null?a.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?a.promise:typeof Map<`u`&&e instanceof Map?a.map:typeof Set<`u`&&e instanceof Set?a.set:typeof Date<`u`&&e instanceof Date?a.date:a.object;default:return a.unknown}},s=r.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`]),c=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,r.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};c.create=e=>new c(e);var l=(e,t)=>{let n;switch(e.code){case s.invalid_type:n=e.received===a.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case s.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,r.jsonStringifyReplacer)}`;break;case s.unrecognized_keys:n=`Unrecognized key(s) in object: ${r.joinValues(e.keys,`, `)}`;break;case s.invalid_union:n=`Invalid input`;break;case s.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${r.joinValues(e.options)}`;break;case s.invalid_enum_value:n=`Invalid enum value. Expected ${r.joinValues(e.options)}, received '${e.received}'`;break;case s.invalid_arguments:n=`Invalid function arguments`;break;case s.invalid_return_type:n=`Invalid function return type`;break;case s.invalid_date:n=`Invalid date`;break;case s.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}"`:r.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case s.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case s.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case s.custom:n=`Invalid input`;break;case s.invalid_intersection_types:n=`Intersection results could not be merged`;break;case s.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case s.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,r.assertNever(e)}return{message:n}},u=l;function d(){return u}var f=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function p(e,t){let n=d(),r=f({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===l?void 0:l].filter(e=>!!e)});e.common.issues.push(r)}var m=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return h;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return h;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},h=Object.freeze({status:`aborted`}),g=e=>({status:`dirty`,value:e}),_=e=>({status:`valid`,value:e}),v=e=>e.status===`aborted`,y=e=>e.status===`dirty`,b=e=>e.status===`valid`,x=e=>typeof Promise<`u`&&e instanceof Promise,S;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(S||={});var C=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}},w=(e,t)=>{if(b(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new c(e.common.issues);return this._error=t,this._error}}};function T(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var E=class{get description(){return this._def.description}_getType(e){return o(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:o(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new m,ctx:{common:e.parent.common,data:e.data,parsedType:o(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(x(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:o(e)};return w(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:o(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return b(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>b(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:o(e)},r=this._parse({data:e,path:n.path,parent:n});return w(n,await(x(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:s.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!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 F({schema:this,typeName:R.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:e=>this[`~validate`](e)}}optional(){return I.create(this,this._def)}nullable(){return L.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Me.create(this)}promise(){return qe.create(this,this._def)}or(e){return Pe.create([this,e],this._def)}and(e){return Le.create(this,e,this._def)}transform(e){return new F({...T(this._def),schema:this,typeName:R.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new Je({...T(this._def),innerType:this,defaultValue:t,typeName:R.ZodDefault})}brand(){return new Ze({typeName:R.ZodBranded,type:this,...T(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new Ye({...T(this._def),innerType:this,catchValue:t,typeName:R.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Qe.create(this,e)}readonly(){return $e.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},D=/^c[^\s-]{8,}$/i,O=/^[0-9a-z]+$/,ee=/^[0-9A-HJKMNP-TV-Z]{26}$/i,k=/^[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,te=/^[a-z0-9_-]{21}$/i,ne=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,re=/^[-+]?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)?)??$/,ie=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ae=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,oe,se=/^(?:(?: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])$/,ce=/^(?:(?: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])$/,le=/^(([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]))$/,ue=/^(([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])$/,de=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,fe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,pe=`((\\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])))`,me=RegExp(`^${pe}$`);function he(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function ge(e){return RegExp(`^${he(e)}$`)}function _e(e){let t=`${pe}T${he(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function ve(e,t){return!((t!==`v4`&&t||!se.test(e))&&(t!==`v6`&&t||!le.test(e)))}function ye(e,t){if(!ne.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function be(e,t){return!((t!==`v4`&&t||!ce.test(e))&&(t!==`v6`&&t||!ue.test(e)))}var A=class e extends E{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==a.string){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.string,received:t.parsedType}),h}let t=new m,n;for(let i of this._def.checks)if(i.kind===`min`)e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),p(n,{code:s.too_small,minimum:i.value,type:`string`,inclusive:!0,exact:!1,message:i.message}),t.dirty());else if(i.kind===`max`)e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),p(n,{code:s.too_big,maximum:i.value,type:`string`,inclusive:!0,exact:!1,message:i.message}),t.dirty());else if(i.kind===`length`){let r=e.data.length>i.value,a=e.data.length<i.value;(r||a)&&(n=this._getOrReturnCtx(e,n),r?p(n,{code:s.too_big,maximum:i.value,type:`string`,inclusive:!0,exact:!0,message:i.message}):a&&p(n,{code:s.too_small,minimum:i.value,type:`string`,inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if(i.kind===`email`)ie.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`email`,code:s.invalid_string,message:i.message}),t.dirty());else if(i.kind===`emoji`)oe||=new RegExp(ae,`u`),oe.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`emoji`,code:s.invalid_string,message:i.message}),t.dirty());else if(i.kind===`uuid`)k.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`uuid`,code:s.invalid_string,message:i.message}),t.dirty());else if(i.kind===`nanoid`)te.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`nanoid`,code:s.invalid_string,message:i.message}),t.dirty());else if(i.kind===`cuid`)D.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`cuid`,code:s.invalid_string,message:i.message}),t.dirty());else if(i.kind===`cuid2`)O.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`cuid2`,code:s.invalid_string,message:i.message}),t.dirty());else if(i.kind===`ulid`)ee.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`ulid`,code:s.invalid_string,message:i.message}),t.dirty());else if(i.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),p(n,{validation:`url`,code:s.invalid_string,message:i.message}),t.dirty()}else i.kind===`regex`?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`regex`,code:s.invalid_string,message:i.message}),t.dirty())):i.kind===`trim`?e.data=e.data.trim():i.kind===`includes`?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),p(n,{code:s.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),t.dirty()):i.kind===`toLowerCase`?e.data=e.data.toLowerCase():i.kind===`toUpperCase`?e.data=e.data.toUpperCase():i.kind===`startsWith`?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),p(n,{code:s.invalid_string,validation:{startsWith:i.value},message:i.message}),t.dirty()):i.kind===`endsWith`?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),p(n,{code:s.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty()):i.kind===`datetime`?_e(i).test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:s.invalid_string,validation:`datetime`,message:i.message}),t.dirty()):i.kind===`date`?me.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:s.invalid_string,validation:`date`,message:i.message}),t.dirty()):i.kind===`time`?ge(i).test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:s.invalid_string,validation:`time`,message:i.message}),t.dirty()):i.kind===`duration`?re.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`duration`,code:s.invalid_string,message:i.message}),t.dirty()):i.kind===`ip`?ve(e.data,i.version)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`ip`,code:s.invalid_string,message:i.message}),t.dirty()):i.kind===`jwt`?ye(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`jwt`,code:s.invalid_string,message:i.message}),t.dirty()):i.kind===`cidr`?be(e.data,i.version)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`cidr`,code:s.invalid_string,message:i.message}),t.dirty()):i.kind===`base64`?de.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`base64`,code:s.invalid_string,message:i.message}),t.dirty()):i.kind===`base64url`?fe.test(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{validation:`base64url`,code:s.invalid_string,message:i.message}),t.dirty()):r.assertNever(i);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:s.invalid_string,...S.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...S.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...S.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...S.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...S.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...S.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...S.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...S.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...S.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...S.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...S.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...S.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...S.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...S.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...S.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...S.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...S.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...S.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...S.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...S.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...S.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...S.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...S.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...S.errToObj(t)})}nonempty(e){return this.min(1,S.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};A.create=e=>new A({checks:[],typeName:R.ZodString,coerce:e?.coerce??!1,...T(e)});function xe(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Se=class e extends E{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==a.number){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.number,received:t.parsedType}),h}let t,n=new m;for(let i of this._def.checks)i.kind===`int`?r.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),p(t,{code:s.invalid_type,expected:`integer`,received:`float`,message:i.message}),n.dirty()):i.kind===`min`?(i.inclusive?e.data<i.value:e.data<=i.value)&&(t=this._getOrReturnCtx(e,t),p(t,{code:s.too_small,minimum:i.value,type:`number`,inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind===`max`?(i.inclusive?e.data>i.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),p(t,{code:s.too_big,maximum:i.value,type:`number`,inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind===`multipleOf`?xe(e.data,i.value)!==0&&(t=this._getOrReturnCtx(e,t),p(t,{code:s.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),p(t,{code:s.not_finite,message:i.message}),n.dirty()):r.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,S.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,S.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,S.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,S.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:S.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:S.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:S.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:S.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:S.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:S.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:S.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&r.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};Se.create=e=>new Se({checks:[],typeName:R.ZodNumber,coerce:e?.coerce||!1,...T(e)});var Ce=class e extends E{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==a.bigint)return this._getInvalidInput(e);let t,n=new m;for(let i of this._def.checks)i.kind===`min`?(i.inclusive?e.data<i.value:e.data<=i.value)&&(t=this._getOrReturnCtx(e,t),p(t,{code:s.too_small,type:`bigint`,minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind===`max`?(i.inclusive?e.data>i.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),p(t,{code:s.too_big,type:`bigint`,maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind===`multipleOf`?e.data%i.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),p(t,{code:s.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):r.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.bigint,received:t.parsedType}),h}gte(e,t){return this.setLimit(`min`,e,!0,S.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,S.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,S.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,S.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:S.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:S.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:S.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Ce.create=e=>new Ce({checks:[],typeName:R.ZodBigInt,coerce:e?.coerce??!1,...T(e)});var we=class extends E{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==a.boolean){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.boolean,received:t.parsedType}),h}return _(e.data)}};we.create=e=>new we({typeName:R.ZodBoolean,coerce:e?.coerce||!1,...T(e)});var Te=class e extends E{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==a.date){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.date,received:t.parsedType}),h}if(Number.isNaN(e.data.getTime()))return p(this._getOrReturnCtx(e),{code:s.invalid_date}),h;let t=new m,n;for(let i of this._def.checks)i.kind===`min`?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),p(n,{code:s.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:`date`}),t.dirty()):i.kind===`max`?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),p(n,{code:s.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:`date`}),t.dirty()):r.assertNever(i);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:S.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:S.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};Te.create=e=>new Te({checks:[],coerce:e?.coerce||!1,typeName:R.ZodDate,...T(e)});var Ee=class extends E{_parse(e){if(this._getType(e)!==a.symbol){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.symbol,received:t.parsedType}),h}return _(e.data)}};Ee.create=e=>new Ee({typeName:R.ZodSymbol,...T(e)});var De=class extends E{_parse(e){if(this._getType(e)!==a.undefined){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.undefined,received:t.parsedType}),h}return _(e.data)}};De.create=e=>new De({typeName:R.ZodUndefined,...T(e)});var Oe=class extends E{_parse(e){if(this._getType(e)!==a.null){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.null,received:t.parsedType}),h}return _(e.data)}};Oe.create=e=>new Oe({typeName:R.ZodNull,...T(e)});var ke=class extends E{constructor(){super(...arguments),this._any=!0}_parse(e){return _(e.data)}};ke.create=e=>new ke({typeName:R.ZodAny,...T(e)});var Ae=class extends E{constructor(){super(...arguments),this._unknown=!0}_parse(e){return _(e.data)}};Ae.create=e=>new Ae({typeName:R.ZodUnknown,...T(e)});var j=class extends E{_parse(e){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.never,received:t.parsedType}),h}};j.create=e=>new j({typeName:R.ZodNever,...T(e)});var je=class extends E{_parse(e){if(this._getType(e)!==a.undefined){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.void,received:t.parsedType}),h}return _(e.data)}};je.create=e=>new je({typeName:R.ZodVoid,...T(e)});var Me=class e extends E{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==a.array)return p(t,{code:s.invalid_type,expected:a.array,received:t.parsedType}),h;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(p(t,{code:e?s.too_big:s.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(p(t,{code:s.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(p(t,{code:s.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new C(t,e,t.path,n)))).then(e=>m.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new C(t,e,t.path,n)));return m.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:S.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:S.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:S.toString(n)}})}nonempty(e){return this.min(1,e)}};Me.create=(e,t)=>new Me({type:e,minLength:null,maxLength:null,exactLength:null,typeName:R.ZodArray,...T(t)});function Ne(e){if(e instanceof M){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=I.create(Ne(r))}return new M({...e._def,shape:()=>t})}return e instanceof Me?new Me({...e._def,type:Ne(e.element)}):e instanceof I?I.create(Ne(e.unwrap())):e instanceof L?L.create(Ne(e.unwrap())):e instanceof P?P.create(e.items.map(e=>Ne(e))):e}var M=class e extends E{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=r.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==a.object){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.object,received:t.parsedType}),h}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof j&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||o.push(e);let c=[];for(let e of i){let t=r[e],i=n.data[e];c.push({key:{status:`valid`,value:e},value:t._parse(new C(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof j){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of o)c.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)o.length>0&&(p(n,{code:s.unrecognized_keys,keys:o}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of o){let r=n.data[t];c.push({key:{status:`valid`,value:t},value:e._parse(new C(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of c){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>m.mergeObjectSync(t,e)):m.mergeObjectSync(t,c)}get shape(){return this._def.shape()}strict(t){return S.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:S.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:R.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of r.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of r.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return Ne(this)}partial(t){let n={};for(let e of r.objectKeys(this.shape)){let r=this.shape[e];n[e]=t&&!t[e]?r:r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of r.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof I;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return We(r.objectKeys(this.shape))}};M.create=(e,t)=>new M({shape:()=>e,unknownKeys:`strip`,catchall:j.create(),typeName:R.ZodObject,...T(t)}),M.strictCreate=(e,t)=>new M({shape:()=>e,unknownKeys:`strict`,catchall:j.create(),typeName:R.ZodObject,...T(t)}),M.lazycreate=(e,t)=>new M({shape:e,unknownKeys:`strip`,catchall:j.create(),typeName:R.ZodObject,...T(t)});var Pe=class extends E{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new c(e.ctx.common.issues));return p(t,{code:s.invalid_union,unionErrors:n}),h}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new c(e));return p(t,{code:s.invalid_union,unionErrors:i}),h}}get options(){return this._def.options}};Pe.create=(e,t)=>new Pe({options:e,typeName:R.ZodUnion,...T(t)});var N=e=>e instanceof He?N(e.schema):e instanceof F?N(e.innerType()):e instanceof Ue?[e.value]:e instanceof Ge?e.options:e instanceof Ke?r.objectValues(e.enum):e instanceof Je?N(e._def.innerType):e instanceof De?[void 0]:e instanceof Oe?[null]:e instanceof I?[void 0,...N(e.unwrap())]:e instanceof L?[null,...N(e.unwrap())]:e instanceof Ze||e instanceof $e?N(e.unwrap()):e instanceof Ye?N(e._def.innerType):[],Fe=class e extends E{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==a.object)return p(t,{code:s.invalid_type,expected:a.object,received:t.parsedType}),h;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(p(t,{code:s.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),h)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=N(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:R.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...T(r)})}};function Ie(e,t){let n=o(e),i=o(t);if(e===t)return{valid:!0,data:e};if(n===a.object&&i===a.object){let n=r.objectKeys(t),i=r.objectKeys(e).filter(e=>n.indexOf(e)!==-1),a={...e,...t};for(let n of i){let r=Ie(e[n],t[n]);if(!r.valid)return{valid:!1};a[n]=r.data}return{valid:!0,data:a}}if(n===a.array&&i===a.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ie(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===a.date&&i===a.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Le=class extends E{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(v(e)||v(r))return h;let i=Ie(e.value,r.value);return i.valid?((y(e)||y(r))&&t.dirty(),{status:t.value,value:i.data}):(p(n,{code:s.invalid_intersection_types}),h)};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(([e,t])=>r(e,t)):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}))}};Le.create=(e,t,n)=>new Le({left:e,right:t,typeName:R.ZodIntersection,...T(n)});var P=class e extends E{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==a.array)return p(n,{code:s.invalid_type,expected:a.array,received:n.parsedType}),h;if(n.data.length<this._def.items.length)return p(n,{code:s.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),h;!this._def.rest&&n.data.length>this._def.items.length&&(p(n,{code:s.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new C(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>m.mergeArray(t,e)):m.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};P.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new P({items:e,typeName:R.ZodTuple,rest:null,...T(t)})};var Re=class e extends E{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==a.object)return p(n,{code:s.invalid_type,expected:a.object,received:n.parsedType}),h;let r=[],i=this._def.keyType,o=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new C(n,e,n.path,e)),value:o._parse(new C(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?m.mergeObjectAsync(t,r):m.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof E?new e({keyType:t,valueType:n,typeName:R.ZodRecord,...T(r)}):new e({keyType:A.create(),valueType:t,typeName:R.ZodRecord,...T(n)})}},ze=class extends E{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==a.map)return p(n,{code:s.invalid_type,expected:a.map,received:n.parsedType}),h;let r=this._def.keyType,i=this._def.valueType,o=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new C(n,e,n.path,[a,`key`])),value:i._parse(new C(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of o){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return h;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let n of o){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return h;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};ze.create=(e,t,n)=>new ze({valueType:t,keyType:e,typeName:R.ZodMap,...T(n)});var Be=class e extends E{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==a.set)return p(n,{code:s.invalid_type,expected:a.set,received:n.parsedType}),h;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(p(n,{code:s.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(p(n,{code:s.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function o(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return h;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let c=[...n.data.values()].map((e,t)=>i._parse(new C(n,e,n.path,t)));return n.common.async?Promise.all(c).then(e=>o(e)):o(c)}min(t,n){return new e({...this._def,minSize:{value:t,message:S.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:S.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Be.create=(e,t)=>new Be({valueType:e,minSize:null,maxSize:null,typeName:R.ZodSet,...T(t)});var Ve=class e extends E{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==a.function)return p(t,{code:s.invalid_type,expected:a.function,received:t.parsedType}),h;function n(e,n){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,d(),l].filter(e=>!!e),issueData:{code:s.invalid_arguments,argumentsError:n}})}function r(e,n){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,d(),l].filter(e=>!!e),issueData:{code:s.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof qe){let e=this;return _(async function(...t){let a=new c([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw a.addIssue(n(t,e)),a}),l=await Reflect.apply(o,this,s);return await e._def.returns._def.type.parseAsync(l,i).catch(e=>{throw a.addIssue(r(l,e)),a})})}{let e=this;return _(function(...t){let a=e._def.args.safeParse(t,i);if(!a.success)throw new c([n(t,a.error)]);let s=Reflect.apply(o,this,a.data),l=e._def.returns.safeParse(s,i);if(!l.success)throw new c([r(s,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:P.create(t).rest(Ae.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||P.create([]).rest(Ae.create()),returns:n||Ae.create(),typeName:R.ZodFunction,...T(r)})}},He=class extends E{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};He.create=(e,t)=>new He({getter:e,typeName:R.ZodLazy,...T(t)});var Ue=class extends E{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return p(t,{received:t.data,code:s.invalid_literal,expected:this._def.value}),h}return{status:`valid`,value:e.data}}get value(){return this._def.value}};Ue.create=(e,t)=>new Ue({value:e,typeName:R.ZodLiteral,...T(t)});function We(e,t){return new Ge({values:e,typeName:R.ZodEnum,...T(t)})}var Ge=class e extends E{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return p(t,{expected:r.joinValues(n),received:t.parsedType,code:s.invalid_type}),h}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return p(t,{received:t.data,code:s.invalid_enum_value,options:n}),h}return _(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};Ge.create=We;var Ke=class extends E{_parse(e){let t=r.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==a.string&&n.parsedType!==a.number){let e=r.objectValues(t);return p(n,{expected:r.joinValues(e),received:n.parsedType,code:s.invalid_type}),h}if(this._cache||=new Set(r.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=r.objectValues(t);return p(n,{received:n.data,code:s.invalid_enum_value,options:e}),h}return _(e.data)}get enum(){return this._def.values}};Ke.create=(e,t)=>new Ke({values:e,typeName:R.ZodNativeEnum,...T(t)});var qe=class extends E{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==a.promise&&t.common.async===!1?(p(t,{code:s.invalid_type,expected:a.promise,received:t.parsedType}),h):_((t.parsedType===a.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};qe.create=(e,t)=>new qe({type:e,typeName:R.ZodPromise,...T(t)});var F=class extends E{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===R.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:e=>{p(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type===`preprocess`){let e=i.transform(n.data,a);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return h;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?h:r.status===`dirty`||t.value===`dirty`?g(r.value):r});{if(t.value===`aborted`)return h;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?h:r.status===`dirty`||t.value===`dirty`?g(r.value):r}}if(i.type===`refinement`){let e=e=>{let t=i.refinement(e,a);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?h:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?h:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(i.type===`transform`){if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!b(e))return h;let r=i.transform(e.value,a);if(r instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:r}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>b(e)?Promise.resolve(i.transform(e.value,a)).then(e=>({status:t.value,value:e})):h)}r.assertNever(i)}};F.create=(e,t,n)=>new F({schema:e,typeName:R.ZodEffects,effect:t,...T(n)}),F.createWithPreprocess=(e,t,n)=>new F({schema:t,effect:{type:`preprocess`,transform:e},typeName:R.ZodEffects,...T(n)});var I=class extends E{_parse(e){return this._getType(e)===a.undefined?_(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};I.create=(e,t)=>new I({innerType:e,typeName:R.ZodOptional,...T(t)});var L=class extends E{_parse(e){return this._getType(e)===a.null?_(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};L.create=(e,t)=>new L({innerType:e,typeName:R.ZodNullable,...T(t)});var Je=class extends E{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===a.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Je.create=(e,t)=>new Je({innerType:e,typeName:R.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...T(t)});var Ye=class extends E{_parse(e){let{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 x(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new c(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new c(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ye.create=(e,t)=>new Ye({innerType:e,typeName:R.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...T(t)});var Xe=class extends E{_parse(e){if(this._getType(e)!==a.nan){let t=this._getOrReturnCtx(e);return p(t,{code:s.invalid_type,expected:a.nan,received:t.parsedType}),h}return{status:`valid`,value:e.data}}};Xe.create=e=>new Xe({typeName:R.ZodNaN,...T(e)});var Ze=class extends E{_parse(e){let{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}},Qe=class e extends E{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?h:e.status===`dirty`?(t.dirty(),g(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?h:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:R.ZodPipeline})}},$e=class extends E{_parse(e){let t=this._def.innerType._parse(e),n=e=>(b(e)&&(e.value=Object.freeze(e.value)),e);return x(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};$e.create=(e,t)=>new $e({innerType:e,typeName:R.ZodReadonly,...T(t)}),M.lazycreate;var R;(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`})(R||={});var z=A.create;Se.create,Xe.create,Ce.create;var et=we.create;Te.create,Ee.create,De.create,Oe.create,ke.create;var tt=Ae.create;j.create,je.create,Me.create;var nt=M.create;M.strictCreate,Pe.create,Fe.create,Le.create,P.create;var rt=Re.create;ze.create,Be.create,Ve.create,He.create,Ue.create;var it=Ge.create;Ke.create,qe.create,F.create,I.create,L.create,F.createWithPreprocess,Qe.create;var at=nt({mode:it([`light`,`dark`,`system`]).optional(),accentColor:z().optional(),fontFamily:z().optional(),borderRadius:z().optional()}),ot=nt({externalId:z().optional(),authId:z().optional(),name:z().optional(),email:z().optional()}),st=nt({agentId:z().min(1,`agentId is required`),apiBaseUrl:z().url(`apiBaseUrl must be a valid URL`),tenantId:z().optional(),user:ot.optional(),sessionId:z().optional(),mode:it([`floating`,`inline`]).optional(),title:z().optional(),subtitle:z().optional(),description:z().optional(),avatarUrl:z().optional(),streaming:et().optional(),preview:et().optional(),skipServerConfigFetch:et().optional(),configChannel:it([`draft`,`published`]).optional(),metadata:rt(tt()).optional(),theme:at.optional()}),ct=st.omit({agentId:!0,apiBaseUrl:!0}).partial(),lt={mode:`floating`,streaming:!0,title:`AI Assistant`,theme:{mode:`light`,accentColor:`#4f46e5`,fontFamily:`system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif`,borderRadius:`12px`}};function ut(e,t){st.parse(e);let n,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);let i=r?ct.passthrough().safeParse(r).data:void 0,a=i?dt(i,e):e,o={mode:a.theme?.mode??n?.mode??lt.theme.mode,accentColor:a.theme?.accentColor||n?.accentColor||lt.theme.accentColor,fontFamily:a.theme?.fontFamily??n?.fontFamily??lt.theme.fontFamily,borderRadius:a.theme?.borderRadius??n?.borderRadius??lt.theme.borderRadius};return{agentId:a.agentId,apiBaseUrl:a.apiBaseUrl.replace(/\/$/,``),tenantId:a.tenantId,user:{externalId:a.user?.externalId,authId:a.user?.authId,name:a.user?.name,email:a.user?.email},sessionId:a.sessionId,mode:a.mode??lt.mode,title:a.title??lt.title,subtitle:a.subtitle,description:a.description,suggestedQuestions:(()=>{let e=i?.suggestedQuestions;return Array.isArray(e)?e:[]})(),avatarUrl:a.avatarUrl,streaming:a.streaming??lt.streaming,preview:a.preview===!0,skipServerConfigFetch:a.skipServerConfigFetch===!0,configChannel:a.configChannel,metadata:a.metadata??{},theme:o,photoSendingEnabled:i?.photoSendingEnabled===!0,fileUploadEnabled:i?.fileUploadEnabled===!0,voiceNoteEnabled:i?.voiceNoteEnabled===!0,voiceNoteMaxDurationSec:(()=>{let e=i?.voiceNoteMaxDurationSec;return typeof e==`number`&&Number.isFinite(e)?e:120})(),attachmentMaxCount:(()=>{let e=i?.attachmentMaxCount;return typeof e==`number`&&Number.isFinite(e)?e:5})(),attachmentMaxFileSizeMb:(()=>{let e=i?.attachmentMaxFileSizeMb;return typeof e==`number`&&Number.isFinite(e)?e:1})(),turnstileSiteKey:(()=>{let e=i?.turnstileSiteKey;return typeof e==`string`&&e.length>0?e:void 0})()}}function dt(e,t){let n={...e};for(let e of Object.keys(t)){let r=t[e];r!=null&&(n[e]=typeof r==`object`&&!Array.isArray(r)&&n[e]!==null&&typeof n[e]==`object`?dt(n[e],r):r)}return n}var ft=function(){return ft=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ft.apply(this,arguments)};function B(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function V(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function pt(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var mt=`4.6.2`;function ht(e,t){return new Promise(function(n){return setTimeout(n,e,t)})}function gt(){return new Promise(function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})}function _t(e,t){t===void 0&&(t=1/0);var n=window.requestIdleCallback;return n?new Promise(function(e){return n.call(window,function(){return e()},{timeout:t})}):ht(Math.min(e,t))}function vt(e){return!!e&&typeof e.then==`function`}function yt(e,t){try{var n=e();vt(n)?n.then(function(e){return t(!0,e)},function(e){return t(!1,e)}):t(!0,n)}catch(e){t(!1,e)}}function bt(e,t,n){return n===void 0&&(n=16),B(this,void 0,void 0,function(){var r,i,a,o;return V(this,function(s){switch(s.label){case 0:r=Array(e.length),i=Date.now(),a=0,s.label=1;case 1:return a<e.length?(r[a]=t(e[a],a),o=Date.now(),o>=i+n?(i=o,[4,gt()]):[3,3]):[3,4];case 2:s.sent(),s.label=3;case 3:return++a,[3,1];case 4:return[2,r]}})})}function xt(e){return e.then(void 0,function(){}),e}function St(e,t){for(var n=0,r=e.length;n<r;++n)if(e[n]===t)return!0;return!1}function Ct(e,t){return!St(e,t)}function wt(e){return parseInt(e)}function H(e){return parseFloat(e)}function U(e,t){return typeof e==`number`&&isNaN(e)?t:e}function W(e){return e.reduce(function(e,t){return e+ +!!t},0)}function Tt(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 Et(e){for(var t=`Unexpected syntax '${e}'`,n=/^\s*([a-z-]*)(.*)$/i.exec(e),r=n[1]||void 0,i={},a=/([.:#][\w-]+|\[.+?\])/gi,o=function(e,t){i[e]=i[e]||[],i[e].push(t)};;){var s=a.exec(n[2]);if(!s)break;var c=s[0];switch(c[0]){case`.`:o(`class`,c.slice(1));break;case`#`:o(`id`,c.slice(1));break;case`[`:var l=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(c);if(l)o(l[1],l[4]??l[5]??``);else throw Error(t);break;default:throw Error(t)}}return[r,i]}function Dt(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 G(e,t){var n=e[0]>>>16,r=e[0]&65535,i=e[1]>>>16,a=e[1]&65535,o=t[0]>>>16,s=t[0]&65535,c=t[1]>>>16,l=t[1]&65535,u=0,d=0,f=0,p=0;p+=a+l,f+=p>>>16,p&=65535,f+=i+c,d+=f>>>16,f&=65535,d+=r+s,u+=d>>>16,d&=65535,u+=n+o,u&=65535,e[0]=u<<16|d,e[1]=f<<16|p}function K(e,t){var n=e[0]>>>16,r=e[0]&65535,i=e[1]>>>16,a=e[1]&65535,o=t[0]>>>16,s=t[0]&65535,c=t[1]>>>16,l=t[1]&65535,u=0,d=0,f=0,p=0;p+=a*l,f+=p>>>16,p&=65535,f+=i*l,d+=f>>>16,f&=65535,f+=a*c,d+=f>>>16,f&=65535,d+=r*l,u+=d>>>16,d&=65535,d+=i*c,u+=d>>>16,d&=65535,d+=a*s,u+=d>>>16,d&=65535,u+=n*l+r*c+i*s+a*o,u&=65535,e[0]=u<<16|d,e[1]=f<<16|p}function Ot(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 q(e,t){t%=64,t!==0&&(t<32?(e[0]=e[1]>>>32-t,e[1]<<=t):(e[0]=e[1]<<t-32,e[1]=0))}function J(e,t){e[0]^=t[0],e[1]^=t[1]}var kt=[4283543511,3981806797],At=[3301882366,444984403];function jt(e){var t=[0,e[0]>>>1];J(e,t),K(e,kt),t[1]=e[0]>>>1,J(e,t),K(e,At),t[1]=e[0]>>>1,J(e,t)}var Mt=[2277735313,289559509],Nt=[1291169091,658871167],Pt=[0,5],Ft=[0,1390208809],It=[0,944331445];function Lt(e,t){var n=Dt(e);t||=0;for(var r=[0,n.length],i=r[1]%16,a=r[1]-i,o=[0,t],s=[0,t],c=[0,0],l=[0,0],u=0;u<a;u+=16)c[0]=n[u+4]|n[u+5]<<8|n[u+6]<<16|n[u+7]<<24,c[1]=n[u]|n[u+1]<<8|n[u+2]<<16|n[u+3]<<24,l[0]=n[u+12]|n[u+13]<<8|n[u+14]<<16|n[u+15]<<24,l[1]=n[u+8]|n[u+9]<<8|n[u+10]<<16|n[u+11]<<24,K(c,Mt),Ot(c,31),K(c,Nt),J(o,c),Ot(o,27),G(o,s),K(o,Pt),G(o,Ft),K(l,Nt),Ot(l,33),K(l,Mt),J(s,l),Ot(s,31),G(s,o),K(s,Pt),G(s,It);c[0]=0,c[1]=0,l[0]=0,l[1]=0;var d=[0,0];switch(i){case 15:d[1]=n[u+14],q(d,48),J(l,d);case 14:d[1]=n[u+13],q(d,40),J(l,d);case 13:d[1]=n[u+12],q(d,32),J(l,d);case 12:d[1]=n[u+11],q(d,24),J(l,d);case 11:d[1]=n[u+10],q(d,16),J(l,d);case 10:d[1]=n[u+9],q(d,8),J(l,d);case 9:d[1]=n[u+8],J(l,d),K(l,Nt),Ot(l,33),K(l,Mt),J(s,l);case 8:d[1]=n[u+7],q(d,56),J(c,d);case 7:d[1]=n[u+6],q(d,48),J(c,d);case 6:d[1]=n[u+5],q(d,40),J(c,d);case 5:d[1]=n[u+4],q(d,32),J(c,d);case 4:d[1]=n[u+3],q(d,24),J(c,d);case 3:d[1]=n[u+2],q(d,16),J(c,d);case 2:d[1]=n[u+1],q(d,8),J(c,d);case 1:d[1]=n[u],J(c,d),K(c,Mt),Ot(c,31),K(c,Nt),J(o,c)}return J(o,r),J(s,r),G(o,s),G(s,o),jt(o),jt(s),G(o,s),G(s,o),(`00000000`+(o[0]>>>0).toString(16)).slice(-8)+(`00000000`+(o[1]>>>0).toString(16)).slice(-8)+(`00000000`+(s[0]>>>0).toString(16)).slice(-8)+(`00000000`+(s[1]>>>0).toString(16)).slice(-8)}function Rt(e){return ft({name:e.name,message:e.message,stack:e.stack?.split(`
|
|
2
|
+
`)},e)}function zt(e){return/^function\s.*?\{\s*\[native code]\s*}$/.test(String(e))}function Bt(e){return typeof e!=`function`}function Vt(e,t){var n=xt(new Promise(function(n){var r=Date.now();yt(e.bind(null,t),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=Date.now()-r;if(!e[0])return n(function(){return{error:e[1],duration:i}});var a=e[1];if(Bt(a))return n(function(){return{value:a,duration:i}});n(function(){return new Promise(function(e){var t=Date.now();yt(a,function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var a=i+Date.now()-t;if(!n[0])return e({error:n[1],duration:a});e({value:n[1],duration:a})})})})})}));return function(){return n.then(function(e){return e()})}}function Ht(e,t,n,r){var i=Object.keys(e).filter(function(e){return Ct(n,e)}),a=xt(bt(i,function(n){return Vt(e[n],t)},r));return function(){return B(this,void 0,void 0,function(){var e,t,n,o,s;return V(this,function(c){switch(c.label){case 0:return[4,a];case 1:return e=c.sent(),[4,bt(e,function(e){return xt(e())},r)];case 2:return t=c.sent(),[4,Promise.all(t)];case 3:for(n=c.sent(),o={},s=0;s<i.length;++s)o[i[s]]=n[s];return[2,o]}})})}}function Ut(){var e=window,t=navigator;return W([`MSCSSMatrix`in e,`msSetImmediate`in e,`msIndexedDB`in e,`msMaxTouchPoints`in t,`msPointerEnabled`in t])>=4}function Wt(){var e=window,t=navigator;return W([`msWriteProfilerMark`in e,`MSStream`in e,`msLaunchUri`in t,`msSaveBlob`in t])>=3&&!Ut()}function Gt(){var e=window,t=navigator;return W([`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 W([`ApplePayError`in e,`CSSPrimitiveValue`in e,`Counter`in e,t.vendor.indexOf(`Apple`)===0,`RGBColor`in e,`WebKitMediaKeys`in e])>=4}function Kt(){var e=window,t=e.HTMLElement,n=e.Document;return W([`safari`in e,!(`ongestureend`in e),!(`TouchEvent`in e),!(`orientation`in e),t&&!(`autocapitalize`in t.prototype),n&&`pointerLockElement`in n.prototype])>=4}function qt(){var e=window;return zt(e.print)&&String(e.browser)===`[object WebPageNamespace]`}function Jt(){var e=window;return W([`buildID`in navigator,`MozAppearance`in(document.documentElement?.style??{}),`onmozfullscreenchange`in e,`mozInnerScreenX`in e,`CSSMozDocumentRule`in e,`CanvasCaptureMediaStream`in e])>=4}function Yt(){var e=window;return W([!(`MediaSettingsRange`in e),`RTCEncodedAudioFrame`in e,``+e.Intl==`[object Intl]`,``+e.Reflect==`[object Reflect]`])>=3}function Xt(){var e=window,t=e.URLPattern;return W([`union`in Set.prototype,`Iterator`in e,t&&`hasRegExpGroups`in t.prototype,`RGB8`in WebGLRenderingContext.prototype])>=3}function Zt(){var e=window;return W([`DOMRectList`in e,`RTCPeerConnectionIceEvent`in e,`SVGGeometryElement`in e,`ontransitioncancel`in e])>=3}function Qt(){var e=window,t=navigator,n=e.CSS,r=e.HTMLButtonElement;return W([!(`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 $t(){if(navigator.platform===`iPad`)return!0;var e=screen,t=e.width/e.height;return W([`MediaSource`in window,!!Element.prototype.webkitRequestFullscreen,t>.65&&t<1.53])>=2}function en(){var e=document;return e.fullscreenElement||e.msFullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement||null}function tn(){var e=document;return(e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen).call(e)}function nn(){var e=Gt(),t=Jt(),n=window,r=navigator,i=`connection`;return e?W([!(`SharedWorker`in n),r[i]&&`ontypechange`in r[i],!(`sinkId`in new Audio)])>=2:t?W([`onorientationchange`in n,`orientation`in n,/android/i.test(r.appVersion)])>=2:!1}function rn(){var e=navigator,t=window,n=Audio.prototype,r=t.visualViewport;return W([`srLatency`in n,`srChannelCount`in n,`devicePosture`in e,r&&`segments`in r,`getTextInformation`in Image.prototype])>=3}function an(){return cn()?-4:on()}function on(){var e=window,t=e.OfflineAudioContext||e.webkitOfflineAudioContext;if(!t)return-2;if(sn())return-1;var n=4500,r=new t(1,5e3,44100),i=r.createOscillator();i.type=`triangle`,i.frequency.value=1e4;var a=r.createDynamicsCompressor();a.threshold.value=-50,a.knee.value=40,a.ratio.value=12,a.attack.value=0,a.release.value=.25,i.connect(a),a.connect(r.destination),i.start(0);var o=ln(r),s=o[0],c=o[1],l=xt(s.then(function(e){return un(e.getChannelData(0).subarray(n))},function(e){if(e.name===`timeout`||e.name===`suspended`)return-3;throw e}));return function(){return c(),l}}function sn(){return Y()&&!Kt()&&!Zt()}function cn(){return Y()&&Qt()&&qt()||Gt()&&rn()&&Xt()}function ln(e){var t=function(){};return[new Promise(function(n,r){var i=!1,a=0,o=0;e.oncomplete=function(e){return n(e.renderedBuffer)};var s=function(){setTimeout(function(){return r(dn(`timeout`))},Math.min(500,o+5e3-Date.now()))},c=function(){try{var t=e.startRendering();switch(vt(t)&&xt(t),e.state){case`running`:o=Date.now(),i&&s();break;case`suspended`:document.hidden||a++,i&&a>=3?r(dn(`suspended`)):setTimeout(c,500)}}catch(e){r(e)}};c(),t=function(){i||(i=!0,o>0&&s())}}),t]}function un(e){for(var t=0,n=0;n<e.length;++n)t+=Math.abs(e[n]);return t}function dn(e){var t=Error(e);return t.name=e,t}function fn(e,t,n){var r;return n===void 0&&(n=50),B(this,void 0,void 0,function(){var i,a;return V(this,function(o){switch(o.label){case 0:i=document,o.label=1;case 1:return i.body?[3,3]:[4,ht(n)];case 2:return o.sent(),[3,1];case 3:a=i.createElement(`iframe`),o.label=4;case 4:return o.trys.push([4,,10,11]),[4,new Promise(function(e,n){var r=!1,o=function(){r=!0,e()};a.onload=o,a.onerror=function(e){r=!0,n(e)};var s=a.style;s.setProperty(`display`,`block`,`important`),s.position=`absolute`,s.top=`0`,s.left=`0`,s.visibility=`hidden`,t&&`srcdoc`in a?a.srcdoc=t:a.src=`about:blank`,i.body.appendChild(a);var c=function(){r||(a.contentWindow?.document?.readyState===`complete`?o():setTimeout(c,10))};c()})];case 5:o.sent(),o.label=6;case 6:return a.contentWindow?.document?.body?[3,8]:[4,ht(n)];case 7:return o.sent(),[3,6];case 8:return[4,e(a,a.contentWindow)];case 9:return[2,o.sent()];case 10:return(r=a.parentNode)==null||r.removeChild(a),[7];case 11:return[2]}})})}function pn(e){for(var t=Et(e),n=t[0],r=t[1],i=document.createElement(n??`div`),a=0,o=Object.keys(r);a<o.length;a++){var s=o[a],c=r[s].join(` `);s===`style`?mn(i.style,c):i.setAttribute(s,c)}return i}function mn(e,t){for(var n=0,r=t.split(`;`);n<r.length;n++){var i=r[n],a=/^\s*([\w-]+)\s*:\s*(.+?)(\s*!([\w-]+))?\s*$/.exec(i);if(a){var o=a[1],s=a[2],c=a[4];e.setProperty(o,s,c||``)}}}function hn(){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(e){if(e instanceof Error&&e.name===`SecurityError`)return!0;throw e}e=t}}var gn=`mmMwWLliI0O&1`,_n=`48px`,vn=[`monospace`,`sans-serif`,`serif`],yn=`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`.split(`.`);function bn(){var e=this;return fn(function(t,n){var r=n.document;return B(e,void 0,void 0,function(){var e,t,n,i,a,o,s,c,l,u,d,f;return V(this,function(p){for(e=r.body,e.style.fontSize=_n,t=r.createElement(`div`),t.style.setProperty(`visibility`,`hidden`,`important`),n={},i={},a=function(e){var n=r.createElement(`span`),i=n.style;return i.position=`absolute`,i.top=`0`,i.left=`0`,i.fontFamily=e,n.textContent=gn,t.appendChild(n),n},o=function(e,t){return a(`'${e}',${t}`)},s=function(){return vn.map(a)},c=function(){for(var e={},t=function(t){e[t]=vn.map(function(e){return o(t,e)})},n=0,r=yn;n<r.length;n++){var i=r[n];t(i)}return e},l=function(e){return vn.some(function(t,r){return e[r].offsetWidth!==n[t]||e[r].offsetHeight!==i[t]})},u=s(),d=c(),e.appendChild(t),f=0;f<vn.length;f++)n[vn[f]]=u[f].offsetWidth,i[vn[f]]=u[f].offsetHeight;return[2,yn.filter(function(e){return l(d[e])})]})})})}function xn(){var e=navigator.plugins;if(e){for(var t=[],n=0;n<e.length;++n){var r=e[n];if(r){for(var i=[],a=0;a<r.length;++a){var o=r[a];i.push({type:o.type,suffixes:o.suffixes})}t.push({name:r.name,description:r.description,mimeTypes:i})}}return t}}function Sn(){return Cn(jn())}function Cn(e){var t,n=!1,r,i,a=wn(),o=a[0],s=a[1];return Tn(o,s)?(n=En(s),e?r=i=`skipped`:(t=Dn(o,s),r=t[0],i=t[1])):r=i=`unsupported`,{winding:n,geometry:r,text:i}}function wn(){var e=document.createElement(`canvas`);return e.width=1,e.height=1,[e,e.getContext(`2d`)]}function Tn(e,t){return!!(t&&e.toDataURL)}function En(e){return e.rect(0,0,10,10),e.rect(2,2,6,6),!e.isPointInPath(5,5,`evenodd`)}function Dn(e,t){On(e,t);var n=An(e);return n===An(e)?(kn(e,t),[An(e),n]):[`unstable`,`unstable`]}function On(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 😃`;t.fillText(n,2,15),t.fillStyle=`rgba(102, 204, 0, 0.2)`,t.font=`18pt Arial`,t.fillText(n,4,45)}function kn(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 i=r[n],a=i[0],o=i[1],s=i[2];t.fillStyle=a,t.beginPath(),t.arc(o,s,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 An(e){return e.toDataURL()}function jn(){return Y()&&Qt()&&qt()}function Mn(){var e=navigator,t=0,n;e.maxTouchPoints===void 0?e.msMaxTouchPoints!==void 0&&(t=e.msMaxTouchPoints):t=wt(e.maxTouchPoints);try{document.createEvent(`TouchEvent`),n=!0}catch{n=!1}var r=`ontouchstart`in window;return{maxTouchPoints:t,touchEvent:n,touchStart:r}}function Nn(){return navigator.oscpu}function Pn(){var e=navigator,t=[],n=e.language||e.userLanguage||e.browserLanguage||e.systemLanguage;if(n!==void 0&&t.push([n]),Array.isArray(e.languages))Gt()&&Yt()||t.push(e.languages);else if(typeof e.languages==`string`){var r=e.languages;r&&t.push(r.split(`,`))}return t}function Fn(){return window.screen.colorDepth}function In(){return U(H(navigator.deviceMemory),void 0)}function Ln(){if(!(Y()&&Qt()&&qt()))return Rn()}function Rn(){var e=screen,t=function(e){return U(wt(e),null)},n=[t(e.width),t(e.height)];return n.sort().reverse(),n}var zn=2500,Bn=10,Vn,Hn;function Un(){if(Hn===void 0){var e=function(){var t=Kn();qn(t)?Hn=setTimeout(e,zn):(Vn=t,Hn=void 0)};e()}}function Wn(){var e=this;return Un(),function(){return B(e,void 0,void 0,function(){var e;return V(this,function(t){switch(t.label){case 0:return e=Kn(),qn(e)?Vn?[2,pt([],Vn,!0)]:en()?[4,tn()]:[3,2]:[3,2];case 1:t.sent(),e=Kn(),t.label=2;case 2:return qn(e)||(Vn=e),[2,e]}})})}}function Gn(){var e=this;if(Y()&&Qt()&&qt())return function(){return Promise.resolve(void 0)};var t=Wn();return function(){return B(e,void 0,void 0,function(){var e,n;return V(this,function(r){switch(r.label){case 0:return[4,t()];case 1:return e=r.sent(),n=function(e){return e===null?null:Tt(e,Bn)},[2,[n(e[0]),n(e[1]),n(e[2]),n(e[3])]]}})})}}function Kn(){var e=screen;return[U(H(e.availTop),null),U(H(e.width)-H(e.availWidth)-U(H(e.availLeft),0),null),U(H(e.height)-H(e.availHeight)-U(H(e.availTop),0),null),U(H(e.availLeft),null)]}function qn(e){for(var t=0;t<4;++t)if(e[t])return!1;return!0}function Jn(){return U(wt(navigator.hardwareConcurrency),void 0)}function Yn(){var e=window.Intl?.DateTimeFormat;if(e){var t=new e().resolvedOptions().timeZone;if(t)return t}var n=-Xn();return`UTC${n>=0?`+`:``}${n}`}function Xn(){var e=new Date().getFullYear();return Math.max(H(new Date(e,0,1).getTimezoneOffset()),H(new Date(e,6,1).getTimezoneOffset()))}function Zn(){try{return!!window.sessionStorage}catch{return!0}}function Qn(){try{return!!window.localStorage}catch{return!0}}function $n(){if(!(Ut()||Wt()))try{return!!window.indexedDB}catch{return!0}}function er(){return!!window.openDatabase}function tr(){return navigator.cpuClass}function nr(){var e=navigator.platform;return e===`MacIntel`&&Y()&&!Kt()?$t()?`iPad`:`iPhone`:e}function rr(){return navigator.vendor||``}function ir(){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],i=window[r];i&&typeof i==`object`&&e.push(r)}return e.sort()}function ar(){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 or(){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 sr(e){var t=(e===void 0?{}:e).debug;return B(this,void 0,void 0,function(){var e,n,r,i,a,o;return V(this,function(s){switch(s.label){case 0:return cr()?(e=or(),n=Object.keys(e),r=(o=[]).concat.apply(o,n.map(function(t){return e[t]})),[4,lr(r)]):[2,void 0];case 1:return i=s.sent(),t&&dr(e,i),a=n.filter(function(t){var n=e[t];return W(n.map(function(e){return i[e]}))>n.length*.6}),a.sort(),[2,a]}})})}function cr(){return Y()||nn()}function lr(e){var t;return B(this,void 0,void 0,function(){var n,r,i,a,o,s,c,o;return V(this,function(l){switch(l.label){case 0:for(n=document,r=n.createElement(`div`),i=Array(e.length),a={},ur(r),o=0;o<e.length;++o)s=pn(e[o]),s.tagName===`DIALOG`&&s.show(),c=n.createElement(`div`),ur(c),c.appendChild(s),r.appendChild(c),i[o]=s;l.label=1;case 1:return n.body?[3,3]:[4,ht(50)];case 2:return l.sent(),[3,1];case 3:n.body.appendChild(r);try{for(o=0;o<e.length;++o)i[o].offsetParent||(a[e[o]]=!0)}finally{(t=r.parentNode)==null||t.removeChild(r)}return[2,a]}})})}function ur(e){e.style.setProperty(`visibility`,`hidden`,`important`),e.style.setProperty(`display`,`block`,`important`)}function dr(e,t){for(var n="DOM blockers debug:\n```",r=0,i=Object.keys(e);r<i.length;r++){var a=i[r];n+=`
|
|
3
3
|
${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
4
|
-
${t[c]?`🚫`:`➡️`} ${c}`}}}function fr(){for(var e=0,t=[`rec2020`,`p3`,`srgb`];e<t.length;e++){var n=t[e];if(matchMedia(`(color-gamut: ${n})`).matches)return n}}function pr(){if(mr(`inverted`))return!0;if(mr(`none`))return!1}function mr(e){return matchMedia(`(inverted-colors: ${e})`).matches}function hr(){if(gr(`active`))return!0;if(gr(`none`))return!1}function gr(e){return matchMedia(`(forced-colors: ${e})`).matches}var _r=100;function vr(){if(matchMedia(`(min-monochrome: 0)`).matches){for(var e=0;e<=_r;++e)if(matchMedia(`(max-monochrome: ${e})`).matches)return e;throw Error(`Too high value`)}}function yr(){if(br(`no-preference`))return 0;if(br(`high`)||br(`more`))return 1;if(br(`low`)||br(`less`))return-1;if(br(`forced`))return 10}function br(e){return matchMedia(`(prefers-contrast: ${e})`).matches}function xr(){if(Sr(`reduce`))return!0;if(Sr(`no-preference`))return!1}function Sr(e){return matchMedia(`(prefers-reduced-motion: ${e})`).matches}function Cr(){if(wr(`reduce`))return!0;if(wr(`no-preference`))return!1}function wr(e){return matchMedia(`(prefers-reduced-transparency: ${e})`).matches}function Tr(){if(Er(`high`))return!0;if(Er(`standard`))return!1}function Er(e){return matchMedia(`(dynamic-range: ${e})`).matches}var X=Math,Z=function(){return 0};function Dr(){var e=X.acos||Z,t=X.acosh||Z,n=X.asin||Z,r=X.asinh||Z,i=X.atanh||Z,a=X.atan||Z,o=X.sin||Z,s=X.sinh||Z,c=X.cos||Z,l=X.cosh||Z,u=X.tan||Z,d=X.tanh||Z,f=X.exp||Z,p=X.expm1||Z,m=X.log1p||Z;return{acos:e(.12312423423423424),acosh:t(1e308),acoshPf:function(e){return X.log(e+X.sqrt(e*e-1))}(1e154),asin:n(.12312423423423424),asinh:r(1),asinhPf:function(e){return X.log(e+X.sqrt(e*e+1))}(1),atanh:i(.5),atanhPf:function(e){return X.log((1+e)/(1-e))/2}(.5),atan:a(.5),sin:o(-1e300),sinh:s(1),sinhPf:function(e){return X.exp(e)-1/X.exp(e)/2}(1),cos:c(10.000000000123),cosh:l(1),coshPf:function(e){return(X.exp(e)+1/X.exp(e))/2}(1),tan:u(-1e300),tanh:d(1),tanhPf:function(e){return(X.exp(2*e)-1)/(X.exp(2*e)+1)}(1),exp:f(1),expm1:p(1),expm1Pf:function(e){return X.exp(e)-1}(1),log1p:m(10),log1pPf:function(e){return X.log(1+e)}(10),powPI:function(e){return X.pow(X.PI,e)}(-100)}}var Or=`mmMwWLliI0fiflO&1`,kr={default:[],apple:[{font:`-apple-system-body`}],serif:[{fontFamily:`serif`}],sans:[{fontFamily:`sans-serif`}],mono:[{fontFamily:`monospace`}],min:[{fontSize:`1px`}],system:[{fontFamily:`system-ui`}]};function Ar(){return jr(function(e,t){for(var n={},r={},i=0,a=Object.keys(kr);i<a.length;i++){var o=a[i],s=kr[o],c=s[0],l=c===void 0?{}:c,u=s[1],d=u===void 0?Or:u,f=e.createElement(`span`);f.textContent=d,f.style.whiteSpace=`nowrap`;for(var p=0,m=Object.keys(l);p<m.length;p++){var h=m[p],g=l[h];g!==void 0&&(f.style[h]=g)}n[o]=f,t.append(e.createElement(`br`),f)}for(var _=0,v=Object.keys(kr);_<v.length;_++){var o=v[_];r[o]=n[o].getBoundingClientRect().width}return r})}function jr(e,t){return t===void 0&&(t=4e3),fn(function(n,r){var i=r.document,a=i.body,o=a.style;o.width=`${t}px`,o.webkitTextSizeAdjust=o.textSizeAdjust=`none`,Gt()?a.style.zoom=`${1/r.devicePixelRatio}`:Y()&&(a.style.zoom=`reset`);var s=i.createElement(`div`);return s.textContent=mt([],Array(t/20<<0),!0).map(function(){return`word`}).join(` `),a.appendChild(s),e(i,a)},`<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">`)}function Mr(){return navigator.pdfViewerEnabled}function Nr(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]-=e[0],t[3]}function Pr(){var e=window.ApplePaySession;if(typeof e?.canMakePayments!=`function`)return-1;if(Fr())return-3;try{return+!!e.canMakePayments()}catch(e){return Ir(e)}}var Fr=hn;function Ir(e){if(e instanceof Error&&e.name===`InvalidAccessError`&&/\bfrom\b.*\binsecure\b/i.test(e.message))return-2;throw e}function Lr(){var e=document.createElement(`a`),t=e.attributionSourceId??e.attributionsourceid;return t===void 0?void 0:String(t)}var Rr=-1,zr=-2,Br=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]),Vr=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),Hr=[`FRAGMENT_SHADER`,`VERTEX_SHADER`],Ur=[`LOW_FLOAT`,`MEDIUM_FLOAT`,`HIGH_FLOAT`,`LOW_INT`,`MEDIUM_INT`,`HIGH_INT`],Wr=`WEBGL_debug_renderer_info`,Gr=`WEBGL_polygon_mode`;function Kr(e){var t=e.cache,n=Jr(t);if(!n)return Rr;if(!ei(n))return zr;var r=Qr()?null:n.getExtension(Wr);return{version:n.getParameter(n.VERSION)?.toString()||``,vendor:n.getParameter(n.VENDOR)?.toString()||``,vendorUnmasked:r?n.getParameter(r.UNMASKED_VENDOR_WEBGL)?.toString():``,renderer:n.getParameter(n.RENDERER)?.toString()||``,rendererUnmasked:r?n.getParameter(r.UNMASKED_RENDERER_WEBGL)?.toString():``,shadingLanguageVersion:n.getParameter(n.SHADING_LANGUAGE_VERSION)?.toString()||``}}function qr(e){var t=e.cache,n=Jr(t);if(!n)return Rr;if(!ei(n))return zr;var r=n.getSupportedExtensions(),i=n.getContextAttributes(),a=[],o=[],s=[],c=[],l=[];if(i)for(var u=0,d=Object.keys(i);u<d.length;u++){var f=d[u];o.push(`${f}=${i[f]}`)}for(var p=Xr(n),m=0,h=p;m<h.length;m++){var g=h[m],_=n[g];s.push(`${g}=${_}${Br.has(_)?`=${n.getParameter(_)}`:``}`)}if(r)for(var v=0,y=r;v<y.length;v++){var b=y[v];if(!(b===Wr&&Qr()||b===Gr&&$r())){var x=n.getExtension(b);if(!x){a.push(b);continue}for(var S=0,C=Xr(x);S<C.length;S++){var g=C[S],_=x[g];c.push(`${g}=${_}${Vr.has(_)?`=${n.getParameter(_)}`:``}`)}}}for(var w=0,T=Hr;w<T.length;w++)for(var E=T[w],D=0,ee=Ur;D<ee.length;D++){var te=ee[D],ne=Yr(n,E,te);l.push(`${E}.${te}=${ne.join(`,`)}`)}return c.sort(),s.sort(),{contextAttributes:o,parameters:s,shaderPrecisions:l,extensions:r,extensionParameters:c,unsupportedExtensions:a}}function Jr(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,i=[`webgl`,`experimental-webgl`];r<i.length;r++){var a=i[r];try{n=t.getContext(a)}catch{}if(n)break}return e.webgl={context:n},n}function Yr(e,t,n){var r=e.getShaderPrecisionFormat(e[t],e[n]);return r?[r.rangeMin,r.rangeMax,r.precision]:[]}function Xr(e){return Object.keys(e.__proto__).filter(Zr)}function Zr(e){return typeof e==`string`&&!e.match(/[^A-Z0-9_x]/)}function Qr(){return Jt()}function $r(){return Gt()||Y()}function ei(e){return typeof e.getParameter==`function`}function ti(){if(!(nn()||Y()))return-2;if(!window.AudioContext)return-1;var e=new AudioContext().baseLatency;return e==null?-1:isFinite(e)?e:-3}function ni(){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 ri={fonts:bn,domBlockers:sr,fontPreferences:Ar,audio:an,screenFrame:Gn,canvas:Sn,osCpu:Nn,languages:Pn,colorDepth:Fn,deviceMemory:In,screenResolution:Ln,hardwareConcurrency:Jn,timezone:Yn,sessionStorage:Zn,localStorage:Qn,indexedDB:$n,openDatabase:er,cpuClass:tr,platform:nr,plugins:xn,touchSupport:Mn,vendor:rr,vendorFlavors:ir,cookiesEnabled:ar,colorGamut:fr,invertedColors:pr,forcedColors:hr,monochrome:vr,contrast:yr,reducedMotion:xr,reducedTransparency:Cr,hdr:Tr,math:Dr,pdfViewerEnabled:Mr,architecture:Nr,applePay:Pr,privateClickMeasurement:Lr,audioBaseLatency:ti,dateTimeLocale:ni,webGlBasics:Kr,webGlExtensions:qr};function ii(e){return Ht(ri,e,[])}var ai=`$ if upgrade to Pro: https://fpjs.dev/pro`;function oi(e){var t=si(e),n=ci(t);return{score:t,comment:ai.replace(/\$/g,`${n}`)}}function si(e){if(nn())return .4;if(Y())return Kt()&&!(Qt()&&qt())?.5:.3;var t=`value`in e.platform?e.platform.value:``;return/^Win/.test(t)?.6:/^Mac/.test(t)?.5:.7}function ci(e){return Et(.99+.01*e,1e-4)}function li(e){for(var t=``,n=0,r=Object.keys(e).sort();n<r.length;n++){var i=r[n],a=e[i],o=`error`in a?`error`:JSON.stringify(a.value);t+=`${t?`|`:``}${i.replace(/([:|\\])/g,`\\$1`)}:${o}`}return t}function ui(e){return JSON.stringify(e,function(e,t){return t instanceof Error?Rt(t):t},2)}function di(e){return Lt(li(e))}function fi(e){var t;return{get visitorId(){return t===void 0&&(t=di(this.components)),t},set visitorId(e){t=e},confidence:oi(e),components:e,version:ht}}function pi(e){return e===void 0&&(e=50),vt(e,e*2)}function mi(e,t){return{get:function(n){return z(this,void 0,void 0,function(){var r,i;return B(this,function(a){switch(a.label){case 0:return[4,e()];case 1:return r=a.sent(),i=fi(r),t||n?.debug,[2,i]}})})}}}function hi(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var e=new XMLHttpRequest;e.open(`get`,`https://m1.openfpcdn.io/fingerprintjs/v${ht}/npm-monitoring`,!0),e.send()}catch{}}function gi(e){return e===void 0&&(e={}),z(this,void 0,void 0,function(){var t,n,r;return B(this,function(i){switch(i.label){case 0:return(e.monitoring??!0)&&hi(),t=e.delayFallback,n=e.debug,[4,pi(t)];case 1:return i.sent(),r=ii({cache:{},debug:n}),[2,mi(r,n)]}})})}var _i={load:gi,hashComponents:di,componentsToDebugString:ui};function vi(e){return e.preview?`include`:`same-origin`}function yi(e){return e.sessionToken?{"x-widget-session-token":e.sessionToken}:{}}function bi(e,t){return t.configChannel===`draft`?`${e}${e.includes(`?`)?`&`:`?`}configChannel=draft`:e}var xi=class{baseUrl;options;sessionToken;sessionTokenExpiresAt;constructor(e,t={}){this.baseUrl=e,this.options=t}get credentials(){return vi(this.options)}channel(e){return bi(e,this.options)}authHeaders(){return{"Content-Type":`application/json`,...yi({sessionToken:this.sessionToken})}}getSessionToken(){return this.sessionToken}hasValidSessionToken(){return!!this.sessionToken&&!!this.sessionTokenExpiresAt&&this.sessionTokenExpiresAt-6e4>Date.now()}async establishSession(e,t,n){if(!t)return!1;try{let r=await fetch(this.channel(`${this.baseUrl}/v1/widget/session`),{method:`POST`,credentials:this.credentials,headers:{"Content-Type":`application/json`},body:JSON.stringify({agentId:e,tenantId:t,turnstileToken:n})});if(!r.ok)return!1;let i=await r.json();if(!i.success||typeof i.data?.token!=`string`)return!1;this.sessionToken=i.data.token;let a=typeof i.data.expiresIn==`number`?i.data.expiresIn:0;return this.sessionTokenExpiresAt=Date.now()+a*1e3,!0}catch{return!1}}async validateWidget(e,t){if(!t)return{valid:!1,error:`Widget is not configured: tenantId is required`};try{let n=new URLSearchParams({agentId:e,tenantId:t}),r=await fetch(this.channel(`${this.baseUrl}/v1/widget/validate?${n}`),{credentials:this.credentials}),i=await r.json();if(r.ok&&i.success)return{valid:!0,agentId:i.data.agentId,tenantId:i.data.tenantId};let a=i?.code===`AGENT_DISABLED`?`AGENT_DISABLED`:r.status===404?`AGENT_NOT_FOUND`:void 0;return{valid:!1,error:i.error??`Widget configuration is invalid (${r.status})`,...a?{code:a}:{}}}catch{return{valid:!1,error:`Unable to reach the KlicForge API to validate widget configuration`}}}async chat(e){let t=await fetch(this.channel(`${this.baseUrl}/v1/agents/${encodeURIComponent(e.agentId)}/responses`),{method:`POST`,credentials:this.credentials,headers:this.authHeaders(),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,attachments:e.attachments})});if(!t.ok)throw Error(`API error: ${t.status} ${t.statusText}`);let n=await t.json();if(!n.success)throw Error(n.error??`Unknown API error`);return{content:n.data?.text??``,sessionId:n.data?.sessionId,images:n.data?.images,documents:n.data?.documents,queued:!!n.data?.queued,controlMode:n.data?.controlMode}}async fetchSessionMessages(e,t){try{let 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;let i=await r.json();return i.success?i.data?.messages??null:null}catch{return null}}async uploadImage(e,t,n,r,i){let a=await fetch(this.channel(`${this.baseUrl}/v1/upload`),{method:`POST`,credentials:this.credentials,headers:this.authHeaders(),body:JSON.stringify({file:e,mimeType:t,fileName:n,agentId:r,tenantId:i})});if(!a.ok)throw Error(`Upload error: ${a.status} ${a.statusText}`);let o=await a.json();if(!o.success)throw Error(o.error??`Upload failed`);return{url:o.data.url}}async uploadFile(e,t,n,r,i){let a=await fetch(this.channel(`${this.baseUrl}/v1/upload`),{method:`POST`,credentials:this.credentials,headers:this.authHeaders(),body:JSON.stringify({file:e,mimeType:t,fileName:n,agentId:r,tenantId:i,kind:`file`})});if(!a.ok)throw Error(`Upload error: ${a.status} ${a.statusText}`);let o=await a.json();if(!o.success)throw Error(o.error??`Upload failed`);return{url:o.data.url}}async fetchWidgetConfig(e,t){try{let n=t?`?tenantId=${encodeURIComponent(t)}`:``,r=await fetch(this.channel(`${this.baseUrl}/v1/agents/${encodeURIComponent(e)}/widget-config${n}`),{credentials:this.credentials});if(!r.ok)return null;let i=await r.json();return i.success?i.data:null}catch{return null}}async endSession(e,t,n,r,i,a){let o=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:i,skipMemory:a})});if(!o.ok)throw Error(`Failed to end session: ${o.status} ${o.statusText}`);let s=await o.json();if(!s.success)throw Error(s.error??`Failed to end session`)}};async function*Si(e,t){if(!e.body)return;let n=e.body.getReader(),r=new TextDecoder,i=``,a=()=>{if(!t)return n.read();let e;return Promise.race([n.read(),new Promise((n,r)=>{e=setTimeout(()=>r(Error(`Stream timed out — no data received for ${t}ms`)),t)})]).finally(()=>clearTimeout(e))};for(;;){let{value:e,done:t}=await a();if(t)break;i+=r.decode(e,{stream:!0});let n=i.lastIndexOf(`
|
|
4
|
+
${t[c]?`🚫`:`➡️`} ${c}`}}}function fr(){for(var e=0,t=[`rec2020`,`p3`,`srgb`];e<t.length;e++){var n=t[e];if(matchMedia(`(color-gamut: ${n})`).matches)return n}}function pr(){if(mr(`inverted`))return!0;if(mr(`none`))return!1}function mr(e){return matchMedia(`(inverted-colors: ${e})`).matches}function hr(){if(gr(`active`))return!0;if(gr(`none`))return!1}function gr(e){return matchMedia(`(forced-colors: ${e})`).matches}var _r=100;function vr(){if(matchMedia(`(min-monochrome: 0)`).matches){for(var e=0;e<=_r;++e)if(matchMedia(`(max-monochrome: ${e})`).matches)return e;throw Error(`Too high value`)}}function yr(){if(br(`no-preference`))return 0;if(br(`high`)||br(`more`))return 1;if(br(`low`)||br(`less`))return-1;if(br(`forced`))return 10}function br(e){return matchMedia(`(prefers-contrast: ${e})`).matches}function xr(){if(Sr(`reduce`))return!0;if(Sr(`no-preference`))return!1}function Sr(e){return matchMedia(`(prefers-reduced-motion: ${e})`).matches}function Cr(){if(wr(`reduce`))return!0;if(wr(`no-preference`))return!1}function wr(e){return matchMedia(`(prefers-reduced-transparency: ${e})`).matches}function Tr(){if(Er(`high`))return!0;if(Er(`standard`))return!1}function Er(e){return matchMedia(`(dynamic-range: ${e})`).matches}var X=Math,Z=function(){return 0};function Dr(){var e=X.acos||Z,t=X.acosh||Z,n=X.asin||Z,r=X.asinh||Z,i=X.atanh||Z,a=X.atan||Z,o=X.sin||Z,s=X.sinh||Z,c=X.cos||Z,l=X.cosh||Z,u=X.tan||Z,d=X.tanh||Z,f=X.exp||Z,p=X.expm1||Z,m=X.log1p||Z;return{acos:e(.12312423423423424),acosh:t(1e308),acoshPf:function(e){return X.log(e+X.sqrt(e*e-1))}(1e154),asin:n(.12312423423423424),asinh:r(1),asinhPf:function(e){return X.log(e+X.sqrt(e*e+1))}(1),atanh:i(.5),atanhPf:function(e){return X.log((1+e)/(1-e))/2}(.5),atan:a(.5),sin:o(-1e300),sinh:s(1),sinhPf:function(e){return X.exp(e)-1/X.exp(e)/2}(1),cos:c(10.000000000123),cosh:l(1),coshPf:function(e){return(X.exp(e)+1/X.exp(e))/2}(1),tan:u(-1e300),tanh:d(1),tanhPf:function(e){return(X.exp(2*e)-1)/(X.exp(2*e)+1)}(1),exp:f(1),expm1:p(1),expm1Pf:function(e){return X.exp(e)-1}(1),log1p:m(10),log1pPf:function(e){return X.log(1+e)}(10),powPI:function(e){return X.pow(X.PI,e)}(-100)}}var Or=`mmMwWLliI0fiflO&1`,kr={default:[],apple:[{font:`-apple-system-body`}],serif:[{fontFamily:`serif`}],sans:[{fontFamily:`sans-serif`}],mono:[{fontFamily:`monospace`}],min:[{fontSize:`1px`}],system:[{fontFamily:`system-ui`}]};function Ar(){return jr(function(e,t){for(var n={},r={},i=0,a=Object.keys(kr);i<a.length;i++){var o=a[i],s=kr[o],c=s[0],l=c===void 0?{}:c,u=s[1],d=u===void 0?Or:u,f=e.createElement(`span`);f.textContent=d,f.style.whiteSpace=`nowrap`;for(var p=0,m=Object.keys(l);p<m.length;p++){var h=m[p],g=l[h];g!==void 0&&(f.style[h]=g)}n[o]=f,t.append(e.createElement(`br`),f)}for(var _=0,v=Object.keys(kr);_<v.length;_++){var o=v[_];r[o]=n[o].getBoundingClientRect().width}return r})}function jr(e,t){return t===void 0&&(t=4e3),fn(function(n,r){var i=r.document,a=i.body,o=a.style;o.width=`${t}px`,o.webkitTextSizeAdjust=o.textSizeAdjust=`none`,Gt()?a.style.zoom=`${1/r.devicePixelRatio}`:Y()&&(a.style.zoom=`reset`);var s=i.createElement(`div`);return s.textContent=pt([],Array(t/20|0),!0).map(function(){return`word`}).join(` `),a.appendChild(s),e(i,a)},`<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">`)}function Mr(){return navigator.pdfViewerEnabled}function Nr(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]-=e[0],t[3]}function Pr(){var e=window.ApplePaySession;if(typeof e?.canMakePayments!=`function`)return-1;if(Fr())return-3;try{return+!!e.canMakePayments()}catch(e){return Ir(e)}}var Fr=hn;function Ir(e){if(e instanceof Error&&e.name===`InvalidAccessError`&&/\bfrom\b.*\binsecure\b/i.test(e.message))return-2;throw e}function Lr(){var e=document.createElement(`a`),t=e.attributionSourceId??e.attributionsourceid;return t===void 0?void 0:String(t)}var Rr=-1,zr=-2,Br=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]),Vr=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),Hr=[`FRAGMENT_SHADER`,`VERTEX_SHADER`],Ur=[`LOW_FLOAT`,`MEDIUM_FLOAT`,`HIGH_FLOAT`,`LOW_INT`,`MEDIUM_INT`,`HIGH_INT`],Wr=`WEBGL_debug_renderer_info`,Gr=`WEBGL_polygon_mode`;function Kr(e){var t=e.cache,n=Jr(t);if(!n)return Rr;if(!ei(n))return zr;var r=Qr()?null:n.getExtension(Wr);return{version:n.getParameter(n.VERSION)?.toString()||``,vendor:n.getParameter(n.VENDOR)?.toString()||``,vendorUnmasked:r?n.getParameter(r.UNMASKED_VENDOR_WEBGL)?.toString():``,renderer:n.getParameter(n.RENDERER)?.toString()||``,rendererUnmasked:r?n.getParameter(r.UNMASKED_RENDERER_WEBGL)?.toString():``,shadingLanguageVersion:n.getParameter(n.SHADING_LANGUAGE_VERSION)?.toString()||``}}function qr(e){var t=e.cache,n=Jr(t);if(!n)return Rr;if(!ei(n))return zr;var r=n.getSupportedExtensions(),i=n.getContextAttributes(),a=[],o=[],s=[],c=[],l=[];if(i)for(var u=0,d=Object.keys(i);u<d.length;u++){var f=d[u];o.push(`${f}=${i[f]}`)}for(var p=Xr(n),m=0,h=p;m<h.length;m++){var g=h[m],_=n[g];s.push(`${g}=${_}${Br.has(_)?`=${n.getParameter(_)}`:``}`)}if(r)for(var v=0,y=r;v<y.length;v++){var b=y[v];if(!(b===Wr&&Qr()||b===Gr&&$r())){var x=n.getExtension(b);if(!x)a.push(b);else for(var S=0,C=Xr(x);S<C.length;S++){var g=C[S],_=x[g];c.push(`${g}=${_}${Vr.has(_)?`=${n.getParameter(_)}`:``}`)}}}for(var w=0,T=Hr;w<T.length;w++)for(var E=T[w],D=0,O=Ur;D<O.length;D++){var ee=O[D],k=Yr(n,E,ee);l.push(`${E}.${ee}=${k.join(`,`)}`)}return c.sort(),s.sort(),{contextAttributes:o,parameters:s,shaderPrecisions:l,extensions:r,extensionParameters:c,unsupportedExtensions:a}}function Jr(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,i=[`webgl`,`experimental-webgl`];r<i.length;r++){var a=i[r];try{n=t.getContext(a)}catch{}if(n)break}return e.webgl={context:n},n}function Yr(e,t,n){var r=e.getShaderPrecisionFormat(e[t],e[n]);return r?[r.rangeMin,r.rangeMax,r.precision]:[]}function Xr(e){return Object.keys(e.__proto__).filter(Zr)}function Zr(e){return typeof e==`string`&&!e.match(/[^A-Z0-9_x]/)}function Qr(){return Jt()}function $r(){return Gt()||Y()}function ei(e){return typeof e.getParameter==`function`}function ti(){if(!(nn()||Y()))return-2;if(!window.AudioContext)return-1;var e=new AudioContext().baseLatency;return e==null?-1:isFinite(e)?e:-3}function ni(){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 ri={fonts:bn,domBlockers:sr,fontPreferences:Ar,audio:an,screenFrame:Gn,canvas:Sn,osCpu:Nn,languages:Pn,colorDepth:Fn,deviceMemory:In,screenResolution:Ln,hardwareConcurrency:Jn,timezone:Yn,sessionStorage:Zn,localStorage:Qn,indexedDB:$n,openDatabase:er,cpuClass:tr,platform:nr,plugins:xn,touchSupport:Mn,vendor:rr,vendorFlavors:ir,cookiesEnabled:ar,colorGamut:fr,invertedColors:pr,forcedColors:hr,monochrome:vr,contrast:yr,reducedMotion:xr,reducedTransparency:Cr,hdr:Tr,math:Dr,pdfViewerEnabled:Mr,architecture:Nr,applePay:Pr,privateClickMeasurement:Lr,audioBaseLatency:ti,dateTimeLocale:ni,webGlBasics:Kr,webGlExtensions:qr};function ii(e){return Ht(ri,e,[])}var ai=`$ if upgrade to Pro: https://fpjs.dev/pro`;function oi(e){var t=si(e),n=ci(t);return{score:t,comment:ai.replace(/\$/g,`${n}`)}}function si(e){if(nn())return .4;if(Y())return Kt()&&!(Qt()&&qt())?.5:.3;var t=`value`in e.platform?e.platform.value:``;return/^Win/.test(t)?.6:/^Mac/.test(t)?.5:.7}function ci(e){return Tt(.99+.01*e,1e-4)}function li(e){for(var t=``,n=0,r=Object.keys(e).sort();n<r.length;n++){var i=r[n],a=e[i],o=`error`in a?`error`:JSON.stringify(a.value);t+=`${t?`|`:``}${i.replace(/([:|\\])/g,`\\$1`)}:${o}`}return t}function ui(e){return JSON.stringify(e,function(e,t){return t instanceof Error?Rt(t):t},2)}function di(e){return Lt(li(e))}function fi(e){var t;return{get visitorId(){return t===void 0&&(t=di(this.components)),t},set visitorId(e){t=e},confidence:oi(e),components:e,version:mt}}function pi(e){return e===void 0&&(e=50),_t(e,e*2)}function mi(e,t){return{get:function(n){return B(this,void 0,void 0,function(){var r,i;return V(this,function(a){switch(a.label){case 0:return[4,e()];case 1:return r=a.sent(),i=fi(r),t||n?.debug,[2,i]}})})}}}function hi(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var e=new XMLHttpRequest;e.open(`get`,`https://m1.openfpcdn.io/fingerprintjs/v${mt}/npm-monitoring`,!0),e.send()}catch{}}function gi(e){return e===void 0&&(e={}),B(this,void 0,void 0,function(){var t,n,r;return V(this,function(i){switch(i.label){case 0:return(e.monitoring??!0)&&hi(),t=e.delayFallback,n=e.debug,[4,pi(t)];case 1:return i.sent(),r=ii({cache:{},debug:n}),[2,mi(r,n)]}})})}var _i={load:gi,hashComponents:di,componentsToDebugString:ui};function vi(e){return e.preview?`include`:`same-origin`}function yi(e){return e.sessionToken?{"x-widget-session-token":e.sessionToken}:{}}function bi(e,t){return t.configChannel===`draft`?`${e}${e.includes(`?`)?`&`:`?`}configChannel=draft`:e}var xi=class{baseUrl;options;sessionToken;sessionTokenExpiresAt;constructor(e,t={}){this.baseUrl=e,this.options=t}get credentials(){return vi(this.options)}channel(e){return bi(e,this.options)}authHeaders(){return{"Content-Type":`application/json`,...yi({sessionToken:this.sessionToken})}}getSessionToken(){return this.sessionToken}hasValidSessionToken(){return!!this.sessionToken&&!!this.sessionTokenExpiresAt&&this.sessionTokenExpiresAt-6e4>Date.now()}async establishSession(e,t,n){if(!t)return!1;try{let r=await fetch(this.channel(`${this.baseUrl}/v1/widget/session`),{method:`POST`,credentials:this.credentials,headers:{"Content-Type":`application/json`},body:JSON.stringify({agentId:e,tenantId:t,turnstileToken:n})});if(!r.ok)return!1;let i=await r.json();if(!i.success||typeof i.data?.token!=`string`)return!1;this.sessionToken=i.data.token;let a=typeof i.data.expiresIn==`number`?i.data.expiresIn:0;return this.sessionTokenExpiresAt=Date.now()+a*1e3,!0}catch{return!1}}async validateWidget(e,t){if(!t)return{valid:!1,error:`Widget is not configured: tenantId is required`};try{let n=new URLSearchParams({agentId:e,tenantId:t}),r=await fetch(this.channel(`${this.baseUrl}/v1/widget/validate?${n}`),{credentials:this.credentials}),i=await r.json();if(r.ok&&i.success)return{valid:!0,agentId:i.data.agentId,tenantId:i.data.tenantId};let a=i?.code===`AGENT_DISABLED`?`AGENT_DISABLED`:r.status===404?`AGENT_NOT_FOUND`:void 0;return{valid:!1,error:i.error??`Widget configuration is invalid (${r.status})`,...a?{code:a}:{}}}catch{return{valid:!1,error:`Unable to reach the KlicForge API to validate widget configuration`}}}async chat(e){let t=await fetch(this.channel(`${this.baseUrl}/v1/agents/${encodeURIComponent(e.agentId)}/responses`),{method:`POST`,credentials:this.credentials,headers:this.authHeaders(),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,attachments:e.attachments})});if(!t.ok)throw Error(`API error: ${t.status} ${t.statusText}`);let n=await t.json();if(!n.success)throw Error(n.error??`Unknown API error`);return{content:n.data?.text??``,sessionId:n.data?.sessionId,images:n.data?.images,documents:n.data?.documents,queued:!!n.data?.queued,controlMode:n.data?.controlMode}}async fetchSessionMessages(e,t){try{let 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;let i=await r.json();return i.success?i.data?.messages??null:null}catch{return null}}async uploadImage(e,t,n,r,i){let a=await fetch(this.channel(`${this.baseUrl}/v1/upload`),{method:`POST`,credentials:this.credentials,headers:this.authHeaders(),body:JSON.stringify({file:e,mimeType:t,fileName:n,agentId:r,tenantId:i})});if(!a.ok)throw Error(`Upload error: ${a.status} ${a.statusText}`);let o=await a.json();if(!o.success)throw Error(o.error??`Upload failed`);return{url:o.data.url}}async uploadFile(e,t,n,r,i){let a=await fetch(this.channel(`${this.baseUrl}/v1/upload`),{method:`POST`,credentials:this.credentials,headers:this.authHeaders(),body:JSON.stringify({file:e,mimeType:t,fileName:n,agentId:r,tenantId:i,kind:`file`})});if(!a.ok)throw Error(`Upload error: ${a.status} ${a.statusText}`);let o=await a.json();if(!o.success)throw Error(o.error??`Upload failed`);return{url:o.data.url}}async uploadVoiceNote(e,t,n,r,i){let a=await fetch(this.channel(`${this.baseUrl}/v1/upload`),{method:`POST`,credentials:this.credentials,headers:this.authHeaders(),body:JSON.stringify({file:e,mimeType:t,fileName:n,agentId:r,tenantId:i,kind:`audio`})});if(!a.ok)throw Error(`Upload error: ${a.status} ${a.statusText}`);let o=await a.json();if(!o.success)throw Error(o.error??`Upload failed`);return{url:o.data.url}}async fetchWidgetConfig(e,t){try{let n=t?`?tenantId=${encodeURIComponent(t)}`:``,r=await fetch(this.channel(`${this.baseUrl}/v1/agents/${encodeURIComponent(e)}/widget-config${n}`),{credentials:this.credentials});if(!r.ok)return null;let i=await r.json();return i.success?i.data:null}catch{return null}}async endSession(e,t,n,r,i,a){let o=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:i,skipMemory:a})});if(!o.ok)throw Error(`Failed to end session: ${o.status} ${o.statusText}`);let s=await o.json();if(!s.success)throw Error(s.error??`Failed to end session`)}};async function*Si(e,t){if(!e.body)return;let n=e.body.getReader(),r=new TextDecoder,i=``,a=()=>{if(!t)return n.read();let e;return Promise.race([n.read(),new Promise((n,r)=>{e=setTimeout(()=>r(Error(`Stream timed out — no data received for ${t}ms`)),t)})]).finally(()=>clearTimeout(e))};for(;;){let{value:e,done:t}=await a();if(t)break;i+=r.decode(e,{stream:!0});let n=i.lastIndexOf(`
|
|
5
5
|
`);if(n===-1)continue;let o=i.slice(0,n);i=i.slice(n+1);for(let e of o.split(`
|
|
6
|
-
`)){let t=e.trim();if(!t.startsWith(`data:`))continue;let n=t.slice(5).trim();n&&(yield n)}}}var Ci=12e4;async function wi(e,t,n,r={}){let i=``,a=!1;try{let o=await fetch(bi(`${e}/v1/agents/${encodeURIComponent(t.agentId)}/responses:stream`,r),{method:`POST`,credentials:vi(r),headers:{"Content-Type":`application/json`,...yi(r)},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,attachments:t.attachments})});if(!o.ok||!o.body){let e=`${o.status} ${o.statusText}`;try{let t=await o.json();t.error&&(e=t.error)}catch{}throw Object.assign(Error(e),{status:o.status})}let s=o.headers.get(`x-session-id`);s&&n.onSession&&n.onSession(s);let c=o.headers.get(`x-run-id`);c&&n.onRunId&&(a=!0,n.onRunId(c));let l=e=>{if(e===`[DONE]`)return n.onEnd(i),!0;try{let t=JSON.parse(e);if(!a&&typeof t.runId==`string`&&n.onRunId&&(a=!0,n.onRunId(t.runId)),t.type===`session`){let e=t.sessionId;return e&&n.onSession&&n.onSession(e),!1}if(t.type===`done`||t.type===`stop`)return n.onEnd(i),!0;if(t.type===`error`)throw Error(t.message??`Stream error`);if(t.type===`images`){let e=t.images;return e&&n.onImages&&n.onImages(e),!1}if(t.type===`documents`){let e=t.documents;return e&&n.onDocuments&&n.onDocuments(e),!1}if(t.type===`control_mode`){let e=t.mode,r=!!t.queued;return e&&n.onControlMode&&n.onControlMode(e,r),r?(n.onEnd(i),!0):!1}if(t.type===`tool_calls_started`){let e=t.toolNames??[];return i.length>0&&!i.endsWith(`
|
|
6
|
+
`)){let t=e.trim();if(!t.startsWith(`data:`))continue;let n=t.slice(5).trim();n&&(yield n)}}}var Ci=12e4;async function wi(e,t,n,r={}){let i=``,a=!1;try{let o=await fetch(bi(`${e}/v1/agents/${encodeURIComponent(t.agentId)}/responses:stream`,r),{method:`POST`,credentials:vi(r),headers:{"Content-Type":`application/json`,...yi(r)},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,attachments:t.attachments})});if(!o.ok||!o.body){let e=`${o.status} ${o.statusText}`;try{let t=await o.json();t.error&&(e=t.error)}catch{}throw Object.assign(Error(e),{status:o.status})}let s=o.headers.get(`x-session-id`);s&&n.onSession&&n.onSession(s);let c=o.headers.get(`x-run-id`);c&&n.onRunId&&(a=!0,n.onRunId(c));let l=e=>{if(e===`[DONE]`)return n.onEnd(i),!0;try{let t=JSON.parse(e);if(!a&&typeof t.runId==`string`&&n.onRunId&&(a=!0,n.onRunId(t.runId)),t.type===`session`){let e=t.sessionId;return e&&n.onSession&&n.onSession(e),!1}if(t.type===`done`||t.type===`stop`)return n.onEnd(i),!0;if(t.type===`error`)throw Error(t.message??`Stream error`);if(t.type===`images`){let e=t.images;return e&&n.onImages&&n.onImages(e),!1}if(t.type===`documents`){let e=t.documents;return e&&n.onDocuments&&n.onDocuments(e),!1}if(t.type===`voice_transcript`){let e=t.transcript;return e&&n.onVoiceTranscript&&n.onVoiceTranscript(e),!1}if(t.type===`control_mode`){let e=t.mode,r=!!t.queued;return e&&n.onControlMode&&n.onControlMode(e,r),r?(n.onEnd(i),!0):!1}if(t.type===`tool_calls_started`){let e=t.toolNames??[];return i.length>0&&!i.endsWith(`
|
|
7
7
|
|
|
8
8
|
`)&&(i=i.replace(/\s+$/,``)+`
|
|
9
9
|
|
|
10
10
|
`,n.onDelta(`
|
|
11
11
|
|
|
12
|
-
`,i)),n.onToolCallsStarted?.(e,t.activityMode),!1}if(t.type===`assistant_ack`){let e=t.text;return e&&n.onAck&&n.onAck(e),!1}if(t.type===`progress`){let e=t.stage,r=t.text,i=t.mode,a=t.timestamp;return e&&r&&n.onProgress&&n.onProgress(e,r,i,a),!1}if(t.type===`tool_start`){let e=t.toolId,r=t.text,i=t.toolName,a=t.mode,o=t.timestamp;return e&&r&&n.onToolStart&&n.onToolStart(e,r,i,a,o),!1}if(t.type===`tool_complete`){let e=t.toolId,r=t.text,i=t.durationMs,a=t.ok;return e&&r&&n.onToolComplete&&n.onToolComplete(e,r,i??0,a),!1}if(t.type===`model_start`||t.type===`final_meta`){if(t.type===`final_meta`&&n.onFinalMeta){let e=t.metrics;n.onFinalMeta(e??{},{mode:t.mode,collapseAfterFinal:t.collapseAfterFinal})}return!1}let r=Ti(t);r&&(i+=r,n.onDelta(r,i))}catch(e){if(!(e instanceof SyntaxError))throw e}return!1};for await(let e of Si(o,Ci))if(l(e))break;n.onEnd(i)}catch(e){n.onError(e instanceof Error?e:Error(String(e)))}}function Ti(e){let t=e.choices;if(Array.isArray(t)&&t.length>0){let e=t[0]?.delta,n=e?.content??e?.text??``;if(n)return n}let n=e.delta;if(n){let e=n.content??n.text??``;if(e)return e}return e.response||(e.text??e.content??``)}function Ei(e,t,n){let r=t*2**(e-1),i=Math.min(r,n),a=i*.3;return Math.floor(i-a+a*2*Math.random())}async function Di(e,t,n,r={}){let i=await fetch(`${e}/v1/sessions/${encodeURIComponent(t)}/runs/${encodeURIComponent(n)}`,{credentials:r.preview?`include`:`same-origin`});if(!i.ok)throw Error(`Failed to fetch run ${n}: ${i.status}`);let a=await i.json();if(!a.success||!a.data)throw Error(a.error??`Failed to fetch run ${n}`);return a.data}async function Oi(e,t,n,r={}){let i=r.maxAttempts??3,a;for(let o=1;o<=i;o++){if(o>1){let e=Ei(o-1,500,4e3);await new Promise(t=>setTimeout(t,e))}try{let a=await Di(e,t,n,r);if(a.status!==`running`||o===i)return a}catch(e){if(a=e instanceof Error?e:Error(String(e)),o===i)throw a}}throw a??Error(`Failed to fetch run ${n}`)}var ki=15e3,Q,Ai,ji,Mi,Ni=[];function Pi(){Mi||(Mi=e=>{if(!Q||e.source!==Q.contentWindow||ji&&e.origin!==ji)return;let t=e.data;!t||typeof t.type!=`string`||(t.type===`turnstile-token`&&typeof t.token==`string`?Ni.shift()?.resolve(t.token):t.type===`turnstile-error`&&Ni.shift()?.reject(Error(t.message??`Turnstile verification failed`)))},window.addEventListener(`message`,Mi))}function Fi(){Q?.remove(),Q=void 0,Ai=void 0}function Ii(e){if(Q&&Ai)return Ai;if(typeof window>`u`||typeof document>`u`)return Promise.reject(Error(`Turnstile requires a browser environment`));Pi(),ji=new URL(e).origin;let t=document.createElement(`iframe`);return t.src=`${e.replace(/\/$/,``)}/v1/widget/turnstile-challenge`,t.style.display=`none`,t.setAttribute(`aria-hidden`,`true`),t.sandbox.add(`allow-scripts`,`allow-same-origin`),Ai=new Promise((e,n)=>{let r=setTimeout(()=>{window.removeEventListener(`message`,i),n(Error(`Turnstile challenge page failed to load`))},ki);function i(n){n.source===t.contentWindow&&n.data?.type===`turnstile-ready`&&(clearTimeout(r),window.removeEventListener(`message`,i),e())}window.addEventListener(`message`,i)}).catch(e=>{throw Fi(),e}),Q=t,document.body.appendChild(t),Ai}async function Li(e){if(await Ii(e),!Q?.contentWindow)throw Error(`Turnstile challenge frame unavailable`);let t=Q.contentWindow,n=ji;return new Promise((e,r)=>{let i={resolve:t=>{clearTimeout(a),e(t)},reject:e=>{clearTimeout(a),r(e)}},a=setTimeout(()=>{let e=Ni.indexOf(i);e!==-1&&Ni.splice(e,1),r(Error(`Turnstile verification timed out`))},ki);Ni.push(i),t.postMessage({type:`turnstile-solve`},n)})}var Ri=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){let[t,n]=e;this.listeners.get(t)?.forEach(e=>e(n))}removeAllListeners(){this.listeners.clear()}},zi=`agentforge`;function Bi(e){return`${zi}:session:${e}`}function Vi(e){try{return sessionStorage.getItem(Bi(e))??void 0}catch{return}}function Hi(e,t){try{sessionStorage.setItem(Bi(e),t)}catch{}}function Ui(e){try{sessionStorage.removeItem(Bi(e))}catch{}}function Wi(e,t,n){return e.map(e=>{if(e.status!==`active`||e.stage===`calling_tool`)return e;let r=n!==void 0&&e.serverTsMs!==void 0&&Number.isFinite(n)&&Number.isFinite(e.serverTsMs)&&n>=e.serverTsMs?n-e.serverTsMs:void 0;return{...e,status:`done`,durationMs:e.durationMs??r??(e.startedAtMs?t-e.startedAtMs:void 0)}})}function Gi(e){let t=Date.now();return e.map(e=>e.status===`active`?{...e,status:`done`,durationMs:e.durationMs??(e.startedAtMs?t-e.startedAtMs:void 0)}:e)}function Ki(e){if(e==null||e<1e3)return null;if(e<1e4)return`${(e/1e3).toFixed(1)}s`;if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.floor(e/6e4),n=Math.round(e%6e4/1e3);return n>0?`${t}m ${n}s`:`${t}m`}function qi(){return`msg-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`}var Ji=2e3,Yi=class{hostConfig;onStateChange;sessionTokenPromise;config;apiClient;state;fingerprint;eventSource=null;emitter;constructor(e,t,n){this.hostConfig=t,this.onStateChange=n,this.config=e,this.apiClient=new xi(e.apiBaseUrl,{preview:e.preview,configChannel:e.configChannel}),this.emitter=new Ri,this.initializeFingerprint();let r=e.sessionId??Vi(e.agentId);e.sessionId&&Hi(e.agentId,e.sessionId);let i=e.mode===`inline`;this.state={isOpen:i,messages:[],isLoading:!1,error:null,sessionId:r,initStatus:`validating`,initError:null},i&&queueMicrotask(()=>this.openWithGreeting())}reportError(e,t){try{fetch(`${this.config.apiBaseUrl.replace(/\/$/,``)}/v1/widget/errors`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({message:e,stack:t?.stack,agentId:this.config.agentId,tenantId:this.config.tenantId,sessionId:this.state.sessionId??this.fingerprint,url:typeof location<`u`?location.href:void 0})}).catch(()=>{})}catch{}}async initializeFingerprint(){try{let e=await(await _i.load()).get();this.fingerprint=e.visitorId}catch{this.fingerprint=void 0}}getState(){return{...this.state,messages:[...this.state.messages]}}setOpen(e){e?(this.ensureSessionToken(),this.openWithGreeting()):this.setState({isOpen:!1})}openWithGreeting(){this.state.initStatus===`error`||this.state.initStatus===`disabled`||this.setState({isOpen:!0})}async hydrate(){let 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){let e=await this.apiClient.fetchWidgetConfig(this.config.agentId,this.config.tenantId);e&&(this.config=dt(this.hostConfig,e),this.onStateChange(this.getState(),this.config))}if(this.setState({initStatus:`ready`}),!this.state.sessionId)return;this.openEventStream();let t=await this.apiClient.fetchSessionMessages(this.state.sessionId,this.config.tenantId);if(t===null){this.handleSessionExpired();return}if(t.length===0)return;let n=t.map(e=>{let t=e.direction===`human`,n=e.role===`user`,r=n?(e.media??[]).map(e=>({url:e.url,mimeType:e.mimeType,fileName:e.fileName,kind:e.mimeType.startsWith(`image/`)?`image`:`file`})):void 0;return{id:qi(),role:e.role,content:e.content,images:!n&&e.images&&e.images.length>0?e.images:void 0,uploadedAttachments:r&&r.length>0?r:void 0,uploadedImageUrl:e.imageUrl||void 0,createdAt:e.createdAt??new Date().toISOString(),status:`sent`,...t?{isHuman:!0,senderDisplay:e.senderDisplay??null}:{}}});this.setState({messages:[...this.state.messages,...n]})}openEventStream(){if(typeof EventSource>`u`||!this.state.sessionId||this.eventSource)return;let e=`${this.config.apiBaseUrl.replace(/\/$/,``)}/v1/sessions/${encodeURIComponent(this.state.sessionId)}/events`,t=new EventSource(e);t.onmessage=e=>{try{let t=JSON.parse(e.data);if(t.type===`control_mode`){let e=t.mode;this.setState({controlMode:e}),this.emitter.emit(`control_mode_changed`,{mode:e});return}if(t.type===`execution_state`){let e=t.state;e===`ai_thinking`||e===`ai_streaming`||e===`tool_running`?this.setState({isLoading:!0}):e===`idle`&&this.setState({isLoading:!1});return}if(t.type===`message`&&t.message&&typeof t.message==`object`){let e=t.message;if(typeof e.content!=`string`||e.id&&this.state.messages.some(t=>t.id===e.id))return;if(e.direction===`human`){let t={id:e.id??qi(),role:`assistant`,content:e.content,createdAt:e.createdAt??new Date().toISOString(),status:`sent`,isHuman:!0,senderDisplay:e.senderDisplay??null};this.setState({messages:[...this.state.messages,t],isLoading:!1}),this.emitter.emit(`message:received`,t);return}if(e.direction===`ai`){let t={id:e.id??qi(),role:`assistant`,content:e.content,createdAt:e.createdAt??new Date().toISOString(),status:`sent`};this.setState({messages:[...this.state.messages,t],isLoading:!1}),this.emitter.emit(`message:received`,t);return}}}catch{}},t.onerror=()=>{},this.eventSource=t}closeEventStream(){this.eventSource&&=(this.eventSource.close(),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,!0)}catch{}Ui(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(){Ui(this.config.agentId),this.closeEventStream(),this.setState({sessionId:void 0,controlMode:void 0})}async sendMessage(e,t){let n=!!e.trim()||t&&t.length>0;if(this.state.isLoading||!n||this.state.initStatus!==`ready`)return;let r=[];if(t&&t.length>0)for(let e of t)try{let t=await Zi(e.file);if(e.kind===`image`){let n=await this.apiClient.uploadImage(t,e.file.type,e.file.name,this.config.agentId,this.config.tenantId);r.push({url:n.url,mimeType:e.file.type,fileName:e.file.name,kind:`image`})}else{let n=await this.apiClient.uploadFile(t,e.file.type||`application/octet-stream`,e.file.name,this.config.agentId,this.config.tenantId);r.push({url:n.url,mimeType:e.file.type||`application/octet-stream`,fileName:e.file.name,kind:`file`})}}catch(e){let t=e instanceof Error?e.message:`Attachment upload failed`;this.setState({error:t});return}let i=r.filter(e=>e.kind===`image`),a={id:qi(),role:`user`,content:e.trim(),uploadedImageUrl:i[0]?.url,uploadedAttachments:r.length>0?r:void 0,createdAt:new Date().toISOString(),status:`sent`},o=!this.state.messages.some(e=>e.role===`user`);this.setState({messages:[...this.state.messages,a],isLoading:!0,error:null}),this.emitter.emit(`message:sent`,a),o&&this.emitter.emit(`conversation:started`,{sessionId:this.state.sessionId});let s=r.length>0?r:void 0;this.config.streaming?await this.sendStreaming(e.trim(),void 0,s):await this.sendNonStreaming(e.trim(),void 0,s)}ensureSessionToken(){return!this.config.turnstileSiteKey||this.apiClient.hasValidSessionToken()?Promise.resolve():(this.sessionTokenPromise??=(async()=>{try{let e=await Li(this.config.apiBaseUrl);await this.apiClient.establishSession(this.config.agentId,this.config.tenantId,e)}catch{}finally{this.sessionTokenPromise=void 0}})(),this.sessionTokenPromise)}async awaitSessionToken(){if(!this.config.turnstileSiteKey||this.apiClient.hasValidSessionToken())return;let e;await Promise.race([this.ensureSessionToken(),new Promise(t=>{e=setTimeout(t,Ji)})]).finally(()=>clearTimeout(e))}async sendNonStreaming(e,t,n,r=!1){await this.awaitSessionToken();try{let 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,attachments:n});if(r.queued&&r.controlMode===`human`){this.setState({isLoading:!1,controlMode:`human_takeover`,...r.sessionId?{sessionId:r.sessionId}:{}}),r.sessionId&&(Hi(this.config.agentId,r.sessionId),this.openEventStream());return}let i={id:qi(),role:`assistant`,content:r.content,images:r.images,documents:r.documents,createdAt:new Date().toISOString(),status:`sent`};this.setState({messages:[...this.state.messages,i],isLoading:!1,...r.sessionId?{sessionId:r.sessionId}:{}}),r.sessionId&&(Hi(this.config.agentId,r.sessionId),this.openEventStream()),this.emitter.emit(`message:received`,i)}catch(i){let a=i instanceof Error?i.message:`Failed to send message`;if(!r&&a.includes(`410`))return this.handleSessionExpired(),this.sendNonStreaming(e,t,n,!0);this.setState({isLoading:!1,error:a}),this.emitter.emit(`message:error`,{error:a,message:null}),this.reportError(a)}}async sendStreaming(e,t,n,r=!1){await this.awaitSessionToken();let i=qi(),a={id:i,role:`assistant`,content:``,createdAt:new Date().toISOString(),status:`streaming`};this.setState({messages:[...this.state.messages,a]}),this.emitter.emit(`stream:start`);let o=!1,s=!1,c=null,l=null,u=Date.now(),d=null;await wi(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,attachments:n},{onSession:e=>{this.setState({sessionId:e}),Hi(this.config.agentId,e),this.openEventStream()},onRunId:e=>{this.updateMessage(i,{runId:e})},onImages:e=>{this.updateMessage(i,{images:e})},onDocuments:e=>{this.updateMessage(i,{documents:e})},onToolCallsStarted:(e,t)=>{t&&c===null&&(c=t),d=null,this.updateMessage(i,{answerStartedAtMs:null}),(t??c)!==`off`&&this.updateMessage(i,{toolStatus:Xi(e)})},onAck:e=>{this.updateMessage(i,{ackText:e})},onProgress:(e,t,n,r)=>{let a=this.state.messages.find(e=>e.id===i)?.progressEvents??[],o=Date.now(),s=r?Date.parse(r):NaN,l=Number.isNaN(s)?void 0:s;n&&c===null&&(c=n,this.updateMessage(i,{turnMeta:{totalMs:null,collapseAfterFinal:null,mode:n}})),this.updateMessage(i,{progressEvents:[...Wi(a,o,l),{stage:e,text:t,timestamp:new Date().toISOString(),status:`active`,startedAtMs:o,serverTsMs:l}]})},onToolStart:(e,t,n,r,a)=>{let o=this.state.messages.find(e=>e.id===i)?.progressEvents??[],s=Date.now(),l=a?Date.parse(a):NaN,u=Number.isNaN(l)?void 0:l;r&&c===null&&(c=r,this.updateMessage(i,{turnMeta:{totalMs:null,collapseAfterFinal:null,mode:r}})),this.updateMessage(i,{progressEvents:[...Wi(o,s,u),{stage:`calling_tool`,toolId:e,toolName:n,text:t,timestamp:new Date().toISOString(),status:`active`,startedAtMs:s,serverTsMs:u}]})},onToolComplete:(e,t,n,r)=>{let a=this.state.messages.find(e=>e.id===i)?.progressEvents??[];this.updateMessage(i,{progressEvents:a.map(i=>i.stage===`calling_tool`&&i.status===`active`&&i.toolId===e?{...i,status:`done`,text:t,durationMs:n,ok:r}:i)})},onFinalMeta:(e,t)=>{c=t?.mode??c,l=t?.collapseAfterFinal??null},onDelta:(e,t)=>{e.trim()&&d===null&&(d=Date.now(),this.updateMessage(i,{answerStartedAtMs:d})),t.trim()&&(this.updateMessage(i,{content:t,toolStatus:void 0}),this.emitter.emit(`stream:delta`,{delta:e,accumulated:t}))},onEnd:e=>{if(s){this.setState({messages:this.state.messages.filter(e=>e.id!==i),isLoading:!1,controlMode:`human_takeover`}),this.emitter.emit(`stream:end`,{content:``});return}let t=this.state.messages.find(e=>e.id===i),n=c===`detailed`,r=n||c===`standard`;this.updateMessage(i,{content:e,status:`sent`,toolStatus:void 0,progressEvents:n&&t?.progressEvents?.length?Gi(t.progressEvents):void 0,progressCollapsed:n?l??!0:void 0,turnMeta:r?{totalMs:(d??Date.now())-u,collapseAfterFinal:l,mode:c}:void 0}),this.setState({isLoading:!1}),this.emitter.emit(`stream:end`,{content:e});let a=this.state.messages.find(e=>e.id===i);a&&this.emitter.emit(`message:received`,a)},onControlMode:(e,t)=>{t&&e===`human`&&(s=!0)},onError:e=>{if(!r&&e.status===410){o=!0,this.setState({messages:this.state.messages.filter(e=>e.id!==i),isLoading:!1});return}let t=t=>{let n=this.state.messages.find(e=>e.id===i)?.content??``;this.updateMessage(i,{content:n||t,status:`error`}),this.setState({isLoading:!1,error:t}),this.emitter.emit(`message:error`,{error:t,message:null}),this.reportError(t,{stack:e.stack})},n=e=>{this.updateMessage(i,{content:e,status:`sent`,toolStatus:void 0,progressEvents:void 0}),this.setState({isLoading:!1}),this.emitter.emit(`stream:end`,{content:e});let t=this.state.messages.find(e=>e.id===i);t&&this.emitter.emit(`message:received`,t)},a=this.state.messages.find(e=>e.id===i)?.runId,s=this.state.sessionId;if(a&&s){Oi(this.config.apiBaseUrl,s,a,{preview:this.config.preview}).then(r=>{r.status===`done`&&r.finalText?n(r.finalText):t(r.errorMessage||e.message||`Something went wrong. Please try again.`)}).catch(()=>t(e.message||`Something went wrong. Please try again.`));return}t(e.message||`Something went wrong. Please try again.`)}},{preview:this.config.preview,configChannel:this.config.configChannel,sessionToken:this.apiClient.getSessionToken()}),o&&(this.handleSessionExpired(),await this.sendStreaming(e,t,n,!0))}};function Xi(e){let t=e[0];if(!t)return`Working...`;let n=t.indexOf(`.`);return n>0?`Using ${t.slice(0,n).replace(/_/g,` `)}: ${t.slice(n+1).replace(/_/g,` `)}${e.length>1?` +${e.length-1}`:``}`:`Using ${t.replace(/_/g,` `)}`}function Zi(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let e=r.result;t(e.split(`,`)[1]??``)},r.onerror=()=>n(Error(`Failed to read file`)),r.readAsDataURL(e)})}function Qi(e){let t=document.createElement(`div`);t.setAttribute(`data-agentkit-widget`,``),e.appendChild(t);let n=t.attachShadow({mode:`open`}),r=document.createElement(`style`);n.appendChild(r);let i=document.createElement(`div`);return i.style.cssText=`display: contents;`,n.appendChild(i),{host:t,shadowRoot:n,styleSlot:r,mountPoint:i}}function $i(e,t){e.textContent=t}function ea(e){e.remove()}function ta(e){document.body?document.body.appendChild(e):document.addEventListener(`DOMContentLoaded`,()=>document.body.appendChild(e),{once:!0})}function na(){let 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(`; `),ta(e),e}function ra(e){getComputedStyle(e).position===`static`&&(e.style.position=`relative`);let 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 ia(e){return e.setAttribute(`data-agentkit-root`,`inline`),getComputedStyle(e).position===`static`&&(e.style.position=`relative`),e}function aa(e){e.remove()}function oa(e){e.removeAttribute(`data-agentkit-root`)}function sa(e,t,n,r,i){let a=e.mode===`inline`,o=!1,s=a&&i?ia(i):!a&&i?ra(i):na(),c=Qi(s);$i(c.styleSlot,r);let l=new Yi(e,t,(e,t)=>{o||u.update(e,t)}),u=n(c.mountPoint,e,l.getState(),{onOpen:()=>d.open(),onClose:()=>d.close(),onSendMessage:(e,t)=>{l.sendMessage(e,t)},onReset:()=>{l.resetConversation()}});l.hydrate(),setTimeout(()=>{o||l.emitter.emit(`ready`,l.getState())},0);let d={open(){o||(l.setOpen(!0),l.emitter.emit(`open`))},close(){o||(l.setOpen(!1),l.emitter.emit(`close`))},toggle(){l.getState().isOpen?d.close():d.open()},async sendMessage(e,t){await l.sendMessage(e,t)},reset(){o||(l.resetConversation(),l.emitter.emit(`reset`))},destroy(){o||(o=!0,l.closeEventStream(),u.destroy(),ea(c.host),a&&i?oa(i):aa(s),l.emitter.emit(`destroy`),l.emitter.removeAllListeners())},on(e,t){l.emitter.on(e,t)},off(e,t){l.emitter.off(e,t)},getState(){return l.getState()}};return d}var ca=new Map,la=0;function ua(e){let t=`agentkit-widget-${++la}`,n=e.destroy.bind(e);return e.destroy=()=>{ca.delete(t),n()},ca.set(t,e),t}function da(e,t,n){let r={...e,mode:`floating`},i=sa(dt(r),r,t,n);return ua(i),i}function fa(e,t,n,r){let i={...t,mode:`floating`},a=sa(dt(i),i,n,r,e);return ua(a),a}function pa(e,t,n,r){let i={...t,mode:`inline`},a=sa(dt(i),i,n,r,e);return ua(a),a}function ma(e){e?ca.get(e)?.destroy():(ca.forEach(e=>e.destroy()),ca.clear())}function ha(){return Array.from(ca.keys())}function ga(e){let{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 _a(e){return e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e}var va=`
|
|
12
|
+
`,i)),n.onToolCallsStarted?.(e,t.activityMode),!1}if(t.type===`assistant_ack`){let e=t.text;return e&&n.onAck&&n.onAck(e),!1}if(t.type===`progress`){let e=t.stage,r=t.text,i=t.mode,a=t.timestamp;return e&&r&&n.onProgress&&n.onProgress(e,r,i,a),!1}if(t.type===`tool_start`){let e=t.toolId,r=t.text,i=t.toolName,a=t.mode,o=t.timestamp;return e&&r&&n.onToolStart&&n.onToolStart(e,r,i,a,o),!1}if(t.type===`tool_complete`){let e=t.toolId,r=t.text,i=t.durationMs,a=t.ok;return e&&r&&n.onToolComplete&&n.onToolComplete(e,r,i??0,a),!1}if(t.type===`model_start`||t.type===`final_meta`){if(t.type===`final_meta`&&n.onFinalMeta){let e=t.metrics;n.onFinalMeta(e??{},{mode:t.mode,collapseAfterFinal:t.collapseAfterFinal})}return!1}let r=Ti(t);r&&(i+=r,n.onDelta(r,i))}catch(e){if(!(e instanceof SyntaxError))throw e}return!1};for await(let e of Si(o,Ci))if(l(e))break;n.onEnd(i)}catch(e){n.onError(e instanceof Error?e:Error(String(e)))}}function Ti(e){let t=e.choices;if(Array.isArray(t)&&t.length>0){let e=t[0]?.delta,n=e?.content??e?.text??``;if(n)return n}let n=e.delta;if(n){let e=n.content??n.text??``;if(e)return e}return e.response||(e.text??e.content??``)}function Ei(e,t,n){let r=t*2**(e-1),i=Math.min(r,n),a=i*.3;return Math.floor(i-a+a*2*Math.random())}async function Di(e,t,n,r={}){let i=await fetch(`${e}/v1/sessions/${encodeURIComponent(t)}/runs/${encodeURIComponent(n)}`,{credentials:r.preview?`include`:`same-origin`});if(!i.ok)throw Error(`Failed to fetch run ${n}: ${i.status}`);let a=await i.json();if(!a.success||!a.data)throw Error(a.error??`Failed to fetch run ${n}`);return a.data}async function Oi(e,t,n,r={}){let i=r.maxAttempts??3,a;for(let o=1;o<=i;o++){if(o>1){let e=Ei(o-1,500,4e3);await new Promise(t=>setTimeout(t,e))}try{let a=await Di(e,t,n,r);if(a.status!==`running`||o===i)return a}catch(e){if(a=e instanceof Error?e:Error(String(e)),o===i)throw a}}throw a??Error(`Failed to fetch run ${n}`)}var ki=15e3,Q,Ai,ji,Mi,Ni=[];function Pi(){Mi||(Mi=e=>{if(!Q||e.source!==Q.contentWindow||ji&&e.origin!==ji)return;let t=e.data;t&&typeof t.type==`string`&&(t.type===`turnstile-token`&&typeof t.token==`string`?Ni.shift()?.resolve(t.token):t.type===`turnstile-error`&&Ni.shift()?.reject(Error(t.message??`Turnstile verification failed`)))},window.addEventListener(`message`,Mi))}function Fi(){Q?.remove(),Q=void 0,Ai=void 0}function Ii(e){if(Q&&Ai)return Ai;if(typeof window>`u`||typeof document>`u`)return Promise.reject(Error(`Turnstile requires a browser environment`));Pi(),ji=new URL(e).origin;let t=document.createElement(`iframe`);return t.src=`${e.replace(/\/$/,``)}/v1/widget/turnstile-challenge`,t.style.display=`none`,t.setAttribute(`aria-hidden`,`true`),t.sandbox.add(`allow-scripts`,`allow-same-origin`),Ai=new Promise((e,n)=>{let r=setTimeout(()=>{window.removeEventListener(`message`,i),n(Error(`Turnstile challenge page failed to load`))},ki);function i(n){n.source===t.contentWindow&&n.data?.type===`turnstile-ready`&&(clearTimeout(r),window.removeEventListener(`message`,i),e())}window.addEventListener(`message`,i)}).catch(e=>{throw Fi(),e}),Q=t,document.body.appendChild(t),Ai}async function Li(e){if(await Ii(e),!Q?.contentWindow)throw Error(`Turnstile challenge frame unavailable`);let t=Q.contentWindow,n=ji;return new Promise((e,r)=>{let i={resolve:t=>{clearTimeout(a),e(t)},reject:e=>{clearTimeout(a),r(e)}},a=setTimeout(()=>{let e=Ni.indexOf(i);e!==-1&&Ni.splice(e,1),r(Error(`Turnstile verification timed out`))},ki);Ni.push(i),t.postMessage({type:`turnstile-solve`},n)})}var Ri=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){let[t,n]=e;this.listeners.get(t)?.forEach(e=>e(n))}removeAllListeners(){this.listeners.clear()}},zi=`agentforge`;function Bi(e){return`${zi}:session:${e}`}function Vi(e){try{return sessionStorage.getItem(Bi(e))??void 0}catch{return}}function Hi(e,t){try{sessionStorage.setItem(Bi(e),t)}catch{}}function Ui(e){try{sessionStorage.removeItem(Bi(e))}catch{}}function Wi(e,t,n){return e.map(e=>{if(e.status!==`active`||e.stage===`calling_tool`)return e;let r=n!==void 0&&e.serverTsMs!==void 0&&Number.isFinite(n)&&Number.isFinite(e.serverTsMs)&&n>=e.serverTsMs?n-e.serverTsMs:void 0;return{...e,status:`done`,durationMs:e.durationMs??r??(e.startedAtMs?t-e.startedAtMs:void 0)}})}function Gi(e){let t=Date.now();return e.map(e=>e.status===`active`?{...e,status:`done`,durationMs:e.durationMs??(e.startedAtMs?t-e.startedAtMs:void 0)}:e)}function Ki(e){if(e==null||e<1e3)return null;if(e<1e4)return`${(e/1e3).toFixed(1)}s`;if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.floor(e/6e4),n=Math.round(e%6e4/1e3);return n>0?`${t}m ${n}s`:`${t}m`}var qi=`[Voice note] `;function Ji(e,t){let n=t?.trim();return n?`${qi}${e}\n\n${n}`:`${qi}${e}`}function Yi(e){if(!e.startsWith(`[Voice note] `))return null;let t=e.slice(13),n=t.indexOf(`
|
|
13
|
+
|
|
14
|
+
`);return n===-1?{transcript:t,rest:``}:{transcript:t.slice(0,n),rest:t.slice(n+2)}}function Xi(){return`msg-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`}var Zi=2e3,Qi=class{hostConfig;onStateChange;sessionTokenPromise;config;apiClient;state;fingerprint;eventSource=null;emitter;constructor(e,t,n){this.hostConfig=t,this.onStateChange=n,this.config=e,this.apiClient=new xi(e.apiBaseUrl,{preview:e.preview,configChannel:e.configChannel}),this.emitter=new Ri,this.initializeFingerprint();let r=e.sessionId??Vi(e.agentId);e.sessionId&&Hi(e.agentId,e.sessionId);let i=e.mode===`inline`;this.state={isOpen:i,messages:[],isLoading:!1,error:null,sessionId:r,initStatus:`validating`,initError:null},i&&queueMicrotask(()=>this.openWithGreeting())}reportError(e,t){try{fetch(`${this.config.apiBaseUrl.replace(/\/$/,``)}/v1/widget/errors`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({message:e,stack:t?.stack,agentId:this.config.agentId,tenantId:this.config.tenantId,sessionId:this.state.sessionId??this.fingerprint,url:typeof location<`u`?location.href:void 0})}).catch(()=>{})}catch{}}async initializeFingerprint(){try{let e=await(await _i.load()).get();this.fingerprint=e.visitorId}catch{this.fingerprint=void 0}}getState(){return{...this.state,messages:[...this.state.messages]}}setOpen(e){e?(this.ensureSessionToken(),this.openWithGreeting()):this.setState({isOpen:!1})}openWithGreeting(){this.state.initStatus!==`error`&&this.state.initStatus!==`disabled`&&this.setState({isOpen:!0})}async hydrate(){let 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){let e=await this.apiClient.fetchWidgetConfig(this.config.agentId,this.config.tenantId);e&&(this.config=ut(this.hostConfig,e),this.onStateChange(this.getState(),this.config))}if(this.setState({initStatus:`ready`}),!this.state.sessionId)return;this.openEventStream();let t=await this.apiClient.fetchSessionMessages(this.state.sessionId,this.config.tenantId);if(t===null){this.handleSessionExpired();return}if(t.length===0)return;let n=t.map(e=>{let t=e.direction===`human`,n=e.role===`user`,r=n?(e.media??[]).map(e=>({url:e.url,mimeType:e.mimeType,fileName:e.fileName,kind:e.mimeType.startsWith(`image/`)?`image`:e.mimeType.startsWith(`audio/`)?`audio`:`file`})):void 0;return{id:Xi(),role:e.role,content:e.content,images:!n&&e.images&&e.images.length>0?e.images:void 0,uploadedAttachments:r&&r.length>0?r:void 0,uploadedImageUrl:e.imageUrl||void 0,createdAt:e.createdAt??new Date().toISOString(),status:`sent`,...t?{isHuman:!0,senderDisplay:e.senderDisplay??null}:{}}});this.setState({messages:[...this.state.messages,...n]})}openEventStream(){if(typeof EventSource>`u`||!this.state.sessionId||this.eventSource)return;let e=`${this.config.apiBaseUrl.replace(/\/$/,``)}/v1/sessions/${encodeURIComponent(this.state.sessionId)}/events`,t=new EventSource(e);t.onmessage=e=>{try{let t=JSON.parse(e.data);if(t.type===`control_mode`){let e=t.mode;this.setState({controlMode:e}),this.emitter.emit(`control_mode_changed`,{mode:e});return}if(t.type===`execution_state`){let e=t.state;e===`ai_thinking`||e===`ai_streaming`||e===`tool_running`?this.setState({isLoading:!0}):e===`idle`&&this.setState({isLoading:!1});return}if(t.type===`message`&&t.message&&typeof t.message==`object`){let e=t.message;if(typeof e.content!=`string`||e.id&&this.state.messages.some(t=>t.id===e.id))return;if(e.direction===`human`){let t={id:e.id??Xi(),role:`assistant`,content:e.content,createdAt:e.createdAt??new Date().toISOString(),status:`sent`,isHuman:!0,senderDisplay:e.senderDisplay??null};this.setState({messages:[...this.state.messages,t],isLoading:!1}),this.emitter.emit(`message:received`,t);return}if(e.direction===`ai`){let t={id:e.id??Xi(),role:`assistant`,content:e.content,createdAt:e.createdAt??new Date().toISOString(),status:`sent`};this.setState({messages:[...this.state.messages,t],isLoading:!1}),this.emitter.emit(`message:received`,t);return}}}catch{}},t.onerror=()=>{},this.eventSource=t}closeEventStream(){this.eventSource&&=(this.eventSource.close(),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,!0)}catch{}Ui(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(){Ui(this.config.agentId),this.closeEventStream(),this.setState({sessionId:void 0,controlMode:void 0})}async sendMessage(e,t){let n=!!e.trim()||t&&t.length>0;if(this.state.isLoading||!n||this.state.initStatus!==`ready`)return;let r=[];if(t&&t.length>0)for(let e of t)try{let t=await ea(e.file);if(e.kind===`image`){let n=await this.apiClient.uploadImage(t,e.file.type,e.file.name,this.config.agentId,this.config.tenantId);r.push({url:n.url,mimeType:e.file.type,fileName:e.file.name,kind:`image`})}else if(e.kind===`audio`){let n=await this.apiClient.uploadVoiceNote(t,e.file.type||`audio/webm`,e.file.name,this.config.agentId,this.config.tenantId);r.push({url:n.url,mimeType:e.file.type||`audio/webm`,fileName:e.file.name,durationMs:e.durationMs,kind:`audio`})}else{let n=await this.apiClient.uploadFile(t,e.file.type||`application/octet-stream`,e.file.name,this.config.agentId,this.config.tenantId);r.push({url:n.url,mimeType:e.file.type||`application/octet-stream`,fileName:e.file.name,kind:`file`})}}catch(e){let t=e instanceof Error?e.message:`Attachment upload failed`;this.setState({error:t});return}let i=r.filter(e=>e.kind===`image`),a={id:Xi(),role:`user`,content:e.trim(),uploadedImageUrl:i[0]?.url,uploadedAttachments:r.length>0?r:void 0,createdAt:new Date().toISOString(),status:`sent`},o=!this.state.messages.some(e=>e.role===`user`);this.setState({messages:[...this.state.messages,a],isLoading:!0,error:null}),this.emitter.emit(`message:sent`,a),o&&this.emitter.emit(`conversation:started`,{sessionId:this.state.sessionId});let s=r.length>0?r:void 0;this.config.streaming?await this.sendStreaming(e.trim(),void 0,s):await this.sendNonStreaming(e.trim(),void 0,s)}ensureSessionToken(){return!this.config.turnstileSiteKey||this.apiClient.hasValidSessionToken()?Promise.resolve():(this.sessionTokenPromise??=(async()=>{try{let e=await Li(this.config.apiBaseUrl);await this.apiClient.establishSession(this.config.agentId,this.config.tenantId,e)}catch{}finally{this.sessionTokenPromise=void 0}})(),this.sessionTokenPromise)}async awaitSessionToken(){if(!this.config.turnstileSiteKey||this.apiClient.hasValidSessionToken())return;let e;await Promise.race([this.ensureSessionToken(),new Promise(t=>{e=setTimeout(t,Zi)})]).finally(()=>clearTimeout(e))}async sendNonStreaming(e,t,n,r=!1){await this.awaitSessionToken();try{let 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,attachments:n});if(r.queued&&r.controlMode===`human`){this.setState({isLoading:!1,controlMode:`human_takeover`,...r.sessionId?{sessionId:r.sessionId}:{}}),r.sessionId&&(Hi(this.config.agentId,r.sessionId),this.openEventStream());return}let i={id:Xi(),role:`assistant`,content:r.content,images:r.images,documents:r.documents,createdAt:new Date().toISOString(),status:`sent`};this.setState({messages:[...this.state.messages,i],isLoading:!1,...r.sessionId?{sessionId:r.sessionId}:{}}),r.sessionId&&(Hi(this.config.agentId,r.sessionId),this.openEventStream()),this.emitter.emit(`message:received`,i)}catch(i){let a=i instanceof Error?i.message:`Failed to send message`;if(!r&&a.includes(`410`))return this.handleSessionExpired(),this.sendNonStreaming(e,t,n,!0);this.setState({isLoading:!1,error:a}),this.emitter.emit(`message:error`,{error:a,message:null}),this.reportError(a)}}async sendStreaming(e,t,n,r=!1){await this.awaitSessionToken();let i=Xi(),a={id:i,role:`assistant`,content:``,createdAt:new Date().toISOString(),status:`streaming`};this.setState({messages:[...this.state.messages,a]}),this.emitter.emit(`stream:start`);let o=!1,s=!1,c=null,l=null,u=Date.now(),d=null;await wi(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,attachments:n},{onSession:e=>{this.setState({sessionId:e}),Hi(this.config.agentId,e),this.openEventStream()},onRunId:e=>{this.updateMessage(i,{runId:e})},onImages:e=>{this.updateMessage(i,{images:e})},onDocuments:e=>{this.updateMessage(i,{documents:e})},onVoiceTranscript:e=>{let t=[...this.state.messages].reverse().find(e=>e.role===`user`);t&&this.updateMessage(t.id,{content:Ji(e,t.content)})},onToolCallsStarted:(e,t)=>{t&&c===null&&(c=t),d=null,this.updateMessage(i,{answerStartedAtMs:null}),(t??c)!==`off`&&this.updateMessage(i,{toolStatus:$i(e)})},onAck:e=>{this.updateMessage(i,{ackText:e})},onProgress:(e,t,n,r)=>{let a=this.state.messages.find(e=>e.id===i)?.progressEvents??[],o=Date.now(),s=r?Date.parse(r):NaN,l=Number.isNaN(s)?void 0:s;n&&c===null&&(c=n,this.updateMessage(i,{turnMeta:{totalMs:null,collapseAfterFinal:null,mode:n}})),this.updateMessage(i,{progressEvents:[...Wi(a,o,l),{stage:e,text:t,timestamp:new Date().toISOString(),status:`active`,startedAtMs:o,serverTsMs:l}]})},onToolStart:(e,t,n,r,a)=>{let o=this.state.messages.find(e=>e.id===i)?.progressEvents??[],s=Date.now(),l=a?Date.parse(a):NaN,u=Number.isNaN(l)?void 0:l;r&&c===null&&(c=r,this.updateMessage(i,{turnMeta:{totalMs:null,collapseAfterFinal:null,mode:r}})),this.updateMessage(i,{progressEvents:[...Wi(o,s,u),{stage:`calling_tool`,toolId:e,toolName:n,text:t,timestamp:new Date().toISOString(),status:`active`,startedAtMs:s,serverTsMs:u}]})},onToolComplete:(e,t,n,r)=>{let a=this.state.messages.find(e=>e.id===i)?.progressEvents??[];this.updateMessage(i,{progressEvents:a.map(i=>i.stage===`calling_tool`&&i.status===`active`&&i.toolId===e?{...i,status:`done`,text:t,durationMs:n,ok:r}:i)})},onFinalMeta:(e,t)=>{c=t?.mode??c,l=t?.collapseAfterFinal??null},onDelta:(e,t)=>{e.trim()&&d===null&&(d=Date.now(),this.updateMessage(i,{answerStartedAtMs:d})),t.trim()&&(this.updateMessage(i,{content:t,toolStatus:void 0}),this.emitter.emit(`stream:delta`,{delta:e,accumulated:t}))},onEnd:e=>{if(s){this.setState({messages:this.state.messages.filter(e=>e.id!==i),isLoading:!1,controlMode:`human_takeover`}),this.emitter.emit(`stream:end`,{content:``});return}let t=this.state.messages.find(e=>e.id===i),n=c===`detailed`,r=n||c===`standard`;this.updateMessage(i,{content:e,status:`sent`,toolStatus:void 0,progressEvents:n&&t?.progressEvents?.length?Gi(t.progressEvents):void 0,progressCollapsed:n?l??!0:void 0,turnMeta:r?{totalMs:(d??Date.now())-u,collapseAfterFinal:l,mode:c}:void 0}),this.setState({isLoading:!1}),this.emitter.emit(`stream:end`,{content:e});let a=this.state.messages.find(e=>e.id===i);a&&this.emitter.emit(`message:received`,a)},onControlMode:(e,t)=>{t&&e===`human`&&(s=!0)},onError:e=>{if(!r&&e.status===410){o=!0,this.setState({messages:this.state.messages.filter(e=>e.id!==i),isLoading:!1});return}let t=t=>{let n=this.state.messages.find(e=>e.id===i)?.content??``;this.updateMessage(i,{content:n||t,status:`error`}),this.setState({isLoading:!1,error:t}),this.emitter.emit(`message:error`,{error:t,message:null}),this.reportError(t,{stack:e.stack})},n=e=>{this.updateMessage(i,{content:e,status:`sent`,toolStatus:void 0,progressEvents:void 0}),this.setState({isLoading:!1}),this.emitter.emit(`stream:end`,{content:e});let t=this.state.messages.find(e=>e.id===i);t&&this.emitter.emit(`message:received`,t)},a=this.state.messages.find(e=>e.id===i)?.runId,s=this.state.sessionId;a&&s?Oi(this.config.apiBaseUrl,s,a,{preview:this.config.preview}).then(r=>{r.status===`done`&&r.finalText?n(r.finalText):t(r.errorMessage||e.message||`Something went wrong. Please try again.`)}).catch(()=>t(e.message||`Something went wrong. Please try again.`)):t(e.message||`Something went wrong. Please try again.`)}},{preview:this.config.preview,configChannel:this.config.configChannel,sessionToken:this.apiClient.getSessionToken()}),o&&(this.handleSessionExpired(),await this.sendStreaming(e,t,n,!0))}};function $i(e){let t=e[0];if(!t)return`Working...`;let n=t.indexOf(`.`);return n>0?`Using ${t.slice(0,n).replace(/_/g,` `)}: ${t.slice(n+1).replace(/_/g,` `)}${e.length>1?` +${e.length-1}`:``}`:`Using ${t.replace(/_/g,` `)}`}function ea(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let e=r.result;t(e.split(`,`)[1]??``)},r.onerror=()=>n(Error(`Failed to read file`)),r.readAsDataURL(e)})}function ta(e){let t=document.createElement(`div`);t.setAttribute(`data-agentkit-widget`,``),e.appendChild(t);let n=t.attachShadow({mode:`open`}),r=document.createElement(`style`);n.appendChild(r);let i=document.createElement(`div`);return i.style.cssText=`display: contents;`,n.appendChild(i),{host:t,shadowRoot:n,styleSlot:r,mountPoint:i}}function na(e,t){e.textContent=t}function ra(e){e.remove()}function ia(e){document.body?document.body.appendChild(e):document.addEventListener(`DOMContentLoaded`,()=>document.body.appendChild(e),{once:!0})}function aa(){let 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`,ia(e),e}function oa(e){getComputedStyle(e).position===`static`&&(e.style.position=`relative`);let 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`,e.appendChild(t),t}function sa(e){return e.setAttribute(`data-agentkit-root`,`inline`),getComputedStyle(e).position===`static`&&(e.style.position=`relative`),e}function ca(e){e.remove()}function la(e){e.removeAttribute(`data-agentkit-root`)}function ua(e,t,n,r,i){let a=e.mode===`inline`,o=!1,s=a&&i?sa(i):!a&&i?oa(i):aa(),c=ta(s);na(c.styleSlot,r);let l=new Qi(e,t,(e,t)=>{o||u.update(e,t)}),u=n(c.mountPoint,e,l.getState(),{onOpen:()=>d.open(),onClose:()=>d.close(),onSendMessage:(e,t)=>{l.sendMessage(e,t)},onReset:()=>{l.resetConversation()}});l.hydrate(),setTimeout(()=>{o||l.emitter.emit(`ready`,l.getState())},0);let d={open(){o||(l.setOpen(!0),l.emitter.emit(`open`))},close(){o||(l.setOpen(!1),l.emitter.emit(`close`))},toggle(){l.getState().isOpen?d.close():d.open()},async sendMessage(e,t){await l.sendMessage(e,t)},reset(){o||(l.resetConversation(),l.emitter.emit(`reset`))},destroy(){o||(o=!0,l.closeEventStream(),u.destroy(),ra(c.host),a&&i?la(i):ca(s),l.emitter.emit(`destroy`),l.emitter.removeAllListeners())},on(e,t){l.emitter.on(e,t)},off(e,t){l.emitter.off(e,t)},getState(){return l.getState()}};return d}var da=new Map,fa=0;function pa(e){let t=`agentkit-widget-${++fa}`,n=e.destroy.bind(e);return e.destroy=()=>{da.delete(t),n()},da.set(t,e),t}function ma(e,t,n){let r={...e,mode:`floating`},i=ua(ut(r),r,t,n);return pa(i),i}function ha(e,t,n,r){let i={...t,mode:`floating`},a=ua(ut(i),i,n,r,e);return pa(a),a}function ga(e,t,n,r){let i={...t,mode:`inline`},a=ua(ut(i),i,n,r,e);return pa(a),a}function _a(e){e?da.get(e)?.destroy():(da.forEach(e=>e.destroy()),da.clear())}function va(){return Array.from(da.keys())}function ya(e){let{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 ba(e){return e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e}var xa=`
|
|
13
15
|
*, *::before, *::after {
|
|
14
16
|
box-sizing: border-box;
|
|
15
17
|
margin: 0;
|
|
@@ -17,20 +19,33 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
:host {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
--ak-
|
|
24
|
-
--ak-
|
|
25
|
-
--ak-
|
|
26
|
-
--ak-
|
|
22
|
+
/* Neutral and status defaults are copied from packages/design-tokens/tokens.css (light
|
|
23
|
+
:root / dark .dark) — the widget is CDN-bundled, so they stay literals here.
|
|
24
|
+
__tests__/design-token-parity.test.ts fails when the two drift. */
|
|
25
|
+
--ak-accent: #4f46e5; /* --primary (white text 6.3:1) */
|
|
26
|
+
--ak-accent-hover: #4338ca; /* --primary-hover */
|
|
27
|
+
--ak-bg: #ffffff; /* --surface */
|
|
28
|
+
--ak-surface: #f7f8fa; /* --bg */
|
|
29
|
+
--ak-text: #0e1220; /* --fg */
|
|
30
|
+
--ak-text-muted: #525c70; /* --fg-muted */
|
|
31
|
+
--ak-border: #e3e6ec; /* --border */
|
|
32
|
+
--ak-border-strong: #818a9d; /* --border-strong */
|
|
33
|
+
--ak-hover: rgb(14 18 32 / 0.04); /* --hover */
|
|
27
34
|
--ak-user-bg: var(--ak-accent);
|
|
28
35
|
--ak-user-text: #ffffff;
|
|
29
|
-
--ak-bot-bg: #
|
|
30
|
-
--ak-bot-text: #
|
|
31
|
-
--ak-
|
|
32
|
-
--ak-
|
|
33
|
-
--ak-
|
|
36
|
+
--ak-bot-bg: #eef0f4; /* --surface-muted */
|
|
37
|
+
--ak-bot-text: #0e1220; /* --fg */
|
|
38
|
+
--ak-success: #0a9466; /* --success */
|
|
39
|
+
--ak-warning: #d98a0b; /* --warning */
|
|
40
|
+
--ak-warning-fg: #8a4b06; /* --warning-fg */
|
|
41
|
+
--ak-warning-soft: #fdf3e2; /* --warning-soft */
|
|
42
|
+
--ak-danger: #c4302b; /* --danger */
|
|
43
|
+
--ak-danger-fg: #b4232b; /* --danger-fg */
|
|
44
|
+
--ak-danger-soft: #fdeced; /* --danger-soft */
|
|
45
|
+
--ak-danger-border: color-mix(in srgb, var(--ak-danger) 35%, transparent);
|
|
46
|
+
--ak-maintenance-fg: var(--ak-warning-fg);
|
|
47
|
+
--ak-maintenance-bg: var(--ak-warning-soft);
|
|
48
|
+
--ak-maintenance-halo: var(--ak-warning);
|
|
34
49
|
--ak-font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
35
50
|
--ak-radius: 12px;
|
|
36
51
|
/* Chat surface texture — scattered line doodles, tiled. Neutral stroke (not accent-tinted)
|
|
@@ -48,21 +63,27 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
48
63
|
}
|
|
49
64
|
|
|
50
65
|
/* Dark mode — set data-theme="dark" on the shadow host element.
|
|
51
|
-
|
|
66
|
+
Values from tokens.css .dark (see the :host note above). */
|
|
52
67
|
:host([data-theme="dark"]) {
|
|
53
|
-
--ak-bg: #
|
|
54
|
-
--ak-surface: #
|
|
55
|
-
--ak-text: #
|
|
56
|
-
--ak-text-muted: #
|
|
57
|
-
--ak-border: #
|
|
58
|
-
--ak-
|
|
59
|
-
--ak-
|
|
68
|
+
--ak-bg: #111521; /* --surface — panel */
|
|
69
|
+
--ak-surface: #171c2a; /* --surface-raised — inputs, insets lift off the panel */
|
|
70
|
+
--ak-text: #eef0f6; /* --fg */
|
|
71
|
+
--ak-text-muted: #a3acbd; /* --fg-muted */
|
|
72
|
+
--ak-border: #232a3a; /* --border */
|
|
73
|
+
--ak-border-strong: #5f687c; /* --border-strong */
|
|
74
|
+
--ak-hover: rgb(255 255 255 / 0.05); /* --hover */
|
|
75
|
+
--ak-bot-bg: #20263a; /* --surface-muted — assistant bubble */
|
|
76
|
+
--ak-bot-text: #eef0f6; /* --fg */
|
|
77
|
+
--ak-success: #2fbf87;
|
|
78
|
+
--ak-warning: #e5a43a;
|
|
79
|
+
--ak-warning-fg: #f2bd5c;
|
|
80
|
+
--ak-warning-soft: #2c2110;
|
|
81
|
+
--ak-danger: #d93a3f;
|
|
82
|
+
--ak-danger-fg: #ff8a8f;
|
|
83
|
+
--ak-danger-soft: #331417;
|
|
60
84
|
/* Same doodle tile, white stroke — dark surfaces need ~1.5x the alpha to read the same */
|
|
61
85
|
--ak-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' fill='none' stroke='rgba(255,255,255,0.07)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 30c5-8 14-8 19 0s14 8 19 0'/%3E%3Ccircle cx='96' cy='22' r='8'/%3E%3Cpath d='M150 34l6-11 6 11z'/%3E%3Cpath d='M196 18v14M189 25h14'/%3E%3Cpath d='M28 74h22M28 81h14'/%3E%3Cpath d='M84 68l8-8 8 8-8 8z'/%3E%3Cpath d='M186 76c0 7-6 12-13 12h-10l-6 6v-6c-5-1-8-6-8-12 0-7 6-12 13-12h11c7 0 13 5 13 12z'/%3E%3Ccircle cx='124' cy='104' r='5'/%3E%3Cpath d='M18 122c7-5 14-5 21 0'/%3E%3Cpath d='M62 132l7-13 7 13z'/%3E%3Cpath d='M106 156h20M106 163h12'/%3E%3Ccircle cx='176' cy='140' r='8'/%3E%3Cpath d='M32 170l6-6 6 6-6 6z'/%3E%3Cpath d='M148 196c5-7 13-7 18 0'/%3E%3Cpath d='M74 196v12M68 202h12'/%3E%3Ccircle cx='206' cy='178' r='4.5'/%3E%3Ccircle cx='58' cy='48' r='4'/%3E%3Cpath d='M128 56h16M128 62h10'/%3E%3Cpath d='M40 100l5-5 5 5-5 5z'/%3E%3Cpath d='M150 116c5-6 12-6 17 0'/%3E%3Ccircle cx='92' cy='128' r='4'/%3E%3Cpath d='M198 108v11M193 113h11'/%3E%3Cpath d='M8 148c5-7 12-7 17 0'/%3E%3Ccircle cx='142' cy='176' r='4'/%3E%3Cpath d='M76 166h16M76 172h9'/%3E%3Cpath d='M186 208l5-9 5 9z'/%3E%3Cpath d='M110 190l6-6 6 6-6 6z'/%3E%3Ccircle cx='46' cy='206' r='5'/%3E%3C/svg%3E");
|
|
62
86
|
--ak-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.4);
|
|
63
|
-
--ak-maintenance-fg: #fde68a;
|
|
64
|
-
--ak-maintenance-bg: rgba(253, 230, 138, 0.06);
|
|
65
|
-
--ak-maintenance-halo: #f59e0b;
|
|
66
87
|
}
|
|
67
88
|
|
|
68
89
|
/* ── Floating layout ─────────────────────────────────────────── */
|
|
@@ -100,14 +121,14 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
100
121
|
align-items: center;
|
|
101
122
|
justify-content: center;
|
|
102
123
|
color: white;
|
|
103
|
-
box-shadow: 0 4px 16px
|
|
124
|
+
box-shadow: 0 4px 16px color-mix(in srgb, var(--ak-accent) 45%, transparent);
|
|
104
125
|
transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
|
|
105
126
|
flex-shrink: 0;
|
|
106
127
|
}
|
|
107
128
|
.ak-launcher:hover {
|
|
108
129
|
background: var(--ak-accent-hover);
|
|
109
130
|
transform: scale(1.08);
|
|
110
|
-
box-shadow: 0 6px 24px
|
|
131
|
+
box-shadow: 0 6px 24px color-mix(in srgb, var(--ak-accent) 55%, transparent);
|
|
111
132
|
}
|
|
112
133
|
.ak-launcher:active {
|
|
113
134
|
transform: scale(0.95);
|
|
@@ -209,6 +230,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
209
230
|
width: 8px;
|
|
210
231
|
height: 8px;
|
|
211
232
|
border-radius: 50%;
|
|
233
|
+
/* Not --ak-success: this dot sits on the accent fill, where the token green is too dark. */
|
|
212
234
|
background: #4ade80;
|
|
213
235
|
flex-shrink: 0;
|
|
214
236
|
}
|
|
@@ -562,9 +584,9 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
562
584
|
border: 1px solid var(--ak-border);
|
|
563
585
|
}
|
|
564
586
|
.ak-message--error .ak-message__bubble {
|
|
565
|
-
background:
|
|
566
|
-
color:
|
|
567
|
-
border-color:
|
|
587
|
+
background: var(--ak-danger-soft);
|
|
588
|
+
color: var(--ak-danger-fg);
|
|
589
|
+
border-color: var(--ak-danger-border);
|
|
568
590
|
}
|
|
569
591
|
.ak-message--operator .ak-message__bubble--operator {
|
|
570
592
|
background: color-mix(in srgb, var(--ak-accent) 8%, var(--ak-bot-bg));
|
|
@@ -696,7 +718,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
696
718
|
.ak-gallery {
|
|
697
719
|
position: relative;
|
|
698
720
|
width: 100%;
|
|
699
|
-
background:
|
|
721
|
+
background: var(--ak-bg);
|
|
700
722
|
overflow: hidden;
|
|
701
723
|
}
|
|
702
724
|
|
|
@@ -707,13 +729,13 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
707
729
|
}
|
|
708
730
|
.ak-gallery--single .ak-gallery__cell--hero {
|
|
709
731
|
display: block;
|
|
710
|
-
background:
|
|
732
|
+
background: var(--ak-bg);
|
|
711
733
|
}
|
|
712
734
|
.ak-gallery__img--contain {
|
|
713
735
|
width: 100%;
|
|
714
736
|
max-height: 320px;
|
|
715
737
|
object-fit: contain;
|
|
716
|
-
background:
|
|
738
|
+
background: var(--ak-bg);
|
|
717
739
|
display: block;
|
|
718
740
|
}
|
|
719
741
|
|
|
@@ -722,7 +744,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
722
744
|
display: grid;
|
|
723
745
|
grid-template-columns: 1fr 1fr;
|
|
724
746
|
gap: 2px;
|
|
725
|
-
background:
|
|
747
|
+
background: var(--ak-border);
|
|
726
748
|
}
|
|
727
749
|
|
|
728
750
|
/* 3-up: big left + 2 stacked right; container holds aspect */
|
|
@@ -730,7 +752,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
730
752
|
display: grid;
|
|
731
753
|
grid-template-columns: 2fr 1fr;
|
|
732
754
|
gap: 2px;
|
|
733
|
-
background:
|
|
755
|
+
background: var(--ak-border);
|
|
734
756
|
aspect-ratio: 4 / 3;
|
|
735
757
|
}
|
|
736
758
|
.ak-gallery--three > .ak-gallery__cell {
|
|
@@ -748,14 +770,14 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
748
770
|
display: grid;
|
|
749
771
|
grid-template-columns: 1fr 1fr;
|
|
750
772
|
gap: 2px;
|
|
751
|
-
background:
|
|
773
|
+
background: var(--ak-border);
|
|
752
774
|
}
|
|
753
775
|
|
|
754
776
|
.ak-gallery__cell {
|
|
755
777
|
position: relative;
|
|
756
778
|
display: block;
|
|
757
779
|
overflow: hidden;
|
|
758
|
-
background:
|
|
780
|
+
background: var(--ak-surface);
|
|
759
781
|
aspect-ratio: 1 / 1;
|
|
760
782
|
line-height: 0;
|
|
761
783
|
text-decoration: none;
|
|
@@ -782,7 +804,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
782
804
|
}
|
|
783
805
|
|
|
784
806
|
.ak-gallery__cell:focus-visible {
|
|
785
|
-
outline: 2px solid var(--ak-
|
|
807
|
+
outline: 2px solid var(--ak-accent);
|
|
786
808
|
outline-offset: -2px;
|
|
787
809
|
}
|
|
788
810
|
|
|
@@ -817,21 +839,21 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
817
839
|
gap: 10px;
|
|
818
840
|
padding: 8px 10px;
|
|
819
841
|
background: var(--ak-surface);
|
|
820
|
-
border: 1px solid var(--ak-border
|
|
842
|
+
border: 1px solid var(--ak-border);
|
|
821
843
|
border-radius: 12px;
|
|
822
844
|
text-decoration: none;
|
|
823
|
-
color: var(--ak-text
|
|
845
|
+
color: var(--ak-text);
|
|
824
846
|
transition: border-color 0.15s, box-shadow 0.15s;
|
|
825
847
|
max-width: 100%;
|
|
826
848
|
}
|
|
827
849
|
|
|
828
850
|
.ak-file-chip:hover {
|
|
829
|
-
border-color:
|
|
851
|
+
border-color: var(--ak-border-strong);
|
|
830
852
|
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
|
|
831
853
|
}
|
|
832
854
|
|
|
833
855
|
.ak-file-chip:focus-visible {
|
|
834
|
-
outline: 2px solid var(--ak-
|
|
856
|
+
outline: 2px solid var(--ak-accent);
|
|
835
857
|
outline-offset: 2px;
|
|
836
858
|
}
|
|
837
859
|
|
|
@@ -861,7 +883,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
861
883
|
.ak-file-chip__name {
|
|
862
884
|
font-size: 13px;
|
|
863
885
|
font-weight: 500;
|
|
864
|
-
color: var(--ak-text
|
|
886
|
+
color: var(--ak-text);
|
|
865
887
|
white-space: nowrap;
|
|
866
888
|
overflow: hidden;
|
|
867
889
|
text-overflow: ellipsis;
|
|
@@ -872,7 +894,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
872
894
|
font-size: 10px;
|
|
873
895
|
font-weight: 600;
|
|
874
896
|
letter-spacing: 0.05em;
|
|
875
|
-
color:
|
|
897
|
+
color: var(--ak-text-muted);
|
|
876
898
|
margin-top: 2px;
|
|
877
899
|
}
|
|
878
900
|
|
|
@@ -882,6 +904,36 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
882
904
|
border-color: transparent;
|
|
883
905
|
}
|
|
884
906
|
|
|
907
|
+
/* ── Voice note player (audio attachment) ──────────────────────────────── */
|
|
908
|
+
.ak-audio-chip {
|
|
909
|
+
display: inline-flex;
|
|
910
|
+
flex-direction: column;
|
|
911
|
+
gap: 6px;
|
|
912
|
+
padding: 8px 10px;
|
|
913
|
+
background: var(--ak-surface);
|
|
914
|
+
border: 1px solid var(--ak-border);
|
|
915
|
+
border-radius: 12px;
|
|
916
|
+
max-width: 100%;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
.ak-message--user .ak-audio-chip {
|
|
920
|
+
background: rgba(255, 255, 255, 0.96);
|
|
921
|
+
border-color: transparent;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
.ak-audio-chip__player {
|
|
925
|
+
height: 36px;
|
|
926
|
+
max-width: 260px;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
.ak-audio-chip__transcript {
|
|
930
|
+
margin: 0;
|
|
931
|
+
font-size: 12px;
|
|
932
|
+
font-style: italic;
|
|
933
|
+
line-height: 1.4;
|
|
934
|
+
color: var(--ak-text-muted);
|
|
935
|
+
}
|
|
936
|
+
|
|
885
937
|
/* ── Lightbox (image preview modal) ────────────────────────────────────── */
|
|
886
938
|
.ak-lightbox {
|
|
887
939
|
position: fixed;
|
|
@@ -996,11 +1048,11 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
996
1048
|
cursor: zoom-in;
|
|
997
1049
|
font: inherit;
|
|
998
1050
|
color: inherit;
|
|
999
|
-
background:
|
|
1051
|
+
background: var(--ak-surface);
|
|
1000
1052
|
}
|
|
1001
1053
|
|
|
1002
1054
|
.ak-gallery__cell:focus-visible {
|
|
1003
|
-
outline: 2px solid var(--ak-
|
|
1055
|
+
outline: 2px solid var(--ak-accent);
|
|
1004
1056
|
outline-offset: -2px;
|
|
1005
1057
|
}
|
|
1006
1058
|
|
|
@@ -1113,54 +1165,78 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1113
1165
|
display: none;
|
|
1114
1166
|
}
|
|
1115
1167
|
|
|
1116
|
-
/*
|
|
1168
|
+
/* Composer card — the dashboard ChatComposer layout: the message row (text, mic at its
|
|
1169
|
+
right edge) over a divider and a toolbar (+ … send), both on the same side padding.
|
|
1170
|
+
The + and mic glyphs (20px in a 32px box) are pulled flush with the text edges. */
|
|
1117
1171
|
.ak-composer__input-wrap {
|
|
1118
1172
|
display: flex;
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
border:
|
|
1123
|
-
|
|
1124
|
-
padding: 5px 5px 5px 6px;
|
|
1173
|
+
flex-direction: column;
|
|
1174
|
+
background: var(--ak-bg);
|
|
1175
|
+
border: 1px solid color-mix(in srgb, var(--ak-border-strong) 40%, transparent);
|
|
1176
|
+
border-radius: 16px;
|
|
1177
|
+
box-shadow: 0 1px 3px rgba(14, 18, 32, 0.06), 0 1px 2px rgba(14, 18, 32, 0.04);
|
|
1125
1178
|
transition: border-color 0.15s;
|
|
1126
1179
|
}
|
|
1127
1180
|
.ak-composer__input-wrap:focus-within {
|
|
1128
1181
|
border-color: var(--ak-accent);
|
|
1129
1182
|
}
|
|
1183
|
+
.ak-composer__row {
|
|
1184
|
+
display: flex;
|
|
1185
|
+
align-items: flex-start;
|
|
1186
|
+
gap: 8px;
|
|
1187
|
+
padding: 10px 12px 8px;
|
|
1188
|
+
}
|
|
1189
|
+
.ak-composer__toolbar {
|
|
1190
|
+
display: flex;
|
|
1191
|
+
align-items: center;
|
|
1192
|
+
gap: 6px;
|
|
1193
|
+
padding: 8px 12px;
|
|
1194
|
+
border-top: 1px solid var(--ak-border);
|
|
1195
|
+
}
|
|
1130
1196
|
|
|
1131
1197
|
/* Attach button wrapper */
|
|
1132
1198
|
.ak-composer__attach-wrap {
|
|
1133
1199
|
flex-shrink: 0;
|
|
1200
|
+
margin-left: -6px;
|
|
1134
1201
|
}
|
|
1135
1202
|
|
|
1136
|
-
/* "+"
|
|
1137
|
-
.ak-composer__attach
|
|
1138
|
-
|
|
1139
|
-
|
|
1203
|
+
/* Icon controls ("+" and mic): borderless, a hover fill rather than an outline */
|
|
1204
|
+
.ak-composer__attach,
|
|
1205
|
+
.ak-composer__mic {
|
|
1206
|
+
width: 32px;
|
|
1207
|
+
height: 32px;
|
|
1140
1208
|
border-radius: 8px;
|
|
1141
|
-
background:
|
|
1142
|
-
border:
|
|
1209
|
+
background: transparent;
|
|
1210
|
+
border: none;
|
|
1143
1211
|
cursor: pointer;
|
|
1144
1212
|
display: flex;
|
|
1145
1213
|
align-items: center;
|
|
1146
1214
|
justify-content: center;
|
|
1147
1215
|
color: var(--ak-text-muted);
|
|
1148
|
-
transition: color 0.15s,
|
|
1216
|
+
transition: color 0.15s, background 0.15s;
|
|
1149
1217
|
flex-shrink: 0;
|
|
1150
1218
|
}
|
|
1151
|
-
.ak-composer__attach:hover:not(:disabled)
|
|
1152
|
-
|
|
1153
|
-
border-color: var(--ak-accent);
|
|
1154
|
-
}
|
|
1219
|
+
.ak-composer__attach:hover:not(:disabled),
|
|
1220
|
+
.ak-composer__mic:hover:not(:disabled),
|
|
1155
1221
|
.ak-composer__attach--open {
|
|
1156
|
-
color: var(--ak-
|
|
1157
|
-
|
|
1158
|
-
background: color-mix(in srgb, var(--ak-accent) 8%, transparent);
|
|
1222
|
+
color: var(--ak-text);
|
|
1223
|
+
background: var(--ak-hover);
|
|
1159
1224
|
}
|
|
1160
|
-
.ak-composer__attach:
|
|
1225
|
+
.ak-composer__attach:focus-visible,
|
|
1226
|
+
.ak-composer__mic:focus-visible,
|
|
1227
|
+
.ak-composer__send:focus-visible {
|
|
1228
|
+
outline: 2px solid var(--ak-accent);
|
|
1229
|
+
outline-offset: 2px;
|
|
1230
|
+
}
|
|
1231
|
+
.ak-composer__attach:disabled,
|
|
1232
|
+
.ak-composer__mic:disabled {
|
|
1161
1233
|
opacity: 0.4;
|
|
1162
1234
|
cursor: not-allowed;
|
|
1163
1235
|
}
|
|
1236
|
+
/* Flush right, and -4px vertically so the 32px box doesn't grow the 24px text row */
|
|
1237
|
+
.ak-composer__mic {
|
|
1238
|
+
margin: -4px -6px -4px 0;
|
|
1239
|
+
}
|
|
1164
1240
|
|
|
1165
1241
|
/* Attachment submenu — floats above the composer, positioned relative to .ak-composer */
|
|
1166
1242
|
.ak-composer__attach-menu {
|
|
@@ -1201,20 +1277,20 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1201
1277
|
cursor: not-allowed;
|
|
1202
1278
|
}
|
|
1203
1279
|
|
|
1204
|
-
/* Textarea — borderless, transparent,
|
|
1280
|
+
/* Textarea — borderless, transparent, fills the message row */
|
|
1205
1281
|
.ak-composer__input {
|
|
1206
1282
|
flex: 1;
|
|
1207
|
-
padding:
|
|
1283
|
+
padding: 0;
|
|
1208
1284
|
border: none;
|
|
1209
1285
|
border-radius: 0;
|
|
1210
1286
|
background: transparent;
|
|
1211
1287
|
color: var(--ak-text);
|
|
1212
1288
|
font-family: var(--ak-font);
|
|
1213
|
-
font-size:
|
|
1214
|
-
line-height: 1.
|
|
1289
|
+
font-size: 16px; /* iOS zooms the page when a focused input is under 16px */
|
|
1290
|
+
line-height: 1.5;
|
|
1215
1291
|
resize: none;
|
|
1216
1292
|
outline: none;
|
|
1217
|
-
min-height:
|
|
1293
|
+
min-height: 24px;
|
|
1218
1294
|
max-height: 110px;
|
|
1219
1295
|
overflow-y: auto;
|
|
1220
1296
|
}
|
|
@@ -1222,10 +1298,74 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1222
1298
|
color: var(--ak-text-muted);
|
|
1223
1299
|
}
|
|
1224
1300
|
|
|
1225
|
-
/*
|
|
1301
|
+
/* Recording bar — replaces the input row while a voice note is being recorded */
|
|
1302
|
+
.ak-composer__recording {
|
|
1303
|
+
display: flex;
|
|
1304
|
+
align-items: center;
|
|
1305
|
+
gap: 10px;
|
|
1306
|
+
flex: 1;
|
|
1307
|
+
padding: 8px 12px;
|
|
1308
|
+
}
|
|
1309
|
+
.ak-composer__recording-timer {
|
|
1310
|
+
display: flex;
|
|
1311
|
+
align-items: center;
|
|
1312
|
+
gap: 8px;
|
|
1313
|
+
flex: 1;
|
|
1314
|
+
color: var(--ak-text);
|
|
1315
|
+
font-family: var(--ak-font);
|
|
1316
|
+
font-size: 13px;
|
|
1317
|
+
font-variant-numeric: tabular-nums;
|
|
1318
|
+
}
|
|
1319
|
+
.ak-composer__recording-dot {
|
|
1320
|
+
width: 8px;
|
|
1321
|
+
height: 8px;
|
|
1322
|
+
border-radius: 50%;
|
|
1323
|
+
background: var(--ak-danger);
|
|
1324
|
+
animation: ak-recording-pulse 1.4s ease-in-out infinite;
|
|
1325
|
+
}
|
|
1326
|
+
@keyframes ak-recording-pulse {
|
|
1327
|
+
0%,
|
|
1328
|
+
100% {
|
|
1329
|
+
opacity: 1;
|
|
1330
|
+
}
|
|
1331
|
+
50% {
|
|
1332
|
+
opacity: 0.35;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
.ak-composer__recording-cancel,
|
|
1336
|
+
.ak-composer__recording-stop {
|
|
1337
|
+
width: 32px;
|
|
1338
|
+
height: 32px;
|
|
1339
|
+
border-radius: 8px;
|
|
1340
|
+
border: none;
|
|
1341
|
+
cursor: pointer;
|
|
1342
|
+
display: flex;
|
|
1343
|
+
align-items: center;
|
|
1344
|
+
justify-content: center;
|
|
1345
|
+
flex-shrink: 0;
|
|
1346
|
+
transition: background 0.15s, color 0.15s;
|
|
1347
|
+
}
|
|
1348
|
+
.ak-composer__recording-cancel {
|
|
1349
|
+
background: transparent;
|
|
1350
|
+
color: var(--ak-text-muted);
|
|
1351
|
+
}
|
|
1352
|
+
.ak-composer__recording-cancel:hover {
|
|
1353
|
+
color: var(--ak-text);
|
|
1354
|
+
background: var(--ak-hover);
|
|
1355
|
+
}
|
|
1356
|
+
.ak-composer__recording-stop {
|
|
1357
|
+
background: var(--ak-accent);
|
|
1358
|
+
color: white;
|
|
1359
|
+
}
|
|
1360
|
+
.ak-composer__recording-stop:hover {
|
|
1361
|
+
background: var(--ak-accent-hover);
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
/* Send button — rounded square at the toolbar's right end */
|
|
1226
1365
|
.ak-composer__send {
|
|
1227
|
-
width:
|
|
1228
|
-
height:
|
|
1366
|
+
width: 32px;
|
|
1367
|
+
height: 32px;
|
|
1368
|
+
margin-left: auto;
|
|
1229
1369
|
border-radius: 8px;
|
|
1230
1370
|
background: var(--ak-accent);
|
|
1231
1371
|
border: none;
|
|
@@ -1234,14 +1374,16 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1234
1374
|
align-items: center;
|
|
1235
1375
|
justify-content: center;
|
|
1236
1376
|
color: white;
|
|
1237
|
-
transition: background 0.15s,
|
|
1377
|
+
transition: background 0.15s, color 0.15s;
|
|
1238
1378
|
flex-shrink: 0;
|
|
1239
1379
|
}
|
|
1240
1380
|
.ak-composer__send:hover:not(:disabled) {
|
|
1241
1381
|
background: var(--ak-accent-hover);
|
|
1242
1382
|
}
|
|
1383
|
+
/* Disabled sits on the muted fill rather than a faded accent, so it stays visible on dark */
|
|
1243
1384
|
.ak-composer__send:disabled {
|
|
1244
|
-
|
|
1385
|
+
background: var(--ak-bot-bg);
|
|
1386
|
+
color: var(--ak-text-muted);
|
|
1245
1387
|
cursor: not-allowed;
|
|
1246
1388
|
}
|
|
1247
1389
|
|
|
@@ -1584,10 +1726,10 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1584
1726
|
/* ── Error banner ────────────────────────────────────────────── */
|
|
1585
1727
|
.ak-error {
|
|
1586
1728
|
padding: 12px 16px;
|
|
1587
|
-
background:
|
|
1588
|
-
color:
|
|
1729
|
+
background: var(--ak-danger-soft);
|
|
1730
|
+
color: var(--ak-danger-fg);
|
|
1589
1731
|
font-size: 13px;
|
|
1590
|
-
border-top: 1px solid
|
|
1732
|
+
border-top: 1px solid var(--ak-danger-border);
|
|
1591
1733
|
text-align: left;
|
|
1592
1734
|
flex-shrink: 0;
|
|
1593
1735
|
display: flex;
|
|
@@ -1629,9 +1771,9 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1629
1771
|
|
|
1630
1772
|
/* Specific styling for origin restriction errors */
|
|
1631
1773
|
.ak-error--origin {
|
|
1632
|
-
background:
|
|
1633
|
-
color:
|
|
1634
|
-
border-top: 1px solid
|
|
1774
|
+
background: var(--ak-warning-soft); /* warning, not danger: less alarming */
|
|
1775
|
+
color: var(--ak-warning-fg);
|
|
1776
|
+
border-top: 1px solid var(--ak-warning);
|
|
1635
1777
|
}
|
|
1636
1778
|
|
|
1637
1779
|
/* ── Agent status indicator ──────────────────────────────────── */
|
|
@@ -1651,7 +1793,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1651
1793
|
}
|
|
1652
1794
|
.ak-agent-status__icon {
|
|
1653
1795
|
flex-shrink: 0;
|
|
1654
|
-
color: var(--ak-
|
|
1796
|
+
color: var(--ak-accent);
|
|
1655
1797
|
animation: ak-sparkle-pulse 2.5s ease-in-out infinite;
|
|
1656
1798
|
}
|
|
1657
1799
|
.ak-agent-status__text {
|
|
@@ -1688,7 +1830,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1688
1830
|
.ak-progress__label {
|
|
1689
1831
|
font-weight: 600;
|
|
1690
1832
|
font-size: 0.78rem;
|
|
1691
|
-
color: var(--ak-
|
|
1833
|
+
color: var(--ak-accent);
|
|
1692
1834
|
}
|
|
1693
1835
|
.ak-progress__toggle {
|
|
1694
1836
|
display: inline-flex;
|
|
@@ -1785,7 +1927,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1785
1927
|
opacity: 0.55;
|
|
1786
1928
|
}
|
|
1787
1929
|
.ak-progress__step-icon--fail {
|
|
1788
|
-
color:
|
|
1930
|
+
color: var(--ak-danger);
|
|
1789
1931
|
opacity: 0.9;
|
|
1790
1932
|
}
|
|
1791
1933
|
/* Post-turn summary row ("Worked for Ns · N steps") */
|
|
@@ -1816,7 +1958,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1816
1958
|
width: 11px;
|
|
1817
1959
|
height: 11px;
|
|
1818
1960
|
border: 1.5px solid var(--ak-border);
|
|
1819
|
-
border-top-color: var(--ak-
|
|
1961
|
+
border-top-color: var(--ak-accent);
|
|
1820
1962
|
border-radius: 50%;
|
|
1821
1963
|
flex-shrink: 0;
|
|
1822
1964
|
animation: ak-spin 0.7s linear infinite;
|
|
@@ -1914,10 +2056,10 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1914
2056
|
display: none;
|
|
1915
2057
|
}
|
|
1916
2058
|
}
|
|
1917
|
-
`;function
|
|
2059
|
+
`;function Sa(){return(0,n.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`rect`,{x:`3`,y:`11`,width:`18`,height:`10`,rx:`2`}),(0,n.jsx)(`circle`,{cx:`12`,cy:`5`,r:`2`}),(0,n.jsx)(`path`,{d:`M12 7v4`}),(0,n.jsx)(`line`,{x1:`8`,y1:`16`,x2:`8`,y2:`16`}),(0,n.jsx)(`line`,{x1:`16`,y1:`16`,x2:`16`,y2:`16`})]})}function Ca(){return(0,n.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,children:[(0,n.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,n.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})}function wa(){return(0,n.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}),(0,n.jsx)(`path`,{d:`M3 3v5h5`})]})}function Ta({title:e,subtitle:r,avatarUrl:i,onClose:a,onReset:o,hideClose:s=!1}){let[c,l]=(0,t.useState)(!1);return(0,n.jsxs)(`div`,{className:`ak-header${c?` ak-header--confirming`:``}`,children:[(0,n.jsxs)(`div`,{className:`ak-header__row`,children:[i?(0,n.jsx)(`img`,{src:i,alt:``,className:`ak-header__avatar`,"aria-hidden":`true`}):(0,n.jsx)(`span`,{className:`ak-header__bot-icon`,"aria-hidden":`true`,children:(0,n.jsx)(Sa,{})}),(0,n.jsxs)(`div`,{className:`ak-header__title-group`,children:[(0,n.jsx)(`span`,{className:`ak-header__title`,children:e}),r&&(0,n.jsx)(`span`,{className:`ak-header__subtitle`,children:r})]}),(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,n.jsx)(`span`,{className:`ak-header__status`,"aria-hidden":`true`}),o&&(0,n.jsx)(`button`,{className:`ak-header__button${c?` ak-header__button--active`:``}`,onClick:()=>l(!0),"aria-label":`New conversation`,type:`button`,title:`Start a new conversation (Retains current conversation to memory)`,children:(0,n.jsx)(wa,{})}),!s&&(0,n.jsx)(`button`,{className:`ak-header__close`,onClick:a,"aria-label":`Close chat`,type:`button`,children:(0,n.jsx)(Ca,{})})]})]}),c&&(0,n.jsxs)(`div`,{className:`ak-header__confirm`,role:`alert`,children:[(0,n.jsxs)(`div`,{className:`ak-header__confirm-text`,children:[(0,n.jsx)(`span`,{className:`ak-header__confirm-title`,children:`End this conversation?`}),(0,n.jsx)(`span`,{className:`ak-header__confirm-sub`,children:`All messages will be removed`})]}),(0,n.jsxs)(`div`,{className:`ak-header__confirm-actions`,children:[(0,n.jsx)(`button`,{className:`ak-header__confirm-cancel`,type:`button`,onClick:()=>l(!1),children:`Cancel`}),(0,n.jsx)(`button`,{className:`ak-header__confirm-ok`,type:`button`,onClick:()=>{o?.(),l(!1)},children:`End chat`})]})]})]})}function Ea(e){if(!e)return null;let t=e.trim();if(!t)return null;if(/^(\/|\.{1,2}\/|#|\?)/.test(t))return t;let n=/^([a-z][a-z0-9+.-]*):/i.exec(t)?.[1]?.toLowerCase();return n?[`http`,`https`,`mailto`,`tel`].includes(n)?t:null:t}function Da(e){return 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(/\$\$(?!\d)[\s\S]+?\$\$/g,``).replace(/\$(?![\s\d])([^$\n]+?)(?<!\s)\$(?!\d)/g,`$1`).replace(/\x00DOLLAR\x00/g,`$`).replace(/\\[a-zA-Z]+\*?/g,``).replace(/\n{3,}/g,`
|
|
1918
2060
|
|
|
1919
|
-
`)}function Ta(e){let[,n]=(0,t.useState)(0);(0,t.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(e=>e+1),1e3);return()=>clearInterval(t)},[e])}var Ea=800;function Da({up:e}){return(0,n.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,n.jsx)(`polyline`,{points:e?`18 15 12 9 6 15`:`6 9 12 15 18 9`})})}function Oa({event:e,active:t}){return t?(0,n.jsx)(`span`,{className:`ak-progress__spinner`,"aria-hidden":`true`}):(0,n.jsx)(`svg`,{className:e.ok===!1?`ak-progress__step-icon ak-progress__step-icon--fail`:`ak-progress__step-icon`,width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:e.ok===!1?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,n.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]}):(0,n.jsx)(`polyline`,{points:`20 6 9 17 4 12`})})}function ka({events:e,live:t,answerStartedAtMs:r}){Ta(t&&!r&&e.some(e=>e.status===`active`));let i=r??Date.now(),a=e[0]?.startedAtMs,o=e.reduce((e,t,n)=>t.status===`active`?n:e,-1);return(0,n.jsx)(`ul`,{className:`ak-progress__steps`,role:`list`,children:e.map((e,r)=>{let s=t&&e.status===`active`,c=s&&r===o?Ki(a?i-a:void 0):s?null:Ki(e.durationMs);return(0,n.jsxs)(`li`,{className:s?`ak-progress__step ak-progress__step--active`:`ak-progress__step`,children:[(0,n.jsx)(Oa,{event:e,active:s}),(0,n.jsx)(`span`,{className:`ak-progress__step-text`,children:e.text}),c&&(0,n.jsxs)(`span`,{className:`ak-progress__step-dur`,children:[`· `,c]})]},`${e.toolId??e.stage}-${r}`)})})}function Aa({events:e,answerStartedAtMs:r}){let[i,a]=(0,t.useState)(0),o=Math.min(i,e.length-1),s=o<e.length-1;(0,t.useEffect)(()=>{if(!s)return;let t=setTimeout(()=>a(t=>Math.min(t+1,e.length-1)),Ea);return()=>clearTimeout(t)},[s,o,e.length]);let c=e[o],l=!s&&c.status===`done`;Ta(!l&&!r);let u=e[0]?.startedAtMs,d=l?null:Ki(u?(r??Date.now())-u:void 0);return(0,n.jsx)(`ul`,{className:`ak-progress__list`,role:`list`,children:(0,n.jsxs)(`li`,{className:`ak-progress__item ak-progress__item--active`,children:[l?(0,n.jsx)(Oa,{event:c,active:!1}):(0,n.jsx)(`span`,{className:`ak-progress__spinner`,"aria-hidden":`true`}),(0,n.jsx)(`span`,{className:`ak-progress__text`,children:c.text}),d&&(0,n.jsxs)(`span`,{className:`ak-progress__step-dur`,children:[`· `,d]})]})})}function ja({ackText:e,events:r=[],collapsed:i=!0,isComplete:a=!1,turnMeta:o,answerStartedAtMs:s}){let[c,l]=(0,t.useState)(!i);(0,t.useEffect)(()=>{a&&l(!i)},[a]);let u=o?.mode;if(!a)return r.length===0?e?(0,n.jsx)(`ul`,{className:`ak-progress__list`,role:`list`,children:(0,n.jsxs)(`li`,{className:`ak-progress__item ak-progress__item--active`,children:[(0,n.jsx)(`span`,{className:`ak-progress__spinner`,"aria-hidden":`true`}),(0,n.jsx)(`span`,{className:`ak-progress__text`,children:e})]})}):null:u===`detailed`?(0,n.jsx)(ka,{events:r,live:!0,answerStartedAtMs:s}):(0,n.jsx)(Aa,{events:r,answerStartedAtMs:s});let d=Ki(o?.totalMs),f=d?`Worked for ${d}`:`Finished working`;return u===`detailed`&&r.length>0?(0,n.jsxs)(`div`,{className:`ak-progress`,children:[(0,n.jsxs)(`button`,{type:`button`,onClick:()=>l(e=>!e),className:`ak-progress__summary`,"aria-expanded":c,"aria-label":c?`Hide working steps`:`Show working steps`,children:[(0,n.jsx)(Oa,{event:{stage:``,text:``,timestamp:``,status:`done`},active:!1}),(0,n.jsx)(`span`,{children:f}),(0,n.jsxs)(`span`,{className:`ak-progress__step-dur`,children:[`· `,r.length,` step`,r.length===1?``:`s`]}),(0,n.jsx)(Da,{up:c})]}),c&&(0,n.jsx)(ka,{events:r,live:!1})]}):u===`standard`&&o?(0,n.jsx)(`div`,{className:`ak-progress`,children:(0,n.jsxs)(`p`,{className:`ak-progress__summary ak-progress__summary--static`,children:[(0,n.jsx)(Oa,{event:{stage:``,text:``,timestamp:``,status:`done`},active:!1}),(0,n.jsx)(`span`,{children:f})]})}):null}function Ma(){return(0,n.jsx)(`svg`,{className:`ak-agent-status__icon`,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,n.jsx)(`path`,{d:`M12 2C12 2 12.7 8.1 14.5 9.5C16.3 10.9 22 12 22 12C22 12 16.3 13.1 14.5 14.5C12.7 15.9 12 22 12 22C12 22 11.3 15.9 9.5 14.5C7.7 13.1 2 12 2 12C2 12 7.7 10.9 9.5 9.5C11.3 8.1 12 2 12 2Z`})})}function Na({status:e}){return(0,n.jsxs)(`div`,{className:`ak-agent-status`,role:`status`,"aria-live":`polite`,children:[(0,n.jsx)(Ma,{}),(0,n.jsx)(`span`,{className:`ak-agent-status__text`,children:e})]})}function Pa({messageId:e,images:t,onCellClick:r}){if(t.length===0)return null;let i=t.length;if(i===1){let e=t[0];return(0,n.jsxs)(`div`,{className:`ak-gallery ak-gallery--single`,children:[(0,n.jsx)(`button`,{type:`button`,onClick:()=>r(0),className:`ak-gallery__cell ak-gallery__cell--hero`,"aria-label":`Open image preview`,children:(0,n.jsx)(`img`,{src:e.src,alt:e.alt,className:`ak-gallery__img ak-gallery__img--contain`})}),(0,n.jsx)(`a`,{href:Ca(e.downloadHref)??void 0,download:!0,className:`ak-message__image-dl-icon`,title:`Download image`,onClick:e=>e.stopPropagation(),children:(0,n.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,n.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,n.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})})]})}if(i===2)return(0,n.jsx)(`div`,{className:`ak-gallery ak-gallery--two`,children:t.map((t,i)=>(0,n.jsx)(Fa,{src:t.src,alt:t.alt,onClick:()=>r(i)},t.key??`${e}-${i}`))});if(i===3)return(0,n.jsxs)(`div`,{className:`ak-gallery ak-gallery--three`,children:[(0,n.jsx)(Fa,{src:t[0].src,alt:t[0].alt,onClick:()=>r(0)},t[0].key??`${e}-0`),(0,n.jsxs)(`div`,{className:`ak-gallery__col`,children:[(0,n.jsx)(Fa,{src:t[1].src,alt:t[1].alt,onClick:()=>r(1)},t[1].key??`${e}-1`),(0,n.jsx)(Fa,{src:t[2].src,alt:t[2].alt,onClick:()=>r(2)},t[2].key??`${e}-2`)]})]});let a=t.slice(0,4),o=i>4?i-4:0;return(0,n.jsx)(`div`,{className:`ak-gallery ak-gallery--grid`,children:a.map((t,i)=>{let s=i===a.length-1;return(0,n.jsx)(Fa,{src:t.src,alt:t.alt,overlayCount:s&&o>0?o:0,onClick:()=>r(i)},t.key??`${e}-${i}`)})})}function Fa({src:e,alt:t,overlayCount:r=0,onClick:i}){return(0,n.jsxs)(`button`,{type:`button`,onClick:i,className:`ak-gallery__cell`,"aria-label":`Open image preview`,children:[(0,n.jsx)(`img`,{src:e,alt:t,className:`ak-gallery__img`,loading:`lazy`}),r>0&&(0,n.jsxs)(`span`,{className:`ak-gallery__overlay`,children:[`+`,r]})]})}function Ia({images:e,index:r,onClose:i,onIndexChange:a}){let o=r!==null,s=o&&r!==null?Math.min(Math.max(0,r),e.length-1):0,c=o?e[s]:null;return(0,t.useEffect)(()=>{if(!o)return;let t=t=>{t.key===`Escape`?(t.stopPropagation(),i()):t.key===`ArrowLeft`&&e.length>1?(t.preventDefault(),a((s-1+e.length)%e.length)):t.key===`ArrowRight`&&e.length>1&&(t.preventDefault(),a((s+1)%e.length))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[o,s,e.length,i,a]),!o||!c?null:(0,n.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Image preview`,className:`ak-lightbox`,onClick:i,children:[(0,n.jsxs)(`div`,{className:`ak-lightbox__toolbar`,onClick:e=>e.stopPropagation(),children:[e.length>1&&(0,n.jsxs)(`span`,{className:`ak-lightbox__counter`,children:[s+1,` / `,e.length]}),(0,n.jsx)(`a`,{href:Ca(c.downloadHref)??void 0,download:!0,target:`_blank`,rel:`noopener noreferrer`,className:`ak-lightbox__btn`,title:`Download image`,"aria-label":`Download image`,children:(0,n.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,n.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,n.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})}),(0,n.jsx)(`button`,{type:`button`,onClick:i,className:`ak-lightbox__btn`,title:`Close`,"aria-label":`Close image preview`,children:(0,n.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,n.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),e.length>1&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),a((s-1+e.length)%e.length)},className:`ak-lightbox__nav ak-lightbox__nav--prev`,"aria-label":`Previous image`,children:(0,n.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,n.jsx)(`polyline`,{points:`15 18 9 12 15 6`})})}),(0,n.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),a((s+1)%e.length)},className:`ak-lightbox__nav ak-lightbox__nav--next`,"aria-label":`Next image`,children:(0,n.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,n.jsx)(`polyline`,{points:`9 18 15 12 9 6`})})})]}),(0,n.jsx)(`img`,{src:c.src,alt:c.alt??`Image preview`,className:`ak-lightbox__img`,onClick:e=>e.stopPropagation()})]})}function La({url:e,mimeType:t,fileName:r}){let i=(()=>{if(r)return r;try{let t=new URL(e).pathname.split(`/`);return(t[t.length-1]||`attachment`).replace(/^\d{10,}-/,``)}catch{return`attachment`}})(),a=i.split(`.`).pop()?.toUpperCase()??``,o=t===`application/pdf`||a===`PDF`?{variant:`pdf`,label:`PDF`}:t===`text/csv`||a===`CSV`?{variant:`csv`,label:`CSV`}:t===`text/markdown`||a===`MD`?{variant:`md`,label:`MD`}:t===`text/plain`||a===`TXT`?{variant:`txt`,label:`TXT`}:{variant:`default`,label:a||`FILE`};return(0,n.jsxs)(`a`,{href:Ca(e)??void 0,target:`_blank`,rel:`noopener noreferrer`,className:`ak-file-chip`,title:i,children:[(0,n.jsx)(`span`,{className:`ak-file-chip__icon ak-file-chip__icon--${o.variant}`,"aria-hidden":!0,children:(0,n.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,n.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]})}),(0,n.jsxs)(`span`,{className:`ak-file-chip__body`,children:[(0,n.jsx)(`span`,{className:`ak-file-chip__name`,children:i}),(0,n.jsx)(`span`,{className:`ak-file-chip__label`,children:o.label})]})]})}function Ra(e){try{return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}catch{return``}}var za=/(`[^`\n]+`|\*\*[^*\n]+\*\*|\*[^*\n]+\*|!\[[^\]\n]*\]\([^)\n]+\)|\[[^\]\n]+\]\([^)\n]+\))/g;function $(e){let t=[],r=0,i=0;za.lastIndex=0;let a;for(;(a=za.exec(e))!==null;){a.index>r&&t.push(e.slice(r,a.index));let o=a[0];if(o.startsWith("`"))t.push((0,n.jsx)(`code`,{className:`ak-md-ic`,children:o.slice(1,-1)},i++));else if(o.startsWith(`**`))t.push((0,n.jsx)(`strong`,{children:o.slice(2,-2)},i++));else if(o.startsWith(`*`))t.push((0,n.jsx)(`em`,{children:o.slice(1,-1)},i++));else if(o.startsWith(`![`)){let e=o.match(/!\[([^\]]*)\]\(([^)]+)\)/),r=Ca(e?.[2]);e&&r?t.push((0,n.jsx)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,children:e[1]||`image`},i++)):e&&t.push(e[1]||`image`)}else{let e=o.match(/\[(.+?)\]\((.+?)\)/),r=Ca(e?.[2]);e&&r?t.push((0,n.jsx)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,children:e[1]},i++)):e?t.push(e[1]):t.push(o)}r=a.index+o.length}return r<e.length&&t.push(e.slice(r)),t}function Ba(e){e=wa(e);let t=e.split(`
|
|
2061
|
+
`)}function Oa(e){let[,n]=(0,t.useState)(0);(0,t.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(e=>e+1),1e3);return()=>clearInterval(t)},[e])}var ka=800;function Aa({up:e}){return(0,n.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,n.jsx)(`polyline`,{points:e?`18 15 12 9 6 15`:`6 9 12 15 18 9`})})}function ja({event:e,active:t}){return t?(0,n.jsx)(`span`,{className:`ak-progress__spinner`,"aria-hidden":`true`}):(0,n.jsx)(`svg`,{className:e.ok===!1?`ak-progress__step-icon ak-progress__step-icon--fail`:`ak-progress__step-icon`,width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:e.ok===!1?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,n.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]}):(0,n.jsx)(`polyline`,{points:`20 6 9 17 4 12`})})}function Ma({events:e,live:t,answerStartedAtMs:r}){Oa(t&&!r&&e.some(e=>e.status===`active`));let i=r??Date.now(),a=e[0]?.startedAtMs,o=e.reduce((e,t,n)=>t.status===`active`?n:e,-1);return(0,n.jsx)(`ul`,{className:`ak-progress__steps`,role:`list`,children:e.map((e,r)=>{let s=t&&e.status===`active`,c=s&&r===o?Ki(a?i-a:void 0):s?null:Ki(e.durationMs);return(0,n.jsxs)(`li`,{className:s?`ak-progress__step ak-progress__step--active`:`ak-progress__step`,children:[(0,n.jsx)(ja,{event:e,active:s}),(0,n.jsx)(`span`,{className:`ak-progress__step-text`,children:e.text}),c&&(0,n.jsxs)(`span`,{className:`ak-progress__step-dur`,children:[`· `,c]})]},`${e.toolId??e.stage}-${r}`)})})}function Na({events:e,answerStartedAtMs:r}){let[i,a]=(0,t.useState)(0),o=Math.min(i,e.length-1),s=o<e.length-1;(0,t.useEffect)(()=>{if(!s)return;let t=setTimeout(()=>a(t=>Math.min(t+1,e.length-1)),ka);return()=>clearTimeout(t)},[s,o,e.length]);let c=e[o],l=!s&&c.status===`done`;Oa(!l&&!r);let u=e[0]?.startedAtMs,d=l?null:Ki(u?(r??Date.now())-u:void 0);return(0,n.jsx)(`ul`,{className:`ak-progress__list`,role:`list`,children:(0,n.jsxs)(`li`,{className:`ak-progress__item ak-progress__item--active`,children:[l?(0,n.jsx)(ja,{event:c,active:!1}):(0,n.jsx)(`span`,{className:`ak-progress__spinner`,"aria-hidden":`true`}),(0,n.jsx)(`span`,{className:`ak-progress__text`,children:c.text}),d&&(0,n.jsxs)(`span`,{className:`ak-progress__step-dur`,children:[`· `,d]})]})})}function Pa({ackText:e,events:r=[],collapsed:i=!0,isComplete:a=!1,turnMeta:o,answerStartedAtMs:s}){let[c,l]=(0,t.useState)(!i);(0,t.useEffect)(()=>{a&&l(!i)},[a]);let u=o?.mode;if(!a)return r.length===0?e?(0,n.jsx)(`ul`,{className:`ak-progress__list`,role:`list`,children:(0,n.jsxs)(`li`,{className:`ak-progress__item ak-progress__item--active`,children:[(0,n.jsx)(`span`,{className:`ak-progress__spinner`,"aria-hidden":`true`}),(0,n.jsx)(`span`,{className:`ak-progress__text`,children:e})]})}):null:u===`detailed`?(0,n.jsx)(Ma,{events:r,live:!0,answerStartedAtMs:s}):(0,n.jsx)(Na,{events:r,answerStartedAtMs:s});let d=Ki(o?.totalMs),f=d?`Worked for ${d}`:`Finished working`;return u===`detailed`&&r.length>0?(0,n.jsxs)(`div`,{className:`ak-progress`,children:[(0,n.jsxs)(`button`,{type:`button`,onClick:()=>l(e=>!e),className:`ak-progress__summary`,"aria-expanded":c,"aria-label":c?`Hide working steps`:`Show working steps`,children:[(0,n.jsx)(ja,{event:{stage:``,text:``,timestamp:``,status:`done`},active:!1}),(0,n.jsx)(`span`,{children:f}),(0,n.jsxs)(`span`,{className:`ak-progress__step-dur`,children:[`· `,r.length,` step`,r.length===1?``:`s`]}),(0,n.jsx)(Aa,{up:c})]}),c&&(0,n.jsx)(Ma,{events:r,live:!1})]}):u===`standard`&&o?(0,n.jsx)(`div`,{className:`ak-progress`,children:(0,n.jsxs)(`p`,{className:`ak-progress__summary ak-progress__summary--static`,children:[(0,n.jsx)(ja,{event:{stage:``,text:``,timestamp:``,status:`done`},active:!1}),(0,n.jsx)(`span`,{children:f})]})}):null}function Fa(){return(0,n.jsx)(`svg`,{className:`ak-agent-status__icon`,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,n.jsx)(`path`,{d:`M12 2C12 2 12.7 8.1 14.5 9.5C16.3 10.9 22 12 22 12C22 12 16.3 13.1 14.5 14.5C12.7 15.9 12 22 12 22C12 22 11.3 15.9 9.5 14.5C7.7 13.1 2 12 2 12C2 12 7.7 10.9 9.5 9.5C11.3 8.1 12 2 12 2Z`})})}function Ia({status:e}){return(0,n.jsxs)(`div`,{className:`ak-agent-status`,role:`status`,"aria-live":`polite`,children:[(0,n.jsx)(Fa,{}),(0,n.jsx)(`span`,{className:`ak-agent-status__text`,children:e})]})}function La({messageId:e,images:t,onCellClick:r}){if(t.length===0)return null;let i=t.length;if(i===1){let e=t[0];return(0,n.jsxs)(`div`,{className:`ak-gallery ak-gallery--single`,children:[(0,n.jsx)(`button`,{type:`button`,onClick:()=>r(0),className:`ak-gallery__cell ak-gallery__cell--hero`,"aria-label":`Open image preview`,children:(0,n.jsx)(`img`,{src:e.src,alt:e.alt,className:`ak-gallery__img ak-gallery__img--contain`})}),(0,n.jsx)(`a`,{href:Ea(e.downloadHref)??void 0,download:!0,className:`ak-message__image-dl-icon`,title:`Download image`,onClick:e=>e.stopPropagation(),children:(0,n.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,n.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,n.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})})]})}if(i===2)return(0,n.jsx)(`div`,{className:`ak-gallery ak-gallery--two`,children:t.map((t,i)=>(0,n.jsx)(Ra,{src:t.src,alt:t.alt,onClick:()=>r(i)},t.key??`${e}-${i}`))});if(i===3)return(0,n.jsxs)(`div`,{className:`ak-gallery ak-gallery--three`,children:[(0,n.jsx)(Ra,{src:t[0].src,alt:t[0].alt,onClick:()=>r(0)},t[0].key??`${e}-0`),(0,n.jsxs)(`div`,{className:`ak-gallery__col`,children:[(0,n.jsx)(Ra,{src:t[1].src,alt:t[1].alt,onClick:()=>r(1)},t[1].key??`${e}-1`),(0,n.jsx)(Ra,{src:t[2].src,alt:t[2].alt,onClick:()=>r(2)},t[2].key??`${e}-2`)]})]});let a=t.slice(0,4),o=i>4?i-4:0;return(0,n.jsx)(`div`,{className:`ak-gallery ak-gallery--grid`,children:a.map((t,i)=>{let s=i===a.length-1;return(0,n.jsx)(Ra,{src:t.src,alt:t.alt,overlayCount:s&&o>0?o:0,onClick:()=>r(i)},t.key??`${e}-${i}`)})})}function Ra({src:e,alt:t,overlayCount:r=0,onClick:i}){return(0,n.jsxs)(`button`,{type:`button`,onClick:i,className:`ak-gallery__cell`,"aria-label":`Open image preview`,children:[(0,n.jsx)(`img`,{src:e,alt:t,className:`ak-gallery__img`,loading:`lazy`}),r>0&&(0,n.jsxs)(`span`,{className:`ak-gallery__overlay`,children:[`+`,r]})]})}function za({images:e,index:r,onClose:i,onIndexChange:a}){let o=r!==null,s=o&&r!==null?Math.min(Math.max(0,r),e.length-1):0,c=o?e[s]:null;return(0,t.useEffect)(()=>{if(!o)return;let t=t=>{t.key===`Escape`?(t.stopPropagation(),i()):t.key===`ArrowLeft`&&e.length>1?(t.preventDefault(),a((s-1+e.length)%e.length)):t.key===`ArrowRight`&&e.length>1&&(t.preventDefault(),a((s+1)%e.length))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[o,s,e.length,i,a]),!o||!c?null:(0,n.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Image preview`,className:`ak-lightbox`,onClick:i,children:[(0,n.jsxs)(`div`,{className:`ak-lightbox__toolbar`,onClick:e=>e.stopPropagation(),children:[e.length>1&&(0,n.jsxs)(`span`,{className:`ak-lightbox__counter`,children:[s+1,` / `,e.length]}),(0,n.jsx)(`a`,{href:Ea(c.downloadHref)??void 0,download:!0,target:`_blank`,rel:`noopener noreferrer`,className:`ak-lightbox__btn`,title:`Download image`,"aria-label":`Download image`,children:(0,n.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,n.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,n.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})}),(0,n.jsx)(`button`,{type:`button`,onClick:i,className:`ak-lightbox__btn`,title:`Close`,"aria-label":`Close image preview`,children:(0,n.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,n.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),e.length>1&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),a((s-1+e.length)%e.length)},className:`ak-lightbox__nav ak-lightbox__nav--prev`,"aria-label":`Previous image`,children:(0,n.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,n.jsx)(`polyline`,{points:`15 18 9 12 15 6`})})}),(0,n.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),a((s+1)%e.length)},className:`ak-lightbox__nav ak-lightbox__nav--next`,"aria-label":`Next image`,children:(0,n.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,n.jsx)(`polyline`,{points:`9 18 15 12 9 6`})})})]}),(0,n.jsx)(`img`,{src:c.src,alt:c.alt??`Image preview`,className:`ak-lightbox__img`,onClick:e=>e.stopPropagation()})]})}function Ba({url:e,mimeType:t,fileName:r}){let i=(()=>{if(r)return r;try{let t=new URL(e).pathname.split(`/`);return(t[t.length-1]||`attachment`).replace(/^\d{10,}-/,``)}catch{return`attachment`}})(),a=i.split(`.`).pop()?.toUpperCase()??``,o=t===`application/pdf`||a===`PDF`?{variant:`pdf`,label:`PDF`}:t===`text/csv`||a===`CSV`?{variant:`csv`,label:`CSV`}:t===`text/markdown`||a===`MD`?{variant:`md`,label:`MD`}:t===`text/plain`||a===`TXT`?{variant:`txt`,label:`TXT`}:{variant:`default`,label:a||`FILE`};return(0,n.jsxs)(`a`,{href:Ea(e)??void 0,target:`_blank`,rel:`noopener noreferrer`,className:`ak-file-chip`,title:i,children:[(0,n.jsx)(`span`,{className:`ak-file-chip__icon ak-file-chip__icon--${o.variant}`,"aria-hidden":!0,children:(0,n.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,n.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]})}),(0,n.jsxs)(`span`,{className:`ak-file-chip__body`,children:[(0,n.jsx)(`span`,{className:`ak-file-chip__name`,children:i}),(0,n.jsx)(`span`,{className:`ak-file-chip__label`,children:o.label})]})]})}function Va({url:e,mimeType:t,transcript:r}){return(0,n.jsxs)(`div`,{className:`ak-audio-chip`,children:[(0,n.jsx)(`audio`,{controls:!0,src:e,className:`ak-audio-chip__player`,"aria-label":`Voice note`,children:(0,n.jsx)(`source`,{src:e,type:t})}),r&&(0,n.jsx)(`p`,{className:`ak-audio-chip__transcript`,children:r})]})}function Ha(e){try{return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}catch{return``}}var Ua=/(`[^`\n]+`|\*\*[^*\n]+\*\*|\*[^*\n]+\*|!\[[^\]\n]*\]\([^)\n]+\)|\[[^\]\n]+\]\([^)\n]+\))/g;function $(e){let t=[],r=0,i=0;Ua.lastIndex=0;let a;for(;(a=Ua.exec(e))!==null;){a.index>r&&t.push(e.slice(r,a.index));let o=a[0];if(o.startsWith("`"))t.push((0,n.jsx)(`code`,{className:`ak-md-ic`,children:o.slice(1,-1)},i++));else if(o.startsWith(`**`))t.push((0,n.jsx)(`strong`,{children:o.slice(2,-2)},i++));else if(o.startsWith(`*`))t.push((0,n.jsx)(`em`,{children:o.slice(1,-1)},i++));else if(o.startsWith(`![`)){let e=o.match(/!\[([^\]]*)\]\(([^)]+)\)/),r=Ea(e?.[2]);e&&r?t.push((0,n.jsx)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,children:e[1]||`image`},i++)):e&&t.push(e[1]||`image`)}else{let e=o.match(/\[(.+?)\]\((.+?)\)/),r=Ea(e?.[2]);e&&r?t.push((0,n.jsx)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,children:e[1]},i++)):e?t.push(e[1]):t.push(o)}r=a.index+o.length}return r<e.length&&t.push(e.slice(r)),t}function Wa(e){e=Da(e);let t=e.split(`
|
|
1920
2062
|
`),r=[],i=0,a=0;for(;i<t.length;){let e=t[i],o=e.match(/^(\s*)```/);if(o){let s=o[1],c=e.trimStart().match(/^```(\w+)?\s*$/)?.[1]||``,l=[];for(i++;i<t.length&&!t[i].trimStart().startsWith("```");)l.push(t[i].startsWith(s)?t[i].slice(s.length):t[i]),i++;i<t.length&&t[i].trimStart().startsWith("```")&&i++,r.push((0,n.jsxs)(`div`,{className:`ak-md-pre-wrap`,children:[c&&(0,n.jsx)(`span`,{className:`ak-md-pre-lang`,children:c}),(0,n.jsx)(`pre`,{className:`ak-md-pre${c?` ak-md-pre--${c}`:``}`,children:(0,n.jsx)(`code`,{className:`ak-md-code`,children:l.join(`
|
|
1921
|
-
`)})})]},a++));continue}let s=e.match(/^(#{1,6})(\s+.*)?$/);if(s){let e=s[1].length,t=s[2]?$(s[2].trim()):``;e===1?r.push((0,n.jsx)(`h1`,{className:`ak-md-h1`,children:t},a++)):e===2?r.push((0,n.jsx)(`h2`,{className:`ak-md-h2`,children:t},a++)):e===3?r.push((0,n.jsx)(`h3`,{className:`ak-md-h3`,children:t},a++)):e===4?r.push((0,n.jsx)(`h4`,{className:`ak-md-h4`,children:t},a++)):e===5?r.push((0,n.jsx)(`h5`,{className:`ak-md-h5`,children:t},a++)):r.push((0,n.jsx)(`h6`,{className:`ak-md-h6`,children:t},a++)),i++;continue}if(/^[-*_]{3,}$/.test(e.trim())){r.push((0,n.jsx)(`hr`,{className:`ak-md-hr`},a++)),i++;continue}if(/^[-*+]\s/.test(e)){let e=[],o=i;for(;o<t.length&&(/^[-*+]\s/.test(t[o])||t[o].trim()===``);){if(t[o].trim()===``){o++;continue}let r=t[o].length-t[o].trimStart().length,i=t[o].replace(/^[-*+]\s+/,``),a=[],s=[],c=o+1;for(;c<t.length&&c<o+20;){let e=t[c];if(e.length-e.trimStart().length>r&&e.trim()!==``){let t=e.trim();/^[-*+]\s/.test(t)?a.push((0,n.jsx)(`li`,{children:$(t.replace(/^[-*+]\s+/,``))},`nested-${c}`)):s.push((0,n.jsx)(`p`,{style:{margin:`0.2em 0 0`},children:$(t)},`cont-${c}`)),c++}else break}let l=s.length>0||a.length>0?(0,n.jsxs)(n.Fragment,{children:[$(i),s,a.length>0&&(0,n.jsx)(`ul`,{style:{margin:`0.2em 0 0`,paddingLeft:`1.2em`},children:a})]}):$(i);e.push((0,n.jsx)(`li`,{children:l},`item-${o}`)),o=c}r.push((0,n.jsx)(`ul`,{className:`ak-md-ul`,children:e},a++)),i=o;continue}if(/^\d+\.\s/.test(e)){let e=[],o=i;for(;o<t.length&&(/^\d+\.\s/.test(t[o])||t[o].trim()===``);){if(t[o].trim()===``){o++;continue}let r=t[o].length-t[o].trimStart().length,i=t[o].replace(/^\d+\.\s+/,``),a=[],s=[],c=o+1;for(;c<t.length&&c<o+20;){let e=t[c];if(e.length-e.trimStart().length>r&&e.trim()!==``){let t=e.trim();/^\d+\.\s/.test(t)?a.push((0,n.jsx)(`li`,{children:$(t.replace(/^\d+\.\s+/,``))},`nested-order-${c}`)):/^[-*+]\s/.test(t)?a.push((0,n.jsx)(`li`,{children:$(t.replace(/^[-*+]\s+/,``))},`nested-unorder-${c}`)):s.push((0,n.jsx)(`p`,{style:{margin:`0.2em 0 0`},children:$(t)},`cont-${c}`)),c++}else break}let l=s.length>0||a.length>0?(0,n.jsxs)(n.Fragment,{children:[$(i),s,a.length>0&&(0,n.jsx)(`ol`,{style:{margin:`0.2em 0 0`,paddingLeft:`1.2em`},children:a})]}):$(i);e.push((0,n.jsx)(`li`,{children:l},`order-item-${o}`)),o=c}r.push((0,n.jsx)(`ol`,{className:`ak-md-ol`,children:e},a++)),i=o;continue}if(e.trim()===``){i++;continue}if(e.includes(`|`)&&i+1<t.length&&t[i+1].includes(`|`)){let o=t[i+1];if(/^\s*\|?[\s:|*-]+\|[\s:|*-|]+\|?[\s:|*-]*$/.test(o)){let s=e.split(`|`).map(e=>e.trim()).filter(e=>e.length>0),c=o.split(`|`).map(e=>{let t=e.trim();return t.startsWith(`:`)&&t.endsWith(`:`)?`center`:t.endsWith(`:`)?`right`:(t.startsWith(`:`),`left`)}).filter((e,t)=>t>0&&t<=s.length),l=[],u=i+2;for(;u<t.length&&t[u].includes(`|`)&&t[u].trim()!==``;){let e=t[u].split(`|`).map(e=>e.trim()).filter(e=>e.length>0);if(e.length>0)l.push(e),u++;else break}r.push((0,n.jsxs)(`table`,{className:`ak-md-table`,children:[(0,n.jsx)(`thead`,{children:(0,n.jsx)(`tr`,{children:s.map((e,t)=>(0,n.jsx)(`th`,{style:{textAlign:c[t]||`left`},className:`ak-md-th`,children:$(e)},`th-${t}`))})}),(0,n.jsx)(`tbody`,{children:l.map((e,t)=>(0,n.jsx)(`tr`,{children:s.map((r,i)=>(0,n.jsx)(`td`,{style:{textAlign:c[i]||`left`},className:`ak-md-td`,children:e[i]?$(e[i]):``},`td-${t}-${i}`))},`tr-${t}`))})]},a++)),i=u;continue}}let c=[];for(;i<t.length&&t[i].trim()!==``&&!t[i].startsWith(`#`)&&!/^\s*```/.test(t[i])&&!/^[-*+]\s/.test(t[i])&&!/^\d+\.\s/.test(t[i])&&!/^[-*_]{3,}$/.test(t[i].trim());)c.push(t[i]),i++;if(c.length>0){let e=[];c.forEach((t,r)=>{e.push(...$(t)),r<c.length-1&&e.push((0,n.jsx)(`br`,{},`br-${r}`))}),r.push((0,n.jsx)(`p`,{className:`ak-md-p`,children:e},a++))}}return(0,n.jsx)(n.Fragment,{children:r})}function Va({message:e}){let[r,i]=(0,t.useState)(null),[a,o]=(0,t.useState)(null),s=e.role===`user`,c=e.status===`error`,l=e.status===`streaming`,u=!!(e.images&&e.images.length>0),d=!!(e.documents&&e.documents.length>0),f=(()=>{if(!s)return[];let t=(e.uploadedAttachments??[]).filter(e=>e.kind===`image`).map(e=>({url:e.url,mimeType:e.mimeType,fileName:e.fileName}));return t.length>0?t:e.uploadedImageUrl?[{url:e.uploadedImageUrl,mimeType:`image/jpeg`}]:[]})(),p=s?(e.uploadedAttachments??[]).filter(e=>e.kind===`file`):[],m=f.length>0,h=p.length>0,g=u||m,_=!!e.progressEvents&&e.progressEvents.length>0,v=l&&!e.content&&!e.toolStatus&&!_,y=!s&&!c,b=!!e.isHuman&&!s,x=s?`ak-message--user`:c?`ak-message--assistant ak-message--error`:b?`ak-message--assistant ak-message--operator`:`ak-message--assistant`,S=[`ak-message__bubble`,y?`ak-message__bubble--md`:``,g?`ak-message__bubble--has-image`:``,b?`ak-message__bubble--operator`:``].filter(Boolean).join(` `),C=b?e.senderDisplay?.trim()||`Operator`:null,w=C?C.charAt(0).toUpperCase():``,T=(0,n.jsxs)(`div`,{className:S,children:[m&&(0,n.jsx)(Pa,{messageId:`${e.id}-up`,images:f.map(e=>({src:e.url,alt:e.fileName??`Uploaded image`,downloadHref:e.url})),onCellClick:e=>i(e)}),h&&(0,n.jsx)(`div`,{className:`ak-message__files`,children:p.map((t,r)=>(0,n.jsx)(La,{url:t.url,mimeType:t.mimeType,fileName:t.fileName},`${e.id}-up-file-${r}`))}),u&&(0,n.jsx)(Pa,{messageId:`${e.id}-asst`,images:e.images.map((e,t)=>{let n=e.url??(e.base64?`data:${e.mimeType};base64,${e.base64}`:null);return n?{src:n,alt:`Generated image`,downloadHref:e.url??n,key:`gen-${t}`}:null}).filter(e=>e!==null),onCellClick:e=>o(e)}),d&&(0,n.jsx)(`div`,{className:`ak-message__files`,children:e.documents.map((t,r)=>t.url?(0,n.jsx)(La,{url:t.url,mimeType:t.mimeType,fileName:t.fileName},`${e.id}-asst-doc-${r}`):null)}),e.content&&(0,n.jsxs)(`div`,{className:g?`ak-message__image-caption`:void 0,children:[y?Ba(e.content):e.content,l&&(0,n.jsxs)(`span`,{className:`ak-cursor`,"aria-hidden":`true`,children:[(0,n.jsx)(`span`,{className:`ak-cursor__dot`}),(0,n.jsx)(`span`,{className:`ak-cursor__dot`}),(0,n.jsx)(`span`,{className:`ak-cursor__dot`})]})]}),(0,n.jsx)(`span`,{className:`ak-message__time`,children:Ra(e.createdAt)})]}),E=!!e.content||g||h||d||!l&&!e.toolStatus;return(0,n.jsxs)(`div`,{className:`ak-message ${x}`,children:[!s&&(e.ackText||e.progressEvents&&e.progressEvents.length>0||e.turnMeta)&&(0,n.jsx)(ja,{ackText:e.ackText,events:e.progressEvents,collapsed:e.progressCollapsed,isComplete:!l,turnMeta:e.turnMeta,answerStartedAtMs:e.answerStartedAtMs}),v&&(0,n.jsxs)(`div`,{className:`ak-typing-row`,role:`status`,"aria-label":`Assistant is typing`,children:[(0,n.jsx)(`span`,{className:`ak-typing-row__dot`}),(0,n.jsx)(`span`,{className:`ak-typing-row__dot`}),(0,n.jsx)(`span`,{className:`ak-typing-row__dot`})]}),!s&&e.toolStatus&&!(e.progressEvents&&e.progressEvents.length>0)&&(0,n.jsx)(Na,{status:e.toolStatus}),b&&(0,n.jsxs)(`span`,{className:`ak-message__sender-label`,children:[(0,n.jsx)(`span`,{className:`ak-message__operator-avatar`,"aria-hidden":`true`,children:w}),(0,n.jsx)(`span`,{className:`ak-message__operator-name`,children:C})]}),E&&T,f.length>0&&(0,n.jsx)(Ia,{images:f.map(e=>({src:e.url,alt:e.fileName??`Uploaded image`,downloadHref:e.url})),index:r,onClose:()=>i(null),onIndexChange:i}),u&&(0,n.jsx)(Ia,{images:e.images.map(e=>{let t=e.url??(e.base64?`data:${e.mimeType};base64,${e.base64}`:null);return t?{src:t,alt:`Generated image`,downloadHref:e.url??t}:null}).filter(e=>e!==null),index:a,onClose:()=>o(null),onIndexChange:o})]})}function Ha(){return(0,n.jsxs)(`div`,{className:`ak-typing`,"aria-label":`Assistant is typing`,children:[(0,n.jsx)(`span`,{className:`ak-typing__dot`}),(0,n.jsx)(`span`,{className:`ak-typing__dot`}),(0,n.jsx)(`span`,{className:`ak-typing__dot`})]})}function Ua(e,t){let n=[],r=null;for(let i of e){if(i.role===`assistant`){let e=!!i.isHuman;r!==null&&r!==e&&n.push({kind:`divider`,id:`divider-${i.id}`,label:e?`${i.senderDisplay?.trim()||t} joined the chat`:`${t} left — AI is back`}),r=e}n.push({kind:`message`,message:i})}return n}function Wa({messages:e,isLoading:r,operatorFallbackLabel:i=`Operator`}){let a=(0,t.useRef)(null),o=(0,t.useRef)(null),s=(0,t.useRef)(!0),c=(0,t.useMemo)(()=>Ua(e,i),[e,i]);return(0,t.useEffect)(()=>{if(!(a.current?.parentElement??a.current))return;let e=e=>{s.current=e.scrollHeight-e.scrollTop-e.clientHeight<120},t=a.current;for(;t&&getComputedStyle(t).overflowY===`visible`;)t=t.parentElement;if(!t)return;let n=()=>e(t);return t.addEventListener(`scroll`,n,{passive:!0}),()=>t.removeEventListener(`scroll`,n)},[]),(0,t.useEffect)(()=>{e[e.length-1]?.role===`user`&&(s.current=!0),s.current&&o.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,t.useEffect)(()=>{s.current&&o.current?.scrollIntoView({behavior:`smooth`})},[r,e.find(e=>e.status===`streaming`)?.content??``]),(0,n.jsxs)(`div`,{ref:a,className:`ak-messages`,role:`log`,"aria-live":`polite`,"aria-label":`Conversation`,children:[c.map(e=>e.kind===`divider`?(0,n.jsx)(`div`,{className:`ak-handoff-divider`,role:`separator`,children:(0,n.jsx)(`span`,{className:`ak-handoff-divider__label`,children:e.label})},e.id):(0,n.jsx)(Va,{message:e.message},e.message.id)),r&&!e.some(e=>e.status===`streaming`)&&(0,n.jsx)(Ha,{}),(0,n.jsx)(`div`,{ref:o})]})}function Ga(){return(0,n.jsxs)(`svg`,{width:`30`,height:`30`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,n.jsx)(`rect`,{x:`3`,y:`11`,width:`18`,height:`10`,rx:`2`}),(0,n.jsx)(`circle`,{cx:`12`,cy:`5`,r:`2`}),(0,n.jsx)(`path`,{d:`M12 7v4`}),(0,n.jsx)(`line`,{x1:`8`,y1:`16`,x2:`8`,y2:`16`}),(0,n.jsx)(`line`,{x1:`16`,y1:`16`,x2:`16`,y2:`16`})]})}function Ka({title:e,description:t,suggestedQuestions:r,avatarUrl:i,onSelect:a}){let o=(r??[]).filter(e=>(e.title??``).trim().length>0);return(0,n.jsxs)(`div`,{className:`ak-empty-state`,"aria-label":`Start a conversation`,children:[(0,n.jsx)(`div`,{className:`ak-empty-state__glow`,"aria-hidden":`true`}),(0,n.jsxs)(`div`,{className:`ak-empty-state__body`,children:[(0,n.jsx)(`div`,{className:`ak-empty-state__avatar`,children:i?(0,n.jsx)(`img`,{src:i,alt:``,className:`ak-empty-state__avatar-img`,"aria-hidden":`true`}):(0,n.jsx)(`span`,{className:`ak-empty-state__bot-icon`,"aria-hidden":`true`,children:(0,n.jsx)(Ga,{})})}),(0,n.jsx)(`p`,{className:`ak-empty-state__title`,children:e}),t&&(0,n.jsx)(`p`,{className:`ak-empty-state__description`,children:t})]}),o.length>0&&(0,n.jsx)(`div`,{className:`ak-empty-state__suggestions`,children:o.map((e,t)=>(0,n.jsxs)(`button`,{className:`ak-empty-state__suggestion`,onClick:()=>a?.(e.prompt??e.title),type:`button`,children:[(0,n.jsx)(`span`,{className:`ak-empty-state__suggestion-title`,children:e.title}),e.description&&(0,n.jsx)(`span`,{className:`ak-empty-state__suggestion-desc`,children:e.description})]},t))})]})}var qa=`https://klicforge.ai/privacy-policy`,Ja=`https://klicforge.ai/terms-of-service`;function Ya(){return(0,n.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`line`,{x1:`22`,y1:`2`,x2:`11`,y2:`13`}),(0,n.jsx)(`polygon`,{points:`22 2 15 22 11 13 2 9 22 2`})]})}function Xa(){return(0,n.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,children:[(0,n.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,n.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]})}function Za(){return(0,n.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z`}),(0,n.jsx)(`circle`,{cx:`12`,cy:`13`,r:`4`})]})}function Qa(){return(0,n.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,n.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]})}function $a(){return(0,n.jsxs)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,n.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})}var eo=[`application/pdf`,`text/markdown`,`text/plain`,`text/csv`],to=[`.pdf`,`.md`,`.txt`,`.csv`],no=[...to,...eo].join(`,`),ro=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`],io=ro.join(`,`);function ao(e){if(eo.includes(e.type))return!0;let t=e.name.toLowerCase();return to.some(e=>t.endsWith(e))}function oo(e){return ro.includes(e.type)}function so({onSend:e,disabled:r=!1,placeholder:i=`Type a message…`,photoSendingEnabled:a=!1,fileUploadEnabled:o=!1,attachmentMaxCount:s=5,attachmentMaxFileSizeMb:c=1}){let[l,u]=(0,t.useState)(``),[d,f]=(0,t.useState)([]),[p,m]=(0,t.useState)(new Map),[h,g]=(0,t.useState)(!1),_=(0,t.useRef)(null),v=(0,t.useRef)(null),y=(0,t.useRef)(null),b=(0,t.useRef)(null),x=(0,t.useRef)(null),S=a||o,C=(0,t.useMemo)(()=>c*1024*1024,[c]);(0,t.useEffect)(()=>()=>{p.forEach(e=>URL.revokeObjectURL(e))},[]),(0,t.useEffect)(()=>{r||_.current?.focus()},[r]);let w=(0,t.useCallback)(e=>{if(!h)return;let t=e.composedPath?e.composedPath():[],n=!!b.current&&t.includes(b.current),r=!!x.current&&t.includes(x.current);!n&&!r&&g(!1)},[h]);(0,t.useEffect)(()=>{if(h)return document.addEventListener(`click`,w),()=>document.removeEventListener(`click`,w)},[h,w]),(0,t.useEffect)(()=>{S||g(!1)},[S]);function T(){p.forEach(e=>URL.revokeObjectURL(e)),m(new Map),f([]),v.current&&(v.current.value=``),y.current&&(y.current.value=``)}function E(e){f(t=>{let n=t[e];if(n){let e=p.get(n.file);e&&(URL.revokeObjectURL(e),m(e=>{let t=new Map(e);return t.delete(n.file),t}))}return t.filter((t,n)=>n!==e)})}function D(){let t=l.trim();!t&&d.length===0||r||(e(t,d),u(``),T(),_.current&&(_.current.style.height=`auto`))}function ee(e){e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),D())}function te(e){let t=e.currentTarget;u(t.value),t.style.height=`auto`,t.style.height=`${t.scrollHeight}px`}function ne(e,t){if(e.length===0)return;let n=[],r=[];for(let i of e){if(t===`image`&&!oo(i)){r.push(`${i.name} (image type not supported)`);continue}if(t===`file`&&!ao(i)){r.push(`${i.name} (file type not supported)`);continue}if(i.size>C){r.push(`${i.name} (over ${c} MB)`);continue}n.push({file:i,kind:t})}f(e=>{let t=[...e,...n],i=t.slice(0,s);return t.length>s&&r.push(`max ${s} attachments allowed`),m(e=>{let t=new Map(e);for(let e of i)e.kind===`image`&&!t.has(e.file)&&t.set(e.file,URL.createObjectURL(e.file));return t}),i}),r.length>0&&alert(`Some attachments were not added:\n• ${r.join(`
|
|
1922
|
-
• `)}`)}function
|
|
1923
|
-
`+
|
|
2063
|
+
`)})})]},a++));continue}let s=e.match(/^(#{1,6})(\s+.*)?$/);if(s){let e=s[1].length,t=s[2]?$(s[2].trim()):``;e===1?r.push((0,n.jsx)(`h1`,{className:`ak-md-h1`,children:t},a++)):e===2?r.push((0,n.jsx)(`h2`,{className:`ak-md-h2`,children:t},a++)):e===3?r.push((0,n.jsx)(`h3`,{className:`ak-md-h3`,children:t},a++)):e===4?r.push((0,n.jsx)(`h4`,{className:`ak-md-h4`,children:t},a++)):e===5?r.push((0,n.jsx)(`h5`,{className:`ak-md-h5`,children:t},a++)):r.push((0,n.jsx)(`h6`,{className:`ak-md-h6`,children:t},a++)),i++;continue}if(/^[-*_]{3,}$/.test(e.trim())){r.push((0,n.jsx)(`hr`,{className:`ak-md-hr`},a++)),i++;continue}if(/^[-*+]\s/.test(e)){let e=[],o=i;for(;o<t.length&&(/^[-*+]\s/.test(t[o])||t[o].trim()===``);){if(t[o].trim()===``){o++;continue}let r=t[o].length-t[o].trimStart().length,i=t[o].replace(/^[-*+]\s+/,``),a=[],s=[],c=o+1;for(;c<t.length&&c<o+20;){let e=t[c];if(e.length-e.trimStart().length>r&&e.trim()!==``){let t=e.trim();/^[-*+]\s/.test(t)?a.push((0,n.jsx)(`li`,{children:$(t.replace(/^[-*+]\s+/,``))},`nested-${c}`)):s.push((0,n.jsx)(`p`,{style:{margin:`0.2em 0 0`},children:$(t)},`cont-${c}`)),c++}else break}let l=s.length>0||a.length>0?(0,n.jsxs)(n.Fragment,{children:[$(i),s,a.length>0&&(0,n.jsx)(`ul`,{style:{margin:`0.2em 0 0`,paddingLeft:`1.2em`},children:a})]}):$(i);e.push((0,n.jsx)(`li`,{children:l},`item-${o}`)),o=c}r.push((0,n.jsx)(`ul`,{className:`ak-md-ul`,children:e},a++)),i=o;continue}if(/^\d+\.\s/.test(e)){let e=[],o=i;for(;o<t.length&&(/^\d+\.\s/.test(t[o])||t[o].trim()===``);){if(t[o].trim()===``){o++;continue}let r=t[o].length-t[o].trimStart().length,i=t[o].replace(/^\d+\.\s+/,``),a=[],s=[],c=o+1;for(;c<t.length&&c<o+20;){let e=t[c];if(e.length-e.trimStart().length>r&&e.trim()!==``){let t=e.trim();/^\d+\.\s/.test(t)?a.push((0,n.jsx)(`li`,{children:$(t.replace(/^\d+\.\s+/,``))},`nested-order-${c}`)):/^[-*+]\s/.test(t)?a.push((0,n.jsx)(`li`,{children:$(t.replace(/^[-*+]\s+/,``))},`nested-unorder-${c}`)):s.push((0,n.jsx)(`p`,{style:{margin:`0.2em 0 0`},children:$(t)},`cont-${c}`)),c++}else break}let l=s.length>0||a.length>0?(0,n.jsxs)(n.Fragment,{children:[$(i),s,a.length>0&&(0,n.jsx)(`ol`,{style:{margin:`0.2em 0 0`,paddingLeft:`1.2em`},children:a})]}):$(i);e.push((0,n.jsx)(`li`,{children:l},`order-item-${o}`)),o=c}r.push((0,n.jsx)(`ol`,{className:`ak-md-ol`,children:e},a++)),i=o;continue}if(e.trim()===``){i++;continue}if(e.includes(`|`)&&i+1<t.length&&t[i+1].includes(`|`)){let o=t[i+1];if(/^\s*\|?[\s:|*-]+\|[\s:|*-|]+\|?[\s:|*-]*$/.test(o)){let s=e.split(`|`).map(e=>e.trim()).filter(e=>e.length>0),c=o.split(`|`).map(e=>{let t=e.trim();return t.startsWith(`:`)&&t.endsWith(`:`)?`center`:t.endsWith(`:`)?`right`:(t.startsWith(`:`),`left`)}).filter((e,t)=>t>0&&t<=s.length),l=[],u=i+2;for(;u<t.length&&t[u].includes(`|`)&&t[u].trim()!==``;){let e=t[u].split(`|`).map(e=>e.trim()).filter(e=>e.length>0);if(e.length>0)l.push(e),u++;else break}r.push((0,n.jsxs)(`table`,{className:`ak-md-table`,children:[(0,n.jsx)(`thead`,{children:(0,n.jsx)(`tr`,{children:s.map((e,t)=>(0,n.jsx)(`th`,{style:{textAlign:c[t]||`left`},className:`ak-md-th`,children:$(e)},`th-${t}`))})}),(0,n.jsx)(`tbody`,{children:l.map((e,t)=>(0,n.jsx)(`tr`,{children:s.map((r,i)=>(0,n.jsx)(`td`,{style:{textAlign:c[i]||`left`},className:`ak-md-td`,children:e[i]?$(e[i]):``},`td-${t}-${i}`))},`tr-${t}`))})]},a++)),i=u;continue}}let c=[];for(;i<t.length&&t[i].trim()!==``&&!t[i].startsWith(`#`)&&!/^\s*```/.test(t[i])&&!/^[-*+]\s/.test(t[i])&&!/^\d+\.\s/.test(t[i])&&!/^[-*_]{3,}$/.test(t[i].trim());)c.push(t[i]),i++;if(c.length>0){let e=[];c.forEach((t,r)=>{e.push(...$(t)),r<c.length-1&&e.push((0,n.jsx)(`br`,{},`br-${r}`))}),r.push((0,n.jsx)(`p`,{className:`ak-md-p`,children:e},a++))}}return(0,n.jsx)(n.Fragment,{children:r})}function Ga({message:e}){let[r,i]=(0,t.useState)(null),[a,o]=(0,t.useState)(null),s=e.role===`user`,c=e.status===`error`,l=e.status===`streaming`,u=!!(e.images&&e.images.length>0),d=!!(e.documents&&e.documents.length>0),f=(()=>{if(!s)return[];let t=(e.uploadedAttachments??[]).filter(e=>e.kind===`image`).map(e=>({url:e.url,mimeType:e.mimeType,fileName:e.fileName}));return t.length>0?t:e.uploadedImageUrl?[{url:e.uploadedImageUrl,mimeType:`image/jpeg`}]:[]})(),p=s?(e.uploadedAttachments??[]).filter(e=>e.kind===`file`):[],m=s?(e.uploadedAttachments??[]).filter(e=>e.kind===`audio`):[],h=f.length>0,g=p.length>0,_=m.length>0,v=u||h,y=s&&_?Yi(e.content):null,b=y?y.rest:e.content,x=!!e.progressEvents&&e.progressEvents.length>0,S=l&&!e.content&&!e.toolStatus&&!x,C=!s&&!c,w=!!e.isHuman&&!s,T=s?`ak-message--user`:c?`ak-message--assistant ak-message--error`:w?`ak-message--assistant ak-message--operator`:`ak-message--assistant`,E=[`ak-message__bubble`,C?`ak-message__bubble--md`:``,v?`ak-message__bubble--has-image`:``,w?`ak-message__bubble--operator`:``].filter(Boolean).join(` `),D=w?e.senderDisplay?.trim()||`Operator`:null,O=D?D.charAt(0).toUpperCase():``,ee=(0,n.jsxs)(`div`,{className:E,children:[h&&(0,n.jsx)(La,{messageId:`${e.id}-up`,images:f.map(e=>({src:e.url,alt:e.fileName??`Uploaded image`,downloadHref:e.url})),onCellClick:e=>i(e)}),g&&(0,n.jsx)(`div`,{className:`ak-message__files`,children:p.map((t,r)=>(0,n.jsx)(Ba,{url:t.url,mimeType:t.mimeType,fileName:t.fileName},`${e.id}-up-file-${r}`))}),_&&(0,n.jsx)(`div`,{className:`ak-message__files`,children:m.map((t,r)=>(0,n.jsx)(Va,{url:t.url,mimeType:t.mimeType,transcript:r===0?y?.transcript??null:null},`${e.id}-up-audio-${r}`))}),u&&(0,n.jsx)(La,{messageId:`${e.id}-asst`,images:e.images.map((e,t)=>{let n=e.url??(e.base64?`data:${e.mimeType};base64,${e.base64}`:null);return n?{src:n,alt:`Generated image`,downloadHref:e.url??n,key:`gen-${t}`}:null}).filter(e=>e!==null),onCellClick:e=>o(e)}),d&&(0,n.jsx)(`div`,{className:`ak-message__files`,children:e.documents.map((t,r)=>t.url?(0,n.jsx)(Ba,{url:t.url,mimeType:t.mimeType,fileName:t.fileName},`${e.id}-asst-doc-${r}`):null)}),b&&(0,n.jsxs)(`div`,{className:v?`ak-message__image-caption`:void 0,children:[C?Wa(b):b,l&&(0,n.jsxs)(`span`,{className:`ak-cursor`,"aria-hidden":`true`,children:[(0,n.jsx)(`span`,{className:`ak-cursor__dot`}),(0,n.jsx)(`span`,{className:`ak-cursor__dot`}),(0,n.jsx)(`span`,{className:`ak-cursor__dot`})]})]}),(0,n.jsx)(`span`,{className:`ak-message__time`,children:Ha(e.createdAt)})]}),k=!!e.content||v||g||d||!l&&!e.toolStatus;return(0,n.jsxs)(`div`,{className:`ak-message ${T}`,children:[!s&&(e.ackText||e.progressEvents&&e.progressEvents.length>0||e.turnMeta)&&(0,n.jsx)(Pa,{ackText:e.ackText,events:e.progressEvents,collapsed:e.progressCollapsed,isComplete:!l,turnMeta:e.turnMeta,answerStartedAtMs:e.answerStartedAtMs}),S&&(0,n.jsxs)(`div`,{className:`ak-typing-row`,role:`status`,"aria-label":`Assistant is typing`,children:[(0,n.jsx)(`span`,{className:`ak-typing-row__dot`}),(0,n.jsx)(`span`,{className:`ak-typing-row__dot`}),(0,n.jsx)(`span`,{className:`ak-typing-row__dot`})]}),!s&&e.toolStatus&&!(e.progressEvents&&e.progressEvents.length>0)&&(0,n.jsx)(Ia,{status:e.toolStatus}),w&&(0,n.jsxs)(`span`,{className:`ak-message__sender-label`,children:[(0,n.jsx)(`span`,{className:`ak-message__operator-avatar`,"aria-hidden":`true`,children:O}),(0,n.jsx)(`span`,{className:`ak-message__operator-name`,children:D})]}),k&&ee,f.length>0&&(0,n.jsx)(za,{images:f.map(e=>({src:e.url,alt:e.fileName??`Uploaded image`,downloadHref:e.url})),index:r,onClose:()=>i(null),onIndexChange:i}),u&&(0,n.jsx)(za,{images:e.images.map(e=>{let t=e.url??(e.base64?`data:${e.mimeType};base64,${e.base64}`:null);return t?{src:t,alt:`Generated image`,downloadHref:e.url??t}:null}).filter(e=>e!==null),index:a,onClose:()=>o(null),onIndexChange:o})]})}function Ka(){return(0,n.jsxs)(`div`,{className:`ak-typing`,"aria-label":`Assistant is typing`,children:[(0,n.jsx)(`span`,{className:`ak-typing__dot`}),(0,n.jsx)(`span`,{className:`ak-typing__dot`}),(0,n.jsx)(`span`,{className:`ak-typing__dot`})]})}function qa(e,t){let n=[],r=null;for(let i of e){if(i.role===`assistant`){let e=!!i.isHuman;r!==null&&r!==e&&n.push({kind:`divider`,id:`divider-${i.id}`,label:e?`${i.senderDisplay?.trim()||t} joined the chat`:`${t} left — AI is back`}),r=e}n.push({kind:`message`,message:i})}return n}function Ja({messages:e,isLoading:r,operatorFallbackLabel:i=`Operator`}){let a=(0,t.useRef)(null),o=(0,t.useRef)(null),s=(0,t.useRef)(!0),c=(0,t.useMemo)(()=>qa(e,i),[e,i]);(0,t.useEffect)(()=>{if(!(a.current?.parentElement??a.current))return;let e=e=>{s.current=e.scrollHeight-e.scrollTop-e.clientHeight<120},t=a.current;for(;t&&getComputedStyle(t).overflowY===`visible`;)t=t.parentElement;if(!t)return;let n=()=>e(t);return t.addEventListener(`scroll`,n,{passive:!0}),()=>t.removeEventListener(`scroll`,n)},[]),(0,t.useEffect)(()=>{e[e.length-1]?.role===`user`&&(s.current=!0),s.current&&o.current?.scrollIntoView({behavior:`smooth`})},[e]);let l=e.find(e=>e.status===`streaming`)?.content??``;return(0,t.useEffect)(()=>{s.current&&o.current?.scrollIntoView({behavior:`smooth`})},[r,l]),(0,n.jsxs)(`div`,{ref:a,className:`ak-messages`,role:`log`,"aria-live":`polite`,"aria-label":`Conversation`,children:[c.map(e=>e.kind===`divider`?(0,n.jsx)(`div`,{className:`ak-handoff-divider`,role:`separator`,children:(0,n.jsx)(`span`,{className:`ak-handoff-divider__label`,children:e.label})},e.id):(0,n.jsx)(Ga,{message:e.message},e.message.id)),r&&!e.some(e=>e.status===`streaming`)&&(0,n.jsx)(Ka,{}),(0,n.jsx)(`div`,{ref:o})]})}function Ya(){return(0,n.jsxs)(`svg`,{width:`30`,height:`30`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,n.jsx)(`rect`,{x:`3`,y:`11`,width:`18`,height:`10`,rx:`2`}),(0,n.jsx)(`circle`,{cx:`12`,cy:`5`,r:`2`}),(0,n.jsx)(`path`,{d:`M12 7v4`}),(0,n.jsx)(`line`,{x1:`8`,y1:`16`,x2:`8`,y2:`16`}),(0,n.jsx)(`line`,{x1:`16`,y1:`16`,x2:`16`,y2:`16`})]})}function Xa({title:e,description:t,suggestedQuestions:r,avatarUrl:i,onSelect:a}){let o=(r??[]).filter(e=>(e.title??``).trim().length>0);return(0,n.jsxs)(`div`,{className:`ak-empty-state`,"aria-label":`Start a conversation`,children:[(0,n.jsx)(`div`,{className:`ak-empty-state__glow`,"aria-hidden":`true`}),(0,n.jsxs)(`div`,{className:`ak-empty-state__body`,children:[(0,n.jsx)(`div`,{className:`ak-empty-state__avatar`,children:i?(0,n.jsx)(`img`,{src:i,alt:``,className:`ak-empty-state__avatar-img`,"aria-hidden":`true`}):(0,n.jsx)(`span`,{className:`ak-empty-state__bot-icon`,"aria-hidden":`true`,children:(0,n.jsx)(Ya,{})})}),(0,n.jsx)(`p`,{className:`ak-empty-state__title`,children:e}),t&&(0,n.jsx)(`p`,{className:`ak-empty-state__description`,children:t})]}),o.length>0&&(0,n.jsx)(`div`,{className:`ak-empty-state__suggestions`,children:o.map((e,t)=>(0,n.jsxs)(`button`,{className:`ak-empty-state__suggestion`,onClick:()=>a?.(e.prompt??e.title),type:`button`,children:[(0,n.jsx)(`span`,{className:`ak-empty-state__suggestion-title`,children:e.title}),e.description&&(0,n.jsx)(`span`,{className:`ak-empty-state__suggestion-desc`,children:e.description})]},t))})]})}var Za=`https://klicforge.ai/privacy-policy`,Qa=`https://klicforge.ai/terms-of-service`;function $a(){return(0,n.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`line`,{x1:`12`,y1:`19`,x2:`12`,y2:`5`}),(0,n.jsx)(`polyline`,{points:`5 12 12 5 19 12`})]})}function eo(){return(0,n.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,n.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,n.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]})}function to(){return(0,n.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z`}),(0,n.jsx)(`circle`,{cx:`12`,cy:`13`,r:`4`})]})}function no(){return(0,n.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,n.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]})}function ro(){return(0,n.jsxs)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,n.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})}function io(){return(0,n.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`path`,{d:`M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z`}),(0,n.jsx)(`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`}),(0,n.jsx)(`line`,{x1:`12`,y1:`19`,x2:`12`,y2:`23`}),(0,n.jsx)(`line`,{x1:`8`,y1:`23`,x2:`16`,y2:`23`})]})}function ao(){return(0,n.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,n.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`})})}var oo=[`application/pdf`,`text/markdown`,`text/plain`,`text/csv`],so=[`.pdf`,`.md`,`.txt`,`.csv`],co=[...so,...oo].join(`,`),lo=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`],uo=lo.join(`,`),fo=[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`];function po(){return typeof MediaRecorder>`u`?null:fo.find(e=>MediaRecorder.isTypeSupported(e))??null}function mo(e){return e.includes(`mp4`)?`mp4`:e.includes(`ogg`)?`ogg`:`webm`}function ho(e){let t=Math.floor(e/1e3),n=Math.floor(t/60),r=t%60;return`${n}:${String(r).padStart(2,`0`)}`}function go(e){if(oo.includes(e.type))return!0;let t=e.name.toLowerCase();return so.some(e=>t.endsWith(e))}function _o(e){return lo.includes(e.type)}function vo({onSend:e,disabled:r=!1,placeholder:i=`Type a message…`,photoSendingEnabled:a=!1,fileUploadEnabled:o=!1,voiceNoteEnabled:s=!1,voiceNoteMaxDurationSec:c=120,attachmentMaxCount:l=5,attachmentMaxFileSizeMb:u=1,onRecordingError:d}){let[f,p]=(0,t.useState)(``),[m,h]=(0,t.useState)([]),[g,_]=(0,t.useState)(new Map),[v,y]=(0,t.useState)(!1),[b,x]=(0,t.useState)(!1),[S,C]=(0,t.useState)(0),w=(0,t.useRef)(null),T=(0,t.useRef)(null),E=(0,t.useRef)(null),D=(0,t.useRef)(null),O=(0,t.useRef)(null),ee=(0,t.useRef)(null),k=(0,t.useRef)(null),te=(0,t.useRef)([]),ne=(0,t.useRef)(null),re=(0,t.useRef)(0),ie=(0,t.useRef)(null),ae=(0,t.useRef)(!1),oe=(0,t.useRef)(!1),se=(0,t.useRef)(f);se.current=f;let ce=(0,t.useRef)(m);ce.current=m;let le=(0,t.useRef)(r);le.current=r;let ue=a||o,de=(0,t.useMemo)(()=>u*1024*1024,[u]),fe=s&&typeof window<`u`&&typeof MediaRecorder<`u`&&!!navigator.mediaDevices?.getUserMedia;(0,t.useEffect)(()=>()=>{g.forEach(e=>URL.revokeObjectURL(e))},[]);let pe=(0,t.useRef)(null);(0,t.useEffect)(()=>{if(r)return;let e=pe.current;pe.current=r,e===null&&typeof window<`u`&&window.matchMedia?.(`(pointer: coarse)`).matches||w.current?.focus()},[r]);let me=(0,t.useRef)(!1);(0,t.useEffect)(()=>{b?ee.current?.focus():me.current&&!le.current&&w.current?.focus(),me.current=b},[b]);let he=(0,t.useCallback)(e=>{if(!v)return;let t=e.composedPath?e.composedPath():[],n=!!D.current&&t.includes(D.current),r=!!O.current&&t.includes(O.current);!n&&!r&&y(!1)},[v]);(0,t.useEffect)(()=>{if(v)return document.addEventListener(`click`,he),()=>document.removeEventListener(`click`,he)},[v,he]),(0,t.useEffect)(()=>{ue||y(!1)},[ue]);function ge(){g.forEach(e=>URL.revokeObjectURL(e)),_(new Map),h([]),T.current&&(T.current.value=``),E.current&&(E.current.value=``)}function _e(e){h(t=>{let n=t[e];if(n){let e=g.get(n.file);e&&(URL.revokeObjectURL(e),_(e=>{let t=new Map(e);return t.delete(n.file),t}))}return t.filter((t,n)=>n!==e)})}function ve(){let t=f.trim();!t&&m.length===0||r||(e(t,m),p(``),ge(),w.current&&(w.current.style.height=`auto`))}let ye=(0,t.useCallback)(()=>{ne.current?.getTracks().forEach(e=>e.stop()),ne.current=null},[]);(0,t.useEffect)(()=>()=>{ie.current&&clearInterval(ie.current),k.current&&k.current.state!==`inactive`&&(ae.current=!0,k.current.stop()),ye()},[ye]);async function be(){if(!fe||b||oe.current||r)return;if(m.length>=l){d?.(`Only ${l} attachments can be sent at once`);return}let t=po();if(!t){d?.(`Voice recording is not supported in this browser`);return}oe.current=!0;let n;try{n=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{oe.current=!1,d?.(`Microphone access was denied`);return}oe.current=!1,ne.current=n,te.current=[],ae.current=!1;let i=new MediaRecorder(n,{mimeType:t});i.ondataavailable=e=>{e.data.size>0&&te.current.push(e.data)},i.onstop=()=>{ye();let n=ae.current,r=Date.now()-re.current,i=new Blob(te.current,{type:t});if(te.current=[],n||r<300||le.current)return;let a=new File([i],`voice-note.${mo(t)}`,{type:t}),o=se.current.trim(),s=[...ce.current,{file:a,kind:`audio`,durationMs:r}];s.length>l?d?.(`Only ${l} attachments can be sent at once`):(e(o,s),p(``),ge(),w.current&&(w.current.style.height=`auto`))},k.current=i,re.current=Date.now(),C(0),i.start(),x(!0),ie.current=setInterval(()=>{let e=Date.now()-re.current;C(e),e>=c*1e3&&A(!1)},250)}function A(e){ie.current&&=(clearInterval(ie.current),null),ae.current=e,k.current&&k.current.state!==`inactive`&&k.current.stop(),x(!1),C(0)}function xe(e){e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ve())}function Se(e){let t=e.currentTarget;p(t.value),t.style.height=`auto`,t.style.height=`${t.scrollHeight}px`}function Ce(e,t){if(e.length===0)return;let n=[],r=[];for(let i of e)t===`image`&&!_o(i)?r.push(`${i.name} (image type not supported)`):t===`file`&&!go(i)?r.push(`${i.name} (file type not supported)`):i.size>de?r.push(`${i.name} (over ${u} MB)`):n.push({file:i,kind:t});h(e=>{let t=[...e,...n],i=t.slice(0,l);return t.length>l&&r.push(`max ${l} attachments allowed`),_(e=>{let t=new Map(e);for(let e of i)e.kind===`image`&&!t.has(e.file)&&t.set(e.file,URL.createObjectURL(e.file));return t}),i}),r.length>0&&alert(`Some attachments were not added:\n• ${r.join(`
|
|
2064
|
+
• `)}`)}function we(e){let t=Array.from(e.currentTarget.files??[]);e.currentTarget.value=``,Ce(t,`image`)}function Te(e){let t=Array.from(e.currentTarget.files??[]);e.currentTarget.value=``,Ce(t,`file`)}function Ee(){y(!1),T.current?.click()}function De(){y(!1),E.current?.click()}let Oe=!r&&(!!f.trim()||m.length>0);return(0,n.jsxs)(`div`,{className:`ak-composer`,children:[ue&&v&&(0,n.jsxs)(`div`,{ref:D,className:`ak-composer__attach-menu`,role:`menu`,children:[a&&(0,n.jsxs)(`button`,{className:`ak-composer__attach-menu-item`,onClick:Ee,type:`button`,role:`menuitem`,disabled:r,children:[(0,n.jsx)(to,{}),(0,n.jsx)(`span`,{children:`Photo`})]}),o&&(0,n.jsxs)(`button`,{className:`ak-composer__attach-menu-item`,onClick:De,type:`button`,role:`menuitem`,disabled:r,children:[(0,n.jsx)(no,{}),(0,n.jsx)(`span`,{children:`File`})]})]}),m.length>0&&(0,n.jsx)(`div`,{className:`ak-composer__attachments`,role:`list`,children:m.map((e,t)=>{let i=`${e.file.name}-${t}`;if(e.kind===`image`){let a=g.get(e.file);return(0,n.jsxs)(`div`,{className:`ak-composer__preview-wrap`,role:`listitem`,children:[a&&(0,n.jsx)(`img`,{src:a,alt:e.file.name,className:`ak-composer__preview-img`}),(0,n.jsx)(`button`,{className:`ak-composer__preview-remove`,onClick:()=>_e(t),type:`button`,"aria-label":`Remove ${e.file.name}`,disabled:r,children:(0,n.jsx)(ro,{})})]},i)}return(0,n.jsxs)(`span`,{className:`ak-composer__file-chip`,role:`listitem`,children:[(0,n.jsx)(no,{}),(0,n.jsx)(`span`,{className:`ak-composer__file-chip-name`,title:e.file.name,children:e.file.name}),(0,n.jsx)(`button`,{className:`ak-composer__file-chip-remove`,onClick:()=>_e(t),type:`button`,"aria-label":`Remove ${e.file.name}`,disabled:r,children:(0,n.jsx)(ro,{})})]},i)})}),ue&&(0,n.jsxs)(n.Fragment,{children:[a&&(0,n.jsx)(`input`,{ref:T,type:`file`,multiple:!0,accept:uo,className:`ak-composer__file-input`,onChange:we,disabled:r,"aria-label":`Attach images`}),o&&(0,n.jsx)(`input`,{ref:E,type:`file`,multiple:!0,accept:co,className:`ak-composer__file-input`,onChange:Te,disabled:r,"aria-label":`Attach files`})]}),(0,n.jsx)(`div`,{className:`ak-composer__input-wrap`,children:b?(0,n.jsxs)(`div`,{className:`ak-composer__recording`,children:[(0,n.jsx)(`button`,{className:`ak-composer__recording-cancel`,onClick:()=>A(!0),"aria-label":`Cancel recording`,type:`button`,children:(0,n.jsx)(ro,{})}),(0,n.jsxs)(`span`,{className:`ak-composer__recording-timer`,children:[(0,n.jsx)(`span`,{className:`ak-composer__recording-dot`}),ho(S)]}),(0,n.jsx)(`button`,{ref:ee,className:`ak-composer__recording-stop`,onClick:()=>A(!1),"aria-label":`Stop recording`,type:`button`,children:(0,n.jsx)(ao,{})})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(`div`,{className:`ak-composer__row`,children:[(0,n.jsx)(`textarea`,{ref:w,className:`ak-composer__input`,value:f,onInput:Se,onKeyDown:xe,placeholder:i,disabled:r,rows:1,"aria-label":`Message input`}),fe&&(0,n.jsx)(`button`,{className:`ak-composer__mic`,onClick:()=>void be(),disabled:r||m.length>=l,"aria-label":m.length>=l?`Only ${l} attachments can be sent at once`:`Record a voice note`,title:m.length>=l?`Only ${l} attachments can be sent at once`:`Record a voice note`,type:`button`,children:(0,n.jsx)(io,{})})]}),(0,n.jsxs)(`div`,{className:`ak-composer__toolbar`,children:[ue&&(0,n.jsx)(`div`,{className:`ak-composer__attach-wrap`,children:(0,n.jsx)(`button`,{ref:O,className:`ak-composer__attach${v?` ak-composer__attach--open`:``}`,onClick:()=>y(e=>!e),disabled:r,"aria-label":`Attachment options`,"aria-haspopup":`true`,"aria-expanded":v,type:`button`,children:(0,n.jsx)(eo,{})})}),(0,n.jsx)(`button`,{className:`ak-composer__send`,onClick:ve,disabled:!Oe,"aria-label":`Send message`,type:`button`,children:(0,n.jsx)($a,{})})]})]})}),(0,n.jsxs)(`p`,{className:`ak-composer__disclaimer`,children:[`By chatting you agree to our`,` `,(0,n.jsx)(`a`,{href:Za,target:`_blank`,rel:`noopener noreferrer`,children:`Privacy Policy`}),` `,`and`,` `,(0,n.jsx)(`a`,{href:Qa,target:`_blank`,rel:`noopener noreferrer`,children:`Terms of Service`}),`. `,`AI can make mistakes. Verify important information.`]})]})}function yo({message:e}){return e.includes(`Origin not allowed`)?(0,n.jsxs)(`div`,{className:`ak-error ak-error--origin`,role:`alert`,children:[(0,n.jsx)(`div`,{className:`ak-error__icon`,children:`🔒`}),(0,n.jsxs)(`div`,{className:`ak-error__content`,children:[(0,n.jsx)(`h3`,{className:`ak-error__title`,children:`Access Restricted`}),(0,n.jsx)(`p`,{className:`ak-error__description`,children:`This widget has been restricted to specific websites only. Contact the website administrator if you believe this is an error.`})]})]}):(0,n.jsxs)(`div`,{className:`ak-error`,role:`alert`,children:[(0,n.jsx)(`div`,{className:`ak-error__icon`,children:`⚠️`}),(0,n.jsx)(`div`,{className:`ak-error__content`,children:(0,n.jsx)(`p`,{className:`ak-error__message`,children:e})})]})}function bo(){return(0,n.jsxs)(`svg`,{width:`28`,height:`28`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,n.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,n.jsx)(`path`,{d:`M12 7v5l3 2`})]})}function xo(){return(0,n.jsxs)(`div`,{className:`ak-maintenance`,role:`status`,"aria-live":`polite`,children:[(0,n.jsx)(`div`,{className:`ak-maintenance__halo`,"aria-hidden":`true`}),(0,n.jsx)(`div`,{className:`ak-maintenance__icon`,children:(0,n.jsx)(bo,{})}),(0,n.jsx)(`p`,{className:`ak-maintenance__title`,children:`Under maintenance`}),(0,n.jsx)(`p`,{className:`ak-maintenance__description`,children:`This assistant is temporarily unavailable. Please check back in a little while.`})]})}function So(){return(0,n.jsxs)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`,className:`ak-branding__logo`,children:[(0,n.jsx)(`rect`,{width:`24`,height:`24`,rx:`5`,fill:`currentColor`}),(0,n.jsx)(`path`,{d:`M12 5L7 13h3.5v6l6.5-9H13.5V5z`,fill:`white`})]})}function Co(){return(0,n.jsxs)(`div`,{className:`ak-branding`,children:[(0,n.jsx)(So,{}),(0,n.jsx)(`span`,{className:`ak-branding__label`,children:`Powered by`}),(0,n.jsx)(`span`,{className:`ak-branding__name`,children:`KlicForge`})]})}function wo({config:e,messages:r,isLoading:i,error:a,isInline:o,initStatus:s,initError:c,callbacks:l}){let[u,d]=(0,t.useState)(null);return(0,n.jsxs)(`div`,{className:o?`ak-shell-wrap`:`ak-shell-wrap ak-shell-enter`,children:[(0,n.jsxs)(`div`,{className:o?`ak-shell ak-shell--inline`:`ak-shell ak-shell--floating`,role:`dialog`,"aria-label":e.title,children:[(0,n.jsx)(Ta,{title:e.title,subtitle:e.subtitle,avatarUrl:e.avatarUrl,onClose:l.onClose,onReset:s===`ready`?l.onReset:void 0,hideClose:o}),s===`validating`&&(0,n.jsx)(`div`,{className:`ak-init-status`,children:(0,n.jsx)(`div`,{className:`ak-init-spinner`,"aria-label":`Connecting…`})}),s===`error`&&(0,n.jsx)(`div`,{className:`ak-init-status ak-init-status--error`,children:(0,n.jsx)(yo,{message:c??`Widget configuration is invalid.`})}),s===`disabled`&&(0,n.jsx)(`div`,{className:`ak-init-status ak-init-status--maintenance`,children:(0,n.jsx)(xo,{})}),s===`ready`&&(0,n.jsxs)(n.Fragment,{children:[r.length===0?(0,n.jsx)(Xa,{title:e.title,description:e.description??e.subtitle,suggestedQuestions:e.suggestedQuestions,avatarUrl:e.avatarUrl,onSelect:e=>l.onSendMessage(e,[])}):(0,n.jsx)(Ja,{messages:r,isLoading:i}),(a||u)&&(0,n.jsx)(yo,{message:a??u}),(0,n.jsx)(vo,{onSend:(e,t)=>{d(null),l.onSendMessage(e,t)},onRecordingError:d,disabled:i,placeholder:`Type a message…`,photoSendingEnabled:e.photoSendingEnabled,fileUploadEnabled:e.fileUploadEnabled,voiceNoteEnabled:e.voiceNoteEnabled,voiceNoteMaxDurationSec:e.voiceNoteMaxDurationSec,attachmentMaxCount:e.attachmentMaxCount,attachmentMaxFileSizeMb:e.attachmentMaxFileSizeMb})]})]}),!o&&(0,n.jsx)(Co,{})]})}function To(){return(0,n.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,n.jsx)(`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`})})}function Eo(){return(0,n.jsx)(`svg`,{width:`22`,height:`22`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,n.jsx)(`polyline`,{points:`6,9 12,15 18,9`})})}function Do({isOpen:e,onClick:t,avatarUrl:r,ariaLabel:i=`Toggle chat`}){let a=!e&&!!r;return(0,n.jsx)(`button`,{className:`ak-launcher${a?` ak-launcher--avatar`:``}`,onClick:t,"aria-label":i,"aria-expanded":e,type:`button`,children:e?(0,n.jsx)(Eo,{}):a?(0,n.jsx)(`img`,{src:r,alt:``,className:`ak-launcher__avatar-img`,"aria-hidden":`true`}):(0,n.jsx)(To,{})})}function Oo({config:e,state:r,callbacks:i}){let a=e.mode===`inline`,o=(0,t.useRef)(null);return(0,t.useEffect)(()=>{let t=o.current?.getRootNode()?.host;if(!t)return;let n=ba(e.theme.mode);t.setAttribute(`data-theme`,n)},[e.theme.mode]),(0,t.useEffect)(()=>{if(a)return;let e=o.current?.getRootNode()?.host;e&&(r.isOpen?e.setAttribute(`data-open`,``):e.removeAttribute(`data-open`))},[a,r.isOpen]),r.initStatus===`disabled`&&!a?null:a?(0,n.jsx)(`div`,{ref:o,className:`ak-inline`,children:(0,n.jsx)(wo,{config:e,messages:r.messages,isLoading:r.isLoading,error:r.error,isInline:!0,initStatus:r.initStatus,initError:r.initError,callbacks:i})}):(0,n.jsxs)(`div`,{ref:o,className:`ak-floating`,children:[r.isOpen&&(0,n.jsx)(wo,{config:e,messages:r.messages,isLoading:r.isLoading,error:r.error,isInline:!1,initStatus:r.initStatus,initError:r.initError,callbacks:i}),(0,n.jsx)(Do,{isOpen:r.isOpen,onClick:r.isOpen?i.onClose:i.onOpen,avatarUrl:e.avatarUrl})]})}var ko=(n,r,i,a)=>{let o=(0,e.createRoot)(n);return o.render((0,t.createElement)(Oo,{config:r,state:i,callbacks:a})),{update(e,n){o.render((0,t.createElement)(Oo,{config:n,state:e,callbacks:a}))},destroy(){setTimeout(()=>{o.unmount()},0)}}};function Ao(e){return xa+`
|
|
2065
|
+
`+ya(e)}function jo(e,t){return Ao(ut({...e,mode:t}))}function Mo(e,t=ko,n){return ma(e,t,n??jo(e,`floating`))}function No(e,t,n=ko,r){return ga(e,t,n,r??jo(t,`inline`))}function Po(e,t,n=ko,r){return ha(e,t,n,r??jo(t,`floating`))}function Fo(e){_a(e)}exports.ApiClient=xi,exports.Composer=vo,exports.ErrorState=yo,exports.EventEmitter=Ri,exports.Header=Ta,exports.Launcher=Do,exports.MessageBubble=Ga,exports.MessageList=Ja,exports.TypingIndicator=Ka,exports.WidgetApp=Oo,exports.WidgetClient=Qi,exports.WidgetShell=wo,exports.buildThemeVars=ya,exports.buildWidgetCSS=Ao,exports.clearSession=Ui,exports.createFloatingContainer=aa,exports.createShadowHost=ta,exports.createWidget=ua,exports.destroy=Fo,exports.destroyWidget=_a,exports.getSessionId=Vi,exports.init=Mo,exports.injectStyles=na,exports.listWidgets=va,exports.mount=No,exports.mountFloating=Po,exports.normalizeConfig=ut,exports.prepareInlineContainer=sa,exports.removeShadowHost=ra,exports.renderWidget=ko,exports.resolveThemeMode=ba,exports.setSessionId=Hi,exports.streamChat=wi,exports.widgetCSS=xa;
|