@blotoutio/providers-shop-gpt-sdk 1.1.1 → 1.2.0

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.
Files changed (4) hide show
  1. package/index.cjs.js +629 -141
  2. package/index.js +629 -141
  3. package/index.mjs +629 -141
  4. package/package.json +1 -1
package/index.mjs CHANGED
@@ -427,11 +427,34 @@ const createShopGPTAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, st
427
427
  const data = (await response.json());
428
428
  return data;
429
429
  };
430
+ const deleteSingleThread = async (threadId) => {
431
+ const response = await fetchImpl(getURL('/thread'), {
432
+ method: 'DELETE',
433
+ headers: getHeaders(),
434
+ credentials: 'include',
435
+ body: JSON.stringify({ threadId }),
436
+ });
437
+ if (!response.ok) {
438
+ throw new Error(`Failed to delete chat threads - ${response.status}: ${await response.text()}`);
439
+ }
440
+ };
441
+ const deleteAllThreads = async () => {
442
+ const response = await fetchImpl(getURL('/delete-threads'), {
443
+ method: 'DELETE',
444
+ headers: getHeaders(),
445
+ credentials: 'include',
446
+ });
447
+ if (!response.ok) {
448
+ throw new Error(`Failed to delete all chat threads - ${response.status}: ${await response.text()}`);
449
+ }
450
+ };
430
451
  return {
431
452
  processQuery,
432
453
  fetchChatHistory,
433
454
  fetchChatThreads,
434
455
  createChatThread,
456
+ deleteSingleThread,
457
+ deleteAllThreads,
435
458
  };
436
459
  };
437
460
 
@@ -548,52 +571,58 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
548
571
  * Copyright 2019 Google LLC
549
572
  * SPDX-License-Identifier: BSD-3-Clause
550
573
  */
551
- const t$3=globalThis,e$6=t$3.ShadowRoot&&(void 0===t$3.ShadyCSS||t$3.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$2=Symbol(),o$4=new WeakMap;let n$3 = class n{constructor(t,e,o){if(this._$cssResult$=!0,o!==s$2)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$6&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$4.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$4.set(s,t));}return t}toString(){return this.cssText}};const r$4=t=>new n$3("string"==typeof t?t:t+"",void 0,s$2),i$3=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1]),t[0]);return new n$3(o,t,s$2)},S$1=(s,o)=>{if(e$6)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$3.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$6?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$4(e)})(t):t;
574
+ const t$4=globalThis,e$8=t$4.ShadowRoot&&(void 0===t$4.ShadyCSS||t$4.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$2=Symbol(),o$5=new WeakMap;let n$4 = class n{constructor(t,e,o){if(this._$cssResult$=!0,o!==s$2)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$8&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$5.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$5.set(s,t));}return t}toString(){return this.cssText}};const r$6=t=>new n$4("string"==typeof t?t:t+"",void 0,s$2),i$3=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1]),t[0]);return new n$4(o,t,s$2)},S$1=(s,o)=>{if(e$8)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$4.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$8?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$6(e)})(t):t;
552
575
 
553
576
  /**
554
577
  * @license
555
578
  * Copyright 2017 Google LLC
556
579
  * SPDX-License-Identifier: BSD-3-Clause
557
- */const{is:i$2,defineProperty:e$5,getOwnPropertyDescriptor:r$3,getOwnPropertyNames:h$1,getOwnPropertySymbols:o$3,getPrototypeOf:n$2}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$2(t,s),y$1={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let b$1 = class b extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=y$1){if(s.state&&(s.attribute=!1),this._$Ei(),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(t,i,s);void 0!==r&&e$5(this.prototype,t,r);}}static getPropertyDescriptor(t,s,i){const{get:e,set:h}=r$3(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get(){return e?.call(this)},set(s){const r=e?.call(this);h.call(this,s),this.requestUpdate(t,r,i);},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??y$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$2(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...h$1(t),...o$3(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$2(s));}else void 0!==s&&i.push(c$2(s));return i}static _$Eu(t,s){const i=s.attribute;return !1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$EC(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==r?this.removeAttribute(e):this.setAttribute(e,r),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e,this[e]=r.fromAttribute(s,t.type),this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??f$1)(this[t],s))return;this.P(t,s,i);}!1===this.isUpdatePending&&(this._$ES=this._$ET());}P(t,s,i){this._$AL.has(t)||this._$AL.set(t,s),!0===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t);}async _$ET(){this.isUpdatePending=!0;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t)!0!==i.wrapped||this._$AL.has(s)||void 0===this[s]||this.P(s,this[s],i);}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EU();}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t);}_$EU(){this._$AL=new Map,this.isUpdatePending=!1;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return !0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU();}updated(t){}firstUpdated(t){}};b$1.elementStyles=[],b$1.shadowRootOptions={mode:"open"},b$1[d$1("elementProperties")]=new Map,b$1[d$1("finalized")]=new Map,p$1?.({ReactiveElement:b$1}),(a$1.reactiveElementVersions??=[]).push("2.0.4");
580
+ */const{is:i$2,defineProperty:e$7,getOwnPropertyDescriptor:r$5,getOwnPropertyNames:h$1,getOwnPropertySymbols:o$4,getPrototypeOf:n$3}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$2(t,s),y$1={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let b$1 = class b extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=y$1){if(s.state&&(s.attribute=!1),this._$Ei(),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(t,i,s);void 0!==r&&e$7(this.prototype,t,r);}}static getPropertyDescriptor(t,s,i){const{get:e,set:h}=r$5(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get(){return e?.call(this)},set(s){const r=e?.call(this);h.call(this,s),this.requestUpdate(t,r,i);},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??y$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$3(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...h$1(t),...o$4(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$2(s));}else void 0!==s&&i.push(c$2(s));return i}static _$Eu(t,s){const i=s.attribute;return !1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$EC(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==r?this.removeAttribute(e):this.setAttribute(e,r),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e,this[e]=r.fromAttribute(s,t.type),this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??f$1)(this[t],s))return;this.P(t,s,i);}!1===this.isUpdatePending&&(this._$ES=this._$ET());}P(t,s,i){this._$AL.has(t)||this._$AL.set(t,s),!0===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t);}async _$ET(){this.isUpdatePending=!0;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t)!0!==i.wrapped||this._$AL.has(s)||void 0===this[s]||this.P(s,this[s],i);}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EU();}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t);}_$EU(){this._$AL=new Map,this.isUpdatePending=!1;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return !0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU();}updated(t){}firstUpdated(t){}};b$1.elementStyles=[],b$1.shadowRootOptions={mode:"open"},b$1[d$1("elementProperties")]=new Map,b$1[d$1("finalized")]=new Map,p$1?.({ReactiveElement:b$1}),(a$1.reactiveElementVersions??=[]).push("2.0.4");
558
581
 
559
582
  /**
560
583
  * @license
561
584
  * Copyright 2017 Google LLC
562
585
  * SPDX-License-Identifier: BSD-3-Clause
563
586
  */
