@blotoutio/providers-shop-gpt-sdk 1.1.0 → 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 +633 -143
  2. package/index.js +633 -143
  3. package/index.mjs +633 -143
  4. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -429,11 +429,34 @@ const createShopGPTAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, st
429
429
  const data = (await response.json());
430
430
  return data;
431
431
  };
432
+ const deleteSingleThread = async (threadId) => {
433
+ const response = await fetchImpl(getURL('/thread'), {
434
+ method: 'DELETE',
435
+ headers: getHeaders(),
436
+ credentials: 'include',
437
+ body: JSON.stringify({ threadId }),
438
+ });
439
+ if (!response.ok) {
440
+ throw new Error(`Failed to delete chat threads - ${response.status}: ${await response.text()}`);
441
+ }
442
+ };
443
+ const deleteAllThreads = async () => {
444
+ const response = await fetchImpl(getURL('/delete-threads'), {
445
+ method: 'DELETE',
446
+ headers: getHeaders(),
447
+ credentials: 'include',
448
+ });
449
+ if (!response.ok) {
450
+ throw new Error(`Failed to delete all chat threads - ${response.status}: ${await response.text()}`);
451
+ }
452
+ };
432
453
  return {
433
454
  processQuery,
434
455
  fetchChatHistory,
435
456
  fetchChatThreads,
436
457
  createChatThread,
458
+ deleteSingleThread,
459
+ deleteAllThreads,
437
460
  };
438
461
  };
439
462
 
@@ -550,52 +573,58 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
550
573
  * Copyright 2019 Google LLC
551
574
  * SPDX-License-Identifier: BSD-3-Clause
552
575
  */
553
- 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;
576
+ 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;
554
577
 
555
578
  /**
556
579
  * @license
557
580
  * Copyright 2017 Google LLC
558
581
  * SPDX-License-Identifier: BSD-3-Clause
559
- */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");
582
+ */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");
560
583
 
561
584
  /**
562
585
  * @license
563
586
  * Copyright 2017 Google LLC
564
587
  * SPDX-License-Identifier: BSD-3-Clause
565
588
  */
566
- 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};
589
+ 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};
567
590
 
568
591
  /**
569
592
  * @license
570
593
  * Copyright 2017 Google LLC
571
594
  * SPDX-License-Identifier: BSD-3-Clause
572
- */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");
595
+ */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");
573
596
 
574
597
  /**
575
598
  * @license
576
599
  * Copyright 2017 Google LLC
577
600
  * SPDX-License-Identifier: BSD-3-Clause
578
601
  */
579
- const t$1=t=>(e,o)=>{void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
602
+ const t$2=t=>(e,o)=>{void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
580
603
 
581
604
  /**
582
605
  * @license
583
606
  * Copyright 2017 Google LLC
584
607
  * SPDX-License-Identifier: BSD-3-Clause
585
- */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)}
608
+ */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)}
609
+
610
+ /**
611
+ * @license
612
+ * Copyright 2017 Google LLC
613
+ * SPDX-License-Identifier: BSD-3-Clause
614
+ */function r$1(r){return n$1({...r,state:!0,attribute:!1})}
586
615
 
587
616
  /**
588
617
  * @license
589
618
  * Copyright 2017 Google LLC
590
619
  * SPDX-License-Identifier: BSD-3-Clause
591
620
  */
592
- const e$3=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
621
+ const e$5=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
593
622
 
594
623
  /**
595
624
  * @license
596
625
  * Copyright 2017 Google LLC
597
626
  * SPDX-License-Identifier: BSD-3-Clause
598
- */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)}})}}
627
+ */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)}})}}
599
628
 
600
629
  const scrollBarStyles = i$3 `
601
630
  ::-webkit-scrollbar {
@@ -645,7 +674,6 @@ const shopGPTStyles = i$3 `
645
674
  bottom: 28px;
646
675
  height: 80%;
647
676
  width: 35%;
648
- min-height: 620px;
649
677
  min-width: 475px;
650
678
  border-radius: 10px;
651
679
  overflow: hidden;
@@ -729,20 +757,20 @@ const shopGPTStyles = i$3 `
729
757
  * Copyright 2017 Google LLC
730
758
  * SPDX-License-Identifier: BSD-3-Clause
731
759
  */
732
- 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)}}
760
+ 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)}}
733
761
 
734
762
  /**
735
763
  * @license
736
764
  * Copyright 2018 Google LLC
737
765
  * SPDX-License-Identifier: BSD-3-Clause
738
- */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}});
766
+ */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}});
739
767
 
740
768
  /**
741
769
  * @license
742
770
  * Copyright 2021 Google LLC
743
771
  * SPDX-License-Identifier: BSD-3-Clause
744
772
  */
745
- function*o(o,f){if(void 0!==o){let i=0;for(const t of o)yield f(t,i++);}}
773
+ function*o$1(o,f){if(void 0!==o){let i=0;for(const t of o)yield f(t,i++);}}
746
774
 
747
775
  const sendFilledIcon = b `
748
776
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
@@ -756,6 +784,9 @@ const sendFilledIcon = b `
756
784
  </defs>
757
785
  </svg>
758
786
  `;
787
+ const trashIcon = b `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
788
+ <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"/>
789
+ </svg>`;
759
790
  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>`;
760
791
  const botIcon = b `
761
792
  <svg xmlns="http://www.w3.org/2000/svg" width="12" height="18" viewBox="0 0 12 18" fill="none">
@@ -896,6 +927,37 @@ const chatThreadsStyles = i$3 `
896
927
  flex: 1;
897
928
  overflow-y: auto;
898
929
  overflow-x: hidden;
930
+
931
+ .thread-wrapper {
932
+ display: flex;
933
+ justify-content: space-between;
934
+ align-items: center;
935
+
936
+ .trash-icon {
937
+ display: none;
938
+ padding: 2px;
939
+ cursor: pointer;
940
+
941
+ &:hover {
942
+ border-radius: 5px;
943
+ background: #dc3545;
944
+
945
+ path {
946
+ fill: white;
947
+ }
948
+ }
949
+ }
950
+
951
+ &:hover {
952
+ background: #f1f4f880;
953
+
954
+ .trash-icon {
955
+ display: flex;
956
+ justify-content: center;
957
+ align-items: center;
958
+ }
959
+ }
960
+ }
899
961
  }
900
962
 
901
963
  .thread-title {
@@ -905,12 +967,12 @@ const chatThreadsStyles = i$3 `
905
967
  cursor: pointer;
