@iai-lib/any-chat-widget 0.1.0-alpha.39 → 0.1.0-alpha.40
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/dist/any-chat-widget.es.js +1763 -1743
- package/dist/any-chat-widget.umd.js +93 -93
- package/package.json +3 -3
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(ie,de){typeof exports=="object"&&typeof module<"u"?de(exports):typeof define=="function"&&define.amd?define(["exports"],de):(ie=typeof globalThis<"u"?globalThis:ie||self,de(ie.AnyChatbot={}))})(this,function(ie){"use strict";var xa=(ie,de,$e)=>{if(!de.has(ie))throw TypeError("Cannot "+$e)};var Ps=(ie,de,$e)=>(xa(ie,de,"read from private field"),$e?$e.call(ie):de.get(ie)),Ei=(ie,de,$e)=>{if(de.has(ie))throw TypeError("Cannot add the same private member more than once");de instanceof WeakSet?de.add(ie):de.set(ie,$e)},ut=(ie,de,$e,Y)=>(xa(ie,de,"write to private field"),Y?Y.call(ie,$e):de.set(ie,$e),$e);var Ke,zt;var de=Object.defineProperty,$e=(s,e,t)=>e in s?de(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Y=(s,e,t)=>($e(s,typeof e!="symbol"?e+"":e,t),t),Sa=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},Ci=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},js=(s,e,t)=>(Sa(s,e,"access private method"),t);/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const Kn=globalThis,
|
|
5
|
+
*/const Kn=globalThis,zs=Kn.ShadowRoot&&(Kn.ShadyCSS===void 0||Kn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ds=Symbol(),Oi=new WeakMap;let Ii=class{constructor(s,e,t){if(this._$cssResult$=!0,t!==Ds)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=s,this.t=e}get styleSheet(){let s=this.o;const e=this.t;if(zs&&s===void 0){const t=e!==void 0&&e.length===1;t&&(s=Oi.get(e)),s===void 0&&((this.o=s=new CSSStyleSheet).replaceSync(this.cssText),t&&Oi.set(e,s))}return s}toString(){return this.cssText}};const Ea=s=>new Ii(typeof s=="string"?s:s+"",void 0,Ds),pt=(s,...e)=>{const t=s.length===1?s[0]:e.reduce((n,i,r)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+s[r+1],s[0]);return new Ii(t,s,Ds)},Ca=(s,e)=>{if(zs)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=Kn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,s.appendChild(n)}},Mi=zs?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return Ea(t)})(s):s;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:Oa,defineProperty:Ia,getOwnPropertyDescriptor:Ma,getOwnPropertyNames:Na,getOwnPropertySymbols:Ra,getPrototypeOf:Pa}=Object,Ut=globalThis,
|
|
9
|
+
*/const{is:Oa,defineProperty:Ia,getOwnPropertyDescriptor:Ma,getOwnPropertyNames:Na,getOwnPropertySymbols:Ra,getPrototypeOf:Pa}=Object,Ut=globalThis,Ni=Ut.trustedTypes,ja=Ni?Ni.emptyScript:"",Ri=Ut.reactiveElementPolyfillSupport,on=(s,e)=>s,qn={toAttribute(s,e){switch(e){case Boolean:s=s?ja:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},Ls=(s,e)=>!Oa(s,e),Pi={attribute:!0,type:String,converter:qn,reflect:!1,hasChanged:Ls};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Ut.litPropertyMetadata??(Ut.litPropertyMetadata=new WeakMap);class Bt extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Pi){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&Ia(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:r}=Ma(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get(){return i==null?void 0:i.call(this)},set(a){const o=i==null?void 0:i.call(this);r.call(this,a),this.requestUpdate(e,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Pi}static _$Ei(){if(this.hasOwnProperty(on("elementProperties")))return;const e=Pa(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(on("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(on("properties"))){const t=this.properties,n=[...Na(t),...Ra(t)];for(const i of n)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(Mi(i))}else e!==void 0&&t.push(Mi(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ca(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostConnected)==null?void 0:n.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostDisconnected)==null?void 0:n.call(t)})}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){var n;const i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(r!==void 0&&i.reflect===!0){const a=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:qn).toAttribute(t,i.type);this._$Em=e,a==null?this.removeAttribute(r):this.setAttribute(r,a),this._$Em=null}}_$AK(e,t){var n;const i=this.constructor,r=i._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const a=i.getPropertyOptions(r),o=typeof a.converter=="function"?{fromAttribute:a.converter}:((n=a.converter)==null?void 0:n.fromAttribute)!==void 0?a.converter:qn;this._$Em=r,this[r]=o.fromAttribute(t,a.type),this._$Em=null}}requestUpdate(e,t,n){if(e!==void 0){if(n??(n=this.constructor.getPropertyOptions(e)),!(n.hasChanged??Ls)(this[e],t))return;this.P(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),n.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[r,a]of this._$Ep)this[r]=a;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[r,a]of i)a.wrapped!==!0||this._$AL.has(r)||this[r]===void 0||this.P(r,this[r],a)}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(e=this._$EO)==null||e.forEach(i=>{var r;return(r=i.hostUpdate)==null?void 0:r.call(i)}),this.update(n)):this._$EU()}catch(i){throw t=!1,this._$EU(),i}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(n=>{var i;return(i=n.hostUpdated)==null?void 0:i.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EC(t,this[t]))),this._$EU()}updated(e){}firstUpdated(e){}}Bt.elementStyles=[],Bt.shadowRootOptions={mode:"open"},Bt[on("elementProperties")]=new Map,Bt[on("finalized")]=new Map,Ri==null||Ri({ReactiveElement:Bt}),(Ut.reactiveElementVersions??(Ut.reactiveElementVersions=[])).push("2.0.4");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const Jn=globalThis,Qn=Jn.trustedTypes,
|
|
14
|
-
\f\r]`,cn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
13
|
+
*/const Jn=globalThis,Qn=Jn.trustedTypes,ji=Qn?Qn.createPolicy("lit-html",{createHTML:s=>s}):void 0,zi="$lit$",Xe=`lit$${(Math.random()+"").slice(9)}$`,Di="?"+Xe,za=`<${Di}>`,ft=document,Yn=()=>ft.createComment(""),ln=s=>s===null||typeof s!="object"&&typeof s!="function",Li=Array.isArray,Da=s=>Li(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",Zs=`[
|
|
14
|
+
\f\r]`,cn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Zi=/-->/g,Hi=/>/g,gt=RegExp(`>|${Zs}(?:([^\\s"'>=/]+)(${Zs}*=${Zs}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ui=/'/g,Bi=/"/g,Wi=/^(?:script|style|textarea|title)$/i,et=Symbol.for("lit-noChange"),re=Symbol.for("lit-nothing"),Vi=new WeakMap,mt=ft.createTreeWalker(ft,129);function Fi(s,e){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return ji!==void 0?ji.createHTML(e):e}const La=(s,e)=>{const t=s.length-1,n=[];let i,r=e===2?"<svg>":"",a=cn;for(let o=0;o<t;o++){const l=s[o];let d,u,h=-1,c=0;for(;c<l.length&&(a.lastIndex=c,u=a.exec(l),u!==null);)c=a.lastIndex,a===cn?u[1]==="!--"?a=Zi:u[1]!==void 0?a=Hi:u[2]!==void 0?(Wi.test(u[2])&&(i=RegExp("</"+u[2],"g")),a=gt):u[3]!==void 0&&(a=gt):a===gt?u[0]===">"?(a=i??cn,h=-1):u[1]===void 0?h=-2:(h=a.lastIndex-u[2].length,d=u[1],a=u[3]===void 0?gt:u[3]==='"'?Bi:Ui):a===Bi||a===Ui?a=gt:a===Zi||a===Hi?a=cn:(a=gt,i=void 0);const f=a===gt&&s[o+1].startsWith("/>")?" ":"";r+=a===cn?l+za:h>=0?(n.push(d),l.slice(0,h)+zi+l.slice(h)+Xe+f):l+Xe+(h===-2?o:f)}return[Fi(s,r+(s[t]||"<?>")+(e===2?"</svg>":"")),n]};let Hs=class ka{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let r=0,a=0;const o=e.length-1,l=this.parts,[d,u]=La(e,t);if(this.el=ka.createElement(d,n),mt.currentNode=this.el.content,t===2){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=mt.nextNode())!==null&&l.length<o;){if(i.nodeType===1){if(i.hasAttributes())for(const h of i.getAttributeNames())if(h.endsWith(zi)){const c=u[a++],f=i.getAttribute(h).split(Xe),A=/([.?@])?(.*)/.exec(c);l.push({type:1,index:r,name:A[2],strings:f,ctor:A[1]==="."?Ha:A[1]==="?"?Ua:A[1]==="@"?Ba:Gn}),i.removeAttribute(h)}else h.startsWith(Xe)&&(l.push({type:6,index:r}),i.removeAttribute(h));if(Wi.test(i.tagName)){const h=i.textContent.split(Xe),c=h.length-1;if(c>0){i.textContent=Qn?Qn.emptyScript:"";for(let f=0;f<c;f++)i.append(h[f],Yn()),mt.nextNode(),l.push({type:2,index:++r});i.append(h[c],Yn())}}}else if(i.nodeType===8)if(i.data===Di)l.push({type:2,index:r});else{let h=-1;for(;(h=i.data.indexOf(Xe,h+1))!==-1;)l.push({type:7,index:r}),h+=Xe.length-1}r++}}static createElement(e,t){const n=ft.createElement("template");return n.innerHTML=e,n}};function Wt(s,e,t=s,n){var i,r;if(e===et)return e;let a=n!==void 0?(i=t._$Co)==null?void 0:i[n]:t._$Cl;const o=ln(e)?void 0:e._$litDirective$;return(a==null?void 0:a.constructor)!==o&&((r=a==null?void 0:a._$AO)==null||r.call(a,!1),o===void 0?a=void 0:(a=new o(s),a._$AT(s,t,n)),n!==void 0?(t._$Co??(t._$Co=[]))[n]=a:t._$Cl=a),a!==void 0&&(e=Wt(s,a._$AS(s,e.values),a,n)),e}let Za=class{constructor(s,e){this._$AV=[],this._$AN=void 0,this._$AD=s,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(s){const{el:{content:e},parts:t}=this._$AD,n=((s==null?void 0:s.creationScope)??ft).importNode(e,!0);mt.currentNode=n;let i=mt.nextNode(),r=0,a=0,o=t[0];for(;o!==void 0;){if(r===o.index){let l;o.type===2?l=new Ki(i,i.nextSibling,this,s):o.type===1?l=new o.ctor(i,o.name,o.strings,this,s):o.type===6&&(l=new Wa(i,this,s)),this._$AV.push(l),o=t[++a]}r!==(o==null?void 0:o.index)&&(i=mt.nextNode(),r++)}return mt.currentNode=ft,n}p(s){let e=0;for(const t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(s,t,e),e+=t.strings.length-2):t._$AI(s[e])),e++}},Ki=class $a{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=re,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Wt(this,e,t),ln(e)?e===re||e==null||e===""?(this._$AH!==re&&this._$AR(),this._$AH=re):e!==this._$AH&&e!==et&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Da(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==re&&ln(this._$AH)?this._$AA.nextSibling.data=e:this.T(ft.createTextNode(e)),this._$AH=e}$(e){var t;const{values:n,_$litType$:i}=e,r=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=Hs.createElement(Fi(i.h,i.h[0]),this.options)),i);if(((t=this._$AH)==null?void 0:t._$AD)===r)this._$AH.p(n);else{const a=new Za(r,this),o=a.u(this.options);a.p(n),this.T(o),this._$AH=a}}_$AC(e){let t=Vi.get(e.strings);return t===void 0&&Vi.set(e.strings,t=new Hs(e)),t}k(e){Li(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const r of e)i===t.length?t.push(n=new $a(this.S(Yn()),this.S(Yn()),this,this.options)):n=t[i],n._$AI(r),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)==null?void 0:n.call(this,!1,!0,t);e&&e!==this._$AB;){const i=e.nextSibling;e.remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},Gn=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(s,e,t,n,i){this.type=1,this._$AH=re,this._$AN=void 0,this.element=s,this.name=e,this._$AM=n,this.options=i,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=re}_$AI(s,e=this,t,n){const i=this.strings;let r=!1;if(i===void 0)s=Wt(this,s,e,0),r=!ln(s)||s!==this._$AH&&s!==et,r&&(this._$AH=s);else{const a=s;let o,l;for(s=i[0],o=0;o<i.length-1;o++)l=Wt(this,a[t+o],e,o),l===et&&(l=this._$AH[o]),r||(r=!ln(l)||l!==this._$AH[o]),l===re?s=re:s!==re&&(s+=(l??"")+i[o+1]),this._$AH[o]=l}r&&!n&&this.j(s)}j(s){s===re?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,s??"")}},Ha=class extends Gn{constructor(){super(...arguments),this.type=3}j(s){this.element[this.name]=s===re?void 0:s}},Ua=class extends Gn{constructor(){super(...arguments),this.type=4}j(s){this.element.toggleAttribute(this.name,!!s&&s!==re)}},Ba=class extends Gn{constructor(s,e,t,n,i){super(s,e,t,n,i),this.type=5}_$AI(s,e=this){if((s=Wt(this,s,e,0)??re)===et)return;const t=this._$AH,n=s===re&&t!==re||s.capture!==t.capture||s.once!==t.once||s.passive!==t.passive,i=s!==re&&(t===re||n);n&&this.element.removeEventListener(this.name,this,t),i&&this.element.addEventListener(this.name,this,s),this._$AH=s}handleEvent(s){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,s):this._$AH.handleEvent(s)}},Wa=class{constructor(s,e,t){this.element=s,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(s){Wt(this,s)}};const qi=Jn.litHtmlPolyfillSupport;qi==null||qi(Hs,Ki),(Jn.litHtmlVersions??(Jn.litHtmlVersions=[])).push("3.1.2");/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/const Xn=globalThis,
|
|
20
|
-
\f\r]`,un=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
21
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),tr=/'/g,nr=/"/g,
|
|
19
|
+
*/const Xn=globalThis,es=Xn.trustedTypes,Ji=es?es.createPolicy("lit-html",{createHTML:s=>s}):void 0,Qi="$lit$",tt=`lit$${(Math.random()+"").slice(9)}$`,Yi="?"+tt,Va=`<${Yi}>`,yt=document,dn=()=>yt.createComment(""),hn=s=>s===null||typeof s!="object"&&typeof s!="function",Gi=Array.isArray,Fa=s=>Gi(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",Us=`[
|
|
20
|
+
\f\r]`,un=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Xi=/-->/g,er=/>/g,vt=RegExp(`>|${Us}(?:([^\\s"'>=/]+)(${Us}*=${Us}*(?:[^
|
|
21
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),tr=/'/g,nr=/"/g,sr=/^(?:script|style|textarea|title)$/i,Ka=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),U=Ka(1),Vt=Symbol.for("lit-noChange"),he=Symbol.for("lit-nothing"),ir=new WeakMap,bt=yt.createTreeWalker(yt,129);function rr(s,e){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ji!==void 0?Ji.createHTML(e):e}const qa=(s,e)=>{const t=s.length-1,n=[];let i,r=e===2?"<svg>":"",a=un;for(let o=0;o<t;o++){const l=s[o];let d,u,h=-1,c=0;for(;c<l.length&&(a.lastIndex=c,u=a.exec(l),u!==null);)c=a.lastIndex,a===un?u[1]==="!--"?a=Xi:u[1]!==void 0?a=er:u[2]!==void 0?(sr.test(u[2])&&(i=RegExp("</"+u[2],"g")),a=vt):u[3]!==void 0&&(a=vt):a===vt?u[0]===">"?(a=i??un,h=-1):u[1]===void 0?h=-2:(h=a.lastIndex-u[2].length,d=u[1],a=u[3]===void 0?vt:u[3]==='"'?nr:tr):a===nr||a===tr?a=vt:a===Xi||a===er?a=un:(a=vt,i=void 0);const f=a===vt&&s[o+1].startsWith("/>")?" ":"";r+=a===un?l+Va:h>=0?(n.push(d),l.slice(0,h)+Qi+l.slice(h)+tt+f):l+tt+(h===-2?o:f)}return[rr(s,r+(s[t]||"<?>")+(e===2?"</svg>":"")),n]};let Bs=class Aa{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let r=0,a=0;const o=e.length-1,l=this.parts,[d,u]=qa(e,t);if(this.el=Aa.createElement(d,n),bt.currentNode=this.el.content,t===2){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=bt.nextNode())!==null&&l.length<o;){if(i.nodeType===1){if(i.hasAttributes())for(const h of i.getAttributeNames())if(h.endsWith(Qi)){const c=u[a++],f=i.getAttribute(h).split(tt),A=/([.?@])?(.*)/.exec(c);l.push({type:1,index:r,name:A[2],strings:f,ctor:A[1]==="."?Qa:A[1]==="?"?Ya:A[1]==="@"?Ga:ts}),i.removeAttribute(h)}else h.startsWith(tt)&&(l.push({type:6,index:r}),i.removeAttribute(h));if(sr.test(i.tagName)){const h=i.textContent.split(tt),c=h.length-1;if(c>0){i.textContent=es?es.emptyScript:"";for(let f=0;f<c;f++)i.append(h[f],dn()),bt.nextNode(),l.push({type:2,index:++r});i.append(h[c],dn())}}}else if(i.nodeType===8)if(i.data===Yi)l.push({type:2,index:r});else{let h=-1;for(;(h=i.data.indexOf(tt,h+1))!==-1;)l.push({type:7,index:r}),h+=tt.length-1}r++}}static createElement(e,t){const n=yt.createElement("template");return n.innerHTML=e,n}};function Ft(s,e,t=s,n){var i,r;if(e===Vt)return e;let a=n!==void 0?(i=t._$Co)==null?void 0:i[n]:t._$Cl;const o=hn(e)?void 0:e._$litDirective$;return(a==null?void 0:a.constructor)!==o&&((r=a==null?void 0:a._$AO)==null||r.call(a,!1),o===void 0?a=void 0:(a=new o(s),a._$AT(s,t,n)),n!==void 0?(t._$Co??(t._$Co=[]))[n]=a:t._$Cl=a),a!==void 0&&(e=Ft(s,a._$AS(s,e.values),a,n)),e}let Ja=class{constructor(s,e){this._$AV=[],this._$AN=void 0,this._$AD=s,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(s){const{el:{content:e},parts:t}=this._$AD,n=((s==null?void 0:s.creationScope)??yt).importNode(e,!0);bt.currentNode=n;let i=bt.nextNode(),r=0,a=0,o=t[0];for(;o!==void 0;){if(r===o.index){let l;o.type===2?l=new Ws(i,i.nextSibling,this,s):o.type===1?l=new o.ctor(i,o.name,o.strings,this,s):o.type===6&&(l=new Xa(i,this,s)),this._$AV.push(l),o=t[++a]}r!==(o==null?void 0:o.index)&&(i=bt.nextNode(),r++)}return bt.currentNode=yt,n}p(s){let e=0;for(const t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(s,t,e),e+=t.strings.length-2):t._$AI(s[e])),e++}},Ws=class Ta{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=he,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Ft(this,e,t),hn(e)?e===he||e==null||e===""?(this._$AH!==he&&this._$AR(),this._$AH=he):e!==this._$AH&&e!==Vt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Fa(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==he&&hn(this._$AH)?this._$AA.nextSibling.data=e:this.T(yt.createTextNode(e)),this._$AH=e}$(e){var t;const{values:n,_$litType$:i}=e,r=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=Bs.createElement(rr(i.h,i.h[0]),this.options)),i);if(((t=this._$AH)==null?void 0:t._$AD)===r)this._$AH.p(n);else{const a=new Ja(r,this),o=a.u(this.options);a.p(n),this.T(o),this._$AH=a}}_$AC(e){let t=ir.get(e.strings);return t===void 0&&ir.set(e.strings,t=new Bs(e)),t}k(e){Gi(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const r of e)i===t.length?t.push(n=new Ta(this.S(dn()),this.S(dn()),this,this.options)):n=t[i],n._$AI(r),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)==null?void 0:n.call(this,!1,!0,t);e&&e!==this._$AB;){const i=e.nextSibling;e.remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},ts=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(s,e,t,n,i){this.type=1,this._$AH=he,this._$AN=void 0,this.element=s,this.name=e,this._$AM=n,this.options=i,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=he}_$AI(s,e=this,t,n){const i=this.strings;let r=!1;if(i===void 0)s=Ft(this,s,e,0),r=!hn(s)||s!==this._$AH&&s!==Vt,r&&(this._$AH=s);else{const a=s;let o,l;for(s=i[0],o=0;o<i.length-1;o++)l=Ft(this,a[t+o],e,o),l===Vt&&(l=this._$AH[o]),r||(r=!hn(l)||l!==this._$AH[o]),l===he?s=he:s!==he&&(s+=(l??"")+i[o+1]),this._$AH[o]=l}r&&!n&&this.j(s)}j(s){s===he?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,s??"")}},Qa=class extends ts{constructor(){super(...arguments),this.type=3}j(s){this.element[this.name]=s===he?void 0:s}},Ya=class extends ts{constructor(){super(...arguments),this.type=4}j(s){this.element.toggleAttribute(this.name,!!s&&s!==he)}},Ga=class extends ts{constructor(s,e,t,n,i){super(s,e,t,n,i),this.type=5}_$AI(s,e=this){if((s=Ft(this,s,e,0)??he)===Vt)return;const t=this._$AH,n=s===he&&t!==he||s.capture!==t.capture||s.once!==t.once||s.passive!==t.passive,i=s!==he&&(t===he||n);n&&this.element.removeEventListener(this.name,this,t),i&&this.element.addEventListener(this.name,this,s),this._$AH=s}handleEvent(s){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,s):this._$AH.handleEvent(s)}},Xa=class{constructor(s,e,t){this.element=s,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(s){Ft(this,s)}};const ar=Xn.litHtmlPolyfillSupport;ar==null||ar(Bs,Ws),(Xn.litHtmlVersions??(Xn.litHtmlVersions=[])).push("3.1.2");const eo=(s,e,t)=>{const n=(t==null?void 0:t.renderBefore)??e;let i=n._$litPart$;if(i===void 0){const r=(t==null?void 0:t.renderBefore)??null;n._$litPart$=i=new Ws(e.insertBefore(dn(),r),r,void 0,t??{})}return i._$AI(s),i};/**
|
|
22
22
|
* @license
|
|
23
23
|
* Copyright 2017 Google LLC
|
|
24
24
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
25
|
-
*/let xe=class extends Bt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var
|
|
25
|
+
*/let xe=class extends Bt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var s;const e=super.createRenderRoot();return(s=this.renderOptions).renderBefore??(s.renderBefore=e.firstChild),e}update(s){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(s),this._$Do=eo(e,this.renderRoot,this.renderOptions)}connectedCallback(){var s;super.connectedCallback(),(s=this._$Do)==null||s.setConnected(!0)}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this._$Do)==null||s.setConnected(!1)}render(){return Vt}};var or;xe._$litElement$=!0,xe.finalized=!0,(or=globalThis.litElementHydrateSupport)==null||or.call(globalThis,{LitElement:xe});const lr=globalThis.litElementPolyfillSupport;lr==null||lr({LitElement:xe}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.4");/**
|
|
26
26
|
* @license
|
|
27
27
|
* Copyright 2017 Google LLC
|
|
28
28
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
29
|
-
*/const He=
|
|
29
|
+
*/const He=s=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(s,e)}):customElements.define(s,e)};/**
|
|
30
30
|
* @license
|
|
31
31
|
* Copyright 2017 Google LLC
|
|
32
32
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
33
|
-
*/const to={attribute:!0,type:String,converter:qn,reflect:!1,hasChanged:
|
|
33
|
+
*/const to={attribute:!0,type:String,converter:qn,reflect:!1,hasChanged:Ls},no=(s=to,e,t)=>{const{kind:n,metadata:i}=t;let r=globalThis.litPropertyMetadata.get(i);if(r===void 0&&globalThis.litPropertyMetadata.set(i,r=new Map),r.set(t.name,s),n==="accessor"){const{name:a}=t;return{set(o){const l=e.get.call(this);e.set.call(this,o),this.requestUpdate(a,l,s)},init(o){return o!==void 0&&this.P(a,void 0,s),o}}}if(n==="setter"){const{name:a}=t;return function(o){const l=this[a];e.call(this,o),this.requestUpdate(a,l,s)}}throw Error("Unsupported decorator location: "+n)};function ne(s){return(e,t)=>typeof t=="object"?no(s,e,t):((n,i,r)=>{const a=i.hasOwnProperty(r);return i.constructor.createProperty(r,a?{...n,wrapped:!0}:n),a?Object.getOwnPropertyDescriptor(i,r):void 0})(s,e,t)}/**
|
|
34
34
|
* @license
|
|
35
35
|
* Copyright 2017 Google LLC
|
|
36
36
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
37
|
-
*/function wt(
|
|
37
|
+
*/function wt(s){return ne({...s,state:!0,attribute:!1})}/**
|
|
38
38
|
* @license
|
|
39
39
|
* Copyright 2017 Google LLC
|
|
40
40
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
41
|
-
*/const cr=(
|
|
41
|
+
*/const cr=(s,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(s,e,t),t);/**
|
|
42
42
|
* @license
|
|
43
43
|
* Copyright 2017 Google LLC
|
|
44
44
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
45
|
-
*/function
|
|
45
|
+
*/function ns(s,e){return(t,n,i)=>{const r=a=>{var o;return((o=a.renderRoot)==null?void 0:o.querySelector(s))??null};if(e){const{get:a,set:o}=typeof n=="object"?t:i??(()=>{const l=Symbol();return{get(){return this[l]},set(d){this[l]=d}}})();return cr(t,n,{get(){let l=a.call(this);return l===void 0&&(l=r(this),(l!==null||this.hasUpdated)&&o.call(this,l)),l}})}return cr(t,n,{get(){return r(this)}})}}/**
|
|
46
46
|
* @license
|
|
47
47
|
* Copyright 2017 Google LLC
|
|
48
48
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
49
|
-
*/const
|
|
50
|
-
\f\r]`,fn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,pr=/-->/g,fr=/>/g,xt=RegExp(`>|${
|
|
51
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
49
|
+
*/const ss=globalThis,is=ss.trustedTypes,dr=is?is.createPolicy("lit-html",{createHTML:s=>s}):void 0,Vs="$lit$",Ue=`lit$${Math.random().toFixed(9).slice(2)}$`,Fs="?"+Ue,so=`<${Fs}>`,_t=document,rs=()=>_t.createComment(""),pn=s=>s===null||typeof s!="object"&&typeof s!="function",hr=Array.isArray,ur=s=>hr(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",Ks=`[
|
|
50
|
+
\f\r]`,fn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,pr=/-->/g,fr=/>/g,xt=RegExp(`>|${Ks}(?:([^\\s"'>=/]+)(${Ks}*=${Ks}*(?:[^
|
|
51
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),gr=/'/g,mr=/"/g,yr=/^(?:script|style|textarea|title)$/i,Kt=Symbol.for("lit-noChange"),ue=Symbol.for("lit-nothing"),vr=new WeakMap,kt=_t.createTreeWalker(_t,129);function br(s,e){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return dr!==void 0?dr.createHTML(e):e}const wr=(s,e)=>{const t=s.length-1,n=[];let i,r=e===2?"<svg>":"",a=fn;for(let o=0;o<t;o++){const l=s[o];let d,u,h=-1,c=0;for(;c<l.length&&(a.lastIndex=c,u=a.exec(l),u!==null);)c=a.lastIndex,a===fn?u[1]==="!--"?a=pr:u[1]!==void 0?a=fr:u[2]!==void 0?(yr.test(u[2])&&(i=RegExp("</"+u[2],"g")),a=xt):u[3]!==void 0&&(a=xt):a===xt?u[0]===">"?(a=i??fn,h=-1):u[1]===void 0?h=-2:(h=a.lastIndex-u[2].length,d=u[1],a=u[3]===void 0?xt:u[3]==='"'?mr:gr):a===mr||a===gr?a=xt:a===pr||a===fr?a=fn:(a=xt,i=void 0);const f=a===xt&&s[o+1].startsWith("/>")?" ":"";r+=a===fn?l+so:h>=0?(n.push(d),l.slice(0,h)+Vs+l.slice(h)+Ue+f):l+Ue+(h===-2?o:f)}return[br(s,r+(s[t]||"<?>")+(e===2?"</svg>":"")),n]};class gn{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let r=0,a=0;const o=e.length-1,l=this.parts,[d,u]=wr(e,t);if(this.el=gn.createElement(d,n),kt.currentNode=this.el.content,t===2){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=kt.nextNode())!==null&&l.length<o;){if(i.nodeType===1){if(i.hasAttributes())for(const h of i.getAttributeNames())if(h.endsWith(Vs)){const c=u[a++],f=i.getAttribute(h).split(Ue),A=/([.?@])?(.*)/.exec(c);l.push({type:1,index:r,name:A[2],strings:f,ctor:A[1]==="."?xr:A[1]==="?"?kr:A[1]==="@"?$r:yn}),i.removeAttribute(h)}else h.startsWith(Ue)&&(l.push({type:6,index:r}),i.removeAttribute(h));if(yr.test(i.tagName)){const h=i.textContent.split(Ue),c=h.length-1;if(c>0){i.textContent=is?is.emptyScript:"";for(let f=0;f<c;f++)i.append(h[f],rs()),kt.nextNode(),l.push({type:2,index:++r});i.append(h[c],rs())}}}else if(i.nodeType===8)if(i.data===Fs)l.push({type:2,index:r});else{let h=-1;for(;(h=i.data.indexOf(Ue,h+1))!==-1;)l.push({type:7,index:r}),h+=Ue.length-1}r++}}static createElement(e,t){const n=_t.createElement("template");return n.innerHTML=e,n}}function $t(s,e,t=s,n){var i,r;if(e===Kt)return e;let a=n!==void 0?(i=t._$Co)==null?void 0:i[n]:t._$Cl;const o=pn(e)?void 0:e._$litDirective$;return(a==null?void 0:a.constructor)!==o&&((r=a==null?void 0:a._$AO)==null||r.call(a,!1),o===void 0?a=void 0:(a=new o(s),a._$AT(s,t,n)),n!==void 0?(t._$Co??(t._$Co=[]))[n]=a:t._$Cl=a),a!==void 0&&(e=$t(s,a._$AS(s,e.values),a,n)),e}class _r{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,i=((e==null?void 0:e.creationScope)??_t).importNode(t,!0);kt.currentNode=i;let r=kt.nextNode(),a=0,o=0,l=n[0];for(;l!==void 0;){if(a===l.index){let d;l.type===2?d=new mn(r,r.nextSibling,this,e):l.type===1?d=new l.ctor(r,l.name,l.strings,this,e):l.type===6&&(d=new Ar(r,this,e)),this._$AV.push(d),l=n[++o]}a!==(l==null?void 0:l.index)&&(r=kt.nextNode(),a++)}return kt.currentNode=_t,i}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class mn{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=ue,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=$t(this,e,t),pn(e)?e===ue||e==null||e===""?(this._$AH!==ue&&this._$AR(),this._$AH=ue):e!==this._$AH&&e!==Kt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):ur(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==ue&&pn(this._$AH)?this._$AA.nextSibling.data=e:this.T(_t.createTextNode(e)),this._$AH=e}$(e){var t;const{values:n,_$litType$:i}=e,r=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=gn.createElement(br(i.h,i.h[0]),this.options)),i);if(((t=this._$AH)==null?void 0:t._$AD)===r)this._$AH.p(n);else{const a=new _r(r,this),o=a.u(this.options);a.p(n),this.T(o),this._$AH=a}}_$AC(e){let t=vr.get(e.strings);return t===void 0&&vr.set(e.strings,t=new gn(e)),t}k(e){hr(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const r of e)i===t.length?t.push(n=new mn(this.S(rs()),this.S(rs()),this,this.options)):n=t[i],n._$AI(r),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)==null?void 0:n.call(this,!1,!0,t);e&&e!==this._$AB;){const i=e.nextSibling;e.remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class yn{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,r){this.type=1,this._$AH=ue,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=r,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=ue}_$AI(e,t=this,n,i){const r=this.strings;let a=!1;if(r===void 0)e=$t(this,e,t,0),a=!pn(e)||e!==this._$AH&&e!==Kt,a&&(this._$AH=e);else{const o=e;let l,d;for(e=r[0],l=0;l<r.length-1;l++)d=$t(this,o[n+l],t,l),d===Kt&&(d=this._$AH[l]),a||(a=!pn(d)||d!==this._$AH[l]),d===ue?e=ue:e!==ue&&(e+=(d??"")+r[l+1]),this._$AH[l]=d}a&&!i&&this.j(e)}j(e){e===ue?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class xr extends yn{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ue?void 0:e}}class kr extends yn{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==ue)}}class $r extends yn{constructor(e,t,n,i,r){super(e,t,n,i,r),this.type=5}_$AI(e,t=this){if((e=$t(this,e,t,0)??ue)===Kt)return;const n=this._$AH,i=e===ue&&n!==ue||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,r=e!==ue&&(n===ue||i);i&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class Ar{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){$t(this,e)}}const io={P:Vs,A:Ue,C:Fs,M:1,L:wr,R:_r,D:ur,V:$t,I:mn,H:yn,N:kr,U:$r,B:xr,F:Ar},Tr=ss.litHtmlPolyfillSupport;Tr==null||Tr(gn,mn),(ss.litHtmlVersions??(ss.litHtmlVersions=[])).push("3.1.3");/**
|
|
52
52
|
* @license
|
|
53
53
|
* Copyright 2017 Google LLC
|
|
54
54
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
55
|
-
*/const ro={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ao=
|
|
55
|
+
*/const ro={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ao=s=>(...e)=>({_$litDirective$:s,values:e});let oo=class{constructor(s){}get _$AU(){return this._$AM._$AU}_$AT(s,e,t){this._$Ct=s,this._$AM=e,this._$Ci=t}_$AS(s,e){return this.update(s,e)}update(s,e){return this.render(...e)}};/**
|
|
56
56
|
* @license
|
|
57
57
|
* Copyright 2020 Google LLC
|
|
58
58
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
59
|
-
*/const{I:lo}=
|
|
59
|
+
*/const{I:lo}=io,Sr=()=>document.createComment(""),vn=(s,e,t)=>{var n;const i=s._$AA.parentNode,r=e===void 0?s._$AB:e._$AA;if(t===void 0){const a=i.insertBefore(Sr(),r),o=i.insertBefore(Sr(),r);t=new lo(a,o,s,s.options)}else{const a=t._$AB.nextSibling,o=t._$AM,l=o!==s;if(l){let d;(n=t._$AQ)==null||n.call(t,s),t._$AM=s,t._$AP!==void 0&&(d=s._$AU)!==o._$AU&&t._$AP(d)}if(a!==r||l){let d=t._$AA;for(;d!==a;){const u=d.nextSibling;i.insertBefore(d,r),d=u}}}return t},At=(s,e,t=s)=>(s._$AI(e,t),s),co={},ho=(s,e=co)=>s._$AH=e,uo=s=>s._$AH,qs=s=>{var e;(e=s._$AP)==null||e.call(s,!1,!0);let t=s._$AA;const n=s._$AB.nextSibling;for(;t!==n;){const i=t.nextSibling;t.remove(),t=i}};/**
|
|
60
60
|
* @license
|
|
61
61
|
* Copyright 2017 Google LLC
|
|
62
62
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
63
|
-
*/const Cr=(i,e,t)=>{const n=new Map;for(let s=e;s<=t;s++)n.set(i[s],s);return n},Er=ao(class extends oo{constructor(i){if(super(i),i.type!==ro.CHILD)throw Error("repeat() can only be used in text expressions")}dt(i,e,t){let n;t===void 0?t=e:e!==void 0&&(n=e);const s=[],r=[];let a=0;for(const o of i)s[a]=n?n(o,a):a,r[a]=t(o,a),a++;return{values:r,keys:s}}render(i,e,t){return this.dt(i,e,t).values}update(i,[e,t,n]){const s=uo(i),{values:r,keys:a}=this.dt(e,t,n);if(!Array.isArray(s))return this.ut=a,r;const o=this.ut??(this.ut=[]),l=[];let d,u,h=0,c=s.length-1,f=0,A=r.length-1;for(;h<=c&&f<=A;)if(s[h]===null)h++;else if(s[c]===null)c--;else if(o[h]===a[f])l[f]=At(s[h],r[f]),h++,f++;else if(o[c]===a[A])l[A]=At(s[c],r[A]),c--,A--;else if(o[h]===a[A])l[A]=At(s[h],r[A]),vn(i,l[A+1],s[h]),h++,A--;else if(o[c]===a[f])l[f]=At(s[c],r[f]),vn(i,s[h],s[c]),c--,f++;else if(d===void 0&&(d=Cr(a,f,A),u=Cr(o,h,c)),d.has(o[h]))if(d.has(o[c])){const V=u.get(a[f]),ae=V!==void 0?s[V]:null;if(ae===null){const ze=vn(i,s[h]);At(ze,r[f]),l[f]=ze}else l[f]=At(ae,r[f]),vn(i,s[h],ae),s[V]=null;f++}else qi(s[c]),c--;else qi(s[h]),h++;for(;f<=A;){const V=vn(i,l[A+1]);At(V,r[f]),l[f++]=V}for(;h<=c;){const V=s[h++];V!==null&&qi(V)}return this.ut=a,ho(i,l),Kt}}),Be=pt`*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: \"\"}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",Segoe UI Symbol,\"Noto Color Emoji\";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.bottom-8{bottom:2rem}.bottom-\\[-1px\\]{bottom:-1px}.left-0{left:0}.left-8{left:2rem}.right-0{right:0}.right-8{right:2rem}.top-0{top:0}.top-12{top:3rem}.z-10{z-index:10}.z-50{z-index:50}.m-0{margin:0}.m-0\\.5{margin:.125rem}.m-2{margin:.5rem}.m-4{margin:1rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-auto{margin-top:auto;margin-bottom:auto}.mb-1{margin-bottom:.25rem}.mb-\\[-8px\\]{margin-bottom:-8px}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-20{margin-left:5rem}.mr-2{margin-right:.5rem}.mr-20{margin-right:5rem}.mt-4{margin-top:1rem}.inline-block{display:inline-block}.flex{display:flex}.hidden{display:none}.h-0{height:0px}.h-12{height:3rem}.h-2{height:.5rem}.h-2\\.5{height:.625rem}.h-3\\/5{height:60%}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-9{height:2.25rem}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.max-h-20{max-height:5rem}.max-h-\\[90vh\\]{max-height:90vh}.w-0{width:0px}.w-2{width:.5rem}.w-2\\.5{width:.625rem}.w-3\\/5{width:60%}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-9{width:2.25rem}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.max-w-\\[90vw\\]{max-width:90vw}.flex-1{flex:1 1 0%}.flex-grow{flex-grow:1}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.resize{resize:both}.snap-x{scroll-snap-type:x var(--tw-scroll-snap-strictness)}.snap-mandatory{--tw-scroll-snap-strictness: mandatory}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.whitespace-pre-wrap{white-space:pre-wrap}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-b-lg{border-bottom-right-radius:.5rem;border-bottom-left-radius:.5rem}.rounded-t-lg{border-top-left-radius:.5rem;border-top-right-radius:.5rem}.border{border-width:1px}.border-x-8{border-left-width:8px;border-right-width:8px}.border-t-8{border-top-width:8px}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity))}.border-x-transparent{border-left-color:transparent;border-right-color:transparent}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity))}.bg-gray-600{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-opacity-50{--tw-bg-opacity: .5}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-white{--tw-gradient-from: #fff var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.p-0{padding:0}.p-2{padding:.5rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.px-0{padding-left:0;padding-right:0}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-8{padding-bottom:2rem}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.text-center{text-align:center}.text-right{text-align:right}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.font-semibold{font-weight:600}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}:host{font-size:16px;line-height:1.2;text-align:left;--iai-chat-i-primary-color: var(--iai-chat-primary-color, #0B64F4);--iai-chat-i-text-color: var(--iai-chat-text-color, #FFF);--iai-chat-i-link-color: var(--iai-chat-link-color, var(--iai-chat-i-primary-color));--iai-chat-i-header-bg: var(--iai-chat-header-background-color, var(--iai-chat-i-primary-color));--iai-chat-i-header-fg: var(--iai-chat-header-text-color, var(--iai-chat-i-text-color));--iai-chat-i-button-bg: var(--iai-chat-button-background-color, var(--iai-chat-i-primary-color));--iai-chat-i-button-fg: var(--iai-chat-button-text-color, var(--iai-chat-i-text-color));--iai-chat-i-message-user-bg: var(--iai-chat-messages-user-background-color, var(--iai-chat-i-primary-color));--iai-chat-i-message-user-fg: var(--iai-chat-messages-user-text-color, var(--iai-chat-i-text-color));--iai-chat-i-message-assistant-bg: var(--iai-chat-messages-assistant-background-color, #6B7280);--iai-chat-i-message-assistant-fg: var(--iai-chat-messages-assistant-text-color, var(--iai-chat-i-text-color));--iai-chat-i-ocb-bg: var(--iai-chat-open-chat-button-background-color, var(--iai-chat-i-primary-color));--iai-chat-i-ocb-fg: var(--iai-chat-open-chat-button-icon-color, var(--iai-chat-i-text-color));--iai-chat-i-iframe-modal-header-bg: var(--iai-chat-iframe-modal-background-color, var(--iai-chat-i-primary-color));--iai-chat-i-iframe-modal-header-fg: var(--iai-chat-iframe-modal-text-color, var(--iai-chat-i-text-color))}h1{font-size:1.5em}h2{font-size:1.17em}h3{font-size:1em}ol,ul{display:flex;flex-direction:column;padding:0;margin-left:20px;gap:8px}ol{list-style-type:decimal}a{color:var(--iai-chat-i-link-color)}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.disabled\\:bg-gray-200:disabled{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity))}.disabled\\:opacity-50:disabled{opacity:.5}@media (min-width: 768px){.md\\:bottom-8{bottom:2rem}.md\\:left-8{left:2rem}.md\\:right-8{right:2rem}.md\\:flex{display:flex}.md\\:h-\\[500px\\]{height:500px}.md\\:h-fit{height:-moz-fit-content;height:fit-content}.md\\:w-\\[350px\\]{width:350px}.md\\:w-fit{width:-moz-fit-content;width:fit-content}.md\\:p-0{padding:0}.md\\:px-0{padding-left:0;padding-right:0}.md\\:pb-0{padding-bottom:0}}`;var po=Object.defineProperty,fo=Object.getOwnPropertyDescriptor,ai=(i,e,t,n)=>{for(var s=n>1?void 0:n?fo(e,t):e,r=i.length-1,a;r>=0;r--)(a=i[r])&&(s=(n?a(e,t,s):a(s))||s);return n&&s&&po(e,t,s),s};let qt=class extends xe{constructor(){super(...arguments),this.activeIndex=0,this.items=[]}render(){return U`
|
|
63
|
+
*/const Er=(s,e,t)=>{const n=new Map;for(let i=e;i<=t;i++)n.set(s[i],i);return n},Cr=ao(class extends oo{constructor(s){if(super(s),s.type!==ro.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,t){let n;t===void 0?t=e:e!==void 0&&(n=e);const i=[],r=[];let a=0;for(const o of s)i[a]=n?n(o,a):a,r[a]=t(o,a),a++;return{values:r,keys:i}}render(s,e,t){return this.dt(s,e,t).values}update(s,[e,t,n]){const i=uo(s),{values:r,keys:a}=this.dt(e,t,n);if(!Array.isArray(i))return this.ut=a,r;const o=this.ut??(this.ut=[]),l=[];let d,u,h=0,c=i.length-1,f=0,A=r.length-1;for(;h<=c&&f<=A;)if(i[h]===null)h++;else if(i[c]===null)c--;else if(o[h]===a[f])l[f]=At(i[h],r[f]),h++,f++;else if(o[c]===a[A])l[A]=At(i[c],r[A]),c--,A--;else if(o[h]===a[A])l[A]=At(i[h],r[A]),vn(s,l[A+1],i[h]),h++,A--;else if(o[c]===a[f])l[f]=At(i[c],r[f]),vn(s,i[h],i[c]),c--,f++;else if(d===void 0&&(d=Er(a,f,A),u=Er(o,h,c)),d.has(o[h]))if(d.has(o[c])){const V=u.get(a[f]),ae=V!==void 0?i[V]:null;if(ae===null){const ze=vn(s,i[h]);At(ze,r[f]),l[f]=ze}else l[f]=At(ae,r[f]),vn(s,i[h],ae),i[V]=null;f++}else qs(i[c]),c--;else qs(i[h]),h++;for(;f<=A;){const V=vn(s,l[A+1]);At(V,r[f]),l[f++]=V}for(;h<=c;){const V=i[h++];V!==null&&qs(V)}return this.ut=a,ho(s,l),Kt}}),Be=pt`*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: \"\"}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",Segoe UI Symbol,\"Noto Color Emoji\";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.bottom-8{bottom:2rem}.bottom-\\[-1px\\]{bottom:-1px}.left-0{left:0}.left-8{left:2rem}.right-0{right:0}.right-8{right:2rem}.top-0{top:0}.top-12{top:3rem}.z-10{z-index:10}.z-50{z-index:50}.m-0{margin:0}.m-0\\.5{margin:.125rem}.m-2{margin:.5rem}.m-4{margin:1rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-auto{margin-top:auto;margin-bottom:auto}.mb-1{margin-bottom:.25rem}.mb-\\[-8px\\]{margin-bottom:-8px}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-20{margin-left:5rem}.mr-2{margin-right:.5rem}.mr-20{margin-right:5rem}.mt-4{margin-top:1rem}.inline-block{display:inline-block}.flex{display:flex}.hidden{display:none}.h-0{height:0px}.h-12{height:3rem}.h-2{height:.5rem}.h-2\\.5{height:.625rem}.h-3\\/5{height:60%}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-9{height:2.25rem}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.max-h-20{max-height:5rem}.max-h-\\[90vh\\]{max-height:90vh}.w-0{width:0px}.w-2{width:.5rem}.w-2\\.5{width:.625rem}.w-3\\/5{width:60%}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-9{width:2.25rem}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.max-w-\\[90vw\\]{max-width:90vw}.flex-1{flex:1 1 0%}.flex-grow{flex-grow:1}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.resize{resize:both}.snap-x{scroll-snap-type:x var(--tw-scroll-snap-strictness)}.snap-mandatory{--tw-scroll-snap-strictness: mandatory}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.whitespace-pre-wrap{white-space:pre-wrap}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-b-lg{border-bottom-right-radius:.5rem;border-bottom-left-radius:.5rem}.rounded-t-lg{border-top-left-radius:.5rem;border-top-right-radius:.5rem}.border{border-width:1px}.border-x-8{border-left-width:8px;border-right-width:8px}.border-t-8{border-top-width:8px}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity))}.border-x-transparent{border-left-color:transparent;border-right-color:transparent}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity))}.bg-gray-600{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-opacity-50{--tw-bg-opacity: .5}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-white{--tw-gradient-from: #fff var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.p-0{padding:0}.p-2{padding:.5rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.px-0{padding-left:0;padding-right:0}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-8{padding-bottom:2rem}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.text-center{text-align:center}.text-right{text-align:right}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.font-semibold{font-weight:600}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}:host{font-size:16px;line-height:1.2;text-align:left;--iai-chat-i-primary-color: var(--iai-chat-primary-color, #0B64F4);--iai-chat-i-text-color: var(--iai-chat-text-color, #FFF);--iai-chat-i-link-color: var(--iai-chat-link-color, var(--iai-chat-i-primary-color));--iai-chat-i-header-bg: var(--iai-chat-header-background-color, var(--iai-chat-i-primary-color));--iai-chat-i-header-fg: var(--iai-chat-header-text-color, var(--iai-chat-i-text-color));--iai-chat-i-button-bg: var(--iai-chat-button-background-color, var(--iai-chat-i-primary-color));--iai-chat-i-button-fg: var(--iai-chat-button-text-color, var(--iai-chat-i-text-color));--iai-chat-i-message-user-bg: var(--iai-chat-messages-user-background-color, var(--iai-chat-i-primary-color));--iai-chat-i-message-user-fg: var(--iai-chat-messages-user-text-color, var(--iai-chat-i-text-color));--iai-chat-i-message-assistant-bg: var(--iai-chat-messages-assistant-background-color, #6B7280);--iai-chat-i-message-assistant-fg: var(--iai-chat-messages-assistant-text-color, var(--iai-chat-i-text-color));--iai-chat-i-ocb-bg: var(--iai-chat-open-chat-button-background-color, var(--iai-chat-i-primary-color));--iai-chat-i-ocb-fg: var(--iai-chat-open-chat-button-icon-color, var(--iai-chat-i-text-color));--iai-chat-i-iframe-modal-header-bg: var(--iai-chat-iframe-modal-background-color, var(--iai-chat-i-primary-color));--iai-chat-i-iframe-modal-header-fg: var(--iai-chat-iframe-modal-text-color, var(--iai-chat-i-text-color))}h1{font-size:1.5em}h2{font-size:1.17em}h3{font-size:1em}ol,ul{display:flex;flex-direction:column;padding:0;margin-left:20px;gap:8px}ol{list-style-type:decimal}a{color:var(--iai-chat-i-link-color)}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.disabled\\:bg-gray-200:disabled{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity))}.disabled\\:opacity-50:disabled{opacity:.5}@media (min-width: 768px){.md\\:bottom-8{bottom:2rem}.md\\:left-8{left:2rem}.md\\:right-8{right:2rem}.md\\:flex{display:flex}.md\\:h-\\[500px\\]{height:500px}.md\\:h-fit{height:-moz-fit-content;height:fit-content}.md\\:w-\\[350px\\]{width:350px}.md\\:w-fit{width:-moz-fit-content;width:fit-content}.md\\:p-0{padding:0}.md\\:px-0{padding-left:0;padding-right:0}.md\\:pb-0{padding-bottom:0}}`;var po=Object.defineProperty,fo=Object.getOwnPropertyDescriptor,as=(s,e,t,n)=>{for(var i=n>1?void 0:n?fo(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&po(e,t,i),i};let qt=class extends xe{constructor(){super(...arguments),this.activeIndex=0,this.items=[]}render(){return U`
|
|
64
64
|
<div>
|
|
65
65
|
<div
|
|
66
66
|
id="carousel"
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
</button>
|
|
87
87
|
|
|
88
88
|
<div class="flex justify-center space-x-2">
|
|
89
|
-
${
|
|
89
|
+
${Cr(this.items,(s,e)=>e,(s,e)=>U`
|
|
90
90
|
<span
|
|
91
91
|
class="h-2.5 w-2.5 bg-gray-400 rounded-full inline-block ${this.activeIndex===e?"bg-gray-600":""}"
|
|
92
92
|
@click=${()=>this.scrollToIndex(e)}
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
</button>
|
|
109
109
|
</div>
|
|
110
110
|
</div>
|
|
111
|
-
`}onSlotChange(
|
|
111
|
+
`}onSlotChange(s){const e=s.target;this.items=(e==null?void 0:e.assignedElements())||[]}onScroll(){const{carousel:s}=this;if(!s)return;let e=0,t=1/0;this.items.forEach((n,i)=>{const r=Math.abs(n.offsetLeft-s.scrollLeft);r<t&&(t=r,e=i)}),this.activeIndex=e}scrollCarousel(s){this.scrollToIndex(this.activeIndex+s)}scrollToIndex(s){s!==this.activeIndex&&(this.activeIndex=Math.max(0,Math.min(s,this.items.length-1)),this.scrollToActiveItem())}scrollToActiveItem(){const{carousel:s,items:e,activeIndex:t}=this;if(!s)return;const n=e[t];n&&s.scrollTo({left:n.offsetLeft-s.clientWidth/2+n.clientWidth/2,behavior:"smooth"})}};qt.styles=[Be,pt`
|
|
112
112
|
::slotted(div) {
|
|
113
113
|
flex: 0 0 auto;
|
|
114
114
|
scroll-snap-align: start;
|
|
@@ -119,26 +119,26 @@
|
|
|
119
119
|
border-radius: 0.25rem;
|
|
120
120
|
margin-right: 1rem;
|
|
121
121
|
}
|
|
122
|
-
`],
|
|
122
|
+
`],as([ne({type:Number})],qt.prototype,"activeIndex",2),as([ne({type:Array})],qt.prototype,"items",2),as([ns("#carousel")],qt.prototype,"carousel",2),qt=as([He("iai-chat-carousel")],qt);function go(s){if(Array.isArray(s)){for(var e=0,t=Array(s.length);e<s.length;e++)t[e]=s[e];return t}else return Array.from(s)}var Js=!1;if(typeof window<"u"){var Or={get passive(){Js=!0}};window.addEventListener("testPassive",null,Or),window.removeEventListener("testPassive",null,Or)}var os=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1),Tt=[],ls=!1,Ir=-1,bn=void 0,St=void 0,wn=void 0,Mr=function(s){return Tt.some(function(e){return!!(e.options.allowTouchMove&&e.options.allowTouchMove(s))})},Qs=function(s){var e=s||window.event;return Mr(e.target)||e.touches.length>1?!0:(e.preventDefault&&e.preventDefault(),!1)},mo=function(s){if(wn===void 0){var e=!!s&&s.reserveScrollBarGap===!0,t=window.innerWidth-document.documentElement.clientWidth;if(e&&t>0){var n=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);wn=document.body.style.paddingRight,document.body.style.paddingRight=n+t+"px"}}bn===void 0&&(bn=document.body.style.overflow,document.body.style.overflow="hidden")},yo=function(){wn!==void 0&&(document.body.style.paddingRight=wn,wn=void 0),bn!==void 0&&(document.body.style.overflow=bn,bn=void 0)},vo=function(){return window.requestAnimationFrame(function(){if(St===void 0){St={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var s=window,e=s.scrollY,t=s.scrollX,n=s.innerHeight;document.body.style.position="fixed",document.body.style.top=-e,document.body.style.left=-t,setTimeout(function(){return window.requestAnimationFrame(function(){var i=n-window.innerHeight;i&&e>=n&&(document.body.style.top=-(e+i))})},300)}})},bo=function(){if(St!==void 0){var s=-parseInt(document.body.style.top,10),e=-parseInt(document.body.style.left,10);document.body.style.position=St.position,document.body.style.top=St.top,document.body.style.left=St.left,window.scrollTo(e,s),St=void 0}},wo=function(s){return s?s.scrollHeight-s.scrollTop<=s.clientHeight:!1},_o=function(s,e){var t=s.targetTouches[0].clientY-Ir;return Mr(s.target)?!1:e&&e.scrollTop===0&&t>0||wo(e)&&t<0?Qs(s):(s.stopPropagation(),!0)},xo=function(s,e){if(!s){console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");return}if(!Tt.some(function(n){return n.targetElement===s})){var t={targetElement:s,options:e||{}};Tt=[].concat(go(Tt),[t]),os?vo():mo(e),os&&(s.ontouchstart=function(n){n.targetTouches.length===1&&(Ir=n.targetTouches[0].clientY)},s.ontouchmove=function(n){n.targetTouches.length===1&&_o(n,s)},ls||(document.addEventListener("touchmove",Qs,Js?{passive:!1}:void 0),ls=!0))}},Nr=function(s){if(!s){console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");return}Tt=Tt.filter(function(e){return e.targetElement!==s}),os&&(s.ontouchstart=null,s.ontouchmove=null,ls&&Tt.length===0&&(document.removeEventListener("touchmove",Qs,Js?{passive:!1}:void 0),ls=!1)),os?bo():yo()};/**
|
|
123
123
|
* @license
|
|
124
124
|
* Copyright 2017 Google LLC
|
|
125
125
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
126
|
-
*/const
|
|
126
|
+
*/const Ys={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Gs=s=>(...e)=>({_$litDirective$:s,values:e});let Xs=class{constructor(s){}get _$AU(){return this._$AM._$AU}_$AT(s,e,t){this._$Ct=s,this._$AM=e,this._$Ci=t}_$AS(s,e){return this.update(s,e)}update(s,e){return this.render(...e)}};/**
|
|
127
127
|
* @license
|
|
128
128
|
* Copyright 2018 Google LLC
|
|
129
129
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
130
|
-
*/const Rr=
|
|
130
|
+
*/const Rr=Gs(class extends Xs{constructor(s){var e;if(super(s),s.type!==Ys.ATTRIBUTE||s.name!=="class"||((e=s.strings)==null?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(e=>s[e]).join(" ")+" "}update(s,[e]){var t,n;if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(const r in e)e[r]&&!((t=this.nt)!=null&&t.has(r))&&this.st.add(r);return this.render(e)}const i=s.element.classList;for(const r of this.st)r in e||(i.remove(r),this.st.delete(r));for(const r in e){const a=!!e[r];a===this.st.has(r)||(n=this.nt)!=null&&n.has(r)||(a?(i.add(r),this.st.add(r)):(i.remove(r),this.st.delete(r)))}return et}});/**
|
|
131
131
|
* @license
|
|
132
132
|
* Copyright 2018 Google LLC
|
|
133
133
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
134
|
-
*/const Pr="important",ko=" !"+Pr,Ct=Gi(class extends Xi{constructor(i){var e;if(super(i),i.type!==Yi.ATTRIBUTE||i.name!=="style"||((e=i.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(i){return Object.keys(i).reduce((e,t)=>{const n=i[t];return n==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(i,[e]){const{style:t}=i.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const n of this.ft)e[n]==null&&(this.ft.delete(n),n.includes("-")?t.removeProperty(n):t[n]=null);for(const n in e){const s=e[n];if(s!=null){this.ft.add(n);const r=typeof s=="string"&&s.endsWith(ko);n.includes("-")||r?t.setProperty(n,r?s.slice(0,-11):s,r?Pr:""):t[n]=s}}return et}});var $o=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jr(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var es={};(function(i){function e(o){o&&o.options&&clearTimeout(o.options.timer)}function t(o,l,d,u){var h={timer:void 0,lastArgs:[]},c=function(){for(var f=this,A=[],V=0;V<arguments.length;V++)A[V]=arguments[V];h.lastArgs=A,h.timer?clearTimeout(h.timer):l&&d.apply(this,h.lastArgs),h.timer=setTimeout(function(){l||d.apply(f,h.lastArgs),h.timer=void 0},o)};return u&&(c=c.bind(u)),c.options=h,c}function n(o,l,d,u){var h;Object.defineProperty(d,u,{configurable:!0,enumerable:!1,get:function(){return h},set:function(c){h=t(o,l,c,this)}})}function s(o,l,d){var u=d.value;return d.value=t(o,l,u),d}function r(o,l){for(var d=[],u=2;u<arguments.length;u++)d[u-2]=arguments[u];if(d.length===0)throw new Error("function applied debounce decorator should be a method");if(d.length===1)throw new Error("method applied debounce decorator should have valid name");var h=d[0],c=d[1],f=d.length===3&&d[2]?d[2]:Object.getOwnPropertyDescriptor(h,c);if(f)return s(o,l,f);n(o,l,h,c)}function a(){for(var o=[],l=0;l<arguments.length;l++)o[l]=arguments[l];var d=500,u=!1;if(o.length&&(typeof o[0]=="number"||typeof o[0]=="object"&&o[0].leading!==void 0)){typeof o[0]=="number"&&(d=o[0]);var h=void 0;return typeof o[0]=="object"&&o[0].leading!==void 0&&(h=o[0]),1<o.length&&typeof o[1]=="object"&&o[1].leading!==void 0&&(h=o[1]),h&&(u=h.leading),function(){for(var c=[],f=0;f<arguments.length;f++)c[f]=arguments[f];return r.apply(void 0,[d,u].concat(c))}}return r.apply(void 0,[d,u].concat(o))}Object.defineProperty(i,"__esModule",{value:!0}),i.cancel=e,i.debounce=a})(es);var B;(function(i){i.assertEqual=s=>s;function e(s){}i.assertIs=e;function t(s){throw new Error}i.assertNever=t,i.arrayToEnum=s=>{const r={};for(const a of s)r[a]=a;return r},i.getValidEnumValues=s=>{const r=i.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),a={};for(const o of r)a[o]=s[o];return i.objectValues(a)},i.objectValues=s=>i.objectKeys(s).map(function(r){return s[r]}),i.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const r=[];for(const a in s)Object.prototype.hasOwnProperty.call(s,a)&&r.push(a);return r},i.find=(s,r)=>{for(const a of s)if(r(a))return a},i.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,r=" | "){return s.map(a=>typeof a=="string"?`'${a}'`:a).join(r)}i.joinValues=n,i.jsonStringifyReplacer=(s,r)=>typeof r=="bigint"?r.toString():r})(B||(B={}));var ts;(function(i){i.mergeShapes=(e,t)=>({...e,...t})})(ts||(ts={}));const y=B.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),nt=i=>{switch(typeof i){case"undefined":return y.undefined;case"string":return y.string;case"number":return isNaN(i)?y.nan:y.number;case"boolean":return y.boolean;case"function":return y.function;case"bigint":return y.bigint;case"symbol":return y.symbol;case"object":return Array.isArray(i)?y.array:i===null?y.null:i.then&&typeof i.then=="function"&&i.catch&&typeof i.catch=="function"?y.promise:typeof Map<"u"&&i instanceof Map?y.map:typeof Set<"u"&&i instanceof Set?y.set:typeof Date<"u"&&i instanceof Date?y.date:y.object;default:return y.unknown}},m=B.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"]),Ao=i=>JSON.stringify(i,null,2).replace(/"([^"]+)":/g,"$1:");class Se extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(r){return r.message},n={_errors:[]},s=r=>{for(const a of r.issues)if(a.code==="invalid_union")a.unionErrors.map(s);else if(a.code==="invalid_return_type")s(a.returnTypeError);else if(a.code==="invalid_arguments")s(a.argumentsError);else if(a.path.length===0)n._errors.push(t(a));else{let o=n,l=0;for(;l<a.path.length;){const d=a.path[l];l===a.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(a))):o[d]=o[d]||{_errors:[]},o=o[d],l++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,B.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Se.create=i=>new Se(i);const _n=(i,e)=>{let t;switch(i.code){case m.invalid_type:i.received===y.undefined?t="Required":t=`Expected ${i.expected}, received ${i.received}`;break;case m.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(i.expected,B.jsonStringifyReplacer)}`;break;case m.unrecognized_keys:t=`Unrecognized key(s) in object: ${B.joinValues(i.keys,", ")}`;break;case m.invalid_union:t="Invalid input";break;case m.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${B.joinValues(i.options)}`;break;case m.invalid_enum_value:t=`Invalid enum value. Expected ${B.joinValues(i.options)}, received '${i.received}'`;break;case m.invalid_arguments:t="Invalid function arguments";break;case m.invalid_return_type:t="Invalid function return type";break;case m.invalid_date:t="Invalid date";break;case m.invalid_string:typeof i.validation=="object"?"includes"in i.validation?(t=`Invalid input: must include "${i.validation.includes}"`,typeof i.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${i.validation.position}`)):"startsWith"in i.validation?t=`Invalid input: must start with "${i.validation.startsWith}"`:"endsWith"in i.validation?t=`Invalid input: must end with "${i.validation.endsWith}"`:B.assertNever(i.validation):i.validation!=="regex"?t=`Invalid ${i.validation}`:t="Invalid";break;case m.too_small:i.type==="array"?t=`Array must contain ${i.exact?"exactly":i.inclusive?"at least":"more than"} ${i.minimum} element(s)`:i.type==="string"?t=`String must contain ${i.exact?"exactly":i.inclusive?"at least":"over"} ${i.minimum} character(s)`:i.type==="number"?t=`Number must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${i.minimum}`:i.type==="date"?t=`Date must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(i.minimum))}`:t="Invalid input";break;case m.too_big:i.type==="array"?t=`Array must contain ${i.exact?"exactly":i.inclusive?"at most":"less than"} ${i.maximum} element(s)`:i.type==="string"?t=`String must contain ${i.exact?"exactly":i.inclusive?"at most":"under"} ${i.maximum} character(s)`:i.type==="number"?t=`Number must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:i.type==="bigint"?t=`BigInt must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:i.type==="date"?t=`Date must be ${i.exact?"exactly":i.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(i.maximum))}`:t="Invalid input";break;case m.custom:t="Invalid input";break;case m.invalid_intersection_types:t="Intersection results could not be merged";break;case m.not_multiple_of:t=`Number must be a multiple of ${i.multipleOf}`;break;case m.not_finite:t="Number must be finite";break;default:t=e.defaultError,B.assertNever(i)}return{message:t}};let zr=_n;function To(i){zr=i}function ci(){return zr}const di=i=>{const{data:e,path:t,errorMaps:n,issueData:s}=i,r=[...t,...s.path||[]],a={...s,path:r};let o="";const l=n.filter(d=>!!d).slice().reverse();for(const d of l)o=d(a,{data:e,defaultError:o}).message;return{...s,path:r,message:s.message||o}},So=[];function b(i,e){const t=di({issueData:e,data:i.data,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,ci(),_n].filter(n=>!!n)});i.common.issues.push(t)}class me{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return P;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t)n.push({key:await s.key,value:await s.value});return me.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:r,value:a}=s;if(r.status==="aborted"||a.status==="aborted")return P;r.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof a.value<"u"||s.alwaysSet)&&(n[r.value]=a.value)}return{status:e.value,value:n}}}const P=Object.freeze({status:"aborted"}),Dr=i=>({status:"dirty",value:i}),ve=i=>({status:"valid",value:i}),ns=i=>i.status==="aborted",is=i=>i.status==="dirty",xn=i=>i.status==="valid",hi=i=>typeof Promise<"u"&&i instanceof Promise;var T;(function(i){i.errToObj=e=>typeof e=="string"?{message:e}:e||{},i.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(T||(T={}));class Ne{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Lr=(i,e)=>{if(xn(e))return{success:!0,data:e.value};if(!i.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Se(i.common.issues);return this._error=t,this._error}}};function j(i){if(!i)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=i;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(r,a)=>r.code!=="invalid_type"?{message:a.defaultError}:typeof a.data>"u"?{message:n??a.defaultError}:{message:t??a.defaultError},description:s}}class L{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)}get description(){return this._def.description}_getType(e){return nt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new me,ctx:{common:e.parent.common,data:e.data,parsedType:nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(hi(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nt(e)},r=this._parseSync({data:e,path:s.path,parent:s});return Lr(s,r)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nt(e)},s=this._parse({data:e,path:n.path,parent:n}),r=await(hi(s)?s:Promise.resolve(s));return Lr(n,r)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,r)=>{const a=e(s),o=()=>r.addIssue({code:m.custom,...n(s)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new Oe({schema:this,typeName:I.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Ve.create(this,this._def)}nullable(){return Mt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ee.create(this,this._def)}promise(){return Gt.create(this,this._def)}or(e){return Tn.create([this,e],this._def)}and(e){return Sn.create(this,e,this._def)}transform(e){return new Oe({...j(this._def),schema:this,typeName:I.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Mn({...j(this._def),innerType:this,defaultValue:t,typeName:I.ZodDefault})}brand(){return new Hr({typeName:I.ZodBranded,type:this,...j(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new yi({...j(this._def),innerType:this,catchValue:t,typeName:I.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Nn.create(this,e)}readonly(){return bi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Co=/^c[^\s-]{8,}$/i,Eo=/^[a-z][a-z0-9]*$/,Oo=/^[0-9A-HJKMNP-TV-Z]{26}$/,Io=/^[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,Mo=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,No="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ss;const Ro=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Po=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,jo=i=>i.precision?i.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${i.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${i.precision}}Z$`):i.precision===0?i.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):i.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function zo(i,e){return!!((e==="v4"||!e)&&Ro.test(i)||(e==="v6"||!e)&&Po.test(i))}class Ce extends L{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==y.string){const s=this._getOrReturnCtx(e);return b(s,{code:m.invalid_type,expected:y.string,received:s.parsedType}),P}const t=new me;let n;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:m.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="max")e.data.length>s.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:m.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="length"){const r=e.data.length>s.value,a=e.data.length<s.value;(r||a)&&(n=this._getOrReturnCtx(e,n),r?b(n,{code:m.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&b(n,{code:m.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),t.dirty())}else if(s.kind==="email")Mo.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"email",code:m.invalid_string,message:s.message}),t.dirty());else if(s.kind==="emoji")ss||(ss=new RegExp(No,"u")),ss.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"emoji",code:m.invalid_string,message:s.message}),t.dirty());else if(s.kind==="uuid")Io.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"uuid",code:m.invalid_string,message:s.message}),t.dirty());else if(s.kind==="cuid")Co.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"cuid",code:m.invalid_string,message:s.message}),t.dirty());else if(s.kind==="cuid2")Eo.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"cuid2",code:m.invalid_string,message:s.message}),t.dirty());else if(s.kind==="ulid")Oo.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"ulid",code:m.invalid_string,message:s.message}),t.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),b(n,{validation:"url",code:m.invalid_string,message:s.message}),t.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"regex",code:m.invalid_string,message:s.message}),t.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(n=this._getOrReturnCtx(e,n),b(n,{code:m.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),t.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(n=this._getOrReturnCtx(e,n),b(n,{code:m.invalid_string,validation:{startsWith:s.value},message:s.message}),t.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(n=this._getOrReturnCtx(e,n),b(n,{code:m.invalid_string,validation:{endsWith:s.value},message:s.message}),t.dirty()):s.kind==="datetime"?jo(s).test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{code:m.invalid_string,validation:"datetime",message:s.message}),t.dirty()):s.kind==="ip"?zo(e.data,s.version)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"ip",code:m.invalid_string,message:s.message}),t.dirty()):B.assertNever(s);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:m.invalid_string,...T.errToObj(n)})}_addCheck(e){return new Ce({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...T.errToObj(e)})}url(e){return this._addCheck({kind:"url",...T.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...T.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...T.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...T.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...T.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...T.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...T.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,...T.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...T.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...T.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...T.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...T.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...T.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...T.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...T.errToObj(t)})}nonempty(e){return this.min(1,T.errToObj(e))}trim(){return new Ce({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ce({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ce({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Ce.create=i=>{var e;return new Ce({checks:[],typeName:I.ZodString,coerce:(e=i==null?void 0:i.coerce)!==null&&e!==void 0?e:!1,...j(i)})};function Do(i,e){const t=(i.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,r=parseInt(i.toFixed(s).replace(".","")),a=parseInt(e.toFixed(s).replace(".",""));return r%a/Math.pow(10,s)}class it extends L{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)!==y.number){const s=this._getOrReturnCtx(e);return b(s,{code:m.invalid_type,expected:y.number,received:s.parsedType}),P}let t;const n=new me;for(const s of this._def.checks)s.kind==="int"?B.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),b(t,{code:m.invalid_type,expected:"integer",received:"float",message:s.message}),n.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:m.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:m.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="multipleOf"?Do(e.data,s.value)!==0&&(t=this._getOrReturnCtx(e,t),b(t,{code:m.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),b(t,{code:m.not_finite,message:s.message}),n.dirty()):B.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,T.toString(t))}gt(e,t){return this.setLimit("min",e,!1,T.toString(t))}lte(e,t){return this.setLimit("max",e,!0,T.toString(t))}lt(e,t){return this.setLimit("max",e,!1,T.toString(t))}setLimit(e,t,n,s){return new it({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:T.toString(s)}]})}_addCheck(e){return new it({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:T.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:T.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const 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"&&B.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;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)}}it.create=i=>new it({checks:[],typeName:I.ZodNumber,coerce:(i==null?void 0:i.coerce)||!1,...j(i)});class st extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==y.bigint){const s=this._getOrReturnCtx(e);return b(s,{code:m.invalid_type,expected:y.bigint,received:s.parsedType}),P}let t;const n=new me;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:m.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:m.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),b(t,{code:m.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):B.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,T.toString(t))}gt(e,t){return this.setLimit("min",e,!1,T.toString(t))}lte(e,t){return this.setLimit("max",e,!0,T.toString(t))}lt(e,t){return this.setLimit("max",e,!1,T.toString(t))}setLimit(e,t,n,s){return new st({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:T.toString(s)}]})}_addCheck(e){return new st({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}st.create=i=>{var e;return new st({checks:[],typeName:I.ZodBigInt,coerce:(e=i==null?void 0:i.coerce)!==null&&e!==void 0?e:!1,...j(i)})};class kn extends L{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==y.boolean){const t=this._getOrReturnCtx(e);return b(t,{code:m.invalid_type,expected:y.boolean,received:t.parsedType}),P}return ve(e.data)}}kn.create=i=>new kn({typeName:I.ZodBoolean,coerce:(i==null?void 0:i.coerce)||!1,...j(i)});class Et extends L{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==y.date){const s=this._getOrReturnCtx(e);return b(s,{code:m.invalid_type,expected:y.date,received:s.parsedType}),P}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return b(s,{code:m.invalid_date}),P}const t=new me;let n;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:m.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),t.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:m.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),t.dirty()):B.assertNever(s);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Et({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:T.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:T.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}Et.create=i=>new Et({checks:[],coerce:(i==null?void 0:i.coerce)||!1,typeName:I.ZodDate,...j(i)});class ui extends L{_parse(e){if(this._getType(e)!==y.symbol){const t=this._getOrReturnCtx(e);return b(t,{code:m.invalid_type,expected:y.symbol,received:t.parsedType}),P}return ve(e.data)}}ui.create=i=>new ui({typeName:I.ZodSymbol,...j(i)});class $n extends L{_parse(e){if(this._getType(e)!==y.undefined){const t=this._getOrReturnCtx(e);return b(t,{code:m.invalid_type,expected:y.undefined,received:t.parsedType}),P}return ve(e.data)}}$n.create=i=>new $n({typeName:I.ZodUndefined,...j(i)});class An extends L{_parse(e){if(this._getType(e)!==y.null){const t=this._getOrReturnCtx(e);return b(t,{code:m.invalid_type,expected:y.null,received:t.parsedType}),P}return ve(e.data)}}An.create=i=>new An({typeName:I.ZodNull,...j(i)});class Jt extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return ve(e.data)}}Jt.create=i=>new Jt({typeName:I.ZodAny,...j(i)});class Ot extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ve(e.data)}}Ot.create=i=>new Ot({typeName:I.ZodUnknown,...j(i)});class We extends L{_parse(e){const t=this._getOrReturnCtx(e);return b(t,{code:m.invalid_type,expected:y.never,received:t.parsedType}),P}}We.create=i=>new We({typeName:I.ZodNever,...j(i)});class pi extends L{_parse(e){if(this._getType(e)!==y.undefined){const t=this._getOrReturnCtx(e);return b(t,{code:m.invalid_type,expected:y.void,received:t.parsedType}),P}return ve(e.data)}}pi.create=i=>new pi({typeName:I.ZodVoid,...j(i)});class Ee extends L{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==y.array)return b(t,{code:m.invalid_type,expected:y.array,received:t.parsedType}),P;if(s.exactLength!==null){const a=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(a||o)&&(b(t,{code:a?m.too_big:m.too_small,minimum:o?s.exactLength.value:void 0,maximum:a?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(b(t,{code:m.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(b(t,{code:m.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((a,o)=>s.type._parseAsync(new Ne(t,a,t.path,o)))).then(a=>me.mergeArray(n,a));const r=[...t.data].map((a,o)=>s.type._parseSync(new Ne(t,a,t.path,o)));return me.mergeArray(n,r)}get element(){return this._def.type}min(e,t){return new Ee({...this._def,minLength:{value:e,message:T.toString(t)}})}max(e,t){return new Ee({...this._def,maxLength:{value:e,message:T.toString(t)}})}length(e,t){return new Ee({...this._def,exactLength:{value:e,message:T.toString(t)}})}nonempty(e){return this.min(1,e)}}Ee.create=(i,e)=>new Ee({type:i,minLength:null,maxLength:null,exactLength:null,typeName:I.ZodArray,...j(e)});function Qt(i){if(i instanceof ee){const e={};for(const t in i.shape){const n=i.shape[t];e[t]=Ve.create(Qt(n))}return new ee({...i._def,shape:()=>e})}else return i instanceof Ee?new Ee({...i._def,type:Qt(i.element)}):i instanceof Ve?Ve.create(Qt(i.unwrap())):i instanceof Mt?Mt.create(Qt(i.unwrap())):i instanceof Re?Re.create(i.items.map(e=>Qt(e))):i}class ee extends L{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=B.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==y.object){const l=this._getOrReturnCtx(e);return b(l,{code:m.invalid_type,expected:y.object,received:l.parsedType}),P}const{status:t,ctx:n}=this._processInputParams(e),{shape:s,keys:r}=this._getCached(),a=[];if(!(this._def.catchall instanceof We&&this._def.unknownKeys==="strip"))for(const l in n.data)r.includes(l)||a.push(l);const o=[];for(const l of r){const d=s[l],u=n.data[l];o.push({key:{status:"valid",value:l},value:d._parse(new Ne(n,u,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof We){const l=this._def.unknownKeys;if(l==="passthrough")for(const d of a)o.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(l==="strict")a.length>0&&(b(n,{code:m.unrecognized_keys,keys:a}),t.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const d of a){const u=n.data[d];o.push({key:{status:"valid",value:d},value:l._parse(new Ne(n,u,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const l=[];for(const d of o){const u=await d.key;l.push({key:u,value:await d.value,alwaysSet:d.alwaysSet})}return l}).then(l=>me.mergeObjectSync(t,l)):me.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return T.errToObj,new ee({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,r,a,o;const l=(a=(r=(s=this._def).errorMap)===null||r===void 0?void 0:r.call(s,t,n).message)!==null&&a!==void 0?a:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=T.errToObj(e).message)!==null&&o!==void 0?o:l}:{message:l}}}:{}})}strip(){return new ee({...this._def,unknownKeys:"strip"})}passthrough(){return new ee({...this._def,unknownKeys:"passthrough"})}extend(e){return new ee({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ee({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:I.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ee({...this._def,catchall:e})}pick(e){const t={};return B.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new ee({...this._def,shape:()=>t})}omit(e){const t={};return B.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new ee({...this._def,shape:()=>t})}deepPartial(){return Qt(this)}partial(e){const t={};return B.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new ee({...this._def,shape:()=>t})}required(e){const t={};return B.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof Ve;)s=s._def.innerType;t[n]=s}}),new ee({...this._def,shape:()=>t})}keyof(){return Zr(B.objectKeys(this.shape))}}ee.create=(i,e)=>new ee({shape:()=>i,unknownKeys:"strip",catchall:We.create(),typeName:I.ZodObject,...j(e)}),ee.strictCreate=(i,e)=>new ee({shape:()=>i,unknownKeys:"strict",catchall:We.create(),typeName:I.ZodObject,...j(e)}),ee.lazycreate=(i,e)=>new ee({shape:i,unknownKeys:"strip",catchall:We.create(),typeName:I.ZodObject,...j(e)});class Tn extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(r){for(const o of r)if(o.result.status==="valid")return o.result;for(const o of r)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const a=r.map(o=>new Se(o.ctx.common.issues));return b(t,{code:m.invalid_union,unionErrors:a}),P}if(t.common.async)return Promise.all(n.map(async r=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await r._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(s);{let r;const a=[];for(const l of n){const d={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!r&&(r={result:u,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;const o=a.map(l=>new Se(l));return b(t,{code:m.invalid_union,unionErrors:o}),P}}get options(){return this._def.options}}Tn.create=(i,e)=>new Tn({options:i,typeName:I.ZodUnion,...j(e)});const fi=i=>i instanceof En?fi(i.schema):i instanceof Oe?fi(i.innerType()):i instanceof On?[i.value]:i instanceof rt?i.options:i instanceof In?Object.keys(i.enum):i instanceof Mn?fi(i._def.innerType):i instanceof $n?[void 0]:i instanceof An?[null]:null;class mi extends L{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==y.object)return b(t,{code:m.invalid_type,expected:y.object,received:t.parsedType}),P;const n=this.discriminator,s=t.data[n],r=this.optionsMap.get(s);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(b(t,{code:m.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(e,t,n){const s=new Map;for(const r of t){const a=fi(r.shape[e]);if(!a)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,r)}}return new mi({typeName:I.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...j(n)})}}function rs(i,e){const t=nt(i),n=nt(e);if(i===e)return{valid:!0,data:i};if(t===y.object&&n===y.object){const s=B.objectKeys(e),r=B.objectKeys(i).filter(o=>s.indexOf(o)!==-1),a={...i,...e};for(const o of r){const l=rs(i[o],e[o]);if(!l.valid)return{valid:!1};a[o]=l.data}return{valid:!0,data:a}}else if(t===y.array&&n===y.array){if(i.length!==e.length)return{valid:!1};const s=[];for(let r=0;r<i.length;r++){const a=i[r],o=e[r],l=rs(a,o);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return t===y.date&&n===y.date&&+i==+e?{valid:!0,data:i}:{valid:!1}}class Sn extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(r,a)=>{if(ns(r)||ns(a))return P;const o=rs(r.value,a.value);return o.valid?((is(r)||is(a))&&t.dirty(),{status:t.value,value:o.data}):(b(n,{code:m.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(([r,a])=>s(r,a)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Sn.create=(i,e,t)=>new Sn({left:i,right:e,typeName:I.ZodIntersection,...j(t)});class Re extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.array)return b(n,{code:m.invalid_type,expected:y.array,received:n.parsedType}),P;if(n.data.length<this._def.items.length)return b(n,{code:m.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),P;!this._def.rest&&n.data.length>this._def.items.length&&(b(n,{code:m.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...n.data].map((r,a)=>{const o=this._def.items[a]||this._def.rest;return o?o._parse(new Ne(n,r,n.path,a)):null}).filter(r=>!!r);return n.common.async?Promise.all(s).then(r=>me.mergeArray(t,r)):me.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new Re({...this._def,rest:e})}}Re.create=(i,e)=>{if(!Array.isArray(i))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Re({items:i,typeName:I.ZodTuple,rest:null,...j(e)})};class Cn extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.object)return b(n,{code:m.invalid_type,expected:y.object,received:n.parsedType}),P;const s=[],r=this._def.keyType,a=this._def.valueType;for(const o in n.data)s.push({key:r._parse(new Ne(n,o,n.path,o)),value:a._parse(new Ne(n,n.data[o],n.path,o))});return n.common.async?me.mergeObjectAsync(t,s):me.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof L?new Cn({keyType:e,valueType:t,typeName:I.ZodRecord,...j(n)}):new Cn({keyType:Ce.create(),valueType:e,typeName:I.ZodRecord,...j(t)})}}class gi extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.map)return b(n,{code:m.invalid_type,expected:y.map,received:n.parsedType}),P;const s=this._def.keyType,r=this._def.valueType,a=[...n.data.entries()].map(([o,l],d)=>({key:s._parse(new Ne(n,o,n.path,[d,"key"])),value:r._parse(new Ne(n,l,n.path,[d,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of a){const d=await l.key,u=await l.value;if(d.status==="aborted"||u.status==="aborted")return P;(d.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(d.value,u.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of a){const d=l.key,u=l.value;if(d.status==="aborted"||u.status==="aborted")return P;(d.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(d.value,u.value)}return{status:t.value,value:o}}}}gi.create=(i,e,t)=>new gi({valueType:e,keyType:i,typeName:I.ZodMap,...j(t)});class It extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.set)return b(n,{code:m.invalid_type,expected:y.set,received:n.parsedType}),P;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(b(n,{code:m.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(b(n,{code:m.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const r=this._def.valueType;function a(l){const d=new Set;for(const u of l){if(u.status==="aborted")return P;u.status==="dirty"&&t.dirty(),d.add(u.value)}return{status:t.value,value:d}}const o=[...n.data.values()].map((l,d)=>r._parse(new Ne(n,l,n.path,d)));return n.common.async?Promise.all(o).then(l=>a(l)):a(o)}min(e,t){return new It({...this._def,minSize:{value:e,message:T.toString(t)}})}max(e,t){return new It({...this._def,maxSize:{value:e,message:T.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}It.create=(i,e)=>new It({valueType:i,minSize:null,maxSize:null,typeName:I.ZodSet,...j(e)});class Yt extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==y.function)return b(t,{code:m.invalid_type,expected:y.function,received:t.parsedType}),P;function n(o,l){return di({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ci(),_n].filter(d=>!!d),issueData:{code:m.invalid_arguments,argumentsError:l}})}function s(o,l){return di({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ci(),_n].filter(d=>!!d),issueData:{code:m.invalid_return_type,returnTypeError:l}})}const r={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Gt){const o=this;return ve(async function(...l){const d=new Se([]),u=await o._def.args.parseAsync(l,r).catch(c=>{throw d.addIssue(n(l,c)),d}),h=await Reflect.apply(a,this,u);return await o._def.returns._def.type.parseAsync(h,r).catch(c=>{throw d.addIssue(s(h,c)),d})})}else{const o=this;return ve(function(...l){const d=o._def.args.safeParse(l,r);if(!d.success)throw new Se([n(l,d.error)]);const u=Reflect.apply(a,this,d.data),h=o._def.returns.safeParse(u,r);if(!h.success)throw new Se([s(u,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Yt({...this._def,args:Re.create(e).rest(Ot.create())})}returns(e){return new Yt({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Yt({args:e||Re.create([]).rest(Ot.create()),returns:t||Ot.create(),typeName:I.ZodFunction,...j(n)})}}class En extends L{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}En.create=(i,e)=>new En({getter:i,typeName:I.ZodLazy,...j(e)});class On extends L{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return b(t,{received:t.data,code:m.invalid_literal,expected:this._def.value}),P}return{status:"valid",value:e.data}}get value(){return this._def.value}}On.create=(i,e)=>new On({value:i,typeName:I.ZodLiteral,...j(e)});function Zr(i,e){return new rt({values:i,typeName:I.ZodEnum,...j(e)})}class rt extends L{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return b(t,{expected:B.joinValues(n),received:t.parsedType,code:m.invalid_type}),P}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),n=this._def.values;return b(t,{received:t.data,code:m.invalid_enum_value,options:n}),P}return ve(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return rt.create(e)}exclude(e){return rt.create(this.options.filter(t=>!e.includes(t)))}}rt.create=Zr;class In extends L{_parse(e){const t=B.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==y.string&&n.parsedType!==y.number){const s=B.objectValues(t);return b(n,{expected:B.joinValues(s),received:n.parsedType,code:m.invalid_type}),P}if(t.indexOf(e.data)===-1){const s=B.objectValues(t);return b(n,{received:n.data,code:m.invalid_enum_value,options:s}),P}return ve(e.data)}get enum(){return this._def.values}}In.create=(i,e)=>new In({values:i,typeName:I.ZodNativeEnum,...j(e)});class Gt extends L{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==y.promise&&t.common.async===!1)return b(t,{code:m.invalid_type,expected:y.promise,received:t.parsedType}),P;const n=t.parsedType===y.promise?t.data:Promise.resolve(t.data);return ve(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Gt.create=(i,e)=>new Gt({type:i,typeName:I.ZodPromise,...j(e)});class Oe extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===I.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,r={addIssue:a=>{b(n,a),a.fatal?t.abort():t.dirty()},get path(){return n.path}};if(r.addIssue=r.addIssue.bind(r),s.type==="preprocess"){const a=s.transform(n.data,r);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(a).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:a,path:n.path,parent:n})}if(s.type==="refinement"){const a=o=>{const l=s.refinement(o,r);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?P:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?P:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!xn(a))return a;const o=s.transform(a.value,r);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>xn(a)?Promise.resolve(s.transform(a.value,r)).then(o=>({status:t.value,value:o})):a);B.assertNever(s)}}Oe.create=(i,e,t)=>new Oe({schema:i,typeName:I.ZodEffects,effect:e,...j(t)}),Oe.createWithPreprocess=(i,e,t)=>new Oe({schema:e,effect:{type:"preprocess",transform:i},typeName:I.ZodEffects,...j(t)});class Ve extends L{_parse(e){return this._getType(e)===y.undefined?ve(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ve.create=(i,e)=>new Ve({innerType:i,typeName:I.ZodOptional,...j(e)});class Mt extends L{_parse(e){return this._getType(e)===y.null?ve(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Mt.create=(i,e)=>new Mt({innerType:i,typeName:I.ZodNullable,...j(e)});class Mn extends L{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===y.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Mn.create=(i,e)=>new Mn({innerType:i,typeName:I.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...j(e)});class yi extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return hi(s)?s.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Se(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Se(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}yi.create=(i,e)=>new yi({innerType:i,typeName:I.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...j(e)});class vi extends L{_parse(e){if(this._getType(e)!==y.nan){const t=this._getOrReturnCtx(e);return b(t,{code:m.invalid_type,expected:y.nan,received:t.parsedType}),P}return{status:"valid",value:e.data}}}vi.create=i=>new vi({typeName:I.ZodNaN,...j(i)});const Lo=Symbol("zod_brand");class Hr extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Nn extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?P:s.status==="dirty"?(t.dirty(),Dr(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?P:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new Nn({in:e,out:t,typeName:I.ZodPipeline})}}class bi extends L{_parse(e){const t=this._def.innerType._parse(e);return xn(t)&&(t.value=Object.freeze(t.value)),t}}bi.create=(i,e)=>new bi({innerType:i,typeName:I.ZodReadonly,...j(e)});const Ur=(i,e={},t)=>i?Jt.create().superRefine((n,s)=>{var r,a;if(!i(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,l=(a=(r=o.fatal)!==null&&r!==void 0?r:t)!==null&&a!==void 0?a:!0,d=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...d,fatal:l})}}):Jt.create(),Zo={object:ee.lazycreate};var I;(function(i){i.ZodString="ZodString",i.ZodNumber="ZodNumber",i.ZodNaN="ZodNaN",i.ZodBigInt="ZodBigInt",i.ZodBoolean="ZodBoolean",i.ZodDate="ZodDate",i.ZodSymbol="ZodSymbol",i.ZodUndefined="ZodUndefined",i.ZodNull="ZodNull",i.ZodAny="ZodAny",i.ZodUnknown="ZodUnknown",i.ZodNever="ZodNever",i.ZodVoid="ZodVoid",i.ZodArray="ZodArray",i.ZodObject="ZodObject",i.ZodUnion="ZodUnion",i.ZodDiscriminatedUnion="ZodDiscriminatedUnion",i.ZodIntersection="ZodIntersection",i.ZodTuple="ZodTuple",i.ZodRecord="ZodRecord",i.ZodMap="ZodMap",i.ZodSet="ZodSet",i.ZodFunction="ZodFunction",i.ZodLazy="ZodLazy",i.ZodLiteral="ZodLiteral",i.ZodEnum="ZodEnum",i.ZodEffects="ZodEffects",i.ZodNativeEnum="ZodNativeEnum",i.ZodOptional="ZodOptional",i.ZodNullable="ZodNullable",i.ZodDefault="ZodDefault",i.ZodCatch="ZodCatch",i.ZodPromise="ZodPromise",i.ZodBranded="ZodBranded",i.ZodPipeline="ZodPipeline",i.ZodReadonly="ZodReadonly"})(I||(I={}));const Ho=(i,e={message:`Input not instance of ${i.name}`})=>Ur(t=>t instanceof i,e),Br=Ce.create,Wr=it.create,Uo=vi.create,Bo=st.create,Vr=kn.create,Wo=Et.create,Vo=ui.create,Fo=$n.create,Ko=An.create,qo=Jt.create,Jo=Ot.create,Qo=We.create,Yo=pi.create,Go=Ee.create,Xo=ee.create,el=ee.strictCreate,tl=Tn.create,nl=mi.create,il=Sn.create,sl=Re.create,rl=Cn.create,al=gi.create,ol=It.create,ll=Yt.create,cl=En.create,dl=On.create,hl=rt.create,ul=In.create,pl=Gt.create,Fr=Oe.create,fl=Ve.create,ml=Mt.create,gl=Oe.createWithPreprocess,yl=Nn.create;var _=Object.freeze({__proto__:null,defaultErrorMap:_n,setErrorMap:To,getErrorMap:ci,makeIssue:di,EMPTY_PATH:So,addIssueToContext:b,ParseStatus:me,INVALID:P,DIRTY:Dr,OK:ve,isAborted:ns,isDirty:is,isValid:xn,isAsync:hi,get util(){return B},get objectUtil(){return ts},ZodParsedType:y,getParsedType:nt,ZodType:L,ZodString:Ce,ZodNumber:it,ZodBigInt:st,ZodBoolean:kn,ZodDate:Et,ZodSymbol:ui,ZodUndefined:$n,ZodNull:An,ZodAny:Jt,ZodUnknown:Ot,ZodNever:We,ZodVoid:pi,ZodArray:Ee,ZodObject:ee,ZodUnion:Tn,ZodDiscriminatedUnion:mi,ZodIntersection:Sn,ZodTuple:Re,ZodRecord:Cn,ZodMap:gi,ZodSet:It,ZodFunction:Yt,ZodLazy:En,ZodLiteral:On,ZodEnum:rt,ZodNativeEnum:In,ZodPromise:Gt,ZodEffects:Oe,ZodTransformer:Oe,ZodOptional:Ve,ZodNullable:Mt,ZodDefault:Mn,ZodCatch:yi,ZodNaN:vi,BRAND:Lo,ZodBranded:Hr,ZodPipeline:Nn,ZodReadonly:bi,custom:Ur,Schema:L,ZodSchema:L,late:Zo,get ZodFirstPartyTypeKind(){return I},coerce:{string:i=>Ce.create({...i,coerce:!0}),number:i=>it.create({...i,coerce:!0}),boolean:i=>kn.create({...i,coerce:!0}),bigint:i=>st.create({...i,coerce:!0}),date:i=>Et.create({...i,coerce:!0})},any:qo,array:Go,bigint:Bo,boolean:Vr,date:Wo,discriminatedUnion:nl,effect:Fr,enum:hl,function:ll,instanceof:Ho,intersection:il,lazy:cl,literal:dl,map:al,nan:Uo,nativeEnum:ul,never:Qo,null:Ko,nullable:ml,number:Wr,object:Xo,oboolean:()=>Vr().optional(),onumber:()=>Wr().optional(),optional:fl,ostring:()=>Br().optional(),pipeline:yl,preprocess:gl,promise:pl,record:rl,set:ol,strictObject:el,string:Br,symbol:Vo,transformer:Fr,tuple:sl,undefined:Fo,union:tl,unknown:Jo,void:Yo,NEVER:P,ZodIssueCode:m,quotelessJson:Ao,ZodError:Se});const wi=_.object({assistantId:_.string(),params:_.record(_.any()).default({}),config:_.object({historyKey:_.string().refine(i=>i.replace(/-/g,"_")).nullable().default("main"),welcomeMessage:_.string().default("Hello! How can I help you today?"),inactivityWarningMessage:_.string().default("Are you still there? The chat will end soon if we don't hear from you."),chatEndedMessage:_.string().default("The chat has ended. Please restart the chat to continue."),resetEndedChatOnLoad:_.boolean().default(!1),initialReplyMessage:_.string().nullable().default(null),disclaimerMessage:_.string().nullable().default(null),disclaimerPopover:_.object({message:_.string().nullable().default(null),agreeButtonText:_.string().default("I Agree"),rememberDurationMinutes:_.number().default(60*24*3)}).default({}),simulateDelays:_.boolean().default(!0),placement:_.enum(["left","right"]).default("right"),openChatButton:_.object({imageSrc:_.string().nullable().default(null),width:_.union([_.string(),_.number()]).default("48px"),height:_.union([_.string(),_.number()]).default("48px"),cta:_.string().nullable().default(null)}).default({}),chatWindow:_.object({header:_.object({text:_.string().nullable().default("AI Chat"),imageSrc:_.string().nullable().default(null)}).default({}),showCloseButton:_.boolean().default(!0)}).default({}),styles:_.object({primaryColor:_.string().nullable().default(null),textColor:_.string().nullable().default(null),linkColor:_.string().nullable().default(null),openChatButton:_.object({backgroundColor:_.string().nullable().default(null),iconColor:_.string().nullable().default(null)}).default({}),header:_.object({backgroundColor:_.string().nullable().default(null),textColor:_.string().nullable().default(null)}).default({}),button:_.object({backgroundColor:_.string().nullable().default(null),textColor:_.string().nullable().default(null)}).default({}),messages:_.object({user:_.object({backgroundColor:_.string().nullable().default(null),textColor:_.string().nullable().default(null)}).default({}),assistant:_.object({backgroundColor:_.string().nullable().default(null),textColor:_.string().nullable().default(null)}).default({})}).default({})}).default({})}).default({}),handlers:_.object({functionCalls:_.record(_.function().returns(_.union([_.any(),_.promise(_.any())]))).default({}),enhancedContent:_.record(_.function().returns(_.union([_.any(),_.promise(_.any())]))).default({})}).default({})});var vl=Object.defineProperty,bl=Object.getOwnPropertyDescriptor,Rn=(i,e,t,n)=>{for(var s=n>1?void 0:n?bl(e,t):e,r=i.length-1,a;r>=0;r--)(a=i[r])&&(s=(n?a(e,t,s):a(s))||s);return n&&s&&vl(e,t,s),s};let Nt=class extends xe{constructor(){super(...arguments),this.isOpen=!1,this.onResizeHandler=()=>{this.isOpen&&window.innerWidth<768?xo(this):Nr(this)}}connectedCallback(){super.connectedCallback(),this.cleanOptions=wi.parse(this.options),this.onResizeHandler(),window.addEventListener("resize",this.onResizeHandler,{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),Nr(this),window.removeEventListener("resize",this.onResizeHandler)}render(){const i=this.cleanOptions.config.placement!=="left",e=Rr({fixed:!0,"bottom-0":!0,"w-full":this.isOpen,"h-full":this.isOpen,...i&&{"right-0":!0,"md:right-8":!0},...!i&&{"left-0":!0,"md:left-8":!0},"md:bottom-8":!0,"md:w-fit":!0,"md:h-fit":!0}),t=Rr({"mt-4":!0,"px-8":!0,"pb-8":!0,"w-full":!0,hidden:this.isOpen,flex:!this.isOpen,"md:px-0":!0,"md:pb-0":!0,"md:w-[350px]":!0,"md:flex":!0});return U`
|
|
134
|
+
*/const Pr="important",ko=" !"+Pr,Et=Gs(class extends Xs{constructor(s){var e;if(super(s),s.type!==Ys.ATTRIBUTE||s.name!=="style"||((e=s.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((e,t)=>{const n=s[t];return n==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(s,[e]){const{style:t}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const n of this.ft)e[n]==null&&(this.ft.delete(n),n.includes("-")?t.removeProperty(n):t[n]=null);for(const n in e){const i=e[n];if(i!=null){this.ft.add(n);const r=typeof i=="string"&&i.endsWith(ko);n.includes("-")||r?t.setProperty(n,r?i.slice(0,-11):i,r?Pr:""):t[n]=i}}return et}});var $o=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jr(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var ei={};(function(s){function e(o){o&&o.options&&clearTimeout(o.options.timer)}function t(o,l,d,u){var h={timer:void 0,lastArgs:[]},c=function(){for(var f=this,A=[],V=0;V<arguments.length;V++)A[V]=arguments[V];h.lastArgs=A,h.timer?clearTimeout(h.timer):l&&d.apply(this,h.lastArgs),h.timer=setTimeout(function(){l||d.apply(f,h.lastArgs),h.timer=void 0},o)};return u&&(c=c.bind(u)),c.options=h,c}function n(o,l,d,u){var h;Object.defineProperty(d,u,{configurable:!0,enumerable:!1,get:function(){return h},set:function(c){h=t(o,l,c,this)}})}function i(o,l,d){var u=d.value;return d.value=t(o,l,u),d}function r(o,l){for(var d=[],u=2;u<arguments.length;u++)d[u-2]=arguments[u];if(d.length===0)throw new Error("function applied debounce decorator should be a method");if(d.length===1)throw new Error("method applied debounce decorator should have valid name");var h=d[0],c=d[1],f=d.length===3&&d[2]?d[2]:Object.getOwnPropertyDescriptor(h,c);if(f)return i(o,l,f);n(o,l,h,c)}function a(){for(var o=[],l=0;l<arguments.length;l++)o[l]=arguments[l];var d=500,u=!1;if(o.length&&(typeof o[0]=="number"||typeof o[0]=="object"&&o[0].leading!==void 0)){typeof o[0]=="number"&&(d=o[0]);var h=void 0;return typeof o[0]=="object"&&o[0].leading!==void 0&&(h=o[0]),1<o.length&&typeof o[1]=="object"&&o[1].leading!==void 0&&(h=o[1]),h&&(u=h.leading),function(){for(var c=[],f=0;f<arguments.length;f++)c[f]=arguments[f];return r.apply(void 0,[d,u].concat(c))}}return r.apply(void 0,[d,u].concat(o))}Object.defineProperty(s,"__esModule",{value:!0}),s.cancel=e,s.debounce=a})(ei);var B;(function(s){s.assertEqual=i=>i;function e(i){}s.assertIs=e;function t(i){throw new Error}s.assertNever=t,s.arrayToEnum=i=>{const r={};for(const a of i)r[a]=a;return r},s.getValidEnumValues=i=>{const r=s.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),a={};for(const o of r)a[o]=i[o];return s.objectValues(a)},s.objectValues=i=>s.objectKeys(i).map(function(r){return i[r]}),s.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const r=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&r.push(a);return r},s.find=(i,r)=>{for(const a of i)if(r(a))return a},s.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,r=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(r)}s.joinValues=n,s.jsonStringifyReplacer=(i,r)=>typeof r=="bigint"?r.toString():r})(B||(B={}));var ti;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(ti||(ti={}));const y=B.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),nt=s=>{switch(typeof s){case"undefined":return y.undefined;case"string":return y.string;case"number":return isNaN(s)?y.nan:y.number;case"boolean":return y.boolean;case"function":return y.function;case"bigint":return y.bigint;case"symbol":return y.symbol;case"object":return Array.isArray(s)?y.array:s===null?y.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?y.promise:typeof Map<"u"&&s instanceof Map?y.map:typeof Set<"u"&&s instanceof Set?y.set:typeof Date<"u"&&s instanceof Date?y.date:y.object;default:return y.unknown}},g=B.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"]),Ao=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:");class Se extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(r){return r.message},n={_errors:[]},i=r=>{for(const a of r.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(t(a));else{let o=n,l=0;for(;l<a.path.length;){const d=a.path[l];l===a.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(a))):o[d]=o[d]||{_errors:[]},o=o[d],l++}}};return i(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,B.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Se.create=s=>new Se(s);const _n=(s,e)=>{let t;switch(s.code){case g.invalid_type:s.received===y.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case g.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,B.jsonStringifyReplacer)}`;break;case g.unrecognized_keys:t=`Unrecognized key(s) in object: ${B.joinValues(s.keys,", ")}`;break;case g.invalid_union:t="Invalid input";break;case g.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${B.joinValues(s.options)}`;break;case g.invalid_enum_value:t=`Invalid enum value. Expected ${B.joinValues(s.options)}, received '${s.received}'`;break;case g.invalid_arguments:t="Invalid function arguments";break;case g.invalid_return_type:t="Invalid function return type";break;case g.invalid_date:t="Invalid date";break;case g.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:B.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case g.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case g.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case g.custom:t="Invalid input";break;case g.invalid_intersection_types:t="Intersection results could not be merged";break;case g.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case g.not_finite:t="Number must be finite";break;default:t=e.defaultError,B.assertNever(s)}return{message:t}};let zr=_n;function To(s){zr=s}function cs(){return zr}const ds=s=>{const{data:e,path:t,errorMaps:n,issueData:i}=s,r=[...t,...i.path||[]],a={...i,path:r};let o="";const l=n.filter(d=>!!d).slice().reverse();for(const d of l)o=d(a,{data:e,defaultError:o}).message;return{...i,path:r,message:i.message||o}},So=[];function b(s,e){const t=ds({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,cs(),_n].filter(n=>!!n)});s.common.issues.push(t)}class ge{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const i of t){if(i.status==="aborted")return P;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const i of t)n.push({key:await i.key,value:await i.value});return ge.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const i of t){const{key:r,value:a}=i;if(r.status==="aborted"||a.status==="aborted")return P;r.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(n[r.value]=a.value)}return{status:e.value,value:n}}}const P=Object.freeze({status:"aborted"}),Dr=s=>({status:"dirty",value:s}),ve=s=>({status:"valid",value:s}),ni=s=>s.status==="aborted",si=s=>s.status==="dirty",xn=s=>s.status==="valid",hs=s=>typeof Promise<"u"&&s instanceof Promise;var T;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(T||(T={}));class Ne{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Lr=(s,e)=>{if(xn(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Se(s.common.issues);return this._error=t,this._error}}};function j(s){if(!s)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:i}=s;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(r,a)=>r.code!=="invalid_type"?{message:a.defaultError}:typeof a.data>"u"?{message:n??a.defaultError}:{message:t??a.defaultError},description:i}}class L{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)}get description(){return this._def.description}_getType(e){return nt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ge,ctx:{common:e.parent.common,data:e.data,parsedType:nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(hs(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const i={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nt(e)},r=this._parseSync({data:e,path:i.path,parent:i});return Lr(i,r)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nt(e)},i=this._parse({data:e,path:n.path,parent:n}),r=await(hs(i)?i:Promise.resolve(i));return Lr(n,r)}refine(e,t){const n=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,r)=>{const a=e(i),o=()=>r.addIssue({code:g.custom,...n(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new Oe({schema:this,typeName:I.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Ve.create(this,this._def)}nullable(){return Mt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ce.create(this,this._def)}promise(){return Gt.create(this,this._def)}or(e){return Tn.create([this,e],this._def)}and(e){return Sn.create(this,e,this._def)}transform(e){return new Oe({...j(this._def),schema:this,typeName:I.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Mn({...j(this._def),innerType:this,defaultValue:t,typeName:I.ZodDefault})}brand(){return new Hr({typeName:I.ZodBranded,type:this,...j(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ys({...j(this._def),innerType:this,catchValue:t,typeName:I.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Nn.create(this,e)}readonly(){return bs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Eo=/^c[^\s-]{8,}$/i,Co=/^[a-z][a-z0-9]*$/,Oo=/^[0-9A-HJKMNP-TV-Z]{26}$/,Io=/^[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,Mo=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,No="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ii;const Ro=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Po=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,jo=s=>s.precision?s.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${s.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${s.precision}}Z$`):s.precision===0?s.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):s.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function zo(s,e){return!!((e==="v4"||!e)&&Ro.test(s)||(e==="v6"||!e)&&Po.test(s))}class Ee extends L{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==y.string){const i=this._getOrReturnCtx(e);return b(i,{code:g.invalid_type,expected:y.string,received:i.parsedType}),P}const t=new ge;let n;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:g.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if(i.kind==="max")e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:g.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if(i.kind==="length"){const r=e.data.length>i.value,a=e.data.length<i.value;(r||a)&&(n=this._getOrReturnCtx(e,n),r?b(n,{code:g.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&b(n,{code:g.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if(i.kind==="email")Mo.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"email",code:g.invalid_string,message:i.message}),t.dirty());else if(i.kind==="emoji")ii||(ii=new RegExp(No,"u")),ii.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"emoji",code:g.invalid_string,message:i.message}),t.dirty());else if(i.kind==="uuid")Io.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"uuid",code:g.invalid_string,message:i.message}),t.dirty());else if(i.kind==="cuid")Eo.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"cuid",code:g.invalid_string,message:i.message}),t.dirty());else if(i.kind==="cuid2")Co.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"cuid2",code:g.invalid_string,message:i.message}),t.dirty());else if(i.kind==="ulid")Oo.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"ulid",code:g.invalid_string,message:i.message}),t.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),b(n,{validation:"url",code:g.invalid_string,message:i.message}),t.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"regex",code:g.invalid_string,message:i.message}),t.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),b(n,{code:g.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),t.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),b(n,{code:g.invalid_string,validation:{startsWith:i.value},message:i.message}),t.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),b(n,{code:g.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty()):i.kind==="datetime"?jo(i).test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{code:g.invalid_string,validation:"datetime",message:i.message}),t.dirty()):i.kind==="ip"?zo(e.data,i.version)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"ip",code:g.invalid_string,message:i.message}),t.dirty()):B.assertNever(i);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:g.invalid_string,...T.errToObj(n)})}_addCheck(e){return new Ee({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...T.errToObj(e)})}url(e){return this._addCheck({kind:"url",...T.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...T.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...T.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...T.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...T.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...T.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...T.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,...T.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...T.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...T.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...T.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...T.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...T.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...T.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...T.errToObj(t)})}nonempty(e){return this.min(1,T.errToObj(e))}trim(){return new Ee({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ee({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ee({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Ee.create=s=>{var e;return new Ee({checks:[],typeName:I.ZodString,coerce:(e=s==null?void 0:s.coerce)!==null&&e!==void 0?e:!1,...j(s)})};function Do(s,e){const t=(s.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,r=parseInt(s.toFixed(i).replace(".","")),a=parseInt(e.toFixed(i).replace(".",""));return r%a/Math.pow(10,i)}class st extends L{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)!==y.number){const i=this._getOrReturnCtx(e);return b(i,{code:g.invalid_type,expected:y.number,received:i.parsedType}),P}let t;const n=new ge;for(const i of this._def.checks)i.kind==="int"?B.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),b(t,{code:g.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:g.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:g.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?Do(e.data,i.value)!==0&&(t=this._getOrReturnCtx(e,t),b(t,{code:g.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),b(t,{code:g.not_finite,message:i.message}),n.dirty()):B.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,T.toString(t))}gt(e,t){return this.setLimit("min",e,!1,T.toString(t))}lte(e,t){return this.setLimit("max",e,!0,T.toString(t))}lt(e,t){return this.setLimit("max",e,!1,T.toString(t))}setLimit(e,t,n,i){return new st({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:T.toString(i)}]})}_addCheck(e){return new st({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:T.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:T.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const 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"&&B.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;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)}}st.create=s=>new st({checks:[],typeName:I.ZodNumber,coerce:(s==null?void 0:s.coerce)||!1,...j(s)});class it extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==y.bigint){const i=this._getOrReturnCtx(e);return b(i,{code:g.invalid_type,expected:y.bigint,received:i.parsedType}),P}let t;const n=new ge;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:g.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:g.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),b(t,{code:g.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):B.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,T.toString(t))}gt(e,t){return this.setLimit("min",e,!1,T.toString(t))}lte(e,t){return this.setLimit("max",e,!0,T.toString(t))}lt(e,t){return this.setLimit("max",e,!1,T.toString(t))}setLimit(e,t,n,i){return new it({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:T.toString(i)}]})}_addCheck(e){return new it({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}it.create=s=>{var e;return new it({checks:[],typeName:I.ZodBigInt,coerce:(e=s==null?void 0:s.coerce)!==null&&e!==void 0?e:!1,...j(s)})};class kn extends L{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==y.boolean){const t=this._getOrReturnCtx(e);return b(t,{code:g.invalid_type,expected:y.boolean,received:t.parsedType}),P}return ve(e.data)}}kn.create=s=>new kn({typeName:I.ZodBoolean,coerce:(s==null?void 0:s.coerce)||!1,...j(s)});class Ct extends L{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==y.date){const i=this._getOrReturnCtx(e);return b(i,{code:g.invalid_type,expected:y.date,received:i.parsedType}),P}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return b(i,{code:g.invalid_date}),P}const t=new ge;let n;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:g.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),t.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:g.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),t.dirty()):B.assertNever(i);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ct({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:T.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:T.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}Ct.create=s=>new Ct({checks:[],coerce:(s==null?void 0:s.coerce)||!1,typeName:I.ZodDate,...j(s)});class us extends L{_parse(e){if(this._getType(e)!==y.symbol){const t=this._getOrReturnCtx(e);return b(t,{code:g.invalid_type,expected:y.symbol,received:t.parsedType}),P}return ve(e.data)}}us.create=s=>new us({typeName:I.ZodSymbol,...j(s)});class $n extends L{_parse(e){if(this._getType(e)!==y.undefined){const t=this._getOrReturnCtx(e);return b(t,{code:g.invalid_type,expected:y.undefined,received:t.parsedType}),P}return ve(e.data)}}$n.create=s=>new $n({typeName:I.ZodUndefined,...j(s)});class An extends L{_parse(e){if(this._getType(e)!==y.null){const t=this._getOrReturnCtx(e);return b(t,{code:g.invalid_type,expected:y.null,received:t.parsedType}),P}return ve(e.data)}}An.create=s=>new An({typeName:I.ZodNull,...j(s)});class Jt extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return ve(e.data)}}Jt.create=s=>new Jt({typeName:I.ZodAny,...j(s)});class Ot extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ve(e.data)}}Ot.create=s=>new Ot({typeName:I.ZodUnknown,...j(s)});class We extends L{_parse(e){const t=this._getOrReturnCtx(e);return b(t,{code:g.invalid_type,expected:y.never,received:t.parsedType}),P}}We.create=s=>new We({typeName:I.ZodNever,...j(s)});class ps extends L{_parse(e){if(this._getType(e)!==y.undefined){const t=this._getOrReturnCtx(e);return b(t,{code:g.invalid_type,expected:y.void,received:t.parsedType}),P}return ve(e.data)}}ps.create=s=>new ps({typeName:I.ZodVoid,...j(s)});class Ce extends L{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==y.array)return b(t,{code:g.invalid_type,expected:y.array,received:t.parsedType}),P;if(i.exactLength!==null){const a=t.data.length>i.exactLength.value,o=t.data.length<i.exactLength.value;(a||o)&&(b(t,{code:a?g.too_big:g.too_small,minimum:o?i.exactLength.value:void 0,maximum:a?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&&(b(t,{code:g.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&&(b(t,{code:g.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((a,o)=>i.type._parseAsync(new Ne(t,a,t.path,o)))).then(a=>ge.mergeArray(n,a));const r=[...t.data].map((a,o)=>i.type._parseSync(new Ne(t,a,t.path,o)));return ge.mergeArray(n,r)}get element(){return this._def.type}min(e,t){return new Ce({...this._def,minLength:{value:e,message:T.toString(t)}})}max(e,t){return new Ce({...this._def,maxLength:{value:e,message:T.toString(t)}})}length(e,t){return new Ce({...this._def,exactLength:{value:e,message:T.toString(t)}})}nonempty(e){return this.min(1,e)}}Ce.create=(s,e)=>new Ce({type:s,minLength:null,maxLength:null,exactLength:null,typeName:I.ZodArray,...j(e)});function Qt(s){if(s instanceof ee){const e={};for(const t in s.shape){const n=s.shape[t];e[t]=Ve.create(Qt(n))}return new ee({...s._def,shape:()=>e})}else return s instanceof Ce?new Ce({...s._def,type:Qt(s.element)}):s instanceof Ve?Ve.create(Qt(s.unwrap())):s instanceof Mt?Mt.create(Qt(s.unwrap())):s instanceof Re?Re.create(s.items.map(e=>Qt(e))):s}class ee extends L{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=B.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==y.object){const l=this._getOrReturnCtx(e);return b(l,{code:g.invalid_type,expected:y.object,received:l.parsedType}),P}const{status:t,ctx:n}=this._processInputParams(e),{shape:i,keys:r}=this._getCached(),a=[];if(!(this._def.catchall instanceof We&&this._def.unknownKeys==="strip"))for(const l in n.data)r.includes(l)||a.push(l);const o=[];for(const l of r){const d=i[l],u=n.data[l];o.push({key:{status:"valid",value:l},value:d._parse(new Ne(n,u,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof We){const l=this._def.unknownKeys;if(l==="passthrough")for(const d of a)o.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(l==="strict")a.length>0&&(b(n,{code:g.unrecognized_keys,keys:a}),t.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const d of a){const u=n.data[d];o.push({key:{status:"valid",value:d},value:l._parse(new Ne(n,u,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const l=[];for(const d of o){const u=await d.key;l.push({key:u,value:await d.value,alwaysSet:d.alwaysSet})}return l}).then(l=>ge.mergeObjectSync(t,l)):ge.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return T.errToObj,new ee({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var i,r,a,o;const l=(a=(r=(i=this._def).errorMap)===null||r===void 0?void 0:r.call(i,t,n).message)!==null&&a!==void 0?a:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=T.errToObj(e).message)!==null&&o!==void 0?o:l}:{message:l}}}:{}})}strip(){return new ee({...this._def,unknownKeys:"strip"})}passthrough(){return new ee({...this._def,unknownKeys:"passthrough"})}extend(e){return new ee({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ee({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:I.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ee({...this._def,catchall:e})}pick(e){const t={};return B.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new ee({...this._def,shape:()=>t})}omit(e){const t={};return B.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new ee({...this._def,shape:()=>t})}deepPartial(){return Qt(this)}partial(e){const t={};return B.objectKeys(this.shape).forEach(n=>{const i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}),new ee({...this._def,shape:()=>t})}required(e){const t={};return B.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Ve;)i=i._def.innerType;t[n]=i}}),new ee({...this._def,shape:()=>t})}keyof(){return Zr(B.objectKeys(this.shape))}}ee.create=(s,e)=>new ee({shape:()=>s,unknownKeys:"strip",catchall:We.create(),typeName:I.ZodObject,...j(e)}),ee.strictCreate=(s,e)=>new ee({shape:()=>s,unknownKeys:"strict",catchall:We.create(),typeName:I.ZodObject,...j(e)}),ee.lazycreate=(s,e)=>new ee({shape:s,unknownKeys:"strip",catchall:We.create(),typeName:I.ZodObject,...j(e)});class Tn extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function i(r){for(const o of r)if(o.result.status==="valid")return o.result;for(const o of r)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const a=r.map(o=>new Se(o.ctx.common.issues));return b(t,{code:g.invalid_union,unionErrors:a}),P}if(t.common.async)return Promise.all(n.map(async r=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await r._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(i);{let r;const a=[];for(const l of n){const d={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!r&&(r={result:u,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;const o=a.map(l=>new Se(l));return b(t,{code:g.invalid_union,unionErrors:o}),P}}get options(){return this._def.options}}Tn.create=(s,e)=>new Tn({options:s,typeName:I.ZodUnion,...j(e)});const fs=s=>s instanceof Cn?fs(s.schema):s instanceof Oe?fs(s.innerType()):s instanceof On?[s.value]:s instanceof rt?s.options:s instanceof In?Object.keys(s.enum):s instanceof Mn?fs(s._def.innerType):s instanceof $n?[void 0]:s instanceof An?[null]:null;class gs extends L{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==y.object)return b(t,{code:g.invalid_type,expected:y.object,received:t.parsedType}),P;const n=this.discriminator,i=t.data[n],r=this.optionsMap.get(i);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(b(t,{code:g.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(e,t,n){const i=new Map;for(const r of t){const a=fs(r.shape[e]);if(!a)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,r)}}return new gs({typeName:I.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...j(n)})}}function ri(s,e){const t=nt(s),n=nt(e);if(s===e)return{valid:!0,data:s};if(t===y.object&&n===y.object){const i=B.objectKeys(e),r=B.objectKeys(s).filter(o=>i.indexOf(o)!==-1),a={...s,...e};for(const o of r){const l=ri(s[o],e[o]);if(!l.valid)return{valid:!1};a[o]=l.data}return{valid:!0,data:a}}else if(t===y.array&&n===y.array){if(s.length!==e.length)return{valid:!1};const i=[];for(let r=0;r<s.length;r++){const a=s[r],o=e[r],l=ri(a,o);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===y.date&&n===y.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}class Sn extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=(r,a)=>{if(ni(r)||ni(a))return P;const o=ri(r.value,a.value);return o.valid?((si(r)||si(a))&&t.dirty(),{status:t.value,value:o.data}):(b(n,{code:g.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(([r,a])=>i(r,a)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Sn.create=(s,e,t)=>new Sn({left:s,right:e,typeName:I.ZodIntersection,...j(t)});class Re extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.array)return b(n,{code:g.invalid_type,expected:y.array,received:n.parsedType}),P;if(n.data.length<this._def.items.length)return b(n,{code:g.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),P;!this._def.rest&&n.data.length>this._def.items.length&&(b(n,{code:g.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...n.data].map((r,a)=>{const o=this._def.items[a]||this._def.rest;return o?o._parse(new Ne(n,r,n.path,a)):null}).filter(r=>!!r);return n.common.async?Promise.all(i).then(r=>ge.mergeArray(t,r)):ge.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new Re({...this._def,rest:e})}}Re.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Re({items:s,typeName:I.ZodTuple,rest:null,...j(e)})};class En extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.object)return b(n,{code:g.invalid_type,expected:y.object,received:n.parsedType}),P;const i=[],r=this._def.keyType,a=this._def.valueType;for(const o in n.data)i.push({key:r._parse(new Ne(n,o,n.path,o)),value:a._parse(new Ne(n,n.data[o],n.path,o))});return n.common.async?ge.mergeObjectAsync(t,i):ge.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof L?new En({keyType:e,valueType:t,typeName:I.ZodRecord,...j(n)}):new En({keyType:Ee.create(),valueType:e,typeName:I.ZodRecord,...j(t)})}}class ms extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.map)return b(n,{code:g.invalid_type,expected:y.map,received:n.parsedType}),P;const i=this._def.keyType,r=this._def.valueType,a=[...n.data.entries()].map(([o,l],d)=>({key:i._parse(new Ne(n,o,n.path,[d,"key"])),value:r._parse(new Ne(n,l,n.path,[d,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of a){const d=await l.key,u=await l.value;if(d.status==="aborted"||u.status==="aborted")return P;(d.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(d.value,u.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of a){const d=l.key,u=l.value;if(d.status==="aborted"||u.status==="aborted")return P;(d.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(d.value,u.value)}return{status:t.value,value:o}}}}ms.create=(s,e,t)=>new ms({valueType:e,keyType:s,typeName:I.ZodMap,...j(t)});class It extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.set)return b(n,{code:g.invalid_type,expected:y.set,received:n.parsedType}),P;const i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(b(n,{code:g.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&&(b(n,{code:g.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const r=this._def.valueType;function a(l){const d=new Set;for(const u of l){if(u.status==="aborted")return P;u.status==="dirty"&&t.dirty(),d.add(u.value)}return{status:t.value,value:d}}const o=[...n.data.values()].map((l,d)=>r._parse(new Ne(n,l,n.path,d)));return n.common.async?Promise.all(o).then(l=>a(l)):a(o)}min(e,t){return new It({...this._def,minSize:{value:e,message:T.toString(t)}})}max(e,t){return new It({...this._def,maxSize:{value:e,message:T.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}It.create=(s,e)=>new It({valueType:s,minSize:null,maxSize:null,typeName:I.ZodSet,...j(e)});class Yt extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==y.function)return b(t,{code:g.invalid_type,expected:y.function,received:t.parsedType}),P;function n(o,l){return ds({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,cs(),_n].filter(d=>!!d),issueData:{code:g.invalid_arguments,argumentsError:l}})}function i(o,l){return ds({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,cs(),_n].filter(d=>!!d),issueData:{code:g.invalid_return_type,returnTypeError:l}})}const r={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Gt){const o=this;return ve(async function(...l){const d=new Se([]),u=await o._def.args.parseAsync(l,r).catch(c=>{throw d.addIssue(n(l,c)),d}),h=await Reflect.apply(a,this,u);return await o._def.returns._def.type.parseAsync(h,r).catch(c=>{throw d.addIssue(i(h,c)),d})})}else{const o=this;return ve(function(...l){const d=o._def.args.safeParse(l,r);if(!d.success)throw new Se([n(l,d.error)]);const u=Reflect.apply(a,this,d.data),h=o._def.returns.safeParse(u,r);if(!h.success)throw new Se([i(u,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Yt({...this._def,args:Re.create(e).rest(Ot.create())})}returns(e){return new Yt({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Yt({args:e||Re.create([]).rest(Ot.create()),returns:t||Ot.create(),typeName:I.ZodFunction,...j(n)})}}class Cn extends L{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Cn.create=(s,e)=>new Cn({getter:s,typeName:I.ZodLazy,...j(e)});class On extends L{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return b(t,{received:t.data,code:g.invalid_literal,expected:this._def.value}),P}return{status:"valid",value:e.data}}get value(){return this._def.value}}On.create=(s,e)=>new On({value:s,typeName:I.ZodLiteral,...j(e)});function Zr(s,e){return new rt({values:s,typeName:I.ZodEnum,...j(e)})}class rt extends L{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return b(t,{expected:B.joinValues(n),received:t.parsedType,code:g.invalid_type}),P}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),n=this._def.values;return b(t,{received:t.data,code:g.invalid_enum_value,options:n}),P}return ve(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return rt.create(e)}exclude(e){return rt.create(this.options.filter(t=>!e.includes(t)))}}rt.create=Zr;class In extends L{_parse(e){const t=B.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==y.string&&n.parsedType!==y.number){const i=B.objectValues(t);return b(n,{expected:B.joinValues(i),received:n.parsedType,code:g.invalid_type}),P}if(t.indexOf(e.data)===-1){const i=B.objectValues(t);return b(n,{received:n.data,code:g.invalid_enum_value,options:i}),P}return ve(e.data)}get enum(){return this._def.values}}In.create=(s,e)=>new In({values:s,typeName:I.ZodNativeEnum,...j(e)});class Gt extends L{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==y.promise&&t.common.async===!1)return b(t,{code:g.invalid_type,expected:y.promise,received:t.parsedType}),P;const n=t.parsedType===y.promise?t.data:Promise.resolve(t.data);return ve(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Gt.create=(s,e)=>new Gt({type:s,typeName:I.ZodPromise,...j(e)});class Oe extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===I.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,r={addIssue:a=>{b(n,a),a.fatal?t.abort():t.dirty()},get path(){return n.path}};if(r.addIssue=r.addIssue.bind(r),i.type==="preprocess"){const a=i.transform(n.data,r);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(a).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:a,path:n.path,parent:n})}if(i.type==="refinement"){const a=o=>{const l=i.refinement(o,r);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?P:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?P:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(i.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!xn(a))return a;const o=i.transform(a.value,r);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>xn(a)?Promise.resolve(i.transform(a.value,r)).then(o=>({status:t.value,value:o})):a);B.assertNever(i)}}Oe.create=(s,e,t)=>new Oe({schema:s,typeName:I.ZodEffects,effect:e,...j(t)}),Oe.createWithPreprocess=(s,e,t)=>new Oe({schema:e,effect:{type:"preprocess",transform:s},typeName:I.ZodEffects,...j(t)});class Ve extends L{_parse(e){return this._getType(e)===y.undefined?ve(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ve.create=(s,e)=>new Ve({innerType:s,typeName:I.ZodOptional,...j(e)});class Mt extends L{_parse(e){return this._getType(e)===y.null?ve(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Mt.create=(s,e)=>new Mt({innerType:s,typeName:I.ZodNullable,...j(e)});class Mn extends L{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===y.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Mn.create=(s,e)=>new Mn({innerType:s,typeName:I.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...j(e)});class ys extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return hs(i)?i.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Se(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Se(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ys.create=(s,e)=>new ys({innerType:s,typeName:I.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...j(e)});class vs extends L{_parse(e){if(this._getType(e)!==y.nan){const t=this._getOrReturnCtx(e);return b(t,{code:g.invalid_type,expected:y.nan,received:t.parsedType}),P}return{status:"valid",value:e.data}}}vs.create=s=>new vs({typeName:I.ZodNaN,...j(s)});const Lo=Symbol("zod_brand");class Hr extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Nn extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?P:i.status==="dirty"?(t.dirty(),Dr(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?P:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,t){return new Nn({in:e,out:t,typeName:I.ZodPipeline})}}class bs extends L{_parse(e){const t=this._def.innerType._parse(e);return xn(t)&&(t.value=Object.freeze(t.value)),t}}bs.create=(s,e)=>new bs({innerType:s,typeName:I.ZodReadonly,...j(e)});const Ur=(s,e={},t)=>s?Jt.create().superRefine((n,i)=>{var r,a;if(!s(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,l=(a=(r=o.fatal)!==null&&r!==void 0?r:t)!==null&&a!==void 0?a:!0,d=typeof o=="string"?{message:o}:o;i.addIssue({code:"custom",...d,fatal:l})}}):Jt.create(),Zo={object:ee.lazycreate};var I;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(I||(I={}));const Ho=(s,e={message:`Input not instance of ${s.name}`})=>Ur(t=>t instanceof s,e),Br=Ee.create,Wr=st.create,Uo=vs.create,Bo=it.create,Vr=kn.create,Wo=Ct.create,Vo=us.create,Fo=$n.create,Ko=An.create,qo=Jt.create,Jo=Ot.create,Qo=We.create,Yo=ps.create,Go=Ce.create,Xo=ee.create,el=ee.strictCreate,tl=Tn.create,nl=gs.create,sl=Sn.create,il=Re.create,rl=En.create,al=ms.create,ol=It.create,ll=Yt.create,cl=Cn.create,dl=On.create,hl=rt.create,ul=In.create,pl=Gt.create,Fr=Oe.create,fl=Ve.create,gl=Mt.create,ml=Oe.createWithPreprocess,yl=Nn.create;var _=Object.freeze({__proto__:null,defaultErrorMap:_n,setErrorMap:To,getErrorMap:cs,makeIssue:ds,EMPTY_PATH:So,addIssueToContext:b,ParseStatus:ge,INVALID:P,DIRTY:Dr,OK:ve,isAborted:ni,isDirty:si,isValid:xn,isAsync:hs,get util(){return B},get objectUtil(){return ti},ZodParsedType:y,getParsedType:nt,ZodType:L,ZodString:Ee,ZodNumber:st,ZodBigInt:it,ZodBoolean:kn,ZodDate:Ct,ZodSymbol:us,ZodUndefined:$n,ZodNull:An,ZodAny:Jt,ZodUnknown:Ot,ZodNever:We,ZodVoid:ps,ZodArray:Ce,ZodObject:ee,ZodUnion:Tn,ZodDiscriminatedUnion:gs,ZodIntersection:Sn,ZodTuple:Re,ZodRecord:En,ZodMap:ms,ZodSet:It,ZodFunction:Yt,ZodLazy:Cn,ZodLiteral:On,ZodEnum:rt,ZodNativeEnum:In,ZodPromise:Gt,ZodEffects:Oe,ZodTransformer:Oe,ZodOptional:Ve,ZodNullable:Mt,ZodDefault:Mn,ZodCatch:ys,ZodNaN:vs,BRAND:Lo,ZodBranded:Hr,ZodPipeline:Nn,ZodReadonly:bs,custom:Ur,Schema:L,ZodSchema:L,late:Zo,get ZodFirstPartyTypeKind(){return I},coerce:{string:s=>Ee.create({...s,coerce:!0}),number:s=>st.create({...s,coerce:!0}),boolean:s=>kn.create({...s,coerce:!0}),bigint:s=>it.create({...s,coerce:!0}),date:s=>Ct.create({...s,coerce:!0})},any:qo,array:Go,bigint:Bo,boolean:Vr,date:Wo,discriminatedUnion:nl,effect:Fr,enum:hl,function:ll,instanceof:Ho,intersection:sl,lazy:cl,literal:dl,map:al,nan:Uo,nativeEnum:ul,never:Qo,null:Ko,nullable:gl,number:Wr,object:Xo,oboolean:()=>Vr().optional(),onumber:()=>Wr().optional(),optional:fl,ostring:()=>Br().optional(),pipeline:yl,preprocess:ml,promise:pl,record:rl,set:ol,strictObject:el,string:Br,symbol:Vo,transformer:Fr,tuple:il,undefined:Fo,union:tl,unknown:Jo,void:Yo,NEVER:P,ZodIssueCode:g,quotelessJson:Ao,ZodError:Se});const ws=_.object({assistantId:_.string(),params:_.record(_.any()).default({}),config:_.object({historyKey:_.string().refine(s=>s.replace(/-/g,"_")).nullable().default("main"),welcomeMessage:_.string().default("Hello! How can I help you today?"),inactivityWarningMessage:_.string().default("Are you still there? The chat will end soon if we don't hear from you."),chatEndedMessage:_.string().default("The chat has ended. Please restart the chat to continue."),resetEndedChatOnLoad:_.boolean().default(!1),initialReplyMessage:_.string().nullable().default(null),disclaimerMessage:_.string().nullable().default(null),disclaimerPopover:_.object({message:_.string().nullable().default(null),agreeButtonText:_.string().default("I Agree"),rememberDurationMinutes:_.number().default(60*24*3)}).default({}),simulateDelays:_.boolean().default(!0),placement:_.enum(["left","right"]).default("right"),openChatButton:_.object({imageSrc:_.string().nullable().default(null),width:_.union([_.string(),_.number()]).default("48px"),height:_.union([_.string(),_.number()]).default("48px"),cta:_.string().nullable().default(null)}).default({}),chatWindow:_.object({header:_.object({text:_.string().nullable().default("AI Chat"),imageSrc:_.string().nullable().default(null)}).default({}),showCloseButton:_.boolean().default(!0)}).default({}),styles:_.object({primaryColor:_.string().nullable().default(null),textColor:_.string().nullable().default(null),linkColor:_.string().nullable().default(null),openChatButton:_.object({backgroundColor:_.string().nullable().default(null),iconColor:_.string().nullable().default(null)}).default({}),header:_.object({backgroundColor:_.string().nullable().default(null),textColor:_.string().nullable().default(null)}).default({}),button:_.object({backgroundColor:_.string().nullable().default(null),textColor:_.string().nullable().default(null)}).default({}),messages:_.object({user:_.object({backgroundColor:_.string().nullable().default(null),textColor:_.string().nullable().default(null)}).default({}),assistant:_.object({backgroundColor:_.string().nullable().default(null),textColor:_.string().nullable().default(null)}).default({})}).default({})}).default({})}).default({}),handlers:_.object({functionCalls:_.record(_.function().returns(_.union([_.any(),_.promise(_.any())]))).default({}),enhancedContent:_.record(_.function().returns(_.union([_.any(),_.promise(_.any())]))).default({})}).default({})});var vl=Object.defineProperty,bl=Object.getOwnPropertyDescriptor,Rn=(s,e,t,n)=>{for(var i=n>1?void 0:n?bl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&vl(e,t,i),i};let Nt=class extends xe{constructor(){super(...arguments),this.isOpen=!1,this.onResizeHandler=()=>{this.isOpen&&window.innerWidth<768?xo(this):Nr(this)}}connectedCallback(){super.connectedCallback(),this.cleanOptions=ws.parse(this.options),this.onResizeHandler(),window.addEventListener("resize",this.onResizeHandler,{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),Nr(this),window.removeEventListener("resize",this.onResizeHandler)}render(){const s=this.cleanOptions.config.placement!=="left",e=Rr({fixed:!0,"bottom-0":!0,"w-full":this.isOpen,"h-full":this.isOpen,...s&&{"right-0":!0,"md:right-8":!0},...!s&&{"left-0":!0,"md:left-8":!0},"md:bottom-8":!0,"md:w-fit":!0,"md:h-fit":!0}),t=Rr({"mt-4":!0,"px-8":!0,"pb-8":!0,"w-full":!0,hidden:this.isOpen,flex:!this.isOpen,"md:px-0":!0,"md:pb-0":!0,"md:w-[350px]":!0,"md:flex":!0});return U`
|
|
135
135
|
<div
|
|
136
136
|
class=${e}
|
|
137
|
-
style=${
|
|
137
|
+
style=${Et({zIndex:"9999",colorScheme:"normal"})}
|
|
138
138
|
>
|
|
139
139
|
<div
|
|
140
140
|
class="w-full h-full p-2 md:w-[350px] md:h-[500px] md:p-0"
|
|
141
|
-
style=${
|
|
141
|
+
style=${Et({visibility:this.isOpen?"visible":"hidden"})}
|
|
142
142
|
>
|
|
143
143
|
<iai-chat
|
|
144
144
|
.options=${this.options}
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
|
|
149
149
|
<div
|
|
150
150
|
class=${t}
|
|
151
|
-
style=${
|
|
151
|
+
style=${Et({justifyContent:s?"flex-end":"flex-start"})}
|
|
152
152
|
>
|
|
153
153
|
<iai-chat-open-chat-button
|
|
154
154
|
.options=${this.cleanOptions}
|
|
@@ -157,11 +157,11 @@
|
|
|
157
157
|
/>
|
|
158
158
|
</div>
|
|
159
159
|
</div>
|
|
160
|
-
`}toggleChat(){this.isOpen=!this.isOpen,this.onResizeHandler()}};Nt.styles=[Be],Rn([ne({type:Object})],Nt.prototype,"options",2),Rn([wt()],Nt.prototype,"isOpen",2),Rn([ni("iai-chat")],Nt.prototype,"chatWindow",2),Rn([es.debounce(250)],Nt.prototype,"onResizeHandler",2),Nt=Rn([He("iai-chat-popup")],Nt);const _i="https://api-dev.ai.inhabit.work";async function wl(i,e={}){return(await fetch(`${_i}/threads`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assistantId:i,params:e})})).json()}async function _l(i,e="No reason provided"){await fetch(`${_i}/threads/${i}/end`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:e})})}async function xl(i,e){return(await fetch(`${_i}/threads/${i}/messages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})})).json()}async function kl(i,e,t,n=!1){return(await fetch(`${_i}/threads/${i}/functions/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({params:t,rerunLLM:n})})).json()}function $l(i){return{all:i=i||new Map,on:function(e,t){var n=i.get(e);n?n.push(t):i.set(e,[t])},off:function(e,t){var n=i.get(e);n&&(t?n.splice(n.indexOf(t)>>>0,1):i.set(e,[]))},emit:function(e,t){var n=i.get(e);n&&n.slice().map(function(s){s(t)}),(n=i.get("*"))&&n.slice().map(function(s){s(e,t)})}}}class Al{constructor(e,t={}){if(this._assistantId="",this._conversationDetails=null,this._messages=[],this.isTyping=!1,this.inputDisabled=!1,this.chatEndingWarningSent=!1,this.chatEnded=!1,this.onStorageEvent=n=>{var s;const[r,a,o]=((s=n.key)==null?void 0:s.split("-"))||[];if(!(r!=="iaiChat"||a!==this.options.historyKey))switch(o){case"messageHistory":this.onMessageHistoryStorageEvent(n);break;case"conversation":this.setConversationDetails(JSON.parse(n.newValue||"null"),!0);break;case"lastActivity":this.keepAlive(JSON.parse(n.newValue||"null"),!0);break;case"chatEndingWarningSent":this.setChatEndingWarningSent(JSON.parse(n.newValue||"false"),!0);break;case"chatEnded":this.setChatEnded(JSON.parse(n.newValue||"false"),!0);break;case"typing":this.setTyping(JSON.parse(n.newValue||"false"),!0);break;case"inputDisabled":this.setInputDisabled(JSON.parse(n.newValue||"false"),!0);break}},this._assistantId=e,this.options={params:{},simulateDelays:!1,resetEndedChatOnLoad:!1,historyKey:"main",...t},this._emitter=$l(),this.on=this._emitter.on.bind(this._emitter),this.off=this._emitter.off.bind(this._emitter),t.events&&Object.entries(t.events).forEach(([n,s])=>{this._emitter.on(n,s)}),t.historyKey){this._messages=this.storageGet("messageHistory",[]);const n=this.storageGet("conversation");n&&this.setConversationDetails(n,!0);const s=this.storageGet("chatEndingWarningSent");s&&this.setChatEndingWarningSent(s,!0);const r=this.storageGet("chatEnded");r&&this.setChatEnded(r,!0);const a=this.storageGet("typing");a&&this.setTyping(a,!0);const o=this.storageGet("inputDisabled");o&&this.setInputDisabled(o,!0);const l=this.storageGet("lastActivity");l&&setTimeout(()=>this.keepAlive(l,!0),0),setTimeout(()=>{this.chatEnded&&this.options.resetEndedChatOnLoad&&this.reset()},0),window.addEventListener("storage",this.onStorageEvent)}}onMessageHistoryStorageEvent(e){if(!e.newValue){this.reset();return}const t=JSON.parse(e.newValue),n=this._messages.map(r=>r.id),s=t.map(r=>r.id);this._messages.forEach(r=>{s.includes(r.id)||this._emitter.emit("messageRemoved",r.id)}),t.forEach(r=>{n.includes(r.id)||this._emitter.emit("message",r)}),this._messages=t}async endChat(e,t=!0){!this.threadId||this.chatEnded||(t&&(this._emitter.emit("chatEnded"),this.setChatEnded(!0)),this.stopInactivityTimers(),await _l(this.threadId,e))}reset(e){this.endChat(e,!1).then(()=>{}),this._messages=[],this.setConversationDetails(null),this.setTyping(!1),this.setInputDisabled(!1),this.setChatEnded(!1),this.stopInactivityTimers(),this.storageRemoveAll(),this._emitter.emit("reset")}destroy(){this._emitter.all.clear(),window.removeEventListener("storage",this.onStorageEvent),this.stopInactivityTimers(),this._emitter.emit("destroy")}stopInactivityTimers(){this._inactivityTimeout&&(clearTimeout(this._inactivityTimeout),this._inactivityTimeout=null),this._inactivityWarningTimeout&&(clearTimeout(this._inactivityWarningTimeout),this._inactivityWarningTimeout=null)}keepAlive(e=Date.now(),t=!1){if(this.stopInactivityTimers(),this.chatEnded||!e)return;const{timeUntilChatEnds:n,timeUntilWarnAboutChatEnding:s}=this;if(!n)return;t||this.storageSet("lastActivity",e);const r=Date.now()-e;r>n?(this.chatEnded||this._emitter.emit("chatEnded"),this.setChatEnded(!0)):r>s?(this.sendChatEndingWarning(),this._inactivityTimeout=setTimeout(()=>{this.chatEnded||this._emitter.emit("chatEnded"),this.setChatEnded(!0)},n-r)):(this.setChatEndingWarningSent(!1),this._inactivityWarningTimeout=setTimeout(()=>this.sendChatEndingWarning(),s-r),this._inactivityTimeout=setTimeout(()=>{this.chatEnded||this._emitter.emit("chatEnded"),this.setChatEnded(!0)},n-r))}async startChat(){if(this.chatStarted)return;const{id:e,inactivityWaitTime:t,inactivityWarningTime:n}=await wl(this.assistantId,this.params);if(!e)throw new Error("Could not start chat");this.setConversationDetails({threadId:e,inactivityWaitTime:t,inactivityWarningTime:n})}addMessage(e){const t={...e,id:e.id||Math.random().toString(36).substring(7)};return this._messages.push(t),this.storageSet("messageHistory",this._messages),this._emitter.emit("message",t),t}removeMessage(e){this._messages=this._messages.filter(t=>t.id!==e),this.storageSet("messageHistory",this._messages),this._emitter.emit("messageRemoved",e)}async respondToFunctionCall(e,t,n){this.simulateDelay(1800).then(()=>this.setTyping(!0));const s=this.simulateDelay(2e3);this.keepAlive(),await this.insertMessagesWithSimulatedDelays(Promise.all([kl(this.threadId,e,t,n),s]).then(([r])=>r))}async sendUserMessage(e){try{this.addMessage({role:"user",content:e}),this.simulateDelay(1800).then(()=>this.setTyping(!0));let t=this.simulateDelay(4800);if(!this.chatStarted){const{initialReplyMessage:r}=this.options;r&&(this.simulateDelay(3800).then(()=>{this.addMessage({role:"assistant",content:r}),this.setTyping(!1)}),this.simulateDelay(6200).then(()=>this.setTyping(!0)),t=this.simulateDelay(8200)),await this.startChat()}this.keepAlive();const{messages:n,functions:s}=await this.insertMessagesWithSimulatedDelays(Promise.all([xl(this.threadId,e),t]).then(([r])=>r));return{messages:n,functions:s}}catch(t){throw console.error("Error sending message:",t),new Error("There was an error sending the message")}}setTyping(e,t=!1){this.isTyping=e,this._emitter.emit("typing",e),t||this.storageSet("typing",e)}setConversationDetails(e,t=!1){this._conversationDetails=e,t||this.storageSet("conversation",e)}setInputDisabled(e,t=!1){this.inputDisabled=e,this._emitter.emit("inputDisabled",e),t||this.storageSet("inputDisabled",e)}setChatEnded(e,t=!1){this.chatEnded=e,t||this.storageSet("chatEnded",e)}setChatEndingWarningSent(e,t=!1){this.chatEndingWarningSent=e,t||this.storageSet("chatEndingWarningSent",e)}sendChatEndingWarning(){this.chatEndingWarningSent||(this._emitter.emit("inactivityWarning"),this.setChatEndingWarningSent(!0))}async insertMessagesWithSimulatedDelays(e){const t=await e;if(t.error)throw new Error(t.message);const{messages:n,functions:s}=t;return await Promise.all(n.map(async(r,a)=>(await this.simulateDelay(1e3*a),this.addMessage(r)))),this.setTyping(!1),s.forEach(r=>this._emitter.emit("functionCall",r)),{messages:n,functions:s}}simulateDelay(e){return this.options.simulateDelays?new Promise(t=>{setTimeout(t,e)}):Promise.resolve()}get assistantId(){return this._assistantId}get params(){return this.options.params}get threadId(){var e;return(e=this._conversationDetails)==null?void 0:e.threadId}get timeUntilChatEnds(){const{inactivityWaitTime:e}=this._conversationDetails||{};return e?e*60*1e3:null}get timeUntilWarnAboutChatEnding(){const{inactivityWaitTime:e=0,inactivityWarningTime:t=0}=this._conversationDetails||{};return(e-t)*60*1e3}get messages(){return this._messages}get chatStarted(){return!!this.threadId}storageSet(e,t){this.options.historyKey&&localStorage.setItem(`iaiChat-${this.options.historyKey}-${e}`,JSON.stringify(t))}storageGet(e,t=null){if(!this.options.historyKey)return null;const n=localStorage.getItem(`iaiChat-${this.options.historyKey}-${e}`);return n?JSON.parse(n):t}storageRemove(e){localStorage.removeItem(`iaiChat-${this.options.historyKey}-${e}`)}storageRemoveAll(){this.options.historyKey&&Object.keys(localStorage).forEach(e=>{e.startsWith(`iaiChat-${this.options.historyKey}-`)&&localStorage.removeItem(e)})}}var Kr={exports:{}};(function(i,e){(function(t,n){i.exports=n()})($o,function(){var t=1e3,n=6e4,s=36e5,r="millisecond",a="second",o="minute",l="hour",d="day",u="week",h="month",c="quarter",f="year",A="date",V="Invalid Date",ae=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,ze=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,nn={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(M){var w=["th","st","nd","rd"],g=M%100;return"["+M+(w[(g-20)%10]||w[g]||w[0])+"]"}},lt=function(M,w,g){var $=String(M);return!$||$.length>=w?M:""+Array(w+1-$.length).join(g)+M},sn={s:lt,z:function(M){var w=-M.utcOffset(),g=Math.abs(w),$=Math.floor(g/60),v=g%60;return(w<=0?"+":"-")+lt($,2,"0")+":"+lt(v,2,"0")},m:function M(w,g){if(w.date()<g.date())return-M(g,w);var $=12*(g.year()-w.year())+(g.month()-w.month()),v=w.clone().add($,h),R=g-v<0,S=w.clone().add($+(R?-1:1),h);return+(-($+(g-v)/(R?v-S:S-v))||0)},a:function(M){return M<0?Math.ceil(M)||0:Math.floor(M)},p:function(M){return{M:h,y:f,w:u,d,D:A,h:l,m:o,s:a,ms:r,Q:c}[M]||String(M||"").toLowerCase().replace(/s$/,"")},u:function(M){return M===void 0}},Te="en",z={};z[Te]=nn;var Fn="$isDayjsObject",be=function(M){return M instanceof Dt||!(!M||!M[Fn])},ct=function M(w,g,$){var v;if(!w)return Te;if(typeof w=="string"){var R=w.toLowerCase();z[R]&&(v=R),g&&(z[R]=g,v=R);var S=w.split("-");if(!v&&S.length>1)return M(S[0])}else{var K=w.name;z[K]=w,v=K}return!$&&v&&(Te=v),v||!$&&Te},oe=function(M,w){if(be(M))return M.clone();var g=typeof w=="object"?w:{};return g.date=M,g.args=arguments,new Dt(g)},W=sn;W.l=ct,W.i=be,W.w=function(M,w){return oe(M,{locale:w.$L,utc:w.$u,x:w.$x,$offset:w.$offset})};var Dt=function(){function M(g){this.$L=ct(g.locale,null,!0),this.parse(g),this.$x=this.$x||g.x||{},this[Fn]=!0}var w=M.prototype;return w.parse=function(g){this.$d=function($){var v=$.date,R=$.utc;if(v===null)return new Date(NaN);if(W.u(v))return new Date;if(v instanceof Date)return new Date(v);if(typeof v=="string"&&!/Z$/i.test(v)){var S=v.match(ae);if(S){var K=S[2]-1||0,te=(S[7]||"0").substring(0,3);return R?new Date(Date.UTC(S[1],K,S[3]||1,S[4]||0,S[5]||0,S[6]||0,te)):new Date(S[1],K,S[3]||1,S[4]||0,S[5]||0,S[6]||0,te)}}return new Date(v)}(g),this.init()},w.init=function(){var g=this.$d;this.$y=g.getFullYear(),this.$M=g.getMonth(),this.$D=g.getDate(),this.$W=g.getDay(),this.$H=g.getHours(),this.$m=g.getMinutes(),this.$s=g.getSeconds(),this.$ms=g.getMilliseconds()},w.$utils=function(){return W},w.isValid=function(){return this.$d.toString()!==V},w.isSame=function(g,$){var v=oe(g);return this.startOf($)<=v&&v<=this.endOf($)},w.isAfter=function(g,$){return oe(g)<this.startOf($)},w.isBefore=function(g,$){return this.endOf($)<oe(g)},w.$g=function(g,$,v){return W.u(g)?this[$]:this.set(v,g)},w.unix=function(){return Math.floor(this.valueOf()/1e3)},w.valueOf=function(){return this.$d.getTime()},w.startOf=function(g,$){var v=this,R=!!W.u($)||$,S=W.p(g),K=function(De,pe){var Le=W.w(v.$u?Date.UTC(v.$y,pe,De):new Date(v.$y,pe,De),v);return R?Le:Le.endOf(d)},te=function(De,pe){return W.w(v.toDate()[De].apply(v.toDate("s"),(R?[0,0,0,0]:[23,59,59,999]).slice(pe)),v)},ie=this.$W,le=this.$M,ge=this.$D,dt="set"+(this.$u?"UTC":"");switch(S){case f:return R?K(1,0):K(31,11);case h:return R?K(1,le):K(0,le+1);case u:var qe=this.$locale().weekStart||0,Lt=(ie<qe?ie+7:ie)-qe;return K(R?ge-Lt:ge+(6-Lt),le);case d:case A:return te(dt+"Hours",0);case l:return te(dt+"Minutes",1);case o:return te(dt+"Seconds",2);case a:return te(dt+"Milliseconds",3);default:return this.clone()}},w.endOf=function(g){return this.startOf(g,!1)},w.$set=function(g,$){var v,R=W.p(g),S="set"+(this.$u?"UTC":""),K=(v={},v[d]=S+"Date",v[A]=S+"Date",v[h]=S+"Month",v[f]=S+"FullYear",v[l]=S+"Hours",v[o]=S+"Minutes",v[a]=S+"Seconds",v[r]=S+"Milliseconds",v)[R],te=R===d?this.$D+($-this.$W):$;if(R===h||R===f){var ie=this.clone().set(A,1);ie.$d[K](te),ie.init(),this.$d=ie.set(A,Math.min(this.$D,ie.daysInMonth())).$d}else K&&this.$d[K](te);return this.init(),this},w.set=function(g,$){return this.clone().$set(g,$)},w.get=function(g){return this[W.p(g)]()},w.add=function(g,$){var v,R=this;g=Number(g);var S=W.p($),K=function(le){var ge=oe(R);return W.w(ge.date(ge.date()+Math.round(le*g)),R)};if(S===h)return this.set(h,this.$M+g);if(S===f)return this.set(f,this.$y+g);if(S===d)return K(1);if(S===u)return K(7);var te=(v={},v[o]=n,v[l]=s,v[a]=t,v)[S]||1,ie=this.$d.getTime()+g*te;return W.w(ie,this)},w.subtract=function(g,$){return this.add(-1*g,$)},w.format=function(g){var $=this,v=this.$locale();if(!this.isValid())return v.invalidDate||V;var R=g||"YYYY-MM-DDTHH:mm:ssZ",S=W.z(this),K=this.$H,te=this.$m,ie=this.$M,le=v.weekdays,ge=v.months,dt=v.meridiem,qe=function(pe,Le,Je,an){return pe&&(pe[Le]||pe($,R))||Je[Le].slice(0,an)},Lt=function(pe){return W.s(K%12||12,pe,"0")},De=dt||function(pe,Le,Je){var an=pe<12?"AM":"PM";return Je?an.toLowerCase():an};return R.replace(ze,function(pe,Le){return Le||function(Je){switch(Je){case"YY":return String($.$y).slice(-2);case"YYYY":return W.s($.$y,4,"0");case"M":return ie+1;case"MM":return W.s(ie+1,2,"0");case"MMM":return qe(v.monthsShort,ie,ge,3);case"MMMM":return qe(ge,ie);case"D":return $.$D;case"DD":return W.s($.$D,2,"0");case"d":return String($.$W);case"dd":return qe(v.weekdaysMin,$.$W,le,2);case"ddd":return qe(v.weekdaysShort,$.$W,le,3);case"dddd":return le[$.$W];case"H":return String(K);case"HH":return W.s(K,2,"0");case"h":return Lt(1);case"hh":return Lt(2);case"a":return De(K,te,!0);case"A":return De(K,te,!1);case"m":return String(te);case"mm":return W.s(te,2,"0");case"s":return String($.$s);case"ss":return W.s($.$s,2,"0");case"SSS":return W.s($.$ms,3,"0");case"Z":return S}return null}(pe)||S.replace(":","")})},w.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},w.diff=function(g,$,v){var R,S=this,K=W.p($),te=oe(g),ie=(te.utcOffset()-this.utcOffset())*n,le=this-te,ge=function(){return W.m(S,te)};switch(K){case f:R=ge()/12;break;case h:R=ge();break;case c:R=ge()/3;break;case u:R=(le-ie)/6048e5;break;case d:R=(le-ie)/864e5;break;case l:R=le/s;break;case o:R=le/n;break;case a:R=le/t;break;default:R=le}return v?R:W.a(R)},w.daysInMonth=function(){return this.endOf(h).$D},w.$locale=function(){return z[this.$L]},w.locale=function(g,$){if(!g)return this.$L;var v=this.clone(),R=ct(g,$,!0);return R&&(v.$L=R),v},w.clone=function(){return W.w(this.$d,this)},w.toDate=function(){return new Date(this.valueOf())},w.toJSON=function(){return this.isValid()?this.toISOString():null},w.toISOString=function(){return this.$d.toISOString()},w.toString=function(){return this.$d.toUTCString()},M}(),rn=Dt.prototype;return oe.prototype=rn,[["$ms",r],["$s",a],["$m",o],["$H",l],["$W",d],["$M",h],["$y",f],["$D",A]].forEach(function(M){rn[M[1]]=function(w){return this.$g(w,M[0],M[1])}}),oe.extend=function(M,w){return M.$i||(M(w,Dt,oe),M.$i=!0),oe},oe.locale=ct,oe.isDayjs=be,oe.unix=function(M){return oe(1e3*M)},oe.en=z[Te],oe.Ls=z,oe.p={},oe})})(Kr);var Tl=Kr.exports;const qr=jr(Tl);/**
|
|
160
|
+
`}toggleChat(){this.isOpen=!this.isOpen,this.onResizeHandler()}};Nt.styles=[Be],Rn([ne({type:Object})],Nt.prototype,"options",2),Rn([wt()],Nt.prototype,"isOpen",2),Rn([ns("iai-chat")],Nt.prototype,"chatWindow",2),Rn([ei.debounce(250)],Nt.prototype,"onResizeHandler",2),Nt=Rn([He("iai-chat-popup")],Nt);const _s="https://api-dev.ai.inhabit.work";async function wl(s,e={}){const t=await fetch(`${_s}/threads`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assistantId:s,params:e})});if(!t.ok)throw new Error(`Failed to create thread: ${t.statusText} (${t.status})`);return t.json()}async function _l(s,e="No reason provided"){const t=await fetch(`${_s}/threads/${s}/end`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:e})});if(!t.ok)throw new Error(`Failed to end thread: ${t.statusText} (${t.status})`)}async function xl(s,e){const t=await fetch(`${_s}/threads/${s}/messages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})});if(!t.ok)throw new Error(`Failed to send message: ${t.statusText} (${t.status})`);return t.json()}async function kl(s,e,t,n=!1){const i=await fetch(`${_s}/threads/${s}/functions/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({params:t,rerunLLM:n})});if(!i.ok)throw new Error(`Failed to respond to function call: ${i.statusText} (${i.status})`);return i.json()}function $l(s){return{all:s=s||new Map,on:function(e,t){var n=s.get(e);n?n.push(t):s.set(e,[t])},off:function(e,t){var n=s.get(e);n&&(t?n.splice(n.indexOf(t)>>>0,1):s.set(e,[]))},emit:function(e,t){var n=s.get(e);n&&n.slice().map(function(i){i(t)}),(n=s.get("*"))&&n.slice().map(function(i){i(e,t)})}}}class Al{constructor(e,t={}){if(this._assistantId="",this._conversationDetails=null,this._messages=[],this.isTyping=!1,this.inputDisabled=!1,this.chatEndingWarningSent=!1,this.chatEnded=!1,this.onStorageEvent=n=>{var i;const[r,a,o]=((i=n.key)==null?void 0:i.split("-"))||[];if(!(r!=="iaiChat"||a!==this.options.historyKey))switch(o){case"messageHistory":this.onMessageHistoryStorageEvent(n);break;case"conversation":this.setConversationDetails(JSON.parse(n.newValue||"null"),!0);break;case"lastActivity":this.keepAlive(JSON.parse(n.newValue||"null"),!0);break;case"chatEndingWarningSent":this.setChatEndingWarningSent(JSON.parse(n.newValue||"false"),!0);break;case"chatEnded":this.setChatEnded(JSON.parse(n.newValue||"false"),!0);break;case"typing":this.setTyping(JSON.parse(n.newValue||"false"),!0);break;case"inputDisabled":this.setInputDisabled(JSON.parse(n.newValue||"false"),!0);break}},this._assistantId=e,this.options={params:{},simulateDelays:!1,resetEndedChatOnLoad:!1,historyKey:"main",...t},this._emitter=$l(),this.on=this._emitter.on.bind(this._emitter),this.off=this._emitter.off.bind(this._emitter),t.events&&Object.entries(t.events).forEach(([n,i])=>{this._emitter.on(n,i)}),t.historyKey){this._messages=this.storageGet("messageHistory",[]);const n=this.storageGet("conversation");n&&this.setConversationDetails(n,!0);const i=this.storageGet("chatEndingWarningSent");i&&this.setChatEndingWarningSent(i,!0);const r=this.storageGet("chatEnded");r&&this.setChatEnded(r,!0);const a=this.storageGet("typing");a&&this.setTyping(a,!0);const o=this.storageGet("inputDisabled");o&&this.setInputDisabled(o,!0);const l=this.storageGet("lastActivity");l&&setTimeout(()=>this.keepAlive(l,!0),0),setTimeout(()=>{this.chatEnded&&this.options.resetEndedChatOnLoad&&this.reset()},0),window.addEventListener("storage",this.onStorageEvent)}}onMessageHistoryStorageEvent(e){if(!e.newValue){this.reset();return}const t=JSON.parse(e.newValue),n=this._messages.map(r=>r.id),i=t.map(r=>r.id);this._messages.forEach(r=>{i.includes(r.id)||this._emitter.emit("messageRemoved",r.id)}),t.forEach(r=>{n.includes(r.id)||this._emitter.emit("message",r)}),this._messages=t}async endChat(e,t=!0){!this.threadId||this.chatEnded||(t&&(this._emitter.emit("chatEnded"),this.setChatEnded(!0)),this.stopInactivityTimers(),await _l(this.threadId,e))}reset(e){this.endChat(e,!1).then(()=>{}),this._messages=[],this.setConversationDetails(null),this.setTyping(!1),this.setInputDisabled(!1),this.setChatEnded(!1),this.stopInactivityTimers(),this.storageRemoveAll(),this._emitter.emit("reset")}destroy(){this._emitter.all.clear(),window.removeEventListener("storage",this.onStorageEvent),this.stopInactivityTimers(),this._emitter.emit("destroy")}stopInactivityTimers(){this._inactivityTimeout&&(clearTimeout(this._inactivityTimeout),this._inactivityTimeout=null),this._inactivityWarningTimeout&&(clearTimeout(this._inactivityWarningTimeout),this._inactivityWarningTimeout=null)}keepAlive(e=Date.now(),t=!1){if(this.stopInactivityTimers(),this.chatEnded||!e)return;const{timeUntilChatEnds:n,timeUntilWarnAboutChatEnding:i}=this;if(!n)return;t||this.storageSet("lastActivity",e);const r=Date.now()-e;r>n?(this.chatEnded||this._emitter.emit("chatEnded"),this.setChatEnded(!0)):r>i?(this.sendChatEndingWarning(),this._inactivityTimeout=setTimeout(()=>{this.chatEnded||this._emitter.emit("chatEnded"),this.setChatEnded(!0)},n-r)):(this.setChatEndingWarningSent(!1),this._inactivityWarningTimeout=setTimeout(()=>this.sendChatEndingWarning(),i-r),this._inactivityTimeout=setTimeout(()=>{this.chatEnded||this._emitter.emit("chatEnded"),this.setChatEnded(!0)},n-r))}async startChat(){if(this.chatStarted)return;const{id:e,inactivityWaitTime:t,inactivityWarningTime:n}=await wl(this.assistantId,this.params);if(!e)throw new Error("Could not start chat");this.setConversationDetails({threadId:e,inactivityWaitTime:t,inactivityWarningTime:n})}addMessage(e){const t={...e,id:e.id||Math.random().toString(36).substring(7)};return this._messages.push(t),this.storageSet("messageHistory",this._messages),this._emitter.emit("message",t),t}removeMessage(e){this._messages=this._messages.filter(t=>t.id!==e),this.storageSet("messageHistory",this._messages),this._emitter.emit("messageRemoved",e)}async respondToFunctionCall(e,t,n){if(!this.threadId)throw new Error("Thread not started");try{this.simulateDelay(1800).then(()=>this.setTyping(!0));const i=this.simulateDelay(2e3);this.keepAlive(),await this.insertMessagesWithSimulatedDelays(Promise.all([kl(this.threadId,e,t,n),i]).then(([r])=>r))}catch(i){this.addMessage({role:"assistant",content:"There was an unexpected error. Please try again later."}),this.setTyping(!1),console.error("Error sending message:",i)}}async sendUserMessage(e){try{this.addMessage({role:"user",content:e}),this.simulateDelay(1800).then(()=>this.setTyping(!0));let t=this.simulateDelay(4800);if(!this.chatStarted){const{initialReplyMessage:r}=this.options;r&&(this.simulateDelay(3800).then(()=>{this.addMessage({role:"assistant",content:r}),this.setTyping(!1)}),this.simulateDelay(6200).then(()=>this.setTyping(!0)),t=this.simulateDelay(8200)),await this.startChat()}this.keepAlive();const{messages:n,functions:i}=await this.insertMessagesWithSimulatedDelays(Promise.all([xl(this.threadId,e),t]).then(([r])=>r));return{messages:n,functions:i}}catch(t){this.addMessage({role:"assistant",content:"There was an unexpected error. Please try again later."}),this.setTyping(!1),console.error("Error sending message:",t)}}setTyping(e,t=!1){this.isTyping=e,this._emitter.emit("typing",e),t||this.storageSet("typing",e)}setConversationDetails(e,t=!1){this._conversationDetails=e,t||this.storageSet("conversation",e)}setInputDisabled(e,t=!1){this.inputDisabled=e,this._emitter.emit("inputDisabled",e),t||this.storageSet("inputDisabled",e)}setChatEnded(e,t=!1){this.chatEnded=e,t||this.storageSet("chatEnded",e)}setChatEndingWarningSent(e,t=!1){this.chatEndingWarningSent=e,t||this.storageSet("chatEndingWarningSent",e)}sendChatEndingWarning(){this.chatEndingWarningSent||(this._emitter.emit("inactivityWarning"),this.setChatEndingWarningSent(!0))}async insertMessagesWithSimulatedDelays(e){const t=await e,{messages:n,functions:i}=t;return await Promise.all(n.map(async(r,a)=>(await this.simulateDelay(1e3*a),this.addMessage(r)))),this.setTyping(!1),i.forEach(r=>this._emitter.emit("functionCall",r)),{messages:n,functions:i}}simulateDelay(e){return this.options.simulateDelays?new Promise(t=>{setTimeout(t,e)}):Promise.resolve()}get assistantId(){return this._assistantId}get params(){return this.options.params}get threadId(){var e;return(e=this._conversationDetails)==null?void 0:e.threadId}get timeUntilChatEnds(){const{inactivityWaitTime:e}=this._conversationDetails||{};return e?e*60*1e3:null}get timeUntilWarnAboutChatEnding(){const{inactivityWaitTime:e=0,inactivityWarningTime:t=0}=this._conversationDetails||{};return(e-t)*60*1e3}get messages(){return this._messages}get chatStarted(){return!!this.threadId}storageSet(e,t){this.options.historyKey&&localStorage.setItem(`iaiChat-${this.options.historyKey}-${e}`,JSON.stringify(t))}storageGet(e,t=null){if(!this.options.historyKey)return null;const n=localStorage.getItem(`iaiChat-${this.options.historyKey}-${e}`);return n?JSON.parse(n):t}storageRemove(e){localStorage.removeItem(`iaiChat-${this.options.historyKey}-${e}`)}storageRemoveAll(){this.options.historyKey&&Object.keys(localStorage).forEach(e=>{e.startsWith(`iaiChat-${this.options.historyKey}-`)&&localStorage.removeItem(e)})}}var Kr={exports:{}};(function(s,e){(function(t,n){s.exports=n()})($o,function(){var t=1e3,n=6e4,i=36e5,r="millisecond",a="second",o="minute",l="hour",d="day",u="week",h="month",c="quarter",f="year",A="date",V="Invalid Date",ae=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,ze=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,nn={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(M){var w=["th","st","nd","rd"],m=M%100;return"["+M+(w[(m-20)%10]||w[m]||w[0])+"]"}},lt=function(M,w,m){var $=String(M);return!$||$.length>=w?M:""+Array(w+1-$.length).join(m)+M},sn={s:lt,z:function(M){var w=-M.utcOffset(),m=Math.abs(w),$=Math.floor(m/60),v=m%60;return(w<=0?"+":"-")+lt($,2,"0")+":"+lt(v,2,"0")},m:function M(w,m){if(w.date()<m.date())return-M(m,w);var $=12*(m.year()-w.year())+(m.month()-w.month()),v=w.clone().add($,h),R=m-v<0,S=w.clone().add($+(R?-1:1),h);return+(-($+(m-v)/(R?v-S:S-v))||0)},a:function(M){return M<0?Math.ceil(M)||0:Math.floor(M)},p:function(M){return{M:h,y:f,w:u,d,D:A,h:l,m:o,s:a,ms:r,Q:c}[M]||String(M||"").toLowerCase().replace(/s$/,"")},u:function(M){return M===void 0}},Te="en",z={};z[Te]=nn;var Fn="$isDayjsObject",be=function(M){return M instanceof Dt||!(!M||!M[Fn])},ct=function M(w,m,$){var v;if(!w)return Te;if(typeof w=="string"){var R=w.toLowerCase();z[R]&&(v=R),m&&(z[R]=m,v=R);var S=w.split("-");if(!v&&S.length>1)return M(S[0])}else{var K=w.name;z[K]=w,v=K}return!$&&v&&(Te=v),v||!$&&Te},oe=function(M,w){if(be(M))return M.clone();var m=typeof w=="object"?w:{};return m.date=M,m.args=arguments,new Dt(m)},W=sn;W.l=ct,W.i=be,W.w=function(M,w){return oe(M,{locale:w.$L,utc:w.$u,x:w.$x,$offset:w.$offset})};var Dt=function(){function M(m){this.$L=ct(m.locale,null,!0),this.parse(m),this.$x=this.$x||m.x||{},this[Fn]=!0}var w=M.prototype;return w.parse=function(m){this.$d=function($){var v=$.date,R=$.utc;if(v===null)return new Date(NaN);if(W.u(v))return new Date;if(v instanceof Date)return new Date(v);if(typeof v=="string"&&!/Z$/i.test(v)){var S=v.match(ae);if(S){var K=S[2]-1||0,te=(S[7]||"0").substring(0,3);return R?new Date(Date.UTC(S[1],K,S[3]||1,S[4]||0,S[5]||0,S[6]||0,te)):new Date(S[1],K,S[3]||1,S[4]||0,S[5]||0,S[6]||0,te)}}return new Date(v)}(m),this.init()},w.init=function(){var m=this.$d;this.$y=m.getFullYear(),this.$M=m.getMonth(),this.$D=m.getDate(),this.$W=m.getDay(),this.$H=m.getHours(),this.$m=m.getMinutes(),this.$s=m.getSeconds(),this.$ms=m.getMilliseconds()},w.$utils=function(){return W},w.isValid=function(){return this.$d.toString()!==V},w.isSame=function(m,$){var v=oe(m);return this.startOf($)<=v&&v<=this.endOf($)},w.isAfter=function(m,$){return oe(m)<this.startOf($)},w.isBefore=function(m,$){return this.endOf($)<oe(m)},w.$g=function(m,$,v){return W.u(m)?this[$]:this.set(v,m)},w.unix=function(){return Math.floor(this.valueOf()/1e3)},w.valueOf=function(){return this.$d.getTime()},w.startOf=function(m,$){var v=this,R=!!W.u($)||$,S=W.p(m),K=function(De,pe){var Le=W.w(v.$u?Date.UTC(v.$y,pe,De):new Date(v.$y,pe,De),v);return R?Le:Le.endOf(d)},te=function(De,pe){return W.w(v.toDate()[De].apply(v.toDate("s"),(R?[0,0,0,0]:[23,59,59,999]).slice(pe)),v)},se=this.$W,le=this.$M,me=this.$D,dt="set"+(this.$u?"UTC":"");switch(S){case f:return R?K(1,0):K(31,11);case h:return R?K(1,le):K(0,le+1);case u:var qe=this.$locale().weekStart||0,Lt=(se<qe?se+7:se)-qe;return K(R?me-Lt:me+(6-Lt),le);case d:case A:return te(dt+"Hours",0);case l:return te(dt+"Minutes",1);case o:return te(dt+"Seconds",2);case a:return te(dt+"Milliseconds",3);default:return this.clone()}},w.endOf=function(m){return this.startOf(m,!1)},w.$set=function(m,$){var v,R=W.p(m),S="set"+(this.$u?"UTC":""),K=(v={},v[d]=S+"Date",v[A]=S+"Date",v[h]=S+"Month",v[f]=S+"FullYear",v[l]=S+"Hours",v[o]=S+"Minutes",v[a]=S+"Seconds",v[r]=S+"Milliseconds",v)[R],te=R===d?this.$D+($-this.$W):$;if(R===h||R===f){var se=this.clone().set(A,1);se.$d[K](te),se.init(),this.$d=se.set(A,Math.min(this.$D,se.daysInMonth())).$d}else K&&this.$d[K](te);return this.init(),this},w.set=function(m,$){return this.clone().$set(m,$)},w.get=function(m){return this[W.p(m)]()},w.add=function(m,$){var v,R=this;m=Number(m);var S=W.p($),K=function(le){var me=oe(R);return W.w(me.date(me.date()+Math.round(le*m)),R)};if(S===h)return this.set(h,this.$M+m);if(S===f)return this.set(f,this.$y+m);if(S===d)return K(1);if(S===u)return K(7);var te=(v={},v[o]=n,v[l]=i,v[a]=t,v)[S]||1,se=this.$d.getTime()+m*te;return W.w(se,this)},w.subtract=function(m,$){return this.add(-1*m,$)},w.format=function(m){var $=this,v=this.$locale();if(!this.isValid())return v.invalidDate||V;var R=m||"YYYY-MM-DDTHH:mm:ssZ",S=W.z(this),K=this.$H,te=this.$m,se=this.$M,le=v.weekdays,me=v.months,dt=v.meridiem,qe=function(pe,Le,Je,an){return pe&&(pe[Le]||pe($,R))||Je[Le].slice(0,an)},Lt=function(pe){return W.s(K%12||12,pe,"0")},De=dt||function(pe,Le,Je){var an=pe<12?"AM":"PM";return Je?an.toLowerCase():an};return R.replace(ze,function(pe,Le){return Le||function(Je){switch(Je){case"YY":return String($.$y).slice(-2);case"YYYY":return W.s($.$y,4,"0");case"M":return se+1;case"MM":return W.s(se+1,2,"0");case"MMM":return qe(v.monthsShort,se,me,3);case"MMMM":return qe(me,se);case"D":return $.$D;case"DD":return W.s($.$D,2,"0");case"d":return String($.$W);case"dd":return qe(v.weekdaysMin,$.$W,le,2);case"ddd":return qe(v.weekdaysShort,$.$W,le,3);case"dddd":return le[$.$W];case"H":return String(K);case"HH":return W.s(K,2,"0");case"h":return Lt(1);case"hh":return Lt(2);case"a":return De(K,te,!0);case"A":return De(K,te,!1);case"m":return String(te);case"mm":return W.s(te,2,"0");case"s":return String($.$s);case"ss":return W.s($.$s,2,"0");case"SSS":return W.s($.$ms,3,"0");case"Z":return S}return null}(pe)||S.replace(":","")})},w.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},w.diff=function(m,$,v){var R,S=this,K=W.p($),te=oe(m),se=(te.utcOffset()-this.utcOffset())*n,le=this-te,me=function(){return W.m(S,te)};switch(K){case f:R=me()/12;break;case h:R=me();break;case c:R=me()/3;break;case u:R=(le-se)/6048e5;break;case d:R=(le-se)/864e5;break;case l:R=le/i;break;case o:R=le/n;break;case a:R=le/t;break;default:R=le}return v?R:W.a(R)},w.daysInMonth=function(){return this.endOf(h).$D},w.$locale=function(){return z[this.$L]},w.locale=function(m,$){if(!m)return this.$L;var v=this.clone(),R=ct(m,$,!0);return R&&(v.$L=R),v},w.clone=function(){return W.w(this.$d,this)},w.toDate=function(){return new Date(this.valueOf())},w.toJSON=function(){return this.isValid()?this.toISOString():null},w.toISOString=function(){return this.$d.toISOString()},w.toString=function(){return this.$d.toUTCString()},M}(),rn=Dt.prototype;return oe.prototype=rn,[["$ms",r],["$s",a],["$m",o],["$H",l],["$W",d],["$M",h],["$y",f],["$D",A]].forEach(function(M){rn[M[1]]=function(w){return this.$g(w,M[0],M[1])}}),oe.extend=function(M,w){return M.$i||(M(w,Dt,oe),M.$i=!0),oe},oe.locale=ct,oe.isDayjs=be,oe.unix=function(M){return oe(1e3*M)},oe.en=z[Te],oe.Ls=z,oe.p={},oe})})(Kr);var Tl=Kr.exports;const qr=jr(Tl);/**
|
|
161
161
|
* @license
|
|
162
162
|
* Copyright 2021 Google LLC
|
|
163
163
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
164
|
-
*/function Fe(
|
|
164
|
+
*/function Fe(s,e,t){return s?e(s):t==null?void 0:t(s)}function Sl(s){return{all:s=s||new Map,on:function(e,t){var n=s.get(e);n?n.push(t):s.set(e,[t])},off:function(e,t){var n=s.get(e);n&&(t?n.splice(n.indexOf(t)>>>0,1):s.set(e,[]))},emit:function(e,t){var n=s.get(e);n&&n.slice().map(function(i){i(t)}),(n=s.get("*"))&&n.slice().map(function(i){i(e,t)})}}}const Pn=U`
|
|
165
165
|
<svg
|
|
166
166
|
xmlns="http://www.w3.org/2000/svg"
|
|
167
167
|
viewBox="0 0 24 24"
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
<path
|
|
174
174
|
d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"/>
|
|
175
175
|
</svg>
|
|
176
|
-
`,
|
|
176
|
+
`,El=U`
|
|
177
177
|
<svg
|
|
178
178
|
xmlns="http://www.w3.org/2000/svg"
|
|
179
179
|
viewBox="0 0 24 24"
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
<path
|
|
186
186
|
d="M12,3C17.5,3 22,6.58 22,11C22,15.42 17.5,19 12,19C10.76,19 9.57,18.82 8.47,18.5C5.55,21 2,21 2,21C4.33,18.67 4.7,17.1 4.75,16.5C3.05,15.07 2,13.13 2,11C2,6.58 6.5,3 12,3Z"/>
|
|
187
187
|
</svg>
|
|
188
|
-
`,
|
|
188
|
+
`,Cl=U`
|
|
189
189
|
<svg
|
|
190
190
|
xmlns="http://www.w3.org/2000/svg"
|
|
191
191
|
viewBox="0 0 24 24"
|
|
@@ -211,40 +211,40 @@
|
|
|
211
211
|
* @license
|
|
212
212
|
* Copyright 2017 Google LLC
|
|
213
213
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
214
|
-
*/class
|
|
215
|
-
`).map(
|
|
216
|
-
`)}class
|
|
217
|
-
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],
|
|
218
|
-
$1`);n=
|
|
219
|
-
`);const
|
|
214
|
+
*/class ai extends Xs{constructor(e){if(super(e),this.it=re,e.type!==Ys.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===re||e==null)return this._t=void 0,this.it=e;if(e===et)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}ai.directiveName="unsafeHTML",ai.resultType=1;const Il=Gs(ai);function oi(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Rt=oi();function Jr(s){Rt=s}const Qr=/[&<>"']/,Ml=new RegExp(Qr.source,"g"),Yr=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Nl=new RegExp(Yr.source,"g"),Rl={"&":"&","<":"<",">":">",'"':""","'":"'"},Gr=s=>Rl[s];function ke(s,e){if(e){if(Qr.test(s))return s.replace(Ml,Gr)}else if(Yr.test(s))return s.replace(Nl,Gr);return s}const Pl=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function jl(s){return s.replace(Pl,(e,t)=>(t=t.toLowerCase(),t==="colon"?":":t.charAt(0)==="#"?t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const zl=/(^|[^\[])\^/g;function J(s,e){let t=typeof s=="string"?s:s.source;e=e||"";const n={replace:(i,r)=>{let a=typeof r=="string"?r:r.source;return a=a.replace(zl,"$1"),t=t.replace(i,a),n},getRegex:()=>new RegExp(t,e)};return n}function Xr(s){try{s=encodeURI(s).replace(/%25/g,"%")}catch{return null}return s}const jn={exec:()=>null};function ea(s,e){const t=s.replace(/\|/g,(r,a,o)=>{let l=!1,d=a;for(;--d>=0&&o[d]==="\\";)l=!l;return l?"|":" |"}),n=t.split(/ \|/);let i=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n}function xs(s,e,t){const n=s.length;if(n===0)return"";let i=0;for(;i<n;){const r=s.charAt(n-i-1);if(r===e&&!t)i++;else if(r!==e&&t)i++;else break}return s.slice(0,n-i)}function Dl(s,e){if(s.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<s.length;n++)if(s[n]==="\\")n++;else if(s[n]===e[0])t++;else if(s[n]===e[1]&&(t--,t<0))return n;return-1}function ta(s,e,t,n){const i=e.href,r=e.title?ke(e.title):null,a=s[1].replace(/\\([\[\]])/g,"$1");if(s[0].charAt(0)!=="!"){n.state.inLink=!0;const o={type:"link",raw:t,href:i,title:r,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,o}return{type:"image",raw:t,href:i,title:r,text:ke(a)}}function Ll(s,e){const t=s.match(/^(\s+)(?:```)/);if(t===null)return e;const n=t[1];return e.split(`
|
|
215
|
+
`).map(i=>{const r=i.match(/^\s+/);if(r===null)return i;const[a]=r;return a.length>=n.length?i.slice(n.length):i}).join(`
|
|
216
|
+
`)}class ks{constructor(e){Y(this,"options"),Y(this,"rules"),Y(this,"lexer"),this.options=e||Rt}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:xs(n,`
|
|
217
|
+
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],i=Ll(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(/#$/.test(n)){const i=xs(n,"#");(this.options.pedantic||!i||/ $/.test(i))&&(n=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let n=t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
|
|
218
|
+
$1`);n=xs(n.replace(/^ *>[ \t]?/gm,""),`
|
|
219
|
+
`);const i=this.lexer.state.top;this.lexer.state.top=!0;const r=this.lexer.blockTokens(n);return this.lexer.state.top=i,{type:"blockquote",raw:t[0],tokens:r,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const i=n.length>1,r={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");const a=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);let o="",l="",d=!1;for(;e;){let u=!1;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;o=t[0],e=e.substring(o.length);let h=t[2].split(`
|
|
220
220
|
`,1)[0].replace(/^\t+/,ze=>" ".repeat(3*ze.length)),c=e.split(`
|
|
221
221
|
`,1)[0],f=0;this.options.pedantic?(f=2,l=h.trimStart()):(f=t[2].search(/[^ ]/),f=f>4?1:f,l=h.slice(f),f+=t[1].length);let A=!1;if(!h&&/^ *$/.test(c)&&(o+=c+`
|
|
222
222
|
`,e=e.substring(c.length+1),u=!0),!u){const ze=new RegExp(`^ {0,${Math.min(3,f-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),nn=new RegExp(`^ {0,${Math.min(3,f-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),lt=new RegExp(`^ {0,${Math.min(3,f-1)}}(?:\`\`\`|~~~)`),sn=new RegExp(`^ {0,${Math.min(3,f-1)}}#`);for(;e;){const Te=e.split(`
|
|
223
223
|
`,1)[0];if(c=Te,this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),lt.test(c)||sn.test(c)||ze.test(c)||nn.test(e))break;if(c.search(/[^ ]/)>=f||!c.trim())l+=`
|
|
224
224
|
`+c.slice(f);else{if(A||h.search(/[^ ]/)>=4||lt.test(h)||sn.test(h)||nn.test(h))break;l+=`
|
|
225
225
|
`+c}!A&&!c.trim()&&(A=!0),o+=Te+`
|
|
226
|
-
`,e=e.substring(Te.length+1),h=c.slice(f)}}r.loose||(d?r.loose=!0:/\n *\n *$/.test(o)&&(d=!0));let V=null,ae;this.options.gfm&&(V=/^\[[ xX]\] /.exec(l),V&&(ae=V[0]!=="[ ] ",l=l.replace(/^\[[ xX]\] +/,""))),r.items.push({type:"list_item",raw:o,task:!!V,checked:ae,loose:!1,text:l,tokens:[]}),r.raw+=o}r.items[r.items.length-1].raw=o.trimEnd(),r.items[r.items.length-1].text=l.trimEnd(),r.raw=r.raw.trimEnd();for(let u=0;u<r.items.length;u++)if(this.lexer.state.top=!1,r.items[u].tokens=this.lexer.blockTokens(r.items[u].text,[]),!r.loose){const h=r.items[u].tokens.filter(f=>f.type==="space"),c=h.length>0&&h.some(f=>/\n.*\n/.test(f.raw));r.loose=c}if(r.loose)for(let u=0;u<r.items.length;u++)r.items[u].loose=!0;return r}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(/\s+/g," "),
|
|
227
|
-
`):[],a={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===
|
|
228
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:ke(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const a=
|
|
229
|
-
]`).replace("lheading",
|
|
230
|
-
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){this.options.pedantic?e=e.replace(/\t/g," ").replace(/^ +$/gm,""):e=e.replace(/^( *)(\t+)/gm,(o,l,d)=>l+" ".repeat(d.length));let n,
|
|
231
|
-
`:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),
|
|
232
|
-
`+n.raw,
|
|
233
|
-
`+n.text,this.inlineQueue[this.inlineQueue.length-1].src=
|
|
234
|
-
`+n.raw,
|
|
235
|
-
`+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=
|
|
236
|
-
`+n.raw,
|
|
237
|
-
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=
|
|
238
|
-
`+n.raw,
|
|
239
|
-
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=
|
|
226
|
+
`,e=e.substring(Te.length+1),h=c.slice(f)}}r.loose||(d?r.loose=!0:/\n *\n *$/.test(o)&&(d=!0));let V=null,ae;this.options.gfm&&(V=/^\[[ xX]\] /.exec(l),V&&(ae=V[0]!=="[ ] ",l=l.replace(/^\[[ xX]\] +/,""))),r.items.push({type:"list_item",raw:o,task:!!V,checked:ae,loose:!1,text:l,tokens:[]}),r.raw+=o}r.items[r.items.length-1].raw=o.trimEnd(),r.items[r.items.length-1].text=l.trimEnd(),r.raw=r.raw.trimEnd();for(let u=0;u<r.items.length;u++)if(this.lexer.state.top=!1,r.items[u].tokens=this.lexer.blockTokens(r.items[u].text,[]),!r.loose){const h=r.items[u].tokens.filter(f=>f.type==="space"),c=h.length>0&&h.some(f=>/\n.*\n/.test(f.raw));r.loose=c}if(r.loose)for(let u=0;u<r.items.length;u++)r.items[u].loose=!0;return r}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(/\s+/g," "),i=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:i,title:r}}}table(e){const t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;const n=ea(t[1]),i=t[2].replace(/^\||\| *$/g,"").split("|"),r=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
|
|
227
|
+
`):[],a={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(const o of i)/^ *-+: *$/.test(o)?a.align.push("right"):/^ *:-+: *$/.test(o)?a.align.push("center"):/^ *:-+ *$/.test(o)?a.align.push("left"):a.align.push(null);for(const o of n)a.header.push({text:o,tokens:this.lexer.inline(o)});for(const o of r)a.rows.push(ea(o,a.header.length).map(l=>({text:l,tokens:this.lexer.inline(l)})));return a}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
|
|
228
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:ke(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const a=xs(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{const a=Dl(t[2],"()");if(a>-1){const o=(t[0].indexOf("!")===0?5:4)+t[1].length+a;t[2]=t[2].substring(0,a),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let i=t[2],r="";if(this.options.pedantic){const a=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);a&&(i=a[1],r=a[3])}else r=t[3]?t[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(n)?i=i.slice(1):i=i.slice(1,-1)),ta(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const i=(n[2]||n[1]).replace(/\s+/g," "),r=t[i.toLowerCase()];if(!r){const a=n[0].charAt(0);return{type:"text",raw:a,text:a}}return ta(n,r,n[0],this.lexer)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!(!i||i[3]&&n.match(/[\p{L}\p{N}]/u))&&(!(i[1]||i[2])||!n||this.rules.inline.punctuation.exec(n))){const r=[...i[0]].length-1;let a,o,l=r,d=0;const u=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+r);(i=u.exec(t))!=null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(o=[...a].length,i[3]||i[4]){l+=o;continue}else if((i[5]||i[6])&&r%3&&!((r+o)%3)){d+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+d);const h=[...i[0]][0].length,c=e.slice(0,r+i.index+h+o);if(Math.min(r,o)%2){const A=c.slice(1,-1);return{type:"em",raw:c,text:A,tokens:this.lexer.inlineTokens(A)}}const f=c.slice(2,-2);return{type:"strong",raw:c,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(/\n/g," ");const i=/[^ ]/.test(n),r=/^ /.test(n)&&/ $/.test(n);return i&&r&&(n=n.substring(1,n.length-1)),n=ke(n,!0),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,i;return t[2]==="@"?(n=ke(t[1]),i="mailto:"+n):(n=ke(t[1]),i=n),{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var t;let n;if(n=this.rules.inline.url.exec(e)){let i,r;if(n[2]==="@")i=ke(n[0]),r="mailto:"+i;else{let a;do a=n[0],n[0]=((t=this.rules.inline._backpedal.exec(n[0]))==null?void 0:t[0])??"";while(a!==n[0]);i=ke(n[0]),n[1]==="www."?r="http://"+n[0]:r=n[0]}return{type:"link",raw:n[0],text:i,href:r,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let n;return this.lexer.state.inRawBlock?n=t[0]:n=ke(t[0]),{type:"text",raw:t[0],text:n}}}}const Zl=/^(?: *(?:\n|$))+/,Hl=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Ul=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,zn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Bl=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,na=/(?:[*+-]|\d{1,9}[.)])/,sa=J(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,na).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),li=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Wl=/^[^\n]+/,ci=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Vl=J(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",ci).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Fl=J(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,na).getRegex(),$s="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",di=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Kl=J("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",di).replace("tag",$s).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ia=J(li).replace("hr",zn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$s).getRegex(),ql=J(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ia).getRegex(),hi={blockquote:ql,code:Hl,def:Vl,fences:Ul,heading:Bl,hr:zn,html:Kl,lheading:sa,list:Fl,newline:Zl,paragraph:ia,table:jn,text:Wl},ra=J("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",zn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$s).getRegex(),Jl={...hi,table:ra,paragraph:J(li).replace("hr",zn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ra).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$s).getRegex()},Ql={...hi,html:J(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",di).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:jn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:J(li).replace("hr",zn).replace("heading",` *#{1,6} *[^
|
|
229
|
+
]`).replace("lheading",sa).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},aa=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Yl=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,oa=/^( {2,}|\\)\n(?!\s*$)/,Gl=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Dn="\\p{P}\\p{S}",Xl=J(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Dn).getRegex(),ec=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,tc=J(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Dn).getRegex(),nc=J("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Dn).getRegex(),sc=J("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Dn).getRegex(),ic=J(/\\([punct])/,"gu").replace(/punct/g,Dn).getRegex(),rc=J(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ac=J(di).replace("(?:-->|$)","-->").getRegex(),oc=J("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",ac).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),As=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,lc=J(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",As).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),la=J(/^!?\[(label)\]\[(ref)\]/).replace("label",As).replace("ref",ci).getRegex(),ca=J(/^!?\[(ref)\](?:\[\])?/).replace("ref",ci).getRegex(),cc=J("reflink|nolink(?!\\()","g").replace("reflink",la).replace("nolink",ca).getRegex(),ui={_backpedal:jn,anyPunctuation:ic,autolink:rc,blockSkip:ec,br:oa,code:Yl,del:jn,emStrongLDelim:tc,emStrongRDelimAst:nc,emStrongRDelimUnd:sc,escape:aa,link:lc,nolink:ca,punctuation:Xl,reflink:la,reflinkSearch:cc,tag:oc,text:Gl,url:jn},dc={...ui,link:J(/^!?\[(label)\]\((.*?)\)/).replace("label",As).getRegex(),reflink:J(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",As).getRegex()},pi={...ui,escape:J(aa).replace("])","~|])").getRegex(),url:J(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},hc={...pi,br:J(oa).replace("{2,}","*").getRegex(),text:J(pi.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ts={normal:hi,gfm:Jl,pedantic:Ql},Ln={normal:ui,gfm:pi,breaks:hc,pedantic:dc};class Pe{constructor(e){Y(this,"tokens"),Y(this,"options"),Y(this,"state"),Y(this,"tokenizer"),Y(this,"inlineQueue"),this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Rt,this.options.tokenizer=this.options.tokenizer||new ks,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:Ts.normal,inline:Ln.normal};this.options.pedantic?(t.block=Ts.pedantic,t.inline=Ln.pedantic):this.options.gfm&&(t.block=Ts.gfm,this.options.breaks?t.inline=Ln.breaks:t.inline=Ln.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ts,inline:Ln}}static lex(e,t){return new Pe(t).lex(e)}static lexInline(e,t){return new Pe(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
|
|
230
|
+
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){this.options.pedantic?e=e.replace(/\t/g," ").replace(/^ +$/gm,""):e=e.replace(/^( *)(\t+)/gm,(o,l,d)=>l+" ".repeat(d.length));let n,i,r,a;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(o=>(n=o.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length),n.raw.length===1&&t.length>0?t[t.length-1].raw+=`
|
|
231
|
+
`:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
|
|
232
|
+
`+n.raw,i.text+=`
|
|
233
|
+
`+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
|
|
234
|
+
`+n.raw,i.text+=`
|
|
235
|
+
`+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(r=e,this.options.extensions&&this.options.extensions.startBlock){let o=1/0;const l=e.slice(1);let d;this.options.extensions.startBlock.forEach(u=>{d=u.call({lexer:this},l),typeof d=="number"&&d>=0&&(o=Math.min(o,d))}),o<1/0&&o>=0&&(r=e.substring(0,o+1))}if(this.state.top&&(n=this.tokenizer.paragraph(r))){i=t[t.length-1],a&&i.type==="paragraph"?(i.raw+=`
|
|
236
|
+
`+n.raw,i.text+=`
|
|
237
|
+
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n),a=r.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&i.type==="text"?(i.raw+=`
|
|
238
|
+
`+n.raw,i.text+=`
|
|
239
|
+
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);continue}if(e){const o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,i,r,a=e,o,l,d;if(this.tokens.links){const u=Object.keys(this.tokens.links);if(u.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)u.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(a))!=null;)a=a.slice(0,o.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(l||(d=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(u=>(n=u.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length),i=t[t.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,a,d)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}if(r=e,this.options.extensions&&this.options.extensions.startInline){let u=1/0;const h=e.slice(1);let c;this.options.extensions.startInline.forEach(f=>{c=f.call({lexer:this},h),typeof c=="number"&&c>=0&&(u=Math.min(u,c))}),u<1/0&&u>=0&&(r=e.substring(0,u+1))}if(n=this.tokenizer.inlineText(r)){e=e.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(d=n.raw.slice(-1)),l=!0,i=t[t.length-1],i&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(e){const u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return t}}class Zn{constructor(e){Y(this,"options"),this.options=e||Rt}code(e,t,n){var i;const r=(i=(t||"").match(/^\S*/))==null?void 0:i[0];return e=e.replace(/\n$/,"")+`
|
|
240
240
|
`,r?'<pre><code class="language-'+ke(r)+'">'+(n?e:ke(e,!0))+`</code></pre>
|
|
241
241
|
`:"<pre><code>"+(n?e:ke(e,!0))+`</code></pre>
|
|
242
242
|
`}blockquote(e){return`<blockquote>
|
|
243
243
|
${e}</blockquote>
|
|
244
244
|
`}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>
|
|
245
245
|
`}hr(){return`<hr>
|
|
246
|
-
`}list(e,t,n){const
|
|
247
|
-
`+e+"</"+
|
|
246
|
+
`}list(e,t,n){const i=t?"ol":"ul",r=t&&n!==1?' start="'+n+'"':"";return"<"+i+r+`>
|
|
247
|
+
`+e+"</"+i+`>
|
|
248
248
|
`}listitem(e,t,n){return`<li>${e}</li>
|
|
249
249
|
`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>
|
|
250
250
|
`}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),`<table>
|
|
@@ -254,13 +254,13 @@ ${e}</blockquote>
|
|
|
254
254
|
`}tablerow(e){return`<tr>
|
|
255
255
|
${e}</tr>
|
|
256
256
|
`}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
257
|
-
`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){const
|
|
258
|
-
`+(a.tokens?this.parseInline(a.tokens):a.text);n+=t?this.renderer.paragraph(o):o;continue}default:{const a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let
|
|
259
|
-
Please report this to https://github.com/markedjs/marked.`,
|
|
257
|
+
`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){const i=Xr(e);if(i===null)return n;e=i;let r='<a href="'+e+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>",r}image(e,t,n){const i=Xr(e);if(i===null)return n;e=i;let r=`<img src="${e}" alt="${n}"`;return t&&(r+=` title="${t}"`),r+=">",r}text(e){return e}}class fi{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class je{constructor(e){Y(this,"options"),Y(this,"renderer"),Y(this,"textRenderer"),this.options=e||Rt,this.options.renderer=this.options.renderer||new Zn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new fi}static parse(e,t){return new je(t).parse(e)}static parseInline(e,t){return new je(t).parseInline(e)}parse(e,t=!0){let n="";for(let i=0;i<e.length;i++){const r=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const a=r,o=this.options.extensions.renderers[a.type].call({parser:this},a);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(a.type)){n+=o||"";continue}}switch(r.type){case"space":continue;case"hr":{n+=this.renderer.hr();continue}case"heading":{const a=r;n+=this.renderer.heading(this.parseInline(a.tokens),a.depth,jl(this.parseInline(a.tokens,this.textRenderer)));continue}case"code":{const a=r;n+=this.renderer.code(a.text,a.lang,!!a.escaped);continue}case"table":{const a=r;let o="",l="";for(let u=0;u<a.header.length;u++)l+=this.renderer.tablecell(this.parseInline(a.header[u].tokens),{header:!0,align:a.align[u]});o+=this.renderer.tablerow(l);let d="";for(let u=0;u<a.rows.length;u++){const h=a.rows[u];l="";for(let c=0;c<h.length;c++)l+=this.renderer.tablecell(this.parseInline(h[c].tokens),{header:!1,align:a.align[c]});d+=this.renderer.tablerow(l)}n+=this.renderer.table(o,d);continue}case"blockquote":{const a=r,o=this.parse(a.tokens);n+=this.renderer.blockquote(o);continue}case"list":{const a=r,o=a.ordered,l=a.start,d=a.loose;let u="";for(let h=0;h<a.items.length;h++){const c=a.items[h],f=c.checked,A=c.task;let V="";if(c.task){const ae=this.renderer.checkbox(!!f);d?c.tokens.length>0&&c.tokens[0].type==="paragraph"?(c.tokens[0].text=ae+" "+c.tokens[0].text,c.tokens[0].tokens&&c.tokens[0].tokens.length>0&&c.tokens[0].tokens[0].type==="text"&&(c.tokens[0].tokens[0].text=ae+" "+c.tokens[0].tokens[0].text)):c.tokens.unshift({type:"text",text:ae+" "}):V+=ae+" "}V+=this.parse(c.tokens,d),u+=this.renderer.listitem(V,A,!!f)}n+=this.renderer.list(u,o,l);continue}case"html":{const a=r;n+=this.renderer.html(a.text,a.block);continue}case"paragraph":{const a=r;n+=this.renderer.paragraph(this.parseInline(a.tokens));continue}case"text":{let a=r,o=a.tokens?this.parseInline(a.tokens):a.text;for(;i+1<e.length&&e[i+1].type==="text";)a=e[++i],o+=`
|
|
258
|
+
`+(a.tokens?this.parseInline(a.tokens):a.text);n+=t?this.renderer.paragraph(o):o;continue}default:{const a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let i=0;i<e.length;i++){const r=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const a=this.options.extensions.renderers[r.type].call({parser:this},r);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){n+=a||"";continue}}switch(r.type){case"escape":{const a=r;n+=t.text(a.text);break}case"html":{const a=r;n+=t.html(a.text);break}case"link":{const a=r;n+=t.link(a.href,a.title,this.parseInline(a.tokens,t));break}case"image":{const a=r;n+=t.image(a.href,a.title,a.text);break}case"strong":{const a=r;n+=t.strong(this.parseInline(a.tokens,t));break}case"em":{const a=r;n+=t.em(this.parseInline(a.tokens,t));break}case"codespan":{const a=r;n+=t.codespan(a.text);break}case"br":{n+=t.br();break}case"del":{const a=r;n+=t.del(this.parseInline(a.tokens,t));break}case"text":{const a=r;n+=t.text(a.text);break}default:{const a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}}class Hn{constructor(e){Y(this,"options"),this.options=e||Rt}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}Y(Hn,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));var Ss,gi,mi,da;class ha{constructor(...e){Ci(this,Ss),Ci(this,mi),Y(this,"defaults",oi()),Y(this,"options",this.setOptions),Y(this,"parse",js(this,Ss,gi).call(this,Pe.lex,je.parse)),Y(this,"parseInline",js(this,Ss,gi).call(this,Pe.lexInline,je.parseInline)),Y(this,"Parser",je),Y(this,"Renderer",Zn),Y(this,"TextRenderer",fi),Y(this,"Lexer",Pe),Y(this,"Tokenizer",ks),Y(this,"Hooks",Hn),this.use(...e)}walkTokens(e,t){var n,i;let r=[];for(const a of e)switch(r=r.concat(t.call(this,a)),a.type){case"table":{const o=a;for(const l of o.header)r=r.concat(this.walkTokens(l.tokens,t));for(const l of o.rows)for(const d of l)r=r.concat(this.walkTokens(d.tokens,t));break}case"list":{const o=a;r=r.concat(this.walkTokens(o.items,t));break}default:{const o=a;(i=(n=this.defaults.extensions)==null?void 0:n.childTokens)!=null&&i[o.type]?this.defaults.extensions.childTokens[o.type].forEach(l=>{const d=o[l].flat(1/0);r=r.concat(this.walkTokens(d,t))}):o.tokens&&(r=r.concat(this.walkTokens(o.tokens,t)))}}return r}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){const a=t.renderers[r.name];a?t.renderers[r.name]=function(...o){let l=r.renderer.apply(this,o);return l===!1&&(l=a.apply(this,o)),l}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const a=t[r.level];a?a.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),i.extensions=t),n.renderer){const r=this.defaults.renderer||new Zn(this.defaults);for(const a in n.renderer){if(!(a in r))throw new Error(`renderer '${a}' does not exist`);if(a==="options")continue;const o=a,l=n.renderer[o],d=r[o];r[o]=(...u)=>{let h=l.apply(r,u);return h===!1&&(h=d.apply(r,u)),h||""}}i.renderer=r}if(n.tokenizer){const r=this.defaults.tokenizer||new ks(this.defaults);for(const a in n.tokenizer){if(!(a in r))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;const o=a,l=n.tokenizer[o],d=r[o];r[o]=(...u)=>{let h=l.apply(r,u);return h===!1&&(h=d.apply(r,u)),h}}i.tokenizer=r}if(n.hooks){const r=this.defaults.hooks||new Hn;for(const a in n.hooks){if(!(a in r))throw new Error(`hook '${a}' does not exist`);if(a==="options")continue;const o=a,l=n.hooks[o],d=r[o];Hn.passThroughHooks.has(a)?r[o]=u=>{if(this.defaults.async)return Promise.resolve(l.call(r,u)).then(c=>d.call(r,c));const h=l.call(r,u);return d.call(r,h)}:r[o]=(...u)=>{let h=l.apply(r,u);return h===!1&&(h=d.apply(r,u)),h}}i.hooks=r}if(n.walkTokens){const r=this.defaults.walkTokens,a=n.walkTokens;i.walkTokens=function(o){let l=[];return l.push(a.call(this,o)),r&&(l=l.concat(r.call(this,o))),l}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Pe.lex(e,t??this.defaults)}parser(e,t){return je.parse(e,t??this.defaults)}}Ss=new WeakSet,gi=function(s,e){return(t,n)=>{const i={...n},r={...this.defaults,...i};this.defaults.async===!0&&i.async===!1&&(r.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),r.async=!0);const a=js(this,mi,da).call(this,!!r.silent,!!r.async);if(typeof t>"u"||t===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(r.hooks&&(r.hooks.options=r),r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(t):t).then(o=>s(o,r)).then(o=>r.hooks?r.hooks.processAllTokens(o):o).then(o=>r.walkTokens?Promise.all(this.walkTokens(o,r.walkTokens)).then(()=>o):o).then(o=>e(o,r)).then(o=>r.hooks?r.hooks.postprocess(o):o).catch(a);try{r.hooks&&(t=r.hooks.preprocess(t));let o=s(t,r);r.hooks&&(o=r.hooks.processAllTokens(o)),r.walkTokens&&this.walkTokens(o,r.walkTokens);let l=e(o,r);return r.hooks&&(l=r.hooks.postprocess(l)),l}catch(o){return a(o)}}},mi=new WeakSet,da=function(s,e){return t=>{if(t.message+=`
|
|
259
|
+
Please report this to https://github.com/markedjs/marked.`,s){const n="<p>An error occurred:</p><pre>"+ke(t.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}};const Pt=new ha;function Q(s,e){return Pt.parse(s,e)}Q.options=Q.setOptions=function(s){return Pt.setOptions(s),Q.defaults=Pt.defaults,Jr(Q.defaults),Q},Q.getDefaults=oi,Q.defaults=Rt,Q.use=function(...s){return Pt.use(...s),Q.defaults=Pt.defaults,Jr(Q.defaults),Q},Q.walkTokens=function(s,e){return Pt.walkTokens(s,e)},Q.parseInline=Pt.parseInline,Q.Parser=je,Q.parser=je.parse,Q.Renderer=Zn,Q.TextRenderer=fi,Q.Lexer=Pe,Q.lexer=Pe.lex,Q.Tokenizer=ks,Q.Hooks=Hn,Q.parse=Q,Q.options,Q.setOptions,Q.use,Q.walkTokens,Q.parseInline,je.parse,Pe.lex;const yi=new Zn;yi.link=(s,e,t)=>{const n=document.createElement("a");return n.setAttribute("href",s),n.setAttribute("target","_blank"),n.setAttribute("rel","noopener nofollow"),n.textContent=t,e&&n.setAttribute("title",e),n.outerHTML};const uc=new ha({renderer:yi});function pc(s){const e=fc(s);return uc.parse(e,{renderer:yi})}function vi(s){const e=pc(s);return U`
|
|
260
260
|
<div class="flex flex-col gap-3">
|
|
261
261
|
${Il(e)}
|
|
262
262
|
</div>
|
|
263
|
-
`}function fc(
|
|
263
|
+
`}function fc(s){const e={"&":"&","<":"<",">":">",'"':""","'":"'"};return s.replace(/[&<>"']/g,t=>e[t])}var gc=Object.defineProperty,mc=Object.getOwnPropertyDescriptor,Ae=(s,e,t,n)=>{for(var i=n>1?void 0:n?mc(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&gc(e,t,i),i},ua=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},Xt=(s,e,t)=>(ua(s,e,"read from private field"),t?t.call(s):e.get(s)),pa=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},fa=(s,e,t,n)=>(ua(s,e,"write to private field"),n?n.call(s,t):e.set(s,t),t),at,Es;let _e=class extends xe{constructor(){super(),pa(this,at,void 0),pa(this,Es,Promise.resolve()),this.disableInput=!1,this.showTyping=!1,this.messages=[],this.inputValue="",this.internalDisableInput=!1,this.internalShowTyping=!1,this.showPopoverDisclaimer=!1,this._emitter=Sl(),this._emitter.on("*",(s,e)=>this.dispatchEvent(new CustomEvent(`iai-chat-${s.toString()}`,{bubbles:!0,composed:!0,detail:e})))}connectedCallback(){super.connectedCallback(),this.cleanOptions=ws.parse(this.options||{});const{assistantId:s,params:e,config:t}=this.cleanOptions;this.checkIfDisclaimerShouldBeShown(),fa(this,at,new Al(s,{params:e,simulateDelays:t.simulateDelays,historyKey:t.historyKey,initialReplyMessage:t.initialReplyMessage,resetEndedChatOnLoad:t.resetEndedChatOnLoad})),this.updateMessages(Xt(this,at).messages),this.showTyping=Xt(this,at).isTyping,this.disableInput=Xt(this,at).inputDisabled,this.chatManager.on("functionCall",({id:n,name:i,params:r})=>{const a=this.cleanOptions.handlers.functionCalls[i];if(!a){console.warn(`No function call handler found for ${i}`);return}a.call(this,{id:n,params:r,html:U,chatWindow:this})}),this.chatManager.on("typing",n=>{this.showTyping=n}),this.chatManager.on("inputDisabled",n=>{this.disableInput=n}),this.chatManager.on("inactivityWarning",()=>{this.addMessage({role:"assistant",content:t.inactivityWarningMessage})}),this.chatManager.on("chatEnded",()=>{this.addMessage({role:"system",content:t.chatEndedMessage}),this.setInputDisabled(!0)}),this.chatManager.on("message",n=>{this.updateMessages([...this.messages,n])}),this.chatManager.on("messageRemoved",n=>{this.updateMessages(this.messages.filter(i=>i.id!==n))}),this.chatManager.on("reset",()=>{this.updateMessages([]),this.checkIfDisclaimerShouldBeShown()}),this.chatManager.on("*",this._emitter.emit)}disconnectedCallback(){super.disconnectedCallback(),this._emitter.all.clear(),Xt(this,at).destroy()}firstUpdated(){this.focusOnInput()}updateMessages(s){this.messages=[...s],this.scrollChatToBottom()}render(){const{chatWindow:s,disclaimerMessage:e,disclaimerPopover:t}=this.cleanOptions.config,{header:n,showCloseButton:i}=s;return U`
|
|
264
264
|
<div class="relative flex flex-col h-full rounded-lg shadow-lg bg-white text-black">
|
|
265
265
|
<div class="header rounded-t-lg text-lg p-2 flex justify-between items-center h-12">
|
|
266
266
|
<div class="flex flex-row h-full items-center">
|
|
@@ -281,7 +281,7 @@ Please report this to https://github.com/markedjs/marked.`,i){const n="<p>An err
|
|
|
281
281
|
${Ol}
|
|
282
282
|
</button>
|
|
283
283
|
|
|
284
|
-
${Fe(
|
|
284
|
+
${Fe(i,()=>U`
|
|
285
285
|
<button class="mr-2 h-6 w-6" @click="${this.closeChat}">
|
|
286
286
|
${Pn}
|
|
287
287
|
</button>
|
|
@@ -291,7 +291,7 @@ Please report this to https://github.com/markedjs/marked.`,i){const n="<p>An err
|
|
|
291
291
|
${Fe(this.showPopoverDisclaimer,()=>U`
|
|
292
292
|
<div class="absolute top-12 left-0 right-0 bottom-0 bg-white z-10 flex flex-col gap-2 rounded-b-lg">
|
|
293
293
|
<div class="flex-grow overflow-y-auto pt-4 px-4 relative">
|
|
294
|
-
${
|
|
294
|
+
${vi(t.message)}
|
|
295
295
|
|
|
296
296
|
<div class="sticky bottom-[-1px] left-0 right-0 h-12 bg-gradient-to-t from-white to-transparent"></div>
|
|
297
297
|
</div>
|
|
@@ -310,7 +310,7 @@ Please report this to https://github.com/markedjs/marked.`,i){const n="<p>An err
|
|
|
310
310
|
<div id="chat-container" class="flex-1 overflow-y-auto p-4 flex flex-col gap-2">
|
|
311
311
|
${this.chatMessage({id:"intro-message",role:"assistant",content:this.cleanOptions.config.welcomeMessage})}
|
|
312
312
|
|
|
313
|
-
${
|
|
313
|
+
${Cr(this.messages,r=>r.id,(r,a)=>U`
|
|
314
314
|
<div>
|
|
315
315
|
${this.nameLabel(a)}
|
|
316
316
|
${this.chatMessage(r)}
|
|
@@ -342,7 +342,7 @@ Please report this to https://github.com/markedjs/marked.`,i){const n="<p>An err
|
|
|
342
342
|
class="button rounded-lg p-2 disabled:opacity-50 h-9 w-9"
|
|
343
343
|
.disabled="${this.isSubmitDisabled}"
|
|
344
344
|
>
|
|
345
|
-
${
|
|
345
|
+
${Cl}
|
|
346
346
|
</button>
|
|
347
347
|
</div>
|
|
348
348
|
</form>
|
|
@@ -352,27 +352,27 @@ Please report this to https://github.com/markedjs/marked.`,i){const n="<p>An err
|
|
|
352
352
|
</p>
|
|
353
353
|
</div>
|
|
354
354
|
</div>
|
|
355
|
-
`}get isSubmitDisabled(){return!this.inputValue||this.internalDisableInput||this.disableInput}handleKeyDown(
|
|
355
|
+
`}get isSubmitDisabled(){return!this.inputValue||this.internalDisableInput||this.disableInput}handleKeyDown(s){s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),!this.isSubmitDisabled&&this.sendUserMessage(s))}checkIfDisclaimerShouldBeShown(){const{config:s}=this.cleanOptions,e=localStorage.getItem(`iaiChatWindow-${s.historyKey}-acceptedDisclaimerTime`);this.showPopoverDisclaimer=!!(s.disclaimerPopover.message&&(!e||qr().diff(e,"minutes")>=s.disclaimerPopover.rememberDurationMinutes))}acceptDisclaimer(){localStorage.setItem(`iaiChatWindow-${this.cleanOptions.config.historyKey}-acceptedDisclaimerTime`,qr().toISOString()),this.showPopoverDisclaimer=!1}handleInput(){const{inputElement:s,chatContainer:e}=this;if(!s||!e)return;this.inputValue=s.value;const{scrollTop:t,clientHeight:n,scrollHeight:i}=e,r=t+n>=i;s.style.height="auto",s.style.height=`${s.scrollHeight+2}px`,r&&this.scrollChatToBottom()}get chatManager(){return Xt(this,at)}resetChat(){this.chatManager.reset("Manually reset by user")}addMessage(s){return this.chatManager.addMessage(s)}removeMessage(s){this.chatManager.removeMessage(s)}setInputDisabled(s=!0){this.chatManager.setInputDisabled(s)}setTypingIndicatorVisible(s=!0){this.chatManager.setTyping(s)}async sendFunctionCallResponse(s,e,t=!1){try{await this.chatManager.respondToFunctionCall(s,e,t)}catch(n){console.error("sendFunctionCallResponse error",n),this.addMessage({role:"assistant",content:"An unexpected error occurred. Please try again later."})}}async sendUserMessage(s){s.preventDefault(),!(this.internalDisableInput||this.disableInput)&&(this.internalDisableInput=!0,this.dispatchEvent(new CustomEvent("iai-chat-send-user-message",{bubbles:!0,composed:!0,detail:{message:this.inputValue},cancelable:!0}))&&(await Xt(this,Es),fa(this,Es,this.chatManager.sendUserMessage(this.inputValue))),this.inputValue="",this.inputElement&&(this.inputElement.style.height="auto"),this.internalDisableInput=!1,setTimeout(()=>{this.focusOnInput()},0))}focusOnInput(){var s;(s=this.inputElement)==null||s.focus()}scrollChatToBottom(){const{chatContainer:s}=this;s==null||s.scrollTo({top:s==null?void 0:s.scrollHeight,behavior:"smooth"})}nameLabel(s){const e=this.messages[s];if(e.role!=="assistant")return null;const t=e.name||"Assistant",n=this.messages[s-1];return((n==null?void 0:n.name)||"Assistant")===t?null:U`
|
|
356
356
|
<div class="name text-sm">${e.name||"Assistant"}</div>
|
|
357
|
-
`}chatMessage(
|
|
357
|
+
`}chatMessage(s){switch(s.role){case"assistant":return U`
|
|
358
358
|
<iai-chat-message-assistant
|
|
359
|
-
id="message-${
|
|
360
|
-
.content="${
|
|
359
|
+
id="message-${s.id}"
|
|
360
|
+
.content="${s.content}"
|
|
361
361
|
></iai-chat-message-assistant>
|
|
362
362
|
`;case"user":return U`
|
|
363
363
|
<iai-chat-message-user
|
|
364
|
-
id="message-${
|
|
365
|
-
.content="${
|
|
364
|
+
id="message-${s.id}"
|
|
365
|
+
.content="${s.content}"
|
|
366
366
|
></iai-chat-message-user>
|
|
367
367
|
`;case"system":return U`
|
|
368
368
|
<iai-chat-message-system
|
|
369
|
-
id="message-${
|
|
370
|
-
.content="${
|
|
371
|
-
.enhancedContent="${
|
|
372
|
-
.contentHtmlTemplate="${
|
|
369
|
+
id="message-${s.id}"
|
|
370
|
+
.content="${s.content}"
|
|
371
|
+
.enhancedContent="${s.enhancedContent}"
|
|
372
|
+
.contentHtmlTemplate="${s.contentHtmlTemplate}"
|
|
373
373
|
.options="${this.cleanOptions}"
|
|
374
374
|
></iai-chat-message-system>
|
|
375
|
-
`;default:return""}}closeChat(){this._emitter.emit("close")}};at=new WeakMap,
|
|
375
|
+
`;default:return""}}closeChat(){this._emitter.emit("close")}};at=new WeakMap,Es=new WeakMap,_e.styles=[Be,pt`
|
|
376
376
|
.header {
|
|
377
377
|
background-color: var(--iai-chat-i-header-bg);
|
|
378
378
|
color: var(--iai-chat-i-header-fg);
|
|
@@ -387,7 +387,7 @@ Please report this to https://github.com/markedjs/marked.`,i){const n="<p>An err
|
|
|
387
387
|
.name {
|
|
388
388
|
color: #8c8c8c;
|
|
389
389
|
}
|
|
390
|
-
`],Ae([ne({type:Object})],_e.prototype,"options",2),Ae([ne()],_e.prototype,"disableInput",2),Ae([ne()],_e.prototype,"showTyping",2),Ae([wt()],_e.prototype,"messages",2),Ae([wt()],_e.prototype,"inputValue",2),Ae([wt()],_e.prototype,"internalDisableInput",2),Ae([wt()],_e.prototype,"internalShowTyping",2),Ae([wt()],_e.prototype,"showPopoverDisclaimer",2),Ae([ni("#chat-container")],_e.prototype,"chatContainer",2),Ae([ni("#message-input")],_e.prototype,"inputElement",2),Ae([es.debounce(1)],_e.prototype,"scrollChatToBottom",1),_e=Ae([He("iai-chat")],_e);var ma={exports:{}};(function(i){(function(e){if(typeof window>"u")return;var t=0,n=!1,s=!1,r="message",a=r.length,o="[iFrameSizer]",l=o.length,d=null,u=window.requestAnimationFrame,h=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),c={},f=null,A=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){be("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}});function V(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function ae(p,x,Z){p.addEventListener(x,Z,!1)}function ze(p,x,Z){p.removeEventListener(x,Z,!1)}function nn(){var p=["moz","webkit","o","ms"],x;for(x=0;x<p.length&&!u;x+=1)u=window[p[x]+"RequestAnimationFrame"];u?u=u.bind(window):z("setup","RequestAnimationFrame not supported")}function lt(p){var x="Host page: "+p;return window.top!==window.self&&(x=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+p:"Nested host page: "+p),x}function sn(p){return o+"["+lt(p)+"]"}function Te(p){return c[p]?c[p].log:n}function z(p,x){ct("log",p,x,Te(p))}function Fn(p,x){ct("info",p,x,Te(p))}function be(p,x){ct("warn",p,x,!0)}function ct(p,x,Z,C){C===!0&&typeof window.console=="object"&&console[p](sn(x),Z)}function oe(p){function x(){function k(){v(F),w(N),Ht("onResized",F)}q("Height"),q("Width"),R(k,F,"init")}function Z(){var k=Me.slice(l).split(":"),D=k[1]?parseInt(k[1],10):0,G=c[k[0]]&&c[k[0]].iframe,X=getComputedStyle(G);return{iframe:G,id:k[0],height:D+C(X)+H(X),width:k[2],type:k[3]}}function C(k){if(k.boxSizing!=="border-box")return 0;var D=k.paddingTop?parseInt(k.paddingTop,10):0,G=k.paddingBottom?parseInt(k.paddingBottom,10):0;return D+G}function H(k){if(k.boxSizing!=="border-box")return 0;var D=k.borderTopWidth?parseInt(k.borderTopWidth,10):0,G=k.borderBottomWidth?parseInt(k.borderBottomWidth,10):0;return D+G}function q(k){var D=Number(c[N]["max"+k]),G=Number(c[N]["min"+k]),X=k.toLowerCase(),fe=Number(F[X]);z(N,"Checking "+X+" is in range "+G+"-"+D),fe<G&&(fe=G,z(N,"Set "+X+" to min value")),fe>D&&(fe=D,z(N,"Set "+X+" to max value")),F[X]=""+fe}function Ze(){function k(){function X(){var we=0,Ge=!1;for(z(N,"Checking connection is from allowed list of origins: "+G);we<G.length;we++)if(G[we]===D){Ge=!0;break}return Ge}function fe(){var we=c[N]&&c[N].remoteHost;return z(N,"Checking connection is from: "+we),D===we}return G.constructor===Array?X():fe()}var D=p.origin,G=c[N]&&c[N].checkOrigin;if(G&&""+D!="null"&&!k())throw new Error("Unexpected message received from: "+D+" for "+F.iframe.id+". Message was: "+p.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}function Zt(){return o===(""+Me).slice(0,l)&&Me.slice(l).split(":")[0]in c}function Qe(){var k=F.type in{true:1,false:1,undefined:1};return k&&z(N,"Ignoring init message from meta parent page"),k}function Ye(k){return Me.slice(Me.indexOf(":")+a+k)}function ht(k){z(N,"onMessage passed: {iframe: "+F.iframe.id+", message: "+k+"}"),Ht("onMessage",{iframe:F.iframe,message:JSON.parse(k)}),z(N,"--")}function ws(){var k=document.body.getBoundingClientRect(),D=F.iframe.getBoundingClientRect();return JSON.stringify({iframeHeight:D.height,iframeWidth:D.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(D.top-k.top,10),offsetLeft:parseInt(D.left-k.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})}function Ri(k,D){function G(){S("Send Page Info","pageInfo:"+ws(),k,D)}dt(G,32,D)}function _s(){function k(fe,we){function Ge(){c[X]?Ri(c[X].iframe,X):D()}["scroll","resize"].forEach(function(_a){z(X,fe+_a+" listener for sendPageInfo"),we(window,_a,Ge)})}function D(){k("Remove ",ze)}function G(){k("Add ",ae)}var X=N;G(),c[X]&&(c[X].stopPageInfo=D)}function xs(){c[N]&&c[N].stopPageInfo&&(c[N].stopPageInfo(),delete c[N].stopPageInfo)}function ks(){var k=!0;return F.iframe===null&&(be(N,"IFrame ("+F.id+") not found"),k=!1),k}function E(k){var D=k.getBoundingClientRect();return M(N),{x:Math.floor(Number(D.left)+Number(d.x)),y:Math.floor(Number(D.top)+Number(d.y))}}function O(k){function D(){d=we,ce(),z(N,"--")}function G(){return{x:Number(F.width)+fe.x,y:Number(F.height)+fe.y}}function X(){window.parentIFrame?window.parentIFrame["scrollTo"+(k?"Offset":"")](we.x,we.y):be(N,"Unable to scroll to requested position, window.parentIFrame not found")}var fe=k?E(F.iframe):{x:0,y:0},we=G();z(N,"Reposition requested from iFrame (offset x:"+fe.x+" y:"+fe.y+")"),window.top===window.self?D():X()}function ce(){Ht("onScroll",d)===!1?g():w(N)}function ye(k){function D(){var Ge=E(we);z(N,"Moving to in page link (#"+X+") at x: "+Ge.x+" y: "+Ge.y),d={x:Ge.x,y:Ge.y},ce(),z(N,"--")}function G(){window.parentIFrame?window.parentIFrame.moveToAnchor(X):z(N,"In page link #"+X+" not found and window.parentIFrame not found")}var X=k.split("#")[1]||"",fe=decodeURIComponent(X),we=document.getElementById(fe)||document.getElementsByName(fe)[0];we?D():window.top===window.self?z(N,"In page link #"+X+" not found"):G()}function Ie(k){var D={};if(Number(F.width)===0&&Number(F.height)===0){var G=Ye(9).split(":");D={x:G[1],y:G[0]}}else D={x:F.width,y:F.height};Ht(k,{iframe:F.iframe,screenX:Number(D.x),screenY:Number(D.y),type:F.type})}function Ht(k,D){return W(N,k,D)}function $s(){switch(c[N]&&c[N].firstRun&&Ss(),F.type){case"close":{rn(F.iframe);break}case"message":{ht(Ye(6));break}case"mouseenter":{Ie("onMouseEnter");break}case"mouseleave":{Ie("onMouseLeave");break}case"autoResize":{c[N].autoResize=JSON.parse(Ye(9));break}case"scrollTo":{O(!1);break}case"scrollToOffset":{O(!0);break}case"pageInfo":{Ri(c[N]&&c[N].iframe,N),_s();break}case"pageInfoStop":{xs();break}case"inPageLink":{ye(Ye(9));break}case"reset":{$(F);break}case"init":{x(),Ht("onInit",F.iframe);break}default:Number(F.width)===0&&Number(F.height)===0?be("Unsupported message received ("+F.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):x()}}function As(k){var D=!0;return c[k]||(D=!1,be(F.type+" No settings for "+k+". Message was: "+Me)),D}function Ts(){for(var k in c)S("iFrame requested init",K(k),c[k].iframe,k)}function Ss(){c[N]&&(c[N].firstRun=!1)}var Me=p.data,F={},N=null;Me==="[iFrameResizerChild]Ready"?Ts():Zt()?(F=Z(),N=F.id,c[N]&&(c[N].loaded=!0),!Qe()&&As(N)&&(z(N,"Received: "+Me),ks()&&Ze()&&$s())):Fn(N,"Ignored: "+Me)}function W(p,x,Z){var C=null,H=null;if(c[p])if(C=c[p][x],typeof C=="function")H=C(Z);else throw new TypeError(x+" on iFrame["+p+"] is not a function");return H}function Dt(p){var x=p.id;delete c[x]}function rn(p){var x=p.id;if(W(x,"onClose",x)===!1){z(x,"Close iframe cancelled by onClose event");return}z(x,"Removing iFrame: "+x);try{p.parentNode&&p.parentNode.removeChild(p)}catch(Z){be(Z)}W(x,"onClosed",x),z(x,"--"),Dt(p)}function M(p){d===null&&(d={x:window.pageXOffset===e?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===e?document.documentElement.scrollTop:window.pageYOffset},z(p,"Get page position: "+d.x+","+d.y))}function w(p){d!==null&&(window.scrollTo(d.x,d.y),z(p,"Set page position: "+d.x+","+d.y),g())}function g(){d=null}function $(p){function x(){v(p),S("reset","reset",p.iframe,p.id)}z(p.id,"Size reset requested by "+(p.type==="init"?"host page":"iFrame")),M(p.id),R(x,p,"reset")}function v(p){function x(q){if(!p.id){z("undefined","messageData id not set");return}p.iframe.style[q]=p[q]+"px",z(p.id,"IFrame ("+H+") "+q+" set to "+p[q]+"px")}function Z(q){!s&&p[q]==="0"&&(s=!0,z(H,"Hidden iFrame detected, creating visibility listener"),qe())}function C(q){x(q),Z(q)}var H=p.iframe.id;c[H]&&(c[H].sizeHeight&&C("height"),c[H].sizeWidth&&C("width"))}function R(p,x,Z){Z!==x.type&&u&&!window.jasmine?(z(x.id,"Requesting animation frame"),u(p)):p()}function S(p,x,Z,C,H){function q(){var ht=c[C]&&c[C].targetOrigin;z(C,"["+p+"] Sending msg to iframe["+C+"] ("+x+") targetOrigin: "+ht),Z.contentWindow.postMessage(o+x,ht)}function Ze(){be(C,"["+p+"] IFrame("+C+") not found")}function Zt(){Z&&"contentWindow"in Z&&Z.contentWindow!==null?q():Ze()}function Qe(){function ht(){c[C]&&!c[C].loaded&&!Ye&&(Ye=!0,be(C,"IFrame has not responded within "+c[C].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))}H&&c[C]&&c[C].warningTimeout&&(c[C].msgTimeout=setTimeout(ht,c[C].warningTimeout))}var Ye=!1;C=C||Z.id,c[C]&&(Zt(),Qe())}function K(p){return p+":"+c[p].bodyMarginV1+":"+c[p].sizeWidth+":"+c[p].log+":"+c[p].interval+":"+c[p].enablePublicMethods+":"+c[p].autoResize+":"+c[p].bodyMargin+":"+c[p].heightCalculationMethod+":"+c[p].bodyBackground+":"+c[p].bodyPadding+":"+c[p].tolerance+":"+c[p].inPageLinks+":"+c[p].resizeFrom+":"+c[p].widthCalculationMethod+":"+c[p].mouseEvents}function te(p){return typeof p=="number"}function ie(p,x){function Z(){function O(ye){var Ie=c[E][ye];Ie!==1/0&&Ie!==0&&(p.style[ye]=te(Ie)?Ie+"px":Ie,z(E,"Set "+ye+" = "+p.style[ye]))}function ce(ye){if(c[E]["min"+ye]>c[E]["max"+ye])throw new Error("Value for min"+ye+" can not be greater than max"+ye)}ce("Height"),ce("Width"),O("maxHeight"),O("minHeight"),O("maxWidth"),O("minWidth")}function C(){var O=x&&x.id||A.id+t++;return document.getElementById(O)!==null&&(O+=t++),O}function H(O){if(typeof O!="string")throw new TypeError("Invaild id for iFrame. Expected String");return O===""&&(p.id=O=C(),n=(x||{}).log,z(O,"Added missing iframe ID: "+O+" ("+p.src+")")),O}function q(){switch(z(E,"IFrame scrolling "+(c[E]&&c[E].scrolling?"enabled":"disabled")+" for "+E),p.style.overflow=(c[E]&&c[E].scrolling)===!1?"hidden":"auto",c[E]&&c[E].scrolling){case"omit":break;case!0:{p.scrolling="yes";break}case!1:{p.scrolling="no";break}default:p.scrolling=c[E]?c[E].scrolling:"no"}}function Ze(){(typeof(c[E]&&c[E].bodyMargin)=="number"||(c[E]&&c[E].bodyMargin)==="0")&&(c[E].bodyMarginV1=c[E].bodyMargin,c[E].bodyMargin=""+c[E].bodyMargin+"px")}function Zt(){var O=c[E]&&c[E].firstRun,ce=c[E]&&c[E].heightCalculationMethod in h;!O&&ce&&$({iframe:p,height:0,width:0,type:"init"})}function Qe(){c[E]&&(c[E].iframe.iFrameResizer={close:rn.bind(null,c[E].iframe),removeListeners:Dt.bind(null,c[E].iframe),resize:S.bind(null,"Window resize","resize",c[E].iframe),moveToAnchor:function(O){S("Move to anchor","moveToAnchor:"+O,c[E].iframe,E)},sendMessage:function(O){O=JSON.stringify(O),S("Send Message","message:"+O,c[E].iframe,E)}})}function Ye(O){function ce(){S("iFrame.onload",O,p,e,!0),Zt()}function ye(Ht){if(p.parentNode){var $s=new Ht(function(As){As.forEach(function(Ts){var Ss=Array.prototype.slice.call(Ts.removedNodes);Ss.forEach(function(Me){Me===p&&rn(p)})})});$s.observe(p.parentNode,{childList:!0})}}var Ie=V();Ie&&ye(Ie),ae(p,"load",ce),S("init",O,p,e,!0)}function ht(O){if(typeof O!="object")throw new TypeError("Options is not an object")}function ws(O){for(var ce in A)Object.prototype.hasOwnProperty.call(A,ce)&&(c[E][ce]=Object.prototype.hasOwnProperty.call(O,ce)?O[ce]:A[ce])}function Ri(O){return O===""||O.match(/^(about:blank|javascript:|file:\/\/)/)!==null?"*":O}function _s(O){var ce=O.split("Callback");if(ce.length===2){var ye="on"+ce[0].charAt(0).toUpperCase()+ce[0].slice(1);this[ye]=this[O],delete this[O],be(E,"Deprecated: '"+O+"' has been renamed '"+ye+"'. The old method will be removed in the next major version.")}}function xs(O){O=O||{},c[E]=Object.create(null),c[E].iframe=p,c[E].firstRun=!0,c[E].remoteHost=p.src&&p.src.split("/").slice(0,3).join("/"),ht(O),Object.keys(O).forEach(_s,O),ws(O),c[E]&&(c[E].targetOrigin=c[E].checkOrigin===!0?Ri(c[E].remoteHost):"*")}function ks(){return E in c&&"iFrameResizer"in p}var E=H(p.id);ks()?be(E,"Ignored iFrame, already setup."):(xs(x),q(),Z(),Ze(),Ye(K(E)),Qe())}function le(p,x){f===null&&(f=setTimeout(function(){f=null,p()},x))}var ge={};function dt(p,x,Z){ge[Z]||(ge[Z]=setTimeout(function(){ge[Z]=null,p()},x))}function qe(){function p(){function H(q){function Ze(Qe){return(c[q]&&c[q].iframe.style[Qe])==="0px"}function Zt(Qe){return Qe.offsetParent!==null}c[q]&&Zt(c[q].iframe)&&(Ze("height")||Ze("width"))&&S("Visibility change","resize",c[q].iframe,q)}Object.keys(c).forEach(function(q){H(q)})}function x(H){z("window","Mutation observed: "+H[0].target+" "+H[0].type),le(p,16)}function Z(){var H=document.querySelector("body"),q={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0},Ze=new C(x);Ze.observe(H,q)}var C=V();C&&Z()}function Lt(p){function x(){pe("Window "+p,"resize")}z("window","Trigger event: "+p),le(x,16)}function De(){function p(){pe("Tab Visible","resize")}document.visibilityState!=="hidden"&&(z("document","Trigger event: Visibility change"),le(p,16))}function pe(p,x){function Z(C){return c[C]&&c[C].resizeFrom==="parent"&&c[C].autoResize&&!c[C].firstRun}Object.keys(c).forEach(function(C){Z(C)&&S(p,x,c[C].iframe,C)})}function Le(){ae(window,"message",oe),ae(window,"resize",function(){Lt("resize")}),ae(document,"visibilitychange",De),ae(document,"-webkit-visibilitychange",De)}function Je(){function p(C,H){function q(){if(H.tagName){if(H.tagName.toUpperCase()!=="IFRAME")throw new TypeError("Expected <IFRAME> tag, found <"+H.tagName+">")}else throw new TypeError("Object is not a valid DOM element")}H&&(q(),ie(H,C),Z.push(H))}function x(C){C&&C.enablePublicMethods&&be("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}var Z;return nn(),Le(),function(C,H){switch(Z=[],x(C),typeof H){case"undefined":case"string":{Array.prototype.forEach.call(document.querySelectorAll(H||"iframe"),p.bind(e,C));break}case"object":{p(C,H);break}default:throw new TypeError("Unexpected data type ("+typeof H+")")}return Z}}function an(p){p.fn?p.fn.iFrameResize||(p.fn.iFrameResize=function(x){function Z(C,H){ie(H,x)}return this.filter("iframe").each(Z).end()}):Fn("","Unable to bind to jQuery, it is not fully loaded.")}window.jQuery!==e&&an(window.jQuery),typeof e=="function"&&e.amd?e([],Je):i.exports=Je(),window.iFrameResize=window.iFrameResize||Je()})()})(ma);var yc=ma.exports;const vc=jr(yc);var bc=Object.defineProperty,wc=Object.getOwnPropertyDescriptor,bs=(i,e,t,n)=>{for(var s=n>1?void 0:n?wc(e,t):e,r=i.length-1,a;r>=0;r--)(a=i[r])&&(s=(n?a(e,t,s):a(s))||s);return n&&s&&bc(e,t,s),s};let Un=class extends xe{constructor(){super(...arguments),this.src="",this.showCloseButton=!1}async onLoad(i){vc({log:!1,heightCalculationMethod:"max",onMessage:({message:e})=>{this.dispatchEvent(new CustomEvent("message-received",{bubbles:!0,composed:!0,detail:e}))}},i.target)}close(){this.dispatchEvent(new CustomEvent("close"))}render(){return U`
|
|
390
|
+
`],Ae([ne({type:Object})],_e.prototype,"options",2),Ae([ne()],_e.prototype,"disableInput",2),Ae([ne()],_e.prototype,"showTyping",2),Ae([wt()],_e.prototype,"messages",2),Ae([wt()],_e.prototype,"inputValue",2),Ae([wt()],_e.prototype,"internalDisableInput",2),Ae([wt()],_e.prototype,"internalShowTyping",2),Ae([wt()],_e.prototype,"showPopoverDisclaimer",2),Ae([ns("#chat-container")],_e.prototype,"chatContainer",2),Ae([ns("#message-input")],_e.prototype,"inputElement",2),Ae([ei.debounce(1)],_e.prototype,"scrollChatToBottom",1),_e=Ae([He("iai-chat")],_e);var ga={exports:{}};(function(s){(function(e){if(typeof window>"u")return;var t=0,n=!1,i=!1,r="message",a=r.length,o="[iFrameSizer]",l=o.length,d=null,u=window.requestAnimationFrame,h=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),c={},f=null,A=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){be("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}});function V(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function ae(p,x,Z){p.addEventListener(x,Z,!1)}function ze(p,x,Z){p.removeEventListener(x,Z,!1)}function nn(){var p=["moz","webkit","o","ms"],x;for(x=0;x<p.length&&!u;x+=1)u=window[p[x]+"RequestAnimationFrame"];u?u=u.bind(window):z("setup","RequestAnimationFrame not supported")}function lt(p){var x="Host page: "+p;return window.top!==window.self&&(x=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+p:"Nested host page: "+p),x}function sn(p){return o+"["+lt(p)+"]"}function Te(p){return c[p]?c[p].log:n}function z(p,x){ct("log",p,x,Te(p))}function Fn(p,x){ct("info",p,x,Te(p))}function be(p,x){ct("warn",p,x,!0)}function ct(p,x,Z,E){E===!0&&typeof window.console=="object"&&console[p](sn(x),Z)}function oe(p){function x(){function k(){v(F),w(N),Ht("onResized",F)}q("Height"),q("Width"),R(k,F,"init")}function Z(){var k=Me.slice(l).split(":"),D=k[1]?parseInt(k[1],10):0,G=c[k[0]]&&c[k[0]].iframe,X=getComputedStyle(G);return{iframe:G,id:k[0],height:D+E(X)+H(X),width:k[2],type:k[3]}}function E(k){if(k.boxSizing!=="border-box")return 0;var D=k.paddingTop?parseInt(k.paddingTop,10):0,G=k.paddingBottom?parseInt(k.paddingBottom,10):0;return D+G}function H(k){if(k.boxSizing!=="border-box")return 0;var D=k.borderTopWidth?parseInt(k.borderTopWidth,10):0,G=k.borderBottomWidth?parseInt(k.borderBottomWidth,10):0;return D+G}function q(k){var D=Number(c[N]["max"+k]),G=Number(c[N]["min"+k]),X=k.toLowerCase(),fe=Number(F[X]);z(N,"Checking "+X+" is in range "+G+"-"+D),fe<G&&(fe=G,z(N,"Set "+X+" to min value")),fe>D&&(fe=D,z(N,"Set "+X+" to max value")),F[X]=""+fe}function Ze(){function k(){function X(){var we=0,Ge=!1;for(z(N,"Checking connection is from allowed list of origins: "+G);we<G.length;we++)if(G[we]===D){Ge=!0;break}return Ge}function fe(){var we=c[N]&&c[N].remoteHost;return z(N,"Checking connection is from: "+we),D===we}return G.constructor===Array?X():fe()}var D=p.origin,G=c[N]&&c[N].checkOrigin;if(G&&""+D!="null"&&!k())throw new Error("Unexpected message received from: "+D+" for "+F.iframe.id+". Message was: "+p.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}function Zt(){return o===(""+Me).slice(0,l)&&Me.slice(l).split(":")[0]in c}function Qe(){var k=F.type in{true:1,false:1,undefined:1};return k&&z(N,"Ignoring init message from meta parent page"),k}function Ye(k){return Me.slice(Me.indexOf(":")+a+k)}function ht(k){z(N,"onMessage passed: {iframe: "+F.iframe.id+", message: "+k+"}"),Ht("onMessage",{iframe:F.iframe,message:JSON.parse(k)}),z(N,"--")}function wi(){var k=document.body.getBoundingClientRect(),D=F.iframe.getBoundingClientRect();return JSON.stringify({iframeHeight:D.height,iframeWidth:D.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(D.top-k.top,10),offsetLeft:parseInt(D.left-k.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})}function Rs(k,D){function G(){S("Send Page Info","pageInfo:"+wi(),k,D)}dt(G,32,D)}function _i(){function k(fe,we){function Ge(){c[X]?Rs(c[X].iframe,X):D()}["scroll","resize"].forEach(function(_a){z(X,fe+_a+" listener for sendPageInfo"),we(window,_a,Ge)})}function D(){k("Remove ",ze)}function G(){k("Add ",ae)}var X=N;G(),c[X]&&(c[X].stopPageInfo=D)}function xi(){c[N]&&c[N].stopPageInfo&&(c[N].stopPageInfo(),delete c[N].stopPageInfo)}function ki(){var k=!0;return F.iframe===null&&(be(N,"IFrame ("+F.id+") not found"),k=!1),k}function C(k){var D=k.getBoundingClientRect();return M(N),{x:Math.floor(Number(D.left)+Number(d.x)),y:Math.floor(Number(D.top)+Number(d.y))}}function O(k){function D(){d=we,ce(),z(N,"--")}function G(){return{x:Number(F.width)+fe.x,y:Number(F.height)+fe.y}}function X(){window.parentIFrame?window.parentIFrame["scrollTo"+(k?"Offset":"")](we.x,we.y):be(N,"Unable to scroll to requested position, window.parentIFrame not found")}var fe=k?C(F.iframe):{x:0,y:0},we=G();z(N,"Reposition requested from iFrame (offset x:"+fe.x+" y:"+fe.y+")"),window.top===window.self?D():X()}function ce(){Ht("onScroll",d)===!1?m():w(N)}function ye(k){function D(){var Ge=C(we);z(N,"Moving to in page link (#"+X+") at x: "+Ge.x+" y: "+Ge.y),d={x:Ge.x,y:Ge.y},ce(),z(N,"--")}function G(){window.parentIFrame?window.parentIFrame.moveToAnchor(X):z(N,"In page link #"+X+" not found and window.parentIFrame not found")}var X=k.split("#")[1]||"",fe=decodeURIComponent(X),we=document.getElementById(fe)||document.getElementsByName(fe)[0];we?D():window.top===window.self?z(N,"In page link #"+X+" not found"):G()}function Ie(k){var D={};if(Number(F.width)===0&&Number(F.height)===0){var G=Ye(9).split(":");D={x:G[1],y:G[0]}}else D={x:F.width,y:F.height};Ht(k,{iframe:F.iframe,screenX:Number(D.x),screenY:Number(D.y),type:F.type})}function Ht(k,D){return W(N,k,D)}function $i(){switch(c[N]&&c[N].firstRun&&Si(),F.type){case"close":{rn(F.iframe);break}case"message":{ht(Ye(6));break}case"mouseenter":{Ie("onMouseEnter");break}case"mouseleave":{Ie("onMouseLeave");break}case"autoResize":{c[N].autoResize=JSON.parse(Ye(9));break}case"scrollTo":{O(!1);break}case"scrollToOffset":{O(!0);break}case"pageInfo":{Rs(c[N]&&c[N].iframe,N),_i();break}case"pageInfoStop":{xi();break}case"inPageLink":{ye(Ye(9));break}case"reset":{$(F);break}case"init":{x(),Ht("onInit",F.iframe);break}default:Number(F.width)===0&&Number(F.height)===0?be("Unsupported message received ("+F.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):x()}}function Ai(k){var D=!0;return c[k]||(D=!1,be(F.type+" No settings for "+k+". Message was: "+Me)),D}function Ti(){for(var k in c)S("iFrame requested init",K(k),c[k].iframe,k)}function Si(){c[N]&&(c[N].firstRun=!1)}var Me=p.data,F={},N=null;Me==="[iFrameResizerChild]Ready"?Ti():Zt()?(F=Z(),N=F.id,c[N]&&(c[N].loaded=!0),!Qe()&&Ai(N)&&(z(N,"Received: "+Me),ki()&&Ze()&&$i())):Fn(N,"Ignored: "+Me)}function W(p,x,Z){var E=null,H=null;if(c[p])if(E=c[p][x],typeof E=="function")H=E(Z);else throw new TypeError(x+" on iFrame["+p+"] is not a function");return H}function Dt(p){var x=p.id;delete c[x]}function rn(p){var x=p.id;if(W(x,"onClose",x)===!1){z(x,"Close iframe cancelled by onClose event");return}z(x,"Removing iFrame: "+x);try{p.parentNode&&p.parentNode.removeChild(p)}catch(Z){be(Z)}W(x,"onClosed",x),z(x,"--"),Dt(p)}function M(p){d===null&&(d={x:window.pageXOffset===e?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===e?document.documentElement.scrollTop:window.pageYOffset},z(p,"Get page position: "+d.x+","+d.y))}function w(p){d!==null&&(window.scrollTo(d.x,d.y),z(p,"Set page position: "+d.x+","+d.y),m())}function m(){d=null}function $(p){function x(){v(p),S("reset","reset",p.iframe,p.id)}z(p.id,"Size reset requested by "+(p.type==="init"?"host page":"iFrame")),M(p.id),R(x,p,"reset")}function v(p){function x(q){if(!p.id){z("undefined","messageData id not set");return}p.iframe.style[q]=p[q]+"px",z(p.id,"IFrame ("+H+") "+q+" set to "+p[q]+"px")}function Z(q){!i&&p[q]==="0"&&(i=!0,z(H,"Hidden iFrame detected, creating visibility listener"),qe())}function E(q){x(q),Z(q)}var H=p.iframe.id;c[H]&&(c[H].sizeHeight&&E("height"),c[H].sizeWidth&&E("width"))}function R(p,x,Z){Z!==x.type&&u&&!window.jasmine?(z(x.id,"Requesting animation frame"),u(p)):p()}function S(p,x,Z,E,H){function q(){var ht=c[E]&&c[E].targetOrigin;z(E,"["+p+"] Sending msg to iframe["+E+"] ("+x+") targetOrigin: "+ht),Z.contentWindow.postMessage(o+x,ht)}function Ze(){be(E,"["+p+"] IFrame("+E+") not found")}function Zt(){Z&&"contentWindow"in Z&&Z.contentWindow!==null?q():Ze()}function Qe(){function ht(){c[E]&&!c[E].loaded&&!Ye&&(Ye=!0,be(E,"IFrame has not responded within "+c[E].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))}H&&c[E]&&c[E].warningTimeout&&(c[E].msgTimeout=setTimeout(ht,c[E].warningTimeout))}var Ye=!1;E=E||Z.id,c[E]&&(Zt(),Qe())}function K(p){return p+":"+c[p].bodyMarginV1+":"+c[p].sizeWidth+":"+c[p].log+":"+c[p].interval+":"+c[p].enablePublicMethods+":"+c[p].autoResize+":"+c[p].bodyMargin+":"+c[p].heightCalculationMethod+":"+c[p].bodyBackground+":"+c[p].bodyPadding+":"+c[p].tolerance+":"+c[p].inPageLinks+":"+c[p].resizeFrom+":"+c[p].widthCalculationMethod+":"+c[p].mouseEvents}function te(p){return typeof p=="number"}function se(p,x){function Z(){function O(ye){var Ie=c[C][ye];Ie!==1/0&&Ie!==0&&(p.style[ye]=te(Ie)?Ie+"px":Ie,z(C,"Set "+ye+" = "+p.style[ye]))}function ce(ye){if(c[C]["min"+ye]>c[C]["max"+ye])throw new Error("Value for min"+ye+" can not be greater than max"+ye)}ce("Height"),ce("Width"),O("maxHeight"),O("minHeight"),O("maxWidth"),O("minWidth")}function E(){var O=x&&x.id||A.id+t++;return document.getElementById(O)!==null&&(O+=t++),O}function H(O){if(typeof O!="string")throw new TypeError("Invaild id for iFrame. Expected String");return O===""&&(p.id=O=E(),n=(x||{}).log,z(O,"Added missing iframe ID: "+O+" ("+p.src+")")),O}function q(){switch(z(C,"IFrame scrolling "+(c[C]&&c[C].scrolling?"enabled":"disabled")+" for "+C),p.style.overflow=(c[C]&&c[C].scrolling)===!1?"hidden":"auto",c[C]&&c[C].scrolling){case"omit":break;case!0:{p.scrolling="yes";break}case!1:{p.scrolling="no";break}default:p.scrolling=c[C]?c[C].scrolling:"no"}}function Ze(){(typeof(c[C]&&c[C].bodyMargin)=="number"||(c[C]&&c[C].bodyMargin)==="0")&&(c[C].bodyMarginV1=c[C].bodyMargin,c[C].bodyMargin=""+c[C].bodyMargin+"px")}function Zt(){var O=c[C]&&c[C].firstRun,ce=c[C]&&c[C].heightCalculationMethod in h;!O&&ce&&$({iframe:p,height:0,width:0,type:"init"})}function Qe(){c[C]&&(c[C].iframe.iFrameResizer={close:rn.bind(null,c[C].iframe),removeListeners:Dt.bind(null,c[C].iframe),resize:S.bind(null,"Window resize","resize",c[C].iframe),moveToAnchor:function(O){S("Move to anchor","moveToAnchor:"+O,c[C].iframe,C)},sendMessage:function(O){O=JSON.stringify(O),S("Send Message","message:"+O,c[C].iframe,C)}})}function Ye(O){function ce(){S("iFrame.onload",O,p,e,!0),Zt()}function ye(Ht){if(p.parentNode){var $i=new Ht(function(Ai){Ai.forEach(function(Ti){var Si=Array.prototype.slice.call(Ti.removedNodes);Si.forEach(function(Me){Me===p&&rn(p)})})});$i.observe(p.parentNode,{childList:!0})}}var Ie=V();Ie&&ye(Ie),ae(p,"load",ce),S("init",O,p,e,!0)}function ht(O){if(typeof O!="object")throw new TypeError("Options is not an object")}function wi(O){for(var ce in A)Object.prototype.hasOwnProperty.call(A,ce)&&(c[C][ce]=Object.prototype.hasOwnProperty.call(O,ce)?O[ce]:A[ce])}function Rs(O){return O===""||O.match(/^(about:blank|javascript:|file:\/\/)/)!==null?"*":O}function _i(O){var ce=O.split("Callback");if(ce.length===2){var ye="on"+ce[0].charAt(0).toUpperCase()+ce[0].slice(1);this[ye]=this[O],delete this[O],be(C,"Deprecated: '"+O+"' has been renamed '"+ye+"'. The old method will be removed in the next major version.")}}function xi(O){O=O||{},c[C]=Object.create(null),c[C].iframe=p,c[C].firstRun=!0,c[C].remoteHost=p.src&&p.src.split("/").slice(0,3).join("/"),ht(O),Object.keys(O).forEach(_i,O),wi(O),c[C]&&(c[C].targetOrigin=c[C].checkOrigin===!0?Rs(c[C].remoteHost):"*")}function ki(){return C in c&&"iFrameResizer"in p}var C=H(p.id);ki()?be(C,"Ignored iFrame, already setup."):(xi(x),q(),Z(),Ze(),Ye(K(C)),Qe())}function le(p,x){f===null&&(f=setTimeout(function(){f=null,p()},x))}var me={};function dt(p,x,Z){me[Z]||(me[Z]=setTimeout(function(){me[Z]=null,p()},x))}function qe(){function p(){function H(q){function Ze(Qe){return(c[q]&&c[q].iframe.style[Qe])==="0px"}function Zt(Qe){return Qe.offsetParent!==null}c[q]&&Zt(c[q].iframe)&&(Ze("height")||Ze("width"))&&S("Visibility change","resize",c[q].iframe,q)}Object.keys(c).forEach(function(q){H(q)})}function x(H){z("window","Mutation observed: "+H[0].target+" "+H[0].type),le(p,16)}function Z(){var H=document.querySelector("body"),q={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0},Ze=new E(x);Ze.observe(H,q)}var E=V();E&&Z()}function Lt(p){function x(){pe("Window "+p,"resize")}z("window","Trigger event: "+p),le(x,16)}function De(){function p(){pe("Tab Visible","resize")}document.visibilityState!=="hidden"&&(z("document","Trigger event: Visibility change"),le(p,16))}function pe(p,x){function Z(E){return c[E]&&c[E].resizeFrom==="parent"&&c[E].autoResize&&!c[E].firstRun}Object.keys(c).forEach(function(E){Z(E)&&S(p,x,c[E].iframe,E)})}function Le(){ae(window,"message",oe),ae(window,"resize",function(){Lt("resize")}),ae(document,"visibilitychange",De),ae(document,"-webkit-visibilitychange",De)}function Je(){function p(E,H){function q(){if(H.tagName){if(H.tagName.toUpperCase()!=="IFRAME")throw new TypeError("Expected <IFRAME> tag, found <"+H.tagName+">")}else throw new TypeError("Object is not a valid DOM element")}H&&(q(),se(H,E),Z.push(H))}function x(E){E&&E.enablePublicMethods&&be("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}var Z;return nn(),Le(),function(E,H){switch(Z=[],x(E),typeof H){case"undefined":case"string":{Array.prototype.forEach.call(document.querySelectorAll(H||"iframe"),p.bind(e,E));break}case"object":{p(E,H);break}default:throw new TypeError("Unexpected data type ("+typeof H+")")}return Z}}function an(p){p.fn?p.fn.iFrameResize||(p.fn.iFrameResize=function(x){function Z(E,H){se(H,x)}return this.filter("iframe").each(Z).end()}):Fn("","Unable to bind to jQuery, it is not fully loaded.")}window.jQuery!==e&&an(window.jQuery),typeof e=="function"&&e.amd?e([],Je):s.exports=Je(),window.iFrameResize=window.iFrameResize||Je()})()})(ga);var yc=ga.exports;const vc=jr(yc);var bc=Object.defineProperty,wc=Object.getOwnPropertyDescriptor,bi=(s,e,t,n)=>{for(var i=n>1?void 0:n?wc(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&bc(e,t,i),i};let Un=class extends xe{constructor(){super(...arguments),this.src="",this.showCloseButton=!1}async onLoad(s){vc({log:!1,heightCalculationMethod:"max",onMessage:({message:e})=>{this.dispatchEvent(new CustomEvent("message-received",{bubbles:!0,composed:!0,detail:e}))}},s.target)}close(){this.dispatchEvent(new CustomEvent("close"))}render(){return U`
|
|
391
391
|
<div class="relative">
|
|
392
392
|
${Fe(this.showCloseButton,()=>U`
|
|
393
393
|
<button class="absolute top-0 right-0 m-2 h-6 text-white focus:outline-none" @click="${this.close}">
|
|
@@ -401,11 +401,11 @@ Please report this to https://github.com/markedjs/marked.`,i){const n="<p>An err
|
|
|
401
401
|
@load=${this.onLoad}
|
|
402
402
|
></iframe>
|
|
403
403
|
</div>
|
|
404
|
-
`}};Un.styles=[Be],
|
|
404
|
+
`}};Un.styles=[Be],bi([ne({type:String})],Un.prototype,"src",2),bi([ne({type:Boolean})],Un.prototype,"showCloseButton",2),Un=bi([He("iai-chat-iframe")],Un);var _c=Object.defineProperty,xc=Object.getOwnPropertyDescriptor,en=(s,e,t,n)=>{for(var i=n>1?void 0:n?xc(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&_c(e,t,i),i};let ot=class extends xe{constructor(){super(...arguments),this.title="",this.src="",this.width="500px",this.height=null,this.showHeader=!0}async connectedCallback(){super.connectedCallback()}close(){this.dispatchEvent(new CustomEvent("close"))}render(){const s=Et({width:this.width,height:this.height});return U`
|
|
405
405
|
<div class="fixed inset-0 z-50 bg-black bg-opacity-50 flex justify-center items-center">
|
|
406
406
|
<div
|
|
407
407
|
class="flex flex-col rounded-lg shadow-lg bg-white mx-auto my-auto max-h-[90vh] max-w-[90vw] overflow-hidden"
|
|
408
|
-
style=${
|
|
408
|
+
style=${s}
|
|
409
409
|
part="modal"
|
|
410
410
|
>
|
|
411
411
|
${Fe(this.showHeader,()=>U`
|
|
@@ -435,37 +435,37 @@ Please report this to https://github.com/markedjs/marked.`,i){const n="<p>An err
|
|
|
435
435
|
color: var(--iai-chat-i-iframe-modal-header-fg);
|
|
436
436
|
height: 50px;
|
|
437
437
|
}
|
|
438
|
-
`],en([ne({type:String})],ot.prototype,"title",2),en([ne({type:String})],ot.prototype,"src",2),en([ne({type:String})],ot.prototype,"width",2),en([ne({type:String})],ot.prototype,"height",2),en([ne({type:Boolean})],ot.prototype,"showHeader",2),ot=en([He("iai-chat-iframe-modal")],ot);var kc=Object.defineProperty,$c=Object.getOwnPropertyDescriptor,
|
|
438
|
+
`],en([ne({type:String})],ot.prototype,"title",2),en([ne({type:String})],ot.prototype,"src",2),en([ne({type:String})],ot.prototype,"width",2),en([ne({type:String})],ot.prototype,"height",2),en([ne({type:Boolean})],ot.prototype,"showHeader",2),ot=en([He("iai-chat-iframe-modal")],ot);var kc=Object.defineProperty,$c=Object.getOwnPropertyDescriptor,ma=(s,e,t,n)=>{for(var i=n>1?void 0:n?$c(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&kc(e,t,i),i};let Cs=class extends xe{constructor(){super(...arguments),this.content=""}render(){return U`
|
|
439
439
|
<div class="flex items-end mr-20">
|
|
440
440
|
<div class="message rounded-lg px-4 py-2">
|
|
441
|
-
${
|
|
441
|
+
${vi(this.content)}
|
|
442
442
|
</div>
|
|
443
443
|
</div>
|
|
444
|
-
`}};
|
|
444
|
+
`}};Cs.styles=[Be,pt`
|
|
445
445
|
.message {
|
|
446
446
|
background-color: var(--iai-chat-i-message-assistant-bg);
|
|
447
447
|
color: var(--iai-chat-i-message-assistant-fg);
|
|
448
448
|
}
|
|
449
|
-
`],
|
|
449
|
+
`],ma([ne({type:String})],Cs.prototype,"content",2),Cs=ma([He("iai-chat-message-assistant")],Cs);async function Ac(s,e){const{type:t,params:n}=s,i=e[t];if(!i)throw new Error(`No handler for enhanced content type ${t}`);return i({params:n,html:U})}var Tc=Object.defineProperty,Sc=Object.getOwnPropertyDescriptor,Bn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Sc(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Tc(e,t,i),i};let jt=class extends xe{constructor(){super(...arguments),this.content=""}async connectedCallback(){if(super.connectedCallback(),this.enhancedContent)try{this.contentHtmlTemplate=await Ac(this.enhancedContent,this.options.handlers.enhancedContent)}catch(s){console.warn("Error processing enhanced content",s)}this.contentHtmlTemplate||(this.contentHtmlTemplate=U`
|
|
450
450
|
<div class="text-center text-gray-400 text-sm">
|
|
451
|
-
${
|
|
451
|
+
${vi(this.content)}
|
|
452
452
|
</div>
|
|
453
453
|
`)}render(){return U`
|
|
454
454
|
<div>
|
|
455
455
|
${this.contentHtmlTemplate}
|
|
456
456
|
</div>
|
|
457
|
-
`}};jt.styles=[Be],Bn([ne({type:Object})],jt.prototype,"options",2),Bn([ne({type:String})],jt.prototype,"content",2),Bn([ne({type:Object})],jt.prototype,"enhancedContent",2),Bn([ne()],jt.prototype,"contentHtmlTemplate",2),jt=Bn([He("iai-chat-message-system")],jt);var
|
|
457
|
+
`}};jt.styles=[Be],Bn([ne({type:Object})],jt.prototype,"options",2),Bn([ne({type:String})],jt.prototype,"content",2),Bn([ne({type:Object})],jt.prototype,"enhancedContent",2),Bn([ne()],jt.prototype,"contentHtmlTemplate",2),jt=Bn([He("iai-chat-message-system")],jt);var Ec=Object.defineProperty,Cc=Object.getOwnPropertyDescriptor,ya=(s,e,t,n)=>{for(var i=n>1?void 0:n?Cc(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Ec(e,t,i),i};let Os=class extends xe{constructor(){super(...arguments),this.content=""}render(){return U`
|
|
458
458
|
<div class="flex items-end justify-end ml-20">
|
|
459
459
|
<div class="message rounded-lg px-4 py-2 flex gap-2">
|
|
460
460
|
<p class="whitespace-pre-wrap">${this.content}</p>
|
|
461
461
|
</div>
|
|
462
462
|
</div>
|
|
463
|
-
`}};
|
|
463
|
+
`}};Os.styles=[Be,pt`
|
|
464
464
|
.message {
|
|
465
465
|
background-color: var(--iai-chat-i-message-user-bg);
|
|
466
466
|
color: var(--iai-chat-i-message-user-fg);
|
|
467
467
|
}
|
|
468
|
-
`],ya([ne({type:String})],
|
|
468
|
+
`],ya([ne({type:String})],Os.prototype,"content",2),Os=ya([He("iai-chat-message-user")],Os);var Oc=Object.defineProperty,Ic=Object.getOwnPropertyDescriptor,Is=(s,e,t,n)=>{for(var i=n>1?void 0:n?Ic(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Oc(e,t,i),i};let tn=class extends xe{constructor(){super(...arguments),this.isChatWindowOpen=!1,this.isCtaOpen=!0}render(){const{openChatButton:{width:s,height:e,imageSrc:t,cta:n},placement:i}=this.options.config,r=Et({alignItems:i!=="left"?"end":"start"}),a=Et({width:s,height:e});return U`
|
|
469
469
|
<div class="flex flex-col gap-4" style=${r}>
|
|
470
470
|
${Fe(n&&this.isCtaOpen&&!this.isChatWindowOpen,()=>U`
|
|
471
471
|
<div class="relative rounded-lg p-5 shadow-md bg-white" style="max-width: 350px;">
|
|
@@ -478,7 +478,7 @@ Please report this to https://github.com/markedjs/marked.`,i){const n="<p>An err
|
|
|
478
478
|
|
|
479
479
|
<div
|
|
480
480
|
class="absolute bottom-0 mx-4 mb-[-8px] w-0 h-0 border-x-8 border-t-8 border-x-transparent border-white"
|
|
481
|
-
style=${
|
|
481
|
+
style=${Et({[i]:0})}
|
|
482
482
|
/>
|
|
483
483
|
</div>
|
|
484
484
|
`)}
|
|
@@ -487,7 +487,7 @@ Please report this to https://github.com/markedjs/marked.`,i){const n="<p>An err
|
|
|
487
487
|
${Fe(t,()=>U`<img src="${t}" alt="Chat Icon" style=${a}/>`,()=>U`
|
|
488
488
|
<div class="button rounded-full flex items-center justify-center" style=${a}>
|
|
489
489
|
<div class="h-3/5 w-3/5">
|
|
490
|
-
${Fe(this.isChatWindowOpen,()=>Pn,()=>
|
|
490
|
+
${Fe(this.isChatWindowOpen,()=>Pn,()=>El)}
|
|
491
491
|
</div>
|
|
492
492
|
</div>
|
|
493
493
|
`)}
|
|
@@ -498,12 +498,12 @@ Please report this to https://github.com/markedjs/marked.`,i){const n="<p>An err
|
|
|
498
498
|
background-color: var(--iai-chat-i-ocb-bg);
|
|
499
499
|
color: var(--iai-chat-i-ocb-fg);
|
|
500
500
|
}
|
|
501
|
-
`],
|
|
501
|
+
`],Is([ne({type:Object})],tn.prototype,"options",2),Is([ne({type:Boolean})],tn.prototype,"isChatWindowOpen",2),Is([wt()],tn.prototype,"isCtaOpen",2),tn=Is([He("iai-chat-open-chat-button")],tn);function Mc(s){return s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function va(s,e=""){return Object.keys(s).reduce((t,n)=>{const i=Mc(n),r=e?`${e}-${i}`:i;return typeof s[n]=="object"&&s[n]!==null?Object.assign(t,va(s[n],r)):t[r]=s[n],t},{})}class Nc{constructor(e){this.widget=null,this.options=ws.parse(e);const t=document.createElement("iai-chat-popup");t.options=this.options;const n=va(this.options.config.styles);Object.entries(n).filter(([,i])=>i).forEach(([i,r])=>{t.style.setProperty(`--iai-chat-${i}`,r)}),document.body.appendChild(t),this.widget=t}get api(){if(!this.widget)throw new Error("Widget has not been initialized");return this.widget}destroy(){var e;(e=this.widget)==null||e.remove(),this.widget=null}}function Rc({html:s,params:e}){return s`
|
|
502
502
|
<div>
|
|
503
503
|
<h2>Unit List</h2>
|
|
504
504
|
|
|
505
505
|
<iai-chat-carousel>
|
|
506
|
-
${e.units.map(t=>
|
|
506
|
+
${e.units.map(t=>s`
|
|
507
507
|
<div>
|
|
508
508
|
<img src=${t.floorPlanImage} alt=${`Floor plan for unit ${t.unitName}`}>
|
|
509
509
|
<h2>Unit ${t.unitName}</h2>
|
|
@@ -516,7 +516,7 @@ Please report this to https://github.com/markedjs/marked.`,i){const n="<p>An err
|
|
|
516
516
|
</div>
|
|
517
517
|
`)}
|
|
518
518
|
</iai-chat-carousel>
|
|
519
|
-
`}function Pc(
|
|
519
|
+
`}function Pc(s){return async function({id:t,params:n,chatWindow:i}){i.setInputDisabled(!0);const r={...n.guestCardId&&{guestCardId:n.guestCardId},...n.customerFirstName&&{firstName:n.customerFirstName},...n.customerLastName&&{lastName:n.customerLastName},...n.customerEmail&&{email:n.customerEmail},...n.customerPhoneNumber&&{phone:n.customerPhoneNumber},...n.desiredMoveInDate&&{moveInDate:n.desiredMoveInDate}},a=document.createElement("iai-chat-iframe-modal");a.title="Schedule a Tour",a.src=`${s}?${new URLSearchParams(r).toString()}`,a.showHeader=!1;const o=()=>{a.remove(),window.removeEventListener("beforeunload",u),i.setInputDisabled(!1)},l=async({detail:h})=>{if(h.type!=="tourScheduled")return;const{tourType:c,tourDate:f,tourTime:A,guestCardId:V}=h;o(),i.addMessage({role:"system",content:"Your tour has been scheduled!"}),await i.sendFunctionCallResponse(t,{status:"scheduled",tourType:c,tourDate:f,tourTime:A,guestCardId:V},!0)},d=async()=>{o(),i.addMessage({role:"system",content:"Tour Scheduler Closed"}),await i.sendFunctionCallResponse(t,{status:"canceled"},!0)},u=async()=>{o(),i.addMessage({role:"system",content:"Tour Scheduler Closed"})};a.addEventListener("message-received",l),a.addEventListener("close",d),window.addEventListener("beforeunload",u),document.body.appendChild(a),i.addMessage({role:"system",content:"Tour Scheduler Opened"})}}function ba(s){return{all:s=s||new Map,on:function(e,t){var n=s.get(e);n?n.push(t):s.set(e,[t])},off:function(e,t){var n=s.get(e);n&&(t?n.splice(n.indexOf(t)>>>0,1):s.set(e,[]))},emit:function(e,t){var n=s.get(e);n&&n.slice().map(function(i){i(t)}),(n=s.get("*"))&&n.slice().map(function(i){i(e,t)})}}}class jc{constructor(e){this.chatWsUrl=e,this._emitter=ba(),this.on=this._emitter.on.bind(this._emitter),this.off=this._emitter.off.bind(this._emitter),this.reconnectCodes=new Set([1006]),this.reconnectAttempts=0,this.maxReconnectAttempts=10}connect(){const e=new WebSocket(this.chatWsUrl);e.onopen=async()=>{this.reconnectAttempts=0,e.send(JSON.stringify({type:"ready"}))},e.onmessage=t=>{const n=JSON.parse(t.data);this._emitter.emit(n.type,n.data)},e.onclose=t=>{console.log("Disconnected: ",t.code,t.reason||"No reason provided"),this._emitter.emit("disconnected",t),this.reconnectCodes.has(t.code)&&this.reconnectAttempts<this.maxReconnectAttempts&&(console.log("Reconnecting..."),this._emitter.emit("reconnecting"),this.reconnectAttempts++,setTimeout(()=>this.connect(),this.reconnectAttempts*1e3))},e.onerror=t=>{console.log("Error:",t),this._emitter.emit("error",t)},this.ws=e}reconnect(){this.reconnectAttempts=0,this.connect()}disconnect(){var e;(e=this.ws)==null||e.close()}destroy(){this.disconnect(),this._emitter.all.clear()}}var Ms;(s=>{(e=>{e.TEXT="TEXT"})(s.MessageType||(s.MessageType={})),(e=>{e.DELIVERED="DELIVERED",e.READ="READ",e.FAILED="FAILED"})(s.AcknowledgeType||(s.AcknowledgeType={})),(e=>{e.GENERIC="GENERIC",e.SMS="SMS",e.RCS="RCS",e.FACEBOOK="FACEBOOK",e.TWITTER="TWITTER",e.WHATSAPP="WHATSAPP",e.WECHAT="WECHAT",e.QQMOBILE="QQMOBILE",e.APPLE_BUSINESS_CHAT="APPLE_BUSINESS_CHAT",e.SKYPE="SKYPE",e.SNAPCHAT="SNAPCHAT",e.VIBER="VIBER",e.LINE="LINE",e.TELEGRAM="TELEGRAM",e.KAKAO="KAKAO"})(s.ContentType||(s.ContentType={})),(e=>{e.SYSTEM="SYSTEM",e.USER="USER"})(s.ConversationEventOrigin||(s.ConversationEventOrigin={})),(e=>{e.PENDING="PENDING",e.ACTIVE="ACTIVE",e.TERMINATED="TERMINATED"})(s.ConversationStatus||(s.ConversationStatus={}))})(Ms||(Ms={}));const zc=Ms.AcknowledgeType,Dc="Anyone Home",Lc="IB Chat Leasing - Development";let Zc="https://five9.ah.inhabit.work";const Hc="https://five9.ah.inhabit.work".replace("http","ws").replace(/\/$/,""),Vn=class Vn{constructor(){Ei(this,Ke,void 0);Ei(this,zt,void 0);this._emitter=ba(),this.on=this._emitter.on.bind(this._emitter),this.off=this._emitter.off.bind(this._emitter),ut(this,Ke,null),ut(this,zt,null),this.conversationStarted=!1}serialize(){return JSON.stringify({sessionToken:this.sessionToken,conversationId:this.conversationId,conversationStarted:this.conversationStarted})}static deserialize(e){const t=JSON.parse(e),n=new Vn;return t.sessionToken&&n.setSession(t.sessionToken),t.conversationId&&n.setConversationId(t.conversationId),n.conversationStarted=t.conversationStarted||!1,n}static generateBaseUrl(e){return`https://${e}/appsvcs/rs/svc`}async createSession(){const e=await fetch(`${Vn.generateBaseUrl("app-scl.five9.com")}/auth/anon?cookieless=true`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({tenantName:Dc})});return ut(this,Ke,await e.json()),Ps(this,Ke)}setSession(e){ut(this,Ke,e)}setConversationId(e){ut(this,zt,e),this.five9WebSocket&&(this.five9WebSocket.destroy(),this.five9WebSocket=void 0,e&&this.connectToWebSocket())}connect(){if(!this.sessionToken)throw new Error("Session not created");if(!this.conversationId)throw new Error("Conversation not started");this.connectToWebSocket()}connectToWebSocket(){if(!this.conversationId)throw new Error("Conversation not started");this.five9WebSocket&&this.five9WebSocket.destroy();const e=new jc(`${Hc}/conversations/${this.conversationId}/ws`);e.on("*",(t,n)=>{this._emitter.emit(t,n)}),e.on("conversationCreated",t=>{this.conversationStarted=!0,console.log("Conversation Created:",t)}),e.on("conversationAccepted",t=>{console.log("Conversation Accepted:",t)}),e.on("agentJoined",t=>{console.log("Agent Joined:",t)}),e.on("agentTransferredConversation",t=>{console.log("Agent Transferred Conversation:",t)}),e.on("conversationTransferredToGroup",t=>{console.log("Conversation Transferred To Group:",t)}),e.on("agentLeftConversation",t=>{console.log("Agent Left Conversation:",t)}),e.on("agentTyping",t=>{console.log("Agent Typing:",t)}),e.on("message",async t=>{console.log("Message:",t),await this.acknowledgeMessage({messages:[{messageId:t.messageId,type:zc.READ}]})}),e.on("conversationTerminated",t=>{console.log("Conversation Terminated:",t)}),e.on("error",t=>{console.log("Error:",t)}),this.five9WebSocket=e,e.connect()}async authenticatedFetch(e,t={}){const{sessionToken:n}=this;if(!n)throw new Error("Session not found");e=e.startsWith("/")?e:`/${e}`;const i=n.metadata.dataCenters[0].apiUrls[0].host,r=await fetch(`${Vn.generateBaseUrl(i)}${e}`,{...t,headers:{...t.headers,"Content-Type":"application/json",Accept:"application/json",Authorization:n.tokenId,farmId:n.context.farmId}});return r.status===204?null:r.json()}async getMetadata(){if(!this.sessionToken)throw new Error("Session not created");return this.authenticatedFetch("/auth/metadata",{method:"GET"})}async createConversation(e){if(!this.sessionToken)throw new Error("Session not created");const t=e.contact||{};Object.keys(t).forEach(r=>{const a=r;t[a]||delete t[a]});const n={...e,campaignName:Lc,tenantId:this.tenantId,callbackUrl:Zc};console.log("body",n);const i=await this.authenticatedFetch("/conversations",{method:"POST",body:JSON.stringify(n)});return this.setConversationId(i.id),i}async sendMessage(e){const{conversationId:t,conversationStarted:n}=this;if(!t||!n)throw new Error("Conversation not started");const i={messageType:Ms.MessageType.TEXT,message:e};await this.authenticatedFetch(`/conversations/${t}/messages`,{method:"POST",body:JSON.stringify(i)})}async sendTyping(){const{conversationId:e}=this;if(!e)throw new Error("Conversation not started");await this.authenticatedFetch(`/conversations/${e}/messages/typing`,{method:"PUT"})}async acknowledgeMessage(e){const{conversationId:t}=this;if(!t)throw new Error("Conversation not started");await this.authenticatedFetch(`/conversations/${t}/messages/acknowledge`,{method:"PUT",body:JSON.stringify(e)})}async terminateConversation(){const{conversationId:e}=this;if(!e)throw new Error("Conversation not started");await this.authenticatedFetch(`/conversations/${e}/terminate`,{method:"POST"}),this.destroy()}destroy(){this.five9WebSocket&&this.five9WebSocket.destroy(),ut(this,Ke,null),ut(this,zt,null)}get sessionToken(){return Ps(this,Ke)}get conversationId(){return Ps(this,zt)}get dataCenter(){var e;return(e=this.sessionToken)==null?void 0:e.metadata.dataCenters[0]}get apiUrl(){var e;return(e=this.dataCenter)==null?void 0:e.apiUrls[0].host}get tenantId(){var e;return(e=this.sessionToken)==null?void 0:e.orgId}get tokenId(){var e;return(e=this.sessionToken)==null?void 0:e.tokenId}get farmId(){var e;return(e=this.sessionToken)==null?void 0:e.context.farmId}};Ke=new WeakMap,zt=new WeakMap;let Ns=Vn;function Wn(s){return`any-${s||"main"}-chatSession`}async function Uc({id:s,params:e,chatWindow:t,html:n}){t=t;const i=async()=>{t.removeMessage("transferMessageId"),await t.sendFunctionCallResponse(s,{transfer:"Declined"},!0),t.setInputDisabled(!1)},r=async()=>{t.setInputDisabled(!0),t.removeMessage("transferMessageId"),t.addMessage({role:"system",content:"Please wait while we connect you to a live agent"}),await t.chatManager.endChat("Transferred to live agent",!1);const a=new Ns;await a.createSession();const{summary:o,subject:l,guestCardId:d,...u}=e;await a.createConversation({contact:u,attributes:{...d&&{gc_id:d,"Chat.gc_id":d},Question:l,"AI Summary":o}}),localStorage.setItem(Wn(t.cleanOptions.config.historyKey),a.serialize()),wa(t,a)};t.addMessage({id:"transferMessageId",role:"system",contentHtmlTemplate:n`
|
|
520
520
|
<style>
|
|
521
521
|
.btn {
|
|
522
522
|
background-color: var(--iai-chat-i-message-user-bg);
|
|
@@ -541,7 +541,7 @@ Please report this to https://github.com/markedjs/marked.`,i){const n="<p>An err
|
|
|
541
541
|
<strong>Would you like to transfer to an agent?</strong>
|
|
542
542
|
<div>
|
|
543
543
|
<button class="btn" @click=${r}>Yes</button>
|
|
544
|
-
<button class="btn btn-no" @click=${
|
|
544
|
+
<button class="btn btn-no" @click=${i}>No</button>
|
|
545
545
|
</div>
|
|
546
546
|
</div>
|
|
547
|
-
`})}function wa(
|
|
547
|
+
`})}function wa(s,e){e.on("*",(r,a)=>{console.log("event:",r,a)}),e.on("conversationCreated",()=>{s.setInputDisabled(!1),localStorage.setItem(Wn(s.cleanOptions.config.historyKey),e.serialize())}),e.on("conversationAccepted",r=>{s.addMessage({role:"system",content:`${r.displayName} has joined the chat`})}),e.on("agentTyping",()=>{s.setTypingIndicatorVisible(!0)}),e.on("agentJoined",r=>{s.addMessage({role:"system",content:`${r.displayName} has joined the chat`})}),e.on("agentTransferredConversation",r=>{s.addMessage({role:"system",content:`You have been transferred to ${r.toDisplayName}`})}),e.on("conversationTransferredToGroup",r=>{s.addMessage({role:"system",content:`You have been transferred to ${r.groupName}`})}),e.on("agentLeftConversation",r=>{s.addMessage({role:"system",content:`${r.displayName} has left the chat`})}),e.on("conversationTerminated",r=>{s.addMessage({role:"system",content:"The chat has ended"}),s.setInputDisabled(!0),localStorage.removeItem(Wn(s.cleanOptions.config.historyKey))}),e.on("message",r=>{switch(r.from){case"SYSTEM":s.addMessage({role:"system",content:r.text});break;case"USER":s.setTypingIndicatorVisible(!1),s.addMessage({role:"assistant",name:r.displayName,content:r.text});break;default:console.log("unhandled message:",r);break}}),e.connect();const t=async r=>{r.preventDefault(),s.addMessage({role:"user",content:r.detail.message}),await e.sendMessage(r.detail.message)},n=async()=>{console.log("destroyed fired"),e.destroy(),s.removeEventListener("iai-chat-send-user-message",t),s.removeEventListener("iai-chat-reset",i),s.removeEventListener("iai-chat-destroy",n)},i=async()=>{console.log("reset fired"),await e.terminateConversation(),await n(),localStorage.removeItem(Wn(s.cleanOptions.config.historyKey))};s.cleanOptions.config.disclaimerMessage="You are chatting with a live agent",s.addEventListener("iai-chat-send-user-message",t),s.addEventListener("iai-chat-reset",i),s.addEventListener("iai-chat-destroy",n)}class Bc{constructor(e,t){const n=ws.parse({assistantId:"7e59c8c1-a4ff-40f1-9a68-86ea294a4e75",...e,config:{...e.config,styles:e.styles||{}}});n.handlers.functionCalls.transferToLiveAgent=Uc,n.handlers.functionCalls.showScheduleTourWidget=Pc(t.schedulerUrl),n.handlers.enhancedContent.unitList=Rc,this.chatWidget=new Nc(n);const i=localStorage.getItem(Wn(n.config.historyKey));if(i){const r=Ns.deserialize(i);setTimeout(()=>{wa(this.chatWidget.api.chatWindow,r)},0)}}destroy(){this.chatWidget.destroy()}}ie.AnyChatWidget=Bc,Object.defineProperty(ie,Symbol.toStringTag,{value:"Module"})});
|