564
- const t$2=globalThis,i$1=t$2.trustedTypes,s$1=i$1?i$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$4="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$2="?"+h,n$1=`<${o$2}>`,r$2=document,l=()=>r$2.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),b=y(2),w=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),A=new WeakMap,E=r$2.createTreeWalker(r$2,129);function C(t,i){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$1?s$1.createHTML(i):i}const P=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n$1:d>=0?(o.push(a),s.slice(0,d)+e$4+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [C(t,l+(t[s]||"<?>")+(2===i?"</svg>":"")),o]};class V{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=P(t,s);if(this.el=V.createElement(f,n),E.currentNode=this.el.content,2===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=E.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$4)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?k:"?"===e[1]?H:"@"===e[1]?I:R}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$1?i$1.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),E.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o$2)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h,t+1));)d.push({type:7,index:c}),t+=h.length-1;}c++;}}static createElement(t,i){const s=r$2.createElement("template");return s.innerHTML=t,s}}function N(t,i,s=t,e){if(i===w)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(!1),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=N(t,h._$AS(t,i.values),h,e)),i}class S{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r$2).importNode(i,!0);E.currentNode=e;let h=E.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new M(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new L(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=E.nextNode(),o++);}return E.currentNode=r$2,e}p(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class M{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=T,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??!0;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=N(this,t,i),c(t)?t===T||null==t||""===t?(this._$AH!==T&&this._$AR(),this._$AH=T):t!==this._$AH&&t!==w&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t));}_(t){this._$AH!==T&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r$2.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=V.createElement(C(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new S(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new V(t)),i}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new M(this.S(l()),this.S(l()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class R{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=T,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=T;}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=N(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==w,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=N(this,e[s+n],i,n),r===w&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===T?t=T:t!==T&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===T?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class k extends R{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===T?void 0:t;}}class H extends R{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==T);}}class I extends R{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=N(this,t,i,0)??T)===w)return;const s=this._$AH,e=t===T&&s!==T||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==T&&(s===T||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class L{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){N(this,t);}}const Z=t$2.litHtmlPolyfillSupport;Z?.(V,M),(t$2.litHtmlVersions??=[]).push("3.1.3");const j=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new M(i.insertBefore(l(),t),t,void 0,s??{});}return h._$AI(t),h};
587
+ const t$3=globalThis,i$1=t$3.trustedTypes,s$1=i$1?i$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$6="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$3="?"+h,n$2=`<${o$3}>`,r$4=document,l=()=>r$4.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),b=y(2),w=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),A=new WeakMap,E=r$4.createTreeWalker(r$4,129);function C(t,i){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$1?s$1.createHTML(i):i}const P=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n$2:d>=0?(o.push(a),s.slice(0,d)+e$6+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [C(t,l+(t[s]||"<?>")+(2===i?"</svg>":"")),o]};class V{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=P(t,s);if(this.el=V.createElement(f,n),E.currentNode=this.el.content,2===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=E.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$6)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?k:"?"===e[1]?H:"@"===e[1]?I:R}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$1?i$1.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),E.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o$3)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h,t+1));)d.push({type:7,index:c}),t+=h.length-1;}c++;}}static createElement(t,i){const s=r$4.createElement("template");return s.innerHTML=t,s}}function N(t,i,s=t,e){if(i===w)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(!1),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=N(t,h._$AS(t,i.values),h,e)),i}class S{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r$4).importNode(i,!0);E.currentNode=e;let h=E.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new M(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new L(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=E.nextNode(),o++);}return E.currentNode=r$4,e}p(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class M{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=T,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??!0;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=N(this,t,i),c(t)?t===T||null==t||""===t?(this._$AH!==T&&this._$AR(),this._$AH=T):t!==this._$AH&&t!==w&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t));}_(t){this._$AH!==T&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r$4.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=V.createElement(C(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new S(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new V(t)),i}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new M(this.S(l()),this.S(l()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class R{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=T,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=T;}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=N(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==w,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=N(this,e[s+n],i,n),r===w&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===T?t=T:t!==T&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===T?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class k extends R{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===T?void 0:t;}}class H extends R{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==T);}}class I extends R{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=N(this,t,i,0)??T)===w)return;const s=this._$AH,e=t===T&&s!==T||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==T&&(s===T||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class L{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){N(this,t);}}const Z=t$3.litHtmlPolyfillSupport;Z?.(V,M),(t$3.litHtmlVersions??=[]).push("3.1.3");const j=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new M(i.insertBefore(l(),t),t,void 0,s??{});}return h._$AI(t),h};
565
588
 
566
589
  /**
567
590
  * @license
568
591
  * Copyright 2017 Google LLC
569
592
  * SPDX-License-Identifier: BSD-3-Clause
570
- */class s extends b$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=j(i,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1);}render(){return w}}s._$litElement$=!0,s[("finalized")]=!0,globalThis.litElementHydrateSupport?.({LitElement:s});const r$1=globalThis.litElementPolyfillSupport;r$1?.({LitElement:s});(globalThis.litElementVersions??=[]).push("4.0.5");
593
+ */class s extends b$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=j(i,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1);}render(){return w}}s._$litElement$=!0,s[("finalized")]=!0,globalThis.litElementHydrateSupport?.({LitElement:s});const r$3=globalThis.litElementPolyfillSupport;r$3?.({LitElement:s});(globalThis.litElementVersions??=[]).push("4.0.5");
571
594
 
572
595
  /**
573
596
  * @license
574
597
  * Copyright 2017 Google LLC
575
598
  * SPDX-License-Identifier: BSD-3-Clause
576
599
  */
577
- const t$1=t=>(e,o)=>{void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
600
+ const t$2=t=>(e,o)=>{void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
578
601
 
579
602
  /**
580
603
  * @license
581
604
  * Copyright 2017 Google LLC
582
605
  * SPDX-License-Identifier: BSD-3-Clause
583
- */const o$1={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1},r=(t=o$1,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.P(o,void 0,t),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,r?{...t,wrapped:!0}:t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
606
+ */const o$2={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1},r$2=(t=o$2,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.P(o,void 0,t),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n$1(t){return (e,o)=>"object"==typeof o?r$2(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,r?{...t,wrapped:!0}:t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
607
+
608
+ /**
609
+ * @license
610
+ * Copyright 2017 Google LLC
611
+ * SPDX-License-Identifier: BSD-3-Clause
612
+ */function r$1(r){return n$1({...r,state:!0,attribute:!1})}
584
613
 
585
614
  /**
586
615
  * @license
587
616
  * Copyright 2017 Google LLC
588
617
  * SPDX-License-Identifier: BSD-3-Clause
589
618
  */
590
- const e$3=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
619
+ const e$5=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
591
620
 
592
621
  /**
593
622
  * @license
594
623
  * Copyright 2017 Google LLC
595
624
  * SPDX-License-Identifier: BSD-3-Clause
596
- */function e$2(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;if(r){const{get:e,set:r}="object"==typeof s?n:i??(()=>{const t=Symbol();return {get(){return this[t]},set(e){this[t]=e;}}})();return e$3(n,s,{get(){let t=e.call(this);return void 0===t&&(t=o(this),(null!==t||this.hasUpdated)&&r.call(this,t)),t}})}return e$3(n,s,{get(){return o(this)}})}}
625
+ */function e$4(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;if(r){const{get:e,set:r}="object"==typeof s?n:i??(()=>{const t=Symbol();return {get(){return this[t]},set(e){this[t]=e;}}})();return e$5(n,s,{get(){let t=e.call(this);return void 0===t&&(t=o(this),(null!==t||this.hasUpdated)&&r.call(this,t)),t}})}return e$5(n,s,{get(){return o(this)}})}}
597
626
 
598
627
  const scrollBarStyles = i$3 `
599
628
  ::-webkit-scrollbar {
@@ -726,20 +755,20 @@ const shopGPTStyles = i$3 `
726
755
  * Copyright 2017 Google LLC
727
756
  * SPDX-License-Identifier: BSD-3-Clause
728
757
  */
729
- const t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e$1=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
758
+ const t$1={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e$3=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
730
759
 
731
760
  /**
732
761
  * @license
733
762
  * Copyright 2018 Google LLC
734
763
  * SPDX-License-Identifier: BSD-3-Clause
735
- */const e=e$1(class extends i{constructor(t$1){if(super(t$1),t$1.type!==t.ATTRIBUTE||"class"!==t$1.name||t$1.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter((s=>t[s])).join(" ")+" "}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)));}return w}});
764
+ */const e$2=e$3(class extends i{constructor(t){if(super(t),t.type!==t$1.ATTRIBUTE||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter((s=>t[s])).join(" ")+" "}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)));}return w}});
736
765
 
737
766
  /**
738
767
  * @license
739
768
  * Copyright 2021 Google LLC
740
769
  * SPDX-License-Identifier: BSD-3-Clause
741
770
  */
742
- function*o(o,f){if(void 0!==o){let i=0;for(const t of o)yield f(t,i++);}}
771
+ function*o$1(o,f){if(void 0!==o){let i=0;for(const t of o)yield f(t,i++);}}
743
772
 
744
773
  const sendFilledIcon = b `
745
774
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
@@ -753,6 +782,9 @@ const sendFilledIcon = b `
753
782
  </defs>
754
783
  </svg>
755
784
  `;
785
+ const trashIcon = b `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
786
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M6.75 1.125H11.25V2.25H6.75V1.125ZM2.25 3.375V4.5H3.375V15.75C3.375 16.0484 3.49353 16.3345 3.7045 16.5455C3.91548 16.7565 4.20163 16.875 4.5 16.875H13.5C13.7984 16.875 14.0845 16.7565 14.2955 16.5455C14.5065 16.3345 14.625 16.0484 14.625 15.75V4.5H15.75V3.375H2.25ZM4.5 15.75V4.5H13.5V15.75H4.5ZM6.75 6.75H7.875V13.5H6.75V6.75ZM10.125 6.75H11.25V13.5H10.125V6.75Z" fill="#A3B2C6"/>
787
+ </svg>`;
756
788
  const chatIcon = b `<svg focusable="false" preserveAspectRatio="xMidYMid meet" fill="currentColor" width="16" height="16" viewBox="0 0 32 32" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M16 19a6.9908 6.9908 0 01-5.833-3.1287l1.666-1.1074a5.0007 5.0007 0 008.334 0l1.666 1.1074A6.9908 6.9908 0 0116 19zM20 8a2 2 0 102 2A1.9806 1.9806 0 0020 8zM12 8a2 2 0 102 2A1.9806 1.9806 0 0012 8z"></path><path d="M17.7358,30,16,29l4-7h6a1.9966,1.9966,0,0,0,2-2V6a1.9966,1.9966,0,0,0-2-2H6A1.9966,1.9966,0,0,0,4,6V20a1.9966,1.9966,0,0,0,2,2h9v2H6a3.9993,3.9993,0,0,1-4-4V6A3.9988,3.9988,0,0,1,6,2H26a3.9988,3.9988,0,0,1,4,4V20a3.9993,3.9993,0,0,1-4,4H21.1646Z"></path></svg>`;
