@bymos/agentkit-sdk 0.9.3 → 0.9.5
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 +6 -5
- package/agentkit-widget.iife.js +379 -355
- package/agentkit-widget.js +380 -356
- package/index.cjs +378 -354
- package/index.d.ts +13 -4
- package/index.js +875 -970
- package/package.json +1 -1
package/agentkit-widget.iife.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var __AgentKitInternal=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t;(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})(t||={});var n;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(n||={});var r=t.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),i=e=>{switch(typeof e){case`undefined`:return r.undefined;case`string`:return r.string;case`number`:return Number.isNaN(e)?r.nan:r.number;case`boolean`:return r.boolean;case`function`:return r.function;case`bigint`:return r.bigint;case`symbol`:return r.symbol;case`object`:return Array.isArray(e)?r.array:e===null?r.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?r.promise:typeof Map<`u`&&e instanceof Map?r.map:typeof Set<`u`&&e instanceof Set?r.set:typeof Date<`u`&&e instanceof Date?r.date:r.object;default:return r.unknown}},a=t.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`]),o=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,t.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()}};o.create=e=>new o(e);var s=(e,n)=>{let i;switch(e.code){case a.invalid_type:i=e.received===r.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case a.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(e.expected,t.jsonStringifyReplacer)}`;break;case a.unrecognized_keys:i=`Unrecognized key(s) in object: ${t.joinValues(e.keys,`, `)}`;break;case a.invalid_union:i=`Invalid input`;break;case a.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${t.joinValues(e.options)}`;break;case a.invalid_enum_value:i=`Invalid enum value. Expected ${t.joinValues(e.options)}, received '${e.received}'`;break;case a.invalid_arguments:i=`Invalid function arguments`;break;case a.invalid_return_type:i=`Invalid function return type`;break;case a.invalid_date:i=`Invalid date`;break;case a.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(i=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(i=`${i} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?i=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?i=`Invalid input: must end with "${e.validation.endsWith}"`:t.assertNever(e.validation):i=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case a.too_small:i=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 a.too_big:i=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 a.custom:i=`Invalid input`;break;case a.invalid_intersection_types:i=`Intersection results could not be merged`;break;case a.not_multiple_of:i=`Number must be a multiple of ${e.multipleOf}`;break;case a.not_finite:i=`Number must be finite`;break;default:i=n.defaultError,t.assertNever(e)}return{message:i}},c=s;function l(){return c}var u=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 d(e,t){let n=l(),r=u({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===s?void 0:s].filter(e=>!!e)});e.common.issues.push(r)}var f=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 p;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 p;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}}},p=Object.freeze({status:`aborted`}),m=e=>({status:`dirty`,value:e}),h=e=>({status:`valid`,value:e}),g=e=>e.status===`aborted`,_=e=>e.status===`dirty`,v=e=>e.status===`valid`,y=e=>typeof Promise<`u`&&e instanceof Promise,b;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(b||={});var x=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}},S=(e,t)=>{if(v(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 o(e.common.issues);return this._error=t,this._error}}};function C(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 w=class{get description(){return this._def.description}_getType(e){return i(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:i(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new f,ctx:{common:e.parent.common,data:e.data,parsedType:i(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(y(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:i(e)};return S(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:i(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return v(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=>v(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:i(e)},r=this._parse({data:e,path:n.path,parent:n});return S(n,await(y(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),o=()=>r.addIssue({code:a.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(o(),!1)):i?!0:(o(),!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 O({schema:this,typeName:A.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 k.create(this,this._def)}nullable(){return $e.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Fe.create(this)}promise(){return Qe.create(this,this._def)}or(e){return Le.create([this,e],this._def)}and(e){return Ve.create(this,e,this._def)}transform(e){return new O({...C(this._def),schema:this,typeName:A.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new et({...C(this._def),innerType:this,defaultValue:t,typeName:A.ZodDefault})}brand(){return new rt({typeName:A.ZodBranded,type:this,...C(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new tt({...C(this._def),innerType:this,catchValue:t,typeName:A.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return it.create(this,e)}readonly(){return at.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},T=/^c[^\s-]{8,}$/i,ee=/^[0-9a-z]+$/,te=/^[0-9A-HJKMNP-TV-Z]{26}$/i,E=/^[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,ne=/^[a-z0-9_-]{21}$/i,re=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ie=/^[-+]?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)?)??$/,ae=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,oe=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,se,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])$/,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])\/(3[0-2]|[12]?[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]))$/,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]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,pe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,me=`((\\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])))`,he=RegExp(`^${me}$`);function ge(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 _e(e){return RegExp(`^${ge(e)}$`)}function ve(e){let t=`${me}T${ge(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function ye(e,t){return!!((t===`v4`||!t)&&ce.test(e)||(t===`v6`||!t)&&ue.test(e))}function be(e,t){if(!re.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 xe(e,t){return!!((t===`v4`||!t)&&le.test(e)||(t===`v6`||!t)&&de.test(e))}var Se=class e extends w{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==r.string){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.string,received:t.parsedType}),p}let n=new f,i;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(i=this._getOrReturnCtx(e,i),d(i,{code:a.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind===`max`)e.data.length>r.value&&(i=this._getOrReturnCtx(e,i),d(i,{code:a.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind===`length`){let t=e.data.length>r.value,o=e.data.length<r.value;(t||o)&&(i=this._getOrReturnCtx(e,i),t?d(i,{code:a.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):o&&d(i,{code:a.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),n.dirty())}else if(r.kind===`email`)ae.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`email`,code:a.invalid_string,message:r.message}),n.dirty());else if(r.kind===`emoji`)se||=new RegExp(oe,`u`),se.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`emoji`,code:a.invalid_string,message:r.message}),n.dirty());else if(r.kind===`uuid`)E.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`uuid`,code:a.invalid_string,message:r.message}),n.dirty());else if(r.kind===`nanoid`)ne.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`nanoid`,code:a.invalid_string,message:r.message}),n.dirty());else if(r.kind===`cuid`)T.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`cuid`,code:a.invalid_string,message:r.message}),n.dirty());else if(r.kind===`cuid2`)ee.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`cuid2`,code:a.invalid_string,message:r.message}),n.dirty());else if(r.kind===`ulid`)te.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`ulid`,code:a.invalid_string,message:r.message}),n.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),d(i,{validation:`url`,code:a.invalid_string,message:r.message}),n.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`regex`,code:a.invalid_string,message:r.message}),n.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(i=this._getOrReturnCtx(e,i),d(i,{code:a.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),n.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(i=this._getOrReturnCtx(e,i),d(i,{code:a.invalid_string,validation:{startsWith:r.value},message:r.message}),n.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(i=this._getOrReturnCtx(e,i),d(i,{code:a.invalid_string,validation:{endsWith:r.value},message:r.message}),n.dirty()):r.kind===`datetime`?ve(r).test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{code:a.invalid_string,validation:`datetime`,message:r.message}),n.dirty()):r.kind===`date`?he.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{code:a.invalid_string,validation:`date`,message:r.message}),n.dirty()):r.kind===`time`?_e(r).test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{code:a.invalid_string,validation:`time`,message:r.message}),n.dirty()):r.kind===`duration`?ie.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`duration`,code:a.invalid_string,message:r.message}),n.dirty()):r.kind===`ip`?ye(e.data,r.version)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`ip`,code:a.invalid_string,message:r.message}),n.dirty()):r.kind===`jwt`?be(e.data,r.alg)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`jwt`,code:a.invalid_string,message:r.message}),n.dirty()):r.kind===`cidr`?xe(e.data,r.version)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`cidr`,code:a.invalid_string,message:r.message}),n.dirty()):r.kind===`base64`?fe.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`base64`,code:a.invalid_string,message:r.message}),n.dirty()):r.kind===`base64url`?pe.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`base64url`,code:a.invalid_string,message:r.message}),n.dirty()):t.assertNever(r);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:a.invalid_string,...b.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...b.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...b.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...b.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...b.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...b.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...b.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...b.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...b.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...b.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...b.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...b.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...b.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...b.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,...b.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,...b.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...b.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...b.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...b.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...b.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...b.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...b.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...b.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...b.errToObj(t)})}nonempty(e){return this.min(1,b.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}};Se.create=e=>new Se({checks:[],typeName:A.ZodString,coerce:e?.coerce??!1,...C(e)});function Ce(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 we=class e extends w{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)!==r.number){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.number,received:t.parsedType}),p}let n,i=new f;for(let r of this._def.checks)r.kind===`int`?t.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:a.invalid_type,expected:`integer`,received:`float`,message:r.message}),i.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:a.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:a.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind===`multipleOf`?Ce(e.data,r.value)!==0&&(n=this._getOrReturnCtx(e,n),d(n,{code:a.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:a.not_finite,message:r.message}),i.dirty()):t.assertNever(r);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,b.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,b.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,b.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,b.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:b.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:b.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:b.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:b.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:b.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:b.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:b.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`&&t.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)}};we.create=e=>new we({checks:[],typeName:A.ZodNumber,coerce:e?.coerce||!1,...C(e)});var Te=class e extends w{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)!==r.bigint)return this._getInvalidInput(e);let n,i=new f;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:a.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:a.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),d(n,{code:a.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):t.assertNever(r);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.bigint,received:t.parsedType}),p}gte(e,t){return this.setLimit(`min`,e,!0,b.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,b.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,b.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,b.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:b.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:b.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:b.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:b.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}};Te.create=e=>new Te({checks:[],typeName:A.ZodBigInt,coerce:e?.coerce??!1,...C(e)});var Ee=class extends w{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==r.boolean){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.boolean,received:t.parsedType}),p}return h(e.data)}};Ee.create=e=>new Ee({typeName:A.ZodBoolean,coerce:e?.coerce||!1,...C(e)});var De=class e extends w{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==r.date){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.date,received:t.parsedType}),p}if(Number.isNaN(e.data.getTime()))return d(this._getOrReturnCtx(e),{code:a.invalid_date}),p;let n=new f,i;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(i=this._getOrReturnCtx(e,i),d(i,{code:a.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),n.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(i=this._getOrReturnCtx(e,i),d(i,{code:a.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),n.dirty()):t.assertNever(r);return{status:n.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:b.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:b.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)}};De.create=e=>new De({checks:[],coerce:e?.coerce||!1,typeName:A.ZodDate,...C(e)});var Oe=class extends w{_parse(e){if(this._getType(e)!==r.symbol){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.symbol,received:t.parsedType}),p}return h(e.data)}};Oe.create=e=>new Oe({typeName:A.ZodSymbol,...C(e)});var ke=class extends w{_parse(e){if(this._getType(e)!==r.undefined){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.undefined,received:t.parsedType}),p}return h(e.data)}};ke.create=e=>new ke({typeName:A.ZodUndefined,...C(e)});var Ae=class extends w{_parse(e){if(this._getType(e)!==r.null){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.null,received:t.parsedType}),p}return h(e.data)}};Ae.create=e=>new Ae({typeName:A.ZodNull,...C(e)});var je=class extends w{constructor(){super(...arguments),this._any=!0}_parse(e){return h(e.data)}};je.create=e=>new je({typeName:A.ZodAny,...C(e)});var Me=class extends w{constructor(){super(...arguments),this._unknown=!0}_parse(e){return h(e.data)}};Me.create=e=>new Me({typeName:A.ZodUnknown,...C(e)});var Ne=class extends w{_parse(e){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.never,received:t.parsedType}),p}};Ne.create=e=>new Ne({typeName:A.ZodNever,...C(e)});var Pe=class extends w{_parse(e){if(this._getType(e)!==r.undefined){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.void,received:t.parsedType}),p}return h(e.data)}};Pe.create=e=>new Pe({typeName:A.ZodVoid,...C(e)});var Fe=class e extends w{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==r.array)return d(t,{code:a.invalid_type,expected:r.array,received:t.parsedType}),p;if(i.exactLength!==null){let e=t.data.length>i.exactLength.value,r=t.data.length<i.exactLength.value;(e||r)&&(d(t,{code:e?a.too_big:a.too_small,minimum:r?i.exactLength.value:void 0,maximum:e?i.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(d(t,{code:a.too_small,minimum:i.minLength.value,type:`array`,inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(d(t,{code:a.too_big,maximum:i.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>i.type._parseAsync(new x(t,e,t.path,n)))).then(e=>f.mergeArray(n,e));let o=[...t.data].map((e,n)=>i.type._parseSync(new x(t,e,t.path,n)));return f.mergeArray(n,o)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:b.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:b.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:b.toString(n)}})}nonempty(e){return this.min(1,e)}};Fe.create=(e,t)=>new Fe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:A.ZodArray,...C(t)});function Ie(e){if(e instanceof D){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=k.create(Ie(r))}return new D({...e._def,shape:()=>t})}else if(e instanceof Fe)return new Fe({...e._def,type:Ie(e.element)});else if(e instanceof k)return k.create(Ie(e.unwrap()));else if(e instanceof $e)return $e.create(Ie(e.unwrap()));else if(e instanceof He)return He.create(e.items.map(e=>Ie(e)));else return e}var D=class e extends w{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(),n=t.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==r.object){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.object,received:t.parsedType}),p}let{status:t,ctx:n}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof Ne&&this._def.unknownKeys===`strip`))for(let e in n.data)o.includes(e)||s.push(e);let c=[];for(let e of o){let t=i[e],r=n.data[e];c.push({key:{status:`valid`,value:e},value:t._parse(new x(n,r,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Ne){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of s)c.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)s.length>0&&(d(n,{code:a.unrecognized_keys,keys:s}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of s){let r=n.data[t];c.push({key:{status:`valid`,value:t},value:e._parse(new x(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=>f.mergeObjectSync(t,e)):f.mergeObjectSync(t,c)}get shape(){return this._def.shape()}strict(t){return b.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:b.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:A.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(n){let r={};for(let e of t.objectKeys(n))n[e]&&this.shape[e]&&(r[e]=this.shape[e]);return new e({...this._def,shape:()=>r})}omit(n){let r={};for(let e of t.objectKeys(this.shape))n[e]||(r[e]=this.shape[e]);return new e({...this._def,shape:()=>r})}deepPartial(){return Ie(this)}partial(n){let r={};for(let e of t.objectKeys(this.shape)){let t=this.shape[e];n&&!n[e]?r[e]=t:r[e]=t.optional()}return new e({...this._def,shape:()=>r})}required(n){let r={};for(let e of t.objectKeys(this.shape))if(n&&!n[e])r[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof k;)t=t._def.innerType;r[e]=t}return new e({...this._def,shape:()=>r})}keyof(){return Ye(t.objectKeys(this.shape))}};D.create=(e,t)=>new D({shape:()=>e,unknownKeys:`strip`,catchall:Ne.create(),typeName:A.ZodObject,...C(t)}),D.strictCreate=(e,t)=>new D({shape:()=>e,unknownKeys:`strict`,catchall:Ne.create(),typeName:A.ZodObject,...C(t)}),D.lazycreate=(e,t)=>new D({shape:e,unknownKeys:`strip`,catchall:Ne.create(),typeName:A.ZodObject,...C(t)});var Le=class extends w{_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 o(e.ctx.common.issues));return d(t,{code:a.invalid_union,unionErrors:n}),p}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 o(e));return d(t,{code:a.invalid_union,unionErrors:i}),p}}get options(){return this._def.options}};Le.create=(e,t)=>new Le({options:e,typeName:A.ZodUnion,...C(t)});var Re=e=>e instanceof qe?Re(e.schema):e instanceof O?Re(e.innerType()):e instanceof Je?[e.value]:e instanceof Xe?e.options:e instanceof Ze?t.objectValues(e.enum):e instanceof et?Re(e._def.innerType):e instanceof ke?[void 0]:e instanceof Ae?[null]:e instanceof k?[void 0,...Re(e.unwrap())]:e instanceof $e?[null,...Re(e.unwrap())]:e instanceof rt||e instanceof at?Re(e.unwrap()):e instanceof tt?Re(e._def.innerType):[],ze=class e extends w{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==r.object)return d(t,{code:a.invalid_type,expected:r.object,received:t.parsedType}),p;let n=this.discriminator,i=t.data[n],o=this.optionsMap.get(i);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(d(t,{code:a.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),p)}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=Re(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:A.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...C(r)})}};function Be(e,n){let a=i(e),o=i(n);if(e===n)return{valid:!0,data:e};if(a===r.object&&o===r.object){let r=t.objectKeys(n),i=t.objectKeys(e).filter(e=>r.indexOf(e)!==-1),a={...e,...n};for(let t of i){let r=Be(e[t],n[t]);if(!r.valid)return{valid:!1};a[t]=r.data}return{valid:!0,data:a}}else if(a===r.array&&o===r.array){if(e.length!==n.length)return{valid:!1};let t=[];for(let r=0;r<e.length;r++){let i=e[r],a=n[r],o=Be(i,a);if(!o.valid)return{valid:!1};t.push(o.data)}return{valid:!0,data:t}}else if(a===r.date&&o===r.date&&+e==+n)return{valid:!0,data:e};else return{valid:!1}}var Ve=class extends w{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(g(e)||g(r))return p;let i=Be(e.value,r.value);return i.valid?((_(e)||_(r))&&t.dirty(),{status:t.value,value:i.data}):(d(n,{code:a.invalid_intersection_types}),p)};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}))}};Ve.create=(e,t,n)=>new Ve({left:e,right:t,typeName:A.ZodIntersection,...C(n)});var He=class e extends w{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==r.array)return d(n,{code:a.invalid_type,expected:r.array,received:n.parsedType}),p;if(n.data.length<this._def.items.length)return d(n,{code:a.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),p;!this._def.rest&&n.data.length>this._def.items.length&&(d(n,{code:a.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let i=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new x(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(i).then(e=>f.mergeArray(t,e)):f.mergeArray(t,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};He.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new He({items:e,typeName:A.ZodTuple,rest:null,...C(t)})};var Ue=class e extends w{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!==r.object)return d(n,{code:a.invalid_type,expected:r.object,received:n.parsedType}),p;let i=[],o=this._def.keyType,s=this._def.valueType;for(let e in n.data)i.push({key:o._parse(new x(n,e,n.path,e)),value:s._parse(new x(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?f.mergeObjectAsync(t,i):f.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof w?new e({keyType:t,valueType:n,typeName:A.ZodRecord,...C(r)}):new e({keyType:Se.create(),valueType:t,typeName:A.ZodRecord,...C(n)})}},We=class extends w{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!==r.map)return d(n,{code:a.invalid_type,expected:r.map,received:n.parsedType}),p;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([e,t],r)=>({key:i._parse(new x(n,e,n.path,[r,`key`])),value:o._parse(new x(n,t,n.path,[r,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of s){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return p;(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 s){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return p;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};We.create=(e,t,n)=>new We({valueType:t,keyType:e,typeName:A.ZodMap,...C(n)});var Ge=class e extends w{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==r.set)return d(n,{code:a.invalid_type,expected:r.set,received:n.parsedType}),p;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(d(n,{code:a.too_small,minimum:i.minSize.value,type:`set`,inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(d(n,{code:a.too_big,maximum:i.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());let o=this._def.valueType;function s(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return p;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let c=[...n.data.values()].map((e,t)=>o._parse(new x(n,e,n.path,t)));return n.common.async?Promise.all(c).then(e=>s(e)):s(c)}min(t,n){return new e({...this._def,minSize:{value:t,message:b.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:b.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Ge.create=(e,t)=>new Ge({valueType:e,minSize:null,maxSize:null,typeName:A.ZodSet,...C(t)});var Ke=class e extends w{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==r.function)return d(t,{code:a.invalid_type,expected:r.function,received:t.parsedType}),p;function n(e,n){return u({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,l(),s].filter(e=>!!e),issueData:{code:a.invalid_arguments,argumentsError:n}})}function i(e,n){return u({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,l(),s].filter(e=>!!e),issueData:{code:a.invalid_return_type,returnTypeError:n}})}let c={errorMap:t.common.contextualErrorMap},f=t.data;if(this._def.returns instanceof Qe){let e=this;return h(async function(...t){let r=new o([]),a=await e._def.args.parseAsync(t,c).catch(e=>{throw r.addIssue(n(t,e)),r}),s=await Reflect.apply(f,this,a);return await e._def.returns._def.type.parseAsync(s,c).catch(e=>{throw r.addIssue(i(s,e)),r})})}else{let e=this;return h(function(...t){let r=e._def.args.safeParse(t,c);if(!r.success)throw new o([n(t,r.error)]);let a=Reflect.apply(f,this,r.data),s=e._def.returns.safeParse(a,c);if(!s.success)throw new o([i(a,s.error)]);return s.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:He.create(t).rest(Me.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||He.create([]).rest(Me.create()),returns:n||Me.create(),typeName:A.ZodFunction,...C(r)})}},qe=class extends w{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})}};qe.create=(e,t)=>new qe({getter:e,typeName:A.ZodLazy,...C(t)});var Je=class extends w{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return d(t,{received:t.data,code:a.invalid_literal,expected:this._def.value}),p}return{status:`valid`,value:e.data}}get value(){return this._def.value}};Je.create=(e,t)=>new Je({value:e,typeName:A.ZodLiteral,...C(t)});function Ye(e,t){return new Xe({values:e,typeName:A.ZodEnum,...C(t)})}var Xe=class e extends w{_parse(e){if(typeof e.data!=`string`){let n=this._getOrReturnCtx(e),r=this._def.values;return d(n,{expected:t.joinValues(r),received:n.parsedType,code:a.invalid_type}),p}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return d(t,{received:t.data,code:a.invalid_enum_value,options:n}),p}return h(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})}};Xe.create=Ye;var Ze=class extends w{_parse(e){let n=t.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==r.string&&i.parsedType!==r.number){let e=t.objectValues(n);return d(i,{expected:t.joinValues(e),received:i.parsedType,code:a.invalid_type}),p}if(this._cache||=new Set(t.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=t.objectValues(n);return d(i,{received:i.data,code:a.invalid_enum_value,options:e}),p}return h(e.data)}get enum(){return this._def.values}};Ze.create=(e,t)=>new Ze({values:e,typeName:A.ZodNativeEnum,...C(t)});var Qe=class extends w{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==r.promise&&t.common.async===!1?(d(t,{code:a.invalid_type,expected:r.promise,received:t.parsedType}),p):h((t.parsedType===r.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:A.ZodPromise,...C(t)});var O=class extends w{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===A.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:e=>{d(r,e),e.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),i.type===`preprocess`){let e=i.transform(r.data,a);if(r.common.async)return Promise.resolve(e).then(async e=>{if(n.value===`aborted`)return p;let t=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return t.status===`aborted`?p:t.status===`dirty`||n.value===`dirty`?m(t.value):t});{if(n.value===`aborted`)return p;let t=this._def.schema._parseSync({data:e,path:r.path,parent:r});return t.status===`aborted`?p:t.status===`dirty`||n.value===`dirty`?m(t.value):t}}if(i.type===`refinement`){let e=e=>{let t=i.refinement(e,a);if(r.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(r.common.async===!1){let t=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return t.status===`aborted`?p:(t.status===`dirty`&&n.dirty(),e(t.value),{status:n.value,value:t.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(t=>t.status===`aborted`?p:(t.status===`dirty`&&n.dirty(),e(t.value).then(()=>({status:n.value,value:t.value}))))}if(i.type===`transform`)if(r.common.async===!1){let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!v(e))return p;let t=i.transform(e.value,a);if(t instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:n.value,value:t}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>v(e)?Promise.resolve(i.transform(e.value,a)).then(e=>({status:n.value,value:e})):p);t.assertNever(i)}};O.create=(e,t,n)=>new O({schema:e,typeName:A.ZodEffects,effect:t,...C(n)}),O.createWithPreprocess=(e,t,n)=>new O({schema:t,effect:{type:`preprocess`,transform:e},typeName:A.ZodEffects,...C(n)});var k=class extends w{_parse(e){return this._getType(e)===r.undefined?h(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};k.create=(e,t)=>new k({innerType:e,typeName:A.ZodOptional,...C(t)});var $e=class extends w{_parse(e){return this._getType(e)===r.null?h(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};$e.create=(e,t)=>new $e({innerType:e,typeName:A.ZodNullable,...C(t)});var et=class extends w{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===r.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};et.create=(e,t)=>new et({innerType:e,typeName:A.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...C(t)});var tt=class extends w{_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 y(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new o(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new o(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};tt.create=(e,t)=>new tt({innerType:e,typeName:A.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...C(t)});var nt=class extends w{_parse(e){if(this._getType(e)!==r.nan){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.nan,received:t.parsedType}),p}return{status:`valid`,value:e.data}}};nt.create=e=>new nt({typeName:A.ZodNaN,...C(e)});var rt=class extends w{_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}},it=class e extends w{_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`?p:e.status===`dirty`?(t.dirty(),m(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`?p: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:A.ZodPipeline})}},at=class extends w{_parse(e){let t=this._def.innerType._parse(e),n=e=>(v(e)&&(e.value=Object.freeze(e.value)),e);return y(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};at.create=(e,t)=>new at({innerType:e,typeName:A.ZodReadonly,...C(t)}),D.lazycreate;var A;(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`})(A||={});var j=Se.create;we.create,nt.create,Te.create;var ot=Ee.create;De.create,Oe.create,ke.create,Ae.create,je.create;var st=Me.create;Ne.create,Pe.create,Fe.create;var ct=D.create;D.strictCreate,Le.create,ze.create,Ve.create,He.create;var lt=Ue.create;We.create,Ge.create,Ke.create,qe.create,Je.create;var ut=Xe.create;Ze.create,Qe.create,O.create,k.create,$e.create,O.createWithPreprocess,it.create;var dt=ct({mode:ut([`light`,`dark`,`system`]).optional(),accentColor:j().optional(),fontFamily:j().optional(),borderRadius:j().optional()}),ft=ct({externalId:j().optional(),authId:j().optional(),name:j().optional(),email:j().optional()}),pt=ct({agentId:j().min(1,`agentId is required`),apiBaseUrl:j().url(`apiBaseUrl must be a valid URL`),tenantId:j().optional(),user:ft.optional(),sessionId:j().optional(),mode:ut([`floating`,`inline`]).optional(),title:j().optional(),subtitle:j().optional(),description:j().optional(),avatarUrl:j().optional(),streaming:ot().optional(),preview:ot().optional(),skipServerConfigFetch:ot().optional(),configChannel:ut([`draft`,`published`]).optional(),metadata:lt(st()).optional(),theme:dt.optional()}),mt=pt.omit({agentId:!0,apiBaseUrl:!0}).partial(),ht={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 gt(e,t){pt.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?mt.passthrough().safeParse(r).data:void 0,a=i?_t(i,e):e,o={mode:a.theme?.mode??n?.mode??ht.theme.mode,accentColor:a.theme?.accentColor??n?.accentColor??ht.theme.accentColor,fontFamily:a.theme?.fontFamily??n?.fontFamily??ht.theme.fontFamily,borderRadius:a.theme?.borderRadius??n?.borderRadius??ht.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??ht.mode,title:a.title??ht.title,subtitle:a.subtitle,description:a.description,suggestedQuestions:(()=>{let e=i?.suggestedQuestions;return Array.isArray(e)?e:[]})(),avatarUrl:a.avatarUrl,streaming:a.streaming??ht.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 _t(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]=_t(n[e],r):n[e]=r)}return n}var vt=function(){return vt=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},vt.apply(this,arguments)};function M(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 N(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 yt(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 bt=`4.6.2`;function xt(e,t){return new Promise(function(n){return setTimeout(n,e,t)})}function St(){return new Promise(function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})}function Ct(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})}):xt(Math.min(e,t))}function wt(e){return!!e&&typeof e.then==`function`}function Tt(e,t){try{var n=e();wt(n)?n.then(function(e){return t(!0,e)},function(e){return t(!1,e)}):t(!0,n)}catch(e){t(!1,e)}}function Et(e,t,n){return n===void 0&&(n=16),M(this,void 0,void 0,function(){var r,i,a,o;return N(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,St()]):[3,3]):[3,4];case 2:s.sent(),s.label=3;case 3:return++a,[3,1];case 4:return[2,r]}})})}function Dt(e){return e.then(void 0,function(){}),e}function Ot(e,t){for(var n=0,r=e.length;n<r;++n)if(e[n]===t)return!0;return!1}function kt(e,t){return!Ot(e,t)}function At(e){return parseInt(e)}function P(e){return parseFloat(e)}function F(e,t){return typeof e==`number`&&isNaN(e)?t:e}function I(e){return e.reduce(function(e,t){return e+ +!!t},0)}function jt(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 Mt(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 Nt(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 Pt(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 L(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 Ft(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 R(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 z(e,t){e[0]^=t[0],e[1]^=t[1]}var It=[4283543511,3981806797],Lt=[3301882366,444984403];function Rt(e){var t=[0,e[0]>>>1];z(e,t),L(e,It),t[1]=e[0]>>>1,z(e,t),L(e,Lt),t[1]=e[0]>>>1,z(e,t)}var zt=[2277735313,289559509],Bt=[1291169091,658871167],Vt=[0,5],Ht=[0,1390208809],Ut=[0,944331445];function Wt(e,t){var n=Nt(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,L(c,zt),Ft(c,31),L(c,Bt),z(o,c),Ft(o,27),Pt(o,s),L(o,Vt),Pt(o,Ht),L(l,Bt),Ft(l,33),L(l,zt),z(s,l),Ft(s,31),Pt(s,o),L(s,Vt),Pt(s,Ut);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],R(d,48),z(l,d);case 14:d[1]=n[u+13],R(d,40),z(l,d);case 13:d[1]=n[u+12],R(d,32),z(l,d);case 12:d[1]=n[u+11],R(d,24),z(l,d);case 11:d[1]=n[u+10],R(d,16),z(l,d);case 10:d[1]=n[u+9],R(d,8),z(l,d);case 9:d[1]=n[u+8],z(l,d),L(l,Bt),Ft(l,33),L(l,zt),z(s,l);case 8:d[1]=n[u+7],R(d,56),z(c,d);case 7:d[1]=n[u+6],R(d,48),z(c,d);case 6:d[1]=n[u+5],R(d,40),z(c,d);case 5:d[1]=n[u+4],R(d,32),z(c,d);case 4:d[1]=n[u+3],R(d,24),z(c,d);case 3:d[1]=n[u+2],R(d,16),z(c,d);case 2:d[1]=n[u+1],R(d,8),z(c,d);case 1:d[1]=n[u],z(c,d),L(c,zt),Ft(c,31),L(c,Bt),z(o,c)}return z(o,r),z(s,r),Pt(o,s),Pt(s,o),Rt(o),Rt(s),Pt(o,s),Pt(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 Gt(e){return vt({name:e.name,message:e.message,stack:e.stack?.split(`
|
|
2
|
-
`)},e)}function Kt(e){return/^function\s.*?\{\s*\[native code]\s*}$/.test(String(e))}function qt(e){return typeof e!=`function`}function Jt(e,t){var n=Dt(new Promise(function(n){var r=Date.now();Tt(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(qt(a))return n(function(){return{value:a,duration:i}});n(function(){return new Promise(function(e){var t=Date.now();Tt(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 Yt(e,t,n,r){var i=Object.keys(e).filter(function(e){return kt(n,e)}),a=Dt(Et(i,function(n){return Jt(e[n],t)},r));return function(){return M(this,void 0,void 0,function(){var e,t,n,o,s;return N(this,function(c){switch(c.label){case 0:return[4,a];case 1:return e=c.sent(),[4,Et(e,function(e){return Dt(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 Xt(){var e=window,t=navigator;return I([`MSCSSMatrix`in e,`msSetImmediate`in e,`msIndexedDB`in e,`msMaxTouchPoints`in t,`msPointerEnabled`in t])>=4}function Zt(){var e=window,t=navigator;return I([`msWriteProfilerMark`in e,`MSStream`in e,`msLaunchUri`in t,`msSaveBlob`in t])>=3&&!Xt()}function Qt(){var e=window,t=navigator;return I([`webkitPersistentStorage`in t,`webkitTemporaryStorage`in t,(t.vendor||``).indexOf(`Google`)===0,`webkitResolveLocalFileSystemURL`in e,`BatteryManager`in e,`webkitMediaStream`in e,`webkitSpeechGrammar`in e])>=5}function B(){var e=window,t=navigator;return I([`ApplePayError`in e,`CSSPrimitiveValue`in e,`Counter`in e,t.vendor.indexOf(`Apple`)===0,`RGBColor`in e,`WebKitMediaKeys`in e])>=4}function $t(){var e=window,t=e.HTMLElement,n=e.Document;return I([`safari`in e,!(`ongestureend`in e),!(`TouchEvent`in e),!(`orientation`in e),t&&!(`autocapitalize`in t.prototype),n&&`pointerLockElement`in n.prototype])>=4}function en(){var e=window;return Kt(e.print)&&String(e.browser)===`[object WebPageNamespace]`}function tn(){var e=window;return I([`buildID`in navigator,`MozAppearance`in(document.documentElement?.style??{}),`onmozfullscreenchange`in e,`mozInnerScreenX`in e,`CSSMozDocumentRule`in e,`CanvasCaptureMediaStream`in e])>=4}function nn(){var e=window;return I([!(`MediaSettingsRange`in e),`RTCEncodedAudioFrame`in e,``+e.Intl==`[object Intl]`,``+e.Reflect==`[object Reflect]`])>=3}function rn(){var e=window,t=e.URLPattern;return I([`union`in Set.prototype,`Iterator`in e,t&&`hasRegExpGroups`in t.prototype,`RGB8`in WebGLRenderingContext.prototype])>=3}function an(){var e=window;return I([`DOMRectList`in e,`RTCPeerConnectionIceEvent`in e,`SVGGeometryElement`in e,`ontransitioncancel`in e])>=3}function on(){var e=window,t=navigator,n=e.CSS,r=e.HTMLButtonElement;return I([!(`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 sn(){if(navigator.platform===`iPad`)return!0;var e=screen,t=e.width/e.height;return I([`MediaSource`in window,!!Element.prototype.webkitRequestFullscreen,t>.65&&t<1.53])>=2}function cn(){var e=document;return e.fullscreenElement||e.msFullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement||null}function ln(){var e=document;return(e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen).call(e)}function un(){var e=Qt(),t=tn(),n=window,r=navigator,i=`connection`;return e?I([!(`SharedWorker`in n),r[i]&&`ontypechange`in r[i],!(`sinkId`in new Audio)])>=2:t?I([`onorientationchange`in n,`orientation`in n,/android/i.test(r.appVersion)])>=2:!1}function dn(){var e=navigator,t=window,n=Audio.prototype,r=t.visualViewport;return I([`srLatency`in n,`srChannelCount`in n,`devicePosture`in e,r&&`segments`in r,`getTextInformation`in Image.prototype])>=3}function fn(){return hn()?-4:pn()}function pn(){var e=window,t=e.OfflineAudioContext||e.webkitOfflineAudioContext;if(!t)return-2;if(mn())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=gn(r),s=o[0],c=o[1],l=Dt(s.then(function(e){return _n(e.getChannelData(0).subarray(n))},function(e){if(e.name===`timeout`||e.name===`suspended`)return-3;throw e}));return function(){return c(),l}}function mn(){return B()&&!$t()&&!an()}function hn(){return B()&&on()&&en()||Qt()&&dn()&&rn()}function gn(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(vn(`timeout`))},Math.min(r,u+i-Date.now()))},f=function(){try{var r=e.startRendering();switch(wt(r)&&Dt(r),e.state){case`running`:u=Date.now(),c&&d();break;case`suspended`:document.hidden||l++,c&&l>=t?s(vn(`suspended`)):setTimeout(f,n);break}}catch(e){s(e)}};f(),a=function(){c||(c=!0,u>0&&d())}}),a]}function _n(e){for(var t=0,n=0;n<e.length;++n)t+=Math.abs(e[n]);return t}function vn(e){var t=Error(e);return t.name=e,t}function yn(e,t,n){var r;return n===void 0&&(n=50),M(this,void 0,void 0,function(){var i,a;return N(this,function(o){switch(o.label){case 0:i=document,o.label=1;case 1:return i.body?[3,3]:[4,xt(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,xt(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 bn(e){for(var t=Mt(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`?xn(i.style,c):i.setAttribute(s,c)}return i}function xn(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 Sn(){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 Cn=`mmMwWLliI0O&1`,wn=`48px`,Tn=[`monospace`,`sans-serif`,`serif`],En=`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 Dn(){var e=this;return yn(function(t,n){var r=n.document;return M(e,void 0,void 0,function(){var e,t,n,i,a,o,s,c,l,u,d,f;return N(this,function(p){for(e=r.body,e.style.fontSize=wn,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=Cn,t.appendChild(n),n},o=function(e,t){return a(`'${e}',${t}`)},s=function(){return Tn.map(a)},c=function(){for(var e={},t=function(t){e[t]=Tn.map(function(e){return o(t,e)})},n=0,r=En;n<r.length;n++){var i=r[n];t(i)}return e},l=function(e){return Tn.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<Tn.length;f++)n[Tn[f]]=u[f].offsetWidth,i[Tn[f]]=u[f].offsetHeight;return[2,En.filter(function(e){return l(d[e])})]})})})}function On(){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 kn(){return An(Rn())}function An(e){var t,n=!1,r,i,a=jn(),o=a[0],s=a[1];return Mn(o,s)?(n=Nn(s),e?r=i=`skipped`:(t=Pn(o,s),r=t[0],i=t[1])):r=i=`unsupported`,{winding:n,geometry:r,text:i}}function jn(){var e=document.createElement(`canvas`);return e.width=1,e.height=1,[e,e.getContext(`2d`)]}function Mn(e,t){return!!(t&&e.toDataURL)}function Nn(e){return e.rect(0,0,10,10),e.rect(2,2,6,6),!e.isPointInPath(5,5,`evenodd`)}function Pn(e,t){Fn(e,t);var n=Ln(e);return n===Ln(e)?(In(e,t),[Ln(e),n]):[`unstable`,`unstable`]}function Fn(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 In(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 Ln(e){return e.toDataURL()}function Rn(){return B()&&on()&&en()}function zn(){var e=navigator,t=0,n;e.maxTouchPoints===void 0?e.msMaxTouchPoints!==void 0&&(t=e.msMaxTouchPoints):t=At(e.maxTouchPoints);try{document.createEvent(`TouchEvent`),n=!0}catch{n=!1}var r=`ontouchstart`in window;return{maxTouchPoints:t,touchEvent:n,touchStart:r}}function Bn(){return navigator.oscpu}function Vn(){var e=navigator,t=[],n=e.language||e.userLanguage||e.browserLanguage||e.systemLanguage;if(n!==void 0&&t.push([n]),Array.isArray(e.languages))Qt()&&nn()||t.push(e.languages);else if(typeof e.languages==`string`){var r=e.languages;r&&t.push(r.split(`,`))}return t}function Hn(){return window.screen.colorDepth}function Un(){return F(P(navigator.deviceMemory),void 0)}function Wn(){if(!(B()&&on()&&en()))return Gn()}function Gn(){var e=screen,t=function(e){return F(At(e),null)},n=[t(e.width),t(e.height)];return n.sort().reverse(),n}var Kn=2500,qn=10,Jn,Yn;function Xn(){if(Yn===void 0){var e=function(){var t=$n();er(t)?Yn=setTimeout(e,Kn):(Jn=t,Yn=void 0)};e()}}function Zn(){var e=this;return Xn(),function(){return M(e,void 0,void 0,function(){var e;return N(this,function(t){switch(t.label){case 0:return e=$n(),er(e)?Jn?[2,yt([],Jn,!0)]:cn()?[4,ln()]:[3,2]:[3,2];case 1:t.sent(),e=$n(),t.label=2;case 2:return er(e)||(Jn=e),[2,e]}})})}}function Qn(){var e=this;if(B()&&on()&&en())return function(){return Promise.resolve(void 0)};var t=Zn();return function(){return M(e,void 0,void 0,function(){var e,n;return N(this,function(r){switch(r.label){case 0:return[4,t()];case 1:return e=r.sent(),n=function(e){return e===null?null:jt(e,qn)},[2,[n(e[0]),n(e[1]),n(e[2]),n(e[3])]]}})})}}function $n(){var e=screen;return[F(P(e.availTop),null),F(P(e.width)-P(e.availWidth)-F(P(e.availLeft),0),null),F(P(e.height)-P(e.availHeight)-F(P(e.availTop),0),null),F(P(e.availLeft),null)]}function er(e){for(var t=0;t<4;++t)if(e[t])return!1;return!0}function tr(){return F(At(navigator.hardwareConcurrency),void 0)}function nr(){var e=window.Intl?.DateTimeFormat;if(e){var t=new e().resolvedOptions().timeZone;if(t)return t}var n=-rr();return`UTC${n>=0?`+`:``}${n}`}function rr(){var e=new Date().getFullYear();return Math.max(P(new Date(e,0,1).getTimezoneOffset()),P(new Date(e,6,1).getTimezoneOffset()))}function ir(){try{return!!window.sessionStorage}catch{return!0}}function ar(){try{return!!window.localStorage}catch{return!0}}function or(){if(!(Xt()||Zt()))try{return!!window.indexedDB}catch{return!0}}function sr(){return!!window.openDatabase}function cr(){return navigator.cpuClass}function lr(){var e=navigator.platform;return e===`MacIntel`&&B()&&!$t()?sn()?`iPad`:`iPhone`:e}function ur(){return navigator.vendor||``}function dr(){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 fr(){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 pr(){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 mr(e){var t=(e===void 0?{}:e).debug;return M(this,void 0,void 0,function(){var e,n,r,i,a,o;return N(this,function(s){switch(s.label){case 0:return hr()?(e=pr(),n=Object.keys(e),r=(o=[]).concat.apply(o,n.map(function(t){return e[t]})),[4,gr(r)]):[2,void 0];case 1:return i=s.sent(),t&&vr(e,i),a=n.filter(function(t){var n=e[t];return I(n.map(function(e){return i[e]}))>n.length*.6}),a.sort(),[2,a]}})})}function hr(){return B()||un()}function gr(e){var t;return M(this,void 0,void 0,function(){var n,r,i,a,o,s,c,o;return N(this,function(l){switch(l.label){case 0:for(n=document,r=n.createElement(`div`),i=Array(e.length),a={},_r(r),o=0;o<e.length;++o)s=bn(e[o]),s.tagName===`DIALOG`&&s.show(),c=n.createElement(`div`),_r(c),c.appendChild(s),r.appendChild(c),i[o]=s;l.label=1;case 1:return n.body?[3,3]:[4,xt(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 _r(e){e.style.setProperty(`visibility`,`hidden`,`important`),e.style.setProperty(`display`,`block`,`important`)}function vr(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
|
+
var __AgentKitInternal=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t;(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})(t||={});var n;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(n||={});var r=t.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),i=e=>{switch(typeof e){case`undefined`:return r.undefined;case`string`:return r.string;case`number`:return Number.isNaN(e)?r.nan:r.number;case`boolean`:return r.boolean;case`function`:return r.function;case`bigint`:return r.bigint;case`symbol`:return r.symbol;case`object`:return Array.isArray(e)?r.array:e===null?r.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?r.promise:typeof Map<`u`&&e instanceof Map?r.map:typeof Set<`u`&&e instanceof Set?r.set:typeof Date<`u`&&e instanceof Date?r.date:r.object;default:return r.unknown}},a=t.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`]),o=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,t.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()}};o.create=e=>new o(e);var s=(e,n)=>{let i;switch(e.code){case a.invalid_type:i=e.received===r.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case a.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(e.expected,t.jsonStringifyReplacer)}`;break;case a.unrecognized_keys:i=`Unrecognized key(s) in object: ${t.joinValues(e.keys,`, `)}`;break;case a.invalid_union:i=`Invalid input`;break;case a.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${t.joinValues(e.options)}`;break;case a.invalid_enum_value:i=`Invalid enum value. Expected ${t.joinValues(e.options)}, received '${e.received}'`;break;case a.invalid_arguments:i=`Invalid function arguments`;break;case a.invalid_return_type:i=`Invalid function return type`;break;case a.invalid_date:i=`Invalid date`;break;case a.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(i=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(i=`${i} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?i=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?i=`Invalid input: must end with "${e.validation.endsWith}"`:t.assertNever(e.validation):i=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case a.too_small:i=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 a.too_big:i=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 a.custom:i=`Invalid input`;break;case a.invalid_intersection_types:i=`Intersection results could not be merged`;break;case a.not_multiple_of:i=`Number must be a multiple of ${e.multipleOf}`;break;case a.not_finite:i=`Number must be finite`;break;default:i=n.defaultError,t.assertNever(e)}return{message:i}},c=s;function l(){return c}var u=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 d(e,t){let n=l(),r=u({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===s?void 0:s].filter(e=>!!e)});e.common.issues.push(r)}var f=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 p;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 p;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}}},p=Object.freeze({status:`aborted`}),m=e=>({status:`dirty`,value:e}),h=e=>({status:`valid`,value:e}),g=e=>e.status===`aborted`,_=e=>e.status===`dirty`,v=e=>e.status===`valid`,y=e=>typeof Promise<`u`&&e instanceof Promise,b;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(b||={});var x=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}},S=(e,t)=>{if(v(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 o(e.common.issues);return this._error=t,this._error}}};function C(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 w=class{get description(){return this._def.description}_getType(e){return i(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:i(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new f,ctx:{common:e.parent.common,data:e.data,parsedType:i(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(y(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:i(e)};return S(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:i(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return v(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=>v(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:i(e)},r=this._parse({data:e,path:n.path,parent:n});return S(n,await(y(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),o=()=>r.addIssue({code:a.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(o(),!1)):i?!0:(o(),!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 k({schema:this,typeName:j.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 A.create(this,this._def)}nullable(){return Qe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Pe.create(this)}promise(){return Ze.create(this,this._def)}or(e){return Ie.create([this,e],this._def)}and(e){return Be.create(this,e,this._def)}transform(e){return new k({...C(this._def),schema:this,typeName:j.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new $e({...C(this._def),innerType:this,defaultValue:t,typeName:j.ZodDefault})}brand(){return new nt({typeName:j.ZodBranded,type:this,...C(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new et({...C(this._def),innerType:this,catchValue:t,typeName:j.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return rt.create(this,e)}readonly(){return it.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},T=/^c[^\s-]{8,}$/i,E=/^[0-9a-z]+$/,ee=/^[0-9A-HJKMNP-TV-Z]{26}$/i,D=/^[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 xe=class e extends w{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==r.string){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.string,received:t.parsedType}),p}let n=new f,i;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(i=this._getOrReturnCtx(e,i),d(i,{code:a.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind===`max`)e.data.length>r.value&&(i=this._getOrReturnCtx(e,i),d(i,{code:a.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind===`length`){let t=e.data.length>r.value,o=e.data.length<r.value;(t||o)&&(i=this._getOrReturnCtx(e,i),t?d(i,{code:a.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):o&&d(i,{code:a.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),n.dirty())}else if(r.kind===`email`)ie.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`email`,code:a.invalid_string,message:r.message}),n.dirty());else if(r.kind===`emoji`)oe||=new RegExp(ae,`u`),oe.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`emoji`,code:a.invalid_string,message:r.message}),n.dirty());else if(r.kind===`uuid`)D.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`uuid`,code:a.invalid_string,message:r.message}),n.dirty());else if(r.kind===`nanoid`)te.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`nanoid`,code:a.invalid_string,message:r.message}),n.dirty());else if(r.kind===`cuid`)T.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`cuid`,code:a.invalid_string,message:r.message}),n.dirty());else if(r.kind===`cuid2`)E.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`cuid2`,code:a.invalid_string,message:r.message}),n.dirty());else if(r.kind===`ulid`)ee.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`ulid`,code:a.invalid_string,message:r.message}),n.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),d(i,{validation:`url`,code:a.invalid_string,message:r.message}),n.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`regex`,code:a.invalid_string,message:r.message}),n.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(i=this._getOrReturnCtx(e,i),d(i,{code:a.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),n.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(i=this._getOrReturnCtx(e,i),d(i,{code:a.invalid_string,validation:{startsWith:r.value},message:r.message}),n.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(i=this._getOrReturnCtx(e,i),d(i,{code:a.invalid_string,validation:{endsWith:r.value},message:r.message}),n.dirty()):r.kind===`datetime`?_e(r).test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{code:a.invalid_string,validation:`datetime`,message:r.message}),n.dirty()):r.kind===`date`?me.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{code:a.invalid_string,validation:`date`,message:r.message}),n.dirty()):r.kind===`time`?ge(r).test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{code:a.invalid_string,validation:`time`,message:r.message}),n.dirty()):r.kind===`duration`?re.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`duration`,code:a.invalid_string,message:r.message}),n.dirty()):r.kind===`ip`?ve(e.data,r.version)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`ip`,code:a.invalid_string,message:r.message}),n.dirty()):r.kind===`jwt`?ye(e.data,r.alg)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`jwt`,code:a.invalid_string,message:r.message}),n.dirty()):r.kind===`cidr`?be(e.data,r.version)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`cidr`,code:a.invalid_string,message:r.message}),n.dirty()):r.kind===`base64`?de.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`base64`,code:a.invalid_string,message:r.message}),n.dirty()):r.kind===`base64url`?fe.test(e.data)||(i=this._getOrReturnCtx(e,i),d(i,{validation:`base64url`,code:a.invalid_string,message:r.message}),n.dirty()):t.assertNever(r);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:a.invalid_string,...b.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...b.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...b.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...b.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...b.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...b.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...b.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...b.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...b.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...b.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...b.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...b.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...b.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...b.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,...b.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,...b.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...b.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...b.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...b.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...b.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...b.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...b.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...b.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...b.errToObj(t)})}nonempty(e){return this.min(1,b.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}};xe.create=e=>new xe({checks:[],typeName:j.ZodString,coerce:e?.coerce??!1,...C(e)});function Se(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 Ce=class e extends w{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)!==r.number){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.number,received:t.parsedType}),p}let n,i=new f;for(let r of this._def.checks)r.kind===`int`?t.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:a.invalid_type,expected:`integer`,received:`float`,message:r.message}),i.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:a.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:a.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind===`multipleOf`?Se(e.data,r.value)!==0&&(n=this._getOrReturnCtx(e,n),d(n,{code:a.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:a.not_finite,message:r.message}),i.dirty()):t.assertNever(r);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,b.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,b.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,b.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,b.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:b.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:b.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:b.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:b.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:b.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:b.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:b.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`&&t.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)}};Ce.create=e=>new Ce({checks:[],typeName:j.ZodNumber,coerce:e?.coerce||!1,...C(e)});var we=class e extends w{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)!==r.bigint)return this._getInvalidInput(e);let n,i=new f;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:a.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),d(n,{code:a.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),d(n,{code:a.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):t.assertNever(r);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.bigint,received:t.parsedType}),p}gte(e,t){return this.setLimit(`min`,e,!0,b.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,b.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,b.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,b.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:b.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:b.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:b.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:b.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}};we.create=e=>new we({checks:[],typeName:j.ZodBigInt,coerce:e?.coerce??!1,...C(e)});var Te=class extends w{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==r.boolean){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.boolean,received:t.parsedType}),p}return h(e.data)}};Te.create=e=>new Te({typeName:j.ZodBoolean,coerce:e?.coerce||!1,...C(e)});var Ee=class e extends w{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==r.date){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.date,received:t.parsedType}),p}if(Number.isNaN(e.data.getTime()))return d(this._getOrReturnCtx(e),{code:a.invalid_date}),p;let n=new f,i;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(i=this._getOrReturnCtx(e,i),d(i,{code:a.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),n.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(i=this._getOrReturnCtx(e,i),d(i,{code:a.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),n.dirty()):t.assertNever(r);return{status:n.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:b.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:b.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)}};Ee.create=e=>new Ee({checks:[],coerce:e?.coerce||!1,typeName:j.ZodDate,...C(e)});var De=class extends w{_parse(e){if(this._getType(e)!==r.symbol){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.symbol,received:t.parsedType}),p}return h(e.data)}};De.create=e=>new De({typeName:j.ZodSymbol,...C(e)});var Oe=class extends w{_parse(e){if(this._getType(e)!==r.undefined){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.undefined,received:t.parsedType}),p}return h(e.data)}};Oe.create=e=>new Oe({typeName:j.ZodUndefined,...C(e)});var ke=class extends w{_parse(e){if(this._getType(e)!==r.null){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.null,received:t.parsedType}),p}return h(e.data)}};ke.create=e=>new ke({typeName:j.ZodNull,...C(e)});var Ae=class extends w{constructor(){super(...arguments),this._any=!0}_parse(e){return h(e.data)}};Ae.create=e=>new Ae({typeName:j.ZodAny,...C(e)});var je=class extends w{constructor(){super(...arguments),this._unknown=!0}_parse(e){return h(e.data)}};je.create=e=>new je({typeName:j.ZodUnknown,...C(e)});var Me=class extends w{_parse(e){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.never,received:t.parsedType}),p}};Me.create=e=>new Me({typeName:j.ZodNever,...C(e)});var Ne=class extends w{_parse(e){if(this._getType(e)!==r.undefined){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.void,received:t.parsedType}),p}return h(e.data)}};Ne.create=e=>new Ne({typeName:j.ZodVoid,...C(e)});var Pe=class e extends w{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==r.array)return d(t,{code:a.invalid_type,expected:r.array,received:t.parsedType}),p;if(i.exactLength!==null){let e=t.data.length>i.exactLength.value,r=t.data.length<i.exactLength.value;(e||r)&&(d(t,{code:e?a.too_big:a.too_small,minimum:r?i.exactLength.value:void 0,maximum:e?i.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(d(t,{code:a.too_small,minimum:i.minLength.value,type:`array`,inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(d(t,{code:a.too_big,maximum:i.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>i.type._parseAsync(new x(t,e,t.path,n)))).then(e=>f.mergeArray(n,e));let o=[...t.data].map((e,n)=>i.type._parseSync(new x(t,e,t.path,n)));return f.mergeArray(n,o)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:b.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:b.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:b.toString(n)}})}nonempty(e){return this.min(1,e)}};Pe.create=(e,t)=>new Pe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:j.ZodArray,...C(t)});function Fe(e){if(e instanceof O){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=A.create(Fe(r))}return new O({...e._def,shape:()=>t})}return e instanceof Pe?new Pe({...e._def,type:Fe(e.element)}):e instanceof A?A.create(Fe(e.unwrap())):e instanceof Qe?Qe.create(Fe(e.unwrap())):e instanceof Ve?Ve.create(e.items.map(e=>Fe(e))):e}var O=class e extends w{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(),n=t.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==r.object){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.object,received:t.parsedType}),p}let{status:t,ctx:n}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof Me&&this._def.unknownKeys===`strip`))for(let e in n.data)o.includes(e)||s.push(e);let c=[];for(let e of o){let t=i[e],r=n.data[e];c.push({key:{status:`valid`,value:e},value:t._parse(new x(n,r,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Me){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of s)c.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)s.length>0&&(d(n,{code:a.unrecognized_keys,keys:s}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of s){let r=n.data[t];c.push({key:{status:`valid`,value:t},value:e._parse(new x(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=>f.mergeObjectSync(t,e)):f.mergeObjectSync(t,c)}get shape(){return this._def.shape()}strict(t){return b.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:b.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:j.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(n){let r={};for(let e of t.objectKeys(n))n[e]&&this.shape[e]&&(r[e]=this.shape[e]);return new e({...this._def,shape:()=>r})}omit(n){let r={};for(let e of t.objectKeys(this.shape))n[e]||(r[e]=this.shape[e]);return new e({...this._def,shape:()=>r})}deepPartial(){return Fe(this)}partial(n){let r={};for(let e of t.objectKeys(this.shape)){let t=this.shape[e];r[e]=n&&!n[e]?t:t.optional()}return new e({...this._def,shape:()=>r})}required(n){let r={};for(let e of t.objectKeys(this.shape))if(n&&!n[e])r[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof A;)t=t._def.innerType;r[e]=t}return new e({...this._def,shape:()=>r})}keyof(){return Je(t.objectKeys(this.shape))}};O.create=(e,t)=>new O({shape:()=>e,unknownKeys:`strip`,catchall:Me.create(),typeName:j.ZodObject,...C(t)}),O.strictCreate=(e,t)=>new O({shape:()=>e,unknownKeys:`strict`,catchall:Me.create(),typeName:j.ZodObject,...C(t)}),O.lazycreate=(e,t)=>new O({shape:e,unknownKeys:`strip`,catchall:Me.create(),typeName:j.ZodObject,...C(t)});var Ie=class extends w{_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 o(e.ctx.common.issues));return d(t,{code:a.invalid_union,unionErrors:n}),p}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 o(e));return d(t,{code:a.invalid_union,unionErrors:i}),p}}get options(){return this._def.options}};Ie.create=(e,t)=>new Ie({options:e,typeName:j.ZodUnion,...C(t)});var Le=e=>e instanceof Ke?Le(e.schema):e instanceof k?Le(e.innerType()):e instanceof qe?[e.value]:e instanceof Ye?e.options:e instanceof Xe?t.objectValues(e.enum):e instanceof $e?Le(e._def.innerType):e instanceof Oe?[void 0]:e instanceof ke?[null]:e instanceof A?[void 0,...Le(e.unwrap())]:e instanceof Qe?[null,...Le(e.unwrap())]:e instanceof nt||e instanceof it?Le(e.unwrap()):e instanceof et?Le(e._def.innerType):[],Re=class e extends w{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==r.object)return d(t,{code:a.invalid_type,expected:r.object,received:t.parsedType}),p;let n=this.discriminator,i=t.data[n],o=this.optionsMap.get(i);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(d(t,{code:a.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),p)}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=Le(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:j.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...C(r)})}};function ze(e,n){let a=i(e),o=i(n);if(e===n)return{valid:!0,data:e};if(a===r.object&&o===r.object){let r=t.objectKeys(n),i=t.objectKeys(e).filter(e=>r.indexOf(e)!==-1),a={...e,...n};for(let t of i){let r=ze(e[t],n[t]);if(!r.valid)return{valid:!1};a[t]=r.data}return{valid:!0,data:a}}if(a===r.array&&o===r.array){if(e.length!==n.length)return{valid:!1};let t=[];for(let r=0;r<e.length;r++){let i=e[r],a=n[r],o=ze(i,a);if(!o.valid)return{valid:!1};t.push(o.data)}return{valid:!0,data:t}}return a===r.date&&o===r.date&&+e==+n?{valid:!0,data:e}:{valid:!1}}var Be=class extends w{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(g(e)||g(r))return p;let i=ze(e.value,r.value);return i.valid?((_(e)||_(r))&&t.dirty(),{status:t.value,value:i.data}):(d(n,{code:a.invalid_intersection_types}),p)};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}))}};Be.create=(e,t,n)=>new Be({left:e,right:t,typeName:j.ZodIntersection,...C(n)});var Ve=class e extends w{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==r.array)return d(n,{code:a.invalid_type,expected:r.array,received:n.parsedType}),p;if(n.data.length<this._def.items.length)return d(n,{code:a.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),p;!this._def.rest&&n.data.length>this._def.items.length&&(d(n,{code:a.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let i=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new x(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(i).then(e=>f.mergeArray(t,e)):f.mergeArray(t,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ve.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new Ve({items:e,typeName:j.ZodTuple,rest:null,...C(t)})};var He=class e extends w{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!==r.object)return d(n,{code:a.invalid_type,expected:r.object,received:n.parsedType}),p;let i=[],o=this._def.keyType,s=this._def.valueType;for(let e in n.data)i.push({key:o._parse(new x(n,e,n.path,e)),value:s._parse(new x(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?f.mergeObjectAsync(t,i):f.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof w?new e({keyType:t,valueType:n,typeName:j.ZodRecord,...C(r)}):new e({keyType:xe.create(),valueType:t,typeName:j.ZodRecord,...C(n)})}},Ue=class extends w{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!==r.map)return d(n,{code:a.invalid_type,expected:r.map,received:n.parsedType}),p;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([e,t],r)=>({key:i._parse(new x(n,e,n.path,[r,`key`])),value:o._parse(new x(n,t,n.path,[r,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of s){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return p;(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 s){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return p;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};Ue.create=(e,t,n)=>new Ue({valueType:t,keyType:e,typeName:j.ZodMap,...C(n)});var We=class e extends w{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==r.set)return d(n,{code:a.invalid_type,expected:r.set,received:n.parsedType}),p;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(d(n,{code:a.too_small,minimum:i.minSize.value,type:`set`,inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(d(n,{code:a.too_big,maximum:i.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());let o=this._def.valueType;function s(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return p;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let c=[...n.data.values()].map((e,t)=>o._parse(new x(n,e,n.path,t)));return n.common.async?Promise.all(c).then(e=>s(e)):s(c)}min(t,n){return new e({...this._def,minSize:{value:t,message:b.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:b.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};We.create=(e,t)=>new We({valueType:e,minSize:null,maxSize:null,typeName:j.ZodSet,...C(t)});var Ge=class e extends w{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==r.function)return d(t,{code:a.invalid_type,expected:r.function,received:t.parsedType}),p;function n(e,n){return u({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,l(),s].filter(e=>!!e),issueData:{code:a.invalid_arguments,argumentsError:n}})}function i(e,n){return u({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,l(),s].filter(e=>!!e),issueData:{code:a.invalid_return_type,returnTypeError:n}})}let c={errorMap:t.common.contextualErrorMap},f=t.data;if(this._def.returns instanceof Ze){let e=this;return h(async function(...t){let r=new o([]),a=await e._def.args.parseAsync(t,c).catch(e=>{throw r.addIssue(n(t,e)),r}),s=await Reflect.apply(f,this,a);return await e._def.returns._def.type.parseAsync(s,c).catch(e=>{throw r.addIssue(i(s,e)),r})})}{let e=this;return h(function(...t){let r=e._def.args.safeParse(t,c);if(!r.success)throw new o([n(t,r.error)]);let a=Reflect.apply(f,this,r.data),s=e._def.returns.safeParse(a,c);if(!s.success)throw new o([i(a,s.error)]);return s.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ve.create(t).rest(je.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||Ve.create([]).rest(je.create()),returns:n||je.create(),typeName:j.ZodFunction,...C(r)})}},Ke=class extends w{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})}};Ke.create=(e,t)=>new Ke({getter:e,typeName:j.ZodLazy,...C(t)});var qe=class extends w{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return d(t,{received:t.data,code:a.invalid_literal,expected:this._def.value}),p}return{status:`valid`,value:e.data}}get value(){return this._def.value}};qe.create=(e,t)=>new qe({value:e,typeName:j.ZodLiteral,...C(t)});function Je(e,t){return new Ye({values:e,typeName:j.ZodEnum,...C(t)})}var Ye=class e extends w{_parse(e){if(typeof e.data!=`string`){let n=this._getOrReturnCtx(e),r=this._def.values;return d(n,{expected:t.joinValues(r),received:n.parsedType,code:a.invalid_type}),p}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return d(t,{received:t.data,code:a.invalid_enum_value,options:n}),p}return h(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})}};Ye.create=Je;var Xe=class extends w{_parse(e){let n=t.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==r.string&&i.parsedType!==r.number){let e=t.objectValues(n);return d(i,{expected:t.joinValues(e),received:i.parsedType,code:a.invalid_type}),p}if(this._cache||=new Set(t.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=t.objectValues(n);return d(i,{received:i.data,code:a.invalid_enum_value,options:e}),p}return h(e.data)}get enum(){return this._def.values}};Xe.create=(e,t)=>new Xe({values:e,typeName:j.ZodNativeEnum,...C(t)});var Ze=class extends w{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==r.promise&&t.common.async===!1?(d(t,{code:a.invalid_type,expected:r.promise,received:t.parsedType}),p):h((t.parsedType===r.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Ze.create=(e,t)=>new Ze({type:e,typeName:j.ZodPromise,...C(t)});var k=class extends w{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===j.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:e=>{d(r,e),e.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),i.type===`preprocess`){let e=i.transform(r.data,a);if(r.common.async)return Promise.resolve(e).then(async e=>{if(n.value===`aborted`)return p;let t=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return t.status===`aborted`?p:t.status===`dirty`||n.value===`dirty`?m(t.value):t});{if(n.value===`aborted`)return p;let t=this._def.schema._parseSync({data:e,path:r.path,parent:r});return t.status===`aborted`?p:t.status===`dirty`||n.value===`dirty`?m(t.value):t}}if(i.type===`refinement`){let e=e=>{let t=i.refinement(e,a);if(r.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(r.common.async===!1){let t=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return t.status===`aborted`?p:(t.status===`dirty`&&n.dirty(),e(t.value),{status:n.value,value:t.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(t=>t.status===`aborted`?p:(t.status===`dirty`&&n.dirty(),e(t.value).then(()=>({status:n.value,value:t.value}))))}if(i.type===`transform`){if(r.common.async===!1){let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!v(e))return p;let t=i.transform(e.value,a);if(t instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:n.value,value:t}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>v(e)?Promise.resolve(i.transform(e.value,a)).then(e=>({status:n.value,value:e})):p)}t.assertNever(i)}};k.create=(e,t,n)=>new k({schema:e,typeName:j.ZodEffects,effect:t,...C(n)}),k.createWithPreprocess=(e,t,n)=>new k({schema:t,effect:{type:`preprocess`,transform:e},typeName:j.ZodEffects,...C(n)});var A=class extends w{_parse(e){return this._getType(e)===r.undefined?h(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};A.create=(e,t)=>new A({innerType:e,typeName:j.ZodOptional,...C(t)});var Qe=class extends w{_parse(e){return this._getType(e)===r.null?h(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Qe.create=(e,t)=>new Qe({innerType:e,typeName:j.ZodNullable,...C(t)});var $e=class extends w{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===r.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};$e.create=(e,t)=>new $e({innerType:e,typeName:j.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...C(t)});var et=class extends w{_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 y(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new o(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new o(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};et.create=(e,t)=>new et({innerType:e,typeName:j.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...C(t)});var tt=class extends w{_parse(e){if(this._getType(e)!==r.nan){let t=this._getOrReturnCtx(e);return d(t,{code:a.invalid_type,expected:r.nan,received:t.parsedType}),p}return{status:`valid`,value:e.data}}};tt.create=e=>new tt({typeName:j.ZodNaN,...C(e)});var nt=class extends w{_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}},rt=class e extends w{_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`?p:e.status===`dirty`?(t.dirty(),m(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`?p: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:j.ZodPipeline})}},it=class extends w{_parse(e){let t=this._def.innerType._parse(e),n=e=>(v(e)&&(e.value=Object.freeze(e.value)),e);return y(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};it.create=(e,t)=>new it({innerType:e,typeName:j.ZodReadonly,...C(t)}),O.lazycreate;var j;(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`})(j||={});var M=xe.create;Ce.create,tt.create,we.create;var at=Te.create;Ee.create,De.create,Oe.create,ke.create,Ae.create;var ot=je.create;Me.create,Ne.create,Pe.create;var st=O.create;O.strictCreate,Ie.create,Re.create,Be.create,Ve.create;var ct=He.create;Ue.create,We.create,Ge.create,Ke.create,qe.create;var lt=Ye.create;Xe.create,Ze.create,k.create,A.create,Qe.create,k.createWithPreprocess,rt.create;var ut=st({mode:lt([`light`,`dark`,`system`]).optional(),accentColor:M().optional(),fontFamily:M().optional(),borderRadius:M().optional()}),dt=st({externalId:M().optional(),authId:M().optional(),name:M().optional(),email:M().optional()}),ft=st({agentId:M().min(1,`agentId is required`),apiBaseUrl:M().url(`apiBaseUrl must be a valid URL`),tenantId:M().optional(),user:dt.optional(),sessionId:M().optional(),mode:lt([`floating`,`inline`]).optional(),title:M().optional(),subtitle:M().optional(),description:M().optional(),avatarUrl:M().optional(),launcherLabel:M().optional(),streaming:at().optional(),preview:at().optional(),skipServerConfigFetch:at().optional(),configChannel:lt([`draft`,`published`]).optional(),metadata:ct(ot()).optional(),theme:ut.optional()}),pt=ft.omit({agentId:!0,apiBaseUrl:!0}).partial(),mt={mode:`floating`,streaming:!0,title:`AI Assistant`,launcherLabel:``,theme:{mode:`light`,accentColor:`#4f46e5`,fontFamily:`system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif`,borderRadius:`12px`}};function ht(e,t){ft.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?pt.passthrough().safeParse(r).data:void 0,a=i?gt(i,e):e,o={mode:a.theme?.mode??n?.mode??mt.theme.mode,accentColor:a.theme?.accentColor||n?.accentColor||mt.theme.accentColor,fontFamily:a.theme?.fontFamily??n?.fontFamily??mt.theme.fontFamily,borderRadius:a.theme?.borderRadius??n?.borderRadius??mt.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??mt.mode,title:a.title??mt.title,subtitle:a.subtitle,description:a.description,suggestedQuestions:(()=>{let e=i?.suggestedQuestions;return Array.isArray(e)?e:[]})(),avatarUrl:a.avatarUrl,launcherLabel:(a.launcherLabel??mt.launcherLabel).trim().slice(0,40),streaming:a.streaming??mt.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 gt(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`?gt(n[e],r):r)}return n}var _t=function(){return _t=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},_t.apply(this,arguments)};function N(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 P(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 vt(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 yt=`4.6.2`;function bt(e,t){return new Promise(function(n){return setTimeout(n,e,t)})}function xt(){return new Promise(function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})}function St(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})}):bt(Math.min(e,t))}function Ct(e){return!!e&&typeof e.then==`function`}function wt(e,t){try{var n=e();Ct(n)?n.then(function(e){return t(!0,e)},function(e){return t(!1,e)}):t(!0,n)}catch(e){t(!1,e)}}function Tt(e,t,n){return n===void 0&&(n=16),N(this,void 0,void 0,function(){var r,i,a,o;return P(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,xt()]):[3,3]):[3,4];case 2:s.sent(),s.label=3;case 3:return++a,[3,1];case 4:return[2,r]}})})}function Et(e){return e.then(void 0,function(){}),e}function Dt(e,t){for(var n=0,r=e.length;n<r;++n)if(e[n]===t)return!0;return!1}function Ot(e,t){return!Dt(e,t)}function kt(e){return parseInt(e)}function F(e){return parseFloat(e)}function I(e,t){return typeof e==`number`&&isNaN(e)?t:e}function L(e){return e.reduce(function(e,t){return e+ +!!t},0)}function At(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 jt(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 Mt(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 Nt(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 R(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 Pt(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 z(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 B(e,t){e[0]^=t[0],e[1]^=t[1]}var Ft=[4283543511,3981806797],It=[3301882366,444984403];function Lt(e){var t=[0,e[0]>>>1];B(e,t),R(e,Ft),t[1]=e[0]>>>1,B(e,t),R(e,It),t[1]=e[0]>>>1,B(e,t)}var Rt=[2277735313,289559509],zt=[1291169091,658871167],Bt=[0,5],Vt=[0,1390208809],Ht=[0,944331445];function Ut(e,t){var n=Mt(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,R(c,Rt),Pt(c,31),R(c,zt),B(o,c),Pt(o,27),Nt(o,s),R(o,Bt),Nt(o,Vt),R(l,zt),Pt(l,33),R(l,Rt),B(s,l),Pt(s,31),Nt(s,o),R(s,Bt),Nt(s,Ht);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],z(d,48),B(l,d);case 14:d[1]=n[u+13],z(d,40),B(l,d);case 13:d[1]=n[u+12],z(d,32),B(l,d);case 12:d[1]=n[u+11],z(d,24),B(l,d);case 11:d[1]=n[u+10],z(d,16),B(l,d);case 10:d[1]=n[u+9],z(d,8),B(l,d);case 9:d[1]=n[u+8],B(l,d),R(l,zt),Pt(l,33),R(l,Rt),B(s,l);case 8:d[1]=n[u+7],z(d,56),B(c,d);case 7:d[1]=n[u+6],z(d,48),B(c,d);case 6:d[1]=n[u+5],z(d,40),B(c,d);case 5:d[1]=n[u+4],z(d,32),B(c,d);case 4:d[1]=n[u+3],z(d,24),B(c,d);case 3:d[1]=n[u+2],z(d,16),B(c,d);case 2:d[1]=n[u+1],z(d,8),B(c,d);case 1:d[1]=n[u],B(c,d),R(c,Rt),Pt(c,31),R(c,zt),B(o,c)}return B(o,r),B(s,r),Nt(o,s),Nt(s,o),Lt(o),Lt(s),Nt(o,s),Nt(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 Wt(e){return _t({name:e.name,message:e.message,stack:e.stack?.split(`
|
|
2
|
+
`)},e)}function Gt(e){return/^function\s.*?\{\s*\[native code]\s*}$/.test(String(e))}function Kt(e){return typeof e!=`function`}function qt(e,t){var n=Et(new Promise(function(n){var r=Date.now();wt(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(Kt(a))return n(function(){return{value:a,duration:i}});n(function(){return new Promise(function(e){var t=Date.now();wt(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 Jt(e,t,n,r){var i=Object.keys(e).filter(function(e){return Ot(n,e)}),a=Et(Tt(i,function(n){return qt(e[n],t)},r));return function(){return N(this,void 0,void 0,function(){var e,t,n,o,s;return P(this,function(c){switch(c.label){case 0:return[4,a];case 1:return e=c.sent(),[4,Tt(e,function(e){return Et(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 Yt(){var e=window,t=navigator;return L([`MSCSSMatrix`in e,`msSetImmediate`in e,`msIndexedDB`in e,`msMaxTouchPoints`in t,`msPointerEnabled`in t])>=4}function Xt(){var e=window,t=navigator;return L([`msWriteProfilerMark`in e,`MSStream`in e,`msLaunchUri`in t,`msSaveBlob`in t])>=3&&!Yt()}function Zt(){var e=window,t=navigator;return L([`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 V(){var e=window,t=navigator;return L([`ApplePayError`in e,`CSSPrimitiveValue`in e,`Counter`in e,t.vendor.indexOf(`Apple`)===0,`RGBColor`in e,`WebKitMediaKeys`in e])>=4}function Qt(){var e=window,t=e.HTMLElement,n=e.Document;return L([`safari`in e,!(`ongestureend`in e),!(`TouchEvent`in e),!(`orientation`in e),t&&!(`autocapitalize`in t.prototype),n&&`pointerLockElement`in n.prototype])>=4}function $t(){var e=window;return Gt(e.print)&&String(e.browser)===`[object WebPageNamespace]`}function en(){var e=window;return L([`buildID`in navigator,`MozAppearance`in(document.documentElement?.style??{}),`onmozfullscreenchange`in e,`mozInnerScreenX`in e,`CSSMozDocumentRule`in e,`CanvasCaptureMediaStream`in e])>=4}function tn(){var e=window;return L([!(`MediaSettingsRange`in e),`RTCEncodedAudioFrame`in e,``+e.Intl==`[object Intl]`,``+e.Reflect==`[object Reflect]`])>=3}function nn(){var e=window,t=e.URLPattern;return L([`union`in Set.prototype,`Iterator`in e,t&&`hasRegExpGroups`in t.prototype,`RGB8`in WebGLRenderingContext.prototype])>=3}function rn(){var e=window;return L([`DOMRectList`in e,`RTCPeerConnectionIceEvent`in e,`SVGGeometryElement`in e,`ontransitioncancel`in e])>=3}function an(){var e=window,t=navigator,n=e.CSS,r=e.HTMLButtonElement;return L([!(`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 on(){if(navigator.platform===`iPad`)return!0;var e=screen,t=e.width/e.height;return L([`MediaSource`in window,!!Element.prototype.webkitRequestFullscreen,t>.65&&t<1.53])>=2}function sn(){var e=document;return e.fullscreenElement||e.msFullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement||null}function cn(){var e=document;return(e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen).call(e)}function ln(){var e=Zt(),t=en(),n=window,r=navigator,i=`connection`;return e?L([!(`SharedWorker`in n),r[i]&&`ontypechange`in r[i],!(`sinkId`in new Audio)])>=2:t?L([`onorientationchange`in n,`orientation`in n,/android/i.test(r.appVersion)])>=2:!1}function un(){var e=navigator,t=window,n=Audio.prototype,r=t.visualViewport;return L([`srLatency`in n,`srChannelCount`in n,`devicePosture`in e,r&&`segments`in r,`getTextInformation`in Image.prototype])>=3}function dn(){return mn()?-4:fn()}function fn(){var e=window,t=e.OfflineAudioContext||e.webkitOfflineAudioContext;if(!t)return-2;if(pn())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=hn(r),s=o[0],c=o[1],l=Et(s.then(function(e){return gn(e.getChannelData(0).subarray(n))},function(e){if(e.name===`timeout`||e.name===`suspended`)return-3;throw e}));return function(){return c(),l}}function pn(){return V()&&!Qt()&&!rn()}function mn(){return V()&&an()&&$t()||Zt()&&un()&&nn()}function hn(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(_n(`timeout`))},Math.min(500,o+5e3-Date.now()))},c=function(){try{var t=e.startRendering();switch(Ct(t)&&Et(t),e.state){case`running`:o=Date.now(),i&&s();break;case`suspended`:document.hidden||a++,i&&a>=3?r(_n(`suspended`)):setTimeout(c,500)}}catch(e){r(e)}};c(),t=function(){i||(i=!0,o>0&&s())}}),t]}function gn(e){for(var t=0,n=0;n<e.length;++n)t+=Math.abs(e[n]);return t}function _n(e){var t=Error(e);return t.name=e,t}function vn(e,t,n){var r;return n===void 0&&(n=50),N(this,void 0,void 0,function(){var i,a;return P(this,function(o){switch(o.label){case 0:i=document,o.label=1;case 1:return i.body?[3,3]:[4,bt(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,bt(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 yn(e){for(var t=jt(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`?bn(i.style,c):i.setAttribute(s,c)}return i}function bn(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 xn(){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 Sn=`mmMwWLliI0O&1`,Cn=`48px`,wn=[`monospace`,`sans-serif`,`serif`],Tn=`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 En(){var e=this;return vn(function(t,n){var r=n.document;return N(e,void 0,void 0,function(){var e,t,n,i,a,o,s,c,l,u,d,f;return P(this,function(p){for(e=r.body,e.style.fontSize=Cn,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=Sn,t.appendChild(n),n},o=function(e,t){return a(`'${e}',${t}`)},s=function(){return wn.map(a)},c=function(){for(var e={},t=function(t){e[t]=wn.map(function(e){return o(t,e)})},n=0,r=Tn;n<r.length;n++){var i=r[n];t(i)}return e},l=function(e){return wn.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<wn.length;f++)n[wn[f]]=u[f].offsetWidth,i[wn[f]]=u[f].offsetHeight;return[2,Tn.filter(function(e){return l(d[e])})]})})})}function Dn(){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 On(){return kn(Ln())}function kn(e){var t,n=!1,r,i,a=An(),o=a[0],s=a[1];return jn(o,s)?(n=Mn(s),e?r=i=`skipped`:(t=Nn(o,s),r=t[0],i=t[1])):r=i=`unsupported`,{winding:n,geometry:r,text:i}}function An(){var e=document.createElement(`canvas`);return e.width=1,e.height=1,[e,e.getContext(`2d`)]}function jn(e,t){return!!(t&&e.toDataURL)}function Mn(e){return e.rect(0,0,10,10),e.rect(2,2,6,6),!e.isPointInPath(5,5,`evenodd`)}function Nn(e,t){Pn(e,t);var n=In(e);return n===In(e)?(Fn(e,t),[In(e),n]):[`unstable`,`unstable`]}function Pn(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 Fn(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 In(e){return e.toDataURL()}function Ln(){return V()&&an()&&$t()}function Rn(){var e=navigator,t=0,n;e.maxTouchPoints===void 0?e.msMaxTouchPoints!==void 0&&(t=e.msMaxTouchPoints):t=kt(e.maxTouchPoints);try{document.createEvent(`TouchEvent`),n=!0}catch{n=!1}var r=`ontouchstart`in window;return{maxTouchPoints:t,touchEvent:n,touchStart:r}}function zn(){return navigator.oscpu}function Bn(){var e=navigator,t=[],n=e.language||e.userLanguage||e.browserLanguage||e.systemLanguage;if(n!==void 0&&t.push([n]),Array.isArray(e.languages))Zt()&&tn()||t.push(e.languages);else if(typeof e.languages==`string`){var r=e.languages;r&&t.push(r.split(`,`))}return t}function Vn(){return window.screen.colorDepth}function Hn(){return I(F(navigator.deviceMemory),void 0)}function Un(){if(!(V()&&an()&&$t()))return Wn()}function Wn(){var e=screen,t=function(e){return I(kt(e),null)},n=[t(e.width),t(e.height)];return n.sort().reverse(),n}var Gn=2500,Kn=10,qn,Jn;function Yn(){if(Jn===void 0){var e=function(){var t=Qn();$n(t)?Jn=setTimeout(e,Gn):(qn=t,Jn=void 0)};e()}}function Xn(){var e=this;return Yn(),function(){return N(e,void 0,void 0,function(){var e;return P(this,function(t){switch(t.label){case 0:return e=Qn(),$n(e)?qn?[2,vt([],qn,!0)]:sn()?[4,cn()]:[3,2]:[3,2];case 1:t.sent(),e=Qn(),t.label=2;case 2:return $n(e)||(qn=e),[2,e]}})})}}function Zn(){var e=this;if(V()&&an()&&$t())return function(){return Promise.resolve(void 0)};var t=Xn();return function(){return N(e,void 0,void 0,function(){var e,n;return P(this,function(r){switch(r.label){case 0:return[4,t()];case 1:return e=r.sent(),n=function(e){return e===null?null:At(e,Kn)},[2,[n(e[0]),n(e[1]),n(e[2]),n(e[3])]]}})})}}function Qn(){var e=screen;return[I(F(e.availTop),null),I(F(e.width)-F(e.availWidth)-I(F(e.availLeft),0),null),I(F(e.height)-F(e.availHeight)-I(F(e.availTop),0),null),I(F(e.availLeft),null)]}function $n(e){for(var t=0;t<4;++t)if(e[t])return!1;return!0}function er(){return I(kt(navigator.hardwareConcurrency),void 0)}function tr(){var e=window.Intl?.DateTimeFormat;if(e){var t=new e().resolvedOptions().timeZone;if(t)return t}var n=-nr();return`UTC${n>=0?`+`:``}${n}`}function nr(){var e=new Date().getFullYear();return Math.max(F(new Date(e,0,1).getTimezoneOffset()),F(new Date(e,6,1).getTimezoneOffset()))}function rr(){try{return!!window.sessionStorage}catch{return!0}}function ir(){try{return!!window.localStorage}catch{return!0}}function ar(){if(!(Yt()||Xt()))try{return!!window.indexedDB}catch{return!0}}function or(){return!!window.openDatabase}function sr(){return navigator.cpuClass}function cr(){var e=navigator.platform;return e===`MacIntel`&&V()&&!Qt()?on()?`iPad`:`iPhone`:e}function lr(){return navigator.vendor||``}function ur(){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 dr(){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 fr(){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 pr(e){var t=(e===void 0?{}:e).debug;return N(this,void 0,void 0,function(){var e,n,r,i,a,o;return P(this,function(s){switch(s.label){case 0:return mr()?(e=fr(),n=Object.keys(e),r=(o=[]).concat.apply(o,n.map(function(t){return e[t]})),[4,hr(r)]):[2,void 0];case 1:return i=s.sent(),t&&_r(e,i),a=n.filter(function(t){var n=e[t];return L(n.map(function(e){return i[e]}))>n.length*.6}),a.sort(),[2,a]}})})}function mr(){return V()||ln()}function hr(e){var t;return N(this,void 0,void 0,function(){var n,r,i,a,o,s,c,o;return P(this,function(l){switch(l.label){case 0:for(n=document,r=n.createElement(`div`),i=Array(e.length),a={},gr(r),o=0;o<e.length;++o)s=yn(e[o]),s.tagName===`DIALOG`&&s.show(),c=n.createElement(`div`),gr(c),c.appendChild(s),r.appendChild(c),i[o]=s;l.label=1;case 1:return n.body?[3,3]:[4,bt(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 gr(e){e.style.setProperty(`visibility`,`hidden`,`important`),e.style.setProperty(`display`,`block`,`important`)}function _r(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 yr(){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 br(){if(xr(`inverted`))return!0;if(xr(`none`))return!1}function xr(e){return matchMedia(`(inverted-colors: ${e})`).matches}function Sr(){if(Cr(`active`))return!0;if(Cr(`none`))return!1}function Cr(e){return matchMedia(`(forced-colors: ${e})`).matches}var wr=100;function Tr(){if(matchMedia(`(min-monochrome: 0)`).matches){for(var e=0;e<=wr;++e)if(matchMedia(`(max-monochrome: ${e})`).matches)return e;throw Error(`Too high value`)}}function Er(){if(Dr(`no-preference`))return 0;if(Dr(`high`)||Dr(`more`))return 1;if(Dr(`low`)||Dr(`less`))return-1;if(Dr(`forced`))return 10}function Dr(e){return matchMedia(`(prefers-contrast: ${e})`).matches}function Or(){if(kr(`reduce`))return!0;if(kr(`no-preference`))return!1}function kr(e){return matchMedia(`(prefers-reduced-motion: ${e})`).matches}function Ar(){if(jr(`reduce`))return!0;if(jr(`no-preference`))return!1}function jr(e){return matchMedia(`(prefers-reduced-transparency: ${e})`).matches}function Mr(){if(Nr(`high`))return!0;if(Nr(`standard`))return!1}function Nr(e){return matchMedia(`(dynamic-range: ${e})`).matches}var V=Math,H=function(){return 0};function Pr(){var e=V.acos||H,t=V.acosh||H,n=V.asin||H,r=V.asinh||H,i=V.atanh||H,a=V.atan||H,o=V.sin||H,s=V.sinh||H,c=V.cos||H,l=V.cosh||H,u=V.tan||H,d=V.tanh||H,f=V.exp||H,p=V.expm1||H,m=V.log1p||H;return{acos:e(.12312423423423424),acosh:t(1e308),acoshPf:function(e){return V.log(e+V.sqrt(e*e-1))}(1e154),asin:n(.12312423423423424),asinh:r(1),asinhPf:function(e){return V.log(e+V.sqrt(e*e+1))}(1),atanh:i(.5),atanhPf:function(e){return V.log((1+e)/(1-e))/2}(.5),atan:a(.5),sin:o(-1e300),sinh:s(1),sinhPf:function(e){return V.exp(e)-1/V.exp(e)/2}(1),cos:c(10.000000000123),cosh:l(1),coshPf:function(e){return(V.exp(e)+1/V.exp(e))/2}(1),tan:u(-1e300),tanh:d(1),tanhPf:function(e){return(V.exp(2*e)-1)/(V.exp(2*e)+1)}(1),exp:f(1),expm1:p(1),expm1Pf:function(e){return V.exp(e)-1}(1),log1p:m(10),log1pPf:function(e){return V.log(1+e)}(10),powPI:function(e){return V.pow(V.PI,e)}(-100)}}var Fr=`mmMwWLliI0fiflO&1`,Ir={default:[],apple:[{font:`-apple-system-body`}],serif:[{fontFamily:`serif`}],sans:[{fontFamily:`sans-serif`}],mono:[{fontFamily:`monospace`}],min:[{fontSize:`1px`}],system:[{fontFamily:`system-ui`}]};function Lr(){return Rr(function(e,t){for(var n={},r={},i=0,a=Object.keys(Ir);i<a.length;i++){var o=a[i],s=Ir[o],c=s[0],l=c===void 0?{}:c,u=s[1],d=u===void 0?Fr: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(Ir);_<v.length;_++){var o=v[_];r[o]=n[o].getBoundingClientRect().width}return r})}function Rr(e,t){return t===void 0&&(t=4e3),yn(function(n,r){var i=r.document,a=i.body,o=a.style;o.width=`${t}px`,o.webkitTextSizeAdjust=o.textSizeAdjust=`none`,Qt()?a.style.zoom=`${1/r.devicePixelRatio}`:B()&&(a.style.zoom=`reset`);var s=i.createElement(`div`);return s.textContent=yt([],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 zr(){return navigator.pdfViewerEnabled}function Br(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]-=e[0],t[3]}function Vr(){var e=window.ApplePaySession;if(typeof e?.canMakePayments!=`function`)return-1;if(Hr())return-3;try{return+!!e.canMakePayments()}catch(e){return Ur(e)}}var Hr=Sn;function Ur(e){if(e instanceof Error&&e.name===`InvalidAccessError`&&/\bfrom\b.*\binsecure\b/i.test(e.message))return-2;throw e}function Wr(){var e=document.createElement(`a`),t=e.attributionSourceId??e.attributionsourceid;return t===void 0?void 0:String(t)}var Gr=-1,Kr=-2,qr=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]),Jr=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),Yr=[`FRAGMENT_SHADER`,`VERTEX_SHADER`],Xr=[`LOW_FLOAT`,`MEDIUM_FLOAT`,`HIGH_FLOAT`,`LOW_INT`,`MEDIUM_INT`,`HIGH_INT`],Zr=`WEBGL_debug_renderer_info`,Qr=`WEBGL_polygon_mode`;function $r(e){var t=e.cache,n=ti(t);if(!n)return Gr;if(!si(n))return Kr;var r=ai()?null:n.getExtension(Zr);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 ei(e){var t=e.cache,n=ti(t);if(!n)return Gr;if(!si(n))return Kr;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=ri(n),m=0,h=p;m<h.length;m++){var g=h[m],_=n[g];s.push(`${g}=${_}${qr.has(_)?`=${n.getParameter(_)}`:``}`)}if(r)for(var v=0,y=r;v<y.length;v++){var b=y[v];if(!(b===Zr&&ai()||b===Qr&&oi())){var x=n.getExtension(b);if(!x){a.push(b);continue}for(var S=0,C=ri(x);S<C.length;S++){var g=C[S],_=x[g];c.push(`${g}=${_}${Jr.has(_)?`=${n.getParameter(_)}`:``}`)}}}for(var w=0,T=Yr;w<T.length;w++)for(var ee=T[w],te=0,E=Xr;te<E.length;te++){var ne=E[te],re=ni(n,ee,ne);l.push(`${ee}.${ne}=${re.join(`,`)}`)}return c.sort(),s.sort(),{contextAttributes:o,parameters:s,shaderPrecisions:l,extensions:r,extensionParameters:c,unsupportedExtensions:a}}function ti(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 ni(e,t,n){var r=e.getShaderPrecisionFormat(e[t],e[n]);return r?[r.rangeMin,r.rangeMax,r.precision]:[]}function ri(e){return Object.keys(e.__proto__).filter(ii)}function ii(e){return typeof e==`string`&&!e.match(/[^A-Z0-9_x]/)}function ai(){return tn()}function oi(){return Qt()||B()}function si(e){return typeof e.getParameter==`function`}function ci(){if(!(un()||B()))return-2;if(!window.AudioContext)return-1;var e=new AudioContext().baseLatency;return e==null?-1:isFinite(e)?e:-3}function li(){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 ui={fonts:Dn,domBlockers:mr,fontPreferences:Lr,audio:fn,screenFrame:Qn,canvas:kn,osCpu:Bn,languages:Vn,colorDepth:Hn,deviceMemory:Un,screenResolution:Wn,hardwareConcurrency:tr,timezone:nr,sessionStorage:ir,localStorage:ar,indexedDB:or,openDatabase:sr,cpuClass:cr,platform:lr,plugins:On,touchSupport:zn,vendor:ur,vendorFlavors:dr,cookiesEnabled:fr,colorGamut:yr,invertedColors:br,forcedColors:Sr,monochrome:Tr,contrast:Er,reducedMotion:Or,reducedTransparency:Ar,hdr:Mr,math:Pr,pdfViewerEnabled:zr,architecture:Br,applePay:Vr,privateClickMeasurement:Wr,audioBaseLatency:ci,dateTimeLocale:li,webGlBasics:$r,webGlExtensions:ei};function di(e){return Yt(ui,e,[])}var fi=`$ if upgrade to Pro: https://fpjs.dev/pro`;function pi(e){var t=mi(e),n=hi(t);return{score:t,comment:fi.replace(/\$/g,`${n}`)}}function mi(e){if(un())return .4;if(B())return $t()&&!(on()&&en())?.5:.3;var t=`value`in e.platform?e.platform.value:``;return/^Win/.test(t)?.6:/^Mac/.test(t)?.5:.7}function hi(e){return jt(.99+.01*e,1e-4)}function gi(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 _i(e){return JSON.stringify(e,function(e,t){return t instanceof Error?Gt(t):t},2)}function vi(e){return Wt(gi(e))}function yi(e){var t;return{get visitorId(){return t===void 0&&(t=vi(this.components)),t},set visitorId(e){t=e},confidence:pi(e),components:e,version:bt}}function bi(e){return e===void 0&&(e=50),Ct(e,e*2)}function xi(e,t){return{get:function(n){return M(this,void 0,void 0,function(){var r,i;return N(this,function(a){switch(a.label){case 0:return[4,e()];case 1:return r=a.sent(),i=yi(r),t||n?.debug,[2,i]}})})}}}function Si(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var e=new XMLHttpRequest;e.open(`get`,`https://m1.openfpcdn.io/fingerprintjs/v${bt}/npm-monitoring`,!0),e.send()}catch{}}function Ci(e){return e===void 0&&(e={}),M(this,void 0,void 0,function(){var t,n,r;return N(this,function(i){switch(i.label){case 0:return(e.monitoring??!0)&&Si(),t=e.delayFallback,n=e.debug,[4,bi(t)];case 1:return i.sent(),r=di({cache:{},debug:n}),[2,xi(r,n)]}})})}var wi={load:Ci,hashComponents:vi,componentsToDebugString:_i};function Ti(e){return e.preview?`include`:`same-origin`}function Ei(e){return e.sessionToken?{"x-widget-session-token":e.sessionToken}:{}}function Di(e,t){return t.configChannel===`draft`?`${e}${e.includes(`?`)?`&`:`?`}configChannel=draft`:e}var Oi=class{baseUrl;options;sessionToken;sessionTokenExpiresAt;constructor(e,t={}){this.baseUrl=e,this.options=t}get credentials(){return Ti(this.options)}channel(e){return Di(e,this.options)}authHeaders(){return{"Content-Type":`application/json`,...Ei({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*ki(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 vr(){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 yr(){if(br(`inverted`))return!0;if(br(`none`))return!1}function br(e){return matchMedia(`(inverted-colors: ${e})`).matches}function xr(){if(Sr(`active`))return!0;if(Sr(`none`))return!1}function Sr(e){return matchMedia(`(forced-colors: ${e})`).matches}var Cr=100;function wr(){if(matchMedia(`(min-monochrome: 0)`).matches){for(var e=0;e<=Cr;++e)if(matchMedia(`(max-monochrome: ${e})`).matches)return e;throw Error(`Too high value`)}}function Tr(){if(Er(`no-preference`))return 0;if(Er(`high`)||Er(`more`))return 1;if(Er(`low`)||Er(`less`))return-1;if(Er(`forced`))return 10}function Er(e){return matchMedia(`(prefers-contrast: ${e})`).matches}function Dr(){if(Or(`reduce`))return!0;if(Or(`no-preference`))return!1}function Or(e){return matchMedia(`(prefers-reduced-motion: ${e})`).matches}function kr(){if(Ar(`reduce`))return!0;if(Ar(`no-preference`))return!1}function Ar(e){return matchMedia(`(prefers-reduced-transparency: ${e})`).matches}function jr(){if(Mr(`high`))return!0;if(Mr(`standard`))return!1}function Mr(e){return matchMedia(`(dynamic-range: ${e})`).matches}var H=Math,U=function(){return 0};function Nr(){var e=H.acos||U,t=H.acosh||U,n=H.asin||U,r=H.asinh||U,i=H.atanh||U,a=H.atan||U,o=H.sin||U,s=H.sinh||U,c=H.cos||U,l=H.cosh||U,u=H.tan||U,d=H.tanh||U,f=H.exp||U,p=H.expm1||U,m=H.log1p||U;return{acos:e(.12312423423423424),acosh:t(1e308),acoshPf:function(e){return H.log(e+H.sqrt(e*e-1))}(1e154),asin:n(.12312423423423424),asinh:r(1),asinhPf:function(e){return H.log(e+H.sqrt(e*e+1))}(1),atanh:i(.5),atanhPf:function(e){return H.log((1+e)/(1-e))/2}(.5),atan:a(.5),sin:o(-1e300),sinh:s(1),sinhPf:function(e){return H.exp(e)-1/H.exp(e)/2}(1),cos:c(10.000000000123),cosh:l(1),coshPf:function(e){return(H.exp(e)+1/H.exp(e))/2}(1),tan:u(-1e300),tanh:d(1),tanhPf:function(e){return(H.exp(2*e)-1)/(H.exp(2*e)+1)}(1),exp:f(1),expm1:p(1),expm1Pf:function(e){return H.exp(e)-1}(1),log1p:m(10),log1pPf:function(e){return H.log(1+e)}(10),powPI:function(e){return H.pow(H.PI,e)}(-100)}}var Pr=`mmMwWLliI0fiflO&1`,Fr={default:[],apple:[{font:`-apple-system-body`}],serif:[{fontFamily:`serif`}],sans:[{fontFamily:`sans-serif`}],mono:[{fontFamily:`monospace`}],min:[{fontSize:`1px`}],system:[{fontFamily:`system-ui`}]};function Ir(){return Lr(function(e,t){for(var n={},r={},i=0,a=Object.keys(Fr);i<a.length;i++){var o=a[i],s=Fr[o],c=s[0],l=c===void 0?{}:c,u=s[1],d=u===void 0?Pr: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(Fr);_<v.length;_++){var o=v[_];r[o]=n[o].getBoundingClientRect().width}return r})}function Lr(e,t){return t===void 0&&(t=4e3),vn(function(n,r){var i=r.document,a=i.body,o=a.style;o.width=`${t}px`,o.webkitTextSizeAdjust=o.textSizeAdjust=`none`,Zt()?a.style.zoom=`${1/r.devicePixelRatio}`:V()&&(a.style.zoom=`reset`);var s=i.createElement(`div`);return s.textContent=vt([],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 Rr(){return navigator.pdfViewerEnabled}function zr(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]-=e[0],t[3]}function Br(){var e=window.ApplePaySession;if(typeof e?.canMakePayments!=`function`)return-1;if(Vr())return-3;try{return+!!e.canMakePayments()}catch(e){return Hr(e)}}var Vr=xn;function Hr(e){if(e instanceof Error&&e.name===`InvalidAccessError`&&/\bfrom\b.*\binsecure\b/i.test(e.message))return-2;throw e}function Ur(){var e=document.createElement(`a`),t=e.attributionSourceId??e.attributionsourceid;return t===void 0?void 0:String(t)}var Wr=-1,Gr=-2,Kr=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]),qr=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),Jr=[`FRAGMENT_SHADER`,`VERTEX_SHADER`],Yr=[`LOW_FLOAT`,`MEDIUM_FLOAT`,`HIGH_FLOAT`,`LOW_INT`,`MEDIUM_INT`,`HIGH_INT`],Xr=`WEBGL_debug_renderer_info`,Zr=`WEBGL_polygon_mode`;function Qr(e){var t=e.cache,n=ei(t);if(!n)return Wr;if(!oi(n))return Gr;var r=ii()?null:n.getExtension(Xr);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 $r(e){var t=e.cache,n=ei(t);if(!n)return Wr;if(!oi(n))return Gr;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=ni(n),m=0,h=p;m<h.length;m++){var g=h[m],_=n[g];s.push(`${g}=${_}${Kr.has(_)?`=${n.getParameter(_)}`:``}`)}if(r)for(var v=0,y=r;v<y.length;v++){var b=y[v];if(!(b===Xr&&ii()||b===Zr&&ai())){var x=n.getExtension(b);if(!x)a.push(b);else for(var S=0,C=ni(x);S<C.length;S++){var g=C[S],_=x[g];c.push(`${g}=${_}${qr.has(_)?`=${n.getParameter(_)}`:``}`)}}}for(var w=0,T=Jr;w<T.length;w++)for(var E=T[w],ee=0,D=Yr;ee<D.length;ee++){var te=D[ee],ne=ti(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 ei(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 ti(e,t,n){var r=e.getShaderPrecisionFormat(e[t],e[n]);return r?[r.rangeMin,r.rangeMax,r.precision]:[]}function ni(e){return Object.keys(e.__proto__).filter(ri)}function ri(e){return typeof e==`string`&&!e.match(/[^A-Z0-9_x]/)}function ii(){return en()}function ai(){return Zt()||V()}function oi(e){return typeof e.getParameter==`function`}function si(){if(!(ln()||V()))return-2;if(!window.AudioContext)return-1;var e=new AudioContext().baseLatency;return e==null?-1:isFinite(e)?e:-3}function ci(){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 li={fonts:En,domBlockers:pr,fontPreferences:Ir,audio:dn,screenFrame:Zn,canvas:On,osCpu:zn,languages:Bn,colorDepth:Vn,deviceMemory:Hn,screenResolution:Un,hardwareConcurrency:er,timezone:tr,sessionStorage:rr,localStorage:ir,indexedDB:ar,openDatabase:or,cpuClass:sr,platform:cr,plugins:Dn,touchSupport:Rn,vendor:lr,vendorFlavors:ur,cookiesEnabled:dr,colorGamut:vr,invertedColors:yr,forcedColors:xr,monochrome:wr,contrast:Tr,reducedMotion:Dr,reducedTransparency:kr,hdr:jr,math:Nr,pdfViewerEnabled:Rr,architecture:zr,applePay:Br,privateClickMeasurement:Ur,audioBaseLatency:si,dateTimeLocale:ci,webGlBasics:Qr,webGlExtensions:$r};function ui(e){return Jt(li,e,[])}var di=`$ if upgrade to Pro: https://fpjs.dev/pro`;function fi(e){var t=pi(e),n=mi(t);return{score:t,comment:di.replace(/\$/g,`${n}`)}}function pi(e){if(ln())return .4;if(V())return Qt()&&!(an()&&$t())?.5:.3;var t=`value`in e.platform?e.platform.value:``;return/^Win/.test(t)?.6:/^Mac/.test(t)?.5:.7}function mi(e){return At(.99+.01*e,1e-4)}function hi(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 gi(e){return JSON.stringify(e,function(e,t){return t instanceof Error?Wt(t):t},2)}function _i(e){return Ut(hi(e))}function vi(e){var t;return{get visitorId(){return t===void 0&&(t=_i(this.components)),t},set visitorId(e){t=e},confidence:fi(e),components:e,version:yt}}function yi(e){return e===void 0&&(e=50),St(e,e*2)}function bi(e,t){return{get:function(n){return N(this,void 0,void 0,function(){var r,i;return P(this,function(a){switch(a.label){case 0:return[4,e()];case 1:return r=a.sent(),i=vi(r),t||n?.debug,[2,i]}})})}}}function xi(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var e=new XMLHttpRequest;e.open(`get`,`https://m1.openfpcdn.io/fingerprintjs/v${yt}/npm-monitoring`,!0),e.send()}catch{}}function Si(e){return e===void 0&&(e={}),N(this,void 0,void 0,function(){var t,n,r;return P(this,function(i){switch(i.label){case 0:return(e.monitoring??!0)&&xi(),t=e.delayFallback,n=e.debug,[4,yi(t)];case 1:return i.sent(),r=ui({cache:{},debug:n}),[2,bi(r,n)]}})})}var Ci={load:Si,hashComponents:_i,componentsToDebugString:gi};function wi(e){return e.preview?`include`:`same-origin`}function Ti(e){return e.sessionToken?{"x-widget-session-token":e.sessionToken}:{}}function Ei(e,t){return t.configChannel===`draft`?`${e}${e.includes(`?`)?`&`:`?`}configChannel=draft`:e}var Di=class{baseUrl;options;sessionToken;sessionTokenExpiresAt;constructor(e,t={}){this.baseUrl=e,this.options=t}get credentials(){return wi(this.options)}channel(e){return Ei(e,this.options)}authHeaders(){return{"Content-Type":`application/json`,...Ti({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*Oi(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
|
|
6
|
+
`)){let t=e.trim();if(!t.startsWith(`data:`))continue;let n=t.slice(5).trim();n&&(yield n)}}}var ki=12e4;async function Ai(e,t,n,r={}){let i=``,a=!1;try{let o=await fetch(Ei(`${e}/v1/agents/${encodeURIComponent(t.agentId)}/responses:stream`,r),{method:`POST`,credentials:wi(r),headers:{"Content-Type":`application/json`,...Ti(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=
|
|
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=ji(t);r&&(i+=r,n.onDelta(r,i))}catch(e){if(!(e instanceof SyntaxError))throw e}return!1};for await(let e of Oi(o,ki))if(l(e))break;n.onEnd(i)}catch(e){n.onError(e instanceof Error?e:Error(String(e)))}}function ji(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 Mi(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 Ni(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 Pi(e,t,n,r={}){let i=r.maxAttempts??3,a;for(let o=1;o<=i;o++){if(o>1){let e=Mi(o-1,500,4e3);await new Promise(t=>setTimeout(t,e))}try{let a=await Ni(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 Fi=15e3,Ii,Li,Ri,zi,Bi=[];function Vi(){zi||(zi=e=>{if(!Ii||e.source!==Ii.contentWindow||Ri&&e.origin!==Ri)return;let t=e.data;t&&typeof t.type==`string`&&(t.type===`turnstile-token`&&typeof t.token==`string`?Bi.shift()?.resolve(t.token):t.type===`turnstile-error`&&Bi.shift()?.reject(Error(t.message??`Turnstile verification failed`)))},window.addEventListener(`message`,zi))}function Hi(){Ii?.remove(),Ii=void 0,Li=void 0}function Ui(e){if(Ii&&Li)return Li;if(typeof window>`u`||typeof document>`u`)return Promise.reject(Error(`Turnstile requires a browser environment`));Vi(),Ri=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`),Li=new Promise((e,n)=>{let r=setTimeout(()=>{window.removeEventListener(`message`,i),n(Error(`Turnstile challenge page failed to load`))},Fi);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 Hi(),e}),Ii=t,document.body.appendChild(t),Li}async function Wi(e){if(await Ui(e),!Ii?.contentWindow)throw Error(`Turnstile challenge frame unavailable`);let t=Ii.contentWindow,n=Ri;return new Promise((e,r)=>{let i={resolve:t=>{clearTimeout(a),e(t)},reject:e=>{clearTimeout(a),r(e)}},a=setTimeout(()=>{let e=Bi.indexOf(i);e!==-1&&Bi.splice(e,1),r(Error(`Turnstile verification timed out`))},Fi);Bi.push(i),t.postMessage({type:`turnstile-solve`},n)})}var Gi=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()}},Ki=`agentforge`;function qi(e){return`${Ki}:session:${e}`}function Ji(e){try{return sessionStorage.getItem(qi(e))??void 0}catch{return}}function Yi(e,t){try{sessionStorage.setItem(qi(e),t)}catch{}}function Xi(e){try{sessionStorage.removeItem(qi(e))}catch{}}function Zi(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 Qi(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 $i(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 ea=`[Voice note] `;function ta(e,t){let n=t?.trim();return n?`${ea}${e}\n\n${n}`:`${ea}${e}`}function na(e){if(!e.startsWith(`[Voice note] `))return null;let t=e.slice(13),n=t.indexOf(`
|
|
13
13
|
|
|
14
|
-
`);return n===-1?{transcript:t,rest:``}:{transcript:t.slice(0,n),rest:t.slice(n+2)}}function ia(){return`msg-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`}var aa=2e3,oa=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 Oi(e.apiBaseUrl,{preview:e.preview,configChannel:e.configChannel}),this.emitter=new Ki,this.initializeFingerprint();let r=e.sessionId??Yi(e.agentId);e.sessionId&&Xi(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 wi.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=gt(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:ia(),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??ia(),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??ia(),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{}Zi(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(){Zi(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 ca(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:ia(),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 Gi(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,aa)})]).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&&(Xi(this.config.agentId,r.sessionId),this.openEventStream());return}let i={id:ia(),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&&(Xi(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=ia(),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 ji(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}),Xi(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:na(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:sa(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:[...Qi(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:[...Qi(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?$i(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){Fi(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 sa(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 ca(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 la(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 ua(e,t){e.textContent=t}function da(e){e.remove()}function fa(e){document.body?document.body.appendChild(e):document.addEventListener(`DOMContentLoaded`,()=>document.body.appendChild(e),{once:!0})}function pa(){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(`; `),fa(e),e}function ma(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 ha(e){return e.setAttribute(`data-agentkit-root`,`inline`),getComputedStyle(e).position===`static`&&(e.style.position=`relative`),e}function ga(e){e.remove()}function _a(e){e.removeAttribute(`data-agentkit-root`)}function va(e,t,n,r,i){let a=e.mode===`inline`,o=!1,s=a&&i?ha(i):!a&&i?ma(i):pa(),c=la(s);ua(c.styleSlot,r);let l=new oa(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(),da(c.host),a&&i?_a(i):ga(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 ya=new Map,ba=0;function xa(e){let t=`agentkit-widget-${++ba}`,n=e.destroy.bind(e);return e.destroy=()=>{ya.delete(t),n()},ya.set(t,e),t}function Sa(e,t,n){let r={...e,mode:`floating`},i=va(gt(r),r,t,n);return xa(i),i}function Ca(e,t,n,r){let i={...t,mode:`inline`},a=va(gt(i),i,n,r,e);return xa(a),a}function wa(e){e?ya.get(e)?.destroy():(ya.forEach(e=>e.destroy()),ya.clear())}var Ta,U,Ea,Da,Oa,ka,Aa,ja,Ma,Na,Pa,Fa,Ia,La,Ra={},za=[],Ba=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Va=Array.isArray;function W(e,t){for(var n in t)e[n]=t[n];return e}function Ha(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ua(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`?i=t[a]:o[a]=t[a];if(arguments.length>2&&(o.children=arguments.length>3?Ta.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return Wa(e,o,r,i,null)}function Wa(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Ea,__i:-1,__u:0};return i==null&&U.vnode!=null&&U.vnode(a),a}function G(e){return e.children}function K(e,t){this.props=e,this.context=t}function Ga(e,t){if(t==null)return e.__?Ga(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?Ga(e):null}function Ka(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],a=W({},t);a.__v=t.__v+1,U.vnode&&U.vnode(a),io(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??Ga(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,oo(r,a,i),t.__e=t.__=null,a.__e!=n&&qa(a)}}function qa(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),qa(e)}function Ja(e){(!e.__d&&(e.__d=!0)&&Da.push(e)&&!Ya.__r++||Oa!=U.debounceRendering)&&((Oa=U.debounceRendering)||ka)(Ya)}function Ya(){try{for(var e,t=1;Da.length;)Da.length>t&&Da.sort(Aa),e=Da.shift(),t=Da.length,Ka(e)}finally{Da.length=Ya.__r=0}}function Xa(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v=r&&r.__k||za,y=t.length;for(c=Za(n,t,v,c,y),d=0;d<y;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&v[p.__i]||Ra,p.__i=d,g=io(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&lo(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),(_=!!(4&p.__u))||f.__k===p.__k?(c=Qa(p,c,e,_),_&&f.__e&&(f.__e=null)):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function Za(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=Wa(null,o,null,null,null):Va(o)?o=e.__k[a]=Wa(G,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=Wa(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=eo(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=Ga(s)),uo(s,s));return r}function Qa(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=Qa(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Ga(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function $a(e,t){return t||=[],e==null||typeof e==`boolean`||(Va(e)?e.some(function(e){$a(e,t)}):t.push(e)),t}function eo(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function to(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||Ba.test(t)?n:n+`px`}function no(e,t,n,r,i){var a,o;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||to(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||to(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(Pa,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[Na]=r[Na]:(n[Na]=Fa,e.addEventListener(t,a?La:Ia,a)):e.removeEventListener(t,a?La:Ia,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function ro(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Ma]==null)t[Ma]=Fa++;else if(t[Ma]<n[Na])return;return n(U.event?U.event(t):t)}}}function io(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[s=t.__e=n.__e]),(u=U.__b)&&u(t);n:if(typeof T==`function`)try{if(_=t.props,v=T.prototype&&T.prototype.render,y=(u=T.contextType)&&r[u.__c],b=u?y?y.props.value:u.__:r,n.__c?g=(d=t.__c=n.__c).__=d.__E:(v?t.__c=d=new T(_,b):(t.__c=d=new K(_,b),d.constructor=T,d.render=fo),y&&y.sub(d),d.state||={},d.__n=r,f=d.__d=!0,d.__h=[],d._sb=[]),v&&d.__s==null&&(d.__s=d.state),v&&T.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=W({},d.__s)),W(d.__s,T.getDerivedStateFromProps(_,d.__s))),p=d.props,m=d.state,d.__v=t,f)v&&T.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),v&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(v&&T.getDerivedStateFromProps==null&&_!==p&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(_,b),t.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&!1===d.shouldComponentUpdate(_,d.__s,b)){t.__v!=n.__v&&(d.props=_,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),za.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d);break n}d.componentWillUpdate!=null&&d.componentWillUpdate(_,d.__s,b),v&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(p,m,h)})}if(d.context=b,d.props=_,d.__P=e,d.__e=!1,x=U.__r,S=0,v)d.state=d.__s,d.__d=!1,x&&x(t),u=d.render(d.props,d.state,d.context),za.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,x&&x(t),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++S<25);d.state=d.__s,d.getChildContext!=null&&(r=W(W({},r),d.getChildContext())),v&&!f&&d.getSnapshotBeforeUpdate!=null&&(h=d.getSnapshotBeforeUpdate(p,m)),C=u!=null&&u.type===G&&u.key==null?so(u.props.children):u,s=Xa(e,Va(C)?C:[C],t,n,r,i,a,o,s,c,l),d.base=t.__e,t.__u&=-161,d.__h.length&&o.push(d),g&&(d.__E=d.__=null)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__e=s}else{for(w=a.length;w--;)Ha(a[w]);ao(t)}else t.__e=n.__e,t.__k=n.__k,e.then||ao(t);U.__e(e,t,n)}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=co(n.__e,t,n,r,i,a,o,c,l);return(u=U.diffed)&&u(t),128&t.__u?void 0:s}function ao(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ao))}function oo(e,t,n){for(var r=0;r<n.length;r++)lo(n[r],n[++r],n[++r]);U.__c&&U.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){U.__e(e,t.__v)}})}function so(e){return typeof e!=`object`||!e||e.__b>0?e:Va(e)?e.map(so):e.constructor===void 0?W({},e):null}function co(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,m,h,g=n.props||Ra,_=t.props,v=t.type;if(v==`svg`?i=`http://www.w3.org/2000/svg`:v==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(l=0;l<a.length;l++)if((p=a[l])&&`setAttribute`in p==!!v&&(v?p.localName==v:p.nodeType==3)){e=p,a[l]=null;break}}if(e==null){if(v==null)return document.createTextNode(_);e=document.createElementNS(i,v,_.is&&_),s&&=(U.__m&&U.__m(t,a),!1),a=null}if(v==null)g===_||s&&e.data==_||(e.data=_);else{if(a=v==`textarea`&&_.defaultValue!=null?null:a&&Ta.call(e.childNodes),!s&&a!=null)for(g={},l=0;l<e.attributes.length;l++)g[(p=e.attributes[l]).name]=p.value;for(l in g)p=g[l],l==`dangerouslySetInnerHTML`?d=p:l==`children`||l in _||l==`value`&&`defaultValue`in _||l==`checked`&&`defaultChecked`in _||no(e,l,null,p,i);for(l in _)p=_[l],l==`children`?f=p:l==`dangerouslySetInnerHTML`?u=p:l==`value`?m=p:l==`checked`?h=p:s&&typeof p!=`function`||g[l]===p||no(e,l,p,g[l],i);if(u)s||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=``),Xa(t.type==`template`?e.content:e,Va(f)?f:[f],t,n,r,v==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&Ga(n,0),s,c),a!=null)for(l=a.length;l--;)Ha(a[l]);s&&v!=`textarea`||(l=`value`,v==`progress`&&m==null?e.removeAttribute(`value`):m!=null&&(m!==e[l]||v==`progress`&&!m||v==`option`&&m!=g[l])&&no(e,l,m,g[l],i),l=`checked`,h!=null&&h!=e[l]&&no(e,l,h,g[l],i))}return e}function lo(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){U.__e(e,n)}}function uo(e,t,n){var r,i;if(U.unmount&&U.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||lo(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){U.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&uo(r[i],t,n||typeof e.type!=`function`);n||Ha(e.__e),e.__c=e.__=e.__e=void 0}function fo(e,t,n){return this.constructor(e,n)}function po(e,t,n){var r,i,a,o;t==document&&(t=document.documentElement),U.__&&U.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,a=[],o=[],io(t,e=(!r&&n||t).__k=Ua(G,null,[e]),i||Ra,Ra,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?Ta.call(t.childNodes):null,a,!r&&n?n:i?i.__e:t.firstChild,r,o),oo(a,e,o)}Ta=za.slice,U={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},Ea=0,K.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=W({},this.state);typeof e==`function`&&(e=e(W({},n),this.props)),e&&W(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ja(this))},K.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ja(this))},K.prototype.render=G,Da=[],ka=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Aa=function(e,t){return e.__v.__b-t.__v.__b},Ya.__r=0,ja=Math.random().toString(8),Ma=`__d`+ja,Na=`__a`+ja,Pa=/(PointerCapture)$|Capture$/i,Fa=0,Ia=ro(!1),La=ro(!0);var mo,q,ho,go,_o=0,vo=[],J=U,yo=J.__b,bo=J.__r,xo=J.diffed,So=J.__c,Co=J.unmount,wo=J.__;function To(e,t){J.__h&&J.__h(q,e,_o||t),_o=0;var n=q.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Y(e){return _o=1,Eo(Fo,e)}function Eo(e,t,n){var r=To(mo++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Fo(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=q,!q.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.some(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a&&a.call(this,e,t,n)||o};q.__f=!0;var a=q.shouldComponentUpdate,o=q.componentWillUpdate;q.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},q.shouldComponentUpdate=i}return r.__N||r.__}function X(e,t){var n=To(mo++,3);!J.__s&&Po(n.__H,t)&&(n.__=e,n.u=t,q.__H.__h.push(n))}function Z(e){return _o=5,Do(function(){return{current:e}},[])}function Do(e,t){var n=To(mo++,7);return Po(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Oo(e,t){return _o=8,Do(function(){return e},t)}function ko(){for(var e;e=vo.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Mo),t.__h.some(No),t.__h=[]}catch(n){t.__h=[],J.__e(n,e.__v)}}}J.__b=function(e){q=null,yo&&yo(e)},J.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),wo&&wo(e,t)},J.__r=function(e){bo&&bo(e),mo=0;var t=(q=e.__c).__H;t&&(ho===q?(t.__h=[],q.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(Mo),t.__h.some(No),t.__h=[],mo=0)),ho=q},J.diffed=function(e){xo&&xo(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(vo.push(t)!==1&&go===J.requestAnimationFrame||((go=J.requestAnimationFrame)||jo)(ko)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),ho=q=null},J.__c=function(e,t){t.some(function(e){try{e.__h.some(Mo),e.__h=e.__h.filter(function(e){return!e.__||No(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],J.__e(n,e.__v)}}),So&&So(e,t)},J.unmount=function(e){Co&&Co(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{Mo(e)}catch(e){t=e}}),n.__H=void 0,t&&J.__e(t,n.__v))};var Ao=typeof requestAnimationFrame==`function`;function jo(e){var t,n=function(){clearTimeout(r),Ao&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ao&&(t=requestAnimationFrame(n))}function Mo(e){var t=q,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),q=t}function No(e){var t=q;e.__c=e.__(),q=t}function Po(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Fo(e,t){return typeof t==`function`?t(e):t}function Io(e,t){for(var n in t)e[n]=t[n];return e}function Lo(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function Ro(e,t){this.props=e,this.context=t}(Ro.prototype=new K).isPureReactComponent=!0,Ro.prototype.shouldComponentUpdate=function(e,t){return Lo(this.props,e)||Lo(this.state,t)};var zo=U.__b;U.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),zo&&zo(e)},typeof Symbol<`u`&&Symbol.for;var Bo=U.__e;U.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k),i.__c(e,t)}Bo(e,t,n,r)};var Vo=U.unmount;function Ho(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=Io({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return Ho(e,t,n)})),e}function Uo(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return Uo(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Wo(){this.__u=0,this.o=null,this.__b=null}function Go(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Ko(){this.i=null,this.l=null}U.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Vo&&Vo(e)},(Wo.prototype=new K).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=Go(r.__v),a=!1,o=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=o;var s=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=Uo(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=s,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},Wo.prototype.componentWillUnmount=function(){this.o=[]},Wo.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),r=this.__v.__k[0].__c;this.__v.__k[0]=Ho(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&Ua(G,null,e.fallback);return i&&(i.__u&=-33),[Ua(G,null,t.__a?null:e.children),i]};var qo=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(Ko.prototype=new K).__a=function(e){var t=this,n=Go(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),qo(t,e,r)):i()};n?n(a):a()}},Ko.prototype.render=function(e){this.i=null,this.l=new Map;var t=$a(e.children);e.revealOrder&&e.revealOrder[0]===`b`&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Ko.prototype.componentDidUpdate=Ko.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){qo(e,n,t)})};var Jo=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,Yo=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Xo=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Zo=/[A-Z0-9]/g,Qo=typeof document<`u`,$o=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};function es(e,t,n){return t.__k??(t.textContent=``),po(e,t),typeof n==`function`&&n(),e?e.__c:null}K.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(K.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var ts=U.event;U.event=function(e){return ts&&(e=ts(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var ns={configurable:!0,get:function(){return this.class}},rs=U.vnode;U.vnode=function(e){typeof e.type==`string`&&function(e){var t=e.props,n=e.type,r={},i=n.indexOf(`-`)==-1;for(var a in t){var o=t[a];if(!(a===`value`&&`defaultValue`in t&&o==null||Qo&&a===`children`&&n===`noscript`||a===`class`||a===`className`)){var s=a.toLowerCase();a===`defaultValue`&&`value`in t&&t.value==null?a=`value`:a===`download`&&!0===o?o=``:s===`translate`&&o===`no`?o=!1:s[0]===`o`&&s[1]===`n`?s===`ondoubleclick`?a=`ondblclick`:s!==`onchange`||n!==`input`&&n!==`textarea`||$o(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:Xo.test(a)&&(a=s):s=a=`oninput`:i&&Yo.test(a)?a=a.replace(Zo,`-$&`).toLowerCase():o===null&&(o=void 0),s===`oninput`&&r[a=s]&&(a=`oninputCapture`),r[a]=o}}n==`select`&&(r.multiple&&Array.isArray(r.value)&&(r.value=$a(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),r.defaultValue!=null&&(r.value=$a(t.children).forEach(function(e){e.props.selected=r.multiple?r.defaultValue.indexOf(e.props.value)!=-1:r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",ns)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=Jo,rs&&rs(e)};var is=U.__r;U.__r=function(e){is&&is(e),e.__c};var as=U.diffed;U.diffed=function(e){as&&as(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value)};function os(e){return!!e.__k&&(po(null,e),!0)}function ss(e){return{render:function(t){es(t,e)},unmount:function(){os(e)}}}function cs(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 ls(e){return e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e}var us=`
|
|
14
|
+
`);return n===-1?{transcript:t,rest:``}:{transcript:t.slice(0,n),rest:t.slice(n+2)}}function ra(){return`msg-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`}var ia=2e3,aa=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 Di(e.apiBaseUrl,{preview:e.preview,configChannel:e.configChannel}),this.emitter=new Gi,this.initializeFingerprint();let r=e.sessionId??Ji(e.agentId);e.sessionId&&Yi(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 Ci.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=ht(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:ra(),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??ra(),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??ra(),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{}Xi(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(){Xi(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 sa(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:ra(),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 Wi(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,ia)})]).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&&(Yi(this.config.agentId,r.sessionId),this.openEventStream());return}let i={id:ra(),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&&(Yi(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=ra(),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 Ai(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}),Yi(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:ta(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:oa(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:[...Zi(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:[...Zi(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?Qi(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?Pi(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 oa(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 sa(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 ca(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 la(e,t){e.textContent=t}function ua(e){e.remove()}function da(e){document.body?document.body.appendChild(e):document.addEventListener(`DOMContentLoaded`,()=>document.body.appendChild(e),{once:!0})}function fa(){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`,da(e),e}function pa(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 ma(e){return e.setAttribute(`data-agentkit-root`,`inline`),getComputedStyle(e).position===`static`&&(e.style.position=`relative`),e}function ha(e){e.remove()}function ga(e){e.removeAttribute(`data-agentkit-root`)}function _a(e,t,n,r,i){let a=e.mode===`inline`,o=!1,s=a&&i?ma(i):!a&&i?pa(i):fa(),c=ca(s);la(c.styleSlot,r);let l=new aa(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(),ua(c.host),a&&i?ga(i):ha(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 va=new Map,ya=0;function ba(e){let t=`agentkit-widget-${++ya}`,n=e.destroy.bind(e);return e.destroy=()=>{va.delete(t),n()},va.set(t,e),t}function xa(e,t,n){let r={...e,mode:`floating`},i=_a(ht(r),r,t,n);return ba(i),i}function Sa(e,t,n,r){let i={...t,mode:`inline`},a=_a(ht(i),i,n,r,e);return ba(a),a}function Ca(e){e?va.get(e)?.destroy():(va.forEach(e=>e.destroy()),va.clear())}var wa,W,Ta,Ea,Da,Oa,ka,Aa,ja,Ma,Na,Pa,Fa,Ia,La={},Ra=[],za=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ba=Array.isArray;function G(e,t){for(var n in t)e[n]=t[n];return e}function Va(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ha(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`?i=t[a]:o[a]=t[a];if(arguments.length>2&&(o.children=arguments.length>3?wa.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return Ua(e,o,r,i,null)}function Ua(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Ta,__i:-1,__u:0};return i==null&&W.vnode!=null&&W.vnode(a),a}function K(e){return e.children}function Wa(e,t){this.props=e,this.context=t}function Ga(e,t){if(t==null)return e.__?Ga(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?Ga(e):null}function Ka(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],a=G({},t);a.__v=t.__v+1,W.vnode&&W.vnode(a),io(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??Ga(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,oo(r,a,i),t.__e=t.__=null,a.__e!=n&&qa(a)}}function qa(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),qa(e)}function Ja(e){(!e.__d&&(e.__d=!0)&&Ea.push(e)&&!Ya.__r++||Da!=W.debounceRendering)&&((Da=W.debounceRendering)||Oa)(Ya)}function Ya(){try{for(var e,t=1;Ea.length;)Ea.length>t&&Ea.sort(ka),e=Ea.shift(),t=Ea.length,Ka(e)}finally{Ea.length=Ya.__r=0}}function Xa(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v=r&&r.__k||Ra,y=t.length;for(c=Za(n,t,v,c,y),d=0;d<y;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&v[p.__i]||La,p.__i=d,g=io(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&lo(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),(_=!!(4&p.__u))||f.__k===p.__k?(c=Qa(p,c,e,_),_&&f.__e&&(f.__e=null)):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function Za(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=Ua(null,o,null,null,null):Ba(o)?o=e.__k[a]=Ua(K,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=Ua(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=eo(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=Ga(s)),uo(s,s));return r}function Qa(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=Qa(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Ga(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function $a(e,t){return t||=[],e==null||typeof e==`boolean`||(Ba(e)?e.some(function(e){$a(e,t)}):t.push(e)),t}function eo(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function to(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||za.test(t)?n:n+`px`}function no(e,t,n,r,i){var a,o;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||to(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||to(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(Na,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[Ma]=r[Ma]:(n[Ma]=Pa,e.addEventListener(t,a?Ia:Fa,a)):e.removeEventListener(t,a?Ia:Fa,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function ro(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[ja]==null)t[ja]=Pa++;else if(t[ja]<n[Ma])return;return n(W.event?W.event(t):t)}}}function io(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[s=t.__e=n.__e]),(u=W.__b)&&u(t);n:if(typeof E==`function`){d=o.length;try{if(v=t.props,y=E.prototype&&E.prototype.render,b=(u=E.contextType)&&r[u.__c],x=u?b?b.props.value:u.__:r,n.__c?_=(f=t.__c=n.__c).__=f.__E:(y?t.__c=f=new E(v,x):(t.__c=f=new Wa(v,x),f.constructor=E,f.render=fo),b&&b.sub(f),f.state||(f.state={}),f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&E.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=G({},f.__s)),G(f.__s,E.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&E.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&E.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)){t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),Ra.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__e=!1,S=W.__r,C=0,y)f.state=f.__s,f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),Ra.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++C<25);f.state=f.__s,f.getChildContext!=null&&(r=G(G({},r),f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),w=u!=null&&u.type===K&&u.key==null?so(u.props.children):u,s=Xa(e,Ba(w)?w:[w],t,n,r,i,a,o,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__E=f.__=null)}catch(e){if(o.length=d,t.__v=null,c||a!=null){if(e.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a!=null&&(a[a.indexOf(s)]=null),t.__e=s}else if(a!=null)for(T=a.length;T--;)Va(a[T])}else t.__e=n.__e;t.__k??=n.__k||[],e.then||ao(t),W.__e(e,t,n)}}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=co(n.__e,t,n,r,i,a,o,c,l);return(u=W.diffed)&&u(t),128&t.__u?void 0:s}function ao(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ao))}function oo(e,t,n){for(var r=0;r<n.length;r++)lo(n[r],n[++r],n[++r]);W.__c&&W.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){W.__e(e,t.__v)}})}function so(e){return typeof e!=`object`||!e||e.__b>0?e:Ba(e)?e.map(so):e.constructor===void 0?G({},e):null}function co(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,m,h,g=n.props||La,_=t.props,v=t.type;if(v==`svg`?i=`http://www.w3.org/2000/svg`:v==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(l=0;l<a.length;l++)if((p=a[l])&&`setAttribute`in p==!!v&&(v?p.localName==v:p.nodeType==3)){e=p,a[l]=null;break}}if(e==null){if(v==null)return document.createTextNode(_);e=document.createElementNS(i,v,_.is&&_),s&&=(W.__m&&W.__m(t,a),!1),a=null}if(v==null)g===_||s&&e.data==_||(e.data=_);else{if(a=v==`textarea`&&_.defaultValue!=null?null:a&&wa.call(e.childNodes),!s&&a!=null)for(g={},l=0;l<e.attributes.length;l++)g[(p=e.attributes[l]).name]=p.value;for(l in g)p=g[l],l==`dangerouslySetInnerHTML`?d=p:l==`children`||l in _||l==`value`&&`defaultValue`in _||l==`checked`&&`defaultChecked`in _||no(e,l,null,p,i);for(l in _)p=_[l],l==`children`?f=p:l==`dangerouslySetInnerHTML`?u=p:l==`value`?m=p:l==`checked`?h=p:s&&typeof p!=`function`||g[l]===p||no(e,l,p,g[l],i);if(u)s||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=``),Xa(t.type==`template`?e.content:e,Ba(f)?f:[f],t,n,r,v==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&Ga(n,0),s,c),a!=null)for(l=a.length;l--;)Va(a[l]);s&&v!=`textarea`||(l=`value`,v==`progress`&&m==null?e.removeAttribute(`value`):m!=null&&(m!==e[l]||v==`progress`&&!m||v==`option`&&m!=g[l])&&no(e,l,m,g[l],i),l=`checked`,h!=null&&h!=e[l]&&no(e,l,h,g[l],i))}return e}function lo(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){W.__e(e,n)}}function uo(e,t,n){var r,i;if(W.unmount&&W.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||lo(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){W.__e(e,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&uo(r[i],t,n||typeof e.type!=`function`);n||Va(e.__e),e.__c=e.__=e.__e=void 0}function fo(e,t,n){return this.constructor(e,n)}function po(e,t,n){var r,i,a,o;t==document&&(t=document.documentElement),W.__&&W.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,a=[],o=[],io(t,e=(!r&&n||t).__k=Ha(K,null,[e]),i||La,La,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?wa.call(t.childNodes):null,a,!r&&n?n:i?i.__e:t.firstChild,r,o),oo(a,e,o),e.props.children=null}wa=Ra.slice,W={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},Ta=0,Wa.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=G({},this.state);typeof e==`function`&&(e=e(G({},n),this.props)),e&&G(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ja(this))},Wa.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ja(this))},Wa.prototype.render=K,Ea=[],Oa=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ka=function(e,t){return e.__v.__b-t.__v.__b},Ya.__r=0,Aa=Math.random().toString(8),ja=`__d`+Aa,Ma=`__a`+Aa,Na=/(PointerCapture)$|Capture$/i,Pa=0,Fa=ro(!1),Ia=ro(!0);var mo,q,ho,go,_o=0,vo=[],J=W,yo=J.__b,bo=J.__r,xo=J.diffed,So=J.__c,Co=J.unmount,wo=J.__;function To(e,t){J.__h&&J.__h(q,e,_o||t),_o=0;var n=q.__H||(q.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Y(e){return _o=1,Eo(Fo,e)}function Eo(e,t,n){var r=To(mo++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Fo(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=q,!q.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=!1,o=r.__c.props!==e;if(r.__c.__H.__.some(function(e){if(e.__N){i=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a){var s=a.call(this,e,t,n);return i?s||o:s}return!i||o};q.__f=!0;var a=q.shouldComponentUpdate,o=q.componentWillUpdate;q.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},q.shouldComponentUpdate=i}return r.__N||r.__}function X(e,t){var n=To(mo++,3);!J.__s&&Po(n.__H,t)&&(n.__=e,n.u=t,q.__H.__h.push(n))}function Z(e){return _o=5,Do(function(){return{current:e}},[])}function Do(e,t){var n=To(mo++,7);return Po(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Oo(e,t){return _o=8,Do(function(){return e},t)}function ko(){for(var e;e=vo.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Mo),t.__h.some(No),t.__h=[]}catch(n){t.__h=[],J.__e(n,e.__v)}}}J.__b=function(e){q=null,yo&&yo(e)},J.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),wo&&wo(e,t)},J.__r=function(e){bo&&bo(e),mo=0;var t=(q=e.__c).__H;t&&(ho===q?(t.__h=[],q.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(Mo),t.__h.some(No),t.__h=[],mo=0)),ho=q},J.diffed=function(e){xo&&xo(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(vo.push(t)!==1&&go===J.requestAnimationFrame||((go=J.requestAnimationFrame)||jo)(ko)),t.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),ho=q=null},J.__c=function(e,t){t.some(function(e){try{e.__h.some(Mo),e.__h=e.__h.filter(function(e){return!e.__||No(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],J.__e(n,e.__v)}}),So&&So(e,t)},J.unmount=function(e){Co&&Co(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{Mo(e)}catch(e){t=e}}),n.__H=void 0,t&&J.__e(t,n.__v))};var Ao=typeof requestAnimationFrame==`function`;function jo(e){var t,n=function(){clearTimeout(r),Ao&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ao&&(t=requestAnimationFrame(n))}function Mo(e){var t=q,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),q=t}function No(e){var t=q;e.__c=e.__(),q=t}function Po(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Fo(e,t){return typeof t==`function`?t(e):t}function Io(e,t){for(var n in t)e[n]=t[n];return e}function Lo(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function Ro(e,t){this.props=e,this.context=t}(Ro.prototype=new Wa).isPureReactComponent=!0,Ro.prototype.shouldComponentUpdate=function(e,t){return Lo(this.props,e)||Lo(this.state,t)};var zo=W.__b;W.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),zo&&zo(e)},typeof Symbol<`u`&&Symbol.for;var Bo=W.__e;W.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k||[]),i.__c(e,t)}Bo(e,t,n,r)};var Vo=W.unmount;function Ho(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=Io({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return Ho(e,t,n)})),e}function Uo(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return Uo(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Wo(){this.__u=0,this.o=null,this.__b=null}function Go(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Ko(){this.i=null,this.l=null}W.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Vo&&Vo(e)},(Wo.prototype=new Wa).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=Go(r.__v),a=!1,o=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=o;var s=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=Uo(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=s,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},Wo.prototype.componentWillUnmount=function(){this.o=[]},Wo.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),r=this.__v.__k[0].__c;this.__v.__k[0]=Ho(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&Ha(K,null,e.fallback);return i&&(i.__u&=-33),[Ha(K,null,t.__a?null:e.children),i]};var qo=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(Ko.prototype=new Wa).__a=function(e){var t=this,n=Go(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),qo(t,e,r)):i()};n?n(a):a()}},Ko.prototype.render=function(e){this.i=null,this.l=new Map;var t=$a(e.children);e.revealOrder&&e.revealOrder[0]===`b`&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Ko.prototype.componentDidUpdate=Ko.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){qo(e,n,t)})};var Jo=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,Yo=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Xo=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Zo=/[A-Z0-9]/g,Qo=typeof document<`u`,$o=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};function es(e,t,n){return t.__k??(t.textContent=``),po(e,t),typeof n==`function`&&n(),e?e.__c:null}Wa.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(Wa.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var ts=W.event;W.event=function(e){return ts&&(e=ts(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var ns={configurable:!0,get:function(){return this.class}},rs=W.vnode;W.vnode=function(e){typeof e.type==`string`&&function(e){var t=e.props,n=e.type,r={},i=n.indexOf(`-`)==-1;for(var a in t){var o=t[a];if(!(a===`value`&&`defaultValue`in t&&o==null||Qo&&a===`children`&&n===`noscript`||a===`class`||a===`className`)){var s=a.toLowerCase();a===`defaultValue`&&`value`in t&&t.value==null?a=`value`:a===`download`&&!0===o?o=``:s===`translate`&&o===`no`?o=!1:s[0]===`o`&&s[1]===`n`?s===`ondoubleclick`?a=`ondblclick`:s!==`onchange`||n!==`input`&&n!==`textarea`||$o(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:Xo.test(a)&&(a=s):s=a=`oninput`:i&&Yo.test(a)?a=a.replace(Zo,`-$&`).toLowerCase():o===null&&(o=void 0),s===`oninput`&&r[a=s]&&(a=`oninputCapture`),r[a]=o}}n==`select`&&(r.multiple&&Array.isArray(r.value)&&(r.value=$a(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),r.defaultValue!=null&&(r.value=$a(t.children).forEach(function(e){e.props.selected=r.multiple?r.defaultValue.indexOf(e.props.value)!=-1:r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",ns)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=Jo,rs&&rs(e)};var is=W.__r;W.__r=function(e){is&&is(e),e.__c};var as=W.diffed;W.diffed=function(e){as&&as(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value)};function os(e){return!!e.__k&&(po(null,e),!0)}function ss(e){return{render:function(t){es(t,e)},unmount:function(){os(e)}}}function cs(e){let{theme:t}=e,n=[`--ak-accent: ${t.accentColor}`,`--ak-font: ${t.fontFamily}`,`--ak-radius: ${t.borderRadius}`];n.push(`--ak-accent-hover: color-mix(in srgb, ${t.accentColor} 85%, black)`);let r=ms(t.accentColor);return n.push(`--ak-on-accent: ${r}`,`--ak-user-text: ${r}`),`:host { ${n.join(`; `)} }`}function ls(e){return e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e}var us=`#ffffff`,ds=`#111827`;function fs(e){let t=e.trim().toLowerCase(),n=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.exec(t);if(n){let e=n[1];return e.length<=4?[0,1,2].map(t=>parseInt(e[t]+e[t],16)):[0,2,4].map(t=>parseInt(e.slice(t,t+2),16))}let r=/^rgba?\(\s*(\d+(?:\.\d+)?)[\s,]+(\d+(?:\.\d+)?)[\s,]+(\d+(?:\.\d+)?)/.exec(t);return r?[Number(r[1]),Number(r[2]),Number(r[3])].map(e=>Math.min(255,e)):null}function ps([e,t,n]){let r=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(e)+.7152*r(t)+.0722*r(n)}function ms(e){let t=fs(e);if(!t)return us;let n=ps(t),r=ps(fs(ds)),i=1.05/(n+.05);return(n+.05)/(r+.05)>i?ds:us}var hs=`
|
|
15
15
|
*, *::before, *::after {
|
|
16
16
|
box-sizing: border-box;
|
|
17
17
|
margin: 0;
|
|
@@ -19,27 +19,36 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
:host {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
--ak-
|
|
26
|
-
--ak-
|
|
27
|
-
--ak-
|
|
28
|
-
--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 */
|
|
29
34
|
--ak-user-bg: var(--ak-accent);
|
|
30
|
-
--ak-
|
|
31
|
-
--ak-
|
|
32
|
-
--ak-bot-
|
|
33
|
-
--ak-
|
|
34
|
-
--ak-
|
|
35
|
-
--ak-
|
|
35
|
+
--ak-on-accent: #ffffff; /* text/icons on the accent; tokens.ts picks white or ink per tenant accent */
|
|
36
|
+
--ak-user-text: var(--ak-on-accent);
|
|
37
|
+
--ak-bot-bg: #eef0f4; /* --surface-muted */
|
|
38
|
+
--ak-bot-text: #0e1220; /* --fg */
|
|
39
|
+
--ak-success: #0a9466; /* --success */
|
|
40
|
+
--ak-warning: #d98a0b; /* --warning */
|
|
41
|
+
--ak-warning-fg: #8a4b06; /* --warning-fg */
|
|
42
|
+
--ak-warning-soft: #fdf3e2; /* --warning-soft */
|
|
43
|
+
--ak-danger: #c4302b; /* --danger */
|
|
44
|
+
--ak-danger-fg: #b4232b; /* --danger-fg */
|
|
45
|
+
--ak-danger-soft: #fdeced; /* --danger-soft */
|
|
46
|
+
--ak-danger-border: color-mix(in srgb, var(--ak-danger) 35%, transparent);
|
|
47
|
+
--ak-maintenance-fg: var(--ak-warning-fg);
|
|
48
|
+
--ak-maintenance-bg: var(--ak-warning-soft);
|
|
49
|
+
--ak-maintenance-halo: var(--ak-warning);
|
|
36
50
|
--ak-font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
37
51
|
--ak-radius: 12px;
|
|
38
|
-
/* Chat surface texture — scattered line doodles, tiled. Neutral stroke (not accent-tinted)
|
|
39
|
-
so it stays a texture rather than competing with brand colour. Alpha is baked into the
|
|
40
|
-
SVG stroke, so the light/dark variants differ only in stroke rgba. */
|
|
41
|
-
--ak-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' fill='none' stroke='rgba(0,0,0,0.045)' 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");
|
|
42
|
-
--ak-pattern-size: 210px;
|
|
43
52
|
--ak-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 8px 24px rgba(0, 0, 0, 0.08);
|
|
44
53
|
--ak-launcher-size: 56px;
|
|
45
54
|
/* Panel-to-launcher offset. Negative pulls the launcher up toward the panel.
|
|
@@ -50,21 +59,25 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
50
59
|
}
|
|
51
60
|
|
|
52
61
|
/* Dark mode — set data-theme="dark" on the shadow host element.
|
|
53
|
-
|
|
62
|
+
Values from tokens.css .dark (see the :host note above). */
|
|
54
63
|
:host([data-theme="dark"]) {
|
|
55
|
-
--ak-bg: #
|
|
56
|
-
--ak-surface: #
|
|
57
|
-
--ak-text: #
|
|
58
|
-
--ak-text-muted: #
|
|
59
|
-
--ak-border: #
|
|
60
|
-
--ak-
|
|
61
|
-
--ak-
|
|
62
|
-
/*
|
|
63
|
-
--ak-
|
|
64
|
+
--ak-bg: #111521; /* --surface — panel */
|
|
65
|
+
--ak-surface: #171c2a; /* --surface-raised — inputs, insets lift off the panel */
|
|
66
|
+
--ak-text: #eef0f6; /* --fg */
|
|
67
|
+
--ak-text-muted: #a3acbd; /* --fg-muted */
|
|
68
|
+
--ak-border: #232a3a; /* --border */
|
|
69
|
+
--ak-border-strong: #5f687c; /* --border-strong */
|
|
70
|
+
--ak-hover: rgb(255 255 255 / 0.05); /* --hover */
|
|
71
|
+
--ak-bot-bg: #20263a; /* --surface-muted — assistant bubble */
|
|
72
|
+
--ak-bot-text: #eef0f6; /* --fg */
|
|
73
|
+
--ak-success: #2fbf87;
|
|
74
|
+
--ak-warning: #e5a43a;
|
|
75
|
+
--ak-warning-fg: #f2bd5c;
|
|
76
|
+
--ak-warning-soft: #2c2110;
|
|
77
|
+
--ak-danger: #d93a3f;
|
|
78
|
+
--ak-danger-fg: #ff8a8f;
|
|
79
|
+
--ak-danger-soft: #331417;
|
|
64
80
|
--ak-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.4);
|
|
65
|
-
--ak-maintenance-fg: #fde68a;
|
|
66
|
-
--ak-maintenance-bg: rgba(253, 230, 138, 0.06);
|
|
67
|
-
--ak-maintenance-halo: #f59e0b;
|
|
68
81
|
}
|
|
69
82
|
|
|
70
83
|
/* ── Floating layout ─────────────────────────────────────────── */
|
|
@@ -91,34 +104,70 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
91
104
|
}
|
|
92
105
|
|
|
93
106
|
/* ── Launcher button ─────────────────────────────────────────── */
|
|
107
|
+
/* Closed with a label it is a pill: face (or chat icon) + short text. Open, or with an
|
|
108
|
+
empty label, it is a round button. */
|
|
94
109
|
.ak-launcher {
|
|
95
|
-
width: var(--ak-launcher-size);
|
|
110
|
+
min-width: var(--ak-launcher-size);
|
|
96
111
|
height: var(--ak-launcher-size);
|
|
97
|
-
border-radius:
|
|
112
|
+
border-radius: 999px;
|
|
98
113
|
background: var(--ak-accent);
|
|
99
114
|
border: none;
|
|
100
115
|
cursor: pointer;
|
|
101
116
|
display: flex;
|
|
102
117
|
align-items: center;
|
|
103
118
|
justify-content: center;
|
|
104
|
-
|
|
105
|
-
|
|
119
|
+
gap: 10px;
|
|
120
|
+
color: var(--ak-on-accent);
|
|
121
|
+
font-family: var(--ak-font);
|
|
122
|
+
box-shadow: 0 6px 20px color-mix(in srgb, var(--ak-accent) 35%, transparent);
|
|
106
123
|
transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
|
|
107
124
|
flex-shrink: 0;
|
|
108
125
|
}
|
|
109
126
|
.ak-launcher:hover {
|
|
110
127
|
background: var(--ak-accent-hover);
|
|
111
|
-
transform:
|
|
112
|
-
box-shadow: 0
|
|
128
|
+
transform: translateY(-1px);
|
|
129
|
+
box-shadow: 0 8px 26px color-mix(in srgb, var(--ak-accent) 45%, transparent);
|
|
113
130
|
}
|
|
114
131
|
.ak-launcher:active {
|
|
115
|
-
transform: scale(0.
|
|
132
|
+
transform: scale(0.97);
|
|
133
|
+
}
|
|
134
|
+
.ak-launcher:focus-visible {
|
|
135
|
+
outline: 2px solid var(--ak-accent);
|
|
136
|
+
outline-offset: 3px;
|
|
116
137
|
}
|
|
117
138
|
.ak-launcher svg {
|
|
118
139
|
pointer-events: none;
|
|
119
140
|
}
|
|
141
|
+
.ak-launcher--pill {
|
|
142
|
+
padding: 0 22px 0 6px;
|
|
143
|
+
}
|
|
144
|
+
.ak-launcher__icon {
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
justify-content: center;
|
|
148
|
+
width: calc(var(--ak-launcher-size) - 12px);
|
|
149
|
+
height: calc(var(--ak-launcher-size) - 12px);
|
|
150
|
+
border-radius: 50%;
|
|
151
|
+
}
|
|
152
|
+
.ak-launcher--pill .ak-launcher__icon {
|
|
153
|
+
background: color-mix(in srgb, var(--ak-on-accent) 18%, transparent);
|
|
154
|
+
}
|
|
155
|
+
.ak-launcher--pill .ak-launcher__icon svg {
|
|
156
|
+
width: 20px;
|
|
157
|
+
height: 20px;
|
|
158
|
+
}
|
|
159
|
+
.ak-launcher__label {
|
|
160
|
+
font-size: 15px;
|
|
161
|
+
font-weight: 600;
|
|
162
|
+
letter-spacing: -0.01em;
|
|
163
|
+
white-space: nowrap;
|
|
164
|
+
/* A 40-char label is ~340px; keep the pill inside a narrow phone viewport. */
|
|
165
|
+
max-width: calc(100vw - 120px);
|
|
166
|
+
overflow: hidden;
|
|
167
|
+
text-overflow: ellipsis;
|
|
168
|
+
}
|
|
120
169
|
/* Launcher showing avatar image instead of chat icon */
|
|
121
|
-
.ak-launcher--avatar {
|
|
170
|
+
.ak-launcher--avatar:not(.ak-launcher--pill) {
|
|
122
171
|
padding: 0;
|
|
123
172
|
overflow: hidden;
|
|
124
173
|
}
|
|
@@ -129,6 +178,12 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
129
178
|
border-radius: 50%;
|
|
130
179
|
pointer-events: none;
|
|
131
180
|
}
|
|
181
|
+
.ak-launcher--pill .ak-launcher__avatar-img {
|
|
182
|
+
width: calc(var(--ak-launcher-size) - 12px);
|
|
183
|
+
height: calc(var(--ak-launcher-size) - 12px);
|
|
184
|
+
border: 2px solid rgba(255, 255, 255, 0.85);
|
|
185
|
+
flex-shrink: 0;
|
|
186
|
+
}
|
|
132
187
|
|
|
133
188
|
/* ── Shell wrapper (positions the hanging branding tab) ─────── */
|
|
134
189
|
.ak-shell-wrap {
|
|
@@ -183,113 +238,146 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
183
238
|
}
|
|
184
239
|
|
|
185
240
|
/* ── Header ──────────────────────────────────────────────────── */
|
|
241
|
+
/* A tinted greeting card: the agent's face, name and subtitle on a soft wash of the accent.
|
|
242
|
+
Before the first message it is large; .ak-header--compact shrinks it to one row. */
|
|
186
243
|
.ak-header {
|
|
187
244
|
display: flex;
|
|
188
|
-
flex-direction: row;
|
|
189
|
-
align-items: center;
|
|
190
|
-
justify-content: space-between;
|
|
191
|
-
padding: 10px 14px;
|
|
192
|
-
background: var(--ak-accent);
|
|
193
|
-
color: #fff;
|
|
194
|
-
flex-shrink: 0;
|
|
195
|
-
gap: 8px;
|
|
196
|
-
}
|
|
197
|
-
.ak-header--confirming {
|
|
198
245
|
flex-direction: column;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
246
|
+
padding: 20px 18px 18px;
|
|
247
|
+
background: color-mix(in srgb, var(--ak-accent) 9%, var(--ak-bg));
|
|
248
|
+
color: var(--ak-text);
|
|
249
|
+
border-bottom: 1px solid color-mix(in srgb, var(--ak-accent) 14%, var(--ak-border));
|
|
250
|
+
flex-shrink: 0;
|
|
202
251
|
}
|
|
203
252
|
.ak-header__row {
|
|
204
253
|
display: flex;
|
|
205
254
|
align-items: center;
|
|
206
|
-
justify-content: space-between;
|
|
207
255
|
width: 100%;
|
|
208
|
-
gap:
|
|
256
|
+
gap: 14px;
|
|
209
257
|
}
|
|
258
|
+
.ak-header__face {
|
|
259
|
+
position: relative;
|
|
260
|
+
width: 56px;
|
|
261
|
+
height: 56px;
|
|
262
|
+
flex-shrink: 0;
|
|
263
|
+
}
|
|
264
|
+
.ak-header__avatar,
|
|
265
|
+
.ak-header__bot {
|
|
266
|
+
width: 100%;
|
|
267
|
+
height: 100%;
|
|
268
|
+
border-radius: 50%;
|
|
269
|
+
border: 3px solid var(--ak-bg);
|
|
270
|
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
|
|
271
|
+
}
|
|
272
|
+
.ak-header__avatar {
|
|
273
|
+
display: block;
|
|
274
|
+
object-fit: cover;
|
|
275
|
+
background: var(--ak-bg);
|
|
276
|
+
}
|
|
277
|
+
.ak-header__bot {
|
|
278
|
+
display: flex;
|
|
279
|
+
align-items: center;
|
|
280
|
+
justify-content: center;
|
|
281
|
+
background: var(--ak-accent);
|
|
282
|
+
color: var(--ak-on-accent);
|
|
283
|
+
}
|
|
284
|
+
/* Online dot, sitting on the face's lower edge */
|
|
210
285
|
.ak-header__status {
|
|
211
|
-
|
|
212
|
-
|
|
286
|
+
position: absolute;
|
|
287
|
+
right: 1px;
|
|
288
|
+
bottom: 1px;
|
|
289
|
+
width: 12px;
|
|
290
|
+
height: 12px;
|
|
213
291
|
border-radius: 50%;
|
|
214
|
-
background:
|
|
215
|
-
|
|
292
|
+
background: var(--ak-success);
|
|
293
|
+
border: 2px solid var(--ak-bg);
|
|
216
294
|
}
|
|
217
295
|
.ak-header__title-group {
|
|
218
296
|
flex: 1;
|
|
219
297
|
display: flex;
|
|
220
298
|
flex-direction: column;
|
|
221
|
-
gap:
|
|
299
|
+
gap: 3px;
|
|
222
300
|
min-width: 0;
|
|
223
301
|
}
|
|
224
302
|
.ak-header__title {
|
|
225
|
-
font-size:
|
|
226
|
-
font-weight:
|
|
227
|
-
|
|
303
|
+
font-size: 18px;
|
|
304
|
+
font-weight: 700;
|
|
305
|
+
line-height: 1.25;
|
|
306
|
+
letter-spacing: -0.015em;
|
|
228
307
|
}
|
|
229
308
|
.ak-header__subtitle {
|
|
230
|
-
font-size:
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
white-space: nowrap;
|
|
234
|
-
overflow: hidden;
|
|
235
|
-
text-overflow: ellipsis;
|
|
236
|
-
}
|
|
237
|
-
.ak-header__close {
|
|
238
|
-
width: 28px;
|
|
239
|
-
height: 28px;
|
|
240
|
-
border-radius: 50%;
|
|
241
|
-
background: rgba(255, 255, 255, 0.2);
|
|
242
|
-
border: none;
|
|
243
|
-
cursor: pointer;
|
|
244
|
-
display: flex;
|
|
245
|
-
align-items: center;
|
|
246
|
-
justify-content: center;
|
|
247
|
-
color: #fff;
|
|
248
|
-
transition: background 0.15s;
|
|
249
|
-
flex-shrink: 0;
|
|
250
|
-
}
|
|
251
|
-
.ak-header__close:hover {
|
|
252
|
-
background: rgba(255, 255, 255, 0.35);
|
|
253
|
-
}
|
|
254
|
-
.ak-header__avatar {
|
|
255
|
-
width: 30px;
|
|
256
|
-
height: 30px;
|
|
257
|
-
border-radius: 50%;
|
|
258
|
-
object-fit: cover;
|
|
259
|
-
flex-shrink: 0;
|
|
260
|
-
border: 2px solid rgba(255, 255, 255, 0.3);
|
|
261
|
-
background: rgba(255, 255, 255, 0.15);
|
|
309
|
+
font-size: 13px;
|
|
310
|
+
color: var(--ak-text-muted);
|
|
311
|
+
line-height: 1.4;
|
|
262
312
|
}
|
|
263
|
-
.ak-
|
|
264
|
-
width: 28px;
|
|
265
|
-
height: 28px;
|
|
266
|
-
border-radius: 50%;
|
|
267
|
-
background: rgba(255, 255, 255, 0.2);
|
|
313
|
+
.ak-header__actions {
|
|
268
314
|
display: flex;
|
|
269
315
|
align-items: center;
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
316
|
+
gap: 4px;
|
|
317
|
+
align-self: flex-start;
|
|
318
|
+
margin: -6px -6px 0 0;
|
|
273
319
|
}
|
|
320
|
+
.ak-header__close,
|
|
274
321
|
.ak-header__button {
|
|
275
|
-
width:
|
|
276
|
-
height:
|
|
277
|
-
border-radius:
|
|
322
|
+
width: 32px;
|
|
323
|
+
height: 32px;
|
|
324
|
+
border-radius: 8px;
|
|
278
325
|
background: transparent;
|
|
279
326
|
border: none;
|
|
280
327
|
cursor: pointer;
|
|
281
328
|
display: flex;
|
|
282
329
|
align-items: center;
|
|
283
330
|
justify-content: center;
|
|
284
|
-
color:
|
|
285
|
-
transition: background 0.15s;
|
|
331
|
+
color: var(--ak-text-muted);
|
|
332
|
+
transition: background 0.15s, color 0.15s;
|
|
286
333
|
flex-shrink: 0;
|
|
287
334
|
}
|
|
288
|
-
.ak-
|
|
289
|
-
|
|
290
|
-
}
|
|
335
|
+
.ak-header__close:hover,
|
|
336
|
+
.ak-header__button:hover,
|
|
291
337
|
.ak-header__button--active {
|
|
292
|
-
background:
|
|
338
|
+
background: color-mix(in srgb, var(--ak-text) 8%, transparent);
|
|
339
|
+
color: var(--ak-text);
|
|
340
|
+
}
|
|
341
|
+
.ak-header__close:focus-visible,
|
|
342
|
+
.ak-header__button:focus-visible {
|
|
343
|
+
outline: 2px solid var(--ak-accent);
|
|
344
|
+
outline-offset: 1px;
|
|
345
|
+
}
|
|
346
|
+
/* In conversation: one row, smaller face, single-line subtitle */
|
|
347
|
+
.ak-header--compact {
|
|
348
|
+
padding: 12px 14px;
|
|
349
|
+
}
|
|
350
|
+
.ak-header--compact .ak-header__row {
|
|
351
|
+
gap: 10px;
|
|
352
|
+
}
|
|
353
|
+
.ak-header--compact .ak-header__face {
|
|
354
|
+
width: 36px;
|
|
355
|
+
height: 36px;
|
|
356
|
+
}
|
|
357
|
+
.ak-header--compact .ak-header__avatar,
|
|
358
|
+
.ak-header--compact .ak-header__bot {
|
|
359
|
+
border-width: 2px;
|
|
360
|
+
box-shadow: none;
|
|
361
|
+
}
|
|
362
|
+
.ak-header--compact .ak-header__status {
|
|
363
|
+
width: 10px;
|
|
364
|
+
height: 10px;
|
|
365
|
+
right: -1px;
|
|
366
|
+
bottom: -1px;
|
|
367
|
+
}
|
|
368
|
+
.ak-header--compact .ak-header__title {
|
|
369
|
+
font-size: 15px;
|
|
370
|
+
font-weight: 600;
|
|
371
|
+
}
|
|
372
|
+
.ak-header--compact .ak-header__subtitle {
|
|
373
|
+
font-size: 12px;
|
|
374
|
+
white-space: nowrap;
|
|
375
|
+
overflow: hidden;
|
|
376
|
+
text-overflow: ellipsis;
|
|
377
|
+
}
|
|
378
|
+
.ak-header--compact .ak-header__actions {
|
|
379
|
+
align-self: center;
|
|
380
|
+
margin: 0 -4px 0 0;
|
|
293
381
|
}
|
|
294
382
|
.ak-header__confirm {
|
|
295
383
|
width: 100%;
|
|
@@ -297,9 +385,9 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
297
385
|
align-items: center;
|
|
298
386
|
justify-content: space-between;
|
|
299
387
|
gap: 8px;
|
|
300
|
-
padding:
|
|
301
|
-
margin:
|
|
302
|
-
border-top: 1px solid
|
|
388
|
+
padding: 12px 0 0;
|
|
389
|
+
margin: 12px 0 0;
|
|
390
|
+
border-top: 1px solid color-mix(in srgb, var(--ak-accent) 14%, var(--ak-border));
|
|
303
391
|
animation: ak-confirm-in 0.18s ease-out;
|
|
304
392
|
}
|
|
305
393
|
@keyframes ak-confirm-in {
|
|
@@ -316,12 +404,12 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
316
404
|
.ak-header__confirm-title {
|
|
317
405
|
font-size: 13px;
|
|
318
406
|
font-weight: 600;
|
|
319
|
-
color:
|
|
407
|
+
color: var(--ak-text);
|
|
320
408
|
line-height: 1.3;
|
|
321
409
|
}
|
|
322
410
|
.ak-header__confirm-sub {
|
|
323
|
-
font-size:
|
|
324
|
-
color:
|
|
411
|
+
font-size: 12px;
|
|
412
|
+
color: var(--ak-text-muted);
|
|
325
413
|
line-height: 1.3;
|
|
326
414
|
}
|
|
327
415
|
.ak-header__confirm-actions {
|
|
@@ -330,60 +418,45 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
330
418
|
gap: 6px;
|
|
331
419
|
flex-shrink: 0;
|
|
332
420
|
}
|
|
333
|
-
.ak-header__confirm-cancel
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
border:
|
|
337
|
-
background: transparent;
|
|
338
|
-
color: #fff;
|
|
421
|
+
.ak-header__confirm-cancel,
|
|
422
|
+
.ak-header__confirm-ok {
|
|
423
|
+
padding: 6px 12px;
|
|
424
|
+
border-radius: 8px;
|
|
339
425
|
font-family: var(--ak-font);
|
|
340
426
|
font-size: 12px;
|
|
341
|
-
font-weight: 500;
|
|
342
427
|
cursor: pointer;
|
|
343
428
|
transition: background 0.15s;
|
|
344
429
|
white-space: nowrap;
|
|
345
430
|
}
|
|
346
|
-
.ak-header__confirm-cancel
|
|
347
|
-
|
|
431
|
+
.ak-header__confirm-cancel {
|
|
432
|
+
border: 1px solid var(--ak-border);
|
|
433
|
+
background: var(--ak-bg);
|
|
434
|
+
color: var(--ak-text);
|
|
435
|
+
font-weight: 500;
|
|
348
436
|
}
|
|
349
|
-
.ak-header__confirm-cancel:
|
|
350
|
-
background:
|
|
437
|
+
.ak-header__confirm-cancel:hover {
|
|
438
|
+
background: var(--ak-surface);
|
|
351
439
|
}
|
|
352
440
|
.ak-header__confirm-ok {
|
|
353
|
-
padding: 5px 10px;
|
|
354
|
-
border-radius: 6px;
|
|
355
441
|
border: none;
|
|
356
|
-
background:
|
|
442
|
+
background: var(--ak-danger);
|
|
357
443
|
color: #fff;
|
|
358
|
-
font-family: var(--ak-font);
|
|
359
|
-
font-size: 12px;
|
|
360
444
|
font-weight: 600;
|
|
361
|
-
cursor: pointer;
|
|
362
|
-
transition: background 0.15s;
|
|
363
|
-
white-space: nowrap;
|
|
364
445
|
}
|
|
365
446
|
.ak-header__confirm-ok:hover {
|
|
366
|
-
background:
|
|
367
|
-
}
|
|
368
|
-
.ak-header__confirm-ok:active {
|
|
369
|
-
background: rgba(239, 68, 68, 0.85);
|
|
447
|
+
background: var(--ak-danger-fg);
|
|
370
448
|
}
|
|
371
449
|
|
|
372
450
|
/* ── Message list ────────────────────────────────────────────── */
|
|
373
451
|
.ak-messages {
|
|
374
452
|
flex: 1;
|
|
375
453
|
overflow-y: auto;
|
|
376
|
-
padding:
|
|
454
|
+
padding: 16px;
|
|
377
455
|
display: flex;
|
|
378
456
|
flex-direction: column;
|
|
379
|
-
gap:
|
|
457
|
+
gap: 10px;
|
|
380
458
|
scroll-behavior: smooth;
|
|
381
459
|
min-height: 0; /* Allow flex child to shrink below its content height */
|
|
382
|
-
/* Faint doodle texture so bubbles read as objects on a surface, not floating on flat colour.
|
|
383
|
-
background-attachment defaults to scroll = anchored to the padding box, so the
|
|
384
|
-
pattern stays put while messages scroll. */
|
|
385
|
-
background-image: var(--ak-pattern);
|
|
386
|
-
background-size: var(--ak-pattern-size) var(--ak-pattern-size);
|
|
387
460
|
}
|
|
388
461
|
.ak-messages::-webkit-scrollbar { width: 4px; }
|
|
389
462
|
.ak-messages::-webkit-scrollbar-track { background: transparent; }
|
|
@@ -393,94 +466,27 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
393
466
|
}
|
|
394
467
|
|
|
395
468
|
/* ── Empty state ─────────────────────────────────────────────── */
|
|
469
|
+
/* The header carries the face and name, so this is just the description and the
|
|
470
|
+
suggested questions as quick-action tiles. */
|
|
396
471
|
.ak-empty-state {
|
|
397
472
|
flex: 1;
|
|
398
|
-
position: relative;
|
|
399
473
|
display: flex;
|
|
400
474
|
flex-direction: column;
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
text-align: center;
|
|
405
|
-
gap: 16px;
|
|
475
|
+
justify-content: flex-start;
|
|
476
|
+
padding: 18px 16px;
|
|
477
|
+
gap: 14px;
|
|
406
478
|
overflow-y: auto;
|
|
407
479
|
overflow-x: hidden;
|
|
408
480
|
min-height: 0;
|
|
409
|
-
/* Glow layer is translucent so the same doodle texture as .ak-messages shows through —
|
|
410
|
-
keeps empty state and message list on one continuous surface. */
|
|
411
|
-
background-color: var(--ak-bg);
|
|
412
|
-
background-image:
|
|
413
|
-
radial-gradient(ellipse 110% 55% at 50% 0%,
|
|
414
|
-
color-mix(in srgb, var(--ak-accent) 10%, transparent),
|
|
415
|
-
transparent 72%
|
|
416
|
-
),
|
|
417
|
-
var(--ak-pattern);
|
|
418
|
-
background-size: auto, var(--ak-pattern-size) var(--ak-pattern-size);
|
|
419
|
-
}
|
|
420
|
-
/* Decorative blurred orb behind the avatar */
|
|
421
|
-
.ak-empty-state__glow {
|
|
422
|
-
position: absolute;
|
|
423
|
-
top: -24px;
|
|
424
|
-
left: 50%;
|
|
425
|
-
transform: translateX(-50%);
|
|
426
|
-
width: 180px;
|
|
427
|
-
height: 180px;
|
|
428
|
-
border-radius: 50%;
|
|
429
|
-
background: color-mix(in srgb, var(--ak-accent) 18%, transparent);
|
|
430
|
-
filter: blur(48px);
|
|
431
|
-
pointer-events: none;
|
|
432
|
-
}
|
|
433
|
-
.ak-empty-state__body {
|
|
434
|
-
display: flex;
|
|
435
|
-
flex-direction: column;
|
|
436
|
-
align-items: center;
|
|
437
|
-
gap: 8px;
|
|
438
|
-
position: relative;
|
|
439
|
-
width: 100%;
|
|
440
|
-
}
|
|
441
|
-
.ak-empty-state__avatar {
|
|
442
|
-
width: 64px;
|
|
443
|
-
height: 64px;
|
|
444
|
-
border-radius: 50%;
|
|
445
481
|
background: var(--ak-bg);
|
|
446
|
-
border: 2px solid color-mix(in srgb, var(--ak-accent) 25%, var(--ak-border));
|
|
447
|
-
box-shadow:
|
|
448
|
-
0 0 0 4px color-mix(in srgb, var(--ak-accent) 10%, transparent),
|
|
449
|
-
0 4px 16px color-mix(in srgb, var(--ak-accent) 20%, transparent);
|
|
450
|
-
display: flex;
|
|
451
|
-
align-items: center;
|
|
452
|
-
justify-content: center;
|
|
453
|
-
color: var(--ak-accent);
|
|
454
|
-
margin-bottom: 4px;
|
|
455
|
-
flex-shrink: 0;
|
|
456
|
-
}
|
|
457
|
-
.ak-empty-state__avatar-img {
|
|
458
|
-
width: 64px;
|
|
459
|
-
height: 64px;
|
|
460
|
-
border-radius: 50%;
|
|
461
|
-
object-fit: cover;
|
|
462
|
-
}
|
|
463
|
-
.ak-empty-state__bot-icon {
|
|
464
|
-
display: flex;
|
|
465
|
-
align-items: center;
|
|
466
|
-
justify-content: center;
|
|
467
|
-
}
|
|
468
|
-
.ak-empty-state__title {
|
|
469
|
-
margin: 0;
|
|
470
|
-
font-size: 16px;
|
|
471
|
-
font-weight: 700;
|
|
472
|
-
color: var(--ak-text);
|
|
473
|
-
line-height: 1.3;
|
|
474
|
-
letter-spacing: -0.01em;
|
|
475
482
|
}
|
|
476
483
|
.ak-empty-state__description {
|
|
477
484
|
margin: 0;
|
|
478
|
-
font-size:
|
|
485
|
+
font-size: 14px;
|
|
479
486
|
color: var(--ak-text-muted);
|
|
480
487
|
line-height: 1.55;
|
|
481
|
-
width: 100%;
|
|
482
488
|
}
|
|
483
|
-
/*
|
|
489
|
+
/* Quick actions — 2-column grid */
|
|
484
490
|
.ak-empty-state__suggestions {
|
|
485
491
|
display: grid;
|
|
486
492
|
grid-template-columns: 1fr 1fr;
|
|
@@ -491,33 +497,49 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
491
497
|
display: flex;
|
|
492
498
|
flex-direction: column;
|
|
493
499
|
align-items: flex-start;
|
|
494
|
-
background:
|
|
495
|
-
border: 1px solid
|
|
496
|
-
border-radius:
|
|
497
|
-
padding:
|
|
500
|
+
background: var(--ak-bg);
|
|
501
|
+
border: 1px solid var(--ak-border);
|
|
502
|
+
border-radius: 14px;
|
|
503
|
+
padding: 12px 14px;
|
|
504
|
+
min-height: 64px;
|
|
498
505
|
cursor: pointer;
|
|
499
506
|
text-align: left;
|
|
500
|
-
|
|
507
|
+
font-family: var(--ak-font);
|
|
508
|
+
transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
|
|
501
509
|
}
|
|
502
510
|
/* Odd last item spans both columns so the grid doesn't look lopsided */
|
|
503
511
|
.ak-empty-state__suggestion:last-child:nth-child(odd) {
|
|
504
512
|
grid-column: 1 / -1;
|
|
505
513
|
}
|
|
506
514
|
.ak-empty-state__suggestion:hover {
|
|
507
|
-
|
|
508
|
-
|
|
515
|
+
border-color: color-mix(in srgb, var(--ak-accent) 45%, var(--ak-border));
|
|
516
|
+
box-shadow: 0 2px 10px color-mix(in srgb, var(--ak-accent) 12%, transparent);
|
|
517
|
+
}
|
|
518
|
+
.ak-empty-state__suggestion:focus-visible {
|
|
519
|
+
outline: 2px solid var(--ak-accent);
|
|
520
|
+
outline-offset: 2px;
|
|
509
521
|
}
|
|
510
522
|
.ak-empty-state__suggestion-title {
|
|
511
|
-
|
|
512
|
-
|
|
523
|
+
display: flex;
|
|
524
|
+
align-items: flex-start;
|
|
525
|
+
justify-content: space-between;
|
|
526
|
+
gap: 8px;
|
|
527
|
+
width: 100%;
|
|
528
|
+
font-size: 14px;
|
|
529
|
+
font-weight: 600;
|
|
513
530
|
color: var(--ak-text);
|
|
514
531
|
line-height: 1.4;
|
|
515
532
|
}
|
|
533
|
+
.ak-empty-state__suggestion-title svg {
|
|
534
|
+
flex-shrink: 0;
|
|
535
|
+
margin-top: 3px;
|
|
536
|
+
color: var(--ak-accent);
|
|
537
|
+
}
|
|
516
538
|
.ak-empty-state__suggestion-desc {
|
|
517
539
|
font-size: 12px;
|
|
518
540
|
color: var(--ak-text-muted);
|
|
519
541
|
line-height: 1.4;
|
|
520
|
-
margin-top:
|
|
542
|
+
margin-top: 4px;
|
|
521
543
|
}
|
|
522
544
|
|
|
523
545
|
/* ── Message bubbles ─────────────────────────────────────────── */
|
|
@@ -540,8 +562,8 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
540
562
|
align-items: flex-start;
|
|
541
563
|
}
|
|
542
564
|
.ak-message__bubble {
|
|
543
|
-
padding:
|
|
544
|
-
border-radius:
|
|
565
|
+
padding: 10px 14px;
|
|
566
|
+
border-radius: 18px;
|
|
545
567
|
font-size: 14px;
|
|
546
568
|
line-height: 1.55;
|
|
547
569
|
word-break: break-word;
|
|
@@ -555,18 +577,17 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
555
577
|
.ak-message--user .ak-message__bubble {
|
|
556
578
|
background: var(--ak-user-bg);
|
|
557
579
|
color: var(--ak-user-text);
|
|
558
|
-
border-bottom-right-radius:
|
|
580
|
+
border-bottom-right-radius: 6px;
|
|
559
581
|
}
|
|
560
582
|
.ak-message--assistant .ak-message__bubble {
|
|
561
583
|
background: var(--ak-bot-bg);
|
|
562
584
|
color: var(--ak-bot-text);
|
|
563
|
-
border-bottom-left-radius:
|
|
564
|
-
border: 1px solid var(--ak-border);
|
|
585
|
+
border-bottom-left-radius: 6px;
|
|
565
586
|
}
|
|
566
587
|
.ak-message--error .ak-message__bubble {
|
|
567
|
-
background:
|
|
568
|
-
color:
|
|
569
|
-
border-color:
|
|
588
|
+
background: var(--ak-danger-soft);
|
|
589
|
+
color: var(--ak-danger-fg);
|
|
590
|
+
border-color: var(--ak-danger-border);
|
|
570
591
|
}
|
|
571
592
|
.ak-message--operator .ak-message__bubble--operator {
|
|
572
593
|
background: color-mix(in srgb, var(--ak-accent) 8%, var(--ak-bot-bg));
|
|
@@ -581,7 +602,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
581
602
|
padding: 0 4px;
|
|
582
603
|
}
|
|
583
604
|
.ak-message--user .ak-message__time {
|
|
584
|
-
color:
|
|
605
|
+
color: color-mix(in srgb, var(--ak-on-accent) 70%, transparent);
|
|
585
606
|
}
|
|
586
607
|
.ak-message__sender-label {
|
|
587
608
|
font-size: 11px;
|
|
@@ -605,7 +626,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
605
626
|
height: 18px;
|
|
606
627
|
border-radius: 50%;
|
|
607
628
|
background: var(--ak-accent);
|
|
608
|
-
color:
|
|
629
|
+
color: var(--ak-on-accent);
|
|
609
630
|
font-size: 10px;
|
|
610
631
|
font-weight: 700;
|
|
611
632
|
line-height: 1;
|
|
@@ -698,7 +719,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
698
719
|
.ak-gallery {
|
|
699
720
|
position: relative;
|
|
700
721
|
width: 100%;
|
|
701
|
-
background:
|
|
722
|
+
background: var(--ak-bg);
|
|
702
723
|
overflow: hidden;
|
|
703
724
|
}
|
|
704
725
|
|
|
@@ -709,13 +730,13 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
709
730
|
}
|
|
710
731
|
.ak-gallery--single .ak-gallery__cell--hero {
|
|
711
732
|
display: block;
|
|
712
|
-
background:
|
|
733
|
+
background: var(--ak-bg);
|
|
713
734
|
}
|
|
714
735
|
.ak-gallery__img--contain {
|
|
715
736
|
width: 100%;
|
|
716
737
|
max-height: 320px;
|
|
717
738
|
object-fit: contain;
|
|
718
|
-
background:
|
|
739
|
+
background: var(--ak-bg);
|
|
719
740
|
display: block;
|
|
720
741
|
}
|
|
721
742
|
|
|
@@ -724,7 +745,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
724
745
|
display: grid;
|
|
725
746
|
grid-template-columns: 1fr 1fr;
|
|
726
747
|
gap: 2px;
|
|
727
|
-
background:
|
|
748
|
+
background: var(--ak-border);
|
|
728
749
|
}
|
|
729
750
|
|
|
730
751
|
/* 3-up: big left + 2 stacked right; container holds aspect */
|
|
@@ -732,7 +753,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
732
753
|
display: grid;
|
|
733
754
|
grid-template-columns: 2fr 1fr;
|
|
734
755
|
gap: 2px;
|
|
735
|
-
background:
|
|
756
|
+
background: var(--ak-border);
|
|
736
757
|
aspect-ratio: 4 / 3;
|
|
737
758
|
}
|
|
738
759
|
.ak-gallery--three > .ak-gallery__cell {
|
|
@@ -750,14 +771,14 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
750
771
|
display: grid;
|
|
751
772
|
grid-template-columns: 1fr 1fr;
|
|
752
773
|
gap: 2px;
|
|
753
|
-
background:
|
|
774
|
+
background: var(--ak-border);
|
|
754
775
|
}
|
|
755
776
|
|
|
756
777
|
.ak-gallery__cell {
|
|
757
778
|
position: relative;
|
|
758
779
|
display: block;
|
|
759
780
|
overflow: hidden;
|
|
760
|
-
background:
|
|
781
|
+
background: var(--ak-surface);
|
|
761
782
|
aspect-ratio: 1 / 1;
|
|
762
783
|
line-height: 0;
|
|
763
784
|
text-decoration: none;
|
|
@@ -784,7 +805,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
784
805
|
}
|
|
785
806
|
|
|
786
807
|
.ak-gallery__cell:focus-visible {
|
|
787
|
-
outline: 2px solid var(--ak-
|
|
808
|
+
outline: 2px solid var(--ak-accent);
|
|
788
809
|
outline-offset: -2px;
|
|
789
810
|
}
|
|
790
811
|
|
|
@@ -819,21 +840,21 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
819
840
|
gap: 10px;
|
|
820
841
|
padding: 8px 10px;
|
|
821
842
|
background: var(--ak-surface);
|
|
822
|
-
border: 1px solid var(--ak-border
|
|
843
|
+
border: 1px solid var(--ak-border);
|
|
823
844
|
border-radius: 12px;
|
|
824
845
|
text-decoration: none;
|
|
825
|
-
color: var(--ak-text
|
|
846
|
+
color: var(--ak-text);
|
|
826
847
|
transition: border-color 0.15s, box-shadow 0.15s;
|
|
827
848
|
max-width: 100%;
|
|
828
849
|
}
|
|
829
850
|
|
|
830
851
|
.ak-file-chip:hover {
|
|
831
|
-
border-color:
|
|
852
|
+
border-color: var(--ak-border-strong);
|
|
832
853
|
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
|
|
833
854
|
}
|
|
834
855
|
|
|
835
856
|
.ak-file-chip:focus-visible {
|
|
836
|
-
outline: 2px solid var(--ak-
|
|
857
|
+
outline: 2px solid var(--ak-accent);
|
|
837
858
|
outline-offset: 2px;
|
|
838
859
|
}
|
|
839
860
|
|
|
@@ -863,7 +884,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
863
884
|
.ak-file-chip__name {
|
|
864
885
|
font-size: 13px;
|
|
865
886
|
font-weight: 500;
|
|
866
|
-
color: var(--ak-text
|
|
887
|
+
color: var(--ak-text);
|
|
867
888
|
white-space: nowrap;
|
|
868
889
|
overflow: hidden;
|
|
869
890
|
text-overflow: ellipsis;
|
|
@@ -874,7 +895,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
874
895
|
font-size: 10px;
|
|
875
896
|
font-weight: 600;
|
|
876
897
|
letter-spacing: 0.05em;
|
|
877
|
-
color:
|
|
898
|
+
color: var(--ak-text-muted);
|
|
878
899
|
margin-top: 2px;
|
|
879
900
|
}
|
|
880
901
|
|
|
@@ -891,7 +912,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
891
912
|
gap: 6px;
|
|
892
913
|
padding: 8px 10px;
|
|
893
914
|
background: var(--ak-surface);
|
|
894
|
-
border: 1px solid var(--ak-border
|
|
915
|
+
border: 1px solid var(--ak-border);
|
|
895
916
|
border-radius: 12px;
|
|
896
917
|
max-width: 100%;
|
|
897
918
|
}
|
|
@@ -1028,11 +1049,11 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1028
1049
|
cursor: zoom-in;
|
|
1029
1050
|
font: inherit;
|
|
1030
1051
|
color: inherit;
|
|
1031
|
-
background:
|
|
1052
|
+
background: var(--ak-surface);
|
|
1032
1053
|
}
|
|
1033
1054
|
|
|
1034
1055
|
.ak-gallery__cell:focus-visible {
|
|
1035
|
-
outline: 2px solid var(--ak-
|
|
1056
|
+
outline: 2px solid var(--ak-accent);
|
|
1036
1057
|
outline-offset: -2px;
|
|
1037
1058
|
}
|
|
1038
1059
|
|
|
@@ -1069,7 +1090,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1069
1090
|
|
|
1070
1091
|
/* User-uploaded image caption uses user bubble colors */
|
|
1071
1092
|
.ak-message--user .ak-message__image-caption {
|
|
1072
|
-
color:
|
|
1093
|
+
color: color-mix(in srgb, var(--ak-on-accent) 80%, transparent);
|
|
1073
1094
|
font-style: normal;
|
|
1074
1095
|
}
|
|
1075
1096
|
|
|
@@ -1145,54 +1166,78 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1145
1166
|
display: none;
|
|
1146
1167
|
}
|
|
1147
1168
|
|
|
1148
|
-
/*
|
|
1169
|
+
/* Composer card — the dashboard ChatComposer layout: the message row (text, mic at its
|
|
1170
|
+
right edge) over a divider and a toolbar (+ … send), both on the same side padding.
|
|
1171
|
+
The + and mic glyphs (20px in a 32px box) are pulled flush with the text edges. */
|
|
1149
1172
|
.ak-composer__input-wrap {
|
|
1150
1173
|
display: flex;
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
border:
|
|
1155
|
-
|
|
1156
|
-
padding: 5px 5px 5px 6px;
|
|
1174
|
+
flex-direction: column;
|
|
1175
|
+
background: var(--ak-bg);
|
|
1176
|
+
border: 1px solid color-mix(in srgb, var(--ak-border-strong) 40%, transparent);
|
|
1177
|
+
border-radius: 16px;
|
|
1178
|
+
box-shadow: 0 1px 3px rgba(14, 18, 32, 0.06), 0 1px 2px rgba(14, 18, 32, 0.04);
|
|
1157
1179
|
transition: border-color 0.15s;
|
|
1158
1180
|
}
|
|
1159
1181
|
.ak-composer__input-wrap:focus-within {
|
|
1160
1182
|
border-color: var(--ak-accent);
|
|
1161
1183
|
}
|
|
1184
|
+
.ak-composer__row {
|
|
1185
|
+
display: flex;
|
|
1186
|
+
align-items: flex-start;
|
|
1187
|
+
gap: 8px;
|
|
1188
|
+
padding: 10px 12px 8px;
|
|
1189
|
+
}
|
|
1190
|
+
.ak-composer__toolbar {
|
|
1191
|
+
display: flex;
|
|
1192
|
+
align-items: center;
|
|
1193
|
+
gap: 6px;
|
|
1194
|
+
padding: 8px 12px;
|
|
1195
|
+
border-top: 1px solid var(--ak-border);
|
|
1196
|
+
}
|
|
1162
1197
|
|
|
1163
1198
|
/* Attach button wrapper */
|
|
1164
1199
|
.ak-composer__attach-wrap {
|
|
1165
1200
|
flex-shrink: 0;
|
|
1201
|
+
margin-left: -6px;
|
|
1166
1202
|
}
|
|
1167
1203
|
|
|
1168
|
-
/* "+"
|
|
1169
|
-
.ak-composer__attach
|
|
1170
|
-
|
|
1171
|
-
|
|
1204
|
+
/* Icon controls ("+" and mic): borderless, a hover fill rather than an outline */
|
|
1205
|
+
.ak-composer__attach,
|
|
1206
|
+
.ak-composer__mic {
|
|
1207
|
+
width: 32px;
|
|
1208
|
+
height: 32px;
|
|
1172
1209
|
border-radius: 8px;
|
|
1173
|
-
background:
|
|
1174
|
-
border:
|
|
1210
|
+
background: transparent;
|
|
1211
|
+
border: none;
|
|
1175
1212
|
cursor: pointer;
|
|
1176
1213
|
display: flex;
|
|
1177
1214
|
align-items: center;
|
|
1178
1215
|
justify-content: center;
|
|
1179
1216
|
color: var(--ak-text-muted);
|
|
1180
|
-
transition: color 0.15s,
|
|
1217
|
+
transition: color 0.15s, background 0.15s;
|
|
1181
1218
|
flex-shrink: 0;
|
|
1182
1219
|
}
|
|
1183
|
-
.ak-composer__attach:hover:not(:disabled)
|
|
1184
|
-
|
|
1185
|
-
border-color: var(--ak-accent);
|
|
1186
|
-
}
|
|
1220
|
+
.ak-composer__attach:hover:not(:disabled),
|
|
1221
|
+
.ak-composer__mic:hover:not(:disabled),
|
|
1187
1222
|
.ak-composer__attach--open {
|
|
1188
|
-
color: var(--ak-
|
|
1189
|
-
|
|
1190
|
-
|
|
1223
|
+
color: var(--ak-text);
|
|
1224
|
+
background: var(--ak-hover);
|
|
1225
|
+
}
|
|
1226
|
+
.ak-composer__attach:focus-visible,
|
|
1227
|
+
.ak-composer__mic:focus-visible,
|
|
1228
|
+
.ak-composer__send:focus-visible {
|
|
1229
|
+
outline: 2px solid var(--ak-accent);
|
|
1230
|
+
outline-offset: 2px;
|
|
1191
1231
|
}
|
|
1192
|
-
.ak-composer__attach:disabled
|
|
1232
|
+
.ak-composer__attach:disabled,
|
|
1233
|
+
.ak-composer__mic:disabled {
|
|
1193
1234
|
opacity: 0.4;
|
|
1194
1235
|
cursor: not-allowed;
|
|
1195
1236
|
}
|
|
1237
|
+
/* Flush right, and -4px vertically so the 32px box doesn't grow the 24px text row */
|
|
1238
|
+
.ak-composer__mic {
|
|
1239
|
+
margin: -4px -6px -4px 0;
|
|
1240
|
+
}
|
|
1196
1241
|
|
|
1197
1242
|
/* Attachment submenu — floats above the composer, positioned relative to .ak-composer */
|
|
1198
1243
|
.ak-composer__attach-menu {
|
|
@@ -1233,20 +1278,20 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1233
1278
|
cursor: not-allowed;
|
|
1234
1279
|
}
|
|
1235
1280
|
|
|
1236
|
-
/* Textarea — borderless, transparent,
|
|
1281
|
+
/* Textarea — borderless, transparent, fills the message row */
|
|
1237
1282
|
.ak-composer__input {
|
|
1238
1283
|
flex: 1;
|
|
1239
|
-
padding:
|
|
1284
|
+
padding: 0;
|
|
1240
1285
|
border: none;
|
|
1241
1286
|
border-radius: 0;
|
|
1242
1287
|
background: transparent;
|
|
1243
1288
|
color: var(--ak-text);
|
|
1244
1289
|
font-family: var(--ak-font);
|
|
1245
1290
|
font-size: 16px; /* iOS zooms the page when a focused input is under 16px */
|
|
1246
|
-
line-height: 1.
|
|
1291
|
+
line-height: 1.5;
|
|
1247
1292
|
resize: none;
|
|
1248
1293
|
outline: none;
|
|
1249
|
-
min-height:
|
|
1294
|
+
min-height: 24px;
|
|
1250
1295
|
max-height: 110px;
|
|
1251
1296
|
overflow-y: auto;
|
|
1252
1297
|
}
|
|
@@ -1254,37 +1299,13 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1254
1299
|
color: var(--ak-text-muted);
|
|
1255
1300
|
}
|
|
1256
1301
|
|
|
1257
|
-
/* Mic button — square with rounded corners, sibling of the "+" attach button */
|
|
1258
|
-
.ak-composer__mic {
|
|
1259
|
-
width: 28px;
|
|
1260
|
-
height: 28px;
|
|
1261
|
-
border-radius: 8px;
|
|
1262
|
-
background: var(--ak-bg);
|
|
1263
|
-
border: 1px solid var(--ak-border);
|
|
1264
|
-
cursor: pointer;
|
|
1265
|
-
display: flex;
|
|
1266
|
-
align-items: center;
|
|
1267
|
-
justify-content: center;
|
|
1268
|
-
color: var(--ak-text-muted);
|
|
1269
|
-
transition: color 0.15s, border-color 0.15s, background 0.15s;
|
|
1270
|
-
flex-shrink: 0;
|
|
1271
|
-
}
|
|
1272
|
-
.ak-composer__mic:hover:not(:disabled) {
|
|
1273
|
-
color: var(--ak-accent);
|
|
1274
|
-
border-color: var(--ak-accent);
|
|
1275
|
-
}
|
|
1276
|
-
.ak-composer__mic:disabled {
|
|
1277
|
-
opacity: 0.4;
|
|
1278
|
-
cursor: not-allowed;
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
1302
|
/* Recording bar — replaces the input row while a voice note is being recorded */
|
|
1282
1303
|
.ak-composer__recording {
|
|
1283
1304
|
display: flex;
|
|
1284
1305
|
align-items: center;
|
|
1285
1306
|
gap: 10px;
|
|
1286
1307
|
flex: 1;
|
|
1287
|
-
padding:
|
|
1308
|
+
padding: 8px 12px;
|
|
1288
1309
|
}
|
|
1289
1310
|
.ak-composer__recording-timer {
|
|
1290
1311
|
display: flex;
|
|
@@ -1300,7 +1321,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1300
1321
|
width: 8px;
|
|
1301
1322
|
height: 8px;
|
|
1302
1323
|
border-radius: 50%;
|
|
1303
|
-
background:
|
|
1324
|
+
background: var(--ak-danger);
|
|
1304
1325
|
animation: ak-recording-pulse 1.4s ease-in-out infinite;
|
|
1305
1326
|
}
|
|
1306
1327
|
@keyframes ak-recording-pulse {
|
|
@@ -1314,8 +1335,8 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1314
1335
|
}
|
|
1315
1336
|
.ak-composer__recording-cancel,
|
|
1316
1337
|
.ak-composer__recording-stop {
|
|
1317
|
-
width:
|
|
1318
|
-
height:
|
|
1338
|
+
width: 32px;
|
|
1339
|
+
height: 32px;
|
|
1319
1340
|
border-radius: 8px;
|
|
1320
1341
|
border: none;
|
|
1321
1342
|
cursor: pointer;
|
|
@@ -1331,20 +1352,21 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1331
1352
|
}
|
|
1332
1353
|
.ak-composer__recording-cancel:hover {
|
|
1333
1354
|
color: var(--ak-text);
|
|
1334
|
-
background: var(--ak-
|
|
1355
|
+
background: var(--ak-hover);
|
|
1335
1356
|
}
|
|
1336
1357
|
.ak-composer__recording-stop {
|
|
1337
1358
|
background: var(--ak-accent);
|
|
1338
|
-
color:
|
|
1359
|
+
color: var(--ak-on-accent);
|
|
1339
1360
|
}
|
|
1340
1361
|
.ak-composer__recording-stop:hover {
|
|
1341
1362
|
background: var(--ak-accent-hover);
|
|
1342
1363
|
}
|
|
1343
1364
|
|
|
1344
|
-
/* Send button — square
|
|
1365
|
+
/* Send button — rounded square at the toolbar's right end */
|
|
1345
1366
|
.ak-composer__send {
|
|
1346
|
-
width:
|
|
1347
|
-
height:
|
|
1367
|
+
width: 32px;
|
|
1368
|
+
height: 32px;
|
|
1369
|
+
margin-left: auto;
|
|
1348
1370
|
border-radius: 8px;
|
|
1349
1371
|
background: var(--ak-accent);
|
|
1350
1372
|
border: none;
|
|
@@ -1352,15 +1374,17 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1352
1374
|
display: flex;
|
|
1353
1375
|
align-items: center;
|
|
1354
1376
|
justify-content: center;
|
|
1355
|
-
color:
|
|
1356
|
-
transition: background 0.15s,
|
|
1377
|
+
color: var(--ak-on-accent);
|
|
1378
|
+
transition: background 0.15s, color 0.15s;
|
|
1357
1379
|
flex-shrink: 0;
|
|
1358
1380
|
}
|
|
1359
1381
|
.ak-composer__send:hover:not(:disabled) {
|
|
1360
1382
|
background: var(--ak-accent-hover);
|
|
1361
1383
|
}
|
|
1384
|
+
/* Disabled sits on the muted fill rather than a faded accent, so it stays visible on dark */
|
|
1362
1385
|
.ak-composer__send:disabled {
|
|
1363
|
-
|
|
1386
|
+
background: var(--ak-bot-bg);
|
|
1387
|
+
color: var(--ak-text-muted);
|
|
1364
1388
|
cursor: not-allowed;
|
|
1365
1389
|
}
|
|
1366
1390
|
|
|
@@ -1514,7 +1538,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1514
1538
|
max-width: 100%;
|
|
1515
1539
|
}
|
|
1516
1540
|
.ak-message--user .ak-message__bubble--md .ak-md-pre-wrap {
|
|
1517
|
-
background:
|
|
1541
|
+
background: color-mix(in srgb, var(--ak-on-accent) 15%, transparent);
|
|
1518
1542
|
}
|
|
1519
1543
|
.ak-message__bubble--md .ak-md-pre-lang {
|
|
1520
1544
|
display: block;
|
|
@@ -1528,7 +1552,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1528
1552
|
border-bottom: 1px solid rgba(0, 0, 0, 0.08);
|
|
1529
1553
|
}
|
|
1530
1554
|
.ak-message--user .ak-message__bubble--md .ak-md-pre-lang {
|
|
1531
|
-
border-bottom-color:
|
|
1555
|
+
border-bottom-color: color-mix(in srgb, var(--ak-on-accent) 15%, transparent);
|
|
1532
1556
|
}
|
|
1533
1557
|
.ak-message__bubble--md .ak-md-pre {
|
|
1534
1558
|
margin: 0;
|
|
@@ -1551,7 +1575,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1551
1575
|
font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
|
|
1552
1576
|
}
|
|
1553
1577
|
.ak-message--user .ak-message__bubble--md .ak-md-ic {
|
|
1554
|
-
background:
|
|
1578
|
+
background: color-mix(in srgb, var(--ak-on-accent) 20%, transparent);
|
|
1555
1579
|
}
|
|
1556
1580
|
.ak-message__bubble--md .ak-md-hr {
|
|
1557
1581
|
border: none;
|
|
@@ -1565,7 +1589,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1565
1589
|
text-underline-offset: 2px;
|
|
1566
1590
|
}
|
|
1567
1591
|
.ak-message--user .ak-message__bubble--md a {
|
|
1568
|
-
color:
|
|
1592
|
+
color: color-mix(in srgb, var(--ak-on-accent) 90%, transparent);
|
|
1569
1593
|
}
|
|
1570
1594
|
.ak-message__bubble--md .ak-md-table {
|
|
1571
1595
|
width: 100%;
|
|
@@ -1583,9 +1607,9 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1583
1607
|
color: var(--ak-text) !important;
|
|
1584
1608
|
}
|
|
1585
1609
|
.ak-message--user .ak-message__bubble--md .ak-md-th {
|
|
1586
|
-
border-bottom-color:
|
|
1610
|
+
border-bottom-color: color-mix(in srgb, var(--ak-on-accent) 50%, transparent) !important;
|
|
1587
1611
|
background: rgba(0, 0, 0, 0.25) !important;
|
|
1588
|
-
color:
|
|
1612
|
+
color: var(--ak-user-text) !important;
|
|
1589
1613
|
font-weight: 700;
|
|
1590
1614
|
}
|
|
1591
1615
|
.ak-message__bubble--md .ak-md-td {
|
|
@@ -1597,8 +1621,8 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1597
1621
|
background: color-mix(in srgb, var(--ak-surface), transparent 40%) !important;
|
|
1598
1622
|
}
|
|
1599
1623
|
.ak-message--user .ak-message__bubble--md .ak-md-td {
|
|
1600
|
-
color:
|
|
1601
|
-
border-bottom-color:
|
|
1624
|
+
color: var(--ak-user-text) !important;
|
|
1625
|
+
border-bottom-color: color-mix(in srgb, var(--ak-on-accent) 25%, transparent) !important;
|
|
1602
1626
|
}
|
|
1603
1627
|
.ak-message--user .ak-message__bubble--md tr:nth-child(even) .ak-md-td {
|
|
1604
1628
|
background: rgba(0, 0, 0, 0.15) !important;
|
|
@@ -1703,10 +1727,10 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1703
1727
|
/* ── Error banner ────────────────────────────────────────────── */
|
|
1704
1728
|
.ak-error {
|
|
1705
1729
|
padding: 12px 16px;
|
|
1706
|
-
background:
|
|
1707
|
-
color:
|
|
1730
|
+
background: var(--ak-danger-soft);
|
|
1731
|
+
color: var(--ak-danger-fg);
|
|
1708
1732
|
font-size: 13px;
|
|
1709
|
-
border-top: 1px solid
|
|
1733
|
+
border-top: 1px solid var(--ak-danger-border);
|
|
1710
1734
|
text-align: left;
|
|
1711
1735
|
flex-shrink: 0;
|
|
1712
1736
|
display: flex;
|
|
@@ -1748,9 +1772,9 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1748
1772
|
|
|
1749
1773
|
/* Specific styling for origin restriction errors */
|
|
1750
1774
|
.ak-error--origin {
|
|
1751
|
-
background:
|
|
1752
|
-
color:
|
|
1753
|
-
border-top: 1px solid
|
|
1775
|
+
background: var(--ak-warning-soft); /* warning, not danger: less alarming */
|
|
1776
|
+
color: var(--ak-warning-fg);
|
|
1777
|
+
border-top: 1px solid var(--ak-warning);
|
|
1754
1778
|
}
|
|
1755
1779
|
|
|
1756
1780
|
/* ── Agent status indicator ──────────────────────────────────── */
|
|
@@ -1770,7 +1794,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1770
1794
|
}
|
|
1771
1795
|
.ak-agent-status__icon {
|
|
1772
1796
|
flex-shrink: 0;
|
|
1773
|
-
color: var(--ak-
|
|
1797
|
+
color: var(--ak-accent);
|
|
1774
1798
|
animation: ak-sparkle-pulse 2.5s ease-in-out infinite;
|
|
1775
1799
|
}
|
|
1776
1800
|
.ak-agent-status__text {
|
|
@@ -1807,7 +1831,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1807
1831
|
.ak-progress__label {
|
|
1808
1832
|
font-weight: 600;
|
|
1809
1833
|
font-size: 0.78rem;
|
|
1810
|
-
color: var(--ak-
|
|
1834
|
+
color: var(--ak-accent);
|
|
1811
1835
|
}
|
|
1812
1836
|
.ak-progress__toggle {
|
|
1813
1837
|
display: inline-flex;
|
|
@@ -1904,7 +1928,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1904
1928
|
opacity: 0.55;
|
|
1905
1929
|
}
|
|
1906
1930
|
.ak-progress__step-icon--fail {
|
|
1907
|
-
color:
|
|
1931
|
+
color: var(--ak-danger);
|
|
1908
1932
|
opacity: 0.9;
|
|
1909
1933
|
}
|
|
1910
1934
|
/* Post-turn summary row ("Worked for Ns · N steps") */
|
|
@@ -1935,7 +1959,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1935
1959
|
width: 11px;
|
|
1936
1960
|
height: 11px;
|
|
1937
1961
|
border: 1.5px solid var(--ak-border);
|
|
1938
|
-
border-top-color: var(--ak-
|
|
1962
|
+
border-top-color: var(--ak-accent);
|
|
1939
1963
|
border-radius: 50%;
|
|
1940
1964
|
flex-shrink: 0;
|
|
1941
1965
|
animation: ak-spin 0.7s linear infinite;
|
|
@@ -1955,11 +1979,11 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1955
1979
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
|
|
1956
1980
|
}
|
|
1957
1981
|
.ak-branding__logo {
|
|
1958
|
-
|
|
1959
|
-
|
|
1982
|
+
display: block;
|
|
1983
|
+
width: 14px;
|
|
1984
|
+
height: 14px;
|
|
1960
1985
|
flex-shrink: 0;
|
|
1961
|
-
|
|
1962
|
-
opacity: 0.75;
|
|
1986
|
+
border-radius: 3px;
|
|
1963
1987
|
}
|
|
1964
1988
|
.ak-branding__label {
|
|
1965
1989
|
font-size: 9px;
|
|
@@ -1969,7 +1993,7 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
1969
1993
|
.ak-branding__name {
|
|
1970
1994
|
font-size: 9px;
|
|
1971
1995
|
font-weight: 600;
|
|
1972
|
-
color: var(--ak-
|
|
1996
|
+
color: var(--ak-text);
|
|
1973
1997
|
opacity: 0.75;
|
|
1974
1998
|
letter-spacing: -0.01em;
|
|
1975
1999
|
}
|
|
@@ -2033,10 +2057,10 @@ ${a}:`;for(var o=0,s=e[a];o<s.length;o++){var c=s[o];n+=`
|
|
|
2033
2057
|
display: none;
|
|
2034
2058
|
}
|
|
2035
2059
|
}
|
|
2036
|
-
`,
|
|
2060
|
+
`,gs=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAIAAAD9b0jDAAAHd0lEQVR42k1WaWxU1xX+zr33vTebx2O8AY3XsBibJSxhKQJCSFiCAYeUJEooTYEuKQXC8iN0U0vzo0hdpKJUUUshogskqJS2ainBgAiNQ4JYWrMYsoBdiLHHnvF4PPNm3nJPf4xp++/q6Jx7zvm+q/t9VFXXSEREYGYABDDw4EDMLIhIiEJYF0LMIAIAcCGbBBXKATCzwvBtYM0MFkIAxKyZiAAl5dDQUM7OMABmQMdKyqWSvtaCBBE0M4HADAYIhd6KiAr5/P8jgsAwTBWPxxc9vuAbX9vo+z6AUCi4+7U9becvjBw50nMdzRiemqGZxXAlKWaAGQQiGu5JICJm7XmeJOz+/ncmNjUWVvvggwvjxtTV1tYcOnyksrLS830wAAYRMZhBggAIBv8PSECzZmYCTMPoi8dbWlZMbGp0XNdxXGbs/uFra9e+uHP7Vt9zmR8ACkJhMh5eURRGJAJAD6AGwJ7vW5axY9tWZgazaRonW08ZSs2ZM2v8+LHLli2J9/UpYxg9zQxBEEJrH4CgYR4LrGqAGCyV0dfX17JqRVPTBK21lFJr/at9+3fs3FGgdcf2rdpzC3yylBBEABGEEACLYVYBIhKCBEEQ+Z5nGnLbK5uZ2XU9Ijp77h/t7e1z584B4DjO5+fMal6xPJ4YIO2LRLfM20wCDAIBJAAWBBJCSnI9oVkYhtHb2/vM6paJTY2u6wYClhBi795f3rxx463DR4jINE0iWvvsF7z+uyFLOc0v+1XjRD5DUmpmBqi6vrHwjhyPy4oplRFaczYzcO5s64SG8UTU3n711wd+u//AwWAwWD+m/sSxt8+1tr5z6vTNvqS1cKn95FPtV7TX8a/AG1+hUJRYA1AFNInY8cXYSn/mGHxrX2LD+pbGCQ0M/HzvL44ePbZ+/fply5as+9KGriuXm5990R7TYD3RohvnJ91g/N1P821n7Zw3eWQ4ndGuDwYpZi2INAvHobPXVE9Kj6pUW7ZsBdDZ2fnmm7979XvfbWocP7Z69IJFT16avRSPLcr70fhdu/vQJaftlOhqK1X2rLJ4bXVu/9ni0ogbDZEsKa1IZWjdkvzjU/zObutSR/z5557Z8OV1vvYDVvDUmTO5vGMaRuXIyjKTD9zQWf+hfx88kji4N3bt6PrpoeaZdefPtgoVvnjH3LQ8N7vBO9+hlNZcFMbBdwKP1OlZD+cyg7R1yyYAeTsXCstHp00++d6VpsmTu+7en7Ng/owDO68c//1YuvvVdU8veWpHXUOTYag/n2pL9nSumWn1J9X7HUJICAJpTxcHddo1jp5LPbHqi40TGuycI83AYKLnr0cOjbGvo+dmoutGOpPetGhcS+5vg4m+xStXjZ80xck7ADZtfqW3L3fmo8Dxy9Rvw5JalpRVMBNBbFxkr5iSXf/03AA8xxgRDufPvLXP//DEN+cGp02+X8ZteqCjoS65sGIo8Unf7Z7EgsULmIGh2xOK7ozyPlwyMXWnV8Yz0pAso7EKIkDIwyfTNZPWrFj5QrrnvjJU973eXZt3rZuUn9HMoTlTisauLq6usyKXirxrNbZ8/ejV6qnzRo0oSt/7xDKLO/pHvfyjC7aMGMJnEFXVNbLWUkltZ6oWLo8URU3XVuSl09mloe6XpqmyRzSmzkN4FtCPgdO48XH6vPrjDe8PiSiHR/jC8ALRrON2njwmTdP3mQRRVe0ECMH5fORzFXasNvPwQjV2qhUQRaFAeSziuxx0vQgPhkSeWed1IG9EfUtJSYl09rOUncmz03GxqPPdiN2fuvWRCAaINVXVNQLgzGDN4VYjd//eT/YkbyUy4xb4lfWu78hYCRVFGZKkAuD7vmZGdgjJJIQykveiN0+PGKVKN21XU+Z1tcznXFaYARkrH839vdbi1c7SdYNyZHDNWhUtCl48bqY+E8I07WxQu5abs7ycmUsbmVRoqN9K9hi5VKzncmmiPbz6hdi3fzwQqs/KMHl5/d4JREuour6JMinvtb94FbXCHvJg5cxy/9Nb5b/ZqOzBdM28AVUufReGBTBcx2OEeSB2930IkXz+Da9uYlAnTMvVlqU1B15dgrwtRyh4M1ZmZ6x144N21tC3rlp/+mnxqZ+Ra/vZIfPjtsijjwXKy0MWLIsiESNqavPMPrDHyrCuHJO3/5njqBuq1jntqRjZqcD101RbVZf4+jEdGCGut4Y6/m51XSAnq4Mx9txASax+267uhlWDKR9au54Oh0RNlWVcPn5rzw+ceEIELMoMQBn5h6bbk1c64+axESh/vZnKl252KhqiFw7KZBeE8swIDEs6tldWG3huix0ojXf0GoJZM8BaayijdFxlxEvm3t5L3be0GWLXkfm0YM8tGj00+yWVTVDN+OkidVcbYTYjTExaE4E1s2npTJYzg0bIeCC1pFkTk2c7vhVSRRG4DhV0QygShNyQdDJ+dDRV1zWwsoiZ2AeBSBQ+b2i/IDqsGVSQG9JagyBIEGutfZB4YBVAgAaYhPAcxaTYc7mgUMxaMxMEAUIyM3TBvfCwyj7wDQQwyf8KfsERMWsCa6H+A89M9AV72eVmAAAAAElFTkSuQmCC`,_s=0;Array.isArray;function Q(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--_s,__i:-1,__u:0,__source:i,__self:a};if(typeof e==`function`&&(o=e.defaultProps))for(s in o)c[s]===void 0&&(c[s]=o[s]);return W.vnode&&W.vnode(l),l}function vs(){return Q(`svg`,{width:`50%`,height:`50%`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Q(`rect`,{x:`3`,y:`11`,width:`18`,height:`10`,rx:`2`}),Q(`circle`,{cx:`12`,cy:`5`,r:`2`}),Q(`path`,{d:`M12 7v4`}),Q(`line`,{x1:`8`,y1:`16`,x2:`8`,y2:`16`}),Q(`line`,{x1:`16`,y1:`16`,x2:`16`,y2:`16`})]})}function ys(){return Q(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,children:[Q(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),Q(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})}function bs(){return Q(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Q(`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}),Q(`path`,{d:`M3 3v5h5`})]})}function xs({title:e,subtitle:t,avatarUrl:n,onClose:r,onReset:i,hideClose:a=!1,compact:o=!1}){let[s,c]=Y(!1);return Q(`div`,{className:`ak-header${o?` ak-header--compact`:``}${s?` ak-header--confirming`:``}`,children:[Q(`div`,{className:`ak-header__row`,children:[Q(`span`,{className:`ak-header__face`,"aria-hidden":`true`,children:[n?Q(`img`,{src:n,alt:``,className:`ak-header__avatar`}):Q(`span`,{className:`ak-header__bot`,children:Q(vs,{})}),Q(`span`,{className:`ak-header__status`})]}),Q(`div`,{className:`ak-header__title-group`,children:[Q(`span`,{className:`ak-header__title`,children:e}),t&&Q(`span`,{className:`ak-header__subtitle`,children:t})]}),Q(`div`,{className:`ak-header__actions`,children:[i&&Q(`button`,{className:`ak-header__button${s?` ak-header__button--active`:``}`,onClick:()=>c(!0),"aria-label":`New conversation`,type:`button`,title:`Start a new conversation (Retains current conversation to memory)`,children:Q(bs,{})}),!a&&Q(`button`,{className:`ak-header__close`,onClick:r,"aria-label":`Close chat`,type:`button`,children:Q(ys,{})})]})]}),s&&Q(`div`,{className:`ak-header__confirm`,role:`alert`,children:[Q(`div`,{className:`ak-header__confirm-text`,children:[Q(`span`,{className:`ak-header__confirm-title`,children:`End this conversation?`}),Q(`span`,{className:`ak-header__confirm-sub`,children:`All messages will be removed`})]}),Q(`div`,{className:`ak-header__confirm-actions`,children:[Q(`button`,{className:`ak-header__confirm-cancel`,type:`button`,onClick:()=>c(!1),children:`Cancel`}),Q(`button`,{className:`ak-header__confirm-ok`,type:`button`,onClick:()=>{i?.(),c(!1)},children:`End chat`})]})]})]})}function Ss(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 Cs(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,`
|
|
2037
2061
|
|
|
2038
|
-
`)}function vs(e){let[,t]=Y(0);X(()=>{if(!e)return;let n=setInterval(()=>t(e=>e+1),1e3);return()=>clearInterval(n)},[e])}var ys=800;function bs({up:e}){return Q(`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:Q(`polyline`,{points:e?`18 15 12 9 6 15`:`6 9 12 15 18 9`})})}function xs({event:e,active:t}){return t?Q(`span`,{className:`ak-progress__spinner`,"aria-hidden":`true`}):Q(`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?Q(G,{children:[Q(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),Q(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]}):Q(`polyline`,{points:`20 6 9 17 4 12`})})}function Ss({events:e,live:t,answerStartedAtMs:n}){vs(t&&!n&&e.some(e=>e.status===`active`));let r=n??Date.now(),i=e[0]?.startedAtMs,a=e.reduce((e,t,n)=>t.status===`active`?n:e,-1);return Q(`ul`,{className:`ak-progress__steps`,role:`list`,children:e.map((e,n)=>{let o=t&&e.status===`active`,s=o&&n===a?ea(i?r-i:void 0):o?null:ea(e.durationMs);return Q(`li`,{className:o?`ak-progress__step ak-progress__step--active`:`ak-progress__step`,children:[Q(xs,{event:e,active:o}),Q(`span`,{className:`ak-progress__step-text`,children:e.text}),s&&Q(`span`,{className:`ak-progress__step-dur`,children:[`· `,s]})]},`${e.toolId??e.stage}-${n}`)})})}function Cs({events:e,answerStartedAtMs:t}){let[n,r]=Y(0),i=Math.min(n,e.length-1),a=i<e.length-1;X(()=>{if(!a)return;let t=setTimeout(()=>r(t=>Math.min(t+1,e.length-1)),ys);return()=>clearTimeout(t)},[a,i,e.length]);let o=e[i],s=!a&&o.status===`done`;vs(!s&&!t);let c=e[0]?.startedAtMs,l=s?null:ea(c?(t??Date.now())-c:void 0);return Q(`ul`,{className:`ak-progress__list`,role:`list`,children:Q(`li`,{className:`ak-progress__item ak-progress__item--active`,children:[s?Q(xs,{event:o,active:!1}):Q(`span`,{className:`ak-progress__spinner`,"aria-hidden":`true`}),Q(`span`,{className:`ak-progress__text`,children:o.text}),l&&Q(`span`,{className:`ak-progress__step-dur`,children:[`· `,l]})]})})}function ws({ackText:e,events:t=[],collapsed:n=!0,isComplete:r=!1,turnMeta:i,answerStartedAtMs:a}){let[o,s]=Y(!n);X(()=>{r&&s(!n)},[r]);let c=i?.mode;if(!r)return t.length===0?e?Q(`ul`,{className:`ak-progress__list`,role:`list`,children:Q(`li`,{className:`ak-progress__item ak-progress__item--active`,children:[Q(`span`,{className:`ak-progress__spinner`,"aria-hidden":`true`}),Q(`span`,{className:`ak-progress__text`,children:e})]})}):null:c===`detailed`?Q(Ss,{events:t,live:!0,answerStartedAtMs:a}):Q(Cs,{events:t,answerStartedAtMs:a});let l=ea(i?.totalMs),u=l?`Worked for ${l}`:`Finished working`;return c===`detailed`&&t.length>0?Q(`div`,{className:`ak-progress`,children:[Q(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`ak-progress__summary`,"aria-expanded":o,"aria-label":o?`Hide working steps`:`Show working steps`,children:[Q(xs,{event:{stage:``,text:``,timestamp:``,status:`done`},active:!1}),Q(`span`,{children:u}),Q(`span`,{className:`ak-progress__step-dur`,children:[`· `,t.length,` step`,t.length===1?``:`s`]}),Q(bs,{up:o})]}),o&&Q(Ss,{events:t,live:!1})]}):c===`standard`&&i?Q(`div`,{className:`ak-progress`,children:Q(`p`,{className:`ak-progress__summary ak-progress__summary--static`,children:[Q(xs,{event:{stage:``,text:``,timestamp:``,status:`done`},active:!1}),Q(`span`,{children:u})]})}):null}function Ts(){return Q(`svg`,{className:`ak-agent-status__icon`,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:Q(`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 Es({status:e}){return Q(`div`,{className:`ak-agent-status`,role:`status`,"aria-live":`polite`,children:[Q(Ts,{}),Q(`span`,{className:`ak-agent-status__text`,children:e})]})}function Ds({messageId:e,images:t,onCellClick:n}){if(t.length===0)return null;let r=t.length;if(r===1){let e=t[0];return Q(`div`,{className:`ak-gallery ak-gallery--single`,children:[Q(`button`,{type:`button`,onClick:()=>n(0),className:`ak-gallery__cell ak-gallery__cell--hero`,"aria-label":`Open image preview`,children:Q(`img`,{src:e.src,alt:e.alt,className:`ak-gallery__img ak-gallery__img--contain`})}),Q(`a`,{href:gs(e.downloadHref)??void 0,download:!0,className:`ak-message__image-dl-icon`,title:`Download image`,onClick:e=>e.stopPropagation(),children:Q(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Q(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),Q(`polyline`,{points:`7 10 12 15 17 10`}),Q(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})})]})}if(r===2)return Q(`div`,{className:`ak-gallery ak-gallery--two`,children:t.map((t,r)=>Q(Os,{src:t.src,alt:t.alt,onClick:()=>n(r)},t.key??`${e}-${r}`))});if(r===3)return Q(`div`,{className:`ak-gallery ak-gallery--three`,children:[Q(Os,{src:t[0].src,alt:t[0].alt,onClick:()=>n(0)},t[0].key??`${e}-0`),Q(`div`,{className:`ak-gallery__col`,children:[Q(Os,{src:t[1].src,alt:t[1].alt,onClick:()=>n(1)},t[1].key??`${e}-1`),Q(Os,{src:t[2].src,alt:t[2].alt,onClick:()=>n(2)},t[2].key??`${e}-2`)]})]});let i=t.slice(0,4),a=r>4?r-4:0;return Q(`div`,{className:`ak-gallery ak-gallery--grid`,children:i.map((t,r)=>{let o=r===i.length-1;return Q(Os,{src:t.src,alt:t.alt,overlayCount:o&&a>0?a:0,onClick:()=>n(r)},t.key??`${e}-${r}`)})})}function Os({src:e,alt:t,overlayCount:n=0,onClick:r}){return Q(`button`,{type:`button`,onClick:r,className:`ak-gallery__cell`,"aria-label":`Open image preview`,children:[Q(`img`,{src:e,alt:t,className:`ak-gallery__img`,loading:`lazy`}),n>0&&Q(`span`,{className:`ak-gallery__overlay`,children:[`+`,n]})]})}function ks({images:e,index:t,onClose:n,onIndexChange:r}){let i=t!==null,a=i&&t!==null?Math.min(Math.max(0,t),e.length-1):0,o=i?e[a]:null;return X(()=>{if(!i)return;let t=t=>{t.key===`Escape`?(t.stopPropagation(),n()):t.key===`ArrowLeft`&&e.length>1?(t.preventDefault(),r((a-1+e.length)%e.length)):t.key===`ArrowRight`&&e.length>1&&(t.preventDefault(),r((a+1)%e.length))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[i,a,e.length,n,r]),!i||!o?null:Q(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Image preview`,className:`ak-lightbox`,onClick:n,children:[Q(`div`,{className:`ak-lightbox__toolbar`,onClick:e=>e.stopPropagation(),children:[e.length>1&&Q(`span`,{className:`ak-lightbox__counter`,children:[a+1,` / `,e.length]}),Q(`a`,{href:gs(o.downloadHref)??void 0,download:!0,target:`_blank`,rel:`noopener noreferrer`,className:`ak-lightbox__btn`,title:`Download image`,"aria-label":`Download image`,children:Q(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Q(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),Q(`polyline`,{points:`7 10 12 15 17 10`}),Q(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})}),Q(`button`,{type:`button`,onClick:n,className:`ak-lightbox__btn`,title:`Close`,"aria-label":`Close image preview`,children:Q(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Q(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),Q(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),e.length>1&&Q(G,{children:[Q(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),r((a-1+e.length)%e.length)},className:`ak-lightbox__nav ak-lightbox__nav--prev`,"aria-label":`Previous image`,children:Q(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:Q(`polyline`,{points:`15 18 9 12 15 6`})})}),Q(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),r((a+1)%e.length)},className:`ak-lightbox__nav ak-lightbox__nav--next`,"aria-label":`Next image`,children:Q(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:Q(`polyline`,{points:`9 18 15 12 9 6`})})})]}),Q(`img`,{src:o.src,alt:o.alt??`Image preview`,className:`ak-lightbox__img`,onClick:e=>e.stopPropagation()})]})}function As({url:e,mimeType:t,fileName:n}){let r=(()=>{if(n)return n;try{let t=new URL(e).pathname.split(`/`);return(t[t.length-1]||`attachment`).replace(/^\d{10,}-/,``)}catch{return`attachment`}})(),i=r.split(`.`).pop()?.toUpperCase()??``,a=t===`application/pdf`||i===`PDF`?{variant:`pdf`,label:`PDF`}:t===`text/csv`||i===`CSV`?{variant:`csv`,label:`CSV`}:t===`text/markdown`||i===`MD`?{variant:`md`,label:`MD`}:t===`text/plain`||i===`TXT`?{variant:`txt`,label:`TXT`}:{variant:`default`,label:i||`FILE`};return Q(`a`,{href:gs(e)??void 0,target:`_blank`,rel:`noopener noreferrer`,className:`ak-file-chip`,title:r,children:[Q(`span`,{className:`ak-file-chip__icon ak-file-chip__icon--${a.variant}`,"aria-hidden":!0,children:Q(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Q(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),Q(`polyline`,{points:`14 2 14 8 20 8`})]})}),Q(`span`,{className:`ak-file-chip__body`,children:[Q(`span`,{className:`ak-file-chip__name`,children:r}),Q(`span`,{className:`ak-file-chip__label`,children:a.label})]})]})}function js({url:e,mimeType:t,transcript:n}){return Q(`div`,{className:`ak-audio-chip`,children:[Q(`audio`,{controls:!0,src:e,className:`ak-audio-chip__player`,"aria-label":`Voice note`,children:Q(`source`,{src:e,type:t})}),n&&Q(`p`,{className:`ak-audio-chip__transcript`,children:n})]})}function Ms(e){try{return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}catch{return``}}var Ns=/(`[^`\n]+`|\*\*[^*\n]+\*\*|\*[^*\n]+\*|!\[[^\]\n]*\]\([^)\n]+\)|\[[^\]\n]+\]\([^)\n]+\))/g;function $(e){let t=[],n=0,r=0;Ns.lastIndex=0;let i;for(;(i=Ns.exec(e))!==null;){i.index>n&&t.push(e.slice(n,i.index));let a=i[0];if(a.startsWith("`"))t.push(Q(`code`,{className:`ak-md-ic`,children:a.slice(1,-1)},r++));else if(a.startsWith(`**`))t.push(Q(`strong`,{children:a.slice(2,-2)},r++));else if(a.startsWith(`*`))t.push(Q(`em`,{children:a.slice(1,-1)},r++));else if(a.startsWith(`![`)){let e=a.match(/!\[([^\]]*)\]\(([^)]+)\)/),n=gs(e?.[2]);e&&n?t.push(Q(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:e[1]||`image`},r++)):e&&t.push(e[1]||`image`)}else{let e=a.match(/\[(.+?)\]\((.+?)\)/),n=gs(e?.[2]);e&&n?t.push(Q(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:e[1]},r++)):e?t.push(e[1]):t.push(a)}n=i.index+a.length}return n<e.length&&t.push(e.slice(n)),t}function Ps(e){e=_s(e);let t=e.split(`
|
|
2062
|
+
`)}function ws(e){let[,t]=Y(0);X(()=>{if(!e)return;let n=setInterval(()=>t(e=>e+1),1e3);return()=>clearInterval(n)},[e])}var Ts=800;function Es({up:e}){return Q(`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:Q(`polyline`,{points:e?`18 15 12 9 6 15`:`6 9 12 15 18 9`})})}function Ds({event:e,active:t}){return t?Q(`span`,{className:`ak-progress__spinner`,"aria-hidden":`true`}):Q(`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?Q(K,{children:[Q(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),Q(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]}):Q(`polyline`,{points:`20 6 9 17 4 12`})})}function Os({events:e,live:t,answerStartedAtMs:n}){ws(t&&!n&&e.some(e=>e.status===`active`));let r=n??Date.now(),i=e[0]?.startedAtMs,a=e.reduce((e,t,n)=>t.status===`active`?n:e,-1);return Q(`ul`,{className:`ak-progress__steps`,role:`list`,children:e.map((e,n)=>{let o=t&&e.status===`active`,s=o&&n===a?$i(i?r-i:void 0):o?null:$i(e.durationMs);return Q(`li`,{className:o?`ak-progress__step ak-progress__step--active`:`ak-progress__step`,children:[Q(Ds,{event:e,active:o}),Q(`span`,{className:`ak-progress__step-text`,children:e.text}),s&&Q(`span`,{className:`ak-progress__step-dur`,children:[`· `,s]})]},`${e.toolId??e.stage}-${n}`)})})}function ks({events:e,answerStartedAtMs:t}){let[n,r]=Y(0),i=Math.min(n,e.length-1),a=i<e.length-1;X(()=>{if(!a)return;let t=setTimeout(()=>r(t=>Math.min(t+1,e.length-1)),Ts);return()=>clearTimeout(t)},[a,i,e.length]);let o=e[i],s=!a&&o.status===`done`;ws(!s&&!t);let c=e[0]?.startedAtMs,l=s?null:$i(c?(t??Date.now())-c:void 0);return Q(`ul`,{className:`ak-progress__list`,role:`list`,children:Q(`li`,{className:`ak-progress__item ak-progress__item--active`,children:[s?Q(Ds,{event:o,active:!1}):Q(`span`,{className:`ak-progress__spinner`,"aria-hidden":`true`}),Q(`span`,{className:`ak-progress__text`,children:o.text}),l&&Q(`span`,{className:`ak-progress__step-dur`,children:[`· `,l]})]})})}function As({ackText:e,events:t=[],collapsed:n=!0,isComplete:r=!1,turnMeta:i,answerStartedAtMs:a}){let[o,s]=Y(!n);X(()=>{r&&s(!n)},[r]);let c=i?.mode;if(!r)return t.length===0?e?Q(`ul`,{className:`ak-progress__list`,role:`list`,children:Q(`li`,{className:`ak-progress__item ak-progress__item--active`,children:[Q(`span`,{className:`ak-progress__spinner`,"aria-hidden":`true`}),Q(`span`,{className:`ak-progress__text`,children:e})]})}):null:c===`detailed`?Q(Os,{events:t,live:!0,answerStartedAtMs:a}):Q(ks,{events:t,answerStartedAtMs:a});let l=$i(i?.totalMs),u=l?`Worked for ${l}`:`Finished working`;return c===`detailed`&&t.length>0?Q(`div`,{className:`ak-progress`,children:[Q(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`ak-progress__summary`,"aria-expanded":o,"aria-label":o?`Hide working steps`:`Show working steps`,children:[Q(Ds,{event:{stage:``,text:``,timestamp:``,status:`done`},active:!1}),Q(`span`,{children:u}),Q(`span`,{className:`ak-progress__step-dur`,children:[`· `,t.length,` step`,t.length===1?``:`s`]}),Q(Es,{up:o})]}),o&&Q(Os,{events:t,live:!1})]}):c===`standard`&&i?Q(`div`,{className:`ak-progress`,children:Q(`p`,{className:`ak-progress__summary ak-progress__summary--static`,children:[Q(Ds,{event:{stage:``,text:``,timestamp:``,status:`done`},active:!1}),Q(`span`,{children:u})]})}):null}function js(){return Q(`svg`,{className:`ak-agent-status__icon`,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:Q(`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 Ms({status:e}){return Q(`div`,{className:`ak-agent-status`,role:`status`,"aria-live":`polite`,children:[Q(js,{}),Q(`span`,{className:`ak-agent-status__text`,children:e})]})}function Ns({messageId:e,images:t,onCellClick:n}){if(t.length===0)return null;let r=t.length;if(r===1){let e=t[0];return Q(`div`,{className:`ak-gallery ak-gallery--single`,children:[Q(`button`,{type:`button`,onClick:()=>n(0),className:`ak-gallery__cell ak-gallery__cell--hero`,"aria-label":`Open image preview`,children:Q(`img`,{src:e.src,alt:e.alt,className:`ak-gallery__img ak-gallery__img--contain`})}),Q(`a`,{href:Ss(e.downloadHref)??void 0,download:!0,className:`ak-message__image-dl-icon`,title:`Download image`,onClick:e=>e.stopPropagation(),children:Q(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Q(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),Q(`polyline`,{points:`7 10 12 15 17 10`}),Q(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})})]})}if(r===2)return Q(`div`,{className:`ak-gallery ak-gallery--two`,children:t.map((t,r)=>Q(Ps,{src:t.src,alt:t.alt,onClick:()=>n(r)},t.key??`${e}-${r}`))});if(r===3)return Q(`div`,{className:`ak-gallery ak-gallery--three`,children:[Q(Ps,{src:t[0].src,alt:t[0].alt,onClick:()=>n(0)},t[0].key??`${e}-0`),Q(`div`,{className:`ak-gallery__col`,children:[Q(Ps,{src:t[1].src,alt:t[1].alt,onClick:()=>n(1)},t[1].key??`${e}-1`),Q(Ps,{src:t[2].src,alt:t[2].alt,onClick:()=>n(2)},t[2].key??`${e}-2`)]})]});let i=t.slice(0,4),a=r>4?r-4:0;return Q(`div`,{className:`ak-gallery ak-gallery--grid`,children:i.map((t,r)=>{let o=r===i.length-1;return Q(Ps,{src:t.src,alt:t.alt,overlayCount:o&&a>0?a:0,onClick:()=>n(r)},t.key??`${e}-${r}`)})})}function Ps({src:e,alt:t,overlayCount:n=0,onClick:r}){return Q(`button`,{type:`button`,onClick:r,className:`ak-gallery__cell`,"aria-label":`Open image preview`,children:[Q(`img`,{src:e,alt:t,className:`ak-gallery__img`,loading:`lazy`}),n>0&&Q(`span`,{className:`ak-gallery__overlay`,children:[`+`,n]})]})}function Fs({images:e,index:t,onClose:n,onIndexChange:r}){let i=t!==null,a=i&&t!==null?Math.min(Math.max(0,t),e.length-1):0,o=i?e[a]:null;return X(()=>{if(!i)return;let t=t=>{t.key===`Escape`?(t.stopPropagation(),n()):t.key===`ArrowLeft`&&e.length>1?(t.preventDefault(),r((a-1+e.length)%e.length)):t.key===`ArrowRight`&&e.length>1&&(t.preventDefault(),r((a+1)%e.length))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[i,a,e.length,n,r]),!i||!o?null:Q(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Image preview`,className:`ak-lightbox`,onClick:n,children:[Q(`div`,{className:`ak-lightbox__toolbar`,onClick:e=>e.stopPropagation(),children:[e.length>1&&Q(`span`,{className:`ak-lightbox__counter`,children:[a+1,` / `,e.length]}),Q(`a`,{href:Ss(o.downloadHref)??void 0,download:!0,target:`_blank`,rel:`noopener noreferrer`,className:`ak-lightbox__btn`,title:`Download image`,"aria-label":`Download image`,children:Q(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Q(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),Q(`polyline`,{points:`7 10 12 15 17 10`}),Q(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})}),Q(`button`,{type:`button`,onClick:n,className:`ak-lightbox__btn`,title:`Close`,"aria-label":`Close image preview`,children:Q(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Q(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),Q(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),e.length>1&&Q(K,{children:[Q(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),r((a-1+e.length)%e.length)},className:`ak-lightbox__nav ak-lightbox__nav--prev`,"aria-label":`Previous image`,children:Q(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:Q(`polyline`,{points:`15 18 9 12 15 6`})})}),Q(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),r((a+1)%e.length)},className:`ak-lightbox__nav ak-lightbox__nav--next`,"aria-label":`Next image`,children:Q(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:Q(`polyline`,{points:`9 18 15 12 9 6`})})})]}),Q(`img`,{src:o.src,alt:o.alt??`Image preview`,className:`ak-lightbox__img`,onClick:e=>e.stopPropagation()})]})}function Is({url:e,mimeType:t,fileName:n}){let r=(()=>{if(n)return n;try{let t=new URL(e).pathname.split(`/`);return(t[t.length-1]||`attachment`).replace(/^\d{10,}-/,``)}catch{return`attachment`}})(),i=r.split(`.`).pop()?.toUpperCase()??``,a=t===`application/pdf`||i===`PDF`?{variant:`pdf`,label:`PDF`}:t===`text/csv`||i===`CSV`?{variant:`csv`,label:`CSV`}:t===`text/markdown`||i===`MD`?{variant:`md`,label:`MD`}:t===`text/plain`||i===`TXT`?{variant:`txt`,label:`TXT`}:{variant:`default`,label:i||`FILE`};return Q(`a`,{href:Ss(e)??void 0,target:`_blank`,rel:`noopener noreferrer`,className:`ak-file-chip`,title:r,children:[Q(`span`,{className:`ak-file-chip__icon ak-file-chip__icon--${a.variant}`,"aria-hidden":!0,children:Q(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Q(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),Q(`polyline`,{points:`14 2 14 8 20 8`})]})}),Q(`span`,{className:`ak-file-chip__body`,children:[Q(`span`,{className:`ak-file-chip__name`,children:r}),Q(`span`,{className:`ak-file-chip__label`,children:a.label})]})]})}function Ls({url:e,mimeType:t,transcript:n}){return Q(`div`,{className:`ak-audio-chip`,children:[Q(`audio`,{controls:!0,src:e,className:`ak-audio-chip__player`,"aria-label":`Voice note`,children:Q(`source`,{src:e,type:t})}),n&&Q(`p`,{className:`ak-audio-chip__transcript`,children:n})]})}function Rs(e){try{return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}catch{return``}}var zs=/(`[^`\n]+`|\*\*[^*\n]+\*\*|\*[^*\n]+\*|!\[[^\]\n]*\]\([^)\n]+\)|\[[^\]\n]+\]\([^)\n]+\))/g;function $(e){let t=[],n=0,r=0;zs.lastIndex=0;let i;for(;(i=zs.exec(e))!==null;){i.index>n&&t.push(e.slice(n,i.index));let a=i[0];if(a.startsWith("`"))t.push(Q(`code`,{className:`ak-md-ic`,children:a.slice(1,-1)},r++));else if(a.startsWith(`**`))t.push(Q(`strong`,{children:a.slice(2,-2)},r++));else if(a.startsWith(`*`))t.push(Q(`em`,{children:a.slice(1,-1)},r++));else if(a.startsWith(`![`)){let e=a.match(/!\[([^\]]*)\]\(([^)]+)\)/),n=Ss(e?.[2]);e&&n?t.push(Q(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:e[1]||`image`},r++)):e&&t.push(e[1]||`image`)}else{let e=a.match(/\[(.+?)\]\((.+?)\)/),n=Ss(e?.[2]);e&&n?t.push(Q(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:e[1]},r++)):e?t.push(e[1]):t.push(a)}n=i.index+a.length}return n<e.length&&t.push(e.slice(n)),t}function Bs(e){e=Cs(e);let t=e.split(`
|
|
2039
2063
|
`),n=[],r=0,i=0;for(;r<t.length;){let e=t[r],a=e.match(/^(\s*)```/);if(a){let o=a[1],s=e.trimStart().match(/^```(\w+)?\s*$/)?.[1]||``,c=[];for(r++;r<t.length&&!t[r].trimStart().startsWith("```");)c.push(t[r].startsWith(o)?t[r].slice(o.length):t[r]),r++;r<t.length&&t[r].trimStart().startsWith("```")&&r++,n.push(Q(`div`,{className:`ak-md-pre-wrap`,children:[s&&Q(`span`,{className:`ak-md-pre-lang`,children:s}),Q(`pre`,{className:`ak-md-pre${s?` ak-md-pre--${s}`:``}`,children:Q(`code`,{className:`ak-md-code`,children:c.join(`
|
|
2040
|
-
`)})})]},i++));continue}let o=e.match(/^(#{1,6})(\s+.*)?$/);if(o){let e=o[1].length,t=o[2]?$(o[2].trim()):``;e===1?n.push(Q(`h1`,{className:`ak-md-h1`,children:t},i++)):e===2?n.push(Q(`h2`,{className:`ak-md-h2`,children:t},i++)):e===3?n.push(Q(`h3`,{className:`ak-md-h3`,children:t},i++)):e===4?n.push(Q(`h4`,{className:`ak-md-h4`,children:t},i++)):e===5?n.push(Q(`h5`,{className:`ak-md-h5`,children:t},i++)):n.push(Q(`h6`,{className:`ak-md-h6`,children:t},i++)),r++;continue}if(/^[-*_]{3,}$/.test(e.trim())){n.push(Q(`hr`,{className:`ak-md-hr`},i++)),r++;continue}if(/^[-*+]\s/.test(e)){let e=[],a=r;for(;a<t.length&&(/^[-*+]\s/.test(t[a])||t[a].trim()===``);){if(t[a].trim()===``){a++;continue}let n=t[a].length-t[a].trimStart().length,r=t[a].replace(/^[-*+]\s+/,``),i=[],o=[],s=a+1;for(;s<t.length&&s<a+20;){let e=t[s];if(e.length-e.trimStart().length>n&&e.trim()!==``){let t=e.trim();/^[-*+]\s/.test(t)?i.push(Q(`li`,{children:$(t.replace(/^[-*+]\s+/,``))},`nested-${s}`)):o.push(Q(`p`,{style:{margin:`0.2em 0 0`},children:$(t)},`cont-${s}`)),s++}else break}let c=o.length>0||i.length>0?Q(G,{children:[$(r),o,i.length>0&&Q(`ul`,{style:{margin:`0.2em 0 0`,paddingLeft:`1.2em`},children:i})]}):$(r);e.push(Q(`li`,{children:c},`item-${a}`)),a=s}n.push(Q(`ul`,{className:`ak-md-ul`,children:e},i++)),r=a;continue}if(/^\d+\.\s/.test(e)){let e=[],a=r;for(;a<t.length&&(/^\d+\.\s/.test(t[a])||t[a].trim()===``);){if(t[a].trim()===``){a++;continue}let n=t[a].length-t[a].trimStart().length,r=t[a].replace(/^\d+\.\s+/,``),i=[],o=[],s=a+1;for(;s<t.length&&s<a+20;){let e=t[s];if(e.length-e.trimStart().length>n&&e.trim()!==``){let t=e.trim();/^\d+\.\s/.test(t)?i.push(Q(`li`,{children:$(t.replace(/^\d+\.\s+/,``))},`nested-order-${s}`)):/^[-*+]\s/.test(t)?i.push(Q(`li`,{children:$(t.replace(/^[-*+]\s+/,``))},`nested-unorder-${s}`)):o.push(Q(`p`,{style:{margin:`0.2em 0 0`},children:$(t)},`cont-${s}`)),s++}else break}let c=o.length>0||i.length>0?Q(G,{children:[$(r),o,i.length>0&&Q(`ol`,{style:{margin:`0.2em 0 0`,paddingLeft:`1.2em`},children:i})]}):$(r);e.push(Q(`li`,{children:c},`order-item-${a}`)),a=s}n.push(Q(`ol`,{className:`ak-md-ol`,children:e},i++)),r=a;continue}if(e.trim()===``){r++;continue}if(e.includes(`|`)&&r+1<t.length&&t[r+1].includes(`|`)){let a=t[r+1];if(/^\s*\|?[\s:|*-]+\|[\s:|*-|]+\|?[\s:|*-]*$/.test(a)){let o=e.split(`|`).map(e=>e.trim()).filter(e=>e.length>0),s=a.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<=o.length),c=[],l=r+2;for(;l<t.length&&t[l].includes(`|`)&&t[l].trim()!==``;){let e=t[l].split(`|`).map(e=>e.trim()).filter(e=>e.length>0);if(e.length>0)c.push(e),l++;else break}n.push(Q(`table`,{className:`ak-md-table`,children:[Q(`thead`,{children:Q(`tr`,{children:o.map((e,t)=>Q(`th`,{style:{textAlign:s[t]||`left`},className:`ak-md-th`,children:$(e)},`th-${t}`))})}),Q(`tbody`,{children:c.map((e,t)=>Q(`tr`,{children:o.map((n,r)=>Q(`td`,{style:{textAlign:s[r]||`left`},className:`ak-md-td`,children:e[r]?$(e[r]):``},`td-${t}-${r}`))},`tr-${t}`))})]},i++)),r=l;continue}}let s=[];for(;r<t.length&&t[r].trim()!==``&&!t[r].startsWith(`#`)&&!/^\s*```/.test(t[r])&&!/^[-*+]\s/.test(t[r])&&!/^\d+\.\s/.test(t[r])&&!/^[-*_]{3,}$/.test(t[r].trim());)s.push(t[r]),r++;if(s.length>0){let e=[];s.forEach((t,n)=>{e.push(...$(t)),n<s.length-1&&e.push(Q(`br`,{},`br-${n}`))}),n.push(Q(`p`,{className:`ak-md-p`,children:e},i++))}}return Q(G,{children:n})}function Fs({message:e}){let[t,n]=Y(null),[r,i]=Y(null),a=e.role===`user`,o=e.status===`error`,s=e.status===`streaming`,c=!!(e.images&&e.images.length>0),l=!!(e.documents&&e.documents.length>0),u=(()=>{if(!a)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`}]:[]})(),d=a?(e.uploadedAttachments??[]).filter(e=>e.kind===`file`):[],f=a?(e.uploadedAttachments??[]).filter(e=>e.kind===`audio`):[],p=u.length>0,m=d.length>0,h=f.length>0,g=c||p,_=a&&h?ra(e.content):null,v=_?_.rest:e.content,y=!!e.progressEvents&&e.progressEvents.length>0,b=s&&!e.content&&!e.toolStatus&&!y,x=!a&&!o,S=!!e.isHuman&&!a,C=a?`ak-message--user`:o?`ak-message--assistant ak-message--error`:S?`ak-message--assistant ak-message--operator`:`ak-message--assistant`,w=[`ak-message__bubble`,x?`ak-message__bubble--md`:``,g?`ak-message__bubble--has-image`:``,S?`ak-message__bubble--operator`:``].filter(Boolean).join(` `),T=S?e.senderDisplay?.trim()||`Operator`:null,ee=T?T.charAt(0).toUpperCase():``,te=Q(`div`,{className:w,children:[p&&Q(Ds,{messageId:`${e.id}-up`,images:u.map(e=>({src:e.url,alt:e.fileName??`Uploaded image`,downloadHref:e.url})),onCellClick:e=>n(e)}),m&&Q(`div`,{className:`ak-message__files`,children:d.map((t,n)=>Q(As,{url:t.url,mimeType:t.mimeType,fileName:t.fileName},`${e.id}-up-file-${n}`))}),h&&Q(`div`,{className:`ak-message__files`,children:f.map((t,n)=>Q(js,{url:t.url,mimeType:t.mimeType,transcript:n===0?_?.transcript??null:null},`${e.id}-up-audio-${n}`))}),c&&Q(Ds,{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=>i(e)}),l&&Q(`div`,{className:`ak-message__files`,children:e.documents.map((t,n)=>t.url?Q(As,{url:t.url,mimeType:t.mimeType,fileName:t.fileName},`${e.id}-asst-doc-${n}`):null)}),v&&Q(`div`,{className:g?`ak-message__image-caption`:void 0,children:[x?Ps(v):v,s&&Q(`span`,{className:`ak-cursor`,"aria-hidden":`true`,children:[Q(`span`,{className:`ak-cursor__dot`}),Q(`span`,{className:`ak-cursor__dot`}),Q(`span`,{className:`ak-cursor__dot`})]})]}),Q(`span`,{className:`ak-message__time`,children:Ms(e.createdAt)})]}),E=!!e.content||g||m||l||!s&&!e.toolStatus;return Q(`div`,{className:`ak-message ${C}`,children:[!a&&(e.ackText||e.progressEvents&&e.progressEvents.length>0||e.turnMeta)&&Q(ws,{ackText:e.ackText,events:e.progressEvents,collapsed:e.progressCollapsed,isComplete:!s,turnMeta:e.turnMeta,answerStartedAtMs:e.answerStartedAtMs}),b&&Q(`div`,{className:`ak-typing-row`,role:`status`,"aria-label":`Assistant is typing`,children:[Q(`span`,{className:`ak-typing-row__dot`}),Q(`span`,{className:`ak-typing-row__dot`}),Q(`span`,{className:`ak-typing-row__dot`})]}),!a&&e.toolStatus&&!(e.progressEvents&&e.progressEvents.length>0)&&Q(Es,{status:e.toolStatus}),S&&Q(`span`,{className:`ak-message__sender-label`,children:[Q(`span`,{className:`ak-message__operator-avatar`,"aria-hidden":`true`,children:ee}),Q(`span`,{className:`ak-message__operator-name`,children:T})]}),E&&te,u.length>0&&Q(ks,{images:u.map(e=>({src:e.url,alt:e.fileName??`Uploaded image`,downloadHref:e.url})),index:t,onClose:()=>n(null),onIndexChange:n}),c&&Q(ks,{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:r,onClose:()=>i(null),onIndexChange:i})]})}function Is(){return Q(`div`,{className:`ak-typing`,"aria-label":`Assistant is typing`,children:[Q(`span`,{className:`ak-typing__dot`}),Q(`span`,{className:`ak-typing__dot`}),Q(`span`,{className:`ak-typing__dot`})]})}function Ls(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 Rs({messages:e,isLoading:t,operatorFallbackLabel:n=`Operator`}){let r=Z(null),i=Z(null),a=Z(!0),o=Do(()=>Ls(e,n),[e,n]);return X(()=>{if(!(r.current?.parentElement??r.current))return;let e=e=>{a.current=e.scrollHeight-e.scrollTop-e.clientHeight<120},t=r.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)},[]),X(()=>{e[e.length-1]?.role===`user`&&(a.current=!0),a.current&&i.current?.scrollIntoView({behavior:`smooth`})},[e]),X(()=>{a.current&&i.current?.scrollIntoView({behavior:`smooth`})},[t,e.find(e=>e.status===`streaming`)?.content??``]),Q(`div`,{ref:r,className:`ak-messages`,role:`log`,"aria-live":`polite`,"aria-label":`Conversation`,children:[o.map(e=>e.kind===`divider`?Q(`div`,{className:`ak-handoff-divider`,role:`separator`,children:Q(`span`,{className:`ak-handoff-divider__label`,children:e.label})},e.id):Q(Fs,{message:e.message},e.message.id)),t&&!e.some(e=>e.status===`streaming`)&&Q(Is,{}),Q(`div`,{ref:i})]})}function zs(){return Q(`svg`,{width:`30`,height:`30`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[Q(`rect`,{x:`3`,y:`11`,width:`18`,height:`10`,rx:`2`}),Q(`circle`,{cx:`12`,cy:`5`,r:`2`}),Q(`path`,{d:`M12 7v4`}),Q(`line`,{x1:`8`,y1:`16`,x2:`8`,y2:`16`}),Q(`line`,{x1:`16`,y1:`16`,x2:`16`,y2:`16`})]})}function Bs({title:e,description:t,suggestedQuestions:n,avatarUrl:r,onSelect:i}){let a=(n??[]).filter(e=>(e.title??``).trim().length>0);return Q(`div`,{className:`ak-empty-state`,"aria-label":`Start a conversation`,children:[Q(`div`,{className:`ak-empty-state__glow`,"aria-hidden":`true`}),Q(`div`,{className:`ak-empty-state__body`,children:[Q(`div`,{className:`ak-empty-state__avatar`,children:r?Q(`img`,{src:r,alt:``,className:`ak-empty-state__avatar-img`,"aria-hidden":`true`}):Q(`span`,{className:`ak-empty-state__bot-icon`,"aria-hidden":`true`,children:Q(zs,{})})}),Q(`p`,{className:`ak-empty-state__title`,children:e}),t&&Q(`p`,{className:`ak-empty-state__description`,children:t})]}),a.length>0&&Q(`div`,{className:`ak-empty-state__suggestions`,children:a.map((e,t)=>Q(`button`,{className:`ak-empty-state__suggestion`,onClick:()=>i?.(e.prompt??e.title),type:`button`,children:[Q(`span`,{className:`ak-empty-state__suggestion-title`,children:e.title}),e.description&&Q(`span`,{className:`ak-empty-state__suggestion-desc`,children:e.description})]},t))})]})}var Vs=`https://klicforge.ai/privacy-policy`,Hs=`https://klicforge.ai/terms-of-service`;function Us(){return Q(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Q(`line`,{x1:`22`,y1:`2`,x2:`11`,y2:`13`}),Q(`polygon`,{points:`22 2 15 22 11 13 2 9 22 2`})]})}function Ws(){return Q(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,children:[Q(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),Q(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]})}function Gs(){return Q(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Q(`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`}),Q(`circle`,{cx:`12`,cy:`13`,r:`4`})]})}function Ks(){return Q(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Q(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),Q(`polyline`,{points:`14 2 14 8 20 8`})]})}function qs(){return Q(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Q(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),Q(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})}function Js(){return Q(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Q(`path`,{d:`M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z`}),Q(`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`}),Q(`line`,{x1:`12`,y1:`19`,x2:`12`,y2:`23`}),Q(`line`,{x1:`8`,y1:`23`,x2:`16`,y2:`23`})]})}function Ys(){return Q(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`currentColor`,children:Q(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`})})}var Xs=[`application/pdf`,`text/markdown`,`text/plain`,`text/csv`],Zs=[`.pdf`,`.md`,`.txt`,`.csv`],Qs=[...Zs,...Xs].join(`,`),$s=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`],ec=$s.join(`,`),tc=[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`];function nc(){return typeof MediaRecorder>`u`?null:tc.find(e=>MediaRecorder.isTypeSupported(e))??null}function rc(e){return e.includes(`mp4`)?`mp4`:e.includes(`ogg`)?`ogg`:`webm`}function ic(e){let t=Math.floor(e/1e3),n=Math.floor(t/60),r=t%60;return`${n}:${String(r).padStart(2,`0`)}`}function ac(e){if(Xs.includes(e.type))return!0;let t=e.name.toLowerCase();return Zs.some(e=>t.endsWith(e))}function oc(e){return $s.includes(e.type)}function sc({onSend:e,disabled:t=!1,placeholder:n=`Type a message…`,photoSendingEnabled:r=!1,fileUploadEnabled:i=!1,voiceNoteEnabled:a=!1,voiceNoteMaxDurationSec:o=120,attachmentMaxCount:s=5,attachmentMaxFileSizeMb:c=1,onRecordingError:l}){let[u,d]=Y(``),[f,p]=Y([]),[m,h]=Y(new Map),[g,_]=Y(!1),[v,y]=Y(!1),[b,x]=Y(0),S=Z(null),C=Z(null),w=Z(null),T=Z(null),ee=Z(null),te=Z(null),E=Z(null),ne=Z([]),re=Z(null),ie=Z(0),ae=Z(null),oe=Z(!1),se=Z(!1),ce=Z(u);ce.current=u;let le=Z(f);le.current=f;let ue=Z(t);ue.current=t;let de=r||i,fe=Do(()=>c*1024*1024,[c]),pe=a&&typeof window<`u`&&typeof MediaRecorder<`u`&&!!navigator.mediaDevices?.getUserMedia;X(()=>()=>{m.forEach(e=>URL.revokeObjectURL(e))},[]);let me=Z(null);X(()=>{if(t)return;let e=me.current;me.current=t,!(e===null&&typeof window<`u`&&window.matchMedia?.(`(pointer: coarse)`).matches)&&S.current?.focus()},[t]);let he=Z(!1);X(()=>{v?te.current?.focus():he.current&&!ue.current&&S.current?.focus(),he.current=v},[v]);let ge=Oo(e=>{if(!g)return;let t=e.composedPath?e.composedPath():[],n=!!T.current&&t.includes(T.current),r=!!ee.current&&t.includes(ee.current);!n&&!r&&_(!1)},[g]);X(()=>{if(g)return document.addEventListener(`click`,ge),()=>document.removeEventListener(`click`,ge)},[g,ge]),X(()=>{de||_(!1)},[de]);function _e(){m.forEach(e=>URL.revokeObjectURL(e)),h(new Map),p([]),C.current&&(C.current.value=``),w.current&&(w.current.value=``)}function ve(e){p(t=>{let n=t[e];if(n){let e=m.get(n.file);e&&(URL.revokeObjectURL(e),h(e=>{let t=new Map(e);return t.delete(n.file),t}))}return t.filter((t,n)=>n!==e)})}function ye(){let n=u.trim();!n&&f.length===0||t||(e(n,f),d(``),_e(),S.current&&(S.current.style.height=`auto`))}let be=Oo(()=>{re.current?.getTracks().forEach(e=>e.stop()),re.current=null},[]);X(()=>()=>{ae.current&&clearInterval(ae.current),E.current&&E.current.state!==`inactive`&&(oe.current=!0,E.current.stop()),be()},[be]);async function xe(){if(!pe||v||se.current||t)return;if(f.length>=s){l?.(`Only ${s} attachments can be sent at once`);return}let n=nc();if(!n){l?.(`Voice recording is not supported in this browser`);return}se.current=!0;let r;try{r=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{se.current=!1,l?.(`Microphone access was denied`);return}se.current=!1,re.current=r,ne.current=[],oe.current=!1;let i=new MediaRecorder(r,{mimeType:n});i.ondataavailable=e=>{e.data.size>0&&ne.current.push(e.data)},i.onstop=()=>{be();let t=oe.current,r=Date.now()-ie.current,i=new Blob(ne.current,{type:n});if(ne.current=[],t||r<300||ue.current)return;let a=new File([i],`voice-note.${rc(n)}`,{type:n}),o=ce.current.trim(),c=[...le.current,{file:a,kind:`audio`,durationMs:r}];if(c.length>s){l?.(`Only ${s} attachments can be sent at once`);return}e(o,c),d(``),_e(),S.current&&(S.current.style.height=`auto`)},E.current=i,ie.current=Date.now(),x(0),i.start(),y(!0),ae.current=setInterval(()=>{let e=Date.now()-ie.current;x(e),e>=o*1e3&&Se(!1)},250)}function Se(e){ae.current&&=(clearInterval(ae.current),null),oe.current=e,E.current&&E.current.state!==`inactive`&&E.current.stop(),y(!1),x(0)}function Ce(e){e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ye())}function we(e){let t=e.currentTarget;d(t.value),t.style.height=`auto`,t.style.height=`${t.scrollHeight}px`}function Te(e,t){if(e.length===0)return;let n=[],r=[];for(let i of e){if(t===`image`&&!oc(i)){r.push(`${i.name} (image type not supported)`);continue}if(t===`file`&&!ac(i)){r.push(`${i.name} (file type not supported)`);continue}if(i.size>fe){r.push(`${i.name} (over ${c} MB)`);continue}n.push({file:i,kind:t})}p(e=>{let t=[...e,...n],i=t.slice(0,s);return t.length>s&&r.push(`max ${s} attachments allowed`),h(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(`
|
|
2041
|
-
• `)}`)}function
|
|
2042
|
-
`+cs(e)}function
|
|
2064
|
+
`)})})]},i++));continue}let o=e.match(/^(#{1,6})(\s+.*)?$/);if(o){let e=o[1].length,t=o[2]?$(o[2].trim()):``;e===1?n.push(Q(`h1`,{className:`ak-md-h1`,children:t},i++)):e===2?n.push(Q(`h2`,{className:`ak-md-h2`,children:t},i++)):e===3?n.push(Q(`h3`,{className:`ak-md-h3`,children:t},i++)):e===4?n.push(Q(`h4`,{className:`ak-md-h4`,children:t},i++)):e===5?n.push(Q(`h5`,{className:`ak-md-h5`,children:t},i++)):n.push(Q(`h6`,{className:`ak-md-h6`,children:t},i++)),r++;continue}if(/^[-*_]{3,}$/.test(e.trim())){n.push(Q(`hr`,{className:`ak-md-hr`},i++)),r++;continue}if(/^[-*+]\s/.test(e)){let e=[],a=r;for(;a<t.length&&(/^[-*+]\s/.test(t[a])||t[a].trim()===``);){if(t[a].trim()===``){a++;continue}let n=t[a].length-t[a].trimStart().length,r=t[a].replace(/^[-*+]\s+/,``),i=[],o=[],s=a+1;for(;s<t.length&&s<a+20;){let e=t[s];if(e.length-e.trimStart().length>n&&e.trim()!==``){let t=e.trim();/^[-*+]\s/.test(t)?i.push(Q(`li`,{children:$(t.replace(/^[-*+]\s+/,``))},`nested-${s}`)):o.push(Q(`p`,{style:{margin:`0.2em 0 0`},children:$(t)},`cont-${s}`)),s++}else break}let c=o.length>0||i.length>0?Q(K,{children:[$(r),o,i.length>0&&Q(`ul`,{style:{margin:`0.2em 0 0`,paddingLeft:`1.2em`},children:i})]}):$(r);e.push(Q(`li`,{children:c},`item-${a}`)),a=s}n.push(Q(`ul`,{className:`ak-md-ul`,children:e},i++)),r=a;continue}if(/^\d+\.\s/.test(e)){let e=[],a=r;for(;a<t.length&&(/^\d+\.\s/.test(t[a])||t[a].trim()===``);){if(t[a].trim()===``){a++;continue}let n=t[a].length-t[a].trimStart().length,r=t[a].replace(/^\d+\.\s+/,``),i=[],o=[],s=a+1;for(;s<t.length&&s<a+20;){let e=t[s];if(e.length-e.trimStart().length>n&&e.trim()!==``){let t=e.trim();/^\d+\.\s/.test(t)?i.push(Q(`li`,{children:$(t.replace(/^\d+\.\s+/,``))},`nested-order-${s}`)):/^[-*+]\s/.test(t)?i.push(Q(`li`,{children:$(t.replace(/^[-*+]\s+/,``))},`nested-unorder-${s}`)):o.push(Q(`p`,{style:{margin:`0.2em 0 0`},children:$(t)},`cont-${s}`)),s++}else break}let c=o.length>0||i.length>0?Q(K,{children:[$(r),o,i.length>0&&Q(`ol`,{style:{margin:`0.2em 0 0`,paddingLeft:`1.2em`},children:i})]}):$(r);e.push(Q(`li`,{children:c},`order-item-${a}`)),a=s}n.push(Q(`ol`,{className:`ak-md-ol`,children:e},i++)),r=a;continue}if(e.trim()===``){r++;continue}if(e.includes(`|`)&&r+1<t.length&&t[r+1].includes(`|`)){let a=t[r+1];if(/^\s*\|?[\s:|*-]+\|[\s:|*-|]+\|?[\s:|*-]*$/.test(a)){let o=e.split(`|`).map(e=>e.trim()).filter(e=>e.length>0),s=a.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<=o.length),c=[],l=r+2;for(;l<t.length&&t[l].includes(`|`)&&t[l].trim()!==``;){let e=t[l].split(`|`).map(e=>e.trim()).filter(e=>e.length>0);if(e.length>0)c.push(e),l++;else break}n.push(Q(`table`,{className:`ak-md-table`,children:[Q(`thead`,{children:Q(`tr`,{children:o.map((e,t)=>Q(`th`,{style:{textAlign:s[t]||`left`},className:`ak-md-th`,children:$(e)},`th-${t}`))})}),Q(`tbody`,{children:c.map((e,t)=>Q(`tr`,{children:o.map((n,r)=>Q(`td`,{style:{textAlign:s[r]||`left`},className:`ak-md-td`,children:e[r]?$(e[r]):``},`td-${t}-${r}`))},`tr-${t}`))})]},i++)),r=l;continue}}let s=[];for(;r<t.length&&t[r].trim()!==``&&!t[r].startsWith(`#`)&&!/^\s*```/.test(t[r])&&!/^[-*+]\s/.test(t[r])&&!/^\d+\.\s/.test(t[r])&&!/^[-*_]{3,}$/.test(t[r].trim());)s.push(t[r]),r++;if(s.length>0){let e=[];s.forEach((t,n)=>{e.push(...$(t)),n<s.length-1&&e.push(Q(`br`,{},`br-${n}`))}),n.push(Q(`p`,{className:`ak-md-p`,children:e},i++))}}return Q(K,{children:n})}function Vs({message:e}){let[t,n]=Y(null),[r,i]=Y(null),a=e.role===`user`,o=e.status===`error`,s=e.status===`streaming`,c=!!(e.images&&e.images.length>0),l=!!(e.documents&&e.documents.length>0),u=(()=>{if(!a)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`}]:[]})(),d=a?(e.uploadedAttachments??[]).filter(e=>e.kind===`file`):[],f=a?(e.uploadedAttachments??[]).filter(e=>e.kind===`audio`):[],p=u.length>0,m=d.length>0,h=f.length>0,g=c||p,_=a&&h?na(e.content):null,v=_?_.rest:e.content,y=!!e.progressEvents&&e.progressEvents.length>0,b=s&&!e.content&&!e.toolStatus&&!y,x=!a&&!o,S=!!e.isHuman&&!a,C=a?`ak-message--user`:o?`ak-message--assistant ak-message--error`:S?`ak-message--assistant ak-message--operator`:`ak-message--assistant`,w=[`ak-message__bubble`,x?`ak-message__bubble--md`:``,g?`ak-message__bubble--has-image`:``,S?`ak-message__bubble--operator`:``].filter(Boolean).join(` `),T=S?e.senderDisplay?.trim()||`Operator`:null,E=T?T.charAt(0).toUpperCase():``,ee=Q(`div`,{className:w,children:[p&&Q(Ns,{messageId:`${e.id}-up`,images:u.map(e=>({src:e.url,alt:e.fileName??`Uploaded image`,downloadHref:e.url})),onCellClick:e=>n(e)}),m&&Q(`div`,{className:`ak-message__files`,children:d.map((t,n)=>Q(Is,{url:t.url,mimeType:t.mimeType,fileName:t.fileName},`${e.id}-up-file-${n}`))}),h&&Q(`div`,{className:`ak-message__files`,children:f.map((t,n)=>Q(Ls,{url:t.url,mimeType:t.mimeType,transcript:n===0?_?.transcript??null:null},`${e.id}-up-audio-${n}`))}),c&&Q(Ns,{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=>i(e)}),l&&Q(`div`,{className:`ak-message__files`,children:e.documents.map((t,n)=>t.url?Q(Is,{url:t.url,mimeType:t.mimeType,fileName:t.fileName},`${e.id}-asst-doc-${n}`):null)}),v&&Q(`div`,{className:g?`ak-message__image-caption`:void 0,children:[x?Bs(v):v,s&&Q(`span`,{className:`ak-cursor`,"aria-hidden":`true`,children:[Q(`span`,{className:`ak-cursor__dot`}),Q(`span`,{className:`ak-cursor__dot`}),Q(`span`,{className:`ak-cursor__dot`})]})]}),Q(`span`,{className:`ak-message__time`,children:Rs(e.createdAt)})]}),D=!!e.content||g||m||l||!s&&!e.toolStatus;return Q(`div`,{className:`ak-message ${C}`,children:[!a&&(e.ackText||e.progressEvents&&e.progressEvents.length>0||e.turnMeta)&&Q(As,{ackText:e.ackText,events:e.progressEvents,collapsed:e.progressCollapsed,isComplete:!s,turnMeta:e.turnMeta,answerStartedAtMs:e.answerStartedAtMs}),b&&Q(`div`,{className:`ak-typing-row`,role:`status`,"aria-label":`Assistant is typing`,children:[Q(`span`,{className:`ak-typing-row__dot`}),Q(`span`,{className:`ak-typing-row__dot`}),Q(`span`,{className:`ak-typing-row__dot`})]}),!a&&e.toolStatus&&!(e.progressEvents&&e.progressEvents.length>0)&&Q(Ms,{status:e.toolStatus}),S&&Q(`span`,{className:`ak-message__sender-label`,children:[Q(`span`,{className:`ak-message__operator-avatar`,"aria-hidden":`true`,children:E}),Q(`span`,{className:`ak-message__operator-name`,children:T})]}),D&&ee,u.length>0&&Q(Fs,{images:u.map(e=>({src:e.url,alt:e.fileName??`Uploaded image`,downloadHref:e.url})),index:t,onClose:()=>n(null),onIndexChange:n}),c&&Q(Fs,{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:r,onClose:()=>i(null),onIndexChange:i})]})}function Hs(){return Q(`div`,{className:`ak-typing`,"aria-label":`Assistant is typing`,children:[Q(`span`,{className:`ak-typing__dot`}),Q(`span`,{className:`ak-typing__dot`}),Q(`span`,{className:`ak-typing__dot`})]})}function Us(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 Ws({messages:e,isLoading:t,operatorFallbackLabel:n=`Operator`}){let r=Z(null),i=Z(null),a=Z(!0),o=Do(()=>Us(e,n),[e,n]);return X(()=>{if(!(r.current?.parentElement??r.current))return;let e=e=>{a.current=e.scrollHeight-e.scrollTop-e.clientHeight<120},t=r.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)},[]),X(()=>{e[e.length-1]?.role===`user`&&(a.current=!0),a.current&&i.current?.scrollIntoView({behavior:`smooth`})},[e]),X(()=>{a.current&&i.current?.scrollIntoView({behavior:`smooth`})},[t,e.find(e=>e.status===`streaming`)?.content??``]),Q(`div`,{ref:r,className:`ak-messages`,role:`log`,"aria-live":`polite`,"aria-label":`Conversation`,children:[o.map(e=>e.kind===`divider`?Q(`div`,{className:`ak-handoff-divider`,role:`separator`,children:Q(`span`,{className:`ak-handoff-divider__label`,children:e.label})},e.id):Q(Vs,{message:e.message},e.message.id)),t&&!e.some(e=>e.status===`streaming`)&&Q(Hs,{}),Q(`div`,{ref:i})]})}function Gs(){return Q(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:Q(`path`,{d:`M5 12h14M13 6l6 6-6 6`})})}function Ks({description:e,suggestedQuestions:t,onSelect:n}){let r=(t??[]).filter(e=>(e.title??``).trim().length>0);return Q(`div`,{className:`ak-empty-state`,"aria-label":`Start a conversation`,children:[e&&Q(`p`,{className:`ak-empty-state__description`,children:e}),r.length>0&&Q(`div`,{className:`ak-empty-state__suggestions`,children:r.map((e,t)=>Q(`button`,{className:`ak-empty-state__suggestion`,onClick:()=>n?.(e.prompt??e.title),type:`button`,children:[Q(`span`,{className:`ak-empty-state__suggestion-title`,children:[e.title,Q(Gs,{})]}),e.description&&Q(`span`,{className:`ak-empty-state__suggestion-desc`,children:e.description})]},t))})]})}var qs=`https://klicforge.ai/privacy-policy`,Js=`https://klicforge.ai/terms-of-service`;function Ys(){return Q(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Q(`line`,{x1:`12`,y1:`19`,x2:`12`,y2:`5`}),Q(`polyline`,{points:`5 12 12 5 19 12`})]})}function Xs(){return Q(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[Q(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),Q(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]})}function Zs(){return Q(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Q(`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`}),Q(`circle`,{cx:`12`,cy:`13`,r:`4`})]})}function Qs(){return Q(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Q(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),Q(`polyline`,{points:`14 2 14 8 20 8`})]})}function $s(){return Q(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Q(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),Q(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})}function ec(){return Q(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[Q(`path`,{d:`M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z`}),Q(`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`}),Q(`line`,{x1:`12`,y1:`19`,x2:`12`,y2:`23`}),Q(`line`,{x1:`8`,y1:`23`,x2:`16`,y2:`23`})]})}function tc(){return Q(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`currentColor`,children:Q(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`})})}var nc=[`application/pdf`,`text/markdown`,`text/plain`,`text/csv`],rc=[`.pdf`,`.md`,`.txt`,`.csv`],ic=[...rc,...nc].join(`,`),ac=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`],oc=ac.join(`,`),sc=[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`];function cc(){return typeof MediaRecorder>`u`?null:sc.find(e=>MediaRecorder.isTypeSupported(e))??null}function lc(e){return e.includes(`mp4`)?`mp4`:e.includes(`ogg`)?`ogg`:`webm`}function uc(e){let t=Math.floor(e/1e3),n=Math.floor(t/60),r=t%60;return`${n}:${String(r).padStart(2,`0`)}`}function dc(e){if(nc.includes(e.type))return!0;let t=e.name.toLowerCase();return rc.some(e=>t.endsWith(e))}function fc(e){return ac.includes(e.type)}function pc({onSend:e,disabled:t=!1,placeholder:n=`Type a message…`,photoSendingEnabled:r=!1,fileUploadEnabled:i=!1,voiceNoteEnabled:a=!1,voiceNoteMaxDurationSec:o=120,attachmentMaxCount:s=5,attachmentMaxFileSizeMb:c=1,onRecordingError:l}){let[u,d]=Y(``),[f,p]=Y([]),[m,h]=Y(new Map),[g,_]=Y(!1),[v,y]=Y(!1),[b,x]=Y(0),S=Z(null),C=Z(null),w=Z(null),T=Z(null),E=Z(null),ee=Z(null),D=Z(null),te=Z([]),ne=Z(null),re=Z(0),ie=Z(null),ae=Z(!1),oe=Z(!1),se=Z(u);se.current=u;let ce=Z(f);ce.current=f;let le=Z(t);le.current=t;let ue=r||i,de=Do(()=>c*1024*1024,[c]),fe=a&&typeof window<`u`&&typeof MediaRecorder<`u`&&!!navigator.mediaDevices?.getUserMedia;X(()=>()=>{m.forEach(e=>URL.revokeObjectURL(e))},[]);let pe=Z(null);X(()=>{if(t)return;let e=pe.current;pe.current=t,e===null&&typeof window<`u`&&window.matchMedia?.(`(pointer: coarse)`).matches||S.current?.focus()},[t]);let me=Z(!1);X(()=>{v?ee.current?.focus():me.current&&!le.current&&S.current?.focus(),me.current=v},[v]);let he=Oo(e=>{if(!g)return;let t=e.composedPath?e.composedPath():[],n=!!T.current&&t.includes(T.current),r=!!E.current&&t.includes(E.current);!n&&!r&&_(!1)},[g]);X(()=>{if(g)return document.addEventListener(`click`,he),()=>document.removeEventListener(`click`,he)},[g,he]),X(()=>{ue||_(!1)},[ue]);function ge(){m.forEach(e=>URL.revokeObjectURL(e)),h(new Map),p([]),C.current&&(C.current.value=``),w.current&&(w.current.value=``)}function _e(e){p(t=>{let n=t[e];if(n){let e=m.get(n.file);e&&(URL.revokeObjectURL(e),h(e=>{let t=new Map(e);return t.delete(n.file),t}))}return t.filter((t,n)=>n!==e)})}function ve(){let n=u.trim();!n&&f.length===0||t||(e(n,f),d(``),ge(),S.current&&(S.current.style.height=`auto`))}let ye=Oo(()=>{ne.current?.getTracks().forEach(e=>e.stop()),ne.current=null},[]);X(()=>()=>{ie.current&&clearInterval(ie.current),D.current&&D.current.state!==`inactive`&&(ae.current=!0,D.current.stop()),ye()},[ye]);async function be(){if(!fe||v||oe.current||t)return;if(f.length>=s){l?.(`Only ${s} attachments can be sent at once`);return}let n=cc();if(!n){l?.(`Voice recording is not supported in this browser`);return}oe.current=!0;let r;try{r=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{oe.current=!1,l?.(`Microphone access was denied`);return}oe.current=!1,ne.current=r,te.current=[],ae.current=!1;let i=new MediaRecorder(r,{mimeType:n});i.ondataavailable=e=>{e.data.size>0&&te.current.push(e.data)},i.onstop=()=>{ye();let t=ae.current,r=Date.now()-re.current,i=new Blob(te.current,{type:n});if(te.current=[],t||r<300||le.current)return;let a=new File([i],`voice-note.${lc(n)}`,{type:n}),o=se.current.trim(),c=[...ce.current,{file:a,kind:`audio`,durationMs:r}];c.length>s?l?.(`Only ${s} attachments can be sent at once`):(e(o,c),d(``),ge(),S.current&&(S.current.style.height=`auto`))},D.current=i,re.current=Date.now(),x(0),i.start(),y(!0),ie.current=setInterval(()=>{let e=Date.now()-re.current;x(e),e>=o*1e3&&xe(!1)},250)}function xe(e){ie.current&&=(clearInterval(ie.current),null),ae.current=e,D.current&&D.current.state!==`inactive`&&D.current.stop(),y(!1),x(0)}function Se(e){e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ve())}function Ce(e){let t=e.currentTarget;d(t.value),t.style.height=`auto`,t.style.height=`${t.scrollHeight}px`}function we(e,t){if(e.length===0)return;let n=[],r=[];for(let i of e)t===`image`&&!fc(i)?r.push(`${i.name} (image type not supported)`):t===`file`&&!dc(i)?r.push(`${i.name} (file type not supported)`):i.size>de?r.push(`${i.name} (over ${c} MB)`):n.push({file:i,kind:t});p(e=>{let t=[...e,...n],i=t.slice(0,s);return t.length>s&&r.push(`max ${s} attachments allowed`),h(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(`
|
|
2065
|
+
• `)}`)}function Te(e){let t=Array.from(e.currentTarget.files??[]);e.currentTarget.value=``,we(t,`image`)}function Ee(e){let t=Array.from(e.currentTarget.files??[]);e.currentTarget.value=``,we(t,`file`)}function De(){_(!1),C.current?.click()}function Oe(){_(!1),w.current?.click()}let ke=!t&&(!!u.trim()||f.length>0);return Q(`div`,{className:`ak-composer`,children:[ue&&g&&Q(`div`,{ref:T,className:`ak-composer__attach-menu`,role:`menu`,children:[r&&Q(`button`,{className:`ak-composer__attach-menu-item`,onClick:De,type:`button`,role:`menuitem`,disabled:t,children:[Q(Zs,{}),Q(`span`,{children:`Photo`})]}),i&&Q(`button`,{className:`ak-composer__attach-menu-item`,onClick:Oe,type:`button`,role:`menuitem`,disabled:t,children:[Q(Qs,{}),Q(`span`,{children:`File`})]})]}),f.length>0&&Q(`div`,{className:`ak-composer__attachments`,role:`list`,children:f.map((e,n)=>{let r=`${e.file.name}-${n}`;if(e.kind===`image`){let i=m.get(e.file);return Q(`div`,{className:`ak-composer__preview-wrap`,role:`listitem`,children:[i&&Q(`img`,{src:i,alt:e.file.name,className:`ak-composer__preview-img`}),Q(`button`,{className:`ak-composer__preview-remove`,onClick:()=>_e(n),type:`button`,"aria-label":`Remove ${e.file.name}`,disabled:t,children:Q($s,{})})]},r)}return Q(`span`,{className:`ak-composer__file-chip`,role:`listitem`,children:[Q(Qs,{}),Q(`span`,{className:`ak-composer__file-chip-name`,title:e.file.name,children:e.file.name}),Q(`button`,{className:`ak-composer__file-chip-remove`,onClick:()=>_e(n),type:`button`,"aria-label":`Remove ${e.file.name}`,disabled:t,children:Q($s,{})})]},r)})}),ue&&Q(K,{children:[r&&Q(`input`,{ref:C,type:`file`,multiple:!0,accept:oc,className:`ak-composer__file-input`,onChange:Te,disabled:t,"aria-label":`Attach images`}),i&&Q(`input`,{ref:w,type:`file`,multiple:!0,accept:ic,className:`ak-composer__file-input`,onChange:Ee,disabled:t,"aria-label":`Attach files`})]}),Q(`div`,{className:`ak-composer__input-wrap`,children:v?Q(`div`,{className:`ak-composer__recording`,children:[Q(`button`,{className:`ak-composer__recording-cancel`,onClick:()=>xe(!0),"aria-label":`Cancel recording`,type:`button`,children:Q($s,{})}),Q(`span`,{className:`ak-composer__recording-timer`,children:[Q(`span`,{className:`ak-composer__recording-dot`}),uc(b)]}),Q(`button`,{ref:ee,className:`ak-composer__recording-stop`,onClick:()=>xe(!1),"aria-label":`Stop recording`,type:`button`,children:Q(tc,{})})]}):Q(K,{children:[Q(`div`,{className:`ak-composer__row`,children:[Q(`textarea`,{ref:S,className:`ak-composer__input`,value:u,onInput:Ce,onKeyDown:Se,placeholder:n,disabled:t,rows:1,"aria-label":`Message input`}),fe&&Q(`button`,{className:`ak-composer__mic`,onClick:()=>void be(),disabled:t||f.length>=s,"aria-label":f.length>=s?`Only ${s} attachments can be sent at once`:`Record a voice note`,title:f.length>=s?`Only ${s} attachments can be sent at once`:`Record a voice note`,type:`button`,children:Q(ec,{})})]}),Q(`div`,{className:`ak-composer__toolbar`,children:[ue&&Q(`div`,{className:`ak-composer__attach-wrap`,children:Q(`button`,{ref:E,className:`ak-composer__attach${g?` ak-composer__attach--open`:``}`,onClick:()=>_(e=>!e),disabled:t,"aria-label":`Attachment options`,"aria-haspopup":`true`,"aria-expanded":g,type:`button`,children:Q(Xs,{})})}),Q(`button`,{className:`ak-composer__send`,onClick:ve,disabled:!ke,"aria-label":`Send message`,type:`button`,children:Q(Ys,{})})]})]})}),Q(`p`,{className:`ak-composer__disclaimer`,children:[`By chatting you agree to our`,` `,Q(`a`,{href:qs,target:`_blank`,rel:`noopener noreferrer`,children:`Privacy Policy`}),` `,`and`,` `,Q(`a`,{href:Js,target:`_blank`,rel:`noopener noreferrer`,children:`Terms of Service`}),`. `,`AI can make mistakes. Verify important information.`]})]})}function mc({message:e}){return e.includes(`Origin not allowed`)?Q(`div`,{className:`ak-error ak-error--origin`,role:`alert`,children:[Q(`div`,{className:`ak-error__icon`,children:`🔒`}),Q(`div`,{className:`ak-error__content`,children:[Q(`h3`,{className:`ak-error__title`,children:`Access Restricted`}),Q(`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.`})]})]}):Q(`div`,{className:`ak-error`,role:`alert`,children:[Q(`div`,{className:`ak-error__icon`,children:`⚠️`}),Q(`div`,{className:`ak-error__content`,children:Q(`p`,{className:`ak-error__message`,children:e})})]})}function hc(){return Q(`svg`,{width:`28`,height:`28`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[Q(`circle`,{cx:`12`,cy:`12`,r:`9`}),Q(`path`,{d:`M12 7v5l3 2`})]})}function gc(){return Q(`div`,{className:`ak-maintenance`,role:`status`,"aria-live":`polite`,children:[Q(`div`,{className:`ak-maintenance__halo`,"aria-hidden":`true`}),Q(`div`,{className:`ak-maintenance__icon`,children:Q(hc,{})}),Q(`p`,{className:`ak-maintenance__title`,children:`Under maintenance`}),Q(`p`,{className:`ak-maintenance__description`,children:`This assistant is temporarily unavailable. Please check back in a little while.`})]})}function _c(){let[e,t]=Y(!1);return e?null:Q(`img`,{src:gs,width:14,height:14,alt:``,"aria-hidden":`true`,className:`ak-branding__logo`,onError:()=>t(!0)})}function vc(){return Q(`div`,{className:`ak-branding`,children:[Q(_c,{}),Q(`span`,{className:`ak-branding__label`,children:`Powered by`}),Q(`span`,{className:`ak-branding__name`,children:`KlicForge`})]})}function yc({config:e,messages:t,isLoading:n,error:r,isInline:i,initStatus:a,initError:o,callbacks:s}){let[c,l]=Y(null);return Q(`div`,{className:i?`ak-shell-wrap`:`ak-shell-wrap ak-shell-enter`,children:[Q(`div`,{className:i?`ak-shell ak-shell--inline`:`ak-shell ak-shell--floating`,role:`dialog`,"aria-label":e.title,children:[Q(xs,{title:e.title,subtitle:e.subtitle,avatarUrl:e.avatarUrl,onClose:s.onClose,onReset:a===`ready`?s.onReset:void 0,hideClose:i,compact:a===`ready`&&t.length>0}),a===`validating`&&Q(`div`,{className:`ak-init-status`,children:Q(`div`,{className:`ak-init-spinner`,"aria-label":`Connecting…`})}),a===`error`&&Q(`div`,{className:`ak-init-status ak-init-status--error`,children:Q(mc,{message:o??`Widget configuration is invalid.`})}),a===`disabled`&&Q(`div`,{className:`ak-init-status ak-init-status--maintenance`,children:Q(gc,{})}),a===`ready`&&Q(K,{children:[t.length===0?Q(Ks,{description:e.description,suggestedQuestions:e.suggestedQuestions,onSelect:e=>s.onSendMessage(e,[])}):Q(Ws,{messages:t,isLoading:n}),(r||c)&&Q(mc,{message:r??c}),Q(pc,{onSend:(e,t)=>{l(null),s.onSendMessage(e,t)},onRecordingError:l,disabled:n,placeholder:`Type a message…`,photoSendingEnabled:e.photoSendingEnabled,fileUploadEnabled:e.fileUploadEnabled,voiceNoteEnabled:e.voiceNoteEnabled,voiceNoteMaxDurationSec:e.voiceNoteMaxDurationSec,attachmentMaxCount:e.attachmentMaxCount,attachmentMaxFileSizeMb:e.attachmentMaxFileSizeMb})]})]}),!i&&Q(vc,{})]})}function bc(){return Q(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:Q(`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 xc(){return Q(`svg`,{width:`22`,height:`22`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:Q(`polyline`,{points:`6,9 12,15 18,9`})})}function Sc({isOpen:e,onClick:t,avatarUrl:n,label:r}){let i=!e&&r.length>0,a=!e&&!!n;return Q(`button`,{className:`ak-launcher${i?` ak-launcher--pill`:``}${a?` ak-launcher--avatar`:``}`,onClick:t,"aria-label":e?`Close chat`:r||`Open chat`,"aria-expanded":e,type:`button`,children:[e?Q(xc,{}):a?Q(`img`,{src:n,alt:``,className:`ak-launcher__avatar-img`,"aria-hidden":`true`}):Q(`span`,{className:`ak-launcher__icon`,"aria-hidden":`true`,children:Q(bc,{})}),i&&Q(`span`,{className:`ak-launcher__label`,"aria-hidden":`true`,children:r})]})}function Cc({config:e,state:t,callbacks:n}){let r=e.mode===`inline`,i=Z(null);return X(()=>{let t=i.current?.getRootNode()?.host;if(!t)return;let n=ls(e.theme.mode);t.setAttribute(`data-theme`,n)},[e.theme.mode]),X(()=>{if(r)return;let e=i.current?.getRootNode()?.host;e&&(t.isOpen?e.setAttribute(`data-open`,``):e.removeAttribute(`data-open`))},[r,t.isOpen]),t.initStatus===`disabled`&&!r?null:r?Q(`div`,{ref:i,className:`ak-inline`,children:Q(yc,{config:e,messages:t.messages,isLoading:t.isLoading,error:t.error,isInline:!0,initStatus:t.initStatus,initError:t.initError,callbacks:n})}):Q(`div`,{ref:i,className:`ak-floating`,children:[t.isOpen&&Q(yc,{config:e,messages:t.messages,isLoading:t.isLoading,error:t.error,isInline:!1,initStatus:t.initStatus,initError:t.initError,callbacks:n}),Q(Sc,{isOpen:t.isOpen,onClick:t.isOpen?n.onClose:n.onOpen,avatarUrl:e.avatarUrl,label:e.launcherLabel})]})}var wc=(e,t,n,r)=>{let i=ss(e);return i.render(Ha(Cc,{config:t,state:n,callbacks:r})),{update(e,t){i.render(Ha(Cc,{config:t,state:e,callbacks:r}))},destroy(){setTimeout(()=>{i.unmount()},0)}}};function Tc(e){return hs+`
|
|
2066
|
+
`+cs(e)}function Ec(e,t){return Tc(ht({...e,mode:t}))}function Dc(e,t=wc,n){return xa(e,t,n??Ec(e,`floating`))}function Oc(e,t,n=wc,r){return Sa(e,t,n,r??Ec(t,`inline`))}function kc(e){Ca(e)}var Ac={init:Dc,mount:Oc,destroy:kc};return window.AgentKit=Ac,e.AgentKit=Ac,e})({});
|