@blotoutio/providers-shop-gpt-sdk 1.2.1 → 1.4.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 +732 -329
  2. package/index.js +732 -329
  3. package/index.mjs +732 -329
  4. package/package.json +1 -1
package/index.mjs CHANGED
@@ -382,6 +382,7 @@ const createShopGPTAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, st
382
382
  message: data.message,
383
383
  products: (_a = data.products) === null || _a === void 0 ? void 0 : _a.filter((item) => !!item).map((item) => ({ ...item, quantity: 1 })),
384
384
  chatTitle: data.chatTitle,
385
+ welcomePrompts: data.welcomePrompts,
385
386
  };
386
387
  };
387
388
  const fetchChatHistory = async (threadId) => {
@@ -488,7 +489,7 @@ const init = (params) => {
488
489
  // exit if not in top window
489
490
  return;
490
491
  }
491
- const { enabled, devMode, merchantUrl, profiles, productHandles, targetPath, uiMode, } = (_c = params.manifest.variables) !== null && _c !== void 0 ? _c : {};
492
+ const { enabled, devMode, merchantUrl, profiles, productHandles, targetPath, uiMode, brandName, quickPrompts, merchantImage, } = (_c = params.manifest.variables) !== null && _c !== void 0 ? _c : {};
492
493
  let shouldShowUI = enabled;
493
494
  if (!enabled && hasPreviewKey()) {
494
495
  logger.log('Enabling UI in preview mode');
@@ -514,6 +515,9 @@ const init = (params) => {
514
515
  profiles,
515
516
  productHandles,
516
517
  path: targetPath,
518
+ brandName,
519
+ quickPrompts,
520
+ merchantImage,
517
521
  });
518
522
  }
519
523
  };
@@ -547,7 +551,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
547
551
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
548
552
  PERFORMANCE OF THIS SOFTWARE.
549
553
  ***************************************************************************** */
550
- /* global Reflect, Promise, SuppressedError, Symbol */
554
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
551
555
 
552
556
 
553
557
  function __decorate(decorators, target, key, desc) {
@@ -571,60 +575,53 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
571
575
  * Copyright 2019 Google LLC
572
576
  * SPDX-License-Identifier: BSD-3-Clause
573
577
  */
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;
578
+ const t$2=globalThis,e$7=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$1=Symbol(),o$5=new WeakMap;let n$3 = class n{constructor(t,e,o){if(this._$cssResult$=!0,o!==s$1)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$7&&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$5=t=>new n$3("string"==typeof t?t:t+"",void 0,s$1),i$4=(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$1)},S$1=(s,o)=>{if(e$7)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$2.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$7?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$5(e)})(t):t;
575
579
 
576
580
  /**
577
581
  * @license
578
582
  * Copyright 2017 Google LLC
579
583
  * SPDX-License-Identifier: BSD-3-Clause
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");
584
+ */const{is:i$3,defineProperty:e$6,getOwnPropertyDescriptor:r$4,getOwnPropertyNames:h$1,getOwnPropertySymbols:o$4,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$3(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$6(this.prototype,t,r);}}static getPropertyDescriptor(t,s,i){const{get:e,set:h}=r$4(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$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");
581
585
 
582
586
  /**
583
587
  * @license
584
588
  * Copyright 2017 Google LLC
585
589
  * SPDX-License-Identifier: BSD-3-Clause
586
590
  */
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};
591
+ const t$1=globalThis,i$2=t$1.trustedTypes,s=i$2?i$2.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$5="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$3="?"+h,n$1=`<${o$3}>`,r$3=document,l=()=>r$3.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),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r$3.createTreeWalker(r$3,129);function P(t,i){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s?s.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",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$5+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};class N{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]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$5)){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]?H:"?"===e[1]?I:"@"===e[1]?L:k}),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$2?i$2.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),C.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$3.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)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=S(t,h._$AS(t,i.values),h,e)),i}class M{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$3).importNode(i,!0);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r$3,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 R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,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=S(this,t,i),c(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==E&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r$3.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=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(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 N(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 R(this.O(l()),this.O(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 k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,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=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=S(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S(this,e[s+n],i,n),r===T&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S(this,t,i,0)??E)===T)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||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 z{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){S(this,t);}}const j=t$1.litHtmlPolyfillSupport;j?.(N,R),(t$1.litHtmlVersions??=[]).push("3.2.1");const B=(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 R(i.insertBefore(l(),t),t,void 0,s??{});}return h._$AI(t),h};
588
592
 
589
593
  /**
590
594
  * @license
591
595
  * Copyright 2017 Google LLC
592
596
  * SPDX-License-Identifier: BSD-3-Clause
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");
597
+ */let r$2 = class r 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 s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(s,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1);}render(){return T}};r$2._$litElement$=!0,r$2["finalized"]=!0,globalThis.litElementHydrateSupport?.({LitElement:r$2});const i$1=globalThis.litElementPolyfillSupport;i$1?.({LitElement:r$2});(globalThis.litElementVersions??=[]).push("4.1.1");
594
598
 
595
599
  /**
596
600
  * @license
597
601
  * Copyright 2017 Google LLC
598
602
  * SPDX-License-Identifier: BSD-3-Clause
599
- */
600
- const t$2=t=>(e,o)=>{void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
603
+ */const o$2={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1},r$1=(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(t){return (e,o)=>"object"==typeof o?r$1(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)}
601
604
 
602
605
  /**
603
606
  * @license
604
607
  * Copyright 2017 Google LLC
605
608
  * SPDX-License-Identifier: BSD-3-Clause
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})}
609
+ */function r(r){return n({...r,state:!0,attribute:!1})}
613
610
 
614
611
  /**
615
612
  * @license
616
613
  * Copyright 2017 Google LLC
617
614
  * SPDX-License-Identifier: BSD-3-Clause
618
615
  */
619
- const e$5=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
616
+ const e$4=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
620
617
 
621
618
  /**
622
619
  * @license
623
620
  * Copyright 2017 Google LLC
624
621
  * SPDX-License-Identifier: BSD-3-Clause
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)}})}}
622
+ */function e$3(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$4(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$4(n,s,{get(){return o(this)}})}}
626
623
 
627
- const scrollBarStyles = i$3 `
624
+ const scrollBarStyles = i$4 `
628
625
  ::-webkit-scrollbar {
629
626
  width: 20px;
630
627
  }
@@ -644,7 +641,7 @@ const scrollBarStyles = i$3 `
644
641
  background-color: #a8bbbf;
645
642
  }
646
643
  `;
647
- const shopGPTStyles = i$3 `
644
+ const shopGPTStyles = i$4 `
648
645
  ${scrollBarStyles}
649
646
 
650
647
  * {
@@ -708,6 +705,35 @@ const shopGPTStyles = i$3 `
708
705
  align-items: center;
709
706
  box-shadow: 0 0 4px 1px #ffffff;
710
707
  }
708
+
709
+ .chatbot-hover-text {
710
+ position: absolute;
711
+ color: #172a41;
712
+ padding: 8px;
713
+ white-space: nowrap;
714
+ font-size: 16px;
715
+ line-height: 21px;
716
+ opacity: 0;
717
+ transition: opacity 0.2s;
718
+ pointer-events: none;
719
+
720
+ top: calc(0% - 30%);
721
+ right: calc(100% + 5px);
722
+
723
+ border-radius: 5px 5px 0px;
724
+ background: #ffcc81;
725
+ box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1),
726
+ 0px 2px 4px -1px rgba(0, 0, 0, 0.06);
727
+
728
+ font-weight: 400;
729
+ line-height: 150%;
730
+ }
731
+
732
+ &:hover {
733
+ .chatbot-hover-text {
734
+ opacity: 1;
735
+ }
736
+ }
711
737
  }
712
738
 
713
739
  .mobile-version {
@@ -755,13 +781,13 @@ const shopGPTStyles = i$3 `
755
781
  * Copyright 2017 Google LLC
756
782
  * SPDX-License-Identifier: BSD-3-Clause
757
783
  */
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)}}
784
+ const t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e$2=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)}}
759
785
 
760
786
  /**
761
787
  * @license
762
788
  * Copyright 2018 Google LLC
763
789
  * SPDX-License-Identifier: BSD-3-Clause
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}});
790
+ */const e$1=e$2(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 T}});
765
791
 