757
789
  const botIcon = b `
758
790
  <svg xmlns="http://www.w3.org/2000/svg" width="12" height="18" viewBox="0 0 12 18" fill="none">
@@ -893,6 +925,37 @@ const chatThreadsStyles = i$3 `
893
925
  flex: 1;
894
926
  overflow-y: auto;
895
927
  overflow-x: hidden;
928
+
929
+ .thread-wrapper {
930
+ display: flex;
931
+ justify-content: space-between;
932
+ align-items: center;
933
+
934
+ .trash-icon {
935
+ display: none;
936
+ padding: 2px;
937
+ cursor: pointer;
938
+
939
+ &:hover {
940
+ border-radius: 5px;
941
+ background: #dc3545;
942
+
943
+ path {
944
+ fill: white;
945
+ }
946
+ }
947
+ }
948
+
949
+ &:hover {
950
+ background: #f1f4f880;
951
+
952
+ .trash-icon {
953
+ display: flex;
954
+ justify-content: center;
955
+ align-items: center;
956
+ }
957
+ }
958
+ }
896
959
  }
897
960
 
898
961
  .thread-title {
@@ -902,12 +965,12 @@ const chatThreadsStyles = i$3 `
902
965
  cursor: pointer;
903
966
  }
904
967
 
905
- .thread-title.active {
968
+ .thread-wrapper.active {
906
969
  border-radius: 5px;
907
970
  background: #f1f4f8;
908
971
  }
909
972
 
910
- .thread-title.disabled {
973
+ .thread-wrapper.disabled {
911
974
  cursor: not-allowed;
912
975
  }
913
976
  }
@@ -970,13 +1033,31 @@ LoadSpinner.styles = [
970
1033
  `,
971
1034
  ];
972
1035
  LoadSpinner = __decorate([
973
- t$1('load-spinner')
1036
+ t$2('load-spinner')
974
1037
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
975
1038
  ], LoadSpinner);
976
1039
 
977
1040
  let ChatThreads =
