UNPKG

@relewise/web-components

Version:

Relewise is a next generation personalization SaaS-platform, which offers functionality within product- and content recommendations and personalized search. Our official Web Components provide simple and easy components for rendering personalized experien

780 lines (718 loc) 501 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.RelewiseWebComponents = {})); })(this, (function (exports) { 'use strict'; /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; /** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const t$2=globalThis,e$6=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$7=Symbol(),o$6=new WeakMap;let n$6 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$7)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$6&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$6.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$6.set(s,t));}return t}toString(){return this.cssText}};const r$5=t=>new n$6("string"==typeof t?t:t+"",void 0,s$7),i$7=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(true===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$6(o,t,s$7)},S$1=(s,o)=>{if(e$6)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$2.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$5=e$6?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$5(e)})(t):t; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const{is:i$6,defineProperty:e$5,getOwnPropertyDescriptor:h$3,getOwnPropertyNames:r$4,getOwnPropertySymbols:o$5,getPrototypeOf:n$5}=Object,a$1=globalThis,c$4=a$1.trustedTypes,l$1=c$4?c$4.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$3=(t,s)=>!i$6(t,s),b={attribute:true,type:String,converter:u$1,reflect:false,useDefault:false,hasChanged:f$3};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let y$1 = class y 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=b){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$5(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$3(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$5(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=true,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...r$4(t),...o$5(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$5(s));}else void 0!==s&&i.push(c$5(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,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(true),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),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),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){const e=this.constructor,h=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??f$3)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;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){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM();}updated(t){}firstUpdated(t){}};y$1.elementStyles=[],y$1.shadowRootOptions={mode:"open"},y$1[d$1("elementProperties")]=new Map,y$1[d$1("finalized")]=new Map,p$1?.({ReactiveElement:y$1}),(a$1.reactiveElementVersions??=[]).push("2.1.1"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const t$1=globalThis,i$5=t$1.trustedTypes,s$6=i$5?i$5.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$4="$lit$",h$2=`lit$${Math.random().toFixed(9).slice(2)}$`,o$4="?"+h$2,n$4=`<${o$4}>`,r$3=document,l=()=>r$3.createComment(""),c$3=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$2=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m$1=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),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$6?s$6.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f$2;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$2?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m$1):void 0!==u[3]&&(c=m$1):c===m$1?">"===u[0]?(c=r??f$2,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m$1:'"'===u[3]?g:p):c===g||c===p?c=m$1:c===v||c===_?c=f$2:(c=m$1,r=void 0);const x=c===m$1&&t[i+1].startsWith("/>")?" ":"";l+=c===f$2?s+n$4:d>=0?(o.push(a),s.slice(0,d)+e$4+s.slice(d)+h$2+x):s+h$2+(-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$4)){const i=v[a++],s=r.getAttribute(t).split(h$2),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$2)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h$2),s=t.length-1;if(s>0){r.textContent=i$5?i$5.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$4)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h$2,t+1));)d.push({type:7,index:c}),t+=h$2.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$3(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),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,true);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??true;}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$3(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$3(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?.(false,true,i);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=false;if(void 0===h)t=S(this,t,i,0),o=!c$3(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$3(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.3.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}; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const s$5=globalThis;let i$4 = class i extends y$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 r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return T}};i$4._$litElement$=true,i$4["finalized"]=true,s$5.litElementHydrateSupport?.({LitElement:i$4});const o$3=s$5.litElementPolyfillSupport;o$3?.({LitElement:i$4});(s$5.litElementVersions??=[]).push("4.2.1"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const o$2={attribute:true,type:String,converter:u$1,reflect:false,hasChanged:f$3},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),"setter"===n&&((t=Object.create(t)).wrapped=true),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.C(o,void 0,t,e),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$3(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,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)} /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */function r$1(r){return n$3({...r,state:true,attribute:false})} function getRelewiseUIOptions() { const options = window.relewiseUIOptions; if (!options || !options.datasetId || !options.apiKey || !options.contextSettings) { throw new Error('Relewise UI not correctly configured'); } return options; } function getRelewiseUISearchOptions() { return window.relewiseUISearchOptions; } function getRelewiseSearchTargetedConfigurations() { return window.relewiseUISearchTargetedConfigurations; } function getRelewiseRecommendationTargetedConfigurations() { return window.relewiseUIRecommendationTargetedConfigurations; } async function getRelewiseContextSettings(displayedAtLocation) { const contextSettings = getRelewiseUIOptions().contextSettings; const user = await contextSettings.getUser(); return { currency: contextSettings.currency, displayedAtLocation: displayedAtLocation, language: contextSettings.language, user: user, }; } function formatPrice(price) { if (!price) { return ''; } const contextSettings = getRelewiseUIOptions().contextSettings; try { return new Intl.NumberFormat(contextSettings.language, { style: 'currency', currency: contextSettings.currency, }).format(Number(price)); } catch { return price; } } function stripHtmlClientSide(value) { if (typeof value !== 'string') { return value; } if (typeof document !== 'undefined') { const container = document.createElement('div'); container.innerHTML = value; return (container.textContent ?? container.innerText ?? ''); } console.error('Relewise web component: stripHtmlClientSide can only be executed in a browser environment. Returning the raw string.'); return value; } const templateHelpers = { stripHtmlClientSide, }; const theme = i$7 ` :host { font-size: var(--relewise-base-font-size, 16px); --font: var(--relewise-font, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"); --color: var(--relewise-color, #eee); --accent-color:var(--relewise-accent-color, #3764e4); --relewise-icon-color: var(--color); --relewise-x-icon-color: var(--color); --border-radius: var(--relewise-border-radius, 1em); --border: var(--relewise-border, 1px solid) } .rw-button { margin: 0; padding: 0; font-family: var(--font); height: var(--relewise-button-height, 3em); border: var(--border); border-radius: var(--border-radius); border-color: var(--accent-color); background-color: var(--accent-color); font-size: var(--relewise-button-font-size, 1em); } .rw-border { border: var(--border); border-radius: var(--border-radius) } `; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const t={CHILD:2},e$3=t=>(...e)=>({_$litDirective$:t,values:e});let i$3 = 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)}}; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */let e$2 = class e extends i$3{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$2.directiveName="unsafeHTML",e$2.resultType=1;const o$1=e$3(e$2); /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const i$2=o=>null===o||"object"!=typeof o&&"function"!=typeof o,f$1=o=>void 0===o.strings; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const s$4=(i,t)=>{const e=i._$AN;if(void 0===e)return false;for(const i of e)i._$AO?.(t,false),s$4(i,t);return true},o=i=>{let t,e;do{if(void 0===(t=i._$AM))break;e=t._$AN,e.delete(i),i=t;}while(0===e?.size)},r=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(void 0===e)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),c$2(t);}};function h$1(i){ void 0!==this._$AN?(o(this),this._$AM=i,r(this)):this._$AM=i;}function n$2(i,t=false,e=0){const r=this._$AH,h=this._$AN;if(void 0!==h&&0!==h.size)if(t)if(Array.isArray(r))for(let i=e;i<r.length;i++)s$4(r[i],false),o(r[i]);else null!=r&&(s$4(r,false),o(r));else s$4(this,i);}const c$2=i=>{i.type==t.CHILD&&(i._$AP??=n$2,i._$AQ??=h$1);};class f extends i$3{constructor(){super(...arguments),this._$AN=void 0;}_$AT(i,t,e){super._$AT(i,t,e),r(this),this.isConnected=i._$AU;}_$AO(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(s$4(this,i),o(this));}setValue(t){if(f$1(this._$Ct))this._$Ct._$AI(t,this);else {const i=[...this._$Ct._$AH];i[this._$Ci]=t,this._$Ct._$AI(i,this,0);}}disconnected(){}reconnected(){}} /** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ let s$3 = class s{constructor(t){this.G=t;}disconnect(){this.G=void 0;}reconnect(t){this.G=t;}deref(){return this.G}};let i$1 = class i{constructor(){this.Y=void 0,this.Z=void 0;}get(){return this.Y}pause(){this.Y??=new Promise((t=>this.Z=t));}resume(){this.Z?.(),this.Y=this.Z=void 0;}}; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const n$1=t=>!i$2(t)&&"function"==typeof t.then,h=1073741823;let c$1 = class c extends f{constructor(){super(...arguments),this._$Cwt=h,this._$Cbt=[],this._$CK=new s$3(this),this._$CX=new i$1;}render(...s){return s.find((t=>!n$1(t)))??T}update(s,i){const e=this._$Cbt;let r=e.length;this._$Cbt=i;const o=this._$CK,c=this._$CX;this.isConnected||this.disconnected();for(let t=0;t<i.length&&!(t>this._$Cwt);t++){const s=i[t];if(!n$1(s))return this._$Cwt=t,s;t<r&&s===e[t]||(this._$Cwt=h,r=0,Promise.resolve(s).then((async t=>{for(;c.get();)await c.get();const i=o.deref();if(void 0!==i){const e=i._$Cbt.indexOf(s);e>-1&&e<i._$Cwt&&(i._$Cwt=e,i.setValue(t));}})));}return T}disconnected(){this._$CK.disconnect(),this._$CX.pause();}reconnected(){this._$CK.reconnect(this),this._$CX.resume();}};const m=e$3(c$1); class ProductTile extends i$4 { constructor() { super(...arguments); this.product = null; this.user = null; } // Override Lit's shadow root creation and only attach default styles when no template override exists. createRenderRoot() { const root = super.createRenderRoot(); if (root instanceof ShadowRoot) { let hasCustomTemplate = false; try { const settings = getRelewiseUIOptions(); hasCustomTemplate = Boolean(settings.templates?.product); } catch (error) { console.error('Relewise: Error initializing initializeRelewiseUI. Keeping default styles, ', error); } if (!hasCustomTemplate) { S$1(root, ProductTile.defaultStyles); } } return root; } connectedCallback() { super.connectedCallback(); } render() { if (!this.product) { return; } const settings = getRelewiseUIOptions(); if (settings.templates?.product) { const result = settings.templates.product(this.product, { html: x, helpers: { ...templateHelpers, formatPrice, unsafeHTML: o$1, nothing: E, user: this.user } }); const markup = result instanceof Promise ? x ` ${m(result.then(result => { if (result === E) { this.toggleAttribute('hidden', true); } return result; }))}` : result; if (result === E) { this.toggleAttribute('hidden', true); } return x `${markup}`; } const url = this.product.data && 'Url' in this.product.data ? this.product.data['Url'].value ?? '' : null; const engagementSettings = settings.userEngagement?.product; return x ` <div class='rw-tile'> ${engagementSettings?.favorite ? x `<relewise-product-favorite-button .product=${this.product} .user=${this.user}> </relewise-product-favorite-button>` : E} ${url ? x `<a class='rw-tile-link' href=${url}>${this.renderTileContent(this.product)}</a>` : x `<div class='rw-tile-link'>${this.renderTileContent(this.product)}</div>`} ${engagementSettings?.sentiment ? x `<relewise-product-sentiment-buttons .product=${this.product} .user=${this.user}> </relewise-product-sentiment-buttons>` : E} </div>`; } renderTileContent(product) { return x ` ${(product.data && 'ImageUrl' in product.data) ? x `<div class="rw-image-container"><img class="rw-object-cover" src=${product.data['ImageUrl'].value} alt=${this.getProductImageAlt(product)} /></div>` : E} <div class='rw-information-container'> <h5 class='rw-display-name'>${product.displayName}</h5> <div class='rw-price'> <span>${formatPrice(product.salesPrice)}</span> ${(product.salesPrice && product.listPrice && product.listPrice !== product.salesPrice) ? x `<span class='rw-list-price'>${formatPrice(product.listPrice)}</span>` : E} </div> </div>`; } getProductImageAlt(product) { const altText = product.variant?.displayName ?? product.displayName ?? ''; return altText ?? ''; } static { this.defaultStyles = [ theme, i$7 ` :host { font-family: var(--font); border: 1px solid var(--relewise-checklist-facet-border-color, #eee); background-color: var(--button-color, white); clip-path: inset(0 round 0.5em); border-radius: 0.5em; box-shadow: 0 1px rgb(0 0 0 / 0.05); } .rw-tile { display: flex; flex-direction: column; position: relative; text-decoration: inherit; text-size-adjust: none; height: 100%; gap: var(--relewise-sentiment-gap, 0.5em); } .rw-tile-link { display: flex; flex-direction: column; text-decoration: inherit; color: inherit; flex: 1; } .rw-tile-link:focus-visible { outline: 2px solid var(--relewise-focus-outline-color, #000); outline-offset: 2px; } .rw-image-container { display: flex; padding: var(--relewise-image-padding, 0); background-color: var(--relewise-image-background-color, #fff); justify-content: var(--relewise-image-align, center); } .rw-information-container { margin: var(--relewise-information-container-margin, 0.5em 0.5em); } .rw-object-cover { object-fit: contain; max-width: var(--relewise-image-width, 100%); height: var(--relewise-image-height, auto); } .rw-price { line-height: 1; display: flex; font-weight: var(--relewise-sales-price-font-weight, 300); font-size: var(--relewise-sales-price-font-size, 1em); color: var(--relewise-sales-price-color, #212427); justify-content: var(--relewise-sales-price-alignment, start); align-items:center; margin: var(--relewise-sales-price-margin, 1em 0em 0em 0em); } .rw-display-name { display: -webkit-box; letter-spacing: var(--relewise-display-name-letter-spacing, -0.025em); justify-content: var(--relewise-display-name-alignment, start); color: var(--relewise-display-name-color, #212427); line-height: var(--relewise-display-name-line-height, 1); font-weight: var(--relewise-display-name-font-weight, 500); font-size: var(--relewise-display-name-font-size, 1em); margin: var(--relewise-display-name-margin, 0em 0em 0em 0em); overflow: hidden; height: calc(var(--relewise-display-name-line-height, 1.05em)* 2); -webkit-box-orient: vertical; -webkit-line-clamp: 2; } .rw-list-price { font-size: var(--relewise-list-price-font-size, 1em); text-decoration: var(--relewise-list-price-text-decoration, line-through); font-weight: 400; color: var(--relewise-list-price-color, #bbb); margin: var(--relewise-list-price-margin, 0em 0em 0em 0.5em); } ` ]; } } __decorate([ n$3({ type: Object }) ], ProductTile.prototype, "product", void 0); __decorate([ n$3({ type: Object }) ], ProductTile.prototype, "user", void 0); class ContentTile extends i$4 { constructor() { super(...arguments); this.content = null; this.user = null; } // Override Lit's shadow root creation and only attach default styles when no template override exists. createRenderRoot() { const root = super.createRenderRoot(); if (root instanceof ShadowRoot) { let hasCustomTemplate = false; try { const settings = getRelewiseUIOptions(); hasCustomTemplate = Boolean(settings.templates?.content); } catch (error) { console.error('Relewise: Error initializing initializeRelewiseUI. Keeping default styles, ', error); } if (!hasCustomTemplate) { S$1(root, ContentTile.defaultStyles); } } return root; } connectedCallback() { super.connectedCallback(); } render() { if (!this.content) { return; } const settings = getRelewiseUIOptions(); if (settings.templates?.content) { const result = settings.templates.content(this.content, { html: x, helpers: { ...templateHelpers, unsafeHTML: o$1, nothing: E, user: this.user } }); const markup = result instanceof Promise ? x ` ${m(result.then(result => { if (result === E) { this.toggleAttribute('hidden', true); } return result; }))}` : result; if (result === E) { this.toggleAttribute('hidden', true); } return x `${markup}`; } const url = this.content.data && 'Url' in this.content.data ? this.content.data['Url'].value ?? '' : null; const engagementSettings = settings.userEngagement?.content; return x ` <div class="rw-content-tile${engagementSettings?.favorite ? ' --rw-has-favorite' : ''}"> ${engagementSettings?.favorite ? x `<relewise-content-favorite-button .content=${this.content} .user=${this.user}> </relewise-content-favorite-button>` : E} ${url ? x `<a class='rw-content-link' href=${url}>${this.renderTileContent(this.content)}</a>` : x `<div class='rw-content-link'>${this.renderTileContent(this.content)}</div>`} ${engagementSettings?.sentiment ? x `<relewise-content-sentiment-buttons .content=${this.content} .user=${this.user}> </relewise-content-sentiment-buttons>` : E} </div>`; } renderTileContent(content) { const image = content.data && 'ImageUrl' in content.data ? content.data['ImageUrl'].value : null; const summary = content.data && 'Summary' in content.data ? content.data['Summary'].value : null; return x ` <div class="rw-image-container"> ${image ? x `<img class="rw-object-cover" src=${image} alt=${this.getContentImageAlt(content)} />` : E} </div> <div class='rw-information-container'> <h5 class='rw-display-name'>${content.displayName}</h5> ${summary ? x `<p class="rw-summary">${summary}</p>` : E} </div>`; } getContentImageAlt(content) { const altText = content.displayName ?? ''; return altText ?? ''; } static { this.defaultStyles = [ theme, i$7 ` :host { font-family: var(--font); border: 1px solid var(--relewise-checklist-facet-border-color, #eee); background-color: var(--button-color, white); clip-path: inset(0 round 0.5em); border-radius: 0.5em; box-shadow: 0 1px rgb(0 0 0 / 0.05); } .rw-content-tile { display: flex; flex-direction: column; position: relative; text-decoration: inherit; text-size-adjust: none; height: 100%; gap: var(--relewise-sentiment-gap, 0.5em); } .rw-content-link { display: flex; flex-direction: column; text-decoration: inherit; color: inherit; flex: 1; justify-content: flex-end; } .rw-content-link:focus-visible { outline: 2px solid var(--relewise-focus-outline-color, #000); outline-offset: 2px; } .rw-image-container { display: flex; padding: var(--relewise-image-padding, 0); background-color: var(--relewise-image-background-color, #fff); justify-content: var(--relewise-image-align, center); } .rw-information-container { margin: var(--relewise-information-container-margin, 0.5em 0.5em); } .--rw-has-favorite .rw-display-name { margin-right: var(--relewise-favorite-space, 2.1em); } .rw-object-cover { object-fit: contain; max-width: var(--relewise-image-width, 100%); height: var(--relewise-image-height, auto); } .rw-display-name { display: -webkit-box; letter-spacing: var(--relewise-display-name-letter-spacing, -0.025em); justify-content: var(--relewise-display-name-alignment, start); color: var(--relewise-display-name-color, #212427); line-height: var(--relewise-display-name-line-height, 1); font-weight: var(--relewise-display-name-font-weight, 500); font-size: var(--relewise-display-name-font-size, 1em); margin: var(--relewise-display-name-margin, 0em 0em 0em 0em); overflow: hidden; height: calc(var(--relewise-display-name-line-height, 1.05em) * 2); -webkit-box-orient: vertical; -webkit-line-clamp: 2; } .rw-summary { margin: 0; font-size: calc(var(--relewise-base-font-size, 16px) * 0.9); line-height: var(--relewise-summary-line-height, 1.2); color: var(--relewise-summary-color, #666); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; height: calc(var(--relewise-summary-line-height, 1.25em) * 2); } ` ]; } } __decorate([ n$3({ type: Object }) ], ContentTile.prototype, "content", void 0); __decorate([ n$3({ type: Object }) ], ContentTile.prototype, "user", void 0); class SearchIcon extends i$4 { connectedCallback() { super.connectedCallback(); } render() { return x ` <svg part="icon" id="svg-icon" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="122.879px" height="119.799px" viewBox="0 0 122.879 119.799" enable-background="new 0 0 122.879 119.799" xml:space="preserve"> <g> <path d="M49.988,0h0.016v0.007C63.803,0.011,76.298,5.608,85.34,14.652c9.027,9.031,14.619,21.515,14.628,35.303h0.007v0.033v0.04 h-0.007c-0.005,5.557-0.917,10.905-2.594,15.892c-0.281,0.837-0.575,1.641-0.877,2.409v0.007c-1.446,3.66-3.315,7.12-5.547,10.307 l29.082,26.139l0.018,0.016l0.157,0.146l0.011,0.011c1.642,1.563,2.536,3.656,2.649,5.78c0.11,2.1-0.543,4.248-1.979,5.971 l-0.011,0.016l-0.175,0.203l-0.035,0.035l-0.146,0.16l-0.016,0.021c-1.565,1.642-3.654,2.534-5.78,2.646 c-2.097,0.111-4.247-0.54-5.971-1.978l-0.015-0.011l-0.204-0.175l-0.029-0.024L78.761,90.865c-0.88,0.62-1.778,1.209-2.687,1.765 c-1.233,0.755-2.51,1.466-3.813,2.115c-6.699,3.342-14.269,5.222-22.272,5.222v0.007h-0.016v-0.007 c-13.799-0.004-26.296-5.601-35.338-14.645C5.605,76.291,0.016,63.805,0.007,50.021H0v-0.033v-0.016h0.007 c0.004-13.799,5.601-26.296,14.645-35.338C23.683,5.608,36.167,0.016,49.955,0.007V0H49.988L49.988,0z M50.004,11.21v0.007h-0.016 h-0.033V11.21c-10.686,0.007-20.372,4.35-27.384,11.359C15.56,29.578,11.213,39.274,11.21,49.973h0.007v0.016v0.033H11.21 c0.007,10.686,4.347,20.367,11.359,27.381c7.009,7.012,16.705,11.359,27.403,11.361v-0.007h0.016h0.033v0.007 c10.686-0.007,20.368-4.348,27.382-11.359c7.011-7.009,11.358-16.702,11.36-27.4h-0.006v-0.016v-0.033h0.006 c-0.006-10.686-4.35-20.372-11.358-27.384C70.396,15.56,60.703,11.213,50.004,11.21L50.004,11.21z"/> </g> </svg>`; } static { this.styles = i$7 ` :host { line-height: 1; width: var(--relewise-icon-width, 1em); height: var(--relewise-icon-height, 1em); } #svg-icon { width: var(--relewise-icon-width, 1em); height: var(--relewise-icon-height, 1em); fill: var(--relewise-icon-color); } `; } } class XIcon extends i$4 { connectedCallback() { super.connectedCallback(); } render() { return x ` <svg part="icon" id="svg-icon" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="122.879px" height="119.799px" viewBox="0 0 122.879 119.799" enable-background="new 0 0 122.879 119.799" xml:space="preserve"> <g> <path d="M1.426,8.313c-1.901-1.901-1.901-4.984,0-6.886c1.901-1.902,4.984-1.902,6.886,0l53.127,53.127l53.127-53.127 c1.901-1.902,4.984-1.902,6.887,0c1.901,1.901,1.901,4.985,0,6.886L68.324,61.439l53.128,53.128c1.901,1.901,1.901,4.984,0,6.886 c-1.902,1.902-4.985,1.902-6.887,0L61.438,68.326L8.312,121.453c-1.901,1.902-4.984,1.902-6.886,0 c-1.901-1.901-1.901-4.984,0-6.886l53.127-53.128L1.426,8.313L1.426,8.313z"/> </g> </svg> `; } static { this.styles = i$7 ` :host { line-height: 1; width: var(--relewise-icon-width, 1em); height: var(--relewise-icon-height, 1em); } #svg-icon { width: var(--relewise-icon-width, 1em); height: var(--relewise-icon-height, 1em); fill: var(--relewise-icon-color); } `; } } class FilterIcon extends i$4 { connectedCallback() { super.connectedCallback(); } render() { return x ` <svg id="svg-icon" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> <path d="M3 7C3 6.44772 3.44772 6 4 6H20C20.5523 6 21 6.44772 21 7C21 7.55228 20.5523 8 20 8H4C3.44772 8 3 7.55228 3 7ZM6 12C6 11.4477 6.44772 11 7 11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H7C6.44772 13 6 12.5523 6 12ZM9 17C9 16.4477 9.44772 16 10 16H14C14.5523 16 15 16.4477 15 17C15 17.5523 14.5523 18 14 18H10C9.44772 18 9 17.5523 9 17Z"/> </svg>`; } static { this.styles = i$7 ` :host { line-height: 1; width: var(--relewise-icon-width, 1em); height: var(--relewise-icon-height, 1em); } #svg-icon { width: var(--relewise-icon-width, 1em); height: var(--relewise-icon-height, 1em); fill: var(--relewise-icon-color); } `; } } class SortIcon extends i$4 { connectedCallback() { super.connectedCallback(); } render() { return x ` <svg id="svg-icon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M12 13.125C12.3013 13.125 12.5733 13.3052 12.6907 13.5827C12.8081 13.8601 12.7482 14.1808 12.5384 14.3971L8.53844 18.5221C8.39719 18.6678 8.20293 18.75 8.00002 18.75C7.79711 18.75 7.60285 18.6678 7.46159 18.5221L3.46159 14.3971C3.25188 14.1808 3.19192 13.8601 3.30934 13.5827C3.42676 13.3052 3.69877 13.125 4.00002 13.125H7.25002V6C7.25002 5.58579 7.5858 5.25 8.00002 5.25C8.41423 5.25 8.75002 5.58579 8.75002 6V13.125H12Z"/> <path d="M20 10.875C20.3013 10.875 20.5733 10.6948 20.6907 10.4173C20.8081 10.1399 20.7482 9.81916 20.5384 9.60289L16.5384 5.47789C16.3972 5.33222 16.2029 5.25 16 5.25C15.7971 5.25 15.6029 5.33222 15.4616 5.47789L11.4616 9.60289C11.2519 9.81916 11.1919 10.1399 11.3093 10.4173C11.4268 10.6948 11.6988 10.875 12 10.875H15.25V18C15.25 18.4142 15.5858 18.75 16 18.75C16.4142 18.75 16.75 18.4142 16.75 18L16.75 10.875H20Z"/> </svg> `; } static { this.styles = i$7 ` :host { line-height: 1; width: var(--relewise-icon-width, 1em); height: var(--relewise-icon-height, 1em); } #svg-icon { width: var(--relewise-icon-width, 1em); height: var(--relewise-icon-height, 1em); fill: var(--relewise-icon-color); } `; } } class Button extends i$4 { constructor() { super(...arguments); this.buttonText = null; this.handleClick = () => { }; } connectedCallback() { super.connectedCallback(); } render() { return x ` <button class="rw-button rw-border" @click=${() => this.handleClick()}> ${this.buttonText ? x ` <span class="rw-button-text">${this.buttonText}</span> ` : E} <span class="rw-button-icon"><slot slot="icon"></slot></span> </button> `; } static { this.styles = [theme, i$7 ` :host { font-family: var(--font); cursor: pointer; display: block; width: fit-content; height: fit-content; margin: auto; } .rw-button { cursor: pointer; height: inherit; width: inherit; color: white; display: flex; align-items: center; padding: inherit; font-weight: var(--relewise-button-text-font-weight, 600); border-color: var(--relewise-button-border-color, #eee); background-color: var(--button-color, white); color: var(--relewise-button-text-color, #333); border-radius: 0.5em; box-shadow: 0 1px rgb(0 0 0 / 0.05); font-size: 0.9em; justify-content: center; } .rw-button-text { align-items: center; justify-content: center; display: flex; line-height: 1em; padding: .5em .25rem; width: 100%; text-align: left; line-height: 1; } .rw-button-icon { padding: var(--relewise-button-icon-padding, 0.3em .8em); --relewise-icon-color: white; line-height: 1; } `]; } } __decorate([ n$3({ attribute: 'button-text' }) ], Button.prototype, "buttonText", void 0); __decorate([ n$3() ], Button.prototype, "handleClick", void 0); class LoadingSpinner extends i$4 { render() { return x `<div class="loader"></div>`; } static { this.styles = [theme, i$7 ` .loader { border: 16px solid var(--color); border-top: 16px solid; border-radius: 50%; border-top-color: var(--accent-color); width: 120px; height: 120px; animation: spin 2s linear infinite; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }`]; } } class FilterScopesBuilder { constructor() { this.fillScope = undefined; this.defaultScope = undefined; } fill({ apply }) { this.fillScope = { $type: 'Relewise.Client.Requests.Filters.Settings.ApplyFilterSettings, Relewise.Client', apply, }; return this; } default({ apply }) { this.defaultScope = { $type: 'Relewise.Client.Requests.Filters.Settings.ApplyFilterSettings,