766
792
  /**
767
793
  * @license
@@ -841,7 +867,7 @@ const shopGPTIcon = b `<svg xmlns="http://www.w3.org/2000/svg" width="105" heigh
841
867
  <path d="M90.323 25.7117C90.2401 25.7117 90.1986 25.7117 90.1669 25.7281C90.1391 25.7424 90.1165 25.7653 90.1022 25.7934C90.0861 25.8255 90.0861 25.8674 90.0861 25.9512V26.9203H89.7359C89.6558 26.9203 89.6148 26.9205 89.5836 26.9366C89.5558 26.9509 89.5331 26.9738 89.5189 27.002C89.5028 27.034 89.5028 27.0759 89.5028 27.1597V27.717C89.5028 27.8008 89.5028 27.8427 89.5189 27.8748C89.5331 27.9029 89.5558 27.9258 89.5836 27.9402C89.6153 27.9565 89.6568 27.9565 89.7397 27.9565H90.0861V32.1113H90.0847C90.0843 32.1182 90.0838 32.1251 90.0835 32.1319C90.0841 32.1478 90.085 32.1637 90.0861 32.1795V32.2192L90.0883 32.2191C90.1341 33.0885 90.844 33.7701 91.7052 33.7715C91.8727 33.7713 92.0388 33.745 92.1978 33.6936C92.2668 33.6713 92.321 33.5887 92.3208 33.5154L92.3225 32.749C92.3226 32.7376 92.3205 32.7194 92.3176 32.7084C92.317 32.7064 92.3165 32.7043 92.3159 32.7022C92.3113 32.6856 92.297 32.6611 92.283 32.651C92.2793 32.6484 92.2311 32.6207 92.1908 32.6453C92.1477 32.6656 92.147 32.6659 92.1463 32.6662C92.1353 32.6715 92.0981 32.6856 92.0807 32.6958C91.9299 32.7603 91.9074 32.7589 91.8631 32.7651C91.8328 32.7694 91.8023 32.7716 91.7716 32.7716C91.7139 32.7716 91.6565 32.7639 91.6007 32.7488C91.5449 32.7337 91.4914 32.7113 91.4414 32.6821C91.4146 32.6643 91.3891 32.6445 91.3652 32.623C91.3511 32.613 91.3375 32.6024 91.3243 32.5912C91.3176 32.5863 91.3111 32.5812 91.3046 32.576C91.3029 32.5738 91.3012 32.5715 91.2995 32.5692C91.1797 32.456 91.1115 32.2977 91.1112 32.1319C91.1116 32.1265 91.1121 32.1212 91.1127 32.1158C91.1122 32.1118 91.1116 32.1079 91.1112 32.1039V27.9565H92.0702C92.1531 27.9565 92.1946 27.9565 92.2262 27.9402C92.2541 27.9258 92.2767 27.9029 92.2909 27.8748C92.3071 27.8427 92.3071 27.8008 92.3071 27.717V27.1597C92.3071 27.0759 92.3071 27.034 92.2909 27.002C92.2767 26.9738 92.2541 26.9509 92.2262 26.9366C92.1946 26.9203 92.1531 26.9203 92.0702 26.9203H91.1112V25.9512C91.1112 25.8674 91.1112 25.8255 91.095 25.7934C91.0808 25.7653 91.0582 25.7424 91.0303 25.7281C90.9986 25.7117 90.9572 25.7117 90.8743 25.7117H90.323Z" fill="#F25C2B"/>
842
868
  </svg>`;
843
869
 
844
- const chatThreadsStyles = i$3 `
870
+ const chatThreadsStyles = i$4 `
845
871
  :host {
846
872
  padding: 24px 24px 21px;
847
873
  font-family: 'Inter', sans-serif;
@@ -916,11 +942,35 @@ const chatThreadsStyles = i$3 `
916
942
  color: #677c95;
917
943
  font-weight: 500;
918
944
  text-transform: uppercase;
919
- margin: 0 0 12px;
945
+ margin: 0;
920
946
  max-height: 18px;
921
947
  padding-left: 12px;
922
948
  }
923
949
 
950
+ .trash-icon {
951
+ display: flex;
952
+ padding: 2px;
953
+ border-radius: 5px;
954
+ cursor: pointer;
955
+ align-items: center;
956
+ justify-content: center;
957
+
958
+ &:hover {
959
+ background: #dc3545;
960
+
961
+ path {
962
+ fill: white;
963
+ }
964
+ }
965
+ }
966
+
967
+ .title-wrapper {
968
+ display: flex;
969
+ justify-content: space-between;
970
+ align-items: center;
971
+ margin: 0 0 12px;
972
+ }
973
+
924
974
  .threads {
925
975
  flex: 1;
926
976
  overflow-y: auto;
@@ -933,17 +983,6 @@ const chatThreadsStyles = i$3 `
933
983
 
934
984
  .trash-icon {
935
985
  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
986
  }
948
987
 
949
988
  &:hover {
@@ -992,15 +1031,13 @@ const chatThreadsStyles = i$3 `
992
1031
  }
993
1032
  `;
994
1033
 
995
- let LoadSpinner =
996
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
997
- class LoadSpinner extends s {
1034
+ class LoadSpinner extends r$2 {
998
1035
  render() {
999
1036
  return x ` <div class="loader"><div class="spinner"></div></div> `;
1000
1037
  }
1001
- };
1038
+ }
1002
1039
  LoadSpinner.styles = [
1003
- i$3 `
1040
+ i$4 `
1004
1041
  .loader {
1005
1042
  display: flex;
1006
1043
  flex: 1;
@@ -1032,14 +1069,15 @@ LoadSpinner.styles = [
1032
1069
  }
1033
1070
  `,
1034
1071
  ];
1035
- LoadSpinner = __decorate([
1036
- t$2('load-spinner')
1037
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1038
- ], LoadSpinner);
1039
-
1040
- let ChatThreads =
1041
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1042
- class ChatThreads extends s {
1072
+ if (!customElements.get('load-spinner')) {
1073
+ customElements.define('load-spinner', LoadSpinner);
1074
+ }
1075
+
1076
+ class ChatThreads extends r$2 {
1077
+ constructor() {
1078
+ super(...arguments);
1079
+ this.deleteAllThreads = false;
1080
+ }
1043
1081
  getDomain() {
1044
1082
  var _a;
1045
1083
  if ((_a = this.merchantUrl) === null || _a === void 0 ? void 0 : _a.startsWith('https://')) {
@@ -1048,6 +1086,14 @@ class ChatThreads extends s {
1048
1086
  return `https://${this.merchantUrl}`;
1049
1087
  }
1050
1088
  handleThreadDelete() {
1089
+ if (this.deleteAllThreads) {
1090
+ this.dispatchEvent(new CustomEvent('delete-all-threads', {
1091
+ composed: true,
1092
+ bubbles: true,
1093
+ }));
1094
+ this.deleteAllThreads = false;
1095
+ return;
1096
+ }
1051
1097
  if (!this.deleteThreadId) {
1052
1098
  return;
1053
1099
  }
@@ -1067,12 +1113,27 @@ class ChatThreads extends s {
1067
1113
  }
1068
1114
  return x `
1069
1115
  <div class="history">
1070
- <p class="title">History</p>
1116
+ <div class="title-wrapper">
1117
+ <p class="title">History</p>
1118
+ ${this.chatThreads.size
1119
+ ? x `<div
1120
+ class="trash-icon"
1121
+ @click=${() => {
1122
+ if (this.isLoading || this.isTyping) {
1123
+ return;
1124
+ }
1125
+ this.deleteAllThreads = true;
1126
+ }}
1127
+ >
1128
+ ${trashIcon}
1129
+ </div>`
1130
+ : E}
1131
+ </div>
1071
1132
  ${this.chatThreads.size
1072
1133
  ? x `<div class="threads">
1073
1134
  ${o$1(this.chatThreads.values(), (thread) => x `
1074
1135
  <div
1075
- class=${e$2({
1136
+ class=${e$1({
1076
1137
  'thread-wrapper': true,
1077
1138
  active: this.selectedThreadId === thread.threadId,
1078
1139
  disabled: this.isTyping,
@@ -1103,7 +1164,7 @@ class ChatThreads extends s {
1103
1164
  </div>
1104
1165
  `)}
1105
1166
  </div>`
1106
- : T}
1167
+ : E}
1107
1168
  </div>
1108
1169
  `;
1109
1170
  }
@@ -1125,55 +1186,69 @@ class ChatThreads extends s {
1125
1186
  ${this.getDomain().replace('https://', '')}
1126
1187
  </a>
1127
1188
  </div>`
1128
- : T}
1129
- ${this.deleteThreadId
1189
+ : E}
1190
+ ${this.deleteThreadId || this.deleteAllThreads
1130
1191
  ? x `
1131
1192
  <confirm-dialog
1132
1193
  @accept=${this.handleThreadDelete}
1133
- @decline=${() => (this.deleteThreadId = '')}
1194
+ @decline=${() => {
1195
+ this.deleteThreadId = '';
1196
+ this.deleteAllThreads = false;
1197
+ }}
1134
1198
  >
1135
- <h2 slot="title">Delete Thread?</h2>
1199
+ <h2 slot="title">
1200
+ ${this.deleteAllThreads
1201
+ ? 'Delete Entire Chat History?'
1202
+ : 'Delete Chat?'}
1203
+ </h2>
1136
1204
  <p slot="content">
1137
1205
  This action cannot be undone. Are you sure you want to delete
1138
- <b>"${this.chatThreads.get(this.deleteThreadId).title}"</b>?
1206
+ ${this.deleteAllThreads
1207
+ ? ' the entire chat history'
1208
+ : x `<b
1209
+ >"${this.chatThreads.get(this.deleteThreadId).title}"</b
1210
+ >`}?
1139
1211
  </p>
1140
1212
  </confirm-dialog>
1141
1213
  `
1142
- : T}
1214
+ : E}
1143
1215
  `;
1144
1216
  }
1145
- };
1217
+ }
1146
1218
  ChatThreads.styles = [chatThreadsStyles];
1147
1219
  __decorate([
1148
- n$1({ type: Object }),
1220
+ n({ type: Object }),
1149
1221
  __metadata("design:type", Map)
1150
1222
  ], ChatThreads.prototype, "chatThreads", void 0);
1151
1223
  __decorate([
1152
- n$1({ type: String }),
1224
+ n({ type: String }),
1153
1225
  __metadata("design:type", Object)
1154
1226
  ], ChatThreads.prototype, "merchantUrl", void 0);
1155
1227
  __decorate([
1156
- n$1({ type: Boolean }),
1228
+ n({ type: Boolean }),
1157
1229
  __metadata("design:type", Boolean)
1158
1230
  ], ChatThreads.prototype, "isLoading", void 0);
1159
1231
  __decorate([
1160
- n$1({ type: Boolean }),
1232
+ n({ type: Boolean }),
1161
1233
  __metadata("design:type", Boolean)
1162
1234
  ], ChatThreads.prototype, "isTyping", void 0);
1163
1235
  __decorate([
1164
- n$1({ type: String }),
1236
+ n({ type: String }),
1165
1237
  __metadata("design:type", String)
1166
1238
  ], ChatThreads.prototype, "selectedThreadId", void 0);
1167
1239
  __decorate([
1168
- r$1(),
1240
+ r(),
1169
1241
  __metadata("design:type", String)
1170
1242
  ], ChatThreads.prototype, "deleteThreadId", void 0);
1171
- ChatThreads = __decorate([
1172
- t$2('chat-threads')
1173
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1174
- ], ChatThreads);
1243
+ __decorate([
1244
+ r(),
1245
+ __metadata("design:type", Object)
1246
+ ], ChatThreads.prototype, "deleteAllThreads", void 0);
1247
+ if (!customElements.get('chat-threads')) {
1248
+ customElements.define('chat-threads', ChatThreads);
1249
+ }
1175
1250
 
1176
- const productsSectionStyles = i$3 `
1251
+ const productsSectionStyles = i$4 `
1177
1252
  :host {
1178
1253
  padding: 24px 16px;
1179
1254
  background-color: #fff;
@@ -1209,9 +1284,14 @@ const productsSectionStyles = i$3 `
1209
1284
  justify-content: center;
1210
1285
  height: 100%;
1211
1286
  }
1287
+
1288
+ .merchant-image {
1289
+ width: 100%;
1290
+ object-fit: contain;
1291
+ }
1212
1292
  `;
1213
1293
 
1214
- const productItemStyles = i$3 `
1294
+ const productItemStyles = i$4 `
1215
1295
  :host {
1216
1296
  font-family: 'Inter', sans-serif;
1217
1297
  font-size: 16px;
@@ -1354,9 +1434,7 @@ const productItemStyles = i$3 `
1354
1434
  }
1355
1435
  `;
1356
1436
 
1357
- let ProductItem =
1358
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1359
- class ProductItem extends s {
1437
+ class ProductItem extends r$2 {
1360
1438
  getLocalPrice(price) {
1361
1439
  if (!this.siteCurrency) {
1362
1440
  return price;
@@ -1364,6 +1442,16 @@ class ProductItem extends s {
1364
1442
  const localPrice = parseFloat(price) * this.siteCurrency.rate;
1365
1443
  return formatMoney(localPrice, this.siteCurrency.currency);
1366
1444
  }
1445
+ getComparedAtPrice(comparedAtPrice, price) {
1446
+ if (!comparedAtPrice ||
1447
+ comparedAtPrice === price ||
1448
+ parseFloat(comparedAtPrice) <= parseFloat(price)) {
1449
+ return E;
1450
+ }
1451
+ return x `<p class="price-compared">
1452
+ ${this.getLocalPrice(comparedAtPrice)}
1453
+ </p>`;
1454
+ }
1367
1455
  redirect(url) {
1368
1456
  var _a;
1369
1457
  if (!url) {
@@ -1372,8 +1460,8 @@ class ProductItem extends s {
1372
1460
  (_a = open(url, '_blank')) === null || _a === void 0 ? void 0 : _a.focus();
1373
1461
  }
1374
1462
  renderVariantTitles() {
1375
- if (!this.product.hasVariantsThatRequiresComponents) {
1376
- return T;
1463
+ if (this.product.hasOnlyDefaultVariant) {
1464
+ return E;
1377
1465
  }
1378
1466
  return this.product.variants[0].selectedOptions.map((option) => x `
1379
1467
  <p class="product-variation-details">${option.name}: ${option.value}</p>
@@ -1397,13 +1485,7 @@ class ProductItem extends s {
1397
1485
  </p>
1398
1486
  ${this.renderVariantTitles()}
1399
1487
  <div class="prices">
1400
- ${this.product.variants[0].comparedAtPrice &&
1401
- this.product.variants[0].comparedAtPrice !==
1402
- this.product.variants[0].price
1403
- ? x `<p class="price-compared">
1404
- ${this.getLocalPrice(this.product.variants[0].comparedAtPrice)}
1405
- </p>`
1406
- : T}
1488
+ ${this.getComparedAtPrice(this.product.variants[0].comparedAtPrice, this.product.variants[0].price)}
1407
1489
  <p>${this.getLocalPrice(this.product.variants[0].price)}</p>
1408
1490
  </div>
1409
1491
  <button
@@ -1416,22 +1498,21 @@ class ProductItem extends s {
1416
1498
  </div>
1417
1499
  `;
1418
1500
  }
1419
- };
1501
+ }
1420
1502
  ProductItem.styles = [productItemStyles];
1421
1503
  __decorate([
1422
- n$1({ type: Object }),
1504
+ n({ type: Object }),
1423
1505
  __metadata("design:type", Object)
1424
1506
  ], ProductItem.prototype, "product", void 0);
1425
1507
  __decorate([
1426
- n$1({ type: Object }),
1508
+ n({ type: Object }),
1427
1509
  __metadata("design:type", Object)
1428
1510
  ], ProductItem.prototype, "siteCurrency", void 0);
1429
- ProductItem = __decorate([
1430
- t$2('product-item')
1431
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1432
- ], ProductItem);
1511
+ if (!customElements.get('product-item')) {
1512
+ customElements.define('product-item', ProductItem);
1513
+ }
1433
1514
 
1434
- const productsListStyles = i$3 `
1515
+ const productsListStyles = i$4 `
1435
1516
  .products::-webkit-scrollbar {
1436
1517
  display: none;
1437
1518
  }
@@ -1457,6 +1538,8 @@ const productsListStyles = i$3 `
1457
1538
  gap: 24px;
1458
1539
  overflow-x: auto;
1459
1540
  scrollbar-width: none;
1541
+ margin-left: -10px;
1542
+ padding-left: 10px;
1460
1543
  }
1461
1544
 
1462
1545
  .scroll-btns {
@@ -1491,19 +1574,34 @@ const productsListStyles = i$3 `
1491
1574
  }
1492
1575
  `;
1493
1576
 
1494
- let ProductsList =
1495
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1496
- class ProductsList extends s {
1577
+ class ProductsList extends r$2 {
1578
+ constructor() {
1579
+ super(...arguments);
1580
+ this.showButtons = true;
1581
+ this.updateButtonsState = () => {
1582
+ if (!this.leftBtnEle || !this.productsEle || !this.rightBtnEle) {
1583
+ return;
1584
+ }
1585
+ const { scrollWidth, clientWidth } = this.productsEle;
1586
+ this.showButtons = scrollWidth > clientWidth;
1587
+ this.leftBtnEle.classList.toggle('disabled', this.productsEle.scrollLeft === 0);
1588
+ const maxScroll = this.productsEle.scrollWidth - this.productsEle.clientWidth;
1589
+ this.rightBtnEle.classList.toggle('disabled', this.productsEle.scrollLeft >= maxScroll - 1);
1590
+ };
1591
+ }
1497
1592
  connectedCallback() {
1498
1593
  super.connectedCallback();
1594
+ this.updateButtonsState();
1595
+ window.addEventListener('resize', this.updateButtonsState);
1499
1596
  }
1500
- updateButtonsState() {
1501
- if (!this.leftBtnEle || !this.productsEle || !this.rightBtnEle) {
1502
- return;
1597
+ disconnectedCallback() {
1598
+ window.removeEventListener('resize', this.updateButtonsState);
1599
+ super.disconnectedCallback();
1600
+ }
1601
+ updated(_changedProperties) {
1602
+ if (_changedProperties.has('products')) {
1603
+ this.updateButtonsState();
1503
1604
  }
1504
- this.leftBtnEle.classList.toggle('disabled', this.productsEle.scrollLeft === 0);
1505
- const maxScroll = this.productsEle.scrollWidth - this.productsEle.clientWidth;
1506
- this.rightBtnEle.classList.toggle('disabled', this.productsEle.scrollLeft >= maxScroll - 1);
1507
1605
  }
1508
1606
  scrollToLeft(e) {
1509
1607
  var _a;
@@ -1517,14 +1615,14 @@ class ProductsList extends s {
1517
1615
  }
1518
1616
  render() {
1519
1617
  if (!this.products.length) {
1520
- return T;
1618
+ return E;
1521
1619
  }
1522
1620
  return x `
1523
1621
  <div class="products-wrapper">
1524
1622
  <div class="products" @scroll=${this.updateButtonsState}>
1525
1623
  ${o$1(this.products, (product) => x `
1526
1624
  <div
1527
- class=${e$2({
1625
+ class=${e$1({
1528
1626
  'product-container': true,
1529
1627
  modal: this.viewType === 'modal',
1530
1628
  })}
@@ -1536,60 +1634,71 @@ class ProductsList extends s {
1536
1634
  </div>
1537
1635
  `)}
1538
1636
  </div>
1539
- <div class="scroll-btns">
1540
- <div class="left-btn disabled" @click=${this.scrollToLeft}>
1541
- ${leftBtn}
1542
- </div>
1543
- <div class="right-btn" @click=${this.scrollToRight}>${rightBtn}</div>
1544
- </div>
1637
+ ${this.showButtons
1638
+ ? x ` <div class="scroll-btns">
1639
+ <div class="left-btn disabled" @click=${this.scrollToLeft}>
1640
+ ${leftBtn}
1641
+ </div>
1642
+ <div class="right-btn" @click=${this.scrollToRight}>
1643
+ ${rightBtn}
1644
+ </div>
1645
+ </div>`
1646
+ : E}
1545
1647
  </div>
1546
1648
  `;
1547
1649
  }
1548
- };
1650
+ }
1549
1651
  ProductsList.styles = [productsListStyles];
1550
1652
  __decorate([
1551
- n$1({ type: Array }),
1653
+ n({ type: Array }),
1552
1654
  __metadata("design:type", Array)
1553
1655
  ], ProductsList.prototype, "products", void 0);
1554
1656
  __decorate([
1555
- n$1({ type: Object }),
1657
+ n({ type: Object }),
1556
1658
  __metadata("design:type", Object)
1557
1659
  ], ProductsList.prototype, "siteCurrency", void 0);
1558
1660
  __decorate([
1559
- e$4('.left-btn'),
1661
+ r(),
1662
+ __metadata("design:type", Object)
1663
+ ], ProductsList.prototype, "showButtons", void 0);
1664
+ __decorate([
1665
+ e$3('.left-btn'),
1560
1666
  __metadata("design:type", Object)
1561
1667
  ], ProductsList.prototype, "leftBtnEle", void 0);
1562
1668
  __decorate([
1563
- e$4('.right-btn'),
1669
+ e$3('.right-btn'),
1564
1670
  __metadata("design:type", Object)
1565
1671
  ], ProductsList.prototype, "rightBtnEle", void 0);
1566
1672
  __decorate([
1567
- e$4('.products'),
1673
+ e$3('.products'),
1568
1674
  __metadata("design:type", Object)
1569
1675
  ], ProductsList.prototype, "productsEle", void 0);
1570
- ProductsList = __decorate([
1571
- t$2('products-list')
1572
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1573
- ], ProductsList);
1574
-
1575
- let ProductsSection =
1576
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1577
- class ProductsSection extends s {
1676
+ if (!customElements.get('products-list')) {
1677
+ customElements.define('products-list', ProductsList);
1678
+ }
1679
+
1680
+ class ProductsSection extends r$2 {
1578
1681
  connectedCallback() {
1579
1682
  super.connectedCallback();
1580
1683
  }
1684
+ renderMerchantImage() {
1685
+ if (this.merchantImage) {
1686
+ return x ` <img class="merchant-image" src=${this.merchantImage} /> `;
1687
+ }
1688
+ return x `
1689
+ <div>${searchIcon}</div>
1690
+ <p>
1691
+ Start exploring by typing your query in the search bar on the right.
1692
+ </p>
1693
+ `;
1694
+ }
1581
1695
  render() {
1582
- if (this.isLoadingHistory) {
1696
+ if (this.isLoadingHistory || this.isLoadingThreads) {
1583
1697
  return x ` <load-spinner></load-spinner> `;
1584
1698
  }
1585
1699
  if (!this.products.length) {
1586
1700
  return x `
1587
- <div class="no-products">
1588
- <div>${searchIcon}</div>
1589
- <p>
1590
- Start exploring by typing your query in the search bar on the right.
1591
- </p>
1592
- </div>
1701
+ <div class="no-products">${this.renderMerchantImage()}</div>
1593
1702
  `;
1594
1703
  }
1595
1704
  const topResult = this.products[0];
@@ -1613,38 +1722,45 @@ class ProductsSection extends s {
1613
1722
  </div>
1614
1723
  `;
1615
1724
  }
1616
- };
1725
+ }
1617
1726
  ProductsSection.styles = [productsSectionStyles];
1618
1727
  __decorate([
1619
- n$1({ type: Array }),
1728
+ n({ type: String }),
1729
+ __metadata("design:type", Object)
1730
+ ], ProductsSection.prototype, "merchantImage", void 0);
1731
+ __decorate([
1732
+ n({ type: Array }),
1620
1733
  __metadata("design:type", Array)
1621
1734
  ], ProductsSection.prototype, "products", void 0);
1622
1735
  __decorate([
1623
- n$1({ type: Boolean }),
1736
+ n({ type: Boolean }),
1624
1737
  __metadata("design:type", Boolean)
1625
1738
  ], ProductsSection.prototype, "isLoadingHistory", void 0);
1626
1739
  __decorate([
1627
- n$1({ type: Object }),
1740
+ n({ type: Object }),
1628
1741
  __metadata("design:type", Object)
1629
1742
  ], ProductsSection.prototype, "siteCurrency", void 0);
1630
1743
  __decorate([
1631
- e$4('.left-btn'),
1744
+ n({ type: Boolean }),
1745
+ __metadata("design:type", Boolean)
1746
+ ], ProductsSection.prototype, "isLoadingThreads", void 0);
1747
+ __decorate([
1748
+ e$3('.left-btn'),
1632
1749
  __metadata("design:type", Object)
1633
1750
  ], ProductsSection.prototype, "leftBtnEle", void 0);
1634
1751
  __decorate([
1635
- e$4('.right-btn'),
1752
+ e$3('.right-btn'),
1636
1753
  __metadata("design:type", Object)
1637
1754
  ], ProductsSection.prototype, "rightBtnEle", void 0);
1638
1755
  __decorate([
1639
- e$4('.products'),
1756
+ e$3('.products'),
1640
1757
  __metadata("design:type", Object)
1641
1758
  ], ProductsSection.prototype, "productsEle", void 0);
1642
- ProductsSection = __decorate([
1643
- t$2('products-section')
1644
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1645
- ], ProductsSection);
1759
+ if (!customElements.get('products-section')) {
1760
+ customElements.define('products-section', ProductsSection);
1761
+ }
1646
1762
 
1647
- const chatSectionStyles = i$3 `
1763
+ const chatSectionStyles = i$4 `
1648
1764
  :host {
1649
1765
  font-family: 'Inter', sans-serif;
1650
1766
  font-size: 16px;
@@ -1822,6 +1938,20 @@ const chatSectionStyles = i$3 `
1822
1938
  gap: 28px;
1823
1939
  padding-bottom: 10px;
1824
1940
  margin-bottom: -10px;
1941
+ margin-right: -10px;
1942
+ padding-right: 10px;
1943
+ margin-left: -10px;
1944
+ padding-left: 10px;
1945
+ background: linear-gradient(#f7f8fa80, #f7f8fa80),
1946
+ var(--shopgpt-merchant-img-url);
1947
+ background-position: center;
1948
+ background-repeat: no-repeat;
1949
+ background-size: contain;
1950
+
1951
+ &.loading {
1952
+ justify-content: center;
1953
+ align-items: center;
1954
+ }
1825
1955
 
1826
1956
  .message:last-child {
1827
1957
  margin-top: 10px;
@@ -1992,7 +2122,7 @@ const chatSectionStyles = i$3 `
1992
2122
  .prompts {
1993
2123
  display: flex;
1994
2124
  justify-content: center;
1995
- gap: 23px 10px;
2125
+ gap: 10px;
1996
2126
  flex-wrap: wrap;
1997
2127
 
1998
2128
  .prompt {
@@ -2028,13 +2158,19 @@ const chatSectionStyles = i$3 `
2028
2158
  0px 20px 20px 0px rgba(0, 0, 0, 0.08);
2029
2159
  border-radius: 0px 0px 10px 10px;
2030
2160
 
2031
- h2 {
2032
- padding: 10px 16px;
2033
- color: #172a41;
2034
- font-size: 16px;
2035
- font-weight: 700;
2036
- line-height: 20px;
2161
+ .title-wrapper {
2162
+ display: flex;
2163
+ justify-content: space-between;
2164
+ align-items: center;
2037
2165
  border-bottom: 1px solid #dbe2eb;
2166
+ padding: 10px 16px;
2167
+
2168
+ h2 {
2169
+ color: #172a41;
2170
+ font-size: 16px;
2171
+ font-weight: 700;
2172
+ line-height: 20px;
2173
+ }
2038
2174
  }
2039
2175
 
2040
2176
  .thread-titles-wrapper {
@@ -2118,7 +2254,7 @@ const crossBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="2
2118
2254
  <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
2255
  </svg>`;
2120
2256
 
2121
- const personalizeDialogStyles = i$3 `
2257
+ const personalizeDialogStyles = i$4 `
2122
2258
  :host {
2123
2259
  font-family: 'Inter', sans-serif;
2124
2260
  font-size: 16px;
@@ -2356,9 +2492,7 @@ const profilePlusIcon = b `<svg xmlns="http://www.w3.org/2000/svg" width="56" he
2356
2492
  <path fill-rule="evenodd" clip-rule="evenodd" d="M21 7C22.7306 7 24.4223 7.51318 25.8612 8.47464C27.3002 9.4361 28.4217 10.8027 29.084 12.4015C29.7462 14.0004 29.9195 15.7597 29.5819 17.457C29.2443 19.1544 28.4109 20.7135 27.1872 21.9372C25.9635 23.1609 24.4044 23.9942 22.707 24.3319C21.0097 24.6695 19.2504 24.4962 17.6515 23.8339C16.0527 23.1717 14.6861 22.0502 13.7246 20.6112C12.7632 19.1723 12.25 17.4806 12.25 15.75C12.25 13.4294 13.1719 11.2038 14.8128 9.56282C16.4538 7.92187 18.6794 7 21 7ZM21 3.5C18.5772 3.5 16.2088 4.21845 14.1943 5.5645C12.1798 6.91054 10.6097 8.82373 9.68248 11.0621C8.75531 13.3005 8.51272 15.7636 8.98539 18.1399C9.45805 20.5161 10.6248 22.6989 12.3379 24.4121C14.0511 26.1252 16.2339 27.2919 18.6101 27.7646C20.9864 28.2373 23.4495 27.9947 25.6879 27.0675C27.9263 26.1403 29.8395 24.5702 31.1855 22.5557C32.5316 20.5412 33.25 18.1728 33.25 15.75C33.25 12.5011 31.9594 9.38526 29.6621 7.08794C27.3647 4.79062 24.2489 3.5 21 3.5ZM56 24.5H49V17.5H45.5V24.5H38.5V28H45.5V35H49V28H56V24.5ZM35 52.5H38.5V43.75C38.5 40.5011 37.2094 37.3853 34.9121 35.0879C32.6147 32.7906 29.4989 31.5 26.25 31.5H15.75C12.5011 31.5 9.38526 32.7906 7.08794 35.0879C4.79062 37.3853 3.5 40.5011 3.5 43.75V52.5H7V43.75C7 41.4294 7.92187 39.2038 9.56282 37.5628C11.2038 35.9219 13.4294 35 15.75 35H26.25C28.5706 35 30.7962 35.9219 32.4372 37.5628C34.0781 39.2038 35 41.4294 35 43.75V52.5Z" fill="#172A41"/>
2357
2493
  </svg>`;
2358
2494
 
2359
- let PersonalizeDialog =
2360
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2361
- class PersonalizeDialog extends s {
2495
+ class PersonalizeDialog extends r$2 {
2362
2496
  constructor() {
2363
2497
  super(...arguments);
2364
2498
  this.isLoading = false;
@@ -2381,7 +2515,7 @@ class PersonalizeDialog extends s {
2381
2515
  return this.selectProductHandle();
2382
2516
  }
2383
2517
  }
2384
- return T;
2518
+ return E;
2385
2519
  };
2386
2520
  }
2387
2521
  showModal() {
@@ -2565,7 +2699,7 @@ class PersonalizeDialog extends s {
2565
2699
  : 'Select Product'}
2566
2700
  </div>
2567
2701
  <ul class="dropdown-list">
2568
- ${(_a = this.defaultProductHandles) === null || _a === void 0 ? void 0 : _a.map((productHandle) => x `<li
2702
+ ${(_a = this.defaultProductHandles) === null || _a === void 0 ? void 0 : _a.map((productHandle) => x ` <li
2569
2703
  class="dropdown-item"
2570
2704
  @click=${() => {
2571
2705
  this.productHandle = productHandle;
@@ -2577,10 +2711,10 @@ class PersonalizeDialog extends s {
2577
2711
  </ul>
2578
2712
  </div>
2579
2713
  ${this.productHandle
2580
- ? x `<button class="finish-btn" @click=${this.handleSubmit}>
2714
+ ? x ` <button class="finish-btn" @click=${this.handleSubmit}>
2581
2715
  Finish
2582
2716
  </button>`
2583
- : T}
2717
+ : E}
2584
2718
  `;
2585
2719
  }
2586
2720
  render() {
@@ -2588,10 +2722,10 @@ class PersonalizeDialog extends s {
2588
2722
  <dialog>
2589
2723
  <div class="dialog-title">
2590
2724
  ${this.state !== 'profile-type'
2591
- ? x `<div class="back-btn btn" @click=${this.handleBackStep}>
2725
+ ? x ` <div class="back-btn btn" @click=${this.handleBackStep}>
2592
2726
  ${backBtn}
2593
2727
  </div>`
2594
- : T}
2728
+ : E}
2595
2729
  <h2>Personalize your search</h2>
2596
2730
  <div class="close-btn btn" @click=${() => this.dialogModal.close()}>
2597
2731
  ${closeBtn}
@@ -2601,75 +2735,174 @@ class PersonalizeDialog extends s {
2601
2735
  </dialog>
2602
2736
  `;
2603
2737
  }
2604
- };
2738
+ }
2605
2739
  PersonalizeDialog.styles = [personalizeDialogStyles];
2606
2740
  __decorate([
2607
- e$4('dialog'),
2741
+ e$3('dialog'),
2608
2742
  __metadata("design:type", HTMLDialogElement)
2609
2743
  ], PersonalizeDialog.prototype, "dialogModal", void 0);
2610
2744
  __decorate([
2611
- e$4('.dropdown-list'),
2745
+ e$3('.dropdown-list'),
2612
2746
  __metadata("design:type", HTMLUListElement)
2613
2747
  ], PersonalizeDialog.prototype, "dropdownList", void 0);
2614
2748
  __decorate([
2615
- e$4('.dropdown-trigger'),
2749
+ e$3('.dropdown-trigger'),
2616
2750
  __metadata("design:type", HTMLDivElement)
2617
2751
  ], PersonalizeDialog.prototype, "dropdownTrigger", void 0);
2618
2752
  __decorate([
2619
- n$1({ type: Array }),
2753
+ n({ type: Array }),
2620
2754
  __metadata("design:type", Array)
2621
2755
  ], PersonalizeDialog.prototype, "defaultProductHandles", void 0);
2622
2756
  __decorate([
2623
- n$1({ type: Array }),
2757
+ n({ type: Array }),
2624
2758
  __metadata("design:type", Array)
2625
2759
  ], PersonalizeDialog.prototype, "defaultProfiles", void 0);
2626
2760
  __decorate([
2627
- n$1({ type: Boolean }),
2628
- __metadata("design:type", Boolean)
2761
+ n({ type: Boolean }),
2762
+ __metadata("design:type", Object)
2629
2763
  ], PersonalizeDialog.prototype, "isLoading", void 0);
2630
2764
  __decorate([
2631
- n$1({ type: String }),
2765
+ n({ type: String }),
2632
2766
  __metadata("design:type", Object)
2633
2767
  ], PersonalizeDialog.prototype, "state", void 0);
2634
2768
  __decorate([
2635
- n$1({ type: String }),
2769
+ n({ type: String }),
2636
2770
  __metadata("design:type", Object)
2637
2771
  ], PersonalizeDialog.prototype, "profileType", void 0);
2638
2772
  __decorate([
2639
- n$1({ type: String }),
2773
+ n({ type: String }),
2640
2774
  __metadata("design:type", Object)
2641
2775
  ], PersonalizeDialog.prototype, "selectedProfile", void 0);
2642
2776
  __decorate([
2643
- n$1({ type: String }),
2777
+ n({ type: String }),
2644
2778
  __metadata("design:type", Object)
2645
2779
  ], PersonalizeDialog.prototype, "visitorType", void 0);
2646
2780
  __decorate([
2647
- n$1({ type: String }),
2781
+ n({ type: String }),
2648
2782
  __metadata("design:type", Object)
2649
2783
  ], PersonalizeDialog.prototype, "productHandle", void 0);
2650
- PersonalizeDialog = __decorate([
2651
- t$2('personalize-dialog')
2652
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2653
- ], PersonalizeDialog);
2784
+ if (!customElements.get('personalize-dialog')) {
2785
+ customElements.define('personalize-dialog', PersonalizeDialog);
2786
+ }
2654
2787
 
2655
2788
  /**
2656
2789
  * @license
2657
2790
  * Copyright 2017 Google LLC
2658
2791
  * 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,"")}
2792
+ */class e extends i{constructor(i){if(super(i),this.it=E,i.type!==t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===E||null==r)return this._t=void 0,this.it=r;if(r===T)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.directiveName="unsafeHTML",e.resultType=1;const o=e$2(e);
2793
+
2794
+ const markdown = (text) => {
2795
+ let src = text;
2796
+ const rx_space = /\t|\r|\uf8ff/g;
2797
+ const rx_hr = /^([*\-=_] *){3,}$/gm;
2798
+ const rx_blockquote = /\n *> *([^]*?)(?=(\n|$){2})/g;
2799
+ const rx_list = /\n( *)(?:[*\-+]|((\d+)|([a-z])|[A-Z])[.)]) +([^]*?)(?=(\n|$){2})/g;
2800
+ const rx_listjoin = /<\/(ol|ul)>\n\n<\1>/g;
2801
+ const rx_highlight = /(^|[^A-Za-z\d\\])(([*_])|(~)|(\^)|(--)|(\+\+)|`)(\2?)([^<]*?)\2\8(?!\2)(?=\W|_|$)/g;
2802
+ const rx_code = /\n((```|~~~).*\n?([^]*?)\n?\2|(( {4}.*?\n)+))/g;
2803
+ const rx_link = /((!?)\[(.*?)\]\((.*?)( ".*")?\)|\\([\\`*_{}[\]()#+\-.!~]))/g;
2804
+ const rx_table = /\n(( *\|.*?\| *\n)+)/g;
2805
+ const rx_thead = /^.*\n( *\|( *:?-+:?-+:? *\|)* *\n|)/;
2806
+ const rx_row = /.*\n/g;
2807
+ const rx_cell = /\|(.*?[^\\])\|/g;
2808
+ const rx_heading = /(?=^|>|\n)([>\s]*?)(#{1,6}) (.*?)( #*)? *(?=\n|$)/g;
2809
+ const rx_para = /(?=^|>|\n)\s*\n+([^<]+?)\n+\s*(?=\n|<|$)/g;
2810
+ const rx_stash = /-\d+\uf8ff/g;
2811
+ const stash = {};
2812
+ let si = 0;
2813
+ function replace(rex, fn) {
2814
+ src = src.replace(rex, fn);
2815
+ }
2816
+ function element(tag, content) {
2817
+ return `<${tag}>${content}</${tag}>`;
2818
+ }
2819
+ function blockquote(src) {
2820
+ return src.replace(rx_blockquote, (_, content) => {
2821
+ return element('blockquote', blockquote(highlight(content.replace(/^ *> */gm, ''))));
2822
+ });
2823
+ }
2824
+ function list(src) {
2825
+ return src.replace(rx_list, (all, ind, ol, num, low, content) => {
2826
+ const entry = element('li', highlight(content
2827
+ .split(new RegExp(`\n ?${ind}(?:(?:\\d+|[a-zA-Z])[.)]|[*\\-+]) +`, 'g'))
2828
+ .map(list)
2829
+ .join('</li><li>')));
2830
+ return `\n${ol
2831
+ ? `<ol start="${num
2832
+ ? ol + '">'
2833
+ : `${parseInt(ol, 36) - 9}" style="list-style-type:${low ? 'low' : 'upp'}er-alpha">`}${entry}</ol>`
2834
+ : element('ul', entry)}`;
2835
+ });
2836
+ }
2837
+ function highlight(src) {
2838
+ return src.replace(rx_highlight, function (all, _, p1, emp, sub, sup, small, big, p2, content) {
2839
+ return (_ +
2840
+ element(emp
2841
+ ? p2
2842
+ ? 'strong'
2843
+ : 'em'
2844
+ : sub
2845
+ ? p2
2846
+ ? 's'
2847
+ : 'sub'
2848
+ : sup
2849
+ ? 'sup'
2850
+ : small
2851
+ ? 'small'
2852
+ : big
2853
+ ? 'big'
2854
+ : 'code', highlight(content)));
2855
+ });
2856
+ }
2857
+ src = `\n${src}\n`;
2858
+ replace(rx_space, ' ');
2859
+ src = blockquote(src);
2860
+ replace(rx_hr, '<hr/>');
2861
+ src = list(src);
2862
+ replace(rx_listjoin, '');
2863
+ replace(rx_code, (_, p1, p2, p3, p4) => {
2864
+ stash[--si] = element('pre', element('code', p3 || p4.replace(/^ {4}/gm, '')));
2865
+ return `${si}\uf8ff`;
2866
+ });
2867
+ replace(rx_link, (_, p1, p2, p3, p4, p5, p6) => {
2868
+ stash[--si] = p4
2869
+ ? p2
2870
+ ? `<img src="${p4}" alt="${p3}"/>`
2871
+ : `<a href="${p4}">${highlight(p3)}</a>`
2872
+ : p6;
2873
+ return `${si}\uf8ff`;
2874
+ });
2875
+ replace(rx_table, (_, table) => {
2876
+ var _a;
2877
+ const sep = ((_a = table.match(rx_thead)) === null || _a === void 0 ? void 0 : _a[1]) || '';
2878
+ return `\n${element('table', table.replace(rx_row, (row, ri) => {
2879
+ return row === sep
2880
+ ? ''
2881
+ : element('tr', row.replace(rx_cell, (_, cell, ci) => ci
2882
+ ? element(sep && !ri ? 'th' : 'td', highlight(cell || ''))
2883
+ : ''));
2884
+ }))}`;
2885
+ });
2886
+ replace(rx_heading, (_, prefix, p1, p2) => {
2887
+ return prefix + element(`h${p1.length}`, highlight(p2));
2888
+ });
2889
+ replace(rx_para, (_, content) => {
2890
+ return element('p', highlight(content));
2891
+ });
2892
+ replace(rx_stash, (all) => stash[parseInt(all)]);
2893
+ return src.trim();
2894
+ };
2662
2895
 
2663
- let MarkdownRenderer =
2664
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2665
- class MarkdownRenderer extends s {
2896
+ class MarkdownRenderer extends r$2 {
2666
2897
  render() {
2667
- const slotContent = this.innerHTML.trim();
2668
- const parsedContent = t(slotContent);
2669
- return o(parsedContent);
2898
+ // Remove lit markers from slot content
2899
+ const slotContent = this.innerHTML
2900
+ .trim()
2901
+ .replace(/<!--\?lit\$[\d$]+-->/g, '');
2902
+ return o(markdown(slotContent));
2670
2903
  }
2671
- };
2672
- MarkdownRenderer.styles = i$3 `
2904
+ }
2905
+ MarkdownRenderer.styles = i$4 `
2673
2906
  :host {
2674
2907
  font-family: 'Inter', sans-serif;
2675
2908
  font-size: 16px;
@@ -2680,14 +2913,11 @@ MarkdownRenderer.styles = i$3 `
2680
2913
  }
2681
2914
  }