978
1041
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
979
1042
  class ChatThreads extends s {
1043
+ getDomain() {
1044
+ var _a;
1045
+ if ((_a = this.merchantUrl) === null || _a === void 0 ? void 0 : _a.startsWith('https://')) {
1046
+ return this.merchantUrl;
1047
+ }
1048
+ return `https://${this.merchantUrl}`;
1049
+ }
1050
+ handleThreadDelete() {
1051
+ if (!this.deleteThreadId) {
1052
+ return;
1053
+ }
1054
+ this.dispatchEvent(new CustomEvent('delete-thread', {
1055
+ detail: { threadId: this.deleteThreadId },
1056
+ composed: true,
1057
+ bubbles: true,
1058
+ }));
1059
+ this.deleteThreadId = '';
1060
+ }
980
1061
  renderChatThreads() {
981
1062
  if (this.isLoading) {
982
1063
  return x `<div class="history">
@@ -989,21 +1070,36 @@ class ChatThreads extends s {
989
1070
  <p class="title">History</p>
990
1071
  ${this.chatThreads.size
991
1072
  ? x `<div class="threads">
992
- ${o(this.chatThreads.values(), (thread) => x `
1073
+ ${o$1(this.chatThreads.values(), (thread) => x `
993
1074
  <div
994
- class=${e({
995
- 'thread-title': true,
1075
+ class=${e$2({
1076
+ 'thread-wrapper': true,
996
1077
  active: this.selectedThreadId === thread.threadId,
997
1078
  disabled: this.isTyping,
998
1079
  })}
999
- @click=${async () => {
1080
+ >
1081
+ <div
1082
+ class="thread-title"
1083
+ @click=${async () => {
1000
1084
  if (this.isLoading || this.isTyping) {
1001
1085
  return;
1002
1086
  }
1003
1087
  await this.setSelectedThreadId(thread.threadId);
1004
1088
  }}
1005
- >
1006
- ${thread.title || 'New Search'}
1089
+ >
1090
+ ${thread.title || 'New Search'}
1091
+ </div>
1092
+ <div
1093
+ class="trash-icon"
1094
+ @click=${() => {
1095
+ if (this.isLoading || this.isTyping) {
1096
+ return;
1097
+ }
1098
+ this.deleteThreadId = thread.threadId;
1099
+ }}
1100
+ >
1101
+ ${trashIcon}
1102
+ </div>
1007
1103
  </div>
1008
1104
  `)}
1009
1105
  </div>`
@@ -1011,13 +1107,6 @@ class ChatThreads extends s {
1011
1107
  </div>
1012
1108
  `;
1013
1109
  }
1014
- getDomain() {
1015
- var _a;
1016
- if ((_a = this.merchantUrl) === null || _a === void 0 ? void 0 : _a.startsWith('https://')) {
1017
- return this.merchantUrl;
1018
- }
1019
- return `https://${this.merchantUrl}`;
1020
- }
1021
1110
  render() {
1022
1111
  return x `
1023
1112
  <div class="shop-gpt-icon">${shopGPTIcon}</div>
@@ -1037,32 +1126,50 @@ class ChatThreads extends s {
1037
1126
  </a>
1038
1127
  </div>`
1039
1128
  : T}
1129
+ ${this.deleteThreadId
1130
+ ? x `
1131
+ <confirm-dialog
1132
+ @accept=${this.handleThreadDelete}
1133
+ @decline=${() => (this.deleteThreadId = '')}
1134
+ >
1135
+ <h2 slot="title">Delete Thread?</h2>
1136
+ <p slot="content">
1137
+ This action cannot be undone. Are you sure you want to delete
1138
+ <b>"${this.chatThreads.get(this.deleteThreadId).title}"</b>?
1139
+ </p>
1140
+ </confirm-dialog>
1141
+ `
1142
+ : T}
1040
1143
  `;
1041
1144
  }
1042
1145
  };
1043
1146
  ChatThreads.styles = [chatThreadsStyles];
1044
1147
  __decorate([
1045
- n({ type: Object }),
1148
+ n$1({ type: Object }),
1046
1149
  __metadata("design:type", Map)
1047
1150
  ], ChatThreads.prototype, "chatThreads", void 0);
1048
1151
  __decorate([
1049
- n({ type: String }),
1152
+ n$1({ type: String }),
1050
1153
  __metadata("design:type", Object)
1051
1154
  ], ChatThreads.prototype, "merchantUrl", void 0);
1052
1155
  __decorate([
1053
- n({ type: Boolean }),
1156
+ n$1({ type: Boolean }),
1054
1157
  __metadata("design:type", Boolean)
1055
1158
  ], ChatThreads.prototype, "isLoading", void 0);
1056
1159
  __decorate([
1057
- n({ type: Boolean }),
1160
+ n$1({ type: Boolean }),
1058
1161
  __metadata("design:type", Boolean)
1059
1162
  ], ChatThreads.prototype, "isTyping", void 0);
1060
1163
  __decorate([
1061
- n({ type: String }),
1164
+ n$1({ type: String }),
1062
1165
  __metadata("design:type", String)
1063
1166
  ], ChatThreads.prototype, "selectedThreadId", void 0);
1167
+ __decorate([
1168
+ r$1(),
1169
+ __metadata("design:type", String)
1170
+ ], ChatThreads.prototype, "deleteThreadId", void 0);
1064
1171
  ChatThreads = __decorate([
1065
- t$1('chat-threads')
1172
+ t$2('chat-threads')
1066
1173
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1067
1174
  ], ChatThreads);
1068
1175
 
@@ -1264,6 +1371,14 @@ class ProductItem extends s {
1264
1371
  }
1265
1372
  (_a = open(url, '_blank')) === null || _a === void 0 ? void 0 : _a.focus();
1266
1373
  }
1374
+ renderVariantTitles() {
1375
+ if (!this.product.hasVariantsThatRequiresComponents) {
1376
+ return T;
1377
+ }
1378
+ return this.product.variants[0].selectedOptions.map((option) => x `
1379
+ <p class="product-variation-details">${option.name}: ${option.value}</p>
1380
+ `);
1381
+ }
1267
1382
  render() {
1268
1383
  return x `
1269
1384
  <div class="product">
@@ -1280,11 +1395,7 @@ class ProductItem extends s {
1280
1395
  >
1281
1396
  ${this.product.title}
1282
1397
  </p>
1283
- ${this.product.variants[0].selectedOptions.map((option) => x `
1284
- <p class="product-variation-details">
1285
- ${option.name}: ${option.value}
1286
- </p>
1287
- `)}
1398
+ ${this.renderVariantTitles()}
1288
1399
  <div class="prices">
1289
1400
  ${this.product.variants[0].comparedAtPrice &&
1290
1401
  this.product.variants[0].comparedAtPrice !==
@@ -1308,15 +1419,15 @@ class ProductItem extends s {
1308
1419
  };
1309
1420
  ProductItem.styles = [productItemStyles];
1310
1421
  __decorate([
1311
- n({ type: Object }),
1422
+ n$1({ type: Object }),
1312
1423
  __metadata("design:type", Object)
1313
1424
  ], ProductItem.prototype, "product", void 0);
1314
1425
  __decorate([
1315
- n({ type: Object }),
1426
+ n$1({ type: Object }),
1316
1427
  __metadata("design:type", Object)
1317
1428
  ], ProductItem.prototype, "siteCurrency", void 0);
1318
1429
  ProductItem = __decorate([
1319
- t$1('product-item')
1430
+ t$2('product-item')
1320
1431
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1321
1432
  ], ProductItem);
1322
1433
 
@@ -1411,9 +1522,9 @@ class ProductsList extends s {
1411
1522
  return x `
1412
1523
  <div class="products-wrapper">
1413
1524
  <div class="products" @scroll=${this.updateButtonsState}>
1414
- ${o(this.products, (product) => x `
1525
+ ${o$1(this.products, (product) => x `
1415
1526
  <div
1416
- class=${e({
1527
+ class=${e$2({
1417
1528
  'product-container': true,
1418
1529
  modal: this.viewType === 'modal',
1419
1530
  })}
@@ -1437,27 +1548,27 @@ class ProductsList extends s {
1437
1548
  };
1438
1549
  ProductsList.styles = [productsListStyles];
1439
1550
  __decorate([
1440
- n({ type: Array }),
1551
+ n$1({ type: Array }),
1441
1552
  __metadata("design:type", Array)
1442
1553
  ], ProductsList.prototype, "products", void 0);
1443
1554
  __decorate([
1444
- n({ type: Object }),
1555
+ n$1({ type: Object }),
1445
1556
  __metadata("design:type", Object)
1446
1557
  ], ProductsList.prototype, "siteCurrency", void 0);
1447
1558
  __decorate([
1448
- e$2('.left-btn'),
1559
+ e$4('.left-btn'),
1449
1560
  __metadata("design:type", Object)
1450
1561
  ], ProductsList.prototype, "leftBtnEle", void 0);
1451
1562
  __decorate([
1452
- e$2('.right-btn'),
1563
+ e$4('.right-btn'),
1453
1564
  __metadata("design:type", Object)
1454
1565
  ], ProductsList.prototype, "rightBtnEle", void 0);
1455
1566
  __decorate([
1456
- e$2('.products'),
1567
+ e$4('.products'),
1457
1568
  __metadata("design:type", Object)
1458
1569
  ], ProductsList.prototype, "productsEle", void 0);
1459
1570
  ProductsList = __decorate([
1460
- t$1('products-list')
1571
+ t$2('products-list')
1461
1572
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1462
1573
  ], ProductsList);
1463
1574
 
@@ -1505,31 +1616,31 @@ class ProductsSection extends s {
1505
1616
  };
1506
1617
  ProductsSection.styles = [productsSectionStyles];
1507
1618
  __decorate([
1508
- n({ type: Array }),
1619
+ n$1({ type: Array }),
1509
1620
  __metadata("design:type", Array)
1510
1621
  ], ProductsSection.prototype, "products", void 0);
1511
1622
  __decorate([
1512
- n({ type: Boolean }),
1623
+ n$1({ type: Boolean }),
1513
1624
  __metadata("design:type", Boolean)
1514
1625
  ], ProductsSection.prototype, "isLoadingHistory", void 0);
1515
1626
  __decorate([
1516
- n({ type: Object }),
1627
+ n$1({ type: Object }),
1517
1628
  __metadata("design:type", Object)
1518
1629
  ], ProductsSection.prototype, "siteCurrency", void 0);
1519
1630
  __decorate([
1520
- e$2('.left-btn'),
1631
+ e$4('.left-btn'),
1521
1632
  __metadata("design:type", Object)
1522
1633
  ], ProductsSection.prototype, "leftBtnEle", void 0);
1523
1634
  __decorate([
1524
- e$2('.right-btn'),
1635
+ e$4('.right-btn'),
1525
1636
  __metadata("design:type", Object)
1526
1637
  ], ProductsSection.prototype, "rightBtnEle", void 0);
1527
1638
  __decorate([
1528
- e$2('.products'),
1639
+ e$4('.products'),
1529
1640
  __metadata("design:type", Object)
1530
1641
  ], ProductsSection.prototype, "productsEle", void 0);
1531
1642
  ProductsSection = __decorate([
1532
- t$1('products-section')
1643
+ t$2('products-section')
1533
1644
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1534
1645
  ], ProductsSection);
1535
1646
 
@@ -1570,6 +1681,9 @@ const chatSectionStyles = i$3 `
1570
1681
  font-weight: 600;
1571
1682
  line-height: 21px;
1572
1683
  text-transform: capitalize;
1684
+ white-space: nowrap;
1685
+ overflow: hidden;
1686
+ text-overflow: ellipsis;
1573
1687
  }
1574
1688
 
1575
1689
  .btn-context {
@@ -1708,6 +1822,10 @@ const chatSectionStyles = i$3 `
1708
1822
  gap: 28px;
1709
1823
  padding-bottom: 10px;
1710
1824
  margin-bottom: -10px;
1825
+
1826
+ .message:last-child {
1827
+ margin-top: 10px;
1828
+ }
1711
1829
  }
1712
1830
 
1713
1831
  .message {
@@ -1925,15 +2043,28 @@ const chatSectionStyles = i$3 `
1925
2043
  }
1926
2044
 
1927
2045
  .thread-title {
2046
+ display: flex;
2047
+ justify-content: space-between;
1928
2048
  padding: 10px 16px;
1929
2049
  color: #4e647f;
1930
- font-size: 14px;
1931
- font-weight: 400;
1932
- line-height: 20px;
1933
2050
  cursor: pointer;
1934
2051
 
2052
+ p {
2053
+ font-size: 14px;
2054
+ font-weight: 400;
2055
+ line-height: 20px;
2056
+ }
2057
+
2058
+ .trash-icon {
2059
+ display: none;
2060
+ }
2061
+
1935
2062
  &:hover {
1936
2063
  background: #f1f4f8;
2064
+
2065
+ .trash-icon {
2066
+ display: flex;
2067
+ }
1937
2068
  }
1938
2069
  }
1939
2070
 
@@ -1942,6 +2073,23 @@ const chatSectionStyles = i$3 `
1942
2073
  }
1943
2074
  }
1944
2075
 
2076
+ .trash-icon {
2077
+ display: flex;
2078
+ justify-content: center;
2079
+ align-items: center;
2080
+ padding: 2px;
2081
+ cursor: pointer;
2082
+
2083
+ &:hover {
2084
+ border-radius: 5px;
2085
+ background: #dc3545;
2086
+
2087
+ path {
2088
+ fill: white;
2089
+ }
2090
+ }
2091
+ }
2092
+
1945
2093
  .chat-threads-background {
1946
2094
  position: absolute;
1947
2095
  top: 78px;
@@ -1960,6 +2108,16 @@ const capitalizeEachWord = (str) => {
1960
2108
  return str === null || str === void 0 ? void 0 : str.replace(/^\w/, (char) => char.toUpperCase());
1961
2109
  };
1962
2110
 
2111
+ const plusBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
2112
+ <path d="M12.75 11.25V6H11.25V11.25H6V12.75H11.25V18H12.75V12.75H18V11.25H12.75Z" fill="white"/>
2113
+ </svg>`;
2114
+ const timerBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
2115
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M6.16652 20.7304C7.89323 21.8842 9.9233 22.5 12 22.5C14.7848 22.5 17.4555 21.3938 19.4246 19.4246C21.3938 17.4555 22.5 14.7848 22.5 12C22.5 9.9233 21.8842 7.89323 20.7304 6.16652C19.5767 4.4398 17.9368 3.09399 16.0182 2.29927C14.0996 1.50455 11.9884 1.29661 9.95156 1.70176C7.91476 2.1069 6.04383 3.10693 4.57538 4.57538C3.10693 6.04383 2.1069 7.91476 1.70176 9.95156C1.29661 11.9884 1.50455 14.0996 2.29927 16.0182C3.09399 17.9368 4.4398 19.5767 6.16652 20.7304ZM6.99987 4.51678C8.47992 3.52785 10.22 3 12 3C14.387 3 16.6761 3.94822 18.364 5.63604C20.0518 7.32387 21 9.61306 21 12C21 13.78 20.4722 15.5201 19.4832 17.0001C18.4943 18.4802 17.0887 19.6337 15.4442 20.3149C13.7996 20.9961 11.99 21.1743 10.2442 20.8271C8.49836 20.4798 6.89472 19.6226 5.63604 18.364C4.37737 17.1053 3.5202 15.5016 3.17294 13.7558C2.82567 12.01 3.0039 10.2004 3.68509 8.55585C4.36628 6.91132 5.51983 5.50571 6.99987 4.51678ZM11.25 12.3075L15.4425 16.5L16.5 15.4425L12.75 11.685V5.25H11.25V12.3075Z" fill="white"/>
2116
+ </svg>`;
2117
+ const crossBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
2118
+ <path d="M18 7.05L16.95 6L12 10.95L7.05 6L6 7.05L10.95 12L6 16.95L7.05 18L12 13.05L16.95 18L18 16.95L13.05 12L18 7.05Z" fill="white"/>
2119
+ </svg>`;
2120
+
1963
2121
  const personalizeDialogStyles = i$3 `
1964
2122
  :host {
1965
2123
  font-family: 'Inter', sans-serif;
@@ -2446,63 +2604,318 @@ class PersonalizeDialog extends s {
2446
2604
  };
2447
2605
  PersonalizeDialog.styles = [personalizeDialogStyles];
2448
2606
  __decorate([
2449
- e$2('dialog'),
2607
+ e$4('dialog'),
2450
2608
  __metadata("design:type", HTMLDialogElement)
2451
2609
  ], PersonalizeDialog.prototype, "dialogModal", void 0);
2452
2610
  __decorate([
2453
- e$2('.dropdown-list'),
2611
+ e$4('.dropdown-list'),
2454
2612
  __metadata("design:type", HTMLUListElement)
2455
2613
  ], PersonalizeDialog.prototype, "dropdownList", void 0);
2456
2614
  __decorate([
2457
- e$2('.dropdown-trigger'),
2615
+ e$4('.dropdown-trigger'),
2458
2616
  __metadata("design:type", HTMLDivElement)
2459
2617
  ], PersonalizeDialog.prototype, "dropdownTrigger", void 0);
2460
2618
  __decorate([
2461
- n({ type: Array }),
2619
+ n$1({ type: Array }),
2462
2620
  __metadata("design:type", Array)
2463
2621
  ], PersonalizeDialog.prototype, "defaultProductHandles", void 0);
2464
2622
  __decorate([
2465
- n({ type: Array }),
2623
+ n$1({ type: Array }),
2466
2624
  __metadata("design:type", Array)
2467
2625
  ], PersonalizeDialog.prototype, "defaultProfiles", void 0);
2468
2626
  __decorate([
2469
- n({ type: Boolean }),
2627
+ n$1({ type: Boolean }),
2470
2628
  __metadata("design:type", Boolean)
2471
2629
  ], PersonalizeDialog.prototype, "isLoading", void 0);
2472
2630
  __decorate([
2473
- n({ type: String }),
2631
+ n$1({ type: String }),
2474
2632
  __metadata("design:type", Object)
2475
2633
  ], PersonalizeDialog.prototype, "state", void 0);
2476
2634
  __decorate([
2477
- n({ type: String }),
2635
+ n$1({ type: String }),
2478
2636
  __metadata("design:type", Object)
2479
2637
  ], PersonalizeDialog.prototype, "profileType", void 0);
2480
2638
  __decorate([
2481
- n({ type: String }),
2639
+ n$1({ type: String }),
2482
2640
  __metadata("design:type", Object)
2483
2641
  ], PersonalizeDialog.prototype, "selectedProfile", void 0);
2484
2642
  __decorate([
2485
- n({ type: String }),
2643
+ n$1({ type: String }),
2486
2644
  __metadata("design:type", Object)
2487
2645
  ], PersonalizeDialog.prototype, "visitorType", void 0);
2488
2646
  __decorate([
2489
- n({ type: String }),
2647
+ n$1({ type: String }),
2490
2648
  __metadata("design:type", Object)
2491
2649
  ], PersonalizeDialog.prototype, "productHandle", void 0);
2492
2650
  PersonalizeDialog = __decorate([
2493
- t$1('personalize-dialog')
2651
+ t$2('personalize-dialog')
2494
2652
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2495
2653
  ], PersonalizeDialog);
2496
2654
 
2497
- const plusBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
2498
- <path d="M12.75 11.25V6H11.25V11.25H6V12.75H11.25V18H12.75V12.75H18V11.25H12.75Z" fill="white"/>
2499
- </svg>`;
2500
- const timerBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
2501
- <path fill-rule="evenodd" clip-rule="evenodd" d="M6.16652 20.7304C7.89323 21.8842 9.9233 22.5 12 22.5C14.7848 22.5 17.4555 21.3938 19.4246 19.4246C21.3938 17.4555 22.5 14.7848 22.5 12C22.5 9.9233 21.8842 7.89323 20.7304 6.16652C19.5767 4.4398 17.9368 3.09399 16.0182 2.29927C14.0996 1.50455 11.9884 1.29661 9.95156 1.70176C7.91476 2.1069 6.04383 3.10693 4.57538 4.57538C3.10693 6.04383 2.1069 7.91476 1.70176 9.95156C1.29661 11.9884 1.50455 14.0996 2.29927 16.0182C3.09399 17.9368 4.4398 19.5767 6.16652 20.7304ZM6.99987 4.51678C8.47992 3.52785 10.22 3 12 3C14.387 3 16.6761 3.94822 18.364 5.63604C20.0518 7.32387 21 9.61306 21 12C21 13.78 20.4722 15.5201 19.4832 17.0001C18.4943 18.4802 17.0887 19.6337 15.4442 20.3149C13.7996 20.9961 11.99 21.1743 10.2442 20.8271C8.49836 20.4798 6.89472 19.6226 5.63604 18.364C4.37737 17.1053 3.5202 15.5016 3.17294 13.7558C2.82567 12.01 3.0039 10.2004 3.68509 8.55585C4.36628 6.91132 5.51983 5.50571 6.99987 4.51678ZM11.25 12.3075L15.4425 16.5L16.5 15.4425L12.75 11.685V5.25H11.25V12.3075Z" fill="white"/>
2502
- </svg>`;
2503
- const crossBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
2504
- <path d="M18 7.05L16.95 6L12 10.95L7.05 6L6 7.05L10.95 12L6 16.95L7.05 18L12 13.05L16.95 18L18 16.95L13.05 12L18 7.05Z" fill="white"/>
2505
- </svg>`;
2655
+ /**
2656
+ * @license
2657
+ * Copyright 2017 Google LLC
2658
+ * SPDX-License-Identifier: BSD-3-Clause
2659
+ */let e$1 = class e extends i{constructor(i){if(super(i),this.it=T,i.type!==t$1.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===T||null==r)return this._t=void 0,this.it=r;if(r===w)return r;if("string"!=typeof r)throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;const s=[r];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}};e$1.directiveName="unsafeHTML",e$1.resultType=1;const o=e$3(e$1);
2660
+
2661
+ var e={"":["<em>","</em>"],_:["<strong>","</strong>"],"*":["<strong>","</strong>"],"~":["<s>","</s>"],"\n":["<br />"]," ":["<br />"],"-":["<hr />"]};function n(e){return e.replace(RegExp("^"+(e.match(/^(\t| )+/)||"")[0],"gm"),"")}function r(e){return (e+"").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function t(a,c){var o,l,g,s,p,u=/((?:^|\n+)(?:\n---+|\* \*(?: \*)+)\n)|(?:^``` *(\w*)\n([\s\S]*?)\n```$)|((?:(?:^|\n+)(?:\t| {2,}).+)+\n*)|((?:(?:^|\n)([>*+-]|\d+\.)\s+.*)+)|(?:!\[([^\]]*?)\]\(([^)]+?)\))|(\[)|(\](?:\(([^)]+?)\))?)|(?:(?:^|\n+)([^\s].*)\n(-{3,}|={3,})(?:\n+|$))|(?:(?:^|\n+)(#{1,6})\s*(.+)(?:\n+|$))|(?:`([^`].*?)`)|( \n\n*|\n{2,}|__|\*\*|[_*]|~~)/gm,m=[],h="",i=c||{},d=0;function f(n){var r=e[n[1]||""],t=m[m.length-1]==n;return r?r[1]?(t?m.pop():m.push(n),r[0|t]):r[0]:n}function $(){for(var e="";m.length;)e+=f(m[m.length-1]);return e}for(a=a.replace(/^\[(.+?)\]:\s*(.+)$/gm,function(e,n,r){return i[n.toLowerCase()]=r,""}).replace(/^\n+|\n+$/g,"");g=u.exec(a);)l=a.substring(d,g.index),d=u.lastIndex,o=g[0],l.match(/[^\\](\\\\)*\\$/)||((p=g[3]||g[4])?o='<pre class="code '+(g[4]?"poetry":g[2].toLowerCase())+'"><code'+(g[2]?' class="language-'+g[2].toLowerCase()+'"':"")+">"+n(r(p).replace(/^\n+|\n+$/g,""))+"</code></pre>":(p=g[6])?(p.match(/\./)&&(g[5]=g[5].replace(/^\d+/gm,"")),s=t(n(g[5].replace(/^\s*[>*+.-]/gm,""))),">"==p?p="blockquote":(p=p.match(/\./)?"ol":"ul",s=s.replace(/^(.*)(\n|$)/gm,"<li>$1</li>")),o="<"+p+">"+s+"</"+p+">"):g[8]?o='<img src="'+r(g[8])+'" alt="'+r(g[7])+'">':g[10]?(h=h.replace("<a>",'<a href="'+r(g[11]||i[l.toLowerCase()])+'">'),o=$()+"</a>"):g[9]?o="<a>":g[12]||g[14]?o="<"+(p="h"+(g[14]?g[14].length:g[13]>"="?1:2))+">"+t(g[12]||g[15],i)+"</"+p+">":g[16]?o="<code>"+r(g[16])+"</code>":(g[17]||g[1])&&(o=f(g[17]||"--"))),h+=l,h+=o;return (h+a.substring(d)+$()).replace(/^\n+|\n+$/g,"")}
2662
+
2663
+ let MarkdownRenderer =
2664
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2665
+ class MarkdownRenderer extends s {
2666
+ render() {
2667
+ const slotContent = this.innerHTML.trim();
2668
+ const parsedContent = t(slotContent);
2669
+ return o(parsedContent);
2670
+ }
2671
+ };
2672
+ MarkdownRenderer.styles = i$3 `
2673
+ :host {
2674
+ font-family: 'Inter', sans-serif;
2675
+ font-size: 16px;
2676
+ font-weight: 400;
2677
+
2678
+ p {
2679
+ margin: 0;
2680
+ }
2681
+ }
2682
+ `;
2683
+ MarkdownRenderer = __decorate([
2684
+ t$2('markdown-renderer')
2685
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2686
+ ], MarkdownRenderer);
2687
+
2688
+ let TooltipComponent =
2689
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2690
+ class TooltipComponent extends s {
2691
+ constructor() {
2692
+ super(...arguments);
2693
+ this.position = 'bottom-left';
2694
+ this.text = '';
2695
+ }
2696
+ render() {
2697
+ return x `
2698
+ <slot></slot>
2699
+ <div class="tooltip ${this.position}">${this.text}</div>
2700
+ `;
2701
+ }
2702
+ };
2703
+ TooltipComponent.styles = [
2704
+ i$3 `
2705
+ :host {
2706
+ position: relative;
2707
+ display: inline-block;
2708
+ }
2709
+ .tooltip {
2710
+ position: absolute;
2711
+ color: #172a41;
2712
+ padding: 4px 8px;
2713
+ border-radius: 4px;
2714
+ white-space: nowrap;
2715
+ font-size: 12px;
2716
+ opacity: 0;
2717
+ transition: opacity 0.2s;
2718
+ pointer-events: none;
2719
+
2720
+ border-radius: 5px;
2721
+ background: #ffcc81;
2722
+ box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1),
2723
+ 0px 2px 4px -1px rgba(0, 0, 0, 0.06);
2724
+
2725
+ font-style: normal;
2726
+ font-weight: 400;
2727
+ line-height: 150%;
2728
+ }
2729
+ :host(:hover) .tooltip {
2730
+ opacity: 1;
2731
+ }
2732
+ .top-center {
2733
+ bottom: calc(100% + 2px);
2734
+ left: 50%;
2735
+ transform: translateX(-50%);
2736
+ }
2737
+ .top-left {
2738
+ bottom: calc(100% + 2px);
2739
+ left: 0;
2740
+ }
2741
+ .top-right {
2742
+ bottom: calc(100% + 2px);
2743
+ right: 0;
2744
+ }
2745
+ .bottom-center {
2746
+ top: calc(100% + 2px);
2747
+ left: 50%;
2748
+ transform: translateX(-50%);
2749
+ }
2750
+ .bottom-left {
2751
+ top: calc(100% + 2px);
2752
+ left: 0;
2753
+ }
2754
+ .bottom-right {
2755
+ top: calc(100% + 2px);
2756
+ right: 0;
2757
+ }
2758
+ .left-center {
2759
+ right: calc(100% + 2px);
2760
+ top: 50%;
2761
+ transform: translateY(-50%);
2762
+ }
2763
+ .left-top {
2764
+ right: calc(100% + 2px);
2765
+ top: 0;
2766
+ }
2767
+ .left-bottom {
2768
+ right: calc(100% + 2px);
2769
+ bottom: 0;
2770
+ }
2771
+ .right-center {
2772
+ left: calc(100% + 2px);
2773
+ top: 50%;
2774
+ transform: translateY(-50%);
2775
+ }
2776
+ .right-top {
2777
+ left: calc(100% + 2px);
2778
+ top: 0;
2779
+ }
2780
+ .right-bottom {
2781
+ left: calc(100% + 2px);
2782
+ bottom: 0;
2783
+ }
2784
+ `,
2785
+ ];
2786
+ __decorate([
2787
+ n$1({ type: String }),
2788
+ __metadata("design:type", String)
2789
+ ], TooltipComponent.prototype, "position", void 0);
2790
+ __decorate([
2791
+ n$1({ type: String }),
2792
+ __metadata("design:type", String)
2793
+ ], TooltipComponent.prototype, "text", void 0);
2794
+ TooltipComponent = __decorate([
2795
+ t$2('tooltip-component')
2796
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2797
+ ], TooltipComponent);
2798
+
2799
+ const confirmDialogStyles = i$3 `
2800
+ :host {
2801
+ font-family: 'Inter', sans-serif;
2802
+ font-size: 16px;
2803
+ font-weight: 400;
2804
+
2805
+ display: flex;
2806
+ position: absolute;
2807
+ top: 0;
2808
+ left: 0;
2809
+ width: 100%;
2810
+ height: 100%;
2811
+ background: #00000050;
2812
+ }
2813
+
2814
+ .modal {
2815
+ width: 75%;
2816
+ max-width: 350px;
2817
+ background: #fff;
2818
+ padding: 16px;
2819
+ margin: auto;
2820
+
2821
+ border-radius: 10px;
2822
+ box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.12),
2823
+ 0px 20px 20px 0px rgba(0, 0, 0, 0.08);
2824
+
2825
+ z-index: 2000;
2826
+ }
2827
+
2828
+ ::slotted([slot='title']) {
2829
+ margin-bottom: 8px !important;
2830
+ color: #172a41;
2831
+ font-size: 18px;
2832
+ font-weight: 700;
2833
+ line-height: 150%;
2834
+ }
2835
+
2836
+ ::slotted([slot='content']) {
2837
+ color: #4e647f;
2838
+ line-height: 150%;
2839
+ }
2840
+
2841
+ .button-wrapper {
2842
+ margin-top: 12px;
2843
+ display: flex;
2844
+ gap: 12px;
2845
+
2846
+ .btn {
2847
+ justify-self: stretch;
2848
+ padding: 10px;
2849
+ cursor: pointer;
2850
+ text-align: center;
2851
+ width: 100%;
2852
+ border: 0;
2853
+ color: #fff;
2854
+ line-height: 150%;
2855
+ text-transform: capitalize;
2856
+ }
2857
+
2858
+ .accept-btn {
2859
+ border-radius: 5px;
2860
+ background: #dc3545;
2861
+
2862
+ &:hover {
2863
+ background: rgb(176, 62, 25);
2864
+ }
2865
+ }
2866
+
2867
+ .decline-btn {
2868
+ border-radius: 5px;
2869
+ background: #4e647f;
2870
+
2871
+ &:hover {
2872
+ background: rgb(57, 77, 102);
2873
+ }
2874
+ }
2875
+ }
2876
+ `;
2877
+
2878
+ let ConfirmDialog =
2879
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2880
+ class ConfirmDialog extends s {
2881
+ onAcceptClick(e) {
2882
+ e.preventDefault();
2883
+ this.dispatchEvent(new CustomEvent('accept', {
2884
+ composed: true,
2885
+ }));
2886
+ }
2887
+ onCancelClick(e) {
2888
+ e.preventDefault();
2889
+ this.dispatchEvent(new CustomEvent('decline', {
2890
+ composed: true,
2891
+ }));
2892
+ }
2893
+ render() {
2894
+ return x `
2895
+ <div class="modal">
2896
+ <slot name="title"></slot>
2897
+ <slot name="content"></slot>
2898
+ <div class="button-wrapper">
2899
+ <slot name="accept-btn">
2900
+ <button class="btn accept-btn" @click=${this.onAcceptClick}>
2901
+ Delete
2902
+ </button>
2903
+ </slot>
2904
+ <slot name="decline-btn">
2905
+ <button class="btn decline-btn" @click=${this.onCancelClick}>
2906
+ Cancel
2907
+ </button>
2908
+ </slot>
2909
+ </div>
2910
+ </div>
2911
+ `;
2912
+ }
2913
+ };
2914
+ ConfirmDialog.styles = [confirmDialogStyles];
2915
+ ConfirmDialog = __decorate([
2916
+ t$2('confirm-dialog')
2917
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2918
+ ], ConfirmDialog);
2506
2919
 
2507
2920
  let ChatSection =
2508
2921
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -2533,6 +2946,17 @@ class ChatSection extends s {
2533
2946
  this.userQuery = '';
2534
2947
  await this.processMessage(e, message);
2535
2948
  }
2949
+ handleThreadDelete() {
2950
+ if (!this.deleteThreadId) {
2951
+ return;
2952
+ }
2953
+ this.dispatchEvent(new CustomEvent('delete-thread', {
2954
+ detail: { threadId: this.deleteThreadId },
2955
+ composed: true,
2956
+ bubbles: true,
2957
+ }));
2958
+ this.deleteThreadId = '';
2959
+ }
2536
2960
  typingIndicator() {
2537
2961
  return x `<div class="typing-dots">
2538
2962
  <div class="dot"></div>
@@ -2549,7 +2973,9 @@ class ChatSection extends s {
2549
2973
  <div class="bot-icon">${botIcon}</div>
2550
2974
  </div>
2551
2975
  <div>
2552
- ${message.message ? x `<p>${message.message}</p>` : T}
2976
+ ${message.message
2977
+ ? x `<markdown-renderer>${message.message}</markdown-renderer>`
2978
+ : T}
2553
2979
  ${this.viewType !== 'modal' && ((_a = message.products) === null || _a === void 0 ? void 0 : _a[0])
2554
2980
  ? x `
2555
2981
  <span class="line"></span>
@@ -2714,37 +3140,49 @@ class ChatSection extends s {
2714
3140
  <div>${botIcon}</div>
2715
3141
  <h2>${((_a = this.thread) === null || _a === void 0 ? void 0 : _a.title) || 'New Search'}</h2>
2716
3142
  <div class="btns-wrapper">
2717
- <button
2718
- class="btn btn-icon new-search-btn"
2719
- title="New chat"
2720
- @click=${async () => {
3143
+ <tooltip-component .position=${'bottom-right'} .text=${'New Chat'}>
3144
+ <button
3145
+ class="btn btn-icon new-search-btn"
3146
+ @click=${(e) => {
2721
3147
  var _a;
2722
- await ((_a = this.setSelectedThreadId) === null || _a === void 0 ? void 0 : _a.call(this, ''));
3148
+ e.preventDefault();
3149
+ (_a = this.setSelectedThreadId) === null || _a === void 0 ? void 0 : _a.call(this, '');
2723
3150
  }}
3151
+ >
3152
+ ${plusBtn}
3153
+ </button>
3154
+ </tooltip-component>
3155
+ <tooltip-component
3156
+ .position=${'bottom-right'}
3157
+ .text=${'Your Search History'}
2724
3158
  >
2725
- ${plusBtn}
2726
- </button>
2727
- <button
2728
- class=${e({
3159
+ <button
3160
+ class=${e$2({
2729
3161
  btn: true,
2730
3162
  'btn-icon': true,
2731
3163
  'threads-btn': true,
2732
3164
  active: this.showChatThreads,
2733
3165
  })}
2734
- title="Your Search History"
2735
- @click=${() => {
3166
+ @click=${(e) => {
3167
+ e.preventDefault();
2736
3168
  this.showChatThreads = !this.showChatThreads;
2737
3169
  }}
2738
- >
2739
- ${timerBtn}
2740
- </button>
2741
- <button
2742
- class="btn btn-icon close-btn"
2743
- title="Close chat"
2744
- @click=${() => { var _a; return (_a = this.closeModal) === null || _a === void 0 ? void 0 : _a.call(this); }}
2745
- >
2746
- ${crossBtn}
2747
- </button>
3170
+ >
3171
+ ${timerBtn}
3172
+ </button>
3173
+ </tooltip-component>
3174
+ <tooltip-component .position=${'bottom-right'} .text=${'Close Chat'}>
3175
+ <button
3176
+ class="btn btn-icon close-btn"
3177
+ @click=${(e) => {
3178
+ var _a;
3179
+ e.preventDefault();
3180
+ (_a = this.closeModal) === null || _a === void 0 ? void 0 : _a.call(this);
3181
+ }}
3182
+ >
3183
+ ${crossBtn}
3184
+ </button>
3185
+ </tooltip-component>
2748
3186
  </div>
2749
3187
  `;
2750
3188
  }
@@ -2793,23 +3231,38 @@ class ChatSection extends s {
2793
3231
  <div class="chat-threads">
2794
3232
  <h2>Your Search History</h2>
2795
3233
  <div class="thread-titles-wrapper">
2796
- ${o(this.chatThreads.values(), (thread) => x `
2797
- <p
2798
- class=${e({
3234
+ ${o$1(this.chatThreads.values(), (thread) => x `
3235
+ <div
3236
+ class=${e$2({
2799
3237
  'thread-title': true,
2800
3238
  disabled: this.isTyping,
2801
3239
  })}
2802
- @click=${async () => {
3240
+ >
3241
+ <p
3242
+ @click=${() => {
2803
3243
  var _a;
2804
3244
  if (this.isTyping) {
2805
3245
  return;
2806
3246
  }
2807
3247
  this.showChatThreads = false;
2808
- await ((_a = this.setSelectedThreadId) === null || _a === void 0 ? void 0 : _a.call(this, thread.threadId));
3248
+ (_a = this.setSelectedThreadId) === null || _a === void 0 ? void 0 : _a.call(this, thread.threadId);
2809
3249
  }}
2810
- >
2811
- ${thread.title || 'New Search'}
2812
- </p>
3250
+ >
3251
+ ${thread.title || 'New Search'}
3252
+ </p>
3253
+ <div
3254
+ class="trash-icon"
3255
+ @click=${() => {
3256
+ if (this.isTyping) {
3257
+ return;
3258
+ }
3259
+ this.deleteThreadId = thread.threadId;
3260
+ this.showChatThreads = false;
3261
+ }}
3262
+ >
3263
+ ${trashIcon}
3264
+ </div>
3265
+ </div>
2813
3266
  `)}
2814
3267
  </div>
2815
3268
  </div>
@@ -2823,7 +3276,7 @@ class ChatSection extends s {
2823
3276
  return x `
2824
3277
  <div class="chat-header">${this.contextButton()}</div>
2825
3278
  <div
2826
- class=${e({
3279
+ class=${e$2({
2827
3280
  'chatbot-section': true,
2828
3281
  'modal-view': this.viewType === 'modal',
2829
3282
  })}
@@ -2837,7 +3290,7 @@ class ChatSection extends s {
2837
3290
  placeholder="Type your search here..."
2838
3291
  />
2839
3292
  <button
2840
- class=${e({
3293
+ class=${e$2({
2841
3294
  btn: true,
2842
3295
  modal: this.viewType === 'modal',
2843
3296
  })}
@@ -2854,72 +3307,90 @@ class ChatSection extends s {
2854
3307
  .defaultProfiles=${this.profiles}
2855
3308
  ></personalize-dialog>
2856
3309
  ${this.renderChatThreads()}
3310
+ ${this.deleteThreadId
3311
+ ? x `
3312
+ <confirm-dialog
3313
+ @accept=${this.handleThreadDelete}
3314
+ @decline=${() => (this.deleteThreadId = '')}
3315
+ >
3316
+ <h2 slot="title">Delete Thread?</h2>
3317
+ <p slot="content">
3318
+ This action cannot be undone. Are you sure you want to delete
3319
+ <b>"${this.chatThreads.get(this.deleteThreadId).title}"</b>?
3320
+ </p>
3321
+ </confirm-dialog>
3322
+ `
3323
+ : T}
2857
3324
  `;
2858
3325
  }
2859
3326
  };
2860
3327
  ChatSection.styles = [chatSectionStyles];
2861
3328
  __decorate([
2862
- n({ type: Object }),
3329
+ n$1({ type: Object }),
2863
3330
  __metadata("design:type", Map)
2864
3331
  ], ChatSection.prototype, "chatThreads", void 0);
2865
3332
  __decorate([
2866
- n({ type: Boolean }),
3333
+ r$1(),
3334
+ __metadata("design:type", String)
3335
+ ], ChatSection.prototype, "deleteThreadId", void 0);
3336
+ __decorate([
3337
+ n$1({ type: Boolean }),
2867
3338
  __metadata("design:type", Boolean)
2868
3339
  ], ChatSection.prototype, "showChatThreads", void 0);
2869
3340
  __decorate([
2870
- n({ type: Boolean }),
3341
+ n$1({ type: Boolean }),
2871
3342
  __metadata("design:type", Boolean)
2872
3343
  ], ChatSection.prototype, "isLoadingHistory", void 0);
2873
3344
  __decorate([
2874
- n({ type: Boolean }),
3345
+ n$1({ type: Boolean }),
2875
3346
  __metadata("design:type", Object)
2876
3347
  ], ChatSection.prototype, "devMode", void 0);
2877
3348
  __decorate([
2878
- n({ type: Boolean }),
3349
+ n$1({ type: Boolean }),
2879
3350
  __metadata("design:type", Boolean)
2880
3351
  ], ChatSection.prototype, "isTyping", void 0);
2881
3352
  __decorate([
2882
- n({ type: Boolean }),
3353
+ n$1({ type: Boolean }),
2883
3354
  __metadata("design:type", Boolean)
2884
3355
  ], ChatSection.prototype, "isFailed", void 0);
2885
3356
  __decorate([
2886
- n({ type: Array }),
3357
+ n$1({ type: Array }),
2887
3358
  __metadata("design:type", Array)
2888
3359
  ], ChatSection.prototype, "messages", void 0);
2889
3360
  __decorate([
2890
- n({ type: Array }),
3361
+ n$1({ type: Array }),
2891
3362
  __metadata("design:type", Array)
2892
3363
  ], ChatSection.prototype, "profiles", void 0);
2893
3364
  __decorate([
2894
- n({ type: Array }),
3365
+ n$1({ type: Array }),
2895
3366
  __metadata("design:type", Array)
2896
3367
  ], ChatSection.prototype, "productHandles", void 0);
2897
3368
  __decorate([
2898
- n({ type: Object }),
3369
+ n$1({ type: Object }),
2899
3370
  __metadata("design:type", Object)
2900
3371
  ], ChatSection.prototype, "thread", void 0);
2901
3372
  __decorate([
2902
- n({ type: Object }),
3373
+ n$1({ type: Object }),
2903
3374
  __metadata("design:type", Object)
2904
3375
  ], ChatSection.prototype, "siteCurrency", void 0);
2905
3376
  __decorate([
2906
- e$2('.context-container'),
3377
+ e$4('.context-container'),
2907
3378
  __metadata("design:type", Object)
2908
3379
  ], ChatSection.prototype, "contextContainerElement", void 0);
2909
3380
  __decorate([
2910
- e$2('.chat-window'),
3381
+ e$4('.chat-window'),
2911
3382
  __metadata("design:type", Object)
2912
3383
  ], ChatSection.prototype, "chatWindowElement", void 0);
2913
3384
  __decorate([
2914
- e$2('personalize-dialog'),
3385
+ e$4('personalize-dialog'),
2915
3386
  __metadata("design:type", Object)
2916
3387
  ], ChatSection.prototype, "personalizeDialogElement", void 0);
2917
3388
  __decorate([
2918
- n({ type: String }),
3389
+ n$1({ type: String }),
2919
3390
  __metadata("design:type", String)
2920
3391
  ], ChatSection.prototype, "userQuery", void 0);
2921
3392
  ChatSection = __decorate([
2922
- t$1('chat-section')
3393
+ t$2('chat-section')
2923
3394
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2924
3395
  ], ChatSection);
2925
3396
 
@@ -3082,6 +3553,20 @@ let ShopGPT = class ShopGPT extends s {
3082
3553
  logger.error(e);
3083
3554
  }
3084
3555
  }
3556
+ handleThreadDelete(e) {
3557
+ e.stopPropagation();
3558
+ this.isLoadingThreads = true;
3559
+ const threadId = e.detail.threadId;
3560
+ if (!threadId) {
3561
+ logger.error('ThreadId is missing to delete the thread!');
3562
+ return;
3563
+ }
3564
+ this.shopGPTAPI
3565
+ .deleteSingleThread(threadId)
3566
+ .then(this.loadChatThreads.bind(this))
3567
+ .catch(logger.error)
3568
+ .finally(() => (this.isLoadingThreads = false));
3569
+ }
3085
3570
  async sendMessageToServer(e, message) {
3086
3571
  e.preventDefault();
3087
3572
  e.stopPropagation();
@@ -3133,7 +3618,10 @@ let ShopGPT = class ShopGPT extends s {
3133
3618
  overlayMode() {
3134
3619
  const thread = this.chatThreads.get(this.selectedThreadId);
3135
3620
  return x `
3136
- <dialog id="shop-gpt-dialog-overlay">
3621
+ <dialog
3622
+ id="shop-gpt-dialog-overlay"
3623
+ @delete-thread=${this.handleThreadDelete}
3624
+ >
3137
3625
  <div class="mobile-version">
3138
3626
  Please switch to the desktop version for the best experience.
3139
3627
  </div>
@@ -3187,7 +3675,7 @@ let ShopGPT = class ShopGPT extends s {
3187
3675
  </div>`;
3188
3676
  }
3189
3677
  return x `
3190
- <div id="shop-gpt-modal">
3678
+ <div id="shop-gpt-modal" @delete-thread=${this.handleThreadDelete}>
3191
3679
  <chat-section
3192
3680
  .isFailed=${this.isFailed}
3193
3681
  .isLoadingHistory=${this.isLoadingHistory}
@@ -3211,47 +3699,47 @@ let ShopGPT = class ShopGPT extends s {
3211
3699
  };
3212
3700
  ShopGPT.styles = [shopGPTStyles];
3213
3701
  __decorate([
3214
- e$2('#shop-gpt-dialog-overlay'),
3702
+ e$4('#shop-gpt-dialog-overlay'),
3215
3703
  __metadata("design:type", Object)
3216
3704
  ], ShopGPT.prototype, "shopGPTDialog", void 0);
3217
3705
  __decorate([
3218
- n({ type: String }),
3706
+ n$1({ type: String }),
3219
3707
  __metadata("design:type", String)
3220
3708
  ], ShopGPT.prototype, "modalState", void 0);
3221
3709
  __decorate([
3222
- n({ type: Boolean }),
3710
+ n$1({ type: Boolean }),
3223
3711
  __metadata("design:type", Boolean)
3224
3712
  ], ShopGPT.prototype, "isLoadingHistory", void 0);
3225
3713
  __decorate([
3226
- n({ type: Boolean }),
3714
+ n$1({ type: Boolean }),
3227
3715
  __metadata("design:type", Boolean)
3228
3716
  ], ShopGPT.prototype, "isLoadingThreads", void 0);
3229
3717
  __decorate([
3230
- n({ type: Boolean }),
3718
+ n$1({ type: Boolean }),
3231
3719
  __metadata("design:type", Boolean)
3232
3720
  ], ShopGPT.prototype, "isTyping", void 0);
3233
3721
  __decorate([
3234
- n({ type: Boolean }),
3722
+ n$1({ type: Boolean }),
3235
3723
  __metadata("design:type", Boolean)
3236
3724
  ], ShopGPT.prototype, "isFailed", void 0);
3237
3725
  __decorate([
3238
- n({ type: String }),
3726
+ n$1({ type: String }),
3239
3727
  __metadata("design:type", String)
3240
3728
  ], ShopGPT.prototype, "selectedThreadId", void 0);
3241
3729
  __decorate([
3242
- n({ type: Array }),
3730
+ n$1({ type: Array }),
3243
3731
  __metadata("design:type", Array)
3244
3732
  ], ShopGPT.prototype, "products", void 0);
3245
3733
  __decorate([
3246
- n({ type: Array }),
3734
+ n$1({ type: Array }),
3247
3735
  __metadata("design:type", Array)
3248
3736
  ], ShopGPT.prototype, "messages", void 0);
3249
3737
  __decorate([
3250
- n({ type: Object }),
3738
+ n$1({ type: Object }),
3251
3739
  __metadata("design:type", Map)
3252
3740
  ], ShopGPT.prototype, "chatThreads", void 0);
3253
3741
  ShopGPT = __decorate([
3254
- t$1('shop-gpt')
3742
+ t$2('shop-gpt')
3255
3743
  ], ShopGPT);
3256
3744
 
3257
3745
  var _a, _b;