906
968
  }
907
969
 
908
- .thread-title.active {
970
+ .thread-wrapper.active {
909
971
  border-radius: 5px;
910
972
  background: #f1f4f8;
911
973
  }
912
974
 
913
- .thread-title.disabled {
975
+ .thread-wrapper.disabled {
914
976
  cursor: not-allowed;
915
977
  }
916
978
  }
@@ -973,13 +1035,31 @@ LoadSpinner.styles = [
973
1035
  `,
974
1036
  ];
975
1037
  LoadSpinner = __decorate([
976
- t$1('load-spinner')
1038
+ t$2('load-spinner')
977
1039
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
978
1040
  ], LoadSpinner);
979
1041
 
980
1042
  let ChatThreads =
981
1043
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
982
1044
  class ChatThreads extends s {
1045
+ getDomain() {
1046
+ var _a;
1047
+ if ((_a = this.merchantUrl) === null || _a === void 0 ? void 0 : _a.startsWith('https://')) {
1048
+ return this.merchantUrl;
1049
+ }
1050
+ return `https://${this.merchantUrl}`;
1051
+ }
1052
+ handleThreadDelete() {
1053
+ if (!this.deleteThreadId) {
1054
+ return;
1055
+ }
1056
+ this.dispatchEvent(new CustomEvent('delete-thread', {
1057
+ detail: { threadId: this.deleteThreadId },
1058
+ composed: true,
1059
+ bubbles: true,
1060
+ }));
1061
+ this.deleteThreadId = '';
1062
+ }
983
1063
  renderChatThreads() {
984
1064
  if (this.isLoading) {
985
1065
  return x `<div class="history">
@@ -992,21 +1072,36 @@ class ChatThreads extends s {
992
1072
  <p class="title">History</p>
993
1073
  ${this.chatThreads.size
994
1074
  ? x `<div class="threads">
995
- ${o(this.chatThreads.values(), (thread) => x `
1075
+ ${o$1(this.chatThreads.values(), (thread) => x `
996
1076
  <div
997
- class=${e({
998
- 'thread-title': true,
1077
+ class=${e$2({
1078
+ 'thread-wrapper': true,
999
1079
  active: this.selectedThreadId === thread.threadId,
1000
1080
  disabled: this.isTyping,
1001
1081
  })}
1002
- @click=${async () => {
1082
+ >
1083
+ <div
1084
+ class="thread-title"
1085
+ @click=${async () => {
1003
1086
  if (this.isLoading || this.isTyping) {
1004
1087
  return;
1005
1088
  }
1006
1089
  await this.setSelectedThreadId(thread.threadId);
1007
1090
  }}
1008
- >
1009
- ${thread.title || 'New Search'}
1091
+ >
1092
+ ${thread.title || 'New Search'}
1093
+ </div>
1094
+ <div
1095
+ class="trash-icon"
1096
+ @click=${() => {
1097
+ if (this.isLoading || this.isTyping) {
1098
+ return;
1099
+ }
1100
+ this.deleteThreadId = thread.threadId;
1101
+ }}
1102
+ >
1103
+ ${trashIcon}
1104
+ </div>
1010
1105
  </div>
1011
1106
  `)}
1012
1107
  </div>`
@@ -1014,13 +1109,6 @@ class ChatThreads extends s {
1014
1109
  </div>
1015
1110
  `;
1016
1111
  }
1017
- getDomain() {
1018
- var _a;
1019
- if ((_a = this.merchantUrl) === null || _a === void 0 ? void 0 : _a.startsWith('https://')) {
1020
- return this.merchantUrl;
1021
- }
1022
- return `https://${this.merchantUrl}`;
1023
- }
1024
1112
  render() {
1025
1113
  return x `
1026
1114
  <div class="shop-gpt-icon">${shopGPTIcon}</div>
@@ -1040,32 +1128,50 @@ class ChatThreads extends s {
1040
1128
  </a>
1041
1129
  </div>`
1042
1130
  : T}
1131
+ ${this.deleteThreadId
1132
+ ? x `
1133
+ <confirm-dialog
1134
+ @accept=${this.handleThreadDelete}
1135
+ @decline=${() => (this.deleteThreadId = '')}
1136
+ >
1137
+ <h2 slot="title">Delete Thread?</h2>
1138
+ <p slot="content">
1139
+ This action cannot be undone. Are you sure you want to delete
1140
+ <b>"${this.chatThreads.get(this.deleteThreadId).title}"</b>?
1141
+ </p>
1142
+ </confirm-dialog>
1143
+ `
1144
+ : T}
1043
1145
  `;
1044
1146
  }
1045
1147
  };
1046
1148
  ChatThreads.styles = [chatThreadsStyles];
1047
1149
  __decorate([
1048
- n({ type: Object }),
1150
+ n$1({ type: Object }),
1049
1151
  __metadata("design:type", Map)
1050
1152
  ], ChatThreads.prototype, "chatThreads", void 0);
1051
1153
  __decorate([
1052
- n({ type: String }),
1154
+ n$1({ type: String }),
1053
1155
  __metadata("design:type", Object)
1054
1156
  ], ChatThreads.prototype, "merchantUrl", void 0);
1055
1157
  __decorate([
1056
- n({ type: Boolean }),
1158
+ n$1({ type: Boolean }),
1057
1159
  __metadata("design:type", Boolean)
1058
1160
  ], ChatThreads.prototype, "isLoading", void 0);
1059
1161
  __decorate([
1060
- n({ type: Boolean }),
1162
+ n$1({ type: Boolean }),
1061
1163
  __metadata("design:type", Boolean)
1062
1164
  ], ChatThreads.prototype, "isTyping", void 0);
1063
1165
  __decorate([
1064
- n({ type: String }),
1166
+ n$1({ type: String }),
1065
1167
  __metadata("design:type", String)
1066
1168
  ], ChatThreads.prototype, "selectedThreadId", void 0);
1169
+ __decorate([
1170
+ r$1(),
1171
+ __metadata("design:type", String)
1172
+ ], ChatThreads.prototype, "deleteThreadId", void 0);
1067
1173
  ChatThreads = __decorate([
1068
- t$1('chat-threads')
1174
+ t$2('chat-threads')
1069
1175
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1070
1176
  ], ChatThreads);
1071
1177
 
@@ -1267,6 +1373,14 @@ class ProductItem extends s {
1267
1373
  }
1268
1374
  (_a = open(url, '_blank')) === null || _a === void 0 ? void 0 : _a.focus();
1269
1375
  }
1376
+ renderVariantTitles() {
1377
+ if (!this.product.hasVariantsThatRequiresComponents) {
1378
+ return T;
1379
+ }
1380
+ return this.product.variants[0].selectedOptions.map((option) => x `
1381
+ <p class="product-variation-details">${option.name}: ${option.value}</p>
1382
+ `);
1383
+ }
1270
1384
  render() {
1271
1385
  return x `
1272
1386
  <div class="product">
@@ -1283,11 +1397,7 @@ class ProductItem extends s {
1283
1397
  >
1284
1398
  ${this.product.title}
1285
1399
  </p>
1286
- ${this.product.variants[0].selectedOptions.map((option) => x `
1287
- <p class="product-variation-details">
1288
- ${option.name}: ${option.value}
1289
- </p>
1290
- `)}
1400
+ ${this.renderVariantTitles()}
1291
1401
  <div class="prices">
1292
1402
  ${this.product.variants[0].comparedAtPrice &&
1293
1403
  this.product.variants[0].comparedAtPrice !==
@@ -1311,15 +1421,15 @@ class ProductItem extends s {
1311
1421
  };
1312
1422
  ProductItem.styles = [productItemStyles];
1313
1423
  __decorate([
1314
- n({ type: Object }),
1424
+ n$1({ type: Object }),
1315
1425
  __metadata("design:type", Object)
1316
1426
  ], ProductItem.prototype, "product", void 0);
1317
1427
  __decorate([
1318
- n({ type: Object }),
1428
+ n$1({ type: Object }),
1319
1429
  __metadata("design:type", Object)
1320
1430
  ], ProductItem.prototype, "siteCurrency", void 0);
1321
1431
  ProductItem = __decorate([
1322
- t$1('product-item')
1432
+ t$2('product-item')
1323
1433
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1324
1434
  ], ProductItem);
1325
1435
 
@@ -1408,12 +1518,15 @@ class ProductsList extends s {
1408
1518
  (_a = this.productsEle) === null || _a === void 0 ? void 0 : _a.scrollBy({ left: 186, behavior: 'smooth' });
1409
1519
  }
1410
1520
  render() {
1521
+ if (!this.products.length) {
1522
+ return T;
1523
+ }
1411
1524
  return x `
1412
1525
  <div class="products-wrapper">
1413
1526
  <div class="products" @scroll=${this.updateButtonsState}>
1414
- ${o(this.products, (product) => x `
1527
+ ${o$1(this.products, (product) => x `
1415
1528
  <div
1416
- class=${e({
1529
+ class=${e$2({
1417
1530
  'product-container': true,
1418
1531
  modal: this.viewType === 'modal',
1419
1532
  })}
@@ -1437,27 +1550,27 @@ class ProductsList extends s {
1437
1550
  };
1438
1551
  ProductsList.styles = [productsListStyles];
1439
1552
  __decorate([
1440
- n({ type: Array }),
1553
+ n$1({ type: Array }),
1441
1554
  __metadata("design:type", Array)
1442
1555
  ], ProductsList.prototype, "products", void 0);
1443
1556
  __decorate([
1444
- n({ type: Object }),
1557
+ n$1({ type: Object }),
1445
1558
  __metadata("design:type", Object)
1446
1559
  ], ProductsList.prototype, "siteCurrency", void 0);
1447
1560
  __decorate([
1448
- e$2('.left-btn'),
1561
+ e$4('.left-btn'),
1449
1562
  __metadata("design:type", Object)
1450
1563
  ], ProductsList.prototype, "leftBtnEle", void 0);
1451
1564
  __decorate([
1452
- e$2('.right-btn'),
1565
+ e$4('.right-btn'),
1453
1566
  __metadata("design:type", Object)
1454
1567
  ], ProductsList.prototype, "rightBtnEle", void 0);
1455
1568
  __decorate([
1456
- e$2('.products'),
1569
+ e$4('.products'),
1457
1570
  __metadata("design:type", Object)
1458
1571
  ], ProductsList.prototype, "productsEle", void 0);
1459
1572
  ProductsList = __decorate([
1460
- t$1('products-list')
1573
+ t$2('products-list')
1461
1574
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1462
1575
  ], ProductsList);
1463
1576
 
@@ -1505,31 +1618,31 @@ class ProductsSection extends s {
1505
1618
  };
1506
1619
  ProductsSection.styles = [productsSectionStyles];
1507
1620
  __decorate([
1508
- n({ type: Array }),
1621
+ n$1({ type: Array }),
1509
1622
  __metadata("design:type", Array)
1510
1623
  ], ProductsSection.prototype, "products", void 0);
1511
1624
  __decorate([
1512
- n({ type: Boolean }),
1625
+ n$1({ type: Boolean }),
1513
1626
  __metadata("design:type", Boolean)
1514
1627
  ], ProductsSection.prototype, "isLoadingHistory", void 0);
1515
1628
  __decorate([
1516
- n({ type: Object }),
1629
+ n$1({ type: Object }),
1517
1630
  __metadata("design:type", Object)
1518
1631
  ], ProductsSection.prototype, "siteCurrency", void 0);
1519
1632
  __decorate([
1520
- e$2('.left-btn'),
1633
+ e$4('.left-btn'),
1521
1634
  __metadata("design:type", Object)
1522
1635
  ], ProductsSection.prototype, "leftBtnEle", void 0);
1523
1636
  __decorate([
1524
- e$2('.right-btn'),
1637
+ e$4('.right-btn'),
1525
1638
  __metadata("design:type", Object)
1526
1639
  ], ProductsSection.prototype, "rightBtnEle", void 0);
1527
1640
  __decorate([
1528
- e$2('.products'),
1641
+ e$4('.products'),
1529
1642
  __metadata("design:type", Object)
1530
1643
  ], ProductsSection.prototype, "productsEle", void 0);
1531
1644
  ProductsSection = __decorate([
1532
- t$1('products-section')
1645
+ t$2('products-section')
1533
1646
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1534
1647
  ], ProductsSection);
1535
1648
 
@@ -1570,6 +1683,9 @@ const chatSectionStyles = i$3 `
1570
1683
  font-weight: 600;
1571
1684
  line-height: 21px;
1572
1685
  text-transform: capitalize;
1686
+ white-space: nowrap;
1687
+ overflow: hidden;
1688
+ text-overflow: ellipsis;
1573
1689
  }
1574
1690
 
1575
1691
  .btn-context {
@@ -1708,6 +1824,10 @@ const chatSectionStyles = i$3 `
1708
1824
  gap: 28px;
1709
1825
  padding-bottom: 10px;
1710
1826
  margin-bottom: -10px;
1827
+
1828
+ .message:last-child {
1829
+ margin-top: 10px;
1830
+ }
1711
1831
  }
1712
1832
 
1713
1833
  .message {
@@ -1925,15 +2045,28 @@ const chatSectionStyles = i$3 `
1925
2045
  }
1926
2046
 
1927
2047
  .thread-title {
2048
+ display: flex;
2049
+ justify-content: space-between;
1928
2050
  padding: 10px 16px;
1929
2051
  color: #4e647f;
1930
- font-size: 14px;
1931
- font-weight: 400;
1932
- line-height: 20px;
1933
2052
  cursor: pointer;
1934
2053
 
2054
+ p {
2055
+ font-size: 14px;
2056
+ font-weight: 400;
2057
+ line-height: 20px;
2058
+ }
2059
+
2060
+ .trash-icon {
2061
+ display: none;
2062
+ }
2063
+
1935
2064
  &:hover {
1936
2065
  background: #f1f4f8;
2066
+
2067
+ .trash-icon {
2068
+ display: flex;
2069
+ }
1937
2070
  }
1938
2071
  }
1939
2072
 
@@ -1942,6 +2075,23 @@ const chatSectionStyles = i$3 `
1942
2075
  }
1943
2076
  }
1944
2077
 
2078
+ .trash-icon {
2079
+ display: flex;
2080
+ justify-content: center;
2081
+ align-items: center;
2082
+ padding: 2px;
2083
+ cursor: pointer;
2084
+
2085
+ &:hover {
2086
+ border-radius: 5px;
2087
+ background: #dc3545;
2088
+
2089
+ path {
2090
+ fill: white;
2091
+ }
2092
+ }
2093
+ }
2094
+
1945
2095
  .chat-threads-background {
1946
2096
  position: absolute;
1947
2097
  top: 78px;
@@ -1960,6 +2110,16 @@ const capitalizeEachWord = (str) => {
1960
2110
  return str === null || str === void 0 ? void 0 : str.replace(/^\w/, (char) => char.toUpperCase());
1961
2111
  };
1962
2112
 
2113
+ const plusBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
2114
+ <path d="M12.75 11.25V6H11.25V11.25H6V12.75H11.25V18H12.75V12.75H18V11.25H12.75Z" fill="white"/>
2115
+ </svg>`;
2116
+ const timerBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
2117
+ <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"/>
2118
+ </svg>`;
2119
+ const crossBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
2120
+ <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"/>
2121
+ </svg>`;
2122
+
1963
2123
  const personalizeDialogStyles = i$3 `
1964
2124
  :host {
1965
2125
  font-family: 'Inter', sans-serif;
@@ -2446,63 +2606,318 @@ class PersonalizeDialog extends s {
2446
2606
  };
2447
2607
  PersonalizeDialog.styles = [personalizeDialogStyles];
2448
2608
  __decorate([
2449
- e$2('dialog'),
2609
+ e$4('dialog'),
2450
2610
  __metadata("design:type", HTMLDialogElement)
2451
2611
  ], PersonalizeDialog.prototype, "dialogModal", void 0);
2452
2612
  __decorate([
2453
- e$2('.dropdown-list'),
2613
+ e$4('.dropdown-list'),
2454
2614
  __metadata("design:type", HTMLUListElement)
2455
2615
  ], PersonalizeDialog.prototype, "dropdownList", void 0);
2456
2616
  __decorate([
2457
- e$2('.dropdown-trigger'),
2617
+ e$4('.dropdown-trigger'),
2458
2618
  __metadata("design:type", HTMLDivElement)
2459
2619
  ], PersonalizeDialog.prototype, "dropdownTrigger", void 0);
2460
2620
  __decorate([
2461
- n({ type: Array }),
2621
+ n$1({ type: Array }),
2462
2622
  __metadata("design:type", Array)
2463
2623
  ], PersonalizeDialog.prototype, "defaultProductHandles", void 0);
2464
2624
  __decorate([
2465
- n({ type: Array }),
2625
+ n$1({ type: Array }),
2466
2626
  __metadata("design:type", Array)
2467
2627
  ], PersonalizeDialog.prototype, "defaultProfiles", void 0);
2468
2628
  __decorate([
2469
- n({ type: Boolean }),
2629
+ n$1({ type: Boolean }),
2470
2630
  __metadata("design:type", Boolean)
2471
2631
  ], PersonalizeDialog.prototype, "isLoading", void 0);
2472
2632
  __decorate([
2473
- n({ type: String }),
2633
+ n$1({ type: String }),
2474
2634
  __metadata("design:type", Object)
2475
2635
  ], PersonalizeDialog.prototype, "state", void 0);
2476
2636
  __decorate([
2477
- n({ type: String }),
2637
+ n$1({ type: String }),
2478
2638
  __metadata("design:type", Object)
2479
2639
  ], PersonalizeDialog.prototype, "profileType", void 0);
2480
2640
  __decorate([
2481
- n({ type: String }),
2641
+ n$1({ type: String }),
2482
2642
  __metadata("design:type", Object)
2483
2643
  ], PersonalizeDialog.prototype, "selectedProfile", void 0);
2484
2644
  __decorate([
2485
- n({ type: String }),
2645
+ n$1({ type: String }),
2486
2646
  __metadata("design:type", Object)
2487
2647
  ], PersonalizeDialog.prototype, "visitorType", void 0);
2488
2648
  __decorate([
2489
- n({ type: String }),
2649
+ n$1({ type: String }),
2490
2650
  __metadata("design:type", Object)
2491
2651
  ], PersonalizeDialog.prototype, "productHandle", void 0);
2492
2652
  PersonalizeDialog = __decorate([
2493
- t$1('personalize-dialog')
2653
+ t$2('personalize-dialog')
2494
2654
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2495
2655
  ], PersonalizeDialog);
2496
2656
 
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>`;
2657
+ /**
2658
+ * @license
2659
+ * Copyright 2017 Google LLC
2660
+ * SPDX-License-Identifier: BSD-3-Clause
2661
+ */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);
2662
+
2663
+ 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,"")}
2664
+
2665
+ let MarkdownRenderer =
2666
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2667
+ class MarkdownRenderer extends s {
2668
+ render() {
2669
+ const slotContent = this.innerHTML.trim();
2670
+ const parsedContent = t(slotContent);
2671
+ return o(parsedContent);
2672
+ }
2673
+ };
2674
+ MarkdownRenderer.styles = i$3 `
2675
+ :host {
2676
+ font-family: 'Inter', sans-serif;
2677
+ font-size: 16px;
2678
+ font-weight: 400;
2679
+
2680
+ p {
2681
+ margin: 0;
2682
+ }
2683
+ }
2684
+ `;
2685
+ MarkdownRenderer = __decorate([
2686
+ t$2('markdown-renderer')
2687
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2688
+ ], MarkdownRenderer);
2689
+
2690
+ let TooltipComponent =
2691
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2692
+ class TooltipComponent extends s {
2693
+ constructor() {
2694
+ super(...arguments);
2695
+ this.position = 'bottom-left';
2696
+ this.text = '';
2697
+ }
2698
+ render() {
2699
+ return x `
2700
+ <slot></slot>
2701
+ <div class="tooltip ${this.position}">${this.text}</div>
2702
+ `;
2703
+ }
2704
+ };
2705
+ TooltipComponent.styles = [
2706
+ i$3 `
2707
+ :host {
2708
+ position: relative;
2709
+ display: inline-block;
2710
+ }
2711
+ .tooltip {
2712
+ position: absolute;
2713
+ color: #172a41;
2714
+ padding: 4px 8px;
2715
+ border-radius: 4px;
2716
+ white-space: nowrap;
2717
+ font-size: 12px;
2718
+ opacity: 0;
2719
+ transition: opacity 0.2s;
2720
+ pointer-events: none;
2721
+
2722
+ border-radius: 5px;
2723
+ background: #ffcc81;
2724
+ box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1),
2725
+ 0px 2px 4px -1px rgba(0, 0, 0, 0.06);
2726
+
2727
+ font-style: normal;
2728
+ font-weight: 400;
2729
+ line-height: 150%;
2730
+ }
2731
+ :host(:hover) .tooltip {
2732
+ opacity: 1;
2733
+ }
2734
+ .top-center {
2735
+ bottom: calc(100% + 2px);
2736
+ left: 50%;
2737
+ transform: translateX(-50%);
2738
+ }
2739
+ .top-left {
2740
+ bottom: calc(100% + 2px);
2741
+ left: 0;
2742
+ }
2743
+ .top-right {
2744
+ bottom: calc(100% + 2px);
2745
+ right: 0;
2746
+ }
2747
+ .bottom-center {
2748
+ top: calc(100% + 2px);
2749
+ left: 50%;
2750
+ transform: translateX(-50%);
2751
+ }
2752
+ .bottom-left {
2753
+ top: calc(100% + 2px);
2754
+ left: 0;
2755
+ }
2756
+ .bottom-right {
2757
+ top: calc(100% + 2px);
2758
+ right: 0;
2759
+ }
2760
+ .left-center {
2761
+ right: calc(100% + 2px);
2762
+ top: 50%;
2763
+ transform: translateY(-50%);
2764
+ }
2765
+ .left-top {
2766
+ right: calc(100% + 2px);
2767
+ top: 0;
2768
+ }
2769
+ .left-bottom {
2770
+ right: calc(100% + 2px);
2771
+ bottom: 0;
2772
+ }
2773
+ .right-center {
2774
+ left: calc(100% + 2px);
2775
+ top: 50%;
2776
+ transform: translateY(-50%);
2777
+ }
2778
+ .right-top {
2779
+ left: calc(100% + 2px);
2780
+ top: 0;
2781
+ }
2782
+ .right-bottom {
2783
+ left: calc(100% + 2px);
2784
+ bottom: 0;
2785
+ }
2786
+ `,
2787
+ ];
2788
+ __decorate([
2789
+ n$1({ type: String }),
2790
+ __metadata("design:type", String)
2791
+ ], TooltipComponent.prototype, "position", void 0);
2792
+ __decorate([
2793
+ n$1({ type: String }),
2794
+ __metadata("design:type", String)
2795
+ ], TooltipComponent.prototype, "text", void 0);
2796
+ TooltipComponent = __decorate([
2797
+ t$2('tooltip-component')
2798
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2799
+ ], TooltipComponent);
2800
+
2801
+ const confirmDialogStyles = i$3 `
2802
+ :host {
2803
+ font-family: 'Inter', sans-serif;
2804
+ font-size: 16px;
2805
+ font-weight: 400;
2806
+
2807
+ display: flex;
2808
+ position: absolute;
2809
+ top: 0;
2810
+ left: 0;
2811
+ width: 100%;
2812
+ height: 100%;
2813
+ background: #00000050;
2814
+ }
2815
+
2816
+ .modal {
2817
+ width: 75%;
2818
+ max-width: 350px;
2819
+ background: #fff;
2820
+ padding: 16px;
2821
+ margin: auto;
2822
+
2823
+ border-radius: 10px;
2824
+ box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.12),
2825
+ 0px 20px 20px 0px rgba(0, 0, 0, 0.08);
2826
+
2827
+ z-index: 2000;
2828
+ }
2829
+
2830
+ ::slotted([slot='title']) {
2831
+ margin-bottom: 8px !important;
2832
+ color: #172a41;
2833
+ font-size: 18px;
2834
+ font-weight: 700;
2835
+ line-height: 150%;
2836
+ }
2837
+
2838
+ ::slotted([slot='content']) {
2839
+ color: #4e647f;
2840
+ line-height: 150%;
2841
+ }
2842
+
2843
+ .button-wrapper {
2844
+ margin-top: 12px;
2845
+ display: flex;
2846
+ gap: 12px;
2847
+
2848
+ .btn {
2849
+ justify-self: stretch;
2850
+ padding: 10px;
2851
+ cursor: pointer;
2852
+ text-align: center;
2853
+ width: 100%;
2854
+ border: 0;
2855
+ color: #fff;
2856
+ line-height: 150%;
2857
+ text-transform: capitalize;
2858
+ }
2859
+
2860
+ .accept-btn {
2861
+ border-radius: 5px;
2862
+ background: #dc3545;
2863
+
2864
+ &:hover {
2865
+ background: rgb(176, 62, 25);
2866
+ }
2867
+ }
2868
+
2869
+ .decline-btn {
2870
+ border-radius: 5px;
2871
+ background: #4e647f;
2872
+
2873
+ &:hover {
2874
+ background: rgb(57, 77, 102);
2875
+ }
2876
+ }
2877
+ }
2878
+ `;
2879
+
2880
+ let ConfirmDialog =
2881
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2882
+ class ConfirmDialog extends s {
2883
+ onAcceptClick(e) {
2884
+ e.preventDefault();
2885
+ this.dispatchEvent(new CustomEvent('accept', {
2886
+ composed: true,
2887
+ }));
2888
+ }
2889
+ onCancelClick(e) {
2890
+ e.preventDefault();
2891
+ this.dispatchEvent(new CustomEvent('decline', {
2892
+ composed: true,
2893
+ }));
2894
+ }
2895
+ render() {
2896
+ return x `
2897
+ <div class="modal">
2898
+ <slot name="title"></slot>
2899
+ <slot name="content"></slot>
2900
+ <div class="button-wrapper">
2901
+ <slot name="accept-btn">
2902
+ <button class="btn accept-btn" @click=${this.onAcceptClick}>
2903
+ Delete
2904
+ </button>
2905
+ </slot>
2906
+ <slot name="decline-btn">
2907
+ <button class="btn decline-btn" @click=${this.onCancelClick}>
2908
+ Cancel
2909
+ </button>
2910
+ </slot>
2911
+ </div>
2912
+ </div>
2913
+ `;
2914
+ }
2915
+ };
2916
+ ConfirmDialog.styles = [confirmDialogStyles];
2917
+ ConfirmDialog = __decorate([
2918
+ t$2('confirm-dialog')
2919
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2920
+ ], ConfirmDialog);
2506
2921
 
2507
2922
  let ChatSection =
2508
2923
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -2533,6 +2948,17 @@ class ChatSection extends s {
2533
2948
  this.userQuery = '';
2534
2949
  await this.processMessage(e, message);
2535
2950
  }
2951
+ handleThreadDelete() {
2952
+ if (!this.deleteThreadId) {
2953
+ return;
2954
+ }
2955
+ this.dispatchEvent(new CustomEvent('delete-thread', {
2956
+ detail: { threadId: this.deleteThreadId },
2957
+ composed: true,
2958
+ bubbles: true,
2959
+ }));
2960
+ this.deleteThreadId = '';
2961
+ }
2536
2962
  typingIndicator() {
2537
2963
  return x `<div class="typing-dots">
2538
2964
  <div class="dot"></div>
@@ -2549,7 +2975,9 @@ class ChatSection extends s {
2549
2975
  <div class="bot-icon">${botIcon}</div>
2550
2976
  </div>
2551
2977
  <div>
2552
- ${message.message ? x `<p>${message.message}</p>` : T}
2978
+ ${message.message
2979
+ ? x `<markdown-renderer>${message.message}</markdown-renderer>`
2980
+ : T}
2553
2981
  ${this.viewType !== 'modal' && ((_a = message.products) === null || _a === void 0 ? void 0 : _a[0])
2554
2982
  ? x `
2555
2983
  <span class="line"></span>
@@ -2714,37 +3142,49 @@ class ChatSection extends s {
2714
3142
  <div>${botIcon}</div>
2715
3143
  <h2>${((_a = this.thread) === null || _a === void 0 ? void 0 : _a.title) || 'New Search'}</h2>
2716
3144
  <div class="btns-wrapper">
2717
- <button
2718
- class="btn btn-icon new-search-btn"
2719
- title="New chat"
2720
- @click=${async () => {
3145
+ <tooltip-component .position=${'bottom-right'} .text=${'New Chat'}>
3146
+ <button
3147
+ class="btn btn-icon new-search-btn"
3148
+ @click=${(e) => {
2721
3149
  var _a;
2722
- await ((_a = this.setSelectedThreadId) === null || _a === void 0 ? void 0 : _a.call(this, ''));
3150
+ e.preventDefault();
3151
+ (_a = this.setSelectedThreadId) === null || _a === void 0 ? void 0 : _a.call(this, '');
2723
3152
  }}
3153
+ >
3154
+ ${plusBtn}
3155
+ </button>
3156
+ </tooltip-component>
3157
+ <tooltip-component
3158
+ .position=${'bottom-right'}
3159
+ .text=${'Your Search History'}
2724
3160
  >
2725
- ${plusBtn}
2726
- </button>
2727
- <button
2728
- class=${e({
3161
+ <button
3162
+ class=${e$2({
2729
3163
  btn: true,
2730
3164
  'btn-icon': true,
2731
3165
  'threads-btn': true,
2732
3166
  active: this.showChatThreads,
2733
3167
  })}
2734
- title="Your Search History"
2735
- @click=${() => {
3168
+ @click=${(e) => {
3169
+ e.preventDefault();
2736
3170
  this.showChatThreads = !this.showChatThreads;
2737
3171
  }}
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>
3172
+ >
3173
+ ${timerBtn}
3174
+ </button>
3175
+ </tooltip-component>
3176
+ <tooltip-component .position=${'bottom-right'} .text=${'Close Chat'}>
3177
+ <button
3178
+ class="btn btn-icon close-btn"
3179
+ @click=${(e) => {
3180
+ var _a;
3181
+ e.preventDefault();
3182
+ (_a = this.closeModal) === null || _a === void 0 ? void 0 : _a.call(this);
3183
+ }}
3184
+ >
3185
+ ${crossBtn}
3186
+ </button>
3187
+ </tooltip-component>
2748
3188
  </div>
2749
3189
  `;
2750
3190
  }
@@ -2793,23 +3233,38 @@ class ChatSection extends s {
2793
3233
  <div class="chat-threads">
2794
3234
  <h2>Your Search History</h2>
2795
3235
  <div class="thread-titles-wrapper">
2796
- ${o(this.chatThreads.values(), (thread) => x `
2797
- <p
2798
- class=${e({
3236
+ ${o$1(this.chatThreads.values(), (thread) => x `
3237
+ <div
3238
+ class=${e$2({
2799
3239
  'thread-title': true,
2800
3240
  disabled: this.isTyping,
2801
3241
  })}
2802
- @click=${async () => {
3242
+ >
3243
+ <p
3244
+ @click=${() => {
2803
3245
  var _a;
2804
3246
  if (this.isTyping) {
2805
3247
  return;
2806
3248
  }
2807
3249
  this.showChatThreads = false;
2808
- await ((_a = this.setSelectedThreadId) === null || _a === void 0 ? void 0 : _a.call(this, thread.threadId));
3250
+ (_a = this.setSelectedThreadId) === null || _a === void 0 ? void 0 : _a.call(this, thread.threadId);
2809
3251
  }}
2810
- >
2811
- ${thread.title || 'New Search'}
2812
- </p>
3252
+ >
3253
+ ${thread.title || 'New Search'}
3254
+ </p>
3255
+ <div
3256
+ class="trash-icon"
3257
+ @click=${() => {
3258
+ if (this.isTyping) {
3259
+ return;
3260
+ }
3261
+ this.deleteThreadId = thread.threadId;
3262
+ this.showChatThreads = false;
3263
+ }}
3264
+ >
3265
+ ${trashIcon}
3266
+ </div>
3267
+ </div>
2813
3268
  `)}
2814
3269
  </div>
2815
3270
  </div>
@@ -2823,7 +3278,7 @@ class ChatSection extends s {
2823
3278
  return x `
2824
3279
  <div class="chat-header">${this.contextButton()}</div>
2825
3280
  <div
2826
- class=${e({
3281
+ class=${e$2({
2827
3282
  'chatbot-section': true,
2828
3283
  'modal-view': this.viewType === 'modal',
2829
3284
  })}
@@ -2837,7 +3292,7 @@ class ChatSection extends s {
2837
3292
  placeholder="Type your search here..."
2838
3293
  />
2839
3294
  <button
2840
- class=${e({
3295
+ class=${e$2({
2841
3296
  btn: true,
2842
3297
  modal: this.viewType === 'modal',
2843
3298
  })}
@@ -2854,72 +3309,90 @@ class ChatSection extends s {
2854
3309
  .defaultProfiles=${this.profiles}
2855
3310
  ></personalize-dialog>
2856
3311
  ${this.renderChatThreads()}
3312
+ ${this.deleteThreadId
3313
+ ? x `
3314
+ <confirm-dialog
3315
+ @accept=${this.handleThreadDelete}
3316
+ @decline=${() => (this.deleteThreadId = '')}
3317
+ >
3318
+ <h2 slot="title">Delete Thread?</h2>
3319
+ <p slot="content">
3320
+ This action cannot be undone. Are you sure you want to delete
3321
+ <b>"${this.chatThreads.get(this.deleteThreadId).title}"</b>?
3322
+ </p>
3323
+ </confirm-dialog>
3324
+ `
3325
+ : T}
2857
3326
  `;
2858
3327
  }
2859
3328
  };
2860
3329
  ChatSection.styles = [chatSectionStyles];
2861
3330
  __decorate([
2862
- n({ type: Object }),
3331
+ n$1({ type: Object }),
2863
3332
  __metadata("design:type", Map)
2864
3333
  ], ChatSection.prototype, "chatThreads", void 0);
2865
3334
  __decorate([
2866
- n({ type: Boolean }),
3335
+ r$1(),
3336
+ __metadata("design:type", String)
3337
+ ], ChatSection.prototype, "deleteThreadId", void 0);
3338
+ __decorate([
3339
+ n$1({ type: Boolean }),
2867
3340
  __metadata("design:type", Boolean)
2868
3341
  ], ChatSection.prototype, "showChatThreads", void 0);
2869
3342
  __decorate([
2870
- n({ type: Boolean }),
3343
+ n$1({ type: Boolean }),
2871
3344
  __metadata("design:type", Boolean)
2872
3345
  ], ChatSection.prototype, "isLoadingHistory", void 0);
2873
3346
  __decorate([
2874
- n({ type: Boolean }),
3347
+ n$1({ type: Boolean }),
2875
3348
  __metadata("design:type", Object)
2876
3349
  ], ChatSection.prototype, "devMode", void 0);
2877
3350
  __decorate([
2878
- n({ type: Boolean }),
3351
+ n$1({ type: Boolean }),
2879
3352
  __metadata("design:type", Boolean)
2880
3353
  ], ChatSection.prototype, "isTyping", void 0);
2881
3354
  __decorate([
2882
- n({ type: Boolean }),
3355
+ n$1({ type: Boolean }),
2883
3356
  __metadata("design:type", Boolean)
2884
3357
  ], ChatSection.prototype, "isFailed", void 0);
2885
3358
  __decorate([
2886
- n({ type: Array }),
3359
+ n$1({ type: Array }),
2887
3360
  __metadata("design:type", Array)
2888
3361
  ], ChatSection.prototype, "messages", void 0);
2889
3362
  __decorate([
2890
- n({ type: Array }),
3363
+ n$1({ type: Array }),
2891
3364
  __metadata("design:type", Array)
2892
3365
  ], ChatSection.prototype, "profiles", void 0);
2893
3366
  __decorate([
2894
- n({ type: Array }),
3367
+ n$1({ type: Array }),
2895
3368
  __metadata("design:type", Array)
2896
3369
  ], ChatSection.prototype, "productHandles", void 0);
2897
3370
  __decorate([
2898
- n({ type: Object }),
3371
+ n$1({ type: Object }),
2899
3372
  __metadata("design:type", Object)
2900
3373
  ], ChatSection.prototype, "thread", void 0);
2901
3374
  __decorate([
2902
- n({ type: Object }),
3375
+ n$1({ type: Object }),
2903
3376
  __metadata("design:type", Object)
2904
3377
  ], ChatSection.prototype, "siteCurrency", void 0);
2905
3378
  __decorate([
2906
- e$2('.context-container'),
3379
+ e$4('.context-container'),
2907
3380
  __metadata("design:type", Object)
2908
3381
  ], ChatSection.prototype, "contextContainerElement", void 0);
2909
3382
  __decorate([
2910
- e$2('.chat-window'),
3383
+ e$4('.chat-window'),
2911
3384
  __metadata("design:type", Object)
2912
3385
  ], ChatSection.prototype, "chatWindowElement", void 0);
2913
3386
  __decorate([
2914
- e$2('personalize-dialog'),
3387
+ e$4('personalize-dialog'),
2915
3388
  __metadata("design:type", Object)
2916
3389
  ], ChatSection.prototype, "personalizeDialogElement", void 0);
2917
3390
  __decorate([
2918
- n({ type: String }),
3391
+ n$1({ type: String }),
2919
3392
  __metadata("design:type", String)
2920
3393
  ], ChatSection.prototype, "userQuery", void 0);
2921
3394
  ChatSection = __decorate([
2922
- t$1('chat-section')
3395
+ t$2('chat-section')
2923
3396
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2924
3397
  ], ChatSection);
2925
3398
 
@@ -2947,7 +3420,7 @@ let ShopGPT = class ShopGPT extends s {
2947
3420
  }
2948
3421
  connectedCallback() {
2949
3422
  super.connectedCallback();
2950
- if (this.uiMode === 'overlay') {
3423
+ if (!this.uiMode || this.uiMode === 'overlay') {
2951
3424
  if (!this.path) {
2952
3425
  return;
2953
3426
  }
@@ -3082,6 +3555,20 @@ let ShopGPT = class ShopGPT extends s {
3082
3555
  logger.error(e);
3083
3556
  }
3084
3557
  }
3558
+ handleThreadDelete(e) {
3559
+ e.stopPropagation();
3560
+ this.isLoadingThreads = true;
3561
+ const threadId = e.detail.threadId;
3562
+ if (!threadId) {
3563
+ logger.error('ThreadId is missing to delete the thread!');
3564
+ return;
3565
+ }
3566
+ this.shopGPTAPI
3567
+ .deleteSingleThread(threadId)
3568
+ .then(this.loadChatThreads.bind(this))
3569
+ .catch(logger.error)
3570
+ .finally(() => (this.isLoadingThreads = false));
3571
+ }
3085
3572
  async sendMessageToServer(e, message) {
3086
3573
  e.preventDefault();
3087
3574
  e.stopPropagation();
@@ -3133,7 +3620,10 @@ let ShopGPT = class ShopGPT extends s {
3133
3620
  overlayMode() {
3134
3621
  const thread = this.chatThreads.get(this.selectedThreadId);
3135
3622
  return x `
3136
- <dialog id="shop-gpt-dialog-overlay">
3623
+ <dialog
3624
+ id="shop-gpt-dialog-overlay"
3625
+ @delete-thread=${this.handleThreadDelete}
3626
+ >
3137
3627
  <div class="mobile-version">
3138
3628
  Please switch to the desktop version for the best experience.
3139
3629
  </div>
@@ -3187,7 +3677,7 @@ let ShopGPT = class ShopGPT extends s {
3187
3677
  </div>`;
3188
3678
  }
3189
3679
  return x `
3190
- <div id="shop-gpt-modal">
3680
+ <div id="shop-gpt-modal" @delete-thread=${this.handleThreadDelete}>
3191
3681
  <chat-section
3192
3682
  .isFailed=${this.isFailed}
3193
3683
  .isLoadingHistory=${this.isLoadingHistory}
@@ -3211,47 +3701,47 @@ let ShopGPT = class ShopGPT extends s {
3211
3701
  };
3212
3702
  ShopGPT.styles = [shopGPTStyles];
3213
3703
  __decorate([
3214
- e$2('#shop-gpt-dialog-overlay'),
3704
+ e$4('#shop-gpt-dialog-overlay'),
3215
3705
  __metadata("design:type", Object)
3216
3706
  ], ShopGPT.prototype, "shopGPTDialog", void 0);
3217
3707
  __decorate([
3218
- n({ type: String }),
3708
+ n$1({ type: String }),
3219
3709
  __metadata("design:type", String)
3220
3710
  ], ShopGPT.prototype, "modalState", void 0);
3221
3711
  __decorate([
3222
- n({ type: Boolean }),
3712
+ n$1({ type: Boolean }),
3223
3713
  __metadata("design:type", Boolean)
3224
3714
  ], ShopGPT.prototype, "isLoadingHistory", void 0);
3225
3715
  __decorate([
3226
- n({ type: Boolean }),
3716
+ n$1({ type: Boolean }),
3227
3717
  __metadata("design:type", Boolean)
3228
3718
  ], ShopGPT.prototype, "isLoadingThreads", void 0);
3229
3719
  __decorate([
3230
- n({ type: Boolean }),
3720
+ n$1({ type: Boolean }),
3231
3721
  __metadata("design:type", Boolean)
3232
3722
  ], ShopGPT.prototype, "isTyping", void 0);
3233
3723
  __decorate([
3234
- n({ type: Boolean }),
3724
+ n$1({ type: Boolean }),
3235
3725
  __metadata("design:type", Boolean)
3236
3726
  ], ShopGPT.prototype, "isFailed", void 0);
3237
3727
  __decorate([
3238
- n({ type: String }),
3728
+ n$1({ type: String }),
3239
3729
  __metadata("design:type", String)
3240
3730
  ], ShopGPT.prototype, "selectedThreadId", void 0);
3241
3731
  __decorate([
3242
- n({ type: Array }),
3732
+ n$1({ type: Array }),
3243
3733
  __metadata("design:type", Array)
3244
3734
  ], ShopGPT.prototype, "products", void 0);
3245
3735
  __decorate([
3246
- n({ type: Array }),
3736
+ n$1({ type: Array }),
3247
3737
  __metadata("design:type", Array)
3248
3738
  ], ShopGPT.prototype, "messages", void 0);
3249
3739
  __decorate([
3250
- n({ type: Object }),
3740
+ n$1({ type: Object }),
3251
3741
  __metadata("design:type", Map)
3252
3742
  ], ShopGPT.prototype, "chatThreads", void 0);
3253
3743
  ShopGPT = __decorate([
3254
- t$1('shop-gpt')
3744
+ t$2('shop-gpt')
3255
3745
  ], ShopGPT);
3256
3746
 
3257
3747
  var _a, _b;