2682
2915
  `;
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 {
2916
+ if (!customElements.get('markdown-renderer')) {
2917
+ customElements.define('markdown-renderer', MarkdownRenderer);
2918
+ }
2919
+
2920
+ class TooltipComponent extends r$2 {
2691
2921
  constructor() {
2692
2922
  super(...arguments);
2693
2923
  this.position = 'bottom-left';
@@ -2699,18 +2929,18 @@ class TooltipComponent extends s {
2699
2929
  <div class="tooltip ${this.position}">${this.text}</div>
2700
2930
  `;
2701
2931
  }
2702
- };
2932
+ }
2703
2933
  TooltipComponent.styles = [
2704
- i$3 `
2934
+ i$4 `
2705
2935
  :host {
2706
2936
  position: relative;
2707
2937
  display: inline-block;
2708
2938
  }
2939
+
2709
2940
  .tooltip {
2710
2941
  position: absolute;
2711
2942
  color: #172a41;
2712
2943
  padding: 4px 8px;
2713
- border-radius: 4px;
2714
2944
  white-space: nowrap;
2715
2945
  font-size: 12px;
2716
2946
  opacity: 0;
@@ -2726,57 +2956,70 @@ TooltipComponent.styles = [
2726
2956
  font-weight: 400;
2727
2957
  line-height: 150%;
2728
2958
  }
2959
+
2729
2960
  :host(:hover) .tooltip {
2730
2961
  opacity: 1;
2731
2962
  }
2963
+
2732
2964
  .top-center {
2733
2965
  bottom: calc(100% + 2px);
2734
2966
  left: 50%;
2735
2967
  transform: translateX(-50%);
2736
2968
  }
2969
+
2737
2970
  .top-left {
2738
2971
  bottom: calc(100% + 2px);
2739
2972
  left: 0;
2740
2973
  }
2974
+
2741
2975
  .top-right {
2742
2976
  bottom: calc(100% + 2px);
2743
2977
  right: 0;
2744
2978
  }
2979
+
2745
2980
  .bottom-center {
2746
2981
  top: calc(100% + 2px);
2747
2982
  left: 50%;
2748
2983
  transform: translateX(-50%);
2749
2984
  }
2985
+
2750
2986
  .bottom-left {
2751
2987
  top: calc(100% + 2px);
2752
2988
  left: 0;
2753
2989
  }
2990
+
2754
2991
  .bottom-right {
2755
2992
  top: calc(100% + 2px);
2756
2993
  right: 0;
2757
2994
  }
2995
+
2758
2996
  .left-center {
2759
2997
  right: calc(100% + 2px);
2760
2998
  top: 50%;
2761
2999
  transform: translateY(-50%);
2762
3000
  }
3001
+
2763
3002
  .left-top {
2764
3003
  right: calc(100% + 2px);
2765
3004
  top: 0;
2766
3005
  }
3006
+
2767
3007
  .left-bottom {
2768
3008
  right: calc(100% + 2px);
2769
3009
  bottom: 0;
2770
3010
  }
3011
+
2771
3012
  .right-center {
2772
3013
  left: calc(100% + 2px);
2773
3014
  top: 50%;
2774
3015
  transform: translateY(-50%);
2775
3016
  }
3017
+
2776
3018
  .right-top {
2777
3019
  left: calc(100% + 2px);
2778
3020
  top: 0;
2779
3021
  }
3022
+
2780
3023
  .right-bottom {
2781
3024
  left: calc(100% + 2px);
2782
3025
  bottom: 0;
@@ -2784,19 +3027,18 @@ TooltipComponent.styles = [
2784
3027
  `,
2785
3028
  ];
2786
3029
  __decorate([
2787
- n$1({ type: String }),
3030
+ n({ type: String }),
2788
3031
  __metadata("design:type", String)
2789
3032
  ], TooltipComponent.prototype, "position", void 0);
2790
3033
  __decorate([
2791
- n$1({ type: String }),
2792
- __metadata("design:type", String)
3034
+ n({ type: String }),
3035
+ __metadata("design:type", Object)
2793
3036
  ], 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);
3037
+ if (!customElements.get('tooltip-component')) {
3038
+ customElements.define('tooltip-component', TooltipComponent);
3039
+ }
2798
3040
 
2799
- const confirmDialogStyles = i$3 `
3041
+ const confirmDialogStyles = i$4 `
2800
3042
  :host {
2801
3043
  font-family: 'Inter', sans-serif;
2802
3044
  font-size: 16px;
@@ -2875,9 +3117,7 @@ const confirmDialogStyles = i$3 `
2875
3117
  }
2876
3118
  `;
2877
3119
 
2878
- let ConfirmDialog =
2879
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2880
- class ConfirmDialog extends s {
3120
+ class ConfirmDialog extends r$2 {
2881
3121
  onAcceptClick(e) {
2882
3122
  e.preventDefault();
2883
3123
  this.dispatchEvent(new CustomEvent('accept', {
@@ -2910,19 +3150,17 @@ class ConfirmDialog extends s {
2910
3150
  </div>
2911
3151
  `;
2912
3152
  }
2913
- };
3153
+ }
2914
3154
  ConfirmDialog.styles = [confirmDialogStyles];
2915
- ConfirmDialog = __decorate([
2916
- t$2('confirm-dialog')
2917
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2918
- ], ConfirmDialog);
2919
-
2920
- let ChatSection =
2921
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2922
- class ChatSection extends s {
3155
+ if (!customElements.get('confirm-dialog')) {
3156
+ customElements.define('confirm-dialog', ConfirmDialog);
3157
+ }
3158
+
3159
+ class ChatSection extends r$2 {
2923
3160
  constructor() {
2924
3161
  super(...arguments);
2925
3162
  this.showChatThreads = false;
3163
+ this.deleteAllThreads = false;
2926
3164
  this.userQuery = '';
2927
3165
  }
2928
3166
  scrollToBottom() {
@@ -2947,6 +3185,14 @@ class ChatSection extends s {
2947
3185
  await this.processMessage(e, message);
2948
3186
  }
2949
3187
  handleThreadDelete() {
3188
+ if (this.deleteAllThreads) {
3189
+ this.dispatchEvent(new CustomEvent('delete-all-threads', {
3190
+ composed: true,
3191
+ bubbles: true,
3192
+ }));
3193
+ this.deleteAllThreads = false;
3194
+ return;
3195
+ }
2950
3196
  if (!this.deleteThreadId) {
2951
3197
  return;
2952
3198
  }
@@ -2958,7 +3204,7 @@ class ChatSection extends s {
2958
3204
  this.deleteThreadId = '';
2959
3205
  }
2960
3206
  typingIndicator() {
2961
- return x `<div class="typing-dots">
3207
+ return x ` <div class="typing-dots">
2962
3208
  <div class="dot"></div>
2963
3209
  <div class="dot"></div>
2964
3210
  <div class="dot"></div>
@@ -2974,8 +3220,8 @@ class ChatSection extends s {
2974
3220
  </div>
2975
3221
  <div>
2976
3222
  ${message.message
2977
- ? x `<markdown-renderer>${message.message}</markdown-renderer>`
2978
- : T}
3223
+ ? x ` <markdown-renderer>${message.message}</markdown-renderer>`
3224
+ : E}
2979
3225
  ${this.viewType !== 'modal' && ((_a = message.products) === null || _a === void 0 ? void 0 : _a[0])
2980
3226
  ? x `
2981
3227
  <span class="line"></span>
@@ -2986,27 +3232,29 @@ class ChatSection extends s {
2986
3232
  ></product-item>
2987
3233
  </div>
2988
3234
  `
2989
- : T}
3235
+ : E}
2990
3236
  </div>
2991
3237
  </div>
2992
3238
  ${this.viewType === 'modal' && message.products
2993
- ? x `<products-list
3239
+ ? x ` <products-list
2994
3240
  .products=${message.products}
2995
3241
  .siteCurrency=${this.siteCurrency}
2996
3242
  .viewType=${this.viewType}
2997
3243
  ></products-list>`
2998
- : T}
3244
+ : E}
2999
3245
  </div>
3000
3246
  `;
3001
3247
  }
3002
3248
  chatWindow() {
3003
- if (this.isLoadingHistory) {
3004
- return x ` <load-spinner></load-spinner> `;
3249
+ if (this.isLoadingHistory || this.isLoadingThreads) {
3250
+ return x `<div class="messages loading">
3251
+ <load-spinner></load-spinner>
3252
+ </div>`;
3005
3253
  }
3006
3254
  return x `
3007
3255
  <div class="messages">
3008
3256
  ${this.isTyping
3009
- ? x `<div class="message bot">
3257
+ ? x ` <div class="message bot">
3010
3258
  <div>
3011
3259
  <div class="bot-icon">${botIcon}</div>
3012
3260
  </div>
@@ -3018,7 +3266,7 @@ class ChatSection extends s {
3018
3266
  sender: 'bot',
3019
3267
  message: "Uh-oh! Looks like I tripped over some alpha-stage wires. Things are still a bit wobbly here, buy hey, that's what testing is for, Let's try that again; or feel free to throw another challenge my way!",
3020
3268
  })
3021
- : T}
3269
+ : E}
3022
3270
  ${this.messages.map((message) => {
3023
3271
  if (message.sender === 'bot') {
3024
3272
  return this.botMessage(message);
@@ -3031,11 +3279,10 @@ class ChatSection extends s {
3031
3279
  </div>
3032
3280
  <div>
3033
3281
  <p>
3034
- Welcome to the personalized search! How can we help?
3035
- <br />
3036
- <br />
3037
- Type your search query or select one of the prompts to get
3038
- started:
3282
+ Hi,
3283
+ ${this.brandName ? x `Welcome to ${this.brandName}.` : E}
3284
+ I'm here to help you find the perfect product? What are you
3285
+ looking to resolve today?
3039
3286
  </p>
3040
3287
  </div>
3041
3288
  </div>
@@ -3043,14 +3290,20 @@ class ChatSection extends s {
3043
3290
  `;
3044
3291
  }
3045
3292
  quickPrompts() {
3046
- var _a;
3047
- if (((_a = this.thread) === null || _a === void 0 ? void 0 : _a.threadId) || this.messages.length) {
3048
- return T;
3293
+ if (this.isLoadingHistory || this.isTyping || this.isLoadingThreads) {
3294
+ return E;
3295
+ }
3296
+ const prompts = this.messages.length
3297
+ ? this.messages[0].welcomePrompts
3298
+ : this.prompts
3299
+ ? this.prompts.split(',').map((prompt) => prompt.trim())
3300
+ : ['Best Selling Items', 'Hot Sales'];
3301
+ if (!prompts) {
3302
+ return E;
3049
3303
  }
3050
- const defaultPrompts = ['Best Selling Items', 'Hot Sales'];
3051
3304
  return x `
3052
3305
  <div class="prompts btn">
3053
- ${defaultPrompts.map((prompt) => x `
3306
+ ${prompts.map((prompt) => x `
3054
3307
  <div
3055
3308
  class="prompt"
3056
3309
  @click=${(e) => this.processMessage(e, prompt)}
@@ -3117,8 +3370,8 @@ class ChatSection extends s {
3117
3370
  <span class="context-type-value"> ${profileType} </span>
3118
3371
  </div>
3119
3372
  ${userDetails
3120
- ? x `<div class="context user-details">${userDetails}</div>`
3121
- : T}
3373
+ ? x ` <div class="context user-details">${userDetails}</div>`
3374
+ : E}
3122
3375
  </div>
3123
3376
  <div>
3124
3377
  <div class="context">
@@ -3126,10 +3379,10 @@ class ChatSection extends s {
3126
3379
  <span class="context-type-value">${visitationType}</span>
3127
3380
  </div>
3128
3381
  ${devContext.productHandle
3129
- ? x `<div class="context product-handle">
3382
+ ? x ` <div class="context product-handle">
3130
3383
  ${devContext.productHandle}
3131
3384
  </div>`
3132
- : T}
3385
+ : E}
3133
3386
  </div>
3134
3387
  </div>
3135
3388
  `;
@@ -3154,10 +3407,10 @@ class ChatSection extends s {
3154
3407
  </tooltip-component>
3155
3408
  <tooltip-component
3156
3409
  .position=${'bottom-right'}
3157
- .text=${'Your Search History'}
3410
+ .text=${'Search History'}
3158
3411
  >
3159
3412
  <button
3160
- class=${e$2({
3413
+ class=${e$1({
3161
3414
  btn: true,
3162
3415
  'btn-icon': true,
3163
3416
  'threads-btn': true,
@@ -3225,15 +3478,31 @@ class ChatSection extends s {
3225
3478
  }
3226
3479
  renderChatThreads() {
3227
3480
  if (!this.chatThreads || !this.showChatThreads) {
3228
- return T;
3481
+ return E;
3229
3482
  }
3230
- return x `<div id="modal-chat-threads">
3483
+ return x ` <div id="modal-chat-threads">
3231
3484
  <div class="chat-threads">
3232
- <h2>Your Search History</h2>
3485
+ <div class="title-wrapper">
3486
+ <h2>Search History</h2>
3487
+ ${this.chatThreads.size
3488
+ ? x `<div
3489
+ class="trash-icon"
3490
+ @click=${() => {
3491
+ if (this.isTyping) {
3492
+ return;
3493
+ }
3494
+ this.deleteAllThreads = true;
3495
+ this.showChatThreads = false;
3496
+ }}
3497
+ >
3498
+ ${trashIcon}
3499
+ </div>`
3500
+ : E}
3501
+ </div>
3233
3502
  <div class="thread-titles-wrapper">
3234
3503
  ${o$1(this.chatThreads.values(), (thread) => x `
3235
3504
  <div
3236
- class=${e$2({
3505
+ class=${e$1({
3237
3506
  'thread-title': true,
3238
3507
  disabled: this.isTyping,
3239
3508
  })}
@@ -3273,10 +3542,17 @@ class ChatSection extends s {
3273
3542
  </div>`;
3274
3543
  }
3275
3544
  render() {
3545
+ if (this.merchantImage) {
3546
+ // set the merchant image as a css variable
3547
+ this.style.setProperty('--shopgpt-merchant-img-url', `url('${this.merchantImage}')`);
3548
+ }
3549
+ else {
3550
+ this.style.removeProperty('--shopgpt-merchant-img-url');
3551
+ }
3276
3552
  return x `
3277
3553
  <div class="chat-header">${this.contextButton()}</div>
3278
3554
  <div
3279
- class=${e$2({
3555
+ class=${e$1({
3280
3556
  'chatbot-section': true,
3281
3557
  'modal-view': this.viewType === 'modal',
3282
3558
  })}
@@ -3290,7 +3566,7 @@ class ChatSection extends s {
3290
3566
  placeholder="Type your search here..."
3291
3567
  />
3292
3568
  <button
3293
- class=${e$2({
3569
+ class=${e$1({
3294
3570
  btn: true,
3295
3571
  modal: this.viewType === 'modal',
3296
3572
  })}
@@ -3307,96 +3583,128 @@ class ChatSection extends s {
3307
3583
  .defaultProfiles=${this.profiles}
3308
3584
  ></personalize-dialog>
3309
3585
  ${this.renderChatThreads()}
3310
- ${this.deleteThreadId
3586
+ ${this.deleteThreadId || this.deleteAllThreads
3311
3587
  ? x `
3312
3588
  <confirm-dialog
3313
3589
  @accept=${this.handleThreadDelete}
3314
- @decline=${() => (this.deleteThreadId = '')}
3590
+ @decline=${() => {
3591
+ this.deleteThreadId = '';
3592
+ this.deleteAllThreads = false;
3593
+ }}
3315
3594
  >
3316
- <h2 slot="title">Delete Thread?</h2>
3595
+ <h2 slot="title">
3596
+ ${this.deleteAllThreads
3597
+ ? 'Delete Entire Chat History?'
3598
+ : 'Delete Chat?'}
3599
+ </h2>
3317
3600
  <p slot="content">
3318
3601
  This action cannot be undone. Are you sure you want to delete
3319
- <b>"${this.chatThreads.get(this.deleteThreadId).title}"</b>?
3602
+ ${this.deleteAllThreads
3603
+ ? ' the entire chat history'
3604
+ : x `<b
3605
+ >"${this.chatThreads.get(this.deleteThreadId)
3606
+ .title}"</b
3607
+ >`}?
3320
3608
  </p>
3321
3609
  </confirm-dialog>
3322
3610
  `
3323
- : T}
3611
+ : E}
3324
3612
  `;
3325
3613
  }
3326
- };
3614
+ }
3327
3615
  ChatSection.styles = [chatSectionStyles];
3328
3616
  __decorate([
3329
- n$1({ type: Object }),
3617
+ n({ type: String }),
3618
+ __metadata("design:type", Object)
3619
+ ], ChatSection.prototype, "merchantImage", void 0);
3620
+ __decorate([
3621
+ n({ type: String }),
3622
+ __metadata("design:type", Object)
3623
+ ], ChatSection.prototype, "brandName", void 0);
3624
+ __decorate([
3625
+ n({ type: String }),
3626
+ __metadata("design:type", Object)
3627
+ ], ChatSection.prototype, "prompts", void 0);
3628
+ __decorate([
3629
+ n({ type: Boolean }),
3630
+ __metadata("design:type", Boolean)
3631
+ ], ChatSection.prototype, "isLoadingThreads", void 0);
3632
+ __decorate([
3633
+ n({ type: Object }),
3330
3634
  __metadata("design:type", Map)
3331
3635
  ], ChatSection.prototype, "chatThreads", void 0);
3332
3636
  __decorate([
3333
- r$1(),
3637
+ r(),
3334
3638
  __metadata("design:type", String)
3335
3639
  ], ChatSection.prototype, "deleteThreadId", void 0);
3336
3640
  __decorate([
3337
- n$1({ type: Boolean }),
3338
- __metadata("design:type", Boolean)
3641
+ n({ type: Boolean }),
3642
+ __metadata("design:type", Object)
3339
3643
  ], ChatSection.prototype, "showChatThreads", void 0);
3340
3644
  __decorate([
3341
- n$1({ type: Boolean }),
3645
+ n({ type: Boolean }),
3342
3646
  __metadata("design:type", Boolean)
3343
3647
  ], ChatSection.prototype, "isLoadingHistory", void 0);
3344
3648
  __decorate([
3345
- n$1({ type: Boolean }),
3649
+ n({ type: Boolean }),
3346
3650
  __metadata("design:type", Object)
3347
3651
  ], ChatSection.prototype, "devMode", void 0);
3348
3652
  __decorate([
3349
- n$1({ type: Boolean }),
3653
+ n({ type: Boolean }),
3350
3654
  __metadata("design:type", Boolean)
3351
3655
  ], ChatSection.prototype, "isTyping", void 0);
3352
3656
  __decorate([
3353
- n$1({ type: Boolean }),
3657
+ n({ type: Boolean }),
3354
3658
  __metadata("design:type", Boolean)
3355
3659
  ], ChatSection.prototype, "isFailed", void 0);
3356
3660
  __decorate([
3357
- n$1({ type: Array }),
3661
+ n({ type: Array }),
3358
3662
  __metadata("design:type", Array)
3359
3663
  ], ChatSection.prototype, "messages", void 0);
3360
3664
  __decorate([
3361
- n$1({ type: Array }),
3665
+ n({ type: Array }),
3362
3666
  __metadata("design:type", Array)
3363
3667
  ], ChatSection.prototype, "profiles", void 0);
3364
3668
  __decorate([
3365
- n$1({ type: Array }),
3669
+ n({ type: Array }),
3366
3670
  __metadata("design:type", Array)
3367
3671
  ], ChatSection.prototype, "productHandles", void 0);
3368
3672
  __decorate([
3369
- n$1({ type: Object }),
3673
+ n({ type: Object }),
3370
3674
  __metadata("design:type", Object)
3371
3675
  ], ChatSection.prototype, "thread", void 0);
3372
3676
  __decorate([
3373
- n$1({ type: Object }),
3677
+ n({ type: Object }),
3374
3678
  __metadata("design:type", Object)
3375
3679
  ], ChatSection.prototype, "siteCurrency", void 0);
3376
3680
  __decorate([
3377
- e$4('.context-container'),
3681
+ r(),
3682
+ __metadata("design:type", Object)
3683
+ ], ChatSection.prototype, "deleteAllThreads", void 0);
3684
+ __decorate([
3685
+ e$3('.context-container'),
3378
3686
  __metadata("design:type", Object)
3379
3687
  ], ChatSection.prototype, "contextContainerElement", void 0);
3380
3688
  __decorate([
3381
- e$4('.chat-window'),
3689
+ e$3('.chat-window'),
3382
3690
  __metadata("design:type", Object)
3383
3691
  ], ChatSection.prototype, "chatWindowElement", void 0);
3384
3692
  __decorate([
3385
- e$4('personalize-dialog'),
3693
+ e$3('personalize-dialog'),
3386
3694
  __metadata("design:type", Object)
3387
3695
  ], ChatSection.prototype, "personalizeDialogElement", void 0);
3388
3696
  __decorate([
3389
- n$1({ type: String }),
3390
- __metadata("design:type", String)
3697
+ n({ type: String }),
3698
+ __metadata("design:type", Object)
3391
3699
  ], ChatSection.prototype, "userQuery", void 0);
3392
- ChatSection = __decorate([
3393
- t$2('chat-section')
3394
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
3395
- ], ChatSection);
3700
+ if (!customElements.get('chat-section')) {
3701
+ customElements.define('chat-section', ChatSection);
3702
+ }
3396
3703
 
3397
3704
  const DIALOG_DELAY = 1000;
3705
+ const LATEST_THREAD_LOAD_DAYS = 14;
3398
3706
  const normalizePath = (path) => path.replace(/\/$/, '');
3399
- let ShopGPT = class ShopGPT extends s {
3707
+ class ShopGPT extends r$2 {
3400
3708
  constructor() {
3401
3709
  super(...arguments);
3402
3710
  this.modalState = 'close';
@@ -3408,6 +3716,18 @@ let ShopGPT = class ShopGPT extends s {
3408
3716
  this.products = [];
3409
3717
  this.messages = [];
3410
3718
  this.chatThreads = new Map();
3719
+ this.loadData = async () => {
3720
+ if (!this.shopGPTAPI) {
3721
+ return;
3722
+ }
3723
+ await this.loadChatThreads();
3724
+ this.selectLatestThread();
3725
+ };
3726
+ this.onPopState = () => {
3727
+ var _a;
3728
+ this.modalState = 'close';
3729
+ (_a = this.shopGPTDialog) === null || _a === void 0 ? void 0 : _a.close();
3730
+ };
3411
3731
  this.submitQuery = (message) => {
3412
3732
  if (!message) {
3413
3733
  return;
@@ -3431,14 +3751,14 @@ let ShopGPT = class ShopGPT extends s {
3431
3751
  }
3432
3752
  this.init();
3433
3753
  }
3754
+ disconnectedCallback() {
3755
+ window.removeEventListener('edgetag-initialized', this.loadData);
3756
+ window.removeEventListener('popstate', this.onPopState);
3757
+ super.disconnectedCallback();
3758
+ }
3434
3759
  init() {
3435
- window.addEventListener('edgetag-initialized', async () => {
3436
- if (!this.shopGPTAPI) {
3437
- return;
3438
- }
3439
- await this.loadChatThreads();
3440
- await this.loadInitialQuery();
3441
- });
3760
+ window.addEventListener('edgetag-initialized', this.loadData);
3761
+ window.addEventListener('popstate', this.onPopState);
3442
3762
  if (!this.uiMode || this.uiMode === 'overlay') {
3443
3763
  delay(DIALOG_DELAY).then(() => {
3444
3764
  var _a;
@@ -3453,6 +3773,19 @@ let ShopGPT = class ShopGPT extends s {
3453
3773
  });
3454
3774
  }
3455
3775
  }
3776
+ setChatTitle(threadId, title) {
3777
+ if (!title || !threadId) {
3778
+ return;
3779
+ }
3780
+ const thread = this.chatThreads.get(threadId);
3781
+ if (thread) {
3782
+ this.chatThreads.set(thread.threadId, {
3783
+ ...thread,
3784
+ title,
3785
+ });
3786
+ this.chatThreads = new Map(this.chatThreads);
3787
+ }
3788
+ }
3456
3789
  async loadInitialQuery() {
3457
3790
  var _a;
3458
3791
  if (!this.selectedThreadId) {
@@ -3465,14 +3798,26 @@ let ShopGPT = class ShopGPT extends s {
3465
3798
  if (!thread) {
3466
3799
  return;
3467
3800
  }
3801
+ const searchParam = new URLSearchParams(window.location.search);
3802
+ const fromAd = searchParam.get('shopGPT') === '1';
3468
3803
  const productHandle = this.devMode
3469
3804
  ? (_a = thread === null || thread === void 0 ? void 0 : thread.devContext) === null || _a === void 0 ? void 0 : _a.productHandle
3470
- : this.storeAPI.getCurrentProductHandle();
3805
+ : fromAd
3806
+ ? this.storeAPI.getCurrentProductHandle()
3807
+ : undefined;
3471
3808
  try {
3472
3809
  this.isTyping = true;
3473
3810
  const reply = await this.shopGPTAPI.processQuery('', thread.threadId, productHandle);
3811
+ if (reply.chatTitle) {
3812
+ this.setChatTitle(this.selectedThreadId, reply.chatTitle);
3813
+ }
3474
3814
  this.messages = [
3475
- { sender: 'bot', message: reply.message, products: reply.products },
3815
+ {
3816
+ sender: 'bot',
3817
+ message: reply.message,
3818
+ products: reply.products,
3819
+ welcomePrompts: reply.welcomePrompts,
3820
+ },
3476
3821
  ...this.messages,
3477
3822
  ];
3478
3823
  this.products = reply.products || [];
@@ -3498,8 +3843,24 @@ let ShopGPT = class ShopGPT extends s {
3498
3843
  this.isLoadingThreads = false;
3499
3844
  }
3500
3845
  }
3846
+ selectLatestThread() {
3847
+ const cutoffTime = Date.now() - LATEST_THREAD_LOAD_DAYS * 24 * 60 * 60 * 1000;
3848
+ // If the latest thread is not older than cutoff we should load the thread
3849
+ let latestThread;
3850
+ for (const thread of this.chatThreads.values()) {
3851
+ if (thread.createdAt >= cutoffTime &&
3852
+ (!latestThread || latestThread.createdAt < thread.createdAt)) {
3853
+ latestThread = thread;
3854
+ }
3855
+ }
3856
+ if (latestThread) {
3857
+ this.setSelectedThreadId(latestThread.threadId);
3858
+ }
3859
+ else if (!this.devMode) {
3860
+ this.createChatThread({ title: '' }, true);
3861
+ }
3862
+ }
3501
3863
  async loadHistory(threadId) {
3502
- var _a, _b, _c;
3503
3864
  try {
3504
3865
  if (!threadId) {
3505
3866
  this.messages = [];
@@ -3508,22 +3869,24 @@ let ShopGPT = class ShopGPT extends s {
3508
3869
  }
3509
3870
  this.isLoadingHistory = true;
3510
3871
  const data = await this.shopGPTAPI.fetchChatHistory(threadId);
3872
+ let latestAvailableProducts = [];
3511
3873
  this.messages = data.map((message) => {
3512
3874
  var _a;
3513
- return ({
3875
+ const products = (_a = message.products) === null || _a === void 0 ? void 0 : _a.map((product) => ({
3876
+ ...product,
3877
+ quantity: 1,
3878
+ }));
3879
+ if (!latestAvailableProducts.length && (products === null || products === void 0 ? void 0 : products.length)) {
3880
+ latestAvailableProducts = products;
3881
+ }
3882
+ return {
3514
3883
  message: message.message,
3515
3884
  sender: message.sender,
3516
- products: (_a = message.products) === null || _a === void 0 ? void 0 : _a.map((product) => ({
3517
- ...product,
3518
- quantity: 1,
3519
- })),
3520
- });
3885
+ products,
3886
+ welcomePrompts: message.welcomePrompts,
3887
+ };
3521
3888
  });
3522
- this.products =
3523
- (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.products) === null || _b === void 0 ? void 0 : _b.map((product) => ({
3524
- ...product,
3525
- quantity: 1,
3526
- }))) !== null && _c !== void 0 ? _c : [];
3889
+ this.products = latestAvailableProducts;
3527
3890
  }
3528
3891
  catch (e) {
3529
3892
  logger.error(e);
@@ -3564,6 +3927,21 @@ let ShopGPT = class ShopGPT extends s {
3564
3927
  this.shopGPTAPI
3565
3928
  .deleteSingleThread(threadId)
3566
3929
  .then(this.loadChatThreads.bind(this))
3930
+ .then(() => {
3931
+ if (this.selectedThreadId === threadId) {
3932
+ this.setSelectedThreadId('');
3933
+ }
3934
+ })
3935
+ .catch(logger.error)
3936
+ .finally(() => (this.isLoadingThreads = false));
3937
+ }
3938
+ handleAllThreadsDelete(e) {
3939
+ e.stopPropagation();
3940
+ this.isLoadingThreads = true;
3941
+ this.shopGPTAPI
3942
+ .deleteAllThreads()
3943
+ .then(this.loadChatThreads.bind(this))
3944
+ .then(() => this.setSelectedThreadId(''))
3567
3945
  .catch(logger.error)
3568
3946
  .finally(() => (this.isLoadingThreads = false));
3569
3947
  }
@@ -3582,21 +3960,20 @@ let ShopGPT = class ShopGPT extends s {
3582
3960
  return;
3583
3961
  }
3584
3962
  if (reply.chatTitle) {
3585
- // Alternatively we can fetch the chatThreads once again which would cost another network request
3586
- const thread = this.chatThreads.get(this.selectedThreadId);
3587
- if (thread) {
3588
- this.chatThreads.set(thread.threadId, {
3589
- ...thread,
3590
- title: reply.chatTitle,
3591
- });
3592
- this.chatThreads = new Map(this.chatThreads);
3593
- }
3963
+ this.setChatTitle(this.selectedThreadId, reply.chatTitle);
3594
3964
  }
3595
3965
  this.messages = [
3596
- { sender: 'bot', message: reply.message, products: reply.products },
3966
+ {
3967
+ sender: 'bot',
3968
+ message: reply.message,
3969
+ products: reply.products,
3970
+ welcomePrompts: reply.welcomePrompts,
3971
+ },
3597
3972
  ...this.messages,
3598
3973
  ];
3599
- this.products = reply.products || [];
3974
+ if (reply.products && reply.products.length > 0) {
3975
+ this.products = reply.products;
3976
+ }
3600
3977
  }
3601
3978
  catch (err) {
3602
3979
  logger.error(err);
@@ -3621,6 +3998,7 @@ let ShopGPT = class ShopGPT extends s {
3621
3998
  <dialog
3622
3999
  id="shop-gpt-dialog-overlay"
3623
4000
  @delete-thread=${this.handleThreadDelete}
4001
+ @delete-all-threads=${this.handleAllThreadsDelete}
3624
4002
  >
3625
4003
  <div class="mobile-version">
3626
4004
  Please switch to the desktop version for the best experience.
@@ -3635,11 +4013,15 @@ let ShopGPT = class ShopGPT extends s {
3635
4013
  .merchantUrl=${this.merchantUrl}
3636
4014
  ></chat-threads>
3637
4015
  <products-section
4016
+ .merchantImage=${this.merchantImage}
3638
4017
  .products=${this.products}
3639
4018
  .isLoadingHistory=${this.isLoadingHistory}
3640
4019
  .siteCurrency=${this.getSiteCurrency()}
4020
+ .isLoadingThreads=${this.isLoadingThreads}
3641
4021
  ></products-section>
3642
4022
  <chat-section
4023
+ .prompts=${this.quickPrompts}
4024
+ .brandName=${this.brandName}
3643
4025
  .isFailed=${this.isFailed}
3644
4026
  .isLoadingHistory=${this.isLoadingHistory}
3645
4027
  .isTyping=${this.isTyping}
@@ -3652,6 +4034,7 @@ let ShopGPT = class ShopGPT extends s {
3652
4034
  .productHandles=${this.productHandles}
3653
4035
  .profiles=${this.profiles}
3654
4036
  .viewType=${'overlay'}
4037
+ .isLoadingThreads=${this.isLoadingThreads}
3655
4038
  ></chat-section>
3656
4039
  </div>
3657
4040
  </dialog>
@@ -3663,7 +4046,7 @@ let ShopGPT = class ShopGPT extends s {
3663
4046
  this.modalState = 'close';
3664
4047
  };
3665
4048
  if (this.modalState === 'close') {
3666
- return x `<div class="chatbot-widget">
4049
+ return x ` <div class="chatbot-widget">
3667
4050
  <button
3668
4051
  @click=${(e) => {
3669
4052
  e.preventDefault();
@@ -3672,11 +4055,18 @@ let ShopGPT = class ShopGPT extends s {
3672
4055
  >
3673
4056
  ${chatIcon}
3674
4057
  </button>
4058
+ <div class="chatbot-hover-text">What are you looking for today?</div>
3675
4059
  </div>`;
3676
4060
  }
3677
4061
  return x `
3678
- <div id="shop-gpt-modal" @delete-thread=${this.handleThreadDelete}>
4062
+ <div
4063
+ id="shop-gpt-modal"
4064
+ @delete-thread=${this.handleThreadDelete}
4065
+ @delete-all-threads=${this.handleAllThreadsDelete}
4066
+ >
3679
4067
  <chat-section
4068
+ .prompts=${this.quickPrompts}
4069
+ .brandName=${this.brandName}
3680
4070
  .isFailed=${this.isFailed}
3681
4071
  .isLoadingHistory=${this.isLoadingHistory}
3682
4072
  .isTyping=${this.isTyping}
@@ -3692,55 +4082,57 @@ let ShopGPT = class ShopGPT extends s {
3692
4082
  .closeModal=${closeModal}
3693
4083
  .setSelectedThreadId=${this.setSelectedThreadId.bind(this)}
3694
4084
  .chatThreads=${this.chatThreads}
4085
+ .isLoadingThreads=${this.isLoadingThreads}
4086
+ .merchantImage=${this.merchantImage}
3695
4087
  ></chat-section>
3696
4088
  </div>
3697
4089
  `;
3698
4090
  }
3699
- };
4091
+ }
3700
4092
  ShopGPT.styles = [shopGPTStyles];
3701
4093
  __decorate([
3702
- e$4('#shop-gpt-dialog-overlay'),
4094
+ e$3('#shop-gpt-dialog-overlay'),
3703
4095
  __metadata("design:type", Object)
3704
4096
  ], ShopGPT.prototype, "shopGPTDialog", void 0);
3705
4097
  __decorate([
3706
- n$1({ type: String }),
4098
+ n({ type: String }),
3707
4099
  __metadata("design:type", String)
3708
4100
  ], ShopGPT.prototype, "modalState", void 0);
3709
4101
  __decorate([
3710
- n$1({ type: Boolean }),
3711
- __metadata("design:type", Boolean)
4102
+ n({ type: Boolean }),
4103
+ __metadata("design:type", Object)
3712
4104
  ], ShopGPT.prototype, "isLoadingHistory", void 0);
3713
4105
  __decorate([
3714
- n$1({ type: Boolean }),
3715
- __metadata("design:type", Boolean)
4106
+ n({ type: Boolean }),
4107
+ __metadata("design:type", Object)
3716
4108
  ], ShopGPT.prototype, "isLoadingThreads", void 0);
3717
4109
  __decorate([
3718
- n$1({ type: Boolean }),
3719
- __metadata("design:type", Boolean)
4110
+ n({ type: Boolean }),
4111
+ __metadata("design:type", Object)
3720
4112
  ], ShopGPT.prototype, "isTyping", void 0);
3721
4113
  __decorate([
3722
- n$1({ type: Boolean }),
3723
- __metadata("design:type", Boolean)
4114
+ n({ type: Boolean }),
4115
+ __metadata("design:type", Object)
3724
4116
  ], ShopGPT.prototype, "isFailed", void 0);
3725
4117
  __decorate([
3726
- n$1({ type: String }),
3727
- __metadata("design:type", String)
4118
+ n({ type: String }),
4119
+ __metadata("design:type", Object)
3728
4120
  ], ShopGPT.prototype, "selectedThreadId", void 0);
3729
4121
  __decorate([
3730
- n$1({ type: Array }),
4122
+ n({ type: Array }),
3731
4123
  __metadata("design:type", Array)
3732
4124
  ], ShopGPT.prototype, "products", void 0);
3733
4125
  __decorate([
3734
- n$1({ type: Array }),
4126
+ n({ type: Array }),
3735
4127
  __metadata("design:type", Array)
3736
4128
  ], ShopGPT.prototype, "messages", void 0);
3737
4129
  __decorate([
3738
- n$1({ type: Object }),
4130
+ n({ type: Object }),
3739
4131
  __metadata("design:type", Map)
3740
4132
  ], ShopGPT.prototype, "chatThreads", void 0);
3741
- ShopGPT = __decorate([
3742
- t$2('shop-gpt')
3743
- ], ShopGPT);
4133
+ if (!customElements.get('shop-gpt')) {
4134
+ customElements.define('shop-gpt', ShopGPT);
4135
+ }
3744
4136
 
3745
4137
  var _a, _b;
3746
4138
  var _c;
@@ -3761,8 +4153,19 @@ if (typeof window != 'undefined' && typeof document != 'undefined') {
3761
4153
  shopGPT.productHandles = params.productHandles;
3762
4154
  shopGPT.uiMode = params.uiMode;
3763
4155
  shopGPT.path = params.path;
4156
+ shopGPT.brandName = params.brandName;
4157
+ shopGPT.quickPrompts = params.quickPrompts;
4158
+ shopGPT.merchantImage = params.merchantImage;
3764
4159
  document.body.append(shopGPT);
3765
4160
  },
4161
+ destroy() {
4162
+ if (!shopGPT) {
4163
+ return;
4164
+ }
4165
+ shopGPT.remove();
4166
+ shopGPT = undefined;
4167
+ delete window[registryKey];
4168
+ },
3766
4169
  });
3767
4170
  }
3768
4171